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 TestAccAWSS3BucketObject_updatesWithVersioningViaAccessPoint(t *testing.T) { var originalObj, modifiedObj s3.GetObjectOutput rName := acctest.RandomWithPrefix("tf-acc-test") resourceName := "aws_s3_bucket_object.test" accessPointResourceName := "aws_s3_access_point.test" sourceInitial := testAccAWSS3BucketObjectCreateTempFile(t, "initial versioned object state") defer os.Remove(sourceInitial) sourceModified := testAccAWSS3BucketObjectCreateTempFile(t, "modified versioned object") defer os.Remove(sourceInitial) resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, CheckDestroy: testAccCheckAWSS3BucketObjectDestroy, Steps: []resource.TestStep{ { Config: testAccAWSS3BucketObjectConfig_updateableViaAccessPoint(rName, true, sourceInitial), Check: resource.ComposeTestCheckFunc( testAccCheckAWSS3BucketObjectExists(resourceName, &originalObj), testAccCheckAWSS3BucketObjectBody(&originalObj, "initial versioned object state"), resource.TestCheckResourceAttrPair(resourceName, "bucket", accessPointResourceName, "arn"), resource.TestCheckResourceAttr(resourceName, "etag", "cee4407fa91906284e2a5e5e03e86b1b"), ), }, { Config: testAccAWSS3BucketObjectConfig_updateableViaAccessPoint(rName, true, sourceModified), Check: resource.ComposeTestCheckFunc( testAccCheckAWSS3BucketObjectExists(resourceName, &modifiedObj), testAccCheckAWSS3BucketObjectBody(&modifiedObj, "modified versioned object"), resource.TestCheckResourceAttr(resourceName, "etag", "00b8c73b1b50e7cc932362c7225b8e29"), testAccCheckAWSS3BucketObjectVersionIdDiffers(&modifiedObj, &originalObj), ), }, }, }) }
explode_data.jsonl/64963
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 637 }
[ 2830, 3393, 14603, 14419, 1220, 18, 36018, 1190, 57829, 2354, 5637, 287, 54428, 6054, 2609, 1155, 353, 8840, 836, 8, 341, 2405, 4024, 5261, 11, 10807, 5261, 274, 18, 25618, 5097, 198, 7000, 675, 1669, 1613, 67880, 26709, 2354, 14335, 44...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func Test_getWorkflowsHandler_FilterByRepo(t *testing.T) { api, tsURL := newTestServer(t) admin, _ := assets.InsertAdminUser(t, api.mustDB()) localConsumer, err := authentication.LoadConsumerByTypeAndUserID(context.TODO(), api.mustDB(), sdk.ConsumerLocal, admin.ID, authentication.LoadConsumerOptions.WithAuthentifiedUser) require.NoError(t, err) _, jws, err := builtin.NewConsumer(context.TODO(), api.mustDB(), sdk.RandomString(10), sdk.RandomString(10), localConsumer, admin.GetGroupIDs(), sdk.NewAuthConsumerScopeDetails(sdk.AuthConsumerScopeProject)) u, _ := assets.InsertLambdaUser(t, api.mustDB()) pkey := sdk.RandomString(10) proj := assets.InsertTestProject(t, api.mustDB(), api.Cache, pkey, pkey) require.NoError(t, group.InsertLinkGroupUser(context.TODO(), api.mustDB(), &group.LinkGroupUser{ GroupID: proj.ProjectGroups[0].Group.ID, AuthentifiedUserID: u.ID, Admin: true, })) repofullName := sdk.RandomString(10) app := &sdk.Application{ Name: sdk.RandomString(10), RepositoryFullname: "ovh/" + repofullName, } require.NoError(t, application.Insert(api.mustDB(), *proj, app)) pip := sdk.Pipeline{ ProjectID: proj.ID, ProjectKey: proj.Key, Name: "pip1", } test.NoError(t, pipeline.InsertPipeline(api.mustDB(), &pip)) wf := sdk.Workflow{ Name: "workflow1", ProjectID: proj.ID, ProjectKey: proj.Key, WorkflowData: sdk.WorkflowData{ Node: sdk.Node{ Name: "root", Context: &sdk.NodeContext{ PipelineID: pip.ID, ApplicationID: app.ID, }, }, }, } test.NoError(t, workflow.Insert(context.TODO(), api.mustDB(), api.Cache, *proj, &wf)) wf2 := sdk.Workflow{ Name: "workflow2", ProjectID: proj.ID, ProjectKey: proj.Key, WorkflowData: sdk.WorkflowData{ Node: sdk.Node{ Name: "root", Context: &sdk.NodeContext{ PipelineID: pip.ID, }, }, }, } test.NoError(t, workflow.Insert(context.TODO(), api.mustDB(), api.Cache, *proj, &wf2)) // Call with an admin sdkclientAdmin := cdsclient.New(cdsclient.Config{ Host: tsURL, BuitinConsumerAuthenticationToken: jws, }) wfs, err := sdkclientAdmin.WorkflowList(proj.Key, cdsclient.WithQueryParameter("repo", "ovh/"+repofullName)) require.NoError(t, err) require.Len(t, wfs, 1) require.Equal(t, wf.Name, wfs[0].Name) require.Equal(t, app.ID, wfs[0].WorkflowData.Node.Context.ApplicationID) require.Equal(t, pip.ID, wfs[0].WorkflowData.Node.Context.PipelineID) }
explode_data.jsonl/31085
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1105 }
[ 2830, 3393, 3062, 6776, 38140, 3050, 68935, 1359, 25243, 1155, 353, 8840, 836, 8, 341, 54299, 11, 10591, 3144, 1669, 501, 2271, 5475, 1155, 692, 64394, 11, 716, 1669, 11770, 23142, 7210, 1474, 1155, 11, 6330, 69419, 3506, 2398, 8854, 29...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestNewHTTPBasicAuth(t *testing.T) { server := httptest.NewServer( http.HandlerFunc( func(w http.ResponseWriter, r *http.Request) { username, password, ok := r.BasicAuth() if !(ok && username == "user" && password == "password123") { t.Fatalf("Basic authorization header was not set correctly: expected '%v:%v', got '%v:%v'", "user", "password123", username, password) } }, ), ) defer server.Close() cfg := config_util.HTTPClientConfig{ BasicAuth: &config_util.BasicAuth{ Username: "user", Password: "password123", }, } c, err := config_util.NewClientFromConfig(cfg, "test") if err != nil { t.Fatal(err) } _, err = c.Get(server.URL) if err != nil { t.Fatal(err) } }
explode_data.jsonl/16313
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 294 }
[ 2830, 3393, 3564, 9230, 15944, 5087, 1155, 353, 8840, 836, 8, 341, 41057, 1669, 54320, 70334, 7121, 5475, 1006, 197, 28080, 89164, 1006, 298, 29244, 3622, 1758, 37508, 11, 435, 353, 1254, 9659, 8, 341, 571, 72358, 11, 3552, 11, 5394, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestRESTClientRequires(t *testing.T) { if _, err := RESTClientFor(&Config{Host: "127.0.0.1", Codec: testapi.Default.Codec()}); err == nil { t.Errorf("unexpected non-error") } if _, err := RESTClientFor(&Config{Host: "127.0.0.1", GroupVersion: testapi.Default.GroupVersion()}); err == nil { t.Errorf("unexpected non-error") } if _, err := RESTClientFor(&Config{Host: "127.0.0.1", GroupVersion: testapi.Default.GroupVersion(), Codec: testapi.Default.Codec()}); err != nil { t.Errorf("unexpected error: %v", err) } }
explode_data.jsonl/25920
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 199 }
[ 2830, 3393, 38307, 2959, 46961, 1155, 353, 8840, 836, 8, 341, 743, 8358, 1848, 1669, 25414, 2959, 2461, 2099, 2648, 90, 9296, 25, 330, 16, 17, 22, 13, 15, 13, 15, 13, 16, 497, 67077, 25, 1273, 2068, 13275, 20274, 66, 368, 14088, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestSolution(t *testing.T) { t.Parallel() type in struct { x, y, z int } type out struct { a, b, c int } var cases = []struct { in in want out }{ {in: in{x: 1, y: 2, z: 3}, want: out{a: 3, b: 1, c: 2}}, {in: in{x: 41, y: 59, z: 31}, want: out{a: 31, b: 41, c: 59}}, } for i, tt := range cases { i, tt := i, tt t.Run(fmt.Sprint(i), func(t *testing.T) { t.Parallel() a, b, c := solution(tt.in.x, tt.in.y, tt.in.z) if a != tt.want.a && b != tt.want.b && c != tt.want.c { t.Errorf("in: %+v, a: %d, b: %d, c: %d, want: %d", tt.in, a, b, c, tt.want) } }) } }
explode_data.jsonl/40429
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 340 }
[ 2830, 3393, 36842, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 741, 13158, 304, 2036, 341, 197, 10225, 11, 379, 11, 1147, 526, 198, 197, 630, 13158, 700, 2036, 341, 197, 11323, 11, 293, 11, 272, 526, 198, 197, 532, 2405, 5048, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestFernetKeys(t *testing.T) { m := SFernetKeyManager{} err := m.InitKeys("", 2) if err != nil { t.Fatalf("fail to initkeys %s", err) } buf := make([]byte, 128) for i := 0; i < 10; i += 1 { msgLen, err := rand.Read(buf) if err != nil { t.Fatalf("rand.Read fail %s", err) } msg, err := m.Encrypt(buf[:msgLen]) if err != nil { t.Fatalf("fail to encrypt %s", err) } omsg := m.Decrypt(msg, time.Hour) if len(omsg) != msgLen { t.Fatalf("descrupt fail %s", err) } for i := 0; i < msgLen; i += 1 { if omsg[i] != buf[i] { t.Fatalf("not identical message!!") } } } }
explode_data.jsonl/60518
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 294 }
[ 2830, 3393, 37, 13845, 8850, 1155, 353, 8840, 836, 8, 341, 2109, 1669, 23463, 13845, 1592, 2043, 16094, 9859, 1669, 296, 26849, 8850, 19814, 220, 17, 340, 743, 1848, 961, 2092, 341, 197, 3244, 30762, 445, 18403, 311, 2930, 10563, 1018, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestAppPgcContCount(t *testing.T) { var ( c = context.Background() ) convey.Convey("PgcContCount", t, func(ctx convey.C) { upCnt, err := d.PgcContCount(c) ctx.Convey("Then err should be nil.upCnt should not be nil.", func(ctx convey.C) { ctx.So(err, convey.ShouldBeNil) ctx.So(upCnt, convey.ShouldNotBeNil) }) }) }
explode_data.jsonl/69221
{ "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, 2164, 47, 20669, 818, 2507, 1155, 353, 8840, 836, 8, 341, 2405, 2399, 197, 1444, 284, 2266, 19047, 741, 197, 340, 37203, 5617, 4801, 5617, 445, 47, 20669, 818, 2507, 497, 259, 11, 2915, 7502, 20001, 727, 8, 341, 197, 598...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestLake_Equalize(t *testing.T) { tcs := []struct{ name string cells []IndexHeight want []IndexHeight } { { name: "basin", cells: []IndexHeight{ {Height: 0.0, Water: 0.1}, {Height: 1.0, Water: 0.1}, {Height: 1.0, Water: 0.1}, {Height: 1.0, Water: 0.1}, {Height: 1.0, Water: 0.1}, {Height: 1.0, Water: 0.1}, {Height: 1.0, Water: 0.1}, }, want: []IndexHeight{ {Height: 0.0, Water: 0.7}, {Height: 1.0}, {Height: 1.0}, {Height: 1.0}, {Height: 1.0}, {Height: 1.0}, {Height: 1.0}, }, }, { name: "small basin", cells: []IndexHeight{ {Height: 0.0, Water: 0.1}, {Height: 0.5, Water: 0.1}, {Height: 1.0, Water: 0.1}, {Height: 1.0, Water: 0.1}, {Height: 1.0, Water: 0.1}, {Height: 1.0, Water: 0.1}, {Height: 1.0, Water: 0.1}, }, want: []IndexHeight{ {Height: 0.0, Water: 0.6}, {Height: 0.5, Water: 0.1}, {Height: 1.0}, {Height: 1.0}, {Height: 1.0}, {Height: 1.0}, {Height: 1.0}, }, }, { name: "incline", cells: []IndexHeight{ {Height: 0.0, Water: 0.1}, {Height: 0.1, Water: 0.1}, {Height: 0.2, Water: 0.1}, {Height: 0.3, Water: 0.1}, {Height: 0.4, Water: 0.1}, {Height: 0.5, Water: 0.1}, {Height: 0.6, Water: 0.1}, }, want: []IndexHeight{ {Height: 0.0, Water: 0.325}, {Height: 0.1, Water: 0.225}, {Height: 0.2, Water: 0.125}, {Height: 0.3, Water: 0.025}, {Height: 0.4}, {Height: 0.5}, {Height: 0.6}, }, }, } for _, tc := range tcs { t.Run(tc.name, func(t *testing.T) { l := &Lake{} rand.Shuffle(len(tc.cells), func(i, j int) { tc.cells[i], tc.cells[j] = tc.cells[j], tc.cells[i] }) for i, c := range tc.cells { l.Add(i, c.Height, c.Water) } l.Equalize() if diff := cmp.Diff(tc.want, l.IndexHeights, cmpopts.EquateApprox(0.0, 0.001), cmpopts.IgnoreFields(IndexHeight{}, "Index")); diff != "" { t.Error(diff) } }) } }
explode_data.jsonl/5212
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1104 }
[ 2830, 3393, 81289, 2089, 1751, 551, 1155, 353, 8840, 836, 8, 341, 3244, 4837, 1669, 3056, 1235, 515, 197, 11609, 914, 198, 197, 1444, 6436, 3056, 1552, 3640, 198, 197, 50780, 3056, 1552, 3640, 198, 197, 92, 341, 197, 197, 515, 298, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestEnvAddOnManagedNodeGroups(t *testing.T) { cfg := NewDefault() defer func() { os.RemoveAll(cfg.ConfigPath) os.RemoveAll(cfg.KubectlCommandsOutputPath) os.RemoveAll(cfg.RemoteAccessCommandsOutputPath) }() os.Setenv("AWS_K8S_TESTER_EKS_ADD_ON_NODE_GROUPS_ENABLE", "false") defer os.Unsetenv("AWS_K8S_TESTER_EKS_ADD_ON_NODE_GROUPS_ENABLE") os.Setenv("AWS_K8S_TESTER_EKS_ADD_ON_MANAGED_NODE_GROUPS_ENABLE", "false") defer os.Unsetenv("AWS_K8S_TESTER_EKS_ADD_ON_MANAGED_NODE_GROUPS_ENABLE") if err := cfg.UpdateFromEnvs(); err != nil { t.Fatal(err) } if cfg.AddOnNodeGroups.Enable { t.Fatal("AddOnNodeGroups.Enable expected false, got true") } if cfg.AddOnManagedNodeGroups.Enable { t.Fatal("AddOnManagedNodeGroups.Enable expected false, got true") } cfg.AddOnNLBHelloWorld.Enable = true if err := cfg.ValidateAndSetDefaults(); !strings.Contains(err.Error(), "AddOnNLBHelloWorld.Enable true") { t.Fatalf("expected add-on error, got %v", err) } }
explode_data.jsonl/69897
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 432 }
[ 2830, 3393, 14359, 2212, 1925, 27192, 1955, 22173, 1155, 353, 8840, 836, 8, 341, 50286, 1669, 1532, 3675, 741, 16867, 2915, 368, 341, 197, 25078, 84427, 28272, 10753, 1820, 340, 197, 25078, 84427, 28272, 11352, 53380, 30479, 5097, 1820, 3...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestValidIP4ToReturnFalseOnEmptyAddress(t *testing.T) { result := ipparser.ValidIP4("") if result == true { t.Fatalf("Expected ValidIP() to be false but got true") } }
explode_data.jsonl/70073
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 64 }
[ 2830, 3393, 4088, 3298, 19, 1249, 5598, 4049, 1925, 3522, 4286, 1155, 353, 8840, 836, 8, 341, 9559, 1669, 5997, 9657, 47156, 3298, 19, 445, 5130, 743, 1102, 621, 830, 341, 197, 3244, 30762, 445, 18896, 7818, 3298, 368, 311, 387, 895, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_locationPath(t *testing.T) { tests := []struct { name string path string scheme source.Scheme real string virtual string expected string }{ { name: "dir:.", scheme: source.DirectoryScheme, path: ".", real: "/home/usr/file", virtual: "file", expected: "file", }, { name: "dir:./", scheme: source.DirectoryScheme, path: "./", real: "/home/usr/file", virtual: "file", expected: "file", }, { name: "dir:./someplace", scheme: source.DirectoryScheme, path: "./someplace", real: "/home/usr/file", virtual: "file", expected: "someplace/file", }, { name: "dir:/someplace", scheme: source.DirectoryScheme, path: "/someplace", real: "file", expected: "/someplace/file", }, { name: "dir:/someplace symlink", scheme: source.DirectoryScheme, path: "/someplace", real: "/someplace/usr/file", virtual: "file", expected: "/someplace/file", }, { name: "dir:/someplace absolute", scheme: source.DirectoryScheme, path: "/someplace", real: "/usr/file", expected: "/usr/file", }, { name: "file:/someplace/file", scheme: source.FileScheme, path: "/someplace/file", real: "/usr/file", expected: "/usr/file", }, { name: "file:/someplace/file relative", scheme: source.FileScheme, path: "/someplace/file", real: "file", expected: "file", }, { name: "image", scheme: source.ImageScheme, path: "alpine:latest", real: "/etc/file", expected: "/etc/file", }, { name: "image symlink", scheme: source.ImageScheme, path: "alpine:latest", real: "/etc/elsewhere/file", virtual: "/etc/file", expected: "/etc/file", }, } for _, test := range tests { t.Run(test.name, func(t *testing.T) { pres := createDirPresenter(t, test.path) pres.srcMetadata = &source.Metadata{ Scheme: test.scheme, Path: test.path, } path := pres.packagePath(pkg.Package{ Locations: []source.Location{ { Coordinates: source.Coordinates{ RealPath: test.real, }, VirtualPath: test.virtual, }, }, }) assert.Equal(t, test.expected, path) }) } }
explode_data.jsonl/25490
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1159 }
[ 2830, 3393, 13126, 1820, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 3056, 1235, 341, 197, 11609, 257, 914, 198, 197, 26781, 257, 914, 198, 197, 1903, 8058, 256, 2530, 92719, 198, 197, 91874, 257, 914, 198, 197, 9558, 220, 914, 198, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestBundle_Reconcile(t *testing.T) { b := NewBundle(yaml.GetName()) spec := &v1beta1.ToolsetSpec{} app := application.NewTestYAMLApplication(t) out, _ := yamlv3.Marshal(testHelperResource) app.SetDeploy(spec, true).SetGetYaml(spec, string(out)) b.AddApplication(app.Application()) resources := []*clientgo.Resource{} err := b.Reconcile(resources, spec) assert.NoError(t, err) }
explode_data.jsonl/48066
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 152 }
[ 2830, 3393, 8409, 50693, 40446, 457, 1155, 353, 8840, 836, 8, 341, 2233, 1669, 1532, 8409, 7021, 9467, 60304, 12367, 98100, 1669, 609, 85, 16, 19127, 16, 24439, 746, 8327, 16094, 28236, 1669, 3766, 7121, 2271, 56, 31102, 4988, 1155, 692...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestAccResourceAppPackage(t *testing.T) { resource.UnitTest(t, resource.TestCase{ ProviderFactories: providerFactories, Steps: []resource.TestStep{ // initial creation { Config: testAccResourceAppFileConfig, Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttr("splunkconfig_app_package.indexes", "base_version", "1.0.0"), resource.TestCheckResourceAttr("splunkconfig_app_package.indexes", "effective_version", "1.0.0"), resource.TestCheckResourceAttr("splunkconfig_app_package.indexes", "patch_count", "0"), resource.TestCheckResourceAttr("splunkconfig_app_package.indexes", "tarball_path", "/tmp/indexes_app-1.0.0.tgz"), resource.TestMatchResourceAttr("splunkconfig_app_package.indexes", "files.0.content", regexp.MustCompile("version = 1.0.0")), resource.TestCheckResourceAttr("splunkconfig_app_package.indexes", "files.0.path", "default/app.conf"), resource.TestCheckResourceAttr("splunkconfig_app_package.indexes", "files.1.path", "default/indexes.conf"), resource.TestMatchResourceAttr("splunkconfig_app_package.indexes", "files.1.content", regexp.MustCompile(`\[original_index]`)), resource.TestCheckResourceAttr("splunkconfig_app_package.indexes", "files.2.path", "default/collections.conf"), resource.TestMatchResourceAttr("splunkconfig_app_package.indexes", "files.2.content", regexp.MustCompile(`\[collection_a]`)), resource.TestMatchResourceAttr("splunkconfig_app_package.indexes", "files.2.content", regexp.MustCompile("field.field_a = string")), ), }, // perform updates that result in a bumped patch count { Config: testAccResourceAppFileConfigPatchIncrease, Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttr("splunkconfig_app_package.indexes", "base_version", "1.0.0"), resource.TestCheckResourceAttr("splunkconfig_app_package.indexes", "effective_version", "1.0.1"), resource.TestCheckResourceAttr("splunkconfig_app_package.indexes", "patch_count", "1"), resource.TestCheckResourceAttr("splunkconfig_app_package.indexes", "tarball_path", "/tmp/indexes_app-1.0.1.tgz"), resource.TestMatchResourceAttr("splunkconfig_app_package.indexes", "files.0.content", regexp.MustCompile("version = 1.0.1")), resource.TestMatchResourceAttr("splunkconfig_app_package.indexes", "files.1.content", regexp.MustCompile("[patch_increase_index]")), ), }, // perform another update that result in a bumped patch count, to ensure the templated version matches the // expected patch count (ie, patch counts aren't cumulative additions) { Config: testAccResourceAppFileConfigPatchIncreaseAgain, Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttr("splunkconfig_app_package.indexes", "base_version", "1.0.0"), resource.TestCheckResourceAttr("splunkconfig_app_package.indexes", "effective_version", "1.0.2"), resource.TestCheckResourceAttr("splunkconfig_app_package.indexes", "patch_count", "2"), resource.TestCheckResourceAttr("splunkconfig_app_package.indexes", "tarball_path", "/tmp/indexes_app-1.0.2.tgz"), resource.TestMatchResourceAttr("splunkconfig_app_package.indexes", "files.0.content", regexp.MustCompile("version = 1.0.2")), resource.TestMatchResourceAttr("splunkconfig_app_package.indexes", "files.1.content", regexp.MustCompile("[patch_increase_again_index]")), ), }, // perform updates that result in a reset patch count { Config: testAccResourceAppFileConfigPatchReset, Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttr("splunkconfig_app_package.indexes", "base_version", "1.1.0"), resource.TestCheckResourceAttr("splunkconfig_app_package.indexes", "effective_version", "1.1.0"), resource.TestCheckResourceAttr("splunkconfig_app_package.indexes", "patch_count", "0"), resource.TestCheckResourceAttr("splunkconfig_app_package.indexes", "tarball_path", "/tmp/indexes_app-1.1.0.tgz"), resource.TestMatchResourceAttr("splunkconfig_app_package.indexes", "files.0.content", regexp.MustCompile("version = 1.1.0")), resource.TestMatchResourceAttr("splunkconfig_app_package.indexes", "files.1.content", regexp.MustCompile("[new_version_index]")), ), }, // perform updates that result in a lowered effective version, which is disallowed { Config: testAccResourceAppFileConfigPatchResetInvalid, ExpectError: regexp.MustCompile("not greater than old effective version"), }, }, }) }
explode_data.jsonl/82442
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1628 }
[ 2830, 3393, 14603, 4783, 2164, 13100, 1155, 353, 8840, 836, 8, 341, 50346, 25159, 2271, 1155, 11, 5101, 31363, 515, 197, 197, 5179, 17417, 2433, 25, 9109, 17417, 2433, 345, 197, 197, 33951, 25, 3056, 9233, 8787, 8304, 515, 298, 197, 3...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestUpgrade(t *testing.T) { yaml := `apiVersion: skaffold/v1alpha5 kind: Config build: artifacts: - image: gcr.io/k8s-skaffold/skaffold-example test: - image: gcr.io/k8s-skaffold/skaffold-example structureTests: - ./test/* deploy: kubectl: manifests: - k8s-* profiles: - name: test profile build: artifacts: - image: gcr.io/k8s-skaffold/skaffold-example test: - image: gcr.io/k8s-skaffold/skaffold-example structureTests: - ./test/* deploy: kubectl: manifests: - k8s-* ` expected := `apiVersion: skaffold/v1beta1 kind: Config build: artifacts: - image: gcr.io/k8s-skaffold/skaffold-example test: - image: gcr.io/k8s-skaffold/skaffold-example structureTests: - ./test/* deploy: kubectl: manifests: - k8s-* profiles: - name: test profile build: artifacts: - image: gcr.io/k8s-skaffold/skaffold-example test: - image: gcr.io/k8s-skaffold/skaffold-example structureTests: - ./test/* deploy: kubectl: manifests: - k8s-* ` verifyUpgrade(t, yaml, expected) }
explode_data.jsonl/71757
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 569 }
[ 2830, 3393, 43861, 1155, 353, 8840, 836, 8, 341, 14522, 9467, 1669, 1565, 2068, 5637, 25, 1901, 2649, 813, 5457, 16, 7141, 20, 198, 15314, 25, 5532, 198, 5834, 510, 220, 35036, 510, 220, 481, 2168, 25, 342, 5082, 4245, 14109, 23, 82...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestData(t *testing.T) { service := compose.EnsureUp(t, "redis") addEntry(t, service.Host(), "foo", 1) ms := mbtest.NewFetcher(t, getConfig(service.Host())) ms.WriteEvents(t, "") }
explode_data.jsonl/53887
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 79 }
[ 2830, 93200, 1155, 353, 8840, 836, 8, 341, 52934, 1669, 30335, 22834, 19098, 2324, 1155, 11, 330, 21748, 5130, 12718, 5874, 1155, 11, 2473, 29840, 1507, 330, 7975, 497, 220, 16, 692, 47691, 1669, 10016, 1944, 7121, 97492, 1155, 11, 6676...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestInvVectWire(t *testing.T) { // Block 203707 hash. hashStr := "3264bc2ac36a60840790ba1d475d01367e7c723da941069e9dc" baseHash, err := chainhash.NewHashFromStr(hashStr) if err != nil { t.Errorf("NewHashFromStr: %v", err) } // errInvVect is an inventory vector with an error. errInvVect := InvVect{ Type: InvTypeError, Hash: chainhash.Hash{}, } // errInvVectEncoded is the wire encoded bytes of errInvVect. errInvVectEncoded := []byte{ 0x00, 0x00, 0x00, 0x00, // InvTypeError 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // No hash } // txInvVect is an inventory vector representing a transaction. txInvVect := InvVect{ Type: InvTypeTx, Hash: *baseHash, } // txInvVectEncoded is the wire encoded bytes of txInvVect. txInvVectEncoded := []byte{ 0x01, 0x00, 0x00, 0x00, // InvTypeTx 0xdc, 0xe9, 0x69, 0x10, 0x94, 0xda, 0x23, 0xc7, 0xe7, 0x67, 0x13, 0xd0, 0x75, 0xd4, 0xa1, 0x0b, 0x79, 0x40, 0x08, 0xa6, 0x36, 0xac, 0xc2, 0x4b, 0x26, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Block 203707 hash } // blockInvVect is an inventory vector representing a block. blockInvVect := InvVect{ Type: InvTypeBlock, Hash: *baseHash, } // blockInvVectEncoded is the wire encoded bytes of blockInvVect. blockInvVectEncoded := []byte{ 0x02, 0x00, 0x00, 0x00, // InvTypeBlock 0xdc, 0xe9, 0x69, 0x10, 0x94, 0xda, 0x23, 0xc7, 0xe7, 0x67, 0x13, 0xd0, 0x75, 0xd4, 0xa1, 0x0b, 0x79, 0x40, 0x08, 0xa6, 0x36, 0xac, 0xc2, 0x4b, 0x26, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Block 203707 hash } tests := []struct { in InvVect // NetAddress to encode out InvVect // Expected decoded NetAddress buf []byte // Wire encoding pver uint32 // Protocol version for wire encoding }{ // Latest protocol version error inventory vector. { errInvVect, errInvVect, errInvVectEncoded, ProtocolVersion, }, // Latest protocol version tx inventory vector. { txInvVect, txInvVect, txInvVectEncoded, ProtocolVersion, }, // Latest protocol version block inventory vector. { blockInvVect, blockInvVect, blockInvVectEncoded, ProtocolVersion, }, // Protocol version BIP0035Version error inventory vector. { errInvVect, errInvVect, errInvVectEncoded, BIP0035Version, }, // Protocol version BIP0035Version tx inventory vector. { txInvVect, txInvVect, txInvVectEncoded, BIP0035Version, }, // Protocol version BIP0035Version block inventory vector. { blockInvVect, blockInvVect, blockInvVectEncoded, BIP0035Version, }, // Protocol version BIP0031Version error inventory vector. { errInvVect, errInvVect, errInvVectEncoded, BIP0031Version, }, // Protocol version BIP0031Version tx inventory vector. { txInvVect, txInvVect, txInvVectEncoded, BIP0031Version, }, // Protocol version BIP0031Version block inventory vector. { blockInvVect, blockInvVect, blockInvVectEncoded, BIP0031Version, }, // Protocol version NetAddressTimeVersion error inventory vector. { errInvVect, errInvVect, errInvVectEncoded, NetAddressTimeVersion, }, // Protocol version NetAddressTimeVersion tx inventory vector. { txInvVect, txInvVect, txInvVectEncoded, NetAddressTimeVersion, }, // Protocol version NetAddressTimeVersion block inventory vector. { blockInvVect, blockInvVect, blockInvVectEncoded, NetAddressTimeVersion, }, // Protocol version MultipleAddressVersion error inventory vector. { errInvVect, errInvVect, errInvVectEncoded, MultipleAddressVersion, }, // Protocol version MultipleAddressVersion tx inventory vector. { txInvVect, txInvVect, txInvVectEncoded, MultipleAddressVersion, }, // Protocol version MultipleAddressVersion block inventory vector. { blockInvVect, blockInvVect, blockInvVectEncoded, MultipleAddressVersion, }, } t.Logf("Running %d tests", len(tests)) for i, test := range tests { // Encode to wire format. var buf bytes.Buffer err := writeInvVect(&buf, test.pver, &test.in) if err != nil { t.Errorf("writeInvVect #%d error %v", i, err) continue } if !bytes.Equal(buf.Bytes(), test.buf) { t.Errorf("writeInvVect #%d\n got: %s want: %s", i, spew.Sdump(buf.Bytes()), spew.Sdump(test.buf)) continue } // Decode the message from wire format. var iv InvVect rbuf := bytes.NewReader(test.buf) err = readInvVect(rbuf, test.pver, &iv) if err != nil { t.Errorf("readInvVect #%d error %v", i, err) continue } if !reflect.DeepEqual(iv, test.out) { t.Errorf("readInvVect #%d\n got: %s want: %s", i, spew.Sdump(iv), spew.Sdump(test.out)) continue } } }
explode_data.jsonl/6595
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 2185 }
[ 2830, 3393, 15174, 92801, 37845, 1155, 353, 8840, 836, 8, 341, 197, 322, 8362, 220, 17, 15, 18, 22, 15, 22, 5175, 624, 50333, 2580, 1669, 330, 18, 17, 21, 19, 8904, 17, 580, 18, 21, 64, 21, 15, 23, 19, 15, 22, 24, 15, 4645, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 Test_PromReporter_OnNewLongestChain(t *testing.T) { t.Run("with nothing in the database", func(t *testing.T) { d := pgtest.NewSqlDB(t) backend := new(mocks.PrometheusBackend) backend.Test(t) reporter := services.NewPromReporter(d, backend, 10*time.Millisecond) var subscribeCalls atomic.Int32 backend.On("SetUnconfirmedTransactions", big.NewInt(0), int64(0)).Return() backend.On("SetMaxUnconfirmedAge", big.NewInt(0), float64(0)).Return() backend.On("SetMaxUnconfirmedBlocks", big.NewInt(0), int64(0)).Return() backend.On("SetPipelineTaskRunsQueued", 0).Return() backend.On("SetPipelineRunsQueued", 0). Run(func(args mock.Arguments) { subscribeCalls.Inc() }). Return() reporter.Start() defer reporter.Close() head := newHead() reporter.OnNewLongestChain(context.Background(), head) require.Eventually(t, func() bool { return subscribeCalls.Load() >= 1 }, 12*time.Second, 100*time.Millisecond) backend.AssertExpectations(t) }) t.Run("with unconfirmed eth_txes", func(t *testing.T) { db := pgtest.NewGormDB(t) ethKeyStore := cltest.NewKeyStore(t, db).Eth() _, fromAddress := cltest.MustAddRandomKeyToKeystore(t, ethKeyStore) var subscribeCalls atomic.Int32 backend := new(mocks.PrometheusBackend) backend.Test(t) backend.On("SetUnconfirmedTransactions", big.NewInt(0), int64(3)).Return() backend.On("SetMaxUnconfirmedAge", big.NewInt(0), mock.MatchedBy(func(s float64) bool { return s > 0 })).Return() backend.On("SetMaxUnconfirmedBlocks", big.NewInt(0), int64(35)).Return() backend.On("SetPipelineTaskRunsQueued", 0).Return() backend.On("SetPipelineRunsQueued", 0). Run(func(args mock.Arguments) { subscribeCalls.Inc() }). Return() d, _ := db.DB() reporter := services.NewPromReporter(d, backend, 10*time.Millisecond) reporter.Start() defer reporter.Close() etx := cltest.MustInsertUnconfirmedEthTxWithBroadcastLegacyAttempt(t, db, 0, fromAddress) cltest.MustInsertUnconfirmedEthTxWithBroadcastLegacyAttempt(t, db, 1, fromAddress) cltest.MustInsertUnconfirmedEthTxWithBroadcastLegacyAttempt(t, db, 2, fromAddress) require.NoError(t, db.Exec(`UPDATE eth_tx_attempts SET broadcast_before_block_num = 7 WHERE eth_tx_id = ?`, etx.ID).Error) head := newHead() reporter.OnNewLongestChain(context.Background(), head) require.Eventually(t, func() bool { return subscribeCalls.Load() >= 1 }, 12*time.Second, 100*time.Millisecond) backend.AssertExpectations(t) }) t.Run("with unfinished pipeline task runs", func(t *testing.T) { db := pgtest.NewGormDB(t) d, _ := db.DB() _, err := d.Exec(`SET CONSTRAINTS pipeline_task_runs_pipeline_run_id_fkey DEFERRED`) require.NoError(t, err) backend := new(mocks.PrometheusBackend) backend.Test(t) reporter := services.NewPromReporter(d, backend, 10*time.Millisecond) cltest.MustInsertUnfinishedPipelineTaskRun(t, db, 1) cltest.MustInsertUnfinishedPipelineTaskRun(t, db, 1) cltest.MustInsertUnfinishedPipelineTaskRun(t, db, 2) var subscribeCalls atomic.Int32 backend.On("SetUnconfirmedTransactions", big.NewInt(0), int64(0)).Return() backend.On("SetMaxUnconfirmedAge", big.NewInt(0), float64(0)).Return() backend.On("SetMaxUnconfirmedBlocks", big.NewInt(0), int64(0)).Return() backend.On("SetPipelineTaskRunsQueued", 3).Return() backend.On("SetPipelineRunsQueued", 2). Run(func(args mock.Arguments) { subscribeCalls.Inc() }). Return() reporter.Start() defer reporter.Close() head := newHead() reporter.OnNewLongestChain(context.Background(), head) require.Eventually(t, func() bool { return subscribeCalls.Load() >= 1 }, 12*time.Second, 100*time.Millisecond) backend.AssertExpectations(t) }) }
explode_data.jsonl/42273
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1443 }
[ 2830, 3393, 1088, 441, 52766, 35482, 3564, 6583, 477, 18837, 1155, 353, 8840, 836, 8, 341, 3244, 16708, 445, 4197, 4302, 304, 279, 4625, 497, 2915, 1155, 353, 8840, 836, 8, 341, 197, 2698, 1669, 17495, 1944, 7121, 8269, 3506, 1155, 69...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestAddVolumePublication(t *testing.T) { mockCtrl := gomock.NewController(t) // Create a mocked persistent store client mockStoreClient := mockpersistentstore.NewMockStoreClient(mockCtrl) // Set the store client behavior we don't care about for this testcase mockStoreClient.EXPECT().GetVolumeTransactions(gomock.Any()).Return([]*storage.VolumeTransaction{}, nil).AnyTimes() // Create a fake VolumePublication fakePub := &utils.VolumePublication{ Name: "foo/bar", NodeName: "bar", VolumeName: "foo", ReadOnly: true, AccessMode: 1, } // Verify that the core calls the store client with the correct object, returning success mockStoreClient.EXPECT().AddVolumePublication(gomock.Any(), fakePub).Return(nil) // Create an instance of the orchestrator for this test orchestrator := getOrchestrator(t) // Add the mocked objects to the orchestrator orchestrator.storeClient = mockStoreClient err := orchestrator.AddVolumePublication(context.Background(), fakePub) assert.Nilf(t, err, fmt.Sprintf("unexpected error adding volume publication: %v", err)) assert.Contains(t, orchestrator.volumePublications, fakePub.VolumeName, "volume publication missing from orchestrator's cache") assert.Contains(t, orchestrator.volumePublications[fakePub.VolumeName], fakePub.NodeName, "volume publication missing from orchestrator's cache") assert.Equal(t, fakePub, orchestrator.volumePublications[fakePub.VolumeName][fakePub.NodeName], "volume publication was not correctly added") }
explode_data.jsonl/62739
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 456 }
[ 2830, 3393, 2212, 18902, 72390, 1155, 353, 8840, 836, 8, 341, 77333, 15001, 1669, 342, 316, 1176, 7121, 2051, 1155, 340, 197, 322, 4230, 264, 46149, 24999, 3553, 2943, 198, 77333, 6093, 2959, 1669, 7860, 69389, 4314, 7121, 11571, 6093, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestApiTest_AddsJSONBodyToRequest(t *testing.T) { handler := http.NewServeMux() handler.HandleFunc("/hello", func(w http.ResponseWriter, r *http.Request) { data, _ := ioutil.ReadAll(r.Body) if string(data) != `{"a": 12345}` { w.WriteHeader(http.StatusInternalServerError) return } if r.Header.Get("Content-Type") != "application/json" { w.WriteHeader(http.StatusBadRequest) return } w.WriteHeader(http.StatusOK) }) apitest.Handler(handler). Post("/hello"). Body(`{"a": 12345}`). Header("Content-Type", "application/json"). Expect(t). Status(http.StatusOK). End() }
explode_data.jsonl/54781
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 250 }
[ 2830, 3393, 6563, 2271, 21346, 82, 5370, 5444, 1249, 1900, 1155, 353, 8840, 836, 8, 341, 53326, 1669, 1758, 7121, 60421, 44, 2200, 741, 53326, 63623, 4283, 14990, 497, 2915, 3622, 1758, 37508, 11, 435, 353, 1254, 9659, 8, 341, 197, 89...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestGitGetter_branchUpdate(t *testing.T) { if !testHasGit { t.Log("git not found, skipping") t.Skip() } g := new(GitGetter) dst := tempDir(t) // First setup the state with a fresh branch repo := testGitRepo(t, "branch-update") repo.git("checkout", "-b", "test-branch") repo.commitFile("branch.txt", "branch") // Get the "test-branch" branch q := repo.url.Query() q.Add("ref", "test-branch") repo.url.RawQuery = q.Encode() if err := g.Get(dst, repo.url); err != nil { t.Fatalf("err: %s", err) } // Verify the main file exists mainPath := filepath.Join(dst, "branch.txt") if _, err := os.Stat(mainPath); err != nil { t.Fatalf("err: %s", err) } // Commit an update to the branch repo.commitFile("branch-update.txt", "branch-update") // Get again should work if err := g.Get(dst, repo.url); err != nil { t.Fatalf("err: %s", err) } // Verify the main file exists mainPath = filepath.Join(dst, "branch-update.txt") if _, err := os.Stat(mainPath); err != nil { t.Fatalf("err: %s", err) } }
explode_data.jsonl/39695
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 431 }
[ 2830, 3393, 46562, 31485, 28031, 4289, 1155, 353, 8840, 836, 8, 341, 743, 753, 1944, 10281, 46562, 341, 197, 3244, 5247, 445, 12882, 537, 1730, 11, 42659, 1138, 197, 3244, 57776, 741, 197, 630, 3174, 1669, 501, 6699, 275, 31485, 340, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestGetNodeValue(t *testing.T) { testCase := []struct { nodeType string nodeValue string err bool }{{ nodeType: "proto", nodeValue: "tcp", err: false, }, { nodeType: "src", nodeValue: "192.168.0.1", err: false, }, { nodeType: "src", nodeValue: "192.168.a", err: true, }, { nodeType: "sport", nodeValue: "192", err: false, }, { nodeType: "sport", nodeValue: "a", err: true, }, { nodeType: "dst", nodeValue: "192.168.0.1", err: false, }, { nodeType: "dst", nodeValue: "192.168.a", err: true, }, { nodeType: "dport", nodeValue: "192", err: false, }, { nodeType: "dport", nodeValue: "a", err: true, }, { nodeType: "id", nodeValue: "a", err: false, }, { nodeType: "noexist", nodeValue: "a", err: true, }} for idx, tc := range testCase { _, err := GetNodeValue(tc.nodeType, tc.nodeValue) if tc.err && err == nil { t.Errorf("[%d] Expecting error when creating node type %s with value %s, but no error found", idx, tc.nodeType, tc.nodeValue) } if !tc.err && err != nil { t.Errorf("[%d] Expecting no error when creating node type %s with value %s, but an error found", idx, tc.nodeType, tc.nodeValue) continue } } _, err := GetNodeValue("proto", 1) if err == nil { t.Errorf("Expecting error when creating node type proto with value 1, but no error found") } }
explode_data.jsonl/6710
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 691 }
[ 2830, 3393, 1949, 1955, 1130, 1155, 353, 8840, 836, 8, 341, 18185, 4207, 1669, 3056, 1235, 341, 197, 20831, 929, 220, 914, 198, 197, 20831, 1130, 914, 198, 197, 9859, 981, 1807, 198, 197, 15170, 515, 197, 20831, 929, 25, 220, 330, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
7
func TestKVStoreClientFactoryConfigValidation(t *testing.T) { testCases := []struct { config loadtest.Config err bool }{ {loadtest.Config{Size: 1, Rate: 1000, Time: 1000, Count: -1}, true}, // invalid tx size {loadtest.Config{Size: 10, Rate: 1000, Time: 1000, Count: -1}, true}, // tx size is too small {loadtest.Config{Size: 14, Rate: 1000, Time: 10000, Count: -1}, false}, // just right for parameters {loadtest.Config{Size: 20, Rate: 1000, Time: 10, Count: -1}, false}, // 10k txs @ 20 bytes each {loadtest.Config{Size: 20, Rate: 1000, Time: 100, Count: -1}, false}, // 100k txs @ 20 bytes each {loadtest.Config{Size: 20, Rate: 1000, Time: 1000, Count: -1}, false}, // 1m txs @ 20 bytes each {loadtest.Config{Size: 100, Rate: 1000, Time: 10, Count: -1}, false}, {loadtest.Config{Size: 100, Rate: 1000, Time: 100000, Count: -1}, false}, // 100m txs @ 100 bytes each {loadtest.Config{Size: 250, Rate: 1000, Time: 10, Count: -1}, false}, {loadtest.Config{Size: 10240, Rate: 1000, Time: 10, Count: -1}, false}, // 10k txs @ 10kB each {loadtest.Config{Size: 10240, Rate: 1000, Time: 100, Count: -1}, false}, // 100k txs @ 10kB each {loadtest.Config{Size: 10240, Rate: 1000, Time: 1000, Count: -1}, false}, // 1m txs @ 10kB each {loadtest.Config{Size: 10240, Rate: 1000, Time: 10000, Count: -1}, false}, // 10m txs @ 10kB each {loadtest.Config{Size: 10240, Rate: 1000, Time: 100000, Count: -1}, false}, // 100m txs @ 10kB each } factory := loadtest.NewKVStoreClientFactory() for i, tc := range testCases { err := factory.ValidateConfig(tc.config) // if we were supposed to get an error if tc.err && err == nil { t.Errorf("Expected an error from test case %d, but got nil", i) } else if !tc.err && err != nil { t.Errorf("Expected no error from test case %d, but got: %v", i, err) } } }
explode_data.jsonl/31449
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 702 }
[ 2830, 3393, 82707, 6093, 2959, 4153, 2648, 13799, 1155, 353, 8840, 836, 8, 341, 18185, 37302, 1669, 3056, 1235, 341, 197, 25873, 2795, 1944, 10753, 198, 197, 9859, 262, 1807, 198, 197, 59403, 197, 197, 90, 1078, 1944, 10753, 90, 1695, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestOOPMetric(t *testing.T) { if err := applyMixerRule(oopPromConfigs); err != nil { fatalf(t, "could not apply required out of process configs: %v", err) } defer func() { if err := deleteMixerRule(oopPromConfigs); err != nil { t.Logf("could not clear out of process config: %v", err) } }() allowRuleSync() checkMetricReport(t, "istio_request_count_oop", destLabel, fqdn("productpage")) }
explode_data.jsonl/81433
{ "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, 46, 3067, 54310, 1155, 353, 8840, 836, 8, 341, 743, 1848, 1669, 3796, 44, 39014, 11337, 10108, 453, 35186, 84905, 1215, 1848, 961, 2092, 341, 197, 1166, 266, 3104, 1155, 11, 330, 28077, 537, 3796, 2567, 700, 315, 1882, 423...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestBadConnectStatus(t *testing.T) { l, err := net.Listen("tcp", "localhost:0") if err != nil { t.Fatalf("Unable to listen: %s", err) } hs := &http.Server{ Handler: http.HandlerFunc(func(resp http.ResponseWriter, req *http.Request) { resp.WriteHeader(403) // forbidden }), } go func() { if err := hs.Serve(l); err != nil { t.Fatalf("Unable to serve: %v", err) } }() dialer := NewDialer(Config{ DialServer: func() (net.Conn, error) { return net.DialTimeout("tcp", l.Addr().String(), 2*time.Second) }, }) _, err = dialer.Dial("connect", "www.google.com") assert.Error(t, err, "Dialing a server that sends a non-successful HTTP status to our CONNECT request should have failed") }
explode_data.jsonl/15725
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 280 }
[ 2830, 3393, 17082, 14611, 2522, 1155, 353, 8840, 836, 8, 341, 8810, 11, 1848, 1669, 4179, 68334, 445, 27161, 497, 330, 8301, 25, 15, 1138, 743, 1848, 961, 2092, 341, 197, 3244, 30762, 445, 17075, 311, 8844, 25, 1018, 82, 497, 1848, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestSegSelector(t *testing.T) { tests := map[string]struct { PrepareMocks func(db *mock_pathdb.MockPathDB, c *mock_revcache.MockRevCache) []*seg.PathSegment ErrorAssertion require.ErrorAssertionFunc }{ "PathDB error": { PrepareMocks: func(db *mock_pathdb.MockPathDB, c *mock_revcache.MockRevCache) []*seg.PathSegment { db.EXPECT().Get(gomock.Any(), gomock.Any()).Return(nil, errors.New("test err")) return nil }, ErrorAssertion: require.Error, }, "RevCacheError": { PrepareMocks: func(db *mock_pathdb.MockPathDB, c *mock_revcache.MockRevCache) []*seg.PathSegment { results := query.Results{ &query.Result{Seg: &seg.PathSegment{}}, } db.EXPECT().Get(gomock.Any(), gomock.Any()).Return(results, nil) c.EXPECT().Get(gomock.Any(), gomock.Any()).Return(nil, errors.New("test err")) return nil }, ErrorAssertion: require.Error, }, "No segments": { PrepareMocks: func(db *mock_pathdb.MockPathDB, c *mock_revcache.MockRevCache) []*seg.PathSegment { db.EXPECT().Get(gomock.Any(), gomock.Any()).Return(nil, nil) return nil }, ErrorAssertion: require.Error, }, "Segments": { PrepareMocks: func(db *mock_pathdb.MockPathDB, c *mock_revcache.MockRevCache) []*seg.PathSegment { seg1 := &seg.PathSegment{RawSData: []byte{1}} seg2 := &seg.PathSegment{RawSData: []byte{2}} seg3 := &seg.PathSegment{RawSData: []byte{3}} results := query.Results{ &query.Result{Seg: seg1}, &query.Result{Seg: seg2}, &query.Result{Seg: seg3}, } db.EXPECT().Get(gomock.Any(), gomock.Any()).Return(results, nil) r1 := c.EXPECT().Get(gomock.Any(), gomock.Any()).Return(nil, nil) r2 := c.EXPECT().Get(gomock.Any(), gomock.Any()).Return(nil, nil).After(r1) c.EXPECT().Get(gomock.Any(), gomock.Any()).Return( revcache.Revocations{revcache.Key{}: &path_mgmt.SignedRevInfo{}}, nil).After(r2) return []*seg.PathSegment{seg1, seg2} }, ErrorAssertion: require.NoError, }, } for name, test := range tests { t.Run(name, func(t *testing.T) { ctrl := gomock.NewController(t) defer ctrl.Finish() db := mock_pathdb.NewMockPathDB(ctrl) c := mock_revcache.NewMockRevCache(ctrl) possibleSegs := test.PrepareMocks(db, c) s := segreq.SegSelector{ PathDB: db, RevCache: c, } seg, err := s.SelectSeg(context.Background(), &query.Params{}) test.ErrorAssertion(t, err) if len(possibleSegs) > 0 { assert.Contains(t, possibleSegs, seg) } }) } }
explode_data.jsonl/54718
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1184 }
[ 2830, 3393, 10998, 5877, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 2415, 14032, 60, 1235, 341, 197, 197, 50590, 72577, 2915, 9791, 353, 16712, 2638, 1999, 24664, 1820, 3506, 345, 298, 1444, 353, 16712, 1288, 7362, 1777, 24664, 36184, 8...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestRetriesNewOtherType_Is(t *testing.T) { err := NewRetriesResult(NewResult(404, "this is an example error, %s", "yep"), 0, time.Now(), nil) if protocol.ResultIs(err, NewResult(200, "OK")) { t.Error("Expected error to be a [Normal, ExampleStatusFailed], filtered by eventtype failed") } }
explode_data.jsonl/66497
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 104 }
[ 2830, 3393, 12020, 4019, 3564, 11409, 929, 31879, 1155, 353, 8840, 836, 8, 341, 9859, 1669, 1532, 12020, 4019, 2077, 35063, 2077, 7, 19, 15, 19, 11, 330, 574, 374, 458, 3110, 1465, 11, 1018, 82, 497, 330, 88, 747, 3975, 220, 15, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestMDServerBasics(t *testing.T) { // setup ctx := context.Background() config := MakeTestConfigOrBust(t, "test_user") defer config.Shutdown(ctx) mdServer := config.MDServer() session, err := config.KBPKI().GetCurrentSession(ctx) require.NoError(t, err) uid := session.UID // (1) get metadata -- allocates an ID h, err := tlf.MakeHandle( []keybase1.UserOrTeamID{uid.AsUserOrTeam()}, nil, nil, nil, nil) require.NoError(t, err) id, rmds, err := mdServer.GetForHandle(ctx, h, kbfsmd.Merged, nil) require.NoError(t, err) require.Nil(t, rmds) // (2) push some new metadata blocks prevRoot := kbfsmd.ID{} middleRoot := kbfsmd.ID{} for i := kbfsmd.Revision(1); i <= 10; i++ { brmd := makeBRMDForTest(t, config.Codec(), id, h, i, uid, prevRoot) rmds := signRMDSForTest(t, config.Codec(), config.Crypto(), brmd) // MDv3 TODO: pass actual key bundles err = mdServer.Put(ctx, rmds, nil, nil, keybase1.MDPriorityNormal) require.NoError(t, err) prevRoot, err = kbfsmd.MakeID(config.Codec(), rmds.MD) require.NoError(t, err) if i == 5 { middleRoot = prevRoot } } // (3) trigger a conflict brmd := makeBRMDForTest(t, config.Codec(), id, h, 10, uid, prevRoot) rmds = signRMDSForTest(t, config.Codec(), config.Crypto(), brmd) // MDv3 TODO: pass actual key bundles err = mdServer.Put(ctx, rmds, nil, nil, keybase1.MDPriorityNormal) require.IsType(t, kbfsmd.ServerErrorConflictRevision{}, err) // (4) push some new unmerged metadata blocks linking to the // middle merged block. prevRoot = middleRoot bid, err := config.Crypto().MakeRandomBranchID() require.NoError(t, err) for i := kbfsmd.Revision(6); i < 41; i++ { brmd := makeBRMDForTest(t, config.Codec(), id, h, i, uid, prevRoot) brmd.SetUnmerged() brmd.SetBranchID(bid) rmds := signRMDSForTest(t, config.Codec(), config.Crypto(), brmd) // MDv3 TODO: pass actual key bundles err = mdServer.Put(ctx, rmds, nil, nil, keybase1.MDPriorityNormal) require.NoError(t, err) prevRoot, err = kbfsmd.MakeID(config.Codec(), rmds.MD) require.NoError(t, err) } // (5) check for proper unmerged head head, err := mdServer.GetForTLF(ctx, id, bid, kbfsmd.Unmerged, nil) require.NoError(t, err) require.NotNil(t, head) require.Equal(t, kbfsmd.Revision(40), head.MD.RevisionNumber()) // (6a) try to get unmerged range rmdses, err := mdServer.GetRange(ctx, id, bid, kbfsmd.Unmerged, 1, 100, nil) require.NoError(t, err) require.Equal(t, 35, len(rmdses)) for i := kbfsmd.Revision(6); i < 41; i++ { require.Equal(t, i, rmdses[i-6].MD.RevisionNumber()) } // (6b) try to get unmerged range subset. rmdses, err = mdServer.GetRange(ctx, id, bid, kbfsmd.Unmerged, 7, 14, nil) require.NoError(t, err) require.Equal(t, 8, len(rmdses)) for i := kbfsmd.Revision(7); i <= 14; i++ { require.Equal(t, i, rmdses[i-7].MD.RevisionNumber()) } // (7) prune unmerged err = mdServer.PruneBranch(ctx, id, bid) require.NoError(t, err) // (8) verify head is pruned head, err = mdServer.GetForTLF(ctx, id, kbfsmd.NullBranchID, kbfsmd.Unmerged, nil) require.NoError(t, err) require.Nil(t, head) // (9) verify revision history is pruned rmdses, err = mdServer.GetRange(ctx, id, kbfsmd.NullBranchID, kbfsmd.Unmerged, 1, 100, nil) require.NoError(t, err) require.Equal(t, 0, len(rmdses)) // (10) check for proper merged head head, err = mdServer.GetForTLF(ctx, id, kbfsmd.NullBranchID, kbfsmd.Merged, nil) require.NoError(t, err) require.NotNil(t, head) require.Equal(t, kbfsmd.Revision(10), head.MD.RevisionNumber()) // (11) try to get merged range rmdses, err = mdServer.GetRange(ctx, id, kbfsmd.NullBranchID, kbfsmd.Merged, 1, 100, nil) require.NoError(t, err) require.Equal(t, 10, len(rmdses)) for i := kbfsmd.Revision(1); i <= 10; i++ { require.Equal(t, i, rmdses[i-1].MD.RevisionNumber()) } }
explode_data.jsonl/82296
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1638 }
[ 2830, 3393, 6076, 5475, 33603, 1211, 1155, 353, 8840, 836, 8, 341, 197, 322, 6505, 198, 20985, 1669, 2266, 19047, 741, 25873, 1669, 7405, 2271, 2648, 2195, 33, 590, 1155, 11, 330, 1944, 3317, 1138, 16867, 2193, 10849, 18452, 7502, 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 TestSetBaseURL(t *testing.T) { ts1 := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { _, _ = fmt.Fprintln(w, "ts1"+r.URL.Path) })) defer ts1.Close() ts2 := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { _, _ = fmt.Fprintln(w, "ts2"+r.URL.Path) })) defer ts2.Close() client := New(Config{ BaseURL: ts1.URL, }) cancel, resp, err := client.LifecycleR().Get("/foo") defer cancel() require.Nil(t, err) require.NotNil(t, resp) require.Equal(t, http.StatusOK, resp.StatusCode()) require.Equal(t, "ts1/foo", resp.String()) cancel, resp, err = client.LifecycleR().Get(ts2.URL) // BaseURL can be overwritten defer cancel() require.Nil(t, err) require.NotNil(t, resp) require.Equal(t, http.StatusOK, resp.StatusCode()) require.Equal(t, "ts2/", resp.String()) }
explode_data.jsonl/7662
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 363 }
[ 2830, 3393, 1649, 3978, 3144, 1155, 353, 8840, 836, 8, 341, 57441, 16, 1669, 54320, 70334, 7121, 5475, 19886, 89164, 18552, 3622, 1758, 37508, 11, 435, 353, 1254, 9659, 8, 341, 197, 197, 6878, 716, 284, 8879, 991, 33655, 3622, 11, 330...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestCacheKVStoreNoNilSet(t *testing.T) { mem := dbadapter.Store{DB: dbm.NewMemDB()} st := cachekv.NewStore(mem) require.Panics(t, func() { st.Set([]byte("key"), nil) }, "setting a nil value should panic") require.Panics(t, func() { st.Set(nil, []byte("value")) }, "setting a nil key should panic") require.Panics(t, func() { st.Set([]byte(""), []byte("value")) }, "setting an empty key should panic") }
explode_data.jsonl/6648
{ "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, 8233, 82707, 6093, 2753, 19064, 1649, 1155, 353, 8840, 836, 8, 341, 14145, 1669, 2927, 19731, 38047, 90, 3506, 25, 2927, 76, 7121, 18816, 3506, 23509, 18388, 1669, 60287, 1225, 85, 7121, 6093, 39908, 340, 17957, 1069, 276, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestExecutePodCommand(t *testing.T) { tests := []struct { name string containerName string expectedContainerName string command []string errorMode v1.HookErrorMode expectedErrorMode v1.HookErrorMode timeout time.Duration expectedTimeout time.Duration hookError error expectedError string }{ { name: "validate defaults", command: []string{"some", "command"}, expectedContainerName: "foo", expectedErrorMode: v1.HookErrorModeFail, expectedTimeout: 30 * time.Second, }, { name: "use specified values", command: []string{"some", "command"}, containerName: "bar", expectedContainerName: "bar", errorMode: v1.HookErrorModeContinue, expectedErrorMode: v1.HookErrorModeContinue, timeout: 10 * time.Second, expectedTimeout: 10 * time.Second, }, { name: "hook error", command: []string{"some", "command"}, expectedContainerName: "foo", expectedErrorMode: v1.HookErrorModeFail, expectedTimeout: 30 * time.Second, hookError: errors.New("hook error"), expectedError: "hook error", }, } for _, test := range tests { t.Run(test.name, func(t *testing.T) { hook := v1.ExecHook{ Container: test.containerName, Command: test.command, OnError: test.errorMode, Timeout: metav1.Duration{Duration: test.timeout}, } pod, err := getAsMap(` { "metadata": { "namespace": "namespace", "name": "name" }, "spec": { "containers": [ {"name": "foo"}, {"name": "bar"} ] } }`) require.NoError(t, err) clientConfig := &rest.Config{} poster := &mockPoster{} defer poster.AssertExpectations(t) podCommandExecutor := NewPodCommandExecutor(clientConfig, poster).(*defaultPodCommandExecutor) streamExecutorFactory := &mockStreamExecutorFactory{} defer streamExecutorFactory.AssertExpectations(t) podCommandExecutor.streamExecutorFactory = streamExecutorFactory baseUrl, _ := url.Parse("https://some.server") contentConfig := rest.ContentConfig{ GroupVersion: &schema.GroupVersion{Group: "", Version: "v1"}, } postRequest := rest.NewRequest(nil, "POST", baseUrl, "/api/v1", contentConfig, rest.Serializers{}, nil, nil) poster.On("Post").Return(postRequest) streamExecutor := &mockStreamExecutor{} defer streamExecutor.AssertExpectations(t) expectedCommand := strings.Join(test.command, "&command=") expectedURL, _ := url.Parse( fmt.Sprintf("https://some.server/api/v1/namespaces/namespace/pods/name/exec?command=%s&container=%s&stderr=true&stdout=true", expectedCommand, test.expectedContainerName), ) streamExecutorFactory.On("NewSPDYExecutor", clientConfig, "POST", expectedURL).Return(streamExecutor, nil) var stdout, stderr bytes.Buffer expectedStreamOptions := remotecommand.StreamOptions{ Stdout: &stdout, Stderr: &stderr, } streamExecutor.On("Stream", expectedStreamOptions).Return(test.hookError) err = podCommandExecutor.executePodCommand(arktest.NewLogger(), pod, "namespace", "name", "hookName", &hook) if test.expectedError != "" { assert.EqualError(t, err, test.expectedError) return } require.NoError(t, err) }) } }
explode_data.jsonl/62115
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1474 }
[ 2830, 3393, 17174, 23527, 4062, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 3056, 1235, 341, 197, 11609, 1698, 914, 198, 197, 53290, 675, 260, 914, 198, 197, 42400, 4502, 675, 914, 198, 197, 45566, 2290, 3056, 917, 198, 197, 18290, 363...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestGroupInt8(t *testing.T) { v := &Value{data: []int8{int8(1), int8(1), int8(1), int8(1), int8(1), int8(1)}} grouped := v.GroupInt8(func(i int, val int8) string { return fmt.Sprintf("%v", i%2 == 0) }).data.(map[string][]int8) assert.Equal(t, 2, len(grouped)) assert.Equal(t, 3, len(grouped["true"])) assert.Equal(t, 3, len(grouped["false"])) }
explode_data.jsonl/23429
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 168 }
[ 2830, 3393, 2808, 1072, 23, 1155, 353, 8840, 836, 8, 1476, 5195, 1669, 609, 1130, 90, 691, 25, 3056, 396, 23, 90, 396, 23, 7, 16, 701, 526, 23, 7, 16, 701, 526, 23, 7, 16, 701, 526, 23, 7, 16, 701, 526, 23, 7, 16, 701, 526...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestX(t *testing.T) { const src = ` package p func _() {} ` _, err := format([]byte(src), 0) if err != nil { t.Error(err) } }
explode_data.jsonl/64606
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 63 }
[ 2830, 3393, 55, 1155, 353, 8840, 836, 8, 341, 4777, 2286, 284, 22074, 1722, 281, 198, 2830, 716, 368, 5613, 3989, 197, 6878, 1848, 1669, 3561, 10556, 3782, 14705, 701, 220, 15, 340, 743, 1848, 961, 2092, 341, 197, 3244, 6141, 3964, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_newCompactionPlanHandler(t *testing.T) { type args struct { sessions *SessionManager cm *ChannelManager meta *meta allocator allocator flush chan UniqueID } tests := []struct { name string args args want *compactionPlanHandler }{ { "test new handler", args{ &SessionManager{}, &ChannelManager{}, &meta{}, newMockAllocator(), nil, }, &compactionPlanHandler{ plans: map[int64]*compactionTask{}, sessions: &SessionManager{}, chManager: &ChannelManager{}, meta: &meta{}, allocator: newMockAllocator(), flushCh: nil, }, }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { got := newCompactionPlanHandler(tt.args.sessions, tt.args.cm, tt.args.meta, tt.args.allocator, tt.args.flush) assert.EqualValues(t, tt.want, got) }) } }
explode_data.jsonl/9514
{ "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, 5921, 13552, 1311, 20485, 3050, 1155, 353, 8840, 836, 8, 341, 13158, 2827, 2036, 341, 197, 1903, 8551, 220, 353, 5283, 2043, 198, 197, 98316, 286, 353, 9629, 2043, 198, 197, 84004, 414, 353, 5490, 198, 197, 197, 57631, 436...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestCheckIssueWithSig(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 := createIssueWithSig(t, 1000) info := defaultCheckerInfo(t) _, err := to.tc.checkIssueWithSig(tx, info) assert.NoError(t, err, "checkIssueWithSig failed with valid issue tx") tx.Timestamp = 0 _, err = to.tc.checkIssueWithSig(tx, info) assert.Error(t, err, "checkIssueWithSig did not fail with invalid timestamp") }
explode_data.jsonl/63078
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 210 }
[ 2830, 3393, 3973, 42006, 2354, 47246, 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, 9738...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestBuildHostNameForCellDependency(t *testing.T) { dependencyInst := "mydep" expected := dependencyInst + "--gateway-service" actual := BuildHostNameForCellDependency(dependencyInst) if diff := cmp.Diff(expected, actual); diff != "" { t.Errorf("BuildHostNameForCellDependency (-expected, +actual)\n%v", diff) } }
explode_data.jsonl/54865
{ "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, 11066, 85305, 2461, 3599, 36387, 1155, 353, 8840, 836, 8, 341, 197, 53690, 8724, 1669, 330, 2408, 14891, 698, 42400, 1669, 24036, 8724, 488, 14482, 46473, 23461, 698, 88814, 1669, 7854, 85305, 2461, 3599, 36387, 91573, 2251, 8...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestHelmManifestFromChartRepoWithValueFileOutsideRepo(t *testing.T) { service := newService(".") source := &argoappv1.ApplicationSource{ Chart: "my-chart", TargetRevision: ">= 1.0.0", Helm: &argoappv1.ApplicationSourceHelm{ ValueFiles: []string{"../my-chart-2/my-chart-2-values.yaml"}, }, } request := &apiclient.ManifestRequest{Repo: &argoappv1.Repository{}, ApplicationSource: source, NoCache: true} _, err := service.GenerateManifest(context.Background(), request) assert.Error(t, err, "should be on or under current directory") }
explode_data.jsonl/58027
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 209 }
[ 2830, 3393, 39, 23162, 38495, 3830, 14488, 25243, 22767, 1703, 41365, 25243, 1155, 353, 8840, 836, 8, 341, 52934, 1669, 501, 1860, 5680, 1138, 47418, 1669, 609, 12088, 676, 85, 16, 17521, 3608, 515, 197, 197, 14488, 25, 688, 330, 2408, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestUtime(t *testing.T) { defer chtmpdir(t)() touch(t, "file1") buf := &unix.Utimbuf{ Modtime: 12345, } err := unix.Utime("file1", buf) if err != nil { t.Fatalf("Utime: %v", err) } fi, err := os.Stat("file1") if err != nil { t.Fatal(err) } if fi.ModTime().Unix() != 12345 { t.Errorf("Utime: failed to change modtime: expected %v, got %v", 12345, fi.ModTime().Unix()) } }
explode_data.jsonl/35459
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 185 }
[ 2830, 3393, 52, 1678, 1155, 353, 8840, 836, 8, 341, 16867, 272, 426, 1307, 3741, 1155, 8, 2822, 3244, 3026, 1155, 11, 330, 1192, 16, 5130, 26398, 1669, 609, 56646, 5255, 20091, 5909, 515, 197, 197, 4459, 1678, 25, 220, 16, 17, 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...
4
func Test_Kafka_Types(t *testing.T) { var Codec = codec.New() schema.RegisterCodec(Codec) sdkTypes.RegisterCodec(Codec) codec.RegisterCrypto(Codec) codec.RegisterEvidences(Codec) vesting.RegisterCodec(Codec) Codec.Seal() cliContext := context.NewCLIContext().WithCodec(Codec) fromAddress := "cosmos1pkkayn066msg6kn33wnl5srhdt3tnu2vzasz9c" testBaseReq := rest.BaseReq{From: fromAddress, ChainID: "test", Fees: sdkTypes.NewCoins()} testMessage := sdkTypes.NewTestMsg() ticketID := TicketID(random.GenerateID("name")) testKafkaMsg := NewKafkaMsgFromRest(testMessage, ticketID, testBaseReq, cliContext) kafkaCliCtx := kafkaCliCtx{ OutputFormat: cliContext.OutputFormat, ChainID: cliContext.ChainID, Height: cliContext.Height, HomeDir: cliContext.HomeDir, NodeURI: cliContext.NodeURI, From: cliContext.From, TrustNode: cliContext.TrustNode, UseLedger: cliContext.UseLedger, BroadcastMode: cliContext.BroadcastMode, Simulate: cliContext.Simulate, GenerateOnly: cliContext.GenerateOnly, FromAddress: cliContext.FromAddress, FromName: cliContext.FromName, Indent: cliContext.Indent, SkipConfirm: cliContext.SkipConfirm, } require.Equal(t, kafkaMsg{Msg: testMessage, TicketID: ticketID, BaseRequest: testBaseReq, KafkaCliCtx: kafkaCliCtx}, testKafkaMsg) require.Equal(t, cliContext, cliCtxFromKafkaMsg(testKafkaMsg, cliContext)) //require }
explode_data.jsonl/50594
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 622 }
[ 2830, 3393, 10102, 21883, 1139, 1804, 1155, 353, 8840, 836, 8, 1476, 2405, 67077, 284, 34647, 7121, 741, 1903, 3416, 19983, 36913, 7, 36913, 340, 1903, 7584, 4173, 19983, 36913, 7, 36913, 340, 43343, 66, 19983, 58288, 7, 36913, 340, 433...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestSubscriptionPanicOnUndefinedResponseType(t *testing.T) { defer func() { if r := recover(); r != nil { assert.Equal(t, "Undefined response type: 0", r) } }() event := connectionEvent{} event.Bytes() }
explode_data.jsonl/58988
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 83 }
[ 2830, 3393, 33402, 47, 31270, 1925, 30571, 53388, 1155, 353, 8840, 836, 8, 341, 16867, 2915, 368, 341, 197, 743, 435, 1669, 11731, 2129, 435, 961, 2092, 341, 298, 6948, 12808, 1155, 11, 330, 30571, 2033, 943, 25, 220, 15, 497, 435, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestBuildConfigNoOutput(t *testing.T) { url, err := url.Parse("https://github.com/openshift/origin.git") if err != nil { t.Fatalf("unexpected error: %v", err) } source := &SourceRef{URL: url} build := &BuildRef{Source: source} config, err := build.BuildConfig() if err != nil { t.Fatalf("unexpected error: %v", err) } if config.Name != "origin" { t.Errorf("unexpected name: %#v", config) } if !reflect.DeepEqual(config.Parameters.Output, buildapi.BuildOutput{}) { t.Errorf("unexpected build output: %#v", config.Parameters.Output) } }
explode_data.jsonl/23738
{ "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, 11066, 2648, 2753, 5097, 1155, 353, 8840, 836, 8, 341, 19320, 11, 1848, 1669, 2515, 8937, 445, 2428, 1110, 5204, 905, 14, 24175, 47833, 14, 8611, 32799, 1138, 743, 1848, 961, 2092, 341, 197, 3244, 30762, 445, 53859, 1465, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestUpdateAgent_Http_NormalUserExistWithName(t *testing.T) { tc := testutils.Setup(t) testutils.LoadFixtures(t, tc.FixturePath()) // user with agent:create scope user, accessToken, err := tc.UserWithScopes("foo", "agent:create") assert.Equal(t, user.GithubLogin, "foo") assert.NoError(t, err) // Mocks the time jwt.TimeFunc = testutils.Now data := []byte(`{"name": "foo","scopes": ["catalog:refresh"]}`) UpdateAgentChecker(tc).Test(t, http.MethodPut, "/system/user/agent"). WithHeader("Authorization", accessToken).WithBody(data). Check(). HasStatus(400).Cb(func(r *http.Response) { b, readErr := ioutil.ReadAll(r.Body) assert.NoError(t, readErr) defer r.Body.Close() err := goa.ServiceError{} marshallErr := json.Unmarshal([]byte(b), &err) assert.NoError(t, marshallErr) assert.Equal(t, "user exists with name: foo", err.Message) }) }
explode_data.jsonl/9417
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 347 }
[ 2830, 3393, 4289, 16810, 2039, 1209, 74900, 1474, 25613, 54523, 1155, 353, 8840, 836, 8, 341, 78255, 1669, 1273, 6031, 39820, 1155, 340, 18185, 6031, 13969, 25958, 18513, 1155, 11, 17130, 991, 12735, 1820, 12367, 197, 322, 1196, 448, 8315...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestSetWithScalars(t *testing.T) { assertParseOneTerm(t, "number", "{1,2,3,4.5}", SetTerm(IntNumberTerm(1), IntNumberTerm(2), IntNumberTerm(3), FloatNumberTerm(4.5))) assertParseOneTerm(t, "bool", "{true, false, true}", SetTerm(BooleanTerm(true), BooleanTerm(false), BooleanTerm(true))) assertParseOneTerm(t, "string", "{\"foo\", \"bar\"}", SetTerm(StringTerm("foo"), StringTerm("bar"))) assertParseOneTerm(t, "mixed", "{null, true, 42}", SetTerm(NullTerm(), BooleanTerm(true), IntNumberTerm(42))) assertParseOneTerm(t, "trailing comma", "{null, true,}", SetTerm(NullTerm(), BooleanTerm(true))) assertParseOneTerm(t, "leading comma", "{, null, true}", SetTerm(NullTerm(), BooleanTerm(true))) assertParseOneTerm(t, "leading comma not comprehension", "{, 1 | 1}", SetTerm(CallTerm(RefTerm(VarTerm("or")), NumberTerm("1"), NumberTerm("1")))) assertParseOneTerm(t, "ambiguous or", "{ 1 + 2 | 3}", SetTerm(CallTerm(RefTerm(VarTerm("or")), CallTerm(RefTerm(VarTerm("plus")), NumberTerm("1"), NumberTerm("2")), NumberTerm("3")))) }
explode_data.jsonl/50459
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 367 }
[ 2830, 3393, 1649, 2354, 54005, 1155, 353, 8840, 836, 8, 341, 6948, 14463, 3966, 17249, 1155, 11, 330, 4082, 497, 13868, 16, 11, 17, 11, 18, 11, 19, 13, 20, 9545, 2573, 17249, 24123, 2833, 17249, 7, 16, 701, 1333, 2833, 17249, 7, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func Test_AddPodToVolume_Positive_ExistingVolumeNewNode(t *testing.T) { // Arrange volumePluginMgr, plugin := volumetesting.GetTestVolumePluginMgr(t) asw := NewActualStateOfWorld("mynode" /* nodeName */, volumePluginMgr) devicePath := "fake/device/path" pod := &v1.Pod{ ObjectMeta: metav1.ObjectMeta{ Name: "pod1", UID: "pod1uid", }, Spec: v1.PodSpec{ Volumes: []v1.Volume{ { Name: "volume-name", VolumeSource: v1.VolumeSource{ GCEPersistentDisk: &v1.GCEPersistentDiskVolumeSource{ PDName: "fake-device1", }, }, }, }, }, } volumeSpec := &volume.Spec{Volume: &pod.Spec.Volumes[0]} generatedVolumeName, err := util.GetUniqueVolumeNameFromSpec(plugin, volumeSpec) if err != nil { t.Fatalf("GetUniqueVolumeNameFromSpec failed. Expected: <no error> Actual: <%v>", err) } err = asw.MarkVolumeAsAttached(emptyVolumeName, volumeSpec, "" /* nodeName */, devicePath) if err != nil { t.Fatalf("MarkVolumeAsAttached failed. Expected: <no error> Actual: <%v>", err) } podName := util.GetUniquePodName(pod) mounter, err := plugin.NewMounter(volumeSpec, pod, volume.VolumeOptions{}) if err != nil { t.Fatalf("NewMounter failed. Expected: <no error> Actual: <%v>", err) } mapper, err := plugin.NewBlockVolumeMapper(volumeSpec, pod, volume.VolumeOptions{}) if err != nil { t.Fatalf("NewBlockVolumeMapper failed. Expected: <no error> Actual: <%v>", err) } // Act err = asw.AddPodToVolume( podName, pod.UID, generatedVolumeName, mounter, mapper, volumeSpec.Name(), "" /* volumeGidValue */, volumeSpec) // Assert if err != nil { t.Fatalf("AddPodToVolume failed. Expected: <no error> Actual: <%v>", err) } verifyVolumeExistsAsw(t, generatedVolumeName, true /* shouldExist */, asw) verifyVolumeDoesntExistInUnmountedVolumes(t, generatedVolumeName, asw) verifyVolumeDoesntExistInGloballyMountedVolumes(t, generatedVolumeName, asw) verifyPodExistsInVolumeAsw(t, podName, generatedVolumeName, "fake/device/path" /* expectedDevicePath */, asw) verifyVolumeExistsWithSpecNameInVolumeAsw(t, podName, volumeSpec.Name(), asw) }
explode_data.jsonl/28879
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 812 }
[ 2830, 3393, 21346, 23527, 1249, 18902, 44246, 3404, 62, 53067, 18902, 3564, 1955, 1155, 353, 8840, 836, 8, 341, 197, 322, 40580, 198, 5195, 4661, 11546, 25567, 11, 9006, 1669, 62820, 57824, 287, 2234, 2271, 18902, 11546, 25567, 1155, 340,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
6
func TestGenesisBad(t *testing.T) { // test some bad ones from raw json testCases := [][]byte{ {}, // empty {1, 1, 1, 1, 1}, // junk []byte(`{}`), // empty []byte(`{"chain_id":"mychain","validators":[{}]}`), // invalid validator []byte(`{"chain_id":"chain","initial_height":"-1"}`), // negative initial height // missing pub_key type []byte( `{"validators":[{"pub_key":{"value":"AT/+aaL1eB0477Mud9JMm8Sh8BIvOYlPGC9KkIUmFaE="},"power":"10","name":""}]}`, ), // missing chain_id []byte( `{"validators":[` + `{"pub_key":{` + `"type":"tendermint/PubKeyEd25519","value":"AT/+aaL1eB0477Mud9JMm8Sh8BIvOYlPGC9KkIUmFaE="` + `},"power":"10","name":""}` + `]}`, ), // too big chain_id []byte( `{"chain_id": "Lorem ipsum dolor sit amet, consectetuer adipiscing", "validators": [` + `{"pub_key":{` + `"type":"tendermint/PubKeyEd25519","value":"AT/+aaL1eB0477Mud9JMm8Sh8BIvOYlPGC9KkIUmFaE="` + `},"power":"10","name":""}` + `]}`, ), // wrong address []byte( `{"chain_id":"mychain", "validators":[` + `{"address": "A", "pub_key":{` + `"type":"tendermint/PubKeyEd25519","value":"AT/+aaL1eB0477Mud9JMm8Sh8BIvOYlPGC9KkIUmFaE="` + `},"power":"10","name":""}` + `]}`, ), } for _, testCase := range testCases { _, err := GenesisDocFromJSON(testCase) assert.Error(t, err, "expected error for empty genDoc json") } }
explode_data.jsonl/61609
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 675 }
[ 2830, 3393, 84652, 17082, 1155, 353, 8840, 836, 8, 341, 197, 322, 1273, 1045, 3873, 6174, 504, 7112, 2951, 198, 18185, 37302, 1669, 52931, 3782, 515, 197, 197, 22655, 1060, 442, 4287, 198, 197, 197, 90, 16, 11, 220, 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...
2
func TestHelmManifestFromChartRepoWithValueFileLinks(t *testing.T) { t.Run("Valid symlink", func(t *testing.T) { service := newService("../..") source := &argoappv1.ApplicationSource{ Chart: "my-chart", TargetRevision: ">= 1.0.0", Helm: &argoappv1.ApplicationSourceHelm{ ValueFiles: []string{"my-chart-link.yaml"}, }, } request := &apiclient.ManifestRequest{Repo: &argoappv1.Repository{}, ApplicationSource: source, NoCache: true} _, err := service.GenerateManifest(context.Background(), request) assert.NoError(t, err) }) t.Run("Symlink pointing to outside", func(t *testing.T) { service := newService("../..") source := &argoappv1.ApplicationSource{ Chart: "my-chart", TargetRevision: ">= 1.0.0", Helm: &argoappv1.ApplicationSourceHelm{ ValueFiles: []string{"my-chart-outside-link.yaml"}, }, } request := &apiclient.ManifestRequest{Repo: &argoappv1.Repository{}, ApplicationSource: source, NoCache: true} _, err := service.GenerateManifest(context.Background(), request) assert.Error(t, err) assert.Contains(t, err.Error(), "outside repository root") }) }
explode_data.jsonl/5679
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 450 }
[ 2830, 3393, 39, 23162, 38495, 3830, 14488, 25243, 22767, 1703, 24089, 1155, 353, 8840, 836, 8, 341, 3244, 16708, 445, 4088, 83221, 497, 2915, 1155, 353, 8840, 836, 8, 341, 197, 52934, 1669, 501, 1860, 17409, 496, 1138, 197, 47418, 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 TestOneNodeDaemonLaunchesPod(t *testing.T) { forEachStrategy(t, func(t *testing.T, strategy *apps.DaemonSetUpdateStrategy) { closeFn, dc, informers, clientset := setup(t) defer closeFn() ns := framework.CreateNamespaceOrDie(clientset, "one-node-daemonset-test", t) defer framework.DeleteNamespaceOrDie(clientset, ns, t) dsClient := clientset.AppsV1().DaemonSets(ns.Name) podClient := clientset.CoreV1().Pods(ns.Name) nodeClient := clientset.CoreV1().Nodes() podInformer := informers.Core().V1().Pods().Informer() ctx, cancel := context.WithCancel(context.Background()) defer cancel() // Start Scheduler setupScheduler(ctx, t, clientset, informers) informers.Start(ctx.Done()) go dc.Run(ctx, 2) ds := newDaemonSet("foo", ns.Name) ds.Spec.UpdateStrategy = *strategy _, err := dsClient.Create(context.TODO(), ds, metav1.CreateOptions{}) if err != nil { t.Fatalf("Failed to create DaemonSet: %v", err) } defer cleanupDaemonSets(t, clientset, ds) _, err = nodeClient.Create(context.TODO(), newNode("single-node", nil), metav1.CreateOptions{}) if err != nil { t.Fatalf("Failed to create node: %v", err) } validateDaemonSetPodsAndMarkReady(podClient, podInformer, 1, t) validateDaemonSetStatus(dsClient, ds.Name, 1, t) }) }
explode_data.jsonl/70039
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 511 }
[ 2830, 3393, 3966, 1955, 89177, 32067, 288, 23527, 1155, 353, 8840, 836, 8, 341, 2023, 4854, 19816, 1155, 11, 2915, 1155, 353, 8840, 836, 11, 8282, 353, 27635, 909, 64, 7291, 1649, 4289, 19816, 8, 341, 197, 27873, 24911, 11, 19402, 11,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestRoaringPostingsAddIterator(t *testing.T) { mockCtrl := gomock.NewController(t) defer mockCtrl.Finish() first := NewPostingsList() postingsIter := postings.NewMockIterator(mockCtrl) gomock.InOrder( postingsIter.EXPECT().Next().Return(true), postingsIter.EXPECT().Current().Return(postings.ID(42)), postingsIter.EXPECT().Next().Return(true), postingsIter.EXPECT().Current().Return(postings.ID(44)), postingsIter.EXPECT().Next().Return(true), postingsIter.EXPECT().Current().Return(postings.ID(51)), postingsIter.EXPECT().Next().Return(false), postingsIter.EXPECT().Err().Return(nil), postingsIter.EXPECT().Close().Return(nil), ) require.NoError(t, first.AddIterator(postingsIter)) require.Equal(t, 3, first.Len()) require.True(t, first.Contains(postings.ID(42))) require.True(t, first.Contains(postings.ID(44))) require.True(t, first.Contains(postings.ID(51))) }
explode_data.jsonl/64026
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 332 }
[ 2830, 3393, 38872, 3249, 4133, 819, 2212, 11951, 1155, 353, 8840, 836, 8, 341, 77333, 15001, 1669, 342, 316, 1176, 7121, 2051, 1155, 340, 16867, 7860, 15001, 991, 18176, 2822, 42190, 1669, 1532, 4133, 819, 852, 2822, 51172, 819, 8537, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestRefSerialization(t *testing.T) { for _, x := range []struct { test Ref expected string }{ {Ref{Name: Name{Image: "alpine"}, Tag: "a123"}, `"alpine:a123"`}, {Ref{Name: Name{Domain: "quay.io", Image: "weaveworks/foobar"}, Tag: "baz"}, `"quay.io/weaveworks/foobar:baz"`}, } { serialized, err := json.Marshal(x.test) if err != nil { t.Errorf("Error encoding %v: %v", x.test, err) } if string(serialized) != x.expected { t.Errorf("Encoded %v as %s, but expected %s", x.test, string(serialized), x.expected) } var decoded Ref if err := json.Unmarshal([]byte(x.expected), &decoded); err != nil { t.Errorf("Error decoding %v: %v", x.expected, err) } if decoded != x.test { t.Errorf("Decoded %s as %v, but expected %v", x.expected, decoded, x.test) } } }
explode_data.jsonl/60185
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 350 }
[ 2830, 3393, 3945, 35865, 1155, 353, 8840, 836, 8, 341, 2023, 8358, 856, 1669, 2088, 3056, 1235, 341, 197, 18185, 257, 8550, 198, 197, 42400, 914, 198, 197, 59403, 197, 197, 90, 3945, 63121, 25, 3988, 90, 1906, 25, 330, 278, 38038, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestMapProxy_Clear(t *testing.T) { testKey := "testingKey1" testValue := "testingValue" mp.Put(testKey, testValue) err := mp.Clear() if err != nil { t.Fatal(err) } else { size, err := mp.Size() AssertEqualf(t, err, size, int32(0), "Map clear failed.") } }
explode_data.jsonl/56980
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 115 }
[ 2830, 3393, 2227, 16219, 57744, 1155, 353, 8840, 836, 8, 341, 18185, 1592, 1669, 330, 8840, 1592, 16, 698, 18185, 1130, 1669, 330, 8840, 1130, 698, 53230, 39825, 8623, 1592, 11, 1273, 1130, 340, 9859, 1669, 10490, 13524, 741, 743, 1848,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestInitializeBootstrapChannel(t *testing.T) { cleanup := configtest.SetDevFabricConfigPath(t) defer cleanup() genesisFile := produceGenesisFile(t, genesisconfig.SampleSingleMSPSoloProfile, "testchannelid") defer os.Remove(genesisFile) fileLedgerLocation, _ := ioutil.TempDir("", "main_test-") defer os.RemoveAll(fileLedgerLocation) ledgerFactory, _, err := createLedgerFactory( &localconfig.TopLevel{ FileLedger: localconfig.FileLedger{ Location: fileLedgerLocation, }, }, &disabled.Provider{}, ) assert.NoError(t, err) bootstrapConfig := &localconfig.TopLevel{ General: localconfig.General{ BootstrapMethod: "file", BootstrapFile: genesisFile, }, } bootstrapBlock := extractBootstrapBlock(bootstrapConfig) initializeBootstrapChannel(bootstrapBlock, ledgerFactory) ledger, err := ledgerFactory.GetOrCreate("testchannelid") assert.NoError(t, err) assert.Equal(t, uint64(1), ledger.Height()) }
explode_data.jsonl/32650
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 332 }
[ 2830, 3393, 9928, 45511, 9629, 1155, 353, 8840, 836, 8, 341, 1444, 60639, 1669, 2193, 1944, 4202, 14592, 81731, 2648, 1820, 1155, 340, 16867, 21290, 2822, 82281, 13774, 1703, 1669, 8193, 84652, 1703, 1155, 11, 59366, 1676, 76266, 10888, 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 TestRemittanceOriginatorIdentificationNumberIssuerInvalid_IdentificationNumber(t *testing.T) { ro := mockRemittanceOriginator() ro.IdentificationNumber = "" ro.IdentificationNumberIssuer = "zz" err := ro.Validate() require.EqualError(t, err, fieldError("IdentificationNumberIssuer", ErrInvalidProperty, ro.IdentificationNumberIssuer).Error()) }
explode_data.jsonl/32948
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 102 }
[ 2830, 3393, 6590, 87191, 13298, 850, 95212, 2833, 98902, 7928, 21576, 306, 2404, 2833, 1155, 353, 8840, 836, 8, 341, 197, 299, 1669, 7860, 6590, 87191, 13298, 850, 741, 197, 299, 6444, 306, 2404, 2833, 284, 8389, 197, 299, 6444, 306, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestMainFatalWriter(t *testing.T) { assert := assert.New(t) const cmd = "foo" const msg = "moo FAILURE" // create buffer to save logger output buf := &bytes.Buffer{} savedBefore := runtimeBeforeSubcommands savedLogOutput := kataLog.Logger.Out savedCLIExiter := cli.OsExiter savedCommands := runtimeCommands // disable runtimeBeforeSubcommands = nil // save all output kataLog.Logger.Out = buf cli.OsExiter = func(status int) {} // override sub-commands runtimeCommands = []cli.Command{ { Name: cmd, Action: func(context *cli.Context) error { return cli.NewExitError(msg, 42) }, }, } defer func() { runtimeBeforeSubcommands = savedBefore kataLog.Logger.Out = savedLogOutput cli.OsExiter = savedCLIExiter runtimeCommands = savedCommands }() setCLIGlobals() err := createRuntimeApp(context.Background(), []string{name, cmd}) assert.Error(err) re := regexp.MustCompile( fmt.Sprintf(`\blevel\b.*\berror\b.*\b%s\b`, msg)) matches := re.FindAllStringSubmatch(buf.String(), -1) assert.NotEmpty(matches) }
explode_data.jsonl/52206
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 406 }
[ 2830, 3393, 6202, 62396, 6492, 1155, 353, 8840, 836, 8, 341, 6948, 1669, 2060, 7121, 1155, 692, 4777, 5439, 284, 330, 7975, 698, 4777, 3750, 284, 330, 76, 2624, 64024, 1837, 197, 322, 1855, 4147, 311, 3581, 5925, 2550, 198, 26398, 166...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestJson2Struct_slice_int(t *testing.T) { ret, err := Json2Struct("auto_name", "[1,2,3,42]", GoStructType) fmt.Printf("ret:\n %s, %v\n", ret, err) }
explode_data.jsonl/72749
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 72 }
[ 2830, 3393, 5014, 17, 9422, 26488, 4042, 1155, 353, 8840, 836, 8, 341, 11262, 11, 1848, 1669, 8308, 17, 9422, 445, 3902, 1269, 497, 10545, 16, 11, 17, 11, 18, 11, 19, 17, 19076, 5994, 9422, 929, 340, 11009, 19367, 445, 2122, 7190, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_validator_ValidateConfiguration(t *testing.T) { t.Parallel() secret := &v1.Secret{} secret.StringData = make(map[string]string) secret.StringData["username"] = "user" secret.StringData["password"] = "password" secret.StringData["endpoint"] = "endpoint" t.Run("successful validation", func(t *testing.T) { // given configuration := &context.SetupConfiguration{Dogus: context.Dogus{Completed: true}, Naming: context.Naming{Completed: true}, UserBackend: context.UserBackend{Completed: true}, Admin: context.User{Completed: true}} doguValidatorMock := &mocks.DoguValidator{} doguValidatorMock.On("ValidateDogus", mock.Anything).Return(nil) namingValidatorMock := &mocks.NamingValidator{} namingValidatorMock.On("ValidateNaming", mock.Anything).Return(nil) userBackendValidatorMock := &mocks.UserBackendValidator{} userBackendValidatorMock.On("ValidateUserBackend", mock.Anything).Return(nil) adminValidatorMock := &mocks.AdminValidator{} adminValidatorMock.On("ValidateAdmin", mock.Anything, mock.Anything).Return(nil) registryConfigEncryptedValidatorMock := &mocks.RegistryConfigEncryptedValidator{} registryConfigEncryptedValidatorMock.On("ValidateRegistryConfigEncrypted", mock.Anything).Return(nil) mockRegistry := &remoteMocks.Registry{} validator := NewStartupConfigurationValidator(mockRegistry) validator.doguValidator = doguValidatorMock validator.namingValidator = namingValidatorMock validator.userBackenValidator = userBackendValidatorMock validator.adminValidator = adminValidatorMock validator.registryConfigEncryptedValidator = registryConfigEncryptedValidatorMock // when err := validator.ValidateConfiguration(configuration) // then require.NoError(t, err) mock.AssertExpectationsForObjects(t, namingValidatorMock, userBackendValidatorMock, adminValidatorMock, registryConfigEncryptedValidatorMock) }) t.Run("error during dogu validation", func(t *testing.T) { // given configuration := &context.SetupConfiguration{Dogus: context.Dogus{Completed: true}} doguValidatorMock := &mocks.DoguValidator{} doguValidatorMock.On("ValidateDogus", mock.Anything).Return(assert.AnError) mockRegistry := &remoteMocks.Registry{} validator := NewStartupConfigurationValidator(mockRegistry) validator.doguValidator = doguValidatorMock // when err := validator.ValidateConfiguration(configuration) // then require.Error(t, err) assert.Contains(t, err.Error(), "failed to validate dogu section") mock.AssertExpectationsForObjects(t, doguValidatorMock) }) t.Run("error during naming validation", func(t *testing.T) { // given configuration := &context.SetupConfiguration{Naming: context.Naming{Completed: true}} namingValidatorMock := &mocks.NamingValidator{} doguValidatorMock := &mocks.DoguValidator{} doguValidatorMock.On("ValidateDogus", mock.Anything).Return(nil) namingValidatorMock.On("ValidateNaming", mock.Anything).Return(assert.AnError) mockRegistry := &remoteMocks.Registry{} validator := NewStartupConfigurationValidator(mockRegistry) validator.doguValidator = doguValidatorMock validator.namingValidator = namingValidatorMock // when err := validator.ValidateConfiguration(configuration) // then require.Error(t, err) assert.Contains(t, err.Error(), "failed to validate naming section") mock.AssertExpectationsForObjects(t, namingValidatorMock, doguValidatorMock) }) t.Run("error during user backend validation", func(t *testing.T) { // given configuration := &context.SetupConfiguration{UserBackend: context.UserBackend{Completed: true}} doguValidatorMock := &mocks.DoguValidator{} doguValidatorMock.On("ValidateDogus", mock.Anything).Return(nil) namingValidatorMock := &mocks.NamingValidator{} namingValidatorMock.On("ValidateNaming", mock.Anything).Return(nil) userBackendValidatorMock := &mocks.UserBackendValidator{} userBackendValidatorMock.On("ValidateUserBackend", mock.Anything).Return(assert.AnError) mockRegistry := &remoteMocks.Registry{} validator := NewStartupConfigurationValidator(mockRegistry) validator.doguValidator = doguValidatorMock validator.namingValidator = namingValidatorMock validator.userBackenValidator = userBackendValidatorMock // when err := validator.ValidateConfiguration(configuration) // then require.Error(t, err) assert.Contains(t, err.Error(), "failed to validate user backend section") mock.AssertExpectationsForObjects(t, namingValidatorMock, doguValidatorMock, userBackendValidatorMock) }) t.Run("error during admin user validation", func(t *testing.T) { // given configuration := &context.SetupConfiguration{Admin: context.User{Completed: true}} doguValidatorMock := &mocks.DoguValidator{} doguValidatorMock.On("ValidateDogus", mock.Anything).Return(nil) namingValidatorMock := &mocks.NamingValidator{} namingValidatorMock.On("ValidateNaming", mock.Anything).Return(nil) userBackendValidatorMock := &mocks.UserBackendValidator{} userBackendValidatorMock.On("ValidateUserBackend", mock.Anything).Return(nil) adminValidatorMock := &mocks.AdminValidator{} adminValidatorMock.On("ValidateAdmin", mock.Anything, mock.Anything).Return(assert.AnError) mockRegistry := &remoteMocks.Registry{} validator := NewStartupConfigurationValidator(mockRegistry) validator.doguValidator = doguValidatorMock validator.namingValidator = namingValidatorMock validator.userBackenValidator = userBackendValidatorMock validator.adminValidator = adminValidatorMock // when err := validator.ValidateConfiguration(configuration) // then require.Error(t, err) assert.Contains(t, err.Error(), "failed to validate admin user section") mock.AssertExpectationsForObjects(t, namingValidatorMock, doguValidatorMock, userBackendValidatorMock, adminValidatorMock) }) t.Run("error during registry config encrypted validation", func(t *testing.T) { // given configuration := &context.SetupConfiguration{Admin: context.User{Completed: true}} doguValidatorMock := &mocks.DoguValidator{} doguValidatorMock.On("ValidateDogus", mock.Anything).Return(nil) namingValidatorMock := &mocks.NamingValidator{} namingValidatorMock.On("ValidateNaming", mock.Anything).Return(nil) userBackendValidatorMock := &mocks.UserBackendValidator{} userBackendValidatorMock.On("ValidateUserBackend", mock.Anything).Return(nil) adminValidatorMock := &mocks.AdminValidator{} adminValidatorMock.On("ValidateAdmin", mock.Anything, mock.Anything).Return(nil) registryConfigEncryptedValidatorMock := &mocks.RegistryConfigEncryptedValidator{} registryConfigEncryptedValidatorMock.On("ValidateRegistryConfigEncrypted", mock.Anything).Return(assert.AnError) mockRegistry := &remoteMocks.Registry{} validator := NewStartupConfigurationValidator(mockRegistry) validator.doguValidator = doguValidatorMock validator.namingValidator = namingValidatorMock validator.userBackenValidator = userBackendValidatorMock validator.adminValidator = adminValidatorMock validator.registryConfigEncryptedValidator = registryConfigEncryptedValidatorMock // when err := validator.ValidateConfiguration(configuration) // then require.Error(t, err) assert.Contains(t, err.Error(), "failed to validate registry config encrypted section") mock.AssertExpectationsForObjects(t, namingValidatorMock, doguValidatorMock, userBackendValidatorMock, adminValidatorMock, registryConfigEncryptedValidatorMock) }) }
explode_data.jsonl/75149
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 2516 }
[ 2830, 3393, 64959, 62, 17926, 7688, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 2822, 197, 20474, 1669, 609, 85, 16, 74779, 16094, 197, 20474, 6431, 1043, 284, 1281, 9147, 14032, 30953, 340, 197, 20474, 6431, 1043, 1183, 5113, 1341...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestIgnoredFiles(t *testing.T) { const ws = ` -- go.mod -- module mod.com go 1.15 -- _foo/x.go -- package x var _ = foo.Bar ` runner.Run(t, ws, func(t *testing.T, env *Env) { env.OpenFile("_foo/x.go") env.Await( OnceMet( CompletedWork(lsp.DiagnosticWorkTitle(lsp.FromDidOpen), 1), NoDiagnostics("_foo/x.go"), )) }) }
explode_data.jsonl/38928
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 167 }
[ 2830, 3393, 43337, 3018, 10809, 1155, 353, 8840, 836, 8, 341, 4777, 17624, 284, 22074, 313, 728, 10929, 39514, 4352, 1463, 905, 271, 3346, 220, 16, 13, 16, 20, 198, 313, 716, 7975, 10776, 18002, 39514, 1722, 856, 271, 947, 716, 284, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestErrors(t *testing.T) { testCases := []struct { name string values string want error }{ {"EC1", "not good", AppError(EC1)}, } testData := []*myErrors.Error{ { Id: "mkit.service.account", Code: 422, Detail: "proto validation: sumo-val-error", Status: http.StatusText(422), }, } appErrTestData := []*myErrors.Error{ { Id: "EC1", Code: 500, Detail: "not good", Status: http.StatusText(500), }, } // test AppError for _, tc := range testCases { t.Run(tc.name, func(t *testing.T) { got := AppError(EC1) if !reflect.DeepEqual(got, tc.want) { t.Errorf("Got %v, want %v", got, tc.want) } }) } // test ValidationError for _, e := range testData { ne := ValidationError("mkit.service.account", "proto validation: sumo-val-error") if e.Error() != ne.Error() { t.Fatalf("Expected %s got %s", e.Error(), ne.Error()) } ne2 := ValidationError("mkit.service.account", "proto validation: %v", errors.New("sumo-val-error")) if e.Error() != ne2.Error() { t.Fatalf("Expected %s got %s", e.Error(), ne2.Error()) } pe := myErrors.Parse(ne.Error()) if pe == nil { t.Fatalf("Expected error got nil %v", pe) } if pe.Id != e.Id { t.Fatalf("Expected %s got %s", e.Id, pe.Id) } if pe.Detail != e.Detail { t.Fatalf("Expected %s got %s", e.Detail, pe.Detail) } if pe.Code != e.Code { t.Fatalf("Expected %d got %d", e.Code, pe.Code) } if pe.Status != e.Status { t.Fatalf("Expected %s got %s", e.Status, pe.Status) } } // test AppError ae := AppError(EC1) if appErrTestData[0].Error() != ae.Error() { t.Fatalf("Expected %s got %s", appErrTestData[0].Error(), ae.Error()) } }
explode_data.jsonl/30317
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 789 }
[ 2830, 3393, 13877, 1155, 353, 8840, 836, 8, 341, 18185, 37302, 1669, 3056, 1235, 341, 197, 11609, 256, 914, 198, 197, 45939, 914, 198, 197, 50780, 256, 1465, 198, 197, 59403, 197, 197, 4913, 7498, 16, 497, 330, 1921, 1661, 497, 1845, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestToWeirdCase(t *testing.T) { t0 := toWeirdCase("abc def") e0 := "AbC DeF" if t0 != e0 { t.Errorf("for %s, expected: %s, got %s", "abc def", "AbC DeF", e0) } t0 = toWeirdCase("ABC") e0 = "AbC" if t0 != e0 { t.Errorf("for %s, expected: %s, got %s", "ABC", "AbC", e0) } t0 = toWeirdCase("This is a test Looks like you passed") e0 = "ThIs Is A TeSt LoOkS LiKe YoU PaSsEd" if t0 != e0 { t.Errorf("for %s, expected: %s, got %s", "This is a test Looks like you passed", "ThIs Is A TeSt LoOkS LiKe YoU PaSsEd", e0) } }
explode_data.jsonl/81145
{ "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, 1249, 1654, 2603, 4207, 1155, 353, 8840, 836, 8, 1476, 3244, 15, 1669, 311, 1654, 2603, 4207, 445, 13683, 707, 1138, 7727, 15, 1669, 330, 5830, 34, 1581, 37, 698, 743, 259, 15, 961, 384, 15, 341, 197, 3244, 13080, 445, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
4
func TestGocloak_GetToken(t *testing.T) { t.Parallel() cfg := GetConfig(t) client := NewClientWithDebug(t) SetUpTestUser(t, client) newToken, err := client.GetToken( cfg.GoCloak.Realm, TokenOptions{ ClientID: cfg.GoCloak.ClientID, ClientSecret: cfg.GoCloak.ClientSecret, Username: cfg.GoCloak.UserName, Password: cfg.GoCloak.Password, GrantType: "password", ResponseTypes: []string{"token", "id_token"}, Scopes: []string{"openid", "offline_access"}, }, ) FailIfErr(t, err, "Login failed") t.Logf("New token: %+v", *newToken) FailIf(t, newToken.RefreshExpiresIn > 0, "Got a refresh token instead of offline") FailIf(t, len(newToken.IDToken) == 0, "Got an empty if token") }
explode_data.jsonl/79518
{ "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, 38, 509, 385, 585, 13614, 3323, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 741, 50286, 1669, 2126, 2648, 1155, 340, 25291, 1669, 1532, 2959, 2354, 7939, 1155, 340, 22212, 2324, 2271, 1474, 1155, 11, 2943, 340, 8638, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestMachineSetToDeployments(t *testing.T) { machineDeployment := v1alpha1.MachineDeployment{ ObjectMeta: metav1.ObjectMeta{ Name: "withMatchingLabels", Namespace: "test", }, Spec: v1alpha1.MachineDeploymentSpec{ Selector: metav1.LabelSelector{ MatchLabels: map[string]string{ "foo": "bar", v1alpha1.MachineClusterLabelName: "test-cluster", }, }, }, } machineDeplopymentList := &v1alpha1.MachineDeploymentList{ TypeMeta: metav1.TypeMeta{ Kind: "MachineDeploymentList", }, Items: []v1alpha1.MachineDeployment{machineDeployment}, } ms1 := v1alpha1.MachineSet{ TypeMeta: metav1.TypeMeta{ Kind: "MachineSet", }, ObjectMeta: metav1.ObjectMeta{ Name: "withOwnerRef", Namespace: "test", OwnerReferences: []metav1.OwnerReference{ *metav1.NewControllerRef(&machineDeployment, controllerKind), }, Labels: map[string]string{ v1alpha1.MachineClusterLabelName: "test-cluster", }, }, } ms2 := v1alpha1.MachineSet{ TypeMeta: metav1.TypeMeta{ Kind: "MachineSet", }, ObjectMeta: metav1.ObjectMeta{ Name: "noOwnerRefNoLabels", Namespace: "test", Labels: map[string]string{ v1alpha1.MachineClusterLabelName: "test-cluster", }, }, } ms3 := v1alpha1.MachineSet{ TypeMeta: metav1.TypeMeta{ Kind: "MachineSet", }, ObjectMeta: metav1.ObjectMeta{ Name: "withMatchingLabels", Namespace: "test", Labels: map[string]string{ "foo": "bar", v1alpha1.MachineClusterLabelName: "test-cluster", }, }, } testsCases := []struct { machineSet v1alpha1.MachineSet mapObject handler.MapObject expected []reconcile.Request }{ { machineSet: ms1, mapObject: handler.MapObject{ Meta: ms1.GetObjectMeta(), Object: &ms1, }, expected: []reconcile.Request{}, }, { machineSet: ms2, mapObject: handler.MapObject{ Meta: ms2.GetObjectMeta(), Object: &ms2, }, expected: nil, }, { machineSet: ms3, mapObject: handler.MapObject{ Meta: ms3.GetObjectMeta(), Object: &ms3, }, expected: []reconcile.Request{ {NamespacedName: client.ObjectKey{Namespace: "test", Name: "withMatchingLabels"}}, }, }, } v1alpha1.AddToScheme(scheme.Scheme) r := &ReconcileMachineDeployment{ Client: fake.NewFakeClient(&ms1, &ms2, &ms3, machineDeplopymentList), scheme: scheme.Scheme, recorder: record.NewFakeRecorder(32), } for _, tc := range testsCases { got := r.MachineSetToDeployments(tc.mapObject) if !reflect.DeepEqual(got, tc.expected) { t.Errorf("Case %s. Got: %v, expected: %v", tc.machineSet.Name, got, tc.expected) } } }
explode_data.jsonl/72976
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1228 }
[ 2830, 3393, 21605, 1649, 1249, 69464, 1368, 1155, 353, 8840, 836, 8, 341, 2109, 3814, 75286, 1669, 348, 16, 7141, 16, 1321, 3814, 75286, 515, 197, 23816, 12175, 25, 77520, 16, 80222, 515, 298, 21297, 25, 414, 330, 4197, 64430, 23674, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestGetContainerInPod(t *testing.T) { expectedName := "mycontainer" imageName := "myimage" // no container fails container, err := GetMatchingContainer([]v1.Container{}, expectedName) assert.NotNil(t, err) // one container will allow any name container, err = GetMatchingContainer([]v1.Container{{Name: "foo", Image: imageName}}, expectedName) assert.Nil(t, err) assert.Equal(t, imageName, container.Image) // multiple container fails if we don't find the correct name container, err = GetMatchingContainer( []v1.Container{{Name: "foo", Image: imageName}, {Name: "bar", Image: imageName}}, expectedName) assert.NotNil(t, err) // multiple container succeeds if we find the correct name container, err = GetMatchingContainer( []v1.Container{{Name: "foo", Image: imageName}, {Name: expectedName, Image: imageName}}, expectedName) assert.Nil(t, err) assert.Equal(t, imageName, container.Image) }
explode_data.jsonl/9464
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 301 }
[ 2830, 3393, 1949, 4502, 641, 23527, 1155, 353, 8840, 836, 8, 341, 42400, 675, 1669, 330, 2408, 3586, 698, 31426, 675, 1669, 330, 2408, 1805, 1837, 197, 322, 902, 5476, 14525, 198, 53290, 11, 1848, 1669, 2126, 64430, 4502, 10556, 85, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestClient_Servers(t *testing.T) { var err error var tv *Version record(t, "servers/version", func(c *Client) { tv = testVersion(t, c) }) testPool := createTestPool(t, "servers/create_pool", testServiceID, tv.Number, "servers22") // Create var server *Server var altServer *Server record(t, "servers/create", func(c *Client) { server, err = c.CreateServer(&CreateServerInput{ ServiceID: testServiceID, PoolID: testPool.ID, Address: "127.0.0.1", }) if err != nil { t.Fatal(err) } // additional pool server for DeleteServer usage altServer, err = c.CreateServer(&CreateServerInput{ ServiceID: testServiceID, PoolID: testPool.ID, Address: "altserver.example.com", }) if err != nil { t.Fatal(err) } }) // Ensure deleted defer func() { // Delete the pool from this version. deleteTestPool(t, testPool, "servers/delete_pool") record(t, "servers/cleanup", func(c *Client) { // Expected to fail as this was explicitly deleted in the test. c.DeleteServer(&DeleteServerInput{ ServiceID: testServiceID, PoolID: testPool.ID, Server: altServer.ID, }) // Expected to fail as the API forbids deleting the last server in // the pool. The pool is deleted from this version but it still // exists as it may be associated with other versions. c.DeleteServer(&DeleteServerInput{ ServiceID: testServiceID, PoolID: testPool.ID, Server: server.ID, }) }) }() if server.ServiceID != testServiceID { t.Errorf("bad server service: %q", server.ServiceID) } if server.PoolID != testPool.ID { t.Errorf("bad server pool: %q", server.PoolID) } if server.Address != "127.0.0.1" { t.Errorf("bad server address: %q", server.Address) } // List var ss []*Server record(t, "servers/list", func(c *Client) { ss, err = c.ListServers(&ListServersInput{ ServiceID: testServiceID, PoolID: testPool.ID, }) }) if err != nil { t.Fatal(err) } if len(ss) < 1 { t.Errorf("bad servers: %v", ss) } // Get var ns *Server record(t, "servers/get", func(c *Client) { ns, err = c.GetServer(&GetServerInput{ ServiceID: testServiceID, PoolID: testPool.ID, Server: server.ID, }) }) if server.ID != ns.ID { t.Errorf("bad ID: %q (%q)", server.ID, ns.ID) } if server.Address != ns.Address { t.Errorf("bad address: %q (%q)", server.Address, ns.Address) } // Update var us *Server record(t, "servers/update", func(c *Client) { us, err = c.UpdateServer(&UpdateServerInput{ ServiceID: testServiceID, PoolID: testPool.ID, Server: server.ID, Address: String("0.0.0.0"), Weight: Uint(50), }) }) if err != nil { t.Fatal(err) } if us.Address == server.Address { t.Errorf("bad address: %s", us.Address) } if us.Weight != 50 { t.Errorf("bad weight: %q", 50) } // Delete record(t, "servers/delete", func(c *Client) { err = c.DeleteServer(&DeleteServerInput{ ServiceID: testServiceID, PoolID: testPool.ID, Server: altServer.ID, }) }) if err != nil { t.Fatal(err) } }
explode_data.jsonl/8318
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1292 }
[ 2830, 3393, 2959, 1098, 18729, 1155, 353, 8840, 836, 8, 341, 2405, 1848, 1465, 198, 2405, 11086, 353, 5637, 198, 71952, 1155, 11, 330, 67696, 64413, 497, 2915, 1337, 353, 2959, 8, 341, 197, 92810, 284, 1273, 5637, 1155, 11, 272, 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 TestValidateV1Beta1InvalidYAML(t *testing.T) { manifest := `--- invalidyaml ` _, err := Validate(manifest) if err == nil || err.Error() != "could not parse the manifest as yaml to retrieve the apiVersion" { t.Errorf("Didn't get expected error from manifest.TestValidateV1Beta1InvalidYAML(), instead got: %s", err) } }
explode_data.jsonl/80474
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 117 }
[ 2830, 3393, 17926, 53, 16, 64811, 16, 7928, 56, 31102, 1155, 353, 8840, 836, 8, 341, 197, 42315, 1669, 1565, 10952, 11808, 41466, 198, 197, 3989, 197, 6878, 1848, 1669, 23282, 60671, 6962, 340, 743, 1848, 621, 2092, 1369, 1848, 6141, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestCreateDevice(t *testing.T) { th.SetupHTTP() defer th.TeardownHTTP() th.Mux.HandleFunc("/API/SoEntryFGHA", func(w http.ResponseWriter, r *http.Request) { th.TestMethod(t, r, "POST") th.TestHeader(t, r, "X-Auth-Token", fakeclient.TokenID) th.TestJSONRequest(t, r, createRequest) w.WriteHeader(http.StatusOK) w.Header().Add("Content-Type", "application/json") fmt.Fprintf(w, createResponse) }) gtHost1 := security.GtHostInCreate{ AZGroup: "zone1-groupa", LicenseKind: "02", OperatingMode: "FW_HA", HALink1IPAddress: "192.168.1.3", HALink1NetworkID: "c5b1b0a8-45a3-4c99-b808-84e7c13e557f", HALink1SubnetID: "9a2116e2-52be-439c-9587-506a1a5d288d", HALink2IPAddress: "192.168.2.3", HALink2NetworkID: "a8df4d5f-8752-4574-a255-dc749acd458f", HALink2SubnetID: "a2ff5669-8422-421c-bb85-a6d691ecf223", } gtHost2 := security.GtHostInCreate{ AZGroup: "zone1-groupb", LicenseKind: "02", OperatingMode: "FW_HA", HALink1IPAddress: "192.168.1.4", HALink1NetworkID: "c5b1b0a8-45a3-4c99-b808-84e7c13e557f", HALink1SubnetID: "9a2116e2-52be-439c-9587-506a1a5d288d", HALink2IPAddress: "192.168.2.4", HALink2NetworkID: "a8df4d5f-8752-4574-a255-dc749acd458f", HALink2SubnetID: "a2ff5669-8422-421c-bb85-a6d691ecf223", } createOpts := security.CreateOpts{ SOKind: "AH", Locale: "ja", TenantID: "9ee80f2a926c49f88f166af47df4e9f5", GtHost: [2]security.GtHostInCreate{gtHost1, gtHost2}, } actual, err := security.Create(fakeclient.ServiceClient(), createOpts).Extract() th.AssertNoErr(t, err) th.CheckDeepEquals(t, &createResult, actual) }
explode_data.jsonl/45985
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 834 }
[ 2830, 3393, 4021, 6985, 1155, 353, 8840, 836, 8, 341, 70479, 39820, 9230, 741, 16867, 270, 94849, 37496, 9230, 2822, 70479, 1321, 2200, 63623, 4283, 7082, 14, 4416, 5874, 12001, 17020, 497, 2915, 3622, 1758, 37508, 11, 435, 353, 1254, 9...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestParseFileError(t *testing.T) { p := NewParser(nil) err := p.ParseFile("testdata/__no_such_file") if err == nil { t.Errorf("an error was expected, got none") } }
explode_data.jsonl/49358
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 71 }
[ 2830, 3393, 14463, 1703, 1454, 1155, 353, 8840, 836, 8, 341, 3223, 1669, 1532, 6570, 27907, 340, 9859, 1669, 281, 8937, 1703, 445, 92425, 79463, 2152, 643, 1387, 2458, 1138, 743, 1848, 621, 2092, 341, 197, 3244, 13080, 445, 276, 1465, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 Test4(t *testing.T) { for i := 0; i < 100; i++ { fmt.Println(base64.StdEncoding.EncodeToString([]byte(convert.IntToStr(i)))) } }
explode_data.jsonl/22071
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 64 }
[ 2830, 3393, 19, 1155, 353, 8840, 836, 8, 341, 2023, 600, 1669, 220, 15, 26, 600, 366, 220, 16, 15, 15, 26, 600, 1027, 341, 197, 11009, 12419, 12663, 21, 19, 36086, 14690, 50217, 5870, 10556, 3782, 60808, 7371, 67557, 1956, 22788, 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 ]
2
func Test_ParseCore(t *testing.T) { app := ctl.NewApplication("test", "A test command-line tool").Terminate(nil) //app.UsageWriter(os.Stderr) cli := ctl.NewControl(&ctl.ControlDefinition{ App: app, Output: os.Stdout, ErrOutput: os.Stderr, }) app.Command("foo", "foo description") app.Command("bar", "bar description") assert.Equal(t, app, cli.App()) assert.Equal(t, os.Stdout, cli.Writer()) assert.Equal(t, os.Stderr, cli.ErrWriter()) foobar := app.Command("foobar", "foobar description") foobarflag := foobar.Flag("foobarflag", "foobarflag description").Required().String() cmd, out := parse(cli, []string{"test", "-V", "foo"}) assert.Empty(t, cmd) assert.Equal(t, "ERROR: unknown short flag '-V'\n", out) cmd, _ = parse(cli, []string{"test", "foo"}) require.Equal(t, ctl.RCOkay, cli.ReturnCode()) assert.NotEmpty(t, cmd) assert.Equal(t, "foo", cmd) cmd, _ = parse(cli, []string{"test", "foobar", "--foobarflag", "test"}) require.Equal(t, ctl.RCOkay, cli.ReturnCode()) assert.NotEmpty(t, cmd) assert.Equal(t, "foobar", cmd) assert.Equal(t, "test", *foobarflag) cmd, out = parse(cli, []string{"test", "--bogus", "foo"}) require.Equal(t, ctl.RCUsage, cli.ReturnCode()) assert.Empty(t, cmd) assert.Equal(t, "ERROR: unknown long flag '--bogus'\n", out) cmd, out = parse(cli, []string{"test", "bob"}) require.Equal(t, ctl.RCUsage, cli.ReturnCode()) assert.Empty(t, cmd) assert.Equal(t, "ERROR: expected command but got \"bob\"\n", out) cmd, _ = parse(cli, []string{"test"}) assert.Empty(t, cmd) require.Equal(t, ctl.RCUsage, cli.ReturnCode()) }
explode_data.jsonl/6329
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 656 }
[ 2830, 3393, 77337, 5386, 1155, 353, 8840, 836, 8, 341, 28236, 1669, 64935, 7121, 4988, 445, 1944, 497, 330, 32, 1273, 3210, 8447, 5392, 1827, 62519, 27907, 340, 197, 322, 676, 85900, 6492, 9638, 77319, 692, 86448, 1669, 64935, 7121, 327...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestCronFunc(t *testing.T) { assert.NotPanics(t, func() { var calls = 0 mjob, _ := CronFunc("* * * * * *", func() { calls++ }, nil) defer mjob.Cancel() <-time.After(time.Second + 100*time.Nanosecond) if calls != 1 { t.Errorf("called %d times, expected 1\n", calls) } }) }
explode_data.jsonl/56061
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 132 }
[ 2830, 3393, 34, 2248, 9626, 1155, 353, 8840, 836, 8, 341, 6948, 15000, 35693, 1211, 1155, 11, 2915, 368, 341, 197, 2405, 6738, 284, 220, 15, 198, 197, 2109, 8799, 11, 716, 1669, 55817, 9626, 29592, 353, 353, 353, 353, 353, 497, 2915...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestCommandLine_CheckLoggedIn(t *testing.T) { options := server.Options{}.WithAuth(true).WithInMemoryStore(true).WithAdminPassword(auth.SysAdminPassword) bs := servertest.NewBufconnServer(options) bs.Start() cl := commandline{} cmd, _ := cl.NewCmd() cl.context = context.Background() cl.passwordReader = pwReaderMock dialOptions := []grpc.DialOption{ grpc.WithContextDialer(bs.Dialer), grpc.WithInsecure(), } cmd.SetArgs([]string{"login", "immudb"}) cmd.Execute() cl.options = Options() cl.options.DialOptions = &dialOptions cl.login(cmd) cmd1 := cobra.Command{} cl1 := new(commandline) cl1.context = context.Background() cl1.passwordReader = pwReaderMock cl1.ts = client.NewTokenService().WithHds(newHomedirServiceMock()).WithTokenFileName("token_admin") dialOptions1 := []grpc.DialOption{ grpc.WithContextDialer(bs.Dialer), grpc.WithInsecure(), } cl1.options = Options() cl1.options.DialOptions = &dialOptions1 err := cl1.checkLoggedIn(&cmd1, nil) assert.Nil(t, err) }
explode_data.jsonl/54120
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 374 }
[ 2830, 3393, 71885, 28188, 28559, 1155, 353, 8840, 836, 8, 341, 35500, 1669, 3538, 22179, 46391, 2354, 5087, 3715, 568, 2354, 641, 10642, 6093, 3715, 568, 2354, 7210, 4876, 27435, 59418, 7210, 4876, 340, 93801, 1669, 1420, 1621, 477, 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 TestEmptyUsername(t *testing.T) { db := Init(test_host, test_coll) defer db.del() tAddUser(t, db) if db.User("").Valid(pass) { t.Errorf("user.Valid() return true for an invalid user") } }
explode_data.jsonl/65263
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 82 }
[ 2830, 3393, 3522, 11115, 1155, 353, 8840, 836, 8, 341, 20939, 1669, 15690, 8623, 12848, 11, 1273, 43597, 340, 16867, 2927, 33012, 2822, 3244, 2212, 1474, 1155, 11, 2927, 340, 743, 2927, 7344, 80821, 4088, 39790, 8, 341, 197, 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 ]
2
func TestGenBankIO(t *testing.T) { files := []string{ "NC_001422.gb", "NC_000913.3.min.gb", } for _, file := range files { in := testutils.ReadTestfile(t, file) state := pars.FromString(in) parser := pars.AsParser(GenBankParser) result, err := parser.Parse(state) if err != nil { t.Errorf("in file %q, parser returned %v\nBuffer:\n%q", file, err, string(result.Token)) return } switch seq := result.Value.(type) { case GenBank: formatGenBankHelper(t, &seq, in) cpy := gts.New(seq.Info(), seq.Features(), seq.Bytes()) formatGenBankHelper(t, &cpy, in) default: t.Errorf("result.Value.(type) = %T, want %T", seq, GenBank{}) } } }
explode_data.jsonl/6540
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 290 }
[ 2830, 3393, 9967, 25828, 3810, 1155, 353, 8840, 836, 8, 341, 74075, 1669, 3056, 917, 515, 197, 197, 1, 9949, 62, 15, 15, 16, 19, 17, 17, 77262, 756, 197, 197, 1, 9949, 62, 15, 15, 15, 24, 16, 18, 13, 18, 4358, 77262, 756, 197,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
4
func Test_Cache1(t *testing.T) { var fn, fs, ca, original string fn = "./test.txt" Write(fn, "\nFoobar\n", true) Reset() Write(fn, "\nFoobar\n", true) Write(fn, "\nFoobar\n", true) fs, _ = file.Read(fn) ca, _ = Read(fn) original = fs if fs == ca { t.Fatalf("CachedFile Test 1 failed") } Stop() fs, _ = file.Read(fn) ca, _ = Read(fn) if fs != ca { t.Fatalf("CachedFile Test 2 failed") } if s, _ := Size(fn); s != 445 { t.Fatalf("CachedFile Test 3 failed") } if Clean(fn) != nil { t.Fatalf("CachedFile Test 4 failed") } if s, _ := Size(fn); s != 0 { t.Fatalf("CachedFile Test 5 failed") } Write(fn, original, false) Stop() }
explode_data.jsonl/63481
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 300 }
[ 2830, 3393, 920, 1777, 16, 1155, 353, 8840, 836, 8, 341, 2405, 5168, 11, 8619, 11, 2162, 11, 4024, 914, 271, 40095, 284, 5924, 1944, 3909, 1837, 60373, 24008, 11, 2917, 77, 91879, 31393, 1699, 497, 830, 340, 197, 14828, 741, 60373, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestFlipManagerChannelFlip(t *testing.T) { // ensure only members of a channel are included in the flip runWithMemberTypes(t, func(mt chat1.ConversationMembersType) { switch mt { case chat1.ConversationMembersType_TEAM: default: return } ctc := makeChatTestContext(t, "FlipManagerChannelFlip", 3) defer ctc.cleanup() users := ctc.users() flip.DefaultCommitmentWindowMsec = 500 var ui0, ui1, ui2 *kbtest.ChatUI ui0 = kbtest.NewChatUI() ui1 = kbtest.NewChatUI() ui2 = kbtest.NewChatUI() ctc.as(t, users[0]).h.mockChatUI = ui0 ctc.as(t, users[1]).h.mockChatUI = ui1 ctc.as(t, users[2]).h.mockChatUI = ui2 ctc.world.Tcs[users[0].Username].G.UIRouter = &fakeUIRouter{ui: ui0} ctc.world.Tcs[users[1].Username].G.UIRouter = &fakeUIRouter{ui: ui1} ctc.world.Tcs[users[2].Username].G.UIRouter = &fakeUIRouter{ui: ui2} listener0 := newServerChatListener() listener1 := newServerChatListener() listener2 := newServerChatListener() ctc.as(t, users[0]).h.G().NotifyRouter.AddListener(listener0) ctc.as(t, users[1]).h.G().NotifyRouter.AddListener(listener1) ctc.as(t, users[2]).h.G().NotifyRouter.AddListener(listener2) conv := mustCreateConversationForTest(t, ctc, users[0], chat1.TopicType_CHAT, mt, ctc.as(t, users[1]).user(), ctc.as(t, users[2]).user()) consumeNewConversation(t, listener0, conv.Id) consumeNewConversation(t, listener1, conv.Id) consumeNewConversation(t, listener2, conv.Id) topicName := "channel-1" channel := mustCreateChannelForTest(t, ctc, users[0], chat1.TopicType_CHAT, &topicName, mt, ctc.as(t, users[1]).user(), ctc.as(t, users[2]).user()) consumeNewMsgRemote(t, listener0, chat1.MessageType_JOIN) consumeNewMsgRemote(t, listener0, chat1.MessageType_SYSTEM) consumeNewMsgRemote(t, listener0, chat1.MessageType_SYSTEM) consumeNewMsgRemote(t, listener1, chat1.MessageType_SYSTEM) consumeNewMsgRemote(t, listener1, chat1.MessageType_SYSTEM) consumeNewMsgRemote(t, listener2, chat1.MessageType_SYSTEM) consumeNewMsgRemote(t, listener2, chat1.MessageType_SYSTEM) mustJoinConversationByID(t, ctc, users[1], channel.Id) consumeNewMsgRemote(t, listener0, chat1.MessageType_JOIN) consumeNewMsgRemote(t, listener1, chat1.MessageType_JOIN) mustJoinConversationByID(t, ctc, users[2], channel.Id) _, err := ctc.as(t, users[2]).chatLocalHandler().LeaveConversationLocal( ctc.as(t, users[0]).startCtx, channel.Id) require.NoError(t, err) consumeNewMsgRemote(t, listener0, chat1.MessageType_JOIN) consumeNewMsgRemote(t, listener1, chat1.MessageType_JOIN) consumeNewMsgRemote(t, listener2, chat1.MessageType_JOIN) consumeNewMsgRemote(t, listener0, chat1.MessageType_LEAVE) consumeNewMsgRemote(t, listener1, chat1.MessageType_LEAVE) mustPostLocalForTest(t, ctc, users[0], channel, chat1.NewMessageBodyWithText(chat1.MessageText{ Body: "/flip", })) flipMsg := consumeNewMsgRemote(t, listener0, chat1.MessageType_FLIP) require.True(t, flipMsg.IsValid()) require.NotNil(t, flipMsg.Valid().FlipGameID) gameID := *flipMsg.Valid().FlipGameID consumeNewMsgRemote(t, listener1, chat1.MessageType_FLIP) res0 := consumeFlipToResult(t, ui0, listener0, gameID, 2) require.True(t, res0 == "HEADS" || res0 == "TAILS") res1 := consumeFlipToResult(t, ui1, listener1, gameID, 2) require.Equal(t, res0, res1) assertNoFlip(t, ui2) }) }
explode_data.jsonl/51273
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1411 }
[ 2830, 3393, 46808, 2043, 9629, 46808, 1155, 353, 8840, 836, 8, 341, 197, 322, 5978, 1172, 3613, 315, 264, 5496, 525, 5230, 304, 279, 18287, 198, 56742, 2354, 9366, 4173, 1155, 11, 2915, 81618, 6236, 16, 4801, 22323, 24371, 929, 8, 341...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestLastLineShort(t *testing.T) { filename, err := fs.TempFilenameWithText(shortText) assert.Nil(t, err) defer os.Remove(filename) val, err := LastLine(filename) assert.Nil(t, err) assert.Equal(t, "last line", val) }
explode_data.jsonl/37837
{ "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, 5842, 2460, 12472, 1155, 353, 8840, 836, 8, 341, 66434, 11, 1848, 1669, 8619, 65009, 20759, 2354, 1178, 37890, 1178, 340, 6948, 59678, 1155, 11, 1848, 340, 16867, 2643, 13270, 10961, 692, 19302, 11, 1848, 1669, 7996, 2460, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestBaremetalHostsSortByRole(t *testing.T) { cases := []struct { name string hosts []*baremetal.Host expectedHosts []string }{ { name: "default", hosts: []*baremetal.Host{ {Name: "master-0", Role: "master"}, {Name: "master-1", Role: "master"}, {Name: "master-2", Role: "master"}, {Name: "worker-0", Role: "worker"}, {Name: "worker-1", Role: "worker"}, }, expectedHosts: []string{ "master-0", "master-1", "master-2", "worker-0", "worker-1", }, }, { name: "norole", hosts: []*baremetal.Host{ {Name: "master-0"}, {Name: "master-1"}, {Name: "master-2"}, {Name: "worker-0"}, {Name: "worker-1"}, }, expectedHosts: []string{ "master-0", "master-1", "master-2", "worker-0", "worker-1", }, }, { name: "mixed", hosts: []*baremetal.Host{ {Name: "worker-0", Role: "worker"}, {Name: "master-0", Role: "master"}, {Name: "worker-1", Role: "worker"}, {Name: "master-1", Role: "master"}, {Name: "master-2", Role: "master"}, }, expectedHosts: []string{ "master-0", "master-1", "master-2", "worker-0", "worker-1", }, }, { name: "mixed-norole", hosts: []*baremetal.Host{ {Name: "worker-0", Role: "worker"}, {Name: "master-0", Role: "master"}, {Name: "worker-1", Role: ""}, {Name: "master-1", Role: "master"}, {Name: "master-2", Role: "master"}, }, expectedHosts: []string{ "master-0", "master-1", "master-2", "worker-0", "worker-1", }, }, } for _, tc := range cases { t.Run(tc.name, func(t *testing.T) { ic := &types.InstallConfig{ ObjectMeta: metav1.ObjectMeta{ Name: testClusterName, }, Platform: types.Platform{ BareMetal: &baremetal.Platform{ Hosts: tc.hosts, }, }, BaseDomain: "test", } SetPlatformDefaults(ic.Platform.BareMetal, ic) for i, h := range ic.Platform.BareMetal.Hosts { assert.Equal(t, h.Name, tc.expectedHosts[i]) } }) } }
explode_data.jsonl/71473
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 965 }
[ 2830, 3393, 33, 546, 54008, 9296, 82, 10231, 1359, 9030, 1155, 353, 8840, 836, 8, 341, 1444, 2264, 1669, 3056, 1235, 341, 197, 11609, 688, 914, 198, 197, 197, 44692, 260, 29838, 54102, 54008, 29840, 198, 197, 42400, 9296, 82, 3056, 91...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestResolveReferencesNoClusterServiceClass(t *testing.T) { fakeKubeClient, fakeCatalogClient, _, testController, _ := newTestController(t, noFakeActions()) instance := getTestServiceInstance() modified, err := testController.resolveReferences(instance) if err == nil { t.Fatalf("Should have failed with no service class") } if e, a := "a non-existent ClusterServiceClass", err.Error(); !strings.Contains(a, e) { t.Fatalf("Did not get the expected error message %q got %q", e, a) } if !modified { t.Fatalf("Should have returned true") } // We should get the following actions: // list call for ClusterServiceClass // update service instance condition for failure actions := fakeCatalogClient.Actions() assertNumberOfActions(t, actions, 2) listRestrictions := clientgotesting.ListRestrictions{ Labels: labels.Everything(), Fields: fields.OneTermEqualSelector("spec.externalName", instance.Spec.ClusterServiceClassExternalName), } assertList(t, actions[0], &v1beta1.ClusterServiceClass{}, listRestrictions) updatedServiceInstance := assertUpdateStatus(t, actions[1], instance) updatedObject, ok := updatedServiceInstance.(*v1beta1.ServiceInstance) if !ok { t.Fatalf("couldn't convert to *v1beta1.ServiceInstance") } if updatedObject.Spec.ClusterServiceClassRef != nil { t.Fatalf("ClusterServiceClassRef was unexpectedly set: %+v", updatedObject) } if updatedObject.Spec.ClusterServicePlanRef != nil { t.Fatalf("ClusterServicePlanRef was unexpectedly set: %+v", updatedObject) } // verify no kube resources created // One single action comes from getting namespace uid kubeActions := fakeKubeClient.Actions() assertNumberOfActions(t, kubeActions, 0) events := getRecordedEvents(testController) expectedEvent := warningEventBuilder(errorNonexistentClusterServiceClassReason).msg( fmt.Sprintf(`References a non-existent ClusterServiceClass %c or there is more than one (found: 0)`, instance.Spec.PlanReference)) if err := checkEvents(events, expectedEvent.stringArr()); err != nil { t.Fatal(err) } }
explode_data.jsonl/58185
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 639 }
[ 2830, 3393, 56808, 31712, 2753, 28678, 1860, 1957, 1155, 353, 8840, 836, 8, 341, 1166, 726, 42, 3760, 2959, 11, 12418, 41606, 2959, 11, 8358, 1273, 2051, 11, 716, 1669, 501, 2271, 2051, 1155, 11, 902, 52317, 12948, 12367, 56256, 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...
8
func TestCallback(t *testing.T) { policy := newRetryPolicy() called := false policy.ingest(&retryPolicyRequest{ data: []byte("tes"), ingestionURL: "http://google.com", httpRequest: func(data []byte, ingestionURL string) error { return nil }, callback: func(err error) { called = true }, }) time.Sleep(100) assert.True(t, called) }
explode_data.jsonl/40706
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 143 }
[ 2830, 3393, 7494, 1155, 353, 8840, 836, 8, 341, 3223, 8018, 1669, 501, 51560, 13825, 2822, 1444, 4736, 1669, 895, 198, 3223, 8018, 13, 287, 477, 2099, 44848, 13825, 1900, 515, 197, 8924, 25, 260, 3056, 3782, 445, 2338, 4461, 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 TestTTLStrategyFailed(t *testing.T) { var err error var un *unstructured.Unstructured var ten int32 = 10 controller := newTTLController() // Veirfy we do not enqueue if not completed wf := test.LoadWorkflowFromBytes([]byte(failedWf)) wf.Spec.TTLStrategy = &wfv1.TTLStrategy{SecondsAfterFailure: &ten} wf.Status.FinishedAt = metav1.Time{Time: controller.clock.Now().Add(-5 * time.Second)} un, err = util.ToUnstructured(wf) assert.NoError(t, err) controller.enqueueWF(un) assert.Equal(t, 0, controller.workqueue.Len()) wf1 := test.LoadWorkflowFromBytes([]byte(failedWf)) wf1.Spec.TTLStrategy = &wfv1.TTLStrategy{SecondsAfterFailure: &ten} wf1.Status.FinishedAt = metav1.Time{Time: controller.clock.Now().Add(-11 * time.Second)} un, err = util.ToUnstructured(wf1) assert.NoError(t, err) controller.enqueueWF(un) assert.Equal(t, 1, controller.workqueue.Len()) }
explode_data.jsonl/48743
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 349 }
[ 2830, 3393, 51, 13470, 19816, 9408, 1155, 353, 8840, 836, 8, 341, 2405, 1848, 1465, 198, 2405, 650, 353, 359, 51143, 10616, 51143, 198, 2405, 5779, 526, 18, 17, 284, 220, 16, 15, 271, 61615, 1669, 501, 51, 13470, 2051, 2822, 197, 32...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestRouterMixedParams(t *testing.T) { api := []*Route{ {http.MethodGet, "/teacher/:tid/room/suggestions", ""}, {http.MethodGet, "/teacher/:id", ""}, } testRouterAPI(t, api) api2 := []*Route{ {http.MethodGet, "/teacher/:id", ""}, {http.MethodGet, "/teacher/:tid/room/suggestions", ""}, } testRouterAPI(t, api2) }
explode_data.jsonl/47135
{ "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, 9523, 86433, 4870, 1155, 353, 8840, 836, 8, 341, 54299, 1669, 29838, 4899, 515, 197, 197, 90, 1254, 20798, 1949, 11, 3521, 23360, 11315, 24449, 14, 2966, 2687, 37882, 497, 77496, 197, 197, 90, 1254, 20798, 1949, 11, 3521, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestDeleteRef(t *testing.T) { ts := httptest.NewTLSServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { if r.Method != http.MethodDelete { t.Errorf("Bad method: %s", r.Method) } if r.URL.Path != "/repos/k8s/kuber/git/refs/heads/my-feature" { t.Errorf("Bad request path: %s", r.URL.Path) } http.Error(w, "204 No Content", http.StatusNoContent) })) defer ts.Close() c := getClient(ts.URL) if err := c.DeleteRef("k8s", "kuber", "heads/my-feature"); err != nil { t.Errorf("Didn't expect error: %v", err) } }
explode_data.jsonl/6256
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 237 }
[ 2830, 3393, 6435, 3945, 1155, 353, 8840, 836, 8, 341, 57441, 1669, 54320, 70334, 7121, 13470, 1220, 2836, 19886, 89164, 18552, 3622, 1758, 37508, 11, 435, 353, 1254, 9659, 8, 341, 197, 743, 435, 20798, 961, 1758, 20798, 6435, 341, 298, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestResourcePermissionsCreate_NotebookPath_NotExists(t *testing.T) { _, err := qa.ResourceFixture{ Fixtures: []qa.HTTPFixture{ { Method: http.MethodGet, Resource: "/api/2.0/workspace/get-status?path=%2FDevelopment%2FInit", Response: common.APIErrorBody{ ErrorCode: "INVALID_REQUEST", Message: "Internal error happened", }, Status: 400, }, }, Resource: ResourcePermissions(), State: map[string]interface{}{ "notebook_path": "/Development/Init", "access_control": []interface{}{ map[string]interface{}{ "user_name": TestingUser, "permission_level": "CAN_USE", }, }, }, Create: true, }.Apply(t) assert.Error(t, err) }
explode_data.jsonl/50882
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 308 }
[ 2830, 3393, 4783, 23851, 4021, 1604, 1272, 2190, 1820, 60816, 15575, 1155, 353, 8840, 836, 8, 341, 197, 6878, 1848, 1669, 88496, 20766, 18930, 515, 197, 12727, 941, 18513, 25, 3056, 15445, 27358, 18930, 515, 298, 197, 515, 571, 84589, 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 TestShutdownMultipleErrors(t *testing.T) { f := newFixture(t) shutdownErrs := []error{errors.New("err1"), nil, errors.New("err3")} // Add mock httpListeners to the server for _, err := range shutdownErrs { m := &mockHTTPListener{} if err != nil { retVal := errors.New(err.Error()) m.ShutdownHook = func() error { return retVal } } f.server.httpListeners = append(f.server.httpListeners, m) } ctx, cancel := context.WithTimeout(context.Background(), time.Duration(5)*time.Second) defer cancel() err := f.server.Shutdown(ctx) if err == nil { t.Fatal("expected an error shutting down server but err==nil") } for _, expectedErr := range shutdownErrs { if expectedErr != nil && !strings.Contains(err.Error(), expectedErr.Error()) { t.Errorf("expected error message to contain '%s', full message: '%s'", expectedErr.Error(), err.Error()) } } }
explode_data.jsonl/79036
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 330 }
[ 2830, 3393, 62004, 32089, 13877, 1155, 353, 8840, 836, 8, 341, 1166, 1669, 501, 18930, 1155, 692, 36196, 18452, 7747, 82, 1669, 3056, 841, 90, 7650, 7121, 445, 615, 16, 3975, 2092, 11, 5975, 7121, 445, 615, 18, 899, 630, 197, 322, 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 TestEnsureRemoveAllWithFile(t *testing.T) { tmp, err := os.CreateTemp("", "test-ensure-removeall-with-dir") if err != nil { t.Fatal(err) } tmp.Close() if err := ensureRemoveAll(context.Background(), tmp.Name()); err != nil { t.Fatal(err) } }
explode_data.jsonl/8832
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 103 }
[ 2830, 3393, 64439, 13021, 2403, 2354, 1703, 1155, 353, 8840, 836, 8, 341, 20082, 11, 1848, 1669, 2643, 7251, 12151, 19814, 330, 1944, 12, 27289, 48625, 541, 26189, 45283, 1138, 743, 1848, 961, 2092, 341, 197, 3244, 26133, 3964, 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 TestIncompatibleMemoryStorageForProduction(t *testing.T) { jaeger := &v1.Jaeger{ Spec: v1.JaegerSpec{ Strategy: v1.DeploymentStrategyProduction, Storage: v1.JaegerStorageSpec{ Type: "memory", }, }, } normalize(context.Background(), jaeger) assert.Equal(t, v1.DeploymentStrategyAllInOne, jaeger.Spec.Strategy) }
explode_data.jsonl/21847
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 140 }
[ 2830, 3393, 641, 34842, 10642, 5793, 2461, 44967, 1155, 353, 8840, 836, 8, 341, 197, 5580, 1878, 1669, 609, 85, 16, 3503, 64, 1878, 515, 197, 7568, 992, 25, 348, 16, 3503, 64, 1878, 8327, 515, 298, 197, 19816, 25, 348, 16, 34848, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestSegmentMerging(t *testing.T) { tests := []struct { name string stop func(tcpip.Endpoint) resume func(tcpip.Endpoint) }{ { "stop work", func(ep tcpip.Endpoint) { ep.(interface{ StopWork() }).StopWork() }, func(ep tcpip.Endpoint) { ep.(interface{ ResumeWork() }).ResumeWork() }, }, { "cork", func(ep tcpip.Endpoint) { ep.SetSockOpt(tcpip.CorkOption(1)) }, func(ep tcpip.Endpoint) { ep.SetSockOpt(tcpip.CorkOption(0)) }, }, } for _, test := range tests { t.Run(test.name, func(t *testing.T) { c := context.New(t, defaultMTU) defer c.Cleanup() c.CreateConnected(789, 30000, nil) // Prevent the endpoint from processing packets. test.stop(c.EP) var allData []byte for i, data := range [][]byte{{1, 2, 3, 4}, {5, 6, 7}, {8, 9}, {10}, {11}} { allData = append(allData, data...) view := buffer.NewViewFromBytes(data) if _, _, err := c.EP.Write(tcpip.SlicePayload(view), tcpip.WriteOptions{}); err != nil { t.Fatalf("Write #%d failed: %v", i+1, err) } } // Let the endpoint process the segments that we just sent. test.resume(c.EP) // Check that data is received. b := c.GetPacket() checker.IPv4(t, b, checker.PayloadLen(len(allData)+header.TCPMinimumSize), checker.TCP( checker.DstPort(context.TestPort), checker.SeqNum(uint32(c.IRS)+1), checker.AckNum(790), checker.TCPFlagsMatch(header.TCPFlagAck, ^uint8(header.TCPFlagPsh)), ), ) if got := b[header.IPv4MinimumSize+header.TCPMinimumSize:]; !bytes.Equal(got, allData) { t.Fatalf("got data = %v, want = %v", got, allData) } // Acknowledge the data. c.SendPacket(nil, &context.Headers{ SrcPort: context.TestPort, DstPort: c.Port, Flags: header.TCPFlagAck, SeqNum: 790, AckNum: c.IRS.Add(1 + seqnum.Size(len(allData))), RcvWnd: 30000, }) }) } }
explode_data.jsonl/22296
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 925 }
[ 2830, 3393, 21086, 44, 95296, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 3056, 1235, 341, 197, 11609, 256, 914, 198, 197, 62644, 256, 2915, 98203, 573, 90409, 340, 197, 10202, 3885, 2915, 98203, 573, 90409, 340, 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...
1
func TestGormDBCreateGroupTwice(t *testing.T) { db, cleanup := qtest.TestDB(t) defer cleanup() admin := qtest.CreateFakeUser(t, db, 10) course := &pb.Course{} qtest.CreateCourse(t, db, admin, course) var users []*pb.User enrollments := []pb.Enrollment_UserStatus{pb.Enrollment_STUDENT, pb.Enrollment_STUDENT} // create as many users as the desired number of enrollments for i := 0; i < len(enrollments); i++ { user := qtest.CreateFakeUser(t, db, uint64(i)) users = append(users, user) if enrollments[i] == pb.Enrollment_PENDING { continue } // enroll users in course if err := db.CreateEnrollment(&pb.Enrollment{ CourseID: course.ID, UserID: users[i].ID, }); err != nil { t.Fatal(err) } err := errors.New("enrollment status not implemented") switch enrollments[i] { case pb.Enrollment_STUDENT: query := &pb.Enrollment{ UserID: users[i].ID, CourseID: course.ID, Status: pb.Enrollment_STUDENT, } err = db.UpdateEnrollment(query) } if err != nil { t.Fatal(err) } } // Try to create two identical groups. The first should succeed while // further attempts should fail with ErrDuplicateGroup. identical := &pb.Group{ Name: "SameNameGroup", CourseID: course.ID, Users: users, } if err := db.CreateGroup(identical); err != nil { t.Fatal(err) } if err := db.CreateGroup(identical); err != database.ErrDuplicateGroup { t.Fatalf("expected error '%v' have '%v'", database.ErrDuplicateGroup, err) } }
explode_data.jsonl/13562
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 605 }
[ 2830, 3393, 38, 493, 3506, 4021, 2808, 22816, 558, 1155, 353, 8840, 836, 8, 341, 20939, 11, 21290, 1669, 2804, 1944, 8787, 3506, 1155, 340, 16867, 21290, 2822, 64394, 1669, 2804, 1944, 7251, 52317, 1474, 1155, 11, 2927, 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, 1...
8
func TestEnvVarVersion(t *testing.T) { for _, format := range formats { format := format t.Run(fmt.Sprintf("amd64-%s", format), func(t *testing.T) { os.Setenv("SEMVER", "v1.0.0-0.1.b1+git.abcdefgh") accept(t, acceptParms{ Name: fmt.Sprintf("env-var-version_%s", format), Conf: "env-var-version.yaml", Format: format, Dockerfile: fmt.Sprintf("%s.env-var-version.dockerfile", format), }) }) } }
explode_data.jsonl/15458
{ "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, 14359, 3962, 5637, 1155, 353, 8840, 836, 8, 341, 2023, 8358, 3561, 1669, 2088, 19856, 341, 197, 59416, 1669, 3561, 198, 197, 3244, 16708, 28197, 17305, 445, 67913, 21, 19, 11069, 82, 497, 3561, 701, 2915, 1155, 353, 8840, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestLoadConfigFrom_IgnoresMainConfigFileIfMissing(t *testing.T) { assert := assertlib.New(t) appenv.SetDefaultEnvToTest() // to ensure it tries to find the config.test file // create a temp config file tmpFile, deferFunc := createTmpFile("config-*.test.yaml", assert) defer deferFunc() fileName := filepath.Base(tmpFile.Name()) configName := fileName[:len(fileName)-10] // strip the ".test.yaml" conf := loadConfigFrom(configName, os.TempDir()) assert.NotNil(conf) }
explode_data.jsonl/61934
{ "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, 5879, 2648, 3830, 7959, 70, 2152, 416, 6202, 2648, 1703, 2679, 25080, 1155, 353, 8840, 836, 8, 341, 6948, 1669, 2060, 2740, 7121, 1155, 340, 28236, 3160, 4202, 3675, 14359, 1249, 2271, 368, 442, 311, 5978, 432, 16297, 311, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestGetName(t *testing.T) { testCases := []struct { desc string cookieName string backendName string expectedCookieName string }{ { desc: "with backend name, without cookie name", cookieName: "", backendName: "/my/BACKEND-v1.0~rc1", expectedCookieName: "_5f7bc", }, { desc: "without backend name, with cookie name", cookieName: "/my/BACKEND-v1.0~rc1", backendName: "", expectedCookieName: "_my_BACKEND-v1.0~rc1", }, { desc: "with backend name, with cookie name", cookieName: "containous", backendName: "treafik", expectedCookieName: "containous", }, } for _, test := range testCases { test := test t.Run(test.desc, func(t *testing.T) { t.Parallel() cookieName := GetName(test.cookieName, test.backendName) assert.Equal(t, test.expectedCookieName, cookieName) }) } }
explode_data.jsonl/58887
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 475 }
[ 2830, 3393, 49403, 1155, 353, 8840, 836, 8, 341, 18185, 37302, 1669, 3056, 1235, 341, 197, 41653, 2290, 914, 198, 197, 197, 16236, 675, 260, 914, 198, 197, 197, 20942, 675, 286, 914, 198, 197, 42400, 20616, 675, 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...
1
func TestListGatewayResourceType(t *testing.T) { g := NewWithT(t) clientSet := kube.NewFakeClient() store := memory.NewController(memory.Make(collections.All)) controller := NewController(clientSet, store, controller2.Options{}) gwClassType := collections.K8SServiceApisV1Alpha1Gatewayclasses.Resource() gwSpecType := collections.K8SServiceApisV1Alpha1Gateways.Resource() k8sHTTPRouteType := collections.K8SServiceApisV1Alpha1Httproutes.Resource() store.Create(config.Config{ Meta: config.Meta{ GroupVersionKind: gwClassType.GroupVersionKind(), Name: "gwclass", Namespace: "ns1", }, Spec: gatewayClassSpec, }) if _, err := store.Create(config.Config{ Meta: config.Meta{ GroupVersionKind: gwSpecType.GroupVersionKind(), Name: "gwspec", Namespace: "ns1", }, Spec: gatewaySpec, }); err != nil { t.Fatal(err) } store.Create(config.Config{ Meta: config.Meta{ GroupVersionKind: k8sHTTPRouteType.GroupVersionKind(), Name: "http-route", Namespace: "ns1", }, Spec: httpRouteSpec, }) g.Expect(controller.Recompute()).ToNot(HaveOccurred()) cfg, err := controller.List(gvk.Gateway, "ns1") g.Expect(err).ToNot(HaveOccurred()) g.Expect(cfg).To(HaveLen(1)) for _, c := range cfg { g.Expect(c.GroupVersionKind).To(Equal(gvk.Gateway)) g.Expect(c.Name).To(Equal("gwspec" + "-" + constants.KubernetesGatewayName)) g.Expect(c.Namespace).To(Equal("ns1")) g.Expect(c.Spec).To(Equal(expectedgw)) } }
explode_data.jsonl/61230
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 653 }
[ 2830, 3393, 852, 40709, 4783, 929, 1155, 353, 8840, 836, 8, 341, 3174, 1669, 1532, 2354, 51, 1155, 692, 25291, 1649, 1669, 80958, 7121, 52317, 2959, 741, 57279, 1669, 4938, 7121, 2051, 63230, 50133, 1337, 3107, 16764, 1171, 61615, 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...
3
func TestPopulateSubjectFromCSR(t *testing.T) { // a subject with all its fields full. fullSubject := &signer.Subject{ CN: "CN", Names: []csr.Name{ { C: "C", ST: "ST", L: "L", O: "O", OU: "OU", }, }, SerialNumber: "deadbeef", } fullName := pkix.Name{ CommonName: "CommonName", Country: []string{"Country"}, Province: []string{"Province"}, Organization: []string{"Organization"}, OrganizationalUnit: []string{"OrganizationalUnit"}, SerialNumber: "SerialNumber", } noCN := *fullSubject noCN.CN = "" name := PopulateSubjectFromCSR(&noCN, fullName) if name.CommonName != "CommonName" { t.Fatal("Failed to replace empty common name") } noC := *fullSubject noC.Names[0].C = "" name = PopulateSubjectFromCSR(&noC, fullName) if !reflect.DeepEqual(name.Country, fullName.Country) { t.Fatal("Failed to replace empty country") } noL := *fullSubject noL.Names[0].L = "" name = PopulateSubjectFromCSR(&noL, fullName) if !reflect.DeepEqual(name.Locality, fullName.Locality) { t.Fatal("Failed to replace empty locality") } noO := *fullSubject noO.Names[0].O = "" name = PopulateSubjectFromCSR(&noO, fullName) if !reflect.DeepEqual(name.Organization, fullName.Organization) { t.Fatal("Failed to replace empty organization") } noOU := *fullSubject noOU.Names[0].OU = "" name = PopulateSubjectFromCSR(&noOU, fullName) if !reflect.DeepEqual(name.OrganizationalUnit, fullName.OrganizationalUnit) { t.Fatal("Failed to replace empty organizational unit") } noSerial := *fullSubject noSerial.SerialNumber = "" name = PopulateSubjectFromCSR(&noSerial, fullName) if name.SerialNumber != fullName.SerialNumber { t.Fatalf("Failed to replace empty serial number: want %#v, got %#v", fullName.SerialNumber, name.SerialNumber) } }
explode_data.jsonl/71282
{ "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, 11598, 6334, 13019, 3830, 70022, 1155, 353, 8840, 836, 8, 341, 197, 322, 264, 3832, 448, 678, 1181, 5043, 2480, 624, 94042, 13019, 1669, 609, 7752, 261, 57388, 515, 197, 6258, 45, 25, 330, 28668, 756, 197, 197, 7980, 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...
7
func TestGameScriptWinO(t *testing.T) { script := []tttPb.MoveTrxPayload{ {Position: 0, Mark: tttPb.Mark_X}, {Position: 1, Mark: tttPb.Mark_O}, {Position: 4, Mark: tttPb.Mark_X}, {Position: 8, Mark: tttPb.Mark_O}, {Position: 3, Mark: tttPb.Mark_X}, {Position: 5, Mark: tttPb.Mark_O}, {Position: 7, Mark: tttPb.Mark_X}, {Position: 2, Mark: tttPb.Mark_O}, } stub := initContract(t) _, err := runScriptAndCheckLastState(script, tttPb.TttContract_OWON, stub) if err != nil { t.Fatal(err.Error()) } }
explode_data.jsonl/67452
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 248 }
[ 2830, 3393, 4868, 5910, 16970, 46, 1155, 353, 8840, 836, 8, 341, 86956, 1669, 3056, 5566, 83, 47, 65, 31195, 1282, 87, 29683, 515, 197, 197, 90, 3812, 25, 220, 15, 11, 4389, 25, 259, 5566, 47, 65, 75888, 6859, 1583, 197, 197, 90, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestContainingPackage(t *testing.T) { // unvirtualized: goroot := runtime.GOROOT() gopath := gopathContainingTools(t) type Test struct { gopath, filename, wantPkg string } tests := []Test{ {gopath, goroot + "/src/fmt/print.go", "fmt"}, {gopath, goroot + "/src/encoding/json/foo.go", "encoding/json"}, {gopath, goroot + "/src/encoding/missing/foo.go", "(not found)"}, {gopath, gopath + "/src/golang.org/x/tools/go/buildutil/util_test.go", "golang.org/x/tools/go/buildutil"}, } if runtime.GOOS != "windows" && runtime.GOOS != "plan9" { // Make a symlink to gopath for test tmp, err := ioutil.TempDir(os.TempDir(), "go") if err != nil { t.Errorf("Unable to create a temporary directory in %s", os.TempDir()) } defer os.RemoveAll(tmp) // symlink between $GOPATH/src and /tmp/go/src // in order to test all possible symlink cases if err := os.Symlink(gopath+"/src", tmp+"/src"); err != nil { t.Fatal(err) } tests = append(tests, []Test{ {gopath, tmp + "/src/golang.org/x/tools/go/buildutil/util_test.go", "golang.org/x/tools/go/buildutil"}, {tmp, gopath + "/src/golang.org/x/tools/go/buildutil/util_test.go", "golang.org/x/tools/go/buildutil"}, {tmp, tmp + "/src/golang.org/x/tools/go/buildutil/util_test.go", "golang.org/x/tools/go/buildutil"}, }...) } for _, test := range tests { var got string var buildContext = build.Default buildContext.GOPATH = test.gopath bp, err := buildutil.ContainingPackage(&buildContext, ".", test.filename) if err != nil { got = "(not found)" } else { got = bp.ImportPath } if got != test.wantPkg { t.Errorf("ContainingPackage(%q) = %s, want %s", test.filename, got, test.wantPkg) } } // TODO(adonovan): test on virtualized GOPATH too. }
explode_data.jsonl/27876
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 739 }
[ 2830, 3393, 86641, 13100, 1155, 353, 8840, 836, 8, 341, 197, 322, 650, 25668, 1506, 510, 3174, 269, 1905, 1669, 15592, 1224, 868, 53837, 741, 3174, 35111, 1669, 342, 35111, 86641, 16583, 1155, 692, 13158, 3393, 2036, 341, 197, 3174, 351...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestGenerateNonce(t *testing.T) { expect := []byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} tmp := []byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} assert.Equal(t, expect, generateNonce(tmp, 0)) expect = []byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01} assert.Equal(t, expect, generateNonce(tmp, 1)) expect = []byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02} assert.Equal(t, expect, generateNonce(tmp, 2)) expect = []byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03} assert.Equal(t, expect, generateNonce(tmp, 3)) tmp = []byte{0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0, 0x12, 0x34, 0x56, 0x78} expect = []byte{0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0, 0xed, 0xcb, 0xa9, 0x87} assert.Equal(t, expect, generateNonce(tmp, 0xffffffff)) }
explode_data.jsonl/16992
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 506 }
[ 2830, 3393, 31115, 90528, 1155, 353, 8840, 836, 8, 341, 24952, 1669, 3056, 3782, 90, 15, 87, 15, 15, 11, 220, 15, 87, 15, 15, 11, 220, 15, 87, 15, 15, 11, 220, 15, 87, 15, 15, 11, 220, 15, 87, 15, 15, 11, 220, 15, 87, 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 TestUpdateInterval(t *testing.T) { tests := []struct { name string request *http.Request dbMock interfaces.DBClient scClient interfaces.SchedulerQueueClient expectedStatus int }{ { name: "OK", request: createRequestIntervalUpdate(intervalForAdd), dbMock: createMockIntervalLoaderUpdateSuccess(), scClient: createMockIntervalLoaderSCUpdateSuccess(), expectedStatus: http.StatusOK, }, { name: "ErrInvalidTimeFormat", request: createRequestIntervalUpdate(intervalForAddInvalidTime), dbMock: createMockIntervalLoaderUpdateSuccess(), scClient: createMockIntervalLoaderSCUpdateSuccess(), expectedStatus: http.StatusBadRequest, }, { name: "ErrIntervalNotFound", request: createRequestIntervalUpdate(intervalForAdd), dbMock: createMockIntervalLoaderUpdateNotFound(), scClient: createMockIntervalLoaderSCUpdateSuccess(), expectedStatus: http.StatusNotFound, }, { name: "ErrInvalidCronFormat", request: createRequestIntervalUpdate(intervalForUpdateInvalidCron), dbMock: createMockIntervalLoaderUpdateInvalidCron(), scClient: createMockIntervalLoaderSCUpdateSuccess(), expectedStatus: http.StatusBadRequest, }, { name: "ErrInvalidFrequencyFormat", request: createRequestIntervalUpdate(intervalForAddInvalidFreq), dbMock: createMockIntervalLoaderUpdateSuccess(), scClient: createMockIntervalLoaderSCUpdateSuccess(), expectedStatus: http.StatusBadRequest, }, { name: "ErrIntervalNameInUse", request: createRequestIntervalUpdate(intervalForAdd), dbMock: createMockIntervalLoaderUpdateNameUsed(), scClient: createMockIntervalLoaderSCUpdateSuccess(), expectedStatus: http.StatusBadRequest, }, { name: "ErrIntervalStillUsedByIntervalActions", request: createRequestIntervalUpdate(intervalForAdd), dbMock: createMockIntervalLoaderUpdateNameStillUsed(), scClient: createMockIntervalLoaderSCUpdateSuccess(), expectedStatus: http.StatusBadRequest, }, { name: "Unexpected Error", request: createRequestIntervalUpdate(intervalForAdd), dbMock: createMockIntervalLoaderUpdateErr(), scClient: createMockIntervalLoadeSCUpdateErr(), expectedStatus: http.StatusServiceUnavailable, }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { rr := httptest.NewRecorder() restUpdateInterval(rr, tt.request, logger.NewMockClient(), tt.dbMock, tt.scClient) response := rr.Result() if response.StatusCode != tt.expectedStatus { t.Errorf("status code mismatch -- expected %v got %v", tt.expectedStatus, response.StatusCode) return } }) } }
explode_data.jsonl/51571
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1208 }
[ 2830, 3393, 4289, 10256, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 3056, 1235, 341, 197, 11609, 1843, 914, 198, 197, 23555, 286, 353, 1254, 9659, 198, 197, 20939, 11571, 260, 24099, 22537, 2959, 198, 197, 29928, 2959, 981, 24099, 808, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestExporterTraceDataCallbackSingleSpan(t *testing.T) { mockTransportChannel := getMockTransportChannel() exporter := getExporter(defaultConfig, mockTransportChannel) // re-use some test generation method(s) from trace_to_envelope_test resource := getResource() instrumentationLibrary := getInstrumentationLibrary() span := getDefaultHTTPServerSpan() traces := pdata.NewTraces() traces.ResourceSpans().Resize(1) rs := traces.ResourceSpans().At(0) r := rs.Resource() resource.CopyTo(r) rs.InstrumentationLibrarySpans().Resize(1) ilss := rs.InstrumentationLibrarySpans().At(0) instrumentationLibrary.CopyTo(ilss.InstrumentationLibrary()) ilss.Spans().Resize(1) span.CopyTo(ilss.Spans().At(0)) droppedSpans, err := exporter.onTraceData(context.Background(), traces) assert.Nil(t, err) assert.Equal(t, 0, droppedSpans) mockTransportChannel.AssertNumberOfCalls(t, "Send", 1) }
explode_data.jsonl/74429
{ "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, 88025, 6550, 1043, 7494, 10888, 12485, 1155, 353, 8840, 836, 8, 341, 77333, 27560, 9629, 1669, 633, 11571, 27560, 9629, 741, 59440, 261, 1669, 633, 88025, 18978, 2648, 11, 7860, 27560, 9629, 692, 197, 322, 312, 24673, 1045, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestCEKFactory(t *testing.T) { key, _ := hex.DecodeString("31bdadd96698c204aa9ce1448ea94ae1fb4a9a0b3c9d773b51bb1822666b8f22") keyB64 := base64.URLEncoding.EncodeToString(key) ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { fmt.Fprintln(w, fmt.Sprintf("%s%s%s", `{"KeyId":"test-key-id","Plaintext":"`, keyB64, `"}`)) })) defer ts.Close() sess := unit.Session.Copy(&aws.Config{ MaxRetries: aws.Int(0), Endpoint: aws.String(ts.URL), DisableSSL: aws.Bool(true), S3ForcePathStyle: aws.Bool(true), Region: aws.String("us-west-2"), }) o := DecryptionClientOptions{ CryptoRegistry: initCryptoRegistryFrom(map[string]WrapEntry{ KMSWrap: (kmsKeyHandler{ kms: kms.New(sess), }).decryptHandler, }, map[string]CEKEntry{ AESGCMNoPadding: newAESGCMContentCipher, }, map[string]Padder{ NoPadder.Name(): NoPadder, }), } iv, err := hex.DecodeString("0d18e06c7c725ac9e362e1ce") if err != nil { t.Errorf("expected no error, but received %v", err) } ivB64 := base64.URLEncoding.EncodeToString(iv) cipherKey, err := hex.DecodeString("31bdadd96698c204aa9ce1448ea94ae1fb4a9a0b3c9d773b51bb1822666b8f22") if err != nil { t.Errorf("expected no error, but received %v", err) } cipherKeyB64 := base64.URLEncoding.EncodeToString(cipherKey) env := Envelope{ WrapAlg: KMSWrap, CEKAlg: AESGCMNoPadding, CipherKey: cipherKeyB64, IV: ivB64, MatDesc: `{"kms_cmk_id":""}`, } wrap, err := wrapFromEnvelope(o, env) cek, err := cekFromEnvelope(o, aws.BackgroundContext(), env, wrap) if err != nil { t.Errorf("expected no error, but received %v", err) } if cek == nil { t.Errorf("expected non-nil cek") } }
explode_data.jsonl/63024
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 819 }
[ 2830, 3393, 2104, 42, 4153, 1155, 353, 8840, 836, 8, 341, 23634, 11, 716, 1669, 12371, 56372, 703, 445, 18, 16, 8940, 718, 24, 21, 21, 24, 23, 66, 17, 15, 19, 5305, 24, 346, 16, 19, 19, 23, 12508, 24, 19, 5918, 16, 10798, 19, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestSet_Iterator(t *testing.T) { gtest.C(t, func(t *gtest.T) { s := gset.NewSet() s.Add(1, 2, 3) t.Assert(s.Size(), 3) a1 := garray.New(true) a2 := garray.New(true) s.Iterator(func(v interface{}) bool { a1.Append(1) return false }) s.Iterator(func(v interface{}) bool { a2.Append(1) return true }) t.Assert(a1.Len(), 1) t.Assert(a2.Len(), 3) }) }
explode_data.jsonl/34380
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 205 }
[ 2830, 3393, 1649, 7959, 465, 850, 1155, 353, 8840, 836, 8, 341, 3174, 1944, 727, 1155, 11, 2915, 1155, 353, 82038, 836, 8, 341, 197, 1903, 1669, 342, 746, 7121, 1649, 741, 197, 1903, 1904, 7, 16, 11, 220, 17, 11, 220, 18, 340, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestHcwalletChainSvrWsNtfns(t *testing.T) { t.Parallel() tests := []struct { name string newNtfn func() (interface{}, error) staticNtfn func() interface{} marshalled string unmarshalled interface{} }{ { name: "ticketpurchase", newNtfn: func() (interface{}, error) { return hcjson.NewCmd("ticketpurchased", "123", 5) }, staticNtfn: func() interface{} { return hcjson.NewTicketPurchasedNtfn("123", 5) }, marshalled: `{"jsonrpc":"1.0","method":"ticketpurchased","params":["123",5],"id":null}`, unmarshalled: &hcjson.TicketPurchasedNtfn{ TxHash: "123", Amount: 5, }, }, { name: "votecreated", newNtfn: func() (interface{}, error) { return hcjson.NewCmd("votecreated", "123", "1234", 100, "12345", 1) }, staticNtfn: func() interface{} { return hcjson.NewVoteCreatedNtfn("123", "1234", 100, "12345", 1) }, marshalled: `{"jsonrpc":"1.0","method":"votecreated","params":["123","1234",100,"12345",1],"id":null}`, unmarshalled: &hcjson.VoteCreatedNtfn{ TxHash: "123", BlockHash: "1234", Height: 100, SStxIn: "12345", VoteBits: 1, }, }, { name: "revocationcreated", newNtfn: func() (interface{}, error) { return hcjson.NewCmd("revocationcreated", "123", "1234") }, staticNtfn: func() interface{} { return hcjson.NewRevocationCreatedNtfn("123", "1234") }, marshalled: `{"jsonrpc":"1.0","method":"revocationcreated","params":["123","1234"],"id":null}`, unmarshalled: &hcjson.RevocationCreatedNtfn{ TxHash: "123", SStxIn: "1234", }, }, { name: "winningtickets", newNtfn: func() (interface{}, error) { return hcjson.NewCmd("winningtickets", "123", 100, map[string]string{"a": "b"}) }, staticNtfn: func() interface{} { return hcjson.NewWinningTicketsNtfn("123", 100, map[string]string{"a": "b"}) }, marshalled: `{"jsonrpc":"1.0","method":"winningtickets","params":["123",100,{"a":"b"}],"id":null}`, unmarshalled: &hcjson.WinningTicketsNtfn{ BlockHash: "123", BlockHeight: 100, Tickets: map[string]string{"a": "b"}, }, }, { name: "spentandmissedtickets", newNtfn: func() (interface{}, error) { return hcjson.NewCmd("spentandmissedtickets", "123", 100, 3, map[string]string{"a": "b"}) }, staticNtfn: func() interface{} { return hcjson.NewSpentAndMissedTicketsNtfn("123", 100, 3, map[string]string{"a": "b"}) }, marshalled: `{"jsonrpc":"1.0","method":"spentandmissedtickets","params":["123",100,3,{"a":"b"}],"id":null}`, unmarshalled: &hcjson.SpentAndMissedTicketsNtfn{ Hash: "123", Height: 100, StakeDiff: 3, Tickets: map[string]string{"a": "b"}, }, }, { name: "newtickets", newNtfn: func() (interface{}, error) { return hcjson.NewCmd("newtickets", "123", 100, 3, []string{"a", "b"}) }, staticNtfn: func() interface{} { return hcjson.NewNewTicketsNtfn("123", 100, 3, []string{"a", "b"}) }, marshalled: `{"jsonrpc":"1.0","method":"newtickets","params":["123",100,3,["a","b"]],"id":null}`, unmarshalled: &hcjson.NewTicketsNtfn{ Hash: "123", Height: 100, StakeDiff: 3, Tickets: []string{"a", "b"}, }, }, } t.Logf("Running %d tests", len(tests)) for i, test := range tests { // Marshal the notification as created by the new static // creation function. The ID is nil for notifications. marshalled, err := hcjson.MarshalCmd(nil, test.staticNtfn()) if err != nil { t.Errorf("MarshalCmd #%d (%s) unexpected error: %v", i, test.name, err) continue } if !bytes.Equal(marshalled, []byte(test.marshalled)) { t.Errorf("Test #%d (%s) unexpected marshalled data - "+ "got %s, want %s", i, test.name, marshalled, test.marshalled) continue } // Ensure the notification is created without error via the // generic new notification creation function. cmd, err := test.newNtfn() if err != nil { t.Errorf("Test #%d (%s) unexpected NewCmd error: %v ", i, test.name, err) } // Marshal the notification as created by the generic new // notification creation function. The ID is nil for // notifications. marshalled, err = hcjson.MarshalCmd(nil, cmd) if err != nil { t.Errorf("MarshalCmd #%d (%s) unexpected error: %v", i, test.name, err) continue } if !bytes.Equal(marshalled, []byte(test.marshalled)) { t.Errorf("Test #%d (%s) unexpected marshalled data - "+ "got %s, want %s", i, test.name, marshalled, test.marshalled) continue } var request hcjson.Request if err := json.Unmarshal(marshalled, &request); err != nil { t.Errorf("Test #%d (%s) unexpected error while "+ "unmarshalling JSON-RPC request: %v", i, test.name, err) continue } cmd, err = hcjson.UnmarshalCmd(&request) if err != nil { t.Errorf("UnmarshalCmd #%d (%s) unexpected error: %v", i, test.name, err) continue } if !reflect.DeepEqual(cmd, test.unmarshalled) { t.Errorf("Test #%d (%s) unexpected unmarshalled command "+ "- got %s, want %s", i, test.name, fmt.Sprintf("(%T) %+[1]v", cmd), fmt.Sprintf("(%T) %+[1]v\n", test.unmarshalled)) continue } } }
explode_data.jsonl/14911
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 2338 }
[ 2830, 3393, 39, 66, 35735, 18837, 50, 18920, 74733, 45, 8935, 4412, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 2822, 78216, 1669, 3056, 1235, 341, 197, 11609, 260, 914, 198, 197, 8638, 45, 83, 8822, 414, 2915, 368, 320, 4970, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestBoltDBCache(t *testing.T) { tempDir, err := ioutil.TempDir("", "httpcache") if err != nil { t.Fatalf("TempDir: %v", err) } defer os.RemoveAll(tempDir) cache, err := bbolt.New(filepath.Join(tempDir, "db")) if err != nil { t.Fatalf("bbolt.New(): %v", err) } key := "testKey" _, ok := cache.Get(key) if ok { t.Fatal("retrieved key before adding it") } val := []byte("some bytes") cache.Set(key, val) retVal, ok := cache.Get(key) if !ok { t.Fatal("could not retrieve an element we just added") } if !bytes.Equal(retVal, val) { t.Fatal("retrieved a different value than what we put in") } cache.Delete(key) _, ok = cache.Get(key) if ok { t.Fatal("deleted key still present") } }
explode_data.jsonl/68570
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 305 }
[ 2830, 3393, 33, 6181, 3506, 8233, 1155, 353, 8840, 836, 8, 341, 16280, 6184, 11, 1848, 1669, 43144, 65009, 6184, 19814, 330, 1254, 9360, 1138, 743, 1848, 961, 2092, 341, 197, 3244, 30762, 445, 12151, 6184, 25, 1018, 85, 497, 1848, 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 TestParseFieldWithFromIdentifier(t *testing.T) { t.Parallel() result, errs := ParseProgram(` struct S { let from: String } `) require.Empty(t, errs) utils.AssertEqualWithDiff(t, []ast.Declaration{ &ast.CompositeDeclaration{ Access: ast.AccessNotSpecified, CompositeKind: common.CompositeKindStructure, Identifier: ast.Identifier{ Identifier: "S", Pos: ast.Position{Offset: 14, Line: 2, Column: 13}, }, Members: ast.NewMembers( []ast.Declaration{ &ast.FieldDeclaration{ Access: ast.AccessNotSpecified, VariableKind: ast.VariableKindConstant, Identifier: ast.Identifier{ Identifier: "from", Pos: ast.Position{Offset: 32, Line: 3, Column: 14}, }, TypeAnnotation: &ast.TypeAnnotation{ Type: &ast.NominalType{ Identifier: ast.Identifier{ Identifier: "String", Pos: ast.Position{Offset: 38, Line: 3, Column: 20}, }, }, StartPos: ast.Position{Offset: 38, Line: 3, Column: 20}, }, Range: ast.Range{ StartPos: ast.Position{Offset: 28, Line: 3, Column: 10}, EndPos: ast.Position{Offset: 43, Line: 3, Column: 25}, }, }, }, ), Range: ast.Range{ StartPos: ast.Position{Offset: 7, Line: 2, Column: 6}, EndPos: ast.Position{Offset: 51, Line: 4, Column: 6}, }, }, }, result.Declarations(), ) }
explode_data.jsonl/35984
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 731 }
[ 2830, 3393, 14463, 1877, 2354, 3830, 8714, 1155, 353, 8840, 836, 8, 1476, 3244, 41288, 7957, 2822, 9559, 11, 70817, 1669, 14775, 10690, 61528, 414, 2036, 328, 341, 688, 1077, 504, 25, 923, 198, 414, 456, 197, 24183, 17957, 11180, 1155, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1