text
stringlengths
93
16.4k
id
stringlengths
20
40
metadata
dict
input_ids
listlengths
45
2.05k
attention_mask
listlengths
45
2.05k
complexity
int64
1
9
func TestClient_StderrJSON(t *testing.T) { stderr := new(bytes.Buffer) process := helperProcess("stderr-json") var logBuf bytes.Buffer mutex := new(sync.Mutex) // Custom hclog.Logger testLogger := hclog.New(&hclog.LoggerOptions{ Name: "test-logger", Level: hclog.Trace, Output: &logBuf, Mutex: mutex, }) c := NewClient(&ClientConfig{ Cmd: process, Stderr: stderr, HandshakeConfig: testHandshake, Logger: testLogger, Plugins: testPluginMap, }) defer c.Kill() if _, err := c.Start(); err != nil { t.Fatalf("err: %s", err) } for !c.Exited() { time.Sleep(10 * time.Millisecond) } if c.killed() { t.Fatal("process failed to exit gracefully") } logOut := logBuf.String() if !strings.Contains(logOut, "[\"HELLO\"]\n") { t.Fatalf("missing json list: '%s'", logOut) } if !strings.Contains(logOut, "12345\n") { t.Fatalf("missing line with raw number: '%s'", logOut) } if !strings.Contains(logOut, "{\"a\":1}") { t.Fatalf("missing json object: '%s'", logOut) } }
explode_data.jsonl/57848
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 482 }
[ 2830, 3393, 2959, 62, 22748, 615, 5370, 1155, 353, 8840, 836, 8, 341, 6736, 615, 1669, 501, 23158, 22622, 340, 53314, 1669, 13137, 7423, 445, 36422, 56080, 5130, 2405, 1487, 15064, 5820, 22622, 198, 42622, 1669, 501, 97233, 99014, 340, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
7
func TestWait(t *testing.T) { framework.NewTest(t).Features("usability.observability.wait"). RequiresSingleCluster(). Run(func(t framework.TestContext) { ns := namespace.NewOrFail(t, t, namespace.Config{ Prefix: "default", Inject: true, }) t.Config().ApplyYAMLOrFail(t, ns.Name(), ` apiVersion: networking.istio.io/v1alpha3 kind: VirtualService metadata: name: reviews spec: gateways: [missing-gw] hosts: - reviews http: - route: - destination: host: reviews `) istioCtl := istioctl.NewOrFail(t, t, istioctl.Config{Cluster: t.Clusters().Default()}) istioCtl.InvokeOrFail(t, []string{"x", "wait", "-v", "VirtualService", "reviews." + ns.Name()}) }) }
explode_data.jsonl/57529
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 289 }
[ 2830, 3393, 14190, 1155, 353, 8840, 836, 8, 341, 1166, 5794, 7121, 2271, 1155, 568, 21336, 445, 355, 2897, 13, 22764, 2897, 16294, 38609, 197, 197, 46961, 10888, 28678, 25829, 197, 85952, 18552, 1155, 12626, 8787, 1972, 8, 341, 298, 840...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestSimpleValueMessage(t *testing.T) { frame := plugin.ToFrame("test/data", []mqtt.Message{ { Timestamp: time.Unix(1, 0), Value: "1", }, }) v, err := frame.Fields[1].FloatAt(0) require.NoError(t, err) require.Equal(t, v, float64(1)) }
explode_data.jsonl/79406
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 119 }
[ 2830, 3393, 16374, 1130, 2052, 1155, 353, 8840, 836, 8, 341, 34465, 1669, 9006, 3274, 4369, 445, 1944, 13167, 497, 3056, 86576, 8472, 515, 197, 197, 515, 298, 10261, 4702, 25, 882, 10616, 941, 7, 16, 11, 220, 15, 1326, 298, 47399, 2...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestEncodeAssuredCall(t *testing.T) { call := &Call{ Path: "/test/assured", StatusCode: http.StatusCreated, Method: http.MethodPost, Response: []byte(`{"assured": true}`), Headers: map[string]string{"Content-Length": "19", "User-Agent": "Go-http-client/1.1", "Accept-Encoding": "gzip", "Assured-Status": "403"}, } resp := httptest.NewRecorder() err := encodeAssuredCall(ctx, resp, call) require.NoError(t, err) require.Equal(t, http.StatusCreated, resp.Code) require.Equal(t, `{"assured": true}`, resp.Body.String()) require.Equal(t, "19", resp.Header().Get("Content-Length")) require.Equal(t, "Go-http-client/1.1", resp.Header().Get("User-Agent")) require.Equal(t, "gzip", resp.Header().Get("Accept-Encoding")) require.Empty(t, resp.Header().Get("Assured-Status")) }
explode_data.jsonl/20260
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 319 }
[ 2830, 3393, 32535, 5615, 3073, 7220, 1155, 353, 8840, 836, 8, 341, 67288, 1669, 609, 7220, 515, 197, 69640, 25, 981, 3521, 1944, 14, 395, 3073, 756, 197, 197, 15872, 25, 1758, 10538, 11694, 345, 197, 84589, 25, 257, 1758, 20798, 4133,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestHandler_ServeDNS(t *testing.T) { cfg := Config{ "example.org": Entry{ A: "127.0.0.1", AAAA: "::1", }, } handler := Handler{ logger: zap.L(), cfg: cfg, } tests := []struct { Name string Question dns.Question ExpectedAnswer string }{ { Name: "A example.org", Question: dns.Question{ Name: "example.org", Qtype: dns.TypeA, }, ExpectedAnswer: fmt.Sprintf("example.org\t%d\tIN\tA\t127.0.0.1", TTL), }, { Name: "AAAA example.org", Question: dns.Question{ Name: "example.org", Qtype: dns.TypeAAAA, }, ExpectedAnswer: fmt.Sprintf("example.org\t%d\tIN\tAAAA\t::1", TTL), }, { Name: "A foo.example.org (unknown domain)", Question: dns.Question{ Name: "unknown.example.org", Qtype: dns.TypeA, }, }, { Name: "MX example.org (unsupported type)", Question: dns.Question{ Name: "example.org", Qtype: dns.TypeMX, }, }, } for _, test := range tests { t.Run(test.Name, func(t *testing.T) { w := &testResponseWriter{} handler.ServeDNS(w, &dns.Msg{ Question: []dns.Question{test.Question}, }) require.NotNil(t, w.writtenMsg) if test.ExpectedAnswer != "" && assert.Len(t, w.writtenMsg.Answer, 1) { assert.Equal(t, test.ExpectedAnswer, w.writtenMsg.Answer[0].String()) } }) } }
explode_data.jsonl/13750
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 653 }
[ 2830, 3393, 3050, 1098, 5852, 61088, 1155, 353, 8840, 836, 8, 341, 50286, 1669, 5532, 515, 197, 197, 1, 8687, 2659, 788, 15788, 515, 298, 22985, 25, 262, 330, 16, 17, 22, 13, 15, 13, 15, 13, 16, 756, 298, 197, 25699, 25, 70154, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestNewRefreshData(t *testing.T) { dsn, err := dockertest.RunRedis() require.Nil(t, err) defer dockertest.KillAllDockers() c := initCache(t, dsn) require.NotNil(t, c) d := initNewRefreshData(c) require.NotNil(t, d) }
explode_data.jsonl/48648
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 104 }
[ 2830, 3393, 3564, 14567, 1043, 1155, 353, 8840, 836, 8, 341, 2698, 9613, 11, 1848, 1669, 27549, 83386, 16708, 48137, 741, 17957, 59678, 1155, 11, 1848, 340, 16867, 27549, 83386, 11352, 483, 2403, 41468, 388, 2822, 1444, 1669, 2930, 8233, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestTxs(t *testing.T) { t.Parallel() t.Run("happy path", func(t *testing.T) { t.Parallel() fabBlock, err := getBlock("./mock/sampleblock.pb") assert.NoError(t, err) block, err := FromFabricBlock(fabBlock) assert.NoError(t, err) txs, err := block.Txs() assert.NoError(t, err) for _, tx := range txs { assert.NotNil(t, tx.Data) assert.Equal(t, int32(0), tx.ValidationCode()) assert.Equal(t, "VALID", tx.ValidationStatus()) } }) t.Run("with MVCC_READ_CONFLICT", func(t *testing.T) { t.Parallel() fabBlock, err := getBlock("./mock/mvcc_read_conflict.pb") assert.NoError(t, err) block, err := FromFabricBlock(fabBlock) assert.NoError(t, err) txs, err := block.Txs() assert.NoError(t, err) for _, tx := range txs { assert.NotNil(t, tx.Data) assert.Equal(t, int32(11), tx.ValidationCode()) assert.Equal(t, "MVCC_READ_CONFLICT", tx.ValidationStatus()) } }) }
explode_data.jsonl/40038
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 419 }
[ 2830, 3393, 51, 18561, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 2822, 3244, 16708, 445, 56521, 1815, 497, 2915, 1155, 353, 8840, 836, 8, 341, 197, 3244, 41288, 7957, 2822, 197, 1166, 370, 4713, 11, 1848, 1669, 633, 4713, 13988...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func Test_fileSystemWhitelist(t *testing.T) { testDir, err := ioutil.TempDir("", "") if err != nil { t.Fatalf("Error creating tempdir: %s", err) } fileContents := ` 228 122 0:90 / / rw,relatime - aufs none rw,si=f8e2406af90782bc,dio,dirperm1 229 228 0:98 / /proc rw,nosuid,nodev,noexec,relatime - proc proc rw 230 228 0:99 / /dev rw,nosuid - tmpfs tmpfs rw,size=65536k,mode=755 231 230 0:100 / /dev/pts rw,nosuid,noexec,relatime - devpts devpts rw,gid=5,mode=620,ptmxmode=666 232 228 0:101 / /sys ro,nosuid,nodev,noexec,relatime - sysfs sysfs ro` path := filepath.Join(testDir, "mountinfo") if err := os.MkdirAll(filepath.Dir(path), 0750); err != nil { t.Fatalf("Error creating tempdir: %s", err) } if err := ioutil.WriteFile(path, []byte(fileContents), 0644); err != nil { t.Fatalf("Error writing file contents to %s: %s", path, err) } actualWhitelist, err := fileSystemWhitelist(path) expectedWhitelist := []string{"/kaniko", "/proc", "/dev", "/dev/pts", "/sys", "/var/run"} sort.Strings(actualWhitelist) sort.Strings(expectedWhitelist) testutil.CheckErrorAndDeepEqual(t, false, err, expectedWhitelist, actualWhitelist) }
explode_data.jsonl/79679
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 464 }
[ 2830, 3393, 2458, 2320, 1639, 57645, 1155, 353, 8840, 836, 8, 341, 18185, 6184, 11, 1848, 1669, 43144, 65009, 6184, 19814, 14676, 743, 1848, 961, 2092, 341, 197, 3244, 30762, 445, 1454, 6825, 2730, 3741, 25, 1018, 82, 497, 1848, 340, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
4
func TestGetStandardVMPowerStatusByNodeName(t *testing.T) { ctrl := gomock.NewController(t) defer ctrl.Finish() cloud := GetTestCloud(ctrl) testcases := []struct { name string nodeName string vm compute.VirtualMachine expectedStatus string getErr *retry.Error expectedErrMsg error }{ { name: "GetPowerStatusByNodeName should report error if node don't exist", nodeName: "vm1", vm: compute.VirtualMachine{}, getErr: &retry.Error{ HTTPStatusCode: http.StatusNotFound, RawError: cloudprovider.InstanceNotFound, }, expectedErrMsg: fmt.Errorf("instance not found"), }, { name: "GetPowerStatusByNodeName should get power status as expected", nodeName: "vm2", vm: compute.VirtualMachine{ Name: to.StringPtr("vm2"), VirtualMachineProperties: &compute.VirtualMachineProperties{ InstanceView: &compute.VirtualMachineInstanceView{ Statuses: &[]compute.InstanceViewStatus{ { Code: to.StringPtr("PowerState/Running"), }, }, }, }, }, expectedStatus: "Running", }, { name: "GetPowerStatusByNodeName should get vmPowerStateStopped if vm.InstanceView is nil", nodeName: "vm3", vm: compute.VirtualMachine{ Name: to.StringPtr("vm3"), VirtualMachineProperties: &compute.VirtualMachineProperties{}, }, expectedStatus: vmPowerStateStopped, }, { name: "GetPowerStatusByNodeName should get vmPowerStateStopped if vm.InstanceView.statuses is nil", nodeName: "vm4", vm: compute.VirtualMachine{ Name: to.StringPtr("vm4"), VirtualMachineProperties: &compute.VirtualMachineProperties{ InstanceView: &compute.VirtualMachineInstanceView{}, }, }, expectedStatus: vmPowerStateStopped, }, } for _, test := range testcases { mockVMClient := cloud.VirtualMachinesClient.(*mockvmclient.MockInterface) mockVMClient.EXPECT().Get(gomock.Any(), cloud.ResourceGroup, test.nodeName, gomock.Any()).Return(test.vm, test.getErr).AnyTimes() powerState, err := cloud.VMSet.GetPowerStatusByNodeName(test.nodeName) assert.Equal(t, test.expectedErrMsg, err, test.name) assert.Equal(t, test.expectedStatus, powerState, test.name) } }
explode_data.jsonl/7466
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 921 }
[ 2830, 3393, 1949, 19781, 53, 5781, 1202, 2522, 1359, 1955, 675, 1155, 353, 8840, 836, 8, 341, 84381, 1669, 342, 316, 1176, 7121, 2051, 1155, 340, 16867, 23743, 991, 18176, 741, 197, 12361, 1669, 2126, 2271, 16055, 62100, 692, 18185, 239...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestGetReturnPayloadWithLoopN(t *testing.T) { stmts := []*sysl.Statement{ { Stmt: &sysl.Statement_LoopN{ LoopN: &sysl.LoopN{ Count: 10, Stmt: []*sysl.Statement{ { Stmt: &sysl.Statement_Ret{ Ret: &sysl.Return{ Payload: "test", }, }, }, }, }, }, }, } actual := getReturnPayload(stmts) assert.Equal(t, "test", actual) }
explode_data.jsonl/58748
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 232 }
[ 2830, 3393, 1949, 5598, 29683, 2354, 14620, 45, 1155, 353, 8840, 836, 8, 341, 55822, 82, 1669, 29838, 7791, 75, 70215, 515, 197, 197, 515, 298, 197, 31063, 25, 609, 7791, 75, 70215, 2351, 47306, 45, 515, 571, 197, 14620, 45, 25, 609...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestPKIidOfNil(t *testing.T) { msgCryptoService := NewMCS(&mocks.ChannelPolicyManagerGetter{}, localmsp.NewSigner(), mgmt.NewDeserializersManager()) pkid := msgCryptoService.GetPKIidOfCert(nil) // Check pkid is not nil assert.Nil(t, pkid, "PKID must be nil") }
explode_data.jsonl/26109
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 103 }
[ 2830, 3393, 22242, 40, 307, 2124, 19064, 1155, 353, 8840, 836, 8, 341, 21169, 58288, 1860, 1669, 1532, 44, 6412, 2099, 16712, 82, 38716, 13825, 2043, 31485, 22655, 2205, 92545, 7121, 7264, 261, 1507, 13742, 2501, 7121, 4896, 2848, 12230, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestWSCloseMsgSendOnConnectionClose(t *testing.T) { o := testWSOptions() s := RunServer(o) defer s.Shutdown() wsc, br := testWSCreateClient(t, false, false, o.Websocket.Host, o.Websocket.Port) defer wsc.Close() checkClientsCount(t, s, 1) var c *client s.mu.Lock() for _, cli := range s.clients { c = cli break } s.mu.Unlock() c.closeConnection(ProtocolViolation) msg := testWSReadFrame(t, br) if len(msg) < 2 { t.Fatalf("Should have 2 bytes to represent the status, got %v", msg) } if sc := int(binary.BigEndian.Uint16(msg[:2])); sc != wsCloseStatusProtocolError { t.Fatalf("Expected status to be %v, got %v", wsCloseStatusProtocolError, sc) } expectedPayload := ProtocolViolation.String() if p := string(msg[2:]); p != expectedPayload { t.Fatalf("Expected payload to be %q, got %q", expectedPayload, p) } }
explode_data.jsonl/42720
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 341 }
[ 2830, 3393, 95696, 1469, 6611, 11505, 1925, 4526, 7925, 1155, 353, 8840, 836, 8, 341, 22229, 1669, 1273, 7433, 3798, 741, 1903, 1669, 6452, 5475, 10108, 340, 16867, 274, 10849, 18452, 2822, 6692, 2388, 11, 1411, 1669, 1273, 95696, 964, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
5
func TestGetCatalogOnConversionError(t *testing.T) { // GIVEN tc := newCatalogTC() defer tc.AssertExpectations(t) tc.finderMock.On("FindAll", internal.ClusterWide).Return(tc.fixAddons(), nil).Once() tc.converterMock.On("Convert", tc.fixAddon()).Return(osb.Service{}, tc.fixError()) svc := broker.NewCatalogService(tc.finderMock, tc.converterMock) osbCtx := broker.NewOSBContext("not", "important") // WHEN _, err := svc.GetCatalog(context.Background(), *osbCtx) // THEN assert.EqualError(t, err, fmt.Sprintf("while converting addon to service: %v", tc.fixError())) }
explode_data.jsonl/17449
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 220 }
[ 2830, 3393, 1949, 41606, 1925, 48237, 1454, 1155, 353, 8840, 836, 8, 341, 197, 322, 89836, 198, 78255, 1669, 501, 41606, 7749, 741, 16867, 17130, 11711, 17536, 804, 1155, 692, 78255, 2658, 261, 11571, 8071, 445, 9885, 2403, 497, 5306, 7...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestTraceExporter_WithRecordMetrics(t *testing.T) { te, err := NewTraceExporter(fakeTraceExporterConfig, zap.NewNop(), newTraceDataPusher(nil)) require.Nil(t, err) require.NotNil(t, te) checkRecordedMetricsForTraceExporter(t, te, nil) }
explode_data.jsonl/70310
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 98 }
[ 2830, 3393, 6550, 88025, 62, 2354, 6471, 27328, 1155, 353, 8840, 836, 8, 341, 197, 665, 11, 1848, 1669, 1532, 6550, 88025, 74138, 6550, 88025, 2648, 11, 32978, 7121, 45, 453, 1507, 501, 6550, 1043, 16644, 261, 27907, 1171, 17957, 59678,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func Test_Recovery(t *testing.T) { rec := middleware.NewRecovery() rec.PrintStack = true rec.Logger = nil h := rec.Wrap(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { panic("Foo bar.") })) w := httptest.NewRecorder() r := httptest.NewRequest("GET", "/", nil) h.ServeHTTP(w, r) if w.Code != http.StatusInternalServerError { t.Error("Wrong code %d", w.Code) } }
explode_data.jsonl/81310
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 161 }
[ 2830, 3393, 50693, 7449, 1155, 353, 8840, 836, 8, 341, 67904, 1669, 29679, 7121, 693, 7449, 741, 67904, 7918, 4336, 284, 830, 198, 67904, 12750, 284, 2092, 198, 9598, 1669, 1395, 38968, 19886, 89164, 18552, 3622, 1758, 37508, 11, 435, 3...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestGetEncrypter(t *testing.T) { type args struct { encryption string pubKey crypto.PublicKey } tests := []struct { name string args args want cipher.Encrypter wantErr bool }{ { "aes256cbc", args{ "aes256cbc", secp256k1test.SofiaPublicKey, }, func() cipher.Encrypter { encrypter, _ := aes256cbc.NewEncrypter(secp256k1test.SofiaPublicKey) return encrypter }(), false, }, { "nacl-ecdh", args{ "nacl-ecdh", secp256k1test.SofiaPublicKey, }, func() cipher.Encrypter { encrypter, _ := nacl.NewEncrypter(secp256k1test.SofiaPublicKey) return encrypter }(), false, }, { "noop", args{ "noop", secp256k1test.SofiaPublicKey, }, func() cipher.Encrypter { encrypter, _ := noop.NewEncrypter(secp256k1test.SofiaPublicKey) return encrypter }(), false, }, { "err-empty", args{ "", secp256k1test.SofiaPublicKey, }, nil, true, }, { "err-invalid", args{ "invalid", secp256k1test.SofiaPublicKey, }, nil, true, }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { got, err := GetEncrypter(tt.args.encryption, tt.args.pubKey) if (err != nil) != tt.wantErr { t.Errorf("GetEncrypter() error = %v, wantErr %v", err, tt.wantErr) return } if !assert.Equal(t, tt.want, got) { t.Errorf("GetEncrypter() = %v, want %v", got, tt.want) } }) } }
explode_data.jsonl/46748
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 783 }
[ 2830, 3393, 1949, 61520, 261, 1155, 353, 8840, 836, 8, 341, 13158, 2827, 2036, 341, 197, 197, 79937, 914, 198, 197, 62529, 1592, 257, 19028, 49139, 1592, 198, 197, 532, 78216, 1669, 3056, 1235, 341, 197, 11609, 262, 914, 198, 197, 312...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestHTTPSUpgrade(t *testing.T) { t.Parallel() type testEntry struct { URL string Proto string Status int Location string } tests := []testEntry{ // HTTPS redirect with no header {URL: "http://example.com", Status: 307, Location: "https://example.com"}, {URL: "http://example.com/", Status: 307, Location: "https://example.com/"}, {URL: "http://example.com/no/slash", Status: 307, Location: "https://example.com/no/slash"}, {URL: "http://example.com/trailing/slash/", Status: 307, Location: "https://example.com/trailing/slash/"}, {URL: "http://127.0.0.1", Status: 307, Location: "https://127.0.0.1"}, // no redirect with no header {URL: "https://example.com", Status: 404}, {URL: "https://example.com/", Status: 404}, {URL: "https://127.0.0.1", Status: 404}, // HTTPS redirect with header {URL: "http://example.com", Proto: "http", Status: 307, Location: "https://example.com"}, {URL: "http://example.com", Proto: "HTTP", Status: 307, Location: "https://example.com"}, // no redirect with header {URL: "http://example.com", Proto: "https", Status: 404}, {URL: "http://example.com", Proto: "HTTPS", Status: 404}, // with port {URL: "http://example.com:8080", Status: 307, Location: "https://example.com:8080"}, {URL: "http://127.0.0.1:8080", Status: 307, Location: "https://127.0.0.1:8080"}, {URL: "https://example.com:8080", Status: 404}, {URL: "https://127.0.0.1:8080", Status: 404}, {URL: "http://example.com:8080", Proto: "http", Status: 307, Location: "https://example.com:8080"}, {URL: "http://127.0.0.1:8080", Proto: "http", Status: 307, Location: "https://127.0.0.1:8080"}, // strange situations {URL: "http://127.0.0.1:80", Status: 307, Location: "https://127.0.0.1:80"}, } handler := httpd.NewRedirectHandler(true, false) for n, item := range tests { test := item t.Run(fmt.Sprintf("Test%d", n), func(t *testing.T) { t.Parallel() w := httptest.NewRecorder() r := newRedirectRequest(t, test.URL, "", test.Proto) handler.ServeHTTP(w, r) if w.Code != test.Status { t.Errorf("wrong status code: %d != %d", w.Code, test.Status) } location := w.HeaderMap.Get("Location") if test.Status == 307 && location != test.Location { t.Errorf("wrong Location: %s != %s", location, test.Location) } }) } }
explode_data.jsonl/13967
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 919 }
[ 2830, 3393, 82354, 43861, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 2822, 13158, 1273, 5874, 2036, 341, 197, 79055, 414, 914, 198, 197, 197, 31549, 262, 914, 198, 197, 58321, 256, 526, 198, 197, 197, 4707, 914, 198, 197, 630, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
4
func TestSubscriber(t *testing.T) { client := newFakeClient() s, err := NewSubscriber(client, path, newFactory(""), logger) if err != nil { t.Fatalf("failed to create new Subscriber: %v", err) } defer s.Stop() if _, err := s.Endpoints(); err != nil { t.Fatal(err) } }
explode_data.jsonl/63597
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 112 }
[ 2830, 3393, 40236, 1155, 353, 8840, 836, 8, 341, 25291, 1669, 501, 52317, 2959, 2822, 1903, 11, 1848, 1669, 1532, 40236, 12805, 11, 1815, 11, 501, 4153, 86076, 5925, 340, 743, 1848, 961, 2092, 341, 197, 3244, 30762, 445, 16091, 311, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestSpringProperties(t *testing.T) { source := corev1.EnvVarSource{ ConfigMapKeyRef: &corev1.ConfigMapKeySelector{ Key: "foo", LocalObjectReference: corev1.LocalObjectReference{ Name: "map-name", }, }, } datasources := []v1alpha1.DataSourceObject{ { Name: "dg", Type: "infinispan-hotrod", Properties: []corev1.EnvVar{ { Name: "url", Value: "localhost:11222", }, { Name: "importer.ProtobufName", Value: "accounts.proto", }, }, }, { Name: "sampledb", Type: "postgresql", Properties: []corev1.EnvVar{ { Name: "jdbc-url", Value: "jdbc:postgresql://localhost:5432/sampledb", }, { Name: "password", ValueFrom: &source, }, }, }, } envs, err := convert2SpringProperties(datasources) assert.NotNil(t, envs) assert.Nil(t, err) expected := []corev1.EnvVar{ { Name: "SPRING_TEIID_DATA_INFINISPAN_DG_URL", Value: "localhost:11222", }, { Name: "SPRING_TEIID_DATA_INFINISPAN_DG_IMPORTER_PROTOBUF_NAME", Value: "accounts.proto", }, { Name: "SPRING_DATASOURCE_SAMPLEDB_JDBC_URL", Value: "jdbc:postgresql://localhost:5432/sampledb", }, { Name: "SPRING_DATASOURCE_SAMPLEDB_PASSWORD", ValueFrom: &source, }, } assert.Equal(t, expected, envs) }
explode_data.jsonl/46389
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 682 }
[ 2830, 3393, 25150, 7903, 1155, 353, 8840, 836, 8, 341, 47418, 1669, 6200, 85, 16, 81214, 3962, 3608, 515, 197, 66156, 2227, 1592, 3945, 25, 609, 98645, 16, 10753, 2227, 1592, 5877, 515, 298, 55242, 25, 330, 7975, 756, 298, 82404, 1190...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestExportResourceDictionaryValue(t *testing.T) { t.Parallel() script := ` access(all) resource Foo { access(all) let bar: Int init(bar: Int) { self.bar = bar } } access(all) fun main(): @{String: Foo} { return <- { "a": <- create Foo(bar: 1), "b": <- create Foo(bar: 2) } } ` actual := exportValueFromScript(t, script) expected := cadence.NewDictionary([]cadence.KeyValuePair{ { Key: cadence.NewString("a"), Value: cadence.NewResource([]cadence.Value{ cadence.NewUInt64(0), cadence.NewInt(1), }).WithType(fooResourceType), }, { Key: cadence.NewString("b"), Value: cadence.NewResource([]cadence.Value{ cadence.NewUInt64(0), cadence.NewInt(2), }).WithType(fooResourceType), }, }) assert.Equal(t, expected, actual) }
explode_data.jsonl/4628
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 462 }
[ 2830, 3393, 16894, 4783, 8517, 1130, 1155, 353, 8840, 836, 8, 1476, 3244, 41288, 7957, 2822, 86956, 1669, 22074, 286, 2615, 20388, 8, 5101, 33428, 341, 310, 2615, 20388, 8, 1077, 3619, 25, 1333, 271, 310, 2930, 54630, 25, 1333, 8, 341...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestRaceCondition(t *testing.T) { tev, fl := initialize(t) defer tev.tearDown() it, _ := fl.Iterator(&ab.SeekPosition{Type: &ab.SeekPosition_Specified{Specified: &ab.SeekSpecified{Number: 1}}}) defer it.Close() var status cb.Status complete := make(chan struct{}) go func() { _, status = it.Next() close(complete) }() fl.Append(blockledger.CreateNextBlock(fl, []*cb.Envelope{{Payload: []byte("My Data")}})) <-complete assert.Equal(t, cb.Status_SUCCESS, status, "Expected to successfully read the block") }
explode_data.jsonl/53182
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 204 }
[ 2830, 3393, 55991, 10547, 1155, 353, 8840, 836, 8, 341, 197, 665, 85, 11, 1320, 1669, 9468, 1155, 340, 16867, 1013, 85, 31853, 59342, 2822, 23374, 11, 716, 1669, 1320, 40846, 2099, 370, 76465, 3812, 90, 929, 25, 609, 370, 76465, 3812,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestApiKeyDataAccess(t *testing.T) { Convey("Testing API Key data access", t, func() { InitTestDB(t) Convey("Given saved api key", func() { cmd := m.AddApiKeyCommand{OrgId: 1, Name: "hello", Key: "asd"} err := AddApiKey(&cmd) So(err, ShouldBeNil) Convey("Should be able to get key by name", func() { query := m.GetApiKeyByNameQuery{KeyName: "hello", OrgId: 1} err = GetApiKeyByName(&query) So(err, ShouldBeNil) So(query.Result, ShouldNotBeNil) }) }) }) }
explode_data.jsonl/38976
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 219 }
[ 2830, 3393, 95931, 1043, 6054, 1155, 353, 8840, 836, 8, 1476, 93070, 5617, 445, 16451, 5333, 5309, 821, 2615, 497, 259, 11, 2915, 368, 341, 197, 98762, 2271, 3506, 1155, 692, 197, 93070, 5617, 445, 22043, 6781, 6330, 1376, 497, 2915, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestValidateGenesisBadMessage(t *testing.T) { desc := stakingtypes.NewDescription("testname", "", "", "", "") msg1 := stakingtypes.NewMsgEditValidator(sdk.ValAddress(pk1.Address()), desc, nil, nil) txGen := simapp.MakeTestEncodingConfig().TxConfig txBuilder := txGen.NewTxBuilder() err := txBuilder.SetMsgs(msg1) require.NoError(t, err) tx := txBuilder.GetTx() genesisState := types.NewGenesisStateFromTx(txGen.TxJSONEncoder(), []sdk.Tx{tx}) err = types.ValidateGenesis(genesisState, simapp.MakeTestEncodingConfig().TxConfig.TxJSONDecoder()) require.Error(t, err) }
explode_data.jsonl/76046
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 210 }
[ 2830, 3393, 17926, 84652, 17082, 2052, 1155, 353, 8840, 836, 8, 341, 41653, 1669, 357, 1765, 9242, 7121, 5009, 445, 1944, 606, 497, 7342, 7342, 7342, 85617, 21169, 16, 1669, 357, 1765, 9242, 7121, 6611, 4036, 14256, 1141, 7584, 77819, 4...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func Test_RemoveUnsafeSet(t *testing.T) { a := makeUnsafeSet([]int{6, 3, 1}) a.Remove(3) if a.Cardinality() != 2 { t.Error("RemoveSet should only have 2 items in the set") } if !(a.Contains(6) && a.Contains(1)) { t.Error("RemoveSet should have only items 6 and 1 in the set") } a.Remove(6) a.Remove(1) if a.Cardinality() != 0 { t.Error("RemoveSet should be an empty set after removing 6 and 1") } }
explode_data.jsonl/173
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 171 }
[ 2830, 3393, 66843, 78770, 1649, 1155, 353, 8840, 836, 8, 341, 11323, 1669, 1281, 78770, 1649, 10556, 396, 90, 21, 11, 220, 18, 11, 220, 16, 8824, 11323, 13270, 7, 18, 692, 743, 264, 48613, 80777, 368, 961, 220, 17, 341, 197, 3244, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
5
func TestChannelNotFound_Is(t *testing.T) { cnf := &callbacks.ChannelNotFound{} if errors.Is(nil, &callbacks.ChannelNotFound{}) { t.Error(invalidErrorAssertion) } if errors.Is(fmt.Errorf(wrapMsg), &callbacks.ChannelNotFound{}) { t.Error(invalidErrorAssertion) } if !errors.Is(cnf, &callbacks.ChannelNotFound{}) { t.Errorf(invalidErrorAssertion) } }
explode_data.jsonl/56083
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 149 }
[ 2830, 3393, 9629, 10372, 31879, 1155, 353, 8840, 836, 8, 341, 1444, 31737, 1669, 609, 68311, 38716, 10372, 31483, 743, 5975, 4506, 27907, 11, 609, 68311, 38716, 10372, 28875, 341, 197, 3244, 6141, 5900, 1891, 1454, 68639, 340, 197, 630, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
4
func TestLookUpEnv(t *testing.T) { os.Setenv("CONF_TEST_KEY", "testval") defer os.Unsetenv("CONF_TEST_KEY") r := LookUpEnv("CONF_TEST_KEY") assert.Equal(t, "testval", r) r = LookUpEnv("CONF_TEST_NOT_THERE") assert.Equal(t, "", r) }
explode_data.jsonl/36225
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 118 }
[ 2830, 3393, 10380, 2324, 14359, 1155, 353, 8840, 836, 8, 341, 25078, 4202, 3160, 445, 38634, 11641, 6600, 497, 330, 1944, 831, 1138, 16867, 2643, 10616, 746, 3160, 445, 38634, 11641, 6600, 1138, 7000, 1669, 9192, 2324, 14359, 445, 38634, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestShouldReturnFalseWhenCheckingForSchemaDiffSuppressForTagFilterOfApplicationConfigAndValueCanBeNormalizedAndOldAndNewNormalizedValueAreNotEqual(t *testing.T) { resourceHandle := NewApplicationConfigResourceHandle() schema := resourceHandle.MetaData().Schema oldValue := expressionEntityTypeSrcEqValue newValue := validTagFilter require.False(t, schema[ApplicationConfigFieldTagFilter].DiffSuppressFunc(ApplicationConfigFieldTagFilter, oldValue, newValue, nil)) }
explode_data.jsonl/64926
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 128 }
[ 2830, 3393, 14996, 5598, 4049, 4498, 40129, 2461, 8632, 21751, 17670, 2461, 5668, 5632, 2124, 4988, 2648, 3036, 1130, 69585, 79082, 3036, 18284, 3036, 3564, 79082, 1130, 11526, 2623, 2993, 1155, 353, 8840, 836, 8, 341, 50346, 6999, 1669, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestParseRange(t *testing.T) { type args struct { s string size int64 } tests := []struct { name string args args want []Range wantErr bool }{ { name: "blank", }, { name: "invalid", args: args{ s: "keks=100500", size: 100, }, wantErr: true, }, { name: "invalid single value", args: args{ s: "bytes=200", size: 500, }, wantErr: true, }, { name: "invalid non-digit end", args: args{ s: "bytes=-f", size: 500, }, wantErr: true, }, { name: "invalid no start or end", args: args{ s: "bytes=-", size: 500, }, wantErr: true, }, { name: "invalid non-digit start", args: args{ s: "bytes=f-", size: 500, }, wantErr: true, }, { name: "single", args: args{ s: "bytes=100-200", size: 200, }, want: []Range{ { Start: 100, Length: 100, }, }, }, { name: "no overlap", args: args{ s: "bytes=100-50", size: 200, }, wantErr: true, }, { name: "after end", args: args{ s: "bytes=200-250", size: 200, }, wantErr: true, }, { name: "from offset till end", args: args{ s: "bytes=50-", size: 200, }, want: []Range{ { Start: 50, Length: 150, }, }, }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { got, err := ParseRange(tt.args.s, tt.args.size) if (err != nil) != tt.wantErr { t.Errorf("ParseRange() error = %v, wantErr %v", err, tt.wantErr) return } if !reflect.DeepEqual(got, tt.want) { t.Errorf("ParseRange() got = %v, want %v", got, tt.want) } }) } }
explode_data.jsonl/3956
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 932 }
[ 2830, 3393, 14463, 6046, 1155, 353, 8840, 836, 8, 341, 13158, 2827, 2036, 341, 197, 1903, 262, 914, 198, 197, 13832, 526, 21, 19, 198, 197, 532, 78216, 1669, 3056, 1235, 341, 197, 11609, 262, 914, 198, 197, 31215, 262, 2827, 198, 19...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestSSLVerifyCA(t *testing.T) { maybeSkipSSLTests(t) // Environment sanity check: should fail without SSL checkSSLSetup(t, "sslmode=disable user=pqgossltest") // Not OK according to the system CA _, err := openSSLConn(t, "host=postgres sslmode=verify-ca user=pqgossltest") if err == nil { t.Fatal("expected error") } _, ok := err.(x509.UnknownAuthorityError) if !ok { t.Fatalf("expected x509.UnknownAuthorityError, got %#+v", err) } rootCertPath := filepath.Join(os.Getenv("PQSSLCERTTEST_PATH"), "root.crt") rootCert := "sslrootcert=" + rootCertPath + " " // No match on Common Name, but that's OK _, err = openSSLConn(t, rootCert+"host=127.0.0.1 sslmode=verify-ca user=pqgossltest") if err != nil { t.Fatal(err) } // Everything OK _, err = openSSLConn(t, rootCert+"host=postgres sslmode=verify-ca user=pqgossltest") if err != nil { t.Fatal(err) } }
explode_data.jsonl/1385
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 362 }
[ 2830, 3393, 22594, 32627, 5049, 1155, 353, 8840, 836, 8, 341, 2109, 49791, 35134, 22594, 18200, 1155, 340, 197, 322, 11586, 46842, 1779, 25, 1265, 3690, 2041, 25316, 198, 25157, 22594, 21821, 1155, 11, 330, 24635, 8516, 28, 18015, 1196, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
5
func TestApplyUnsetExclusivelyOwnedFields(t *testing.T) { defer featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, genericfeatures.ServerSideApply, true)() _, client, closeFn := setup(t) defer closeFn() // spec.replicas is a optional, defaulted field // spec.template.spec.hostname is an optional, non-defaulted field apply := []byte(`{ "apiVersion": "apps/v1", "kind": "Deployment", "metadata": { "name": "deployment-exclusive-unset", "labels": {"app": "nginx"} }, "spec": { "replicas": 3, "selector": { "matchLabels": { "app": "nginx" } }, "template": { "metadata": { "labels": { "app": "nginx" } }, "spec": { "hostname": "test-hostname", "containers": [{ "name": "nginx", "image": "nginx:latest" }] } } } }`) _, err := client.CoreV1().RESTClient().Patch(types.ApplyPatchType). AbsPath("/apis/apps/v1"). Namespace("default"). Resource("deployments"). Name("deployment-exclusive-unset"). Param("fieldManager", "apply_test"). Body(apply). Do(context.TODO()). Get() if err != nil { t.Fatalf("Failed to create object using Apply patch: %v", err) } // unset spec.replicas and spec.template.spec.hostname apply = []byte(`{ "apiVersion": "apps/v1", "kind": "Deployment", "metadata": { "name": "deployment-exclusive-unset", "labels": {"app": "nginx"} }, "spec": { "selector": { "matchLabels": { "app": "nginx" } }, "template": { "metadata": { "labels": { "app": "nginx" } }, "spec": { "containers": [{ "name": "nginx", "image": "nginx:latest" }] } } } }`) patched, err := client.CoreV1().RESTClient().Patch(types.ApplyPatchType). AbsPath("/apis/apps/v1"). Namespace("default"). Resource("deployments"). Name("deployment-exclusive-unset"). Param("fieldManager", "apply_test"). Body(apply). Do(context.TODO()). Get() if err != nil { t.Fatalf("Failed to create object using Apply patch: %v", err) } deployment, ok := patched.(*appsv1.Deployment) if !ok { t.Fatalf("Failed to convert response object to Deployment") } if *deployment.Spec.Replicas != 1 { t.Errorf("Expected deployment.spec.replicas to be 1 (default value), but got %d", deployment.Spec.Replicas) } if len(deployment.Spec.Template.Spec.Hostname) != 0 { t.Errorf("Expected deployment.spec.template.spec.hostname to be unset, but got %s", deployment.Spec.Template.Spec.Hostname) } }
explode_data.jsonl/53485
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1119 }
[ 2830, 3393, 28497, 1806, 746, 840, 4163, 3132, 57641, 8941, 1155, 353, 8840, 836, 8, 341, 16867, 4565, 70, 266, 57824, 287, 4202, 13859, 42318, 16014, 2271, 1155, 11, 4094, 12753, 13275, 13859, 42318, 11, 13954, 20304, 22997, 16384, 28497...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
6
func TestClusterGroup(t *testing.T) { data, err := setupTest(t) if err != nil { t.Fatalf("Error when setting up test: %v", err) } defer teardownTest(t, data) skipIfAntreaPolicyDisabled(t, data) initialize(t, data) t.Run("TestGroupClusterGroupValidate", func(t *testing.T) { t.Run("Case=IPBlockWithPodSelectorDenied", func(t *testing.T) { testInvalidCGIPBlockWithPodSelector(t) }) t.Run("Case=IPBlockWithNamespaceSelectorDenied", func(t *testing.T) { testInvalidCGIPBlockWithNSSelector(t) }) t.Run("Case=ServiceRefWithPodSelectorDenied", func(t *testing.T) { testInvalidCGServiceRefWithPodSelector(t) }) t.Run("Case=ServiceRefWithNamespaceSelectorDenied", func(t *testing.T) { testInvalidCGServiceRefWithNSSelector(t) }) t.Run("Case=ServiceRefWithIPBlockDenied", func(t *testing.T) { testInvalidCGServiceRefWithIPBlock(t) }) }) failOnError(k8sUtils.CleanCGs(), t) }
explode_data.jsonl/66401
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 335 }
[ 2830, 3393, 28678, 2808, 1155, 353, 8840, 836, 8, 341, 8924, 11, 1848, 1669, 6505, 2271, 1155, 340, 743, 1848, 961, 2092, 341, 197, 3244, 30762, 445, 1454, 979, 6243, 705, 1273, 25, 1018, 85, 497, 1848, 340, 197, 532, 16867, 49304, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestShouldGetAddedUserGroupsFromBackend(t *testing.T) { mock := mocks.NewMockAutheliaCtx(t) // Setup pointer to john so we can adjust it during the test. user := &authentication.UserDetails{ Username: "john", Groups: []string{ "admin", "users", }, Emails: []string{ "john@example.com", }, } mock.UserProviderMock.EXPECT().GetDetails("john").Return(user, nil).Times(1) verifyGet := VerifyGet(verifyGetCfg) mock.Clock.Set(time.Now()) userSession := mock.Ctx.GetSession() userSession.Username = user.Username userSession.AuthenticationLevel = authentication.TwoFactor userSession.LastActivity = mock.Clock.Now().Unix() userSession.RefreshTTL = mock.Clock.Now().Add(-1 * time.Minute) userSession.Groups = user.Groups userSession.Emails = user.Emails userSession.KeepMeLoggedIn = true err := mock.Ctx.SaveSession(userSession) require.NoError(t, err) mock.Ctx.Request.Header.Set("X-Original-URL", "https://two-factor.example.com") verifyGet(mock.Ctx) assert.Equal(t, 200, mock.Ctx.Response.StatusCode()) mock.Ctx.Request.Header.Set("X-Original-URL", "https://grafana.example.com") verifyGet(mock.Ctx) assert.Equal(t, 403, mock.Ctx.Response.StatusCode()) // Check Refresh TTL has been updated since grafana.example.com has a group subject and refresh is enabled. userSession = mock.Ctx.GetSession() // Check user groups are correct. require.Len(t, userSession.Groups, len(user.Groups)) assert.Equal(t, mock.Clock.Now().Add(5*time.Minute).Unix(), userSession.RefreshTTL.Unix()) assert.Equal(t, "admin", userSession.Groups[0]) assert.Equal(t, "users", userSession.Groups[1]) // Add the grafana group, and force the next request to refresh. user.Groups = append(user.Groups, "grafana") userSession.RefreshTTL = mock.Clock.Now().Add(-1 * time.Second) err = mock.Ctx.SaveSession(userSession) require.NoError(t, err) // Reset otherwise we get the last 403 when we check the Response. Is there a better way to do this? mock.Close() mock = mocks.NewMockAutheliaCtx(t) defer mock.Close() err = mock.Ctx.SaveSession(userSession) assert.NoError(t, err) mock.Clock.Set(time.Now()) gomock.InOrder( mock.UserProviderMock.EXPECT().GetDetails("john").Return(user, nil).Times(1), ) mock.Ctx.Request.Header.Set("X-Original-URL", "https://grafana.example.com") VerifyGet(verifyGetCfg)(mock.Ctx) assert.Equal(t, 200, mock.Ctx.Response.StatusCode()) // Check admin group is removed from the session. userSession = mock.Ctx.GetSession() assert.Equal(t, true, userSession.KeepMeLoggedIn) assert.Equal(t, authentication.TwoFactor, userSession.AuthenticationLevel) assert.Equal(t, mock.Clock.Now().Add(5*time.Minute).Unix(), userSession.RefreshTTL.Unix()) require.Len(t, userSession.Groups, 3) assert.Equal(t, "admin", userSession.Groups[0]) assert.Equal(t, "users", userSession.Groups[1]) assert.Equal(t, "grafana", userSession.Groups[2]) }
explode_data.jsonl/20205
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1075 }
[ 2830, 3393, 14996, 1949, 19337, 1474, 22173, 3830, 29699, 1155, 353, 8840, 836, 8, 341, 77333, 1669, 68909, 7121, 11571, 5087, 35929, 23684, 1155, 692, 197, 322, 18626, 7445, 311, 39642, 773, 582, 646, 7500, 432, 2337, 279, 1273, 624, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestWorkWithoutReady(t *testing.T) { if !runIntegrationTests { t.Skip("To run this test, use: go test -integration") } other_worker := New(Unlimited) if err := other_worker.AddServer(Network, "127.0.0.1:4730"); err != nil { t.Error(err) } if err := other_worker.AddFunc("gearman-go-workertest", foobar, 0); err != nil { t.Error(err) } timeout := make(chan bool, 1) done := make(chan bool, 1) other_worker.JobHandler = func(j Job) error { if !other_worker.ready { t.Error("Worker not ready as expected") } done <- true return nil } go func() { time.Sleep(5 * time.Second) timeout <- true }() go func() { other_worker.Work() }() // With the all-in-one Work() we don't know if the // worker is ready at this stage so we may have to wait a sec: go func() { tries := 5 for tries > 0 { if other_worker.ready { other_worker.Echo([]byte("Hello")) break } // still waiting for it to be ready.. time.Sleep(250 * time.Millisecond) tries-- } }() // determine if we've finished or timed out: select { case <-timeout: t.Error("Test timed out waiting for the worker") case <-done: } }
explode_data.jsonl/43518
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 460 }
[ 2830, 3393, 6776, 26040, 19202, 1155, 353, 8840, 836, 8, 341, 743, 753, 6108, 52464, 18200, 341, 197, 3244, 57776, 445, 1249, 1598, 419, 1273, 11, 990, 25, 728, 1273, 481, 60168, 1138, 197, 532, 197, 1575, 40385, 1669, 1532, 49289, 18...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestClient_GetStorageBackupList(t *testing.T) { server, client, mux := setupTestClient(true) defer server.Close() uri := path.Join(apiStorageBase, dummyUUID, "backups") mux.HandleFunc(uri, func(writer http.ResponseWriter, request *http.Request) { assert.Equal(t, http.MethodGet, request.Method) writer.Header().Set(requestUUIDHeader, dummyRequestUUID) fmt.Fprintf(writer, prepareStorageBackupListHTTPGet()) }) for _, test := range uuidCommonTestCases { res, err := client.GetStorageBackupList(emptyCtx, test.testUUID) if test.isFailed { assert.NotNil(t, err) } else { assert.Nil(t, err, "GetStorageBackupList returned an error %v", err) assert.Equal(t, 1, len(res)) assert.Equal(t, fmt.Sprintf("[%v]", getMockStorageBackup()), fmt.Sprintf("%v", res)) } } }
explode_data.jsonl/40948
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 308 }
[ 2830, 3393, 2959, 13614, 5793, 56245, 852, 1155, 353, 8840, 836, 8, 341, 41057, 11, 2943, 11, 59807, 1669, 6505, 2271, 2959, 3715, 340, 16867, 3538, 10421, 741, 197, 6070, 1669, 1815, 22363, 24827, 5793, 3978, 11, 17292, 24754, 11, 330,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestDockerSaveToFileMultipleImages(t *testing.T) { file := "file" image1 := "image1:tag1" image2 := "image2:tag2" image3 := "image3:tag3" g := NewWithT(t) ctx := context.Background() mockCtrl := gomock.NewController(t) executable := mockexecutables.NewMockExecutable(mockCtrl) executable.EXPECT().Execute(ctx, "save", "-o", file, image1, image2, image3).Return(bytes.Buffer{}, nil) d := executables.NewDocker(executable) g.Expect(d.SaveToFile(ctx, file, image1, image2, image3)).To(Succeed()) }
explode_data.jsonl/6807
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 203 }
[ 2830, 3393, 35, 13659, 8784, 41550, 32089, 14228, 1155, 353, 8840, 836, 8, 341, 17661, 1669, 330, 1192, 698, 31426, 16, 1669, 330, 1805, 16, 25, 4578, 16, 698, 31426, 17, 1669, 330, 1805, 17, 25, 4578, 17, 698, 31426, 18, 1669, 330,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestEtcdListServices(t *testing.T) { ctx := api.NewDefaultContext() fakeClient := tools.NewFakeEtcdClient(t) key := makeServiceListKey(ctx) fakeClient.Data[key] = tools.EtcdResponseWithError{ R: &etcd.Response{ Node: &etcd.Node{ Nodes: []*etcd.Node{ { Value: runtime.EncodeOrDie(latest.Codec, &api.Service{TypeMeta: api.TypeMeta{ID: "foo"}}), }, { Value: runtime.EncodeOrDie(latest.Codec, &api.Service{TypeMeta: api.TypeMeta{ID: "bar"}}), }, }, }, }, E: nil, } registry := NewTestEtcdRegistry(fakeClient) services, err := registry.ListServices(ctx) if err != nil { t.Errorf("unexpected error: %v", err) } if len(services.Items) != 2 || services.Items[0].ID != "foo" || services.Items[1].ID != "bar" { t.Errorf("Unexpected service list: %#v", services) } }
explode_data.jsonl/8164
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 360 }
[ 2830, 3393, 31860, 4385, 852, 11025, 1155, 353, 8840, 836, 8, 341, 20985, 1669, 6330, 7121, 3675, 1972, 741, 1166, 726, 2959, 1669, 7375, 7121, 52317, 31860, 4385, 2959, 1155, 340, 23634, 1669, 1281, 1860, 852, 1592, 7502, 340, 1166, 72...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
5
func TestPageWithAdditionalExtension(t *testing.T) { t.Parallel() cfg, fs := newTestCfg() writeSource(t, fs, filepath.Join("content", "simple.md"), simplePageWithAdditionalExtension) s := buildSingleSite(t, deps.DepsCfg{Fs: fs, Cfg: cfg}, BuildCfg{SkipRender: true}) require.Len(t, s.RegularPages(), 1) p := s.RegularPages()[0] checkPageContent(t, p, "<p>first line.<br />\nsecond line.</p>\n\n<p>fourth line.</p>\n") }
explode_data.jsonl/60615
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 167 }
[ 2830, 3393, 2665, 2354, 29019, 12049, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 741, 50286, 11, 8619, 1669, 501, 2271, 42467, 2822, 24945, 3608, 1155, 11, 8619, 11, 26054, 22363, 445, 1796, 497, 330, 22944, 21324, 3975, 4285, 266...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestBindPanics(t *testing.T) { t.Parallel() ctx := NewIsolate().NewContext() panic := ctx.Bind("panic", func(CallbackArgs) (*Value, error) { panic("aaaah!!") }) ctx.Global().Set("panic", panic) res, err := ctx.Eval(`panic();`, "esplode.js") if err == nil { t.Error("Expected error, got ", res) } else if matched, _ := regexp.MatchString("panic.*aaaah!!", err.Error()); !matched { t.Errorf("Error should mention a panic and 'aaaah!!', but doesn't: %v", err) } }
explode_data.jsonl/81567
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 178 }
[ 2830, 3393, 9950, 35693, 1211, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 741, 20985, 1669, 1532, 3872, 33066, 1005, 3564, 1972, 2822, 30764, 1669, 5635, 32451, 445, 19079, 497, 2915, 3025, 3420, 4117, 8, 4609, 1130, 11, 1465, 8, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestSystemNew(t *testing.T) { sys := NewSystem(1, vec3{}, -1) v0 := (*vec3)(sys.New(0)) if v0 == nil { t.Fatal("System.New() returned nil pointer") } v0eq := (*vec3)(sys.New(0)) if v0 != v0eq { t.Fatal("System.New() invalid pointer for ID already reserved") } v0eq = (*vec3)(sys.Get(0)) if v0 != v0eq { t.Fatal("System.Get() returned different pointer from New()") } v10 := sys.New(10) if v10 == nil { t.Fatal("System.New() returned nil pointer") } v2 := (*vec3)(sys.Get(2)) if v2 != nil { t.Fatal("System.Get() valid pointer for invalid index") } sys.Recycle(0) v0eq = (*vec3)(sys.Get(0)) if v0eq != nil { t.Fatal("recycled index returned data") } sys.Reset() v0eq = (*vec3)(sys.Get(0)) if v0eq != nil { t.Fatal("system still contains valid data after Reset()") } }
explode_data.jsonl/45099
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 354 }
[ 2830, 3393, 2320, 3564, 1155, 353, 8840, 836, 8, 341, 41709, 1669, 1532, 2320, 7, 16, 11, 7486, 18, 22655, 481, 16, 692, 5195, 15, 1669, 4609, 4083, 18, 2376, 7791, 7121, 7, 15, 1171, 743, 348, 15, 621, 2092, 341, 197, 3244, 26133...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
8
func TestJSONEncode(t *testing.T) { script := ` import "json" import "internal/testutil" o = { a:1, b: { x: [1,2], y: "string", z: 1m }, c: 1.1, d: false, e: /.*/, f: 2019-08-14T10:03:12Z, } json.encode(v: o) == bytes(v:"{\"a\":1,\"b\":{\"x\":[1,2],\"y\":\"string\",\"z\":\"1m\"},\"c\":1.1,\"d\":false,\"e\":\".*\",\"f\":\"2019-08-14T10:03:12Z\"}") or testutil.fail() ` ctx := dependenciestest.Default().Inject(context.Background()) if _, _, err := runtime.Eval(ctx, script); err != nil { t.Fatal("evaluation of json.encode failed: ", err) } }
explode_data.jsonl/18037
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 302 }
[ 2830, 3393, 5370, 32535, 1155, 353, 8840, 836, 8, 341, 86956, 1669, 22074, 474, 330, 2236, 698, 474, 330, 10481, 12697, 1314, 1837, 78, 284, 341, 262, 264, 25, 16, 345, 262, 293, 25, 341, 286, 856, 25, 508, 16, 11, 17, 1259, 286, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestRowsUpsert(t *testing.T) { uu := map[string]struct { rows render.Rows row render.Row e render.Rows }{ "add": { rows: render.Rows{ {ID: "a", Fields: []string{"blee", "duh"}}, {ID: "b", Fields: []string{"albert", "blee"}}, }, row: render.Row{ID: "c", Fields: []string{"f1", "f2"}}, e: render.Rows{ {ID: "a", Fields: []string{"blee", "duh"}}, {ID: "b", Fields: []string{"albert", "blee"}}, {ID: "c", Fields: []string{"f1", "f2"}}, }, }, "update": { rows: render.Rows{ {ID: "a", Fields: []string{"blee", "duh"}}, {ID: "b", Fields: []string{"albert", "blee"}}, }, row: render.Row{ID: "a", Fields: []string{"f1", "f2"}}, e: render.Rows{ {ID: "a", Fields: []string{"f1", "f2"}}, {ID: "b", Fields: []string{"albert", "blee"}}, }, }, } for k := range uu { u := uu[k] t.Run(k, func(t *testing.T) { rows := u.rows.Upsert(u.row) assert.Equal(t, u.e, rows) }) } }
explode_data.jsonl/66596
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 497 }
[ 2830, 3393, 9024, 98778, 529, 1155, 353, 8840, 836, 8, 341, 10676, 84, 1669, 2415, 14032, 60, 1235, 341, 197, 68438, 3141, 11332, 198, 197, 33967, 220, 3141, 14657, 198, 197, 7727, 262, 3141, 11332, 198, 197, 59403, 197, 197, 1, 718, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestDeleteImage(t *testing.T) { manager, fakeDocker := newTestDockerManager() fakeDocker.Image = &dockertypes.ImageInspect{ID: "1111", RepoTags: []string{"foo"}} manager.RemoveImage(kubecontainer.ImageSpec{Image: "1111"}) fakeDocker.AssertCallDetails(NewCalledDetail("inspect_image", nil), NewCalledDetail("remove_image", []interface{}{"1111", dockertypes.ImageRemoveOptions{PruneChildren: true}})) }
explode_data.jsonl/31155
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 139 }
[ 2830, 3393, 6435, 1906, 1155, 353, 8840, 836, 8, 341, 92272, 11, 12418, 35, 13659, 1669, 501, 2271, 35, 13659, 2043, 741, 1166, 726, 35, 13659, 7528, 284, 609, 77055, 529, 1804, 7528, 58533, 90, 915, 25, 330, 16, 16, 16, 16, 497, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestOneBackend(t *testing.T) { defer leakcheck.Check(t) r, cleanup := manual.GenerateAndRegisterManualResolver() defer cleanup() test, err := startTestServers(1) if err != nil { t.Fatalf("failed to start servers: %v", err) } defer test.cleanup() cc, err := grpc.Dial(r.Scheme()+":///test.server", grpc.WithInsecure(), grpc.WithBalancerName(roundrobin.Name)) if err != nil { t.Fatalf("failed to dial: %v", err) } defer cc.Close() testc := testpb.NewTestServiceClient(cc) // The first RPC should fail because there's no address. ctx, cancel := context.WithTimeout(context.Background(), time.Millisecond) defer cancel() if _, err := testc.EmptyCall(ctx, &testpb.Empty{}); err == nil || status.Code(err) != codes.DeadlineExceeded { t.Fatalf("EmptyCall() = _, %v, want _, DeadlineExceeded", err) } r.NewAddress([]resolver.Address{{Addr: test.addresses[0]}}) // The second RPC should succeed. if _, err := testc.EmptyCall(context.Background(), &testpb.Empty{}); err != nil { t.Fatalf("EmptyCall() = _, %v, want _, <nil>", err) } }
explode_data.jsonl/44011
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 396 }
[ 2830, 3393, 3966, 29699, 1155, 353, 8840, 836, 8, 341, 16867, 23352, 2028, 10600, 1155, 340, 7000, 11, 21290, 1669, 11376, 57582, 3036, 8690, 52092, 18190, 741, 16867, 21290, 2822, 18185, 11, 1848, 1669, 1191, 2271, 78139, 7, 16, 340, 7...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
6
func TestHealthCheckNodePortE2E(t *testing.T) { ipt := iptablestest.NewFake() ipvs := ipvstest.NewFake() ipset := ipsettest.NewFake(testIPSetVersion) fp := NewFakeProxier(ipt, ipvs, ipset, nil, nil, v1.IPv4Protocol) fp.servicesSynced = true fp.endpointSlicesSynced = true // Add initial service serviceName := "svc1" namespaceName := "ns1" svc := v1.Service{ ObjectMeta: metav1.ObjectMeta{Name: serviceName, Namespace: namespaceName}, Spec: v1.ServiceSpec{ ClusterIP: "172.20.1.1", Selector: map[string]string{"foo": "bar"}, Ports: []v1.ServicePort{{Name: "", TargetPort: intstr.FromInt(80), Protocol: v1.ProtocolTCP}}, Type: "LoadBalancer", HealthCheckNodePort: 30000, ExternalTrafficPolicy: v1.ServiceExternalTrafficPolicyTypeLocal, }, } fp.OnServiceAdd(&svc) fp.syncProxyRules() // Ensure that Proxier updates ipvs appropriately after service's being created assert.NotNil(t, fp.ipsetList["KUBE-HEALTH-CHECK-NODE-PORT"]) activeEntries1 := fp.ipsetList["KUBE-HEALTH-CHECK-NODE-PORT"].activeEntries assert.Equal(t, 1, activeEntries1.Len(), "Expected 1 active entry in KUBE-HEALTH-CHECK-NODE-PORT") assert.Equal(t, true, activeEntries1.Has("30000"), "Expected activeEntries to reference hc node port in spec") // Update health check node port in the spec newSvc := svc newSvc.Spec.HealthCheckNodePort = 30001 fp.OnServiceUpdate(&svc, &newSvc) fp.syncProxyRules() // Ensure that Proxier updates ipvs appropriately after service's being updated assert.NotNil(t, fp.ipsetList["KUBE-HEALTH-CHECK-NODE-PORT"]) activeEntries2 := fp.ipsetList["KUBE-HEALTH-CHECK-NODE-PORT"].activeEntries assert.Equal(t, 1, activeEntries2.Len(), "Expected 1 active entry in KUBE-HEALTH-CHECK-NODE-PORT") assert.Equal(t, true, activeEntries2.Has("30001"), "Expected activeEntries to reference updated hc node port in spec") fp.OnServiceDelete(&svc) fp.syncProxyRules() // Ensure that Proxier updates ipvs appropriately after EndpointSlice delete assert.NotNil(t, fp.ipsetList["KUBE-HEALTH-CHECK-NODE-PORT"]) activeEntries3 := fp.ipsetList["KUBE-HEALTH-CHECK-NODE-PORT"].activeEntries assert.Equal(t, 0, activeEntries3.Len(), "Expected 0 active entries in KUBE-HEALTH-CHECK-NODE-PORT") }
explode_data.jsonl/44377
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 903 }
[ 2830, 3393, 14542, 3973, 1955, 7084, 36, 17, 36, 1155, 353, 8840, 836, 8, 341, 8230, 417, 1669, 66068, 480, 267, 477, 7121, 52317, 741, 46531, 11562, 1669, 45475, 267, 477, 7121, 52317, 741, 46531, 746, 1669, 5997, 746, 1944, 7121, 52...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestUTF16BytesToString(t *testing.T) { input := "abc白鵬翔\u145A6" utf16Bytes := toUTF16Bytes(input) output, _, err := UTF16BytesToString(utf16Bytes) if err != nil { t.Fatal(err) } assert.Equal(t, input, output) }
explode_data.jsonl/32603
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 101 }
[ 2830, 3393, 8561, 16, 21, 7078, 5870, 1155, 353, 8840, 836, 8, 341, 22427, 1669, 330, 13683, 99243, 165, 44706, 102482, 3770, 16, 19, 20, 32, 21, 698, 197, 4762, 16, 21, 7078, 1669, 311, 8561, 16, 21, 7078, 5384, 692, 21170, 11, 8...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestValidateListenersFails(t *testing.T) { tests := []struct { listeners []v1alpha1.Listener msg string }{ { listeners: []v1alpha1.Listener{ { Name: "tcp-listener", Port: 2201, Protocol: "TCP", }, { Name: "tcp-listener", Port: 2202, Protocol: "TCP", }, }, msg: "duplicated name", }, { listeners: []v1alpha1.Listener{ { Name: "tcp-listener-1", Port: 2201, Protocol: "TCP", }, { Name: "tcp-listener-2", Port: 2201, Protocol: "TCP", }, }, msg: "duplicated port/protocol combination", }, } gcv := createGlobalConfigurationValidator() for _, test := range tests { allErrs := gcv.validateListeners(test.listeners, field.NewPath("listeners")) if len(allErrs) == 0 { t.Errorf("validateListeners() returned no errors for invalid input for the case of %s", test.msg) } } }
explode_data.jsonl/11996
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 478 }
[ 2830, 3393, 17926, 31570, 37, 6209, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 3056, 1235, 341, 197, 14440, 18223, 3056, 85, 16, 7141, 16, 64091, 198, 197, 21169, 981, 914, 198, 197, 59403, 197, 197, 515, 298, 14440, 18223, 25, 3056, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestStoreReplicaVisitor(t *testing.T) { defer leaktest.AfterTest(t)() stopper := stop.NewStopper() defer stopper.Stop(context.Background()) store, _ := createTestStore(t, testStoreOpts{ // This test was written before test stores could start with more than one // range and was not adapted. createSystemRanges: false, }, stopper) // Remove range 1. repl1, err := store.GetReplica(1) if err != nil { t.Error(err) } if err := store.RemoveReplica(context.Background(), repl1, repl1.Desc().NextReplicaID, RemoveOptions{ DestroyData: true, }); err != nil { t.Error(err) } // Add 10 new ranges. const newCount = 10 for i := 0; i < newCount; i++ { repl := createReplica(store, roachpb.RangeID(i+1), roachpb.RKey(fmt.Sprintf("a%02d", i)), roachpb.RKey(fmt.Sprintf("a%02d", i+1))) if err := store.AddReplica(repl); err != nil { t.Fatal(err) } } // Verify two passes of the visit, the second one in-order. visitor := newStoreReplicaVisitor(store) exp := make(map[roachpb.RangeID]struct{}) for i := 0; i < newCount; i++ { exp[roachpb.RangeID(i+1)] = struct{}{} } for pass := 0; pass < 2; pass++ { if ec := visitor.EstimatedCount(); ec != 10 { t.Fatalf("expected 10 remaining; got %d", ec) } i := 1 seen := make(map[roachpb.RangeID]struct{}) // Ensure that our next pass is done in-order. if pass == 1 { _ = visitor.InOrder() } var lastRangeID roachpb.RangeID visitor.Visit(func(repl *Replica) bool { if pass == 1 { if repl.RangeID <= lastRangeID { t.Fatalf("on second pass, expect ranges to be visited in ascending range ID order; %d !> %d", repl.RangeID, lastRangeID) } lastRangeID = repl.RangeID } _, ok := seen[repl.RangeID] if ok { t.Fatalf("already saw %d", repl.RangeID) } seen[repl.RangeID] = struct{}{} if ec := visitor.EstimatedCount(); ec != 10-i { t.Fatalf( "expected %d remaining; got %d after seeing %+v", 10-i, ec, seen, ) } i++ return true }) if ec := visitor.EstimatedCount(); ec != 10 { t.Fatalf("expected 10 remaining; got %d", ec) } if !reflect.DeepEqual(exp, seen) { t.Fatalf("got %v, expected %v", seen, exp) } } }
explode_data.jsonl/84
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 915 }
[ 2830, 3393, 6093, 18327, 15317, 16796, 1155, 353, 8840, 836, 8, 341, 16867, 23352, 1944, 36892, 2271, 1155, 8, 741, 62644, 712, 1669, 2936, 7121, 10674, 712, 741, 16867, 2936, 712, 30213, 5378, 19047, 2398, 57279, 11, 716, 1669, 1855, 2...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
5
func TestConverterRecursiveStructWithToReqMissingError(t *testing.T) { fieldMap := make(map[string]codegen.FieldMapperEntry) _, err := convertTypes( "Foo", "Bar", `struct NestedFoo { 1: required string one 2: optional NestedFoo two } struct Foo { 1: required NestedFoo three 2: optional Foo recur } struct Bar { 1: required NestedFoo three 2: optional Bar recur 3: required NestedFoo eight }`, nil, fieldMap, ) assert.Error(t, err) assert.Equal(t, "required toField eight does not have a valid fromField mapping", err.Error()) }
explode_data.jsonl/62096
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 235 }
[ 2830, 3393, 14920, 78542, 9422, 2354, 1249, 27234, 25080, 1454, 1155, 353, 8840, 836, 8, 341, 39250, 2227, 1669, 1281, 9147, 14032, 60, 95859, 17087, 10989, 5874, 692, 197, 6878, 1848, 1669, 5508, 4173, 1006, 197, 197, 1, 40923, 497, 33...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestRouterMethodUndefined(t *testing.T) { request := &http.Request{ URL: &url.URL{ Path: "/sha246:41af286dc0b172ed2f1ca934fd2278de4a1192302ffa07087cea2682e7d372e3", }, Method: "PUT", Body: nil, } ctrl := gomock.NewController(t) defer ctrl.Finish() cmp := setupRouterTestComponents(t, ctrl) cmp.undefinedHandler.EXPECT().ServeHTTP(cmp.types.responseWriter, cmp.types.request) cmp.router.ServeHTTP(cmp.responseWriter, request) }
explode_data.jsonl/3915
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 193 }
[ 2830, 3393, 9523, 3523, 30571, 1155, 353, 8840, 836, 8, 341, 23555, 1669, 609, 1254, 9659, 515, 197, 79055, 25, 609, 1085, 20893, 515, 298, 69640, 25, 3521, 15247, 17, 19, 21, 25, 19, 16, 2577, 17, 23, 21, 7628, 15, 65, 16, 22, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestDaoTagByName(t *testing.T) { var ( c = context.TODO() tname = "" ) convey.Convey("TagByName", t, func(ctx convey.C) { tag, err := d.TagByName(c, tname) ctx.Convey("Then err should be nil.tag should not be nil.", func(ctx convey.C) { ctx.So(err, convey.ShouldBeNil) ctx.So(tag, convey.ShouldNotBeNil) }) }) }
explode_data.jsonl/36686
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 156 }
[ 2830, 3393, 12197, 5668, 16898, 1155, 353, 8840, 836, 8, 341, 2405, 2399, 197, 1444, 257, 284, 2266, 90988, 741, 197, 3244, 606, 284, 8389, 197, 340, 37203, 5617, 4801, 5617, 445, 5668, 16898, 497, 259, 11, 2915, 7502, 20001, 727, 8, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestSetIdempotencyToken(t *testing.T) { cases := []struct { Case interface{} }{ { &struct { Field *string `idempotencyToken:"true"` }{}, }, { &struct { Field string `idempotencyToken:"true"` }{}, }, { &struct { Field *string `idempotencyToken:"true"` }{Field: new(string)}, }, { &struct { Field string `idempotencyToken:"true"` }{Field: ""}, }, } for i, c := range cases { v := reflect.Indirect(reflect.ValueOf(c.Case)) protocol.SetIdempotencyToken(v.Field(0)) if v.Field(0).Interface() == nil { t.Errorf("%d, expect not nil", i) } } }
explode_data.jsonl/78826
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 285 }
[ 2830, 3393, 1649, 764, 3262, 354, 2251, 3323, 1155, 353, 8840, 836, 8, 341, 1444, 2264, 1669, 3056, 1235, 341, 197, 197, 4207, 3749, 16094, 197, 59403, 197, 197, 515, 298, 197, 5, 1235, 341, 571, 94478, 353, 917, 1565, 307, 3262, 35...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestSendEthereumClaimsIgnoreNonSequentialNonces(t *testing.T) { mockCtrl := gomock.NewController(t) defer mockCtrl.Finish() mockCosmos := mocks.NewMockCosmosClient(mockCtrl) mockCosmos.EXPECT().FromAddress().Return(sdk.AccAddress{}).AnyTimes() biggerNonceMatcher := HasBiggerNonce(0) mockCosmos.EXPECT().SyncBroadcastMsg(biggerNonceMatcher).Return(&sdk.TxResponse{}, nil).Times(7) s := peggyBroadcastClient{ daemonQueryClient: nil, broadcastClient: mockCosmos, } // We have events with nonces 1, 2, 3, 4, 5, 6, 7, 9. // So we are missing the 8, meaning events above that won't be relayed deposits := []*wrappers.PeggySendToCosmosEvent{ { EventNonce: big.NewInt(2), Amount: big.NewInt(123), }, { EventNonce: big.NewInt(6), Amount: big.NewInt(456), }, } withdraws := []*wrappers.PeggyTransactionBatchExecutedEvent{ { EventNonce: big.NewInt(1), BatchNonce: big.NewInt(0), }, { EventNonce: big.NewInt(3), BatchNonce: big.NewInt(0), }, } valsetUpdates := []*wrappers.PeggyValsetUpdatedEvent{ { EventNonce: big.NewInt(4), NewValsetNonce: big.NewInt(0), RewardAmount: big.NewInt(0), }, { EventNonce: big.NewInt(5), NewValsetNonce: big.NewInt(0), RewardAmount: big.NewInt(0), }, { EventNonce: big.NewInt(9), NewValsetNonce: big.NewInt(0), RewardAmount: big.NewInt(0), }, } erc20Deployed := []*wrappers.PeggyERC20DeployedEvent{ { EventNonce: big.NewInt(7), }, } s.SendEthereumClaims(context.Background(), 0, deposits, withdraws, valsetUpdates, erc20Deployed, time.Microsecond, ) }
explode_data.jsonl/19861
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 743 }
[ 2830, 3393, 11505, 36, 18532, 372, 51133, 12497, 8121, 22046, 8121, 1603, 1155, 353, 8840, 836, 8, 341, 77333, 15001, 1669, 342, 316, 1176, 7121, 2051, 1155, 340, 16867, 7860, 15001, 991, 18176, 2822, 77333, 54224, 8631, 1669, 68909, 7121...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestSplitStatementToPieces(t *testing.T) { testcases := []struct { input string output string }{{ input: "select * from table", }, { input: "select * from table1; select * from table2;", output: "select * from table1; select * from table2", }, { input: "select * from /* comment ; */ table;", output: "select * from /* comment ; */ table", }, { input: "select * from table where semi = ';';", output: "select * from table where semi = ';'", }, { input: "select * from table1;--comment;\nselect * from table2;", output: "select * from table1;--comment;\nselect * from table2", }, { input: "CREATE TABLE `total_data` (`id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'id', " + "`region` varchar(32) NOT NULL COMMENT 'region name, like zh; th; kepler'," + "`data_size` bigint NOT NULL DEFAULT '0' COMMENT 'data size;'," + "`createtime` datetime NOT NULL DEFAULT NOW() COMMENT 'create time;'," + "`comment` varchar(100) NOT NULL DEFAULT '' COMMENT 'comment'," + "PRIMARY KEY (`id`))", }} for _, tcase := range testcases { if tcase.output == "" { tcase.output = tcase.input } stmtPieces, err := SplitStatementToPieces(tcase.input) if err != nil { t.Errorf("input: %s, err: %v", tcase.input, err) continue } out := strings.Join(stmtPieces, ";") if out != tcase.output { t.Errorf("out: %s, want %s", out, tcase.output) } } }
explode_data.jsonl/3389
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 552 }
[ 2830, 3393, 20193, 8636, 1249, 91225, 1155, 353, 8840, 836, 8, 341, 18185, 23910, 1669, 3056, 1235, 341, 197, 22427, 220, 914, 198, 197, 21170, 914, 198, 197, 15170, 515, 197, 22427, 25, 330, 1742, 353, 504, 1965, 756, 197, 2137, 341,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
5
func TestMCP23017DriverCommandsWriteGPIO(t *testing.T) { mcp, adaptor := initTestMCP23017DriverWithStubbedAdaptor(0) gobottest.Assert(t, mcp.Start(), nil) adaptor.i2cReadImpl = func(b []byte) (int, error) { return len(b), nil } adaptor.i2cWriteImpl = func([]byte) (int, error) { return 0, nil } result := mcp.Command("WriteGPIO")(pinValPort) gobottest.Assert(t, result.(map[string]interface{})["err"], nil) }
explode_data.jsonl/42314
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 172 }
[ 2830, 3393, 44, 7123, 17, 18, 15, 16, 22, 11349, 30479, 7985, 26337, 1155, 353, 8840, 836, 8, 341, 2109, 4672, 11, 91941, 1669, 2930, 2271, 44, 7123, 17, 18, 15, 16, 22, 11349, 2354, 33838, 2721, 2589, 32657, 7, 15, 340, 3174, 674...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestCreateTracesExporter(t *testing.T) { cfg := &Config{ ExporterSettings: config.NewExporterSettings(config.NewIDWithName(typeStr, "customname")), Endpoint: "test-endpoint", AccessToken: "abcd1234", NumWorkers: 3, MaxConnections: 45, DisableCompression: true, AccessTokenPassthroughConfig: splunk.AccessTokenPassthroughConfig{ AccessTokenPassthrough: true, }, } params := component.ExporterCreateParams{Logger: zap.NewNop()} te, err := newSAPMTracesExporter(cfg, params) assert.Nil(t, err) assert.NotNil(t, te, "failed to create trace exporter") assert.NoError(t, te.Shutdown(context.Background()), "trace exporter shutdown failed") }
explode_data.jsonl/72152
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 276 }
[ 2830, 3393, 4021, 1282, 2434, 88025, 1155, 353, 8840, 836, 8, 341, 50286, 1669, 609, 2648, 515, 197, 197, 88025, 6086, 25, 256, 2193, 7121, 88025, 6086, 8754, 7121, 915, 54523, 5808, 2580, 11, 330, 9163, 606, 30154, 197, 197, 27380, 2...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestUnmapIndex(t *testing.T) { e := Engine{prefix: []byte("e-prefix.")} dbID, tableID, colID, err := e.unmapIndex(nil) require.ErrorIs(t, err, ErrIllegalMappedKey) require.Zero(t, dbID) require.Zero(t, tableID) require.Zero(t, colID) dbID, tableID, colID, err = e.unmapIndex([]byte( "e-prefix.CTL.INDEX.a", )) require.ErrorIs(t, err, ErrCorruptedData) require.Zero(t, dbID) require.Zero(t, tableID) require.Zero(t, colID) dbID, tableID, colID, err = e.unmapIndex(append( []byte("e-prefix.CTL.INDEX."), 0x01, 0x02, 0x03, 0x04, 0x11, 0x12, 0x13, 0x14, 0x21, 0x22, 0x23, 0x24, )) require.NoError(t, err) require.EqualValues(t, 0x01020304, dbID) require.EqualValues(t, 0x11121314, tableID) require.EqualValues(t, 0x21222324, colID) }
explode_data.jsonl/64095
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 360 }
[ 2830, 3393, 1806, 2186, 1552, 1155, 353, 8840, 836, 8, 341, 7727, 1669, 8200, 90, 11849, 25, 3056, 3782, 445, 68, 67181, 38739, 630, 20939, 915, 11, 1965, 915, 11, 1375, 915, 11, 1848, 1669, 384, 6307, 2186, 1552, 27907, 340, 17957, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestFeeFilterWireErrors(t *testing.T) { pver := ProtocolVersion pverNoFeeFilter := FeeFilterVersion - 1 wireErr := &MessageError{} baseFeeFilter := NewMsgFeeFilter(123123) // 0x1e0f3 baseFeeFilterEncoded := []byte{ 0xf3, 0xe0, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, } tests := []struct { in *MsgFeeFilter // Value to encode buf []byte // Wire encoding pver uint32 // Protocol version for wire encoding max int // Max size of fixed buffer to induce errors writeErr error // Expected write error readErr error // Expected read error }{ // Latest protocol version with intentional read/write errors. // Force error in minfee. {baseFeeFilter, baseFeeFilterEncoded, pver, 0, io.ErrShortWrite, io.EOF}, // Force error due to unsupported protocol version. {baseFeeFilter, baseFeeFilterEncoded, pverNoFeeFilter, 4, wireErr, wireErr}, } t.Logf("Running %d tests", len(tests)) for i, test := range tests { // Encode to wire format. w := newFixedWriter(test.max) err := test.in.BchEncode(w, test.pver, BaseEncoding) if reflect.TypeOf(err) != reflect.TypeOf(test.writeErr) { t.Errorf("BchEncode #%d wrong error got: %v, want: %v", i, err, test.writeErr) continue } // For errors which are not of type MessageError, check them for // equality. if _, ok := err.(*MessageError); !ok { if err != test.writeErr { t.Errorf("BchEncode #%d wrong error got: %v, "+ "want: %v", i, err, test.writeErr) continue } } // Decode from wire format. var msg MsgFeeFilter r := newFixedReader(test.max, test.buf) err = msg.BchDecode(r, test.pver, BaseEncoding) if reflect.TypeOf(err) != reflect.TypeOf(test.readErr) { t.Errorf("BchDecode #%d wrong error got: %v, want: %v", i, err, test.readErr) continue } // For errors which are not of type MessageError, check them for // equality. if _, ok := err.(*MessageError); !ok { if err != test.readErr { t.Errorf("BchDecode #%d wrong error got: %v, "+ "want: %v", i, err, test.readErr) continue } } } }
explode_data.jsonl/11084
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 892 }
[ 2830, 3393, 41941, 5632, 37845, 13877, 1155, 353, 8840, 836, 8, 341, 3223, 423, 1669, 24572, 5637, 198, 3223, 423, 2753, 41941, 5632, 1669, 40458, 5632, 5637, 481, 220, 16, 198, 6692, 554, 7747, 1669, 609, 2052, 1454, 31483, 24195, 4194...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
8
func TestRateLimiting(t *testing.T) { rl := NewRateLimiter(10) if !within(rl.Limit(10), time.Duration(float32(time.Second)), time.Millisecond) { t.Fatal() } if !within(rl.Limit(10), time.Duration(float32(time.Second*2)), time.Millisecond) { t.Fatal() } if !within(rl.Limit(10), time.Duration(float32(time.Second*3)), time.Millisecond) { t.Fatal() } if within(rl.Limit(10), time.Duration(float32(time.Second*3)), time.Millisecond) { t.Fatal() } rl.UpdateBandwidth(50) if !within(rl.Limit(75), time.Duration(float32(time.Second)*1.5), time.Millisecond) { t.Fatal() } if within(rl.Limit(75), time.Duration(float32(time.Second)*1.5), time.Millisecond) { t.Fatal() } rl.UpdateBandwidth(100) if !within(rl.Limit(1), time.Duration(time.Millisecond*10), time.Millisecond) { t.Fatal() } if within(rl.Limit(1), time.Duration(time.Millisecond*10), time.Millisecond) { t.Fatal() } }
explode_data.jsonl/19245
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 387 }
[ 2830, 3393, 11564, 16527, 287, 1155, 353, 8840, 836, 8, 341, 197, 2381, 1669, 1532, 11564, 43, 17700, 7, 16, 15, 692, 743, 753, 55850, 7, 2381, 1214, 2353, 7, 16, 15, 701, 882, 33795, 8268, 18, 17, 9730, 32435, 5731, 882, 71482, 8...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
9
func TestOrder(t *testing.T) { t.Parallel() if !areTestAPIKeysSet() || !canManipulateRealOrders { t.Skip("skipping test, either api keys or canManipulateRealOrders isnt set correctly") } _, err := f.Order(context.Background(), spotPair, order.Buy.Lower(), "limit", false, false, false, "", 0.0001, 500) if err != nil { t.Error(err) } }
explode_data.jsonl/15189
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 145 }
[ 2830, 3393, 4431, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 741, 743, 753, 546, 2271, 7082, 8850, 1649, 368, 1369, 753, 4814, 92876, 6334, 12768, 24898, 341, 197, 3244, 57776, 445, 4886, 5654, 1273, 11, 2987, 6330, 6894, 476, 6...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
4
func TestBuild_TaskParamsFromTaskResults(t *testing.T) { a := v1alpha1.PipelineTask{Name: "a"} b := v1alpha1.PipelineTask{Name: "b"} c := v1alpha1.PipelineTask{Name: "c"} d := v1alpha1.PipelineTask{Name: "d"} e := v1alpha1.PipelineTask{Name: "e"} xDependsOnA := v1alpha1.PipelineTask{ Name: "x", Params: []v1alpha1.Param{ { Name: "paramX", Value: v1beta1.ArrayOrString{ Type: v1alpha1.ParamTypeString, StringVal: "$(tasks.a.results.resultA)", }, }, }, } yDependsOnBRunsAfterC := v1alpha1.PipelineTask{ Name: "y", RunAfter: []string{"c"}, Params: []v1alpha1.Param{ { Name: "paramB", Value: v1beta1.ArrayOrString{ Type: v1alpha1.ParamTypeString, StringVal: "$(tasks.b.results.resultB)", }, }, }, } zDependsOnDAndE := v1alpha1.PipelineTask{ Name: "z", Params: []v1alpha1.Param{ { Name: "paramZ", Value: v1beta1.ArrayOrString{ Type: v1alpha1.ParamTypeString, StringVal: "$(tasks.d.results.resultD) $(tasks.e.results.resultE)", }, }, }, } // a b c d e // | \ / \ / // x y z nodeA := &dag.Node{Task: a} nodeB := &dag.Node{Task: b} nodeC := &dag.Node{Task: c} nodeD := &dag.Node{Task: d} nodeE := &dag.Node{Task: e} nodeX := &dag.Node{Task: xDependsOnA} nodeY := &dag.Node{Task: yDependsOnBRunsAfterC} nodeZ := &dag.Node{Task: zDependsOnDAndE} nodeA.Next = []*dag.Node{nodeX} nodeB.Next = []*dag.Node{nodeY} nodeC.Next = []*dag.Node{nodeY} nodeD.Next = []*dag.Node{nodeZ} nodeE.Next = []*dag.Node{nodeZ} nodeX.Prev = []*dag.Node{nodeA} nodeY.Prev = []*dag.Node{nodeB, nodeC} nodeZ.Prev = []*dag.Node{nodeD, nodeE} expectedDAG := &dag.Graph{ Nodes: map[string]*dag.Node{ "a": nodeA, "b": nodeB, "c": nodeC, "d": nodeD, "e": nodeE, "x": nodeX, "y": nodeY, "z": nodeZ, }, } p := &v1alpha1.Pipeline{ ObjectMeta: metav1.ObjectMeta{Name: "pipeline"}, Spec: v1alpha1.PipelineSpec{ Tasks: []v1alpha1.PipelineTask{a, b, c, d, e, xDependsOnA, yDependsOnBRunsAfterC, zDependsOnDAndE}, }, } g, err := dag.Build(v1alpha1.PipelineTaskList(p.Spec.Tasks)) if err != nil { t.Fatalf("didn't expect error creating valid Pipeline %v but got %v", p, err) } assertSameDAG(t, expectedDAG, g) }
explode_data.jsonl/69252
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1175 }
[ 2830, 3393, 11066, 77103, 4870, 3830, 6262, 9801, 1155, 353, 8840, 836, 8, 341, 11323, 1669, 348, 16, 7141, 16, 1069, 8790, 6262, 63121, 25, 330, 64, 16707, 2233, 1669, 348, 16, 7141, 16, 1069, 8790, 6262, 63121, 25, 330, 65, 16707, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestEndpointSetCongestionControl(t *testing.T) { testCases := []struct { cc tcpip.CongestionControlOption err *tcpip.Error }{ {"reno", nil}, {"cubic", nil}, {"blahblah", tcpip.ErrNoSuchFile}, } for _, connected := range []bool{false, true} { for _, tc := range testCases { t.Run(fmt.Sprintf("SetSockOpt(.., %v) w/ connected = %v", tc.cc, connected), func(t *testing.T) { c := context.New(t, 1500) defer c.Cleanup() // Create TCP endpoint. var err *tcpip.Error c.EP, err = c.Stack().NewEndpoint(tcp.ProtocolNumber, ipv4.ProtocolNumber, &c.WQ) if err != nil { t.Fatalf("NewEndpoint failed: %v", err) } var oldCC tcpip.CongestionControlOption if err := c.EP.GetSockOpt(&oldCC); err != nil { t.Fatalf("c.EP.SockOpt(%v) = %v", &oldCC, err) } if connected { c.Connect(789 /* iss */, 32768 /* rcvWnd */, nil) } if err := c.EP.SetSockOpt(tc.cc); err != tc.err { t.Fatalf("c.EP.SetSockOpt(%v) = %v, want %v", tc.cc, err, tc.err) } var cc tcpip.CongestionControlOption if err := c.EP.GetSockOpt(&cc); err != nil { t.Fatalf("c.EP.SockOpt(%v) = %v", &cc, err) } got, want := cc, oldCC // If SetSockOpt is expected to succeed then the // returned value for congestion control should match // the one specified in the SetSockOpt above, else it // should be what it was before the call to SetSockOpt. if tc.err == nil { want = tc.cc } if got != want { t.Fatalf("got congestion control: %v, want: %v", got, want) } }) } } }
explode_data.jsonl/22332
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 729 }
[ 2830, 3393, 27380, 1649, 30421, 42498, 3273, 1155, 353, 8840, 836, 8, 341, 18185, 37302, 1669, 3056, 1235, 341, 197, 63517, 220, 28051, 573, 727, 644, 42498, 3273, 5341, 198, 197, 9859, 353, 27161, 573, 6141, 198, 197, 59403, 197, 197, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
8
func Test_SqlDatabaseThroughputSetting_WhenConvertedToHub_RoundTripsWithoutLoss(t *testing.T) { t.Parallel() parameters := gopter.DefaultTestParameters() parameters.MaxSize = 10 properties := gopter.NewProperties(parameters) properties.Property( "Round trip from SqlDatabaseThroughputSetting to hub returns original", prop.ForAll(RunResourceConversionTestForSqlDatabaseThroughputSetting, SqlDatabaseThroughputSettingGenerator())) properties.TestingRun(t, gopter.NewFormatedReporter(false, 240, os.Stdout)) }
explode_data.jsonl/21813
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 157 }
[ 2830, 3393, 1098, 1470, 5988, 23857, 628, 15400, 62, 4498, 61941, 1249, 19316, 2568, 795, 21884, 1690, 26040, 39838, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 741, 67543, 1669, 728, 73137, 13275, 2271, 9706, 741, 67543, 14535, 1695...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestAnswer(t *testing.T) { tests := []struct { input [][]int expect []int }{ { [][]int{ {1, 2, 3}, {4, 5, 6}, {7, 8, 9}, }, []int{1, 2, 4, 7, 5, 3, 6, 8, 9}, }, { [][]int{ {1, 2}, {3, 4}, }, []int{1, 2, 3, 4}, }, { [][]int{ {1}, }, []int{1}, }, } for i, test := range tests { if actual := findDiagonalOrder(test.input); !reflect.DeepEqual(actual, test.expect) { t.Errorf("%d: input = %+v, expect = %+v, actual = %+v", i, test.input, test.expect, actual) } } }
explode_data.jsonl/12307
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 311 }
[ 2830, 3393, 16141, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 3056, 1235, 341, 197, 22427, 220, 52931, 396, 198, 197, 24952, 3056, 396, 198, 197, 59403, 197, 197, 515, 298, 197, 16613, 396, 515, 571, 197, 90, 16, 11, 220, 17, 11, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestHashWithParams(t *testing.T) { c := NewChance() length := 16 actual, err := c.HashWithParams(length, false) if err != nil { t.Errorf("HashWithParams() execution error: %s", err.Error()) } else if len(actual) != length { t.Errorf("HashWithParams() was incorrect, expect: [exactly %d characters], actual: %s.", length, actual) } }
explode_data.jsonl/8929
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 124 }
[ 2830, 3393, 6370, 2354, 4870, 1155, 353, 8840, 836, 8, 341, 1444, 1669, 1532, 76070, 741, 49046, 1669, 220, 16, 21, 198, 88814, 11, 1848, 1669, 272, 15103, 2354, 4870, 21370, 11, 895, 340, 743, 1848, 961, 2092, 341, 197, 3244, 13080, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestNSERetryClient_Register(t *testing.T) { t.Cleanup(func() { goleak.VerifyNone(t) }) var callCounter = &count.CallCounter{} var counter = count.NewNetworkServiceEndpointRegistryClient(callCounter) var client = chain.NewNetworkServiceEndpointRegistryClient( retry.NewNetworkServiceEndpointRegistryClient( context.Background(), retry.WithInterval(time.Millisecond*10), retry.WithTryTimeout(time.Second/30)), counter, injecterror.NewNetworkServiceEndpointRegistryClient(injecterror.WithRegisterErrorTimes(0, 1, 2, 3, 4)), ) var _, err = client.Register(context.Background(), nil) require.NoError(t, err) require.Equal(t, 6, callCounter.Registers()) }
explode_data.jsonl/68611
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 234 }
[ 2830, 3393, 2448, 640, 15149, 2959, 73124, 1155, 353, 8840, 836, 8, 341, 3244, 727, 60639, 18552, 368, 314, 728, 273, 585, 54853, 4064, 1155, 8, 9568, 2405, 1618, 14099, 284, 609, 1830, 27017, 14099, 16094, 2405, 5546, 284, 1760, 7121, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestTRaft_hdlVoteReq(t *testing.T) { ta := require.New(t) bm := NewTailBitmap ids := []int64{1, 2, 3} id := int64(1) testVote := func( cand candStat, voter voterStat, ) (*ElectReply, int64) { ts := newCluster(ids) t1 := ts[0] t1.initTraft( voter.committer, voter.author, voter.logs, voter.nilLogs, nil, voter.votedFor, ) startCluster(ts) defer stopAll(ts) req := &ElectReq{ Candidate: cand.candidateId, Committer: cand.committer, Accepted: bm(0, cand.logs...), } var reply *ElectReply addr := t1.Config.Members[id].Addr rpcTo(addr, func(cli TRaftClient, ctx context.Context) { var err error reply, err = cli.Elect(ctx, req) if err != nil { panic("wtf") } }) return reply, t1.Status[id].VoteExpireAt } lid := NewLeaderId cases := []struct { cand candStat voter voterStat want wantVoteReply }{ // vote granted { candStat{candidateId: lid(2, 2), committer: lid(1, id), logs: []int64{5}}, voterStat{votedFor: lid(0, id), committer: lid(0, id), author: lid(1, id), logs: []int64{5, 6}}, wantVoteReply{ OK: true, votedFor: lid(2, 2), committer: lid(0, id), allLogBitmap: bm(0, 5, 6), logs: "[<001#001:006{set(x, 6)}-0→0>]", }, }, // vote granted // send back nil logs { candStat{candidateId: lid(2, 2), committer: lid(1, id), logs: []int64{5}}, voterStat{votedFor: lid(0, id), committer: lid(0, id), author: lid(1, id), logs: []int64{5, 6, 7}, nilLogs: map[int64]bool{6: true}}, wantVoteReply{ OK: true, votedFor: lid(2, 2), committer: lid(0, id), allLogBitmap: bm(0, 5, 6, 7), logs: "[<>, <001#001:007{set(x, 7)}-0→0>]", }, }, // candidate has no upto date logs { candStat{candidateId: lid(2, 2), committer: lid(0, id), logs: []int64{5, 6}}, voterStat{votedFor: lid(1, id), committer: lid(1, id), author: lid(1, id), logs: []int64{5, 6}}, wantVoteReply{ OK: false, votedFor: lid(1, id), committer: lid(1, id), allLogBitmap: bm(0, 5, 6), logs: "[]", }, }, // candidate has not enough logs // No log is sent back to candidate because it does not need to rebuild // full log history. { candStat{candidateId: lid(2, 2), committer: lid(1, id), logs: []int64{5}}, voterStat{votedFor: lid(1, id), committer: lid(1, id), author: lid(1, id), logs: []int64{5, 6}}, wantVoteReply{ OK: false, votedFor: lid(1, id), committer: lid(1, id), allLogBitmap: bm(0, 5, 6), logs: "[]", }, }, // candidate has smaller term. // No log sent back. { candStat{candidateId: lid(2, 2), committer: lid(1, id), logs: []int64{5, 6}}, voterStat{votedFor: lid(3, id), committer: lid(1, id), author: lid(1, id), logs: []int64{5, 6}}, wantVoteReply{ OK: false, votedFor: lid(3, id), committer: lid(1, id), allLogBitmap: bm(0, 5, 6), logs: "[]", }, }, // candidate has smaller id. // No log sent back. { candStat{candidateId: lid(3, id-1), committer: lid(1, id), logs: []int64{5, 6}}, voterStat{votedFor: lid(3, id), committer: lid(1, id), author: lid(1, id), logs: []int64{5, 6}}, wantVoteReply{ OK: false, votedFor: lid(3, id), committer: lid(1, id), allLogBitmap: bm(0, 5, 6), logs: "[]", }, }, } for i, c := range cases { reply, gotExpire := testVote(c.cand, c.voter) ta.Equal( c.want, wantVoteReply{ OK: reply.OK, votedFor: reply.VotedFor, committer: reply.Committer, allLogBitmap: reply.Accepted, logs: RecordsShortStr(reply.Logs), }, "%d-th: case: %+v", i+1, c) if reply.OK { ta.InDelta(uSecondI64()+leaderLease, gotExpire, 1000*1000*1000) } else { ta.Equal(int64(0), gotExpire) } } }
explode_data.jsonl/17377
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1988 }
[ 2830, 3393, 2378, 64, 723, 66154, 41412, 27234, 1155, 353, 8840, 836, 8, 1476, 197, 2565, 1669, 1373, 7121, 1155, 692, 2233, 76, 1669, 1532, 44795, 16773, 271, 197, 3365, 1669, 3056, 396, 21, 19, 90, 16, 11, 220, 17, 11, 220, 18, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestConfig_GetSenderBonus(t *testing.T) { tt := []struct { count int want sdk.Int }{ {1, sdk.NewInt(0)}, {100, sdk.NewInt(100000000)}, {101, sdk.NewInt(0)}, {500, sdk.NewInt(500000000)}, {510, sdk.NewInt(0)}, } c := NewConfig(sdk.NewDec(100), 30) for i := range tt { tc := tt[i] t.Run(fmt.Sprintf("count=%d", tc.count), func(t *testing.T) { reward := c.GetSenderBonus(tc.count) require.Truef(t, tc.want.Equal(reward), "%s != %s", tc.want, reward) }) } }
explode_data.jsonl/39703
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 247 }
[ 2830, 3393, 2648, 13614, 20381, 48728, 1155, 353, 8840, 836, 8, 341, 3244, 83, 1669, 3056, 1235, 341, 197, 18032, 526, 198, 197, 50780, 220, 45402, 7371, 198, 197, 59403, 197, 197, 90, 16, 11, 45402, 7121, 1072, 7, 15, 39781, 197, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestRejectBadCanaryTrafficValues(t *testing.T) { g := gomega.NewGomegaWithT(t) isvc := makeTestInferenceService() isvc.Spec.Canary = &isvc.Spec.Default isvc.Spec.CanaryTrafficPercent = GetIntReference(-1) g.Expect(isvc.validate(c)).Should(gomega.MatchError(TrafficBoundsExceededError)) isvc.Spec.CanaryTrafficPercent = GetIntReference(101) g.Expect(isvc.validate(c)).Should(gomega.MatchError(TrafficBoundsExceededError)) }
explode_data.jsonl/1491
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 169 }
[ 2830, 3393, 78413, 17082, 6713, 658, 87229, 6227, 1155, 353, 8840, 836, 8, 341, 3174, 1669, 342, 32696, 7121, 38, 32696, 2354, 51, 1155, 340, 19907, 7362, 1669, 1281, 2271, 641, 2202, 1860, 741, 19907, 7362, 36473, 53280, 658, 284, 609,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestContextGetDuration(t *testing.T) { c, _ := CreateTestContext(httptest.NewRecorder()) c.Set("duration", time.Second) assert.Equal(t, time.Second, c.GetDuration("duration")) }
explode_data.jsonl/26752
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 65 }
[ 2830, 3393, 1972, 1949, 12945, 1155, 353, 8840, 836, 8, 341, 1444, 11, 716, 1669, 4230, 2271, 1972, 73392, 83, 70334, 7121, 47023, 2398, 1444, 4202, 445, 17021, 497, 882, 32435, 340, 6948, 12808, 1155, 11, 882, 32435, 11, 272, 2234, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
func TestTrackConnectedRace(t *testing.T) { log := logging.NoLog{} networkID := uint32(0) appVersion := version.NewDefaultVersion("app", 0, 1, 0) versionParser := version.NewDefaultParser() ip0 := utils.IPDesc{ IP: net.IPv6loopback, Port: 0, } id0 := ids.NewShortID(hashing.ComputeHash160Array([]byte(ip0.String()))) ip1 := utils.IPDesc{ IP: net.IPv6loopback, Port: 1, } id1 := ids.NewShortID(hashing.ComputeHash160Array([]byte(ip1.String()))) listener0 := &testListener{ addr: &net.TCPAddr{ IP: net.IPv6loopback, Port: 0, }, inbound: make(chan net.Conn, 1<<10), closed: make(chan struct{}), } caller0 := &testDialer{ addr: &net.TCPAddr{ IP: net.IPv6loopback, Port: 0, }, outbounds: make(map[string]*testListener), } listener1 := &testListener{ addr: &net.TCPAddr{ IP: net.IPv6loopback, Port: 1, }, inbound: make(chan net.Conn, 1<<10), closed: make(chan struct{}), } caller1 := &testDialer{ addr: &net.TCPAddr{ IP: net.IPv6loopback, Port: 1, }, outbounds: make(map[string]*testListener), } caller0.outbounds[ip1.String()] = listener1 caller1.outbounds[ip0.String()] = listener0 serverUpgrader := NewIPUpgrader() clientUpgrader := NewIPUpgrader() vdrs := validators.NewSet() handler := router.Router(nil) net0 := NewDefaultNetwork( prometheus.NewRegistry(), log, id0, ip0, networkID, appVersion, versionParser, listener0, caller0, serverUpgrader, clientUpgrader, vdrs, vdrs, handler, ) assert.NotNil(t, net0) net1 := NewDefaultNetwork( prometheus.NewRegistry(), log, id1, ip1, networkID, appVersion, versionParser, listener1, caller1, serverUpgrader, clientUpgrader, vdrs, vdrs, handler, ) assert.NotNil(t, net1) net0.Track(ip1) go func() { err := net0.Dispatch() assert.Error(t, err) }() go func() { err := net1.Dispatch() assert.Error(t, err) }() err := net0.Close() assert.NoError(t, err) err = net1.Close() assert.NoError(t, err) }
explode_data.jsonl/38084
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 942 }
[ 2830, 3393, 15667, 21146, 55991, 1155, 353, 8840, 836, 8, 341, 6725, 1669, 8392, 16766, 2201, 16094, 9038, 2349, 915, 1669, 2622, 18, 17, 7, 15, 340, 28236, 5637, 1669, 2319, 7121, 3675, 5637, 445, 676, 497, 220, 15, 11, 220, 16, 11...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func Test_Run_Positive_DoNothing(t *testing.T) { // Arrange volumePluginMgr, fakePlugin := volumetesting.GetTestVolumePluginMgr(t) dsw := cache.NewDesiredStateOfWorld(volumePluginMgr) asw := cache.NewActualStateOfWorld(volumePluginMgr) fakeKubeClient := controllervolumetesting.CreateTestClient() fakeRecorder := &record.FakeRecorder{} ad := operationexecutor.NewOperationExecutor(operationexecutor.NewOperationGenerator(fakeKubeClient, volumePluginMgr, fakeRecorder, false /* checkNodeCapabilitiesBeforeMount */)) informerFactory := informers.NewSharedInformerFactory(fakeKubeClient, controller.NoResyncPeriodFunc()) nsu := statusupdater.NewNodeStatusUpdater( fakeKubeClient, informerFactory.Core().V1().Nodes().Lister(), asw) reconciler := NewReconciler( reconcilerLoopPeriod, maxWaitForUnmountDuration, syncLoopPeriod, false, dsw, asw, ad, nsu) // Act ch := make(chan struct{}) go reconciler.Run(ch) defer close(ch) // Assert waitForNewAttacherCallCount(t, 0 /* expectedCallCount */, fakePlugin) verifyNewAttacherCallCount(t, true /* expectZeroNewAttacherCallCount */, fakePlugin) verifyNewDetacherCallCount(t, true /* expectZeroNewDetacherCallCount */, fakePlugin) waitForAttachCallCount(t, 0 /* expectedAttachCallCount */, fakePlugin) waitForDetachCallCount(t, 0 /* expectedDetachCallCount */, fakePlugin) }
explode_data.jsonl/39428
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 444 }
[ 2830, 3393, 84158, 44246, 3404, 93481, 23780, 1155, 353, 8840, 836, 8, 341, 197, 322, 40580, 198, 5195, 4661, 11546, 25567, 11, 12418, 11546, 1669, 62820, 57824, 287, 2234, 2271, 18902, 11546, 25567, 1155, 340, 2698, 2280, 1669, 6500, 712...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func Test_VolumeExists_Positive_VolumeDoesntExistNodeDoesntExists(t *testing.T) { // Arrange volumePluginMgr, _ := controllervolumetesting.GetTestVolumePluginMgr((t)) dsw := NewDesiredStateOfWorld(volumePluginMgr) nodeName := "node-name" volumeName := api.UniqueDeviceName("volume-name") // Act volumeExists := dsw.VolumeExists(volumeName, nodeName) // Assert if volumeExists { t.Fatalf("Volume %q exists, it should not.", volumeName) } volumesToAttach := dsw.GetVolumesToAttach() if len(volumesToAttach) != 0 { t.Fatalf("len(volumesToAttach) Expected: <0> Actual: <%v>", len(volumesToAttach)) } }
explode_data.jsonl/40752
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 228 }
[ 2830, 3393, 2334, 4661, 15575, 44246, 3404, 2334, 4661, 21468, 406, 25613, 1955, 21468, 406, 15575, 1155, 353, 8840, 836, 8, 341, 197, 322, 40580, 198, 5195, 4661, 11546, 25567, 11, 716, 1669, 683, 1100, 648, 1132, 57824, 287, 2234, 227...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestTriangle(t *testing.T) { // go语言使用表格驱动测试 // 定义一个struct数组作为一组测试数据 // a, b作为calcTriangele(a, b int)的参数。c作为calcTriangele(a, b int)的返回结果 tests := []struct { a, b, c int }{ {3, 4, 5}, {5, 12, 13}, {8, 15, 17}, {12, 35, 37}, {30000, 40000, 50000}, } // 遍历表格数据,并调用被测方法 for _, tt := range tests { if actual := calcTriangele(tt.a, tt.b); actual != tt.c { t.Errorf("calcTriangle(%d, %d); got %d; expected %d", tt.a, tt.b, actual, tt.c) } } }
explode_data.jsonl/33034
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 328 }
[ 2830, 3393, 51942, 1155, 353, 8840, 836, 8, 341, 197, 322, 728, 102064, 37029, 112611, 102474, 81705, 198, 197, 322, 41479, 248, 64559, 46944, 1235, 69824, 100622, 108940, 81705, 20074, 198, 197, 322, 264, 11, 293, 100622, 26586, 21884, 8...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestAddLoadBalancerTags(t *testing.T) { loadBalancerName := "test-elb" awsServices := newMockedFakeAWSServices(TestClusterId) c, _ := newAWSCloud(strings.NewReader("[global]"), awsServices) want := make(map[string]string) want["tag1"] = "val1" expectedAddTagsRequest := &elb.AddTagsInput{ LoadBalancerNames: []*string{&loadBalancerName}, Tags: []*elb.Tag{ { Key: aws.String("tag1"), Value: aws.String("val1"), }, }, } awsServices.elb.(*MockedFakeELB).On("AddTags", expectedAddTagsRequest).Return(&elb.AddTagsOutput{}) err := c.addLoadBalancerTags(loadBalancerName, want) assert.Nil(t, err, "Error adding load balancer tags: %v", err) awsServices.elb.(*MockedFakeELB).AssertExpectations(t) }
explode_data.jsonl/29224
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 292 }
[ 2830, 3393, 2212, 5879, 93825, 15930, 1155, 353, 8840, 836, 8, 341, 49386, 93825, 675, 1669, 330, 1944, 83149, 65, 698, 197, 8635, 11025, 1669, 501, 11571, 291, 52317, 14419, 1220, 2161, 31159, 28678, 764, 340, 1444, 11, 716, 1669, 501,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestSoftMergeSanctionThreshold(t *testing.T) { cases := []struct { name string clientSanctionMap map[shared.IIGOSanctionsTier]shared.IIGOSanctionsScore expectedVal map[shared.IIGOSanctionsTier]shared.IIGOSanctionsScore }{ { name: "Basic soft merge", clientSanctionMap: map[shared.IIGOSanctionsTier]shared.IIGOSanctionsScore{ shared.SanctionTier1: shared.IIGOSanctionsScore(3), }, expectedVal: map[shared.IIGOSanctionsTier]shared.IIGOSanctionsScore{ shared.SanctionTier1: 3, shared.SanctionTier2: 5, shared.SanctionTier3: 10, shared.SanctionTier4: 20, shared.SanctionTier5: 30, }, }, { name: "No merge", clientSanctionMap: map[shared.IIGOSanctionsTier]shared.IIGOSanctionsScore{}, expectedVal: map[shared.IIGOSanctionsTier]shared.IIGOSanctionsScore{ shared.SanctionTier1: 1, shared.SanctionTier2: 5, shared.SanctionTier3: 10, shared.SanctionTier4: 20, shared.SanctionTier5: 30, }, }, { name: "More complicated merge", clientSanctionMap: map[shared.IIGOSanctionsTier]shared.IIGOSanctionsScore{ shared.SanctionTier1: 7, shared.SanctionTier2: 9, shared.SanctionTier5: 400, }, expectedVal: map[shared.IIGOSanctionsTier]shared.IIGOSanctionsScore{ shared.SanctionTier1: 7, shared.SanctionTier2: 9, shared.SanctionTier3: 10, shared.SanctionTier4: 20, shared.SanctionTier5: 400, }, }, } for _, tc := range cases { t.Run(tc.name, func(t *testing.T) { res := softMergeSanctionThresholds(tc.clientSanctionMap) if !reflect.DeepEqual(res, tc.expectedVal) { t.Errorf("Expected final transgressions to be %v got %v", tc.expectedVal, res) } }) } }
explode_data.jsonl/74055
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 758 }
[ 2830, 3393, 30531, 52096, 23729, 407, 37841, 1155, 353, 8840, 836, 8, 341, 1444, 2264, 1669, 3056, 1235, 341, 197, 11609, 1060, 914, 198, 197, 25291, 23729, 407, 2227, 2415, 58, 6100, 2447, 1914, 3126, 276, 5136, 70684, 60, 6100, 2447, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestNew(t *testing.T) { r := NewREST(nil, nil, schema.GroupResource{Group: "bears", Resource: "panda"}) require.NotNil(t, r) require.False(t, r.NamespaceScoped()) require.Equal(t, []string{"pinniped"}, r.Categories()) require.IsType(t, &loginapi.TokenCredentialRequest{}, r.New()) require.IsType(t, &loginapi.TokenCredentialRequestList{}, r.NewList()) ctx := context.Background() // check the simple invariants of our no-op list list, err := r.List(ctx, nil) require.NoError(t, err) require.NotNil(t, list) require.IsType(t, &loginapi.TokenCredentialRequestList{}, list) require.Equal(t, "0", list.(*loginapi.TokenCredentialRequestList).ResourceVersion) require.NotNil(t, list.(*loginapi.TokenCredentialRequestList).Items) require.Len(t, list.(*loginapi.TokenCredentialRequestList).Items, 0) // make sure we can turn lists into tables if needed table, err := r.ConvertToTable(ctx, list, nil) require.NoError(t, err) require.NotNil(t, table) require.Equal(t, "0", table.ResourceVersion) require.Nil(t, table.Rows) // exercise group resource - force error by passing a runtime.Object that does not have an embedded object meta _, err = r.ConvertToTable(ctx, &metav1.APIGroup{}, nil) require.Error(t, err, "the resource panda.bears does not support being converted to a Table") }
explode_data.jsonl/23948
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 464 }
[ 2830, 3393, 3564, 1155, 353, 8840, 836, 8, 341, 7000, 1669, 1532, 38307, 27907, 11, 2092, 11, 10802, 5407, 4783, 90, 2808, 25, 330, 65, 7444, 497, 11765, 25, 330, 79, 9817, 23625, 17957, 93882, 1155, 11, 435, 340, 17957, 50757, 1155, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestFlagPreload(t *testing.T) { t.Run("happy code path", func(t *testing.T) { f := GenFixtureFlag() db := PopulateTestDB(f) defer db.Close() err := f.Preload(db) assert.NoError(t, err) }) }
explode_data.jsonl/36838
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 92 }
[ 2830, 3393, 12135, 4703, 1078, 1155, 353, 8840, 836, 8, 341, 3244, 16708, 445, 56521, 2038, 1815, 497, 2915, 1155, 353, 8840, 836, 8, 341, 197, 1166, 1669, 9316, 18930, 12135, 741, 197, 20939, 1669, 70938, 2271, 3506, 955, 340, 197, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
func TestGetByID(t *testing.T) { mockUserRepo := new(mocks.UserRepository) hash, _ := bcrypt.GenerateFromPassword([]byte("super_password"), bcrypt.MinCost) mockUser := model.User{ ID: 1, FullName: "Mr. Test", Email: "mrtest@example.com", Hash: string(hash), IsActive: 1, IsTrashed: 0, } t.Run("success", func(t *testing.T) { existingUser := mockUser mockUserRepo.On("GetUser", mock.Anything, mock.AnythingOfType("int32")). Return(existingUser, nil).Once() u := usecase.NewUserUsecase(mockUserRepo, time.Second*2) user, err := u.GetByID(context.TODO(), 1) assert.NoError(t, err) assert.Equal(t, existingUser.Email, user.Email) assert.Equal(t, "", user.Hash) mockUserRepo.AssertExpectations(t) }) t.Run("not-found", func(t *testing.T) { mockUserRepo.On("GetUser", mock.Anything, mock.AnythingOfType("int32")). Return(model.User{}, errors.New("no row found")).Once() u := usecase.NewUserUsecase(mockUserRepo, time.Second*2) _, err := u.GetByID(context.TODO(), 2) assert.Error(t, err) mockUserRepo.AssertExpectations(t) }) }
explode_data.jsonl/76996
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 474 }
[ 2830, 3393, 1949, 60572, 1155, 353, 8840, 836, 8, 341, 77333, 1474, 25243, 1669, 501, 1255, 25183, 7344, 4624, 692, 50333, 11, 716, 1669, 33520, 57582, 3830, 4876, 10556, 3782, 445, 9522, 10122, 3975, 33520, 17070, 14940, 340, 77333, 1474...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func Test_Mock_AssertNotCalled(t *testing.T) { var mockedService = new(TestExampleImplementation) mockedService.On("Test_Mock_AssertNotCalled", 1, 2, 3).Return(5, 6, 7) mockedService.Called(1, 2, 3) assert.True(t, mockedService.AssertNotCalled(t, "Test_Mock_NotCalled")) }
explode_data.jsonl/8611
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 126 }
[ 2830, 3393, 1245, 1176, 62222, 529, 2623, 20960, 1155, 353, 8840, 836, 8, 8022, 2405, 46149, 1860, 284, 501, 31159, 13314, 36850, 7229, 2109, 67385, 1860, 8071, 445, 2271, 1245, 1176, 62222, 529, 2623, 20960, 497, 220, 16, 11, 220, 17, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func Test_getVMExtensionCannotGetSettings(t *testing.T) { ctx := log.NewSyncLogger(log.NewLogfmtLogger(os.Stdout)) mm := createMockVMExtensionEnvironmentManager() mm.getHandlerSettingsError = errors.New("the settings exist only in a parallel dimension") ii, _ := GetInitializationInfo("yaba", "5.0", true, testEnableCallback) _, err := getVMExtensionInternal(ctx, ii, mm) require.Equal(t, mm.getHandlerSettingsError, err) }
explode_data.jsonl/18581
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 143 }
[ 2830, 3393, 3062, 11187, 12049, 17444, 1949, 6086, 1155, 353, 8840, 836, 8, 341, 20985, 1669, 1487, 7121, 12154, 7395, 12531, 7121, 2201, 12501, 7395, 9638, 83225, 1171, 2109, 76, 1669, 1855, 11571, 11187, 12049, 12723, 2043, 741, 2109, 7...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestSchemaDeleteRelation(t *testing.T) { conn, cleanup, _ := testserver.NewTestServer(require.New(t), 0, memdb.DisableGC, 0, false, testfixtures.EmptyDatastore) t.Cleanup(cleanup) client := v1alpha1.NewSchemaServiceClient(conn) v0client := v0.NewACLServiceClient(conn) // Write a basic schema. _, err := client.WriteSchema(context.Background(), &v1alpha1.WriteSchemaRequest{ Schema: `definition example/user {} definition example/document { relation somerelation: example/user relation anotherrelation: example/user }`, }) require.NoError(t, err) // Write a relationship for one of the relations. _, err = v0client.Write(context.Background(), &v0.WriteRequest{ Updates: []*v0.RelationTupleUpdate{tuple.Create( tuple.MustParse("example/document:somedoc#somerelation@example/user:someuser#..."), )}, }) require.Nil(t, err) // Attempt to delete the `somerelation` relation, which should fail. _, err = client.WriteSchema(context.Background(), &v1alpha1.WriteSchemaRequest{ Schema: `definition example/user {} definition example/document { relation anotherrelation: example/user }`, }) grpcutil.RequireStatus(t, codes.InvalidArgument, err) // Attempt to delete the `anotherrelation` relation, which should succeed. _, err = client.WriteSchema(context.Background(), &v1alpha1.WriteSchemaRequest{ Schema: `definition example/user {} definition example/document { relation somerelation: example/user }`, }) require.Nil(t, err) // Delete the relationship. _, err = v0client.Write(context.Background(), &v0.WriteRequest{ Updates: []*v0.RelationTupleUpdate{tuple.Delete( tuple.MustParse("example/document:somedoc#somerelation@example/user:someuser#..."), )}, }) require.Nil(t, err) // Attempt to delete the `somerelation` relation, which should succeed. writeResp, err := client.WriteSchema(context.Background(), &v1alpha1.WriteSchemaRequest{ Schema: `definition example/user {} definition example/document {}`, }) require.Nil(t, err) rev, err := nspkg.DecodeV1Alpha1Revision(writeResp.ComputedDefinitionsRevision) require.NoError(t, err) require.Len(t, rev, 2) }
explode_data.jsonl/54548
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 749 }
[ 2830, 3393, 8632, 6435, 33790, 1155, 353, 8840, 836, 8, 341, 32917, 11, 21290, 11, 716, 1669, 1273, 4030, 7121, 2271, 5475, 23482, 7121, 1155, 701, 220, 15, 11, 1833, 1999, 10166, 480, 22863, 11, 220, 15, 11, 895, 11, 1273, 45247, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestIfElse(t *testing.T) { const SCRIPT = ` var rv; if (rv === undefined) { rv = "passed"; } else { rv = "failed"; } ` testScript(SCRIPT, asciiString("passed"), t) }
explode_data.jsonl/75231
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 85 }
[ 2830, 3393, 2679, 22971, 1155, 353, 8840, 836, 8, 341, 4777, 53679, 284, 22074, 2405, 17570, 280, 743, 320, 10553, 2049, 5614, 8, 341, 197, 78484, 284, 330, 35422, 876, 197, 92, 770, 341, 197, 78484, 284, 330, 16091, 876, 197, 532, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
func TestScaleUpdate(t *testing.T) { testClient(t, func(e *cli.Engine, i *mocksdk.Interface) { i.On("SystemGet").Return(fxSystem(), nil) i.On("ServiceUpdate", "app1", "web", structs.ServiceUpdateOptions{Count: options.Int(3), Cpu: options.Int(5), Memory: options.Int(10)}).Return(nil) res, err := testExecute(e, "scale web --cpu 5 --memory 10 --count 3 -a app1", nil) require.NoError(t, err) require.Equal(t, 0, res.Code) res.RequireStderr(t, []string{""}) res.RequireStdout(t, []string{"Scaling web... OK"}) }) }
explode_data.jsonl/65999
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 213 }
[ 2830, 3393, 6947, 4289, 1155, 353, 8840, 836, 8, 341, 18185, 2959, 1155, 11, 2915, 2026, 353, 19521, 54424, 11, 600, 353, 16712, 51295, 41065, 8, 341, 197, 8230, 8071, 445, 2320, 1949, 1827, 5598, 955, 87, 2320, 1507, 2092, 340, 197, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestShowCmd(t *testing.T) { mailResponse, err := test.Fixture("mail.json") if err != nil { t.Fatal("read file Error!") } tests := []struct { name string response string want string args []string }{ { "Prints mail ids", mailResponse, "From: batman@superhero.org. Date: 2018-06-08 14:33:55\nSubject: Super Man\nSome message body\n", []string{"foo@baz.org", "-i 123"}, }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { output, err := test.RunCommand(tt.response, tt.args, NewCmdShow) if err != nil { t.Fatalf("error running command `list`: %v", err) } expected := output.String() if expected != tt.want { t.Errorf("It doesn't return mail info, returned: %v, want: %v", expected, tt.want) } }) } }
explode_data.jsonl/14418
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 345 }
[ 2830, 3393, 7812, 15613, 1155, 353, 8840, 836, 8, 341, 2109, 604, 2582, 11, 1848, 1669, 1273, 991, 12735, 445, 3711, 4323, 1138, 743, 1848, 961, 2092, 341, 197, 3244, 26133, 445, 878, 1034, 4600, 22988, 197, 532, 78216, 1669, 3056, 12...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestNotify_OnceSlice(t *testing.T) { callSize := 0 OnceSlice([]os.Signal{syscall.SIGUSR1, syscall.SIGUSR2}, func() { callSize++ }) syscall.Kill(pid, syscall.SIGUSR1) time.Sleep(time.Millisecond) syscall.Kill(pid, syscall.SIGUSR2) time.Sleep(time.Millisecond) syscall.Kill(pid, syscall.SIGUSR1) time.Sleep(time.Millisecond) syscall.Kill(pid, syscall.SIGUSR2) time.Sleep(time.Millisecond) if callSize != 1 { t.Log(callSize) t.Fail() } }
explode_data.jsonl/69856
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 214 }
[ 2830, 3393, 28962, 62, 12522, 33236, 1155, 353, 8840, 836, 8, 341, 67288, 1695, 1669, 220, 15, 198, 197, 12522, 33236, 10556, 436, 75669, 90, 71069, 85086, 49558, 16, 11, 49345, 85086, 49558, 17, 2137, 2915, 368, 314, 1618, 1695, 1027, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestTextInput_ChangedEvent(t *testing.T) { is := is.New(t) var eventArgs *TextInputChangedEventArgs ti := newTextInput(t, TextInputOpts.ChangedHandler(func(args *TextInputChangedEventArgs) { eventArgs = args })) ti.InputText = "foo" render(ti, t) is.Equal(eventArgs.InputText, "foo") }
explode_data.jsonl/51579
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 112 }
[ 2830, 3393, 42762, 27588, 3726, 1556, 1155, 353, 8840, 836, 8, 341, 19907, 1669, 374, 7121, 1155, 692, 2405, 1538, 4117, 353, 42762, 71365, 198, 72859, 1669, 501, 42762, 1155, 11, 42232, 43451, 6353, 3726, 3050, 18552, 7356, 353, 42762, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestAutopilot_RollingUpdate(t *testing.T) { t.Parallel() dir1, s1 := testServerWithConfig(t, func(c *Config) { c.Datacenter = "dc1" c.Bootstrap = true }) defer os.RemoveAll(dir1) defer s1.Shutdown() conf := func(c *Config) { c.Datacenter = "dc1" c.Bootstrap = false } dir2, s2 := testServerWithConfig(t, conf) defer os.RemoveAll(dir2) defer s2.Shutdown() dir3, s3 := testServerWithConfig(t, conf) defer os.RemoveAll(dir3) defer s3.Shutdown() // Join the servers to s1, and wait until they are all promoted to // voters. servers := []*Server{s1, s2, s3} for _, s := range servers[1:] { joinLAN(t, s, s1) } retry.Run(t, func(r *retry.R) { r.Check(wantRaft(servers)) for _, s := range servers { r.Check(wantPeers(s, 3)) } }) // Add one more server like we are doing a rolling update. dir4, s4 := testServerWithConfig(t, conf) defer os.RemoveAll(dir4) defer s4.Shutdown() joinLAN(t, s1, s4) servers = append(servers, s4) retry.Run(t, func(r *retry.R) { r.Check(wantRaft(servers)) for _, s := range servers { r.Check(wantPeers(s, 3)) } }) // Now kill one of the "old" nodes like we are doing a rolling update. s3.Shutdown() isVoter := func() bool { future := s1.raft.GetConfiguration() if err := future.Error(); err != nil { t.Fatalf("err: %v", err) } for _, s := range future.Configuration().Servers { if string(s.ID) == string(s4.config.NodeID) { return s.Suffrage == raft.Voter } } t.Fatalf("didn't find s4") return false } // Wait for s4 to stabilize, get promoted to a voter, and for s3 to be // removed. servers = []*Server{s1, s2, s4} retry.Run(t, func(r *retry.R) { r.Check(wantRaft(servers)) for _, s := range servers { r.Check(wantPeers(s, 3)) } if !isVoter() { r.Fatalf("should be a voter") } }) }
explode_data.jsonl/27413
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 804 }
[ 2830, 3393, 19602, 453, 23958, 2568, 965, 287, 4289, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 741, 48532, 16, 11, 274, 16, 1669, 1273, 5475, 2354, 2648, 1155, 11, 2915, 1337, 353, 2648, 8, 341, 197, 1444, 3336, 3057, 284, 33...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestSelectEntry_DropDown(t *testing.T) { app := test.NewApp() defer test.NewApp() app.Settings().SetTheme(theme.LightTheme()) options := []string{"A", "B", "C"} e := widget.NewSelectEntry(options) w := test.NewWindow(e) defer w.Close() w.Resize(fyne.NewSize(150, 200)) e.Resize(e.MinSize().Max(fyne.NewSize(130, 0))) e.Move(fyne.NewPos(10, 10)) c := w.Canvas() test.AssertImageMatches(t, "select_entry/dropdown_initial.png", c.Capture()) assert.Nil(t, c.Overlays().Top()) switchPos := fyne.NewPos(140-theme.Padding()-theme.IconInlineSize()/2, 10+theme.Padding()+theme.IconInlineSize()/2) test.TapCanvas(c, switchPos) test.AssertImageMatches(t, "select_entry/dropdown_empty_opened.png", c.Capture()) test.TapCanvas(c, fyne.NewPos(50, 15+2*(theme.Padding()+e.Size().Height))) test.AssertImageMatches(t, "select_entry/dropdown_tapped_B.png", c.Capture()) assert.Equal(t, "B", e.Text) test.TapCanvas(c, switchPos) test.AssertImageMatches(t, "select_entry/dropdown_B_opened.png", c.Capture()) test.TapCanvas(c, fyne.NewPos(50, 15+3*(theme.Padding()+e.Size().Height))) test.AssertImageMatches(t, "select_entry/dropdown_tapped_C.png", c.Capture()) assert.Equal(t, "C", e.Text) }
explode_data.jsonl/42144
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 503 }
[ 2830, 3393, 3379, 5874, 1557, 887, 4454, 1155, 353, 8840, 836, 8, 341, 28236, 1669, 1273, 7121, 2164, 741, 16867, 1273, 7121, 2164, 741, 28236, 27000, 1005, 1649, 12594, 57524, 50791, 12594, 12367, 35500, 1669, 3056, 917, 4913, 32, 497, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestQueryEmptyOffers(t *testing.T) { tt := test.Start(t) defer tt.Finish() test.ResetHorizonDB(t, tt.HorizonDB) q := &Q{tt.HorizonSession()} offers, err := q.GetAllOffers() tt.Assert.NoError(err) tt.Assert.Len(offers, 0) updated, err := q.GetUpdatedOffers(0) tt.Assert.NoError(err) tt.Assert.Len(updated, 0) count, err := q.CountOffers() tt.Assert.NoError(err) tt.Assert.Equal(0, count) numRemoved, err := q.CompactOffers(100) tt.Assert.NoError(err) tt.Assert.Equal(int64(0), numRemoved) seq, err := q.GetOfferCompactionSequence() tt.Assert.NoError(err) tt.Assert.Equal(uint32(100), seq) }
explode_data.jsonl/69695
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 277 }
[ 2830, 3393, 2859, 3522, 95509, 1155, 353, 8840, 836, 8, 341, 3244, 83, 1669, 1273, 12101, 1155, 340, 16867, 17853, 991, 18176, 741, 18185, 36660, 39601, 16973, 3506, 1155, 11, 17853, 3839, 269, 16973, 3506, 340, 18534, 1669, 609, 48, 90...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestPlainText(t *testing.T) { text := `hello world \r\n I am GoRequest` ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { // check method is PATCH before going to check other features if r.Method != POST { t.Errorf("Expected method %q; got %q", POST, r.Method) } if r.Header == nil { t.Errorf("Expected non-nil request Header") } if r.Header.Get("Content-Type") != "text/plain" { t.Error("Expected Header Content-Type -> text/plain", "| but got", r.Header.Get("Content-Type")) } defer r.Body.Close() body, _ := ioutil.ReadAll(r.Body) if string(body) != text { t.Error(`Expected text `, text, "| but got", string(body)) } })) defer ts.Close() New().Post(ts.URL). Type("text"). Send(text). End() New().Post(ts.URL). Set("Content-Type", "text/plain"). Send(text). End() }
explode_data.jsonl/25480
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 353 }
[ 2830, 3393, 73248, 1155, 353, 8840, 836, 8, 341, 15425, 1669, 1565, 14990, 1879, 1124, 81, 1699, 358, 1079, 5994, 1900, 19324, 57441, 1669, 54320, 70334, 7121, 5475, 19886, 89164, 18552, 3622, 1758, 37508, 11, 435, 353, 1254, 9659, 8, 3...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
5
func TestEnvShow_Execute(t *testing.T) { mockError := errors.New("some error") testEnv := &config.Environment{ App: "testApp", Name: "testEnv", Region: "us-west-2", AccountID: "123456789012", Prod: false, RegistryURL: "", ExecutionRoleARN: "", ManagerRoleARN: "", } testSvc1 := &config.Service{ App: "testApp", Name: "testSvc1", Type: "load-balanced", } testSvc2 := &config.Service{ App: "testApp", Name: "testSvc2", Type: "load-balanced", } testSvc3 := &config.Service{ App: "testApp", Name: "testSvc3", Type: "load-balanced", } var wantedResources = []*describe.CfnResource{ { Type: "AWS::IAM::Role", PhysicalID: "testApp-testEnv-CFNExecutionRole", }, { Type: "testApp-testEnv-Cluster", PhysicalID: "AWS::ECS::Cluster-jI63pYBWU6BZ", }, } mockTags := map[string]string{"copilot-application": "testApp", "copilot-environment": "testEnv", "key1": "value1", "key2": "value2"} mockEnvDescription := describe.EnvDescription{ Environment: testEnv, Services: []*config.Service{testSvc1, testSvc2, testSvc3}, Tags: mockTags, Resources: wantedResources, } testCases := map[string]struct { inputEnv string shouldOutputJSON bool setupMocks func(mocks showEnvMocks) wantedContent string wantedError error }{ "return error if fail to describe the env": { inputEnv: "testEnv", setupMocks: func(m showEnvMocks) { gomock.InOrder( m.describer.EXPECT().Describe().Return(nil, mockError), ) }, wantedError: fmt.Errorf("describe environment testEnv: some error"), }, "return error if fail to generate JSON output": { inputEnv: "testEnv", shouldOutputJSON: true, setupMocks: func(m showEnvMocks) { gomock.InOrder( m.describer.EXPECT().Describe().Return(&mockEnvDescription, mockError), ) }, wantedError: fmt.Errorf("describe environment testEnv: some error"), }, "success in human format": { inputEnv: "testEnv", setupMocks: func(m showEnvMocks) { gomock.InOrder( m.describer.EXPECT().Describe().Return(&mockEnvDescription, nil), ) }, wantedContent: "About\n\n Name testEnv\n Production false\n Region us-west-2\n Account ID 123456789012\n\nServices\n\n Name Type\n ---- ----\n testSvc1 load-balanced\n testSvc2 load-balanced\n testSvc3 load-balanced\n\nTags\n\n Key Value\n --- -----\n copilot-application testApp\n copilot-environment testEnv\n key1 value1\n key2 value2\n\nResources\n\n AWS::IAM::Role testApp-testEnv-CFNExecutionRole\n testApp-testEnv-Cluster AWS::ECS::Cluster-jI63pYBWU6BZ\n", }, "success in JSON format": { inputEnv: "testEnv", shouldOutputJSON: true, setupMocks: func(m showEnvMocks) { gomock.InOrder( m.describer.EXPECT().Describe().Return(&mockEnvDescription, nil), ) }, wantedContent: "{\"environment\":{\"app\":\"testApp\",\"name\":\"testEnv\",\"region\":\"us-west-2\",\"accountID\":\"123456789012\",\"prod\":false,\"registryURL\":\"\",\"executionRoleARN\":\"\",\"managerRoleARN\":\"\"},\"services\":[{\"app\":\"testApp\",\"name\":\"testSvc1\",\"type\":\"load-balanced\"},{\"app\":\"testApp\",\"name\":\"testSvc2\",\"type\":\"load-balanced\"},{\"app\":\"testApp\",\"name\":\"testSvc3\",\"type\":\"load-balanced\"}],\"tags\":{\"copilot-application\":\"testApp\",\"copilot-environment\":\"testEnv\",\"key1\":\"value1\",\"key2\":\"value2\"},\"resources\":[{\"type\":\"AWS::IAM::Role\",\"physicalID\":\"testApp-testEnv-CFNExecutionRole\"},{\"type\":\"testApp-testEnv-Cluster\",\"physicalID\":\"AWS::ECS::Cluster-jI63pYBWU6BZ\"}]}\n", }, } for name, tc := range testCases { t.Run(name, func(t *testing.T) { ctrl := gomock.NewController(t) defer ctrl.Finish() b := &bytes.Buffer{} mockStoreReader := mocks.NewMockstore(ctrl) mockEnvDescriber := mocks.NewMockenvDescriber(ctrl) mocks := showEnvMocks{ describer: mockEnvDescriber, } tc.setupMocks(mocks) showEnvs := &showEnvOpts{ showEnvVars: showEnvVars{ envName: tc.inputEnv, shouldOutputJSON: tc.shouldOutputJSON, }, store: mockStoreReader, describer: mockEnvDescriber, initEnvDescriber: func() error { return nil }, w: b, } // WHEN err := showEnvs.Execute() // THEN if tc.wantedError != nil { require.EqualError(t, err, tc.wantedError.Error()) } else { require.NoError(t, err) require.Equal(t, tc.wantedContent, b.String(), "expected output content match") } }) } }
explode_data.jsonl/59948
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 2213 }
[ 2830, 3393, 14359, 7812, 83453, 1155, 353, 8840, 836, 8, 341, 77333, 1454, 1669, 5975, 7121, 445, 14689, 1465, 1138, 18185, 14359, 1669, 609, 1676, 45651, 515, 197, 59557, 25, 1060, 330, 1944, 2164, 756, 197, 21297, 25, 1797, 330, 1944,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestNodeGroupForNode(t *testing.T) { gkeManagerMock := &gkeManagerMock{} gke := &GkeCloudProvider{ gkeManager: gkeManagerMock, } n := BuildTestNode("n1", 1000, 1000) n.Spec.ProviderID = "gce://project1/us-central1-b/n1" mig := GkeMig{gceRef: gce.GceRef{Name: "ng1"}} gkeManagerMock.On("GetMigForInstance", mock.AnythingOfType("*gce.GceRef")).Return(&mig, nil).Once() nodeGroup, err := gke.NodeGroupForNode(n) assert.NoError(t, err) assert.Equal(t, mig, *reflect.ValueOf(nodeGroup).Interface().(*GkeMig)) mock.AssertExpectationsForObjects(t, gkeManagerMock) }
explode_data.jsonl/30478
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 246 }
[ 2830, 3393, 1955, 2808, 2461, 1955, 1155, 353, 8840, 836, 8, 341, 3174, 440, 2043, 11571, 1669, 609, 70, 440, 2043, 11571, 16094, 3174, 440, 1669, 609, 38, 440, 16055, 5179, 515, 197, 3174, 440, 2043, 25, 342, 440, 2043, 11571, 345, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestGetComponentFrom(t *testing.T) { type cmpSetting struct { componentName string project string applicationName string debugPort int } tests := []struct { name string isEnvInfo bool componentType string envURL []localConfigProvider.LocalURL cmpSetting cmpSetting want Component wantErr bool }{ { name: "Case 1: Get component when env info file exists", isEnvInfo: true, componentType: "nodejs", envURL: []localConfigProvider.LocalURL{ { Name: "url1", }, }, cmpSetting: cmpSetting{ componentName: "frontend", project: "project1", applicationName: "testing", debugPort: 1234, }, want: Component{ TypeMeta: metav1.TypeMeta{ Kind: "Component", APIVersion: "odo.dev/v1alpha1", }, ObjectMeta: metav1.ObjectMeta{ Name: "frontend", }, Spec: ComponentSpec{ Type: "nodejs", }, Status: ComponentStatus{}, }, }, { name: "Case 2: Get component when env info file does not exists", isEnvInfo: false, componentType: "nodejs", envURL: []localConfigProvider.LocalURL{ { Name: "url2", }, }, cmpSetting: cmpSetting{ componentName: "backend", project: "project2", applicationName: "app1", debugPort: 5896, }, want: Component{}, }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { ctrl := gomock.NewController(t) defer ctrl.Finish() mockLocalConfigProvider := localConfigProvider.NewMockLocalConfigProvider(ctrl) mockLocalConfigProvider.EXPECT().Exists().Return(tt.isEnvInfo) if tt.isEnvInfo { mockLocalConfigProvider.EXPECT().GetName().Return(tt.cmpSetting.componentName) component := getMachineReadableFormat(tt.cmpSetting.componentName, tt.componentType) mockLocalConfigProvider.EXPECT().GetNamespace().Return(tt.cmpSetting.project) component.Namespace = tt.cmpSetting.project mockLocalConfigProvider.EXPECT().GetApplication().Return(tt.cmpSetting.applicationName) mockLocalConfigProvider.EXPECT().GetDebugPort().Return(tt.cmpSetting.debugPort) component.Spec = ComponentSpec{ App: tt.cmpSetting.applicationName, Type: tt.componentType, Ports: []string{fmt.Sprintf("%d", tt.cmpSetting.debugPort)}, } mockLocalConfigProvider.EXPECT().ListURLs().Return(tt.envURL, nil) if len(tt.envURL) > 0 { for _, url := range tt.envURL { component.Spec.URL = append(component.Spec.URL, url.Name) } } tt.want = component } got, err := getComponentFrom(mockLocalConfigProvider, tt.componentType) if (err != nil) != tt.wantErr { t.Errorf("getComponentFrom() error = %v, wantErr %v", err, tt.wantErr) } if !reflect.DeepEqual(got, tt.want) { t.Errorf("getComponentFrom() = %v, want %v", got, tt.want) } }) } }
explode_data.jsonl/4410
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1296 }
[ 2830, 3393, 25640, 3830, 1155, 353, 8840, 836, 8, 341, 13158, 26089, 15400, 2036, 341, 197, 52228, 675, 256, 914, 198, 197, 72470, 260, 914, 198, 197, 197, 5132, 675, 914, 198, 197, 39730, 7084, 981, 526, 198, 197, 532, 78216, 1669, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
6
func TestContainerErrorMsg(t *testing.T) { t.Parallel() if strings.HasSuffix(strings.Split(ptest.Flags.DockerRepo, "/")[0], ".local") { t.Skip("Skipping for local docker repo") } clients := test.Setup(t) names := test.ResourceNames{ Service: test.ObjectNameForTest(t), Image: test.InvalidHelloWorld, } test.EnsureTearDown(t, clients, &names) // Specify an invalid image path // A valid DockerRepo is still needed, otherwise will get UNAUTHORIZED instead of container missing error t.Logf("Creating a new Service %s", names.Service) svc, err := v1b1test.CreateService(t, clients, names) if err != nil { t.Fatal("Failed to create Service:", err) } names.Config = serviceresourcenames.Configuration(svc) names.Route = serviceresourcenames.Route(svc) manifestUnknown := fmt.Sprint(http.StatusNotFound) t.Log("When the imagepath is invalid, the Configuration should have error status.") // Wait for ServiceState becomes NotReady. It also waits for the creation of Configuration. if err := v1b1test.WaitForServiceState(clients.ServingBetaClient, names.Service, v1b1test.IsServiceAndChildrenFailed, "ServiceIsNotReady"); err != nil { t.Fatalf("The Service %s was unexpected state: %v", names.Service, err) } // Checking for "Container image not present in repository" scenario defined in error condition spec err = v1b1test.CheckConfigurationState(clients.ServingBetaClient, names.Config, func(r *v1beta1.Configuration) (bool, error) { cond := r.Status.GetCondition(v1beta1.ConfigurationConditionReady) if cond != nil && !cond.IsUnknown() { if strings.Contains(cond.Message, manifestUnknown) && cond.IsFalse() { return true, nil } t.Logf("Reason: %s ; Message: %s ; Status %s", cond.Reason, cond.Message, cond.Status) return true, fmt.Errorf("The configuration %s was not marked with expected error condition (Reason=%q, Message=%q, Status=%q), but with (Reason=%q, Message=%q, Status=%q)", names.Config, containerMissing, manifestUnknown, "False", cond.Reason, cond.Message, cond.Status) } return false, nil }) if err != nil { t.Fatal("Failed to validate configuration state:", err) } revisionName, err := getRevisionFromConfiguration(clients, names.Config) if err != nil { t.Fatalf("Failed to get revision from configuration %s: %v", names.Config, err) } t.Log("When the imagepath is invalid, the revision should have error status.") err = v1b1test.CheckRevisionState(clients.ServingBetaClient, revisionName, func(r *v1beta1.Revision) (bool, error) { cond := r.Status.GetCondition(v1beta1.RevisionConditionReady) if cond != nil { if cond.Reason == containerMissing && strings.Contains(cond.Message, manifestUnknown) { return true, nil } return true, fmt.Errorf("The revision %s was not marked with expected error condition (Reason=%q, Message=%q), but with (Reason=%q, Message=%q)", revisionName, containerMissing, manifestUnknown, cond.Reason, cond.Message) } return false, nil }) if err != nil { t.Fatal("Failed to validate revision state:", err) } t.Log("Checking to ensure Route is in desired state") err = v1b1test.CheckRouteState(clients.ServingBetaClient, names.Route, v1b1test.IsRouteFailed) if err != nil { t.Fatalf("the Route %s was not desired state: %v", names.Route, err) } }
explode_data.jsonl/34648
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1106 }
[ 2830, 3393, 4502, 89035, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 741, 743, 9069, 16152, 40177, 51442, 19823, 32068, 477, 51887, 909, 13659, 25243, 11, 3521, 17135, 15, 1125, 5933, 2438, 899, 341, 197, 3244, 57776, 445, 85945, 3...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
5
func TestGetCallback(t *testing.T) { scope := DB.NewScope(nil) if DB.Callback().Create().Get("gorm:test_callback") != nil { t.Errorf("`gorm:test_callback` should be nil") } DB.Callback().Create().Register("gorm:test_callback", func(scope *gorm.Scope) { scope.Set("gorm:test_callback_value", 1) }) callback := DB.Callback().Create().Get("gorm:test_callback") if callback == nil { t.Errorf("`gorm:test_callback` should be non-nil") } callback(scope) if v, ok := scope.Get("gorm:test_callback_value"); !ok || v != 1 { t.Errorf("`gorm:test_callback_value` should be `1, true` but `%v, %v`", v, ok) } DB.Callback().Create().Replace("gorm:test_callback", func(scope *gorm.Scope) { scope.Set("gorm:test_callback_value", 2) }) callback = DB.Callback().Create().Get("gorm:test_callback") if callback == nil { t.Errorf("`gorm:test_callback` should be non-nil") } callback(scope) if v, ok := scope.Get("gorm:test_callback_value"); !ok || v != 2 { t.Errorf("`gorm:test_callback_value` should be `2, true` but `%v, %v`", v, ok) } DB.Callback().Create().Remove("gorm:test_callback") if DB.Callback().Create().Get("gorm:test_callback") != nil { t.Errorf("`gorm:test_callback` should be nil") } DB.Callback().Create().Register("gorm:test_callback", func(scope *gorm.Scope) { scope.Set("gorm:test_callback_value", 3) }) callback = DB.Callback().Create().Get("gorm:test_callback") if callback == nil { t.Errorf("`gorm:test_callback` should be non-nil") } callback(scope) if v, ok := scope.Get("gorm:test_callback_value"); !ok || v != 3 { t.Errorf("`gorm:test_callback_value` should be `3, true` but `%v, %v`", v, ok) } }
explode_data.jsonl/13360
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 635 }
[ 2830, 3393, 1949, 7494, 1155, 353, 8840, 836, 8, 341, 66836, 1669, 5952, 7121, 10803, 27907, 692, 743, 5952, 48787, 1005, 4021, 1005, 1949, 445, 73281, 84476, 12519, 899, 961, 2092, 341, 197, 3244, 13080, 93314, 73281, 84476, 12519, 63, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestRoaringPostingsListMin(t *testing.T) { d := NewPostingsList() d.Insert(42) d.Insert(78) d.Insert(103) min, err := d.Min() require.NoError(t, err) require.Equal(t, postings.ID(42), min) d = NewPostingsList() _, err = d.Min() require.Error(t, err) }
explode_data.jsonl/64011
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 118 }
[ 2830, 3393, 38872, 3249, 4133, 819, 852, 6217, 1155, 353, 8840, 836, 8, 341, 2698, 1669, 1532, 4133, 819, 852, 741, 2698, 23142, 7, 19, 17, 340, 2698, 23142, 7, 22, 23, 340, 2698, 23142, 7, 16, 15, 18, 692, 25320, 11, 1848, 1669, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestLoadConfig(t *testing.T) { factories, err := config.ExampleComponents() assert.Nil(t, err) factory := &Factory{} factories.Receivers[configmodels.Type(typeStr)] = factory cfg, err := config.LoadConfigFile(t, path.Join(".", "testdata", "config.yaml"), factories) require.NoError(t, err) require.NotNil(t, cfg) // The receiver `sapm/disabled` doesn't count because disabled receivers // are excluded from the final list. assert.Equal(t, len(cfg.Receivers), 3) r0 := cfg.Receivers["sapm"] assert.Equal(t, r0, factory.CreateDefaultConfig()) r1 := cfg.Receivers["sapm/customname"].(*Config) assert.Equal(t, r1, &Config{ ReceiverSettings: configmodels.ReceiverSettings{ TypeVal: typeStr, NameVal: "sapm/customname", Endpoint: "0.0.0.0:7276", }, }) r2 := cfg.Receivers["sapm/tls"].(*Config) assert.Equal(t, r2, &Config{ ReceiverSettings: configmodels.ReceiverSettings{ TypeVal: typeStr, NameVal: "sapm/tls", Endpoint: ":7276", }, TLSCredentials: &configtls.TLSSetting{ CertFile: "/test.crt", KeyFile: "/test.key", }, }) }
explode_data.jsonl/69650
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 474 }
[ 2830, 3393, 5879, 2648, 1155, 353, 8840, 836, 8, 341, 1166, 52893, 11, 1848, 1669, 2193, 5121, 1516, 10443, 741, 6948, 59678, 1155, 11, 1848, 692, 1166, 2919, 1669, 609, 4153, 16094, 1166, 52893, 2817, 346, 1945, 58, 1676, 6507, 10184, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestCallback(t *testing.T) { user, err := schema.Parse(&UserWithCallback{}, &sync.Map{}, schema.NamingStrategy{}) if err != nil { t.Fatalf("failed to parse user with callback, got error %v", err) } for _, str := range []string{"BeforeSave", "AfterCreate"} { if !reflect.Indirect(reflect.ValueOf(user)).FieldByName(str).Interface().(bool) { t.Errorf("%v should be true", str) } } for _, str := range []string{"BeforeCreate", "BeforeUpdate", "AfterUpdate", "AfterSave", "BeforeDelete", "AfterDelete", "AfterFind"} { if reflect.Indirect(reflect.ValueOf(user)).FieldByName(str).Interface().(bool) { t.Errorf("%v should be false", str) } } }
explode_data.jsonl/68750
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 238 }
[ 2830, 3393, 7494, 1155, 353, 8840, 836, 8, 341, 19060, 11, 1848, 1669, 10802, 8937, 2099, 1474, 2354, 7494, 22655, 609, 12996, 10104, 22655, 10802, 2067, 6469, 19816, 37790, 743, 1848, 961, 2092, 341, 197, 3244, 30762, 445, 16091, 311, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
6
func TestClientPreRequestHook(t *testing.T) { client := dc() client.SetPreRequestHook(func(c *Client, r *http.Request) error { c.log.Debugf("I'm in Pre-Request Hook") return nil }) client.SetPreRequestHook(func(c *Client, r *http.Request) error { c.log.Debugf("I'm Overwriting existing Pre-Request Hook") // Reading Request `N` no of times for i := 0; i < 5; i++ { b, _ := r.GetBody() rb, _ := ioutil.ReadAll(b) c.log.Debugf("%s %v", string(rb), len(rb)) assertEqual(t, true, len(rb) >= 45) } return nil }) ts := createPostServer(t) defer ts.Close() // Regular bodybuf use case resp, _ := client.R(). SetBody(map[string]interface{}{"username": "testuser", "password": "testpass"}). Post(ts.URL + "/login") assertEqual(t, http.StatusOK, resp.StatusCode()) assertEqual(t, `{ "id": "success", "message": "login successful" }`, resp.String()) // io.Reader body use case resp, _ = client.R(). SetHeader(hdrContentTypeKey, jsonContentType). SetBody(bytes.NewReader([]byte(`{"username":"testuser", "password":"testpass"}`))). Post(ts.URL + "/login") assertEqual(t, http.StatusOK, resp.StatusCode()) assertEqual(t, `{ "id": "success", "message": "login successful" }`, resp.String()) }
explode_data.jsonl/39352
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 476 }
[ 2830, 3393, 2959, 4703, 1900, 31679, 1155, 353, 8840, 836, 8, 341, 25291, 1669, 19402, 741, 25291, 4202, 4703, 1900, 31679, 18552, 1337, 353, 2959, 11, 435, 353, 1254, 9659, 8, 1465, 341, 197, 1444, 1665, 88278, 445, 40, 2776, 304, 49...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestTLSHandshakeConn(t *testing.T) { SetLogger(testLogger{t}) connector, err := NewConnector(makeConnStr(t).String()) if err != nil { t.Error(err) } ctx, cancel := context.WithTimeout(context.Background(), time.Second*30) defer cancel() toconn, err := dialConnection(ctx, connector, connector.params) if err != nil { t.Error(err) } outbuf := newTdsBuffer(connector.params.packetSize, toconn) handshakeConn := tlsHandshakeConn{buf: outbuf} t.Run(`set deadline`, func(t *testing.T) { defer assertPanic(t, false) deadline := time.Now().Add(time.Millisecond * 100) err := handshakeConn.SetDeadline(deadline) if err != nil { t.Fatalf(`SetDeadline should return nil`) } }) t.Run(`set read deadline`, func(t *testing.T) { defer assertPanic(t, false) deadline := time.Now().Add(time.Minute) err := handshakeConn.SetReadDeadline(deadline) if err != nil { t.Fatalf(`SetReadDeadline should return nil`) } }) t.Run(`set write deadline`, func(t *testing.T) { defer assertPanic(t, false) deadline := time.Now().Add(time.Minute) err := handshakeConn.SetWriteDeadline(deadline) if err != nil { t.Fatalf(`SetWriteDeadline should return nil`) } }) t.Run(`get remote addr`, func(t *testing.T) { addr := handshakeConn.RemoteAddr() if addr != nil { t.Fatalf(`RemoteAddr should return nil`) } }) }
explode_data.jsonl/67691
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 535 }
[ 2830, 3393, 45439, 2314, 29661, 9701, 1155, 353, 8840, 836, 8, 341, 22212, 7395, 8623, 7395, 90, 83, 8824, 32917, 1256, 11, 1848, 1669, 1532, 35954, 36944, 9701, 2580, 1155, 568, 703, 2398, 743, 1848, 961, 2092, 341, 197, 3244, 6141, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2