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 TestDaoReportUsers(t *testing.T) { var ( c = context.TODO() ids = []int64{1, 2, 3} ) convey.Convey("ReportUsers", t, func(ctx convey.C) { users, userMap, err := d.ReportUsers(c, ids) ctx.Convey("Then err should be nil.users,userMap should not be nil.", func(ctx convey.C) { ctx.So(err, convey.ShouldBeNil) ctx.So(userMap, convey.ShouldHaveLength, 0) ctx.So(users, convey.ShouldHaveLength, 0) }) }) }
explode_data.jsonl/51295
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 184 }
[ 2830, 3393, 12197, 10361, 7137, 1155, 353, 8840, 836, 8, 341, 2405, 2399, 197, 1444, 256, 284, 2266, 90988, 741, 197, 197, 3365, 284, 3056, 396, 21, 19, 90, 16, 11, 220, 17, 11, 220, 18, 532, 197, 340, 37203, 5617, 4801, 5617, 445...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func Test_ResolveTypes_ObjectField_Fail(t *testing.T) { data := ` models: Custom: field1: NonExisting ` old, err := unmarshalSpec([]byte(data)) assert.Equal(t, err, nil) errors := enrichSpec(old) assert.Equal(t, len(errors), 1) assert.Equal(t, strings.Contains(errors[0].Message, "NonExisting"), true) }
explode_data.jsonl/79850
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 125 }
[ 2830, 3393, 62, 56808, 4173, 27839, 1877, 1400, 604, 1155, 353, 8840, 836, 8, 341, 8924, 1669, 22074, 6507, 510, 220, 8406, 510, 262, 2070, 16, 25, 11581, 53067, 198, 3989, 61828, 11, 1848, 1669, 650, 27121, 8327, 10556, 3782, 2592, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_TX_BatchReplace(t *testing.T) { table := createInitTable() defer dropTable(table) gtest.C(t, func(t *gtest.T) { tx, err := db.Begin() if err != nil { gtest.Error(err) } if _, err := tx.BatchReplace(table, g.List{ { "id": 2, "passport": "USER_2", "password": "PASS_2", "nickname": "NAME_2", "create_time": gtime.Now().String(), }, { "id": 4, "passport": "USER_4", "password": "PASS_4", "nickname": "NAME_4", "create_time": gtime.Now().String(), }, }, 10); err != nil { gtest.Error(err) } if err := tx.Commit(); err != nil { gtest.Error(err) } if n, err := db.Table(table).Count(); err != nil { gtest.Error(err) } else { t.Assert(n, SIZE) } if value, err := db.Table(table).Fields("password").Where("id", 2).Value(); err != nil { gtest.Error(err) } else { t.Assert(value.String(), "PASS_2") } }) }
explode_data.jsonl/41308
{ "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, 18819, 1668, 754, 23107, 1155, 353, 8840, 836, 8, 341, 26481, 1669, 1855, 3803, 2556, 741, 16867, 5943, 2556, 15761, 692, 3174, 1944, 727, 1155, 11, 2915, 1155, 353, 82038, 836, 8, 341, 197, 46237, 11, 1848, 1669, 2927, 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...
6
func TestCredentialRedaction(t *testing.T) { if runtime.GOOS == "windows" { t.Skip("Depends on unimplemented containerd bind-mount support on Windows") } t.Parallel() ctx := namespaces.WithNamespace(context.Background(), "buildkit-test") tmpdir, err := ioutil.TempDir("", "buildkit-state") require.NoError(t, err) defer os.RemoveAll(tmpdir) gs := setupGitSource(t, tmpdir) url := "https://user:keepthissecret@non-existant-host/user/private-repo.git" id := &source.GitIdentifier{Remote: url} g, err := gs.Resolve(ctx, id, nil, nil) require.NoError(t, err) _, _, _, _, err = g.CacheKey(ctx, nil, 0) require.Error(t, err) require.False(t, strings.Contains(err.Error(), "keepthissecret")) }
explode_data.jsonl/12590
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 271 }
[ 2830, 3393, 48265, 6033, 1311, 1155, 353, 8840, 836, 8, 341, 743, 15592, 97574, 3126, 621, 330, 27077, 1, 341, 197, 3244, 57776, 445, 7839, 1412, 389, 650, 54071, 5476, 67, 10719, 59588, 1824, 389, 5515, 1138, 197, 630, 3244, 41288, 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...
2
func TestNewBuilder(t *testing.T) { cd := testClusterDeployment() c := fakeClient(cd) controllerName := "test-controller-name" expected := &builder{ c: c, cd: cd, controllerName: controllerName, urlToUse: activeURL, } actual := NewBuilder(c, cd, controllerName) assert.Equal(t, expected, actual, "unexpected builder") }
explode_data.jsonl/35042
{ "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, 3564, 3297, 1155, 353, 8840, 836, 8, 341, 72826, 1669, 1273, 28678, 75286, 741, 1444, 1669, 12418, 2959, 75912, 340, 61615, 675, 1669, 330, 1944, 67245, 11494, 698, 42400, 1669, 609, 17850, 515, 197, 1444, 25, 1060, 272, 345...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestSpendableCoinsPeriodicVestingAcc(t *testing.T) { now := osttime.Now() endTime := now.Add(24 * time.Hour) periods := types.Periods{ types.Period{Length: int64(12 * 60 * 60), Amount: sdk.Coins{sdk.NewInt64Coin(feeDenom, 500), sdk.NewInt64Coin(stakeDenom, 50)}}, types.Period{Length: int64(6 * 60 * 60), Amount: sdk.Coins{sdk.NewInt64Coin(feeDenom, 250), sdk.NewInt64Coin(stakeDenom, 25)}}, types.Period{Length: int64(6 * 60 * 60), Amount: sdk.Coins{sdk.NewInt64Coin(feeDenom, 250), sdk.NewInt64Coin(stakeDenom, 25)}}, } _, _, addr := testdata.KeyTestPubAddr() origCoins := sdk.Coins{ sdk.NewInt64Coin(feeDenom, 1000), sdk.NewInt64Coin(stakeDenom, 100)} bacc := authtypes.NewBaseAccountWithAddress(addr) pva := types.NewPeriodicVestingAccount(bacc, origCoins, now.Unix(), periods) // require that there exist no spendable coins at the beginning of the // vesting schedule lockedCoins := pva.LockedCoins(now) require.Equal(t, origCoins, lockedCoins) // require that all original coins are spendable at the end of the vesting // schedule lockedCoins = pva.LockedCoins(endTime) require.Equal(t, sdk.NewCoins(), lockedCoins) // require that all still vesting coins (50%) are locked lockedCoins = pva.LockedCoins(now.Add(12 * time.Hour)) require.Equal(t, sdk.Coins{sdk.NewInt64Coin(feeDenom, 500), sdk.NewInt64Coin(stakeDenom, 50)}, lockedCoins) // receive some coins // require that all still vesting coins (50% of original) are locked plus any received lockedCoins = pva.LockedCoins(now.Add(12 * time.Hour)) require.Equal(t, sdk.Coins{sdk.NewInt64Coin(feeDenom, 500), sdk.NewInt64Coin(stakeDenom, 50)}, lockedCoins) }
explode_data.jsonl/31293
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 639 }
[ 2830, 3393, 50, 3740, 480, 69602, 23750, 292, 53, 59855, 14603, 1155, 353, 8840, 836, 8, 341, 80922, 1669, 36896, 1678, 13244, 741, 6246, 1462, 1669, 1431, 1904, 7, 17, 19, 353, 882, 73550, 340, 197, 19304, 82, 1669, 4494, 14834, 3127...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestWitnessSizes(t *testing.T) { for _, test := range witnessSizeTests { test := test t.Run(test.name, func(t *testing.T) { size := test.genWitness(t).SerializeSize() if size != test.expSize { t.Fatalf("size mismatch, want: %v, got: %v", test.expSize, size) } }) } }
explode_data.jsonl/45761
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 131 }
[ 2830, 3393, 98413, 34930, 1155, 353, 8840, 836, 8, 341, 2023, 8358, 1273, 1669, 2088, 11298, 1695, 18200, 341, 197, 18185, 1669, 1273, 198, 197, 3244, 16708, 8623, 2644, 11, 2915, 1155, 353, 8840, 836, 8, 341, 298, 13832, 1669, 1273, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestNewProtobufDataPointWithType(t *testing.T) { Convey("A nil datapoint value", t, func() { dp := sfxmodel.DataPoint{} Convey("should error when converted", func() { _, err := NewProtobufDataPointWithType(&dp, sfxmodel.MetricType_COUNTER) So(err, ShouldEqual, errDatapointValueNotSet) }) Convey("with a value", func() { dp.Value = sfxmodel.Datum{ IntValue: pointer.Int64(1), } Convey("source should set", func() { dp.Source = "hello" dp2, err := NewProtobufDataPointWithType(&dp, sfxmodel.MetricType_COUNTER) So(err, ShouldBeNil) So(dp2.Dimensions["sf_source"], ShouldEqual, "hello") }) }) }) }
explode_data.jsonl/81468
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 276 }
[ 2830, 3393, 3564, 12423, 18464, 1043, 2609, 73716, 1155, 353, 8840, 836, 8, 341, 93070, 5617, 445, 32, 2092, 61723, 781, 897, 497, 259, 11, 2915, 368, 341, 197, 55256, 1669, 274, 8298, 2528, 3336, 2609, 16094, 197, 93070, 5617, 445, 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...
1
func TestJaro(t *testing.T) { for _, row := range jaro_testdata { res := Jaro(row[0], row[1]) expected, err := strconv.ParseFloat(row[2], 64) if err != nil { t.Error("bad row in test data") } if math.Abs(res-expected) > 0.001 { t.Errorf("Jaro(%q, %q) => %.3f, expected %.3f", row[0], row[1], res, expected) } } }
explode_data.jsonl/58059
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 156 }
[ 2830, 3393, 41, 17165, 1155, 353, 8840, 836, 8, 341, 2023, 8358, 2802, 1669, 2088, 502, 17165, 4452, 691, 341, 197, 10202, 1669, 619, 17165, 7835, 58, 15, 1125, 2802, 58, 16, 2546, 197, 42400, 11, 1848, 1669, 33317, 8937, 5442, 7835, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestRouterMultiLevelUnmatch(t *testing.T) { // Create empty handler h := new(Handler) // Create empty context c := new(Context) c.Params = Params{} // Create route r := Route("/a/b/c", h) // Non-matching routes rs := []string{"/", "", "/:a/b/c", "/A/B/C", "/some/thing", "some/thing", "/more/levels/to/be/sure/it/shouldn't/matter", "///", "/almost/trailer/"} // Check for _, s := range rs { if r.Match(s, c) { t.Errorf("'%s' shouldn't match against '/a/b/c'", s) } } }
explode_data.jsonl/35798
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 211 }
[ 2830, 3393, 9523, 20358, 4449, 1806, 6347, 1155, 353, 8840, 836, 8, 341, 197, 322, 4230, 4287, 7013, 198, 9598, 1669, 501, 7, 3050, 692, 197, 322, 4230, 4287, 2266, 198, 1444, 1669, 501, 14001, 340, 1444, 58268, 284, 34352, 31483, 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 TestGetStorageAccessKeys(t *testing.T) { ctrl := gomock.NewController(t) defer ctrl.Finish() cloud := &Cloud{} value := "foo bar" tests := []struct { results storage.AccountListKeysResult expectedKey string expectErr bool err error }{ {storage.AccountListKeysResult{}, "", true, nil}, { storage.AccountListKeysResult{ Keys: &[]storage.AccountKey{ {Value: &value}, }, }, "bar", false, nil, }, { storage.AccountListKeysResult{ Keys: &[]storage.AccountKey{ {}, {Value: &value}, }, }, "bar", false, nil, }, {storage.AccountListKeysResult{}, "", true, fmt.Errorf("test error")}, } for _, test := range tests { mockStorageAccountsClient := mockstorageaccountclient.NewMockInterface(ctrl) cloud.StorageAccountClient = mockStorageAccountsClient mockStorageAccountsClient.EXPECT().ListKeys(gomock.Any(), "rg", gomock.Any()).Return(test.results, nil).AnyTimes() key, err := cloud.GetStorageAccesskey("acct", "rg") if test.expectErr && err == nil { t.Errorf("Unexpected non-error") continue } if !test.expectErr && err != nil { t.Errorf("Unexpected error: %v", err) continue } if key != test.expectedKey { t.Errorf("expected: %s, saw %s", test.expectedKey, key) } } }
explode_data.jsonl/69822
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 544 }
[ 2830, 3393, 1949, 5793, 6054, 8850, 1155, 353, 8840, 836, 8, 341, 84381, 1669, 342, 316, 1176, 7121, 2051, 1155, 340, 16867, 23743, 991, 18176, 2822, 197, 12361, 1669, 609, 16055, 16094, 16309, 1669, 330, 7975, 3619, 1837, 78216, 1669, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
7
func TestCorrelateRecordsForInterNodeDenyFlow(t *testing.T) { messageChan := make(chan *entities.Message) input := AggregationInput{ MessageChan: messageChan, WorkerNum: 2, CorrelateFields: fields, } ap, _ := InitAggregationProcess(input) // Test the scenario, where src record has egress deny rule record1 := createDataMsgForSrc(t, false, false, false, false, true).GetSet().GetRecords()[0] runCorrelationAndCheckResult(t, ap, record1, nil, false, false, false) // Cleanup the flowKeyMap in aggregation process. flowKey1, _, _ := getFlowKeyFromRecord(record1) ap.deleteFlowKeyFromMap(*flowKey1) heap.Pop(&ap.expirePriorityQueue) // Test the scenario, where dst record has ingress reject rule record2 := createDataMsgForDst(t, false, false, false, true, false).GetSet().GetRecords()[0] runCorrelationAndCheckResult(t, ap, record2, nil, false, false, false) // Cleanup the flowKeyMap in aggregation process. ap.deleteFlowKeyFromMap(*flowKey1) heap.Pop(&ap.expirePriorityQueue) // Test the scenario, where dst record has ingress drop rule record1 = createDataMsgForSrc(t, false, false, false, false, false).GetSet().GetRecords()[0] record2 = createDataMsgForDst(t, false, false, false, false, true).GetSet().GetRecords()[0] runCorrelationAndCheckResult(t, ap, record1, record2, false, false, true) // Cleanup the flowKeyMap in aggregation process. ap.deleteFlowKeyFromMap(*flowKey1) }
explode_data.jsonl/8701
{ "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, 10580, 3748, 349, 25876, 2461, 3306, 1955, 23619, 88, 18878, 1155, 353, 8840, 836, 8, 341, 24753, 46019, 1669, 1281, 35190, 353, 10499, 8472, 340, 22427, 1669, 4598, 34442, 2505, 515, 197, 46733, 46019, 25, 257, 1943, 46019, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestCrConflictMoveAndSetexRemovedFile(t *testing.T) { test(t, users("alice", "bob"), as(alice, mkdir("a"), write("a/b", "hello"), ), as(bob, disableUpdates(), ), as(alice, rm("a/b"), ), as(bob, noSync(), rename("a/b", "a/c"), setex("a/c", true), reenableUpdates(), lsdir("a/", m{"c$": "EXEC"}), read("a/c", "hello"), ), as(alice, lsdir("a/", m{"c$": "EXEC"}), read("a/c", "hello"), ), ) }
explode_data.jsonl/31374
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 249 }
[ 2830, 3393, 16001, 57974, 9860, 3036, 1649, 327, 42642, 1703, 1155, 353, 8840, 836, 8, 341, 18185, 1155, 345, 197, 90896, 445, 63195, 497, 330, 47086, 4461, 197, 60451, 17643, 558, 345, 298, 88650, 445, 64, 4461, 298, 24945, 445, 64, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestUpdate(t *testing.T) { catalogStore, err := store.Open("catalog_update", store.DefaultOptions()) require.NoError(t, err) defer os.RemoveAll("catalog_update") dataStore, err := store.Open("sqldata_update", store.DefaultOptions()) require.NoError(t, err) defer os.RemoveAll("sqldata_update") engine, err := NewEngine(catalogStore, dataStore, DefaultOptions().WithPrefix(sqlPrefix)) require.NoError(t, err) _, err = engine.ExecStmt("CREATE DATABASE db1", nil, true) require.NoError(t, err) _, err = engine.ExecStmt("UPDATE table1 SET title = 'title11' WHERE title = 'title", nil, true) require.ErrorIs(t, err, ErrNoDatabaseSelected) err = engine.UseDatabase("db1") require.NoError(t, err) _, err = engine.ExecStmt(`CREATE TABLE table1 ( id INTEGER, title VARCHAR[50], active BOOLEAN, PRIMARY KEY id )`, nil, true) require.NoError(t, err) _, err = engine.ExecStmt("CREATE UNIQUE INDEX ON table1(title)", nil, true) require.NoError(t, err) _, err = engine.ExecStmt("CREATE INDEX ON table1(active)", nil, true) require.NoError(t, err) params, err := engine.InferParameters("UPDATE table1 SET active = @active") require.NoError(t, err) require.NotNil(t, params) require.Len(t, params, 1) require.Equal(t, params["active"], BooleanType) _, err = engine.ExecStmt("UPDATE table2 SET active = false", nil, true) require.ErrorIs(t, err, ErrTableDoesNotExist) _, err = engine.ExecStmt("UPDATE table1 SET name = 'name1'", nil, true) require.ErrorIs(t, err, ErrColumnDoesNotExist) t.Run("update on empty table should complete without issues", func(t *testing.T) { summary, err := engine.ExecStmt("UPDATE table1 SET active = false", nil, true) require.NoError(t, err) require.NotNil(t, summary) require.Zero(t, summary.UpdatedRows) }) rowCount := 10 for i := 0; i < rowCount; i++ { _, err = engine.ExecStmt(fmt.Sprintf(` INSERT INTO table1 (id, title, active) VALUES (%d, 'title%d', %v)`, i, i, i%2 == 0), nil, true) require.NoError(t, err) } t.Run("updating with contradiction should not produce any change", func(t *testing.T) { summary, err := engine.ExecStmt("UPDATE table1 SET active = false WHERE false", nil, true) require.NoError(t, err) require.NotNil(t, summary) require.Zero(t, summary.UpdatedRows) }) t.Run("updating specific row should update only one row", func(t *testing.T) { summary, err := engine.ExecStmt("UPDATE table1 SET active = true WHERE title = @title", map[string]interface{}{"title": "title1"}, true) require.NoError(t, err) require.NotNil(t, summary) require.Equal(t, 1, summary.UpdatedRows) r, err := engine.QueryStmt("SELECT COUNT() FROM table1", nil, true) require.NoError(t, err) row, err := r.Read() require.NoError(t, err) require.Equal(t, int64(rowCount), row.Values[EncodeSelector("", "db1", "table1", "col0")].Value()) err = r.Close() require.NoError(t, err) r, err = engine.QueryStmt("SELECT COUNT() FROM table1 WHERE active", nil, true) require.NoError(t, err) row, err = r.Read() require.NoError(t, err) require.Equal(t, int64(rowCount/2+1), row.Values[EncodeSelector("", "db1", "table1", "col0")].Value()) err = r.Close() require.NoError(t, err) }) }
explode_data.jsonl/64062
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1213 }
[ 2830, 3393, 4289, 1155, 353, 8840, 836, 8, 341, 1444, 7750, 6093, 11, 1848, 1669, 3553, 12953, 445, 26539, 8882, 497, 3553, 13275, 3798, 2398, 17957, 35699, 1155, 11, 1848, 340, 16867, 2643, 84427, 445, 26539, 8882, 5130, 8924, 6093, 11...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestTranscodingOGG(t *testing.T) { var inputPath = "/tmp/ffmpeg/ogg" var outputPath = "/tmp/ffmpeg/out/ogg.mp4" trans := new(transcoder.Transcoder) err := trans.Initialize(inputPath, outputPath) assert.Nil(t, err) done := trans.Run(false) err = <-done assert.Nil(t, err) }
explode_data.jsonl/57663
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 117 }
[ 2830, 3393, 3167, 48367, 12223, 38, 1155, 353, 8840, 836, 8, 1476, 2405, 1946, 1820, 284, 3521, 5173, 14, 72422, 14, 16108, 698, 2405, 95017, 284, 3521, 5173, 14, 72422, 48316, 14, 16108, 16870, 19, 1837, 72453, 1669, 501, 33089, 40170,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestMatchPod(t *testing.T) { testCases := []struct { in *api.Pod fieldSelector fields.Selector expectMatch bool }{ { in: &api.Pod{ Spec: api.PodSpec{NodeName: "nodeA"}, }, fieldSelector: fields.ParseSelectorOrDie("spec.nodeName=nodeA"), expectMatch: true, }, { in: &api.Pod{ Spec: api.PodSpec{NodeName: "nodeB"}, }, fieldSelector: fields.ParseSelectorOrDie("spec.nodeName=nodeA"), expectMatch: false, }, { in: &api.Pod{ Spec: api.PodSpec{RestartPolicy: api.RestartPolicyAlways}, }, fieldSelector: fields.ParseSelectorOrDie("spec.restartPolicy=Always"), expectMatch: true, }, { in: &api.Pod{ Spec: api.PodSpec{RestartPolicy: api.RestartPolicyAlways}, }, fieldSelector: fields.ParseSelectorOrDie("spec.restartPolicy=Never"), expectMatch: false, }, { in: &api.Pod{ Spec: api.PodSpec{SchedulerName: "scheduler1"}, }, fieldSelector: fields.ParseSelectorOrDie("spec.schedulerName=scheduler1"), expectMatch: true, }, { in: &api.Pod{ Spec: api.PodSpec{SchedulerName: "scheduler1"}, }, fieldSelector: fields.ParseSelectorOrDie("spec.schedulerName=scheduler2"), expectMatch: false, }, { in: &api.Pod{ Spec: api.PodSpec{ServiceAccountName: "serviceAccount1"}, }, fieldSelector: fields.ParseSelectorOrDie("spec.serviceAccountName=serviceAccount1"), expectMatch: true, }, { in: &api.Pod{ Spec: api.PodSpec{SchedulerName: "serviceAccount1"}, }, fieldSelector: fields.ParseSelectorOrDie("spec.serviceAccountName=serviceAccount2"), expectMatch: false, }, { in: &api.Pod{ Status: api.PodStatus{Phase: api.PodRunning}, }, fieldSelector: fields.ParseSelectorOrDie("status.phase=Running"), expectMatch: true, }, { in: &api.Pod{ Status: api.PodStatus{Phase: api.PodRunning}, }, fieldSelector: fields.ParseSelectorOrDie("status.phase=Pending"), expectMatch: false, }, { in: &api.Pod{ Status: api.PodStatus{ PodIPs: []api.PodIP{ {IP: "1.2.3.4"}, }, }, }, fieldSelector: fields.ParseSelectorOrDie("status.podIP=1.2.3.4"), expectMatch: true, }, { in: &api.Pod{ Status: api.PodStatus{ PodIPs: []api.PodIP{ {IP: "1.2.3.4"}, }, }, }, fieldSelector: fields.ParseSelectorOrDie("status.podIP=4.3.2.1"), expectMatch: false, }, { in: &api.Pod{ Status: api.PodStatus{NominatedNodeName: "node1"}, }, fieldSelector: fields.ParseSelectorOrDie("status.nominatedNodeName=node1"), expectMatch: true, }, { in: &api.Pod{ Status: api.PodStatus{NominatedNodeName: "node1"}, }, fieldSelector: fields.ParseSelectorOrDie("status.nominatedNodeName=node2"), expectMatch: false, }, { in: &api.Pod{ Status: api.PodStatus{ PodIPs: []api.PodIP{ {IP: "2001:db8::"}, }, }, }, fieldSelector: fields.ParseSelectorOrDie("status.podIP=2001:db8::"), expectMatch: true, }, { in: &api.Pod{ Status: api.PodStatus{ PodIPs: []api.PodIP{ {IP: "2001:db8::"}, }, }, }, fieldSelector: fields.ParseSelectorOrDie("status.podIP=2001:db7::"), expectMatch: false, }, } for _, testCase := range testCases { m := MatchPod(labels.Everything(), testCase.fieldSelector) result, err := m.Matches(testCase.in) if err != nil { t.Errorf("Unexpected error %v", err) } if result != testCase.expectMatch { t.Errorf("Result %v, Expected %v, Selector: %v, Pod: %v", result, testCase.expectMatch, testCase.fieldSelector.String(), testCase.in) } } }
explode_data.jsonl/34739
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1712 }
[ 2830, 3393, 8331, 23527, 1155, 353, 8840, 836, 8, 341, 18185, 37302, 1669, 3056, 1235, 341, 197, 17430, 310, 353, 2068, 88823, 198, 197, 39250, 5877, 5043, 14752, 269, 198, 197, 24952, 8331, 256, 1807, 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...
4
func TestConfigFix(t *testing.T) { testCases := []struct { cfg *Config err error }{ {cfg: &Config{}, err: ErrIllegalTopic}, {cfg: &Config{MQ: MQConfig{BlobDeleteTopic: "test"}}, err: ErrIllegalTopic}, {cfg: &Config{MQ: MQConfig{BlobDeleteTopic: "test", ShardRepairTopic: "test1"}}, err: ErrIllegalTopic}, {cfg: &Config{MQ: MQConfig{BlobDeleteTopic: "test", ShardRepairTopic: "test", ShardRepairPriorityTopic: "test3"}}, err: ErrIllegalTopic}, {cfg: &Config{MQ: MQConfig{BlobDeleteTopic: "test", ShardRepairTopic: "test1", ShardRepairPriorityTopic: "test"}}, err: ErrIllegalTopic}, {cfg: &Config{MQ: MQConfig{BlobDeleteTopic: "test", ShardRepairTopic: "test1", ShardRepairPriorityTopic: "test3"}}, err: nil}, } for _, tc := range testCases { err := tc.cfg.checkAndFix() require.Equal(t, true, errors.Is(err, tc.err)) tc.cfg.shardRepairCfg() tc.cfg.blobDeleteCfg() } }
explode_data.jsonl/7361
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 353 }
[ 2830, 3393, 2648, 25958, 1155, 353, 8840, 836, 8, 341, 18185, 37302, 1669, 3056, 1235, 341, 197, 50286, 353, 2648, 198, 197, 9859, 1465, 198, 197, 59403, 197, 197, 90, 14072, 25, 609, 2648, 22655, 1848, 25, 15495, 33713, 26406, 1583, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestKustomize(t *testing.T) { testCase := &tests.KustomizeTestCase{ Package: "../../../../tests/legacy_kustomizations/knative-eventing-install", Expected: "test_data/expected", } tests.RunTestCase(t, testCase) }
explode_data.jsonl/49692
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 86 }
[ 2830, 3393, 42, 1450, 551, 1155, 353, 8840, 836, 8, 341, 18185, 4207, 1669, 609, 23841, 11352, 1450, 551, 16458, 515, 197, 10025, 1434, 25, 220, 63392, 23841, 14, 39884, 4698, 1450, 8040, 14109, 29738, 39687, 287, 57899, 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
func TestEncode(t *testing.T) { t.Parallel() b := new(bytes.Buffer) err := Encode(b, sample(t)) ok(t, err) equals(t, b.String(), "127.0.0.1 foobar\n192.168.0.1 bazbaz blahbar\nfe80::1%lo0 bazbaz\n") b.Reset() err = Encode(b, comment(t)) ok(t, err) equals(t, b.String(), "# Don't delete this line!\n\n192.168.0.1 bazbaz\n") }
explode_data.jsonl/43700
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 168 }
[ 2830, 3393, 32535, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 741, 2233, 1669, 501, 23158, 22622, 340, 9859, 1669, 56562, 1883, 11, 6077, 1155, 1171, 59268, 1155, 11, 1848, 340, 197, 7176, 1155, 11, 293, 6431, 1507, 330, 16, 17,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestBastionAdditionalUserData(t *testing.T) { runTestAWS(t, "bastionuserdata.example.com", "bastionadditional_user-data", "v1alpha2", true, 1, true, false, nil) }
explode_data.jsonl/17492
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 65 }
[ 2830, 3393, 33, 559, 290, 29019, 39485, 1155, 353, 8840, 836, 8, 341, 56742, 2271, 36136, 1155, 11, 330, 28011, 290, 23496, 7724, 905, 497, 330, 28011, 290, 35499, 3317, 13945, 497, 330, 85, 16, 7141, 17, 497, 830, 11, 220, 16, 11, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
func TestConnectionCreateMany(t *testing.T) { assert := assert.New(t) tx, err := Default().Begin() assert.Nil(err) defer tx.Rollback() err = createTable(tx) assert.Nil(err) var objects []DatabaseMapped for x := 0; x < 10; x++ { objects = append(objects, benchObj{ Name: fmt.Sprintf("test_object_%d", x), UUID: uuid.V4().String(), Timestamp: time.Now().UTC(), Amount: 1005.0, Pending: true, Category: fmt.Sprintf("category_%d", x), }) } err = Default().CreateManyInTx(objects, tx) assert.Nil(err) var verify []benchObj err = Default().QueryInTx(`select * from bench_object`, tx).OutMany(&verify) assert.Nil(err) assert.NotEmpty(verify) }
explode_data.jsonl/33845
{ "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, 4526, 4021, 8441, 1155, 353, 8840, 836, 8, 341, 6948, 1669, 2060, 7121, 1155, 340, 46237, 11, 1848, 1669, 7899, 1005, 11135, 741, 6948, 59678, 3964, 340, 16867, 9854, 88918, 2822, 9859, 284, 1855, 2556, 27301, 340, 6948, 596...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestReportWorkflowResource_ScheduledWorkflowIDNotEmpty_NoExperiment_Success(t *testing.T) { store := NewFakeClientManagerOrFatal(util.NewFakeTimeForEpoch()) defer store.Close() manager := NewResourceManager(store) job := &api.Job{ Name: "j1", Enabled: true, PipelineSpec: &api.PipelineSpec{WorkflowManifest: testWorkflow.ToStringForStore()}, // no experiment reference } newJob, err := manager.CreateJob(job) // report workflow workflow := util.NewWorkflow(&v1alpha1.Workflow{ ObjectMeta: v1.ObjectMeta{ Name: "MY_NAME", Namespace: "MY_NAMESPACE", UID: "WORKFLOW_1", Labels: map[string]string{util.LabelKeyWorkflowRunId: "WORKFLOW_1"}, OwnerReferences: []v1.OwnerReference{{ APIVersion: "kubeflow.org/v1beta1", Kind: "ScheduledWorkflow", Name: "SCHEDULE_NAME", UID: types.UID(newJob.UUID), }}, CreationTimestamp: v1.NewTime(time.Unix(11, 0).UTC()), }, }) err = manager.ReportWorkflowResource(workflow) assert.Nil(t, err) runDetail, err := manager.GetRun("WORKFLOW_1") assert.Nil(t, err) expectedRunDetail := &model.RunDetail{ Run: model.Run{ UUID: "WORKFLOW_1", ExperimentUUID: DefaultFakeUUID, DisplayName: "MY_NAME", StorageState: api.Run_STORAGESTATE_AVAILABLE.String(), Name: "MY_NAME", Namespace: "MY_NAMESPACE", CreatedAtInSec: 11, ScheduledAtInSec: 0, FinishedAtInSec: 0, PipelineSpec: model.PipelineSpec{ WorkflowSpecManifest: workflow.GetWorkflowSpec().ToStringForStore(), }, ResourceReferences: []*model.ResourceReference{ { ResourceUUID: "WORKFLOW_1", ResourceType: common.Run, ReferenceUUID: DefaultFakeUUID, ReferenceName: "Default", ReferenceType: common.Experiment, Relationship: common.Owner, }, { ResourceUUID: "WORKFLOW_1", ResourceType: common.Run, ReferenceUUID: newJob.UUID, ReferenceName: newJob.Name, ReferenceType: common.Job, Relationship: common.Creator, }, }, }, PipelineRuntime: model.PipelineRuntime{WorkflowRuntimeManifest: workflow.ToStringForStore()}, } assert.Equal(t, expectedRunDetail, runDetail) }
explode_data.jsonl/77056
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 988 }
[ 2830, 3393, 10361, 62768, 4783, 1098, 26644, 62768, 915, 27416, 36989, 77780, 87161, 1155, 353, 8840, 836, 8, 341, 57279, 1669, 1532, 52317, 2959, 2043, 2195, 62396, 67811, 7121, 52317, 1462, 2461, 44338, 2398, 16867, 3553, 10421, 741, 9227...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestAddEndpointsWithUnknownEventKindShouldNotPanic(t *testing.T) { h, l := newHandler() h.Handle(resource.Event{ Kind: resource.None, Entry: entryForEndpoints(serviceName, createTime, "v1"), }) expectNoNotification(t, l) }
explode_data.jsonl/37583
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 87 }
[ 2830, 3393, 2212, 80786, 2354, 13790, 1556, 10629, 14996, 2623, 47, 31270, 1155, 353, 8840, 836, 8, 341, 9598, 11, 326, 1669, 501, 3050, 2822, 9598, 31421, 23599, 6904, 515, 197, 197, 10629, 25, 220, 5101, 18475, 345, 197, 197, 5874, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestValidateAnnontatedApplication(t *testing.T) { tests := map[string]struct { engine chaosTypes.EngineInfo isErr bool }{ "Test Positive-1": { engine: chaosTypes.EngineInfo{ Instance: &v1alpha1.ChaosEngine{ ObjectMeta: metav1.ObjectMeta{ Name: "validate-annotation-p2", Namespace: "default", }, Spec: v1alpha1.ChaosEngineSpec{ ChaosServiceAccount: "fake-serviceAccount", EngineState: "active", AnnotationCheck: "false", Appinfo: v1alpha1.ApplicationParams{ Applabel: "app=nginx", AppKind: "deployment", }, Components: v1alpha1.ComponentParams{ Runner: v1alpha1.RunnerInfo{ Image: "fake-runner-image", }, }, Experiments: []v1alpha1.ExperimentList{ { Name: "exp-1", }, }, }, }, AppExperiments: []string{"exp-1"}, }, isErr: false, }, "Test Negetive-1": { engine: chaosTypes.EngineInfo{ Instance: &v1alpha1.ChaosEngine{ ObjectMeta: metav1.ObjectMeta{ Name: "validate-annotation-n1", Namespace: "default", }, Spec: v1alpha1.ChaosEngineSpec{ Appinfo: v1alpha1.ApplicationParams{ Applabel: "app=nginx", AppKind: "deployment", }, EngineState: "active", AnnotationCheck: "dummy", Components: v1alpha1.ComponentParams{ Runner: v1alpha1.RunnerInfo{ Image: "fake-runner-image", }, }, Experiments: []v1alpha1.ExperimentList{ { Name: "exp-1", }, }, }, }, }, isErr: true, }, "Test Negetive-2": { engine: chaosTypes.EngineInfo{ Instance: &v1alpha1.ChaosEngine{ ObjectMeta: metav1.ObjectMeta{ Name: "validate-annotation-n2", Namespace: "default", }, Spec: v1alpha1.ChaosEngineSpec{ AnnotationCheck: "true", EngineState: "active", Appinfo: v1alpha1.ApplicationParams{ Applabel: "app=nginx", AppKind: "deployment", }, Components: v1alpha1.ComponentParams{ Runner: v1alpha1.RunnerInfo{ Image: "fake-runner-image", }, }, Experiments: []v1alpha1.ExperimentList{ { Name: "exp-1", }, }, }, }, AppExperiments: []string{"exp-1"}, }, isErr: true, }, } for name, mock := range tests { t.Run(name, func(t *testing.T) { r := CreateFakeClient(t) err := r.client.Create(context.TODO(), mock.engine.Instance) if err != nil { fmt.Printf("Unable to create engine: %v", err) } err = r.validateAnnontatedApplication(&mock.engine) if mock.isErr && err == nil { t.Fatalf("Test %q failed: expected error not to be nil", name) } if !mock.isErr && err != nil { t.Fatalf("Test %q failed: expected error to be nil", name) } }) } }
explode_data.jsonl/32126
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1455 }
[ 2830, 3393, 17926, 27093, 544, 657, 4988, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 2415, 14032, 60, 1235, 341, 197, 80118, 26915, 4173, 54424, 1731, 198, 197, 19907, 7747, 220, 1807, 198, 197, 59403, 197, 197, 1, 2271, 43903, 12, 16...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
6
func TestPluginVolume(t *testing.T) { lun := 0 vol := &api.Volume{ Name: "vol1", VolumeSource: api.VolumeSource{ FC: &api.FCVolumeSource{ TargetWWNs: []string{"some_wwn"}, FSType: "ext4", Lun: &lun, }, }, } doTestPlugin(t, volume.NewSpecFromVolume(vol)) }
explode_data.jsonl/12301
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 144 }
[ 2830, 3393, 11546, 18902, 1155, 353, 8840, 836, 8, 341, 8810, 359, 1669, 220, 15, 198, 5195, 337, 1669, 609, 2068, 79106, 515, 197, 21297, 25, 330, 12536, 16, 756, 197, 17446, 4661, 3608, 25, 6330, 79106, 3608, 515, 298, 197, 6754, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestMatDeterminant(t *testing.T) { mat1 := NewMatWithSize(101, 101, MatTypeCV32F) ret := Determinant(mat1) if ret != 0 { t.Error("TestMatDeterminant error.") } }
explode_data.jsonl/81736
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 71 }
[ 2830, 3393, 11575, 92648, 517, 1155, 353, 8840, 836, 8, 341, 59874, 16, 1669, 1532, 11575, 2354, 1695, 7, 16, 15, 16, 11, 220, 16, 15, 16, 11, 6867, 929, 19589, 18, 17, 37, 340, 11262, 1669, 34907, 517, 33397, 16, 340, 743, 2112, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestStorageQuota(t *testing.T) { wf := unmarshalWF(wfWithPVC) cancel, controller := newController(wf) defer cancel() controller.kubeclientset.(*fake.Clientset).BatchV1().(*batchfake.FakeBatchV1).Fake.PrependReactor("create", "persistentvolumeclaims", func(action k8stesting.Action) (bool, runtime.Object, error) { return true, nil, apierr.NewForbidden(schema.GroupResource{Group: "test", Resource: "test1"}, "test", errors.New("exceeded quota")) }) ctx := context.Background() woc := newWorkflowOperationCtx(wf, controller) woc.operate(ctx) assert.Equal(t, wfv1.WorkflowPending, woc.wf.Status.Phase) assert.Contains(t, woc.wf.Status.Message, "Waiting for a PVC to be created.") controller.kubeclientset.(*fake.Clientset).BatchV1().(*batchfake.FakeBatchV1).Fake.PrependReactor("create", "persistentvolumeclaims", func(action k8stesting.Action) (bool, runtime.Object, error) { return true, nil, apierr.NewBadRequest("BadRequest") }) woc.operate(ctx) assert.Equal(t, wfv1.WorkflowError, woc.wf.Status.Phase) assert.Contains(t, woc.wf.Status.Message, "BadRequest") }
explode_data.jsonl/71030
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 410 }
[ 2830, 3393, 5793, 2183, 6089, 1155, 353, 8840, 836, 8, 341, 6692, 69, 1669, 650, 27121, 32131, 3622, 69, 2354, 47, 11287, 692, 84441, 11, 6461, 1669, 501, 2051, 3622, 69, 340, 16867, 9121, 2822, 61615, 5202, 3760, 2972, 746, 41399, 30...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestConcurrentOrderers(t *testing.T) { // Determine number of orderers to use - environment can override const numOrderersDefault = 10000 numOrderersEnv := os.Getenv("TEST_MASSIVE_ORDERER_COUNT") numOrderers, err := strconv.Atoi(numOrderersEnv) if err != nil { numOrderers = numOrderersDefault } channel, err := setupMassiveTestChannel(0, numOrderers) if err != nil { t.Fatalf("Failed to create massive channel: %s", err) } txn := apitxn.Transaction{ Proposal: &apitxn.TransactionProposal{ Proposal: &pb.Proposal{}, }, Transaction: &pb.Transaction{}, } _, err = channel.SendTransaction(&txn) if err != nil { t.Fatalf("SendTransaction returned error: %s", err) } }
explode_data.jsonl/76246
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 259 }
[ 2830, 3393, 1109, 3231, 4431, 388, 1155, 353, 8840, 836, 8, 341, 197, 322, 29901, 1372, 315, 1973, 388, 311, 990, 481, 4573, 646, 2812, 198, 4777, 1629, 4431, 388, 3675, 284, 220, 16, 15, 15, 15, 15, 198, 22431, 4431, 388, 14359, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestFindTeamByName(t *testing.T) { th := Setup().InitBasic() defer th.TearDown() Client := th.BasicClient Client.Logout() if _, err := Client.FindTeamByName(th.BasicTeam.Name); err == nil { t.Fatal("Should have failed when not logged in.") } }
explode_data.jsonl/48525
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 94 }
[ 2830, 3393, 9885, 14597, 16898, 1155, 353, 8840, 836, 8, 341, 70479, 1669, 18626, 1005, 3803, 15944, 741, 16867, 270, 836, 682, 4454, 2822, 71724, 1669, 270, 48868, 2959, 198, 71724, 5247, 411, 2822, 743, 8358, 1848, 1669, 8423, 9998, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestConnectivityCheck(t *testing.T) { // Connectivity is ok when server return 200 server := NewHTTPServerTest(200) connectivity := CheckConnectivity(server.endpoint) assert.Equal(t, config.HTTPConnectivitySuccess, connectivity) server.stop() // Connectivity is ok when server return 500 server = NewHTTPServerTest(500) connectivity = CheckConnectivity(server.endpoint) assert.Equal(t, config.HTTPConnectivityFailure, connectivity) server.stop() }
explode_data.jsonl/82449
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 137 }
[ 2830, 3393, 14611, 1927, 3973, 1155, 353, 8840, 836, 8, 341, 197, 322, 96054, 374, 5394, 979, 3538, 470, 220, 17, 15, 15, 198, 41057, 1669, 1532, 9230, 5475, 2271, 7, 17, 15, 15, 340, 56905, 1927, 1669, 4248, 14611, 1927, 21421, 609...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestReverseBool(t *testing.T) { type args struct { s []bool } tests := []struct { name string args args want []bool }{ {name: "testcase1", args: args{s: []bool{true, true, false, false, false}}, want: []bool{false, false, false, true, true}}, {name: "testcase2", args: args{s: []bool{}}, want: []bool{}}, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { ReverseBool(tt.args.s) if reflect.DeepEqual(tt.args.s, tt.want) != true { t.Errorf("ReverseBool() got = %v, want %v", tt.args.s, tt.want) } }) } }
explode_data.jsonl/73909
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 258 }
[ 2830, 3393, 45695, 11233, 1155, 353, 8840, 836, 8, 341, 13158, 2827, 2036, 341, 197, 1903, 3056, 2641, 198, 197, 532, 78216, 1669, 3056, 1235, 341, 197, 11609, 914, 198, 197, 31215, 2827, 198, 197, 50780, 3056, 2641, 198, 197, 59403, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestGet_fileSubdir(t *testing.T) { dst := tempDir(t) u := testModule("basic//subdir") if err := Get(dst, u); err != nil { t.Fatalf("err: %s", err) } mainPath := filepath.Join(dst, "sub.tf") if _, err := os.Stat(mainPath); err != nil { t.Fatalf("err: %s", err) } }
explode_data.jsonl/812
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 127 }
[ 2830, 3393, 1949, 2458, 3136, 3741, 1155, 353, 8840, 836, 8, 341, 52051, 1669, 2730, 6184, 1155, 340, 10676, 1669, 1273, 3332, 445, 22342, 322, 1966, 3741, 5130, 743, 1848, 1669, 2126, 30260, 11, 575, 1215, 1848, 961, 2092, 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 TestQueryERC20ToDenom(t *testing.T) { var ( erc20 = "0xb462864E395d88d6bc7C5dd5F3F5eb4cc2599255" denom = "uatom" ) response := types.QueryERC20ToDenomResponse{ Denom: denom, CosmosOriginated: true, } input := CreateTestEnv(t) ctx := input.Context input.GravityKeeper.setCosmosOriginatedDenomToERC20(ctx, denom, erc20) queriedDenom, err := queryERC20ToDenom(ctx, erc20, input.GravityKeeper) require.NoError(t, err) correctBytes, err := codec.MarshalJSONIndent(types.ModuleCdc, response) require.NoError(t, err) assert.Equal(t, correctBytes, queriedDenom) }
explode_data.jsonl/8804
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 255 }
[ 2830, 3393, 2859, 27434, 17, 15, 1249, 23619, 316, 1155, 353, 8840, 836, 8, 341, 2405, 2399, 197, 197, 2962, 17, 15, 284, 330, 15, 7929, 19, 21, 17, 23, 21, 19, 36, 18, 24, 20, 67, 23, 23, 67, 21, 8904, 22, 34, 20, 631, 20, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestThrottledLogger(t *testing.T) { // Install a fake log func for testing. log := make(chan string) infoDepth = func(depth int, args ...interface{}) { log <- fmt.Sprint(args...) } interval := 100 * time.Millisecond tl := NewThrottledLogger("name", interval) start := time.Now() go tl.Infof("test %v", 1) if got, want := <-log, "name: test 1"; got != want { t.Errorf("got %q, want %q", got, want) } go tl.Infof("test %v", 2) if got, want := <-log, "name: skipped 1 log messages"; got != want { t.Errorf("got %q, want %q", got, want) } if got, want := skippedCount(tl), 0; got != want { t.Errorf("skippedCount is %v but was expecting %v after waiting", got, want) } if got := time.Since(start); got < interval { t.Errorf("didn't wait long enough before logging, got %v, want >= %v", got, interval) } go tl.Infof("test %v", 3) if got, want := <-log, "name: test 3"; got != want { t.Errorf("got %q, want %q", got, want) } if got, want := skippedCount(tl), 0; got != want { t.Errorf("skippedCount is %v but was expecting %v", got, want) } }
explode_data.jsonl/28497
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 420 }
[ 2830, 3393, 1001, 46689, 832, 7395, 1155, 353, 8840, 836, 8, 341, 197, 322, 19242, 264, 12418, 1487, 2915, 369, 7497, 624, 6725, 1669, 1281, 35190, 914, 340, 27043, 19776, 284, 2915, 53675, 526, 11, 2827, 2503, 4970, 28875, 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 Test_validate_list(t *testing.T) { should := require.New(t) schemas, err := ThriftSchemas(` struct Request { 1: list<string> words; } `) should.Nil(err) obj := NewObject() obj.Schema = schemas["Request"] obj.Set("words", NewList("hello", "world")) should.Panics(func() { obj.Set("words", 1) }) should.Panics(func() { obj.Set("words", NewList(1)) }) }
explode_data.jsonl/61926
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 159 }
[ 2830, 3393, 42681, 2019, 1155, 353, 8840, 836, 8, 341, 197, 5445, 1669, 1373, 7121, 1155, 340, 1903, 31126, 11, 1848, 1669, 29565, 2085, 50, 31126, 61528, 6472, 6145, 341, 197, 197, 16, 25, 1140, 4947, 29, 4244, 280, 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...
1
func TestServer_Request_Reject_Pseudo_ExactlyOne(t *testing.T) { // 8.1.2.3 Request Pseudo-Header Fields // "All HTTP/2 requests MUST include exactly one valid value" ... testRejectRequest(t, func(st *serverTester) { st.addLogFilter("duplicate pseudo-header") st.bodylessReq1(":method", "GET", ":method", "POST") }) }
explode_data.jsonl/71626
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 119 }
[ 2830, 3393, 5475, 44024, 50693, 583, 1088, 21952, 62531, 32739, 3966, 1155, 353, 8840, 836, 8, 341, 197, 322, 220, 23, 13, 16, 13, 17, 13, 18, 6145, 393, 21952, 12, 4047, 24580, 198, 197, 322, 330, 2403, 10130, 14, 17, 7388, 27732, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestTransportIssue10457(t *testing.T) { defer afterTest(t) // used to fail in goroutine leak check ts := httptest.NewServer(HandlerFunc(func(w ResponseWriter, r *Request) { // Send a response with no body, keep-alive // (implicit), and then lie and immediately close the // connection. This forces the Transport's readLoop to // immediately Peek an io.EOF and get to the point // that used to hang. conn, _, _ := w.(Hijacker).Hijack() conn.Write([]byte("HTTP/1.1 200 OK\r\nFoo: Bar\r\nContent-Length: 0\r\n\r\n")) // keep-alive conn.Close() })) defer ts.Close() tr := &Transport{} defer tr.CloseIdleConnections() cl := &Client{Transport: tr} res, err := cl.Get(ts.URL) if err != nil { t.Fatalf("Get: %v", err) } defer res.Body.Close() // Just a sanity check that we at least get the response. The real // test here is that the "defer afterTest" above doesn't find any // leaked goroutines. if got, want := res.Header.Get("Foo"), "Bar"; got != want { t.Errorf("Foo header = %q; want %q", got, want) } }
explode_data.jsonl/4916
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 392 }
[ 2830, 3393, 27560, 42006, 16, 15, 19, 20, 22, 1155, 353, 8840, 836, 8, 341, 16867, 1283, 2271, 1155, 8, 442, 1483, 311, 3690, 304, 45198, 14159, 23352, 1779, 198, 57441, 1669, 54320, 70334, 7121, 5475, 7, 3050, 9626, 18552, 3622, 5949...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestInstanceIdentity(t *testing.T) { imports := make(testImporter) conf := Config{Importer: imports} makePkg := func(src string) { fset := token.NewFileSet() f, err := parser.ParseFile(fset, "", src, 0) if err != nil { t.Fatal(err) } name := f.Name.Name pkg, err := conf.Check(name, fset, []*ast.File{f}, nil) if err != nil { t.Fatal(err) } imports[name] = pkg } makePkg(genericPkg + `lib; type T[P any] struct{}`) makePkg(genericPkg + `a; import "generic_lib"; var A generic_lib.T[int]`) makePkg(genericPkg + `b; import "generic_lib"; var B generic_lib.T[int]`) a := imports["generic_a"].Scope().Lookup("A") b := imports["generic_b"].Scope().Lookup("B") if !Identical(a.Type(), b.Type()) { t.Errorf("mismatching types: a.A: %s, b.B: %s", a.Type(), b.Type()) } }
explode_data.jsonl/55563
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 355 }
[ 2830, 3393, 2523, 18558, 1155, 353, 8840, 836, 8, 341, 21918, 82, 1669, 1281, 8623, 77289, 340, 67850, 1669, 5532, 90, 77289, 25, 15202, 532, 77438, 47, 7351, 1669, 2915, 14705, 914, 8, 341, 197, 1166, 746, 1669, 3950, 7121, 1703, 164...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestAppend(t *testing.T) { randomBools := make([]bool, 128) rng := rand.New(rand.NewSource(1)) for i := 0; i < len(randomBools); i++ { randomBools[i] = rng.Intn(2) == 1 } for i := 0; i < len(randomBools)-1; i++ { a := New(randomBools[0:i]...) b := New(randomBools[i:]...) a.Append(b) if !equal(a.Bits(), randomBools) { t.Errorf("got %v, want %v", a.Bits(), randomBools) } } }
explode_data.jsonl/67082
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 194 }
[ 2830, 3393, 23877, 1155, 353, 8840, 836, 8, 341, 83628, 1233, 3069, 1669, 1281, 10556, 2641, 11, 220, 16, 17, 23, 692, 7000, 968, 1669, 10382, 7121, 37595, 7121, 3608, 7, 16, 4390, 2023, 600, 1669, 220, 15, 26, 600, 366, 2422, 25110...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestTrueVerifier(t *testing.T) { tests := []struct { name string write []byte wantError bool }{ { name: "test okay hash", write: []byte("hello world"), wantError: false, }, { name: "test wrong hash", write: []byte("HELLO WORLD"), wantError: false, }, { name: "test empty hash", write: []byte{}, wantError: false, }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { v := NewInsecureVerifier() io.Copy(v, bytes.NewReader(tt.write)) if err := v.Verify(); (err != nil) != tt.wantError { t.Errorf("NewInsecureVerifier().Write(%x).Verify() = %v, wantReader %v", tt.write, err, tt.wantError) return } }) } }
explode_data.jsonl/38056
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 351 }
[ 2830, 3393, 2514, 82394, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 3056, 1235, 341, 197, 11609, 414, 914, 198, 197, 24945, 257, 3056, 3782, 198, 197, 50780, 1454, 1807, 198, 197, 59403, 197, 197, 515, 298, 11609, 25, 414, 330, 1944, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestCase1(t *testing.T) { var ( input = []int{1, 2, 3, 4} expected = []int{1, 3, 6, 10} ) result := runningSum(input) if !reflect.DeepEqual(result, expected) { t.Errorf("Running result = %v; \n expected = %v", result, expected) } }
explode_data.jsonl/61046
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 108 }
[ 2830, 30573, 16, 1155, 353, 8840, 836, 8, 1476, 2405, 2399, 197, 22427, 262, 284, 3056, 396, 90, 16, 11, 220, 17, 11, 220, 18, 11, 220, 19, 532, 197, 42400, 284, 3056, 396, 90, 16, 11, 220, 18, 11, 220, 21, 11, 220, 16, 15, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestDate(t *testing.T) { d := time.Date(2013, time.August, 27, 22, 25, 11, 0, time.UTC) if dummys.Call("toUnixTimestamp", d).Int() != int(d.Unix()) { t.Fail() } d2 := js.Global.Get("Date").New(d.UnixNano() / 1000000).Interface().(time.Time) if !d2.Equal(d) { t.Fail() } }
explode_data.jsonl/56788
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 132 }
[ 2830, 3393, 1916, 1155, 353, 8840, 836, 8, 341, 2698, 1669, 882, 8518, 7, 17, 15, 16, 18, 11, 882, 875, 768, 590, 11, 220, 17, 22, 11, 220, 17, 17, 11, 220, 17, 20, 11, 220, 16, 16, 11, 220, 15, 11, 882, 87069, 340, 743, 6...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestGetEnvOrDefaultGetFromEnv(t *testing.T) { require.NoError(t, os.Setenv(envKeyName, "VALUE")) assert.Equal(t, "VALUE", GetEnvOrDefault(envKeyName, "DEFAULT_VALUE")) require.NoError(t, os.Unsetenv(envKeyName)) }
explode_data.jsonl/78025
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 89 }
[ 2830, 3393, 1949, 14359, 14188, 1949, 3830, 14359, 1155, 353, 8840, 836, 8, 341, 17957, 35699, 1155, 11, 2643, 4202, 3160, 16978, 58660, 11, 330, 23832, 5455, 6948, 12808, 1155, 11, 330, 23832, 497, 2126, 14359, 14188, 16978, 58660, 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
func TestApiServerLeaseEndpointReconcilerEnabled(t *testing.T) { testCases := []string{ ` kubernetesVersion: v1.11.3 `, ` kubernetesVersion: v1.10.2 `} for _, testCase := range testCases { confBody := singleAzConfigYaml + testCase c, _ := ClusterFromBytes([]byte(confBody)) if enabled, err := c.ApiServerLeaseEndpointReconciler(); enabled == false || err != nil { t.Errorf("API server lease endpoint should be enabled at Kubernetes 1.9 or greater: %s\n%s", err, confBody) } } }
explode_data.jsonl/4381
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 192 }
[ 2830, 3393, 6563, 5475, 2304, 519, 27380, 693, 40446, 5769, 5462, 1155, 353, 8840, 836, 8, 341, 18185, 37302, 1669, 3056, 917, 515, 197, 197, 3989, 74, 29827, 5637, 25, 348, 16, 13, 16, 16, 13, 18, 198, 12892, 197, 197, 3989, 74, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestMarshalJSON(t *testing.T) { m := &m1{} m.F1.Set("f1") m.F2.Set("") m.F3.Set(nil) m.F4.Set(nil) m.F5.Set("") m.F9 = make([]string, 0) m.F10 = []string{"1"} bs, err := MarshalJSON(m) if err != nil { t.Fatalf("unexpected err %v", err) } if !bytes.Equal(bs, []byte(`{"f1":"f1","f4":null,"F5":"","F10":["1"]}`)) { t.Fatalf("unexpected json %v", string(bs)) } m.F6.Get() }
explode_data.jsonl/4250
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 210 }
[ 2830, 3393, 55438, 5370, 1155, 353, 8840, 836, 8, 341, 2109, 1669, 609, 76, 16, 16094, 2109, 991, 16, 4202, 445, 69, 16, 1138, 2109, 991, 17, 4202, 31764, 2109, 991, 18, 4202, 27907, 340, 2109, 991, 19, 4202, 27907, 340, 2109, 991, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestUpgrade(t *testing.T) { path := "github.com/hyperledger/fabric/examples/chaincode/go/example02/cmd" testUpgrade(t, "example02", "0", "example02", "1", path, "", nil, nil, nil) testUpgrade(t, "example02", "0", "example02", "", path, EmptyVersionErr("example02").Error(), nil, nil, nil) testUpgrade(t, "example02", "0", "example02", "0", path, IdenticalVersionErr("example02").Error(), nil, nil, nil) testUpgrade(t, "example02", "0", "example03", "1", path, NotFoundErr("example03").Error(), nil, nil, nil) testUpgrade(t, "example02", "0", "example02", "1{}0", path, InvalidVersionErr("1{}0").Error(), nil, nil, nil) testUpgrade(t, "example02", "0", "example*02", "1{}0", path, InvalidChaincodeNameErr("example*02").Error(), nil, nil, nil) testUpgrade(t, "example02", "0", "", "1", path, EmptyChaincodeNameErr("").Error(), nil, nil, nil) scc := New(NewMockProvider(), mockAclProvider) scc.support = &lscc.MockSupport{} stub := shim.NewMockStub("lscc", scc) res := stub.MockInit("1", nil) assert.Equal(t, int32(shim.OK), res.Status, res.Message) scc.support.(*lscc.MockSupport).GetInstantiationPolicyRv = []byte("instantiation policy") scc.support.(*lscc.MockSupport).GetInstantiationPolicyErr = errors.New("barf") testUpgrade(t, "example02", "0", "example02", "1", path, "barf", scc, stub, nil) scc = New(NewMockProvider(), mockAclProvider) scc.support = &lscc.MockSupport{} stub = shim.NewMockStub("lscc", scc) res = stub.MockInit("1", nil) assert.Equal(t, int32(shim.OK), res.Status, res.Message) testUpgrade(t, "example02", "0", "example02", "1", path, "instantiation policy missing", scc, stub, nil) scc = New(NewMockProvider(), mockAclProvider) scc.support = &lscc.MockSupport{} stub = shim.NewMockStub("lscc", scc) res = stub.MockInit("1", nil) assert.Equal(t, int32(shim.OK), res.Status, res.Message) scc.support.(*lscc.MockSupport).GetInstantiationPolicyRv = []byte("instantiation policy") scc.support.(*lscc.MockSupport).GetInstantiationPolicyMap = map[string][]byte{} scc.support.(*lscc.MockSupport).CheckInstantiationPolicyMap = map[string]error{"example020": errors.New("barf")} testUpgrade(t, "example02", "0", "example02", "1", path, "barf", scc, stub, nil) scc = New(NewMockProvider(), mockAclProvider) scc.support = &lscc.MockSupport{} stub = shim.NewMockStub("lscc", scc) res = stub.MockInit("1", nil) assert.Equal(t, int32(shim.OK), res.Status, res.Message) scc.support.(*lscc.MockSupport).GetInstantiationPolicyRv = []byte("instantiation policy") scc.support.(*lscc.MockSupport).GetInstantiationPolicyMap = map[string][]byte{} scc.support.(*lscc.MockSupport).CheckInstantiationPolicyMap = map[string]error{"example021": errors.New("barf")} testUpgrade(t, "example02", "0", "example02", "1", path, "barf", scc, stub, nil) // Enable PrivateChannelData mocksccProvider := (&mscc.MocksccProviderFactory{ ApplicationConfigBool: true, ApplicationConfigRv: &config.MockApplication{ CapabilitiesRv: &config.MockApplicationCapabilities{ PrivateChannelDataRv: true, }, }, }).NewSystemChaincodeProvider().(*mscc.MocksccProviderImpl) scc = New(mocksccProvider, mockAclProvider) scc.support = &lscc.MockSupport{} stub = shim.NewMockStub("lscc", scc) res = stub.MockInit("1", nil) assert.Equal(t, int32(shim.OK), res.Status, res.Message) scc.support.(*lscc.MockSupport).GetInstantiationPolicyRv = []byte("instantiation policy") collName1 := "mycollection1" policyEnvelope := &common.SignaturePolicyEnvelope{} var requiredPeerCount, maximumPeerCount int32 requiredPeerCount = 1 maximumPeerCount = 2 coll1 := createCollectionConfig(collName1, policyEnvelope, requiredPeerCount, maximumPeerCount) ccp := &common.CollectionConfigPackage{[]*common.CollectionConfig{coll1}} ccpBytes, err := proto.Marshal(ccp) assert.NoError(t, err) assert.NotNil(t, ccpBytes) // As v12 capability is not enabled (which is required for the collection upgrade), an error is expected expectedErrorMsg := "as V1_2 capability is not enabled, collection upgrades are not allowed" testUpgrade(t, "example02", "0", "example02", "1", path, expectedErrorMsg, scc, stub, ccpBytes) // Enable PrivateChannelData and V1_2Validation mocksccProvider = (&mscc.MocksccProviderFactory{ ApplicationConfigBool: true, ApplicationConfigRv: &config.MockApplication{ CapabilitiesRv: &config.MockApplicationCapabilities{ PrivateChannelDataRv: true, CollectionUpgradeRv: true, }, }, }).NewSystemChaincodeProvider().(*mscc.MocksccProviderImpl) scc = New(mocksccProvider, mockAclProvider) scc.support = &lscc.MockSupport{} stub = shim.NewMockStub("lscc", scc) res = stub.MockInit("1", nil) assert.Equal(t, int32(shim.OK), res.Status, res.Message) scc.support.(*lscc.MockSupport).GetInstantiationPolicyRv = []byte("instantiation policy") // As the PrivateChannelData is enabled and collectionConfigBytes is valid, no error is expected testUpgrade(t, "example02", "0", "example02", "1", path, "", scc, stub, []byte("nil")) // Should contain an entry for the chaincodeData only as the collectionConfigBytes is nil assert.Equal(t, 1, len(stub.State)) _, ok := stub.State["example02"] assert.Equal(t, true, ok) scc = New(mocksccProvider, mockAclProvider) scc.support = &lscc.MockSupport{} stub = shim.NewMockStub("lscc", scc) res = stub.MockInit("1", nil) assert.Equal(t, int32(shim.OK), res.Status, res.Message) scc.support.(*lscc.MockSupport).GetInstantiationPolicyRv = []byte("instantiation policy") // As the PrivateChannelData is enabled and collectionConfigBytes is valid, no error is expected testUpgrade(t, "example02", "0", "example02", "1", path, "", scc, stub, ccpBytes) // Should contain two entries: one for the chaincodeData and another for the collectionConfigBytes // as the V1_2Validation is enabled. Only in V1_2Validation, collection upgrades are allowed. // Note that V1_2Validation would be replaced with CollectionUpgrade capability. assert.Equal(t, 2, len(stub.State)) _, ok = stub.State["example02"] assert.Equal(t, true, ok) actualccpBytes, ok := stub.State["example02~collection"] assert.Equal(t, true, ok) assert.Equal(t, ccpBytes, actualccpBytes) }
explode_data.jsonl/46557
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 2249 }
[ 2830, 3393, 43861, 1155, 353, 8840, 836, 8, 341, 26781, 1669, 330, 5204, 905, 7530, 39252, 50704, 6663, 28897, 67020, 14, 8819, 1851, 25525, 65182, 15, 17, 83033, 1837, 18185, 43861, 1155, 11, 330, 8687, 15, 17, 497, 330, 15, 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
func TestExtractPartialRead(t *testing.T) { rc := mutate.Extract(invalidImage{}) if _, err := io.Copy(ioutil.Discard, io.LimitReader(rc, 1)); err != nil { t.Errorf("Could not read one byte from reader") } if err := rc.Close(); err != nil { t.Errorf("rc.Close: %v", err) } }
explode_data.jsonl/3089
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 115 }
[ 2830, 3393, 28959, 37314, 4418, 1155, 353, 8840, 836, 8, 341, 30295, 1669, 67182, 5121, 2144, 5900, 1891, 1906, 37790, 743, 8358, 1848, 1669, 6399, 31770, 1956, 30158, 909, 47560, 11, 6399, 1214, 2353, 5062, 35429, 11, 220, 16, 5905, 18...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestRunInformersFinished(t *testing.T) { fi := &fixedInformer{sunk: true} defer func() { if !fi.Done() { t.Fatalf("Test didn't wait for informers to finish") } }() ctx, cancel := context.WithCancel(TestContextWithLogger(t)) t.Cleanup(cancel) waitInformers, err := RunInformers(ctx.Done(), fi) if err != nil { t.Fatal("Failed to start informers:", err) } cancel() ch := make(chan struct{}) go func() { waitInformers() ch <- struct{}{} }() select { case <-ch: case <-time.After(time.Second): t.Fatal("Timed out waiting for informers to finish.") } }
explode_data.jsonl/45301
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 239 }
[ 2830, 3393, 6727, 37891, 388, 24890, 1155, 353, 8840, 836, 8, 341, 30839, 1669, 609, 22021, 641, 34527, 84386, 3122, 25, 830, 532, 16867, 2915, 368, 341, 197, 743, 753, 9983, 60422, 368, 341, 298, 3244, 30762, 445, 2271, 3207, 944, 37...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestConfigDecodeBytes(t *testing.T) { t.Parallel() // Test with some input src := []byte("abc") key := base64.StdEncoding.EncodeToString(src) result, err := decodeBytes(key) if err != nil { t.Fatalf("err: %s", err) } if !bytes.Equal(src, result) { t.Fatalf("bad: %#v", result) } // Test with no input result, err = decodeBytes("") if err != nil { t.Fatalf("err: %s", err) } if len(result) > 0 { t.Fatalf("bad: %#v", result) } }
explode_data.jsonl/67908
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 198 }
[ 2830, 3393, 2648, 32564, 7078, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 741, 197, 322, 3393, 448, 1045, 1946, 198, 41144, 1669, 3056, 3782, 445, 13683, 1138, 23634, 1669, 2331, 21, 19, 36086, 14690, 50217, 5870, 14705, 692, 9559...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestInitPipelineOpts_Validate(t *testing.T) { testCases := map[string]struct { inProjectEnvs []string inProjectName string expectedError error }{ "invalid project name": { inProjectName: "", expectedError: errNoProjectInWorkspace, }, } for name, tc := range testCases { t.Run(name, func(t *testing.T) { // GIVEN ctrl := gomock.NewController(t) defer ctrl.Finish() opts := &InitPipelineOpts{ projectEnvs: tc.inProjectEnvs, GlobalOpts: &GlobalOpts{projectName: tc.inProjectName}, } // WHEN err := opts.Validate() // THEN if tc.expectedError != nil { require.Equal(t, tc.expectedError, err) } else { require.Nil(t, err) } }) } }
explode_data.jsonl/50734
{ "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, 3803, 34656, 43451, 62, 17926, 1155, 353, 8840, 836, 8, 341, 18185, 37302, 1669, 2415, 14032, 60, 1235, 341, 197, 17430, 7849, 1702, 11562, 3056, 917, 198, 197, 17430, 7849, 675, 914, 271, 197, 42400, 1454, 1465, 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 TestRecover_startHandlerFunc_GET(t *testing.T) { t.Parallel() rec, _, _ := testSetup() ctx, w, r, _ := testRequest(rec.Authboss, "GET") if err := rec.startHandlerFunc(ctx, w, r); err != nil { t.Error("Unexpected error:", err) } if w.Code != http.StatusOK { t.Error("Unexpected status:", w.Code) } body := w.Body.String() if !strings.Contains(body, `<form action="recover"`) { t.Error("Should have rendered a form") } if !strings.Contains(body, `name="`+rec.PrimaryID) { t.Error("Form should contain the primary ID field") } if !strings.Contains(body, `name="confirm_`+rec.PrimaryID) { t.Error("Form should contain the confirm primary ID field") } }
explode_data.jsonl/61493
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 262 }
[ 2830, 3393, 693, 3688, 4906, 3050, 9626, 12702, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 2822, 67904, 11, 8358, 716, 1669, 1273, 21821, 741, 20985, 11, 289, 11, 435, 11, 716, 1669, 1273, 1900, 20635, 25233, 33314, 11, 330, 380...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestIssue30100(t *testing.T) { store, clean := testkit.CreateMockStore(t) defer clean() orgEnable := core.PreparedPlanCacheEnabled() defer core.SetPreparedPlanCache(orgEnable) core.SetPreparedPlanCache(true) se, err := session.CreateSession4TestWithOpt(store, &session.Opt{ PreparedPlanCache: kvcache.NewSimpleLRUCache(100, 0.1, math.MaxUint64), }) require.NoError(t, err) tk := testkit.NewTestKitWithSession(t, store, se) tk.MustExec("use test") tk.MustExec("drop table if exists t;") tk.MustExec("create table t(col1 enum('aa', 'bb'), col2 int, index(col1, col2));") tk.MustExec("insert into t values('aa', 333);") tk.MustExec(`prepare stmt from 'SELECT * FROM t t1 JOIN t t2 ON t1.col1 = t2.col1 WHERE t1.col1 <=> NULL';`) tk.MustQuery("execute stmt").Check(testkit.Rows()) tk.MustQuery("execute stmt").Check(testkit.Rows()) tk.MustQuery("select @@last_plan_from_cache").Check(testkit.Rows("1")) tk.MustExec(`prepare stmt from 'SELECT * FROM t t1 JOIN t t2 ON t1.col1 = t2.col1 WHERE t1.col1 <=> NULL and t2.col2 > ?';`) tk.MustExec("set @a=0;") tk.MustQuery("execute stmt using @a").Check(testkit.Rows()) tk.MustQuery("execute stmt using @a").Check(testkit.Rows()) tk.MustQuery("select @@last_plan_from_cache").Check(testkit.Rows("1")) }
explode_data.jsonl/5536
{ "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, 42006, 18, 15, 16, 15, 15, 1155, 353, 8840, 836, 8, 341, 57279, 11, 4240, 1669, 1273, 8226, 7251, 11571, 6093, 1155, 340, 16867, 4240, 741, 87625, 11084, 1669, 6200, 28770, 7212, 20485, 8233, 5462, 741, 16867, 6200, 4202, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestUnaryClientInterceptor(t *testing.T) { clientConn, err := grpc.Dial("fake:connection", grpc.WithInsecure()) if err != nil { t.Fatalf("failed to create client connection: %v", err) } defer clientConn.Close() sr := NewSpanRecorder() tp := oteltest.NewTracerProvider(oteltest.WithSpanRecorder(sr)) unaryInterceptor := UnaryClientInterceptor(WithTracerProvider(tp)) req := &mockProtoMessage{} reply := &mockProtoMessage{} uniInterceptorInvoker := &mockUICInvoker{} checks := []struct { method string name string expectedSpanCode codes.Code expectedAttr map[attribute.Key]attribute.Value eventsAttr []map[attribute.Key]attribute.Value expectErr bool }{ { method: "/github.com.serviceName/bar", name: "github.com.serviceName/bar", expectedAttr: map[attribute.Key]attribute.Value{ semconv.RPCSystemKey: attribute.StringValue("grpc"), semconv.RPCServiceKey: attribute.StringValue("github.com.serviceName"), semconv.RPCMethodKey: attribute.StringValue("bar"), GRPCStatusCodeKey: attribute.Int64Value(0), semconv.NetPeerIPKey: attribute.StringValue("fake"), semconv.NetPeerPortKey: attribute.StringValue("connection"), }, eventsAttr: []map[attribute.Key]attribute.Value{ { RPCMessageTypeKey: attribute.StringValue("SENT"), RPCMessageIDKey: attribute.IntValue(1), RPCMessageUncompressedSizeKey: attribute.IntValue(proto.Size(proto.Message(req))), }, { RPCMessageTypeKey: attribute.StringValue("RECEIVED"), RPCMessageIDKey: attribute.IntValue(1), RPCMessageUncompressedSizeKey: attribute.IntValue(proto.Size(proto.Message(reply))), }, }, }, { method: "/serviceName/bar", name: "serviceName/bar", expectedAttr: map[attribute.Key]attribute.Value{ semconv.RPCSystemKey: attribute.StringValue("grpc"), semconv.RPCServiceKey: attribute.StringValue("serviceName"), semconv.RPCMethodKey: attribute.StringValue("bar"), GRPCStatusCodeKey: attribute.Int64Value(0), semconv.NetPeerIPKey: attribute.StringValue("fake"), semconv.NetPeerPortKey: attribute.StringValue("connection"), }, eventsAttr: []map[attribute.Key]attribute.Value{ { RPCMessageTypeKey: attribute.StringValue("SENT"), RPCMessageIDKey: attribute.IntValue(1), RPCMessageUncompressedSizeKey: attribute.IntValue(proto.Size(proto.Message(req))), }, { RPCMessageTypeKey: attribute.StringValue("RECEIVED"), RPCMessageIDKey: attribute.IntValue(1), RPCMessageUncompressedSizeKey: attribute.IntValue(proto.Size(proto.Message(reply))), }, }, }, { method: "serviceName/bar", name: "serviceName/bar", expectedAttr: map[attribute.Key]attribute.Value{ semconv.RPCSystemKey: attribute.StringValue("grpc"), semconv.RPCServiceKey: attribute.StringValue("serviceName"), semconv.RPCMethodKey: attribute.StringValue("bar"), GRPCStatusCodeKey: attribute.Int64Value(int64(grpc_codes.OK)), semconv.NetPeerIPKey: attribute.StringValue("fake"), semconv.NetPeerPortKey: attribute.StringValue("connection"), }, eventsAttr: []map[attribute.Key]attribute.Value{ { RPCMessageTypeKey: attribute.StringValue("SENT"), RPCMessageIDKey: attribute.IntValue(1), RPCMessageUncompressedSizeKey: attribute.IntValue(proto.Size(proto.Message(req))), }, { RPCMessageTypeKey: attribute.StringValue("RECEIVED"), RPCMessageIDKey: attribute.IntValue(1), RPCMessageUncompressedSizeKey: attribute.IntValue(proto.Size(proto.Message(reply))), }, }, }, { method: "serviceName/bar_error", name: "serviceName/bar_error", expectedSpanCode: codes.Error, expectedAttr: map[attribute.Key]attribute.Value{ semconv.RPCSystemKey: attribute.StringValue("grpc"), semconv.RPCServiceKey: attribute.StringValue("serviceName"), semconv.RPCMethodKey: attribute.StringValue("bar_error"), GRPCStatusCodeKey: attribute.Int64Value(int64(grpc_codes.Internal)), semconv.NetPeerIPKey: attribute.StringValue("fake"), semconv.NetPeerPortKey: attribute.StringValue("connection"), }, eventsAttr: []map[attribute.Key]attribute.Value{ { RPCMessageTypeKey: attribute.StringValue("SENT"), RPCMessageIDKey: attribute.IntValue(1), RPCMessageUncompressedSizeKey: attribute.IntValue(proto.Size(proto.Message(req))), }, { RPCMessageTypeKey: attribute.StringValue("RECEIVED"), RPCMessageIDKey: attribute.IntValue(1), RPCMessageUncompressedSizeKey: attribute.IntValue(proto.Size(proto.Message(reply))), }, }, expectErr: true, }, { method: "invalidName", name: "invalidName", expectedAttr: map[attribute.Key]attribute.Value{ semconv.RPCSystemKey: attribute.StringValue("grpc"), GRPCStatusCodeKey: attribute.Int64Value(0), semconv.NetPeerIPKey: attribute.StringValue("fake"), semconv.NetPeerPortKey: attribute.StringValue("connection"), }, eventsAttr: []map[attribute.Key]attribute.Value{ { RPCMessageTypeKey: attribute.StringValue("SENT"), RPCMessageIDKey: attribute.IntValue(1), RPCMessageUncompressedSizeKey: attribute.IntValue(proto.Size(proto.Message(req))), }, { RPCMessageTypeKey: attribute.StringValue("RECEIVED"), RPCMessageIDKey: attribute.IntValue(1), RPCMessageUncompressedSizeKey: attribute.IntValue(proto.Size(proto.Message(reply))), }, }, }, { method: "/github.com.foo.serviceName_123/method", name: "github.com.foo.serviceName_123/method", expectedAttr: map[attribute.Key]attribute.Value{ semconv.RPCSystemKey: attribute.StringValue("grpc"), GRPCStatusCodeKey: attribute.Int64Value(0), semconv.RPCServiceKey: attribute.StringValue("github.com.foo.serviceName_123"), semconv.RPCMethodKey: attribute.StringValue("method"), semconv.NetPeerIPKey: attribute.StringValue("fake"), semconv.NetPeerPortKey: attribute.StringValue("connection"), }, eventsAttr: []map[attribute.Key]attribute.Value{ { RPCMessageTypeKey: attribute.StringValue("SENT"), RPCMessageIDKey: attribute.IntValue(1), RPCMessageUncompressedSizeKey: attribute.IntValue(proto.Size(proto.Message(req))), }, { RPCMessageTypeKey: attribute.StringValue("RECEIVED"), RPCMessageIDKey: attribute.IntValue(1), RPCMessageUncompressedSizeKey: attribute.IntValue(proto.Size(proto.Message(reply))), }, }, }, } for _, check := range checks { err := unaryInterceptor(context.Background(), check.method, req, reply, clientConn, uniInterceptorInvoker.invoker) if check.expectErr { assert.Error(t, err) } else { assert.NoError(t, err) } span, ok := getSpanFromRecorder(sr, check.name) if !assert.True(t, ok, "missing span %q", check.name) { continue } assert.Equal(t, check.expectedSpanCode, span.StatusCode()) assert.Equal(t, check.expectedAttr, span.Attributes()) assert.Equal(t, check.eventsAttr, eventAttrMap(span.Events())) } }
explode_data.jsonl/79674
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 3184 }
[ 2830, 3393, 94545, 2959, 32786, 1155, 353, 8840, 836, 8, 341, 25291, 9701, 11, 1848, 1669, 47900, 98462, 445, 30570, 25, 7742, 497, 47900, 26124, 641, 25132, 2398, 743, 1848, 961, 2092, 341, 197, 3244, 30762, 445, 16091, 311, 1855, 2943...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestMemCache_Delete(t *testing.T) { assert := assert.New(t) err := cMem.Set("test", "aaa", time.Millisecond*500) assert.Nil(err) cMem.Del("test") _, err = cMem.Get("test") assert.True(isNotExits(err)) }
explode_data.jsonl/74755
{ "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, 18816, 8233, 57418, 1155, 353, 8840, 836, 8, 341, 6948, 1669, 2060, 7121, 1155, 340, 9859, 1669, 272, 18816, 4202, 445, 1944, 497, 330, 32646, 497, 882, 71482, 9, 20, 15, 15, 340, 6948, 59678, 3964, 340, 1444, 18816, 909, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestCommonLogFormatter_Format(t *testing.T) { clf := CommonLogFormatter{} testCases := []struct { name string data map[string]interface{} expectedLog string }{ { name: "OriginStatus & OriginContentSize are nil", data: map[string]interface{}{ StartUTC: time.Date(2009, time.November, 10, 23, 0, 0, 0, time.UTC), Duration: 123 * time.Second, ClientHost: "10.0.0.1", ClientUsername: "Client", RequestMethod: http.MethodGet, RequestPath: "/foo", RequestProtocol: "http", OriginStatus: nil, OriginContentSize: nil, RequestRefererHeader: "", RequestUserAgentHeader: "", RequestCount: 0, RouterName: "", ServiceURL: "", }, expectedLog: `10.0.0.1 - Client [10/Nov/2009:23:00:00 +0000] "GET /foo http" - - "-" "-" 0 "-" "-" 123000ms `, }, { name: "all data", data: map[string]interface{}{ StartUTC: time.Date(2009, time.November, 10, 23, 0, 0, 0, time.UTC), Duration: 123 * time.Second, ClientHost: "10.0.0.1", ClientUsername: "Client", RequestMethod: http.MethodGet, RequestPath: "/foo", RequestProtocol: "http", OriginStatus: 123, OriginContentSize: 132, RequestRefererHeader: "referer", RequestUserAgentHeader: "agent", RequestCount: nil, RouterName: "foo", ServiceURL: "http://10.0.0.2/toto", }, expectedLog: `10.0.0.1 - Client [10/Nov/2009:23:00:00 +0000] "GET /foo http" 123 132 "referer" "agent" - "foo" "http://10.0.0.2/toto" 123000ms `, }, { name: "all data with local time", data: map[string]interface{}{ StartLocal: time.Date(2009, time.November, 10, 23, 0, 0, 0, time.UTC), Duration: 123 * time.Second, ClientHost: "10.0.0.1", ClientUsername: "Client", RequestMethod: http.MethodGet, RequestPath: "/foo", RequestProtocol: "http", OriginStatus: 123, OriginContentSize: 132, RequestRefererHeader: "referer", RequestUserAgentHeader: "agent", RequestCount: nil, RouterName: "foo", ServiceURL: "http://10.0.0.2/toto", }, expectedLog: `10.0.0.1 - Client [10/Nov/2009:14:00:00 -0900] "GET /foo http" 123 132 "referer" "agent" - "foo" "http://10.0.0.2/toto" 123000ms `, }, } // Set timezone to Alaska to have a constant behavior os.Setenv("TZ", "US/Alaska") for _, test := range testCases { test := test t.Run(test.name, func(t *testing.T) { t.Parallel() entry := &logrus.Entry{Data: test.data} raw, err := clf.Format(entry) assert.NoError(t, err) assert.Equal(t, test.expectedLog, string(raw)) }) } }
explode_data.jsonl/61894
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1507 }
[ 2830, 3393, 10839, 2201, 14183, 72999, 1155, 353, 8840, 836, 8, 341, 39407, 69, 1669, 7718, 2201, 14183, 31483, 18185, 37302, 1669, 3056, 1235, 341, 197, 11609, 286, 914, 198, 197, 8924, 286, 2415, 14032, 31344, 16094, 197, 42400, 2201, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestGetDefaultExtensionsToIgnore(t *testing.T) { t.Run("should success get 35 extensions to ignore", func(t *testing.T) { assert.Len(t, GetDefaultExtensionsToIgnore(), 35) }) }
explode_data.jsonl/70911
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 64 }
[ 2830, 3393, 1949, 3675, 31282, 1249, 12497, 1155, 353, 8840, 836, 8, 341, 3244, 16708, 445, 5445, 2393, 633, 220, 18, 20, 19721, 311, 10034, 497, 2915, 1155, 353, 8840, 836, 8, 341, 197, 6948, 65819, 1155, 11, 2126, 3675, 31282, 1249,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestLoggingServiceV2WriteLogEntriesError(t *testing.T) { errCode := codes.Internal mockLogging.err = grpc.Errorf(errCode, "test error") var entries []*loggingpb.LogEntry = nil var request = &loggingpb.WriteLogEntriesRequest{ Entries: entries, } c, err := NewClient(context.Background(), clientOpt) if err != nil { t.Fatal(err) } resp, err := c.WriteLogEntries(context.Background(), request) if c := grpc.Code(err); c != errCode { t.Errorf("got error code %q, want %q", c, errCode) } _ = resp }
explode_data.jsonl/77760
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 196 }
[ 2830, 3393, 34575, 1860, 53, 17, 7985, 2201, 24533, 1454, 1155, 353, 8840, 836, 8, 341, 9859, 2078, 1669, 13912, 32579, 198, 77333, 34575, 18441, 284, 47900, 13080, 3964, 2078, 11, 330, 1944, 1465, 5130, 2405, 10695, 29838, 25263, 16650, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestIssue29755(t *testing.T) { store, clean := testkit.CreateMockStore(t) defer clean() tk := testkit.NewTestKit(t, store) tk.MustExec("use test") tk.MustExec("set tidb_enable_vectorized_expression = on;") tk.MustQuery("select char(123, NULL, 123)").Check(testkit.Rows("{{")) tk.MustQuery("select char(NULL, 123, 123)").Check(testkit.Rows("{{")) tk.MustExec("set tidb_enable_vectorized_expression = off;") tk.MustQuery("select char(123, NULL, 123)").Check(testkit.Rows("{{")) tk.MustQuery("select char(NULL, 123, 123)").Check(testkit.Rows("{{")) }
explode_data.jsonl/65618
{ "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, 42006, 17, 24, 22, 20, 20, 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, 340, 3244, 74, 50...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestTeamsService_AddTeamProjectBySlug(t *testing.T) { client, mux, _, teardown := setup() defer teardown() opt := &TeamProjectOptions{ Permission: String("admin"), } wantAcceptHeaders := []string{mediaTypeProjectsPreview} mux.HandleFunc("/orgs/o/teams/s/projects/1", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "PUT") testHeader(t, r, "Accept", strings.Join(wantAcceptHeaders, ", ")) v := &TeamProjectOptions{} json.NewDecoder(r.Body).Decode(v) if !cmp.Equal(v, opt) { t.Errorf("Request body = %+v, want %+v", v, opt) } w.WriteHeader(http.StatusNoContent) }) ctx := context.Background() _, err := client.Teams.AddTeamProjectBySlug(ctx, "o", "s", 1, opt) if err != nil { t.Errorf("Teams.AddTeamProjectBySlug returned error: %v", err) } const methodName = "AddTeamProjectBySlug" testBadOptions(t, methodName, func() (err error) { _, err = client.Teams.AddTeamProjectBySlug(ctx, "\n", "\n", -1, opt) return err }) testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { return client.Teams.AddTeamProjectBySlug(ctx, "o", "s", 1, opt) }) }
explode_data.jsonl/4550
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 450 }
[ 2830, 3393, 60669, 1860, 21346, 14597, 7849, 1359, 54968, 1155, 353, 8840, 836, 8, 341, 25291, 11, 59807, 11, 8358, 49304, 1669, 6505, 741, 16867, 49304, 2822, 64838, 1669, 609, 14597, 7849, 3798, 515, 197, 197, 14966, 25, 923, 445, 288...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestAddTeamMembersDomainConstrained(t *testing.T) { th := Setup(t).InitBasic() defer th.TearDown() client := th.SystemAdminClient team := th.BasicTeam team.AllowedDomains = "domain1.com, domain2.com" _, response := client.UpdateTeam(team) require.Nil(t, response.Error) // create two users on allowed domains user1, response := client.CreateUser(&model.User{ Email: "user@domain1.com", Password: "Pa$$word11", Username: GenerateTestUsername(), }) require.Nil(t, response.Error) user2, response := client.CreateUser(&model.User{ Email: "user@domain2.com", Password: "Pa$$word11", Username: GenerateTestUsername(), }) require.Nil(t, response.Error) userList := []string{ user1.Id, user2.Id, } // validate that they can be added tm, response := client.AddTeamMembers(team.Id, userList) require.Nil(t, response.Error) require.Len(t, tm, 2) // cleanup _, response = client.RemoveTeamMember(team.Id, user1.Id) require.Nil(t, response.Error) _, response = client.RemoveTeamMember(team.Id, user2.Id) require.Nil(t, response.Error) // disable one of the allowed domains team.AllowedDomains = "domain1.com" _, response = client.UpdateTeam(team) require.Nil(t, response.Error) // validate that they cannot be added _, response = client.AddTeamMembers(team.Id, userList) require.NotNil(t, response.Error) // validate that one user can be added gracefully members, response := client.AddTeamMembersGracefully(team.Id, userList) require.Nil(t, response.Error) require.Len(t, members, 2) require.NotNil(t, members[0].Member) require.NotNil(t, members[1].Error) require.Equal(t, members[0].UserId, user1.Id) require.Equal(t, members[1].UserId, user2.Id) require.Nil(t, members[0].Error) require.Nil(t, members[1].Member) }
explode_data.jsonl/70728
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 662 }
[ 2830, 3393, 2212, 14597, 24371, 13636, 1109, 57727, 1155, 353, 8840, 836, 8, 341, 70479, 1669, 18626, 1155, 568, 3803, 15944, 741, 16867, 270, 836, 682, 4454, 741, 25291, 1669, 270, 16620, 7210, 2959, 198, 197, 9196, 1669, 270, 48868, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestRunInContainerNoSuchPod(t *testing.T) { fakeCommandRunner := fakeContainerCommandRunner{} kubelet, _, fakeDocker := makeTestKubelet(t) fakeDocker.containerList = []docker.APIContainers{} kubelet.runner = &fakeCommandRunner podName := "podFoo" podNamespace := "etcd" containerName := "containerFoo" output, err := kubelet.RunInContainer( &Pod{Name: podName, Namespace: podNamespace}, containerName, []string{"ls"}) if output != nil { t.Errorf("unexpected non-nil command: %v", output) } if err == nil { t.Error("unexpected non-error") } }
explode_data.jsonl/2847
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 210 }
[ 2830, 3393, 6727, 641, 4502, 65531, 23527, 1155, 353, 8840, 836, 8, 341, 1166, 726, 4062, 19486, 1669, 12418, 4502, 4062, 19486, 16094, 16463, 3760, 1149, 11, 8358, 12418, 35, 13659, 1669, 1281, 2271, 42, 3760, 1149, 1155, 340, 1166, 72...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestRoundRobinMsgRouter(t *testing.T) { for _, tc := range []struct { partitionCount int source int64 want []int }{ { partitionCount: 8, source: 9, want: []int{1, 2, 3, 4, 5, 6, 7, 0, 1}, }, { partitionCount: 5, source: 2, want: []int{2, 3, 4, 0, 1, 2}, }, } { t.Run(fmt.Sprintf("partitionCount=%d", tc.partitionCount), func(t *testing.T) { source := &test.FakeSource{Ret: tc.source} msgRouter := newRoundRobinMsgRouter(rand.New(source), tc.partitionCount) for i, want := range tc.want { got := msgRouter.Route([]byte("IGNORED")) if got != want { t.Errorf("i=%d: Route() = %d, want = %d", i, got, want) } } }) } }
explode_data.jsonl/66482
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 382 }
[ 2830, 3393, 27497, 76671, 6611, 9523, 1155, 353, 8840, 836, 8, 341, 2023, 8358, 17130, 1669, 2088, 3056, 1235, 341, 197, 72872, 680, 2507, 526, 198, 197, 47418, 260, 526, 21, 19, 198, 197, 50780, 1843, 3056, 396, 198, 197, 59403, 197,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestRuleImpreciseDataType(t *testing.T) { common.Log.Debug("Entering function: %s", common.GetFunctionName()) sqls := [][]string{ { `CREATE TABLE tab2 ( p_id BIGINT UNSIGNED NOT NULL, a_id BIGINT UNSIGNED NOT NULL, hours float NOT null, PRIMARY KEY (p_id, a_id) );`, `alter table tbl add column c float not null;`, `insert into tb (col) values (0.00001);`, `select * from tb where col = 0.00001;`, }, { "REPLACE INTO `storage` (`hostname`,`storagehost`, `filename`, `starttime`, `binlogstarttime`, `uploadname`, `binlogsize`, `filesize`, `md5`, `status`) VALUES (1, 1, 1, 1, 1, 1, ?, ?);", }, } for _, sql := range sqls[0] { q, err := NewQuery4Audit(sql) if err == nil { rule := q.RuleImpreciseDataType() if rule.Item != "COL.009" { t.Error("Rule not match:", rule.Item, "Expect : COL.009") } } else { t.Error("sqlparser.Parse Error:", err) } } for _, sql := range sqls[1] { q, err := NewQuery4Audit(sql) if err == nil { rule := q.RuleImpreciseDataType() if rule.Item != "OK" { t.Error("Rule not match:", rule.Item, "Expect : OK") } } else { t.Error("sqlparser.Parse Error:", err) } } common.Log.Debug("Exiting function: %s", common.GetFunctionName()) }
explode_data.jsonl/76783
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 576 }
[ 2830, 3393, 11337, 25216, 2758, 1064, 22653, 1155, 353, 8840, 836, 8, 341, 83825, 5247, 20345, 445, 82867, 729, 25, 1018, 82, 497, 4185, 2234, 5152, 675, 2398, 30633, 82, 1669, 52931, 917, 515, 197, 197, 515, 298, 197, 63, 22599, 1436...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
7
func TestDeleteRunningJob(t *testing.T) { withRepository(func(r *RedisJobRepository) { job := addLeasedJob(t, r, "queue1", "cluster1") result, err := r.DeleteJobs([]*api.Job{job}) if err != nil { t.Fatalf("deleting jobs failed with error %s", err) } err, deletionOccurred := result[job] assert.Nil(t, err) assert.True(t, deletionOccurred) }) }
explode_data.jsonl/32046
{ "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, 6435, 18990, 12245, 1155, 353, 8840, 836, 8, 341, 46948, 4624, 18552, 2601, 353, 48137, 12245, 4624, 8, 341, 197, 68577, 1669, 912, 2304, 1475, 12245, 1155, 11, 435, 11, 330, 4584, 16, 497, 330, 18855, 16, 5130, 197, 9559,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestAdmin_ExportFile(t *testing.T) { ts, _, teardown := startupT(t) defer teardown() c1 := store.Comment{Text: "test test #1", Locator: store.Locator{SiteID: "radio-t", URL: "https://radio-t.com/blah1"}} c2 := store.Comment{Text: "test test #2", ParentID: "p1", Locator: store.Locator{SiteID: "radio-t", URL: "https://radio-t.com/blah2"}} addComment(t, c1, ts) addComment(t, c2, ts) req, err := http.NewRequest("GET", ts.URL+"/api/v1/admin/export?site=radio-t&mode=file", nil) require.NoError(t, err) requireAdminOnly(t, req) resp, err := sendReq(t, req, adminUmputunToken) require.NoError(t, err) assert.Equal(t, 200, resp.StatusCode) assert.Equal(t, "application/gzip", resp.Header.Get("Content-Type")) ungzReader, err := gzip.NewReader(resp.Body) assert.NoError(t, err) ungzBody, err := ioutil.ReadAll(ungzReader) assert.NoError(t, err) assert.Equal(t, 3, strings.Count(string(ungzBody), "\n")) assert.Equal(t, 2, strings.Count(string(ungzBody), "\"text\"")) t.Logf("%s", string(ungzBody)) }
explode_data.jsonl/51833
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 432 }
[ 2830, 3393, 7210, 62, 16894, 1703, 1155, 353, 8840, 836, 8, 341, 57441, 11, 8358, 49304, 1669, 20567, 51, 1155, 340, 16867, 49304, 2822, 1444, 16, 1669, 3553, 56730, 90, 1178, 25, 330, 1944, 1273, 671, 16, 756, 197, 197, 33831, 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 TestNewThrowErrorIfInvalidArgsForFormat(t *testing.T) { _, err := New(1, "YYYY-MM-DD") assert.EqualError(t, err, "First argument must be a datetime string") _, err = New("2018-01-01", 2) assert.EqualError(t, err, "Second argument must be a format string") }
explode_data.jsonl/73975
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 97 }
[ 2830, 3393, 3564, 23079, 1454, 2679, 7928, 4117, 2461, 4061, 1155, 353, 8840, 836, 8, 341, 197, 6878, 1848, 1669, 1532, 7, 16, 11, 330, 28189, 18506, 40175, 1138, 6948, 12808, 1454, 1155, 11, 1848, 11, 330, 5338, 5693, 1969, 387, 264,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_wrap_int(t *testing.T) { should := require.New(t) str, err := MarshalToString(WrapInt64(100)) should.Nil(err) should.Equal("100", str) }
explode_data.jsonl/51196
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 63 }
[ 2830, 3393, 38550, 4042, 1155, 353, 8840, 836, 8, 341, 197, 5445, 1669, 1373, 7121, 1155, 340, 11355, 11, 1848, 1669, 35667, 5870, 14031, 4611, 1072, 21, 19, 7, 16, 15, 15, 1171, 197, 5445, 59678, 3964, 340, 197, 5445, 12808, 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
func TestGetChannelStateNoChannelInBlockchain(t *testing.T) { stateServiceTest.channelServiceMock.Put( stateServiceTest.defaultChannelKey, stateServiceTest.defaultChannelData, ) stateServiceTest.channelServiceMock.blockchainReader.readChannelFromBlockchain = func(channelID *big.Int) (*blockchain.MultiPartyEscrowChannel, bool, error) { return nil, false, nil } defer cleanup() reply, err := stateServiceTest.service.GetChannelState( nil, stateServiceTest.defaultRequest, ) assert.Nil(t, reply) assert.Equal(t, errors.New("unable to read channel details from blockchain."), err) }
explode_data.jsonl/6079
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 196 }
[ 2830, 3393, 1949, 9629, 1397, 2753, 9629, 641, 98898, 1155, 353, 8840, 836, 8, 341, 24291, 1860, 2271, 16195, 1860, 11571, 39825, 1006, 197, 24291, 1860, 2271, 8764, 9629, 1592, 345, 197, 24291, 1860, 2271, 8764, 9629, 1043, 345, 197, 3...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestInitInsertSql(t *testing.T) { table := model.SQLTable{ DbName: "hera", Table: "user_tags", Types: nil, PrimaryKey: "", Columns: []string{"a", "B", "c"}, ColumnsDefaultValue: nil, PrimaryKeyIndex: 0, InsertSQL: "", QuerySQL: "", QueryNode: nil, } res := initInsertSQL(&table) t.Log(res) if res != "insert into hera.user_tags(`a`,`B`,`c`) values (?,?,?)" { t.Fail() } }
explode_data.jsonl/52694
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 279 }
[ 2830, 3393, 3803, 13780, 8269, 1155, 353, 8840, 836, 8, 341, 26481, 1669, 1614, 25095, 2556, 515, 197, 197, 7994, 675, 25, 1060, 330, 1923, 64, 756, 197, 197, 2556, 25, 2290, 330, 872, 16333, 756, 197, 197, 4173, 25, 2290, 2092, 345...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestRemoveSpaceManagerByUsername(t *testing.T) { Convey("Remove manager by username", t, func() { setup(MockRoute{"DELETE", "/v2/spaces/bc7b4caf-f4b8-4d85-b126-0729b9351e56/managers", "", "", 200, "", nil}, t) defer teardown() c := &Config{ ApiAddress: server.URL, Token: "foobar", } client, err := NewClient(c) So(err, ShouldBeNil) space := &Space{ Guid: "bc7b4caf-f4b8-4d85-b126-0729b9351e56", c: client, } err = space.RemoveManagerByUsername("user-name") So(err, ShouldBeNil) }) }
explode_data.jsonl/59994
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 257 }
[ 2830, 3393, 13021, 9914, 2043, 91519, 1155, 353, 8840, 836, 8, 341, 93070, 5617, 445, 13021, 6645, 553, 5934, 497, 259, 11, 2915, 368, 341, 197, 84571, 66436, 4899, 4913, 14424, 497, 3521, 85, 17, 26734, 2434, 3470, 66, 22, 65, 19, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestArray_Rand(t *testing.T) { gtest.C(t, func(t *gtest.T) { a1 := []interface{}{0, 1, 2, 3, 4, 5, 6} array1 := garray.NewArrayFrom(a1) t.Assert(len(array1.Rands(2)), 2) t.Assert(len(array1.Rands(10)), 10) t.AssertIN(array1.Rands(1)[0], a1) }) gtest.C(t, func(t *gtest.T) { s1 := []interface{}{"a", "b", "c", "d"} a1 := garray.NewArrayFrom(s1) i1, ok := a1.Rand() t.Assert(ok, true) t.Assert(a1.Contains(i1), true) t.Assert(a1.Len(), 4) }) }
explode_data.jsonl/13904
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 258 }
[ 2830, 3393, 1857, 2568, 437, 1155, 353, 8840, 836, 8, 341, 3174, 1944, 727, 1155, 11, 2915, 1155, 353, 82038, 836, 8, 341, 197, 11323, 16, 1669, 3056, 4970, 6257, 90, 15, 11, 220, 16, 11, 220, 17, 11, 220, 18, 11, 220, 19, 11, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestMultiStageDockerBuildWithSecondImageDirty(t *testing.T) { f := newIBDFixture(t, k8s.EnvGKE) defer f.TearDown() manifest := NewSanchoDockerBuildMultiStageManifest(f) iTargetID1 := manifest.ImageTargets[0].ID() iTargetID2 := manifest.ImageTargets[1].ID() result1 := store.NewImageBuildResultSingleRef(iTargetID1, container.MustParseNamedTagged("sancho-base:tilt-prebuilt1")) result2 := store.NewImageBuildResultSingleRef(iTargetID2, container.MustParseNamedTagged("sancho:tilt-prebuilt2")) newFile := f.WriteFile("sancho/message.txt", "message") stateSet := store.BuildStateSet{ iTargetID1: store.NewBuildState(result1, nil, nil), iTargetID2: store.NewBuildState(result2, []string{newFile}, nil), } _, err := f.ibd.BuildAndDeploy(f.ctx, f.st, buildTargets(manifest), stateSet) if err != nil { t.Fatal(err) } assert.Equal(t, 1, f.docker.BuildCount) expected := expectedFile{ Path: "Dockerfile", Contents: ` FROM sancho-base:tilt-prebuilt1 ADD . . RUN go install github.com/tilt-dev/sancho ENTRYPOINT /go/bin/sancho `, } testutils.AssertFileInTar(t, tar.NewReader(f.docker.BuildContext), expected) }
explode_data.jsonl/38262
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 446 }
[ 2830, 3393, 20358, 19398, 35, 13659, 11066, 2354, 15666, 1906, 36485, 1155, 353, 8840, 836, 8, 341, 1166, 1669, 501, 3256, 5262, 12735, 1155, 11, 595, 23, 82, 81214, 38, 3390, 340, 16867, 282, 836, 682, 4454, 2822, 197, 42315, 1669, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestInvalidateSession(t *testing.T) { dir1, s1 := testServer(t) defer os.RemoveAll(dir1) defer s1.Shutdown() testrpc.WaitForLeader(t, s1.RPC, "dc1") // Create a session state := s1.fsm.State() if err := state.EnsureNode(1, &structs.Node{Node: "foo", Address: "127.0.0.1"}); err != nil { t.Fatalf("err: %s", err) } session := &structs.Session{ ID: generateUUID(), Node: "foo", TTL: "10s", } if err := state.SessionCreate(100, session); err != nil { t.Fatalf("err: %v", err) } // This should cause a destroy s1.invalidateSession(session.ID) // Check it is gone _, sess, err := state.SessionGet(nil, session.ID) if err != nil { t.Fatalf("err: %v", err) } if sess != nil { t.Fatalf("should destroy session") } }
explode_data.jsonl/35333
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 324 }
[ 2830, 3393, 641, 7067, 5283, 1155, 353, 8840, 836, 8, 341, 48532, 16, 11, 274, 16, 1669, 1273, 5475, 1155, 340, 16867, 2643, 84427, 14161, 16, 340, 16867, 274, 16, 10849, 18452, 2822, 18185, 29414, 99153, 52621, 1155, 11, 274, 16, 201...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestTPDUSetUDH(t *testing.T) { // also tests tpdu.TPDU.UDH b := tpdu.TPDU{} udh := b.UDH if len(udh) != 0 { t.Errorf("initial udh should be empty") } for _, p := range []tpdu.UserDataHeader{ nil, {tpdu.InformationElement{ID: 1, Data: []byte{5, 6, 7}}}, {tpdu.InformationElement{ID: 1, Data: []byte{1, 2, 3}}, tpdu.InformationElement{ID: 1, Data: []byte{5, 6, 7}}, }, nil, } { b.SetUDH(p) udh = b.UDH assert.Equal(t, udh, p) } }
explode_data.jsonl/28773
{ "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, 4239, 21547, 1649, 4656, 39, 1155, 353, 8840, 836, 8, 341, 197, 322, 1083, 7032, 18101, 1054, 836, 47, 21547, 13, 4656, 39, 198, 2233, 1669, 18101, 1054, 836, 47, 21547, 16094, 197, 661, 71, 1669, 293, 13, 4656, 39, 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...
3
func TestReduce(t *testing.T) { type args struct { s []uint64 f func(sum, value uint64) uint64 neutral uint64 } tests := []struct { name string args args want uint64 }{ { name: "basic", args: args{ s: []uint64{1, 3, 4}, f: func(sum, value uint64) uint64 { return sum + value }, neutral: 0, }, want: 8, }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { var got uint64 = uint64s.Reduce(tt.args.s, tt.args.f, tt.args.neutral) assert.Equal(t, tt.want, got) got = uint64s.New(tt.args.s).Reduce(tt.args.f, tt.args.neutral) assert.Equal(t, tt.want, got) }) } }
explode_data.jsonl/55615
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 334 }
[ 2830, 3393, 50325, 1155, 353, 8840, 836, 8, 341, 13158, 2827, 2036, 341, 197, 1903, 981, 3056, 2496, 21, 19, 198, 197, 1166, 981, 2915, 19713, 11, 897, 2622, 21, 19, 8, 2622, 21, 19, 198, 197, 197, 59568, 2622, 21, 19, 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...
1
func TestConversion(t *testing.T) { actual := []error{fmt.Errorf("B"), fmt.Errorf("A")} expected := []error{fmt.Errorf("A"), fmt.Errorf("B")} Sort(actual) assert.Equal(t, expected, actual) }
explode_data.jsonl/70054
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 79 }
[ 2830, 3393, 48237, 1155, 353, 8840, 836, 8, 341, 88814, 1669, 3056, 841, 90, 12501, 13080, 445, 33, 3975, 8879, 13080, 445, 32, 42132, 42400, 1669, 3056, 841, 90, 12501, 13080, 445, 32, 3975, 8879, 13080, 445, 33, 42132, 7568, 371, 29...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestCollection_Distinct(t *testing.T) { mgoClient := Ins() result, err := mgoClient.C("test").Distinct("name", bson.M{}) if err != nil { t.Errorf("Distinct error: %s", err) t.FailNow() } t.Log("Distinct ok", result) }
explode_data.jsonl/30096
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 96 }
[ 2830, 3393, 6482, 1557, 380, 7800, 1155, 353, 8840, 836, 8, 341, 2109, 3346, 2959, 1669, 9726, 741, 9559, 11, 1848, 1669, 296, 3346, 2959, 727, 445, 1944, 1827, 72767, 445, 606, 497, 50980, 1321, 37790, 743, 1848, 961, 2092, 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...
2
func TestBuildConfigBinaryWithImageSource(t *testing.T) { source := &SourceRef{ Name: "binarybuild", SourceImage: &ImageRef{ Reference: reference.DockerImageReference{ Name: "foo", Registry: "bar", }, }, } build := &BuildRef{Source: source, Binary: true} config, err := build.BuildConfig() if err != nil { t.Fatalf("unexpected error: %v", err) } for _, trigger := range config.Spec.Triggers { if trigger.Type == buildv1.ImageChangeBuildTriggerType { t.Fatalf("binary build should not have any imagechangetriggers") } if trigger.Type == buildv1.ConfigChangeBuildTriggerType { t.Fatalf("binary build should not have a buildconfig change trigger") } } }
explode_data.jsonl/17583
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 255 }
[ 2830, 3393, 11066, 2648, 21338, 2354, 1906, 3608, 1155, 353, 8840, 836, 8, 341, 47418, 1669, 609, 3608, 3945, 515, 197, 21297, 25, 330, 25891, 5834, 756, 197, 197, 3608, 1906, 25, 609, 1906, 3945, 515, 298, 197, 8856, 25, 5785, 909, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestIoBufferClone(t *testing.T) { for i := 16; i < 1024+16; i++ { s := randString(i) buffer := NewIoBufferString(s) nb := buffer.Clone() if nb.String() != s { t.Errorf("Clone() expect %s but got %s", s, nb.String()) } } }
explode_data.jsonl/24058
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 112 }
[ 2830, 3393, 42799, 4095, 37677, 1155, 353, 8840, 836, 8, 341, 2023, 600, 1669, 220, 16, 21, 26, 600, 366, 220, 16, 15, 17, 19, 10, 16, 21, 26, 600, 1027, 341, 197, 1903, 1669, 10382, 703, 1956, 340, 197, 31122, 1669, 1532, 42799, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestAPI_AuthorizeUser(t *testing.T) { a := apiWithTempDB(t) _, mock := tconf.MockedProvider(t, a.config, "") a.ext.UseProviders(mock) // no token _, err := a.AuthorizeUser(nil, "", nil) assert.Error(t, err) // bad token _, err = a.AuthorizeUser(nil, "bad", nil) assert.Error(t, err) // bad provider at, err := tokens.GrantAuthToken(a.conn, "bad", 0) require.NoError(t, err) _, err = a.AuthorizeUser(nil, at.Token, nil) assert.Error(t, err) // provider not found at, err = tokens.GrantAuthToken(a.conn, provider.Google, 0) require.NoError(t, err) _, err = a.AuthorizeUser(nil, at.Token, nil) assert.Error(t, err) // invalid session p := provider.Name(mock.Name()) at, err = tokens.GrantAuthToken(a.conn, p, 0) require.NoError(t, err) _, err = a.AuthorizeUser(nil, at.Token, nil) assert.Error(t, err) // create tok, data := authToken(t, a, p) u, err := a.AuthorizeUser(context.Background(), tok, data) assert.NoError(t, err) require.NotNil(t, u) assert.True(t, u.IsConfirmed()) assert.True(t, u.IsActive()) assert.Equal(t, p, u.Provider) mp := tconf.ToMockProvider(mock) assert.Equal(t, mp.Username, u.Username) assert.Equal(t, mp.Email, u.Email) // update username := u.Username tok, data = authToken(t, a, p) u, err = a.AuthorizeUser(context.Background(), tok, data) assert.NoError(t, err) require.NotNil(t, u) assert.NoError(t, err) assert.Equal(t, p, u.Provider) assert.Equal(t, username, u.Username) assert.Equal(t, mp.Email, u.Email) }
explode_data.jsonl/75407
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 632 }
[ 2830, 3393, 7082, 1566, 1553, 551, 1474, 1155, 353, 8840, 836, 8, 341, 11323, 1669, 6330, 2354, 12151, 3506, 1155, 340, 197, 6878, 7860, 1669, 259, 6135, 24664, 291, 5179, 1155, 11, 264, 5423, 11, 14676, 11323, 9220, 9046, 37351, 30389,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestUpdateCapacityAllocatable(t *testing.T) { socketDir, socketName, _, err := tmpSocketDir() topologyStore := topologymanager.NewFakeManager() require.NoError(t, err) defer os.RemoveAll(socketDir) testManager, err := newManagerImpl(socketName, nil, topologyStore) as := assert.New(t) as.NotNil(testManager) as.Nil(err) devs := []pluginapi.Device{ {ID: "Device1", Health: pluginapi.Healthy}, {ID: "Device2", Health: pluginapi.Healthy}, {ID: "Device3", Health: pluginapi.Unhealthy}, } callback := testManager.genericDeviceUpdateCallback // Adds three devices for resource1, two healthy and one unhealthy. // Expects capacity for resource1 to be 2. resourceName1 := "domain1.com/resource1" e1 := &endpointImpl{} testManager.endpoints[resourceName1] = endpointInfo{e: e1, opts: nil} callback(resourceName1, devs) capacity, allocatable, removedResources := testManager.GetCapacity() resource1Capacity, ok := capacity[v1.ResourceName(resourceName1)] as.True(ok) resource1Allocatable, ok := allocatable[v1.ResourceName(resourceName1)] as.True(ok) as.Equal(int64(3), resource1Capacity.Value()) as.Equal(int64(2), resource1Allocatable.Value()) as.Equal(0, len(removedResources)) // Deletes an unhealthy device should NOT change allocatable but change capacity. devs1 := devs[:len(devs)-1] callback(resourceName1, devs1) capacity, allocatable, removedResources = testManager.GetCapacity() resource1Capacity, ok = capacity[v1.ResourceName(resourceName1)] as.True(ok) resource1Allocatable, ok = allocatable[v1.ResourceName(resourceName1)] as.True(ok) as.Equal(int64(2), resource1Capacity.Value()) as.Equal(int64(2), resource1Allocatable.Value()) as.Equal(0, len(removedResources)) // Updates a healthy device to unhealthy should reduce allocatable by 1. devs[1].Health = pluginapi.Unhealthy callback(resourceName1, devs) capacity, allocatable, removedResources = testManager.GetCapacity() resource1Capacity, ok = capacity[v1.ResourceName(resourceName1)] as.True(ok) resource1Allocatable, ok = allocatable[v1.ResourceName(resourceName1)] as.True(ok) as.Equal(int64(3), resource1Capacity.Value()) as.Equal(int64(1), resource1Allocatable.Value()) as.Equal(0, len(removedResources)) // Deletes a healthy device should reduce capacity and allocatable by 1. devs2 := devs[1:] callback(resourceName1, devs2) capacity, allocatable, removedResources = testManager.GetCapacity() resource1Capacity, ok = capacity[v1.ResourceName(resourceName1)] as.True(ok) resource1Allocatable, ok = allocatable[v1.ResourceName(resourceName1)] as.True(ok) as.Equal(int64(0), resource1Allocatable.Value()) as.Equal(int64(2), resource1Capacity.Value()) as.Equal(0, len(removedResources)) // Tests adding another resource. resourceName2 := "resource2" e2 := &endpointImpl{} testManager.endpoints[resourceName2] = endpointInfo{e: e2, opts: nil} callback(resourceName2, devs) capacity, allocatable, removedResources = testManager.GetCapacity() as.Equal(2, len(capacity)) resource2Capacity, ok := capacity[v1.ResourceName(resourceName2)] as.True(ok) resource2Allocatable, ok := allocatable[v1.ResourceName(resourceName2)] as.True(ok) as.Equal(int64(3), resource2Capacity.Value()) as.Equal(int64(1), resource2Allocatable.Value()) as.Equal(0, len(removedResources)) // Expires resourceName1 endpoint. Verifies testManager.GetCapacity() reports that resourceName1 // is removed from capacity and it no longer exists in healthyDevices after the call. e1.setStopTime(time.Now().Add(-1*endpointStopGracePeriod - time.Duration(10)*time.Second)) capacity, allocatable, removed := testManager.GetCapacity() as.Equal([]string{resourceName1}, removed) as.NotContains(capacity, v1.ResourceName(resourceName1)) as.NotContains(allocatable, v1.ResourceName(resourceName1)) val, ok := capacity[v1.ResourceName(resourceName2)] as.True(ok) as.Equal(int64(3), val.Value()) as.NotContains(testManager.healthyDevices, resourceName1) as.NotContains(testManager.unhealthyDevices, resourceName1) as.NotContains(testManager.endpoints, resourceName1) as.Equal(1, len(testManager.endpoints)) // Stops resourceName2 endpoint. Verifies its stopTime is set, allocate and // preStartContainer calls return errors. e2.stop() as.False(e2.stopTime.IsZero()) _, err = e2.allocate([]string{"Device1"}) reflect.DeepEqual(err, fmt.Errorf(errEndpointStopped, e2)) _, err = e2.preStartContainer([]string{"Device1"}) reflect.DeepEqual(err, fmt.Errorf(errEndpointStopped, e2)) // Marks resourceName2 unhealthy and verifies its capacity/allocatable are // correctly updated. testManager.markResourceUnhealthy(resourceName2) capacity, allocatable, removed = testManager.GetCapacity() val, ok = capacity[v1.ResourceName(resourceName2)] as.True(ok) as.Equal(int64(3), val.Value()) val, ok = allocatable[v1.ResourceName(resourceName2)] as.True(ok) as.Equal(int64(0), val.Value()) as.Empty(removed) // Writes and re-reads checkpoints. Verifies we create a stopped endpoint // for resourceName2, its capacity is set to zero, and we still consider // it as a DevicePlugin resource. This makes sure any pod that was scheduled // during the time of propagating capacity change to the scheduler will be // properly rejected instead of being incorrectly started. err = testManager.writeCheckpoint() as.Nil(err) testManager.healthyDevices = make(map[string]sets.String) testManager.unhealthyDevices = make(map[string]sets.String) err = testManager.readCheckpoint() as.Nil(err) as.Equal(1, len(testManager.endpoints)) as.Contains(testManager.endpoints, resourceName2) capacity, allocatable, removed = testManager.GetCapacity() val, ok = capacity[v1.ResourceName(resourceName2)] as.True(ok) as.Equal(int64(0), val.Value()) val, ok = allocatable[v1.ResourceName(resourceName2)] as.True(ok) as.Equal(int64(0), val.Value()) as.Empty(removed) as.True(testManager.isDevicePluginResource(resourceName2)) }
explode_data.jsonl/82143
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 2024 }
[ 2830, 3393, 4289, 29392, 25154, 15086, 1155, 353, 8840, 836, 8, 341, 58279, 6184, 11, 7575, 675, 11, 8358, 1848, 1669, 4174, 10286, 6184, 741, 42118, 2449, 6093, 1669, 44882, 13297, 7121, 52317, 2043, 741, 17957, 35699, 1155, 11, 1848, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func Test_ParseIncludeMatchingRule_EnvVar(t *testing.T) { os.Setenv("NRIA_INCLUDE_MATCHING_METRICS", "process.name:\n - regex \"kube*\" \n") defer os.Unsetenv("NRIA_INCLUDE_MATCHING_METRICS") configStr := "license_key: abc123" f, err := ioutil.TempFile("", "yaml_config_test") assert.NoError(t, err) f.WriteString(configStr) f.Close() cfg, err := LoadConfig(f.Name()) assert.NoError(t, err) expected := IncludeMetricsMap{"process.name": []string{"regex \"kube*\""}} assert.True(t, reflect.DeepEqual(cfg.IncludeMetricsMatchers, expected)) }
explode_data.jsonl/22929
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 226 }
[ 2830, 3393, 77337, 22283, 64430, 11337, 62, 14359, 3962, 1155, 353, 8840, 836, 8, 341, 25078, 4202, 3160, 445, 45, 78263, 48081, 40824, 1718, 33387, 84172, 497, 330, 4630, 2644, 7190, 77, 481, 20180, 7245, 97717, 9, 2105, 1124, 77, 1138...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestPrincipalCombined(t *testing.T) { msp1, err := setup("testdata/idemix/MSP1OU1", "MSP1OU1") assert.NoError(t, err) id1, err := getDefaultSigner(msp1) assert.NoError(t, err) ou := &msp.OrganizationUnit{ OrganizationalUnitIdentifier: id1.GetOrganizationalUnits()[0].OrganizationalUnitIdentifier, MspIdentifier: id1.GetMSPIdentifier(), CertifiersIdentifier: nil, } principalBytes, err := proto.Marshal(ou) assert.NoError(t, err) principalOU := &msp.MSPPrincipal{ PrincipalClassification: msp.MSPPrincipal_ORGANIZATION_UNIT, Principal: principalBytes} principalBytes, err = proto.Marshal(&msp.MSPRole{Role: msp.MSPRole_MEMBER, MspIdentifier: id1.GetMSPIdentifier()}) assert.NoError(t, err) principalRole := &msp.MSPPrincipal{ PrincipalClassification: msp.MSPPrincipal_ROLE, Principal: principalBytes} principals := []*msp.MSPPrincipal{principalOU, principalRole} combinedPrincipal := &msp.CombinedPrincipal{Principals: principals} combinedPrincipalBytes, err := proto.Marshal(combinedPrincipal) assert.NoError(t, err) principalsCombined := &msp.MSPPrincipal{PrincipalClassification: msp.MSPPrincipal_COMBINED, Principal: combinedPrincipalBytes} err = id1.SatisfiesPrincipal(principalsCombined) assert.NoError(t, err) }
explode_data.jsonl/46053
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 534 }
[ 2830, 3393, 31771, 94268, 1155, 353, 8840, 836, 8, 341, 47691, 79, 16, 11, 1848, 1669, 6505, 445, 92425, 38146, 336, 941, 10270, 4592, 16, 11922, 16, 497, 330, 44, 4592, 16, 11922, 16, 1138, 6948, 35699, 1155, 11, 1848, 692, 15710, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestGetClientTLSConfigInvalidArgs(t *testing.T) { // 1. cfg := &ClientTLSConfig{ CertFiles: []string{"root.pem"}, Client: KeyCertFiles{ KeyFile: "no_tls_client-key.pem", CertFile: "no_tls_client-cert.pem", }, } _, err := GetClientTLSConfig(cfg, nil) assert.Error(t, err) assert.Contains(t, err.Error(), "open no_tls_client-cert.pem: no such file or directory") // 2. cfg = &ClientTLSConfig{ CertFiles: nil, Client: KeyCertFiles{ KeyFile: "tls_client-key.pem", CertFile: "tls_client-cert.pem", }, } AbsTLSClient(cfg, configDir) _, err = GetClientTLSConfig(cfg, nil) assert.Error(t, err) assert.Contains(t, err.Error(), "No trusted root certificates for TLS were provided") // 3. cfg = &ClientTLSConfig{ CertFiles: nil, Client: KeyCertFiles{ KeyFile: "no-tls_client-key.pem", CertFile: "tls_client-cert.pem", }, } AbsTLSClient(cfg, configDir) _, err = GetClientTLSConfig(cfg, nil) assert.Error(t, err) assert.Contains(t, err.Error(), "no-tls_client-key.pem: no such file or directory") // 4. cfg = &ClientTLSConfig{ CertFiles: nil, Client: KeyCertFiles{ KeyFile: "", CertFile: "", }, } _, err = GetClientTLSConfig(cfg, nil) assert.Error(t, err) assert.Contains(t, err.Error(), "No trusted root certificates for TLS were provided") // 5. cfg = &ClientTLSConfig{ CertFiles: []string{"no-root.pem"}, Client: KeyCertFiles{ KeyFile: "tls_client-key.pem", CertFile: "tls_client-cert.pem", }, } AbsTLSClient(cfg, configDir) _, err = GetClientTLSConfig(cfg, nil) assert.Error(t, err) assert.Contains(t, err.Error(), "no-root.pem: no such file or directory") }
explode_data.jsonl/43279
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 705 }
[ 2830, 3393, 1949, 2959, 45439, 2648, 7928, 4117, 1155, 353, 8840, 836, 8, 341, 197, 322, 220, 16, 624, 50286, 1669, 609, 2959, 45439, 2648, 515, 197, 6258, 529, 10809, 25, 3056, 917, 4913, 2888, 49373, 7115, 197, 71724, 25, 5309, 3693...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_perEncodingTestList2(t *testing.T) { testList21, err := createTestList2Msg0Items() assert.NilError(t, err, "Error creating TestList2 PDU") per, err := PerEncodeTestList2(testList21) assert.NilError(t, err) t.Logf("TestList2 PER\n%v", hex.Dump(per)) // Generating APER bytes with Go APER lib perNew, err := aper.Marshal(testList21, test_sm_ies.Choicemap, nil) assert.NilError(t, err) //Comparing bytes against each other assert.DeepEqual(t, per, perNew) result, err := PerDecodeTestList2(per) assert.NilError(t, err) assert.Assert(t, result != nil) t.Logf("TestList2 PER - decoded\n%v", result) testList22, err := createTestList2Msg2Items() assert.NilError(t, err, "Error creating TestList2 PDU") per2, err := PerEncodeTestList2(testList22) assert.NilError(t, err) t.Logf("TestList2 PER\n%v", hex.Dump(per2)) // Generating APER bytes with Go APER lib perNew2, err := aper.Marshal(testList22, test_sm_ies.Choicemap, nil) assert.NilError(t, err) //Comparing bytes against each other assert.DeepEqual(t, per2, perNew2) result2, err := PerDecodeTestList2(per2) assert.NilError(t, err) assert.Assert(t, result2 != nil) t.Logf("TestList2 PER - decoded\n%v", result2) assert.Equal(t, 2, len(result2.GetValue())) assert.DeepEqual(t, testList22.GetValue()[0].GetItem2(), result2.GetValue()[0].GetItem2()) assert.Equal(t, testList22.GetValue()[0].GetItem1(), result2.GetValue()[0].GetItem1()) assert.DeepEqual(t, testList22.GetValue()[1].GetItem2(), result2.GetValue()[1].GetItem2()) assert.Equal(t, testList22.GetValue()[1].GetItem1(), result2.GetValue()[1].GetItem1()) }
explode_data.jsonl/7757
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 652 }
[ 2830, 3393, 5678, 14690, 2271, 852, 17, 1155, 353, 8840, 836, 8, 1476, 18185, 852, 17, 16, 11, 1848, 1669, 1855, 2271, 852, 17, 6611, 15, 4353, 741, 6948, 59678, 1454, 1155, 11, 1848, 11, 330, 1454, 6825, 3393, 852, 17, 393, 21547, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestKillContainerInPod(t *testing.T) { manager, fakeDocker := newTestDockerManager() pod := makePod("qux", nil) containers := []*FakeContainer{ { ID: "1111", Name: "/k8s_foo_qux_new_1234_42", }, { ID: "2222", Name: "/k8s_bar_qux_new_1234_42", }, } containerToKill := containers[0] containerToSpare := containers[1] fakeDocker.SetFakeRunningContainers(containers) if err := manager.KillContainerInPod(kubecontainer.ContainerID{}, &pod.Spec.Containers[0], pod, "test kill container in pod.", nil); err != nil { t.Errorf("unexpected error: %v", err) } // Assert the container has been stopped. if err := fakeDocker.AssertStopped([]string{containerToKill.ID}); err != nil { t.Errorf("container was not stopped correctly: %v", err) } // Assert the container has been spared. if err := fakeDocker.AssertStopped([]string{containerToSpare.ID}); err == nil { t.Errorf("container unexpectedly stopped: %v", containerToSpare.ID) } }
explode_data.jsonl/31157
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 367 }
[ 2830, 3393, 53734, 4502, 641, 23527, 1155, 353, 8840, 836, 8, 341, 92272, 11, 12418, 35, 13659, 1669, 501, 2271, 35, 13659, 2043, 2822, 3223, 347, 1669, 1281, 23527, 445, 446, 87, 497, 2092, 340, 197, 39399, 1669, 29838, 52317, 4502, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 Test_ObjectTracker_TryCancelExpect_CancelBeforeExpected(t *testing.T) { g := gomega.NewWithT(t) ot := newObjTracker(schema.GroupVersionKind{}, func() objData { return objData{retries: 2} }) ct := makeCT("test-template") // TryCancelExpect calls should be tracked, even if an object hasn't been Expected yet ot.TryCancelExpect(ct) // 2 --> 1 retries ot.TryCancelExpect(ct) // 1 --> 0 retries g.Expect(ot.Satisfied()).NotTo(gomega.BeTrue(), "should not be satisfied before ExpectationsDone") ot.Expect(ct) g.Expect(ot.Satisfied()).NotTo(gomega.BeTrue(), "should not be satisfied before ExpectationsDone") ot.ExpectationsDone() g.Expect(ot.Satisfied()).NotTo(gomega.BeTrue(), "expectation should remain after two retries") ot.TryCancelExpect(ct) // 0 retries --> DELETE g.Expect(ot.Satisfied()).To(gomega.BeTrue(), "should be satisfied") }
explode_data.jsonl/52326
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 316 }
[ 2830, 3393, 27839, 31133, 1139, 884, 9269, 17536, 97485, 10227, 18896, 1155, 353, 8840, 836, 8, 341, 3174, 1669, 342, 32696, 7121, 2354, 51, 1155, 340, 197, 354, 1669, 74259, 31133, 42735, 5407, 5637, 10629, 22655, 2915, 368, 2839, 1043, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestArray_Shuffle(t *testing.T) { gtest.C(t, func(t *gtest.T) { a1 := []interface{}{0, 1, 2, 3, 4, 5, 6} array1 := garray.NewArrayFrom(a1) t.Assert(array1.Shuffle().Len(), 7) }) }
explode_data.jsonl/13905
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 96 }
[ 2830, 3393, 1857, 36578, 13208, 1155, 353, 8840, 836, 8, 341, 3174, 1944, 727, 1155, 11, 2915, 1155, 353, 82038, 836, 8, 341, 197, 11323, 16, 1669, 3056, 4970, 6257, 90, 15, 11, 220, 16, 11, 220, 17, 11, 220, 18, 11, 220, 19, 11...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestTagDefault2(t *testing.T) { assert.NoError(t, PrepareEngine()) type DefaultStruct2 struct { Id int64 Name string } assertSync(t, new(DefaultStruct2)) tables, err := testEngine.DBMetas() assert.NoError(t, err) var defaultVal string var isDefaultExist bool tableName := testEngine.GetColumnMapper().Obj2Table("DefaultStruct2") for _, table := range tables { if table.Name == tableName { col := table.GetColumn("name") assert.NotNil(t, col) defaultVal = col.Default isDefaultExist = !col.DefaultIsEmpty break } } assert.False(t, isDefaultExist, fmt.Sprintf("default value is --%v--", defaultVal)) assert.EqualValues(t, "", defaultVal) }
explode_data.jsonl/19211
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 253 }
[ 2830, 3393, 5668, 3675, 17, 1155, 353, 8840, 836, 8, 341, 6948, 35699, 1155, 11, 31166, 4571, 12367, 13158, 7899, 9422, 17, 2036, 341, 197, 67211, 256, 526, 21, 19, 198, 197, 21297, 914, 198, 197, 630, 6948, 12154, 1155, 11, 501, 87...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestLLRBTreeReset(t *testing.T) { context := &commonLLRBTreeTestContextStruct{t: t} context.tree = NewLLRBTree(CompareInt, context) context.tree.Reset() }
explode_data.jsonl/46751
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 62 }
[ 2830, 3393, 4086, 29259, 6533, 14828, 1155, 353, 8840, 836, 8, 341, 28413, 1669, 609, 5464, 4086, 29259, 6533, 2271, 1972, 9422, 90, 83, 25, 259, 532, 28413, 25728, 284, 1532, 4086, 29259, 6533, 7, 27374, 1072, 11, 2266, 340, 28413, 2...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
func TestSyncBlockVolumeDisabled(t *testing.T) { modeBlock := v1.PersistentVolumeBlock modeFile := v1.PersistentVolumeFilesystem // All of these should bind as feature set is not enabled for BlockVolume // meaning volumeMode will be ignored and dropped tests := []controllerTest{ { // syncVolume binds a requested block claim to a block volume "14-1 - binding to volumeMode block", withVolumeVolumeMode(&modeBlock, newVolumeArray("volume14-1", "10Gi", "", "", v1.VolumeAvailable, v1.PersistentVolumeReclaimRetain, classEmpty)), withVolumeVolumeMode(&modeBlock, newVolumeArray("volume14-1", "10Gi", "", "", v1.VolumeAvailable, v1.PersistentVolumeReclaimRetain, classEmpty)), withClaimVolumeMode(&modeBlock, newClaimArray("claim14-1", "uid14-1", "10Gi", "", v1.ClaimPending, nil)), withClaimVolumeMode(&modeBlock, newClaimArray("claim14-1", "uid14-1", "10Gi", "", v1.ClaimPending, nil)), noevents, noerrors, testSyncClaim, }, { // syncVolume binds a requested filesystem claim to a filesystem volume "14-2 - binding to volumeMode filesystem", withVolumeVolumeMode(&modeFile, newVolumeArray("volume14-2", "10Gi", "", "", v1.VolumeAvailable, v1.PersistentVolumeReclaimRetain, classEmpty)), withVolumeVolumeMode(&modeFile, newVolumeArray("volume14-2", "10Gi", "uid14-2", "claim14-2", v1.VolumeBound, v1.PersistentVolumeReclaimRetain, classEmpty, annBoundByController)), withClaimVolumeMode(&modeFile, newClaimArray("claim14-2", "uid14-2", "10Gi", "", v1.ClaimPending, nil)), withClaimVolumeMode(&modeFile, newClaimArray("claim14-2", "uid14-2", "10Gi", "volume14-2", v1.ClaimBound, nil, annBoundByController, annBindCompleted)), noevents, noerrors, testSyncClaim, }, { // syncVolume binds an unspecified volumemode for claim to a specified filesystem volume "14-3 - binding to volumeMode filesystem using default for claim", withVolumeVolumeMode(&modeFile, newVolumeArray("volume14-3", "10Gi", "", "", v1.VolumeAvailable, v1.PersistentVolumeReclaimRetain, classEmpty)), withVolumeVolumeMode(&modeFile, newVolumeArray("volume14-3", "10Gi", "uid14-3", "claim14-3", v1.VolumeBound, v1.PersistentVolumeReclaimRetain, classEmpty, annBoundByController)), withClaimVolumeMode(nil, newClaimArray("claim14-3", "uid14-3", "10Gi", "", v1.ClaimPending, nil)), withClaimVolumeMode(nil, newClaimArray("claim14-3", "uid14-3", "10Gi", "volume14-3", v1.ClaimBound, nil, annBoundByController, annBindCompleted)), noevents, noerrors, testSyncClaim, }, { // syncVolume binds a requested filesystem claim to an unspecified volumeMode for volume "14-4 - binding to unspecified volumeMode using requested filesystem for claim", withVolumeVolumeMode(nil, newVolumeArray("volume14-4", "10Gi", "", "", v1.VolumeAvailable, v1.PersistentVolumeReclaimRetain, classEmpty)), withVolumeVolumeMode(nil, newVolumeArray("volume14-4", "10Gi", "uid14-4", "claim14-4", v1.VolumeBound, v1.PersistentVolumeReclaimRetain, classEmpty, annBoundByController)), withClaimVolumeMode(&modeFile, newClaimArray("claim14-4", "uid14-4", "10Gi", "", v1.ClaimPending, nil)), withClaimVolumeMode(&modeFile, newClaimArray("claim14-4", "uid14-4", "10Gi", "volume14-4", v1.ClaimBound, nil, annBoundByController, annBindCompleted)), noevents, noerrors, testSyncClaim, }, { // syncVolume binds a requested filesystem claim to an unspecified volumeMode for volume "14-5 - binding different volumeModes should be ignored", withVolumeVolumeMode(&modeBlock, newVolumeArray("volume14-5", "10Gi", "", "", v1.VolumeAvailable, v1.PersistentVolumeReclaimRetain, classEmpty)), withVolumeVolumeMode(&modeBlock, newVolumeArray("volume14-5", "10Gi", "", "", v1.VolumeAvailable, v1.PersistentVolumeReclaimRetain, classEmpty)), withClaimVolumeMode(&modeFile, newClaimArray("claim14-5", "uid14-5", "10Gi", "", v1.ClaimPending, nil)), withClaimVolumeMode(&modeFile, newClaimArray("claim14-5", "uid14-5", "10Gi", "", v1.ClaimPending, nil)), noevents, noerrors, testSyncClaim, }, } defer utilfeaturetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, features.BlockVolume, false)() runSyncTests(t, tests, []*storage.StorageClass{ { ObjectMeta: metav1.ObjectMeta{Name: classWait}, VolumeBindingMode: &modeWait, }, }, []*v1.Pod{}) }
explode_data.jsonl/28996
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1457 }
[ 2830, 3393, 12154, 4713, 18902, 25907, 1155, 353, 8840, 836, 8, 341, 60247, 4713, 1669, 348, 16, 61655, 18902, 4713, 198, 60247, 1703, 1669, 348, 16, 61655, 18902, 1703, 8948, 198, 197, 322, 2009, 315, 1493, 1265, 10719, 438, 4565, 738,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestGetBlobStorageMetaData(t *testing.T) { t.Run("Nothing at all passed", func(t *testing.T) { m := make(map[string]string) _, err := getBlobStorageMetadata(m) assert.NotNil(t, err) }) t.Run("All parameters passed and parsed", func(t *testing.T) { m := make(map[string]string) m["accountName"] = "acc" m["accountKey"] = "key" m["containerName"] = "dapr" meta, err := getBlobStorageMetadata(m) assert.Nil(t, err) assert.Equal(t, "acc", meta.accountName) assert.Equal(t, "key", meta.accountKey) assert.Equal(t, "dapr", meta.containerName) }) }
explode_data.jsonl/24156
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 242 }
[ 2830, 3393, 1949, 37985, 5793, 37307, 1155, 353, 8840, 836, 8, 341, 3244, 16708, 445, 23780, 518, 678, 5823, 497, 2915, 1155, 353, 8840, 836, 8, 341, 197, 2109, 1669, 1281, 9147, 14032, 30953, 340, 197, 197, 6878, 1848, 1669, 633, 379...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_limitClock(t *testing.T) { debug("test") lim := newLimiter(1 * time.Second) tests := []struct { name string limit *simpleRateLimit }{ {"", lim}, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { t.Logf("Number of running go routines %v: %v", "before", runtime.NumGoroutine()) go limitClock(tt.limit) <-tt.limit.throttle tt.limit.Stop() time.Sleep(1 * time.Second) t.Logf("Number of running go routines %v: %v", "after", runtime.NumGoroutine()) }) } }
explode_data.jsonl/18853
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 215 }
[ 2830, 3393, 14763, 26104, 1155, 353, 8840, 836, 8, 341, 39730, 445, 1944, 1138, 197, 4659, 1669, 501, 43, 17700, 7, 16, 353, 882, 32435, 340, 78216, 1669, 3056, 1235, 341, 197, 11609, 220, 914, 198, 197, 8810, 2353, 353, 22944, 11564,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestOpen_ReturnsError_WithBadArgs(t *testing.T) { stringRef := "foo" testCases := []interface{}{42, time.Now(), &stringRef} for _, tc := range testCases { t.Run(fmt.Sprintf("%v", tc), func(t *testing.T) { _, err := gorm.Open("postgresql", tc) if err == nil { t.Error("Should got error with invalid database source") } if !strings.HasPrefix(err.Error(), "invalid database source:") { t.Errorf("Should got error starting with \"invalid database source:\", but got %q", err.Error()) } }) } }
explode_data.jsonl/28033
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 204 }
[ 2830, 3393, 5002, 53316, 82, 1454, 62, 2354, 17082, 4117, 1155, 353, 8840, 836, 8, 341, 11357, 3945, 1669, 330, 7975, 698, 18185, 37302, 1669, 3056, 4970, 6257, 90, 19, 17, 11, 882, 13244, 1507, 609, 917, 3945, 532, 2023, 8358, 17130,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestInitializeWallet(t *testing.T) { rand.Seed(time.Now().UnixNano()) userID := rand.Int() addr := test.RandServerAddress(t) err := Create(addr, userID) require.NoError(t, err) err = UnloadWallet(addr, userID) require.NoError(t, err) err = Create(addr, userID) require.NoError(t, err) }
explode_data.jsonl/1639
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 119 }
[ 2830, 3393, 9928, 38259, 1155, 353, 8840, 836, 8, 341, 7000, 437, 5732, 291, 9730, 13244, 1005, 55832, 83819, 2398, 19060, 915, 1669, 10382, 7371, 741, 53183, 1669, 1273, 2013, 437, 5475, 4286, 1155, 692, 9859, 1669, 4230, 24497, 11, 35...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestClientDNSCertificate(t *testing.T) { inputPath := "dnsNameClientCert.pem" expected := lint.NA out := test.TestLint("e_dnsname_bad_character_in_label", inputPath) if out.Status != expected { t.Errorf("%s: expected %s, got %s", inputPath, expected, out.Status) } }
explode_data.jsonl/47144
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 107 }
[ 2830, 3393, 2959, 61088, 33202, 1155, 353, 8840, 836, 8, 341, 22427, 1820, 1669, 330, 45226, 675, 2959, 36934, 49373, 698, 42400, 1669, 57920, 2067, 32, 198, 13967, 1669, 1273, 8787, 47556, 445, 68, 71125, 606, 34199, 40988, 1243, 6106, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestFileExistingFiles(t *testing.T) { fh1 := createFile() defer os.Remove(fh1.Name()) fh2 := createFile() defer os.Remove(fh2.Name()) fh3 := createFile() defer os.Remove(fh3.Name()) s, _ := serializers.NewCirconusSerializer(time.Millisecond) f := File{ Files: []string{fh1.Name(), fh2.Name(), fh3.Name()}, serializer: s, } err := f.Connect() assert.NoError(t, err) _, err = f.Write(testutil.MockMetrics()) assert.NoError(t, err) validateFile(fh1.Name(), expExistFile, t) validateFile(fh2.Name(), expExistFile, t) validateFile(fh3.Name(), expExistFile, t) err = f.Close() assert.NoError(t, err) }
explode_data.jsonl/3857
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 281 }
[ 2830, 3393, 1703, 53067, 10809, 1155, 353, 8840, 836, 8, 341, 1166, 71, 16, 1669, 1855, 1703, 741, 16867, 2643, 13270, 89148, 16, 2967, 2398, 1166, 71, 17, 1669, 1855, 1703, 741, 16867, 2643, 13270, 89148, 17, 2967, 2398, 1166, 71, 18...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestGetJobConfigInvalidResponse(t *testing.T) { httpmock.Activate() defer httpmock.DeactivateAndReset() ctx := context.Background() responder, _ := httpmock.NewJsonResponder(200, invalidTestResponse) httpmock.RegisterResponder("GET", fakeJobConfigURL, responder) client := getTestJobManagerClient() resp, err := client.GetJobConfig(ctx, testURL, "1") assert.Nil(t, resp) assert.NotNil(t, err) }
explode_data.jsonl/32357
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 144 }
[ 2830, 3393, 1949, 12245, 2648, 7928, 2582, 1155, 353, 8840, 836, 8, 341, 28080, 16712, 14140, 731, 741, 16867, 1758, 16712, 8934, 16856, 3036, 14828, 741, 20985, 1669, 2266, 19047, 741, 10202, 20328, 11, 716, 1669, 1758, 16712, 7121, 5014...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestPullImages(t *testing.T) { tests := map[string]struct { client docker.Docker wantErrorCount int }{ "simple": { client: FakeDockerClient{ imageExists: false, pullFails: false, }, wantErrorCount: 0, }, "image exists": { client: FakeDockerClient{ imageExists: true, pullFails: false, }, wantErrorCount: 0, }, "error pulling image": { client: FakeDockerClient{ imageExists: false, pullFails: true, }, wantErrorCount: 1, }, } for name, tc := range tests { t.Run(name, func(t *testing.T) { imgClient := ImageClient{ dockerClient: tc.client, } got := imgClient.PullImages(imgs, 0) if len(got) != tc.wantErrorCount { t.Fatalf("Expected errors: %d but got %d", tc.wantErrorCount, len(got)) } }) } }
explode_data.jsonl/61547
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 370 }
[ 2830, 3393, 36068, 14228, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 2415, 14032, 60, 1235, 341, 197, 25291, 260, 26588, 909, 13659, 198, 197, 50780, 1454, 2507, 526, 198, 197, 59403, 197, 197, 1, 22944, 788, 341, 298, 25291, 25, 3696...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestRailsFKUsage(t *testing.T) { store, clean := testkit.CreateMockStore(t) defer clean() tk := testkit.NewTestKit(t, store) tk.MustExec("use test") tk.MustExec(`CREATE TABLE author_addresses ( id bigint(20) NOT NULL AUTO_INCREMENT, PRIMARY KEY (id) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4`) tk.MustExec(`CREATE TABLE authors ( id bigint(20) NOT NULL AUTO_INCREMENT, name varchar(255) NOT NULL, author_address_id bigint(20) DEFAULT NULL, author_address_extra_id bigint(20) DEFAULT NULL, organization_id varchar(255) DEFAULT NULL, owned_essay_id varchar(255) DEFAULT NULL, PRIMARY KEY (id), KEY index_authors_on_author_address_id (author_address_id), KEY index_authors_on_author_address_extra_id (author_address_extra_id), CONSTRAINT fk_rails_94423a17a3 FOREIGN KEY (author_address_id) REFERENCES author_addresses (id) ON UPDATE CASCADE ON DELETE RESTRICT ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4`) tk.MustQuery(`SELECT fk.referenced_table_name AS 'to_table', fk.referenced_column_name AS 'primary_key', fk.column_name AS 'column', fk.constraint_name AS 'name', rc.update_rule AS 'on_update', rc.delete_rule AS 'on_delete' FROM information_schema.referential_constraints rc JOIN information_schema.key_column_usage fk USING (constraint_schema, constraint_name) WHERE fk.referenced_column_name IS NOT NULL AND fk.table_schema = database() AND fk.table_name = 'authors';`).Check(testkit.Rows("author_addresses id author_address_id fk_rails_94423a17a3 CASCADE RESTRICT")) }
explode_data.jsonl/65600
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 615 }
[ 2830, 3393, 52490, 26998, 14783, 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, 340, 3244, 74, 50463, 10216...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1