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 TestNullStringParam(t *testing.T) { spec := nullTestSpec{"nullstring", "string", [6]nullTestRow{ {NullString{"aqua", true}, "", NullString{"aqua", true}}, {NullString{"brown", false}, "", NullString{"", false}}, {"chartreuse", "", NullString{"chartreuse", true}}, {NullString{"darkred", true}, "", NullString{"darkred", true}}, {NullString{"eel", false}, "", NullString{"", false}}, {"foo", NullString{"black", false}, nil}, }} nullTestRun(t, spec) }
explode_data.jsonl/15991
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 171 }
[ 2830, 3393, 3280, 703, 2001, 1155, 353, 8840, 836, 8, 341, 98100, 1669, 845, 2271, 8327, 4913, 2921, 917, 497, 330, 917, 497, 508, 21, 60, 2921, 2271, 3102, 515, 197, 197, 90, 3280, 703, 4913, 64, 43832, 497, 830, 2137, 7342, 18084,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestSameResult(t *testing.T) { test := proofParamsTest{ bits: 32, p: tt.B10("3532369103"), q: tt.B10("3649146287"), n: tt.B10("12890131596525970561"), f: tt.B10("8088109122034248022"), alpha: tt.B10("1662308981529268576"), h1: tt.B10("7740598546761717939"), h2: tt.B10("682354612026984561"), } idx := 0 safePrimes := []*big.Int{test.p, test.q} f := func(bits uint) (*big.Int, error) { r := safePrimes[idx] idx = (idx + 1) % 2 return r, nil } randVars := []*big.Int{test.f, test.alpha} rIdx := 0 g := func(nn *big.Int) (*big.Int, error) { r := randVars[rIdx] rIdx = (rIdx + 1) % 2 return r, nil } params1, err := genProofParams(f, g, 32) require.NoError(t, err) params2, err := genProofParams(f, g, 32) require.NoError(t, err) require.Equal(t, params1.N, params2.N) require.Equal(t, params1.H1, params2.H1) require.Equal(t, params1.H2, params2.H2) }
explode_data.jsonl/73922
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 475 }
[ 2830, 3393, 19198, 2077, 1155, 353, 8840, 836, 8, 341, 18185, 1669, 11064, 4870, 2271, 515, 197, 2233, 1199, 25, 220, 220, 18, 17, 345, 197, 3223, 25, 257, 17853, 1785, 16, 15, 445, 18, 20, 18, 17, 18, 21, 24, 16, 15, 18, 4461, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestElasticsearchCreate(t *testing.T) { args := testutil.Args for _, testcase := range []struct { args []string api mock.API wantError string wantOutput string }{ { args: args("logging elasticsearch create --service-id 123 --version 1 --name log --index logs --autoclone"), api: mock.API{ ListVersionsFn: testutil.ListVersions, CloneVersionFn: testutil.CloneVersionResult(4), }, wantError: "error parsing arguments: required flag --url not provided", }, { args: args("logging elasticsearch create --service-id 123 --version 1 --name log --url example.com --autoclone"), api: mock.API{ ListVersionsFn: testutil.ListVersions, CloneVersionFn: testutil.CloneVersionResult(4), }, wantError: "error parsing arguments: required flag --index not provided", }, { args: args("logging elasticsearch create --service-id 123 --version 1 --name log --index logs --url example.com --autoclone"), api: mock.API{ ListVersionsFn: testutil.ListVersions, CloneVersionFn: testutil.CloneVersionResult(4), CreateElasticsearchFn: createElasticsearchOK, }, wantOutput: "Created Elasticsearch logging endpoint log (service 123 version 4)", }, { args: args("logging elasticsearch create --service-id 123 --version 1 --name log --index logs --url example.com --autoclone"), api: mock.API{ ListVersionsFn: testutil.ListVersions, CloneVersionFn: testutil.CloneVersionResult(4), CreateElasticsearchFn: createElasticsearchError, }, wantError: errTest.Error(), }, } { t.Run(strings.Join(testcase.args, " "), func(t *testing.T) { var stdout bytes.Buffer opts := testutil.NewRunOpts(testcase.args, &stdout) opts.APIClient = mock.APIClient(testcase.api) err := app.Run(opts) testutil.AssertErrorContains(t, err, testcase.wantError) testutil.AssertStringContains(t, stdout.String(), testcase.wantOutput) }) } }
explode_data.jsonl/6905
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 751 }
[ 2830, 3393, 36, 51179, 1836, 4021, 1155, 353, 8840, 836, 8, 341, 31215, 1669, 1273, 1314, 51015, 198, 2023, 8358, 70080, 1669, 2088, 3056, 1235, 341, 197, 31215, 981, 3056, 917, 198, 197, 54299, 286, 7860, 24922, 198, 197, 50780, 1454, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestResolveMissingDependencyParam(t *testing.T) { t.Skip("still haven't decided if this is going to be supported") s := &Step{ Data: map[string]interface{}{ "helm": map[interface{}]interface{}{ "description": "install wordpress", "Arguments": []string{ "{{bundle.dependencies.mysql.parameters.nope}}", }, }, }, } cxt := context.NewTestContext(t) m := &Manifest{ Dependencies: map[string]Dependency{ "mysql": { Tag: "deislabs/porter-mysql", }, }, Mixins: []MixinDeclaration{{Name: "helm"}}, Install: Steps{ s, }, } rm := NewRuntimeManifest(cxt.Context, ActionInstall, m) os.Setenv("DATABASE", "wordpress") err := rm.ResolveStep(s) require.Error(t, err) assert.Equal(t, "unable to resolve step: unable to render template values: Missing variable \"nope\"", err.Error()) }
explode_data.jsonl/37721
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 337 }
[ 2830, 3393, 56808, 25080, 36387, 2001, 1155, 353, 8840, 836, 8, 341, 3244, 57776, 445, 43366, 8990, 944, 6635, 421, 419, 374, 2087, 311, 387, 7248, 5130, 1903, 1669, 609, 8304, 515, 197, 40927, 25, 2415, 14032, 31344, 67066, 298, 197, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestConfigureClusterListener(t *testing.T) { logEntries := make(chan string, 100) allocatePort := func() uint16 { l, err := net.Listen("tcp", "127.0.0.1:0") assert.NoError(t, err) _, portStr, err := net.SplitHostPort(l.Addr().String()) assert.NoError(t, err) port, err := strconv.ParseInt(portStr, 10, 64) assert.NoError(t, err) assert.NoError(t, l.Close()) t.Log("picked unused port", port) return uint16(port) } unUsedPort := allocatePort() backupLogger := logger logger = logger.WithOptions(zap.Hooks(func(entry zapcore.Entry) error { logEntries <- entry.Message return nil })) defer func() { logger = backupLogger }() ca, err := tlsgen.NewCA() assert.NoError(t, err) serverKeyPair, err := ca.NewServerCertKeyPair("127.0.0.1") assert.NoError(t, err) loadPEM := func(fileName string) ([]byte, error) { switch fileName { case "cert": return serverKeyPair.Cert, nil case "key": return serverKeyPair.Key, nil case "ca": return ca.CertBytes(), nil default: return nil, errors.New("I/O error") } } for _, testCase := range []struct { name string conf *localconfig.TopLevel generalConf comm.ServerConfig generalSrv *comm.GRPCServer shouldBeEqual bool expectedPanic string expectedLogEntries []string }{ { name: "invalid certificate", generalConf: comm.ServerConfig{}, conf: &localconfig.TopLevel{ General: localconfig.General{ Cluster: localconfig.Cluster{ ListenAddress: "127.0.0.1", ListenPort: 5000, ServerPrivateKey: "key", ServerCertificate: "bad", RootCAs: []string{"ca"}, }, }, }, expectedPanic: "Failed to load cluster server certificate from 'bad' (I/O error)", generalSrv: &comm.GRPCServer{}, expectedLogEntries: []string{"Failed to load cluster server certificate from 'bad' (I/O error)"}, }, { name: "invalid key", generalConf: comm.ServerConfig{}, conf: &localconfig.TopLevel{ General: localconfig.General{ Cluster: localconfig.Cluster{ ListenAddress: "127.0.0.1", ListenPort: 5000, ServerPrivateKey: "bad", ServerCertificate: "cert", RootCAs: []string{"ca"}, }, }, }, expectedPanic: "Failed to load cluster server key from 'bad' (I/O error)", generalSrv: &comm.GRPCServer{}, expectedLogEntries: []string{"Failed to load cluster server key from 'bad' (I/O error)"}, }, { name: "invalid ca cert", generalConf: comm.ServerConfig{}, conf: &localconfig.TopLevel{ General: localconfig.General{ Cluster: localconfig.Cluster{ ListenAddress: "127.0.0.1", ListenPort: 5000, ServerPrivateKey: "key", ServerCertificate: "cert", RootCAs: []string{"bad"}, }, }, }, expectedPanic: "Failed to load CA cert file 'bad' (I/O error)", generalSrv: &comm.GRPCServer{}, expectedLogEntries: []string{"Failed to load CA cert file 'bad' (I/O error)"}, }, { name: "bad listen address", generalConf: comm.ServerConfig{}, conf: &localconfig.TopLevel{ General: localconfig.General{ Cluster: localconfig.Cluster{ ListenAddress: "99.99.99.99", ListenPort: unUsedPort, ServerPrivateKey: "key", ServerCertificate: "cert", RootCAs: []string{"ca"}, }, }, }, expectedPanic: fmt.Sprintf("Failed creating gRPC server on 99.99.99.99:%d due "+ "to listen tcp 99.99.99.99:%d:", unUsedPort, unUsedPort), generalSrv: &comm.GRPCServer{}, }, { name: "green path", generalConf: comm.ServerConfig{}, conf: &localconfig.TopLevel{ General: localconfig.General{ Cluster: localconfig.Cluster{ ListenAddress: "127.0.0.1", ListenPort: 5000, ServerPrivateKey: "key", ServerCertificate: "cert", RootCAs: []string{"ca"}, }, }, }, generalSrv: &comm.GRPCServer{}, }, } { t.Run(testCase.name, func(t *testing.T) { if testCase.shouldBeEqual { conf, srv := configureClusterListener(testCase.conf, testCase.generalConf, loadPEM) assert.Equal(t, conf, testCase.generalConf) assert.Equal(t, srv, testCase.generalSrv) } if testCase.expectedPanic != "" { f := func() { configureClusterListener(testCase.conf, testCase.generalConf, loadPEM) } assert.Contains(t, panicMsg(f), testCase.expectedPanic) } else { configureClusterListener(testCase.conf, testCase.generalConf, loadPEM) } // Ensure logged messages that are expected were all logged var loggedMessages []string for len(logEntries) > 0 { logEntry := <-logEntries loggedMessages = append(loggedMessages, logEntry) } assert.Subset(t, loggedMessages, testCase.expectedLogEntries) }) } }
explode_data.jsonl/32658
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 2234 }
[ 2830, 3393, 28560, 28678, 2743, 1155, 353, 8840, 836, 8, 341, 6725, 24533, 1669, 1281, 35190, 914, 11, 220, 16, 15, 15, 692, 197, 31191, 7084, 1669, 2915, 368, 2622, 16, 21, 341, 197, 8810, 11, 1848, 1669, 4179, 68334, 445, 27161, 4...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestExecuteGetDynatraceSLO(t *testing.T) { handler := test.NewFileBasedURLHandler(t) handler.AddExact(SLOPath+"/524ca177-849b-3e8c-8175-42b93fbc33c5?from=1571649084000&timeFrame=GTF&to=1571649085000", "./testdata/test_get_slo_id.json") dtClient, _, teardown := createDynatraceClient(t, handler) defer teardown() timeframe, err := common.NewTimeframeParser("2019-10-21T09:11:24Z", "2019-10-21T09:11:25Z").Parse() assert.NoError(t, err) sloID := "524ca177-849b-3e8c-8175-42b93fbc33c5" sloResult, err := NewSLOClient(dtClient).Get(context.TODO(), NewSLOClientGetParameters(sloID, *timeframe)) assert.NoError(t, err) assert.NotNil(t, sloResult, "No SLO Result returned for "+sloID) assert.EqualValues(t, 95.66405076939219, sloResult.EvaluatedPercentage, "Not returning expected value for SLO") }
explode_data.jsonl/10852
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 343 }
[ 2830, 3393, 17174, 1949, 95709, 266, 41183, 50, 1593, 1155, 353, 8840, 836, 8, 341, 53326, 1669, 1273, 7121, 1703, 28715, 3144, 3050, 1155, 340, 53326, 1904, 57954, 3759, 1593, 1820, 27569, 20, 17, 19, 924, 16, 22, 22, 12, 23, 19, 2...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func Test_getLastKubeWatchResult(t *testing.T) { untyped.TestHookSetPartitionDuration(time.Hour) db, err := (&badgerwrap.MockFactory{}).Open(badger.DefaultOptions("")) assert.Nil(t, err) tables := typed.NewTableList(db) ts, err := ptypes.TimestampProto(someWatchTime) assert.Nil(t, err) watchRec := typed.KubeWatchResult{Kind: kubeextractor.NodeKind, WatchType: typed.KubeWatchResult_UPDATE, Timestamp: ts, Payload: somePodPayload} metadata := &kubeextractor.KubeMetadata{Name: "someName", Namespace: "someNamespace"} err = tables.Db().Update(func(txn badgerwrap.Txn) error { return updateKubeWatchTable(tables, txn, &watchRec, metadata, true) }) assert.Nil(t, err) err = tables.Db().View(func(txn badgerwrap.Txn) error { prevWatch, err := getLastKubeWatchResult(tables, txn, ts, kubeextractor.NodeKind, metadata.Namespace, "differentName") assert.Nil(t, err) assert.Nil(t, prevWatch) prevWatch, err = getLastKubeWatchResult(tables, txn, ts, kubeextractor.NodeKind, metadata.Namespace, metadata.Name) assert.Nil(t, err) assert.NotNil(t, prevWatch) return nil }) assert.Nil(t, err) }
explode_data.jsonl/38957
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 430 }
[ 2830, 3393, 3062, 5842, 42, 3760, 14247, 2077, 1155, 353, 8840, 836, 8, 341, 20479, 44181, 8787, 31679, 1649, 49978, 12945, 9730, 73550, 340, 20939, 11, 1848, 1669, 15899, 13855, 1389, 10097, 24664, 4153, 6257, 568, 5002, 1883, 329, 1389,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestMinReplicaCheck(t *testing.T) { hc := NewHealthChecker( []CategoryID{LinkerdHAChecks}, &Options{ ControlPlaneNamespace: "linkerd", }, ) var err error testCases := []struct { controlPlaneResourceDefs []string expected error }{ { controlPlaneResourceDefs: generateAllControlPlaneDef(&controlPlaneReplicaOptions{ controller: 1, destination: 3, identity: 3, proxyInjector: 3, spValidator: 1, tap: 3, }, t), expected: fmt.Errorf("not enough replicas available for [linkerd-controller linkerd-sp-validator]"), }, { controlPlaneResourceDefs: generateAllControlPlaneDef(&controlPlaneReplicaOptions{ controller: 3, destination: 2, identity: 1, proxyInjector: 1, spValidator: 0, tap: 3, }, t), expected: fmt.Errorf("not enough replicas available for [linkerd-identity linkerd-proxy-injector linkerd-sp-validator]"), }, { controlPlaneResourceDefs: generateAllControlPlaneDef(&controlPlaneReplicaOptions{ controller: 3, destination: 2, identity: 2, proxyInjector: 3, spValidator: 2, tap: 3, }, t), expected: nil, }, } for i, tc := range testCases { tc := tc //pin t.Run(fmt.Sprintf("%d", i), func(t *testing.T) { hc.kubeAPI, err = k8s.NewFakeAPI(tc.controlPlaneResourceDefs...) if err != nil { t.Fatal(err) } err = hc.checkMinReplicasAvailable(context.Background()) if err == nil && tc.expected != nil { t.Log("Expected error: nil") t.Logf("Received error: %s\n", err) t.Fatal("test case failed") } if err != nil { if err.Error() != tc.expected.Error() { t.Logf("Expected error: %s\n", tc.expected) t.Logf("Received error: %s\n", err) t.Fatal("test case failed") } } }) } }
explode_data.jsonl/19153
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 865 }
[ 2830, 3393, 6217, 18327, 15317, 3973, 1155, 353, 8840, 836, 8, 341, 9598, 66, 1669, 1532, 14542, 35188, 1006, 197, 197, 1294, 6746, 915, 90, 3939, 14348, 39, 1706, 1227, 82, 1583, 197, 197, 5, 3798, 515, 298, 197, 3273, 34570, 22699, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestGob(t *testing.T) { u, err := Parse("https://www.google.com/x?y=z") if err != nil { t.Fatal(err) } var w bytes.Buffer err = gob.NewEncoder(&w).Encode(u) if err != nil { t.Fatal(err) } u1 := new(URL) err = gob.NewDecoder(&w).Decode(u1) if err != nil { t.Fatal(err) } if u1.String() != u.String() { t.Errorf("json decoded to: %s\nwant: %s\n", u1, u) } }
explode_data.jsonl/71737
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 194 }
[ 2830, 3393, 38, 674, 1155, 353, 8840, 836, 8, 341, 10676, 11, 1848, 1669, 14775, 445, 2428, 1110, 2136, 5713, 905, 10776, 30, 88, 82570, 1138, 743, 1848, 961, 2092, 341, 197, 3244, 26133, 3964, 340, 197, 532, 2405, 289, 5820, 22622, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestCreateInvalidExperiment(t *testing.T) { if testing.Short() { t.Skip("skip test in short mode") } sess := newSessionForTesting(t) defer sess.Close() builder, err := sess.NewExperimentBuilder("antani") if err == nil { t.Fatal("expected an error here") } if builder != nil { t.Fatal("expected a nil builder here") } }
explode_data.jsonl/26316
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 125 }
[ 2830, 3393, 4021, 7928, 77780, 1155, 353, 8840, 836, 8, 341, 743, 7497, 55958, 368, 341, 197, 3244, 57776, 445, 20599, 1273, 304, 2805, 3856, 1138, 197, 532, 1903, 433, 1669, 501, 5283, 2461, 16451, 1155, 340, 16867, 21875, 10421, 741, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
4
func TestRejectsInvalidSCTFeedback(t *testing.T) { s := createAndOpenStorage() defer closeAndDeleteStorage(s) v := mustCreateSignatureVerifiers(t) h := newHandlerWithClock(s, v, testStuckClock(stuckClockTimeMillis)) rr := httptest.NewRecorder() req, err := http.NewRequest("POST", "/.well-known/ct/v1/sct-feedback", strings.NewReader("BlahBlah},")) if err != nil { t.Fatalf("Failed to create request: %v", err) } h.HandleSCTFeedback(rr, req) assert.Equal(t, http.StatusBadRequest, rr.Code) }
explode_data.jsonl/80082
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 194 }
[ 2830, 3393, 78413, 82, 7928, 50, 1162, 35348, 1155, 353, 8840, 836, 8, 341, 1903, 1669, 1855, 3036, 5002, 5793, 741, 16867, 3265, 3036, 6435, 5793, 1141, 340, 5195, 1669, 1969, 4021, 25088, 10141, 11836, 1155, 340, 9598, 1669, 501, 3050...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestSend(t *testing.T) { n := Notification{ BotAPIKey: "key", BotEmailAddress: "from", Content: "content", Type: "stream", To: "to", Endpoint: "https://test/v1", Client: &http.Client{Timeout: 3 * time.Second}, } var mockResponse apiResponse var hitServer bool ts := httptest.NewServer(http.HandlerFunc(func(rw http.ResponseWriter, r *http.Request) { hitServer = true if r.Method != "POST" { t.Error("HTTP method should be POST") } if r.Header.Get("Content-Type") != "application/x-www-form-urlencoded" { t.Error("content type should be application/x-www-form-urlencoded") } user, pass, ok := r.BasicAuth() if user != "from" { t.Error("missing auth username") } if pass != "key" { t.Error("missing auth password") } if ok != true { t.Error("missing auth") } b, err := ioutil.ReadAll(r.Body) if err != nil { t.Error(err) } if string(b) == "" { t.Error("missing payload") } if err := json.NewEncoder(rw).Encode(mockResponse); err != nil { t.Error(err) } })) defer ts.Close() n.Endpoint = ts.URL mockResponse.Result = "success" if err := n.Send(); err != nil { t.Error(err) } if !hitServer { t.Error("didn't reach server") } n.Type = "private" if err := n.Send(); err != nil { t.Error(err) } // failure mockResponse.Result = "error" if err := n.Send(); err == nil { t.Error("unexpected success") } n.Type = "dummy" if err := n.Send(); err == nil { t.Error("unexpected success") } }
explode_data.jsonl/42203
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 678 }
[ 2830, 3393, 11505, 1155, 353, 8840, 836, 8, 341, 9038, 1669, 16571, 515, 197, 12791, 354, 7082, 1592, 25, 981, 330, 792, 756, 197, 12791, 354, 79986, 25, 330, 1499, 756, 197, 197, 2762, 25, 260, 330, 1796, 756, 197, 27725, 25, 310, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
9
func TestStream_PulsarMsgStream_BroadCast(t *testing.T) { pulsarAddress, _ := Params.Load("_PulsarAddress") c1, c2 := funcutil.RandomString(8), funcutil.RandomString(8) producerChannels := []string{c1, c2} consumerChannels := []string{c1, c2} consumerSubName := funcutil.RandomString(8) msgPack := MsgPack{} msgPack.Msgs = append(msgPack.Msgs, getTsMsg(commonpb.MsgType_TimeTick, 1)) msgPack.Msgs = append(msgPack.Msgs, getTsMsg(commonpb.MsgType_TimeTick, 3)) inputStream := getPulsarInputStream(pulsarAddress, producerChannels) outputStream := getPulsarOutputStream(pulsarAddress, consumerChannels, consumerSubName) err := inputStream.Broadcast(&msgPack) if err != nil { log.Fatalf("produce error = %v", err) } receiveMsg(outputStream, len(consumerChannels)*len(msgPack.Msgs)) inputStream.Close() outputStream.Close() }
explode_data.jsonl/55291
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 311 }
[ 2830, 3393, 3027, 1088, 14295, 277, 6611, 3027, 1668, 8546, 18714, 1155, 353, 8840, 836, 8, 341, 3223, 14295, 277, 4286, 11, 716, 1669, 34352, 13969, 16975, 47, 14295, 277, 4286, 1138, 1444, 16, 11, 272, 17, 1669, 2915, 1314, 26709, 7...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestSetCellStyleCurrencyNumberFormat(t *testing.T) { t.Run("TestBook3", func(t *testing.T) { f, err := prepareTestBook3() if !assert.NoError(t, err) { t.FailNow() } f.SetCellValue("Sheet1", "A1", 56) f.SetCellValue("Sheet1", "A2", -32.3) var style int style, err = f.NewStyle(`{"number_format": 188, "decimal_places": -1}`) if !assert.NoError(t, err) { t.FailNow() } assert.NoError(t, f.SetCellStyle("Sheet1", "A1", "A1", style)) style, err = f.NewStyle(`{"number_format": 188, "decimal_places": 31, "negred": true}`) if !assert.NoError(t, err) { t.FailNow() } assert.NoError(t, f.SetCellStyle("Sheet1", "A2", "A2", style)) assert.NoError(t, f.SaveAs(filepath.Join("test", "TestSetCellStyleCurrencyNumberFormat.TestBook3.xlsx"))) }) t.Run("TestBook4", func(t *testing.T) { f, err := prepareTestBook4() if !assert.NoError(t, err) { t.FailNow() } f.SetCellValue("Sheet1", "A1", 42920.5) f.SetCellValue("Sheet1", "A2", 42920.5) _, err = f.NewStyle(`{"number_format": 26, "lang": "zh-tw"}`) if !assert.NoError(t, err) { t.FailNow() } style, err := f.NewStyle(`{"number_format": 27}`) if !assert.NoError(t, err) { t.FailNow() } assert.NoError(t, f.SetCellStyle("Sheet1", "A1", "A1", style)) style, err = f.NewStyle(`{"number_format": 31, "lang": "ko-kr"}`) if !assert.NoError(t, err) { t.FailNow() } assert.NoError(t, f.SetCellStyle("Sheet1", "A2", "A2", style)) style, err = f.NewStyle(`{"number_format": 71, "lang": "th-th"}`) if !assert.NoError(t, err) { t.FailNow() } assert.NoError(t, f.SetCellStyle("Sheet1", "A2", "A2", style)) assert.NoError(t, f.SaveAs(filepath.Join("test", "TestSetCellStyleCurrencyNumberFormat.TestBook4.xlsx"))) }) }
explode_data.jsonl/36972
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 813 }
[ 2830, 3393, 1649, 15171, 26321, 2833, 4061, 1155, 353, 8840, 836, 8, 341, 3244, 16708, 445, 2271, 7134, 18, 497, 2915, 1155, 353, 8840, 836, 8, 341, 197, 1166, 11, 1848, 1669, 10549, 2271, 7134, 18, 741, 197, 743, 753, 2207, 35699, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
4
func Test_IsMaintenanceMode_configMapHasDeletionTimestamp(t *testing.T) { t.Parallel() // SETUP ctx := context.Background() mockCtrl := gomock.NewController(t) defer mockCtrl.Finish() cm := newMaintenanceModeConfigMap(map[string]string{ "maintenanceMode": "true", }) cm.ObjectMeta.DeletionTimestamp = &metav1.Time{Time: time.Now()} cf := fake.NewClientFactory(cm) // EXERCISE result, resultErr := IsMaintenanceMode(ctx, cf) // VERIFY assert.Assert(t, result == false) assert.NilError(t, resultErr) }
explode_data.jsonl/8490
{ "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, 31879, 92735, 3636, 5332, 2227, 10281, 1912, 52625, 20812, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 2822, 197, 322, 90857, 198, 20985, 1669, 2266, 19047, 741, 77333, 15001, 1669, 342, 316, 1176, 7121, 2051, 1155, 340, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestRSAPSSSelfSigned(t *testing.T) { for i, pemBlock := range []string{rsaPSSSelfSignedPEM, rsaPSSSelfSignedOpenSSL110PEM} { der, _ := pem.Decode([]byte(pemBlock)) if der == nil { t.Errorf("#%d: failed to find PEM block", i) continue } cert, err := ParseCertificate(der.Bytes) if err != nil { t.Errorf("#%d: failed to parse: %s", i, err) continue } if err = cert.CheckSignatureFrom(cert); err != nil { t.Errorf("#%d: signature check failed: %s", i, err) continue } } }
explode_data.jsonl/67989
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 226 }
[ 2830, 3393, 11451, 2537, 1220, 12092, 49312, 1155, 353, 8840, 836, 8, 341, 2023, 600, 11, 54184, 4713, 1669, 2088, 3056, 917, 90, 60869, 47, 1220, 12092, 49312, 1740, 44, 11, 68570, 47, 1220, 12092, 49312, 5002, 22594, 16, 16, 15, 174...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestInsufficientPermission_Error(t *testing.T) { inp := &callbacks.InsufficientPermissions{} expectedErrMsg := callbacks.InsufficientPermissionMessage if inp.Error() != expectedErrMsg { t.Errorf( "Unexpected error message. Got %s, Expected: %s", inp.Error(), expectedErrMsg, ) } inp.Err = fmt.Errorf(wrapMsg) expectedErrMsg = fmt.Sprintf("%s: %s", expectedErrMsg, wrapMsg) if inp.Error() != expectedErrMsg { t.Errorf( "Unexpected error message. Got %s, Expected: %s", inp.Error(), expectedErrMsg, ) } }
explode_data.jsonl/56091
{ "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, 15474, 26683, 14966, 28651, 1155, 353, 8840, 836, 8, 341, 17430, 79, 1669, 609, 68311, 5337, 82, 26683, 23851, 16094, 42400, 75449, 1669, 26679, 5337, 82, 26683, 14966, 2052, 271, 743, 32344, 6141, 368, 961, 3601, 75449, 341, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestBuildClassic(t *testing.T) { testClient(t, func(e *cli.Engine, i *mocksdk.Interface) { i.On("SystemGet").Return(fxSystemClassic(), nil) i.On("BuildCreateUpload", "app1", mock.Anything, structs.BuildCreateOptions{}).Return(fxBuild(), nil) i.On("BuildLogs", "app1", "build1", structs.LogsOptions{}).Return(testLogs(fxLogs()), nil) i.On("BuildGet", "app1", "build1").Return(fxBuildRunning(), nil).Twice() i.On("BuildGet", "app1", "build4").Return(fxBuild(), nil) res, err := testExecute(e, "build ./testdata/httpd -a app1", nil) require.NoError(t, err) require.Equal(t, 0, res.Code) res.RequireStderr(t, []string{""}) res.RequireStdout(t, []string{ "Packaging source... OK", "Starting build... OK", "log1", "log2", "Build: build1", "Release: release1", }) }) }
explode_data.jsonl/65788
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 342 }
[ 2830, 3393, 11066, 63331, 1155, 353, 8840, 836, 8, 341, 18185, 2959, 1155, 11, 2915, 2026, 353, 19521, 54424, 11, 600, 353, 16712, 51295, 41065, 8, 341, 197, 8230, 8071, 445, 2320, 1949, 1827, 5598, 955, 87, 2320, 63331, 1507, 2092, 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 TestWebSocket(t *testing.T) { // TODO: https option with parallel leads to flakes. // https://github.com/knative/serving/issues/11387 if !test.ServingFlags.HTTPS { t.Parallel() } clients := Setup(t) names := test.ResourceNames{ Service: test.ObjectNameForTest(t), Image: wsServerTestImageName, } // Clean up in both abnormal and normal exits. test.EnsureTearDown(t, clients, &names) if _, err := v1test.CreateServiceReady(t, clients, &names); err != nil { t.Fatal("Failed to create WebSocket server:", err) } // Validate the websocket connection. if err := validateWebSocketConnection(t, clients, names); err != nil { t.Error(err) } }
explode_data.jsonl/76516
{ "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, 61238, 1155, 353, 8840, 836, 8, 341, 197, 322, 5343, 25, 3703, 2999, 448, 15279, 11508, 311, 81623, 624, 197, 322, 3703, 1110, 5204, 905, 14109, 29738, 2687, 19505, 38745, 14, 16, 16, 18, 23, 22, 198, 743, 753, 1944, 808...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
4
func TestFSMsgIndexFileWithExtraZeros(t *testing.T) { cleanupFSDatastore(t) defer cleanupFSDatastore(t) s := createDefaultFileStore(t) defer s.Close() c := storeCreateChannel(t, s, "foo") ms := c.Msgs msg1 := storeMsg(t, c, "foo", 1, []byte("msg1")) ms.(*FileMsgStore).RLock() fname := ms.(*FileMsgStore).writeSlice.idxFile.name ms.(*FileMsgStore).RUnlock() s.Close() f, err := openFileWithFlags(fname, os.O_CREATE|os.O_RDWR|os.O_APPEND) if err != nil { t.Fatalf("Error opening file: %v", err) } defer f.Close() b := make([]byte, msgIndexRecSize) if _, err := f.Write(b); err != nil { t.Fatalf("Error adding zeros: %v", err) } f.Close() // Reopen file store s, rs := openDefaultFileStore(t) defer s.Close() rc := getRecoveredChannel(t, rs, "foo") msg := msgStoreLookup(t, rc.Msgs, msg1.Sequence) if !reflect.DeepEqual(msg, msg1) { t.Fatalf("Expected message %v, got %v", msg1, msg) } // Add one more message msg2 := storeMsg(t, rc, "foo", 2, []byte("msg2")) s.Close() // Reopen file store s, rs = openDefaultFileStore(t) defer s.Close() rc = getRecoveredChannel(t, rs, "foo") msgs := []*pb.MsgProto{msg1, msg2} for _, omsg := range msgs { msg := msgStoreLookup(t, rc.Msgs, omsg.Sequence) if !reflect.DeepEqual(msg, omsg) { t.Fatalf("Expected message %v, got %v", omsg, msg) } } }
explode_data.jsonl/7779
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 580 }
[ 2830, 3393, 8485, 6611, 1552, 1703, 2354, 11612, 57, 6264, 1155, 353, 8840, 836, 8, 341, 1444, 60639, 8485, 1043, 4314, 1155, 340, 16867, 21290, 8485, 1043, 4314, 1155, 692, 1903, 1669, 1855, 3675, 1703, 6093, 1155, 340, 16867, 274, 104...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestBasicDataAccessParsing(t *testing.T) { yamlFile, err := ioutil.ReadFile("testdata/data-access-1.yaml") if err != nil { t.Fatalf("Error reading test data file: %s", err.Error()) } dar, err := ParseDataAccess(yamlFile) if err != nil { t.Fatalf("Error while parsing rules: %s", err.Error()) } das := dar.AccessRights assert.Equal(t, 2, len(das)) da0 := das[0] assert.Equal(t, "11111111-1111-1111-1111-111111111111", da0.Id) assert.Equal(t, "my first rule", da0.Rule.Name) assert.Equal(t, "This describes the first rule", da0.Rule.Description) assert.Equal(t, "xxxx-xxxx-xxxx", da0.Rule.Id) dao0 := *(da0.DataObject) assert.Equal(t, "table1", dao0.Name) assert.Equal(t, "table", dao0.Type) dao0p := *(dao0.Parent) assert.Equal(t, "yyy", dao0p.Name) assert.Equal(t, "schema", dao0p.Type) dao0pp := *(dao0p.Parent) assert.Equal(t, "zzz", dao0pp.Name) assert.Equal(t, "database", dao0pp.Type) assert.Equal(t, 2, len(da0.Permissions)) assert.Equal(t, "select", da0.Permissions[0]) assert.Equal(t, "delete", da0.Permissions[1]) assert.Equal(t, 2, len(da0.Users)) assert.Equal(t, "bart", da0.Users[0]) assert.Equal(t, "dieter", da0.Users[1]) da1 := das[1] assert.Equal(t, "11111111-1111-1111-1111-111111111112", da1.Id) assert.Equal(t, "my first rule2", da1.Rule.Name) assert.Equal(t, "This describes the first rule2", da1.Rule.Description) assert.Equal(t, "xxxx-xxxx-xxxx2", da1.Rule.Id) dao1 := *(da1.DataObject) assert.Equal(t, "table2", dao1.Name) assert.Equal(t, "table", dao1.Type) dao1p := *(dao1.Parent) assert.Equal(t, "yyy", dao1p.Name) assert.Equal(t, "schema", dao1p.Type) dao1pp := *(dao1p.Parent) assert.Equal(t, "zzz", dao1pp.Name) assert.Equal(t, "database", dao1pp.Type) assert.Equal(t, 1, len(da1.Permissions)) assert.Equal(t, "select", da1.Permissions[0]) assert.Equal(t, 2, len(da1.Users)) assert.Equal(t, "katleen", da1.Users[0]) assert.Equal(t, "stefanie", da1.Users[1]) }
explode_data.jsonl/26667
{ "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, 15944, 1043, 6054, 68839, 1155, 353, 8840, 836, 8, 341, 14522, 9467, 1703, 11, 1848, 1669, 43144, 78976, 445, 92425, 13167, 42156, 12, 16, 33406, 1138, 743, 1848, 961, 2092, 341, 197, 3244, 30762, 445, 1454, 5290, 1273, 821,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestGetVolumeClaimsForStatefulSet(t *testing.T) { initialObjs := []runtime.Object{ newPVCWithStatefulSetAnnotation("foo", "default", "the-statefulset"), newPVCWithStatefulSetAnnotation("bar", "default", "the-other-statefulset"), newPVCWithStatefulSetAnnotation("bar-foo", "default", "the-statefulset"), newPVCWithStatefulSetAnnotation("baz", "kube-system", "the-statefulset"), newPVC("qux", "default"), } c, err := newFakeController(initialObjs...) require.NoError(t, err) fakeIndexerAdd(t, c, initialObjs...) pvcs, err := c.getVolumeClaimsForStatefulSet("default", "the-statefulset") require.NoError(t, err) expected := []*corev1.PersistentVolumeClaim{ newPVCWithStatefulSetAnnotation("foo", "default", "the-statefulset"), newPVCWithStatefulSetAnnotation("bar-foo", "default", "the-statefulset"), } assert.ElementsMatch(t, expected, pvcs) }
explode_data.jsonl/46207
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 320 }
[ 2830, 3393, 1949, 18902, 51133, 2461, 1397, 1262, 1649, 1155, 353, 8840, 836, 8, 341, 85270, 4121, 2519, 1669, 3056, 22255, 8348, 515, 197, 8638, 47, 11287, 2354, 1397, 1262, 1649, 19711, 445, 7975, 497, 330, 2258, 497, 330, 1782, 20733...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestURLMultiArrayStringMultiValid(t *testing.T) { t.Skip("Cannot set nil for string value in string slice") client := newQueriesClient() result, err := client.ArrayStringMultiValid(context.Background(), &QueriesArrayStringMultiValidOptions{ ArrayQuery: []string{ "ArrayQuery1", url.QueryEscape("begin!*'();:@ &=+$,/?#[]end"), "", ""}, }) if err != nil { t.Fatalf("ArrayStringMultiValid: %v", err) } if s := result.RawResponse.StatusCode; s != http.StatusOK { t.Fatalf("unexpected status code %d", s) } }
explode_data.jsonl/72652
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 197 }
[ 2830, 3393, 3144, 20358, 1857, 703, 20358, 4088, 1155, 353, 8840, 836, 8, 341, 3244, 57776, 445, 17444, 738, 2092, 369, 914, 897, 304, 914, 15983, 1138, 25291, 1669, 501, 55261, 2959, 741, 9559, 11, 1848, 1669, 2943, 8114, 703, 20358, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestListServices(t *testing.T) { handler := func(w http.ResponseWriter, r *http.Request) { testutils.AssertEqual(t, r.Method, "GET") testutils.AssertEqual(t, r.URL.Path, "/service/") services := []models.ServiceSummary{ {ServiceID: "id1"}, {ServiceID: "id2"}, } MarshalAndWrite(t, w, services, 200) } client, server := newClientAndServer(handler) defer server.Close() services, err := client.ListServices() if err != nil { t.Fatal(err) } testutils.AssertEqual(t, len(services), 2) testutils.AssertEqual(t, services[0].ServiceID, "id1") testutils.AssertEqual(t, services[1].ServiceID, "id2") }
explode_data.jsonl/24182
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 250 }
[ 2830, 3393, 852, 11025, 1155, 353, 8840, 836, 8, 341, 53326, 1669, 2915, 3622, 1758, 37508, 11, 435, 353, 1254, 9659, 8, 341, 197, 18185, 6031, 11711, 2993, 1155, 11, 435, 20798, 11, 330, 3806, 1138, 197, 18185, 6031, 11711, 2993, 115...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func Test_plugin_ServeHTTP_GetPublicKey(t *testing.T) { ctrl := gomock.NewController(t) tassert := assert.New(t) mockStore := storeMock.NewMockStore(ctrl) mockStore.EXPECT().LoadUser("key_in").Return(&store.User{ MattermostUserID: "key_in", PublicKey: []byte{1, 1}, }, nil).AnyTimes() mockStore.EXPECT().LoadUser("key_in2").Return(&store.User{ MattermostUserID: "key_in2", PublicKey: []byte{2, 2}, }, nil).AnyTimes() mockStore.EXPECT().LoadUser(gomock.Any()).Return(nil, errors.New("some error")).AnyTimes() mockStore.EXPECT().StoreUser(&store.User{ MattermostUserID: "key_in", PublicKey: []byte{1, 1}, }).Return(nil) mockStore.EXPECT().StoreUser(gomock.Any()).Return(errors.New("some error")) httpTest := test.HTTPTest{ Assertions: tassert, Encoder: test.EncodeJSON, } tests := []struct { name string request test.Request expectedResponse test.ExpectedResponse config *config.Config userID string }{ { name: "test bad request", request: test.Request{ Method: "POST", URL: fmt.Sprintf("%s/pub_keys", config.APIPath), }, expectedResponse: test.ExpectedResponse{ StatusCode: http.StatusBadRequest, ResponseType: test.ContentTypeJSON, Body: api.Error{ Message: "Bad Request", StatusCode: http.StatusBadRequest, }, }, userID: "abc", }, { name: "test not registered user", request: test.Request{ Method: "POST", URL: fmt.Sprintf("%s/pub_keys", config.APIPath), Body: struct { UserIDs []string `json:"user_ids"` }{UserIDs: []string{"abc"}}, }, expectedResponse: test.ExpectedResponse{ StatusCode: http.StatusNoContent, ResponseType: test.ContentTypeJSON, Body: api.Error{ Message: "No public keys were found for given users", StatusCode: http.StatusNoContent, }, }, userID: "abc", }, { name: "test success", request: test.Request{ Method: "POST", URL: fmt.Sprintf("%s/pub_keys", config.APIPath), Body: struct { UserIDs []string `json:"user_ids"` }{UserIDs: []string{"key_in"}}, }, expectedResponse: test.ExpectedResponse{ StatusCode: http.StatusOK, ResponseType: test.ContentTypeJSON, Body: struct { PublicKeys []string `json:"public_keys"` }{PublicKeys: []string{crypto.PublicKey([]byte{1, 1}).String()}}, }, userID: "abc", }, { name: "test successs", request: test.Request{ Method: "POST", URL: fmt.Sprintf("%s/pub_keys", config.APIPath), Body: struct { UserIDs []string `json:"user_ids"` }{UserIDs: []string{"key_in", "key_in2"}}, }, expectedResponse: test.ExpectedResponse{ StatusCode: http.StatusOK, ResponseType: test.ContentTypeJSON, Body: struct { PublicKeys []string `json:"public_keys"` }{PublicKeys: []string{crypto.PublicKey([]byte{1, 1}).String(), crypto.PublicKey([]byte{2, 2}).String()}}, }, userID: "abc", }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { p := plugin.NewWithStore(mockStore, nil) req := httpTest.CreateHTTPRequest(tt.request) req.Header.Add("Mattermost-User-ID", tt.userID) rr := httptest.NewRecorder() p.ServeHTTP(nil, rr, req) httpTest.CompareHTTPResponse(rr, tt.expectedResponse) }) } }
explode_data.jsonl/1446
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1472 }
[ 2830, 3393, 23110, 1098, 5852, 9230, 13614, 61822, 1155, 353, 8840, 836, 8, 1476, 84381, 1669, 342, 316, 1176, 7121, 2051, 1155, 340, 3244, 2207, 1669, 2060, 7121, 1155, 692, 77333, 6093, 1669, 3553, 11571, 7121, 11571, 6093, 62100, 340, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestEnvAddOnWordpress(t *testing.T) { cfg := NewDefault() defer func() { os.RemoveAll(cfg.ConfigPath) os.RemoveAll(cfg.KubectlCommandsOutputPath) os.RemoveAll(cfg.RemoteAccessCommandsOutputPath) }() os.Setenv("AWS_K8S_TESTER_EKS_ADD_ON_MANAGED_NODE_GROUPS_ENABLE", `true`) defer os.Unsetenv("AWS_K8S_TESTER_EKS_ADD_ON_MANAGED_NODE_GROUPS_ENABLE") os.Setenv("AWS_K8S_TESTER_EKS_ADD_ON_CSI_EBS_ENABLE", "true") defer os.Unsetenv("AWS_K8S_TESTER_EKS_ADD_ON_CSI_EBS_ENABLE") os.Setenv("AWS_K8S_TESTER_EKS_ADD_ON_WORDPRESS_ENABLE", "true") defer os.Unsetenv("AWS_K8S_TESTER_EKS_ADD_ON_WORDPRESS_ENABLE") os.Setenv("AWS_K8S_TESTER_EKS_ADD_ON_WORDPRESS_NAMESPACE", "word-press") defer os.Unsetenv("AWS_K8S_TESTER_EKS_ADD_ON_WORDPRESS_NAMESPACE") os.Setenv("AWS_K8S_TESTER_EKS_ADD_ON_WORDPRESS_USER_NAME", "my-user") defer os.Unsetenv("AWS_K8S_TESTER_EKS_ADD_ON_WORDPRESS_USER_NAME") os.Setenv("AWS_K8S_TESTER_EKS_ADD_ON_WORDPRESS_PASSWORD", "my-password") defer os.Unsetenv("AWS_K8S_TESTER_EKS_ADD_ON_WORDPRESS_PASSWORD") if err := cfg.UpdateFromEnvs(); err != nil { t.Fatal(err) } err := cfg.ValidateAndSetDefaults() assert.NoError(t, err) if !cfg.AddOnWordpress.Enable { t.Fatalf("unexpected cfg.AddOnWordpress.Enable %v", cfg.AddOnWordpress.Enable) } if cfg.AddOnWordpress.Namespace != "word-press" { t.Fatalf("unexpected cfg.AddOnWordpress.Namespace %q", cfg.AddOnWordpress.Namespace) } if cfg.AddOnWordpress.UserName != "my-user" { t.Fatalf("unexpected cfg.AddOnWordpress.UserName %q", cfg.AddOnWordpress.UserName) } if cfg.AddOnWordpress.Password != "my-password" { t.Fatalf("unexpected cfg.AddOnWordpress.Password %q", cfg.AddOnWordpress.Password) } }
explode_data.jsonl/69904
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 809 }
[ 2830, 3393, 14359, 2212, 1925, 10879, 1873, 1155, 353, 8840, 836, 8, 341, 50286, 1669, 1532, 3675, 741, 16867, 2915, 368, 341, 197, 25078, 84427, 28272, 10753, 1820, 340, 197, 25078, 84427, 28272, 11352, 53380, 30479, 5097, 1820, 340, 197...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func Test_Images(t *testing.T) { pod := corev1.Pod{ Spec: corev1.PodSpec{ Containers: []corev1.Container{ { Image: "image1", }, { Image: "image2", }, }, InitContainers: []corev1.Container{ { Image: "image3", }, }, }, } expected := []string{"image3", "image1", "image2"} actual := Images(pod) testutil.CheckErrorAndDeepEqual(t, false, nil, expected, actual) }
explode_data.jsonl/68110
{ "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, 62, 14228, 1155, 353, 8840, 836, 8, 341, 3223, 347, 1669, 6200, 85, 16, 88823, 515, 197, 7568, 992, 25, 6200, 85, 16, 88823, 8327, 515, 298, 197, 74632, 25, 3056, 98645, 16, 33672, 515, 571, 197, 515, 464, 53397, 25, 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 TestTakeFromIdleList(t *testing.T) { t.Parallel() sp, sc, cleanup := setup(t, SessionPoolConfig{MaxIdle: 10}) // make sure maintainer keeps the idle sessions defer cleanup() // Take ten sessions from session pool and recycle them. shs := make([]*sessionHandle, 10) for i := 0; i < len(shs); i++ { var err error shs[i], err = sp.take(context.Background()) if err != nil { t.Errorf("failed to get session(%v): %v", i, err) } } // Make sure it's sampled once before recycling, otherwise it will be cleaned up. <-time.After(sp.SessionPoolConfig.healthCheckSampleInterval) for i := 0; i < len(shs); i++ { shs[i].recycle() } // Further session requests from session pool won't cause mockclient to create more sessions. wantSessions := sc.DumpSessions() // Take ten sessions from session pool again, this time all sessions should come from idle list. gotSessions := map[string]bool{} for i := 0; i < len(shs); i++ { sh, err := sp.take(context.Background()) if err != nil { t.Errorf("cannot take session from session pool: %v", err) } gotSessions[sh.getID()] = true } if len(gotSessions) != 10 { t.Errorf("got %v unique sessions, want 10", len(gotSessions)) } if !testEqual(gotSessions, wantSessions) { t.Errorf("got sessions: %v, want %v", gotSessions, wantSessions) } }
explode_data.jsonl/78693
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 472 }
[ 2830, 3393, 17814, 3830, 41370, 852, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 2822, 41378, 11, 1136, 11, 21290, 1669, 6505, 1155, 11, 9164, 10551, 2648, 90, 5974, 41370, 25, 220, 16, 15, 5410, 442, 1281, 2704, 4981, 1743, 1359...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestRemoteWriteRetryOnRateLimit(t *testing.T) { want, err := LoadFile("testdata/remote_write_retry_on_rate_limit.good.yml") require.NoError(t, err) out, err := yaml.Marshal(want) require.NoError(t, err) got := &Config{} require.NoError(t, yaml.UnmarshalStrict(out, got)) require.Equal(t, true, got.RemoteWriteConfigs[0].QueueConfig.RetryOnRateLimit) require.Equal(t, false, got.RemoteWriteConfigs[1].QueueConfig.RetryOnRateLimit) }
explode_data.jsonl/81271
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 174 }
[ 2830, 3393, 24703, 7985, 51560, 1925, 11564, 16527, 1155, 353, 8840, 836, 8, 341, 50780, 11, 1848, 1669, 8893, 1703, 445, 92425, 14, 18147, 9165, 62745, 4470, 9246, 14763, 59569, 33936, 1138, 17957, 35699, 1155, 11, 1848, 692, 13967, 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 TestRequestWatch(t *testing.T) { testCases := []struct { Request *Request Err bool ErrFn func(error) bool Empty bool }{ { Request: &Request{err: errors.New("bail")}, Err: true, }, { Request: &Request{baseURL: &url.URL{}, pathPrefix: "%"}, Err: true, }, { Request: &Request{ client: clientFunc(func(req *http.Request) (*http.Response, error) { return nil, errors.New("err") }), baseURL: &url.URL{}, }, Err: true, }, { Request: &Request{ content: defaultContentConfig(), serializers: defaultSerializers(t), client: clientFunc(func(req *http.Request) (*http.Response, error) { return &http.Response{ StatusCode: http.StatusForbidden, Body: ioutil.NopCloser(bytes.NewReader([]byte{})), }, nil }), baseURL: &url.URL{}, }, Err: true, ErrFn: func(err error) bool { return apierrors.IsForbidden(err) }, }, { Request: &Request{ content: defaultContentConfig(), serializers: defaultSerializers(t), client: clientFunc(func(req *http.Request) (*http.Response, error) { return &http.Response{ StatusCode: http.StatusUnauthorized, Body: ioutil.NopCloser(bytes.NewReader([]byte{})), }, nil }), baseURL: &url.URL{}, }, Err: true, ErrFn: func(err error) bool { return apierrors.IsUnauthorized(err) }, }, { Request: &Request{ content: defaultContentConfig(), serializers: defaultSerializers(t), client: clientFunc(func(req *http.Request) (*http.Response, error) { return &http.Response{ StatusCode: http.StatusUnauthorized, Body: ioutil.NopCloser(bytes.NewReader([]byte(runtime.EncodeOrDie(scheme.Codecs.LegacyCodec(v1.SchemeGroupVersion), &metav1.Status{ Status: metav1.StatusFailure, Reason: metav1.StatusReasonUnauthorized, })))), }, nil }), baseURL: &url.URL{}, }, Err: true, ErrFn: func(err error) bool { return apierrors.IsUnauthorized(err) }, }, { Request: &Request{ serializers: defaultSerializers(t), client: clientFunc(func(req *http.Request) (*http.Response, error) { return nil, io.EOF }), baseURL: &url.URL{}, }, Empty: true, }, { Request: &Request{ serializers: defaultSerializers(t), client: clientFunc(func(req *http.Request) (*http.Response, error) { return nil, &url.Error{Err: io.EOF} }), baseURL: &url.URL{}, }, Empty: true, }, { Request: &Request{ serializers: defaultSerializers(t), client: clientFunc(func(req *http.Request) (*http.Response, error) { return nil, errors.New("http: can't write HTTP request on broken connection") }), baseURL: &url.URL{}, }, Empty: true, }, { Request: &Request{ serializers: defaultSerializers(t), client: clientFunc(func(req *http.Request) (*http.Response, error) { return nil, errors.New("foo: connection reset by peer") }), baseURL: &url.URL{}, }, Empty: true, }, } for i, testCase := range testCases { t.Logf("testcase %v", testCase.Request) testCase.Request.backoffMgr = &NoBackoff{} watch, err := testCase.Request.Watch() hasErr := err != nil if hasErr != testCase.Err { t.Errorf("%d: expected %t, got %t: %v", i, testCase.Err, hasErr, err) continue } if testCase.ErrFn != nil && !testCase.ErrFn(err) { t.Errorf("%d: error not valid: %v", i, err) } if hasErr && watch != nil { t.Errorf("%d: watch should be nil when error is returned", i) continue } if testCase.Empty { _, ok := <-watch.ResultChan() if ok { t.Errorf("%d: expected the watch to be empty: %#v", i, watch) } } } }
explode_data.jsonl/13267
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1720 }
[ 2830, 3393, 1900, 14247, 1155, 353, 8840, 836, 8, 341, 18185, 37302, 1669, 3056, 1235, 341, 197, 73806, 353, 1900, 198, 197, 197, 7747, 257, 1807, 198, 197, 197, 7747, 24911, 256, 2915, 6390, 8, 1807, 198, 197, 197, 3522, 256, 1807, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestSplayCalculation(t *testing.T) { assert := assert.New(t) check := corev2.FixtureCheckConfig("check1") check.ProxyRequests = corev2.FixtureProxyRequests(true) // 10s * 90% / 3 = 3 check.Interval = 10 splay, err := calculateSplayInterval(check, 3) assert.Equal(3*time.Second, splay) assert.Nil(err) // 20s * 50% / 5 = 2 check.Interval = 20 check.ProxyRequests.SplayCoverage = 50 splay, err = calculateSplayInterval(check, 5) assert.Equal(2*time.Second, splay) assert.Nil(err) // invalid cron string check.Cron = "invalid" splay, err = calculateSplayInterval(check, 5) assert.Equal(time.Duration(0), splay) assert.NotNil(err) // at most, 60s from current time * 50% / 2 = 15 // this test will depend on when it is run, but the // largest splay calculation will be 15 check.Cron = "* * * * *" splay, err = calculateSplayInterval(check, 2) assert.True(splay >= 0 && splay <= 15*time.Second) assert.Nil(err) }
explode_data.jsonl/69787
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 364 }
[ 2830, 3393, 50, 1363, 47168, 2914, 1155, 353, 8840, 836, 8, 341, 6948, 1669, 2060, 7121, 1155, 692, 25157, 1669, 6200, 85, 17, 991, 12735, 3973, 2648, 445, 2028, 16, 1138, 25157, 75200, 35295, 284, 6200, 85, 17, 991, 12735, 16219, 352...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestServiceCreateWithServiceAccountName(t *testing.T) { action, created, _, err := fakeServiceCreate([]string{ "service", "create", "foo", "--image", "gcr.io/foo/bar:baz", "--service-account", "foo-bar-account", "--no-wait"}, false) if err != nil { t.Fatal(err) } else if !action.Matches("create", "services") { t.Fatalf("Bad action %v", action) } template := &created.Spec.Template if err != nil { t.Fatal(err) } else if template.Spec.ServiceAccountName != "foo-bar-account" { t.Fatalf("wrong service account name:%v", template.Spec.ServiceAccountName) } }
explode_data.jsonl/42458
{ "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, 1860, 4021, 2354, 1860, 7365, 675, 1155, 353, 8840, 836, 8, 341, 38933, 11, 3465, 11, 8358, 1848, 1669, 12418, 1860, 4021, 10556, 917, 515, 197, 197, 1, 7936, 497, 330, 3182, 497, 330, 7975, 497, 14482, 1805, 497, 330, 7...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
5
func Test_generator_Generate(t *testing.T) { type fields struct { path string data GeneratorData generationPath string } type args struct { ctx context.Context } tests := []struct { name string fields fields args args wantFiles []fileResult wantErr bool }{ { "Generate template with directory generator", fields{ path: filepath.Join("testing", "templates", "valid", "app"), data: GeneratorData{ &model.Template{ Name: "test", }, &model.Generator{ Name: "app", }, values.Values{ "foo": "bar", "bar": "foo", }, }, }, args{context.Background()}, []fileResult{ fileResult{ relativePath: "hi.js", contents: testutils.ReadFile(t, "testing", "expected", "templates", "valid", "app", "hi.js"), }, fileResult{ relativePath: "internal/hi.js", contents: testutils.ReadFile(t, "testing", "expected", "templates", "valid", "app", "hi.js"), }, }, false, }, { "Generate template with file generator relative path", fields{ path: filepath.Join("testing", "templates", "valid", "controller"), data: GeneratorData{ &model.Template{ Name: "test", }, &model.Generator{ Name: "controller", TType: model.GeneratorTypeFile, FileTypeOptions: model.FileTypeOptions{ DefaultTemplateFile: "Controller.java", }, }, values.Values{ "Name": "Foo", }, }, generationPath: "NewController.java", }, args{context.Background()}, []fileResult{ fileResult{ relativePath: "NewController.java", contents: testutils.ReadFile(t, "testing", "expected", "templates", "valid", "controller", "Controller.java"), }, }, false, }, { "Generate template with file generator on internal directory", fields{ path: filepath.Join("testing", "templates", "valid", "controller"), data: GeneratorData{ &model.Template{ Name: "test", }, &model.Generator{ Name: "controller", TType: model.GeneratorTypeFile, FileTypeOptions: model.FileTypeOptions{ DefaultTemplateFile: "Controller.java", FileGenerationRelativePath: "controllers", }, }, values.Values{ "Name": "Foo", }, }, generationPath: "NewController.java", }, args{context.Background()}, []fileResult{ fileResult{ relativePath: "controllers/NewController.java", contents: testutils.ReadFile(t, "testing", "expected", "templates", "valid", "controller", "Controller.java"), }, }, false, }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { tempDir := testutils.CreateTempDir("test_valid", t) generationDir := filepath.Join(tempDir, filepath.Dir(tt.fields.generationPath)) generationPath := filepath.Join(tempDir, tt.fields.generationPath) _ = os.MkdirAll(generationDir, os.ModePerm) defer func() { _ = os.RemoveAll(tempDir) }() g := NewGenerator( tt.fields.path, generationPath, tt.fields.data, SetGeneratorOutput(ioutil.Discard), ) if err := g.Generate(tt.args.ctx); (err != nil) != tt.wantErr { t.Errorf("generator.Generate() error = %v, wantErr %v", err, tt.wantErr) return } for _, wantFile := range tt.wantFiles { file, err := ioutil.ReadFile(filepath.Join(tempDir, wantFile.relativePath)) if err != nil { t.Errorf("generator.Generate() error = %v file should exists", wantFile.relativePath) continue } if string(file) != wantFile.contents { t.Errorf("Generator.Generate() \ncontents\n %s\n want \n%s\n", string(file), wantFile.contents) } } }) } }
explode_data.jsonl/69727
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1669 }
[ 2830, 3393, 25813, 2646, 13220, 1155, 353, 8840, 836, 8, 341, 13158, 5043, 2036, 341, 197, 26781, 1843, 914, 198, 197, 8924, 1843, 28358, 1043, 198, 197, 3174, 17252, 1820, 914, 198, 197, 532, 13158, 2827, 2036, 341, 197, 20985, 2266, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestBadDialServer(t *testing.T) { dialer := NewDialer(Config{ DialServer: func() (net.Conn, error) { return nil, fmt.Errorf("I refuse to dial") }, }) _, err := dialer.Dial("tcp", "www.google.com") assert.Error(t, err, "Dialing with a bad DialServer function should have failed") }
explode_data.jsonl/15722
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 110 }
[ 2830, 3393, 17082, 35, 530, 5475, 1155, 353, 8840, 836, 8, 341, 2698, 530, 261, 1669, 1532, 35, 530, 261, 33687, 515, 197, 10957, 530, 5475, 25, 2915, 368, 320, 4711, 50422, 11, 1465, 8, 341, 298, 853, 2092, 11, 8879, 13080, 445, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestTimeoutStore(t *testing.T) { mr, err := miniredis.Run() if err != nil { t.Fatal(err) } port, err := strconv.Atoi(mr.Port()) if err != nil { t.Fatal(err) } rdb := redis.NewRedis(conf.RedisConf{ Port: port, Host: mr.Host(), DisableTLS: true, }) ts := redis.NewTimeoutStore(rdb) key := "foo" if ts.IsOnTimeout(key) { t.Fatal("should not be on timeout") } err = ts.SetTimeout(key, 5*time.Minute) if err != nil { t.Fatal(err) } if !ts.IsOnTimeout(key) { t.Fatal("key is on timeout") } }
explode_data.jsonl/3221
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 259 }
[ 2830, 3393, 7636, 6093, 1155, 353, 8840, 836, 8, 341, 2109, 81, 11, 1848, 1669, 1308, 2690, 285, 16708, 741, 743, 1848, 961, 2092, 341, 197, 3244, 26133, 3964, 340, 197, 630, 52257, 11, 1848, 1669, 33317, 67107, 1255, 81, 43013, 2398,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestWriteECFriendlyBlock(t *testing.T) { extent, err := CreateExtent("localtest.ext", 100) require.Nil(t, err) //extent.ResetWriter() defer os.Remove("localtest.ext") b1 := generateBlock(512 << 10) extent.Lock() extent.AppendBlocks([]*pb.Block{b1}, true) extent.AppendBlocks([]*pb.Block{b1}, true) extent.Unlock() blocks, _, _, err := extent.ReadBlocks(0, 2, 5<<20) require.Nil(t, err) require.Equal(t, b1, blocks[0]) require.Equal(t, b1, blocks[1]) }
explode_data.jsonl/14634
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 205 }
[ 2830, 3393, 7985, 7498, 96505, 4713, 1155, 353, 8840, 836, 8, 341, 197, 70172, 11, 1848, 1669, 4230, 49818, 445, 2438, 1944, 9220, 497, 220, 16, 15, 15, 340, 17957, 59678, 1155, 11, 1848, 340, 197, 322, 70172, 36660, 6492, 741, 16867,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestCreatePerfEvent(t *testing.T) { fd, err := createPerfEvent(0, 1) if err != nil { t.Fatal("Can't create perf event:", err) } unix.Close(fd) }
explode_data.jsonl/18695
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 67 }
[ 2830, 3393, 4021, 3889, 69, 1556, 1155, 353, 8840, 836, 8, 341, 61721, 11, 1848, 1669, 1855, 3889, 69, 1556, 7, 15, 11, 220, 16, 340, 743, 1848, 961, 2092, 341, 197, 3244, 26133, 445, 6713, 944, 1855, 21784, 1538, 12147, 1848, 340, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
2
func TestLocale(t *testing.T) { trans := New() expected := "rm" if trans.Locale() != expected { t.Errorf("Expected '%s' Got '%s'", expected, trans.Locale()) } }
explode_data.jsonl/40879
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 78 }
[ 2830, 3393, 19231, 1155, 353, 8840, 836, 8, 8022, 72453, 1669, 1532, 3568, 42400, 1669, 330, 8719, 18591, 743, 1356, 59094, 368, 961, 3601, 972, 197, 3244, 13080, 445, 18896, 7677, 82, 6, 24528, 7677, 82, 22772, 3601, 11, 1356, 59094, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestSubaccountTransfer(t *testing.T) { tt := []struct { Coin currency.Code Source string Destination string Size float64 ErrExpected error }{ {ErrExpected: errCoinMustBeSpecified}, {Coin: currency.BTC, ErrExpected: errSubaccountTransferSizeGreaterThanZero}, {Coin: currency.BTC, Size: 420, ErrExpected: errSubaccountTransferSourceDestinationMustNotBeEqual}, } for x := range tt { _, err := f.SubaccountTransfer(context.Background(), tt[x].Coin, tt[x].Source, tt[x].Destination, tt[x].Size) if !errors.Is(err, tt[x].ErrExpected) { t.Errorf("expected %s, but received: %s", tt[x].ErrExpected, err) } } if !areTestAPIKeysSet() || !canManipulateRealOrders { t.Skip("skipping test, either api keys or canManipulateRealOrders isn't set") } _, err := f.SubaccountTransfer(context.Background(), currency.BTC, "", "test", 0.1) if err != nil { t.Error(err) } }
explode_data.jsonl/15250
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 369 }
[ 2830, 3393, 3136, 4608, 21970, 1155, 353, 8840, 836, 8, 341, 3244, 83, 1669, 3056, 1235, 341, 197, 6258, 1961, 286, 11413, 20274, 198, 197, 197, 3608, 414, 914, 198, 197, 10957, 20646, 914, 198, 197, 91224, 286, 2224, 21, 19, 198, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
6
func TestFollowThreads(t *testing.T) { th := Setup(t).InitBasic() defer th.TearDown() th.App.UpdateConfig(func(cfg *model.Config) { *cfg.ServiceSettings.ThreadAutoFollow = true *cfg.ServiceSettings.CollapsedThreads = model.CollapsedThreadsDefaultOn }) t.Run("1 thread", func(t *testing.T) { client := th.Client rpost, resp, err := client.CreatePost(&model.Post{ChannelId: th.BasicChannel.Id, Message: "testMsg"}) require.NoError(t, err) CheckCreatedStatus(t, resp) _, resp, err = client.CreatePost(&model.Post{ChannelId: th.BasicChannel.Id, Message: "testReply", RootId: rpost.Id}) require.NoError(t, err) CheckCreatedStatus(t, resp) defer th.App.Srv().Store.Post().PermanentDeleteByUser(th.BasicUser.Id) var uss *model.Threads uss, _, err = th.Client.GetUserThreads(th.BasicUser.Id, th.BasicTeam.Id, model.GetUserThreadsOpts{ Deleted: false, }) require.NoError(t, err) require.Len(t, uss.Threads, 1) resp, err = th.Client.UpdateThreadFollowForUser(th.BasicUser.Id, th.BasicTeam.Id, rpost.Id, false) require.NoError(t, err) CheckOKStatus(t, resp) uss, _, err = th.Client.GetUserThreads(th.BasicUser.Id, th.BasicTeam.Id, model.GetUserThreadsOpts{ Deleted: false, }) require.NoError(t, err) require.Len(t, uss.Threads, 0) resp, err = th.Client.UpdateThreadFollowForUser(th.BasicUser.Id, th.BasicTeam.Id, rpost.Id, true) require.NoError(t, err) CheckOKStatus(t, resp) uss, _, err = th.Client.GetUserThreads(th.BasicUser.Id, th.BasicTeam.Id, model.GetUserThreadsOpts{ Deleted: false, }) require.NoError(t, err) require.Len(t, uss.Threads, 1) require.GreaterOrEqual(t, uss.Threads[0].LastViewedAt, uss.Threads[0].LastReplyAt) }) t.Run("No permission to channel", func(t *testing.T) { // Add user1 to private channel _, appErr := th.App.AddUserToChannel(th.BasicUser, th.BasicPrivateChannel2, false) require.Nil(t, appErr) defer th.App.RemoveUserFromChannel(th.Context, th.BasicUser.Id, "", th.BasicPrivateChannel2) // create thread in private channel rpost, resp, err := th.Client.CreatePost(&model.Post{ChannelId: th.BasicPrivateChannel2.Id, Message: "root post"}) require.NoError(t, err) CheckCreatedStatus(t, resp) _, resp, err = th.Client.CreatePost(&model.Post{ChannelId: th.BasicPrivateChannel2.Id, Message: "testReply", RootId: rpost.Id}) require.NoError(t, err) CheckCreatedStatus(t, resp) // Try to follow thread as other user who is not in the private channel resp, err = th.Client.UpdateThreadFollowForUser(th.BasicUser2.Id, th.BasicTeam.Id, rpost.Id, true) require.Error(t, err) CheckForbiddenStatus(t, resp) // Try to unfollow thread as other user who is not in the private channel resp, err = th.Client.UpdateThreadFollowForUser(th.BasicUser2.Id, th.BasicTeam.Id, rpost.Id, false) require.Error(t, err) CheckForbiddenStatus(t, resp) }) }
explode_data.jsonl/47573
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1111 }
[ 2830, 3393, 12480, 38666, 1155, 353, 8840, 836, 8, 341, 70479, 1669, 18626, 1155, 568, 3803, 15944, 741, 16867, 270, 836, 682, 4454, 2822, 70479, 5105, 16689, 2648, 18552, 28272, 353, 2528, 10753, 8, 341, 197, 197, 9, 14072, 13860, 6086...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestGetClusterFromRouteConfiguration(t *testing.T) { tests := []struct { name string rc *xdspb.RouteConfiguration wantCluster string }{ { name: "no-virtual-hosts-in-rc", rc: emptyRouteConfig, wantCluster: "", }, { name: "no-domains-in-rc", rc: noDomainsInRouteConfig, wantCluster: "", }, { name: "non-matching-domain-in-rc", rc: &xdspb.RouteConfiguration{ VirtualHosts: []*routepb.VirtualHost{ {Domains: []string{uninterestingDomain}}, }, }, wantCluster: "", }, { name: "no-routes-in-rc", rc: &xdspb.RouteConfiguration{ VirtualHosts: []*routepb.VirtualHost{ {Domains: []string{goodMatchingDomain}}, }, }, wantCluster: "", }, { name: "default-route-match-field-is-non-nil", rc: &xdspb.RouteConfiguration{ VirtualHosts: []*routepb.VirtualHost{ { Domains: []string{goodMatchingDomain}, Routes: []*routepb.Route{ { Match: &routepb.RouteMatch{}, Action: &routepb.Route_Route{}, }, }, }, }, }, wantCluster: "", }, { name: "default-route-routeaction-field-is-nil", rc: &xdspb.RouteConfiguration{ VirtualHosts: []*routepb.VirtualHost{ { Domains: []string{goodMatchingDomain}, Routes: []*routepb.Route{{}}, }, }, }, wantCluster: "", }, { name: "default-route-cluster-field-is-empty", rc: &xdspb.RouteConfiguration{ VirtualHosts: []*routepb.VirtualHost{ { Domains: []string{goodMatchingDomain}, Routes: []*routepb.Route{ { Action: &routepb.Route_Route{ Route: &routepb.RouteAction{ ClusterSpecifier: &routepb.RouteAction_ClusterHeader{}, }, }, }, }, }, }, }, wantCluster: "", }, { name: "good-route-config", rc: goodRouteConfig1, wantCluster: goodClusterName1, }, } for _, test := range tests { t.Run(test.name, func(t *testing.T) { if gotCluster := getClusterFromRouteConfiguration(test.rc, goodLDSTarget1); gotCluster != test.wantCluster { t.Errorf("getClusterFromRouteConfiguration(%+v, %v) = %v, want %v", test.rc, goodLDSTarget1, gotCluster, test.wantCluster) } }) } }
explode_data.jsonl/51248
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1178 }
[ 2830, 3393, 1949, 28678, 3830, 4899, 7688, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 3056, 1235, 341, 197, 11609, 286, 914, 198, 197, 30295, 688, 353, 9703, 43467, 58004, 7688, 198, 197, 50780, 28678, 914, 198, 197, 59403, 197, 197, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestAsyncPutRequest(t *testing.T) { t.Log("Sending PUT async request... (expected http code: 200)") req := NewRequest() ch := make(chan *AsyncResponse) for i := 0; i <= 100; i++ { req.AsyncPut("http://httpbin.org/put", ch) } for i := 0; i <= 100; i++ { aRes := <-ch if aRes.Err != nil { t.Error(aRes.Err) } if aRes.Resp.GetStatusCode() != 200 { t.Error( "For", "PUT http://httpbin.org/put", "expected", 200, "got", aRes.Resp.GetStatusCode(), ) } } }
explode_data.jsonl/74147
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 225 }
[ 2830, 3393, 6525, 19103, 1900, 1155, 353, 8840, 836, 8, 341, 3244, 5247, 445, 49282, 34380, 3312, 1681, 1112, 320, 7325, 1758, 2038, 25, 220, 17, 15, 15, 95377, 24395, 1669, 1532, 1900, 741, 23049, 1669, 1281, 35190, 353, 6525, 2582, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestGenerateExtraVarsCommand(t *testing.T) { tests := []struct { desc string options *AnsibleAdhocOptions err error extravars string }{ { desc: "Testing extra vars map[string]string", options: &AnsibleAdhocOptions{ ExtraVars: map[string]interface{}{ "extra": "var", }, }, err: nil, extravars: "{\"extra\":\"var\"}", }, { desc: "Testing extra vars map[string]bool", options: &AnsibleAdhocOptions{ ExtraVars: map[string]interface{}{ "extra": true, }, }, err: nil, extravars: "{\"extra\":true}", }, { desc: "Testing extra vars map[string]int", options: &AnsibleAdhocOptions{ ExtraVars: map[string]interface{}{ "extra": 10, }, }, err: nil, extravars: "{\"extra\":10}", }, { desc: "Testing extra vars map[string][]string", options: &AnsibleAdhocOptions{ ExtraVars: map[string]interface{}{ "extra": []string{"var"}, }, }, err: nil, extravars: "{\"extra\":[\"var\"]}", }, { desc: "Testing extra vars map[string]map[string]string", options: &AnsibleAdhocOptions{ ExtraVars: map[string]interface{}{ "extra": map[string]string{ "var": "value", }, }, }, err: nil, extravars: "{\"extra\":{\"var\":\"value\"}}", }, } for _, test := range tests { t.Run(test.desc, func(t *testing.T) { t.Log(test.desc) extravars, err := test.options.generateExtraVarsCommand() if err != nil && assert.Error(t, err) { assert.Equal(t, test.err, err) } else { assert.Equal(t, extravars, test.extravars, "Unexpected options value") } }) } }
explode_data.jsonl/69689
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 798 }
[ 2830, 3393, 31115, 11612, 28305, 4062, 1155, 353, 8840, 836, 8, 1476, 78216, 1669, 3056, 1235, 341, 197, 41653, 414, 914, 198, 197, 35500, 256, 353, 69599, 1238, 2589, 88473, 3798, 198, 197, 9859, 981, 1465, 198, 197, 8122, 376, 402, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestStream_ReaderWriterJSON(t *testing.T) { addr := genAddr(t) done := make(chan struct{}) want := "HELLO" go func() { defer close(done) stream := makeReadStream(addr, t) reader := stream.Reader() var have string err := json.NewDecoder(reader).Decode(&have) assert.Nil(t, err) assert.Equal(t, want, have) assert.Nil(t, reader.Close()) }() time.Sleep(time.Second) // write stream := makeWriteStream(addr, t) writer := stream.Writer() err := json.NewEncoder(writer).Encode("HELLO") assert.Nil(t, err) assert.Nil(t, writer.Close()) <-done }
explode_data.jsonl/58208
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 233 }
[ 2830, 3393, 3027, 62, 5062, 6492, 5370, 1155, 353, 8840, 836, 8, 341, 53183, 1669, 4081, 13986, 1155, 340, 40495, 1669, 1281, 35190, 2036, 37790, 50780, 1669, 330, 50712, 1593, 1837, 30680, 2915, 368, 341, 197, 16867, 3265, 34232, 340, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestRaceFlushVersusAddSample(t *testing.T) { config.DetectFeatures() metricAgent := &ServerlessMetricAgent{} defer metricAgent.Stop() metricAgent.Start(10*time.Second, &ValidMetricConfigMocked{}, &MetricDogStatsD{}) assert.NotNil(t, metricAgent.Demux) go func() { http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { time.Sleep(10 * time.Millisecond) }) err := http.ListenAndServe("localhost:8888", nil) if err != nil { panic(err) } }() go func() { for i := 0; i < 1000; i++ { n := rand.Intn(10) time.Sleep(time.Duration(n) * time.Microsecond) go SendTimeoutEnhancedMetric([]string{"tag0:value0", "tag1:value1"}, metricAgent.Demux) } }() go func() { for i := 0; i < 1000; i++ { n := rand.Intn(10) time.Sleep(time.Duration(n) * time.Microsecond) go metricAgent.Flush() } }() time.Sleep(2 * time.Second) }
explode_data.jsonl/50624
{ "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, 55991, 46874, 83956, 355, 2212, 17571, 1155, 353, 8840, 836, 8, 1476, 25873, 909, 13176, 21336, 2822, 2109, 16340, 16810, 1669, 609, 5475, 1717, 54310, 16810, 16094, 16867, 18266, 16810, 30213, 741, 2109, 16340, 16810, 12101, 7,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestDomains_GetDomain(t *testing.T) { setup() defer teardown() mux.HandleFunc("/v2/domains/example.com", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, http.MethodGet) fmt.Fprint(w, `{"domain":{"name":"example.com"}}`) }) domains, _, err := client.Domains.Get(ctx, "example.com") if err != nil { t.Errorf("domain.Get returned error: %v", err) } expected := &Domain{Name: "example.com"} if !reflect.DeepEqual(domains, expected) { t.Errorf("domains.Get returned %+v, expected %+v", domains, expected) } }
explode_data.jsonl/22671
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 217 }
[ 2830, 3393, 74713, 13614, 13636, 1155, 353, 8840, 836, 8, 341, 84571, 741, 16867, 49304, 2822, 2109, 2200, 63623, 4283, 85, 17, 71344, 1735, 65182, 905, 497, 2915, 3622, 1758, 37508, 11, 435, 353, 1254, 9659, 8, 341, 197, 18185, 3523, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestMurmurHash3_k1Calc(t *testing.T) { type fields struct { k1 uint64 k2 uint64 h1 uint64 h2 uint64 } tests := []struct { name string fields fields }{ { name: "123456", fields: fields{ h1: 123456, h2: 123456, }, }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { m := &MurmurHash3{ k1: tt.fields.k1, k2: tt.fields.k2, h1: tt.fields.h1, h2: tt.fields.h2, } m.k1Calc() }) } }
explode_data.jsonl/55815
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 266 }
[ 2830, 3393, 44, 52370, 324, 6370, 18, 4698, 16, 47168, 1155, 353, 8840, 836, 8, 341, 13158, 5043, 2036, 341, 197, 16463, 16, 2622, 21, 19, 198, 197, 16463, 17, 2622, 21, 19, 198, 197, 9598, 16, 2622, 21, 19, 198, 197, 9598, 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 TestInClusterClientConfigPrecedence(t *testing.T) { tt := []struct { overrides *ConfigOverrides }{ { overrides: &ConfigOverrides{ ClusterInfo: clientcmdapi.Cluster{ Server: "https://host-from-overrides.com", }, }, }, { overrides: &ConfigOverrides{ AuthInfo: clientcmdapi.AuthInfo{ Token: "https://host-from-overrides.com", }, }, }, { overrides: &ConfigOverrides{ ClusterInfo: clientcmdapi.Cluster{ CertificateAuthority: "/path/to/ca-from-overrides.crt", }, }, }, { overrides: &ConfigOverrides{ ClusterInfo: clientcmdapi.Cluster{ Server: "https://host-from-overrides.com", }, AuthInfo: clientcmdapi.AuthInfo{ Token: "https://host-from-overrides.com", }, }, }, { overrides: &ConfigOverrides{ ClusterInfo: clientcmdapi.Cluster{ Server: "https://host-from-overrides.com", CertificateAuthority: "/path/to/ca-from-overrides.crt", }, }, }, { overrides: &ConfigOverrides{ ClusterInfo: clientcmdapi.Cluster{ CertificateAuthority: "/path/to/ca-from-overrides.crt", }, AuthInfo: clientcmdapi.AuthInfo{ Token: "https://host-from-overrides.com", }, }, }, { overrides: &ConfigOverrides{ ClusterInfo: clientcmdapi.Cluster{ Server: "https://host-from-overrides.com", CertificateAuthority: "/path/to/ca-from-overrides.crt", }, AuthInfo: clientcmdapi.AuthInfo{ Token: "https://host-from-overrides.com", }, }, }, { overrides: &ConfigOverrides{}, }, } for _, tc := range tt { expectedServer := "https://host-from-cluster.com" expectedToken := "token-from-cluster" expectedCAFile := "/path/to/ca-from-cluster.crt" icc := &inClusterClientConfig{ inClusterConfigProvider: func() (*restclient.Config, error) { return &restclient.Config{ Host: expectedServer, BearerToken: expectedToken, TLSClientConfig: restclient.TLSClientConfig{ CAFile: expectedCAFile, }, }, nil }, overrides: tc.overrides, } clientConfig, err := icc.ClientConfig() if err != nil { t.Fatalf("Unxpected error: %v", err) } if overridenServer := tc.overrides.ClusterInfo.Server; len(overridenServer) > 0 { expectedServer = overridenServer } if overridenToken := tc.overrides.AuthInfo.Token; len(overridenToken) > 0 { expectedToken = overridenToken } if overridenCAFile := tc.overrides.ClusterInfo.CertificateAuthority; len(overridenCAFile) > 0 { expectedCAFile = overridenCAFile } if clientConfig.Host != expectedServer { t.Errorf("Expected server %v, got %v", expectedServer, clientConfig.Host) } if clientConfig.BearerToken != expectedToken { t.Errorf("Expected token %v, got %v", expectedToken, clientConfig.BearerToken) } if clientConfig.TLSClientConfig.CAFile != expectedCAFile { t.Errorf("Expected Certificate Authority %v, got %v", expectedCAFile, clientConfig.TLSClientConfig.CAFile) } } }
explode_data.jsonl/56170
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1327 }
[ 2830, 3393, 641, 28678, 2959, 2648, 4703, 1998, 763, 1155, 353, 8840, 836, 8, 341, 3244, 83, 1669, 3056, 1235, 341, 197, 197, 83358, 353, 2648, 80010, 198, 197, 59403, 197, 197, 515, 298, 197, 83358, 25, 609, 2648, 80010, 515, 571, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestSuccessAfterTemp(t *testing.T) { tempErr := fmt.Errorf("this is a temp error") var count int fstore := failstore.NewFailstore(ds.NewMapDatastore(), func(op string) error { count++ if count < 3 { return tempErr } count = 0 return nil }) rds := &Datastore{ Batching: fstore, Retries: 5, TempErrFunc: func(err error) bool { return err == tempErr }, } k := ds.NewKey("test") val := []byte("foo") err := rds.Put(k, val) if err != nil { t.Fatal(err) } has, err := rds.Has(k) if err != nil { t.Fatal(err) } if !has { t.Fatal("should have this thing") } out, err := rds.Get(k) if err != nil { t.Fatal(err) } if string(out) != string(val) { t.Fatal("got wrong value") } }
explode_data.jsonl/28918
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 334 }
[ 2830, 3393, 7188, 6025, 12151, 1155, 353, 8840, 836, 8, 341, 16280, 7747, 1669, 8879, 13080, 445, 574, 374, 264, 2730, 1465, 1138, 2405, 1760, 526, 198, 1166, 4314, 1669, 3690, 4314, 7121, 19524, 4314, 33783, 7121, 2227, 1043, 4314, 150...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestSqrt(t *testing.T) { // Define test cases testCases := []struct { a float64 b float64 want float64 description string errExpected bool }{ { description: "negative input", a: -64, want: 123456789, errExpected: true, }, { description: "64", a: 64, want: 8, }, } t.Parallel() for _, c := range testCases { got, err := calculator.Sqrt(c.a) if err != nil && !c.errExpected { t.Errorf("error received while testing %s. The function call was: Sqrt(%v), and the error was: %v", c.description, c.a, err) } // Only fail on want != got if an error was not expected if !c.errExpected && c.want != got { t.Errorf("want %v, got %v, while testing %s. The function call was: Sqrt(%v)", c.want, got, c.description, c.a) } } }
explode_data.jsonl/12264
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 398 }
[ 2830, 3393, 50, 8140, 1155, 353, 8840, 836, 8, 341, 197, 322, 18614, 1273, 5048, 198, 18185, 37302, 1669, 3056, 1235, 341, 197, 11323, 1843, 2224, 21, 19, 198, 197, 2233, 1843, 2224, 21, 19, 198, 197, 50780, 286, 2224, 21, 19, 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...
6
func TestAssociateManagerByUsernameAndOrigin(t *testing.T) { Convey("Associate manager by username and origin", t, func() { expectedBody := `{"origin":"ldap","username":"user-name"}` setup(MockRoute{"PUT", "/v2/organizations/bc7b4caf-f4b8-4d85-b126-0729b9351e56/managers", []string{associateOrgUserPayload}, "", 201, "", &expectedBody}, t) defer teardown() c := &Config{ ApiAddress: server.URL, Token: "foobar", } client, err := NewClient(c) So(err, ShouldBeNil) org := &Org{ Guid: "bc7b4caf-f4b8-4d85-b126-0729b9351e56", c: client, } newOrg, err := org.AssociateManagerByUsernameAndOrigin("user-name", "ldap") So(err, ShouldBeNil) So(newOrg.Guid, ShouldEqual, "bc7b4caf-f4b8-4d85-b126-0729b9351e56") }) }
explode_data.jsonl/4444
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 343 }
[ 2830, 3393, 95540, 2043, 91519, 3036, 13298, 1155, 353, 8840, 836, 8, 341, 93070, 5617, 445, 95540, 6645, 553, 5934, 323, 6238, 497, 259, 11, 2915, 368, 341, 197, 42400, 5444, 1669, 1565, 4913, 8611, 3252, 38665, 2198, 5113, 3252, 872, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestAgent_Metrics_ACLDeny(t *testing.T) { t.Parallel() a := NewTestAgent(t.Name(), TestACLConfig()) defer a.Shutdown() t.Run("no token", func(t *testing.T) { req, _ := http.NewRequest("GET", "/v1/agent/metrics", nil) if _, err := a.srv.AgentMetrics(nil, req); !acl.IsErrPermissionDenied(err) { t.Fatalf("err: %v", err) } }) t.Run("agent master token", func(t *testing.T) { req, _ := http.NewRequest("GET", "/v1/agent/metrics?token=towel", nil) if _, err := a.srv.AgentMetrics(nil, req); err != nil { t.Fatalf("err: %v", err) } }) t.Run("read-only token", func(t *testing.T) { ro := makeReadOnlyAgentACL(t, a.srv) req, _ := http.NewRequest("GET", fmt.Sprintf("/v1/agent/metrics?token=%s", ro), nil) if _, err := a.srv.AgentMetrics(nil, req); err != nil { t.Fatalf("err: %v", err) } }) }
explode_data.jsonl/33596
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 376 }
[ 2830, 3393, 16810, 1245, 13468, 97627, 23619, 88, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 741, 11323, 1669, 1532, 2271, 16810, 1155, 2967, 1507, 3393, 55393, 2648, 2398, 16867, 264, 10849, 18452, 2822, 3244, 16708, 445, 2152, 395...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestRenameRepoAction(t *testing.T) { assert.NoError(t, PrepareTestDatabase()) user := AssertExistsAndLoadBean(t, &User{ID: 2}).(*User) repo := AssertExistsAndLoadBean(t, &Repository{OwnerID: user.ID}).(*Repository) repo.Owner = user oldRepoName := repo.Name const newRepoName = "newRepoName" repo.Name = newRepoName repo.LowerName = strings.ToLower(newRepoName) actionBean := &Action{ OpType: ActionRenameRepo, ActUserID: user.ID, ActUser: user, RepoID: repo.ID, Repo: repo, IsPrivate: repo.IsPrivate, Content: oldRepoName, } AssertNotExistsBean(t, actionBean) assert.NoError(t, RenameRepoAction(user, oldRepoName, repo)) AssertExistsAndLoadBean(t, actionBean) _, err := x.ID(repo.ID).Cols("name", "lower_name").Update(repo) assert.NoError(t, err) CheckConsistencyFor(t, &Action{}) }
explode_data.jsonl/74206
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 359 }
[ 2830, 3393, 88757, 25243, 2512, 1155, 353, 8840, 836, 8, 341, 6948, 35699, 1155, 11, 31166, 2271, 5988, 12367, 19060, 1669, 5319, 15575, 3036, 5879, 10437, 1155, 11, 609, 1474, 90, 915, 25, 220, 17, 16630, 4071, 1474, 340, 17200, 5368, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestRequiredCreateOpts(t *testing.T) { res := monitors.Create(fake.ServiceClient(), monitors.CreateOpts{}) if res.Err == nil { t.Fatalf("Expected error, got none") } res = monitors.Create(fake.ServiceClient(), monitors.CreateOpts{Type: monitors.TypeHTTP}) if res.Err == nil { t.Fatalf("Expected error, got none") } }
explode_data.jsonl/7656
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 118 }
[ 2830, 3393, 8164, 4021, 43451, 1155, 353, 8840, 836, 8, 341, 10202, 1669, 36477, 7251, 74138, 13860, 2959, 1507, 36477, 7251, 43451, 37790, 743, 592, 27862, 621, 2092, 341, 197, 3244, 30762, 445, 18896, 1465, 11, 2684, 6857, 1138, 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 TestOpenShiftClusterStaticValidateAPIServerProfile(t *testing.T) { commonTests := []*validateTest{ { name: "valid", }, { name: "visibility invalid", modify: func(oc *OpenShiftCluster) { oc.Properties.APIServerProfile.Visibility = "invalid" }, wantErr: "400: InvalidParameter: properties.apiserverProfile.visibility: The provided visibility 'invalid' is invalid.", }, { name: "url invalid", modify: func(oc *OpenShiftCluster) { oc.Properties.APIServerProfile.URL = "\x00" }, wantErr: "400: InvalidParameter: properties.apiserverProfile.url: The provided URL '\x00' is invalid.", }, { name: "ip invalid", modify: func(oc *OpenShiftCluster) { oc.Properties.APIServerProfile.IP = "invalid" }, wantErr: "400: InvalidParameter: properties.apiserverProfile.ip: The provided IP 'invalid' is invalid.", }, { name: "ipv6 ip invalid", modify: func(oc *OpenShiftCluster) { oc.Properties.APIServerProfile.IP = "::" }, wantErr: "400: InvalidParameter: properties.apiserverProfile.ip: The provided IP '::' is invalid: must be IPv4.", }, } createTests := []*validateTest{ { name: "empty url valid", modify: func(oc *OpenShiftCluster) { oc.Properties.APIServerProfile.URL = "" }, }, { name: "empty ip valid", modify: func(oc *OpenShiftCluster) { oc.Properties.APIServerProfile.IP = "" }, }, } runTests(t, testModeCreate, createTests) runTests(t, testModeCreate, commonTests) runTests(t, testModeUpdate, commonTests) }
explode_data.jsonl/39085
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 622 }
[ 2830, 3393, 5002, 24841, 28678, 11690, 17926, 2537, 1637, 2836, 8526, 1155, 353, 8840, 836, 8, 341, 83825, 18200, 1669, 29838, 7067, 2271, 515, 197, 197, 515, 298, 11609, 25, 330, 1891, 756, 197, 197, 1583, 197, 197, 515, 298, 11609, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestPullEngine_Remove(t *testing.T) { t.Parallel() peers := make(map[string]*pullTestInstance) inst1 := newPushPullTestInstance("p1", peers) defer inst1.Stop() inst1.Add("0") assert.True(t, inst1.PullEngine.state.Exists("0")) inst1.Remove("0") assert.False(t, inst1.PullEngine.state.Exists("0")) inst1.Remove("0") // remove twice assert.False(t, inst1.PullEngine.state.Exists("0")) }
explode_data.jsonl/56500
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 157 }
[ 2830, 3393, 36068, 4571, 66843, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 741, 197, 375, 388, 1669, 1281, 9147, 14032, 8465, 23441, 2271, 2523, 340, 88656, 16, 1669, 501, 16644, 36068, 2271, 2523, 445, 79, 16, 497, 25029, 340, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestDeleteEvtSubscription(t *testing.T) { common.SetUpMockConfig() defer func() { err := common.TruncateDB(common.OnDisk) if err != nil { t.Fatalf("error: %v", err) } }() sub := Subscription{ SubscriptionID: "112345", Destination: "https://10.10.10.23:8080/destination", Name: "Event Subscription", EventTypes: []string{"Alert", "StatusChange"}, OriginResources: []string{"/redfish/v1/Systems/uuid.1"}, } if cerr := SaveEventSubscription(sub); cerr != nil { t.Errorf("Error while making save event subscriptions: %v\n", cerr.Error()) } if err := DeleteEvtSubscription(sub.SubscriptionID); err != nil { t.Errorf("Error while deleting event subscriptions: %v\n", err.Error()) } evtSub, _ := GetEvtSubscriptions("/redfish/v1/Systems/uuid.1") assert.Equal(t, 0, len(evtSub), "there should be no data") }
explode_data.jsonl/49417
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 345 }
[ 2830, 3393, 6435, 89120, 33402, 1155, 353, 8840, 836, 8, 341, 83825, 4202, 2324, 11571, 2648, 741, 16867, 2915, 368, 341, 197, 9859, 1669, 4185, 8240, 26900, 3506, 57802, 8071, 47583, 340, 197, 743, 1848, 961, 2092, 341, 298, 3244, 3076...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestSafeWriteConfig(t *testing.T) { v := New() fs := afero.NewMemMapFs() v.SetFs(fs) v.AddConfigPath("/test") v.SetConfigName("c") v.SetConfigType("yaml") require.NoError(t, v.ReadConfig(bytes.NewBuffer(yamlExample))) require.NoError(t, v.SafeWriteConfig()) read, err := afero.ReadFile(fs, "/test/c.yaml") require.NoError(t, err) assert.Equal(t, yamlWriteExpected, read) }
explode_data.jsonl/9910
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 164 }
[ 2830, 3393, 25663, 7985, 2648, 1155, 353, 8840, 836, 8, 341, 5195, 1669, 1532, 741, 53584, 1669, 264, 802, 78, 7121, 18816, 2227, 48300, 741, 5195, 4202, 48300, 31856, 340, 5195, 1904, 2648, 1820, 4283, 1944, 1138, 5195, 4202, 2648, 675...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestRendezvousInfo(t *testing.T) { addresses := [][]cproto.Address{ { { ContainerPort: 1, }, { ContainerPort: MinLocalRendezvousPort + 1, }, { ContainerPort: 10, }, { ContainerPort: MinLocalRendezvousPort, }, { ContainerPort: 100, }, }, { { ContainerPort: 200, }, { ContainerPort: MinLocalRendezvousPort, }, { ContainerPort: 20, }, { ContainerPort: MinLocalRendezvousPort + 1, }, { ContainerPort: 2, }, }, } system := actor.NewSystem("") rp, created := system.ActorOf( actor.Addr("resourceManagers"), resourcemanagers.NewResourcePool( &resourcemanagers.ResourcePoolConfig{PoolName: "default"}, nil, resourcemanagers.NewFairShareScheduler(), resourcemanagers.WorstFit, )) if !created { t.Fatal("unable to create cluster") } defaultTaskSpec := &tasks.TaskSpec{ HarnessPath: "/opt/determined", TaskContainerDefaults: model.TaskContainerDefaultsConfig{}, } // This is the minimal trial to receive scheduler.ContainerStarted messages. trial := &trial{ rm: rp, experiment: &model.Experiment{}, task: &sproto.AllocateRequest{}, allocations: []sproto.Allocation{mockAllocation{}, mockAllocation{}}, experimentState: model.ActiveState, startedContainers: make(map[cproto.ID]bool), terminatedContainers: make(map[cproto.ID]terminatedContainerWithState), containers: make(map[cproto.ID]cproto.Container), containerRanks: make(map[cproto.ID]int), containerAddresses: make(map[cproto.ID][]cproto.Address), containerSockets: make(map[cproto.ID]*actor.Ref), taskSpec: defaultTaskSpec, } trialRef, created := system.ActorOf(actor.Addr("trial"), trial) if !created { t.Fatal("unable to create trial") } // Simulate a stray websocket connecting to the trial. strayID := cproto.ID("stray-container-id") system.Ask(trialRef, containerConnected{ContainerID: strayID}) t.Run("Stray sockets are not accepted", func(t *testing.T) { _, strayRemains := trial.containerSockets[strayID] assert.Assert(t, !strayRemains) }) containers := make([]*cproto.Container, 0) mockActors := make(map[*cproto.Container]*mockActor) for idx, caddrs := range addresses { c := &cproto.Container{ ID: cproto.ID(strconv.Itoa(idx)), State: cproto.Running, } mockActors[c] = &mockActor{} ref, created := system.ActorOf(actor.Addr(uuid.New().String()), mockActors[c]) if !created { t.Fatal("cannot make socket") } // Simulate trial containers connecting to the trial actor. trial.containerSockets[c.ID] = ref // Simulate the scheduling of a container. system.Ask(trialRef, sproto.TaskContainerStateChanged{ Container: *c, ContainerStarted: &sproto.TaskContainerStarted{ Addresses: caddrs, }, }).Get() containers = append(containers, c) } var rmsgs []*rendezvousInfoMessage for _, c := range containers { for _, msg := range mockActors[c].Messages { tmsg, ok := msg.(*trialMessage) if !ok { continue } else if tmsg.RendezvousInfo == nil { continue } rmsgs = append(rmsgs, tmsg.RendezvousInfo) } } if e, f := len(addresses), len(rmsgs); e != f { t.Fatalf("expected %d messages but found %d instead", e, f) } rep := rmsgs[0] t.Run("Container addresses are sorted by ContainerPort", func(t *testing.T) { for _, c := range rep.Containers { var cports []int for _, addr := range c.Addresses { cports = append(cports, addr.ContainerPort) } assert.Assert(t, sort.IntsAreSorted(cports), cports) } }) t.Run("Rendezvous addrs are sorted", func(t *testing.T) { var addrs []int for _, addr := range rep.Addrs { i, _ := strconv.Atoi(addr) addrs = append(addrs, i) } assert.Assert(t, sort.IntsAreSorted(addrs), addrs) }) t.Run("Rendezvous addrs2 are sorted", func(t *testing.T) { var addrs2 []int for _, addr := range rep.Addrs2 { i, _ := strconv.Atoi(addr) addrs2 = append(addrs2, i) } assert.Assert(t, sort.IntsAreSorted(addrs2), addrs2) }) t.Run("Rendezvous information is the same for all containers", func(t *testing.T) { for idx, n := 1, len(rmsgs); idx < n; idx++ { // Ignore the rank in comparisons. rmsgs[idx].Rank = 0 assert.DeepEqual(t, rep, rmsgs[idx]) } }) }
explode_data.jsonl/30221
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1876 }
[ 2830, 3393, 49, 72502, 57445, 1731, 1155, 353, 8840, 836, 8, 341, 197, 53789, 1669, 52931, 66, 15110, 26979, 515, 197, 197, 515, 298, 197, 515, 571, 197, 4502, 7084, 25, 220, 16, 345, 298, 197, 1583, 298, 197, 515, 571, 197, 4502, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestCataloger_DeleteRepository(t *testing.T) { ctx := context.Background() c := testCataloger(t) // create test data for i := 1; i < 3; i++ { repoName := fmt.Sprintf("repo%d", i) storage := fmt.Sprintf("s3://bucket%d", i) branchName := fmt.Sprintf("branch%d", i) if err := c.CreateRepository(ctx, repoName, storage, branchName); err != nil { t.Fatal("create repository for testing failed", err) } } tests := []struct { name string repository string wantErr bool }{ { name: "existing", repository: "repo2", wantErr: false, }, { name: "not found", repository: "repo5", wantErr: true, }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { err := c.DeleteRepository(ctx, tt.repository) if (err != nil) != tt.wantErr { t.Errorf("DeleteRepository() error = %v, wantErr %v", err, tt.wantErr) return } if err != nil { return } _, err = c.GetRepository(ctx, tt.repository) if !errors.Is(err, db.ErrNotFound) { t.Errorf("Repository (%s) is not gone: %s", tt.repository, err) } }) } }
explode_data.jsonl/69237
{ "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, 41606, 261, 57418, 4624, 1155, 353, 8840, 836, 8, 341, 20985, 1669, 2266, 19047, 741, 1444, 1669, 1273, 41606, 261, 1155, 692, 197, 322, 1855, 1273, 821, 198, 2023, 600, 1669, 220, 16, 26, 600, 366, 220, 18, 26, 600, 102...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestGetInstanceByNodeNameBatching(t *testing.T) { awsServices := newMockedFakeAWSServices(TestClusterId) c, err := newAWSCloud(strings.NewReader("[global]"), awsServices) assert.Nil(t, err, "Error building aws cloud: %v", err) var tag ec2.Tag tag.Key = aws.String(TagNameKubernetesClusterPrefix + TestClusterId) tag.Value = aws.String("") tags := []*ec2.Tag{&tag} nodeNames := []string{} for i := 0; i < 200; i++ { nodeName := fmt.Sprintf("ip-171-20-42-%d.ec2.internal", i) nodeNames = append(nodeNames, nodeName) ec2Instance := &ec2.Instance{} instanceId := fmt.Sprintf("i-abcedf%d", i) ec2Instance.InstanceId = aws.String(instanceId) ec2Instance.PrivateDnsName = aws.String(nodeName) ec2Instance.State = &ec2.InstanceState{Code: aws.Int64(48), Name: aws.String("running")} ec2Instance.Tags = tags awsServices.instances = append(awsServices.instances, ec2Instance) } instances, err := c.getInstancesByNodeNames(nodeNames) assert.NotEmpty(t, instances) assert.Equal(t, 200, len(instances), "Expected 200 but got less") }
explode_data.jsonl/29214
{ "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, 42761, 1359, 1955, 675, 21074, 287, 1155, 353, 8840, 836, 8, 341, 197, 8635, 11025, 1669, 501, 11571, 291, 52317, 14419, 1220, 2161, 31159, 28678, 764, 340, 1444, 11, 1848, 1669, 501, 14419, 3540, 52178, 51442, 68587, 10937, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestFormatterFunctions(test *testing.T) { f := formatter.New().SetFunctions(formatter.Functions{ "Nn": func() int { return 8 }, }) assert.NotNil(test, f.AddFunctions(formatter.Functions{ "cc": func() string { return "C" }, "xx": func() error { return nil }, })) assert.Len(test, f.GetFunctions(), 3) assert.NotNil(test, f.GetFunction("cc")) formatted, err := f.Format("{cc} {Nn}") assert.NoError(test, err) assert.Equal(test, "C 8", formatted) assert.Len(test, f.RemoveFunction("cc").GetFunctions(), 2) assert.Len(test, f.RemoveFunction("cc").GetFunctions(), 2) assert.Len(test, f.RemoveFunctions([]string{"xx"}).GetFunctions(), 1) assert.Empty(test, f.ResetFunctions().GetFunctions()) }
explode_data.jsonl/39738
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 271 }
[ 2830, 3393, 14183, 25207, 8623, 353, 8840, 836, 8, 341, 1166, 1669, 24814, 7121, 1005, 1649, 25207, 89764, 30547, 82, 515, 197, 197, 92366, 77, 788, 2915, 368, 526, 314, 470, 220, 23, 1153, 197, 8824, 6948, 93882, 8623, 11, 282, 1904,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestJobRunsController_Create_NotFound(t *testing.T) { t.Parallel() ethClient, _, assertMocksCalled := cltest.NewEthMocksWithStartupAssertions(t) defer assertMocksCalled() app, cleanup := cltest.NewApplication(t, ethClient, ) defer cleanup() app.Start() client := app.NewHTTPClient() resp, cleanup := client.Post("/v2/specs/4C95A8FA-EEAC-4BD5-97D9-27806D200D3C/runs", bytes.NewBuffer([]byte{})) defer cleanup() assert.Equal(t, http.StatusNotFound, resp.StatusCode, "Response should be not found") }
explode_data.jsonl/49849
{ "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, 12245, 73920, 2051, 34325, 60816, 6650, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 741, 197, 769, 2959, 11, 8358, 2060, 72577, 20960, 1669, 1185, 1944, 7121, 65390, 11571, 16056, 39076, 90206, 1155, 340, 16867, 2060, 725...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestAt(t *testing.T) { in := []Coords{{4, 5}, {7, 11}, {0, 0}, {10, 15}, {5, 20}, {10, 20}, {9, 19}, {-5, 1}} out := []int{Empty, MAGENTA, Empty, OutOfBounds, Empty, OutOfBounds, Empty, OutOfBounds} pf := createPlayfield() var result int for i, c := range in { result = pf.At(c) if result != out[i] { t.Errorf("iteration nb %v : result == %v, expected %v", i+1, result, out[i]) } } }
explode_data.jsonl/38419
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 184 }
[ 2830, 3393, 1655, 1155, 353, 8840, 836, 8, 341, 17430, 1669, 3056, 34344, 2979, 19, 11, 220, 20, 2137, 314, 22, 11, 220, 16, 16, 2137, 314, 15, 11, 220, 15, 2137, 314, 16, 15, 11, 220, 16, 20, 2137, 314, 20, 11, 220, 17, 15, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestAssignPrintln(t *testing.T) { gopClTest(t, ` p := println p "Hello world" `, `package main import fmt "fmt" func main() { p := fmt.Println p("Hello world") } `) }
explode_data.jsonl/73574
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 75 }
[ 2830, 3393, 28933, 8994, 2261, 1155, 353, 8840, 836, 8, 341, 3174, 453, 5066, 2271, 1155, 11, 22074, 79, 1669, 13751, 198, 79, 330, 9707, 1879, 698, 7808, 1565, 1722, 1887, 271, 474, 8879, 330, 12501, 1837, 2830, 1887, 368, 341, 3223,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestPlatformDetect(t *testing.T) { data := []struct { input string expected string }{ {"10.12.3", "10.12.3"}, {"asdf", "asdf"}, {"", ""}, } for _, m := range data { t.Run(fmt.Sprintf("%s in %s", m.input, m.expected), func(t *testing.T) { resultVersion := extractDarwinVersion([]byte(m.input)) assert.Equal(t, m.expected, string(resultVersion)) }) } }
explode_data.jsonl/37617
{ "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, 17296, 57193, 1155, 353, 8840, 836, 8, 341, 8924, 1669, 3056, 1235, 341, 197, 22427, 262, 914, 198, 197, 42400, 914, 198, 197, 59403, 197, 197, 4913, 16, 15, 13, 16, 17, 13, 18, 497, 330, 16, 15, 13, 16, 17, 13, 18, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestCreateCertificateCreatesWithConfiguredMetadata(t *testing.T) { t.Parallel() _, _, certificate, distinguishedName := CreateSampleCertKeyPair(t, nil, nil, false, nil) tmpPath := StoreCertToTempFile(t, certificate) defer os.Remove(tmpPath) // Verify the certificate information. We use openssl binary to read in the file and if it doesn't error, then we // know the certificate is formatted correctly. // See: https://stackoverflow.com/questions/26259432/how-to-check-a-public-rsa-key-file/26260514#26260514 cmd := shell.Command{ Command: "openssl", Args: []string{"x509", "-inform", "PEM", "-in", tmpPath, "-text", "-noout"}, } out := shell.RunCommandAndGetOutput(t, cmd) // openssl text output will encode the distinguished name in the following format distinguishedNameString := fmt.Sprintf( "C=%s, ST=%s, L=%s, O=%s, OU=%s, CN=%s", distinguishedName.Country[0], distinguishedName.Province[0], distinguishedName.Locality[0], distinguishedName.Organization[0], distinguishedName.OrganizationalUnit[0], distinguishedName.CommonName, ) assert.True(t, strings.Contains(out, distinguishedNameString)) // Parse out the validity timestamps and verify they are within 5 seconds of expected times expectedNotBefore := time.Now() expectedNotAfter := expectedNotBefore.Add(1 * time.Hour) certNotBefore, certNotAfter := parseValidityTimestampsFromOpensslCertOut(t, out) assert.True(t, timeDiffWithin(expectedNotBefore, certNotBefore, 5*time.Second)) assert.True(t, timeDiffWithin(expectedNotAfter, certNotAfter, 5*time.Second)) }
explode_data.jsonl/62202
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 518 }
[ 2830, 3393, 4021, 33202, 54868, 2354, 2648, 3073, 14610, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 2822, 197, 6878, 8358, 15748, 11, 38475, 675, 1669, 4230, 17571, 36934, 1592, 12443, 1155, 11, 2092, 11, 2092, 11, 895, 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...
1
func TestMakeWatchHandler(t *testing.T) { t.Parallel() defer os.Remove("handler_out") defer os.Remove("handler_index_out") script := "bash -c 'echo $CONSUL_INDEX >> handler_index_out && cat >> handler_out'" handler := makeWatchHandler(os.Stderr, script) handler(100, []string{"foo", "bar", "baz"}) raw, err := ioutil.ReadFile("handler_out") if err != nil { t.Fatalf("err: %v", err) } if string(raw) != "[\"foo\",\"bar\",\"baz\"]\n" { t.Fatalf("bad: %s", raw) } raw, err = ioutil.ReadFile("handler_index_out") if err != nil { t.Fatalf("err: %v", err) } if string(raw) != "100\n" { t.Fatalf("bad: %s", raw) } }
explode_data.jsonl/26656
{ "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, 8078, 14247, 3050, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 741, 16867, 2643, 13270, 445, 17905, 6068, 1138, 16867, 2643, 13270, 445, 17905, 3560, 6068, 1138, 86956, 1669, 330, 46216, 481, 66, 364, 3047, 400, 95494, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestUpdatePassword(t *testing.T) { th := Setup(t) defer th.TearDown() t.Run("Forbidden when request performed by system user on a system admin", func(t *testing.T) { res, err := th.Client.UpdatePassword(th.SystemAdminUser.Id, "Pa$$word11", "foobar") require.Error(t, err) CheckForbiddenStatus(t, res) }) t.Run("OK when request performed by system user with requisite system permission, except if requested user is system admin", func(t *testing.T) { th.AddPermissionToRole(model.PermissionSysconsoleWriteUserManagementUsers.Id, model.SystemUserRoleId) defer th.RemovePermissionFromRole(model.PermissionSysconsoleWriteUserManagementUsers.Id, model.SystemUserRoleId) res, _ := th.Client.UpdatePassword(th.TeamAdminUser.Id, "Pa$$word11", "foobar") CheckOKStatus(t, res) res, err := th.Client.UpdatePassword(th.SystemAdminUser.Id, "Pa$$word11", "foobar") require.Error(t, err) CheckForbiddenStatus(t, res) }) t.Run("OK when request performed by system admin, even if requested user is system admin", func(t *testing.T) { res, _ := th.SystemAdminClient.UpdatePassword(th.SystemAdminUser.Id, "Pa$$word11", "foobar") CheckOKStatus(t, res) }) }
explode_data.jsonl/47570
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 397 }
[ 2830, 3393, 4289, 4876, 1155, 353, 8840, 836, 8, 341, 70479, 1669, 18626, 1155, 340, 16867, 270, 836, 682, 4454, 2822, 3244, 16708, 445, 69115, 979, 1681, 10660, 553, 1849, 1196, 389, 264, 1849, 3986, 497, 2915, 1155, 353, 8840, 836, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestReceiveTraceDataOp(t *testing.T) { doneFn, err := obsreporttest.SetupRecordedMetricsTest() require.NoError(t, err) defer doneFn() sr := new(oteltest.SpanRecorder) tp := oteltest.NewTracerProvider(oteltest.WithSpanRecorder(sr)) otel.SetTracerProvider(tp) defer otel.SetTracerProvider(trace.NewNoopTracerProvider()) parentCtx, parentSpan := tp.Tracer("test").Start(context.Background(), t.Name()) defer parentSpan.End() params := []testParams{ {items: 13, err: errFake}, {items: 42, err: nil}, } for i, param := range params { rec := NewReceiver(ReceiverSettings{ReceiverID: receiver, Transport: transport}) ctx := rec.StartTracesOp(parentCtx) assert.NotNil(t, ctx) rec.EndTracesOp(ctx, format, params[i].items, param.err) } spans := sr.Completed() require.Equal(t, len(params), len(spans)) var acceptedSpans, refusedSpans int for i, span := range spans { assert.Equal(t, "receiver/"+receiver.String()+"/TraceDataReceived", span.Name()) switch params[i].err { case nil: acceptedSpans += params[i].items assert.Equal(t, attribute.Int64Value(int64(params[i].items)), span.Attributes()[obsmetrics.AcceptedSpansKey]) assert.Equal(t, attribute.Int64Value(0), span.Attributes()[obsmetrics.RefusedSpansKey]) assert.Equal(t, codes.Unset, span.StatusCode()) case errFake: refusedSpans += params[i].items assert.Equal(t, attribute.Int64Value(0), span.Attributes()[obsmetrics.AcceptedSpansKey]) assert.Equal(t, attribute.Int64Value(int64(params[i].items)), span.Attributes()[obsmetrics.RefusedSpansKey]) assert.Equal(t, codes.Error, span.StatusCode()) assert.Equal(t, params[i].err.Error(), span.StatusMessage()) default: t.Fatalf("unexpected param: %v", params[i]) } } obsreporttest.CheckReceiverTraces(t, receiver, transport, int64(acceptedSpans), int64(refusedSpans)) }
explode_data.jsonl/9544
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 707 }
[ 2830, 3393, 14742, 6550, 1043, 7125, 1155, 353, 8840, 836, 8, 341, 40495, 24911, 11, 1848, 1669, 7448, 11736, 1944, 39820, 6471, 291, 27328, 2271, 741, 17957, 35699, 1155, 11, 1848, 340, 16867, 2814, 24911, 2822, 1903, 81, 1669, 501, 7,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
5
func TestRows(t *testing.T) { user1 := User{Name: "RowsUser1", Age: 1, Birthday: parseTime("2000-1-1")} user2 := User{Name: "RowsUser2", Age: 10, Birthday: parseTime("2010-1-1")} user3 := User{Name: "RowsUser3", Age: 20, Birthday: parseTime("2020-1-1")} DB.Save(&user1).Save(&user2).Save(&user3) rows, err := DB.Table("users").Where("name = ? or name = ?", user2.Name, user3.Name).Select("name, age").Rows() if err != nil { t.Errorf("Not error should happen, got %v", err) } count := 0 for rows.Next() { var name string var age int64 rows.Scan(&name, &age) count++ } if count != 2 { t.Errorf("Should found two records") } }
explode_data.jsonl/28047
{ "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, 9024, 1155, 353, 8840, 836, 8, 341, 19060, 16, 1669, 2657, 63121, 25, 330, 9024, 1474, 16, 497, 13081, 25, 220, 16, 11, 36240, 25, 4715, 1462, 445, 17, 15, 15, 15, 12, 16, 12, 16, 42132, 19060, 17, 1669, 2657, 63121, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestRenewingNonExistentLease(t *testing.T) { withRepository(func(r *RedisJobRepository) { renewed, e := r.RenewLease("cluster2", []string{"missingJobId"}) assert.Nil(t, e) assert.Equal(t, 0, len(renewed)) }) }
explode_data.jsonl/32041
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 98 }
[ 2830, 3393, 34625, 78410, 8121, 840, 18128, 2304, 519, 1155, 353, 8840, 836, 8, 341, 46948, 4624, 18552, 2601, 353, 48137, 12245, 4624, 8, 341, 197, 17200, 931, 291, 11, 384, 1669, 435, 2013, 268, 365, 2304, 519, 445, 18855, 17, 497, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestSelect(t *testing.T) { q := NewQuery().Select(table, fields...) if q.SQL.String() != "SELECT field1, field2, field3 FROM table" { t.Fatalf("Select failed to create SQL successfully [%s]\n", q.SQL.String()) } }
explode_data.jsonl/76523
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 80 }
[ 2830, 3393, 3379, 1155, 353, 8840, 836, 8, 341, 18534, 1669, 1532, 2859, 1005, 3379, 15761, 11, 5043, 31218, 743, 2804, 25095, 6431, 368, 961, 330, 4858, 2070, 16, 11, 2070, 17, 11, 2070, 18, 4295, 1965, 1, 341, 197, 3244, 30762, 44...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
2
func TestChecksums(t *testing.T) { dir, err := ioutil.TempDir("", "badger-test") require.NoError(t, err) defer removeDir(dir) // Set up SST with K1=V1 opts := getTestOptions(dir) opts.Truncate = true opts.ValueLogFileSize = 100 * 1024 * 1024 // 100Mb kv, err := Open(opts) require.NoError(t, err) require.NoError(t, kv.Close()) var ( k0 = []byte("k0") k1 = []byte("k1") k2 = []byte("k2") k3 = []byte("k3") v0 = []byte("value0-012345678901234567890123012345678901234567890123") v1 = []byte("value1-012345678901234567890123012345678901234567890123") v2 = []byte("value2-012345678901234567890123012345678901234567890123") v3 = []byte("value3-012345678901234567890123012345678901234567890123") ) // Make sure the value log would actually store the item require.True(t, len(v0) >= kv.opt.ValueThreshold) // Use a vlog with K0=V0 and a (corrupted) second transaction(k1,k2) buf := createVlog(t, []*Entry{ {Key: k0, Value: v0}, {Key: k1, Value: v1}, {Key: k2, Value: v2}, }) buf[len(buf)-1]++ // Corrupt last byte require.NoError(t, ioutil.WriteFile(vlogFilePath(dir, 0), buf, 0777)) // K1 should exist, but K2 shouldn't. kv, err = Open(opts) require.NoError(t, err) require.NoError(t, kv.View(func(txn *Txn) error { item, err := txn.Get(k0) require.NoError(t, err) require.Equal(t, getItemValue(t, item), v0) _, err = txn.Get(k1) require.Equal(t, ErrKeyNotFound, err) _, err = txn.Get(k2) require.Equal(t, ErrKeyNotFound, err) return nil })) // Write K3 at the end of the vlog. txnSet(t, kv, k3, v3, 0) require.NoError(t, kv.Close()) // The vlog should contain K0 and K3 (K1 and k2 was lost when Badger started up // last due to checksum failure). kv, err = Open(opts) require.NoError(t, err) { txn := kv.NewTransaction(false) iter := txn.NewIterator(DefaultIteratorOptions) iter.Seek(k0) require.True(t, iter.Valid()) it := iter.Item() require.Equal(t, it.Key(), k0) require.Equal(t, getItemValue(t, it), v0) iter.Next() require.True(t, iter.Valid()) it = iter.Item() require.Equal(t, it.Key(), k3) require.Equal(t, getItemValue(t, it), v3) iter.Close() txn.Discard() } require.NoError(t, kv.Close()) }
explode_data.jsonl/39095
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1008 }
[ 2830, 3393, 73190, 82, 1155, 353, 8840, 836, 8, 341, 48532, 11, 1848, 1669, 43144, 65009, 6184, 19814, 330, 13855, 1389, 16839, 1138, 17957, 35699, 1155, 11, 1848, 340, 16867, 4057, 6184, 14161, 692, 197, 322, 2573, 705, 91416, 448, 730...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestParticipantRound2BadInput(t *testing.T) { // Prepare Dkg Round 1 output p1, _, _, _, _ := PrepareRound2Input(t) bcast := make(map[uint32]Round1Bcast) p2p := make(map[uint32]*Round1P2PSendPacket) // Test empty bcast and p2p _, err := p1.Round2(bcast, p2p) require.Error(t, err) // Test nil bcast and p2p p1, _, _, _, _ = PrepareRound2Input(t) _, err = p1.Round2(nil, nil) require.Error(t, err) // Test tampered input bcast and p2p p1, _, bcast1, bcast2, p2psend2 := PrepareRound2Input(t) bcast = make(map[uint32]Round1Bcast) p2p = make(map[uint32]*Round1P2PSendPacket) // Tamper bcast1 and p2psend2 by doubling their value bcast1[1].Y = bcast1[1].Y.Add(bcast1[1].Y, bcast1[1].Y) p2psend2[1].SecretShare.Value = p2psend2[1].SecretShare.Value.Add(p2psend2[1].SecretShare.Value) bcast[1] = bcast1 bcast[2] = bcast2 p2p[2] = p2psend2[1] _, err = p1.Round2(bcast, p2p) require.Error(t, err) }
explode_data.jsonl/77864
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 430 }
[ 2830, 3393, 67504, 27497, 17, 17082, 2505, 1155, 353, 8840, 836, 8, 341, 197, 322, 31166, 422, 7351, 17097, 220, 16, 2550, 198, 3223, 16, 11, 8358, 8358, 8358, 716, 1669, 31166, 27497, 17, 2505, 1155, 340, 2233, 3829, 1669, 1281, 9147...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestIpPortIndexer(t *testing.T) { var testConfig = common.NewConfig() ipIndexer, err := NewIPPortIndexer(*testConfig, metagen) assert.Nil(t, err) podName := "testpod" ns := "testns" container := "container" ip := "1.2.3.4" port := int64(80) pod := Pod{ Metadata: ObjectMeta{ Name: podName, Namespace: ns, Labels: map[string]string{ "labelkey": "labelvalue", }, }, Spec: PodSpec{ Containers: make([]Container, 0), }, Status: PodStatus{ PodIP: ip, }, } indexers := ipIndexer.GetMetadata(&pod) indices := ipIndexer.GetIndexes(&pod) assert.Equal(t, 1, len(indexers)) assert.Equal(t, 1, len(indices)) assert.Equal(t, ip, indices[0]) assert.Equal(t, ip, indexers[0].Index) // Meta doesn't have container info _, err = indexers[0].Data.GetValue("kubernetes.container.name") assert.NotNil(t, err) expected := common.MapStr{ "pod": common.MapStr{ "name": "testpod", }, "namespace": "testns", "labels": common.MapStr{ "labelkey": "labelvalue", }, } pod.Spec.Containers = []Container{ { Name: container, Ports: []ContainerPort{ { Name: container, ContainerPort: port, }, }, }, } indexers = ipIndexer.GetMetadata(&pod) assert.Equal(t, 2, len(indexers)) assert.Equal(t, ip, indexers[0].Index) assert.Equal(t, fmt.Sprintf("%s:%d", ip, port), indexers[1].Index) indices = ipIndexer.GetIndexes(&pod) assert.Equal(t, 2, len(indices)) assert.Equal(t, ip, indices[0]) assert.Equal(t, fmt.Sprintf("%s:%d", ip, port), indices[1]) assert.Equal(t, expected.String(), indexers[0].Data.String()) expected["container"] = common.MapStr{"name": container} assert.Equal(t, expected.String(), indexers[1].Data.String()) }
explode_data.jsonl/80959
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 749 }
[ 2830, 3393, 23378, 7084, 1552, 261, 1155, 353, 8840, 836, 8, 341, 2405, 1273, 2648, 284, 4185, 7121, 2648, 2822, 46531, 1552, 261, 11, 1848, 1669, 1532, 3298, 7084, 1552, 261, 4071, 1944, 2648, 11, 2270, 8535, 340, 6948, 59678, 1155, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestRowTableUpdateInvalidForm(t *testing.T) { map_dao := &DaoImpl{} service := service.MakeTableRowService(map_dao) uri_params := map[string]string{"table_id": "124"} values := url.Values{} request := makeRequest(http.MethodPost, uri_params, values, true) result := service.Update(request) if result.IsSuccess() { t.Errorf("Form validation failed") } }
explode_data.jsonl/15443
{ "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, 3102, 2556, 4289, 7928, 1838, 1155, 353, 8840, 836, 8, 341, 19567, 814, 3441, 1669, 609, 12197, 9673, 16094, 52934, 1669, 2473, 50133, 38558, 1860, 9147, 814, 3441, 340, 197, 6070, 6745, 1669, 2415, 14032, 30953, 4913, 2005, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestSerializeMetricWithEscapes(t *testing.T) { now := time.Now() tags := map[string]string{ "cpu tag": "cpu0", } fields := map[string]interface{}{ "U,age=Idle": int64(90), } m, err := metric.New("My CPU", tags, fields, now) assert.NoError(t, err) s, _ := NewSerializer(0) buf, err := s.Serialize(m) assert.NoError(t, err) expS := []byte(fmt.Sprintf(`{"fields":{"U,age=Idle":90},"name":"My CPU","tags":{"cpu tag":"cpu0"},"timestamp":%d}`, now.Unix()) + "\n") assert.Equal(t, string(expS), string(buf)) }
explode_data.jsonl/47353
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 220 }
[ 2830, 3393, 15680, 54310, 2354, 36121, 9337, 1155, 353, 8840, 836, 8, 341, 80922, 1669, 882, 13244, 741, 3244, 2032, 1669, 2415, 14032, 30953, 515, 197, 197, 1, 16475, 4772, 788, 330, 16475, 15, 756, 197, 532, 55276, 1669, 2415, 14032, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestValdateReferencedUpstream(t *testing.T) { upstream := "test" upstreamNames := map[string]sets.Empty{ "test": {}, } allErrs := validateReferencedUpstream(upstream, field.NewPath("upstream"), upstreamNames) if len(allErrs) > 0 { t.Errorf("validateReferencedUpstream() returned errors %v for valid input", allErrs) } }
explode_data.jsonl/65838
{ "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, 2208, 1028, 47447, 5767, 2324, 4027, 1155, 353, 8840, 836, 8, 341, 59810, 4027, 1669, 330, 1944, 698, 59810, 4027, 7980, 1669, 2415, 14032, 60, 4917, 11180, 515, 197, 197, 1, 1944, 788, 14573, 197, 630, 50960, 7747, 82, 16...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestApplyEmptyAffinityLabelsDoesSucceed(t *testing.T) { affinityTrait, environment, _ := createNominalAffinityTest() err := affinityTrait.Apply(environment) assert.Nil(t, err) }
explode_data.jsonl/10353
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 64 }
[ 2830, 3393, 28497, 3522, 25841, 13489, 23674, 21468, 50, 29264, 1155, 353, 8840, 836, 8, 341, 197, 2649, 13489, 49257, 11, 4573, 11, 716, 1669, 1855, 36312, 977, 25841, 13489, 2271, 2822, 9859, 1669, 50452, 49257, 36051, 67591, 692, 6948,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
func TestPlayer_Position(t *testing.T) { entity := new(stfake.Entity) pos := r3.Vector{X: 1, Y: 2, Z: 3} entity.On("Position").Return(pos) pl := &Player{Entity: entity} assert.Equal(t, pos, pl.Position()) }
explode_data.jsonl/12195
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 85 }
[ 2830, 3393, 4476, 55724, 1155, 353, 8840, 836, 8, 341, 52987, 1669, 501, 5895, 30570, 9899, 340, 28164, 1669, 435, 18, 14286, 90, 55, 25, 220, 16, 11, 809, 25, 220, 17, 11, 1863, 25, 220, 18, 630, 52987, 8071, 445, 3812, 1827, 559...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestBroadcastAPI(t *testing.T) { node := nodeWithMemoryEngine() ruleConfig := rule.DefaultConfig ruleContainer := rule.NewContainer(ruleConfig) api := NewExecutor(node, ruleContainer, "test") resp := api.Broadcast(context.Background(), &BroadcastRequest{}) require.Equal(t, ErrorBadRequest, resp.Error) resp = api.Broadcast(context.Background(), &BroadcastRequest{Channels: []string{"test"}}) require.Equal(t, ErrorBadRequest, resp.Error) resp = api.Broadcast(context.Background(), &BroadcastRequest{Channels: []string{"test"}, Data: []byte("test")}) require.Nil(t, resp.Error) resp = api.Broadcast(context.Background(), &BroadcastRequest{Channels: []string{"test:test"}, Data: []byte("test")}) require.Equal(t, ErrorNamespaceNotFound, resp.Error) resp = api.Broadcast(context.Background(), &BroadcastRequest{Channels: []string{"test", "test:test"}, Data: []byte("test")}) require.Equal(t, ErrorNamespaceNotFound, resp.Error) }
explode_data.jsonl/48460
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 303 }
[ 2830, 3393, 43362, 7082, 1155, 353, 8840, 836, 8, 341, 20831, 1669, 2436, 2354, 10642, 4571, 741, 7000, 1111, 2648, 1669, 5912, 13275, 2648, 198, 7000, 1111, 4502, 1669, 5912, 7121, 4502, 34944, 2648, 692, 54299, 1669, 1532, 25255, 6958, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestVersionHandler(t *testing.T) { SetVersion("3.0.0") cfg := initTest() r := gofight.New() r.GET("/version"). Run(routerEngine(cfg, q), func(r gofight.HTTPResponse, rq gofight.HTTPRequest) { assert.Equal(t, http.StatusOK, r.Code) data := r.Body.Bytes() value, _ := jsonparser.GetString(data, "version") assert.Equal(t, "3.0.0", value) }) }
explode_data.jsonl/67619
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 159 }
[ 2830, 3393, 5637, 3050, 1155, 353, 8840, 836, 8, 341, 22212, 5637, 445, 18, 13, 15, 13, 15, 1138, 50286, 1669, 2930, 2271, 2822, 7000, 1669, 728, 21143, 7121, 2822, 7000, 17410, 4283, 4366, 38609, 197, 85952, 61210, 4571, 28272, 11, 2...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestFailureNotifier(t *testing.T) { assert := assert.New(t) fn := NewFailureNotifier(5) for id := 0; id < 5; id++ { assert.False(fn.IsConnected(id), "Node should be initially disconnected") err := fn.NowConnected(id) assert.Nil(err, "Node could not connect") assert.True(fn.IsConnected(id), "Node should be connected") } // check on false failures select { case <-fn.NotifyOnFailure(3): t.Error("Unexpected failure") case <-time.After(100 * time.Millisecond): } wait := fn.NotifyOnFailure(3) fn.NowDisconnected(3) // check on false failures select { case <-wait: case <-time.After(100 * time.Millisecond): t.Error("Failure not reported") } }
explode_data.jsonl/1475
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 250 }
[ 2830, 3393, 17507, 64729, 1155, 353, 8840, 836, 8, 341, 6948, 1669, 2060, 7121, 1155, 340, 40095, 1669, 1532, 17507, 64729, 7, 20, 692, 2023, 877, 1669, 220, 15, 26, 877, 366, 220, 20, 26, 877, 1027, 341, 197, 6948, 50757, 24008, 45...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestRemoveItem(t *testing.T) { sandboxResp, _ := testClient.CreateSandboxPublicToken(sandboxInstitution, testProducts) tokenResp, _ := testClient.ExchangePublicToken(sandboxResp.PublicToken) itemResp, err := testClient.RemoveItem(tokenResp.AccessToken) assert.Nil(t, err) assert.True(t, itemResp.Removed) }
explode_data.jsonl/12572
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 104 }
[ 2830, 3393, 13021, 1234, 1155, 353, 8840, 836, 8, 341, 1903, 31536, 36555, 11, 716, 1669, 1273, 2959, 7251, 50, 31536, 12676, 3323, 1141, 31536, 641, 10446, 11, 1273, 17746, 340, 43947, 36555, 11, 716, 1669, 1273, 2959, 86997, 12676, 33...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestMetadataServiceProxy_GetExportedURLs(t *testing.T) { pxy := createPxy() assert.NotNil(t, pxy) res, err := pxy.GetExportedURLs(constant.ANY_VALUE, constant.ANY_VALUE, constant.ANY_VALUE, constant.ANY_VALUE) assert.Nil(t, err) assert.Len(t, res, 1) }
explode_data.jsonl/36440
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 108 }
[ 2830, 3393, 14610, 1860, 16219, 13614, 16894, 291, 3144, 82, 1155, 353, 8840, 836, 8, 1476, 197, 1767, 88, 1669, 1855, 47, 4130, 741, 6948, 93882, 1155, 11, 281, 4130, 340, 10202, 11, 1848, 1669, 281, 4130, 2234, 16894, 291, 3144, 82,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestSuite(t *testing.T) { // ensureInitialized ensureInitErrorMkdir(t) ensureInitErrorHarden(t) ensureInitWithManifestFile(t) ensureInitErrorReadManifestFile(t) ensureInitErrorUnMarshalManifestFile(t) ensureInitWithoutManifestFile(t) // saveManifest saveManifestErrorMarshalTest(t) saveManifestErrorWriteFileTest(t) // main test cases store(t) storeErrorEnsureInitTest(t) storeErrorStoreDataTest(t) storeErrorSaveManifestTest(t) retrieve(t) retrieveErrorNotExists(t) retrieveErrorEnsureInitTest(t) retrieveErrorFileMissingTest(t) retrieveErrorReadDataTest(t) remove(t) removeNotExists(t) removeErrorEnsureInitTest(t) removeErrorSaveManifestTest(t) removeErrorRemoveDataTest(t) }
explode_data.jsonl/59038
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 267 }
[ 2830, 3393, 28000, 1155, 353, 8840, 836, 8, 1476, 197, 322, 5978, 22495, 198, 197, 27289, 3803, 1454, 44, 12438, 1155, 340, 197, 27289, 3803, 1454, 39, 8341, 1155, 340, 197, 27289, 3803, 2354, 38495, 1703, 1155, 340, 197, 27289, 3803, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestAsyncDelayReturnsError(t *testing.T) { storage := SimpleRESTStorage{ injectedFunction: func(obj runtime.Object) (runtime.Object, error) { return nil, apierrs.NewAlreadyExists("foo", "bar") }, } handler := Handle(map[string]RESTStorage{"foo": &storage}, codec, "/prefix/version", selfLinker) handler.(*defaultAPIServer).group.handler.asyncOpWait = time.Millisecond / 2 server := httptest.NewServer(handler) status := expectApiStatus(t, "DELETE", fmt.Sprintf("%s/prefix/version/foo/bar", server.URL), nil, http.StatusConflict) if status.Status != api.StatusFailure || status.Message == "" || status.Details == nil || status.Reason != api.StatusReasonAlreadyExists { t.Errorf("Unexpected status %#v", status) } }
explode_data.jsonl/71503
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 245 }
[ 2830, 3393, 6525, 20039, 16446, 1454, 1155, 353, 8840, 836, 8, 341, 197, 16172, 1669, 8993, 38307, 5793, 515, 197, 17430, 28303, 5152, 25, 2915, 6779, 15592, 8348, 8, 320, 22255, 8348, 11, 1465, 8, 341, 298, 853, 2092, 11, 6330, 84735...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestV3TrustWithTrustId(t *testing.T) { ctx := context.Background() if !isV3Api() { return } c, rollback := makeConnection(t) defer rollback() c.TrustId = os.Getenv("SWIFT_TRUST_ID") err := c.Authenticate(ctx) if err != nil { t.Fatal("Auth failed", err) } if !c.Authenticated() { t.Fatal("Not authenticated") } }
explode_data.jsonl/12653
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 141 }
[ 2830, 3393, 53, 18, 45548, 2354, 45548, 764, 1155, 353, 8840, 836, 8, 341, 20985, 1669, 2266, 19047, 741, 743, 753, 285, 53, 18, 6563, 368, 341, 197, 853, 198, 197, 630, 1444, 11, 60414, 1669, 1281, 4526, 1155, 340, 16867, 60414, 28...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestBuildGet(t *testing.T) { testServer(t, func(c *stdsdk.Client, p *structs.MockProvider) { b1 := fxBuild b2 := structs.Build{} p.On("BuildGet", "app1", "build1").Return(&b1, nil) err := c.Get("/apps/app1/builds/build1", stdsdk.RequestOptions{}, &b2) require.NoError(t, err) require.Equal(t, b1, b2) }) }
explode_data.jsonl/71419
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 151 }
[ 2830, 3393, 11066, 1949, 1155, 353, 8840, 836, 8, 341, 18185, 5475, 1155, 11, 2915, 1337, 353, 1834, 51295, 11716, 11, 281, 353, 1235, 82, 24664, 5179, 8, 341, 197, 2233, 16, 1669, 33219, 11066, 198, 197, 2233, 17, 1669, 62845, 25212,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestOldestSeek(t *testing.T) { m := newMockD() defer close(m.recvChan) ds := initializeDeliverHandler() go ds.Handle(m) m.recvChan <- makeSeek(systemChainID, &ab.SeekInfo{Start: seekOldest, Stop: seekOldest, Behavior: ab.SeekInfo_BLOCK_UNTIL_READY}) select { case deliverReply := <-m.sendChan: assert.NotEqual(t, nil, deliverReply.GetBlock(), "Received an error on the reply channel") assert.Equal(t, uint64(0), deliverReply.GetBlock().Header.Number, "Expected only the most recent block") case <-time.After(time.Second): t.Fatalf("Timed out waiting to get all blocks") } }
explode_data.jsonl/36271
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 220 }
[ 2830, 3393, 42719, 4979, 39350, 1155, 353, 8840, 836, 8, 341, 2109, 1669, 501, 11571, 35, 741, 16867, 3265, 1255, 40433, 46019, 692, 83336, 1669, 9468, 16532, 1524, 3050, 741, 30680, 11472, 31421, 1255, 692, 2109, 40433, 46019, 9119, 1281...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestStringPrimaryKey(t *testing.T) { type UUIDStruct struct { ID string `gorm:"primary_key"` Name string } DB.DropTable(&UUIDStruct{}) DB.AutoMigrate(&UUIDStruct{}) data := UUIDStruct{ID: "uuid", Name: "hello"} if err := DB.Save(&data).Error; err != nil || data.ID != "uuid" || data.Name != "hello" { t.Errorf("string primary key should not be populated") } data = UUIDStruct{ID: "uuid", Name: "hello world"} if err := DB.Save(&data).Error; err != nil || data.ID != "uuid" || data.Name != "hello world" { t.Errorf("string primary key should not be populated") } }
explode_data.jsonl/28034
{ "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, 703, 25981, 1155, 353, 8840, 836, 8, 341, 13158, 23698, 9422, 2036, 341, 197, 29580, 256, 914, 1565, 73281, 2974, 6545, 3097, 8805, 197, 21297, 914, 198, 197, 532, 45409, 58626, 2099, 24754, 9422, 37790, 45409, 6477, 44, 344...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
7
func Test_Print(t *testing.T) { gtest.C(t, func(t *gtest.T) { w := bytes.NewBuffer(nil) l := NewWithWriter(w) l.Print(ctx, 1, 2, 3) l.Printf(ctx, "%d %d %d", 1, 2, 3) t.Assert(gstr.Count(w.String(), "["), 0) t.Assert(gstr.Count(w.String(), "1 2 3"), 2) }) }
explode_data.jsonl/2598
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 142 }
[ 2830, 3393, 45788, 1155, 353, 8840, 836, 8, 341, 3174, 1944, 727, 1155, 11, 2915, 1155, 353, 82038, 836, 8, 341, 197, 6692, 1669, 5820, 7121, 4095, 27907, 340, 197, 8810, 1669, 1532, 2354, 6492, 3622, 340, 197, 8810, 7918, 7502, 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 TestDeviceCodeIncludesResource(t *testing.T) { sender := mocks.NewSender() sender.AppendResponse(mocks.NewResponseWithContent(MockDeviceCodeResponse)) code, err := InitiateDeviceAuth(sender, TestOAuthConfig, TestClientID, TestResource) if err != nil { t.Fatalf("adal: unexpected error initiating device auth") } if code.Resource != TestResource { t.Fatalf("adal: InitiateDeviceAuth failed to stash the resource in the DeviceCode struct") } }
explode_data.jsonl/27496
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 141 }
[ 2830, 3393, 6985, 2078, 55834, 4783, 1155, 353, 8840, 836, 8, 341, 1903, 1659, 1669, 68909, 7121, 20381, 741, 1903, 1659, 8982, 2582, 1255, 25183, 7121, 2582, 2354, 2762, 66436, 6985, 2078, 2582, 4390, 43343, 11, 1848, 1669, 15690, 6493, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestMultiSitesRebuild(t *testing.T) { // t.Parallel() not supported, see https://github.com/fortytw2/leaktest/issues/4 // This leaktest seems to be a little bit shaky on Travis. if !isCI() { defer leaktest.CheckTimeout(t, 10*time.Second)() } assert := require.New(t) b := newMultiSiteTestDefaultBuilder(t).Running().CreateSites().Build(BuildCfg{}) sites := b.H.Sites fs := b.Fs b.AssertFileContent("public/en/sect/doc2/index.html", "Single: doc2|Hello|en|\n\n<h1 id=\"doc2\">doc2</h1>\n\n<p><em>some content</em>") enSite := sites[0] frSite := sites[1] assert.Len(enSite.RegularPages, 5) assert.Len(frSite.RegularPages, 4) // Verify translations b.AssertFileContent("public/en/sect/doc1-slug/index.html", "Hello") b.AssertFileContent("public/fr/sect/doc1/index.html", "Bonjour") // check single page content b.AssertFileContent("public/fr/sect/doc1/index.html", "Single", "Shortcode: Bonjour") b.AssertFileContent("public/en/sect/doc1-slug/index.html", "Single", "Shortcode: Hello") contentFs := b.H.BaseFs.Content.Fs for i, this := range []struct { preFunc func(t *testing.T) events []fsnotify.Event assertFunc func(t *testing.T) }{ // * Remove doc // * Add docs existing languages // (Add doc new language: TODO(bep) we should load config.toml as part of these so we can add languages). // * Rename file // * Change doc // * Change a template // * Change language file { func(t *testing.T) { fs.Source.Remove("content/sect/doc2.en.md") }, []fsnotify.Event{{Name: filepath.FromSlash("content/sect/doc2.en.md"), Op: fsnotify.Remove}}, func(t *testing.T) { assert.Len(enSite.RegularPages, 4, "1 en removed") // Check build stats require.Equal(t, 1, enSite.draftCount, "Draft") require.Equal(t, 1, enSite.futureCount, "Future") require.Equal(t, 1, enSite.expiredCount, "Expired") require.Equal(t, 0, frSite.draftCount, "Draft") require.Equal(t, 1, frSite.futureCount, "Future") require.Equal(t, 1, frSite.expiredCount, "Expired") }, }, { func(t *testing.T) { writeNewContentFile(t, contentFs, "new_en_1", "2016-07-31", "new1.en.md", -5) writeNewContentFile(t, contentFs, "new_en_2", "1989-07-30", "new2.en.md", -10) writeNewContentFile(t, contentFs, "new_fr_1", "2016-07-30", "new1.fr.md", 10) }, []fsnotify.Event{ {Name: filepath.FromSlash("content/new1.en.md"), Op: fsnotify.Create}, {Name: filepath.FromSlash("content/new2.en.md"), Op: fsnotify.Create}, {Name: filepath.FromSlash("content/new1.fr.md"), Op: fsnotify.Create}, }, func(t *testing.T) { assert.Len(enSite.RegularPages, 6) assert.Len(enSite.AllPages, 34) assert.Len(frSite.RegularPages, 5) require.Equal(t, "new_fr_1", frSite.RegularPages[3].title) require.Equal(t, "new_en_2", enSite.RegularPages[0].title) require.Equal(t, "new_en_1", enSite.RegularPages[1].title) rendered := readDestination(t, fs, "public/en/new1/index.html") require.True(t, strings.Contains(rendered, "new_en_1"), rendered) }, }, { func(t *testing.T) { p := "sect/doc1.en.md" doc1 := readFileFromFs(t, contentFs, p) doc1 += "CHANGED" writeToFs(t, contentFs, p, doc1) }, []fsnotify.Event{{Name: filepath.FromSlash("content/sect/doc1.en.md"), Op: fsnotify.Write}}, func(t *testing.T) { assert.Len(enSite.RegularPages, 6) doc1 := readDestination(t, fs, "public/en/sect/doc1-slug/index.html") require.True(t, strings.Contains(doc1, "CHANGED"), doc1) }, }, // Rename a file { func(t *testing.T) { if err := contentFs.Rename("new1.en.md", "new1renamed.en.md"); err != nil { t.Fatalf("Rename failed: %s", err) } }, []fsnotify.Event{ {Name: filepath.FromSlash("content/new1renamed.en.md"), Op: fsnotify.Rename}, {Name: filepath.FromSlash("content/new1.en.md"), Op: fsnotify.Rename}, }, func(t *testing.T) { assert.Len(enSite.RegularPages, 6, "Rename") require.Equal(t, "new_en_1", enSite.RegularPages[1].title) rendered := readDestination(t, fs, "public/en/new1renamed/index.html") require.True(t, strings.Contains(rendered, "new_en_1"), rendered) }}, { // Change a template func(t *testing.T) { template := "layouts/_default/single.html" templateContent := readSource(t, fs, template) templateContent += "{{ print \"Template Changed\"}}" writeSource(t, fs, template, templateContent) }, []fsnotify.Event{{Name: filepath.FromSlash("layouts/_default/single.html"), Op: fsnotify.Write}}, func(t *testing.T) { assert.Len(enSite.RegularPages, 6) assert.Len(enSite.AllPages, 34) assert.Len(frSite.RegularPages, 5) doc1 := readDestination(t, fs, "public/en/sect/doc1-slug/index.html") require.True(t, strings.Contains(doc1, "Template Changed"), doc1) }, }, { // Change a language file func(t *testing.T) { languageFile := "i18n/fr.yaml" langContent := readSource(t, fs, languageFile) langContent = strings.Replace(langContent, "Bonjour", "Salut", 1) writeSource(t, fs, languageFile, langContent) }, []fsnotify.Event{{Name: filepath.FromSlash("i18n/fr.yaml"), Op: fsnotify.Write}}, func(t *testing.T) { assert.Len(enSite.RegularPages, 6) assert.Len(enSite.AllPages, 34) assert.Len(frSite.RegularPages, 5) docEn := readDestination(t, fs, "public/en/sect/doc1-slug/index.html") require.True(t, strings.Contains(docEn, "Hello"), "No Hello") docFr := readDestination(t, fs, "public/fr/sect/doc1/index.html") require.True(t, strings.Contains(docFr, "Salut"), "No Salut") homeEn := enSite.getPage(KindHome) require.NotNil(t, homeEn) assert.Len(homeEn.Translations(), 3) require.Equal(t, "fr", homeEn.Translations()[0].Lang()) }, }, // Change a shortcode { func(t *testing.T) { writeSource(t, fs, "layouts/shortcodes/shortcode.html", "Modified Shortcode: {{ i18n \"hello\" }}") }, []fsnotify.Event{ {Name: filepath.FromSlash("layouts/shortcodes/shortcode.html"), Op: fsnotify.Write}, }, func(t *testing.T) { assert.Len(enSite.RegularPages, 6) assert.Len(enSite.AllPages, 34) assert.Len(frSite.RegularPages, 5) b.AssertFileContent("public/fr/sect/doc1/index.html", "Single", "Modified Shortcode: Salut") b.AssertFileContent("public/en/sect/doc1-slug/index.html", "Single", "Modified Shortcode: Hello") }, }, } { if this.preFunc != nil { this.preFunc(t) } err := b.H.Build(BuildCfg{}, this.events...) if err != nil { t.Fatalf("[%d] Failed to rebuild sites: %s", i, err) } this.assertFunc(t) } // Check that the drafts etc. are not built/processed/rendered. assertShouldNotBuild(t, b.H) }
explode_data.jsonl/16238
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 2910 }
[ 2830, 3393, 20358, 93690, 693, 5834, 1155, 353, 8840, 836, 8, 341, 197, 322, 259, 41288, 7957, 368, 537, 7248, 11, 1490, 3703, 1110, 5204, 905, 14, 3969, 88, 15560, 17, 14, 273, 585, 1944, 38745, 14, 19, 198, 197, 322, 1096, 23352, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestNewTestContext(t *testing.T) { context := gogiven.NewTestContext(someFilename) then.AssertThat(t, context.FileName(), is.EqualTo(someFilename)) then.AssertThat(t, context.SomeTests(), has.TypeName("*gogiven.SafeMap")) }
explode_data.jsonl/67575
{ "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, 3564, 2271, 1972, 1155, 353, 8840, 836, 8, 341, 28413, 1669, 342, 538, 2071, 7121, 2271, 1972, 1141, 635, 20759, 340, 58633, 11711, 4792, 1155, 11, 2266, 35231, 1507, 374, 56064, 1141, 635, 20759, 1171, 58633, 11711, 4792, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestClassifyMsg(t *testing.T) { t.Run("ConfigUpdate", func(t *testing.T) { class := (&StandardChannel{}).ClassifyMsg(&cb.ChannelHeader{Type: int32(cb.HeaderType_CONFIG_UPDATE)}) require.Equal(t, class, ConfigUpdateMsg) }) t.Run("OrdererTx", func(t *testing.T) { class := (&StandardChannel{}).ClassifyMsg(&cb.ChannelHeader{Type: int32(cb.HeaderType_ORDERER_TRANSACTION)}) require.Equal(t, class, ConfigMsg) }) t.Run("ConfigTx", func(t *testing.T) { class := (&StandardChannel{}).ClassifyMsg(&cb.ChannelHeader{Type: int32(cb.HeaderType_CONFIG)}) require.Equal(t, class, ConfigMsg) }) t.Run("EndorserTx", func(t *testing.T) { class := (&StandardChannel{}).ClassifyMsg(&cb.ChannelHeader{Type: int32(cb.HeaderType_ENDORSER_TRANSACTION)}) require.Equal(t, class, NormalMsg) }) }
explode_data.jsonl/65685
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 311 }
[ 2830, 3393, 1957, 1437, 6611, 1155, 353, 8840, 836, 8, 341, 3244, 16708, 445, 2648, 4289, 497, 2915, 1155, 353, 8840, 836, 8, 341, 197, 15487, 1669, 15899, 19781, 9629, 6257, 568, 1957, 1437, 6611, 2099, 7221, 38716, 4047, 90, 929, 25...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestCreateServiceWithMemLimit(t *testing.T) { // An example service service := kobject.ServiceConfig{ ContainerName: "name", Image: "image", Environment: []kobject.EnvVar{kobject.EnvVar{Name: "env", Value: "value"}}, Port: []kobject.Ports{kobject.Ports{HostPort: 123, ContainerPort: 456, Protocol: string(corev1.ProtocolTCP)}}, Command: []string{"cmd"}, WorkingDir: "dir", Args: []string{"arg1", "arg2"}, VolList: []string{"/tmp/volume"}, Network: []string{"network1", "network2"}, // not supported Labels: nil, Annotations: map[string]string{"abc": "def"}, CPUQuota: 1, // not supported CapAdd: []string{"cap_add"}, // not supported CapDrop: []string{"cap_drop"}, // not supported Expose: []string{"expose"}, // not supported Privileged: true, Restart: "always", MemLimit: 1337, MemReservation: 1338, } // An example object generated via k8s runtime.Objects() komposeObject := kobject.KomposeObject{ ServiceConfigs: map[string]kobject.ServiceConfig{"app": service}, } k := Kubernetes{} objects, err := k.Transform(komposeObject, kobject.ConvertOptions{CreateD: true, Replicas: 3}) if err != nil { t.Error(errors.Wrap(err, "k.Transform failed")) } // Retrieve the deployment object and test that it matches the mem value for _, obj := range objects { if deploy, ok := obj.(*appsv1.Deployment); ok { memLimit, _ := deploy.Spec.Template.Spec.Containers[0].Resources.Limits.Memory().AsInt64() if memLimit != 1337 { t.Errorf("Expected 1337 for memory limit check, got %v", memLimit) } memReservation, _ := deploy.Spec.Template.Spec.Containers[0].Resources.Requests.Memory().AsInt64() if memReservation != 1338 { t.Errorf("Expected 1338 for memory reservation check, got %v", memReservation) } } } }
explode_data.jsonl/58954
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 783 }
[ 2830, 3393, 4021, 1860, 2354, 18816, 16527, 1155, 353, 8840, 836, 8, 341, 197, 322, 1527, 3110, 2473, 198, 52934, 1669, 595, 1700, 13860, 2648, 515, 197, 197, 4502, 675, 25, 220, 330, 606, 756, 197, 53397, 25, 688, 330, 1805, 756, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
6
func TestAuthCodeURL_Optional(t *testing.T) { conf := &Config{ ClientID: "CLIENT_ID", Endpoint: Endpoint{ AuthURL: "/auth-url", TokenURL: "/token-url", }, } url := conf.AuthCodeURL("") if url != "/auth-url?client_id=CLIENT_ID&response_type=code" { t.Fatalf("Auth code URL doesn't match the expected, found: %v", url) } }
explode_data.jsonl/25885
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 141 }
[ 2830, 3393, 5087, 2078, 3144, 2232, 560, 278, 1155, 353, 8840, 836, 8, 341, 67850, 1669, 609, 2648, 515, 197, 71724, 915, 25, 330, 45271, 3450, 756, 197, 197, 27380, 25, 47269, 515, 298, 197, 5087, 3144, 25, 220, 3521, 3242, 25443, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestAccCollection_Basic(t *testing.T) { var collection openapi.Collection resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, ProviderFactories: testAccProviderFactories, CheckDestroy: testAccCheckRocksetCollectionDestroy, Steps: []resource.TestStep{ { Config: testAccCheckCollectionBasic(), Check: resource.ComposeTestCheckFunc( testAccCheckRocksetCollectionExists("rockset_collection.test", &collection), resource.TestCheckResourceAttr("rockset_collection.test", "name", testCollectionName), resource.TestCheckResourceAttr("rockset_collection.test", "workspace", testCollectionWorkspace), resource.TestCheckResourceAttr("rockset_collection.test", "description", testCollectionDescription), testAccCheckRetentionSecsMatches(&collection, 60), ), ExpectNonEmptyPlan: false, }, { Config: testAccCheckCollectionUpdateForceRecreate(), Check: resource.ComposeTestCheckFunc( testAccCheckRocksetCollectionExists("rockset_collection.test", &collection), resource.TestCheckResourceAttr("rockset_collection.test", "name", fmt.Sprintf("%s-updated", testCollectionName)), resource.TestCheckResourceAttr("rockset_collection.test", "workspace", testCollectionWorkspace), resource.TestCheckResourceAttr("rockset_collection.test", "description", testCollectionDescription), testAccCheckRetentionSecsMatches(&collection, 61), ), ExpectNonEmptyPlan: false, }, }, }) }
explode_data.jsonl/7135
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 517 }
[ 2830, 3393, 14603, 6482, 1668, 5971, 1155, 353, 8840, 836, 8, 341, 2405, 4426, 1787, 2068, 28629, 271, 50346, 8787, 1155, 11, 5101, 31363, 515, 197, 197, 4703, 3973, 25, 688, 2915, 368, 314, 1273, 14603, 4703, 3973, 1155, 8, 1153, 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