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 TestFailureLatestReleaseBranchMergeBaseToLatestNoLatestTag(t *testing.T) { testRepo := newTestRepo(t) defer testRepo.cleanup(t) require.Nil(t, command.NewWithWorkDir( testRepo.sut.Dir(), "git", "tag", "-d", testRepo.firstTagName, ).RunSuccess()) result, err := testRepo.sut.LatestReleaseBranchMergeBaseToLatest() require.NotNil(t, err) require.Equal(t, result, git.DiscoverResult{}) }
explode_data.jsonl/14007
{ "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, 17507, 31992, 16077, 18197, 52096, 3978, 1249, 31992, 2753, 31992, 5668, 1155, 353, 8840, 836, 8, 341, 18185, 25243, 1669, 501, 2271, 25243, 1155, 340, 16867, 1273, 25243, 87689, 1155, 692, 17957, 59678, 1155, 11, 3210, 7121, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestRebalance_MergeBackups(t *testing.T) { c := newTestCluster(nil) defer c.teardown() db1, err := c.newDB() if err != nil { t.Fatalf("Expected nil. Got: %v", err) } db2, err := c.newDB() if err != nil { t.Fatalf("Expected nil. Got: %v", err) } dm, err := db1.NewDMap("mymap") if err != nil { t.Fatalf("Expected nil. Got: %v", err) } for i := 0; i < 1000; i++ { err = dm.Put(bkey(i), bval(i)) if err != nil { t.Fatalf("Expected nil. Got: %v", err) } } db3, err := c.newDB() if err != nil { t.Fatalf("Expected nil. Got: %v", err) } checkOwnerCount := func(db *Olric) { syncClusterMembers(db1, db2, db3) for partID := uint64(0); partID < db.config.PartitionCount; partID++ { backup := db.backups[partID] if backup.ownerCount() != 1 { t.Fatalf("Expected backup owner count is 1 for PartID: %d on %s. Got: %d", partID, db.this, backup.ownerCount()) } part := db.partitions[partID] for _, backupOwner := range backup.loadOwners() { if hostCmp(backupOwner, part.owner()) { t.Fatalf("Partition owner is also backup owner. PartID: %d: %s", partID, backupOwner) } } } } checkOwnerCount(db1) checkOwnerCount(db2) checkOwnerCount(db3) }
explode_data.jsonl/5867
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 556 }
[ 2830, 3393, 693, 21571, 1245, 10080, 3707, 8602, 1155, 353, 8840, 836, 8, 341, 1444, 1669, 501, 2271, 28678, 27907, 340, 16867, 272, 31853, 37496, 2822, 20939, 16, 11, 1848, 1669, 272, 4618, 3506, 741, 743, 1848, 961, 2092, 341, 197, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
5
func TestAllServersCache_NotFound(t *testing.T) { srv := &hcloud.Server{ ID: 101010, Name: "not-found", PrivateNet: []hcloud.ServerPrivateNet{ { IP: net.ParseIP("10.0.0.4"), }, }, } cacheOps := newAllServersCacheOps(t, srv) tmpl := allServersCacheTestCase{ SetUp: func(t *testing.T, tt *allServersCacheTestCase) { tt.ServerClient. On("All", mock.Anything). Return(nil, nil) }, ExpectedErr: hcops.ErrNotFound, } runAllServersCacheTests(t, "Not found", tmpl, cacheOps) }
explode_data.jsonl/5921
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 236 }
[ 2830, 3393, 2403, 78139, 8233, 60816, 6650, 1155, 353, 8840, 836, 8, 341, 1903, 10553, 1669, 609, 71, 12361, 22997, 515, 197, 29580, 25, 256, 220, 16, 15, 16, 15, 16, 15, 345, 197, 21297, 25, 330, 1921, 26704, 756, 197, 197, 16787, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestNoRedirect(t *testing.T) { go func() { mux := http.NewServeMux() mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { http.Redirect(w, r, "/redirected", http.StatusMovedPermanently) }) mux.HandleFunc("/redirected", func(w http.ResponseWriter, r *http.Request) { w.WriteHeader(http.StatusInternalServerError) }) srv := http.Server{ Addr: "localhost:8888", Handler: mux, } err := srv.ListenAndServe() require.NoError(t, err) }() checker := newHealthChecker() checker.port = "8888" condition := func() bool { return checker.checkOne("127.0.0.1") } require.Eventually(t, condition, 5*time.Second, 500*time.Millisecond) }
explode_data.jsonl/46942
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 285 }
[ 2830, 3393, 2753, 17725, 1155, 353, 8840, 836, 8, 341, 30680, 2915, 368, 341, 197, 2109, 2200, 1669, 1758, 7121, 60421, 44, 2200, 741, 197, 2109, 2200, 63623, 35460, 2915, 3622, 1758, 37508, 11, 435, 353, 1254, 9659, 8, 341, 298, 2808...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestRestartIndexCornerCases(t *testing.T) { for _, c := range []struct { name string fn func(t *testing.T, dir string, s *ImmuStore) }{ { "Closed store", func(t *testing.T, dir string, s *ImmuStore) { s.Close() err := s.indexer.restartIndex() require.Equal(t, ErrAlreadyClosed, err) }, }, { "No nodes folder", func(t *testing.T, dir string, s *ImmuStore) { require.NoError(t, os.MkdirAll(filepath.Join(dir, "index/commit1"), 0777)) err := s.indexer.restartIndex() require.NoError(t, err) }, }, { "No commit folder", func(t *testing.T, dir string, s *ImmuStore) { require.NoError(t, os.MkdirAll(filepath.Join(dir, "index/nodes1"), 0777)) err := s.indexer.restartIndex() require.NoError(t, err) }, }, { "Invalid index structure", func(t *testing.T, dir string, s *ImmuStore) { require.NoError(t, os.MkdirAll(filepath.Join(dir, "index/nodes1"), 0777)) require.NoError(t, ioutil.WriteFile(filepath.Join(dir, "index/commit1"), []byte{}, 0777)) err := s.indexer.restartIndex() require.NoError(t, err) }, }, } { t.Run(c.name, func(t *testing.T) { d, err := ioutil.TempDir("", "indexertest") require.NoError(t, err) defer os.RemoveAll(d) store, err := Open(d, DefaultOptions()) require.NoError(t, err) defer store.Close() c.fn(t, d, store) }) } }
explode_data.jsonl/67687
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 647 }
[ 2830, 3393, 59354, 1552, 50352, 37302, 1155, 353, 8840, 836, 8, 341, 2023, 8358, 272, 1669, 2088, 3056, 1235, 341, 197, 11609, 914, 198, 197, 40095, 256, 2915, 1155, 353, 8840, 836, 11, 5419, 914, 11, 274, 353, 1427, 15128, 6093, 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 TestCacheMountSharedRefs(t *testing.T) { t.Parallel() ctx := namespaces.WithNamespace(context.Background(), "buildkit-test") tmpdir, err := ioutil.TempDir("", "cachemanager") require.NoError(t, err) defer os.RemoveAll(tmpdir) snapshotter, err := native.NewSnapshotter(filepath.Join(tmpdir, "snapshots")) require.NoError(t, err) co, cleanup, err := newCacheManager(ctx, cmOpt{ snapshotter: snapshotter, snapshotterName: "native", }) require.NoError(t, err) defer cleanup() g1 := newRefGetter(co.manager, co.md, sharedCacheRefs) g2 := newRefGetter(co.manager, co.md, sharedCacheRefs) g3 := newRefGetter(co.manager, co.md, sharedCacheRefs) ref, err := g1.getRefCacheDir(ctx, nil, "foo", pb.CacheSharingOpt_SHARED) require.NoError(t, err) ref2, err := g1.getRefCacheDir(ctx, nil, "bar", pb.CacheSharingOpt_SHARED) require.NoError(t, err) // different ID returns different ref require.NotEqual(t, ref.ID(), ref2.ID()) // same ID on same mount still shares the reference ref3, err := g1.getRefCacheDir(ctx, nil, "foo", pb.CacheSharingOpt_SHARED) require.NoError(t, err) require.Equal(t, ref.ID(), ref3.ID()) // same ID on different mount gets same ID ref4, err := g2.getRefCacheDir(ctx, nil, "foo", pb.CacheSharingOpt_SHARED) require.NoError(t, err) require.Equal(t, ref.ID(), ref4.ID()) // private gets a new ID ref5, err := g3.getRefCacheDir(ctx, nil, "foo", pb.CacheSharingOpt_PRIVATE) require.NoError(t, err) require.NotEqual(t, ref.ID(), ref5.ID()) }
explode_data.jsonl/50740
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 594 }
[ 2830, 3393, 8233, 16284, 16997, 82807, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 741, 20985, 1669, 58091, 26124, 22699, 5378, 19047, 1507, 330, 5834, 8226, 16839, 5130, 20082, 3741, 11, 1848, 1669, 43144, 65009, 6184, 19814, 330, 6...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestOther(t *testing.T) { m := RwMap() t.Log(m.Load("key")) m.Range(func(_, _ interface{}) bool { return true }) m.Len() m.Random() m = AtomicMap() t.Log(m.Load("key")) m.Range(func(_, _ interface{}) bool { return true }) m.Len() m.Random() }
explode_data.jsonl/60936
{ "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, 11409, 1155, 353, 8840, 836, 8, 341, 2109, 1669, 55294, 2227, 741, 3244, 5247, 1255, 13969, 445, 792, 5455, 2109, 24783, 18552, 41117, 716, 3749, 28875, 1807, 341, 197, 853, 830, 198, 197, 3518, 2109, 65819, 741, 2109, 26709...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestRetrieverPersist_GetURLs(t *testing.T) { t.Parallel() testCases := []struct { name string urls urlMap users []entity.User createdURLs []entity.URL user entity.User hasErr bool expectedURLs []entity.URL }{ { name: "user created URLs", urls: urlMap{ "google": entity.URL{ Alias: "google", OriginalURL: "https://www.google.com/", }, "short": entity.URL{ Alias: "short", OriginalURL: "https://github.com/short-d/short/", }, "mozilla": entity.URL{ Alias: "mozilla", OriginalURL: "https://www.mozilla.org/", }, }, users: []entity.User{ { ID: "12345", Name: "Test User", Email: "test@gmail.com", }, { ID: "12345", Name: "Test User", Email: "test@gmail.com", }, { ID: "12346", Name: "Test User 2", Email: "test2@gmail.com", }, }, createdURLs: []entity.URL{ { Alias: "google", OriginalURL: "https://www.google.com/", }, { Alias: "short", OriginalURL: "https://github.com/short-d/short/", }, { Alias: "mozilla", OriginalURL: "https://www.mozilla.org/", }, }, user: entity.User{ ID: "12345", Name: "Test User", Email: "test@gmail.com", }, hasErr: false, expectedURLs: []entity.URL{ { Alias: "google", OriginalURL: "https://www.google.com/", }, { Alias: "short", OriginalURL: "https://github.com/short-d/short/", }, }, }, { name: "user has no URL", urls: urlMap{ "google": entity.URL{ Alias: "google", OriginalURL: "https://www.google.com/", }, "short": entity.URL{ Alias: "short", OriginalURL: "https://github.com/short-d/short/", }, "mozilla": entity.URL{ Alias: "mozilla", OriginalURL: "https://www.mozilla.org/", }, }, users: []entity.User{ { ID: "12345", Name: "Test User", Email: "test@gmail.com", }, { ID: "12345", Name: "Test User", Email: "test@gmail.com", }, { ID: "12345", Name: "Test User", Email: "test@gmail.com", }, }, createdURLs: []entity.URL{ { Alias: "google", OriginalURL: "https://www.google.com/", }, { Alias: "short", OriginalURL: "https://github.com/short-d/short/", }, { Alias: "mozilla", OriginalURL: "https://www.mozilla.org/", }, }, user: entity.User{ ID: "12346", Name: "Test User 2", Email: "test2@gmail.com", }, hasErr: false, expectedURLs: []entity.URL{}, }, } for _, testCase := range testCases { testCase := testCase t.Run(testCase.name, func(t *testing.T) { t.Parallel() fakeURLRepo := repository.NewURLFake(testCase.urls) fakeUserURLRelationRepo := repository.NewUserURLRepoFake(testCase.users, testCase.createdURLs) retriever := NewRetrieverPersist(&fakeURLRepo, &fakeUserURLRelationRepo) urls, err := retriever.GetURLsByUser(testCase.user) if testCase.hasErr { mdtest.NotEqual(t, nil, err) return } mdtest.Equal(t, nil, err) mdtest.Equal(t, testCase.expectedURLs, urls) }) } }
explode_data.jsonl/42427
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1735 }
[ 2830, 3393, 12020, 461, 2054, 61267, 13614, 3144, 82, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 2822, 18185, 37302, 1669, 3056, 1235, 341, 197, 11609, 260, 914, 198, 197, 19320, 82, 260, 2515, 2227, 198, 197, 90896, 286, 3056, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestGreaterEqualUInt(t *testing.T) { t.Parallel() match, err := path.GreaterEqual(&testType1{ UInt: 4567, }, "uint", "4566") require.Nil(t, err) require.True(t, match) match, err = path.GreaterEqual(&testType1{ UInt: 4567, }, "uint", "4567") require.Nil(t, err) require.True(t, match) match, err = path.GreaterEqual(&testType1{ UInt: 4567, }, "uint", "4568") require.Nil(t, err) require.False(t, match) }
explode_data.jsonl/78466
{ "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, 41366, 2993, 18777, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 2822, 47706, 11, 1848, 1669, 1815, 1224, 28362, 2993, 2099, 1944, 929, 16, 515, 197, 87190, 25, 220, 19, 20, 21, 22, 345, 197, 2137, 330, 2496, 497, 33...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestGetArgoServerURI(t *testing.T) { for _, tt := range argoServerURITests { t.Run(tt.name, func(t *testing.T) { cr := makeTestArgoCD(tt.opts...) r := &ReconcileArgoCD{} setRouteAPIFound(t, tt.routeEnabled) result := r.getArgoServerURI(cr) if result != tt.want { t.Errorf("%s test failed, got=%q want=%q", tt.name, result, tt.want) } }) } }
explode_data.jsonl/11932
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 180 }
[ 2830, 3393, 1949, 2735, 78, 5475, 10301, 1155, 353, 8840, 836, 8, 341, 2023, 8358, 17853, 1669, 2088, 1392, 78, 5475, 1511, 952, 17966, 341, 197, 3244, 16708, 47152, 2644, 11, 2915, 1155, 353, 8840, 836, 8, 341, 298, 91492, 1669, 1281...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestIsJsonMap(t *testing.T) { tests := []struct { name string data string want bool }{ {name: "good json", data: `{"local_tcp": { "Type": "tcp","Format": "json","Levels": [ {"ID": 5,"Name": "debug","Stacktrace": false} ], "Options": {"ip": "localhost","port": 18065}, "MaxQueueSize": 1000}} `, want: true, }, {name: "empty json", data: "{}", want: true}, {name: "string json", data: `"test"`, want: false}, {name: "array json", data: `["test1", "test2"]`, want: false}, {name: "bad json", data: `{huh?}`, want: false}, {name: "filename", data: "/tmp/logger.conf", want: false}, {name: "mysql dsn", data: "mysql://mmuser:@tcp(localhost:3306)/mattermost?charset=utf8mb4,utf8&readTimeout=30s", want: false}, {name: "postgres dsn", data: "postgres://mmuser:passwordlocalhost:5432/mattermost?sslmode=disable&connect_timeout=10", want: false}, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { if got := IsJsonMap(tt.data); got != tt.want { t.Errorf("IsJsonMap() = %v, want %v", got, tt.want) } }) } }
explode_data.jsonl/80630
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 459 }
[ 2830, 3393, 3872, 5014, 2227, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 3056, 1235, 341, 197, 11609, 914, 198, 197, 8924, 914, 198, 197, 50780, 1807, 198, 197, 59403, 197, 197, 47006, 25, 330, 18536, 2951, 497, 821, 25, 1565, 4913, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestStateTransition(t *testing.T) { type testType int const ( testRenew testType = iota testRebind testLeaseExpire ) const ( // The following 3 durations are included in DHCP responses. // They are multiples of a second because that's the smallest time granularity // DHCP messages support. renewTime Seconds = 1 rebindTime Seconds = 2 leaseLength Seconds = 3 ) for _, tc := range []struct { name string typ testType acquireTimeout time.Duration // The time durations to advance in test when the current time is requested. durations []time.Duration }{ { name: "Renew", typ: testRenew, acquireTimeout: defaultAcquireTimeout, durations: []time.Duration{ // First acquisition. 0, // Transition to renew. renewTime.Duration(), // Calculate renew acquisition timeout. 0, // Second acquisition from renew. 0, }, }, { name: "Rebind", typ: testRebind, acquireTimeout: defaultAcquireTimeout, durations: []time.Duration{ // First acquisition. 0, // Transition to renew. renewTime.Duration(), // Give renew acquisition 10ms timeout, and expect it to timeout. (rebindTime - renewTime).Duration() - 10*time.Millisecond, // Transition to rebind. 10 * time.Millisecond, // Calculate rebind acquisition timeout. 0, // Second acquisition from rebind. 0, }, }, { // Test the client is not stuck in retransimission longer than it should. // If the client keeps retransmitting until the acquisition timeout // configured in this test, the lease will expire after it's done, // causing it to miss REBIND. name: "RebindWithLargeAcquisitionTimeout", typ: testRebind, // A large enough duration for the test to timeout. acquireTimeout: 1000 * time.Hour, durations: []time.Duration{ // First acquisition. 0, // Transition to renew. renewTime.Duration(), // Give renew acquisition 10ms timeout, and expect it to timeout. (rebindTime - renewTime).Duration() - 10*time.Millisecond, // Transition to rebind. 10 * time.Millisecond, // Calculate rebind acquisition timeout. 0, // Second acquisition from rebind. 0, }, }, { name: "LeaseExpire", typ: testLeaseExpire, acquireTimeout: defaultAcquireTimeout, durations: []time.Duration{ // First acquisition. 0, // Transition to renew. renewTime.Duration(), // Give renew acquisition 10ms timeout, and expect it to timeout. (rebindTime - renewTime).Duration() - 10*time.Millisecond, // Transition to rebind. 10 * time.Millisecond, // Give rebind acquisition 10ms timeout, and expect it to timeout. (leaseLength - rebindTime).Duration() - 10*time.Millisecond, // Transition to lease expiration. 10 * time.Millisecond, // Second acquisition after lease expiration. 0, }, }, { // Test the client is not stuck in retransimission longer than it should. // If the client keeps retransmitting until the acquisition timeout // configured in this test, the test will timeout before the client can // reinitialize after lease expiration. name: "LeaseExpireWithLargeAcquisitionTimeout", typ: testLeaseExpire, // A large enough duration for the test to timeout. acquireTimeout: 1000 * time.Hour, durations: []time.Duration{ // First acquisition. 0, // Transition to renew. renewTime.Duration(), // Give renew acquisition 10ms timeout, and expect it to timeout. (rebindTime - renewTime).Duration() - 10*time.Millisecond, // Transition to rebind. 10 * time.Millisecond, // Give rebind acquisition 10ms timeout, and expect it to timeout. (leaseLength - rebindTime).Duration() - 10*time.Millisecond, // Transition to lease expiration. 10 * time.Millisecond, // Second acquisition after lease expiration. 0, }, }, } { t.Run(tc.name, func(t *testing.T) { var wg sync.WaitGroup defer wg.Wait() ctx, cancel := context.WithCancel(context.Background()) defer cancel() s := stack.New(stack.Options{}) if err := s.CreateNIC(testNICID, &endpoint{}); err != nil { t.Fatalf("s.CreateNIC(_, nil) = %s", err) } c := newZeroJitterClient(s, testNICID, linkAddr1, tc.acquireTimeout, defaultBackoffTime, defaultRetransTime, nil) c.acquire = func(ctx context.Context, _ *Client, _ string, info *Info) (Config, error) { timeout := false switch info.State { case renewing: if tc.typ == testRebind { timeout = true } fallthrough case rebinding: if tc.typ == testLeaseExpire { timeout = true } } if timeout { // Simulates a timeout using the deadline from context. <-ctx.Done() return Config{}, fmt.Errorf("fake test timeout error: %w", ctx.Err()) } info.Addr = tcpip.AddressWithPrefix{ Address: "\xc0\xa8\x03\x02", PrefixLen: 24, } return Config{ RenewTime: renewTime, RebindTime: rebindTime, LeaseLength: leaseLength, }, nil } clientTransitionsDone := make(chan struct{}) c.now = stubTimeNow(ctx, time.Time{}, tc.durations, clientTransitionsDone) count := 0 var curAddr tcpip.AddressWithPrefix addrCh := make(chan tcpip.AddressWithPrefix) c.acquiredFunc = func(oldAddr, newAddr tcpip.AddressWithPrefix, cfg Config) { if oldAddr != curAddr { t.Fatalf("aquisition %d: curAddr=%s, oldAddr=%s", count, curAddr, oldAddr) } count++ curAddr = newAddr // Respond to context cancellation to avoid deadlock when enclosing test // times out. select { case <-ctx.Done(): case addrCh <- curAddr: } } wg.Add(1) go func() { c.Run(ctx) wg.Done() }() wantAddr := <-addrCh t.Logf("got first address: %s", wantAddr) // The first address is always acquired through init selecting state. if got := c.stats.InitAcquire.Value(); got != 1 { t.Errorf("client entered initselecting state %d times, want: 1", got) } if tc.typ == testLeaseExpire { if gotAddr, wantAddr := <-addrCh, (tcpip.AddressWithPrefix{}); gotAddr != wantAddr { t.Fatalf("lease did not correctly expire: got unexpected address = %s, want = %s", gotAddr, wantAddr) } } if gotAddr := <-addrCh; gotAddr != wantAddr { t.Fatalf("incorrect new address: got = %s, want = %s", gotAddr, wantAddr) } <-clientTransitionsDone switch tc.typ { case testRenew: if got := c.stats.RenewAcquire.Value(); got != 1 { t.Errorf("client entered renew state %d times, want: 1", got) } case testRebind: if got := c.stats.RebindAcquire.Value(); got != 1 { t.Errorf("client entered rebind state %d times, want: 1", got) } case testLeaseExpire: if got := c.stats.RenewAcquire.Value(); got == 0 { t.Error("client did not renew before lease expiration, want at least once") } if got := c.stats.RebindAcquire.Value(); got == 0 { t.Error("client did not rebind before lease expiration, want at least once") } } }) } }
explode_data.jsonl/20581
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 2871 }
[ 2830, 3393, 1397, 21768, 1155, 353, 8840, 836, 8, 341, 13158, 1273, 929, 526, 198, 4777, 2399, 197, 18185, 34625, 365, 1273, 929, 284, 81910, 198, 197, 18185, 693, 7666, 198, 197, 18185, 2304, 519, 8033, 554, 198, 197, 692, 4777, 2399...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestProposalQueues(t *testing.T) { input := getMockApp(t, 0, GenesisState{}, nil) header := abci.Header{Height: input.mApp.LastBlockHeight() + 1} input.mApp.BeginBlock(abci.RequestBeginBlock{Header: header}) ctx := input.mApp.BaseApp.NewContext(false, abci.Header{}) input.mApp.InitChainer(ctx, abci.RequestInitChain{}) // create test proposals tp := testProposal() proposal, err := input.keeper.SubmitProposal(ctx, tp) require.NoError(t, err) inactiveIterator := input.keeper.InactiveProposalQueueIterator(ctx, proposal.DepositEndTime) require.True(t, inactiveIterator.Valid()) var proposalID uint64 input.keeper.cdc.UnmarshalBinaryLengthPrefixed(inactiveIterator.Value(), &proposalID) require.Equal(t, proposalID, proposal.ProposalID) inactiveIterator.Close() input.keeper.activateVotingPeriod(ctx, proposal) proposal, ok := input.keeper.GetProposal(ctx, proposal.ProposalID) require.True(t, ok) activeIterator := input.keeper.ActiveProposalQueueIterator(ctx, proposal.VotingEndTime) require.True(t, activeIterator.Valid()) input.keeper.cdc.UnmarshalBinaryLengthPrefixed(activeIterator.Value(), &proposalID) require.Equal(t, proposalID, proposal.ProposalID) activeIterator.Close() }
explode_data.jsonl/36932
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 410 }
[ 2830, 3393, 98637, 25776, 1137, 1155, 353, 8840, 836, 8, 341, 22427, 1669, 633, 11571, 2164, 1155, 11, 220, 15, 11, 40788, 1397, 22655, 2092, 692, 20883, 1669, 668, 5855, 15753, 90, 3640, 25, 1946, 744, 2164, 24682, 4713, 3640, 368, 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 TestGetTeamStats(t *testing.T) { th := Setup(t).InitBasic() defer th.TearDown() t.Run("without view restrictions", func(t *testing.T) { teamStats, err := th.App.GetTeamStats(th.BasicTeam.Id, nil) require.Nil(t, err) require.NotNil(t, teamStats) members, err := th.App.GetTeamMembers(th.BasicTeam.Id, 0, 5, nil) require.Nil(t, err) assert.Equal(t, int64(len(members)), teamStats.TotalMemberCount) assert.Equal(t, int64(len(members)), teamStats.ActiveMemberCount) }) t.Run("with view restrictions by this team", func(t *testing.T) { restrictions := &model.ViewUsersRestrictions{Teams: []string{th.BasicTeam.Id}} teamStats, err := th.App.GetTeamStats(th.BasicTeam.Id, restrictions) require.Nil(t, err) require.NotNil(t, teamStats) members, err := th.App.GetTeamMembers(th.BasicTeam.Id, 0, 5, nil) require.Nil(t, err) assert.Equal(t, int64(len(members)), teamStats.TotalMemberCount) assert.Equal(t, int64(len(members)), teamStats.ActiveMemberCount) }) t.Run("with view restrictions by valid channel", func(t *testing.T) { restrictions := &model.ViewUsersRestrictions{Teams: []string{}, Channels: []string{th.BasicChannel.Id}} teamStats, err := th.App.GetTeamStats(th.BasicTeam.Id, restrictions) require.Nil(t, err) require.NotNil(t, teamStats) members, err := th.App.GetChannelMembersPage(th.BasicChannel.Id, 0, 5) require.Nil(t, err) assert.Equal(t, int64(len(*members)), teamStats.TotalMemberCount) assert.Equal(t, int64(len(*members)), teamStats.ActiveMemberCount) }) t.Run("with view restrictions to not see anything", func(t *testing.T) { restrictions := &model.ViewUsersRestrictions{Teams: []string{}, Channels: []string{}} teamStats, err := th.App.GetTeamStats(th.BasicTeam.Id, restrictions) require.Nil(t, err) require.NotNil(t, teamStats) assert.Equal(t, int64(0), teamStats.TotalMemberCount) assert.Equal(t, int64(0), teamStats.ActiveMemberCount) }) t.Run("with view restrictions by other team", func(t *testing.T) { restrictions := &model.ViewUsersRestrictions{Teams: []string{"other-team-id"}} teamStats, err := th.App.GetTeamStats(th.BasicTeam.Id, restrictions) require.Nil(t, err) require.NotNil(t, teamStats) assert.Equal(t, int64(0), teamStats.TotalMemberCount) assert.Equal(t, int64(0), teamStats.ActiveMemberCount) }) t.Run("with view restrictions by not-existing channel", func(t *testing.T) { restrictions := &model.ViewUsersRestrictions{Teams: []string{}, Channels: []string{"test"}} teamStats, err := th.App.GetTeamStats(th.BasicTeam.Id, restrictions) require.Nil(t, err) require.NotNil(t, teamStats) assert.Equal(t, int64(0), teamStats.TotalMemberCount) assert.Equal(t, int64(0), teamStats.ActiveMemberCount) }) }
explode_data.jsonl/30279
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1043 }
[ 2830, 3393, 1949, 14597, 16635, 1155, 353, 8840, 836, 8, 341, 70479, 1669, 18626, 1155, 568, 3803, 15944, 741, 16867, 270, 836, 682, 4454, 2822, 3244, 16708, 445, 28996, 1651, 16869, 497, 2915, 1155, 353, 8840, 836, 8, 341, 197, 197, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func Test_buildLineArray(t *testing.T) { type args struct { str string } tests := []struct { name string args args want []string }{ {"1", args{" line 1 \n line 2 \nline 3"}, []string{"line 1", "line 2", "line 3"}}, {"2", args{" line 1 \r\n line 2 \r\nline 3"}, []string{"line 1", "line 2", "line 3"}}, {"3", args{" line 1 \n ;line 2 \n#line 3"}, []string{"line 1"}}, {"4", args{""}, []string{}}, {"5", args{"\n\n\n \n"}, []string{}}, {"6", args{"#hello"}, []string{}}, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { if got := buildLineArray(tt.args.str); !reflect.DeepEqual(got, tt.want) { t.Errorf("buildLineArray() = %v, want %v", got, tt.want) } }) } }
explode_data.jsonl/62168
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 316 }
[ 2830, 3393, 20801, 2460, 1857, 1155, 353, 8840, 836, 8, 341, 13158, 2827, 2036, 341, 197, 11355, 914, 198, 197, 532, 78216, 1669, 3056, 1235, 341, 197, 11609, 914, 198, 197, 31215, 2827, 198, 197, 50780, 3056, 917, 198, 197, 59403, 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...
2
func TestVariables_Validate(t *testing.T) { t.Run("nil", func(t *testing.T) { var o Variables if err := o.Validate(); err != nil { t.Errorf("unexpected error: %v", err) } }) t.Run("empty", func(t *testing.T) { var o Variables o.Vars = make(map[string]VarInfo, 0) if err := o.Validate(); err != nil { t.Errorf("unexpected error: %v", err) } }) }
explode_data.jsonl/61181
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 164 }
[ 2830, 3393, 22678, 62, 17926, 1155, 353, 8840, 836, 8, 341, 3244, 16708, 445, 8385, 497, 2915, 1155, 353, 8840, 836, 8, 341, 197, 2405, 297, 21419, 198, 197, 743, 1848, 1669, 297, 47667, 2129, 1848, 961, 2092, 341, 298, 3244, 13080, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestNonParametric_Const(t *testing.T) { testData := []struct { name string data []float64 minSegment int ref []int }{ {"Empty", []float64{}, 1, nil}, {"Test1", []float64{3240, 3207, 2029, 3028, 3021, 2624, 3290, 2823, 3573}, 1, nil}, {"Test2", big, 1, []int{100}}, {"Test3", []float64{0, 0, 0, 0, 0, 100, 100, 100, 100}, 1, []int{5}}, {"Test4", []float64{0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2}, 1, []int{6, 12}}, {"MinSegmentTooBig", []float64{0, 0, 0, 0, 1, 1, 1}, 4, nil}, {"MinSegmentJustRight", []float64{0, 0, 0, 0, 1, 1, 1, 1}, 4, []int{4}}, } for _, td := range testData { t.Run(td.name, func(t *testing.T) { compareChangepoints(t, td.data, td.minSegment, td.ref) }) } }
explode_data.jsonl/61526
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 376 }
[ 2830, 3393, 8121, 2001, 16340, 15100, 267, 1155, 353, 8840, 836, 8, 341, 18185, 1043, 1669, 3056, 1235, 341, 197, 11609, 981, 914, 198, 197, 8924, 981, 3056, 3649, 21, 19, 198, 197, 25320, 21086, 526, 198, 197, 59504, 286, 3056, 396, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestCacheFasthttp(t *testing.T) { var n uint32 mux := func(reqCtx *fasthttp.RequestCtx) { atomic.AddUint32(&n, 1) reqCtx.Write([]byte(expectedBodyStr)) } cachedMux := httpcache.CacheFasthttpFunc(mux, cacheDuration) e := httptest.New(t, httptest.RequestHandler(cachedMux)) if err := runTest(e, &n, expectedBodyStr, ""); err != nil { t.Fatal(err) } }
explode_data.jsonl/16264
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 161 }
[ 2830, 3393, 8233, 32174, 1254, 1155, 353, 8840, 836, 8, 341, 2405, 308, 2622, 18, 17, 198, 2109, 2200, 1669, 2915, 6881, 23684, 353, 9349, 1254, 9659, 23684, 8, 341, 197, 78739, 1904, 21570, 18, 17, 2099, 77, 11, 220, 16, 340, 197, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestDateBeforeToday(t *testing.T) { today := Date(time.Now()) date, _ := DateFromString(today.String()) if date.Before(today) { t.Errorf("date '%v' should not be before today (%v)", date, today) } if today.Before(*date) { t.Errorf("today (%v) should not be before date '%v'", today, date) } }
explode_data.jsonl/33904
{ "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, 1916, 10227, 15364, 1155, 353, 8840, 836, 8, 341, 3244, 6289, 1669, 2631, 9730, 13244, 2398, 44086, 11, 716, 1669, 2631, 44491, 75693, 6431, 12367, 743, 2400, 31153, 75693, 8, 341, 197, 3244, 13080, 445, 1028, 7677, 85, 6, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestHandshakeClientCHACHA20SHA256(t *testing.T) { test := &clientTest{ name: "CHACHA20-SHA256", args: []string{"-ciphersuites", "TLS_CHACHA20_POLY1305_SHA256"}, } runClientTestTLS13(t, test) }
explode_data.jsonl/27707
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 90 }
[ 2830, 3393, 2314, 29661, 2959, 2149, 11873, 32, 17, 15, 33145, 17, 20, 21, 1155, 353, 8840, 836, 8, 341, 18185, 1669, 609, 2972, 2271, 515, 197, 11609, 25, 330, 2149, 11873, 32, 17, 15, 6222, 17020, 17, 20, 21, 756, 197, 31215, 25...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func Test_BKDRHash64(t *testing.T) { var x uint64 = 4214762819217104013 gtest.C(t, func(t *gtest.T) { j := ghash.BKDRHash64(strBasic) t.Assert(j, x) }) }
explode_data.jsonl/60227
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 84 }
[ 2830, 3393, 1668, 42, 7687, 6370, 21, 19, 1155, 353, 8840, 836, 8, 341, 2405, 856, 2622, 21, 19, 284, 220, 19, 17, 16, 19, 22, 21, 17, 23, 16, 24, 17, 16, 22, 16, 15, 19, 15, 16, 18, 198, 3174, 1944, 727, 1155, 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...
1
func TestScheduleJob(t *testing.T) { t.Parallel() const jobID = "1234567890abcd" jobName := pinpoint.LegacyJobName(jobID) ts := startFakeLegacyServer(t, map[string]string{ "/api/new": fmt.Sprintf(`{"jobId": %q}`, jobID), }) defer ts.Close() ctx := context.Background() authorizedCtx := metadata.NewOutgoingContext(ctx, metadata.MD{ EndpointsHeader: []string{ base64.RawURLEncoding.EncodeToString([]byte(`{"email": "user@example.com"}`)), }, }) Convey("Given a grpc server with a client", t, func() { dialer := registerPinpointServer(t, &pinpointServer{legacyPinpointService: ts.URL, LegacyClient: &http.Client{}}) conn, err := grpc.DialContext(ctx, "bufnet", grpc.WithContextDialer(dialer), grpc.WithInsecure()) So(err, ShouldBeNil) defer conn.Close() client := proto.NewPinpointClient(conn) Convey("without authentication, ScheduleJob fails", func() { _, err := client.ScheduleJob(ctx, &proto.ScheduleJobRequest{}) So(err, ShouldBeStatusError, codes.PermissionDenied) }) Convey("with authentication", func() { ctx := authorizedCtx Convey("without appropriate arguments, ScheduleJob fails", func() { _, err := client.ScheduleJob(ctx, &proto.ScheduleJobRequest{}) So(err, ShouldBeStatusError, codes.InvalidArgument) }) Convey("with correct GTestBenchmark arguments, ScheduleJob succeeds", func() { j, err := client.ScheduleJob(ctx, &proto.ScheduleJobRequest{ Job: &proto.JobSpec{ Config: "some-config", Target: "some-target", Arguments: &proto.JobSpec_GtestBenchmark{ GtestBenchmark: &proto.GTestBenchmark{ Benchmark: "benchmark", Test: "test", Measurement: "measurement", }, }, }, }) So(err, ShouldBeNil) So(j.Name, ShouldEqual, jobName) }) Convey("with extra args for a Telemetry job, ScheduleJob succeeds", func() { j, err := client.ScheduleJob(ctx, &proto.ScheduleJobRequest{ Job: &proto.JobSpec{ Config: "some-config", Target: "some-target", Arguments: &proto.JobSpec_TelemetryBenchmark{ TelemetryBenchmark: &proto.TelemetryBenchmark{ Benchmark: "benchmark", StorySelection: &proto.TelemetryBenchmark_Story{ Story: "some-story", }, Measurement: "measurement", ExtraArgs: []string{"--browser", "some-browser"}, }, }, }, }) So(err, ShouldBeNil) So(j.Name, ShouldEqual, jobName) }) }) }) }
explode_data.jsonl/53296
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1047 }
[ 2830, 3393, 32210, 12245, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 2822, 4777, 2618, 915, 284, 330, 16, 17, 18, 19, 20, 21, 22, 23, 24, 15, 68644, 698, 68577, 675, 1669, 66538, 1214, 791, 2757, 12245, 675, 28329, 915, 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 TestWithShardBlockSize(t *testing.T) { sharedMap := NewSharedMap(WithShardBlockSize(10)) assert.EqualValues(t, uint32(16), sharedMap.shardBlockSize) assert.EqualValues(t, uint32(16), sharedMap.n+1) }
explode_data.jsonl/77829
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 80 }
[ 2830, 3393, 2354, 2016, 567, 89932, 1155, 353, 8840, 836, 8, 341, 197, 6100, 2227, 1669, 1532, 16997, 2227, 7, 2354, 2016, 567, 89932, 7, 16, 15, 1171, 6948, 12808, 6227, 1155, 11, 2622, 18, 17, 7, 16, 21, 701, 6094, 2227, 2395, 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 TestClient_logStderr(t *testing.T) { orig := stdErrBufferSize stdErrBufferSize = 32 defer func() { stdErrBufferSize = orig }() stderr := bytes.Buffer{} c := NewClient(&ClientConfig{ Stderr: &stderr, Cmd: &exec.Cmd{ Path: "test", }, }) c.clientWaitGroup.Add(1) msg := ` this line is more than 32 bytes long and this line is more than 32 bytes long {"a": "b", "@level": "debug"} this line is short ` reader := strings.NewReader(msg) c.stderrWaitGroup.Add(1) c.logStderr(reader) read := stderr.String() if read != msg { t.Fatalf("\nexpected output: %q\ngot output: %q", msg, read) } }
explode_data.jsonl/57863
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 259 }
[ 2830, 3393, 2959, 5224, 22748, 615, 1155, 353, 8840, 836, 8, 341, 197, 4670, 1669, 1460, 7747, 52661, 198, 6736, 7747, 52661, 284, 220, 18, 17, 198, 16867, 2915, 368, 341, 197, 6736, 7747, 52661, 284, 2713, 198, 197, 66816, 6736, 615,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestMissingPubKey(t *testing.T) { _, err := New(&GinJWTMiddleware{ Realm: "zone", SigningAlgorithm: "RS256", PrivKeyFile: "testdata/jwtRS256.key", PubKeyFile: "nonexisting", }) assert.Error(t, err) assert.Equal(t, ErrNoPubKeyFile, err) }
explode_data.jsonl/64429
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 134 }
[ 2830, 3393, 25080, 29162, 1592, 1155, 353, 8840, 836, 8, 341, 197, 6878, 1848, 1669, 1532, 2099, 38, 258, 55172, 24684, 515, 197, 197, 64290, 25, 310, 330, 8684, 756, 197, 197, 93358, 27847, 25, 330, 11451, 17, 20, 21, 756, 197, 197...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestIntArray_Unique(t *testing.T) { gtest.C(t, func(t *gtest.T) { expect := []int{1, 2, 3, 4, 5, 3, 2, 2, 3, 5, 5} array := garray.NewIntArrayFrom(expect) t.Assert(array.Unique().Slice(), []int{1, 2, 3, 4, 5}) }) }
explode_data.jsonl/47596
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 113 }
[ 2830, 3393, 95338, 62, 22811, 1155, 353, 8840, 836, 8, 341, 3174, 1944, 727, 1155, 11, 2915, 1155, 353, 82038, 836, 8, 341, 197, 24952, 1669, 3056, 396, 90, 16, 11, 220, 17, 11, 220, 18, 11, 220, 19, 11, 220, 20, 11, 220, 18, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestCanonicalizeReferenceResults(t *testing.T) { linkedReferenceResults := datastructures.DisjointIDSet{} linkedReferenceResults.Union("x01", "x03") state := &State{ RangeData: map[string]lsif.RangeData{ "r01": {ReferenceResultID: "x02"}, "r02": {ReferenceResultID: "x03"}, }, ResultSetData: map[string]lsif.ResultSetData{ "s03": {ReferenceResultID: "x03"}, "s04": {ReferenceResultID: "x04"}, }, ReferenceData: map[string]datastructures.DefaultIDSetMap{ "x01": {"d01": {"r05": {}}}, "x02": {"d02": {"r06": {}}, "d04": {"r07": {}}}, "x03": {"d01": {"r08": {}}, "d03": {"r09": {}}}, "x04": {"d04": {"r10": {}}}, }, LinkedReferenceResults: linkedReferenceResults, } canonicalizeReferenceResults(state) expectedState := &State{ RangeData: map[string]lsif.RangeData{ "r01": {ReferenceResultID: "x02"}, "r02": {ReferenceResultID: "x01"}, }, ResultSetData: map[string]lsif.ResultSetData{ "s03": {ReferenceResultID: "x01"}, "s04": {ReferenceResultID: "x04"}, }, ReferenceData: map[string]datastructures.DefaultIDSetMap{ "x01": {"d01": {"r05": {}, "r08": {}}, "d03": {"r09": {}}}, "x02": {"d02": {"r06": {}}, "d04": {"r07": {}}}, "x04": {"d04": {"r10": {}}}, }, LinkedReferenceResults: linkedReferenceResults, } if diff := cmp.Diff(expectedState, state); diff != "" { t.Errorf("unexpected state (-want +got):\n%s", diff) } }
explode_data.jsonl/40067
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 598 }
[ 2830, 3393, 70914, 551, 8856, 9801, 1155, 353, 8840, 836, 8, 341, 197, 43133, 8856, 9801, 1669, 821, 46094, 10166, 32850, 915, 1649, 16094, 197, 43133, 8856, 9801, 10616, 290, 445, 87, 15, 16, 497, 330, 87, 15, 18, 5130, 24291, 1669, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestContainsKey(t *testing.T) { tests := map[string]struct { mapOfObjs map[string]interface{} searchKey string hasKey bool }{ "contains key - +ve test case - map having the key": { mapOfObjs: map[string]interface{}{ "k1": "v1", }, searchKey: "k1", hasKey: true, }, "contains key - +ve test case - map without the key": { mapOfObjs: map[string]interface{}{ "k1": "v1", }, searchKey: "k2", hasKey: false, }, "contains key - +ve test case - empty map": { mapOfObjs: map[string]interface{}{}, searchKey: "k1", hasKey: false, }, "contains key - +ve test case - nil map": { mapOfObjs: nil, searchKey: "k1", hasKey: false, }, "contains key - +ve test case - with empty search key": { mapOfObjs: map[string]interface{}{ "k1": "v1", }, searchKey: "", hasKey: false, }, } for name, mock := range tests { t.Run(name, func(t *testing.T) { hasKey := ContainsKey(mock.mapOfObjs, mock.searchKey) if hasKey != mock.hasKey { t.Fatalf("failed to test contains key: expected key '%s': actual 'not found'", mock.searchKey) } }) } }
explode_data.jsonl/44190
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 523 }
[ 2830, 3393, 23805, 1592, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 2415, 14032, 60, 1235, 341, 197, 19567, 2124, 4121, 2519, 2415, 14032, 31344, 16094, 197, 45573, 1592, 914, 198, 197, 63255, 1592, 262, 1807, 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...
2
func TestCreateAppProtectPolicyEx(t *testing.T) { tests := []struct { policy *unstructured.Unstructured expectedPolicyEx *AppProtectPolicyEx wantErr bool msg string }{ { policy: &unstructured.Unstructured{ Object: map[string]interface{}{ "metadata": map[string]interface{}{ "uid": "1", }, "spec": map[string]interface{}{ "policy": map[string]interface{}{ "name": "TestPolicy", "signature-requirements": []interface{}{ map[string]interface{}{ "maxRevisionDatetime": "2020-01-23T18:32:02Z", "minRevisionDatetime": "2020-01-21T18:32:02Z", "tag": "MinMax", }, map[string]interface{}{ "maxRevisionDatetime": "2020-01-23T18:32:02Z", "tag": "Max", }, map[string]interface{}{ "minRevisionDatetime": "2020-01-23T18:32:02Z", "tag": "Min", }, }, }, }, }, }, expectedPolicyEx: &AppProtectPolicyEx{ SignatureReqs: []SignatureReq{ { Tag: "MinMax", RevTimes: &RevTimes{ MinRevTime: parseTime("2020-01-21T18:32:02Z"), MaxRevTime: parseTime("2020-01-23T18:32:02Z"), }, }, { Tag: "Max", RevTimes: &RevTimes{ MaxRevTime: parseTime("2020-01-23T18:32:02Z"), }, }, { Tag: "Min", RevTimes: &RevTimes{ MinRevTime: parseTime("2020-01-23T18:32:02Z"), }, }, }, IsValid: true, ErrorMsg: "", }, wantErr: false, msg: "valid policy", }, { policy: &unstructured.Unstructured{ Object: map[string]interface{}{ "spec": map[string]interface{}{ "policy": map[string]interface{}{ "name": "TestPolicy", "signature-requirements": []interface{}{ map[string]interface{}{ "minRevisionDatetime": "time", "tag": "MinMax", }, }, }, }, }, }, expectedPolicyEx: &AppProtectPolicyEx{ SignatureReqs: nil, IsValid: false, ErrorMsg: "Invalid timestamp", }, wantErr: true, msg: "policy with invalid min timestamp", }, { policy: &unstructured.Unstructured{ Object: map[string]interface{}{ "spec": map[string]interface{}{ "policy": map[string]interface{}{ "name": "TestPolicy", "signature-requirements": []interface{}{ map[string]interface{}{ "maxRevisionDatetime": "time", "tag": "MinMax", }, }, }, }, }, }, expectedPolicyEx: &AppProtectPolicyEx{ SignatureReqs: nil, IsValid: false, ErrorMsg: "Invalid timestamp", }, wantErr: true, msg: "policy with invalid max timestamp", }, { policy: &unstructured.Unstructured{ Object: map[string]interface{}{ "spec": map[string]interface{}{}, }, }, expectedPolicyEx: &AppProtectPolicyEx{ SignatureReqs: nil, IsValid: false, ErrorMsg: "Validation Failed", }, wantErr: true, msg: "policy empty spec", }, { policy: &unstructured.Unstructured{ Object: map[string]interface{}{ "spec": map[string]interface{}{ "policy": map[string]interface{}{ "name": "TestPolicy", "signature-requirements": map[string]interface{}{ "invalid": map[string]interface{}{ "maxRevisionDatetime": "time", "tag": "MinMax", }, }, }, }, }, }, expectedPolicyEx: &AppProtectPolicyEx{ SignatureReqs: nil, IsValid: false, ErrorMsg: failedValidationErrorMsg, }, wantErr: true, msg: "policy with incorrect structure", }, } for _, test := range tests { test.expectedPolicyEx.Obj = test.policy policyEx, err := createAppProtectPolicyEx(test.policy) if (err != nil) != test.wantErr { t.Errorf("createAppProtectPolicyEx() returned %v, for the case of %s", err, test.msg) } if diff := cmp.Diff(test.expectedPolicyEx, policyEx); diff != "" { t.Errorf("createAppProtectPolicyEx() %q returned unexpected result (-want +got):\n%s", test.msg, diff) } } }
explode_data.jsonl/19380
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 2165 }
[ 2830, 3393, 4021, 2164, 61547, 13825, 840, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 3056, 1235, 341, 197, 3223, 8018, 1843, 353, 359, 51143, 10616, 51143, 198, 197, 42400, 13825, 840, 353, 2164, 61547, 13825, 840, 198, 197, 50780, 774...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestMVCCStatsTxnSysPutPut(t *testing.T) { defer leaktest.AfterTest(t)() engine := createTestEngine() defer engine.Close() ctx := context.Background() aggMS := &enginepb.MVCCStats{} assertEq(t, engine, "initially", aggMS, &enginepb.MVCCStats{}) key := keys.RangeDescriptorKey(roachpb.RKey("a")) ts1 := hlc.Timestamp{WallTime: 1E9} ts2 := hlc.Timestamp{WallTime: 2E9} txn := &roachpb.Transaction{TxnMeta: enginepb.TxnMeta{ID: uuid.MakeV4(), Timestamp: ts1}} // Write an intent at ts1. val1 := roachpb.MakeValueFromString("value") if err := MVCCPut(ctx, engine, aggMS, key, ts1, val1, txn); err != nil { t.Fatal(err) } mKeySize := int64(mvccKey(key).EncodedSize()) require.EqualValues(t, mKeySize, 11) mValSize := int64((&enginepb.MVCCMetadata{ Timestamp: hlc.LegacyTimestamp(ts1), Deleted: false, Txn: &txn.TxnMeta, }).Size()) require.EqualValues(t, mValSize, 44) vKeySize := mvccVersionTimestampSize require.EqualValues(t, vKeySize, 12) vVal1Size := int64(len(val1.RawBytes)) require.EqualValues(t, vVal1Size, 10) val2 := roachpb.MakeValueFromString("longvalue") vVal2Size := int64(len(val2.RawBytes)) require.EqualValues(t, vVal2Size, 14) expMS := enginepb.MVCCStats{ LastUpdateNanos: 1E9, SysBytes: mKeySize + mValSize + vKeySize + vVal1Size, // 11+44+12+10 = 77 SysCount: 1, } assertEq(t, engine, "after first put", aggMS, &expMS) // Rewrite the intent to ts2 with a different value. txn.Timestamp.Forward(ts2) txn.Sequence++ // The new meta value grows because we've bumped `txn.Sequence`. // The value also grows as the older value is part of the same // transaction and so contributes to the intent history. mVal2Size := int64((&enginepb.MVCCMetadata{ Timestamp: hlc.LegacyTimestamp(ts2), Deleted: false, Txn: &txn.TxnMeta, IntentHistory: []enginepb.MVCCMetadata_SequencedIntent{ {Sequence: 0, Value: val1.RawBytes}, }, }).Size()) require.EqualValues(t, mVal2Size, 62) if err := MVCCPut(ctx, engine, aggMS, key, ts2, val2, txn); err != nil { t.Fatal(err) } expMS = enginepb.MVCCStats{ LastUpdateNanos: 1E9, SysBytes: mKeySize + mVal2Size + vKeySize + vVal2Size, // 11+46+12+14 = 83 SysCount: 1, } assertEq(t, engine, "after intent rewrite", aggMS, &expMS) }
explode_data.jsonl/41648
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 975 }
[ 2830, 3393, 66626, 3706, 16635, 31584, 77, 32792, 19103, 19103, 1155, 353, 8840, 836, 8, 341, 16867, 23352, 1944, 36892, 2271, 1155, 8, 741, 80118, 1669, 1855, 2271, 4571, 741, 16867, 4712, 10421, 2822, 20985, 1669, 2266, 19047, 741, 197,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestAccPingAccessVersionDataSource(t *testing.T) { resourceName := "data.pingaccess_version.test" resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, ProtoV5ProviderFactories: testAccProviders, Steps: []resource.TestStep{ { Config: testAccPingAccessVersionConfig(), Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttrSet(resourceName, "version"), ), }, }, }) }
explode_data.jsonl/11695
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 181 }
[ 2830, 3393, 14603, 69883, 6054, 5637, 17173, 1155, 353, 8840, 836, 8, 341, 50346, 675, 1669, 330, 691, 98247, 5211, 9438, 5958, 1837, 50346, 8787, 1155, 11, 5101, 31363, 515, 197, 197, 4703, 3973, 25, 338, 2915, 368, 314, 1273, 14603, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestCheckIssueWithProofs(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 := createIssueWithProofs(t, 1000) info := defaultCheckerInfo(t) to.stor.addBlock(t, blockID0) _, err := to.tc.checkIssueWithProofs(tx, info) assert.NoError(t, err, "checkIssueWithProofs failed with valid issue tx") tx.Timestamp = 0 _, err = to.tc.checkIssueWithProofs(tx, info) assert.Error(t, err, "checkIssueWithProofs did not fail with invalid timestamp") }
explode_data.jsonl/63079
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 226 }
[ 2830, 3393, 3973, 42006, 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, 4185, 727, 2675, 59362, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestTextGenerator_GenerateDataBySchema_MaxLengthLessThanMinLength_Error(t *testing.T) { textGeneratorInstance := &textGenerator{} schema := openapi3.NewSchema() var maxLength uint64 = 4 schema.MinLength = 5 schema.MaxLength = &maxLength data, err := textGeneratorInstance.GenerateDataBySchema(context.Background(), schema) assert.EqualError(t, err, "[textGenerator] max length cannot be less than min length") assert.Equal(t, "", data) }
explode_data.jsonl/45034
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 150 }
[ 2830, 3393, 1178, 12561, 2646, 13220, 1043, 1359, 8632, 58843, 4373, 27451, 26067, 6217, 4373, 28651, 1155, 353, 8840, 836, 8, 341, 15425, 12561, 2523, 1669, 609, 1318, 12561, 16094, 1903, 3416, 1669, 1787, 2068, 18, 7121, 8632, 741, 2405...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestMixedMPReachMPUnreach(t *testing.T) { aspath1 := []bgp.AsPathParamInterface{ bgp.NewAs4PathParam(2, []uint32{100}), } nlri1 := []bgp.AddrPrefixInterface{bgp.NewIPv6AddrPrefix(32, "2222::")} nlri2 := []bgp.AddrPrefixInterface{bgp.NewIPv6AddrPrefix(32, "1111::")} p := []bgp.PathAttributeInterface{ bgp.NewPathAttributeOrigin(0), bgp.NewPathAttributeAsPath(aspath1), bgp.NewPathAttributeMpReachNLRI("1::1", nlri1), bgp.NewPathAttributeMpUnreachNLRI(nlri2), } msg := bgp.NewBGPUpdateMessage(nil, p, nil) pList := ProcessMessage(msg, peerR1(), time.Now()) assert.Equal(t, len(pList), 2) assert.Equal(t, pList[0].IsWithdraw, false) assert.Equal(t, pList[1].IsWithdraw, true) msgs := CreateUpdateMsgFromPaths(pList) assert.Equal(t, len(msgs), 2) uIndex := unreachIndex(msgs) rIndex := 0 if uIndex == 0 { rIndex = 1 } assert.Equal(t, len(msgs[uIndex].Body.(*bgp.BGPUpdate).PathAttributes), 1) assert.Equal(t, len(msgs[rIndex].Body.(*bgp.BGPUpdate).PathAttributes), 3) }
explode_data.jsonl/29062
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 441 }
[ 2830, 3393, 86433, 5781, 48368, 5781, 1806, 22606, 1155, 353, 8840, 836, 8, 341, 60451, 2343, 16, 1669, 3056, 12220, 79, 20242, 93492, 5051, 515, 197, 2233, 21888, 7121, 2121, 19, 93492, 7, 17, 11, 3056, 2496, 18, 17, 90, 16, 15, 15...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestAddBytesReadListener(t *testing.T) { for i := 0; i < 3; i++ { name := fmt.Sprintf("AddBytesReadListener(%d)", i) t.Run(name, func(t *testing.T) { testAddBytesReadListener(i, t) }) } }
explode_data.jsonl/50579
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 89 }
[ 2830, 3393, 2212, 7078, 4418, 2743, 1155, 353, 8840, 836, 8, 341, 2023, 600, 1669, 220, 15, 26, 600, 366, 220, 18, 26, 600, 1027, 341, 197, 11609, 1669, 8879, 17305, 445, 2212, 7078, 4418, 2743, 15238, 67, 11583, 600, 340, 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...
1
func TestDeployListByName(t *testing.T) { deployment1, err := generateDeployment() if err != nil { t.Fatal(err) } deployment1.Deployment.Name = "test" deployment1.Deployment.Save() generateDeployment() if err != nil { t.Fatal(err) } key := mailbox.AccessKey{FullAccess: true} key.Create() req := api.DeploymentStatsRequest{ Count: 10, NamePattern: "t*t", } req.Sign(key.Name, key.Secret) var resp api.DeploymentStatsResponse code := doRequest(t, req, &resp, "deploy/list") if code != 200 { t.Fatalf("Server repsponded with %d", code) } if len(resp.Deployments) != 1 { t.Fatalf("Deployment length %d != 1", len(resp.Deployments)) } }
explode_data.jsonl/15719
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 273 }
[ 2830, 3393, 69464, 852, 16898, 1155, 353, 8840, 836, 8, 341, 197, 82213, 16, 11, 1848, 1669, 6923, 75286, 741, 743, 1848, 961, 2092, 341, 197, 3244, 26133, 3964, 340, 197, 532, 197, 82213, 16, 34848, 39130, 2967, 284, 330, 1944, 698, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestDefaultByteBuf_WriteUInt64(t *testing.T) { buf := EmptyByteBuf() buf.WriteUInt64(math.MaxUint64) if math.MaxUint64 != buf.ReadUInt64() { t.Fail() } }
explode_data.jsonl/1987
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 74 }
[ 2830, 3393, 3675, 7153, 15064, 31825, 18777, 21, 19, 1155, 353, 8840, 836, 8, 341, 26398, 1669, 22228, 7153, 15064, 741, 26398, 4073, 18777, 21, 19, 37270, 14535, 21570, 21, 19, 340, 743, 6888, 14535, 21570, 21, 19, 961, 6607, 91181, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_Workspace_Status_WhenSerializedToJson_DeserializesAsEqual(t *testing.T) { t.Parallel() parameters := gopter.DefaultTestParameters() parameters.MaxSize = 10 properties := gopter.NewProperties(parameters) properties.Property( "Round trip of Workspace_Status via JSON returns original", prop.ForAll(RunJSONSerializationTestForWorkspaceStatus, WorkspaceStatusGenerator())) properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout)) }
explode_data.jsonl/43361
{ "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, 87471, 8746, 36449, 62, 4498, 77521, 78967, 98054, 2848, 4756, 2121, 2993, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 741, 67543, 1669, 728, 73137, 13275, 2271, 9706, 741, 67543, 14535, 1695, 284, 220, 16, 15, 198, 869...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestSyncOptionReplaceFromCLI(t *testing.T) { Given(t). Path("config-map"). Replace(). When(). CreateApp(). Sync(). Then(). Expect(SyncStatusIs(SyncStatusCodeSynced)). And(func(app *Application) { assert.Equal(t, app.Status.OperationState.SyncResult.Resources[0].Message, "configmap/my-map created") }). When(). Sync(). Then(). Expect(SyncStatusIs(SyncStatusCodeSynced)). And(func(app *Application) { assert.Equal(t, app.Status.OperationState.SyncResult.Resources[0].Message, "configmap/my-map replaced") }) }
explode_data.jsonl/35669
{ "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, 12154, 5341, 23107, 3830, 63959, 1155, 353, 8840, 836, 8, 341, 9600, 2071, 1155, 4292, 197, 69640, 445, 1676, 25858, 38609, 197, 197, 23107, 25829, 197, 197, 4498, 25829, 197, 75569, 2164, 25829, 197, 7568, 1721, 25829, 197, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestConcatExpectElements(t *testing.T) { xs := Concat(FromSlice([]int{1}), FromSlice([]int{10}), Empty[int](), FromSlice([]int{100})).Slice() assert.Equal(t, []int{1, 10, 100}, xs) ys := Concat( FromSlice([]int{1, 2, 3}), Empty[int](), FromSlice([]int{}), Empty[int](), FromSlice([]int{10, 20, 30}), Empty[int](), ).Slice() assert.Equal(t, []int{1, 2, 3, 10, 20, 30}, ys) }
explode_data.jsonl/43973
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 194 }
[ 2830, 3393, 78440, 17536, 11868, 1155, 353, 8840, 836, 8, 341, 10225, 82, 1669, 78195, 7, 3830, 33236, 10556, 396, 90, 16, 38842, 5542, 33236, 10556, 396, 90, 16, 15, 38842, 22228, 18640, 60, 1507, 5542, 33236, 10556, 396, 90, 16, 15,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestRPrime(t *testing.T) { for _, ut := range rPrimeTests { if newRPrime := rPrime(ut.p.Rank, ut.in, defaultOptions); newRPrime != ut.out { t.Errorf("TestRPrime() = %+v, want %+v.", newRPrime, ut.out) } } }
explode_data.jsonl/22943
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 110 }
[ 2830, 3393, 49, 32306, 1155, 353, 8840, 836, 8, 341, 2023, 8358, 8621, 1669, 2088, 435, 32306, 18200, 341, 394, 421, 501, 49, 32306, 1669, 435, 32306, 7, 332, 556, 2013, 1180, 11, 8621, 1858, 11, 1638, 3798, 1215, 501, 49, 32306, 96...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestNew_Go(t *testing.T) { api := NewAPI() t.Run("Success", func(t *testing.T) { secretKey, err := ecdsa.GenerateKey(elliptic.P256(), rand.Reader) assert.Nil(t, err) certificate, err := GenerateCertificate(secretKey) assert.Nil(t, err) pc, err := api.NewPeerConnection(Configuration{ ICEServers: []ICEServer{ { URLs: []string{ "stun:stun.l.google.com:19302", "turns:google.de?transport=tcp", }, Username: "unittest", Credential: OAuthCredential{ MACKey: "WmtzanB3ZW9peFhtdm42NzUzNG0=", AccessToken: "AAwg3kPHWPfvk9bDFL936wYvkoctMADzQ==", }, CredentialType: ICECredentialTypeOauth, }, }, ICETransportPolicy: ICETransportPolicyRelay, BundlePolicy: BundlePolicyMaxCompat, RTCPMuxPolicy: RTCPMuxPolicyNegotiate, PeerIdentity: "unittest", Certificates: []Certificate{*certificate}, ICECandidatePoolSize: 5, }) assert.Nil(t, err) assert.NotNil(t, pc) }) t.Run("Failure", func(t *testing.T) { testCases := []struct { initialize func() (*PeerConnection, error) expectedErr error }{ {func() (*PeerConnection, error) { secretKey, err := ecdsa.GenerateKey(elliptic.P256(), rand.Reader) assert.Nil(t, err) certificate, err := NewCertificate(secretKey, x509.Certificate{ Version: 2, SerialNumber: big.NewInt(1653), NotBefore: time.Now().AddDate(0, -2, 0), NotAfter: time.Now().AddDate(0, -1, 0), }) assert.Nil(t, err) return api.NewPeerConnection(Configuration{ Certificates: []Certificate{*certificate}, }) }, &rtcerr.InvalidAccessError{Err: ErrCertificateExpired}}, {func() (*PeerConnection, error) { return api.NewPeerConnection(Configuration{ ICEServers: []ICEServer{ { URLs: []string{ "stun:stun.l.google.com:19302", "turns:google.de?transport=tcp", }, Username: "unittest", }, }, }) }, &rtcerr.InvalidAccessError{Err: ErrNoTurnCredencials}}, } for i, testCase := range testCases { _, err := testCase.initialize() assert.EqualError(t, err, testCase.expectedErr.Error(), "testCase: %d %v", i, testCase, ) } }) }
explode_data.jsonl/37343
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1081 }
[ 2830, 3393, 3564, 2646, 78, 1155, 353, 8840, 836, 8, 341, 54299, 1669, 1532, 7082, 741, 3244, 16708, 445, 7188, 497, 2915, 1155, 353, 8840, 836, 8, 341, 197, 197, 20474, 1592, 11, 1848, 1669, 384, 4385, 9081, 57582, 1592, 7, 613, 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 TestRssSource_GetClaims(t *testing.T) { tests := []struct { name string rssSource *RssSource want []Claim }{ { name: "Correctly maps rss feed tags", rssSource: rssSourceWithFeed(` <?xml version="1.0" encoding="UTF-8"?> <feed xmlns="http://www.w3.org/2005/Atom" xmlns:media="http://search.yahoo.com/mrss/"> <category term="publisher_name"/> <link href="http://publisher_site.com" /> <entry> <link href="http://article_url.com" /> <updated>2020-08-06T23:20:42+00:00</updated> <title>article title</title> </entry> <entry> <link href="http://second_article_url.com" /> <updated>2021-10-03T05:00:15+00:00</updated> <title>second article title</title> </entry> </feed> `), want: []Claim{ claim( "article title", "publisher_name", "http://article_url.com", true, time.Date(2020, 8, 6, 23, 20, 42, 0, time.UTC), ), claim( "second article title", "publisher_name", "http://second_article_url.com", true, time.Date(2021, 10, 3, 5, 0, 15, 0, time.UTC), ), }, }, { name: "Uses 'pubDate' for review date if 'updated' tag not available", rssSource: rssSourceWithFeed(` <rss xmlns:atom="http://www.w3.org/2005/Atom" xmlns:media="http://search.yahoo.com/mrss/" version="2.0"> <channel> <link>http://publisher_site.com</link> <category>publisher_name</category> <item> <title>article title</title> <link>http://article_url.com</link> <pubDate>Sun, 02 Aug 2020 15:13:00 +0000</pubDate> </item> </channel> </rss> `), want: []Claim{ claim( "article title", "publisher_name", "http://article_url.com", true, time.Date(2020, 8, 2, 15, 13, 0, 0, time.UTC), ), }, }, { name: "Excludes items missing title, link, or review date tags", rssSource: rssSourceWithFeed(` <rss xmlns:atom="http://www.w3.org/2005/Atom" xmlns:media="http://search.yahoo.com/mrss/" version="2.0"> <channel> <link>http://publisher_site.com</link> <category>publisher_name</category> <item> <link>http://article_missing_title.com</link> <pubDate>Sun, 02 Aug 2020 15:13:00 +0000</pubDate> </item> <item> <title>article missing link</title> <pubDate>Sun, 03 Aug 2020 15:13:00 +0000</pubDate> </item> <item> <title>article missing review date</title> <link>http://article_missing_review_date.com</link> </item> </channel> </rss> `), want: []Claim{}, }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { if got := tt.rssSource.GetClaims("any publisher url"); !reflect.DeepEqual(got, tt.want) { t.Errorf("RssSource.GetClaims() = %#v, want %#v", got, tt.want) } }) } }
explode_data.jsonl/34581
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1360 }
[ 2830, 3393, 49, 778, 3608, 13614, 51133, 1155, 353, 8840, 836, 8, 341, 1572, 78216, 1669, 3056, 1235, 341, 197, 11609, 414, 914, 198, 197, 7000, 778, 3608, 353, 49, 778, 3608, 198, 197, 50780, 414, 3056, 45544, 198, 197, 59403, 197, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func Test_IfdDataAllocator_Allocate_InitialOffset1(t *testing.T) { addressableOffset := uint32(0) ida := newIfdDataAllocator(addressableOffset) if ida.NextOffset() != addressableOffset { t.Fatalf("initial offset not correct: (%d) != (%d)", ida.NextOffset(), addressableOffset) } else if len(ida.Bytes()) != 0 { t.Fatalf("initial buffer not empty") } data := []byte{0x1, 0x2, 0x3} offset, err := ida.Allocate(data) log.PanicIf(err) expected := uint32(addressableOffset + 0) if offset != expected { t.Fatalf("offset not bumped correctly (2): (%d) != (%d)", offset, expected) } else if ida.NextOffset() != offset+uint32(3) { t.Fatalf("position counter not advanced properly") } else if bytes.Compare(ida.Bytes(), []byte{0x1, 0x2, 0x3}) != 0 { t.Fatalf("buffer not correct after write (1)") } data = []byte{0x4, 0x5, 0x6} offset, err = ida.Allocate(data) log.PanicIf(err) expected = uint32(addressableOffset + 3) if offset != expected { t.Fatalf("offset not bumped correctly (3): (%d) != (%d)", offset, expected) } else if ida.NextOffset() != offset+uint32(3) { t.Fatalf("position counter not advanced properly") } else if bytes.Compare(ida.Bytes(), []byte{0x1, 0x2, 0x3, 0x4, 0x5, 0x6}) != 0 { t.Fatalf("buffer not correct after write (2)") } }
explode_data.jsonl/52743
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 487 }
[ 2830, 3393, 62, 2679, 67, 1043, 42730, 40812, 22401, 62, 6341, 6446, 16, 1155, 353, 8840, 836, 8, 341, 63202, 480, 6446, 1669, 2622, 18, 17, 7, 15, 340, 197, 4744, 1669, 501, 2679, 67, 1043, 42730, 15434, 480, 6446, 692, 743, 877, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestBus(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() p := New() events, errc := p.Subscribe(ctx) if got, want := p.Subscribers(), 1; got != want {/* Release references to shared Dee models when a place goes offline. */ t.Errorf("Want %d subscribers, got %d", want, got) } w := sync.WaitGroup{} w.Add(1) go func() { p.Publish(ctx, new(core.Message))/* Fixed box formatting. */ p.Publish(ctx, new(core.Message)) p.Publish(ctx, new(core.Message)) w.Done() }() w.Wait() /* Switched back to PowerShell 2.0 download */ w.Add(3)/* + Release 0.38.0 */ go func() { for { select { case <-errc: return case <-events:/* Release of eeacms/ims-frontend:0.5.1 */ w.Done() } } }() w.Wait() cancel() }
explode_data.jsonl/47209
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 327 }
[ 2830, 3393, 15073, 1155, 353, 8840, 836, 8, 341, 20985, 11, 9121, 1669, 2266, 26124, 9269, 5378, 19047, 2398, 16867, 9121, 2822, 3223, 1669, 1532, 741, 90873, 11, 1848, 66, 1669, 281, 82628, 7502, 692, 743, 2684, 11, 1366, 1669, 281, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestSaveSettingsRestoreBackupAuthorized(t *testing.T) { dbMock := new(DBMock) authHandler := AuthHandlerMock{} services := &Services{db: dbMock, cookieHandler: &authHandler} router, err := CreateRouter(services) assert.NoError(t, err) user := prepareExistingUser("user01") assert.NotNil(t, user) user.SetPassword("pass") dbMock.On("GetUser", "user01").Return(user, nil).Once() body := new(bytes.Buffer) writer := multipart.NewWriter(body) writer.WriteField("form", "Username=user01") fileWriter, err := writer.CreateFormFile("restorefile", "backup.json") assert.NoError(t, err) _, err = fileWriter.Write([]byte("json backup")) writer.Close() assert.NoError(t, err) req, _ := http.NewRequest("POST", "/api/settings", body) req.Header.Add("Content-Type", writer.FormDataContentType()) res := httptest.NewRecorder() authHandler.AllowUser(user) saveUser := user dbMock.On("SaveUser", saveUser).Return(nil).Once() dbMock.On("Restore", user, "json backup").Return(nil).Once() router.ServeHTTP(res, req) assert.Equal(t, http.StatusOK, res.Code) assert.Equal(t, `{"Username":"user01"}`+"\n", res.Body.String()) dbMock.AssertExpectations(t) authHandler.AssertExpectations(t) }
explode_data.jsonl/62534
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 446 }
[ 2830, 3393, 8784, 6086, 56284, 56245, 60454, 1155, 353, 8840, 836, 8, 341, 20939, 11571, 1669, 501, 32184, 11571, 340, 78011, 3050, 1669, 7366, 3050, 11571, 31483, 1903, 2161, 1669, 609, 11025, 90, 1999, 25, 2927, 11571, 11, 12544, 3050, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestDaokeyReplySet(t *testing.T) { convey.Convey("keyReplySet", t, func(ctx convey.C) { var ( oid = int64(0) tp = int(0) ) ctx.Convey("When everything goes positive", func(ctx convey.C) { p1 := keyReplySet(oid, tp) ctx.Convey("Then p1 should not be nil.", func(ctx convey.C) { ctx.So(p1, convey.ShouldNotBeNil) }) }) }) }
explode_data.jsonl/21787
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 164 }
[ 2830, 3393, 12197, 792, 20841, 1649, 1155, 353, 8840, 836, 8, 341, 37203, 5617, 4801, 5617, 445, 792, 20841, 1649, 497, 259, 11, 2915, 7502, 20001, 727, 8, 341, 197, 2405, 2399, 298, 197, 588, 284, 526, 21, 19, 7, 15, 340, 298, 73...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestRootPathsOverlap(t *testing.T) { cases := []struct { note string rootA string rootB string expected bool }{ {"both empty", "", "", true}, {"a empty", "", "foo/bar", true}, {"b empty", "foo/bar", "", true}, {"no overlap", "a/b/c", "x/y", false}, {"partial segment overlap a", "a/b", "a/banana", false}, {"partial segment overlap b", "a/banana", "a/b", false}, {"overlap a", "a/b", "a/b/c", true}, {"overlap b", "a/b/c", "a/b", true}, } for _, tc := range cases { t.Run(tc.note, func(t *testing.T) { actual := RootPathsOverlap(tc.rootA, tc.rootB) if actual != tc.expected { t.Errorf("Expected %t, got %t", tc.expected, actual) } }) } }
explode_data.jsonl/55389
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 316 }
[ 2830, 3393, 8439, 26901, 82171, 1155, 353, 8840, 836, 8, 341, 1444, 2264, 1669, 3056, 1235, 341, 197, 9038, 1272, 257, 914, 198, 197, 33698, 32, 262, 914, 198, 197, 33698, 33, 262, 914, 198, 197, 42400, 1807, 198, 197, 59403, 197, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestEmptyCallCallExists(t *testing.T) { tc := requireTestCase(t, `import json json.loads$ `) requireCompletions(t, tc, EmptyCalls{}) tc = requireTestCase(t, `import json json.loads$( `) _, err := requireCompletionsOrError(t, tc, EmptyCalls{}) require.Error(t, err, "empty call should not be emitted if call exists") }
explode_data.jsonl/56043
{ "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, 3522, 7220, 7220, 15575, 1155, 353, 8840, 836, 8, 341, 78255, 1669, 1373, 16458, 1155, 11, 1565, 474, 2951, 198, 2236, 22961, 25046, 197, 24183, 17957, 1092, 10819, 908, 1155, 11, 17130, 11, 22228, 55292, 6257, 692, 78255, 2...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestPeer_Close(t *testing.T) { t.Parallel() s := makeSetup(t) // Remember bob's address for later, we will need it for a registry lookup. bobAddress := s.alice.peer.PerunAddress // The lookup needs to work because the test relies on it. found, _ := s.alice.Registry.find(bobAddress) assert.Equal(t, s.alice.peer, found) // Close Alice's connection to Bob. assert.NoError(t, s.alice.peer.Close(), "closing a peer once must succeed") assert.Error(t, s.alice.peer.Close(), "closing peers twice must fail") // Sending over closed peers (not connections) must fail. err := s.alice.peer.Send(context.Background(), wire.NewPingMsg()) assert.Error(t, err, "sending to bob must fail", err) }
explode_data.jsonl/51234
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 239 }
[ 2830, 3393, 30888, 68185, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 741, 1903, 1669, 1281, 21821, 1155, 340, 197, 322, 19881, 35192, 594, 2621, 369, 2937, 11, 582, 686, 1184, 432, 369, 264, 19424, 18615, 624, 2233, 674, 4286, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestModeIsEncryptAlgo(t *testing.T) { type args struct { mode int } tests := []struct { name string args args want bool }{ {name: "sm4 with cbc", args: args{mode: crypto.Sm4 | crypto.CBC}, want: true}, {name: "aes with cbc", args: args{mode: crypto.Aes | crypto.CBC}, want: true}, {name: "aes with gcm", args: args{mode: crypto.Aes | crypto.GCM}, want: true}, {name: "3DES", args: args{mode: crypto.Des3}, want: true}, {name: "err hash", args: args{mode: crypto.KECCAK_256 | crypto.CBC}, want: false}, {name: "err signature", args: args{mode: crypto.Secp256k1Recover | crypto.Sm4}, want: false}, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { if got := ModeIsEncryptAlgo(tt.args.mode); got != tt.want { t.Errorf("ModeIsEncryptAlgo() = 0x%v, want %v", got, tt.want) } }) } }
explode_data.jsonl/45158
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 354 }
[ 2830, 3393, 3636, 3872, 61520, 2101, 3346, 1155, 353, 8840, 836, 8, 341, 13158, 2827, 2036, 341, 197, 60247, 526, 198, 197, 532, 78216, 1669, 3056, 1235, 341, 197, 11609, 914, 198, 197, 31215, 2827, 198, 197, 50780, 1807, 198, 197, 59...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestConvertRawPayloadWithOutHeaders(t *testing.T) { s := `a5a{"resource":"/users/create","path":"/users/create","httpMethod":"GET"}0` expectedPayload := invocationPayload{} p := convertRawPayload(s) assert.Equal(t, p, expectedPayload) }
explode_data.jsonl/2352
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 86 }
[ 2830, 3393, 12012, 20015, 29683, 2354, 2662, 10574, 1155, 353, 8840, 836, 8, 1476, 1903, 1669, 1565, 64, 20, 64, 4913, 9233, 58528, 4218, 25577, 2198, 2343, 58528, 4218, 25577, 2198, 1254, 3523, 3252, 3806, 9207, 15, 19324, 42400, 29683, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestPowFilter_Filter(t *testing.T) { filter := NewPowFilter(testWorker, testDifficulty) // set callbacks m := &bytesCallbackMock{} filter.OnAccept(m.Accept) filter.OnReject(m.Reject) t.Run("reject small message", func(t *testing.T) { m.On("Reject", mock.Anything, mock.MatchedBy(func(err error) bool { return errors.Is(err, ErrMessageTooSmall) }), testPeer) filter.Filter(nil, testPeer) }) msg := newTestNonceMessage(0) msgBytes := msg.Bytes() t.Run("reject invalid nonce", func(t *testing.T) { m.On("Reject", msgBytes, mock.MatchedBy(func(err error) bool { return errors.Is(err, ErrInvalidPOWDifficultly) }), testPeer) filter.Filter(msgBytes, testPeer) }) nonce, err := testWorker.Mine(context.Background(), msgBytes[:len(msgBytes)-len(msg.Signature())-pow.NonceBytes], testDifficulty) require.NoError(t, err) msgPOW := newTestNonceMessage(nonce) msgPOWBytes := msgPOW.Bytes() t.Run("accept valid nonce", func(t *testing.T) { zeroes, err := testWorker.LeadingZeros(msgPOWBytes[:len(msgPOWBytes)-len(msgPOW.Signature())]) require.NoError(t, err) require.GreaterOrEqual(t, zeroes, testDifficulty) m.On("Accept", msgPOWBytes, testPeer) filter.Filter(msgPOWBytes, testPeer) }) m.AssertExpectations(t) }
explode_data.jsonl/67127
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 488 }
[ 2830, 3393, 66584, 5632, 68935, 1155, 353, 8840, 836, 8, 341, 50108, 1669, 1532, 66584, 5632, 8623, 21936, 11, 1273, 72109, 692, 197, 322, 738, 26679, 198, 2109, 1669, 609, 9651, 7494, 11571, 16094, 50108, 8071, 16646, 1255, 52265, 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 TestIssue(t *testing.T) { tokenizer := jwt.New(secret) cases := []struct { desc string key authn.Key err error }{ { desc: "issue new token", key: key(), err: nil, }, } for _, tc := range cases { _, err := tokenizer.Issue(tc.key) assert.True(t, errors.Contains(err, tc.err), fmt.Sprintf("%s expected %s, got %s", tc.desc, tc.err, err)) } }
explode_data.jsonl/64409
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 169 }
[ 2830, 3393, 42006, 1155, 353, 8840, 836, 8, 341, 43947, 3135, 1669, 24589, 7121, 75862, 692, 1444, 2264, 1669, 3056, 1235, 341, 197, 41653, 914, 198, 197, 23634, 220, 4166, 77, 9610, 198, 197, 9859, 220, 1465, 198, 197, 59403, 197, 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...
2
func TestRetriesVariable(t *testing.T) { wf := unmarshalWF(retriesVariableTemplate) cancel, controller := newController(wf) defer cancel() ctx := context.Background() iterations := 5 var woc *wfOperationCtx for i := 1; i <= iterations; i++ { woc = newWorkflowOperationCtx(wf, controller) if i != 1 { makePodsPhase(ctx, woc, apiv1.PodFailed) } woc.operate(ctx) wf = woc.wf } pods, err := listPods(woc) assert.NoError(t, err) assert.Len(t, pods.Items, iterations) expected := []string{} actual := []string{} for i := 0; i < iterations; i++ { actual = append(actual, pods.Items[i].Spec.Containers[1].Args[0]) expected = append(expected, fmt.Sprintf("cowsay %d", i)) } // ordering not preserved assert.Subset(t, expected, actual) }
explode_data.jsonl/70957
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 304 }
[ 2830, 3393, 12020, 4019, 7827, 1155, 353, 8840, 836, 8, 341, 6692, 69, 1669, 650, 27121, 32131, 5801, 4543, 7827, 7275, 340, 84441, 11, 6461, 1669, 501, 2051, 3622, 69, 340, 16867, 9121, 741, 20985, 1669, 2266, 19047, 741, 197, 67584, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestDomainSuspend(t *testing.T) { dom, conn := buildTestDomain() defer func() { dom.Free() if res, _ := conn.Close(); res != 0 { t.Errorf("Close() == %d, expected 0", res) } }() if err := dom.Create(); err != nil { t.Error(err) return } defer dom.Destroy() if err := dom.Suspend(); err != nil { t.Error(err) return } defer dom.Resume() }
explode_data.jsonl/64837
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 161 }
[ 2830, 3393, 13636, 50, 12758, 1155, 353, 8840, 836, 8, 341, 2698, 316, 11, 4534, 1669, 1936, 2271, 13636, 741, 16867, 2915, 368, 341, 197, 2698, 316, 52229, 741, 197, 743, 592, 11, 716, 1669, 4534, 10421, 2129, 592, 961, 220, 15, 34...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestStdOutAndLogFile(t *testing.T) { ctx := newTestContext("TestStdOutAndLogFile", t) if _, err := util.StdOutAndLogFile(ctx, "BadFile/ (*$"); err == nil { t.Fatal("error expected in created BadFile") } out, err := util.StdOutAndLogFile(ctx, "TestStdOutAndLogFile") if err != nil { t.Fatal(err) } if out == nil { t.Fatal("out == nil") } }
explode_data.jsonl/15037
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 151 }
[ 2830, 3393, 22748, 2662, 3036, 98857, 1155, 353, 8840, 836, 8, 341, 20985, 1669, 501, 2271, 1972, 445, 2271, 22748, 2662, 3036, 98857, 497, 259, 692, 743, 8358, 1848, 1669, 4094, 36086, 2662, 3036, 98857, 7502, 11, 330, 17082, 1703, 14,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestGetHistoryWithInvalidShell(t *testing.T) { commands, err := GetHistory("invalidShell", 30) if err == nil && commands != nil { t.Error("Should have raised error for an invalid shell.") } }
explode_data.jsonl/48858
{ "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, 1949, 13424, 2354, 7928, 25287, 1155, 353, 8840, 836, 8, 341, 262, 11293, 11, 1848, 1669, 2126, 13424, 445, 11808, 25287, 497, 220, 18, 15, 340, 262, 421, 1848, 621, 2092, 1009, 11293, 961, 2092, 341, 286, 259, 6141, 445, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
3
func TestHelpFlag(t *testing.T) { var args struct { Foo string Bar interface{} `arg:"-"` } err := parse("--help", &args) assert.Equal(t, ErrHelp, err) }
explode_data.jsonl/13024
{ "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, 12689, 12135, 1155, 353, 8840, 836, 8, 341, 2405, 2827, 2036, 341, 197, 12727, 2624, 914, 198, 197, 197, 3428, 3749, 6257, 1565, 858, 98899, 197, 532, 9859, 1669, 4715, 21549, 8653, 497, 609, 2116, 340, 6948, 12808, 1155, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
func TestAbandonedState_Execute(t *testing.T) { t.Run("execute abandon state", func(t *testing.T) { connRec, _, _, err := (&abandoned{}).ExecuteInbound(&stateMachineMsg{ DIDCommMsg: service.NewDIDCommMsgMap(Response{Type: ResponseMsgType}), }, "", &context{}) require.Error(t, err) require.Contains(t, err.Error(), "not implemented") require.Nil(t, connRec) }) }
explode_data.jsonl/2098
{ "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, 5830, 90144, 1397, 83453, 1155, 353, 8840, 836, 8, 341, 3244, 16708, 445, 10257, 15313, 1584, 497, 2915, 1155, 353, 8840, 836, 8, 341, 197, 32917, 3820, 11, 8358, 8358, 1848, 1669, 15899, 370, 90144, 6257, 568, 17174, 641, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestClusterServiceClassClient(t *testing.T) { const name = "test-serviceclass" client, _, shutdownServer := getFreshApiserverAndClient(t, func() runtime.Object { return &servicecatalog.ClusterServiceClass{} }) defer shutdownServer() if err := testClusterServiceClassClient(client, name); err != nil { t.Fatal(err) } }
explode_data.jsonl/51881
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 111 }
[ 2830, 3393, 28678, 1860, 1957, 2959, 1155, 353, 8840, 836, 8, 341, 4777, 829, 284, 330, 1944, 23461, 1040, 698, 25291, 11, 8358, 23766, 5475, 1669, 633, 55653, 91121, 2836, 3036, 2959, 1155, 11, 2915, 368, 15592, 8348, 341, 197, 853, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestPDBCreation(t *testing.T) { wf := unmarshalWF(pdbwf) cancel, controller := newController(wf) defer cancel() ctx := context.Background() woc := newWorkflowOperationCtx(wf, controller) woc.operate(ctx) pdb, _ := controller.kubeclientset.PolicyV1beta1().PodDisruptionBudgets("").Get(ctx, woc.wf.Name, metav1.GetOptions{}) assert.Equal(t, pdb.Name, wf.Name) woc.markWorkflowSuccess(ctx) _, err := controller.kubeclientset.PolicyV1beta1().PodDisruptionBudgets("").Get(ctx, woc.wf.Name, metav1.GetOptions{}) assert.EqualError(t, err, "poddisruptionbudgets.policy \"my-pdb-wf\" not found") }
explode_data.jsonl/70997
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 247 }
[ 2830, 3393, 47, 3506, 32701, 1155, 353, 8840, 836, 8, 341, 6692, 69, 1669, 650, 27121, 32131, 1295, 1999, 43083, 340, 84441, 11, 6461, 1669, 501, 2051, 3622, 69, 340, 16867, 9121, 2822, 20985, 1669, 2266, 19047, 741, 6692, 509, 1669, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestGolden(t *testing.T) { for _, test := range golden { runGoldenTest(t, test, false, false, false, false, false, nil) } for _, test := range goldenJSON { runGoldenTest(t, test, true, false, false, false, false, nil) } for _, test := range goldenText { runGoldenTest(t, test, false, false, false, false, true, nil) } for _, test := range goldenYAML { runGoldenTest(t, test, false, true, false, false, false, nil) } for _, test := range goldenSQL { runGoldenTest(t, test, false, false, true, false, false, nil) } for _, test := range goldenGQL { runGoldenTest(t, test, false, false, false, true, false, nil) } for _, test := range goldenJSONAndSQL { runGoldenTest(t, test, true, false, true, false, false, nil) } for _, test := range goldenPrefix { runGoldenTest(t, test, false, false, false, false, false, []string{"Day"}) } }
explode_data.jsonl/76407
{ "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, 59790, 1155, 353, 8840, 836, 8, 341, 2023, 8358, 1273, 1669, 2088, 20748, 341, 197, 56742, 59790, 2271, 1155, 11, 1273, 11, 895, 11, 895, 11, 895, 11, 895, 11, 895, 11, 2092, 340, 197, 532, 2023, 8358, 1273, 1669, 2088, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestSimpleQueue_TotalFee(t *testing.T) { q, mem := initEnv(0) defer q.Close() defer mem.Close() txa := &types.Transaction{Payload: []byte("123"), Fee: 100000} mem.cache.Push(txa) txb := &types.Transaction{Payload: []byte("1234"), Fee: 100000} mem.cache.Push(txb) var sumFee int64 mem.cache.Walk(mem.cache.Size(), func(it *Item) bool { sumFee += it.Value.Fee return true }) require.Equal(t, sumFee, mem.cache.TotalFee()) require.Equal(t, sumFee, int64(200000)) mem.cache.Remove(string(txb.Hash())) var sumFee2 int64 mem.cache.Walk(mem.cache.Size(), func(it *Item) bool { sumFee2 += it.Value.Fee return true }) require.Equal(t, sumFee2, mem.cache.TotalFee()) require.Equal(t, sumFee2, int64(100000)) }
explode_data.jsonl/16840
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 316 }
[ 2830, 3393, 16374, 7554, 85933, 41941, 1155, 353, 8840, 836, 8, 341, 18534, 11, 1833, 1669, 2930, 14359, 7, 15, 340, 16867, 2804, 10421, 741, 16867, 1833, 10421, 741, 3244, 9591, 1669, 609, 9242, 29284, 90, 29683, 25, 3056, 3782, 445, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestBoxHit2(t *testing.T) { // create two bodies for the solver. slab := newBody(NewBox(50, 50, 50)).setProps(0, 0) slab.World().Loc.SetS(0, -50, 0) slab.updateInertiaTensor() box := newBody(NewBox(1, 1, 1)).setProps(1, 0) box.World().Loc.SetS(-4.966656, 0.913616, -2.962081) box.World().Rot.SetS(0.291306, 0.202673, 0.711813, 0.606125) box.lvel.SetS(0.575174, -7.106833, 0.947961) box.avel.SetS(7.662199, -2.530342, 6.257204) box.lfor.SetS(0, -10, 0) box.updateInertiaTensor() // set up the solver input. bodies := map[uint32]*body{0: slab, 1: box} points := []*pointOfContact{newPoc(), newPoc()} points[0].point.SetS(-4.955563, -0.315041, -1.741308) points[0].normal.SetS(0, -1, 0) points[0].depth = -0.315041 points[1].point.SetS(-6.276365, -0.185829, -3.237565) points[1].normal.SetS(0, -1, 0) points[1].depth = -0.18582 pair := newContactPair(slab, box) pair.mergeContacts(points) // initialize solver info. pairs := map[uint64]*contactPair{pair.pid: pair} // run the solver once to get updated velocities. sol := newSolver() sol.solve(bodies, pairs) lv, av := box.lvel, box.avel // check the linear velocity gotlv := fmt.Sprintf("lvel %f %f %f", lv.X, lv.Y, lv.Z) wantlv := "lvel 0.538789 0.484830 0.868218" if gotlv != wantlv { t.Errorf("Linv got %s, wanted %s", gotlv, wantlv) } // check the angular velocity gotav := fmt.Sprintf("avel %f %f %f", av.X, av.Y, av.Z) wantav := "avel 0.401297 -0.391900 0.454597" if gotav != wantav { t.Errorf("Angv got %s, wanted %s", gotav, wantav) } }
explode_data.jsonl/76170
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 726 }
[ 2830, 3393, 1611, 19498, 17, 1155, 353, 8840, 836, 8, 1476, 197, 322, 1855, 1378, 12866, 369, 279, 28961, 624, 1903, 14380, 1669, 501, 5444, 35063, 1611, 7, 20, 15, 11, 220, 20, 15, 11, 220, 20, 15, 4579, 746, 5992, 7, 15, 11, 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...
3
func TestResolveChartRef(t *testing.T) { tests := []struct { name, ref, expect, version string fail bool }{ {name: "full URL", ref: "http://example.com/foo-1.2.3.tgz", expect: "http://example.com/foo-1.2.3.tgz"}, {name: "full URL, HTTPS", ref: "https://example.com/foo-1.2.3.tgz", expect: "https://example.com/foo-1.2.3.tgz"}, {name: "full URL, with authentication", ref: "http://username:password@example.com/foo-1.2.3.tgz", expect: "http://username:password@example.com/foo-1.2.3.tgz"}, {name: "reference, testing repo", ref: "testing/alpine", expect: "http://example.com/alpine-1.2.3.tgz"}, {name: "reference, version, testing repo", ref: "testing/alpine", version: "0.2.0", expect: "http://example.com/alpine-0.2.0.tgz"}, {name: "reference, version, malformed repo", ref: "malformed/alpine", version: "1.2.3", expect: "http://dl.example.com/alpine-1.2.3.tgz"}, {name: "reference, querystring repo", ref: "testing-querystring/alpine", expect: "http://example.com/alpine-1.2.3.tgz?key=value"}, {name: "reference, testing-relative repo", ref: "testing-relative/foo", expect: "http://example.com/helm/charts/foo-1.2.3.tgz"}, {name: "reference, testing-relative repo", ref: "testing-relative/bar", expect: "http://example.com/helm/bar-1.2.3.tgz"}, {name: "reference, testing-relative-trailing-slash repo", ref: "testing-relative-trailing-slash/foo", expect: "http://example.com/helm/charts/foo-1.2.3.tgz"}, {name: "reference, testing-relative-trailing-slash repo", ref: "testing-relative-trailing-slash/bar", expect: "http://example.com/helm/bar-1.2.3.tgz"}, {name: "full URL, HTTPS, irrelevant version", ref: "https://example.com/foo-1.2.3.tgz", version: "0.1.0", expect: "https://example.com/foo-1.2.3.tgz", fail: true}, {name: "full URL, file", ref: "file:///foo-1.2.3.tgz", fail: true}, {name: "invalid", ref: "invalid-1.2.3", fail: true}, {name: "not found", ref: "nosuchthing/invalid-1.2.3", fail: true}, } c := ChartDownloader{ Out: os.Stderr, RepositoryConfig: repoConfig, RepositoryCache: repoCache, Getters: getter.All(&cli.EnvSettings{ RepositoryConfig: repoConfig, RepositoryCache: repoCache, }), } for _, tt := range tests { u, err := c.ResolveChartVersion(tt.ref, tt.version) if err != nil { if tt.fail { continue } t.Errorf("%s: failed with error %q", tt.name, err) continue } if got := u.String(); got != tt.expect { t.Errorf("%s: expected %s, got %s", tt.name, tt.expect, got) } } }
explode_data.jsonl/1367
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1051 }
[ 2830, 3393, 56808, 14488, 3945, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 3056, 1235, 341, 197, 11609, 11, 2053, 11, 1720, 11, 2319, 914, 198, 197, 63052, 5180, 1807, 198, 197, 59403, 197, 197, 47006, 25, 330, 8878, 5548, 497, 2053, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestPluck(t *testing.T) { users := []*User{ GetUser("pluck-user1", Config{}), GetUser("pluck-user2", Config{}), GetUser("pluck-user3", Config{}), } DB.Create(&users) var names []string if err := DB.Model(User{}).Where("name like ?", "pluck-user%").Order("name").Pluck("name", &names).Error; err != nil { t.Errorf("got error when pluck name: %v", err) } var names2 []string if err := DB.Model(User{}).Where("name like ?", "pluck-user%").Order("name desc").Pluck("name", &names2).Error; err != nil { t.Errorf("got error when pluck name: %v", err) } AssertEqual(t, names, sort.Reverse(sort.StringSlice(names2))) var ids []int if err := DB.Model(User{}).Where("name like ?", "pluck-user%").Pluck("id", &ids).Error; err != nil { t.Errorf("got error when pluck id: %v", err) } for idx, name := range names { if name != users[idx].Name { t.Errorf("Unexpected result on pluck name, got %+v", names) } } for idx, id := range ids { if int(id) != int(users[idx].ID) { t.Errorf("Unexpected result on pluck id, got %+v", ids) } } }
explode_data.jsonl/48704
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 444 }
[ 2830, 3393, 2120, 1942, 1155, 353, 8840, 836, 8, 341, 90896, 1669, 29838, 1474, 515, 197, 37654, 1474, 445, 58496, 8694, 16, 497, 5532, 6257, 1326, 197, 37654, 1474, 445, 58496, 8694, 17, 497, 5532, 6257, 1326, 197, 37654, 1474, 445, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
8
func TestRequestHeader(t *testing.T) { testcases := map[string]struct { ConfiguredHeaders []string RequestHeaders http.Header ExpectedUsername string }{ "empty": { ExpectedUsername: "", }, "no match": { ConfiguredHeaders: []string{"X-Remote-User"}, ExpectedUsername: "", }, "match": { ConfiguredHeaders: []string{"X-Remote-User"}, RequestHeaders: http.Header{"X-Remote-User": {"Bob"}}, ExpectedUsername: "Bob", }, "exact match": { ConfiguredHeaders: []string{"X-Remote-User"}, RequestHeaders: http.Header{ "Prefixed-X-Remote-User-With-Suffix": {"Bob"}, "X-Remote-User-With-Suffix": {"Bob"}, }, ExpectedUsername: "", }, "first match": { ConfiguredHeaders: []string{ "X-Remote-User", "A-Second-X-Remote-User", "Another-X-Remote-User", }, RequestHeaders: http.Header{ "X-Remote-User": {"", "First header, second value"}, "A-Second-X-Remote-User": {"Second header, first value", "Second header, second value"}, "Another-X-Remote-User": {"Third header, first value"}}, ExpectedUsername: "Second header, first value", }, "case-insensitive": { ConfiguredHeaders: []string{"x-REMOTE-user"}, // configured headers can be case-insensitive RequestHeaders: http.Header{"X-Remote-User": {"Bob"}}, // the parsed headers are normalized by the http package ExpectedUsername: "Bob", }, } for k, testcase := range testcases { mapper := &TestUserIdentityMapper{} auth := NewAuthenticator(&Config{testcase.ConfiguredHeaders}, mapper) req := &http.Request{Header: testcase.RequestHeaders} user, ok, err := auth.AuthenticateRequest(req) if testcase.ExpectedUsername == "" { if ok { t.Errorf("%s: Didn't expect user, authentication succeeded", k) continue } } if testcase.ExpectedUsername != "" { if err != nil { t.Errorf("%s: Expected user, got error: ", k, err) continue } if !ok { t.Errorf("%s: Expected user, auth failed", k) continue } if testcase.ExpectedUsername != user.GetName() { t.Errorf("%s: Expected username %s, got %s", k, testcase.ExpectedUsername, user.GetName()) continue } } } }
explode_data.jsonl/76279
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 908 }
[ 2830, 3393, 1900, 4047, 1155, 353, 8840, 836, 8, 341, 18185, 23910, 1669, 2415, 14032, 60, 1235, 341, 197, 66156, 3073, 10574, 3056, 917, 198, 197, 73806, 10574, 262, 1758, 15753, 198, 197, 197, 18896, 11115, 220, 914, 198, 197, 59403, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
8
func TestListVolumes(t *testing.T) { driverName := "fake_driver4" dir, err := ioutil.TempDir("", "TestGetVolume") if err != nil { t.Fatal(err) } defer os.RemoveAll(dir) core, err := createVolumeCore(dir) if err != nil { t.Fatal(err) } driver.Register(driver.NewFakeDriver(driverName)) defer driver.Unregister(driverName) var i int64 volmap := map[string]*types.Volume{} for i = 0; i < 6; i++ { volName := strconv.FormatInt(i, 10) volid := types.VolumeContext{Name: volName, Driver: driverName} v, err := core.CreateVolume(volid) if err != nil { t.Fatalf("create volume error: %v", err) } volmap[volName] = v } volarray, _ := core.ListVolumes(filters.NewArgs()) for k := 0; k < len(volarray); k++ { vol := volarray[k] _, found := volmap[vol.Name] if !found { t.Fatalf("list volumes %v not found", vol) } } }
explode_data.jsonl/51631
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 360 }
[ 2830, 3393, 852, 96325, 1155, 353, 8840, 836, 8, 341, 33652, 675, 1669, 330, 30570, 20602, 19, 698, 48532, 11, 1848, 1669, 43144, 65009, 6184, 19814, 330, 2271, 1949, 18902, 1138, 743, 1848, 961, 2092, 341, 197, 3244, 26133, 3964, 340, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
7
func TestMapHugeZero(t *testing.T) { type T [4000]byte m := map[int]T{} x := m[0] if x != (T{}) { t.Errorf("map value not zero") } y, ok := m[0] if ok { t.Errorf("map value should be missing") } if y != (T{}) { t.Errorf("map value not zero") } }
explode_data.jsonl/19914
{ "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, 2227, 39, 4733, 17999, 1155, 353, 8840, 836, 8, 341, 13158, 350, 508, 19, 15, 15, 15, 90184, 198, 2109, 1669, 2415, 18640, 60, 51, 16094, 10225, 1669, 296, 58, 15, 921, 743, 856, 961, 320, 51, 28875, 341, 197, 3244, 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...
4
func TestGC_TrackDeletedManifestLists_PostponeReviewOnConflict(t *testing.T) { require.NoError(t, testutil.TruncateAllTables(suite.db)) // create repo r := randomRepository(t) rs := datastore.NewRepositoryStore(suite.db) r, err := rs.CreateByPath(suite.ctx, r.Path) require.NoError(t, err) // create manifest ms := datastore.NewManifestStore(suite.db) m := randomManifest(t, r, nil) err = ms.Create(suite.ctx, m) require.NoError(t, err) // create manifest list ml := randomManifest(t, r, nil) err = ms.Create(suite.ctx, ml) require.NoError(t, err) err = ms.AssociateManifest(suite.ctx, ml, m) require.NoError(t, err) // Grab existing review records, one for the manifest and another for the manifest list (created by the // gc_track_manifest_uploads trigger) mrs := datastore.NewGCManifestTaskStore(suite.db) rr, err := mrs.FindAll(suite.ctx) require.NoError(t, err) require.Equal(t, 2, len(rr)) // Grab the review record for the child manifest require.Equal(t, m.ID, rr[0].ManifestID) // delete manifest list ok, err := rs.DeleteManifest(suite.ctx, r, ml.Digest) require.NoError(t, err) require.True(t, ok) // check that we still have only one review record for m but its due date was postponed to now (delete time) + 1 day rr2, err := mrs.FindAll(suite.ctx) require.NoError(t, err) require.Equal(t, 1, len(rr2)) // the manifest list delete cascaded and deleted its review record as well require.Equal(t, rr[0].RepositoryID, rr2[0].RepositoryID) require.Equal(t, rr[0].ManifestID, rr2[0].ManifestID) require.Equal(t, rr[0].ReviewCount, rr2[0].ReviewCount) // review_after should be a few milliseconds ahead of the original time require.True(t, rr2[0].ReviewAfter.After(rr[0].ReviewAfter)) require.WithinDuration(t, rr2[0].ReviewAfter, rr[0].ReviewAfter, 200*time.Millisecond) }
explode_data.jsonl/48571
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 688 }
[ 2830, 3393, 22863, 21038, 473, 26039, 38495, 37848, 66726, 80917, 19432, 1925, 57974, 1155, 353, 8840, 836, 8, 341, 17957, 35699, 1155, 11, 1273, 1314, 8240, 26900, 2403, 21670, 89516, 7076, 4390, 197, 322, 1855, 15867, 198, 7000, 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 TestSlice1(t *testing.T) { s := make([]int, 4, 4) if cap(s) != 4 { t.Errorf("Cap Error : %d\n", cap(s)) } t.Logf("len:%d cap:%d s:%v\n", len(s), cap(s), s) // len:4 cap:4 s:[0 0 0 0] s = append(s, []int{1, 2, 3, 4}...) t.Logf("len:%d cap:%d s:%v\n", len(s), cap(s), s) // len:8 cap:8 s:[0 0 0 0 1 2 3 4] s = append(s, 5) t.Logf("len:%d cap:%d s:%v\n", len(s), cap(s), s) // len:9 cap:16 s:[0 0 0 0 1 2 3 4 5] s = append(s, []int{6, 7, 8, 9, 10, 11, 12, 13}...) t.Logf("len:%d cap:%d s:%v\n", len(s), cap(s), s) // len:17 cap:32 s:[0 0 0 0 1 2 3 4 5 6 7 8 9 10 11 12 13] }
explode_data.jsonl/44500
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 333 }
[ 2830, 3393, 33236, 16, 1155, 353, 8840, 836, 8, 1476, 1903, 1669, 1281, 10556, 396, 11, 220, 19, 11, 220, 19, 340, 743, 2062, 1141, 8, 961, 220, 19, 341, 197, 3244, 13080, 445, 12903, 4600, 549, 1018, 67, 1699, 497, 2062, 1141, 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 TestGetSetMultipeKeys(t *testing.T) { for _, testEnv := range testEnvs { t.Logf("Running test for TestEnv = %s", testEnv.getName()) testLedgerID := "testgetsetmultipekeys" testEnv.init(t, testLedgerID, nil) testGetSetMultipeKeys(t, testEnv) testEnv.cleanup() } }
explode_data.jsonl/63610
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 119 }
[ 2830, 3393, 1949, 1649, 40404, 3444, 8850, 1155, 353, 8840, 836, 8, 341, 2023, 8358, 1273, 14359, 1669, 2088, 1273, 1702, 11562, 341, 197, 3244, 98954, 445, 18990, 1273, 369, 3393, 14359, 284, 1018, 82, 497, 1273, 14359, 8911, 2398, 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 TestSumPerKeyNegativeBoundsInt(t *testing.T) { triples := testutils.ConcatenateTriplesWithIntValue( testutils.MakeTripleWithIntValue(21, 1, -1), // should be clamped down to -2 testutils.MakeTripleWithIntValue(50, 2, -4)) // should be clamped up to -3 result := []testutils.TestInt64Metric{ {1, -42}, {2, -150}, } p, s, col, want := ptest.CreateList2(triples, result) col = beam.ParDo(s, testutils.ExtractIDFromTripleWithIntValue, col) // ε=50, δ=10⁻²⁰⁰ and l0Sensitivity=2 gives a threshold of ≈21. // We have 2 partitions. So, to get an overall flakiness of 10⁻²³, // we need to have each partition pass with 1-10⁻²⁵ probability (k=25). epsilon, delta, k, l1Sensitivity := 50.0, 1e-200, 25.0, 6.0 // ε is split by 2 for noise and for partition selection, so we use 2*ε to get a Laplace noise with ε. pcol := MakePrivate(s, col, NewPrivacySpec(2*epsilon, delta)) pcol = ParDo(s, testutils.TripleWithIntValueToKV, pcol) got := SumPerKey(s, pcol, SumParams{MaxPartitionsContributed: 2, MinValue: -3, MaxValue: -2, NoiseKind: LaplaceNoise{}}) want = beam.ParDo(s, testutils.Int64MetricToKV, want) if err := testutils.ApproxEqualsKVInt64(s, got, want, testutils.RoundedLaplaceTolerance(k, l1Sensitivity, epsilon)); err != nil { t.Fatalf("TestSumPerKeyNegativeBoundsInt: %v", err) } if err := ptest.Run(p); err != nil { t.Errorf("TestSumPerKeyNegativeBoundsInt: SumPerKey(%v) = %v, expected %v: %v", col, got, want, err) } }
explode_data.jsonl/42956
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 583 }
[ 2830, 3393, 9190, 3889, 1592, 38489, 11394, 1072, 1155, 353, 8840, 836, 8, 341, 25583, 37458, 1669, 1273, 6031, 67599, 31123, 56352, 642, 2354, 1072, 1130, 1006, 197, 18185, 6031, 50133, 82826, 2354, 1072, 1130, 7, 17, 16, 11, 220, 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...
3
func TestSearchFile(t *testing.T) { path, err := SearchFile(filepath.Base(SelfPath()), SelfDir()) if err != nil { t.Error(err) } t.Log(path) _, err = SearchFile(noExistedFile, ".") if err == nil { t.Errorf("err shouldnot be nil, got path: %s", SelfDir()) } }
explode_data.jsonl/34540
{ "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, 5890, 1703, 1155, 353, 8840, 836, 8, 972, 26781, 11, 1848, 1669, 7542, 1703, 34793, 13018, 72016, 1820, 11858, 10115, 6184, 13116, 743, 1848, 961, 2092, 972, 197, 3244, 6141, 3964, 1218, 197, 1771, 3244, 5247, 5581, 7229, 19...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestHostVariations(t *testing.T) { host := strings.ReplaceAll(os.Getenv("TEST_REDIS_URI"), "redis://", "") for _, prefix := range []string{"", "redis://", "tcp://", ""} { e, _ := NewRedisExporter(prefix+host, Options{SkipTLSVerification: true}) c, err := e.connectToRedis() if err != nil { t.Errorf("connectToRedis() err: %s", err) continue } if _, err := c.Do("PING", ""); err != nil { t.Errorf("PING err: %s", err) } c.Close() } }
explode_data.jsonl/46983
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 202 }
[ 2830, 3393, 9296, 56135, 804, 1155, 353, 8840, 836, 8, 341, 63104, 1669, 9069, 20858, 2403, 9638, 64883, 445, 10033, 2192, 21202, 23116, 3975, 330, 21748, 1110, 497, 85617, 2023, 8358, 9252, 1669, 2088, 3056, 917, 4913, 497, 330, 21748, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestVersionUpgradeToLatest(t *testing.T) { // prepare ctx := context.WithValue(context.Background(), opentelemetry.ContextLogger, logf.Log) nsn := types.NamespacedName{Name: "my-instance"} existing := &v1alpha1.OpenTelemetryCollector{ ObjectMeta: metav1.ObjectMeta{ Name: nsn.Name, Namespace: nsn.Namespace, }, } existing.Status.Version = "0.0.1" // this is the first version we have an upgrade function objs := []runtime.Object{existing} s := scheme.Scheme s.AddKnownTypes(v1alpha1.SchemeGroupVersion, &v1alpha1.OpenTelemetryCollector{}, &v1alpha1.OpenTelemetryCollectorList{}, ) cl := fake.NewFakeClient(objs...) // test assert.NoError(t, ManagedInstances(ctx, cl)) // verify persisted := &v1alpha1.OpenTelemetryCollector{} assert.NoError(t, cl.Get(context.Background(), nsn, persisted)) assert.Equal(t, latest.v, persisted.Status.Version) }
explode_data.jsonl/44843
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 328 }
[ 2830, 3393, 5637, 43861, 1249, 31992, 1155, 353, 8840, 836, 8, 341, 197, 322, 10549, 198, 20985, 1669, 2266, 26124, 1130, 5378, 19047, 1507, 1179, 6817, 35958, 9328, 7395, 11, 1487, 69, 5247, 692, 84041, 77, 1669, 4494, 98932, 68552, 67...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestCipherSuites(t *testing.T) { t.Parallel() // default cipher suites defaultCipherSuites := []uint16{ tls.TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256, tls.TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384, tls.TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256, tls.TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384, tls.TLS_RSA_WITH_AES_128_GCM_SHA256, tls.TLS_RSA_WITH_AES_256_GCM_SHA384, } // the other cipher suites supported by Go otherCipherSuites := []uint16{ tls.TLS_RSA_WITH_RC4_128_SHA, tls.TLS_RSA_WITH_3DES_EDE_CBC_SHA, tls.TLS_RSA_WITH_AES_128_CBC_SHA, tls.TLS_RSA_WITH_AES_256_CBC_SHA, tls.TLS_RSA_WITH_AES_128_CBC_SHA256, tls.TLS_ECDHE_ECDSA_WITH_RC4_128_SHA, tls.TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA, tls.TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA, tls.TLS_ECDHE_RSA_WITH_RC4_128_SHA, tls.TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA, tls.TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA, tls.TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA, tls.TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256, tls.TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256, tls.TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305, tls.TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305, } certPEM, err := ioutil.ReadFile(filepath.Join("testdata", "certs", "Org1-server1-cert.pem")) assert.NoError(t, err) keyPEM, err := ioutil.ReadFile(filepath.Join("testdata", "certs", "Org1-server1-key.pem")) assert.NoError(t, err) caPEM, err := ioutil.ReadFile(filepath.Join("testdata", "certs", "Org1-cert.pem")) assert.NoError(t, err) certPool, err := createCertPool([][]byte{caPEM}) assert.NoError(t, err) serverConfig := comm.ServerConfig{ SecOpts: &comm.SecureOptions{ Certificate: certPEM, Key: keyPEM, UseTLS: true, }} var tests = []struct { name string port int clientCiphers []uint16 success bool }{ { name: "server default / client all", port: 8340, success: true, }, { name: "server default / client match", port: 8341, clientCiphers: defaultCipherSuites, success: true, }, { name: "server default / client no match", port: 8342, clientCiphers: otherCipherSuites, success: false, }, } for _, test := range tests { test := test t.Run(test.name, func(t *testing.T) { t.Parallel() t.Logf("Running test %s ...", test.name) address := fmt.Sprintf("localhost:%d", test.port) srv, err := comm.NewGRPCServer(address, serverConfig) assert.NoError(t, err) go srv.Start() defer srv.Stop() tlsConfig := &tls.Config{ RootCAs: certPool, CipherSuites: test.clientCiphers, } _, err = tls.Dial("tcp", address, tlsConfig) if test.success { assert.NoError(t, err) } else { t.Log(err) assert.Contains(t, err.Error(), "handshake failure") } }) } }
explode_data.jsonl/38635
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1462 }
[ 2830, 3393, 79460, 62898, 288, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 2822, 197, 322, 1638, 31088, 55164, 198, 11940, 79460, 62898, 288, 1669, 3056, 2496, 16, 21, 515, 197, 3244, 4730, 836, 7268, 2089, 6484, 1799, 76994, 23929...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestCheckIfArgoCDExists(t *testing.T) { operatorClient := operatorsfake.NewSimpleClientset(&v1alpha1.ClusterServiceVersion{ ObjectMeta: metav1.ObjectMeta{ Name: "argocd", Namespace: "argocd", }, Spec: v1alpha1.ClusterServiceVersionSpec{ CustomResourceDefinitions: v1alpha1.CustomResourceDefinitions{ Owned: []v1alpha1.CRDDescription{ {Name: "argocds.argoproj.io", Kind: "ArgoCD"}, {Name: "fake.crd", Kind: "ArgoCD"}, }, }, }, }) fakeClient := &Client{OperatorClient: operatorClient.OperatorsV1alpha1()} err := fakeClient.CheckIfArgoCDExists("argocd") if err != nil { t.Fatalf("CheckIfArgoCDExists failed: got %v,want %v", err, nil) } err = fakeClient.CheckIfArgoCDExists("unknown") wantErr := `deployments "unknown" not found` if err == nil { t.Fatalf("CheckIfArgoCDExists failed: got %v, want %v", nil, wantErr) } }
explode_data.jsonl/31481
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 364 }
[ 2830, 3393, 3973, 2679, 2735, 78, 6484, 15575, 1155, 353, 8840, 836, 8, 341, 83041, 2959, 1669, 19624, 30570, 7121, 16374, 2959, 746, 2099, 85, 16, 7141, 16, 72883, 1860, 5637, 515, 197, 23816, 12175, 25, 77520, 16, 80222, 515, 298, 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...
3
func TestJiraSetInnoDBDefaultRowFormat(t *testing.T) { // For issue #23541 // JIRA needs to be able to set this to be happy. // See: https://nova.moe/run-jira-on-tidb/ store, clean := testkit.CreateMockStore(t) defer clean() tk := testkit.NewTestKit(t, store) tk.MustExec("set global innodb_default_row_format = dynamic") tk.MustExec("set global innodb_default_row_format = 'dynamic'") tk.MustQuery("SHOW VARIABLES LIKE 'innodb_default_row_format'").Check(testkit.Rows("innodb_default_row_format dynamic")) tk.MustQuery("SHOW VARIABLES LIKE 'character_set_server'").Check(testkit.Rows("character_set_server utf8mb4")) tk.MustQuery("SHOW VARIABLES LIKE 'innodb_file_format'").Check(testkit.Rows("innodb_file_format Barracuda")) tk.MustQuery("SHOW VARIABLES LIKE 'innodb_large_prefix'").Check(testkit.Rows("innodb_large_prefix ON")) }
explode_data.jsonl/65576
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 326 }
[ 2830, 3393, 41, 8832, 1649, 641, 82240, 3675, 3102, 4061, 1155, 353, 8840, 836, 8, 341, 197, 322, 1752, 4265, 671, 17, 18, 20, 19, 16, 198, 197, 322, 619, 60556, 3880, 311, 387, 2952, 311, 738, 419, 311, 387, 6247, 624, 197, 322, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestTypeSystem_ScalarTypesMustBeSerializable_AcceptsAScalarTypeDefiningSerialize(t *testing.T) { _, err := schemaWithFieldType(graphql.NewScalar(graphql.ScalarConfig{ Name: "SomeScalar", Serialize: func(value interface{}) interface{} { return nil }, })) if err != nil { t.Fatalf("unexpected error: %v", err) } }
explode_data.jsonl/79167
{ "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, 929, 2320, 1098, 59153, 4173, 31776, 3430, 29268, 1566, 66, 57771, 1911, 59153, 45102, 5740, 15680, 1155, 353, 8840, 836, 8, 1476, 197, 6878, 1848, 1669, 10802, 2354, 63733, 24312, 1470, 7121, 20639, 24312, 1470, 808, 59153, 2...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func Test_KeyFileNamesFetcher_Suite(t *testing.T) { setupForTest := func(listenerCert, listenerKey string, trustSystemCerts bool) (string, *HorizonConfig) { dir, _ := setupTesting(listenerCert, listenerKey, trustSystemCerts, t) cfg, err := Read(filepath.Join(dir, "config.json")) if err != nil { t.Error(nil) } err = os.Setenv("SNAP_COMMON", dir) if err != nil { t.Error(err) } cfg.Edge.PublicKeyPath = filepath.Join(dir, "/trusted/keyfile1.pem") return dir, cfg } dir, cfg := setupForTest(collaboratorsTestCert, collaboratorsTestKey, false) t.Run("Test zero *.pem files under user key path", func(t *testing.T) { fnames, err := cfg.Collaborators.KeyFileNamesFetcher.GetKeyFileNames(cfg.Edge.PublicKeyPath, cfg.UserPublicKeyPath()) if err != nil { t.Error("Got error but should not.") } if len(fnames) != 0 { t.Errorf("Number of files should be 0 but got %v.", len(fnames)) } }) t.Run("Test filter out non .pem files", func(t *testing.T) { userKeyPath := cfg.UserPublicKeyPath() if err := os.Mkdir(userKeyPath, 0777); err != nil { t.Error(err) } if err := os.Mkdir(dir+"/trusted", 0777); err != nil { t.Error(err) } nonpemfile1 := filepath.Join(dir, "/trusted/non_pem_file1") if err := ioutil.WriteFile(nonpemfile1, []byte("hello from non pem file 1"), 0660); err != nil { t.Error(err) } nonpemfile2 := filepath.Join(userKeyPath, "/non_pem_file2") if err := ioutil.WriteFile(nonpemfile2, []byte("hello from non pem file 2"), 0660); err != nil { t.Error(err) } fnames, err := cfg.Collaborators.KeyFileNamesFetcher.GetKeyFileNames(cfg.Edge.PublicKeyPath, userKeyPath) if err != nil { t.Error("Got error but should not.") } if len(fnames) != 0 { t.Errorf("Number of files should be 0 but got %v.", len(fnames)) } }) t.Run("Test getting pem files", func(t *testing.T) { userKeyPath := cfg.UserPublicKeyPath() pemfile1 := filepath.Join(dir, "/trusted/realfile1.pem") if err := ioutil.WriteFile(pemfile1, []byte("hello from pem file 1"), 0660); err != nil { t.Error(err) } pemfile2 := filepath.Join(dir, "/trusted/realfile2.pem") if err := ioutil.WriteFile(pemfile2, []byte("hello from pem file 2"), 0660); err != nil { t.Error(err) } pemfile3 := filepath.Join(userKeyPath, "realfile3.pem") if err := ioutil.WriteFile(pemfile3, []byte("hello from pem file 3"), 0660); err != nil { t.Error(err) } pemfile4 := filepath.Join(userKeyPath, "realfile4.pem") if err := ioutil.WriteFile(pemfile4, []byte("hello from pem file 4"), 0660); err != nil { t.Error(err) } fnames, err := cfg.Collaborators.KeyFileNamesFetcher.GetKeyFileNames(cfg.Edge.PublicKeyPath, userKeyPath) if err != nil { t.Error("Got error but should not.") } if len(fnames) != 4 { t.Errorf("Number of files should be 4 but got %v.", len(fnames)) } else { for _, fn := range fnames { if !strings.Contains(fn, "realfile") { t.Errorf("File %v should not be returned as a pem file.", fn) } } } }) t.Run("Cleaning up", func(t *testing.T) { cleanup(dir, t) }) }
explode_data.jsonl/70615
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1299 }
[ 2830, 3393, 35253, 1703, 7980, 97492, 1098, 9302, 1155, 353, 8840, 836, 8, 341, 84571, 2461, 2271, 1669, 2915, 40610, 36934, 11, 11446, 1592, 914, 11, 6950, 2320, 34, 15546, 1807, 8, 320, 917, 11, 353, 39601, 16973, 2648, 8, 341, 197,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestGetExtensionStability(t *testing.T) { check := func(m *pb.MyMessage) bool { ext1, err := proto.GetExtension(m, pb.E_Ext_More) if err != nil { t.Fatalf("GetExtension() failed: %s", err) } ext2, err := proto.GetExtension(m, pb.E_Ext_More) if err != nil { t.Fatalf("GetExtension() failed: %s", err) } return ext1 == ext2 } msg := &pb.MyMessage{Count: proto.Int32(4)} ext0 := &pb.Ext{} if err := proto.SetExtension(msg, pb.E_Ext_More, ext0); err != nil { t.Fatalf("Could not set ext1: %s", ext0) } if !check(msg) { t.Errorf("GetExtension() not stable before marshaling") } bb, err := proto.Marshal(msg) if err != nil { t.Fatalf("Marshal() failed: %s", err) } msg1 := &pb.MyMessage{} err = proto.Unmarshal(bb, msg1) if err != nil { t.Fatalf("Unmarshal() failed: %s", err) } if !check(msg1) { t.Errorf("GetExtension() not stable after unmarshaling") } }
explode_data.jsonl/55063
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 401 }
[ 2830, 3393, 1949, 12049, 623, 2897, 1155, 353, 8840, 836, 8, 341, 25157, 1669, 2915, 1255, 353, 16650, 27054, 2052, 8, 1807, 341, 197, 95450, 16, 11, 1848, 1669, 18433, 2234, 12049, 1255, 11, 17310, 5142, 62, 6756, 1245, 460, 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...
3
func TestRedis_Hsetnx(t *testing.T) { runOnRedis(t, func(client *Redis) { assert.Nil(t, client.Hset("a", "aa", "aaa")) assert.Nil(t, client.Hset("a", "bb", "bbb")) _, err := NewRedis(client.Addr, "").Hsetnx("a", "bb", "ccc") assert.NotNil(t, err) ok, err := client.Hsetnx("a", "bb", "ccc") assert.Nil(t, err) assert.False(t, ok) ok, err = client.Hsetnx("a", "dd", "ddd") assert.Nil(t, err) assert.True(t, ok) vals, err := client.Hvals("a") assert.Nil(t, err) assert.ElementsMatch(t, []string{"aaa", "bbb", "ddd"}, vals) }) }
explode_data.jsonl/39158
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 276 }
[ 2830, 3393, 48137, 2039, 746, 23357, 1155, 353, 8840, 836, 8, 341, 56742, 1925, 48137, 1155, 11, 2915, 12805, 353, 48137, 8, 341, 197, 6948, 59678, 1155, 11, 2943, 3839, 746, 445, 64, 497, 330, 5305, 497, 330, 32646, 5455, 197, 6948, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestPersistWithLargeWfSupport(t *testing.T) { defer makeMax()() cancel, controller := newController() defer cancel() ctx := context.Background() wfcset := controller.wfclientset.ArgoprojV1alpha1().Workflows("") wf := unmarshalWF(helloWorldWfPersist) wf, err := wfcset.Create(ctx, wf, metav1.CreateOptions{}) assert.NoError(t, err) controller.offloadNodeStatusRepo, controller.hydrator = getMockDBCtx(nil, true) woc := newWorkflowOperationCtx(wf, controller) woc.operate(ctx) wf, err = wfcset.Get(ctx, wf.Name, metav1.GetOptions{}) assert.NoError(t, err) assert.Equal(t, wfv1.NodeRunning, woc.wf.Status.Phase) // check the saved version has been offloaded assert.True(t, wf.Status.IsOffloadNodeStatus()) assert.Empty(t, wf.Status.Nodes) assert.Empty(t, wf.Status.CompressedNodes) // check the updated in-memory version is pre-offloaded state assert.False(t, woc.wf.Status.IsOffloadNodeStatus()) assert.NotEmpty(t, woc.wf.Status.Nodes) assert.Empty(t, woc.wf.Status.CompressedNodes) }
explode_data.jsonl/45517
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 395 }
[ 2830, 3393, 61267, 2354, 34253, 54, 69, 7916, 1155, 353, 8840, 836, 8, 341, 16867, 1281, 5974, 368, 741, 84441, 11, 6461, 1669, 501, 2051, 741, 16867, 9121, 2822, 20985, 1669, 2266, 19047, 741, 6692, 8316, 746, 1669, 6461, 1418, 69, 2...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func Test_packetConnReadFromRecvfromInvalidSockaddr(t *testing.T) { p, err := newPacketConn( &net.Interface{}, &addrRecvfromSocket{ addr: &unix.SockaddrInet4{}, }, 0, nil, ) if err != nil { t.Fatal(err) } _, _, err = p.ReadFrom(nil) if want, got := unix.EINVAL, err; want != got { t.Fatalf("unexpected error:\n- want: %v\n- got: %v", want, got) } }
explode_data.jsonl/35207
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 179 }
[ 2830, 3393, 21078, 9701, 4418, 3830, 63483, 1499, 7928, 79812, 6214, 1155, 353, 8840, 836, 8, 341, 3223, 11, 1848, 1669, 501, 16679, 9701, 1006, 197, 197, 5, 4711, 41065, 38837, 197, 197, 5, 6214, 63483, 1499, 10286, 515, 298, 53183, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestNewGatewayClient(t *testing.T) { _, err := NewGatewayClient("3383e58e-9cde-4ffa-85cf-81cd25b2423e", "SecKey") assert.NoError(t, err) }
explode_data.jsonl/67937
{ "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, 3564, 40709, 2959, 1155, 353, 8840, 836, 8, 341, 197, 6878, 1848, 1669, 1532, 40709, 2959, 445, 18, 18, 23, 18, 68, 20, 23, 68, 12, 24, 66, 450, 12, 19, 71942, 12, 23, 20, 9792, 12, 23, 16, 4385, 17, 20, 65, 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
func TestReadWithSizeLimit(t *testing.T) { buf := archive.MustWriteTarGz([][2]string{ {"data.json", `"foo"`}, }) loader := NewTarballLoaderWithBaseURL(buf, "") br := NewCustomReader(loader).WithSizeLimitBytes(4) _, err := br.Read() if err == nil || err.Error() != "bundle file exceeded max size (4 bytes)" { t.Fatal("expected error but got:", err) } buf = archive.MustWriteTarGz([][2]string{ {".signatures.json", `"foo"`}, }) loader = NewTarballLoaderWithBaseURL(buf, "") br = NewCustomReader(loader).WithSizeLimitBytes(4) _, err = br.Read() if err == nil || err.Error() != "bundle signatures file exceeded max size (4 bytes)" { t.Fatal("expected error but got:", err) } }
explode_data.jsonl/55365
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 260 }
[ 2830, 3393, 4418, 2354, 1695, 16527, 1155, 353, 8840, 836, 8, 1476, 26398, 1669, 18132, 50463, 7985, 62733, 38, 89, 10556, 58, 17, 30953, 515, 197, 197, 4913, 691, 4323, 497, 53305, 7975, 39917, 1583, 197, 8824, 197, 8355, 1669, 1532, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestDoubleDataPointSlice(t *testing.T) { es := NewDoubleDataPointSlice() assert.EqualValues(t, 0, es.Len()) es = newDoubleDataPointSlice(&[]*otlpmetrics.DoubleDataPoint{}) assert.EqualValues(t, 0, es.Len()) es.Resize(7) emptyVal := NewDoubleDataPoint() emptyVal.InitEmpty() testVal := generateTestDoubleDataPoint() assert.EqualValues(t, 7, es.Len()) for i := 0; i < es.Len(); i++ { assert.EqualValues(t, emptyVal, es.At(i)) fillTestDoubleDataPoint(es.At(i)) assert.EqualValues(t, testVal, es.At(i)) } }
explode_data.jsonl/19533
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 211 }
[ 2830, 3393, 7378, 1043, 2609, 33236, 1155, 353, 8840, 836, 8, 341, 78966, 1669, 1532, 7378, 1043, 2609, 33236, 741, 6948, 12808, 6227, 1155, 11, 220, 15, 11, 1531, 65819, 2398, 78966, 284, 501, 7378, 1043, 2609, 33236, 2099, 1294, 9, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestDeleteInstanceV2(t *testing.T) { instanceIds := []string{"instanceId"} queryArgs := &DeleteInstanceArgs{ BbcRecycleFlag: true, InstanceIds: instanceIds, } if err := BBC_CLIENT.DeleteInstances(queryArgs); err != nil { fmt.Println("delete instance failed: ", err) } else { fmt.Println("delete instance success") } }
explode_data.jsonl/4094
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 124 }
[ 2830, 3393, 6435, 2523, 53, 17, 1155, 353, 8840, 836, 8, 341, 56256, 12701, 1669, 3056, 917, 4913, 4851, 764, 16707, 27274, 4117, 1669, 609, 6435, 2523, 4117, 515, 197, 12791, 8904, 3820, 5449, 12135, 25, 830, 345, 197, 197, 2523, 127...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestTLSCertObserverControllerInformerFilters(t *testing.T) { spec.Run(t, "informer filters", func(t *testing.T, when spec.G, it spec.S) { var ( r *require.Assertions observableWithInformerOption *testutil.ObservableWithInformerOption secretsInformerFilter controllerlib.Filter oidcProviderInformerFilter controllerlib.Filter ) it.Before(func() { r = require.New(t) observableWithInformerOption = testutil.NewObservableWithInformerOption() secretsInformer := kubeinformers.NewSharedInformerFactory(nil, 0).Core().V1().Secrets() oidcProviderInformer := pinnipedinformers.NewSharedInformerFactory(nil, 0).Config().V1alpha1().OIDCProviders() _ = NewTLSCertObserverController( nil, "", // don't care about the secret name for this test secretsInformer, oidcProviderInformer, observableWithInformerOption.WithInformer, // make it possible to observe the behavior of the Filters ) secretsInformerFilter = observableWithInformerOption.GetFilterForInformer(secretsInformer) oidcProviderInformerFilter = observableWithInformerOption.GetFilterForInformer(oidcProviderInformer) }) when("watching Secret objects", func() { var ( subject controllerlib.Filter secret, otherSecret *corev1.Secret ) it.Before(func() { subject = secretsInformerFilter secret = &corev1.Secret{ObjectMeta: metav1.ObjectMeta{Name: "any-name", Namespace: "any-namespace"}} otherSecret = &corev1.Secret{ObjectMeta: metav1.ObjectMeta{Name: "any-other-name", Namespace: "any-other-namespace"}} }) when("any Secret changes", func() { it("returns true to trigger the sync method", func() { r.True(subject.Add(secret)) r.True(subject.Update(secret, otherSecret)) r.True(subject.Update(otherSecret, secret)) r.True(subject.Delete(secret)) }) }) }) when("watching OIDCProvider objects", func() { var ( subject controllerlib.Filter provider, otherProvider *v1alpha1.OIDCProvider ) it.Before(func() { subject = oidcProviderInformerFilter provider = &v1alpha1.OIDCProvider{ObjectMeta: metav1.ObjectMeta{Name: "any-name", Namespace: "any-namespace"}} otherProvider = &v1alpha1.OIDCProvider{ObjectMeta: metav1.ObjectMeta{Name: "any-other-name", Namespace: "any-other-namespace"}} }) when("any OIDCProvider changes", func() { it("returns true to trigger the sync method", func() { r.True(subject.Add(provider)) r.True(subject.Update(provider, otherProvider)) r.True(subject.Update(otherProvider, provider)) r.True(subject.Delete(provider)) }) }) }) }, spec.Parallel(), spec.Report(report.Terminal{})) }
explode_data.jsonl/48584
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1065 }
[ 2830, 3393, 13470, 3540, 529, 17151, 2051, 641, 34527, 28351, 1155, 353, 8840, 836, 8, 341, 98100, 16708, 1155, 11, 330, 258, 34527, 13406, 497, 2915, 1155, 353, 8840, 836, 11, 979, 1398, 1224, 11, 432, 1398, 808, 8, 341, 197, 2405, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestEmailTest(t *testing.T) { th := Setup().InitBasic().InitSystemAdmin() defer th.TearDown() Client := th.Client config := model.Config{ EmailSettings: model.EmailSettings{ SMTPServer: "", SMTPPort: "", }, } _, resp := Client.TestEmail(&config) CheckForbiddenStatus(t, resp) _, resp = th.SystemAdminClient.TestEmail(&config) CheckErrorMessage(t, resp, "api.admin.test_email.missing_server") CheckBadRequestStatus(t, resp) inbucket_host := os.Getenv("CI_HOST") if inbucket_host == "" { inbucket_host = "dockerhost" } inbucket_port := os.Getenv("CI_INBUCKET_PORT") if inbucket_port == "" { inbucket_port = "9000" } config.EmailSettings.SMTPServer = inbucket_host config.EmailSettings.SMTPPort = inbucket_port _, resp = th.SystemAdminClient.TestEmail(&config) CheckOKStatus(t, resp) }
explode_data.jsonl/10684
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 320 }
[ 2830, 3393, 4781, 2271, 1155, 353, 8840, 836, 8, 341, 70479, 1669, 18626, 1005, 3803, 15944, 1005, 3803, 2320, 7210, 741, 16867, 270, 836, 682, 4454, 741, 71724, 1669, 270, 11716, 271, 25873, 1669, 1614, 10753, 515, 197, 197, 4781, 6086...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestStaleness(t *testing.T) { storage := testutil.NewStorage(t) defer storage.Close() engine := promql.NewEngine(nil, nil, 10, 10*time.Second) opts := &ManagerOptions{ QueryFunc: EngineQueryFunc(engine, storage), Appendable: storage, Context: context.Background(), Logger: log.NewNopLogger(), } expr, err := promql.ParseExpr("a + 1") testutil.Ok(t, err) rule := NewRecordingRule("a_plus_one", expr, labels.Labels{}) group := NewGroup("default", "", time.Second, []Rule{rule}, opts) // A time series that has two samples and then goes stale. app, _ := storage.Appender() app.Add(labels.FromStrings(model.MetricNameLabel, "a"), 0, 1) app.Add(labels.FromStrings(model.MetricNameLabel, "a"), 1000, 2) app.Add(labels.FromStrings(model.MetricNameLabel, "a"), 2000, math.Float64frombits(value.StaleNaN)) err = app.Commit() testutil.Ok(t, err) ctx := context.Background() // Execute 3 times, 1 second apart. group.Eval(ctx, time.Unix(0, 0)) group.Eval(ctx, time.Unix(1, 0)) group.Eval(ctx, time.Unix(2, 0)) querier, err := storage.Querier(context.Background(), 0, 2000) testutil.Ok(t, err) defer querier.Close() matcher, err := labels.NewMatcher(labels.MatchEqual, model.MetricNameLabel, "a_plus_one") testutil.Ok(t, err) set, err := querier.Select(nil, matcher) testutil.Ok(t, err) samples, err := readSeriesSet(set) testutil.Ok(t, err) metric := labels.FromStrings(model.MetricNameLabel, "a_plus_one").String() metricSample, ok := samples[metric] testutil.Assert(t, ok, "Series %s not returned.", metric) testutil.Assert(t, value.IsStaleNaN(metricSample[2].V), "Appended second sample not as expected. Wanted: stale NaN Got: %x", math.Float64bits(metricSample[2].V)) metricSample[2].V = 42 // reflect.DeepEqual cannot handle NaN. want := map[string][]promql.Point{ metric: []promql.Point{{0, 2}, {1000, 3}, {2000, 42}}, } testutil.Equals(t, want, samples) }
explode_data.jsonl/40287
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 747 }
[ 2830, 3393, 623, 278, 23709, 1155, 353, 8840, 836, 8, 341, 197, 16172, 1669, 1273, 1314, 7121, 5793, 1155, 340, 16867, 5819, 10421, 741, 80118, 1669, 2706, 1470, 7121, 4571, 27907, 11, 2092, 11, 220, 16, 15, 11, 220, 16, 15, 77053, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestClient_GetSearch(t *testing.T) { Convey("given a 200 status is returned with an empty result list", t, func() { searchResp, err := ioutil.ReadFile("./response_mocks/empty_results.json") So(err, ShouldBeNil) httpClient := createHTTPClientMock(http.StatusOK, searchResp) searchClient := newSearchClient(httpClient) Convey("when GetSearch is called", func() { v := url.Values{} v.Set("q", "a") r, err := searchClient.GetSearch(ctx, v) Convey("a positive response is returned", func() { So(err, ShouldBeNil) So(r.Count, ShouldEqual, 0) So(r.ContentTypes, ShouldBeEmpty) So(r.Items, ShouldBeEmpty) }) Convey("and dphttpclient.Do is called 1 time", func() { checkResponseBase(httpClient, http.MethodGet, "/search?q=a") }) }) }) Convey("given a 200 status is returned with list of search results", t, func() { searchResp, err := ioutil.ReadFile("./response_mocks/results.json") So(err, ShouldBeNil) httpClient := createHTTPClientMock(http.StatusOK, searchResp) searchClient := newSearchClient(httpClient) Convey("when GetSearch is called", func() { v := url.Values{} v.Set("q", "housing") r, err := searchClient.GetSearch(ctx, v) Convey("a positive response is returned", func() { So(err, ShouldBeNil) So(r.Count, ShouldEqual, 5) So(r.Items, ShouldNotBeEmpty) So(r.ContentTypes, ShouldNotBeEmpty) }) Convey("and dphttpclient.Do is called 1 time", func() { checkResponseBase(httpClient, http.MethodGet, "/search?q=housing") }) }) }) Convey("given a 400 status is returned", t, func() { httpClient := createHTTPClientMock(http.StatusBadRequest, nil) searchClient := newSearchClient(httpClient) Convey("when GetSearch is called", func() { v := url.Values{} v.Set("limit", "a") _, err := searchClient.GetSearch(ctx, v) Convey("then the expected error is returned", func() { So(err.Error(), ShouldResemble, errors.Errorf("invalid response from dp-search-api - should be: 200, got: 400, path: "+testHost+"/search?limit=a").Error()) }) Convey("and dphttpclient.Do is called 1 time", func() { checkResponseBase(httpClient, http.MethodGet, "/search?limit=a") }) }) }) Convey("given a 500 status is returned", t, func() { httpClient := createHTTPClientMock(http.StatusInternalServerError, nil) searchClient := newSearchClient(httpClient) Convey("when GetSearch is called", func() { v := url.Values{} v.Set("limit", "housing") _, err := searchClient.GetSearch(ctx, v) Convey("then the expected error is returned", func() { So(err.Error(), ShouldResemble, errors.Errorf("invalid response from dp-search-api - should be: 200, got: 500, path: "+testHost+"/search?limit=housing").Error()) }) Convey("and dphttpclient.Do is called 1 time", func() { checkResponseBase(httpClient, http.MethodGet, "/search?limit=housing") }) }) }) }
explode_data.jsonl/75480
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1091 }
[ 2830, 3393, 2959, 13614, 5890, 1155, 353, 8840, 836, 8, 341, 93070, 5617, 445, 41968, 264, 220, 17, 15, 15, 2639, 374, 5927, 448, 458, 4287, 1102, 1140, 497, 259, 11, 2915, 368, 341, 197, 45573, 36555, 11, 1848, 1669, 43144, 78976, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestDownload_FirstStream(t *testing.T) { assert, require := assert.New(t), require.New(t) ctx := context.Background() // youtube-dl test video video, err := testDownloader.Client.GetVideoContext(ctx, "BaW_jenozKc") require.NoError(err) require.NotNil(video) assert.Equal(`youtube-dl test video "'/\ä↭𝕐`, video.Title) assert.Equal(`Philipp Hagemeister`, video.Author) assert.Equal(10*time.Second, video.Duration) assert.Len(video.Formats, 18) if assert.Greater(len(video.Formats), 0) { assert.NoError(testDownloader.Download(ctx, video, &video.Formats[0], "")) } }
explode_data.jsonl/66733
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 219 }
[ 2830, 3393, 11377, 79790, 3027, 1155, 353, 8840, 836, 8, 341, 6948, 11, 1373, 1669, 2060, 7121, 1155, 701, 1373, 7121, 1155, 340, 20985, 1669, 2266, 19047, 2822, 197, 322, 27178, 1737, 75, 1273, 2766, 198, 96947, 11, 1848, 1669, 1273, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestSubscribeDuplicateType(t *testing.T) { mux := new(TypeMux) expected := "event: duplicate type event.testEvent in Subscribe" defer func() { err := recover() if err == nil { t.Errorf("Subscribe didn't panic for duplicate type") } else if err != expected { t.Errorf("panic mismatch: got %#v, expected %#v", err, expected) } }() mux.Subscribe(testEvent(1), testEvent(2)) }
explode_data.jsonl/61576
{ "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, 28573, 53979, 929, 1155, 353, 8840, 836, 8, 341, 2109, 2200, 1669, 501, 22498, 44, 2200, 340, 42400, 1669, 330, 3087, 25, 22513, 943, 1538, 5958, 1556, 304, 27270, 1837, 16867, 2915, 368, 341, 197, 9859, 1669, 11731, 741, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestSendX(t *testing.T) { server, client := net.Pipe() go func() { SendOK(client) SendErr(client, errors.New("example")) SendClose(client) server.Close() }() client.Close() }
explode_data.jsonl/70
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 79 }
[ 2830, 3393, 11505, 55, 1155, 353, 8840, 836, 8, 341, 41057, 11, 2943, 1669, 4179, 1069, 3444, 2822, 30680, 2915, 368, 341, 197, 71752, 3925, 12805, 340, 197, 71752, 7747, 12805, 11, 5975, 7121, 445, 8687, 5455, 197, 71752, 7925, 12805, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestDefaultSignerSignTx(t *testing.T) { data, err := hex.DecodeString("634fb5a872396d9693e5c9f9d7233cfa93f395c093371017ff44aa9ae6564cdd") if err != nil { t.Fatal(err) } privKey, err := crypto.DecodeSecp256k1PrivateKey(data) if err != nil { t.Fatal(err) } signer := crypto.NewDefaultSigner(privKey) beneficiary := common.HexToAddress("8d3766440f0d7b949a5e32995d09619a7f86e632") tx, err := signer.SignTx(types.NewTransaction(0, beneficiary, big.NewInt(0), 21000, big.NewInt(1), []byte{1})) if err != nil { t.Fatal(err) } expectedR := math.MustParseBig256("0x28815033e9b5b7ec32e40e3c90b6cd499c12de8a7da261fdad8b800c845b88ef") expectedS := math.MustParseBig256("0x71f1c08f754ee36e0c9743a2240d4b6640ea4d78c8dc2d83a599bdcf80ef9d5f") expectedV := math.MustParseBig256("0x1c") v, r, s := tx.RawSignatureValues() if expectedV.Cmp(v) != 0 { t.Fatalf("wrong v value. expected %x, got %x", expectedV, v) } if expectedR.Cmp(r) != 0 { t.Fatalf("wrong r value. expected %x, got %x", expectedR, r) } if expectedS.Cmp(s) != 0 { t.Fatalf("wrong s value. expected %x, got %x", expectedS, s) } }
explode_data.jsonl/31475
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 523 }
[ 2830, 3393, 3675, 7264, 261, 7264, 31584, 1155, 353, 8840, 836, 8, 341, 8924, 11, 1848, 1669, 12371, 56372, 703, 445, 21, 18, 19, 10798, 20, 64, 23, 22, 17, 18, 24, 21, 67, 24, 21, 24, 18, 68, 20, 66, 24, 69, 24, 67, 22, 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...
7
func TestFlattenShootGCP(t *testing.T) { minPorts := int32(2) aggregationInterval := "test" metadata := "test" fs := float32(2) internal := "test" gcpControlPlaneConfig, _ := json.Marshal(gcpAlpha1.ControlPlaneConfig{ Zone: "zone1", }) gcpConfig, _ := json.Marshal(gcpAlpha1.InfrastructureConfig{ TypeMeta: v1.TypeMeta{ APIVersion: "gcp.provider.extensions.gardener.cloud/v1alpha1", Kind: "InfrastructureConfig", }, Networks: gcpAlpha1.NetworkConfig{ VPC: &gcpAlpha1.VPC{ CloudRouter: &gcpAlpha1.CloudRouter{ Name: "bar", }, Name: "foo", }, Workers: "10.250.0.0/19", CloudNAT: &gcpAlpha1.CloudNAT{ MinPortsPerVM: &minPorts, }, Internal: &internal, FlowLogs: &gcpAlpha1.FlowLogs{ AggregationInterval: &aggregationInterval, FlowSampling: &fs, Metadata: &metadata, }, }, }) d := ResourceShoot().TestResourceData() shoot := corev1beta1.ShootSpec{ Provider: corev1beta1.Provider{ Type: "gcp", ControlPlaneConfig: &corev1beta1.ProviderConfig{ RawExtension: runtime.RawExtension{ Raw: gcpControlPlaneConfig, }, }, InfrastructureConfig: &corev1beta1.ProviderConfig{ RawExtension: runtime.RawExtension{ Raw: gcpConfig, }, }, }, } expected := []interface{}{ map[string]interface{}{ "kubernetes": []interface{}{}, "networking": []interface{}{}, "provider": []interface{}{ map[string]interface{}{ "type": "gcp", "control_plane_config": []interface{}{ map[string]interface{}{ "gcp": []interface{}{ map[string]interface{}{ "zone": "zone1", }, }, }, }, "infrastructure_config": []interface{}{ map[string]interface{}{ "gcp": []interface{}{ map[string]interface{}{ "networks": []interface{}{ map[string]interface{}{ "vpc": []interface{}{ map[string]interface{}{ "name": "foo", "cloud_router": []interface{}{ map[string]interface{}{ "name": "bar", }, }, }, }, "workers": "10.250.0.0/19", "cloud_nat": []interface{}{ map[string]interface{}{ "min_ports_per_vm": int32(2), }, }, "internal": "test", "flow_logs": []interface{}{ map[string]interface{}{ "aggregation_interval": "test", "flow_sampling": float32(2), "metadata": "test", }, }, }, }, }, }, }, }, }, }, }, } err := d.Set("spec", expected) if err != nil { t.Fatalf("Unable to set the spec: %v\n", err) } out, _ := flatten.FlattenShoot(shoot, d, "") if diff := cmp.Diff(expected, out); diff != "" { t.Fatalf("Error matching output and expected: \n%s", diff) } }
explode_data.jsonl/26241
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1546 }
[ 2830, 3393, 3882, 14456, 85195, 38, 7123, 1155, 353, 8840, 836, 8, 341, 25320, 68273, 1669, 526, 18, 17, 7, 17, 340, 197, 351, 34442, 10256, 1669, 330, 1944, 698, 2109, 7603, 1669, 330, 1944, 698, 53584, 1669, 2224, 18, 17, 7, 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...
3
func TestActivityService_ListNotification(t *testing.T) { setup() defer teardown() mux.HandleFunc("/notifications", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "GET") testFormValues(t, r, values{ "all": "true", "participating": "true", "since": "2006-01-02T15:04:05Z", "before": "2007-03-04T15:04:05Z", }) fmt.Fprint(w, `[{"id":"1", "subject":{"title":"t"}}]`) }) opt := &NotificationListOptions{ All: true, Participating: true, Since: time.Date(2006, 01, 02, 15, 04, 05, 0, time.UTC), Before: time.Date(2007, 03, 04, 15, 04, 05, 0, time.UTC), } notifications, _, err := client.Activity.ListNotifications(opt) if err != nil { t.Errorf("Activity.ListNotifications returned error: %v", err) } want := []Notification{{ID: String("1"), Subject: &NotificationSubject{Title: String("t")}}} if !reflect.DeepEqual(notifications, want) { t.Errorf("Activity.ListNotifications returned %+v, want %+v", notifications, want) } }
explode_data.jsonl/6715
{ "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, 4052, 1860, 27104, 11196, 1155, 353, 8840, 836, 8, 341, 84571, 741, 16867, 49304, 2822, 2109, 2200, 63623, 4283, 38188, 497, 2915, 3622, 1758, 37508, 11, 435, 353, 1254, 9659, 8, 341, 197, 18185, 3523, 1155, 11, 435, 11, 3...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1