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 TestMiddlewareShouldPushIndexFile(t *testing.T) { // given indexFile := "/index.html" request, err := http.NewRequest(http.MethodGet, "/", nil) // Request root directory, not indexfile itself if err != nil { t.Fatalf("Could not create HTTP request: %v", err) } root, err := ioutil.TempDir("", "caddy") if err != nil { t.Fatalf("Could not create temporary directory: %v", err) } defer os.Remove(root) middleware := Middleware{ Next: httpserver.HandlerFunc(func(w http.ResponseWriter, r *http.Request) (int, error) { return 0, nil }), Rules: []Rule{ {Path: indexFile, Resources: []Resource{ {Path: "/index.css", Method: http.MethodGet}, }}, }, Root: http.Dir(root), indexPages: []string{indexFile}, } indexFilePath := filepath.Join(root, indexFile) _, err = os.Create(indexFilePath) if err != nil { t.Fatalf("Could not create index file: %s: %v", indexFile, err) } defer os.Remove(indexFilePath) pushingWriter := &MockedPusher{ ResponseWriter: httptest.NewRecorder(), returnedError: errors.New("cannot push right now"), } // when _, err2 := middleware.ServeHTTP(pushingWriter, request) // then if err2 != nil { t.Error("Should not return error") } expectedPushedResources := map[string]*http.PushOptions{ "/index.css": { Method: http.MethodGet, Header: http.Header{}, }, } comparePushedResources(t, expectedPushedResources, pushingWriter.pushed) }
explode_data.jsonl/66107
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 537 }
[ 2830, 3393, 24684, 14996, 16644, 1552, 1703, 1155, 353, 8840, 836, 8, 341, 197, 322, 2661, 198, 26327, 1703, 1669, 3521, 1252, 2564, 698, 23555, 11, 1848, 1669, 1758, 75274, 19886, 20798, 1949, 11, 64657, 2092, 8, 442, 6145, 3704, 6220,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestGinIPRateLimiterNotSameMethod(t *testing.T) { defer cleanRedisKey(fmt.Sprintf("%s:%s", testPrefix, testIP)) limiter := NewIPRateLimiter(&Rate{ Window: 2 * time.Second, Limit: 1, }, testPrefix) ginHandleFunc := GinRateLimit(limiter, []string{"POST"}) c, _ := gin.CreateTestContext(httptest.NewRecorder()) c.Request, _ = http.NewRequest("GET", "/", nil) c.Request.Header.Add("X-Forwarded-For", testIP) assert.Equal(t, testIP, c.ClientIP()) ginHandleFunc(c) assert.False(t, c.IsAborted()) ginHandleFunc(c) assert.False(t, c.IsAborted()) }
explode_data.jsonl/8110
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 230 }
[ 2830, 3393, 38, 258, 3298, 11564, 43, 17700, 2623, 19198, 3523, 1155, 353, 8840, 836, 8, 341, 16867, 4240, 48137, 1592, 28197, 17305, 4430, 82, 7533, 82, 497, 1273, 14335, 11, 1273, 3298, 1171, 197, 4659, 2015, 1669, 1532, 3298, 11564, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestGather(t *testing.T) { saveFind := findSockets saveDump := perfDump defer func() { findSockets = saveFind perfDump = saveDump }() findSockets = func(c *Ceph) ([]*socket, error) { return []*socket{{"osd.1", typeOsd, ""}}, nil } perfDump = func(binary string, s *socket) (string, error) { return osdPerfDump, nil } acc := &testutil.Accumulator{} c := &Ceph{} require.NoError(t, c.Gather(acc)) }
explode_data.jsonl/40227
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 183 }
[ 2830, 3393, 38, 1856, 1155, 353, 8840, 836, 8, 341, 49230, 9885, 1669, 1477, 50, 19601, 198, 49230, 51056, 1669, 21784, 51056, 198, 16867, 2915, 368, 341, 197, 80603, 50, 19601, 284, 3581, 9885, 198, 197, 197, 59545, 51056, 284, 3581, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestNonResourceCoversExactMatch(t *testing.T) { escalationTest{ ownerRules: []authorizationapi.PolicyRule{ {Verbs: sets.NewString("get"), NonResourceURLs: sets.NewString("/foo")}, {Verbs: sets.NewString("get"), NonResourceURLs: sets.NewString("/bar")}, {Verbs: sets.NewString("post"), NonResourceURLs: sets.NewString("/baz")}, }, servantRules: []authorizationapi.PolicyRule{ {Verbs: sets.NewString("get"), NonResourceURLs: sets.NewString("/foo", "/bar")}, {Verbs: sets.NewString("post"), NonResourceURLs: sets.NewString("/baz")}, }, expectedCovered: true, }.test(t) }
explode_data.jsonl/9061
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 228 }
[ 2830, 3393, 8121, 4783, 34, 8969, 57954, 8331, 1155, 353, 8840, 836, 8, 341, 80629, 278, 367, 2271, 515, 197, 197, 8118, 26008, 25, 3056, 39554, 2068, 1069, 8018, 11337, 515, 298, 197, 90, 10141, 1279, 25, 7289, 7121, 703, 445, 455, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_UpdateProjectPermsWithWorkflow(t *testing.T) { api, db, router, end := newTestAPI(t, bootstrap.InitiliazeDB) defer end() proj := assets.InsertTestProject(t, db, api.Cache, sdk.RandomString(10), sdk.RandomString(10), nil) u, pass := assets.InsertLambdaUser(api.mustDB(), &proj.ProjectGroups[0].Group) //First pipeline pip := sdk.Pipeline{ ProjectID: proj.ID, ProjectKey: proj.Key, Name: "pip1", } test.NoError(t, pipeline.InsertPipeline(api.mustDB(), api.Cache, proj, &pip, u)) newWf := sdk.Workflow{ Name: sdk.RandomString(10), WorkflowData: &sdk.WorkflowData{ Node: sdk.Node{ Name: "root", Type: sdk.NodeTypePipeline, Context: &sdk.NodeContext{ PipelineID: pip.ID, }, }, }, ProjectID: proj.ID, ProjectKey: proj.Key, } (&newWf).RetroMigrate() //Prepare request vars := map[string]string{ "permProjectKey": proj.Key, } uri := router.GetRoute("POST", api.postWorkflowHandler, vars) test.NotEmpty(t, uri) req := assets.NewAuthentifiedRequest(t, u, pass, "POST", uri, &newWf) //Do the request w := httptest.NewRecorder() router.Mux.ServeHTTP(w, req) assert.Equal(t, 201, w.Code) test.NoError(t, json.Unmarshal(w.Body.Bytes(), &newWf)) assert.NotEqual(t, 0, newWf.ID) newGr := assets.InsertTestGroup(t, db, sdk.RandomString(10)) newGp := sdk.GroupPermission{ Group: *newGr, Permission: permission.PermissionReadWriteExecute, } uri = router.GetRoute("POST", api.addGroupInProjectHandler, vars) test.NotEmpty(t, uri) req = assets.NewAuthentifiedRequest(t, u, pass, "POST", uri, &newGp) //Do the request w = httptest.NewRecorder() router.Mux.ServeHTTP(w, req) assert.Equal(t, 200, w.Code) proj2, errP := project.Load(api.mustDB(), api.Cache, proj.Key, u, project.LoadOptions.WithPipelines, project.LoadOptions.WithGroups) test.NoError(t, errP) wfLoaded, errL := workflow.Load(context.Background(), db, api.Cache, proj2, newWf.Name, u, workflow.LoadOptions{OnlyRootNode: true}) test.NoError(t, errL) assert.Equal(t, 2, len(wfLoaded.Groups)) checked := 0 for _, grProj := range proj2.ProjectGroups { for _, grWf := range wfLoaded.Groups { if grProj.Group.Name == grWf.Group.Name { checked++ assert.Equal(t, grProj.Permission, grWf.Permission) break } } } assert.Equal(t, 2, checked, "Haven't checked all groups") }
explode_data.jsonl/64787
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1012 }
[ 2830, 3393, 47393, 7849, 3889, 1011, 2354, 62768, 1155, 353, 8840, 836, 8, 341, 54299, 11, 2927, 11, 9273, 11, 835, 1669, 501, 2271, 7082, 1155, 11, 26925, 26849, 24078, 2986, 3506, 340, 16867, 835, 741, 197, 30386, 1669, 11770, 23142, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestFxVerifyTransferNilOutput(t *testing.T) { vm := testVM{} date := time.Date(2019, time.January, 19, 16, 25, 17, 3, time.UTC) vm.clock.Set(date) fx := Fx{} if err := fx.Initialize(&vm); err != nil { t.Fatal(err) } tx := &testTx{ bytes: txBytes, } in := &TransferInput{ Amt: 1, Input: Input{ SigIndices: []uint32{0}, }, } cred := &Credential{ Sigs: [][crypto.SECP256K1RSigLen]byte{ sigBytes, }, } if err := fx.VerifyTransfer(tx, in, cred, nil); err == nil { t.Fatalf("Should have failed verification due to a nil output") } }
explode_data.jsonl/68841
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 260 }
[ 2830, 3393, 81856, 32627, 21970, 19064, 5097, 1155, 353, 8840, 836, 8, 341, 54879, 1669, 1273, 11187, 16094, 44086, 1669, 882, 8518, 7, 17, 15, 16, 24, 11, 882, 3503, 276, 3536, 11, 220, 16, 24, 11, 220, 16, 21, 11, 220, 17, 20, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestPEXReactorUsesSeedsIfNeeded(t *testing.T) { // directory to store address books dir, err := ioutil.TempDir("", "pex_reactor") require.Nil(t, err) defer os.RemoveAll(dir) // nolint: errcheck // 1. create seed seed := p2p.MakeSwitch( config, 0, "127.0.0.1", "123.123.123", func(i int, sw *p2p.Switch) *p2p.Switch { book := NewAddrBook(filepath.Join(dir, "addrbook0.json"), false) book.SetLogger(log.TestingLogger()) sw.SetAddrBook(book) sw.SetLogger(log.TestingLogger()) r := NewPEXReactor(book, &PEXReactorConfig{}) r.SetLogger(log.TestingLogger()) sw.AddReactor("pex", r) return sw }, ) seed.AddListener( p2p.NewDefaultListener( "tcp", seed.NodeInfo().ListenAddr, true, log.TestingLogger(), ), ) require.Nil(t, seed.Start()) defer seed.Stop() // 2. create usual peer with only seed configured. peer := p2p.MakeSwitch( config, 1, "127.0.0.1", "123.123.123", func(i int, sw *p2p.Switch) *p2p.Switch { book := NewAddrBook(filepath.Join(dir, "addrbook1.json"), false) book.SetLogger(log.TestingLogger()) sw.SetAddrBook(book) sw.SetLogger(log.TestingLogger()) r := NewPEXReactor( book, &PEXReactorConfig{ Seeds: []string{seed.NodeInfo().NetAddress().String()}, }, ) r.SetLogger(log.TestingLogger()) sw.AddReactor("pex", r) return sw }, ) require.Nil(t, peer.Start()) defer peer.Stop() // 3. check that the peer connects to seed immediately assertPeersWithTimeout(t, []*p2p.Switch{peer}, 10*time.Millisecond, 3*time.Second, 1) }
explode_data.jsonl/6129
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 702 }
[ 2830, 3393, 1740, 55, 693, 5621, 68965, 1514, 6767, 95803, 1155, 353, 8840, 836, 8, 341, 197, 322, 6220, 311, 3553, 2621, 6467, 198, 48532, 11, 1848, 1669, 43144, 65009, 6184, 19814, 330, 79, 327, 1288, 5621, 1138, 17957, 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 TestDaokeyUV(t *testing.T) { convey.Convey("keyUV", t, func(ctx convey.C) { var ( action = "" hour = 0 slot = 0 kind = "" ) ctx.Convey("When everything goes positive", func(ctx convey.C) { p1 := keyUV(action, hour, slot, kind) ctx.Convey("Then p1 should not be nil.", func(ctx convey.C) { ctx.So(p1, convey.ShouldNotBeNil) }) }) }) }
explode_data.jsonl/21783
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 176 }
[ 2830, 3393, 12197, 792, 22246, 1155, 353, 8840, 836, 8, 341, 37203, 5617, 4801, 5617, 445, 792, 22246, 497, 259, 11, 2915, 7502, 20001, 727, 8, 341, 197, 2405, 2399, 298, 38933, 284, 8389, 298, 9598, 413, 256, 284, 220, 15, 198, 298...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestBlock_Current(t *testing.T) { mockJSONRPC := &mocks.JSONRPC{} mockGraphQL := &mocks.GraphQL{} tc, err := testTraceConfig() assert.NoError(t, err) c := &Client{ c: mockJSONRPC, g: mockGraphQL, tc: tc, p: params.GoerliChainConfig, traceSemaphore: semaphore.NewWeighted(100), } ctx := context.Background() mockJSONRPC.On( "CallContext", ctx, mock.Anything, "eth_getBlockByNumber", "latest", true, ).Return( nil, ).Run( func(args mock.Arguments) { r := args.Get(1).(*json.RawMessage) file, err := ioutil.ReadFile("testdata/block_1.json") assert.NoError(t, err) *r = json.RawMessage(file) }, ).Once() mockJSONRPC.On( "BatchCallContext", ctx, mock.MatchedBy(func(rpcs []rpc.BatchElem) bool { return len(rpcs) == 1 && rpcs[0].Method == "debug_traceTransaction" }), ).Return( nil, ).Run( func(args mock.Arguments) { r := args.Get(1).([]rpc.BatchElem) assert.Len(t, r, 1) assert.Len(t, r[0].Args, 2) assert.Equal( t, common.HexToHash("0x5e77a04531c7c107af1882d76cbff9486d0a9aa53701c30888509d4f5f2b003a").Hex(), r[0].Args[0], ) assert.Equal(t, tc, r[0].Args[1]) file, err := ioutil.ReadFile( "testdata/tx_trace_1.json", ) assert.NoError(t, err) call := new(Call) assert.NoError(t, call.UnmarshalJSON(file)) *(r[0].Result.(**Call)) = call }, ).Once() mockJSONRPC.On( "BatchCallContext", ctx, mock.MatchedBy(func(rpcs []rpc.BatchElem) bool { return len(rpcs) == 1 && rpcs[0].Method == "eth_getTransactionReceipt" }), ).Return( nil, ).Run( func(args mock.Arguments) { r := args.Get(1).([]rpc.BatchElem) assert.Len(t, r, 1) assert.Equal( t, "0x5e77a04531c7c107af1882d76cbff9486d0a9aa53701c30888509d4f5f2b003a", r[0].Args[0], ) file, err := ioutil.ReadFile( "testdata/tx_receipt_1.json", ) assert.NoError(t, err) receipt := new(types.Receipt) assert.NoError(t, receipt.UnmarshalJSON(file)) *(r[0].Result.(**types.Receipt)) = receipt }, ).Once() correctRaw, err := ioutil.ReadFile("testdata/block_response_1.json") assert.NoError(t, err) var correct *RosettaTypes.BlockResponse assert.NoError(t, json.Unmarshal(correctRaw, &correct)) resp, err := c.Block( ctx, nil, ) assert.Equal(t, correct.Block, resp) assert.NoError(t, err) mockJSONRPC.AssertExpectations(t) mockGraphQL.AssertExpectations(t) }
explode_data.jsonl/55503
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1236 }
[ 2830, 3393, 4713, 40735, 1155, 353, 8840, 836, 8, 341, 77333, 5370, 29528, 1669, 609, 16712, 82, 18009, 29528, 16094, 77333, 88637, 1669, 609, 16712, 82, 40237, 3588, 31483, 78255, 11, 1848, 1669, 1273, 6550, 2648, 741, 6948, 35699, 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 TestAllValuesAreExpressions(t *testing.T) { assert := assert.New(t) var e Expression e = NewVarValue("abc") r, err := NewRegexpValue("/abc/") assert.NoError(err) e = r e = NewStringValue("abc") d, err := NewDateTimeValue("2006-03-04T") assert.NoError(err) e = d i, err := NewIntegerValueFromBinaryString("0b1") assert.NoError(err) e = i dbl, err := NewDoubleFromString("12.12") assert.NoError(err) e = dbl e = &AnyValue{"abc"} assert.NotNil(e) }
explode_data.jsonl/51392
{ "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, 2403, 6227, 11526, 40315, 1155, 353, 8840, 836, 8, 341, 6948, 1669, 2060, 7121, 1155, 692, 2405, 384, 16378, 271, 7727, 284, 1532, 3962, 1130, 445, 13683, 1138, 7000, 11, 1848, 1669, 1532, 3477, 4580, 1130, 4283, 13683, 5300...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestPopulateCluster_BastionInvalidMatchingValues_Required(t *testing.T) { // We can't have a bastion with public masters / nodes c := buildMinimalCluster() c.Spec.Topology.Masters = kopsapi.TopologyPublic c.Spec.Topology.Nodes = kopsapi.TopologyPublic c.Spec.Topology.Bastion = &kopsapi.BastionSpec{} expectErrorFromPopulateCluster(t, c, "bastion") }
explode_data.jsonl/75045
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 133 }
[ 2830, 3393, 11598, 6334, 28678, 1668, 559, 290, 7928, 64430, 6227, 62, 8164, 1155, 353, 8840, 836, 8, 341, 197, 322, 1205, 646, 944, 614, 264, 31977, 290, 448, 584, 35367, 608, 7798, 198, 1444, 1669, 1936, 88328, 28678, 741, 1444, 364...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestPush(t *testing.T) { t.Log("Test basic push action") name := "test-push" dir := "charts" setupRepo(t, name, dir) defer teardownRepo(t, name) key := dir + "/foo-1.2.3.tgz" // set a cleanup in beforehand defer removeObject(t, name, key) cmd, stdout, stderr := command(fmt.Sprintf("helm s3 push testdata/foo-1.2.3.tgz %s", name)) if err := cmd.Run(); err != nil { t.Errorf("Unexpected error: %v", err) } if stdout.String() != "" { t.Errorf("Expected stdout to be empty, but got %q", stdout.String()) } if stderr.String() != "" { t.Errorf("Expected stderr to be empty, but got %q", stderr.String()) } // Check that chart was actually pushed obj, err := mc.StatObject(name, key, minio.StatObjectOptions{}) if err != nil { t.Errorf("Unexpected error: %v", err) } if obj.Key != key { t.Errorf("Expected key to be %q but got %q", key, obj.Key) } }
explode_data.jsonl/13704
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 360 }
[ 2830, 3393, 16644, 1155, 353, 8840, 836, 8, 341, 3244, 5247, 445, 2271, 6770, 4484, 1917, 5130, 11609, 1669, 330, 1944, 98643, 698, 48532, 1669, 330, 36584, 698, 84571, 25243, 1155, 11, 829, 11, 5419, 340, 16867, 49304, 25243, 1155, 11,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
6
func TestGetJenkinsJobs(t *testing.T) { now := func() *metav1.Time { n := metav1.Now() return &n } tests := []struct { name string pjs []kube.ProwJob expected []string }{ { name: "both complete and running", pjs: []kube.ProwJob{ { Spec: kube.ProwJobSpec{ Job: "coolio", }, Status: kube.ProwJobStatus{ CompletionTime: now(), }, }, { Spec: kube.ProwJobSpec{ Job: "maradona", }, Status: kube.ProwJobStatus{}, }, }, expected: []string{"maradona"}, }, { name: "only complete", pjs: []kube.ProwJob{ { Spec: kube.ProwJobSpec{ Job: "coolio", }, Status: kube.ProwJobStatus{ CompletionTime: now(), }, }, { Spec: kube.ProwJobSpec{ Job: "maradona", }, Status: kube.ProwJobStatus{ CompletionTime: now(), }, }, }, expected: nil, }, { name: "only running", pjs: []kube.ProwJob{ { Spec: kube.ProwJobSpec{ Job: "coolio", }, Status: kube.ProwJobStatus{}, }, { Spec: kube.ProwJobSpec{ Job: "maradona", }, Status: kube.ProwJobStatus{}, }, }, expected: []string{"maradona", "coolio"}, }, } for _, test := range tests { t.Logf("scenario %q", test.name) got := getJenkinsJobs(test.pjs) if len(got) != len(test.expected) { t.Errorf("unexpected job amount: %d (%v), expected: %d (%v)", len(got), got, len(test.expected), test.expected) } for _, ej := range test.expected { var found bool for _, gj := range got { if ej == gj { found = true break } } if !found { t.Errorf("expected jobs: %v\ngot: %v", test.expected, got) } } } }
explode_data.jsonl/72992
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 930 }
[ 2830, 3393, 1949, 41, 57006, 40667, 1155, 353, 8840, 836, 8, 341, 80922, 1669, 2915, 368, 353, 4059, 402, 16, 16299, 341, 197, 9038, 1669, 77520, 16, 13244, 741, 197, 853, 609, 77, 198, 197, 532, 78216, 1669, 3056, 1235, 341, 197, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestFindLocationByName(t *testing.T) { tests := []struct { name string want Location err error }{ { name: "宜蘭縣", want: locations[0], err: nil, }, { name: "", want: Location{}, err: errLocationNotFound, }, { name: "Not found", want: Location{}, err: errLocationNotFound, }, } for i, test := range tests { got, err := FindLocationByName(test.name) if err != test.err { t.Errorf("(%v) Expected error: %v, got: %v", i, test.err, err) } if !reflect.DeepEqual(test.want, got) { t.Errorf("(%v) Expected Location: %v, got: %v", i, test.want, got) } } }
explode_data.jsonl/19157
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 295 }
[ 2830, 3393, 9885, 4707, 16898, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 3056, 1235, 341, 197, 11609, 914, 198, 197, 50780, 9866, 198, 197, 9859, 220, 1465, 198, 197, 59403, 197, 197, 515, 298, 11609, 25, 330, 99841, 107507, 106061, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestEncodeDeterministic(t *testing.T) { for _, test := range testValidMessages { for _, want := range test.decodeTo { t.Run(fmt.Sprintf("%s (%T)", test.desc, want), func(t *testing.T) { opts := proto.MarshalOptions{ Deterministic: true, AllowPartial: test.partial, } wire, err := opts.Marshal(want) if err != nil { t.Fatalf("Marshal error: %v\nMessage:\n%v", err, prototext.Format(want)) } wire2, err := opts.Marshal(want) if err != nil { t.Fatalf("Marshal error: %v\nMessage:\n%v", err, prototext.Format(want)) } if !bytes.Equal(wire, wire2) { t.Fatalf("deterministic marshal returned varying results:\n%v", cmp.Diff(wire, wire2)) } got := want.ProtoReflect().New().Interface() uopts := proto.UnmarshalOptions{ AllowPartial: test.partial, } if err := uopts.Unmarshal(wire, got); err != nil { t.Errorf("Unmarshal error: %v\nMessage:\n%v", err, prototext.Format(want)) return } if !proto.Equal(got, want) && got.ProtoReflect().IsValid() && want.ProtoReflect().IsValid() { t.Errorf("Unmarshal returned unexpected result; got:\n%v\nwant:\n%v", prototext.Format(got), prototext.Format(want)) } }) } } }
explode_data.jsonl/1534
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 557 }
[ 2830, 3393, 32535, 92648, 4532, 1155, 353, 8840, 836, 8, 341, 2023, 8358, 1273, 1669, 2088, 1273, 4088, 15820, 341, 197, 2023, 8358, 1366, 1669, 2088, 1273, 15922, 1249, 341, 298, 3244, 16708, 28197, 17305, 4430, 82, 13456, 51, 11583, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestNewCmdTokenGenerate(t *testing.T) { var buf bytes.Buffer args := []string{} cmd := NewCmdTokenGenerate(&buf) cmd.SetArgs(args) if err := cmd.Execute(); err != nil { t.Errorf("Cannot execute token command: %v", err) } }
explode_data.jsonl/11812
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 89 }
[ 2830, 3393, 3564, 15613, 3323, 31115, 1155, 353, 8840, 836, 8, 341, 2405, 6607, 5820, 22622, 198, 31215, 1669, 3056, 917, 31483, 25920, 1669, 1532, 15613, 3323, 31115, 2099, 5909, 340, 25920, 4202, 4117, 7356, 692, 743, 1848, 1669, 5439, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestURLConfig(t *testing.T) { u := NewURLConfig(EnvironmentOf(MapFetcher(map[string][]string{ "http.key": []string{"root", "root-2"}, "http.https://host.com.key": []string{"host", "host-2"}, "http.https://user@host.com/a.key": []string{"user-a", "user-b"}, "http.https://user@host.com.key": []string{"user", "user-2"}, "http.https://host.com/a.key": []string{"host-a", "host-b"}, "http.https://host.com:8080.key": []string{"port", "port-2"}, "http.https://host.com/repo.git.key": []string{".git"}, "http.https://host.com/repo.key": []string{"no .git"}, "http.https://host.com/repo2.key": []string{"no .git"}, "http.http://host.com/repo.key": []string{"http"}, "http.https://host.*/a.key": []string{"wild"}, }))) getOne := map[string]string{ "https://root.com/a/b/c": "root-2", "https://host.com/": "host-2", "https://host.com/a/b/c": "host-b", "https://user:pass@host.com/a/b/c": "user-b", "https://user:pass@host.com/z/b/c": "user-2", "https://host.com:8080/a": "port-2", "https://host.com/repo.git/info/lfs": ".git", "https://host.com/repo.git/info": ".git", "https://host.com/repo.git": ".git", "https://host.com/repo": "no .git", "https://host.com/repo2.git/info/lfs/foo/bar": "no .git", "https://host.com/repo2.git/info/lfs": "no .git", "https://host.com/repo2.git/info": "host-2", // doesn't match /.git/info/lfs\Z/ "https://host.com/repo2.git": "host-2", // ditto "https://host.com/repo2": "no .git", "http://host.com/repo": "http", "https://host.wild/a/b/c": "wild", } for rawurl, expected := range getOne { value, _ := u.Get("http", rawurl, "key") assert.Equal(t, expected, value, "get one: "+rawurl) } getAll := map[string][]string{ "https://root.com/a/b/c": []string{"root", "root-2"}, "https://host.com/": []string{"host", "host-2"}, "https://host.com/a/b/c": []string{"host-a", "host-b"}, "https://user:pass@host.com/a/b/c": []string{"user-a", "user-b"}, "https://user:pass@host.com/z/b/c": []string{"user", "user-2"}, "https://host.com:8080/a": []string{"port", "port-2"}, } for rawurl, expected := range getAll { values := u.GetAll("http", rawurl, "key") assert.Equal(t, expected, values, "get all: "+rawurl) } }
explode_data.jsonl/26864
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1381 }
[ 2830, 3393, 3144, 2648, 1155, 353, 8840, 836, 8, 341, 10676, 1669, 1532, 3144, 2648, 48018, 2124, 21253, 97492, 9147, 14032, 45725, 917, 515, 197, 197, 76932, 4735, 788, 5968, 3056, 917, 4913, 2888, 497, 330, 2888, 12, 17, 7115, 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 TestDownloadWithoutWorkspace(t *testing.T) { v := viper.New() v.Set("token", "abc123") cfg := config.Config{ UserViperConfig: v, } err := runDownload(cfg, pflag.NewFlagSet("fake", pflag.PanicOnError), []string{}) if assert.Error(t, err) { assert.Regexp(t, "re-run the configure", err.Error()) } }
explode_data.jsonl/15066
{ "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, 11377, 26040, 45981, 1155, 353, 8840, 836, 8, 341, 5195, 1669, 95132, 7121, 741, 5195, 4202, 445, 5839, 497, 330, 13683, 16, 17, 18, 1138, 50286, 1669, 2193, 10753, 515, 197, 31672, 53, 12858, 2648, 25, 348, 345, 197, 630,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestDoctestInsideSectionNoBlankLine(t *testing.T) { // Without a leading blank line, parses as a standard paragraph. src := ` s1 -- >>> a b ` expected := ` Doc Section[s1] Paragraph Text[>>> a b] ` assertParse(t, expected, src) }
explode_data.jsonl/21263
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 97 }
[ 2830, 3393, 5404, 67880, 24480, 9620, 2753, 22770, 2460, 1155, 353, 8840, 836, 8, 341, 197, 322, 17147, 264, 6388, 10113, 1555, 11, 70835, 438, 264, 5297, 14311, 624, 41144, 1669, 22074, 82, 16, 198, 7088, 20154, 264, 198, 65, 198, 39...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestServerStart(t *testing.T) { setup() defer teardown() var svr *server mux.HandleFunc(testlib.CloudServerURL(svr.itemActionPath("5767c20e-fba4-4b23-8045-31e641d10d57")), func(w http.ResponseWriter, r *http.Request) { assert.Equal(t, http.MethodPost, r.Method) var sa *ServerAction require.NoError(t, json.NewDecoder(r.Body).Decode(&sa)) assert.Equal(t, "start", sa.Action) resp := ` { "OS-EXT-STS:task_state": null, "addresses": { "priv_sapd@vccloud.vn": [ { "OS-EXT-IPS-MAC:mac_addr": "fa:16:3e:49:27:4b", "version": 4, "addr": "10.20.165.22", "OS-EXT-IPS:type": "fixed" } ], "EXT_DIRECTNET_9": [ { "OS-EXT-IPS-MAC:mac_addr": "fa:16:3e:46:ed:7d", "version": 4, "addr": "103.107.183.146", "OS-EXT-IPS:type": "fixed" } ] }, "OS-EXT-STS:vm_state": "stopped", "OS-SRV-USG:launched_at": "2020-04-14T10:31:17.000000", "flavor": { "name": "nix.2c_2g", "ram": 2048, "OS-FLV-DISABLED:disabled": false, "vcpus": 2, "swap": "", "os-flavor-access:is_public": true, "rxtx_factor": 1.0, "OS-FLV-EXT-DATA:ephemeral": 0, "disk": 0, "id": "be7dab73-2c87-4d59-a2fd-49e4f7845310" }, "id": "5767c20e-fba4-4b23-8045-31e641d10d57", "security_groups": [ { "name": "default" }, { "name": "default" } ], "user_id": "55d38aecb1034c06b99c1c87fb6f0740", "OS-DCF:diskConfig": "MANUAL", "accessIPv4": "", "accessIPv6": "", "OS-EXT-STS:power_state": 4, "OS-EXT-AZ:availability_zone": "HN1", "config_drive": "", "status": "SHUTOFF", "updated": "2020-04-14T11:02:39Z", "hostId": "74ca4ef173ad2fd2e875a30ee7f594072ba1367ac3d963532f2430a1", "OS-SRV-USG:terminated_at": null, "key_name": "sapd1", "name": "sapd12345x", "created": "2020-04-14T10:30:59Z", "tenant_id": "17a1c3c952c84b3e84a82ddd48364938", "os-extended-volumes:volumes_attached": [ { "id": "ef173de9-d587-4570-b9a9-9baf760c8b85" } ], "metadata": { "category": "premium", "os_type": "Ubuntu 18.04" }, "ipv6": false, "category": "premium", "region_name": "HaNoi" }` _, _ = fmt.Fprint(w, resp) }) server, err := client.Server.Start(ctx, "5767c20e-fba4-4b23-8045-31e641d10d57") require.NoError(t, err) assert.Equal(t, "5767c20e-fba4-4b23-8045-31e641d10d57", server.ID) }
explode_data.jsonl/35475
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1213 }
[ 2830, 3393, 5475, 3479, 1155, 353, 8840, 836, 8, 341, 84571, 741, 16867, 49304, 741, 2405, 13559, 81, 353, 4030, 198, 2109, 2200, 63623, 8623, 2740, 94492, 5475, 3144, 1141, 18920, 8984, 2512, 1820, 445, 20, 22, 21, 22, 66, 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...
1
func TestTxs(t *testing.T) { kb, err := keys.NewKeyBaseFromDir(InitClientHome(t, "")) require.NoError(t, err) addr, seed := CreateAddr(t, name1, pw, kb) cleanup, _, _, port := InitializeTestLCD(t, 1, []sdk.AccAddress{addr}, true) defer cleanup() var emptyTxs []sdk.TxResponse txs := getTransactions(t, port) require.Equal(t, emptyTxs, txs) // query empty txs = getTransactions(t, port, fmt.Sprintf("sender=%s", addr.String())) require.Equal(t, emptyTxs, txs) // also tests url decoding txs = getTransactions(t, port, fmt.Sprintf("sender=%s", addr.String())) require.Equal(t, emptyTxs, txs) txs = getTransactions(t, port, fmt.Sprintf("action=submit%%20proposal&proposer=%s", addr.String())) require.Equal(t, emptyTxs, txs) // create tx receiveAddr, resultTx := doTransfer(t, port, seed, name1, memo, pw, addr, fees) tests.WaitForHeight(resultTx.Height+1, port) // check if tx is queryable tx := getTransaction(t, port, resultTx.TxHash) require.Equal(t, resultTx.TxHash, tx.TxHash) // query sender txs = getTransactions(t, port, fmt.Sprintf("sender=%s", addr.String())) require.Len(t, txs, 1) require.Equal(t, resultTx.Height, txs[0].Height) // query recipient txs = getTransactions(t, port, fmt.Sprintf("recipient=%s", receiveAddr.String())) require.Len(t, txs, 1) require.Equal(t, resultTx.Height, txs[0].Height) // query transaction that doesn't exist validTxHash := "9ADBECAAD8DACBEC3F4F535704E7CF715C765BDCEDBEF086AFEAD31BA664FB0B" res, body := getTransactionRequest(t, port, validTxHash) require.True(t, strings.Contains(body, validTxHash)) require.Equal(t, http.StatusNotFound, res.StatusCode) // bad query string res, body = getTransactionRequest(t, port, "badtxhash") require.True(t, strings.Contains(body, "encoding/hex")) require.Equal(t, http.StatusInternalServerError, res.StatusCode) }
explode_data.jsonl/25406
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 720 }
[ 2830, 3393, 51, 18561, 1155, 353, 8840, 836, 8, 341, 16463, 65, 11, 1848, 1669, 6894, 7121, 1592, 3978, 3830, 6184, 7, 3803, 2959, 7623, 1155, 11, 77561, 17957, 35699, 1155, 11, 1848, 340, 53183, 11, 10320, 1669, 4230, 13986, 1155, 11...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestBoardHealth(t *testing.T) { client := v1.New(nil) b, err := client.BoardHealth(health.NewForBoard(types.FXBTCJPY)) assert.NoError(t, err) fmt.Printf("%+v\n", b) }
explode_data.jsonl/41198
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 76 }
[ 2830, 3393, 11932, 14542, 1155, 353, 8840, 836, 8, 341, 25291, 1669, 348, 16, 7121, 27907, 340, 2233, 11, 1848, 1669, 2943, 83284, 14542, 7, 12120, 7121, 2461, 11932, 52613, 991, 55, 59118, 27188, 56, 1171, 6948, 35699, 1155, 11, 1848, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
func TestRemoveTag(t *testing.T) { tcs := []struct { name string tag string webhooksBefore admit_v1.MutatingWebhookConfigurationList webhooksAfter admit_v1.MutatingWebhookConfigurationList namespaces corev1.NamespaceList outputMatches []string skipConfirmation bool error string }{ { name: "TestSimpleRemove", tag: "sample", webhooksBefore: admit_v1.MutatingWebhookConfigurationList{ Items: []admit_v1.MutatingWebhookConfiguration{ { ObjectMeta: metav1.ObjectMeta{ Name: "istio-revision-tag-sample", Labels: map[string]string{istioTagLabel: "sample"}, }, }, }, }, webhooksAfter: admit_v1.MutatingWebhookConfigurationList{}, namespaces: corev1.NamespaceList{}, outputMatches: []string{}, skipConfirmation: true, error: "", }, { name: "TestWrongTagLabelNotRemoved", tag: "sample", webhooksBefore: admit_v1.MutatingWebhookConfigurationList{ Items: []admit_v1.MutatingWebhookConfiguration{ { ObjectMeta: metav1.ObjectMeta{ Name: "istio-revision-tag-wrong", Labels: map[string]string{istioTagLabel: "wrong"}, }, }, }, }, webhooksAfter: admit_v1.MutatingWebhookConfigurationList{ Items: []admit_v1.MutatingWebhookConfiguration{ { ObjectMeta: metav1.ObjectMeta{ Name: "istio-revision-tag-wrong", Labels: map[string]string{istioTagLabel: "wrong"}, }, }, }, }, namespaces: corev1.NamespaceList{}, outputMatches: []string{}, skipConfirmation: true, error: "cannot remove tag \"sample\"", }, { name: "TestDeleteTagWithDependentNamespace", tag: "match", webhooksBefore: admit_v1.MutatingWebhookConfigurationList{ Items: []admit_v1.MutatingWebhookConfiguration{ { ObjectMeta: metav1.ObjectMeta{ Name: "istio-revision-tag-match", Labels: map[string]string{istioTagLabel: "match"}, }, }, }, }, webhooksAfter: admit_v1.MutatingWebhookConfigurationList{ Items: []admit_v1.MutatingWebhookConfiguration{ { ObjectMeta: metav1.ObjectMeta{ Name: "istio-revision-tag-match", Labels: map[string]string{istioTagLabel: "match"}, }, }, }, }, namespaces: corev1.NamespaceList{ Items: []corev1.Namespace{ { ObjectMeta: metav1.ObjectMeta{ Name: "dependent", Labels: map[string]string{label.IstioRev: "match"}, }, }, }, }, outputMatches: []string{"Caution, found 1 namespace(s) still injected by tag \"match\": dependent"}, skipConfirmation: false, error: "", }, } for _, tc := range tcs { t.Run(tc.name, func(t *testing.T) { var out bytes.Buffer client := fake.NewSimpleClientset(tc.webhooksBefore.DeepCopyObject(), tc.namespaces.DeepCopyObject()) err := removeTag(context.Background(), client, tc.tag, tc.skipConfirmation, &out) if tc.error == "" && err != nil { t.Fatalf("expected no error, got %v", err) } if tc.error != "" { if err == nil { t.Fatalf("expected error to include \"%s\" but got none", tc.error) } if !strings.Contains(err.Error(), tc.error) { t.Fatalf("expected \"%s\" in error, got %v", tc.error, err) } } commandOutput := out.String() for _, s := range tc.outputMatches { if !strings.Contains(commandOutput, s) { t.Fatalf("expected \"%s\" in command output, got %s", s, commandOutput) } } // check mutating webhooks after run webhooksAfter, _ := client.AdmissionregistrationV1().MutatingWebhookConfigurations().List(context.Background(), metav1.ListOptions{}) if len(webhooksAfter.Items) != len(tc.webhooksAfter.Items) { t.Fatalf("expected %d after running, got %d", len(tc.webhooksAfter.Items), len(webhooksAfter.Items)) } }) } }
explode_data.jsonl/15894
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1769 }
[ 2830, 3393, 13021, 5668, 1155, 353, 8840, 836, 8, 341, 3244, 4837, 1669, 3056, 1235, 341, 197, 11609, 1797, 914, 198, 197, 60439, 1060, 914, 198, 197, 97250, 38560, 10227, 256, 16698, 2273, 16, 1321, 332, 1095, 5981, 20873, 7688, 852, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestNew(t *testing.T) { t.Run("with no args", func(t *testing.T) { obj := New() if obj.trace == true { t.Errorf("expected trace=false, got %s", strconv.FormatBool(obj.trace)) } }, ) t.Run("implements MessageSender", func(t *testing.T) { var _ logevent.MessageSender = New() }, ) }
explode_data.jsonl/71383
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 144 }
[ 2830, 3393, 3564, 1155, 353, 8840, 836, 8, 341, 3244, 16708, 445, 4197, 902, 2827, 756, 197, 29244, 1155, 353, 8840, 836, 8, 341, 298, 22671, 1669, 1532, 741, 298, 743, 2839, 34412, 621, 830, 341, 571, 3244, 13080, 445, 7325, 11655, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestUintString(t *testing.T) { var expected = "123456789" ti := Uint{} ti.Set(expected) // nolint if ti.String() != expected { t.Errorf("actual:%s, expected:%s", ti.String(), expected) } }
explode_data.jsonl/13401
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 83 }
[ 2830, 3393, 21570, 703, 1155, 353, 8840, 836, 8, 341, 2405, 3601, 284, 330, 16, 17, 18, 19, 20, 21, 22, 23, 24, 698, 72859, 1669, 27883, 16094, 72859, 4202, 15253, 8, 442, 308, 337, 396, 198, 743, 8988, 6431, 368, 961, 3601, 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...
2
func TestAzureMachine_ValidateUpdate(t *testing.T) { g := NewWithT(t) tests := []struct { name string oldMachine *AzureMachine machine *AzureMachine wantErr bool }{ { name: "azuremachine with valid SSHPublicKey", oldMachine: createMachineWithSSHPublicKey(t, ""), machine: createMachineWithSSHPublicKey(t, validSSHPublicKey), wantErr: false, }, { name: "azuremachine without SSHPublicKey", oldMachine: createMachineWithSSHPublicKey(t, ""), machine: createMachineWithSSHPublicKey(t, ""), wantErr: true, }, { name: "azuremachine with invalid SSHPublicKey", oldMachine: createMachineWithSSHPublicKey(t, ""), machine: createMachineWithSSHPublicKey(t, "invalid ssh key"), wantErr: true, }, { name: "azuremachine with user assigned identities", oldMachine: createMachineWithUserAssignedIdentities(t, []UserAssignedIdentity{{ProviderID: "azure:///123"}}), machine: createMachineWithUserAssignedIdentities(t, []UserAssignedIdentity{{ProviderID: "azure:///123"}, {ProviderID: "azure:///456"}}), wantErr: false, }, { name: "azuremachine with empty user assigned identities", oldMachine: createMachineWithUserAssignedIdentities(t, []UserAssignedIdentity{{ProviderID: "azure:///123"}}), machine: createMachineWithUserAssignedIdentities(t, []UserAssignedIdentity{}), wantErr: true, }, { name: "azuremachine with valid osDisk cache type", oldMachine: createMachineWithOsDiskCacheType(t, string(compute.PossibleCachingTypesValues()[0])), machine: createMachineWithOsDiskCacheType(t, string(compute.PossibleCachingTypesValues()[1])), wantErr: false, }, { name: "azuremachine with invalid osDisk cache type", oldMachine: createMachineWithOsDiskCacheType(t, string(compute.PossibleCachingTypesValues()[0])), machine: createMachineWithOsDiskCacheType(t, "invalid_cache_type"), wantErr: true, }, { name: "azuremachine with invalid data disk's managed disk's storage account type", oldMachine: createMachineWithDataDiskManagedDisk(t, "Premium_LRS"), machine: createMachineWithDataDiskManagedDisk(t, "invalid_storage_account"), wantErr: true, }, { name: "azuremachine with invalid data disk's managed disk update", oldMachine: createMachineWithDataDiskManagedDisk(t, "Premium_LRS"), machine: createMachineWithDataDiskManagedDisk(t, "Standard_LRS"), wantErr: true, }, } for _, tc := range tests { t.Run(tc.name, func(t *testing.T) { err := tc.machine.ValidateUpdate(tc.oldMachine) if tc.wantErr { g.Expect(err).To(HaveOccurred()) } else { g.Expect(err).NotTo(HaveOccurred()) } }) } }
explode_data.jsonl/24642
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1109 }
[ 2830, 3393, 78107, 21605, 62, 17926, 4289, 1155, 353, 8840, 836, 8, 341, 3174, 1669, 1532, 2354, 51, 1155, 692, 78216, 1669, 3056, 1235, 341, 197, 11609, 981, 914, 198, 197, 61828, 21605, 353, 78107, 21605, 198, 197, 2109, 3814, 262, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestFailureBadSpanID(t *testing.T) { badSpanIDESSpan, err := loadESSpanFixture(1) require.NoError(t, err) badSpanIDESSpan.SpanID = "zz" failingSpanTransformAnyMsg(t, &badSpanIDESSpan) }
explode_data.jsonl/5153
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 84 }
[ 2830, 3393, 17507, 17082, 12485, 915, 1155, 353, 8840, 836, 8, 341, 2233, 329, 12485, 915, 9996, 848, 11, 1848, 1669, 2795, 9996, 848, 18930, 7, 16, 340, 17957, 35699, 1155, 11, 1848, 340, 2233, 329, 12485, 915, 9996, 848, 85309, 915,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
func TestIsXMLType(t *testing.T) { for _, test := range []struct { input string expect bool }{ {"application/xml", true}, {"application/json+xml", true}, {"application/vnd.foo+xml", true}, {"application/xml; charset=utf-8", true}, {"application/vnd.foo+xml; charset=utf-8", true}, {"text/xml", true}, {"text/json+xml", true}, {"text/vnd.foo+xml", true}, {"application/foo-xml", false}, {"application/foo.xml", false}, {"application/vnd.foo-xml", false}, {"application/vnd.foo.xml", false}, {"application/xml+json", false}, {"text/foo-xml", false}, {"text/foo.xml", false}, {"text/vnd.foo-xml", false}, {"text/vnd.foo.xml", false}, {"text/xml+json", false}, } { result := IsXMLType(test.input) if result != test.expect { t.Errorf("failed on %q: want %v, got %v", test.input, test.expect, result) } } }
explode_data.jsonl/51177
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 356 }
[ 2830, 3393, 3872, 10609, 929, 1155, 353, 8840, 836, 8, 341, 2023, 8358, 1273, 1669, 2088, 3056, 1235, 341, 197, 22427, 220, 914, 198, 197, 24952, 1807, 198, 197, 59403, 197, 197, 4913, 5132, 36524, 497, 830, 1583, 197, 197, 4913, 5132...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestParseImageName(t *testing.T) { for _, tt := range parseImageNameTests { name, tag := parseImageName(tt.imageName) if name != tt.name || tag != tt.tag { t.Errorf("Expected name/tag: %s/%s, got %s/%s", tt.name, tt.tag, name, tag) } } }
explode_data.jsonl/2850
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 114 }
[ 2830, 3393, 14463, 1906, 675, 1155, 353, 8840, 836, 8, 341, 2023, 8358, 17853, 1669, 2088, 4715, 1906, 675, 18200, 341, 197, 11609, 11, 4772, 1669, 4715, 1906, 675, 47152, 7352, 675, 340, 197, 743, 829, 961, 17853, 2644, 1369, 4772, 9...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
4
func Test_Execution_CleanupSuccess_Detach_SkipDetach(t *testing.T) { // Should try 10 times to detach release := models.MockRelease(t) release.DetachStrategy = to.Strp("SkipDetach") maws := models.MockAwsClients(release) maws.ASG.DetachLoadBalancersError = fmt.Errorf("never reached") assertSuccessfulExecutionWithAWS(t, release, maws) }
explode_data.jsonl/3590
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 122 }
[ 2830, 3393, 62, 20294, 920, 60639, 7188, 1557, 295, 610, 1098, 13389, 89306, 1155, 353, 8840, 836, 8, 341, 197, 322, 12260, 1430, 220, 16, 15, 3039, 311, 46781, 198, 17200, 1623, 1669, 4119, 24664, 16077, 1155, 340, 17200, 1623, 909, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestWhiteTransparent195(t *testing.T) { err := initTesting() if err != nil { t.Error(err) return } // create pdf. pdf := GoPdf{} pdf.Start(Config{PageSize: *PageSizeA4}) pdf.AddPage() var glyphNotFoundOfLiberationSerif []rune //err = pdf.AddTTFFontWithOption("LiberationSerif-Regular", "/Users/oneplus/Code/Work/gopdf_old/test/res/Meera-Regular.ttf", TtfOption{ err = pdf.AddTTFFontWithOption("LiberationSerif-Regular", "test/res/LiberationSerif-Regular.ttf", TtfOption{ OnGlyphNotFound: func(r rune) { //call when can not find glyph inside ttf file. glyphNotFoundOfLiberationSerif = append(glyphNotFoundOfLiberationSerif, r) }, OnGlyphNotFoundSubstitute: func(r rune) rune { //return r return rune('\u20b0') //(U+25A1) = “□” }, }) if err != nil { t.Error(err) return } err = pdf.SetFont("LiberationSerif-Regular", "", 14) if err != nil { t.Error(err) return } // write text. op := CellOption{Align: Left | Middle} rect := Rect{W: 20, H: 30} pdf.SetX(350) pdf.SetY(50) //err = pdf.Cell(&rect, "あいうえ") // OK. //err = pdf.Cell(&rect, "あうう") // OK. err = pdf.CellWithOption(&rect, "あいうえ", op) // NG. "abcdef." is White/Transparent. //err = pdf.Cell(&rect, " あいうえ") // NG. "abcdef." is White/Transparent. // err = pdf.Cell(&rect, "あいうえ ") // NG. "abcdef." is White/Transparent. if err != nil { t.Error(err) return } pdf.SetY(100) err = pdf.CellWithOption(&rect, "abcกdef.", op) if err != nil { t.Error(err) return } //coz あ い う え not contain in "test/res/LiberationSerif-Regular.ttf" // if len(glyphNotFoundOfLiberationSerif) != 4 { // t.Error(err) // return // } pdf.SetNoCompression() err = pdf.WritePdf("./test/out/white_transparent195.pdf") if err != nil { t.Error(err) return } }
explode_data.jsonl/60947
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 772 }
[ 2830, 3393, 14075, 57360, 16, 24, 20, 1155, 353, 8840, 836, 8, 341, 9859, 1669, 2930, 16451, 741, 743, 1848, 961, 2092, 341, 197, 3244, 6141, 3964, 340, 197, 853, 198, 197, 532, 197, 322, 1855, 12782, 624, 3223, 2940, 1669, 5994, 67...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestBufferCapacity(t *testing.T) { s := pubsub.NewServer(pubsub.BufferCapacity(2)) s.SetLogger(log.TestingLogger()) assert.Equal(t, 2, s.BufferCapacity()) ctx := context.Background() err := s.Publish(ctx, "Nighthawk") require.NoError(t, err) err = s.Publish(ctx, "Sage") require.NoError(t, err) ctx, cancel := context.WithTimeout(ctx, 10*time.Millisecond) defer cancel() err = s.Publish(ctx, "Ironclad") if assert.Error(t, err) { assert.Equal(t, context.DeadlineExceeded, err) } }
explode_data.jsonl/22063
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 203 }
[ 2830, 3393, 4095, 29392, 1155, 353, 8840, 836, 8, 341, 1903, 1669, 6675, 1966, 7121, 5475, 74186, 1966, 22622, 29392, 7, 17, 1171, 1903, 4202, 7395, 12531, 8787, 287, 7395, 12367, 6948, 12808, 1155, 11, 220, 17, 11, 274, 22622, 29392, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestHeader(t *testing.T) { src := prelude.NewDummySource("func main; end") pos := prelude.Pos{File: src} root := &Program{ Toplevels: []Node{ &Function{ StartPos: pos, EndPos: pos, Ident: NewSymbol("main"), }, }, } var buf bytes.Buffer Fprintln(&buf, root) got, err := buf.ReadString('\n') if err != nil { t.Fatal(err) } want := "AST of <dummy>:\n" if got != want { t.Fatalf("Want '%s' as first line but actually '%s'", want, got) } }
explode_data.jsonl/23983
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 219 }
[ 2830, 3393, 4047, 1155, 353, 8840, 836, 8, 341, 41144, 1669, 855, 52538, 7121, 43344, 3608, 445, 2830, 1887, 26, 835, 1138, 28164, 1669, 855, 52538, 44208, 90, 1703, 25, 2286, 532, 33698, 1669, 609, 10690, 515, 197, 10261, 67780, 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...
3
func TestWriteUsage(t *testing.T) { expectedUsage := "Usage: example [--name NAME] [--value VALUE] [--verbose] [--dataset DATASET] [--optimize OPTIMIZE] [--ids IDS] [--values VALUES] [--workers WORKERS] [--testenv TESTENV] [--file FILE] INPUT [OUTPUT [OUTPUT ...]]" expectedHelp := ` Usage: example [--name NAME] [--value VALUE] [--verbose] [--dataset DATASET] [--optimize OPTIMIZE] [--ids IDS] [--values VALUES] [--workers WORKERS] [--testenv TESTENV] [--file FILE] INPUT [OUTPUT [OUTPUT ...]] Positional arguments: INPUT OUTPUT list of outputs Options: --name NAME name to use [default: Foo Bar] --value VALUE secret value [default: 42] --verbose, -v verbosity level --dataset DATASET dataset to use --optimize OPTIMIZE, -O OPTIMIZE optimization level --ids IDS Ids --values VALUES Values [default: [3.14 42 256]] --workers WORKERS, -w WORKERS number of workers to start [default: 10, env: WORKERS] --testenv TESTENV, -a TESTENV [env: TEST_ENV] --file FILE, -f FILE File with mandatory extension [default: scratch.txt] --help, -h display this help and exit ` var args struct { Input string `arg:"positional"` Output []string `arg:"positional" help:"list of outputs"` Name string `help:"name to use"` Value int `help:"secret value"` Verbose bool `arg:"-v" help:"verbosity level"` Dataset string `help:"dataset to use"` Optimize int `arg:"-O" help:"optimization level"` Ids []int64 `help:"Ids"` Values []float64 `help:"Values"` Workers int `arg:"-w,env:WORKERS" help:"number of workers to start" default:"10"` TestEnv string `arg:"-a,env:TEST_ENV"` File *NameDotName `arg:"-f" help:"File with mandatory extension"` } args.Name = "Foo Bar" args.Value = 42 args.Values = []float64{3.14, 42, 256} args.File = &NameDotName{"scratch", "txt"} p, err := NewParser(Config{Program: "example"}, &args) require.NoError(t, err) os.Args[0] = "example" var help bytes.Buffer p.WriteHelp(&help) assert.Equal(t, expectedHelp[1:], help.String()) var usage bytes.Buffer p.WriteUsage(&usage) assert.Equal(t, expectedUsage, strings.TrimSpace(usage.String())) }
explode_data.jsonl/20488
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1009 }
[ 2830, 3393, 7985, 14783, 1155, 353, 8840, 836, 8, 341, 42400, 14783, 1669, 330, 14783, 25, 3110, 73817, 606, 19122, 60, 73817, 957, 26827, 60, 73817, 14883, 60, 73817, 21378, 39362, 61273, 60, 73817, 94332, 40034, 96897, 60, 73817, 3365, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_IsControllingBot(t *testing.T) { pl := playerWithProperty("m_bIsControllingBot", st.PropertyValue{IntVal: 0}) assert.False(t, pl.IsControllingBot()) pl = playerWithProperty("m_bIsControllingBot", st.PropertyValue{IntVal: 1}) assert.True(t, pl.IsControllingBot()) }
explode_data.jsonl/12188
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 100 }
[ 2830, 3393, 4476, 31879, 818, 16210, 23502, 1155, 353, 8840, 836, 8, 341, 72213, 1669, 2781, 2354, 3052, 445, 76, 880, 3872, 818, 16210, 23502, 497, 357, 15727, 1130, 90, 1072, 2208, 25, 220, 15, 8824, 6948, 50757, 1155, 11, 625, 4506...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestCatalogList(t *testing.T) { client, err := clients.NewIdentityV3Client() th.AssertNoErr(t, err) allPages, err := catalog.List(client).AllPages() th.AssertNoErr(t, err) allEntities, err := catalog.ExtractServiceCatalog(allPages) th.AssertNoErr(t, err) for _, entity := range allEntities { tools.PrintResource(t, entity) } }
explode_data.jsonl/36939
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 132 }
[ 2830, 3393, 41606, 852, 1155, 353, 8840, 836, 8, 341, 25291, 11, 1848, 1669, 8239, 7121, 18558, 53, 18, 2959, 741, 70479, 11711, 2753, 7747, 1155, 11, 1848, 692, 50960, 17713, 11, 1848, 1669, 16403, 5814, 12805, 568, 2403, 17713, 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...
2
func TestCreatePipelineUnknownType(t *testing.T) { tmp, _ := ioutil.TempDir("", "TestCreatePipelineUnknownType") gaia.Cfg = new(gaia.Config) gaia.Cfg.HomePath = tmp buf := new(bytes.Buffer) gaia.Cfg.Logger = hclog.New(&hclog.LoggerOptions{ Level: hclog.Trace, Output: buf, Name: "Gaia", }) mcp := new(mockCreatePipelineStore) services.MockStorageService(mcp) defer func() { services.MockStorageService(nil) }() cp := new(gaia.CreatePipeline) cp.Pipeline.Type = gaia.PTypeUnknown pipelineService := NewGaiaPipelineService(Dependencies{ Scheduler: &mockScheduleService{}, }) pipelineService.CreatePipeline(cp) if cp.Output != "create pipeline failed. Pipeline type is not supported unknown is not supported" { t.Fatal("error output was not the expected output. was: ", cp.Output) } if cp.StatusType != gaia.CreatePipelineFailed { t.Fatal("pipeline status is not expected status. was:", cp.StatusType) } }
explode_data.jsonl/13139
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 358 }
[ 2830, 3393, 4021, 34656, 13790, 929, 1155, 353, 8840, 836, 8, 341, 20082, 11, 716, 1669, 43144, 65009, 6184, 19814, 330, 2271, 4021, 34656, 13790, 929, 1138, 3174, 64, 685, 727, 4817, 284, 501, 3268, 64, 685, 10753, 340, 3174, 64, 685...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestLoadModule(t *testing.T) { logp.TestingSetup() cases := []struct { name string exists bool err bool }{ { name: "service", exists: true, err: false, }, { name: "broken", exists: true, err: true, }, { name: "empty", exists: false, err: false, }, { name: "notexists", exists: false, err: false, }, } for _, c := range cases { register := NewRegister() r := NewLightModulesSource("testdata/lightmodules") t.Run(c.name, func(t *testing.T) { _, err := r.loadModule(register, c.name) if c.err { assert.Error(t, err) } assert.Equal(t, c.exists, r.HasModule(c.name)) }) } }
explode_data.jsonl/9713
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 347 }
[ 2830, 3393, 5879, 3332, 1155, 353, 8840, 836, 8, 341, 6725, 79, 8787, 287, 21821, 2822, 1444, 2264, 1669, 3056, 1235, 341, 197, 11609, 256, 914, 198, 197, 8122, 1671, 1807, 198, 197, 9859, 262, 1807, 198, 197, 59403, 197, 197, 515, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestGetOutboundTCPFilterChainForService(t *testing.T) { mockCtrl := gomock.NewController(t) defer mockCtrl.Finish() mockCatalog := catalog.NewMockMeshCataloger(mockCtrl) mockConfigurator := configurator.NewMockConfigurator(mockCtrl) lb := &listenerBuilder{ meshCatalog: mockCatalog, cfg: mockConfigurator, serviceIdentity: tests.BookbuyerServiceIdentity, } testCases := []struct { name string destinationIPRanges []string servicePort uint32 expectedFilterChainMatch *xds_listener.FilterChainMatch expectError bool }{ { name: "service with multiple endpoints", destinationIPRanges: []string{ "1.1.1.1/32", "2.2.2.2/32", }, servicePort: 80, // this can be different from the target port in the endpoints expectedFilterChainMatch: &xds_listener.FilterChainMatch{ DestinationPort: &wrapperspb.UInt32Value{Value: 80}, // same as 'servicePort' PrefixRanges: []*xds_core.CidrRange{ // The order is guaranteed to be sorted { AddressPrefix: "1.1.1.1", PrefixLen: &wrapperspb.UInt32Value{ Value: 32, }, }, { AddressPrefix: "2.2.2.2", PrefixLen: &wrapperspb.UInt32Value{ Value: 32, }, }, }, }, expectError: false, }, { name: "service with no endpoints", destinationIPRanges: nil, servicePort: 80, expectedFilterChainMatch: nil, expectError: true, }, } for i, tc := range testCases { t.Run(fmt.Sprintf("Testing test case %d: %s", i, tc.name), func(t *testing.T) { assert := tassert.New(t) trafficMatch := trafficpolicy.TrafficMatch{ Name: "test", DestinationPort: int(tc.servicePort), DestinationIPRanges: tc.destinationIPRanges, WeightedClusters: []service.WeightedCluster{{ClusterName: "bookstore_14001", Weight: 100}}, } tcpFilterChain, err := lb.getOutboundTCPFilterChainForService(trafficMatch) assert.Equal(err != nil, tc.expectError) if err != nil { assert.Nil(tcpFilterChain) } else { assert.NotNil(tcpFilterChain) assert.Len(tcpFilterChain.FilterChainMatch.PrefixRanges, len(tc.destinationIPRanges)) for _, filter := range tcpFilterChain.Filters { assert.Equal(wellknown.TCPProxy, filter.Name) } } }) } }
explode_data.jsonl/10268
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1094 }
[ 2830, 3393, 1949, 2662, 10891, 49896, 5632, 18837, 2461, 1860, 1155, 353, 8840, 836, 8, 341, 77333, 15001, 1669, 342, 316, 1176, 7121, 2051, 1155, 340, 16867, 7860, 15001, 991, 18176, 2822, 77333, 41606, 1669, 16403, 7121, 11571, 14194, 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...
3
func TestAutoNodeRecoveryTimeoutEnvForPxVersion2_6(t *testing.T) { coreops.SetInstance(coreops.New(fakek8sclient.NewSimpleClientset())) nodeName := "testNode" cluster := &corev1.StorageCluster{ ObjectMeta: metav1.ObjectMeta{ Name: "px-cluster", Namespace: "kube-system", }, Spec: corev1.StorageClusterSpec{ Image: "portworx/oci-monitor:2.5.1", }, } recoveryEnv := v1.EnvVar{ Name: "AUTO_NODE_RECOVERY_TIMEOUT_IN_SECS", Value: "1500", } driver := portworx{} actual, err := driver.GetStoragePodSpec(cluster, nodeName) require.NoError(t, err) require.Contains(t, actual.Containers[0].Env, recoveryEnv) cluster.Spec.Image = "portworx/oci-monitor:2.6.0" actual, err = driver.GetStoragePodSpec(cluster, nodeName) require.NoError(t, err) require.NotContains(t, actual.Containers[0].Env, recoveryEnv) }
explode_data.jsonl/55438
{ "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, 13253, 1955, 693, 7449, 7636, 14359, 2461, 60977, 5637, 17, 62, 21, 1155, 353, 8840, 836, 8, 341, 71882, 3721, 4202, 2523, 47867, 3721, 7121, 74138, 74, 23, 82, 2972, 7121, 16374, 2959, 746, 12145, 20831, 675, 1669, 330, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestInterSlice(t *testing.T) { val := interface{}("something") m := map[string]interface{}{"value": []interface{}{val}, "nothing": nil} assert.Equal(t, val, New(m).Get("value").InterSlice()[0]) assert.Equal(t, val, New(m).Get("value").MustInterSlice()[0]) assert.Equal(t, []interface{}(nil), New(m).Get("nothing").InterSlice()) assert.Equal(t, val, New(m).Get("nothing").InterSlice([]interface{}{interface{}("something")})[0]) assert.Panics(t, func() { New(m).Get("nothing").MustInterSlice() }) }
explode_data.jsonl/23377
{ "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, 3306, 33236, 1155, 353, 8840, 836, 8, 1476, 19302, 1669, 3749, 6257, 445, 33331, 1138, 2109, 1669, 2415, 14032, 31344, 6257, 4913, 957, 788, 3056, 4970, 6257, 90, 831, 2137, 330, 41212, 788, 2092, 532, 6948, 12808, 1155, 11,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestStringPowers(t *testing.T) { var b, p Word for b = 2; b <= 16; b++ { for p = 0; p <= 512; p++ { x := nat(nil).expWW(b, p) xs := x.string(lowercaseDigits[0:b]) xs2 := toString(x, lowercaseDigits[0:b]) if xs != xs2 { t.Errorf("failed at %d ** %d in base %d: %s != %s", b, p, b, xs, xs2) } } if b >= 3 && testing.Short() { break } } }
explode_data.jsonl/2189
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 195 }
[ 2830, 3393, 703, 47, 15965, 1155, 353, 8840, 836, 8, 341, 2405, 293, 11, 281, 9322, 198, 2023, 293, 284, 220, 17, 26, 293, 2651, 220, 16, 21, 26, 293, 1027, 341, 197, 2023, 281, 284, 220, 15, 26, 281, 2651, 220, 20, 16, 17, 26...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestObjectKeys(t *testing.T) { const SCRIPT = ` var o = { a: 1, b: 2, c: 3, d: 4 }; o; ` vm := New() prg := MustCompile("test.js", SCRIPT, false) res, err := vm.RunProgram(prg) if err != nil { t.Fatal(err) } if o, ok := res.(*Object); ok { keys := o.Keys() if !reflect.DeepEqual(keys, []string{"a", "b", "c", "d"}) { t.Fatalf("Unexpected keys: %v", keys) } } }
explode_data.jsonl/10496
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 185 }
[ 2830, 3393, 1190, 8850, 1155, 353, 8840, 836, 8, 341, 4777, 53679, 284, 22074, 2405, 297, 284, 314, 264, 25, 220, 16, 11, 293, 25, 220, 17, 11, 272, 25, 220, 18, 11, 294, 25, 220, 19, 2605, 22229, 280, 197, 19324, 54879, 1669, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
4
func TestGetFrontendIPConfigID(t *testing.T) { ctrl := gomock.NewController(t) defer ctrl.Finish() az := GetTestCloud(ctrl) testGetLoadBalancerSubResourceID(t, az, az.getFrontendIPConfigID, frontendIPConfigIDTemplate) }
explode_data.jsonl/7457
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 81 }
[ 2830, 3393, 1949, 23395, 408, 3298, 2648, 915, 1155, 353, 8840, 836, 8, 341, 84381, 1669, 342, 316, 1176, 7121, 2051, 1155, 340, 16867, 23743, 991, 18176, 741, 197, 1370, 1669, 2126, 2271, 16055, 62100, 692, 18185, 1949, 5879, 93825, 31...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
func TestPeerCleanup(t *testing.T) { params := &BpPeerParams{timeout: 2 * time.Millisecond} peer := NewBpPeer( p2p.ID(tmrand.Str(12)), 0, 10, func(err error, _ p2p.ID) {}, params) peer.SetLogger(log.TestingLogger()) assert.Nil(t, peer.blockResponseTimer) peer.RequestSent(1) assert.NotNil(t, peer.blockResponseTimer) peer.Cleanup() checkByStoppingPeerTimer(t, peer, false) }
explode_data.jsonl/35428
{ "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, 30888, 67335, 1155, 353, 8840, 836, 8, 341, 25856, 1669, 609, 33, 79, 30888, 4870, 90, 14150, 25, 220, 17, 353, 882, 71482, 630, 197, 16537, 1669, 1532, 33, 79, 30888, 1006, 197, 3223, 17, 79, 9910, 64190, 11335, 27318, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestRuntimeValueLocationStack_takeStealTargetFromUsedRegister(t *testing.T) { s := newRuntimeValueLocationStack() intReg := unreservedGeneralPurposeRegisters[0] intLocation := &runtimeValueLocation{register: intReg} floatReg := unreservedVectorRegisters[0] floatLocation := &runtimeValueLocation{register: floatReg} s.push(intLocation) s.push(floatLocation) // Take for float. target, ok := s.takeStealTargetFromUsedRegister(registerTypeVector) require.True(t, ok) require.Equal(t, floatLocation, target) // Take for ints. target, ok = s.takeStealTargetFromUsedRegister(registerTypeGeneralPurpose) require.True(t, ok) require.Equal(t, intLocation, target) // Pop float value. popped := s.pop() require.Equal(t, floatLocation, popped) // Now we cannot find the steal target. target, ok = s.takeStealTargetFromUsedRegister(registerTypeVector) require.False(t, ok) require.Nil(t, target) // Pop int value. popped = s.pop() require.Equal(t, intLocation, popped) // Now we cannot find the steal target. target, ok = s.takeStealTargetFromUsedRegister(registerTypeGeneralPurpose) require.False(t, ok) require.Nil(t, target) }
explode_data.jsonl/4605
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 381 }
[ 2830, 3393, 15123, 1130, 4707, 4336, 73261, 20903, 278, 6397, 3830, 22743, 8690, 1155, 353, 8840, 836, 8, 341, 1903, 1669, 501, 15123, 1130, 4707, 4336, 741, 2084, 3477, 1669, 650, 51102, 15415, 74033, 92078, 58, 15, 921, 2084, 4707, 16...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestOpenShiftClusterStaticValidateConsoleProfile(t *testing.T) { commonTests := []*validateTest{ { name: "valid", }, { name: "console url invalid", modify: func(oc *OpenShiftCluster) { oc.Properties.ConsoleProfile.URL = "\x00" }, wantErr: "400: InvalidParameter: properties.consoleProfile.url: The provided console URL '\x00' is invalid.", }, } createTests := []*validateTest{ { name: "empty console url valid", modify: func(oc *OpenShiftCluster) { oc.Properties.ConsoleProfile.URL = "" }, }, } runTests(t, testModeCreate, createTests) runTests(t, testModeCreate, commonTests) runTests(t, testModeUpdate, commonTests) }
explode_data.jsonl/39080
{ "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, 5002, 24841, 28678, 11690, 17926, 12372, 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, 25, 330, 53...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestNewKoolRun(t *testing.T) { k := NewKoolRun() if _, ok := k.DefaultKoolService.out.(*shell.DefaultOutputWriter); !ok { t.Errorf("unexpected shell.OutputWriter on default KoolRun instance") } if _, ok := k.DefaultKoolService.exiter.(*shell.DefaultExiter); !ok { t.Errorf("unexpected shell.Exiter on default KoolRun instance") } if _, ok := k.DefaultKoolService.in.(*shell.DefaultInputReader); !ok { t.Errorf("unexpected shell.InputReader on default KoolRun instance") } if _, ok := k.parser.(*parser.DefaultParser); !ok { t.Errorf("unexpected parser.Parser on default KoolRun instance") } }
explode_data.jsonl/60851
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 219 }
[ 2830, 3393, 3564, 42, 1749, 6727, 1155, 353, 8840, 836, 8, 341, 16463, 1669, 1532, 42, 1749, 6727, 2822, 743, 8358, 5394, 1669, 595, 13275, 42, 1749, 1860, 2532, 41399, 21384, 13275, 5097, 6492, 1215, 753, 562, 341, 197, 3244, 13080, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
5
func TestExprCond(t *testing.T) { b := Select("id").From("table1").Where(expr{sql: "a=? OR b=?", args: []interface{}{1, 2}}).Where(Or(Eq{"c": 3}, Eq{"d": 4})) sql, args, err := b.ToSQL() assert.NoError(t, err) assert.EqualValues(t, "table1", b.TableName()) assert.EqualValues(t, "SELECT id FROM table1 WHERE (a=? OR b=?) AND (c=? OR d=?)", sql) assert.EqualValues(t, []interface{}{1, 2, 3, 4}, args) }
explode_data.jsonl/63969
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 176 }
[ 2830, 3393, 16041, 49696, 1155, 353, 8840, 836, 8, 341, 2233, 1669, 8427, 445, 307, 1827, 3830, 445, 2005, 16, 1827, 9064, 34322, 90, 3544, 25, 330, 64, 19884, 2726, 293, 87873, 2827, 25, 3056, 4970, 6257, 90, 16, 11, 220, 17, 3417,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestRawTokenAltEncodingNoConverter(t *testing.T) { d := NewDecoder(strings.NewReader(testInputAltEncoding)) token, err := d.RawToken() if token == nil { t.Fatalf("expected a token on first RawToken call") } if err != nil { t.Fatal(err) } token, err = d.RawToken() if token != nil { t.Errorf("expected a nil token; got %#v", token) } if err == nil { t.Fatalf("expected an error on second RawToken call") } const encoding = "x-testing-uppercase" if !strings.Contains(err.Error(), encoding) { t.Errorf("expected error to contain %q; got error: %v", encoding, err) } }
explode_data.jsonl/48610
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 229 }
[ 2830, 3393, 20015, 3323, 26017, 14690, 2753, 14920, 1155, 353, 8840, 836, 8, 341, 2698, 1669, 1532, 20732, 51442, 68587, 8623, 2505, 26017, 14690, 1171, 43947, 11, 1848, 1669, 294, 50575, 3323, 741, 743, 3950, 621, 2092, 341, 197, 3244, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestDroppedMessagesOnSendToQueueSub(t *testing.T) { opts := GetDefaultOptions() opts.MaxMsgs = 3 s := runServerWithOpts(t, opts, nil) defer s.Shutdown() sc := NewDefaultConnection(t) defer sc.Close() // Produce 1 message if err := sc.Publish("foo", []byte("hello")); err != nil { t.Fatalf("Unexpected error on publish: %v", err) } // Start a queue subscriber, it should receive the message ch := make(chan bool) blocked := make(chan bool) if _, err := sc.QueueSubscribe("foo", "bar", func(m *stan.Msg) { ch <- true // Block <-blocked m.Ack() }, stan.MaxInflight(1), stan.DeliverAllAvailable()); err != nil { t.Fatalf("Unexpected error on subscribe: %v", err) } // Wait for message if err := Wait(ch); err != nil { t.Fatal("Did not get our message") } // Send messages 2, 3, 4 and 5. Messages 1 and 2 should be dropped. for i := 2; i <= 5; i++ { if err := sc.Publish("foo", []byte("hello")); err != nil { t.Fatalf("Unexpected error on publish: %v", err) } } // Start another member, it should receive messages 3, 4 and 5 expectedSeq := uint64(3) good := 0 cb := func(m *stan.Msg) { if m.Sequence == expectedSeq { good++ if good == 3 { ch <- true } } expectedSeq++ } if _, err := sc.QueueSubscribe("foo", "bar", cb, stan.DeliverAllAvailable()); err != nil { t.Fatalf("Unexpected error on subscribe: %v", err) } // Wait for messages: if err := Wait(ch); err != nil { t.Fatal("Did not get our messages") } // Unlock first member close(blocked) }
explode_data.jsonl/23095
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 592 }
[ 2830, 3393, 35, 41716, 15820, 1925, 11505, 1249, 7554, 3136, 1155, 353, 8840, 836, 8, 341, 64734, 1669, 2126, 3675, 3798, 741, 64734, 14535, 6611, 82, 284, 220, 18, 198, 1903, 1669, 1598, 5475, 2354, 43451, 1155, 11, 12185, 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 TestBuildEvent(t *testing.T) { t.Run("all fields", func(t *testing.T) { e := testEvent() e.TargetPath = "link_target" e.Info.SID = "S-123-4" e.Info.Owner = "beats" e.Info.Group = "staff" e.Info.SetUID = true e.Info.Origin = []string{"google.com"} fields := buildMetricbeatEvent(e, false).MetricSetFields assert.Equal(t, testEventTime, e.Timestamp) assertHasKey(t, fields, "event.action") assertHasKey(t, fields, "event.kind") assertHasKey(t, fields, "event.category") assertHasKey(t, fields, "event.type") assertHasKey(t, fields, "file.path") assertHasKey(t, fields, "file.extension") assertHasKey(t, fields, "file.target_path") assertHasKey(t, fields, "file.inode") assertHasKey(t, fields, "file.uid") assertHasKey(t, fields, "file.owner") assertHasKey(t, fields, "file.group") assertHasKey(t, fields, "file.size") assertHasKey(t, fields, "file.mtime") assertHasKey(t, fields, "file.ctime") assertHasKey(t, fields, "file.type") assertHasKey(t, fields, "file.setuid") assertHasKey(t, fields, "file.setgid") assertHasKey(t, fields, "file.origin") if runtime.GOOS != "windows" { assertHasKey(t, fields, "file.gid") assertHasKey(t, fields, "file.mode") } assertHasKey(t, fields, "file.hash.sha1") assertHasKey(t, fields, "file.hash.sha256") // Remove in 8.x assertHasKey(t, fields, "hash.sha1") assertHasKey(t, fields, "hash.sha256") }) if runtime.GOOS == "windows" { t.Run("drive letter", func(t *testing.T) { e := testEvent() e.Path = "c:\\Documents" fields := buildMetricbeatEvent(e, false).MetricSetFields value, err := fields.GetValue("file.drive_letter") assert.NoError(t, err) assert.Equal(t, "C", value) }) t.Run("no drive letter", func(t *testing.T) { e := testEvent() e.Path = "\\\\remote\\Documents" fields := buildMetricbeatEvent(e, false).MetricSetFields _, err := fields.GetValue("file.drive_letter") assert.Error(t, err) }) } t.Run("ecs categorization", func(t *testing.T) { e := testEvent() e.Action = ConfigChange fields := buildMetricbeatEvent(e, false).MetricSetFields types, err := fields.GetValue("event.type") if err != nil { t.Fatal(err) } ecsTypes, ok := types.([]string) assert.True(t, ok) assert.Equal(t, []string{"change"}, ecsTypes) e.Action = Action(Created | Updated | Deleted) fields = buildMetricbeatEvent(e, false).MetricSetFields types, err = fields.GetValue("event.type") if err != nil { t.Fatal(err) } ecsTypes, ok = types.([]string) assert.True(t, ok) assert.Equal(t, []string{"change", "creation", "deletion"}, ecsTypes) }) t.Run("no setuid/setgid", func(t *testing.T) { e := testEvent() e.Info.SetGID = false fields := buildMetricbeatEvent(e, false).MetricSetFields _, err := fields.GetValue("file.setuid") assert.Error(t, err) _, err = fields.GetValue("file.setgid") assert.Error(t, err) }) t.Run("setgid set", func(t *testing.T) { e := testEvent() fields := buildMetricbeatEvent(e, false).MetricSetFields _, err := fields.GetValue("file.setuid") assert.Error(t, err) setgid, err := fields.GetValue("file.setgid") if err != nil { t.Fatal(err) } flag, ok := setgid.(bool) assert.True(t, ok) assert.True(t, flag) }) t.Run("setuid set", func(t *testing.T) { e := testEvent() e.Info.SetUID = true e.Info.SetGID = false fields := buildMetricbeatEvent(e, false).MetricSetFields _, err := fields.GetValue("file.setgid") assert.Error(t, err) setgid, err := fields.GetValue("file.setuid") if err != nil { t.Fatal(err) } flag, ok := setgid.(bool) assert.True(t, ok) assert.True(t, flag) }) t.Run("setuid and setgid set", func(t *testing.T) { e := testEvent() e.Info.SetUID = true fields := buildMetricbeatEvent(e, false).MetricSetFields setuid, err := fields.GetValue("file.setgid") if err != nil { t.Fatal(err) } flag, ok := setuid.(bool) assert.True(t, ok) assert.True(t, flag) setgid, err := fields.GetValue("file.setuid") if err != nil { t.Fatal(err) } flag, ok = setgid.(bool) assert.True(t, ok) assert.True(t, flag) }) }
explode_data.jsonl/66370
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1770 }
[ 2830, 3393, 11066, 1556, 1155, 353, 8840, 836, 8, 341, 3244, 16708, 445, 541, 5043, 497, 2915, 1155, 353, 8840, 836, 8, 341, 197, 7727, 1669, 1273, 1556, 741, 197, 7727, 35016, 1820, 284, 330, 2080, 11123, 698, 197, 7727, 20132, 808, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestCreatePipelineVersion(t *testing.T) { store := NewFakeClientManagerOrFatal(util.NewFakeTimeForEpoch()) manager := NewResourceManager(store) // Create a pipeline before versions. _, err := manager.CreatePipeline("p", "", []byte(testWorkflow.ToStringForStore())) assert.Nil(t, err) // Create a version under the above pipeline. pipelineStore, ok := store.pipelineStore.(*storage.PipelineStore) assert.True(t, ok) pipelineStore.SetUUIDGenerator(util.NewFakeUUIDGeneratorOrFatal(FakeUUIDOne, nil)) version, err := manager.CreatePipelineVersion( &api.PipelineVersion{ Name: "p_v", ResourceReferences: []*api.ResourceReference{ &api.ResourceReference{ Key: &api.ResourceKey{ Id: DefaultFakeUUID, Type: api.ResourceType_PIPELINE, }, Relationship: api.Relationship_OWNER, }, }, }, []byte(testWorkflow.ToStringForStore()), true) assert.Nil(t, err) defer store.Close() pipelineVersionExpected := &model.PipelineVersion{ UUID: FakeUUIDOne, CreatedAtInSec: 2, Name: "p_v", Parameters: "[{\"name\":\"param1\"}]", Status: model.PipelineVersionReady, PipelineId: DefaultFakeUUID, } assert.Equal(t, pipelineVersionExpected, version) }
explode_data.jsonl/77070
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 507 }
[ 2830, 3393, 4021, 34656, 5637, 1155, 353, 8840, 836, 8, 341, 57279, 1669, 1532, 52317, 2959, 2043, 2195, 62396, 67811, 7121, 52317, 1462, 2461, 44338, 2398, 92272, 1669, 1532, 32498, 31200, 692, 197, 322, 4230, 264, 15301, 1573, 10795, 62...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestRenterFileListLocalPath(t *testing.T) { if testing.Short() { t.SkipNow() } rt, err := newRenterTester(t.Name()) if err != nil { t.Fatal(err) } defer rt.Close() id := rt.renter.mu.Lock() f := newTestingFile() f.name = "testname" rt.renter.files["test"] = f rt.renter.tracking[f.name] = trackedFile{ RepairPath: "TestPath", } rt.renter.mu.Unlock(id) files := rt.renter.FileList() if len(files) != 1 { t.Fatal("wrong number of files, got", len(files), "wanted one") } if files[0].LocalPath != "TestPath" { t.Fatal("file had wrong LocalPath: got", files[0].LocalPath, "wanted TestPath") } }
explode_data.jsonl/68232
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 269 }
[ 2830, 3393, 49, 1950, 1703, 852, 7319, 1820, 1155, 353, 8840, 836, 8, 341, 743, 7497, 55958, 368, 341, 197, 3244, 57776, 7039, 741, 197, 532, 55060, 11, 1848, 1669, 501, 49, 1950, 58699, 1155, 2967, 2398, 743, 1848, 961, 2092, 341, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
5
func TestFillClusterFromClusterModel(t *testing.T) { cases := []struct { name string input cluster.ClusterModel expected pke.PKEOnAzureCluster }{ { name: "empty cluster model", input: cluster.ClusterModel{}, expected: pke.PKEOnAzureCluster{}, }, } for _, tc := range cases { t.Run(tc.name, func(t *testing.T) { var result pke.PKEOnAzureCluster fillClusterFromClusterModel(&result, tc.input) assert.DeepEqual(t, tc.expected, result) }) } }
explode_data.jsonl/52605
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 213 }
[ 2830, 3393, 14449, 28678, 3830, 28678, 1712, 1155, 353, 8840, 836, 8, 341, 1444, 2264, 1669, 3056, 1235, 341, 197, 11609, 257, 914, 198, 197, 22427, 262, 10652, 72883, 1712, 198, 197, 42400, 281, 440, 1069, 3390, 1925, 78107, 28678, 198...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func Test_BuildCommand(t *testing.T) { // Given tool := givenTool() cmd := "command" args := []string{"arg1", "arg2"} expectedCommand := append([]string{"java", "-jar", tool.path, cmd}, args...) // When actualCommand := tool.BuildCommand(cmd, args...).GetCmd().Args // Then require.Equal(t, expectedCommand, actualCommand) }
explode_data.jsonl/58094
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 112 }
[ 2830, 3393, 96686, 4062, 1155, 353, 8840, 836, 8, 341, 197, 322, 16246, 198, 197, 14172, 1669, 2661, 7740, 741, 25920, 1669, 330, 5631, 698, 31215, 1669, 3056, 917, 4913, 858, 16, 497, 330, 858, 17, 16707, 42400, 4062, 1669, 8737, 105...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestRoundTrip(t *testing.T) { var record ff.Number var recordTripped ff.Number ff.NewNumber(&record) buf1, err := json.Marshal(&record) if err != nil { t.Fatalf("Marshal: %v", err) } err = json.Unmarshal(buf1, &recordTripped) if err != nil { t.Fatalf("Unmarshal: %v", err) } good := reflect.DeepEqual(record, recordTripped) if !good { t.Fatalf("Expected: %v\n Got: %v", record, recordTripped) } }
explode_data.jsonl/15654
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 178 }
[ 2830, 3393, 27497, 56352, 1155, 353, 8840, 836, 8, 341, 2405, 3255, 25539, 31182, 198, 2405, 3255, 21884, 6924, 25539, 31182, 198, 67399, 7121, 2833, 2099, 8548, 692, 26398, 16, 11, 1848, 1669, 2951, 37271, 2099, 8548, 340, 743, 1848, 9...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
4
func TestNewClient(t *testing.T) { t.Run("no arg for with port", func(t *testing.T) { _, err := NewClientWithPort("") assert.Error(t, err) }) t.Run("no arg for with address", func(t *testing.T) { _, err := NewClientWithAddress("") assert.Error(t, err) }) t.Run("new client closed with empty token", func(t *testing.T) { c, err := NewClient() assert.NoError(t, err) defer c.Close() c.WithAuthToken("") }) t.Run("new client with trace ID", func(t *testing.T) { c, err := NewClient() assert.NoError(t, err) defer c.Close() ctx := c.WithTraceID(context.Background(), "") _ = c.WithTraceID(ctx, "test") }) }
explode_data.jsonl/61830
{ "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, 3564, 2959, 1155, 353, 8840, 836, 8, 341, 3244, 16708, 445, 2152, 1392, 369, 448, 2635, 497, 2915, 1155, 353, 8840, 836, 8, 341, 197, 197, 6878, 1848, 1669, 1532, 2959, 2354, 7084, 31764, 197, 6948, 6141, 1155, 11, 1848, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestRepository_Create(t *testing.T) { ctx := context.Background() mr, err := miniredis.Run() require.NoError(t, err) rc := redis.NewClient(&redis.Options{ Addr: mr.Addr(), }) repo := otpreporedis.New(rc) t.Run("Create New", func(t *testing.T) { entity := otpsvc.Entity{ UUID: uuid.New().String(), PhoneNumber: "+1234567890", PinCode: "1234", ExpiresAt: time.Now().Add(time.Minute * 5), } err = repo.Create(ctx, entity) assert.NoError(t, err) }) t.Run("Create Duplicate", func(t *testing.T) { entity := otpsvc.Entity{ UUID: uuid.New().String(), PhoneNumber: "+1234567890", PinCode: "1234", ExpiresAt: time.Now().Add(time.Minute * 5), } err = repo.Create(ctx, entity) assert.NoError(t, err) err = repo.Create(ctx, entity) assert.Error(t, err) }) }
explode_data.jsonl/684
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 382 }
[ 2830, 3393, 4624, 34325, 1155, 353, 8840, 836, 8, 341, 20985, 1669, 2266, 19047, 2822, 2109, 81, 11, 1848, 1669, 1308, 2690, 285, 16708, 741, 17957, 35699, 1155, 11, 1848, 692, 30295, 1669, 20870, 7121, 2959, 2099, 21748, 22179, 515, 19...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestBadTokenOnRefreshHandler(t *testing.T) { // the middleware to test authMiddleware, _ := New(&GinJWTMiddleware{ Realm: "test zone", Key: key, Timeout: time.Hour, Authenticator: defaultAuthenticator, }) handler := ginHandler(authMiddleware) r := gofight.New() r.GET("/auth/refresh_token"). SetHeader(gofight.H{ "Authorization": "Bearer " + "BadToken", }). Run(handler, func(r gofight.HTTPResponse, rq gofight.HTTPRequest) { assert.Equal(t, http.StatusUnauthorized, r.Code) }) }
explode_data.jsonl/64454
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 230 }
[ 2830, 3393, 17082, 3323, 1925, 14567, 3050, 1155, 353, 8840, 836, 8, 341, 197, 322, 279, 29679, 311, 1273, 198, 78011, 24684, 11, 716, 1669, 1532, 2099, 38, 258, 55172, 24684, 515, 197, 197, 64290, 25, 260, 330, 1944, 10143, 756, 197,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestReadRecord(t *testing.T) { t.Run("Comm", testComm) t.Run("Exit", testExit) t.Run("CPUWideSwitch", testCPUWideSwitch) t.Run("SampleGetpid", testSampleGetpid) t.Run("SampleGetpidConcurrent", testSampleGetpidConcurrent) t.Run("SampleTracepointStack", testSampleTracepointStack) t.Run("RedirectedOutput", testRedirectedOutput) // TODO(acln): a test for the case when a record straddles the head // of the ring is missing. See readRawRecordNonblock. }
explode_data.jsonl/72985
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 161 }
[ 2830, 3393, 4418, 6471, 1155, 353, 8840, 836, 8, 341, 3244, 16708, 445, 17977, 497, 1273, 17977, 340, 3244, 16708, 445, 15339, 497, 1273, 15339, 340, 3244, 16708, 445, 31615, 60970, 16837, 497, 1273, 31615, 60970, 16837, 340, 3244, 16708,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestDeleteEventSubscriptionOnFabrics(t *testing.T) { // Intializing plugin token evcommon.Token.Tokens = map[string]string{ "CFM": "token", } config.SetUpMockConfig(t) defer func() { err := common.TruncateDB(common.InMemory) if err != nil { t.Fatalf("error: %v", err) } err = common.TruncateDB(common.OnDisk) if err != nil { t.Fatalf("error: %v", err) } }() mockTargetandPlugin(t) mockFabricsData(t) storeTestEventDetails(t) pc := PluginContact{ Auth: mockIsAuthorized, ContactClient: mockContactClient, } // positive test case with basic auth type req := &eventsproto.EventRequest{ SessionToken: "validToken", EventSubscriptionID: "71de0110-c35a-4859-984c-072d6c5a32d9", } resp := pc.DeleteEventSubscriptionsDetails(req) assert.Equal(t, http.StatusOK, int(resp.StatusCode), "Status Code should be StatusOK") }
explode_data.jsonl/18098
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 358 }
[ 2830, 3393, 6435, 1556, 33402, 1925, 52167, 6198, 1155, 353, 8840, 836, 8, 341, 197, 322, 1333, 530, 4849, 9006, 3950, 198, 74837, 5464, 32277, 836, 9713, 284, 2415, 14032, 30953, 515, 197, 197, 1, 9650, 44, 788, 330, 5839, 756, 197, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestInjectVolumeIntoDeployment(t *testing.T) { tests := []struct { name string podSpec *corev1.PodSpec volumes []corev1.Volume expected *corev1.PodSpec }{ { // The PodSpec defines no Volumes and is injected with an empty list. // Expected: The PodSpec's VolumeMount list remains empty. name: "EmptyVolumeMounts", podSpec: &corev1.PodSpec{ Containers: []corev1.Container{ }, }, volumes: []corev1.Volume{}, expected: &corev1.PodSpec{ Containers: []corev1.Container{ }, }, }, { // The PodSpec does not define any Volumes and is injected with a VolumeMount. // Expected: The PodSpec contains the Volume that was injected. name: "WithContainerHasNoVolumeMounts", podSpec: &corev1.PodSpec{ }, volumes: defaultVolumes, expected:&corev1.PodSpec{ Volumes: defaultVolumes, }, }, { // The PodSpec contains a single VolumeMount and is injected with an empty Volume list // Expected: The PodSpec's Volume list is unchanged. name: "WithContainerHasVolumeMountsEmptyDefaults", podSpec: &corev1.PodSpec{ Volumes: defaultVolumes, }, volumes: []corev1.Volume{}, expected: &corev1.PodSpec{ Volumes: defaultVolumes, }, }, { // The PodSpec defines single Volume and is injected with a new Volume. // Expected: The PodSpec contains both Volumes. name: "WithContainerHasNonOverlappingEnvVar", podSpec: &corev1.PodSpec{ Volumes: []corev1.Volume{ corev1.Volume{ Name: "bar", VolumeSource: corev1.VolumeSource{}, }, }, }, volumes: defaultVolumes, expected: &corev1.PodSpec{ Volumes: []corev1.Volume{ corev1.Volume{ Name: "bar", VolumeSource: corev1.VolumeSource{}, }, corev1.Volume{ Name: "foo", VolumeSource: corev1.VolumeSource{}, }, }, }, }, { // The PodSpec defines a single Volume that is injected with a Volume that has a name conflict. // Expected: The existing Volume is overwritten. name: "WithContainerHasOverlappingVolumeMounts", podSpec: &corev1.PodSpec{ Volumes: []corev1.Volume{ corev1.Volume{ Name: "foo", }, }, }, volumes: defaultVolumes, expected: &corev1.PodSpec{ Volumes: []corev1.Volume{ corev1.Volume{ Name: "foo", VolumeSource: corev1.VolumeSource{}, }, }, }, }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { overrides.InjectVolumesIntoDeployment(tt.podSpec, tt.volumes) podSpecWant := tt.expected podSpecGot := tt.podSpec assert.Equal(t, podSpecWant, podSpecGot) }) } }
explode_data.jsonl/4029
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1202 }
[ 2830, 3393, 13738, 18902, 26591, 75286, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 3056, 1235, 341, 197, 11609, 257, 914, 198, 197, 3223, 347, 8327, 220, 353, 98645, 16, 88823, 8327, 198, 197, 5195, 19705, 256, 3056, 98645, 16, 79106, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestCheckoutFailureWrongRevision(t *testing.T) { testRepo := newTestRepo(t) defer testRepo.cleanup(t) err := testRepo.sut.Checkout("wrong") require.NotNil(t, err) require.Contains(t, err.Error(), "checkout wrong did not succeed") }
explode_data.jsonl/14014
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 94 }
[ 2830, 3393, 55145, 17507, 29185, 33602, 1155, 353, 8840, 836, 8, 341, 18185, 25243, 1669, 501, 2271, 25243, 1155, 340, 16867, 1273, 25243, 87689, 1155, 692, 9859, 1669, 1273, 25243, 514, 332, 10600, 411, 445, 34870, 1138, 17957, 93882, 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
func TestGetPipelinePath(t *testing.T) { testCases := []struct { pipelinePath string count int }{ { pipelinePath: "../../module/postgresql/log/ingest/pipeline.json", count: 1, }, { pipelinePath: "../../module/postgresql/log/ingest", count: 1, }, { pipelinePath: "postgresql/log", count: 1, }, } for _, tc := range testCases { paths, err := getPipelinePath(tc.pipelinePath, "../../module") if err != nil { t.Fatal(err) } assert.Equal(t, tc.count, len(paths)) } testCasesError := []string{ "non-such-pipeline.json", "no/such/path/to/pipeline", "not/module", } for _, p := range testCasesError { paths, err := getPipelinePath(p, "./module") if err == nil { t.Fatal(paths) } assert.Equal(t, 0, len(paths)) } }
explode_data.jsonl/70582
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 400 }
[ 2830, 3393, 1949, 34656, 1820, 1155, 353, 8840, 836, 8, 341, 18185, 37302, 1669, 3056, 1235, 341, 197, 3223, 8790, 1820, 914, 198, 197, 18032, 286, 526, 198, 197, 59403, 197, 197, 515, 298, 3223, 8790, 1820, 25, 10208, 4352, 29996, 81...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestDeleteStream(t *testing.T) { defer cleanupStorage(t) // Use a central NATS server. ns := natsdTest.RunDefaultServer() defer ns.Shutdown() // Configure server. s1Config := getTestConfig("a", true, 5050) s1 := runServerWithConfig(t, s1Config) defer s1.Stop() getMetadataLeader(t, 10*time.Second, s1) client, err := lift.Connect([]string{"localhost:5050"}) require.NoError(t, err) defer client.Close() err = client.DeleteStream(context.Background(), "foo") require.Error(t, err) err = client.CreateStream(context.Background(), "foo", "foo", lift.Partitions(3)) require.NoError(t, err) stream := s1.metadata.GetStream("foo") require.NotNil(t, stream) err = client.DeleteStream(context.Background(), "foo") require.NoError(t, err) stream = s1.metadata.GetStream("foo") require.Nil(t, stream) err = client.CreateStream(context.Background(), "foo", "foo", lift.Partitions(3)) require.NoError(t, err) }
explode_data.jsonl/34465
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 338 }
[ 2830, 3393, 6435, 3027, 1155, 353, 8840, 836, 8, 341, 16867, 21290, 5793, 1155, 692, 197, 322, 5443, 264, 8622, 18248, 50, 3538, 624, 84041, 1669, 308, 1862, 67, 2271, 16708, 3675, 5475, 741, 16867, 12268, 10849, 18452, 2822, 197, 322, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestDisableOnRemove(t *testing.T) { path, _ := fileutils.FindDir("tests") tarData, err := ioutil.ReadFile(filepath.Join(path, "testplugin.tar.gz")) require.NoError(t, err) testCases := []struct { Description string Upgrade bool }{ { "Remove without upgrading", false, }, { "Remove after upgrading", true, }, } for _, tc := range testCases { t.Run(tc.Description, func(t *testing.T) { th := Setup().InitBasic() defer th.TearDown() th.App.UpdateConfig(func(cfg *model.Config) { *cfg.PluginSettings.Enable = true *cfg.PluginSettings.EnableUploads = true }) // Upload manifest, resp := th.SystemAdminClient.UploadPlugin(bytes.NewReader(tarData)) CheckNoError(t, resp) require.Equal(t, "testplugin", manifest.Id) // Check initial status pluginsResp, resp := th.SystemAdminClient.GetPlugins() CheckNoError(t, resp) require.Empty(t, pluginsResp.Active) require.Equal(t, pluginsResp.Inactive, []*model.PluginInfo{{ Manifest: *manifest, }}) // Enable plugin ok, resp := th.SystemAdminClient.EnablePlugin(manifest.Id) CheckNoError(t, resp) require.True(t, ok) // Confirm enabled status pluginsResp, resp = th.SystemAdminClient.GetPlugins() CheckNoError(t, resp) require.Empty(t, pluginsResp.Inactive) require.Equal(t, pluginsResp.Active, []*model.PluginInfo{{ Manifest: *manifest, }}) if tc.Upgrade { // Upgrade manifest, resp = th.SystemAdminClient.UploadPluginForced(bytes.NewReader(tarData)) CheckNoError(t, resp) require.Equal(t, "testplugin", manifest.Id) // Plugin should remain active pluginsResp, resp = th.SystemAdminClient.GetPlugins() CheckNoError(t, resp) require.Empty(t, pluginsResp.Inactive) require.Equal(t, pluginsResp.Active, []*model.PluginInfo{{ Manifest: *manifest, }}) } // Remove plugin ok, resp = th.SystemAdminClient.RemovePlugin(manifest.Id) CheckNoError(t, resp) require.True(t, ok) // Plugin should have no status pluginsResp, resp = th.SystemAdminClient.GetPlugins() CheckNoError(t, resp) require.Empty(t, pluginsResp.Inactive) require.Empty(t, pluginsResp.Active) // Upload same plugin manifest, resp = th.SystemAdminClient.UploadPlugin(bytes.NewReader(tarData)) CheckNoError(t, resp) require.Equal(t, "testplugin", manifest.Id) // Plugin should be inactive pluginsResp, resp = th.SystemAdminClient.GetPlugins() CheckNoError(t, resp) require.Empty(t, pluginsResp.Active) require.Equal(t, pluginsResp.Inactive, []*model.PluginInfo{{ Manifest: *manifest, }}) // Clean up ok, resp = th.SystemAdminClient.RemovePlugin(manifest.Id) CheckNoError(t, resp) require.True(t, ok) }) } }
explode_data.jsonl/27536
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1097 }
[ 2830, 3393, 25479, 1925, 13021, 1155, 353, 8840, 836, 8, 341, 26781, 11, 716, 1669, 1034, 6031, 9998, 6184, 445, 23841, 1138, 3244, 277, 1043, 11, 1848, 1669, 43144, 78976, 34793, 22363, 5581, 11, 330, 1944, 9138, 28048, 20963, 5455, 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 TestMultiRequestBatchWithFwdAndReverseRequests(t *testing.T) { defer leaktest.AfterTest(t)() s, _ := startNoSplitMergeServer(t) ctx := context.TODO() defer s.Stopper().Stop(ctx) db := s.DB() if err := setupMultipleRanges(ctx, db, "a", "b"); err != nil { t.Fatal(err) } b := &client.Batch{} b.Header.MaxSpanRequestKeys = 100 b.Scan("a", "b") b.ReverseScan("a", "b") if err := db.Run(ctx, b); !testutils.IsError( err, "batch with limit contains both forward and reverse scans", ) { t.Fatal(err) } }
explode_data.jsonl/36458
{ "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, 20358, 1900, 21074, 2354, 37, 6377, 3036, 45695, 35295, 1155, 353, 8840, 836, 8, 341, 16867, 23352, 1944, 36892, 2271, 1155, 8, 741, 1903, 11, 716, 1669, 1191, 2753, 20193, 52096, 5475, 1155, 340, 20985, 1669, 2266, 90988, 7...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestParsePSIStats(t *testing.T) { t.Run("unknown measurement type", func(t *testing.T) { raw := "nonesense haha test=fake" _, err := parsePSIStats("fake", strings.NewReader(raw)) if err != nil { t.Error("unknown measurement type must be ignored") } }) t.Run("malformed measurement", func(t *testing.T) { t.Run("some", func(t *testing.T) { raw := `some avg10=0.10 avg60=2.00 avg300=3.85 total=oops full avg10=0.20 avg60=3.00 avg300=teddy total=25` stats, err := parsePSIStats("fake", strings.NewReader(raw)) if err == nil { t.Error("a malformed line must result in a parse error") } if stats.Some != nil || stats.Full != nil { t.Error("a parse error must result in a nil PSILine") } }) t.Run("full", func(t *testing.T) { raw := `some avg10=0.10 avg60=2.00 avg300=3.85 total=1 full avg10=0.20 avg60=3.00 avg300=test total=25` stats, err := parsePSIStats("fake", strings.NewReader(raw)) t.Log(err) t.Log(stats) if err == nil { t.Error("a malformed line must result in a parse error") } if stats.Some != nil || stats.Full != nil { t.Error("a parse error must result in a nil PSILine") } }) }) }
explode_data.jsonl/23014
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 488 }
[ 2830, 3393, 14463, 5012, 40, 16635, 1155, 353, 8840, 836, 8, 341, 3244, 16708, 445, 16088, 18662, 943, 497, 2915, 1155, 353, 8840, 836, 8, 341, 197, 76559, 1669, 330, 77, 3154, 1117, 62350, 1273, 18111, 726, 698, 197, 197, 6878, 1848,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestGetActiveOrders(t *testing.T) { t.Parallel() pair, err := currency.NewPairFromString("BTC_USDT") if err != nil { t.Error(err) } var getOrdersRequest = order.GetOrdersRequest{ Type: order.AnyType, Pairs: currency.Pairs{pair}, AssetType: asset.Spot, } _, err = b.GetActiveOrders(context.Background(), &getOrdersRequest) switch { case areTestAPIKeysSet() && err != nil: t.Error("GetActiveOrders() error", err) case !areTestAPIKeysSet() && err == nil && !mockTests: t.Error("GetActiveOrders() expecting an error when no keys are set") case mockTests && err != nil: t.Error("Mock GetActiveOrders() error", err) } }
explode_data.jsonl/76659
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 252 }
[ 2830, 3393, 1949, 5728, 24898, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 741, 3223, 1310, 11, 1848, 1669, 11413, 7121, 12443, 44491, 445, 59118, 13467, 10599, 1138, 743, 1848, 961, 2092, 341, 197, 3244, 6141, 3964, 340, 197, 532,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestIamUserPolicySupplier_Resources(t *testing.T) { cases := []struct { test string dirName string mocks func(client *mocks.FakeIAM) err error }{ { test: "no iam user (no policy)", dirName: "iam_user_policy_empty", mocks: func(client *mocks.FakeIAM) { client.On("ListUsersPages", mock.Anything, mock.Anything).Return(nil) client.On("ListUserPoliciesPages", mock.Anything, mock.Anything).Panic("ListUsersPoliciesPages should not be called when there is no user") }, err: nil, }, { test: "iam multiples users multiple policies", dirName: "iam_user_policy_multiple", mocks: func(client *mocks.FakeIAM) { client.On("ListUsersPages", &iam.ListUsersInput{}, mock.MatchedBy(func(callback func(res *iam.ListUsersOutput, lastPage bool) bool) bool { callback(&iam.ListUsersOutput{Users: []*iam.User{ { UserName: aws.String("loadbalancer"), }, { UserName: aws.String("loadbalancer2"), }, }}, false) callback(&iam.ListUsersOutput{Users: []*iam.User{ { UserName: aws.String("loadbalancer3"), }, }}, true) return true })).Return(nil).Once() shouldSkipfirst := false shouldSkipSecond := false shouldSkipThird := false client.On("ListUserPoliciesPages", &iam.ListUserPoliciesInput{ UserName: aws.String("loadbalancer"), }, mock.MatchedBy(func(callback func(res *iam.ListUserPoliciesOutput, lastPage bool) bool) bool { if shouldSkipfirst { return false } callback(&iam.ListUserPoliciesOutput{PolicyNames: []*string{ aws.String("test"), aws.String("test2"), aws.String("test3"), }}, false) callback(&iam.ListUserPoliciesOutput{PolicyNames: []*string{ aws.String("test4"), }}, true) shouldSkipfirst = true return true })).Return(nil).Once() client.On("ListUserPoliciesPages", &iam.ListUserPoliciesInput{ UserName: aws.String("loadbalancer2"), }, mock.MatchedBy(func(callback func(res *iam.ListUserPoliciesOutput, lastPage bool) bool) bool { if shouldSkipSecond { return false } callback(&iam.ListUserPoliciesOutput{PolicyNames: []*string{ aws.String("test2"), aws.String("test22"), aws.String("test23"), }}, false) callback(&iam.ListUserPoliciesOutput{PolicyNames: []*string{ aws.String("test24"), }}, true) shouldSkipSecond = true return true })).Return(nil).Once() client.On("ListUserPoliciesPages", &iam.ListUserPoliciesInput{ UserName: aws.String("loadbalancer3"), }, mock.MatchedBy(func(callback func(res *iam.ListUserPoliciesOutput, lastPage bool) bool) bool { if shouldSkipThird { return false } callback(&iam.ListUserPoliciesOutput{PolicyNames: []*string{ aws.String("test3"), aws.String("test32"), aws.String("test33"), }}, false) callback(&iam.ListUserPoliciesOutput{PolicyNames: []*string{ aws.String("test34"), }}, true) shouldSkipThird = true return true })).Return(nil).Once() }, err: nil, }, { test: "cannot list iam user (no policy)", dirName: "iam_user_policy_empty", mocks: func(client *mocks.FakeIAM) { client.On("ListUsersPages", mock.Anything, mock.Anything).Return(awserr.NewRequestFailure(nil, 403, "")) }, err: remoteerror.NewResourceEnumerationErrorWithType(awserr.NewRequestFailure(nil, 403, ""), resourceaws.AwsIamUserPolicyResourceType, resourceaws.AwsIamUserResourceType), }, { test: "cannot list user policy", dirName: "iam_user_policy_empty", mocks: func(client *mocks.FakeIAM) { client.On("ListUsersPages", &iam.ListUsersInput{}, mock.MatchedBy(func(callback func(res *iam.ListUsersOutput, lastPage bool) bool) bool { callback(&iam.ListUsersOutput{Users: []*iam.User{ { UserName: aws.String("loadbalancer"), }, { UserName: aws.String("loadbalancer2"), }, }}, true) return true })).Return(nil).Once() client.On("ListUserPoliciesPages", mock.Anything, mock.Anything).Return(awserr.NewRequestFailure(nil, 403, "")) }, err: remoteerror.NewResourceEnumerationError(awserr.NewRequestFailure(nil, 403, ""), resourceaws.AwsIamUserPolicyResourceType), }, } for _, c := range cases { shouldUpdate := c.dirName == *goldenfile.Update providerLibrary := terraform.NewProviderLibrary() supplierLibrary := resource.NewSupplierLibrary() if shouldUpdate { provider, err := InitTestAwsProvider(providerLibrary) if err != nil { t.Fatal(err) } supplierLibrary.AddSupplier(NewIamUserPolicySupplier(provider)) } t.Run(c.test, func(tt *testing.T) { fakeIam := mocks.FakeIAM{} c.mocks(&fakeIam) provider := mocks2.NewMockedGoldenTFProvider(c.dirName, providerLibrary.Provider(terraform.AWS), shouldUpdate) deserializer := awsdeserializer.NewIamUserPolicyDeserializer() s := &IamUserPolicySupplier{ provider, deserializer, &fakeIam, terraform.NewParallelResourceReader(parallel.NewParallelRunner(context.TODO(), 10)), } got, err := s.Resources() assert.Equal(tt, c.err, err) mock.AssertExpectationsForObjects(tt) test.CtyTestDiff(got, c.dirName, provider, deserializer, shouldUpdate, t) }) } }
explode_data.jsonl/69080
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 2375 }
[ 2830, 3393, 40, 309, 1474, 13825, 46167, 62, 11277, 1155, 353, 8840, 836, 8, 1476, 1444, 2264, 1669, 3056, 1235, 341, 197, 18185, 262, 914, 198, 197, 48532, 675, 914, 198, 197, 2109, 25183, 256, 2915, 12805, 353, 16712, 82, 991, 726, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestResetPassword(t *testing.T) { th := Setup(t).InitBasic() defer th.TearDown() th.CheckCommand(t, "user", "password", th.BasicUser.Email, "password2") th.Client.Logout() th.BasicUser.Password = "password2" th.LoginBasic() }
explode_data.jsonl/57419
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 91 }
[ 2830, 3393, 14828, 4876, 1155, 353, 8840, 836, 8, 341, 70479, 1669, 18626, 1155, 568, 3803, 15944, 741, 16867, 270, 836, 682, 4454, 2822, 70479, 10600, 4062, 1155, 11, 330, 872, 497, 330, 3833, 497, 270, 48868, 1474, 24066, 11, 330, 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
func TestMsgEncDec(t *testing.T) { key, err := GenerateUser() if err != nil { t.Fatal(err) } var db testDB u := OpenUser(&db, key, tls.Certificate{Certificate: [][]byte{{}}}, nil) buf := make([]byte, 2048) rand.Read(buf) err = u.NewMessage(u.Address(), buf) if err != nil { t.Fatal(err) } message := u.decryptMessage(db.last) if message == nil || !bytes.Equal(message.Content, buf) { t.Fatal("decrypt error") } }
explode_data.jsonl/27817
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 183 }
[ 2830, 3393, 6611, 7408, 4900, 1155, 353, 8840, 836, 8, 341, 23634, 11, 1848, 1669, 19813, 1474, 741, 743, 1848, 961, 2092, 341, 197, 3244, 26133, 3964, 340, 197, 532, 2405, 2927, 1273, 3506, 198, 10676, 1669, 5264, 1474, 2099, 1999, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestGetBidTypeForMissingBidTypeExt(t *testing.T) { pubmaticExt := pubmaticBidExt{} actualBidTypeValue := getBidType(&pubmaticExt) // banner is the default bid type when no bidType key is present in the bid.ext if actualBidTypeValue != "banner" { t.Errorf("Expected Bid Type value was: banner, actual value is: %v", actualBidTypeValue) } }
explode_data.jsonl/77925
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 120 }
[ 2830, 3393, 1949, 65452, 929, 2461, 25080, 65452, 929, 6756, 1155, 353, 8840, 836, 8, 341, 62529, 37244, 6756, 1669, 6675, 37244, 65452, 6756, 16094, 88814, 65452, 929, 1130, 1669, 633, 65452, 929, 2099, 9585, 37244, 6756, 340, 197, 322, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestTransportResponseHeaderTimeout(t *testing.T) { defer afterTest(t) if testing.Short() { t.Skip("skipping timeout test in -short mode") } inHandler := make(chan bool, 1) mux := NewServeMux() mux.HandleFunc("/fast", func(w ResponseWriter, r *Request) { inHandler <- true }) mux.HandleFunc("/slow", func(w ResponseWriter, r *Request) { inHandler <- true time.Sleep(2 * time.Second) }) ts := httptest.NewServer(mux) defer ts.Close() tr := &Transport{ ResponseHeaderTimeout: 500 * time.Millisecond, } defer tr.CloseIdleConnections() c := &Client{Transport: tr} tests := []struct { path string want int wantErr string }{ {path: "/fast", want: 200}, {path: "/slow", wantErr: "timeout awaiting response headers"}, {path: "/fast", want: 200}, } for i, tt := range tests { res, err := c.Get(ts.URL + tt.path) select { case <-inHandler: case <-time.After(5 * time.Second): t.Errorf("never entered handler for test index %d, %s", i, tt.path) continue } if err != nil { uerr, ok := err.(*url.Error) if !ok { t.Errorf("error is not an url.Error; got: %#v", err) continue } nerr, ok := uerr.Err.(net.Error) if !ok { t.Errorf("error does not satisfy net.Error interface; got: %#v", err) continue } if !nerr.Timeout() { t.Errorf("want timeout error; got: %q", nerr) continue } if strings.Contains(err.Error(), tt.wantErr) { continue } t.Errorf("%d. unexpected error: %v", i, err) continue } if tt.wantErr != "" { t.Errorf("%d. no error. expected error: %v", i, tt.wantErr) continue } if res.StatusCode != tt.want { t.Errorf("%d for path %q status = %d; want %d", i, tt.path, res.StatusCode, tt.want) } } }
explode_data.jsonl/4899
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 761 }
[ 2830, 3393, 27560, 2582, 4047, 7636, 1155, 353, 8840, 836, 8, 341, 16867, 1283, 2271, 1155, 340, 743, 7497, 55958, 368, 341, 197, 3244, 57776, 445, 4886, 5654, 9632, 1273, 304, 481, 8676, 3856, 1138, 197, 532, 17430, 3050, 1669, 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...
1
func TestValidateVirtualService(t *testing.T) { testCases := []struct { name string in proto.Message valid bool }{ {name: "simple", in: &networking.VirtualService{ Hosts: []string{"foo.bar"}, Http: []*networking.HTTPRoute{{ Route: []*networking.HTTPRouteDestination{{ Destination: &networking.Destination{Host: "foo.baz"}, }}, }}, }, valid: true}, {name: "duplicate hosts", in: &networking.VirtualService{ Hosts: []string{"*.foo.bar", "*.bar"}, Http: []*networking.HTTPRoute{{ Route: []*networking.HTTPRouteDestination{{ Destination: &networking.Destination{Host: "foo.baz"}, }}, }}, }, valid: false}, {name: "no hosts", in: &networking.VirtualService{ Hosts: nil, Http: []*networking.HTTPRoute{{ Route: []*networking.HTTPRouteDestination{{ Destination: &networking.Destination{Host: "foo.baz"}, }}, }}, }, valid: false}, {name: "bad host", in: &networking.VirtualService{ Hosts: []string{"foo.ba!r"}, Http: []*networking.HTTPRoute{{ Route: []*networking.HTTPRouteDestination{{ Destination: &networking.Destination{Host: "foo.baz"}, }}, }}, }, valid: false}, {name: "no tcp or http routing", in: &networking.VirtualService{ Hosts: []string{"foo.bar"}, }, valid: false}, {name: "bad gateway", in: &networking.VirtualService{ Hosts: []string{"foo.bar"}, Gateways: []string{"b@dgateway"}, Http: []*networking.HTTPRoute{{ Route: []*networking.HTTPRouteDestination{{ Destination: &networking.Destination{Host: "foo.baz"}, }}, }}, }, valid: false}, {name: "FQDN for gateway", in: &networking.VirtualService{ Hosts: []string{"foo.bar"}, Gateways: []string{"gateway.example.com"}, Http: []*networking.HTTPRoute{{ Route: []*networking.HTTPRouteDestination{{ Destination: &networking.Destination{Host: "foo.baz"}, }}, }}, }, valid: true}, {name: "wildcard for mesh gateway", in: &networking.VirtualService{ Hosts: []string{"*"}, Http: []*networking.HTTPRoute{{ Route: []*networking.HTTPRouteDestination{{ Destination: &networking.Destination{Host: "foo.baz"}, }}, }}, }, valid: false}, {name: "wildcard for non-mesh gateway", in: &networking.VirtualService{ Hosts: []string{"*"}, Gateways: []string{"somegateway"}, Http: []*networking.HTTPRoute{{ Route: []*networking.HTTPRouteDestination{{ Destination: &networking.Destination{Host: "foo.baz"}, }}, }}, }, valid: true}, {name: "valid removeResponseHeaders", in: &networking.VirtualService{ Hosts: []string{"foo.bar"}, Http: []*networking.HTTPRoute{{ Route: []*networking.HTTPRouteDestination{{ Destination: &networking.Destination{Host: "foo.baz"}, }}, RemoveResponseHeaders: []string{"unwantedHeader", "secretStuff"}, }}, }, valid: true}, } for _, tc := range testCases { t.Run(tc.name, func(t *testing.T) { if err := ValidateVirtualService("", "", tc.in); (err == nil) != tc.valid { t.Fatalf("got valid=%v but wanted valid=%v: %v", err == nil, tc.valid, err) } }) } }
explode_data.jsonl/56921
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1314 }
[ 2830, 3393, 17926, 33026, 1860, 1155, 353, 8840, 836, 8, 341, 18185, 37302, 1669, 3056, 1235, 341, 197, 11609, 220, 914, 198, 197, 17430, 262, 18433, 8472, 198, 197, 56322, 1807, 198, 197, 59403, 197, 197, 47006, 25, 330, 22944, 497, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestRedirect(t *testing.T) { router := New().WithPrefix("/test/prefix") w := httptest.NewRecorder() r, err := http.NewRequest("GET", "http://localhost:9090/foo", nil) if err != nil { t.Fatalf("Error building test request: %s", err) } router.Redirect(w, r, "/some/endpoint", http.StatusFound) if w.Code != http.StatusFound { t.Fatalf("Unexpected redirect status code: got %d, want %d", w.Code, http.StatusFound) } want := "/test/prefix/some/endpoint" got := w.Header()["Location"][0] if want != got { t.Fatalf("Unexpected redirect location: got %s, want %s", got, want) } }
explode_data.jsonl/65124
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 227 }
[ 2830, 3393, 17725, 1155, 353, 8840, 836, 8, 341, 67009, 1669, 1532, 1005, 2354, 14335, 4283, 1944, 4322, 5060, 1138, 6692, 1669, 54320, 70334, 7121, 47023, 741, 7000, 11, 1848, 1669, 1758, 75274, 445, 3806, 497, 330, 1254, 1110, 8301, 2...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
4
func TestCfgRendering(t *testing.T) { i := NewGrafanaIni(&testGrafanaConfig) config := map[string][]string{} config = i.cfgRendering(config) testConfig := map[string][]string{ "rendering": { "server_url = server_url", "callback_url = callback_url", "concurrent_render_request_limit = 10", }, } require.Equal(t, config, testConfig) }
explode_data.jsonl/24526
{ "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, 42467, 36056, 1155, 353, 8840, 836, 8, 341, 8230, 1669, 1532, 38, 15453, 3362, 43325, 2099, 1944, 38, 15453, 3362, 2648, 340, 25873, 1669, 2415, 14032, 45725, 917, 16094, 25873, 284, 600, 30481, 36056, 8754, 340, 18185, 2648, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_Reload(t *testing.T) { t.Parallel() a := NewTestAgent(t.Name(), ` acl_enforce_version_8 = false services = [ { name = "redis" } ] watches = [ { datacenter = "dc1" type = "key" key = "test" handler = "true" } ] limits = { rpc_rate=1 rpc_max_burst=100 } `) defer a.Shutdown() if a.State.Service("redis") == nil { t.Fatal("missing redis service") } cfg2 := TestConfig(config.Source{ Name: "reload", Format: "hcl", Data: ` data_dir = "` + a.Config.DataDir + `" node_id = "` + string(a.Config.NodeID) + `" node_name = "` + a.Config.NodeName + `" acl_enforce_version_8 = false services = [ { name = "redis-reloaded" } ] limits = { rpc_rate=2 rpc_max_burst=200 } `, }) if err := a.ReloadConfig(cfg2); err != nil { t.Fatalf("got error %v want nil", err) } if a.State.Service("redis-reloaded") == nil { t.Fatal("missing redis-reloaded service") } if a.config.RPCRateLimit != 2 { t.Fatalf("RPC rate not set correctly. Got %v. Want 2", a.config.RPCRateLimit) } if a.config.RPCMaxBurst != 200 { t.Fatalf("RPC max burst not set correctly. Got %v. Want 200", a.config.RPCMaxBurst) } for _, wp := range a.watchPlans { if !wp.IsStopped() { t.Fatalf("Reloading configs should stop watch plans of the previous configuration") } } }
explode_data.jsonl/33597
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 666 }
[ 2830, 3393, 16810, 2568, 76897, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 741, 11323, 1669, 1532, 2271, 16810, 1155, 2967, 1507, 22074, 197, 11323, 564, 6205, 8833, 9438, 62, 23, 284, 895, 198, 197, 1903, 2161, 284, 2278, 298, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
8
func TestFilterEnvironment(t *testing.T) { assert := assert.New(t) rancher := NewRancherMockClient() environment := client.Project{Name: "Default"} assert.True(filterEnvironment(rancher, environment, "*")) assert.True(filterEnvironment(rancher, environment, "Default")) assert.True(filterEnvironment(rancher, environment, "Default,prod,dev,test")) assert.True(filterEnvironment(rancher, environment, "-*-Default,Default,prod,dev,test")) environment = client.Project{Name: "myuser-Default"} assert.False(filterEnvironment(rancher, environment, "Default,prod,dev,test")) assert.False(filterEnvironment(rancher, environment, "-*-Default,Default,prod,dev,test")) }
explode_data.jsonl/48863
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 211 }
[ 2830, 3393, 5632, 12723, 1155, 353, 8840, 836, 8, 1476, 6948, 1669, 2060, 7121, 1155, 340, 7000, 3497, 261, 1669, 1532, 49, 3497, 261, 11571, 2959, 2822, 197, 23294, 1669, 2943, 30944, 63121, 25, 330, 3675, 16707, 6948, 32443, 19704, 12...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestEvent_WriteTo(t *testing.T) { t.Parallel() e := Message{} e.AppendText("This is an example\nOf an event", "") e.AppendData([]byte("raw bytes here")) e.Comment("This test should pass") e.AppendText("Important data\nImportant again\r\rVery important\r\n") e.SetName("test_event") e.SetRetry(time.Second * 5) e.SetID(MustEventID("example_id")) output := "id: example_id\nevent: test_event\nretry: 5000\ndata: This is an example\ndata: Of an event\ndata: raw bytes here\n: This test should pass\ndata: Important data\ndata: Important again\rdata: \rdata: Very important\r\n\n" expectedWritten := int64(len(output)) w := &strings.Builder{} written, _ := e.WriteTo(w) require.Equal(t, output, w.String(), "event written incorrectly") require.Equal(t, expectedWritten, written, "written byte count wrong") }
explode_data.jsonl/47327
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 297 }
[ 2830, 3393, 1556, 31825, 1249, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 2822, 7727, 1669, 4856, 16094, 7727, 95713, 445, 1986, 374, 458, 3110, 1699, 2124, 458, 1538, 497, 14676, 7727, 8982, 1043, 10556, 3782, 445, 1041, 5820, 15...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestLoadTokenFailsBadPath(t *testing.T) { _, err := LoadToken("/tmp/this_file_should_never_exist_really") expectedSubstring := "failed to open file" if err == nil || !strings.Contains(err.Error(), expectedSubstring) { t.Fatalf("azure: failed to get correct error expected(%s) actual(%s)", expectedSubstring, err.Error()) } }
explode_data.jsonl/14992
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 119 }
[ 2830, 3393, 5879, 3323, 37, 6209, 17082, 1820, 1155, 353, 8840, 836, 8, 972, 197, 6878, 1848, 1669, 8893, 3323, 4283, 5173, 14, 574, 2458, 43378, 13925, 423, 35906, 1288, 745, 6060, 42400, 59075, 1669, 330, 16091, 311, 1787, 1034, 5031,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestTypeString(t *testing.T) { var tokens = []struct { tt Type str string }{ {ILLEGAL, "ILLEGAL"}, {EOF, "EOF"}, {COMMENT, "COMMENT"}, {IDENT, "IDENT"}, {NUMBER, "NUMBER"}, {FLOAT, "FLOAT"}, {BOOL, "BOOL"}, {STRING, "STRING"}, {LBRACK, "LBRACK"}, {LBRACE, "LBRACE"}, {COMMA, "COMMA"}, {PERIOD, "PERIOD"}, {RBRACK, "RBRACK"}, {RBRACE, "RBRACE"}, {ASSIGN, "ASSIGN"}, {ADD, "ADD"}, {SUB, "SUB"}, } for _, token := range tokens { if token.tt.String() != token.str { t.Errorf("want: %q got:%q\n", token.str, token.tt) } } }
explode_data.jsonl/51686
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 297 }
[ 2830, 3393, 929, 703, 1155, 353, 8840, 836, 8, 341, 2405, 11211, 284, 3056, 1235, 341, 197, 3244, 83, 220, 3990, 198, 197, 11355, 914, 198, 197, 59403, 197, 197, 90, 1715, 75234, 11, 330, 1715, 75234, 7115, 197, 197, 90, 23483, 11, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestSqlite3_DropConstraintStmtHook(t *testing.T) { a := assert.New(t, false) suite := test.NewSuite(a, test.Sqlite3) defer suite.Close() suite.ForEach(func(t *test.Driver) { db := t.DB for _, query := range sqlite3CreateTable { _, err := db.Exec(query) t.NotError(err) } defer clearSqlite3CreateTable(t, db) testDialectDropConstraintStmtHook(t) }) }
explode_data.jsonl/11876
{ "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, 8269, 632, 18, 1557, 887, 17890, 31063, 31679, 1155, 353, 8840, 836, 8, 341, 11323, 1669, 2060, 7121, 1155, 11, 895, 692, 96572, 1669, 1273, 7121, 28000, 2877, 11, 1273, 23005, 632, 18, 340, 16867, 16182, 10421, 2822, 96572,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestHostLengthMax(t *testing.T) { store, clean := realtikvtest.CreateMockStoreAndSetup(t) defer clean() tk := testkit.NewTestKit(t, store) tk.MustExec("use test") host1 := strings.Repeat("a", 65) host2 := strings.Repeat("a", 256) tk.MustExec(fmt.Sprintf(`CREATE USER 'abcddfjakldfjaldddds'@'%s'`, host1)) tk.MustGetErrMsg(fmt.Sprintf(`CREATE USER 'abcddfjakldfjaldddds'@'%s'`, host2), "[ddl:1470]String 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' is too long for host name (should be no longer than 255)") }
explode_data.jsonl/5765
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 219 }
[ 2830, 3393, 9296, 4373, 5974, 1155, 353, 8840, 836, 8, 341, 57279, 11, 4240, 1669, 1931, 83, 1579, 85, 1944, 7251, 11571, 6093, 3036, 21821, 1155, 340, 16867, 4240, 2822, 3244, 74, 1669, 1273, 8226, 7121, 2271, 7695, 1155, 11, 3553, 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 TestTracingBuildExecutor(t *testing.T) { ctrl, ctx := gomock.WithContext(context.Background(), t) // Creating an instance of TracingBuildExecutor should cause it // to create a new Tracer object. baseBuildExecutor := mock.NewMockBuildExecutor(ctrl) tracerProvider := mock.NewMockTracerProvider(ctrl) tracer := mock.NewMockTracer(ctrl) tracerProvider.EXPECT().Tracer("github.com/buildbarn/bb-remote-execution/pkg/builder").Return(tracer) buildExecutor := builder.NewTracingBuildExecutor(baseBuildExecutor, tracerProvider) // Example execution request, response and execution state updates. request := &remoteworker.DesiredState_Executing{} response := &remoteexecution.ExecuteResponse{} fetchingInputs := &remoteworker.CurrentState_Executing{ ExecutionState: &remoteworker.CurrentState_Executing_FetchingInputs{}, } running := &remoteworker.CurrentState_Executing{ ExecutionState: &remoteworker.CurrentState_Executing_Running{}, } uploadingOutputs := &remoteworker.CurrentState_Executing{ ExecutionState: &remoteworker.CurrentState_Executing_UploadingOutputs{}, } // Call Execute() against the TracingBuildExecutor. The call // should be forwarded to the underlying BuildExecutor in // literal form, and execution state updates should also be // forwarded back to the caller. A trace span should be created // that contains events for each of the execution state updates. ctxWithTracing := mock.NewMockContext(ctrl) filePool := mock.NewMockFilePool(ctrl) instanceName := digest.MustNewInstanceName("hello") baseBuildExecutor.EXPECT().Execute(ctxWithTracing, filePool, instanceName, testutil.EqProto(t, request), gomock.Any()).DoAndReturn( func(ctx context.Context, filePool re_filesystem.FilePool, instanceName digest.InstanceName, request *remoteworker.DesiredState_Executing, executionStateUpdates chan<- *remoteworker.CurrentState_Executing) *remoteexecution.ExecuteResponse { executionStateUpdates <- fetchingInputs executionStateUpdates <- running executionStateUpdates <- uploadingOutputs return response }) span := mock.NewMockSpan(ctrl) tracer.EXPECT().Start(ctx, "BuildExecutor.Execute").Return(ctxWithTracing, span) span.EXPECT().AddEvent("FetchingInputs") span.EXPECT().AddEvent("Running") span.EXPECT().AddEvent("UploadingOutputs") span.EXPECT().End() executionStateUpdates := make(chan *remoteworker.CurrentState_Executing, 3) testutil.RequireEqualProto(t, response, buildExecutor.Execute(ctx, filePool, instanceName, request, executionStateUpdates)) testutil.RequireEqualProto(t, fetchingInputs, <-executionStateUpdates) testutil.RequireEqualProto(t, running, <-executionStateUpdates) testutil.RequireEqualProto(t, uploadingOutputs, <-executionStateUpdates) }
explode_data.jsonl/22964
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 869 }
[ 2830, 3393, 1282, 4527, 11066, 25255, 1155, 353, 8840, 836, 8, 341, 84381, 11, 5635, 1669, 342, 316, 1176, 26124, 1972, 5378, 19047, 1507, 259, 692, 197, 322, 31306, 458, 2867, 315, 1163, 4527, 11066, 25255, 1265, 5240, 432, 198, 197, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestModifyIsolatedPositionMargin(t *testing.T) { t.Parallel() if !areTestAPIKeysSet() || !canManipulateRealOrders { t.Skip("skipping test: api keys not set or canManipulateRealOrders set to false") } _, err := b.ModifyIsolatedPositionMargin(context.Background(), currency.NewPairWithDelimiter("BTCUSD", "PERP", "_"), "BOTH", "add", 5) if err != nil { t.Error(err) } }
explode_data.jsonl/76631
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 143 }
[ 2830, 3393, 44427, 3872, 80519, 3812, 21681, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 741, 743, 753, 546, 2271, 7082, 8850, 1649, 368, 1369, 753, 4814, 92876, 6334, 12768, 24898, 341, 197, 3244, 57776, 445, 4886, 5654, 1273, 25,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
4
func TestTLSClientDisabled(t *testing.T) { th := &testHandler{} authServer := NewAuthServerStatic("", "", 0) authServer.entries["user1"] = []*AuthServerStaticEntry{{ Password: "password1", }} defer authServer.close() // Create the listener, so we can get its host. // Below, we are enabling --ssl-verify-server-cert, which adds // a check that the common name of the certificate matches the // server host name we connect to. l, err := NewListener("tcp", "127.0.0.1:", authServer, th, 0, 0, false) require.NoError(t, err) defer l.Close() host := l.Addr().(*net.TCPAddr).IP.String() port := l.Addr().(*net.TCPAddr).Port // Create the certs. root, err := os.MkdirTemp("", "TestTLSServer") require.NoError(t, err) defer os.RemoveAll(root) tlstest.CreateCA(root) tlstest.CreateSignedCert(root, tlstest.CA, "01", "server", host) tlstest.CreateSignedCert(root, tlstest.CA, "02", "client", "Client Cert") // Create the server with TLS config. serverConfig, err := vttls.ServerConfig( path.Join(root, "server-cert.pem"), path.Join(root, "server-key.pem"), "", "", "", tls.VersionTLS12) require.NoError(t, err) l.TLSConfig.Store(serverConfig) var wg sync.WaitGroup wg.Add(1) go func(l *Listener) { wg.Done() l.Accept() }(l) // This is ensure the listener is called wg.Wait() // Sleep so that the Accept function is called as well.' time.Sleep(3 * time.Second) // Setup the right parameters. params := &ConnParams{ Host: host, Port: port, Uname: "user1", Pass: "password1", SslMode: vttls.Disabled, } conn, err := Connect(context.Background(), params) require.NoError(t, err) // make sure this went through SSL results, err := conn.ExecuteFetch("ssl echo", 1000, true) require.NoError(t, err) assert.Equal(t, "OFF", results.Rows[0][0].ToString()) if conn != nil { conn.Close() } }
explode_data.jsonl/53765
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 732 }
[ 2830, 3393, 45439, 2959, 25907, 1155, 353, 8840, 836, 8, 341, 70479, 1669, 609, 1944, 3050, 31483, 78011, 5475, 1669, 1532, 5087, 5475, 11690, 19814, 7342, 220, 15, 340, 78011, 5475, 35754, 1183, 872, 16, 1341, 284, 29838, 5087, 5475, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestSetUndeliveredEventsFlag(t *testing.T) { common.SetUpMockConfig() defer func() { err := common.TruncateDB(common.OnDisk) if err != nil { t.Fatalf("error: %v", err) } }() if cerr := SetUndeliveredEventsFlag("destination"); cerr != nil { t.Errorf("Error while making set undelivered events flag: %v\n", cerr.Error()) } }
explode_data.jsonl/49422
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 136 }
[ 2830, 3393, 1649, 19957, 301, 43056, 7900, 12135, 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, 34...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestExtractHost(t *testing.T) { fixtures := map[string]string{ "localhost:8085": "localhost", "marmalade": "marmalade", } for header, expected := range fixtures { host := extractHost(header) if host != expected { t.Fatalf("%s != %s", host, expected) } } }
explode_data.jsonl/66377
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 115 }
[ 2830, 3393, 28959, 9296, 1155, 353, 8840, 836, 8, 341, 1166, 941, 18513, 1669, 2415, 14032, 30953, 515, 197, 197, 1, 8301, 25, 23, 15, 23, 20, 788, 330, 8301, 756, 197, 197, 1, 76, 2178, 278, 1021, 788, 414, 330, 76, 2178, 278, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestWeb(t *testing.T) { gomega.RegisterFailHandler(ginkgo.Fail) junitReporter := reporters.NewJUnitReporter(fmt.Sprintf("web-%d-test-result.xml", config.GinkgoConfig.ParallelNode)) ginkgo.RunSpecsWithDefaultAndCustomReporters(t, "Web Suite", []ginkgo.Reporter{junitReporter}) }
explode_data.jsonl/59912
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 107 }
[ 2830, 3393, 5981, 1155, 353, 8840, 836, 8, 341, 3174, 32696, 19983, 19524, 3050, 3268, 766, 3346, 57243, 340, 12428, 3843, 52766, 1669, 19040, 7121, 56248, 52766, 28197, 17305, 445, 2911, 11069, 67, 16839, 53838, 9028, 497, 2193, 1224, 76...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestFilterFailsToProcess(t *testing.T) { // Arrange config := getConfigWithFilters(t, []string{"filter.1"}) mFilter1 := createMockFilterWithReturn(errors.New("failed to handle")) loader := loaderstest.MockLoader{} loader.On("LoadFilter", "filter.1").Return(mFilter1, nil) mModule1 := createMockHandlerWithReturn(&modules.Response{}, nil) loader.On("LoadModule", "module.auth.1").Return(mModule1, nil) server, err := New(config, zap.NewNop(), &loader) assert.Equal(t, err, nil) isReady := server.StartAndWait() require.True(t, isReady, "failed to initialize the server") // Act packet := radius.New(radius.CodeAccessRequest, []byte(config.Secret)) client := radius.Client{ Retry: 0, } go func() { port := config.Listeners[0].Extra["Port"].(int) client.Exchange( context.Background(), packet, fmt.Sprintf(":%d", port), ) }() time.Sleep(time.Millisecond * 500) // Assert assert.NotNil(t, server) mFilter1.AssertExpectations(t) }
explode_data.jsonl/59974
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 367 }
[ 2830, 3393, 5632, 37, 6209, 1249, 7423, 1155, 353, 8840, 836, 8, 341, 197, 322, 40580, 198, 25873, 1669, 66763, 2354, 28351, 1155, 11, 3056, 917, 4913, 5315, 13, 16, 1, 8824, 2109, 5632, 16, 1669, 1855, 11571, 5632, 2354, 5598, 38881,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestDialTimeout(t *testing.T) { // Cannot use t.Parallel - modifies global hooks. origTestHookDialChannel := testHookDialChannel defer func() { testHookDialChannel = origTestHookDialChannel }() defer sw.Set(socktest.FilterConnect, nil) for i, tt := range dialTimeoutTests { switch runtime.GOOS { case "plan9", "windows": testHookDialChannel = func() { time.Sleep(tt.guard) } if runtime.GOOS == "plan9" { break } fallthrough default: sw.Set(socktest.FilterConnect, func(so *socktest.Status) (socktest.AfterFilter, error) { time.Sleep(tt.guard) return nil, errTimedout }) } ch := make(chan error) d := Dialer{Timeout: tt.timeout} if tt.delta != 0 { d.Deadline = time.Now().Add(tt.delta) } max := time.NewTimer(tt.max) defer max.Stop() go func() { // This dial never starts to send any TCP SYN // segment because of above socket filter and // test hook. c, err := d.Dial("tcp", "127.0.0.1:0") if err == nil { err = fmt.Errorf("unexpectedly established: tcp:%s->%s", c.LocalAddr(), c.RemoteAddr()) c.Close() } ch <- err }() select { case <-max.C: t.Fatalf("#%d: Dial didn't return in an expected time", i) case err := <-ch: if perr := parseDialError(err); perr != nil { t.Errorf("#%d: %v", i, perr) } if nerr, ok := err.(Error); !ok || !nerr.Timeout() { t.Fatalf("#%d: %v", i, err) } } } }
explode_data.jsonl/77444
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 618 }
[ 2830, 3393, 35, 530, 7636, 1155, 353, 8840, 836, 8, 341, 197, 322, 34655, 990, 259, 41288, 7957, 481, 82949, 3644, 29677, 624, 197, 4670, 2271, 31679, 35, 530, 9629, 1669, 1273, 31679, 35, 530, 9629, 198, 16867, 2915, 368, 314, 1273, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestTabletServerHealthzNotConnected(t *testing.T) { db, tsv := setupTabletServerTest(t, "") defer tsv.StopService() defer db.Close() tsv.sm.SetServingType(topodatapb.TabletType_PRIMARY, time.Time{}, StateNotConnected, "test disconnected") req, err := http.NewRequest("GET", "/healthz", nil) if err != nil { t.Fatal(err) } rr := httptest.NewRecorder() handler := http.HandlerFunc(tsv.healthzHandler) handler.ServeHTTP(rr, req) expectedCode := http.StatusInternalServerError if status := rr.Code; status != expectedCode { t.Errorf("handler returned wrong status code: got %v want %v", status, expectedCode) } expected := "500 internal server error: vttablet is not serving\n" if rr.Body.String() != expected { t.Errorf("handler returned unexpected body: got %v want %v", rr.Body.String(), expected) } }
explode_data.jsonl/79979
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 302 }
[ 2830, 3393, 2556, 83, 5475, 14542, 89, 2623, 21146, 1155, 353, 8840, 836, 8, 341, 20939, 11, 259, 3492, 1669, 6505, 2556, 83, 5475, 2271, 1155, 11, 14676, 16867, 259, 3492, 30213, 1860, 741, 16867, 2927, 10421, 2822, 57441, 85, 22552, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestRoutes_jwksRoutes(t *testing.T) { t.Parallel() m := mux.NewRouter() jwksRoutes(m, nil) cases := []struct { req *http.Request vars map[string]string }{ { req: httptest.NewRequest("GET", "/12345", nil), vars: map[string]string{"realm_id": "12345"}, }, } for _, tc := range cases { testRoute(t, m, tc.req, tc.vars) } }
explode_data.jsonl/41251
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 169 }
[ 2830, 3393, 26653, 5374, 86, 2787, 26653, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 2822, 2109, 1669, 59807, 7121, 9523, 741, 12428, 86, 2787, 26653, 1255, 11, 2092, 692, 1444, 2264, 1669, 3056, 1235, 341, 197, 24395, 220, 353, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestImagesReadyStep(t *testing.T) { links := []api.StepLink{someStepLink("ONE")} irs := ImagesReadyStep(links) specification := stepExpectation{ name: "[images]", requires: links, creates: []api.StepLink{api.ImagesReadyLink()}, provides: providesExpectation{ params: nil, }, inputs: inputsExpectation{ values: nil, err: false, }, } execSpecification := executionExpectation{ prerun: doneExpectation{ value: true, err: false, }, runError: false, postrun: doneExpectation{ value: true, err: false, }, } examineStep(t, irs, specification) executeStep(t, irs, execSpecification, nil) }
explode_data.jsonl/75500
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 269 }
[ 2830, 3393, 14228, 19202, 8304, 1155, 353, 8840, 836, 8, 341, 197, 15880, 1669, 3056, 2068, 68402, 3939, 90, 14689, 8304, 3939, 445, 5225, 42132, 197, 16838, 1669, 11779, 19202, 8304, 95851, 340, 98100, 2404, 1669, 3019, 17536, 367, 515, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestEngine_InvalidTag(t *testing.T) { engine := NewDefaultEngine() defer engine.Close() engine.MustOpen() pt := models.MustNewPoint( "cpu", models.NewTags(map[string]string{"\xf2": "cpu"}), map[string]interface{}{"value": 1.0}, time.Unix(1, 2), ) if err := engine.WritePoints(context.TODO(), []models.Point{pt}); err == nil { fmt.Println(pt.String()) t.Fatal("expected error: got nil") } pt = models.MustNewPoint( "cpu", models.NewTags(map[string]string{"foo": "bar", string([]byte{0, 255, 188, 233}): "value"}), map[string]interface{}{"value": 1.0}, time.Unix(1, 2), ) if err := engine.WritePoints(context.TODO(), []models.Point{pt}); err == nil { t.Fatalf("unexpected error: %v", err) } }
explode_data.jsonl/5983
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 296 }
[ 2830, 3393, 4571, 62, 7928, 5668, 1155, 353, 8840, 836, 8, 341, 80118, 1669, 1532, 3675, 4571, 741, 16867, 4712, 10421, 741, 80118, 50463, 5002, 2822, 60796, 1669, 4119, 50463, 3564, 2609, 1006, 197, 197, 1, 16475, 756, 197, 19727, 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...
3
func TestWatchSucceedsWithoutArgs(t *testing.T) { _, s, closeFn := framework.RunAMaster(nil) defer closeFn() resp, err := http.Get(s.URL + "/api/v1/namespaces?watch=1") if err != nil { t.Fatalf("unexpected error getting experimental prefix: %v", err) } if resp.StatusCode != http.StatusOK { t.Fatalf("got status %v instead of 200 OK", resp.StatusCode) } resp.Body.Close() }
explode_data.jsonl/67590
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 148 }
[ 2830, 3393, 14247, 50, 29264, 16056, 411, 4117, 1155, 353, 8840, 836, 8, 341, 197, 6878, 274, 11, 3265, 24911, 1669, 12626, 16708, 1402, 2300, 27907, 340, 16867, 3265, 24911, 2822, 34653, 11, 1848, 1669, 1758, 2234, 1141, 20893, 488, 35...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestSelect_NamesInWhere(t *testing.T) { s := MustParseSelectStatement("select * from cpu where time > 23s AND (asdf = 'jkl' OR (foo = 'bar' AND baz = 'bar'))") a := s.NamesInWhere() if !reflect.DeepEqual(a, []string{"time", "asdf", "foo", "baz"}) { t.Fatalf("exp: time,asdf,foo,baz\ngot: %s\n", strings.Join(a, ",")) } }
explode_data.jsonl/24807
{ "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, 3379, 1604, 971, 641, 9064, 1155, 353, 8840, 836, 8, 341, 1903, 1669, 15465, 14463, 3379, 8636, 445, 1742, 353, 504, 17319, 1380, 882, 861, 220, 17, 18, 82, 3567, 320, 76615, 284, 364, 73, 10561, 6, 2726, 320, 7975, 284,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestFiltering(t *testing.T) { ctx := api.NewContext() mockMinionRegistry := registrytest.NewMinionRegistry([]string{"m1", "m2", "m3"}, api.NodeResources{}) healthy := HealthyRegistry{ delegate: mockMinionRegistry, client: &notMinion{minion: "m1"}, } expected := []string{"m1", "m2", "m3"} list, err := healthy.ListMinions(ctx) if err != nil { t.Errorf("unexpected error: %v", err) } expectedMinions := registrytest.MakeMinionList(expected, api.NodeResources{}) expectedMinions.Items[0].Status.Conditions = []api.NodeCondition{{Kind: api.NodeReady, Status: api.ConditionNone}} expectedMinions.Items[1].Status.Conditions = []api.NodeCondition{{Kind: api.NodeReady, Status: api.ConditionFull}} expectedMinions.Items[2].Status.Conditions = []api.NodeCondition{{Kind: api.NodeReady, Status: api.ConditionFull}} if !reflect.DeepEqual(list, expectedMinions) { t.Errorf("Expected %v, Got %v", expected, list) } minion, err := healthy.GetMinion(ctx, "m1") if err != nil { t.Errorf("unexpected error: %v", err) } if minion == nil { t.Errorf("Unexpected empty 'm1'") } }
explode_data.jsonl/23237
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 402 }
[ 2830, 3393, 5632, 287, 1155, 353, 8840, 836, 8, 341, 20985, 1669, 6330, 7121, 1972, 741, 77333, 6217, 290, 15603, 1669, 19424, 1944, 7121, 6217, 290, 15603, 10556, 917, 4913, 76, 16, 497, 330, 76, 17, 497, 330, 76, 18, 14345, 6330, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
5