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 TestInjectInterruptedImageManifest(t *testing.T) { Convey("Make a new controller", t, func() { port := test.GetFreePort() baseURL := test.GetBaseURL(port) conf := config.New() conf.HTTP.Port = port ctlr := api.NewController(conf) dir := t.TempDir() ctlr.Config.Storage.RootDirectory = dir go startServer(ctlr) defer stopServer(ctlr) test.WaitTillServerReady(baseURL) rthdlr := api.NewRouteHandler(ctlr) Convey("Upload a blob & a config blob; Create an image manifest", func() { // create a blob/layer resp, err := resty.R().Post(baseURL + "/v2/repotest/blobs/uploads/") So(err, ShouldBeNil) So(resp.StatusCode(), ShouldEqual, http.StatusAccepted) loc := test.Location(baseURL, resp) So(loc, ShouldNotBeEmpty) // since we are not specifying any prefix i.e provided in config while starting server, // so it should store repotest to global root dir _, err = os.Stat(path.Join(dir, "repotest")) So(err, ShouldBeNil) resp, err = resty.R().Get(loc) So(err, ShouldBeNil) So(resp.StatusCode(), ShouldEqual, http.StatusNoContent) content := []byte("this is a dummy blob") digest := godigest.FromBytes(content) So(digest, ShouldNotBeNil) // monolithic blob upload: success resp, err = resty.R().SetQueryParam("digest", digest.String()). SetHeader("Content-Type", "application/octet-stream").SetBody(content).Put(loc) So(err, ShouldBeNil) So(resp.StatusCode(), ShouldEqual, http.StatusCreated) blobLoc := resp.Header().Get("Location") So(blobLoc, ShouldNotBeEmpty) So(resp.Header().Get("Content-Length"), ShouldEqual, "0") So(resp.Header().Get(constants.DistContentDigestKey), ShouldNotBeEmpty) // upload image config blob resp, err = resty.R().Post(baseURL + "/v2/repotest/blobs/uploads/") So(err, ShouldBeNil) So(resp.StatusCode(), ShouldEqual, http.StatusAccepted) loc = test.Location(baseURL, resp) cblob, cdigest := test.GetRandomImageConfig() resp, err = resty.R(). SetContentLength(true). SetHeader("Content-Length", fmt.Sprintf("%d", len(cblob))). SetHeader("Content-Type", "application/octet-stream"). SetQueryParam("digest", cdigest.String()). SetBody(cblob). Put(loc) So(err, ShouldBeNil) So(resp.StatusCode(), ShouldEqual, http.StatusCreated) // create a manifest manifest := ispec.Manifest{ Config: ispec.Descriptor{ MediaType: "application/vnd.oci.image.config.v1+json", Digest: cdigest, Size: int64(len(cblob)), }, Layers: []ispec.Descriptor{ { MediaType: "application/vnd.oci.image.layer.v1.tar", Digest: digest, Size: int64(len(content)), }, }, } manifest.SchemaVersion = 2 content, err = json.Marshal(manifest) So(err, ShouldBeNil) digest = godigest.FromBytes(content) So(digest, ShouldNotBeNil) // Testing router path: @Router /v2/{name}/manifests/{reference} [put] Convey("Uploading an image manifest blob (when injected simulates an interrupted image manifest upload)", func() { injected := test.InjectFailure(0) request, _ := http.NewRequestWithContext(context.TODO(), "PUT", baseURL, bytes.NewReader(content)) request = mux.SetURLVars(request, map[string]string{"name": "repotest", "reference": "1.0"}) request.Header.Set("Content-Type", "application/vnd.oci.image.manifest.v1+json") response := httptest.NewRecorder() rthdlr.UpdateManifest(response, request) resp := response.Result() defer resp.Body.Close() So(resp, ShouldNotBeNil) if injected { So(resp.StatusCode, ShouldEqual, http.StatusInternalServerError) } else { So(resp.StatusCode, ShouldEqual, http.StatusCreated) } }) }) }) }
explode_data.jsonl/77707
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1509 }
[ 2830, 3393, 13738, 22528, 57472, 38495, 1155, 353, 8840, 836, 8, 341, 93070, 5617, 445, 8078, 264, 501, 6461, 497, 259, 11, 2915, 368, 341, 197, 52257, 1669, 1273, 2234, 10940, 7084, 741, 197, 24195, 3144, 1669, 1273, 2234, 3978, 3144, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestAuthenticatorData_Verify(t *testing.T) { type fields struct { RPIDHash []byte Flags AuthenticatorFlags Counter uint32 AttData AttestedCredentialData ExtData []byte } type args struct { rpIdHash []byte userVerificationRequired bool } tests := []struct { name string fields fields args args wantErr bool }{ // TODO: Add test cases. } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { a := &AuthenticatorData{ RPIDHash: tt.fields.RPIDHash, Flags: tt.fields.Flags, Counter: tt.fields.Counter, AttData: tt.fields.AttData, ExtData: tt.fields.ExtData, } if err := a.Verify(tt.args.rpIdHash, nil, tt.args.userVerificationRequired); (err != nil) != tt.wantErr { t.Errorf("AuthenticatorData.Verify() error = %v, wantErr %v", err, tt.wantErr) } }) } }
explode_data.jsonl/78531
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 393 }
[ 2830, 3393, 5087, 61393, 1043, 2334, 261, 1437, 1155, 353, 8840, 836, 8, 341, 13158, 5043, 2036, 341, 197, 11143, 33751, 6370, 3056, 3782, 198, 197, 197, 9195, 262, 46367, 850, 9195, 198, 197, 197, 14099, 220, 2622, 18, 17, 198, 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...
2
func TestNewPostWithDefaultEmoticon(t *testing.T) { p := Emoticon2EmojiPlugin{} config := Emoticon2EmojiPluginConfiguration{ CustomMatches: "{\"XD\":\"laughing\"}", } p.API = initTestPlugin(t, &config) p.OnConfigurationChange() post := &model.Post{ Message: "Hello XD !!", } post, err := p.MessageWillBePosted(nil, post) assert.NotNil(t, post) assert.Equal(t, "Hello :laughing: !!", post.Message) assert.Equal(t, "", err) }
explode_data.jsonl/35686
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 192 }
[ 2830, 3393, 3564, 4133, 2354, 3675, 2269, 354, 1924, 1155, 353, 8840, 836, 8, 972, 3223, 1669, 5748, 354, 1924, 17, 92731, 11546, 90, 1771, 25873, 1669, 5748, 354, 1924, 17, 92731, 11546, 7688, 1666, 197, 6258, 1450, 42470, 25, 54734, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestWatchAfterClose(t *testing.T) { integration2.BeforeTest(t) clus := integration2.NewClusterV3(t, &integration2.ClusterConfig{Size: 1}) defer clus.Terminate(t) cli := clus.Client(0) clus.TakeClient(0) if err := cli.Close(); err != nil { t.Fatal(err) } donec := make(chan struct{}) go func() { cli.Watch(context.TODO(), "foo") if err := cli.Close(); err != nil && err != context.Canceled { t.Errorf("expected %v, got %v", context.Canceled, err) } close(donec) }() select { case <-time.After(integration2.RequestWaitTimeout): t.Fatal("wc.Watch took too long") case <-donec: } }
explode_data.jsonl/28937
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 256 }
[ 2830, 3393, 14247, 6025, 7925, 1155, 353, 8840, 836, 8, 341, 2084, 17376, 17, 31153, 2271, 1155, 692, 197, 4163, 1669, 17590, 17, 7121, 28678, 53, 18, 1155, 11, 609, 60168, 17, 72883, 2648, 90, 1695, 25, 220, 16, 3518, 16867, 1185, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestNodeGetCapabilities(t *testing.T) { // Create server and client connection s := newTestServer(t) defer s.Stop() // Make a call c := csi.NewNodeClient(s.Conn()) // Get Capabilities r, err := c.NodeGetCapabilities( context.Background(), &csi.NodeGetCapabilitiesRequest{}) assert.NoError(t, err) assert.Len(t, r.GetCapabilities(), 2) assert.Equal( t, csi.NodeServiceCapability_RPC_GET_VOLUME_STATS, r.GetCapabilities()[0].GetRpc().GetType()) assert.Equal( t, csi.NodeServiceCapability_RPC_VOLUME_CONDITION, r.GetCapabilities()[1].GetRpc().GetType()) }
explode_data.jsonl/51454
{ "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, 1955, 1949, 55315, 1155, 353, 8840, 836, 8, 341, 197, 322, 4230, 3538, 323, 2943, 3633, 198, 1903, 1669, 501, 2271, 5475, 1155, 340, 16867, 274, 30213, 2822, 197, 322, 7405, 264, 1618, 198, 1444, 1669, 272, 6321, 7121, 195...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestAddBlockedTx(t *testing.T) { q, mem := initEnv(0) defer q.Close() defer mem.Close() msg1 := mem.client.NewMessage("mempool", types.EventTx, tx3) err := mem.client.Send(msg1, true) require.Nil(t, err) _, err = mem.client.Wait(msg1) require.Nil(t, err) blkDetail := &types.BlockDetail{Block: blk} msg2 := mem.client.NewMessage("mempool", types.EventAddBlock, blkDetail) mem.client.Send(msg2, false) msg3 := mem.client.NewMessage("mempool", types.EventTx, tx3) err = mem.client.Send(msg3, true) require.Nil(t, err) resp, err := mem.client.Wait(msg3) require.Nil(t, err) if string(resp.GetData().(*types.Reply).GetMsg()) != types.ErrDupTx.Error() { t.Error("TestAddBlockedTx failed") } }
explode_data.jsonl/16824
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 299 }
[ 2830, 3393, 2212, 95847, 31584, 1155, 353, 8840, 836, 8, 341, 18534, 11, 1833, 1669, 2930, 14359, 7, 15, 340, 16867, 2804, 10421, 741, 16867, 1833, 10421, 2822, 21169, 16, 1669, 1833, 6581, 7121, 2052, 445, 76, 3262, 1749, 497, 4494, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestTypeAsString(t *testing.T) { defer leaktest.AfterTest(t)() p := planner{} testData := []struct { expr tree.Expr expected string expectedErr bool }{ {expr: tree.NewDString("foo"), expected: "foo"}, { expr: &tree.BinaryExpr{ Operator: tree.Concat, Left: tree.NewDString("foo"), Right: tree.NewDString("bar")}, expected: "foobar", }, {expr: tree.NewDInt(3), expectedErr: true}, } t.Run("TypeAsString", func(t *testing.T) { for _, td := range testData { fn, err := p.TypeAsString(td.expr, "test") if err != nil { if !td.expectedErr { t.Fatalf("expected no error; got %v", err) } continue } else if td.expectedErr { t.Fatal("expected error; got none") } s, err := fn() if err != nil { t.Fatal(err) } if s != td.expected { t.Fatalf("expected %s; got %s", td.expected, s) } } }) t.Run("TypeAsStringArray", func(t *testing.T) { for _, td := range testData { fn, err := p.TypeAsStringArray([]tree.Expr{td.expr, td.expr}, "test") if err != nil { if !td.expectedErr { t.Fatalf("expected no error; got %v", err) } continue } else if td.expectedErr { t.Fatal("expected error; got none") } a, err := fn() if err != nil { t.Fatal(err) } expected := []string{td.expected, td.expected} if !reflect.DeepEqual(a, expected) { t.Fatalf("expected %s; got %s", expected, a) } } }) }
explode_data.jsonl/20457
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 665 }
[ 2830, 3393, 929, 26582, 1155, 353, 8840, 836, 8, 341, 16867, 23352, 1944, 36892, 2271, 1155, 8, 741, 3223, 1669, 49711, 16094, 18185, 1043, 1669, 3056, 1235, 341, 197, 8122, 649, 286, 4916, 93267, 198, 197, 42400, 262, 914, 198, 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...
7
func TestQuote(t *testing.T) { tpl := `{{quote "a" "b" "c"}}` if err := runt(tpl, `"a" "b" "c"`); err != nil { t.Error(err) } tpl = `{{quote "\"a\"" "b" "c"}}` if err := runt(tpl, `"\"a\"" "b" "c"`); err != nil { t.Error(err) } tpl = `{{quote 1 2 3 }}` if err := runt(tpl, `"1" "2" "3"`); err != nil { t.Error(err) } }
explode_data.jsonl/63872
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 185 }
[ 2830, 3393, 19466, 1155, 353, 8840, 836, 8, 341, 3244, 500, 1669, 1565, 2979, 2949, 330, 64, 1, 330, 65, 1, 330, 66, 30975, 3989, 743, 1848, 1669, 1598, 83, 1155, 500, 11, 53305, 64, 1, 330, 65, 1, 330, 66, 39917, 1215, 1848, 96...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestFanOutInterfaces(t *testing.T) { f := &FanOut{} if types.Consumer(f) == nil { t.Errorf("FanOut: nil types.Consumer") } if types.Closable(f) == nil { t.Errorf("FanOut: nil types.Closable") } }
explode_data.jsonl/68319
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 91 }
[ 2830, 3393, 58277, 2662, 41066, 1155, 353, 8840, 836, 8, 341, 1166, 1669, 609, 58277, 2662, 16094, 743, 4494, 70471, 955, 8, 621, 2092, 341, 197, 3244, 13080, 445, 58277, 2662, 25, 2092, 4494, 70471, 1138, 197, 532, 743, 4494, 727, 23...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestSummaryValueAtPercentile_CopyTo(t *testing.T) { ms := NewSummaryValueAtPercentile() NewSummaryValueAtPercentile().CopyTo(ms) assert.True(t, ms.IsNil()) generateTestSummaryValueAtPercentile().CopyTo(ms) assert.EqualValues(t, generateTestSummaryValueAtPercentile(), ms) }
explode_data.jsonl/19586
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 95 }
[ 2830, 3393, 19237, 1130, 1655, 32010, 457, 77637, 1249, 1155, 353, 8840, 836, 8, 341, 47691, 1669, 1532, 19237, 1130, 1655, 32010, 457, 741, 197, 3564, 19237, 1130, 1655, 32010, 457, 1005, 12106, 1249, 35680, 340, 6948, 32443, 1155, 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 TestStateToTerminalViewLocalResourceLinks(t *testing.T) { m := model.Manifest{ Name: "foo", }.WithDeployTarget(model.LocalTarget{ Links: []model.Link{ model.MustNewLink("www.apple.edu", "apple"), model.MustNewLink("www.zombo.com", "zombo"), }, }) state := newState([]model.Manifest{m}) v := StateToTerminalView(*state, &sync.RWMutex{}) res, _ := v.Resource(m.Name) assert.Equal(t, []string{"www.apple.edu", "www.zombo.com"}, res.Endpoints) }
explode_data.jsonl/54853
{ "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, 1397, 1249, 47890, 851, 7319, 4783, 24089, 1155, 353, 8840, 836, 8, 341, 2109, 1669, 1614, 72272, 515, 197, 21297, 25, 330, 7975, 756, 197, 7810, 2354, 69464, 6397, 7635, 20856, 6397, 515, 197, 197, 24089, 25, 3056, 2528, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestSuccessCloneOrOpen(t *testing.T) { testRepo := newTestRepo(t) defer testRepo.cleanup(t) secondRepo, err := git.CloneOrOpenRepo(testRepo.sut.Dir(), testRepo.dir, false) require.Nil(t, err) require.Equal(t, secondRepo.Dir(), testRepo.sut.Dir()) require.Nil(t, secondRepo.Cleanup()) }
explode_data.jsonl/13976
{ "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, 7188, 37677, 2195, 5002, 1155, 353, 8840, 836, 8, 341, 18185, 25243, 1669, 501, 2271, 25243, 1155, 340, 16867, 1273, 25243, 87689, 1155, 692, 197, 5569, 25243, 11, 1848, 1669, 16345, 64463, 2195, 5002, 25243, 8623, 25243, 514,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestUpdateAccountHoldings(t *testing.T) { t.Parallel() if !areTestAPIKeysSet() { t.Skip("API keys required but not set, skipping test") } _, err := f.UpdateAccountInfo(context.Background(), asset.Spot) if err != nil { t.Error(err) } }
explode_data.jsonl/15222
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 93 }
[ 2830, 3393, 4289, 7365, 47427, 819, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 741, 743, 753, 546, 2271, 7082, 8850, 1649, 368, 341, 197, 3244, 57776, 445, 7082, 6894, 2567, 714, 537, 738, 11, 42659, 1273, 1138, 197, 532, 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...
3
func TestDeleteReactsOnNumberOfRemovedObjects(t *testing.T) { givenID := uuidA() givenTenant := uuidB() sut := repo.NewDeleter("users", "tenant_col") cases := map[string]struct { methodToTest methodToTest givenRowsAffected int64 expectedErrString string }{ "[DeleteOne] returns error when removed more than one object": { methodToTest: sut.DeleteOne, givenRowsAffected: 154, expectedErrString: "delete should remove single row, but removed 154 rows", }, "[DeleteOne] returns error when object not found": { methodToTest: sut.DeleteOne, givenRowsAffected: 0, expectedErrString: "delete should remove single row, but removed 0 rows", }, "[Delete Many] success when removed more than one object": { methodToTest: sut.DeleteMany, givenRowsAffected: 154, expectedErrString: "", }, "[Delete Many] success when not found objects to remove": { methodToTest: sut.DeleteMany, givenRowsAffected: 0, expectedErrString: "", }, } for tn, tc := range cases { t.Run(tn, func(t *testing.T) { // GIVEN db, mock := testdb.MockDatabase(t) ctx := persistence.SaveToContext(context.TODO(), db) defer mock.AssertExpectations(t) mock.ExpectExec(defaultExpectedDeleteQuery()).WithArgs(givenTenant, givenID).WillReturnResult(sqlmock.NewResult(0, tc.givenRowsAffected)) // WHEN err := tc.methodToTest(ctx, givenTenant, repo.Conditions{repo.NewEqualCondition("id_col", givenID)}) // THEN if tc.expectedErrString != "" { require.EqualError(t, err, tc.expectedErrString) } }) } }
explode_data.jsonl/61039
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 620 }
[ 2830, 3393, 6435, 693, 11359, 1925, 40619, 42642, 11543, 1155, 353, 8840, 836, 8, 341, 3174, 2071, 915, 1669, 16040, 32, 741, 3174, 2071, 71252, 1669, 16040, 33, 741, 1903, 332, 1669, 15867, 7121, 1912, 273, 465, 445, 4218, 497, 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...
2
func TestSubrepoName(t *testing.T) { pkg := core.NewPackage("test/pkg") pkg.SubrepoName = "pleasings" s, _, err := parseFileToStatementsInPkg("src/parse/asp/test_data/interpreter/subrepo_name.build", pkg) assert.NoError(t, err) assert.EqualValues(t, "pleasings", s.Lookup("subrepo")) }
explode_data.jsonl/81089
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 120 }
[ 2830, 3393, 3136, 23476, 675, 1155, 353, 8840, 836, 8, 341, 3223, 7351, 1669, 6200, 7121, 13100, 445, 1944, 22523, 1138, 3223, 7351, 12391, 23476, 675, 284, 330, 694, 300, 819, 698, 1903, 11, 8358, 1848, 1669, 4715, 1703, 1249, 93122, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestAPIs(t *testing.T) { RegisterFailHandler(Fail) SetDefaultEventuallyTimeout(20 * time.Second) SetDefaultEventuallyPollingInterval(100 * time.Millisecond) SetDefaultConsistentlyDuration(5 * time.Second) SetDefaultConsistentlyPollingInterval(100 * time.Millisecond) RunSpecs(t, "Controller Suite") }
explode_data.jsonl/40271
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 100 }
[ 2830, 3393, 7082, 82, 1155, 353, 8840, 836, 8, 341, 79096, 19524, 3050, 7832, 604, 692, 22212, 3675, 67982, 7636, 7, 17, 15, 353, 882, 32435, 340, 22212, 3675, 67982, 49207, 287, 10256, 7, 16, 15, 15, 353, 882, 71482, 340, 22212, 36...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestSchemaParse(t *testing.T) { schemaFile, err := ioutil.ReadFile("../test.yaml") if err != nil { t.Error(err.Error()) } schema := New(schemaFile) expected := Schema{ Tables: []Table{ Table{ Name: "order", Fields: []Field{ Field{ Name: "id", Type: PrimaryKey, }, Field{ Name: "items", Type: String, }, Field{ Name: "price", Type: Int, }, Field{ Name: "user_id", Type: Int, }, }, }, Table{ Name: "user", Fields: []Field{ Field{ Name: "id", Type: PrimaryKey, }, Field{ Name: "forename", Type: String, }, Field{ Name: "surname", Type: String, }, Field{ Name: "address", Type: String, }, }, }, }, } if !reflect.DeepEqual(schema, expected) { spew.Dump(schema) t.Error("Schema parsed incorrectly from yaml.") } }
explode_data.jsonl/75487
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 525 }
[ 2830, 3393, 8632, 14463, 1155, 353, 8840, 836, 8, 341, 1903, 3416, 1703, 11, 1848, 1669, 43144, 78976, 17409, 1944, 33406, 1138, 743, 1848, 961, 2092, 341, 197, 3244, 6141, 3964, 6141, 2398, 197, 630, 1903, 3416, 1669, 1532, 42735, 1703...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestAnonymousStruct(t *testing.T) { type X struct { A struct { B int } } expected := `{ "swagger.X": { "id": "swagger.X", "required": [ "A" ], "properties": { "A": { "type": "swagger.X.A", "description": "", "format": "" } } }, "swagger.X.A": { "id": "swagger.X.A", "required": [ "B" ], "properties": { "B": { "type": "integer", "description": "", "format": "int32" } } } }` testJsonFromStruct(t, X{}, expected) }
explode_data.jsonl/39927
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 267 }
[ 2830, 3393, 32684, 9422, 1155, 353, 8840, 836, 8, 341, 13158, 1599, 2036, 341, 197, 22985, 2036, 341, 298, 12791, 526, 198, 197, 197, 532, 197, 630, 42400, 1669, 1565, 515, 220, 330, 74755, 4338, 788, 341, 256, 330, 307, 788, 330, 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 TestTerraformDataLoader(t *testing.T) { loader := TerraformResourceLoader{} loaded, err := loader.Load("./testdata/resources/terraform_data.tf") assert.Nil(t, err, "Expecting Load to run without error") assert.Equal(t, len(loaded.Resources), 1, "Unexpected number of resources") }
explode_data.jsonl/49075
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 96 }
[ 2830, 3393, 51, 13886, 52873, 9181, 1155, 353, 8840, 836, 8, 341, 197, 8355, 1669, 49426, 627, 4783, 9181, 16094, 197, 15589, 11, 1848, 1669, 16047, 13969, 13988, 92425, 38900, 14, 61385, 1769, 68994, 1138, 6948, 59678, 1155, 11, 1848, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestAuthConfigMerge(t *testing.T) { content := ` apiVersion: v1 clusters: - cluster: server: https://localhost:8080 name: foo-cluster contexts: - context: cluster: foo-cluster user: foo-user namespace: bar name: foo-context current-context: foo-context kind: Config users: - name: foo-user user: exec: apiVersion: client.authentication.k8s.io/v1alpha1 args: - arg-1 - arg-2 command: foo-command ` tmpfile, err := ioutil.TempFile("", "kubeconfig") if err != nil { t.Error(err) } defer os.Remove(tmpfile.Name()) if err := ioutil.WriteFile(tmpfile.Name(), []byte(content), 0666); err != nil { t.Error(err) } config, err := BuildConfigFromFlags("", tmpfile.Name()) if err != nil { t.Error(err) } if !reflect.DeepEqual(config.ExecProvider.Args, []string{"arg-1", "arg-2"}) { t.Errorf("Got args %v when they should be %v\n", config.ExecProvider.Args, []string{"arg-1", "arg-2"}) } }
explode_data.jsonl/56172
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 400 }
[ 2830, 3393, 5087, 2648, 52096, 1155, 353, 8840, 836, 8, 341, 27751, 1669, 22074, 2068, 5637, 25, 348, 16, 198, 78521, 510, 12, 10652, 510, 262, 3538, 25, 3703, 1110, 8301, 25, 23, 15, 23, 15, 198, 220, 829, 25, 15229, 93208, 198, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 Test_errorFromResponse(t *testing.T) { type args struct { res *http.Response decoder *json.Decoder } tests := []struct { name string args args wantErr bool wantType string }{ { name: "Return rate limit error", args: args{ res: &http.Response{ StatusCode: http.StatusTooManyRequests, Header: http.Header{ "x-ratelimit-limit": []string{"10000"}, "x-ratelimit-remaining": []string{"9999"}, "x-ratelimit-reset": []string{"1640818767"}, }, }, decoder: json.NewDecoder(strings.NewReader("")), }, wantErr: true, wantType: "*clickup.RateLimitError", }, { name: "Return rate clickup clickup error", args: args{ res: &http.Response{ StatusCode: http.StatusUnprocessableEntity, Request: &http.Request{ URL: &url.URL{Host: "https://mock.clickup.com"}, }, }, decoder: json.NewDecoder(strings.NewReader(`{"ECODE": "fail", "err": "error"}`)), }, wantErr: true, wantType: "*clickup.ErrClickupResponse", }, { name: "Return rate clickup clickup http error", args: args{ res: &http.Response{ StatusCode: http.StatusUnprocessableEntity, Request: &http.Request{ URL: &url.URL{Host: "https://mock.clickup.com"}, }, }, decoder: json.NewDecoder(strings.NewReader(`{{{badJSON}}}}`)), }, wantErr: true, wantType: "*clickup.HTTPError", }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { err := errorFromResponse(tt.args.res, tt.args.decoder) if (err != nil) != tt.wantErr { t.Errorf("errorFromResponse() error = %v, wantErr %v", err, tt.wantErr) } if fmt.Sprintf("%T", err) != tt.wantType { t.Errorf("errorFromResponse() error = %T, wantType %v", err, tt.wantType) } }) } }
explode_data.jsonl/74373
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 832 }
[ 2830, 3393, 4096, 3830, 2582, 1155, 353, 8840, 836, 8, 341, 13158, 2827, 2036, 341, 197, 10202, 257, 353, 1254, 12574, 198, 197, 197, 48110, 353, 2236, 22442, 4316, 198, 197, 532, 78216, 1669, 3056, 1235, 341, 197, 11609, 257, 914, 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 TestLoggedIn_Hydra_Error_Log(t *testing.T) { s, cfg, _, h, _, err := setupHydraTest(true) if err != nil { t.Fatalf("setupHydraTest() failed: %v", err) } logs, close := fakesdl.New() defer close() s.logger = logs.Client h.RejectLoginResp = &hydraapi.RequestHandlerResponse{RedirectTo: hydraPublicURL} pname := "dr_joe_era_commons" sendLoggedIn(t, s, cfg, h, pname, "", loginStateID, pb.ResourceTokenRequestState_DATASET) logs.Client.Close() got := logs.Server.Logs[0].Entries[0] if got.Labels["pass_auth_check"] == "true" { t.Errorf("Labels[pass_auth_check] want false") } if got.Labels["error_type"] != errRejectedPolicy { t.Errorf("Labels[pass_auth_check] = %s want %s", got.Labels["error_type"], errRejectedPolicy) } if got.Labels["error_type"] != errRejectedPolicy { t.Errorf("Labels[pass_auth_check] = %s want %s", got.Labels["error_type"], errRejectedPolicy) } if got.GetJsonPayload() == nil { t.Errorf("got.GetJsonPayload() want not nil") } }
explode_data.jsonl/18500
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 407 }
[ 2830, 3393, 28559, 2039, 88, 22248, 28651, 44083, 1155, 353, 8840, 836, 8, 341, 1903, 11, 13286, 11, 8358, 305, 11, 8358, 1848, 1669, 6505, 30816, 22248, 2271, 3715, 340, 743, 1848, 961, 2092, 341, 197, 3244, 30762, 445, 15188, 30816, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 Test_ContainsMultipleSet(t *testing.T) { a := makeSet([]int{8, 6, 7, 5, 3, 0, 9}) if !a.Contains(8, 6, 7, 5, 3, 0, 9) { t.Error("ContainsAll should contain Jenny'S phone number") } if a.Contains(8, 6, 11, 5, 3, 0, 9) { t.Error("ContainsAll should not have all of these numbers") } }
explode_data.jsonl/176
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 130 }
[ 2830, 3393, 62, 23805, 32089, 1649, 1155, 353, 8840, 836, 8, 341, 11323, 1669, 1281, 1649, 10556, 396, 90, 23, 11, 220, 21, 11, 220, 22, 11, 220, 20, 11, 220, 18, 11, 220, 15, 11, 220, 24, 8824, 743, 753, 64, 11545, 7, 23, 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 TestPush(t *testing.T) { items := []int{23, 24, 2, 5, 10} interfaceItems := make([]interface{}, len(items)) for i, v := range items { interfaceItems[i] = v } a := New(interfaceItems) newValue := 7 result := a.Push(newValue) if result != a.Length() { t.Log("Push should return the new length of the array") t.Log("Expected", a.Length(), "\n Got", result) t.Fail() } lastItem, _ := a.Get(a.Length() - 1) if lastItem.(int) != newValue { t.Log("Last item in array after push should equal newly inserted item") t.Log("Expected", newValue, "\n Got", lastItem) t.Fail() } }
explode_data.jsonl/47096
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 231 }
[ 2830, 3393, 16644, 1155, 353, 8840, 836, 8, 341, 46413, 1669, 3056, 396, 90, 17, 18, 11, 220, 17, 19, 11, 220, 17, 11, 220, 20, 11, 220, 16, 15, 532, 58915, 1564, 4353, 1669, 1281, 10556, 4970, 22655, 2422, 24337, 4390, 2023, 600,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestCritMarshalJSON(t *testing.T) { mockProtected := struct { Crit trc.Crit `json:"crit"` }{} b, err := json.Marshal(mockProtected) require.NoError(t, err) var protected struct { Crit []string `json:"crit"` } require.NoError(t, json.Unmarshal(b, &protected)) assert.ElementsMatch(t, []string{"type", "key_type", "key_version", "as"}, protected.Crit) }
explode_data.jsonl/64408
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 144 }
[ 2830, 3393, 64258, 55438, 5370, 1155, 353, 8840, 836, 8, 341, 77333, 66915, 1669, 2036, 341, 197, 6258, 1003, 489, 66, 727, 1003, 1565, 2236, 2974, 36996, 8805, 197, 15170, 532, 2233, 11, 1848, 1669, 2951, 37271, 30389, 66915, 340, 1795...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestUpdateTags(t *testing.T) { type want struct { cr *v1beta1.SecurityGroup result managed.ExternalUpdate err error } cases := map[string]struct { args want }{ "Same": { args: args{ sg: &fake.MockSecurityGroupClient{ MockDescribe: func(ctx context.Context, input *awsec2.DescribeSecurityGroupsInput, opts []func(*awsec2.Options)) (*awsec2.DescribeSecurityGroupsOutput, error) { return &awsec2.DescribeSecurityGroupsOutput{ SecurityGroups: []awsec2types.SecurityGroup{{ Tags: []awsec2types.Tag{ { Key: aws.String("k1"), Value: aws.String("v1"), }, { Key: aws.String("k2"), Value: aws.String("v2"), }, }, IpPermissions: sgPermissions(port100), IpPermissionsEgress: sgPermissions(port100), }}, }, nil }, }, cr: sg(withSpec(v1beta1.SecurityGroupParameters{ Tags: []v1beta1.Tag{ { Key: "k1", Value: "v1", }, { Key: "k2", Value: "v2", }, }, }), withStatus(v1beta1.SecurityGroupObservation{ SecurityGroupID: sgID, })), }, want: want{ cr: sg(withSpec(v1beta1.SecurityGroupParameters{ Tags: []v1beta1.Tag{ { Key: "k1", Value: "v1", }, { Key: "k2", Value: "v2", }, }}), withStatus(v1beta1.SecurityGroupObservation{ SecurityGroupID: sgID, })), }, }, "Change": { args: args{ sg: &fake.MockSecurityGroupClient{ MockDescribe: func(ctx context.Context, input *awsec2.DescribeSecurityGroupsInput, opts []func(*awsec2.Options)) (*awsec2.DescribeSecurityGroupsOutput, error) { return &awsec2.DescribeSecurityGroupsOutput{ SecurityGroups: []awsec2types.SecurityGroup{{ Tags: []awsec2types.Tag{ { Key: aws.String("k1"), Value: aws.String("v1"), }, { Key: aws.String("k2"), Value: aws.String("vx"), }, { Key: aws.String("k4"), Value: aws.String("v4"), }, }, }}, }, nil }, MockCreateTags: func(ctx context.Context, input *awsec2.CreateTagsInput, opts []func(*awsec2.Options)) (*awsec2.CreateTagsOutput, error) { if diff := cmp.Diff(input.Tags, []awsec2types.Tag{ { Key: aws.String("k2"), Value: aws.String("v2"), }, { Key: aws.String("k3"), Value: aws.String("v3"), }, }, cmpopts.SortSlices(compareTags), cmpopts.IgnoreTypes(document.NoSerde{})); diff != "" { t.Errorf("r: -want, +got:\n%s", diff) } return &awsec2.CreateTagsOutput{}, nil }, MockDeleteTags: func(ctx context.Context, input *awsec2.DeleteTagsInput, opts []func(*awsec2.Options)) (*awsec2.DeleteTagsOutput, error) { if diff := cmp.Diff(input.Tags, []awsec2types.Tag{{Key: aws.String("k4")}}, cmpopts.IgnoreTypes(document.NoSerde{})); diff != "" { t.Errorf("r: -want, +got:\n%s", diff) } return &awsec2.DeleteTagsOutput{}, nil }, }, cr: sg(withSpec(v1beta1.SecurityGroupParameters{ Tags: []v1beta1.Tag{ { Key: "k1", Value: "v1", }, { Key: "k2", Value: "v2", }, { Key: "k3", Value: "v3", }, }, }), withStatus(v1beta1.SecurityGroupObservation{ SecurityGroupID: sgID, })), }, want: want{ cr: sg(withSpec(v1beta1.SecurityGroupParameters{ Tags: []v1beta1.Tag{ { Key: "k1", Value: "v1", }, { Key: "k2", Value: "v2", }, { Key: "k3", Value: "v3", }, }}), withStatus(v1beta1.SecurityGroupObservation{ SecurityGroupID: sgID, })), }, }, "TagsFail": { args: args{ sg: &fake.MockSecurityGroupClient{ MockDescribe: func(ctx context.Context, input *awsec2.DescribeSecurityGroupsInput, opts []func(*awsec2.Options)) (*awsec2.DescribeSecurityGroupsOutput, error) { return &awsec2.DescribeSecurityGroupsOutput{ SecurityGroups: []awsec2types.SecurityGroup{{ Tags: []awsec2types.Tag{}, }}, }, nil }, MockCreateTags: func(ctx context.Context, input *awsec2.CreateTagsInput, opts []func(*awsec2.Options)) (*awsec2.CreateTagsOutput, error) { return &awsec2.CreateTagsOutput{}, errBoom }, }, cr: sg(withSpec(v1beta1.SecurityGroupParameters{ Tags: []v1beta1.Tag{ { Key: "k1", Value: "v1", }, }, }), withStatus(v1beta1.SecurityGroupObservation{ SecurityGroupID: sgID, })), }, want: want{ cr: sg(withSpec(v1beta1.SecurityGroupParameters{ Tags: []v1beta1.Tag{ { Key: "k1", Value: "v1", }, }, }), withStatus(v1beta1.SecurityGroupObservation{ SecurityGroupID: sgID, })), err: awsclient.Wrap(errBoom, errCreateTags), }, }, } for name, tc := range cases { t.Run(name, func(t *testing.T) { e := &external{kube: tc.kube, sg: tc.sg} o, err := e.Update(context.Background(), tc.args.cr) if diff := cmp.Diff(tc.want.err, err, test.EquateErrors()); diff != "" { t.Errorf("r: -want, +got:\n%s", diff) } if diff := cmp.Diff(tc.want.cr, tc.args.cr, test.EquateConditions()); diff != "" { t.Errorf("r: -want, +got:\n%s", diff) } if diff := cmp.Diff(tc.want.result, o); diff != "" { t.Errorf("r: -want, +got:\n%s", diff) } }) } }
explode_data.jsonl/79623
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 2976 }
[ 2830, 3393, 4289, 15930, 1155, 353, 8840, 836, 8, 341, 13158, 1366, 2036, 341, 197, 91492, 257, 353, 85, 16, 19127, 16, 21567, 2808, 198, 197, 9559, 8975, 5121, 15342, 4289, 198, 197, 9859, 262, 1465, 198, 197, 630, 1444, 2264, 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 TestValidateActionProxyRewritePathFails(t *testing.T) { tests := []string{`/\d{3}`, `(`, "$request_uri"} for _, test := range tests { allErrs := validateActionProxyRewritePath(test, field.NewPath("rewritePath")) if len(allErrs) == 0 { t.Errorf("validateActionProxyRewritePath(%v) returned no errors for invalid input", test) } } }
explode_data.jsonl/65897
{ "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, 17926, 2512, 16219, 58465, 1247, 1820, 37, 6209, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 3056, 917, 90, 63, 34319, 67, 90, 18, 28350, 1565, 5809, 11, 5201, 2035, 15572, 16707, 2023, 8358, 1273, 1669, 2088, 7032, 341, 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 TestASTCompiler(t *testing.T) { testcases := []struct { name string now time.Time file *ast.File script string want plantest.PlanSpec }{ { name: "override now time using now option", now: time.Unix(1, 1), script: ` import "csv" option now = () => 2017-10-10T00:01:00Z csv.from(csv: "foo,bar") |> range(start: 2017-10-10T00:00:00Z) `, want: plantest.PlanSpec{ Nodes: []plan.Node{ &plan.PhysicalPlanNode{Spec: &csv.FromCSVProcedureSpec{}}, &plan.PhysicalPlanNode{Spec: &universe.RangeProcedureSpec{}}, &plan.PhysicalPlanNode{Spec: &universe.YieldProcedureSpec{}}, }, Edges: [][2]int{ {0, 1}, {1, 2}, }, Resources: flux.ResourceManagement{ConcurrencyQuota: 1, MemoryBytesQuota: math.MaxInt64}, Now: parser.MustParseTime("2017-10-10T00:01:00Z").Value, }, }, { name: "get now time from compiler", now: parser.MustParseTime("2018-10-10T00:00:00Z").Value, script: ` import "csv" csv.from(csv: "foo,bar") |> range(start: 2017-10-10T00:00:00Z) `, want: plantest.PlanSpec{ Nodes: []plan.Node{ &plan.PhysicalPlanNode{Spec: &csv.FromCSVProcedureSpec{}}, &plan.PhysicalPlanNode{Spec: &universe.RangeProcedureSpec{}}, &plan.PhysicalPlanNode{Spec: &universe.YieldProcedureSpec{}}, }, Edges: [][2]int{ {0, 1}, {1, 2}, }, Resources: flux.ResourceManagement{ConcurrencyQuota: 1, MemoryBytesQuota: math.MaxInt64}, Now: parser.MustParseTime("2018-10-10T00:00:00Z").Value, }, }, { name: "prepend file", file: &ast.File{ Body: []ast.Statement{ &ast.OptionStatement{ Assignment: &ast.VariableAssignment{ ID: &ast.Identifier{Name: "now"}, Init: &ast.FunctionExpression{ Body: &ast.DateTimeLiteral{ Value: parser.MustParseTime("2018-10-10T00:00:00Z").Value, }, }, }, }, }, }, script: ` import "csv" csv.from(csv: "foo,bar") |> range(start: 2017-10-10T00:00:00Z) `, want: plantest.PlanSpec{ Nodes: []plan.Node{ &plan.PhysicalPlanNode{Spec: &csv.FromCSVProcedureSpec{}}, &plan.PhysicalPlanNode{Spec: &universe.RangeProcedureSpec{}}, &plan.PhysicalPlanNode{Spec: &universe.YieldProcedureSpec{}}, }, Edges: [][2]int{ {0, 1}, {1, 2}, }, Resources: flux.ResourceManagement{ConcurrencyQuota: 1, MemoryBytesQuota: math.MaxInt64}, Now: parser.MustParseTime("2018-10-10T00:00:00Z").Value, }, }, } for _, tc := range testcases { t.Run(tc.name, func(t *testing.T) { astPkg, err := flux.Parse(tc.script) if err != nil { t.Fatalf("failed to parse script: %v", err) } c := lang.ASTCompiler{ AST: astPkg, Now: tc.now, } if tc.file != nil { c.PrependFile(tc.file) } program, err := c.Compile(context.Background()) if err != nil { t.Fatalf("failed to compile AST: %v", err) } // we need to start the program to get compile errors derived from AST evaluation if _, err := program.Start(context.Background(), &memory.Allocator{}); err != nil { t.Fatalf("failed to start program: %v", err) } got := program.(*lang.AstProgram).PlanSpec want := plantest.CreatePlanSpec(&tc.want) if err := plantest.ComparePlansShallow(want, got); err != nil { t.Error(err) } }) } }
explode_data.jsonl/51326
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1559 }
[ 2830, 3393, 6349, 38406, 1155, 353, 8840, 836, 8, 341, 18185, 23910, 1669, 3056, 1235, 341, 197, 11609, 256, 914, 198, 197, 80922, 262, 882, 16299, 198, 197, 17661, 256, 353, 559, 8576, 198, 197, 86956, 914, 198, 197, 50780, 256, 6008...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 Test_Workspace_Status_WhenPropertiesConverted_RoundTripsWithoutLoss(t *testing.T) { t.Parallel() parameters := gopter.DefaultTestParameters() parameters.MaxSize = 10 properties := gopter.NewProperties(parameters) properties.Property( "Round trip from Workspace_Status to Workspace_Status via AssignPropertiesToWorkspaceStatus & AssignPropertiesFromWorkspaceStatus returns original", prop.ForAll(RunPropertyAssignmentTestForWorkspaceStatus, WorkspaceStatusGenerator())) properties.TestingRun(t, gopter.NewFormatedReporter(false, 240, os.Stdout)) }
explode_data.jsonl/43360
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 168 }
[ 2830, 3393, 87471, 8746, 36449, 62, 4498, 7903, 61941, 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, 284, 220, 16, 15, 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...
1
func TestAutopilot_PromoteNonVoter(t *testing.T) { t.Parallel() dir1, s1 := testServerWithConfig(t, func(c *Config) { c.Datacenter = "dc1" c.Bootstrap = true c.RaftConfig.ProtocolVersion = 3 c.AutopilotConfig.ServerStabilizationTime = 200 * time.Millisecond c.ServerHealthInterval = 100 * time.Millisecond c.AutopilotInterval = 100 * time.Millisecond }) defer os.RemoveAll(dir1) defer s1.Shutdown() codec := rpcClient(t, s1) defer codec.Close() testrpc.WaitForLeader(t, s1.RPC, "dc1") dir2, s2 := testServerWithConfig(t, func(c *Config) { c.Datacenter = "dc1" c.Bootstrap = false c.RaftConfig.ProtocolVersion = 3 }) defer os.RemoveAll(dir2) defer s2.Shutdown() joinLAN(t, s2, s1) // Make sure we see it as a nonvoter initially. We wait until half // the stabilization period has passed. retry.Run(t, func(r *retry.R) { future := s1.raft.GetConfiguration() if err := future.Error(); err != nil { r.Fatal(err) } servers := future.Configuration().Servers if len(servers) != 2 { r.Fatalf("bad: %v", servers) } if servers[1].Suffrage != raft.Nonvoter { r.Fatalf("bad: %v", servers) } health := s1.autopilot.GetServerHealth(string(servers[1].ID)) if health == nil { r.Fatal("nil health") } if !health.Healthy { r.Fatalf("bad: %v", health) } if time.Since(health.StableSince) < s1.config.AutopilotConfig.ServerStabilizationTime/2 { r.Fatal("stable period not elapsed") } }) // Make sure it ends up as a voter. retry.Run(t, func(r *retry.R) { future := s1.raft.GetConfiguration() if err := future.Error(); err != nil { r.Fatal(err) } servers := future.Configuration().Servers if len(servers) != 2 { r.Fatalf("bad: %v", servers) } if servers[1].Suffrage != raft.Voter { r.Fatalf("bad: %v", servers) } }) }
explode_data.jsonl/27415
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 770 }
[ 2830, 3393, 19602, 453, 23958, 1088, 441, 1272, 8121, 53, 25392, 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, 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 TestValidate(t *testing.T) { u := New() err := u.Validate() if err.Error() != fmt.Sprintf(ErrMissingField, "FirstName") { t.Error("Expected missing first name error") } u.FirstName = "test" err = u.Validate() if err.Error() != fmt.Sprintf(ErrMissingField, "LastName") { t.Error("Expected missing last name error") } u.LastName = "test" err = u.Validate() if err.Error() != fmt.Sprintf(ErrMissingField, "Username") { t.Error("Expected missing username error") } u.Username = "test" err = u.Validate() if err.Error() != fmt.Sprintf(ErrMissingField, "Password") { t.Error("Expected missing password error") } u.Password = "test" err = u.Validate() if err != nil { t.Error(err) } }
explode_data.jsonl/66632
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 280 }
[ 2830, 3393, 17926, 1155, 353, 8840, 836, 8, 341, 10676, 1669, 1532, 741, 9859, 1669, 575, 47667, 741, 743, 1848, 6141, 368, 961, 8879, 17305, 7, 7747, 25080, 1877, 11, 330, 26584, 899, 341, 197, 3244, 6141, 445, 18896, 7402, 1156, 829...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestRegisterClaimKeySuccess(t *testing.T) { db, mock, _ := sqlmock.New(sqlmock.QueryMatcherOption(sqlmock.QueryMatcherEqual)) defer db.Close() identifier := "127.0.0.1" mock.ExpectExec(`DELETE FROM failed_key_claim_attempts WHERE identifier = ?`).WithArgs(identifier).WillReturnResult(sqlmock.NewResult(1, 1)) receivedResult := registerClaimKeySuccess(db, identifier) if err := mock.ExpectationsWereMet(); err != nil { t.Errorf("there were unfulfilled expectations: %s", err) } assert.Nil(t, receivedResult, "Expected nil if executed delete") }
explode_data.jsonl/64740
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 195 }
[ 2830, 3393, 8690, 45544, 1592, 7188, 1155, 353, 8840, 836, 8, 341, 20939, 11, 7860, 11, 716, 1669, 5704, 16712, 7121, 13148, 16712, 15685, 37554, 5341, 13148, 16712, 15685, 37554, 2993, 1171, 16867, 2927, 10421, 2822, 197, 15909, 1669, 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...
2
func TestTokenFromParamPath(t *testing.T) { // the middleware to test authMiddleware, _ := New(&GinJWTMiddleware{ Realm: "test zone", Key: key, Timeout: time.Hour, Authenticator: defaultAuthenticator, Unauthorized: func(c *gin.Context, code int, message string) { c.String(code, message) }, TokenLookup: "param:token", }) handler := ginHandler(authMiddleware) r := gofight.New() userToken, _, _ := authMiddleware.TokenGenerator(MapClaims{ "identity": "admin", }) r.GET("/auth/refresh_token"). SetHeader(gofight.H{ "Authorization": "Bearer " + userToken, }). Run(handler, func(r gofight.HTTPResponse, rq gofight.HTTPRequest) { assert.Equal(t, http.StatusUnauthorized, r.Code) }) r.GET("/g/"+userToken+"/refresh_token"). Run(handler, func(r gofight.HTTPResponse, rq gofight.HTTPRequest) { assert.Equal(t, http.StatusOK, r.Code) }) }
explode_data.jsonl/64448
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 384 }
[ 2830, 3393, 3323, 3830, 2001, 1820, 1155, 353, 8840, 836, 8, 341, 197, 322, 279, 29679, 311, 1273, 198, 78011, 24684, 11, 716, 1669, 1532, 2099, 38, 258, 55172, 24684, 515, 197, 197, 64290, 25, 260, 330, 1944, 10143, 756, 197, 55242, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestFormatterDelimiters(test *testing.T) { f := formatter.New().SetDelimiters("<", ">") left, right := f.GetDelimiters() assert.Equal(test, "<", left) assert.Equal(test, ">", right) formatted, err := f.Format("<p1> <p0>", "c", 3) assert.NoError(test, err) assert.Equal(test, "3 c", formatted) assert.Equal(test, f, f.ResetDelimiters()) assert.Equal(test, formatter.DefaultLeftDelimiter, f.GetLeftDelimiter()) assert.Equal(test, formatter.DefaultRightDelimiter, f.GetRightDelimiter()) }
explode_data.jsonl/39736
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 202 }
[ 2830, 3393, 14183, 16532, 67645, 8623, 353, 8840, 836, 8, 341, 1166, 1669, 24814, 7121, 1005, 1649, 16532, 67645, 9639, 497, 28957, 5130, 35257, 11, 1290, 1669, 282, 2234, 16532, 67645, 2822, 6948, 12808, 8623, 11, 4055, 497, 2115, 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...
1
func TestAddAuthorEmailEmpty(t *testing.T) { t.Parallel() // arrange p := podcast.New("title", "link", "description", nil, nil) // act p.AddAuthor("", "") // assert assert.Len(t, p.ManagingEditor, 0) assert.Len(t, p.IAuthor, 0) }
explode_data.jsonl/73067
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 96 }
[ 2830, 3393, 2212, 7133, 4781, 3522, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 2822, 197, 322, 30893, 198, 3223, 1669, 17711, 7121, 445, 2102, 497, 330, 2080, 497, 330, 4684, 497, 2092, 11, 2092, 692, 197, 322, 1160, 198, 3223, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestRand(t *testing.T) { a := utils.GenRandom(5) var emptyInterf interface{} = a _, ok := emptyInterf.(int) if ok != true { t.Errorf("Random number must return an integer") } }
explode_data.jsonl/59810
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 73 }
[ 2830, 3393, 56124, 1155, 353, 8840, 836, 8, 341, 11323, 1669, 12439, 65384, 13999, 7, 20, 340, 2405, 4287, 3306, 69, 3749, 6257, 284, 264, 198, 197, 6878, 5394, 1669, 4287, 3306, 69, 12832, 396, 692, 743, 5394, 961, 830, 341, 197, 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 ]
2
func TestIntegrity(t *testing.T) { tree, err := Open("ahtree_test", DefaultOptions().WithSynced(false)) require.NoError(t, err) defer os.RemoveAll("ahtree_test") N := 1024 for i := 1; i <= N; i++ { _, _, err := tree.Append([]byte{byte(i)}) require.NoError(t, err) } n, _, err := tree.Root() require.NoError(t, err) for i := uint64(1); i <= n; i++ { r, err := tree.RootAt(i) require.NoError(t, err) for j := uint64(1); j <= i; j++ { iproof, err := tree.InclusionProof(j, i) require.NoError(t, err) d, err := tree.DataAt(j) require.NoError(t, err) pd := make([]byte, 1+len(d)) pd[0] = LeafPrefix copy(pd[1:], d) verifies := VerifyInclusion(iproof, j, i, sha256.Sum256(pd), r) require.True(t, verifies) } } }
explode_data.jsonl/49661
{ "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, 1072, 67212, 1155, 353, 8840, 836, 8, 341, 51968, 11, 1848, 1669, 5264, 445, 64, 426, 765, 4452, 497, 7899, 3798, 1005, 2354, 12154, 291, 3576, 1171, 17957, 35699, 1155, 11, 1848, 340, 16867, 2643, 84427, 445, 64, 426, 765...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestGitGetter_submodule(t *testing.T) { if !testHasGit { t.Log("git not found, skipping") t.Skip() } g := new(GitGetter) dst := tempDir(t) // Set up the grandchild gc := testGitRepo(t, "grandchild") gc.commitFile("grandchild.txt", "grandchild") // Set up the child c := testGitRepo(t, "child") c.commitFile("child.txt", "child") c.git("submodule", "add", gc.dir) c.git("commit", "-m", "Add grandchild submodule") // Set up the parent p := testGitRepo(t, "parent") p.commitFile("parent.txt", "parent") p.git("submodule", "add", c.dir) p.git("commit", "-m", "Add child submodule") // Clone the root repository if err := g.Get(dst, p.url); err != nil { t.Fatalf("err: %s", err) } // Check that the files exist for _, path := range []string{ filepath.Join(dst, "parent.txt"), filepath.Join(dst, "child", "child.txt"), filepath.Join(dst, "child", "grandchild", "grandchild.txt"), } { if _, err := os.Stat(path); err != nil { t.Fatalf("err: %s", err) } } }
explode_data.jsonl/39700
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 420 }
[ 2830, 3393, 46562, 31485, 5228, 4352, 1155, 353, 8840, 836, 8, 341, 743, 753, 1944, 10281, 46562, 341, 197, 3244, 5247, 445, 12882, 537, 1730, 11, 42659, 1138, 197, 3244, 57776, 741, 197, 630, 3174, 1669, 501, 6699, 275, 31485, 340, 5...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestDiffNegative(t *testing.T) { tests := []struct { name string args []string asserter func(s *scaffold, err error) }{ { name: "no env", args: []string{"diff"}, asserter: func(s *scaffold, err error) { a := assert.New(s.t) a.True(isUsageError(err)) a.Equal("exactly one environment required", err.Error()) }, }, { name: "2 envs", args: []string{"diff", "dev", "prod"}, asserter: func(s *scaffold, err error) { a := assert.New(s.t) a.True(isUsageError(err)) a.Equal("exactly one environment required", err.Error()) }, }, { name: "bad env", args: []string{"diff", "foo"}, asserter: func(s *scaffold, err error) { a := assert.New(s.t) a.False(isUsageError(err)) a.Equal("invalid environment \"foo\"", err.Error()) }, }, { name: "baseline env", args: []string{"diff", "_"}, asserter: func(s *scaffold, err error) { a := assert.New(s.t) a.True(isUsageError(err)) a.Equal("cannot diff baseline environment, use a real environment", err.Error()) }, }, { name: "c and C", args: []string{"diff", "dev", "-c", "cluster-objects", "-C", "service2"}, asserter: func(s *scaffold, err error) { a := assert.New(s.t) a.True(isUsageError(err)) a.Equal(`cannot include as well as exclude components, specify one or the other`, err.Error()) }, }, { name: "k and K", args: []string{"diff", "dev", "-k", "namespace", "-K", "secret"}, asserter: func(s *scaffold, err error) { a := assert.New(s.t) a.True(isUsageError(err)) a.Equal(`cannot include as well as exclude kinds, specify one or the other`, err.Error()) }, }, } for _, test := range tests { t.Run(test.name, func(t *testing.T) { s := newScaffold(t) defer s.reset() err := s.executeCommand(test.args...) require.NotNil(t, err) test.asserter(s, err) }) } }
explode_data.jsonl/72092
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 861 }
[ 2830, 3393, 21751, 38489, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 3056, 1235, 341, 197, 11609, 257, 914, 198, 197, 31215, 257, 3056, 917, 198, 197, 197, 33758, 465, 2915, 1141, 353, 82, 27864, 11, 1848, 1465, 340, 197, 59403, 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 TestGetProcessingOutput(t *testing.T) { defer goleak.VerifyNone(t, opt) pipelineId := uuid.New() incorrectConvertPipelineId := uuid.New() err := cacheService.SetValue(context.Background(), pipelineId, cache.RunOutput, "MOCK_RUN_OUTPUT") if err != nil { panic(err) } err = cacheService.SetValue(context.Background(), incorrectConvertPipelineId, cache.RunOutput, cache.RunOutput) if err != nil { panic(err) } type args struct { ctx context.Context cacheService cache.Cache key uuid.UUID subKey cache.SubKey errorTitle string } tests := []struct { name string args args want string wantErr bool }{ { // Test case with calling GetProcessingOutput with pipelineId which doesn't contain run output. // As a result, want to receive an error. name: "get run output with incorrect pipelineId", args: args{ ctx: context.Background(), cacheService: cacheService, key: uuid.New(), subKey: cache.RunOutput, errorTitle: "", }, want: "", wantErr: true, }, { // Test case with calling GetProcessingOutput with pipelineId which contains incorrect run output. // As a result, want to receive an error. name: "get run output with incorrect run output", args: args{ ctx: context.Background(), cacheService: cacheService, key: incorrectConvertPipelineId, subKey: cache.RunOutput, errorTitle: "", }, want: "", wantErr: true, }, { // Test case with calling GetProcessingOutput with pipelineId which contains run output. // As a result, want to receive an expected string. name: "get run output with correct pipelineId", args: args{ ctx: context.Background(), cacheService: cacheService, key: pipelineId, subKey: cache.RunOutput, errorTitle: "", }, want: "MOCK_RUN_OUTPUT", wantErr: false, }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { got, err := GetProcessingOutput(tt.args.ctx, tt.args.cacheService, tt.args.key, tt.args.subKey, tt.args.errorTitle) if (err != nil) != tt.wantErr { t.Errorf("GetProcessingOutput() error = %v, wantErr %v", err, tt.wantErr) return } if got != tt.want { t.Errorf("GetProcessingOutput() got = %v, want %v", got, tt.want) } }) } }
explode_data.jsonl/24
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1019 }
[ 2830, 3393, 1949, 28892, 5097, 1155, 353, 8840, 836, 8, 341, 16867, 728, 273, 585, 54853, 4064, 1155, 11, 3387, 340, 3223, 8790, 764, 1669, 16040, 7121, 741, 197, 61954, 12012, 34656, 764, 1669, 16040, 7121, 741, 9859, 1669, 6500, 1860,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestFormatFromExtension(t *testing.T) { testCases := []struct { name string ext string want Format err error }{ { name: "jpg without leading dot", ext: "jpg", want: JPEG, }, { name: "jpg with leading dot", ext: ".jpg", want: JPEG, }, { name: "jpg uppercase", ext: ".JPG", want: JPEG, }, { name: "unsupported", ext: ".unsupportedextension", want: -1, err: ErrUnsupportedFormat, }, } for _, tc := range testCases { t.Run(tc.name, func(t *testing.T) { got, err := FormatFromExtension(tc.ext) if err != tc.err { t.Errorf("got error %#v want %#v", err, tc.err) } if got != tc.want { t.Errorf("got result %#v want %#v", got, tc.want) } }) } }
explode_data.jsonl/2434
{ "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, 4061, 3830, 12049, 1155, 353, 8840, 836, 8, 341, 18185, 37302, 1669, 3056, 1235, 341, 197, 11609, 914, 198, 197, 95450, 220, 914, 198, 197, 50780, 15042, 198, 197, 9859, 220, 1465, 198, 197, 59403, 197, 197, 515, 298, 1160...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestRestartRequest(t *testing.T) { g := NewWithT(t) logKeeper := utils.NewLogKeeper() defer logKeeper.Stop() testConfig := &config.CloudTestConfig{ RetestConfig: config.RetestConfig{ Patterns: []string{"#Please_RETEST#"}, RestartCount: 2, }, } testConfig.Timeout = 3000 tmpDir, err := ioutil.TempDir(os.TempDir(), "cloud-test-temp") defer utils.ClearFolder(tmpDir, false) g.Expect(err).To(BeNil()) testConfig.ConfigRoot = tmpDir createProvider(testConfig, "a_provider") testConfig.Executions = append(testConfig.Executions, &config.ExecutionConfig{ Name: "simple", Tags: []string{"request_restart"}, Timeout: 1500, PackageRoot: "./sample", }) testConfig.Reporting.JUnitReportFile = JunitReport report, err := commands.PerformTesting(testConfig, &testValidationFactory{}, &commands.Arguments{}) g.Expect(err.Error()).To(Equal("there is failed tests 1")) g.Expect(report).NotTo(BeNil()) g.Expect(len(report.Suites)).To(Equal(1)) g.Expect(report.Suites[0].Failures).To(Equal(1)) g.Expect(report.Suites[0].Tests).To(Equal(2)) g.Expect(len(report.Suites[0].TestCases)).To(Equal(2)) logKeeper.CheckMessagesOrder(t, []string{ "Starting TestRequestRestart", "Re schedule task TestRequestRestart reason: rerun-request", "Starting TestRequestRestart", "Re schedule task TestRequestRestart reason: rerun-request", "Test TestRequestRestart retry count 2 exceed: err", }) }
explode_data.jsonl/58466
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 554 }
[ 2830, 3393, 59354, 1900, 1155, 353, 8840, 836, 8, 341, 3174, 1669, 1532, 2354, 51, 1155, 692, 6725, 77233, 1669, 12439, 7121, 2201, 77233, 741, 16867, 1487, 77233, 30213, 2822, 18185, 2648, 1669, 609, 1676, 94492, 2271, 2648, 515, 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 TestRepoPermissionPublicNonOrgRepo(t *testing.T) { assert.NoError(t, unittest.PrepareTestDatabase()) // public non-organization repo repo := unittest.AssertExistsAndLoadBean(t, &Repository{ID: 4}).(*Repository) assert.NoError(t, repo.getUnits(db.GetEngine(db.DefaultContext))) // plain user user := unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: 2}).(*user_model.User) perm, err := GetUserRepoPermission(repo, user) assert.NoError(t, err) for _, unit := range repo.Units { assert.True(t, perm.CanRead(unit.Type)) assert.False(t, perm.CanWrite(unit.Type)) } // change to collaborator assert.NoError(t, repo.AddCollaborator(user)) perm, err = GetUserRepoPermission(repo, user) assert.NoError(t, err) for _, unit := range repo.Units { assert.True(t, perm.CanRead(unit.Type)) assert.True(t, perm.CanWrite(unit.Type)) } // collaborator collaborator := unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: 4}).(*user_model.User) perm, err = GetUserRepoPermission(repo, collaborator) assert.NoError(t, err) for _, unit := range repo.Units { assert.True(t, perm.CanRead(unit.Type)) assert.True(t, perm.CanWrite(unit.Type)) } // owner owner := unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: 5}).(*user_model.User) perm, err = GetUserRepoPermission(repo, owner) assert.NoError(t, err) for _, unit := range repo.Units { assert.True(t, perm.CanRead(unit.Type)) assert.True(t, perm.CanWrite(unit.Type)) } // admin admin := unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: 1}).(*user_model.User) perm, err = GetUserRepoPermission(repo, admin) assert.NoError(t, err) for _, unit := range repo.Units { assert.True(t, perm.CanRead(unit.Type)) assert.True(t, perm.CanWrite(unit.Type)) } }
explode_data.jsonl/49791
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 706 }
[ 2830, 3393, 25243, 14966, 12676, 8121, 42437, 25243, 1155, 353, 8840, 836, 8, 341, 6948, 35699, 1155, 11, 19905, 28770, 3380, 2271, 5988, 12367, 197, 322, 584, 2477, 12, 23899, 15867, 198, 17200, 5368, 1669, 19905, 11711, 15575, 3036, 587...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestAPIListObjectPartsHandlerPreSign(t *testing.T) { defer DetectTestLeak(t)() ExecObjectLayerAPITest(t, testAPIListObjectPartsHandlerPreSign, []string{"PutObjectPart", "NewMultipart", "ListObjectParts"}) }
explode_data.jsonl/10711
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 75 }
[ 2830, 3393, 7082, 852, 1190, 28921, 3050, 4703, 7264, 1155, 353, 8840, 836, 8, 341, 16867, 33287, 2271, 2304, 585, 1155, 8, 741, 197, 10216, 1190, 9188, 2537, 952, 477, 1155, 11, 1273, 7082, 852, 1190, 28921, 3050, 4703, 7264, 345, 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
func TestFSExpirationWithTruncatedNonLastSlice(t *testing.T) { cleanupFSDatastore(t) defer cleanupFSDatastore(t) s := createDefaultFileStore(t, SliceConfig(3, 0, 0, ""), BufferSize(0)) defer s.Close() cs := storeCreateChannel(t, s, "foo") payload := []byte("msg") for seq := uint64(1); seq <= 5; seq++ { storeMsg(t, cs, "foo", seq, payload) } // Truncate the end of first slice ms := cs.Msgs.(*FileMsgStore) ms.RLock() fslice := ms.files[1] fname := fslice.file.name ms.RUnlock() s.Close() datContent, err := ioutil.ReadFile(fname) if err != nil { t.Fatalf("Error reading %v: %v", fname, err) } if err := ioutil.WriteFile(fname, datContent[:len(datContent)-5], 0666); err != nil { t.Fatalf("Error writing file %v: %v", fname, err) } // Now re-open the store with a max age limit. // Since the first slice is corrupted, one of the message in that // slice will be removed. sl := testDefaultStoreLimits sl.MaxAge = 100 * time.Millisecond s, state := openDefaultFileStoreWithLimits(t, &sl, BufferSize(0), TruncateUnexpectedEOF(true)) defer s.Close() time.Sleep(200 * time.Millisecond) cs = getRecoveredChannel(t, state, "foo") n, b := msgStoreState(t, cs.Msgs) if n != 0 || b != 0 { t.Fatalf("Expected no message, got %v/%v", n, b) } }
explode_data.jsonl/7785
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 509 }
[ 2830, 3393, 8485, 66301, 2354, 1282, 38007, 8121, 5842, 33236, 1155, 353, 8840, 836, 8, 341, 1444, 60639, 8485, 1043, 4314, 1155, 340, 16867, 21290, 8485, 1043, 4314, 1155, 692, 1903, 1669, 1855, 3675, 1703, 6093, 1155, 11, 56476, 2648, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestArgAliasesCompletionInGo(t *testing.T) { rootCmd := &Command{ Use: "root", Args: OnlyValidArgs, ValidArgs: []string{"one", "two", "three"}, ArgAliases: []string{"un", "deux", "trois"}, Run: emptyRun, } // Test that argaliases are not completed when there are validargs that match output, err := executeCommand(rootCmd, ShellCompNoDescRequestCmd, "") if err != nil { t.Errorf("Unexpected error: %v", err) } expected := strings.Join([]string{ "one", "two", "three", ":4", "Completion ended with directive: ShellCompDirectiveNoFileComp", ""}, "\n") if output != expected { t.Errorf("expected: %q, got: %q", expected, output) } // Test that argaliases are not completed when there are validargs that match using a prefix output, err = executeCommand(rootCmd, ShellCompNoDescRequestCmd, "t") if err != nil { t.Errorf("Unexpected error: %v", err) } expected = strings.Join([]string{ "two", "three", ":4", "Completion ended with directive: ShellCompDirectiveNoFileComp", ""}, "\n") if output != expected { t.Errorf("expected: %q, got: %q", expected, output) } // Test that argaliases are completed when there are no validargs that match output, err = executeCommand(rootCmd, ShellCompNoDescRequestCmd, "tr") if err != nil { t.Errorf("Unexpected error: %v", err) } expected = strings.Join([]string{ "trois", ":4", "Completion ended with directive: ShellCompDirectiveNoFileComp", ""}, "\n") if output != expected { t.Errorf("expected: %q, got: %q", expected, output) } }
explode_data.jsonl/43762
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 569 }
[ 2830, 3393, 2735, 95209, 33190, 641, 10850, 1155, 353, 8840, 836, 8, 341, 33698, 15613, 1669, 609, 4062, 515, 197, 95023, 25, 286, 330, 2888, 756, 197, 197, 4117, 25, 981, 8278, 4088, 4117, 345, 197, 197, 4088, 4117, 25, 220, 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...
7
func TestConfigValidate(t *testing.T) { mc := NewMockConnection() m.When(mc.ValidNamespaces()).ThenReturn(namespaces(), nil) mk := NewMockKubeSettings() m.When(mk.NamespaceNames(namespaces())).ThenReturn([]string{"default"}) cfg := config.NewConfig(mk) cfg.SetConnection(mc) assert.Nil(t, cfg.Load("testdata/k9s.yml")) cfg.Validate() }
explode_data.jsonl/19250
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 132 }
[ 2830, 3393, 2648, 17926, 1155, 353, 8840, 836, 8, 341, 97662, 1669, 1532, 11571, 4526, 741, 2109, 50761, 69248, 47156, 7980, 27338, 6011, 12209, 5598, 40401, 27338, 1507, 2092, 692, 2109, 74, 1669, 1532, 11571, 42, 3760, 6086, 741, 2109, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestAdd(t *testing.T) { repo := newInMemoryRepo() err := repo.Add(&User{ Username: "test3", Password: "test3", }) assert.NoError(t, err) }
explode_data.jsonl/382
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 67 }
[ 2830, 3393, 2212, 1155, 353, 8840, 836, 8, 341, 17200, 5368, 1669, 501, 641, 10642, 25243, 2822, 9859, 1669, 15867, 1904, 2099, 1474, 515, 197, 197, 11115, 25, 330, 1944, 18, 756, 197, 197, 4876, 25, 330, 1944, 18, 756, 197, 3518, 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
func TestSokuonInvalid(t *testing.T) { const want = "sokuon cannot precede a vowel" input := []string{ "っあ", "っい", "っう", "っえ", "っお", "ッア", "ッイ", "ッウ", "ッエ", "ッオ", } for _, v := range input { got, err := KanaToRomaji(v) assert.EqualError(t, err, want) assert.Empty(t, got) } }
explode_data.jsonl/11341
{ "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, 50, 16493, 263, 7928, 1155, 353, 8840, 836, 8, 341, 4777, 1366, 284, 330, 82, 16493, 263, 4157, 16201, 68, 264, 76181, 1837, 22427, 1669, 3056, 917, 515, 197, 197, 1, 41791, 29491, 497, 330, 41791, 16586, 497, 330, 41791, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestIndirectDependencyFix(t *testing.T) { testenv.NeedsGo1Point(t, 14) const mod = ` -- go.mod -- module mod.com go 1.12 require example.com v1.2.3 // indirect -- main.go -- package main import "example.com/blah" func main() { fmt.Println(blah.Name) ` const want = `module mod.com go 1.12 require example.com v1.2.3 ` runModfileTest(t, mod, proxy, func(t *testing.T, env *Env) { env.OpenFile("go.mod") var d protocol.PublishDiagnosticsParams env.Await( OnceMet( env.DiagnosticAtRegexp("go.mod", "// indirect"), ReadDiagnostics("go.mod", &d), ), ) env.ApplyQuickFixes("go.mod", d.Diagnostics) if got := env.Editor.BufferText("go.mod"); got != want { t.Fatalf("unexpected go.mod content:\n%s", tests.Diff(want, got)) } }) }
explode_data.jsonl/3740
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 334 }
[ 2830, 3393, 1425, 1226, 36387, 25958, 1155, 353, 8840, 836, 8, 341, 18185, 3160, 2067, 68, 6767, 10850, 16, 2609, 1155, 11, 220, 16, 19, 692, 4777, 1463, 284, 22074, 313, 728, 10929, 39514, 4352, 1463, 905, 271, 3346, 220, 16, 13, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestJobSpecsController_Create_FluxMonitor_enabled(t *testing.T) { config := cltest.NewTestConfig(t) config.Set("SEERLINK_DEV", "FALSE") config.Set("FEATURE_FLUX_MONITOR", "TRUE") rpcClient, gethClient, _, assertMocksCalled := cltest.NewEthMocksWithStartupAssertions(t) defer assertMocksCalled() app, cleanup := cltest.NewApplicationWithConfig(t, config, eth.NewClientWith(rpcClient, gethClient), ) defer cleanup() getOraclesResult, err := cltest.GenericEncode([]string{"address[]"}, []common.Address{}) require.NoError(t, err) cltest.MockFluxAggCall(gethClient, cltest.FluxAggAddress, "getOracles"). Return(getOraclesResult, nil) cltest.MockFluxAggCall(gethClient, cltest.FluxAggAddress, "latestRoundData"). Return(nil, errors.New("first round")) result := cltest.MakeRoundStateReturnData(2, true, 10000, 7, 0, 1000, 100, 1) cltest.MockFluxAggCall(gethClient, cltest.FluxAggAddress, "oracleRoundState"). Return(result, nil).Maybe() cltest.MockFluxAggCall(gethClient, cltest.FluxAggAddress, "minSubmissionValue"). Return(cltest.MustGenericEncode([]string{"uint256"}, big.NewInt(0)), nil) cltest.MockFluxAggCall(gethClient, cltest.FluxAggAddress, "maxSubmissionValue"). Return(cltest.MustGenericEncode([]string{"uint256"}, big.NewInt(10000000)), nil) require.NoError(t, app.Start()) client := app.NewHTTPClient() jsonStr := cltest.MustReadFile(t, "testdata/flux_monitor_job.json") resp, cleanup := client.Post("/v2/specs", bytes.NewBuffer(jsonStr)) defer cleanup() cltest.AssertServerResponse(t, resp, http.StatusOK) }
explode_data.jsonl/31811
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 572 }
[ 2830, 3393, 12245, 8327, 82, 2051, 34325, 1400, 62859, 30098, 18220, 1155, 353, 8840, 836, 8, 341, 25873, 1669, 1185, 1944, 7121, 2271, 2648, 1155, 340, 25873, 4202, 445, 925, 640, 35956, 26419, 497, 330, 30351, 1138, 25873, 4202, 445, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestCamelMatch(t *testing.T) { tests := [...]caseType{ { queries: []string{"FooBar", "FooBarTest", "FootBall", "FrameBuffer", "ForceFeedBack"}, pattern: "FB", expected: []bool{true, false, true, true, false}, }, { queries: []string{"FooBar", "FooBarTest", "FootBall", "FrameBuffer", "ForceFeedBack"}, pattern: "FoBa", expected: []bool{true, false, true, false, false}, }, { queries: []string{"FooBar", "FooBarTest", "FootBall", "FrameBuffer", "ForceFeedBack"}, pattern: "FoBaT", expected: []bool{false, true, false, false, false}, }, { queries: []string{"CompetitiveProgramming", "CounterPick", "ControlPanel"}, pattern: "CooP", expected: []bool{false, false, true}, }, { queries: []string{"aksvbjLiknuTzqon", "ksvjLimflkpnTzqn", "mmkasvjLiknTxzqn", "ksvjLiurknTzzqbn", "ksvsjLctikgnTzqn", "knzsvzjLiknTszqn"}, pattern: "ksvjLiknTzqn", expected: []bool{true, true, true, true, true, true}, }, } for _, tc := range tests { output := camelMatch(tc.queries, tc.pattern) if !reflect.DeepEqual(output, tc.expected) { t.Fatalf("input: %v, output: %v, expected: %v", tc.pattern, output, tc.expected) } } }
explode_data.jsonl/13169
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 524 }
[ 2830, 3393, 25406, 301, 8331, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 48179, 5638, 929, 515, 197, 197, 515, 298, 197, 42835, 25, 220, 3056, 917, 4913, 40923, 3428, 497, 330, 40923, 3428, 2271, 497, 330, 41820, 35907, 497, 330, 4369...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 Test_ServiceProvide(t *testing.T) { c := NewLidi(Settings{}) type S1 struct { test string } s1 := S1{"awesome"} err := c.Provide(s1) if err != nil { t.Error(err) } s1.test = "changed" err = c.InvokeFunction(func(s S1) { if s1.test != "changed" { t.Fatal("Not equal") } if s.test != "awesome" { t.Fatal("Not equal") } if s1.test != "changed" { t.Fatal("Equal") } if &s1 == &s { t.Fatal("Equal") } if s1 == s { t.Fatal("Equal") } }) if err != nil { t.Error(err) } }
explode_data.jsonl/40203
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 272 }
[ 2830, 3393, 52548, 60424, 1155, 353, 8840, 836, 8, 341, 1444, 1669, 1532, 43, 12278, 57395, 6257, 692, 13158, 328, 16, 2036, 341, 197, 18185, 914, 198, 197, 532, 1903, 16, 1669, 328, 16, 4913, 16875, 63159, 9859, 1669, 272, 7763, 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...
6
func TestClient_RunOCRJob_JobNotFound(t *testing.T) { t.Parallel() app := startNewApplication(t) client, _ := app.NewClientAndRenderer() set := flag.NewFlagSet("test", 0) set.Parse([]string{"1"}) c := cli.NewContext(nil, set, nil) require.NoError(t, client.RemoteLogin(c)) err := client.TriggerPipelineRun(c) assert.Contains(t, err.Error(), "parseResponse error: Error; job ID 1") }
explode_data.jsonl/5275
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 151 }
[ 2830, 3393, 2959, 84158, 93495, 12245, 10598, 674, 10372, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 2822, 28236, 1669, 1191, 3564, 4988, 1155, 340, 25291, 11, 716, 1669, 906, 7121, 2959, 3036, 11541, 2822, 8196, 1669, 5181, 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 TestBigUnnamedStruct(t *testing.T) { b := struct{ a, b, c, d int64 }{1, 2, 3, 4} v := ValueOf(b) b1 := v.Interface().(struct { a, b, c, d int64 }) if b1.a != b.a || b1.b != b.b || b1.c != b.c || b1.d != b.d { t.Errorf("ValueOf(%v).Interface().(*Big) = %v", b, b1) } }
explode_data.jsonl/29535
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 147 }
[ 2830, 3393, 15636, 78925, 9422, 1155, 353, 8840, 836, 8, 341, 2233, 1669, 2036, 90, 264, 11, 293, 11, 272, 11, 294, 526, 21, 19, 335, 90, 16, 11, 220, 17, 11, 220, 18, 11, 220, 19, 532, 5195, 1669, 5162, 2124, 1883, 340, 2233, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestModifyingExistingRequest(t *testing.T) { r, err := Prepare(mocks.NewRequestForURL("https://bing.com"), WithPath("search"), WithQueryParameters(map[string]interface{}{"q": "golang"})) if err != nil { t.Fatalf("autorest: Preparing an existing request returned an error (%v)", err) } if r.URL.Host != "bing.com" { t.Fatalf("autorest: Preparing an existing request failed when setting the host (%s)", r.URL) } if r.URL.Path != "/search" { t.Fatalf("autorest: Preparing an existing request failed when setting the path (%s)", r.URL.Path) } if r.URL.RawQuery != "q=golang" { t.Fatalf("autorest: Preparing an existing request failed when setting the query parameters (%s)", r.URL.RawQuery) } }
explode_data.jsonl/20977
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 261 }
[ 2830, 3393, 4459, 7766, 53067, 1900, 1155, 353, 8840, 836, 8, 972, 7000, 11, 1848, 1669, 31166, 1255, 25183, 75274, 2461, 3144, 445, 2428, 1110, 7132, 905, 3975, 3085, 1820, 445, 1836, 3975, 3085, 2859, 9706, 9147, 14032, 31344, 6257, 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...
5
func TestEmptyValueQuery(t *testing.T) { // issue: https://github.com/tidwall/gjson/issues/246 assert(t, Get( `["ig","","tw","fb","tw","ig","tw"]`, `#(!="")#`).Raw == `["ig","tw","fb","tw","ig","tw"]`) assert(t, Get( `["ig","","tw","fb","tw","ig","tw"]`, `#(!=)#`).Raw == `["ig","tw","fb","tw","ig","tw"]`) }
explode_data.jsonl/43492
{ "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, 3522, 1130, 2859, 1155, 353, 8840, 836, 8, 341, 197, 322, 4265, 25, 3703, 1110, 5204, 905, 5523, 307, 16431, 4846, 2236, 38745, 14, 17, 19, 21, 198, 6948, 1155, 11, 2126, 1006, 197, 197, 63, 1183, 343, 59859, 15560, 2198...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestStatusConditions(t *testing.T) { wf := unmarshalWF(pdbwf) cancel, controller := newController(wf) defer cancel() ctx := context.Background() woc := newWorkflowOperationCtx(wf, controller) woc.operate(ctx) assert.Empty(t, woc.wf.Status.Conditions) woc.markWorkflowSuccess(ctx) assert.Equal(t, woc.wf.Status.Conditions[0].Status, metav1.ConditionStatus("True")) }
explode_data.jsonl/70999
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 148 }
[ 2830, 3393, 2522, 35435, 1155, 353, 8840, 836, 8, 341, 6692, 69, 1669, 650, 27121, 32131, 1295, 1999, 43083, 340, 84441, 11, 6461, 1669, 501, 2051, 3622, 69, 340, 16867, 9121, 2822, 20985, 1669, 2266, 19047, 741, 6692, 509, 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 TestHmhdBox_Version(t *testing.T) { hb := HmhdBox{ version: 11, } if hb.Version() != 11 { t.Fatalf("Version() not correct.") } }
explode_data.jsonl/11008
{ "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, 39, 76, 15990, 1611, 85217, 1155, 353, 8840, 836, 8, 341, 9598, 65, 1669, 472, 76, 15990, 1611, 515, 197, 74954, 25, 220, 16, 16, 345, 197, 630, 743, 45135, 35842, 368, 961, 220, 16, 16, 341, 197, 3244, 30762, 445, 563...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestPointerToBool(t *testing.T) { boolVar := true ret := PointerToBool(boolVar) if *ret != boolVar { t.Fatalf("expected PointerToBool(true) to return *true, instead returned %#v", ret) } if IsTrueBoolPointer(ret) != boolVar { t.Fatalf("expected IsTrueBoolPointer(*true) to return true, instead returned %#v", IsTrueBoolPointer(ret)) } boolVar = false ret = PointerToBool(boolVar) if *ret != boolVar { t.Fatalf("expected PointerToBool(false) to return *false, instead returned %#v", ret) } if IsTrueBoolPointer(ret) != boolVar { t.Fatalf("expected IsTrueBoolPointer(*false) to return false, instead returned %#v", IsTrueBoolPointer(ret)) } }
explode_data.jsonl/7025
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 251 }
[ 2830, 3393, 9084, 1249, 11233, 1155, 353, 8840, 836, 8, 341, 7562, 3962, 1669, 830, 198, 11262, 1669, 21635, 1249, 11233, 9764, 3962, 340, 743, 353, 2122, 961, 1807, 3962, 341, 197, 3244, 30762, 445, 7325, 21635, 1249, 11233, 3715, 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...
5
func TestInstanceClient(t *testing.T) { rootTestFunc := func(sType server.StorageType) func(t *testing.T) { return func(t *testing.T) { const name = "test-instance" client, _, shutdownServer := getFreshApiserverAndClient(t, sType.String(), func() runtime.Object { return &servicecatalog.ServiceInstance{} }) defer shutdownServer() if err := testInstanceClient(sType, client, name); err != nil { t.Fatal(err) } } } for _, sType := range storageTypes { if !t.Run(sType.String(), rootTestFunc(sType)) { t.Errorf("%q test failed", sType) } } }
explode_data.jsonl/7401
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 230 }
[ 2830, 3393, 2523, 2959, 1155, 353, 8840, 836, 8, 341, 33698, 2271, 9626, 1669, 2915, 1141, 929, 3538, 43771, 929, 8, 2915, 1155, 353, 8840, 836, 8, 341, 197, 853, 2915, 1155, 353, 8840, 836, 8, 341, 298, 4777, 829, 284, 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 TestReconcileTaskResourceResolutionAndValidation(t *testing.T) { for _, tt := range []struct { desc string d test.Data wantFailedReason string wantEvents []string }{{ desc: "Fail ResolveTaskResources", d: test.Data{ Tasks: []*v1beta1.Task{ tb.Task("test-task-missing-resource", tb.TaskSpec( tb.TaskResources(tb.TaskResourcesInput("workspace", resourcev1alpha1.PipelineResourceTypeGit)), ), tb.TaskNamespace("foo")), }, TaskRuns: []*v1beta1.TaskRun{ tb.TaskRun("test-taskrun-missing-resource", tb.TaskRunNamespace("foo"), tb.TaskRunSpec( tb.TaskRunTaskRef("test-task-missing-resource", tb.TaskRefAPIVersion("a1")), tb.TaskRunResources( tb.TaskRunResourcesInput("workspace", tb.TaskResourceBindingRef("git")), ), )), }, ClusterTasks: nil, PipelineResources: nil, }, wantFailedReason: podconvert.ReasonFailedResolution, wantEvents: []string{ "Normal Started ", "Warning Failed", }, }, { desc: "Fail ValidateResolvedTaskResources", d: test.Data{ Tasks: []*v1beta1.Task{ tb.Task("test-task-missing-resource", tb.TaskSpec( tb.TaskResources(tb.TaskResourcesInput("workspace", resourcev1alpha1.PipelineResourceTypeGit)), ), tb.TaskNamespace("foo")), }, TaskRuns: []*v1beta1.TaskRun{ tb.TaskRun("test-taskrun-missing-resource", tb.TaskRunNamespace("foo"), tb.TaskRunSpec( tb.TaskRunTaskRef("test-task-missing-resource", tb.TaskRefAPIVersion("a1")), )), }, ClusterTasks: nil, PipelineResources: nil, }, wantFailedReason: podconvert.ReasonFailedValidation, wantEvents: []string{ "Normal Started ", "Warning Failed", }, }} { t.Run(tt.desc, func(t *testing.T) { names.TestingSeed() testAssets, cancel := getTaskRunController(t, tt.d) defer cancel() clients := testAssets.Clients reconciler := testAssets.Controller.Reconciler.(*Reconciler) fr := reconciler.Recorder.(*record.FakeRecorder) if err := reconciler.Reconcile(context.Background(), getRunName(tt.d.TaskRuns[0])); err != nil { t.Errorf("expected no error reconciling valid TaskRun but got %v", err) } tr, err := clients.Pipeline.TektonV1beta1().TaskRuns(tt.d.TaskRuns[0].Namespace).Get(tt.d.TaskRuns[0].Name, metav1.GetOptions{}) if err != nil { t.Fatalf("Expected TaskRun %s to exist but instead got error when getting it: %v", tt.d.TaskRuns[0].Name, err) } for _, c := range tr.Status.Conditions { if c.Type != apis.ConditionSucceeded || c.Status != corev1.ConditionFalse || c.Reason != tt.wantFailedReason { t.Errorf("Expected TaskRun to \"%s\" but it did not. Final conditions were:\n%#v", tt.wantFailedReason, tr.Status.Conditions) } } err = checkEvents(fr, tt.desc, tt.wantEvents) if !(err == nil) { t.Errorf(err.Error()) } }) } }
explode_data.jsonl/60096
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1253 }
[ 2830, 3393, 693, 40446, 457, 6262, 4783, 38106, 3036, 13799, 1155, 353, 8840, 836, 8, 341, 2023, 8358, 17853, 1669, 2088, 3056, 1235, 341, 197, 41653, 1797, 914, 198, 197, 2698, 394, 1273, 3336, 198, 197, 50780, 9408, 25139, 914, 198, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestReturnsErrorFromGetPodRoleWhenPodNotFound(t *testing.T) { defer leaktest.Check(t)() ctx, cancel := context.WithCancel(context.Background()) defer cancel() source := kt.NewFakeControllerSource() defer source.Shutdown() source.Add(testutil.NewPodWithRole("ns", "name", "192.168.0.1", "Running", "running_role")) podCache := k8s.NewPodCache(sts.DefaultResolver("arn:account:"), source, time.Second, defaultBuffer) podCache.Run(ctx) server := &KiamServer{pods: podCache, assumePolicy: &allowPolicy{}, credentialsProvider: &stubCredentialsProvider{accessKey: "A1234"}} _, e := server.GetPodRole(ctx, &pb.GetPodRoleRequest{Ip: "foo"}) if e != k8s.ErrPodNotFound { t.Error("unexpected error, was", e) } }
explode_data.jsonl/43097
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 260 }
[ 2830, 3393, 16446, 1454, 3830, 1949, 23527, 9030, 4498, 23527, 10372, 1155, 353, 8840, 836, 8, 341, 16867, 23352, 1944, 10600, 1155, 8, 741, 20985, 11, 9121, 1669, 2266, 26124, 9269, 5378, 19047, 2398, 16867, 9121, 2822, 47418, 1669, 1854...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestN(t *testing.T) { const want = "naninuneno" for _, v := range [2]string{"なにぬねの", "ナニヌネノ"} { got, err := KanaToRomaji(v) assert.Equal(t, want, got) assert.Nil(t, err) } }
explode_data.jsonl/11302
{ "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, 45, 1155, 353, 8840, 836, 8, 341, 4777, 1366, 284, 330, 18759, 258, 359, 11790, 1837, 2023, 8358, 348, 1669, 2088, 508, 17, 30953, 4913, 25770, 19655, 133300, 124381, 15767, 497, 330, 95352, 77583, 138398, 124810, 125541, 9207...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestSetFunc(t *testing.T) { const SCRIPT = ` sum(40, 2); ` r := New() err := r.Set("sum", func(call FunctionCall) Value { return r.ToValue(call.Argument(0).ToInteger() + call.Argument(1).ToInteger()) }) if err != nil { t.Fatal(err) } v, err := r.RunString(SCRIPT) if err != nil { t.Fatal(err) } if i := v.ToInteger(); i != 42 { t.Fatalf("Expected 42, got: %d", i) } }
explode_data.jsonl/10459
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 180 }
[ 2830, 3393, 1649, 9626, 1155, 353, 8840, 836, 8, 341, 4777, 53679, 284, 22074, 31479, 7, 19, 15, 11, 220, 17, 317, 197, 3989, 7000, 1669, 1532, 741, 9859, 1669, 435, 4202, 445, 1242, 497, 2915, 32691, 5712, 7220, 8, 5162, 341, 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 TestIntegrationHTTPDoForceSkipVerify(t *testing.T) { ctx := context.Background() results := HTTPDo(ctx, HTTPDoConfig{ URL: "https://self-signed.badssl.com/", InsecureSkipVerify: true, }) if results.Error != nil { t.Fatal(results.Error) } }
explode_data.jsonl/53535
{ "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, 52464, 9230, 5404, 18573, 35134, 32627, 1155, 353, 8840, 836, 8, 341, 20985, 1669, 2266, 19047, 741, 55497, 1669, 10130, 5404, 7502, 11, 10130, 5404, 2648, 515, 197, 79055, 25, 394, 330, 2428, 1110, 721, 92553, 31563, 24635, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestABCIValidators(t *testing.T) { pkEd := bls12381.GenPrivKey().PubKey() // correct validator tmValExpected := NewValidator(pkEd, 10) tmVal := NewValidator(pkEd, 10) abciVal := TM2PB.ValidatorUpdate(tmVal) tmVals, err := PB2TM.ValidatorUpdates([]abci.ValidatorUpdate{abciVal}) assert.Nil(t, err) assert.Equal(t, tmValExpected, tmVals[0]) abciVals := TM2PB.ValidatorUpdates(NewValidatorSet(tmVals)) assert.Equal(t, []abci.ValidatorUpdate{abciVal}, abciVals) // val with address tmVal.Address = pkEd.Address() abciVal = TM2PB.ValidatorUpdate(tmVal) tmVals, err = PB2TM.ValidatorUpdates([]abci.ValidatorUpdate{abciVal}) assert.Nil(t, err) assert.Equal(t, tmValExpected, tmVals[0]) }
explode_data.jsonl/65074
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 300 }
[ 2830, 3393, 1867, 11237, 31748, 1155, 353, 8840, 836, 8, 341, 3223, 74, 2715, 1669, 1501, 82, 16, 17, 18, 23, 16, 65384, 32124, 1592, 1005, 29162, 1592, 2822, 197, 322, 4396, 22935, 198, 3244, 76, 2208, 18896, 1669, 1532, 14256, 39928...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestAddUserToTeam(t *testing.T) { th := Setup(t).InitBasic() defer th.TearDown() t.Run("add user", func(t *testing.T) { user := model.User{Email: strings.ToLower(model.NewId()) + "success+test@example.com", Nickname: "Darth Vader", Username: "vader" + model.NewId(), Password: "passwd1", AuthService: ""} ruser, _ := th.App.CreateUser(&user) defer th.App.PermanentDeleteUser(&user) _, err := th.App.AddUserToTeam(th.BasicTeam.Id, ruser.Id, "") require.Nil(t, err, "Should add user to the team") }) t.Run("allow user by domain", func(t *testing.T) { th.BasicTeam.AllowedDomains = "example.com" _, err := th.App.UpdateTeam(th.BasicTeam) require.Nil(t, err, "Should update the team") user := model.User{Email: strings.ToLower(model.NewId()) + "success+test@example.com", Nickname: "Darth Vader", Username: "vader" + model.NewId(), Password: "passwd1", AuthService: ""} ruser, _ := th.App.CreateUser(&user) defer th.App.PermanentDeleteUser(&user) _, err = th.App.AddUserToTeam(th.BasicTeam.Id, ruser.Id, "") require.Nil(t, err, "Should have allowed whitelisted user") }) t.Run("block user by domain but allow bot", func(t *testing.T) { th.BasicTeam.AllowedDomains = "example.com" _, err := th.App.UpdateTeam(th.BasicTeam) require.Nil(t, err, "Should update the team") user := model.User{Email: strings.ToLower(model.NewId()) + "test@invalid.com", Nickname: "Darth Vader", Username: "vader" + model.NewId(), Password: "passwd1", AuthService: ""} ruser, err := th.App.CreateUser(&user) require.Nil(t, err, "Error creating user: %s", err) defer th.App.PermanentDeleteUser(&user) _, err = th.App.AddUserToTeam(th.BasicTeam.Id, ruser.Id, "") require.NotNil(t, err, "Should not add restricted user") require.Equal(t, "JoinUserToTeam", err.Where, "Error should be JoinUserToTeam") user = model.User{Email: strings.ToLower(model.NewId()) + "test@invalid.com", Nickname: "Darth Vader", Username: "vader" + model.NewId(), AuthService: "notnil", AuthData: model.NewString("notnil")} ruser, err = th.App.CreateUser(&user) require.Nil(t, err, "Error creating authservice user: %s", err) defer th.App.PermanentDeleteUser(&user) _, err = th.App.AddUserToTeam(th.BasicTeam.Id, ruser.Id, "") require.NotNil(t, err, "Should not add authservice user") require.Equal(t, "JoinUserToTeam", err.Where, "Error should be JoinUserToTeam") bot, err := th.App.CreateBot(&model.Bot{ Username: "somebot", Description: "a bot", OwnerId: th.BasicUser.Id, }) require.Nil(t, err) _, err = th.App.AddUserToTeam(th.BasicTeam.Id, bot.UserId, "") assert.Nil(t, err, "should be able to add bot to domain restricted team") }) t.Run("block user with subdomain", func(t *testing.T) { th.BasicTeam.AllowedDomains = "example.com" _, err := th.App.UpdateTeam(th.BasicTeam) require.Nil(t, err, "Should update the team") user := model.User{Email: strings.ToLower(model.NewId()) + "test@invalid.example.com", Nickname: "Darth Vader", Username: "vader" + model.NewId(), Password: "passwd1", AuthService: ""} ruser, _ := th.App.CreateUser(&user) defer th.App.PermanentDeleteUser(&user) _, err = th.App.AddUserToTeam(th.BasicTeam.Id, ruser.Id, "") require.NotNil(t, err, "Should not add restricted user") require.Equal(t, "JoinUserToTeam", err.Where, "Error should be JoinUserToTeam") }) t.Run("allow users by multiple domains", func(t *testing.T) { th.BasicTeam.AllowedDomains = "foo.com, bar.com" _, err := th.App.UpdateTeam(th.BasicTeam) require.Nil(t, err, "Should update the team") user1 := model.User{Email: strings.ToLower(model.NewId()) + "success+test@foo.com", Nickname: "Darth Vader", Username: "vader" + model.NewId(), Password: "passwd1", AuthService: ""} ruser1, _ := th.App.CreateUser(&user1) user2 := model.User{Email: strings.ToLower(model.NewId()) + "success+test@bar.com", Nickname: "Darth Vader", Username: "vader" + model.NewId(), Password: "passwd1", AuthService: ""} ruser2, _ := th.App.CreateUser(&user2) user3 := model.User{Email: strings.ToLower(model.NewId()) + "success+test@invalid.com", Nickname: "Darth Vader", Username: "vader" + model.NewId(), Password: "passwd1", AuthService: ""} ruser3, _ := th.App.CreateUser(&user3) defer th.App.PermanentDeleteUser(&user1) defer th.App.PermanentDeleteUser(&user2) defer th.App.PermanentDeleteUser(&user3) _, err = th.App.AddUserToTeam(th.BasicTeam.Id, ruser1.Id, "") require.Nil(t, err, "Should have allowed whitelisted user1") _, err = th.App.AddUserToTeam(th.BasicTeam.Id, ruser2.Id, "") require.Nil(t, err, "Should have allowed whitelisted user2") _, err = th.App.AddUserToTeam(th.BasicTeam.Id, ruser3.Id, "") require.NotNil(t, err, "Should not have allowed restricted user3") require.Equal(t, "JoinUserToTeam", err.Where, "Error should be JoinUserToTeam") }) }
explode_data.jsonl/30270
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1869 }
[ 2830, 3393, 2212, 1474, 1249, 14597, 1155, 353, 8840, 836, 8, 341, 70479, 1669, 18626, 1155, 568, 3803, 15944, 741, 16867, 270, 836, 682, 4454, 2822, 3244, 16708, 445, 718, 1196, 497, 2915, 1155, 353, 8840, 836, 8, 341, 197, 19060, 16...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestString(t *testing.T) { program := &Program{ Statements: []Statement{ &VarStatement{ Token: token.Token{ Type: token.Var, Literal: "var", }, Name: &Identifier{ Token: token.Token{ Type: token.Ident, Literal: "myVar", }, Value: "myVar", }, Value: &Identifier{ Token: token.Token{ Type: token.Ident, Literal: "anotherVar", }, Value: "anotherVar", }, }, }, } if program.String() != "var myVar = anotherVar" { t.Errorf("program.String() wrong. got=%q", program.String()) } }
explode_data.jsonl/58646
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 295 }
[ 2830, 3393, 703, 1155, 353, 8840, 836, 8, 341, 197, 14906, 1669, 609, 10690, 515, 197, 197, 93122, 25, 3056, 8636, 515, 298, 197, 5, 3962, 8636, 515, 571, 33299, 25, 3950, 32277, 515, 464, 27725, 25, 262, 3950, 87968, 345, 464, 1507...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestQueryOrder(t *testing.T) { t.Parallel() _, err := b.QueryOrder(context.Background(), currency.NewPair(currency.BTC, currency.USDT), "", 1337) switch { case areTestAPIKeysSet() && err != nil: t.Error("QueryOrder() error", err) case !areTestAPIKeysSet() && err == nil && !mockTests: t.Error("QueryOrder() expecting an error when no keys are set") case mockTests && err != nil: t.Error("Mock QueryOrder() error", err) } }
explode_data.jsonl/76653
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 158 }
[ 2830, 3393, 2859, 4431, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 2822, 197, 6878, 1848, 1669, 293, 15685, 4431, 5378, 19047, 1507, 11413, 7121, 12443, 90475, 1785, 7749, 11, 11413, 67672, 10599, 701, 7342, 220, 16, 18, 18, 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...
8
func TestUpdateClusterStatusOK(t *testing.T) { clusterName := "foobarCluster" // create dummy httpserver testClusterServer := httptest.NewServer(createHttptestFakeHandlerForCluster(true)) defer testClusterServer.Close() federationCluster := newCluster(clusterName, testClusterServer.URL) federationClusterList := newClusterList(federationCluster) testFederationServer := httptest.NewServer(createHttptestFakeHandlerForFederation(federationClusterList, true)) defer testFederationServer.Close() restClientCfg, err := clientcmd.BuildConfigFromFlags(testFederationServer.URL, "") if err != nil { t.Errorf("Failed to build client config") } federationClientSet := federationclientset.NewForConfigOrDie(restclient.AddUserAgent(restClientCfg, "cluster-controller")) // Override KubeconfigGetterForCluster to avoid having to setup service accounts and mount files with secret tokens. originalGetter := controllerutil.KubeconfigGetterForCluster controllerutil.KubeconfigGetterForCluster = func(c *federationv1beta1.Cluster) clientcmd.KubeconfigGetter { return func() (*clientcmdapi.Config, error) { return &clientcmdapi.Config{}, nil } } manager := NewclusterController(federationClientSet, 5) err = manager.UpdateClusterStatus() if err != nil { t.Errorf("Failed to Update Cluster Status: %v", err) } clusterStatus, found := manager.clusterClusterStatusMap[clusterName] if !found { t.Errorf("Failed to Update Cluster Status") } else { if (clusterStatus.Conditions[1].Status != v1.ConditionFalse) || (clusterStatus.Conditions[1].Type != federationv1beta1.ClusterOffline) { t.Errorf("Failed to Update Cluster Status") } } // Reset KubeconfigGetterForCluster controllerutil.KubeconfigGetterForCluster = originalGetter }
explode_data.jsonl/15120
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 575 }
[ 2830, 3393, 4289, 28678, 2522, 3925, 1155, 353, 8840, 836, 8, 341, 197, 18855, 675, 1669, 330, 50267, 28678, 698, 197, 322, 1855, 17292, 1758, 4030, 198, 18185, 28678, 5475, 1669, 54320, 70334, 7121, 5475, 32602, 39, 5566, 70334, 52317, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestClientIntermediaryErrors(t *testing.T) { testcase := func(code int, expectedErrorCode twirp.ErrorCode, clientMaker func(string, HTTPClient) Haberdasher) func(*testing.T) { return func(t *testing.T) { // Make a server that returns invalid twirp error responses, // simulating a network intermediary. s := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { w.WriteHeader(code) _, err := w.Write([]byte("response from intermediary")) if err != nil { t.Fatalf("Unexpected error: %s", err.Error()) } })) defer s.Close() client := clientMaker(s.URL, http.DefaultClient) _, err := client.MakeHat(context.Background(), &Size{Inches: 1}) if err == nil { t.Fatal("Expected error, but found nil") } if twerr, ok := err.(twirp.Error); !ok { t.Fatalf("expected twirp.Error typed err, have=%T", err) } else { // error message should mention the code if !strings.Contains(twerr.Msg(), fmt.Sprintf("Error from intermediary with HTTP status code %d", code)) { t.Errorf("unexpected error message: %q", twerr.Msg()) } // error meta should include http_error_from_intermediary if twerr.Meta("http_error_from_intermediary") != "true" { t.Errorf("expected error.Meta('http_error_from_intermediary') to be %q, but found %q", "true", twerr.Meta("http_error_from_intermediary")) } // error meta should include status if twerr.Meta("status_code") != strconv.Itoa(code) { t.Errorf("expected error.Meta('status_code') to be %q, but found %q", code, twerr.Meta("status_code")) } // error meta should include body if twerr.Meta("body") != "response from intermediary" { t.Errorf("expected error.Meta('body') to be the response from intermediary, but found %q", twerr.Meta("body")) } // error code should be properly mapped from HTTP Code if twerr.Code() != expectedErrorCode { t.Errorf("expected to map HTTP status %q to twirp.ErrorCode %q, but found %q", code, expectedErrorCode, twerr.Code()) } } } } var cases = []struct { httpStatusCode int twirpErrorCode twirp.ErrorCode }{ // Map meaningful HTTP codes to semantic equivalent twirp.ErrorCodes {400, twirp.Internal}, {401, twirp.Unauthenticated}, {403, twirp.PermissionDenied}, {404, twirp.BadRoute}, {429, twirp.Unavailable}, {502, twirp.Unavailable}, {503, twirp.Unavailable}, {504, twirp.Unavailable}, // all other codes are unknown {505, twirp.Unknown}, {410, twirp.Unknown}, {408, twirp.Unknown}, } for _, c := range cases { jsonTestName := fmt.Sprintf("json_client/%d_to_%s", c.httpStatusCode, c.twirpErrorCode) t.Run(jsonTestName, testcase(c.httpStatusCode, c.twirpErrorCode, NewHaberdasherJSONClient)) protoTestName := fmt.Sprintf("proto_client/%d_to_%s", c.httpStatusCode, c.twirpErrorCode) t.Run(protoTestName, testcase(c.httpStatusCode, c.twirpErrorCode, NewHaberdasherProtobufClient)) } }
explode_data.jsonl/617
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1150 }
[ 2830, 3393, 2959, 3306, 4404, 658, 13877, 1155, 353, 8840, 836, 8, 341, 18185, 5638, 1669, 2915, 15842, 526, 11, 3601, 30748, 4384, 404, 79, 98433, 11, 2943, 33259, 2915, 3609, 11, 10130, 2959, 8, 28876, 14348, 33767, 8, 2915, 4071, 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 TestIntegration(t *testing.T) { if testing.Short() { t.Skip() } t.Parallel() db, cleanup := dbtest.NewDB(t, *dsn) defer cleanup() t.Run("Store", testStore(db)) t.Run("GitHubWebhook", testGitHubWebhook(db)) }
explode_data.jsonl/49086
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 97 }
[ 2830, 3393, 52464, 1155, 353, 8840, 836, 8, 341, 743, 7497, 55958, 368, 341, 197, 3244, 57776, 741, 197, 630, 3244, 41288, 7957, 2822, 20939, 11, 21290, 1669, 2927, 1944, 7121, 3506, 1155, 11, 353, 75136, 340, 16867, 21290, 2822, 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 ]
2
func TestCensorAPIKey(t *testing.T) { cfg := APIConfig{ Key: "ddog_32_characters_long_api_key1", } assert.Equal( t, "***************************_key1", cfg.GetCensoredKey(), ) }
explode_data.jsonl/32914
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 86 }
[ 2830, 3393, 34, 3805, 7082, 1592, 1155, 353, 8840, 836, 8, 341, 50286, 1669, 5333, 2648, 515, 197, 55242, 25, 330, 631, 538, 62, 18, 17, 79060, 17799, 11697, 3097, 16, 756, 197, 630, 6948, 12808, 1006, 197, 3244, 345, 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
func TestMissingModuleFolder(t *testing.T) { home := paths.Paths.Home paths.Paths.Home = "/no/such/path" defer func() { paths.Paths.Home = home }() configs := []*conf.C{ load(t, map[string]interface{}{"module": "nginx"}), } reg, err := NewModuleRegistry(configs, beat.Info{Version: "5.2.0"}, true) require.NoError(t, err) assert.NotNil(t, reg) // this should return an empty list, but no error inputs, err := reg.GetInputConfigs() require.NoError(t, err) assert.Equal(t, 0, len(inputs)) }
explode_data.jsonl/64759
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 201 }
[ 2830, 3393, 25080, 3332, 13682, 1155, 353, 8840, 836, 8, 341, 197, 5117, 1669, 12716, 91663, 59965, 198, 197, 21623, 91663, 59965, 284, 3521, 2152, 2687, 1387, 50976, 698, 16867, 2915, 368, 314, 12716, 91663, 59965, 284, 2114, 335, 2822, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestPathToArray(t *testing.T) { path := NewParams(44, 118, 1, false, 4) require.Equal(t, "[44 118 1 0 4]", fmt.Sprintf("%v", path.DerivationPath())) path = NewParams(44, 118, 2, true, 15) require.Equal(t, "[44 118 2 1 15]", fmt.Sprintf("%v", path.DerivationPath())) }
explode_data.jsonl/68949
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 115 }
[ 2830, 3393, 1820, 29512, 1155, 353, 8840, 836, 8, 341, 26781, 1669, 1532, 4870, 7, 19, 19, 11, 220, 16, 16, 23, 11, 220, 16, 11, 895, 11, 220, 19, 340, 17957, 12808, 1155, 11, 10545, 19, 19, 220, 16, 16, 23, 220, 16, 220, 15, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestRoute_GetNamespace(t *testing.T) { route := Route{} route.namespace = "example" got := route.GetNamespace() if got != route.namespace { t.Errorf("GetNamespace() = %s, want %s", got, route.namespace) } }
explode_data.jsonl/67783
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 84 }
[ 2830, 3393, 4899, 13614, 22699, 1155, 353, 8840, 836, 8, 341, 7000, 2133, 1669, 9572, 16094, 7000, 2133, 50409, 284, 330, 8687, 698, 3174, 354, 1669, 6021, 2234, 22699, 2822, 743, 2684, 961, 6021, 50409, 341, 197, 3244, 13080, 445, 1949...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestSimplifiedURLs(t *testing.T) { opts := GetDefaultOptions() opts.NoRandomize = true opts.Servers = []string{ "nats://host1:1234", "nats://host2:", "nats://host3", "host4:1234", "host5:", "host6", "nats://[1:2:3:4]:1234", "nats://[5:6:7:8]:", "nats://[9:10:11:12]", "[13:14:15:16]:", "[17:18:19:20]:1234", } // We expect the result in the server pool to be: expected := []string{ "nats://host1:1234", "nats://host2:4222", "nats://host3:4222", "nats://host4:1234", "nats://host5:4222", "nats://host6:4222", "nats://[1:2:3:4]:1234", "nats://[5:6:7:8]:4222", "nats://[9:10:11:12]:4222", "nats://[13:14:15:16]:4222", "nats://[17:18:19:20]:1234", } nc := &Conn{Opts: opts} if err := nc.setupServerPool(); err != nil { t.Fatalf("Problem setting up Server Pool: %v\n", err) } // Check server pool directly for i, u := range nc.srvPool { if u.url.String() != expected[i] { t.Fatalf("Expected url %q, got %q", expected[i], u.url.String()) } } }
explode_data.jsonl/44908
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 514 }
[ 2830, 3393, 50, 73837, 3144, 82, 1155, 353, 8840, 836, 8, 341, 64734, 1669, 2126, 3675, 3798, 741, 64734, 16766, 13999, 551, 284, 830, 198, 64734, 808, 18729, 284, 3056, 917, 515, 197, 197, 1, 77, 1862, 1110, 3790, 16, 25, 16, 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...
4
func TestOther(t *testing.T) { if testing.Short() { t.Skip() } execStatements(t, []string{ "create table stream1(id int, val varbinary(128), primary key(id))", "create table stream2(id int, val varbinary(128), primary key(id))", }) defer execStatements(t, []string{ "drop table stream1", "drop table stream2", }) engine.se.Reload(context.Background()) testcases := []string{ "repair table stream2", "optimize table stream2", "analyze table stream2", "select * from stream1", "set @val=1", "show tables", "describe stream1", "grant select on stream1 to current_user()", "revoke select on stream1 from current_user()", } // customRun is a modified version of runCases. customRun := func(mode string) { t.Logf("Run mode: %v", mode) ctx, cancel := context.WithCancel(context.Background()) defer cancel() wg, ch := startStream(ctx, t, nil, "", nil) defer wg.Wait() want := [][]string{{ `gtid`, `type:OTHER`, }} for _, stmt := range testcases { startPosition := primaryPosition(t) execStatement(t, stmt) endPosition := primaryPosition(t) if startPosition == endPosition { t.Logf("statement %s did not affect binlog", stmt) continue } expectLog(ctx, t, stmt, ch, want) } cancel() if evs, ok := <-ch; ok { t.Fatalf("unexpected evs: %v", evs) } } customRun("gtid") // Test FilePos flavor savedEngine := engine defer func() { engine = savedEngine }() engine = customEngine(t, func(in mysql.ConnParams) mysql.ConnParams { in.Flavor = "FilePos" return in }) defer engine.Close() customRun("filePos") }
explode_data.jsonl/10409
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 633 }
[ 2830, 3393, 11409, 1155, 353, 8840, 836, 8, 341, 743, 7497, 55958, 368, 341, 197, 3244, 57776, 741, 197, 630, 67328, 93122, 1155, 11, 3056, 917, 515, 197, 197, 1, 3182, 1965, 4269, 16, 3724, 526, 11, 1044, 762, 25891, 7, 16, 17, 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...
4
func TestContext2Plan_computedMultiIndex(t *testing.T) { m := testModule(t, "plan-computed-multi-index") p := testProvider("aws") p.DiffFn = testDiffFn p.GetSchemaReturn = &ProviderSchema{ ResourceTypes: map[string]*configschema.Block{ "aws_instance": { Attributes: map[string]*configschema.Attribute{ "compute": {Type: cty.String, Optional: true}, "foo": {Type: cty.List(cty.String), Optional: true}, "ip": {Type: cty.List(cty.String), Computed: true}, }, }, }, } p.DiffFn = func(info *InstanceInfo, s *InstanceState, c *ResourceConfig) (*InstanceDiff, error) { diff := &InstanceDiff{ Attributes: map[string]*ResourceAttrDiff{}, } compute, _ := c.Raw["compute"].(string) if compute != "" { diff.Attributes[compute] = &ResourceAttrDiff{ Old: "", New: "", NewComputed: true, } diff.Attributes["compute"] = &ResourceAttrDiff{ Old: "", New: compute, } } fooOld := s.Attributes["foo"] fooNew, _ := c.Raw["foo"].(string) fooComputed := false for _, k := range c.ComputedKeys { if k == "foo" { fooComputed = true } } if fooNew != "" { diff.Attributes["foo"] = &ResourceAttrDiff{ Old: fooOld, New: fooNew, NewComputed: fooComputed, } } ipOld := s.Attributes["ip"] ipComputed := ipOld == "" diff.Attributes["ip"] = &ResourceAttrDiff{ Old: ipOld, New: "", NewComputed: ipComputed, } return diff, nil } ctx := testContext2(t, &ContextOpts{ Config: m, ProviderResolver: providers.ResolverFixed( map[string]providers.Factory{ "aws": testProviderFuncFixed(p), }, ), }) plan, diags := ctx.Plan() if diags.HasErrors() { t.Fatalf("unexpected errors: %s", diags.Err()) } schema := p.GetSchemaReturn.ResourceTypes["aws_instance"] ty := schema.ImpliedType() if len(plan.Changes.Resources) != 3 { t.Fatal("expected 3 changes, got", len(plan.Changes.Resources)) } for _, res := range plan.Changes.Resources { if res.Action != plans.Create { t.Fatalf("expected resource creation, got %s", res.Action) } ric, err := res.Decode(ty) if err != nil { t.Fatal(err) } switch i := ric.Addr.String(); i { case "aws_instance.foo[0]": checkVals(t, objectVal(t, schema, map[string]cty.Value{ "ip": cty.UnknownVal(cty.List(cty.String)), "foo": cty.NullVal(cty.List(cty.String)), "compute": cty.StringVal("ip.#"), }), ric.After) case "aws_instance.foo[1]": checkVals(t, objectVal(t, schema, map[string]cty.Value{ "ip": cty.UnknownVal(cty.List(cty.String)), "foo": cty.NullVal(cty.List(cty.String)), "compute": cty.StringVal("ip.#"), }), ric.After) case "aws_instance.bar[0]": checkVals(t, objectVal(t, schema, map[string]cty.Value{ "ip": cty.UnknownVal(cty.List(cty.String)), "foo": cty.UnknownVal(cty.List(cty.String)), }), ric.After) default: t.Fatal("unknown instance:", i) } } }
explode_data.jsonl/28674
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1358 }
[ 2830, 3393, 1972, 17, 20485, 2965, 19292, 20358, 1552, 1155, 353, 8840, 836, 8, 341, 2109, 1669, 1273, 3332, 1155, 11, 330, 10393, 11476, 19292, 95669, 21492, 1138, 3223, 1669, 1273, 5179, 445, 8635, 1138, 3223, 98063, 24911, 284, 1273, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestWriteTooLong(t *testing.T) { w := NewWriter(ioutil.Discard) b := make([]byte, MaxFrameLength+1) n, err := w.Write(b) assert.Error(t, err, "Writing too long message should result in error") assert.Equal(t, 0, n, "Writing too long message should result in 0 bytes written") n, err = w.Write(b[:len(b)-1]) assert.NoError(t, err, "Writing message of MaxFrameLength should be allowed") assert.Equal(t, MaxFrameLength, n, "Writing message of MaxFrameLength should have written MaxFrameLength bytes") }
explode_data.jsonl/19797
{ "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, 7985, 31246, 6583, 1155, 353, 8840, 836, 8, 341, 6692, 1669, 1532, 6492, 1956, 30158, 909, 47560, 340, 2233, 1669, 1281, 10556, 3782, 11, 7487, 4369, 4373, 10, 16, 340, 9038, 11, 1848, 1669, 289, 4073, 1883, 340, 6948, 614...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestLink(t *testing.T) { fakeIGs := instances.NewFakeInstanceGroups(sets.NewString(), defaultNamer) fakeNodePool := instances.NewNodePool(fakeIGs, defaultNamer) fakeGCE := gce.FakeGCECloud(gce.DefaultTestClusterValues()) linker := newTestIGLinker(fakeGCE, fakeNodePool) sp := utils.ServicePort{NodePort: 8080, Protocol: annotations.ProtocolHTTP} // Mimic the instance group being created if _, err := linker.instancePool.EnsureInstanceGroupsAndPorts(defaultNamer.InstanceGroup(), []int64{sp.NodePort}); err != nil { t.Fatalf("Did not expect error when ensuring IG for ServicePort %+v: %v", sp, err) } // Mimic the syncer creating the backend. linker.backendPool.Create(sp, "fake-health-check-link") if err := linker.Link(sp, []GroupKey{{Zone: defaultZone}}); err != nil { t.Fatalf("%v", err) } be, err := fakeGCE.GetGlobalBackendService(sp.BackendName(defaultNamer)) if err != nil { t.Fatalf("%v", err) } if len(be.Backends) == 0 { t.Fatalf("Expected Backends to be created") } }
explode_data.jsonl/81933
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 363 }
[ 2830, 3393, 3939, 1155, 353, 8840, 836, 8, 341, 1166, 726, 1914, 82, 1669, 13121, 7121, 52317, 2523, 22173, 7, 4917, 7121, 703, 1507, 1638, 45, 15232, 340, 1166, 726, 1955, 10551, 1669, 13121, 7121, 1955, 10551, 74138, 1914, 82, 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...
5
func TestNewFromFormat(t *testing.T) { date := "05-13-2011" testTime := time.Date(2011, 5, 13, 0, 0, 0, 0, time.Local) lib, err := New(date, "MM-DD-YYYY") if assert.NoError(t, err) { assert.True(t, testTime.Equal(lib.ToTime())) } }
explode_data.jsonl/73967
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 108 }
[ 2830, 3393, 3564, 3830, 4061, 1155, 353, 8840, 836, 8, 341, 44086, 1669, 330, 15, 20, 12, 16, 18, 12, 17, 15, 16, 16, 698, 18185, 1462, 1669, 882, 8518, 7, 17, 15, 16, 16, 11, 220, 20, 11, 220, 16, 18, 11, 220, 15, 11, 220, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_toSnakeCase(t *testing.T) { tests := []struct { want string input string }{ {"", ""}, {"A", "a"}, {"AaAa", "aa_aa"}, {"BatteryLifeValue", "battery_life_value"}, {"Id0Value", "id0_value"}, } for _, test := range tests { have := toCamelCase(test.input) if have != test.want { t.Errorf("input=%q:\nhave: %q\nwant: %q", test.input, have, test.want) } } }
explode_data.jsonl/14290
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 177 }
[ 2830, 3393, 2346, 83420, 4207, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 3056, 1235, 341, 197, 50780, 220, 914, 198, 197, 22427, 914, 198, 197, 59403, 197, 197, 4913, 497, 77496, 197, 197, 4913, 32, 497, 330, 64, 7115, 197, 197, 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...
3
func TestBinaries(t *testing.T) { t.Parallel() // this test only verifies that specifying `binaryTargets` downloaded the separate file into the directory _, err := os.Stat("./query-engine-" + platform.BinaryPlatformName() + "_gen.go") assert.Equal(t, err, nil) _, err = os.Stat("./query-engine-debian-openssl-1.1.x_gen.go") assert.Equal(t, err, nil) }
explode_data.jsonl/80900
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 132 }
[ 2830, 3393, 28794, 5431, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 2822, 197, 322, 419, 1273, 1172, 87856, 429, 37838, 1565, 25891, 49030, 63, 23293, 279, 8651, 1034, 1119, 279, 6220, 198, 197, 6878, 1848, 1669, 2643, 53419, 1398...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestStringConv(t *testing.T) { s := strconv.Itoa(10) t.Log("str" + s) if i, err := strconv.Atoi("10"); err == nil { t.Log(10 + i) } }
explode_data.jsonl/51245
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 73 }
[ 2830, 3393, 703, 34892, 1155, 353, 8840, 836, 8, 341, 1903, 1669, 33317, 64109, 7, 16, 15, 340, 3244, 5247, 445, 495, 1, 488, 274, 340, 743, 600, 11, 1848, 1669, 33317, 67107, 445, 16, 15, 5038, 1848, 621, 2092, 341, 197, 3244, 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 ]
2
func TestBasic(t *testing.T) { sys := newTestSystem(t, func(creds *auth.Credentials, fs *filesystem) *kernfs.Dentry { return fs.newReadonlyDir(creds, 0755, map[string]*kernfs.Dentry{ "file1": fs.newFile(creds, staticFileContent), }) }) sys.GetDentryOrDie(sys.PathOpAtRoot("file1")).DecRef() }
explode_data.jsonl/19800
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 130 }
[ 2830, 3393, 15944, 1155, 353, 8840, 836, 8, 341, 41709, 1669, 501, 2271, 2320, 1155, 11, 2915, 7, 85734, 353, 3242, 727, 15735, 11, 8619, 353, 41897, 8, 353, 74, 932, 3848, 909, 4085, 341, 197, 853, 8619, 4618, 4418, 3243, 6184, 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 TestClusterCSINodeV2(t *testing.T) { ctx := framework.NewTestCtx(t) defer ctx.Cleanup() resourceNS := "kube-system" namespace, err := ctx.GetNamespace() if err != nil { t.Fatalf("could not get namespace: %v", err) } clusterSpec := storageos.StorageOSClusterSpec{ SecretRefName: "storageos-api", SecretRefNamespace: "default", Namespace: resourceNS, Tolerations: []corev1.Toleration{ { Key: "key", Operator: corev1.TolerationOpEqual, Value: "value", Effect: corev1.TaintEffectNoSchedule, }, }, K8sDistro: "openshift", Images: storageos.ContainerImages{ NodeContainer: "rotsesgao/node:v2", APIManagerContainer: "storageos/api-manager:develop", }, KVBackend: storageos.StorageOSClusterKVBackend{ Address: "etcd-client.default.svc.cluster.local:2379", }, } testStorageOS := testutil.NewStorageOSCluster(namespace, clusterSpec) t.Run("SetupOperator", func(t *testing.T) { testutil.SetupOperator(t, ctx) }) t.Run("DeployCluster", func(t *testing.T) { err = testutil.DeployCluster(t, ctx, testStorageOS) if err != nil { t.Fatal(err) } }) namespacedName := types.NamespacedName{ Name: testutil.TestClusterCRName, Namespace: namespace, } t.Run("ClusterStatusCheck", func(t *testing.T) { if err = testutil.ClusterStatusCheck(t, namespacedName, 1, testutil.RetryInterval, testutil.Timeout); err != nil { t.Fatal(err) } }) f := framework.Global daemonset, err := f.KubeClient.AppsV1().DaemonSets(resourceNS).Get(context.TODO(), "storageos-daemonset", metav1.GetOptions{}) if err != nil { t.Fatalf("failed to get storageos-daemonset: %v", err) } info, err := f.KubeClient.Discovery().ServerVersion() if err != nil { t.Fatalf("failed to get version info: %v", err) } version := strings.TrimLeft(info.String(), "v") t.Run("CSIHelperCountTest", func(t *testing.T) { //Check the number of containers in daemonset pod spec. if deploy.CSIV1Supported(version) { if len(daemonset.Spec.Template.Spec.Containers) != 3 { t.Errorf("unexpected number of daemonset pod containers:\n\t(GOT) %d\n\t(WNT) %d", len(daemonset.Spec.Template.Spec.Containers), 3) } } else { if len(daemonset.Spec.Template.Spec.Containers) != 2 { t.Errorf("unexpected number of daemonset pod containers:\n\t(GOT) %d\n\t(WNT) %d", len(daemonset.Spec.Template.Spec.Containers), 2) } } }) // Test DaemonSet configuration. t.Run("DaemonSetDefaultLogAnnotationTest", func(t *testing.T) { testutil.DaemonSetDefaultLogAnnotationTest(t, f.KubeClient, resourceNS) }) // Test StorageOSCluster CR attributes. t.Run("StorageOSClusterCRAttributesTest", func(t *testing.T) { testutil.StorageOSClusterCRAttributesTest(t, testutil.TestClusterCRName, namespace) }) // Test CSIDriver resource existence. t.Run("CSIDriverResourceTest", func(t *testing.T) { testutil.CSIDriverResourceTest(t, deploy.StorageOSProvisionerName) }) // API Manager tests. t.Run("APIManagerDeploymentTest", func(t *testing.T) { testutil.APIManagerDeploymentTest(t, resourceNS, testutil.RetryInterval, testutil.Timeout) }) t.Run("APIManagerMetricsServiceTest", func(t *testing.T) { testutil.APIManagerMetricsServiceTest(t, resourceNS, testutil.RetryInterval, testutil.Timeout) }) t.Run("APIManagerMetricsServiceMonitorTest", func(t *testing.T) { testutil.APIManagerMetricsServiceMonitorTest(t, resourceNS, testutil.RetryInterval, testutil.Timeout) }) // Test pod scheduler mutating admission contoller. t.Run("PodSchedulerAdmissionControllerTest", func(t *testing.T) { testutil.PodSchedulerAdmissionControllerTest(t, ctx) }) // Test node label sync. // TODO: Currently relies on v1 CLI. // testutil.NodeLabelSyncTest(t, f.KubeClient) }
explode_data.jsonl/28613
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1493 }
[ 2830, 3393, 28678, 6412, 687, 534, 53, 17, 1155, 353, 8840, 836, 8, 341, 20985, 1669, 12626, 7121, 2271, 23684, 1155, 340, 16867, 5635, 727, 60639, 741, 50346, 2448, 1669, 330, 97717, 36648, 1837, 56623, 11, 1848, 1669, 5635, 2234, 2269...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestSetMemoryLimit(t *testing.T) { c, err := NewContainer(ContainerName) if err != nil { t.Errorf(err.Error()) } oldMemLimit, err := c.MemoryLimit() if err != nil { t.Errorf(err.Error()) } if err := c.SetMemoryLimit(oldMemLimit * 4); err != nil { t.Errorf(err.Error()) } newMemLimit, err := c.MemoryLimit() if err != nil { t.Errorf(err.Error()) } if newMemLimit != oldMemLimit*4 { t.Errorf("SetMemoryLimit failed") } }
explode_data.jsonl/2786
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 184 }
[ 2830, 3393, 1649, 10642, 16527, 1155, 353, 8840, 836, 8, 341, 1444, 11, 1848, 1669, 1532, 4502, 75145, 675, 340, 743, 1848, 961, 2092, 341, 197, 3244, 13080, 3964, 6141, 2398, 197, 630, 61828, 18816, 16527, 11, 1848, 1669, 272, 71162, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestValidateV1Beta1IncompleteChartSource(t *testing.T) { manifest := `--- apiVersion: manifests/v1beta1 metadata: name: test-manifest spec: sources: charts: - type: directory name: local charts: - name: chart1 source: local namespace: default version: 1.0.0 ` _, err := Validate(manifest) if err == nil || !strings.Contains(err.Error(), "manifest validation errors") { t.Errorf("Didn't get expected error from manifest.TestValidateV1Beta1IncompleteChartSource(), instead got: %s", err) } }
explode_data.jsonl/80479
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 194 }
[ 2830, 3393, 17926, 53, 16, 64811, 16, 96698, 14488, 3608, 1155, 353, 8840, 836, 8, 341, 197, 42315, 1669, 1565, 10952, 2068, 5637, 25, 83232, 5457, 16, 19127, 16, 198, 17637, 510, 220, 829, 25, 1273, 20477, 6962, 198, 9535, 510, 220, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestCloseDialog(t *testing.T) { t.Parallel() tests := []struct { name string accept bool promptText string dialogType page.DialogType sel string want string }{ { name: "AlertAcceptWithPromptText", accept: true, promptText: "this is a prompt text", dialogType: page.DialogTypeAlert, sel: "#alert", want: "alert text", }, { name: "AlertDismissWithPromptText", accept: false, promptText: "this is a prompt text", dialogType: page.DialogTypeAlert, sel: "#alert", want: "alert text", }, { name: "AlertAcceptWithoutPromptText", accept: true, dialogType: page.DialogTypeAlert, sel: "#alert", want: "alert text", }, { name: "AlertDismissWithoutPromptText", accept: false, dialogType: page.DialogTypeAlert, sel: "#alert", want: "alert text", }, { name: "PromptAcceptWithPromptText", accept: true, promptText: "this is a prompt text", dialogType: page.DialogTypePrompt, sel: "#prompt", want: "prompt text", }, { name: "PromptDismissWithPromptText", accept: false, promptText: "this is a prompt text", dialogType: page.DialogTypePrompt, sel: "#prompt", want: "prompt text", }, { name: "PromptAcceptWithoutPromptText", accept: true, dialogType: page.DialogTypePrompt, sel: "#prompt", want: "prompt text", }, { name: "PromptDismissWithoutPromptText", accept: false, dialogType: page.DialogTypePrompt, sel: "#prompt", want: "prompt text", }, { name: "ConfirmAcceptWithPromptText", accept: true, promptText: "this is a prompt text", dialogType: page.DialogTypeConfirm, sel: "#confirm", want: "confirm text", }, { name: "ConfirmDismissWithPromptText", accept: false, promptText: "this is a prompt text", dialogType: page.DialogTypeConfirm, sel: "#confirm", want: "confirm text", }, { name: "ConfirmAcceptWithoutPromptText", accept: true, dialogType: page.DialogTypeConfirm, sel: "#confirm", want: "confirm text", }, { name: "ConfirmDismissWithoutPromptText", accept: false, dialogType: page.DialogTypeConfirm, sel: "#confirm", want: "confirm text", }, } for _, test := range tests { t.Run(test.name, func(t *testing.T) { t.Parallel() ctx, cancel := testAllocate(t, "") defer cancel() ListenTarget(ctx, func(ev interface{}) { switch e := ev.(type) { case *page.EventJavascriptDialogOpening: if e.Type != test.dialogType { t.Errorf("expected dialog type to be %q, got: %q", test.dialogType, e.Type) } if e.Message != test.want { t.Errorf("expected dialog message to be %q, got: %q", test.want, e.Message) } task := page.HandleJavaScriptDialog(test.accept) if test.promptText != "" { task = task.WithPromptText(test.promptText) } go func() { if err := Run(ctx, task); err != nil { t.Error(err) } }() case *page.EventJavascriptDialogClosed: if e.Result != test.accept { t.Errorf("expected result to be %t, got %t", test.accept, e.Result) } if e.UserInput != test.promptText { t.Errorf("expected user input to be %q, got %q", test.promptText, e.UserInput) } } }) if err := Run(ctx, Navigate(testdataDir+"/dialog.html"), Click(test.sel, ByID, NodeVisible), ); err != nil { t.Fatal(err) } }) } }
explode_data.jsonl/8481
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1825 }
[ 2830, 3393, 7925, 4468, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 2822, 78216, 1669, 3056, 1235, 341, 197, 11609, 981, 914, 198, 197, 197, 10330, 257, 1807, 198, 197, 3223, 14749, 1178, 914, 198, 197, 59420, 929, 2150, 26854, 9...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestSettings(t *testing.T) { Convey("Works", t, func() { c := context.Background() c = settings.Use(c, settings.New(&settings.MemoryStorage{})) cfg, err := fetchCachedSettings(c) So(err, ShouldBeNil) So(cfg, ShouldResemble, &Settings{}) }) }
explode_data.jsonl/45172
{ "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, 6086, 1155, 353, 8840, 836, 8, 341, 93070, 5617, 445, 37683, 497, 259, 11, 2915, 368, 341, 197, 1444, 1669, 2266, 19047, 741, 197, 1444, 284, 5003, 9046, 1337, 11, 5003, 7121, 2099, 6511, 71162, 5793, 6257, 4390, 197, 5028...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestOCMProvider_GetComputeNodes(t *testing.T) { type fields struct { ocmClient ocm.Client } type args struct { clusterSpec *types.ClusterSpec } internalId := "test-internal-id" spec := &types.ClusterSpec{ InternalID: internalId, ExternalID: "", Status: "", AdditionalInfo: nil, } tests := []struct { name string fields fields args args want *types.ComputeNodesInfo wantErr bool }{ { name: "should return compute nodes info", fields: fields{ ocmClient: &ocm.ClientMock{ GetClusterFunc: func(clusterID string) (*clustersmgmtv1.Cluster, error) { nodes := clustersmgmtv1.NewClusterNodes().Compute(6) return clustersmgmtv1.NewCluster().Nodes(nodes).Build() }, GetExistingClusterMetricsFunc: func(clusterID string) (*v1.SubscriptionMetrics, error) { nodes := v1.NewClusterMetricsNodes().Compute(3) return v1.NewSubscriptionMetrics().Nodes(nodes).Build() }, }, }, args: args{ clusterSpec: spec, }, want: &types.ComputeNodesInfo{ Actual: 3, Desired: 6, }, wantErr: false, }, { name: "should return error when failed to get cluster", fields: fields{ ocmClient: &ocm.ClientMock{ GetClusterFunc: func(clusterID string) (*clustersmgmtv1.Cluster, error) { return nil, errors.Errorf("failed to get cluster info") }, }, }, args: args{ clusterSpec: spec, }, wantErr: true, want: nil, }, { name: "should return error when failed to get existing cluster metrics", fields: fields{ ocmClient: &ocm.ClientMock{ GetClusterFunc: func(clusterID string) (*clustersmgmtv1.Cluster, error) { nodes := clustersmgmtv1.NewClusterNodes().Compute(6) return clustersmgmtv1.NewCluster().Nodes(nodes).Build() }, GetExistingClusterMetricsFunc: func(clusterID string) (*v1.SubscriptionMetrics, error) { return nil, errors.Errorf("failed to get existing cluster metrics") }, }, }, args: args{ clusterSpec: spec, }, wantErr: true, want: nil, }, } for _, test := range tests { t.Run(test.name, func(t *testing.T) { RegisterTestingT(t) p := newOCMProvider(test.fields.ocmClient, nil, &ocm.OCMConfig{}) resp, err := p.GetComputeNodes(test.args.clusterSpec) Expect(resp).To(Equal(test.want)) if test.wantErr { Expect(err).NotTo(BeNil()) } }) } }
explode_data.jsonl/4839
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1092 }
[ 2830, 3393, 7612, 44, 5179, 13614, 46254, 12288, 1155, 353, 8840, 836, 8, 341, 13158, 5043, 2036, 341, 197, 197, 509, 76, 2959, 297, 6226, 11716, 198, 197, 532, 13158, 2827, 2036, 341, 197, 197, 18855, 8327, 353, 9242, 72883, 8327, 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...
1
func TestHasJump(t *testing.T) { testCases := map[string]struct { rules []iptablestest.Rule destChain string destIP string destPort string expected bool }{ "case 1": { // Match the 1st rule(both dest IP and dest Port) rules: []iptablestest.Rule{ {"-d ": "10.20.30.41/32", "--dport ": "80", "-p ": "tcp", "-j ": "REJECT"}, {"--dport ": "3001", "-p ": "tcp", "-j ": "KUBE-MARK-MASQ"}, }, destChain: "REJECT", destIP: "10.20.30.41", destPort: "80", expected: true, }, "case 2": { // Match the 2nd rule(dest Port) rules: []iptablestest.Rule{ {"-d ": "10.20.30.41/32", "-p ": "tcp", "-j ": "REJECT"}, {"--dport ": "3001", "-p ": "tcp", "-j ": "REJECT"}, }, destChain: "REJECT", destIP: "", destPort: "3001", expected: true, }, "case 3": { // Match both dest IP and dest Port rules: []iptablestest.Rule{ {"-d ": "1.2.3.4/32", "--dport ": "80", "-p ": "tcp", "-j ": "KUBE-XLB-GF53O3C2HZEXL2XN"}, }, destChain: "KUBE-XLB-GF53O3C2HZEXL2XN", destIP: "1.2.3.4", destPort: "80", expected: true, }, "case 4": { // Match dest IP but doesn't match dest Port rules: []iptablestest.Rule{ {"-d ": "1.2.3.4/32", "--dport ": "80", "-p ": "tcp", "-j ": "KUBE-XLB-GF53O3C2HZEXL2XN"}, }, destChain: "KUBE-XLB-GF53O3C2HZEXL2XN", destIP: "1.2.3.4", destPort: "8080", expected: false, }, "case 5": { // Match dest Port but doesn't match dest IP rules: []iptablestest.Rule{ {"-d ": "1.2.3.4/32", "--dport ": "80", "-p ": "tcp", "-j ": "KUBE-XLB-GF53O3C2HZEXL2XN"}, }, destChain: "KUBE-XLB-GF53O3C2HZEXL2XN", destIP: "10.20.30.40", destPort: "80", expected: false, }, "case 6": { // Match the 2nd rule(dest IP) rules: []iptablestest.Rule{ {"-d ": "10.20.30.41/32", "-p ": "tcp", "-j ": "REJECT"}, {"-d ": "1.2.3.4/32", "-p ": "tcp", "-j ": "REJECT"}, {"--dport ": "3001", "-p ": "tcp", "-j ": "REJECT"}, }, destChain: "REJECT", destIP: "1.2.3.4", destPort: "8080", expected: true, }, "case 7": { // Match the 2nd rule(dest Port) rules: []iptablestest.Rule{ {"-d ": "10.20.30.41/32", "-p ": "tcp", "-j ": "REJECT"}, {"--dport ": "3001", "-p ": "tcp", "-j ": "REJECT"}, }, destChain: "REJECT", destIP: "1.2.3.4", destPort: "3001", expected: true, }, "case 8": { // Match the 1st rule(dest IP) rules: []iptablestest.Rule{ {"-d ": "10.20.30.41/32", "-p ": "tcp", "-j ": "REJECT"}, {"--dport ": "3001", "-p ": "tcp", "-j ": "REJECT"}, }, destChain: "REJECT", destIP: "10.20.30.41", destPort: "8080", expected: true, }, "case 9": { rules: []iptablestest.Rule{ {"-j ": "KUBE-SEP-LWSOSDSHMKPJHHJV"}, }, destChain: "KUBE-SEP-LWSOSDSHMKPJHHJV", destIP: "", destPort: "", expected: true, }, "case 10": { rules: []iptablestest.Rule{ {"-j ": "KUBE-SEP-FOO"}, }, destChain: "KUBE-SEP-BAR", destIP: "", destPort: "", expected: false, }, } for k, tc := range testCases { if got := hasJump(tc.rules, tc.destChain, tc.destIP, tc.destPort); got != tc.expected { t.Errorf("%v: expected %v, got %v", k, tc.expected, got) } } }
explode_data.jsonl/9291
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1773 }
[ 2830, 3393, 10281, 33979, 1155, 353, 8840, 836, 8, 341, 18185, 37302, 1669, 2415, 14032, 60, 1235, 341, 197, 7000, 2425, 257, 3056, 11442, 480, 267, 477, 63961, 198, 197, 49616, 18837, 914, 198, 197, 49616, 3298, 262, 914, 198, 197, 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...
3
func TestParseUserData(t *testing.T) { for testName, testCase := range map[string]struct { userData string expectError bool expectedUserData userData }{ "Succeeds": { userData: "#!/bin/bash\necho foo", expectedUserData: userData{ Options: userdata.Options{ Directive: userdata.ShellScript + "/bin/bash", Content: "echo foo", }, }, }, "IgnoresLeadingWhitespace": { userData: "\n\n\n#!/bin/bash\necho foo", expectedUserData: userData{ Options: userdata.Options{ Directive: userdata.ShellScript + "/bin/bash", Content: "echo foo", }, }, }, "SucceedsWithDirectiveAndClosingTag": { userData: "<powershell>\necho foo\n</powershell>", expectedUserData: userData{ Options: userdata.Options{ Directive: userdata.PowerShellScript, Content: "echo foo", }, }, }, "SucceedsWithDirectiveAndClosingTagAndPersist": { userData: "<powershell>\necho foo\n</powershell>\n<persist>true</persist>", expectedUserData: userData{ Options: userdata.Options{ Directive: userdata.PowerShellScript, Content: "echo foo", Persist: true, }, }, }, "FailsWithoutMatchingClosingTag": { userData: "<powershell>\necho foo", expectError: true, }, "FailsForNoDirective": { userData: "echo foo", expectError: true, }, "FailsForPersistedUserDataIfUnpersistable": { userData: "<persist>true</persist>\n#!/bin/bash\necho foo", expectError: true, }, "FailsForEmpty": { userData: "", expectError: true, }, } { t.Run(testName, func(t *testing.T) { userData, err := parseUserData(testCase.userData) if !testCase.expectError { require.NoError(t, err) assert.Equal(t, testCase.expectedUserData.Directive, userData.Directive) assert.Equal(t, testCase.expectedUserData.Content, userData.Content) assert.Equal(t, testCase.expectedUserData.Persist, userData.Persist) } else { assert.Error(t, err) assert.Empty(t, userData) } }) } }
explode_data.jsonl/3807
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 900 }
[ 2830, 3393, 14463, 39485, 1155, 353, 8840, 836, 8, 341, 2023, 94396, 11, 54452, 1669, 2088, 2415, 14032, 60, 1235, 341, 197, 19060, 1043, 260, 914, 198, 197, 24952, 1454, 414, 1807, 198, 197, 42400, 39485, 34385, 198, 197, 59403, 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...
2
func TestQueryWithAssociation(t *testing.T) { user := *GetUser("query_with_association", Config{Account: true, Pets: 2, Toys: 1, Company: true, Manager: true, Team: 2, Languages: 1, Friends: 3}) if err := DB.Create(&user).Error; err != nil { t.Fatalf("errors happened when create user: %v", err) } user.CreatedAt = time.Time{} user.UpdatedAt = time.Time{} if err := DB.Where(&user).First(&User{}).Error; err != nil { t.Errorf("search with struct with association should returns no error, but got %v", err) } if err := DB.Where(user).First(&User{}).Error; err != nil { t.Errorf("search with struct with association should returns no error, but got %v", err) } }
explode_data.jsonl/48699
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 230 }
[ 2830, 3393, 2859, 2354, 63461, 1155, 353, 8840, 836, 8, 341, 19060, 1669, 353, 1949, 1474, 445, 1631, 6615, 58665, 367, 497, 5532, 90, 7365, 25, 830, 11, 35886, 25, 220, 17, 11, 48381, 25, 220, 16, 11, 8188, 25, 830, 11, 10567, 25...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestWriteDocumentFrequency(t *testing.T) { dfEmpty := NewDocumentFrequency() dfSmall := NewDocumentFrequency() term := "car" vocab := map[string]int{ term: 1, } dfSmall.AddVocabulary(vocab) type test struct { name string df DocumentFrequency } tests := []test{ { name: "Empty index", df: dfEmpty, }, { name: "Small index", df: dfSmall, }, } for _, tc := range tests { var buf bytes.Buffer tc.df.Write(&buf) _, err := ReadDocumentFrequency(&buf) if err != nil { t.Errorf("%s: unexpected error %v", tc.name, err) } } }
explode_data.jsonl/9833
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 243 }
[ 2830, 3393, 7985, 7524, 38614, 1155, 353, 8840, 836, 8, 341, 85187, 3522, 1669, 1532, 7524, 38614, 741, 85187, 25307, 1669, 1532, 7524, 38614, 741, 197, 4991, 1669, 330, 6918, 698, 5195, 20497, 1669, 2415, 14032, 63025, 515, 197, 197, 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...
3
func Test_Output(t *testing.T) { expected := []byte(foo + newLineStr) actual, err := cmder.New(echo, foo).Output() if err != nil { t.Error(err) } msg := fmt.Sprintf("Expected '%s' Got '%s'", expected, actual) assert.Equal(t, expected, actual, msg) }
explode_data.jsonl/70667
{ "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, 65062, 1155, 353, 8840, 836, 8, 341, 42400, 1669, 3056, 3782, 71880, 488, 501, 2460, 2580, 692, 88814, 11, 1848, 1669, 9961, 1107, 7121, 2026, 958, 11, 15229, 568, 5097, 741, 743, 1848, 961, 2092, 341, 197, 3244, 6141, 396...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestPlayer_Kills(t *testing.T) { pl := playerWithResourceProperty("m_iKills", st.PropertyValue{IntVal: 5}) assert.Equal(t, 5, pl.Kills()) }
explode_data.jsonl/12205
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 57 }
[ 2830, 3393, 4476, 10102, 3305, 1155, 353, 8840, 836, 8, 341, 72213, 1669, 2781, 2354, 4783, 3052, 445, 76, 5318, 42, 3305, 497, 357, 15727, 1130, 90, 1072, 2208, 25, 220, 20, 8824, 6948, 12808, 1155, 11, 220, 20, 11, 625, 11352, 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
func TestAccKeycloakOpenidClientOptionalScopes_updateClientForceNew(t *testing.T) { realm := "terraform-realm-" + acctest.RandString(10) clientOne := "terraform-client-" + acctest.RandString(10) clientTwo := "terraform-client-" + acctest.RandString(10) clientScope := "terraform-client-scope-" + acctest.RandString(10) clientScopes := append(preAssignedOptionalClientScopes, clientScope) resource.Test(t, resource.TestCase{ Providers: testAccProviders, PreCheck: func() { testAccPreCheck(t) }, Steps: []resource.TestStep{ { Config: testKeycloakOpenidClientOptionalScopes_basic(realm, clientOne, clientScope), Check: testAccCheckKeycloakOpenidClientHasOptionalScopes("keycloak_openid_client_optional_scopes.optional_scopes", clientScopes), }, { Config: testKeycloakOpenidClientOptionalScopes_basic(realm, clientTwo, clientScope), Check: testAccCheckKeycloakOpenidClientHasOptionalScopes("keycloak_openid_client_optional_scopes.optional_scopes", clientScopes), }, }, }) }
explode_data.jsonl/31484
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 366 }
[ 2830, 3393, 14603, 1592, 88751, 5002, 307, 2959, 15309, 3326, 18523, 8882, 2959, 18573, 3564, 1155, 353, 8840, 836, 8, 341, 17200, 7673, 1669, 330, 61385, 5504, 7673, 27651, 488, 1613, 67880, 2013, 437, 703, 7, 16, 15, 340, 25291, 3966,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1