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 TestAddOrder(t *testing.T) { src, err := Parse("select foo, bar from baz order by foo") if err != nil { t.Error(err) } order := src.(*Select).OrderBy[0] dst, err := Parse("select * from t") if err != nil { t.Error(err) } dst.(*Select).AddOrder(order) buf := NewTrackedBuffer(nil) dst.Format(buf) want := "select * from t order by foo asc" if buf.String() != want { t.Errorf("order: %q, want %s", buf.String(), want) } dst, err = Parse("select * from t union select * from s") if err != nil { t.Error(err) } dst.(*Union).AddOrder(order) buf = NewTrackedBuffer(nil) dst.Format(buf) want = "select * from t union select * from s order by foo asc" if buf.String() != want { t.Errorf("order: %q, want %s", buf.String(), want) } }
explode_data.jsonl/3371
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 311 }
[ 2830, 3393, 2212, 4431, 1155, 353, 8840, 836, 8, 341, 41144, 11, 1848, 1669, 14775, 445, 1742, 15229, 11, 3619, 504, 50247, 1973, 553, 15229, 1138, 743, 1848, 961, 2092, 341, 197, 3244, 6141, 3964, 340, 197, 532, 42245, 1669, 2286, 41...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestAggregateContext_EventsHandling(t *testing.T) { id := NewIntAggregateId(12) ctx := NewAggregateContext(id, 0) ctx.StoreEvent(&eventA{}) ctx.StoreEvent(&eventB{}) events := ctx.getUncommittedEvents() if len(events) != 2 { t.Fatalf("expected %d events but got %d", 2, len(events)) } ctx.clearUncommittedEvents() events = ctx.getUncommittedEvents() if len(events) != 0 { t.Fatalf("expected no events but got %d", len(events)) } }
explode_data.jsonl/1204
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 171 }
[ 2830, 3393, 64580, 1972, 62, 7900, 38606, 1155, 353, 8840, 836, 8, 341, 15710, 1669, 1532, 1072, 64580, 764, 7, 16, 17, 340, 20985, 1669, 1532, 64580, 1972, 3724, 11, 220, 15, 692, 20985, 38047, 1556, 2099, 3087, 32, 37790, 20985, 380...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestNullInt64Param(t *testing.T) { spec := nullTestSpec{"nullint64", "int64", [6]nullTestRow{ {NullInt64{31, true}, 1, NullInt64{31, true}}, {NullInt64{-22, false}, 1, NullInt64{0, false}}, {22, 1, NullInt64{22, true}}, {NullInt64{33, true}, 1, NullInt64{33, true}}, {NullInt64{222, false}, 1, NullInt64{0, false}}, {0, NullInt64{31, false}, nil}, }} nullTestRun(t, spec) }
explode_data.jsonl/15992
{ "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, 3280, 1072, 21, 19, 2001, 1155, 353, 8840, 836, 8, 341, 98100, 1669, 845, 2271, 8327, 4913, 2921, 396, 21, 19, 497, 330, 396, 21, 19, 497, 508, 21, 60, 2921, 2271, 3102, 515, 197, 197, 90, 3280, 1072, 21, 19, 90, 18,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestHmhdBox_AvgBitrate(t *testing.T) { hb := HmhdBox{ avgBitrate: 11, } if hb.AvgBitrate() != 11 { t.Fatalf("AvgBitrate() not correct.") } }
explode_data.jsonl/11012
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 74 }
[ 2830, 3393, 39, 76, 15990, 1611, 1566, 7239, 8344, 7698, 1155, 353, 8840, 836, 8, 341, 9598, 65, 1669, 472, 76, 15990, 1611, 515, 197, 197, 13961, 8344, 7698, 25, 220, 16, 16, 345, 197, 630, 743, 45135, 875, 7239, 8344, 7698, 368, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestNamespaceFilter(t *testing.T) { r, _ := http.NewRequest("GET", "/v1/user/123", nil) w := httptest.NewRecorder() ns := NewNamespace("/v1") ns.Filter("before", func(ctx *context.Context) { ctx.Output.Body([]byte("this is Filter")) }). Get("/user/:id", func(ctx *context.Context) { ctx.Output.Body([]byte(ctx.Input.Param(":id"))) }) AddNamespace(ns) BeeApp.Handlers.ServeHTTP(w, r) if w.Body.String() != "this is Filter" { t.Errorf("TestNamespaceFilter can't run, get the response is " + w.Body.String()) } }
explode_data.jsonl/12610
{ "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, 22699, 5632, 1155, 353, 8840, 836, 8, 341, 7000, 11, 716, 1669, 1758, 75274, 445, 3806, 497, 3521, 85, 16, 11739, 14, 16, 17, 18, 497, 2092, 340, 6692, 1669, 54320, 70334, 7121, 47023, 2822, 84041, 1669, 1532, 22699, 4283,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestGetResources(t *testing.T) { res := GetSystemResources() t.Logf("CPU Count = %d", res.CPUNumCores) t.Logf("CPU MHz = %.2f", res.CPUMhzPercore) t.Logf("Total CPU MHz = %.2f", res.CPUTotalTicks) t.Logf("Total Physical Memory MiB = %.2f", res.MemoryTotalPhysicalKB/1024.0) t.Logf("Total Virtual Memory MiB = %.2f", res.MemoryTotalVirtualKB/1024.0) }
explode_data.jsonl/67705
{ "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, 1949, 11277, 1155, 353, 8840, 836, 8, 341, 10202, 1669, 2126, 2320, 11277, 741, 3244, 98954, 445, 31615, 4504, 284, 1018, 67, 497, 592, 727, 47, 1861, 372, 34, 4589, 340, 3244, 98954, 445, 31615, 36494, 284, 18524, 17, 69,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestAddConst(t *testing.T) { t.Parallel() s := []float64{3, 4, 1, 7, 5} c := 6.0 truth := []float64{9, 10, 7, 13, 11} AddConst(c, s) areSlicesEqual(t, truth, s, "Wrong addition of constant") }
explode_data.jsonl/1208
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 95 }
[ 2830, 3393, 2212, 19167, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 741, 1903, 1669, 3056, 3649, 21, 19, 90, 18, 11, 220, 19, 11, 220, 16, 11, 220, 22, 11, 220, 20, 532, 1444, 1669, 220, 21, 13, 15, 198, 25583, 940, 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 TestHotHistoryRegionConfig(t *testing.T) { re := require.New(t) registerDefaultSchedulers() cfgData := ` [schedule] hot-regions-reserved-days= 30 hot-regions-write-interval= "30m" ` cfg := NewConfig() meta, err := toml.Decode(cfgData, &cfg) re.NoError(err) err = cfg.Adjust(&meta, false) re.NoError(err) re.Equal(30*time.Minute, cfg.Schedule.HotRegionsWriteInterval.Duration) re.Equal(uint64(30), cfg.Schedule.HotRegionsReservedDays) // Verify default value cfg = NewConfig() err = cfg.Adjust(nil, false) re.NoError(err) re.Equal(10*time.Minute, cfg.Schedule.HotRegionsWriteInterval.Duration) re.Equal(uint64(7), cfg.Schedule.HotRegionsReservedDays) }
explode_data.jsonl/78170
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 274 }
[ 2830, 3393, 20170, 13424, 14091, 2648, 1155, 353, 8840, 836, 8, 341, 17200, 1669, 1373, 7121, 1155, 340, 29422, 3675, 74674, 741, 50286, 1043, 1669, 22074, 11880, 8796, 921, 10622, 32163, 908, 11588, 2771, 95214, 28, 220, 18, 15, 198, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestOpen(t *testing.T) { _, err := Open("testdata/bogus") if err != ErrUnknown { t.Error("expected error") } for i, name := range filenames { g, err := Open("testdata/" + name) if err != errs[i] { t.Error("Open", name, "expected", errs[i], "got", err) } if g != nil { g.Close() } } }
explode_data.jsonl/21920
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 140 }
[ 2830, 3393, 5002, 1155, 353, 8840, 836, 8, 341, 197, 6878, 1848, 1669, 5264, 445, 92425, 3470, 538, 355, 1138, 743, 1848, 961, 15495, 13790, 341, 197, 3244, 6141, 445, 7325, 1465, 1138, 197, 532, 2023, 600, 11, 829, 1669, 2088, 40540,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_MTime(t *testing.T) { gtest.Case(t, func() { var ( file1 string = "/testfile_t1.txt" err error fileobj os.FileInfo ) createTestFile(file1, "") defer delTestFiles(file1) fileobj, err = os.Stat(testpath() + file1) gtest.Assert(err, nil) gtest.Assert(gfile.MTime(testpath()+file1), fileobj.ModTime().Unix()) gtest.Assert(gfile.MTime(""), 0) }) }
explode_data.jsonl/1546
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 182 }
[ 2830, 3393, 1245, 1462, 1155, 353, 8840, 836, 8, 341, 3174, 1944, 727, 519, 1155, 11, 2915, 368, 1476, 197, 2405, 2399, 298, 17661, 16, 256, 914, 284, 3521, 1944, 1192, 528, 16, 3909, 698, 298, 9859, 257, 1465, 198, 298, 17661, 2295...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestParseMachineSetupYaml(t *testing.T) { testTables := []struct { reader io.Reader expectedErr bool }{ { reader: strings.NewReader(`items: - machineParams: - os: ubuntu-1710 roles: - Master versions: kubelet: 1.9.3 controlPlane: 1.9.3 - os: ubuntu-1710 roles: - Master versions: kubelet: 1.9.4 controlPlane: 1.9.4 image: projects/ubuntu-os-cloud/global/images/family/ubuntu-1710 metadata: startupScript: | #!/bin/bash - machineParams: - os: ubuntu-1710 roles: - Node versions: kubelet: 1.9.3 - os: ubuntu-1710 roles: - Node versions: kubelet: 1.9.4 image: projects/ubuntu-os-cloud/global/images/family/ubuntu-1710 metadata: startupScript: | #!/bin/bash echo this is the node config.`), expectedErr: false, }, { reader: strings.NewReader("Not valid yaml"), expectedErr: true, }, } for _, table := range testTables { validConfigs, err := parseMachineSetupYaml(table.reader) if table.expectedErr { if err == nil { t.Errorf("An error was not received as expected.") } if validConfigs != nil { t.Errorf("GetMachineSetupConfigs should be nil, got %v", validConfigs) } } if !table.expectedErr { if err != nil { t.Errorf("Got unexpected error: %s", err) } if validConfigs == nil { t.Errorf("GetMachineSetupConfigs should have been parsed, but was nil") } } } }
explode_data.jsonl/44886
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 653 }
[ 2830, 3393, 14463, 21605, 21821, 56, 9467, 1155, 353, 8840, 836, 8, 341, 18185, 21670, 1669, 3056, 1235, 341, 197, 61477, 414, 6399, 47431, 198, 197, 42400, 7747, 1807, 198, 197, 59403, 197, 197, 515, 298, 61477, 25, 9069, 68587, 5809, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
8
func TestEnsureHTTP(t *testing.T) { addrs := []string{"http://prometheus-cache:9091", "prometheus-cache:9091", "https://prometheus-cache:9091"} srv := servicers.NewPushExporterServicer(addrs).(*servicers.PushExporterServicer) protocolMatch := regexp.MustCompile("(http|https)://") for _, addr := range srv.PushAddresses { assert.True(t, protocolMatch.MatchString(addr)) } }
explode_data.jsonl/61831
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 137 }
[ 2830, 3393, 64439, 9230, 1155, 353, 8840, 836, 8, 341, 12718, 5428, 1669, 3056, 917, 4913, 1254, 1110, 24468, 39705, 36680, 25, 24, 15, 24, 16, 497, 330, 24468, 39705, 36680, 25, 24, 15, 24, 16, 497, 330, 2428, 1110, 24468, 39705, 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 TestParseSuccess(t *testing.T) { testCases := []struct { desc string executable *executable.Executable env sshenv.Env arguments []string expectedArgs CommandArgs }{ { desc: "It sets discover as the command when the command string was empty", executable: &executable.Executable{Name: executable.GitlabShell}, env: sshenv.Env{IsSSHConnection: true, RemoteAddr: "1"}, arguments: []string{}, expectedArgs: &Shell{Arguments: []string{}, SshArgs: []string{}, CommandType: Discover, Env: sshenv.Env{IsSSHConnection: true, RemoteAddr: "1"}}, }, { desc: "It finds the key id in any passed arguments", executable: &executable.Executable{Name: executable.GitlabShell}, env: sshenv.Env{IsSSHConnection: true, RemoteAddr: "1"}, arguments: []string{"hello", "key-123"}, expectedArgs: &Shell{Arguments: []string{"hello", "key-123"}, SshArgs: []string{}, CommandType: Discover, GitlabKeyId: "123", Env: sshenv.Env{IsSSHConnection: true, RemoteAddr: "1"}}, }, { desc: "It finds the username in any passed arguments", executable: &executable.Executable{Name: executable.GitlabShell}, env: sshenv.Env{IsSSHConnection: true, RemoteAddr: "1"}, arguments: []string{"hello", "username-jane-doe"}, expectedArgs: &Shell{Arguments: []string{"hello", "username-jane-doe"}, SshArgs: []string{}, CommandType: Discover, GitlabUsername: "jane-doe", Env: sshenv.Env{IsSSHConnection: true, RemoteAddr: "1"}}, }, { desc: "It parses 2fa_recovery_codes command", executable: &executable.Executable{Name: executable.GitlabShell}, env: sshenv.Env{IsSSHConnection: true, OriginalCommand: "2fa_recovery_codes"}, arguments: []string{}, expectedArgs: &Shell{Arguments: []string{}, SshArgs: []string{"2fa_recovery_codes"}, CommandType: TwoFactorRecover, Env: sshenv.Env{IsSSHConnection: true, OriginalCommand: "2fa_recovery_codes"}}, }, { desc: "It parses git-receive-pack command", executable: &executable.Executable{Name: executable.GitlabShell}, env: sshenv.Env{IsSSHConnection: true, OriginalCommand: "git-receive-pack group/repo"}, arguments: []string{}, expectedArgs: &Shell{Arguments: []string{}, SshArgs: []string{"git-receive-pack", "group/repo"}, CommandType: ReceivePack, Env: sshenv.Env{IsSSHConnection: true, OriginalCommand: "git-receive-pack group/repo"}}, }, { desc: "It parses git-receive-pack command and a project with single quotes", executable: &executable.Executable{Name: executable.GitlabShell}, env: sshenv.Env{IsSSHConnection: true, OriginalCommand: "git-receive-pack 'group/repo'"}, arguments: []string{}, expectedArgs: &Shell{Arguments: []string{}, SshArgs: []string{"git-receive-pack", "group/repo"}, CommandType: ReceivePack, Env: sshenv.Env{IsSSHConnection: true, OriginalCommand: "git-receive-pack 'group/repo'"}}, }, { desc: `It parses "git receive-pack" command`, executable: &executable.Executable{Name: executable.GitlabShell}, env: sshenv.Env{IsSSHConnection: true, OriginalCommand: `git-receive-pack "group/repo"`}, arguments: []string{}, expectedArgs: &Shell{Arguments: []string{}, SshArgs: []string{"git-receive-pack", "group/repo"}, CommandType: ReceivePack, Env: sshenv.Env{IsSSHConnection: true, OriginalCommand: `git-receive-pack "group/repo"`}}, }, { desc: `It parses a command followed by control characters`, executable: &executable.Executable{Name: executable.GitlabShell}, env: sshenv.Env{IsSSHConnection: true, OriginalCommand: `git-receive-pack group/repo; any command`}, arguments: []string{}, expectedArgs: &Shell{Arguments: []string{}, SshArgs: []string{"git-receive-pack", "group/repo"}, CommandType: ReceivePack, Env: sshenv.Env{IsSSHConnection: true, OriginalCommand: `git-receive-pack group/repo; any command`}}, }, { desc: "It parses git-upload-pack command", executable: &executable.Executable{Name: executable.GitlabShell}, env: sshenv.Env{IsSSHConnection: true, OriginalCommand: `git upload-pack "group/repo"`}, arguments: []string{}, expectedArgs: &Shell{Arguments: []string{}, SshArgs: []string{"git-upload-pack", "group/repo"}, CommandType: UploadPack, Env: sshenv.Env{IsSSHConnection: true, OriginalCommand: `git upload-pack "group/repo"`}}, }, { desc: "It parses git-upload-archive command", executable: &executable.Executable{Name: executable.GitlabShell}, env: sshenv.Env{IsSSHConnection: true, OriginalCommand: "git-upload-archive 'group/repo'"}, arguments: []string{}, expectedArgs: &Shell{Arguments: []string{}, SshArgs: []string{"git-upload-archive", "group/repo"}, CommandType: UploadArchive, Env: sshenv.Env{IsSSHConnection: true, OriginalCommand: "git-upload-archive 'group/repo'"}}, }, { desc: "It parses git-lfs-authenticate command", executable: &executable.Executable{Name: executable.GitlabShell}, env: sshenv.Env{IsSSHConnection: true, OriginalCommand: "git-lfs-authenticate 'group/repo' download"}, arguments: []string{}, expectedArgs: &Shell{Arguments: []string{}, SshArgs: []string{"git-lfs-authenticate", "group/repo", "download"}, CommandType: LfsAuthenticate, Env: sshenv.Env{IsSSHConnection: true, OriginalCommand: "git-lfs-authenticate 'group/repo' download"}}, }, { desc: "It parses authorized-keys command", executable: &executable.Executable{Name: executable.AuthorizedKeysCheck}, arguments: []string{"git", "git", "key"}, expectedArgs: &AuthorizedKeys{Arguments: []string{"git", "git", "key"}, ExpectedUser: "git", ActualUser: "git", Key: "key"}, }, { desc: "It parses authorized-principals command", executable: &executable.Executable{Name: executable.AuthorizedPrincipalsCheck}, arguments: []string{"key", "principal-1", "principal-2"}, expectedArgs: &AuthorizedPrincipals{Arguments: []string{"key", "principal-1", "principal-2"}, KeyId: "key", Principals: []string{"principal-1", "principal-2"}}, }, { desc: "Unknown executable", executable: &executable.Executable{Name: "unknown"}, arguments: []string{}, expectedArgs: &GenericArgs{Arguments: []string{}}, }, } for _, tc := range testCases { t.Run(tc.desc, func(t *testing.T) { result, err := Parse(tc.executable, tc.arguments, tc.env) require.NoError(t, err) require.Equal(t, tc.expectedArgs, result) }) } }
explode_data.jsonl/77816
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 2631 }
[ 2830, 3393, 14463, 7188, 1155, 353, 8840, 836, 8, 341, 18185, 37302, 1669, 3056, 1235, 341, 197, 41653, 260, 914, 198, 197, 67328, 5922, 256, 353, 95924, 30798, 5922, 198, 197, 57538, 688, 29230, 3160, 81214, 198, 197, 197, 16370, 262, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestDeleteSession(t *testing.T) { process := createProcess(1, 1) lease, _ := process.CapacityQueue.Push(emptyRequest.Context()) sessions = make(Sessions) sessions["test-session"] = process timeoutCancels["test-session"] = make(chan bool) leases["test-session"] = lease AssertThat(t, process.CapacityQueue.Size(), EqualTo{1}) reqUrl := createUrl("/wd/hub/firefox/33.0/test-process/1/session/test-session") req, _ := http.NewRequest(http.MethodDelete, reqUrl, strings.NewReader("payload")) resp, err := http.DefaultClient.Do(req) AssertThat(t, err, Is{nil}) AssertThat(t, resp, Code{http.StatusOK}) AssertThat(t, len(sessions), EqualTo{0}) AssertThat(t, process.CapacityQueue.Size(), EqualTo{0}) }
explode_data.jsonl/65293
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 257 }
[ 2830, 3393, 6435, 5283, 1155, 353, 8840, 836, 8, 341, 53314, 1669, 1855, 7423, 7, 16, 11, 220, 16, 340, 197, 1623, 11, 716, 1669, 1882, 78963, 4018, 7554, 34981, 24216, 1900, 9328, 2398, 1903, 8551, 284, 1281, 3759, 8551, 340, 1903, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestContainerStartOnDaemonRestart(t *testing.T) { skip.If(t, testEnv.IsRemoteDaemon(), "cannot start daemon on remote test run") t.Parallel() d := daemon.New(t) d.StartWithBusybox(t, "--iptables=false") defer d.Stop(t) client, err := d.NewClient() assert.Check(t, err, "error creating client") ctx := context.Background() cID := container.Create(t, ctx, client) defer client.ContainerRemove(ctx, cID, types.ContainerRemoveOptions{Force: true}) err = client.ContainerStart(ctx, cID, types.ContainerStartOptions{}) assert.Check(t, err, "error starting test container") inspect, err := client.ContainerInspect(ctx, cID) assert.Check(t, err, "error getting inspect data") ppid := getContainerdShimPid(t, inspect) err = d.Kill() assert.Check(t, err, "failed to kill test daemon") err = unix.Kill(inspect.State.Pid, unix.SIGKILL) assert.Check(t, err, "failed to kill container process") err = unix.Kill(ppid, unix.SIGKILL) assert.Check(t, err, "failed to kill containerd-shim") d.Start(t, "--iptables=false") err = client.ContainerStart(ctx, cID, types.ContainerStartOptions{}) assert.Check(t, err, "failed to start test container") }
explode_data.jsonl/22588
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 414 }
[ 2830, 3393, 4502, 3479, 1925, 89177, 59354, 1155, 353, 8840, 836, 8, 341, 1903, 13389, 32901, 1155, 11, 1273, 14359, 4506, 24703, 89177, 1507, 330, 33260, 1191, 39293, 389, 8699, 1273, 1598, 1138, 3244, 41288, 7957, 2822, 2698, 1669, 3929...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestMVCCStatsDelDelCommitMovesTimestamp(t *testing.T) { defer leaktest.AfterTest(t)() engine := createTestEngine() defer engine.Close() ctx := context.Background() aggMS := &enginepb.MVCCStats{} assertEq(t, engine, "initially", aggMS, &enginepb.MVCCStats{}) key := roachpb.Key("a") ts1 := hlc.Timestamp{WallTime: 1E9} ts2 := hlc.Timestamp{WallTime: 2E9} ts3 := hlc.Timestamp{WallTime: 3E9} // Write a non-transactional tombstone at t=1s. if err := MVCCDelete(ctx, engine, aggMS, key, ts1, nil /* txn */); err != nil { t.Fatal(err) } mKeySize := int64(mvccKey(key).EncodedSize()) require.EqualValues(t, mKeySize, 2) vKeySize := mvccVersionTimestampSize require.EqualValues(t, vKeySize, 12) expMS := enginepb.MVCCStats{ LastUpdateNanos: 1E9, KeyBytes: mKeySize + vKeySize, KeyCount: 1, ValBytes: 0, ValCount: 1, } assertEq(t, engine, "after non-transactional delete", aggMS, &expMS) // Write an tombstone intent at t=2s (anchored at ts=1s, just for fun). txn := &roachpb.Transaction{TxnMeta: enginepb.TxnMeta{ID: uuid.MakeV4(), Timestamp: ts1}} if err := MVCCDelete(ctx, engine, aggMS, key, ts2, txn); err != nil { t.Fatal(err) } mValSize := int64((&enginepb.MVCCMetadata{ Timestamp: hlc.LegacyTimestamp(ts1), Deleted: true, Txn: &txn.TxnMeta, }).Size()) require.EqualValues(t, mValSize, 44) expMS = enginepb.MVCCStats{ LastUpdateNanos: 2E9, KeyBytes: mKeySize + 2*vKeySize, // 2+2*12 = 26 KeyCount: 1, ValBytes: mValSize, // 44 ValCount: 2, IntentCount: 1, IntentBytes: vKeySize, // TBD // The original non-transactional write (at 1s) has now aged one second. GCBytesAge: 1 * vKeySize, } assertEq(t, engine, "after put", aggMS, &expMS) // Now commit or abort the intent, respectively, but with a timestamp gap // (i.e. this is a push-commit as it would happen for a SNAPSHOT txn). t.Run("Commit", func(t *testing.T) { aggMS := *aggMS engine := engine.NewBatch() defer engine.Close() txn := txn.Clone() txn.Status = roachpb.COMMITTED txn.Timestamp.Forward(ts3) if err := MVCCResolveWriteIntent(ctx, engine, &aggMS, roachpb.Intent{Span: roachpb.Span{Key: key}, Status: txn.Status, Txn: txn.TxnMeta}); err != nil { t.Fatal(err) } expAggMS := enginepb.MVCCStats{ LastUpdateNanos: 3E9, KeyBytes: mKeySize + 2*vKeySize, // 2+2*12 = 26 KeyCount: 1, ValBytes: 0, ValCount: 2, IntentCount: 0, IntentBytes: 0, // The very first write picks up another second of age. Before a bug fix, // this was failing to do so. GCBytesAge: 2 * vKeySize, } assertEq(t, engine, "after committing", &aggMS, &expAggMS) }) t.Run("Abort", func(t *testing.T) { aggMS := *aggMS engine := engine.NewBatch() defer engine.Close() txn := txn.Clone() txn.Status = roachpb.ABORTED txn.Timestamp.Forward(ts3) if err := MVCCResolveWriteIntent(ctx, engine, &aggMS, roachpb.Intent{ Span: roachpb.Span{Key: key}, Status: txn.Status, Txn: txn.TxnMeta, }); err != nil { t.Fatal(err) } expAggMS := enginepb.MVCCStats{ LastUpdateNanos: 3E9, KeyBytes: mKeySize + vKeySize, // 2+12 = 14 KeyCount: 1, ValBytes: 0, ValCount: 1, IntentCount: 0, IntentBytes: 0, // We aborted our intent, but the value we first wrote was a tombstone, and // so it's expected to retain its age. Since it's now the only value, it // also contributes as a meta key. GCBytesAge: 2 * (mKeySize + vKeySize), } assertEq(t, engine, "after aborting", &aggMS, &expAggMS) }) }
explode_data.jsonl/41642
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1645 }
[ 2830, 3393, 66626, 3706, 16635, 16532, 16532, 33441, 45789, 20812, 1155, 353, 8840, 836, 8, 341, 16867, 23352, 1944, 36892, 2271, 1155, 8, 741, 80118, 1669, 1855, 2271, 4571, 741, 16867, 4712, 10421, 2822, 20985, 1669, 2266, 19047, 741, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestMainAndExtPolicyCompiler(t *testing.T) { policyDecision := policyCompilerMainAndExt("fraud-detection") mainPMpolicies := tu.GetMainPMDecisions("fraud-detection") extPMpolicies := tu.GetExtPMDecisions("fraud-detection") tu.CheckPolicies(t, policyDecision, mainPMpolicies, extPMpolicies) policyDecision2 := policyCompilerMainAndExt("marketing") mainPMpolicies2 := tu.GetMainPMDecisions("marketing") extPMpolicies2 := tu.GetExtPMDecisions("marketing") tu.CheckPolicies(t, policyDecision2, mainPMpolicies2, extPMpolicies2) }
explode_data.jsonl/42361
{ "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, 6202, 3036, 6756, 13825, 38406, 1155, 353, 8840, 836, 8, 341, 3223, 8018, 74846, 1669, 4842, 38406, 6202, 3036, 6756, 445, 42289, 661, 1737, 22280, 1138, 36641, 8795, 79, 42038, 1669, 9765, 2234, 6202, 8795, 4900, 6805, 445, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestLDAP_AccessControl(t *testing.T) { tests := []accessControlTestCase{ { url: "/api/admin/ldap/reload", method: http.MethodPost, desc: "ReloadLDAPCfg should return 200 for user with correct permissions", expectedCode: http.StatusOK, permissions: []*accesscontrol.Permission{ {Action: accesscontrol.ActionLDAPConfigReload}, }, }, { url: "/api/admin/ldap/reload", method: http.MethodPost, desc: "ReloadLDAPCfg should return 403 for user without required permissions", expectedCode: http.StatusForbidden, permissions: []*accesscontrol.Permission{ {Action: "wrong"}, }, }, { url: "/api/admin/ldap/status", method: http.MethodGet, desc: "GetLDAPStatus should return 200 for user without required permissions", expectedCode: http.StatusOK, permissions: []*accesscontrol.Permission{ {Action: accesscontrol.ActionLDAPStatusRead}, }, }, { url: "/api/admin/ldap/status", method: http.MethodGet, desc: "GetLDAPStatus should return 200 for user without required permissions", expectedCode: http.StatusForbidden, permissions: []*accesscontrol.Permission{ {Action: "wrong"}, }, }, { url: "/api/admin/ldap/test", method: http.MethodGet, desc: "GetUserFromLDAP should return 200 for user with required permissions", expectedCode: http.StatusOK, permissions: []*accesscontrol.Permission{ {Action: accesscontrol.ActionLDAPUsersRead}, }, }, { url: "/api/admin/ldap/test", method: http.MethodGet, desc: "GetUserFromLDAP should return 403 for user without required permissions", expectedCode: http.StatusForbidden, permissions: []*accesscontrol.Permission{ {Action: "wrong"}, }, }, { url: "/api/admin/ldap/sync/1", method: http.MethodPost, desc: "PostSyncUserWithLDAP should return 200 for user without required permissions", expectedCode: http.StatusOK, permissions: []*accesscontrol.Permission{ {Action: accesscontrol.ActionLDAPUsersSync}, }, }, { url: "/api/admin/ldap/sync/1", method: http.MethodPost, desc: "PostSyncUserWithLDAP should return 200 for user without required permissions", expectedCode: http.StatusForbidden, permissions: []*accesscontrol.Permission{ {Action: "wrong"}, }, }, } for _, test := range tests { t.Run(test.desc, func(t *testing.T) { enabled := setting.LDAPEnabled configFile := setting.LDAPConfigFile t.Cleanup(func() { setting.LDAPEnabled = enabled setting.LDAPConfigFile = configFile }) setting.LDAPEnabled = true path, err := filepath.Abs("../../conf/ldap.toml") assert.NoError(t, err) setting.LDAPConfigFile = path cfg := setting.NewCfg() cfg.LDAPEnabled = true sc, hs := setupAccessControlScenarioContext(t, cfg, test.url, test.permissions) hs.SQLStore = &mockstore.SQLStoreMock{ExpectedUser: &models.User{}} hs.authInfoService = &logintest.AuthInfoServiceFake{} hs.Login = &loginservice.LoginServiceMock{} sc.resp = httptest.NewRecorder() sc.req, err = http.NewRequest(test.method, test.url, nil) assert.NoError(t, err) // Add minimal setup to pass handler userSearchResult = &models.ExternalUserInfo{} userSearchError = nil newLDAP = func(_ []*ldap.ServerConfig) multildap.IMultiLDAP { return &LDAPMock{} } sc.exec() assert.Equal(t, test.expectedCode, sc.resp.Code) }) } }
explode_data.jsonl/34376
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1495 }
[ 2830, 3393, 93497, 1566, 1322, 3273, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 3056, 5211, 3273, 16458, 515, 197, 197, 515, 298, 19320, 25, 688, 3521, 2068, 17402, 14, 38665, 10758, 1078, 756, 298, 42257, 25, 981, 1758, 20798, 4133, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestParseError(t *testing.T) { assert := assert.New(t) assertParseError := func(s string) { e := d.Try(func() { Parse(s) }) _, ok := e.(d.WrappedError) assert.True(ok) } assertParseError("foo") // too few digits assertParseError("0000000000000000000000000000000") // too many digits assertParseError("000000000000000000000000000000000") // 'w' not valid base32 assertParseError("00000000000000000000000000000000w") // no prefix assertParseError("sha1-00000000000000000000000000000000") assertParseError("sha2-00000000000000000000000000000000") r := Parse("00000000000000000000000000000000") assert.NotNil(r) }
explode_data.jsonl/15925
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 199 }
[ 2830, 3393, 14463, 1454, 1155, 353, 8840, 836, 8, 341, 6948, 1669, 2060, 7121, 1155, 692, 6948, 14463, 1454, 1669, 2915, 1141, 914, 8, 341, 197, 7727, 1669, 294, 19824, 18552, 368, 314, 14775, 1141, 8, 2751, 197, 197, 6878, 5394, 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 TestWrongFlag(t *testing.T) { app := newTestApp(RunCommand) testArgs := []string{"bcn", "run", "-B", "not-found", "--D", "bash"} err := app.Run(testArgs) if err.Error() != "flag provided but not defined: -B" { t.Fatalf("error running command `bcn run %v", err) } }
explode_data.jsonl/53759
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 108 }
[ 2830, 3393, 29185, 12135, 1155, 353, 8840, 836, 8, 341, 28236, 1669, 501, 2271, 2164, 2785, 359, 4062, 692, 18185, 4117, 1669, 3056, 917, 4913, 8904, 77, 497, 330, 6108, 497, 6523, 33, 497, 330, 1921, 26704, 497, 14482, 35, 497, 330, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestTransformUnstructuredError(t *testing.T) { testCases := []struct { Req *http.Request Res *http.Response Resource string Name string ErrFn func(error) bool Transformed error }{ { Resource: "foo", Name: "bar", Req: &http.Request{ Method: "POST", }, Res: &http.Response{ StatusCode: http.StatusConflict, Body: ioutil.NopCloser(bytes.NewReader(nil)), }, ErrFn: apierrors.IsAlreadyExists, }, { Resource: "foo", Name: "bar", Req: &http.Request{ Method: "PUT", }, Res: &http.Response{ StatusCode: http.StatusConflict, Body: ioutil.NopCloser(bytes.NewReader(nil)), }, ErrFn: apierrors.IsConflict, }, { Resource: "foo", Name: "bar", Req: &http.Request{}, Res: &http.Response{ StatusCode: http.StatusNotFound, Body: ioutil.NopCloser(bytes.NewReader(nil)), }, ErrFn: apierrors.IsNotFound, }, { Req: &http.Request{}, Res: &http.Response{ StatusCode: http.StatusBadRequest, Body: ioutil.NopCloser(bytes.NewReader(nil)), }, ErrFn: apierrors.IsBadRequest, }, { // status in response overrides transformed result Req: &http.Request{}, Res: &http.Response{StatusCode: http.StatusBadRequest, Body: ioutil.NopCloser(bytes.NewReader([]byte(`{"kind":"Status","apiVersion":"v1","status":"Failure","code":404}`)))}, ErrFn: apierrors.IsBadRequest, Transformed: &apierrors.StatusError{ ErrStatus: metav1.Status{Status: metav1.StatusFailure, Code: http.StatusNotFound}, }, }, { // successful status is ignored Req: &http.Request{}, Res: &http.Response{StatusCode: http.StatusBadRequest, Body: ioutil.NopCloser(bytes.NewReader([]byte(`{"kind":"Status","apiVersion":"v1","status":"Success","code":404}`)))}, ErrFn: apierrors.IsBadRequest, }, { // empty object does not change result Req: &http.Request{}, Res: &http.Response{StatusCode: http.StatusBadRequest, Body: ioutil.NopCloser(bytes.NewReader([]byte(`{}`)))}, ErrFn: apierrors.IsBadRequest, }, { // we default apiVersion for backwards compatibility with old clients // TODO: potentially remove in 1.7 Req: &http.Request{}, Res: &http.Response{StatusCode: http.StatusBadRequest, Body: ioutil.NopCloser(bytes.NewReader([]byte(`{"kind":"Status","status":"Failure","code":404}`)))}, ErrFn: apierrors.IsBadRequest, Transformed: &apierrors.StatusError{ ErrStatus: metav1.Status{Status: metav1.StatusFailure, Code: http.StatusNotFound}, }, }, { // we do not default kind Req: &http.Request{}, Res: &http.Response{StatusCode: http.StatusBadRequest, Body: ioutil.NopCloser(bytes.NewReader([]byte(`{"status":"Failure","code":404}`)))}, ErrFn: apierrors.IsBadRequest, }, } for i, testCase := range testCases { r := &Request{ content: defaultContentConfig(), serializers: defaultSerializers(t), resourceName: testCase.Name, resource: testCase.Resource, } result := r.transformResponse(testCase.Res, testCase.Req) err := result.err if !testCase.ErrFn(err) { t.Errorf("unexpected error: %v", err) continue } if !apierrors.IsUnexpectedServerError(err) { t.Errorf("%d: unexpected error type: %v", i, err) } if len(testCase.Name) != 0 && !strings.Contains(err.Error(), testCase.Name) { t.Errorf("unexpected error string: %s", err) } if len(testCase.Resource) != 0 && !strings.Contains(err.Error(), testCase.Resource) { t.Errorf("unexpected error string: %s", err) } // verify Error() properly transforms the error transformed := result.Error() expect := testCase.Transformed if expect == nil { expect = err } if !reflect.DeepEqual(expect, transformed) { t.Errorf("%d: unexpected Error(): %s", i, diff.ObjectReflectDiff(expect, transformed)) } // verify result.Get properly transforms the error if _, err := result.Get(); !reflect.DeepEqual(expect, err) { t.Errorf("%d: unexpected error on Get(): %s", i, diff.ObjectReflectDiff(expect, err)) } // verify result.Into properly handles the error if err := result.Into(&v1.Pod{}); !reflect.DeepEqual(expect, err) { t.Errorf("%d: unexpected error on Into(): %s", i, diff.ObjectReflectDiff(expect, err)) } // verify result.Raw leaves the error in the untransformed state if _, err := result.Raw(); !reflect.DeepEqual(result.err, err) { t.Errorf("%d: unexpected error on Raw(): %s", i, diff.ObjectReflectDiff(expect, err)) } } }
explode_data.jsonl/13266
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1886 }
[ 2830, 3393, 8963, 1806, 51143, 1454, 1155, 353, 8840, 836, 8, 341, 18185, 37302, 1669, 3056, 1235, 341, 197, 197, 27234, 353, 1254, 9659, 198, 197, 197, 1061, 353, 1254, 12574, 271, 197, 79487, 914, 198, 197, 21297, 257, 914, 271, 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 TestQuery_PrefixRequired(t *testing.T) { for _, cmd := range []string{"read", "range"} { c := StartCapture() exit = func(r int) {} os.Args = []string{ "dosa", "query", cmd, "--scope", "foo", "--path", "../../testentity", "TestEntity", "StrKey:eq:foo", } main() assert.Contains(t, c.stop(true), "--namePrefix' was not specified") } }
explode_data.jsonl/70148
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 167 }
[ 2830, 3393, 2859, 1088, 5060, 8164, 1155, 353, 8840, 836, 8, 341, 2023, 8358, 5439, 1669, 2088, 3056, 917, 4913, 878, 497, 330, 9669, 9207, 341, 197, 1444, 1669, 5145, 27429, 741, 197, 14519, 284, 2915, 2601, 526, 8, 5613, 197, 25078,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestOpenShiftStateMetrics(t *testing.T) { c, err := NewConfigFromString(``) if err != nil { t.Fatal(err) } c.SetImages(map[string]string{ "openshift-state-metrics": "docker.io/openshift/origin-openshift-state-metrics:latest", "kube-rbac-proxy": "docker.io/openshift/origin-kube-rbac-proxy:latest", }) f := NewFactory("openshift-monitoring", c) d, err := f.OpenShiftStateMetricsDeployment() if err != nil { t.Fatal(err) } if d.Spec.Template.Spec.Containers[0].Image != "docker.io/openshift/origin-kube-rbac-proxy:latest" { t.Fatal("kube-rbac-proxy image incorrectly configured") } if d.Spec.Template.Spec.Containers[1].Image != "docker.io/openshift/origin-kube-rbac-proxy:latest" { t.Fatal("kube-rbac-proxy image incorrectly configured") } if d.Spec.Template.Spec.Containers[2].Image != "docker.io/openshift/origin-openshift-state-metrics:latest" { t.Fatal("openshift-state-metrics image incorrectly configured") } }
explode_data.jsonl/68662
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 372 }
[ 2830, 3393, 5002, 24841, 1397, 27328, 1155, 353, 8840, 836, 8, 341, 1444, 11, 1848, 1669, 1532, 2648, 44491, 5809, 24183, 743, 1848, 961, 2092, 341, 197, 3244, 26133, 3964, 340, 197, 532, 1444, 4202, 14228, 9147, 14032, 30953, 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...
6
func TestTagsUnmarshal(t *testing.T) { c := NewComment() jsonData := []byte(`{"tags":["such", "wow"]}`) err := json.Unmarshal(jsonData, &c) if err != nil { t.Error(err) } got := c.Tags.All() expected := []string{"wow", "such"} if !equalSlices(expected, got) { t.Errorf("Tags are not the one that we expected them to be: got: %v, expected: %v", got, expected) } }
explode_data.jsonl/58854
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 153 }
[ 2830, 3393, 15930, 1806, 27121, 1155, 353, 8840, 836, 8, 341, 1444, 1669, 1532, 10677, 741, 30847, 1043, 1669, 3056, 3782, 5809, 4913, 14082, 36799, 20805, 497, 330, 57454, 1341, 27085, 9859, 1669, 2951, 38097, 9304, 1043, 11, 609, 66, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestOIAP(t *testing.T) { rwc := openTPMOrSkip(t) defer rwc.Close() // Get auth info from OIAP. _, err := oiap(rwc) if err != nil { t.Fatal("Couldn't run OIAP:", err) } }
explode_data.jsonl/75345
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 91 }
[ 2830, 3393, 79781, 2537, 1155, 353, 8840, 836, 8, 341, 7000, 24028, 1669, 1787, 4239, 44, 2195, 35134, 1155, 340, 16867, 435, 24028, 10421, 2822, 197, 322, 2126, 4166, 3546, 504, 506, 40, 2537, 624, 197, 6878, 1848, 1669, 297, 67721, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestRetrieveWithAgentErrorConditions(t *testing.T) { t.Run("Query_Failure", func (t *testing.T) { ctrl := gomock.NewController(t) mockAgent := mocks.NewMockAgent(ctrl) defer ctrl.Finish() mockAgent.EXPECT().QueryStream(gomock.Any(), gomock.Any()). Return(nil, errors.New("")) mockRequest := httptest.NewRequest("GET", "/", nil) responseRecorder := httptest.NewRecorder() mockRequest = injectMockAssetContext(mockRequest, "T1", "C1", "A1", mockAgent, mocks.NewMockAssetSchemaAlwaysValid(ctrl)) handler := http.HandlerFunc(RetrieveAsset) handler.ServeHTTP(responseRecorder, mockRequest) assert.Equal(t, http.StatusBadGateway, responseRecorder.Result().StatusCode, "Response Should be 502 BAD GATEWAY") }) t.Run("Query_Unauthorized", func (t *testing.T) { ctrl := gomock.NewController(t) mockAgent := mocks.NewMockAgent(ctrl) defer ctrl.Finish() mockAgent.EXPECT().QueryStream(gomock.Any(), gomock.Any()). Return(nil, helpers.ErrUnauthorized) mockRequest := httptest.NewRequest("GET", "/", nil) responseRecorder := httptest.NewRecorder() mockRequest = injectMockAssetContext(mockRequest, "T1", "C1", "A1", mockAgent, mocks.NewMockAssetSchemaAlwaysValid(ctrl)) handler := http.HandlerFunc(RetrieveAsset) handler.ServeHTTP(responseRecorder, mockRequest) assert.Equal(t, http.StatusUnauthorized, responseRecorder.Result().StatusCode, "Response Should be 401 UNAUTHORIZED") }) }
explode_data.jsonl/65737
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 541 }
[ 2830, 3393, 87665, 2354, 16810, 1454, 35435, 1155, 353, 8840, 836, 8, 341, 3244, 16708, 445, 2859, 1400, 9373, 497, 2915, 320, 83, 353, 8840, 836, 8, 341, 197, 84381, 1669, 342, 316, 1176, 7121, 2051, 1155, 340, 197, 77333, 16810, 166...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestSpanLink_TraceID(t *testing.T) { ms := NewSpanLink() assert.EqualValues(t, NewTraceID([16]byte{}), ms.TraceID()) testValTraceID := NewTraceID([16]byte{1, 2, 3, 4, 5, 6, 7, 8, 8, 7, 6, 5, 4, 3, 2, 1}) ms.SetTraceID(testValTraceID) assert.EqualValues(t, testValTraceID, ms.TraceID()) }
explode_data.jsonl/63296
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 141 }
[ 2830, 3393, 12485, 3939, 21038, 578, 915, 1155, 353, 8840, 836, 8, 341, 47691, 1669, 1532, 12485, 3939, 741, 6948, 12808, 6227, 1155, 11, 1532, 6550, 915, 2561, 16, 21, 90184, 6257, 701, 9829, 46920, 915, 2398, 18185, 2208, 6550, 915, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestExtauth(t *testing.T) { RegisterFailHandler(Fail) junitReporter := reporters.NewJUnitReporter("junit.xml") RunSpecsWithDefaultAndCustomReporters(t, "Extauth Suite", []Reporter{junitReporter}) }
explode_data.jsonl/75029
{ "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, 840, 2565, 940, 1155, 353, 8840, 836, 8, 341, 79096, 19524, 3050, 7832, 604, 340, 12428, 3843, 52766, 1669, 19040, 7121, 56248, 52766, 445, 73, 3843, 9028, 1138, 85952, 8327, 16056, 3675, 3036, 10268, 10361, 388, 1155, 11, 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
func TestWrapIfErr2(t *testing.T) { l := NewLabel("") code := newBuilder(). Push(123). Push(true). WrapIfErr(2, l). Push(10). Label(l). Resolve() ctx := NewContext(code) ctx.Exec(0, code.Len()) if v := checkPop(ctx); v != 10 { t.Fatal("v != 10, ret =", v) } }
explode_data.jsonl/74957
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 135 }
[ 2830, 3393, 26787, 2679, 7747, 17, 1155, 353, 8840, 836, 8, 341, 8810, 1669, 1532, 2476, 31764, 43343, 1669, 501, 3297, 25829, 197, 10025, 1116, 7, 16, 17, 18, 4292, 197, 10025, 1116, 3715, 4292, 197, 17300, 4611, 2679, 7747, 7, 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 TestErrorClass(t *testing.T) { db := openTestConn(t) defer db.Close() _, err := db.Query("SELECT int 'notint'") if err == nil { t.Fatal("expected error") } pge, ok := err.(*Error) if !ok { t.Fatalf("expected *pq.Error, got %#+v", err) } if pge.Code.Class() != "22" { t.Fatalf("expected class 28, got %v", pge.Code.Class()) } if pge.Code.Class().Name() != "data_exception" { t.Fatalf("expected data_exception, got %v", pge.Code.Class().Name()) } }
explode_data.jsonl/73502
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 205 }
[ 2830, 3393, 1454, 1957, 1155, 353, 8840, 836, 8, 341, 20939, 1669, 1787, 2271, 9701, 1155, 340, 16867, 2927, 10421, 2822, 197, 6878, 1848, 1669, 2927, 15685, 445, 4858, 526, 364, 1921, 396, 69550, 743, 1848, 621, 2092, 341, 197, 3244, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
5
func TestStripTags(t *testing.T) { Convey("测试HTML标签过滤", t, func() { s := []byte("啊<div class=\"a\">是<span>打</span><!--注释-->发<img src=\"http://asf.jpg\">是<br /></div>") So(string(KeepTags(s)), ShouldEqual, "啊是打发是") So(string(KeepTags(s, "br", "div")), ShouldEqual, "啊<div class=\"a\">是打发是<br /></div>") So(string(StripTags(s)), ShouldEqual, string(s)) So(string(StripTags(s, "br", "div")), ShouldEqual, `啊是<span>打</span><!--注释-->发<img src="http://asf.jpg">是`) }) }
explode_data.jsonl/15618
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 250 }
[ 2830, 3393, 5901, 15930, 1155, 353, 8840, 836, 8, 341, 93070, 5617, 445, 81705, 5835, 105151, 108459, 497, 259, 11, 2915, 368, 341, 197, 1903, 1669, 3056, 3782, 445, 103924, 2626, 536, 4070, 64, 11403, 20412, 9880, 29, 75437, 522, 1480,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestNewList(t *testing.T) { type args struct { appConfig config.Config } tests := []struct { name string args args want *List }{ { name: "TestNewListWithAppConfig", args: args{ appConfig: config.Config{Title: "Test"}, }, want: &List{ appConfig: config.Config{Title: "Test"}, }, }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { if got := NewList(tt.args.appConfig); !reflect.DeepEqual(got, tt.want) { t.Errorf("NewList() = %v, want %v", got, tt.want) } }) } }
explode_data.jsonl/72057
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 246 }
[ 2830, 3393, 3564, 852, 1155, 353, 8840, 836, 8, 341, 13158, 2827, 2036, 341, 197, 28236, 2648, 2193, 10753, 198, 197, 532, 78216, 1669, 3056, 1235, 341, 197, 11609, 914, 198, 197, 31215, 2827, 198, 197, 50780, 353, 852, 198, 197, 5940...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestNoneListRecords(t *testing.T) { noneReset() _, err := cache.ListRecords() if err != nil { t.Errorf("Failed to list records in none cacher - %v", err) } }
explode_data.jsonl/60817
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 67 }
[ 2830, 3393, 4064, 852, 25876, 1155, 353, 8840, 836, 8, 341, 197, 6697, 14828, 741, 197, 6878, 1848, 1669, 6500, 5814, 25876, 741, 743, 1848, 961, 2092, 341, 197, 3244, 13080, 445, 9408, 311, 1140, 7424, 304, 6857, 272, 11007, 481, 101...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestLoadCheckLinux(t *testing.T) { loadAvg = Avg cpuInfo = CPUInfo loadCheck := new(LoadCheck) loadCheck.Configure(nil, nil, "test") mock := mocksender.NewMockSender(loadCheck.ID()) var nbCPU float64 info, _ := cpuInfo() for _, i := range info { nbCPU += float64(i.Cores) } mock.On("Gauge", "system.load.1", 0.83, "", []string(nil)).Return().Times(1) mock.On("Gauge", "system.load.5", 0.96, "", []string(nil)).Return().Times(1) mock.On("Gauge", "system.load.15", 1.15, "", []string(nil)).Return().Times(1) mock.On("Gauge", "system.load.norm.1", 0.83/nbCPU, "", []string(nil)).Return().Times(1) mock.On("Gauge", "system.load.norm.5", 0.96/nbCPU, "", []string(nil)).Return().Times(1) mock.On("Gauge", "system.load.norm.15", 1.15/nbCPU, "", []string(nil)).Return().Times(1) mock.On("Commit").Return().Times(1) loadCheck.Run() mock.AssertExpectations(t) mock.AssertNumberOfCalls(t, "Gauge", 6) mock.AssertNumberOfCalls(t, "Commit", 1) }
explode_data.jsonl/35960
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 419 }
[ 2830, 3393, 5879, 3973, 46324, 1155, 353, 8840, 836, 8, 341, 49386, 39447, 284, 62080, 198, 80335, 1731, 284, 13940, 1731, 198, 49386, 3973, 1669, 501, 4957, 2731, 3973, 340, 49386, 3973, 78281, 27907, 11, 2092, 11, 330, 1944, 5130, 773...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func Test_LoadComponentsConfig(t *testing.T) { installation := &Installation{ Options: &Options{ ComponentsConfig: path.Join("../../internal/testdata", "components.yaml"), }, } components, err := LoadComponentsConfig(installation.Options.ComponentsConfig) require.NoError(t, err) require.Equal(t, 6, len(components)) installation2 := &Installation{ Options: &Options{ ComponentsConfig: path.Join("../../internal/testdata", "installationCR.yaml"), }, } components, err = LoadComponentsConfig(installation2.Options.ComponentsConfig) require.NoError(t, err) require.Equal(t, 8, len(components)) }
explode_data.jsonl/64709
{ "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, 19553, 10443, 2648, 1155, 353, 8840, 836, 8, 341, 197, 80816, 1669, 609, 55453, 515, 197, 197, 3798, 25, 609, 3798, 515, 298, 197, 10443, 2648, 25, 1815, 22363, 36800, 10481, 12697, 691, 497, 330, 5149, 33406, 4461, 197, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestUninjectAndInject(t *testing.T) { defaultOptions := newInjectOptions() defaultOptions.linkerdVersion = "testinjectversion" tlsOptions := newInjectOptions() tlsOptions.linkerdVersion = defaultOptions.linkerdVersion tlsOptions.tls = "optional" proxyResourceOptions := newInjectOptions() proxyResourceOptions.linkerdVersion = defaultOptions.linkerdVersion proxyResourceOptions.proxyCPURequest = "110m" proxyResourceOptions.proxyMemoryRequest = "100Mi" proxyResourceOptions.proxyCPULimit = "160m" proxyResourceOptions.proxyMemoryLimit = "150Mi" noInitContainerOptions := newInjectOptions() noInitContainerOptions.linkerdVersion = defaultOptions.linkerdVersion noInitContainerOptions.noInitContainer = true testCases := []injectYAML{ { inputFileName: "inject_emojivoto_deployment.input.yml", goldenFileName: "inject_emojivoto_deployment.golden.yml", reportFileName: "inject_emojivoto_deployment.report", testInjectOptions: defaultOptions, }, { inputFileName: "inject_emojivoto_list.input.yml", goldenFileName: "inject_emojivoto_list.golden.yml", reportFileName: "inject_emojivoto_list.report", testInjectOptions: defaultOptions, }, { inputFileName: "inject_emojivoto_deployment_hostNetwork_false.input.yml", goldenFileName: "inject_emojivoto_deployment_hostNetwork_false.golden.yml", reportFileName: "inject_emojivoto_deployment_hostNetwork_false.report", testInjectOptions: defaultOptions, }, { inputFileName: "inject_emojivoto_deployment_hostNetwork_true.input.yml", goldenFileName: "inject_emojivoto_deployment_hostNetwork_true.input.yml", reportFileName: "inject_emojivoto_deployment_hostNetwork_true.report", testInjectOptions: defaultOptions, }, { inputFileName: "inject_emojivoto_deployment_injectDisabled.input.yml", goldenFileName: "inject_emojivoto_deployment_injectDisabled.input.yml", reportFileName: "inject_emojivoto_deployment_injectDisabled.report", testInjectOptions: defaultOptions, }, { inputFileName: "inject_emojivoto_deployment_controller_name.input.yml", goldenFileName: "inject_emojivoto_deployment_controller_name.golden.yml", reportFileName: "inject_emojivoto_deployment_controller_name.report", testInjectOptions: defaultOptions, }, { inputFileName: "inject_emojivoto_statefulset.input.yml", goldenFileName: "inject_emojivoto_statefulset.golden.yml", reportFileName: "inject_emojivoto_statefulset.report", testInjectOptions: defaultOptions, }, { inputFileName: "inject_emojivoto_pod.input.yml", goldenFileName: "inject_emojivoto_pod.golden.yml", reportFileName: "inject_emojivoto_pod.report", testInjectOptions: defaultOptions, }, { inputFileName: "inject_emojivoto_pod_with_requests.input.yml", goldenFileName: "inject_emojivoto_pod_with_requests.golden.yml", reportFileName: "inject_emojivoto_pod_with_requests.report", testInjectOptions: proxyResourceOptions, }, { inputFileName: "inject_emojivoto_deployment.input.yml", goldenFileName: "inject_emojivoto_deployment_tls.golden.yml", reportFileName: "inject_emojivoto_deployment.report", testInjectOptions: tlsOptions, }, { inputFileName: "inject_emojivoto_pod.input.yml", goldenFileName: "inject_emojivoto_pod_tls.golden.yml", reportFileName: "inject_emojivoto_pod.report", testInjectOptions: tlsOptions, }, { inputFileName: "inject_emojivoto_deployment_udp.input.yml", goldenFileName: "inject_emojivoto_deployment_udp.golden.yml", reportFileName: "inject_emojivoto_deployment_udp.report", testInjectOptions: defaultOptions, }, { inputFileName: "inject_emojivoto_already_injected.input.yml", goldenFileName: "inject_emojivoto_already_injected.golden.yml", reportFileName: "inject_emojivoto_already_injected.report", testInjectOptions: defaultOptions, }, { inputFileName: "inject_emojivoto_istio.input.yml", goldenFileName: "inject_emojivoto_istio.input.yml", reportFileName: "inject_emojivoto_istio.report", testInjectOptions: defaultOptions, }, { inputFileName: "inject_contour.input.yml", goldenFileName: "inject_contour.input.yml", reportFileName: "inject_contour.report", testInjectOptions: defaultOptions, }, { inputFileName: "inject_emojivoto_deployment_empty_resources.input.yml", goldenFileName: "inject_emojivoto_deployment_empty_resources.golden.yml", reportFileName: "inject_emojivoto_deployment_empty_resources.report", testInjectOptions: defaultOptions, }, { inputFileName: "inject_emojivoto_list_empty_resources.input.yml", goldenFileName: "inject_emojivoto_list_empty_resources.golden.yml", reportFileName: "inject_emojivoto_list_empty_resources.report", testInjectOptions: defaultOptions, }, { inputFileName: "inject_emojivoto_deployment.input.yml", goldenFileName: "inject_emojivoto_deployment_no_init_container.golden.yml", reportFileName: "inject_emojivoto_deployment.report", testInjectOptions: noInitContainerOptions, }, } for i, tc := range testCases { tc := tc // pin verbose = true t.Run(fmt.Sprintf("%d: %s --verbose", i, tc.inputFileName), func(t *testing.T) { testUninjectAndInject(t, tc) }) verbose = false t.Run(fmt.Sprintf("%d: %s", i, tc.inputFileName), func(t *testing.T) { testUninjectAndInject(t, tc) }) } }
explode_data.jsonl/22528
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 2373 }
[ 2830, 3393, 1806, 32133, 3036, 13738, 1155, 353, 8840, 836, 8, 341, 11940, 3798, 1669, 501, 13738, 3798, 741, 11940, 3798, 18076, 14348, 5637, 284, 330, 1944, 32133, 4366, 1837, 3244, 4730, 3798, 1669, 501, 13738, 3798, 741, 3244, 4730, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestSpanEventSlice_RemoveIf(t *testing.T) { // Test RemoveIf on empty slice emptySlice := NewSpanEventSlice() emptySlice.RemoveIf(func(el SpanEvent) bool { t.Fail() return false }) // Test RemoveIf filtered := generateTestSpanEventSlice() pos := 0 filtered.RemoveIf(func(el SpanEvent) bool { pos++ return pos%3 == 0 }) assert.Equal(t, 5, filtered.Len()) }
explode_data.jsonl/63282
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 146 }
[ 2830, 3393, 12485, 1556, 33236, 66843, 2679, 1155, 353, 8840, 836, 8, 341, 197, 322, 3393, 10783, 2679, 389, 4287, 15983, 198, 197, 3194, 33236, 1669, 1532, 12485, 1556, 33236, 741, 197, 3194, 33236, 13270, 2679, 18552, 18584, 11903, 1556...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestPreciseStrategy(t *testing.T) { t.Parallel() t.Run("LimitLessThanOneSetAsOne", func(t2 *testing.T) { t2.Parallel() asrt := assert.New(t2) strategy := NewPreciseStrategy(-10) asrt.Equal(1, strategy.GetLimit(), "expected a default limit of 1") }) t.Run("InitialState", func(t2 *testing.T) { t2.Parallel() asrt := assert.New(t2) strategy := NewPreciseStrategy(1) asrt.Equal(1, strategy.GetLimit(), "expected a default limit of 1") asrt.Equal(0, strategy.GetBusyCount(), "expected all resources free") asrt.Contains(strategy.String(), "PreciseStrategy{inFlight=0, ") }) t.Run("SetLimit", func(t2 *testing.T) { t2.Parallel() asrt := assert.New(t2) strategy := NewPreciseStrategy(0) asrt.Equal(1, strategy.GetLimit(), "expected a default limit of 3") strategy.SetLimit(2) asrt.Equal(2, strategy.GetLimit()) // negative limits result in 1 strategy.SetLimit(-10) asrt.Equal(1, strategy.GetLimit()) asrt.Equal(0, strategy.GetBusyCount(), "expected all resources free") }) t.Run("AcquireIncrementsBusy", func(t2 *testing.T) { t2.Parallel() asrt := assert.New(t2) strategy := NewPreciseStrategy(1) asrt.Equal(0, strategy.GetBusyCount(), "expected all resources free") token, ok := strategy.TryAcquire(context.Background()) asrt.True(ok && token != nil, "expected token") asrt.True(token.IsAcquired(), "expected acquired token") asrt.Equal(1, strategy.GetBusyCount(), "expected 1 resource taken") }) t.Run("ExceedingLimitReturnsFalse", func(t2 *testing.T) { t2.Parallel() asrt := assert.New(t2) strategy := NewPreciseStrategy(1) asrt.Equal(0, strategy.GetBusyCount(), "expected all resources free") token, ok := strategy.TryAcquire(context.Background()) asrt.True(ok && token != nil, "expected token") asrt.True(token.IsAcquired(), "expected acquired token") asrt.Equal(1, strategy.GetBusyCount(), "expected 1 resource taken") // try again but we expect this to fail token2, ok2 := strategy.TryAcquire(context.Background()) asrt.False(ok2, "expected token fail") if token2 != nil { asrt.False(token2.IsAcquired(), "token should not be acquired") } asrt.Equal(1, strategy.GetBusyCount(), "expected only 1 resource taken") }) t.Run("AcquireAndRelease", func(t2 *testing.T) { t2.Parallel() asrt := assert.New(t2) strategy := NewPreciseStrategy(1) asrt.Equal(0, strategy.GetBusyCount(), "expected all resources free") token, ok := strategy.TryAcquire(context.Background()) asrt.True(ok && token != nil, "expected token") asrt.True(token.IsAcquired(), "expected acquired token") asrt.Equal(1, strategy.GetBusyCount(), "expected 1 resource taken") token.Release() asrt.Equal(0, strategy.GetBusyCount(), "expected all resources free") token, ok = strategy.TryAcquire(context.Background()) asrt.True(ok && token != nil, "expected token") asrt.True(token.IsAcquired(), "expected acquired token") asrt.Equal(1, strategy.GetBusyCount(), "expected 1 resource taken") }) }
explode_data.jsonl/66154
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1125 }
[ 2830, 3393, 68833, 1064, 19816, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 2822, 3244, 16708, 445, 16527, 27451, 26067, 3966, 1649, 2121, 3966, 497, 2915, 1155, 17, 353, 8840, 836, 8, 341, 197, 3244, 17, 41288, 7957, 741, 197, 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 TestSplitPipe(t *testing.T) { split := func(t *testing.T, path, el, er string, eo bool) { t.Helper() left, right, ok := splitPossiblePipe(path) // fmt.Printf("%-40s [%v] [%v] [%v]\n", path, left, right, ok) if left != el || right != er || ok != eo { t.Fatalf("expected '%v/%v/%v', got '%v/%v/%v", el, er, eo, left, right, ok) } } split(t, "hello", "", "", false) split(t, "hello.world", "", "", false) split(t, "hello|world", "hello", "world", true) split(t, "hello\\|world", "", "", false) split(t, "hello.#", "", "", false) split(t, `hello.#[a|1="asdf\"|1324"]#\|that`, "", "", false) split(t, `hello.#[a|1="asdf\"|1324"]#|that.more|yikes`, `hello.#[a|1="asdf\"|1324"]#`, "that.more|yikes", true) split(t, `a.#[]#\|b`, "", "", false) }
explode_data.jsonl/43460
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 370 }
[ 2830, 3393, 20193, 34077, 1155, 353, 8840, 836, 8, 341, 1903, 2292, 1669, 2915, 1155, 353, 8840, 836, 11, 1815, 11, 655, 11, 2714, 914, 11, 94603, 1807, 8, 341, 197, 3244, 69282, 741, 197, 35257, 11, 1290, 11, 5394, 1669, 6718, 6522...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestMarshalStanzaError(t *testing.T) { for i, data := range [...]struct { se stanza.Error xml string err bool }{ 0: {stanza.Error{}, "", true}, 1: {stanza.Error{Condition: stanza.UnexpectedRequest}, `<error><unexpected-request xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"></unexpected-request></error>`, false}, 2: {stanza.Error{Type: stanza.Cancel, Condition: stanza.UnexpectedRequest}, `<error type="cancel"><unexpected-request xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"></unexpected-request></error>`, false}, 3: {stanza.Error{Type: stanza.Wait, Condition: stanza.UndefinedCondition}, `<error type="wait"><undefined-condition xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"></undefined-condition></error>`, false}, 4: {stanza.Error{Type: stanza.Modify, By: jid.MustParse("test@example.net"), Condition: stanza.SubscriptionRequired}, `<error type="modify" by="test@example.net"><subscription-required xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"></subscription-required></error>`, false}, 5: {stanza.Error{Type: stanza.Continue, Condition: stanza.ServiceUnavailable, Text: simpleText}, `<error type="continue"><service-unavailable xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"></service-unavailable><text xmlns="urn:ietf:params:xml:ns:xmpp-stanzas">test</text></error>`, false}, } { t.Run(fmt.Sprintf("%d", i), func(t *testing.T) { b, err := xml.Marshal(data.se) switch { case data.err && err == nil: t.Errorf("Expected an error when marshaling stanza error %v", data.se) case !data.err && err != nil: t.Error(err) case err != nil: return case string(b) != data.xml: t.Errorf("Expected marshaling stanza error '%v' to be:\n`%s`\nbut got:\n`%s`.", data.se, data.xml, string(b)) } }) } }
explode_data.jsonl/33542
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 677 }
[ 2830, 3393, 55438, 623, 26466, 1454, 1155, 353, 8840, 836, 8, 341, 2023, 600, 11, 821, 1669, 2088, 48179, 1235, 341, 197, 84686, 220, 95436, 6141, 198, 197, 48460, 914, 198, 197, 9859, 1807, 198, 197, 59403, 197, 197, 15, 25, 314, 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...
7
func TestDynamicListArgsForBuiltin(t *testing.T) { th := Setup(t) defer th.TearDown() provider := &testProvider{} RegisterCommandProvider(provider) command := provider.GetCommand(th.App, nil) emptyCmdArgs := &model.CommandArgs{} t.Run("GetAutoCompleteListItems", func(t *testing.T) { suggestions := th.App.getSuggestions(emptyCmdArgs, []*model.AutocompleteData{command.AutocompleteData}, "", "bogus --dynaArg ", model.SYSTEM_ADMIN_ROLE_ID) assert.Len(t, suggestions, 3) assert.Equal(t, "this is hint 1", suggestions[0].Hint) assert.Equal(t, "this is hint 2", suggestions[1].Hint) assert.Equal(t, "this is hint 3", suggestions[2].Hint) }) t.Run("GetAutoCompleteListItems bad arg", func(t *testing.T) { suggestions := th.App.getSuggestions(emptyCmdArgs, []*model.AutocompleteData{command.AutocompleteData}, "", "bogus --badArg ", model.SYSTEM_ADMIN_ROLE_ID) assert.Len(t, suggestions, 0) }) }
explode_data.jsonl/58282
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 343 }
[ 2830, 3393, 21752, 852, 4117, 2461, 33, 25628, 1155, 353, 8840, 836, 8, 341, 70479, 1669, 18626, 1155, 340, 16867, 270, 836, 682, 4454, 2822, 197, 19979, 1669, 609, 1944, 5179, 16094, 79096, 4062, 5179, 50886, 692, 45566, 1669, 9109, 22...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestParse(t *testing.T) { tc := []struct { Name string FilePath string ExpectedInterfaces []Interface ExpectedConcreteTypes []ConcreteType }{ {Name: "parsing a file with no types", FilePath: "testFiles/noTypes.go", ExpectedInterfaces: []Interface{}, ExpectedConcreteTypes: []ConcreteType{}}, { Name: "parsing a file with one interface", FilePath: "testFiles/withSingleInterface.go", ExpectedInterfaces: []Interface{ { Package: "main", Name: "Test", BaseType: "interface", Methods: []Method{ { Package: "main", Receiver: "", Name: "SigOne", Parameters: []string{"io.Reader"}, ReturnValues: []string{}, }, { Package: "main", Receiver: "", Name: "SigTwo", Parameters: []string{}, ReturnValues: []string{"int"}, }, { Package: "main", Receiver: "", Name: "SigThree", Parameters: []string{"string"}, ReturnValues: []string{"bool"}, }, }, }, }, ExpectedConcreteTypes: []ConcreteType{}, }, { Name: "parsing a file with one struct", FilePath: "testFiles/withSingleStruct.go", ExpectedInterfaces: []Interface{}, ExpectedConcreteTypes: []ConcreteType{ { Package: "main", Name: "Test", BaseType: "struct", Fields: map[string]string{ "FieldOne": "string", "FieldTwo": "int", "io.Reader": "embedded", }, Methods: []Method{}, }, }, }, { Name: "parsing a file with one custom type", FilePath: "testFiles/withSingleCustomType.go", ExpectedInterfaces: []Interface{}, ExpectedConcreteTypes: []ConcreteType{{Package: "main", Name: "CustomType", BaseType: "bool", Fields: map[string]string{}, Methods: []Method{}}}, }, { Name: "parsing a file with multiple of each", FilePath: "testFiles/withMultipleOfEach.go", ExpectedInterfaces: []Interface{ { Package: "main", Name: "FirstInterface", BaseType: "interface", Methods: []Method{ { Package: "main", Receiver: "", Name: "First", Parameters: []string{}, ReturnValues: []string{}, }, { Package: "main", Receiver: "", Name: "second", Parameters: []string{"int"}, ReturnValues: []string{}, }, { Package: "main", Receiver: "", Name: "Third", Parameters: []string{"bool"}, ReturnValues: []string{"io.ReadWriter"}, }, }, }, { Package: "main", Name: "SecondInterface", BaseType: "interface", Methods: []Method{ { Package: "main", Receiver: "", Name: "SecondFirst", Parameters: []string{"float64"}, ReturnValues: []string{}, }, { Package: "main", Receiver: "", Name: "SecondSecond", Parameters: []string{"bool"}, ReturnValues: []string{"bool"}, }, { Package: "main", Receiver: "", Name: "SecondThird", Parameters: []string{"string", "string", "string", "float32"}, ReturnValues: []string{"*io.Reader"}, }, }, }, }, ExpectedConcreteTypes: []ConcreteType{ { Package: "main", Name: "FirstStruct", BaseType: "struct", Fields: map[string]string{ "FirstField": "string", "SecondField": "float64", "ThirdField": "*int", }, Methods: []Method{}, }, { Package: "main", Name: "SecondStruct", BaseType: "struct", Fields: map[string]string{ "*FirstStruct": "embedded", "SecondFirstField": "string", "SecondSecondField": "int", }, Methods: []Method{}, }, { Package: "main", Name: "FirstCustomType", BaseType: "float64", Fields: map[string]string{}, Methods: []Method{}, }, { Package: "main", Name: "SecondCustomType", BaseType: "string", Fields: map[string]string{}, Methods: []Method{}, }, }, }, { Name: "parsing a file with methods on structs and custom types", FilePath: "testFiles/withMultipleMethods.go", ExpectedInterfaces: []Interface{}, ExpectedConcreteTypes: []ConcreteType{ { Package: "test", Name: "S", BaseType: "struct", Fields: map[string]string{ "FieldOne": "string", "io.Reader": "embedded", "FieldThree": "int", }, Methods: []Method{ { Package: "test", Receiver: "*S", Name: "MethodOne", Parameters: []string{"string", "string", "string"}, ReturnValues: []string{"*int"}, }, { Package: "test", Receiver: "*S", Name: "MethodTwo", Parameters: []string{}, ReturnValues: []string{}, }, }, }, { Package: "test", Name: "Custom", BaseType: "bool", Fields: map[string]string{}, Methods: []Method{ { Package: "test", Receiver: "Custom", Name: "SomethingElse", Parameters: []string{}, ReturnValues: []string{"bool", "error", "interface{}"}, }, }, }, }, }, { Name: "parsing a file with nameless parameters and receivers", FilePath: "testFiles/withNamelessParams.go", ExpectedInterfaces: []Interface{}, ExpectedConcreteTypes: []ConcreteType{ { Package: "test", Name: "Custom", BaseType: "struct", Fields: map[string]string{}, Methods: []Method{ { Package: "test", Receiver: "Custom", Name: "MethodOne", Parameters: []string{"io.Writer", "int", "*string"}, ReturnValues: []string{"io.Writer", "error"}, }, }, }, }, }, } for _, tt := range tc { t.Run(tt.Name, func(t *testing.T) { file, err := os.Open(tt.FilePath) defer file.Close() if err != nil { t.Fatalf("unable to open file: %v", err) } typer := NewTyper() err = typer.Parse(file) if err != nil { t.Fatalf("unable to parse file: %v", err) } typer.ResolveMethods() gotInterfaces := typer.GetInterfaces() gotConcreteTypes := typer.GetConcreteTypes() if !reflect.DeepEqual(gotInterfaces, tt.ExpectedInterfaces) { t.Errorf("got Interfaces: %+v, wanted Interfaces: %+v", gotInterfaces, tt.ExpectedInterfaces) } if !reflect.DeepEqual(gotConcreteTypes, tt.ExpectedConcreteTypes) { t.Errorf("got ConcreteTypes: %+v, wanted ConcreteTypes: %+v", gotConcreteTypes, tt.ExpectedConcreteTypes) } }) } t.Run("parsing an invalid file", func(t *testing.T) { file, err := os.Open("testFiles/invalid.go") defer file.Close() if err != nil { t.Fatalf("unable to open file: %v", err) } typer := NewTyper() err = typer.Parse(file) if err.Error() != "unable to parse file, no package name" { t.Errorf("invalid error returned when parsing file without a package name") } }) }
explode_data.jsonl/18086
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 3757 }
[ 2830, 3393, 14463, 1155, 353, 8840, 836, 8, 341, 78255, 1669, 3056, 1235, 341, 197, 21297, 1698, 914, 198, 197, 197, 19090, 1060, 914, 198, 197, 197, 18896, 41066, 262, 3056, 5051, 198, 197, 197, 18896, 83594, 4173, 3056, 83594, 929, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestRunSimple(t *testing.T) { args, expectedResult := []int{3, 4, -1, 1}, 2 if Run(args) != expectedResult { t.Fail() } args, expectedResult = []int{1, 2, 0}, 3 if Run(args) != expectedResult { t.Fail() } }
explode_data.jsonl/51751
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 93 }
[ 2830, 3393, 6727, 16374, 1155, 353, 8840, 836, 8, 341, 31215, 11, 81441, 1669, 3056, 396, 90, 18, 11, 220, 19, 11, 481, 16, 11, 220, 16, 2137, 220, 17, 198, 743, 6452, 7356, 8, 961, 81441, 341, 197, 3244, 57243, 741, 197, 630, 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...
3
func TestAddFailureWrongPath(t *testing.T) { testRepo := newTestRepo(t) defer testRepo.cleanup(t) err := testRepo.sut.Add("wrong") require.NotNil(t, err) require.Contains(t, err.Error(), "adding file wrong to repository") }
explode_data.jsonl/14016
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 90 }
[ 2830, 3393, 2212, 17507, 29185, 1820, 1155, 353, 8840, 836, 8, 341, 18185, 25243, 1669, 501, 2271, 25243, 1155, 340, 16867, 1273, 25243, 87689, 1155, 692, 9859, 1669, 1273, 25243, 514, 332, 1904, 445, 34870, 1138, 17957, 93882, 1155, 11, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
func TestGetOpenOrders(t *testing.T) { t.Parallel() if !areTestAPIKeysSet() { t.Skip() } _, err := f.GetOpenOrders(context.Background(), "") if err != nil { t.Error(err) } _, err = f.GetOpenOrders(context.Background(), spotPair) if err != nil { t.Error(err) } }
explode_data.jsonl/15184
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 122 }
[ 2830, 3393, 1949, 5002, 24898, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 741, 743, 753, 546, 2271, 7082, 8850, 1649, 368, 341, 197, 3244, 57776, 741, 197, 532, 197, 6878, 1848, 1669, 282, 2234, 5002, 24898, 5378, 19047, 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, 1...
4
func TestChatSrvRetentionSweepTeam(t *testing.T) { sweepChannel := randSweepChannel() t.Logf("sweepChannel: %v", sweepChannel) runWithMemberTypes(t, func(mt chat1.ConversationMembersType) { switch mt { case chat1.ConversationMembersType_TEAM: default: t.Logf("skipping %v stage", mt) return } runWithRetentionPolicyTypes(t, func(policy chat1.RetentionPolicy, ephemeralLifetime *gregor1.DurationSec) { ctc := makeChatTestContext(t, "TestChatSrvTeamRetention", 2) defer ctc.cleanup() users := ctc.users() ctx := ctc.as(t, users[0]).startCtx _ = ctc.as(t, users[1]).startCtx for i, u := range users { t.Logf("user[%v] %v %v", i, u.Username, u.User.GetUID()) ctc.world.Tcs[u.Username].ChatG.Syncer.(*Syncer).isConnected = true } listener := newServerChatListener() ctc.as(t, users[1]).h.G().NotifyRouter.AddListener(listener) // 3 convs // convA: inherit team expire policy (default) // convB: expire policy // convC: retain policy var convs []chat1.ConversationInfoLocal for i := 0; i < 3; i++ { t.Logf("creating conv %v", i) var topicName *string if i > 0 { s := fmt.Sprintf("regarding-%v-gons", i) topicName = &s } conv := mustCreateChannelForTest(t, ctc, users[0], chat1.TopicType_CHAT, topicName, mt, ctc.as(t, users[1]).user()) convs = append(convs, conv) if i > 0 { mustJoinConversationByID(t, ctc, users[1], conv.Id) consumeJoinConv(t, listener) } } convA := convs[0] convB := convs[1] convC := convs[2] teamID := tlfIDToTeamIDForce(t, convA.Triple.Tlfid) // policy can be EXPIRE or EPHEMERAL here. teamPolicy := policy convExpirePolicy := policy convRetainPolicy := chat1.NewRetentionPolicyWithRetain(chat1.RpRetain{}) latestMsgMap := make(map[string] /*convID*/ chat1.MessageID) latestMsg := func(convID chat1.ConversationID) chat1.MessageID { return latestMsgMap[convID.String()] } for i, conv := range convs { t.Logf("conv (%v/%v) %v in team %v", i+1, len(convs), conv.Id, tlfIDToTeamIDForce(t, conv.Triple.Tlfid)) msgID := mustPostLocalForTest(t, ctc, users[0], conv, chat1.NewMessageBodyWithText(chat1.MessageText{Body: "hello!"})) latestMsgMap[conv.Id.String()] = msgID ignoreTypes := []chat1.MessageType{chat1.MessageType_SYSTEM, chat1.MessageType_JOIN} consumeNewMsgWhileIgnoring(t, listener, chat1.MessageType_TEXT, ignoreTypes, chat1.ChatActivitySource_REMOTE) } mustSetConvRetention(t, ctc, users[0], convB.Id, convExpirePolicy, sweepChannel) require.True(t, consumeSetConvRetention(t, listener).Eq(convB.Id)) mustSetTeamRetention(t, ctc, users[0], teamID, teamPolicy, sweepChannel) require.True(t, consumeSetTeamRetention(t, listener).Eq(teamID)) mustSetConvRetention(t, ctc, users[0], convC.Id, convRetainPolicy, sweepChannel) require.True(t, consumeSetConvRetention(t, listener).Eq(convC.Id)) // This will take at least 1 second. sweepPollForDeletion(t, ctc, users[0], listener, convB.Id, latestMsg(convB.Id)+1) sweepPollForDeletion(t, ctc, users[0], listener, convA.Id, latestMsg(convA.Id)+1) sweepNoDeletion(t, ctc, users[0], convC.Id) checkThread := func(convID chat1.ConversationID, expectDeleted bool) { tvres, err := ctc.as(t, users[1]).chatLocalHandler().GetThreadLocal(ctx, chat1.GetThreadLocalArg{ConversationID: convID}) require.NoError(t, err) var nText int for _, msg := range tvres.Thread.Messages { require.True(t, msg.IsValidFull()) require.Equal(t, chat1.MessageID(0), msg.Valid().ServerHeader.SupersededBy) if msg.GetMessageType() == chat1.MessageType_TEXT { nText++ } } if expectDeleted { require.Equal(t, 0, nText, "conv contents should be deleted: %v", convID.DbShortFormString()) } else { require.Equal(t, 1, nText) } } checkThread(convA.Id, true) checkThread(convB.Id, true) checkThread(convC.Id, false) if ephemeralLifetime != nil { for _, conv := range []chat1.ConversationInfoLocal{convA, convB} { // If we are using an ephemeral policy make sure messages with a lifetime exceeding // the policy age are blocked. badLifetime := *ephemeralLifetime + 1 _, err := postLocalEphemeralForTest(t, ctc, users[0], conv, chat1.NewMessageBodyWithText(chat1.MessageText{Body: "hello!"}), &badLifetime) require.Error(t, err) require.IsType(t, libkb.ChatEphemeralRetentionPolicyViolatedError{}, err) mustPostLocalEphemeralForTest(t, ctc, users[0], conv, chat1.NewMessageBodyWithText(chat1.MessageText{Body: "hello!"}), ephemeralLifetime) } } }) }) }
explode_data.jsonl/63707
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1978 }
[ 2830, 3393, 15672, 50, 10553, 86329, 50, 48542, 14597, 1155, 353, 8840, 836, 8, 341, 1903, 48542, 9629, 1669, 10382, 50, 48542, 9629, 741, 3244, 98954, 445, 82, 48542, 9629, 25, 1018, 85, 497, 23146, 9629, 340, 56742, 2354, 9366, 4173, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestH12_AutoGzip(t *testing.T) { h12Compare{ Handler: func(w ResponseWriter, r *Request) { if ae := r.Header.Get("Accept-Encoding"); ae != "gzip" { t.Errorf("%s Accept-Encoding = %q; want gzip", r.Proto, ae) } w.Header().Set("Content-Encoding", "gzip") gz := gzip.NewWriter(w) io.WriteString(gz, "I am some gzipped content. Go go go go go go go go go go go go should compress well.") gz.Close() }, }.run(t) }
explode_data.jsonl/4751
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 192 }
[ 2830, 3393, 39, 16, 17, 1566, 1535, 38, 9964, 1155, 353, 8840, 836, 8, 341, 9598, 16, 17, 27374, 515, 197, 197, 3050, 25, 2915, 3622, 5949, 6492, 11, 435, 353, 1900, 8, 341, 298, 743, 41856, 1669, 435, 15753, 2234, 445, 16646, 673...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestPushPlainHTTPInsecure(t *testing.T) { // Skip docker, because "dockerd --insecure-registries" requires restarting the daemon testutil.DockerIncompatible(t) base := testutil.NewBase(t) reg := testregistry.NewPlainHTTP(base) defer reg.Cleanup() base.Cmd("pull", testutil.CommonImage).AssertOK() testImageRef := fmt.Sprintf("%s:%d/%s:%s", reg.IP.String(), reg.ListenPort, testutil.Identifier(t), strings.Split(testutil.CommonImage, ":")[1]) t.Logf("testImageRef=%q", testImageRef) base.Cmd("tag", testutil.CommonImage, testImageRef).AssertOK() base.Cmd("--insecure-registry", "push", testImageRef).AssertOK() }
explode_data.jsonl/51085
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 231 }
[ 2830, 3393, 16644, 26982, 9230, 641, 25132, 1155, 353, 8840, 836, 8, 341, 197, 322, 25784, 26588, 11, 1576, 330, 28648, 67, 1177, 258, 25132, 32163, 380, 4019, 1, 7460, 92524, 279, 39293, 198, 18185, 1314, 909, 13659, 641, 34842, 1155, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestScan(t *testing.T) { rows := testRows{} rows.addValue("field_a", "a") rows.addValue("field_b", "b") rows.addValue("field_c", "c") e := testType{"a", "", "c"} var r testType err := Scan(&r, rows) if err != nil { t.Errorf("unexpected error: %s", err) } if r != e { t.Errorf("expected %q got %q", e, r) } }
explode_data.jsonl/41062
{ "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, 26570, 1155, 353, 8840, 836, 8, 341, 68438, 1669, 1273, 9024, 16094, 68438, 82259, 445, 2566, 4306, 497, 330, 64, 1138, 68438, 82259, 445, 2566, 880, 497, 330, 65, 1138, 68438, 82259, 445, 2566, 666, 497, 330, 66, 5130, 77...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestEmbedEtcd(t *testing.T) { s := &etcdTester{} s.setUpTest(t) defer s.tearDownTest(t) curl := s.clientURL.String() cli, err := clientv3.New(clientv3.Config{ Endpoints: []string{curl}, DialTimeout: 3 * time.Second, }) require.NoError(t, err) defer cli.Close() var ( key = "test-key" val = "test-val" ) _, err = cli.Put(context.Background(), key, val) require.NoError(t, err) resp, err2 := cli.Get(context.Background(), key) require.NoError(t, err2) require.Len(t, resp.Kvs, 1) require.Equal(t, resp.Kvs[0].Value, []byte(val)) }
explode_data.jsonl/70527
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 255 }
[ 2830, 3393, 25486, 31860, 4385, 1155, 353, 8840, 836, 8, 341, 1903, 1669, 609, 295, 4385, 58699, 16094, 1903, 77700, 2271, 1155, 340, 16867, 274, 31853, 59342, 2271, 1155, 340, 45599, 1669, 274, 6581, 3144, 6431, 741, 86448, 11, 1848, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestChatSrvTopicNameState(t *testing.T) { runWithMemberTypes(t, func(mt chat1.ConversationMembersType) { // Only run this test for teams switch mt { case chat1.ConversationMembersType_TEAM: default: return } ctc := makeChatTestContext(t, "TestChatSrvTopicNameState", 1) defer ctc.cleanup() users := ctc.users() ui := kbtest.NewChatUI() ctc.as(t, users[0]).h.mockChatUI = ui listener0 := newServerChatListener() ctc.as(t, users[0]).h.G().NotifyRouter.AddListener(listener0) ctc.world.Tcs[users[0].Username].ChatG.Syncer.(*Syncer).isConnected = true tc := ctc.world.Tcs[users[0].Username] ri := ctc.as(t, users[0]).ri firstConv := mustCreateConversationForTest(t, ctc, users[0], chat1.TopicType_CHAT, mt) consumeNewConversation(t, listener0, firstConv.Id) topicName := "MIKE" ctx := ctc.as(t, users[0]).startCtx ncres, err := ctc.as(t, users[0]).chatLocalHandler().NewConversationLocal(ctx, chat1.NewConversationLocalArg{ TlfName: firstConv.TlfName, TopicName: &topicName, TopicType: chat1.TopicType_CHAT, TlfVisibility: keybase1.TLFVisibility_PRIVATE, MembersType: chat1.ConversationMembersType_TEAM, }) require.NoError(t, err) convInfo := ncres.Conv.Info consumeNewConversation(t, listener0, convInfo.Id) consumeNewMsgRemote(t, listener0, chat1.MessageType_JOIN) consumeTeamType(t, listener0) consumeNewMsgRemote(t, listener0, chat1.MessageType_SYSTEM) // Delete the conv, make sure we can still create a new channel after _, err = ctc.as(t, users[0]).chatLocalHandler().DeleteConversationLocal(ctx, chat1.DeleteConversationLocalArg{ ConvID: convInfo.Id, }) require.NoError(t, err) consumeLeaveConv(t, listener0) consumeTeamType(t, listener0) t.Logf("Deleted conv") topicName = "josh" ncres, err = ctc.as(t, users[0]).chatLocalHandler().NewConversationLocal(ctx, chat1.NewConversationLocalArg{ TlfName: firstConv.TlfName, TopicName: &topicName, TopicType: chat1.TopicType_CHAT, TlfVisibility: keybase1.TLFVisibility_PRIVATE, MembersType: chat1.ConversationMembersType_TEAM, }) require.NoError(t, err) conv := ncres.Conv convInfo = conv.Info consumeNewConversation(t, listener0, convInfo.Id) consumeNewMsgRemote(t, listener0, chat1.MessageType_JOIN) consumeNewMsgRemote(t, listener0, chat1.MessageType_SYSTEM) // Creating a conversation with same topic name just returns the matching one topicName = "random" ncarg := chat1.NewConversationLocalArg{ TlfName: convInfo.TlfName, TopicName: &topicName, TopicType: chat1.TopicType_CHAT, TlfVisibility: keybase1.TLFVisibility_PRIVATE, MembersType: chat1.ConversationMembersType_TEAM, } ncres, err = ctc.as(t, users[0]).chatLocalHandler().NewConversationLocal(ctx, ncarg) require.NoError(t, err) randomConvID := ncres.Conv.GetConvID() consumeNewConversation(t, listener0, randomConvID) consumeNewMsgRemote(t, listener0, chat1.MessageType_JOIN) ncres, err = ctc.as(t, users[0]).chatLocalHandler().NewConversationLocal(ctx, ncarg) require.NoError(t, err) require.Equal(t, randomConvID, ncres.Conv.GetConvID()) assertNoNewConversation(t, listener0) // Try to change topic name to one that exists plarg := chat1.PostLocalArg{ ConversationID: convInfo.Id, Msg: chat1.MessagePlaintext{ ClientHeader: chat1.MessageClientHeader{ Conv: convInfo.Triple, MessageType: chat1.MessageType_METADATA, TlfName: convInfo.TlfName, }, MessageBody: chat1.NewMessageBodyWithMetadata(chat1.MessageConversationMetadata{ ConversationTitle: topicName, }), }, IdentifyBehavior: keybase1.TLFIdentifyBehavior_CHAT_CLI, } _, err = ctc.as(t, users[0]).chatLocalHandler().PostLocal(ctx, plarg) require.Error(t, err) require.IsType(t, DuplicateTopicNameError{}, err) plarg.Msg.MessageBody = chat1.NewMessageBodyWithMetadata(chat1.MessageConversationMetadata{ ConversationTitle: "EULALIA", }) _, err = ctc.as(t, users[0]).chatLocalHandler().PostLocal(ctx, plarg) require.NoError(t, err) consumeNewMsgRemote(t, listener0, chat1.MessageType_METADATA) // Create race with topic name state, and make sure we do the right thing plarg.Msg.MessageBody = chat1.NewMessageBodyWithMetadata(chat1.MessageConversationMetadata{ ConversationTitle: "ANOTHERONE", }) sender := NewBlockingSender(tc.Context(), NewBoxer(tc.Context()), func() chat1.RemoteInterface { return ri }) prepareRes, err := sender.Prepare(ctx, plarg.Msg, mt, &conv, nil) require.NoError(t, err) msg1 := prepareRes.Boxed ts1 := prepareRes.TopicNameState prepareRes, err = sender.Prepare(ctx, plarg.Msg, mt, &conv, nil) require.NoError(t, err) msg2 := prepareRes.Boxed ts2 := prepareRes.TopicNameState require.True(t, ts1.Eq(*ts2)) _, err = ri.PostRemote(ctx, chat1.PostRemoteArg{ ConversationID: convInfo.Id, MessageBoxed: msg1, TopicNameState: ts1, }) require.NoError(t, err) consumeNewMsgRemote(t, listener0, chat1.MessageType_METADATA) _, err = ri.PostRemote(ctx, chat1.PostRemoteArg{ ConversationID: convInfo.Id, MessageBoxed: msg2, TopicNameState: ts2, }) require.Error(t, err) require.IsType(t, libkb.ChatStalePreviousStateError{}, err) }) }
explode_data.jsonl/63711
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 2209 }
[ 2830, 3393, 15672, 50, 10553, 26406, 675, 1397, 1155, 353, 8840, 836, 8, 341, 56742, 2354, 9366, 4173, 1155, 11, 2915, 81618, 6236, 16, 4801, 22323, 24371, 929, 8, 341, 197, 197, 322, 8278, 1598, 419, 1273, 369, 7263, 198, 197, 8961, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestUnmarshalPex(t *testing.T) { var pem peerExchangeMessage err := bencode.Unmarshal([]byte("d5:added12:\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0ce"), &pem) require.NoError(t, err) require.EqualValues(t, 2, len(pem.Added)) require.EqualValues(t, 1286, pem.Added[0].Port) require.EqualValues(t, 0x100*0xb+0xc, pem.Added[1].Port) }
explode_data.jsonl/7443
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 172 }
[ 2830, 3393, 1806, 27121, 47, 327, 1155, 353, 8840, 836, 8, 341, 2405, 54184, 14397, 31564, 2052, 198, 9859, 1669, 293, 6180, 38097, 10556, 3782, 445, 67, 20, 25, 16828, 16, 17, 7190, 87, 15, 16, 3462, 15, 17, 3462, 15, 18, 3462, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestContext_PrintObject(t *testing.T) { ctx := client.Context{} animal := &testdata.Dog{ Size_: "big", Name: "Spot", } any, err := types.NewAnyWithValue(animal) require.NoError(t, err) hasAnimal := &testdata.HasAnimal{ Animal: any, X: 10, } // // proto // registry := testdata.NewTestInterfaceRegistry() ctx = ctx.WithJSONMarshaler(codec.NewProtoCodec(registry)) // json buf := &bytes.Buffer{} ctx = ctx.WithOutput(buf) ctx.OutputFormat = "json" err = ctx.PrintProto(hasAnimal) require.NoError(t, err) require.Equal(t, `{"animal":{"@type":"/testdata.Dog","size":"big","name":"Spot"},"x":"10"} `, string(buf.Bytes())) // yaml buf = &bytes.Buffer{} ctx = ctx.WithOutput(buf) ctx.OutputFormat = "text" err = ctx.PrintProto(hasAnimal) require.NoError(t, err) require.Equal(t, `animal: '@type': /testdata.Dog name: Spot size: big x: "10" `, string(buf.Bytes())) // // amino // amino := testdata.NewTestAmino() ctx = ctx.WithLegacyAmino(&codec.LegacyAmino{Amino: amino}) // json buf = &bytes.Buffer{} ctx = ctx.WithOutput(buf) ctx.OutputFormat = "json" err = ctx.PrintObjectLegacy(hasAnimal) require.NoError(t, err) require.Equal(t, `{"type":"testdata/HasAnimal","value":{"animal":{"type":"testdata/Dog","value":{"size":"big","name":"Spot"}},"x":"10"}} `, string(buf.Bytes())) // yaml buf = &bytes.Buffer{} ctx = ctx.WithOutput(buf) ctx.OutputFormat = "text" err = ctx.PrintObjectLegacy(hasAnimal) require.NoError(t, err) require.Equal(t, `type: testdata/HasAnimal value: animal: type: testdata/Dog value: name: Spot size: big x: "10" `, string(buf.Bytes())) }
explode_data.jsonl/30380
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 696 }
[ 2830, 3393, 1972, 45788, 1190, 1155, 353, 8840, 836, 8, 341, 20985, 1669, 2943, 9328, 31483, 197, 47899, 1669, 609, 92425, 909, 538, 515, 197, 91224, 23211, 330, 16154, 756, 197, 21297, 25, 220, 330, 47049, 756, 197, 532, 197, 3767, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestGetPrefix(t *testing.T) { tests := []struct { input string expected string }{ { input: "/foo/bar", expected: "foo/bar", }, { input: "foo/bar", expected: "foo/bar", }, } for _, test := range tests { out := getPrefix(test.input) if out != test.expected { t.Errorf("expected: %s, saw: %s", test.expected, out) } } }
explode_data.jsonl/58284
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 172 }
[ 2830, 3393, 1949, 14335, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 3056, 1235, 341, 197, 22427, 262, 914, 198, 197, 42400, 914, 198, 197, 59403, 197, 197, 515, 298, 22427, 25, 262, 3521, 7975, 49513, 756, 298, 42400, 25, 330, 7975, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestNewExporter(t *testing.T) { cases := []struct { uri string ok bool }{ {uri: "", ok: false}, {uri: "localhost:8500", ok: true}, {uri: "https://localhost:8500", ok: true}, {uri: "http://some.where:8500", ok: true}, {uri: "fuuuu://localhost:8500", ok: false}, } for _, test := range cases { _, err := NewExporter(test.uri, "", ".*", true) if test.ok && err != nil { t.Errorf("expected no error w/ %s but got %s", test.uri, err) } if !test.ok && err == nil { t.Errorf("expected error w/ %s but got %s", test.uri, err) } } }
explode_data.jsonl/3409
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 246 }
[ 2830, 3393, 3564, 88025, 1155, 353, 8840, 836, 8, 341, 1444, 2264, 1669, 3056, 1235, 341, 197, 197, 6070, 914, 198, 197, 59268, 220, 1807, 198, 197, 59403, 197, 197, 90, 6070, 25, 7342, 5394, 25, 895, 1583, 197, 197, 90, 6070, 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...
6
func TestCreateAssetTxSyntacticVerifyBaseTx(t *testing.T) { tx, c, ctx := validCreateAssetTx(t) var baseTx BaseTx tx.BaseTx = baseTx if err := tx.SyntacticVerify(ctx, c, assetID, 0, 0, 2); err == nil { t.Fatal("CreateAssetTx should have failed syntactic verification due to invalid BaseTx (nil)") } }
explode_data.jsonl/73234
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 113 }
[ 2830, 3393, 4021, 16604, 31584, 34667, 406, 23170, 32627, 3978, 31584, 1155, 353, 8840, 836, 8, 341, 46237, 11, 272, 11, 5635, 1669, 2697, 4021, 16604, 31584, 1155, 340, 2405, 2331, 31584, 5351, 31584, 198, 46237, 13018, 31584, 284, 2331,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestCheckHash(t *testing.T) { for i, v := range diffSpecs[:2] { in, _ := hex.DecodeString(v.input) if !CheckHash(in, 0) { t.Errorf("\n[%d] check hash goes wrong", i) } if !CheckHash(in, v.output-1) { t.Errorf("\n[%d] check hash goes wrong", i) } if !CheckHash(in, v.output) { t.Errorf("\n[%d] check hash goes wrong", i) } if CheckHash(in, v.output+1) { t.Errorf("\n[%d] check hash goes wrong", i) } } if CheckHash([]byte("Obviously less than 32 bytes"), 0) { t.Errorf("\nexpected:\n\tfalse\ngot:\n\ttrue\n") } if CheckHash([]byte("Here it is obviously more than 32 bytes"), 0) { t.Errorf("\nexpected:\n\tfalse\ngot:\n\ttrue\n") } }
explode_data.jsonl/59326
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 312 }
[ 2830, 3393, 3973, 6370, 1155, 353, 8840, 836, 8, 341, 2023, 600, 11, 348, 1669, 2088, 3638, 8327, 82, 3447, 17, 60, 341, 197, 17430, 11, 716, 1669, 12371, 56372, 703, 3747, 10046, 340, 197, 743, 753, 3973, 6370, 5900, 11, 220, 15, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
8
func TestReadDirentsSymlinks(t *testing.T) { osDirname := filepath.Join(testRoot, "d0/symlinks") actual, err := ReadDirents(osDirname, nil) ensureError(t, err) // Because some platforms set multiple mode type bits, when we create the // expected slice, we need to ensure the mode types are set appropriately. var expected Dirents for _, pathname := range []string{"nothing", "toAbs", "toD1", "toF1", "d4"} { info, err := os.Lstat(filepath.Join(osDirname, pathname)) if err != nil { t.Fatal(err) } expected = append(expected, &Dirent{name: pathname, modeType: info.Mode() & os.ModeType}) } ensureDirentsMatch(t, actual, expected) }
explode_data.jsonl/77080
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 239 }
[ 2830, 3393, 4418, 87409, 65677, 34667, 1014, 15504, 1155, 353, 8840, 836, 8, 341, 25078, 6184, 606, 1669, 26054, 22363, 8623, 8439, 11, 330, 67, 15, 2687, 88, 1014, 15504, 5130, 88814, 11, 1848, 1669, 4457, 87409, 65677, 9638, 6184, 606...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_fsSource_ReadDown_FileError(t *testing.T) { s := getTestSource(t, "sample-migrations") s.migrations.Append(&migration{ Version: 4, Identifier: "invalid", Direction: "down", Raw: "no_such_file", }) _, _, err := s.ReadDown(4) if !errors.Is(err, fs.ErrNotExist) { t.Fatalf("expected ErrNotExist, got: %v", err) } }
explode_data.jsonl/81891
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 162 }
[ 2830, 3393, 34470, 3608, 38381, 4454, 34061, 1454, 1155, 353, 8840, 836, 8, 341, 1903, 1669, 633, 2271, 3608, 1155, 11, 330, 13611, 1448, 17824, 1138, 1903, 744, 17824, 8982, 2099, 80227, 515, 197, 77847, 25, 262, 220, 19, 345, 197, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestImportIgnoreChanges(t *testing.T) { loaders := []*deploytest.ProviderLoader{ deploytest.NewProviderLoader("pkgA", semver.MustParse("1.0.0"), func() (plugin.Provider, error) { return &deploytest.Provider{ DiffF: func(urn resource.URN, id resource.ID, olds, news resource.PropertyMap, ignoreChanges []string) (plugin.DiffResult, error) { if olds["foo"].DeepEquals(news["foo"]) { return plugin.DiffResult{Changes: plugin.DiffNone}, nil } return plugin.DiffResult{ Changes: plugin.DiffSome, DetailedDiff: map[string]plugin.PropertyDiff{ "foo": {Kind: plugin.DiffUpdate}, }, }, nil }, CreateF: func(urn resource.URN, news resource.PropertyMap, timeout float64, preview bool) (resource.ID, resource.PropertyMap, resource.Status, error) { return "created-id", news, resource.StatusOK, nil }, ReadF: func(urn resource.URN, id resource.ID, inputs, state resource.PropertyMap) (plugin.ReadResult, resource.Status, error) { return plugin.ReadResult{ Inputs: resource.PropertyMap{ "foo": resource.NewStringProperty("bar"), }, Outputs: resource.PropertyMap{ "foo": resource.NewStringProperty("bar"), }, }, resource.StatusOK, nil }, }, nil }), } program := deploytest.NewLanguageRuntime(func(_ plugin.RunInfo, monitor *deploytest.ResourceMonitor) error { _, _, _, err := monitor.RegisterResource("pkgA:m:typA", "resA", true, deploytest.ResourceOptions{ Inputs: resource.PropertyMap{"foo": resource.NewStringProperty("foo")}, ImportID: "import-id", IgnoreChanges: []string{"foo"}, }) assert.NoError(t, err) return nil }) host := deploytest.NewPluginHost(nil, nil, program, loaders...) p := &TestPlan{ Options: UpdateOptions{Host: host}, } project := p.GetProject() snap, res := TestOp(Update).Run(project, p.GetTarget(nil), p.Options, false, p.BackendClient, nil) assert.Nil(t, res) assert.Len(t, snap.Resources, 2) assert.Equal(t, resource.NewStringProperty("bar"), snap.Resources[1].Outputs["foo"]) }
explode_data.jsonl/4175
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 809 }
[ 2830, 3393, 11511, 12497, 11317, 1155, 353, 8840, 836, 8, 341, 49386, 388, 1669, 29838, 35794, 1944, 36208, 9181, 515, 197, 197, 35794, 1944, 7121, 5179, 9181, 445, 30069, 32, 497, 5234, 423, 50463, 14463, 445, 16, 13, 15, 13, 15, 397...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestRenderYAML(t *testing.T) { w := httptest.NewRecorder() data := ` a : Easy! b: c: 2 d: [3, 4] ` (YAML{data}).WriteContentType(w) assert.Equal(t, "application/x-yaml; charset=utf-8", w.Header().Get("Content-Type")) err := (YAML{data}).Render(w) assert.NoError(t, err) assert.Equal(t, "\"\\na : Easy!\\nb:\\n\\tc: 2\\n\\td: [3, 4]\\n\\t\"\n", w.Body.String()) assert.Equal(t, "application/x-yaml; charset=utf-8", w.Header().Get("Content-Type")) }
explode_data.jsonl/493
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 218 }
[ 2830, 3393, 6750, 56, 31102, 1155, 353, 8840, 836, 8, 341, 6692, 1669, 54320, 70334, 7121, 47023, 741, 8924, 1669, 22074, 64, 549, 18609, 4894, 65, 510, 1444, 25, 220, 17, 198, 2698, 25, 508, 18, 11, 220, 19, 921, 197, 3989, 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 TestSchemaParser_SimpleTypeInheritingInterface(t *testing.T) { body := `type Hello implements World { }` astDoc := parse(t, body) expected := &ast.Document{ Loc: testLoc(0, 31), Definitions: []ast.Node{ &ast.ObjectDefinition{ Loc: testLoc(0, 31), Name: &ast.Name{ Value: "Hello", Loc: testLoc(5, 10), }, Interfaces: []*ast.Named{ { Name: &ast.Name{ Value: "World", Loc: testLoc(22, 27), }, Loc: testLoc(22, 27), }, }, Fields: []*ast.FieldDefinition{}, }, }, } if !reflect.DeepEqual(astDoc, expected) { t.Fatalf("unexpected document, expected: %s, got: %s", jsonString(expected), jsonString(astDoc)) } }
explode_data.jsonl/51220
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 332 }
[ 2830, 3393, 8632, 6570, 1098, 6456, 929, 641, 1923, 5853, 5051, 1155, 353, 8840, 836, 8, 341, 35402, 1669, 1565, 1313, 21927, 5169, 4337, 314, 335, 3989, 88836, 9550, 1669, 4715, 1155, 11, 2487, 340, 42400, 1669, 609, 559, 26256, 515, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestGetAccountBalance(t *testing.T) { t.Parallel() if h.APIKey == "" || h.APISecret == "" || h.APIAuthPEMKey == "" { t.Skip() } result, err := h.GetAccounts() if err != nil { t.Errorf("Test failed - Huobi GetAccounts: %s", err) } userID := strconv.FormatInt(result[0].ID, 10) _, err = h.GetAccountBalance(userID) if err != nil { t.Errorf("Test failed - Huobi GetAccountBalance: %s", err) } }
explode_data.jsonl/24336
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 172 }
[ 2830, 3393, 1949, 7365, 21190, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 2822, 743, 305, 24922, 1592, 621, 1591, 1369, 305, 29837, 1637, 50856, 621, 1591, 1369, 305, 24922, 5087, 1740, 44, 1592, 621, 1591, 341, 197, 3244, 57776, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestNamespaceFlushSkipFlushed(t *testing.T) { ctrl := xtest.NewController(t) defer ctrl.Finish() ctx := context.NewBackground() defer ctx.Close() ns, closer := newTestNamespace(t) defer closer() ns.bootstrapState = Bootstrapped blockStart := xtime.Now().Truncate(ns.Options().RetentionOptions().BlockSize()) states := []fileOpState{ {WarmStatus: warmStatus{DataFlushed: fileOpNotStarted}}, {WarmStatus: warmStatus{DataFlushed: fileOpSuccess}}, } for i, s := range states { shard := NewMockdatabaseShard(ctrl) shard.EXPECT().IsBootstrapped().Return(true).AnyTimes() shard.EXPECT().FlushState(blockStart).Return(s, nil) if s.WarmStatus.DataFlushed != fileOpSuccess { shard.EXPECT().WarmFlush(blockStart, gomock.Any(), gomock.Any()).Return(nil) } ns.shards[testShardIDs[i].ID()] = shard } err := ns.WarmFlush(blockStart, nil) require.NoError(t, err) }
explode_data.jsonl/35357
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 345 }
[ 2830, 3393, 22699, 46874, 35134, 46874, 291, 1155, 353, 8840, 836, 8, 341, 84381, 1669, 856, 1944, 7121, 2051, 1155, 340, 16867, 23743, 991, 18176, 2822, 20985, 1669, 2266, 7121, 8706, 741, 16867, 5635, 10421, 2822, 84041, 11, 12128, 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...
3
func TestFutureImports(t *testing.T) { assertParseErrorContains(t, "future", "import future", "invalid import, use `import future.keywords` or `import.future.keywords.in`") assertParseErrorContains(t, "future.a", "import future.a", "invalid import, must be `future.keywords`") assertParseErrorContains(t, "unknown keyword", "import future.keywords.xyz", "unexpected keyword, must be one of [in]") assertParseErrorContains(t, "all keyword import + alias", "import future.keywords as xyz", "future keyword imports cannot be aliased") assertParseErrorContains(t, "keyword import + alias", "import future.keywords.in as xyz", "future keyword imports cannot be aliased") tests := []struct { note, imp string exp map[string]tokens.Token }{ { note: "simple import", imp: "import future.keywords.in", exp: map[string]tokens.Token{"in": tokens.In}, }, { note: "all keywords imported", imp: "import future.keywords", exp: map[string]tokens.Token{"in": tokens.In}, }, } for _, tc := range tests { t.Run(tc.note, func(t *testing.T) { parser := NewParser().WithFilename("").WithReader(bytes.NewBufferString(tc.imp)) _, _, errs := parser.Parse() if exp, act := 0, len(errs); exp != act { t.Fatalf("expected %d errors, got %d: %v", exp, act, errs) } for kw, exp := range tc.exp { act := parser.s.s.Keyword(kw) if act != exp { t.Errorf("expected keyword %q to yield token %v, got %v", kw, exp, act) } } }) } }
explode_data.jsonl/50483
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 579 }
[ 2830, 3393, 24206, 31250, 1155, 353, 8840, 836, 8, 341, 6948, 14463, 1454, 23805, 1155, 11, 330, 21055, 497, 330, 474, 3853, 497, 330, 11808, 1159, 11, 990, 1565, 474, 3853, 87159, 63, 476, 1565, 474, 97693, 87159, 1858, 63, 1138, 694...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
4
func TestNewFileItem_ParentFolder(t *testing.T) { f := &fileDialog{file: &FileDialog{}} _ = f.makeUI() currentDir, _ := filepath.Abs(".") currentLister, err := storage.ListerForURI(storage.NewURI("file://" + currentDir)) if err != nil { t.Error(err) } parentDir := storage.NewURI("file://" + filepath.Dir(currentDir)) f.setLocation(currentLister) item := &fileDialogItem{picker: f, name: "(Parent)", location: parentDir, dir: true} item.ExtendBaseWidget(item) assert.Equal(t, "(Parent)", item.name) test.Tap(item) assert.False(t, item.isCurrent) assert.Equal(t, (*fileDialogItem)(nil), f.selected) assert.Equal(t, parentDir.String(), f.dir.String()) }
explode_data.jsonl/11118
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 250 }
[ 2830, 3393, 3564, 1703, 1234, 1088, 1390, 13682, 1155, 353, 8840, 836, 8, 341, 1166, 1669, 609, 1192, 4468, 90, 1192, 25, 609, 26596, 6257, 532, 197, 62, 284, 282, 10117, 2275, 741, 20121, 6184, 11, 716, 1669, 26054, 33255, 5680, 1138...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestDSSPartialSigs(t *testing.T) { dss0 := getDSS(0) dss1 := getDSS(1) ps0, err := dss0.PartialSig() assert.Nil(t, err) assert.NotNil(t, ps0) assert.Len(t, dss0.partials, 1) // second time should not affect list ps0, err = dss0.PartialSig() assert.Nil(t, err) assert.NotNil(t, ps0) assert.Len(t, dss0.partials, 1) // wrong index goodI := ps0.Partial.I ps0.Partial.I = 100 err = dss1.ProcessPartialSig(ps0) assert.Error(t, err) assert.Contains(t, err.Error(), "invalid index") ps0.Partial.I = goodI // wrong sessionID goodSessionID := ps0.SessionID ps0.SessionID = []byte("ahhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh") err = dss1.ProcessPartialSig(ps0) assert.Error(t, err) assert.Contains(t, err.Error(), "dss: session id") ps0.SessionID = goodSessionID // wrong Signature goodSig := ps0.Signature ps0.Signature = ethschnorr.NewSignature() copy(ps0.Signature.CommitmentPublicAddress[:], randomBytes(20)) badSig := secp256k1.ToInt(suite.Scalar().Pick(randomStream)) ps0.Signature.Signature.Set(badSig) assert.Error(t, dss1.ProcessPartialSig(ps0)) ps0.Signature = goodSig // invalid partial sig goodV := ps0.Partial.V ps0.Partial.V = suite.Scalar().Zero() ps0.Signature, err = ethschnorr.Sign(dss0.secret, ps0.Hash()) require.Nil(t, err) err = dss1.ProcessPartialSig(ps0) assert.Error(t, err) assert.Contains(t, err.Error(), "not valid") ps0.Partial.V = goodV ps0.Signature = goodSig // fine err = dss1.ProcessPartialSig(ps0) assert.Nil(t, err) // already received assert.Error(t, dss1.ProcessPartialSig(ps0)) // if not enough partial signatures, can't generate signature sig, err := dss1.Signature() assert.Nil(t, sig) // XXX: Should also check err is nil? assert.Error(t, err) assert.Contains(t, err.Error(), "not enough") // enough partial sigs ? for i := 2; i < nbParticipants; i++ { dss := getDSS(i) ps, e := dss.PartialSig() require.Nil(t, e) require.Nil(t, dss1.ProcessPartialSig(ps)) } assert.True(t, dss1.EnoughPartialSig()) sig, err = dss1.Signature() assert.NoError(t, err) assert.NoError(t, Verify(dss1.long.Commitments()[0], msg, sig)) }
explode_data.jsonl/60382
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 913 }
[ 2830, 3393, 35, 1220, 37314, 50, 14462, 1155, 353, 8840, 836, 8, 341, 2698, 778, 15, 1669, 633, 35, 1220, 7, 15, 340, 2698, 778, 16, 1669, 633, 35, 1220, 7, 16, 340, 35009, 15, 11, 1848, 1669, 294, 778, 15, 1069, 20894, 47246, 7...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestSelf(t *testing.T) { logp.TestingSetup(logp.WithSelectors(processorName)) config, err := conf.NewConfigFrom(mapstr.M{ "match_pids": []string{"self_pid"}, "target": "self", }) if err != nil { t.Fatal(err) } proc, err := New(config) if err != nil { t.Fatal(err) } selfPID := os.Getpid() ev := beat.Event{ Fields: mapstr.M{ "self_pid": selfPID, }, } result, err := proc.Run(&ev) if err != nil { t.Fatal(err) } t.Log(result.Fields) pidField, err := result.Fields.GetValue("self.process.pid") if err != nil { t.Fatal(err) } pid, ok := pidField.(int) assert.True(t, ok) assert.Equal(t, selfPID, pid) }
explode_data.jsonl/42533
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 300 }
[ 2830, 3393, 12092, 1155, 353, 8840, 836, 8, 341, 6725, 79, 8787, 287, 21821, 12531, 79, 26124, 96995, 21929, 269, 675, 1171, 25873, 11, 1848, 1669, 2335, 7121, 2648, 3830, 9147, 495, 1321, 515, 197, 197, 1, 6347, 620, 3365, 788, 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...
5
func TestAddNamespace(t *testing.T) { ms := []datadog.Metric{ NewGauge("test.metric", 0, 1.0, []string{}), NewGauge("system.cpu.time", 0, 2.0, []string{}), NewGauge("process.memory.physical_usage", 0, 3.0, []string{}), } addNamespace(ms, "namespace") assert.Equal(t, "test.metric", *ms[0].Metric) assert.Equal(t, "namespace.system.cpu.time", *ms[1].Metric) assert.Equal(t, "namespace.process.memory.physical_usage", *ms[2].Metric) }
explode_data.jsonl/46800
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 197 }
[ 2830, 3393, 2212, 22699, 1155, 353, 8840, 836, 8, 341, 47691, 1669, 3056, 5911, 329, 538, 1321, 16340, 515, 197, 197, 3564, 38, 19392, 445, 1944, 85816, 497, 220, 15, 11, 220, 16, 13, 15, 11, 3056, 917, 6257, 1326, 197, 197, 3564, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestReconcileOnCancelledRunFinallyPipelineRunWithRunningFinalTask(t *testing.T) { // TestReconcileOnCancelledRunFinallyPipelineRunWithRunningFinalTask runs "Reconcile" on a PipelineRun that has been gracefully cancelled. // It verifies that reconcile is successful and completed tasks and running final tasks are left untouched. prs := []*v1beta1.PipelineRun{{ ObjectMeta: baseObjectMeta("test-pipeline-run-cancelled-run-finally", "foo"), Spec: v1beta1.PipelineRunSpec{ PipelineRef: &v1beta1.PipelineRef{Name: "test-pipeline"}, ServiceAccountName: "test-sa", Status: v1beta1.PipelineRunSpecStatusCancelledRunFinally, }, Status: v1beta1.PipelineRunStatus{ PipelineRunStatusFields: v1beta1.PipelineRunStatusFields{ StartTime: &metav1.Time{Time: time.Now()}, TaskRuns: map[string]*v1beta1.PipelineRunTaskRunStatus{ "test-pipeline-run-cancelled-run-finally-hello-world": { PipelineTaskName: "hello-world-1", Status: &v1beta1.TaskRunStatus{ Status: duckv1beta1.Status{ Conditions: []apis.Condition{{ Type: apis.ConditionSucceeded, Status: corev1.ConditionTrue, }}, }, }, }, "test-pipeline-run-cancelled-run-finally-final-task": { PipelineTaskName: "final-task-1", Status: &v1beta1.TaskRunStatus{}, }, }, }, }, }} ps := []*v1beta1.Pipeline{{ ObjectMeta: baseObjectMeta("test-pipeline", "foo"), Spec: v1beta1.PipelineSpec{ Tasks: []v1beta1.PipelineTask{{ Name: "hello-world-1", TaskRef: &v1beta1.TaskRef{ Name: "hello-world", }, }}, Finally: []v1beta1.PipelineTask{{ Name: "final-task-1", TaskRef: &v1beta1.TaskRef{ Name: "some-task", }, }}, }, }} ts := []*v1beta1.Task{ simpleHelloWorldTask, simpleSomeTask, } trs := []*v1beta1.TaskRun{ createHelloWorldTaskRunWithStatus("test-pipeline-run-cancelled-run-finally-hello-world", "foo", "test-pipeline-run-cancelled-run-finally", "test-pipeline", "my-pod-name", apis.Condition{ Type: apis.ConditionSucceeded, Status: corev1.ConditionTrue, }), createHelloWorldTaskRun("test-pipeline-run-cancelled-run-finally-final-task", "foo", "test-pipeline-run-cancelled-run-finally", "test-pipeline"), } cms := getConfigMapsWithEnabledAlphaAPIFields() d := test.Data{ PipelineRuns: prs, Pipelines: ps, Tasks: ts, TaskRuns: trs, ConfigMaps: cms, } prt := newPipelineRunTest(d, t) defer prt.Cancel() wantEvents := []string{ "Normal Started", } reconciledRun, clients := prt.reconcileRun("foo", "test-pipeline-run-cancelled-run-finally", wantEvents, false) if reconciledRun.Status.CompletionTime != nil { t.Errorf("Expected a CompletionTime to be nil on incomplete PipelineRun but was %v", reconciledRun.Status.CompletionTime) } // This PipelineRun should still be complete and unknown, and the status should reflect that if !reconciledRun.Status.GetCondition(apis.ConditionSucceeded).IsUnknown() { t.Errorf("Expected PipelineRun status to be complete and unknown, but was %v", reconciledRun.Status.GetCondition(apis.ConditionSucceeded)) } // There should be 2 task runs, one for already completed "hello-world-1" task and one for the "final-task-1" final task if len(reconciledRun.Status.TaskRuns) != 2 { t.Errorf("Expected PipelineRun status to have 2 task runs, but was %v", len(reconciledRun.Status.TaskRuns)) } actions := clients.Pipeline.Actions() patchActions := make([]ktesting.PatchAction, 0) for _, action := range actions { if patchAction, ok := action.(ktesting.PatchAction); ok { patchActions = append(patchActions, patchAction) } } if len(patchActions) != 0 { t.Errorf("Expected no patch actions, but was %v", len(patchActions)) } }
explode_data.jsonl/68263
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1592 }
[ 2830, 3393, 693, 40446, 457, 1925, 39473, 6727, 23949, 34656, 51918, 18990, 19357, 6262, 1155, 353, 8840, 836, 8, 341, 197, 322, 3393, 693, 40446, 457, 1925, 39473, 6727, 23949, 34656, 51918, 18990, 19357, 6262, 8473, 330, 693, 40446, 457...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestCertificateRequestOperationInvalid(t *testing.T) { mockCtrl := gomock.NewController(t) defer mockCtrl.Finish() mockClient := client.NewMockClient(mockCtrl) mockOutput := &mock.Output{} operation := certificateRequestOperation{ acm: mockClient, domainName: "z", // Invalid output: mockOutput, } operation.execute() if !mockOutput.Exited { t.Errorf("Expected premature exit; didn't") } }
explode_data.jsonl/29938
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 157 }
[ 2830, 3393, 33202, 1900, 8432, 7928, 1155, 353, 8840, 836, 8, 341, 77333, 15001, 1669, 342, 316, 1176, 7121, 2051, 1155, 340, 16867, 7860, 15001, 991, 18176, 2822, 77333, 2959, 1669, 2943, 7121, 11571, 2959, 30389, 15001, 340, 77333, 5097...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestPassThroughAnnotationsFilter(t *testing.T) { for desc, test := range map[string]struct { podAnnotations map[string]string runtimePodAnnotations []string passthroughAnnotations map[string]string }{ "should support direct match": { podAnnotations: map[string]string{"c": "d", "d": "e"}, runtimePodAnnotations: []string{"c"}, passthroughAnnotations: map[string]string{"c": "d"}, }, "should support wildcard match": { podAnnotations: map[string]string{ "t.f": "j", "z.g": "o", "z": "o", "y.ca": "b", "y": "b", }, runtimePodAnnotations: []string{"*.f", "z*g", "y.c*"}, passthroughAnnotations: map[string]string{ "t.f": "j", "z.g": "o", "y.ca": "b", }, }, "should support wildcard match all": { podAnnotations: map[string]string{ "t.f": "j", "z.g": "o", "z": "o", "y.ca": "b", "y": "b", }, runtimePodAnnotations: []string{"*"}, passthroughAnnotations: map[string]string{ "t.f": "j", "z.g": "o", "z": "o", "y.ca": "b", "y": "b", }, }, "should support match including path separator": { podAnnotations: map[string]string{ "matchend.com/end": "1", "matchend.com/end1": "2", "matchend.com/1end": "3", "matchmid.com/mid": "4", "matchmid.com/mi1d": "5", "matchmid.com/mid1": "6", "matchhead.com/head": "7", "matchhead.com/1head": "8", "matchhead.com/head1": "9", "matchall.com/abc": "10", "matchall.com/def": "11", "end/matchend": "12", "end1/matchend": "13", "1end/matchend": "14", "mid/matchmid": "15", "mi1d/matchmid": "16", "mid1/matchmid": "17", "head/matchhead": "18", "1head/matchhead": "19", "head1/matchhead": "20", "abc/matchall": "21", "def/matchall": "22", "match1/match2": "23", "nomatch/nomatch": "24", }, runtimePodAnnotations: []string{ "matchend.com/end*", "matchmid.com/mi*d", "matchhead.com/*head", "matchall.com/*", "end*/matchend", "mi*d/matchmid", "*head/matchhead", "*/matchall", "match*/match*", }, passthroughAnnotations: map[string]string{ "matchend.com/end": "1", "matchend.com/end1": "2", "matchmid.com/mid": "4", "matchmid.com/mi1d": "5", "matchhead.com/head": "7", "matchhead.com/1head": "8", "matchall.com/abc": "10", "matchall.com/def": "11", "end/matchend": "12", "end1/matchend": "13", "mid/matchmid": "15", "mi1d/matchmid": "16", "head/matchhead": "18", "1head/matchhead": "19", "abc/matchall": "21", "def/matchall": "22", "match1/match2": "23", }, }, } { t.Run(desc, func(t *testing.T) { passthroughAnnotations := getPassthroughAnnotations(test.podAnnotations, test.runtimePodAnnotations) assert.Equal(t, test.passthroughAnnotations, passthroughAnnotations) }) } }
explode_data.jsonl/8829
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1645 }
[ 2830, 3393, 12187, 23857, 21418, 5632, 1155, 353, 8840, 836, 8, 341, 2023, 6560, 11, 1273, 1669, 2088, 2415, 14032, 60, 1235, 341, 197, 3223, 347, 21418, 260, 2415, 14032, 30953, 198, 197, 7000, 4466, 23527, 21418, 220, 3056, 917, 198, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestConnectionFailure(t *testing.T) { // Scenario: node 1 fails to connect to node 2. node1 := newTestNode(t) defer node1.stop() node2 := newTestNode(t) defer node2.stop() dialer := &mocks.SecureDialer{} dialer.On("Dial", mock.Anything, mock.Anything).Return(nil, errors.New("oops")) node1.c.Connections = cluster.NewConnectionStore(dialer, &disabled.Gauge{}) node1.c.Configure(testChannel, []cluster.RemoteNode{node2.nodeInfo}) _, err := node1.c.Remote(testChannel, node2.nodeInfo.ID) assert.EqualError(t, err, "oops") }
explode_data.jsonl/39844
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 202 }
[ 2830, 3393, 4526, 17507, 1155, 353, 8840, 836, 8, 341, 197, 322, 58663, 25, 2436, 220, 16, 14525, 311, 4564, 311, 2436, 220, 17, 382, 20831, 16, 1669, 501, 2271, 1955, 1155, 340, 16867, 2436, 16, 13227, 2822, 20831, 17, 1669, 501, 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 TestPrepareErrorCreatingWorkingDir(t *testing.T) { rh := newFakeSTI(&FakeSTI{}) rh.fs.(*test.FakeFileSystem).WorkingDirError = errors.New("WorkingDirError") err := rh.Prepare(rh.config) if err == nil || err.Error() != "WorkingDirError" { t.Errorf("An error was expected for WorkingDir, but got different: %v", err) } }
explode_data.jsonl/59446
{ "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, 50590, 1454, 24973, 33978, 6184, 1155, 353, 8840, 836, 8, 341, 7000, 71, 1669, 501, 52317, 784, 40, 2099, 52317, 784, 40, 37790, 7000, 71, 41355, 41399, 1944, 991, 726, 50720, 568, 33978, 6184, 1454, 284, 5975, 7121, 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...
3
func TestCLI(t *testing.T) { spec.Run(t, "Spring Boot CLI", func(t *testing.T, when spec.G, it spec.S) { g := gomega.NewWithT(t) var f *test.BuildFactory it.Before(func() { f = test.NewBuildFactory(t) }) it("contributes cli", func() { f.AddDependency(cli.Dependency, filepath.Join("testdata", "stub-spring-boot-cli.tar.gz")) a, err := cli.NewCLI(f.Build) g.Expect(err).NotTo(gomega.HaveOccurred()) g.Expect(a.Contribute()).To(gomega.Succeed()) layer := f.Build.Layers.Layer("spring-boot-cli") g.Expect(layer).To(test.HaveLayerMetadata(false, false, true)) g.Expect(filepath.Join(layer.Root, "bin", "spring")).To(gomega.BeARegularFile()) }) }, spec.Report(report.Terminal{})) }
explode_data.jsonl/39306
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 319 }
[ 2830, 3393, 63959, 1155, 353, 8840, 836, 8, 341, 98100, 16708, 1155, 11, 330, 25150, 15004, 39277, 497, 2915, 1155, 353, 8840, 836, 11, 979, 1398, 1224, 11, 432, 1398, 808, 8, 1476, 197, 3174, 1669, 342, 32696, 7121, 2354, 51, 1155, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestChannelForwardHeadersPrependedWithKnative(t *testing.T) { helpers.SingleEventWithKnativeHeaderHelperForChannelTestHelper( t, cloudevents.EncodingBinary, channelTestRunner, ) }
explode_data.jsonl/57146
{ "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, 9629, 25925, 10574, 4703, 79, 2883, 2354, 42, 29738, 1155, 353, 8840, 836, 8, 341, 197, 21723, 23119, 1556, 2354, 42, 29738, 4047, 5511, 2461, 9629, 2271, 5511, 1006, 197, 3244, 345, 197, 39407, 283, 450, 47664, 58764, 21338...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestCommitsComparison_String(t *testing.T) { v := CommitsComparison{ BaseCommit: &RepositoryCommit{}, MergeBaseCommit: &RepositoryCommit{}, Status: String(""), AheadBy: Int(0), BehindBy: Int(0), TotalCommits: Int(0), HTMLURL: String(""), PermalinkURL: String(""), DiffURL: String(""), PatchURL: String(""), URL: String(""), } want := `github.CommitsComparison{BaseCommit:github.RepositoryCommit{}, MergeBaseCommit:github.RepositoryCommit{}, Status:"", AheadBy:0, BehindBy:0, TotalCommits:0, HTMLURL:"", PermalinkURL:"", DiffURL:"", PatchURL:"", URL:""}` if got := v.String(); got != want { t.Errorf("CommitsComparison.String = %v, want %v", got, want) } }
explode_data.jsonl/33230
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 334 }
[ 2830, 3393, 17977, 1199, 33487, 31777, 1155, 353, 8840, 836, 8, 341, 5195, 1669, 6804, 1199, 33487, 515, 197, 66732, 33441, 25, 414, 609, 4624, 33441, 38837, 197, 9209, 10080, 3978, 33441, 25, 609, 4624, 33441, 38837, 197, 58321, 25, 68...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestHeaderIgnoredSize(t *testing.T) { h := FileHeader{ Name: "foo.txt", Method: Deflate, Extra: []byte{zip64ExtraId & 0xFF, zip64ExtraId >> 8, 24, 0, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8}, // bad size but shouldn't be consulted } testValidHeader(&h, t) }
explode_data.jsonl/18866
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 157 }
[ 2830, 3393, 4047, 43337, 3018, 1695, 1155, 353, 8840, 836, 8, 341, 9598, 1669, 2887, 4047, 515, 197, 21297, 25, 256, 330, 7975, 3909, 756, 197, 84589, 25, 3892, 5075, 345, 197, 197, 11612, 25, 220, 3056, 3782, 90, 9964, 21, 19, 1161...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestBaseAppMiddleware(t *testing.T) { anteKey := []byte("ante-key") deliverKey := []byte("deliver-key") txHandlerOpt := func(bapp *baseapp.BaseApp) { legacyRouter := middleware.NewLegacyRouter() r := sdk.NewRoute(routeMsgCounter, handlerMsgCounter(t, capKey1, deliverKey)) legacyRouter.AddRoute(r) txHandler := testTxHandler( middleware.TxHandlerOptions{ LegacyRouter: legacyRouter, MsgServiceRouter: middleware.NewMsgServiceRouter(encCfg.InterfaceRegistry), TxDecoder: testTxDecoder(encCfg.Amino), }, customHandlerTxTest(t, capKey1, anteKey), ) bapp.SetTxHandler(txHandler) } app := setupBaseApp(t, txHandlerOpt) app.InitChain(abci.RequestInitChain{}) header := tmproto.Header{Height: app.LastBlockHeight() + 1} app.BeginBlock(abci.RequestBeginBlock{Header: header}) // execute a tx that will fail ante handler execution // // NOTE: State should not be mutated here. This will be implicitly checked by // the next txs ante handler execution (customHandlerTxTest). tx := newTxCounter(0, 0) tx.setFailOnAnte(true) txBytes, err := encCfg.Amino.Marshal(tx) require.NoError(t, err) res := app.DeliverTx(abci.RequestDeliverTx{Tx: txBytes}) require.Empty(t, res.Events) require.False(t, res.IsOK(), fmt.Sprintf("%v", res)) ctx := app.DeliverState().Context() store := ctx.KVStore(capKey1) require.Equal(t, int64(0), getIntFromStore(store, anteKey)) // execute at tx that will pass the ante handler (the checkTx state should // mutate) but will fail the message handler tx = newTxCounter(0, 0) tx.setFailOnHandler(true) txBytes, err = encCfg.Amino.Marshal(tx) require.NoError(t, err) res = app.DeliverTx(abci.RequestDeliverTx{Tx: txBytes}) require.Empty(t, res.Events) require.False(t, res.IsOK(), fmt.Sprintf("%v", res)) ctx = app.DeliverState().Context() store = ctx.KVStore(capKey1) require.Equal(t, int64(1), getIntFromStore(store, anteKey)) require.Equal(t, int64(0), getIntFromStore(store, deliverKey)) // execute a successful ante handler and message execution where state is // implicitly checked by previous tx executions tx = newTxCounter(1, 0) txBytes, err = encCfg.Amino.Marshal(tx) require.NoError(t, err) res = app.DeliverTx(abci.RequestDeliverTx{Tx: txBytes}) require.NotEmpty(t, res.Events) require.True(t, res.IsOK(), fmt.Sprintf("%v", res)) ctx = app.DeliverState().Context() store = ctx.KVStore(capKey1) require.Equal(t, int64(2), getIntFromStore(store, anteKey)) require.Equal(t, int64(1), getIntFromStore(store, deliverKey)) // commit app.EndBlock(abci.RequestEndBlock{}) app.Commit() }
explode_data.jsonl/30044
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 981 }
[ 2830, 3393, 3978, 2164, 24684, 1155, 353, 8840, 836, 8, 341, 197, 4942, 1592, 1669, 3056, 3782, 445, 4942, 16173, 1138, 69509, 1524, 1592, 1669, 3056, 3782, 445, 74728, 16173, 5130, 46237, 3050, 21367, 1669, 2915, 1883, 676, 353, 3152, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestGetPortfolio(t *testing.T) { ptrBASE := GetPortfolio() if reflect.TypeOf(ptrBASE).String() != "*portfolio.Base" { t.Error("Test Failed - portfolio_test.go - GetoPortfolio error") } }
explode_data.jsonl/33750
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 73 }
[ 2830, 3393, 1949, 66675, 1155, 353, 8840, 836, 8, 341, 43811, 18450, 1669, 2126, 66675, 741, 743, 8708, 73921, 23866, 18450, 568, 703, 368, 961, 15630, 27159, 13018, 1, 341, 197, 3244, 6141, 445, 2271, 21379, 481, 19565, 4452, 18002, 48...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestStripForeignKeys(t *testing.T) { tcs := []struct { desc string ddl string hasErr bool newDDL string }{ { desc: "has FK constraints", ddl: "CREATE TABLE `table1` (\n" + "`id` int(11) NOT NULL AUTO_INCREMENT,\n" + "`foreign_id` int(11) CHECK (foreign_id>10),\n" + "PRIMARY KEY (`id`),\n" + "KEY `fk_table1_ref_foreign_id` (`foreign_id`),\n" + "CONSTRAINT `fk_table1_ref_foreign_id` FOREIGN KEY (`foreign_id`) REFERENCES `foreign` (`id`)\n" + ") ENGINE=InnoDB DEFAULT CHARSET=latin1;", newDDL: "create table table1 (\n" + "\tid int(11) not null auto_increment,\n" + "\tforeign_id int(11),\n" + "\tPRIMARY KEY (id),\n" + "\tKEY fk_table1_ref_foreign_id (foreign_id),\n" + "\tcheck (foreign_id > 10)\n" + ") ENGINE InnoDB,\n" + " CHARSET latin1", hasErr: false, }, { desc: "no FK constraints", ddl: "CREATE TABLE `table1` (\n" + "`id` int(11) NOT NULL AUTO_INCREMENT,\n" + "`foreign_id` int(11) NOT NULL CHECK (foreign_id>10),\n" + "`user_id` int(11) NOT NULL,\n" + "PRIMARY KEY (`id`),\n" + "KEY `fk_table1_ref_foreign_id` (`foreign_id`),\n" + "KEY `fk_table1_ref_user_id` (`user_id`)\n" + ") ENGINE=InnoDB DEFAULT CHARSET=latin1;", newDDL: "create table table1 (\n" + "\tid int(11) not null auto_increment,\n" + "\tforeign_id int(11) not null,\n" + "\tuser_id int(11) not null,\n" + "\tPRIMARY KEY (id),\n" + "\tKEY fk_table1_ref_foreign_id (foreign_id),\n" + "\tKEY fk_table1_ref_user_id (user_id),\n" + "\tcheck (foreign_id > 10)\n" + ") ENGINE InnoDB,\n" + " CHARSET latin1", }, } for _, tc := range tcs { newDDL, err := stripTableForeignKeys(tc.ddl) if tc.hasErr != (err != nil) { t.Fatalf("hasErr does not match: err: %v, tc: %+v", err, tc) } if newDDL != tc.newDDL { utils.MustMatch(t, tc.newDDL, newDDL, fmt.Sprintf("newDDL does not match. tc: %+v", tc)) } } }
explode_data.jsonl/61884
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1017 }
[ 2830, 3393, 5901, 58632, 8850, 1155, 353, 8840, 836, 8, 341, 3244, 4837, 1669, 3056, 1235, 341, 197, 41653, 914, 198, 197, 197, 78372, 220, 914, 271, 197, 63255, 7747, 1807, 198, 197, 8638, 58781, 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...
4
func TestTxSimulatorQueryUnsupportedTx(t *testing.T) { for _, testEnv := range testEnvs { // Query is only supported and tested on the CouchDB testEnv if testEnv.getName() == couchDBtestEnvName { t.Logf("Running test for TestEnv = %s", testEnv.getName()) testLedgerID := "testtxsimulatorunsupportedtxqueries" testEnv.init(t, testLedgerID, nil) testTxSimulatorQueryUnsupportedTx(t, testEnv) testEnv.cleanup() } } }
explode_data.jsonl/63615
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 171 }
[ 2830, 3393, 31584, 14027, 10511, 2859, 41884, 31584, 1155, 353, 8840, 836, 8, 341, 2023, 8358, 1273, 14359, 1669, 2088, 1273, 1702, 11562, 341, 197, 197, 322, 11361, 374, 1172, 7248, 323, 12510, 389, 279, 61128, 3506, 1273, 14359, 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 TestMazeFactory(t *testing.T) { factory := new(MazeFactory) maze := factory.makeMaze() wall := factory.makeWall() room1 := factory.makeRoom(1) room2 := factory.makeRoom(2) door := factory.makeDoor(room1, room2) _, isRoom1 := room1.(*Room) _, isRoom2 := room2.(*Room) _, isDoor := door.(*Door) if maze == nil { t.Error("maze is nil") } if wall == nil { t.Error("wall is nil") } if !isRoom1 || !isRoom2 { t.Error("isRoom is not of type Room") } if !isDoor { t.Error("isDoor is not of type Door") } }
explode_data.jsonl/34905
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 238 }
[ 2830, 3393, 44, 9832, 4153, 1155, 353, 8840, 836, 8, 341, 1166, 2919, 1669, 501, 3189, 9832, 4153, 692, 2109, 9832, 1669, 8633, 10117, 44, 9832, 368, 715, 6692, 541, 1669, 8633, 10117, 32597, 368, 715, 197, 2966, 16, 1669, 8633, 10117...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestCreateAssetTxSyntacticVerifyName(t *testing.T) { tx, c, ctx := validCreateAssetTx(t) // String of Length 129 should fail SyntacticVerify tx.Name = nameTooLong if err := tx.SyntacticVerify(ctx, c, assetID, 0, 0, 1); err == nil { t.Fatal("CreateAssetTx should have failed syntactic verification due to name too long") } tx.Name = invalidWhitespaceStr if err := tx.SyntacticVerify(ctx, c, assetID, 0, 0, 1); err == nil { t.Fatal("CreateAssetTx should have failed syntactic verification due to invalid whitespace in name") } tx.Name = invalidASCIIStr if err := tx.SyntacticVerify(ctx, c, assetID, 0, 0, 1); err == nil { t.Fatal("CreateAssetTx should have failed syntactic verification due to invalid ASCII character in name") } }
explode_data.jsonl/73230
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 252 }
[ 2830, 3393, 4021, 16604, 31584, 34667, 406, 23170, 32627, 675, 1155, 353, 8840, 836, 8, 341, 46237, 11, 272, 11, 5635, 1669, 2697, 4021, 16604, 31584, 1155, 692, 197, 322, 923, 315, 17287, 220, 16, 17, 24, 1265, 3690, 5718, 406, 23170...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestAPI_Errors(t *testing.T) { var err error _, err = NewKeyed(make([]byte, 31)) assert.Error(t, err) d := New().Digest() _, err = d.Seek(-1, io.SeekStart) assert.Error(t, err) _, err = d.Seek(-1, io.SeekCurrent) assert.Error(t, err) _, err = d.Seek(0, io.SeekEnd) assert.Error(t, err) _, err = d.Seek(0, 9999) assert.Error(t, err) }
explode_data.jsonl/44525
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 170 }
[ 2830, 3393, 7082, 93623, 1087, 1155, 353, 8840, 836, 8, 341, 2405, 1848, 1465, 271, 197, 6878, 1848, 284, 1532, 1592, 291, 36944, 10556, 3782, 11, 220, 18, 16, 1171, 6948, 6141, 1155, 11, 1848, 692, 2698, 1669, 1532, 1005, 45217, 2822...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestEmptyPrep(t *testing.T) { pp := NewTxPreparedPool(0) want := "prepared transactions exceeded limit: 0" err := pp.Put(nil, "aa") if err == nil || err.Error() != want { t.Errorf("Put err: %v, want %s", err, want) } }
explode_data.jsonl/36819
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 91 }
[ 2830, 3393, 3522, 4703, 79, 1155, 353, 8840, 836, 8, 341, 65729, 1669, 1532, 31584, 4703, 7212, 10551, 7, 15, 340, 50780, 1669, 330, 60112, 14131, 33808, 3930, 25, 220, 15, 698, 9859, 1669, 11823, 39825, 27907, 11, 330, 5305, 1138, 74...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestUpdateAssetsSubpath(t *testing.T) { t.Run("no client dir", func(t *testing.T) { tempDir, err := ioutil.TempDir("", "test_update_assets_subpath") require.NoError(t, err) defer os.RemoveAll(tempDir) os.Chdir(tempDir) err = utils.UpdateAssetsSubpath("/") require.Error(t, err) }) t.Run("valid", func(t *testing.T) { tempDir, err := ioutil.TempDir("", "test_update_assets_subpath") require.NoError(t, err) defer os.RemoveAll(tempDir) os.Chdir(tempDir) err = os.Mkdir(model.CLIENT_DIR, 0700) require.NoError(t, err) testCases := []struct { Description string RootHTML string MainCSS string ManifestJSON string Subpath string ExpectedError error ExpectedRootHTML string ExpectedMainCSS string ExpectedManifestJSON string }{ { "no changes required, empty subpath provided", baseRootHtml, baseCss, baseManifestJSON, "", nil, baseRootHtml, baseCss, baseManifestJSON, }, { "no changes required", baseRootHtml, baseCss, baseManifestJSON, "/", nil, baseRootHtml, baseCss, baseManifestJSON, }, { "content security policy not found (missing quotes)", contentSecurityPolicyNotFoundHtml, baseCss, baseManifestJSON, "/subpath", fmt.Errorf("failed to find 'Content-Security-Policy' meta tag to rewrite"), contentSecurityPolicyNotFoundHtml, baseCss, baseManifestJSON, }, { "content security policy not found (missing unsafe-eval)", contentSecurityPolicyNotFound2Html, baseCss, baseManifestJSON, "/subpath", fmt.Errorf("failed to find 'Content-Security-Policy' meta tag to rewrite"), contentSecurityPolicyNotFound2Html, baseCss, baseManifestJSON, }, { "subpath", baseRootHtml, baseCss, baseManifestJSON, "/subpath", nil, subpathRootHtml, subpathCSS, subpathManifestJson, }, { "new subpath from old", subpathRootHtml, subpathCSS, subpathManifestJson, "/nested/subpath", nil, newSubpathRootHTML, newSubpathCSS, newSubpathManifestJson, }, { "resetting to /", subpathRootHtml, subpathCSS, baseManifestJSON, "/", nil, baseRootHtml, baseCss, baseManifestJSON, }, } for _, testCase := range testCases { t.Run(testCase.Description, func(t *testing.T) { ioutil.WriteFile(filepath.Join(tempDir, model.CLIENT_DIR, "root.html"), []byte(testCase.RootHTML), 0700) ioutil.WriteFile(filepath.Join(tempDir, model.CLIENT_DIR, "main.css"), []byte(testCase.MainCSS), 0700) ioutil.WriteFile(filepath.Join(tempDir, model.CLIENT_DIR, "manifest.json"), []byte(testCase.ManifestJSON), 0700) err := utils.UpdateAssetsSubpath(testCase.Subpath) if testCase.ExpectedError != nil { require.Equal(t, testCase.ExpectedError, err) } else { require.NoError(t, err) } contents, err := ioutil.ReadFile(filepath.Join(tempDir, model.CLIENT_DIR, "root.html")) require.NoError(t, err) // Rewrite the expected and contents for simpler diffs when failed. expectedRootHTML := strings.Replace(testCase.ExpectedRootHTML, ">", ">\n", -1) contentsStr := strings.Replace(string(contents), ">", ">\n", -1) require.Equal(t, expectedRootHTML, contentsStr) contents, err = ioutil.ReadFile(filepath.Join(tempDir, model.CLIENT_DIR, "main.css")) require.NoError(t, err) require.Equal(t, testCase.ExpectedMainCSS, string(contents)) contents, err = ioutil.ReadFile(filepath.Join(tempDir, model.CLIENT_DIR, "manifest.json")) require.NoError(t, err) require.Equal(t, testCase.ExpectedManifestJSON, string(contents)) }) } }) }
explode_data.jsonl/26124
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1720 }
[ 2830, 3393, 4289, 26879, 3136, 2343, 1155, 353, 8840, 836, 8, 341, 3244, 16708, 445, 2152, 2943, 5419, 497, 2915, 1155, 353, 8840, 836, 8, 341, 197, 16280, 6184, 11, 1848, 1669, 43144, 65009, 6184, 19814, 330, 1944, 8882, 53299, 5228, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestUrl(t *testing.T) { var tests = []struct { param string expected bool }{ {"http://foo.bar#com", true}, {"http://foobar.com", true}, {"https://foobar.com", true}, {"foobar.com", false}, {"http://foobar.coffee/", true}, {"http://foobar.中文网/", true}, {"http://foobar.org/", true}, {"http://foobar.org:8080/", true}, {"ftp://foobar.ru/", true}, {"http://user:pass@www.foobar.com/", true}, {"http://127.0.0.1/", true}, {"http://duckduckgo.com/?q=%2F", true}, {"http://localhost:3000/", true}, {"http://foobar.com/?foo=bar#baz=qux", true}, {"http://foobar.com?foo=bar", true}, {"http://www.xn--froschgrn-x9a.net/", true}, {"", false}, {"xyz://foobar.com", true}, {"invalid.", false}, {".com", false}, {"rtmp://foobar.com", true}, {"http://www.foo_bar.com/", true}, {"http://localhost:3000/", true}, {"http://foobar.com/#baz", true}, {"http://foobar.com#baz=qux", true}, {"http://foobar.com/t$-_.+!*\\'(),", true}, {"http://www.foobar.com/~foobar", true}, {"http://www.-foobar.com/", true}, {"http://www.foo---bar.com/", true}, {"mailto:someone@example.com", true}, {"irc://irc.server.org/channel", true}, {"irc://#channel@network", true}, {"/abs/test/dir", false}, {"./rel/test/dir", false}, } validate := New() for i, test := range tests { errs := validate.Var(test.param, "url") if test.expected { if !IsEqual(errs, nil) { t.Fatalf("Index: %d URL failed Error: %s", i, errs) } } else { if IsEqual(errs, nil) { t.Fatalf("Index: %d URL failed Error: %s", i, errs) } else { val := getError(errs, "", "") if val.Tag() != "url" { t.Fatalf("Index: %d URL failed Error: %s", i, errs) } } } } i := 1 PanicMatches(t, func() { _ = validate.Var(i, "url") }, "Bad field type int") }
explode_data.jsonl/77315
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 830 }
[ 2830, 3393, 2864, 1155, 353, 8840, 836, 8, 1476, 2405, 7032, 284, 3056, 1235, 341, 197, 36037, 262, 914, 198, 197, 42400, 1807, 198, 197, 59403, 197, 197, 4913, 1254, 1110, 7975, 22001, 2, 874, 497, 830, 1583, 197, 197, 4913, 1254, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func Test_aliyunAuthCredential_isCacheTokenValid(t *testing.T) { type fields struct { region string accessKey string secretKey string cacheToken *registryTemporaryToken cacheTokenExpiredAt time.Time } var nilTime time.Time tests := []struct { name string fields fields want bool }{ {"nil cacheTokenExpiredAt", fields{"test-region", "MockAccessKey", "MockSecretKey", nil, nilTime}, false}, {"nil cacheToken", fields{"test-region", "MockAccessKey", "MockSecretKey", nil, time.Time{}}, false}, {"expired", fields{"test-region", "MockAccessKey", "MockSecretKey", &registryTemporaryToken{}, time.Now().AddDate(0, 0, -1)}, false}, {"ok", fields{"test-region", "MockAccessKey", "MockSecretKey", &registryTemporaryToken{}, time.Now().AddDate(0, 0, 1)}, true}, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { a := &aliyunAuthCredential{ region: tt.fields.region, accessKey: tt.fields.accessKey, secretKey: tt.fields.secretKey, cacheToken: tt.fields.cacheToken, cacheTokenExpiredAt: tt.fields.cacheTokenExpiredAt, } if got := a.isCacheTokenValid(); got != tt.want { assert.Equal(t, got, tt.want) } }) } }
explode_data.jsonl/38950
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 554 }
[ 2830, 3393, 62, 7956, 42420, 5087, 48265, 6892, 8233, 3323, 4088, 1155, 353, 8840, 836, 8, 341, 13158, 5043, 2036, 341, 197, 197, 3943, 1060, 914, 198, 197, 197, 5211, 1592, 1843, 914, 198, 197, 197, 20474, 1592, 1843, 914, 198, 197, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func Test_SetEqual(t *testing.T) { a := NewSet() b := NewSet() if !a.Equal(b) { t.Error("Both a and b are empty sets, and should be equal") } a.Add(10) if a.Equal(b) { t.Error("a should not be equal to b because b is empty and a has item 1 in it") } b.Add(10) if !a.Equal(b) { t.Error("a is now equal again to b because both have the item 10 in them") } b.Add(8) b.Add(3) b.Add(47) if a.Equal(b) { t.Error("b has 3 more elements in it so therefore should not be equal to a") } a.Add(8) a.Add(3) a.Add(47) if !a.Equal(b) { t.Error("a and b should be equal with the same number of elements") } }
explode_data.jsonl/198
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 279 }
[ 2830, 3393, 14812, 2993, 1155, 353, 8840, 836, 8, 341, 11323, 1669, 1532, 1649, 741, 2233, 1669, 1532, 1649, 2822, 743, 753, 64, 12808, 1883, 8, 341, 197, 3244, 6141, 445, 20629, 264, 323, 293, 525, 4287, 7289, 11, 323, 1265, 387, 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...
6
func TestFormat(t *testing.T) { t.Parallel() for _, test := range formatTests { got := fmt.Sprintf(test.format, test.h) if got != test.want { t.Errorf("unexpected result for fmt.Sprintf(%q, %#v): got:%q, want:%q", test.format, test.h, got, test.want) } } }
explode_data.jsonl/76215
{ "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, 4061, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 741, 2023, 8358, 1273, 1669, 2088, 3561, 18200, 341, 197, 3174, 354, 1669, 8879, 17305, 8623, 8021, 11, 1273, 860, 340, 197, 743, 2684, 961, 1273, 70212, 341, 298, 324...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestChangeLockToPut(t *testing.T) { store, clean := createMockStoreAndSetup(t) defer clean() tk := testkit.NewTestKit(t, store) tk2 := testkit.NewTestKit(t, store) tk.MustExec("use test") tk2.MustExec("use test") tk.MustExec("drop table if exists tk") tk.MustExec("create table t1(c1 varchar(20) key, c2 int, c3 int, unique key k1(c2), key k2(c3))") tk.MustExec(`insert into t1 values ("1", 1, 1), ("2", 2, 2), ("3", 3, 3)`) // Test point get change lock to put. for _, mode := range []string{"REPEATABLE-READ", "READ-COMMITTED"} { tk.MustExec(fmt.Sprintf(`set tx_isolation = "%s"`, mode)) tk.MustExec("begin pessimistic") tk.MustQuery(`select * from t1 where c1 = "1" for update`).Check(testkit.Rows("1 1 1")) tk.MustExec("commit") tk.MustExec("begin pessimistic") tk.MustQuery(`select * from t1 where c1 = "1" for update`).Check(testkit.Rows("1 1 1")) tk.MustExec("commit") tk.MustExec("admin check table t1") tk2.MustExec("begin") tk2.MustQuery(`select * from t1 use index(k1) where c2 = "1" for update`).Check(testkit.Rows("1 1 1")) tk2.MustQuery(`select * from t1 use index(k1) where c2 = "3" for update`).Check(testkit.Rows("3 3 3")) tk2.MustExec("commit") tk2.MustExec("begin") tk2.MustQuery(`select * from t1 use index(k2) where c3 = 1`).Check(testkit.Rows("1 1 1")) tk2.MustQuery("select * from t1 use index(k2) where c3 > 1").Check(testkit.Rows("2 2 2", "3 3 3")) tk2.MustExec("commit") } // Test batch point get change lock to put. for _, mode := range []string{"REPEATABLE-READ", "READ-COMMITTED"} { tk.MustExec(fmt.Sprintf(`set tx_isolation = "%s"`, mode)) tk.MustExec("begin pessimistic") tk.MustQuery(`select * from t1 where c1 in ("1", "5", "3") for update`).Check(testkit.Rows("1 1 1", "3 3 3")) tk.MustExec("commit") tk.MustExec("begin pessimistic") tk.MustQuery(`select * from t1 where c1 in ("1", "2", "8") for update`).Check(testkit.Rows("1 1 1", "2 2 2")) tk.MustExec("commit") tk.MustExec("admin check table t1") tk2.MustExec("begin") tk2.MustQuery(`select * from t1 use index(k1) where c2 in ("1", "2", "3") for update`).Check(testkit.Rows("1 1 1", "2 2 2", "3 3 3")) tk2.MustQuery(`select * from t1 use index(k2) where c2 in ("2") for update`).Check(testkit.Rows("2 2 2")) tk2.MustExec("commit") tk2.MustExec("begin") tk2.MustQuery(`select * from t1 use index(k2) where c3 in (5, 8)`).Check(testkit.Rows()) tk2.MustQuery(`select * from t1 use index(k2) where c3 in (1, 8) for update`).Check(testkit.Rows("1 1 1")) tk2.MustQuery(`select * from t1 use index(k2) where c3 > 1`).Check(testkit.Rows("2 2 2", "3 3 3")) tk2.MustExec("commit") } tk.MustExec("admin check table t1") }
explode_data.jsonl/12505
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1111 }
[ 2830, 3393, 4072, 11989, 1249, 19103, 1155, 353, 8840, 836, 8, 341, 57279, 11, 4240, 1669, 1855, 11571, 6093, 3036, 21821, 1155, 340, 16867, 4240, 2822, 3244, 74, 1669, 1273, 8226, 7121, 2271, 7695, 1155, 11, 3553, 340, 3244, 74, 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...
3
func TestIntegrationOBFS4IoutilTempDirError(t *testing.T) { ctx := context.Background() config := obfs4config() expected := errors.New("mocked error") config.ioutilTempDir = func(dir, prefix string) (string, error) { return "", expected } results := OBFS4Connect(ctx, config) if !errors.Is(results.Error, expected) { t.Fatal("not the error that we expected") } }
explode_data.jsonl/53550
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 131 }
[ 2830, 3393, 52464, 20608, 8485, 19, 40, 30158, 12151, 6184, 1454, 1155, 353, 8840, 836, 8, 341, 20985, 1669, 2266, 19047, 741, 25873, 1669, 1508, 3848, 19, 1676, 741, 42400, 1669, 5975, 7121, 445, 16712, 291, 1465, 1138, 25873, 8607, 30...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestAssertable_IsFalse(t *testing.T) { tests := []struct { name string actual interface{} shouldFail bool }{ { name: "should assert a false value if it's false", actual: false, shouldFail: false, }, { name: "should assert a true value if it's false", actual: true, shouldFail: true, }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { test := &testing.T{} That(test, tt.actual).IsFalse() ThatBool(t, test.Failed()).IsEqualTo(tt.shouldFail) }) } }
explode_data.jsonl/53648
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 255 }
[ 2830, 3393, 8534, 480, 31879, 4049, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 3056, 1235, 341, 197, 11609, 981, 914, 198, 197, 88814, 257, 3749, 16094, 197, 197, 5445, 19524, 1807, 198, 197, 59403, 197, 197, 515, 298, 11609, 25, 981,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestGcdRecursiveWithAllPositive(t *testing.T) { m,n := 544,119 want := 17 actual,err := Gcd_Recursive(m,n) if (actual != want || err != nil) { t.Fatalf(`Gcd_Recursive(544, 119) = %q, %v. The wanted value is %#q`, actual, err, want) } }
explode_data.jsonl/22686
{ "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, 38, 4385, 78542, 2354, 2403, 35490, 1155, 353, 8840, 836, 8, 341, 2109, 10128, 1669, 220, 20, 19, 19, 11, 16, 16, 24, 198, 50780, 1669, 220, 16, 22, 198, 88814, 77911, 1669, 479, 4385, 62, 78542, 1255, 10128, 340, 743, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestInvalidUserPassword(t *testing.T) { _, err := Parse("http://user^:passwo^rd@foo.com/") if got, wantsub := fmt.Sprint(err), "net/url: invalid userinfo"; !strings.Contains(got, wantsub) { t.Errorf("error = %q; want substring %q", got, wantsub) } }
explode_data.jsonl/71739
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 102 }
[ 2830, 3393, 7928, 1474, 4876, 1155, 353, 8840, 836, 8, 341, 197, 6878, 1848, 1669, 14775, 445, 1254, 1110, 872, 61, 25, 6385, 1126, 61, 6498, 31, 7975, 905, 53006, 743, 2684, 11, 1366, 1966, 1669, 8879, 808, 1350, 3964, 701, 330, 47...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestIndexManagementChanges(t *testing.T) { cluster := &logging.ClusterLogging{ Spec: logging.ClusterLoggingSpec{ LogStore: &logging.LogStoreSpec{ Type: "elasticsearch", RetentionPolicy: &logging.RetentionPoliciesSpec{ App: &logging.RetentionPolicySpec{ MaxAge: elasticsearch.TimeUnit("12h"), }, }, }, }, } cr := &ClusterLoggingRequest{ Cluster: cluster, } existing := &elasticsearch.Elasticsearch{} elasticsearchCR1 := cr.newElasticsearchCR("test-app-name", existing) cluster = &logging.ClusterLogging{ Spec: logging.ClusterLoggingSpec{ LogStore: &logging.LogStoreSpec{ Type: "elasticsearch", RetentionPolicy: &logging.RetentionPoliciesSpec{ Audit: &logging.RetentionPolicySpec{ MaxAge: elasticsearch.TimeUnit("12h"), }, }, }, }, } cr = &ClusterLoggingRequest{ Cluster: cluster, } elasticsearchCR2 := cr.newElasticsearchCR("test-app-name", existing) diffCR, different := isElasticsearchCRDifferent(elasticsearchCR1, elasticsearchCR2) if !different { t.Errorf("Expected that difference would be found due to retention policy change") } if diffCR.Spec.IndexManagement.Policies[2].Name != indexmanagement.PolicyNameAudit || diffCR.Spec.IndexManagement.Policies[2].Phases.Delete.MinAge != cluster.Spec.LogStore.RetentionPolicy.Audit.MaxAge { t.Errorf("Expected that difference would be found due to retention policy change") } }
explode_data.jsonl/72387
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 540 }
[ 2830, 3393, 1552, 22237, 11317, 1155, 353, 8840, 836, 8, 341, 197, 18855, 1669, 609, 25263, 72883, 34575, 515, 197, 7568, 992, 25, 8392, 72883, 34575, 8327, 515, 298, 24201, 6093, 25, 609, 25263, 5247, 6093, 8327, 515, 571, 27725, 25, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
4
func TestUnreachableJob(t *testing.T) { // 203.0.113.0/24 is reserved for documentation so should not be routable // See: https://tools.ietf.org/html/rfc6890 ip := "203.0.113.1" // Port 80 is sometimes omitted in logs a non-standard one is easier to validate port := 1234 url := fmt.Sprintf("http://%s:%d", ip, port) event := testRequest(t, url) mapvaltest.Test( t, mapval.Strict(mapval.Compose( hbtest.MonitorChecks("http@"+url, url, ip, "http", "down"), hbtest.TCPBaseChecks(uint16(port)), hbtest.ErrorChecks(url, "io"), httpBaseChecks(url), )), event.Fields, ) }
explode_data.jsonl/39392
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 246 }
[ 2830, 3393, 1806, 46550, 12245, 1155, 353, 8840, 836, 8, 341, 197, 322, 220, 17, 15, 18, 13, 15, 13, 16, 16, 18, 13, 15, 14, 17, 19, 374, 4591, 369, 9705, 773, 1265, 537, 387, 8242, 480, 198, 197, 322, 3496, 25, 3703, 1110, 15...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestNewFromFile_SupportsNestedVariables(t *testing.T) { cases := []struct { name string template string }{ {"Variable in filename", "./test_data/TestNewFromFile_SupportsNestedVariables_VarInFilename.parent.wf.json"}, {"No variable in filename", "./test_data/TestNewFromFile_SupportsNestedVariables.parent.wf.json"}} for _, tt := range cases { t.Run(tt.name, func(t *testing.T) { ctx := context.Background() client, err := newTestGCSClient() if err != nil { t.Fatal(err) } td, err := ioutil.TempDir(os.TempDir(), "") if err != nil { t.Fatalf("error creating temp dir: %v", err) } defer os.RemoveAll(td) tf := filepath.Join(td, "test.cred") if err := ioutil.WriteFile(tf, []byte(`{ "type": "service_account" }`), 0600); err != nil { t.Fatalf("error creating temp file: %v", err) } wf, err := NewFromFile(tt.template) if err != nil { t.Fatal(err) } wf.Zone = "wf-zone" wf.Project = "bar-project" wf.OAuthPath = tf wf.Logger = &MockLogger{} wf.StorageClient = client wf.externalLogging = true err = wf.populate(ctx) if err != nil { t.Fatal(err) } child := wf.Steps["include-workflow"].IncludeWorkflow assert.Equal(t, "v1", child.Vars["k1"]) assert.Equal(t, "include-workflow-image-v1", (*child.Workflow.Steps["create-disks"].CreateDisks)[0].SourceImage) }) } }
explode_data.jsonl/3874
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 614 }
[ 2830, 3393, 3564, 43633, 1098, 2800, 82, 71986, 22678, 1155, 353, 8840, 836, 8, 341, 1444, 2264, 1669, 3056, 1235, 341, 197, 11609, 257, 914, 198, 197, 22832, 914, 198, 197, 59403, 197, 197, 4913, 7827, 304, 3899, 497, 5924, 1944, 176...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestETag(t *testing.T) { t.Parallel() app := iris.New() n := "_" app.Get("/", cache.ETag, func(ctx iris.Context) { ctx.WriteString(n) n += "_" }) // the first and last test writes the content with status OK without cache, // the rest tests the cache headers and status 304 and return, so body should be "". e := httptest.New(t, app) r := e.GET("/").Expect().Status(httptest.StatusOK) r.Header("ETag").Equal("/") // test if header setted. r.Body().Equal("_") e.GET("/").WithHeader("ETag", "/").WithHeader("If-None-Match", "/").Expect(). Status(httptest.StatusNotModified).Body().Equal("") // browser is responsible, no the test engine. r = e.GET("/").Expect().Status(httptest.StatusOK) r.Header("ETag").Equal("/") // test if header setted. r.Body().Equal("__") }
explode_data.jsonl/32200
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 298 }
[ 2830, 3393, 1348, 351, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 2822, 28236, 1669, 63942, 7121, 741, 9038, 1669, 9000, 698, 28236, 2234, 35460, 6500, 13, 1348, 351, 11, 2915, 7502, 63942, 9328, 8, 341, 197, 20985, 44747, 1445, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1