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 TestPipelineRunFacts_IsRunning(t *testing.T) { for _, tc := range []struct { name string state PipelineRunState expected bool }{{ name: "one-started", state: oneStartedState, expected: true, }, { name: "one-finished", state: oneFinishedState, expected: false, }, { name: "one-failed", state: oneFailedState, expected: false, }, { name: "all-finished", state: allFinishedState, expected: false, }, { name: "no-run-started", state: noRunStartedState, expected: false, }, { name: "one-run-started", state: oneRunStartedState, expected: true, }, { name: "one-run-failed", state: oneRunFailedState, expected: false, }} { t.Run(tc.name, func(t *testing.T) { d, err := dagFromState(tc.state) if err != nil { t.Fatalf("Could not get a dag from the TC state %#v: %v", tc.state, err) } facts := PipelineRunFacts{ State: tc.state, TasksGraph: d, FinalTasksGraph: &dag.Graph{}, } if tc.expected != facts.IsRunning() { t.Errorf("IsRunning expected to be %v", tc.expected) } }) } }
explode_data.jsonl/18204
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 536 }
[ 2830, 3393, 34656, 6727, 37, 11359, 31879, 18990, 1155, 353, 8840, 836, 8, 341, 2023, 8358, 17130, 1669, 2088, 3056, 1235, 341, 197, 11609, 257, 914, 198, 197, 24291, 262, 40907, 6727, 1397, 198, 197, 42400, 1807, 198, 197, 15170, 515, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestValidateCert(t *testing.T) { key, _, _, _, err := ParseAuthorizedKey([]byte(exampleSSHCert)) if err != nil { t.Fatalf("ParseAuthorizedKey: %v", err) } validCert, ok := key.(*Certificate) if !ok { t.Fatalf("got %v (%T), want *Certificate", key, key) } checker := CertChecker{} checker.IsAuthority = func(k PublicKey) bool { return bytes.Equal(k.Marshal(), validCert.SignatureKey.Marshal()) } if err := checker.CheckCert("user", validCert); err != nil { t.Errorf("Unable to validate certificate: %v", err) } invalidCert := &Certificate{ Key: testPublicKeys["rsa"], SignatureKey: testPublicKeys["ecdsa"], ValidBefore: CertTimeInfinity, Signature: &Signature{}, } if err := checker.CheckCert("user", invalidCert); err == nil { t.Error("Invalid cert signature passed validation") } }
explode_data.jsonl/30248
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 394 }
[ 2830, 3393, 17926, 36934, 1155, 353, 8840, 836, 8, 341, 262, 1376, 11, 8358, 8358, 8358, 1848, 1669, 14775, 60454, 1592, 10556, 3782, 66203, 1220, 22455, 529, 1171, 262, 421, 1848, 961, 2092, 341, 286, 259, 30762, 445, 14463, 60454, 159...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestTx_DeleteBucket(t *testing.T) { db := MustOpenDB() defer db.MustClose() // Create a bucket and add a value. if err := db.Update(func(tx *bolt.Tx) error { b, err := tx.CreateBucket([]byte("widgets")) if err != nil { t.Fatal(err) } if err := b.Put([]byte("foo"), []byte("bar")); err != nil { t.Fatal(err) } return nil }); err != nil { t.Fatal(err) } // Delete the bucket and make sure we can't get the value. if err := db.Update(func(tx *bolt.Tx) error { if err := tx.DeleteBucket([]byte("widgets")); err != nil { t.Fatal(err) } if tx.Bucket([]byte("widgets")) != nil { t.Fatal("unexpected bucket") } return nil }); err != nil { t.Fatal(err) } if err := db.Update(func(tx *bolt.Tx) error { // Create the bucket again and make sure there's not a phantom value. b, err := tx.CreateBucket([]byte("widgets")) if err != nil { t.Fatal(err) } if v := b.Get([]byte("foo")); v != nil { t.Fatalf("unexpected phantom value: %v", v) } return nil }); err != nil { t.Fatal(err) } }
explode_data.jsonl/1694
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 451 }
[ 2830, 3393, 31584, 57418, 36018, 1155, 353, 8840, 836, 8, 341, 20939, 1669, 15465, 5002, 3506, 741, 16867, 2927, 50463, 7925, 2822, 197, 322, 4230, 264, 15621, 323, 912, 264, 897, 624, 743, 1848, 1669, 2927, 16689, 18552, 27301, 353, 52...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestHoard_OverrideDefault(t *testing.T) { h := Make(Expires().AfterSeconds(1)) _ = h.Get("key", func() (interface{}, *Expiration) { return "first", ExpiresNever }) assert.Equal(t, ExpiresNever, h.cache["key"].expiration) h = Make(ExpiresNever) _ = h.Get("key", func() (interface{}, *Expiration) { return "first", Expires().AfterSecondsIdle(1) }) assert.Equal(t, 1, h.cache["key"].expiration.idle.Seconds()) }
explode_data.jsonl/82507
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 169 }
[ 2830, 3393, 39, 33386, 62, 2177, 3675, 1155, 353, 8840, 836, 8, 1476, 9598, 1669, 7405, 7, 65331, 1005, 6025, 15343, 7, 16, 4390, 197, 62, 284, 305, 2234, 445, 792, 497, 2915, 368, 320, 4970, 22655, 353, 66301, 8, 341, 197, 853, 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 TestConfigClients_Update_Hydra_Error(t *testing.T) { s, cfg, _, h, iss, err := setupHydraTest(false) if err != nil { t.Fatalf("setupHydraTest() failed: %v", err) } clientName := "test_client" // Update the client RedirectUris. cli := &cpb.Client{ RedirectUris: []string{"http://client.example.com"}, } h.UpdateClientResp = &hydraapi.Client{ ClientID: test.TestClientID, Name: clientName, Secret: "secret", RedirectURIs: cli.RedirectUris, Scope: defaultScope, GrantTypes: defaultGrantTypes, ResponseTypes: defaultResponseTypes, } h.UpdateClientErr = &hydraapi.GenericError{Code: http.StatusServiceUnavailable} resp := sendConfigClientsUpdate(t, "admin", clientName, "master", test.TestClientID, test.TestClientSecret, cli, s, iss) if resp.StatusCode != http.StatusServiceUnavailable { t.Errorf("resp.StatusCode = %d, wants %d", resp.StatusCode, http.StatusServiceUnavailable) } conf, err := s.loadConfig(nil, "master") if err != nil { t.Fatalf("s.loadConfig() failed %v", err) } if diff := cmp.Diff(cfg, conf, protocmp.Transform()); len(diff) != 0 { t.Errorf("config should not update, (-want, +got): %s", diff) } }
explode_data.jsonl/18523
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 465 }
[ 2830, 3393, 2648, 47174, 47393, 2039, 88, 22248, 28651, 1155, 353, 8840, 836, 8, 341, 1903, 11, 13286, 11, 8358, 305, 11, 2369, 11, 1848, 1669, 6505, 30816, 22248, 2271, 3576, 340, 743, 1848, 961, 2092, 341, 197, 3244, 30762, 445, 151...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestLinuxCgroupsPathSpecified(t *testing.T) { cgroupsPath := "/user/cgroups/path/id" spec := &specs.Spec{} spec.Linux = &specs.Linux{ CgroupsPath: cgroupsPath, } opts := &CreateOpts{ CgroupName: "ContainerID", UseSystemdCgroup: false, Spec: spec, } cgroup, err := createCgroupConfig(opts) if err != nil { t.Errorf("Couldn't create Cgroup config: %v", err) } if cgroup.Path != cgroupsPath { t.Errorf("Wrong cgroupsPath, expected '%s' got '%s'", cgroupsPath, cgroup.Path) } }
explode_data.jsonl/6062
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 226 }
[ 2830, 3393, 46324, 34, 16753, 1820, 8327, 1870, 1155, 353, 8840, 836, 8, 341, 1444, 16753, 1820, 1669, 3521, 872, 2899, 16753, 50976, 38146, 1837, 98100, 1669, 609, 94531, 36473, 16094, 98100, 1214, 19559, 284, 609, 94531, 1214, 19559, 51...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestNamespaceNest(t *testing.T) { r, _ := http.NewRequest("GET", "/v1/admin/order", nil) w := httptest.NewRecorder() ns := NewNamespace("/v1") ns.Namespace( NewNamespace("/admin"). Get("/order", func(ctx *context.Context) { ctx.Output.Body([]byte("order")) }), ) AddNamespace(ns) BeeApp.Handlers.ServeHTTP(w, r) if w.Body.String() != "order" { t.Errorf("TestNamespaceNest can't run, get the response is " + w.Body.String()) } }
explode_data.jsonl/12606
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 193 }
[ 2830, 3393, 22699, 45, 477, 1155, 353, 8840, 836, 8, 341, 7000, 11, 716, 1669, 1758, 75274, 445, 3806, 497, 3521, 85, 16, 17402, 43395, 497, 2092, 340, 6692, 1669, 54320, 70334, 7121, 47023, 2822, 84041, 1669, 1532, 22699, 4283, 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 TestPipelineRunState_SuccessfulOrSkippedDAGTasks(t *testing.T) { largePipelineState := buildPipelineStateWithLargeDepencyGraph(t) tcs := []struct { name string state PipelineRunState specStatus v1beta1.PipelineRunSpecStatus expectedNames []string }{{ name: "no-tasks-started", state: noneStartedState, expectedNames: []string{}, }, { name: "no-tasks-started-run-cancelled-gracefully", state: noneStartedState, specStatus: v1beta1.PipelineRunSpecStatusCancelledRunFinally, expectedNames: []string{pts[0].Name, pts[1].Name}, }, { name: "one-task-started", state: oneStartedState, expectedNames: []string{}, }, { name: "one-task-started-run-stopped-gracefully", state: oneStartedState, specStatus: v1beta1.PipelineRunSpecStatusStoppedRunFinally, expectedNames: []string{pts[1].Name}, }, { name: "one-task-finished", state: oneFinishedState, expectedNames: []string{pts[0].Name}, }, { name: "one-task-finished-run-cancelled-forcefully", state: oneFinishedState, specStatus: v1beta1.PipelineRunSpecStatusCancelled, expectedNames: []string{pts[0].Name}, }, { name: "one-task-failed", state: oneFailedState, expectedNames: []string{pts[1].Name}, }, { name: "all-finished", state: allFinishedState, expectedNames: []string{pts[0].Name, pts[1].Name}, }, { name: "conditional task not skipped as the condition execution was successful", state: conditionCheckSuccessNoTaskStartedState, expectedNames: []string{}, }, { name: "conditional task not skipped as the condition has not started executing yet", state: conditionCheckStartedState, expectedNames: []string{}, }, { name: "conditional task skipped as the condition execution resulted in failure", state: conditionCheckFailedWithNoOtherTasksState, expectedNames: []string{pts[5].Name}, }, { name: "conditional task skipped as the condition execution resulted in failure but the other pipeline task" + "not skipped since it finished execution successfully", state: conditionCheckFailedWithOthersPassedState, expectedNames: []string{pts[5].Name, pts[0].Name}, }, { name: "conditional task skipped as the condition execution resulted in failure but the other pipeline task" + "not skipped since it failed", state: conditionCheckFailedWithOthersFailedState, expectedNames: []string{pts[5].Name}, }, { name: "large deps, not started", state: largePipelineState, expectedNames: []string{}, }, { name: "one-run-started", state: oneRunStartedState, expectedNames: []string{}, }, { name: "one-run-finished", state: oneRunFinishedState, expectedNames: []string{pts[12].Name}, }, { name: "one-run-failed", state: oneRunFailedState, expectedNames: []string{pts[13].Name}, }} for _, tc := range tcs { t.Run(tc.name, func(t *testing.T) { d, err := dagFromState(tc.state) if err != nil { t.Fatalf("Unexpected error while buildig DAG for state %v: %v", tc.state, err) } facts := PipelineRunFacts{ State: tc.state, SpecStatus: tc.specStatus, TasksGraph: d, FinalTasksGraph: &dag.Graph{}, } names := facts.successfulOrSkippedDAGTasks() if d := cmp.Diff(names, tc.expectedNames); d != "" { t.Errorf("Expected to get completed names %v but got something different %s", tc.expectedNames, diff.PrintWantGot(d)) } }) } }
explode_data.jsonl/18196
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1548 }
[ 2830, 3393, 34656, 6727, 1397, 87161, 1262, 2195, 19290, 6450, 35, 1890, 25449, 1155, 353, 8840, 836, 8, 341, 8810, 2744, 34656, 1397, 1669, 1936, 34656, 1397, 2354, 34253, 7839, 2251, 11212, 1155, 340, 3244, 4837, 1669, 3056, 1235, 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 TestDecodeNdjson(t *testing.T) { tests := []struct { body string result string }{ {"{}", "[{}]"}, {"{\"a\":\"b\"}", "[{\"a\":\"b\"}]"}, {"{\"a\":\"b\"}\n{\"c\":\"d\"}", "[{\"a\":\"b\"},{\"c\":\"d\"}]"}, {"{\"a\":\"b\"}\r\n{\"c\":\"d\"}", "[{\"a\":\"b\"},{\"c\":\"d\"}]"}, {"{\"a\":\"b\"}\r\n{\"c\":\"d\"}\n", "[{\"a\":\"b\"},{\"c\":\"d\"}]"}, {"{\"a\":\"b\"}\r\n{\"c\":\"d\"}\r\n", "[{\"a\":\"b\"},{\"c\":\"d\"}]"}, } for _, test := range tests { resp := &response{} err := decodeAsNdjson([]byte(test.body), resp) if err != nil { t.Fatalf("decodeAsNdjson failed: %v", err) } j, err := json.Marshal(resp.body) if err != nil { t.Fatalf("Marshal failed: %v", err) } assert.Equal(t, test.result, string(j)) } }
explode_data.jsonl/20807
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 392 }
[ 2830, 3393, 32564, 39837, 2236, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 3056, 1235, 341, 197, 35402, 256, 914, 198, 197, 9559, 914, 198, 197, 59403, 197, 197, 4913, 42351, 10545, 78134, 7115, 197, 197, 4913, 64238, 64, 23488, 65, 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...
4
func TestGetDataRateFromDataRateIndex(t *testing.T) { for _, tc := range []struct { Name string BandID string DataRateIndex int IsLora bool ExpectedDataRate ttnpb.DataRate ErrorAssertion func(error) bool }{ { Name: "Valid_EU", BandID: "EU_863_870", IsLora: true, ExpectedDataRate: ttnpb.DataRate{Modulation: &ttnpb.DataRate_LoRa{LoRa: &ttnpb.LoRaDataRate{ SpreadingFactor: 12, Bandwidth: 125000, }}}, }, { Name: "Valid_EU_FSK", BandID: "EU_863_870", IsLora: false, DataRateIndex: 7, ExpectedDataRate: ttnpb.DataRate{Modulation: &ttnpb.DataRate_FSK{FSK: &ttnpb.FSKDataRate{ BitRate: 50000, }}}, }, { Name: "Invalid_EU", BandID: "EU_863_870", DataRateIndex: 16, ExpectedDataRate: ttnpb.DataRate{}, ErrorAssertion: func(err error) bool { return errors.Resemble(err, errDataRateIndex) }, }, } { t.Run(tc.Name, func(t *testing.T) { a := assertions.New(t) dr, isLora, err := getDataRateFromIndex(tc.BandID, tc.DataRateIndex) if err != nil { if tc.ErrorAssertion == nil || !a.So(tc.ErrorAssertion(err), should.BeTrue) { t.Fatalf("Unexpected error: %v", err) } } else if tc.ErrorAssertion != nil { t.Fatalf("Expected error") } else { if !a.So(dr, should.Resemble, tc.ExpectedDataRate) || !a.So(isLora, should.Resemble, tc.IsLora) { t.Fatalf("Invalid datarate: %v", dr) } } }) } }
explode_data.jsonl/69425
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 768 }
[ 2830, 3393, 68957, 11564, 3830, 1043, 11564, 1552, 1155, 353, 8840, 836, 8, 341, 2023, 8358, 17130, 1669, 2088, 3056, 1235, 341, 197, 21297, 1797, 914, 198, 197, 12791, 437, 915, 1843, 914, 198, 197, 40927, 11564, 1552, 262, 526, 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 TestReconciler_DontCreateDeployment_NoChanges(t *testing.T) { job := mock.Job() job.TaskGroups[0].Update = noCanaryUpdate // Create 10 allocations from the job var allocs []*structs.Allocation for i := 0; i < 10; i++ { alloc := mock.Alloc() alloc.Job = job alloc.JobID = job.ID alloc.NodeID = uuid.Generate() alloc.Name = structs.AllocName(job.ID, job.TaskGroups[0].Name, uint(i)) alloc.TaskGroup = job.TaskGroups[0].Name allocs = append(allocs, alloc) } reconciler := NewAllocReconciler(testLogger(), allocUpdateFnIgnore, false, job.ID, job, nil, allocs, nil) r := reconciler.Compute() // Assert the correct results assertResults(t, r, &resultExpectation{ createDeployment: nil, deploymentUpdates: nil, place: 0, inplace: 0, stop: 0, desiredTGUpdates: map[string]*structs.DesiredUpdates{ job.TaskGroups[0].Name: { DestructiveUpdate: 0, Ignore: 10, }, }, }) }
explode_data.jsonl/67253
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 426 }
[ 2830, 3393, 693, 40446, 5769, 1557, 544, 4021, 75286, 36989, 11317, 1155, 353, 8840, 836, 8, 341, 68577, 1669, 7860, 45293, 741, 68577, 28258, 22173, 58, 15, 936, 4289, 284, 902, 6713, 658, 4289, 271, 197, 322, 4230, 220, 16, 15, 6964...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestCmd(t *testing.T) { type TestSpec struct { rs.BaseField Options []string `yaml:"options"` BadOptions bool `yaml:"bad_options"` Sources []string `yaml:"sources"` BadSource bool `yaml:"bad_source"` OutputFiles []string `yaml:"output_files"` } type CheckSpec struct { rs.BaseField Expected string `yaml:"expected"` } testhelper.TestFixtures(t, "./fixtures", func() interface{} { return rs.Init(&TestSpec{}, nil) }, func() interface{} { return rs.Init(&CheckSpec{}, nil) }, func(t *testing.T, in, c interface{}) { spec := in.(*TestSpec) check := c.(*CheckSpec) cwd, err := os.Getwd() if !assert.NoError(t, err) { return } defer t.Cleanup(func() { if !assert.NoError(t, os.Chdir(cwd)) { return } }) ctx := dt.NewTestContextWithGlobalEnv(context.TODO(), map[string]utils.LazyValue{ constant.ENV_DUKKHA_WORKDIR: utils.ImmediateString(cwd), }) ctx.(di.CacheDirSetter).SetCacheDir(t.TempDir()) ctx.AddRenderer("file", file.NewDefault("file")) ctx.AddRenderer("env", env.NewDefault("env")) ctx.AddRenderer("shell", shell.NewDefault("shell")) outputDir := filepath.Join(t.TempDir(), "output") ctx.AddEnv(true, &dukkha.EnvEntry{ Name: "out_dir", Value: outputDir, }) assert.NoError(t, os.MkdirAll(outputDir, 0755)) appCtx := dukkha.Context(ctx) cmd := &cobra.Command{} opts := &Options{} createOptionsFlags(cmd, opts) assert.NoError(t, spec.ResolveFields(ctx, -1)) err = cmd.ParseFlags(sliceutils.NewStrings(spec.Options, spec.Sources...)) if spec.BadOptions { assert.Error(t, err) return } assert.NoError(t, err) stdout := &bytes.Buffer{} err = run(appCtx, opts, spec.Sources, stdout) if spec.BadSource { assert.Error(t, err) return } assert.NoError(t, err) if !assert.NoError(t, os.Chdir(cwd)) { return } ctx.(di.WorkDirOverrider).OverrideWorkDir(cwd) // have a look at the output dir entries, err := os.ReadDir(outputDir) assert.NoError(t, err) t.Log(len(entries)) for _, v := range entries { t.Log(v.Name()) } var actual []*rs.AnyObject for _, file := range spec.OutputFiles { switch file { case "-": actualPart, err2 := parseYaml(yaml.NewDecoder(stdout)) assert.NoError(t, err2) actual = append(actual, actualPart...) default: f, err2 := os.Open(file) if !assert.NoError(t, err2) { return } actualPart, err2 := parseYaml(yaml.NewDecoder(f)) _ = f.Close() assert.NoError(t, err2) actual = append(actual, actualPart...) } } expected, err := parseYaml(yaml.NewDecoder(strings.NewReader(check.Expected))) assert.NoError(t, err) if !assert.Equal(t, len(expected), len(actual)) { return } for i, v := range expected { assert.NoError(t, v.ResolveFields(ctx, -1)) assert.EqualValues(t, v.NormalizedValue(), actual[i].NormalizedValue()) } }, ) }
explode_data.jsonl/6988
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1345 }
[ 2830, 3393, 15613, 1155, 353, 8840, 836, 8, 1476, 13158, 3393, 8327, 2036, 341, 197, 41231, 13018, 1877, 271, 197, 197, 3798, 262, 3056, 917, 1565, 41466, 2974, 2875, 8805, 197, 12791, 329, 3798, 1807, 257, 1565, 41466, 2974, 13855, 874...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestExecuteInstall(t *testing.T) { cryptoProvider, err := sw.NewDefaultSecurityLevelWithKeystore(sw.NewDummyKeyStore()) require.NoError(t, err) scc := &SCC{ BuiltinSCCs: map[string]struct{}{"lscc": {}}, Support: &SupportImpl{GetMSPIDs: getMSPIDs}, ACLProvider: mockAclProvider, GetMSPIDs: getMSPIDs, BCCSP: cryptoProvider, BuildRegistry: &container.BuildRegistry{}, ChaincodeBuilder: &mock.ChaincodeBuilder{}, } require.NotNil(t, scc) stub := shimtest.NewMockStub("lscc", scc) res := stub.MockInit("1", nil) require.Equal(t, int32(shim.OK), res.Status, res.Message) err = scc.executeInstall(stub, []byte("barf")) require.Error(t, err) }
explode_data.jsonl/11798
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 313 }
[ 2830, 3393, 17174, 24690, 1155, 353, 8840, 836, 8, 341, 1444, 9444, 5179, 11, 1848, 1669, 2021, 7121, 3675, 15352, 4449, 2354, 6608, 63373, 58902, 7121, 43344, 1592, 6093, 2398, 17957, 35699, 1155, 11, 1848, 340, 1903, 638, 1669, 609, 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 TestPrimitiveGetFloat(t *testing.T) { client := newPrimitiveClient() result, err := client.GetFloat(context.Background(), nil) if err != nil { t.Fatalf("GetFloat: %v", err) } if r := cmp.Diff(result.FloatWrapper, FloatWrapper{ Field1: to.Float32Ptr(1.05), Field2: to.Float32Ptr(-0.003), }); r != "" { t.Fatal(r) } }
explode_data.jsonl/61671
{ "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, 33313, 1949, 5442, 1155, 353, 8840, 836, 8, 341, 25291, 1669, 501, 33313, 2959, 741, 9559, 11, 1848, 1669, 2943, 2234, 5442, 5378, 19047, 1507, 2092, 340, 743, 1848, 961, 2092, 341, 197, 3244, 30762, 445, 1949, 5442, 25, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestConfigServiceV2CreateSink(t *testing.T) { var name string = "name3373707" var destination string = "destination-1429847026" var filter string = "filter-1274492040" var writerIdentity string = "writerIdentity775638794" var expectedResponse = &loggingpb.LogSink{ Name: name, Destination: destination, Filter: filter, WriterIdentity: writerIdentity, } mockConfig.err = nil mockConfig.reqs = nil mockConfig.resps = append(mockConfig.resps[:0], expectedResponse) var formattedParent string = ConfigProjectPath("[PROJECT]") var sink *loggingpb.LogSink = &loggingpb.LogSink{} var request = &loggingpb.CreateSinkRequest{ Parent: formattedParent, Sink: sink, } c, err := NewConfigClient(context.Background(), clientOpt) if err != nil { t.Fatal(err) } resp, err := c.CreateSink(context.Background(), request) if err != nil { t.Fatal(err) } if want, got := request, mockConfig.reqs[0]; !proto.Equal(want, got) { t.Errorf("wrong request %q, want %q", got, want) } if want, got := expectedResponse, resp; !proto.Equal(want, got) { t.Errorf("wrong response %q, want %q)", got, want) } }
explode_data.jsonl/77771
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 444 }
[ 2830, 3393, 2648, 1860, 53, 17, 4021, 45094, 1155, 353, 8840, 836, 8, 341, 2405, 829, 914, 284, 330, 606, 18, 18, 22, 18, 22, 15, 22, 698, 2405, 9106, 914, 284, 330, 17997, 12, 16, 19, 17, 24, 23, 19, 22, 15, 17, 21, 698, 24...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
5
func TestMissingConsortiumSection(t *testing.T) { blockDest := filepath.Join(tmpDir, "block") config := configtxgentest.Load(genesisconfig.SampleInsecureSoloProfile) config.Consortiums = nil assert.NoError(t, doOutputBlock(config, "foo", blockDest), "Missing consortiums section") }
explode_data.jsonl/14586
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 90 }
[ 2830, 3393, 25080, 1109, 6860, 2356, 9620, 1155, 353, 8840, 836, 8, 341, 47996, 34830, 1669, 26054, 22363, 10368, 6184, 11, 330, 4574, 5130, 25873, 1669, 2193, 3998, 15772, 477, 13969, 36884, 13774, 1676, 76266, 641, 25132, 89299, 8526, 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 TestJetStreamDrainFailsToDeleteConsumer(t *testing.T) { s := RunBasicJetStreamServer() defer s.Shutdown() if config := s.JetStreamConfig(); config != nil { defer os.RemoveAll(config.StoreDir) } errCh := make(chan error, 1) nc, err := nats.Connect(s.ClientURL(), nats.ErrorHandler(func(_ *nats.Conn, _ *nats.Subscription, err error) { select { case errCh <- err: default: } })) if err != nil { t.Fatalf("Unexpected error: %v", err) } defer nc.Close() js, err := nc.JetStream() if err != nil { t.Fatalf("Unexpected error: %v", err) } if _, err := js.AddStream(&nats.StreamConfig{ Name: "TEST", Subjects: []string{"foo"}, }); err != nil { t.Fatalf("Unexpected error: %v", err) } js.Publish("foo", []byte("hi")) blockCh := make(chan struct{}) sub, err := js.Subscribe("foo", func(m *nats.Msg) { <-blockCh }, nats.Durable("dur")) if err != nil { t.Fatalf("Error subscribing: %v", err) } // Initiate the drain... it won't complete because we have blocked the // message callback. sub.Drain() // Now delete the JS consumer if err := js.DeleteConsumer("TEST", "dur"); err != nil { t.Fatalf("Error deleting consumer: %v", err) } // Now unblock and make sure we get the async error close(blockCh) select { case err := <-errCh: if !strings.Contains(err.Error(), "consumer not found") { t.Fatalf("Unexpected async error: %v", err) } case <-time.After(time.Second): t.Fatal("Did not get async error") } }
explode_data.jsonl/29191
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 575 }
[ 2830, 3393, 35641, 3027, 8847, 466, 37, 6209, 64105, 29968, 1155, 353, 8840, 836, 8, 341, 1903, 1669, 6452, 15944, 35641, 3027, 5475, 741, 16867, 274, 10849, 18452, 2822, 743, 2193, 1669, 274, 3503, 295, 3027, 2648, 2129, 2193, 961, 209...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestEntry_OnKeyDown_DeleteNewline(t *testing.T) { entry := widget.NewEntry() entry.SetText("H\ni") right := &fyne.KeyEvent{Name: fyne.KeyRight} entry.TypedKey(right) key := &fyne.KeyEvent{Name: fyne.KeyDelete} entry.TypedKey(key) assert.Equal(t, "Hi", entry.Text) }
explode_data.jsonl/12343
{ "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, 5874, 35482, 24173, 57418, 3564, 1056, 1155, 353, 8840, 836, 8, 341, 48344, 1669, 9086, 7121, 5874, 741, 48344, 92259, 445, 39, 1699, 72, 5130, 47921, 1669, 609, 30595, 811, 58808, 63121, 25, 51941, 811, 9610, 5979, 532, 483...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestDeployAndUpgrade(t *testing.T) { chainID := util.GetTestChainID() var ctxt = context.Background() url1 := "github.com/hyperledger/fabric/examples/chaincode/go/chaincode_example01" url2 := "github.com/hyperledger/fabric/examples/chaincode/go/chaincode_example02" chaincodeID1 := &pb.ChaincodeID{Path: url1, Name: "upgradeex01", Version: "0"} chaincodeID2 := &pb.ChaincodeID{Path: url2, Name: "upgradeex01", Version: "1"} defer deleteChaincodeOnDisk("upgradeex01.0") defer deleteChaincodeOnDisk("upgradeex01.1") f := "init" argsDeploy := util.ToChaincodeArgs(f, "a", "100", "b", "200") spec := &pb.ChaincodeSpec{Type: 1, ChaincodeId: chaincodeID1, Input: &pb.ChaincodeInput{Args: argsDeploy}} cccid1 := ccprovider.NewCCContext(chainID, "upgradeex01", "0", "", false, nil, nil) cccid2 := ccprovider.NewCCContext(chainID, "upgradeex01", "1", "", false, nil, nil) resp, prop, err := deploy(endorserServer, chainID, spec, nil) chaincodeName := spec.ChaincodeId.Name if err != nil { t.Fail() chaincode.GetChain().Stop(ctxt, cccid1, &pb.ChaincodeDeploymentSpec{ChaincodeSpec: &pb.ChaincodeSpec{ChaincodeId: chaincodeID1}}) chaincode.GetChain().Stop(ctxt, cccid2, &pb.ChaincodeDeploymentSpec{ChaincodeSpec: &pb.ChaincodeSpec{ChaincodeId: chaincodeID2}}) t.Logf("Error deploying <%s>: %s", chaincodeName, err) return } var nextBlockNumber uint64 = 3 // something above created block 0 err = endorserServer.(*Endorser).commitTxSimulation(prop, chainID, signer, resp, nextBlockNumber) if err != nil { t.Fail() chaincode.GetChain().Stop(ctxt, cccid1, &pb.ChaincodeDeploymentSpec{ChaincodeSpec: &pb.ChaincodeSpec{ChaincodeId: chaincodeID1}}) chaincode.GetChain().Stop(ctxt, cccid2, &pb.ChaincodeDeploymentSpec{ChaincodeSpec: &pb.ChaincodeSpec{ChaincodeId: chaincodeID2}}) t.Logf("Error committing <%s>: %s", chaincodeName, err) return } argsUpgrade := util.ToChaincodeArgs(f, "a", "150", "b", "300") spec = &pb.ChaincodeSpec{Type: 1, ChaincodeId: chaincodeID2, Input: &pb.ChaincodeInput{Args: argsUpgrade}} _, _, err = upgrade(endorserServer, chainID, spec, nil) if err != nil { t.Fail() chaincode.GetChain().Stop(ctxt, cccid1, &pb.ChaincodeDeploymentSpec{ChaincodeSpec: &pb.ChaincodeSpec{ChaincodeId: chaincodeID1}}) chaincode.GetChain().Stop(ctxt, cccid2, &pb.ChaincodeDeploymentSpec{ChaincodeSpec: &pb.ChaincodeSpec{ChaincodeId: chaincodeID2}}) t.Logf("Error upgrading <%s>: %s", chaincodeName, err) return } fmt.Printf("Upgrade test passed\n") t.Logf("Upgrade test passed") chaincode.GetChain().Stop(ctxt, cccid1, &pb.ChaincodeDeploymentSpec{ChaincodeSpec: &pb.ChaincodeSpec{ChaincodeId: chaincodeID1}}) chaincode.GetChain().Stop(ctxt, cccid2, &pb.ChaincodeDeploymentSpec{ChaincodeSpec: &pb.ChaincodeSpec{ChaincodeId: chaincodeID2}}) }
explode_data.jsonl/27804
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1054 }
[ 2830, 3393, 69464, 3036, 43861, 1155, 353, 8840, 836, 8, 341, 197, 8819, 915, 1669, 4094, 2234, 2271, 18837, 915, 741, 2405, 59162, 284, 2266, 19047, 2822, 19320, 16, 1669, 330, 5204, 905, 7530, 39252, 50704, 6663, 28897, 67020, 14, 881...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestIssue23(t *testing.T) { p := NewPolicy() p.SkipElementsContent("tag1", "tag2") input := `<tag1>cut<tag2></tag2>harm</tag1><tag1>123</tag1><tag2>234</tag2>` out := p.Sanitize(input) expected := "" if out != expected { t.Errorf( "test failed;\ninput : %s\noutput : %s\nexpected: %s", input, out, expected) } p = NewPolicy() p.SkipElementsContent("tag") p.AllowElements("p") input = `<tag>234<p>asd</p></tag>` out = p.Sanitize(input) expected = "" if out != expected { t.Errorf( "test failed;\ninput : %s\noutput : %s\nexpected: %s", input, out, expected) } p = NewPolicy() p.SkipElementsContent("tag") p.AllowElements("p", "br") input = `<tag>234<p>as<br/>d</p></tag>` out = p.Sanitize(input) expected = "" if out != expected { t.Errorf( "test failed;\ninput : %s\noutput : %s\nexpected: %s", input, out, expected) } }
explode_data.jsonl/28801
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 424 }
[ 2830, 3393, 42006, 17, 18, 1155, 353, 8840, 836, 8, 341, 3223, 1669, 1532, 13825, 741, 3223, 57776, 11868, 2762, 445, 4578, 16, 497, 330, 4578, 17, 1138, 22427, 1669, 30586, 4578, 16, 29, 10242, 16805, 17, 1472, 4578, 17, 29, 71, 21...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
4
func TestClosedTimestampCanServeAfterSplitAndMerges(t *testing.T) { defer leaktest.AfterTest(t)() if util.RaceEnabled { // Limiting how long transactions can run does not work // well with race unless we're extremely lenient, which // drives up the test duration. t.Skip("skipping under race") } ctx := context.Background() tc, db0, desc, repls := setupTestClusterForClosedTimestampTesting(ctx, t, testingTargetDuration) // Disable the automatic merging. if _, err := db0.Exec("SET CLUSTER SETTING kv.range_merge.queue_enabled = false"); err != nil { t.Fatal(err) } defer tc.Stopper().Stop(ctx) if _, err := db0.Exec(`INSERT INTO cttest.kv VALUES(1, $1)`, "foo"); err != nil { t.Fatal(err) } if _, err := db0.Exec(`INSERT INTO cttest.kv VALUES(3, $1)`, "foo"); err != nil { t.Fatal(err) } // Start by ensuring that the values can be read from all replicas at ts. ts := hlc.Timestamp{WallTime: timeutil.Now().UnixNano()} baRead := makeReadBatchRequestForDesc(desc, ts) testutils.SucceedsSoon(t, func() error { return verifyCanReadFromAllRepls(ctx, t, baRead, repls, expectRows(2)) }) // Manually split the table to have easier access to descriptors. tableID, err := getTableID(db0, "cttest", "kv") if err != nil { t.Fatalf("failed to lookup ids: %+v", err) } // Split the table at key 2. k, err := sqlbase.EncodeTableKey(sqlbase.EncodeTableIDIndexID(nil, tableID, 1), tree.NewDInt(2), encoding.Ascending) if err != nil { t.Fatalf("failed to encode key: %+v", err) } lr, rr, err := tc.Server(0).SplitRange(k) if err != nil { t.Fatalf("failed to split range at key %v: %+v", roachpb.Key(k), err) } // Ensure that we can perform follower reads from all replicas. lRepls := replsForRange(ctx, t, tc, lr) rRepls := replsForRange(ctx, t, tc, rr) // Now immediately query both the ranges and there's 1 value per range. // We need to tollerate RangeNotFound as the split range may not have been // created yet. baReadL := makeReadBatchRequestForDesc(lr, ts) require.Nil(t, verifyCanReadFromAllRepls(ctx, t, baReadL, lRepls, respFuncs(retryOnRangeNotFound, expectRows(1)))) baReadR := makeReadBatchRequestForDesc(rr, ts) require.Nil(t, verifyCanReadFromAllRepls(ctx, t, baReadR, rRepls, respFuncs(retryOnRangeNotFound, expectRows(1)))) // Now merge the ranges back together and ensure that there's two values in // the merged range. merged, err := tc.Server(0).MergeRanges(lr.StartKey.AsRawKey()) require.Nil(t, err) mergedRepls := replsForRange(ctx, t, tc, merged) // The hazard here is that a follower is not yet aware of the merge and will // return an error. We'll accept that because a client wouldn't see that error // from distsender. baReadMerged := makeReadBatchRequestForDesc(merged, ts) require.Nil(t, verifyCanReadFromAllRepls(ctx, t, baReadMerged, mergedRepls, respFuncs(retryOnRangeKeyMismatch, expectRows(2)))) }
explode_data.jsonl/65032
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1066 }
[ 2830, 3393, 26884, 20812, 6713, 60421, 6025, 20193, 3036, 44, 2375, 288, 1155, 353, 8840, 836, 8, 341, 16867, 23352, 1944, 36892, 2271, 1155, 8, 2822, 743, 4094, 2013, 578, 5462, 341, 197, 197, 322, 28008, 287, 1246, 1293, 14131, 646, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestOnChainReport(t *testing.T) { tests := []struct { name string tx lndclient.Transaction sweeps map[string]bool openedChannels map[string]channelInfo closedChannels map[string]closedChannelInfo expectedEntries map[EntryType]bool }{ { name: "sweep tx", tx: lndclient.Transaction{ TxHash: hash.String(), Tx: &wire.MsgTx{}, }, sweeps: map[string]bool{ hash.String(): true, }, expectedEntries: map[EntryType]bool{ EntryTypeSweep: true, EntryTypeSweepFee: true, }, }, { name: "locally opened channel", tx: lndclient.Transaction{ TxHash: hash.String(), Amount: -20000, Fee: 100, }, openedChannels: map[string]channelInfo{ hash.String(): {}, }, expectedEntries: map[EntryType]bool{ EntryTypeLocalChannelOpen: true, EntryTypeChannelOpenFee: true, }, }, { name: "remote opened channel", tx: lndclient.Transaction{ TxHash: hash.String(), Amount: 0, }, openedChannels: map[string]channelInfo{ hash.String(): {}, }, expectedEntries: map[EntryType]bool{ EntryTypeRemoteChannelOpen: true, }, }, { name: "closed channel that we opened", tx: lndclient.Transaction{ TxHash: hash.String(), Tx: &wire.MsgTx{}, }, closedChannels: map[string]closedChannelInfo{ hash.String(): { channelInfo: channelInfo{ initiator: lndclient.InitiatorLocal, }, }, }, expectedEntries: map[EntryType]bool{ EntryTypeChannelClose: true, EntryTypeChannelCloseFee: true, }, }, { name: "closed channel that remote opened", tx: lndclient.Transaction{ TxHash: hash.String(), Tx: &wire.MsgTx{}, }, closedChannels: map[string]closedChannelInfo{ hash.String(): { channelInfo: channelInfo{ initiator: lndclient.InitiatorRemote, }, }, }, expectedEntries: map[EntryType]bool{ EntryTypeChannelClose: true, }, }, } for _, test := range tests { test := test t.Run(test.name, func(t *testing.T) { t.Parallel() info := &onChainInformation{ txns: []lndclient.Transaction{test.tx}, entryUtils: testUtils, sweeps: test.sweeps, openedChannels: test.openedChannels, closedChannels: test.closedChannels, } report, err := onChainReport(info) require.NoError(t, err, "on chain report failed") require.Equal(t, len(test.expectedEntries), len(report), "wrong number of reports") // Check that each of the entries we got is an expected // type. for _, entry := range report { _, ok := test.expectedEntries[entry.Type] require.True(t, ok, "entry type: %v not "+ "expected", entry.Type) // Once we've found an entry, set it to false // so that we do not double count it. test.expectedEntries[entry.Type] = false } }) } }
explode_data.jsonl/52948
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1285 }
[ 2830, 3393, 1925, 18837, 10361, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 3056, 1235, 341, 197, 11609, 310, 914, 198, 197, 46237, 1060, 326, 303, 2972, 29284, 198, 197, 1903, 896, 7124, 688, 2415, 14032, 96436, 198, 197, 52199, 291, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestPessimisticTxnWithDDLChangeColumn(t *testing.T) { store, clean := createMockStoreAndSetup(t) defer clean() tk := testkit.NewTestKit(t, store) tk.MustExec("use test") tk2 := testkit.NewTestKit(t, store) tk2.MustExec("use test") tk.MustExec("drop table if exists t1") tk.MustExec("create table t1 (c1 int primary key, c2 int, c3 varchar(10))") tk.MustExec("insert t1 values (1, 77, 'a'), (2, 88, 'b')") // Extend column field length is acceptable. tk.MustExec("set tidb_enable_amend_pessimistic_txn = 1;") tk.MustExec("begin pessimistic") tk.MustExec("update t1 set c2 = c1 * 10") tk2.MustExec("alter table t1 modify column c2 bigint") tk.MustExec("commit") tk.MustExec("begin pessimistic") tk.MustExec("update t1 set c3 = 'aba'") tk2.MustExec("alter table t1 modify column c3 varchar(30)") tk.MustExec("commit") tk2.MustExec("admin check table t1") tk.MustQuery("select * from t1").Check(testkit.Rows("1 10 aba", "2 20 aba")) // Change column from nullable to not null is not allowed by now. tk.MustExec("begin pessimistic") tk.MustExec("insert into t1(c1) values(100)") tk2.MustExec("alter table t1 change column c2 cc2 bigint not null") require.Error(t, tk.ExecToErr("commit")) // Change default value is rejected. tk2.MustExec("create table ta(a bigint primary key auto_random(3), b varchar(255) default 'old');") tk2.MustExec("insert into ta(b) values('a')") tk.MustExec("begin pessimistic") tk.MustExec("insert into ta values()") tk2.MustExec("alter table ta modify column b varchar(300) default 'new';") require.Error(t, tk.ExecToErr("commit")) tk2.MustQuery("select b from ta").Check(testkit.Rows("a")) // Change default value with add index. There is a new MultipleKeyFlag flag on the index key, and the column is changed, // the flag check will fail. tk2.MustExec("insert into ta values()") tk.MustExec("begin pessimistic") tk.MustExec("insert into ta(b) values('inserted_value')") tk.MustExec("insert into ta values()") tk.MustExec("insert into ta values()") tk2.MustExec("alter table ta add index i1(b)") tk2.MustExec("alter table ta change column b b varchar(301) default 'newest'") tk2.MustExec("alter table ta modify column b varchar(301) default 'new'") require.Error(t, tk.ExecToErr("commit")) tk2.MustExec("admin check table ta") tk2.MustQuery("select count(b) from ta use index(i1) where b = 'new'").Check(testkit.Rows("1")) // Change default value to now(). tk2.MustExec("create table tbl_time(c1 int, c_time timestamp)") tk2.MustExec("insert into tbl_time(c1) values(1)") tk.MustExec("begin pessimistic") tk.MustExec("insert into tbl_time(c1) values(2)") tk2.MustExec("alter table tbl_time modify column c_time timestamp default now()") tk2.MustExec("insert into tbl_time(c1) values(3)") tk2.MustExec("insert into tbl_time(c1) values(4)") require.Error(t, tk.ExecToErr("commit")) tk2.MustQuery("select count(1) from tbl_time where c_time is not null").Check(testkit.Rows("2")) }
explode_data.jsonl/12491
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1069 }
[ 2830, 3393, 47, 66733, 4532, 31584, 77, 2354, 58781, 4072, 2933, 1155, 353, 8840, 836, 8, 341, 57279, 11, 4240, 1669, 1855, 11571, 6093, 3036, 21821, 1155, 340, 16867, 4240, 2822, 3244, 74, 1669, 1273, 8226, 7121, 2271, 7695, 1155, 11, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestHttpCmd(t *testing.T) { dir := testDir + "httpcmd" receiver := svc.Svc{ Dir: dir, } receiver.Init() defer os.RemoveAll(dir) err := os.Chdir(dir) if err != nil { t.Fatal(err) } // go-doudou svc http --handler -c go -o _, _, err = ExecuteCommandC(rootCmd, []string{"svc", "http", "--handler", "-c", "go", "-o"}...) if err != nil { t.Fatal(err) } expect := `package httpsrv import ( "context" "encoding/json" "net/http" service "testfileshttpcmd" "testfileshttpcmd/vo" ) type TestfileshttpcmdHandlerImpl struct { testfileshttpcmd service.Testfileshttpcmd } func (receiver *TestfileshttpcmdHandlerImpl) PageUsers(_writer http.ResponseWriter, _req *http.Request) { var ( ctx context.Context query vo.PageQuery code int data vo.PageRet msg error ) ctx = _req.Context() if err := json.NewDecoder(_req.Body).Decode(&query); err != nil { http.Error(_writer, err.Error(), http.StatusBadRequest) return } defer _req.Body.Close() code, data, msg = receiver.testfileshttpcmd.PageUsers( ctx, query, ) if msg != nil { if msg == context.Canceled { http.Error(_writer, msg.Error(), http.StatusBadRequest) } else { http.Error(_writer, msg.Error(), http.StatusInternalServerError) } return } if err := json.NewEncoder(_writer).Encode(struct { Code int ` + "`" + `json:"code,omitempty"` + "`" + ` Data vo.PageRet ` + "`" + `json:"data,omitempty"` + "`" + ` }{ Code: code, Data: data, }); err != nil { http.Error(_writer, err.Error(), http.StatusInternalServerError) return } } func NewTestfileshttpcmdHandler(testfileshttpcmd service.Testfileshttpcmd) TestfileshttpcmdHandler { return &TestfileshttpcmdHandlerImpl{ testfileshttpcmd, } } ` handlerimplfile := dir + "/transport/httpsrv/handlerimpl.go" f, err := os.Open(handlerimplfile) if err != nil { t.Fatal(err) } content, err := ioutil.ReadAll(f) if err != nil { t.Fatal(err) } if string(content) != expect { t.Errorf("want %s, go %s\n", expect, string(content)) } expect = `package client import ( "context" "encoding/json" "net/url" "testfileshttpcmd/vo" "github.com/go-resty/resty/v2" "github.com/pkg/errors" "github.com/unionj-cloud/go-doudou/stringutils" ddhttp "github.com/unionj-cloud/go-doudou/svc/http" ) type TestfileshttpcmdClient struct { provider ddhttp.IServiceProvider client *resty.Client } func (receiver *TestfileshttpcmdClient) SetProvider(provider ddhttp.IServiceProvider) { receiver.provider = provider } func (receiver *TestfileshttpcmdClient) SetClient(client *resty.Client) { receiver.client = client } func (receiver *TestfileshttpcmdClient) PageUsers(ctx context.Context, query vo.PageQuery) (code int, data vo.PageRet, msg error) { var ( _server string _err error ) if _server, _err = receiver.provider.SelectServer(); _err != nil { msg = errors.Wrap(_err, "") return } _urlValues := url.Values{} _req := receiver.client.R() _req.SetContext(ctx) _req.SetBody(query) if _req.Body != nil { _req.SetQueryParamsFromValues(_urlValues) } else { _req.SetFormDataFromValues(_urlValues) } _resp, _err := _req.Post(_server + "/testfileshttpcmd/pageusers") if _err != nil { msg = errors.Wrap(_err, "") return } if _resp.IsError() { msg = errors.New(_resp.String()) return } var _result struct { Code int ` + "`" + `json:"code"` + "`" + ` Data vo.PageRet ` + "`" + `json:"data"` + "`" + ` Msg string ` + "`" + `json:"msg"` + "`" + ` } if _err = json.Unmarshal(_resp.Body(), &_result); _err != nil { msg = errors.Wrap(_err, "") return } if stringutils.IsNotEmpty(_result.Msg) { msg = errors.New(_result.Msg) return } return _result.Code, _result.Data, nil } func NewTestfileshttpcmd(opts ...ddhttp.DdClientOption) *TestfileshttpcmdClient { defaultProvider := ddhttp.NewServiceProvider("TESTFILESHTTPCMD") defaultClient := ddhttp.NewClient() svcClient := &TestfileshttpcmdClient{ provider: defaultProvider, client: defaultClient, } for _, opt := range opts { opt(svcClient) } return svcClient } ` clientfile := dir + "/client/client.go" f, err = os.Open(clientfile) if err != nil { t.Fatal(err) } content, err = ioutil.ReadAll(f) if err != nil { t.Fatal(err) } if string(content) != expect { t.Errorf("want %s, go %s\n", expect, string(content)) } }
explode_data.jsonl/67883
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1763 }
[ 2830, 3393, 2905, 15613, 1155, 353, 8840, 836, 8, 341, 48532, 1669, 1273, 6184, 488, 330, 1254, 8710, 698, 17200, 12862, 1669, 46154, 808, 7362, 515, 197, 197, 6184, 25, 5419, 345, 197, 532, 17200, 12862, 26849, 741, 16867, 2643, 84427,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
9
func TestPasswordEntry_Placeholder(t *testing.T) { entry, window := setupPasswordImageTest() defer teardownImageTest(window) c := window.Canvas() entry.SetPlaceHolder("Password") test.AssertImageMatches(t, "password_entry/placeholder_initial.png", c.Capture()) test.Type(entry, "Hié™שרה") assert.Equal(t, "Hié™שרה", entry.Text) test.AssertImageMatches(t, "password_entry/placeholder_typed.png", c.Capture()) }
explode_data.jsonl/57338
{ "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, 4876, 5874, 1088, 26536, 4251, 1155, 353, 8840, 836, 8, 341, 48344, 11, 3241, 1669, 6505, 4876, 1906, 2271, 741, 16867, 49304, 1906, 2271, 15906, 340, 1444, 1669, 3241, 54121, 2822, 48344, 4202, 17371, 8589, 445, 4876, 1138, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestClassifyExamples(t *testing.T) { const src = ` package p const Const1 = 0 var Var1 = 0 type ( Type1 int Type1_Foo int Type1_foo int type2 int Embed struct { Type1 } Uembed struct { type2 } ) func Func1() {} func Func1_Foo() {} func Func1_foo() {} func func2() {} func (Type1) Func1() {} func (Type1) Func1_Foo() {} func (Type1) Func1_foo() {} func (Type1) func2() {} func (type2) Func1() {} type ( Conflict int Conflict_Conflict int Conflict_conflict int ) func (Conflict) Conflict() {} func GFunc[T any]() {} type GType[T any] int func (GType[T]) M() {} ` const test = ` package p_test func ExampleConst1() {} // invalid - no support for consts and vars func ExampleVar1() {} // invalid - no support for consts and vars func Example() {} func Example_() {} // invalid - suffix must start with a lower-case letter func Example_suffix() {} func Example_suffix_xX_X_x() {} func Example_世界() {} // invalid - suffix must start with a lower-case letter func Example_123() {} // invalid - suffix must start with a lower-case letter func Example_BadSuffix() {} // invalid - suffix must start with a lower-case letter func ExampleType1() {} func ExampleType1_() {} // invalid - suffix must start with a lower-case letter func ExampleType1_suffix() {} func ExampleType1_BadSuffix() {} // invalid - suffix must start with a lower-case letter func ExampleType1_Foo() {} func ExampleType1_Foo_suffix() {} func ExampleType1_Foo_BadSuffix() {} // invalid - suffix must start with a lower-case letter func ExampleType1_foo() {} func ExampleType1_foo_suffix() {} func ExampleType1_foo_Suffix() {} // matches Type1, instead of Type1_foo func Exampletype2() {} // invalid - cannot match unexported func ExampleFunc1() {} func ExampleFunc1_() {} // invalid - suffix must start with a lower-case letter func ExampleFunc1_suffix() {} func ExampleFunc1_BadSuffix() {} // invalid - suffix must start with a lower-case letter func ExampleFunc1_Foo() {} func ExampleFunc1_Foo_suffix() {} func ExampleFunc1_Foo_BadSuffix() {} // invalid - suffix must start with a lower-case letter func ExampleFunc1_foo() {} func ExampleFunc1_foo_suffix() {} func ExampleFunc1_foo_Suffix() {} // matches Func1, instead of Func1_foo func Examplefunc1() {} // invalid - cannot match unexported func ExampleType1_Func1() {} func ExampleType1_Func1_() {} // invalid - suffix must start with a lower-case letter func ExampleType1_Func1_suffix() {} func ExampleType1_Func1_BadSuffix() {} // invalid - suffix must start with a lower-case letter func ExampleType1_Func1_Foo() {} func ExampleType1_Func1_Foo_suffix() {} func ExampleType1_Func1_Foo_BadSuffix() {} // invalid - suffix must start with a lower-case letter func ExampleType1_Func1_foo() {} func ExampleType1_Func1_foo_suffix() {} func ExampleType1_Func1_foo_Suffix() {} // matches Type1.Func1, instead of Type1.Func1_foo func ExampleType1_func2() {} // matches Type1, instead of Type1.func2 func ExampleEmbed_Func1() {} // invalid - no support for forwarded methods from embedding exported type func ExampleUembed_Func1() {} // methods from embedding unexported types are OK func ExampleUembed_Func1_suffix() {} func ExampleConflict_Conflict() {} // ambiguous with either Conflict or Conflict_Conflict type func ExampleConflict_conflict() {} // ambiguous with either Conflict or Conflict_conflict type func ExampleConflict_Conflict_suffix() {} // ambiguous with either Conflict or Conflict_Conflict type func ExampleConflict_conflict_suffix() {} // ambiguous with either Conflict or Conflict_conflict type func ExampleGFunc() {} func ExampleGFunc_suffix() {} func ExampleGType_M() {} func ExampleGType_M_suffix() {} ` // Parse literal source code as a *doc.Package. fset := token.NewFileSet() files := []*ast.File{ mustParse(fset, "src.go", src), mustParse(fset, "src_test.go", test), } p, err := doc.NewFromFiles(fset, files, "example.com/p") if err != nil { t.Fatalf("doc.NewFromFiles: %v", err) } // Collect the association of examples to top-level identifiers. got := map[string][]string{} got[""] = exampleNames(p.Examples) for _, f := range p.Funcs { got[f.Name] = exampleNames(f.Examples) } for _, t := range p.Types { got[t.Name] = exampleNames(t.Examples) for _, f := range t.Funcs { got[f.Name] = exampleNames(f.Examples) } for _, m := range t.Methods { got[t.Name+"."+m.Name] = exampleNames(m.Examples) } } want := map[string][]string{ "": {"", "suffix", "suffix_xX_X_x"}, // Package-level examples. "Type1": {"", "foo_Suffix", "func2", "suffix"}, "Type1_Foo": {"", "suffix"}, "Type1_foo": {"", "suffix"}, "Func1": {"", "foo_Suffix", "suffix"}, "Func1_Foo": {"", "suffix"}, "Func1_foo": {"", "suffix"}, "Type1.Func1": {"", "foo_Suffix", "suffix"}, "Type1.Func1_Foo": {"", "suffix"}, "Type1.Func1_foo": {"", "suffix"}, "Uembed.Func1": {"", "suffix"}, // These are implementation dependent due to the ambiguous parsing. "Conflict_Conflict": {"", "suffix"}, "Conflict_conflict": {"", "suffix"}, "GFunc": {"", "suffix"}, "GType.M": {"", "suffix"}, } for id := range got { if !reflect.DeepEqual(got[id], want[id]) { t.Errorf("classification mismatch for %q:\ngot %q\nwant %q", id, got[id], want[id]) } delete(want, id) } if len(want) > 0 { t.Errorf("did not find:\n%q", want) } }
explode_data.jsonl/40681
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 2286 }
[ 2830, 3393, 1957, 1437, 40381, 1155, 353, 8840, 836, 8, 341, 4777, 2286, 284, 22074, 1722, 281, 271, 1024, 24522, 16, 284, 220, 15, 198, 947, 256, 8735, 16, 256, 284, 220, 15, 271, 1313, 2399, 27725, 16, 257, 526, 198, 27725, 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...
9
func TestKill(t *testing.T) { skipOn(t, "N/A", "lldb") // k command presumably works but leaves the process around? withTestProcess("testprog", t, func(p *proc.Target, fixture protest.Fixture) { if err := p.Detach(true); err != nil { t.Fatal(err) } if valid, _ := p.Valid(); valid { t.Fatal("expected process to have exited") } if runtime.GOOS == "linux" { if runtime.GOARCH == "arm64" { //there is no any sync between signal sended(tracee handled) and open /proc/%d/. It may fail on arm64 return } _, err := os.Open(fmt.Sprintf("/proc/%d/", p.Pid())) if err == nil { t.Fatal("process has not exited", p.Pid()) } } }) }
explode_data.jsonl/56219
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 277 }
[ 2830, 3393, 53734, 1155, 353, 8840, 836, 8, 341, 1903, 13389, 1925, 1155, 11, 330, 45, 10360, 497, 330, 32459, 65, 899, 442, 595, 3210, 35448, 4278, 714, 10901, 279, 1882, 2163, 5267, 46948, 2271, 7423, 445, 1944, 32992, 497, 259, 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...
6
func TestCredentialsMisuse(t *testing.T) { tlsCreds, err := credentials.NewClientTLSFromFile(tlsDir+"ca.pem", "x.test.youtube.com") if err != nil { t.Fatalf("Failed to create authenticator %v", err) } // Two conflicting credential configurations if _, err := Dial("Non-Existent.Server:80", WithTransportCredentials(tlsCreds), WithBlock(), WithInsecure()); err != errCredentialsConflict { t.Fatalf("Dial(_, _) = _, %v, want _, %v", err, errCredentialsConflict) } // security info on insecure connection if _, err := Dial("Non-Existent.Server:80", WithPerRPCCredentials(securePerRPCCredentials{}), WithBlock(), WithInsecure()); err != errTransportCredentialsMissing { t.Fatalf("Dial(_, _) = _, %v, want _, %v", err, errTransportCredentialsMissing) } }
explode_data.jsonl/6664
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 272 }
[ 2830, 3393, 27025, 83159, 810, 1155, 353, 8840, 836, 8, 341, 3244, 4730, 34, 53369, 11, 1848, 1669, 16387, 7121, 2959, 45439, 43633, 1155, 4730, 6184, 5172, 924, 49373, 497, 330, 87, 5958, 20145, 905, 1138, 743, 1848, 961, 2092, 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...
4
func TestLogsWorkflowOpts_Validate_EndError(t *testing.T) { opts := logsWorkflowOpts{logsWorkflowVars: logsWorkflowVars{logsSharedVars: logsSharedVars{endString: "abc"}}} err := opts.Validate() assert.Equal(t, fmt.Errorf("Could not find format for \"abc\""), err) }
explode_data.jsonl/74228
{ "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, 51053, 62768, 43451, 62, 17926, 49953, 1454, 1155, 353, 8840, 836, 8, 341, 64734, 1669, 18422, 62768, 43451, 90, 22081, 62768, 28305, 25, 18422, 62768, 28305, 90, 22081, 16997, 28305, 25, 18422, 16997, 28305, 90, 408, 703, 25,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestUpgrade(t *testing.T) { path := "github.com/hyperledger/fabric/examples/chaincode/go/chaincode_example02" testUpgrade(t, "example02", "0", "example02", "1", path, "") testUpgrade(t, "example02", "0", "example02", "", path, EmptyVersionErr("example02").Error()) testUpgrade(t, "example02", "0", "example02", "0", path, IdenticalVersionErr("example02").Error()) testUpgrade(t, "example02", "0", "example03", "1", path, NotFoundErr("test").Error()) testUpgrade(t, "example02", "0", "example02", "1{}0", path, InvalidVersionErr("1{}0").Error()) testUpgrade(t, "example02", "0", "example*02", "1{}0", path, InvalidChaincodeNameErr("example*02").Error()) testUpgrade(t, "example02", "0", "", "1", path, EmptyChaincodeNameErr("").Error()) }
explode_data.jsonl/9390
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 275 }
[ 2830, 3393, 43861, 1155, 353, 8840, 836, 8, 341, 26781, 1669, 330, 5204, 905, 7530, 39252, 50704, 6663, 28897, 67020, 14, 8819, 1851, 25525, 14, 8819, 1851, 39304, 15, 17, 1837, 18185, 43861, 1155, 11, 330, 8687, 15, 17, 497, 330, 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 TestRespondentContextClosed(t *testing.T) { s := GetSocket(t, NewSocket) c, e := s.OpenContext() MustSucceed(t, e) MustNotBeNil(t, c) MustSucceed(t, c.Close()) MustBeError(t, c.Close(), mangos.ErrClosed) c, e = s.OpenContext() MustSucceed(t, e) MustNotBeNil(t, c) MustSucceed(t, s.Close()) MustBeError(t, c.Close(), mangos.ErrClosed) _, e = s.OpenContext() MustBeError(t, e, mangos.ErrClosed) }
explode_data.jsonl/57409
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 193 }
[ 2830, 3393, 65354, 306, 1972, 26884, 1155, 353, 8840, 836, 8, 341, 1903, 1669, 2126, 10286, 1155, 11, 1532, 10286, 340, 1444, 11, 384, 1669, 274, 12953, 1972, 741, 9209, 590, 50, 29264, 1155, 11, 384, 340, 9209, 590, 2623, 3430, 19064...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestMetaBackend_emptyLegacyRemote(t *testing.T) { // Create a temporary working directory that is empty td := tempDir(t) os.MkdirAll(td, 0755) defer os.RemoveAll(td) defer testChdir(t, td)() // Create some legacy remote state legacyState := testState() _, srv := testRemoteState(t, legacyState, 200) defer srv.Close() statePath := testStateFileRemote(t, legacyState) // Setup the meta m := testMetaBackend(t, nil) // Get the backend b, err := m.Backend(&BackendOpts{Init: true}) if err != nil { t.Fatalf("bad: %s", err) } // Check the state s, err := b.State(backend.DefaultStateName) if err != nil { t.Fatalf("bad: %s", err) } if err := s.RefreshState(); err != nil { t.Fatalf("bad: %s", err) } state := s.State() if actual := state.String(); actual != legacyState.String() { t.Fatalf("bad: %s", actual) } // Verify we didn't setup the backend state if !state.Backend.Empty() { t.Fatal("shouldn't configure backend") } // Verify the default paths don't exist if _, err := os.Stat(DefaultStateFilename); err == nil { t.Fatal("file should not exist") } // Verify a backup doesn't exist if _, err := os.Stat(DefaultStateFilename + DefaultBackupExtension); err == nil { t.Fatal("file should not exist") } if _, err := os.Stat(statePath + DefaultBackupExtension); err == nil { t.Fatal("file should not exist") } }
explode_data.jsonl/34311
{ "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, 12175, 29699, 15124, 77415, 24703, 1155, 353, 8840, 836, 8, 341, 197, 322, 4230, 264, 13340, 3238, 6220, 429, 374, 4287, 198, 76373, 1669, 2730, 6184, 1155, 340, 25078, 1321, 12438, 2403, 61241, 11, 220, 15, 22, 20, 20, 34...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
9
func TestGetHealthStatus(t *testing.T) { status := make(map[string]interface{}) err := handleAndParse(&testingRequest{ url: "/api/chartrepo/health", method: http.MethodGet, credential: sysAdmin, }, &status) if err != nil { t.Fatal(err) } if _, ok := status["health"]; !ok { t.Fatal("expect 'health' but got nil") } }
explode_data.jsonl/74126
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 146 }
[ 2830, 3393, 1949, 14542, 2522, 1155, 353, 8840, 836, 8, 341, 23847, 1669, 1281, 9147, 14032, 31344, 37790, 9859, 1669, 3705, 3036, 14463, 2099, 8840, 1900, 515, 197, 19320, 25, 286, 3521, 2068, 73941, 23476, 14, 12120, 756, 197, 42257, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestConfigUpdate(t *testing.T) { expectedURL := "/v1.30/configs/config_id/update" client := &Client{ version: "1.30", client: newMockClient(func(req *http.Request) (*http.Response, error) { if !strings.HasPrefix(req.URL.Path, expectedURL) { return nil, fmt.Errorf("Expected URL '%s', got '%s'", expectedURL, req.URL) } if req.Method != "POST" { return nil, fmt.Errorf("expected POST method, got %s", req.Method) } return &http.Response{ StatusCode: http.StatusOK, Body: ioutil.NopCloser(bytes.NewReader([]byte("body"))), }, nil }), } err := client.ConfigUpdate(context.Background(), "config_id", swarm.Version{}, swarm.ConfigSpec{}) if err != nil { t.Fatal(err) } }
explode_data.jsonl/59215
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 299 }
[ 2830, 3393, 2648, 4289, 1155, 353, 8840, 836, 8, 341, 42400, 3144, 1669, 3521, 85, 16, 13, 18, 15, 14730, 82, 14730, 842, 29832, 1837, 25291, 1669, 609, 2959, 515, 197, 74954, 25, 330, 16, 13, 18, 15, 756, 197, 25291, 25, 501, 115...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestTransportRejectsAlphaPort(t *testing.T) { res, err := Get("http://dummy.tld:123foo/bar") if err == nil { res.Body.Close() t.Fatal("unexpected success") } ue, ok := err.(*url.Error) if !ok { t.Fatalf("got %#v; want *url.Error", err) } got := ue.Err.Error() want := `invalid port ":123foo" after host` if got != want { t.Errorf("got error %q; want %q", got, want) } }
explode_data.jsonl/14163
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 173 }
[ 2830, 3393, 27560, 78413, 82, 19384, 7084, 1155, 353, 8840, 836, 8, 341, 10202, 11, 1848, 1669, 2126, 445, 1254, 1110, 31390, 734, 507, 25, 16, 17, 18, 7975, 49513, 1138, 743, 1848, 621, 2092, 341, 197, 10202, 20934, 10421, 741, 197, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
4
func TestNamespace(t *testing.T) { t.Run("user", func(t *testing.T) { const wantUserID = 3 users := database.NewMockUserStore() users.GetByIDFunc.SetDefaultHook(func(_ context.Context, id int32) (*types.User, error) { if id != wantUserID { t.Errorf("got %d, want %d", id, wantUserID) } return &types.User{ID: wantUserID, Username: "alice"}, nil }) db := database.NewMockDB() db.UsersFunc.SetDefaultReturn(users) RunTests(t, []*Test{ { Schema: mustParseGraphQLSchema(t, db), Query: ` { namespace(id: "VXNlcjoz") { __typename ... on User { username } } } `, ExpectedResult: ` { "namespace": { "__typename": "User", "username": "alice" } } `, }, }) }) t.Run("organization", func(t *testing.T) { const wantOrgID = 3 orgs := database.NewMockOrgStore() orgs.GetByIDFunc.SetDefaultHook(func(_ context.Context, id int32) (*types.Org, error) { if id != wantOrgID { t.Errorf("got %d, want %d", id, wantOrgID) } return &types.Org{ID: wantOrgID, Name: "acme"}, nil }) db := database.NewMockDB() db.OrgsFunc.SetDefaultReturn(orgs) RunTests(t, []*Test{ { Schema: mustParseGraphQLSchema(t, db), Query: ` { namespace(id: "T3JnOjM=") { __typename ... on Org { name } } } `, ExpectedResult: ` { "namespace": { "__typename": "Org", "name": "acme" } } `, }, }) }) t.Run("invalid", func(t *testing.T) { invalidID := "aW52YWxpZDoz" wantErr := InvalidNamespaceIDErr{id: graphql.ID(invalidID)} RunTests(t, []*Test{ { Schema: mustParseGraphQLSchema(t, database.NewMockDB()), Query: fmt.Sprintf(` { namespace(id: %q) { __typename } } `, invalidID), ExpectedResult: ` { "namespace": null } `, ExpectedErrors: []*gqlerrors.QueryError{ { Path: []any{"namespace"}, Message: wantErr.Error(), ResolverError: wantErr, }, }, }, }) }) }
explode_data.jsonl/73118
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1082 }
[ 2830, 3393, 22699, 1155, 353, 8840, 836, 8, 341, 3244, 16708, 445, 872, 497, 2915, 1155, 353, 8840, 836, 8, 341, 197, 4777, 1366, 36899, 284, 220, 18, 198, 197, 90896, 1669, 4625, 7121, 11571, 1474, 6093, 741, 197, 90896, 2234, 60572,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestAWSInstanceStateController(t *testing.T) { mockCtrl := gomock.NewController(t) sqsSvs = mock_sqsiface.NewMockSQSAPI(mockCtrl) instanceStateReconciler = &AwsInstanceStateReconciler{ Client: testEnv.Client, Log: ctrl.Log.WithName("controllers").WithName("AWSInstanceState"), sqsServiceFactory: func() sqsiface.SQSAPI { return sqsSvs }, } defer mockCtrl.Finish() t.Run("should maintain list of cluster queue URLs and reconcile failing machines", func(t *testing.T) { g := NewWithT(t) failingMachineMeta := metav1.ObjectMeta{ Name: "aws-cluster-1-instance-1", Namespace: "default", } sqsSvs.EXPECT().GetQueueUrl(&sqs.GetQueueUrlInput{QueueName: aws.String("aws-cluster-1-queue")}).AnyTimes(). Return(&sqs.GetQueueUrlOutput{QueueUrl: aws.String("aws-cluster-1-url")}, nil) sqsSvs.EXPECT().GetQueueUrl(&sqs.GetQueueUrlInput{QueueName: aws.String("aws-cluster-2-queue")}).AnyTimes(). Return(&sqs.GetQueueUrlOutput{QueueUrl: aws.String("aws-cluster-2-url")}, nil) sqsSvs.EXPECT().GetQueueUrl(&sqs.GetQueueUrlInput{QueueName: aws.String("aws-cluster-3-queue")}).AnyTimes(). Return(&sqs.GetQueueUrlOutput{QueueUrl: aws.String("aws-cluster-3-url")}, nil) sqsSvs.EXPECT().ReceiveMessage(&sqs.ReceiveMessageInput{QueueUrl: aws.String("aws-cluster-1-url")}).AnyTimes(). DoAndReturn(func(arg *sqs.ReceiveMessageInput) (*sqs.ReceiveMessageOutput, error) { m := &infrav1.AWSMachine{} lookupKey := types.NamespacedName{ Namespace: failingMachineMeta.Namespace, Name: failingMachineMeta.Name, } err := k8sClient.Get(context.TODO(), lookupKey, m) // start returning a message once the AWSMachine is available if err == nil { return &sqs.ReceiveMessageOutput{ Messages: []*sqs.Message{{ ReceiptHandle: aws.String("message-receipt-handle"), Body: aws.String(messageBodyJSON), }}, }, nil } return &sqs.ReceiveMessageOutput{Messages: []*sqs.Message{}}, nil }) sqsSvs.EXPECT().ReceiveMessage(&sqs.ReceiveMessageInput{QueueUrl: aws.String("aws-cluster-2-url")}).AnyTimes(). Return(&sqs.ReceiveMessageOutput{Messages: []*sqs.Message{}}, nil) sqsSvs.EXPECT().ReceiveMessage(&sqs.ReceiveMessageInput{QueueUrl: aws.String("aws-cluster-3-url")}).AnyTimes(). Return(&sqs.ReceiveMessageOutput{Messages: []*sqs.Message{}}, nil) sqsSvs.EXPECT().DeleteMessage(&sqs.DeleteMessageInput{QueueUrl: aws.String("aws-cluster-1-url"), ReceiptHandle: aws.String("message-receipt-handle")}).AnyTimes(). Return(nil, nil) g.Expect(testEnv.Manager.GetFieldIndexer().IndexField(context.Background(), &infrav1.AWSMachine{}, controllers.InstanceIDIndex, func(o client.Object) []string { m := o.(*infrav1.AWSMachine) if m.Spec.InstanceID != nil { return []string{*m.Spec.InstanceID} } return nil }, )).ToNot(HaveOccurred()) err := instanceStateReconciler.SetupWithManager(context.Background(), testEnv.Manager, controller.Options{}) g.Expect(err).ToNot(HaveOccurred()) go func() { fmt.Println("Starting the manager") if err := testEnv.StartManager(ctx); err != nil { panic(fmt.Sprintf("Failed to start the envtest manager: %v", err)) } }() testEnv.WaitForWebhooks() k8sClient = testEnv.GetClient() persistObject(g, createAWSCluster("aws-cluster-1")) persistObject(g, createAWSCluster("aws-cluster-2")) machine1 := &infrav1.AWSMachine{ Spec: infrav1.AWSMachineSpec{ InstanceID: pointer.StringPtr("i-failing-instance-1"), InstanceType: "test", }, ObjectMeta: failingMachineMeta, } persistObject(g, machine1) t.Log("Ensuring queue URLs are up-to-date") g.Eventually(func() bool { exist := true for _, cluster := range []string{"aws-cluster-1", "aws-cluster-2"} { _, ok := instanceStateReconciler.queueURLs.Load(cluster) exist = exist && ok } return exist }, 10*time.Second).Should(Equal(true)) deleteAWSCluster(g, "aws-cluster-2") t.Log("Ensuring we stop tracking deleted queue") g.Eventually(func() bool { _, ok := instanceStateReconciler.queueURLs.Load("aws-cluster-2") return ok }, 10*time.Second).Should(Equal(false)) persistObject(g, createAWSCluster("aws-cluster-3")) t.Log("Ensuring newly created cluster is added to tracked clusters") g.Eventually(func() bool { exist := true for _, cluster := range []string{"aws-cluster-1", "aws-cluster-3"} { _, ok := instanceStateReconciler.queueURLs.Load(cluster) exist = exist && ok } return exist }, 10*time.Second).Should(Equal(true)) t.Log("Ensuring machine is labelled with correct instance state") g.Eventually(func() bool { m := &infrav1.AWSMachine{} key := types.NamespacedName{ Namespace: failingMachineMeta.Namespace, Name: failingMachineMeta.Name, } g.Expect(k8sClient.Get(context.TODO(), key, m)).NotTo(HaveOccurred()) labels := m.GetLabels() val := labels[Ec2InstanceStateLabelKey] return val == "shutting-down" }, 10*time.Second).Should(Equal(true)) }) }
explode_data.jsonl/64520
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 2050 }
[ 2830, 3393, 36136, 8846, 2051, 1155, 353, 8840, 836, 8, 341, 77333, 15001, 1669, 342, 316, 1176, 7121, 2051, 1155, 340, 1903, 26358, 50, 11562, 284, 7860, 643, 26358, 52674, 7121, 11571, 64308, 50, 7082, 30389, 15001, 340, 56256, 1397, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestMTLS(t *testing.T) { t.Run("with mTLS enabled", func(t *testing.T) { rt := NewTestDaprRuntime(modes.StandaloneMode) rt.runtimeConfig.mtlsEnabled = true rt.runtimeConfig.SentryServiceAddress = "1.1.1.1" os.Setenv(certs.TrustAnchorsEnvVar, testCertRoot) defer os.Clearenv() err := rt.establishSecurity("test", rt.runtimeConfig.SentryServiceAddress) assert.Nil(t, err) assert.NotNil(t, rt.authenticator) }) t.Run("with mTLS disabled", func(t *testing.T) { rt := NewTestDaprRuntime(modes.StandaloneMode) err := rt.establishSecurity("test", rt.runtimeConfig.SentryServiceAddress) assert.Nil(t, err) assert.Nil(t, rt.authenticator) }) }
explode_data.jsonl/76069
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 276 }
[ 2830, 3393, 8505, 7268, 1155, 353, 8840, 836, 8, 341, 3244, 16708, 445, 4197, 296, 45439, 8970, 497, 2915, 1155, 353, 8840, 836, 8, 341, 197, 55060, 1669, 1532, 2271, 35, 59817, 15123, 1255, 2539, 7758, 84112, 3636, 340, 197, 55060, 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 TestDumpRequest(t *testing.T) { url, _ := url.Parse("https://www.example.com") assert.True(t, len(DumpRequest(&http.Request{ URL: url, })) > 0) }
explode_data.jsonl/43866
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 69 }
[ 2830, 3393, 51056, 1900, 1155, 353, 8840, 836, 8, 341, 19320, 11, 716, 1669, 2515, 8937, 445, 2428, 1110, 2136, 7724, 905, 1138, 1572, 6948, 32443, 1155, 11, 2422, 5432, 1510, 1900, 2099, 1254, 9659, 515, 197, 79055, 25, 220, 2515, 34...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
func TestHeadTracker_StartConnectsFromLastSavedHeader(t *testing.T) { t.Parallel() g := gomega.NewGomegaWithT(t) // Need separate db because ht.Stop() will cancel the ctx, causing a db connection // close and go-txdb rollback. config, _, cleanupDB := cltest.BootstrapThrowawayORM(t, "last_saved_header", true) defer cleanupDB() config.Config.Dialect = dialects.Postgres store, cleanup := cltest.NewStoreWithConfig(t, config) defer cleanup() logger := store.Config.CreateProductionLogger() sub := new(mocks.Subscription) ethClient := new(mocks.Client) store.EthClient = ethClient chchHeaders := make(chan chan<- *models.Head, 1) ethClient.On("ChainID", mock.Anything).Return(store.Config.ChainID(), nil) ethClient.On("SubscribeNewHead", mock.Anything, mock.Anything). Run(func(args mock.Arguments) { chchHeaders <- args.Get(1).(chan<- *models.Head) }). Return(sub, nil) latestHeadByNumber := make(map[int64]*models.Head) fnCall := ethClient.On("HeaderByNumber", mock.Anything, mock.Anything) fnCall.RunFn = func(args mock.Arguments) { num := args.Get(1).(*big.Int) head, exists := latestHeadByNumber[num.Int64()] if !exists { head = cltest.Head(num.Int64()) latestHeadByNumber[num.Int64()] = head } fnCall.ReturnArguments = mock.Arguments{head, nil} } sub.On("Unsubscribe").Return() sub.On("Err").Return(nil) lastSavedBN := big.NewInt(1) currentBN := big.NewInt(2) var connectedValue atomic.Value checker := &cltest.MockHeadTrackable{ConnectedCallback: func(bn *models.Head) { connectedValue.Store(bn.ToInt()) }} ht := services.NewHeadTracker(logger, store, []strpkg.HeadTrackable{checker}, cltest.NeverSleeper{}) require.NoError(t, ht.Save(context.TODO(), models.NewHead(lastSavedBN, cltest.NewHash(), cltest.NewHash(), 0))) assert.Nil(t, ht.Start()) headers := <-chchHeaders headers <- &models.Head{Number: currentBN.Int64()} g.Eventually(func() int32 { return checker.ConnectedCount() }).Should(gomega.Equal(int32(1))) connectedBN := connectedValue.Load().(*big.Int) assert.Equal(t, lastSavedBN, connectedBN) g.Eventually(func() int32 { return checker.OnNewLongestChainCount() }).Should(gomega.Equal(int32(1))) assert.NoError(t, ht.Stop()) h, err := store.LastHead(context.TODO()) require.NoError(t, err) require.NotNil(t, h) assert.Equal(t, h.Number, currentBN.Int64()) }
explode_data.jsonl/9098
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 875 }
[ 2830, 3393, 12346, 31133, 38056, 14611, 82, 3830, 5842, 41133, 4047, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 741, 3174, 1669, 342, 32696, 7121, 38, 32696, 2354, 51, 1155, 692, 197, 322, 14656, 8651, 2927, 1576, 34323, 30213, 36...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestRest_CreateWithLazyImage(t *testing.T) { ts, _, teardown := startupT(t) defer teardown() body := `{"text": "test 123 ![](http://example.com/image.png)", "locator":{"url": "https://radio-t.com/blah1", "site": "remark42"}}` // create comment resp, err := post(t, ts.URL+"/api/v1/comment", body) require.NoError(t, err) require.Equal(t, http.StatusCreated, resp.StatusCode) b, err := ioutil.ReadAll(resp.Body) assert.NoError(t, err) c := store.Comment{} err = json.Unmarshal(b, &c) assert.NoError(t, err) assert.Equal(t, c.Text, "<p>test 123 <img src=\"http://example.com/image.png\" alt=\"\" loading=\"lazy\"/></p>\n") }
explode_data.jsonl/37391
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 266 }
[ 2830, 3393, 12416, 34325, 2354, 39766, 1906, 1155, 353, 8840, 836, 8, 341, 57441, 11, 8358, 49304, 1669, 20567, 51, 1155, 340, 16867, 49304, 741, 35402, 1669, 1565, 4913, 1318, 788, 330, 1944, 220, 16, 17, 18, 753, 50994, 1254, 1110, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestQuering(t *testing.T) { cases := []CR{ { caseName: "1. Simple filter", filter: []Filter{ {FieldName: "Oi.Descr", Value: "Debug"}, {FieldName: "Oi.Santa.ID", Value: 1, Operation: ComparisonGreater}, {FieldName: "Oi.Santa.Clause", Value: "Tree"}, }, values: fieldValues{ fieldName: "Oi.Santa.ID", values: []interface{}{2, 3}, }, }, { caseName: "1.1. Simple inValue filter", filter: []Filter{ {FieldName: "Oi.Santa.Clause", Value: []string{"Baltic", "Pacific"}, Operation: ComparisonIn}, }, values: fieldValues{ fieldName: "Oi.Santa.ID", values: []interface{}{34, 35}, }, }, { caseName: "1.2. Simple not equal filter", filter: []Filter{ {FieldName: "Oi.Descr", Value: "Debug"}, {FieldName: "Oi.Santa.ID", Value: 1, Operation: ComparisonGreater}, {FieldName: "Oi.Santa.Clause", Value: "Tree"}, {FieldName: "Oi.Santa.ID", Value: 2, Operation: ComparisonNotEqual}, }, values: fieldValues{ fieldName: "Oi.Santa.ID", values: []interface{}{3}, }, }, { caseName: "2. String begin with + modifier", filter: []Filter{ {FieldName: "Oi.Code", Value: "x25990"}, {FieldName: "Oi.Santa.Clause", Value: "tree", Modifier: modMe, Operation: ComparisonBeginWith}, }, values: fieldValues{ fieldName: "Oi.Santa.ID", values: []interface{}{39, 41}, }, }, { caseName: "3. Int32, lesser, exists in slice", filter: []Filter{ {FieldName: "Oi.ID", Value: int32(200), Operation: ComparisonLesser}, {FieldName: "Version", Value: float32(3.78), Operation: ComparisonEqual}, {FieldName: "Oi.Santa.Chain", Value: 39, Operation: ComparisonExists}, }, values: fieldValues{ fieldName: "Oi.Santa.ID", values: []interface{}{3, 13, 14}, }, }, { caseName: "4. String end with, int32 greater, string lesser, string end with, float32 greater", filter: []Filter{ {FieldName: "Oi.ID", Value: int32(100), Operation: ComparisonGreater}, {FieldName: "Version", Value: float32(1), Operation: ComparisonGreater}, {FieldName: "Oi.Santa.Clause", Value: "ic", Operation: ComparisonEndWith}, {FieldName: "Oi.Descr", Value: "ZZZZZZZZ", Operation: ComparisonLesser}, {FieldName: "Oi.Descr", Value: "Ab", Operation: ComparisonGreater}, }, values: fieldValues{ fieldName: "Oi.Santa.ID", values: []interface{}{34, 35}, }, }, { caseName: "5. Unsupported Comparison 1", filter: []Filter{ {FieldName: "Number", Value: 1, Operation: ComparisonEndWith}, }, err: errors.New("unsupported comparison"), }, { caseName: "6. Unsupported Comparison 2", filter: []Filter{ {FieldName: "Number", Value: 1, Operation: ComparisonBeginWith}, }, err: errors.New("unsupported comparison"), }, { caseName: "7. Unsupported Comparison 3", filter: []Filter{ {FieldName: "SomeByte", Value: 1, Operation: ComparisonGreater}, }, err: errors.New("unsupported comparison"), }, { caseName: "8. Unsupported Comparison 4", filter: []Filter{ {FieldName: "SomeByte", Value: 1, Operation: ComparisonLesser}, }, err: errors.New("unsupported comparison"), }, { caseName: "9. Unsupported Comparison 5", filter: []Filter{ {FieldName: "Number", Value: 1, Operation: ComparisonExists}, }, err: errors.New("unsupported comparison"), }, { caseName: "10. Unsupported Comparison 6", filter: []Filter{ {FieldName: "Number", Value: 1, Operation: 99}, }, err: errors.New("unsupported comparison"), }, { caseName: "10.1. Unsupported Comparison 7", filter: []Filter{ {FieldName: "Oi.Santa.Clause", Value: "Baltic", Operation: ComparisonIn}, }, err: errors.New("unsupported comparison"), }, { caseName: "11. Another filters", filter: []Filter{ {FieldName: "Oi.Santa.ID", Value: 20, Operation: ComparisonLesser}, {FieldName: "Version", Value: float32(9), Operation: ComparisonLesser}, {FieldName: "Oi.Custom.MaskF64", Value: float64(2012.33), Operation: ComparisonLesser}, {FieldName: "Oi.Custom.MaskF64", Value: float64(12.3), Operation: ComparisonGreater}, {FieldName: "Oi.Custom.MaskI64", Value: int64(-454), Operation: ComparisonGreater}, {FieldName: "Oi.Custom.MaskI64", Value: int64(900), Operation: ComparisonLesser}, }, values: fieldValues{ fieldName: "Oi.Santa.ID", values: []interface{}{1, 2, 3}, }, }, } RunQueringTests(t, cases) }
explode_data.jsonl/46147
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1838 }
[ 2830, 3393, 2183, 4671, 1155, 353, 8840, 836, 8, 1476, 1444, 2264, 1669, 3056, 8973, 515, 197, 197, 515, 298, 2722, 675, 25, 330, 16, 13, 8993, 4051, 756, 298, 50108, 25, 3056, 5632, 515, 571, 197, 90, 51241, 25, 330, 81096, 68428, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestNewManifestPermissioned(t *testing.T) { manifest, err := bosh.NewManifest(deploymentName, networkName, true, boshDetails) stemcell := bosh.Stemcell{ Alias: "default", Name: boshStemcell, Version: "latest", } Equal(t, err, nil) NotEqual(t, manifest, nil) Equal(t, manifest.Name, deploymentName) Equal(t, manifest.DirectorUuid, boshUuid) Equal(t, manifest.Stemcells[0], stemcell) Equal(t, manifest.Jobs[0].VmType, vmType) Equal(t, manifest.Jobs[0].Networks[0], map[string]string{"name": networkName}) Equal(t, manifest.Properties.Peer.Network, map[string]string{"id": deploymentName}) Equal(t, manifest.Properties.Peer.Consensus, map[string]string{"plugin": "pbft"}) Equal(t, manifest.Properties.Peer.Core.DataPath, peerDataDir) Equal(t, manifest.Properties.Docker.Store.Dir, dockerDataDir) Equal(t, len(manifest.Properties.MemberService.Clients), 7) user := bosh.BlockchainUser{ Name: "lukas", Secret: "NPKYL39uKbkj", Affiliation: "bank_a", AffiliationRole: "00001", } found := false for _, client := range manifest.Properties.MemberService.Clients { if client == user { found = true break } } Equal(t, found, true) }
explode_data.jsonl/52711
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 492 }
[ 2830, 3393, 3564, 38495, 14966, 291, 1155, 353, 8840, 836, 8, 341, 197, 42315, 11, 1848, 1669, 293, 9267, 7121, 38495, 12797, 52799, 675, 11, 3922, 675, 11, 830, 11, 293, 9267, 7799, 692, 18388, 336, 5873, 1669, 293, 9267, 7758, 336, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestNew_data_fail(t *testing.T) { clk := gpiotest.Pin{} data := failPin{fail: true} if dev, err := New(&clk, &data); dev != nil || err == nil { t.Fatal("data pin is not usable") } }
explode_data.jsonl/32417
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 80 }
[ 2830, 3393, 3564, 1769, 22121, 1155, 353, 8840, 836, 8, 341, 197, 32583, 1669, 342, 2493, 354, 477, 82939, 16094, 8924, 1669, 3690, 19861, 90, 18403, 25, 830, 532, 743, 3483, 11, 1848, 1669, 1532, 2099, 32583, 11, 609, 691, 1215, 3483...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestRunGetOut(t *testing.T) { o, err := runGetOut("true") assert.Nil(t, err) assert.Equal(t, len(o), 0) o, err = runGetOut("false") assert.NotNil(t, err) o, err = runGetOut("echo", "hello") assert.Nil(t, err) assert.Equal(t, string(o), "hello\n") // base64 encode "oops" so we can't match on the command arguments o, err = runGetOut("/bin/sh", "-c", "echo hello; echo b29wcwo= | base64 -d 1>&2; exit 1") assert.Error(t, err) errtext := err.Error() assert.Contains(t, errtext, "exit status 1\noops\n") o, err = runGetOut("/usr/bin/test-failure-to-exec-this-should-not-exist", "arg") assert.Error(t, err) }
explode_data.jsonl/28216
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 267 }
[ 2830, 3393, 6727, 1949, 2662, 1155, 353, 8840, 836, 8, 341, 22229, 11, 1848, 1669, 1598, 1949, 2662, 445, 1866, 1138, 6948, 59678, 1155, 11, 1848, 340, 6948, 12808, 1155, 11, 2422, 10108, 701, 220, 15, 692, 22229, 11, 1848, 284, 1598,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestFormatterObjectArgumentsError(test *testing.T) { formatted, err := formatter.New().SetLeftDelimiter("[").Format("[.Z} [.Y} [.X} [.Z}", struct { X, Y, Z int }{ X: 7, Y: 8, Z: 9, }, "c") assert.Error(test, err) assert.Empty(test, formatted) }
explode_data.jsonl/39734
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 118 }
[ 2830, 3393, 14183, 1190, 19139, 1454, 8623, 353, 8840, 836, 8, 341, 37410, 12127, 11, 1848, 1669, 24814, 7121, 1005, 1649, 5415, 91098, 445, 1183, 568, 4061, 10937, 13, 57, 92, 48339, 56, 92, 48339, 55, 92, 48339, 57, 9545, 2036, 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...
1
func Test_Respond(t *testing.T) { t.Parallel() testCases := map[string]struct { status int errString string expectedBody string }{ "status without error string": { status: http.StatusBadRequest, expectedBody: `{"error":"Bad Request"} `, }, "status with error string": { status: http.StatusBadRequest, errString: "bad parameter", expectedBody: `{"error":"bad parameter"} `, }, } for name, testCase := range testCases { testCase := testCase t.Run(name, func(t *testing.T) { t.Parallel() w := httptest.NewRecorder() Respond(w, testCase.status, testCase.errString, contenttype.JSON) response := w.Result() defer response.Body.Close() bytes, err := ioutil.ReadAll(response.Body) require.NoError(t, err) body := string(bytes) assert.Equal(t, testCase.status, response.StatusCode) assert.Equal(t, testCase.expectedBody, body) }) } }
explode_data.jsonl/58531
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 362 }
[ 2830, 3393, 62, 65354, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 2822, 18185, 37302, 1669, 2415, 14032, 60, 1235, 341, 197, 23847, 981, 526, 198, 197, 9859, 703, 262, 914, 198, 197, 42400, 5444, 914, 198, 197, 59403, 197, 197, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestMainMakeVersionStringNoVersion(t *testing.T) { assert := assert.New(t) savedVersion := version version = "" defer func() { version = savedVersion }() v := makeVersionString() testVersionString(assert, v, unknown, commit, specs.Version) }
explode_data.jsonl/52199
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 84 }
[ 2830, 3393, 6202, 8078, 5637, 703, 2753, 5637, 1155, 353, 8840, 836, 8, 341, 6948, 1669, 2060, 7121, 1155, 692, 1903, 4141, 5637, 1669, 2319, 198, 74954, 284, 35829, 16867, 2915, 368, 341, 197, 74954, 284, 6781, 5637, 198, 197, 66816, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestReceivedInvalidSegmentCountIncrement(t *testing.T) { c := context.New(t, defaultMTU) defer c.Cleanup() c.CreateConnected(context.TestInitialSequenceNumber, 30000, -1 /* epRcvBuf */) stats := c.Stack().Stats() want := stats.TCP.InvalidSegmentsReceived.Value() + 1 iss := seqnum.Value(context.TestInitialSequenceNumber).Add(1) vv := c.BuildSegment(nil, &context.Headers{ SrcPort: context.TestPort, DstPort: c.Port, Flags: header.TCPFlagAck, SeqNum: iss, AckNum: c.IRS.Add(1), RcvWnd: 30000, }) tcpbuf := vv.ToView()[header.IPv4MinimumSize:] tcpbuf[header.TCPDataOffset] = ((header.TCPMinimumSize - 1) / 4) << 4 c.SendSegment(vv) if got := stats.TCP.InvalidSegmentsReceived.Value(); got != want { t.Errorf("got stats.TCP.InvalidSegmentsReceived.Value() = %d, want = %d", got, want) } if got := c.EP.Stats().(*tcp.Stats).ReceiveErrors.MalformedPacketsReceived.Value(); got != want { t.Errorf("got EP Stats.ReceiveErrors.MalformedPacketsReceived stats = %d, want = %d", got, want) } }
explode_data.jsonl/75990
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 416 }
[ 2830, 3393, 23260, 7928, 21086, 2507, 38311, 1155, 353, 8840, 836, 8, 341, 1444, 1669, 2266, 7121, 1155, 11, 1638, 8505, 52, 340, 16867, 272, 727, 60639, 741, 1444, 7251, 21146, 5378, 8787, 6341, 14076, 2833, 11, 220, 18, 15, 15, 15, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestDoubleDown(t *testing.T) { stack := []cards.Card{ {Rank: cards.Six, Suit: cards.Club}, {Rank: cards.Four, Suit: cards.Club}, {Rank: cards.Four, Suit: cards.Club}, {Rank: cards.Jack, Suit: cards.Club}, {Rank: cards.Ace, Suit: cards.Club}, {Rank: cards.Ten, Suit: cards.Club}, } deck := cards.Deck{ Cards: stack, } output := &bytes.Buffer{} input := strings.NewReader("d\nq") g, err := blackjack.NewBlackjackGame( blackjack.WithCustomDeck(deck), blackjack.WithIncomingDeck(false), blackjack.WithOutput(output), blackjack.WithInput(input), ) if err != nil { t.Fatal(err) } p := &blackjack.Player{ Name: "planty", Hands: []*blackjack.Hand{ { Id: 1, Bet: 1, }, }, Cash: 99, Decide: blackjack.HumanAction, Bet: blackjack.HumanBet, Action: blackjack.ActionDoubleDown, } g.AddPlayer(p) g.OpeningDeal() g.PlayHand(g.Players[0]) g.DealerPlay() g.Outcome(output) want := 102 got := g.Players[0].Cash if want != got { t.Fatalf("wanted: %d, got: %d", want, got) } }
explode_data.jsonl/5932
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 464 }
[ 2830, 3393, 7378, 4454, 1155, 353, 8840, 836, 8, 1476, 48227, 1669, 3056, 25024, 48613, 515, 197, 197, 90, 22550, 25, 7411, 808, 941, 11, 32611, 25, 7411, 21610, 392, 1583, 197, 197, 90, 22550, 25, 7411, 991, 413, 11, 32611, 25, 741...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestCurrencyConversion(t *testing.T) { tests := []struct { name string val int }{ { name: "1", val: 999999999999999, // this is the max size with accurate precision }, { name: "2", val: 0, }, { name: "3", val: -999999999999999, }, { name: "4", val: 3333333333333333, }, { name: "5", val: 1111111111111111, }, } for _, tt := range tests { tt := tt t.Run(tt.name, func(t *testing.T) { in := int64(tt.val) res := util.Int64PtrWithCentsToFloat64Ptr(&in) out := util.Float64PtrToInt64PtrWithCents(res) assert.Equal(t, in, *out) inInt := int(in) res = util.IntPtrWithCentsToFloat64Ptr(&inInt) outInt := util.Float64PtrToIntPtrWithCents(res) assert.Equal(t, inInt, *outInt) }) } }
explode_data.jsonl/36935
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 382 }
[ 2830, 3393, 26321, 48237, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 3056, 1235, 341, 197, 11609, 914, 198, 197, 19302, 220, 526, 198, 197, 59403, 197, 197, 515, 298, 11609, 25, 330, 16, 756, 298, 19302, 25, 220, 220, 24, 24, 24, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestNormalBatch(t *testing.T) { filters := getFilters() maxMessageCount := uint32(2) absoluteMaxBytes := uint32(1000) preferredMaxBytes := uint32(100) r := NewReceiverImpl(&mocksharedconfig.Manager{BatchSizeVal: &ab.BatchSize{MaxMessageCount: maxMessageCount, AbsoluteMaxBytes: absoluteMaxBytes, PreferredMaxBytes: preferredMaxBytes}}, filters) batches, committers, ok := r.Ordered(goodTx) if batches != nil || committers != nil { t.Fatalf("Should not have created batch") } if !ok { t.Fatalf("Should have enqueued message into batch") } batches, committers, ok = r.Ordered(goodTx) if batches == nil || committers == nil { t.Fatalf("Should have created batch") } if !ok { t.Fatalf("Should have enqueued second message into batch") } }
explode_data.jsonl/64635
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 261 }
[ 2830, 3393, 12206, 21074, 1155, 353, 8840, 836, 8, 341, 1166, 8612, 1669, 633, 28351, 741, 22543, 2052, 2507, 1669, 2622, 18, 17, 7, 17, 340, 197, 17182, 5974, 7078, 1669, 2622, 18, 17, 7, 16, 15, 15, 15, 340, 40346, 5554, 5974, 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...
7
func TestScanTypeHashingIncludesScbAnnotations(t *testing.T) { originalScanType := scanType.DeepCopy() originalScanType.ObjectMeta.Annotations = map[string]string{ "foo.example.com/bar": "54165165135", "auto-discovery.securecodebox.io/scantype-hash": "same-hash", } modifiedScantype := scanType.DeepCopy() modifiedScantype.ObjectMeta.Annotations = map[string]string{ "foo.example.com/bar": "719839183223", "auto-discovery.securecodebox.io/scantype-hash": "other-hash", } assert.NotEqual( t, HashScanType(*originalScanType), HashScanType(*modifiedScantype), "Should not equal as hash should include *.securecodebox.io/* annotations", ) }
explode_data.jsonl/24498
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 289 }
[ 2830, 3393, 26570, 929, 6370, 287, 55834, 3326, 65, 21418, 1155, 353, 8840, 836, 8, 341, 197, 9889, 26570, 929, 1669, 8569, 929, 55602, 12106, 741, 197, 9889, 26570, 929, 80222, 91172, 284, 2415, 14032, 30953, 515, 197, 197, 1, 7975, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_Pagination_PrevNext_AsOneLinks(t *testing.T) { doc := testutil.CreateHTML() body := dom.QuerySelector(doc, "body") root := testutil.CreateDiv(0) dom.AppendChild(body, root) anchor := testutil.CreateAnchor("page2", "view as one page") dom.AppendChild(root, anchor) assertDefaultDocumentNextLink(t, doc, nil) dom.SetInnerHTML(anchor, "next") assertDefaultDocumenOutlink(t, doc, nil, anchor) }
explode_data.jsonl/10837
{ "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, 1088, 10353, 1088, 7282, 5847, 62741, 3966, 24089, 1155, 353, 8840, 836, 8, 341, 59536, 1669, 1273, 1314, 7251, 5835, 741, 35402, 1669, 4719, 15685, 5877, 19153, 11, 330, 2599, 5130, 33698, 1669, 1273, 1314, 7251, 12509, 7, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestGetContainerImageMultipleContainers(t *testing.T) { pod := v1.Pod{ ObjectMeta: metav1.ObjectMeta{ Name: "mypod", Namespace: "Default", }, Spec: v1.PodSpec{ Containers: []v1.Container{ { Name: "mypodContainer", Image: "rook/test", }, { Name: "otherPodContainer", Image: "rook/test2", }, }, }, } // start a basic cluster container, err := k8sutil.GetContainerImage(&pod, "foo") assert.NotNil(t, err) assert.Equal(t, "", container) assert.Equal(t, "failed to find image for container foo", err.Error()) }
explode_data.jsonl/35522
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 260 }
[ 2830, 3393, 1949, 4502, 1906, 32089, 74632, 1155, 353, 8840, 836, 8, 1476, 3223, 347, 1669, 348, 16, 88823, 515, 197, 23816, 12175, 25, 77520, 16, 80222, 515, 298, 21297, 25, 414, 330, 86134, 347, 756, 298, 90823, 25, 330, 3675, 756, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestObjectCopyDifficultName(t *testing.T) { ctx := context.Background() c, rollback := makeConnectionWithObjectHeaders(t) defer rollback() const dest = OBJECT + "?param %30%31%32 £100" _, err := c.ObjectCopy(ctx, CONTAINER, OBJECT, CONTAINER, dest, nil) if err != nil { t.Fatal(err) } err = c.ObjectDelete(ctx, CONTAINER, dest) if err != nil { t.Fatal(err) } }
explode_data.jsonl/12705
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 153 }
[ 2830, 3393, 1190, 12106, 21751, 3866, 675, 1155, 353, 8840, 836, 8, 341, 20985, 1669, 2266, 19047, 741, 1444, 11, 60414, 1669, 1281, 4526, 2354, 1190, 10574, 1155, 340, 16867, 60414, 741, 4777, 3201, 284, 39786, 488, 27244, 903, 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, 1...
3
func TestDecodeJson(t *testing.T) { reader, err := os.Open("./data/search_coffee_sample.json") if err != nil { panic(err) } var sq Query rsp, err := sq.decodeJSON(reader) if err != nil { t.Error("error should be nil", err) return } if rsp.OrganicResults[0].Title != "Portland Roasting Coffee" { t.Error("empty title in local results") return } }
explode_data.jsonl/19465
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 145 }
[ 2830, 3393, 32564, 5014, 1155, 353, 8840, 836, 8, 341, 61477, 11, 1848, 1669, 2643, 12953, 13988, 691, 23167, 666, 21180, 17491, 4323, 1138, 743, 1848, 961, 2092, 341, 197, 30764, 3964, 340, 197, 532, 2405, 18031, 11361, 198, 7000, 2154...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestNamingModel(t *testing.T) { logx.Disable() _ = Clean() sqlFile := filepath.Join(t.TempDir(), "tmp.sql") err := ioutil.WriteFile(sqlFile, []byte(source), 0o777) assert.Nil(t, err) dir, _ := filepath.Abs("./testmodel") camelDir := filepath.Join(dir, "camel") snakeDir := filepath.Join(dir, "snake") defer func() { _ = os.RemoveAll(dir) }() g, err := NewDefaultGenerator(camelDir, &config.Config{ NamingFormat: "GoZero", }) assert.Nil(t, err) err = g.StartFromDDL(sqlFile, true, "go_zero") assert.Nil(t, err) assert.True(t, func() bool { _, err := os.Stat(filepath.Join(camelDir, "TestUserModel.go")) return err == nil }()) g, err = NewDefaultGenerator(snakeDir, &config.Config{ NamingFormat: "go_zero", }) assert.Nil(t, err) err = g.StartFromDDL(sqlFile, true, "go_zero") assert.Nil(t, err) assert.True(t, func() bool { _, err := os.Stat(filepath.Join(snakeDir, "test_user_model.go")) return err == nil }()) }
explode_data.jsonl/6515
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 412 }
[ 2830, 3393, 85410, 1712, 1155, 353, 8840, 836, 8, 341, 6725, 87, 10166, 480, 741, 197, 62, 284, 9590, 2822, 30633, 1703, 1669, 26054, 22363, 1155, 65009, 6184, 1507, 330, 5173, 10045, 1138, 9859, 1669, 43144, 4073, 1703, 13148, 1703, 11...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestBrokenCookie(t *testing.T) { db := newDB() store := New(db, []byte("secret")) countFn := makeCountHandler("session", store) r1 := req(countFn, nil) match(t, r1, 200, "1") cookie := parseCookies(r1.Header().Get("Set-Cookie"))["session"] cookie.Value += "junk" r2 := req(countFn, cookie) match(t, r2, 200, "1") }
explode_data.jsonl/71332
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 137 }
[ 2830, 3393, 90526, 20616, 1155, 353, 8840, 836, 8, 341, 20939, 1669, 501, 3506, 741, 57279, 1669, 1532, 9791, 11, 3056, 3782, 445, 20474, 5455, 18032, 24911, 1669, 1281, 2507, 3050, 445, 5920, 497, 3553, 692, 7000, 16, 1669, 4232, 11512...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestStepWFGetNodeName(t *testing.T) { controller := newController() wfcset := controller.wfclientset.ArgoprojV1alpha1().Workflows("") // operate the workflow. it should create a pod. wf := unmarshalWF(stepScriptTmpl) wf, err := wfcset.Create(wf) assert.NoError(t, err) assert.True(t, hasOutputResultRef("generate", &wf.Spec.Templates[0])) assert.False(t, hasOutputResultRef("print-message", &wf.Spec.Templates[0])) woc := newWorkflowOperationCtx(wf, controller) woc.operate() wf, err = wfcset.Get(wf.ObjectMeta.Name, metav1.GetOptions{}) assert.NoError(t, err) for _, node := range wf.Status.Nodes { if strings.Contains(node.Name, "generate") { assert.True(t, getStepOrDAGTaskName(node.Name) == "generate") } else if strings.Contains(node.Name, "print-message") { assert.True(t, getStepOrDAGTaskName(node.Name) == "print-message") } } }
explode_data.jsonl/54387
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 346 }
[ 2830, 3393, 8304, 32131, 1949, 1955, 675, 1155, 353, 8840, 836, 8, 1476, 61615, 1669, 501, 2051, 741, 6692, 8316, 746, 1669, 6461, 1418, 69, 2972, 746, 18979, 45926, 73, 53, 16, 7141, 16, 1005, 6776, 38140, 445, 5130, 197, 322, 14476,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestExecInContainerNoSuchContainer(t *testing.T) { testKubelet := newTestKubelet(t) kubelet := testKubelet.kubelet fakeRuntime := testKubelet.fakeRuntime fakeCommandRunner := fakeContainerCommandRunner{} kubelet.runner = &fakeCommandRunner podName := "podFoo" podNamespace := "nsFoo" containerID := "containerFoo" fakeRuntime.PodList = []*kubecontainer.Pod{ { ID: "12345678", Name: podName, Namespace: podNamespace, Containers: []*kubecontainer.Container{ {Name: "bar", ID: kubecontainer.ContainerID{"test", "barID"}}, }, }, } err := kubelet.ExecInContainer( kubecontainer.GetPodFullName(&api.Pod{ObjectMeta: api.ObjectMeta{ UID: "12345678", Name: podName, Namespace: podNamespace, }}), "", containerID, []string{"ls"}, nil, nil, nil, false, ) if err == nil { t.Fatal("unexpected non-error") } if !fakeCommandRunner.ID.IsEmpty() { t.Fatal("unexpected invocation of runner.ExecInContainer") } }
explode_data.jsonl/43320
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 429 }
[ 2830, 3393, 10216, 641, 4502, 65531, 4502, 1155, 353, 8840, 836, 8, 341, 18185, 42, 3760, 1149, 1669, 501, 2271, 42, 3760, 1149, 1155, 340, 16463, 3760, 1149, 1669, 1273, 42, 3760, 1149, 5202, 3760, 1149, 198, 1166, 726, 15123, 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 TestNewDNSProviderConfig(t *testing.T) { testCases := []struct { desc string apiKey string expected string }{ { desc: "success", apiKey: "123", }, { desc: "missing credentials", expected: "dreamhost: credentials missing", }, } for _, test := range testCases { t.Run(test.desc, func(t *testing.T) { config := NewDefaultConfig() config.APIKey = test.apiKey p, err := NewDNSProviderConfig(config) if test.expected == "" { assert.NoError(t, err) assert.NotNil(t, p) } else { require.EqualError(t, err, test.expected) } }) } }
explode_data.jsonl/52233
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 267 }
[ 2830, 3393, 3564, 61088, 5179, 2648, 1155, 353, 8840, 836, 8, 341, 18185, 37302, 1669, 3056, 1235, 341, 197, 41653, 257, 914, 198, 197, 54299, 1592, 256, 914, 198, 197, 42400, 914, 198, 197, 59403, 197, 197, 515, 298, 41653, 25, 256, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestSketchSeriesListJSONMarshal(t *testing.T) { sl := make(SketchSeriesList, 2) for i := range sl { sl[i] = Makeseries(i) } json, err := sl.MarshalJSON() assert.NoError(t, err) assert.JSONEq(t, string(json), `{"sketches":[{"metric":"name.0","tags":["a:0","b:0"],"host":"host.0","interval":0,"points":[{"sketch":{"summary":{"Min":0,"Max":0,"Sum":0,"Avg":0,"Cnt":0}},"ts":0},{"sketch":{"summary":{"Min":0,"Max":0,"Sum":0,"Avg":0,"Cnt":1}},"ts":10},{"sketch":{"summary":{"Min":0,"Max":1,"Sum":1,"Avg":0.5,"Cnt":2}},"ts":20},{"sketch":{"summary":{"Min":0,"Max":2,"Sum":3,"Avg":1,"Cnt":3}},"ts":30},{"sketch":{"summary":{"Min":0,"Max":3,"Sum":6,"Avg":1.5,"Cnt":4}},"ts":40}]},{"metric":"name.1","tags":["a:1","b:1"],"host":"host.1","interval":1,"points":[{"sketch":{"summary":{"Min":0,"Max":0,"Sum":0,"Avg":0,"Cnt":0}},"ts":0},{"sketch":{"summary":{"Min":0,"Max":0,"Sum":0,"Avg":0,"Cnt":1}},"ts":10},{"sketch":{"summary":{"Min":0,"Max":1,"Sum":1,"Avg":0.5,"Cnt":2}},"ts":20},{"sketch":{"summary":{"Min":0,"Max":2,"Sum":3,"Avg":1,"Cnt":3}},"ts":30},{"sketch":{"summary":{"Min":0,"Max":3,"Sum":6,"Avg":1.5,"Cnt":4}},"ts":40},{"sketch":{"summary":{"Min":0,"Max":4,"Sum":10,"Avg":2,"Cnt":5}},"ts":50}]}]}`) config.Datadog.Set("cmd.check.fullsketches", true) json, err = sl.MarshalJSON() assert.NoError(t, err) assert.JSONEq(t, string(json), `{"sketches":[{"host":"host.0","interval":0,"metric":"name.0","points":[{"bins":"","binsCount":0,"sketch":{"summary":{"Avg":0,"Cnt":0,"Max":0,"Min":0,"Sum":0}},"ts":0},{"bins":"0:1","binsCount":1,"sketch":{"summary":{"Avg":0,"Cnt":1,"Max":0,"Min":0,"Sum":0}},"ts":10},{"bins":"0:1 1338:1","binsCount":2,"sketch":{"summary":{"Avg":0.5,"Cnt":2,"Max":1,"Min":0,"Sum":1}},"ts":20},{"bins":"0:1 1338:1 1383:1","binsCount":3,"sketch":{"summary":{"Avg":1,"Cnt":3,"Max":2,"Min":0,"Sum":3}},"ts":30},{"bins":"0:1 1338:1 1383:1 1409:1","binsCount":4,"sketch":{"summary":{"Avg":1.5,"Cnt":4,"Max":3,"Min":0,"Sum":6}},"ts":40}],"tags":["a:0","b:0"]},{"host":"host.1","interval":1,"metric":"name.1","points":[{"bins":"","binsCount":0,"sketch":{"summary":{"Avg":0,"Cnt":0,"Max":0,"Min":0,"Sum":0}},"ts":0},{"bins":"0:1","binsCount":1,"sketch":{"summary":{"Avg":0,"Cnt":1,"Max":0,"Min":0,"Sum":0}},"ts":10},{"bins":"0:1 1338:1","binsCount":2,"sketch":{"summary":{"Avg":0.5,"Cnt":2,"Max":1,"Min":0,"Sum":1}},"ts":20},{"bins":"0:1 1338:1 1383:1","binsCount":3,"sketch":{"summary":{"Avg":1,"Cnt":3,"Max":2,"Min":0,"Sum":3}},"ts":30},{"bins":"0:1 1338:1 1383:1 1409:1","binsCount":4,"sketch":{"summary":{"Avg":1.5,"Cnt":4,"Max":3,"Min":0,"Sum":6}},"ts":40},{"bins":"0:1 1338:1 1383:1 1409:1 1427:1","binsCount":5,"sketch":{"summary":{"Avg":2,"Cnt":5,"Max":4,"Min":0,"Sum":10}},"ts":50}],"tags":["a:1","b:1"]}]}`) }
explode_data.jsonl/34960
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1217 }
[ 2830, 3393, 75288, 25544, 852, 5370, 55438, 1155, 353, 8840, 836, 8, 341, 78626, 1669, 1281, 3759, 74, 2995, 25544, 852, 11, 220, 17, 692, 2023, 600, 1669, 2088, 1739, 341, 197, 78626, 989, 60, 284, 36870, 4699, 1956, 340, 197, 630, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestSetServiceInstanceCondition(t *testing.T) { instanceWithCondition := func(condition *v1beta1.ServiceInstanceCondition) *v1beta1.ServiceInstance { instance := getTestServiceInstance() instance.Status.Conditions = []v1beta1.ServiceInstanceCondition{*condition} return instance } // The value of the LastTransitionTime field on conditions has to be // tested to ensure it is updated correctly. // // Time basis for all condition changes: newTs := metav1.Now() oldTs := metav1.NewTime(newTs.Add(-5 * time.Minute)) // condition is a shortcut method for creating conditions with the 'old' timestamp. condition := func(cType v1beta1.ServiceInstanceConditionType, status v1beta1.ConditionStatus, s ...string) *v1beta1.ServiceInstanceCondition { c := &v1beta1.ServiceInstanceCondition{ Type: cType, Status: status, } if len(s) > 0 { c.Reason = s[0] } if len(s) > 1 { c.Message = s[1] } // This is the expected 'before' timestamp for all conditions under // test. c.LastTransitionTime = oldTs return c } // shortcut methods for creating conditions of different types readyFalse := func() *v1beta1.ServiceInstanceCondition { return condition(v1beta1.ServiceInstanceConditionReady, v1beta1.ConditionFalse, "Reason", "Message") } readyFalsef := func(reason, message string) *v1beta1.ServiceInstanceCondition { return condition(v1beta1.ServiceInstanceConditionReady, v1beta1.ConditionFalse, reason, message) } readyTrue := func() *v1beta1.ServiceInstanceCondition { return condition(v1beta1.ServiceInstanceConditionReady, v1beta1.ConditionTrue, "Reason", "Message") } failedTrue := func() *v1beta1.ServiceInstanceCondition { return condition(v1beta1.ServiceInstanceConditionFailed, v1beta1.ConditionTrue, "Reason", "Message") } // withNewTs sets the LastTransitionTime to the 'new' basis time and // returns it. withNewTs := func(c *v1beta1.ServiceInstanceCondition) *v1beta1.ServiceInstanceCondition { c.LastTransitionTime = newTs return c } // this test works by calling setServiceInstanceCondition with the input and // condition fields of the test case, and ensuring that afterward the // input (which is mutated by the setServiceInstanceCondition call) is deep-equal // to the test case result. // // take note of where withNewTs is used when declaring the result to // indicate that the LastTransitionTime field on a condition should have // changed. // // name: short description of the test // input: instance status // condition: condition to set // result: expected instance result cases := []struct { name string input *v1beta1.ServiceInstance condition *v1beta1.ServiceInstanceCondition result *v1beta1.ServiceInstance }{ { name: "new ready condition", input: getTestServiceInstance(), condition: readyFalse(), result: instanceWithCondition(withNewTs(readyFalse())), }, { name: "not ready -> not ready; no ts update", input: instanceWithCondition(readyFalse()), condition: readyFalse(), result: instanceWithCondition(readyFalse()), }, { name: "not ready -> not ready, reason and message change; no ts update", input: instanceWithCondition(readyFalse()), condition: readyFalsef("DifferentReason", "DifferentMessage"), result: instanceWithCondition(readyFalsef("DifferentReason", "DifferentMessage")), }, { name: "not ready -> ready", input: instanceWithCondition(readyFalse()), condition: readyTrue(), result: instanceWithCondition(withNewTs(readyTrue())), }, { name: "ready -> ready; no ts update", input: instanceWithCondition(readyTrue()), condition: readyTrue(), result: instanceWithCondition(readyTrue()), }, { name: "ready -> not ready", input: instanceWithCondition(readyTrue()), condition: readyFalse(), result: instanceWithCondition(withNewTs(readyFalse())), }, { name: "not ready -> not ready + failed", input: instanceWithCondition(readyFalse()), condition: failedTrue(), result: func() *v1beta1.ServiceInstance { i := instanceWithCondition(readyFalse()) i.Status.Conditions = append(i.Status.Conditions, *withNewTs(failedTrue())) return i }(), }, } for _, tc := range cases { setServiceInstanceConditionInternal(tc.input, tc.condition.Type, tc.condition.Status, tc.condition.Reason, tc.condition.Message, newTs) if !reflect.DeepEqual(tc.input, tc.result) { t.Errorf("%v: unexpected diff: %v", tc.name, diff.ObjectReflectDiff(tc.input, tc.result)) } } }
explode_data.jsonl/58175
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1549 }
[ 2830, 3393, 1649, 1860, 2523, 10547, 1155, 353, 8840, 836, 8, 341, 56256, 2354, 10547, 1669, 2915, 47489, 353, 85, 16, 19127, 16, 13860, 2523, 10547, 8, 353, 85, 16, 19127, 16, 13860, 2523, 341, 197, 56256, 1669, 633, 2271, 1860, 2523...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestContains(t *testing.T) { is := assert.New(t) tests := map[interface{}]interface{}{ 1: []int{1, 2, 3}, 2: []int8{1, 2, 3}, 3: []int16{1, 2, 3}, 4: []int32{4, 2, 3}, 5: []int64{5, 2, 3}, 6: []uint{6, 2, 3}, 7: []uint8{7, 2, 3}, 8: []uint16{8, 2, 3}, 9: []uint32{9, 2, 3}, 10: []uint64{10, 3}, 11: []string{"11", "3"}, 'a': []int64{97}, 'b': []rune{'a', 'b'}, 'c': []byte{'a', 'b', 'c'}, // byte -> uint8 "a": []string{"a", "b", "c"}, 12: [5]uint{12, 1, 2, 3, 4}, 'A': [3]rune{'A', 'B', 'C'}, 'd': [4]byte{'a', 'b', 'c', 'd'}, "aa": [3]string{"aa", "bb", "cc"}, } for val, list := range tests { is.True(Contains(list, val)) is.False(NotContains(list, val)) } is.False(Contains(nil, []int{})) is.False(Contains('a', []int{})) // is.False(Contains([]int{2, 3}, []int{2})) is.False(Contains([]string{"a", "b"}, 12)) is.False(Contains(nil, 12)) is.False(Contains(map[int]int{2: 3}, 12)) tests1 := map[interface{}]interface{}{ 2: []int{1, 3}, "a": []string{"b", "c"}, } for val, list := range tests1 { is.True(NotContains(list, val)) is.False(Contains(list, val)) } }
explode_data.jsonl/70783
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 632 }
[ 2830, 3393, 23805, 1155, 353, 8840, 836, 8, 341, 19907, 1669, 2060, 7121, 1155, 340, 78216, 1669, 2415, 58, 4970, 78134, 4970, 67066, 197, 197, 16, 25, 262, 3056, 396, 90, 16, 11, 220, 17, 11, 220, 18, 1583, 197, 197, 17, 25, 262,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestParseArgs(t *testing.T) { input := []string{appconfig.DefaultDocumentWorker, "documentID"} channelName, err := proc.ParseArgv(input) assert.NoError(t, err) assert.Equal(t, "documentID", channelName) }
explode_data.jsonl/40509
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 77 }
[ 2830, 3393, 14463, 4117, 1155, 353, 8840, 836, 8, 341, 22427, 1669, 3056, 917, 90, 676, 1676, 13275, 7524, 21936, 11, 330, 6062, 915, 16707, 71550, 675, 11, 1848, 1669, 13674, 8937, 2735, 85, 5384, 340, 6948, 35699, 1155, 11, 1848, 34...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
func TestNode_ShortID(t *testing.T) { n := NewNode(gen.Reference(), insolar.StaticRoleVirtual, nil, "127.0.0.1", "123") assert.EqualValues(t, GenerateUintShortID(n.ID()), n.ShortID()) n.(MutableNode).SetShortID(11) assert.EqualValues(t, 11, n.ShortID()) }
explode_data.jsonl/46252
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 106 }
[ 2830, 3393, 1955, 1098, 22007, 915, 1155, 353, 8840, 836, 8, 341, 9038, 1669, 1532, 1955, 36884, 58416, 1507, 1640, 7417, 58826, 9030, 33026, 11, 2092, 11, 330, 16, 17, 22, 13, 15, 13, 15, 13, 16, 497, 330, 16, 17, 18, 1138, 6948,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestCT_GeomGuideListMarshalUnmarshal(t *testing.T) { v := dml.NewCT_GeomGuideList() buf, _ := xml.Marshal(v) v2 := dml.NewCT_GeomGuideList() xml.Unmarshal(buf, v2) }
explode_data.jsonl/73140
{ "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, 1162, 2646, 68, 316, 41010, 852, 55438, 1806, 27121, 1155, 353, 8840, 836, 8, 341, 5195, 1669, 294, 1014, 7121, 1162, 2646, 68, 316, 41010, 852, 741, 26398, 11, 716, 1669, 8396, 37271, 3747, 340, 5195, 17, 1669, 294, 1014,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestGetActivityPubPageSize(t *testing.T) { t.Run("Not specified -> default value", func(t *testing.T) { cmd := getTestCmd(t) pageSize, err := getActivityPubPageSize(cmd) require.NoError(t, err) require.Equal(t, defaultActivityPubPageSize, pageSize) }) t.Run("Invalid value -> error", func(t *testing.T) { cmd := getTestCmd(t, "--"+activityPubPageSizeFlagName, "xxx") _, err := getActivityPubPageSize(cmd) require.Error(t, err) require.Contains(t, err.Error(), "invalid value") }) t.Run("<=0 -> error", func(t *testing.T) { cmd := getTestCmd(t, "--"+activityPubPageSizeFlagName, "-120") _, err := getActivityPubPageSize(cmd) require.EqualError(t, err, "value must be greater than 0") }) t.Run("Valid value -> success", func(t *testing.T) { cmd := getTestCmd(t, "--"+activityPubPageSizeFlagName, "120") pageSize, err := getActivityPubPageSize(cmd) require.NoError(t, err) require.Equal(t, 120, pageSize) }) t.Run("Valid env value -> error", func(t *testing.T) { restoreEnv := setEnv(t, activityPubPageSizeEnvKey, "125") defer restoreEnv() cmd := getTestCmd(t) pageSize, err := getActivityPubPageSize(cmd) require.NoError(t, err) require.Equal(t, 125, pageSize) }) }
explode_data.jsonl/31132
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 480 }
[ 2830, 3393, 1949, 4052, 29162, 45917, 1155, 353, 8840, 836, 8, 341, 3244, 16708, 445, 2623, 5189, 1464, 1638, 897, 497, 2915, 1155, 353, 8840, 836, 8, 341, 197, 25920, 1669, 633, 2271, 15613, 1155, 692, 197, 35272, 1695, 11, 1848, 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 TestParsePointWithStringWithSpaces(t *testing.T) { test(t, `cpu,host=serverA,region=us-east value=1.0,str="foo bar" 1000000000`, NewTestPoint( "cpu", models.NewTags(map[string]string{ "host": "serverA", "region": "us-east", }), models.Fields{ "value": 1.0, "str": "foo bar", // spaces in string value }, time.Unix(1, 0)), ) }
explode_data.jsonl/16932
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 175 }
[ 2830, 3393, 14463, 2609, 52342, 2354, 71324, 1155, 353, 8840, 836, 8, 341, 18185, 1155, 11, 1565, 16475, 11, 3790, 28, 4030, 32, 11, 3943, 28, 355, 39507, 897, 28, 16, 13, 15, 42321, 428, 7975, 3619, 1, 220, 16, 15, 15, 15, 15, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestIssue27831(t *testing.T) { store, clean := testkit.CreateMockStore(t) defer clean() tk := testkit.NewTestKit(t, store) tk.MustExec("use test") tk.MustExec("drop table if exists t") tk.MustExec("create table t(a enum(\"a\", \"b\"), b enum(\"a\", \"b\"), c bool)") tk.MustExec("insert into t values(\"a\", \"a\", 1);") tk.MustQuery("select * from t t1 right join t t2 on t1.a=t2.b and t1.a= t2.c;").Check(testkit.Rows("a a 1 a a 1")) tk.MustExec("drop table if exists t") tk.MustExec("create table t(a enum(\"a\", \"b\"), b enum(\"a\", \"b\"), c bool, d int, index idx(d))") tk.MustExec("insert into t values(\"a\", \"a\", 1, 1);") tk.MustQuery("select /*+ inl_hash_join(t1) */ * from t t1 right join t t2 on t1.a=t2.b and t1.a= t2.c and t1.d=t2.d;").Check(testkit.Rows("a a 1 1 a a 1 1")) }
explode_data.jsonl/65613
{ "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, 42006, 17, 22, 23, 18, 16, 1155, 353, 8840, 836, 8, 341, 57279, 11, 4240, 1669, 1273, 8226, 7251, 11571, 6093, 1155, 340, 16867, 4240, 2822, 3244, 74, 1669, 1273, 8226, 7121, 2271, 7695, 1155, 11, 3553, 340, 3244, 74, 50...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestMakeChannelCreationTransactionWithSigner(t *testing.T) { channelID := "foo" mspmgmt.LoadDevMsp() signer := localmsp.NewSigner() cct, err := MakeChannelCreationTransaction(channelID, signer, nil, genesisconfig.Load(genesisconfig.SampleSingleMSPChannelV11Profile)) assert.NoError(t, err, "Making chain creation tx") assert.NotEmpty(t, cct.Signature, "Should have signature") payload, err := utils.UnmarshalPayload(cct.Payload) assert.NoError(t, err, "Unmarshaling payload") configUpdateEnv, err := configtx.UnmarshalConfigUpdateEnvelope(payload.Data) assert.NoError(t, err, "Unmarshaling ConfigUpdateEnvelope") assert.NotEmpty(t, configUpdateEnv.Signatures, "Should have config env sigs") sigHeader, err := utils.GetSignatureHeader(payload.Header.SignatureHeader) assert.NoError(t, err, "Unmarshaling SignatureHeader") assert.NotEmpty(t, sigHeader.Creator, "Creator specified") }
explode_data.jsonl/78128
{ "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, 8078, 9629, 32701, 8070, 2354, 7264, 261, 1155, 353, 8840, 836, 8, 341, 71550, 915, 1669, 330, 7975, 1837, 47691, 5187, 46063, 13969, 14592, 83816, 741, 69054, 261, 1669, 2205, 92545, 7121, 7264, 261, 2822, 1444, 302, 11, 18...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func Test_setZeroes(t *testing.T) { type args struct { matrix [][]int } tests := []struct { name string args args want [][]int }{ { name: "示例一", args: args{matrix: [][]int{{1, 1, 1}, {1, 0, 1}, {1, 1, 1}}}, want: [][]int{{1, 0, 1}, {0, 0, 0}, {1, 0, 1}}, }, { name: "示例二", args: args{matrix: [][]int{{0, 1, 2, 0}, {3, 4, 5, 2}, {1, 3, 1, 5}}}, want: [][]int{{0, 0, 0, 0}, {0, 4, 5, 0}, {0, 3, 1, 0}}, }, { name: "错误一:在首行或首列有0的情况", args: args{matrix: [][]int{{1, 1, 1}, {0, 1, 2}}}, want: [][]int{{0, 1, 1}, {0, 0, 0}}, }, { name: "错误二:typo", args: args{matrix: [][]int{{0, 1}}}, want: [][]int{{0, 0}}, }, { name: "错误三:typo", args: args{matrix: [][]int{{3, 5, 5, 6, 9, 1, 4, 5, 0, 5}, {2, 7, 9, 5, 9, 5, 4, 9, 6, 8}, {6, 0, 7, 8, 1, 0, 1, 6, 8, 1}, {7, 2, 6, 5, 8, 5, 6, 5, 0, 6}, {2, 3, 3, 1, 0, 4, 6, 5, 3, 5}, {5, 9, 7, 3, 8, 8, 5, 1, 4, 3}, {2, 4, 7, 9, 9, 8, 4, 7, 3, 7}, {3, 5, 2, 8, 8, 2, 2, 4, 9, 8}}}, want: [][]int{{0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, {2, 0, 9, 5, 0, 0, 4, 9, 0, 8}, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, {5, 0, 7, 3, 0, 0, 5, 1, 0, 3}, {2, 0, 7, 9, 0, 0, 4, 7, 0, 7}, {3, 0, 2, 8, 0, 0, 2, 4, 0, 8}}, }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { if setZeroes(tt.args.matrix); !reflect.DeepEqual(tt.args.matrix, tt.want) { t.Errorf("setZeroes() = %v, want %v", tt.args.matrix, tt.want) } }) } }
explode_data.jsonl/54997
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 936 }
[ 2830, 3393, 2602, 17999, 288, 1155, 353, 8840, 836, 8, 341, 13158, 2827, 2036, 341, 197, 60930, 52931, 396, 198, 197, 532, 78216, 1669, 3056, 1235, 341, 197, 11609, 914, 198, 197, 31215, 2827, 198, 197, 50780, 52931, 396, 198, 197, 59...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestActionAndSubscriptionLifecyle(t *testing.T) { assert := assert.New(t) dir := tempdir(t) subscriptionName := "testSub" defer cleanup(t, dir) sm := newTestSubscriptionManager() sm.config.LevelDB.Path = path.Join(dir, "db") err := sm.Init() assert.NoError(err) defer sm.db.Close() assert.Equal([]*api.SubscriptionInfo{}, sm.getSubscriptions()) assert.Equal([]*StreamInfo{}, sm.getStreams()) stream := &StreamInfo{ Type: "webhook", Webhook: &webhookActionInfo{URL: "http://test.invalid"}, } err = sm.addStream(stream) assert.NoError(err) sub := &api.SubscriptionInfo{ Name: subscriptionName, Stream: stream.ID, } err = sm.addSubscription(sub) assert.NoError(err) assert.Equal([]*api.SubscriptionInfo{sub}, sm.getSubscriptions()) assert.Equal([]*StreamInfo{stream}, sm.getStreams()) retSub, _ := sm.subscriptionByID(sub.ID) assert.Equal(sub, retSub.info) retStream, _ := sm.streamByID(stream.ID) assert.Equal(stream, retStream.spec) assert.Nil(sm.subscriptionByID(stream.ID)) assert.Nil(sm.streamByID(sub.ID)) err = sm.suspendStream(retStream) assert.NoError(err) err = sm.suspendStream(retStream) assert.NoError(err) for { // Incase the suspend takes a little time if err = sm.resumeStream(retStream); err == nil { break } else { time.Sleep(1 * time.Millisecond) } } err = sm.resumeStream(retStream) assert.EqualError(err, "Event processor is already active. Suspending:false") // Reload sm.Close() sm = newTestSubscriptionManager() sm.config.LevelDB.Path = path.Join(dir, "db") err = sm.Init() assert.NoError(err) assert.Equal(1, len(sm.streams)) assert.Equal(1, len(sm.subscriptions)) reloadedSub, err := sm.subscriptionByID(retSub.info.ID) assert.NoError(err) err = sm.resetSubscription(reloadedSub, "0") assert.NoError(err) err = sm.deleteSubscription(reloadedSub) assert.NoError(err) reloadedStream, err := sm.streamByID(retStream.spec.ID) assert.NoError(err) err = sm.deleteStream(reloadedStream) assert.NoError(err) sm.Close() }
explode_data.jsonl/82229
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 795 }
[ 2830, 3393, 2512, 3036, 33402, 43, 333, 757, 967, 1155, 353, 8840, 836, 8, 341, 6948, 1669, 2060, 7121, 1155, 340, 48532, 1669, 2730, 3741, 1155, 340, 28624, 12124, 675, 1669, 330, 1944, 3136, 698, 16867, 21290, 1155, 11, 5419, 340, 7...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestPUCalculator_DesiredPU(t *testing.T) { tc := []struct { buffer int dbCount int want int }{ { buffer: 5, dbCount: 0, want: 100, }, { buffer: 5, dbCount: 4, want: 100, }, { buffer: 5, dbCount: 14, want: 200, }, { buffer: 5, dbCount: 15, want: 300, }, { buffer: 5, dbCount: 84, want: 900, }, { buffer: 5, dbCount: 85, want: 1000, }, { buffer: 5, dbCount: 100, want: 1000, }, { buffer: 5, dbCount: 200, want: 1000, }, { buffer: 3, dbCount: 6, want: 100, }, { buffer: 3, dbCount: 7, want: 200, }, } for _, c := range tc { calc := scaler.NewPUCalculator(c.dbCount, c.buffer) require.Equal(t, c.want, calc.DesiredPU(), fmt.Sprintf("%#v", c)) } }
explode_data.jsonl/48901
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 491 }
[ 2830, 3393, 47, 5459, 278, 20022, 98054, 2690, 6325, 1155, 353, 8840, 836, 8, 341, 78255, 1669, 3056, 1235, 341, 197, 31122, 220, 526, 198, 197, 20939, 2507, 526, 198, 197, 50780, 262, 526, 198, 197, 59403, 197, 197, 515, 298, 31122, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestSameStreamNameDifferentNamespaces(t *testing.T) { // this buildconfig references an image stream with the same name as the one that was just updated, // but the namespaces differ buildcfg := mockBuildConfig("registry.com/namespace/imagename1", "registry.com/namespace/imagename1", "testImageRepo1", "testTag1") imageStream := mockImageStream("testImageRepo1", "registry.com/namespace/imagename2", map[string]string{"testTag1": "newImageID123"}) imageStream.Namespace = "othernamespace" image := mockImage("testImage@id", "registry.com/namespace/imagename@id") controller := mockImageChangeController(buildcfg, imageStream, image) bcInstantiator := controller.BuildConfigInstantiator.(*buildConfigInstantiator) bcUpdater := bcInstantiator.buildConfigUpdater err := controller.HandleImageRepo(imageStream) if err != nil { t.Errorf("Unexpected error %v from HandleImageRepo", err) } if len(bcInstantiator.name) != 0 { t.Error("New build generated when a different repository was updated!") } if bcUpdater.buildcfg != nil { t.Error("BuildConfig was updated when a different repository was updated!") } }
explode_data.jsonl/69174
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 354 }
[ 2830, 3393, 19198, 3027, 675, 69123, 7980, 27338, 1155, 353, 8840, 836, 8, 341, 197, 322, 419, 1936, 1676, 15057, 458, 2168, 4269, 448, 279, 1852, 829, 438, 279, 825, 429, 572, 1101, 6049, 345, 197, 322, 714, 279, 58091, 1745, 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...
4
func TestMissingStorage(t *testing.T) { handler := New(map[string]RESTStorage{ "foo": &SimpleRESTStorage{}, }, "/prefix/version") server := httptest.NewServer(handler) client := http.Client{} request, err := http.NewRequest("GET", server.URL+"/prefix/version/foobar", nil) expectNoError(t, err) response, err := client.Do(request) expectNoError(t, err) if response.StatusCode != 404 { t.Errorf("Unexpected response %#v", response) } }
explode_data.jsonl/30463
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 163 }
[ 2830, 3393, 25080, 5793, 1155, 353, 8840, 836, 8, 341, 53326, 1669, 1532, 9147, 14032, 60, 38307, 5793, 515, 197, 197, 1, 7975, 788, 609, 16374, 38307, 5793, 38837, 197, 2137, 3521, 11849, 64413, 1138, 41057, 1669, 54320, 70334, 7121, 5...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestForwardResponseStreamCustomMarshaler(t *testing.T) { type msg struct { pb proto.Message err error } tests := []struct { name string msgs []msg statusCode int }{{ name: "encoding", msgs: []msg{ {&pb.SimpleMessage{Id: "One"}, nil}, {&pb.SimpleMessage{Id: "Two"}, nil}, }, statusCode: http.StatusOK, }, { name: "empty", statusCode: http.StatusOK, }, { name: "error", msgs: []msg{{nil, status.Errorf(codes.OutOfRange, "400")}}, statusCode: http.StatusBadRequest, }, { name: "stream_error", msgs: []msg{ {&pb.SimpleMessage{Id: "One"}, nil}, {nil, status.Errorf(codes.OutOfRange, "400")}, }, statusCode: http.StatusOK, }} newTestRecv := func(t *testing.T, msgs []msg) func() (proto.Message, error) { var count int return func() (proto.Message, error) { if count == len(msgs) { return nil, io.EOF } else if count > len(msgs) { t.Errorf("recv() called %d times for %d messages", count, len(msgs)) } count++ msg := msgs[count-1] return msg.pb, msg.err } } ctx := runtime.NewServerMetadataContext(context.Background(), runtime.ServerMetadata{}) marshaler := &CustomMarshaler{&runtime.JSONPb{}} for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { recv := newTestRecv(t, tt.msgs) req := httptest.NewRequest("GET", "http://example.com/foo", nil) resp := httptest.NewRecorder() runtime.ForwardResponseStream(ctx, runtime.NewServeMux(), marshaler, resp, req, recv) w := resp.Result() if w.StatusCode != tt.statusCode { t.Errorf("StatusCode %d want %d", w.StatusCode, tt.statusCode) } if h := w.Header.Get("Transfer-Encoding"); h != "chunked" { t.Errorf("ForwardResponseStream missing header chunked") } body, err := ioutil.ReadAll(w.Body) if err != nil { t.Errorf("Failed to read response body with %v", err) } w.Body.Close() var want []byte counter := 0 for _, msg := range tt.msgs { if msg.err != nil { t.Skip("checking erorr encodings") } b, err := marshaler.Marshal(map[string]interface{}{"result": msg.pb, "header_metadata": metadata.MD{}, "count": counter}) if err != nil { t.Errorf("marshaler.Marshal() failed %v", err) } want = append(want, b...) want = append(want, "\n"...) counter++ } if string(body) != string(want) { t.Errorf("ForwardResponseStream() = \"%s\" want \"%s\"", body, want) } }) } }
explode_data.jsonl/13713
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1070 }
[ 2830, 3393, 25925, 2582, 3027, 10268, 55438, 261, 1155, 353, 8840, 836, 8, 341, 13158, 3750, 2036, 341, 197, 3223, 65, 220, 18433, 8472, 198, 197, 9859, 1465, 198, 197, 532, 78216, 1669, 3056, 1235, 341, 197, 11609, 981, 914, 198, 197...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestSubQueryWithRaw(t *testing.T) { users := []User{ {Name: "subquery_raw_1", Age: 10}, {Name: "subquery_raw_2", Age: 20}, {Name: "subquery_raw_3", Age: 30}, {Name: "subquery_raw_4", Age: 40}, } DB.Create(&users) var count int64 err := DB.Raw("select count(*) from (?) tmp", DB.Table("users"). Select("name"). Where("age >= ? and name in (?)", 20, []string{"subquery_raw_1", "subquery_raw_3"}). Group("name"), ).Count(&count).Error if err != nil { t.Errorf("Expected to get no errors, but got %v", err) } if count != 1 { t.Errorf("Row count must be 1, instead got %d", count) } err = DB.Raw("select count(*) from (?) tmp", DB.Table("users"). Select("name"). Where("name LIKE ?", "subquery_raw%"). Not("age <= ?", 10).Not("name IN (?)", []string{"subquery_raw_1", "subquery_raw_3"}). Group("name"), ).Count(&count).Error if err != nil { t.Errorf("Expected to get no errors, but got %v", err) } if count != 2 { t.Errorf("Row count must be 2, instead got %d", count) } }
explode_data.jsonl/48718
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 429 }
[ 2830, 3393, 3136, 2859, 2354, 20015, 1155, 353, 8840, 836, 8, 341, 90896, 1669, 3056, 1474, 515, 197, 197, 63121, 25, 330, 1966, 1631, 16067, 62, 16, 497, 13081, 25, 220, 16, 15, 1583, 197, 197, 63121, 25, 330, 1966, 1631, 16067, 62...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestInvalidBuffer(t *testing.T) { tick = fakeTick defer func() { tick = time.Tick }() buf := &bytes.Buffer{} log.SetOutput(buf) defer func() { log.SetOutput(os.Stderr) }() c := New(&errWriter{}, time.Second) c.Count("metric", 1) wait(buf) assert.Contains(t, buf.String(), "error: could not write to statsd: i/o error") }
explode_data.jsonl/59257
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 134 }
[ 2830, 3393, 7928, 4095, 1155, 353, 8840, 836, 8, 341, 3244, 865, 284, 12418, 22213, 198, 16867, 2915, 368, 314, 9341, 284, 882, 66858, 335, 2822, 26398, 1669, 609, 9651, 22622, 16094, 6725, 4202, 5097, 10731, 340, 16867, 2915, 368, 314,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestReverseBits(t *testing.T) { for _, h := range reverseBitsTests { if v := reverseBits(h.in, h.bitCount); v != h.out { t.Errorf("reverseBits(%v,%v) = %v, want %v", h.in, h.bitCount, v, h.out) } } }
explode_data.jsonl/81407
{ "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, 45695, 19920, 1155, 353, 8840, 836, 8, 341, 2023, 8358, 305, 1669, 2088, 9931, 19920, 18200, 341, 197, 743, 348, 1669, 9931, 19920, 3203, 1858, 11, 305, 30099, 2507, 1215, 348, 961, 305, 2532, 341, 298, 3244, 13080, 445, 2...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestDisableFold(t *testing.T) { // Functions like BENCHMARK() shall not be folded into result 0, // but normal outer function with constant args should be folded. // Types of expression and first layer of args will be validated. cases := []struct { SQL string Expected expression.Expression Args []expression.Expression }{ {`select sin(length("abc"))`, &expression.Constant{}, nil}, {`select benchmark(3, sin(123))`, &expression.ScalarFunction{}, []expression.Expression{ &expression.Constant{}, &expression.ScalarFunction{}, }}, {`select pow(length("abc"), benchmark(3, sin(123)))`, &expression.ScalarFunction{}, []expression.Expression{ &expression.Constant{}, &expression.ScalarFunction{}, }}, } ctx := MockContext() for _, c := range cases { st, err := parser.New().ParseOneStmt(c.SQL, "", "") require.NoError(t, err) stmt := st.(*ast.SelectStmt) expr := stmt.Fields.Fields[0].Expr builder, _ := NewPlanBuilder().Init(ctx, nil, &hint.BlockHintProcessor{}) builder.rewriterCounter++ rewriter := builder.getExpressionRewriter(context.TODO(), nil) require.NotNil(t, rewriter) require.Equal(t, 0, rewriter.disableFoldCounter) rewrittenExpression, _, err := builder.rewriteExprNode(rewriter, expr, true) require.NoError(t, err) require.Equal(t, 0, rewriter.disableFoldCounter) builder.rewriterCounter-- require.IsType(t, c.Expected, rewrittenExpression) for i, expectedArg := range c.Args { rewrittenArg := expression.GetFuncArg(rewrittenExpression, i) require.IsType(t, expectedArg, rewrittenArg) } } }
explode_data.jsonl/25787
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 580 }
[ 2830, 3393, 25479, 75536, 1155, 353, 8840, 836, 8, 341, 197, 322, 23550, 1075, 425, 96190, 368, 4880, 537, 387, 47035, 1119, 1102, 220, 15, 345, 197, 322, 714, 4622, 15955, 729, 448, 6783, 2827, 1265, 387, 47035, 624, 197, 322, 20768,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestParseSpsPps(t *testing.T) { s := "a=fmtp:96 packetization-mode=1; sprop-parameter-sets=Z2QAIKzZQMApsBEAAAMAAQAAAwAyDxgxlg==,aOvssiw=; profile-level-id=640020" f, err := ParseAFmtPBase(s) assert.Equal(t, nil, err) sps, pps, err := ParseSpsPps(&f) assert.Equal(t, nil, err) assert.Equal(t, goldenSps, sps) assert.Equal(t, goldenPps, pps) }
explode_data.jsonl/55594
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 180 }
[ 2830, 3393, 14463, 50, 1690, 47, 1690, 1155, 353, 8840, 836, 8, 341, 1903, 1669, 330, 64, 18111, 76, 790, 25, 24, 21, 10151, 2022, 14982, 28, 16, 26, 274, 2674, 89412, 12, 4917, 28, 57, 17, 48, 15469, 42, 89, 57, 48, 4835, 1690,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestFirestoreGetDocument(t *testing.T) { var name2 string = "name2-1052831874" var expectedResponse = &firestorepb.Document{ Name: name2, } mockFirestore.err = nil mockFirestore.reqs = nil mockFirestore.resps = append(mockFirestore.resps[:0], expectedResponse) var formattedName string = fmt.Sprintf("projects/%s/databases/%s/documents/%s/%s", "[PROJECT]", "[DATABASE]", "[DOCUMENT]", "[ANY_PATH]") var request = &firestorepb.GetDocumentRequest{ Name: formattedName, } c, err := NewClient(context.Background(), clientOpt) if err != nil { t.Fatal(err) } resp, err := c.GetDocument(context.Background(), request) if err != nil { t.Fatal(err) } if want, got := request, mockFirestore.reqs[0]; !proto.Equal(want, got) { t.Errorf("wrong request %q, want %q", got, want) } if want, got := expectedResponse, resp; !proto.Equal(want, got) { t.Errorf("wrong response %q, want %q)", got, want) } }
explode_data.jsonl/27370
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 359 }
[ 2830, 3393, 48513, 1949, 7524, 1155, 353, 8840, 836, 8, 341, 2405, 829, 17, 914, 284, 330, 606, 17, 12, 16, 15, 20, 17, 23, 18, 16, 23, 22, 19, 698, 2405, 3601, 2582, 284, 609, 10796, 4314, 16650, 26256, 515, 197, 21297, 25, 829...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestFormat(t *testing.T) { s, err := parseFile("src/parse/asp/test_data/interpreter/format.build") assert.NoError(t, err) assert.EqualValues(t, `LLVM_NATIVE_ARCH=\"x86\"`, s.Lookup("arch")) assert.EqualValues(t, `ARCH="linux_amd64"`, s.Lookup("arch2")) }
explode_data.jsonl/81093
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 108 }
[ 2830, 3393, 4061, 1155, 353, 8840, 836, 8, 341, 1903, 11, 1848, 1669, 4715, 1703, 445, 3548, 14, 6400, 14, 13367, 12697, 1769, 14, 90554, 92340, 13239, 1138, 6948, 35699, 1155, 11, 1848, 340, 6948, 12808, 6227, 1155, 11, 1565, 4086, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestSlotQueueBasic2(t *testing.T) { obj := NewSlotQueue("test2") if !obj.isIdle() { t.Fatalf("Should be idle") } if ok, _ := obj.isNewContainerNeeded(); ok { t.Fatalf("Should not need a new container") } outChan, cancel := obj.startDequeuer(context.Background()) select { case z := <-outChan: t.Fatalf("Should not get anything from queue: %#v", z) case <-time.After(time.Duration(500) * time.Millisecond): } cancel() }
explode_data.jsonl/45505
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 169 }
[ 2830, 3393, 19877, 7554, 15944, 17, 1155, 353, 8840, 836, 8, 1476, 22671, 1669, 1532, 19877, 7554, 445, 1944, 17, 5130, 743, 753, 2295, 2079, 41370, 368, 341, 197, 3244, 30762, 445, 14996, 387, 27647, 1138, 197, 532, 743, 5394, 11, 71...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestText(t *testing.T) { g := setup(t) g.Len(diff.NewText("a"), 1) g.Len(diff.NewText("a\n"), 2) g.Len(diff.NewText("a\n\n"), 3) g.Len(diff.NewText("\na"), 2) }
explode_data.jsonl/75070
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 88 }
[ 2830, 3393, 1178, 1155, 353, 8840, 836, 8, 341, 3174, 1669, 6505, 1155, 340, 3174, 65819, 37124, 7121, 1178, 445, 64, 3975, 220, 16, 340, 3174, 65819, 37124, 7121, 1178, 445, 64, 1699, 3975, 220, 17, 340, 3174, 65819, 37124, 7121, 117...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestGetTxIDsSubmittedByUser(t *testing.T) { clientCertTemDir := testutils.GenerateTestCrypto(t, []string{"admin", "alice", "bob", "eve", "server"}) testServer, _, _, err := SetupTestServerWithParams(t, clientCertTemDir, time.Second, 10, false, false) defer testServer.Stop() require.NoError(t, err) bcdb, adminSession, aliceSession := startServerConnectOpenAdminCreateUserAndUserSession(t, testServer, clientCertTemDir, "alice") pemUserCert, err := ioutil.ReadFile(path.Join(clientCertTemDir, "bob.pem")) require.NoError(t, err) dbPerm := map[string]types.Privilege_Access{ "bdb": 1, } addUser(t, "bob", adminSession, pemUserCert, dbPerm) bobSession := openUserSession(t, bcdb, "bob", clientCertTemDir) pemUserCert, err = ioutil.ReadFile(path.Join(clientCertTemDir, "eve.pem")) require.NoError(t, err) addUser(t, "eve", adminSession, pemUserCert, dbPerm) eveSession := openUserSession(t, bcdb, "eve", clientCertTemDir) users := []string{"alice", "bob"} userSessions := []DBSession{aliceSession, bobSession} userTx := make(map[string][]proto.Message) // 4 blocks, 10 tx each, 10 keys, each key repeated each block // odd blocks tx submitted by Alice, even by Bob for i := 0; i < 3; i++ { keys := make([]string, 0) values := make([]string, 0) for j := 0; j < 10; j++ { keys = append(keys, fmt.Sprintf("key%d", j)) values = append(values, fmt.Sprintf("value%d_%d", i, j)) } userTx[users[i%2]] = append(userTx[users[i%2]], putMultipleKeysAndValidateMultipleUsers(t, keys, values, users, userSessions[i%2])...) } tests := []struct { name string user string userSession DBSession userTxNum int userTx []proto.Message wantErr bool }{ { name: "user alice - multiple tx", user: "alice", userSession: aliceSession, userTxNum: 20, userTx: userTx["alice"], wantErr: false, }, { name: "user bob - multiple tx", user: "bob", userSession: bobSession, userTxNum: 10, userTx: userTx["bob"], wantErr: false, }, { name: "user eve - no tx", user: "eve", userSession: eveSession, userTxNum: 0, userTx: nil, wantErr: false, }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { p, err := tt.userSession.Provenance() require.NoError(t, err) txs, err := p.GetTxIDsSubmittedByUser(tt.user) if tt.wantErr { require.Error(t, err) return } require.NoError(t, err) require.Equal(t, tt.userTxNum, len(txs)) expectedTxIds := make([]string, 0) for _, tx := range tt.userTx { expectedTxIds = append(expectedTxIds, tx.(*types.DataTxEnvelope).GetPayload().GetTxId()) } require.ElementsMatch(t, expectedTxIds, txs) }) } }
explode_data.jsonl/47198
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1223 }
[ 2830, 3393, 1949, 31584, 30466, 46541, 1359, 1474, 1155, 353, 8840, 836, 8, 341, 25291, 36934, 21988, 6184, 1669, 1273, 6031, 57582, 2271, 58288, 1155, 11, 3056, 917, 4913, 2882, 497, 330, 63195, 497, 330, 47086, 497, 330, 82048, 497, 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...
3
func Test_signature_Raw(t *testing.T) { t.Parallel() type ( testCase struct { name string sign Signature want []byte wantErr bool } testList []testCase ) algos := GetAlgos() tests := make(testList, 0, algos.Len()+1) for name, algo := range algos { signable, _ := mockSignable(algo, 1024) tests = append(tests, testCase{ name: name + "_OK", sign: NewSignature(signable.Blob), want: signable.Blob, }) } tests = append(tests, testCase{ name: "ERR", sign: NewSignature(nil), wantErr: true, }) for idx := range tests { test := tests[idx] t.Run(test.name, func(t *testing.T) { t.Parallel() got, err := test.sign.Raw() if (err != nil) != test.wantErr { t.Errorf("Raw() error: %v | want: %v", err, test.wantErr) return } if !reflect.DeepEqual(got, test.want) { t.Errorf("Raw() got: %#v | want: %#v", got, test.want) } }) } }
explode_data.jsonl/21346
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 434 }
[ 2830, 3393, 39859, 2568, 672, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 2822, 13158, 2399, 197, 18185, 4207, 2036, 341, 298, 11609, 262, 914, 198, 298, 69054, 262, 32232, 198, 298, 50780, 262, 3056, 3782, 198, 298, 50780, 7747, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestNamespaceAssignShardSet(t *testing.T) { ctrl := xtest.NewController(t) defer ctrl.Finish() shards := sharding.NewShards([]uint32{0, 1, 2, 3, 4}, shard.Available) prevAssignment := shard.NewShards([]shard.Shard{shards[0], shards[2], shards[3]}) nextAssignment := shard.NewShards([]shard.Shard{shards[0], shards[4]}) closing := shard.NewShards([]shard.Shard{shards[2], shards[3]}) closingErrors := shard.NewShards([]shard.Shard{shards[3]}) adding := shard.NewShards([]shard.Shard{shards[4]}) metadata, err := namespace.NewMetadata(defaultTestNs1ID, namespace.NewOptions()) require.NoError(t, err) hashFn := func(identifier ident.ID) uint32 { return shards[0].ID() } shardSet, err := sharding.NewShardSet(prevAssignment.All(), hashFn) require.NoError(t, err) dopts := DefaultTestOptions() reporter := xmetrics.NewTestStatsReporter(xmetrics.NewTestStatsReporterOptions()) scope, closer := tally.NewRootScope(tally.ScopeOptions{Reporter: reporter}, time.Millisecond) defer closer.Close() dopts = dopts.SetInstrumentOptions(dopts.InstrumentOptions(). SetMetricsScope(scope)) oNs, err := newDatabaseNamespace(metadata, namespace.NewRuntimeOptionsManager(metadata.ID().String()), shardSet, nil, nil, nil, dopts) require.NoError(t, err) ns := oNs.(*dbNamespace) prevMockShards := make(map[uint32]*MockdatabaseShard) for _, testShard := range prevAssignment.All() { shard := NewMockdatabaseShard(ctrl) shard.EXPECT().ID().Return(testShard.ID()).AnyTimes() if closing.Contains(testShard.ID()) { if closingErrors.Contains(testShard.ID()) { shard.EXPECT().Close().Return(fmt.Errorf("an error")) } else { shard.EXPECT().Close().Return(nil) } } ns.shards[testShard.ID()] = shard prevMockShards[testShard.ID()] = shard } nextShardSet, err := sharding.NewShardSet(nextAssignment.All(), hashFn) require.NoError(t, err) ns.AssignShardSet(nextShardSet) waitForStats(reporter, func(r xmetrics.TestStatsReporter) bool { var ( counts = r.Counters() adds = int64(adding.NumShards()) closeSuccess = int64(closing.NumShards() - closingErrors.NumShards()) closeErrors = int64(closingErrors.NumShards()) ) return counts["database.dbnamespace.shards.add"] == adds && counts["database.dbnamespace.shards.close"] == closeSuccess && counts["database.dbnamespace.shards.close-errors"] == closeErrors }) for _, shard := range shards { if nextAssignment.Contains(shard.ID()) { assert.NotNil(t, ns.shards[shard.ID()]) if prevAssignment.Contains(shard.ID()) { assert.Equal(t, prevMockShards[shard.ID()], ns.shards[shard.ID()]) } else { assert.True(t, adding.Contains(shard.ID())) } } else { assert.Nil(t, ns.shards[shard.ID()]) } } }
explode_data.jsonl/35366
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1116 }
[ 2830, 3393, 22699, 28933, 2016, 567, 1649, 1155, 353, 8840, 836, 8, 341, 84381, 1669, 856, 1944, 7121, 2051, 1155, 340, 16867, 23743, 991, 18176, 2822, 36196, 2347, 1669, 557, 28410, 7121, 2016, 2347, 10556, 2496, 18, 17, 90, 15, 11, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestBuilderHeadersEncrypter(t *testing.T) { key := testPrivRSAKey1 claims := &Claims{Issuer: "foo"} keyIDBytes := make([]byte, 20) if _, err := io.ReadFull(rand.Reader, keyIDBytes); err != nil { t.Fatalf("failed to read random bytes: %v", err) } keyID := hex.EncodeToString(keyIDBytes) wantKeyID := keyID recipient := jose.Recipient{ Algorithm: jose.RSA1_5, Key: key.Public(), KeyID: keyID, } wantType := jose.ContentType("JWT") encrypter, err := jose.NewEncrypter(jose.A128CBC_HS256, recipient, (&jose.EncrypterOptions{}).WithType(wantType)) require.NoError(t, err, "failed to create encrypter") token, err := Encrypted(encrypter).Claims(claims).CompactSerialize() require.NoError(t, err, "failed to create token") jwe, err := jose.ParseEncrypted(token) if assert.NoError(t, err, "error parsing encrypted token") { assert.Equal(t, jose.Header{ ExtraHeaders: map[jose.HeaderKey]interface{}{ jose.HeaderType: string(wantType), "enc": "A128CBC-HS256", }, Algorithm: string(jose.RSA1_5), KeyID: wantKeyID, }, jwe.Header) } }
explode_data.jsonl/63653
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 464 }
[ 2830, 3393, 3297, 10574, 61520, 261, 1155, 353, 8840, 836, 8, 341, 23634, 1669, 1273, 32124, 73564, 1592, 16, 198, 197, 48561, 1669, 609, 51133, 90, 98902, 25, 330, 7975, 63159, 23634, 915, 7078, 1669, 1281, 10556, 3782, 11, 220, 17, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func Test_BeginAuthWithPrompt(t *testing.T) { // This exists because there was a panic caused by the oauth2 package when // the AuthCodeOption passed was nil. This test uses it, Test_BeginAuth does // not, to ensure both cases are covered. t.Parallel() a := assert.New(t) provider := googleProvider() provider.SetPrompt("test", "prompts") session, err := provider.BeginAuth("test_state") s := session.(*google.Session) a.NoError(err) a.Contains(s.AuthURL, "accounts.google.com/o/oauth2/auth") a.Contains(s.AuthURL, fmt.Sprintf("client_id=%s", domain.Env.GoogleKey)) a.Contains(s.AuthURL, "state=test_state") a.Contains(s.AuthURL, "scope=email") a.Contains(s.AuthURL, "prompt=test+prompts") }
explode_data.jsonl/19857
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 263 }
[ 2830, 3393, 93447, 5087, 2354, 54615, 1155, 353, 8840, 836, 8, 341, 197, 322, 1096, 6724, 1576, 1052, 572, 264, 21975, 8881, 553, 279, 46415, 17, 6328, 979, 198, 197, 322, 279, 7366, 2078, 5341, 5823, 572, 2092, 13, 1096, 1273, 5711, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestWithMultiPartFormDataSetsContentLength(t *testing.T) { v := map[string]interface{}{ "file": ioutil.NopCloser(strings.NewReader("Hello Gopher")), "age": "42", } r, err := Prepare(&http.Request{}, WithMultiPartFormData(v)) if err != nil { t.Fatalf("autorest: WithMultiPartFormData failed with error (%v)", err) } b, err := ioutil.ReadAll(r.Body) if err != nil { t.Fatalf("autorest: WithMultiPartFormData failed with error (%v)", err) } if r.ContentLength != int64(len(b)) { t.Fatalf("autorest:WithMultiPartFormData set Content-Length to %v, expected %v", r.ContentLength, len(b)) } }
explode_data.jsonl/20962
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 258 }
[ 2830, 3393, 2354, 20358, 5800, 55966, 30175, 2762, 4373, 1155, 353, 8840, 836, 8, 972, 5195, 1669, 2415, 14032, 31344, 6257, 1666, 197, 197, 1, 1192, 788, 43144, 2067, 453, 51236, 799, 51442, 68587, 445, 9707, 479, 16940, 2761, 1871, 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...
4
func TestPrintOneRecord(t *testing.T) { fakeTimestamp := time.Now() fakeData := []byte("something cool") fakeShardID := "fake-shard-id" fakeSequenceNumber := "fake-sequence-number" cases := []struct { name string verbose bool stream string shard *kinesis.Shard record *kinesis.Record expected string compress string }{ { name: "non verbose mode", verbose: false, record: &kinesis.Record{ ApproximateArrivalTimestamp: &fakeTimestamp, Data: fakeData, }, expected: fmt.Sprintf( "%s %s\n", fakeTimestamp.Format(recordDatetimeFormat), string(fakeData), ), }, { name: "verbose mode", verbose: true, stream: "fake-stream", shard: &kinesis.Shard{ ShardId: &fakeShardID, }, record: &kinesis.Record{ ApproximateArrivalTimestamp: &fakeTimestamp, SequenceNumber: &fakeSequenceNumber, Data: fakeData, }, expected: fmt.Sprintf( "%s %s %s %s %s\n", fakeTimestamp.Format(recordDatetimeFormat), "fake-stream", fakeShardID, fakeSequenceNumber, string(fakeData), ), }, } for _, test := range cases { var buf bytes.Buffer printOneRecord(&buf, test.stream, test.shard, test.record, test.compress, test.verbose) actual := buf.String() assert.Equal(t, test.expected, actual, "test [%s] failed", test.name) } }
explode_data.jsonl/57246
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 651 }
[ 2830, 3393, 8994, 3966, 6471, 1155, 353, 8840, 836, 8, 341, 1166, 726, 20812, 1669, 882, 13244, 741, 1166, 726, 1043, 1669, 3056, 3782, 445, 33331, 7010, 1138, 1166, 726, 2016, 567, 915, 1669, 330, 30570, 7514, 567, 12897, 698, 1166, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestBasicMarshalOrdered(t *testing.T) { var result bytes.Buffer err := NewEncoder(&result).Order(OrderPreserve).Encode(basicTestData) if err != nil { t.Fatal(err) } expected := basicTestTomlOrdered if !bytes.Equal(result.Bytes(), expected) { t.Errorf("Bad marshal: expected\n-----\n%s\n-----\ngot\n-----\n%s\n-----\n", expected, result.Bytes()) } }
explode_data.jsonl/46302
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 141 }
[ 2830, 3393, 15944, 55438, 54384, 1155, 353, 8840, 836, 8, 341, 2405, 1102, 5820, 22622, 198, 9859, 1669, 1532, 19921, 2099, 1382, 568, 4431, 39692, 14367, 5852, 568, 32535, 1883, 5971, 83920, 340, 743, 1848, 961, 2092, 341, 197, 3244, 2...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestGetCrb(t *testing.T) { assert := assert.New(t) crb := e.getCrb() assert.Equal(reflect.TypeOf(crb), reflect.TypeOf(&rbacv1.ClusterRoleBinding{})) assert.Equal(crb.ObjectMeta.Name, e.namespace) assert.Equal(crb.Subjects[0].Kind, "ServiceAccount") assert.Equal(crb.Subjects[0].Name, e.namespace) assert.Equal(crb.Subjects[0].Namespace, e.namespace) }
explode_data.jsonl/21317
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 155 }
[ 2830, 3393, 1949, 34, 10681, 1155, 353, 8840, 836, 8, 341, 6948, 1669, 2060, 7121, 1155, 340, 1444, 10681, 1669, 384, 22494, 10681, 741, 6948, 12808, 13321, 767, 73921, 1337, 10681, 701, 8708, 73921, 2099, 10681, 580, 85, 16, 72883, 903...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestJobStrategy(t *testing.T) { ctx := api.NewDefaultContext() if !Strategy.NamespaceScoped() { t.Errorf("Job must be namespace scoped") } if Strategy.AllowCreateOnUpdate() { t.Errorf("Job should not allow create on update") } validSelector := map[string]string{"a": "b"} validPodTemplateSpec := api.PodTemplateSpec{ ObjectMeta: api.ObjectMeta{ Labels: validSelector, }, Spec: api.PodSpec{ RestartPolicy: api.RestartPolicyOnFailure, DNSPolicy: api.DNSClusterFirst, Containers: []api.Container{{Name: "abc", Image: "image", ImagePullPolicy: "IfNotPresent"}}, }, } job := &experimental.Job{ ObjectMeta: api.ObjectMeta{ Name: "myjob", Namespace: api.NamespaceDefault, }, Spec: experimental.JobSpec{ Selector: validSelector, Template: &validPodTemplateSpec, }, Status: experimental.JobStatus{ Active: 11, }, } Strategy.PrepareForCreate(job) if job.Status.Active != 0 { t.Errorf("Job does not allow setting status on create") } errs := Strategy.Validate(ctx, job) if len(errs) != 0 { t.Errorf("Unexpected error validating %v", errs) } parallelism := 10 updatedJob := &experimental.Job{ ObjectMeta: api.ObjectMeta{Name: "bar", ResourceVersion: "4"}, Spec: experimental.JobSpec{ Parallelism: &parallelism, }, Status: experimental.JobStatus{ Active: 11, }, } // ensure we do not change status job.Status.Active = 10 Strategy.PrepareForUpdate(updatedJob, job) if updatedJob.Status.Active != 10 { t.Errorf("PrepareForUpdate should have preserved prior version status") } errs = Strategy.ValidateUpdate(ctx, updatedJob, job) if len(errs) == 0 { t.Errorf("Expected a validation error") } }
explode_data.jsonl/8946
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 640 }
[ 2830, 3393, 12245, 19816, 1155, 353, 8840, 836, 8, 341, 20985, 1669, 6330, 7121, 3675, 1972, 741, 743, 753, 19816, 46011, 39437, 368, 341, 197, 3244, 13080, 445, 12245, 1969, 387, 4473, 46960, 1138, 197, 532, 743, 27745, 29081, 4021, 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...
7
func TestCreatePipeline_ComplexPipeline(t *testing.T) { store := NewFakeClientManagerOrFatal(util.NewFakeTimeForEpoch()) defer store.Close() manager := NewResourceManager(store) createdPipeline, err := manager.CreatePipeline("pipeline1", "", []byte(strings.TrimSpace( complexPipeline))) assert.Nil(t, err) _, err = manager.GetPipeline(createdPipeline.UUID) assert.Nil(t, err) }
explode_data.jsonl/28348
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 144 }
[ 2830, 3393, 4021, 34656, 16946, 9111, 34656, 1155, 353, 8840, 836, 8, 341, 57279, 1669, 1532, 52317, 2959, 2043, 2195, 62396, 67811, 7121, 52317, 1462, 2461, 44338, 2398, 16867, 3553, 10421, 741, 92272, 1669, 1532, 32498, 31200, 692, 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 TestDirty(t *testing.T) { var r Record if r.Signed() { t.Error("Signed returned true for zero record") } if _, err := rlp.EncodeToBytes(r); err != errEncodeUnsigned { t.Errorf("expected errEncodeUnsigned, got %#v", err) } require.NoError(t, r.Sign(privkey)) if !r.Signed() { t.Error("Signed return false for signed record") } _, err := rlp.EncodeToBytes(r) assert.NoError(t, err) r.SetSeq(3) if r.Signed() { t.Error("Signed returned true for modified record") } if _, err := rlp.EncodeToBytes(r); err != errEncodeUnsigned { t.Errorf("expected errEncodeUnsigned, got %#v", err) } }
explode_data.jsonl/39491
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 254 }
[ 2830, 3393, 36485, 1155, 353, 8840, 836, 8, 341, 2405, 435, 13583, 271, 743, 435, 808, 1542, 368, 341, 197, 3244, 6141, 445, 49312, 5927, 830, 369, 7168, 3255, 1138, 197, 532, 743, 8358, 1848, 1669, 435, 13545, 50217, 1249, 7078, 2601...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestConditionalRequireResolve(t *testing.T) { default_suite.expectBundled(t, bundled{ files: map[string]string{ "/a.js": ` require.resolve(x ? 'a' : y ? 'b' : 'c') require.resolve(x ? y ? 'a' : 'b' : c) `, }, entryPaths: []string{"/a.js"}, options: config.Options{ Mode: config.ModeBundle, Platform: config.PlatformNode, OutputFormat: config.FormatCommonJS, AbsOutputFile: "/out.js", ExternalModules: config.ExternalModules{ NodeModules: map[string]bool{ "a": true, "b": true, "c": true, }, }, }, }) }
explode_data.jsonl/38473
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 283 }
[ 2830, 3393, 79233, 17959, 56808, 1155, 353, 8840, 836, 8, 341, 11940, 57239, 25952, 33, 1241, 832, 1155, 11, 51450, 515, 197, 74075, 25, 2415, 14032, 30953, 515, 298, 197, 3115, 64, 2857, 788, 22074, 571, 17957, 14691, 2075, 937, 364, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1