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 TestAgent_ServiceMaintenance_Disable(t *testing.T) { t.Parallel() a := NewTestAgent(t.Name(), "") defer a.Shutdown() // Register the service service := &structs.NodeService{ ID: "test", Service: "test", } if err := a.AddService(service, nil, false, ""); err != nil { t.Fatalf("err: %v", err) } // Force the service into maintenance mode if err := a.EnableServiceMaintenance("test", "", ""); err != nil { t.Fatalf("err: %s", err) } // Leave maintenance mode req, _ := http.NewRequest("PUT", "/v1/agent/service/maintenance/test?enable=false", nil) resp := httptest.NewRecorder() if _, err := a.srv.AgentServiceMaintenance(resp, req); err != nil { t.Fatalf("err: %s", err) } if resp.Code != 200 { t.Fatalf("expected 200, got %d", resp.Code) } // Ensure the maintenance check was removed checkID := serviceMaintCheckID("test") if _, ok := a.State.Checks()[checkID]; ok { t.Fatalf("should have removed maintenance check") } }
explode_data.jsonl/33640
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 362 }
[ 2830, 3393, 16810, 52548, 92735, 45525, 480, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 741, 11323, 1669, 1532, 2271, 16810, 1155, 2967, 1507, 14676, 16867, 264, 10849, 18452, 2822, 197, 322, 8451, 279, 2473, 198, 52934, 1669, 609, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
6
func TestInjectClient(t *testing.T) { r := &reconciler{} orig := r.client n := fake.NewFakeClient() if orig == n { t.Errorf("Original and new clients are identical: %v", orig) } err := r.InjectClient(n) if err != nil { t.Errorf("Unexpected error injecting the client: %v", err) } if n != r.client { t.Errorf("Unexpected client. Expected: '%v'. Actual: '%v'", n, r.client) } }
explode_data.jsonl/7296
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 159 }
[ 2830, 3393, 13738, 2959, 1155, 353, 8840, 836, 8, 341, 7000, 1669, 609, 265, 40446, 5769, 16094, 197, 4670, 1669, 435, 6581, 198, 9038, 1669, 12418, 7121, 52317, 2959, 741, 743, 2713, 621, 308, 341, 197, 3244, 13080, 445, 18395, 323, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestStepClock(t *testing.T) { now := time.Now() step := time.Second clock := NewStepClock(now, step) N := 100 for i := 0; i < N; i++ { assert.Equal(t, now, clock()) now = now.Add(step) } }
explode_data.jsonl/8551
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 88 }
[ 2830, 3393, 8304, 26104, 1155, 353, 8840, 836, 8, 341, 80922, 1669, 882, 13244, 741, 77093, 1669, 882, 32435, 198, 84165, 1669, 1532, 8304, 26104, 32263, 11, 3019, 340, 18317, 1669, 220, 16, 15, 15, 198, 2023, 600, 1669, 220, 15, 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...
2
func TestQueryAccount(t *testing.T) { app, ctx := createTestApp(true) cdc := app.Codec() req := abci.RequestQuery{ Path: "", Data: []byte{}, } path := []string{types.QueryAccount} querier := keep.NewQuerier(app.AccountKeeper) bz, err := querier(ctx, []string{"other"}, req) require.Error(t, err) require.Nil(t, bz) req = abci.RequestQuery{ Path: fmt.Sprintf("custom/%s/%s", types.QuerierRoute, types.QueryAccount), Data: []byte{}, } res, err := querier(ctx, path, req) require.Error(t, err) require.Nil(t, res) req.Data = cdc.MustMarshalJSON(types.NewQueryAccountParams([]byte(""))) res, err = querier(ctx, path, req) require.Error(t, err) require.Nil(t, res) _, _, addr := types.KeyTestPubAddr() req.Data = cdc.MustMarshalJSON(types.NewQueryAccountParams(addr)) res, err = querier(ctx, path, req) require.Error(t, err) require.Nil(t, res) app.AccountKeeper.SetAccount(ctx, app.AccountKeeper.NewAccountWithAddress(ctx, addr)) res, err = querier(ctx, path, req) require.NoError(t, err) require.NotNil(t, res) res, err = querier(ctx, path, req) require.NoError(t, err) require.NotNil(t, res) var account exported.Account err2 := cdc.UnmarshalJSON(res, &account) require.Nil(t, err2) }
explode_data.jsonl/73025
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 506 }
[ 2830, 3393, 2859, 7365, 1155, 353, 8840, 836, 8, 341, 28236, 11, 5635, 1669, 1855, 2271, 2164, 3715, 340, 1444, 7628, 1669, 906, 20274, 66, 2822, 24395, 1669, 668, 5855, 9659, 2859, 515, 197, 69640, 25, 8324, 197, 40927, 25, 3056, 378...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestMPLS(t *testing.T) { p := gopacket.NewPacket(testMPLS, LinkTypeEthernet, testDecodeOptions) if p.ErrorLayer() != nil { t.Error("Failed to decode packet:", p.ErrorLayer().Error()) } checkLayers(p, []gopacket.LayerType{LayerTypeEthernet, LayerTypeMPLS, LayerTypeIPv4, LayerTypeICMPv4, gopacket.LayerTypePayload}, t) testSerialization(t, p, testMPLS) }
explode_data.jsonl/42262
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 145 }
[ 2830, 3393, 44, 2916, 50, 1155, 353, 8840, 836, 8, 341, 3223, 1669, 342, 453, 5709, 7121, 16679, 8623, 44, 2916, 50, 11, 5948, 929, 98006, 11, 1273, 32564, 3798, 340, 743, 281, 6141, 9188, 368, 961, 2092, 341, 197, 3244, 6141, 445, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestOnDeactivate(t *testing.T) { testAPI := &plugintest.API{} p := NewPlugin( config.BuildConfig{ Manifest: manifest, BuildHash: BuildHash, BuildHashShort: BuildHashShort, BuildDate: BuildDate, }, ) p.API = testAPI mm := pluginapi.NewClient(p.API, p.Driver) p.conf = config.NewService(mm, p.BuildConfig, "the_bot_id", nil) testAPI.On("PublishWebSocketEvent", "plugin_disabled", map[string]interface{}{"version": manifest.Version}, &model.WebsocketBroadcast{}) err := p.OnDeactivate() require.NoError(t, err) }
explode_data.jsonl/13316
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 223 }
[ 2830, 3393, 1925, 1912, 16856, 1155, 353, 8840, 836, 8, 341, 18185, 7082, 1669, 609, 47474, 396, 477, 24922, 16094, 3223, 1669, 1532, 11546, 1006, 197, 25873, 25212, 2648, 515, 298, 197, 38495, 25, 981, 14455, 345, 298, 197, 11066, 6370...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestELF32Hash(t *testing.T) { data := []byte{} hash := ELF32Hash(data) if hash != 0 { t.Logf("Got hash of 0x%08x for no data (expected 0).\n", hash) t.Fail() } data = []byte("Hi there lol") hash = ELF32Hash(data) if hash != 0x086c29bc { t.Logf("Got incorrect PJW hash: 0x%08x\n", hash) t.Fail() } }
explode_data.jsonl/56511
{ "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, 2749, 37, 18, 17, 6370, 1155, 353, 8840, 836, 8, 341, 8924, 1669, 3056, 3782, 16094, 50333, 1669, 72568, 18, 17, 6370, 2592, 340, 743, 5175, 961, 220, 15, 341, 197, 3244, 98954, 445, 32462, 5175, 315, 220, 15, 87, 4, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func Test_Number_LT(t *testing.T) { testNumberLT(t, "Number", []testNumberValue{ {"1", Number(0), 0, false}, // test zero {"2", Number(0), -10, false}, // not required {"3", Number(0).Required(), -10, true}, // required {"4", Number(1), 1, true}, // smaller than 1 {"5", Number(1), 2, false}, {"6", Number(10), 1, true}, }) testNumberLT(t, "NumF32", []testNumberValue{ {"1", NumF32(0), 0, false}, // test zero {"2", NumF32(0), -10, false}, // not required {"3", NumF32(0).Required(), -10, true}, // required {"4", NumF32(1), 1, true}, // smaller than 1 {"5", NumF32(1), 2, false}, {"6", NumF32(10), 1, true}, }) testNumberLT(t, "NumF64", []testNumberValue{ {"1", NumF64(0), 0, false}, // test zero {"2", NumF64(0), -10, false}, // not required {"3", NumF64(0).Required(), -10, true}, // required {"4", NumF64(1), 1, true}, // smaller than 1 {"5", NumF64(1), 2, false}, {"6", NumF64(10), 1, true}, }) testNumberLT(t, "NumI32", []testNumberValue{ {"1", NumI32(0), 0, false}, // test zero {"2", NumI32(0), -10, false}, // not required {"3", NumI32(0).Required(), -10, true}, // required {"4", NumI32(1), 1, true}, // smaller than 1 {"5", NumI32(1), 2, false}, {"6", NumI32(10), 1, true}, }) testNumberLT(t, "NumI64", []testNumberValue{ {"1", NumI64(0), 0, false}, // test zero {"2", NumI64(0), -10, false}, // not required {"3", NumI64(0).Required(), -10, true}, // required {"4", NumI64(1), 1, true}, // smaller than 1 {"5", NumI64(1), 2, false}, {"6", NumI64(10), 1, true}, }) }
explode_data.jsonl/57516
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 842 }
[ 2830, 3393, 51799, 65917, 1155, 353, 8840, 836, 8, 341, 18185, 2833, 27404, 1155, 11, 330, 2833, 497, 3056, 1944, 2833, 1130, 515, 197, 197, 4913, 16, 497, 5624, 7, 15, 701, 220, 15, 11, 895, 2137, 1797, 442, 1273, 7168, 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 TestMultipleReplacementSameKey(t *testing.T) { input := "[name] should say '[name]'" replacements := map[string]string{ "name": "test", } replacer := defaultReplacer{} assert.Equal(t, "test should say 'test'", replacer.replace(replacements, input), "[name] should be replaced by test") }
explode_data.jsonl/76421
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 99 }
[ 2830, 3393, 32089, 68569, 19198, 1592, 1155, 353, 8840, 836, 8, 341, 22427, 1669, 10545, 606, 60, 1265, 1977, 18309, 606, 30651, 698, 17200, 63535, 1669, 2415, 14032, 30953, 515, 197, 197, 31486, 788, 330, 1944, 756, 197, 532, 17200, 90...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestInsertingProceduralData(t *testing.T) { //First connect to the cluster. In BTrDB v4 we are advocating that all //programs use environment variables to specify the endpoint rather //than assuming specific addresses: //Set $BTRDB_ENDPOINTS to //"server1:4410;server2:4410..." //Note that not all endpoints need be listed, but it will make this //program more resilient if you specify more or all of the endpoints db, err := btrdb.ConnectAuth(context.TODO(), os.Getenv("BTRDB_APIKEY"), btrdb.EndpointsFromEnv()...) if err != nil { t.Fatalf("Unexpected connection error: %v", err) } //Streams must be created before use uu := uuid.NewRandom() //A collection is a small group of streams (<100 is best) generally associated //with a single device or service. BTrDB is designed for lots of small collections //not small numbers of big collections collection := fmt.Sprintf("test/inserting_procedural_data.%d", time.Now().UnixNano()) //The annotation is used to store (mutable) extra data with the stream. It //is technically just a byte array, but we prefer people use msgpacked objects. //the tooling is not quite there to make this easy, so its ok to make this nil //for now var annotation map[string]*string = nil stream, err := db.Create(context.TODO(), uu, collection, btrdb.OptKV("name", "test"), annotation) if err != nil { t.Fatalf("Unexpected creation error: %v", err) } //Now you manipulate the stream: err = stream.InsertTV(context.TODO(), []int64{100e6, 200e6, 300e6, 400e6}, []float64{1.1, 2.2, 3.3, 4.4}) if err != nil { t.Fatalf("Unexpected insert error: %v", err) } //Start = -1000ns, End = 1000ns, Width = 150ns, Depth = 2^0 (all the way), Version = latest rvchan, ver, errc := stream.Windows(context.TODO(), -1000e6, 1000e6, 150e6, 0, btrdb.LatestVersion) _ = ver //don't use this, that's ok for result := range rvchan { fmt.Printf("Window @%d min=%.2f mean=%.2f max=%.2f count=%d\n", result.Time, result.Min, result.Mean, result.Max, result.Count) } if e := <-errc; e != nil { t.Fatalf("Got an error: %v", e) } }
explode_data.jsonl/64719
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 728 }
[ 2830, 3393, 13780, 287, 1336, 1998, 4176, 1043, 1155, 353, 8840, 836, 8, 341, 197, 322, 5338, 4564, 311, 279, 10652, 13, 758, 425, 1282, 3506, 348, 19, 582, 525, 58316, 429, 678, 198, 197, 322, 72953, 990, 4573, 7332, 311, 13837, 27...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestEntryPointOverride_ToStringSlice(t *testing.T) { testCases := map[string]struct { inEntryPointOverride EntryPointOverride wantedSlice []string wantedError error }{ "Both fields are empty": { inEntryPointOverride: EntryPointOverride{ String: nil, StringSlice: nil, }, wantedSlice: nil, }, "Given a string": { inEntryPointOverride: EntryPointOverride{ String: aws.String(`read "some command"`), StringSlice: nil, }, wantedSlice: []string{"read", "some command"}, }, "Given a string slice": { inEntryPointOverride: EntryPointOverride{ String: nil, StringSlice: []string{"/bin/sh", "-c"}, }, wantedSlice: []string{"/bin/sh", "-c"}, }, } for name, tc := range testCases { t.Run(name, func(t *testing.T) { out, err := tc.inEntryPointOverride.ToStringSlice() require.NoError(t, err) require.Equal(t, tc.wantedSlice, out) }) } }
explode_data.jsonl/79727
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 393 }
[ 2830, 3393, 97416, 2177, 38346, 703, 33236, 1155, 353, 8840, 836, 8, 341, 18185, 37302, 1669, 2415, 14032, 60, 1235, 341, 197, 17430, 97416, 2177, 72685, 2177, 271, 197, 6692, 7566, 33236, 3056, 917, 198, 197, 6692, 7566, 1454, 1465, 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 TestDisassociateGroupFromUser(t *testing.T) { ts := httptest.NewTLSServer( http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { fmt.Fprintln(w, associateGroupWithUserResponse) }), ) defer ts.Close() duo := buildAdminClient(ts.URL, nil) result, err := duo.DisassociateGroupFromUser("DU3RP9I2WOC59VZX672N", "DGXXXXXXXXXXXXXXXXXX") if err != nil { t.Errorf("Unexpected error from DisassociateGroupFromUser call %v", err.Error()) } if result.Stat != "OK" { t.Errorf("Expected OK, but got %s", result.Stat) } }
explode_data.jsonl/61409
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 214 }
[ 2830, 3393, 4839, 71531, 2808, 3830, 1474, 1155, 353, 8840, 836, 8, 341, 57441, 1669, 54320, 70334, 7121, 13470, 1220, 2836, 1006, 197, 28080, 89164, 18552, 3622, 1758, 37508, 11, 435, 353, 1254, 9659, 8, 341, 298, 11009, 991, 33655, 36...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestFound(t *testing.T) { req, rec := setup() req.SetBasicAuth(user, pass) wraph(makeFoundAPI(t)).ServeHTTP(rec, req) res := rec.Result() if res.StatusCode != http.StatusFound { t.Error("wrong status code:", res.StatusCode) } if res.Header.Get("Location") != location { t.Error("wrong redirect location") } }
explode_data.jsonl/21809
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 121 }
[ 2830, 3393, 6650, 1155, 353, 8840, 836, 8, 341, 24395, 11, 1395, 1669, 6505, 741, 24395, 4202, 15944, 5087, 4277, 11, 1494, 692, 6692, 1935, 36944, 6650, 7082, 1155, 4579, 60421, 9230, 20635, 11, 4232, 340, 10202, 1669, 1395, 18456, 282...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func Test_SN(t *testing.T) { // skipInContainer(t) // sn := SN() // if sn == "" { // t.Fatalf("get sn fatal") // } // t.Logf("SN:%s", sn) }
explode_data.jsonl/73745
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 71 }
[ 2830, 3393, 47260, 1155, 353, 8840, 836, 8, 341, 197, 322, 10706, 641, 4502, 1155, 340, 197, 322, 4131, 1669, 17924, 741, 197, 322, 421, 4131, 621, 1591, 341, 197, 322, 220, 3244, 30762, 445, 455, 4131, 18582, 1138, 197, 322, 456, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestJQWithArrayQueryProducesRequiredArray(t *testing.T) { t.Parallel() input := `{"timestamp": 1649264191, "iss_position": {"longitude": "52.8439", "latitude": "10.8107"}, "message": "success"}` want := `["10.8107","52.8439"]` + "\n" got, err := script.Echo(input).JQ("[.iss_position.latitude, .iss_position.longitude]").String() if err != nil { t.Fatal(err) } if want != got { t.Error(want, got) t.Error(cmp.Diff(want, got)) } }
explode_data.jsonl/51485
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 187 }
[ 2830, 3393, 41, 48, 2354, 1857, 2859, 49112, 8164, 1857, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 741, 22427, 1669, 1565, 4913, 13035, 788, 220, 16, 21, 19, 24, 17, 21, 19, 16, 24, 16, 11, 330, 1038, 9661, 788, 5212, 25446...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestRangeCacheCoalescedRequests(t *testing.T) { defer leaktest.AfterTest(t)() defer log.Scope(t).Close(t) db := initTestDescriptorDB(t) ctx := context.Background() pauseLookupResumeAndAssert := func(key string, expected int64) { var wg sync.WaitGroup db.pauseRangeLookups() // We're going to perform 3 lookups on the same key, in parallel, while // lookups are paused. Either they're all expected to get cache hits (in the // case where expected == 0), or there will be one request actually blocked // in the db and the other two will get coalesced onto it. var coalesced chan struct{} if expected > 0 { coalesced = make(chan struct{}) db.cache.coalesced = coalesced } for i := 0; i < 3; i++ { wg.Add(1) go func() { doLookupWithToken(ctx, db.cache, key, EvictionToken{}, false) wg.Done() }() } // Wait for requests to be coalesced before unblocking the db. if coalesced != nil { for i := 0; i < 2; i++ { <-coalesced } } db.resumeRangeLookups() wg.Wait() db.assertLookupCountEq(t, expected, key) } // Totally uncached range. // Retrieves [meta(min),meta(g)) and [a,b). // Prefetches [meta(g),meta(m)), [meta(m),meta(s)), [b,c), and [c,d). pauseLookupResumeAndAssert("aa", 2) // Metadata 2 ranges aren't cached, metadata 1 range is. // Retrieves [d,e). // Prefetches [e,f) and [f,g). pauseLookupResumeAndAssert("d", 1) pauseLookupResumeAndAssert("ea", 0) }
explode_data.jsonl/28185
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 575 }
[ 2830, 3393, 6046, 8233, 7339, 3831, 1998, 35295, 1155, 353, 8840, 836, 8, 341, 16867, 23352, 1944, 36892, 2271, 1155, 8, 741, 16867, 1487, 77940, 1155, 568, 7925, 1155, 340, 20939, 1669, 2930, 2271, 11709, 3506, 1155, 340, 20985, 1669, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestIsStorageReference(t *testing.T) { type args struct { link string } tests := []struct { name string args args want bool }{ { name: "Simple ID", args: args{ link: "f4d71508-bec6-4db9-9694-d2d028db6cef", }, want: true, }, { name: "Storage Prefix + ID", args: args{ link: "storage:f4d71508-bec6-4db9-9694-d2d028db6cef", }, want: true, }, { name: "Storage Prefix :// + ID", args: args{ link: "storage://f4d71508-bec6-4db9-9694-d2d028db6cef", }, want: true, }, { name: "Filename IPA", args: args{ link: "storage:filename=dummyfilename.ipa", }, want: true, }, { name: "Filename APK", args: args{ link: "storage:filename=dummyfilename.apk", }, want: true, }, { name: "Filename ZIP", args: args{ link: "storage:filename=dummyfilename.zip", }, want: false, }, { name: "Bad Reference", args: args{ link: "storage:bad-ref", }, want: false, }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { if got := IsStorageReference(tt.args.link); got != tt.want { t.Errorf("IsStorageReference() = %v, want %v", got, tt.want) } }) } }
explode_data.jsonl/79921
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 608 }
[ 2830, 3393, 3872, 5793, 8856, 1155, 353, 8840, 836, 8, 341, 13158, 2827, 2036, 341, 197, 54238, 914, 198, 197, 532, 78216, 1669, 3056, 1235, 341, 197, 11609, 914, 198, 197, 31215, 2827, 198, 197, 50780, 1807, 198, 197, 59403, 197, 197...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestCryptionHandlerGet(t *testing.T) { req := httptest.NewRequest(http.MethodGet, "/any", nil) handler := CryptionHandler(aesKey)(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { _, err := w.Write([]byte(respText)) w.Header().Set("X-Test", "test") assert.Nil(t, err) })) recorder := httptest.NewRecorder() handler.ServeHTTP(recorder, req) expect, err := codec.EcbEncrypt(aesKey, []byte(respText)) assert.Nil(t, err) assert.Equal(t, http.StatusOK, recorder.Code) assert.Equal(t, "test", recorder.Header().Get("X-Test")) assert.Equal(t, base64.StdEncoding.EncodeToString(expect), recorder.Body.String()) }
explode_data.jsonl/24316
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 251 }
[ 2830, 3393, 34, 15597, 3050, 1949, 1155, 353, 8840, 836, 8, 341, 24395, 1669, 54320, 70334, 75274, 19886, 20798, 1949, 11, 3521, 3767, 497, 2092, 340, 53326, 1669, 356, 15597, 3050, 2877, 288, 1592, 2376, 1254, 89164, 18552, 3622, 1758, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestGetContainerUsageNanoCores(t *testing.T) { var value0 uint64 var value1 uint64 = 10000000000 // Test with a large container of 100+ CPUs var value2 uint64 = 188427786383 tests := []struct { desc string cpuUsageCache map[string]*cpuUsageRecord stats *runtimeapi.ContainerStats expected *uint64 }{ { desc: "should return nil if stats is nil", cpuUsageCache: map[string]*cpuUsageRecord{}, }, { desc: "should return nil if cpu stats is nil", cpuUsageCache: map[string]*cpuUsageRecord{}, stats: &runtimeapi.ContainerStats{ Attributes: &runtimeapi.ContainerAttributes{ Id: "1", }, Cpu: nil, }, }, { desc: "should return nil if usageCoreNanoSeconds is nil", cpuUsageCache: map[string]*cpuUsageRecord{}, stats: &runtimeapi.ContainerStats{ Attributes: &runtimeapi.ContainerAttributes{ Id: "1", }, Cpu: &runtimeapi.CpuUsage{ Timestamp: 1, UsageCoreNanoSeconds: nil, }, }, }, { desc: "should return nil if cpu stats is not cached yet", cpuUsageCache: map[string]*cpuUsageRecord{}, stats: &runtimeapi.ContainerStats{ Attributes: &runtimeapi.ContainerAttributes{ Id: "1", }, Cpu: &runtimeapi.CpuUsage{ Timestamp: 1, UsageCoreNanoSeconds: &runtimeapi.UInt64Value{ Value: 10000000000, }, }, }, }, { desc: "should return zero value if cached cpu stats is equal to current value", stats: &runtimeapi.ContainerStats{ Attributes: &runtimeapi.ContainerAttributes{ Id: "1", }, Cpu: &runtimeapi.CpuUsage{ Timestamp: 1, UsageCoreNanoSeconds: &runtimeapi.UInt64Value{ Value: 10000000000, }, }, }, cpuUsageCache: map[string]*cpuUsageRecord{ "1": { stats: &runtimeapi.CpuUsage{ Timestamp: 0, UsageCoreNanoSeconds: &runtimeapi.UInt64Value{ Value: 10000000000, }, }, }, }, expected: &value0, }, { desc: "should return correct value if cached cpu stats is not equal to current value", stats: &runtimeapi.ContainerStats{ Attributes: &runtimeapi.ContainerAttributes{ Id: "1", }, Cpu: &runtimeapi.CpuUsage{ Timestamp: int64(time.Second / time.Nanosecond), UsageCoreNanoSeconds: &runtimeapi.UInt64Value{ Value: 20000000000, }, }, }, cpuUsageCache: map[string]*cpuUsageRecord{ "1": { stats: &runtimeapi.CpuUsage{ Timestamp: 0, UsageCoreNanoSeconds: &runtimeapi.UInt64Value{ Value: 10000000000, }, }, }, }, expected: &value1, }, { desc: "should return correct value if elapsed UsageCoreNanoSeconds exceeds 18446744073", stats: &runtimeapi.ContainerStats{ Attributes: &runtimeapi.ContainerAttributes{ Id: "1", }, Cpu: &runtimeapi.CpuUsage{ Timestamp: int64(time.Second / time.Nanosecond), UsageCoreNanoSeconds: &runtimeapi.UInt64Value{ Value: 68172016162105, }, }, }, cpuUsageCache: map[string]*cpuUsageRecord{ "1": { stats: &runtimeapi.CpuUsage{ Timestamp: 0, UsageCoreNanoSeconds: &runtimeapi.UInt64Value{ Value: 67983588375722, }, }, }, }, expected: &value2, }, } for _, test := range tests { provider := &criStatsProvider{cpuUsageCache: test.cpuUsageCache} // Before the update, the cached value should be nil cached := provider.getContainerUsageNanoCores(test.stats) assert.Nil(t, cached) // Update the cache and get the latest value. real := provider.getAndUpdateContainerUsageNanoCores(test.stats) assert.Equal(t, test.expected, real, test.desc) // After the update, the cached value should be up-to-date cached = provider.getContainerUsageNanoCores(test.stats) assert.Equal(t, test.expected, cached, test.desc) } }
explode_data.jsonl/7537
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1696 }
[ 2830, 3393, 1949, 4502, 14783, 83819, 34, 4589, 1155, 353, 8840, 836, 8, 341, 2405, 897, 15, 2622, 21, 19, 198, 2405, 897, 16, 2622, 21, 19, 284, 220, 16, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 271, 197, 322, 3393, 448, 264, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestLess(t *testing.T) { t.Parallel() if id2.Less(id1) { t.Errorf("'%s'.Less(%s) should be true", id2.PublicKeyHex(), id1.PublicKeyHex()) } if !id1.Less(id2) { t.Errorf("'%s'.Less(%s) should be false", id1.PublicKeyHex(), id2.PublicKeyHex()) } if !id1.Less(id3) { t.Errorf("'%s'.Less(%s) should be false", id1.PublicKeyHex(), id3.PublicKeyHex()) } }
explode_data.jsonl/7128
{ "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, 27451, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 2822, 743, 877, 17, 1214, 433, 3724, 16, 8, 341, 197, 3244, 13080, 445, 36165, 82, 4427, 27451, 15238, 82, 8, 1265, 387, 830, 497, 877, 17, 49139, 1592, 20335, 1507...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestMultiClusterUpdateCanUpdateCluster(t *testing.T) { mc := newMultiCluster() ci := pb.ClusterInfo{ ClusterId: 1, NodeId: 2, IsLeader: true, Nodes: map[uint64]string{1: "a1", 2: "a2", 3: "a3"}, ConfigChangeIndex: 1, } nhi := pb.NodeHostInfo{ RaftAddress: "a2", LastTick: 100, Region: "region-1", ClusterInfo: []pb.ClusterInfo{ci}, } mc.update(nhi) // higher ConfigChangeIndex will be accepted uci := pb.ClusterInfo{ ClusterId: 1, NodeId: 2, IsLeader: false, Nodes: map[uint64]string{2: "a2", 3: "a3", 4: "a4", 5: "a5"}, ConfigChangeIndex: 2, } unhi := pb.NodeHostInfo{ RaftAddress: "a2", LastTick: 200, Region: "region-1", ClusterInfo: []pb.ClusterInfo{uci}, } mc.update(unhi) v, _ := mc.Clusters[1] if v.ConfigChangeIndex != 2 { t.Errorf("ConfigChangeIndex = %d, want 2", v.ConfigChangeIndex) } if len(v.Nodes) != 4 { t.Errorf("nodes sz = %d, want 4", len(v.Nodes)) } // node 1 expected to be gone hasNode1 := false for _, n := range v.Nodes { if n.NodeID == 1 { hasNode1 = true } } if hasNode1 { t.Error("node 1 is not deleted") } if v.Nodes[2].Tick != 200 { t.Errorf("tick = %d, want 200", v.Nodes[2].Tick) } // lower ConfigChangeIndex will be ignored uci = pb.ClusterInfo{ ClusterId: 1, NodeId: 2, IsLeader: false, Nodes: map[uint64]string{1: "a1", 2: "a2"}, ConfigChangeIndex: 1, } unhi = pb.NodeHostInfo{ RaftAddress: "a2", LastTick: 200, Region: "region-1", ClusterInfo: []pb.ClusterInfo{uci}, } mc.update(unhi) if v.ConfigChangeIndex != 2 { t.Errorf("ConfigChangeIndex = %d, want 2", v.ConfigChangeIndex) } if len(v.Nodes) != 4 { t.Errorf("nodes sz = %d, want 4", len(v.Nodes)) } }
explode_data.jsonl/24609
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 936 }
[ 2830, 3393, 20358, 28678, 4289, 6713, 4289, 28678, 1155, 353, 8840, 836, 8, 341, 97662, 1669, 501, 20358, 28678, 741, 1444, 72, 1669, 17310, 72883, 1731, 515, 197, 197, 28678, 764, 25, 260, 220, 16, 345, 197, 30217, 764, 25, 310, 220,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
9
func TestMetaWorker_HandleRequest(t *testing.T) { formatStr := "RadioChecker API (C) %d The RadioChecker Authors. All rights reserved. " + "(Version: %s / Build: %s / Revision: %s)" expectedResult := fmt.Sprintf(formatStr, time.Now().Year(), Version, Build, Revision) result, err := MetaWorker{}.HandleRequest() if err != nil || result != expectedResult { t.Errorf("MetaWorker (%v).HandleRequest(): got (%s, %v), expected type (%s, false)", MetaWorker{}, result, err, expectedResult) } }
explode_data.jsonl/24721
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 165 }
[ 2830, 3393, 12175, 21936, 42714, 1900, 1155, 353, 8840, 836, 8, 341, 59416, 2580, 1669, 330, 28203, 35188, 5333, 320, 34, 8, 1018, 67, 576, 13484, 35188, 24124, 13, 2009, 3188, 4591, 13, 330, 3610, 197, 197, 29209, 5637, 25, 1018, 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 TestPatch(t *testing.T) { program, err := expr.Compile( `Ticket == "$100" and "$90" != Ticket + "0"`, expr.Env(mockEnv{}), expr.Patch(&stringerPatcher{}), ) require.NoError(t, err) env := mockEnv{ Ticket: &ticket{Price: 100}, } output, err := expr.Run(program, env) require.NoError(t, err) require.Equal(t, true, output) }
explode_data.jsonl/36912
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 150 }
[ 2830, 3393, 43622, 1155, 353, 8840, 836, 8, 341, 197, 14906, 11, 1848, 1669, 15169, 89323, 1006, 197, 197, 63, 34058, 621, 5201, 16, 15, 15, 1, 323, 5201, 24, 15, 1, 961, 28397, 488, 330, 15, 1, 12892, 197, 8122, 649, 81214, 30389...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestDeleteMigrationsNoMigrationName(t *testing.T) { cmdArgs := []string{"delete", "migrations"} var migrationList storkv1.MigrationList expected := "error: At least one argument needs to be provided for migration name" testCommon(t, cmdArgs, &migrationList, expected, true) }
explode_data.jsonl/18259
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 86 }
[ 2830, 3393, 6435, 44, 17824, 2753, 20168, 675, 1155, 353, 8840, 836, 8, 341, 25920, 4117, 1669, 3056, 917, 4913, 4542, 497, 330, 76, 17824, 63159, 2405, 11906, 852, 357, 669, 85, 16, 1321, 5033, 852, 198, 42400, 1669, 330, 841, 25, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestMakeParentDir(t *testing.T) { type args struct { p string } tests := []struct { name string args args wantParentDir string wantErr bool }{ {name: "valid", args: args{p: "/tmp/gg/hh"}, wantParentDir: "/tmp/gg", wantErr: false}, {name: "perm_denied", args: args{p: "/etc/gg/hh"}, wantParentDir: "/etc/gg", wantErr: true}, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { gotParentDir, err := MakeParentDir(tt.args.p) if (err != nil) != tt.wantErr { t.Errorf("MakeParentDir() error = %v, wantErr %v", err, tt.wantErr) return } if gotParentDir != tt.wantParentDir { t.Errorf("MakeParentDir() gotParentDir = %v, want %v", gotParentDir, tt.wantParentDir) } }) } }
explode_data.jsonl/46406
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 373 }
[ 2830, 3393, 8078, 8387, 6184, 1155, 353, 8840, 836, 8, 341, 13158, 2827, 2036, 341, 197, 3223, 914, 198, 197, 532, 78216, 1669, 3056, 1235, 341, 197, 11609, 688, 914, 198, 197, 31215, 688, 2827, 198, 197, 50780, 8387, 6184, 914, 198, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestRelease_MirrorDelete(t *testing.T) { assert.NoError(t, models.PrepareTestDatabase()) user := models.AssertExistsAndLoadBean(t, &models.User{ID: 2}).(*models.User) repo := models.AssertExistsAndLoadBean(t, &models.Repository{ID: 1}).(*models.Repository) repoPath := models.RepoPath(user.Name, repo.Name) opts := migration.MigrateOptions{ RepoName: "test_mirror", Description: "Test mirror", Private: false, Mirror: true, CloneAddr: repoPath, Wiki: true, Releases: false, } mirrorRepo, err := repository.CreateRepository(user, user, models.CreateRepoOptions{ Name: opts.RepoName, Description: opts.Description, IsPrivate: opts.Private, IsMirror: opts.Mirror, Status: models.RepositoryBeingMigrated, }) assert.NoError(t, err) mirror, err := repository.MigrateRepositoryGitData(user, user, mirrorRepo, opts) assert.NoError(t, err) gitRepo, err := git.OpenRepository(repoPath) assert.NoError(t, err) defer gitRepo.Close() findOptions := models.FindReleasesOptions{IncludeDrafts: true, IncludeTags: true} initCount, err := models.GetReleaseCountByRepoID(mirror.ID, findOptions) assert.NoError(t, err) assert.NoError(t, release_service.CreateRelease(gitRepo, &models.Release{ RepoID: repo.ID, PublisherID: user.ID, TagName: "v0.2", Target: "master", Title: "v0.2 is released", Note: "v0.2 is released", IsDraft: false, IsPrerelease: false, IsTag: true, }, nil)) err = mirror.GetMirror() assert.NoError(t, err) _, ok := runSync(mirror.Mirror) assert.True(t, ok) count, err := models.GetReleaseCountByRepoID(mirror.ID, findOptions) assert.NoError(t, err) assert.EqualValues(t, initCount+1, count) release, err := models.GetRelease(repo.ID, "v0.2") assert.NoError(t, err) assert.NoError(t, release_service.DeleteReleaseByID(release.ID, user, true)) _, ok = runSync(mirror.Mirror) assert.True(t, ok) count, err = models.GetReleaseCountByRepoID(mirror.ID, findOptions) assert.NoError(t, err) assert.EqualValues(t, initCount, count) }
explode_data.jsonl/68215
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 874 }
[ 2830, 3393, 16077, 1245, 28812, 6435, 1155, 353, 8840, 836, 8, 341, 6948, 35699, 1155, 11, 4119, 28770, 3380, 2271, 5988, 12367, 19060, 1669, 4119, 11711, 15575, 3036, 5879, 10437, 1155, 11, 609, 6507, 7344, 90, 915, 25, 220, 17, 16630,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestTimeoutHandlerSuccess(t *testing.T) { ln := fasthttputil.NewInmemoryListener() h := func(ctx *RequestCtx) { if string(ctx.Path()) == "/" { ctx.Success("aaa/bbb", []byte("real response")) } } s := &Server{ Handler: TimeoutHandler(h, 10*time.Second, "timeout!!!"), } serverCh := make(chan struct{}) go func() { if err := s.Serve(ln); err != nil { t.Fatalf("unexepcted error: %s", err) } close(serverCh) }() concurrency := 20 clientCh := make(chan struct{}, concurrency) for i := 0; i < concurrency; i++ { go func() { conn, err := ln.Dial() if err != nil { t.Fatalf("unexepcted error: %s", err) } if _, err = conn.Write([]byte("GET / HTTP/1.1\r\nHost: google.com\r\n\r\n")); err != nil { t.Fatalf("unexpected error: %s", err) } br := bufio.NewReader(conn) verifyResponse(t, br, StatusOK, "aaa/bbb", "real response") clientCh <- struct{}{} }() } for i := 0; i < concurrency; i++ { select { case <-clientCh: case <-time.After(time.Second): t.Fatalf("timeout") } } if err := ln.Close(); err != nil { t.Fatalf("unexpected error: %s", err) } select { case <-serverCh: case <-time.After(time.Second): t.Fatalf("timeout") } }
explode_data.jsonl/73298
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 535 }
[ 2830, 3393, 7636, 3050, 7188, 1155, 353, 8840, 836, 8, 341, 197, 2261, 1669, 4937, 96336, 628, 321, 7121, 641, 17269, 2743, 741, 9598, 1669, 2915, 7502, 353, 1900, 23684, 8, 341, 197, 743, 914, 7502, 17474, 2140, 621, 16891, 341, 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...
2
func TestBindTupleCons(t *testing.T) { env := environment(map[string]interface{}{ "a": NewOutputType(StringType), "b": NewPromiseType(StringType), "c": NewUnionType(StringType, BoolType), }) scope := env.scope() cases := []exprTestCase{ {x: `["foo", "bar", "baz"]`, t: NewTupleType(StringType, StringType, StringType)}, {x: `[0, "foo", true]`, t: NewTupleType(NumberType, StringType, BoolType)}, {x: `[a, b, c]`, t: NewTupleType(env["a"].(Type), env["b"].(Type), env["c"].(Type))}, {x: `[{"foo": "bar"}]`, t: NewTupleType(NewObjectType(map[string]Type{"foo": StringType}))}, } for _, c := range cases { t.Run(c.x, func(t *testing.T) { expr, diags := BindExpressionText(c.x, scope, hcl.Pos{}) assert.Len(t, diags, 0) assert.Equal(t, c.t, expr.Type()) _, ok := expr.(*TupleConsExpression) assert.True(t, ok) assert.Equal(t, c.x, fmt.Sprintf("%v", expr)) }) } }
explode_data.jsonl/42573
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 403 }
[ 2830, 3393, 9950, 28681, 15220, 1155, 353, 8840, 836, 8, 341, 57538, 1669, 4573, 9147, 14032, 31344, 67066, 197, 197, 56693, 788, 1532, 5097, 929, 2242, 929, 1326, 197, 197, 1, 65, 788, 1532, 21041, 929, 2242, 929, 1326, 197, 197, 969...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestWriteError(t *testing.T) { testRecorder := httptest.NewRecorder() writeError(testRecorder, testKind, testMessage) if testRecorder.Code != statusNotOk { t.Fail() t.Logf(fmt.Sprint("expected: ", statusNotOk, ", found: ", testRecorder.Code)) } var errors ErrorDeclarations json.NewDecoder(testRecorder.Body).Decode(&errors) if len(errors) == 0 { t.Fail() t.Logf("error array has a length of zero") return } if errors[0].Kind != testKind { t.Fail() t.Logf(fmt.Sprint("expected: ", testKind, ", found: ", errors[0].Kind)) } if errors[0].Message != testMessage { t.Fail() t.Logf(fmt.Sprint("expected: ", testMessage, ", found: ", errors[0].Message)) } }
explode_data.jsonl/48434
{ "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, 7985, 1454, 1155, 353, 8840, 836, 8, 341, 18185, 47023, 1669, 54320, 70334, 7121, 47023, 741, 24945, 1454, 8623, 47023, 11, 1273, 10629, 11, 1273, 2052, 692, 743, 1273, 47023, 20274, 961, 2639, 2623, 11578, 341, 197, 3244, 5...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
5
func Test_UpdateBatchByCache(t *testing.T) { helper := sysutil.NewFileTestUtil(t) absFile := path.Join(helper.TempDir, commonTestFile) tests := []struct { name string initCache []ResourceUpdater initFiles []ResourceUpdater reconcileInfos []reconcileInfo }{ { name: "test_cache_equal_but_force_update", initCache: []ResourceUpdater{ &CgroupResourceUpdater{ParentDir: "/", file: sysutil.CPUShares, value: "1024", lastUpdateTimestamp: time.Now().Add(-5 * time.Second), updateFunc: CommonCgroupUpdateFunc}, &CommonResourceUpdater{file: absFile, value: "19", lastUpdateTimestamp: time.Now().Add(-5 * time.Second), updateFunc: CommonUpdateFunc}, }, initFiles: []ResourceUpdater{ &CgroupResourceUpdater{ParentDir: "/", file: sysutil.CPUShares, value: "2048", lastUpdateTimestamp: time.Now().Add(-5 * time.Second), updateFunc: CommonCgroupUpdateFunc}, &CommonResourceUpdater{file: absFile, value: "20", lastUpdateTimestamp: time.Now().Add(-5 * time.Second), updateFunc: CommonUpdateFunc}, }, reconcileInfos: []reconcileInfo{ { desc: "test_update", resources: []ResourceUpdater{ NewCommonCgroupResourceUpdater(PodOwnerRef("", "pod1"), "/", sysutil.CPUShares, "1024"), NewCommonResourceUpdater(absFile, "19"), }, expect: []ResourceUpdater{ NewCommonCgroupResourceUpdater(PodOwnerRef("", "pod1"), "/", sysutil.CPUShares, "1024"), NewCommonResourceUpdater(absFile, "19"), }, }, }, }, { name: "test_cache_equal_and_not_forceUpdate", initCache: []ResourceUpdater{ &CgroupResourceUpdater{ParentDir: "/", file: sysutil.CPUShares, value: "1024", lastUpdateTimestamp: time.Now(), updateFunc: CommonCgroupUpdateFunc}, &CommonResourceUpdater{file: absFile, value: "19", lastUpdateTimestamp: time.Now(), updateFunc: CommonUpdateFunc}, }, initFiles: []ResourceUpdater{ &CgroupResourceUpdater{ParentDir: "/", file: sysutil.CPUShares, value: "2048", lastUpdateTimestamp: time.Now(), updateFunc: CommonCgroupUpdateFunc}, &CommonResourceUpdater{file: absFile, value: "20", lastUpdateTimestamp: time.Now().Add(-5 * time.Second), updateFunc: CommonUpdateFunc}, }, reconcileInfos: []reconcileInfo{ { desc: "test_update", resources: []ResourceUpdater{ NewCommonCgroupResourceUpdater(PodOwnerRef("", "pod1"), "/", sysutil.CPUShares, "1024"), NewCommonResourceUpdater(absFile, "19"), }, expect: []ResourceUpdater{ NewCommonCgroupResourceUpdater(PodOwnerRef("", "pod1"), "/", sysutil.CPUShares, "2048"), NewCommonResourceUpdater(absFile, "20"), }, }, }, }, { name: "test_reconcile", initCache: []ResourceUpdater{}, initFiles: []ResourceUpdater{ NewCommonCgroupResourceUpdater(PodOwnerRef("", "pod1"), "/", sysutil.CPUShares, "2"), }, reconcileInfos: []reconcileInfo{ { desc: "test_start", resources: []ResourceUpdater{ NewCommonCgroupResourceUpdater(PodOwnerRef("", "pod1"), "/", sysutil.CPUShares, "1024"), }, expect: []ResourceUpdater{ NewCommonCgroupResourceUpdater(PodOwnerRef("", "pod1"), "/", sysutil.CPUShares, "1024"), }, }, { desc: "test_running_2", resources: []ResourceUpdater{ NewCommonCgroupResourceUpdater(PodOwnerRef("", "pod1"), "/", sysutil.CPUShares, "2"), }, expect: []ResourceUpdater{ NewCommonCgroupResourceUpdater(PodOwnerRef("", "pod1"), "/", sysutil.CPUShares, "2"), }, }, { desc: "test_running_3", resources: []ResourceUpdater{ NewCommonCgroupResourceUpdater(PodOwnerRef("", "pod1"), "/", sysutil.CPUShares, "1024"), }, expect: []ResourceUpdater{ NewCommonCgroupResourceUpdater(PodOwnerRef("", "pod1"), "/", sysutil.CPUShares, "1024"), }, }, }, }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { prepareResourceFiles(helper, tt.initFiles) resourceCache := cache.NewCache(time.Second, time.Second) for _, resource := range tt.initCache { resourceCache.Set(resource.Key(), resource, time.Until(resource.GetLastUpdateTimestamp())+time.Second) } rm := ResourceUpdateExecutor{name: tt.name, forceUpdateSeconds: 1, resourceCache: resourceCache, locker: &sync.Mutex{}} stop := make(chan struct{}) rm.Run(stop) defer func() { stop <- struct{}{} }() for _, info := range tt.reconcileInfos { rm.UpdateBatchByCache(info.resources...) got := getActualResources(info.resources) equalResourceMap(t, info.resources, got, fmt.Sprintf("case:%s,checkCurrentResource", info.desc)) } }) } }
explode_data.jsonl/56862
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1908 }
[ 2830, 3393, 47393, 21074, 1359, 8233, 1155, 353, 8840, 836, 8, 1476, 9598, 2947, 1669, 5708, 1314, 7121, 1703, 2271, 2742, 1155, 692, 197, 3435, 1703, 1669, 1815, 22363, 80434, 65009, 6184, 11, 4185, 2271, 1703, 692, 78216, 1669, 3056, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestUsingExternalCA(t *testing.T) { tests := []struct { setupFuncs []func(cfg *kubeadmapi.InitConfiguration) error expected bool }{ { setupFuncs: []func(cfg *kubeadmapi.InitConfiguration) error{ CreatePKIAssets, }, expected: false, }, { setupFuncs: []func(cfg *kubeadmapi.InitConfiguration) error{ CreatePKIAssets, deleteCAKey, deleteFrontProxyCAKey, }, expected: true, }, } for _, test := range tests { dir := testutil.SetupTempDir(t) defer os.RemoveAll(dir) cfg := &kubeadmapi.InitConfiguration{ APIEndpoint: kubeadmapi.APIEndpoint{AdvertiseAddress: "1.2.3.4"}, ClusterConfiguration: kubeadmapi.ClusterConfiguration{ Networking: kubeadmapi.Networking{ServiceSubnet: "10.96.0.0/12", DNSDomain: "cluster.local"}, CertificatesDir: dir, }, NodeRegistration: kubeadmapi.NodeRegistrationOptions{Name: "valid-hostname"}, } for _, f := range test.setupFuncs { if err := f(cfg); err != nil { t.Errorf("error executing setup function: %v", err) } } if val, _ := UsingExternalCA(cfg); val != test.expected { t.Errorf("UsingExternalCA did not match expected: %v", test.expected) } } }
explode_data.jsonl/58626
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 493 }
[ 2830, 3393, 16429, 25913, 5049, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 3056, 1235, 341, 197, 84571, 9626, 82, 3056, 2830, 28272, 353, 74, 392, 3149, 76, 2068, 26849, 7688, 8, 1465, 198, 197, 42400, 256, 1807, 198, 197, 59403, 197,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestMultiWindowProcessing(t *testing.T) { // Set up our SDF to block on the second window of four, at the second // position of the restriction. (i.e. window at 0.5 progress, full element // at 0.375 progress) blockW := 1 wsdf := WindowBlockingSdf{ block: make(chan struct{}), claim: 1, w: testMultiWindows[blockW], } dfn, err := graph.NewDoFn(&wsdf, graph.NumMainInputs(graph.MainSingle)) if err != nil { t.Fatalf("invalid function: %v", err) } // Create a plan with a single valid element as input to ProcessElement. in := FullValue{ Elm: &FullValue{ Elm: 1, Elm2: offsetrange.Restriction{Start: 0, End: 4}, }, Elm2: 4.0, Timestamp: testTimestamp, Windows: testMultiWindows, } capt := &CaptureNode{UID: 2} n := &ParDo{UID: 1, Fn: dfn, Out: []Node{capt}} node := &ProcessSizedElementsAndRestrictions{PDo: n} root := &FixedRoot{UID: 0, Elements: []MainInput{{Key: in}}, Out: node} units := []Unit{root, node, capt} p, err := NewPlan("a", units) if err != nil { t.Fatalf("failed to construct plan: %v", err) } // Start a goroutine for processing, expecting to synchronize with it once // while processing is blocked (to validate processing) and a second time // it's done (to validate final outputs). done := make(chan struct{}) go func() { if err := p.Execute(context.Background(), "1", DataContext{}); err != nil { t.Fatalf("execute failed: %v", err) } done <- struct{}{} }() // Once SDF is blocked, check that it is tracking windows properly, and that // getting progress and splitting works as expected. <-wsdf.block if got, want := node.currW, blockW; got != want { t.Errorf("Incorrect current window during processing, got %v, want %v", got, want) } if got, want := node.numW, len(testMultiWindows); got != want { t.Errorf("Incorrect total number of windows during processing, got %v, want %v", got, want) } su := <-node.SU if got, want := su.GetProgress(), 1.5/4.0; !floatEquals(got, want, 0.00001) { t.Errorf("Incorrect result from GetProgress() during processing, got %v, want %v", got, want) } // Split should hit window boundary between 2 and 3. We don't need to check // the split result here, just the effects it has on currW and numW. frac := 0.5 if _, _, err := su.Split(frac); err != nil { t.Errorf("Split(%v) failed with error: %v", frac, err) } if got, want := node.currW, blockW; got != want { t.Errorf("Incorrect current window after splitting, got %v, want %v", got, want) } if got, want := node.numW, 3; got != want { t.Errorf("Incorrect total number of windows after splitting, got %v, want %v", got, want) } // Now we can unblock SDF and finish processing, then check that the results // respected the windowed split. node.SU <- su wsdf.block <- struct{}{} <-done gotOut := capt.Elements wantOut := []FullValue{{ // Only 3 windows, 4th should be gone after split. Elm: 1, Timestamp: testTimestamp, Windows: testMultiWindows[0:1], }, { Elm: 1, Timestamp: testTimestamp, Windows: testMultiWindows[1:2], }, { Elm: 1, Timestamp: testTimestamp, Windows: testMultiWindows[2:3], }} if diff := cmp.Diff(gotOut, wantOut); diff != "" { t.Errorf("ProcessSizedElementsAndRestrictions produced incorrect outputs (-got, +want):\n%v", diff) } }
explode_data.jsonl/51817
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1224 }
[ 2830, 3393, 20358, 4267, 28892, 1155, 353, 8840, 836, 8, 341, 197, 322, 2573, 705, 1039, 328, 5262, 311, 2504, 389, 279, 2086, 3241, 315, 3040, 11, 518, 279, 2086, 198, 197, 322, 2309, 315, 279, 19455, 13, 320, 72, 1734, 13, 3241, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestTerminateAnalysisRun(t *testing.T) { newRun := StartTerminatingAnalysisRun(t, false) assert.Equal(t, v1alpha1.AnalysisPhaseSuccessful, newRun.Status.Phase) assert.Equal(t, "Run Terminated", newRun.Status.Message) }
explode_data.jsonl/75850
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 78 }
[ 2830, 3393, 62519, 26573, 6727, 1155, 353, 8840, 836, 8, 341, 8638, 6727, 1669, 5145, 21209, 64283, 26573, 6727, 1155, 11, 895, 340, 6948, 12808, 1155, 11, 348, 16, 7141, 16, 8624, 9092, 30733, 36374, 11, 501, 6727, 10538, 35989, 519, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestPathManifestReader_Read(t *testing.T) { _ = apiextv1.AddToScheme(scheme.Scheme) testCases := map[string]struct { manifests map[string]string namespace string expectedObjs []object.ObjMetadata expectedErrMsg string }{ "Empty package is ok": { manifests: map[string]string{}, namespace: "test-namespace", expectedObjs: []object.ObjMetadata{}, }, "Kptfile are ignored": { manifests: map[string]string{ "Kptfile": kptFile, "pod-a.yaml": podA, }, namespace: "test-namespace", expectedObjs: []object.ObjMetadata{ { GroupKind: schema.GroupKind{ Kind: "Pod", }, Name: "pod-a", Namespace: "test-namespace", }, }, }, "Namespace gets set on namespaced resources": { manifests: map[string]string{ "pod-a.yaml": podA, "deployment.yaml": deploymentA, }, namespace: "test-namespace", expectedObjs: []object.ObjMetadata{ { GroupKind: schema.GroupKind{ Kind: "Pod", }, Name: "pod-a", Namespace: "test-namespace", }, { GroupKind: schema.GroupKind{ Group: "apps", Kind: "Deployment", }, Name: "test-deployment", Namespace: "test-namespace", }, }, }, "Function config resources are ignored": { manifests: map[string]string{ "Kptfile": kptFileWithPipeline, "pod-a.yaml": podA, "deployment-a.yaml": deploymentA, "cm.yaml": configMap, }, namespace: "test-namespace", expectedObjs: []object.ObjMetadata{ { GroupKind: schema.GroupKind{ Kind: "Pod", }, Name: "pod-a", Namespace: "test-namespace", }, { GroupKind: schema.GroupKind{ Group: "apps", Kind: "Deployment", }, Name: "test-deployment", Namespace: "test-namespace", }, }, }, "CR and CRD in the same set is ok": { manifests: map[string]string{ "crd.yaml": crd, "cr.yaml": cr, }, namespace: "test-namespace", expectedObjs: []object.ObjMetadata{ { GroupKind: schema.GroupKind{ Group: "custom.io", Kind: "Custom", }, Name: "cr", }, { GroupKind: schema.GroupKind{ Group: "apiextensions.k8s.io", Kind: "CustomResourceDefinition", }, Name: "custom.io", }, }, }, "CR with unknown type is not allowed": { manifests: map[string]string{ "cr.yaml": cr, }, namespace: "test-namespace", expectedErrMsg: "unknown resource types: Custom.custom.io", }, } for tn, tc := range testCases { t.Run(tn, func(t *testing.T) { tf := cmdtesting.NewTestFactory().WithNamespace("test-ns") defer tf.Cleanup() mapper, err := tf.ToRESTMapper() if !assert.NoError(t, err) { t.FailNow() } // Set up the yaml manifests (including Kptfile) in temp dir. dir, err := ioutil.TempDir("", "path-reader-test") assert.NoError(t, err) for filename, content := range tc.manifests { p := filepath.Join(dir, filename) err := ioutil.WriteFile(p, []byte(content), 0600) assert.NoError(t, err) } // Create the ResourceGroupPathManifestReader, and Read() // the manifests into unstructureds rgPathReader := &ResourceGroupPathManifestReader{ PkgPath: dir, ReaderOptions: manifestreader.ReaderOptions{ Mapper: mapper, Namespace: tc.namespace, EnforceNamespace: false, }, } readObjs, err := rgPathReader.Read() if tc.expectedErrMsg != "" { if !assert.Error(t, err) { t.FailNow() } assert.Contains(t, err.Error(), tc.expectedErrMsg) return } assert.NoError(t, err) readObjMetas := object.UnstructuredsToObjMetas(readObjs) sort.Slice(readObjMetas, func(i, j int) bool { return readObjMetas[i].String() < readObjMetas[j].String() }) assert.Equal(t, tc.expectedObjs, readObjMetas) }) } }
explode_data.jsonl/23155
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1896 }
[ 2830, 3393, 1820, 38495, 5062, 38381, 1155, 353, 8840, 836, 8, 341, 197, 62, 284, 6330, 427, 85, 16, 1904, 1249, 28906, 1141, 8058, 92719, 340, 18185, 37302, 1669, 2415, 14032, 60, 1235, 341, 197, 197, 42315, 82, 414, 2415, 14032, 309...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestOrderingServiceConnFailure(t *testing.T) { testOrderingServiceConnFailure(t, blockDelivererConsumerWithRecv) testOrderingServiceConnFailure(t, blockDelivererConsumerWithSend) connWG.Wait() }
explode_data.jsonl/60870
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 64 }
[ 2830, 3393, 4431, 287, 1860, 9701, 17507, 1155, 353, 8840, 836, 8, 341, 18185, 4431, 287, 1860, 9701, 17507, 1155, 11, 2504, 16532, 1524, 261, 29968, 2354, 63483, 340, 18185, 4431, 287, 1860, 9701, 17507, 1155, 11, 2504, 16532, 1524, 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
func TestPipelineRunDescribe_without_start_time(t *testing.T) { clock := clockwork.NewFakeClock() pipelineRuns := []*v1alpha1.PipelineRun{ tb.PipelineRun("pipeline-run", "ns", cb.PipelineRunCreationTimestamp(clock.Now()), tb.PipelineRunLabel("tekton.dev/pipeline", "pipeline"), tb.PipelineRunSpec("pipeline"), tb.PipelineRunStatus(), ), } namespaces := []*corev1.Namespace{ { ObjectMeta: metav1.ObjectMeta{ Name: "ns", }, }, } version := "v1alpha1" tdc := testDynamic.Options{} dynamic, err := tdc.Client( cb.UnstructuredPR(pipelineRuns[0], version), ) if err != nil { t.Errorf("unable to create dynamic client: %v", err) } cs, _ := test.SeedTestData(t, pipelinetest.Data{Namespaces: namespaces, PipelineRuns: pipelineRuns}) cs.Pipeline.Resources = cb.APIResourceList(version, []string{"pipelinerun", "taskrun"}) p := &test.Params{Tekton: cs.Pipeline, Kube: cs.Kube, Dynamic: dynamic, Clock: clock} pipelinerun := Command(p) clock.Advance(10 * time.Minute) actual, err := test.ExecuteCommand(pipelinerun, "desc", "pipeline-run", "-n", "ns") if err != nil { t.Errorf("Unexpected error: %v", err) } golden.Assert(t, actual, fmt.Sprintf("%s.golden", t.Name())) }
explode_data.jsonl/7908
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 518 }
[ 2830, 3393, 34656, 6727, 74785, 39904, 4906, 3009, 1155, 353, 8840, 836, 8, 341, 84165, 1669, 8866, 1778, 7121, 52317, 26104, 2822, 3223, 8790, 73920, 1669, 29838, 85, 16, 7141, 16, 1069, 8790, 6727, 515, 197, 62842, 1069, 8790, 6727, 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 TestPFlagProvider(t *testing.T) { const schema = ` { "type": "object", "properties": { "foo": { "type": "string" } } } ` ctx := context.Background() s, err := jsonschema.CompileString(ctx, "", schema) require.NoError(t, err) t.Run("only parses known flags", func(t *testing.T) { flags := pflag.NewFlagSet("", pflag.ContinueOnError) flags.String("foo", "", "") flags.String("bar", "", "") require.NoError(t, flags.Parse([]string{"--foo", "x", "--bar", "y"})) p, err := NewPFlagProvider([]byte(schema), s, flags, nil) require.NoError(t, err) values, err := p.Read() require.NoError(t, err) assert.Equal(t, map[string]interface{}{ "foo": "x", }, values) }) }
explode_data.jsonl/36280
{ "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, 47, 12135, 5179, 1155, 353, 8840, 836, 8, 341, 4777, 10802, 284, 22074, 515, 220, 330, 1313, 788, 330, 1700, 756, 220, 330, 13193, 788, 341, 197, 1, 7975, 788, 341, 3677, 330, 1313, 788, 330, 917, 698, 197, 532, 220, 4...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestSCRAMSASLPrep(t *testing.T) { type stringStruct struct { password string expected string } // some of the testing methodology for this is borrowed from: // // https://github.com/MagicStack/asyncpg/blob/master/tests/test_connect.py#L276-L287 tests := []stringStruct{ stringStruct{password: "hippo", expected: "hippo"}, stringStruct{password: "híppo", expected: "híppo"}, stringStruct{password: "こんにちは", expected: "こんにちは"}, stringStruct{password: "hippo\u1680lake", expected: "hippo lake"}, stringStruct{password: "hipp\ufe01o", expected: "hippo"}, stringStruct{password: "hipp\u206ao", expected: "hipp\u206ao"}, } for _, test := range tests { t.Run(fmt.Sprintf("saslprep %q", test.password), func(t *testing.T) { scram := SCRAMPassword{password: test.password} if scram.saslPrep() != test.expected { t.Errorf("%q should be %q", test.password, test.expected) } }) } }
explode_data.jsonl/28542
{ "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, 3540, 33905, 50, 1911, 43, 4703, 79, 1155, 353, 8840, 836, 8, 341, 13158, 914, 9422, 2036, 341, 197, 58199, 914, 198, 197, 42400, 914, 198, 197, 630, 197, 322, 1045, 315, 279, 7497, 37052, 369, 419, 374, 45564, 504, 510,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestInjectionEnabled(t *testing.T) { type testCase struct { name string annotations map[string]string expect bool } testcases := []testCase{ { name: "enable_Injection_done", annotations: map[string]string{ common.InjectSidecarDone: "true", }, expect: true, }, { name: "disable_Injection_done", annotations: map[string]string{ common.InjectSidecarDone: "false", }, expect: false, }, { name: "no_Injection", annotations: map[string]string{ "test": "false", }, expect: false, }, } for _, testcase := range testcases { got := SidecarInjectDone(testcase.annotations) if got != testcase.expect { t.Errorf("The testcase %s's failed due to expect %v but got %v", testcase.name, testcase.expect, got) } } }
explode_data.jsonl/35575
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 339 }
[ 2830, 3393, 36653, 5462, 1155, 353, 8840, 836, 8, 341, 13158, 54452, 2036, 341, 197, 11609, 286, 914, 198, 197, 197, 39626, 2415, 14032, 30953, 198, 197, 24952, 414, 1807, 198, 197, 630, 18185, 23910, 1669, 3056, 66194, 515, 197, 197, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestBQDatasetFromMetadata(t *testing.T) { dm := DatasetMetadataToUpdate{ Description: "desc", Name: "name", DefaultTableExpiration: time.Hour, } dm.SetLabel("label", "value") dm.DeleteLabel("del") got := bqDatasetFromMetadata(&dm) want := &bq.Dataset{ Description: "desc", FriendlyName: "name", DefaultTableExpirationMs: 60 * 60 * 1000, Labels: map[string]string{"label": "value"}, ForceSendFields: []string{"Description", "FriendlyName"}, NullFields: []string{"Labels.del"}, } if diff := testutil.Diff(got, want); diff != "" { t.Errorf("-got, +want:\n%s", diff) } }
explode_data.jsonl/70126
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 284 }
[ 2830, 3393, 33, 48, 33363, 3830, 14610, 1155, 353, 8840, 836, 8, 341, 2698, 76, 1669, 39183, 14610, 93919, 515, 197, 47414, 25, 330, 8614, 756, 197, 21297, 25, 286, 330, 606, 756, 197, 91084, 2556, 66301, 25, 882, 73550, 345, 197, 5...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestServerlessRecordCustomMetric(t *testing.T) { cfgFn := func(cfg *Config) { cfg.ServerlessMode.Enabled = true } app := testApp(nil, cfgFn, t) app.RecordCustomMetric("myMetric", 123.0) app.expectSingleLoggedError(t, "unable to record custom metric", map[string]interface{}{ "metric-name": "myMetric", "reason": errMetricServerless.Error(), }) }
explode_data.jsonl/52867
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 139 }
[ 2830, 3393, 5475, 1717, 6471, 10268, 54310, 1155, 353, 8840, 836, 8, 341, 50286, 24911, 1669, 2915, 28272, 353, 2648, 8, 314, 13286, 22997, 1717, 3636, 13690, 284, 830, 456, 28236, 1669, 1273, 2164, 27907, 11, 13286, 24911, 11, 259, 340...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestPruneFiles(t *testing.T) { // Create temp dir to test in dir := t.TempDir() files := []string{ "file1.txt", "file2.png", } // Create our test files for _, file := range files { path := filepath.Join(dir, file) f, err := os.Create(path) if err != nil { t.Fatalf("error creating test file: %s\n", err) } f.Close() } result, err := Prune(dir, 2) if err != nil { t.Fatalf("error counting files: %s\n", err) } // Check if the result is correct if result != 1 { t.Fatalf("pruned wrong number of files: expected 1, pruned %d", result) } }
explode_data.jsonl/30985
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 234 }
[ 2830, 3393, 3533, 2886, 10809, 1155, 353, 8840, 836, 8, 341, 197, 322, 4230, 2730, 5419, 311, 1273, 304, 198, 48532, 1669, 259, 65009, 6184, 2822, 74075, 1669, 3056, 917, 515, 197, 197, 1, 1192, 16, 3909, 756, 197, 197, 1, 1192, 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...
5
func TestJSONValuesMessage(t *testing.T) { timestamp := time.Unix(1, 0) values := []float64{ -0.5182926829268293, -0.3582317073170732, 0.1753048780487805, 0.20599365234375, -0.050048828125, 1.03582763671875, } msg := fmt.Sprintf(`{"ax": %v, "ay": %v, "az": %v, "gx": %v, "gy": %v, "gz": %v}`, values[0], values[1], values[2], values[3], values[4], values[5]) frame := plugin.ToFrame("test/data", []mqtt.Message{ { Timestamp: timestamp, Value: msg, }, }) numFields := len(values) + 1 require.NotNil(t, frame) require.Equal(t, numFields, len(frame.Fields)) v, ok := frame.Fields[0].ConcreteAt(0) require.Equal(t, true, ok) require.Equal(t, v, timestamp) for idx, val := range values { v, err := frame.Fields[idx+1].FloatAt(0) require.NoError(t, err) require.Equal(t, val, v) } }
explode_data.jsonl/79407
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 392 }
[ 2830, 3393, 5370, 6227, 2052, 1155, 353, 8840, 836, 8, 341, 3244, 4702, 1669, 882, 10616, 941, 7, 16, 11, 220, 15, 340, 45939, 1669, 3056, 3649, 21, 19, 515, 197, 197, 12, 15, 13, 20, 16, 23, 17, 24, 17, 21, 23, 17, 24, 17, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestWorker_DoTask_Err(t *testing.T) { // setup nopProducer, _ := bus.NewProducer(bus.NewOptions("nop")) cnclCtx, cncl := context.WithCancel(context.Background()) cncl() pths := []string{ "./test/test.json", } createdDates := []time.Time{ time.Date(2016, 01, 01, 00, 00, 00, 00, time.UTC), time.Date(2017, 01, 01, 00, 00, 00, 00, time.UTC), time.Date(2018, 01, 01, 00, 00, 00, 00, time.UTC), } // line sets lineSets := [][]string{ { `{"f1":"v1","f2":"v1","f3":"v1"}`, `{"f1":"v2","f2":"v1","f3":"v2"}`, }, } // scenario 1 file createFile(lineSets[0], pths[0], createdDates[0]) // case1: single file with duplicates type scenario struct { appOpt *options producer bus.Producer ctx context.Context info string expectedResult task.Result expectedMsg string } scenarios := []scenario{ // scenario : bad info (no dest-template) { appOpt: &options{}, producer: nopProducer, ctx: context.Background(), info: `?fields=f1`, expectedResult: task.ErrResult, expectedMsg: `dest-template required`, }, // scenario : bad info (bad sep fields) { appOpt: &options{}, producer: nopProducer, ctx: context.Background(), info: `?fields=f1&dest-template=./test/test.json`, expectedResult: task.ErrResult, expectedMsg: `src-path required`, }, // scenario : file does not exist { appOpt: &options{}, producer: nopProducer, ctx: context.Background(), info: "./test/doesnotexist.json?fields=0&dest-template=./test/test.json", expectedResult: task.ErrResult, expectedMsg: `no such file or directory`, }, // scenario : cancelled by context { appOpt: &options{}, producer: nopProducer, ctx: cnclCtx, // already cancelled info: "nop://test/test.json?fields=f1&dest-template=nop://test/output.json", expectedResult: task.ErrResult, expectedMsg: `task interrupted`, }, // scenario: err closing writer { appOpt: &options{}, producer: nopProducer, ctx: context.Background(), info: "./test/test.json?fields=f1&dest-template=nop://close_err/test.json", expectedResult: task.ErrResult, expectedMsg: `close_err`, }, // scenario: err writer init { appOpt: &options{}, producer: nopProducer, ctx: context.Background(), info: "./test/test.json?fields=f1&dest-template=nop://init_err/test.json", expectedResult: task.ErrResult, expectedMsg: `init_err`, }, } for sNum, s := range scenarios { appOpt := s.appOpt producer = s.producer wkr := appOpt.newWorker(s.info) gotRslt, gotMsg := wkr.DoTask(s.ctx) // check result if gotRslt != s.expectedResult { t.Errorf("scenario %v expected result '%v' but got '%v'", sNum+1, s.expectedResult, gotRslt) } // check msg if !strings.Contains(gotMsg, s.expectedMsg) { t.Errorf("scenario %v expected msg '%v' but got '%v'", sNum+1, s.expectedMsg, gotMsg) } } // cleanup os.RemoveAll("./test/") }
explode_data.jsonl/77120
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1490 }
[ 2830, 3393, 21936, 93481, 6262, 93623, 1155, 353, 8840, 836, 8, 341, 197, 322, 6505, 198, 9038, 453, 45008, 11, 716, 1669, 5828, 7121, 45008, 60872, 7121, 3798, 445, 62813, 5455, 1444, 77, 564, 23684, 11, 13665, 564, 1669, 2266, 26124, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestClient_UpdateServer_validation(t *testing.T) { var err error _, err = testClient.UpdateServer(&UpdateServerInput{ ServiceID: "", }) if err != ErrMissingServiceID { t.Errorf("bad error: %s", err) } _, err = testClient.UpdateServer(&UpdateServerInput{ ServiceID: "foo", PoolID: "", }) if err != ErrMissingPool { t.Errorf("bad error: %q", err) } _, err = testClient.UpdateServer(&UpdateServerInput{ ServiceID: "foo", PoolID: "bar", Server: "", }) if err != ErrMissingServer { t.Errorf("bad error: %q", err) } }
explode_data.jsonl/8322
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 225 }
[ 2830, 3393, 2959, 47393, 5475, 19416, 1155, 353, 8840, 836, 8, 341, 2405, 1848, 1465, 198, 197, 6878, 1848, 284, 1273, 2959, 16689, 5475, 2099, 4289, 5475, 2505, 515, 197, 91619, 915, 25, 8324, 197, 3518, 743, 1848, 961, 15495, 25080, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestDuplicateKeys(t *testing.T) { // this is vaild jsonStr according to the JSON spec var jsonStr = `{"name": "Alex","name": "Peter"}` if Parse(jsonStr).Get("name").String() != Parse(jsonStr).Map()["name"].String() { t.Fatalf("expected '%v', got '%v'", Parse(jsonStr).Get("name").String(), Parse(jsonStr).Map()["name"].String(), ) } if !Valid(jsonStr) { t.Fatal("should be valid") } }
explode_data.jsonl/43458
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 168 }
[ 2830, 3393, 53979, 8850, 1155, 353, 8840, 836, 8, 341, 197, 322, 419, 374, 348, 604, 67, 2951, 2580, 4092, 311, 279, 4718, 1398, 198, 2405, 2951, 2580, 284, 1565, 4913, 606, 788, 330, 27387, 2198, 606, 788, 330, 36559, 9207, 3989, 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 TestList(t *testing.T) { /* Create the following structure: mytestfiles mytestfiles/foo.js mytestfiles/subdir/bar.js */ dir := fs.NewDir(t, "mytestfiles", fs.WithFile("foo.js", "foo", fs.WithMode(0755)), fs.WithDir("mysubdir", fs.WithFile("bar.js", "bar", fs.WithMode(0755))), ) defer dir.Remove() type args struct { dir string pattern string } tests := []struct { name string args args want int wantErr bool }{ { name: "find all .js files", args: args{dir: dir.Path(), pattern: ".*.js"}, want: 2, wantErr: false, }, { name: "find one", args: args{dir: dir.Path(), pattern: "bar.js"}, want: 1, wantErr: false, }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { got, err := List(tt.args.dir, tt.args.pattern) if (err != nil) != tt.wantErr { t.Errorf("List() error = %v, wantErr %v", err, tt.wantErr) return } if len(got) != tt.want { t.Errorf("List() got = %v, which is %d in length, but want %d", got, len(got), tt.want) } }) } }
explode_data.jsonl/72031
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 526 }
[ 2830, 3393, 852, 1155, 353, 8840, 836, 8, 341, 197, 3284, 197, 75569, 279, 2701, 5944, 510, 298, 13624, 1944, 7198, 198, 298, 13624, 1944, 7198, 60555, 2857, 198, 298, 13624, 1944, 7198, 37885, 3741, 49513, 2857, 198, 197, 3276, 48532, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestMapProxy_SetWithNilValue(t *testing.T) { err := mp.Set("test", nil) AssertErrorNotNil(t, err, "set did not return an error for nil value") mp.Clear() }
explode_data.jsonl/57008
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 62 }
[ 2830, 3393, 2227, 16219, 14812, 2354, 19064, 1130, 1155, 353, 8840, 836, 8, 341, 9859, 1669, 10490, 4202, 445, 1944, 497, 2092, 340, 18017, 1454, 96144, 1155, 11, 1848, 11, 330, 746, 1521, 537, 470, 458, 1465, 369, 2092, 897, 1138, 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
func TestJobSpecsController_Create(t *testing.T) { t.Parallel() app, cleanup := cltest.NewApplication() defer cleanup() client := app.NewHTTPClient() resp, cleanup := client.Post("/v2/specs", bytes.NewBuffer(cltest.LoadJSON("../internal/fixtures/web/hello_world_job.json"))) defer cleanup() cltest.AssertServerResponse(t, resp, 200) var j models.JobSpec err := cltest.ParseJSONAPIResponse(resp, &j) require.NoError(t, err) adapter1, _ := adapters.For(j.Tasks[0], app.Store) httpGet := adapter1.BaseAdapter.(*adapters.HTTPGet) assert.Equal(t, httpGet.URL.String(), "https://bitstamp.net/api/ticker/") adapter2, _ := adapters.For(j.Tasks[1], app.Store) jsonParse := adapter2.BaseAdapter.(*adapters.JSONParse) assert.Equal(t, []string(jsonParse.Path), []string{"last"}) adapter4, _ := adapters.For(j.Tasks[3], app.Store) signTx := adapter4.BaseAdapter.(*adapters.EthTx) assert.Equal(t, "0x356a04bCe728ba4c62A30294A55E6A8600a320B3", signTx.Address.String()) assert.Equal(t, "0x609ff1bd", signTx.FunctionSelector.String()) var initr models.Initiator app.Store.One("JobID", j.ID, &initr) assert.Equal(t, models.InitiatorWeb, initr.Type) assert.NotEqual(t, models.Time{}, j.CreatedAt) }
explode_data.jsonl/53686
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 480 }
[ 2830, 3393, 12245, 8327, 82, 2051, 34325, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 2822, 28236, 11, 21290, 1669, 1185, 1944, 7121, 4988, 741, 16867, 21290, 741, 25291, 1669, 906, 7121, 9230, 2959, 2822, 34653, 11, 21290, 1669, 2...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestModifyOrder(t *testing.T) { t.Parallel() _, err := b.ModifyOrder(context.Background(), &order.Modify{AssetType: asset.Spot}) if err == nil { t.Error("ModifyOrder() error cannot be nil") } }
explode_data.jsonl/76673
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 80 }
[ 2830, 3393, 44427, 4431, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 741, 197, 6878, 1848, 1669, 293, 23127, 1437, 4431, 5378, 19047, 3148, 197, 197, 5, 1358, 23127, 1437, 90, 16604, 929, 25, 9329, 808, 19099, 3518, 743, 1848, 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 ]
2
func TestVisitor(t *testing.T) { d := ABData{A: 111, B: 222} add := &AddVisitor{} sub := &SubVisitor{} d.Accept(add) d.Accept(sub) }
explode_data.jsonl/24667
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 65 }
[ 2830, 3393, 16796, 1155, 353, 8840, 836, 8, 341, 2698, 1669, 14137, 1043, 90, 32, 25, 220, 16, 16, 16, 11, 425, 25, 220, 17, 17, 17, 532, 12718, 1669, 609, 2212, 16796, 16094, 28624, 1669, 609, 3136, 16796, 16094, 2698, 52265, 25906...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestEtcdGetController(t *testing.T) { ctx := api.NewDefaultContext() fakeClient := tools.NewFakeEtcdClient(t) key, _ := makeControllerKey(ctx, "foo") fakeClient.Set(key, runtime.EncodeOrDie(latest.Codec, &api.ReplicationController{TypeMeta: api.TypeMeta{ID: "foo"}}), 0) registry := NewTestEtcdRegistry(fakeClient) ctrl, err := registry.GetController(ctx, "foo") if err != nil { t.Errorf("unexpected error: %v", err) } if ctrl.ID != "foo" { t.Errorf("Unexpected controller: %#v", ctrl) } }
explode_data.jsonl/8158
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 196 }
[ 2830, 3393, 31860, 4385, 1949, 2051, 1155, 353, 8840, 836, 8, 341, 20985, 1669, 6330, 7121, 3675, 1972, 741, 1166, 726, 2959, 1669, 7375, 7121, 52317, 31860, 4385, 2959, 1155, 340, 23634, 11, 716, 1669, 1281, 2051, 1592, 7502, 11, 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...
3
func TestMulInt(t *testing.T) { tests := []struct { in1 string // in2 uint // expected string //预期十六进制编码值 }{ {"0", 0, "0"}, {"1", 0, "0"}, {"0", 1, "0"}, {"1", 1, "1"}, // { "fffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2e", 2, "fffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2d", }, //secp256k1素数*3 {"fffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f", 3, "0"}, // { "fffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2e", 8, "fffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc27", }, // // // { "b75674dc9180d306c692163ac5e089f7cef166af99645c0c23568ab6d967288a", 6, "4c06bd2b6904f228a76c8560a3433bced9a8681d985a2848d407404d186b0280", }, { "54873298ac2b5ba8591c125ae54931f5ea72040aee07b208d6135476fb5b9c0e", 3, "fd9597ca048212f90b543710afdb95e1bf560c20ca17161a8239fd64f212d42a", }, { "7c30fbd363a74c17e1198f56b090b59bbb6c8755a74927a6cba7a54843506401", 5, "6cf4eb20f2447c77657fccb172d38c0aa91ea4ac446dc641fa463a6b5091fba7", }, { "fb4529be3e027a3d1587d8a500b72f2d312e3577340ef5175f96d113be4c2ceb", 8, "da294df1f013d1e8ac3ec52805b979698971abb9a077a8bafcb688a4f261820f", }, } t.Logf("Running %d tests", len(tests)) for i, test := range tests { f := new(fieldVal).SetHex(test.in1).Normalize() expected := new(fieldVal).SetHex(test.expected).Normalize() result := f.MulInt(test.in2).Normalize() if !result.Equals(expected) { t.Errorf("fieldVal.MulInt #%d wrong result\n"+ "got: %v\nwant: %v", i, result, expected) continue } } }
explode_data.jsonl/366
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 862 }
[ 2830, 3393, 59155, 1072, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 3056, 1235, 341, 258, 16, 414, 914, 6475, 258, 17, 414, 2622, 256, 6475, 7325, 914, 442, 104394, 102853, 41299, 43316, 112950, 25511, 198, 197, 59403, 197, 197, 4913, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestInstallConfigGenerate(t *testing.T) { cases := []struct { name string platformContents []string expectedPlatformYaml string }{ { name: "aws", platformContents: []string{ "aws", "test-region", }, expectedPlatformYaml: ` aws: region: test-region vpcCIDRBlock: "" vpcID: ""`, }, { name: "libvirt", platformContents: []string{ "libvirt", "test-uri", }, expectedPlatformYaml: ` libvirt: URI: test-uri masterIPs: null network: if: "" ipRange: "" name: "" resolver: ""`, }, } for _, tc := range cases { t.Run(tc.name, func(t *testing.T) { stock := &StockImpl{ clusterID: &testAsset{}, emailAddress: &testAsset{}, password: &testAsset{}, sshKey: &testAsset{}, baseDomain: &testAsset{}, clusterName: &testAsset{}, license: &testAsset{}, pullSecret: &testAsset{}, platform: &testAsset{}, } dir, err := ioutil.TempDir("", "TestInstallConfigGenerate") if err != nil { t.Skipf("could not create temporary directory: %v", err) } defer os.RemoveAll(dir) installConfig := &installConfig{ assetStock: stock, directory: dir, } states := map[asset.Asset]*asset.State{ stock.clusterID: { Contents: []asset.Content{{Data: []byte("test-cluster-id")}}, }, stock.emailAddress: { Contents: []asset.Content{{Data: []byte("test-email")}}, }, stock.password: { Contents: []asset.Content{{Data: []byte("test-password")}}, }, stock.sshKey: { Contents: []asset.Content{{Data: []byte("test-sshkey")}}, }, stock.baseDomain: { Contents: []asset.Content{{Data: []byte("test-domain")}}, }, stock.clusterName: { Contents: []asset.Content{{Data: []byte("test-cluster-name")}}, }, stock.license: { Contents: []asset.Content{{Data: []byte("test-license")}}, }, stock.pullSecret: { Contents: []asset.Content{{Data: []byte("test-pull-secret")}}, }, stock.platform: { Contents: make([]asset.Content, len(tc.platformContents)), }, } for i, c := range tc.platformContents { states[stock.platform].Contents[i].Data = []byte(c) } state, err := installConfig.Generate(states) assert.NoError(t, err, "unexpected error generating asset") assert.NotNil(t, state, "unexpected nil for asset state") filename := filepath.Join(dir, "install-config.yml") assert.Equal(t, 1, len(state.Contents), "unexpected number of contents in asset state") assert.Equal(t, filename, state.Contents[0].Name, "unexpected filename in asset state") exp := fmt.Sprintf(`admin: email: test-email password: test-password sshKey: test-sshkey baseDomain: test-domain clusterID: test-cluster-id license: test-license machines: null metadata: creationTimestamp: null name: test-cluster-name networking: podCIDR: IP: "" Mask: null serviceCIDR: IP: "" Mask: null type: "" platform: %s pullSecret: test-pull-secret `, tc.expectedPlatformYaml) assert.Equal(t, exp, string(state.Contents[0].Data), "unexpected data in install-config.yml") }) } }
explode_data.jsonl/75055
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1380 }
[ 2830, 3393, 24690, 2648, 31115, 1155, 353, 8840, 836, 8, 341, 1444, 2264, 1669, 3056, 1235, 341, 197, 11609, 338, 914, 198, 197, 197, 15734, 14803, 257, 3056, 917, 198, 197, 42400, 17296, 56, 9467, 914, 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...
3
func TestReportWorkflowResource_ScheduledWorkflowIDNotEmpty_Success(t *testing.T) { store, manager, job := initWithJob(t) defer store.Close() // report workflow workflow := util.NewWorkflow(&v1alpha1.Workflow{ ObjectMeta: v1.ObjectMeta{ Name: "MY_NAME", Namespace: "MY_NAMESPACE", UID: "WORKFLOW_1", OwnerReferences: []v1.OwnerReference{{ APIVersion: "kubeflow.org/v1beta1", Kind: "ScheduledWorkflow", Name: "SCHEDULE_NAME", UID: types.UID(job.UUID), }}, CreationTimestamp: v1.NewTime(time.Unix(11, 0).UTC()), }, }) err := manager.ReportWorkflowResource(workflow) assert.Nil(t, err) runDetail, err := manager.GetRun("WORKFLOW_1") assert.Nil(t, err) expectedRunDetail := &model.RunDetail{ Run: model.Run{ UUID: "WORKFLOW_1", DisplayName: "MY_NAME", StorageState: api.Run_STORAGESTATE_AVAILABLE.String(), Name: "MY_NAME", Namespace: "MY_NAMESPACE", CreatedAtInSec: 11, ScheduledAtInSec: 0, FinishedAtInSec: 0, PipelineSpec: model.PipelineSpec{ WorkflowSpecManifest: workflow.GetSpec().ToStringForStore(), }, ResourceReferences: []*model.ResourceReference{ { ResourceUUID: "WORKFLOW_1", ResourceType: common.Run, ReferenceUUID: job.UUID, ReferenceType: common.Job, Relationship: common.Creator, }, { ResourceUUID: "WORKFLOW_1", ResourceType: common.Run, ReferenceUUID: DefaultFakeUUID, ReferenceType: common.Experiment, Relationship: common.Owner, }, }, }, PipelineRuntime: model.PipelineRuntime{WorkflowRuntimeManifest: workflow.ToStringForStore()}, } assert.Equal(t, expectedRunDetail, runDetail) }
explode_data.jsonl/28390
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 796 }
[ 2830, 3393, 10361, 62768, 4783, 1098, 26644, 62768, 915, 27416, 87161, 1155, 353, 8840, 836, 8, 341, 57279, 11, 6645, 11, 2618, 1669, 13864, 12245, 1155, 340, 16867, 3553, 10421, 2822, 197, 322, 1895, 28288, 198, 197, 56249, 1669, 4094, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestFindAllPasswords(t *testing.T) { t.Run("check FindAllPasswords", func(t *testing.T) { got := FindAllPasswords("111111", "111112") want := 2 if got != want { log.Fatalf("want: %d, got: %d", want, got) } }) t.Run("check hasAdjacentNumber", func(t *testing.T) { got := hasAdjacentNumber(111111) want := true if got != want { log.Fatalf("want: %t, got: %t", want, got) } }) t.Run("get part 1 result", func(t *testing.T) { got := FindAllPasswords("197487", "673251") fmt.Println(got) }) }
explode_data.jsonl/28614
{ "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, 9885, 2403, 84546, 1155, 353, 8840, 836, 8, 341, 3244, 16708, 445, 2028, 7379, 2403, 84546, 497, 2915, 1155, 353, 8840, 836, 8, 341, 197, 3174, 354, 1669, 7379, 2403, 84546, 445, 16, 16, 16, 16, 16, 16, 497, 330, 16, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestOptRuleBlacklist(t *testing.T) { store, clean := testkit.CreateMockStore(t) defer clean() tk := testkit.NewTestKit(t, store) tk.MustQuery(`select * from mysql.opt_rule_blacklist`).Check(testkit.Rows()) }
explode_data.jsonl/65491
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 82 }
[ 2830, 3393, 21367, 11337, 14417, 1607, 1155, 353, 8840, 836, 8, 341, 57279, 11, 4240, 1669, 1273, 8226, 7251, 11571, 6093, 1155, 340, 16867, 4240, 2822, 3244, 74, 1669, 1273, 8226, 7121, 2271, 7695, 1155, 11, 3553, 340, 3244, 74, 50463,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestCommitBeforeApply(t *testing.T) { ctrl := gomock.NewController(t) defer ctrl.Finish() rangeManager := mock.NewMockentryCataloger(ctrl) rocks := onboard.NewCatalogRepoActions(&onboard.Config{ CommitUsername: committer, RepositoryID: repoID, DefaultBranchID: "master", EntryCatalog: rangeManager, }, logging.Default()) retCommitID, err := rocks.Commit(context.Background(), msg, nil) require.Error(t, err) require.Equal(t, "", retCommitID) require.Equal(t, onboard.ErrNoMetaRange, err) }
explode_data.jsonl/31617
{ "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, 33441, 10227, 28497, 1155, 353, 8840, 836, 8, 341, 84381, 1669, 342, 316, 1176, 7121, 2051, 1155, 340, 16867, 23743, 991, 18176, 741, 75087, 2043, 1669, 7860, 7121, 11571, 4085, 41606, 261, 62100, 692, 197, 299, 14553, 1669, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestNewLRUCache(t *testing.T) { t.Parallel() size := 2000 c, _ := lru.New(2000) type args struct { size int } tests := []struct { name string args args want *LRU }{ { name: "Test_NewLRUCache_OK", args: args{size: size}, want: &LRU{ Cache: c, }, }, } for _, tt := range tests { tt := tt t.Run(tt.name, func(t *testing.T) { t.Parallel() if got := NewLRUCache(tt.args.size); !reflect.DeepEqual(got, tt.want) { t.Errorf("NewLRUCache() = %v, want %v", got, tt.want) } }) } }
explode_data.jsonl/46945
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 267 }
[ 2830, 3393, 3564, 20117, 5459, 1777, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 2822, 13832, 1669, 220, 17, 15, 15, 15, 198, 1444, 11, 716, 1669, 326, 2672, 7121, 7, 17, 15, 15, 15, 692, 13158, 2827, 2036, 341, 197, 13832, 5...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestFilterMatchDefault(t *testing.T) { p, err := graphite.NewParser([]string{"servers.localhost .host.measurement*"}, nil) if err != nil { t.Fatalf("unexpected error creating parser, got %v", err) } exp := models.MustNewPoint("miss.servers.localhost.cpu_load", models.NewTags(map[string]string{}), models.Fields{"value": float64(11)}, time.Unix(1435077219, 0)) pt, err := p.Parse("miss.servers.localhost.cpu_load 11 1435077219") if err != nil { t.Fatalf("parse error: %v", err) } if exp.String() != pt.String() { t.Errorf("parse mismatch: got %v, exp %v", pt.String(), exp.String()) } }
explode_data.jsonl/32177
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 237 }
[ 2830, 3393, 5632, 8331, 3675, 1155, 353, 8840, 836, 8, 341, 3223, 11, 1848, 1669, 94173, 7121, 6570, 10556, 917, 4913, 67696, 13, 8301, 659, 3790, 17326, 24359, 9, 14345, 2092, 340, 743, 1848, 961, 2092, 341, 197, 3244, 30762, 445, 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...
4
func TestFlowAggregator_sendFlowKeyRecord(t *testing.T) { ctrl := gomock.NewController(t) defer ctrl.Finish() mockIPFIXExpProc := ipfixtest.NewMockIPFIXExportingProcess(ctrl) mockIPFIXRegistry := ipfixtest.NewMockIPFIXRegistry(ctrl) mockDataSet := ipfixentitiestesting.NewMockSet(ctrl) mockRecord := ipfixentitiestesting.NewMockRecord(ctrl) mockAggregationProcess := ipfixtest.NewMockIPFIXAggregationProcess(ctrl) fa := &flowAggregator{ externalFlowCollectorAddr: "", externalFlowCollectorProto: "", aggregatorTransportProtocol: "tcp", aggregationProcess: mockAggregationProcess, activeFlowRecordTimeout: testActiveTimeout, inactiveFlowRecordTimeout: testInactiveTimeout, exportingProcess: mockIPFIXExpProc, templateIDv4Expv4: testTemplateIDv4Expv4, templateIDv4Expv6: testTemplateIDv4Expv6, templateIDv6Expv4: testTemplateIDv6Expv4, templateIDv6Expv6: testTemplateIDv6Expv6, registry: mockIPFIXRegistry, set: mockDataSet, flowAggregatorAddress: "", observationDomainID: testObservationDomainID, } ipv4Key := ipfixintermediate.FlowKey{ SourceAddress: "10.0.0.1", DestinationAddress: "10.0.0.2", Protocol: 6, SourcePort: 1234, DestinationPort: 5678, } ipv6Key := ipfixintermediate.FlowKey{ SourceAddress: "2001:0:3238:dfe1:63::fefb", DestinationAddress: "2001:0:3238:dfe1:63::fefc", Protocol: 6, SourcePort: 1234, DestinationPort: 5678, } readyRecord := &ipfixintermediate.AggregationFlowRecord{ Record: mockRecord, ReadyToSend: true, } testcases := []struct { name string isIPv6 bool flowKey ipfixintermediate.FlowKey flowRecord *ipfixintermediate.AggregationFlowRecord }{ { "IPv4_ready_to_send", false, ipv4Key, readyRecord, }, { "IPv6_ready_to_send", true, ipv6Key, readyRecord, }, } for _, tc := range testcases { templateID := fa.templateIDv4Expv4 if tc.isIPv6 { templateID = fa.templateIDv6Expv6 } mockDataSet.EXPECT().ResetSet() mockDataSet.EXPECT().PrepareSet(ipfixentities.Data, templateID).Return(nil) elementList := make([]*ipfixentities.InfoElementWithValue, 0) mockRecord.EXPECT().GetOrderedElementList().Return(elementList) mockDataSet.EXPECT().AddRecord(elementList, templateID).Return(nil) mockIPFIXExpProc.EXPECT().SendSet(mockDataSet).Return(0, nil) mockAggregationProcess.EXPECT().ResetStatElementsInRecord(mockRecord).Return(nil) mockAggregationProcess.EXPECT().AreCorrelatedFieldsFilled(*tc.flowRecord).Return(false) mockAggregationProcess.EXPECT().SetCorrelatedFieldsFilled(tc.flowRecord) mockAggregationProcess.EXPECT().IsExporterOfAggregatedRecordIPv4(*tc.flowRecord).Return(!tc.isIPv6) mockAggregationProcess.EXPECT().IsAggregatedRecordIPv4(*tc.flowRecord).Return(!tc.isIPv6) err := fa.sendFlowKeyRecord(tc.flowKey, tc.flowRecord) assert.NoError(t, err, "Error in sending flow key record: %v, key: %v, record: %v", err, tc.flowKey, tc.flowRecord) } }
explode_data.jsonl/24304
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1358 }
[ 2830, 3393, 18878, 9042, 58131, 13565, 18878, 1592, 6471, 1155, 353, 8840, 836, 8, 341, 84381, 1669, 342, 316, 1176, 7121, 2051, 1155, 340, 16867, 23743, 991, 18176, 2822, 77333, 3298, 39690, 8033, 24508, 1669, 5997, 5743, 1944, 7121, 115...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestLookupLonger(t *testing.T) { tbl := NewTable(bgp.RF_IPv4_UC) tbl.setDestination(NewDestination(bgp.NewIPAddrPrefix(23, "11.0.0.0"), 0)) tbl.setDestination(NewDestination(bgp.NewIPAddrPrefix(24, "11.0.0.0"), 0)) tbl.setDestination(NewDestination(bgp.NewIPAddrPrefix(32, "11.0.0.4"), 0)) tbl.setDestination(NewDestination(bgp.NewIPAddrPrefix(32, "11.0.0.129"), 0)) tbl.setDestination(NewDestination(bgp.NewIPAddrPrefix(28, "11.0.0.144"), 0)) tbl.setDestination(NewDestination(bgp.NewIPAddrPrefix(29, "11.0.0.144"), 0)) tbl.setDestination(NewDestination(bgp.NewIPAddrPrefix(32, "11.0.0.145"), 0)) r, _ := tbl.GetLongerPrefixDestinations("11.0.0.128/25") assert.Equal(t, len(r), 4) r, _ = tbl.GetLongerPrefixDestinations("11.0.0.0/24") assert.Equal(t, len(r), 6) }
explode_data.jsonl/6673
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 371 }
[ 2830, 3393, 34247, 6583, 261, 1155, 353, 8840, 836, 8, 341, 3244, 2024, 1669, 1532, 2556, 1883, 21888, 2013, 37, 16607, 85, 19, 80314, 692, 3244, 2024, 980, 33605, 35063, 33605, 1883, 21888, 7121, 3298, 13986, 14335, 7, 17, 18, 11, 33...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestEmptyProperties(t *testing.T) { pomStr := `<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.example</groupId> <artifactId>my-app</artifactId> <version>1.0.0-SNAPSHOT</version> <packaging>jar</packaging> <name>My App</name> <parent> <groupId>fr.creekorful</groupId> <artifactId>parent-project</artifactId> <version>1.0.0-SNAPSHOT</version> </parent> <properties> </properties> </project>` var project MavenProject if err := xml.Unmarshal([]byte(pomStr), &project); err != nil { t.Errorf("unable to unmarshal pom file. Reason: %s", err) } if len(project.Properties) != 0 { t.Error("property map should be empty") } }
explode_data.jsonl/41670
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 418 }
[ 2830, 3393, 3522, 7903, 1155, 353, 8840, 836, 8, 341, 3223, 316, 2580, 1669, 1565, 1316, 6455, 2319, 428, 16, 13, 15, 1, 11170, 428, 8561, 12, 23, 85990, 27, 4987, 24967, 428, 1254, 1110, 76, 5276, 5096, 2659, 16341, 1898, 14, 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...
3
func TestContainerNaming(t *testing.T) { podUID := "12345678" verifyPackUnpack(t, "file", podUID, "name", "container") verifyPackUnpack(t, "file", podUID, "name-with-dashes", "container") // UID is same as pod name verifyPackUnpack(t, "file", podUID, podUID, "container") // No Container name verifyPackUnpack(t, "other", podUID, "name", "") container := &api.Container{Name: "container"} podName := "foo" podNamespace := "test" name := fmt.Sprintf("k8s_%s_%s_%s_%s_42", container.Name, podName, podNamespace, podUID) podFullName := fmt.Sprintf("%s_%s", podName, podNamespace) returned, hash, err := ParseDockerName(name) if err != nil { t.Errorf("Failed to parse Docker container name %q: %v", name, err) } if returned.PodFullName != podFullName || string(returned.PodUID) != podUID || returned.ContainerName != container.Name || hash != 0 { t.Errorf("unexpected parse: %s %s %s %d", returned.PodFullName, returned.PodUID, returned.ContainerName, hash) } }
explode_data.jsonl/11443
{ "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, 4502, 85410, 1155, 353, 8840, 836, 8, 341, 3223, 347, 6463, 1669, 330, 16, 17, 18, 19, 20, 21, 22, 23, 698, 93587, 30684, 1806, 4748, 1155, 11, 330, 1192, 497, 7509, 6463, 11, 330, 606, 497, 330, 3586, 1138, 93587, 306...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestIsNeedQuoted(t *testing.T) { if !token.IsNeedQuoted("true") { t.Fatal("failed to quoted judge for boolean") } if !token.IsNeedQuoted("1.234") { t.Fatal("failed to quoted judge for number") } if !token.IsNeedQuoted("1:1") { t.Fatal("failed to quoted judge for time") } if !token.IsNeedQuoted("hoge # comment") { t.Fatal("failed to quoted judge for comment") } if !token.IsNeedQuoted("\\0") { t.Fatal("failed to quoted judge for escaped token") } if token.IsNeedQuoted("Hello World") { t.Fatal("failed to unquoted judge") } }
explode_data.jsonl/9940
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 217 }
[ 2830, 3393, 3872, 23657, 2183, 9253, 1155, 353, 8840, 836, 8, 341, 743, 753, 5839, 4506, 23657, 2183, 9253, 445, 1866, 899, 341, 197, 3244, 26133, 445, 16091, 311, 23237, 11651, 369, 2710, 1138, 197, 532, 743, 753, 5839, 4506, 23657, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
7
func TestPingRegistryEndpoint(t *testing.T) { ep, err := NewEndpoint(makeURL("/v1/"), false) if err != nil { t.Fatal(err) } regInfo, err := ep.Ping() if err != nil { t.Fatal(err) } assertEqual(t, regInfo.Standalone, true, "Expected standalone to be true (default)") }
explode_data.jsonl/78253
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 116 }
[ 2830, 3393, 69883, 15603, 27380, 1155, 353, 8840, 836, 8, 341, 96626, 11, 1848, 1669, 1532, 27380, 36944, 3144, 4283, 85, 16, 14, 3975, 895, 340, 743, 1848, 961, 2092, 341, 197, 3244, 26133, 3964, 340, 197, 532, 37013, 1731, 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...
3
func TestBdevBackendUpdate(t *testing.T) { numCtrlrs := 4 controllers := make(storage.NvmeControllers, 0, numCtrlrs) for i := 0; i < numCtrlrs; i++ { c := mockSpdkController(int32(i)) controllers = append(controllers, &c) } for name, tc := range map[string]struct { pciAddr string mec spdk.MockEnvCfg mnc spdk.MockNvmeCfg expErr error }{ "init failed": { pciAddr: controllers[0].PciAddr, mec: spdk.MockEnvCfg{ InitErr: errors.New("spdk init says no"), }, mnc: spdk.MockNvmeCfg{ DiscoverCtrlrs: controllers, }, expErr: errors.New("spdk init says no"), }, "not found": { pciAddr: "NotReal", mnc: spdk.MockNvmeCfg{ DiscoverCtrlrs: controllers, }, expErr: FaultPCIAddrNotFound("NotReal"), }, "binding update fail": { pciAddr: controllers[0].PciAddr, mnc: spdk.MockNvmeCfg{ DiscoverCtrlrs: controllers, UpdateErr: errors.New("spdk says no"), }, expErr: errors.New("spdk says no"), }, "binding update success": { pciAddr: controllers[0].PciAddr, mnc: spdk.MockNvmeCfg{ DiscoverCtrlrs: controllers, }, expErr: nil, }, } { t.Run(name, func(t *testing.T) { log, buf := logging.NewTestLogger(name) defer common.ShowBufferOnFailure(t, buf) b := backendWithMockBinding(log, tc.mec, tc.mnc) gotErr := b.UpdateFirmware(tc.pciAddr, "/some/path", 0) common.CmpErr(t, tc.expErr, gotErr) }) } }
explode_data.jsonl/28413
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 684 }
[ 2830, 3393, 33, 3583, 29699, 4289, 1155, 353, 8840, 836, 8, 341, 22431, 15001, 5428, 1669, 220, 19, 198, 197, 21611, 1669, 1281, 52463, 2067, 85, 2660, 14353, 11, 220, 15, 11, 1629, 15001, 5428, 340, 2023, 600, 1669, 220, 15, 26, 60...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestCancelSwapOrders(t *testing.T) { t.Parallel() if !areTestAPIKeysSet() || !canManipulateRealOrders { t.Skip("skipping test, either api keys or manipulaterealorders isnt set correctly") } _, err := c.CancelSwapOrders([]string{"578639816552972288", "578639902896914432"}) if err != nil { t.Error(err) } }
explode_data.jsonl/42951
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 128 }
[ 2830, 3393, 9269, 46179, 24898, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 741, 743, 753, 546, 2271, 7082, 8850, 1649, 368, 1369, 753, 4814, 92876, 6334, 12768, 24898, 341, 197, 3244, 57776, 445, 4886, 5654, 1273, 11, 2987, 6330, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
4
func TestReportWorkflowResource_WorkflowCompleted_FinalStatePersisted_DeleteFailed(t *testing.T) { store, manager, run := initWithOneTimeRun(t) manager.argoClient = client.NewFakeArgoClientWithBadWorkflow() defer store.Close() // report workflow workflow := util.NewWorkflow(&v1alpha1.Workflow{ ObjectMeta: v1.ObjectMeta{ Name: run.Name, Namespace: "ns1", UID: types.UID(run.UUID), Labels: map[string]string{util.LabelKeyWorkflowRunId: run.UUID, util.LabelKeyWorkflowPersistedFinalState: "true"}, }, Status: v1alpha1.WorkflowStatus{Phase: v1alpha1.NodeFailed}, }) err := manager.ReportWorkflowResource(workflow) assert.NotNil(t, err) assert.Contains(t, err.Error(), "failed to delete workflow") }
explode_data.jsonl/77062
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 276 }
[ 2830, 3393, 10361, 62768, 4783, 87471, 4965, 22724, 77072, 1397, 61267, 291, 57418, 9408, 1155, 353, 8840, 836, 8, 341, 57279, 11, 6645, 11, 1598, 1669, 13864, 3966, 1462, 6727, 1155, 340, 92272, 13, 12088, 2959, 284, 2943, 7121, 52317, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestDomains_GetRecordforDomainName(t *testing.T) { setup() defer teardown() mux.HandleFunc("/v2/domains/example.com/records/1", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, http.MethodGet) fmt.Fprint(w, `{"domain_record":{"id":1}}`) }) record, _, err := client.Domains.Record(ctx, "example.com", 1) if err != nil { t.Errorf("Domains.GetRecord returned error: %v", err) } expected := &DomainRecord{ID: 1} if !reflect.DeepEqual(record, expected) { t.Errorf("Domains.GetRecord returned %+v, expected %+v", record, expected) } }
explode_data.jsonl/22676
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 225 }
[ 2830, 3393, 74713, 13614, 6471, 1958, 13636, 675, 1155, 353, 8840, 836, 8, 341, 84571, 741, 16867, 49304, 2822, 2109, 2200, 63623, 4283, 85, 17, 71344, 1735, 65182, 905, 14, 26203, 14, 16, 497, 2915, 3622, 1758, 37508, 11, 435, 353, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestDeciding_ExecuteInbound(t *testing.T) { ctrl := gomock.NewController(t) defer ctrl.Finish() t.Run("handles inbound message", func(t *testing.T) { messenger := serviceMocks.NewMockMessenger(ctrl) messenger.EXPECT().ReplyTo(gomock.Any(), gomock.Any()).Return(nil) followup, action, err := (&deciding{}).ExecuteInbound(messenger, &metaData{ transitionalPayload: transitionalPayload{Action: Action{Msg: service.NewDIDCommMsgMap(struct{}{})}}, }) require.NoError(t, err) require.NoError(t, action()) require.Equal(t, &waiting{}, followup) }) t.Run("adds attachment", func(t *testing.T) { expected := &decorator.Attachment{ ID: uuid.New().String(), } messenger := serviceMocks.NewMockMessenger(ctrl) messenger.EXPECT().ReplyTo(gomock.Any(), gomock.Any()).DoAndReturn( func(_ string, msg service.DIDCommMsgMap) error { result := &Response{} err := msg.Decode(result) require.NoError(t, err) require.Len(t, result.Attachments, 1) require.Equal(t, expected, result.Attachments[0]) return nil }, ).Times(1) msg := service.NewDIDCommMsgMap(struct{}{}) msg.Metadata()[metaAttachment] = []*decorator.Attachment{expected} _, action, err := (&deciding{}).ExecuteInbound(messenger, &metaData{ transitionalPayload: transitionalPayload{Action: Action{Msg: msg}}, }) require.NoError(t, err) err = action() require.NoError(t, err) }) t.Run("fails if attachments used improperly", func(t *testing.T) { messenger := serviceMocks.NewMockMessenger(ctrl) messenger.EXPECT().ReplyTo(gomock.Any(), gomock.Any()).MaxTimes(0) msg := service.NewDIDCommMsgMap(struct{}{}) msg.Metadata()[metaAttachment] = []struct{}{} _, action, err := (&deciding{}).ExecuteInbound(messenger, &metaData{ transitionalPayload: transitionalPayload{Action: Action{Msg: msg}}, }) require.NoError(t, err) err = action() require.Error(t, err) }) }
explode_data.jsonl/66252
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 753 }
[ 2830, 3393, 4900, 6577, 83453, 641, 10891, 1155, 353, 8840, 836, 8, 341, 84381, 1669, 342, 316, 1176, 7121, 2051, 1155, 340, 16867, 23743, 991, 18176, 2822, 3244, 16708, 445, 43931, 64943, 1943, 497, 2915, 1155, 353, 8840, 836, 8, 341, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestLocale(t *testing.T) { trans := New() expected := "nl_CW" if trans.Locale() != expected { t.Errorf("Expected '%s' Got '%s'", expected, trans.Locale()) } }
explode_data.jsonl/45056
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 70 }
[ 2830, 3393, 19231, 1155, 353, 8840, 836, 8, 1476, 72453, 1669, 1532, 741, 42400, 1669, 330, 15643, 920, 54, 1837, 743, 1356, 59094, 368, 961, 3601, 341, 197, 3244, 13080, 445, 18896, 7677, 82, 6, 24528, 7677, 82, 22772, 3601, 11, 1356...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestAccessReviewCheckOnMissingNamespace(t *testing.T) { namespace := "test/test" mockClient := newMockClientForTest(map[string]v1.NamespacePhase{}, map[string]v1.TenantPhase{}) mockClient.AddReactor("get", "namespaces", func(action core.Action) (bool, runtime.Object, error) { return true, nil, fmt.Errorf("nope, out of luck") }) handler, informerFactory, err := newHandlerForTest(mockClient) if err != nil { t.Errorf("unexpected error initializing handler: %v", err) } informerFactory.Start(wait.NeverStop) err = handler.Admit(admission.NewAttributesRecord(nil, nil, schema.GroupVersionKind{Group: "authorization.k8s.io", Version: "v1", Kind: "LocalSubjectAccesReview"}, metav1.TenantSystem, namespace, "", schema.GroupVersionResource{Group: "authorization.k8s.io", Version: "v1", Resource: "localsubjectaccessreviews"}, "", admission.Create, &metav1.CreateOptions{}, false, nil), nil) if err != nil { t.Error(err) } }
explode_data.jsonl/69155
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 324 }
[ 2830, 3393, 6054, 19432, 3973, 1925, 25080, 22699, 1155, 353, 8840, 836, 8, 341, 56623, 1669, 330, 1944, 12697, 698, 77333, 2959, 1669, 501, 11571, 2959, 2461, 2271, 9147, 14032, 60, 85, 16, 46011, 30733, 22655, 2415, 14032, 60, 85, 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 TestMultipleRegions(t *testing.T) { t.Parallel() g := gomega.NewGomegaWithT(t) // Set the logger to development mode for verbose logs. logf.SetLogger(zap.New(zap.UseDevMode(true))) namespaced := types.NamespacedName{ Name: "read-test", Namespace: "default", } application := &app.FybrikApplication{} g.Expect(readObjectFromFile("../../testdata/unittests/data-usage.yaml", application)).NotTo(gomega.HaveOccurred()) application.Spec.Data[0] = app.DataContext{ DataSetID: "s3-external/redact-dataset", Requirements: app.DataRequirements{Interface: app.InterfaceDetails{Protocol: app.ArrowFlight, DataFormat: app.Arrow}}, } application.SetGeneration(1) // Objects to track in the fake client. objs := []runtime.Object{ application, } // Register operator types with the runtime scheme. s := utils.NewScheme(g) // Create a fake client to mock API calls. cl := fake.NewFakeClientWithScheme(s, objs...) // Read module readModule := &app.FybrikModule{} g.Expect(readObjectFromFile("../../testdata/unittests/module-read-parquet.yaml", readModule)).NotTo(gomega.HaveOccurred()) readModule.Namespace = utils.GetControllerNamespace() g.Expect(cl.Create(context.TODO(), readModule)).NotTo(gomega.HaveOccurred(), "the read module could not be created") copyModule := &app.FybrikModule{} g.Expect(readObjectFromFile("../../testdata/unittests/copy-csv-parquet.yaml", copyModule)).NotTo(gomega.HaveOccurred()) copyModule.Namespace = utils.GetControllerNamespace() g.Expect(cl.Create(context.TODO(), copyModule)).NotTo(gomega.HaveOccurred(), "the copy module could not be created") // Create storage account dummySecret := &corev1.Secret{} g.Expect(readObjectFromFile("../../testdata/unittests/credentials-theshire.yaml", dummySecret)).NotTo(gomega.HaveOccurred()) dummySecret.Namespace = utils.GetControllerNamespace() g.Expect(cl.Create(context.Background(), dummySecret)).NotTo(gomega.HaveOccurred()) account := &app.FybrikStorageAccount{} g.Expect(readObjectFromFile("../../testdata/unittests/account-theshire.yaml", account)).NotTo(gomega.HaveOccurred()) account.Namespace = utils.GetControllerNamespace() g.Expect(cl.Create(context.Background(), account)).NotTo(gomega.HaveOccurred()) // Create a FybrikApplicationReconciler object with the scheme and fake client. r := createTestFybrikApplicationController(cl, s) req := reconcile.Request{ NamespacedName: namespaced, } _, err := r.Reconcile(context.Background(), req) g.Expect(err).To(gomega.BeNil()) err = cl.Get(context.TODO(), req.NamespacedName, application) g.Expect(err).To(gomega.BeNil(), "Cannot fetch fybrikapplication") // check provisioned storage g.Expect(application.Status.ProvisionedStorage["s3-external/redact-dataset"].DatasetRef).ToNot(gomega.BeEmpty(), "No storage provisioned") // check plotter creation g.Expect(application.Status.Generated).ToNot(gomega.BeNil()) plotterObjectKey := types.NamespacedName{ Namespace: application.Status.Generated.Namespace, Name: application.Status.Generated.Name, } plotter := &app.Plotter{} err = cl.Get(context.Background(), plotterObjectKey, plotter) g.Expect(err).NotTo(gomega.HaveOccurred()) g.Expect(plotter.Spec.Flows).To(gomega.HaveLen(1)) subflow0 := plotter.Spec.Flows[0].SubFlows[0] subflow1 := plotter.Spec.Flows[0].SubFlows[1] g.Expect(subflow0.Steps).To(gomega.HaveLen(1)) g.Expect(subflow0.Steps[0]).To(gomega.HaveLen(1)) g.Expect(subflow0.Steps[0][0].Cluster).To(gomega.Equal("neverland-cluster")) g.Expect(subflow1.Steps).To(gomega.HaveLen(1)) g.Expect(subflow1.Steps[0]).To(gomega.HaveLen(1)) g.Expect(subflow1.Steps[0][0].Cluster).To(gomega.Equal("thegreendragon")) }
explode_data.jsonl/45022
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1375 }
[ 2830, 3393, 32089, 79284, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 741, 3174, 1669, 342, 32696, 7121, 38, 32696, 2354, 51, 1155, 340, 197, 322, 2573, 279, 5925, 311, 4401, 3856, 369, 13694, 18422, 624, 6725, 69, 4202, 7395, 13...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestReflectNullValueArgument(t *testing.T) { rt := New() rt.Set("fn", func(v Value) { if v == nil { t.Error("null becomes nil") } if !IsNull(v) { t.Error("null is not null") } }) rt.RunString(`fn(null);`) }
explode_data.jsonl/10500
{ "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, 72789, 3280, 1130, 9171, 1155, 353, 8840, 836, 8, 341, 55060, 1669, 1532, 741, 55060, 4202, 445, 8822, 497, 2915, 3747, 5162, 8, 341, 197, 743, 348, 621, 2092, 341, 298, 3244, 6141, 445, 2921, 9044, 2092, 1138, 197, 197, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestBuildIDs(t *testing.T) { testfile := filepath.Join(*testDataDir, "libc.elf.section-only") f, err := os.Open(testfile) if err != nil { t.Fatal("from os.Open: ", err) } buildIDs, err := GetBuildIDs(testfile, f) if err != nil { t.Fatal("from GetBuildIDs: ", err) } if len(buildIDs) != 1 { t.Fatal("expected one build ID but got ", buildIDs) } expected := "4fcb712aa6387724a9f465a32cd8c14b" if hex.EncodeToString(buildIDs[0]) != expected { t.Fatal("expected ", expected, " but got ", buildIDs[0]) } }
explode_data.jsonl/64421
{ "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, 11066, 30466, 1155, 353, 8840, 836, 8, 341, 18185, 1192, 1669, 26054, 22363, 4071, 1944, 1043, 6184, 11, 330, 55576, 13, 490, 29168, 15382, 1138, 1166, 11, 1848, 1669, 2643, 12953, 8623, 1192, 340, 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 TestAddEndpointsToService(t *testing.T) { r := newTestResolver(t) defer r.Close() ctx := viewertest.NewContext(context.Background(), r.client) mr, qr := r.Mutation(), r.Query() locType, err := mr.AddLocationType(ctx, models.AddLocationTypeInput{ Name: "loc_type_name", }) require.NoError(t, err) location, err := mr.AddLocation(ctx, models.AddLocationInput{ Name: "loc_inst_name", Type: locType.ID, }) require.NoError(t, err) eqType, err := mr.AddEquipmentType(ctx, models.AddEquipmentTypeInput{ Name: "eq_type_name", Ports: []*models.EquipmentPortInput{ {Name: "typ1_p1"}, }, }) require.NoError(t, err) defs := eqType.QueryPortDefinitions().AllX(ctx) eq1, err := mr.AddEquipment(ctx, models.AddEquipmentInput{ Name: "eq_inst_name_1", Type: eqType.ID, Location: &location.ID, }) require.NoError(t, err) ep1 := eq1.QueryPorts().Where(equipmentport.HasDefinitionWith(equipmentportdefinition.ID(defs[0].ID))).OnlyX(ctx) eq2, err := mr.AddEquipment(ctx, models.AddEquipmentInput{ Name: "eq_inst_name_2", Type: eqType.ID, Location: &location.ID, }) require.NoError(t, err) ep2 := eq2.QueryPorts().Where(equipmentport.HasDefinitionWith(equipmentportdefinition.ID(defs[0].ID))).OnlyX(ctx) eq3, err := mr.AddEquipment(ctx, models.AddEquipmentInput{ Name: "eq_inst_name_3", Type: eqType.ID, Location: &location.ID, }) require.NoError(t, err) ep3 := eq3.QueryPorts().Where(equipmentport.HasDefinitionWith(equipmentportdefinition.ID(defs[0].ID))).OnlyX(ctx) serviceType, err := mr.AddServiceType(ctx, models.ServiceTypeCreateData{ Name: "service_type_name", Endpoints: []*models.ServiceEndpointDefinitionInput{ { Name: "endpoint type1", Role: pointer.ToString("CONSUMER"), EquipmentTypeID: eqType.ID, }, }, }) require.NoError(t, err) require.Equal(t, "service_type_name", serviceType.Name) service, err := mr.AddService(ctx, models.ServiceCreateData{ Name: "service_name", ServiceTypeID: serviceType.ID, Status: pointerToServiceStatus(models.ServiceStatusPending), }) require.NoError(t, err) ept := serviceType.QueryEndpointDefinitions().OnlyX(ctx) _, err = mr.AddServiceEndpoint(ctx, models.AddServiceEndpointInput{ ID: service.ID, EquipmentID: eq1.ID, PortID: pointer.ToInt(ep1.ID), Definition: ept.ID, }) require.NoError(t, err) _, err = mr.AddServiceEndpoint(ctx, models.AddServiceEndpointInput{ ID: service.ID, EquipmentID: eq2.ID, PortID: pointer.ToInt(ep2.ID), Definition: ept.ID, }) require.NoError(t, err) fetchedNode, err := qr.Node(ctx, service.ID) require.NoError(t, err) fetchedService, ok := fetchedNode.(*ent.Service) require.True(t, ok) endpoints := fetchedService.QueryEndpoints().QueryPort().IDsX(ctx) require.Len(t, endpoints, 2) require.NotContains(t, endpoints, eq3.ID) e1 := fetchedService.QueryEndpoints().Where(serviceendpoint.HasPortWith(equipmentport.ID(ep1.ID))).OnlyX(ctx) _, err = mr.AddServiceEndpoint(ctx, models.AddServiceEndpointInput{ ID: service.ID, EquipmentID: eq3.ID, PortID: pointer.ToInt(ep3.ID), Definition: ept.ID, }) require.NoError(t, err) _, err = mr.RemoveServiceEndpoint(ctx, e1.ID) require.NoError(t, err) require.NoError(t, err) fetchedNode, err = qr.Node(ctx, service.ID) require.NoError(t, err) fetchedService, ok = fetchedNode.(*ent.Service) require.True(t, ok) endpoints = fetchedService.QueryEndpoints().QueryPort().IDsX(ctx) require.Len(t, endpoints, 2) require.Contains(t, endpoints, ep3.ID) require.NotContains(t, endpoints, ep1.ID) }
explode_data.jsonl/7211
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1529 }
[ 2830, 3393, 2212, 80786, 1249, 1860, 1155, 353, 8840, 836, 8, 341, 7000, 1669, 501, 2271, 18190, 1155, 340, 16867, 435, 10421, 741, 20985, 1669, 1651, 83386, 7121, 1972, 5378, 19047, 1507, 435, 6581, 692, 2109, 81, 11, 49290, 1669, 435,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestGC_TrackConfigurationBlobs(t *testing.T) { require.NoError(t, testutil.TruncateAllTables(suite.db)) // create repo r := randomRepository(t) rs := datastore.NewRepositoryStore(suite.db) r, err := rs.CreateByPath(suite.ctx, r.Path) require.NoError(t, err) // create config blob bs := datastore.NewBlobStore(suite.db) b := randomBlob(t) err = bs.Create(suite.ctx, b) require.NoError(t, err) // create manifest ms := datastore.NewManifestStore(suite.db) m := randomManifest(t, r, b) err = ms.Create(suite.ctx, m) require.NoError(t, err) // Check that a corresponding task was created and scheduled for 1 day ahead. This is done by the // `gc_track_configuration_blobs` trigger/function brs := datastore.NewGCConfigLinkStore(suite.db) rr, err := brs.FindAll(suite.ctx) require.NoError(t, err) require.Equal(t, 1, len(rr)) require.NotEmpty(t, rr[0].ID) require.Equal(t, r.ID, rr[0].RepositoryID) require.Equal(t, m.ID, rr[0].ManifestID) require.Equal(t, b.Digest, rr[0].Digest) }
explode_data.jsonl/48558
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 415 }
[ 2830, 3393, 22863, 21038, 473, 7688, 33, 68164, 1155, 353, 8840, 836, 8, 341, 17957, 35699, 1155, 11, 1273, 1314, 8240, 26900, 2403, 21670, 89516, 7076, 4390, 197, 322, 1855, 15867, 198, 7000, 1669, 4194, 4624, 1155, 340, 41231, 1669, 6...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestNonBlockingOwnerRefDoesNotBlock(t *testing.T) { stopCh := make(chan struct{}) s, closeFn, gc, clientSet := setup(t, stopCh) defer func() { // We have to close the stop channel first, so the shared informers can terminate their watches; // otherwise closeFn() will hang waiting for active client connections to finish. close(stopCh) closeFn() }() ns := framework.CreateTestingNamespace("gc-foreground2", s, t) defer framework.DeleteTestingNamespace(ns, s, t) podClient := clientSet.Core().Pods(ns.Name) rcClient := clientSet.Core().ReplicationControllers(ns.Name) // create the RC with the orphan finalizer set toBeDeletedRC, err := rcClient.Create(newOwnerRC(toBeDeletedRCName, ns.Name)) if err != nil { t.Fatalf("Failed to create replication controller: %v", err) } // BlockingOwnerDeletion is not set pod1 := newPod("pod1", ns.Name, []metav1.OwnerReference{ {UID: toBeDeletedRC.ObjectMeta.UID, Name: toBeDeletedRC.Name}, }) // adding finalizer that no controller handles, so that the pod won't be deleted pod1.ObjectMeta.Finalizers = []string{"x/y"} // BlockingOwnerDeletion is false falseVar := false pod2 := newPod("pod2", ns.Name, []metav1.OwnerReference{ {UID: toBeDeletedRC.ObjectMeta.UID, Name: toBeDeletedRC.Name, BlockOwnerDeletion: &falseVar}, }) // adding finalizer that no controller handles, so that the pod won't be deleted pod2.ObjectMeta.Finalizers = []string{"x/y"} _, err = podClient.Create(pod1) if err != nil { t.Fatalf("Failed to create Pod: %v", err) } _, err = podClient.Create(pod2) if err != nil { t.Fatalf("Failed to create Pod: %v", err) } go gc.Run(5, stopCh) err = rcClient.Delete(toBeDeletedRCName, getForegroundOptions()) if err != nil { t.Fatalf("Failed to delete the rc: %v", err) } // verify the toBeDeleteRC is deleted if err := wait.PollImmediate(5*time.Second, 30*time.Second, func() (bool, error) { _, err := rcClient.Get(toBeDeletedRC.Name, metav1.GetOptions{}) if err != nil { if errors.IsNotFound(err) { return true, nil } return false, err } return false, nil }); err != nil { t.Errorf("unexpected error: %v", err) } // verify pods are still there pods, err := podClient.List(metav1.ListOptions{}) if err != nil { t.Fatalf("Failed to list pods: %v", err) } if len(pods.Items) != 2 { t.Errorf("expect there to be 2 pods, got %#v", pods.Items) } }
explode_data.jsonl/37646
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 885 }
[ 2830, 3393, 8121, 48266, 13801, 3945, 21468, 2623, 4713, 1155, 353, 8840, 836, 8, 341, 62644, 1143, 1669, 1281, 35190, 2036, 37790, 1903, 11, 3265, 24911, 11, 22122, 11, 2943, 1649, 1669, 6505, 1155, 11, 2936, 1143, 692, 16867, 2915, 36...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestKitKnativeFullBuild(t *testing.T) { doKitFullBuild(t, "knative", "300mi", "5m0s", TestTimeoutLong, kitOptions{ dependencies: []string{ "camel-k-knative", }, }) }
explode_data.jsonl/61811
{ "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, 7695, 42, 29738, 9432, 11066, 1155, 353, 8840, 836, 8, 341, 19935, 7695, 9432, 11066, 1155, 11, 330, 19095, 1388, 497, 330, 18, 15, 15, 8155, 497, 330, 20, 76, 15, 82, 497, 3393, 7636, 6583, 11, 16138, 3798, 515, 197, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
func TestMaintainer(t *testing.T) { t.Skip("asserting session state seems flakey") t.Parallel() if testing.Short() { t.SkipNow() } var ( minOpened uint64 = 5 maxIdle uint64 = 4 ) sp, _, cleanup := setup(t, SessionPoolConfig{MinOpened: minOpened, MaxIdle: maxIdle}) defer cleanup() sampleInterval := sp.SessionPoolConfig.healthCheckSampleInterval waitFor(t, func() error { sp.mu.Lock() defer sp.mu.Unlock() if sp.numOpened != 5 { return fmt.Errorf("Replenish. Expect %d open, got %d", sp.MinOpened, sp.numOpened) } return nil }) // To save test time, we are not creating many sessions, because the time // to create sessions will have impact on the decision on sessionsToKeep. // We also parallelize the take and recycle process. shs := make([]*sessionHandle, 10) for i := 0; i < len(shs); i++ { var err error shs[i], err = sp.take(context.Background()) if err != nil { t.Errorf("cannot get session from session pool: %v", err) } } sp.mu.Lock() if sp.numOpened != 10 { t.Errorf("Scale out from normal use. Expect %d open, got %d", 10, sp.numOpened) } sp.mu.Unlock() <-time.After(sampleInterval) for _, sh := range shs[:7] { sh.recycle() } waitFor(t, func() error { sp.mu.Lock() defer sp.mu.Unlock() if sp.numOpened != 7 { return fmt.Errorf("Keep extra MaxIdle sessions. Expect %d open, got %d", 7, sp.numOpened) } return nil }) for _, sh := range shs[7:] { sh.recycle() } waitFor(t, func() error { sp.mu.Lock() defer sp.mu.Unlock() if sp.numOpened != minOpened { return fmt.Errorf("Scale down. Expect %d open, got %d", minOpened, sp.numOpened) } return nil }) }
explode_data.jsonl/78708
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 676 }
[ 2830, 3393, 66734, 1743, 1155, 353, 8840, 836, 8, 341, 3244, 57776, 445, 2207, 287, 3797, 1584, 4977, 1320, 726, 88, 1138, 3244, 41288, 7957, 741, 743, 7497, 55958, 368, 341, 197, 3244, 57776, 7039, 741, 197, 532, 2405, 2399, 197, 253...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestAccDatabricksDBFSFile_CreateViaContent(t *testing.T) { config := qa.EnvironmentTemplate(t, ` resource "databricks_dbfs_file" "file" { content = base64encode("{var.RANDOM}") content_b64_md5 = md5(base64encode("{var.RANDOM}")) path = "/tmp/tf-test/file-content-{var.RANDOM}" overwrite = false mkdirs = true validate_remote_file = true }`) acceptance.AccTest(t, resource.TestCase{ CheckDestroy: testDBFSFileResourceDestroy, Steps: []resource.TestStep{ { Config: config, Destroy: false, }, { //Deleting and recreating the token PreConfig: func() { client := common.CommonEnvironmentClient() err := NewDBFSAPI(client).Delete(qa.FirstKeyValue(t, config, "path"), false) assert.NoError(t, err, err) }, Config: config, PlanOnly: true, ExpectNonEmptyPlan: true, }, { Config: config, Destroy: false, }, }, }) }
explode_data.jsonl/58532
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 415 }
[ 2830, 3393, 14603, 35, 2096, 77789, 3506, 8485, 1703, 34325, 54428, 2762, 1155, 353, 8840, 836, 8, 341, 25873, 1669, 88496, 45651, 7275, 1155, 11, 22074, 50346, 330, 67, 2096, 77789, 8685, 3848, 2458, 1, 330, 1192, 1, 341, 197, 27751, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestServer_ListBlocks_Genesis(t *testing.T) { db, _ := dbTest.SetupDB(t) ctx := context.Background() bs := &Server{ BeaconDB: db, } // Should throw an error if no genesis block is found. _, err := bs.ListBlocks(ctx, &ethpb.ListBlocksRequest{ QueryFilter: &ethpb.ListBlocksRequest_Genesis{ Genesis: true, }, }) require.ErrorContains(t, "Could not find genesis", err) // Should return the proper genesis block if it exists. parentRoot := [32]byte{'a'} blk := testutil.NewBeaconBlock() blk.Block.ParentRoot = parentRoot[:] root, err := blk.Block.HashTreeRoot() require.NoError(t, err) require.NoError(t, db.SaveBlock(ctx, blk)) require.NoError(t, db.SaveGenesisBlockRoot(ctx, root)) wanted := &ethpb.ListBlocksResponse{ BlockContainers: []*ethpb.BeaconBlockContainer{ { Block: blk, BlockRoot: root[:], }, }, NextPageToken: "0", TotalSize: 1, } res, err := bs.ListBlocks(ctx, &ethpb.ListBlocksRequest{ QueryFilter: &ethpb.ListBlocksRequest_Genesis{ Genesis: true, }, }) require.NoError(t, err) if !proto.Equal(wanted, res) { t.Errorf("Wanted %v, received %v", wanted, res) } }
explode_data.jsonl/36473
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 468 }
[ 2830, 3393, 5475, 27104, 29804, 2646, 268, 13774, 1155, 353, 8840, 836, 8, 341, 20939, 11, 716, 1669, 2927, 2271, 39820, 3506, 1155, 340, 20985, 1669, 2266, 19047, 2822, 93801, 1669, 609, 5475, 515, 197, 197, 3430, 22379, 3506, 25, 2927...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestReactorBroadcastTxMessage(t *testing.T) { config := cfg.TestConfig() const N = 4 reactors := makeAndConnectStorageReactors(config, N) defer func() { for _, r := range reactors { r.Stop() } }() for _, r := range reactors { for _, peer := range r.Switch.Peers().List() { peer.Set(types.PeerStateKey, peerState{1}) } } // send a bunch of txs to the first reactor's storage // and wait for them all to be received in the others txs := checkTxs(t, reactors[0].Storage, NUM_TXS, UnknownPeerID) waitForTxs(t, txs, reactors) }
explode_data.jsonl/22983
{ "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, 693, 5621, 43362, 31584, 2052, 1155, 353, 8840, 836, 8, 341, 25873, 1669, 13286, 8787, 2648, 741, 4777, 451, 284, 220, 19, 198, 197, 2934, 1087, 1669, 1281, 3036, 14611, 5793, 14799, 1087, 8754, 11, 451, 340, 16867, 2915, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestProgressEventHandlerOnAttemptingCoord(t *testing.T) { ev := NewProgressEventHandler(true, 0) board := challengeBoard coord := &Coord{3, 3} testProgressEventHandler(t, func() { ev.OnAttemptingCoord(board, coord) }, ev, coord, true) }
explode_data.jsonl/54908
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 82 }
[ 2830, 3393, 9496, 17945, 1925, 98584, 19437, 1155, 353, 8840, 836, 8, 341, 74837, 1669, 1532, 9496, 17945, 3715, 11, 220, 15, 340, 59868, 1669, 8645, 11932, 198, 197, 26402, 1669, 609, 19437, 90, 18, 11, 220, 18, 532, 18185, 9496, 179...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestUpdateHost(t *testing.T) { ts := httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { if req.URL.Path != "/api/v0/hosts/123456ABCD" { t.Error("request URL should be /api/v0/hosts/123456ABCD but: ", req.URL.Path) } if req.Method != "PUT" { t.Error("request method should be PUT but: ", req.Method) } body, _ := ioutil.ReadAll(req.Body) var data struct { Name string `json:"name"` Meta HostMeta `json:"meta"` Interfaces []Interface `json:"interfaces"` RoleFullnames []string `json:"roleFullnames"` Checks []CheckConfig `json:"checks"` } err := json.Unmarshal(body, &data) if err != nil { t.Fatal("request body should be decoded as json", string(body)) } if data.Name != "mydb002" { t.Error("request sends json including name but: ", data.Name) } if !reflect.DeepEqual(data.RoleFullnames, []string{"My-Service:db-master", "My-Service:db-slave"}) { t.Error("request sends json including roleFullnames but: ", data.RoleFullnames) } if !reflect.DeepEqual(data.Checks, []CheckConfig{ {Name: "mysql", Memo: "check mysql memo"}, {Name: "nginx", Memo: "check nginx memo"}, }) { t.Error("request sends json including checks but: ", data.Checks) } respJSON, _ := json.Marshal(map[string]string{ "id": "123456ABCD", }) res.Header()["Content-Type"] = []string{"application/json"} fmt.Fprint(res, string(respJSON)) })) defer ts.Close() client, _ := NewClientWithOptions("dummy-key", ts.URL, false) hostID, err := client.UpdateHost("123456ABCD", &UpdateHostParam{ Name: "mydb002", RoleFullnames: []string{"My-Service:db-master", "My-Service:db-slave"}, Checks: []CheckConfig{ {Name: "mysql", Memo: "check mysql memo"}, {Name: "nginx", Memo: "check nginx memo"}, }, }) if err != nil { t.Error("err should be nil but: ", err) } if hostID != "123456ABCD" { t.Error("hostID should be empty but: ", hostID) } }
explode_data.jsonl/63821
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 829 }
[ 2830, 3393, 4289, 9296, 1155, 353, 8840, 836, 8, 341, 57441, 1669, 54320, 70334, 7121, 5475, 19886, 89164, 18552, 4590, 1758, 37508, 11, 4232, 353, 1254, 9659, 8, 341, 197, 743, 4232, 20893, 17474, 961, 3521, 2068, 5457, 15, 14, 44692, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
7
func TestParse(t *testing.T) { r := strings.NewReader(` user/repo user1/repo-x user3/repo-y 1.0.1 user5/repo-z 1.0.13 `) repos, err := Parse(r) if err != nil { t.Error(err) } t.Logf("%q\n", repos) }
explode_data.jsonl/29348
{ "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, 14463, 1155, 353, 8840, 836, 8, 341, 7000, 1669, 9069, 68587, 61528, 19060, 10758, 5368, 198, 19060, 16, 10758, 5368, 6558, 198, 19060, 18, 10758, 5368, 12034, 220, 16, 13, 15, 13, 16, 17642, 19060, 20, 10758, 5368, 9141, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestAdDaysInMonths(t *testing.T) { normalData := []int{31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31} leapData := []int{31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31} tests := []struct { name string isLeapYear bool expected []int }{ {"leap year", true, leapData}, {"not leap year", false, normalData}, } for _, test := range tests { t.Run(test.name, func(t *testing.T) { data := adDaysInMonths(test.isLeapYear) sum := func(d []int) int { s := 0 for _, v := range d { s = s + v } return s } assert.ElementsMatch(t, test.expected, data) assert.Equal(t, sum(test.expected), sum(data)) }) } }
explode_data.jsonl/62866
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 307 }
[ 2830, 3393, 2589, 20557, 641, 59184, 1155, 353, 8840, 836, 8, 341, 197, 8252, 1043, 1669, 3056, 396, 90, 18, 16, 11, 220, 17, 23, 11, 220, 18, 16, 11, 220, 18, 15, 11, 220, 18, 16, 11, 220, 18, 15, 11, 220, 18, 16, 11, 220, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestTeamsService_ListIDPGroupsForTeamByID(t *testing.T) { client, mux, _, teardown := setup() defer teardown() mux.HandleFunc("/organizations/1/team/1/team-sync/group-mappings", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "GET") fmt.Fprint(w, `{"groups": [{"group_id": "1", "group_name": "n", "group_description": "d"}]}`) }) ctx := context.Background() groups, _, err := client.Teams.ListIDPGroupsForTeamByID(ctx, 1, 1) if err != nil { t.Errorf("Teams.ListIDPGroupsForTeamByID returned error: %v", err) } want := &IDPGroupList{ Groups: []*IDPGroup{ { GroupID: String("1"), GroupName: String("n"), GroupDescription: String("d"), }, }, } if !cmp.Equal(groups, want) { t.Errorf("Teams.ListIDPGroupsForTeamByID returned %+v. want %+v", groups, want) } const methodName = "ListIDPGroupsForTeamByID" testBadOptions(t, methodName, func() (err error) { _, _, err = client.Teams.ListIDPGroupsForTeamByID(ctx, -1, -1) return err }) testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { got, resp, err := client.Teams.ListIDPGroupsForTeamByID(ctx, 1, 1) if got != nil { t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got) } return resp, err }) }
explode_data.jsonl/4554
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 542 }
[ 2830, 3393, 60669, 1860, 27104, 915, 47, 22173, 2461, 14597, 60572, 1155, 353, 8840, 836, 8, 341, 25291, 11, 59807, 11, 8358, 49304, 1669, 6505, 741, 16867, 49304, 2822, 2109, 2200, 63623, 4283, 69253, 14, 16, 78015, 14, 16, 78015, 6503...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestSplit(t *testing.T) { var splittests []SplitTest splittests = unixsplittests if runtime.GOOS == "windows" { splittests = append(splittests, winsplittests...) } for _, test := range splittests { if d, f := filepath.Split(test.path); d != test.dir || f != test.file { t.Errorf("Split(%q) = %q, %q, want %q, %q", test.path, d, f, test.dir, test.file) } } }
explode_data.jsonl/1656
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 158 }
[ 2830, 3393, 20193, 1155, 353, 8840, 836, 8, 341, 2405, 12503, 14267, 82, 3056, 20193, 2271, 198, 1903, 500, 14267, 82, 284, 51866, 69095, 14267, 82, 198, 743, 15592, 97574, 3126, 621, 330, 27077, 1, 341, 197, 1903, 500, 14267, 82, 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...
5
func TestParseStubStatsValidInput(t *testing.T) { var rt int64 = 271504 var tests = []struct { input []byte expectedResult StubStats expectedError bool }{ { input: []byte(validStabStats), expectedResult: StubStats{ Connections: StubConnections{ Active: 1457, Accepted: 6717066, Handled: 6717066, Reading: 1, Writing: 8, Waiting: 1448, }, Requests: 65844359, RequestTime: rt, }, expectedError: false, }, { input: []byte("invalid-stats"), expectedError: true, }, } for _, test := range tests { var result StubStats err := parseStubStats(test.input, &result) if err != nil && !test.expectedError { t.Errorf("parseStubStats() returned error for valid input %q: %v", string(test.input), err) } if !test.expectedError && test.expectedResult != result { t.Errorf("parseStubStats() result %v != expected %v for input %q", result, test.expectedResult, test.input) } } }
explode_data.jsonl/63027
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 424 }
[ 2830, 3393, 14463, 33838, 16635, 4088, 2505, 1155, 353, 8840, 836, 8, 341, 2405, 16677, 526, 21, 19, 284, 220, 17, 22, 16, 20, 15, 19, 198, 2405, 7032, 284, 3056, 1235, 341, 197, 22427, 688, 3056, 3782, 198, 197, 42400, 2077, 66611,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestIsPassing(t *testing.T) { yes := true no := false headSHA := "head" success := string(githubql.StatusStateSuccess) failure := string(githubql.StatusStateFailure) testCases := []struct { name string passing bool config config.TideContextPolicy combinedContexts map[string]string }{ { name: "empty policy - success (trust combined status)", passing: true, combinedContexts: map[string]string{"c1": success, "c2": success, statusContext: failure}, }, { name: "empty policy - failure because of failed context c4 (trust combined status)", passing: false, combinedContexts: map[string]string{"c1": success, "c2": success, "c3": failure, statusContext: failure}, }, { name: "passing (trust combined status)", passing: true, config: config.TideContextPolicy{ RequiredContexts: []string{"c1", "c2", "c3"}, SkipUnknownContexts: &no, }, combinedContexts: map[string]string{"c1": success, "c2": success, "c3": success, statusContext: failure}, }, { name: "failing because of missing required check c3", passing: false, config: config.TideContextPolicy{ RequiredContexts: []string{"c1", "c2", "c3"}, }, combinedContexts: map[string]string{"c1": success, "c2": success, statusContext: failure}, }, { name: "failing because of failed context c2", passing: false, combinedContexts: map[string]string{"c1": success, "c2": failure}, config: config.TideContextPolicy{ RequiredContexts: []string{"c1", "c2", "c3"}, OptionalContexts: []string{"c4"}, }, }, { name: "passing because of failed context c4 is optional", passing: true, combinedContexts: map[string]string{"c1": success, "c2": success, "c3": success, "c4": failure}, config: config.TideContextPolicy{ RequiredContexts: []string{"c1", "c2", "c3"}, OptionalContexts: []string{"c4"}, }, }, { name: "skipping unknown contexts - failing because of missing required context c3", passing: false, config: config.TideContextPolicy{ RequiredContexts: []string{"c1", "c2", "c3"}, SkipUnknownContexts: &yes, }, combinedContexts: map[string]string{"c1": success, "c2": success, statusContext: failure}, }, { name: "skipping unknown contexts - failing because c2 is failing", passing: false, combinedContexts: map[string]string{"c1": success, "c2": failure}, config: config.TideContextPolicy{ RequiredContexts: []string{"c1", "c2"}, OptionalContexts: []string{"c4"}, SkipUnknownContexts: &yes, }, }, { name: "skipping unknown contexts - passing because c4 is optional", passing: true, combinedContexts: map[string]string{"c1": success, "c2": success, "c3": success, "c4": failure}, config: config.TideContextPolicy{ RequiredContexts: []string{"c1", "c3"}, OptionalContexts: []string{"c4"}, SkipUnknownContexts: &yes, }, }, { name: "skipping unknown contexts - passing because c4 is optional and c5 is unknown", passing: true, combinedContexts: map[string]string{"c1": success, "c2": success, "c3": success, "c4": failure, "c5": failure}, config: config.TideContextPolicy{ RequiredContexts: []string{"c1", "c3"}, OptionalContexts: []string{"c4"}, SkipUnknownContexts: &yes, }, }, } for _, tc := range testCases { ghc := &fgc{ combinedStatus: tc.combinedContexts, expectedSHA: headSHA} log := logrus.WithField("component", "tide") _, err := log.String() if err != nil { t.Fatalf("Failed to get log output before testing: %v", err) } pr := PullRequest{HeadRefOID: githubql.String(headSHA)} passing := isPassingTests(log, ghc, pr, &tc.config) if passing != tc.passing { t.Errorf("%s: Expected %t got %t", tc.name, tc.passing, passing) } } }
explode_data.jsonl/42790
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1641 }
[ 2830, 3393, 3872, 12187, 287, 1155, 353, 8840, 836, 8, 341, 197, 9693, 1669, 830, 198, 72104, 1669, 895, 198, 46081, 33145, 1669, 330, 1983, 698, 30553, 1669, 914, 3268, 3827, 1470, 10538, 1397, 7188, 340, 1166, 9373, 1669, 914, 3268, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_Delete_Action(t *testing.T) { var ( manager *Manager vectorRepo *fakeVectorRepo ) reset := func() { vectorRepo = &fakeVectorRepo{} vectorRepo.On("ActionByID", mock.Anything, mock.Anything, mock.Anything).Return(&search.Result{ ClassName: "MyAction", }, nil).Once() schemaManager := &fakeSchemaManager{} locks := &fakeLocks{} network := &fakeNetwork{} cfg := &config.WeaviateConfig{} authorizer := &fakeAuthorizer{} logger, _ := test.NewNullLogger() vectorizer := &fakeVectorizer{} manager = NewManager(locks, schemaManager, network, cfg, logger, authorizer, vectorizer, vectorRepo) } reset() id := strfmt.UUID("5a1cd361-1e0d-42ae-bd52-ee09cb5f31cc") vectorRepo.On("DeleteAction", "MyAction", id).Return(nil).Once() ctx := context.Background() err := manager.DeleteAction(ctx, nil, id) assert.Nil(t, err) vectorRepo.AssertExpectations(t) }
explode_data.jsonl/74852
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 346 }
[ 2830, 3393, 57418, 59899, 1155, 353, 8840, 836, 8, 341, 2405, 2399, 197, 92272, 262, 353, 2043, 198, 197, 20365, 25243, 353, 30570, 3781, 25243, 198, 197, 692, 70343, 1669, 2915, 368, 341, 197, 20365, 25243, 284, 609, 30570, 3781, 25243...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestGDPRPreventsCookie(t *testing.T) { rr := doPost(`{"bidders":["appnexus", "pubmatic"]}`, nil, false, syncersForTest()) assert.Equal(t, rr.Header().Get("Content-Type"), "application/json; charset=utf-8") assert.Equal(t, http.StatusOK, rr.Code) assert.Empty(t, parseSyncs(t, rr.Body.Bytes())) assert.Equal(t, "no_cookie", parseStatus(t, rr.Body.Bytes())) }
explode_data.jsonl/21683
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 149 }
[ 2830, 3393, 40849, 6480, 4703, 47664, 20616, 1155, 353, 8840, 836, 8, 341, 197, 634, 1669, 65156, 5809, 4913, 65, 99129, 36799, 676, 77, 23666, 497, 330, 9585, 37244, 1341, 28350, 2092, 11, 895, 11, 12811, 388, 2461, 2271, 2398, 6948, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestInsertShardedGeo(t *testing.T) { invschema := &vschemapb.SrvVSchema{ Keyspaces: map[string]*vschemapb.Keyspace{ "sharded": { Sharded: true, Vindexes: map[string]*vschemapb.Vindex{ "geo": { Type: "region_experimental", Params: map[string]string{ "region_bytes": "1", }, }, "lookup": { Type: "lookup_unique", Params: map[string]string{ "table": "id_idx", "from": "id", "to": "keyspace_id", }, Owner: "t1", }, }, Tables: map[string]*vschemapb.Table{ "t1": { ColumnVindexes: []*vschemapb.ColumnVindex{{ Name: "geo", Columns: []string{"region", "id"}, }, { Name: "lookup", Columns: []string{"id"}, }}, }, }, }, }, } vs, err := vindexes.BuildVSchema(invschema) if err != nil { t.Fatal(err) } ks := vs.Keyspaces["sharded"] ins := NewInsert( InsertSharded, ks.Keyspace, []sqltypes.PlanValue{{ // colVindex columns: region, id Values: []sqltypes.PlanValue{{ // rows for region Values: []sqltypes.PlanValue{{ Value: sqltypes.NewInt64(1), }, { Value: sqltypes.NewInt64(255), }}, }, { // rows for id Values: []sqltypes.PlanValue{{ Value: sqltypes.NewInt64(1), }, { Value: sqltypes.NewInt64(1), }}, }}, }, { // colVindex columns: id Values: []sqltypes.PlanValue{{ // rows for id Values: []sqltypes.PlanValue{{ Value: sqltypes.NewInt64(1), }, { Value: sqltypes.NewInt64(1), }}, }}, }}, ks.Tables["t1"], "prefix", []string{" mid1", " mid2"}, " suffix", ) vc := &loggingVCursor{ shards: []string{"-20", "20-"}, shardForKsid: []string{"20-", "-20"}, } _, err = ins.Execute(vc, map[string]*querypb.BindVariable{}, false) if err != nil { t.Fatal(err) } vc.ExpectLog(t, []string{ `Execute insert into id_idx(id, keyspace_id) values(:id0, :keyspace_id0), (:id1, :keyspace_id1) ` + `id0: type:INT64 value:"1" id1: type:INT64 value:"1" ` + `keyspace_id0: type:VARBINARY value:"\001\026k@\264J\272K\326" keyspace_id1: type:VARBINARY value:"\377\026k@\264J\272K\326" true`, `ResolveDestinations sharded [value:"0" value:"1" ] Destinations:DestinationKeyspaceID(01166b40b44aba4bd6),DestinationKeyspaceID(ff166b40b44aba4bd6)`, `ExecuteMultiShard sharded.20-: prefix mid1 suffix /* vtgate:: keyspace_id:01166b40b44aba4bd6 */ ` + `{_id0: type:INT64 value:"1" _id1: type:INT64 value:"1" ` + `_region0: type:INT64 value:"1" _region1: type:INT64 value:"255" } ` + `sharded.-20: prefix mid2 suffix /* vtgate:: keyspace_id:ff166b40b44aba4bd6 */ ` + `{_id0: type:INT64 value:"1" _id1: type:INT64 value:"1" ` + `_region0: type:INT64 value:"1" _region1: type:INT64 value:"255" } ` + `true false`, }) }
explode_data.jsonl/55991
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1413 }
[ 2830, 3393, 13780, 2016, 20958, 37344, 1155, 353, 8840, 836, 8, 341, 17430, 11562, 3416, 1669, 609, 11562, 2407, 391, 65, 808, 10553, 53, 8632, 515, 197, 197, 8850, 27338, 25, 2415, 14032, 8465, 11562, 2407, 391, 65, 37863, 1306, 515, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestTrace(t *testing.T) { cases := []struct { name string rcode int question *dns.Msg server string }{ { name: "NXDOMAIN", rcode: dns.RcodeNameError, question: new(dns.Msg).SetQuestion("example.org.", dns.TypeA), }, { name: "NOERROR", rcode: dns.RcodeSuccess, question: new(dns.Msg).SetQuestion("example.net.", dns.TypeCNAME), }, } for _, tc := range cases { t.Run(tc.name, func(t *testing.T) { w := dnstest.NewRecorder(&test.ResponseWriter{}) m := mocktracer.New() tr := &trace{ Next: test.HandlerFunc(func(_ context.Context, w dns.ResponseWriter, r *dns.Msg) (int, error) { m := new(dns.Msg) m.SetRcode(r, tc.rcode) w.WriteMsg(m) return tc.rcode, nil }), every: 1, tracer: m, } ctx := context.TODO() if _, err := tr.ServeDNS(ctx, w, tc.question); err != nil { t.Fatalf("Error during tr.ServeDNS(ctx, w, %v): %v", tc.question, err) } fs := m.FinishedSpans() // Each trace consists of two spans; the root and the Next function. if len(fs) != 2 { t.Fatalf("Unexpected span count: len(fs): want 2, got %v", len(fs)) } rootSpan := fs[1] req := request.Request{W: w, Req: tc.question} if rootSpan.OperationName != defaultTopLevelSpanName { t.Errorf("Unexpected span name: rootSpan.Name: want %v, got %v", defaultTopLevelSpanName, rootSpan.OperationName) } if rootSpan.Tag(tagName) != req.Name() { t.Errorf("Unexpected span tag: rootSpan.Tag(%v): want %v, got %v", tagName, req.Name(), rootSpan.Tag(tagName)) } if rootSpan.Tag(tagType) != req.Type() { t.Errorf("Unexpected span tag: rootSpan.Tag(%v): want %v, got %v", tagType, req.Type(), rootSpan.Tag(tagType)) } if rootSpan.Tag(tagProto) != req.Proto() { t.Errorf("Unexpected span tag: rootSpan.Tag(%v): want %v, got %v", tagProto, req.Proto(), rootSpan.Tag(tagProto)) } if rootSpan.Tag(tagRemote) != req.IP() { t.Errorf("Unexpected span tag: rootSpan.Tag(%v): want %v, got %v", tagRemote, req.IP(), rootSpan.Tag(tagRemote)) } if rootSpan.Tag(tagRcode) != rcode.ToString(tc.rcode) { t.Errorf("Unexpected span tag: rootSpan.Tag(%v): want %v, got %v", tagRcode, rcode.ToString(tc.rcode), rootSpan.Tag(tagRcode)) } }) } }
explode_data.jsonl/64691
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1051 }
[ 2830, 3393, 6550, 1155, 353, 8840, 836, 8, 341, 1444, 2264, 1669, 3056, 1235, 341, 197, 11609, 257, 914, 198, 197, 30295, 534, 262, 526, 198, 197, 197, 7841, 353, 45226, 30365, 198, 197, 41057, 256, 914, 198, 197, 59403, 197, 197, 5...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestCreateJob_ThroughPipelineID(t *testing.T) { store, manager, pipeline := initWithPipeline(t) defer store.Close() apiExperiment := &api.Experiment{Name: "e1"} experiment, err := manager.CreateExperiment(apiExperiment) job := &api.Job{ Name: "j1", Enabled: true, PipelineSpec: &api.PipelineSpec{ PipelineId: pipeline.UUID, Parameters: []*api.Parameter{ {Name: "param1", Value: "world"}, }, }, ResourceReferences: []*api.ResourceReference{ { Key: &api.ResourceKey{Type: api.ResourceType_EXPERIMENT, Id: experiment.UUID}, Relationship: api.Relationship_OWNER, }, }, } // Create a new pipeline version with UUID being FakeUUID. pipelineStore, ok := store.pipelineStore.(*storage.PipelineStore) assert.True(t, ok) pipelineStore.SetUUIDGenerator(util.NewFakeUUIDGeneratorOrFatal(FakeUUIDOne, nil)) version, err := manager.CreatePipelineVersion(&api.PipelineVersion{ Name: "version_for_run", ResourceReferences: []*api.ResourceReference{ &api.ResourceReference{ Key: &api.ResourceKey{ Id: pipeline.UUID, Type: api.ResourceType_PIPELINE, }, Relationship: api.Relationship_OWNER, }, }, }, []byte(testWorkflow.ToStringForStore()), true) assert.Nil(t, err) // The pipeline specified via pipeline id will be converted to this // pipeline's default version, which will be used to create run. newJob, err := manager.CreateJob(job) expectedJob := &model.Job{ UUID: "123e4567-e89b-12d3-a456-426655440000", DisplayName: "j1", Name: "j1", Namespace: "ns1", ServiceAccount: "pipeline-runner", Enabled: true, CreatedAtInSec: 4, UpdatedAtInSec: 4, Conditions: "NO_STATUS", PipelineSpec: model.PipelineSpec{ PipelineId: pipeline.UUID, PipelineName: "p1", WorkflowSpecManifest: testWorkflow.ToStringForStore(), Parameters: "[{\"name\":\"param1\",\"value\":\"world\"}]", }, ResourceReferences: []*model.ResourceReference{ { ResourceUUID: "123e4567-e89b-12d3-a456-426655440000", ResourceType: common.Job, ReferenceUUID: experiment.UUID, ReferenceName: "e1", ReferenceType: common.Experiment, Relationship: common.Owner, }, { ResourceUUID: "123e4567-e89b-12d3-a456-426655440000", ResourceType: common.Job, ReferenceUUID: version.UUID, ReferenceName: version.Name, ReferenceType: common.PipelineVersion, Relationship: common.Creator, }, }, } assert.Nil(t, err) assert.Equal(t, expectedJob, newJob) }
explode_data.jsonl/77035
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1091 }
[ 2830, 3393, 4021, 12245, 62, 23857, 34656, 915, 1155, 353, 8840, 836, 8, 341, 57279, 11, 6645, 11, 15301, 1669, 13864, 34656, 1155, 340, 16867, 3553, 10421, 741, 54299, 77780, 1669, 609, 2068, 5121, 14329, 63121, 25, 330, 68, 16, 16707,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestAssessRunStatusWorstMessageInReconcileAnalysisRun(t *testing.T) { newRun := StartAssessRunStatusWorstMessageInReconcileAnalysisRun(t, false) assert.Equal(t, v1alpha1.AnalysisPhaseFailed, newRun.Status.Phase) assert.Equal(t, "Metric \"run-forever\" assessed Failed due to failed (1) > failureLimit (0)", newRun.Status.Message) }
explode_data.jsonl/75848
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 116 }
[ 2830, 3393, 5615, 433, 6727, 2522, 54, 65296, 2052, 641, 693, 40446, 457, 26573, 6727, 1155, 353, 8840, 836, 8, 341, 8638, 6727, 1669, 5145, 5615, 433, 6727, 2522, 54, 65296, 2052, 641, 693, 40446, 457, 26573, 6727, 1155, 11, 895, 340...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestRenderer(t *testing.T) { tmpl, err := Parse(strings.NewReader(` my-lang: hello ${name} `)) if err != nil { t.Fatal(err) } tmpl.RegisterRenderer("my-lang", func(out io.Writer, n *Node, v *vm.VM) error { s := os.Expand(n.Text, func(s string) string { if vv, ok := v.Get(s); ok { return fmt.Sprint(vv) } return "" }) fmt.Fprint(out, s) return nil }) var buf bytes.Buffer err = tmpl.Execute(&buf, Values{ "name": "golang", }) if err != nil { t.Fatal(err) } got := strings.TrimSpace(buf.String()) expect := "hello golang" if expect != got { t.Fatalf("expected %v but %v", expect, got) } }
explode_data.jsonl/80442
{ "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, 11541, 1155, 353, 8840, 836, 8, 341, 3244, 54010, 11, 1848, 1669, 14775, 51442, 68587, 61528, 2408, 75460, 510, 220, 23811, 3570, 606, 532, 197, 63, 1171, 743, 1848, 961, 2092, 341, 197, 3244, 26133, 3964, 340, 197, 532, 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...
2
func TestMustReadConfig(t *testing.T) { cfg := MustReadConfig("../_resources/config/test.toml") // Logger if cfg.Logger.LogFile != logFile { t.Errorf("Test failed, expected: '%s', got: '%s'", logFile, cfg.Logger.LogFile) } if cfg.Logger.LogLevel != logLevel { t.Errorf("Test failed, expected: '%s', got: '%s'", logLevel, cfg.Logger.LogLevel) } // API if cfg.API.Port != httpPort { t.Errorf("Test failed, expected: '%d', got: '%d'", httpPort, cfg.API.Port) } // Storage if cfg.Storage.Host != storageHost { t.Errorf("Test failed, expected: '%s', got: '%s'", storageHost, cfg.Storage.Host) } if cfg.Storage.Port != storagePort { t.Errorf("Test failed, expected: '%d', got: '%d'", storagePort, cfg.Storage.Port) } // Sender if cfg.Sender.HTTPStream != httpStream { t.Errorf("Test failed, expected: '%s', got: '%s'", httpStream, cfg.Sender.HTTPStream) } if cfg.Sender.PingInterval != pingInterval { t.Errorf("Test failed, expected: '%d', got: '%d'", pingInterval, cfg.Sender.PingInterval) } }
explode_data.jsonl/49581
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 429 }
[ 2830, 3393, 31776, 4418, 2648, 1155, 353, 8840, 836, 8, 341, 50286, 1669, 15465, 4418, 2648, 17409, 62, 12745, 14730, 12697, 73494, 75, 5130, 197, 322, 9514, 198, 743, 13286, 12750, 5247, 1703, 961, 1487, 1703, 341, 197, 3244, 13080, 44...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
8