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 TestState_UpdateNickSelfNilMaps(t *testing.T) { t.Parallel() st := setupNewState() ev := &irc.Event{ Name: irc.NICK, Sender: users[0], Args: []string{nicks[1]}, } st.addUser(users[0]) st.Update(ev) _, ok := st.userChannels[nicks[0]] if got, exp := ok, false; exp != got { t.Errorf("Expected: %v, got: %v", exp, got) } _, ok = st.userChannels[nicks[1]] if got, exp := ok, false; exp != got { t.Errorf("Expected: %v, got: %v", exp, got) } }
explode_data.jsonl/32092
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 221 }
[ 2830, 3393, 1397, 47393, 30356, 12092, 19064, 36562, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 2822, 18388, 1669, 6505, 3564, 1397, 741, 74837, 1669, 609, 2437, 6904, 515, 197, 21297, 25, 256, 79923, 2067, 10685, 345, 197, 7568, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestSafeWriteConfigWithExistingFile(t *testing.T) { v := New() fs := afero.NewMemMapFs() fs.Create("/test/c.yaml") v.SetFs(fs) v.AddConfigPath("/test") v.SetConfigName("c") v.SetConfigType("yaml") err := v.SafeWriteConfig() require.Error(t, err) _, ok := err.(ConfigFileAlreadyExistsError) assert.True(t, ok, "Expected ConfigFileAlreadyExistsError") }
explode_data.jsonl/9912
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 148 }
[ 2830, 3393, 25663, 7985, 2648, 2354, 53067, 1703, 1155, 353, 8840, 836, 8, 341, 5195, 1669, 1532, 741, 53584, 1669, 264, 802, 78, 7121, 18816, 2227, 48300, 741, 53584, 7251, 4283, 1944, 2899, 33406, 1138, 5195, 4202, 48300, 31856, 340, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestOpenShiftClusterStaticValidateMasterProfile(t *testing.T) { tests := []*validateTest{ { name: "valid", }, { name: "vmSize unsupported", modify: func(oc *OpenShiftCluster) { oc.Properties.MasterProfile.VMSize = VMSizeStandardD2sV3 }, wantErr: "400: InvalidParameter: properties.masterProfile.vmSize: The provided master VM size 'Standard_D2s_v3' is invalid.", }, { name: "subnetId invalid", modify: func(oc *OpenShiftCluster) { oc.Properties.MasterProfile.SubnetID = "invalid" }, wantErr: "400: InvalidParameter: properties.masterProfile.subnetId: The provided master VM subnet 'invalid' is invalid.", }, { name: "subnet subscriptionId not matching cluster subscriptionId", modify: func(oc *OpenShiftCluster) { oc.Properties.MasterProfile.SubnetID = "/subscriptions/7a3036d1-60a1-4605-8a41-44955e050804/resourcegroups/test-vnet/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/master" }, wantErr: "400: InvalidParameter: properties.masterProfile.subnetId: The provided master VM subnet '/subscriptions/7a3036d1-60a1-4605-8a41-44955e050804/resourcegroups/test-vnet/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/master' is invalid: must be in same subscription as cluster.", }, } runTests(t, testModeCreate, tests) runTests(t, testModeUpdate, tests) }
explode_data.jsonl/39083
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 505 }
[ 2830, 3393, 5002, 24841, 28678, 11690, 17926, 18041, 8526, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 29838, 7067, 2271, 515, 197, 197, 515, 298, 11609, 25, 330, 1891, 756, 197, 197, 1583, 197, 197, 515, 298, 11609, 25, 330, 7338, 169...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestEndToEnd(t *testing.T) { receiverConfig := loadConfigAssertNoError(t, config.NewComponentIDWithName(typeStr, "end_to_end_test/2")) // e2e test with port undefined by user endToEndScrapeTest(t, receiverConfig, "end-to-end port not defined") }
explode_data.jsonl/1739
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 88 }
[ 2830, 3393, 3727, 66573, 1155, 353, 8840, 836, 8, 341, 17200, 12862, 2648, 1669, 2795, 2648, 8534, 2753, 1454, 1155, 11, 2193, 7121, 2189, 915, 54523, 5808, 2580, 11, 330, 408, 2346, 6213, 4452, 14, 17, 28075, 197, 322, 384, 17, 68, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestAccessibleReposEnv_Repos(t *testing.T) { assert.NoError(t, PrepareTestDatabase()) org := AssertExistsAndLoadBean(t, &User{ID: 3}).(*User) testSuccess := func(userID int64, expectedRepoIDs []int64) { env, err := org.AccessibleReposEnv(userID) assert.NoError(t, err) repos, err := env.Repos(1, 100) assert.NoError(t, err) expectedRepos := make([]*Repository, len(expectedRepoIDs)) for i, repoID := range expectedRepoIDs { expectedRepos[i] = AssertExistsAndLoadBean(t, &Repository{ID: repoID}).(*Repository) } assert.Equal(t, expectedRepos, repos) } testSuccess(2, []int64{3, 5, 32}) testSuccess(4, []int64{3, 32}) }
explode_data.jsonl/71075
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 274 }
[ 2830, 3393, 55390, 693, 966, 14359, 50693, 966, 1155, 353, 8840, 836, 8, 341, 6948, 35699, 1155, 11, 31166, 2271, 5988, 2398, 87625, 1669, 5319, 15575, 3036, 5879, 10437, 1155, 11, 609, 1474, 90, 915, 25, 220, 18, 16630, 4071, 1474, 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...
2
func TestDevice_FromPb(t *testing.T) { a := New(t) p := testDev.ToPb() dev := FromPb(p) a.So(dev.AppID, ShouldEqual, testDev.AppID) a.So(dev.DevID, ShouldEqual, testDev.DevID) a.So(dev.Latitude, ShouldEqual, testDev.Latitude) a.So(dev.Longitude, ShouldEqual, testDev.Longitude) a.So(dev.Altitude, ShouldEqual, testDev.Altitude) a.So(p.Attributes, ShouldResemble, testDev.Attributes) }
explode_data.jsonl/53525
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 171 }
[ 2830, 3393, 6985, 53157, 47, 65, 1155, 353, 8840, 836, 8, 341, 11323, 1669, 1532, 1155, 692, 3223, 1669, 1273, 14592, 3274, 47, 65, 741, 27302, 1669, 5542, 47, 65, 1295, 340, 11323, 46387, 17622, 5105, 915, 11, 12260, 2993, 11, 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...
1
func TestConfigDefaultNPSPluginState(t *testing.T) { t.Run("should enable NPS plugin by default", func(t *testing.T) { c1 := Config{} c1.SetDefaults() assert.True(t, c1.PluginSettings.PluginStates["com.mattermost.nps"].Enable) }) t.Run("should enable NPS plugin if diagnostics are enabled", func(t *testing.T) { c1 := Config{ LogSettings: LogSettings{ EnableDiagnostics: NewBool(true), }, } c1.SetDefaults() assert.True(t, c1.PluginSettings.PluginStates["com.mattermost.nps"].Enable) }) t.Run("should not enable NPS plugin if diagnostics are disabled", func(t *testing.T) { c1 := Config{ LogSettings: LogSettings{ EnableDiagnostics: NewBool(false), }, } c1.SetDefaults() assert.False(t, c1.PluginSettings.PluginStates["com.mattermost.nps"].Enable) }) t.Run("should not re-enable NPS plugin after it has been disabled", func(t *testing.T) { c1 := Config{ PluginSettings: PluginSettings{ PluginStates: map[string]*PluginState{ "com.mattermost.nps": { Enable: false, }, }, }, } c1.SetDefaults() assert.False(t, c1.PluginSettings.PluginStates["com.mattermost.nps"].Enable) }) }
explode_data.jsonl/50677
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 469 }
[ 2830, 3393, 2648, 3675, 45, 5012, 11546, 1397, 1155, 353, 8840, 836, 8, 341, 3244, 16708, 445, 5445, 7283, 451, 5012, 9006, 553, 1638, 497, 2915, 1155, 353, 8840, 836, 8, 341, 197, 1444, 16, 1669, 5532, 16094, 197, 1444, 16, 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...
1
func TestSetting_Runtime(t *testing.T) { t.Parallel() now := time.Date(2019, 12, 31, 12, 12, 13, 0, time.Local) // Tuesday tests := []struct { name string start, end time.Time startTime, endTime int dayOfWeek []time.Weekday expected time.Time }{ { name: "before start date", start: now.AddDate(0, 0, 10), end: now.AddDate(0, 0, 11), startTime: 0, endTime: 86400, dayOfWeek: []time.Weekday{time.Sunday, time.Monday, time.Tuesday, time.Wednesday, time.Thursday, time.Friday, time.Saturday}, expected: now.AddDate(0, 0, 10), }, { name: "after end date", start: now.AddDate(0, 0, -10), end: now.AddDate(0, 0, -1), startTime: 0, endTime: 86400, dayOfWeek: []time.Weekday{time.Sunday, time.Monday, time.Tuesday, time.Wednesday, time.Thursday, time.Friday, time.Saturday}, expected: time.Time{}, }, { name: "today now", start: now.AddDate(0, 0, -10), end: now.AddDate(0, 0, 10), startTime: 0, endTime: 86400, dayOfWeek: []time.Weekday{time.Tuesday}, expected: now, }, { name: "today but later", start: now.AddDate(0, 0, -10), end: now.AddDate(0, 0, 10), startTime: 60 * 60 * 14, endTime: 60 * 60 * 18, dayOfWeek: []time.Weekday{time.Tuesday}, expected: time.Date(now.Year(), now.Month(), now.Day(), 14, 0, 0, 0, now.Location()), }, { name: "today but earlier", start: now.AddDate(0, 0, -10), end: now.AddDate(0, 0, 10), startTime: 60 * 60 * 4, endTime: 60 * 60 * 8, dayOfWeek: []time.Weekday{time.Tuesday}, expected: time.Date(now.Year(), now.Month(), now.Day()+7, 4, 0, 0, 0, now.Location()), }, { name: "tomorrow", start: now.AddDate(0, 0, -10), end: now.AddDate(0, 0, 10), startTime: 60 * 60 * 4, endTime: 60 * 60 * 8, dayOfWeek: []time.Weekday{time.Sunday, time.Monday, time.Wednesday, time.Thursday, time.Friday, time.Saturday}, expected: time.Date(now.Year(), now.Month(), now.Day()+1, 4, 0, 0, 0, now.Location()), }, } for i, tt := range tests { t.Run(fmt.Sprintf("%d: %s", i, tt.name), func(t *testing.T) { var dayOfWeek int for _, d := range tt.dayOfWeek { dayOfWeek |= 2 << uint(d) } s := Setting{ DayOfWeek: dayOfWeek, StartDay: tt.start, EndDay: tt.end, StartTime: tt.startTime, EndTime: tt.endTime, } runtime := s.Runtime(now) // strip monotonic clock readings with Round(0) so == will work assert.Equal(t, tt.expected.Round(0), runtime.Round(0)) }) } }
explode_data.jsonl/13336
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1280 }
[ 2830, 3393, 15400, 63422, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 2822, 80922, 1669, 882, 8518, 7, 17, 15, 16, 24, 11, 220, 16, 17, 11, 220, 18, 16, 11, 220, 16, 17, 11, 220, 16, 17, 11, 220, 16, 18, 11, 220, 15, 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...
2
func TestDSNReformat(t *testing.T) { for i, tst := range testDSNs { dsn1 := tst.in cfg1, err := ParseDSN(dsn1) if err != nil { t.Error(err.Error()) continue } cfg1.tls = nil // pointer not static res1 := fmt.Sprintf("%+v", cfg1) dsn2 := cfg1.FormatDSN() cfg2, err := ParseDSN(dsn2) if err != nil { t.Error(err.Error()) continue } cfg2.tls = nil // pointer not static res2 := fmt.Sprintf("%+v", cfg2) if res1 != res2 { t.Errorf("%d. %q does not match %q", i, res2, res1) } } }
explode_data.jsonl/70843
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 284 }
[ 2830, 3393, 5936, 45, 693, 2243, 1155, 353, 8840, 836, 8, 972, 2023, 600, 11, 71707, 1669, 2088, 1273, 5936, 47360, 972, 197, 2698, 9613, 16, 1669, 71707, 1858, 319, 197, 50286, 16, 11, 1848, 1669, 14775, 5936, 45, 1500, 9613, 16, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
5
func TestCreateJob_EmptyPipelineSpec(t *testing.T) { store := NewFakeClientManagerOrFatal(util.NewFakeTimeForEpoch()) defer store.Close() manager := NewResourceManager(store) job := &api.Job{ Name: "pp 1", Enabled: true, PipelineSpec: &api.PipelineSpec{ Parameters: []*api.Parameter{ {Name: "param1", Value: "world"}, }, }, } _, err := manager.CreateJob(job) assert.NotNil(t, err) assert.Contains(t, err.Error(), "Failed to fetch workflow spec") }
explode_data.jsonl/28377
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 190 }
[ 2830, 3393, 4021, 12245, 76060, 1595, 34656, 8327, 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, 92272, 1669, 1532, 32498, 31200, 340, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestExifEditor_IsDirty(t *testing.T) { je, _ := NewExifEditorEmpty(true) if !je.IsDirty() { t.Errorf("Expected editor to not be dirty") } je, _ = NewExifEditorEmpty(false) if je.IsDirty() { t.Errorf("Expected editor to not be dirty") } //edit a field which should set the editor to dirty err := je.SetImageDescription("some description") if err != nil { t.Fatalf("Could not set tag: %v", err) } if !je.IsDirty() { t.Errorf("Expected editor to be dirty after setting tag") } }
explode_data.jsonl/79880
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 193 }
[ 2830, 3393, 840, 333, 9410, 31879, 36485, 1155, 353, 8840, 836, 8, 341, 197, 3756, 11, 716, 1669, 1532, 840, 333, 9410, 3522, 3715, 340, 743, 753, 3756, 4506, 36485, 368, 341, 197, 3244, 13080, 445, 18896, 6440, 311, 537, 387, 18595, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestCrJournalCreateDirRenameFileRemoveUnmerged(t *testing.T) { test(t, journal(), users("alice", "bob"), as(alice, mkdir("a"), write("a/b", "hello"), ), as(bob, enableJournal(), pauseJournal(), mkdir("x"), ), as(alice, rm("a/b"), ), as(bob, mkdir("c"), mkfile("c/d", ""), pwriteBSSync("c/d", []byte("test"), 0, false), rename("c/d", "c/e"), rm("c/e"), ), as(bob, rmdir("c"), ), as(bob, resumeJournal(), flushJournal(), ), as(bob, lsdir("a/", m{}), lsdir("", m{"a$": "DIR", "x$": "DIR"}), ), as(alice, lsdir("a/", m{}), lsdir("", m{"a$": "DIR", "x$": "DIR"}), ), ) }
explode_data.jsonl/31383
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 368 }
[ 2830, 3393, 16001, 43494, 4021, 6184, 88757, 1703, 13021, 1806, 40354, 1155, 353, 8840, 836, 8, 341, 18185, 1155, 11, 8322, 3148, 197, 90896, 445, 63195, 497, 330, 47086, 4461, 197, 60451, 17643, 558, 345, 298, 88650, 445, 64, 4461, 298...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestMarkTodoAsComplete(t *testing.T) { t.Log(`Should mark a single todo as done`) mockDB, mock, err := sqlmock.New() if err != nil { t.Error(err) t.Fail() } defer mockDB.Close() userID := uint(1) todoID := uint(1) currentTime := time.Now() mock.ExpectExec(`UPDATE todos.+`). WithArgs(todoID, userID, currentTime). WillReturnResult(sqlmock.NewResult(1, 1)) db := DB{mockDB} if err := db.MarkTodoAsComplete(todoID, userID, currentTime); err != nil { t.Errorf("Failed to mark todo as done: %s", err.Error()) t.Fail() } if err := mock.ExpectationsWereMet(); err != nil { t.Errorf("there were unfulfilled expectations: %s", err) } }
explode_data.jsonl/44579
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 275 }
[ 2830, 3393, 8949, 24176, 2121, 12548, 1155, 353, 8840, 836, 8, 341, 3244, 5247, 5809, 14996, 1868, 264, 3175, 11804, 438, 2814, 24183, 77333, 3506, 11, 7860, 11, 1848, 1669, 5704, 16712, 7121, 741, 743, 1848, 961, 2092, 341, 197, 3244, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
4
func TestGetRemoteTags(t *testing.T) { r := spawnTestRegistrySession(t) tags, err := r.GetRemoteTags([]string{makeURL("/v1/")}, REPO) if err != nil { t.Fatal(err) } assertEqual(t, len(tags), 2, "Expected two tags") assertEqual(t, tags["latest"], imageID, "Expected tag latest to map to "+imageID) assertEqual(t, tags["test"], imageID, "Expected tag test to map to "+imageID) _, err = r.GetRemoteTags([]string{makeURL("/v1/")}, "foo42/baz") if err != ErrRepoNotFound { t.Fatal("Expected ErrRepoNotFound error when fetching tags for bogus repo") } }
explode_data.jsonl/13102
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 217 }
[ 2830, 3393, 1949, 24703, 15930, 1155, 353, 8840, 836, 8, 341, 7000, 1669, 18042, 2271, 15603, 5283, 1155, 340, 3244, 2032, 11, 1848, 1669, 435, 2234, 24703, 15930, 10556, 917, 90, 6927, 3144, 4283, 85, 16, 97112, 2137, 3596, 2045, 340, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestBQInvariantToPreClamping(t *testing.T) { lower, upper := -1.0, 1.0 bq1 := getNoiselessBQ(t, lower, upper) bq2 := getNoiselessBQ(t, lower, upper) for _, i := range createEntries() { bq1.Add(i) bq2.Add(math.Min(math.Max(-1.0, i), 1.0)) } for _, rank := range getRanks() { got, err := bq1.Result(rank) if err != nil { t.Fatalf("Couldn't compute dp result for rank=%f: %v", rank, err) } want, err := bq2.Result(rank) if err != nil { t.Fatalf("Couldn't compute dp result for rank=%f: %v", rank, err) } if !cmp.Equal(got, want) { t.Errorf("Add: Wanted the same result for pre-clamped entries and regularly clamped entries for rank %f got %f, want %f", rank, got, want) } } }
explode_data.jsonl/80639
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 318 }
[ 2830, 3393, 33, 48, 76621, 1249, 4703, 5066, 30457, 1155, 353, 8840, 836, 8, 341, 8810, 1202, 11, 8416, 1669, 481, 16, 13, 15, 11, 220, 16, 13, 15, 198, 2233, 80, 16, 1669, 633, 61819, 1717, 33, 48, 1155, 11, 4722, 11, 8416, 340...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
6
func TestLayer3RouterCreateDelete(t *testing.T) { client, err := clients.NewNetworkV2Client() th.AssertNoErr(t, err) network, err := networking.CreateNetwork(t, client) th.AssertNoErr(t, err) defer networking.DeleteNetwork(t, client, network.ID) router, err := CreateRouter(t, client, network.ID) th.AssertNoErr(t, err) defer DeleteRouter(t, client, router.ID) tools.PrintResource(t, router) newName := tools.RandomString("TESTACC-", 8) newDescription := "" updateOpts := routers.UpdateOpts{ Name: newName, Description: &newDescription, } _, err = routers.Update(client, router.ID, updateOpts).Extract() th.AssertNoErr(t, err) newRouter, err := routers.Get(client, router.ID).Extract() th.AssertNoErr(t, err) tools.PrintResource(t, newRouter) th.AssertEquals(t, newRouter.Name, newName) th.AssertEquals(t, newRouter.Description, newDescription) listOpts := routers.ListOpts{} allPages, err := routers.List(client, listOpts).AllPages() th.AssertNoErr(t, err) allRouters, err := routers.ExtractRouters(allPages) th.AssertNoErr(t, err) var found bool for _, router := range allRouters { if router.ID == newRouter.ID { found = true } } th.AssertEquals(t, found, true) }
explode_data.jsonl/22104
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 481 }
[ 2830, 3393, 9188, 18, 9523, 4021, 6435, 1155, 353, 8840, 836, 8, 341, 25291, 11, 1848, 1669, 8239, 7121, 12320, 53, 17, 2959, 741, 70479, 11711, 2753, 7747, 1155, 11, 1848, 692, 9038, 2349, 11, 1848, 1669, 28030, 7251, 12320, 1155, 11...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestRouterParams(t *testing.T) { r := NewTestRouter(t) r.Resource("/test", PathParam("id", "desc"), QueryParam("i", "desc", int16(0)), QueryParam("f32", "desc", float32(0.0)), QueryParam("f64", "desc", 0.0), QueryParam("schema", "desc", "test", Schema(schema.Schema{Pattern: "^a-z+$"})), QueryParam("items", "desc", []int{}), QueryParam("start", "desc", time.Time{}), ).Get("desc", func(id string, i int16, f32 float32, f64 float64, schema string, items []int, start time.Time) string { return fmt.Sprintf("%s %v %v %v %v %v %v", id, i, f32, f64, schema, items, start) }) w := httptest.NewRecorder() req, _ := http.NewRequest(http.MethodGet, "/test/someId?i=1&f32=1.0&f64=123.45&items=1,2,3&start=2020-01-01T12:00:00Z", nil) r.ServeHTTP(w, req) assert.Equal(t, http.StatusOK, w.Code) assert.Equal(t, "someId 1 1 123.45 test [1 2 3] 2020-01-01 12:00:00 +0000 UTC", w.Body.String()) // Arrays can be sent as JSON arrays w = httptest.NewRecorder() req, _ = http.NewRequest(http.MethodGet, "/test/someId?items=[1,2,3]", nil) r.ServeHTTP(w, req) assert.Equal(t, http.StatusOK, w.Code) // Failure parsing tests w = httptest.NewRecorder() req, _ = http.NewRequest(http.MethodGet, "/test/someId?i=bad", nil) r.ServeHTTP(w, req) assert.Equal(t, http.StatusBadRequest, w.Code) w = httptest.NewRecorder() req, _ = http.NewRequest(http.MethodGet, "/test/someId?f32=bad", nil) r.ServeHTTP(w, req) assert.Equal(t, http.StatusBadRequest, w.Code) w = httptest.NewRecorder() req, _ = http.NewRequest(http.MethodGet, "/test/someId?f64=bad", nil) r.ServeHTTP(w, req) assert.Equal(t, http.StatusBadRequest, w.Code) w = httptest.NewRecorder() req, _ = http.NewRequest(http.MethodGet, "/test/someId?schema=foo1", nil) r.ServeHTTP(w, req) assert.Equal(t, http.StatusBadRequest, w.Code) w = httptest.NewRecorder() req, _ = http.NewRequest(http.MethodGet, "/test/someId?items=1,2,bad", nil) r.ServeHTTP(w, req) assert.Equal(t, http.StatusBadRequest, w.Code) w = httptest.NewRecorder() req, _ = http.NewRequest(http.MethodGet, "/test/someId?start=bad", nil) r.ServeHTTP(w, req) assert.Equal(t, http.StatusBadRequest, w.Code) // Invalid Go number should return an error, may support these in the future. w = httptest.NewRecorder() req, _ = http.NewRequest(http.MethodGet, "/test/someId?items=1e10", nil) r.ServeHTTP(w, req) assert.Equal(t, http.StatusBadRequest, w.Code) }
explode_data.jsonl/66543
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1016 }
[ 2830, 3393, 9523, 4870, 1155, 353, 8840, 836, 8, 341, 7000, 1669, 1532, 2271, 9523, 1155, 692, 7000, 20766, 4283, 1944, 756, 197, 69640, 2001, 445, 307, 497, 330, 8614, 4461, 197, 60362, 2001, 445, 72, 497, 330, 8614, 497, 526, 16, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func Test_createS3Client(t *testing.T) { assert := assert.New(t) type args struct { region string id string secret string } tests := []struct { name string args args wantNil bool wantErr bool }{ { "success-without-credentials", args{ "region", "", "", }, false, false, }, { "success-with-credentials", args{ "region", "id", "secret", }, false, false, }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { got, err := createS3Client(tt.args.region, tt.args.id, tt.args.secret) if (err != nil) != tt.wantErr { t.Errorf("createSession() error = %v, wantErr %v", err, tt.wantErr) return } if !assert.Equal(tt.wantNil, got == nil) { t.Errorf("createSession() = %v, want %v", got, tt.wantNil) } }) } }
explode_data.jsonl/14342
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 422 }
[ 2830, 3393, 8657, 50, 18, 2959, 1155, 353, 8840, 836, 8, 341, 6948, 1669, 2060, 7121, 1155, 340, 13158, 2827, 2036, 341, 197, 197, 3943, 914, 198, 197, 15710, 257, 914, 198, 197, 197, 20474, 914, 198, 197, 532, 78216, 1669, 3056, 12...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestSocketSend(t *testing.T) { expected := "Hello unit test" ctx, sys := setupMockScriptEnv(` name="send" type="testing" function vertical(ctx, domain) local conn, err = socket.connect(ctx, "127.0.0.1", 8080, "tcp") if (err ~= nil and err ~= "") then log(ctx, err) end local n n, err = conn:send("Hello unit test") if (err ~= nil and err ~= "") then log(ctx, err) elseif n == 0 then log(ctx, "failed to send the data") end end `) if ctx == nil || sys == nil { t.Fatal("failed to initialize the scripting environment") } defer func() { _ = sys.Shutdown() }() cfg, bus, err := requests.ContextConfigBus(ctx) if err != nil { t.Fatal("failed to obtain the config and event bus") } errch := make(chan string) fn := func(msg string) { errch <- msg } bus.Subscribe(requests.LogTopic, fn) defer bus.Unsubscribe(requests.LogTopic, fn) ln, err := net.Listen("tcp", "127.0.0.1:8080") if err != nil { t.Fatal("failed to listen on port 8080") } defer ln.Close() datach := make(chan string) go func(ln net.Listener, ch chan string) { conn, err := ln.Accept() if err != nil { ch <- err.Error() return } defer conn.Close() buf := make([]byte, 64) n, err := conn.Read(buf) if err != nil { ch <- err.Error() return } ch <- string(buf[:n]) }(ln, datach) cfg.AddDomain("owasp.org") sys.DataSources()[0].Request(ctx, &requests.DNSRequest{Domain: "owasp.org"}) // Read the initial message generated by the DNS Request <-errch timer := time.NewTimer(time.Duration(15) * time.Second) defer timer.Stop() select { case <-timer.C: t.Error("the test timed out") case msg := <-errch: t.Error(msg) case data := <-datach: if data != expected { t.Error(data) } } }
explode_data.jsonl/51389
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 737 }
[ 2830, 3393, 10286, 11505, 1155, 353, 8840, 836, 8, 341, 42400, 1669, 330, 9707, 4982, 1273, 698, 20985, 11, 5708, 1669, 6505, 11571, 5910, 14359, 61528, 197, 11609, 428, 6681, 698, 197, 13158, 428, 8840, 1837, 197, 7527, 12140, 7502, 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 TestLeftV1(t *testing.T) { cases := []struct { start int64 now int64 period int64 total int64 tenThousandth int64 expect int64 }{ {10000, 10001, 10, 10000, 2, 9998}, {10000, 10011, 10, 10000, 2, 9996}, {10000, 10001, 10, 1e17, 2, 9998 * 1e13}, {10000, 10011, 10, 1e17, 2, 9998 * 9998 * 1e9}, } for _, c := range cases { c := c t.Run("test LeftProportionV1", func(t *testing.T) { create := pty.UnfreezeCreate{ StartTime: c.start, AssetExec: "coins", AssetSymbol: "bty", TotalCount: c.total, Beneficiary: "x", Means: pty.LeftProportionX, MeansOpt: &pty.UnfreezeCreate_LeftProportion{ LeftProportion: &pty.LeftProportion{ Period: c.period, TenThousandth: c.tenThousandth, }, }, } u := &pty.Unfreeze{ TotalCount: c.total, Means: pty.LeftProportionX, StartTime: c.start, MeansOpt: &pty.Unfreeze_LeftProportion{ LeftProportion: &pty.LeftProportion{ Period: c.period, TenThousandth: c.tenThousandth, }, }, } m := leftProportion{} u, err := m.setOpt(u, &create) assert.Nil(t, err) f, err := m.calcFrozen(u, c.now) assert.Nil(t, err) assert.Equal(t, c.expect, f) }) } }
explode_data.jsonl/22552
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 685 }
[ 2830, 3393, 5415, 53, 16, 1155, 353, 8840, 836, 8, 341, 1444, 2264, 1669, 3056, 1235, 341, 197, 21375, 260, 526, 21, 19, 198, 197, 80922, 1843, 526, 21, 19, 198, 197, 197, 19304, 286, 526, 21, 19, 198, 197, 34493, 260, 526, 21, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestHandshakeContextHierarchy(t *testing.T) { c, s := localPipe(t) clientErr := make(chan error, 1) clientConfig := testConfig.Clone() serverConfig := testConfig.Clone() ctx, cancel := context.WithCancel(context.Background()) defer cancel() key := struct{}{} ctx = context.WithValue(ctx, key, true) go func() { defer close(clientErr) defer c.Close() var innerCtx context.Context clientConfig.Certificates = nil clientConfig.GetClientCertificate = func(certificateRequest *CertificateRequestInfo) (*Certificate, error) { if val, ok := certificateRequest.Context().Value(key).(bool); !ok || !val { t.Errorf("GetClientCertificate context was not child of HandshakeContext") } innerCtx = certificateRequest.Context() return &Certificate{ Certificate: [][]byte{testRSACertificate}, PrivateKey: testRSAPrivateKey, }, nil } cli := Client(c, clientConfig) err := cli.HandshakeContext(ctx) if err != nil { clientErr <- err return } select { case <-innerCtx.Done(): default: t.Errorf("GetClientCertificate context was not canceled after HandshakeContext returned.") } }() var innerCtx context.Context serverConfig.Certificates = nil serverConfig.ClientAuth = RequestClientCert serverConfig.GetCertificate = func(clientHello *ClientHelloInfo) (*Certificate, error) { if val, ok := clientHello.Context().Value(key).(bool); !ok || !val { t.Errorf("GetClientCertificate context was not child of HandshakeContext") } innerCtx = clientHello.Context() return &Certificate{ Certificate: [][]byte{testRSACertificate}, PrivateKey: testRSAPrivateKey, }, nil } conn := Server(s, serverConfig) err := conn.HandshakeContext(ctx) if err != nil { t.Errorf("Unexpected server handshake error: %v", err) } select { case <-innerCtx.Done(): default: t.Errorf("GetCertificate context was not canceled after HandshakeContext returned.") } if err := <-clientErr; err != nil { t.Errorf("Unexpected client error: %v", err) } }
explode_data.jsonl/36362
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 709 }
[ 2830, 3393, 2314, 29661, 1972, 85264, 1155, 353, 8840, 836, 8, 341, 1444, 11, 274, 1669, 2205, 34077, 1155, 340, 25291, 7747, 1669, 1281, 35190, 1465, 11, 220, 16, 340, 25291, 2648, 1669, 1273, 2648, 64463, 741, 41057, 2648, 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...
3
func TestAllocValue(t *testing.T) { y := newY(nil, nil, nil) for e := 0xe000; e <= 0xf8ff; e++ { if y.allocatedValues[e] { continue } if g := y.allocValue(); g != e { t.Fatal(g, e) } } for e := 0xf0000; e <= 0xffffd; e++ { if g := y.allocValue(); g != e { t.Fatal(g, e) } } for e := 0x100000; e <= 0x10fffd; e++ { if g := y.allocValue(); g != e { t.Fatal(g, e) } } ok := false func() { defer func() { ok = recover() != nil }() y.allocValue() }() if g, e := ok, true; g != e { t.Fatal(g, e) } }
explode_data.jsonl/28788
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 289 }
[ 2830, 3393, 25154, 1130, 1155, 353, 8840, 836, 8, 341, 14522, 1669, 80384, 27907, 11, 2092, 11, 2092, 340, 2023, 384, 1669, 220, 15, 8371, 15, 15, 15, 26, 384, 2651, 220, 15, 5848, 23, 542, 26, 384, 1027, 341, 197, 743, 379, 13, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestAnonymousField(t *testing.T) { user := User{Name: "anonymous_field", Company: Company{Name: "company"}} DB.Save(&user) var user2 User DB.First(&user2, "name = ?", "anonymous_field") DB.Model(&user2).Related(&user2.Company) if user2.Company.Name != "company" { t.Errorf("Should be able to get anonymous field") } }
explode_data.jsonl/6070
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 121 }
[ 2830, 3393, 32684, 1877, 1155, 353, 8840, 836, 8, 341, 19060, 1669, 2657, 63121, 25, 330, 25280, 5013, 497, 8188, 25, 8188, 63121, 25, 330, 10139, 95642, 45409, 13599, 2099, 872, 692, 2405, 1196, 17, 2657, 198, 45409, 15926, 2099, 872, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestIterateMapInMap(t *testing.T) { const idx = uint32(1) parent := createMapInMap(t, ArrayOfMaps) defer parent.Close() a := createArray(t) defer a.Close() if err := parent.Put(idx, a); err != nil { t.Fatal(err) } var ( key uint32 m *Map entries = parent.Iterate() ) defer m.Close() if !entries.Next(&key, &m) { t.Fatal("Iterator encountered error:", entries.Err()) } if key != 1 { t.Error("Iterator didn't skip first entry") } if m == nil { t.Fatal("Map is nil") } }
explode_data.jsonl/21669
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 229 }
[ 2830, 3393, 8537, 349, 2227, 641, 2227, 1155, 353, 8840, 836, 8, 341, 4777, 7187, 284, 2622, 18, 17, 7, 16, 692, 24804, 1669, 1855, 2227, 641, 2227, 1155, 11, 2910, 2124, 36562, 340, 16867, 2681, 10421, 2822, 11323, 1669, 1855, 1857, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
5
func Test_NewMqMsgStream(t *testing.T) { f := &fixture{t: t} parameters := f.setup() defer f.teardown() factory := &ProtoUDFactory{} for i := range parameters { func(client mqclient.Client) { _, err := NewMqMsgStream(context.Background(), 100, 100, client, factory.NewUnmarshalDispatcher()) assert.Nil(t, err) }(parameters[i].client) } }
explode_data.jsonl/55276
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 146 }
[ 2830, 3393, 39582, 44, 80, 6611, 3027, 1155, 353, 8840, 836, 8, 341, 1166, 1669, 609, 59612, 90, 83, 25, 259, 532, 67543, 1669, 282, 25338, 741, 16867, 282, 31853, 37496, 2822, 1166, 2919, 1669, 609, 31549, 4656, 4153, 16094, 2023, 60...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestStartServerPortUnavailable(t *testing.T) { s, err := NewServer() require.NoError(t, err) // Listen on the next available port listener, err := net.Listen("tcp", ":0") require.NoError(t, err) // Attempt to listen on the port used above. s.UpdateConfig(func(cfg *model.Config) { *cfg.ServiceSettings.ListenAddress = listener.Addr().String() }) serverErr := s.Start() s.Shutdown() require.Error(t, serverErr) }
explode_data.jsonl/47828
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 154 }
[ 2830, 3393, 3479, 5475, 7084, 92928, 1155, 353, 8840, 836, 8, 341, 1903, 11, 1848, 1669, 1532, 5475, 741, 17957, 35699, 1155, 11, 1848, 692, 197, 322, 32149, 389, 279, 1790, 2500, 2635, 198, 14440, 798, 11, 1848, 1669, 4179, 68334, 44...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestAuthService_CreateUser_DuplicateHandling(t *testing.T) { u := st.User{ID: -1, Username: "alle", FirstName: "Alle", LastName: "Alle", Email: "alle@alle.com", Password: "pwd"} dao := dao.MockUserDao{} dao.On("GetByUsername", u.Username).Return(&u, nil) s := AuthService{&mailer, &dao, createTestConfig()} err := s.CreateUser(&u) assert.Equal(t, st.AuthError{Msg: "Username already exists", Status: 400}, err) }
explode_data.jsonl/18890
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 167 }
[ 2830, 3393, 90466, 34325, 1474, 1557, 14070, 38606, 1155, 353, 8840, 836, 8, 341, 10676, 1669, 357, 7344, 90, 915, 25, 481, 16, 11, 29545, 25, 330, 5054, 497, 49467, 25, 330, 70451, 497, 48946, 25, 330, 70451, 497, 8299, 25, 330, 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 TestUname(t *testing.T) { var utsname unix.Utsname err := unix.Uname(&utsname) if err != nil { t.Fatalf("Uname: %v", err) } // conversion from []byte to string, golang.org/issue/20753 t.Logf("OS: %s/%s %s", string(utsname.Sysname[:]), string(utsname.Machine[:]), string(utsname.Release[:])) }
explode_data.jsonl/35463
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 129 }
[ 2830, 3393, 52, 606, 1155, 353, 8840, 836, 8, 341, 2405, 220, 6128, 606, 51866, 5255, 2576, 606, 198, 9859, 1669, 51866, 5255, 606, 2099, 6128, 606, 340, 743, 1848, 961, 2092, 341, 197, 3244, 30762, 445, 52, 606, 25, 1018, 85, 497, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestSyncPodCreatesNetAndContainerPullsImage(t *testing.T) { dm, fakeDocker := newTestDockerManagerWithRealImageManager() dm.podInfraContainerImage = "foo/infra_image:v1" puller := dm.dockerPuller.(*FakeDockerPuller) puller.HasImages = []string{} dm.podInfraContainerImage = "foo/infra_image:v1" pod := makePod("foo", &api.PodSpec{ Containers: []api.Container{ {Name: "bar", Image: "foo/something:v0", ImagePullPolicy: "IfNotPresent"}, }, }) runSyncPod(t, dm, fakeDocker, pod, nil, false) verifyCalls(t, fakeDocker, []string{ // Create pod infra container. "create", "start", "inspect_container", "inspect_container", // Create container. "create", "start", "inspect_container", }) fakeDocker.Lock() if !reflect.DeepEqual(puller.ImagesPulled, []string{"foo/infra_image:v1", "foo/something:v0"}) { t.Errorf("unexpected pulled containers: %v", puller.ImagesPulled) } if len(fakeDocker.Created) != 2 || !matchString(t, "/k8s_POD\\.[a-f0-9]+_foo_new_", fakeDocker.Created[0]) || !matchString(t, "/k8s_bar\\.[a-f0-9]+_foo_new_", fakeDocker.Created[1]) { t.Errorf("unexpected containers created %v", fakeDocker.Created) } fakeDocker.Unlock() }
explode_data.jsonl/31162
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 468 }
[ 2830, 3393, 12154, 23527, 54868, 6954, 3036, 4502, 36068, 82, 1906, 1155, 353, 8840, 836, 8, 341, 2698, 76, 11, 12418, 35, 13659, 1669, 501, 2271, 35, 13659, 2043, 2354, 12768, 1906, 2043, 741, 2698, 76, 556, 347, 19433, 956, 4502, 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...
5
func TestEvents(t *testing.T) { mt := NewMockTerminal(2) testEvent := termbox.Event{Type: termbox.EventKey, Key: termbox.KeyCtrlC} mt.PutEvent(testEvent) mt.PutEvent(termbox.Event{Type: termbox.EventKey, Key: termbox.KeyTab}) event, err := mt.TimeoutEvent(time.Second) if err != nil { t.Errorf("unexpected error %v", err) return } if !reflect.DeepEqual(testEvent, event) { t.Errorf("got unexpected event %#v", event) return } if err := mt.Reset(); err != nil { t.Errorf("unexpected error %v", err) return } _, err = mt.TimeoutEvent(time.Second) if err != terminal.ErrEventTimeout { t.Errorf("unexpected error %v", err) return } }
explode_data.jsonl/80612
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 268 }
[ 2830, 3393, 7900, 1155, 353, 8840, 836, 8, 341, 2109, 83, 1669, 1532, 11571, 47890, 7, 17, 340, 18185, 1556, 1669, 4647, 2011, 6904, 90, 929, 25, 4647, 2011, 6904, 1592, 11, 5309, 25, 4647, 2011, 9610, 15001, 34, 532, 2109, 83, 3982...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestRunHooks(t *testing.T) { t.Run( "no error multiple hooks", func(t *testing.T) { var ctrl = gomock.NewController(t) defer ctrl.Finish() reset() Init(DefaultConfig()) var ran = [4]bool{} RegisterLoader( NewMockLoader(ctrl), func(Store) error { ran[0] = true return nil }, ) RegisterLoader( NewMockLoader(ctrl), func(Store) error { ran[1] = true return nil }, ) Group("foo").RegisterLoader( NewMockLoader(ctrl), func(Store) error { ran[2] = true return nil }, ) RegisterKeyHook( "test", func(Store) error { ran[3] = true return nil }, ) require.Nil(t, RunHooks()) require.True(t, ran[0]) require.True(t, ran[1]) require.True(t, ran[2]) require.True(t, ran[3]) }, ) t.Run( "with error multiple hooks", func(t *testing.T) { var ctrl = gomock.NewController(t) defer ctrl.Finish() reset() Init(DefaultConfig()) var ran = [3]bool{} RegisterLoader( NewMockLoader(ctrl), func(Store) error { ran[0] = true return nil }, ) RegisterLoader( NewMockLoader(ctrl), func(Store) error { ran[1] = true return errors.New("err") }, ) RegisterLoader( NewMockLoader(ctrl), func(Store) error { ran[2] = true return nil }, ) require.NotNil(t, RunHooks()) require.True(t, ran[0]) require.True(t, ran[1]) require.False(t, ran[2]) }, ) t.Run( "with error key hook multiple hooks", func(t *testing.T) { var ctrl = gomock.NewController(t) defer ctrl.Finish() reset() Init(DefaultConfig()) var ran = [3]bool{} RegisterLoader( NewMockLoader(ctrl), func(Store) error { ran[0] = true return nil }, ) RegisterKeyHook( "test", func(Store) error { ran[1] = true return errors.New("") }, ) RegisterLoader( NewMockLoader(ctrl), func(Store) error { ran[2] = true return nil }, ) require.NotNil(t, RunHooks()) require.False(t, ran[0]) require.True(t, ran[1]) require.False(t, ran[2]) }, ) t.Run( "with error on group multiple hooks ", func(t *testing.T) { var ctrl = gomock.NewController(t) defer ctrl.Finish() reset() Init(DefaultConfig()) var ran = [3]bool{} RegisterLoader( NewMockLoader(ctrl), func(Store) error { ran[0] = true return nil }, ) Group("foo").RegisterLoader( NewMockLoader(ctrl), func(Store) error { ran[1] = true return errors.New("err") }, ) Group("foo").RegisterLoader( NewMockLoader(ctrl), func(Store) error { ran[2] = true return nil }, ) require.NotNil(t, RunHooks()) require.True(t, ran[0]) require.True(t, ran[1]) require.False(t, ran[2]) }, ) }
explode_data.jsonl/35310
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1439 }
[ 2830, 3393, 6727, 67769, 1155, 353, 8840, 836, 8, 341, 3244, 16708, 1006, 197, 197, 1, 2152, 1465, 5248, 29677, 756, 197, 29244, 1155, 353, 8840, 836, 8, 341, 298, 2405, 23743, 284, 342, 316, 1176, 7121, 2051, 1155, 340, 298, 16867, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestLightMetricSet_VerifyHostDataURI(t *testing.T) { const hostEndpoint = "ceph-restful:8003" const sampleHttpsEndpoint = "https://" + hostEndpoint r := NewRegister() r.MustAddMetricSet("http", "json", newMetricSetWithOption, WithHostParser(func(module Module, host string) (HostData, error) { u, err := url.Parse(host) if err != nil { return HostData{}, err } return HostData{ Host: u.Host, URI: host, }, nil })) r.SetSecondarySource(NewLightModulesSource("testdata/lightmodules")) config, err := common.NewConfigFrom( common.MapStr{ "module": "httpextended", "metricsets": []string{"extends"}, "hosts": []string{sampleHttpsEndpoint}, }) require.NoError(t, err) _, metricSets, err := NewModule(config, r) require.NoError(t, err) require.Len(t, metricSets, 1) assert.Equal(t, hostEndpoint, metricSets[0].Host()) assert.Equal(t, sampleHttpsEndpoint, metricSets[0].HostData().URI) }
explode_data.jsonl/9715
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 389 }
[ 2830, 3393, 13911, 54310, 1649, 2334, 261, 1437, 9296, 1043, 10301, 1155, 353, 8840, 836, 8, 341, 4777, 3468, 27380, 284, 330, 58722, 76233, 1262, 25, 23, 15, 15, 18, 698, 4777, 6077, 92869, 27380, 284, 330, 2428, 52136, 488, 3468, 27...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestDNS(t *testing.T) { dns := filter.NewBuilder(). LD(filter.Word, filter.IMM, 20). LDX(filter.Byte, filter.MSH, 0). ADD(filter.Index, 0). TAX(). Label("lb_0"). LD(filter.Word, filter.IND, 0). JEQ(filter.Const, "", "lb_1", 0x07657861). LD(filter.Word, filter.IND, 4). JEQ(filter.Const, "", "lb_1", 0x6d706c65). LD(filter.Word, filter.IND, 8). JEQ(filter.Const, "", "lb_1", 0x03636f6d). LD(filter.Byte, filter.IND, 12). JEQ(filter.Const, "", "lb_1", 0x00). RET(filter.Const, 1). Label("lb_1"). RET(filter.Const, 0). Build() if dns.String() != test_dns { t.Fatalf("Program mismatch: %s", dns.String()) } }
explode_data.jsonl/11714
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 411 }
[ 2830, 3393, 61088, 1155, 353, 8840, 836, 8, 341, 262, 44077, 1669, 4051, 7121, 3297, 25829, 286, 28877, 19704, 64969, 11, 4051, 47929, 44, 11, 220, 17, 15, 4292, 286, 444, 16591, 19704, 32119, 11, 4051, 1321, 8590, 11, 220, 15, 4292, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestSyncPodsDeletes(t *testing.T) { kubelet, _, fakeDocker := makeTestKubelet(t) fakeDocker.containerList = []docker.APIContainers{ { // the k8s prefix is required for the kubelet to manage the container Names: []string{"/k8s--foo--bar.test"}, ID: "1234", }, { // network container Names: []string{"/k8s--net--foo.test--"}, ID: "9876", }, { Names: []string{"foo"}, ID: "4567", }, } err := kubelet.SyncPods([]Pod{}) if err != nil { t.Errorf("unexpected error: %v", err) } verifyCalls(t, fakeDocker, []string{"list", "list", "stop", "stop"}) // A map iteration is used to delete containers, so must not depend on // order here. expectedToStop := map[string]bool{ "1234": true, "9876": true, } if len(fakeDocker.stopped) != 2 || !expectedToStop[fakeDocker.stopped[0]] || !expectedToStop[fakeDocker.stopped[1]] { t.Errorf("Wrong containers were stopped: %v", fakeDocker.stopped) } }
explode_data.jsonl/2831
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 405 }
[ 2830, 3393, 12154, 23527, 82, 61317, 1155, 353, 8840, 836, 8, 341, 16463, 3760, 1149, 11, 8358, 12418, 35, 13659, 1669, 1281, 2271, 42, 3760, 1149, 1155, 340, 1166, 726, 35, 13659, 18357, 852, 284, 3056, 28648, 24922, 74632, 515, 197, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
5
func TestCreateDefaultConfig(t *testing.T) { factory := NewFactory() cfg := factory.CreateDefaultConfig() assert.NotNil(t, cfg, "failed to create default config") assert.NoError(t, configtest.CheckConfigStruct(cfg)) }
explode_data.jsonl/73106
{ "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, 4021, 3675, 2648, 1155, 353, 8840, 836, 8, 341, 1166, 2919, 1669, 1532, 4153, 741, 50286, 1669, 8633, 7251, 3675, 2648, 741, 6948, 93882, 1155, 11, 13286, 11, 330, 16091, 311, 1855, 1638, 2193, 1138, 6948, 35699, 1155, 11, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
func TestEmptyImport(t *testing.T) { p, err := Import("", Default.GOROOT, FindOnly) if err == nil { t.Fatal(`Import("") returned nil error.`) } if p == nil { t.Fatal(`Import("") returned nil package.`) } if p.ImportPath != "" { t.Fatalf("ImportPath=%q, want %q.", p.ImportPath, "") } }
explode_data.jsonl/513
{ "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, 3522, 11511, 1155, 353, 8840, 836, 8, 341, 3223, 11, 1848, 1669, 13213, 19814, 7899, 1224, 868, 53837, 11, 7379, 7308, 340, 743, 1848, 621, 2092, 341, 197, 3244, 26133, 5809, 11511, 39047, 5927, 2092, 1465, 14908, 340, 197, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
4
func TestCreatePassiveSellOfferValidateSellingAsset(t *testing.T) { kp0 := newKeypair0() kp1 := newKeypair1() sourceAccount := NewSimpleAccount(kp1.Address(), int64(41137196761100)) createPassiveOffer := CreatePassiveSellOffer{ Selling: CreditAsset{"ABCD0123456789", kp0.Address()}, Buying: NativeAsset{}, Amount: "10", Price: "1.0", } _, err := NewTransaction( TransactionParams{ SourceAccount: &sourceAccount, IncrementSequenceNum: false, Operations: []Operation{&createPassiveOffer}, BaseFee: MinBaseFee, Timebounds: NewInfiniteTimeout(), }, ) if assert.Error(t, err) { expected := `validation failed for *txnbuild.CreatePassiveSellOffer operation: Field: Selling, Error: asset code length must be between 1 and 12 characters` assert.Contains(t, err.Error(), expected) } }
explode_data.jsonl/29367
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 346 }
[ 2830, 3393, 4021, 12187, 533, 68533, 39462, 17926, 50, 6293, 16604, 1155, 353, 8840, 836, 8, 341, 16463, 79, 15, 1669, 501, 6608, 1082, 1310, 15, 741, 16463, 79, 16, 1669, 501, 6608, 1082, 1310, 16, 741, 47418, 7365, 1669, 1532, 16374...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestSplitCheckKubeServerVersion(t *testing.T) { defer func() { executeCommandFunc = keptnutils.ExecuteCommand }() var executeOutput string var executeError error executeCommandFunc = func(string, []string) (string, error) { return executeOutput, executeError } for _, tt := range checkSplitTests { t.Run(tt.constraints, func(t *testing.T) { executeOutput = tt.executeOutput executeError = tt.executeError err := CheckKubeServerVersion(tt.constraints) if tt.err == "" { require.NoError(t, err) } else { require.EqualError(t, err, tt.err) } }) } }
explode_data.jsonl/67735
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 231 }
[ 2830, 3393, 20193, 3973, 42, 3760, 5475, 5637, 1155, 353, 8840, 836, 8, 341, 16867, 2915, 368, 341, 197, 8122, 3068, 4062, 9626, 284, 8604, 77, 6031, 13827, 4062, 198, 197, 69826, 2405, 9026, 5097, 914, 198, 2405, 9026, 1454, 1465, 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 TestWaiter(t *testing.T) { var ( w = newWaiter() waitTime = time.Second startTime = time.Now() doneTime time.Time done = make(chan struct{}) ) go func() { defer close(done) if err := w.wait(10 * time.Second); err != nil { t.Errorf("failed to wait: %v", err) return } doneTime = time.Now() }() time.Sleep(waitTime) w.done() <-done if doneTime.Sub(startTime) < waitTime { t.Errorf("wait time is too short: %v; want %v", doneTime.Sub(startTime), waitTime) } }
explode_data.jsonl/42294
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 229 }
[ 2830, 3393, 14190, 261, 1155, 353, 8840, 836, 8, 341, 2405, 2399, 197, 6692, 260, 284, 501, 14190, 261, 741, 197, 48750, 1462, 220, 284, 882, 32435, 198, 197, 21375, 1462, 284, 882, 13244, 741, 197, 40495, 1462, 220, 882, 16299, 198, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestTreapPutGetDelete(t *testing.T) { treap := NewTreap() _, ok := treap.Get(c(3)) if ok { t.Error("should not contain 3") } treap.Put(c(3), 44) v, ok := treap.Get(c(3)) if !ok { t.Error("should contain 3") } if v != 44 { t.Error("should be 44") } v, ok = treap.Delete(c(3)) if !ok { t.Error("should contain 3") } if v != 44 { t.Error("should be 44") } v, ok = treap.Get(c(3)) if ok { t.Error("should not contain 3") } v, ok = treap.Delete(c(3)) if v == 44 { t.Error("should not be 44") } if ok { t.Error("should not contain 3") } }
explode_data.jsonl/51549
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 278 }
[ 2830, 3393, 65775, 391, 19103, 1949, 6435, 1155, 353, 8840, 836, 8, 341, 3244, 265, 391, 1669, 1532, 65775, 391, 741, 197, 6878, 5394, 1669, 4258, 391, 2234, 1337, 7, 18, 1171, 743, 5394, 341, 197, 3244, 6141, 445, 5445, 537, 6644, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
9
func TestInsert5AndRemove1AndRootShouldBeNode4(t *testing.T) { tree := NewArtTree() for i := 0; i < 5; i++ { tree.Insert([]byte{byte(i)}, []byte{byte(i)}) } tree.Remove([]byte{1}) res := *(tree.root.FindChild(byte(1))) if res != nil { t.Error("Did not expect to find child after removal") } if tree.size != 4 { t.Error("Unexpected tree size after inserting and removing") } if tree.root == nil || tree.root.nodeType != NODE4 { t.Error("Unexpected root node after inserting and removing") } }
explode_data.jsonl/43959
{ "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, 13780, 20, 3036, 13021, 16, 3036, 8439, 14996, 3430, 1955, 19, 1155, 353, 8840, 836, 8, 341, 51968, 1669, 1532, 9286, 6533, 2822, 2023, 600, 1669, 220, 15, 26, 600, 366, 220, 20, 26, 600, 1027, 341, 197, 51968, 23142, 10...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestRequiredWithoutAll(t *testing.T) { fieldVal := "test" test := struct { Field1 string `validate:"omitempty" json:"field_1"` Field2 *string `validate:"required_without_all=Field1" json:"field_2"` Field3 map[string]string `validate:"required_without_all=Field2" json:"field_3"` Field4 interface{} `validate:"required_without_all=Field3" json:"field_4"` Field5 string `validate:"required_without_all=Field3" json:"field_5"` }{ Field1: "", Field2: &fieldVal, Field3: map[string]string{"key": "val"}, Field4: "test", Field5: "test", } validate := New() errs := validate.Struct(test) Equal(t, errs, nil) test2 := struct { Field1 string `validate:"omitempty" json:"field_1"` Field2 *string `validate:"required_without_all=Field1" json:"field_2"` Field3 map[string]string `validate:"required_without_all=Field2" json:"field_3"` Field4 interface{} `validate:"required_without_all=Field3" json:"field_4"` Field5 string `validate:"required_without_all=Field3" json:"field_5"` Field6 string `validate:"required_without_all=Field1 Field3" json:"field_6"` }{ Field3: map[string]string{"key": "val"}, Field4: "test", Field5: "test", } errs = validate.Struct(test2) NotEqual(t, errs, nil) ve := errs.(ValidationErrors) Equal(t, len(ve), 1) AssertError(t, errs, "Field2", "Field2", "Field2", "Field2", "required_without_all") }
explode_data.jsonl/77370
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 629 }
[ 2830, 3393, 8164, 26040, 2403, 1155, 353, 8840, 836, 8, 1476, 39250, 2208, 1669, 330, 1944, 698, 18185, 1669, 2036, 341, 197, 94478, 16, 914, 310, 1565, 7067, 2974, 19967, 1, 2951, 2974, 2566, 62, 16, 8805, 197, 94478, 17, 353, 917, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestNiceConfig_GetInt(t *testing.T) { container := tests.InitBaseContainer() container.Bind(&env.NiceEnvProvider{}) Convey("test nice env normal case", t, func() { appService := container.MustMake(contract.AppKey).(contract.App) envService := container.MustMake(contract.EnvKey).(contract.Env) folder := filepath.Join(appService.ConfigFolder(), envService.AppEnv()) serv, err := NewNiceConfig(container, folder, map[string]string{}) So(err, ShouldBeNil) conf := serv.(*NiceConfig) timeout := conf.GetString("database.mysql.timeout") So(timeout, ShouldEqual, "10s") }) }
explode_data.jsonl/62522
{ "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, 44978, 2648, 13614, 1072, 1155, 353, 8840, 836, 8, 341, 53290, 1669, 7032, 26849, 3978, 4502, 741, 53290, 32451, 2099, 3160, 2067, 558, 14359, 5179, 37790, 93070, 5617, 445, 1944, 6419, 6105, 4622, 1142, 497, 259, 11, 2915, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestCatalog_ListNodes_NodeMetaFilter(t *testing.T) { t.Parallel() dir1, s1 := testServer(t) defer os.RemoveAll(dir1) defer s1.Shutdown() codec := rpcClient(t, s1) defer codec.Close() testrpc.WaitForLeader(t, s1.RPC, "dc1") // Add a new node with the right meta k/v pair node := &structs.Node{Node: "foo", Address: "127.0.0.1", Meta: map[string]string{"somekey": "somevalue"}} if err := s1.fsm.State().EnsureNode(1, node); err != nil { t.Fatalf("err: %v", err) } // Filter by a specific meta k/v pair args := structs.DCSpecificRequest{ Datacenter: "dc1", NodeMetaFilters: map[string]string{ "somekey": "somevalue", }, } var out structs.IndexedNodes retry.Run(t, func(r *retry.R) { msgpackrpc.CallWithCodec(codec, "Catalog.ListNodes", &args, &out) if got, want := len(out.Nodes), 1; got != want { r.Fatalf("got %d nodes want %d", got, want) } }) // Verify that only the correct node was returned if out.Nodes[0].Node != "foo" { t.Fatalf("bad: %v", out) } if out.Nodes[0].Address != "127.0.0.1" { t.Fatalf("bad: %v", out) } if v, ok := out.Nodes[0].Meta["somekey"]; !ok || v != "somevalue" { t.Fatalf("bad: %v", out) } // Now filter on a nonexistent meta k/v pair args = structs.DCSpecificRequest{ Datacenter: "dc1", NodeMetaFilters: map[string]string{ "somekey": "invalid", }, } out = structs.IndexedNodes{} err := msgpackrpc.CallWithCodec(codec, "Catalog.ListNodes", &args, &out) if err != nil { t.Fatalf("err: %v", err) } // Should get an empty list of nodes back retry.Run(t, func(r *retry.R) { msgpackrpc.CallWithCodec(codec, "Catalog.ListNodes", &args, &out) if len(out.Nodes) != 0 { r.Fatal(nil) } }) }
explode_data.jsonl/49222
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 742 }
[ 2830, 3393, 41606, 27104, 12288, 41340, 12175, 5632, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 741, 48532, 16, 11, 274, 16, 1669, 1273, 5475, 1155, 340, 16867, 2643, 84427, 14161, 16, 340, 16867, 274, 16, 10849, 18452, 741, 43343...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func Test_trie_MarshalBinary(t *testing.T) { tree := newTrieTree() tree.Add("hello", 9) tree.Add("world", 12) tree.Reset() trie := tree.(*trieTree) assert.Len(t, trie.nodesBuf1, 0) assert.Len(t, trie.nodesBuf2, 0) assert.Len(t, trie.root.children, 0) tree.Add("eleme", 1) tree.Add("eleme", 1) tree.Add("eleme", 3) tree.Add("eleme", 2) tree.Add("eleme.ci", 2) tree.Add("eleme.ci.etrace", 3) tree.Add("eleme.bdi", 4) tree.Add("eleme.other", 5) tree.Add("etrace", 6) tree.Add("java", 7) tree.Add("javascript", 8) tree.Add("j", 9) bin := tree.MarshalBinary() assert.NotNil(t, bin) assert.Equal(t, "ejltaervmaaecs.ecbcorditii.hpeettrrace", string(bin.labels)[2:]) assert.Len(t, bin.values, 9) tree.Reset() }
explode_data.jsonl/2672
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 350 }
[ 2830, 3393, 3547, 645, 1245, 28423, 21338, 1155, 353, 8840, 836, 8, 341, 51968, 1669, 501, 51, 7231, 6533, 741, 51968, 1904, 445, 14990, 497, 220, 24, 340, 51968, 1904, 445, 14615, 497, 220, 16, 17, 692, 51968, 36660, 741, 197, 8927, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestFirestoreBatchGetDocuments(t *testing.T) { var missing string = "missing1069449574" var transaction []byte = []byte("-34") var expectedResponse = &firestorepb.BatchGetDocumentsResponse{ Result: &firestorepb.BatchGetDocumentsResponse_Missing{ Missing: missing, }, Transaction: transaction, } mockFirestore.err = nil mockFirestore.reqs = nil mockFirestore.resps = append(mockFirestore.resps[:0], expectedResponse) var formattedDatabase string = fmt.Sprintf("projects/%s/databases/%s", "[PROJECT]", "[DATABASE]") var documents []string = nil var request = &firestorepb.BatchGetDocumentsRequest{ Database: formattedDatabase, Documents: documents, } c, err := NewClient(context.Background(), clientOpt) if err != nil { t.Fatal(err) } stream, err := c.BatchGetDocuments(context.Background(), request) if err != nil { t.Fatal(err) } resp, err := stream.Recv() if err != nil { t.Fatal(err) } if want, got := request, mockFirestore.reqs[0]; !proto.Equal(want, got) { t.Errorf("wrong request %q, want %q", got, want) } if want, got := expectedResponse, resp; !proto.Equal(want, got) { t.Errorf("wrong response %q, want %q)", got, want) } }
explode_data.jsonl/27380
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 434 }
[ 2830, 3393, 48513, 21074, 1949, 27143, 1155, 353, 8840, 836, 8, 341, 2405, 7402, 914, 284, 330, 30616, 16, 15, 21, 24, 19, 19, 24, 20, 22, 19, 698, 2405, 7745, 3056, 3782, 284, 3056, 3782, 13645, 18, 19, 1138, 2405, 3601, 2582, 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 TestFileServerCleanPath(t *testing.T) { tests := []struct { path string wantCode int wantOpen []string }{ {"/", 200, []string{"/", "/index.html"}}, {"/dir", 301, []string{"/dir"}}, {"/dir/", 200, []string{"/dir", "/dir/index.html"}}, } for _, tt := range tests { var log []string rr := httptest.NewRecorder() req, _ := NewRequest("GET", "http://foo.localhost"+tt.path, nil) FileServer(fileServerCleanPathDir{&log}).ServeHTTP(rr, req) if !reflect.DeepEqual(log, tt.wantOpen) { t.Logf("For %s: Opens = %q; want %q", tt.path, log, tt.wantOpen) } if rr.Code != tt.wantCode { t.Logf("For %s: Response code = %d; want %d", tt.path, rr.Code, tt.wantCode) } } }
explode_data.jsonl/48241
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 312 }
[ 2830, 3393, 1703, 5475, 27529, 1820, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 3056, 1235, 341, 197, 26781, 257, 914, 198, 197, 50780, 2078, 526, 198, 197, 50780, 5002, 3056, 917, 198, 197, 59403, 197, 197, 90, 3115, 497, 220, 17, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
4
func TestCreateNodeAffinitySort(t *testing.T) { assert := assert.New(t) //unsort labels gives sorted result nodeAffinity := createNodeAffinity(map[string]string{ "B": "value2", "A": "value1", "D": "value4", "E": "value5", "C": "value3", }) assert.Equal(nodeAffinity.RequiredDuringSchedulingIgnoredDuringExecution.NodeSelectorTerms[0].MatchExpressions[0].Key, "A") assert.Equal(nodeAffinity.RequiredDuringSchedulingIgnoredDuringExecution.NodeSelectorTerms[0].MatchExpressions[0].Values[0], "value1") assert.Equal(nodeAffinity.RequiredDuringSchedulingIgnoredDuringExecution.NodeSelectorTerms[0].MatchExpressions[1].Key, "B") assert.Equal(nodeAffinity.RequiredDuringSchedulingIgnoredDuringExecution.NodeSelectorTerms[0].MatchExpressions[1].Values[0], "value2") assert.Equal(nodeAffinity.RequiredDuringSchedulingIgnoredDuringExecution.NodeSelectorTerms[0].MatchExpressions[2].Key, "C") assert.Equal(nodeAffinity.RequiredDuringSchedulingIgnoredDuringExecution.NodeSelectorTerms[0].MatchExpressions[2].Values[0], "value3") assert.Equal(nodeAffinity.RequiredDuringSchedulingIgnoredDuringExecution.NodeSelectorTerms[0].MatchExpressions[3].Key, "D") assert.Equal(nodeAffinity.RequiredDuringSchedulingIgnoredDuringExecution.NodeSelectorTerms[0].MatchExpressions[3].Values[0], "value4") assert.Equal(nodeAffinity.RequiredDuringSchedulingIgnoredDuringExecution.NodeSelectorTerms[0].MatchExpressions[4].Key, "E") assert.Equal(nodeAffinity.RequiredDuringSchedulingIgnoredDuringExecution.NodeSelectorTerms[0].MatchExpressions[4].Values[0], "value5") }
explode_data.jsonl/54107
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 531 }
[ 2830, 3393, 4021, 1955, 25841, 13489, 10231, 1155, 353, 8840, 836, 8, 341, 6948, 1669, 2060, 7121, 1155, 692, 197, 322, 359, 6860, 9201, 6696, 10615, 1102, 198, 20831, 25841, 13489, 1669, 1855, 1955, 25841, 13489, 9147, 14032, 30953, 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...
1
func TestStringArrFlag(t *testing.T) { tests := []struct { init []string def string in []string expected []string }{ {nil, "test", nil, []string{"test"}}, {nil, "test", []string{"new"}, []string{"new"}}, {nil, "test", []string{"a", "b"}, []string{"a", "b"}}, {[]string{"default"}, "newdefault", nil, []string{"newdefault"}}, {[]string{"default"}, "newdefault", []string{"arg"}, []string{"arg"}}, {[]string{"default"}, "newdefault", []string{"a", "b"}, []string{"a", "b"}}, {[]string{"default"}, "newdefault", []string{"a", "b", "a", "b"}, []string{"a", "b"}}, } for _, test := range tests { test := test name := fmt.Sprintf("init=%v,default=%v,in=%v,out=%v", test.init, test.def, test.in, test.expected) t.Run(name, func(t *testing.T) { init := make([]string, len(test.init)) copy(init, test.init) fs := flag.NewFlagSet("test", flag.ContinueOnError) flag := StringArrVarFlag(fs, &init, "a", "add") if test.def != "" { flag.SetDefault(test.def) } defaultValue := flag.String() goflagUsage, _ := withStderr(fs.PrintDefaults) goflagExpectedUsage := fmt.Sprintf(" -a value\n \tadd (default %v)\n", defaultValue) cmd := cobra.Command{} cmd.PersistentFlags().AddGoFlag(fs.Lookup("a")) cobraUsage := cmd.LocalFlags().FlagUsages() cobraExpectedUsage := fmt.Sprintf(" -a, --a string add (default \"%v\")\n", defaultValue) for _, v := range test.in { err := flag.Set(v) if err != nil { t.Error(err) } } assert.Equal(t, goflagExpectedUsage, goflagUsage) assert.Equal(t, cobraExpectedUsage, cobraUsage) assert.Equal(t, test.expected, init) assert.Equal(t, test.expected, flag.List()) }) } }
explode_data.jsonl/32976
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 730 }
[ 2830, 3393, 703, 8838, 12135, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 3056, 1235, 341, 197, 28248, 257, 3056, 917, 198, 197, 7452, 414, 914, 198, 197, 17430, 981, 3056, 917, 198, 197, 42400, 3056, 917, 198, 197, 59403, 197, 197, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
4
func TestZKGroupStorageClaimAndGetAndReleasePartition(t *testing.T) { zk := newZKGroupStorage([]string{"127.0.0.1:2181"}, 6*time.Second) err := zk.claimPartition(testGroup, testTopic, 0, testConsumerID) if err != nil { t.Error(err) } err = zk.releasePartition(testGroup, testTopic, 0) if err != nil { t.Error(err) } zk.claimPartition(testGroup, testTopic, 0, testConsumerID) err = zk.claimPartition(testGroup, testTopic, 0, testConsumerID) if err == nil { zk.releasePartition(testGroup, testTopic, 0) t.Error("Expected it can't claim a partition twice, but it did") } cid, err := zk.getPartitionOwner(testGroup, testTopic, 0) if err != nil { zk.releasePartition(testGroup, testTopic, 0) t.Error("get partition owner failed, because: ", err) } if cid != testConsumerID { zk.releasePartition(testGroup, testTopic, 0) t.Error("partition owner get from zookeeper isn't unexpected") } zk.releasePartition(testGroup, testTopic, 0) }
explode_data.jsonl/5650
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 362 }
[ 2830, 3393, 57, 42, 2808, 5793, 45544, 97726, 3036, 16077, 49978, 1155, 353, 8840, 836, 8, 341, 20832, 74, 1669, 501, 57, 42, 2808, 5793, 10556, 917, 4913, 16, 17, 22, 13, 15, 13, 15, 13, 16, 25, 17, 16, 23, 16, 14345, 220, 21, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestRequiredPositionalMultiple(t *testing.T) { var args struct { Input string `arg:"positional"` Multiple []string `arg:"positional,required"` } err := parse("foo", &args) assert.Error(t, err) }
explode_data.jsonl/13003
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 78 }
[ 2830, 3393, 8164, 3812, 278, 32089, 1155, 353, 8840, 836, 8, 341, 2405, 2827, 2036, 341, 197, 66588, 262, 914, 256, 1565, 858, 2974, 966, 3005, 8805, 197, 9209, 12229, 3056, 917, 1565, 858, 2974, 966, 3005, 11, 6279, 8805, 197, 532, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
func TestStoreSafeGetOnSafeReference(t *testing.T) { st, closer := makeStore() defer closer() firstKey := []byte(`firstKey`) firstValue := []byte(`firstValue`) firstTag := []byte(`firstTag`) secondTag := []byte(`secondTag`) firstItem, err := st.Set(schema.KeyValue{Key: firstKey, Value: firstValue}) assert.NoError(t, err) // first item, no prev root ref1 := schema.SafeReferenceOptions{ Ro: &schema.ReferenceOptions{ Reference: firstTag, Key: firstKey, }, } proof, err := st.SafeReference(ref1) assert.NoError(t, err) leaf := api.Digest(proof.Index, firstTag, firstKey) // Here verify if first reference was correctly inserted. We have no root yet. verified := proof.Verify(leaf[:], schema.Root{}) assert.True(t, verified) ref2 := schema.SafeReferenceOptions{ Ro: &schema.ReferenceOptions{ Reference: secondTag, Key: firstKey, }, RootIndex: &schema.Index{ Index: proof.Index, }, } proof2, err := st.SafeReference(ref2) assert.NoError(t, err) prevRoot := proof.NewRoot() leaf2 := api.Digest(proof2.Index, secondTag, firstKey) // Here verify if second reference was correctly inserted. We have root from safeReference 2. verified2 := proof2.Verify(leaf2[:], *prevRoot) assert.True(t, verified2) // first item by first tag , no prev root firstItem1, err := st.SafeGet(schema.SafeGetOptions{ Key: firstTag, RootIndex: &schema.Index{ Index: proof2.Index, }, }) assert.NoError(t, err) assert.NotNil(t, firstItem1) assert.Equal(t, firstKey, firstItem1.Item.Key) assert.Equal(t, firstValue, firstItem1.Item.Value) assert.Equal(t, firstItem.Index, firstItem1.Item.Index) // here verify if the tree in witch the referenced item was inserted is correct assert.True(t, firstItem1.Proof.Verify( firstItem1.Item.Hash(), *proof2.NewRoot(), )) // get first item by second tag with most fresh root firstItem2, err := st.SafeGet(schema.SafeGetOptions{ Key: secondTag, RootIndex: &schema.Index{ Index: proof2.Index, }, }) assert.NoError(t, err) assert.NotNil(t, firstItem2) assert.Equal(t, firstKey, firstItem2.Item.Key) assert.Equal(t, firstValue, firstItem2.Item.Value) assert.Equal(t, firstItem.Index, firstItem2.Item.Index) assert.True(t, firstItem2.Proof.Verify( firstItem2.Item.Hash(), *proof2.NewRoot(), )) lastRoot, err := st.CurrentRoot() assert.NoError(t, err) assert.NotNil(t, lastRoot) assert.Equal(t, *lastRoot, *firstItem2.Proof.NewRoot()) }
explode_data.jsonl/77971
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 937 }
[ 2830, 3393, 6093, 25663, 1949, 1925, 25663, 8856, 1155, 353, 8840, 836, 8, 341, 18388, 11, 12128, 1669, 1281, 6093, 741, 16867, 12128, 2822, 42190, 1592, 1669, 3056, 3782, 5809, 3896, 1592, 24183, 42190, 1130, 1669, 3056, 3782, 5809, 3896...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestPerms(t *testing.T) { conn, err := dbtest.Connect() if err != nil { t.Error(err) return } defer func() { dbtest.Reset(conn) dbtest.Disconnect(conn) }() // seeds the database with a dummy user account. auser := &core.User{Login: "spaceghost"} users := user.New(conn) err = users.Create(noContext, auser) if err != nil { t.Error(err) }/* SAE-411 Release 1.0.4 */ /* build fix for v2 (was caused by PathwayParser refactoring) */ // seeds the database with a dummy repository. arepo := &core.Repository{UID: "1", Slug: "octocat/hello-world"}/* Release 0.95.160 */ repos := repos.New(conn) err = repos.Create(noContext, arepo) if err != nil { t.Error(err) } if err != nil { t.Error(err) }/* FALTA IMAGEM DE FUNDO E ADICIONAR PRODUTOS */ /* We're on 0.2dev for docs */ store := New(conn).(*permStore) t.Run("Create", testPermCreate(store, auser, arepo)) t.Run("Find", testPermFind(store, auser, arepo))/* Closes database connection at every health check */ t.Run("List", testPermList(store, auser, arepo)) t.Run("Update", testPermUpdate(store, auser, arepo)) t.Run("Delete", testPermDelete(store, auser, arepo)) }
explode_data.jsonl/19315
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 453 }
[ 2830, 3393, 3889, 1011, 1155, 353, 8840, 836, 8, 341, 32917, 11, 1848, 1669, 2927, 1944, 43851, 741, 743, 1848, 961, 2092, 341, 197, 3244, 6141, 3964, 340, 197, 853, 198, 197, 532, 16867, 2915, 368, 341, 197, 20939, 1944, 36660, 20571...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestExtractLabelsFromKubeEnv(t *testing.T) { poolLabel := "cloud.google.com/gke-nodepool" preemptibleLabel := "cloud.google.com/gke-preemptible" expectedLabels := map[string]string{ "a": "b", "c": "d", poolLabel: "pool-3", preemptibleLabel: "true", } cases := []struct { desc string env string expect map[string]string err error }{ { desc: "from NODE_LABELS", env: "ENABLE_NODE_PROBLEM_DETECTOR: 'daemonset'\n" + "NODE_LABELS: a=b,c=d,cloud.google.com/gke-nodepool=pool-3,cloud.google.com/gke-preemptible=true\n" + "DNS_SERVER_IP: '10.0.0.10'\n", expect: expectedLabels, err: nil, }, { desc: "from AUTOSCALER_ENV_VARS.node_labels", env: "ENABLE_NODE_PROBLEM_DETECTOR: 'daemonset'\n" + "AUTOSCALER_ENV_VARS: node_labels=a=b,c=d,cloud.google.com/gke-nodepool=pool-3,cloud.google.com/gke-preemptible=true;" + "node_taints='dedicated=ml:NoSchedule,test=dev:PreferNoSchedule,a=b:c';" + "kube_reserved=cpu=1000m,memory=300000Mi;" + "os=linux\n" + "DNS_SERVER_IP: '10.0.0.10'\n", expect: expectedLabels, err: nil, }, { desc: "malformed key-value in AUTOSCALER_ENV_VARS.node_labels", env: "AUTOSCALER_ENV_VARS: node_labels=ab,c=d\n", err: fmt.Errorf("error while parsing key-value list, val: ab"), }, } for _, c := range cases { t.Run(c.desc, func(t *testing.T) { labels, err := extractLabelsFromKubeEnv(c.env) assert.Equal(t, c.err, err) if c.err != nil { return } assert.Equal(t, c.expect, labels) }) } }
explode_data.jsonl/50921
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 820 }
[ 2830, 3393, 28959, 23674, 3830, 42, 3760, 14359, 1155, 353, 8840, 836, 8, 341, 85273, 2476, 1669, 330, 12361, 5713, 905, 4846, 440, 39054, 10285, 698, 40346, 20968, 1238, 2476, 1669, 330, 12361, 5713, 905, 4846, 440, 21334, 20968, 1238, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestGetUserTokensMultiple(t *testing.T) { requests := []*http.Request{} ts := httptest.NewTLSServer( http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { if len(requests) == 0 { fmt.Fprintln(w, getUserTokensPage1Response) } else { fmt.Fprintln(w, getUserTokensPage2Response) } requests = append(requests, r) }), ) defer ts.Close() duo := buildAdminClient(ts.URL, nil) result, err := duo.GetUserTokens("DU3RP9I2WOC59VZX672N") if len(requests) != 2 { t.Errorf("Expected two requets, found %d", len(requests)) } if len(result.Response) != 4 { t.Errorf("Expected four tokens in the response, found %d", len(result.Response)) } if err != nil { t.Errorf("Expected err to be nil, found %s", err) } }
explode_data.jsonl/61414
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 311 }
[ 2830, 3393, 1949, 1474, 29300, 32089, 1155, 353, 8840, 836, 8, 341, 23555, 82, 1669, 29838, 1254, 9659, 16094, 57441, 1669, 54320, 70334, 7121, 13470, 1220, 2836, 1006, 197, 28080, 89164, 18552, 3622, 1758, 37508, 11, 435, 353, 1254, 9659...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestExpandWithExprsSuccess(t *testing.T) { f := func(q, qExpected string) { t.Helper() for i := 0; i < 3; i++ { qExpanded, err := ExpandWithExprs(q) if err != nil { t.Fatalf("unexpected error when expanding %q: %s", q, err) } if qExpanded != qExpected { t.Fatalf("unexpected expanded expression for %q;\ngot\n%q\nwant\n%q", q, qExpanded, qExpected) } } } f(`1`, `1`) f(`foobar`, `foobar`) f(`with (x = 1) x+x`, `2`) f(`with (f(x) = x*x) 3+f(2)+2`, `9`) }
explode_data.jsonl/19190
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 251 }
[ 2830, 3393, 38946, 2354, 16041, 82, 7188, 1155, 353, 8840, 836, 8, 341, 1166, 1669, 2915, 10583, 11, 2804, 18896, 914, 8, 341, 197, 3244, 69282, 741, 197, 2023, 600, 1669, 220, 15, 26, 600, 366, 220, 18, 26, 600, 1027, 341, 298, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
4
func TestRemoveSigningMethod(t *testing.T) { RegisterSigningMethod(MySigningMethod) if GetSigningMethod("SuperSignerAlgorithm1000") == nil { t.Error("Expected SuperSignerAlgorithm1000, got nil") } RemoveSigningMethod(MySigningMethod) if a := GetSigningMethod("SuperSignerAlgorithm1000"); a != nil { t.Errorf("Expected nil, got %v", a) } }
explode_data.jsonl/33942
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 122 }
[ 2830, 3393, 13021, 93358, 3523, 1155, 353, 8840, 836, 8, 341, 79096, 93358, 3523, 37485, 93358, 3523, 692, 743, 2126, 93358, 3523, 445, 19284, 7264, 261, 27847, 16, 15, 15, 15, 899, 621, 2092, 341, 197, 3244, 6141, 445, 18896, 7297, 7...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestSpanStatusCode(t *testing.T) { td := NewTraces() status := td.ResourceSpans().AppendEmpty().InstrumentationLibrarySpans().AppendEmpty().Spans().AppendEmpty().Status() // Check handling of deprecated status code, see spec here: // https://github.com/open-telemetry/opentelemetry-proto/blob/59c488bfb8fb6d0458ad6425758b70259ff4a2bd/opentelemetry/proto/trace/v1/trace.proto#L231 // // 2. New senders, which are aware of the `code` field MUST set both the // `deprecated_code` and `code` fields according to the following rules: // // if code==STATUS_CODE_UNSET then `deprecated_code` MUST be // set to DEPRECATED_STATUS_CODE_OK. status.orig.DeprecatedCode = otlptrace.Status_DEPRECATED_STATUS_CODE_UNKNOWN_ERROR status.SetCode(StatusCodeUnset) assert.EqualValues(t, otlptrace.Status_DEPRECATED_STATUS_CODE_OK, status.orig.DeprecatedCode) // if code==STATUS_CODE_OK then `deprecated_code` MUST be // set to DEPRECATED_STATUS_CODE_OK. status.orig.DeprecatedCode = otlptrace.Status_DEPRECATED_STATUS_CODE_UNKNOWN_ERROR status.SetCode(StatusCodeOk) assert.EqualValues(t, otlptrace.Status_DEPRECATED_STATUS_CODE_OK, status.orig.DeprecatedCode) // if code==STATUS_CODE_ERROR then `deprecated_code` MUST be // set to DEPRECATED_STATUS_CODE_UNKNOWN_ERROR. status.orig.DeprecatedCode = otlptrace.Status_DEPRECATED_STATUS_CODE_OK status.SetCode(StatusCodeError) assert.EqualValues(t, otlptrace.Status_DEPRECATED_STATUS_CODE_UNKNOWN_ERROR, status.orig.DeprecatedCode) }
explode_data.jsonl/79477
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 563 }
[ 2830, 3393, 12485, 15872, 1155, 353, 8840, 836, 8, 341, 76373, 1669, 1532, 1282, 2434, 741, 23847, 1669, 17941, 20766, 6406, 596, 1005, 23877, 3522, 1005, 56324, 367, 16915, 6406, 596, 1005, 23877, 3522, 1005, 6406, 596, 1005, 23877, 3522...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestParseCommandLine2(t *testing.T) { g := NewWithT(t) cmdLine := utils.ParseCommandLine("go test ./test/integration -test.timeout 300s -count 1 --run \"^(TestNSMHealLocalDieNSMD)$\" --tags \"basic recover usecase\" --test.v") g.Expect(len(cmdLine)).To(Equal(12)) }
explode_data.jsonl/59870
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 105 }
[ 2830, 3393, 14463, 71885, 17, 1155, 353, 8840, 836, 8, 341, 3174, 1669, 1532, 2354, 51, 1155, 692, 25920, 2460, 1669, 12439, 8937, 71885, 445, 3346, 1273, 12991, 1944, 31114, 17376, 481, 1944, 36110, 220, 18, 15, 15, 82, 481, 1830, 22...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestExcelizeImage(t *testing.T) { f := excelize.NewFile() // 插入图片 if err := f.AddPicture("Sheet1", "A2", "image.png", ""); err != nil { fmt.Println(err) } // 在工作表中插入图片,并设置图片的缩放比例 if err := f.AddPicture("Sheet1", "E2", "image.jpeg", `{ "x_scale": 0.5, "y_scale": 0.5 }`); err != nil { fmt.Println(err) } // 在工作表中插入图片,并设置图片的打印属性 if err := f.AddPicture("Sheet1", "G2", "image.gif", `{ "x_offset": 15, "y_offset": 10, "print_obj": true, "lock_aspect_ratio": false, "locked": false }`); err != nil { fmt.Println(err) } // 保存文件 if err := f.SaveAs(pathPrefix + "BookImage_out.xlsx"); err != nil { fmt.Println(err) } }
explode_data.jsonl/475
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 440 }
[ 2830, 3393, 20055, 551, 1906, 1155, 353, 8840, 836, 8, 341, 1166, 1669, 3438, 19412, 7121, 1703, 741, 197, 322, 55059, 240, 17254, 45930, 198, 743, 1848, 1669, 282, 1904, 24669, 445, 10541, 16, 497, 330, 32, 17, 497, 330, 1805, 3508, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestNoTLSCertificate(t *testing.T) { // Scenario: The node is sent a message by another node that doesn't // connect with mutual TLS, thus doesn't provide a TLS certificate node1 := newTestNode(t) defer node1.stop() node1.c.Configure(testChannel, []cluster.RemoteNode{node1.nodeInfo}) clientConfig := comm_utils.ClientConfig{ AsyncConnect: true, Timeout: time.Millisecond * 100, SecOpts: comm_utils.SecureOptions{ ServerRootCAs: [][]byte{ca.CertBytes()}, UseTLS: true, }, } cl, err := comm_utils.NewGRPCClient(clientConfig) assert.NoError(t, err) var conn *grpc.ClientConn gt := gomega.NewGomegaWithT(t) gt.Eventually(func() (bool, error) { conn, err = cl.NewConnection(node1.srv.Address()) return true, err }, time.Minute).Should(gomega.BeTrue()) echoClient := orderer.NewClusterClient(conn) stream, err := echoClient.Step(context.Background()) assert.NoError(t, err) err = stream.Send(wrapSubmitReq(testSubReq)) assert.NoError(t, err) _, err = stream.Recv() assert.EqualError(t, err, "rpc error: code = Unknown desc = no TLS certificate sent") }
explode_data.jsonl/39838
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 414 }
[ 2830, 3393, 2753, 13470, 3540, 20962, 1155, 353, 8840, 836, 8, 341, 197, 322, 58663, 25, 576, 2436, 374, 3208, 264, 1943, 553, 2441, 2436, 429, 3171, 944, 198, 197, 322, 4564, 448, 26750, 41654, 11, 8450, 3171, 944, 3410, 264, 41654, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestSocketPVPubKey(t *testing.T) { for _, tc := range socketTestCases(t) { func() { var ( chainID = cmn.RandStr(12) validatorEndpoint, serviceEndpoint = testSetupSocketPair( t, chainID, types.NewMockPV(), tc.addr, tc.dialer) ) defer validatorEndpoint.Stop() defer serviceEndpoint.Stop() clientKey := validatorEndpoint.GetPubKey() privvalPubKey := serviceEndpoint.privVal.GetPubKey() assert.Equal(t, privvalPubKey, clientKey) }() } }
explode_data.jsonl/77979
{ "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, 10286, 47, 13378, 392, 1592, 1155, 353, 8840, 836, 8, 341, 2023, 8358, 17130, 1669, 2088, 7575, 2271, 37302, 1155, 8, 341, 197, 29244, 368, 341, 298, 2405, 2399, 571, 197, 8819, 915, 999, 284, 9961, 77, 2013, 437, 2580, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestAccAWSDBInstance_portUpdate(t *testing.T) { var v rds.DBInstance rName := acctest.RandString(5) resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, CheckDestroy: testAccCheckAWSDBInstanceDestroy, Steps: []resource.TestStep{ { Config: testAccSnapshotInstanceConfig_mysqlPort(rName), Check: resource.ComposeTestCheckFunc( testAccCheckAWSDBInstanceExists("aws_db_instance.bar", &v), resource.TestCheckResourceAttr( "aws_db_instance.bar", "port", "3306"), ), }, { Config: testAccSnapshotInstanceConfig_updateMysqlPort(rName), Check: resource.ComposeTestCheckFunc( testAccCheckAWSDBInstanceExists("aws_db_instance.bar", &v), resource.TestCheckResourceAttr( "aws_db_instance.bar", "port", "3305"), ), }, }, }) }
explode_data.jsonl/33927
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 361 }
[ 2830, 3393, 14603, 36136, 3506, 2523, 8716, 4289, 1155, 353, 8840, 836, 8, 341, 2405, 348, 435, 5356, 22537, 2523, 271, 7000, 675, 1669, 1613, 67880, 2013, 437, 703, 7, 20, 692, 50346, 8787, 1155, 11, 5101, 31363, 515, 197, 197, 4703,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestFibonacciNegative(t *testing.T) { var test_values = []int{-1, -2, -3, -10, -1000, -1000000, math.MinInt64} for _, i := range test_values { if _, err := NewGenerator(i); err == nil { t.Errorf("Expected NewGenerator to return error when asked for %d iterations", i) } } }
explode_data.jsonl/44340
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 116 }
[ 2830, 3393, 37, 579, 39345, 38489, 1155, 353, 8840, 836, 8, 341, 2405, 1273, 9146, 284, 3056, 396, 19999, 16, 11, 481, 17, 11, 481, 18, 11, 481, 16, 15, 11, 481, 16, 15, 15, 15, 11, 481, 16, 15, 15, 15, 15, 15, 15, 11, 6888,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestStaticDriverInfo(t *testing.T) { for _, tc := range []struct { Scenario string input string needsMac bool driver string boot string management string power string raid string vendor string }{ { Scenario: "ipmi", input: "ipmi://192.168.122.1:6233", needsMac: false, driver: "ipmi", boot: "ipxe", management: "", power: "", raid: "", vendor: "", }, { Scenario: "libvirt", input: "libvirt://192.168.122.1", needsMac: true, driver: "ipmi", boot: "ipxe", management: "", power: "", raid: "", vendor: "", }, { Scenario: "idrac", input: "idrac://192.168.122.1", needsMac: false, driver: "idrac", boot: "ipxe", management: "", power: "", raid: "", vendor: "", }, { Scenario: "irmc", input: "irmc://192.168.122.1", needsMac: false, driver: "irmc", boot: "pxe", management: "", power: "", raid: "irmc", vendor: "", }, { Scenario: "redfish", input: "redfish://192.168.122.1", needsMac: true, driver: "redfish", boot: "ipxe", management: "", power: "", raid: "", vendor: "", }, { Scenario: "redfish virtual media", input: "redfish-virtualmedia://192.168.122.1", needsMac: true, driver: "redfish", boot: "redfish-virtual-media", management: "", power: "", raid: "", vendor: "", }, { Scenario: "ilo5 virtual media", input: "ilo5-virtualmedia://192.168.122.1", needsMac: true, driver: "redfish", boot: "redfish-virtual-media", }, { Scenario: "idrac virtual media", input: "idrac-virtualmedia://192.168.122.1", needsMac: true, driver: "idrac", boot: "idrac-redfish-virtual-media", management: "idrac-redfish", power: "idrac-redfish", raid: "no-raid", vendor: "no-vendor", }, } { t.Run(tc.Scenario, func(t *testing.T) { acc, err := NewAccessDetails(tc.input) if err != nil { t.Fatalf("unexpected parse error: %v", err) } if acc.NeedsMAC() != tc.needsMac { t.Fatalf("MAC needed: %v , expected %v", acc.NeedsMAC(), tc.needsMac) } if acc.Driver() != tc.driver { t.Fatalf("Unexpected driver %q, expected %q", acc.Driver(), tc.driver) } if acc.BootInterface() != tc.boot { t.Fatalf("Unexpected boot interface %q, expected %q", acc.BootInterface(), tc.boot) } }) } }
explode_data.jsonl/11830
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1407 }
[ 2830, 3393, 11690, 11349, 1731, 1155, 353, 8840, 836, 8, 341, 2023, 8358, 17130, 1669, 2088, 3056, 1235, 341, 197, 197, 54031, 256, 914, 198, 197, 22427, 414, 914, 198, 197, 197, 55245, 19552, 256, 1807, 198, 197, 33652, 257, 914, 198...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
5
func TestGCAfterPin(t *testing.T) { chunkCount := 50 db := newTestDB(t, &Options{ Capacity: 100, }) pinAddrs := make([]swarm.Address, 0) // upload random chunks for i := 0; i < chunkCount; i++ { ch := generateTestRandomChunk() // call unreserve on the batch with radius 0 so that // localstore is aware of the batch and the chunk can // be inserted into the database unreserveChunkBatch(t, db, 0, ch) _, err := db.Put(context.Background(), storage.ModePutUpload, ch) if err != nil { t.Fatal(err) } // Pin before adding to GC in ModeSetSync err = db.Set(context.Background(), storage.ModeSetPin, ch.Address()) if err != nil { t.Fatal(err) } pinAddrs = append(pinAddrs, ch.Address()) err = db.Set(context.Background(), storage.ModeSetSync, ch.Address()) if err != nil { t.Fatal(err) } } t.Run("pin Index count", newItemsCountTest(db.pinIndex, chunkCount)) t.Run("gc index count", newItemsCountTest(db.gcIndex, int(0))) for _, hash := range pinAddrs { _, err := db.Get(context.Background(), storage.ModeGetRequest, hash) if err != nil { t.Fatal(err) } } }
explode_data.jsonl/11631
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 431 }
[ 2830, 3393, 38, 5049, 1046, 19861, 1155, 353, 8840, 836, 8, 1476, 23049, 3122, 2507, 1669, 220, 20, 15, 271, 20939, 1669, 501, 2271, 3506, 1155, 11, 609, 3798, 515, 197, 6258, 391, 4018, 25, 220, 16, 15, 15, 345, 197, 8824, 3223, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
7
func TestLexMode(t *testing.T) { cases := []struct { Input string Mode lexModeValue }{ { "", lexModeHcl, }, { "foo", lexModeHcl, }, { "{}", lexModeJson, }, { " {}", lexModeJson, }, } for i, tc := range cases { actual := lexMode(tc.Input) if actual != tc.Mode { t.Fatalf("%d: %#v", i, actual) } } }
explode_data.jsonl/34507
{ "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, 47778, 3636, 1155, 353, 8840, 836, 8, 341, 1444, 2264, 1669, 3056, 1235, 341, 197, 66588, 914, 198, 197, 197, 3636, 220, 22429, 3636, 1130, 198, 197, 59403, 197, 197, 515, 298, 197, 39680, 298, 197, 2571, 3636, 39, 564, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestAlphaValidateVolumeDevices(t *testing.T) { volumes := []core.Volume{ {Name: "abc", VolumeSource: core.VolumeSource{PersistentVolumeClaim: &core.PersistentVolumeClaimVolumeSource{ClaimName: "testclaim1"}}}, {Name: "abc-123", VolumeSource: core.VolumeSource{PersistentVolumeClaim: &core.PersistentVolumeClaimVolumeSource{ClaimName: "testclaim2"}}}, {Name: "def", VolumeSource: core.VolumeSource{HostPath: &core.HostPathVolumeSource{Path: "/foo/baz", Type: newHostPathType(string(core.HostPathUnset))}}}, } vols, v1err := ValidateVolumes(volumes, field.NewPath("field")) if len(v1err) > 0 { t.Errorf("Invalid test volumes - expected success %v", v1err) return } disabledAlphaVolDevice := []core.VolumeDevice{ {Name: "abc", DevicePath: "/foo"}, } successCase := []core.VolumeDevice{ {Name: "abc", DevicePath: "/foo"}, {Name: "abc-123", DevicePath: "/usr/share/test"}, } goodVolumeMounts := []core.VolumeMount{ {Name: "xyz", MountPath: "/foofoo"}, {Name: "ghi", MountPath: "/foo/usr/share/test"}, } errorCases := map[string][]core.VolumeDevice{ "empty name": {{Name: "", DevicePath: "/foo"}}, "duplicate name": {{Name: "abc", DevicePath: "/foo"}, {Name: "abc", DevicePath: "/foo/bar"}}, "name not found": {{Name: "not-found", DevicePath: "/usr/share/test"}}, "name found but invalid source": {{Name: "def", DevicePath: "/usr/share/test"}}, "empty devicepath": {{Name: "abc", DevicePath: ""}}, "relative devicepath": {{Name: "abc-123", DevicePath: "baz"}}, "duplicate devicepath": {{Name: "abc", DevicePath: "/foo"}, {Name: "abc-123", DevicePath: "/foo"}}, "no backsteps": {{Name: "def", DevicePath: "/baz/../"}}, "name exists in volumemounts": {{Name: "abc", DevicePath: "/baz/../"}}, "path exists in volumemounts": {{Name: "xyz", DevicePath: "/this/path/exists"}}, "both exist in volumemounts": {{Name: "abc", DevicePath: "/this/path/exists"}}, } badVolumeMounts := []core.VolumeMount{ {Name: "abc", MountPath: "/foo"}, {Name: "abc-123", MountPath: "/this/path/exists"}, } // enable BlockVolume defer utilfeaturetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, features.BlockVolume, true)() // Success Cases: // Validate normal success cases - only PVC volumeSource if errs := ValidateVolumeDevices(successCase, GetVolumeMountMap(goodVolumeMounts), vols, field.NewPath("field")); len(errs) != 0 { t.Errorf("expected success: %v", errs) } // Error Cases: // Validate normal error cases - only PVC volumeSource for k, v := range errorCases { if errs := ValidateVolumeDevices(v, GetVolumeMountMap(badVolumeMounts), vols, field.NewPath("field")); len(errs) == 0 { t.Errorf("expected failure for %s", k) } } // disable BlockVolume defer utilfeaturetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, features.BlockVolume, false)() if errs := ValidateVolumeDevices(disabledAlphaVolDevice, GetVolumeMountMap(goodVolumeMounts), vols, field.NewPath("field")); len(errs) == 0 { t.Errorf("expected failure: %v", errs) } }
explode_data.jsonl/1018
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1177 }
[ 2830, 3393, 19384, 17926, 18902, 40835, 1155, 353, 8840, 836, 8, 341, 5195, 19705, 1669, 3056, 2153, 79106, 515, 197, 197, 63121, 25, 330, 13683, 497, 20265, 3608, 25, 6200, 79106, 3608, 90, 53194, 18902, 45544, 25, 609, 2153, 61655, 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...
6
func TestToFromOtlp(t *testing.T) { otlp := &otlptrace.TracesData{} td := TracesFromInternalRep(internal.TracesFromOtlp(otlp)) assert.EqualValues(t, NewTraces(), td) assert.EqualValues(t, otlp, internal.TracesToOtlp(td.InternalRep())) // More tests in ./tracedata/traces_test.go. Cannot have them here because of // circular dependency. }
explode_data.jsonl/79478
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 130 }
[ 2830, 3393, 1249, 3830, 46, 11544, 79, 1155, 353, 8840, 836, 8, 341, 197, 354, 13545, 1669, 609, 354, 75, 3505, 578, 8240, 2434, 1043, 16094, 76373, 1669, 1163, 2434, 3830, 11569, 18327, 98364, 8240, 2434, 3830, 46, 11544, 79, 7, 354,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestGetServiceCert(t *testing.T) { mockCtrl := gomock.NewController(t) defer mockCtrl.Finish() type testCase struct { certName string certChain []byte privKey []byte expectError bool } testCases := []testCase{ {"foo", []byte("cert-chain"), []byte("priv-key"), false}, {"bar", []byte("cert-chain-2"), []byte("priv-key-2"), false}, } for i, tc := range testCases { t.Run(fmt.Sprintf("Testing test case %d", i), func(t *testing.T) { assert := tassert.New(t) // Mock cert cert := &certificate.Certificate{ CertChain: tc.certChain, PrivateKey: tc.privKey, } // Test the function sdsSecret, err := getServiceCertSecret(cert, tc.certName) assert.Equal(err != nil, tc.expectError) assert.NotNil(sdsSecret) assert.Equal(sdsSecret.GetTlsCertificate().GetCertificateChain().GetInlineBytes(), tc.certChain) assert.Equal(sdsSecret.GetTlsCertificate().GetPrivateKey().GetInlineBytes(), tc.privKey) }) } }
explode_data.jsonl/56036
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 390 }
[ 2830, 3393, 1949, 1860, 36934, 1155, 353, 8840, 836, 8, 341, 77333, 15001, 1669, 342, 316, 1176, 7121, 2051, 1155, 340, 16867, 7860, 15001, 991, 18176, 2822, 13158, 54452, 2036, 341, 197, 1444, 529, 675, 262, 914, 198, 197, 1444, 529, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestShouldUpdateApplicationConfigTerraformResourceStateFromModelWhenTagFilterIsProvided(t *testing.T) { fullLabel := "prefix label suffix" applicationConfig := restapi.ApplicationConfig{ ID: applicationConfigID, Label: fullLabel, TagFilterExpression: defaultTagFilterModel, Scope: restapi.ApplicationConfigScopeIncludeNoDownstream, BoundaryScope: restapi.BoundaryScopeAll, } testHelper := NewTestHelper(t) sut := NewApplicationConfigResourceHandle() resourceData := testHelper.CreateEmptyResourceDataForResourceHandle(sut) err := sut.UpdateState(resourceData, &applicationConfig, testHelper.ResourceFormatter()) require.NoError(t, err) require.Equal(t, applicationConfigID, resourceData.Id()) require.Equal(t, defaultLabel, resourceData.Get(ApplicationConfigFieldLabel)) require.Equal(t, fullLabel, resourceData.Get(ApplicationConfigFieldFullLabel)) _, matchSpecificationSet := resourceData.GetOk(ApplicationConfigFieldMatchSpecification) require.False(t, matchSpecificationSet) require.Equal(t, defaultNormalizedTagFilter, resourceData.Get(ApplicationConfigFieldTagFilter)) require.Equal(t, string(restapi.ApplicationConfigScopeIncludeNoDownstream), resourceData.Get(ApplicationConfigFieldScope)) require.Equal(t, string(restapi.BoundaryScopeAll), resourceData.Get(ApplicationConfigFieldBoundaryScope)) }
explode_data.jsonl/64945
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 430 }
[ 2830, 3393, 14996, 4289, 4988, 2648, 51, 13886, 627, 4783, 1397, 3830, 1712, 4498, 5668, 5632, 3872, 35819, 291, 1155, 353, 8840, 836, 8, 341, 94042, 2476, 1669, 330, 11849, 2383, 20525, 698, 197, 5132, 2648, 1669, 2732, 2068, 17521, 26...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestBlobberGRPCService_GetFileMetaData_FileNotExist(t *testing.T) { req := &blobbergrpc.GetFileMetaDataRequest{ Context: &blobbergrpc.RequestContext{ Client: "client", ClientKey: "", Allocation: "", }, Path: "path", PathHash: "path_hash", AuthToken: "testval", Allocation: "something", } mockStorageHandler := &storageHandlerI{} mockReferencePackage := &mocks.PackageHandler{} mockStorageHandler.On("verifyAllocation", mock.Anything, req.Allocation, true).Return(&allocation.Allocation{ ID: "allocationId", Tx: req.Allocation, }, nil) mockReferencePackage.On("GetReferenceFromLookupHash", mock.Anything, mock.Anything, mock.Anything).Return(nil, errors.New("file doesnt exist")) mockReferencePackage.On("GetCommitMetaTxns", mock.Anything, mock.Anything).Return(nil, nil) mockReferencePackage.On("GetCollaborators", mock.Anything, mock.Anything).Return([]reference.Collaborator{ reference.Collaborator{ RefID: 1, ClientID: "test", }, }, nil) mockReferencePackage.On("IsACollaborator", mock.Anything, mock.Anything, mock.Anything).Return(true) mockStorageHandler.On("verifyAuthTicket", mock.Anything, mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(true, nil) svc := newGRPCBlobberService(mockStorageHandler, mockReferencePackage) _, err := svc.GetFileMetaData(context.Background(), req) if err == nil { t.Fatal("expected error") } }
explode_data.jsonl/66827
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 508 }
[ 2830, 3393, 37985, 652, 8626, 4872, 1860, 13614, 1703, 37307, 34061, 45535, 1155, 353, 8840, 836, 8, 341, 24395, 1669, 609, 35112, 652, 56585, 2234, 1703, 37307, 1900, 515, 197, 70871, 25, 609, 35112, 652, 56585, 9659, 1972, 515, 298, 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 TestMarathonSDRunAndStop(t *testing.T) { var ( refreshInterval = model.Duration(time.Millisecond * 10) conf = SDConfig{Servers: testServers, RefreshInterval: refreshInterval} ch = make(chan []*targetgroup.Group) doneCh = make(chan error) ) md, err := NewDiscovery(conf, nil) if err != nil { t.Fatalf("%s", err) } md.appsClient = func(client *http.Client, url string) (*AppList, error) { return marathonTestAppList(marathonValidLabel, 1), nil } ctx, cancel := context.WithCancel(context.Background()) go func() { md.Run(ctx, ch) close(doneCh) }() timeout := time.After(md.refreshInterval * 3) for { select { case <-ch: cancel() case <-doneCh: cancel() return case <-timeout: t.Fatalf("Update took too long.") } } }
explode_data.jsonl/73165
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 343 }
[ 2830, 3393, 12061, 23941, 5491, 6727, 3036, 10674, 1155, 353, 8840, 836, 8, 341, 2405, 2399, 197, 197, 17168, 10256, 284, 1614, 33795, 9730, 71482, 353, 220, 16, 15, 340, 197, 67850, 310, 284, 8030, 2648, 90, 78139, 25, 1273, 78139, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestWSJWTCookieUser(t *testing.T) { nucSigFunc := func() *jwt.UserClaims { return newJWTTestUserClaims() } nucBearerFunc := func() *jwt.UserClaims { ret := newJWTTestUserClaims() ret.BearerToken = true return ret } o := testWSOptions() setupAddTrusted(o) setupAddCookie(o) s := RunServer(o) buildMemAccResolver(s) defer s.Shutdown() genJwt := func(t *testing.T, nuc *jwt.UserClaims) string { okp, _ := nkeys.FromSeed(oSeed) akp, _ := nkeys.CreateAccount() apub, _ := akp.PublicKey() nac := jwt.NewAccountClaims(apub) ajwt, err := nac.Encode(okp) if err != nil { t.Fatalf("Error generating account JWT: %v", err) } nkp, _ := nkeys.CreateUser() pub, _ := nkp.PublicKey() nuc.Subject = pub jwt, err := nuc.Encode(akp) if err != nil { t.Fatalf("Error generating user JWT: %v", err) } addAccountToMemResolver(s, apub, ajwt) return jwt } cliOpts := testWSClientOptions{ host: o.Websocket.Host, port: o.Websocket.Port, } for _, test := range []struct { name string nuc *jwt.UserClaims opts func(t *testing.T, claims *jwt.UserClaims) (testWSClientOptions, testClaimsOptions) expectAnswer string }{ { name: "protocol auth, non-bearer key, with signature", nuc: nucSigFunc(), opts: func(t *testing.T, claims *jwt.UserClaims) (testWSClientOptions, testClaimsOptions) { return cliOpts, testClaimsOptions{nuc: claims} }, expectAnswer: "+OK", }, { name: "protocol auth, non-bearer key, w/o required signature", nuc: nucSigFunc(), opts: func(t *testing.T, claims *jwt.UserClaims) (testWSClientOptions, testClaimsOptions) { return cliOpts, testClaimsOptions{nuc: claims, dontSign: true} }, expectAnswer: "-ERR", }, { name: "protocol auth, bearer key, w/o signature", nuc: nucBearerFunc(), opts: func(t *testing.T, claims *jwt.UserClaims) (testWSClientOptions, testClaimsOptions) { return cliOpts, testClaimsOptions{nuc: claims, dontSign: true} }, expectAnswer: "+OK", }, { name: "cookie auth, non-bearer key, protocol auth fail", nuc: nucSigFunc(), opts: func(t *testing.T, claims *jwt.UserClaims) (testWSClientOptions, testClaimsOptions) { co := cliOpts co.extraHeaders = map[string]string{} co.extraHeaders["Cookie"] = o.Websocket.JWTCookie + "=" + genJwt(t, claims) return co, testClaimsOptions{connectRequest: struct{}{}} }, expectAnswer: "-ERR", }, { name: "cookie auth, bearer key, protocol auth success with implied cookie jwt", nuc: nucBearerFunc(), opts: func(t *testing.T, claims *jwt.UserClaims) (testWSClientOptions, testClaimsOptions) { co := cliOpts co.extraHeaders = map[string]string{} co.extraHeaders["Cookie"] = o.Websocket.JWTCookie + "=" + genJwt(t, claims) return co, testClaimsOptions{connectRequest: struct{}{}} }, expectAnswer: "+OK", }, { name: "cookie auth, non-bearer key, protocol auth success via override jwt in CONNECT opts", nuc: nucSigFunc(), opts: func(t *testing.T, claims *jwt.UserClaims) (testWSClientOptions, testClaimsOptions) { co := cliOpts co.extraHeaders = map[string]string{} co.extraHeaders["Cookie"] = o.Websocket.JWTCookie + "=" + genJwt(t, claims) return co, testClaimsOptions{nuc: nucBearerFunc()} }, expectAnswer: "+OK", }, } { t.Run(test.name, func(t *testing.T) { cliOpt, claimOpt := test.opts(t, test.nuc) claimOpt.expectAnswer = test.expectAnswer _, c, _, _ := testWSWithClaims(t, s, cliOpt, claimOpt) c.Close() }) } s.Shutdown() }
explode_data.jsonl/42736
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1574 }
[ 2830, 3393, 7433, 41, 54, 7749, 9619, 1474, 1155, 353, 8840, 836, 8, 1476, 9038, 1754, 47246, 9626, 1669, 2915, 368, 353, 41592, 7344, 51133, 314, 470, 501, 55172, 2271, 1474, 51133, 368, 456, 9038, 1754, 26399, 9626, 1669, 2915, 368, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestIsNotFound_nested(t *testing.T) { t.Parallel() testCases := []struct { name string err error expectMatch bool }{ { name: "direct match", err: requestError{ClientError: ClientError{Errors: []clientErrorSubError{{Message: "status code 404"}}}}, expectMatch: true, }, { name: "direct, no match", err: requestError{ClientError: ClientError{Errors: []clientErrorSubError{{Message: "status code 403"}}}}, expectMatch: false, }, { name: "nested match", err: fmt.Errorf("wrapping: %w", requestError{ClientError: ClientError{Errors: []clientErrorSubError{{Message: "status code 404"}}}}), expectMatch: true, }, { name: "nested, no match", err: fmt.Errorf("wrapping: %w", requestError{ClientError: ClientError{Errors: []clientErrorSubError{{Message: "status code 403"}}}}), expectMatch: false, }, } for _, tc := range testCases { t.Run(tc.name, func(t *testing.T) { if result := IsNotFound(tc.err); result != tc.expectMatch { t.Errorf("expected match: %t, got match: %t", tc.expectMatch, result) } }) } }
explode_data.jsonl/6267
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 504 }
[ 2830, 3393, 3872, 10372, 66279, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 741, 18185, 37302, 1669, 3056, 1235, 341, 197, 11609, 286, 914, 198, 197, 9859, 260, 1465, 198, 197, 24952, 8331, 1807, 198, 197, 59403, 197, 197, 515, 2...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestAllocsInterfaceBig(t *testing.T) { if testing.Short() { t.Skip("skipping malloc count in short mode") } v := ValueOf(S{}) if allocs := testing.AllocsPerRun(100, func() { v.Interface() }); allocs > 0 { t.Error("allocs:", allocs) } }
explode_data.jsonl/29617
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 100 }
[ 2830, 3393, 25154, 82, 5051, 15636, 1155, 353, 8840, 836, 8, 341, 743, 7497, 55958, 368, 341, 197, 3244, 57776, 445, 4886, 5654, 15731, 1760, 304, 2805, 3856, 1138, 197, 532, 5195, 1669, 5162, 2124, 3759, 37790, 743, 5574, 82, 1669, 7...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestInfluxDB(t *testing.T) { Convey("InfluxDB", t, func() { datasource := &models.DataSource{ Url: "http://awesome-influxdb:1337", Database: "awesome-db", JsonData: simplejson.New(), } query := "SELECT awesomeness FROM somewhere" e := &InfluxDBExecutor{ QueryParser: &InfluxdbQueryParser{}, ResponseParser: &ResponseParser{}, } Convey("createRequest with GET httpMode", func() { req, _ := e.createRequest(datasource, query) Convey("as default", func() { So(req.Method, ShouldEqual, "GET") }) Convey("has a 'q' GET param that equals to query", func() { q := req.URL.Query().Get("q") So(q, ShouldEqual, query) }) Convey("has an empty body", func() { So(req.Body, ShouldEqual, nil) }) }) Convey("createRequest with POST httpMode", func() { datasource.JsonData.Set("httpMode", "POST") req, _ := e.createRequest(datasource, query) Convey("method should be POST", func() { So(req.Method, ShouldEqual, "POST") }) Convey("has no 'q' GET param", func() { q := req.URL.Query().Get("q") So(q, ShouldEqual, "") }) Convey("has the request as GET param in body", func() { body, _ := ioutil.ReadAll(req.Body) testBodyValues := url.Values{} testBodyValues.Add("q", query) testBody := testBodyValues.Encode() So(string(body[:]), ShouldEqual, testBody) }) }) Convey("createRequest with PUT httpMode", func() { datasource.JsonData.Set("httpMode", "PUT") _, err := e.createRequest(datasource, query) Convey("should miserably fail", func() { So(err, ShouldEqual, ErrInvalidHttpMode) }) }) }) }
explode_data.jsonl/76125
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 687 }
[ 2830, 3393, 641, 36706, 3506, 1155, 353, 8840, 836, 8, 341, 93070, 5617, 445, 641, 36706, 3506, 497, 259, 11, 2915, 368, 341, 197, 2698, 19346, 919, 1669, 609, 6507, 21698, 515, 298, 197, 2864, 25, 414, 330, 1254, 1110, 16875, 3419, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestExportMultiplexing(t *testing.T) { metricSink := newMetricAppender() _, port, doneFn := ocReceiverOnGRPCServer(t, metricSink) defer doneFn() metricsClient, metricsClientDoneFn, err := makeMetricsServiceClient(port) require.NoError(t, err, "Failed to create the gRPC MetricsService_ExportClient: %v", err) defer metricsClientDoneFn() // Step 1) The initiation. initiatingNode := &commonpb.Node{ Identifier: &commonpb.ProcessIdentifier{ Pid: 1, HostName: "multiplexer", }, LibraryInfo: &commonpb.LibraryInfo{Language: commonpb.LibraryInfo_JAVA}, } err = metricsClient.Send(&agentmetricspb.ExportMetricsServiceRequest{Node: initiatingNode}) require.NoError(t, err, "Failed to send the initiating message: %v", err) // Step 1a) Send some metrics without a node, they should be registered as coming from the initiating node. mLi := []*metricspb.Metric{makeMetric(1)} err = metricsClient.Send(&agentmetricspb.ExportMetricsServiceRequest{Node: nil, Metrics: mLi}) require.NoError(t, err, "Failed to send the proxied message from app1: %v", err) // Step 2) Send a "proxied" metrics message from app1 with "node1" node1 := &commonpb.Node{ Identifier: &commonpb.ProcessIdentifier{Pid: 9489, HostName: "nodejs-host"}, LibraryInfo: &commonpb.LibraryInfo{Language: commonpb.LibraryInfo_NODE_JS}, } mL1 := []*metricspb.Metric{makeMetric(2)} err = metricsClient.Send(&agentmetricspb.ExportMetricsServiceRequest{Node: node1, Metrics: mL1}) require.NoError(t, err, "Failed to send the proxied message from app1: %v", err) // Step 3) Send a metrics message without a node but with metrics: this // should be registered as belonging to the last used node i.e. "node1". mLn1 := []*metricspb.Metric{makeMetric(3)} err = metricsClient.Send(&agentmetricspb.ExportMetricsServiceRequest{Node: nil, Metrics: mLn1}) require.NoError(t, err, "Failed to send the proxied message without a node: %v", err) // Step 4) Send a metrics message from a differently proxied node "node2" from app2 node2 := &commonpb.Node{ Identifier: &commonpb.ProcessIdentifier{Pid: 7752, HostName: "golang-host"}, LibraryInfo: &commonpb.LibraryInfo{Language: commonpb.LibraryInfo_GO_LANG}, } mL2 := []*metricspb.Metric{makeMetric(4)} err = metricsClient.Send(&agentmetricspb.ExportMetricsServiceRequest{Node: node2, Metrics: mL2}) require.NoError(t, err, "Failed to send the proxied message from app2: %v", err) // Step 5a) Send a metrics message without a node but with metrics: this // should be registered as belonging to the last used node i.e. "node2". mLn2a := []*metricspb.Metric{makeMetric(5)} err = metricsClient.Send(&agentmetricspb.ExportMetricsServiceRequest{Node: nil, Metrics: mLn2a}) require.NoError(t, err, "Failed to send the proxied message without a node: %v", err) // Step 5b) mLn2b := []*metricspb.Metric{makeMetric(6)} err = metricsClient.Send(&agentmetricspb.ExportMetricsServiceRequest{Node: nil, Metrics: mLn2b}) require.NoError(t, err, "Failed to send the proxied message without a node: %v", err) // Give the process sometime to send data over the wire and perform batching <-time.After(150 * time.Millisecond) // Examination time! resultsMapping := make(map[string][]*metricspb.Metric) metricSink.forEachEntry(func(node *commonpb.Node, metrics []*metricspb.Metric) { resultsMapping[nodeToKey(node)] = metrics }) // First things first, we expect exactly 3 unique keys // 1. Initiating Node // 2. Node 1 // 3. Node 2 if g, w := len(resultsMapping), 3; g != w { t.Errorf("Got %d keys in the results map; Wanted exactly %d\n\nResultsMapping: %+v\n", g, w, resultsMapping) } // Want metric counts wantMetricCounts := map[string]int{ nodeToKey(initiatingNode): 1, nodeToKey(node1): 2, nodeToKey(node2): 3, } for key, wantMetricCounts := range wantMetricCounts { gotMetricCounts := len(resultsMapping[key]) if gotMetricCounts != wantMetricCounts { t.Errorf("Key=%q gotMetricCounts %d wantMetricCounts %d", key, gotMetricCounts, wantMetricCounts) } } // Now ensure that the exported metrics match up exactly with // the nodes and the last seen node expectation/behavior. // (or at least their serialized equivalents match up) wantContents := map[string][]*metricspb.Metric{ nodeToKey(initiatingNode): mLi, nodeToKey(node1): append(mL1, mLn1...), nodeToKey(node2): append(mL2, append(mLn2a, mLn2b...)...), } gotBlob, _ := json.Marshal(resultsMapping) wantBlob, _ := json.Marshal(wantContents) if !bytes.Equal(gotBlob, wantBlob) { t.Errorf("Unequal serialization results\nGot:\n\t%s\nWant:\n\t%s\n", gotBlob, wantBlob) } }
explode_data.jsonl/1887
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1683 }
[ 2830, 3393, 16894, 57251, 2571, 287, 1155, 353, 8840, 836, 8, 341, 2109, 16340, 45094, 1669, 501, 54310, 2164, 1659, 2822, 197, 6878, 2635, 11, 2814, 24911, 1669, 17796, 25436, 1925, 8626, 4872, 5475, 1155, 11, 18266, 45094, 340, 16867, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestExternalTable(t *testing.T) { if testing.Short() { t.Skip() } execStatements(t, []string{ "create database external", "create table external.ext(id int, val varbinary(128), primary key(id))", }) defer execStatements(t, []string{ "drop database external", }) engine.se.Reload(context.Background()) testcases := []testcase{{ input: []string{ "begin", "insert into external.ext values (1, 'aaa')", "commit", }, // External table events don't get sent. output: [][]string{{ `begin`, `gtid`, `commit`, }}, }} runCases(t, nil, testcases, "", nil) }
explode_data.jsonl/10423
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 238 }
[ 2830, 3393, 25913, 2556, 1155, 353, 8840, 836, 8, 341, 743, 7497, 55958, 368, 341, 197, 3244, 57776, 741, 197, 630, 67328, 93122, 1155, 11, 3056, 917, 515, 197, 197, 1, 3182, 4625, 9250, 756, 197, 197, 1, 3182, 1965, 9250, 9220, 372...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestHelmHookWeight(t *testing.T) { Given(t). Path("hook"). When(). // this create a weird hook, that runs during sync - but before the pod, and because it'll fail - the pod will never be created PatchFile("hook.yaml", `[ {"op": "replace", "path": "/metadata/annotations", "value": {"argocd.argoproj.io/hook": "Sync", "helm.sh/hook-weight": "-1"}}, {"op": "replace", "path": "/spec/containers/0/command/0", "value": "false"} ]`). Create(). IgnoreErrors(). Sync(). Then(). Expect(OperationPhaseIs(OperationFailed)). Expect(ResourceResultNumbering(1)) }
explode_data.jsonl/69393
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 213 }
[ 2830, 3393, 39, 23162, 31679, 8295, 1155, 353, 8840, 836, 8, 341, 9600, 2071, 1155, 4292, 197, 69640, 445, 20873, 38609, 197, 197, 4498, 25829, 197, 197, 322, 419, 1855, 264, 16283, 9704, 11, 429, 8473, 2337, 12811, 481, 714, 1573, 27...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestExamplesComplete(t *testing.T) { t.Parallel() terraformOptions := &terraform.Options{ // The path to where our Terraform code is located TerraformDir: "../../examples/complete", Upgrade: true, // Variables to pass to our Terraform code using -var-file options VarFiles: []string{"fixtures.us-east-2.tfvars"}, } // At the end of the test, run `terraform destroy` to clean up any resources that were created defer terraform.Destroy(t, terraformOptions) // This will run `terraform init` and `terraform apply` and fail the test if there are any errors terraform.InitAndApply(t, terraformOptions) // Run `terraform output` to get the value of an output variable vpcCidr := terraform.Output(t, terraformOptions, "vpc_cidr") // Verify we're getting back the outputs we expect assert.Equal(t, "172.16.0.0/16", vpcCidr) // Run `terraform output` to get the value of an output variable privateSubnetCidrs := terraform.OutputList(t, terraformOptions, "private_subnet_cidrs") // Verify we're getting back the outputs we expect assert.Equal(t, []string{"172.16.0.0/19", "172.16.32.0/19"}, privateSubnetCidrs) // Run `terraform output` to get the value of an output variable publicSubnetCidrs := terraform.OutputList(t, terraformOptions, "public_subnet_cidrs") // Verify we're getting back the outputs we expect assert.Equal(t, []string{"172.16.96.0/19", "172.16.128.0/19"}, publicSubnetCidrs) // Run `terraform output` to get the value of an output variable keyName := terraform.Output(t, terraformOptions, "key_name") // Verify we're getting back the outputs we expect assert.Equal(t, "eg-test-ec2-bastion-ssh-key", keyName) }
explode_data.jsonl/18791
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 581 }
[ 2830, 3393, 40381, 12548, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 2822, 197, 61385, 3798, 1669, 609, 61385, 22179, 515, 197, 197, 322, 576, 1815, 311, 1380, 1039, 49426, 627, 2038, 374, 7407, 198, 197, 10261, 13886, 627, 6184, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestDelegationSerialization(t *testing.T) { require := require.New(t) // NOTE: These cases should be synced with tests in runtime/src/consensus/staking.rs. for _, tc := range []struct { rr Delegation expectedBase64 string }{ {Delegation{}, "oWZzaGFyZXNA"}, { Delegation{Shares: mustInitQuantity(t, 100)}, "oWZzaGFyZXNBZA==", }, } { enc := cbor.Marshal(tc.rr) require.Equal(tc.expectedBase64, base64.StdEncoding.EncodeToString(enc), "serialization should match") var dec Delegation err := cbor.Unmarshal(enc, &dec) require.NoError(err, "Unmarshal") require.EqualValues(tc.rr, dec, "Delegation serialization should round-trip") } }
explode_data.jsonl/36025
{ "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, 1912, 87566, 35865, 1155, 353, 8840, 836, 8, 341, 17957, 1669, 1373, 7121, 1155, 692, 197, 322, 16743, 25, 4220, 5048, 1265, 387, 85028, 448, 7032, 304, 15592, 13437, 14, 6254, 13626, 14272, 1765, 25638, 624, 2023, 8358, 171...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestClientNonIdempotentRetry(t *testing.T) { t.Parallel() dialsCount := 0 c := &Client{ Dial: func(addr string) (net.Conn, error) { dialsCount++ switch dialsCount { case 1, 2: return &readErrorConn{}, nil case 3: return &singleReadConn{ s: "HTTP/1.1 345 OK\r\nContent-Type: foobar\r\nContent-Length: 7\r\n\r\n0123456", }, nil default: t.Fatalf("unexpected number of dials: %d", dialsCount) } panic("unreachable") }, } // This POST must succeed, since the readErrorConn closes // the connection before sending any response. // So the client must retry non-idempotent request. dialsCount = 0 statusCode, body, err := c.Post(nil, "http://foobar/a/b", nil) if err != nil { t.Fatalf("unexpected error: %s", err) } if statusCode != 345 { t.Fatalf("unexpected status code: %d. Expecting 345", statusCode) } if string(body) != "0123456" { t.Fatalf("unexpected body: %q. Expecting %q", body, "0123456") } // Verify that idempotent GET succeeds. dialsCount = 0 statusCode, body, err = c.Get(nil, "http://foobar/a/b") if err != nil { t.Fatalf("unexpected error: %s", err) } if statusCode != 345 { t.Fatalf("unexpected status code: %d. Expecting 345", statusCode) } if string(body) != "0123456" { t.Fatalf("unexpected body: %q. Expecting %q", body, "0123456") } }
explode_data.jsonl/79369
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 550 }
[ 2830, 3393, 2959, 8121, 764, 3262, 63532, 51560, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 2822, 2698, 10309, 2507, 1669, 220, 15, 198, 1444, 1669, 609, 2959, 515, 197, 10957, 530, 25, 2915, 24497, 914, 8, 320, 4711, 50422, 11,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestRoutes_userRoutes(t *testing.T) { t.Parallel() m := mux.NewRouter() userRoutes(m, nil) cases := []struct { req *http.Request vars map[string]string }{ { req: httptest.NewRequest("GET", "/new", nil), }, { req: httptest.NewRequest("GET", "/import", nil), }, { req: httptest.NewRequest("POST", "/import", nil), }, { req: httptest.NewRequest("GET", "/12345/edit", nil), }, { req: httptest.NewRequest("GET", "/12345", nil), }, { req: httptest.NewRequest("PATCH", "/12345", nil), }, { req: httptest.NewRequest("DELETE", "/12345", nil), }, { req: httptest.NewRequest("POST", "/12345/reset-password", nil), }, } for _, tc := range cases { testRoute(t, m, tc.req, tc.vars) } }
explode_data.jsonl/41248
{ "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, 26653, 3317, 26653, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 2822, 2109, 1669, 59807, 7121, 9523, 741, 19060, 26653, 1255, 11, 2092, 692, 1444, 2264, 1669, 3056, 1235, 341, 197, 24395, 220, 353, 1254, 9659, 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 TestContinuousVestingAccountMarshal(t *testing.T) { pubkey := secp256k1.GenPrivKey().PubKey() addr := sdk.AccAddress(pubkey.Address()) coins := sdk.NewCoins(sdk.NewInt64Coin("test", 5)) baseAcc := authtypes.NewBaseAccount(addr, pubkey, 50) baseVesting := types.NewBaseVestingAccount(baseAcc, coins, time.Now().Unix()) acc := types.NewContinuousVestingAccountRaw(baseVesting, baseVesting.EndTime) bz, err := app.AccountKeeper.MarshalAccount(acc) require.Nil(t, err) acc2, err := app.AccountKeeper.UnmarshalAccount(bz) require.Nil(t, err) require.IsType(t, &types.ContinuousVestingAccount{}, acc2) require.Equal(t, acc.String(), acc2.String()) // error on bad bytes _, err = app.AccountKeeper.UnmarshalAccount(bz[:len(bz)/2]) require.NotNil(t, err) }
explode_data.jsonl/31297
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 295 }
[ 2830, 3393, 94780, 53, 59855, 7365, 55438, 1155, 353, 8840, 836, 8, 341, 62529, 792, 1669, 511, 4672, 17, 20, 21, 74, 16, 65384, 32124, 1592, 1005, 29162, 1592, 741, 53183, 1669, 45402, 77538, 4286, 74186, 792, 26979, 2398, 197, 29609, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestListen(t *testing.T) { pair, err := unix.Socketpair(unix.AF_UNIX, unix.SOCK_STREAM, 0) if err != nil { t.Fatalf("unix.Socket(unix.AF_UNIX, unix.SOCK_STREAM, 0) => %v", err) } ctx := contexttest.Context(t) sfile1, err := newSocket(ctx, pair[0], false) if err != nil { t.Fatalf("newSocket(%v) => %v", pair[0], err) } defer sfile1.DecRef(ctx) socket1 := sfile1.FileOperations.(socket.Socket) sfile2, err := newSocket(ctx, pair[1], false) if err != nil { t.Fatalf("newSocket(%v) => %v", pair[1], err) } defer sfile2.DecRef(ctx) socket2 := sfile2.FileOperations.(socket.Socket) // Socketpairs can not be listened to. if err := socket1.Listen(nil, 64); err != syserr.ErrInvalidEndpointState { t.Fatalf("socket1.Listen(nil, 64) => %v, want syserr.ErrInvalidEndpointState", err) } if err := socket2.Listen(nil, 64); err != syserr.ErrInvalidEndpointState { t.Fatalf("socket2.Listen(nil, 64) => %v, want syserr.ErrInvalidEndpointState", err) } // Create a Unix socket, do not bind it. sock, err := unix.Socket(unix.AF_UNIX, unix.SOCK_STREAM, 0) if err != nil { t.Fatalf("unix.Socket(unix.AF_UNIX, unix.SOCK_STREAM, 0) => %v", err) } sfile3, err := newSocket(ctx, sock, false) if err != nil { t.Fatalf("newSocket(%v) => %v", sock, err) } defer sfile3.DecRef(ctx) socket3 := sfile3.FileOperations.(socket.Socket) // This socket is not bound so we can't listen on it. if err := socket3.Listen(nil, 64); err != syserr.ErrInvalidEndpointState { t.Fatalf("socket3.Listen(nil, 64) => %v, want syserr.ErrInvalidEndpointState", err) } }
explode_data.jsonl/255
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 663 }
[ 2830, 3393, 38714, 1155, 353, 8840, 836, 8, 341, 3223, 1310, 11, 1848, 1669, 51866, 52089, 12670, 18364, 941, 70860, 82754, 11, 51866, 78922, 23584, 11, 220, 15, 340, 743, 1848, 961, 2092, 341, 197, 3244, 30762, 445, 56646, 52089, 18364...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
9
func TestConditions(t *testing.T) { client := enttest.Open(t, "sqlite3", "file:ent?mode=memory&cache=shared&_fk=1", enttest.WithMigrateOptions(migrate.WithGlobalUniqueID(true))) defer client.Close() var calls int defer func() { require.Equal(t, 2, calls) }() client.Card.Use(hook.If(func(next ent.Mutator) ent.Mutator { return hook.CardFunc(func(ctx context.Context, m *ent.CardMutation) (ent.Value, error) { require.True(t, m.Op().Is(ent.OpUpdateOne)) calls++ return next.Mutate(ctx, m) }) }, hook.Or( hook.HasFields(card.FieldName), hook.HasClearedFields(card.FieldName), ))) client.User.Use(hook.If(func(next ent.Mutator) ent.Mutator { return hook.UserFunc(func(ctx context.Context, m *ent.UserMutation) (ent.Value, error) { require.True(t, m.Op().Is(ent.OpUpdate)) incr, exists := m.AddedWorth() require.True(t, exists) require.EqualValues(t, 100, incr) return next.Mutate(ctx, m) }) }, hook.HasAddedFields(user.FieldWorth))) ctx := context.Background() crd := client.Card.Create().SetNumber("9876").SaveX(ctx) crd = crd.Update().SetName("alexsn").SaveX(ctx) crd = crd.Update().ClearName().SaveX(ctx) client.Card.DeleteOne(crd).ExecX(ctx) alexsn := client.User.Create().SetName("alexsn").SaveX(ctx) client.User.Update().Where(user.ID(alexsn.ID)).AddWorth(100).SaveX(ctx) client.User.DeleteOne(alexsn).ExecX(ctx) }
explode_data.jsonl/36052
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 562 }
[ 2830, 3393, 35435, 1155, 353, 8840, 836, 8, 341, 25291, 1669, 1197, 1944, 12953, 1155, 11, 330, 37042, 18, 497, 330, 1192, 25, 306, 30, 8516, 28, 17269, 5, 9360, 28, 6100, 85047, 41718, 28, 16, 497, 1197, 1944, 26124, 44, 34479, 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 TestHTTPProxyRouteWithAServiceWeight(t *testing.T) { rh, cc, done := setup(t) defer done() rh.OnAdd(&v1.Service{ ObjectMeta: metav1.ObjectMeta{ Name: "kuard", Namespace: "default", }, Spec: v1.ServiceSpec{ Ports: []v1.ServicePort{{ Protocol: "TCP", Port: 80, TargetPort: intstr.FromInt(8080), }}, }, }) proxy1 := &projcontour.HTTPProxy{ ObjectMeta: metav1.ObjectMeta{ Name: "simple", Namespace: "default", }, Spec: projcontour.HTTPProxySpec{ VirtualHost: &projcontour.VirtualHost{Fqdn: "test2.test.com"}, Routes: []projcontour.Route{{ Conditions: conditions(prefixCondition("/a")), Services: []projcontour.Service{{ Name: "kuard", Port: 80, Weight: 90, // ignored }}, }}, }, } rh.OnAdd(proxy1) assertRDS(t, cc, "1", virtualhosts( envoy.VirtualHost("test2.test.com", &envoy_api_v2_route.Route{ Match: routePrefix("/a"), Action: routecluster("default/kuard/80/da39a3ee5e"), }, ), ), nil) proxy2 := &projcontour.HTTPProxy{ ObjectMeta: metav1.ObjectMeta{ Name: "simple", Namespace: "default", }, Spec: projcontour.HTTPProxySpec{ VirtualHost: &projcontour.VirtualHost{Fqdn: "test2.test.com"}, Routes: []projcontour.Route{{ Conditions: conditions(prefixCondition("/a")), Services: []projcontour.Service{{ Name: "kuard", Port: 80, Weight: 90, }, { Name: "kuard", Port: 80, Weight: 60, }}, }}, }, } rh.OnUpdate(proxy1, proxy2) assertRDS(t, cc, "2", virtualhosts( envoy.VirtualHost("test2.test.com", &envoy_api_v2_route.Route{ Match: routePrefix("/a"), Action: routeweightedcluster( weightedcluster{"default/kuard/80/da39a3ee5e", 60}, weightedcluster{"default/kuard/80/da39a3ee5e", 90}), }, ), ), nil) }
explode_data.jsonl/70766
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 900 }
[ 2830, 3393, 9230, 16219, 4899, 2354, 32, 1860, 8295, 1155, 353, 8840, 836, 8, 341, 7000, 71, 11, 12527, 11, 2814, 1669, 6505, 1155, 340, 16867, 2814, 2822, 7000, 71, 8071, 2212, 2099, 85, 16, 13860, 515, 197, 23816, 12175, 25, 77520, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestIntegrationHTTPDoUnknownDNS(t *testing.T) { ctx := context.Background() results := HTTPDo(ctx, HTTPDoConfig{ URL: "http://ooni.io", DNSServerNetwork: "antani", }) if !strings.HasSuffix(results.Error.Error(), "unsupported network value") { t.Fatal("not the error that we expected") } }
explode_data.jsonl/53534
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 123 }
[ 2830, 3393, 52464, 9230, 5404, 13790, 61088, 1155, 353, 8840, 836, 8, 341, 20985, 1669, 2266, 19047, 741, 55497, 1669, 10130, 5404, 7502, 11, 10130, 5404, 2648, 515, 197, 79055, 25, 1060, 330, 1254, 1110, 9009, 72, 4245, 756, 197, 10957...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestContextMatches(t *testing.T) { for repo, presubmits := range c.PresubmitsStatic { for _, p := range presubmits { checkContext(t, repo, p) } } }
explode_data.jsonl/55573
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 65 }
[ 2830, 3393, 1972, 42470, 1155, 353, 8840, 836, 8, 341, 2023, 15867, 11, 1652, 392, 44703, 1669, 2088, 272, 1069, 416, 392, 44703, 11690, 341, 197, 2023, 8358, 281, 1669, 2088, 1652, 392, 44703, 341, 298, 25157, 1972, 1155, 11, 15867, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestBasic(t *testing.T) { blob, err := JSON("test/a/b") assert.For(t).ThatActual(err).IsNil() compareBlobTo(t, blob, "expected_a_b.json") }
explode_data.jsonl/6315
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 67 }
[ 2830, 3393, 15944, 1155, 353, 8840, 836, 8, 341, 2233, 1684, 11, 1848, 1669, 4718, 445, 1944, 14186, 3470, 5130, 6948, 26676, 1155, 568, 4792, 28123, 3964, 568, 3872, 19064, 2822, 197, 18948, 37985, 1249, 1155, 11, 23404, 11, 330, 7325,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestWriterDict(t *testing.T) { const ( dict = "hello world" text = "hello again world" ) var b bytes.Buffer w, err := NewWriter(&b, 5) if err != nil { t.Fatalf("NewWriter: %v", err) } w.Write([]byte(dict)) w.Flush() b.Reset() w.Write([]byte(text)) w.Close() var b1 bytes.Buffer w, _ = NewWriterDict(&b1, 5, []byte(dict)) w.Write([]byte(text)) w.Close() if !bytes.Equal(b1.Bytes(), b.Bytes()) { t.Fatalf("writer wrote %q want %q", b1.Bytes(), b.Bytes()) } }
explode_data.jsonl/81410
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 222 }
[ 2830, 3393, 6492, 13448, 1155, 353, 8840, 836, 8, 341, 4777, 2399, 197, 2698, 849, 284, 330, 14990, 1879, 698, 197, 15425, 284, 330, 14990, 1549, 1879, 698, 197, 340, 2405, 293, 5820, 22622, 198, 6692, 11, 1848, 1669, 1532, 6492, 2099...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestValidateKubernetesLabelValue(t *testing.T) { validLabelValues := []string{"", "a", "a1", "this--valid--label--is--exactly--sixty--three--characters--long", "123456", "my-label_valid.com"} invalidLabelValues := []string{"a$$b", "-abc", "not.valid.", "This____long____label___is______sixty______four_____chararacters", "Label with spaces"} for _, l := range validLabelValues { if err := validateKubernetesLabelValue(l); err != nil { t.Fatalf("Label value %v should not return error: %v", l, err) } } for _, l := range invalidLabelValues { if err := validateKubernetesLabelValue(l); err == nil { t.Fatalf("Label value %v should return an error", l) } } }
explode_data.jsonl/17871
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 240 }
[ 2830, 3393, 17926, 42, 29827, 2476, 1130, 1155, 353, 8840, 836, 8, 1476, 56322, 2476, 6227, 1669, 3056, 917, 4913, 497, 330, 64, 497, 330, 64, 16, 497, 330, 574, 313, 1891, 313, 1502, 313, 285, 313, 327, 32739, 313, 50364, 1881, 313...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestCheckUnorderedExchangeV2WithProofs(t *testing.T) { to, path := createCheckerTestObjects(t) defer func() { to.stor.close(t) err := common.CleanTemporaryDirs(path) assert.NoError(t, err, "failed to clean test data dirs") }() tx := createUnorderedExchangeWithProofs(t, 2) info := defaultCheckerInfo(t) to.stor.createAsset(t, testGlobal.asset0.asset.ID) to.stor.createAsset(t, testGlobal.asset1.asset.ID) to.stor.createAsset(t, testGlobal.asset2.asset.ID) to.stor.activateFeature(t, int16(settings.SmartAccountTrading)) to.stor.activateFeature(t, int16(settings.SmartAssets)) to.stor.activateFeature(t, int16(settings.OrderV3)) to.stor.activateFeature(t, int16(settings.BlockV5)) _, err := to.tc.checkExchangeWithProofs(tx, info) assert.Errorf(t, err, "have to fail on incorrect order of orders after activation of BlockV5") }
explode_data.jsonl/63086
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 329 }
[ 2830, 3393, 3973, 1806, 10544, 31564, 53, 17, 2354, 31076, 82, 1155, 353, 8840, 836, 8, 341, 31709, 11, 1815, 1669, 1855, 35188, 2271, 11543, 1155, 692, 16867, 2915, 368, 341, 197, 31709, 1236, 269, 4653, 1155, 692, 197, 9859, 1669, 4...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestFailFastWorkflowLauncher(t *testing.T) { ctx := context.TODO() f := NewFailFastLaunchPlanExecutor() t.Run("getStatus", func(t *testing.T) { a, err := f.GetStatus(ctx, &core.WorkflowExecutionIdentifier{ Project: "p", Domain: "d", Name: "n", }) assert.Nil(t, a) assert.Error(t, err) }) t.Run("launch", func(t *testing.T) { err := f.Launch(ctx, LaunchContext{ ParentNodeExecution: &core.NodeExecutionIdentifier{ NodeId: "node-id", ExecutionId: &core.WorkflowExecutionIdentifier{ Project: "p", Domain: "d", Name: "n", }, }, }, &core.WorkflowExecutionIdentifier{ Project: "p", Domain: "d", Name: "n", }, &core.Identifier{}, nil) assert.Error(t, err) }) t.Run("kill", func(t *testing.T) { err := f.Kill(ctx, &core.WorkflowExecutionIdentifier{ Project: "p", Domain: "d", Name: "n", }, "reason") assert.NoError(t, err) }) }
explode_data.jsonl/13093
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 439 }
[ 2830, 3393, 19524, 32174, 62768, 91176, 1155, 353, 8840, 836, 8, 341, 20985, 1669, 2266, 90988, 741, 1166, 1669, 1532, 19524, 32174, 32067, 20485, 25255, 741, 3244, 16708, 445, 68873, 497, 2915, 1155, 353, 8840, 836, 8, 341, 197, 11323, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestBlkioBFQStats(t *testing.T) { helper := NewCgroupTestUtil("blkio", t) defer helper.cleanup() helper.writeFileContents(blkioBFQStatsTestFiles) blkio := &BlkioGroup{} actualStats := *cgroups.NewStats() err := blkio.GetStats(helper.CgroupPath, &actualStats) if err != nil { t.Fatal(err) } expectedStats := cgroups.BlkioStats{} appendBlkioStatEntry(&expectedStats.IoServiceBytesRecursive, 8, 0, 1100, "Read") appendBlkioStatEntry(&expectedStats.IoServiceBytesRecursive, 8, 0, 1200, "Write") appendBlkioStatEntry(&expectedStats.IoServiceBytesRecursive, 8, 0, 1300, "Sync") appendBlkioStatEntry(&expectedStats.IoServiceBytesRecursive, 8, 0, 1500, "Async") appendBlkioStatEntry(&expectedStats.IoServiceBytesRecursive, 8, 0, 1500, "Total") appendBlkioStatEntry(&expectedStats.IoServicedRecursive, 8, 0, 11, "Read") appendBlkioStatEntry(&expectedStats.IoServicedRecursive, 8, 0, 41, "Write") appendBlkioStatEntry(&expectedStats.IoServicedRecursive, 8, 0, 21, "Sync") appendBlkioStatEntry(&expectedStats.IoServicedRecursive, 8, 0, 31, "Async") appendBlkioStatEntry(&expectedStats.IoServicedRecursive, 8, 0, 51, "Total") expectBlkioStatsEquals(t, expectedStats, actualStats.BlkioStats) }
explode_data.jsonl/45838
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 448 }
[ 2830, 3393, 4923, 74, 815, 19883, 48, 16635, 1155, 353, 8840, 836, 8, 341, 9598, 2947, 1669, 1532, 34, 4074, 2271, 2742, 445, 34989, 815, 497, 259, 340, 16867, 13137, 87689, 741, 9598, 2947, 70007, 14803, 29811, 74, 815, 19883, 48, 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...
2
func TestStatusCompletion(t *testing.T) { rels := []*release.Release{ { Name: "athos", Namespace: "default", Info: &release.Info{ Status: release.StatusDeployed, }, Chart: &chart.Chart{ Metadata: &chart.Metadata{ Name: "Athos-chart", Version: "1.2.3", }, }, }, { Name: "porthos", Namespace: "default", Info: &release.Info{ Status: release.StatusFailed, }, Chart: &chart.Chart{ Metadata: &chart.Metadata{ Name: "Porthos-chart", Version: "111.222.333", }, }, }, { Name: "aramis", Namespace: "default", Info: &release.Info{ Status: release.StatusUninstalled, }, Chart: &chart.Chart{ Metadata: &chart.Metadata{ Name: "Aramis-chart", Version: "0.0.0", }, }, }, { Name: "dartagnan", Namespace: "gascony", Info: &release.Info{ Status: release.StatusUnknown, }, Chart: &chart.Chart{ Metadata: &chart.Metadata{ Name: "Dartagnan-chart", Version: "1.2.3-prerelease", }, }, }} tests := []cmdTestCase{{ name: "completion for status", cmd: "__complete status a", golden: "output/status-comp.txt", rels: rels, }, { name: "completion for status with too many arguments", cmd: "__complete status dartagnan ''", golden: "output/status-wrong-args-comp.txt", rels: rels, }, { name: "completion for status with global flag", cmd: "__complete status --debug a", golden: "output/status-comp.txt", rels: rels, }} runTestCmd(t, tests) }
explode_data.jsonl/50601
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 754 }
[ 2830, 3393, 2522, 33190, 1155, 353, 8840, 836, 8, 341, 197, 53783, 1669, 29838, 22998, 58693, 515, 197, 197, 515, 298, 21297, 25, 414, 330, 587, 436, 756, 298, 90823, 25, 330, 2258, 756, 298, 197, 1731, 25, 609, 22998, 20132, 515, 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 TestInstanceMysql(t *testing.T) { t.Run("test instance mysql", func(t *testing.T) { mysql := Instance() if mysql == nil { t.Error("mysql instance is nil") } }) }
explode_data.jsonl/19486
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 73 }
[ 2830, 3393, 2523, 44, 14869, 1155, 353, 8840, 836, 8, 341, 3244, 16708, 445, 1944, 2867, 10564, 497, 2915, 1155, 353, 8840, 836, 8, 341, 197, 56955, 1669, 19283, 741, 197, 743, 10564, 621, 2092, 341, 298, 3244, 6141, 445, 12272, 2867,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestClusterServiceBrokerDoesNotExist(t *testing.T) { // GIVEN require.NoError(t, v1beta1.AddToScheme(scheme.Scheme)) cli := fake.NewFakeClientWithScheme(scheme.Scheme) sut := NewClusterBrokersFacade(cli, fixWorkingNs(), fixService(), fixBrokerName(), logrus.New()) // WHEN ex, err := sut.Exist() // THEN require.NoError(t, err) assert.False(t, ex) }
explode_data.jsonl/74976
{ "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, 28678, 1860, 65545, 21468, 45535, 1155, 353, 8840, 836, 8, 341, 197, 322, 89836, 198, 17957, 35699, 1155, 11, 348, 16, 19127, 16, 1904, 1249, 28906, 1141, 8058, 92719, 1171, 86448, 1669, 12418, 7121, 52317, 2959, 2354, 28906, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestMultiDoc(t *testing.T) { f := Yaml{} yaml := ` apiVersion: batch/v1 kind: Job metadata: name: pi spec: trolo: lolo: lo --- apiVersion: batch/v1 kind: Job metadata: name: pi2 spec: trolo: lolo: lo --- apiVersion: batch/v1 kind: Job metadata: name: pi3 spec: trolo: lolo: lo` wrapped, err := f.Wrap(yaml) if err != nil { t.Fatal(err) } expected := `apiVersion: appcontroller.k8s/v1alpha1 kind: Definition metadata: name: job-pi job: apiVersion: batch/v1 kind: Job metadata: name: pi spec: trolo: lolo: lo --- apiVersion: appcontroller.k8s/v1alpha1 kind: Definition metadata: name: job-pi2 job: apiVersion: batch/v1 kind: Job metadata: name: pi2 spec: trolo: lolo: lo --- apiVersion: appcontroller.k8s/v1alpha1 kind: Definition metadata: name: job-pi3 job: apiVersion: batch/v1 kind: Job metadata: name: pi3 spec: trolo: lolo: lo` if wrapped != expected { t.Errorf("wrapped doesn't match expected output\nExpected:\n%s\nactual:\n%s", expected, wrapped) } }
explode_data.jsonl/34054
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 507 }
[ 2830, 3393, 20358, 9550, 1155, 353, 8840, 836, 8, 341, 1166, 1669, 809, 9467, 16094, 14522, 9467, 1669, 1565, 220, 6330, 5637, 25, 7162, 5457, 16, 198, 220, 3093, 25, 12011, 198, 220, 11160, 510, 262, 829, 25, 8938, 198, 220, 1398, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3