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 TestComputeDHFailsOnLowOrder(t *testing.T) { _, locPrivKey := genEphKeys() for _, remLowOrderPubKey := range blacklist { shared, err := computeDHSecret(&remLowOrderPubKey, locPrivKey) assert.Error(t, err) assert.Equal(t, err, ErrSharedSecretIsZero) assert.Empty(t, shared) } }
explode_data.jsonl/39909
{ "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, 46254, 35, 49716, 6209, 1925, 24187, 4431, 1155, 353, 8840, 836, 8, 341, 197, 6878, 1329, 32124, 1592, 1669, 4081, 36, 759, 8850, 741, 2023, 8358, 1299, 24187, 4431, 29162, 1592, 1669, 2088, 66049, 341, 197, 197, 6100, 11, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestWaitForBuildToStart(t *testing.T) { jobName := "ContinuousDelivery/piper-library" jobID := strings.ReplaceAll(jobName, "/", "/job/") t.Run("error - build not started", func(t *testing.T) { // init buildNumber := int64(43) task := &mocks.Task{} task.On("WaitToStart", time.Millisecond).Return(buildNumber, nil) jenkins := &mocks.Jenkins{} jenkins. On("GetBuild", jobID, buildNumber). Return(nil, fmt.Errorf("Build not started")) // test build, err := WaitForBuildToStart(jenkins, jobName, task, time.Millisecond) // asserts task.AssertExpectations(t) jenkins.AssertExpectations(t) assert.EqualError(t, err, "Build not started") assert.Nil(t, build) }) }
explode_data.jsonl/73397
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 274 }
[ 2830, 3393, 14190, 2461, 11066, 1249, 3479, 1155, 353, 8840, 836, 8, 341, 68577, 675, 1669, 330, 94780, 38121, 4322, 12858, 52421, 698, 68577, 915, 1669, 9069, 20858, 2403, 28329, 675, 11, 64657, 3521, 8799, 14, 5130, 3244, 16708, 445, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestUUID5RFC4122Validation(t *testing.T) { tests := []struct { param string expected bool }{ {"", false}, {"xxxa987Fbc9-4bed-3078-cf07-9141ba07c9f3", false}, {"9c858901-8a57-4791-81Fe-4c455b099bc9", false}, {"a987Fbc9-4bed-3078-cf07-9141ba07c9f3", false}, {"987Fbc97-4bed-5078-af07-9141ba07c9f3", true}, {"987Fbc97-4bed-5078-9f07-9141ba07c9f3", true}, } validate := New() for i, test := range tests { errs := validate.Var(test.param, "uuid5_rfc4122") if test.expected { if !IsEqual(errs, nil) { t.Fatalf("Index: %d UUID5RFC4122 failed Error: %s", i, errs) } } else { if IsEqual(errs, nil) { t.Fatalf("Index: %d UUID5RFC4122 failed Error: %s", i, errs) } else { val := getError(errs, "", "") if val.Tag() != "uuid5_rfc4122" { t.Fatalf("Index: %d UUID5RFC4122 failed Error: %s", i, errs) } } } } }
explode_data.jsonl/77271
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 453 }
[ 2830, 3393, 24754, 20, 64371, 19, 16, 17, 17, 13799, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 3056, 1235, 341, 197, 36037, 262, 914, 198, 197, 42400, 1807, 198, 197, 92, 4257, 197, 197, 4913, 497, 895, 1583, 197, 197, 4913, 4146, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestCreateClean(t *testing.T) { config := createValidTestConfig() clientBuilder := NewNonInteractiveClientConfig(*config, "clean", &ConfigOverrides{}, nil) clientConfig, err := clientBuilder.ClientConfig() if err != nil { t.Errorf("Unexpected error: %v", err) } matchStringArg(config.Clusters["clean"].Server, clientConfig.Host, t) matchStringArg("", clientConfig.APIPath, t) matchBoolArg(config.Clusters["clean"].InsecureSkipTLSVerify, clientConfig.Insecure, t) matchStringArg(config.AuthInfos["clean"].Token, clientConfig.BearerToken, t) }
explode_data.jsonl/56164
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 185 }
[ 2830, 3393, 4021, 27529, 1155, 353, 8840, 836, 8, 341, 25873, 1669, 1855, 4088, 2271, 2648, 741, 25291, 3297, 1669, 1532, 8121, 71686, 2959, 2648, 4071, 1676, 11, 330, 18377, 497, 609, 2648, 80010, 22655, 2092, 692, 25291, 2648, 11, 184...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestContainsAndExcludes(t *testing.T) { validate := New() type ImpossibleStringTest struct { Foo string `validate:"fieldcontains=Bar"` Bar string `validate:"fieldexcludes=Foo"` } impossibleStringTest := &ImpossibleStringTest{ Foo: "foo", Bar: "bar", } errs := validate.Struct(impossibleStringTest) NotEqual(t, errs, nil) AssertError(t, errs, "ImpossibleStringTest.Foo", "ImpossibleStringTest.Foo", "Foo", "Foo", "fieldcontains") impossibleStringTest = &ImpossibleStringTest{ Foo: "bar", Bar: "foo", } errs = validate.Struct(impossibleStringTest) NotEqual(t, errs, nil) AssertError(t, errs, "ImpossibleStringTest.Foo", "ImpossibleStringTest.Foo", "Foo", "Foo", "fieldcontains") }
explode_data.jsonl/77301
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 273 }
[ 2830, 3393, 23805, 3036, 840, 7396, 1155, 353, 8840, 836, 8, 341, 197, 7067, 1669, 1532, 2822, 13158, 82652, 703, 2271, 2036, 341, 197, 12727, 2624, 914, 1565, 7067, 2974, 2566, 13372, 28, 3428, 8805, 197, 197, 3428, 914, 1565, 7067, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestStartTraceReception(t *testing.T) { tests := []struct { name string host component.Host wantErr bool }{ { name: "nil_host", wantErr: true, }, { name: "valid_host", host: componenttest.NewNopHost(), }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { sink := new(exportertest.SinkTraceExporterOld) cfg := &Config{ ReceiverSettings: configmodels.ReceiverSettings{ NameVal: zipkinReceiver, }, HTTPServerSettings: confighttp.HTTPServerSettings{ Endpoint: "localhost:0", }, } zr, err := New(cfg, sink) require.Nil(t, err) require.NotNil(t, zr) err = zr.Start(context.Background(), tt.host) assert.Equal(t, tt.wantErr, err != nil) if !tt.wantErr { require.Nil(t, zr.Shutdown(context.Background())) } }) } }
explode_data.jsonl/53602
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 393 }
[ 2830, 3393, 3479, 6550, 693, 995, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 3056, 1235, 341, 197, 11609, 262, 914, 198, 197, 63104, 262, 3692, 29840, 198, 197, 50780, 7747, 1807, 198, 197, 59403, 197, 197, 515, 298, 11609, 25, 262, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestServerConnectionsLeak(t *testing.T) { var ( ctx = context.Background() server = mustServer(t)(NewServer()) addr, listener = newTestListener(t) client, cleanup = newTestClient(t, addr) ) defer cleanup() defer listener.Close() connectionCountBefore := server.countConnection() go server.Serve(ctx, listener) registerTestingService(server, &testingServer{}) tp := &internal.TestPayload{} // do a regular call if err := client.Call(ctx, serviceName, "Test", tp, tp); err != nil { t.Fatalf("unexpected error during test call: %v", err) } connectionCount := server.countConnection() if connectionCount != 1 { t.Fatalf("unexpected connection count: %d, expected: %d", connectionCount, 1) } // close the client, so that server gets EOF if err := client.Close(); err != nil { t.Fatalf("unexpected error while closing client: %v", err) } // server should eventually close the client connection maxAttempts := 20 for i := 1; i <= maxAttempts; i++ { connectionCountAfter := server.countConnection() if connectionCountAfter == connectionCountBefore { break } if i == maxAttempts { t.Fatalf("expected number of connections to be equal %d after client close, got %d connections", connectionCountBefore, connectionCountAfter) } time.Sleep(100 * time.Millisecond) } }
explode_data.jsonl/41083
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 446 }
[ 2830, 3393, 5475, 54751, 2304, 585, 1155, 353, 8840, 836, 8, 341, 2405, 2399, 197, 20985, 1797, 284, 2266, 19047, 741, 197, 41057, 688, 284, 1969, 5475, 1155, 2376, 3564, 5475, 2398, 197, 53183, 11, 11446, 220, 284, 501, 2271, 2743, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestStartStopAdapter(t *testing.T) { ctx, _ := rectesting.SetupFakeContext(t) ctx, cancel := context.WithCancel(ctx) envCfg := NewEnvConfig() ce := adaptertest.NewTestClient() adapter := NewAdapter(ctx, envCfg, ce) done := make(chan struct{}) go func(ctx context.Context) { err := adapter.Start(ctx) if err != nil { t.Error("Unexpected error:", err) } close(done) }(ctx) cancel() select { case <-time.After(2 * time.Second): t.Fatal("Expected adapter to be stopped after 2 seconds") case <-done: } }
explode_data.jsonl/48891
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 204 }
[ 2830, 3393, 3479, 10674, 5940, 1155, 353, 8840, 836, 8, 341, 20985, 11, 716, 1669, 7608, 59855, 39820, 52317, 1972, 1155, 340, 20985, 11, 9121, 1669, 2266, 26124, 9269, 7502, 340, 57538, 42467, 1669, 1532, 14359, 2648, 2822, 197, 346, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestNewClusterCommand(t *testing.T) { fakeRootSettings := &environment.AirshipCTLSettings{ AirshipConfigPath: "../../testdata/k8s/config.yaml", KubeConfigPath: "../../testdata/k8s/kubeconfig.yaml", } fakeRootSettings.InitConfig() tests := []*testutil.CmdTest{ { Name: "cluster-cmd-with-help", CmdLine: "--help", Cmd: cluster.NewClusterCommand(fakeRootSettings), }, { Name: "cluster-init-cmd-with-help", CmdLine: "--help", Cmd: cluster.NewInitCommand(fakeRootSettings), }, } for _, testcase := range tests { testutil.RunTest(t, testcase) } }
explode_data.jsonl/46629
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 258 }
[ 2830, 3393, 3564, 28678, 4062, 1155, 353, 8840, 836, 8, 341, 1166, 726, 8439, 6086, 1669, 609, 23294, 875, 404, 5270, 23871, 6086, 515, 197, 22985, 404, 5270, 2648, 1820, 25, 10208, 92425, 14109, 23, 82, 14730, 33406, 756, 197, 39340, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestExponentialGrowth__String(t *testing.T) { g := &tester.ExponentialGrowth{Precision: 3} assert.Equal(t, g.String(), "^3") g = &tester.ExponentialGrowth{Precision: 42} assert.Equal(t, g.String(), "^42") g = &tester.ExponentialGrowth{Precision: 100} assert.Equal(t, g.String(), "^100") }
explode_data.jsonl/66520
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 123 }
[ 2830, 3393, 840, 59825, 38, 19089, 563, 703, 1155, 353, 8840, 836, 8, 341, 3174, 1669, 609, 73358, 5121, 59825, 38, 19089, 90, 55501, 25, 220, 18, 532, 6948, 12808, 1155, 11, 342, 6431, 1507, 39915, 18, 5130, 3174, 284, 609, 73358, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestFmtDockerOpts(t *testing.T) { secOpts := []dockerOpt{{"seccomp", "unconfined", ""}} opts := FmtDockerOpts(secOpts, ':') assert.Len(t, opts, 1) assert.Contains(t, opts, "seccomp:unconfined", "Docker 1.10") opts = FmtDockerOpts(secOpts, '=') assert.Len(t, opts, 1) assert.Contains(t, opts, "seccomp=unconfined", "Docker 1.11") }
explode_data.jsonl/31185
{ "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, 93322, 35, 13659, 43451, 1155, 353, 8840, 836, 8, 341, 197, 5024, 43451, 1669, 3056, 28648, 21367, 2979, 1, 325, 638, 14435, 497, 330, 359, 6135, 1589, 497, 1591, 11248, 64734, 1669, 434, 2501, 35, 13659, 43451, 73104, 43451...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestInitAccount(t *testing.T) { testCases := []struct { desc string account *Account email string keyType string expectedAccount *Account }{ { desc: "Existing account with all information", account: &Account{ Email: "foo@foo.net", KeyType: acme.EC256, }, expectedAccount: &Account{ Email: "foo@foo.net", KeyType: acme.EC256, }, }, { desc: "Account nil", email: "foo@foo.net", keyType: "EC256", expectedAccount: &Account{ Email: "foo@foo.net", KeyType: acme.EC256, }, }, { desc: "Existing account with no email", account: &Account{ KeyType: acme.RSA4096, }, email: "foo@foo.net", keyType: "EC256", expectedAccount: &Account{ Email: "foo@foo.net", KeyType: acme.EC256, }, }, { desc: "Existing account with no key type", account: &Account{ Email: "foo@foo.net", }, email: "bar@foo.net", keyType: "EC256", expectedAccount: &Account{ Email: "foo@foo.net", KeyType: acme.EC256, }, }, { desc: "Existing account and provider with no key type", account: &Account{ Email: "foo@foo.net", }, email: "bar@foo.net", expectedAccount: &Account{ Email: "foo@foo.net", KeyType: acme.RSA4096, }, }, } for _, test := range testCases { test := test t.Run(test.desc, func(t *testing.T) { t.Parallel() acmeProvider := Provider{account: test.account, Configuration: &Configuration{Email: test.email, KeyType: test.keyType}} actualAccount, err := acmeProvider.initAccount(context.Background()) assert.Nil(t, err, "Init account in error") assert.Equal(t, test.expectedAccount.Email, actualAccount.Email, "unexpected email account") assert.Equal(t, test.expectedAccount.KeyType, actualAccount.KeyType, "unexpected keyType account") }) } }
explode_data.jsonl/20644
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 845 }
[ 2830, 3393, 3803, 7365, 1155, 353, 8840, 836, 8, 341, 18185, 37302, 1669, 3056, 1235, 341, 197, 41653, 310, 914, 198, 197, 86866, 260, 353, 7365, 198, 197, 57549, 1843, 914, 198, 197, 23634, 929, 260, 914, 198, 197, 42400, 7365, 353, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestExactValidArgs(t *testing.T) { tests := []struct { name string args []string wantErr bool }{ { name: "no args", args: []string{}, wantErr: true, }, { name: "with correct args", args: []string{"a"}, wantErr: false, }, { name: "with invalid args", args: []string{"b"}, wantErr: true, }, { name: "with more args", args: []string{"a", "b", "c"}, wantErr: true, }, } for _, tt := range tests { args := tt.args wantErr := tt.wantErr t.Run(tt.name, func(t *testing.T) { c := &cobra.Command{Use: "c", Args: ExactValidArgs(1), ValidArgs: []string{"a"}, Run: emptyRun} if _, err := executeCommand(c, args...); (err != nil) != wantErr { t.Errorf("ExactValidArgs() error = %v, wantErr %v", err, wantErr) } }) } }
explode_data.jsonl/59322
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 406 }
[ 2830, 3393, 57954, 4088, 4117, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 3056, 1235, 341, 197, 11609, 262, 914, 198, 197, 31215, 262, 3056, 917, 198, 197, 50780, 7747, 1807, 198, 197, 59403, 197, 197, 515, 298, 11609, 25, 262, 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...
2
func TestDockerGetPort(t *testing.T) { testCases := []struct { desc string container docker.ContainerJSON serverPort string expected string }{ { desc: "no binding, no server port label", container: containerJSON(name("foo")), expected: "", }, { desc: "binding, no server port label", container: containerJSON(ports(nat.PortMap{ "80/tcp": {}, })), expected: "80", }, { desc: "binding, multiple ports, no server port label", container: containerJSON(ports(nat.PortMap{ "80/tcp": {}, "443/tcp": {}, })), expected: "80", }, { desc: "no binding, server port label", container: containerJSON(), serverPort: "8080", expected: "8080", }, { desc: "binding, server port label", container: containerJSON( ports(nat.PortMap{ "80/tcp": {}, })), serverPort: "8080", expected: "8080", }, { desc: "binding, multiple ports, server port label", container: containerJSON(ports(nat.PortMap{ "8080/tcp": {}, "80/tcp": {}, })), serverPort: "8080", expected: "8080", }, } for _, test := range testCases { test := test t.Run(test.desc, func(t *testing.T) { t.Parallel() dData := parseContainer(test.container) actual := getPort(dData, test.serverPort) assert.Equal(t, test.expected, actual) }) } }
explode_data.jsonl/26365
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 611 }
[ 2830, 3393, 35, 13659, 1949, 7084, 1155, 353, 8840, 836, 8, 341, 18185, 37302, 1669, 3056, 1235, 341, 197, 41653, 981, 914, 198, 197, 53290, 220, 26588, 33672, 5370, 198, 197, 41057, 7084, 914, 198, 197, 42400, 256, 914, 198, 197, 594...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestFindKeyAndType(t *testing.T) { // out is either the matched type in case of a match or the original // string up till the insertion point. tests := []struct { key string hasExt bool in, out string }{ // Don't search past a private use extension. {"co", false, "en-x-foo-u-co-pinyin", "en"}, {"co", false, "x-foo-u-co-pinyin", ""}, {"co", false, "en-s-fff-x-foo", "en-s-fff"}, // Insertion points in absence of -u extension. {"cu", false, "en", ""}, // t.str is "" {"cu", false, "en-v-va", "en"}, {"cu", false, "en-a-va", "en-a-va"}, {"cu", false, "en-a-va-v-va", "en-a-va"}, {"cu", false, "en-x-a", "en"}, // Tags with the -u extension. {"co", true, "en-u-co-standard", "standard"}, {"co", true, "yue-u-co-pinyin", "pinyin"}, {"co", true, "en-u-co-abc", "abc"}, {"co", true, "en-u-co-abc-def", "abc-def"}, {"co", true, "en-u-co-abc-def-x-foo", "abc-def"}, {"co", true, "en-u-co-standard-nu-arab", "standard"}, {"co", true, "yue-u-co-pinyin-nu-arab", "pinyin"}, // Insertion points. {"cu", true, "en-u-co-standard", "en-u-co-standard"}, {"cu", true, "yue-u-co-pinyin-x-foo", "yue-u-co-pinyin"}, {"cu", true, "en-u-co-abc", "en-u-co-abc"}, {"cu", true, "en-u-nu-arabic", "en-u"}, {"cu", true, "en-u-co-abc-def-nu-arabic", "en-u-co-abc-def"}, } for i, tt := range tests { start, end, hasExt := Make(tt.in).findTypeForKey(tt.key) if start != end { res := tt.in[start:end] if res != tt.out { t.Errorf("%d:%s: was %q; want %q", i, tt.in, res, tt.out) } } else { if hasExt != tt.hasExt { t.Errorf("%d:%s: hasExt was %v; want %v", i, tt.in, hasExt, tt.hasExt) continue } if tt.in[:start] != tt.out { t.Errorf("%d:%s: insertion point was %q; want %q", i, tt.in, tt.in[:start], tt.out) } } } }
explode_data.jsonl/27930
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 887 }
[ 2830, 3393, 9885, 1592, 3036, 929, 1155, 353, 8840, 836, 8, 341, 197, 322, 700, 374, 2987, 279, 18054, 943, 304, 1142, 315, 264, 2432, 476, 279, 4024, 198, 197, 322, 914, 705, 11956, 279, 35927, 1459, 624, 78216, 1669, 3056, 1235, 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...
6
func TestRowTableAddWithoutGeometry(t *testing.T) { map_dao := &TableRowAddNonGeomImpl{&DaoImpl{}, false} service := service.MakeTableRowService(map_dao) uri_params := map[string]string{"table_id": "42"} values := url.Values{} values.Set("with_geometry", "0") values.Set("name", "Some Name") request := makeRequest(http.MethodPost, uri_params, values, true) result := service.Add(request) if !result.IsSuccess() { t.Errorf("Error returned") } _, ok := result.GetDataByKey("row") if !ok { t.Errorf("row should be present in data") } if !map_dao.IsInsertCalled() { t.Errorf("Insert has not been called") } }
explode_data.jsonl/15448
{ "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, 3102, 2556, 2212, 26040, 20787, 1155, 353, 8840, 836, 8, 341, 19567, 814, 3441, 1669, 609, 38558, 2212, 8121, 78708, 9673, 90, 5, 12197, 9673, 22655, 895, 532, 52934, 1669, 2473, 50133, 38558, 1860, 9147, 814, 3441, 340, 197...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
4
func TestCancelBatchOrders(t *testing.T) { t.Parallel() if !areTestAPIKeysSet() || !canManipulateRealOrders { t.Skip("skipping test, either api keys or manipulaterealorders isnt set correctly") } temp := []string{"4477045999", "4477381751", "4477381751"} _, err := b.CancelBatchOrders(temp) if err != nil { t.Error(err) } }
explode_data.jsonl/33172
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 133 }
[ 2830, 3393, 9269, 21074, 24898, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 741, 743, 753, 546, 2271, 7082, 8850, 1649, 368, 1369, 753, 4814, 92876, 6334, 12768, 24898, 341, 197, 3244, 57776, 445, 4886, 5654, 1273, 11, 2987, 6330, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestParseDurationString_ShouldNotParseDurationStringWithOutOfOrderQuantitiesAndUnits(t *testing.T) { duration, err := ParseDurationString("h1") assert.EqualError(t, err, "could not parse 'h1' as a duration") assert.Equal(t, time.Duration(0), duration) }
explode_data.jsonl/12148
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 87 }
[ 2830, 3393, 14463, 12945, 703, 36578, 616, 2623, 14463, 12945, 703, 2354, 31731, 4431, 44220, 1361, 3036, 26314, 1155, 353, 8840, 836, 8, 341, 89300, 11, 1848, 1669, 14775, 12945, 703, 445, 71, 16, 5130, 6948, 12808, 1454, 1155, 11, 184...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestDBCreate(t *testing.T) { for _, item := range content { var n model.Name n.Name = item t.Run(item, func(t *testing.T) { body, _ := json.Marshal(n) resp, err := http.Post(endpointPrefix+"/name/create", "application/json", bytes.NewBuffer(body)) if err != nil { t.Error(err.Error()) } if resp.StatusCode != 200 { t.Errorf("TestDBPost: response code is not 200, error: %d", resp.StatusCode) } defer resp.Body.Close() data, err := ioutil.ReadAll(resp.Body) json.Unmarshal(data, &n) // Check response json if n.Name != item { t.Errorf("TestDBPost: expectd %s but got %s", item, n.Name) } }) } }
explode_data.jsonl/64858
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 291 }
[ 2830, 3393, 3506, 4021, 1155, 353, 8840, 836, 8, 341, 2023, 8358, 1509, 1669, 2088, 2213, 341, 197, 2405, 308, 1614, 2967, 198, 197, 9038, 2967, 284, 1509, 198, 197, 3244, 16708, 5393, 11, 2915, 1155, 353, 8840, 836, 8, 341, 298, 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...
4
func TestModuleString(t *testing.T) { input := `package a.b.c import data.foo.bar import input.xyz p = true { not bar } q = true { xyz.abc = 2 } wildcard = true { bar[_] = 1 }` mod := MustParseModule(input) roundtrip, err := ParseModule("", mod.String()) if err != nil { t.Fatalf("Unexpected error while parsing roundtripped module: %v", err) } if !roundtrip.Equal(mod) { t.Fatalf("Expected roundtripped to equal original but:\n\nExpected:\n\n%v\n\nDoes not equal result:\n\n%v", mod, roundtrip) } }
explode_data.jsonl/65310
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 198 }
[ 2830, 3393, 3332, 703, 1155, 353, 8840, 836, 8, 1476, 22427, 1669, 1565, 1722, 264, 948, 520, 271, 474, 821, 58432, 22001, 198, 474, 1946, 55699, 271, 79, 284, 830, 314, 537, 3619, 456, 80, 284, 830, 314, 40511, 13, 13683, 284, 220,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestGetWorkflowSpecBytes_ByWorkflowManifest(t *testing.T) { store := NewFakeClientManagerOrFatal(util.NewFakeTimeForEpoch()) defer store.Close() manager := NewResourceManager(store) spec := &api.PipelineSpec{ WorkflowManifest: "some manifest", Parameters: []*api.Parameter{ {Name: "param1", Value: "world"}, }, } workflowBytes, err := manager.getWorkflowSpecBytes(spec) assert.Nil(t, err) assert.Equal(t, []byte("some manifest"), workflowBytes) }
explode_data.jsonl/28396
{ "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, 1949, 62768, 8327, 7078, 85996, 62768, 38495, 1155, 353, 8840, 836, 8, 341, 57279, 1669, 1532, 52317, 2959, 2043, 2195, 62396, 67811, 7121, 52317, 1462, 2461, 44338, 2398, 16867, 3553, 10421, 741, 92272, 1669, 1532, 32498, 31200...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestVersionedTreeSpecial1(t *testing.T) { tree := NewMutableTree(db.NewMemDB(), 100) tree.Set([]byte("C"), []byte("so43QQFN")) tree.SaveVersion() tree.Set([]byte("A"), []byte("ut7sTTAO")) tree.SaveVersion() tree.Set([]byte("X"), []byte("AoWWC1kN")) tree.SaveVersion() tree.Set([]byte("T"), []byte("MhkWjkVy")) tree.SaveVersion() tree.DeleteVersion(1) tree.DeleteVersion(2) tree.DeleteVersion(3) require.Equal(t, tree.nodeSize(), len(tree.ndb.nodes())) }
explode_data.jsonl/25115
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 200 }
[ 2830, 3393, 5637, 291, 6533, 20366, 16, 1155, 353, 8840, 836, 8, 341, 51968, 1669, 1532, 11217, 6533, 9791, 7121, 18816, 3506, 1507, 220, 16, 15, 15, 692, 51968, 4202, 10556, 3782, 445, 34, 3975, 3056, 3782, 445, 704, 19, 18, 48026, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestVersionedCheckpointsSpecialCase5(t *testing.T) { tree := NewMutableTree(db.NewMemDB(), 0) tree.Set([]byte("R"), []byte("ygZlIzeW")) tree.SaveVersion() tree.Set([]byte("j"), []byte("ZgmCWyo2")) tree.SaveVersion() tree.Set([]byte("R"), []byte("vQDaoz6Z")) tree.SaveVersion() tree.DeleteVersion(1) tree.GetVersioned([]byte("R"), 2) }
explode_data.jsonl/25131
{ "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, 5637, 291, 3973, 7706, 20366, 4207, 20, 1155, 353, 8840, 836, 8, 341, 51968, 1669, 1532, 11217, 6533, 9791, 7121, 18816, 3506, 1507, 220, 15, 692, 51968, 4202, 10556, 3782, 445, 49, 3975, 3056, 3782, 445, 48765, 57, 75, 40...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestCopyErrorTarDstLockOutput(t *testing.T) { env := BuildEnv(t) imgpkg := Imgpkg{t, Logger{}, env.ImgpkgPath} _, err := imgpkg.RunWithOpts( []string{"copy", "--tty", "-i", env.Image, "--to-tar", "file", "--lock-output", "bogus"}, RunOpts{AllowError: true}, ) if err == nil || !strings.Contains(err.Error(), "output lock file with tar destination") { t.Fatalf("expected copy to fail when --lock-output is provided with a tar destination, got %v", err) } }
explode_data.jsonl/23223
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 179 }
[ 2830, 3393, 12106, 1454, 62733, 54600, 11989, 5097, 1155, 353, 8840, 836, 8, 341, 57538, 1669, 7854, 14359, 1155, 340, 39162, 30069, 1669, 2362, 21888, 7351, 90, 83, 11, 9514, 22655, 6105, 13, 13033, 30069, 1820, 532, 197, 6878, 1848, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestFilterAddLatest(t *testing.T) { pver := wire.ProtocolVersion data := []byte{0x01, 0x02} msg := wire.NewMsgFilterAdd(data) // Ensure the command is expected value. wantCmd := "filteradd" if cmd := msg.Command(); cmd != wantCmd { t.Errorf("NewMsgFilterAdd: wrong command - got %v want %v", cmd, wantCmd) } // Ensure max payload is expected value for latest protocol version. wantPayload := uint32(523) maxPayload := msg.MaxPayloadLength(pver) if maxPayload != wantPayload { t.Errorf("MaxPayloadLength: wrong max payload length for "+ "protocol version %d - got %v, want %v", pver, maxPayload, wantPayload) } // Test encode with latest protocol version. var buf bytes.Buffer err := msg.BtcEncode(&buf, pver) if err != nil { t.Errorf("encode of MsgFilterAdd failed %v err <%v>", msg, err) } // Test decode with latest protocol version. var readmsg wire.MsgFilterAdd err = readmsg.BtcDecode(&buf, pver) if err != nil { t.Errorf("decode of MsgFilterAdd failed [%v] err <%v>", buf, err) } return }
explode_data.jsonl/14207
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 380 }
[ 2830, 3393, 5632, 2212, 31992, 1155, 353, 8840, 836, 8, 341, 3223, 423, 1669, 9067, 54096, 5637, 271, 8924, 1669, 3056, 3782, 90, 15, 87, 15, 16, 11, 220, 15, 87, 15, 17, 532, 21169, 1669, 9067, 7121, 6611, 5632, 2212, 2592, 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...
5
func TestNewVersionHandler(t *testing.T) { rec := httptest.NewRecorder() req, _ := http.NewRequest(http.MethodGet, "/version", nil) version := "2.0.0" h := NewVersionHandler(version) h(rec, req) if rec.Code != http.StatusOK { t.Errorf("Wrong response code expected %d actual %d", http.StatusOK, rec.Code) } if !strings.Contains(rec.Body.String(), version) { t.Errorf("Version %s not found in response body %s", rec.Body.String(), version) } }
explode_data.jsonl/1926
{ "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, 3564, 5637, 3050, 1155, 353, 8840, 836, 8, 341, 67904, 1669, 54320, 70334, 7121, 47023, 741, 24395, 11, 716, 1669, 1758, 75274, 19886, 20798, 1949, 11, 3521, 4366, 497, 2092, 340, 74954, 1669, 330, 17, 13, 15, 13, 15, 1837...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestCall_Call_InvalidArgs(t *testing.T) { mockJSONRPC := &mocks.JSONRPC{} mockGraphQL := &mocks.GraphQL{} c := &Client{ c: mockJSONRPC, g: mockGraphQL, traceSemaphore: semaphore.NewWeighted(100), } ctx := context.Background() resp, err := c.Call( ctx, &RosettaTypes.CallRequest{ Method: "eth_call", Parameters: map[string]interface{}{ "index": 11408349, "Hash": "0x73fc065bc04f16c98247f8ec1e990f581ec58723bcd8059de85f93ab18706448", "to": "not valid ", "data": "0x70a08231000000000000000000000000b5e5d0f8c0cba267cd3d7035d6adc8eba7df7cdd", }, }, ) assert.Nil(t, resp) assert.True(t, errors.Is(err, ErrCallParametersInvalid)) mockJSONRPC.AssertExpectations(t) mockGraphQL.AssertExpectations(t) }
explode_data.jsonl/55499
{ "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, 7220, 76028, 62, 7928, 4117, 1155, 353, 8840, 836, 8, 341, 77333, 5370, 29528, 1669, 609, 16712, 82, 18009, 29528, 16094, 77333, 88637, 1669, 609, 16712, 82, 40237, 3588, 31483, 1444, 1669, 609, 2959, 515, 197, 1444, 25, 106...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestStateTreeConsistency(t *testing.T) { tf.UnitTest(t) ctx := context.Background() bs := bstore.NewBlockstore(repo.NewInMemoryRepo().Datastore()) cst := cborutil.NewIpldStore(bs) tree := NewState(cst) var addrs []address.Address for i := 100; i < 150; i++ { a, err := address.NewIDAddress(uint64(i)) if err != nil { t.Fatal(err) } addrs = append(addrs, a) } randomCid, err := cid.Decode("bafy2bzacecu7n7wbtogznrtuuvf73dsz7wasgyneqasksdblxupnyovmtwxxu") if err != nil { t.Fatal(err) } for i, a := range addrs { if err := tree.SetActor(ctx, a, &actor.Actor{ Code: e.NewCid(randomCid), Head: e.NewCid(randomCid), Balance: abi.NewTokenAmount(int64(10000 + i)), CallSeqNum: uint64(1000 - i), }); err != nil { t.Fatal(err) } } root, err := tree.Commit(ctx) if err != nil { t.Fatal(err) } if root.String() != "bafy2bzaceadyjnrv3sbjvowfl3jr4pdn5p2bf3exjjie2f3shg4oy5sub7h34" { t.Fatalf("State Tree Mismatch. Expected: bafy2bzaceadyjnrv3sbjvowfl3jr4pdn5p2bf3exjjie2f3shg4oy5sub7h34 Actual: %s", root.String()) } }
explode_data.jsonl/9603
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 538 }
[ 2830, 3393, 1397, 6533, 15220, 47094, 1155, 353, 8840, 836, 8, 341, 3244, 69, 25159, 2271, 1155, 692, 20985, 1669, 2266, 19047, 741, 93801, 1669, 293, 4314, 7121, 4713, 4314, 50608, 7121, 641, 10642, 25243, 1005, 1043, 4314, 2398, 1444, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
8
func TestFailbackSuceess(t *testing.T) { ctrl := gomock.NewController(t) defer ctrl.Finish() invoker := mock.NewMockInvoker(ctrl) clusterInvoker := registerFailback(invoker).(*failbackClusterInvoker) invoker.EXPECT().GetUrl().Return(failbackUrl).AnyTimes() invoker.EXPECT().IsAvailable().Return(true) mockResult := &protocol.RPCResult{Rest: rest{tried: 0, success: true}} invoker.EXPECT().Invoke(gomock.Any()).Return(mockResult) result := clusterInvoker.Invoke(context.Background(), &invocation.RPCInvocation{}) assert.Equal(t, mockResult, result) }
explode_data.jsonl/6991
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 200 }
[ 2830, 3393, 19524, 1419, 50, 10521, 433, 1155, 353, 8840, 836, 8, 341, 84381, 1669, 342, 316, 1176, 7121, 2051, 1155, 340, 16867, 23743, 991, 18176, 2822, 197, 14057, 10451, 1669, 7860, 7121, 11571, 47668, 62100, 340, 197, 18855, 47668, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestConverterRecursiveStructWithFieldMap(t *testing.T) { fieldMap := make(map[string]codegen.FieldMapperEntry) fieldMap["Five.One"] = codegen.FieldMapperEntry{ QualifiedName: "Five.Two", Override: true, } fieldMap["Five.Two"] = codegen.FieldMapperEntry{ QualifiedName: "Five.One", Override: true, } lines, err := convertTypes( "Foo", "Bar", `struct NestedFoo { 1: required string one 2: required string two 3: optional NestedFoo three } struct Foo { 1: required NestedFoo five } struct Bar { 2: required NestedFoo five }`, nil, fieldMap, ) assert.NoError(t, err) assertPrettyEqual(t, trim(` inOriginal := in; _ = inOriginal outOriginal := out; _ = outOriginal var convertNestedFooHelper1 func(in *structs.NestedFoo) (out *structs.NestedFoo) convertNestedFooHelper1 = func(in *structs.NestedFoo) (out *structs.NestedFoo) { if in != nil { out = &structs.NestedFoo{} if inOriginal.Five != nil { out.One = string(inOriginal.Five.Two) } if inOriginal.Five != nil { out.Two = string(inOriginal.Five.One) } out.Three = convertNestedFooHelper1(in.Three) } else { out = nil } return } out.Five = convertNestedFooHelper1(in.Five) `), lines) }
explode_data.jsonl/62098
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 557 }
[ 2830, 3393, 14920, 78542, 9422, 2354, 1877, 2227, 1155, 353, 8840, 836, 8, 341, 39250, 2227, 1669, 1281, 9147, 14032, 60, 95859, 17087, 10989, 5874, 340, 39250, 2227, 1183, 37020, 37067, 1341, 284, 2038, 4370, 17087, 10989, 5874, 515, 197...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestCreateBlock(t *testing.T) { tmpdir, err := ioutil.TempDir("", "test") testutil.Ok(t, err) defer func() { testutil.Ok(t, os.RemoveAll(tmpdir)) }() b, err := OpenBlock(nil, createBlock(t, tmpdir, genSeries(1, 1, 0, 10)), nil) if err == nil { testutil.Ok(t, b.Close()) } testutil.Ok(t, err) }
explode_data.jsonl/9634
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 139 }
[ 2830, 3393, 4021, 4713, 1155, 353, 8840, 836, 8, 341, 20082, 3741, 11, 1848, 1669, 43144, 65009, 6184, 19814, 330, 1944, 1138, 18185, 1314, 54282, 1155, 11, 1848, 340, 16867, 2915, 368, 341, 197, 18185, 1314, 54282, 1155, 11, 2643, 8442...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestFindIndexOfEmail_Fail(t *testing.T) { x := []string{"testingATtest.com", "testingAtTest.com", "testingATtest.com"} got := FindIndexOfEmail(x) want := -1 if got != want { t.Errorf("Got: %d, Wanted: %d", got, want) } }
explode_data.jsonl/45940
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 94 }
[ 2830, 3393, 9885, 27376, 4781, 1400, 604, 1155, 353, 8840, 836, 8, 341, 10225, 1669, 3056, 917, 4913, 8840, 828, 1944, 905, 497, 330, 8840, 1655, 2271, 905, 497, 330, 8840, 828, 1944, 905, 63159, 3174, 354, 1669, 7379, 27376, 4781, 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...
2
func TestStatusCmd(t *testing.T) { releasesMockWithStatus := func(info *release.Info, hooks ...*release.Hook) []*release.Release { info.LastDeployed = helmtime.Unix(1452902400, 0).UTC() return []*release.Release{{ Name: "flummoxed-chickadee", Namespace: "default", Info: info, Chart: &chart.Chart{}, Hooks: hooks, }} } tests := []cmdTestCase{{ name: "get status of a deployed release", cmd: "status flummoxed-chickadee", golden: "output/status.txt", rels: releasesMockWithStatus(&release.Info{ Status: release.StatusDeployed, }), }, { name: "get status of a deployed release, with desc", cmd: "status --show-desc flummoxed-chickadee", golden: "output/status-with-desc.txt", rels: releasesMockWithStatus(&release.Info{ Status: release.StatusDeployed, Description: "Mock description", }), }, { name: "get status of a deployed release with notes", cmd: "status flummoxed-chickadee", golden: "output/status-with-notes.txt", rels: releasesMockWithStatus(&release.Info{ Status: release.StatusDeployed, Notes: "release notes", }), }, { name: "get status of a deployed release with notes in json", cmd: "status flummoxed-chickadee -o json", golden: "output/status.json", rels: releasesMockWithStatus(&release.Info{ Status: release.StatusDeployed, Notes: "release notes", }), }, { name: "get status of a deployed release with test suite", cmd: "status flummoxed-chickadee", golden: "output/status-with-test-suite.txt", rels: releasesMockWithStatus( &release.Info{ Status: release.StatusDeployed, }, &release.Hook{ Name: "never-run-test", Events: []release.HookEvent{release.HookTest}, }, &release.Hook{ Name: "passing-test", Events: []release.HookEvent{release.HookTest}, LastRun: release.HookExecution{ StartedAt: mustParseTime("2006-01-02T15:04:05Z"), CompletedAt: mustParseTime("2006-01-02T15:04:07Z"), Phase: release.HookPhaseSucceeded, }, }, &release.Hook{ Name: "failing-test", Events: []release.HookEvent{release.HookTest}, LastRun: release.HookExecution{ StartedAt: mustParseTime("2006-01-02T15:10:05Z"), CompletedAt: mustParseTime("2006-01-02T15:10:07Z"), Phase: release.HookPhaseFailed, }, }, &release.Hook{ Name: "passing-pre-install", Events: []release.HookEvent{release.HookPreInstall}, LastRun: release.HookExecution{ StartedAt: mustParseTime("2006-01-02T15:00:05Z"), CompletedAt: mustParseTime("2006-01-02T15:00:07Z"), Phase: release.HookPhaseSucceeded, }, }, ), }} runTestCmd(t, tests) }
explode_data.jsonl/50600
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1192 }
[ 2830, 3393, 2522, 15613, 1155, 353, 8840, 836, 8, 341, 17200, 28299, 11571, 2354, 2522, 1669, 2915, 14208, 353, 22998, 20132, 11, 29677, 2503, 9, 22998, 3839, 1941, 8, 29838, 22998, 58693, 341, 197, 27043, 24682, 69464, 291, 284, 33765, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestParticipantArbitraryIds(t *testing.T) { _, err := NewParticipant(3, 2, testGenerator, curves.NewK256Scalar(), 4) require.Error(t, err) _, err = NewParticipant(0, 2, testGenerator, curves.NewK256Scalar(), 1) require.Error(t, err) _, err = NewParticipant(2, 2, testGenerator, curves.NewK256Scalar(), 2, 3, 5) require.Error(t, err) _, err = NewParticipant(1, 2, testGenerator, curves.NewK256Scalar(), 4) require.Error(t, err) }
explode_data.jsonl/77873
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 179 }
[ 2830, 3393, 67504, 6953, 87851, 12701, 1155, 353, 8840, 836, 8, 341, 197, 6878, 1848, 1669, 1532, 67504, 7, 18, 11, 220, 17, 11, 1273, 12561, 11, 35933, 7121, 42, 17, 20, 21, 20639, 1507, 220, 19, 340, 17957, 6141, 1155, 11, 1848, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestNewTx(t *testing.T) { t.Parallel() t.Run("new tx, defaults", func(t *testing.T) { tx := bt.NewTx() assert.NotNil(t, tx) assert.IsType(t, &bt.Tx{}, tx) assert.Equal(t, uint32(1), tx.Version) assert.Equal(t, uint32(0), tx.LockTime) assert.Equal(t, 0, tx.InputCount()) assert.Equal(t, 0, tx.OutputCount()) assert.Equal(t, uint64(0), tx.GetTotalOutputSatoshis()) assert.Equal(t, uint64(0), tx.GetTotalInputSatoshis()) }) }
explode_data.jsonl/28734
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 207 }
[ 2830, 3393, 3564, 31584, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 2822, 3244, 16708, 445, 931, 9854, 11, 16674, 497, 2915, 1155, 353, 8840, 836, 8, 341, 197, 46237, 1669, 19592, 7121, 31584, 741, 197, 6948, 93882, 1155, 11, 98...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestJsonListValue_Get_OutOfRange(t *testing.T) { list := NewJSONList(NewRegistry(), &structpb.ListValue{Values: []*structpb.Value{ {Kind: &structpb.Value_StringValue{StringValue: "hello"}}, {Kind: &structpb.Value_NumberValue{NumberValue: 1}}}}) if !IsError(list.Get(Int(-1))) { t.Error("Negative index did not result in error.") } if !IsError(list.Get(Int(2))) { t.Error("Index out of range did not result in error.") } if !IsError(list.Get(Uint(1))) { t.Error("Index of incorrect type did not result in error.") } }
explode_data.jsonl/55360
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 202 }
[ 2830, 3393, 5014, 852, 1130, 13614, 36675, 2124, 6046, 1155, 353, 8840, 836, 8, 341, 14440, 1669, 1532, 5370, 852, 35063, 15603, 1507, 609, 1235, 16650, 5814, 1130, 90, 6227, 25, 29838, 1235, 16650, 6167, 515, 197, 197, 90, 10629, 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...
4
func TestGetSnapshotByID(t *testing.T) { testCases := []struct { name string testFunc func(t *testing.T) }{ { name: "snapshotID not valid", testFunc: func(t *testing.T) { sourceVolumeID := "unit-test" ctx := context.Background() d, _ := NewFakeDriver(t) d.cloud = &azure.Cloud{} snapshotID := "testurl/subscriptions/23/providers/Microsoft.Compute/snapshots/snapshot-name" expectedErr := fmt.Errorf("could not get snapshot name from testurl/subscriptions/23/providers/Microsoft.Compute/snapshots/snapshot-name, correct format: (?i).*/subscriptions/(?:.*)/resourceGroups/(?:.*)/providers/Microsoft.Compute/snapshots/(.+)") _, err := d.getSnapshotByID(ctx, d.cloud.ResourceGroup, snapshotID, sourceVolumeID) if !reflect.DeepEqual(err, expectedErr) { t.Errorf("actualErr: (%v), expectedErr: (%v)", err, expectedErr) } }, }, { name: "snapshot get error", testFunc: func(t *testing.T) { d, _ := NewFakeDriver(t) d.cloud = &azure.Cloud{} ctrl := gomock.NewController(t) defer ctrl.Finish() mockSnapshotClient := mocksnapshotclient.NewMockInterface(ctrl) d.cloud.SnapshotsClient = mockSnapshotClient rerr := &retry.Error{ RawError: fmt.Errorf("test"), } snapshotID := "testurl/subscriptions/23/providers/Microsoft.Compute/snapshots/snapshot-name" snapshot := compute.Snapshot{ SnapshotProperties: &compute.SnapshotProperties{}, ID: &snapshotID, } snapshotVolumeID := "unit-test" mockSnapshotClient.EXPECT().Get(gomock.Any(), gomock.Any(), gomock.Any()).Return(snapshot, rerr).AnyTimes() expectedErr := fmt.Errorf("could not get snapshot name from testurl/subscriptions/23/providers/Microsoft.Compute/snapshots/snapshot-name, correct format: (?i).*/subscriptions/(?:.*)/resourceGroups/(?:.*)/providers/Microsoft.Compute/snapshots/(.+)") _, err := d.getSnapshotByID(context.Background(), d.cloud.ResourceGroup, snapshotID, snapshotVolumeID) if !reflect.DeepEqual(err, expectedErr) { t.Errorf("actualErr: (%v), expectedErr: (%v)", err, expectedErr) } }, }, } for _, tc := range testCases { t.Run(tc.name, tc.testFunc) } }
explode_data.jsonl/59392
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 908 }
[ 2830, 3393, 1949, 15009, 60572, 1155, 353, 8840, 836, 8, 341, 18185, 37302, 1669, 3056, 1235, 341, 197, 11609, 257, 914, 198, 197, 18185, 9626, 2915, 1155, 353, 8840, 836, 340, 197, 59403, 197, 197, 515, 298, 11609, 25, 330, 35501, 91...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestLoadAndMergeConfig(t *testing.T) { tmpDir, err := ioutil.TempDir("", "merge-config") require.NoError(t, err) defer os.RemoveAll(tmpDir) // No registries.d exists config, err := loadAndMergeConfig(filepath.Join(tmpDir, "thisdoesnotexist")) require.NoError(t, err) assert.Equal(t, &registryConfiguration{Docker: map[string]registryNamespace{}}, config) // Empty registries.d directory emptyDir := filepath.Join(tmpDir, "empty") err = os.Mkdir(emptyDir, 0755) require.NoError(t, err) config, err = loadAndMergeConfig(emptyDir) require.NoError(t, err) assert.Equal(t, &registryConfiguration{Docker: map[string]registryNamespace{}}, config) // Unreadable registries.d directory unreadableDir := filepath.Join(tmpDir, "unreadable") err = os.Mkdir(unreadableDir, 0000) require.NoError(t, err) _, err = loadAndMergeConfig(unreadableDir) assert.Error(t, err) // An unreadable file in a registries.d directory unreadableFileDir := filepath.Join(tmpDir, "unreadableFile") err = os.Mkdir(unreadableFileDir, 0755) require.NoError(t, err) err = ioutil.WriteFile(filepath.Join(unreadableFileDir, "0.yaml"), []byte("{}"), 0644) require.NoError(t, err) err = ioutil.WriteFile(filepath.Join(unreadableFileDir, "1.yaml"), nil, 0000) require.NoError(t, err) _, err = loadAndMergeConfig(unreadableFileDir) assert.Error(t, err) // Invalid YAML invalidYAMLDir := filepath.Join(tmpDir, "invalidYAML") err = os.Mkdir(invalidYAMLDir, 0755) require.NoError(t, err) err = ioutil.WriteFile(filepath.Join(invalidYAMLDir, "0.yaml"), []byte("}"), 0644) require.NoError(t, err) _, err = loadAndMergeConfig(invalidYAMLDir) assert.Error(t, err) // Duplicate DefaultDocker duplicateDefault := filepath.Join(tmpDir, "duplicateDefault") err = os.Mkdir(duplicateDefault, 0755) require.NoError(t, err) err = ioutil.WriteFile(filepath.Join(duplicateDefault, "0.yaml"), []byte("default-docker:\n sigstore: file:////tmp/something"), 0644) require.NoError(t, err) err = ioutil.WriteFile(filepath.Join(duplicateDefault, "1.yaml"), []byte("default-docker:\n sigstore: file:////tmp/different"), 0644) require.NoError(t, err) _, err = loadAndMergeConfig(duplicateDefault) require.Error(t, err) assert.Contains(t, err.Error(), "0.yaml") assert.Contains(t, err.Error(), "1.yaml") // Duplicate DefaultDocker duplicateNS := filepath.Join(tmpDir, "duplicateNS") err = os.Mkdir(duplicateNS, 0755) require.NoError(t, err) err = ioutil.WriteFile(filepath.Join(duplicateNS, "0.yaml"), []byte("docker:\n example.com:\n sigstore: file:////tmp/something"), 0644) require.NoError(t, err) err = ioutil.WriteFile(filepath.Join(duplicateNS, "1.yaml"), []byte("docker:\n example.com:\n sigstore: file:////tmp/different"), 0644) require.NoError(t, err) _, err = loadAndMergeConfig(duplicateNS) assert.Error(t, err) assert.Contains(t, err.Error(), "0.yaml") assert.Contains(t, err.Error(), "1.yaml") // A fully worked example, including an empty-dictionary file and a non-.yaml file config, err = loadAndMergeConfig("fixtures/registries.d") require.NoError(t, err) assert.Equal(t, &registryConfiguration{ DefaultDocker: &registryNamespace{SigStore: "file:///mnt/companywide/signatures/for/other/repositories"}, Docker: map[string]registryNamespace{ "example.com": {SigStore: "https://sigstore.example.com"}, "registry.test.example.com": {SigStore: "http://registry.test.example.com/sigstore"}, "registry.test.example.com:8888": {SigStore: "http://registry.test.example.com:8889/sigstore", SigStoreStaging: "https://registry.test.example.com:8889/sigstore/specialAPIserverWhichDoesntExist"}, "localhost": {SigStore: "file:///home/mitr/mydevelopment1"}, "localhost:8080": {SigStore: "file:///home/mitr/mydevelopment2"}, "localhost/invalid/url/test": {SigStore: ":emptyscheme"}, "docker.io/contoso": {SigStore: "https://sigstore.contoso.com/fordocker"}, "docker.io/centos": {SigStore: "https://sigstore.centos.org/"}, "docker.io/centos/mybetaprooduct": { SigStore: "http://localhost:9999/mybetaWIP/sigstore", SigStoreStaging: "file:///srv/mybetaWIP/sigstore", }, "docker.io/centos/mybetaproduct:latest": {SigStore: "https://sigstore.centos.org/"}, }, }, config) }
explode_data.jsonl/63962
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1765 }
[ 2830, 3393, 5879, 3036, 52096, 2648, 1155, 353, 8840, 836, 8, 341, 20082, 6184, 11, 1848, 1669, 43144, 65009, 6184, 19814, 330, 19052, 25130, 1138, 17957, 35699, 1155, 11, 1848, 340, 16867, 2643, 84427, 10368, 6184, 692, 197, 322, 2308, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestCharsetDecoder(t *testing.T) { tests := []struct { src string want string charsets []string content []string }{ {"=?utf-8?b?Q2Fmw6k=?=", "Café", nil, nil}, {"=?ISO-8859-1?Q?caf=E9?=", "café", nil, nil}, {"=?US-ASCII?Q?foo_bar?=", "foo bar", nil, nil}, {"=?utf-8?Q?=?=", "=?utf-8?Q?=?=", nil, nil}, {"=?utf-8?Q?=A?=", "=?utf-8?Q?=A?=", nil, nil}, { "=?ISO-8859-15?Q?f=F5=F6?= =?windows-1252?Q?b=E0r?=", "f\xf5\xf6b\xe0r", []string{"iso-8859-15", "windows-1252"}, []string{"f\xf5\xf6", "b\xe0r"}, }, } for _, test := range tests { i := 0 dec := &WordDecoder{ CharsetReader: func(charset string, input io.Reader) (io.Reader, error) { if charset != test.charsets[i] { t.Errorf("DecodeHeader(%q), got charset %q, want %q", test.src, charset, test.charsets[i]) } content, err := ioutil.ReadAll(input) if err != nil { t.Errorf("DecodeHeader(%q), error in reader: %v", test.src, err) } got := string(content) if got != test.content[i] { t.Errorf("DecodeHeader(%q), got content %q, want %q", test.src, got, test.content[i]) } i++ return strings.NewReader(got), nil }, } got, err := dec.DecodeHeader(test.src) if err != nil { t.Errorf("DecodeHeader(%q): %v", test.src, err) } if got != test.want { t.Errorf("DecodeHeader(%q) = %q, want %q", test.src, got, test.want) } } }
explode_data.jsonl/36206
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 727 }
[ 2830, 3393, 78172, 20732, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 3056, 1235, 341, 197, 41144, 414, 914, 198, 197, 50780, 257, 914, 198, 197, 7450, 4917, 3056, 917, 198, 197, 27751, 220, 3056, 917, 198, 197, 59403, 197, 197, 4913, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
4
func TestBackupAsOfSystemTime(t *testing.T) { defer leaktest.AfterTest(t)() const numAccounts = 1000 ctx, _, sqlDB, _, cleanupFn := BackupRestoreTestSetup(t, singleNode, numAccounts, InitNone) defer cleanupFn() var beforeTs, equalTs string var rowCount int sqlDB.QueryRow(t, `SELECT cluster_logical_timestamp()`).Scan(&beforeTs) err := crdb.ExecuteTx(ctx, sqlDB.DB.(*gosql.DB), nil /* txopts */, func(tx *gosql.Tx) error { _, err := tx.Exec(`DELETE FROM data.bank WHERE id % 4 = 1`) if err != nil { return err } return tx.QueryRow(`SELECT cluster_logical_timestamp()`).Scan(&equalTs) }) if err != nil { t.Fatal(err) } sqlDB.QueryRow(t, `SELECT count(*) FROM data.bank`).Scan(&rowCount) if expected := numAccounts * 3 / 4; rowCount != expected { t.Fatalf("expected %d rows but found %d", expected, rowCount) } beforeDir := LocalFoo + `/beforeTs` sqlDB.Exec(t, fmt.Sprintf(`BACKUP DATABASE data TO '%s' AS OF SYSTEM TIME %s`, beforeDir, beforeTs)) equalDir := LocalFoo + `/equalTs` sqlDB.Exec(t, fmt.Sprintf(`BACKUP DATABASE data TO '%s' AS OF SYSTEM TIME %s`, equalDir, equalTs)) sqlDB.Exec(t, `DROP TABLE data.bank`) sqlDB.Exec(t, `RESTORE data.* FROM $1`, beforeDir) sqlDB.QueryRow(t, `SELECT count(*) FROM data.bank`).Scan(&rowCount) if expected := numAccounts; rowCount != expected { t.Fatalf("expected %d rows but found %d", expected, rowCount) } sqlDB.Exec(t, `DROP TABLE data.bank`) sqlDB.Exec(t, `RESTORE data.* FROM $1`, equalDir) sqlDB.QueryRow(t, `SELECT count(*) FROM data.bank`).Scan(&rowCount) if expected := numAccounts * 3 / 4; rowCount != expected { t.Fatalf("expected %d rows but found %d", expected, rowCount) } }
explode_data.jsonl/57594
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 651 }
[ 2830, 3393, 56245, 2121, 2124, 2320, 1462, 1155, 353, 8840, 836, 8, 341, 16867, 23352, 1944, 36892, 2271, 1155, 8, 2822, 4777, 1629, 41369, 284, 220, 16, 15, 15, 15, 271, 20985, 11, 8358, 5704, 3506, 11, 8358, 21290, 24911, 1669, 4343...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func Test_store_LazyQuery(t *testing.T) { tests := []struct { name string req *logproto.QueryRequest expected []*logproto.Stream }{ { "all", newQuery("{foo=~\"ba.*\"}", from, from.Add(6*time.Millisecond), logproto.FORWARD), []*logproto.Stream{ { Labels: "{foo=\"bar\"}", Entries: []logproto.Entry{ { Timestamp: from, Line: "1", }, { Timestamp: from.Add(time.Millisecond), Line: "2", }, { Timestamp: from.Add(2 * time.Millisecond), Line: "3", }, { Timestamp: from.Add(3 * time.Millisecond), Line: "4", }, { Timestamp: from.Add(4 * time.Millisecond), Line: "5", }, { Timestamp: from.Add(5 * time.Millisecond), Line: "6", }, }, }, { Labels: "{foo=\"bazz\"}", Entries: []logproto.Entry{ { Timestamp: from, Line: "1", }, { Timestamp: from.Add(time.Millisecond), Line: "2", }, { Timestamp: from.Add(2 * time.Millisecond), Line: "3", }, { Timestamp: from.Add(3 * time.Millisecond), Line: "4", }, { Timestamp: from.Add(4 * time.Millisecond), Line: "5", }, { Timestamp: from.Add(5 * time.Millisecond), Line: "6", }, }, }, }, }, { "filter regex", newQuery("{foo=~\"ba.*\"} |~ \"1|2|3\" !~ \"2|3\"", from, from.Add(6*time.Millisecond), logproto.FORWARD), []*logproto.Stream{ { Labels: "{foo=\"bar\"}", Entries: []logproto.Entry{ { Timestamp: from, Line: "1", }, }, }, { Labels: "{foo=\"bazz\"}", Entries: []logproto.Entry{ { Timestamp: from, Line: "1", }, }, }, }, }, { "filter matcher", newQuery("{foo=\"bar\"}", from, from.Add(6*time.Millisecond), logproto.FORWARD), []*logproto.Stream{ { Labels: "{foo=\"bar\"}", Entries: []logproto.Entry{ { Timestamp: from, Line: "1", }, { Timestamp: from.Add(time.Millisecond), Line: "2", }, { Timestamp: from.Add(2 * time.Millisecond), Line: "3", }, { Timestamp: from.Add(3 * time.Millisecond), Line: "4", }, { Timestamp: from.Add(4 * time.Millisecond), Line: "5", }, { Timestamp: from.Add(5 * time.Millisecond), Line: "6", }, }, }, }, }, { "filter time", newQuery("{foo=~\"ba.*\"}", from, from.Add(time.Millisecond), logproto.FORWARD), []*logproto.Stream{ { Labels: "{foo=\"bar\"}", Entries: []logproto.Entry{ { Timestamp: from, Line: "1", }, }, }, { Labels: "{foo=\"bazz\"}", Entries: []logproto.Entry{ { Timestamp: from, Line: "1", }, }, }, }, }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { s := &store{ Store: storeFixture, cfg: Config{ MaxChunkBatchSize: 10, }, } ctx = user.InjectOrgID(context.Background(), "test-user") it, err := s.LazyQuery(ctx, logql.SelectParams{QueryRequest: tt.req}) if err != nil { t.Errorf("store.LazyQuery() error = %v", err) return } streams, _, err := iter.ReadBatch(it, tt.req.Limit) _ = it.Close() if err != nil { t.Fatalf("error reading batch %s", err) } assertStream(t, tt.expected, streams.Streams) }) } }
explode_data.jsonl/58941
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 2173 }
[ 2830, 3393, 14809, 2351, 13619, 2859, 1155, 353, 8840, 836, 8, 1476, 78216, 1669, 3056, 1235, 341, 197, 11609, 257, 914, 198, 197, 24395, 414, 353, 839, 15110, 15685, 1900, 198, 197, 42400, 29838, 839, 15110, 33308, 198, 197, 59403, 197...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestSeriesSort(t *testing.T) { tRef := time.Date(2017, 1, 1, 5, 30, 12, 0, time.UTC) // Create new series init := []Series{ NewSeriesFloat64("test", &SeriesInit{1, 0}, nil, 1.0, 2.0, 3.0, nil), NewSeriesInt64("test", &SeriesInit{1, 0}, nil, 1, 2, 3, nil), NewSeriesString("test", &SeriesInit{1, 0}, nil, "1", "2", "3", nil), NewSeriesTime("test", &SeriesInit{1, 0}, nil, tRef, tRef.Add(24*time.Hour), tRef.Add(2*24*time.Hour), nil), NewSeriesGeneric("test", civil.Date{}, &SeriesInit{0, 1}, nil, civil.Date{2018, time.May, 01}, civil.Date{2018, time.May, 02}, civil.Date{2018, time.May, 03}, nil), // NewSeriesMixed("test", &SeriesInit{1, 0}, nil, 1, 2, 3, nil), } // Set IsLessThanFunc(a, b interface{}) bool (init[4].(*SeriesGeneric)).SetIsLessThanFunc(nil) (init[4].(*SeriesGeneric)).SetIsLessThanFunc(func(a, b interface{}) bool { g1 := a.(civil.Date) g2 := b.(civil.Date) return g1.Before(g2) }) // (init[5].(*SeriesMixed)).SetIsLessThanFunc(func(a, b interface{}) bool { // return b.(int) > a.(int) // }) // Sort values for i := range init { s := init[i] s.Sort(context.Background(), SortOptions{Desc: true}) } expectedValues := [][]interface{}{ {3.0, 2.0, 1.0, "NaN", "NaN"}, {3, 2, 1, "NaN", "NaN"}, {"3", "2", "1", "NaN", "NaN"}, {tRef.Add(2 * 24 * time.Hour), tRef.Add(24 * time.Hour), tRef, "NaN", "NaN"}, {civil.Date{2018, time.May, 3}, civil.Date{2018, time.May, 2}, civil.Date{2018, time.May, 1}, "NaN", "NaN"}, // {3, 2, 1, "NaN", "NaN"}, } for i := range init { s := init[i] exVals := expectedValues[i] for row := 0; row < len(exVals); row++ { rowVal := s.ValueString(row) exp := exVals[row] if rowVal != fmt.Sprintf("%v", exp) { t.Errorf("wrong val: expected: %v actual: %v", exp, rowVal) } } } }
explode_data.jsonl/10003
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 805 }
[ 2830, 3393, 25544, 10231, 1155, 353, 8840, 836, 8, 1476, 3244, 3945, 1669, 882, 8518, 7, 17, 15, 16, 22, 11, 220, 16, 11, 220, 16, 11, 220, 20, 11, 220, 18, 15, 11, 220, 16, 17, 11, 220, 15, 11, 882, 87069, 692, 197, 322, 42...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestAccKeycloakSamlIdentityProvider_basic(t *testing.T) { t.Parallel() samlName := acctest.RandomWithPrefix("tf-acc") resource.Test(t, resource.TestCase{ ProviderFactories: testAccProviderFactories, PreCheck: func() { testAccPreCheck(t) }, CheckDestroy: testAccCheckKeycloakSamlIdentityProviderDestroy(), Steps: []resource.TestStep{ { Config: testKeycloakSamlIdentityProvider_basic(samlName), Check: testAccCheckKeycloakSamlIdentityProviderExists("keycloak_saml_identity_provider.saml"), }, }, }) }
explode_data.jsonl/76728
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 215 }
[ 2830, 3393, 14603, 1592, 88751, 50, 9467, 18558, 5179, 34729, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 2822, 1903, 9467, 675, 1669, 1613, 67880, 26709, 2354, 14335, 445, 8935, 12, 4475, 5130, 50346, 8787, 1155, 11, 5101, 31363, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestPhaseNetwork(t *testing.T) { runTestPhase(t, "lifecyclephases.example.com", "lifecycle_phases", "v1alpha2", true, 1, cloudup.PhaseNetwork) }
explode_data.jsonl/17507
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 57 }
[ 2830, 3393, 30733, 12320, 1155, 353, 8840, 836, 8, 341, 56742, 2271, 30733, 1155, 11, 330, 75, 19517, 759, 2264, 7724, 905, 497, 330, 75, 19517, 9782, 2264, 497, 330, 85, 16, 7141, 17, 497, 830, 11, 220, 16, 11, 9437, 454, 35989, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestSynRcvdBadSeqNumber(t *testing.T) { c := context.New(t, defaultMTU) defer c.Cleanup() // Create TCP endpoint. var err tcpip.Error c.EP, err = c.Stack().NewEndpoint(tcp.ProtocolNumber, ipv4.ProtocolNumber, &c.WQ) if err != nil { t.Fatalf("NewEndpoint failed: %s", err) } // Bind to wildcard. if err := c.EP.Bind(tcpip.FullAddress{Port: context.StackPort}); err != nil { t.Fatalf("Bind failed: %s", err) } // Start listening. if err := c.EP.Listen(10); err != nil { t.Fatalf("Listen failed: %s", err) } // Send a SYN to get a SYN-ACK. This should put the ep into SYN-RCVD state irs := seqnum.Value(context.TestInitialSequenceNumber) c.SendPacket(nil, &context.Headers{ SrcPort: context.TestPort, DstPort: context.StackPort, Flags: header.TCPFlagSyn, SeqNum: irs, RcvWnd: 30000, }) // Receive the SYN-ACK reply. b := c.GetPacket() tcpHdr := header.TCP(header.IPv4(b).Payload()) iss := seqnum.Value(tcpHdr.SequenceNumber()) tcpCheckers := []checker.TransportChecker{ checker.SrcPort(context.StackPort), checker.DstPort(context.TestPort), checker.TCPFlags(header.TCPFlagAck | header.TCPFlagSyn), checker.TCPAckNum(uint32(irs) + 1), } checker.IPv4(t, b, checker.TCP(tcpCheckers...)) // Now send a packet with an out-of-window sequence number largeSeqnum := irs + seqnum.Value(tcpHdr.WindowSize()) + 1 c.SendPacket(nil, &context.Headers{ SrcPort: context.TestPort, DstPort: context.StackPort, Flags: header.TCPFlagAck, SeqNum: largeSeqnum, AckNum: iss + 1, RcvWnd: 30000, }) // Should receive an ACK with the expected SEQ number b = c.GetPacket() tcpCheckers = []checker.TransportChecker{ checker.SrcPort(context.StackPort), checker.DstPort(context.TestPort), checker.TCPFlags(header.TCPFlagAck), checker.TCPAckNum(uint32(irs) + 1), checker.TCPSeqNum(uint32(iss + 1)), } checker.IPv4(t, b, checker.TCP(tcpCheckers...)) // Now that the socket replied appropriately with the ACK, // complete the connection to test that the large SEQ num // did not change the state from SYN-RCVD. // Get setup to be notified about connection establishment. we, ch := waiter.NewChannelEntry(nil) c.WQ.EventRegister(&we, waiter.ReadableEvents) defer c.WQ.EventUnregister(&we) // Send ACK to move to ESTABLISHED state. c.SendPacket(nil, &context.Headers{ SrcPort: context.TestPort, DstPort: context.StackPort, Flags: header.TCPFlagAck, SeqNum: irs + 1, AckNum: iss + 1, RcvWnd: 30000, }) <-ch newEP, _, err := c.EP.Accept(nil) if err != nil { t.Fatalf("Accept failed: %s", err) } // Now verify that the TCP socket is usable and in a connected state. data := "Don't panic" var r strings.Reader r.Reset(data) if _, err := newEP.Write(&r, tcpip.WriteOptions{}); err != nil { t.Fatalf("Write failed: %s", err) } pkt := c.GetPacket() tcpHdr = header.IPv4(pkt).Payload() if string(tcpHdr.Payload()) != data { t.Fatalf("unexpected data: got %s, want %s", string(tcpHdr.Payload()), data) } }
explode_data.jsonl/76012
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1244 }
[ 2830, 3393, 37134, 49, 13122, 67, 17082, 20183, 2833, 1155, 353, 8840, 836, 8, 341, 1444, 1669, 2266, 7121, 1155, 11, 1638, 8505, 52, 340, 16867, 272, 727, 60639, 2822, 197, 322, 4230, 26656, 14887, 624, 2405, 1848, 28051, 573, 6141, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
7
func TestMaxInFlightMutating(t *testing.T) { const AllowedMutatingInflightRequestsNo = 3 calls := &sync.WaitGroup{} calls.Add(AllowedMutatingInflightRequestsNo) responses := &sync.WaitGroup{} responses.Add(AllowedMutatingInflightRequestsNo) // Block is used to keep requests in flight for as long as we need to. All requests will // be unblocked at the same time. block := &sync.WaitGroup{} block.Add(1) waitForCalls := true waitForCallsMutex := sync.Mutex{} server := createMaxInflightServer(calls, block, &waitForCalls, &waitForCallsMutex, 1, AllowedMutatingInflightRequestsNo) defer server.Close() // These should hang and be accounted, i.e. saturate the server for i := 0; i < AllowedMutatingInflightRequestsNo; i++ { // These should hang waiting on block... go func() { if err := expectHTTPPost(server.URL+"/foo/bar", http.StatusOK); err != nil { t.Error(err) } responses.Done() }() } // We wait for all calls to be received by the server calls.Wait() // Disable calls notifications in the server // Disable calls notifications in the server waitForCallsMutex.Lock() waitForCalls = false waitForCallsMutex.Unlock() // Do this multiple times to show that rate limit rejected requests don't block. for i := 0; i < 2; i++ { if err := expectHTTPPost(server.URL+"/foo/bar/", errors.StatusTooManyRequests); err != nil { t.Error(err) } } // Validate that non-mutating URLs still work. use a path regex match if err := expectHTTPGet(server.URL+"/dontwait", http.StatusOK); err != nil { t.Error(err) } // Let all hanging requests finish block.Done() // Show that we recover from being blocked up. // Too avoid flakyness we need to wait until at least one of the requests really finishes. responses.Wait() if err := expectHTTPPost(server.URL+"/foo/bar", http.StatusOK); err != nil { t.Error(err) } }
explode_data.jsonl/68213
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 642 }
[ 2830, 3393, 5974, 641, 45305, 51440, 1095, 1155, 353, 8840, 836, 8, 341, 4777, 57622, 51440, 1095, 641, 38390, 35295, 2753, 284, 220, 18, 271, 1444, 5583, 1669, 609, 12996, 28384, 2808, 16094, 1444, 5583, 1904, 7, 35382, 51440, 1095, 64...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestToStringKeys(t *testing.T) { var test1 interface{} = map[interface{}]interface{}{ "Adam": "Smith", "Isaac": "Newton", } result1, err := toStringKeys(test1) th.AssertNoErr(t, err) expected := map[string]interface{}{ "Adam": "Smith", "Isaac": "Newton", } th.AssertDeepEquals(t, result1, expected) }
explode_data.jsonl/23275
{ "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, 5870, 8850, 1155, 353, 8840, 836, 8, 341, 2405, 1273, 16, 3749, 6257, 284, 2415, 58, 4970, 78134, 4970, 67066, 197, 197, 1, 37575, 788, 220, 330, 41885, 756, 197, 197, 1, 3872, 64705, 788, 330, 76377, 756, 197, 532, 9559...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestGetDeviceByName(t *testing.T) { client, _, device, err := test.NewClientServer() if err != nil { t.Fatal(err) } assert := assert.New(t) device2, err := client.GetDeviceByName(device.Name) assert.NoError(err) assert.EqualValues(device, device2) }
explode_data.jsonl/34116
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 102 }
[ 2830, 3393, 1949, 6985, 16898, 1155, 353, 8840, 836, 8, 341, 25291, 11, 8358, 3671, 11, 1848, 1669, 1273, 7121, 2959, 5475, 741, 743, 1848, 961, 2092, 341, 197, 3244, 26133, 3964, 340, 197, 532, 6948, 1669, 2060, 7121, 1155, 692, 5471...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestKubeadmConfigReconciler_Reconcile_ReturnNilIfReferencedMachineIsNotFound(t *testing.T) { g := NewWithT(t) machine := newMachine(nil, "machine") config := newKubeadmConfig(machine, "cfg") objects := []client.Object{ // intentionally omitting machine config, } myclient := helpers.NewFakeClientWithScheme(setupScheme(), objects...) k := &KubeadmConfigReconciler{ Client: myclient, } request := ctrl.Request{ NamespacedName: client.ObjectKey{ Namespace: "default", Name: "cfg", }, } _, err := k.Reconcile(ctx, request) g.Expect(err).To(BeNil()) }
explode_data.jsonl/44310
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 231 }
[ 2830, 3393, 42, 392, 3149, 76, 2648, 693, 40446, 5769, 50693, 40446, 457, 53316, 19064, 2679, 47447, 5767, 21605, 3872, 10372, 1155, 353, 8840, 836, 8, 341, 3174, 1669, 1532, 2354, 51, 1155, 692, 2109, 3814, 1669, 501, 21605, 27907, 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 TestGCPBuilder(t *testing.T) { test.CmdValidator( t, GCPBuilder(), 0, []string{flag.Output, flag.ProjectID, flag.GCPProjectID, flag.Network, flag.AtlasCIDRBlock, flag.Region}, ) }
explode_data.jsonl/1544
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 82 }
[ 2830, 3393, 38, 7123, 3297, 1155, 353, 8840, 836, 8, 341, 18185, 64512, 14256, 1006, 197, 3244, 345, 197, 9600, 7123, 3297, 3148, 197, 197, 15, 345, 197, 197, 1294, 917, 90, 9903, 34246, 11, 5181, 30944, 915, 11, 5181, 1224, 7123, 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
func TestNewPRMMatchRepository(t *testing.T) { _prm := NewPRMMatchRepository() prm, ok := _prm.(*prmMatchRepository) require.True(t, ok) assert.Equal(t, &prmMatchRepository{prmCommon{prmTypeMatchRepository}}, prm) }
explode_data.jsonl/36515
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 90 }
[ 2830, 3393, 3564, 6480, 8035, 754, 4624, 1155, 353, 8840, 836, 8, 341, 197, 5294, 76, 1669, 1532, 6480, 8035, 754, 4624, 741, 25653, 76, 11, 5394, 1669, 716, 94043, 41399, 94043, 8331, 4624, 340, 17957, 32443, 1155, 11, 5394, 340, 694...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestProviderSecretConfig(t *testing.T) { integration.ProgramTest(t, &integration.ProgramTestOptions{ Dir: "provider_secret_config", Dependencies: []string{"@pulumi/pulumi"}, Quick: true, }) }
explode_data.jsonl/76370
{ "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, 5179, 19773, 2648, 1155, 353, 8840, 836, 8, 341, 2084, 17376, 80254, 2271, 1155, 11, 609, 60168, 80254, 2271, 3798, 515, 197, 197, 6184, 25, 688, 330, 19979, 21962, 5332, 756, 197, 197, 48303, 25, 3056, 917, 4913, 31, 79, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestTargetBlankNoOpener(t *testing.T) { p := UGCPolicy() p.AddTargetBlankToFullyQualifiedLinks(true) p.AllowAttrs("target").Matching(Paragraph).OnElements("a") tests := []test{ { in: `<a href="/path" />`, expected: `<a href="/path" rel="nofollow"/>`, }, { in: `<a href="/path" target="_blank" />`, expected: `<a href="/path" target="_blank" rel="nofollow noopener"/>`, }, { in: `<a href="/path" target="foo" />`, expected: `<a href="/path" target="foo" rel="nofollow"/>`, }, { in: `<a href="https://www.google.com/" />`, expected: `<a href="https://www.google.com/" rel="nofollow noopener" target="_blank"/>`, }, { in: `<a href="https://www.google.com/" target="_blank"/>`, expected: `<a href="https://www.google.com/" target="_blank" rel="nofollow noopener"/>`, }, { in: `<a href="https://www.google.com/" rel="nofollow"/>`, expected: `<a href="https://www.google.com/" rel="nofollow noopener" target="_blank"/>`, }, { in: `<a href="https://www.google.com/" rel="noopener"/>`, expected: `<a href="https://www.google.com/" rel="nofollow noopener" target="_blank"/>`, }, { in: `<a href="https://www.google.com/" rel="noopener nofollow" />`, expected: `<a href="https://www.google.com/" rel="nofollow noopener" target="_blank"/>`, }, { in: `<a href="https://www.google.com/" target="foo" />`, expected: `<a href="https://www.google.com/" target="_blank" rel="nofollow noopener"/>`, }, } // These tests are run concurrently to enable the race detector to pick up // potential issues wg := sync.WaitGroup{} wg.Add(len(tests)) for ii, tt := range tests { go func(ii int, tt test) { out := p.Sanitize(tt.in) if out != tt.expected { t.Errorf( "test %d failed;\ninput : %s\noutput : %s\nexpected: %s", ii, tt.in, out, tt.expected, ) } wg.Done() }(ii, tt) } wg.Wait() }
explode_data.jsonl/28806
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 899 }
[ 2830, 3393, 6397, 22770, 2753, 7125, 798, 1155, 353, 8840, 836, 8, 341, 3223, 1669, 547, 38, 7123, 8018, 741, 3223, 1904, 6397, 22770, 1249, 67386, 65993, 24089, 3715, 340, 3223, 29081, 53671, 445, 5657, 1827, 64430, 7, 42165, 568, 1925...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestNodeResource(t *testing.T) { c := NewTestCluster() ctx := context.Background() nodename := "testnode" store := &storemocks.Store{} c.store = store lock := &lockmocks.DistributedLock{} store.On("CreateLock", mock.Anything, mock.Anything).Return(lock, nil) lock.On("Lock", mock.Anything).Return(context.TODO(), nil) lock.On("Unlock", mock.Anything).Return(nil) node := &types.Node{ NodeMeta: types.NodeMeta{ Name: nodename, CPU: types.CPUMap{"0": 0, "1": 10}, MemCap: 2, InitCPU: types.CPUMap{"0": 100, "1": 100}, InitMemCap: 6, NUMAMemory: types.NUMAMemory{"0": 1, "1": 1}, InitNUMAMemory: types.NUMAMemory{"0": 3, "1": 3}, }, } engine := &enginemocks.API{} engine.On("ResourceValidate", mock.Anything, mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return( fmt.Errorf("%s", "not validate"), ) node.Engine = engine // fail by validating _, err := c.NodeResource(ctx, "", false) assert.Error(t, err) // failed by GetNode store.On("GetNode", ctx, nodename).Return(nil, types.ErrNoETCD).Once() _, err = c.NodeResource(ctx, nodename, false) assert.Error(t, err) store.On("GetNode", mock.Anything, nodename).Return(node, nil) // failed by list node workloads store.On("ListNodeWorkloads", mock.Anything, mock.Anything, mock.Anything).Return(nil, types.ErrNoETCD).Once() _, err = c.NodeResource(ctx, nodename, false) assert.Error(t, err) workloads := []*types.Workload{ { ResourceMeta: types.ResourceMeta{ MemoryRequest: 1, MemoryLimit: 1, CPU: types.CPUMap{"0": 100, "1": 30}, CPUQuotaRequest: 1.3, CPUQuotaLimit: 1.3, }, }, { ResourceMeta: types.ResourceMeta{ MemoryRequest: 2, MemoryLimit: 2, CPU: types.CPUMap{"1": 50}, CPUQuotaRequest: 0.5, CPUQuotaLimit: 0.5, }, }, } store.On("ListNodeWorkloads", mock.Anything, mock.Anything, mock.Anything).Return(workloads, nil) store.On("UpdateNodes", mock.Anything, mock.Anything).Return(nil) // success but workload inspect failed nr, err := c.NodeResource(ctx, nodename, true) assert.NoError(t, err) assert.Equal(t, nr.Name, nodename) assert.NotEmpty(t, nr.Diffs) details := strings.Join(nr.Diffs, ",") assert.Contains(t, details, "inspect failed") }
explode_data.jsonl/67526
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 982 }
[ 2830, 3393, 1955, 4783, 1155, 353, 8840, 836, 8, 341, 1444, 1669, 1532, 2271, 28678, 741, 20985, 1669, 2266, 19047, 741, 9038, 347, 1840, 1669, 330, 1944, 3509, 698, 57279, 1669, 609, 4314, 16712, 82, 38047, 16094, 1444, 16114, 284, 355...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestGetRawContainerInfoRoot(t *testing.T) { var ( mockCadvisor = new(cadvisortest.Mock) mockPodManager = new(kubepodtest.MockManager) mockRuntimeCache = new(kubecontainertest.MockRuntimeCache) cadvisorReq = &cadvisorapiv1.ContainerInfoRequest{} containerPath = "/" containerInfo = &cadvisorapiv1.ContainerInfo{ ContainerReference: cadvisorapiv1.ContainerReference{ Name: containerPath, }, } ) mockCadvisor.On("ContainerInfo", containerPath, cadvisorReq).Return(containerInfo, nil) provider := newStatsProvider(mockCadvisor, mockPodManager, mockRuntimeCache, fakeContainerStatsProvider{}) _, err := provider.GetRawContainerInfo(containerPath, cadvisorReq, false) assert.NoError(t, err) mockCadvisor.AssertExpectations(t) }
explode_data.jsonl/3071
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 284 }
[ 2830, 3393, 1949, 20015, 4502, 1731, 8439, 1155, 353, 8840, 836, 8, 341, 2405, 2399, 197, 77333, 34, 81794, 257, 284, 501, 1337, 329, 2682, 371, 477, 24664, 340, 197, 77333, 23527, 2043, 256, 284, 501, 5969, 392, 747, 347, 1944, 24664...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestAutoRetryConfigurableRetries(t *testing.T) { t.Parallel() stdout := new(bytes.Buffer) stderr := new(bytes.Buffer) rootPath := copyEnvironment(t, TEST_FIXTURE_AUTO_RETRY_CONFIGURABLE_RETRIES) modulePath := util.JoinPath(rootPath, TEST_FIXTURE_AUTO_RETRY_CONFIGURABLE_RETRIES) err := runTerragruntCommand(t, fmt.Sprintf("terragrunt apply -auto-approve --terragrunt-non-interactive --terragrunt-working-dir %s", modulePath), stdout, stderr) sleeps := regexp.MustCompile("Sleeping 0s before retrying.").FindAllStringIndex(stderr.String(), -1) assert.Nil(t, err) assert.Equal(t, 4, len(sleeps)) // 5 retries, so 4 sleeps assert.Contains(t, stdout.String(), "Apply complete!") }
explode_data.jsonl/10100
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 265 }
[ 2830, 3393, 13253, 51560, 2648, 18329, 12020, 4019, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 2822, 6736, 411, 1669, 501, 23158, 22622, 340, 6736, 615, 1669, 501, 23158, 22622, 340, 33698, 1820, 1669, 2975, 12723, 1155, 11, 13602, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestIntArray_LockFunc(t *testing.T) { gtest.C(t, func(t *gtest.T) { s1 := []int{1, 2, 3, 4} a1 := garray.NewIntArrayFrom(s1, true) ch1 := make(chan int64, 3) ch2 := make(chan int64, 3) //go1 go a1.LockFunc(func(n1 []int) { //读写锁 time.Sleep(2 * time.Second) //暂停2秒 n1[2] = 6 ch2 <- gconv.Int64(time.Now().UnixNano() / 1000 / 1000) }) //go2 go func() { time.Sleep(100 * time.Millisecond) //故意暂停0.01秒,等go1执行锁后,再开始执行. ch1 <- gconv.Int64(time.Now().UnixNano() / 1000 / 1000) a1.Len() ch1 <- gconv.Int64(time.Now().UnixNano() / 1000 / 1000) }() t1 := <-ch1 t2 := <-ch1 <-ch2 //等待go1完成 // 防止ci抖动,以豪秒为单位 t.AssertGT(t2-t1, 20) //go1加的读写互斥锁,所go2读的时候被阻塞。 t.Assert(a1.Contains(6), true) }) }
explode_data.jsonl/47624
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 488 }
[ 2830, 3393, 95338, 2351, 1176, 9626, 1155, 353, 8840, 836, 8, 341, 3174, 1944, 727, 1155, 11, 2915, 1155, 353, 82038, 836, 8, 341, 197, 1903, 16, 1669, 3056, 396, 90, 16, 11, 220, 17, 11, 220, 18, 11, 220, 19, 532, 197, 11323, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestEnforceJWSAuthType(t *testing.T) { wfe, _ := setupWFE(t) testKeyIDJWS, _, _ := signRequestKeyID(t, 1, nil, "", "", wfe.nonceService) testEmbeddedJWS, _, _ := signRequestEmbed(t, nil, "", "", wfe.nonceService) // A hand crafted JWS that has both a Key ID and an embedded JWK conflictJWSBody := ` { "header": { "alg": "RS256", "jwk": { "e": "AQAB", "kty": "RSA", "n": "ppbqGaMFnnq9TeMUryR6WW4Lr5WMgp46KlBXZkNaGDNQoifWt6LheeR5j9MgYkIFU7Z8Jw5-bpJzuBeEVwb-yHGh4Umwo_qKtvAJd44iLjBmhBSxq-OSe6P5hX1LGCByEZlYCyoy98zOtio8VK_XyS5VoOXqchCzBXYf32ksVUTrtH1jSlamKHGz0Q0pRKIsA2fLqkE_MD3jP6wUDD6ExMw_tKYLx21lGcK41WSrRpDH-kcZo1QdgCy2ceNzaliBX1eHmKG0-H8tY4tPQudk-oHQmWTdvUIiHO6gSKMGDZNWv6bq74VTCsRfUEAkuWhqUhgRSGzlvlZ24wjHv5Qdlw" } }, "protected": "eyJub25jZSI6ICJibTl1WTJVIiwgInVybCI6ICJodHRwOi8vbG9jYWxob3N0L3Rlc3QiLCAia2lkIjogInRlc3RrZXkifQ", "payload": "Zm9v", "signature": "ghTIjrhiRl2pQ09vAkUUBbF5KziJdhzOTB-okM9SPRzU8Hyj0W1H5JA1Zoc-A-LuJGNAtYYHWqMw1SeZbT0l9FHcbMPeWDaJNkHS9jz5_g_Oyol8vcrWur2GDtB2Jgw6APtZKrbuGATbrF7g41Wijk6Kk9GXDoCnlfOQOhHhsrFFcWlCPLG-03TtKD6EBBoVBhmlp8DRLs7YguWRZ6jWNaEX-1WiRntBmhLqoqQFtvZxCBw_PRuaRw_RZBd1x2_BNYqEdOmVNC43UHMSJg3y_3yrPo905ur09aUTscf-C_m4Sa4M0FuDKn3bQ_pFrtz-aCCq6rcTIyxYpDqNvHMT2Q" } ` conflictJWS, err := jose.ParseSigned(conflictJWSBody) if err != nil { t.Fatal("Unable to parse conflict JWS") } testCases := []struct { Name string JWS *jose.JSONWebSignature ExpectedAuthType jwsAuthType ExpectedResult *probs.ProblemDetails ErrorStatType string }{ { Name: "Key ID and embedded JWS", JWS: conflictJWS, ExpectedAuthType: invalidAuthType, ExpectedResult: &probs.ProblemDetails{ Type: probs.MalformedProblem, Detail: "jwk and kid header fields are mutually exclusive", HTTPStatus: http.StatusBadRequest, }, ErrorStatType: "JWSAuthTypeInvalid", }, { Name: "Key ID when expected is embedded JWK", JWS: testKeyIDJWS, ExpectedAuthType: embeddedJWK, ExpectedResult: &probs.ProblemDetails{ Type: probs.MalformedProblem, Detail: "No embedded JWK in JWS header", HTTPStatus: http.StatusBadRequest, }, ErrorStatType: "JWSAuthTypeWrong", }, { Name: "Embedded JWK when expected is Key ID", JWS: testEmbeddedJWS, ExpectedAuthType: embeddedKeyID, ExpectedResult: &probs.ProblemDetails{ Type: probs.MalformedProblem, Detail: "No Key ID in JWS header", HTTPStatus: http.StatusBadRequest, }, ErrorStatType: "JWSAuthTypeWrong", }, { Name: "Key ID when expected is KeyID", JWS: testKeyIDJWS, ExpectedAuthType: embeddedKeyID, ExpectedResult: nil, }, { Name: "Embedded JWK when expected is embedded JWK", JWS: testEmbeddedJWS, ExpectedAuthType: embeddedJWK, ExpectedResult: nil, }, } for _, tc := range testCases { t.Run(tc.Name, func(t *testing.T) { wfe.stats.joseErrorCount.Reset() prob := wfe.enforceJWSAuthType(tc.JWS, tc.ExpectedAuthType) if tc.ExpectedResult == nil && prob != nil { t.Fatal(fmt.Sprintf("Expected nil result, got %#v", prob)) } else { test.AssertMarshaledEquals(t, prob, tc.ExpectedResult) } if tc.ErrorStatType != "" { test.AssertEquals(t, test.CountCounterVec( "type", tc.ErrorStatType, wfe.stats.joseErrorCount), 1) } }) } }
explode_data.jsonl/15350
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1897 }
[ 2830, 3393, 1702, 8833, 41, 7433, 5087, 929, 1155, 353, 8840, 836, 8, 341, 6692, 1859, 11, 716, 1669, 6505, 54, 11419, 1155, 692, 18185, 1592, 915, 41, 7433, 11, 8358, 716, 1669, 1841, 1900, 1592, 915, 1155, 11, 220, 16, 11, 2092, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestAzureMachineTemplate_ValidateCreate(t *testing.T) { g := NewWithT(t) tests := []struct { name string machineTemplate *AzureMachineTemplate wantErr bool }{ { name: "azuremachinetemplate with marketplane image - full", machineTemplate: createAzureMachineTemplateFromMachine( createMachineWithtMarketPlaceImage("PUB1234", "OFFER1234", "SKU1234", "1.0.0"), ), wantErr: false, }, { name: "azuremachinetemplate with marketplace image - missing publisher", machineTemplate: createAzureMachineTemplateFromMachine( createMachineWithtMarketPlaceImage("", "OFFER1234", "SKU1234", "1.0.0"), ), wantErr: true, }, { name: "azuremachinetemplate with shared gallery image - full", machineTemplate: createAzureMachineTemplateFromMachine( createMachineWithSharedImage("SUB123", "RG123", "NAME123", "GALLERY1", "1.0.0"), ), wantErr: false, }, { name: "azuremachinetemplate with marketplace image - missing subscription", machineTemplate: createAzureMachineTemplateFromMachine( createMachineWithSharedImage("", "RG123", "NAME123", "GALLERY2", "1.0.0"), ), wantErr: true, }, { name: "azuremachinetemplate with image by - with id", machineTemplate: createAzureMachineTemplateFromMachine( createMachineWithImageByID("ID123"), ), wantErr: false, }, { name: "azuremachinetemplate with image by - without id", machineTemplate: createAzureMachineTemplateFromMachine( createMachineWithImageByID(""), ), wantErr: true, }, { name: "azuremachinetemplate with valid SSHPublicKey", machineTemplate: createAzureMachineTemplateFromMachine( createMachineWithSSHPublicKey(validSSHPublicKey), ), wantErr: false, }, { name: "azuremachinetemplate without SSHPublicKey", machineTemplate: createAzureMachineTemplateFromMachine( createMachineWithSSHPublicKey(""), ), wantErr: true, }, { name: "azuremachinetemplate with invalid SSHPublicKey", machineTemplate: createAzureMachineTemplateFromMachine( createMachineWithSSHPublicKey("invalid ssh key"), ), wantErr: true, }, { name: "azuremachinetemplate with list of user-assigned identities", machineTemplate: createAzureMachineTemplateFromMachine( createMachineWithUserAssignedIdentities([]UserAssignedIdentity{{ProviderID: "azure:///123"}, {ProviderID: "azure:///456"}}), ), wantErr: false, }, { name: "azuremachinetemplate with empty list of user-assigned identities", machineTemplate: createAzureMachineTemplateFromMachine( createMachineWithUserAssignedIdentities([]UserAssignedIdentity{}), ), wantErr: true, }, { name: "azuremachinetemplate with valid osDisk cache type", machineTemplate: createAzureMachineTemplateFromMachine( createMachineWithOsDiskCacheType(string(compute.PossibleCachingTypesValues()[1])), ), wantErr: false, }, { name: "azuremachinetemplate with invalid osDisk cache type", machineTemplate: createAzureMachineTemplateFromMachine( createMachineWithOsDiskCacheType("invalid_cache_type"), ), wantErr: true, }, } for _, test := range tests { t.Run(test.name, func(t *testing.T) { err := test.machineTemplate.ValidateCreate() if test.wantErr { g.Expect(err).To(HaveOccurred()) } else { g.Expect(err).NotTo(HaveOccurred()) } }) } }
explode_data.jsonl/42150
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1303 }
[ 2830, 3393, 78107, 21605, 7275, 62, 17926, 4021, 1155, 353, 8840, 836, 8, 341, 3174, 1669, 1532, 2354, 51, 1155, 692, 78216, 1669, 3056, 1235, 341, 197, 11609, 310, 914, 198, 197, 2109, 3814, 7275, 353, 78107, 21605, 7275, 198, 197, 5...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestHeap(t *testing.T) { var ( values = []int{2, 8, 5, 1, 7, 9, 6, 3, 0, 4} ) var items []Item for _, value := range values { items = append(items, Int(value)) } heap := New(items) for index := range values { assert.Equal(t, index, int(heap.Pop().(Int)), "binaryheap.InitPop") } for _, value := range values { heap.Push(Int(value)) } for index := range values { assert.Equal(t, index, int(heap.Pop().(Int)), "binaryheap.PushPop") } }
explode_data.jsonl/80902
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 198 }
[ 2830, 3393, 27909, 1155, 353, 8840, 836, 8, 341, 2405, 2399, 197, 45939, 284, 3056, 396, 90, 17, 11, 220, 23, 11, 220, 20, 11, 220, 16, 11, 220, 22, 11, 220, 24, 11, 220, 21, 11, 220, 18, 11, 220, 15, 11, 220, 19, 532, 197, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
5
func TestToYAMLPath(t *testing.T) { tests := []struct { desc string in string expect Path }{ { desc: "all-uppercase", in: "A.B.C.D", expect: Path{"a", "b", "c", "d"}, }, } for _, tt := range tests { t.Run(tt.desc, func(t *testing.T) { if got := ToYAMLPath(tt.in); !got.Equals(tt.expect) { t.Errorf("%s: expect %v got %v", tt.desc, tt.expect, got) } }) } }
explode_data.jsonl/70570
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 219 }
[ 2830, 3393, 1249, 56, 31102, 1820, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 3056, 1235, 341, 197, 41653, 256, 914, 198, 197, 17430, 257, 914, 198, 197, 24952, 7933, 198, 197, 59403, 197, 197, 515, 298, 41653, 25, 256, 330, 541, 59...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestVolumeClaimBasicV1(t *testing.T) { yaml := ` kind: PersistentVolumeClaim apiVersion: v1 metadata: name: my-volumeclaim spec: accessModes: - ReadWriteOnce resources: requests: storage: 360Gi` volume, err := decodeVolumeClaim([]byte(yaml), CostimatorConfig{}) if err != nil { t.Error(err) return } expectedAPIVersionKindName := "v1|PersistentVolumeClaim|default|my-volumeclaim" if got := volume.APIVersionKindName; got != expectedAPIVersionKindName { t.Errorf("Expected APIVersionKindName %+v, got %+v", expectedAPIVersionKindName, got) } if got := volume.StorageClass; got != storageClassStandard { t.Errorf("Expected StorageClassName %+v, got %+v", storageClassStandard, got) } expectedStorage := int64(386547056640) requests := volume.Requests if got := requests.Storage; got != expectedStorage { t.Errorf("Expected Requests Storage %+v, got %+v", expectedStorage, got) } limits := volume.Limits if got := limits.Storage; got != expectedStorage { t.Errorf("Expected Limits Storage %+v, got %+v", expectedStorage, got) } }
explode_data.jsonl/54608
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 393 }
[ 2830, 3393, 18902, 45544, 15944, 53, 16, 1155, 353, 8840, 836, 8, 341, 14522, 9467, 1669, 22074, 220, 3093, 25, 66544, 18902, 45544, 198, 220, 6330, 5637, 25, 348, 16, 198, 220, 11160, 510, 262, 829, 25, 847, 66768, 7859, 198, 220, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestAuthTokens(t *testing.T) { startCmd := GetStartCmd() args := []string{ "--" + authTokensDefFlagName, "/services/orb/keys", "--" + authTokensDefFlagName, "/services/orb/outbox|admin&read|admin", "--" + authTokensDefFlagName, "/services/orb/inbox||admin", "--" + authTokensDefFlagName, "/services/orb/activities|read&", "--" + authTokensFlagName, "admin=ADMIN_TOKEN", "--" + authTokensFlagName, "read=READ_TOKEN", } startCmd.SetArgs(args) err := startCmd.Execute() authDefs, err := getAuthTokenDefinitions(startCmd, authTokensDefFlagName, authTokensDefEnvKey, nil) require.NoError(t, err) require.Len(t, authDefs, 4) require.Equal(t, "/services/orb/keys", authDefs[0].EndpointExpression) require.Empty(t, authDefs[0].ReadTokens) require.Empty(t, authDefs[0].WriteTokens) require.Equal(t, "/services/orb/outbox", authDefs[1].EndpointExpression) require.Len(t, authDefs[1].ReadTokens, 2) require.Equal(t, authDefs[1].ReadTokens[0], "admin") require.Equal(t, authDefs[1].ReadTokens[1], "read") require.Len(t, authDefs[1].WriteTokens, 1) require.Equal(t, authDefs[1].ReadTokens[0], "admin") require.Equal(t, "/services/orb/inbox", authDefs[2].EndpointExpression) require.Len(t, authDefs[2].ReadTokens, 0) require.Len(t, authDefs[2].WriteTokens, 1) require.Equal(t, "/services/orb/activities", authDefs[3].EndpointExpression) require.Len(t, authDefs[3].ReadTokens, 1) require.Len(t, authDefs[3].WriteTokens, 0) authTokens, err := getAuthTokens(startCmd, authTokensFlagName, authTokensEnvKey, nil) require.NoError(t, err) require.Len(t, authTokens, 2) require.Equal(t, "ADMIN_TOKEN", authTokens["admin"]) require.Equal(t, "READ_TOKEN", authTokens["read"]) clientAuthDefs, err := getAuthTokenDefinitions(startCmd, clientAuthTokensDefFlagName, clientAuthTokensDefEnvKey, authDefs) require.NoError(t, err) require.Len(t, clientAuthDefs, len(authDefs)) clientAuthTokens, err := getAuthTokens(startCmd, clientAuthTokensFlagName, clientAuthTokensEnvKey, authTokens) require.NoError(t, err) require.Len(t, clientAuthTokens, len(authTokens)) }
explode_data.jsonl/31122
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 793 }
[ 2830, 3393, 5087, 29300, 1155, 353, 8840, 836, 8, 341, 21375, 15613, 1669, 2126, 3479, 15613, 2822, 31215, 1669, 3056, 917, 515, 197, 197, 74757, 1, 488, 4166, 29300, 2620, 12135, 675, 11, 3521, 12779, 5144, 65, 14, 10563, 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, 1...
1
func TestNormalizedVariantKey(t *testing.T) { type TNormData struct { code int chrom string posindex uint8 pos uint32 epos uint32 sizeref uint8 sizealt uint8 esizeref uint8 esizealt uint8 vk uint64 eref string ealt string ref string alt string } var ndata = []TNormData{ {-2, "1", 0, 26, 26, 1, 1, 1, 1, 0x0800000d08880000, "A", "C", "A", "C"}, // invalid position {-1, "1", 1, 1, 0, 1, 1, 1, 1, 0x08000000736a947f, "J", "C", "J", "C"}, // invalid reference {4, "1", 0, 0, 0, 1, 1, 1, 1, 0x0800000008880000, "A", "C", "T", "G"}, // flip {0, "1", 0, 0, 0, 1, 1, 1, 1, 0x0800000008880000, "A", "C", "A", "C"}, // OK {32, "13", 1, 3, 3, 3, 2, 2, 1, 0x68000001fed6a22d, "DE", "D", "CDE", "CD"}, // left trim {48, "13", 0, 2, 3, 3, 3, 1, 1, 0x68000001c7868961, "D", "F", "CDE", "CFE"}, // left trim + right trim {48, "1", 0, 0, 2, 6, 6, 1, 1, 0x0800000147df7d13, "C", "K", "aBCDEF", "aBKDEF"}, // left trim + right trim {0, "1", 0, 0, 0, 1, 0, 1, 0, 0x0800000008000000, "A", "", "A", ""}, // OK {8, "1", 0, 3, 2, 1, 0, 2, 1, 0x0800000150b13d0f, "CD", "C", "D", ""}, // left extend {0, "1", 1, 25, 24, 1, 2, 1, 2, 0x0800000c111ea6eb, "Y", "CK", "Y", "CK"}, // OK {2, "1", 0, 0, 0, 1, 1, 1, 1, 0x0800000008900000, "A", "G", "G", "A"}, // swap {6, "1", 1, 1, 0, 1, 1, 1, 1, 0x0800000008880000, "A", "C", "G", "T"}, // swap + flip } for _, v := range ndata { v := v t.Run("", func(t *testing.T) { t.Parallel() vk, code := gref.NormalizedVariantKey(v.chrom, v.pos, v.posindex, v.ref, v.alt) if vk != v.vk { t.Errorf("The VK is different, got: %#v expected %#v", vk, v.vk) } if code != v.code { t.Errorf("The return code is different, got: %#v expected %#v", code, v.code) } }) } }
explode_data.jsonl/40557
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1043 }
[ 2830, 3393, 79082, 20746, 1592, 1155, 353, 8840, 836, 8, 341, 13158, 350, 24993, 1043, 2036, 341, 197, 43343, 257, 526, 198, 197, 23049, 441, 262, 914, 198, 197, 28164, 1252, 2622, 23, 198, 197, 28164, 414, 2622, 18, 17, 198, 197, 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...
3
func TestClosedIntegrate(t *testing.T) { basis := NewClosed(1, 1) levels := []uint64{0, 1, 2, 3} values := []float64{1.0, 0.25, 1.0 / 2.0 / 2.0, 1.0 / 2.0 / 2.0 / 2.0} for i := range levels { indices := internal.Compose([]uint64{levels[i]}, []uint64{0}) assert.Equal(basis.Integrate(indices), values[i], t) } }
explode_data.jsonl/27891
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 149 }
[ 2830, 3393, 26884, 1072, 57017, 1155, 353, 8840, 836, 8, 341, 2233, 10718, 1669, 1532, 26884, 7, 16, 11, 220, 16, 692, 197, 42564, 1669, 3056, 2496, 21, 19, 90, 15, 11, 220, 16, 11, 220, 17, 11, 220, 18, 532, 45939, 1669, 3056, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestPhantom_IsEnabled(t *testing.T) { for _, tc := range []struct { desc string ok bool rfErr error // MockReadFile error. spiValue int // Current SPI value. num int isEnabled bool }{ // Supported states. "only" indicates that only that phantom is on/off, and // "all" indicates that "all" phantoms for the `agc` device are in that state. {"only 1 on", true, nil, 0b00001000, 1, true}, {"only 1 off", true, nil, 0b00000111, 1, false}, {"all on 1 on", true, nil, 0b00001111, 1, true}, {"all off 1 off", true, nil, 0b00000000, 1, false}, {"only 2 on", true, nil, 0b00000100, 2, true}, {"only 2 off", true, nil, 0b00001011, 2, false}, {"all on 2 on", true, nil, 0b00001111, 2, true}, {"all off 2 off", true, nil, 0b00000000, 2, false}, {"only 15 on", true, nil, 0b00000010, 15, true}, {"only 15 off", true, nil, 0b00001101, 15, false}, {"all on 15 on", true, nil, 0b00001111, 15, true}, {"all off 15 off", true, nil, 0b00000000, 15, false}, {"only 16 on", true, nil, 0b00000001, 16, true}, {"only 16 off", true, nil, 0b00001110, 16, false}, {"all on 16 on", true, nil, 0b00001111, 16, true}, {"all off 16 off", true, nil, 0b00000000, 16, false}, // Error states. {desc: "unsupported spi value", spiValue: 99, num: 1}, {desc: "readfile error", rfErr: fmt.Errorf("mock ReadFile error"), num: 1}, } { signal, err := newInput("TestPhantom", tc.num, 16) if err != nil { t.Fatalf("error setting up test; %s", err) } t.Run(fmt.Sprintf("Phantom() %s", tc.desc), func(t *testing.T) { helpers.ResetMockReadWrite() helpers.PrepareMockReadFile([]byte{}, tc.rfErr) signal.Phantom().spi.Write(tc.spiValue) got, err := signal.Phantom().IsEnabled() if err != nil && tc.ok { t.Fatalf("unexpected error %q", err) } if err == nil && !tc.ok { t.Fatalf("expected an error") } if !tc.ok { return } if want := tc.isEnabled; got != want { t.Errorf("= %t, want %t", got, want) } }) } }
explode_data.jsonl/34846
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 854 }
[ 2830, 3393, 3357, 30002, 31879, 5462, 1155, 353, 8840, 836, 8, 341, 2023, 8358, 17130, 1669, 2088, 3056, 1235, 341, 197, 41653, 257, 914, 198, 197, 59268, 981, 1807, 198, 197, 7000, 69, 7747, 262, 1465, 442, 14563, 4418, 1703, 1465, 6...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
7
func TestSQLQueryFactoryFinalizeFail(t *testing.T) { s, _ := newMockProvider().init() fb := database.MessageQueryFactory.NewFilter(context.Background()) sel := squirrel.Select("*").From("mytable") _, _, _, err := s.filterSelect(context.Background(), "ns", sel, fb.Eq("namespace", map[bool]bool{true: false}), nil, []interface{}{"sequence"}) assert.Regexp(t, "FF10149.*namespace", err) }
explode_data.jsonl/34918
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 138 }
[ 2830, 3393, 6688, 2859, 4153, 19357, 551, 19524, 1155, 353, 8840, 836, 8, 341, 1903, 11, 716, 1669, 501, 11571, 5179, 1005, 2327, 741, 1166, 65, 1669, 4625, 8472, 2859, 4153, 7121, 5632, 5378, 19047, 2398, 1903, 301, 1669, 90524, 14752,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestMapFlat(t *testing.T) { m := Map{ "foo": "bar", "bar": Map{ "foo": "bar", }, "baz": map[string]interface{}{ "foo": "bar", }, } assert.Equal(t, Map{ "foo": "bar", "bar_foo": "bar", "baz_foo": "bar", }, m.Flat("_")) }
explode_data.jsonl/10187
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 140 }
[ 2830, 3393, 2227, 31019, 1155, 353, 8840, 836, 8, 341, 2109, 1669, 5027, 515, 197, 197, 1, 7975, 788, 330, 2257, 756, 197, 197, 1, 2257, 788, 5027, 515, 298, 197, 1, 7975, 788, 330, 2257, 756, 197, 197, 1583, 197, 197, 1, 42573, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestCheckRefErrUnsupported(t *testing.T) { query := `arr = [[1,2],[3,4]]; arr[1][0].deadbeef` _, errs := newTypeChecker().CheckBody(nil, MustParseBody(query)) if len(errs) != 1 { t.Fatalf("Expected exactly one error but got: %v", errs) } details, ok := errs[0].Details.(*RefErrUnsupportedDetail) if !ok { t.Fatalf("Expected ref err unsupported but got: %v", errs) } wantRef := MustParseRef(`arr[1][0].deadbeef`) wantPos := 2 wantHave := types.N if !wantRef.Equal(details.Ref) || wantPos != details.Pos || types.Compare(wantHave, details.Have) != 0 { t.Fatalf("Expected (%v, %v, %v) but got: (%v, %v, %v)", wantRef, wantPos, wantHave, details.Ref, details.Pos, details.Have) } }
explode_data.jsonl/14566
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 292 }
[ 2830, 3393, 3973, 3945, 7747, 41884, 1155, 353, 8840, 836, 8, 1476, 27274, 1669, 1565, 1118, 284, 4318, 16, 11, 17, 14955, 18, 11, 19, 97829, 2890, 58, 16, 1457, 15, 936, 33754, 1371, 823, 19324, 197, 6878, 70817, 1669, 501, 929, 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...
6
func TestFieldLevelName(t *testing.T) { type Test struct { String string `validate:"custom1" json:"json1"` Array []string `validate:"dive,custom2" json:"json2"` Map map[string]string `validate:"dive,custom3" json:"json3"` Array2 []string `validate:"custom4" json:"json4"` Map2 map[string]string `validate:"custom5" json:"json5"` } var res1, res2, res3, res4, res5, alt1, alt2, alt3, alt4, alt5 string validate := New() validate.RegisterTagNameFunc(func(fld reflect.StructField) string { name := strings.SplitN(fld.Tag.Get("json"), ",", 2)[0] if name == "-" { return "" } return name }) err := validate.RegisterValidation("custom1", func(fl FieldLevel) bool { res1 = fl.FieldName() alt1 = fl.StructFieldName() return true }) Equal(t, err, nil) err = validate.RegisterValidation("custom2", func(fl FieldLevel) bool { res2 = fl.FieldName() alt2 = fl.StructFieldName() return true }) Equal(t, err, nil) err = validate.RegisterValidation("custom3", func(fl FieldLevel) bool { res3 = fl.FieldName() alt3 = fl.StructFieldName() return true }) Equal(t, err, nil) err = validate.RegisterValidation("custom4", func(fl FieldLevel) bool { res4 = fl.FieldName() alt4 = fl.StructFieldName() return true }) Equal(t, err, nil) err = validate.RegisterValidation("custom5", func(fl FieldLevel) bool { res5 = fl.FieldName() alt5 = fl.StructFieldName() return true }) Equal(t, err, nil) test := Test{ String: "test", Array: []string{"1"}, Map: map[string]string{"test": "test"}, } errs := validate.Struct(test) Equal(t, errs, nil) Equal(t, res1, "json1") Equal(t, alt1, "String") Equal(t, res2, "json2[0]") Equal(t, alt2, "Array[0]") Equal(t, res3, "json3[test]") Equal(t, alt3, "Map[test]") Equal(t, res4, "json4") Equal(t, alt4, "Array2") Equal(t, res5, "json5") Equal(t, alt5, "Map2") }
explode_data.jsonl/77349
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 831 }
[ 2830, 3393, 1877, 4449, 675, 1155, 353, 8840, 836, 8, 341, 13158, 3393, 2036, 341, 197, 4980, 914, 310, 1565, 7067, 2974, 9163, 16, 1, 414, 2951, 2974, 2236, 16, 8805, 197, 58743, 220, 3056, 917, 688, 1565, 7067, 2974, 67, 533, 11, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestMsgUpdateClassMetadata(t *testing.T) { _, _, a1 := testdata.KeyTestPubAddr() tests := map[string]struct { src MsgUpdateClassMetadata expErr bool }{ "valid": { src: MsgUpdateClassMetadata{Admin: a1.String(), ClassId: "C01", Metadata: []byte("hello world")}, expErr: false, }, "invalid: bad admin address": { src: MsgUpdateClassMetadata{Admin: "???a!#)(%", ClassId: "C01", Metadata: []byte("hello world")}, expErr: true, }, "invalid: bad class ID": { src: MsgUpdateClassMetadata{Admin: a1.String(), ClassId: "6012949", Metadata: []byte("hello world")}, expErr: true, }, "invalid: no class ID": { src: MsgUpdateClassMetadata{Admin: a1.String()}, expErr: true, }, "invalid: metadata too large": { src: MsgUpdateClassMetadata{Admin: a1.String(), ClassId: "C01", Metadata: []byte(simtypes.RandStringOfLength(r, 288))}, expErr: true, }, } for msg, test := range tests { t.Run(msg, func(t *testing.T) { err := test.src.ValidateBasic() if test.expErr { require.Error(t, err) } else { require.NoError(t, err) } }) } }
explode_data.jsonl/65134
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 492 }
[ 2830, 3393, 6611, 4289, 1957, 14610, 1155, 353, 8840, 836, 8, 341, 197, 6878, 8358, 264, 16, 1669, 1273, 691, 9610, 2271, 29162, 13986, 2822, 78216, 1669, 2415, 14032, 60, 1235, 341, 197, 41144, 262, 24205, 4289, 1957, 14610, 198, 197, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestRamStoreGetByIndex(t *testing.T) { indexName := "nodeName" indexKey := "node1" indexers := cache.Indexers{ indexName: func(obj interface{}) ([]string, error) { pod, ok := obj.(*v1.Pod) if !ok { return []string{}, nil } if len(pod.Spec.NodeName) == 0 { return []string{}, nil } return []string{pod.Spec.NodeName}, nil }, } testCases := []struct { // The operations that will be executed on the storage operations func(*store) // The objects expected to be got by the indexName and indexKey expected []runtime.Object }{ { operations: func(store *store) { store.Create(&v1.Pod{ObjectMeta: metav1.ObjectMeta{Name: "pod1", Labels: map[string]string{"app": "nginx1"}}, Spec: v1.PodSpec{NodeName: indexKey}}) store.Create(&v1.Pod{ObjectMeta: metav1.ObjectMeta{Name: "pod2", Labels: map[string]string{"app": "nginx2"}}, Spec: v1.PodSpec{NodeName: indexKey}}) store.Create(&v1.Pod{ObjectMeta: metav1.ObjectMeta{Name: "pod3", Labels: map[string]string{"app": "nginx3"}}, Spec: v1.PodSpec{NodeName: "othernode"}}) }, expected: []runtime.Object{ &v1.Pod{ObjectMeta: metav1.ObjectMeta{Name: "pod1", Labels: map[string]string{"app": "nginx1"}}, Spec: v1.PodSpec{NodeName: indexKey}}, &v1.Pod{ObjectMeta: metav1.ObjectMeta{Name: "pod2", Labels: map[string]string{"app": "nginx2"}}, Spec: v1.PodSpec{NodeName: indexKey}}, }, }, { operations: func(store *store) { store.Create(&v1.Pod{ObjectMeta: metav1.ObjectMeta{Name: "pod1", Labels: map[string]string{"app": "nginx1"}}, Spec: v1.PodSpec{NodeName: indexKey}}) store.Create(&v1.Pod{ObjectMeta: metav1.ObjectMeta{Name: "pod2", Labels: map[string]string{"app": "nginx2"}}, Spec: v1.PodSpec{NodeName: indexKey}}) store.Delete("pod2") }, expected: []runtime.Object{ &v1.Pod{ObjectMeta: metav1.ObjectMeta{Name: "pod1", Labels: map[string]string{"app": "nginx1"}}, Spec: v1.PodSpec{NodeName: indexKey}}, }, }, { operations: func(store *store) { store.Create(&v1.Pod{ObjectMeta: metav1.ObjectMeta{Name: "pod1", Labels: map[string]string{"app": "nginx1"}}, Spec: v1.PodSpec{NodeName: indexKey}}) store.Update(&v1.Pod{ObjectMeta: metav1.ObjectMeta{Name: "pod1", Labels: map[string]string{"app": "nginx2"}}, Spec: v1.PodSpec{NodeName: indexKey}}) }, expected: []runtime.Object{ &v1.Pod{ObjectMeta: metav1.ObjectMeta{Name: "pod1", Labels: map[string]string{"app": "nginx2"}}, Spec: v1.PodSpec{NodeName: indexKey}}, }, }, } for i, testCase := range testCases { store := NewStore(cache.MetaNamespaceKeyFunc, indexers, testGenEvent) testCase.operations(store) objs, err := store.GetByIndex(indexName, indexKey) if err != nil { t.Errorf("%d: failed to get object by index: %v", i, err) } if !assert.ElementsMatch(t, testCase.expected, objs) { t.Errorf("%d: Expected objects:\n %v\n do not match objects retrieved from GetByIndex operation:\n %v", i, testCase.expected, objs) } } }
explode_data.jsonl/65624
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1216 }
[ 2830, 3393, 63848, 6093, 1949, 1359, 1552, 1155, 353, 8840, 836, 8, 341, 26327, 675, 1669, 330, 93451, 698, 26327, 1592, 1669, 330, 3509, 16, 698, 26327, 388, 1669, 6500, 18338, 388, 515, 197, 26327, 675, 25, 2915, 6779, 3749, 28875, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestGrayscaleRepoPersistence(t *testing.T) { if err := server.OpenTest(); err != nil { t.Fatalf("can't open test server: %v\n", err) } defer server.CloseTest() uuid, _ := initTestRepo() // Make grayscale and set various properties config := dvid.NewConfig() config.Set("BlockSize", "12,13,14") config.Set("VoxelSize", "1.1,2.8,11") config.Set("VoxelUnits", "microns,millimeters,nanometers") dataservice, err := datastore.NewData(uuid, grayscaleT, "mygrayscale", config) if err != nil { t.Errorf("Unable to create grayscale instance: %s\n", err) } grayscale, ok := dataservice.(*Data) if !ok { t.Errorf("Can't cast uint8 data service into Data\n") } oldData := *grayscale // Restart test datastore and see if datasets are still there. if err = datastore.SaveDataByUUID(uuid, grayscale); err != nil { t.Fatalf("Unable to save repo during grayscale persistence test: %v\n", err) } datastore.CloseReopenTest() dataservice2, err := datastore.GetDataByUUIDName(uuid, "mygrayscale") if err != nil { t.Fatalf("Can't get grayscale instance from reloaded test db: %v\n", err) } grayscale2, ok := dataservice2.(*Data) if !ok { t.Errorf("Returned new data instance 2 is not imageblk.Data\n") } if !oldData.Equals(grayscale2) { t.Errorf("Expected %v, got %v\n", oldData, *grayscale2) } }
explode_data.jsonl/31328
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 527 }
[ 2830, 3393, 6464, 50348, 25243, 71562, 1155, 353, 8840, 836, 8, 341, 743, 1848, 1669, 3538, 12953, 2271, 2129, 1848, 961, 2092, 341, 197, 3244, 30762, 445, 4814, 944, 1787, 1273, 3538, 25, 1018, 85, 1699, 497, 1848, 340, 197, 532, 168...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
8
func TestDeriveMultiSigSegwit(t *testing.T) { xpubs := []string{ "tpubDAiPiLZeUdwo9oJiE9GZnteXj2E2MEMUb4knc4yCD87bL9siDgYcvrZSHZQZcYTyraL3fxVBRCcMiyfr3oQfH1wNo8J5i8aRAN56dDXaZxC", "tpubDBYBpkSfvt9iVSfdX2ArZq1Q8bVSro3sotbJhdZCG9rgfjdr4aZp7g7AF1P9w95X5fzuJzdZAqYWWU7nb37c594wR22hPY5VpYziXUN2yez", "tpubDAaTEMnf9SPKJweLaptFdy3Vmyhim5DKQxXRbsCxmAaUp8F84YD5GhdfmABwLddjHTftSVvUPuSru6vJ3b5N2hBveiGmZNE5N5yvB6WZ96c", "tpubDAXKYCetkje8HRRhAvUbAyuC5iF3SgfFWCVXfmrGCw3H9ExCYZVTEoeg7TjtDhgkS7TNHDRZUQNzGACWVzZCAYXy79vqku5z1geYmnsNLaa", } deriver := NewAddressDeriver(Testnet, xpubs, 2, "") assert.Equal(t, "2N4TmnHspa8wqFEUfxfjzHoSUAgwoUwNWhr", deriver.Derive(0, 0).String()) }
explode_data.jsonl/80965
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 455 }
[ 2830, 3393, 22171, 533, 20358, 47246, 10998, 88519, 1155, 353, 8840, 836, 8, 341, 10225, 9585, 82, 1669, 3056, 917, 515, 197, 197, 1, 790, 392, 6352, 72, 34767, 43, 59462, 52, 67, 1126, 24, 78, 41, 72, 36, 24, 38, 57, 23446, 55, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestScpGetRemote(t *testing.T) { t.Parallel() fs := new(afero.MemMapFs) tests := []struct { path string content []byte ignore bool }{ {"http://Foo.Bar/foo_Bar-Foo", []byte(`T€st Content 123`), false}, {"http://Doppel.Gänger/foo_Bar-Foo", []byte(`T€st Cont€nt 123`), false}, {"http://Doppel.Gänger/Fizz_Bazz-Foo", []byte(`T€st Банковский кассир Cont€nt 123`), false}, {"http://Doppel.Gänger/Fizz_Bazz-Bar", []byte(`T€st Банковский кассир Cont€nt 456`), true}, } for _, test := range tests { msg := fmt.Sprintf("%v", test) req, err := http.NewRequest("GET", test.path, nil) require.NoError(t, err, msg) srv, cl := getTestServer(func(w http.ResponseWriter, r *http.Request) { w.Write(test.content) }) defer func() { srv.Close() }() cfg := viper.New() c, err := getRemote(req, fs, cfg, cl) require.NoError(t, err, msg) assert.Equal(t, string(test.content), string(c)) c, err = getCache(req.URL.String(), fs, cfg, test.ignore) require.NoError(t, err, msg) if test.ignore { assert.Empty(t, c, msg) } else { assert.Equal(t, string(test.content), string(c)) } } }
explode_data.jsonl/69218
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 525 }
[ 2830, 3393, 3326, 79, 1949, 24703, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 741, 53584, 1669, 501, 2877, 802, 78, 1321, 336, 2227, 48300, 692, 78216, 1669, 3056, 1235, 341, 197, 26781, 262, 914, 198, 197, 27751, 3056, 3782, 19...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestAssessRunStatusErrorMessageFromProviderInDryRunMode(t *testing.T) { providerMessage := "Provider Error" status, message, dryRunSummary := StartAssessRunStatusErrorMessageFromProvider(t, providerMessage, true) assert.Equal(t, v1alpha1.AnalysisPhaseSuccessful, status) assert.Equal(t, "", message) expectedDryRunSummary := v1alpha1.RunSummary{ Count: 2, Successful: 1, Failed: 1, Inconclusive: 0, Error: 0, } assert.Equal(t, &expectedDryRunSummary, dryRunSummary) }
explode_data.jsonl/75845
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 196 }
[ 2830, 3393, 5615, 433, 6727, 2522, 21349, 3830, 5179, 641, 85215, 6727, 3636, 1155, 353, 8840, 836, 8, 341, 197, 19979, 2052, 1669, 330, 5179, 4600, 698, 23847, 11, 1943, 11, 9058, 6727, 19237, 1669, 5145, 5615, 433, 6727, 2522, 21349, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestCallFunctionFailsOnNonFunction(t *testing.T) { t.Parallel() ctx := NewIsolate().NewContext() ob, _ := ctx.Eval(`({x:3})`, "") res, err := ob.Call(nil) if err == nil { t.Fatalf("Expected err, but got %v", res) } else if err.Error() != "Not a function" { t.Errorf("Wrong error message: %q", err) } }
explode_data.jsonl/81560
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 133 }
[ 2830, 3393, 7220, 5152, 37, 6209, 1925, 8121, 5152, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 741, 20985, 1669, 1532, 3872, 33066, 1005, 3564, 1972, 741, 63353, 11, 716, 1669, 5635, 5142, 831, 5809, 2306, 87, 25, 18, 5410, 7808...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestGetHostPublicIPv4AddressFromEC2Metadata(t *testing.T) { ctrl := gomock.NewController(t) defer ctrl.Finish() ec2MetadataClient := mock_ec2.NewMockEC2MetadataClient(ctrl) ec2Client := mock_ec2.NewMockClient(ctrl) agent := &ecsAgent{ ec2MetadataClient: ec2MetadataClient, ec2Client: ec2Client, } ec2MetadataClient.EXPECT().PublicIPv4Address().Return(hostPublicIPv4Address, nil) assert.Equal(t, hostPublicIPv4Address, agent.getHostPublicIPv4AddressFromEC2Metadata()) }
explode_data.jsonl/41608
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 193 }
[ 2830, 3393, 1949, 9296, 12676, 58056, 19, 4286, 3830, 7498, 17, 14610, 1155, 353, 8840, 836, 8, 341, 84381, 1669, 342, 316, 1176, 7121, 2051, 1155, 340, 16867, 23743, 991, 18176, 2822, 197, 757, 17, 14610, 2959, 1669, 7860, 36844, 17, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestClient_HKeys(t *testing.T) { mc := minimock.NewController(t) defer mc.Finish() tests := []struct { name string arg string expectCommand string mockResponse *api.ExecuteCommandResponse mockErr error wantResult ListResult }{ { name: "could_not_execute_command", arg: "key", expectCommand: "HKEYS key", mockErr: errors.New("something went wrong"), wantResult: ListResult{ err: errors.New("could not execute command: something went wrong"), }, }, { name: "server_responds_with_error", arg: "key", expectCommand: "HKEYS key", mockResponse: &api.ExecuteCommandResponse{ Reply: api.ErrCommandReply, Item: "internal server error", }, wantResult: ListResult{ err: errors.New("internal server error"), }, }, { name: "server_responds_with_nil", arg: "key", expectCommand: "HKEYS key", mockResponse: &api.ExecuteCommandResponse{ Reply: api.NilCommandReply, }, wantResult: ListResult{}, }, { name: "server_responds_with_slice", arg: "key", expectCommand: "HKEYS key", mockResponse: &api.ExecuteCommandResponse{ Reply: api.SliceCommandReply, Items: []string{"string1", "string2"}, }, wantResult: ListResult{val: []string{"string1", "string2"}}, }, { name: "server_responds_with_unexpected_reply", arg: "key", expectCommand: "HKEYS key", mockResponse: &api.ExecuteCommandResponse{ Reply: api.StringCommandReply, Item: "string", }, wantResult: ListResult{err: errors.New("unexpected reply: STRING")}, }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { mock := NewexecutorMock(mc) mock.ExecuteCommandMock. Expect(context.Background(), &api.ExecuteCommandRequest{Command: tt.expectCommand}). Return(tt.mockResponse, tt.mockErr) cl := Client{executor: mock} res := cl.HKeys(tt.arg) assert.Equal(t, tt.wantResult, res) }) } }
explode_data.jsonl/18542
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 945 }
[ 2830, 3393, 2959, 2039, 8850, 1155, 353, 8840, 836, 8, 341, 97662, 1669, 21187, 1176, 7121, 2051, 1155, 340, 16867, 19223, 991, 18176, 2822, 78216, 1669, 3056, 1235, 341, 197, 11609, 688, 914, 198, 197, 47903, 1843, 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...
1
func TestReminderExecution(t *testing.T) { testActorsRuntime := newTestActorsRuntime() actorType, actorID := getTestActorTypeAndID() actorKey := testActorsRuntime.constructCompositeKey(actorType, actorID) fakeCallAndActivateActor(testActorsRuntime, actorKey) err := testActorsRuntime.executeReminder(actorType, actorID, "2s", "2s", "reminder1", "data") assert.Nil(t, err) }
explode_data.jsonl/12874
{ "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, 95359, 20294, 1155, 353, 8840, 836, 8, 341, 18185, 2414, 1087, 15123, 1669, 501, 2271, 2414, 1087, 15123, 741, 93410, 929, 11, 12089, 915, 1669, 633, 2271, 18870, 929, 3036, 915, 741, 93410, 1592, 1669, 1273, 2414, 1087, 151...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestGuild_sortChannels(t *testing.T) { snowflakes := []Snowflake{ NewSnowflake(6), NewSnowflake(65), NewSnowflake(324), NewSnowflake(5435), NewSnowflake(63453), NewSnowflake(111111111), } guild := NewGuild() for i := range snowflakes { channel := NewChannel() channel.ID = snowflakes[len(snowflakes)-1-i] // reverse guild.Channels = append(guild.Channels, channel) } guild.sortChannels() for i, c := range guild.Channels { if snowflakes[i] != c.ID { t.Error("channels in guild did not sort correctly") } } }
explode_data.jsonl/55145
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 224 }
[ 2830, 3393, 72574, 18435, 35925, 1155, 353, 8840, 836, 8, 341, 1903, 3328, 1489, 2050, 1669, 3056, 62285, 63456, 515, 197, 197, 3564, 62285, 63456, 7, 21, 1326, 197, 197, 3564, 62285, 63456, 7, 21, 20, 1326, 197, 197, 3564, 62285, 634...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestBindFunctionCall(t *testing.T) { env := environment(map[string]interface{}{ "f0": NewFunction(StaticFunctionSignature{ Parameters: []Parameter{ {Name: "foo", Type: StringType}, {Name: "bar", Type: IntType}, }, ReturnType: BoolType, }), "f1": NewFunction(StaticFunctionSignature{ Parameters: []Parameter{ {Name: "foo", Type: StringType}, }, VarargsParameter: &Parameter{ Name: "bar", Type: IntType, }, ReturnType: BoolType, }), "a": NewOutputType(StringType), "b": NewPromiseType(StringType), "c": NewOutputType(IntType), "d": NewPromiseType(IntType), }) scope := env.scope() cases := []exprTestCase{ // Standard calls {x: `f0("foo", 0)`, t: BoolType}, {x: `f1("foo")`, t: BoolType}, {x: `f1("foo", 1, 2, 3)`, t: BoolType}, // Lifted calls {x: `f0(a, 0)`, t: NewOutputType(BoolType)}, {x: `f0(b, 0)`, t: NewPromiseType(BoolType)}, {x: `f0("foo", c)`, t: NewOutputType(BoolType)}, {x: `f0("foo", d)`, t: NewPromiseType(BoolType)}, {x: `f0(a, d)`, t: NewOutputType(BoolType)}, {x: `f0(b, c)`, t: NewOutputType(BoolType)}, {x: `f1(a)`, t: NewOutputType(BoolType)}, {x: `f1(b)`, t: NewPromiseType(BoolType)}, {x: `f1("foo", c)`, t: NewOutputType(BoolType)}, {x: `f1("foo", d)`, t: NewPromiseType(BoolType)}, {x: `f1("foo", c, d)`, t: NewOutputType(BoolType)}, } for _, c := range cases { t.Run(c.x, func(t *testing.T) { expr, diags := BindExpressionText(c.x, scope, hcl.Pos{}) assert.Len(t, diags, 0) assert.Equal(t, c.t, expr.Type()) _, ok := expr.(*FunctionCallExpression) assert.True(t, ok) assert.Equal(t, c.x, fmt.Sprintf("%v", expr)) }) } }
explode_data.jsonl/42566
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 790 }
[ 2830, 3393, 9950, 5152, 7220, 1155, 353, 8840, 836, 8, 341, 57538, 1669, 4573, 9147, 14032, 31344, 67066, 197, 197, 96171, 15, 788, 1532, 5152, 7, 11690, 5152, 25088, 515, 298, 197, 9706, 25, 3056, 4971, 515, 571, 197, 63121, 25, 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 TestChannelDemux_WithInvalidChannel(t *testing.T) { outputChannels := make(map[OutputLineId]chan Signal, 1) outputChannels[0] = make(chan Signal, 1) dmux := ChannelDemux{ OutputChannels: outputChannels, Selector: func(inputSignal Signal) (outputLineId int, err error) { return -2, nil //return some id not in output channels }, } id, err := dmux.Demux("abc") if err == nil { t.Errorf("expected error (but got none) while demuxing , as configured selector returned a channel id does not exist") } if id >= 0 { t.Errorf("configured selector always returns an invalid output line id, but we got a valid one : %v", id) } }
explode_data.jsonl/58641
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 218 }
[ 2830, 3393, 9629, 32003, 2200, 62, 2354, 7928, 9629, 1155, 353, 8840, 836, 8, 1476, 21170, 35925, 1669, 1281, 9147, 58, 5097, 2460, 764, 60, 5658, 27230, 11, 220, 16, 340, 21170, 35925, 58, 15, 60, 284, 1281, 35190, 27230, 11, 220, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestBubble(t *testing.T) { type args struct { array []int } tests := []struct { name string args args want []int }{ // TODO: Add test cases. {name: "test_1", args: args{array: []int{1, 2, 3}}, want: []int{1, 2, 3}}, {name: "test_2", args: args{array: []int{3, 2, 1}}, want: []int{1, 2, 3}}, {name: "test_3", args: args{array: []int{3, 1, 2}}, want: []int{1, 2, 3}}, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { if got := Bubble(tt.args.array); !reflect.DeepEqual(got, tt.want) { t.Errorf("Bubble() = %v, want %v", got, tt.want) } }) } }
explode_data.jsonl/7250
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 289 }
[ 2830, 3393, 75778, 1155, 353, 8840, 836, 8, 341, 13158, 2827, 2036, 341, 197, 11923, 3056, 396, 198, 197, 532, 78216, 1669, 3056, 1235, 341, 197, 11609, 914, 198, 197, 31215, 2827, 198, 197, 50780, 3056, 396, 198, 197, 59403, 197, 197...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestNeedsADRParamSetupReq(t *testing.T) { type TestCase struct { Name string InputDevice *ttnpb.EndDevice Band *band.Band Needs bool } var tcs []TestCase ForEachBand(t, func(makeBandName func(parts ...string) string, phy *band.Band, _ ttnpb.PHYVersion) { tcs = append(tcs, TestCase{ Name: makeBandName("no MAC state"), InputDevice: &ttnpb.EndDevice{}, Band: phy, }, ) for _, conf := range []struct { Suffix string CurrentParameters, DesiredParameters ttnpb.MACParameters Needs bool }{ { Suffix: "current(limit:nil,delay:nil),desired(limit:nil,delay:nil)", }, { Suffix: "current(limit:32768,delay:1024),desired(limit:32768,delay:1024)", CurrentParameters: ttnpb.MACParameters{ AdrAckLimitExponent: &ttnpb.ADRAckLimitExponentValue{ Value: ttnpb.ADR_ACK_LIMIT_32768, }, AdrAckDelayExponent: &ttnpb.ADRAckDelayExponentValue{ Value: ttnpb.ADR_ACK_DELAY_1024, }, }, DesiredParameters: ttnpb.MACParameters{ AdrAckLimitExponent: &ttnpb.ADRAckLimitExponentValue{ Value: ttnpb.ADR_ACK_LIMIT_32768, }, AdrAckDelayExponent: &ttnpb.ADRAckDelayExponentValue{ Value: ttnpb.ADR_ACK_DELAY_1024, }, }, }, { Suffix: "current(limit:32768,delay:1024),desired(limit:nil,delay:nil)", CurrentParameters: ttnpb.MACParameters{ AdrAckLimitExponent: &ttnpb.ADRAckLimitExponentValue{ Value: ttnpb.ADR_ACK_LIMIT_32768, }, AdrAckDelayExponent: &ttnpb.ADRAckDelayExponentValue{ Value: ttnpb.ADR_ACK_DELAY_1024, }, }, }, { Suffix: "current(limit:nil,delay:1024),desired(limit:32768,delay:1024)", CurrentParameters: ttnpb.MACParameters{ AdrAckDelayExponent: &ttnpb.ADRAckDelayExponentValue{ Value: ttnpb.ADR_ACK_DELAY_1024, }, }, DesiredParameters: ttnpb.MACParameters{ AdrAckLimitExponent: &ttnpb.ADRAckLimitExponentValue{ Value: ttnpb.ADR_ACK_LIMIT_32768, }, AdrAckDelayExponent: &ttnpb.ADRAckDelayExponentValue{ Value: ttnpb.ADR_ACK_DELAY_1024, }, }, Needs: phy.ADRAckLimit != ttnpb.ADR_ACK_LIMIT_32768, }, { Suffix: "current(limit:nil,delay:nil),desired(limit:32768,delay:1024)", DesiredParameters: ttnpb.MACParameters{ AdrAckLimitExponent: &ttnpb.ADRAckLimitExponentValue{ Value: ttnpb.ADR_ACK_LIMIT_32768, }, AdrAckDelayExponent: &ttnpb.ADRAckDelayExponentValue{ Value: ttnpb.ADR_ACK_DELAY_1024, }, }, Needs: phy.ADRAckLimit != ttnpb.ADR_ACK_LIMIT_32768 || phy.ADRAckDelay != ttnpb.ADR_ACK_DELAY_1024, }, { Suffix: "current(limit:32768,delay:nil),desired(limit:nil,delay:1024)", CurrentParameters: ttnpb.MACParameters{ AdrAckLimitExponent: &ttnpb.ADRAckLimitExponentValue{ Value: ttnpb.ADR_ACK_LIMIT_32768, }, }, DesiredParameters: ttnpb.MACParameters{ AdrAckDelayExponent: &ttnpb.ADRAckDelayExponentValue{ Value: ttnpb.ADR_ACK_DELAY_1024, }, }, Needs: phy.ADRAckDelay != ttnpb.ADR_ACK_DELAY_1024, }, { Suffix: "current(limit:32768,delay:1024),desired(limit:32768,delay:2048)", CurrentParameters: ttnpb.MACParameters{ AdrAckLimitExponent: &ttnpb.ADRAckLimitExponentValue{ Value: ttnpb.ADR_ACK_LIMIT_32768, }, AdrAckDelayExponent: &ttnpb.ADRAckDelayExponentValue{ Value: ttnpb.ADR_ACK_DELAY_1024, }, }, DesiredParameters: ttnpb.MACParameters{ AdrAckLimitExponent: &ttnpb.ADRAckLimitExponentValue{ Value: ttnpb.ADR_ACK_LIMIT_32768, }, AdrAckDelayExponent: &ttnpb.ADRAckDelayExponentValue{ Value: ttnpb.ADR_ACK_DELAY_2048, }, }, Needs: true, }, } { ForEachMACVersion(t, func(makeMACName func(parts ...string) string, macVersion ttnpb.MACVersion) { tcs = append(tcs, TestCase{ Name: makeBandName(makeMACName(conf.Suffix)), InputDevice: &ttnpb.EndDevice{ MacState: &ttnpb.MACState{ LorawanVersion: macVersion, CurrentParameters: conf.CurrentParameters, DesiredParameters: conf.DesiredParameters, }, }, Band: phy, Needs: conf.Needs && macVersion.Compare(ttnpb.MAC_V1_1) >= 0, }, ) }) } }) for _, tc := range tcs { tc := tc test.RunSubtest(t, test.SubtestConfig{ Name: tc.Name, Parallel: true, Func: func(ctx context.Context, t *testing.T, a *assertions.Assertion) { dev := CopyEndDevice(tc.InputDevice) res := DeviceNeedsADRParamSetupReq(dev, tc.Band) if tc.Needs { a.So(res, should.BeTrue) } else { a.So(res, should.BeFalse) } a.So(dev, should.Resemble, tc.InputDevice) }, }) } }
explode_data.jsonl/38427
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 2436 }
[ 2830, 3393, 65064, 96473, 2001, 21821, 27234, 1155, 353, 8840, 836, 8, 341, 13158, 30573, 2036, 341, 197, 21297, 286, 914, 198, 197, 66588, 6985, 353, 83, 1517, 16650, 18569, 6985, 198, 197, 12791, 437, 286, 353, 7053, 1785, 437, 198, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestEmptyFile(t *testing.T) { tmpdir, err := ioutil.TempDir("", "disk_endpoint_test") if err != nil { t.Fatalf("Unable to create temp directory: %+v", err) } defer os.RemoveAll(tmpdir) // Make sure that it starts clean, and a newly stored data can be retrieved. testBrandNewDiskPersistenceCanStoreAndRetrieve(t, tmpdir, "empty", testStruct{Value: 10}) // Overwrite the state file to an empty file. ioutil.WriteFile(path.Join(tmpdir, "empty.json"), []byte{}, 0644) p, err := NewDiskPersistence(tmpdir) if err != nil { t.Fatalf("Unable to create new DiskPersistence") } var v testStruct err = p.Value("empty").Load(&v) // If we wrote the wrong file, the error would be nil. // If the library couldn't handle empty file, the error wouldn't be ErrNotFound. if err != ErrNotFound { t.Fatalf("Expected NotFound error but found %+v", err) } }
explode_data.jsonl/16546
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 300 }
[ 2830, 3393, 3522, 1703, 1155, 353, 8840, 836, 8, 341, 20082, 3741, 11, 1848, 1669, 43144, 65009, 6184, 19814, 330, 30496, 36699, 4452, 1138, 743, 1848, 961, 2092, 341, 197, 3244, 30762, 445, 17075, 311, 1855, 2730, 6220, 25, 68524, 85, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
4
func TestLsLong(t *testing.T) { ctx := context.Background() r := fstest.NewRun(t) defer r.Finalise() file1 := r.WriteBoth(ctx, "potato2", "------------------------------------------------------------", t1) file2 := r.WriteBoth(ctx, "empty space", "-", t2) fstest.CheckItems(t, r.Fremote, file1, file2) var buf bytes.Buffer err := operations.ListLong(ctx, r.Fremote, &buf) require.NoError(t, err) res := buf.String() lines := strings.Split(strings.Trim(res, "\n"), "\n") assert.Equal(t, 2, len(lines)) timeFormat := "2006-01-02 15:04:05.000000000" precision := r.Fremote.Precision() location := time.Now().Location() checkTime := func(m, filename string, expected time.Time) { modTime, err := time.ParseInLocation(timeFormat, m, location) // parse as localtime if err != nil { t.Errorf("Error parsing %q: %v", m, err) } else { fstest.AssertTimeEqualWithPrecision(t, filename, expected, modTime, precision) } } m1 := regexp.MustCompile(`(?m)^ 1 (\d{4}-\d\d-\d\d \d\d:\d\d:\d\d\.\d{9}) empty space$`) if ms := m1.FindStringSubmatch(res); ms == nil { t.Errorf("empty space missing: %q", res) } else { checkTime(ms[1], "empty space", t2.Local()) } m2 := regexp.MustCompile(`(?m)^ 60 (\d{4}-\d\d-\d\d \d\d:\d\d:\d\d\.\d{9}) potato2$`) if ms := m2.FindStringSubmatch(res); ms == nil { t.Errorf("potato2 missing: %q", res) } else { checkTime(ms[1], "potato2", t1.Local()) } }
explode_data.jsonl/51927
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 608 }
[ 2830, 3393, 43, 82, 6583, 1155, 353, 8840, 836, 8, 341, 20985, 1669, 2266, 19047, 741, 7000, 1669, 48434, 477, 7121, 6727, 1155, 340, 16867, 435, 991, 977, 1064, 741, 17661, 16, 1669, 435, 4073, 20629, 7502, 11, 330, 19099, 4330, 17, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func Test(t *testing.T) { a := assertions.New(t) A := memory.New() B := memory.New() err := New(A, B).HandleLog(&Entry{ message: "foo", fields: log.Fields(), time: time.Now(), level: log.DebugLevel, }) a.So(err, assertions.ShouldBeNil) a.So(A.Entries, assertions.ShouldHaveLength, 1) a.So(B.Entries, assertions.ShouldHaveLength, 1) }
explode_data.jsonl/49344
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 152 }
[ 2830, 3393, 1155, 353, 8840, 836, 8, 341, 11323, 1669, 54836, 7121, 1155, 692, 22985, 1669, 4938, 7121, 741, 12791, 1669, 4938, 7121, 2822, 9859, 1669, 1532, 4346, 11, 425, 568, 6999, 2201, 2099, 5874, 515, 197, 24753, 25, 330, 7975, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestGetAPIPath(t *testing.T) { apiPath := Go.GetAPIPath() v := runtime.Version()[2:] v = v[:3] verNum, err := strconv.ParseFloat(v, 64) if nil != err { t.Error(err) return } if verNum >= 1.4 { if !strings.HasSuffix(apiPath, "src") { t.Error("api path should end with \"src\"") return } } else { if !strings.HasSuffix(apiPath, "pkg") { t.Error("api path should end with \"pkg\"") } } }
explode_data.jsonl/152
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 192 }
[ 2830, 3393, 1949, 7082, 1820, 1155, 353, 8840, 836, 8, 341, 54299, 1820, 1669, 5994, 2234, 7082, 1820, 2822, 5195, 1669, 15592, 35842, 10116, 17, 24135, 5195, 284, 348, 3447, 18, 2533, 197, 423, 4651, 11, 1848, 1669, 33317, 8937, 5442, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestUnsubscribeUnblockPost(t *testing.T) { mux := new(TypeMux) defer mux.Stop() sub := mux.Subscribe(testEvent(0)) unblocked := make(chan bool) go func() { mux.Post(testEvent(5)) unblocked <- true }() select { case <-unblocked: t.Errorf("Post returned before Unsubscribe") default: sub.Unsubscribe() <-unblocked } }
explode_data.jsonl/61575
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 145 }
[ 2830, 3393, 1806, 9384, 1806, 4574, 4133, 1155, 353, 8840, 836, 8, 341, 2109, 2200, 1669, 501, 22498, 44, 2200, 340, 16867, 59807, 30213, 2822, 28624, 1669, 59807, 82628, 8623, 1556, 7, 15, 1171, 20479, 61348, 1669, 1281, 35190, 1807, 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 TestErrorToFault(t *testing.T) { assert.Nil(t, ErrorToFault(nil)) f := ErrorToFault(errors.New("test")) if assert.NotNil(t, f) { assert.Equal(t, reasoncode.ReasonCode(""), f.ReasonCode) assert.Equal(t, "test", f.Message) } f = ErrorToFault(NewError("MyCode", "My message")) if assert.NotNil(t, f) { assert.Equal(t, reasoncode.ReasonCode("MyCode"), f.ReasonCode) assert.Equal(t, "My message", f.Message) } }
explode_data.jsonl/17709
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 181 }
[ 2830, 3393, 1454, 1249, 58780, 1155, 353, 8840, 836, 8, 341, 6948, 59678, 1155, 11, 4600, 1249, 58780, 27907, 4390, 1166, 1669, 4600, 1249, 58780, 38881, 7121, 445, 1944, 5455, 743, 2060, 93882, 1155, 11, 282, 8, 341, 197, 6948, 12808, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestAddServiceWithProperties(t *testing.T) { r := newTestResolver(t) defer r.Close() ctx := viewertest.NewContext(context.Background(), r.client) mr := r.Mutation() serviceTypeStrValue := "Foo" serviceStrPropType := models.PropertyTypeInput{ Name: "service_str_prop", Type: "string", StringValue: &serviceTypeStrValue, } servicePropTypeInput := []*models.PropertyTypeInput{&serviceStrPropType} serviceType, err := mr.AddServiceType(ctx, models.ServiceTypeCreateData{ Name: "Internet Access", HasCustomer: false, Properties: servicePropTypeInput}) require.NoError(t, err) propertyType, err := serviceType.QueryPropertyTypes().Only(ctx) require.NoError(t, err) serviceStrValue := "Bar" serviceStrProp := models.PropertyInput{PropertyTypeID: propertyType.ID, StringValue: &serviceStrValue} servicePropInput := []*models.PropertyInput{&serviceStrProp} service, err := mr.AddService(ctx, models.ServiceCreateData{ Name: "Kent building, room 201", ServiceTypeID: serviceType.ID, Properties: servicePropInput, Status: pointerToServiceStatus(models.ServiceStatusPending), }) require.NoError(t, err) fetchedProperty, err := service.QueryProperties().Only(ctx) require.NoError(t, err) assert.Equal(t, pointer.GetString(fetchedProperty.StringVal), serviceStrValue) }
explode_data.jsonl/7202
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 453 }
[ 2830, 3393, 2212, 1860, 2354, 7903, 1155, 353, 8840, 836, 8, 341, 7000, 1669, 501, 2271, 18190, 1155, 340, 16867, 435, 10421, 741, 20985, 1669, 1651, 83386, 7121, 1972, 5378, 19047, 1507, 435, 6581, 692, 2109, 81, 1669, 435, 1321, 22705...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestMapProxy_RemoveIfSameWithNilKey(t *testing.T) { _, err := mp.RemoveIfSame(nil, "test") AssertErrorNotNil(t, err, "remove did not return an error for nil key") mp.Clear() }
explode_data.jsonl/56970
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 69 }
[ 2830, 3393, 2227, 16219, 66843, 2679, 19198, 2354, 19064, 1592, 1155, 353, 8840, 836, 8, 341, 197, 6878, 1848, 1669, 10490, 13270, 2679, 19198, 27907, 11, 330, 1944, 1138, 18017, 1454, 96144, 1155, 11, 1848, 11, 330, 5399, 1521, 537, 47...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestLiveUpdateRunTriggerLocalContainer(t *testing.T) { f := newBDFixture(t, k8s.EnvDockerDesktop, container.RuntimeDocker) defer f.TearDown() runs := []model.LiveUpdateRunStep{ model.LiveUpdateRunStep{Command: model.ToUnixCmd("echo hello")}, model.LiveUpdateRunStep{Command: model.ToUnixCmd("echo a"), Triggers: f.NewPathSet("a.txt")}, // matches changed file model.LiveUpdateRunStep{Command: model.ToUnixCmd("echo b"), Triggers: f.NewPathSet("b.txt")}, // does NOT match changed file } lu := assembleLiveUpdate(SanchoSyncSteps(f), runs, true, nil, f) tCase := testCase{ manifest: manifestbuilder.New(f, "sancho"). WithK8sYAML(SanchoYAML). WithImageTarget(NewSanchoDockerBuildImageTarget(f)). WithLiveUpdate(lu). Build(), changedFiles: []string{"a.txt"}, expectDockerBuildCount: 0, expectDockerPushCount: 0, expectDockerCopyCount: 1, expectDockerExecCount: 2, // one run's triggers don't match -- should only exec the other two. expectDockerRestartCount: 1, } runTestCase(t, f, tCase) }
explode_data.jsonl/35169
{ "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, 20324, 4289, 6727, 17939, 7319, 4502, 1155, 353, 8840, 836, 8, 341, 1166, 1669, 501, 33, 5262, 12735, 1155, 11, 595, 23, 82, 81214, 35, 13659, 23597, 11, 5476, 16706, 35, 13659, 340, 16867, 282, 836, 682, 4454, 2822, 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 TestParseGroupVersion(t *testing.T) { tests := []struct { input string g string v string }{ {input: "", g: "", v: ""}, {input: "v1", g: "", v: "v1"}, {input: "apps/v1", g: "apps", v: "v1"}, {input: "/v1", g: "", v: "v1"}, {input: "apps/", g: "apps", v: ""}, {input: "/apps/", g: "", v: "apps/"}, } for _, tc := range tests { g, v := ParseGroupVersion(tc.input) assert.Equal(t, tc.g, g, tc.input) assert.Equal(t, tc.v, v, tc.input) } }
explode_data.jsonl/39018
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 239 }
[ 2830, 3393, 14463, 2808, 5637, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 3056, 1235, 341, 197, 22427, 914, 198, 197, 3174, 257, 914, 198, 197, 5195, 257, 914, 198, 197, 59403, 197, 197, 90, 1355, 25, 7342, 342, 25, 7342, 348, 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...
2
func TestFilesystemVersion_RelName(t *testing.T) { type TestCase struct { In FilesystemVersion Out string Panic bool } creat := FilesystemVersionCreation(time.Now()) tcs := []TestCase{ { In: FilesystemVersion{ Type: FilesystemVersion_Snapshot, Name: "foobar", Creation: creat, }, Out: "@foobar", }, { In: FilesystemVersion{ Type: FilesystemVersion_Bookmark, Name: "foobar", Creation: creat, }, Out: "#foobar", }, { In: FilesystemVersion{ Type: 2342, Name: "foobar", Creation: creat, }, Panic: true, }, } for _, tc := range tcs { if tc.Panic { assert.Panics(t, func() { tc.In.RelName() }) } else { o := tc.In.RelName() assert.Equal(t, tc.Out, o) } } }
explode_data.jsonl/44344
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 371 }
[ 2830, 3393, 1703, 8948, 5637, 88922, 675, 1155, 353, 8840, 836, 8, 1476, 13158, 30573, 2036, 341, 197, 70167, 262, 2887, 8948, 5637, 198, 197, 197, 2662, 256, 914, 198, 197, 10025, 31270, 1807, 198, 197, 630, 197, 94739, 1669, 2887, 8...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestForwardedMetricWithMetadataFromProtoBadMetricProto(t *testing.T) { var res ForwardedMetricWithMetadata pb := metricpb.ForwardedMetricWithMetadata{ Metric: testBadForwardedMetricProto, Metadata: testForwardMetadata1Proto, } require.Error(t, res.FromProto(&pb)) }
explode_data.jsonl/75084
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 103 }
[ 2830, 3393, 25925, 291, 54310, 2354, 14610, 3830, 31549, 17082, 54310, 31549, 1155, 353, 8840, 836, 8, 341, 2405, 592, 22164, 291, 54310, 2354, 14610, 198, 3223, 65, 1669, 18266, 16650, 26676, 1606, 291, 54310, 2354, 14610, 515, 197, 9209...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestGocloak_GetIssuer(t *testing.T) { t.Parallel() cfg := GetConfig(t) client := NewClientWithDebug(t) issuer, err := client.GetIssuer(cfg.GoCloak.Realm) t.Log(issuer) FailIfErr(t, err, "get issuer") }
explode_data.jsonl/79509
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 93 }
[ 2830, 3393, 38, 509, 385, 585, 13614, 98902, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 741, 50286, 1669, 2126, 2648, 1155, 340, 25291, 1669, 1532, 2959, 2354, 7939, 1155, 340, 197, 66817, 11, 1848, 1669, 2943, 2234, 98902, 28272,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestRegister_koNamespace(t *testing.T) { ctx := context.Background() cfgBloomFilter := rpc.Config{ Config: rotate.Config{ Config: bloomfilter.Config{ N: 10000000, P: 0.0000001, HashName: "optimal", }, TTL: 1500, }, Port: 1234, } serviceConf := config.ServiceConfig{ ExtraConfig: config.ExtraConfig{ "wrongnamespace": cfgBloomFilter, }, } logger, err := gologging.NewLogger(config.ExtraConfig{ gologging.Namespace: map[string]interface{}{ "level": "DEBUG", "stdout": true, }, }) if err != nil { t.Error(err.Error()) return } if _, err := Register(ctx, "bloomfilter-test", serviceConf, logger, func(name string, port int) { if err := consul.Register(ctx, map[string]interface{}{}, port, name, logger); err != nil { logger.Error(fmt.Sprintf("Couldn't register %s:%d in consul: %s", name, port, err.Error())) } }); err != errNoConfig { t.Errorf("didn't get error %s", errNoConfig) } }
explode_data.jsonl/48332
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 416 }
[ 2830, 3393, 8690, 4698, 78, 22699, 1155, 353, 8840, 836, 8, 341, 20985, 1669, 2266, 19047, 741, 50286, 33, 18474, 5632, 19687, 197, 7000, 3992, 10753, 515, 298, 66156, 25, 16919, 10753, 515, 571, 66156, 25, 51454, 5315, 10753, 515, 464,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func Test_mrCmd(t *testing.T) { t.Parallel() repo := copyTestRepo(t) var mrID string t.Run("create", func(t *testing.T) { git := exec.Command("git", "checkout", "mrtest") git.Dir = repo b, err := git.CombinedOutput() if err != nil { t.Log(string(b)) t.Fatal(err) } cmd := exec.Command("../lab_bin", "mr", "create", "lab-testing", "master", "-m", "mr title", "-m", "mr description", ) cmd.Dir = repo b, _ = cmd.CombinedOutput() out := string(b) t.Log(out) require.Contains(t, out, "https://gitlab.com/lab-testing/test/merge_requests") i := strings.Index(out, "/diffs\n") mrID = strings.TrimPrefix(out[:i], "https://gitlab.com/lab-testing/test/merge_requests/") t.Log(mrID) }) t.Run("show", func(t *testing.T) { if mrID == "" { t.Skip("mrID is empty, create likely failed") } cmd := exec.Command("../lab_bin", "mr", "show", "lab-testing", mrID) cmd.Dir = repo b, err := cmd.CombinedOutput() if err != nil { t.Log(string(b)) t.Fatal(err) } out := string(b) require.Contains(t, out, "Project: lab-testing/test\n") require.Contains(t, out, "Branches: mrtest->master\n") require.Contains(t, out, "Status: Open\n") require.Contains(t, out, fmt.Sprintf("#%s mr title", mrID)) require.Contains(t, out, "===================================\nmr description") require.Contains(t, out, fmt.Sprintf("WebURL: https://gitlab.com/lab-testing/test/merge_requests/%s", mrID)) }) t.Run("delete", func(t *testing.T) { if mrID == "" { t.Skip("mrID is empty, create likely failed") } cmd := exec.Command("../lab_bin", "mr", "lab-testing", "-d", mrID) cmd.Dir = repo b, err := cmd.CombinedOutput() if err != nil { t.Log(string(b)) t.Fatal(err) } require.Contains(t, string(b), fmt.Sprintf("Merge Request #%s closed", mrID)) }) }
explode_data.jsonl/44429
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 799 }
[ 2830, 3393, 92858, 15613, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 741, 17200, 5368, 1669, 2975, 2271, 25243, 1155, 340, 2405, 17317, 915, 914, 198, 3244, 16708, 445, 3182, 497, 2915, 1155, 353, 8840, 836, 8, 341, 197, 90731, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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