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 TestGatherClusterPruner(t *testing.T) { tests := []struct { name string inputObj runtime.Object expectedRecords int evalOutput func(t *testing.T, obj *imageregistryv1.ImagePruner) }{ { name: "not found", inputObj: &imageregistryv1.ImagePruner{ ObjectMeta: metav1.ObjectMeta{ Name: "pruner-i-dont-care-about", }, }, }, { name: "simple image pruner", expectedRecords: 1, inputObj: &imageregistryv1.ImagePruner{ ObjectMeta: metav1.ObjectMeta{ Name: "cluster", }, Spec: imageregistryv1.ImagePrunerSpec{ Schedule: "0 0 * * *", }, }, evalOutput: func(t *testing.T, obj *imageregistryv1.ImagePruner) { if obj.Name != "cluster" { t.Errorf("received wrong prunner: %+v", obj) return } if obj.Spec.Schedule != "0 0 * * *" { t.Errorf("unexpected spec.schedule: %q", obj.Spec.Schedule) } }, }, } for _, test := range tests { t.Run(test.name, func(t *testing.T) { client := imageregistryfake.NewSimpleClientset(test.inputObj) gatherer := &Gatherer{registryClient: client.ImageregistryV1()} records, errs := GatherClusterImagePruner(gatherer)() if len(errs) > 0 { t.Errorf("unexpected errors: %#v", errs) return } if numRecords := len(records); numRecords != test.expectedRecords { t.Errorf("expected one record, got %d", numRecords) return } if test.expectedRecords == 0 { return } if expectedRecordName := "config/imagepruner"; records[0].Name != expectedRecordName { t.Errorf("expected %q record name, got %q", expectedRecordName, records[0].Name) return } item := records[0].Item itemBytes, err := item.Marshal(context.TODO()) if err != nil { t.Fatalf("unable to marshal config: %v", err) } var output imageregistryv1.ImagePruner obj, _, err := registrySerializer.LegacyCodec(imageregistryv1.SchemeGroupVersion).Decode(itemBytes, nil, &output) if err != nil { t.Fatalf("failed to decode object: %v", err) } test.evalOutput(t, obj.(*imageregistryv1.ImagePruner)) }) } }
explode_data.jsonl/32585
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 947 }
[ 2830, 3393, 38, 1856, 28678, 3533, 47037, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 3056, 1235, 341, 197, 11609, 310, 914, 198, 197, 22427, 5261, 286, 15592, 8348, 198, 197, 42400, 25876, 526, 198, 197, 93413, 5097, 414, 2915, 1155, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestFailureFindCommitsRequest(t *testing.T) { server, serverSocketPath := startTestServices(t) defer server.Stop() client, conn := newCommitServiceClient(t, serverSocketPath) defer conn.Close() testRepo, _, cleanupFn := testhelper.NewTestRepo(t) defer cleanupFn() testCases := []struct { desc string request *gitalypb.FindCommitsRequest code codes.Code }{ { desc: "empty path string", request: &gitalypb.FindCommitsRequest{ Repository: testRepo, Paths: [][]byte{[]byte("")}, }, code: codes.InvalidArgument, }, } for _, tc := range testCases { t.Run(tc.desc, func(t *testing.T) { ctx, cancel := testhelper.Context() defer cancel() stream, err := client.FindCommits(ctx, tc.request) require.NoError(t, err) for err == nil { _, err = stream.Recv() } testhelper.RequireGrpcError(t, err, tc.code) }) } }
explode_data.jsonl/26121
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 375 }
[ 2830, 3393, 17507, 9885, 17977, 1199, 1900, 1155, 353, 8840, 836, 8, 341, 41057, 11, 3538, 10286, 1820, 1669, 1191, 2271, 11025, 1155, 340, 16867, 3538, 30213, 2822, 25291, 11, 4534, 1669, 501, 33441, 1860, 2959, 1155, 11, 3538, 10286, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestDotPrefixMatch(t *testing.T) { list := cmdList{} pass := true pass = pass && list.dotPrefixMatch("s.privileged", "security.privileged") pass = pass && list.dotPrefixMatch("u.blah", "user.blah") if !pass { t.Error("failed prefix matching") } }
explode_data.jsonl/79086
{ "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, 34207, 14335, 8331, 1155, 353, 8840, 836, 8, 341, 14440, 1669, 5439, 852, 31483, 41431, 1669, 830, 198, 41431, 284, 1494, 1009, 1140, 22790, 14335, 8331, 445, 82, 82571, 68431, 497, 330, 17039, 82571, 68431, 1138, 41431, 284, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestGetGroups(t *testing.T) { tests := []struct { name string secret *api.Secret expectResult []string expectError bool }{ { name: "not set", secret: &api.Secret{ ObjectMeta: metav1.ObjectMeta{Name: "test"}, Data: map[string][]byte{}, }, expectResult: []string{"system:bootstrappers"}, }, { name: "set to empty value", secret: &api.Secret{ ObjectMeta: metav1.ObjectMeta{Name: "test"}, Data: map[string][]byte{ bootstrapapi.BootstrapTokenExtraGroupsKey: []byte(""), }, }, expectResult: []string{"system:bootstrappers"}, }, { name: "invalid prefix", secret: &api.Secret{ ObjectMeta: metav1.ObjectMeta{Name: "test"}, Data: map[string][]byte{ bootstrapapi.BootstrapTokenExtraGroupsKey: []byte("foo"), }, }, expectError: true, }, { name: "valid", secret: &api.Secret{ ObjectMeta: metav1.ObjectMeta{Name: "test"}, Data: map[string][]byte{ bootstrapapi.BootstrapTokenExtraGroupsKey: []byte("system:bootstrappers:foo,system:bootstrappers:bar,system:bootstrappers:bar"), }, }, // expect the results in deduplicated, sorted order expectResult: []string{ "system:bootstrappers", "system:bootstrappers:bar", "system:bootstrappers:foo", }, }, } for _, test := range tests { result, err := getGroups(test.secret) if test.expectError { if err == nil { t.Errorf("test %q expected an error, but didn't get one (result: %#v)", test.name, result) } continue } if err != nil { t.Errorf("test %q return an unexpected error: %v", test.name, err) continue } if !reflect.DeepEqual(result, test.expectResult) { t.Errorf("test %q expected %#v, got %#v", test.name, test.expectResult, result) } } }
explode_data.jsonl/65925
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 773 }
[ 2830, 3393, 1949, 22173, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 3056, 1235, 341, 197, 11609, 260, 914, 198, 197, 197, 20474, 981, 353, 2068, 74779, 198, 197, 24952, 2077, 3056, 917, 198, 197, 24952, 1454, 220, 1807, 198, 197, 5940...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestRepositoryIncrementalIndex(t *testing.T) { r, cleanup := repository.TestRepository(t) defer cleanup() repo := r.(*repository.Repository) repository.IndexFull = func(*repository.Index) bool { return true } // add 15 packs for j := 0; j < 5; j++ { // add 3 packs, write intermediate index for i := 0; i < 3; i++ { saveRandomDataBlobs(t, repo, 5, 1<<15) rtest.OK(t, repo.FlushPacks(context.Background())) } rtest.OK(t, repo.SaveFullIndex(context.TODO())) } // add another 5 packs for i := 0; i < 5; i++ { saveRandomDataBlobs(t, repo, 5, 1<<15) rtest.OK(t, repo.FlushPacks(context.Background())) } // save final index rtest.OK(t, repo.SaveIndex(context.TODO())) packEntries := make(map[restic.ID]map[restic.ID]struct{}) err := repo.List(context.TODO(), restic.IndexFile, func(id restic.ID, size int64) error { idx, err := repository.LoadIndex(context.TODO(), repo, id) rtest.OK(t, err) for pb := range idx.Each(context.TODO()) { if _, ok := packEntries[pb.PackID]; !ok { packEntries[pb.PackID] = make(map[restic.ID]struct{}) } packEntries[pb.PackID][id] = struct{}{} } return nil }) if err != nil { t.Fatal(err) } for packID, ids := range packEntries { if len(ids) > 1 { t.Errorf("pack %v listed in %d indexes\n", packID, len(ids)) } } }
explode_data.jsonl/71942
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 563 }
[ 2830, 3393, 4624, 38311, 278, 1552, 1155, 353, 8840, 836, 8, 341, 7000, 11, 21290, 1669, 12542, 8787, 4624, 1155, 340, 16867, 21290, 2822, 17200, 5368, 1669, 435, 41399, 23319, 25170, 692, 17200, 3099, 18338, 9432, 284, 2915, 4071, 23319,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestGenerateAccessToken(t *testing.T) { fakeToken := `{"access_token": "ya29.new", "expires_in":3599, "token_type":"Bearer"}` mockTokenServer := InitMockServer(fakeToken) defer mockTokenServer.Close() fakeKey := strings.Replace(testdata.FakeServiceAccountKeyData, "FAKE-TOKEN-URI", mockTokenServer.GetURL(), 1) fakeKeyData := []byte(fakeKey) token, duration, err := generateAccessToken(fakeKeyData) if token != "ya29.new" || duration.Seconds() < 3598 || err != nil { t.Errorf("Test : Fail to make access token, got token: %s, duration: %v, err: %v", token, duration, err) } latestFakeToken := `{"access_token": "ya29.latest", "expires_in":3599, "token_type":"Bearer"}` mockTokenServer.SetResp(latestFakeToken) // The token is cached so the old token gets returned. token, duration, err = generateAccessToken(fakeKeyData) if token != "ya29.new" || err != nil { t.Errorf("Test : Fail to make access token, got token: %s, duration: %v, err: %v", token, duration, err) } }
explode_data.jsonl/72351
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 344 }
[ 2830, 3393, 31115, 37649, 1155, 353, 8840, 836, 8, 341, 1166, 726, 3323, 1669, 1565, 4913, 5211, 6458, 788, 330, 7755, 17, 24, 4618, 497, 330, 48203, 1243, 788, 18, 20, 24, 24, 11, 330, 5839, 1819, 3252, 26399, 9207, 3989, 77333, 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...
6
func TestWriteBackupList_EmptyColumnsValues(t *testing.T) { expectedRes := "name modified wal_segment_backup_start start_time finish_time hostname data_dir pg_version start_lsn finish_lsn is_permanent\n" + " - shortWallName0 - - 0 0 0 false\n" + "b1 - - - 0 0 0 false\n" + " - - - 0 0 0 false\n" b := bytes.Buffer{} postgres.WriteBackupListDetails(emptyColonsBackups, &b) assert.Equal(t, expectedRes, b.String()) }
explode_data.jsonl/23914
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 443 }
[ 2830, 3393, 7985, 56245, 852, 76060, 1595, 13965, 6227, 1155, 353, 8840, 836, 8, 341, 42400, 1061, 1669, 330, 606, 10807, 40826, 28061, 44710, 4906, 1191, 3009, 6248, 3009, 28115, 821, 4334, 17495, 9438, 1191, 907, 9613, 6248, 907, 9613, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestHiddenCommandExecutes(t *testing.T) { // ensure that outs does not already equal what the command will be setting it // to, if it did this test would not actually be testing anything... if outs == "hidden" { t.Errorf("outs should NOT EQUAL hidden") } cmdHidden.Execute() // upon running the command, the value of outs should now be 'hidden' if outs != "hidden" { t.Errorf("Hidden command failed to run!") } }
explode_data.jsonl/47426
{ "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, 17506, 4062, 10216, 2095, 1155, 353, 8840, 836, 8, 1476, 197, 322, 5978, 429, 22806, 1558, 537, 2669, 6144, 1128, 279, 3210, 686, 387, 6243, 432, 198, 197, 322, 311, 11, 421, 432, 1521, 419, 1273, 1035, 537, 3520, 387, 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...
3
func TestStatesSpec(t *testing.T) { ts := serveHTTP(t) defer ts.Close() client := NewTestClient(ts) vehicles, err := client.Vehicles() if err != nil { t.Fatal(err) } vehicle := vehicles[0] Convey("Should get mobile enabled status", t, func() { status, err := vehicle.MobileEnabled() So(err, ShouldBeNil) So(status, ShouldBeTrue) }) Convey("Should get charge state", t, func() { status, err := vehicle.ChargeState() So(err, ShouldBeNil) So(status.BatteryLevel, ShouldEqual, 90) So(status.ChargeRate, ShouldEqual, 0) So(status.ChargingState, ShouldEqual, "Complete") }) Convey("Should get climate state", t, func() { status, err := vehicle.ClimateState() So(err, ShouldBeNil) So(status.DriverTempSetting, ShouldEqual, 22.0) So(status.PassengerTempSetting, ShouldEqual, 22.0) So(status.IsRearDefrosterOn, ShouldBeFalse) }) Convey("Should get drive state", t, func() { status, err := vehicle.DriveState() So(err, ShouldBeNil) So(status.Latitude, ShouldEqual, 35.1) So(status.Longitude, ShouldEqual, 20.2) }) Convey("Should get GUI settings", t, func() { status, err := vehicle.GuiSettings() So(err, ShouldBeNil) So(status.GuiDistanceUnits, ShouldEqual, "mi/hr") So(status.GuiTemperatureUnits, ShouldEqual, "F") }) Convey("Should get Vehicle state", t, func() { status, err := vehicle.VehicleState() So(err, ShouldBeNil) So(status.APIVersion, ShouldEqual, 3) So(status.CalendarSupported, ShouldBeTrue) So(status.RearTrunk, ShouldEqual, 0) }) Convey("Should get service data", t, func() { status, err := vehicle.ServiceData() So(err, ShouldBeNil) So(status.ServiceStatus, ShouldEqual, "in_service") wantTime, err := time.Parse(time.RFC3339, "2019-08-15T14:15:00+02:00") if err != nil { t.Fatal(err) } So(status.ServiceETC, ShouldEqual, wantTime) }) }
explode_data.jsonl/18854
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 722 }
[ 2830, 3393, 23256, 8327, 1155, 353, 8840, 836, 8, 341, 57441, 1669, 8683, 9230, 1155, 340, 16867, 10591, 10421, 2822, 25291, 1669, 1532, 2271, 2959, 35864, 340, 197, 57115, 11, 1848, 1669, 2943, 5058, 41865, 741, 743, 1848, 961, 2092, 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 TestDeposit(t *testing.T) { kb, err := keys.NewKeyBaseFromDir(InitClientHome(t, "")) require.NoError(t, err) addr, seed := CreateAddr(t, name1, pw, kb) cleanup, _, _, port := InitializeTestLCD(t, 1, []sdk.AccAddress{addr}, true) defer cleanup() acc := getAccount(t, port, addr) initialBalance := acc.GetCoins() // create SubmitProposal TX proposalTokens := sdk.TokensFromTendermintPower(5) resultTx := doSubmitProposal(t, port, seed, name1, pw, addr, proposalTokens, fees) tests.WaitForHeight(resultTx.Height+1, port) // check if tx was committed require.Equal(t, uint32(0), resultTx.Code) var proposalID uint64 cdc.MustUnmarshalBinaryLengthPrefixed(resultTx.Data, &proposalID) // verify balance acc = getAccount(t, port, addr) coins := acc.GetCoins() expectedBalance := initialBalance[0].Sub(fees[0]) require.Equal(t, expectedBalance.Amount.Sub(proposalTokens), coins.AmountOf(sdk.DefaultBondDenom)) expectedBalance = coins[0] // query proposal proposal := getProposal(t, port, proposalID) require.Equal(t, "Test", proposal.GetTitle()) // create SubmitProposal TX depositTokens := sdk.TokensFromTendermintPower(5) resultTx = doDeposit(t, port, seed, name1, pw, addr, proposalID, depositTokens, fees) tests.WaitForHeight(resultTx.Height+1, port) // verify balance after deposit and fee acc = getAccount(t, port, addr) expectedBalance = expectedBalance.Sub(fees[0]) require.Equal(t, expectedBalance.Amount.Sub(depositTokens), acc.GetCoins().AmountOf(sdk.DefaultBondDenom)) // query tx txs := getTransactions(t, port, fmt.Sprintf("action=deposit&depositor=%s", addr)) require.Len(t, txs, 1) require.Equal(t, resultTx.Height, txs[0].Height) // query proposal totalCoins := sdk.Coins{sdk.NewCoin(sdk.DefaultBondDenom, sdk.TokensFromTendermintPower(10))} proposal = getProposal(t, port, proposalID) require.True(t, proposal.TotalDeposit.IsEqual(totalCoins)) // query deposit deposit := getDeposit(t, port, proposalID, addr) require.True(t, deposit.Amount.IsEqual(totalCoins)) }
explode_data.jsonl/25412
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 733 }
[ 2830, 3393, 78982, 1155, 353, 8840, 836, 8, 341, 16463, 65, 11, 1848, 1669, 6894, 7121, 1592, 3978, 3830, 6184, 7, 3803, 2959, 7623, 1155, 11, 77561, 17957, 35699, 1155, 11, 1848, 340, 53183, 11, 10320, 1669, 4230, 13986, 1155, 11, 82...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestNewApplicationStatusChangeEvent(t *testing.T) { tests := []struct { name string appID string event events.ApplicationEventType state string wantID string wantEvent events.ApplicationEventType wantState string }{ {TestCreateName, "testAppId001", events.SubmitApplication, "SubmitApplication", "testAppId001", events.SubmitApplication, "SubmitApplication"}, } for _, tt := range tests { instance := NewApplicationStatusChangeEvent(tt.appID, tt.event, tt.state) event := instance.GetEvent() t.Run(tt.name, func(t *testing.T) { if event != tt.wantEvent { t.Errorf("want %s %s %s, got %s %s %s", tt.wantID, tt.wantEvent, tt.wantState, instance.applicationID, instance.event, instance.state) } }) } }
explode_data.jsonl/9777
{ "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, 3564, 4988, 2522, 76498, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 3056, 1235, 341, 197, 11609, 414, 914, 198, 197, 28236, 915, 257, 914, 198, 197, 28302, 257, 4357, 17521, 47906, 198, 197, 24291, 257, 914, 198, 197, 5078...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestTruncateLargeLogEvent(t *testing.T) { records := make([]*kinesis.PutRecordsRequestEntry, 0, 500) record := map[interface{}]interface{}{ "somekey": make([]byte, 1024*1024), } outputPlugin, _ := newMockOutputPlugin(nil, false) timeStamp := time.Now() retCode := outputPlugin.AddRecord(&records, record, &timeStamp) actualData, err := outputPlugin.processRecord(record, len("testKey")) if err != nil { logrus.Errorf("[kinesis %d] %v\n", outputPlugin.PluginID, err) } assert.Equal(t, retCode, fluentbit.FLB_OK, "Expected return code to be FLB_OK") assert.Len(t, records, 1, "Expected output to contain 1 record") assert.Len(t, actualData, 1024*1024-len("testKey"), "Expected length is less than 1MB") }
explode_data.jsonl/74099
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 263 }
[ 2830, 3393, 1282, 26900, 34253, 2201, 1556, 1155, 353, 8840, 836, 8, 341, 197, 26203, 1669, 1281, 85288, 74, 82789, 39825, 25876, 1900, 5874, 11, 220, 15, 11, 220, 20, 15, 15, 692, 71952, 1669, 2415, 58, 4970, 78134, 4970, 67066, 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 TestAddQuota(t *testing.T) { kubeClient := fake.NewSimpleClientset() gvr := v1.SchemeGroupVersion.WithResource("pods") listersForResourceConfig := map[schema.GroupVersionResource]cache.GenericLister{ gvr: newGenericLister(gvr.GroupResource(), newTestPods()), } qc := setupQuotaController(t, kubeClient, mockListerForResourceFunc(listersForResourceConfig), mockDiscoveryFunc) defer close(qc.stop) testCases := []struct { name string quota *v1.ResourceQuota expectedPriority bool }{ { name: "no status", expectedPriority: true, quota: &v1.ResourceQuota{ ObjectMeta: metav1.ObjectMeta{ Namespace: "default", Name: "rq", }, Spec: v1.ResourceQuotaSpec{ Hard: v1.ResourceList{ v1.ResourceCPU: resource.MustParse("4"), }, }, }, }, { name: "status, no usage", expectedPriority: true, quota: &v1.ResourceQuota{ ObjectMeta: metav1.ObjectMeta{ Namespace: "default", Name: "rq", }, Spec: v1.ResourceQuotaSpec{ Hard: v1.ResourceList{ v1.ResourceCPU: resource.MustParse("4"), }, }, Status: v1.ResourceQuotaStatus{ Hard: v1.ResourceList{ v1.ResourceCPU: resource.MustParse("4"), }, }, }, }, { name: "status, no usage(to validate it works for extended resources)", expectedPriority: true, quota: &v1.ResourceQuota{ ObjectMeta: metav1.ObjectMeta{ Namespace: "default", Name: "rq", }, Spec: v1.ResourceQuotaSpec{ Hard: v1.ResourceList{ "requests.example/foobars.example.com": resource.MustParse("4"), }, }, Status: v1.ResourceQuotaStatus{ Hard: v1.ResourceList{ "requests.example/foobars.example.com": resource.MustParse("4"), }, }, }, }, { name: "status, mismatch", expectedPriority: true, quota: &v1.ResourceQuota{ ObjectMeta: metav1.ObjectMeta{ Namespace: "default", Name: "rq", }, Spec: v1.ResourceQuotaSpec{ Hard: v1.ResourceList{ v1.ResourceCPU: resource.MustParse("4"), }, }, Status: v1.ResourceQuotaStatus{ Hard: v1.ResourceList{ v1.ResourceCPU: resource.MustParse("6"), }, Used: v1.ResourceList{ v1.ResourceCPU: resource.MustParse("0"), }, }, }, }, { name: "status, missing usage, but don't care (no informer)", expectedPriority: false, quota: &v1.ResourceQuota{ ObjectMeta: metav1.ObjectMeta{ Namespace: "default", Name: "rq", }, Spec: v1.ResourceQuotaSpec{ Hard: v1.ResourceList{ "foobars.example.com": resource.MustParse("4"), }, }, Status: v1.ResourceQuotaStatus{ Hard: v1.ResourceList{ "foobars.example.com": resource.MustParse("4"), }, }, }, }, { name: "ready", expectedPriority: false, quota: &v1.ResourceQuota{ ObjectMeta: metav1.ObjectMeta{ Namespace: "default", Name: "rq", }, Spec: v1.ResourceQuotaSpec{ Hard: v1.ResourceList{ v1.ResourceCPU: resource.MustParse("4"), }, }, Status: v1.ResourceQuotaStatus{ Hard: v1.ResourceList{ v1.ResourceCPU: resource.MustParse("4"), }, Used: v1.ResourceList{ v1.ResourceCPU: resource.MustParse("0"), }, }, }, }, } for _, tc := range testCases { qc.addQuota(tc.quota) if tc.expectedPriority { if e, a := 1, qc.missingUsageQueue.Len(); e != a { t.Errorf("%s: expected %v, got %v", tc.name, e, a) } if e, a := 0, qc.queue.Len(); e != a { t.Errorf("%s: expected %v, got %v", tc.name, e, a) } } else { if e, a := 0, qc.missingUsageQueue.Len(); e != a { t.Errorf("%s: expected %v, got %v", tc.name, e, a) } if e, a := 1, qc.queue.Len(); e != a { t.Errorf("%s: expected %v, got %v", tc.name, e, a) } } for qc.missingUsageQueue.Len() > 0 { key, _ := qc.missingUsageQueue.Get() qc.missingUsageQueue.Done(key) } for qc.queue.Len() > 0 { key, _ := qc.queue.Get() qc.queue.Done(key) } } }
explode_data.jsonl/76143
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 2064 }
[ 2830, 3393, 2212, 2183, 6089, 1155, 353, 8840, 836, 8, 341, 16463, 3760, 2959, 1669, 12418, 7121, 16374, 2959, 746, 741, 3174, 18920, 1669, 348, 16, 92719, 2808, 5637, 26124, 4783, 445, 79, 29697, 1138, 14440, 388, 90100, 2648, 1669, 24...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
9
func TestSpanModifyWhileFlushing(t *testing.T) { tracer, _, _, stop := startTestTracer(t) defer stop() done := make(chan struct{}) go func() { span := tracer.newRootSpan("pylons.request", "pylons", "/") span.Finish() // It doesn't make much sense to update the span after it's been finished, // but an error in a user's code could lead to this. span.SetTag("race_test", "true") span.SetTag("race_test2", 133.7) span.SetTag("race_test3", 133.7) span.SetTag(ext.Error, errors.New("t")) done <- struct{}{} }() for { select { case <-done: return default: tracer.flush() time.Sleep(10 * time.Millisecond) } } }
explode_data.jsonl/42851
{ "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, 12485, 44427, 7983, 3882, 40813, 1155, 353, 8840, 836, 8, 341, 25583, 9584, 11, 8358, 8358, 2936, 1669, 1191, 2271, 1282, 9584, 1155, 340, 16867, 2936, 2822, 40495, 1669, 1281, 35190, 2036, 37790, 30680, 2915, 368, 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 TestBoundsList(t *testing.T) { type Entity struct { Attribute primitives.BoundsList `xml:"attribute,attr"` } //empty entity := Entity{Attribute: primitives.BoundsList{}} encoded, err := xml.Marshal(&entity) require.Empty(t, err) require.Equal(t, `<Entity></Entity>`, string(encoded)) //encode b := primitives.BoundsListFromRefs("A1:B2", "C3:F10", "Z1") require.Equal(t, primitives.RefList("A1:B2 C3:F10 Z1"), b.ToRefList()) entity = Entity{Attribute: b} encoded, err = xml.Marshal(&entity) require.Empty(t, err) require.Equal(t, `<Entity attribute="A1:B2 C3:F10 Z1"></Entity>`, string(encoded)) //decode var decoded Entity err = xml.Unmarshal(encoded, &decoded) require.Empty(t, err) require.Equal(t, entity, decoded) //methods require.Equal(t, true, primitives.BoundsList{}.IsEmpty()) require.Equal(t, primitives.RefList("A1:B2 C3:F10 Z1"), decoded.Attribute.ToRefList()) require.Equal(t, false, decoded.Attribute.IsEmpty()) decoded.Attribute.Add("X11") require.Equal(t, primitives.RefList("A1:B2 C3:F10 Z1 X11"), decoded.Attribute.ToRefList()) require.Equal(t, "A1:B2 C3:F10 Z1 X11", decoded.Attribute.String()) }
explode_data.jsonl/15559
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 465 }
[ 2830, 3393, 11394, 852, 1155, 353, 8840, 836, 8, 341, 13158, 10390, 2036, 341, 197, 197, 3907, 71194, 72133, 852, 1565, 6455, 2974, 9116, 11, 2991, 8805, 197, 630, 197, 322, 3194, 198, 52987, 1669, 10390, 90, 3907, 25, 71194, 72133, 8...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestUpdateIssueValueLabelErrs(t *testing.T) { cucm, iucm, lucm, pucm, m := prepareMocksAndRUC() tests := []struct { body *strings.Reader err error mockOn bool }{ { strings.NewReader("title=test-title&description=test-description&status=1&labels="), errors.New("no labels assigned"), false, }, { strings.NewReader("title=test-title&description=test-description&status=1&labels=test1,test2,test3"), errors.New("label test1 is not valid"), true, }, } for _, ts := range tests { if ts.mockOn { lucm.On("FindByName", mock.AnythingOfType("string")).Return(domain.Label{}, ts.err) } c, _ := prepareHTTP(echo.POST, "/api/issues/:id", ts.body) c.SetParamNames("id") c.SetParamValues("1") err := m.UpdateIssue(c) assert.NotNil(t, err) assert.Equal(t, ts.err.Error(), err.Error()) checkAssertions(t, cucm, iucm, lucm, pucm) } }
explode_data.jsonl/60164
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 381 }
[ 2830, 3393, 4289, 42006, 1130, 2476, 7747, 82, 1155, 353, 8840, 836, 8, 341, 1444, 1754, 76, 11, 600, 1754, 76, 11, 25927, 76, 11, 281, 1754, 76, 11, 296, 1669, 10549, 72577, 3036, 49, 5459, 2822, 78216, 1669, 3056, 1235, 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...
3
func TestGroupVersion(t *testing.T) { rootTestFunc := func(sType server.StorageType) func(t *testing.T) { return func(t *testing.T) { client, _, shutdownServer := getFreshApiserverAndClient(t, sType.String(), func() runtime.Object { return &servicecatalog.ClusterServiceBroker{} }) defer shutdownServer() if err := testGroupVersion(client); 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/7395
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 216 }
[ 2830, 3393, 2808, 5637, 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, 25291, 11, 8358, 23766, 5475...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestModifyGcloudCommand(t *testing.T) { type TestCase struct { Input clientcmdapi.Config Expected clientcmdapi.Config } cases := []TestCase{ { Input: clientcmdapi.Config{ AuthInfos: map[string]*clientcmdapi.AuthInfo{ "some-user": { AuthProvider: &clientcmdapi.AuthProviderConfig{ Name: "gcp", Config: map[string]string{ "cmd-path": "/usr/local/bin/gcloud", }, }, }, }, }, Expected: clientcmdapi.Config{ AuthInfos: map[string]*clientcmdapi.AuthInfo{ "some-user": { AuthProvider: &clientcmdapi.AuthProviderConfig{ Name: "gcp", Config: map[string]string{ "cmd-path": "gcloud", }, }, }, }, }, }, } for _, c := range cases { if err := modifyGcloudCommand(&c.Input); err != nil { t.Errorf("ModifyGcloudCommand returned error; %v", err) } if !reflect.DeepEqual(c.Expected, c.Input) { t.Errorf("ModifyGcloudCommand not correct; got %v; want %v", c.Input, c.Expected) } } }
explode_data.jsonl/25459
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 486 }
[ 2830, 3393, 44427, 38, 12361, 4062, 1155, 353, 8840, 836, 8, 341, 13158, 30573, 2036, 341, 197, 66588, 262, 2943, 8710, 2068, 10753, 198, 197, 197, 18896, 2943, 8710, 2068, 10753, 198, 197, 630, 1444, 2264, 1669, 3056, 16458, 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...
4
func TestConnectIncrementActiveConnection(t *testing.T) { c := context.New(t, defaultMTU) defer c.Cleanup() stats := c.Stack().Stats() want := stats.TCP.ActiveConnectionOpenings.Value() + 1 c.CreateConnected(context.TestInitialSequenceNumber, 30000, -1 /* epRcvBuf */) if got := stats.TCP.ActiveConnectionOpenings.Value(); got != want { t.Errorf("got stats.TCP.ActtiveConnectionOpenings.Value() = %d, want = %d", got, want) } }
explode_data.jsonl/75917
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 157 }
[ 2830, 3393, 14611, 38311, 5728, 4526, 1155, 353, 8840, 836, 8, 341, 1444, 1669, 2266, 7121, 1155, 11, 1638, 8505, 52, 340, 16867, 272, 727, 60639, 2822, 79659, 1669, 272, 58646, 1005, 16635, 741, 50780, 1669, 10472, 836, 7123, 28755, 45...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestFileUploaded_GetURL(t *testing.T) { s3URL, _ := url.Parse("s3://" + bucketName + filePath) Convey("Given a valid FileUploaded", t, func() { input := &FileUploaded{ S3URL: NewS3URL(s3URL), Time: time.Now().UTC().Unix(), } Convey("When get is called", func() { result := input.GetURL() Convey("Then the correct value is returned.", func() { So(result, ShouldEqual, "s3://"+bucketName+filePath) }) }) }) }
explode_data.jsonl/23626
{ "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, 1703, 62061, 13614, 3144, 1155, 353, 8840, 836, 8, 341, 1903, 18, 3144, 11, 716, 1669, 2515, 8937, 445, 82, 18, 52136, 488, 15621, 675, 488, 22598, 692, 93070, 5617, 445, 22043, 264, 2697, 2887, 62061, 497, 259, 11, 2915, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestParallelReady(t *testing.T) { tests := []struct { name string fsubs []*Subscription subs []*Subscription ichannel *duckv1alpha1.Channelable channels []*duckv1alpha1.Channelable want bool }{{ name: "ingress false, empty", fsubs: []*Subscription{}, subs: []*Subscription{}, ichannel: getChannelable(false), channels: []*duckv1alpha1.Channelable{}, want: false, }, { name: "ingress true, empty", fsubs: []*Subscription{}, subs: []*Subscription{}, ichannel: getChannelable(true), channels: []*duckv1alpha1.Channelable{}, want: false, }, { name: "ingress true, one channelable not ready, one subscription ready", ichannel: getChannelable(true), channels: []*duckv1alpha1.Channelable{getChannelable(false)}, fsubs: []*Subscription{getSubscription("fsub0", true)}, subs: []*Subscription{getSubscription("sub0", true)}, want: false, }, { name: "ingress true, one channelable ready, one subscription not ready", ichannel: getChannelable(true), channels: []*duckv1alpha1.Channelable{getChannelable(true)}, fsubs: []*Subscription{getSubscription("fsub0", false)}, subs: []*Subscription{getSubscription("sub0", false)}, want: false, }, { name: "ingress false, one channelable ready, one subscription ready", ichannel: getChannelable(false), channels: []*duckv1alpha1.Channelable{getChannelable(true)}, fsubs: []*Subscription{getSubscription("fsub0", true)}, subs: []*Subscription{getSubscription("sub0", true)}, want: false, }, { name: "ingress true, one channelable ready, one subscription ready", ichannel: getChannelable(true), channels: []*duckv1alpha1.Channelable{getChannelable(true)}, fsubs: []*Subscription{getSubscription("fsub0", true)}, subs: []*Subscription{getSubscription("sub0", true)}, want: true, }, { name: "ingress true, one channelable ready, one not, two subsriptions ready", ichannel: getChannelable(true), channels: []*duckv1alpha1.Channelable{getChannelable(true), getChannelable(false)}, fsubs: []*Subscription{getSubscription("fsub0", true), getSubscription("fsub1", true)}, subs: []*Subscription{getSubscription("sub0", true), getSubscription("sub1", true)}, want: false, }, { name: "ingress true, two channelables ready, one subscription ready, one not", ichannel: getChannelable(true), channels: []*duckv1alpha1.Channelable{getChannelable(true), getChannelable(true)}, fsubs: []*Subscription{getSubscription("fsub0", true), getSubscription("fsub1", false)}, subs: []*Subscription{getSubscription("sub0", true), getSubscription("sub1", false)}, want: false, }, { name: "ingress false, two channelables ready, two subscriptions ready", ichannel: getChannelable(false), channels: []*duckv1alpha1.Channelable{getChannelable(true), getChannelable(true)}, fsubs: []*Subscription{getSubscription("fsub0", true), getSubscription("fsub1", true)}, subs: []*Subscription{getSubscription("sub0", true), getSubscription("sub1", true)}, want: false, }, { name: "ingress true, two channelables ready, two subscriptions ready", ichannel: getChannelable(true), channels: []*duckv1alpha1.Channelable{getChannelable(true), getChannelable(true)}, fsubs: []*Subscription{getSubscription("fsub0", true), getSubscription("fsub1", true)}, subs: []*Subscription{getSubscription("sub0", true), getSubscription("sub1", true)}, want: true, }} for _, test := range tests { t.Run(test.name, func(t *testing.T) { ps := ParallelStatus{} ps.PropagateChannelStatuses(test.ichannel, test.channels) ps.PropagateSubscriptionStatuses(test.fsubs, test.subs) got := ps.IsReady() want := test.want if want != got { t.Errorf("unexpected conditions (-want, +got) = %v %v", want, got) } }) } }
explode_data.jsonl/29239
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1562 }
[ 2830, 3393, 16547, 19202, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 3056, 1235, 341, 197, 11609, 257, 914, 198, 197, 1166, 64798, 262, 29838, 33402, 198, 197, 1903, 15738, 257, 29838, 33402, 198, 197, 197, 713, 2594, 353, 72970, 85, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_duplicateFunctionName(t *testing.T) { resetForTest() const functionName = "samplefunc" const functionLang = "ruby" templatePullLocalTemplateRepo(t) defer tearDownFetchTemplates(t) defer tearDownNewFunction(t, functionName) // Create function parameters := []string{ "new", functionName, "--lang=" + functionLang, } faasCmd.SetArgs(parameters) faasCmd.Execute() // Attempt to create duplicate function parameters = append(parameters, "--append="+functionName+".yml") faasCmd.SetArgs(parameters) stdOut := faasCmd.Execute().Error() if found, err := regexp.MatchString(FunctionExistsOutput, stdOut); err != nil || !found { t.Fatalf("Output is not as expected: %s\n", stdOut) } }
explode_data.jsonl/47233
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 252 }
[ 2830, 3393, 70434, 5152, 675, 1155, 353, 8840, 836, 8, 341, 70343, 2461, 2271, 2822, 4777, 90519, 284, 330, 13611, 2830, 698, 4777, 729, 26223, 284, 330, 46275, 1837, 22832, 36068, 7319, 7275, 25243, 1155, 340, 16867, 32825, 20714, 51195,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestBool(t *testing.T) { val := bool(true) m := map[string]interface{}{"value": val, "nothing": nil} assert.Equal(t, val, New(m).Get("value").Bool()) assert.Equal(t, val, New(m).Get("value").MustBool()) assert.Equal(t, bool(false), New(m).Get("nothing").Bool()) assert.Equal(t, val, New(m).Get("nothing").Bool(true)) assert.Panics(t, func() { New(m).Get("age").MustBool() }) }
explode_data.jsonl/23400
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 167 }
[ 2830, 3393, 11233, 1155, 353, 8840, 836, 8, 1476, 19302, 1669, 1807, 3715, 340, 2109, 1669, 2415, 14032, 31344, 6257, 4913, 957, 788, 1044, 11, 330, 41212, 788, 2092, 532, 6948, 12808, 1155, 11, 1044, 11, 1532, 1255, 568, 1949, 445, 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...
1
func TestKVGetErrConnClosed(t *testing.T) { defer testutil.AfterTest(t) clus := integration.NewClusterV3(t, &integration.ClusterConfig{Size: 1}) defer clus.Terminate(t) cli := clus.Client(0) donec := make(chan struct{}) if err := cli.Close(); err != nil { t.Fatal(err) } clus.TakeClient(0) go func() { defer close(donec) _, err := cli.Get(context.TODO(), "foo") if !clientv3.IsConnCanceled(err) { t.Errorf("expected %v, got %v", context.Canceled, err) } }() select { case <-time.After(integration.RequestWaitTimeout): t.Fatal("kv.Get took too long") case <-donec: } }
explode_data.jsonl/16403
{ "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, 82707, 1949, 7747, 9701, 26884, 1155, 353, 8840, 836, 8, 341, 16867, 1273, 1314, 36892, 2271, 1155, 692, 197, 4163, 1669, 17590, 7121, 28678, 53, 18, 1155, 11, 609, 60168, 72883, 2648, 90, 1695, 25, 220, 16, 3518, 16867, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestAccKibanaLogstashPipeline(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, CheckDestroy: testCheckKibanaLogstashPipelineDestroy, Steps: []resource.TestStep{ { Config: testKibanaLogstashPipeline, Check: resource.ComposeTestCheckFunc( testCheckKibanaLogstashPipelineExists("kibana_logstash_pipeline.test"), ), }, { ResourceName: "kibana_logstash_pipeline.test", ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{}, }, }, }) }
explode_data.jsonl/52166
{ "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, 14603, 42, 579, 3362, 2201, 49771, 34656, 1155, 353, 8840, 836, 8, 1476, 50346, 8787, 1155, 11, 5101, 31363, 515, 197, 197, 4703, 3973, 25, 2915, 368, 341, 298, 18185, 14603, 4703, 3973, 1155, 340, 197, 197, 1583, 197, 197...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestKvListFormat(t *testing.T) { var emptyPoint *point var testKVList = []struct { keysValues []interface{} want string }{ { keysValues: []interface{}{"pod", "kubedns"}, want: " pod=\"kubedns\"", }, { keysValues: []interface{}{"pod", "kubedns", "update", true}, want: " pod=\"kubedns\" update=true", }, { keysValues: []interface{}{"pod", "kubedns", "spec", struct { X int Y string N time.Time }{X: 76, Y: "strval", N: time.Date(2006, 1, 2, 15, 4, 5, .067890e9, time.UTC)}}, want: " pod=\"kubedns\" spec={X:76 Y:strval N:2006-01-02 15:04:05.06789 +0000 UTC}", }, { keysValues: []interface{}{"pod", "kubedns", "values", []int{8, 6, 7, 5, 3, 0, 9}}, want: " pod=\"kubedns\" values=[8 6 7 5 3 0 9]", }, { keysValues: []interface{}{"pod", "kubedns", "values", []string{"deployment", "svc", "configmap"}}, want: " pod=\"kubedns\" values=[deployment svc configmap]", }, { keysValues: []interface{}{"pod", "kubedns", "bytes", []byte("test case for byte array")}, want: " pod=\"kubedns\" bytes=\"test case for byte array\"", }, { keysValues: []interface{}{"pod", "kubedns", "bytes", []byte("��=� ⌘")}, want: " pod=\"kubedns\" bytes=\"\\ufffd\\ufffd=\\ufffd \\u2318\"", }, { keysValues: []interface{}{"multiLineString", `Hello world! Starts with tab. Starts with spaces. No whitespace.`, "pod", "kubedns", }, want: ` multiLineString=< Hello world! Starts with tab. Starts with spaces. No whitespace. > pod="kubedns"`, }, { keysValues: []interface{}{"pod", "kubedns", "maps", map[string]int{"three": 4}}, want: " pod=\"kubedns\" maps=map[three:4]", }, { keysValues: []interface{}{"pod", klog.KRef("kube-system", "kubedns"), "status", "ready"}, want: " pod=\"kube-system/kubedns\" status=\"ready\"", }, { keysValues: []interface{}{"pod", klog.KRef("", "kubedns"), "status", "ready"}, want: " pod=\"kubedns\" status=\"ready\"", }, { keysValues: []interface{}{"pod", klog.KObj(test.KMetadataMock{Name: "test-name", NS: "test-ns"}), "status", "ready"}, want: " pod=\"test-ns/test-name\" status=\"ready\"", }, { keysValues: []interface{}{"pod", klog.KObj(test.KMetadataMock{Name: "test-name", NS: ""}), "status", "ready"}, want: " pod=\"test-name\" status=\"ready\"", }, { keysValues: []interface{}{"pod", klog.KObj(nil), "status", "ready"}, want: " pod=\"\" status=\"ready\"", }, { keysValues: []interface{}{"pod", klog.KObj((*test.PtrKMetadataMock)(nil)), "status", "ready"}, want: " pod=\"\" status=\"ready\"", }, { keysValues: []interface{}{"pod", klog.KObj((*test.KMetadataMock)(nil)), "status", "ready"}, want: " pod=\"\" status=\"ready\"", }, { keysValues: []interface{}{"pods", klog.KObjs([]test.KMetadataMock{ { Name: "kube-dns", NS: "kube-system", }, { Name: "mi-conf", }, })}, want: " pods=[kube-system/kube-dns mi-conf]", }, { keysValues: []interface{}{"point-1", point{100, 200}, "point-2", emptyPoint}, want: " point-1=\"x=100, y=200\" point-2=\"nil\"", }, } for _, d := range testKVList { b := &bytes.Buffer{} serialize.KVListFormat(b, d.keysValues...) if b.String() != d.want { t.Errorf("KVListFormat error:\n got:\n\t%s\nwant:\t%s", b.String(), d.want) } } }
explode_data.jsonl/36534
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1606 }
[ 2830, 3393, 42, 85, 852, 4061, 1155, 353, 8840, 836, 8, 341, 2405, 4287, 2609, 353, 2768, 198, 2405, 1273, 82707, 852, 284, 3056, 1235, 341, 197, 80112, 6227, 3056, 4970, 16094, 197, 50780, 981, 914, 198, 197, 59403, 197, 197, 515, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestCacheBuildRemote(t *testing.T) { testutil.Run(t, "", func(t *testutil.T) { tmpDir := t.NewTempDir(). Write("dep1", "content1"). Write("dep2", "content2"). Write("dep3", "content3"). Chdir() tags := map[string]string{ "artifact1": "artifact1:tag1", "artifact2": "artifact2:tag2", } artifacts := []*latest.Artifact{ {ImageName: "artifact1", ArtifactType: latest.ArtifactType{DockerArtifact: &latest.DockerArtifact{}}}, {ImageName: "artifact2", ArtifactType: latest.ArtifactType{DockerArtifact: &latest.DockerArtifact{}}}, } deps := depLister(map[string][]string{ "artifact1": {"dep1", "dep2"}, "artifact2": {"dep3"}, }) // Mock Docker dockerDaemon := fakeLocalDaemon(&testutil.FakeAPIClient{}) t.Override(&docker.NewAPIClient, func(docker.Config) (docker.LocalDaemon, error) { return dockerDaemon, nil }) t.Override(&docker.DefaultAuthHelper, stubAuth{}) t.Override(&docker.RemoteDigest, func(ref string, _ docker.Config) (string, error) { switch ref { case "artifact1:tag1": return "sha256:51ae7fa00c92525c319404a3a6d400e52ff9372c5a39cb415e0486fe425f3165", nil case "artifact2:tag2": return "sha256:35bdf2619f59e6f2372a92cb5486f4a0bf9b86e0e89ee0672864db6ed9c51539", nil default: return "", errors.New("unknown remote tag") } }) // Mock args builder t.Override(&docker.EvalBuildArgs, func(_ config.RunMode, _ string, _ string, args map[string]*string, _ map[string]*string) (map[string]*string, error) { return args, nil }) // Create cache cfg := &mockConfig{ cacheFile: tmpDir.Path("cache"), } artifactCache, err := NewCache(cfg, false, false, deps, build.ToArtifactGraph(artifacts), make(mockArtifactStore)) t.CheckNoError(err) // First build: Need to build both artifacts builder := &mockBuilder{dockerDaemon: dockerDaemon, push: true} bRes, err := artifactCache.Build(context.Background(), ioutil.Discard, tags, artifacts, builder.BuildAndTest) t.CheckNoError(err) t.CheckDeepEqual(2, len(builder.built)) t.CheckDeepEqual(2, len(bRes)) // Artifacts should always be returned in their original order t.CheckDeepEqual("artifact1", bRes[0].ImageName) t.CheckDeepEqual("artifact2", bRes[1].ImageName) // Second build: both artifacts are read from cache builder = &mockBuilder{dockerDaemon: dockerDaemon, push: true} bRes, err = artifactCache.Build(context.Background(), ioutil.Discard, tags, artifacts, builder.BuildAndTest) t.CheckNoError(err) t.CheckEmpty(builder.built) t.CheckDeepEqual(2, len(bRes)) t.CheckDeepEqual("artifact1", bRes[0].ImageName) t.CheckDeepEqual("artifact2", bRes[1].ImageName) // Third build: change one artifact's dependencies tmpDir.Write("dep1", "new content") builder = &mockBuilder{dockerDaemon: dockerDaemon, push: true} bRes, err = artifactCache.Build(context.Background(), ioutil.Discard, tags, artifacts, builder.BuildAndTest) t.CheckNoError(err) t.CheckDeepEqual(1, len(builder.built)) t.CheckDeepEqual(2, len(bRes)) t.CheckDeepEqual("artifact1", bRes[0].ImageName) t.CheckDeepEqual("artifact2", bRes[1].ImageName) }) }
explode_data.jsonl/23068
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1225 }
[ 2830, 3393, 8233, 11066, 24703, 1155, 353, 8840, 836, 8, 341, 18185, 1314, 16708, 1155, 11, 7342, 2915, 1155, 353, 1944, 1314, 836, 8, 341, 197, 20082, 6184, 1669, 259, 7121, 12151, 6184, 25829, 298, 60373, 445, 14891, 16, 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, 1...
1
func TestGetCredentialsEndpointWhenCredentialsAreSet(t *testing.T) { ctrl := gomock.NewController(t) defer ctrl.Finish() credentialsManager := mock_credentials.NewMockManager(ctrl) credentialsIDInTask := "credsid" task := Task{ Containers: []*apicontainer.Container{ { Name: "c1", Environment: make(map[string]string), }, { Name: "c2", Environment: make(map[string]string), }}, credentialsID: credentialsIDInTask, } taskCredentials := credentials.TaskIAMRoleCredentials{ IAMRoleCredentials: credentials.IAMRoleCredentials{CredentialsID: "credsid"}, } credentialsManager.EXPECT().GetTaskCredentials(credentialsIDInTask).Return(taskCredentials, true) task.initializeCredentialsEndpoint(credentialsManager) // Test if all containers in the task have the environment variable for // credentials endpoint set correctly. for _, container := range task.Containers { env := container.Environment _, exists := env[awsSDKCredentialsRelativeURIPathEnvironmentVariableName] if !exists { t.Errorf("'%s' environment variable not set for container '%s', env: %v", awsSDKCredentialsRelativeURIPathEnvironmentVariableName, container.Name, env) } } }
explode_data.jsonl/37192
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 433 }
[ 2830, 3393, 1949, 27025, 27380, 4498, 27025, 11526, 1649, 1155, 353, 8840, 836, 8, 341, 84381, 1669, 342, 316, 1176, 7121, 2051, 1155, 340, 16867, 23743, 991, 18176, 741, 197, 32353, 2043, 1669, 7860, 47396, 7121, 11571, 2043, 62100, 692,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestObjectSessionContext_StableMarshal(t *testing.T) { objectCtxFrom := generateObjectCtx("Object ID") t.Run("non empty", func(t *testing.T) { wire, err := objectCtxFrom.StableMarshal(nil) require.NoError(t, err) objectCtxTo := new(session.ObjectSessionContext) require.NoError(t, objectCtxTo.Unmarshal(wire)) require.Equal(t, objectCtxFrom, objectCtxTo) }) }
explode_data.jsonl/79971
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 145 }
[ 2830, 3393, 1190, 5283, 1972, 70645, 480, 55438, 1155, 353, 8840, 836, 8, 341, 35798, 23684, 3830, 1669, 6923, 1190, 23684, 445, 1190, 3034, 5130, 3244, 16708, 445, 6280, 4287, 497, 2915, 1155, 353, 8840, 836, 8, 341, 197, 6692, 554, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestPromotable(t *testing.T) { id := uint64(1) tests := []struct { peers []uint64 wp bool }{ {[]uint64{1}, true}, {[]uint64{1, 2, 3}, true}, {[]uint64{}, false}, {[]uint64{2, 3}, false}, } for i, tt := range tests { r := newRaft(id, tt.peers, 5, 1, NewMemoryStorage(), 0) if g := r.promotable(); g != tt.wp { t.Errorf("#%d: promotable = %v, want %v", i, g, tt.wp) } } }
explode_data.jsonl/67371
{ "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, 35186, 354, 480, 1155, 353, 8840, 836, 8, 341, 15710, 1669, 2622, 21, 19, 7, 16, 340, 78216, 1669, 3056, 1235, 341, 197, 197, 375, 388, 3056, 2496, 21, 19, 198, 197, 31595, 262, 1807, 198, 197, 59403, 197, 197, 90, 129...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestToDNS1123Subdomain(t *testing.T) { testCases := map[string]struct { name string expected string }{ "short": { name: "abc", expected: "abc", }, "too long": { name: strings.Repeat("a", 300), expected: strings.Repeat("a", 243), }, "surrounded by dashes": { name: "-foo-", expected: "foo", }, "illegal characters": { name: "a$b", expected: "ab", }, } for n, tc := range testCases { t.Run(n, func(t *testing.T) { a := ToDNS1123Subdomain(tc.name) if a != tc.expected { t.Errorf("Expected %q, actually %q", tc.expected, a) } }) } }
explode_data.jsonl/53358
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 298 }
[ 2830, 3393, 1249, 61088, 16, 16, 17, 18, 3136, 12204, 1155, 353, 8840, 836, 8, 341, 18185, 37302, 1669, 2415, 14032, 60, 1235, 341, 197, 11609, 257, 914, 198, 197, 42400, 914, 198, 197, 59403, 197, 197, 1, 8676, 788, 341, 298, 11609...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestGenerateFieldsYaml(t *testing.T) { tmpDir := tmpPath(t) defer os.RemoveAll(tmpDir) v, _ := common.NewVersion("6.0.0") generator, err := NewGenerator("metricbeat-*", "metric beat ?!", fieldsYml, tmpDir, "7.0.0-alpha1", *v) if err != nil { t.Fatal(err) } _, err = generator.Generate() if err != nil { t.Fatal(err) } generator.fieldsYaml = "" _, err = generator.Generate() assert.Error(t, err) }
explode_data.jsonl/3907
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 182 }
[ 2830, 3393, 31115, 8941, 56, 9467, 1155, 353, 8840, 836, 8, 341, 20082, 6184, 1669, 4174, 1820, 1155, 340, 16867, 2643, 84427, 10368, 6184, 692, 5195, 11, 716, 1669, 4185, 7121, 5637, 445, 21, 13, 15, 13, 15, 1138, 3174, 15312, 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 TestAllDevices(t *testing.T) { device := dtos.ToDeviceModel(buildTestDeviceRequest().Device) devices := []models.Device{device, device, device} expectedDeviceTotalCount := uint32(len(devices)) dic := mockDic() dbClientMock := &dbMock.DBClient{} dbClientMock.On("DeviceTotalCount").Return(expectedDeviceTotalCount, nil) dbClientMock.On("AllDevices", 0, 10, []string(nil)).Return(devices, nil) dbClientMock.On("AllDevices", 0, 5, testDeviceLabels).Return([]models.Device{devices[0], devices[1]}, nil) dbClientMock.On("AllDevices", 1, 2, []string(nil)).Return([]models.Device{devices[1], devices[2]}, nil) dbClientMock.On("AllDevices", 4, 1, testDeviceLabels).Return([]models.Device{}, errors.NewCommonEdgeX(errors.KindEntityDoesNotExist, "query objects bounds out of range.", nil)) dic.Update(di.ServiceConstructorMap{ container.DBClientInterfaceName: func(get di.Get) interface{} { return dbClientMock }, }) controller := NewDeviceController(dic) assert.NotNil(t, controller) tests := []struct { name string offset string limit string labels string errorExpected bool expectedCount int expectedTotalCount uint32 expectedStatusCode int }{ {"Valid - get devices without labels", "0", "10", "", false, 3, expectedDeviceTotalCount, http.StatusOK}, {"Valid - get devices with labels", "0", "5", strings.Join(testDeviceLabels, ","), false, 2, expectedDeviceTotalCount, http.StatusOK}, {"Valid - get devices with offset and no labels", "1", "2", "", false, 2, expectedDeviceTotalCount, http.StatusOK}, {"Invalid - offset out of range", "4", "1", strings.Join(testDeviceLabels, ","), true, 0, expectedDeviceTotalCount, http.StatusNotFound}, } for _, testCase := range tests { t.Run(testCase.name, func(t *testing.T) { req, err := http.NewRequest(http.MethodGet, common.ApiAllDeviceRoute, http.NoBody) query := req.URL.Query() query.Add(common.Offset, testCase.offset) query.Add(common.Limit, testCase.limit) if len(testCase.labels) > 0 { query.Add(common.Labels, testCase.labels) } req.URL.RawQuery = query.Encode() require.NoError(t, err) // Act recorder := httptest.NewRecorder() handler := http.HandlerFunc(controller.AllDevices) handler.ServeHTTP(recorder, req) // Assert if testCase.errorExpected { var res commonDTO.BaseResponse err = json.Unmarshal(recorder.Body.Bytes(), &res) require.NoError(t, err) assert.Equal(t, common.ApiVersion, res.ApiVersion, "API Version not as expected") assert.Equal(t, testCase.expectedStatusCode, recorder.Result().StatusCode, "HTTP status code not as expected") assert.Equal(t, testCase.expectedStatusCode, int(res.StatusCode), "Response status code not as expected") assert.NotEmpty(t, res.Message, "Response message doesn't contain the error message") } else { var res responseDTO.MultiDevicesResponse err = json.Unmarshal(recorder.Body.Bytes(), &res) require.NoError(t, err) assert.Equal(t, common.ApiVersion, res.ApiVersion, "API Version not as expected") assert.Equal(t, testCase.expectedStatusCode, recorder.Result().StatusCode, "HTTP status code not as expected") assert.Equal(t, testCase.expectedStatusCode, int(res.StatusCode), "Response status code not as expected") assert.Equal(t, testCase.expectedCount, len(res.Devices), "Device count not as expected") assert.Equal(t, testCase.expectedTotalCount, res.TotalCount, "Total count not as expected") assert.Empty(t, res.Message, "Message should be empty when it is successful") } }) } }
explode_data.jsonl/9306
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1314 }
[ 2830, 3393, 2403, 40835, 1155, 353, 8840, 836, 8, 341, 54719, 1669, 7594, 436, 3274, 6985, 1712, 43333, 2271, 6985, 1900, 1005, 6985, 340, 27302, 1216, 1669, 3056, 6507, 43995, 90, 6111, 11, 3671, 11, 3671, 532, 42400, 6985, 7595, 2507,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestInitCmd_exists(t *testing.T) { var buf bytes.Buffer fc := fake.NewSimpleClientset(&v1beta1.Deployment{ ObjectMeta: metav1.ObjectMeta{ Namespace: "kudo-system", Name: "kudo-manager-deploy", }, }) fc2 := apiextfake.NewSimpleClientset() fc.PrependReactor("*", "*", func(action testcore.Action) (bool, runtime.Object, error) { return true, nil, apierrors.NewAlreadyExists(v1.Resource("deployments"), "1") }) cmd := &initCmd{ out: &buf, fs: afero.NewMemMapFs(), client: &kube.Client{KubeClient: fc, ExtClient: fc2}, } clog.InitWithFlags(nil, &buf) Settings.Home = "/opt" if err := cmd.run(); err != nil { t.Errorf("did not expect error: %v", err) } expected := "$KUDO_HOME has been configured at /opt\n" if !strings.Contains(buf.String(), expected) { t.Errorf("expected %q, got %q", expected, buf.String()) } }
explode_data.jsonl/53639
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 359 }
[ 2830, 3393, 3803, 15613, 9766, 1155, 353, 8840, 836, 8, 1476, 2405, 6607, 5820, 22622, 198, 1166, 66, 1669, 12418, 7121, 16374, 2959, 746, 2099, 85, 16, 19127, 16, 34848, 39130, 515, 197, 23816, 12175, 25, 77520, 16, 80222, 515, 298, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestDeleteExpiredSnapshots(t *testing.T) { sqlstore := InitTestDB(t) Convey("Testing dashboard snapshots clean up", t, func() { setting.SnapShotRemoveExpired = true notExpiredsnapshot := createTestSnapshot(sqlstore, "key1", 48000) createTestSnapshot(sqlstore, "key2", -1200) createTestSnapshot(sqlstore, "key3", -1200) err := DeleteExpiredSnapshots(&models.DeleteExpiredSnapshotsCommand{}) So(err, ShouldBeNil) query := models.GetDashboardSnapshotsQuery{ OrgId: 1, SignedInUser: &models.SignedInUser{OrgRole: models.ROLE_ADMIN}, } err = SearchDashboardSnapshots(&query) So(err, ShouldBeNil) So(len(query.Result), ShouldEqual, 1) So(query.Result[0].Key, ShouldEqual, notExpiredsnapshot.Key) err = DeleteExpiredSnapshots(&models.DeleteExpiredSnapshotsCommand{}) So(err, ShouldBeNil) query = models.GetDashboardSnapshotsQuery{ OrgId: 1, SignedInUser: &models.SignedInUser{OrgRole: models.ROLE_ADMIN}, } err = SearchDashboardSnapshots(&query) So(err, ShouldBeNil) So(len(query.Result), ShouldEqual, 1) So(query.Result[0].Key, ShouldEqual, notExpiredsnapshot.Key) }) }
explode_data.jsonl/31106
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 443 }
[ 2830, 3393, 6435, 54349, 61871, 27634, 1155, 353, 8840, 836, 8, 341, 30633, 4314, 1669, 15690, 2271, 3506, 1155, 692, 93070, 5617, 445, 16451, 26967, 61823, 4240, 705, 497, 259, 11, 2915, 368, 341, 197, 8196, 1280, 808, 6861, 36402, 130...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestProc_manyEndings(t *testing.T) { p := New() const COUNT = 20 var wg sync.WaitGroup wg.Add(COUNT) for i := 0; i < COUNT; i++ { runtime.On(p.End(), wg.Done) } fatalAfter(t, runtime.After(wg.Wait), 5*time.Second, "timed out waiting for loose End()s") fatalAfter(t, p.Done(), 5*time.Second, "timed out waiting for process death") }
explode_data.jsonl/45686
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 145 }
[ 2830, 3393, 24508, 22101, 3727, 819, 1155, 353, 8840, 836, 8, 341, 3223, 1669, 1532, 741, 4777, 23989, 284, 220, 17, 15, 198, 2405, 63581, 12811, 28384, 2808, 198, 72079, 1904, 3025, 7463, 340, 2023, 600, 1669, 220, 15, 26, 600, 366, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestU128_Hash(t *testing.T) { assertHash(t, []hashAssert{ {NewU128(*big.NewInt(29)), MustHexDecodeString( "0x139bd9153bbc4913d4161f7a5dd39912b5d22b57a8b557f0a24078a11f943174")}, }) }
explode_data.jsonl/18419
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 102 }
[ 2830, 3393, 52, 16, 17, 23, 2039, 988, 1155, 353, 8840, 836, 8, 341, 6948, 6370, 1155, 11, 3056, 8296, 8534, 515, 197, 197, 90, 3564, 52, 16, 17, 23, 4071, 16154, 7121, 1072, 7, 17, 24, 5731, 15465, 20335, 32564, 703, 1006, 298, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestMarshalEmptyIP(t *testing.T) { for _, in := range [][]byte{nil, []byte("")} { var out = IP{1, 2, 3, 4} if err := out.UnmarshalText(in); err != nil || out != nil { t.Errorf("UnmarshalText(%v) = %v, %v; want nil, nil", in, out, err) } } var ip IP got, err := ip.MarshalText() if err != nil { t.Fatal(err) } if !reflect.DeepEqual(got, []byte("")) { t.Errorf(`got %#v, want []byte("")`, got) } }
explode_data.jsonl/14218
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 199 }
[ 2830, 3393, 55438, 3522, 3298, 1155, 353, 8840, 836, 8, 341, 2023, 8358, 304, 1669, 2088, 52931, 3782, 90, 8385, 11, 3056, 3782, 39047, 92, 341, 197, 2405, 700, 284, 6790, 90, 16, 11, 220, 17, 11, 220, 18, 11, 220, 19, 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...
6
func TestRateSleep(t *testing.T) { // The jitter tolerance (5msec) doesn't have strong basis. const JitterTolerance int64 = 5000000 ct := NewDuration(0, 100000000) // 10msec r := CycleTime(ct) if ct.Cmp(r.ExpectedCycleTime()) != 0 { t.Fail() } for i := 0; i < 10; i++ { start := time.Now().UnixNano() time.Sleep(time.Duration(rand.Intn(10)) * time.Millisecond) r.Sleep() end := time.Now().UnixNano() elapsed := end - start delta := elapsed - int64(ct.ToNSec()) if delta < 0 { delta = -delta } if delta > JitterTolerance { actual := r.CycleTime() t.Errorf("expected: %d actual: %d measured: %d delta: %d", ct.ToNSec(), actual.ToNSec(), elapsed, delta) } } }
explode_data.jsonl/6815
{ "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, 11564, 41745, 1155, 353, 8840, 836, 8, 341, 197, 322, 576, 84392, 24098, 320, 20, 76, 5024, 8, 3171, 944, 614, 3746, 8037, 624, 4777, 619, 3248, 51, 31661, 526, 21, 19, 284, 220, 20, 15, 15, 15, 15, 15, 15, 198, 8921...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestAuthRequired(t *testing.T) { tests := []testRun{{ Name: "auth", URL: "rc/noopauth", Method: "POST", Body: `{}`, ContentType: "application/javascript", Status: http.StatusForbidden, Expected: `{ "error": "authentication must be set up on the rc server to use \"rc/noopauth\" or the --rc-no-auth flag must be in use", "input": {}, "path": "rc/noopauth", "status": 403 } `, }} opt := newTestOpt() opt.Serve = false opt.Files = "" opt.NoAuth = false testServer(t, tests, &opt) }
explode_data.jsonl/12969
{ "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, 5087, 8164, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 3056, 1944, 6727, 90, 515, 197, 21297, 25, 286, 330, 3242, 756, 197, 79055, 25, 260, 330, 1287, 33100, 453, 3242, 756, 197, 84589, 25, 414, 330, 2946, 756, 197, 197,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestDescribeDocumentsCommand(t *testing.T) { ssmMock := &manager.MockSSM{ Error: false, NextToken: "", CommandStatus: "Success", CommandHistory: map[string]*struct { Command *ssm.Command Status string }{}, DocumentDescription: ssmDocumentDescription, } m := manager.NewTestManager(ssmMock, nil, nil) t.Run("Describe documents works", func(t *testing.T) { expected := outputDocumentDescription actual, err := m.DescribeDocument("AWS-RunShellScript") assert.Nil(t, err) assert.NotNil(t, actual) assert.Equal(t, expected, actual) }) t.Run("Incorrect name failes", func(t *testing.T) { actual, err := m.DescribeDocument("Does-not-exist") assert.NotNil(t, err) assert.EqualError(t, err, "failed to describe document: expected") assert.Nil(t, actual) }) }
explode_data.jsonl/27144
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 314 }
[ 2830, 3393, 74785, 27143, 4062, 1155, 353, 8840, 836, 8, 341, 34472, 76, 11571, 1669, 609, 13297, 24664, 1220, 44, 515, 197, 58421, 25, 260, 895, 345, 197, 197, 5847, 3323, 25, 257, 8324, 197, 97493, 2522, 25, 330, 7188, 756, 197, 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...
1
func TestParseList(t *testing.T) { // This just tests the expected return values and the like. Testing the full // parsing logic is in parse_test.go. cases := []struct { str string expected List expectedValid bool }{ {``, List{}, false}, {`asd`, List{Address{Raw: "asd"}}, true}, {"Martin <martin@example.com>", List{Address{Name: "Martin", Address: "martin@example.com"}}, false}, {"\"Martin, What\" <martin@example.com>, another@foo.com", List{ Address{Raw: "\"Martin, What\" <martin@example.com>", Name: "Martin, What", Address: "martin@example.com"}, Address{Raw: "another@foo.com", Address: "another@foo.com"}, }, false}, } for _, tc := range cases { t.Run(tc.str, func(t *testing.T) { got, gotValid := ParseList(tc.str) if !cmplist(tc.expected, got) { t.Errorf(diff.Cmp(tc.expected, got)) } if gotValid != tc.expectedValid { t.Errorf("gotValid: %v, expectedValid: %v", gotValid, tc.expectedValid) } }) } }
explode_data.jsonl/70341
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 403 }
[ 2830, 3393, 14463, 852, 1155, 353, 8840, 836, 8, 341, 197, 322, 1096, 1101, 7032, 279, 3601, 470, 2750, 323, 279, 1075, 13, 26768, 279, 2480, 198, 197, 322, 22314, 12218, 374, 304, 4715, 4452, 18002, 624, 1444, 2264, 1669, 3056, 1235,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestDirectoryFiltersLoads(t *testing.T) { // exclude, and its error, should be excluded from the workspace. const files = ` -- go.mod -- module example.com go 1.12 -- exclude/exclude.go -- package exclude const _ = Nonexistant ` cfg := EditorConfig{ DirectoryFilters: []string{"-exclude"}, } WithOptions(cfg).Run(t, files, func(t *testing.T, env *Env) { env.Await(NoDiagnostics("exclude/x.go")) }) }
explode_data.jsonl/37372
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 152 }
[ 2830, 3393, 9310, 28351, 78517, 1155, 353, 8840, 836, 8, 341, 197, 322, 21687, 11, 323, 1181, 1465, 11, 1265, 387, 27444, 504, 279, 27514, 624, 4777, 3542, 284, 22074, 313, 728, 10929, 39514, 4352, 3110, 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
func TestGarbageCollectServices(t *testing.T) { r := newJobsTestResolver(t) defer r.drv.Close() client := r.client ctx := viewertest.NewContext(context.Background(), client) equipType := client.EquipmentType.Create(). SetName("equipType"). SaveX(ctx) pType := client.PropertyType.Create(). SetName("p1"). SetType("string"). SetBoolVal(true). SetEquipmentType(equipType). SaveX(ctx) sType := client.ServiceType.Create(). SetName("serviceType"). AddPropertyTypes(pType). SetIsDeleted(true). SaveX(ctx) epType := client.ServiceEndpointDefinition.Create(). SetName("ep1"). SetEquipmentType(equipType). SetIndex(0). SetServiceType(sType). SaveX(ctx) eq := client.Equipment.Create(). SetName("equip"). SetType(equipType). SaveX(ctx) prop := client.Property.Create(). SetType(pType). SetBoolVal(true). SetEquipment(eq). SaveX(ctx) s1 := client.Service.Create(). SetName("s1"). SetType(sType). SetStatus("PENDING"). SaveX(ctx) ep := client.ServiceEndpoint.Create(). SetDefinition(epType). SetService(s1). SetEquipment(eq). SaveX(ctx) s2 := client.Service.Create(). SetName("s2"). SetType(sType). AddProperties(prop). SetStatus("PENDING"). SaveX(ctx) require.True(t, client.ServiceType.Query().Where(servicetype.ID(sType.ID)).ExistX(ctx)) require.True(t, client.ServiceEndpointDefinition.Query().Where(serviceendpointdefinition.ID(epType.ID)).ExistX(ctx)) require.True(t, client.PropertyType.Query().Where(propertytype.ID(pType.ID)).ExistX(ctx)) require.True(t, client.Service.Query().Where(service.ID(s1.ID)).ExistX(ctx)) require.True(t, client.Service.Query().Where(service.ID(s2.ID)).ExistX(ctx)) require.True(t, client.ServiceEndpoint.Query().Where(serviceendpoint.ID(ep.ID)).ExistX(ctx)) require.True(t, client.Property.Query().Where(property.ID(prop.ID)).ExistX(ctx)) err := r.jobsRunner.collectServices(ctx) require.NoError(t, err) require.False(t, client.ServiceType.Query().Where(servicetype.ID(sType.ID)).ExistX(ctx)) require.False(t, client.ServiceEndpointDefinition.Query().Where(serviceendpointdefinition.ID(epType.ID)).ExistX(ctx)) require.False(t, client.PropertyType.Query().Where(propertytype.ID(pType.ID)).ExistX(ctx)) require.False(t, client.Service.Query().Where(service.ID(s1.ID)).ExistX(ctx)) require.False(t, client.Service.Query().Where(service.ID(s2.ID)).ExistX(ctx)) require.False(t, client.ServiceEndpoint.Query().Where(serviceendpoint.ID(ep.ID)).ExistX(ctx)) require.False(t, client.Property.Query().Where(property.ID(prop.ID)).ExistX(ctx)) }
explode_data.jsonl/38408
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 986 }
[ 2830, 3393, 43930, 20652, 47504, 11025, 1155, 353, 8840, 836, 8, 341, 7000, 1669, 501, 40667, 2271, 18190, 1155, 340, 16867, 435, 950, 10553, 10421, 741, 25291, 1669, 435, 6581, 198, 20985, 1669, 1651, 83386, 7121, 1972, 5378, 19047, 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...
1
func TestCreateSnapshots(t *testing.T) { c, err := NewContainer(ContainerName) if err != nil { t.Errorf(err.Error()) } for i := 0; i < 3; i++ { if _, err := c.CreateSnapshot(); err != nil { t.Errorf(err.Error()) } } }
explode_data.jsonl/2742
{ "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, 4021, 61871, 27634, 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, 2023, 600, 1669, 220, 15, 26, 600, 366, 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, 1...
4
func TestAdapterTimeMetric(t *testing.T) { adapterName := "anyName" performTest := func(m *Metrics, timeInMs float64, adapterErrors map[pbsmetrics.AdapterError]struct{}) { m.RecordAdapterTime(pbsmetrics.AdapterLabels{ Adapter: openrtb_ext.BidderName(adapterName), AdapterErrors: adapterErrors, }, time.Duration(timeInMs)*time.Millisecond) } testCases := []struct { description string testCase func(m *Metrics) expectedCount uint64 expectedSum float64 }{ { description: "Success", testCase: func(m *Metrics) { performTest(m, 500, map[pbsmetrics.AdapterError]struct{}{}) }, expectedCount: 1, expectedSum: 0.5, }, { description: "Error", testCase: func(m *Metrics) { performTest(m, 500, map[pbsmetrics.AdapterError]struct{}{ pbsmetrics.AdapterErrorTimeout: {}, }) }, expectedCount: 0, expectedSum: 0, }, } for _, test := range testCases { m := createMetricsForTesting() test.testCase(m) result := getHistogramFromHistogramVec(m.adapterRequestsTimer, adapterLabel, adapterName) assertHistogram(t, test.description, result, test.expectedCount, test.expectedSum) } }
explode_data.jsonl/13952
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 476 }
[ 2830, 3393, 5940, 1462, 54310, 1155, 353, 8840, 836, 8, 341, 197, 19731, 675, 1669, 330, 3767, 675, 698, 197, 28488, 2271, 1669, 2915, 1255, 353, 27328, 11, 882, 641, 21634, 2224, 21, 19, 11, 12956, 13877, 2415, 11407, 1279, 43262, 34...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestStore_DeleteServiceAccount(t *testing.T) { cases := []struct { desc string user tests.TestUser expectedErr error }{ { desc: "service accounts should exist and get deleted", user: tests.TestUser{Login: "servicetest1@admin", IsServiceAccount: true}, expectedErr: nil, }, { desc: "service accounts is false should not delete the user", user: tests.TestUser{Login: "test1@admin", IsServiceAccount: false}, expectedErr: serviceaccounts.ErrServiceAccountNotFound, }, } for _, c := range cases { t.Run(c.desc, func(t *testing.T) { db, store := setupTestDatabase(t) user := tests.SetupUserServiceAccount(t, db, c.user) err := store.DeleteServiceAccount(context.Background(), user.OrgId, user.Id) if c.expectedErr != nil { require.ErrorIs(t, err, c.expectedErr) } else { require.NoError(t, err) } }) } }
explode_data.jsonl/59023
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 378 }
[ 2830, 3393, 6093, 57418, 1860, 7365, 1155, 353, 8840, 836, 8, 341, 1444, 2264, 1669, 3056, 1235, 341, 197, 41653, 286, 914, 198, 197, 19060, 286, 7032, 8787, 1474, 198, 197, 42400, 7747, 1465, 198, 197, 59403, 197, 197, 515, 298, 4165...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestTxWire(t *testing.T) { // Empty tx message. noTx := NewMsgTx(1) noTx.Version = 1 noTxEncoded := []byte{ 0x01, 0x00, 0x00, 0x00, // Version 0x00, // Varint for number of input transactions 0x00, // Varint for number of output transactions 0x00, 0x00, 0x00, 0x00, // Lock time } tests := []struct { in *MsgTx // Message to encode out *MsgTx // Expected decoded message buf []byte // Wire encoding pver uint32 // Protocol version for wire encoding enc MessageEncoding // Message encoding format }{ // Latest protocol version with no transactions. { noTx, noTx, noTxEncoded, ProtocolVersion, BaseEncoding, }, // Latest protocol version with multiple transactions. { multiTx, multiTx, multiTxEncoded, ProtocolVersion, BaseEncoding, }, // Protocol version BIP0035Version with no transactions. { noTx, noTx, noTxEncoded, BIP0035Version, BaseEncoding, }, // Protocol version BIP0035Version with multiple transactions. { multiTx, multiTx, multiTxEncoded, BIP0035Version, BaseEncoding, }, // Protocol version BIP0031Version with no transactions. { noTx, noTx, noTxEncoded, BIP0031Version, BaseEncoding, }, // Protocol version BIP0031Version with multiple transactions. { multiTx, multiTx, multiTxEncoded, BIP0031Version, BaseEncoding, }, // Protocol version NetAddressTimeVersion with no transactions. { noTx, noTx, noTxEncoded, NetAddressTimeVersion, BaseEncoding, }, // Protocol version NetAddressTimeVersion with multiple transactions. { multiTx, multiTx, multiTxEncoded, NetAddressTimeVersion, BaseEncoding, }, // Protocol version MultipleAddressVersion with no transactions. { noTx, noTx, noTxEncoded, MultipleAddressVersion, BaseEncoding, }, // Protocol version MultipleAddressVersion with multiple transactions. { multiTx, multiTx, multiTxEncoded, MultipleAddressVersion, BaseEncoding, }, } t.Logf("Running %d tests", len(tests)) for i, test := range tests { // Encode the message to wire format. var buf bytes.Buffer err := test.in.HdfEncode(&buf, test.pver, test.enc) if err != nil { t.Errorf("HdfEncode #%d error %v", i, err) continue } if !bytes.Equal(buf.Bytes(), test.buf) { t.Errorf("HdfEncode #%d\n got: %s want: %s", i, spew.Sdump(buf.Bytes()), spew.Sdump(test.buf)) continue } // Decode the message from wire format. var msg MsgTx rbuf := bytes.NewReader(test.buf) err = msg.HdfDecode(rbuf, test.pver, test.enc) if err != nil { t.Errorf("HdfDecode #%d error %v", i, err) continue } if !reflect.DeepEqual(&msg, test.out) { t.Errorf("HdfDecode #%d\n got: %s want: %s", i, spew.Sdump(&msg), spew.Sdump(test.out)) continue } } }
explode_data.jsonl/24620
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1256 }
[ 2830, 3393, 31584, 37845, 1155, 353, 8840, 836, 8, 341, 197, 322, 22228, 9854, 1943, 624, 72104, 31584, 1669, 1532, 6611, 31584, 7, 16, 340, 72104, 31584, 35842, 284, 220, 16, 198, 72104, 31584, 46795, 1669, 3056, 3782, 515, 197, 197, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
6
func Test_calculateFieldDesc(t *testing.T) { sampleSize := make([]byte, 2<<25) tests := []struct { name string valueSize int expected int }{ {"TZero", 0, 0}, {"TSmall", 127, 2}, {"TMedium", 128, 3}, {"TLarge", 16384, 4}, {"TVeryL", 10000000, 5}, {"TOverflow", 2000000000, 6}, } for _, test := range tests { t.Run(test.name, func(t *testing.T) { assert.Equal(t, test.expected, CalculateFieldDescSize(test.valueSize)) if test.valueSize <= len(sampleSize) { inputBytes := sampleSize[:test.valueSize] dummy := &types.GetBlockHeadersRequest{Hash: inputBytes} realSize := proto.Size(dummy) assert.Equal(t, realSize, CalculateFieldDescSize(test.valueSize)+len(inputBytes)) } else { fmt.Println(test.name, " is too big to make real ") } }) } }
explode_data.jsonl/81870
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 339 }
[ 2830, 3393, 24005, 11207, 1877, 11065, 1155, 353, 8840, 836, 8, 341, 1903, 1516, 1695, 1669, 1281, 10556, 3782, 11, 220, 17, 2442, 17, 20, 340, 78216, 1669, 3056, 1235, 341, 197, 11609, 414, 914, 198, 197, 16309, 1695, 526, 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 TestCanonicalize(t *testing.T) { // TODO: do a full test using CLDR data in a separate regression test. tests := []struct { in, out string option CanonType }{ {"en-Latn", "en", SuppressScript}, {"sr-Cyrl", "sr-Cyrl", SuppressScript}, {"sh", "sr-Latn", Legacy}, {"sh-HR", "sr-Latn-HR", Legacy}, {"sh-Cyrl-HR", "sr-Cyrl-HR", Legacy}, {"tl", "fil", Legacy}, {"no", "no", Legacy}, {"no", "nb", Legacy | CLDR}, {"cmn", "cmn", Legacy}, {"cmn", "zh", Macro}, {"cmn-u-co-stroke", "zh-u-co-stroke", Macro}, {"yue", "yue", Macro}, {"nb", "no", Macro}, {"nb", "nb", Macro | CLDR}, {"no", "no", Macro}, {"no", "no", Macro | CLDR}, {"iw", "he", DeprecatedBase}, {"iw", "he", Deprecated | CLDR}, {"mo", "ro-MD", Deprecated}, // Adopted by CLDR as of version 25. {"alb", "sq", Legacy}, // bibliographic {"dut", "nl", Legacy}, // bibliographic // As of CLDR 25, mo is no longer considered a legacy mapping. {"mo", "mo", Legacy | CLDR}, {"und-AN", "und-AN", Deprecated}, {"und-YD", "und-YE", DeprecatedRegion}, {"und-YD", "und-YD", DeprecatedBase}, {"und-Qaai", "und-Zinh", DeprecatedScript}, {"und-Qaai", "und-Qaai", DeprecatedBase}, {"drh", "mn", All}, // drh -> khk -> mn {"en-GB-u-rg-uszzzz", "en-GB-u-rg-uszzzz", Raw}, {"en-GB-u-rg-USZZZZ", "en-GB-u-rg-uszzzz", Raw}, // TODO: use different exact values for language and regional tag? {"en-GB-u-rg-uszzzz-va-posix", "en-GB-u-rg-uszzzz-va-posix", Raw}, {"en-GB-u-rg-uszzzz-co-phonebk", "en-GB-u-co-phonebk-rg-uszzzz", Raw}, // Invalid region specifications are left as is. {"en-GB-u-rg-usz", "en-GB-u-rg-usz", Raw}, {"en-GB-u-rg-usz-va-posix", "en-GB-u-rg-usz-va-posix", Raw}, {"en-GB-u-rg-usz-co-phonebk", "en-GB-u-co-phonebk-rg-usz", Raw}, } for i, tt := range tests { in, _ := Raw.Parse(tt.in) in, _ = tt.option.Canonicalize(in) if in.String() != tt.out { t.Errorf("%d:%s: was %s; want %s", i, tt.in, in.String(), tt.out) } } // Test idempotence. for _, base := range Supported.BaseLanguages() { tag, _ := Raw.Compose(base) got, _ := All.Canonicalize(tag) want, _ := All.Canonicalize(got) if got != want { t.Errorf("idem(%s): got %s; want %s", tag, got, want) } } }
explode_data.jsonl/15844
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1049 }
[ 2830, 3393, 70914, 551, 1155, 353, 8840, 836, 8, 341, 197, 322, 5343, 25, 653, 264, 2480, 1273, 1667, 6976, 7687, 821, 304, 264, 8651, 30549, 1273, 624, 78216, 1669, 3056, 1235, 341, 197, 17430, 11, 700, 914, 198, 197, 80845, 220, 3...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
5
func TestSweepContainer(t *testing.T) { cfg := defaultTestConfigIntegTest() cfg.TaskCleanupWaitDuration = 1 * time.Minute cfg.ContainerMetadataEnabled = config.BooleanDefaultFalse{Value: config.ExplicitlyEnabled} taskEngine, done, _ := setup(cfg, nil, t) defer done() taskArn := "arn:aws:ecs:us-east-1:123456789012:task/testSweepContainer" testTask := createTestTask(taskArn) go taskEngine.AddTask(testTask) verifyContainerRunningStateChange(t, taskEngine) verifyTaskRunningStateChange(t, taskEngine) verifyContainerStoppedStateChange(t, taskEngine) verifyTaskStoppedStateChange(t, taskEngine) tasks, _ := taskEngine.ListTasks() assert.Equal(t, len(tasks), 1) assert.Equal(t, tasks[0].GetKnownStatus(), apitaskstatus.TaskStopped) // Should be stopped, let's verify it's still listed... task, ok := taskEngine.(*DockerTaskEngine).State().TaskByArn(taskArn) assert.True(t, ok, "Expected task to be present still, but wasn't") task.SetSentStatus(apitaskstatus.TaskStopped) // cleanupTask waits for TaskStopped to be sent before cleaning time.Sleep(1 * time.Minute) for i := 0; i < 60; i++ { _, ok = taskEngine.(*DockerTaskEngine).State().TaskByArn(taskArn) if !ok { break } time.Sleep(1 * time.Second) } assert.False(t, ok, "Expected container to have been swept but was not") tasks, _ = taskEngine.ListTasks() assert.Equal(t, len(tasks), 0) }
explode_data.jsonl/39467
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 493 }
[ 2830, 3393, 50, 48542, 4502, 1155, 353, 8840, 836, 8, 341, 50286, 1669, 1638, 2271, 2648, 1072, 791, 2271, 741, 50286, 28258, 67335, 14190, 12945, 284, 220, 16, 353, 882, 75770, 198, 50286, 33672, 14610, 5462, 284, 2193, 19162, 3675, 40...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestOTLPRateLimit(t *testing.T) { // The configured rate limit. const eventRateLimit = 10 // The actual rate limit: a 3x "burst multiplier" is applied, // and each gRPC method call is counted towards the event rate // limit as well. const sendEventLimit = (3 * eventRateLimit) / 2 srv := apmservertest.NewUnstartedServer(t) srv.Config.AgentAuth.SecretToken = "abc123" // enable auth & rate limiting srv.Config.AgentAuth.Anonymous = &apmservertest.AnonymousAuthConfig{ Enabled: true, AllowAgent: []string{"iOS/swift"}, RateLimit: &apmservertest.RateLimitConfig{ IPLimit: 2, EventLimit: eventRateLimit, }, } err := srv.Start() require.NoError(t, err) sendEvent := func(ip string) error { ctx, cancel := context.WithCancel(context.Background()) defer cancel() exporter := newOTLPTraceExporter(t, srv, otlptracegrpc.WithHeaders(map[string]string{"x-real-ip": ip}), otlptracegrpc.WithRetry(otlptracegrpc.RetryConfig{Enabled: false}), ) resource := sdkresource.NewSchemaless( attribute.String("service.name", "service2"), attribute.String("telemetry.sdk.name", "iOS"), attribute.String("telemetry.sdk.language", "swift"), ) return sendOTLPTrace(ctx, newOTLPTracerProvider(exporter, sdktrace.WithResource(resource))) } // Check that for the configured IP limit (2), we can handle 3*event_limit without being rate limited. var g errgroup.Group for i := 0; i < sendEventLimit; i++ { g.Go(func() error { return sendEvent("10.11.12.13") }) g.Go(func() error { return sendEvent("10.11.12.14") }) } err = g.Wait() assert.NoError(t, err) // The rate limiter cache only has space for 2 IPs, so the 3rd one reuses an existing // limiter, which will have already been exhausted. err = sendEvent("10.11.12.15") require.Error(t, err) errStatus, ok := status.FromError(err) require.True(t, ok) assert.Equal(t, codes.ResourceExhausted, errStatus.Code()) assert.Equal(t, "rate limit exceeded", errStatus.Message()) }
explode_data.jsonl/34665
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 719 }
[ 2830, 3393, 1793, 43, 6480, 349, 16527, 1155, 353, 8840, 836, 8, 341, 197, 322, 576, 19755, 4379, 3930, 624, 4777, 1538, 11564, 16527, 284, 220, 16, 15, 271, 197, 322, 576, 5042, 4379, 3930, 25, 264, 220, 18, 87, 330, 57738, 30559, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestContextBindWithQuery(t *testing.T) { w := httptest.NewRecorder() c, _ := CreateTestContext(w) c.Request, _ = http.NewRequest("POST", "/?foo=bar&bar=foo", bytes.NewBufferString("foo=unused")) var obj struct { Foo string `form:"foo"` Bar string `form:"bar"` } assert.NoError(t, c.BindQuery(&obj)) assert.Equal(t, "foo", obj.Bar) assert.Equal(t, "bar", obj.Foo) assert.Equal(t, 0, w.Body.Len()) }
explode_data.jsonl/26822
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 174 }
[ 2830, 3393, 1972, 9950, 2354, 2859, 1155, 353, 8840, 836, 8, 341, 6692, 1669, 54320, 70334, 7121, 47023, 741, 1444, 11, 716, 1669, 4230, 2271, 1972, 3622, 692, 1444, 9659, 11, 716, 284, 1758, 75274, 445, 2946, 497, 3521, 30, 7975, 28,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestEmbedder(t *testing.T) { hW := []byte("hello, world") embedded, err := Embed("asset", hW) if err != nil { t.Fatal(err) } p1 := strings.Index(string(embedded), "{") p2 := strings.Index(string(embedded), "}") bytesOnly := string(embedded)[p1+1 : p2] bytesOnlySlice := strings.Split(bytesOnly, ",") var hW2 []byte for _, b := range bytesOnlySlice { bb, err := strconv.Atoi(strings.TrimSpace(b)) if err != nil { t.Fatal(err) } hW2 = append(hW2, byte(bb)) } if string(hW2) != "hello, world" { t.Fatal("Should be able to embed an asset") } t.Log("Succes - embedder") }
explode_data.jsonl/12812
{ "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, 25486, 1107, 1155, 353, 8840, 836, 8, 1476, 9598, 54, 1669, 3056, 3782, 445, 14990, 11, 1879, 5130, 197, 69864, 11, 1848, 1669, 37068, 445, 9852, 497, 305, 54, 340, 743, 1848, 961, 2092, 341, 197, 3244, 26133, 3964, 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...
5
func TestThrottling_DebugHeader(t *testing.T) { tracer, closer := NewTracer("DOOP", NewConstSampler(true), NewNullReporter()) h := http.Header{} h.Add(JaegerDebugHeader, "x") ctx, err := tracer.Extract(opentracing.HTTPHeaders, opentracing.HTTPHeadersCarrier(h)) require.NoError(t, err) sp := tracer.StartSpan("root", opentracing.ChildOf(ctx)).(*Span) assert.True(t, sp.context.IsDebug()) closer.Close() tracer, closer = NewTracer("DOOP", NewConstSampler(true), NewNullReporter(), TracerOptions.DebugThrottler(testThrottler{allowAll: false})) defer closer.Close() sp = tracer.StartSpan("root", opentracing.ChildOf(ctx)).(*Span) assert.False(t, sp.context.IsDebug(), "debug should not be allowed by the throttler") }
explode_data.jsonl/44656
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 275 }
[ 2830, 3393, 1001, 46689, 2718, 77938, 4047, 1155, 353, 8840, 836, 8, 341, 25583, 9584, 11, 12128, 1669, 1532, 1282, 9584, 445, 5865, 3067, 497, 1532, 19167, 66048, 3715, 701, 1532, 3280, 52766, 12367, 9598, 1669, 1758, 15753, 16094, 9598,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestClientRequest(t *testing.T) { server := newTestServer() defer server.Stop() client := DialInProc(server) defer client.Close() var resp Result if err := client.Call(&resp, "test_echo", "hello", 10, &Args{"world"}); err != nil { //t.Fatal(err) logs.Error(err) } if !reflect.DeepEqual(resp, Result{"hello", 10, &Args{"world"}}) { //t.Errorf("incorrect result %#v", resp) logs.Error("incorrect result %#v", resp) } jsonstr := json.ToJSON(resp) logs.Info(jsonstr) }
explode_data.jsonl/64458
{ "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, 2959, 1900, 1155, 353, 8840, 836, 8, 341, 41057, 1669, 501, 2271, 5475, 741, 16867, 3538, 30213, 741, 25291, 1669, 66155, 641, 24508, 21421, 340, 16867, 2943, 10421, 2822, 2405, 9039, 5714, 198, 743, 1848, 1669, 2943, 27017, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestHandleBuild(t *testing.T) { t.Parallel() ctx := testutil.TestingContext() ctx, _ = tq.TestingContext(ctx, nil) Convey(`Test BuildbucketPubSubHandler`, t, func() { Convey(`non chromium build is ignored`, func() { buildExp := bbv1.LegacyApiCommonBuildMessage{ Project: "fake", Bucket: "luci.fake.bucket", Id: 87654321, Status: bbv1.StatusCompleted, CreatedTs: bbv1.FormatTimestamp(time.Now()), } r := &http.Request{Body: makeBBReq(buildExp)} err := bbPubSubHandlerImpl(ctx, r) So(err, ShouldBeNil) }) Convey(`chromium build is processed`, func() { buildExp := bbv1.LegacyApiCommonBuildMessage{ Project: "chromium", Bucket: chromiumCIBucket, Id: 87654321, Status: bbv1.StatusCompleted, CreatedTs: bbv1.FormatTimestamp(time.Now()), } r := &http.Request{Body: makeBBReq(buildExp)} err := bbPubSubHandlerImpl(ctx, r) So(err, ShouldBeNil) }) }) }
explode_data.jsonl/70800
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 442 }
[ 2830, 3393, 6999, 11066, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 741, 20985, 1669, 1273, 1314, 8787, 287, 1972, 741, 20985, 11, 716, 284, 35885, 8787, 287, 1972, 7502, 11, 2092, 692, 93070, 5617, 5809, 2271, 7854, 30410, 29162,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestAddToScheme(t *testing.T) { s := runtime.NewScheme() if err := AddToScheme(s); err != nil { t.Errorf("AddToScheme() error = %v", err) } gvs := []schema.GroupVersion{ v1alpha1.SchemeGroupVersion, } for _, gv := range gvs { if !s.IsVersionRegistered(gv) { t.Errorf("AddToScheme() %v should be registered", gv) } } }
explode_data.jsonl/31109
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 150 }
[ 2830, 3393, 2212, 1249, 28906, 1155, 353, 8840, 836, 8, 341, 1903, 1669, 15592, 7121, 28906, 741, 743, 1848, 1669, 2691, 1249, 28906, 1141, 1215, 1848, 961, 2092, 341, 197, 3244, 13080, 445, 2212, 1249, 28906, 368, 1465, 284, 1018, 85, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestV1_Path(t *testing.T) { framework.NewTest(t). RequiresEnvironment(environment.Kube). Run(func(ctx framework.TestContext) { ns := namespace.NewOrFail(t, ctx, "v1-path", true) ports := []echo.Port{ { Name: "http", Protocol: config.ProtocolHTTP, ServicePort: 80, }, } var a, b echo.Instance echoboot.NewBuilderOrFail(t, ctx). With(&a, echo.Config{ Service: "a", Namespace: ns, Ports: ports, Galley: g, Pilot: p, }). With(&b, echo.Config{ Service: "b", Namespace: ns, Ports: ports, Galley: g, Pilot: p, }). BuildOrFail(t) newTestCase := func(path string, expectAllowed bool) TestCase { return TestCase{ Request: connection.Checker{ From: b, Options: echo.CallOptions{ Target: a, PortName: "http", Scheme: scheme.HTTP, Path: path, }, }, ExpectAllowed: expectAllowed, } } cases := []TestCase{ newTestCase("/public", true), newTestCase("/private", false), newTestCase("/public/../private", false), newTestCase("/public/./../private", false), newTestCase("/public/.././private", false), newTestCase("/public/%2E%2E/private", false), newTestCase("/public/%2e%2e/private", false), newTestCase("/public/%2E/%2E%2E/private", false), newTestCase("/public/%2e/%2e%2e/private", false), newTestCase("/public/%2E%2E/%2E/private", false), newTestCase("/public/%2e%2e/%2e/private", false), } args := map[string]string{ "Namespace": ns.Name(), } policies := tmpl.EvaluateAllOrFail(t, args, file.AsStringOrFail(t, rbacClusterConfigTmpl), file.AsStringOrFail(t, "testdata/v1-policy-path.yaml.tmpl")) g.ApplyConfigOrFail(t, ns, policies...) defer g.DeleteConfigOrFail(t, ns, policies...) RunRBACTest(t, cases) }) }
explode_data.jsonl/60540
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 948 }
[ 2830, 3393, 53, 16, 66388, 1155, 353, 8840, 836, 8, 341, 1166, 5794, 7121, 2271, 1155, 4292, 197, 197, 46961, 12723, 67591, 11352, 3760, 4292, 197, 85952, 18552, 7502, 12626, 8787, 1972, 8, 341, 298, 84041, 1669, 4473, 7121, 46059, 1155...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestFormatDuration(t *testing.T) { s := formatDuration(time.Second, ",", 3) assert.Equal(t, "00:00:01,000", s) s = formatDuration(time.Second, ",", 2) assert.Equal(t, "00:00:01,00", s) s = formatDuration(time.Millisecond, ",", 3) assert.Equal(t, "00:00:00,001", s) s = formatDuration(10*time.Millisecond, ".", 3) assert.Equal(t, "00:00:00.010", s) s = formatDuration(100*time.Millisecond, ",", 3) assert.Equal(t, "00:00:00,100", s) s = formatDuration(time.Second+234*time.Millisecond, ",", 3) assert.Equal(t, "00:00:01,234", s) s = formatDuration(12*time.Second+345*time.Millisecond, ",", 3) assert.Equal(t, "00:00:12,345", s) s = formatDuration(2*time.Minute+3*time.Second+456*time.Millisecond, ",", 3) assert.Equal(t, "00:02:03,456", s) s = formatDuration(20*time.Minute+34*time.Second+567*time.Millisecond, ",", 3) assert.Equal(t, "00:20:34,567", s) s = formatDuration(3*time.Hour+25*time.Minute+45*time.Second+678*time.Millisecond, ",", 3) assert.Equal(t, "03:25:45,678", s) s = formatDuration(34*time.Hour+17*time.Minute+36*time.Second+789*time.Millisecond, ",", 3) assert.Equal(t, "34:17:36,789", s) }
explode_data.jsonl/13622
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 519 }
[ 2830, 3393, 4061, 12945, 1155, 353, 8840, 836, 8, 341, 1903, 1669, 3561, 12945, 9730, 32435, 11, 82978, 220, 18, 340, 6948, 12808, 1155, 11, 330, 15, 15, 25, 15, 15, 25, 15, 16, 11, 15, 15, 15, 497, 274, 340, 1903, 284, 3561, 12...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestToJSON(t *testing.T) { t.Parallel() for _, tc := range testcases { if result := ToJSON(tc.input); result != tc.expected { t.Errorf("Expected %v, got %v", tc.expected, result) } } }
explode_data.jsonl/81874
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 82 }
[ 2830, 3393, 1249, 5370, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 2822, 2023, 8358, 17130, 1669, 2088, 1273, 23910, 341, 197, 743, 1102, 1669, 2014, 5370, 44415, 10046, 1215, 1102, 961, 17130, 56835, 341, 298, 3244, 13080, 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 ]
3
func Test_noCacheHeaders(t *testing.T) { upstreamServer := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { _, err := w.Write([]byte("upstream")) if err != nil { t.Error(err) } })) t.Cleanup(upstreamServer.Close) opts := baseTestOptions() opts.UpstreamServers = options.UpstreamConfig{ Upstreams: []options.Upstream{ { ID: upstreamServer.URL, Path: "/", URI: upstreamServer.URL, }, }, } opts.SkipAuthRegex = []string{".*"} err := validation.Validate(opts) assert.NoError(t, err) proxy, err := NewOAuthProxy(opts, func(_ string) bool { return true }) if err != nil { t.Fatal(err) } t.Run("not exist in response from upstream", func(t *testing.T) { rec := httptest.NewRecorder() req := httptest.NewRequest(http.MethodGet, "/upstream", nil) proxy.ServeHTTP(rec, req) assert.Equal(t, http.StatusOK, rec.Code) assert.Equal(t, "upstream", rec.Body.String()) // checking noCacheHeaders does not exists in response headers from upstream for k := range noCacheHeaders { assert.Equal(t, "", rec.Header().Get(k)) } }) t.Run("has no-cache", func(t *testing.T) { tests := []struct { path string hasNoCache bool }{ { path: "/oauth2/sign_in", hasNoCache: true, }, { path: "/oauth2/sign_out", hasNoCache: true, }, { path: "/oauth2/start", hasNoCache: true, }, { path: "/oauth2/callback", hasNoCache: true, }, { path: "/oauth2/auth", hasNoCache: false, }, { path: "/oauth2/userinfo", hasNoCache: true, }, { path: "/upstream", hasNoCache: false, }, } for _, tt := range tests { t.Run(tt.path, func(t *testing.T) { rec := httptest.NewRecorder() req := httptest.NewRequest(http.MethodGet, tt.path, nil) proxy.ServeHTTP(rec, req) cacheControl := rec.Result().Header.Get("Cache-Control") if tt.hasNoCache != (strings.Contains(cacheControl, "no-cache")) { t.Errorf(`unexpected "Cache-Control" header: %s`, cacheControl) } }) } }) }
explode_data.jsonl/36422
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 974 }
[ 2830, 3393, 6536, 8233, 10574, 1155, 353, 8840, 836, 8, 341, 59810, 4027, 5475, 1669, 54320, 70334, 7121, 5475, 19886, 89164, 18552, 3622, 1758, 37508, 11, 435, 353, 1254, 9659, 8, 341, 197, 197, 6878, 1848, 1669, 289, 4073, 10556, 3782...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestReadLayeredYAMLs(t *testing.T) { testDataDir := filepath.Join(env.IstioSrc, "operator/pkg/util/testdata/yaml") tests := []struct { name string overlays []string wantErr bool stdin bool }{ { name: "layer1", overlays: []string{"yaml_layer1"}, wantErr: false, }, { name: "layer1_stdin", overlays: []string{"yaml_layer1"}, wantErr: false, stdin: true, }, { name: "layer1_2", overlays: []string{"yaml_layer1", "yaml_layer2"}, wantErr: false, }, { name: "layer1_2_3", overlays: []string{"yaml_layer1", "yaml_layer2", "yaml_layer3"}, wantErr: false, }, } for _, tt := range tests { t.Run(fmt.Sprintf("%s stdin=%v", tt.name, tt.stdin), func(t *testing.T) { inDir := filepath.Join(testDataDir, "input") outPath := filepath.Join(testDataDir, "output", tt.name+".yaml") wantBytes, err := ioutil.ReadFile(outPath) want := string(wantBytes) if err != nil { t.Errorf("ioutil.ReadFile() error = %v, filename: %v", err, outPath) } stdinReader := &bytes.Buffer{} var filenames []string for _, ol := range tt.overlays { filename := filepath.Join(inDir, ol+".yaml") if tt.stdin { b, err := ioutil.ReadFile(filename) if err != nil { t.Fatalf("ioutil.ReadFile() error = %v, filenaem: %v", err, filename) } if _, err := stdinReader.Write(b); err != nil { t.Fatalf("failed to populate fake sdtin") } filenames = append(filenames, "-") } else { filenames = append(filenames, filename) } } got, err := readLayeredYAMLs(filenames, stdinReader) if (err != nil) != tt.wantErr { t.Errorf("ReadLayeredYAMLs() error = %v, wantErr %v", err, tt.wantErr) return } if util.YAMLDiff(got, want) != "" { t.Errorf("ReadLayeredYAMLs() got = %v, want %v", got, want) } }) } }
explode_data.jsonl/72357
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 919 }
[ 2830, 3393, 4418, 9188, 291, 56, 31102, 82, 1155, 353, 8840, 836, 8, 341, 18185, 1043, 6184, 1669, 26054, 22363, 16978, 2447, 267, 815, 20360, 11, 330, 7884, 22523, 22610, 12697, 691, 26491, 9467, 1138, 78216, 1669, 3056, 1235, 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...
8
func TestJob_record(t *testing.T) { type fields struct { session session.ServiceFormatter info Response } type args struct { fields []string values []string } tests := []struct { name string fields fields args args want map[string]string }{ { name: "make record", fields: fields{}, args: args{ fields: []string{ "first", "last", "DOB", }, values: []string{ "john", "doe", "1/1/1970", }, }, want: map[string]string{ "first": "john", "last": "doe", "DOB": "1/1/1970", }, }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { j := &Job{ session: tt.fields.session, info: tt.fields.info, } if got := j.record(tt.args.fields, tt.args.values); !reflect.DeepEqual(got, tt.want) { t.Errorf("Job.record() = %v, want %v", got, tt.want) } }) } }
explode_data.jsonl/19876
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 454 }
[ 2830, 3393, 12245, 14192, 1155, 353, 8840, 836, 8, 341, 13158, 5043, 2036, 341, 197, 25054, 3797, 13860, 14183, 198, 197, 27043, 262, 5949, 198, 197, 532, 13158, 2827, 2036, 341, 197, 55276, 3056, 917, 198, 197, 45939, 3056, 917, 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...
2
func TestMissingUserConfig(t *testing.T) { plugin := Plugin{ Config: Config{ Token: "123456789", }, } err := plugin.Exec() assert.NotNil(t, err) }
explode_data.jsonl/17927
{ "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, 25080, 1474, 2648, 1155, 353, 8840, 836, 8, 341, 197, 9138, 1669, 21245, 515, 197, 66156, 25, 5532, 515, 298, 33299, 25, 330, 16, 17, 18, 19, 20, 21, 22, 23, 24, 756, 197, 197, 1583, 197, 630, 9859, 1669, 9006, 30798, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestAnalogSensorDriverHalt(t *testing.T) { d := NewAnalogSensorDriver(newAioTestAdaptor(), "1") done := make(chan struct{}) go func() { <-d.halt close(done) }() gobottest.Assert(t, d.Halt(), nil) select { case <-done: case <-time.After(100 * time.Millisecond): t.Errorf("AnalogSensor was not halted") } }
explode_data.jsonl/911
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 135 }
[ 2830, 3393, 2082, 30951, 30752, 11349, 39, 3145, 1155, 353, 8840, 836, 8, 341, 2698, 1669, 1532, 2082, 30951, 30752, 11349, 1755, 32, 815, 2271, 2589, 32657, 1507, 330, 16, 1138, 40495, 1669, 1281, 35190, 2036, 37790, 30680, 2915, 368, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestRun(t *testing.T) { cases := []struct { name string args []string verbose bool outJSON bool minComplexity int top int excludeDirs []string want string code int }{ { name: "increment for breaks in the linear flow", args: []string{"../../testdata/a.go"}, minComplexity: 1, top: 10, want: "../../testdata/a.go:9:2: `if b1` is deeply nested (complexity: 1)\n", code: 0, }, { name: "show only top 2", args: []string{"../../testdata/d.go"}, minComplexity: 1, top: 2, want: "../../testdata/d.go:16:2: `if b1` is deeply nested (complexity: 3)\n../../testdata/d.go:6:2: `if b1` is deeply nested (complexity: 1)\n", code: 0, }, { name: "show only those with complexity of 2 or more", args: []string{"../../testdata/d.go"}, minComplexity: 2, top: 10, want: "../../testdata/d.go:16:2: `if b1` is deeply nested (complexity: 3)\n", code: 0, }, { name: "ignore generated file", args: []string{"../../testdata/generated.go"}, minComplexity: 1, top: 10, want: "", code: 0, }, { name: "directory given", args: []string{"../../testdata/a"}, minComplexity: 1, top: 10, want: "../../testdata/a/a.go:8:2: `if b1` is deeply nested (complexity: 1)\n", code: 0, }, { name: "Check files recursively", args: []string{"../../testdata/a/..."}, minComplexity: 1, top: 10, want: "../../testdata/a/a.go:8:2: `if b1` is deeply nested (complexity: 1)\n../../testdata/a/b/a.go:8:2: `if b1` is deeply nested (complexity: 1)\n", code: 0, }, { name: "Check all files recursively", verbose: true, args: []string{"./..."}, minComplexity: 1, top: 10, want: "", code: 0, }, { name: "no args given", verbose: true, args: []string{}, minComplexity: 1, top: 10, want: "", code: 0, }, { name: "package name given", args: []string{"github.com/nakabonne/nestif/testdata/a"}, minComplexity: 1, top: 10, want: func() string { path, _ := filepath.Abs("../../testdata/a/a.go") return path + ":8:2: `if b1` is deeply nested (complexity: 1)\n" }(), code: 0, }, { name: "json output", outJSON: true, args: []string{"../../testdata/a.go"}, minComplexity: 1, top: 10, want: "[{\"Pos\":{\"Filename\":\"../../testdata/a.go\",\"Offset\":78,\"Line\":9,\"Column\":2},\"Complexity\":1,\"Message\":\"`if b1` is deeply nested (complexity: 1)\"}]\n", code: 0, }, { name: "exclude-dirs given", args: []string{"../../testdata"}, minComplexity: 1, top: 10, excludeDirs: []string{"../../testdata"}, want: "", code: 0, }, { name: "wrong exclude-dirs given", args: []string{"../../testdata"}, minComplexity: 1, top: 10, excludeDirs: []string{"(^|/../../testdata"}, want: "failed to parse exclude dir pattern: error parsing regexp: missing closing ): `(^|/../../testdata`\n", code: 1, }, } for _, tc := range cases { t.Run(tc.name, func(t *testing.T) { b := new(bytes.Buffer) a := app{ verbose: tc.verbose, outJSON: tc.outJSON, minComplexity: tc.minComplexity, top: tc.top, excludeDirs: tc.excludeDirs, stdout: b, stderr: b, } c := a.run(tc.args) assert.Equal(t, tc.code, c) assert.Equal(t, tc.want, b.String()) }) } }
explode_data.jsonl/75157
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 2232 }
[ 2830, 3393, 6727, 1155, 353, 8840, 836, 8, 341, 1444, 2264, 1669, 3056, 1235, 341, 197, 11609, 688, 914, 198, 197, 31215, 688, 3056, 917, 198, 197, 197, 14883, 981, 1807, 198, 197, 13967, 5370, 981, 1807, 198, 197, 25320, 31137, 487, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestBlackHoleAddress(t *testing.T) { addr := BlackHoleAddress() a := addr.String() fmt.Println(a) require.Equal(t, addr.String(), "okexchain1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqupa6dx") }
explode_data.jsonl/61604
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 82 }
[ 2830, 3393, 14417, 39, 1263, 4286, 1155, 353, 8840, 836, 8, 341, 53183, 1669, 5235, 39, 1263, 4286, 741, 11323, 1669, 10789, 6431, 741, 11009, 12419, 2877, 340, 17957, 12808, 1155, 11, 10789, 6431, 1507, 330, 562, 327, 8819, 16, 27579, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
func Test_CreateTable_Migration_AutoAddColumns(t *testing.T) { // #TODO(kishorevaishnav): There is some problem with the below code. f1 := flag.NewFlagSet("f1", flag.ContinueOnError) var autoAddColumns string f1.StringVar(&autoAddColumns, "autoAddColumns", "id:int created_at:datetime modified_at:datetime", "-------") err := f1.Parse([]string{"autoAddColumns"}) if err != nil { fmt.Println(autoAddColumns) fmt.Println(err) } // initializeDefaults() argsss := []string{"add", "ct", "test123", "first:int", "second:string"} fileName, mm, _ := generateMigration(argsss) expectedString := `{"id":"` + getID(fileName) + `","up":{"createTable":[{"tableName":"test123","columns":[{"fieldname":"first","datatype":"int"},{"fieldname":"second","datatype":"string"}]}]},"down":{"dropTable":[{"tableName":"test123"}]}}` content1, _ := json.Marshal(mm) checkError(t, expectedString, string(content1)) }
explode_data.jsonl/22633
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 321 }
[ 2830, 3393, 34325, 2556, 1245, 5033, 1566, 1535, 2212, 13965, 1155, 353, 8840, 836, 8, 341, 197, 322, 671, 14732, 5969, 812, 460, 6586, 812, 3722, 1648, 2619, 374, 1045, 3491, 448, 279, 3685, 2038, 624, 1166, 16, 1669, 5181, 7121, 121...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestCastCoer(t *testing.T) { store, clean := testkit.CreateMockStore(t) defer clean() tk := testkit.NewTestKit(t, store) tk.MustQuery("select coercibility(binary('a'))").Check(testkit.Rows("2")) tk.MustQuery("select coercibility(cast('a' as char(10)))").Check(testkit.Rows("2")) tk.MustQuery("select coercibility(convert('abc', char(10)));").Check(testkit.Rows("2")) }
explode_data.jsonl/65569
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 142 }
[ 2830, 3393, 18714, 7339, 261, 1155, 353, 8840, 836, 8, 341, 57279, 11, 4240, 1669, 1273, 8226, 7251, 11571, 6093, 1155, 340, 16867, 4240, 2822, 3244, 74, 1669, 1273, 8226, 7121, 2271, 7695, 1155, 11, 3553, 692, 3244, 74, 50463, 2859, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestRemoveString(t *testing.T) { slice1 := []string{"val1", "val2", "val3"} slice2 := []string{"val1", "val2", "val3", "val1"} slice3 := []string{"val1", "val2", "val1", "val3"} slice4 := []string{"val2", "val1", "val1", "val3"} tests := map[string]struct { actual []string removeValue string expected []string }{ "value is at start": {slice1, "val1", []string{"val2", "val3"}}, "value is at end": {slice1, "val3", []string{"val1", "val2"}}, "value is in between": {slice1, "val2", []string{"val1", "val3"}}, "value is twice at start & end": {slice2, "val1", []string{"val2", "val3"}}, "value is twice at start & between": {slice3, "val1", []string{"val2", "val3"}}, "value is twice in between": {slice4, "val1", []string{"val2", "val3"}}, "nil array and non empty value": {nil, "val1", nil}, "empty string to be removed": {slice1, "", slice1}, "nil array and empty string": {nil, "", nil}, } for name, test := range tests { // pinning the values name := name test := test t.Run(name, func(t *testing.T) { newSlice := RemoveString(test.actual, test.removeValue) if !reflect.DeepEqual(newSlice, test.expected) { t.Fatalf(" failed to test RemoveString: expected slice '%v': actual slice '%v'", test.expected, newSlice) } }) } }
explode_data.jsonl/44193
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 591 }
[ 2830, 3393, 13021, 703, 1155, 353, 8840, 836, 8, 341, 1903, 4754, 16, 1669, 3056, 917, 4913, 831, 16, 497, 330, 831, 17, 497, 330, 831, 18, 16707, 1903, 4754, 17, 1669, 3056, 917, 4913, 831, 16, 497, 330, 831, 17, 497, 330, 831, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestGetBulkState(t *testing.T) { fakeStore := &daprt.MockStateStore{} fakeStore.On("Get", mock.MatchedBy(func(req *state.GetRequest) bool { return req.Key == "fakeAPI||good-key" })).Return( &state.GetResponse{ Data: []byte("test-data"), ETag: "test-etag", }, nil) fakeStore.On("Get", mock.MatchedBy(func(req *state.GetRequest) bool { return req.Key == "fakeAPI||error-key" })).Return( nil, errors.New("failed to get state with error-key")) fakeAPI := &api{ id: "fakeAPI", stateStores: map[string]state.Store{"store1": fakeStore}, } port, _ := freeport.GetFreePort() server := startDaprAPIServer(port, fakeAPI, "") defer server.Stop() clientConn := createTestClient(port) defer clientConn.Close() client := runtimev1pb.NewDaprClient(clientConn) testCases := []struct { testName string storeName string keys []string errorExcepted bool expectedResponse []*runtimev1pb.BulkStateItem expectedError codes.Code }{ { testName: "get state", storeName: "store1", keys: []string{"good-key", "good-key"}, errorExcepted: false, expectedResponse: []*runtimev1pb.BulkStateItem{ { Data: []byte("test-data"), Etag: "test-etag", }, { Data: []byte("test-data"), Etag: "test-etag", }, }, expectedError: codes.OK, }, { testName: "get store with non-existing store", storeName: "no-store", keys: []string{"good-key", "good-key"}, errorExcepted: true, expectedResponse: []*runtimev1pb.BulkStateItem{}, expectedError: codes.InvalidArgument, }, { testName: "get store with key but error occurs", storeName: "store1", keys: []string{"error-key", "error-key"}, errorExcepted: false, expectedResponse: []*runtimev1pb.BulkStateItem{ { Error: "failed to get state with error-key", }, { Error: "failed to get state with error-key", }, }, expectedError: codes.OK, }, { testName: "get store with empty keys", storeName: "store1", keys: []string{}, errorExcepted: false, expectedResponse: []*runtimev1pb.BulkStateItem{}, expectedError: codes.OK, }, } for _, tt := range testCases { t.Run(tt.testName, func(t *testing.T) { req := &runtimev1pb.GetBulkStateRequest{ StoreName: tt.storeName, Keys: tt.keys, } resp, err := client.GetBulkState(context.Background(), req) if !tt.errorExcepted { assert.NoError(t, err, "Expected no error") if len(tt.expectedResponse) == 0 { assert.Equal(t, len(resp.Items), 0, "Expected response to be empty") } else { for i := 0; i < len(resp.Items); i++ { if tt.expectedResponse[i].Error == "" { assert.Equal(t, resp.Items[i].Data, tt.expectedResponse[i].Data, "Expected response Data to be same") assert.Equal(t, resp.Items[i].Etag, tt.expectedResponse[i].Etag, "Expected response Etag to be same") } else { assert.Equal(t, resp.Items[i].Error, tt.expectedResponse[i].Error, "Expected response error to be same") } } } } else { assert.Error(t, err, "Expected error") assert.Equal(t, tt.expectedError, status.Code(err)) } }) } }
explode_data.jsonl/21735
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1490 }
[ 2830, 3393, 1949, 88194, 1397, 1155, 353, 8840, 836, 8, 341, 1166, 726, 6093, 1669, 609, 91294, 3342, 24664, 1397, 6093, 16094, 1166, 726, 6093, 8071, 445, 1949, 497, 7860, 1321, 34244, 1359, 18552, 6881, 353, 2454, 2234, 1900, 8, 1807,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestNullBoolParam(t *testing.T) { spec := nullTestSpec{"nullbool", "bool", [6]nullTestRow{ {NullBool{false, true}, true, NullBool{false, true}}, {NullBool{true, false}, false, NullBool{false, false}}, {true, true, NullBool{true, true}}, {NullBool{true, true}, false, NullBool{true, true}}, {NullBool{true, false}, true, NullBool{false, false}}, {true, NullBool{true, false}, nil}, }} nullTestRun(t, spec) }
explode_data.jsonl/15997
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 175 }
[ 2830, 3393, 3280, 11233, 2001, 1155, 353, 8840, 836, 8, 341, 98100, 1669, 845, 2271, 8327, 4913, 2921, 2641, 497, 330, 2641, 497, 508, 21, 60, 2921, 2271, 3102, 515, 197, 197, 90, 3280, 11233, 90, 3849, 11, 830, 2137, 830, 11, 18084...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestTtlState_ToMetricState(t *testing.T) { Convey("ToMetricState test", t, func() { So(TTLStateDEL.ToMetricState(), ShouldResemble, StateNODATA) So(TTLStateOK.ToMetricState(), ShouldResemble, StateOK) So(TTLStateWARN.ToMetricState(), ShouldResemble, StateWARN) So(TTLStateERROR.ToMetricState(), ShouldResemble, StateERROR) So(TTLStateNODATA.ToMetricState(), ShouldResemble, StateNODATA) }) }
explode_data.jsonl/81005
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 161 }
[ 2830, 3393, 51, 11544, 1397, 38346, 54310, 1397, 1155, 353, 8840, 836, 8, 341, 93070, 5617, 445, 1249, 54310, 1397, 1273, 497, 259, 11, 2915, 368, 341, 197, 76912, 4140, 13470, 1397, 38332, 3274, 54310, 1397, 1507, 12260, 1061, 91629, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestSortKey(t *testing.T) { r := Response{ Star: 101, Watch: 102, Fork: 103, Issues: 104, } assert.Equal(t, r.sortingValue(keyStar), 101) assert.Equal(t, r.sortingValue(keyWatch), 102) assert.Equal(t, r.sortingValue(keyFork), 103) assert.Equal(t, r.sortingValue(keyIssues), 104) }
explode_data.jsonl/46805
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 141 }
[ 2830, 3393, 10231, 1592, 1155, 353, 8840, 836, 8, 1476, 7000, 1669, 5949, 515, 197, 197, 12699, 25, 256, 220, 16, 15, 16, 345, 197, 197, 14247, 25, 220, 220, 16, 15, 17, 345, 197, 12727, 669, 25, 256, 220, 16, 15, 18, 345, 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 TestPlain_Render(t *testing.T) { ctrl := gomock.NewController(t) defer ctrl.Finish() response := mock.NewMockHttpWrapResponseWriter(ctrl) response.EXPECT().WriteHeader(200) protocol := mock.NewMockHttpProtocol(ctrl) protocol.EXPECT().SetHeader(`Content-Type`, `text/plain`) protocol.EXPECT().ResponseWriter().Return(response) protocol.EXPECT().Write([]byte(`text`)).Return(len([]byte(`text`)), nil) err := Plain.Render(protocol, 200, `text`) response.EXPECT().WriteHeader(200) protocol.EXPECT().SetHeader(`Content-Type`, `text/plain`) protocol.EXPECT().ResponseWriter().Return(response) protocol.EXPECT().Write([]byte(`text`)).Return(len([]byte(`text`)), nil) err1 := Plain.Render(protocol, 200, []byte(`text`)) assert.Nil(t, err) assert.Nil(t, err1) }
explode_data.jsonl/42556
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 290 }
[ 2830, 3393, 26982, 42102, 1155, 353, 8840, 836, 8, 341, 84381, 1669, 342, 316, 1176, 7121, 2051, 1155, 340, 16867, 23743, 991, 18176, 741, 21735, 1669, 7860, 7121, 11571, 2905, 26787, 2582, 6492, 62100, 340, 21735, 22402, 7285, 1005, 7985...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestIngest(t *testing.T) { var mem vfs.FS var d *DB defer func() { require.NoError(t, d.Close()) }() reset := func() { if d != nil { require.NoError(t, d.Close()) } mem = vfs.NewMem() require.NoError(t, mem.MkdirAll("ext", 0755)) var err error d, err = Open("", &Options{ FS: mem, L0CompactionThreshold: 100, L0StopWritesThreshold: 100, DebugCheck: DebugCheckLevels, }) require.NoError(t, err) } reset() datadriven.RunTest(t, "testdata/ingest", func(td *datadriven.TestData) string { switch td.Cmd { case "reset": reset() return "" case "batch": b := d.NewIndexedBatch() if err := runBatchDefineCmd(td, b); err != nil { return err.Error() } if err := b.Commit(nil); err != nil { return err.Error() } return "" case "build": if err := runBuildCmd(td, d, mem); err != nil { return err.Error() } return "" case "ingest": if err := runIngestCmd(td, d, mem); err != nil { return err.Error() } return "" case "get": return runGetCmd(td, d) case "iter": iter := d.NewIter(nil) defer iter.Close() return runIterCmd(td, iter) case "lsm": return runLSMCmd(td, d) default: return fmt.Sprintf("unknown command: %s", td.Cmd) } }) }
explode_data.jsonl/40260
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 613 }
[ 2830, 3393, 641, 6969, 1155, 353, 8840, 836, 8, 341, 2405, 1833, 92941, 991, 50, 198, 2405, 294, 353, 3506, 198, 16867, 2915, 368, 341, 197, 17957, 35699, 1155, 11, 294, 10421, 2398, 197, 66816, 70343, 1669, 2915, 368, 341, 197, 743, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func Test_components(t *testing.T) { type args struct { cfg model.ClusterConfigurationEntity } tests := []struct { name string args args want []keb.Component }{ { name: "nil", args: args{}, want: []keb.Component{}, }, { name: "empty", args: args{ cfg: model.ClusterConfigurationEntity{}, }, want: []keb.Component{}, }, { name: "some", args: args{ cfg: model.ClusterConfigurationEntity{ Components: []*keb.Component{ { Component: "a1", URL: "a1", Version: "a1", }, }, }, }, want: []keb.Component{ { URL: "a1", Component: "a1", Version: "a1", }, }, }, } for i := range tests { tt := tests[i] t.Run(tt.name, func(t *testing.T) { if got := components(tt.args.cfg); !reflect.DeepEqual(got, tt.want) { t.Errorf("components() = %v, want %v", got, tt.want) } }) } }
explode_data.jsonl/74505
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 482 }
[ 2830, 3393, 23258, 1155, 353, 8840, 836, 8, 341, 13158, 2827, 2036, 341, 197, 50286, 1614, 72883, 7688, 3030, 198, 197, 532, 78216, 1669, 3056, 1235, 341, 197, 11609, 914, 198, 197, 31215, 2827, 198, 197, 50780, 3056, 440, 65, 5119, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestGetAccountAssetBalance(t *testing.T) { t.Parallel() if !areTestAPIKeysSet() { t.Skip("API keys required but not set, skipping test") } _, err := c.GetAccountAssetBalance(currency.BTC.String()) if err != nil { t.Error(err) } }
explode_data.jsonl/42925
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 92 }
[ 2830, 3393, 1949, 7365, 16604, 21190, 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 TestGetActiveLogIDs(t *testing.T) { ctx := context.Background() cleanTestDB(t, db) admin := NewAdminStorage(db) // Create a few test trees log1 := proto.Clone(testonly.LogTree).(*trillian.Tree) // nolint: errcheck, forcetypeassert log2 := proto.Clone(testonly.LogTree).(*trillian.Tree) // nolint: errcheck, forcetypeassert log3 := proto.Clone(testonly.PreorderedLogTree).(*trillian.Tree) // nolint: errcheck, forcetypeassert drainingLog := proto.Clone(testonly.LogTree).(*trillian.Tree) // nolint: errcheck, forcetypeassert frozenLog := proto.Clone(testonly.LogTree).(*trillian.Tree) // nolint: errcheck, forcetypeassert deletedLog := proto.Clone(testonly.LogTree).(*trillian.Tree) // nolint: errcheck, forcetypeassert for _, tree := range []**trillian.Tree{&log1, &log2, &log3, &drainingLog, &frozenLog, &deletedLog} { newTree, err := storage.CreateTree(ctx, admin, *tree) if err != nil { t.Fatalf("CreateTree(%+v) returned err = %v", tree, err) } *tree = newTree } // FROZEN is not a valid initial state, so we have to update it separately. if _, err := storage.UpdateTree(ctx, admin, frozenLog.TreeId, func(t *trillian.Tree) { t.TreeState = trillian.TreeState_FROZEN }); err != nil { t.Fatalf("UpdateTree() returned err = %v", err) } // DRAINING is not a valid initial state, so we have to update it separately. if _, err := storage.UpdateTree(ctx, admin, drainingLog.TreeId, func(t *trillian.Tree) { t.TreeState = trillian.TreeState_DRAINING }); err != nil { t.Fatalf("UpdateTree() returned err = %v", err) } // Update deleted trees accordingly updateDeletedStmt, err := db.PrepareContext(ctx, "UPDATE Trees SET Deleted = $1 WHERE Tree_Id = $2") if err != nil { t.Fatalf("PrepareContext() returned err = %v", err) } defer updateDeletedStmt.Close() // nolint: errcheck for _, treeID := range []int64{deletedLog.TreeId} { if _, err = updateDeletedStmt.ExecContext(ctx, true, treeID); err != nil { t.Fatalf("ExecContext(%v) returned err = %v", treeID, err) } } s := NewLogStorage(db, nil) tx, err := s.Snapshot(ctx) if err != nil { t.Fatalf("Snapshot() returns err = %v", err) } defer tx.Close() // nolint: errcheck got, err := tx.GetActiveLogIDs(ctx) if err != nil { t.Fatalf("GetActiveLogIDs() returns err = %v", err) } if err := tx.Commit(ctx); err != nil { t.Errorf("Commit() returned err = %v", err) } want := []int64{log1.TreeId, log2.TreeId, log3.TreeId, drainingLog.TreeId} sort.Slice(got, func(i, j int) bool { return got[i] < got[j] }) sort.Slice(want, func(i, j int) bool { return want[i] < want[j] }) if diff := cmp.Diff(got, want); diff != "" { t.Errorf("post-GetActiveLogIDs diff (-got +want):\n%v", diff) } }
explode_data.jsonl/30703
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1071 }
[ 2830, 3393, 1949, 5728, 2201, 30466, 1155, 353, 8840, 836, 8, 341, 20985, 1669, 2266, 19047, 2822, 1444, 2675, 2271, 3506, 1155, 11, 2927, 340, 64394, 1669, 1532, 7210, 5793, 9791, 692, 197, 322, 4230, 264, 2421, 1273, 12408, 198, 6725,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestSync(t *testing.T) { pVclusterService := corev1.Service{ ObjectMeta: metav1.ObjectMeta{ Name: generictesting.DefaultTestVclusterServiceName, Namespace: generictesting.DefaultTestCurrentNamespace, }, Spec: corev1.ServiceSpec{ ClusterIP: "1.2.3.4", }, } translate.Suffix = generictesting.DefaultTestVclusterName pDNSService := corev1.Service{ ObjectMeta: metav1.ObjectMeta{ Name: translate.PhysicalName("kube-dns", "kube-system"), Namespace: generictesting.DefaultTestTargetNamespace, }, Spec: corev1.ServiceSpec{ ClusterIP: "2.2.2.2", }, } vNamespace := corev1.Namespace{ ObjectMeta: metav1.ObjectMeta{ Name: "testns", }, } vObjectMeta := metav1.ObjectMeta{ Name: "testpod", Namespace: vNamespace.Name, } pObjectMeta := metav1.ObjectMeta{ Name: translate.PhysicalName("testpod", "testns"), Namespace: "test", Annotations: map[string]string{ podtranslate.ClusterAutoScalerAnnotation: "false", podtranslate.LabelsAnnotation: "", podtranslate.NameAnnotation: vObjectMeta.Name, podtranslate.NamespaceAnnotation: vObjectMeta.Namespace, translator.NameAnnotation: vObjectMeta.Name, translator.NamespaceAnnotation: vObjectMeta.Namespace, podtranslate.ServiceAccountNameAnnotation: "", podtranslate.UIDAnnotation: string(vObjectMeta.UID), }, Labels: map[string]string{ translate.NamespaceLabel: vObjectMeta.Namespace, translate.MarkerLabel: translate.Suffix, }, } pPodBase := &corev1.Pod{ ObjectMeta: pObjectMeta, Spec: corev1.PodSpec{ AutomountServiceAccountToken: pointer.Bool(false), EnableServiceLinks: pointer.Bool(false), HostAliases: []corev1.HostAlias{{ IP: pVclusterService.Spec.ClusterIP, Hostnames: []string{"kubernetes", "kubernetes.default", "kubernetes.default.svc"}, }}, Hostname: vObjectMeta.Name, }, } vPodWithNodeName := &corev1.Pod{ ObjectMeta: vObjectMeta, Spec: corev1.PodSpec{ NodeName: "test123", }, } pPodWithNodeName := pPodBase.DeepCopy() pPodWithNodeName.Spec.NodeName = "test456" vPodWithNodeSelector := &corev1.Pod{ ObjectMeta: vObjectMeta, Spec: corev1.PodSpec{ NodeSelector: map[string]string{ "labelA": "valueA", "labelB": "valueB", }, }, } nodeSelectorOption := "labelB=enforcedB,otherLabel=abc" pPodWithNodeSelector := pPodBase.DeepCopy() pPodWithNodeSelector.Spec.NodeSelector = map[string]string{ "labelA": "valueA", "labelB": "enforcedB", "otherLabel": "abc", } generictesting.RunTests(t, []*generictesting.SyncTest{ { Name: "Delete virtual pod", InitialVirtualState: []runtime.Object{vPodWithNodeName.DeepCopy()}, InitialPhysicalState: []runtime.Object{pPodWithNodeName}, ExpectedVirtualState: map[schema.GroupVersionKind][]runtime.Object{ corev1.SchemeGroupVersion.WithKind("Pod"): {}, }, ExpectedPhysicalState: map[schema.GroupVersionKind][]runtime.Object{ corev1.SchemeGroupVersion.WithKind("Pod"): { pPodWithNodeName, }, }, Sync: func(ctx *synccontext.RegisterContext) { syncCtx, syncer := generictesting.FakeStartSyncer(t, ctx, New) _, err := syncer.(*podSyncer).Sync(syncCtx, pPodWithNodeName.DeepCopy(), vPodWithNodeName) assert.NilError(t, err) }, }, { Name: "Sync and enforce NodeSelector", InitialVirtualState: []runtime.Object{vPodWithNodeSelector.DeepCopy(), vNamespace.DeepCopy()}, InitialPhysicalState: []runtime.Object{pVclusterService.DeepCopy(), pDNSService.DeepCopy()}, ExpectedVirtualState: map[schema.GroupVersionKind][]runtime.Object{ corev1.SchemeGroupVersion.WithKind("Pod"): {vPodWithNodeSelector.DeepCopy()}, }, ExpectedPhysicalState: map[schema.GroupVersionKind][]runtime.Object{ corev1.SchemeGroupVersion.WithKind("Pod"): { pPodWithNodeSelector, }, }, Sync: func(ctx *synccontext.RegisterContext) { ctx.Options.EnforceNodeSelector = true ctx.Options.NodeSelector = nodeSelectorOption syncCtx, syncer := generictesting.FakeStartSyncer(t, ctx, New) _, err := syncer.(*podSyncer).SyncDown(syncCtx, vPodWithNodeSelector.DeepCopy()) assert.NilError(t, err) }, }, }) }
explode_data.jsonl/77147
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1821 }
[ 2830, 3393, 12154, 1155, 353, 8840, 836, 8, 341, 3223, 53, 18855, 1860, 1669, 6200, 85, 16, 13860, 515, 197, 23816, 12175, 25, 77520, 16, 80222, 515, 298, 21297, 25, 414, 1766, 849, 59855, 13275, 2271, 53, 18855, 1860, 675, 345, 298, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestActiveEndpoint_Reserve_AlreadyReady(t *testing.T) { k8s, kna := fakeClients() kna.ServingV1alpha1().Revisions(testNamespace).Create( newRevisionBuilder(defaultRevisionLabels). withReady(false). build()) k8s.CoreV1().Services(testNamespace).Create(newServiceBuilder().build()) a := NewRevisionActivator(k8s, kna, TestLogger(t)) rev, _ := kna.ServingV1alpha1().Revisions(testNamespace).Get(testRevision, metav1.GetOptions{}) rev.Status.MarkActive() rev.Status.MarkContainerHealthy() rev.Status.MarkResourcesAvailable() _, err := kna.ServingV1alpha1().Revisions(testNamespace).Update(rev) if err != nil { t.Fatalf("Error updating the revision %s: %v", testRevision, err) } ch := make(chan ActivationResult) go func() { ch <- a.ActiveEndpoint(testNamespace, testRevision) }() select { case ar := <-ch: want := Endpoint{testServiceFQDN, v1alpha1.DefaultUserPort} if ar.Endpoint != want { t.Errorf("Unexpected endpoint. Want %+v. Got %+v.", want, ar.Endpoint) } if ar.Status != http.StatusOK { t.Errorf("Unexpected error state. Want 0. Got %v.", ar.Status) } if ar.ServiceName != "test-service" { t.Errorf("Unexpected service name. Want test-service. Got %v.", ar.ServiceName) } if ar.ConfigurationName != "test-config" { t.Errorf("Unexpected configuration name. Want test-config. Got %v.", ar.ConfigurationName) } if ar.Error != nil { t.Errorf("Unexpected error. Want nil. Got %v.", ar.Error) } case <-time.After(3 * time.Second): t.Error("Expected result after revision ready @", time.Now()) } }
explode_data.jsonl/27257
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 589 }
[ 2830, 3393, 5728, 27380, 92815, 5852, 40812, 2307, 19202, 1155, 353, 8840, 836, 8, 341, 16463, 23, 82, 11, 1148, 64, 1669, 12418, 47174, 741, 16463, 3376, 808, 19505, 53, 16, 7141, 16, 1005, 693, 40015, 8623, 22699, 568, 4021, 1006, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestStorageKey_Hash(t *testing.T) { assertHash(t, []hashAssert{ {NewStorageKey([]byte{0, 42, 254}), MustHexDecodeString( "0x537db36f5b5970b679a28a3df8d219317d658014fb9c3d409c0c799d8ecf149d")}, {NewStorageKey([]byte{0, 0}), MustHexDecodeString( "0x9ee6dfb61a2fb903df487c401663825643bb825d41695e63df8af6162ab145a6")}, }) }
explode_data.jsonl/3063
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 171 }
[ 2830, 3393, 5793, 1592, 2039, 988, 1155, 353, 8840, 836, 8, 341, 6948, 6370, 1155, 11, 3056, 8296, 8534, 515, 197, 197, 90, 3564, 5793, 1592, 10556, 3782, 90, 15, 11, 220, 19, 17, 11, 220, 17, 20, 19, 38842, 15465, 20335, 32564, 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 TestStringPrimitive(t *testing.T) { const SCRIPT = ` var s = "test"; s[0] + s[2] + s[1]; ` testScript1(SCRIPT, asciiString("tse"), t) }
explode_data.jsonl/75265
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 68 }
[ 2830, 3393, 703, 33313, 1155, 353, 8840, 836, 8, 341, 4777, 53679, 284, 22074, 2405, 274, 284, 330, 1944, 876, 1903, 58, 15, 60, 488, 274, 58, 17, 60, 488, 274, 58, 16, 935, 197, 19324, 18185, 5910, 16, 7, 24787, 11, 47120, 703, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestGoogleChat_Post(t *testing.T) { ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { b, err := ioutil.ReadAll(r.Body) require.NoError(t, err) var payload = GoogleChatPayload{} err = json.Unmarshal(b, &payload) require.NoError(t, err) require.Equal(t, "gitrepository/webapp.gitops-system", payload.Cards[0].Header.Title) require.Equal(t, "source-controller", payload.Cards[0].Header.SubTitle) require.Equal(t, "message", payload.Cards[0].Sections[0].Widgets[0].TextParagraph.Text) require.Equal(t, "test", payload.Cards[0].Sections[1].Widgets[0].KeyValue.TopLabel) require.Equal(t, "metadata", payload.Cards[0].Sections[1].Widgets[0].KeyValue.Content) })) defer ts.Close() google_chat, err := NewGoogleChat(ts.URL, "") require.NoError(t, err) err = google_chat.Post(testEvent()) require.NoError(t, err) }
explode_data.jsonl/16321
{ "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, 14444, 15672, 66726, 1155, 353, 8840, 836, 8, 341, 57441, 1669, 54320, 70334, 7121, 5475, 19886, 89164, 18552, 3622, 1758, 37508, 11, 435, 353, 1254, 9659, 8, 341, 197, 2233, 11, 1848, 1669, 43144, 41851, 2601, 20934, 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...
1
func Test_Base(t *testing.T) { endpoint := os.Getenv("ETCD_ENDPOINT") if endpoint == "" { t.Error("not found env ETCD_ENDPOINT or ETCD_ENDPOINT is empty string") return } fmt.Printf("endpoint=[%s]\n", endpoint) Init(endpoint) defer Close() key := util.GenRandomString(16) value := util.GenRandomString(16) _, err := put(key, value) if err != nil { t.Error(err) return } fmt.Printf("put key=[%s], value=[%s]\n", key, value) resp, err := get(key) if err != nil { t.Error(err) return } for _, kv := range resp.Kvs { fmt.Printf("get key=[%s], value=[%s]\n", kv.Key, kv.Value) } if _, err := delete_(key); err != nil { t.Error(err) } else { fmt.Printf("delete key=[%s]\n", key) } }
explode_data.jsonl/27600
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 330 }
[ 2830, 3393, 33982, 1155, 353, 8840, 836, 8, 341, 6246, 2768, 1669, 2643, 64883, 445, 1348, 6484, 48756, 1138, 743, 14887, 621, 1591, 341, 197, 3244, 6141, 445, 1921, 1730, 6105, 17768, 6484, 48756, 476, 17768, 6484, 48756, 374, 4287, 91...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestIsEqValidation(t *testing.T) { validate := New() var j uint64 var k float64 s := "abcd" i := 1 j = 1 k = 1.543 arr := []string{"test"} now := time.Now().UTC() errs := validate.Var(s, "eq=abcd") Equal(t, errs, nil) errs = validate.Var(i, "eq=1") Equal(t, errs, nil) errs = validate.Var(j, "eq=1") Equal(t, errs, nil) errs = validate.Var(k, "eq=1.543") Equal(t, errs, nil) errs = validate.Var(arr, "eq=1") Equal(t, errs, nil) errs = validate.Var(arr, "eq=2") NotEqual(t, errs, nil) AssertError(t, errs, "", "", "", "", "eq") PanicMatches(t, func() { _ = validate.Var(now, "eq=now") }, "Bad field type time.Time") }
explode_data.jsonl/77287
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 310 }
[ 2830, 3393, 3872, 27312, 13799, 1155, 353, 8840, 836, 8, 1476, 197, 7067, 1669, 1532, 2822, 2405, 502, 2622, 21, 19, 198, 2405, 595, 2224, 21, 19, 198, 1903, 1669, 330, 68644, 698, 8230, 1669, 220, 16, 198, 12428, 284, 220, 16, 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...
1
func TestCannotSetInvalidPath(t *testing.T) { Given(t). Path(guestbookPath). When(). Create(). IgnoreErrors(). AppSet("--path", "garbage"). Then(). Expect(Error("", "app path does not exist")) }
explode_data.jsonl/66674
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 85 }
[ 2830, 3393, 17444, 1649, 7928, 1820, 1155, 353, 8840, 836, 8, 341, 9600, 2071, 1155, 4292, 197, 69640, 3268, 3045, 2190, 1820, 4292, 197, 197, 4498, 25829, 197, 75569, 25829, 197, 197, 12497, 13877, 25829, 197, 59557, 1649, 21549, 2343, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestNew(t *testing.T) { bus := i2ctest.Playback{ Ops: []i2ctest.IO{ {Addr: 0x18, W: []byte{0xf0}}, {Addr: 0x18, W: []byte{0xe1, 0xf0}, R: []byte{0x18}}, {Addr: 0x18, W: []byte{0xd2, 0xe1}, R: []byte{0x1}}, {Addr: 0x18, W: []byte{0xe1, 0xb4}}, {Addr: 0x18, W: []byte{0xc3, 0x6, 0x26, 0x46, 0x66, 0x86}}, }, } d, err := New(&bus, 0x18, &DefaultOpts) if err != nil { t.Fatal(err) } if s := d.String(); s != "DS2483{playback(24)}" { t.Fatal(s) } if err := d.Halt(); err != nil { t.Fatal(err) } if err := bus.Close(); err != nil { t.Fatal(err) } }
explode_data.jsonl/67953
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 333 }
[ 2830, 3393, 3564, 1155, 353, 8840, 836, 8, 341, 92530, 1669, 600, 17, 67880, 24462, 1419, 515, 197, 197, 38904, 25, 3056, 72, 17, 67880, 8393, 515, 298, 197, 90, 13986, 25, 220, 15, 87, 16, 23, 11, 467, 25, 3056, 3782, 90, 15, 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 TestEnvFileNotFoundError(t *testing.T) { base := testutil.NewBase(t) var dockerComposeYAML = ` version: '3.1' services: svc4: image: ghcr.io/stargz-containers/nginx:$TAG ` comp := testutil.NewComposeDir(t, dockerComposeYAML) defer comp.CleanUp() envFile := `TAG=1.19-alpine-org` comp.WriteFile("envFile", envFile) //env-file is relative to the current working directory and not the project directory base.ComposeCmd("-f", comp.YAMLFullPath(), "--env-file", "envFile", "up", "-d").AssertFail() defer base.ComposeCmd("-f", comp.YAMLFullPath(), "down", "-v").Run() }
explode_data.jsonl/20534
{ "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, 14359, 1703, 67908, 1155, 353, 8840, 836, 8, 341, 24195, 1669, 1273, 1314, 7121, 3978, 1155, 692, 2405, 26588, 70492, 56, 31102, 284, 22074, 4366, 25, 364, 18, 13, 16, 3876, 12779, 510, 220, 46154, 19, 510, 262, 2168, 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...
1
func TestHgGetBranches(t *testing.T) { assert := assert.New(t) repo, client := helpers.CreateHgRepo(t, "hg-repo") defer helpers.CleanupHgRepo(t, client) helpers.SeedHgRepo(t, repo, client) helpers.SeedHgBookmark(t, repo, client) branches, err := repo.GetBranches() assert.Nil(err) assert.Equal(2, len(branches)) assert.Equal("default", branches[0].Name) assert.Equal("test-bookmark", branches[1].Name) for i := 0; i < len(branches); i++ { output, err := client.ExecCmd([]string{"log", "-r", branches[i].Name, "--template", "{node}"}) assert.Nil(err) assert.Equal(string(output), branches[i].Id) } }
explode_data.jsonl/57189
{ "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, 39, 70, 1949, 18197, 288, 1155, 353, 8840, 836, 8, 341, 6948, 1669, 2060, 7121, 1155, 692, 17200, 5368, 11, 2943, 1669, 30187, 7251, 39, 70, 25243, 1155, 11, 330, 66602, 5504, 5368, 1138, 16867, 30187, 727, 60639, 39, 70, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestVerboseConnect(t *testing.T) { s := runProtoServer() defer s.Shutdown() c := createClientConn(t, "localhost", PROTO_TEST_PORT) defer c.Close() doConnect(t, c, true, false, false) send := sendCommand(t, c) expect := expectCommand(t, c) expect(okRe) // Connect send("CONNECT {\"verbose\":true,\"pedantic\":true,\"ssl_required\":false}\r\n") expect(okRe) }
explode_data.jsonl/16814
{ "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, 63404, 14611, 1155, 353, 8840, 836, 8, 341, 1903, 1669, 1598, 31549, 5475, 741, 16867, 274, 10849, 18452, 2822, 1444, 1669, 1855, 2959, 9701, 1155, 11, 330, 8301, 497, 5308, 5207, 11641, 12377, 340, 16867, 272, 10421, 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 TestReadYAMLUnexpectedStream(t *testing.T) { f := newFixture(t) defer f.TearDown() f.UseRealFS() f.File("test.yaml", yamlStream) tf := "observed = read_yaml('test.yaml')\n" f.File("Tiltfile", tf) _, err := f.ExecFile("Tiltfile") if err != nil { fmt.Println(f.PrintOutput()) } require.Error(t, err) require.Contains(t, err.Error(), "expected a yaml document but found a yaml stream") }
explode_data.jsonl/10614
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 169 }
[ 2830, 3393, 4418, 56, 31102, 29430, 3027, 1155, 353, 8840, 836, 8, 341, 1166, 1669, 501, 18930, 1155, 340, 16867, 282, 836, 682, 4454, 2822, 1166, 9046, 12768, 8485, 2822, 1166, 8576, 445, 1944, 33406, 497, 32246, 3027, 340, 3244, 69, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestMineVtb(t *testing.T) { assert := assert.New(t) popContext := generateTestPopContext(t) defer popContext.popContext.Free() popContext.BtcBestBlock() mockMiner := NewMockMiner() index, err := mockMiner.MineVbkBlockTip() assert.NoError(err) vbkBlock, err := index.GetVbkBlockHeader() assert.NoError(err) btcTip, err := popContext.BtcBestBlock() assert.NoError(err) vtb, err := mockMiner.MineVtb(vbkBlock, btcTip.GetHash()) assert.NoError(err) assert.Equal(vtb.ContainingBlock.Height, vbkBlock.Height+1) assert.Equal(vtb.Transaction.PublishedBlock.Difficulty, vbkBlock.Difficulty) assert.Equal(vtb.Transaction.PublishedBlock.Height, vbkBlock.Height) assert.Equal(vtb.Transaction.PublishedBlock.Nonce, vbkBlock.Nonce) assert.Equal(vtb.Transaction.PublishedBlock.Timestamp, vbkBlock.Timestamp) assert.Equal(vtb.Transaction.PublishedBlock.Version, vbkBlock.Version) assert.True(bytes.Equal(vtb.Transaction.PublishedBlock.MerkleRoot[:], vbkBlock.MerkleRoot[:])) assert.True(bytes.Equal(vtb.Transaction.PublishedBlock.PreviousBlock[:], vbkBlock.PreviousBlock[:])) assert.True(bytes.Equal(vtb.Transaction.PublishedBlock.PreviousKeystone[:], vbkBlock.PreviousKeystone[:])) assert.True(bytes.Equal(vtb.Transaction.PublishedBlock.SecondPreviousKeystone[:], vbkBlock.SecondPreviousKeystone[:])) }
explode_data.jsonl/39850
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 485 }
[ 2830, 3393, 63495, 53, 18387, 1155, 353, 8840, 836, 8, 341, 6948, 1669, 2060, 7121, 1155, 692, 74813, 1972, 1669, 6923, 2271, 11598, 1972, 1155, 340, 16867, 2420, 1972, 8288, 1972, 52229, 2822, 74813, 1972, 1785, 10413, 14470, 4713, 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 TestApplicationList_malformed(t *testing.T) { ts := testGateApplicationListMalformed() defer ts.Close() meta := command.ApiMeta{} args := []string{"--gate-endpoint", ts.URL} cmd := ApplicationListCommand{ ApiMeta: meta, } ret := cmd.Run(args) if ret == 0 { // Success is actually failure here, return payload is malformed. t.Fatalf("Command failed with: %d", ret) } }
explode_data.jsonl/18310
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 134 }
[ 2830, 3393, 4988, 852, 717, 278, 10155, 1155, 353, 8840, 836, 8, 341, 57441, 1669, 1273, 42318, 4988, 852, 29600, 10155, 741, 16867, 10591, 10421, 2822, 84004, 1669, 3210, 21044, 12175, 16094, 31215, 1669, 3056, 917, 4913, 313, 24601, 130...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestUrlExtractor_DateFromQuery(t *testing.T) { t.Parallel() pattern := "/" handler := func(actualDate *time.Time, err *error) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { obtainedDate, obtainedErr := extractor.DateFromQuery(r) if obtainedDate != nil { *actualDate = *obtainedDate } *err = obtainedErr } } t.Run("It successfully extracts the date", func(t *testing.T) { var actualDate time.Time var err error expectedDateStr := "2017-09-07" expectedDate, err := time.Parse("2006-01-02", expectedDateStr) assert.NoError(t, err) executeRequest(t, pattern, "/?date="+expectedDateStr, handler(&actualDate, &err)) assert.NoError(t, err) assert.EqualValues(t, actualDate, expectedDate) }) t.Run("It fails on invalid date", func(t *testing.T) { invalidDate := "13th of Yesterday" var actualDate time.Time var err error executeRequest(t, pattern, "/?date="+invalidDate, handler(&actualDate, &err)) assert.Error(t, err) assert.EqualError(t, err, fmt.Sprintf("Invalid date %s", invalidDate)) assert.Equal(t, time.Time{}, actualDate) }) }
explode_data.jsonl/15292
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 419 }
[ 2830, 3393, 2864, 56118, 39564, 3830, 2859, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 2822, 3223, 3227, 1669, 80455, 53326, 1669, 2915, 29721, 1916, 353, 1678, 16299, 11, 1848, 353, 841, 8, 1758, 89164, 341, 197, 853, 2915, 3622,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestEstimateMapBytesSize(t *testing.T) { opts := testResultOptions() blopts := opts.DatabaseBlockOptions() start := time.Now().Truncate(testBlockSize) threeBytes := checked.NewBytes([]byte("123"), nil) threeBytes.IncRef() blocks := []block.DatabaseBlock{ block.NewDatabaseBlock(start, testBlockSize, ts.Segment{Head: threeBytes}, blopts, namespace.Context{}), block.NewDatabaseBlock(start.Add(1*testBlockSize), testBlockSize, ts.Segment{Tail: threeBytes}, blopts, namespace.Context{}), } sr := NewShardResult(opts) fooTags := ident.NewTags(ident.StringTag("foo", "foe")) barTags := ident.NewTags(ident.StringTag("bar", "baz")) sr.AddBlock(ident.StringID("foo"), fooTags, blocks[0]) sr.AddBlock(ident.StringID("bar"), barTags, blocks[1]) require.Equal(t, int64(24), EstimateMapBytesSize(sr.AllSeries())) }
explode_data.jsonl/4681
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 294 }
[ 2830, 3393, 13782, 3426, 2227, 7078, 1695, 1155, 353, 8840, 836, 8, 341, 64734, 1669, 1273, 2077, 3798, 741, 2233, 385, 12754, 1669, 12185, 25008, 4713, 3798, 2822, 21375, 1669, 882, 13244, 1005, 1282, 26900, 8623, 89932, 692, 197, 27856,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestEnumerationNotCoveringAPIGroupStar(t *testing.T) { escalationTest{ ownerRules: []authorizationapi.PolicyRule{ {APIGroups: []string{"dummy-group"}, Verbs: sets.NewString("get"), Resources: sets.NewString("roles")}, }, servantRules: []authorizationapi.PolicyRule{ {APIGroups: []string{"*"}, Verbs: sets.NewString("get"), Resources: sets.NewString("roles")}, }, expectedCovered: false, expectedUncoveredRules: []authorizationapi.PolicyRule{ {APIGroups: []string{"*"}, Verbs: sets.NewString("get"), Resources: sets.NewString("roles")}, }, }.test(t) }
explode_data.jsonl/9051
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 209 }
[ 2830, 3393, 67117, 2623, 30896, 287, 7082, 2808, 12699, 1155, 353, 8840, 836, 8, 341, 80629, 278, 367, 2271, 515, 197, 197, 8118, 26008, 25, 3056, 39554, 2068, 1069, 8018, 11337, 515, 298, 197, 90, 7082, 22173, 25, 3056, 917, 4913, 31...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestServeHTTPExistingContext(t *testing.T) { r := NewRouter() r.Get("/hi", func(w http.ResponseWriter, r *http.Request) { s, _ := r.Context().Value(ctxKey{"testCtx"}).(string) w.Write([]byte(s)) }) r.NotFound(func(w http.ResponseWriter, r *http.Request) { s, _ := r.Context().Value(ctxKey{"testCtx"}).(string) w.WriteHeader(404) w.Write([]byte(s)) }) testcases := []struct { Ctx context.Context Method string Path string ExpectedBody string ExpectedStatus int }{ { Method: "GET", Path: "/hi", Ctx: context.WithValue(context.Background(), ctxKey{"testCtx"}, "hi ctx"), ExpectedStatus: 200, ExpectedBody: "hi ctx", }, { Method: "GET", Path: "/hello", Ctx: context.WithValue(context.Background(), ctxKey{"testCtx"}, "nothing here ctx"), ExpectedStatus: 404, ExpectedBody: "nothing here ctx", }, } for _, tc := range testcases { resp := httptest.NewRecorder() req, err := http.NewRequest(tc.Method, tc.Path, nil) if err != nil { t.Fatalf("%v", err) } req = req.WithContext(tc.Ctx) r.ServeHTTP(resp, req) b, err := ioutil.ReadAll(resp.Body) if err != nil { t.Fatalf("%v", err) } if resp.Code != tc.ExpectedStatus { t.Fatalf("%v != %v", tc.ExpectedStatus, resp.Code) } if string(b) != tc.ExpectedBody { t.Fatalf("%s != %s", tc.ExpectedBody, b) } } }
explode_data.jsonl/42879
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 689 }
[ 2830, 3393, 60421, 9230, 53067, 1972, 1155, 353, 8840, 836, 8, 341, 7000, 1669, 1532, 9523, 741, 7000, 2234, 4283, 6023, 497, 2915, 3622, 1758, 37508, 11, 435, 353, 1254, 9659, 8, 341, 197, 1903, 11, 716, 1669, 435, 9328, 1005, 1130, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestUnmarshal_WithBoolean(t *testing.T) { type testStruct struct { Boolval bool } testUnmarshal(t, []testcase{ {`boolval = true`, nil, &testStruct{true}}, {`boolval = false`, nil, &testStruct{false}}, }) }
explode_data.jsonl/52955
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 92 }
[ 2830, 3393, 1806, 27121, 62, 2354, 6890, 1155, 353, 8840, 836, 8, 341, 13158, 1273, 9422, 2036, 341, 197, 197, 11233, 831, 1807, 198, 197, 532, 18185, 1806, 27121, 1155, 11, 3056, 1944, 5638, 515, 197, 197, 90, 63, 2641, 831, 284, 8...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1