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 TestSeek(t *testing.T) { lines := []string{strings.Repeat("1", 32)} f, cleanup := setupTestFile(t) defer cleanup() appendToFile(t, f, lines) cmd := newReadLogsCommand() cmd.Offset = 16 cmd.readerBufferSize = 16 // this is the minimum allowed buffer size by bufio.NewReader mockLogOutputWriter := new(mockLogOutputWriter) defer mockLogOutputWriter.AssertExpectations(t) var wg sync.WaitGroup wg.Add(1) var wgDone = func(mock.Arguments) { wg.Done() } mockLogOutputWriter.On("Write", fmt.Sprintf("32 %s\n", strings.Repeat("1", 16))).Run(wgDone) cmd.logOutputWriter = mockLogOutputWriter mockLogStreamProvider := new(mockLogStreamProvider) defer mockLogStreamProvider.AssertExpectations(t) mockLogStreamProvider.On("Open").Return(f, nil) cmd.logStreamProvider = mockLogStreamProvider go func() { wg.Wait() _ = f.Close() }() err := cmd.readLogs() var expectedErr *os.PathError assert.ErrorAs(t, err, &expectedErr) }
explode_data.jsonl/3430
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 349 }
[ 2830, 3393, 39350, 1155, 353, 8840, 836, 8, 341, 78390, 1669, 3056, 917, 90, 18594, 2817, 10979, 445, 16, 497, 220, 18, 17, 73822, 1166, 11, 21290, 1669, 6505, 2271, 1703, 1155, 340, 16867, 21290, 741, 82560, 41550, 1155, 11, 282, 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 TestRepository_GetSearchCount_Success(t *testing.T) { mocksSearchService := new(mocks.SearchService) mocksSearchService.On("Issues", Anything, AnythingOfType("string"), Anything). Return(&github.IssuesSearchResult{Total: ToInt(42)}, nil, nil) repository := initRepository(t) if repository != nil { repository.searchService = mocksSearchService value, err := repository.GetCount("test") if assert.NoError(t, err) { assert.Equal(t, 42, value) mocksSearchService.AssertNumberOfCalls(t, "Issues", 1) mocksSearchService.AssertExpectations(t) } } }
explode_data.jsonl/36432
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 205 }
[ 2830, 3393, 4624, 13614, 5890, 2507, 87161, 1155, 353, 8840, 836, 8, 341, 2109, 25183, 5890, 1860, 1669, 501, 1255, 25183, 31903, 1860, 340, 2109, 25183, 5890, 1860, 8071, 445, 85828, 497, 40933, 11, 40933, 34696, 445, 917, 3975, 40933, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestMultipleRelationshipsFromOneNode(t *testing.T) { path := neo4j.Path{ Nodes: []neo4j.Node{ {Id: 5, Labels: []string{`Person`}, Props: map[string]interface{}{"Key": 5}}, {Id: 119, Labels: []string{`Movie`}, Props: map[string]interface{}{"Key": 119}}, }, Relationships: []neo4j.Relationship{ {Id: 4, StartId: 5, EndId: 119, Type: `DIRECTED`}, {Id: 5, StartId: 5, EndId: 119, Type: `WROTE`}, }, } actual := input.ToString(path) expected := `(:Movie {"Key":119})<-[:DIRECTED]-(:Person {"Key":5})-[:WROTE]->(:Movie {"Key":119})` if actual != expected { t.Fatalf(`expected '%v' but got '%v'`, expected, actual) } }
explode_data.jsonl/7084
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 281 }
[ 2830, 3393, 32089, 50822, 82, 3830, 3966, 1955, 1155, 353, 8840, 836, 8, 341, 26781, 1669, 35082, 19, 73, 17474, 515, 197, 197, 12288, 25, 3056, 51260, 19, 73, 21714, 515, 298, 197, 90, 764, 25, 220, 20, 11, 60996, 25, 3056, 917, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestPlanMigration_upApplyNone(t *testing.T) { db := dbtest.OpenWithoutMigrations(t) session, err := dbpkg.Open(db.DSN) require.NoError(t, err) n, err := Migrate(session, migrate.Up, 0) require.NoError(t, err) require.Greater(t, n, 1) migrations, err := PlanMigration(session, migrate.Up, 0) require.NoError(t, err) require.Empty(t, migrations) }
explode_data.jsonl/39319
{ "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, 20485, 20168, 8237, 28497, 4064, 1155, 353, 8840, 836, 8, 341, 20939, 1669, 2927, 1944, 12953, 26040, 44, 17824, 1155, 340, 25054, 11, 1848, 1669, 2927, 30069, 12953, 9791, 909, 18966, 340, 17957, 35699, 1155, 11, 1848, 692, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestRunInvalidGcflags(t *testing.T) { folder := testlib.Mktmp(t) writeGoodMain(t, folder) config := config.Project{ Builds: []config.Build{ { Binary: "nametest", Gcflags: []string{"{{.Version}"}, Targets: []string{ runtimeTarget, }, }, }, } ctx := context.New(config) ctx.Git.CurrentTag = "5.6.7" err := Default.Build(ctx, ctx.Config.Builds[0], api.Options{ Target: runtimeTarget, }) require.EqualError(t, err, `template: tmpl:1: unexpected "}" in operand`) }
explode_data.jsonl/54147
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 225 }
[ 2830, 3393, 6727, 7928, 38, 66, 11161, 1155, 353, 8840, 836, 8, 341, 1166, 2018, 1669, 1273, 2740, 1321, 74, 5173, 1155, 340, 24945, 15216, 6202, 1155, 11, 8527, 340, 25873, 1669, 2193, 30944, 515, 197, 197, 11066, 82, 25, 3056, 1676,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestCloseSend(t *testing.T) { send := make(chan *pb.ChaincodeMessage) recv := make(chan *pb.ChaincodeMessage) stream := newInProcStream(recv, send) stream.CloseSend() _, ok := <-send assert.False(t, ok, "send channel should be closed") assert.NotPanics(t, func() { stream.CloseSend() }, "CloseSend should be idempotent") }
explode_data.jsonl/68812
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 119 }
[ 2830, 3393, 7925, 11505, 1155, 353, 8840, 836, 8, 341, 32817, 1669, 1281, 35190, 353, 16650, 98269, 1851, 2052, 340, 197, 33977, 1669, 1281, 35190, 353, 16650, 98269, 1851, 2052, 692, 44440, 1669, 501, 641, 24508, 3027, 89494, 11, 3624, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_handleClientRequest(t *testing.T) { type args struct { client net.Conn } tests := []struct { name string args args }{ // TODO: Add test cases. } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { handleClientRequest(tt.args.client) }) } }
explode_data.jsonl/54071
{ "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, 10630, 2959, 1900, 1155, 353, 8840, 836, 8, 341, 13158, 2827, 2036, 341, 197, 25291, 4179, 50422, 198, 197, 532, 78216, 1669, 3056, 1235, 341, 197, 11609, 914, 198, 197, 31215, 2827, 198, 197, 59403, 197, 197, 322, 5343, 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 TestEnvironmentEcsUpserter(t *testing.T) { assert := assert.New(t) workflow := new(environmentWorkflow) workflow.environment = &common.Environment{ Name: "foo", Provider: common.EnvProviderEcs, } vpcInputParams := make(map[string]string) stackManager := new(mockedStackManagerForUpsert) stackManager.On("AwaitFinalStatus", "mu-environment-foo").Return(&common.Stack{Status: common.StackStatusCreateComplete}) stackManager.On("UpsertStack", "mu-environment-foo", mock.AnythingOfType("map[string]string")).Return(nil) stackManager.On("FindLatestImageID").Return("ami-00000", nil) err := workflow.environmentUpserter("mu", vpcInputParams, stackManager, stackManager, stackManager)() assert.Nil(err) stackManager.AssertExpectations(t) stackManager.AssertNumberOfCalls(t, "AwaitFinalStatus", 1) stackManager.AssertNumberOfCalls(t, "UpsertStack", 1) stackParams := stackManager.Calls[1].Arguments.Get(1).(map[string]string) assert.Equal("EC2", stackParams["LaunchType"]) assert.Equal("ami-00000", stackParams["ImageId"]) assert.NotContains(stackParams, "KeyName") }
explode_data.jsonl/15907
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 379 }
[ 2830, 3393, 12723, 36, 4837, 2324, 90727, 1155, 353, 8840, 836, 8, 341, 6948, 1669, 2060, 7121, 1155, 692, 197, 56249, 1669, 501, 67591, 62768, 340, 197, 56249, 62145, 284, 609, 5464, 45651, 515, 197, 21297, 25, 257, 330, 7975, 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...
1
func TestGetPackages(t *testing.T) { a := newForTest(t) defer a.Close() tTeam, _ := a.AddTeam(&Team{Name: "test_team"}) tApp, _ := a.AddApp(&Application{Name: "test_app", TeamID: tTeam.ID}) _, _ = a.AddPackage(&Package{Type: PkgTypeOther, URL: "http://sample.url/pkg1", Version: "1010.5.0+2016-05-27-1832", ApplicationID: tApp.ID, Arch: ArchAMD64}) _, _ = a.AddPackage(&Package{Type: PkgTypeOther, URL: "http://sample.url/pkg2", Version: "12.1.0", ApplicationID: tApp.ID, Arch: ArchX86}) _, _ = a.AddPackage(&Package{Type: PkgTypeOther, URL: "http://sample.url/pkg3", Version: "14.1.0", ApplicationID: tApp.ID, Arch: ArchAArch64}) _, _ = a.AddPackage(&Package{Type: PkgTypeOther, URL: "http://sample.url/pkg4", Version: "1010.6.0-blabla", ApplicationID: tApp.ID}) pkgs, err := a.GetPackages(tApp.ID, 0, 0) assert.NoError(t, err) assert.Equal(t, 4, len(pkgs)) assert.Equal(t, "http://sample.url/pkg4", pkgs[0].URL) assert.Equal(t, "http://sample.url/pkg1", pkgs[1].URL) assert.Equal(t, "http://sample.url/pkg3", pkgs[2].URL) assert.Equal(t, "http://sample.url/pkg2", pkgs[3].URL) assert.Equal(t, ArchAll, pkgs[0].Arch) assert.Equal(t, ArchAMD64, pkgs[1].Arch) assert.Equal(t, ArchAArch64, pkgs[2].Arch) assert.Equal(t, ArchX86, pkgs[3].Arch) _, err = a.GetPackages("invalidAppID", 0, 0) assert.Error(t, err, "Add id must be a valid uuid.") _, err = a.GetPackages(uuid.New().String(), 0, 0) assert.NoError(t, err, "should be no error for non existing appID") }
explode_data.jsonl/74617
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 641 }
[ 2830, 3393, 1949, 69513, 1155, 353, 8840, 836, 8, 341, 11323, 1669, 501, 2461, 2271, 1155, 340, 16867, 264, 10421, 2822, 3244, 14597, 11, 716, 1669, 264, 1904, 14597, 2099, 14597, 63121, 25, 330, 1944, 26532, 23625, 3244, 2164, 11, 716,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestOCMProvider_Delete(t *testing.T) { type fields struct { ocmClient ocm.Client } type args struct { clusterSpec *types.ClusterSpec } internalId := "test-internal-id" spec := &types.ClusterSpec{ InternalID: internalId, ExternalID: "", Status: "", AdditionalInfo: nil, } tests := []struct { name string fields fields args args want bool wantErr bool }{ { name: "should return true if cluster is not found from OCM", fields: fields{ ocmClient: &ocm.ClientMock{ DeleteClusterFunc: func(clusterID string) (int, error) { return http.StatusNotFound, nil }, }, }, args: args{ clusterSpec: spec, }, want: true, wantErr: false, }, { name: "should return false if the cluster still exists in OCM", fields: fields{ ocmClient: &ocm.ClientMock{ DeleteClusterFunc: func(clusterID string) (int, error) { return http.StatusConflict, nil }, }, }, args: args{ clusterSpec: spec, }, want: false, wantErr: false, }, { name: "should return error", fields: fields{ ocmClient: &ocm.ClientMock{ DeleteClusterFunc: func(clusterID string) (int, error) { return 0, errors.Errorf("failed to delete cluster from OCM") }, }, }, args: args{ clusterSpec: spec, }, want: false, wantErr: true, }, } for _, test := range tests { t.Run(test.name, func(t *testing.T) { RegisterTestingT(t) p := newOCMProvider(test.fields.ocmClient, nil, &ocm.OCMConfig{}) resp, err := p.Delete(test.args.clusterSpec) Expect(resp).To(Equal(test.want)) if test.wantErr { Expect(err).NotTo(BeNil()) } }) } }
explode_data.jsonl/4832
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 794 }
[ 2830, 3393, 7612, 44, 5179, 57418, 1155, 353, 8840, 836, 8, 341, 13158, 5043, 2036, 341, 197, 197, 509, 76, 2959, 297, 6226, 11716, 198, 197, 532, 13158, 2827, 2036, 341, 197, 197, 18855, 8327, 353, 9242, 72883, 8327, 198, 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...
1
func TestUnschedulableNodeDaemonDoesLaunchPod(t *testing.T) { forEachStrategy(t, func(t *testing.T, strategy *apps.DaemonSetUpdateStrategy) { closeFn, dc, informers, clientset := setup(t) defer closeFn() ns := framework.CreateNamespaceOrDie(clientset, "daemonset-unschedulable-test", t) defer framework.DeleteNamespaceOrDie(clientset, ns, t) dsClient := clientset.AppsV1().DaemonSets(ns.Name) podClient := clientset.CoreV1().Pods(ns.Name) nodeClient := clientset.CoreV1().Nodes() podInformer := informers.Core().V1().Pods().Informer() ctx, cancel := context.WithCancel(context.Background()) defer cancel() informers.Start(ctx.Done()) go dc.Run(ctx, 2) // Start Scheduler setupScheduler(ctx, t, clientset, informers) ds := newDaemonSet("foo", ns.Name) ds.Spec.UpdateStrategy = *strategy ds.Spec.Template.Spec.HostNetwork = true _, err := dsClient.Create(ctx, ds, metav1.CreateOptions{}) if err != nil { t.Fatalf("Failed to create DaemonSet: %v", err) } defer cleanupDaemonSets(t, clientset, ds) // Creates unschedulable node. node := newNode("unschedulable-node", nil) node.Spec.Unschedulable = true node.Spec.Taints = []v1.Taint{ { Key: v1.TaintNodeUnschedulable, Effect: v1.TaintEffectNoSchedule, }, } _, err = nodeClient.Create(ctx, node, metav1.CreateOptions{}) if err != nil { t.Fatalf("Failed to create node: %v", err) } // Creates network-unavailable node. nodeNU := newNode("network-unavailable-node", nil) nodeNU.Status.Conditions = []v1.NodeCondition{ {Type: v1.NodeReady, Status: v1.ConditionFalse}, {Type: v1.NodeNetworkUnavailable, Status: v1.ConditionTrue}, } nodeNU.Spec.Taints = []v1.Taint{ { Key: v1.TaintNodeNetworkUnavailable, Effect: v1.TaintEffectNoSchedule, }, } _, err = nodeClient.Create(ctx, nodeNU, metav1.CreateOptions{}) if err != nil { t.Fatalf("Failed to create node: %v", err) } validateDaemonSetPodsAndMarkReady(podClient, podInformer, 2, t) validateDaemonSetStatus(dsClient, ds.Name, 2, t) }) }
explode_data.jsonl/70047
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 857 }
[ 2830, 3393, 1806, 72243, 360, 480, 1955, 89177, 21468, 32067, 23527, 1155, 353, 8840, 836, 8, 341, 2023, 4854, 19816, 1155, 11, 2915, 1155, 353, 8840, 836, 11, 8282, 353, 27635, 909, 64, 7291, 1649, 4289, 19816, 8, 341, 197, 27873, 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...
4
func TestLabelsFromSpec(t *testing.T) { tests := map[string]struct { spec []string expectedLabels map[string]string expectedRemoveLabels []string expectedError string }{ "empty spec": { expectedLabels: map[string]string{}, }, "spec with =": { spec: []string{"foo=bar"}, expectedLabels: map[string]string{"foo": "bar"}, }, "invalid label spec": { spec: []string{"foo=bar=foobar"}, expectedError: "invalid label spec", }, "spec with -": { spec: []string{"foo-"}, expectedLabels: map[string]string{}, expectedRemoveLabels: []string{"foo"}, }, "unknown label spec": { spec: []string{"foo:bar"}, expectedError: "unknown label spec", }, "modify and remove": { spec: []string{"foo=bar", "foo-"}, expectedError: "can not both modify and remove a label in the same command", }, } for name, test := range tests { labels, removeLabels, err := LabelsFromSpec(test.spec) checkError(err, test.expectedError, name, t) if !reflect.DeepEqual(labels, test.expectedLabels) { t.Errorf("%s expected labels %#v but got %#v", name, test.expectedLabels, labels) } if !reflect.DeepEqual(removeLabels, test.expectedRemoveLabels) { t.Errorf("%s expected to remove labels %#v but got %#v", name, test.expectedRemoveLabels, removeLabels) } } }
explode_data.jsonl/17592
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 583 }
[ 2830, 3393, 23674, 3830, 8327, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 2415, 14032, 60, 1235, 341, 197, 98100, 338, 3056, 917, 198, 197, 42400, 23674, 981, 2415, 14032, 30953, 198, 197, 42400, 13021, 23674, 3056, 917, 198, 197, 42400...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestGetProwYAMLDoesNotCallRefGettersWhenInrepoconfigIsDisabled(t *testing.T) { t.Parallel() var baseSHAGetterCalled, headSHAGetterCalled bool baseSHAGetter := func() (string, error) { baseSHAGetterCalled = true return "", nil } headSHAGetter := func() (string, error) { headSHAGetterCalled = true return "", nil } c := &Config{} if _, err := c.getProwYAML(nil, "test", baseSHAGetter, headSHAGetter); err != nil { t.Fatalf("error calling GetProwYAML: %v", err) } if baseSHAGetterCalled { t.Error("baseSHAGetter got called") } if headSHAGetterCalled { t.Error("headSHAGetter got called") } }
explode_data.jsonl/8096
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 250 }
[ 2830, 3393, 1949, 47, 651, 56, 31102, 21468, 2623, 7220, 3945, 1949, 5045, 4498, 641, 23476, 1676, 3872, 25907, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 2822, 2405, 2331, 8590, 1890, 21405, 20960, 11, 1968, 8590, 1890, 21405, 20...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestGetSetID(t *testing.T) { id := ID("someid") var r Record r.Set(id) var id2 ID require.NoError(t, r.Load(&id2)) assert.Equal(t, id, id2) }
explode_data.jsonl/39484
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 73 }
[ 2830, 3393, 1949, 1649, 915, 1155, 353, 8840, 836, 8, 341, 15710, 1669, 3034, 445, 14689, 307, 1138, 2405, 435, 13583, 198, 7000, 4202, 3724, 692, 2405, 877, 17, 3034, 198, 17957, 35699, 1155, 11, 435, 13969, 2099, 307, 17, 1171, 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
func TestBreaker(t *testing.T) { n := 0 doubleCircuit := func(ctx context.Context) (string, error) { n++ if n < 3 { return "", ErrOps } return "OK", nil } breaker := Breaker(doubleCircuit, 2) results := []Result{} for i := 0; i < 5; i++ { resp, err := breaker(context.Background()) results = append(results, Result{resp, err}) if err == ErrServiceUnreachable { time.Sleep(5 * time.Second) } } expectedResults := []Result{ Result{"", ErrOps}, Result{"", ErrOps}, Result{"", ErrServiceUnreachable}, Result{"OK", nil}, Result{"OK", nil}, } if !reflect.DeepEqual(results, expectedResults) { t.Errorf("got: %v, want: %v", results, expectedResults) } }
explode_data.jsonl/82648
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 271 }
[ 2830, 3393, 22524, 261, 1155, 353, 8840, 836, 8, 341, 9038, 1669, 220, 15, 271, 8646, 34, 37268, 1669, 2915, 7502, 2266, 9328, 8, 320, 917, 11, 1465, 8, 341, 197, 9038, 81452, 197, 743, 308, 366, 220, 18, 341, 298, 853, 7342, 1549...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestCallRetry(t *testing.T) { service := "test.service" endpoint := "Test.Endpoint" address := "10.1.10.1" var called int wrap := func(cf CallFunc) CallFunc { return func(ctx context.Context, node *registry.Node, req Request, rsp interface{}, opts CallOptions) error { called++ if called == 1 { return errors.InternalServerError("test.error", "retry request") } // don't do the call return nil } } r := newTestRegistry() c := NewClient( Registry(r), WrapCall(wrap), ) c.Options().Selector.Init(selector.Registry(r)) req := c.NewRequest(service, endpoint, nil) // test calling remote address if err := c.Call(context.Background(), req, nil, WithAddress(address)); err != nil { t.Fatal("call with address error", err) } // num calls if called < c.Options().CallOptions.Retries+1 { t.Fatal("request not retried") } }
explode_data.jsonl/70452
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 324 }
[ 2830, 3393, 7220, 51560, 1155, 353, 8840, 836, 8, 341, 52934, 1669, 330, 1944, 5736, 698, 6246, 2768, 1669, 330, 2271, 90409, 698, 63202, 1669, 330, 16, 15, 13, 16, 13, 16, 15, 13, 16, 1837, 2405, 2598, 526, 271, 6692, 4611, 1669, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestRouter(t *testing.T) { type EchoResponse struct { Value string `json:"value" description:"The echoed back word"` } r := NewTestRouter(t) r.Resource("/echo", PathParam("word", "The word to echo back"), QueryParam("greet", "Return a greeting", false), ResponseJSON(http.StatusOK, "Successful echo response"), ResponseError(http.StatusBadRequest, "Invalid input"), ).Put("Echo back an input word.", func(word string, greet bool) (*EchoResponse, *ErrorModel) { if word == "test" { return nil, &ErrorModel{Detail: "Value not allowed: test"} } v := word if greet { v = "Hello, " + word } return &EchoResponse{Value: v}, nil }) w := httptest.NewRecorder() req, _ := http.NewRequest(http.MethodPut, "/echo/world", nil) r.ServeHTTP(w, req) assert.Equal(t, http.StatusOK, w.Code) assert.Equal(t, `{"value":"world"}`+"\n", w.Body.String()) w = httptest.NewRecorder() req, _ = http.NewRequest(http.MethodPut, "/echo/world?greet=true", nil) r.ServeHTTP(w, req) assert.Equal(t, http.StatusOK, w.Code) assert.Equal(t, `{"value":"Hello, world"}`+"\n", w.Body.String()) w = httptest.NewRecorder() req, _ = http.NewRequest(http.MethodPut, "/echo/world?greet=bad", nil) r.ServeHTTP(w, req) assert.Equal(t, http.StatusBadRequest, w.Code) // Check spec & docs routes w = httptest.NewRecorder() req, _ = http.NewRequest(http.MethodGet, "/openapi.json", nil) r.ServeHTTP(w, req) assert.Equal(t, http.StatusOK, w.Code) w = httptest.NewRecorder() req, _ = http.NewRequest(http.MethodGet, "/docs", nil) r.ServeHTTP(w, req) assert.Equal(t, http.StatusOK, w.Code) }
explode_data.jsonl/66536
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 635 }
[ 2830, 3393, 9523, 1155, 353, 8840, 836, 8, 341, 13158, 37806, 2582, 2036, 341, 197, 47399, 914, 1565, 2236, 2974, 957, 1, 4008, 2974, 785, 54112, 1182, 3409, 8805, 197, 630, 7000, 1669, 1532, 2271, 9523, 1155, 692, 7000, 20766, 4283, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestLoadOnce(t *testing.T) { reset() config := []string{} err := Load(config) if err != nil { t.Fatalf("unexpected error: %v", err) } config = append(config, "i_am_a_test_flag") err = Load(config) if err == nil { t.Fatal("expected an error when loading for the second time but got none") } if IsSet(FlagTestFlag) { t.Fatalf("expected test flag to be undisturbed after error but it was not") } reset() }
explode_data.jsonl/270
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 160 }
[ 2830, 3393, 5879, 12522, 1155, 353, 8840, 836, 8, 341, 70343, 2822, 25873, 1669, 3056, 917, 16094, 9859, 1669, 8893, 8754, 340, 743, 1848, 961, 2092, 341, 197, 3244, 30762, 445, 53859, 1465, 25, 1018, 85, 497, 1848, 340, 197, 630, 258...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestNewTxFromString(t *testing.T) { t.Parallel() t.Run("valid tx no inputs", func(t *testing.T) { tx, err := bt.NewTxFromString("01000000000100000000000000001a006a07707265666978310c6578616d706c65206461746102133700000000") assert.NoError(t, err) assert.NotNil(t, tx) }) t.Run("invalid tx", func(t *testing.T) { tx, err := bt.NewTxFromString("0") assert.Error(t, err) assert.Nil(t, tx) }) t.Run("invalid tx - too short", func(t *testing.T) { tx, err := bt.NewTxFromString("000000") assert.Error(t, err) assert.Nil(t, tx) }) t.Run("valid tx, 1 input, 1 output", func(t *testing.T) { rawTx := "02000000011ccba787d421b98904da3329b2c7336f368b62e89bc896019b5eadaa28145b9c000000004847304402205cc711985ce2a6d61eece4f9b6edd6337bad3b7eca3aa3ce59bc15620d8de2a80220410c92c48a226ba7d5a9a01105524097f673f31320d46c3b61d2378e6f05320041ffffffff01c0aff629010000001976a91418392a59fc1f76ad6a3c7ffcea20cfcb17bda9eb88ac00000000" tx, err := bt.NewTxFromString(rawTx) assert.NoError(t, err) assert.NotNil(t, tx) // Check version, locktime, inputs assert.Equal(t, uint32(2), tx.Version) assert.Equal(t, uint32(0), tx.LockTime) assert.Equal(t, 1, len(tx.Inputs)) // Create a new unlocking script i := bt.Input{ PreviousTxID: "9c5b1428aaad5e9b0196c89be8628b366f33c7b22933da0489b921d487a7cb1c", PreviousTxOutIndex: 0, SequenceNumber: bt.DefaultSequenceNumber, } i.UnlockingScript, err = bscript.NewFromHexString("47304402205cc711985ce2a6d61eece4f9b6edd6337bad3b7eca3aa3ce59bc15620d8de2a80220410c92c48a226ba7d5a9a01105524097f673f31320d46c3b61d2378e6f05320041") assert.NoError(t, err) assert.NotNil(t, i.UnlockingScript) // Check input type assert.Equal(t, true, reflect.DeepEqual(*tx.Inputs[0], i)) // Check output assert.Equal(t, 1, len(tx.Outputs)) // New output var ls *bscript.Script ls, err = bscript.NewFromHexString("76a91418392a59fc1f76ad6a3c7ffcea20cfcb17bda9eb88ac") assert.NoError(t, err) assert.NotNil(t, ls) // Check the type o := bt.Output{Satoshis: 4999000000, LockingScript: ls} assert.Equal(t, true, reflect.DeepEqual(*tx.Outputs[0], o)) }) }
explode_data.jsonl/28735
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1007 }
[ 2830, 3393, 3564, 31584, 44491, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 2822, 3244, 16708, 445, 1891, 9854, 902, 11127, 497, 2915, 1155, 353, 8840, 836, 8, 341, 197, 46237, 11, 1848, 1669, 19592, 7121, 31584, 44491, 445, 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 TestDefaultCleanupHTTP(t *testing.T) { http.HandleFunc("/", func(w http.ResponseWriter, req *http.Request) { fmt.Fprintf(w, "Hello world!") }) server := &http.Server{Addr: ":10000"} PreCleanupPush(cleanup1, 2) PreCleanupPush(cleanup2, 1) PostCleanupPush(cleanup3, 4) PostCleanupPush(cleanup4, 3) Serve(server, 5*time.Second) }
explode_data.jsonl/15567
{ "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, 3675, 67335, 9230, 1155, 353, 8840, 836, 8, 341, 28080, 63623, 35460, 2915, 3622, 1758, 37508, 11, 4232, 353, 1254, 9659, 8, 341, 197, 11009, 59559, 3622, 11, 330, 9707, 1879, 22988, 197, 8824, 41057, 1669, 609, 1254, 22997,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestEnforceSingleMesh(t *testing.T) { assert := tassert.New(t) out := new(bytes.Buffer) store := storage.Init(driver.NewMemory()) if mem, ok := store.Driver.(*driver.Memory); ok { mem.SetNamespace(settings.Namespace()) } config := &helm.Configuration{ Releases: store, KubeClient: &kubefake.PrintingKubeClient{ Out: ioutil.Discard, }, Capabilities: chartutil.DefaultCapabilities, Log: func(format string, v ...interface{}) {}, } fakeClientSet := fake.NewSimpleClientset() install := &installCmd{ out: out, chartPath: testChartPath, meshName: defaultMeshName, clientSet: fakeClientSet, enforceSingleMesh: true, setOptions: []string{ fmt.Sprintf("OpenServiceMesh.image.registry=%s", testRegistry), fmt.Sprintf("OpenServiceMesh.image.tag=%s", testOsmImageTag), "OpenServiceMesh.image.pullPolicy=IfNotPresent", fmt.Sprintf("OpenServiceMesh.envoyLogLevel=%s", testEnvoyLogLevel), fmt.Sprintf("OpenServiceMesh.controllerLogLevel=%s", testControllerLogLevel), fmt.Sprintf("OpenServiceMesh.prometheus.retention.time=%s", testRetentionTime), "OpenServiceMesh.serviceCertValidityDuration=24h", "OpenServiceMesh.deployGrafana=false", "OpenServiceMesh.enableIngress=true", "OpenServiceMesh.certificateManager=tresor", }, } err := install.run(config) assert.Nil(err) assert.Equal(out.String(), "OSM installed successfully in namespace [osm-system] with mesh name [osm]\n") }
explode_data.jsonl/60828
{ "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, 1702, 8833, 10888, 14194, 1155, 353, 8840, 836, 8, 341, 6948, 1669, 259, 2207, 7121, 1155, 692, 13967, 1669, 501, 23158, 22622, 340, 57279, 1669, 5819, 26849, 24032, 7121, 10642, 2398, 743, 1833, 11, 5394, 1669, 3553, 41768, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_hcsTask_DeleteExec_InitExecID_CreatedState_Success(t *testing.T) { lt, init, second := setupTestHcsTask(t) // remove the 2nd exec so we just check without it. lt.execs.Delete(second.id) // try to delete the init exec pid, status, at, err := lt.DeleteExec(context.TODO(), "") if err != nil { t.Fatalf("expected nil err got: %v", err) } verifyDeleteSuccessValues(t, pid, status, at, init) }
explode_data.jsonl/56378
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 151 }
[ 2830, 3393, 1523, 4837, 6262, 57418, 10216, 15644, 10216, 915, 920, 2850, 1397, 87161, 1155, 353, 8840, 836, 8, 341, 197, 4832, 11, 2930, 11, 2086, 1669, 6505, 2271, 39, 4837, 6262, 1155, 340, 197, 322, 4057, 279, 220, 17, 303, 3883, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestDecodeCmdMessagePublish(t *testing.T) { bin := []byte{ // nil 0x05, // string: abc 0x02, 0x00, 0x03, 0x61, 0x62, 0x63, // string: def 0x02, 0x00, 0x03, 0x64, 0x65, 0x66, } r := bytes.NewReader(bin) d := amf0.NewDecoder(r) var v AMFConvertible err := CmdBodyDecoderFor("publish", 42)(r, d, &v) assert.Nil(t, err) assert.Equal(t, &NetStreamPublish{ PublishingName: "abc", PublishingType: "def", }, v) }
explode_data.jsonl/7725
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 217 }
[ 2830, 3393, 32564, 15613, 2052, 50145, 1155, 353, 8840, 836, 8, 341, 2233, 258, 1669, 3056, 3782, 515, 197, 197, 322, 2092, 198, 197, 197, 15, 87, 15, 20, 345, 197, 197, 322, 914, 25, 39022, 198, 197, 197, 15, 87, 15, 17, 11, 22...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestDestroy(t *testing.T) { cluster := initCluster() cluster.InitCluster() urls := make([]*motan.URL, 0, 2) urls = append(urls, &motan.URL{Host: "127.0.0.1", Port: 8001, Protocol: "test"}) urls = append(urls, &motan.URL{Host: "127.0.0.1", Port: 8002, Protocol: "test"}) cluster.Notify(RegistryURL, urls) cluster.Destroy() if cluster.closed != true { t.Fatalf("cluster destroy fail, closed not false") } }
explode_data.jsonl/19273
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 176 }
[ 2830, 3393, 14245, 1155, 353, 8840, 836, 8, 341, 197, 18855, 1669, 2930, 28678, 741, 197, 18855, 26849, 28678, 741, 19320, 82, 1669, 1281, 85288, 46828, 276, 20893, 11, 220, 15, 11, 220, 17, 340, 19320, 82, 284, 8737, 91182, 11, 609, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestLog_no_pipelinerun_argument(t *testing.T) { ns := []*corev1.Namespace{ { ObjectMeta: metav1.ObjectMeta{ Name: "ns", }, }, } cs, _ := test.SeedTestData(t, pipelinetest.Data{Namespaces: ns}) p := &test.Params{Tekton: cs.Pipeline, Kube: cs.Kube} c := Command(p) _, err := test.ExecuteCommand(c, "logs", "-n", "ns") if err == nil { t.Error("Expecting an error but it's empty") } }
explode_data.jsonl/14855
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 188 }
[ 2830, 3393, 2201, 6536, 620, 81079, 10453, 359, 9025, 1155, 353, 8840, 836, 8, 341, 84041, 1669, 29838, 98645, 16, 46011, 515, 197, 197, 515, 298, 23816, 12175, 25, 77520, 16, 80222, 515, 571, 21297, 25, 330, 4412, 756, 298, 197, 1583...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestWaitReadyReuseAction(t *testing.T) { t.Parallel() ctx, cancel := testAllocate(t, "js.html") defer cancel() // Reusing a single WaitReady action used to panic. action := WaitReady("#input2", ByID) for i := 0; i < 3; i++ { if err := Run(ctx, action); err != nil { t.Fatalf("got error: %v", err) } } }
explode_data.jsonl/59494
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 129 }
[ 2830, 3393, 14190, 19202, 38081, 2512, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 2822, 20985, 11, 9121, 1669, 1273, 75380, 1155, 11, 330, 2519, 2564, 1138, 16867, 9121, 2822, 197, 322, 1032, 970, 264, 3175, 13824, 19202, 1917, 14...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestSplitWith(t *testing.T) { for i, tc := range []struct { input string expectModule string expectVersion string expectReplace string expectErr bool }{ { input: "module", expectModule: "module", }, { input: "module@version", expectModule: "module", expectVersion: "version", }, { input: "module@version=replace", expectModule: "module", expectVersion: "version", expectReplace: "replace", }, { input: "module=replace", expectModule: "module", expectReplace: "replace", }, { input: "=replace", expectErr: true, }, { input: "@version", expectErr: true, }, { input: "@version=replace", expectErr: true, }, { input: "", expectErr: true, }, } { actualModule, actualVersion, actualReplace, actualErr := splitWith(tc.input) if actualModule != tc.expectModule { t.Errorf("Test %d: Expected module '%s' but got '%s' (input=%s)", i, tc.expectModule, actualModule, tc.input) } if tc.expectErr { if actualErr == nil { t.Errorf("Test %d: Expected error but did not get one (input='%s')", i, tc.input) } continue } if !tc.expectErr && actualErr != nil { t.Errorf("Test %d: Expected no error but got: %s (input='%s')", i, actualErr, tc.input) } if actualVersion != tc.expectVersion { t.Errorf("Test %d: Expected version '%s' but got '%s' (input='%s')", i, tc.expectVersion, actualVersion, tc.input) } if actualReplace != tc.expectReplace { t.Errorf("Test %d: Expected module '%s' but got '%s' (input='%s')", i, tc.expectReplace, actualReplace, tc.input) } } }
explode_data.jsonl/80733
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 782 }
[ 2830, 3393, 20193, 2354, 1155, 353, 8840, 836, 8, 341, 2023, 600, 11, 17130, 1669, 2088, 3056, 1235, 341, 197, 22427, 260, 914, 198, 197, 24952, 3332, 220, 914, 198, 197, 24952, 5637, 914, 198, 197, 24952, 23107, 914, 198, 197, 24952,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestIncreaseConsumeOKTPSGetConsumeOKTPS(t *testing.T) { ShutDownStatis() tests := []struct { RT int ExpectSum int64 }{ {1, 0}, {1, 1}, {1, 2}, {1, 3}, {1, 4}, {1, 5}, {1, 6}, {1, 6}, } for _, tt := range tests { increaseConsumeOKTPS("rocketmq", "default", tt.RT) topicAndGroupConsumeOKTPS.samplingInSeconds() snapshot := getConsumeOKTPS("rocketmq", "default") if snapshot.sum != tt.ExpectSum { t.Errorf("wrong Consume OK TPS sum. want=%d, got=%d", tt.ExpectSum, snapshot.sum) } } }
explode_data.jsonl/1965
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 255 }
[ 2830, 3393, 69556, 1109, 31323, 3925, 4239, 50, 1949, 1109, 31323, 3925, 4239, 50, 1155, 353, 8840, 836, 8, 341, 197, 2016, 332, 4454, 623, 3605, 741, 78216, 1669, 3056, 1235, 341, 197, 11826, 286, 526, 198, 197, 35911, 9190, 526, 21,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestHandleRDSResponse(t *testing.T) { fakeServer, sCleanup := fakexds.StartServer(t) client, cCleanup := fakeServer.GetClientConn(t) defer func() { cCleanup() sCleanup() }() v2c := newV2Client(client, goodNodeProto, func(int) time.Duration { return 0 }) // Register an LDS watcher, and wait till the request is sent out, the // response is received and the callback is invoked. cbCh := make(chan error, 1) v2c.watchLDS(goodLDSTarget1, func(u ldsUpdate, err error) { t.Logf("v2c.watchLDS callback, ldsUpdate: %+v, err: %v", u, err) cbCh <- err }) <-fakeServer.RequestChan fakeServer.ResponseChan <- &fakexds.Response{Resp: goodLDSResponse1} if err := <-cbCh; err != nil { t.Fatalf("v2c.watchLDS returned error in callback: %v", err) } tests := []struct { name string rdsResponse *xdspb.DiscoveryResponse wantErr bool wantUpdate *rdsUpdate wantUpdateErr bool }{ // Badly marshaled RDS response. { name: "badly-marshaled-response", rdsResponse: badlyMarshaledRDSResponse, wantErr: true, wantUpdate: nil, wantUpdateErr: false, }, // Response does not contain RouteConfiguration proto. { name: "no-route-config-in-response", rdsResponse: badResourceTypeInRDSResponse, wantErr: true, wantUpdate: nil, wantUpdateErr: false, }, // No VirtualHosts in the response. Just one test case here for a bad // RouteConfiguration, since the others are covered in // TestGetClusterFromRouteConfiguration. { name: "no-virtual-hosts-in-response", rdsResponse: noVirtualHostsInRDSResponse, wantErr: true, wantUpdate: nil, wantUpdateErr: false, }, // Response contains one good RouteConfiguration, uninteresting though. { name: "one-uninteresting-route-config", rdsResponse: goodRDSResponse2, wantErr: false, wantUpdate: nil, wantUpdateErr: false, }, // Response contains one good interesting RouteConfiguration. { name: "one-good-route-config", rdsResponse: goodRDSResponse1, wantErr: false, wantUpdate: &rdsUpdate{clusterName: goodClusterName1}, wantUpdateErr: false, }, } for _, test := range tests { t.Run(test.name, func(t *testing.T) { gotUpdateCh := make(chan rdsUpdate, 1) gotUpdateErrCh := make(chan error, 1) // Register a watcher, to trigger the v2Client to send an RDS request. cancelWatch := v2c.watchRDS(goodRouteName1, func(u rdsUpdate, err error) { t.Logf("in v2c.watchRDS callback, rdsUpdate: %+v, err: %v", u, err) gotUpdateCh <- u gotUpdateErrCh <- err }) // Wait till the request makes it to the fakeServer. This ensures that // the watch request has been processed by the v2Client. <-fakeServer.RequestChan // Directly push the response through a call to handleRDSResponse, // thereby bypassing the fakeServer. if err := v2c.handleRDSResponse(test.rdsResponse); (err != nil) != test.wantErr { t.Fatalf("v2c.handleRDSResponse() returned err: %v, wantErr: %v", err, test.wantErr) } // If the test needs the callback to be invoked, verify the update and // error pushed to the callback. if test.wantUpdate != nil { timer := time.NewTimer(defaultTestTimeout) select { case <-timer.C: t.Fatal("Timeout when expecting RDS update") case gotUpdate := <-gotUpdateCh: timer.Stop() if !reflect.DeepEqual(gotUpdate, *test.wantUpdate) { t.Fatalf("got RDS update : %+v, want %+v", gotUpdate, *test.wantUpdate) } } // Since the callback that we registered pushes to both channels at // the same time, this channel read should return immediately. gotUpdateErr := <-gotUpdateErrCh if (gotUpdateErr != nil) != test.wantUpdateErr { t.Fatalf("got RDS update error {%v}, wantErr: %v", gotUpdateErr, test.wantUpdateErr) } } cancelWatch() }) } }
explode_data.jsonl/51249
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1592 }
[ 2830, 3393, 6999, 49, 5936, 2582, 1155, 353, 8840, 836, 8, 341, 1166, 726, 5475, 11, 274, 67335, 1669, 282, 585, 327, 5356, 12101, 5475, 1155, 340, 25291, 11, 272, 67335, 1669, 12418, 5475, 2234, 2959, 9701, 1155, 340, 16867, 2915, 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 TestGameScriptWinX(t *testing.T) { script := []tttPb.MoveTrxPayload{ {Position: 0, Mark: tttPb.Mark_X}, {Position: 1, Mark: tttPb.Mark_O}, {Position: 4, Mark: tttPb.Mark_X}, {Position: 8, Mark: tttPb.Mark_O}, {Position: 3, Mark: tttPb.Mark_X}, {Position: 5, Mark: tttPb.Mark_O}, {Position: 6, Mark: tttPb.Mark_X}, } stub := initContract(t) _, err := runScriptAndCheckLastState(script, tttPb.TttContract_XWON, stub) if err != nil { t.Fatal(err.Error()) } }
explode_data.jsonl/67451
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 230 }
[ 2830, 3393, 4868, 5910, 16970, 55, 1155, 353, 8840, 836, 8, 341, 86956, 1669, 3056, 5566, 83, 47, 65, 31195, 1282, 87, 29683, 515, 197, 197, 90, 3812, 25, 220, 15, 11, 4389, 25, 259, 5566, 47, 65, 75888, 6859, 1583, 197, 197, 90, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestUpsertSQLRecord(t *testing.T) { var rec = struct { B int `db:"b"` C int `db:"c"` }{1, 2} us := Upsert("tab"). Columns("b", "c"). Record(rec). Where("d=$1", 4). Returning("f", "g") sql, args, err := us.ToSQL() assert.NoError(t, err) expected := ` WITH upd AS ( UPDATE tab SET b = $1, c = $2 WHERE (d=$3) RETURNING f,g ), ins AS ( INSERT INTO tab(b,c) SELECT $1,$2 WHERE NOT EXISTS (SELECT 1 FROM upd) RETURNING f,g ) SELECT * FROM ins UNION ALL SELECT * FROM upd ` assert.Equal(t, stripWS(expected), stripWS(sql)) assert.Equal(t, []interface{}{1, 2, 4}, args) }
explode_data.jsonl/32410
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 297 }
[ 2830, 3393, 98778, 529, 6688, 6471, 1155, 353, 8840, 836, 8, 341, 2405, 1395, 284, 2036, 341, 197, 12791, 526, 1565, 1999, 2974, 65, 8805, 197, 6258, 526, 1565, 1999, 2974, 66, 8805, 197, 15170, 16, 11, 220, 17, 532, 70175, 1669, 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...
1
func TestBuildRateLimitZones(t *testing.T) { invalidType := &ingress.Ingress{} expected := []string{} actual := buildRateLimitZones(invalidType) if !reflect.DeepEqual(expected, actual) { t.Errorf("Expected '%v' but returned '%v'", expected, actual) } }
explode_data.jsonl/80592
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 96 }
[ 2830, 3393, 11066, 11564, 16527, 57, 3154, 1155, 353, 8840, 836, 8, 341, 197, 11808, 929, 1669, 609, 287, 673, 5337, 2483, 16094, 42400, 1669, 3056, 917, 16094, 88814, 1669, 1936, 11564, 16527, 57, 3154, 5900, 1891, 929, 692, 743, 753, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestCdnKeys(t *testing.T) { tc := testutil.SystemTest(t) buf := &bytes.Buffer{} // Test setup // Delete the Google CDN key if it exists. if err := getCdnKey(buf, tc.ProjectID, gcdnCdnKeyID); err == nil { testutil.Retry(t, 3, 2*time.Second, func(r *testutil.R) { if err := deleteCdnKey(buf, tc.ProjectID, gcdnCdnKeyID); err != nil { r.Errorf("deleteCdnKey got err: %v", err) } }) } // Delete the Akamai CDN key if it exists. if err := getCdnKey(buf, tc.ProjectID, akamaiCdnKeyID); err == nil { testutil.Retry(t, 3, 2*time.Second, func(r *testutil.R) { if err := deleteCdnKey(buf, tc.ProjectID, akamaiCdnKeyID); err != nil { r.Errorf("deleteCdnKey got err: %v", err) } }) } // Tests // Google CDN tests // Create a new Google CDN key. testutil.Retry(t, 3, 2*time.Second, func(r *testutil.R) { cdnKeyName := fmt.Sprintf("projects/%s/locations/%s/cdnKeys/%s", projectNumber, location, gcdnCdnKeyID) if err := createCdnKey(buf, tc.ProjectID, gcdnCdnKeyID, hostname, gcdnKeyname, privateKey, ""); err != nil { r.Errorf("createCdnKey (GCDN) got err: %v", err) } if got := buf.String(); !strings.Contains(got, cdnKeyName) { r.Errorf("createCdnKey (GCDN) got\n----\n%v\n----\nWant to contain:\n----\n%v\n----\n", got, cdnKeyName) } }) buf.Reset() // List the CDN keys for a given location. testutil.Retry(t, 3, 2*time.Second, func(r *testutil.R) { cdnKeyName := fmt.Sprintf("projects/%s/locations/%s/cdnKeys/%s", tc.ProjectID, location, gcdnCdnKeyID) if err := listCdnKeys(buf, tc.ProjectID); err != nil { r.Errorf("listCdnKeys got err: %v", err) } if got := buf.String(); !strings.Contains(got, cdnKeyName) { r.Errorf("listCdnKeys got\n----\n%v\n----\nWant to contain:\n----\n%v\n----\n", got, cdnKeyName) } }) buf.Reset() // Update an existing CDN key. testutil.Retry(t, 3, 2*time.Second, func(r *testutil.R) { cdnKeyName := fmt.Sprintf("projects/%s/locations/%s/cdnKeys/%s", tc.ProjectID, location, gcdnCdnKeyID) if err := updateCdnKey(buf, tc.ProjectID, gcdnCdnKeyID, updatedHostname, gcdnKeyname, updatedPrivateKey, ""); err != nil { r.Errorf("updateCdnKey got err: %v", err) } if got := buf.String(); !strings.Contains(got, cdnKeyName) { r.Errorf("updateCdnKey got\n----\n%v\n----\nWant to contain:\n----\n%v\n----\n", got, cdnKeyName) } }) buf.Reset() // Get the updated CDN key. testutil.Retry(t, 3, 2*time.Second, func(r *testutil.R) { cdnKeyName := fmt.Sprintf("projects/%s/locations/%s/cdnKeys/%s", tc.ProjectID, location, gcdnCdnKeyID) if err := getCdnKey(buf, tc.ProjectID, gcdnCdnKeyID); err != nil { r.Errorf("getCdnKey got err: %v", err) } if got := buf.String(); !strings.Contains(got, cdnKeyName) { r.Errorf("getCdnKey got\n----\n%v\n----\nWant to contain:\n----\n%v\n----\n", got, cdnKeyName) } }) // Delete the CDN key. testutil.Retry(t, 3, 2*time.Second, func(r *testutil.R) { if err := deleteCdnKey(buf, tc.ProjectID, gcdnCdnKeyID); err != nil { r.Errorf("deleteCdnKey got err: %v", err) } if got := buf.String(); !strings.Contains(got, deleteCdnKeyResponse) { r.Errorf("deleteCdnKey got\n----\n%v\n----\nWant to contain:\n----\n%v\n----\n", got, deleteCdnKeyResponse) } }) // Akamai tests // Create a new Akamai CDN key. testutil.Retry(t, 3, 2*time.Second, func(r *testutil.R) { cdnKeyName := fmt.Sprintf("projects/%s/locations/%s/cdnKeys/%s", projectNumber, location, akamaiCdnKeyID) if err := createCdnKey(buf, tc.ProjectID, akamaiCdnKeyID, hostname, "", "", privateKey); err != nil { r.Errorf("createCdnKey (Akamai) got err: %v", err) } if got := buf.String(); !strings.Contains(got, cdnKeyName) { r.Errorf("createCdnKey (Akamai) got\n----\n%v\n----\nWant to contain:\n----\n%v\n----\n", got, cdnKeyName) } }) buf.Reset() // List the CDN keys for a given location. testutil.Retry(t, 3, 2*time.Second, func(r *testutil.R) { cdnKeyName := fmt.Sprintf("projects/%s/locations/%s/cdnKeys/%s", tc.ProjectID, location, akamaiCdnKeyID) if err := listCdnKeys(buf, tc.ProjectID); err != nil { r.Errorf("listCdnKeys got err: %v", err) } if got := buf.String(); !strings.Contains(got, cdnKeyName) { r.Errorf("listCdnKeys got\n----\n%v\n----\nWant to contain:\n----\n%v\n----\n", got, cdnKeyName) } }) buf.Reset() // Update an existing CDN key. testutil.Retry(t, 3, 2*time.Second, func(r *testutil.R) { cdnKeyName := fmt.Sprintf("projects/%s/locations/%s/cdnKeys/%s", tc.ProjectID, location, akamaiCdnKeyID) if err := updateCdnKey(buf, tc.ProjectID, akamaiCdnKeyID, updatedHostname, "", "", updatedPrivateKey); err != nil { r.Errorf("updateCdnKey got err: %v", err) } if got := buf.String(); !strings.Contains(got, cdnKeyName) { r.Errorf("updateCdnKey got\n----\n%v\n----\nWant to contain:\n----\n%v\n----\n", got, cdnKeyName) } }) buf.Reset() // Get the updated CDN key. testutil.Retry(t, 3, 2*time.Second, func(r *testutil.R) { cdnKeyName := fmt.Sprintf("projects/%s/locations/%s/cdnKeys/%s", tc.ProjectID, location, akamaiCdnKeyID) if err := getCdnKey(buf, tc.ProjectID, akamaiCdnKeyID); err != nil { r.Errorf("getCdnKey got err: %v", err) } if got := buf.String(); !strings.Contains(got, cdnKeyName) { r.Errorf("getCdnKey got\n----\n%v\n----\nWant to contain:\n----\n%v\n----\n", got, cdnKeyName) } }) // Delete the CDN key. testutil.Retry(t, 3, 2*time.Second, func(r *testutil.R) { if err := deleteCdnKey(buf, tc.ProjectID, akamaiCdnKeyID); err != nil { r.Errorf("deleteCdnKey got err: %v", err) } if got := buf.String(); !strings.Contains(got, deleteCdnKeyResponse) { r.Errorf("deleteCdnKey got\n----\n%v\n----\nWant to contain:\n----\n%v\n----\n", got, deleteCdnKeyResponse) } }) }
explode_data.jsonl/56005
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 2512 }
[ 2830, 3393, 34, 17395, 8850, 1155, 353, 8840, 836, 8, 341, 78255, 1669, 1273, 1314, 16620, 2271, 1155, 340, 26398, 1669, 609, 9651, 22622, 31483, 197, 322, 3393, 6505, 271, 197, 322, 10428, 279, 5085, 88365, 1376, 421, 432, 6724, 624, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestStress(t *testing.T) { var count int32 underTest := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { w.WriteHeader(http.StatusNoContent) atomic.AddInt32(&count, 1) })) defer underTest.Close() target := StressTest{ Name: "test", Target: underTest.URL, Method: "GET", Workers: 1, Sustain: time.Millisecond * 100, RequestsPerSecond: 10, } handler := Handler(context.TODO(), "test", "", "") apitest.Handler(handler).Get("/").Expect(t).Status(http.StatusOK).Body("no tests\n").End() apitest.Handler(handler).Post("/start-test").Body(toJson(t, target)).Expect(t).Status(http.StatusCreated).End() apitest.Handler(handler).Get("/").Expect(t).Status(http.StatusTooEarly).End() // multiply by 1.5 to account for the time required to compute the reports // in practice, this takes way less time time.Sleep(time.Duration(float64(target.Sustain) * 1.5)) apitest.Handler(handler).Get("/").Expect(t).Status(http.StatusOK).End() t.Logf("Total number of calls: %v", count) if count <= 0 { t.Fatal("Handler under test was not called") } }
explode_data.jsonl/269
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 462 }
[ 2830, 3393, 623, 673, 1155, 353, 8840, 836, 8, 341, 2405, 1760, 526, 18, 17, 198, 197, 7995, 2271, 1669, 54320, 70334, 7121, 5475, 19886, 89164, 18552, 3622, 1758, 37508, 11, 435, 353, 1254, 9659, 8, 341, 197, 6692, 69794, 19886, 1053...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestGetCredentialsPathWithSharedCredentialsFile(t *testing.T) { fname := filepath.Join("..", "..", "testdata", "credentials") if err := os.Setenv("AWS_SHARED_CREDENTIALS_FILE", fname); err != nil { t.Error("error occured in os.Setenv(\"AWS_SHARED_CREDENTIALS_FILE\")") } getCredentialsPath("") }
explode_data.jsonl/2447
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 126 }
[ 2830, 3393, 1949, 27025, 1820, 2354, 16997, 27025, 1703, 1155, 353, 8840, 836, 8, 341, 1166, 606, 1669, 26054, 22363, 95032, 497, 32213, 497, 330, 92425, 497, 330, 32353, 1138, 743, 1848, 1669, 2643, 4202, 3160, 445, 36136, 54718, 920, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestInitAndReleaseCache(t *testing.T) { dataDir := "/foo" _, err := InitCache(dataDir, TESTING_FEATURES, TESTING_CACHE_SIZE, TESTING_MEMORY_LIMIT) require.Error(t, err) tmpdir, err := ioutil.TempDir("", "wasmvm-testing") require.NoError(t, err) defer os.RemoveAll(tmpdir) cache, err := InitCache(tmpdir, TESTING_FEATURES, TESTING_CACHE_SIZE, TESTING_MEMORY_LIMIT) require.NoError(t, err) ReleaseCache(cache) }
explode_data.jsonl/62546
{ "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, 3803, 3036, 16077, 8233, 1155, 353, 8840, 836, 8, 341, 8924, 6184, 1669, 3521, 7975, 698, 197, 6878, 1848, 1669, 15690, 8233, 2592, 6184, 11, 95535, 30827, 50, 11, 95535, 29138, 4098, 11, 95535, 30048, 29194, 340, 17957, 614...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestTSPrivateIdentifiers(t *testing.T) { // The TypeScript compiler still moves private field initializers into the // constructor, but it has to leave the private field declaration in place so // the private field is still declared. expectPrintedTS(t, "class Foo { #foo }", "class Foo {\n #foo;\n}\n") expectPrintedTS(t, "class Foo { #foo = 1 }", "class Foo {\n constructor() {\n this.#foo = 1;\n }\n #foo;\n}\n") expectPrintedTS(t, "class Foo { #foo() {} }", "class Foo {\n #foo() {\n }\n}\n") expectPrintedTS(t, "class Foo { get #foo() {} }", "class Foo {\n get #foo() {\n }\n}\n") expectPrintedTS(t, "class Foo { set #foo(x) {} }", "class Foo {\n set #foo(x) {\n }\n}\n") // The TypeScript compiler doesn't currently support static private fields // because it moves static field initializers to after the class body and // private fields can't be used outside the class body. It remains to be seen // how the TypeScript compiler will transform private static fields once it // finally does support them. For now just leave the initializer in place. expectPrintedTS(t, "class Foo { static #foo }", "class Foo {\n static #foo;\n}\n") expectPrintedTS(t, "class Foo { static #foo = 1 }", "class Foo {\n static #foo = 1;\n}\n") expectPrintedTS(t, "class Foo { static #foo() {} }", "class Foo {\n static #foo() {\n }\n}\n") expectPrintedTS(t, "class Foo { static get #foo() {} }", "class Foo {\n static get #foo() {\n }\n}\n") expectPrintedTS(t, "class Foo { static set #foo(x) {} }", "class Foo {\n static set #foo(x) {\n }\n}\n") }
explode_data.jsonl/82315
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 550 }
[ 2830, 3393, 9951, 16787, 28301, 11836, 1155, 353, 8840, 836, 8, 341, 197, 322, 576, 87457, 19415, 2058, 10797, 869, 2070, 2856, 12230, 1119, 279, 198, 197, 322, 4692, 11, 714, 432, 702, 311, 5274, 279, 869, 2070, 18004, 304, 1992, 773...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestRowFunc(t *testing.T) { ctx := createContext(t) fc := funcs[ast.RowFunc] _, err := fc.getFunction(ctx, datumsToConstants(types.MakeDatums([]interface{}{"1", 1.2, true, 120}...))) require.NoError(t, err) }
explode_data.jsonl/19010
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 91 }
[ 2830, 3393, 3102, 9626, 1155, 353, 8840, 836, 8, 341, 20985, 1669, 83674, 1155, 340, 1166, 66, 1669, 76871, 58, 559, 14657, 9626, 921, 197, 6878, 1848, 1669, 25563, 670, 5152, 7502, 11, 3258, 6237, 1249, 9386, 52613, 50133, 45696, 6237,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestOnContainersUnableToTransitionStateForDesiredRunningTask(t *testing.T) { firstContainerName := "container1" firstContainer := &apicontainer.Container{ KnownStatusUnsafe: apicontainerstatus.ContainerCreated, DesiredStatusUnsafe: apicontainerstatus.ContainerRunning, Name: firstContainerName, } task := &managedTask{ Task: &apitask.Task{ Containers: []*apicontainer.Container{ firstContainer, }, DesiredStatusUnsafe: apitaskstatus.TaskRunning, }, } task.handleContainersUnableToTransitionState() assert.Equal(t, task.GetDesiredStatus(), apitaskstatus.TaskStopped) assert.Equal(t, task.Containers[0].GetDesiredStatus(), apicontainerstatus.ContainerStopped) }
explode_data.jsonl/24578
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 257 }
[ 2830, 3393, 1925, 74632, 17075, 1249, 21768, 1397, 2461, 4896, 2690, 18990, 6262, 1155, 353, 8840, 836, 8, 341, 42190, 4502, 675, 1669, 330, 3586, 16, 698, 42190, 4502, 1669, 609, 391, 51160, 1743, 33672, 515, 197, 39340, 4169, 2522, 78...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestRemoveStaleAndCommitPvtDataOfOldBlocksWithExpiry(t *testing.T) { ledgerid := "TestTxSimulatorMissingPvtdataExpiry" btlPolicy := btltestutil.SampleBTLPolicy( map[[2]string]uint64{ {"ns", "coll"}: 1, }, ) testEnv := testEnvsMap[levelDBtestEnvName] testEnv.init(t, ledgerid, btlPolicy) defer testEnv.cleanup() txMgr := testEnv.getTxMgr() populateCollConfigForTest(t, txMgr.(*LockBasedTxMgr), []collConfigkey{ {"ns", "coll"}, }, version.NewHeight(1, 1), ) bg, _ := testutil.NewBlockGenerator(t, ledgerid, false) // storing hashed data but the pvt key is missing // stored pvt key would get expired and purged while committing block 3 blkAndPvtdata := prepareNextBlockForTest(t, txMgr, bg, "txid-1", map[string]string{"pubkey1": "pub-value1"}, map[string]string{"pvtkey1": "pvt-value1"}, true) _, _, err := txMgr.ValidateAndPrepare(blkAndPvtdata, true) assert.NoError(t, err) // committing block 1 assert.NoError(t, txMgr.Commit()) // pvt data should not exist assert.False(t, testPvtKeyExist(t, txMgr, "ns", "coll", "pvtkey1")) // committing pvt data of block 1 v1 := []byte("pvt-value1") pvtDataBlk1Tx1 := producePvtdata(t, 1, []string{"ns:coll"}, []string{"pvtkey1"}, [][]byte{v1}) blocksPvtData := map[uint64][]*ledger.TxPvtData{ 1: { pvtDataBlk1Tx1, }, } err = txMgr.RemoveStaleAndCommitPvtDataOfOldBlocks(blocksPvtData) assert.NoError(t, err) // pvt data should exist assert.True(t, testPvtValueEqual(t, txMgr, "ns", "coll", "pvtkey1", v1)) // storing hashed data but the pvt key is missing // stored pvt key would get expired and purged while committing block 4 blkAndPvtdata = prepareNextBlockForTest(t, txMgr, bg, "txid-2", map[string]string{"pubkey2": "pub-value2"}, map[string]string{"pvtkey2": "pvt-value2"}, true) _, _, err = txMgr.ValidateAndPrepare(blkAndPvtdata, true) assert.NoError(t, err) // committing block 2 assert.NoError(t, txMgr.Commit()) // pvt data should not exist assert.False(t, testPvtKeyExist(t, txMgr, "ns", "coll", "pvtkey2")) blkAndPvtdata = prepareNextBlockForTest(t, txMgr, bg, "txid-3", map[string]string{"pubkey3": "pub-value3"}, nil, false) _, _, err = txMgr.ValidateAndPrepare(blkAndPvtdata, true) assert.NoError(t, err) // committing block 3 assert.NoError(t, txMgr.Commit()) // prepareForExpiringKey must have selected the pvtkey2 as it would // get expired during next block commit // committing pvt data of block 2 v2 := []byte("pvt-value2") pvtDataBlk2Tx1 := producePvtdata(t, 1, []string{"ns:coll"}, []string{"pvtkey2"}, [][]byte{v2}) blocksPvtData = map[uint64][]*ledger.TxPvtData{ 2: { pvtDataBlk2Tx1, }, } err = txMgr.RemoveStaleAndCommitPvtDataOfOldBlocks(blocksPvtData) assert.NoError(t, err) // pvt data should exist assert.True(t, testPvtValueEqual(t, txMgr, "ns", "coll", "pvtkey2", v2)) blkAndPvtdata = prepareNextBlockForTest(t, txMgr, bg, "txid-4", map[string]string{"pubkey4": "pub-value4"}, nil, false) _, _, err = txMgr.ValidateAndPrepare(blkAndPvtdata, true) assert.NoError(t, err) // committing block 4 and should purge pvtkey2 assert.NoError(t, txMgr.Commit()) assert.True(t, testPvtValueEqual(t, txMgr, "ns", "coll", "pvtkey2", nil)) }
explode_data.jsonl/63620
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1329 }
[ 2830, 3393, 13021, 623, 1574, 3036, 33441, 47, 9708, 1043, 2124, 18284, 4713, 16056, 840, 48209, 1155, 353, 8840, 836, 8, 341, 197, 50704, 307, 1669, 330, 2271, 31584, 14027, 10511, 25080, 47, 9708, 691, 840, 48209, 698, 2233, 11544, 13...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestOldTasksStatusChange(t *testing.T) { t.Parallel() gd, err := startDispatcher(DefaultConfig()) assert.NoError(t, err) defer gd.Close() var expectedSessionID string var nodeID string { stream, err := gd.Clients[0].Session(context.Background(), &api.SessionRequest{}) assert.NoError(t, err) defer stream.CloseSend() resp, err := stream.Recv() assert.NoError(t, err) assert.NotEmpty(t, resp.SessionID) expectedSessionID = resp.SessionID nodeID = resp.Node.ID } testTask1 := &api.Task{ NodeID: nodeID, ID: "testTask1", Status: api.TaskStatus{State: api.TaskStateAssigned}, DesiredState: api.TaskStateReady, } testTask2 := &api.Task{ NodeID: nodeID, ID: "testTask2", Status: api.TaskStatus{State: api.TaskStateAssigned}, DesiredState: api.TaskStateReady, } { // without correct SessionID should fail stream, err := gd.Clients[0].Tasks(context.Background(), &api.TasksRequest{}) assert.NoError(t, err) assert.NotNil(t, stream) resp, err := stream.Recv() assert.Nil(t, resp) assert.Error(t, err) assert.Equal(t, grpc.Code(err), codes.InvalidArgument) } stream, err := gd.Clients[0].Tasks(context.Background(), &api.TasksRequest{SessionID: expectedSessionID}) assert.NoError(t, err) time.Sleep(100 * time.Millisecond) resp, err := stream.Recv() assert.NoError(t, err) // initially no tasks assert.Equal(t, 0, len(resp.Tasks)) err = gd.Store.Update(func(tx store.Tx) error { assert.NoError(t, store.CreateTask(tx, testTask1)) assert.NoError(t, store.CreateTask(tx, testTask2)) return nil }) assert.NoError(t, err) resp, err = stream.Recv() assert.NoError(t, err) assert.Equal(t, len(resp.Tasks), 2) assert.True(t, resp.Tasks[0].ID == "testTask1" && resp.Tasks[1].ID == "testTask2" || resp.Tasks[0].ID == "testTask2" && resp.Tasks[1].ID == "testTask1") err = gd.Store.Update(func(tx store.Tx) error { assert.NoError(t, store.UpdateTask(tx, &api.Task{ ID: testTask1.ID, NodeID: nodeID, // only Status is changed for task1 Status: api.TaskStatus{State: api.TaskStateFailed, Err: "1234"}, DesiredState: api.TaskStateReady, })) return nil }) assert.NoError(t, err) // dispatcher shouldn't send snapshot for this update recvChan := make(chan struct{}) go func() { _, _ = stream.Recv() recvChan <- struct{}{} }() select { case <-recvChan: assert.Fail(t, "task.Status update should not trigger dispatcher update") case <-time.After(250 * time.Millisecond): } }
explode_data.jsonl/13860
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1042 }
[ 2830, 3393, 18284, 25449, 2522, 4072, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 2822, 3174, 67, 11, 1848, 1669, 1191, 21839, 87874, 2648, 2398, 6948, 35699, 1155, 11, 1848, 340, 16867, 32630, 10421, 2822, 2405, 3601, 5283, 915, 9...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestGasConsumptionBadTx(t *testing.T) { gasWanted := uint64(5) ante := func(ctx sdk.Context, tx sdk.Tx, simulate bool) (sdk.Context, error) { txTest := tx.(txTest) ctx.GasMeter().ConsumeGas(uint64(txTest.Counter), "counter-ante") if txTest.FailOnAnte { return ctx, sdkerrors.Wrap(sdkerrors.ErrUnauthorized, "ante handler failure") } return ctx, nil } txHandlerOpt := func(bapp *baseapp.BaseApp) { legacyRouter := middleware.NewLegacyRouter() r := sdk.NewRoute(routeMsgCounter, func(ctx sdk.Context, msg sdk.Msg) (*sdk.Result, error) { count := msg.(*msgCounter).Counter ctx.GasMeter().ConsumeGas(uint64(count), "counter-handler") return &sdk.Result{}, nil }) legacyRouter.AddRoute(r) txHandler := testTxHandler( middleware.TxHandlerOptions{ LegacyRouter: legacyRouter, MsgServiceRouter: middleware.NewMsgServiceRouter(encCfg.InterfaceRegistry), TxDecoder: testTxDecoder(encCfg.Amino), }, ante, ) bapp.SetTxHandler(txHandler) } app := setupBaseApp(t, txHandlerOpt) app.InitChain(abci.RequestInitChain{ ConsensusParams: &tmproto.ConsensusParams{ Block: &tmproto.BlockParams{ MaxGas: 9, }, }, }) app.InitChain(abci.RequestInitChain{}) header := tmproto.Header{Height: app.LastBlockHeight() + 1} app.BeginBlock(abci.RequestBeginBlock{Header: header}) tx := newTxCounter(5, 0) tx.GasLimit = gasWanted tx.setFailOnAnte(true) txBytes, err := encCfg.Amino.Marshal(tx) require.NoError(t, err) res := app.DeliverTx(abci.RequestDeliverTx{Tx: txBytes}) require.False(t, res.IsOK(), fmt.Sprintf("%v", res)) // require next tx to fail due to black gas limit tx = newTxCounter(5, 0) txBytes, err = encCfg.Amino.Marshal(tx) require.NoError(t, err) res = app.DeliverTx(abci.RequestDeliverTx{Tx: txBytes}) require.False(t, res.IsOK(), fmt.Sprintf("%v", res)) }
explode_data.jsonl/30045
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 770 }
[ 2830, 3393, 58728, 41966, 560, 17082, 31584, 1155, 353, 8840, 836, 8, 341, 3174, 300, 54, 7566, 1669, 2622, 21, 19, 7, 20, 340, 197, 4942, 1669, 2915, 7502, 45402, 9328, 11, 9854, 45402, 81362, 11, 37453, 1807, 8, 320, 51295, 9328, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestBundlerClientAuth(t *testing.T) { b, err := NewBundler("testdata/client-auth/root.pem", "testdata/client-auth/int.pem") if err != nil { t.Fatal(err) } for _, leafFile := range []string{"testdata/client-auth/leaf-server.pem", "testdata/client-auth/leaf-client.pem"} { if _, err := b.BundleFromFile(leafFile, "", Optimal, ""); err != nil { t.Fatal(err) } } }
explode_data.jsonl/36893
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 162 }
[ 2830, 3393, 33, 85365, 2959, 5087, 1155, 353, 8840, 836, 8, 341, 2233, 11, 1848, 1669, 1532, 33, 85365, 445, 92425, 25085, 33503, 72074, 49373, 497, 330, 92425, 25085, 33503, 31114, 49373, 1138, 743, 1848, 961, 2092, 341, 197, 3244, 261...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestRelease(t *testing.T) { type testcase struct { begin, reserve bool expectedQueries []string err bool } tests := []testcase{{ begin: true, reserve: false, expectedQueries: []string{"rollback"}, }, { begin: true, reserve: true, }, { begin: false, reserve: true, }, { begin: false, reserve: false, err: true, }} for i, test := range tests { name := fmt.Sprintf("%d", i) if test.begin { name += " begin" } if test.reserve { name += " reserve" } t.Run(name, func(t *testing.T) { db, tsv := setupTabletServerTest(t, "") defer tsv.StopService() defer db.Close() db.AddQueryPattern(".*", &sqltypes.Result{}) target := querypb.Target{TabletType: topodatapb.TabletType_PRIMARY} var err error var transactionID, reservedID int64 switch { case test.begin && test.reserve: _, transactionID, reservedID, _, err = tsv.ReserveBeginExecute(ctx, &target, []string{"select 1212"}, nil, "select 42", nil, &querypb.ExecuteOptions{}) require.NotEqual(t, int64(0), transactionID) require.NotEqual(t, int64(0), reservedID) case test.begin: _, transactionID, _, err = tsv.BeginExecute(ctx, &target, nil, "select 42", nil, 0, &querypb.ExecuteOptions{}) require.NotEqual(t, int64(0), transactionID) case test.reserve: _, reservedID, _, err = tsv.ReserveExecute(ctx, &target, nil, "select 42", nil, 0, &querypb.ExecuteOptions{}) require.NotEqual(t, int64(0), reservedID) } require.NoError(t, err) db.ResetQueryLog() err = tsv.Release(ctx, &target, transactionID, reservedID) if test.err { require.Error(t, err) } else { require.NoError(t, err) } assert.Contains(t, db.QueryLog(), strings.Join(test.expectedQueries, ";"), "expected queries to run") }) } }
explode_data.jsonl/80027
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 792 }
[ 2830, 3393, 16077, 1155, 353, 8840, 836, 8, 341, 13158, 70080, 2036, 341, 197, 80431, 11, 20499, 220, 1807, 198, 197, 42400, 55261, 3056, 917, 198, 197, 9859, 1797, 1807, 198, 197, 630, 78216, 1669, 3056, 1944, 5638, 90, 515, 197, 804...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 Test_canAttendMeetings(t *testing.T) { type args struct { intervals [][]int } tests := []struct { name string args args want bool }{ { name: "equal", args: args{ intervals: [][]int{{0, 30}, {5, 10}, {15, 20}}, }, want: false, }, { name: "equal", args: args{ intervals: [][]int{{7, 10}, {2, 4}}, }, want: true, }, { name: "equal", args: args{ intervals: [][]int{{8, 11}, {17, 20}, {17, 20}}, }, want: false, }, { name: "equal", args: args{ intervals: [][]int{{13, 15}, {1, 13}}, }, want: true, }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { if got := canAttendMeetings(tt.args.intervals); got != tt.want { t.Errorf("canAttendMeetings() = %v, want %v", got, tt.want) } if got := canAttendMeetingsO2(tt.args.intervals); got != tt.want { t.Errorf("canAttendMeetings() = %v, want %v", got, tt.want) } }) } }
explode_data.jsonl/38410
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 484 }
[ 2830, 3393, 27421, 98268, 40551, 819, 1155, 353, 8840, 836, 8, 341, 13158, 2827, 2036, 341, 197, 2084, 42198, 52931, 396, 198, 197, 532, 78216, 1669, 3056, 1235, 341, 197, 11609, 914, 198, 197, 31215, 2827, 198, 197, 50780, 1807, 198, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestHappyHealthCheck(t *testing.T) { draftContentRW := mockHealthyExternalService() cAPI := mockHealthyExternalService() liveBlogPost := mockHealthyExternalService() h, err := NewHealthService("", "", "", draftContentRW, cAPI, &mockConfig, []ExternalService{liveBlogPost}) assert.NoError(t, err) req := httptest.NewRequest("GET", "/__health", nil) w := httptest.NewRecorder() h.HealthCheckHandleFunc()(w, req) resp := w.Result() assert.Equal(t, http.StatusOK, resp.StatusCode) hcBody := make(map[string]interface{}) err = json.NewDecoder(resp.Body).Decode(&hcBody) assert.NoError(t, err) assert.Len(t, hcBody["checks"], 3) assert.True(t, hcBody["ok"].(bool)) checks := hcBody["checks"].([]interface{}) for _, c := range checks { check := c.(map[string]interface{}) assert.True(t, check["ok"].(bool)) if check["id"] == "check-content-api-health" { assert.Equal(t, "Content API is good-to-go", check["checkOutput"]) assert.Equal(t, "Content API is not available at http://cool.api.ft.com/content", check["technicalSummary"]) } } cAPI.AssertExpectations(t) }
explode_data.jsonl/2301
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 409 }
[ 2830, 3393, 32847, 14542, 3973, 1155, 353, 8840, 836, 8, 341, 2698, 2944, 2762, 56368, 1669, 7860, 96113, 25913, 1860, 741, 1444, 7082, 1669, 7860, 96113, 25913, 1860, 741, 8810, 533, 26700, 4133, 1669, 7860, 96113, 25913, 1860, 2822, 959...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestMutationTx(t *testing.T) { ctx := context.Background() client := enttest.Open(t, "sqlite3", "file:ent?mode=memory&cache=shared&_fk=1", enttest.WithMigrateOptions(migrate.WithGlobalUniqueID(true))) defer client.Close() client.Card.Use(func(next ent.Mutator) ent.Mutator { return hook.CardFunc(func(ctx context.Context, m *ent.CardMutation) (ent.Value, error) { tx, err := m.Tx() if err != nil { return nil, err } if err := tx.Rollback(); err != nil { return nil, err } return nil, fmt.Errorf("rolled back") }) }) tx, err := client.Tx(ctx) require.NoError(t, err) a8m := tx.User.Create().SetName("a8m").SaveX(ctx) crd, err := tx.Card.Create().SetNumber("1234").SetOwner(a8m).Save(ctx) require.EqualError(t, err, "rolled back") require.Nil(t, crd) _, err = tx.Card.Query().All(ctx) require.Error(t, err, "tx already rolled back") }
explode_data.jsonl/36048
{ "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, 53998, 31584, 1155, 353, 8840, 836, 8, 341, 20985, 1669, 2266, 19047, 741, 25291, 1669, 1197, 1944, 12953, 1155, 11, 330, 37042, 18, 497, 330, 1192, 25, 306, 30, 8516, 28, 17269, 5, 9360, 28, 6100, 85047, 41718, 28, 16, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestGetName(t *testing.T) { url := &motan.URL{Port: 8989, Protocol: "motan2"} url.PutParam(motan.TimeOutKey, "100") ep := &MotanEndpoint{} ep.SetURL(url) ep.SetProxy(true) ep.SetSerialization(&serialize.SimpleSerialization{}) ep.Initialize() fmt.Printf("format\n") request := &motan.MotanRequest{ServiceName: "test", Method: "test"} request.Attachment = motan.NewStringMap(0) res := ep.Call(request) fmt.Printf("res:%+v\n", res) }
explode_data.jsonl/52239
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 184 }
[ 2830, 3393, 49403, 1155, 353, 8840, 836, 8, 341, 19320, 1669, 609, 46828, 276, 20893, 90, 7084, 25, 220, 23, 24, 23, 24, 11, 24572, 25, 330, 46828, 276, 17, 16707, 19320, 39825, 2001, 1255, 354, 276, 16299, 2662, 1592, 11, 330, 16, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func Test_Setter(t *testing.T) { c1 := NewLidi(Settings{}) a := &A{"awesome"} b := &B{} if err := c1.Provide(a); err != nil { t.Fatal(err) } if err := c1.Provide(b); err != nil { t.Fatal(err) } if err := c1.InvokeFunction(func(b *B) { if b.a.test != "awesome" { t.Fatal("Not Equal") } }); err != nil { t.Fatal(err) } }
explode_data.jsonl/40208
{ "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, 14812, 465, 1155, 353, 8840, 836, 8, 341, 1444, 16, 1669, 1532, 43, 12278, 57395, 6257, 692, 11323, 1669, 609, 32, 4913, 16875, 16707, 2233, 1669, 609, 33, 31483, 743, 1848, 1669, 272, 16, 7763, 19448, 2877, 1215, 1848, 96...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestMap_ReadDir(t *testing.T) { fs := Map(map[string][]byte{ "foo/bar/three.txt": []byte("333"), "foo/bar.txt": []byte("22"), "top.txt": []byte("top.txt file"), "other-top.txt": []byte("other-top.txt file"), }) tests := []struct { dir string want []os.FileInfo }{ { dir: "", want: []os.FileInfo{ dirInfo("foo"), fileInfo{"other-top.txt", int64(len("other-top.txt file"))}, fileInfo{"top.txt", int64(len("top.txt file"))}, }, }, { dir: "foo", want: []os.FileInfo{ dirInfo("bar"), fileInfo{"bar.txt", 2}, }, }, { dir: "foo/", want: []os.FileInfo{ dirInfo("bar"), fileInfo{"bar.txt", 2}, }, }, { dir: "foo/bar", want: []os.FileInfo{ fileInfo{"three.txt", 3}, }, }, } for _, leadingSlashOrEmpty := range []string{"", "/"} { for _, tt := range tests { path := leadingSlashOrEmpty + tt.dir if path == "" { continue } fis, err := fs.ReadDir(nil, path) if err != nil { t.Errorf("ReadDir(%q) = %v", path, err) continue } if !reflect.DeepEqual(fis, tt.want) { t.Errorf("ReadDir(%q) = %#v; want %#v", path, fis, tt.want) continue } } if _, err := fs.ReadDir(nil, leadingSlashOrEmpty+"xxxx"); !os.IsNotExist(err) { t.Errorf("ReadDir %q = %v; want os.IsNotExist error", leadingSlashOrEmpty+"xxxx", err) } } }
explode_data.jsonl/42382
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 688 }
[ 2830, 3393, 2227, 38381, 6184, 1155, 353, 8840, 836, 8, 341, 53584, 1669, 5027, 9147, 14032, 45725, 3782, 515, 197, 197, 1, 7975, 49513, 20439, 765, 3909, 788, 3056, 3782, 445, 18, 18, 18, 4461, 197, 197, 1, 7975, 49513, 3909, 788, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestNullState(t *testing.T) { nul := &null{} require.Equal(t, "null", nul.Name()) require.False(t, nul.CanTransitionTo(nul)) require.True(t, nul.CanTransitionTo(&invited{})) require.True(t, nul.CanTransitionTo(&requested{})) require.False(t, nul.CanTransitionTo(&responded{})) require.False(t, nul.CanTransitionTo(&completed{})) }
explode_data.jsonl/2085
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 143 }
[ 2830, 3393, 3280, 1397, 1155, 353, 8840, 836, 8, 341, 9038, 360, 1669, 609, 2921, 16094, 17957, 12808, 1155, 11, 330, 2921, 497, 308, 360, 2967, 2398, 17957, 50757, 1155, 11, 308, 360, 53280, 21768, 1249, 1445, 360, 1171, 17957, 32443, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestBatchUpdateBadRequest(t *testing.T) { ts := httptest.NewServer( http.HandlerFunc( func(w http.ResponseWriter, r *http.Request) { w.Header().Set("Content-Type", "application/json") w.WriteHeader(http.StatusBadRequest) fmt.Fprintf(w, `{"error":"ParseError","description":"Errors found in incoming JSON buffer"}`) })) defer ts.Close() cli, err := client.NewNgsiV2Client(client.SetUrl(ts.URL)) if err != nil { t.Fatalf("Unexpected error: '%v'", err) } if err := cli.BatchUpdate(&model.BatchUpdate{}); err == nil { t.Fatal("Expected an error") } }
explode_data.jsonl/64652
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 232 }
[ 2830, 3393, 21074, 4289, 46015, 1155, 353, 8840, 836, 8, 341, 57441, 1669, 54320, 70334, 7121, 5475, 1006, 197, 28080, 89164, 1006, 298, 29244, 3622, 1758, 37508, 11, 435, 353, 1254, 9659, 8, 341, 571, 6692, 15753, 1005, 1649, 445, 2762...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestApp01myCustomerHndlrRowLastPrev(t *testing.T) { var td *TestData_App01myCustomer t.Logf("TestCustomer.RowPrev()...\n") td = &TestData_App01myCustomer{} td.Setup(t) t.Logf("TestCustomer.RowPrev() - End of Test\n\n\n") }
explode_data.jsonl/63217
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 116 }
[ 2830, 3393, 2164, 15, 16, 2408, 12792, 39, 303, 19018, 3102, 5842, 33528, 1155, 353, 8840, 836, 8, 341, 262, 762, 17941, 688, 353, 83920, 36117, 15, 16, 2408, 12792, 271, 262, 259, 98954, 445, 2271, 12792, 14657, 33528, 368, 30801, 77...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestNumeronymsOutput(t *testing.T) { testCases := map[string]struct { input []string expected []string }{ "single string short": {input: []string{"abc"}, expected: []string{"abc"}}, "single string long": {input: []string{"abcdef"}, expected: []string{"a4f"}}, "multiple strings": {input: []string{"international", "help", "welcome"}, expected: []string{"i11l", "h2p", "w5e"}}, "empty string": {input: []string{""}, expected: []string{""}}, "string containing non-alphabet": {input: []string{"abs12ab"}, expected: []string{"a5b"}}, "non-alphabet only": {input: []string{"123124"}, expected: []string{"144"}}, "single emoji": {input: []string{"😀"}, expected: []string{"😀"}}, "alphabet + emoji": {input: []string{"a😀bc"}, expected: []string{"a2c"}}, } for name, test := range testCases { test := test name := name t.Run(name, func(t *testing.T) { actual := numeronyms(test.input...) assert.Equalf(t, actual, test.expected, "Unexpected output for %v\nexpected: %v,\nactual: %v", name, test.expected, actual) }) } }
explode_data.jsonl/48792
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 420 }
[ 2830, 3393, 67737, 45603, 5097, 1155, 353, 8840, 836, 8, 341, 18185, 37302, 1669, 2415, 14032, 60, 1235, 341, 197, 22427, 262, 3056, 917, 198, 197, 42400, 3056, 917, 198, 197, 59403, 197, 197, 1, 15338, 914, 2805, 788, 314, 1355, 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 TestInvitedState(t *testing.T) { inv := &invited{} require.Equal(t, "invited", inv.Name()) require.False(t, inv.CanTransitionTo(&null{})) require.False(t, inv.CanTransitionTo(inv)) require.True(t, inv.CanTransitionTo(&requested{})) require.False(t, inv.CanTransitionTo(&responded{})) require.False(t, inv.CanTransitionTo(&completed{})) }
explode_data.jsonl/2086
{ "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, 15174, 1608, 1397, 1155, 353, 8840, 836, 8, 341, 197, 14057, 1669, 609, 14057, 1608, 16094, 17957, 12808, 1155, 11, 330, 14057, 1608, 497, 1529, 2967, 2398, 17957, 50757, 1155, 11, 1529, 53280, 21768, 1249, 2099, 2921, 6257, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestFileChooserShouldEmitEvent(t *testing.T) { BeforeEach(t) defer AfterEach(t) _, err := page.Goto(server.EMPTY_PAGE) require.NoError(t, err) require.NoError(t, page.SetContent("<input type=file>")) fileChooser, err := page.ExpectFileChooser(func() error { return page.Click("input") }) require.NoError(t, err) require.False(t, fileChooser.IsMultiple()) require.Equal(t, page, fileChooser.Page()) elementHTML, err := fileChooser.Element().InnerHTML() require.NoError(t, err) inputElement, err := page.QuerySelector("input") require.NoError(t, err) inputElementHTML, err := inputElement.InnerHTML() require.NoError(t, err) require.Equal(t, elementHTML, inputElementHTML) require.NoError(t, fileChooser.SetFiles([]playwright.InputFile{ { Name: "file-to-upload.txt", MimeType: "text/plain", Buffer: []byte("123"), }, })) fileName, err := page.Evaluate("e => e.files[0].name", inputElement) require.NoError(t, err) require.Equal(t, "file-to-upload.txt", fileName) }
explode_data.jsonl/39917
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 396 }
[ 2830, 3393, 72282, 14996, 36, 1763, 1556, 1155, 353, 8840, 836, 8, 341, 197, 87275, 1155, 340, 16867, 4636, 4854, 1155, 340, 197, 6878, 1848, 1669, 2150, 1224, 2072, 21421, 48377, 19971, 340, 17957, 35699, 1155, 11, 1848, 340, 17957, 35...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestDial(t *testing.T) { tests := []struct { name string host string addrs []string resolveError string expectedError string expectedAddress string }{ { name: noSuchHost, host: "testing123", resolveError: noSuchHost, expectedError: noSuchHost, }, { name: "empty addrs", host: "testing123", expectedError: noSuchHost, }, { name: "single address", host: "testing123", addrs: []string{"127.0.0.1"}, expectedAddress: "127.0.0.1", }, { name: "multiple address", host: "testing123", addrs: []string{"127.0.0.1", "127.0.0.2", "127.0.0.3", "127.0.0.4"}, expectedAddress: "127.0.0.3", }, { name: "ip", host: "127.0.0.1", expectedAddress: "127.0.0.1", }, } // set seed so we get same addresses rand.Seed(0) for _, test := range tests { test := test t.Run(test.name, func(t *testing.T) { r := &testResolver{ addrs: test.addrs, } if test.resolveError != "" { r.err = errors.New(test.resolveError) } c := New( WithTTL(time.Hour), WithDialer(&testDialer{}), WithResolver(r), ) // run multiple times to ensure we use cache for i := 0; i < 2; i++ { conn, err := c.Dial("tcp", test.host) if test.expectedError != "" { require.Error(t, err) require.Contains(t, err.Error(), test.expectedError) continue } require.NoError(t, err) tc, ok := conn.(*testConn) require.True(t, ok) require.Equal(t, test.expectedAddress, tc.address) } }) } }
explode_data.jsonl/5942
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 871 }
[ 2830, 3393, 35, 530, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 3056, 1235, 341, 197, 11609, 310, 914, 198, 197, 63104, 310, 914, 198, 197, 12718, 5428, 1843, 3056, 917, 198, 197, 87778, 1454, 262, 914, 198, 197, 42400, 1454, 256, 9...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
4
func TestDockerHostConfigRawConfig(t *testing.T) { rawHostConfigInput := dockercontainer.HostConfig{ Privileged: true, ReadonlyRootfs: true, DNS: []string{"dns1, dns2"}, DNSSearch: []string{"dns.search"}, ExtraHosts: []string{"extra:hosts"}, SecurityOpt: []string{"foo", "bar"}, Resources: dockercontainer.Resources{ CPUShares: 2, Ulimits: []*units.Ulimit{{Name: "ulimit name", Soft: 10, Hard: 100}}, }, LogConfig: dockercontainer.LogConfig{ Type: "foo", Config: map[string]string{"foo": "bar"}, }, } rawHostConfig, err := json.Marshal(&rawHostConfigInput) if err != nil { t.Fatal(err) } testTask := &Task{ Arn: "arn:aws:ecs:us-east-1:012345678910:task/c09f0188-7f87-4b0f-bfc3-16296622b6fe", Family: "myFamily", Version: "1", Containers: []*apicontainer.Container{ { Name: "c1", DockerConfig: apicontainer.DockerConfig{ HostConfig: strptr(string(rawHostConfig)), }, }, }, } config, configErr := testTask.DockerHostConfig(testTask.Containers[0], dockerMap(testTask), defaultDockerClientAPIVersion, &config.Config{}) assert.Nil(t, configErr) expectedOutput := rawHostConfigInput expectedOutput.CPUPercent = minimumCPUPercent if runtime.GOOS == "windows" { // CPUShares will always be 0 on windows expectedOutput.CPUShares = 0 } assertSetStructFieldsEqual(t, expectedOutput, *config) }
explode_data.jsonl/37185
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 590 }
[ 2830, 3393, 35, 13659, 9296, 2648, 20015, 2648, 1155, 353, 8840, 836, 8, 341, 76559, 9296, 2648, 2505, 1669, 26588, 3586, 29840, 2648, 515, 197, 197, 32124, 68431, 25, 257, 830, 345, 197, 96043, 3243, 8439, 3848, 25, 830, 345, 197, 10...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestAddWrapper(t *testing.T) { t.Parallel() p, _, cleanup := currentTestConfig.Provider(t) defer cleanup() sw, ok := p.(*CSP) assert.True(t, ok) tester := func(o interface{}, getter func(t reflect.Type) (interface{}, bool)) { tt := reflect.TypeOf(o) err := sw.AddWrapper(tt, o) assert.NoError(t, err) o2, ok := getter(tt) assert.True(t, ok) assert.Equal(t, o, o2) } tester(&mocks.KeyGenerator{}, func(t reflect.Type) (interface{}, bool) { o, ok := sw.KeyGenerators[t]; return o, ok }) tester(&mocks.KeyDeriver{}, func(t reflect.Type) (interface{}, bool) { o, ok := sw.KeyDerivers[t]; return o, ok }) tester(&mocks.KeyImporter{}, func(t reflect.Type) (interface{}, bool) { o, ok := sw.KeyImporters[t]; return o, ok }) tester(&mocks.Encryptor{}, func(t reflect.Type) (interface{}, bool) { o, ok := sw.Encryptors[t]; return o, ok }) tester(&mocks.Decryptor{}, func(t reflect.Type) (interface{}, bool) { o, ok := sw.Decryptors[t]; return o, ok }) tester(&mocks.Signer{}, func(t reflect.Type) (interface{}, bool) { o, ok := sw.Signers[t]; return o, ok }) tester(&mocks.Verifier{}, func(t reflect.Type) (interface{}, bool) { o, ok := sw.Verifiers[t]; return o, ok }) tester(&mocks.Hasher{}, func(t reflect.Type) (interface{}, bool) { o, ok := sw.Hashers[t]; return o, ok }) // Add invalid wrapper err := sw.AddWrapper(reflect.TypeOf(cleanup), cleanup) assert.Error(t, err) assert.Equal(t, err.Error(), "wrapper type not valid, must be on of: KeyGenerator, KeyDeriver, KeyImporter, Encryptor, Decryptor, Signer, Verifier, Hasher") }
explode_data.jsonl/29292
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 610 }
[ 2830, 3393, 2212, 11542, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 741, 3223, 11, 8358, 21290, 1669, 1482, 2271, 2648, 36208, 1155, 340, 16867, 21290, 2822, 77295, 11, 5394, 1669, 281, 41399, 34, 4592, 340, 6948, 32443, 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 TestGetSetLien(t *testing.T) { ctx, _, _, _, keeper := makeTestKit().expand() // Empty l1 := keeper.GetLien(ctx, addr1) if !l1.GetCoins().IsZero() { t.Errorf("empty lien has %v, want empty", l1) } // Initialize amt := ubld(123) lien := types.Lien{Coins: amt} keeper.SetLien(ctx, addr1, lien) l2 := keeper.GetLien(ctx, addr1) if !l2.Coins.IsEqual(amt) { t.Errorf("initial lien has %v, want %s", l2, amt) } // Delete keeper.SetLien(ctx, addr1, types.Lien{}) l3 := keeper.GetLien(ctx, addr1) if !l3.Coins.IsZero() { t.Errorf("zeroed lien has %v, want empty", l3) } }
explode_data.jsonl/40987
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 281 }
[ 2830, 3393, 1949, 1649, 43, 3591, 1155, 353, 8840, 836, 8, 341, 20985, 11, 8358, 8358, 8358, 53416, 1669, 1281, 2271, 7695, 1005, 32317, 2822, 197, 322, 22228, 198, 8810, 16, 1669, 53416, 2234, 43, 3591, 7502, 11, 10789, 16, 340, 743,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestHasBlock(t *testing.T) { bc := newTestChain(t) blocks, err := bc.genBlocks(50) require.NoError(t, err) // Test unpersisted and persisted access for j := 0; j < 2; j++ { for i := 0; i < len(blocks); i++ { assert.True(t, bc.HasBlock(blocks[i].Hash())) } newBlock := bc.newBlock() assert.False(t, bc.HasBlock(newBlock.Hash())) assert.NoError(t, bc.persist()) } }
explode_data.jsonl/74541
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 164 }
[ 2830, 3393, 10281, 4713, 1155, 353, 8840, 836, 8, 341, 2233, 66, 1669, 501, 2271, 18837, 1155, 340, 2233, 34936, 11, 1848, 1669, 17916, 22822, 29804, 7, 20, 15, 340, 17957, 35699, 1155, 11, 1848, 692, 197, 322, 3393, 21624, 4975, 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...
3
func TestGrpc_GetChainConfig(t *testing.T) { cfg, err := g.GetChainConfig(getOkCtx(), nil) assert.NoError(t, err) assert.Equal(t, types.DefaultCoinPrecision, cfg.GetCoinPrecision()) }
explode_data.jsonl/345
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 72 }
[ 2830, 3393, 6464, 3992, 13614, 18837, 2648, 1155, 353, 8840, 836, 8, 341, 50286, 11, 1848, 1669, 342, 2234, 18837, 2648, 5433, 11578, 23684, 1507, 2092, 340, 6948, 35699, 1155, 11, 1848, 340, 6948, 12808, 1155, 11, 4494, 13275, 41180, 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
func TestSequenceFormatter(t *testing.T) { mutex := &sync.Mutex{} results := map[string]struct{}{} ready := &sync.WaitGroup{} ready.Add(100) finished := &sync.WaitGroup{} finished.Add(100) fabenc.SetSequence(0) for i := 1; i <= 100; i++ { go func(i int) { buf := &bytes.Buffer{} entry := zapcore.Entry{Level: zapcore.DebugLevel} f := fabenc.SequenceFormatter{FormatVerb: "%d"} ready.Done() // setup complete ready.Wait() // wait for all go routines to be ready f.Format(buf, entry, nil) // format concurrently mutex.Lock() results[buf.String()] = struct{}{} mutex.Unlock() finished.Done() }(i) } finished.Wait() for i := 1; i <= 100; i++ { assert.Contains(t, results, strconv.Itoa(i)) } }
explode_data.jsonl/10936
{ "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, 14076, 14183, 1155, 353, 8840, 836, 8, 341, 42622, 1669, 609, 12996, 99014, 16094, 55497, 1669, 2415, 14032, 60, 1235, 6257, 31483, 197, 2307, 1669, 609, 12996, 28384, 2808, 16094, 197, 2307, 1904, 7, 16, 15, 15, 692, 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...
1
func TestWaitIPAddresses(t *testing.T) { if !unprivileged() { t.Skip("skipping test in privileged mode.") } c, err := NewContainer(ContainerName) if err != nil { t.Errorf(err.Error()) } if _, err := c.WaitIPAddresses(30 * time.Second); err != nil { t.Errorf(err.Error()) } }
explode_data.jsonl/2752
{ "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, 14190, 3298, 52290, 1155, 353, 8840, 836, 8, 341, 743, 753, 359, 97288, 368, 341, 197, 3244, 57776, 445, 4886, 5654, 1273, 304, 46261, 3856, 13053, 197, 630, 1444, 11, 1848, 1669, 1532, 4502, 75145, 675, 340, 743, 1848, 96...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
4
func TestHistogramDataPoint_StartTimestamp(t *testing.T) { ms := NewHistogramDataPoint() assert.EqualValues(t, Timestamp(0), ms.StartTimestamp()) testValStartTimestamp := Timestamp(1234567890) ms.SetStartTimestamp(testValStartTimestamp) assert.EqualValues(t, testValStartTimestamp, ms.StartTimestamp()) }
explode_data.jsonl/32735
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 104 }
[ 2830, 3393, 77210, 1043, 2609, 38056, 20812, 1155, 353, 8840, 836, 8, 341, 47691, 1669, 1532, 77210, 1043, 2609, 741, 6948, 12808, 6227, 1155, 11, 32758, 7, 15, 701, 9829, 12101, 20812, 2398, 18185, 2208, 3479, 20812, 1669, 32758, 7, 16...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestCodecDecode(t *testing.T) { sourceUrl, _ := url.Parse("http://example.com/source") source := &types.URLRef{URL: *sourceUrl} testCases := map[string]struct { codec amqp.Codec msg *amqp.Message want *cloudevents.Event wantErr error }{ "simple v2 structured": { codec: amqp.Codec{Encoding: amqp.StructuredV02}, msg: &amqp.Message{ ContentType: cloudevents.ApplicationCloudEventsJSON, Body: func() []byte { body := map[string]interface{}{ "specversion": "0.2", "id": "ABC-123", "type": "com.example.test", "source": "http://example.com/source", } return toBytes(body) }(), }, want: &cloudevents.Event{ Context: &cloudevents.EventContextV02{ SpecVersion: cloudevents.CloudEventsVersionV02, Type: "com.example.test", Source: *source, ID: "ABC-123", }, }, }, "simple v3 structured": { codec: amqp.Codec{Encoding: amqp.StructuredV03}, msg: &amqp.Message{ ContentType: cloudevents.ApplicationCloudEventsJSON, Body: func() []byte { body := map[string]interface{}{ "specversion": "0.3", "id": "ABC-123", "type": "com.example.test", "source": "http://example.com/source", "subject": "a-subject", } return toBytes(body) }(), }, want: &cloudevents.Event{ Context: &cloudevents.EventContextV03{ SpecVersion: cloudevents.CloudEventsVersionV03, Type: "com.example.test", Source: *source, ID: "ABC-123", Subject: strptr("a-subject"), }, }, }, "binary v3 with nil attribute": { codec: amqp.Codec{Encoding: amqp.BinaryV03}, msg: &amqp.Message{ ContentType: cloudevents.ApplicationJSON, ApplicationProperties: map[string]interface{}{ "cloudEvents:specversion": "0.3", "cloudEvents:type": "com.example.test", "cloudEvents:source": "http://example.com/source", "cloudEvents:subject": "mySubject", "cloudEvents:id": "123myID", "cloudEvents:cause": nil, }, Body: func() []byte { bytes, _ := json.Marshal(DataExample{ AnInt: 42, AString: "testing", }) return bytes }(), }, want: &cloudevents.Event{ Context: &cloudevents.EventContextV03{ SpecVersion: cloudevents.CloudEventsVersionV03, Type: "com.example.test", Source: *source, Subject: strptr("mySubject"), ID: "123myID", }, Data: func() []byte { bytes, _ := json.Marshal(DataExample{ AnInt: 42, AString: "testing", }) return bytes }(), DataEncoded: true, }, }, } for n, tc := range testCases { t.Run(n, func(t *testing.T) { got, err := tc.codec.Decode(context.TODO(), tc.msg) if tc.wantErr != nil || err != nil { if diff := cmp.Diff(tc.wantErr, err); diff != "" { t.Errorf("unexpected error (-want, +got) = %v", diff) } return } if diff := cmp.Diff(tc.want, got); diff != "" { t.Errorf("unexpected event (-want, +got) = %v", diff) } }) } }
explode_data.jsonl/10762
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1554 }
[ 2830, 3393, 36913, 32564, 1155, 353, 8840, 836, 8, 341, 47418, 2864, 11, 716, 1669, 2515, 8937, 445, 1254, 1110, 8687, 905, 54373, 1138, 47418, 1669, 609, 9242, 20893, 3945, 90, 3144, 25, 353, 2427, 2864, 630, 18185, 37302, 1669, 2415, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestGetDefaultBasePath(t *testing.T) { testCases := map[string]struct { value string expectValue string }{ "Missing env variable": { value: "", expectValue: defaultBasePath, }, "Present env variable with value": { value: "value1", expectValue: "value1", }, "Present env variable with whitespaces": { value: " ", expectValue: defaultBasePath, }, } for k, v := range testCases { v := v t.Run(k, func(t *testing.T) { if len(v.value) != 0 { os.Setenv(string(ProvisionerBasePath), v.value) } actualValue := getDefaultBasePath() if !reflect.DeepEqual(actualValue, v.expectValue) { t.Errorf("expected %s got %s", v.expectValue, actualValue) } os.Unsetenv(string(ProvisionerBasePath)) }) } }
explode_data.jsonl/30412
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 343 }
[ 2830, 3393, 1949, 3675, 3978, 1820, 1155, 353, 8840, 836, 8, 341, 18185, 37302, 1669, 2415, 14032, 60, 1235, 341, 197, 16309, 981, 914, 198, 197, 24952, 1130, 914, 198, 197, 59403, 197, 197, 1, 25080, 6105, 3890, 788, 341, 298, 16309,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_parseFromFlag(t *testing.T) { type args struct { from []string } tests := []struct { name string args args want []config.SupplierConfig wantErr bool }{ { name: "test complete from parsing", args: args{ from: []string{"tfstate+s3://bucket/path/to/state.tfstate"}, }, want: []config.SupplierConfig{ { Key: "tfstate", Backend: "s3", Path: "bucket/path/to/state.tfstate", }, }, wantErr: false, }, { name: "test complete from parsing with multiples flags", args: args{ from: []string{"tfstate+s3://bucket/path/to/state.tfstate", "tfstate:///tmp/my-state.tfstate"}, }, want: []config.SupplierConfig{ { Key: "tfstate", Backend: "s3", Path: "bucket/path/to/state.tfstate", }, { Key: "tfstate", Backend: "", Path: "/tmp/my-state.tfstate", }, }, wantErr: false, }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { got, err := parseFromFlag(tt.args.from) if (err != nil) != tt.wantErr { t.Errorf("parseFromFlag() error = %v, err %v", err, tt.wantErr) return } if !reflect.DeepEqual(got, tt.want) { t.Errorf("parseFromFlag() got = %v, want %v", got, tt.want) } }) } }
explode_data.jsonl/60888
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 638 }
[ 2830, 3393, 21039, 3830, 12135, 1155, 353, 8840, 836, 8, 341, 13158, 2827, 2036, 341, 197, 42727, 3056, 917, 198, 197, 532, 78216, 1669, 3056, 1235, 341, 197, 11609, 262, 914, 198, 197, 31215, 262, 2827, 198, 197, 50780, 262, 3056, 16...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestMixedInstancesSpotASG(t *testing.T) { runTestAWS(t, "mixedinstances.example.com", "mixed_instances_spot", "v1alpha2", false, 3, true, true, nil) runTestCloudformation(t, "mixedinstances.example.com", "mixed_instances_spot", "v1alpha2", false, nil) }
explode_data.jsonl/17512
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 101 }
[ 2830, 3393, 86433, 42725, 47049, 1911, 38, 1155, 353, 8840, 836, 8, 341, 56742, 2271, 36136, 1155, 11, 330, 56685, 47825, 7724, 905, 497, 330, 56685, 41504, 84766, 497, 330, 85, 16, 7141, 17, 497, 895, 11, 220, 18, 11, 830, 11, 830,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestHashJoiner(t *testing.T) { defer leaktest.AfterTest(t)() defer log.Scope(t).Close(t) ctx := context.Background() st := cluster.MakeTestingClusterSettings() evalCtx := tree.MakeTestingEvalContext(st) defer evalCtx.Stop(ctx) flowCtx := &execinfra.FlowCtx{ EvalCtx: &evalCtx, Cfg: &execinfra.ServerConfig{Settings: st}, } for _, outputBatchSize := range []int{1, 17, coldata.BatchSize()} { if outputBatchSize > coldata.BatchSize() { // It is possible for varied coldata.BatchSize() to be smaller than // requested outputBatchSize. Such configuration is invalid, and we skip // it. continue } for _, tcs := range [][]*joinTestCase{hjTestCases, mjTestCases} { for _, tc := range tcs { for _, tc := range tc.mutateTypes() { runHashJoinTestCase(t, tc, func(sources []colexecbase.Operator) (colexecbase.Operator, error) { spec := createSpecForHashJoiner(tc) args := &NewColOperatorArgs{ Spec: spec, Inputs: sources, StreamingMemAccount: testMemAcc, } args.TestingKnobs.UseStreamingMemAccountForBuffering = true args.TestingKnobs.DiskSpillingDisabled = true result, err := TestNewColOperator(ctx, flowCtx, args) if err != nil { return nil, err } if hj, ok := result.Op.(*hashJoiner); ok { hj.outputBatchSize = outputBatchSize } return result.Op, nil }) } } } } }
explode_data.jsonl/7383
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 648 }
[ 2830, 3393, 6370, 12292, 261, 1155, 353, 8840, 836, 8, 341, 16867, 23352, 1944, 36892, 2271, 1155, 8, 741, 16867, 1487, 77940, 1155, 568, 7925, 1155, 692, 20985, 1669, 2266, 19047, 741, 18388, 1669, 10652, 50133, 16451, 28678, 6086, 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 TestEventTotalCount(t *testing.T) { dbClientMock := newMockDB(true) dic := mocks.NewMockDIC() dic.Update(di.ServiceConstructorMap{ container.DBClientInterfaceName: func(get di.Get) interface{} { return dbClientMock }, }) count, err := EventTotalCount(dic) require.NoError(t, err) assert.Equal(t, testEventCount, count, "Event total count is not expected") }
explode_data.jsonl/54246
{ "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, 1556, 7595, 2507, 1155, 353, 8840, 836, 8, 341, 20939, 2959, 11571, 1669, 501, 11571, 3506, 3715, 692, 2698, 292, 1669, 68909, 7121, 11571, 93161, 741, 2698, 292, 16689, 55493, 13860, 13288, 2227, 515, 197, 53290, 22537, 2959,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestFetchCheckpointWithStealing(t *testing.T) { future := time.Now().AddDate(0, 1, 0) svc := &mockDynamoDB{ tableExist: true, item: map[string]*dynamodb.AttributeValue{ SequenceNumberKey: {S: aws.String("deadbeef")}, LeaseOwnerKey: {S: aws.String("abcd-efgh")}, LeaseTimeoutKey: { S: aws.String(future.Format(time.RFC3339)), }, }, } kclConfig := cfg.NewKinesisClientLibConfig("appName", "test", "us-west-2", "abc"). WithInitialPositionInStream(cfg.LATEST). WithMaxRecords(10). WithMaxLeasesForWorker(1). WithShardSyncIntervalMillis(5000). WithFailoverTimeMillis(300000). WithLeaseStealing(true) checkpoint := NewDynamoCheckpoint(kclConfig).WithDynamoDB(svc) checkpoint.Init() status := &par.ShardStatus{ ID: "0001", Checkpoint: "", LeaseTimeout: time.Now(), Mux: &sync.RWMutex{}, } checkpoint.FetchCheckpoint(status) leaseTimeout, _ := time.Parse(time.RFC3339, *svc.item[LeaseTimeoutKey].S) assert.Equal(t, leaseTimeout, status.LeaseTimeout) }
explode_data.jsonl/9843
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 449 }
[ 2830, 3393, 20714, 92688, 2354, 20903, 6132, 1155, 353, 8840, 836, 8, 341, 1166, 2976, 1669, 882, 13244, 1005, 2212, 1916, 7, 15, 11, 220, 16, 11, 220, 15, 692, 1903, 7362, 1669, 609, 16712, 35, 85608, 3506, 515, 197, 26481, 25613, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestTaskStatusImpactedByFailedTest(t *testing.T) { Convey("With a successful task one failed test should result in a task failure", t, func() { displayName := "testName" var ( b *build.Build v *Version testTask *task.Task detail *apimodels.TaskEndDetail ) reset := func() { b = &build.Build{ Id: "buildtest", Version: "abc", Activated: true, Tasks: []build.TaskCache{ { Id: "testone", Activated: true, }, }, } v = &Version{ Id: b.Version, Status: evergreen.VersionStarted, Config: "identifier: sample", } testTask = &task.Task{ Id: "testone", DisplayName: displayName, Activated: false, BuildId: b.Id, Project: "sample", Version: b.Version, } detail = &apimodels.TaskEndDetail{ Status: evergreen.TaskSucceeded, Logs: &apimodels.TaskLogs{ AgentLogURLs: []apimodels.LogInfo{{Command: "foo1", URL: "agent"}}, TaskLogURLs: []apimodels.LogInfo{{Command: "foo2", URL: "task"}}, SystemLogURLs: []apimodels.LogInfo{{Command: "foo3", URL: "system"}}, }, } require.NoError(t, db.ClearCollections(task.Collection, build.Collection, VersionCollection), "Error clearing collections") So(b.Insert(), ShouldBeNil) So(testTask.Insert(), ShouldBeNil) So(v.Insert(), ShouldBeNil) } Convey("task should not fail if there are no failed test, also logs should be updated", func() { reset() updates := StatusChanges{} So(MarkEnd(testTask, "", time.Now(), detail, true, &updates), ShouldBeNil) So(updates.PatchNewStatus, ShouldBeEmpty) So(updates.VersionNewStatus, ShouldEqual, evergreen.VersionSucceeded) So(updates.VersionComplete, ShouldBeTrue) So(updates.BuildNewStatus, ShouldEqual, evergreen.BuildSucceeded) So(updates.BuildComplete, ShouldBeTrue) taskData, err := task.FindOne(task.ById(testTask.Id)) So(err, ShouldBeNil) So(taskData.Status, ShouldEqual, evergreen.TaskSucceeded) So(reflect.DeepEqual(taskData.Logs, detail.Logs), ShouldBeTrue) buildCache, err := build.FindOne(build.ById(b.Id)) So(err, ShouldBeNil) So(buildCache.Status, ShouldEqual, evergreen.TaskSucceeded) for _, t := range buildCache.Tasks { So(t.Status, ShouldEqual, evergreen.TaskSucceeded) } }) Convey("task should not fail if there are only passing or silently failing tests", func() { reset() updates := StatusChanges{} err := testTask.SetResults([]task.TestResult{ { Status: evergreen.TestSilentlyFailedStatus, }, { Status: evergreen.TestSucceededStatus, }, { Status: evergreen.TestSilentlyFailedStatus, }, }) So(err, ShouldBeNil) So(MarkEnd(testTask, "", time.Now(), detail, true, &updates), ShouldBeNil) So(updates.PatchNewStatus, ShouldBeEmpty) So(updates.VersionNewStatus, ShouldEqual, evergreen.VersionSucceeded) So(updates.VersionComplete, ShouldBeTrue) So(updates.BuildNewStatus, ShouldEqual, evergreen.BuildSucceeded) So(updates.BuildComplete, ShouldBeTrue) taskData, err := task.FindOne(task.ById(testTask.Id)) So(err, ShouldBeNil) So(taskData.Status, ShouldEqual, evergreen.TaskSucceeded) buildCache, err := build.FindOne(build.ById(b.Id)) So(err, ShouldBeNil) So(buildCache.Status, ShouldEqual, evergreen.TaskSucceeded) for _, t := range buildCache.Tasks { So(t.Status, ShouldEqual, evergreen.TaskSucceeded) } }) Convey("task should fail if there is one failed test", func() { reset() err := testTask.SetResults([]task.TestResult{ { Status: evergreen.TestFailedStatus, }, }) updates := StatusChanges{} So(err, ShouldBeNil) detail.Status = evergreen.TaskFailed So(MarkEnd(testTask, "", time.Now(), detail, true, &updates), ShouldBeNil) So(updates.PatchNewStatus, ShouldBeEmpty) So(updates.VersionNewStatus, ShouldEqual, evergreen.VersionFailed) So(updates.VersionComplete, ShouldBeTrue) So(updates.BuildNewStatus, ShouldEqual, evergreen.BuildFailed) So(updates.BuildComplete, ShouldBeTrue) taskData, err := task.FindOne(task.ById(testTask.Id)) So(err, ShouldBeNil) So(taskData.Status, ShouldEqual, evergreen.TaskFailed) buildCache, err := build.FindOne(build.ById(b.Id)) So(err, ShouldBeNil) So(buildCache.Status, ShouldEqual, evergreen.TaskFailed) }) Convey("test failures should update the task cache", func() { reset() err := testTask.SetResults([]task.TestResult{ { Status: evergreen.TestFailedStatus, }, }) updates := StatusChanges{} So(err, ShouldBeNil) detail.Status = evergreen.TaskFailed So(MarkEnd(testTask, "", time.Now(), detail, true, &updates), ShouldBeNil) So(updates.PatchNewStatus, ShouldBeEmpty) So(updates.VersionNewStatus, ShouldEqual, evergreen.VersionFailed) So(updates.VersionComplete, ShouldBeTrue) So(updates.BuildNewStatus, ShouldEqual, evergreen.BuildFailed) So(updates.BuildComplete, ShouldBeTrue) updates = StatusChanges{} So(UpdateBuildAndVersionStatusForTask(testTask.Id, &updates), ShouldBeNil) So(updates.PatchNewStatus, ShouldBeEmpty) So(updates.VersionNewStatus, ShouldEqual, evergreen.VersionFailed) So(updates.VersionComplete, ShouldBeTrue) So(updates.BuildNewStatus, ShouldEqual, evergreen.BuildFailed) So(updates.BuildComplete, ShouldBeTrue) buildCache, err := build.FindOne(build.ById(b.Id)) So(err, ShouldBeNil) So(buildCache.Status, ShouldEqual, evergreen.TaskFailed) var hasFailedTask bool for _, t := range buildCache.Tasks { if t.Status == evergreen.TaskFailed { hasFailedTask = true } } So(hasFailedTask, ShouldBeTrue) }) Convey("incomplete versions report updates", func() { reset() b2 := &build.Build{ Id: "buildtest2", Version: "abc", Activated: false, Status: evergreen.BuildCreated, Tasks: []build.TaskCache{ { Id: "testone2", Status: evergreen.TaskUndispatched, }, }, } So(b2.Insert(), ShouldBeNil) err := testTask.SetResults([]task.TestResult{ { Status: evergreen.TestFailedStatus, }, }) So(err, ShouldBeNil) updates := StatusChanges{} detail.Status = evergreen.TaskFailed So(MarkEnd(testTask, "", time.Now(), detail, true, &updates), ShouldBeNil) So(updates.PatchNewStatus, ShouldBeEmpty) So(updates.VersionNewStatus, ShouldEqual, evergreen.VersionFailed) So(updates.VersionComplete, ShouldBeTrue) So(updates.BuildNewStatus, ShouldEqual, evergreen.BuildFailed) So(updates.BuildComplete, ShouldBeTrue) }) }) }
explode_data.jsonl/60430
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 2780 }
[ 2830, 3393, 6262, 2522, 25216, 22167, 1359, 9408, 2271, 1155, 353, 8840, 836, 8, 341, 93070, 5617, 445, 2354, 264, 6849, 3383, 825, 4641, 1273, 1265, 1102, 304, 264, 3383, 7901, 497, 259, 11, 2915, 368, 341, 197, 31271, 675, 1669, 330...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestLog_Config_ViewService(t *testing.T) { // setup test server s := httptest.NewServer(server.FakeHandler()) // create a vela client client, err := vela.NewClient(s.URL, "vela", nil) if err != nil { t.Errorf("unable to create client: %v", err) } // setup tests tests := []struct { failure bool config *Config }{ { failure: false, config: &Config{ Action: "view", Org: "github", Repo: "octocat", Build: 1, Service: 1, Output: "", }, }, { failure: false, config: &Config{ Action: "view", Org: "github", Repo: "octocat", Build: 1, Service: 1, Output: "dump", }, }, { failure: false, config: &Config{ Action: "view", Org: "github", Repo: "octocat", Build: 1, Service: 1, Output: "json", }, }, { failure: false, config: &Config{ Action: "view", Org: "github", Repo: "octocat", Build: 1, Service: 1, Output: "spew", }, }, { failure: false, config: &Config{ Action: "view", Org: "github", Repo: "octocat", Build: 1, Service: 1, Output: "yaml", }, }, { failure: true, config: &Config{ Action: "view", Org: "github", Repo: "octocat", Build: 1, Output: "", }, }, } // run tests for _, test := range tests { err := test.config.ViewService(client) if test.failure { if err == nil { t.Errorf("ViewService should have returned err") } continue } if err != nil { t.Errorf("ViewService returned err: %v", err) } } }
explode_data.jsonl/4177
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 846 }
[ 2830, 3393, 2201, 35412, 50711, 1860, 1155, 353, 8840, 836, 8, 341, 197, 322, 6505, 1273, 3538, 198, 1903, 1669, 54320, 70334, 7121, 5475, 21421, 991, 726, 3050, 12367, 197, 322, 1855, 264, 348, 8294, 2943, 198, 25291, 11, 1848, 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...
6
func TestKeyChain_ShouldFailWhenAddingSameGeneratedAccount(t *testing.T) { kr, err := New(t.Name(), BackendTest, t.TempDir(), nil) require.NoError(t, err) // Given we create a mnemonic _, seed, err := kr.NewMnemonic("test", English, "", hd.Secp256k1) require.NoError(t, err) require.NoError(t, kr.Delete("test")) path := hd.CreateHDPath(118, 0, 0).String() _, err = kr.NewAccount("test1", seed, "", path, hd.Secp256k1) require.NoError(t, err) // Creating another account with different uid but same seed should fail due to have same pub address _, err = kr.NewAccount("test2", seed, "", path, hd.Secp256k1) require.Error(t, err) }
explode_data.jsonl/73451
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 247 }
[ 2830, 3393, 1592, 18837, 36578, 616, 19524, 4498, 32308, 19198, 15741, 7365, 1155, 353, 8840, 836, 8, 341, 197, 9855, 11, 1848, 1669, 1532, 1155, 2967, 1507, 55260, 2271, 11, 259, 65009, 6184, 1507, 2092, 340, 17957, 35699, 1155, 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 TestDeleteDevice(t *testing.T) { t.Parallel() cs := &model.ConnectionString{ HostName: "localhost", Key: []byte("secret"), Name: "gimmeAccessPls", } deviceID := "6c985f61-5093-45eb-8ece-7dfe97a6de7b" testCases := []struct { Name string ConnStr *model.ConnectionString RSPCode int RTError error Error error }{{ Name: "ok", ConnStr: cs, RSPCode: http.StatusOK, }, { Name: "error/invalid connection string", ConnStr: &model.ConnectionString{ Name: "bad", }, Error: errors.New("failed to prepare request: invalid connection string"), }, { Name: "error/internal roundtrip error", ConnStr: cs, RTError: errors.New("idk"), Error: errors.New("failed to execute request:.*idk"), }, { Name: "error/bad status code", ConnStr: cs, RSPCode: http.StatusInternalServerError, Error: common.HTTPError{Code: http.StatusInternalServerError}, }} for i := range testCases { tc := testCases[i] t.Run(tc.Name, func(t *testing.T) { t.Parallel() ctx := context.Background() w := httptest.NewRecorder() httpClient := &http.Client{ Transport: RoundTripperFunc(func( r *http.Request, ) (*http.Response, error) { if tc.RTError != nil { return nil, tc.RTError } w.WriteHeader(tc.RSPCode) return w.Result(), nil }), } client := NewClient(NewOptions(nil). SetClient(httpClient)) err := client.DeleteDevice(ctx, tc.ConnStr, deviceID) if tc.Error != nil { if assert.Error(t, err) { assert.Regexp(t, tc.Error.Error(), err.Error()) } } else { assert.NoError(t, err) } }) } }
explode_data.jsonl/63459
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 700 }
[ 2830, 3393, 6435, 6985, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 741, 71899, 1669, 609, 2528, 67478, 515, 197, 197, 85305, 25, 330, 8301, 756, 197, 55242, 25, 414, 3056, 3782, 445, 20474, 4461, 197, 21297, 25, 257, 330, 70, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestGenerateEmqxBrokerLoadedModules(t *testing.T) { modules := []v1beta1.EmqxBrokerModules{ { Name: "foo", Enable: true, }, { Name: "bar", Enable: false, }, } emqxBroker := v1beta1.EmqxBroker{ Spec: v1beta1.EmqxBrokerSpec{ Modules: modules, }, } emqxBroker.Default() assert.Equal(t, util.StringEmqxBrokerLoadedModules(emqxBroker.GetModules()), "{foo, true}.\n{bar, false}.\n{emqx_mod_acl_internal, true}.\n", ) }
explode_data.jsonl/39825
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 233 }
[ 2830, 3393, 31115, 2269, 80, 14377, 45985, 22369, 28201, 1155, 353, 8840, 836, 8, 341, 42228, 2425, 1669, 3056, 85, 16, 19127, 16, 13, 2269, 80, 14377, 45985, 28201, 515, 197, 197, 515, 298, 21297, 25, 256, 330, 7975, 756, 298, 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 TestCSSFlags(t *testing.T) { var retriever publicSettings.UserRetriever // not required during initialization err := publicSettings.InitI18n(config.Get().I18n, retriever) if err != nil { t.Errorf("failed to initialize language translations: %v", err) } languages := GetTorrentLanguages() flagsCSSPath := path.Join("..", "..", "public", "css", "flags", "flags.css") file, err := ioutil.ReadFile(flagsCSSPath) if err != nil { t.Errorf("Failed to load flags.css: %v", err) return } contents := string(file) for _, language := range languages { flag := publicSettings.Flag(language.Code, true) fmt.Printf("Finding css class for: %s (%s)\n", flag, language.Name) if !strings.Contains(contents, ".flag-"+flag) { t.Errorf("flags.css does not contains class .flag-%s. You probably need to update it.", flag) } } }
explode_data.jsonl/50278
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 297 }
[ 2830, 3393, 33658, 9195, 1155, 353, 8840, 836, 8, 341, 2405, 10759, 423, 584, 6086, 7344, 12020, 461, 2054, 442, 537, 2567, 2337, 17465, 198, 9859, 1669, 584, 6086, 26849, 40, 16, 23, 77, 8754, 2234, 1005, 40, 16, 23, 77, 11, 10759,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestCommandWithEnv(t *testing.T) { c, err := NewContainer(ContainerName) if err != nil { t.Errorf(err.Error()) } options := DefaultAttachOptions options.Env = []string{"FOO=BAR"} options.ClearEnv = true args := []string{"/bin/sh", "-c", "test $FOO = 'BAR'"} ok, err := c.RunCommand(args, options) if err != nil { t.Errorf(err.Error()) } if ok != true { t.Errorf("Expected success") } }
explode_data.jsonl/2795
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 167 }
[ 2830, 3393, 4062, 2354, 14359, 1155, 353, 8840, 836, 8, 341, 1444, 11, 1848, 1669, 1532, 4502, 75145, 675, 340, 743, 1848, 961, 2092, 341, 197, 3244, 13080, 3964, 6141, 2398, 197, 630, 35500, 1669, 7899, 30485, 3798, 198, 35500, 81214, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestParseDefaultPrefsAfterUncommenting(t *testing.T) { /* * Set up */ f, err := ioutil.TempFile("", "Testing") if err != nil { panic(fmt.Sprintf("Failed to make tempfile: %v", err)) } defer os.Remove(f.Name()) lines := strings.Split(gDefaultPrefsStr, "\n") for _, line := range lines { if len(line) > 2 && line[0] == '#' && line[1] != '#' { line = line[1:] } f.WriteString(line + "\n") } f.Close() /* * Call */ prefs, err := loadPrefs(f) /* * Test */ require.Nil(t, err) require.NotNil(t, prefs) }
explode_data.jsonl/65250
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 243 }
[ 2830, 3393, 14463, 3675, 31434, 6025, 1806, 6182, 287, 1155, 353, 8840, 836, 8, 341, 197, 3284, 197, 353, 2573, 705, 198, 197, 735, 1166, 11, 1848, 1669, 43144, 65009, 1703, 19814, 330, 16451, 1138, 743, 1848, 961, 2092, 341, 197, 307...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestValueBinder_Int_Types(t *testing.T) { type target struct { int64 int64 mustInt64 int64 uint64 uint64 mustUint64 uint64 int32 int32 mustInt32 int32 uint32 uint32 mustUint32 uint32 int16 int16 mustInt16 int16 uint16 uint16 mustUint16 uint16 int8 int8 mustInt8 int8 uint8 uint8 mustUint8 uint8 byte byte mustByte byte int int mustInt int uint uint mustUint uint } types := []string{ "int64=1", "mustInt64=2", "uint64=3", "mustUint64=4", "int32=5", "mustInt32=6", "uint32=7", "mustUint32=8", "int16=9", "mustInt16=10", "uint16=11", "mustUint16=12", "int8=13", "mustInt8=14", "uint8=15", "mustUint8=16", "byte=17", "mustByte=18", "int=19", "mustInt=20", "uint=21", "mustUint=22", } c := createTestContext("/search?"+strings.Join(types, "&"), nil, nil) b := QueryParamsBinder(c) dest := target{} err := b. Int64("int64", &dest.int64). MustInt64("mustInt64", &dest.mustInt64). Uint64("uint64", &dest.uint64). MustUint64("mustUint64", &dest.mustUint64). Int32("int32", &dest.int32). MustInt32("mustInt32", &dest.mustInt32). Uint32("uint32", &dest.uint32). MustUint32("mustUint32", &dest.mustUint32). Int16("int16", &dest.int16). MustInt16("mustInt16", &dest.mustInt16). Uint16("uint16", &dest.uint16). MustUint16("mustUint16", &dest.mustUint16). Int8("int8", &dest.int8). MustInt8("mustInt8", &dest.mustInt8). Uint8("uint8", &dest.uint8). MustUint8("mustUint8", &dest.mustUint8). Byte("byte", &dest.byte). MustByte("mustByte", &dest.mustByte). Int("int", &dest.int). MustInt("mustInt", &dest.mustInt). Uint("uint", &dest.uint). MustUint("mustUint", &dest.mustUint). BindError() assert.NoError(t, err) assert.Equal(t, int64(1), dest.int64) assert.Equal(t, int64(2), dest.mustInt64) assert.Equal(t, uint64(3), dest.uint64) assert.Equal(t, uint64(4), dest.mustUint64) assert.Equal(t, int32(5), dest.int32) assert.Equal(t, int32(6), dest.mustInt32) assert.Equal(t, uint32(7), dest.uint32) assert.Equal(t, uint32(8), dest.mustUint32) assert.Equal(t, int16(9), dest.int16) assert.Equal(t, int16(10), dest.mustInt16) assert.Equal(t, uint16(11), dest.uint16) assert.Equal(t, uint16(12), dest.mustUint16) assert.Equal(t, int8(13), dest.int8) assert.Equal(t, int8(14), dest.mustInt8) assert.Equal(t, uint8(15), dest.uint8) assert.Equal(t, uint8(16), dest.mustUint8) assert.Equal(t, uint8(17), dest.byte) assert.Equal(t, uint8(18), dest.mustByte) assert.Equal(t, 19, dest.int) assert.Equal(t, 20, dest.mustInt) assert.Equal(t, uint(21), dest.uint) assert.Equal(t, uint(22), dest.mustUint) }
explode_data.jsonl/82543
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1310 }
[ 2830, 3393, 1130, 44055, 32054, 1139, 1804, 1155, 353, 8840, 836, 8, 341, 13158, 2169, 2036, 341, 197, 2084, 21, 19, 414, 526, 21, 19, 198, 197, 2109, 590, 1072, 21, 19, 220, 526, 21, 19, 198, 197, 8254, 21, 19, 257, 2622, 21, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestFlattenInterfaceSlices(t *testing.T) { expected := []interface{}{"a", "b", "c"} in := []interface{}{"a", "b", "c"} require.Equal(t, expected, FlattenInterfaceSlices(in)) in2 := [][]interface{}{in} require.Equal(t, expected, FlattenInterfaceSlices(in2)) in3 := [][]interface{}{{"a"}, {"b", "c"}} require.Equal(t, expected, FlattenInterfaceSlices(in3)) in4 := [][]interface{}{{"a"}, {[]interface{}{"b"}, "c"}} require.Equal(t, expected, FlattenInterfaceSlices(in4)) }
explode_data.jsonl/52298
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 195 }
[ 2830, 3393, 3882, 14456, 5051, 50, 37414, 1155, 353, 8840, 836, 8, 341, 42400, 1669, 3056, 4970, 6257, 4913, 64, 497, 330, 65, 497, 330, 66, 63159, 17430, 1669, 3056, 4970, 6257, 4913, 64, 497, 330, 65, 497, 330, 66, 16707, 17957, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestCaptiveStellarCore_PrepareRangeAfterClose(t *testing.T) { ctx := context.Background() executablePath := "/etc/stellar-core" networkPassphrase := network.PublicNetworkPassphrase historyURLs := []string{"http://localhost"} captiveCoreToml, err := NewCaptiveCoreToml(CaptiveCoreTomlParams{}) assert.NoError(t, err) captiveStellarCore, err := NewCaptive( CaptiveCoreConfig{ BinaryPath: executablePath, NetworkPassphrase: networkPassphrase, HistoryArchiveURLs: historyURLs, Toml: captiveCoreToml, }, ) assert.NoError(t, err) assert.NoError(t, captiveStellarCore.Close()) assert.EqualError( t, captiveStellarCore.PrepareRange(ctx, BoundedRange(65, 66)), "error starting prepare range: opening subprocess: error getting latest checkpoint sequence: "+ "error getting root HAS: Get \"http://localhost/.well-known/stellar-history.json\": context canceled", ) // even if the request to fetch the latest checkpoint succeeds, we should fail at creating the subprocess mockArchive := &historyarchive.MockArchive{} mockArchive. On("GetRootHAS"). Return(historyarchive.HistoryArchiveState{ CurrentLedger: uint32(200), }, nil) captiveStellarCore.archive = mockArchive assert.EqualError( t, captiveStellarCore.PrepareRange(ctx, BoundedRange(65, 66)), "error starting prepare range: opening subprocess: error running stellar-core: context canceled", ) mockArchive.AssertExpectations(t) }
explode_data.jsonl/7327
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 505 }
[ 2830, 3393, 34, 27781, 623, 26880, 5386, 79561, 3380, 6046, 6025, 7925, 1155, 353, 8840, 836, 8, 341, 20985, 1669, 2266, 19047, 741, 67328, 5922, 1820, 1669, 3521, 12107, 14272, 26880, 23460, 698, 9038, 2349, 12187, 27710, 1669, 3922, 491...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestTopDownCasts(t *testing.T) { tests := []struct { note string rules []string expected interface{} }{ {"to_number", []string{ `p = [x, y, z, i, j] { to_number("-42.0", x); to_number(false, y); to_number(100.1, z); to_number(null, i); to_number(true, j) }`, }, "[-42.0, 0, 100.1, 0, 1]"}, {"to_number ref dest", []string{`p = true { to_number("3", a[2]) }`}, "true"}, {"to_number ref dest", []string{`p = true { not to_number("-1", a[2]) }`}, "true"}, {"to_number: bad input", []string{`p { to_number("broken", x) }`}, fmt.Errorf("invalid syntax")}, } data := loadSmallTestData() for _, tc := range tests { runTopDownTestCase(t, data, tc.note, tc.rules, tc.expected) } }
explode_data.jsonl/25210
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 311 }
[ 2830, 3393, 5366, 4454, 34, 11757, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 3056, 1235, 341, 197, 9038, 1272, 257, 914, 198, 197, 7000, 2425, 262, 3056, 917, 198, 197, 42400, 3749, 16094, 197, 59403, 197, 197, 4913, 983, 5500, 497, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestRemoteSignProposalErrors(t *testing.T) { for _, tc := range socketTestCases(t) { func() { var ( chainID = cmn.RandStr(12) validatorEndpoint, serviceEndpoint = testSetupSocketPair( t, chainID, types.NewErroringMockPV(), tc.addr, tc.dialer) ts = time.Now() proposal = &types.Proposal{Timestamp: ts} ) defer validatorEndpoint.Stop() defer serviceEndpoint.Stop() err := validatorEndpoint.SignProposal("", proposal) require.Equal(t, err.(*RemoteSignerError).Description, types.ErroringMockPVErr.Error()) err = serviceEndpoint.privVal.SignProposal(chainID, proposal) require.Error(t, err) err = validatorEndpoint.SignProposal(chainID, proposal) require.Error(t, err) }() } }
explode_data.jsonl/77986
{ "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, 24703, 7264, 98637, 13877, 1155, 353, 8840, 836, 8, 341, 2023, 8358, 17130, 1669, 2088, 7575, 2271, 37302, 1155, 8, 341, 197, 29244, 368, 341, 298, 2405, 2399, 571, 197, 8819, 915, 999, 284, 9961, 77, 2013, 437, 2580, 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 TestValidateAppautoscalingServiceNamespace(t *testing.T) { cases := []struct { Value string ErrCount int }{ { Value: "ecs", ErrCount: 0, }, { Value: "ec2", ErrCount: 0, }, { Value: "autoscaling", ErrCount: 1, }, { Value: "s3", ErrCount: 1, }, { Value: "es", ErrCount: 1, }, { Value: "", ErrCount: 1, }, } for _, tc := range cases { _, errors := validateAppautoscalingServiceNamespace(tc.Value, "service_namespace") if len(errors) != tc.ErrCount { t.Fatalf("Service Namespace validation failed for value %q: %q", tc.Value, errors) } } }
explode_data.jsonl/78602
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 319 }
[ 2830, 3393, 17926, 2164, 79301, 81552, 1860, 22699, 1155, 353, 8840, 836, 8, 341, 1444, 2264, 1669, 3056, 1235, 341, 197, 47399, 262, 914, 198, 197, 197, 7747, 2507, 526, 198, 197, 59403, 197, 197, 515, 298, 47399, 25, 262, 330, 53717...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestUseTLSConfigClientAuthConnection(t *testing.T) { for i, tc := range []struct { name string serverTLSProvider tlsconfig.TLSCertProvider serverParams []tlsconfig.ServerParam clientParams []tlsconfig.ClientParam }{ { name: "TLS with client cert required", serverTLSProvider: tlsconfig.TLSCertFromFiles(serverCertFile, serverKeyFile), serverParams: []tlsconfig.ServerParam{ tlsconfig.ServerClientAuthType(tls.RequireAndVerifyClientCert), tlsconfig.ServerClientCAs(tlsconfig.CertPoolFromCAFiles(caCertFile)), }, clientParams: []tlsconfig.ClientParam{ tlsconfig.ClientKeyPairFiles(clientCertFile, clientKeyFile), tlsconfig.ClientRootCAs(tlsconfig.CertPoolFromCAFiles(caCertFile)), }, }, { name: "TLS with no client cert", serverTLSProvider: tlsconfig.TLSCertFromFiles(serverCertFile, serverKeyFile), serverParams: []tlsconfig.ServerParam{ tlsconfig.ServerClientAuthType(tls.NoClientCert), tlsconfig.ServerClientCAs(tlsconfig.CertPoolFromCAFiles(caCertFile)), }, clientParams: []tlsconfig.ClientParam{ tlsconfig.ClientRootCAs(tlsconfig.CertPoolFromCAFiles(caCertFile)), }, }, } { func() { server := httptest.NewUnstartedServer(http.HandlerFunc(func(rw http.ResponseWriter, req *http.Request) { fmt.Fprintf(rw, "OK: %s", req.URL.Path) })) serverCfg, err := tlsconfig.NewServerConfig(tc.serverTLSProvider, tc.serverParams...) require.NoError(t, err) server.TLS = serverCfg server.StartTLS() defer server.Close() clientCfg, err := tlsconfig.NewClientConfig(tc.clientParams...) require.NoError(t, err) client := &http.Client{ Transport: &http.Transport{ TLSClientConfig: clientCfg, }, } resp, err := client.Get(server.URL + "/hello") require.NoError(t, err) bytes, err := ioutil.ReadAll(resp.Body) require.NoError(t, err) assert.Equal(t, "OK: /hello", string(bytes), "Case %d: %s", i, tc.name) }() } }
explode_data.jsonl/67707
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 839 }
[ 2830, 3393, 10253, 45439, 2648, 2959, 5087, 4526, 1155, 353, 8840, 836, 8, 341, 2023, 600, 11, 17130, 1669, 2088, 3056, 1235, 341, 197, 11609, 1060, 914, 198, 197, 41057, 45439, 5179, 55026, 1676, 836, 43, 3540, 529, 5179, 198, 197, 4...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestEngineRunnerPod(t *testing.T) { tests := map[string]struct { isErr bool runner *podEngineRunner }{ "Test Positive-1": { runner: &podEngineRunner{ pod: &corev1.Pod{}, engineRunner: &corev1.Pod{ ObjectMeta: metav1.ObjectMeta{ Labels: make(map[string]string), Name: "dummypod", Namespace: "dummyns", }, }, reconcileEngine: &reconcileEngine{ r: CreateFakeClient(t), reqLogger: chaosTypes.Log.WithValues(), }, }, isErr: false, }, "Test Positive-2": { runner: &podEngineRunner{ pod: &corev1.Pod{}, engineRunner: &corev1.Pod{ ObjectMeta: metav1.ObjectMeta{ Labels: make(map[string]string), Name: "dummypresentpod", Namespace: "default", }, }, reconcileEngine: &reconcileEngine{ r: CreateFakeClient(t), reqLogger: chaosTypes.Log.WithValues(), }, }, isErr: false, }, } for name, mock := range tests { t.Run(name, func(t *testing.T) { if name == "Test Positive-2" { mock.runner.r.client.Create(context.TODO(), mock.runner.engineRunner) } err := engineRunnerPod(mock.runner) if mock.isErr && err == nil { t.Fatalf("Test %q failed: expected error not to be nil", name) } if !mock.isErr && err != nil { t.Fatalf("Test %q failed: expected error to be nil", name) } }) } }
explode_data.jsonl/32133
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 669 }
[ 2830, 3393, 4571, 19486, 23527, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 2415, 14032, 60, 1235, 341, 197, 19907, 7747, 220, 1807, 198, 197, 197, 41736, 353, 39073, 4571, 19486, 198, 197, 59403, 197, 197, 1, 2271, 43903, 12, 16, 788,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestSubset_NestedMap_Fail(t *testing.T) { super := map[string]interface{}{ "a": "1", "b": "2", "c": "3", "d": map[string]interface{}{ "aa": "11", "bb": "22", "cc": "33", }, } sub := map[string]interface{}{ "c": "3", "d": map[string]interface{}{ "dd": "44", }, } if testutil.ContainSubset(super, sub) { t.Fatalf("expected map to not be subset of super, got true") } }
explode_data.jsonl/79703
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 197 }
[ 2830, 3393, 70584, 1604, 9980, 2227, 1400, 604, 1155, 353, 8840, 836, 8, 1476, 12468, 1669, 2415, 14032, 31344, 67066, 197, 197, 56693, 788, 330, 16, 756, 197, 197, 1, 65, 788, 330, 17, 756, 197, 197, 96946, 788, 330, 18, 756, 197, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestFromString(t *testing.T) { type args struct { header string } tests := []struct { name string args args want *Policy }{ struct { name string args args want *Policy }{ "simple", args{header: "img-src 'none';"}, &Policy{ Directives: *orderedset.NewOrderedSet([]string{"img-src"}), Sources: map[string]*orderedset.OrderedSet{ "img-src": orderedset.NewOrderedSet([]string{"'none'"}), }, }, }, { "medium", args{header: "img-src https: 'self'; object-src 'none'; default-src 'none'"}, &Policy{ Directives: *orderedset.NewOrderedSet([]string{"img-src", "object-src", "default-src"}), Sources: map[string]*orderedset.OrderedSet{ "img-src": orderedset.NewOrderedSet([]string{"https:", "'self'"}), "object-src": orderedset.NewOrderedSet([]string{"'none'"}), "default-src": orderedset.NewOrderedSet([]string{"'none'"}), }, }, }, { "dupe", args{header: "img-src https: 'self'; img-src 'none'"}, &Policy{ Directives: *orderedset.NewOrderedSet([]string{"img-src"}), Sources: map[string]*orderedset.OrderedSet{ "img-src": orderedset.NewOrderedSet([]string{"https:", "'self'"}), }, }, }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { if got := FromString(tt.args.header); !reflect.DeepEqual(got, tt.want) { t.Errorf("FromString() = %v, want %v", got, tt.want) } }) } }
explode_data.jsonl/10343
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 641 }
[ 2830, 3393, 44491, 1155, 353, 8840, 836, 8, 341, 13158, 2827, 2036, 341, 197, 20883, 914, 198, 197, 532, 78216, 1669, 3056, 1235, 341, 197, 11609, 914, 198, 197, 31215, 2827, 198, 197, 50780, 353, 13825, 198, 197, 59403, 197, 6472, 34...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestRemoveFromCQ(t *testing.T) { unittest.SmallTest(t) reason := "SkCQ is no longer looking at this change" changeID := int64(123) accountID1 := 111111 accountID2 := 222222 accountID3 := 333333 ci := &gerrit.ChangeInfo{ Issue: changeID, Labels: map[string]*gerrit.LabelEntry{ gerrit.LabelCommitQueue: { All: []*gerrit.LabelDetail{ { Value: gerrit.LabelCommitQueueDryRun, AccountID: accountID1, }, { Value: gerrit.LabelCommitQueueNone, AccountID: accountID2, }, { Value: gerrit.LabelCommitQueueSubmit, AccountID: accountID3, }, }, }, // This should be ignored. gerrit.LabelCodeReview: { All: []*gerrit.LabelDetail{ { Value: gerrit.LabelCodeReviewApprove, AccountID: accountID1, }, }, }, }, } // Mock gerrit. g := &mocks.GerritInterface{} g.On("DeleteVote", testutils.AnyContext, changeID, gerrit.LabelCommitQueue, accountID1, gerrit.NotifyNone).Return(nil).Once() g.On("DeleteVote", testutils.AnyContext, changeID, gerrit.LabelCommitQueue, accountID3, gerrit.NotifyNone).Return(nil).Once() g.On("SetReview", testutils.AnyContext, ci, reason, map[string]int{}, []string{}, gerrit.NotifyOwner, AutogeneratedCommentTag, 0).Return(nil).Once() cr := gerritCodeReview{ gerritClient: g, cfg: gerrit.ConfigChromium, } cr.RemoveFromCQ(context.Background(), ci, reason) }
explode_data.jsonl/45916
{ "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, 13021, 3830, 34, 48, 1155, 353, 8840, 836, 8, 341, 20479, 14267, 90183, 2271, 1155, 692, 17200, 1497, 1669, 330, 19290, 34, 48, 374, 902, 5021, 3330, 518, 419, 2297, 698, 68380, 915, 1669, 526, 21, 19, 7, 16, 17, 18, 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 TestUint16ToSlice(t *testing.T) { b := uint16ToSlice(uint16(0x1234)) assert.Equal(t, []byte{0x12, 0x34}, b) }
explode_data.jsonl/35787
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 58 }
[ 2830, 3393, 21570, 16, 21, 1249, 33236, 1155, 353, 8840, 836, 8, 341, 2233, 1669, 2622, 16, 21, 1249, 33236, 8488, 16, 21, 7, 15, 87, 16, 17, 18, 19, 4390, 6948, 12808, 1155, 11, 3056, 3782, 90, 15, 87, 16, 17, 11, 220, 15, 87...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
func TestAfterCanceled(t *testing.T) { const wait = 10 * time.Millisecond testCtx, cancel := context.WithTimeout(context.Background(), wait*2) defer cancel() ctx, cancel := context.WithCancel(testCtx) defer cancel() var canceledAt time.Time go func() { time.Sleep(wait / 2) canceledAt = time.Now() cancel() }() select { case _, ok := <-ablyutil.After(ctx, wait): if ok { t.Error("expected timer channel to be closed on cancel") } if sinceCancel := time.Since(canceledAt); !isCloseTo(sinceCancel, 0) { t.Errorf("expected timer to fire immediately after cancel; got %v", sinceCancel) } case <-testCtx.Done(): t.Error("expected timer to be done before the context is canceled") } }
explode_data.jsonl/10438
{ "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, 6025, 63263, 1155, 353, 8840, 836, 8, 1476, 4777, 3783, 284, 220, 16, 15, 353, 882, 71482, 271, 18185, 23684, 11, 9121, 1669, 2266, 26124, 7636, 5378, 19047, 1507, 3783, 9, 17, 340, 16867, 9121, 2822, 20985, 11, 9121, 1669...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestWithBackoffMaxDelay(t *testing.T) { md := DefaultBackoffConfig.MaxDelay / 2 expected := BackoffConfig{MaxDelay: md} setDefaults(&expected) testBackoffConfigSet(t, &expected, WithBackoffMaxDelay(md)) }
explode_data.jsonl/6667
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 76 }
[ 2830, 3393, 2354, 3707, 1847, 5974, 20039, 1155, 353, 8840, 836, 8, 341, 84374, 1669, 7899, 3707, 1847, 2648, 14535, 20039, 608, 220, 17, 198, 42400, 1669, 6841, 1847, 2648, 90, 5974, 20039, 25, 10688, 532, 8196, 16273, 2099, 7325, 340,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
func TestConfig_Encrypt_GoodData_NoErr(t *testing.T) { setup() defer teardown() _, err := cfg.Encrypt(content) if err != nil { t.Error(err) } }
explode_data.jsonl/6916
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 68 }
[ 2830, 3393, 2648, 93529, 3571, 2646, 1386, 1043, 36989, 7747, 1155, 353, 8840, 836, 8, 341, 220, 6505, 741, 220, 17956, 49304, 741, 220, 8358, 1848, 1669, 13286, 26598, 3571, 15063, 340, 220, 421, 1848, 961, 2092, 341, 262, 259, 6141, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
2
func TestScrapePoolRaces(t *testing.T) { interval, _ := model.ParseDuration("500ms") timeout, _ := model.ParseDuration("1s") newConfig := func() *config.ScrapeConfig { return &config.ScrapeConfig{ScrapeInterval: interval, ScrapeTimeout: timeout} } sp, _ := newScrapePool(newConfig(), &nopAppendable{}, 0, nil) tgts := []*targetgroup.Group{ { Targets: []model.LabelSet{ {model.AddressLabel: "127.0.0.1:9090"}, {model.AddressLabel: "127.0.0.2:9090"}, {model.AddressLabel: "127.0.0.3:9090"}, {model.AddressLabel: "127.0.0.4:9090"}, {model.AddressLabel: "127.0.0.5:9090"}, {model.AddressLabel: "127.0.0.6:9090"}, {model.AddressLabel: "127.0.0.7:9090"}, {model.AddressLabel: "127.0.0.8:9090"}, }, }, } sp.Sync(tgts) active := sp.ActiveTargets() dropped := sp.DroppedTargets() expectedActive, expectedDropped := len(tgts[0].Targets), 0 if len(sp.ActiveTargets()) != expectedActive { t.Fatalf("Invalid number of active targets: expected %v, got %v", expectedActive, len(active)) } if len(dropped) != expectedDropped { t.Fatalf("Invalid number of dropped targets: expected %v, got %v", expectedDropped, len(dropped)) } for i := 0; i < 20; i++ { time.Sleep(time.Duration(10 * time.Millisecond)) sp.reload(newConfig()) } sp.stop() }
explode_data.jsonl/56117
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 543 }
[ 2830, 3393, 3326, 19842, 10551, 49, 2434, 1155, 353, 8840, 836, 8, 341, 2084, 6152, 11, 716, 1669, 1614, 8937, 12945, 445, 20, 15, 15, 1011, 1138, 78395, 11, 716, 1669, 1614, 8937, 12945, 445, 16, 82, 1138, 8638, 2648, 1669, 2915, 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 TestDeployWithErrorReadingManifestFile(t *testing.T) { p := &fakeProxy{} e := &fakeExecutor{} c := &deployCommand{ getManifest: getManifestWithError, proxy: p, executor: e, kubeconfig: &fakeKubeConfig{}, } ctx := context.Background() cwd := "/tmp" opts := &Options{ Name: "movies", ManifestPath: "", Variables: []string{}, } err := c.runDeploy(ctx, cwd, opts) assert.Error(t, err) // No command was executed assert.Len(t, e.executed, 0) // Proxy wasn't started assert.False(t, p.started) }
explode_data.jsonl/6526
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 238 }
[ 2830, 3393, 69464, 66102, 31899, 38495, 1703, 1155, 353, 8840, 836, 8, 341, 3223, 1669, 609, 30570, 16219, 16094, 7727, 1669, 609, 30570, 25255, 16094, 1444, 1669, 609, 35794, 4062, 515, 197, 10366, 38495, 25, 633, 38495, 66102, 345, 197,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func Test_newFunctionListNoTemplates(t *testing.T) { cmdParameters := []string{ "new", "--list", } faasCmd.SetArgs(cmdParameters) stdOut := faasCmd.Execute().Error() // Validate command output if !strings.HasPrefix(stdOut, NoTemplates) { t.Fatalf("Output is not as expected: %s\n", stdOut) } }
explode_data.jsonl/47229
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 119 }
[ 2830, 3393, 5921, 5152, 852, 2753, 51195, 1155, 353, 8840, 836, 8, 341, 25920, 9706, 1669, 3056, 917, 515, 197, 197, 1, 931, 756, 197, 197, 74757, 1607, 756, 197, 630, 1166, 64, 300, 15613, 4202, 4117, 14160, 9706, 340, 6736, 2662, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestLocalDockerComposeWithEnvironment(t *testing.T) { path := "./testresources/docker-compose-simple.yml" identifier := strings.ToLower(uuid.New().String()) compose := NewLocalDockerCompose([]string{path}, identifier, WithLogger(TestLogger(t))) destroyFn := func() { err := compose.Down() checkIfError(t, err) } defer destroyFn() err := compose. WithCommand([]string{"up", "-d"}). WithEnv(map[string]string{ "bar": "BAR", }). Invoke() checkIfError(t, err) assert.Equal(t, 1, len(compose.Services)) assert.Contains(t, compose.Services, "nginx") containerNameNginx := compose.Identifier + "_nginx_1" present := map[string]string{ "bar": "BAR", } absent := map[string]string{} assertContainerEnvironmentVariables(t, containerNameNginx, present, absent) }
explode_data.jsonl/43635
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 297 }
[ 2830, 3393, 7319, 35, 13659, 70492, 2354, 12723, 1155, 353, 8840, 836, 8, 341, 26781, 1669, 5924, 1944, 12745, 61764, 65070, 65957, 33936, 1837, 197, 15909, 1669, 9069, 29983, 41458, 7121, 1005, 703, 12367, 32810, 2900, 1669, 1532, 7319, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestModExtractPurlsFromManifest(t *testing.T) { var err error mod := Mod{} mod.GoSumPath = testGoSumName mod.ProjectList = getProjectList() if err != nil { t.Error(err) } result := mod.ExtractPurlsFromManifest() if len(result) != 5 { t.Error(result) } }
explode_data.jsonl/46384
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 112 }
[ 2830, 3393, 4459, 28959, 47, 20502, 3830, 38495, 1155, 353, 8840, 836, 8, 341, 2405, 1848, 1465, 198, 42228, 1669, 5650, 16094, 42228, 67131, 9190, 1820, 284, 1273, 10850, 9190, 675, 198, 42228, 30944, 852, 284, 633, 7849, 852, 741, 743...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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