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 TestNamespaceCond(t *testing.T) { r, _ := http.NewRequest("GET", "/v2/test/list", nil) w := httptest.NewRecorder() ns := NewNamespace("/v2") ns.Cond(func(ctx *context.Context) bool { return ctx.Input.Domain() == "beego.me" }). AutoRouter(&TestController{}) AddNamespace(ns) BeeApp.Handlers.ServeHTTP(w, r) if w.Code != 405 { t.Errorf("TestNamespaceCond can't run get the result " + strconv.Itoa(w.Code)) } }
explode_data.jsonl/12611
{ "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, 22699, 49696, 1155, 353, 8840, 836, 8, 341, 7000, 11, 716, 1669, 1758, 75274, 445, 3806, 497, 3521, 85, 17, 12697, 20936, 497, 2092, 340, 6692, 1669, 54320, 70334, 7121, 47023, 2822, 84041, 1669, 1532, 22699, 4283, 85, 17, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestSet(t *testing.T) { client := framework.NewEtcdClient() keysAPI := etcd.NewKeysAPI(client) etcdStorage := etcdstorage.NewEtcdStorage(client, testapi.Default.Codec(), "", false) ctx := context.TODO() framework.WithEtcdKey(func(key string) { testObject := api.ServiceAccount{ObjectMeta: api.ObjectMeta{Name: "foo"}} if err := etcdStorage.Set(ctx, key, &testObject, nil, 0); err != nil { t.Fatalf("unexpected error: %v", err) } resp, err := keysAPI.Get(ctx, key, nil) if err != nil || resp.Node == nil { t.Fatalf("unexpected error: %v %v", err, resp) } decoded, err := runtime.Decode(testapi.Default.Codec(), []byte(resp.Node.Value)) if err != nil { t.Fatalf("unexpected response: %#v", resp.Node) } result := *decoded.(*api.ServiceAccount) if !api.Semantic.DeepEqual(testObject, result) { t.Errorf("expected: %#v got: %#v", testObject, result) } }) }
explode_data.jsonl/50998
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 358 }
[ 2830, 3393, 1649, 1155, 353, 8840, 836, 8, 341, 25291, 1669, 12626, 7121, 31860, 4385, 2959, 741, 80112, 7082, 1669, 1842, 4385, 7121, 8850, 7082, 12805, 340, 197, 295, 4385, 5793, 1669, 1842, 4385, 16172, 7121, 31860, 4385, 5793, 12805, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestUpdateWithAutoidSchema(t *testing.T) { store, clean := testkit.CreateMockStore(t) defer clean() tk := testkit.NewTestKit(t, store) tk.MustExec(`use test`) tk.MustExec(`create table t1(id int primary key auto_increment, n int);`) tk.MustExec(`create table t2(id int primary key, n float auto_increment, key I_n(n));`) tk.MustExec(`create table t3(id int primary key, n double auto_increment, key I_n(n));`) tests := []struct { exec string query string result [][]interface{} }{ { `insert into t1 set n = 1`, `select * from t1 where id = 1`, testkit.Rows(`1 1`), }, { `update t1 set id = id+1`, `select * from t1 where id = 2`, testkit.Rows(`2 1`), }, { `insert into t1 set n = 2`, `select * from t1 where id = 3`, testkit.Rows(`3 2`), }, { `update t1 set id = id + '1.1' where id = 3`, `select * from t1 where id = 4`, testkit.Rows(`4 2`), }, { `insert into t1 set n = 3`, `select * from t1 where id = 5`, testkit.Rows(`5 3`), }, { `update t1 set id = id + '0.5' where id = 5`, `select * from t1 where id = 6`, testkit.Rows(`6 3`), }, { `insert into t1 set n = 4`, `select * from t1 where id = 7`, testkit.Rows(`7 4`), }, { `insert into t2 set id = 1`, `select * from t2 where id = 1`, testkit.Rows(`1 1`), }, { `update t2 set n = n+1`, `select * from t2 where id = 1`, testkit.Rows(`1 2`), }, { `insert into t2 set id = 2`, `select * from t2 where id = 2`, testkit.Rows(`2 3`), }, { `update t2 set n = n + '2.2'`, `select * from t2 where id = 2`, testkit.Rows(`2 5.2`), }, { `insert into t2 set id = 3`, `select * from t2 where id = 3`, testkit.Rows(`3 6`), }, { `update t2 set n = n + '0.5' where id = 3`, `select * from t2 where id = 3`, testkit.Rows(`3 6.5`), }, { `insert into t2 set id = 4`, `select * from t2 where id = 4`, testkit.Rows(`4 7`), }, { `insert into t3 set id = 1`, `select * from t3 where id = 1`, testkit.Rows(`1 1`), }, { `update t3 set n = n+1`, `select * from t3 where id = 1`, testkit.Rows(`1 2`), }, { `insert into t3 set id = 2`, `select * from t3 where id = 2`, testkit.Rows(`2 3`), }, { `update t3 set n = n + '3.3'`, `select * from t3 where id = 2`, testkit.Rows(`2 6.3`), }, { `insert into t3 set id = 3`, `select * from t3 where id = 3`, testkit.Rows(`3 7`), }, { `update t3 set n = n + '0.5' where id = 3`, `select * from t3 where id = 3`, testkit.Rows(`3 7.5`), }, { `insert into t3 set id = 4`, `select * from t3 where id = 4`, testkit.Rows(`4 8`), }, } for _, tt := range tests { tk.MustExec(tt.exec) tk.MustQuery(tt.query).Check(tt.result) } }
explode_data.jsonl/76260
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1391 }
[ 2830, 3393, 4289, 2354, 19602, 588, 8632, 1155, 353, 8840, 836, 8, 341, 57279, 11, 4240, 1669, 1273, 8226, 7251, 11571, 6093, 1155, 340, 16867, 4240, 741, 3244, 74, 1669, 1273, 8226, 7121, 2271, 7695, 1155, 11, 3553, 340, 3244, 74, 50...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestValidateNodeIP(t *testing.T) { hostnameOverride := GetHostname() localIP, _ := GetLocalIP(hostnameOverride) cases := []struct { name string ip net.IP expected error }{ { name: "case1", ip: nil, expected: fmt.Errorf("nodeIP must be a valid IP address"), }, { name: "case2", ip: net.IPv4(127, 0, 0, 1), expected: fmt.Errorf("nodeIP can't be loopback address"), }, { name: "case3", ip: net.IPv4(239, 0, 0, 254), expected: fmt.Errorf("nodeIP can't be a multicast address"), }, { name: "case4", ip: net.IPv4(169, 254, 0, 0), expected: fmt.Errorf("nodeIP can't be a link-local unicast address"), }, { name: "case5", ip: net.IPv4(0, 0, 0, 0), expected: fmt.Errorf("nodeIP can't be an all zeros address"), }, { name: "case 6", ip: net.ParseIP(localIP), expected: nil, }, { name: "case 7", ip: net.IPv4(114, 114, 114, 114), expected: fmt.Errorf("node IP: %q not found in the host's network interfaces", "114.114.114.114"), }, } for _, c := range cases { err := ValidateNodeIP(c.ip) if !reflect.DeepEqual(err, c.expected) { t.Errorf("%v: expected %v, but got %v", c.name, c.expected, err) } } }
explode_data.jsonl/76272
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 629 }
[ 2830, 3393, 17926, 1955, 3298, 1155, 353, 8840, 836, 8, 341, 197, 27806, 2177, 1669, 2126, 88839, 741, 8854, 3298, 11, 716, 1669, 2126, 7319, 3298, 85886, 2177, 692, 1444, 2264, 1669, 3056, 1235, 341, 197, 11609, 257, 914, 198, 197, 4...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestNoCancellationContext(t *testing.T) { deadline := time.Now().Add(1 * time.Second) ctx, cancelFunc := context.WithDeadline(context.Background(), deadline) cancelFunc() require.Error(t, ctx.Err()) d, ok := ctx.Deadline() require.True(t, ok) require.Equal(t, deadline, d) nctx := noCancellationContext{Context: ctx} assert.NoError(t, nctx.Err()) d, ok = nctx.Deadline() assert.False(t, ok) assert.True(t, d.IsZero()) }
explode_data.jsonl/46014
{ "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, 2753, 82298, 1972, 1155, 353, 8840, 836, 8, 341, 197, 78788, 1669, 882, 13244, 1005, 2212, 7, 16, 353, 882, 32435, 340, 20985, 11, 9121, 9626, 1669, 2266, 26124, 83593, 5378, 19047, 1507, 21428, 340, 84441, 9626, 741, 17957,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestState_IsOn(t *testing.T) { t.Parallel() st := setupNewState() if st.IsOn(users[0], channels[0]) { t.Errorf("Expected %v to not be on %v", users[0], channels[0]) } st.addChannel(channels[0]) if st.IsOn(users[0], channels[0]) { t.Errorf("Expected %v to not be on %v", users[0], channels[0]) } st.addUser(users[0]) st.addToChannel(users[0], channels[0]) if !st.IsOn(users[0], channels[0]) { t.Errorf("Expected %v to be on %v", users[0], channels[0]) } }
explode_data.jsonl/32090
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 211 }
[ 2830, 3393, 1397, 31879, 1925, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 2822, 18388, 1669, 6505, 3564, 1397, 741, 743, 357, 4506, 1925, 35438, 58, 15, 1125, 11744, 58, 15, 2467, 341, 197, 3244, 13080, 445, 18896, 1018, 85, 311...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestHash(t *testing.T) { // hash the empty string to be sure that sha256 is being used expect := "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" sum := Hash("") if expect != sum { t.Errorf("expected hash %q but got %q", expect, sum) } }
explode_data.jsonl/32275
{ "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, 6370, 1155, 353, 8840, 836, 8, 341, 197, 322, 5175, 279, 4287, 914, 311, 387, 2704, 429, 15870, 17, 20, 21, 374, 1660, 1483, 198, 24952, 1669, 330, 68, 18, 65, 15, 66, 19, 19, 17, 24, 23, 8316, 16, 66, 16, 19, 24, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestAnalyzersHaveUniqueNames(t *testing.T) { g := NewWithT(t) existingNames := make(map[string]struct{}) for _, a := range All() { n := a.Metadata().Name _, ok := existingNames[n] // TODO (Nino-K): remove this condition once metadata is clean up if ok == true && n == "schema.ValidationAnalyzer.ServiceEntry" { continue } g.Expect(ok).To(BeFalse(), fmt.Sprintf("Analyzer name %q is used more than once. "+ "Analyzers should be registered in All() exactly once and have a unique name.", n)) existingNames[n] = struct{}{} } }
explode_data.jsonl/37450
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 198 }
[ 2830, 3393, 73307, 59619, 12116, 22811, 7980, 1155, 353, 8840, 836, 8, 341, 3174, 1669, 1532, 2354, 51, 1155, 692, 8122, 11083, 7980, 1669, 1281, 9147, 14032, 60, 1235, 37790, 2023, 8358, 264, 1669, 2088, 2009, 368, 341, 197, 9038, 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...
4
func TestCheckBoolean(t *testing.T) { l := lua.NewState() l.PushBoolean(true) if !checkBoolean(l, -1) { t.Error("expected true") } l.PushNumber(42) defer func() { err := recover() if err == nil { t.Error("expected panic") } }() checkBoolean(l, -1) }
explode_data.jsonl/40378
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 123 }
[ 2830, 3393, 3973, 6890, 1155, 353, 8840, 836, 8, 341, 8810, 1669, 20357, 7121, 1397, 741, 8810, 34981, 6890, 3715, 340, 743, 753, 2028, 6890, 2333, 11, 481, 16, 8, 341, 197, 3244, 6141, 445, 7325, 830, 1138, 197, 630, 8810, 34981, 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...
2
func TestAppendElement(t *testing.T) { e := Tags(struct{ a, b, c Tag }{}) doc := e.a(e.b("b")) doc.Append(e.c("c")) assert.Equal(t, `<a><b>b</b><c>c</c></a>`, marshal(doc)) }
explode_data.jsonl/15615
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 92 }
[ 2830, 3393, 23877, 1691, 1155, 353, 8840, 836, 8, 341, 7727, 1669, 27683, 6163, 90, 264, 11, 293, 11, 272, 12353, 335, 37790, 59536, 1669, 384, 5849, 2026, 948, 445, 65, 5455, 59536, 8982, 2026, 520, 445, 66, 5455, 6948, 12808, 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
func TestConstStringIter(t *testing.T) { const SCRIPT = ` var count = 0; for (var i in "1234") { for (var j in "1234567") { count++ } } count; ` testScript1(SCRIPT, intToValue(28), t) }
explode_data.jsonl/10448
{ "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, 19167, 703, 8537, 1155, 353, 8840, 836, 8, 341, 4777, 53679, 284, 1565, 271, 2405, 1760, 284, 220, 15, 401, 2023, 320, 947, 600, 304, 330, 16, 17, 18, 19, 899, 341, 7782, 2023, 320, 947, 502, 304, 330, 16, 17, 18, 19...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestValidateExpirationYear(t *testing.T) { if !ValidateExpirationYear("2020") { t.Error("2020") t.FailNow() } if !ValidateExpirationYear("2025") { t.Error("2025") t.FailNow() } if !ValidateExpirationYear("2030") { t.Error("2030") t.FailNow() } if ValidateExpirationYear("2019") { t.Error("2019") t.FailNow() } if ValidateExpirationYear("2031") { t.Error("2031") t.FailNow() } }
explode_data.jsonl/24411
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 186 }
[ 2830, 3393, 17926, 66301, 9490, 1155, 353, 8840, 836, 8, 341, 743, 753, 17926, 66301, 9490, 445, 17, 15, 17, 15, 899, 341, 197, 3244, 6141, 445, 17, 15, 17, 15, 1138, 197, 3244, 57243, 7039, 741, 197, 532, 743, 753, 17926, 66301, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestBasicTransform(t *testing.T) { type Test struct { String string `r:"repl"` } var tt Test set := New() set.SetTagName("r") set.Register("repl", func(ctx context.Context, t *Transformer, value reflect.Value, param string) error { value.SetString("test") return nil }) val := reflect.ValueOf(tt) // trigger a wait in struct parsing for i := 0; i < 3; i++ { _, err := set.extractStructCache(val) Equal(t, err, nil) } err := set.Struct(context.Background(), &tt) Equal(t, err, nil) Equal(t, tt.String, "test") type Test2 struct { Test Test String string `r:"repl"` } var tt2 Test2 err = set.Struct(context.Background(), &tt2) Equal(t, err, nil) Equal(t, tt2.Test.String, "test") Equal(t, tt2.String, "test") type Test3 struct { Test String string `r:"repl"` } var tt3 Test3 err = set.Struct(context.Background(), &tt3) Equal(t, err, nil) Equal(t, tt3.Test.String, "test") Equal(t, tt3.String, "test") type Test4 struct { Test *Test String string `r:"repl"` } var tt4 Test4 err = set.Struct(context.Background(), &tt4) Equal(t, err, nil) Equal(t, tt4.Test, nil) Equal(t, tt4.String, "test") tt5 := Test4{Test: &Test{}} err = set.Struct(context.Background(), &tt5) Equal(t, err, nil) Equal(t, tt5.Test.String, "test") Equal(t, tt5.String, "test") type Test6 struct { Test *Test `r:"default"` String string `r:"repl"` } var tt6 Test6 set.Register("default", func(ctx context.Context, t *Transformer, value reflect.Value, param string) error { value.Set(reflect.New(value.Type().Elem())) return nil }) err = set.Struct(context.Background(), &tt6) Equal(t, err, nil) NotEqual(t, tt6.Test, nil) Equal(t, tt6.Test.String, "test") Equal(t, tt6.String, "test") tt6.String = "BAD" var tString string // wil invoke one processing and one waiting go func() { err := set.Field(context.Background(), &tString, "repl") Equal(t, err, nil) }() err = set.Field(context.Background(), &tt6.String, "repl") Equal(t, err, nil) Equal(t, tt6.String, "test") err = set.Field(context.Background(), &tt6.String, "") Equal(t, err, nil) err = set.Field(context.Background(), &tt6.String, "-") Equal(t, err, nil) err = set.Field(context.Background(), tt6.String, "test") NotEqual(t, err, nil) Equal(t, err.Error(), "mold: Field(non-pointer string)") err = set.Field(context.Background(), nil, "test") NotEqual(t, err, nil) Equal(t, err.Error(), "mold: Field(nil)") var iface interface{} err = set.Field(context.Background(), iface, "test") NotEqual(t, err, nil) Equal(t, err.Error(), "mold: Field(nil)") done := make(chan struct{}) go func() { err := set.Field(context.Background(), &tString, "nonexistant") NotEqual(t, err, nil) close(done) }() err = set.Field(context.Background(), &tt6.String, "nonexistant") NotEqual(t, err, nil) Equal(t, err.Error(), "unregistered/undefined transformation 'nonexistant' found on field") <-done set.Register("dummy", func(ctx context.Context, t *Transformer, value reflect.Value, param string) error { return nil }) err = set.Field(context.Background(), &tt6.String, "dummy") Equal(t, err, nil) }
explode_data.jsonl/43614
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1287 }
[ 2830, 3393, 15944, 8963, 1155, 353, 8840, 836, 8, 1476, 13158, 3393, 2036, 341, 197, 4980, 914, 1565, 81, 2974, 265, 500, 8805, 197, 630, 2405, 17853, 3393, 271, 8196, 1669, 1532, 741, 8196, 4202, 22616, 445, 81, 1138, 8196, 19983, 44...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestCalculateCapacities(t *testing.T) { activeProcessesPriorities := make(ProcessMetrics) activeProcessesPriorities["first"] = 4 activeProcessesPriorities["second"] = 1 browserState := make(BrowserState) const maxConnections = 25 newCapacities := calculateCapacities(browserState, activeProcessesPriorities, maxConnections) AssertThat(t, newCapacities["first"], EqualTo{20}) AssertThat(t, newCapacities["second"], EqualTo{5}) }
explode_data.jsonl/65289
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 139 }
[ 2830, 3393, 47866, 12903, 580, 1361, 1155, 353, 8840, 836, 8, 341, 74770, 92727, 49471, 1361, 1669, 1281, 78003, 27328, 340, 74770, 92727, 49471, 1361, 1183, 3896, 1341, 284, 220, 19, 198, 74770, 92727, 49471, 1361, 1183, 5569, 1341, 284,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestIsCfgChanged(t *testing.T) { getInitialCfg := func() *ReplicationCfg { return &ReplicationCfg{ ReplicationConfig: ReplicationConfig{ ID: "foo", Remote: "a", Direction: ActiveReplicatorTypePull, ConflictResolutionType: ConflictResolverCustom, ConflictResolutionFn: "a", PurgeOnRemoval: true, DeltaSyncEnabled: true, MaxBackoff: 5, InitialState: "a", Continuous: true, Filter: "a", QueryParams: []interface{}{"ABC"}, Cancel: true, }, } } type cfgChangedTest struct { name string // Test name updatedConfig *ReplicationUpsertConfig // Updated replication config expectedChanged bool } testCases := []cfgChangedTest{ { name: "remoteChanged", updatedConfig: &ReplicationUpsertConfig{ Remote: base.StringPtr("b"), }, expectedChanged: true, }, { name: "directionChanged", updatedConfig: &ReplicationUpsertConfig{ Direction: base.StringPtr(string(ActiveReplicatorTypePushAndPull)), }, expectedChanged: true, }, { name: "conflictResolverChanged", updatedConfig: &ReplicationUpsertConfig{ ConflictResolutionType: base.StringPtr(string(ConflictResolverDefault)), }, expectedChanged: true, }, { name: "conflictResolverFnChange", updatedConfig: &ReplicationUpsertConfig{ ConflictResolutionFn: base.StringPtr("b"), }, expectedChanged: true, }, { name: "unchanged", updatedConfig: &ReplicationUpsertConfig{ Remote: base.StringPtr("a"), ConflictResolutionFn: base.StringPtr("a"), }, expectedChanged: false, }, } testBucket := base.GetTestBucket(t) defer testBucket.Close() testCfg, err := base.NewCfgSG(testBucket, "") require.NoError(t, err) mgr, err := NewSGReplicateManager(&DatabaseContext{Name: "test"}, testCfg) require.NoError(t, err) for _, testCase := range testCases { t.Run(fmt.Sprintf("%s", testCase.name), func(t *testing.T) { replicationCfg := getInitialCfg() replicatorConfig, err := mgr.NewActiveReplicatorConfig(replicationCfg) replicationCfg.Upsert(testCase.updatedConfig) isChanged, err := mgr.isCfgChanged(replicationCfg, replicatorConfig) assert.NoError(t, err) assert.Equal(t, testCase.expectedChanged, isChanged) }) } }
explode_data.jsonl/73344
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1081 }
[ 2830, 3393, 3872, 42467, 5389, 1155, 353, 8840, 836, 8, 1476, 10366, 6341, 42467, 1669, 2915, 368, 353, 18327, 1693, 42467, 341, 197, 853, 609, 18327, 1693, 42467, 515, 298, 197, 18327, 1693, 2648, 25, 3321, 1693, 2648, 515, 571, 29580,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_Size(t *testing.T) { // Open a data file. db := MustOpenDB() path := db.Path() defer db.MustClose() pagesize := db.Info().PageSize // Insert until we get above the minimum 4MB size. if err := db.Update(func(tx *bolt.Tx) error { b, _ := tx.CreateBucketIfNotExists([]byte("data")) for i := 0; i < 10000; i++ { if err := b.Put([]byte(fmt.Sprintf("%04d", i)), make([]byte, 1000)); err != nil { t.Fatal(err) } } return nil }); err != nil { t.Fatal(err) } // Close database and grab the size. if err := db.DB.Close(); err != nil { t.Fatal(err) } sz := fileSize(path) if sz == 0 { t.Fatalf("unexpected new file size: %d", sz) } // Reopen database, update, and check size again. db0, err := bolt.Open(path, 0666, nil) if err != nil { t.Fatal(err) } if err := db0.Update(func(tx *bolt.Tx) error { if err := tx.Bucket([]byte("data")).Put([]byte{0}, []byte{0}); err != nil { t.Fatal(err) } return nil }); err != nil { t.Fatal(err) } if err := db0.Close(); err != nil { t.Fatal(err) } newSz := fileSize(path) if newSz == 0 { t.Fatalf("unexpected new file size: %d", newSz) } // Compare the original size with the new size. // db size might increase by a few page sizes due to the new small update. if sz < newSz-5*int64(pagesize) { t.Fatalf("unexpected file growth: %d => %d", sz, newSz) } }
explode_data.jsonl/27463
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 586 }
[ 2830, 3393, 5002, 45553, 1155, 353, 8840, 836, 8, 341, 197, 322, 5264, 264, 821, 1034, 624, 20939, 1669, 15465, 5002, 3506, 741, 26781, 1669, 2927, 17474, 741, 16867, 2927, 50463, 7925, 2822, 3223, 1134, 551, 1669, 2927, 20132, 1005, 45...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestYAMLLoader_SupportedFileExtensions(t *testing.T) { tests := []struct { name string want []string }{ { name: "support .yaml and .yml file extensions", want: []string{".yaml", ".yml"}, }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { yl := &YAMLLoader{} if got := yl.SupportedFileExtensions(); !reflect.DeepEqual(got, tt.want) { t.Errorf("YAMLLoader.SupportedFileExtensions() = %v, want %v", got, tt.want) } }) } }
explode_data.jsonl/33677
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 212 }
[ 2830, 3393, 56, 1402, 4086, 39966, 1098, 12513, 1703, 31282, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 3056, 1235, 341, 197, 11609, 914, 198, 197, 50780, 3056, 917, 198, 197, 59403, 197, 197, 515, 298, 11609, 25, 330, 23362, 659, 414...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestDeclLine(t *testing.T) { ver, _ := goversion.Parse(runtime.Version()) if ver.Major > 0 && !ver.AfterOrEqual(goversion.GoVersion{Major: 1, Minor: 10, Rev: -1}) { t.Skip("go 1.9 and prior versions do not emit DW_AT_decl_line") } withTestProcess("decllinetest", t, func(p *proc.Target, fixture protest.Fixture) { setFileBreakpoint(p, t, fixture.Source, 8) setFileBreakpoint(p, t, fixture.Source, 9) setFileBreakpoint(p, t, fixture.Source, 10) setFileBreakpoint(p, t, fixture.Source, 11) setFileBreakpoint(p, t, fixture.Source, 14) assertNoError(p.Continue(), t, "Continue 1") if goversion.VersionAfterOrEqual(runtime.Version(), 1, 15) { testDeclLineCount(t, p, 8, []string{}) } else { testDeclLineCount(t, p, 8, []string{"a"}) } assertNoError(p.Continue(), t, "Continue 2") testDeclLineCount(t, p, 9, []string{"a"}) assertNoError(p.Continue(), t, "Continue 3") if goversion.VersionAfterOrEqual(runtime.Version(), 1, 15) { testDeclLineCount(t, p, 10, []string{"a"}) } else { testDeclLineCount(t, p, 10, []string{"a", "b"}) } assertNoError(p.Continue(), t, "Continue 4") testDeclLineCount(t, p, 11, []string{"a", "b"}) assertNoError(p.Continue(), t, "Continue 5") testDeclLineCount(t, p, 14, []string{"a", "b"}) }) }
explode_data.jsonl/56301
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 516 }
[ 2830, 3393, 21629, 2460, 1155, 353, 8840, 836, 8, 341, 197, 423, 11, 716, 1669, 728, 4366, 8937, 89467, 35842, 2398, 743, 2739, 1321, 3035, 861, 220, 15, 1009, 753, 423, 36892, 2195, 2993, 3268, 859, 1325, 67131, 5637, 90, 34475, 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...
3
func TestClient_ShowJobSpec_NotFound(t *testing.T) { t.Parallel() app, cleanup := cltest.NewApplication(t, cltest.EthMockRegisterChainID) defer cleanup() require.NoError(t, app.Start()) client, r := app.NewClientAndRenderer() set := flag.NewFlagSet("test", 0) set.Parse([]string{"bogus-ID"}) c := cli.NewContext(nil, set, nil) assert.Error(t, client.ShowJobSpec(c)) assert.Empty(t, r.Renders) }
explode_data.jsonl/78837
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 161 }
[ 2830, 3393, 2959, 79665, 12245, 8327, 60816, 6650, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 2822, 28236, 11, 21290, 1669, 1185, 1944, 7121, 4988, 1155, 11, 1185, 1944, 5142, 339, 11571, 8690, 18837, 915, 340, 16867, 21290, 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
func TestStoreGetNonCachedReceipts(t *testing.T) { logger.SetTestMode(t) block, expect := fakeReceipts() store := nonCachedStore() store.SetRawReceipts(block, expect) got, _ := store.GetRawReceipts(block) equalStorageReceipts(t, expect, got) }
explode_data.jsonl/51278
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 100 }
[ 2830, 3393, 6093, 1949, 8121, 70293, 67461, 82, 1155, 353, 8840, 836, 8, 341, 17060, 4202, 2271, 3636, 1155, 692, 47996, 11, 1720, 1669, 12418, 67461, 82, 741, 57279, 1669, 2477, 70293, 6093, 741, 57279, 4202, 20015, 67461, 82, 18682, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestShouldFindStringInSliceFold(t *testing.T) { a := "xYz" b := "AbC" slice := []string{"XYz", "abc"} assert.True(t, IsStringInSliceFold(a, slice)) assert.True(t, IsStringInSliceFold(b, slice)) }
explode_data.jsonl/45970
{ "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, 14996, 9885, 703, 641, 33236, 75536, 1155, 353, 8840, 836, 8, 341, 11323, 1669, 330, 87, 56, 89, 698, 2233, 1669, 330, 5830, 34, 698, 1903, 4754, 1669, 3056, 917, 4913, 16356, 89, 497, 330, 13683, 63159, 6948, 32443, 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 TestFlatten(t *testing.T) { assert := require.New(t) assert.Equal([]interface{}{`one`, `two`, `three`}, Flatten([]string{`one`, `two`, `three`})) assert.Equal([]interface{}{`one`, `two`, `three`}, Flatten([]interface{}{[]string{`one`, `two`}, `three`})) assert.Equal([]interface{}{`one`, `two`, `three`}, Flatten([]interface{}{[]string{`one`}, []string{`two`}, []string{`three`}})) }
explode_data.jsonl/45573
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 155 }
[ 2830, 3393, 3882, 14456, 1155, 353, 8840, 836, 8, 341, 6948, 1669, 1373, 7121, 1155, 692, 6948, 12808, 10556, 4970, 6257, 90, 63, 603, 7808, 1565, 19789, 7808, 1565, 27856, 63, 2137, 85638, 10556, 917, 90, 63, 603, 7808, 1565, 19789, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestBuildQuery(t *testing.T) { gtest.C(t, func(t *gtest.T) { src := url.Values{ "a": {"a2", "a1"}, "b": {"b2", "b1"}, "c": {"c1", "c2"}, } expect := "a=a2&a=a1&b=b2&b=b1&c=c1&c=c2" t.Assert(gurl.BuildQuery(src), expect) }) }
explode_data.jsonl/52550
{ "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, 11066, 2859, 1155, 353, 8840, 836, 8, 341, 3174, 1944, 727, 1155, 11, 2915, 1155, 353, 82038, 836, 8, 341, 197, 41144, 1669, 2515, 35145, 515, 298, 197, 56693, 788, 5212, 64, 17, 497, 330, 64, 16, 7115, 298, 197, 1, 65...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestRevelLevelfOutput(t *testing.T) { l, b := newBufferedRevelLog() l.Errorf("This is %s test", "a") expectedMatch := "ERROR.*This is a test\n" actual := b.String() if ok, _ := regexp.Match(expectedMatch, []byte(actual)); !ok { t.Errorf("Log output mismatch %s (actual) != %s (expected)", actual, expectedMatch) } }
explode_data.jsonl/3452
{ "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, 693, 889, 2304, 85, 490, 5097, 1155, 353, 8840, 836, 8, 341, 8810, 11, 293, 1669, 501, 4095, 291, 693, 889, 2201, 741, 8810, 13080, 445, 1986, 374, 1018, 82, 1273, 497, 330, 64, 5130, 42400, 8331, 1669, 330, 3682, 4908, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestTx_DeleteBucket_ReadOnly(t *testing.T) { db := MustOpenDB() defer db.MustClose() if err := db.View(func(tx *bolt.Tx) error { if err := tx.DeleteBucket([]byte("foo")); err != bolt.ErrTxNotWritable { t.Fatalf("unexpected error: %s", err) } return nil }); err != nil { t.Fatal(err) } }
explode_data.jsonl/1696
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 132 }
[ 2830, 3393, 31584, 57418, 36018, 62, 20914, 1155, 353, 8840, 836, 8, 341, 20939, 1669, 15465, 5002, 3506, 741, 16867, 2927, 50463, 7925, 741, 743, 1848, 1669, 2927, 6382, 18552, 27301, 353, 52433, 81362, 8, 1465, 341, 197, 743, 1848, 16...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestRequestBodyBuffered(t *testing.T) { // Buffered requested are removed by // *http.Client.Do // but we want wedeploy.RequestBody to "persist" // so we can read it afterwards (for example, for verbose mode) setupServer() defer teardownServer() mux.HandleFunc("/url", func(w http.ResponseWriter, r *http.Request) { fmt.Fprintf(w, `"body"`) }) req := URL("http://example.com/url") type Foo struct { Bar string `json:"bar"` } var foo = &Foo{Bar: "one"} var b, _ = json.Marshal(foo) req.Body(bytes.NewBuffer(b)) if err := req.Get(); err != nil { t.Error(err) } var want = `{"bar":"one"}` var got = req.RequestBody.(*bytes.Buffer).String() if want != got { t.Errorf("Wanted request body %v, got %v instead", want, got) } }
explode_data.jsonl/24738
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 293 }
[ 2830, 3393, 33334, 4095, 291, 1155, 353, 8840, 836, 8, 341, 197, 322, 30702, 11223, 525, 6963, 553, 198, 197, 322, 353, 1254, 11716, 33596, 198, 197, 322, 714, 582, 1366, 10840, 747, 1989, 72096, 311, 330, 39826, 698, 197, 322, 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...
1
func TestJsonSamples(t *testing.T) { bidder, buildErr := Builder(openrtb_ext.BidderConnectAd, config.Adapter{ Endpoint: "http://bidder.connectad.io/API?src=pbs"}) if buildErr != nil { t.Fatalf("Builder returned unexpected error %v", buildErr) } adapterstest.RunJSONBidderTest(t, "connectadtest", bidder) }
explode_data.jsonl/30336
{ "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, 5014, 39571, 1155, 353, 8840, 836, 8, 341, 2233, 307, 1107, 11, 1936, 7747, 1669, 20626, 30981, 3342, 65, 9927, 1785, 307, 1107, 14611, 2589, 11, 2193, 34190, 515, 197, 197, 27380, 25, 330, 1254, 1110, 20648, 1107, 10800, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_Map(t *testing.T) { in := []int{1, 2, 4, 8} expected := []float32{1.1, 2.2, 4.4, 8.8} mapper := func(i int) float32 { return float32(i) * 1.1 } actual := Map(in, mapper) assert.Equal(t, expected, actual) }
explode_data.jsonl/58331
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 106 }
[ 2830, 3393, 56992, 1155, 353, 8840, 836, 8, 341, 17430, 1669, 3056, 396, 90, 16, 11, 220, 17, 11, 220, 19, 11, 220, 23, 532, 42400, 1669, 3056, 3649, 18, 17, 90, 16, 13, 16, 11, 220, 17, 13, 17, 11, 220, 19, 13, 19, 11, 220,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestONTTransfer(t *testing.T) { for i := 1; i <= 100; i++ { endpoint := "http://polaris1.ont.io:20336" //pass := "" //wif, _ := neoutils.NEP2Decrypt("", pass) wif := "" asset := "ong" to := "AcWfHYbPDt4ysz7s5WQtkGvcFsfTsM6anm" amount := float64(float64(i) / math.Pow10(9)) gasPrice := int(500) gasLimit := int(20000) txid, err := neoutils.OntologyTransfer(endpoint, gasPrice, gasLimit, wif, asset, to, amount) if err != nil { log.Printf("err %v", err) return } log.Printf("tx id =%v", txid) } }
explode_data.jsonl/20396
{ "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, 10232, 21970, 1155, 353, 8840, 836, 8, 1476, 2023, 600, 1669, 220, 16, 26, 600, 2651, 220, 16, 15, 15, 26, 600, 1027, 1476, 197, 6246, 2768, 1669, 330, 1254, 1110, 79, 7417, 285, 16, 13, 544, 4245, 25, 17, 15, 18, 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...
3
func TestReconcilePropagateAnnotations(t *testing.T) { names.TestingSeed() ps := []*v1alpha1.Pipeline{tb.Pipeline("test-pipeline", "foo", tb.PipelineSpec( tb.PipelineTask("hello-world-1", "hello-world"), ))} prs := []*v1alpha1.PipelineRun{tb.PipelineRun("test-pipeline-run-with-annotations", "foo", tb.PipelineRunAnnotation("PipelineRunAnnotation", "PipelineRunValue"), tb.PipelineRunSpec("test-pipeline", tb.PipelineRunServiceAccount("test-sa"), ), )} ts := []*v1alpha1.Task{tb.Task("hello-world", "foo")} d := test.Data{ PipelineRuns: prs, Pipelines: ps, Tasks: ts, } testAssets, cancel := getPipelineRunController(t, d) defer cancel() c := testAssets.Controller clients := testAssets.Clients err := c.Reconciler.Reconcile(context.Background(), "foo/test-pipeline-run-with-annotations") if err != nil { t.Errorf("Did not expect to see error when reconciling completed PipelineRun but saw %s", err) } // Check that the PipelineRun was reconciled correctly _, err = clients.Pipeline.Tekton().PipelineRuns("foo").Get("test-pipeline-run-with-annotations", metav1.GetOptions{}) if err != nil { t.Fatalf("Somehow had error getting completed reconciled run out of fake client: %s", err) } // Check that the expected TaskRun was created actual := clients.Pipeline.Actions()[0].(ktesting.CreateAction).GetObject().(*v1alpha1.TaskRun) if actual == nil { t.Errorf("Expected a TaskRun to be created, but it wasn't.") } expectedTaskRun := tb.TaskRun("test-pipeline-run-with-annotations-hello-world-1-9l9zj", "foo", tb.TaskRunOwnerReference("PipelineRun", "test-pipeline-run-with-annotations", tb.OwnerReferenceAPIVersion("tekton.dev/v1alpha1"), tb.Controller, tb.BlockOwnerDeletion, ), tb.TaskRunLabel("tekton.dev/pipeline", "test-pipeline"), tb.TaskRunLabel(pipeline.GroupName+pipeline.PipelineTaskLabelKey, "hello-world-1"), tb.TaskRunLabel("tekton.dev/pipelineRun", "test-pipeline-run-with-annotations"), tb.TaskRunAnnotation("PipelineRunAnnotation", "PipelineRunValue"), tb.TaskRunSpec( tb.TaskRunTaskRef("hello-world"), tb.TaskRunServiceAccount("test-sa"), ), ) if d := cmp.Diff(actual, expectedTaskRun); d != "" { t.Errorf("expected to see TaskRun %v created. Diff %s", expectedTaskRun, d) } }
explode_data.jsonl/81296
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 906 }
[ 2830, 3393, 693, 40446, 457, 2008, 46836, 21418, 1155, 353, 8840, 836, 8, 341, 93940, 8787, 287, 41471, 2822, 35009, 1669, 29838, 85, 16, 7141, 16, 1069, 8790, 90, 18387, 1069, 8790, 445, 1944, 2268, 8790, 497, 330, 7975, 497, 16363, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestDirFDIterDirents(t *testing.T) { sys := newTestSystem(t, func(creds *auth.Credentials, fs *filesystem) *kernfs.Dentry { return fs.newReadonlyDir(creds, 0755, map[string]*kernfs.Dentry{ // Fill root with nodes backed by various inode implementations. "dir1": fs.newReadonlyDir(creds, 0755, nil), "dir2": fs.newDir(creds, 0755, map[string]*kernfs.Dentry{ "dir3": fs.newDir(creds, 0755, nil), }), "file1": fs.newFile(creds, staticFileContent), }) }) pop := sys.PathOpAtRoot("/") fd, err := sys.vfs.OpenAt(sys.ctx, sys.creds, &pop, &vfs.OpenOptions{}) if err != nil { sys.t.Fatalf("OpenAt for PathOperation %+v failed: %v", pop, err) } defer fd.DecRef() collector := &direntCollector{} if err := fd.IterDirents(sys.ctx, collector); err != nil { sys.t.Fatalf("IterDirent failed: %v", err) } // Root directory should contain ".", ".." and 3 children: if collector.count() != 5 { sys.t.Fatalf("IterDirent returned too many dirents") } for _, dirName := range []string{".", "..", "dir1", "dir2"} { if err := collector.contains(dirName, linux.DT_DIR); err != nil { sys.t.Fatalf("IterDirent had unexpected results: %v", err) } } if err := collector.contains("file1", linux.DT_REG); err != nil { sys.t.Fatalf("IterDirent had unexpected results: %v", err) } }
explode_data.jsonl/19805
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 550 }
[ 2830, 3393, 6184, 14596, 8537, 87409, 65677, 1155, 353, 8840, 836, 8, 341, 41709, 1669, 501, 2271, 2320, 1155, 11, 2915, 7, 85734, 353, 3242, 727, 15735, 11, 8619, 353, 41897, 8, 353, 74, 932, 3848, 909, 4085, 341, 197, 853, 8619, 4...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestGerritOptOutHelpRepos(t *testing.T) { tests := []struct { name string in *GerritOrgRepoConfigs want map[string]sets.String }{ { name: "multiple-org", in: &GerritOrgRepoConfigs{ { Org: "org-1", Repos: []string{"repo-1"}, OptOutHelp: true, }, { Org: "org-2", Repos: []string{"repo-2"}, OptOutHelp: true, }, }, want: map[string]sets.String{ "org-1": sets.NewString("repo-1"), "org-2": sets.NewString("repo-2"), }, }, { name: "org-union", in: &GerritOrgRepoConfigs{ { Org: "org-1", Repos: []string{"repo-1"}, OptOutHelp: true, }, { Org: "org-1", Repos: []string{"repo-2"}, OptOutHelp: true, }, }, want: map[string]sets.String{ "org-1": sets.NewString("repo-1", "repo-2"), }, }, { name: "skip-non-optout", in: &GerritOrgRepoConfigs{ { Org: "org-1", Repos: []string{"repo-1"}, }, { Org: "org-1", Repos: []string{"repo-2"}, OptOutHelp: true, }, }, want: map[string]sets.String{ "org-1": sets.NewString("repo-2"), }, }, { name: "empty", in: &GerritOrgRepoConfigs{}, want: nil, }, } for _, tc := range tests { t.Run(tc.name, func(t *testing.T) { got := tc.in.OptOutHelpRepos() if diff := cmp.Diff(tc.want, got); diff != "" { t.Errorf("output mismatch. got(+), want(-):\n%s", diff) } }) } }
explode_data.jsonl/41020
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 849 }
[ 2830, 3393, 38, 615, 275, 21367, 2662, 12689, 693, 966, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 3056, 1235, 341, 197, 11609, 914, 198, 197, 17430, 256, 353, 38, 615, 275, 42437, 25243, 84905, 198, 197, 50780, 2415, 14032, 60, 4917,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestMakeWithBool(t *testing.T) { o := opt.Bool(0, true) assert.True(t, o.IsDefined()) assert.Equal(t, 0, o.Get()) v, ok := o.Fetch() assert.Equal(t, 0, v) assert.True(t, ok) o = opt.Bool(100, false) assert.False(t, o.IsDefined()) assert.Panics(t, func() { o.Get() }) v, ok = o.Fetch() assert.Equal(t, 0, v) assert.False(t, ok) }
explode_data.jsonl/32426
{ "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, 8078, 2354, 11233, 1155, 353, 8840, 836, 8, 341, 22229, 1669, 3387, 52497, 7, 15, 11, 830, 692, 6948, 32443, 1155, 11, 297, 4506, 29361, 2398, 6948, 12808, 1155, 11, 220, 15, 11, 297, 2234, 12367, 5195, 11, 5394, 1669, 2...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestClientReceivingUnknownTopicWithBackoffFunc(t *testing.T) { seedBroker := NewMockBroker(t, 1) metadataResponse1 := new(MetadataResponse) seedBroker.Returns(metadataResponse1) retryCount := int32(0) config := NewTestConfig() config.Metadata.Retry.Max = 1 config.Metadata.Retry.BackoffFunc = func(retries, maxRetries int) time.Duration { atomic.AddInt32(&retryCount, 1) return 0 } client, err := NewClient([]string{seedBroker.Addr()}, config) if err != nil { t.Fatal(err) } metadataUnknownTopic := new(MetadataResponse) metadataUnknownTopic.AddTopic("new_topic", ErrUnknownTopicOrPartition) seedBroker.Returns(metadataUnknownTopic) seedBroker.Returns(metadataUnknownTopic) if err := client.RefreshMetadata("new_topic"); err != ErrUnknownTopicOrPartition { t.Error("ErrUnknownTopicOrPartition expected, got", err) } safeClose(t, client) seedBroker.Close() actualRetryCount := atomic.LoadInt32(&retryCount) if actualRetryCount != 1 { t.Fatalf("Expected BackoffFunc to be called exactly once, but saw %d", actualRetryCount) } }
explode_data.jsonl/54403
{ "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, 2959, 693, 46344, 13790, 26406, 2354, 3707, 1847, 9626, 1155, 353, 8840, 836, 8, 341, 197, 22602, 65545, 1669, 1532, 11571, 65545, 1155, 11, 220, 16, 692, 2109, 7603, 2582, 16, 1669, 501, 3189, 7603, 2582, 340, 197, 22602, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestFrontendRouter_RedirectToEntryPage__should_redirect_to_login_when_auth_token_is_unavailable(t *testing.T) { setup := setupTest(t, nil) defer setup.ctrl.Finish() setup.testCtx.Request = httptest.NewRequest(http.MethodGet, "/test", nil) setup.router.RedirectToEntryPage(setup.testCtx) assert.Equal(t, http.StatusPermanentRedirect, setup.w.Code) assert.Equal(t, "/login", setup.w.HeaderMap["Location"][0]) }
explode_data.jsonl/32974
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 156 }
[ 2830, 3393, 23395, 408, 9523, 92940, 1226, 1249, 5874, 2665, 563, 5445, 30043, 2346, 13681, 47636, 14014, 6458, 6892, 4907, 10334, 1155, 353, 8840, 836, 8, 341, 84571, 1669, 6505, 2271, 1155, 11, 2092, 340, 16867, 6505, 57078, 991, 18176,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestNestedGroups(t *testing.T) { handlerPrintCounter := func(w http.ResponseWriter, r *http.Request) { counter, _ := r.Context().Value(ctxKey{"counter"}).(int) w.Write([]byte(fmt.Sprintf("%v", counter))) } mwIncreaseCounter := func(next http.Handler) http.Handler { return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { ctx := r.Context() counter, _ := ctx.Value(ctxKey{"counter"}).(int) counter++ ctx = context.WithValue(ctx, ctxKey{"counter"}, counter) next.ServeHTTP(w, r.WithContext(ctx)) }) } // Each route represents value of its counter (number of applied middlewares). r := NewRouter() // counter == 0 r.Get("/0", handlerPrintCounter) r.Group(func(r Router) { r.Use(mwIncreaseCounter) // counter == 1 r.Get("/1", handlerPrintCounter) // r.Handle(GET, "/2", Chain(mwIncreaseCounter).HandlerFunc(handlerPrintCounter)) r.With(mwIncreaseCounter).Get("/2", handlerPrintCounter) r.Group(func(r Router) { r.Use(mwIncreaseCounter, mwIncreaseCounter) // counter == 3 r.Get("/3", handlerPrintCounter) }) r.Route("/", func(r Router) { r.Use(mwIncreaseCounter, mwIncreaseCounter) // counter == 3 // r.Handle(GET, "/4", Chain(mwIncreaseCounter).HandlerFunc(handlerPrintCounter)) r.With(mwIncreaseCounter).Get("/4", handlerPrintCounter) r.Group(func(r Router) { r.Use(mwIncreaseCounter, mwIncreaseCounter) // counter == 5 r.Get("/5", handlerPrintCounter) // r.Handle(GET, "/6", Chain(mwIncreaseCounter).HandlerFunc(handlerPrintCounter)) r.With(mwIncreaseCounter).Get("/6", handlerPrintCounter) }) }) }) ts := httptest.NewServer(r) defer ts.Close() for _, route := range []string{"0", "1", "2", "3", "4", "5", "6"} { if _, body := testRequest(t, ts, "GET", "/"+route, nil); body != route { t.Errorf("expected %v, got %v", route, body) } } }
explode_data.jsonl/42880
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 715 }
[ 2830, 3393, 71986, 22173, 1155, 353, 8840, 836, 8, 341, 53326, 8994, 14099, 1669, 2915, 3622, 1758, 37508, 11, 435, 353, 1254, 9659, 8, 341, 197, 58261, 11, 716, 1669, 435, 9328, 1005, 1130, 7502, 1592, 4913, 8292, 9207, 68615, 396, 3...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestNamespaceSnapshotAllShardsSuccess(t *testing.T) { shardMethodResults := []snapshotTestCase{ { isSnapshotting: false, expectSnapshot: true, shardBootstrapStateBeforeTick: Bootstrapped, shardSnapshotErr: nil, isBootstrapped: true, }, { isSnapshotting: false, expectSnapshot: true, shardBootstrapStateBeforeTick: Bootstrapped, shardSnapshotErr: nil, isBootstrapped: true, }, } require.NoError(t, testSnapshotWithShardSnapshotErrs(t, shardMethodResults)) }
explode_data.jsonl/35360
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 321 }
[ 2830, 3393, 22699, 15009, 2403, 2016, 2347, 7188, 1155, 353, 8840, 836, 8, 341, 36196, 567, 3523, 9801, 1669, 3056, 35501, 16458, 515, 197, 197, 515, 298, 19907, 15009, 1280, 25, 394, 895, 345, 298, 24952, 15009, 25, 394, 830, 345, 29...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestReporter(t *testing.T) { var ( release = "release" version = "version" network = "192.168.0.0/16" hostID = "hostid" hostname = "hostname" timestamp = time.Now() metrics = report.Metrics{ host.Load1: report.MakeSingletonMetric(timestamp, 1.0), host.CPUUsage: report.MakeSingletonMetric(timestamp, 30.0).WithMax(100.0), host.MemoryUsage: report.MakeSingletonMetric(timestamp, 60.0).WithMax(100.0), } uptime = "278h55m43s" kernel = "release version" _, ipnet, _ = net.ParseCIDR(network) ) mtime.NowForce(timestamp) defer mtime.NowReset() var ( oldGetKernelReleaseAndVersion = host.GetKernelReleaseAndVersion oldGetLoad = host.GetLoad oldGetUptime = host.GetUptime oldGetCPUUsagePercent = host.GetCPUUsagePercent oldGetMemoryUsageBytes = host.GetMemoryUsageBytes oldGetLocalNetworks = host.GetLocalNetworks ) defer func() { host.GetKernelReleaseAndVersion = oldGetKernelReleaseAndVersion host.GetLoad = oldGetLoad host.GetUptime = oldGetUptime host.GetCPUUsagePercent = oldGetCPUUsagePercent host.GetMemoryUsageBytes = oldGetMemoryUsageBytes host.GetLocalNetworks = oldGetLocalNetworks }() host.GetKernelReleaseAndVersion = func() (string, string, error) { return release, version, nil } host.GetLoad = func(time.Time) report.Metrics { return metrics } host.GetUptime = func() (time.Duration, error) { return time.ParseDuration(uptime) } host.GetCPUUsagePercent = func() (float64, float64) { return 30.0, 100.0 } host.GetMemoryUsageBytes = func() (float64, float64) { return 60.0, 100.0 } host.GetLocalNetworks = func() ([]*net.IPNet, error) { return []*net.IPNet{ipnet}, nil } hr := controls.NewDefaultHandlerRegistry() rpt, err := host.NewReporter(hostID, hostname, "", "", nil, hr).Report() if err != nil { t.Fatal(err) } nodeID := report.MakeHostNodeID(hostID) node, ok := rpt.Host.Nodes[nodeID] if !ok { t.Errorf("Expected host node %q, but not found", nodeID) } // Should have a bunch of expected latest keys for _, tuple := range []struct { key, want string }{ {host.Timestamp, timestamp.UTC().Format(time.RFC3339Nano)}, {host.HostName, hostname}, {host.OS, runtime.GOOS}, {host.Uptime, uptime}, {host.KernelVersion, kernel}, } { if have, ok := node.Latest.Lookup(tuple.key); !ok || have != tuple.want { t.Errorf("Expected %s %q, got %q", tuple.key, tuple.want, have) } } // Should have the local network if have, ok := node.Sets.Lookup(host.LocalNetworks); !ok || !have.Contains(network) { t.Errorf("Expected host.LocalNetworks to include %q, got %q", network, have) } // Should have metrics for key, want := range metrics { wantSample, _ := want.LastSample() if metric, ok := node.Metrics[key]; !ok { t.Errorf("Expected %s metric, but not found", key) } else if sample, ok := metric.LastSample(); !ok { t.Errorf("Expected %s metric to have a sample, but there were none", key) } else if sample.Value != wantSample.Value { t.Errorf("Expected %s metric sample %f, got %f", key, wantSample.Value, sample.Value) } } }
explode_data.jsonl/41261
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1248 }
[ 2830, 3393, 52766, 1155, 353, 8840, 836, 8, 341, 2405, 2399, 197, 17200, 1623, 256, 284, 330, 22998, 698, 197, 74954, 256, 284, 330, 4366, 698, 197, 9038, 2349, 256, 284, 330, 16, 24, 17, 13, 16, 21, 23, 13, 15, 13, 15, 14, 16, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestChannelReconfigureChannel(t *testing.T) { t.Parallel() // Scenario: We test the following things: // Updating a channel with an outdated JoinChannel message doesn't work // Removing an organization from a channel is indeed reflected in that // the GossipChannel doesn't consider peers from that organization as // peers in the channel, and refuses to have any channel-related contact // with peers of that channel cs := &cryptoService{} adapter := new(gossipAdapterMock) configureAdapter(adapter, discovery.NetworkMember{PKIid: pkiIDInOrg1}) adapter.On("GetConf").Return(conf) adapter.On("GetMembership").Return([]discovery.NetworkMember{}) adapter.On("OrgByPeerIdentity", api.PeerIdentityType(orgInChannelA)).Return(orgInChannelA) adapter.On("OrgByPeerIdentity", api.PeerIdentityType(orgNotInChannelA)).Return(orgNotInChannelA) adapter.On("GetOrgOfPeer", pkiIDInOrg1).Return(orgInChannelA) adapter.On("GetOrgOfPeer", pkiIDinOrg2).Return(orgNotInChannelA) outdatedJoinChanMsg := &joinChanMsg{ getTS: func() time.Time { return time.Now() }, members2AnchorPeers: map[string][]api.AnchorPeer{ string(orgNotInChannelA): {}, }, } newJoinChanMsg := &joinChanMsg{ getTS: func() time.Time { return time.Now().Add(time.Millisecond * 100) }, members2AnchorPeers: map[string][]api.AnchorPeer{ string(orgInChannelA): {}, }, } updatedJoinChanMsg := &joinChanMsg{ getTS: func() time.Time { return time.Now().Add(time.Millisecond * 200) }, members2AnchorPeers: map[string][]api.AnchorPeer{ string(orgNotInChannelA): {}, }, } gc := NewGossipChannel(pkiIDInOrg1, orgInChannelA, cs, channelA, adapter, api.JoinChannelMessage(newJoinChanMsg), disabledMetrics) // Just call it again, to make sure stuff don't crash gc.ConfigureChannel(api.JoinChannelMessage(newJoinChanMsg)) adapter.On("Gossip", mock.Anything) adapter.On("Forward", mock.Anything) adapter.On("Send", mock.Anything, mock.Anything) adapter.On("DeMultiplex", mock.Anything) assert.True(t, gc.IsOrgInChannel(orgInChannelA)) assert.False(t, gc.IsOrgInChannel(orgNotInChannelA)) assert.True(t, gc.IsMemberInChan(discovery.NetworkMember{PKIid: pkiIDInOrg1})) assert.False(t, gc.IsMemberInChan(discovery.NetworkMember{PKIid: pkiIDinOrg2})) gc.ConfigureChannel(outdatedJoinChanMsg) assert.True(t, gc.IsOrgInChannel(orgInChannelA)) assert.False(t, gc.IsOrgInChannel(orgNotInChannelA)) assert.True(t, gc.IsMemberInChan(discovery.NetworkMember{PKIid: pkiIDInOrg1})) assert.False(t, gc.IsMemberInChan(discovery.NetworkMember{PKIid: pkiIDinOrg2})) gc.ConfigureChannel(updatedJoinChanMsg) gc.ConfigureChannel(updatedJoinChanMsg) assert.False(t, gc.IsOrgInChannel(orgInChannelA)) assert.True(t, gc.IsOrgInChannel(orgNotInChannelA)) assert.False(t, gc.IsMemberInChan(discovery.NetworkMember{PKIid: pkiIDInOrg1})) assert.True(t, gc.IsMemberInChan(discovery.NetworkMember{PKIid: pkiIDinOrg2})) // Ensure we don't respond to a StateInfoRequest from a peer in the wrong org sMsg, _ := gc.(*gossipChannel).createStateInfoRequest() invalidReceivedMsg := &receivedMsg{ msg: sMsg, PKIID: pkiIDInOrg1, } gossipMessagesSentFromChannel := make(chan *proto.GossipMessage, 1) messageRelayer := func(arg mock.Arguments) { msg := arg.Get(0).(*proto.GossipMessage) gossipMessagesSentFromChannel <- msg } invalidReceivedMsg.On("Respond", mock.Anything).Run(messageRelayer) gc.HandleMessage(invalidReceivedMsg) select { case <-gossipMessagesSentFromChannel: t.Fatal("Responded with digest, but shouldn't have since peer is in ORG2 and its not in the channel") case <-time.After(time.Second * 1): } }
explode_data.jsonl/66328
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1345 }
[ 2830, 3393, 9629, 693, 21002, 9629, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 2822, 197, 322, 58663, 25, 1205, 1273, 279, 2701, 2513, 510, 197, 322, 78118, 264, 5496, 448, 458, 40526, 16471, 9629, 1943, 3171, 944, 975, 198, 197...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestLoadTestPostsCommands(t *testing.T) { th := Setup(t).InitBasic() defer th.TearDown() Client := th.Client channel := th.BasicChannel enableTesting := *th.App.Config().ServiceSettings.EnableTesting defer func() { th.App.UpdateConfig(func(cfg *model.Config) { *cfg.ServiceSettings.EnableTesting = enableTesting }) }() th.App.UpdateConfig(func(cfg *model.Config) { *cfg.ServiceSettings.EnableTesting = true }) rs := Client.Must(Client.ExecuteCommand(channel.Id, "/test posts fuzz 2 3 2")).(*model.CommandResponse) require.Equal(t, "Added posts", rs.Text, rs.Text) time.Sleep(2 * time.Second) }
explode_data.jsonl/26341
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 207 }
[ 2830, 3393, 5879, 2271, 19631, 30479, 1155, 353, 8840, 836, 8, 341, 70479, 1669, 18626, 1155, 568, 3803, 15944, 741, 16867, 270, 836, 682, 4454, 2822, 71724, 1669, 270, 11716, 198, 71550, 1669, 270, 48868, 9629, 271, 197, 12552, 16451, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestEncodeDecodePunycode(t *testing.T) { for _, tst := range testcases { enc := encode([]byte(tst[0])) if string(enc) != tst[1] { t.Errorf("%s encodeded as %s but should be %s", tst[0], enc, tst[1]) } dec := decode([]byte(tst[1])) if string(dec) != strings.ToLower(tst[0]) { t.Errorf("%s decoded as %s but should be %s", tst[1], dec, strings.ToLower(tst[0])) } } }
explode_data.jsonl/74308
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 184 }
[ 2830, 3393, 32535, 32564, 47, 359, 88, 1851, 1155, 353, 8840, 836, 8, 341, 2023, 8358, 71707, 1669, 2088, 1273, 23910, 341, 197, 197, 954, 1669, 16164, 10556, 3782, 1155, 267, 58, 15, 10907, 197, 743, 914, 66941, 8, 961, 71707, 58, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestTool_ShowAction(t *testing.T) { e, cleanup := fakes.NewTestEnv(t) defer cleanup() cmd := &command.Command{ Args: []string{"tool"}, ExecRoot: e.ExecRoot, InputSpec: &command.InputSpec{ Inputs: []string{ "a/b/input.txt", }, }, OutputFiles: []string{"a/b/out"}, } opt := command.DefaultExecutionOptions() _, acDg := e.Set(cmd, opt, &command.Result{Status: command.CacheHitResultStatus}, &fakes.OutputFile{Path: "a/b/out", Contents: "output"}, fakes.StdOut("stdout"), fakes.StdErr("stderr"), &fakes.InputFile{Path: "a/b/input.txt", Contents: "input"}) toolClient := &Client{GrpcClient: e.Client.GrpcClient} got, err := toolClient.ShowAction(context.Background(), acDg.String()) if err != nil { t.Fatalf("ShowAction(%v) failed: %v", acDg.String(), err) } want := `Command ======= Command Digest: 76a608e419da9ed3673f59b8b903f21dbf7cc3178281029151a090cac02d9e4d/15 tool Platform ======== Inputs ====== [Root directory digest: e23e10be0d14b5b2b1b7af32de78dea554a74df5bb22b31ae6c49583c1a8aa0e/75] a/b/input.txt: [File digest: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855/0] ------------------------------------------------------------------------ Action Result Exit code: 0 stdout digest: 63d42d26156fcc761e57da4128e9881d5bdf3bf933f0f6e9c93d6e26b9b90ae7/6 stderr digest: 7e6b710b765404cccbad9eedcff7615fc37b269d6db12cd81a58be541d93083c/6 Output Files ============ a/b/out, digest: e0ee8bb50685e05fa0f47ed04203ae953fdfd055f5bd2892ea186504254f8c3a/6 Output Files From Directories ============================= ` if diff := cmp.Diff(want, got); diff != "" { t.Fatalf("ShowAction(%v) returned diff (-want +got): %v\n\ngot: %v\n\nwant: %v\n", acDg.String(), diff, got, want) } }
explode_data.jsonl/8277
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 750 }
[ 2830, 3393, 7740, 79665, 2512, 1155, 353, 8840, 836, 8, 341, 7727, 11, 21290, 1669, 282, 2050, 7121, 2271, 14359, 1155, 340, 16867, 21290, 741, 25920, 1669, 609, 5631, 12714, 515, 197, 197, 4117, 25, 257, 3056, 917, 4913, 14172, 7115, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestDownloadIntoNonexistentBucket(t *testing.T) { var ( baseParams = tutils.BaseAPIParams() objName = "object" obj = "storage.googleapis.com/nvdata-openimages/openimages-train-000001.tar" ) bucket, err := tutils.GenerateNonexistentBucketName("download", baseParams) tassert.CheckFatal(t, err) bck := cmn.Bck{ Name: bucket, Provider: cmn.ProviderAIS, } _, err = api.DownloadSingle(baseParams, generateDownloadDesc(), bck, objName, obj) tassert.CheckError(t, err) api.DestroyBucket(baseParams, bck) }
explode_data.jsonl/70388
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 221 }
[ 2830, 3393, 11377, 26591, 8121, 64085, 36018, 1155, 353, 8840, 836, 8, 341, 2405, 2399, 197, 24195, 4870, 284, 259, 6031, 13018, 7082, 4870, 741, 197, 22671, 675, 262, 284, 330, 1700, 698, 197, 22671, 286, 284, 330, 16172, 19758, 905, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestIPv4Addresses(t *testing.T) { if !unprivileged() { t.Skip("skipping test in privileged mode.") } c, err := NewContainer(ContainerName) if err != nil { t.Errorf(err.Error()) } if _, err := c.IPv4Addresses(); err != nil { t.Errorf(err.Error()) } }
explode_data.jsonl/2806
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 111 }
[ 2830, 3393, 58056, 19, 52290, 1155, 353, 8840, 836, 8, 341, 743, 753, 359, 97288, 368, 341, 197, 3244, 57776, 445, 4886, 5654, 1273, 304, 46261, 3856, 13053, 197, 630, 1444, 11, 1848, 1669, 1532, 4502, 75145, 675, 340, 743, 1848, 961,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestAccAWSDBInstance_enhancedMonitoring(t *testing.T) { var dbInstance rds.DBInstance rName := acctest.RandString(5) resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, CheckDestroy: testAccCheckAWSDBInstanceNoSnapshot, Steps: []resource.TestStep{ { Config: testAccSnapshotInstanceConfig_enhancedMonitoring(rName), Check: resource.ComposeTestCheckFunc( testAccCheckAWSDBInstanceExists("aws_db_instance.enhanced_monitoring", &dbInstance), resource.TestCheckResourceAttr( "aws_db_instance.enhanced_monitoring", "monitoring_interval", "5"), ), }, }, }) }
explode_data.jsonl/33925
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 260 }
[ 2830, 3393, 14603, 36136, 3506, 2523, 6205, 71, 4874, 98062, 1155, 353, 8840, 836, 8, 341, 2405, 2927, 2523, 435, 5356, 22537, 2523, 198, 7000, 675, 1669, 1613, 67880, 2013, 437, 703, 7, 20, 692, 50346, 8787, 1155, 11, 5101, 31363, 51...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestMergeWithPrecedence(t *testing.T) { cases := []struct { name string first *meshconfig.ProxyConfig second *meshconfig.ProxyConfig expected *meshconfig.ProxyConfig }{ { name: "concurrency", first: &meshconfig.ProxyConfig{ Concurrency: v(1), }, second: &meshconfig.ProxyConfig{ Concurrency: v(2), }, expected: &meshconfig.ProxyConfig{ Concurrency: v(1), }, }, { name: "concurrency value 0", first: &meshconfig.ProxyConfig{ Concurrency: v(0), }, second: &meshconfig.ProxyConfig{ Concurrency: v(2), }, expected: &meshconfig.ProxyConfig{ Concurrency: v(0), }, }, { name: "source concurrency nil", first: &meshconfig.ProxyConfig{ Concurrency: nil, }, second: &meshconfig.ProxyConfig{ Concurrency: v(2), }, expected: &meshconfig.ProxyConfig{ Concurrency: v(2), }, }, { name: "dest concurrency nil", first: &meshconfig.ProxyConfig{ Concurrency: v(2), }, second: &meshconfig.ProxyConfig{ Concurrency: nil, }, expected: &meshconfig.ProxyConfig{ Concurrency: v(2), }, }, { name: "both concurrency nil", first: &meshconfig.ProxyConfig{ Concurrency: nil, }, second: &meshconfig.ProxyConfig{ Concurrency: nil, }, expected: &meshconfig.ProxyConfig{ Concurrency: nil, }, }, { name: "envvars", first: &meshconfig.ProxyConfig{ ProxyMetadata: map[string]string{ "a": "x", "b": "y", }, }, second: &meshconfig.ProxyConfig{ ProxyMetadata: map[string]string{ "a": "z", "b": "y", "c": "d", }, }, expected: &meshconfig.ProxyConfig{ ProxyMetadata: map[string]string{ "a": "x", "b": "y", "c": "d", }, }, }, { name: "empty envars merge with populated", first: &meshconfig.ProxyConfig{ ProxyMetadata: map[string]string{}, }, second: &meshconfig.ProxyConfig{ ProxyMetadata: map[string]string{ "a": "z", "b": "y", "c": "d", }, }, expected: &meshconfig.ProxyConfig{ ProxyMetadata: map[string]string{ "a": "z", "b": "y", "c": "d", }, }, }, { name: "nil proxyconfig", first: nil, second: &meshconfig.ProxyConfig{ ProxyMetadata: map[string]string{ "a": "z", "b": "y", "c": "d", }, }, expected: &meshconfig.ProxyConfig{ ProxyMetadata: map[string]string{ "a": "z", "b": "y", "c": "d", }, }, }, } for _, tc := range cases { merged := mergeWithPrecedence(tc.first, tc.second) if diff := cmp.Diff(merged, tc.expected); diff != "" { t.Fatalf("expected and received not the same: %s", diff) } } }
explode_data.jsonl/52374
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1335 }
[ 2830, 3393, 52096, 2354, 4703, 1998, 763, 1155, 353, 8840, 836, 8, 341, 1444, 2264, 1669, 3056, 1235, 341, 197, 11609, 257, 914, 198, 197, 42190, 262, 353, 23506, 1676, 75200, 2648, 198, 197, 197, 5569, 256, 353, 23506, 1676, 75200, 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...
3
func TestNewConsulDiscovery(t *testing.T) { d := NewConsulDiscovery(config.TestLogger(), config.DefaultDiscovery()) assert.NotNil(t, d.log, "Logger") assert.NotNil(t, d.client, "Consul client") }
explode_data.jsonl/69055
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 76 }
[ 2830, 3393, 3564, 15220, 360, 67400, 1155, 353, 8840, 836, 8, 341, 2698, 1669, 1532, 15220, 360, 67400, 8754, 8787, 7395, 1507, 2193, 13275, 67400, 2398, 6948, 93882, 1155, 11, 294, 1665, 11, 330, 7395, 1138, 6948, 93882, 1155, 11, 294,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestMetric_HistogramDataPoints(t *testing.T) { ms := NewMetric() ms.InitEmpty() assert.EqualValues(t, NewHistogramDataPointSlice(), ms.HistogramDataPoints()) fillTestHistogramDataPointSlice(ms.HistogramDataPoints()) testValHistogramDataPoints := generateTestHistogramDataPointSlice() assert.EqualValues(t, testValHistogramDataPoints, ms.HistogramDataPoints()) }
explode_data.jsonl/19514
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 119 }
[ 2830, 3393, 54310, 2039, 28499, 1043, 11411, 1155, 353, 8840, 836, 8, 341, 47691, 1669, 1532, 54310, 741, 47691, 26849, 3522, 741, 6948, 12808, 6227, 1155, 11, 1532, 77210, 1043, 2609, 33236, 1507, 9829, 3839, 28499, 1043, 11411, 2398, 65...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestSetExpr(t *testing.T) { assert.NoError(t, prepareEngine()) type User struct { Id int64 Show bool } assert.NoError(t, testEngine.Sync2(new(User))) cnt, err := testEngine.Insert(&User{ Show: true, }) assert.NoError(t, err) assert.EqualValues(t, 1, cnt) var not = "NOT" if testEngine.dialect.DBType() == core.MSSQL { not = "~" } cnt, err = testEngine.SetExpr("show", not+" `show`").Id(1).Update(new(User)) assert.NoError(t, err) assert.EqualValues(t, 1, cnt) }
explode_data.jsonl/9275
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 215 }
[ 2830, 3393, 1649, 16041, 1155, 353, 8840, 836, 8, 341, 6948, 35699, 1155, 11, 10549, 4571, 12367, 13158, 2657, 2036, 341, 197, 67211, 256, 526, 21, 19, 198, 197, 197, 7812, 1807, 198, 197, 630, 6948, 35699, 1155, 11, 1273, 4571, 92183...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestVectorBase(t *testing.T) { v := New(WithCapacity(10)) assert.True(t, v.Empty()) assert.Equal(t, 10, v.Capacity()) v.PushBack(1) v.PushBack(2) assert.False(t, v.Empty()) assert.Equal(t, 2, v.Size()) assert.Equal(t, 1, v.Front()) assert.Equal(t, 2, v.Back()) }
explode_data.jsonl/33850
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 129 }
[ 2830, 3393, 3781, 3978, 1155, 353, 8840, 836, 8, 341, 5195, 1669, 1532, 7, 2354, 29392, 7, 16, 15, 1171, 6948, 32443, 1155, 11, 348, 11180, 2398, 6948, 12808, 1155, 11, 220, 16, 15, 11, 348, 78963, 4018, 2398, 5195, 34981, 3707, 7, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestNonExistentImageStream(t *testing.T) { // this buildconfig references a non-existent image stream, so an update to the real image stream should not // trigger a build here. buildcfg := mockBuildConfig("registry.com/namespace/imagename", "registry.com/namespace/imagename", "testImageStream", "testTag") imageStream := mockImageStream("otherImageRepo", "registry.com/namespace/imagename", map[string]string{"testTag": "newImageID123"}) image := mockImage("testImage@id", "registry.com/namespace/imagename@id") controller := mockImageChangeController(buildcfg, imageStream, image) bcInstantiator := controller.BuildConfigInstantiator.(*buildConfigInstantiator) bcUpdater := bcInstantiator.buildConfigUpdater err := controller.HandleImageRepo(imageStream) if err != nil { t.Fatalf("Unexpected error %v from HandleImageRepo", err) } if len(bcInstantiator.name) != 0 { t.Error("New build generated when a different repository was updated!") } if bcUpdater.buildcfg != nil { t.Error("BuildConfig was updated when a different repository was updated!") } }
explode_data.jsonl/69170
{ "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, 8121, 840, 18128, 1906, 3027, 1155, 353, 8840, 836, 8, 341, 197, 322, 419, 1936, 1676, 15057, 264, 2477, 59828, 2168, 4269, 11, 773, 458, 2647, 311, 279, 1931, 2168, 4269, 1265, 537, 198, 197, 322, 8183, 264, 1936, 1588, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestIssueFind(t *testing.T) { defer gock.Off() gock.New("https://try.gogs.io"). Get("/api/v1/repos/gogits/gogs/issues/1"). Reply(200). Type("application/json"). File("testdata/issue.json") client, _ := New("https://try.gogs.io") got, _, err := client.Issues.Find(context.Background(), "gogits/gogs", 1) if err != nil { t.Error(err) } want := new(scm.Issue) raw, _ := ioutil.ReadFile("testdata/issue.json.golden") json.Unmarshal(raw, &want) if diff := cmp.Diff(got, want); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } }
explode_data.jsonl/77747
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 247 }
[ 2830, 3393, 42006, 9885, 1155, 353, 8840, 836, 8, 341, 16867, 728, 377, 13, 4596, 2822, 3174, 1176, 7121, 445, 2428, 1110, 1539, 1302, 26307, 4245, 38609, 197, 37654, 4283, 2068, 5457, 16, 49505, 4846, 538, 1199, 4846, 26307, 38745, 14,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestAPIRequestParameters_WithSorting_SetsSorting(t *testing.T) { s := APIRequestSorting{ Property: "testproperty1", } params := APIRequestParameters{} params.WithSorting(s) assert.Equal(t, s, params.Sorting) }
explode_data.jsonl/44622
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 81 }
[ 2830, 3393, 7082, 1900, 9706, 62, 2354, 71681, 1098, 1415, 71681, 1155, 353, 8840, 836, 8, 341, 1903, 1669, 5333, 1900, 71681, 515, 197, 197, 3052, 25, 330, 1944, 3699, 16, 756, 197, 532, 25856, 1669, 5333, 1900, 9706, 31483, 25856, 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
func TestGetClusterPlansFromServiceName(t *testing.T) { planExternalMetaDataRaw, err := fakePlanExternalMetaDataRaw() if err != nil { fmt.Printf("error occured %v during marshalling", err) return } planServiceInstanceCreateParameterSchemasRaw, err := fakePlanServiceInstanceCreateParameterSchemasRaw() if err != nil { fmt.Printf("error occured %v during marshalling", err) return } type args struct { serviceClassName string } tests := []struct { name string args args want []scv1beta1.ClusterServicePlan wantErr bool }{ { name: "test case 1 : plans found for the service class", args: args{serviceClassName: "1dda1477cace09730bd8ed7a6505607e"}, wantErr: false, want: []scv1beta1.ClusterServicePlan{ { ObjectMeta: metav1.ObjectMeta{ Name: "67042296c7c95e84142f21f58da2ebfe", }, Spec: scv1beta1.ClusterServicePlanSpec{ ClusterServiceClassRef: scv1beta1.ClusterObjectReference{ Name: "1dda1477cace09730bd8ed7a6505607e", }, CommonServicePlanSpec: scv1beta1.CommonServicePlanSpec{ ExternalName: "dev", Description: "this is a example description 1", ExternalMetadata: &runtime.RawExtension{Raw: planExternalMetaDataRaw[0]}, ServiceInstanceCreateParameterSchema: &runtime.RawExtension{Raw: planServiceInstanceCreateParameterSchemasRaw[0]}, }, }, }, { ObjectMeta: metav1.ObjectMeta{ Name: "7f88be6129622f72554c20af879a8ce0", }, Spec: scv1beta1.ClusterServicePlanSpec{ ClusterServiceClassRef: scv1beta1.ClusterObjectReference{ Name: "1dda1477cace09730bd8ed7a6505607e", }, CommonServicePlanSpec: scv1beta1.CommonServicePlanSpec{ ExternalName: "prod", Description: "this is a example description 2", ExternalMetadata: &runtime.RawExtension{Raw: planExternalMetaDataRaw[1]}, ServiceInstanceCreateParameterSchema: &runtime.RawExtension{Raw: planServiceInstanceCreateParameterSchemasRaw[1]}, }, }, }, }, }, { name: "test case 2 : no plans found for the service class", args: args{serviceClassName: "1dda1477cace09730bd8"}, wantErr: false, want: []scv1beta1.ClusterServicePlan{}, }, } planList := scv1beta1.ClusterServicePlanList{ Items: []scv1beta1.ClusterServicePlan{ { ObjectMeta: metav1.ObjectMeta{ Name: "67042296c7c95e84142f21f58da2ebfe", }, Spec: scv1beta1.ClusterServicePlanSpec{ ClusterServiceClassRef: scv1beta1.ClusterObjectReference{ Name: "1dda1477cace09730bd8ed7a6505607e", }, CommonServicePlanSpec: scv1beta1.CommonServicePlanSpec{ ExternalName: "dev", Description: "this is a example description 1", ExternalMetadata: &runtime.RawExtension{Raw: planExternalMetaDataRaw[0]}, ServiceInstanceCreateParameterSchema: &runtime.RawExtension{Raw: planServiceInstanceCreateParameterSchemasRaw[0]}, }, }, }, { ObjectMeta: metav1.ObjectMeta{ Name: "7f88be6129622f72554c20af879a8ce0", }, Spec: scv1beta1.ClusterServicePlanSpec{ ClusterServiceClassRef: scv1beta1.ClusterObjectReference{ Name: "1dda1477cace09730bd8ed7a6505607e", }, CommonServicePlanSpec: scv1beta1.CommonServicePlanSpec{ ExternalName: "prod", Description: "this is a example description 2", ExternalMetadata: &runtime.RawExtension{Raw: planExternalMetaDataRaw[1]}, ServiceInstanceCreateParameterSchema: &runtime.RawExtension{Raw: planServiceInstanceCreateParameterSchemasRaw[1]}, }, }, }, }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { client, fakeClientSet := FakeNew() fakeClientSet.ServiceCatalogClientSet.PrependReactor("list", "clusterserviceplans", func(action ktesting.Action) (bool, runtime.Object, error) { var pList []scv1beta1.ClusterServicePlan for _, plan := range planList.Items { if plan.Spec.ClusterServiceClassRef.Name == strings.Split(action.(ktesting.ListAction).GetListRestrictions().Fields.String(), "=")[1] { pList = append(pList, plan) } } return true, &scv1beta1.ClusterServicePlanList{Items: pList}, nil }) gotPlans, err := client.GetClusterPlansFromServiceName(tt.args.serviceClassName) if err == nil && !tt.wantErr { if len(fakeClientSet.ServiceCatalogClientSet.Actions()) != 1 { t.Errorf("expected 2 actions in GetServiceClassAndPlans got: %v", fakeClientSet.ServiceCatalogClientSet.Actions()) } for _, wantedServicePlan := range tt.want { found := false for _, gotServicePlan := range gotPlans { if reflect.DeepEqual(wantedServicePlan.Spec.ExternalName, gotServicePlan.Spec.ExternalName) { found = true } else { continue } if !reflect.DeepEqual(wantedServicePlan.Name, gotServicePlan.Name) { t.Errorf("different plan name expected got: %v , expected: %v", wantedServicePlan.Name, gotServicePlan.Name) } if !reflect.DeepEqual(wantedServicePlan.Spec, gotServicePlan.Spec) { t.Errorf("different plan spec value expected got: %v , expected: %v", wantedServicePlan.Spec, gotServicePlan.Spec) } } if !found { t.Errorf("service plan %v not found", wantedServicePlan.Spec.ExternalName) } } } else if err == nil && tt.wantErr { t.Error("test failed, expected: false, got true") } else if err != nil && !tt.wantErr { t.Errorf("test failed, expected: no error, got error: %s", err.Error()) } }) } }
explode_data.jsonl/65170
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 2574 }
[ 2830, 3393, 1949, 28678, 97728, 3830, 1860, 675, 1155, 353, 8840, 836, 8, 341, 197, 10393, 25913, 37307, 20015, 11, 1848, 1669, 12418, 20485, 25913, 37307, 20015, 741, 743, 1848, 961, 2092, 341, 197, 11009, 19367, 445, 841, 34942, 1018, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestGetRemote(t *testing.T) { t.Parallel() // windows fails when lazy blob is being extracted with "invalid windows mount type: 'bind'" if runtime.GOOS != "linux" { t.Skipf("unsupported GOOS: %s", runtime.GOOS) } ctx := namespaces.WithNamespace(context.Background(), "buildkit-test") tmpdir, err := ioutil.TempDir("", "cachemanager") require.NoError(t, err) defer os.RemoveAll(tmpdir) snapshotter, err := native.NewSnapshotter(filepath.Join(tmpdir, "snapshots")) require.NoError(t, err) co, cleanup, err := newCacheManager(ctx, cmOpt{ snapshotter: snapshotter, snapshotterName: "native", }) require.NoError(t, err) defer cleanup() cm := co.manager ctx, done, err := leaseutil.WithLease(ctx, co.lm, leaseutil.MakeTemporary) require.NoError(t, err) defer done(context.TODO()) contentBuffer := contentutil.NewBuffer() descHandlers := DescHandlers(map[digest.Digest]*DescHandler{}) // make some lazy refs from blobs expectedContent := map[digest.Digest]struct{}{} variant := map[digest.Digest]digest.Digest{} esgz2gzip := map[digest.Digest]digest.Digest{} var descs []ocispecs.Descriptor for i := 0; i < 2; i++ { blobmap := map[string]string{"foo": strconv.Itoa(i)} blobBytes, desc, err := mapToBlob(blobmap, true) require.NoError(t, err) expectedContent[desc.Digest] = struct{}{} descs = append(descs, desc) cw, err := contentBuffer.Writer(ctx) require.NoError(t, err) _, err = cw.Write(blobBytes) require.NoError(t, err) err = cw.Commit(ctx, 0, cw.Digest()) require.NoError(t, err) descHandlers[desc.Digest] = &DescHandler{ Provider: func(_ session.Group) content.Provider { return contentBuffer }, } uncompressedBlobBytes, uncompressedDesc, err := mapToBlob(blobmap, false) require.NoError(t, err) expectedContent[uncompressedDesc.Digest] = struct{}{} esgzDgst, uncompressedEsgzDgst, err := esgzBlobDigest(uncompressedBlobBytes) require.NoError(t, err) expectedContent[esgzDgst] = struct{}{} variant[uncompressedEsgzDgst] = uncompressedDesc.Digest esgz2gzip[esgzDgst] = desc.Digest } // Create 3 levels of mutable refs, where each parent ref has 2 children (this tests parallel creation of // overlapping blob chains). lazyRef, err := cm.GetByBlob(ctx, descs[0], nil, descHandlers) require.NoError(t, err) refs := []ImmutableRef{lazyRef} for i := 0; i < 3; i++ { var newRefs []ImmutableRef for j, ir := range refs { for k := 0; k < 2; k++ { mutRef, err := cm.New(ctx, ir, nil, descHandlers) require.NoError(t, err) m, err := mutRef.Mount(ctx, false, nil) require.NoError(t, err) lm := snapshot.LocalMounter(m) target, err := lm.Mount() require.NoError(t, err) f, err := os.Create(filepath.Join(target, fmt.Sprintf("%d-%d-%d", i, j, k))) require.NoError(t, err) err = os.Chtimes(f.Name(), time.Unix(0, 0), time.Unix(0, 0)) require.NoError(t, err) _, desc, err := fileToBlob(f, true) require.NoError(t, err) expectedContent[desc.Digest] = struct{}{} uncompressedBlobBytes, uncompressedDesc, err := fileToBlob(f, false) require.NoError(t, err) expectedContent[uncompressedDesc.Digest] = struct{}{} esgzDgst, uncompressedEsgzDgst, err := esgzBlobDigest(uncompressedBlobBytes) require.NoError(t, err) expectedContent[esgzDgst] = struct{}{} variant[uncompressedEsgzDgst] = uncompressedDesc.Digest esgz2gzip[esgzDgst] = desc.Digest f.Close() err = lm.Unmount() require.NoError(t, err) immutRef, err := mutRef.Commit(ctx) require.NoError(t, err) newRefs = append(newRefs, immutRef) } } refs = newRefs } // also test the original lazyRef to get coverage for refs that don't have to be extracted from the snapshotter lazyRef2, err := cm.GetByBlob(ctx, descs[1], nil, descHandlers) require.NoError(t, err) refs = append(refs, lazyRef2) checkNumBlobs(ctx, t, co.cs, 1) // Call GetRemote on all the refs esgzRefs := map[digest.Digest]struct{}{} var esgzRefsMu sync.Mutex eg, egctx := errgroup.WithContext(ctx) for _, ir := range refs { ir := ir.(*immutableRef) for _, compressionType := range []compression.Type{compression.Uncompressed, compression.Gzip, compression.EStargz} { compressionType := compressionType eg.Go(func() error { remote, err := ir.GetRemote(egctx, true, compressionType, true, nil) require.NoError(t, err) refChain := ir.parentRefChain() for i, desc := range remote.Descriptors { switch compressionType { case compression.Uncompressed: require.Equal(t, ocispecs.MediaTypeImageLayer, desc.MediaType) case compression.Gzip: require.Equal(t, ocispecs.MediaTypeImageLayerGzip, desc.MediaType) case compression.EStargz: require.Equal(t, ocispecs.MediaTypeImageLayerGzip, desc.MediaType) default: require.Fail(t, "unhandled media type", compressionType) } dgst := desc.Digest if v, ok := variant[dgst]; ok { dgst = v } require.Contains(t, expectedContent, dgst) checkDescriptor(ctx, t, co.cs, desc, compressionType) r := refChain[i] if compressionType == compression.EStargz { if digest.Digest(r.getBlob()) == desc.Digest { esgzRefsMu.Lock() esgzRefs[desc.Digest] = struct{}{} esgzRefsMu.Unlock() } } isLazy, err := r.isLazy(egctx) require.NoError(t, err) needs, err := needsConversion(desc.MediaType, compressionType) require.NoError(t, err) if needs { require.False(t, isLazy, "layer %q requires conversion so it must be unlazied", desc.Digest) } bDesc, err := r.getCompressionBlob(egctx, compressionType) if isLazy { require.Error(t, err) } else { require.NoError(t, err) checkDescriptor(ctx, t, co.cs, bDesc, compressionType) require.Equal(t, desc.Digest, bDesc.Digest) } } return nil }) } } require.NoError(t, eg.Wait()) for dgst := range esgzRefs { gzipDgst, ok := esgz2gzip[dgst] require.True(t, ok, "match for gzip blob: %s", dgst) delete(expectedContent, gzipDgst) // esgz blob is reused also as gzip. duplicated gzip blob is unexpected. } // verify there's a 1-to-1 mapping between the content store and what we expected to be there err = co.cs.Walk(ctx, func(info content.Info) error { dgst := info.Digest if v, ok := variant[dgst]; ok { dgst = v } var matched bool for expected := range expectedContent { if dgst == expected { delete(expectedContent, expected) matched = true break } } require.True(t, matched, "match for blob: %s", info.Digest) checkInfo(ctx, t, co.cs, info) return nil }) require.NoError(t, err) require.Equal(t, map[digest.Digest]struct{}{}, expectedContent) }
explode_data.jsonl/3979
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 2835 }
[ 2830, 3393, 1949, 24703, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 741, 197, 322, 11030, 14525, 979, 15678, 23404, 374, 1660, 27432, 448, 330, 11808, 11030, 6470, 943, 25, 364, 7666, 41165, 743, 15592, 97574, 3126, 961, 330, 1421...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestValidateSensor(t *testing.T) { dir := "../../examples/sensors" files, err := ioutil.ReadDir(dir) assert.Nil(t, err) for _, file := range files { content, err := ioutil.ReadFile(fmt.Sprintf("%s/%s", dir, file.Name())) assert.Nil(t, err) var sensor *v1alpha1.Sensor err = yaml.Unmarshal(content, &sensor) assert.Nil(t, err) err = ValidateSensor(sensor) assert.Nil(t, err) } }
explode_data.jsonl/60534
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 180 }
[ 2830, 3393, 17926, 30752, 1155, 353, 8840, 836, 8, 341, 48532, 1669, 10208, 51668, 2687, 26529, 698, 74075, 11, 1848, 1669, 43144, 6503, 6184, 14161, 340, 6948, 59678, 1155, 11, 1848, 340, 2023, 8358, 1034, 1669, 2088, 3542, 341, 197, 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...
2
func TestAPISelector_Select(t *testing.T) { ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) { fmt.Fprint(w, testAPIServerString) })) defer ts.Close() u, _ := url.Parse(ts.URL) as := NewAPISelector(u) actual, _ := as.Select(context.TODO(), &Params{ Infra: "test", Language: "ruby", OsxImage: "meow", Dist: "yosamitty", Group: "dev", OS: "osx", }) assert.Equal(t, actual, "travis-ci-awesome") }
explode_data.jsonl/18678
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 221 }
[ 2830, 3393, 7082, 5877, 58073, 1155, 353, 8840, 836, 8, 341, 57441, 1669, 54320, 70334, 7121, 5475, 19886, 89164, 18552, 3622, 1758, 37508, 11, 4232, 353, 1254, 9659, 8, 341, 197, 11009, 991, 1350, 3622, 11, 1273, 2537, 1637, 2836, 703,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestApiVersion(t *testing.T) { for _, hey := range []struct { x Gvk exp string }{ {Gvk{}, ""}, {Gvk{Kind: "k"}, ""}, {Gvk{Version: "v"}, "v"}, {Gvk{Version: "v", Kind: "k"}, "v"}, {Gvk{Group: "g"}, "g/"}, {Gvk{Group: "g", Kind: "k"}, "g/"}, {Gvk{Group: "g", Version: "v"}, "g/v"}, {Gvk{Group: "g", Version: "v", Kind: "k"}, "g/v"}, } { assert.Equal(t, hey.exp, hey.x.ApiVersion()) } }
explode_data.jsonl/39016
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 225 }
[ 2830, 3393, 6563, 5637, 1155, 353, 8840, 836, 8, 341, 2023, 8358, 34209, 1669, 2088, 3056, 1235, 341, 197, 10225, 256, 479, 48363, 198, 197, 48558, 914, 198, 197, 59403, 197, 197, 90, 38, 48363, 22655, 77496, 197, 197, 90, 38, 48363, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestParseKeyword(t *testing.T) { foo := strings.Split("republic dominican cuba caribbean greenland el salvador too", " ") var args []string for _, s := range foo { args = append(args, []string{"--foo", s}...) } f := NewFixture(t, model.NewUserConfigState(args)) defer f.TearDown() f.File("Tiltfile", ` config.define_string_list('foo') cfg = config.parse() print(cfg['foo']) `) _, err := f.ExecFile("Tiltfile") require.NoError(t, err) require.Contains(t, f.PrintOutput(), value.StringSliceToList(foo).String()) }
explode_data.jsonl/65226
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 201 }
[ 2830, 3393, 14463, 34481, 1155, 353, 8840, 836, 8, 341, 197, 7975, 1669, 9069, 19823, 445, 265, 888, 11111, 7065, 18728, 64, 1803, 32059, 6176, 1933, 655, 27059, 5364, 2238, 497, 330, 14167, 2405, 2827, 3056, 917, 198, 2023, 8358, 274, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestCloudHypervisorCleanupVM(t *testing.T) { assert := assert.New(t) store, err := persist.GetDriver() assert.NoError(err, "persist.GetDriver() unexpected error") clh := &cloudHypervisor{ config: HypervisorConfig{ VMStorePath: store.RunVMStoragePath(), RunStorePath: store.RunStoragePath(), }, } err = clh.cleanupVM(true) assert.Error(err, "persist.GetDriver() expected error") clh.id = "cleanVMID" err = clh.cleanupVM(true) assert.NoError(err, "persist.GetDriver() unexpected error") dir := filepath.Join(store.RunVMStoragePath(), clh.id) os.MkdirAll(dir, os.ModePerm) err = clh.cleanupVM(false) assert.NoError(err, "persist.GetDriver() unexpected error") _, err = os.Stat(dir) assert.Error(err, "dir should not exist %s", dir) assert.True(os.IsNotExist(err), "persist.GetDriver() unexpected error") }
explode_data.jsonl/68499
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 314 }
[ 2830, 3393, 16055, 39, 1082, 31396, 67335, 11187, 1155, 353, 8840, 836, 8, 341, 6948, 1669, 2060, 7121, 1155, 340, 57279, 11, 1848, 1669, 22334, 2234, 11349, 741, 6948, 35699, 3964, 11, 330, 39826, 2234, 11349, 368, 16500, 1465, 5130, 3...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestCollectorVolumeMountsWithVolumes(t *testing.T) { name := "my-instance" globalVolumes := []corev1.Volume{ { Name: "globalVolume", VolumeSource: corev1.VolumeSource{}, }, } globalVolumeMounts := []corev1.VolumeMount{ { Name: "globalVolume", }, } collectorVolumes := []corev1.Volume{ { Name: "collectorVolume", VolumeSource: corev1.VolumeSource{}, }, } collectorVolumeMounts := []corev1.VolumeMount{ { Name: "collectorVolume", }, } jaeger := v1.NewJaeger(types.NamespacedName{Name: name}) jaeger.Spec.Volumes = globalVolumes jaeger.Spec.VolumeMounts = globalVolumeMounts jaeger.Spec.Collector.Volumes = collectorVolumes jaeger.Spec.Collector.VolumeMounts = collectorVolumeMounts podSpec := NewCollector(jaeger).Get().Spec.Template.Spec // Additional 1 is sampling configmap assert.Len(t, podSpec.Volumes, len(append(collectorVolumes, globalVolumes...))+1) assert.Len(t, podSpec.Containers[0].VolumeMounts, len(append(collectorVolumeMounts, globalVolumeMounts...))+1) // collector is first while global is second assert.Equal(t, "collectorVolume", podSpec.Volumes[0].Name) assert.Equal(t, "globalVolume", podSpec.Volumes[1].Name) assert.Equal(t, "collectorVolume", podSpec.Containers[0].VolumeMounts[0].Name) assert.Equal(t, "globalVolume", podSpec.Containers[0].VolumeMounts[1].Name) }
explode_data.jsonl/59524
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 524 }
[ 2830, 3393, 53694, 18902, 16284, 16056, 96325, 1155, 353, 8840, 836, 8, 341, 11609, 1669, 330, 2408, 73655, 1837, 18842, 96325, 1669, 3056, 98645, 16, 79106, 515, 197, 197, 515, 298, 21297, 25, 260, 330, 9752, 18902, 756, 298, 17446, 46...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestConnectToMongo(t *testing.T) { ctx, client, _, err := ConnectToMongo(mongoTestsHostURL, "", "") if err != nil { log.Fatal(err) } // Check the connection err = client.Ping(ctx, nil) if err != nil { log.Fatal(err) } }
explode_data.jsonl/71134
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 100 }
[ 2830, 3393, 14611, 1249, 54998, 1155, 353, 8840, 836, 8, 341, 20985, 11, 2943, 11, 8358, 1848, 1669, 13015, 1249, 54998, 1255, 6363, 18200, 9296, 3144, 11, 7342, 14676, 743, 1848, 961, 2092, 341, 197, 6725, 26133, 3964, 340, 197, 630, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestHostInfo_ConnectAddress(t *testing.T) { var localhost = net.IPv4(127, 0, 0, 1) tests := []struct { name string connectAddr net.IP rpcAddr net.IP broadcastAddr net.IP peer net.IP }{ {name: "rpc_address", rpcAddr: localhost}, {name: "connect_address", connectAddr: localhost}, {name: "broadcast_address", broadcastAddr: localhost}, {name: "peer", peer: localhost}, } for _, test := range tests { t.Run(test.name, func(t *testing.T) { host := &HostInfo{ connectAddress: test.connectAddr, rpcAddress: test.rpcAddr, broadcastAddress: test.broadcastAddr, peer: test.peer, } if addr := host.ConnectAddress(); !addr.Equal(localhost) { t.Fatalf("expected ConnectAddress to be %s got %s", localhost, addr) } }) } }
explode_data.jsonl/37536
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 369 }
[ 2830, 3393, 9296, 1731, 15100, 2321, 4286, 1155, 353, 8840, 836, 8, 341, 2405, 47422, 284, 4179, 46917, 85, 19, 7, 16, 17, 22, 11, 220, 15, 11, 220, 15, 11, 220, 16, 340, 78216, 1669, 3056, 1235, 341, 197, 11609, 688, 914, 198, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestDialerCancelDial(t *testing.T) { done := make(chan struct{}, 1) var ( l net.Listener err error setupWg sync.WaitGroup connsMadeWg sync.WaitGroup ) setupWg.Add(1) connsMadeWg.Add(5) go func() { // Continuously accept connections from myself l, err = net.Listen("tcp", "127.0.0.1:") if err != nil { t.Error(err) } setupWg.Done() for { _, err := l.Accept() if err != nil { // Distinguish between an error that occurred because // the test is over from actual errors select { case <-done: return default: t.Error(err) return } } connsMadeWg.Done() } }() // Wait until [l] has been populated to avoid race condition setupWg.Wait() port, _ := strconv.Atoi(strings.Split(l.Addr().String(), ":")[1]) myIP := utils.IPDesc{ IP: net.ParseIP("127.0.0.1"), Port: uint16(port), } // Create a dialer that should allow 10 outgoing connections per second dialer := NewDialer("tcp", NewDialerConfig(10, 30*time.Second), logging.NoLog{}) // Make 5 outgoing connections. Should not be throttled. for i := 0; i < 5; i++ { startTime := time.Now() _, err := dialer.Dial(context.Background(), myIP) assert.NoError(t, err) // Connecting to myself shouldn't take more than 50 ms if outgoing // connections aren't throttled assert.WithinDuration(t, startTime, time.Now(), 50*time.Millisecond) } // Make another outgoing connection but immediately cancel the context // (actually we cancel it before calling Dial but same difference) ctx, cancel := context.WithCancel(context.Background()) cancel() sixthDialDone := make(chan struct{}, 1) go func() { _, err := dialer.Dial(ctx, myIP) assert.Error(t, err) close(sixthDialDone) }() // First 5 connections should have succeeded but not the 6th, cancelled one connsMadeWg.Wait() // Don't exit test before we assert that the sixth Dial attempt errors <-sixthDialDone done <- struct{}{} // mark that test is done _ = l.Close() }
explode_data.jsonl/72397
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 770 }
[ 2830, 3393, 35, 530, 261, 9269, 35, 530, 1155, 353, 8840, 836, 8, 341, 40495, 1669, 1281, 35190, 2036, 22655, 220, 16, 692, 2405, 2399, 197, 8810, 1843, 4179, 64091, 198, 197, 9859, 260, 1465, 198, 197, 84571, 54, 70, 257, 12811, 28...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
5
func TestHybiShortRead(t *testing.T) { wireData := []byte{0x81, 0x05, 'h', 'e', 'l', 'l', 'o', 0x89, 0x05, 'h', 'e', 'l', 'l', 'o', // ping 0x81, 0x05, 'w', 'o', 'r', 'l', 'd'} br := bufio.NewReader(bytes.NewBuffer(wireData)) bw := bufio.NewWriter(bytes.NewBuffer([]byte{})) conn := newHybiConn(newConfig(t, "/"), bufio.NewReadWriter(br, bw), nil, nil) step := 0 pos := 0 expectedPos := []int{2, 5, 16, 19} expectedLen := []int{3, 2, 3, 2} for { msg := make([]byte, 3) n, err := conn.Read(msg) if step >= len(expectedPos) { if err == nil { t.Errorf("read not EOF") } if n != 0 { t.Errorf("expect read 0, got %d", n) } return } pos = expectedPos[step] endPos := pos + expectedLen[step] if err != nil { t.Errorf("read from %d, got error %q", pos, err) return } if n != endPos-pos { t.Errorf("read from %d, expect %d, got %d", pos, endPos-pos, n) } if !bytes.Equal(wireData[pos:endPos], msg[:n]) { t.Errorf("read from %d, frame %v, got %v", pos, wireData[pos:endPos], msg[:n]) } step++ } }
explode_data.jsonl/53446
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 511 }
[ 2830, 3393, 30816, 8221, 12472, 4418, 1155, 353, 8840, 836, 8, 341, 6692, 554, 1043, 1669, 3056, 3782, 90, 15, 87, 23, 16, 11, 220, 15, 87, 15, 20, 11, 364, 71, 516, 364, 68, 516, 364, 75, 516, 364, 75, 516, 364, 78, 751, 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...
8
func TestTruncateBody(t *testing.T) { tests := []struct { body string want string level string }{ // Anything below 8 is completely truncated { body: "Completely truncated below 8", want: " [truncated 28 chars]", level: "0", }, // Small strings are not truncated by high levels { body: "Small body never gets truncated", want: "Small body never gets truncated", level: "10", }, { body: "Small body never gets truncated", want: "Small body never gets truncated", level: "8", }, // Strings are truncated to 1024 if level is less than 9. { body: buildString(2000), level: "8", want: fmt.Sprintf("%s [truncated 976 chars]", buildString(1024)), }, // Strings are truncated to 10240 if level is 9. { body: buildString(20000), level: "9", want: fmt.Sprintf("%s [truncated 9760 chars]", buildString(10240)), }, // Strings are not truncated if level is 10 or higher { body: buildString(20000), level: "10", want: buildString(20000), }, // Strings are not truncated if level is 10 or higher { body: buildString(20000), level: "11", want: buildString(20000), }, } l := flag.Lookup("v").Value.(flag.Getter).Get().(glog.Level) for _, test := range tests { flag.Set("v", test.level) got := truncateBody(test.body) if got != test.want { t.Errorf("truncateBody(%v) = %v, want %v", test.body, got, test.want) } } flag.Set("v", l.String()) }
explode_data.jsonl/13286
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 607 }
[ 2830, 3393, 1282, 26900, 5444, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 3056, 1235, 341, 197, 35402, 220, 914, 198, 197, 50780, 220, 914, 198, 197, 53743, 914, 198, 197, 59403, 197, 197, 322, 40933, 3685, 220, 23, 374, 6587, 59756, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestCallModelSecondArg(t *testing.T) { t.Skip("call model times out right now") tc := requireTestCaseWithModelAndSymbols(t, `import requests url = "https://it-is-a-good-question/42-is-a-good-answer" data = dict(field=5) requests.get(url, $`) completions := requireCompletions(t, tc, CallModel{}) require.NotEmpty(t, completions) }
explode_data.jsonl/56042
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 128 }
[ 2830, 3393, 7220, 1712, 15666, 2735, 1155, 353, 8840, 836, 8, 341, 3244, 57776, 445, 6659, 1614, 3039, 700, 1290, 1431, 1138, 78255, 1669, 1373, 16458, 2354, 1712, 3036, 56213, 1155, 11, 1565, 474, 7388, 4710, 1085, 284, 330, 2428, 1110...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestSuObjectObjectAsKey(t *testing.T) { ob := SuObject{} ob.Set(&SuObject{}, SuInt(123)) assert.T(t).This(ob.Get(nil, &SuObject{})).Is(SuInt(123)) }
explode_data.jsonl/7113
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 69 }
[ 2830, 3393, 36459, 1190, 1190, 2121, 1592, 1155, 353, 8840, 836, 8, 341, 63353, 1669, 16931, 1190, 16094, 63353, 4202, 2099, 36459, 1190, 22655, 16931, 1072, 7, 16, 17, 18, 1171, 6948, 836, 1155, 568, 1986, 49595, 2234, 27907, 11, 609, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
func TestSnapshot(t *testing.T) { nodeName := "node" now := time.Now() ttl := 10 * time.Second testPods := []*v1.Pod{ makeBasePod(t, nodeName, "test-1", "100m", "500", "", []v1.ContainerPort{{HostIP: "127.0.0.1", HostPort: 80, Protocol: "TCP"}}), makeBasePod(t, nodeName, "test-2", "200m", "1Ki", "", []v1.ContainerPort{{HostIP: "127.0.0.1", HostPort: 80, Protocol: "TCP"}}), } tests := []struct { podsToAssume []*v1.Pod podsToAdd []*v1.Pod }{{ // two pod were assumed at same time. But first one is called Add() and gets confirmed. podsToAssume: []*v1.Pod{testPods[0], testPods[1]}, podsToAdd: []*v1.Pod{testPods[0]}, }} for _, tt := range tests { cache := newSchedulerCache(ttl, time.Second, nil) for _, podToAssume := range tt.podsToAssume { if err := assumeAndFinishBinding(cache, podToAssume, now); err != nil { t.Fatalf("assumePod failed: %v", err) } } for _, podToAdd := range tt.podsToAdd { if err := cache.AddPod(podToAdd); err != nil { t.Fatalf("AddPod failed: %v", err) } } snapshot := cache.Snapshot() if !reflect.DeepEqual(snapshot.Nodes, cache.nodes) { t.Fatalf("expect \n%+v; got \n%+v", cache.nodes, snapshot.Nodes) } if !reflect.DeepEqual(snapshot.AssumedPods, cache.assumedPods) { t.Fatalf("expect \n%+v; got \n%+v", cache.assumedPods, snapshot.AssumedPods) } } }
explode_data.jsonl/19645
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 610 }
[ 2830, 3393, 15009, 1155, 353, 8840, 836, 8, 341, 20831, 675, 1669, 330, 3509, 698, 80922, 1669, 882, 13244, 741, 3244, 11544, 1669, 220, 16, 15, 353, 882, 32435, 271, 18185, 23527, 82, 1669, 29838, 85, 16, 88823, 515, 197, 77438, 3978...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestGetValidatorSortingUnmixed(t *testing.T) { app, ctx, addrs, _ := bootstrapValidatorTest(t, 1000, 20) // initialize some validators into the state amts := []int64{ 0, 100 * sdk.PowerReduction.Int64(), 1 * sdk.PowerReduction.Int64(), 400 * sdk.PowerReduction.Int64(), 200 * sdk.PowerReduction.Int64()} n := len(amts) var validators [5]types.Validator for i, amt := range amts { validators[i] = types.NewValidator(sdk.ValAddress(addrs[i]), PKs[i], types.Description{}) validators[i].Status = sdk.Bonded validators[i].Tokens = sdk.NewInt(amt) validators[i].DelegatorShares = sdk.NewDec(amt) keeper.TestingUpdateValidator(app.StakingKeeper, ctx, validators[i], true) } // first make sure everything made it in to the gotValidator group resValidators := app.StakingKeeper.GetBondedValidatorsByPower(ctx) assert.Equal(t, n, len(resValidators)) assert.Equal(t, sdk.NewInt(400).Mul(sdk.PowerReduction), resValidators[0].BondedTokens(), "%v", resValidators) assert.Equal(t, sdk.NewInt(200).Mul(sdk.PowerReduction), resValidators[1].BondedTokens(), "%v", resValidators) assert.Equal(t, sdk.NewInt(100).Mul(sdk.PowerReduction), resValidators[2].BondedTokens(), "%v", resValidators) assert.Equal(t, sdk.NewInt(1).Mul(sdk.PowerReduction), resValidators[3].BondedTokens(), "%v", resValidators) assert.Equal(t, sdk.NewInt(0), resValidators[4].BondedTokens(), "%v", resValidators) assert.Equal(t, validators[3].OperatorAddress, resValidators[0].OperatorAddress, "%v", resValidators) assert.Equal(t, validators[4].OperatorAddress, resValidators[1].OperatorAddress, "%v", resValidators) assert.Equal(t, validators[1].OperatorAddress, resValidators[2].OperatorAddress, "%v", resValidators) assert.Equal(t, validators[2].OperatorAddress, resValidators[3].OperatorAddress, "%v", resValidators) assert.Equal(t, validators[0].OperatorAddress, resValidators[4].OperatorAddress, "%v", resValidators) // test a basic increase in voting power validators[3].Tokens = sdk.NewInt(500).Mul(sdk.PowerReduction) keeper.TestingUpdateValidator(app.StakingKeeper, ctx, validators[3], true) resValidators = app.StakingKeeper.GetBondedValidatorsByPower(ctx) require.Equal(t, len(resValidators), n) assert.True(ValEq(t, validators[3], resValidators[0])) // test a decrease in voting power validators[3].Tokens = sdk.NewInt(300).Mul(sdk.PowerReduction) keeper.TestingUpdateValidator(app.StakingKeeper, ctx, validators[3], true) resValidators = app.StakingKeeper.GetBondedValidatorsByPower(ctx) require.Equal(t, len(resValidators), n) assert.True(ValEq(t, validators[3], resValidators[0])) assert.True(ValEq(t, validators[4], resValidators[1])) // test equal voting power, different age validators[3].Tokens = sdk.NewInt(200).Mul(sdk.PowerReduction) ctx = ctx.WithBlockHeight(10) keeper.TestingUpdateValidator(app.StakingKeeper, ctx, validators[3], true) resValidators = app.StakingKeeper.GetBondedValidatorsByPower(ctx) require.Equal(t, len(resValidators), n) assert.True(ValEq(t, validators[3], resValidators[0])) assert.True(ValEq(t, validators[4], resValidators[1])) // no change in voting power - no change in sort ctx = ctx.WithBlockHeight(20) keeper.TestingUpdateValidator(app.StakingKeeper, ctx, validators[4], true) resValidators = app.StakingKeeper.GetBondedValidatorsByPower(ctx) require.Equal(t, len(resValidators), n) assert.True(ValEq(t, validators[3], resValidators[0])) assert.True(ValEq(t, validators[4], resValidators[1])) // change in voting power of both validators, both still in v-set, no age change validators[3].Tokens = sdk.NewInt(300).Mul(sdk.PowerReduction) validators[4].Tokens = sdk.NewInt(300).Mul(sdk.PowerReduction) keeper.TestingUpdateValidator(app.StakingKeeper, ctx, validators[3], true) resValidators = app.StakingKeeper.GetBondedValidatorsByPower(ctx) require.Equal(t, len(resValidators), n) ctx = ctx.WithBlockHeight(30) keeper.TestingUpdateValidator(app.StakingKeeper, ctx, validators[4], true) resValidators = app.StakingKeeper.GetBondedValidatorsByPower(ctx) require.Equal(t, len(resValidators), n, "%v", resValidators) assert.True(ValEq(t, validators[3], resValidators[0])) assert.True(ValEq(t, validators[4], resValidators[1])) }
explode_data.jsonl/6097
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1595 }
[ 2830, 3393, 1949, 14256, 71681, 1806, 56685, 1155, 353, 8840, 836, 8, 341, 28236, 11, 5635, 11, 912, 5428, 11, 716, 1669, 26925, 14256, 2271, 1155, 11, 220, 16, 15, 15, 15, 11, 220, 17, 15, 692, 197, 322, 9468, 1045, 38588, 1119, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestProposalSent_ExecuteInbound(t *testing.T) { t.Run("Successes", func(t *testing.T) { followup, action, err := (&proposalSent{}).ExecuteInbound(&metaData{proposeCredential: &ProposeCredential{}}) require.NoError(t, err) require.Equal(t, &noOp{}, followup) require.NotNil(t, action) ctrl := gomock.NewController(t) defer ctrl.Finish() messenger := serviceMocks.NewMockMessenger(ctrl) messenger.EXPECT().ReplyTo(gomock.Any(), gomock.Any()) require.NoError(t, action(messenger)) }) t.Run("ProposeCredential is absent", func(t *testing.T) { followup, action, err := (&proposalSent{}).ExecuteInbound(&metaData{}) require.Contains(t, fmt.Sprintf("%v", err), "propose credential was not provided") require.Nil(t, followup) require.Nil(t, action) }) }
explode_data.jsonl/53013
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 309 }
[ 2830, 3393, 98637, 31358, 83453, 641, 10891, 1155, 353, 8840, 836, 8, 341, 3244, 16708, 445, 7188, 288, 497, 2915, 1155, 353, 8840, 836, 8, 341, 197, 1166, 1544, 454, 11, 1917, 11, 1848, 1669, 15899, 73874, 31358, 6257, 568, 17174, 64...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestRWFileHandleWriteAt(t *testing.T) { r, vfs, fh, cleanup := rwHandleCreateWriteOnly(t) defer cleanup() offset := func() int64 { n, err := fh.Seek(0, io.SeekCurrent) require.NoError(t, err) return n } // Preconditions assert.Equal(t, int64(0), offset()) assert.True(t, fh.opened) assert.False(t, fh.writeCalled) // Write the data n, err := fh.WriteAt([]byte("hello**"), 0) assert.NoError(t, err) assert.Equal(t, 7, n) // After write assert.Equal(t, int64(0), offset()) assert.True(t, fh.writeCalled) // Write more data n, err = fh.WriteAt([]byte(" world"), 5) assert.NoError(t, err) assert.Equal(t, 6, n) // Close assert.NoError(t, fh.Close()) // Check can't write on closed handle n, err = fh.WriteAt([]byte("hello"), 0) assert.Equal(t, ECLOSED, err) assert.Equal(t, 0, n) // check vfs root, err := vfs.Root() require.NoError(t, err) checkListing(t, root, []string{"file1,11,false"}) // check the underlying r.Fremote but not the modtime file1 := fstest.NewItem("file1", "hello world", t1) vfs.WaitForWriters(waitForWritersDelay) fstest.CheckListingWithPrecision(t, r.Fremote, []fstest.Item{file1}, []string{}, fs.ModTimeNotSupported) }
explode_data.jsonl/7344
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 498 }
[ 2830, 3393, 56368, 1703, 6999, 7985, 1655, 1155, 353, 8840, 836, 8, 341, 7000, 11, 92941, 11, 36075, 11, 21290, 1669, 25991, 6999, 4021, 7985, 7308, 1155, 340, 16867, 21290, 2822, 40668, 1669, 2915, 368, 526, 21, 19, 341, 197, 9038, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestMinimumNObjectIDArgs(t *testing.T) { tests := []struct { name string args []string wantErr bool }{ { name: "no args", args: []string{}, wantErr: true, }, { name: "with correct args", args: []string{"5dd56c847a3e5a1f363d424d"}, wantErr: false, }, { name: "with invalid args", args: []string{"b"}, wantErr: true, }, { name: "with more args", args: []string{"5dd56c847a3e5a1f363d424d", "5dd56c847a3e5a1f363d424e"}, wantErr: false, }, } for _, tt := range tests { args := tt.args wantErr := tt.wantErr t.Run(tt.name, func(t *testing.T) { c := &cobra.Command{Use: "c", Args: MinimumNObjectIDArgs(1), ValidArgs: []string{"a"}, Run: emptyRun} if _, err := executeCommand(c, args...); (err != nil) != wantErr { t.Errorf("MinimumNObjectIDArgs() error = %v, wantErr %v", err, wantErr) } }) } }
explode_data.jsonl/59323
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 454 }
[ 2830, 3393, 28695, 45, 1190, 915, 4117, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 3056, 1235, 341, 197, 11609, 262, 914, 198, 197, 31215, 262, 3056, 917, 198, 197, 50780, 7747, 1807, 198, 197, 59403, 197, 197, 515, 298, 11609, 25, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestValidatePersistentVolumeSourceUpdate(t *testing.T) { validVolume := testVolume("foo", "", core.PersistentVolumeSpec{ Capacity: core.ResourceList{ core.ResourceName(core.ResourceStorage): resource.MustParse("1G"), }, AccessModes: []core.PersistentVolumeAccessMode{core.ReadWriteOnce}, PersistentVolumeSource: core.PersistentVolumeSource{ HostPath: &core.HostPathVolumeSource{ Path: "/foo", Type: newHostPathType(string(core.HostPathDirectory)), }, }, StorageClassName: "valid", }) validPvSourceNoUpdate := validVolume.DeepCopy() invalidPvSourceUpdateType := validVolume.DeepCopy() invalidPvSourceUpdateType.Spec.PersistentVolumeSource = core.PersistentVolumeSource{ FlexVolume: &core.FlexPersistentVolumeSource{ Driver: "kubernetes.io/blue", FSType: "ext4", }, } invalidPvSourceUpdateDeep := validVolume.DeepCopy() invalidPvSourceUpdateDeep.Spec.PersistentVolumeSource = core.PersistentVolumeSource{ HostPath: &core.HostPathVolumeSource{ Path: "/updated", Type: newHostPathType(string(core.HostPathDirectory)), }, } scenarios := map[string]struct { isExpectedFailure bool oldVolume *core.PersistentVolume newVolume *core.PersistentVolume }{ "condition-no-update": { isExpectedFailure: false, oldVolume: validVolume, newVolume: validPvSourceNoUpdate, }, "condition-update-source-type": { isExpectedFailure: true, oldVolume: validVolume, newVolume: invalidPvSourceUpdateType, }, "condition-update-source-deep": { isExpectedFailure: true, oldVolume: validVolume, newVolume: invalidPvSourceUpdateDeep, }, } for name, scenario := range scenarios { errs := ValidatePersistentVolumeUpdate(scenario.newVolume, scenario.oldVolume) if len(errs) == 0 && scenario.isExpectedFailure { t.Errorf("Unexpected success for scenario: %s", name) } if len(errs) > 0 && !scenario.isExpectedFailure { t.Errorf("Unexpected failure for scenario: %s - %+v", name, errs) } } }
explode_data.jsonl/992
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 774 }
[ 2830, 3393, 17926, 53194, 18902, 3608, 4289, 1155, 353, 8840, 836, 8, 341, 56322, 18902, 1669, 1273, 18902, 445, 7975, 497, 7342, 6200, 61655, 18902, 8327, 515, 197, 6258, 391, 4018, 25, 6200, 20766, 852, 515, 298, 71882, 20766, 675, 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...
6
func TestHasOnlyTags(t *testing.T) { opt := NewOption() tp := newTextProcessor(opt) actuals := []bool{ tp.IsOnlyTags("\t <br> \n"), tp.IsOnlyTags("\t hoge \n"), } expecteds := []bool{ true, false, } for i := range actuals { if actuals[i] != expecteds[i] { t.Errorf("expected %v, but got %v", expecteds[i], actuals[i]) } } }
explode_data.jsonl/25043
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 159 }
[ 2830, 3393, 10281, 7308, 15930, 1155, 353, 8840, 836, 8, 341, 64838, 1669, 1532, 5341, 741, 73423, 1669, 94653, 22946, 24539, 692, 88814, 82, 1669, 3056, 2641, 515, 197, 73423, 4506, 7308, 15930, 4921, 83, 366, 1323, 29, 1124, 77, 4461,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestLoadIdentityFile(t *testing.T) { t.Parallel() // Load expected tls.Config and ssh.ClientConfig. expectedTLSConfig := getExpectedTLSConfig(t) expectedSSHConfig := getExpectedSSHConfig(t) // Write identity file to disk. path := filepath.Join(t.TempDir(), "file") idFile := &identityfile.IdentityFile{ PrivateKey: keyPEM, Certs: identityfile.Certs{ TLS: tlsCert, SSH: sshCert, }, CACerts: identityfile.CACerts{ TLS: [][]byte{tlsCACert}, SSH: [][]byte{sshCACert}, }, } err := identityfile.Write(idFile, path) require.NoError(t, err) // Load identity file from disk. creds := LoadIdentityFile(path) // Build tls.Config and compare to expected tls.Config. tlsConfig, err := creds.TLSConfig() require.NoError(t, err) requireEqualTLSConfig(t, expectedTLSConfig, tlsConfig) // Build ssh.ClientConfig and compare to expected ssh.ClientConfig. sshConfig, err := creds.SSHClientConfig() require.NoError(t, err) requireEqualSSHConfig(t, expectedSSHConfig, sshConfig) // Load invalid identity. creds = LoadIdentityFile("invalid_path") _, err = creds.TLSConfig() require.Error(t, err) _, err = creds.SSHClientConfig() require.Error(t, err) }
explode_data.jsonl/55479
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 457 }
[ 2830, 3393, 92985, 1703, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 2822, 197, 322, 8893, 3601, 55026, 10753, 323, 29230, 11716, 2648, 624, 42400, 45439, 2648, 1669, 633, 18896, 45439, 2648, 1155, 340, 42400, 62419, 2648, 1669, 633,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestEndpointConfigWithMultipleBackends(t *testing.T) { configPath := filepath.Join(getConfigPath(), configTestEntityMatchersFile) sampleViper := newViper(configPath) var backends []core.ConfigBackend backendMap := make(map[string]interface{}) backendMap["client"] = sampleViper.Get("client") backends = append(backends, &mocks.MockConfigBackend{KeyValueMap: backendMap}) backendMap = make(map[string]interface{}) backendMap["channels"] = sampleViper.Get("channels") backends = append(backends, &mocks.MockConfigBackend{KeyValueMap: backendMap}) backendMap = make(map[string]interface{}) backendMap["entityMatchers"] = sampleViper.Get("entityMatchers") backends = append(backends, &mocks.MockConfigBackend{KeyValueMap: backendMap}) backendMap = make(map[string]interface{}) backendMap["organizations"] = sampleViper.Get("organizations") backends = append(backends, &mocks.MockConfigBackend{KeyValueMap: backendMap}) backendMap = make(map[string]interface{}) backendMap["orderers"] = sampleViper.Get("orderers") backends = append(backends, &mocks.MockConfigBackend{KeyValueMap: backendMap}) backendMap = make(map[string]interface{}) backendMap["peers"] = sampleViper.Get("peers") backends = append(backends, &mocks.MockConfigBackend{KeyValueMap: backendMap}) //create endpointConfig with all 7 backends having 7 different entities endpointConfig, err := ConfigFromBackend(backends...) assert.Nil(t, err, "ConfigFromBackend should have been successful for multiple backends") assert.NotNil(t, endpointConfig, "Invalid endpoint config from multiple backends") //Get network Config networkConfig := endpointConfig.NetworkConfig() assert.NotNil(t, networkConfig, "Invalid networkConfig") //Channel assert.Equal(t, len(networkConfig.Channels), 5) assert.Equal(t, len(networkConfig.Channels["mychannel"].Peers), 1) assert.Equal(t, networkConfig.Channels["mychannel"].Policies.QueryChannelConfig.MinResponses, 1) assert.Equal(t, networkConfig.Channels["mychannel"].Policies.QueryChannelConfig.MaxTargets, 1) assert.Equal(t, networkConfig.Channels["mychannel"].Policies.QueryChannelConfig.RetryOpts.MaxBackoff.String(), (5 * time.Second).String()) assert.Equal(t, networkConfig.Channels["mychannel"].Policies.QueryChannelConfig.RetryOpts.InitialBackoff.String(), (500 * time.Millisecond).String()) assert.Equal(t, networkConfig.Channels["mychannel"].Policies.QueryChannelConfig.RetryOpts.BackoffFactor, 2.0) //Organizations assert.Equal(t, len(networkConfig.Organizations), 4) assert.Equal(t, networkConfig.Organizations["org1"].MSPID, "Org1MSP") //Orderer assert.Equal(t, len(networkConfig.Orderers), 2) assert.Equal(t, networkConfig.Orderers["local.orderer.example.com"].URL, "orderer.example.com:7050") assert.Equal(t, networkConfig.Orderers["orderer1.example.com"].URL, "orderer1.example.com:7050") //Peer assert.Equal(t, len(networkConfig.Peers), 3) assert.Equal(t, networkConfig.Peers["local.peer0.org1.example.com"].URL, "peer0.org1.example.com:7051") assert.Equal(t, networkConfig.Peers["peer0.org3.example.com"].URL, "peer0.org3.example.com:7051") //EntityMatchers endpointConfigImpl := endpointConfig.(*EndpointConfig) assert.Equal(t, len(endpointConfigImpl.entityMatchers.matchers), 4) assert.Equal(t, len(endpointConfigImpl.entityMatchers.matchers["peer"]), 10) assert.Equal(t, endpointConfigImpl.entityMatchers.matchers["peer"][0].MappedHost, "local.peer0.org1.example.com") assert.Equal(t, len(endpointConfigImpl.entityMatchers.matchers["orderer"]), 6) assert.Equal(t, endpointConfigImpl.entityMatchers.matchers["orderer"][0].MappedHost, "local.orderer.example.com") assert.Equal(t, len(endpointConfigImpl.entityMatchers.matchers["certificateauthority"]), 3) assert.Equal(t, endpointConfigImpl.entityMatchers.matchers["certificateauthority"][0].MappedHost, "local.ca.org1.example.com") assert.Equal(t, len(endpointConfigImpl.entityMatchers.matchers["channel"]), 1) assert.Equal(t, endpointConfigImpl.entityMatchers.matchers["channel"][0].MappedName, "ch1") }
explode_data.jsonl/34099
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1381 }
[ 2830, 3393, 27380, 2648, 2354, 32089, 3707, 1412, 1155, 353, 8840, 836, 8, 1476, 25873, 1820, 1669, 26054, 22363, 5433, 2648, 1820, 1507, 2193, 2271, 3030, 37862, 1703, 340, 1903, 1516, 53, 12858, 1669, 501, 53, 12858, 8754, 1820, 692, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestResetAllWithGit(t *testing.T) { th := git.InitTestRepositoryFromLocal(t) defer th.CleanUp(t) _, err := testFile(th.RepoPath, "file") require.NoError(t, err) err = AddAll(th.Repository, testAddopt1) require.NoError(t, err) var tests = []struct { inp1 *git.Repository inp2 *ResetOptions }{ {th.Repository, testResetopt1}, } for _, test := range tests { err := resetAllWithGit(test.inp1, test.inp2) require.NoError(t, err) } }
explode_data.jsonl/16673
{ "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, 14828, 2403, 2354, 46562, 1155, 353, 8840, 836, 8, 341, 70479, 1669, 16345, 26849, 2271, 4624, 3830, 7319, 1155, 340, 16867, 270, 727, 2675, 2324, 1155, 692, 197, 6878, 1848, 1669, 1273, 1703, 24365, 2817, 5368, 1820, 11, 33...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestStoreGateway_InitialSyncFailure(t *testing.T) { ctx := context.Background() gatewayCfg := mockGatewayConfig() gatewayCfg.ShardingEnabled = true storageCfg := mockStorageConfig(t) ringStore := consul.NewInMemoryClient(ring.GetCodec()) bucketClient := &bucket.ClientMock{} g, err := newStoreGateway(gatewayCfg, storageCfg, bucketClient, ringStore, defaultLimitsOverrides(t), mockLoggingLevel(), log.NewNopLogger(), nil) require.NoError(t, err) bucketClient.MockIter("", []string{}, errors.New("network error")) require.NoError(t, g.StartAsync(ctx)) err = g.AwaitRunning(ctx) assert.Error(t, err) assert.Equal(t, services.Failed, g.State()) // We expect a clean shutdown, including unregistering the instance from the ring. assert.False(t, g.ringLifecycler.IsRegistered()) }
explode_data.jsonl/57958
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 275 }
[ 2830, 3393, 6093, 40709, 62, 6341, 12154, 17507, 1155, 353, 8840, 836, 8, 341, 20985, 1669, 2266, 19047, 741, 3174, 12043, 42467, 1669, 7860, 40709, 2648, 741, 3174, 12043, 42467, 10849, 28410, 5462, 284, 830, 198, 197, 16172, 42467, 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 TestPrQueueOneReaderOneWriter(t *testing.T) { clus := NewClusterV3(t, &ClusterConfig{Size: 1}) defer clus.Terminate(t) // write out five items with random priority etcdc := clus.RandClient() q := recipe.NewPriorityQueue(etcdc, "testprq") for i := 0; i < 5; i++ { // [0, 2] priority for priority collision to test seq keys pr := uint16(rand.Intn(3)) if err := q.Enqueue(fmt.Sprintf("%d", pr), pr); err != nil { t.Fatalf("error enqueuing (%v)", err) } } // read back items; confirm priority order is respected lastPr := -1 for i := 0; i < 5; i++ { s, err := q.Dequeue() if err != nil { t.Fatalf("error dequeueing (%v)", err) } curPr := 0 if _, err := fmt.Sscanf(s, "%d", &curPr); err != nil { t.Fatalf(`error parsing item "%s" (%v)`, s, err) } if lastPr > curPr { t.Fatalf("expected priority %v > %v", curPr, lastPr) } } }
explode_data.jsonl/14552
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 369 }
[ 2830, 3393, 3533, 7554, 3966, 5062, 3966, 6492, 1155, 353, 8840, 836, 8, 341, 197, 4163, 1669, 1532, 28678, 53, 18, 1155, 11, 609, 28678, 2648, 90, 1695, 25, 220, 16, 3518, 16867, 1185, 355, 836, 261, 34016, 1155, 692, 197, 322, 327...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestConfigDefaultEmailNotificationContentsType(t *testing.T) { c1 := Config{} c1.SetDefaults() if *c1.EmailSettings.EmailNotificationContentsType != EMAIL_NOTIFICATION_CONTENTS_FULL { t.Fatal("EmailSettings.EmailNotificationContentsType should default to 'full'") } }
explode_data.jsonl/50669
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 92 }
[ 2830, 3393, 2648, 3675, 4781, 11196, 14803, 929, 1155, 353, 8840, 836, 8, 341, 1444, 16, 1669, 5532, 16094, 1444, 16, 4202, 16273, 2822, 743, 353, 66, 16, 24066, 6086, 24066, 11196, 14803, 929, 961, 51708, 54241, 25560, 50, 29822, 341, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
2
func TestBTreeMultipleSearch1(t *testing.T) { tree := newRangeTree() tree.update(&metapb.Range{StartKey: []byte("a"), EndKey: []byte("e")}) tree.update(&metapb.Range{StartKey: []byte("e"), EndKey: []byte("k")}) tree.update(&metapb.Range{StartKey: []byte("k"), EndKey: []byte("t")}) tree.update(&metapb.Range{StartKey: []byte("t"), EndKey: []byte("w")}) tree.update(&metapb.Range{StartKey: []byte("w"), EndKey: []byte("z")}) rs := tree.multipleSearch([]byte("f"), 10) if len(rs) != 4 { t.Errorf("test failed %v", rs) return } r := rs[0] if bytes.Compare([]byte("e"), r.StartKey) != 0 || bytes.Compare([]byte("k"), r.EndKey) != 0 { t.Errorf("test failed") return } }
explode_data.jsonl/25353
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 281 }
[ 2830, 3393, 33, 6533, 32089, 5890, 16, 1155, 353, 8840, 836, 8, 341, 51968, 1669, 501, 6046, 6533, 741, 51968, 5317, 2099, 4059, 391, 65, 24783, 90, 3479, 1592, 25, 3056, 3782, 445, 64, 3975, 3972, 1592, 25, 3056, 3782, 445, 68, 899...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestRollBackVote(t *testing.T) { desc := &contract.TxDesc{ Module: "tdpos", Method: "rollback_vote", } strDesc, _ := json.Marshal(desc) U, L, tdpos := commonWork(t) txCons, block := makeTxWithDesc(strDesc, U, L, t) tdpos.context = &contract.TxContext{} tdpos.context.UtxoBatch = tdpos.utxoVM.NewBatch() tdpos.candidateBallots.LoadOrStore("D_candidate_ballots_f3prTg9itaZY6m48wXXikXdcxiByW7zgk", int64(1)) desc2 := &contract.TxDesc{ Module: "tdpos", Method: "rollback_vote", Tx: txCons, Args: map[string]interface{}{ "candidates": []interface{}{"f3prTg9itaZY6m48wXXikXdcxiByW7zgk"}, }, } rollBackVoteErr := tdpos.rollbackVote(desc2, block) if rollBackVoteErr != nil { t.Error("roll back vote error ", rollBackVoteErr.Error()) } // add cache canBal := &candidateBallotsCacheValue{ ballots: int64(1), isDel: false, } tdpos.candidateBallotsCache.LoadOrStore("D_candidate_ballots_f3prTg9itaZY6m48wXXikXdcxiByW7zgk", canBal) rollBackVoteErr = tdpos.rollbackVote(desc2, block) if rollBackVoteErr != nil { t.Error("roll back vote error ", rollBackVoteErr.Error()) } }
explode_data.jsonl/77200
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 489 }
[ 2830, 3393, 32355, 3707, 41412, 1155, 353, 8840, 836, 8, 341, 41653, 1669, 609, 20257, 81362, 11065, 515, 197, 197, 3332, 25, 330, 1296, 966, 756, 197, 84589, 25, 330, 33559, 54360, 756, 197, 532, 11355, 11065, 11, 716, 1669, 2951, 37...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestAs(t *testing.T) { var errT errorT var errP *os.PathError var p *poser _, errF := os.Open("non-existing") testCases := []struct { err error target interface{} match bool }{{ fmt.Errorf("pittied the fool: %w", errorT{}), &errT, true, }, { errF, &errP, true, }, { errors.Opaque(errT), &errT, false, }, { errorT{}, &errP, false, }, { wrapped{nil}, &errT, false, }, { &poser{"error", nil}, &errT, true, }, { &poser{"path", nil}, &errP, true, }, { &poser{"oh no", nil}, &p, true, }, { &poser{"oo", nil}, &errF, false, }} for _, tc := range testCases { name := fmt.Sprintf("As(Errorf(..., %v), %v)", tc.err, tc.target) t.Run(name, func(t *testing.T) { match := errors.As(tc.err, tc.target) if match != tc.match { t.Fatalf("match: got %v; want %v", match, tc.match) } if !match { return } if tc.target == nil { t.Fatalf("non-nil result after match") } }) } }
explode_data.jsonl/5221
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 509 }
[ 2830, 3393, 2121, 1155, 353, 8840, 836, 8, 341, 2405, 1848, 51, 1465, 51, 198, 2405, 1848, 47, 353, 436, 17474, 1454, 198, 2405, 281, 353, 20071, 198, 197, 6878, 1848, 37, 1669, 2643, 12953, 445, 6280, 49357, 5130, 18185, 37302, 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...
4
func TestFloatListEncoder(t *testing.T) { e := NewFloatListEncoder() d := NewFloatListDecoder(false) slices := [][]float64{ {}, {0}, {10.1, 20.2, 30.3}, repeatFloatSlice([]float64{-11, 22, -33, 44}, 128), } // test Encode & Decode for _, sl := range slices { b := e.Encode(sl) assert.Equal(t, sl, d.Decode(b)) } // test Read buf := bytes.NewBufferString("") for _, sl := range slices { _, err := buf.Write(e.Encode(sl)) require.NoError(t, err) } for i := 0; i < len(slices); i++ { n, sl, err := d.Read(buf) require.NoError(t, err) assert.Equal(t, slices[i], sl) assert.NotEmpty(t, n) } }
explode_data.jsonl/60190
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 292 }
[ 2830, 3393, 5442, 852, 19921, 1155, 353, 8840, 836, 8, 341, 7727, 1669, 1532, 5442, 852, 19921, 741, 2698, 1669, 1532, 5442, 852, 20732, 3576, 340, 1903, 37414, 1669, 52931, 3649, 21, 19, 515, 197, 197, 38837, 197, 197, 90, 15, 1583, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestScriptTokenizerUnsupportedVersion(t *testing.T) { const scriptVersion = 65535 tokenizer := MakeScriptTokenizer(scriptVersion, nil) if !errors.Is(tokenizer.Err(), ErrUnsupportedScriptVersion) { t.Fatalf("script tokenizer did not error with unsupported version") } }
explode_data.jsonl/33514
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 83 }
[ 2830, 3393, 5910, 37434, 41884, 5637, 1155, 353, 8840, 836, 8, 341, 4777, 5316, 5637, 284, 220, 21, 20, 20, 18, 20, 198, 43947, 3135, 1669, 7405, 5910, 37434, 42795, 5637, 11, 2092, 340, 743, 753, 7650, 4506, 13274, 3135, 27862, 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...
2
func TestRequestReceived_ExecuteInbound(t *testing.T) { t.Run("Successes", func(t *testing.T) { followup, action, err := (&requestReceived{}).ExecuteInbound(&metaData{issueCredential: &IssueCredential{}}) require.NoError(t, err) require.Equal(t, &credentialIssued{}, followup) require.NotNil(t, action) ctrl := gomock.NewController(t) defer ctrl.Finish() messenger := serviceMocks.NewMockMessenger(ctrl) messenger.EXPECT().ReplyTo(gomock.Any(), gomock.Any()) require.NoError(t, action(messenger)) }) t.Run("IssueCredential is absent", func(t *testing.T) { followup, action, err := (&requestReceived{}).ExecuteInbound(&metaData{}) require.Contains(t, fmt.Sprintf("%v", err), "issue credential was not provided") require.Nil(t, followup) require.Nil(t, action) }) }
explode_data.jsonl/53007
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 308 }
[ 2830, 3393, 1900, 23260, 83453, 641, 10891, 1155, 353, 8840, 836, 8, 341, 3244, 16708, 445, 7188, 288, 497, 2915, 1155, 353, 8840, 836, 8, 341, 197, 1166, 1544, 454, 11, 1917, 11, 1848, 1669, 15899, 2035, 23260, 6257, 568, 17174, 641,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestMatConvertFp16(t *testing.T) { src := NewMatWithSize(100, 100, MatTypeCV32F) dst := src.ConvertFp16() if dst.Empty() { t.Error("TestConvertFp16 dst should not be empty.") } }
explode_data.jsonl/81698
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 80 }
[ 2830, 3393, 11575, 12012, 37, 79, 16, 21, 1155, 353, 8840, 836, 8, 341, 41144, 1669, 1532, 11575, 2354, 1695, 7, 16, 15, 15, 11, 220, 16, 15, 15, 11, 6867, 929, 19589, 18, 17, 37, 340, 52051, 1669, 2286, 36179, 37, 79, 16, 21, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestGetEmojiImage(t *testing.T) { th := Setup().InitBasic() defer th.TearDown() Client := th.Client th.App.UpdateConfig(func(cfg *model.Config) { *cfg.ServiceSettings.EnableCustomEmoji = true }) emoji1 := &model.Emoji{ CreatorId: th.BasicUser.Id, Name: model.NewId(), } emoji1, resp := Client.CreateEmoji(emoji1, utils.CreateTestGif(t, 10, 10), "image.gif") CheckNoError(t, resp) th.App.UpdateConfig(func(cfg *model.Config) { *cfg.ServiceSettings.EnableCustomEmoji = false }) _, resp = Client.GetEmojiImage(emoji1.Id) CheckNotImplementedStatus(t, resp) CheckErrorMessage(t, resp, "api.emoji.disabled.app_error") th.App.UpdateConfig(func(cfg *model.Config) { *cfg.ServiceSettings.EnableCustomEmoji = true }) th.App.UpdateConfig(func(cfg *model.Config) { *cfg.FileSettings.DriverName = "local" }) emojiImage, resp := Client.GetEmojiImage(emoji1.Id) CheckNoError(t, resp) if len(emojiImage) <= 0 { t.Fatal("should return the image") } _, imageType, err := image.DecodeConfig(bytes.NewReader(emojiImage)) if err != nil { t.Fatalf("unable to identify received image: %v", err.Error()) } else if imageType != "gif" { t.Fatal("should've received gif data") } emoji2 := &model.Emoji{ CreatorId: th.BasicUser.Id, Name: model.NewId(), } emoji2, resp = Client.CreateEmoji(emoji2, utils.CreateTestAnimatedGif(t, 10, 10, 10), "image.gif") CheckNoError(t, resp) emojiImage, resp = Client.GetEmojiImage(emoji2.Id) CheckNoError(t, resp) if len(emojiImage) <= 0 { t.Fatal("should return the image") } _, imageType, err = image.DecodeConfig(bytes.NewReader(emojiImage)) if err != nil { t.Fatalf("unable to identify received image: %v", err.Error()) } else if imageType != "gif" { t.Fatal("should've received gif data") } emoji3 := &model.Emoji{ CreatorId: th.BasicUser.Id, Name: model.NewId(), } emoji3, resp = Client.CreateEmoji(emoji3, utils.CreateTestJpeg(t, 10, 10), "image.jpg") CheckNoError(t, resp) emojiImage, resp = Client.GetEmojiImage(emoji3.Id) CheckNoError(t, resp) if len(emojiImage) <= 0 { t.Fatal("should return the image") } _, imageType, err = image.DecodeConfig(bytes.NewReader(emojiImage)) if err != nil { t.Fatalf("unable to identify received image: %v", err.Error()) } else if imageType != "jpeg" { t.Fatal("should've received gif data") } emoji4 := &model.Emoji{ CreatorId: th.BasicUser.Id, Name: model.NewId(), } emoji4, resp = Client.CreateEmoji(emoji4, utils.CreateTestPng(t, 10, 10), "image.png") CheckNoError(t, resp) emojiImage, resp = Client.GetEmojiImage(emoji4.Id) CheckNoError(t, resp) if len(emojiImage) <= 0 { t.Fatal("should return the image") } _, imageType, err = image.DecodeConfig(bytes.NewReader(emojiImage)) if err != nil { t.Fatalf("unable to identify received image: %v", err.Error()) } else if imageType != "png" { t.Fatal("should've received gif data") } _, resp = Client.DeleteEmoji(emoji4.Id) CheckNoError(t, resp) _, resp = Client.GetEmojiImage(emoji4.Id) CheckNotFoundStatus(t, resp) _, resp = Client.GetEmojiImage(model.NewId()) CheckNotFoundStatus(t, resp) _, resp = Client.GetEmojiImage("") CheckBadRequestStatus(t, resp) }
explode_data.jsonl/76086
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1286 }
[ 2830, 3393, 1949, 92731, 1906, 1155, 353, 8840, 836, 8, 341, 70479, 1669, 18626, 1005, 3803, 15944, 741, 16867, 270, 836, 682, 4454, 741, 71724, 1669, 270, 11716, 271, 70479, 5105, 16689, 2648, 18552, 28272, 353, 2528, 10753, 8, 314, 35...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestFastGetPodsToMove(t *testing.T) { // Unreplicated pod pod1 := &kube_api.Pod{ ObjectMeta: kube_api.ObjectMeta{ Name: "pod1", Namespace: "ns", }, } _, err := FastGetPodsToMove(schedulercache.NewNodeInfo(pod1), false, true, kube_api.Codecs.UniversalDecoder()) assert.Error(t, err) // Replicated pod pod2 := &kube_api.Pod{ ObjectMeta: kube_api.ObjectMeta{ Name: "pod2", Namespace: "ns", Annotations: map[string]string{ "kubernetes.io/created-by": "{\"kind\":\"SerializedReference\",\"apiVersion\":\"v1\",\"reference\":{\"kind\":\"ReplicaSet\"}}", }, }, } r2, err := FastGetPodsToMove(schedulercache.NewNodeInfo(pod2), false, true, kube_api.Codecs.UniversalDecoder()) assert.NoError(t, err) assert.Equal(t, 1, len(r2)) assert.Equal(t, pod2, r2[0]) // Manifest pod pod3 := &kube_api.Pod{ ObjectMeta: kube_api.ObjectMeta{ Name: "pod3", Namespace: "kube-system", Annotations: map[string]string{ types.ConfigMirrorAnnotationKey: "something", }, }, } r3, err := FastGetPodsToMove(schedulercache.NewNodeInfo(pod3), false, true, kube_api.Codecs.UniversalDecoder()) assert.NoError(t, err) assert.Equal(t, 0, len(r3)) // DeamonSet pod pod4 := &kube_api.Pod{ ObjectMeta: kube_api.ObjectMeta{ Name: "pod4", Namespace: "ns", Annotations: map[string]string{ "kubernetes.io/created-by": "{\"kind\":\"SerializedReference\",\"apiVersion\":\"v1\",\"reference\":{\"kind\":\"DaemonSet\"}}", }, }, } r4, err := FastGetPodsToMove(schedulercache.NewNodeInfo(pod2, pod3, pod4), false, true, kube_api.Codecs.UniversalDecoder()) assert.NoError(t, err) assert.Equal(t, 1, len(r4)) assert.Equal(t, pod2, r4[0]) // Kube-system pod5 := &kube_api.Pod{ ObjectMeta: kube_api.ObjectMeta{ Name: "pod5", Namespace: "kube-system", Annotations: map[string]string{ "kubernetes.io/created-by": "{\"kind\":\"SerializedReference\",\"apiVersion\":\"v1\",\"reference\":{\"kind\":\"ReplicaSet\"}}", }, }, } _, err = FastGetPodsToMove(schedulercache.NewNodeInfo(pod5), false, true, kube_api.Codecs.UniversalDecoder()) assert.Error(t, err) }
explode_data.jsonl/70895
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 943 }
[ 2830, 3393, 32174, 1949, 23527, 82, 1249, 9860, 1155, 353, 8840, 836, 8, 1476, 197, 322, 1230, 9995, 13724, 7509, 198, 3223, 347, 16, 1669, 609, 97717, 11697, 88823, 515, 197, 23816, 12175, 25, 80958, 11697, 80222, 515, 298, 21297, 25, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestNewFileItem(t *testing.T) { f := &fileDialog{file: &FileDialog{}} _ = f.makeUI() item := f.newFileItem("/path/to/filename.txt", false) assert.Equal(t, item.name, "filename") test.Tap(item) assert.True(t, item.isCurrent) assert.Equal(t, item, f.selected) }
explode_data.jsonl/76866
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 112 }
[ 2830, 3393, 3564, 1703, 1234, 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, 22339, 1669, 282, 4618, 1703, 1234, 4283, 2343, 32429, 6663, 4033, 3909...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestClaimPosition(t *testing.T) { t.Parallel() _, err := b.ClaimPosition(1337) if err == nil { t.Error("Test Failed - ClaimPosition() error") } }
explode_data.jsonl/79954
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 60 }
[ 2830, 3393, 45544, 3812, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 2822, 197, 6878, 1848, 1669, 293, 21610, 2640, 3812, 7, 16, 18, 18, 22, 340, 743, 1848, 621, 2092, 341, 197, 3244, 6141, 445, 2271, 21379, 481, 37502, 3812, 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 ]
2
func TestAssociateAuditorByUsernameAndOrigin(t *testing.T) { Convey("Associate auditor by username and origin", t, func() { expectedBody := `{"origin":"ldap","username":"user-name"}` setup(MockRoute{"PUT", "/v2/organizations/bc7b4caf-f4b8-4d85-b126-0729b9351e56/auditors", []string{associateOrgUserPayload}, "", 201, "", &expectedBody}, t) defer teardown() c := &Config{ ApiAddress: server.URL, Token: "foobar", } client, err := NewClient(c) So(err, ShouldBeNil) org := &Org{ Guid: "bc7b4caf-f4b8-4d85-b126-0729b9351e56", c: client, } newOrg, err := org.AssociateAuditorByUsernameAndOrigin("user-name", "ldap") So(err, ShouldBeNil) So(newOrg.Guid, ShouldEqual, "bc7b4caf-f4b8-4d85-b126-0729b9351e56") }) }
explode_data.jsonl/4446
{ "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, 95540, 52949, 1919, 91519, 3036, 13298, 1155, 353, 8840, 836, 8, 341, 93070, 5617, 445, 95540, 53306, 553, 5934, 323, 6238, 497, 259, 11, 2915, 368, 341, 197, 42400, 5444, 1669, 1565, 4913, 8611, 3252, 38665, 2198, 5113, 325...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestProjectEulerChallenges(t *testing.T) { testCases := []struct { desc string actualResult int expectedResult int }{ {"67: Maximum Path Sum Two", MaximumPathSumTwo(), 7273}, } for _, tC := range testCases { if tC.actualResult != tC.expectedResult { t.Errorf("Failure. Test case: %v. Actual result: %v. Expected result: %v.", tC.desc, tC.actualResult, tC.expectedResult) } } }
explode_data.jsonl/41119
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 163 }
[ 2830, 3393, 7849, 36, 8479, 1143, 42370, 1155, 353, 8840, 836, 8, 341, 18185, 37302, 1669, 3056, 1235, 341, 197, 41653, 1843, 914, 198, 197, 88814, 2077, 256, 526, 198, 197, 42400, 2077, 526, 198, 197, 59403, 197, 197, 4913, 21, 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...
3
func TestGocloak_GetClientRoles(t *testing.T) { t.Parallel() cfg := GetConfig(t) client := NewClientWithDebug(t) token := GetAdminToken(t, client) testClient := GetClientByClientID(t, client, cfg.GoCloak.ClientID) _, err := client.GetClientRoles( token.AccessToken, cfg.GoCloak.Realm, testClient.ID) FailIfErr(t, err, "GetClientRoles failed") }
explode_data.jsonl/79534
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 144 }
[ 2830, 3393, 38, 509, 385, 585, 13614, 2959, 25116, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 741, 50286, 1669, 2126, 2648, 1155, 340, 25291, 1669, 1532, 2959, 2354, 7939, 1155, 340, 43947, 1669, 2126, 7210, 3323, 1155, 11, 2943, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestValidate(t *testing.T) { t.Parallel() ctx := context.TODO() now := time.Now() z1, err := zone.New(ctx, t.Name()+"1") require.NoError(t, err) m1, err := mode.New(ctx, z1.ID, t.Name()+"1", 70, 80, 1) require.NoError(t, err) m2, err := mode.New(ctx, z1.ID, t.Name()+"2", 71, 79, 2) require.NoError(t, err) existing, err := New(ctx, z1.ID, m1.ID, SCHEDULED, WeekdayMask(time.Monday)|WeekdayMask(time.Wednesday), now, now.Add(time.Hour*24*30), 32400, 61200) // 9 to 5 monday and wednesday for the next 30 days require.NoError(t, err) tests := []struct { name string weekdays []time.Weekday start time.Time end time.Time startTime int endTime int err string }{ { name: "valid", weekdays: []time.Weekday{time.Tuesday}, }, { name: "backward span", weekdays: []time.Weekday{time.Tuesday}, start: existing.EndDay, end: existing.StartDay, err: "setting start must be before setting end", }, { name: "backward time", weekdays: []time.Weekday{time.Tuesday}, startTime: existing.EndTime, endTime: existing.StartTime, err: "setting end time must be after start time", }, { name: "no days", err: "setting must be active on at least one day of the week", }, { name: "overlapping", weekdays: []time.Weekday{time.Monday}, err: fmt.Sprintf("new setting overlaps with setting %d", existing.ID), }, } for i, tt := range tests { t.Run(fmt.Sprintf("%d: %s", i, tt.name), func(t *testing.T) { sched := Setting{ ZoneID: z1.ID, ModeID: m2.ID, Priority: existing.Priority, StartDay: existing.StartDay, EndDay: existing.EndDay, StartTime: existing.StartTime, EndTime: existing.EndTime, } for _, d := range tt.weekdays { sched.DayOfWeek |= WeekdayMask(d) } if !tt.start.IsZero() { sched.StartDay = tt.start } if !tt.end.IsZero() { sched.EndDay = tt.end } if tt.startTime != 0 { sched.StartTime = tt.startTime } if tt.endTime != 0 { sched.EndTime = tt.endTime } err := Validate(ctx, sched) if tt.err != "" { assert.EqualError(t, err, tt.err) } else { assert.NoError(t, err) } }) } }
explode_data.jsonl/13338
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1070 }
[ 2830, 3393, 17926, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 741, 20985, 1669, 2266, 90988, 741, 80922, 1669, 882, 13244, 2822, 20832, 16, 11, 1848, 1669, 10143, 7121, 7502, 11, 259, 2967, 25589, 16, 1138, 17957, 35699, 1155, 11,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
7
func TestAccKmsSecretCiphertext_basic(t *testing.T) { t.Parallel() kms := BootstrapKMSKey(t) plaintext := fmt.Sprintf("secret-%s", acctest.RandString(10)) resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testGoogleKmsSecretCiphertext(kms.CryptoKey.Name, plaintext), Check: func(s *terraform.State) error { plaintext, err := testAccDecryptSecretDataWithCryptoKey(s, kms.CryptoKey.Name, "google_kms_secret_ciphertext.acceptance") if err != nil { return err } return resource.TestCheckResourceAttr("google_kms_secret_ciphertext.acceptance", "plaintext", plaintext)(s) }, }, }, }) }
explode_data.jsonl/81402
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 302 }
[ 2830, 3393, 14603, 42, 1011, 19773, 34, 45043, 34729, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 2822, 16463, 1011, 1669, 26059, 42, 4826, 1592, 1155, 692, 197, 71223, 1669, 8879, 17305, 445, 20474, 11069, 82, 497, 1613, 67880, 20...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestSingleAck(t *testing.T) { ctx := context.Background() ctx, cancel := context.WithTimeout(ctx, time.Second) defer cancel() workChan := make(chan *TestWork, 10) go testWorker(workChan) ack := ack.NewAckTree(ctx, func() { //we are good }, func(err error) { t.Errorf("Receive error %s", err.Error()) }) //send a test work with an ack tree workChan <- &TestWork{ack: ack, workTime: 10 * time.Millisecond} ack.Wait() if !ack.IsDone() { t.Errorf("AckTree should be done") } }
explode_data.jsonl/51887
{ "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, 10888, 55559, 1155, 353, 8840, 836, 8, 341, 20985, 1669, 2266, 19047, 741, 20985, 11, 9121, 1669, 2266, 26124, 7636, 7502, 11, 882, 32435, 340, 16867, 9121, 2822, 97038, 46019, 1669, 1281, 35190, 353, 2271, 6776, 11, 220, 16...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestIssue29993(t *testing.T) { store, clean := testkit.CreateMockStore(t) defer clean() orgEnable := core.PreparedPlanCacheEnabled() defer core.SetPreparedPlanCache(orgEnable) core.SetPreparedPlanCache(true) se, err := session.CreateSession4TestWithOpt(store, &session.Opt{ PreparedPlanCache: kvcache.NewSimpleLRUCache(100, 0.1, math.MaxUint64), }) require.NoError(t, err) tk := testkit.NewTestKitWithSession(t, store, se) tk.MustExec("use test") // test PointGet + cluster index tk.MustExec("set tidb_enable_clustered_index=on;") tk.MustExec("drop table if exists t;") tk.MustExec("CREATE TABLE `t` (`COL1` enum('a', 'b') NOT NULL PRIMARY KEY, col2 int) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;") tk.MustExec("insert into t values('a', 1), ('b', 2);") tk.MustExec("set @a='a', @b='b', @z='z';") tk.MustExec(`prepare stmt from 'select col1 from t where col1 = ? and col2 in (1, 2);';`) tk.MustQuery("execute stmt using @a").Check(testkit.Rows("a")) tk.MustQuery("execute stmt using @b").Check(testkit.Rows("b")) tk.MustQuery("select @@last_plan_from_cache").Check(testkit.Rows("1")) tk.MustQuery("execute stmt using @z").Check(testkit.Rows()) // The length of range have been changed, so the plan can not be cached. tk.MustQuery("select @@last_plan_from_cache").Check(testkit.Rows("0")) tk.MustQuery("execute stmt using @z").Check(testkit.Rows()) // test batchPointGet + cluster index tk.MustExec("drop table if exists t;") tk.MustExec("CREATE TABLE `t` (`COL1` enum('a', 'b') NOT NULL, col2 int, PRIMARY KEY(col1, col2)) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;") tk.MustExec("insert into t values('a', 1), ('b', 2);") tk.MustExec("set @a='a', @b='b', @z='z';") tk.MustExec(`prepare stmt from 'select col1 from t where (col1, col2) in ((?, 1));';`) tk.MustQuery("execute stmt using @a").Check(testkit.Rows("a")) tk.MustQuery("execute stmt using @b").Check(testkit.Rows()) tk.MustQuery("select @@last_plan_from_cache").Check(testkit.Rows("1")) tk.MustQuery("execute stmt using @z").Check(testkit.Rows()) tk.MustQuery("select @@last_plan_from_cache").Check(testkit.Rows("1")) tk.MustQuery("execute stmt using @z").Check(testkit.Rows()) // test PointGet + non cluster index tk.MustExec("set tidb_enable_clustered_index=off;") tk.MustExec("drop table if exists t;") tk.MustExec("CREATE TABLE `t` (`COL1` enum('a', 'b') NOT NULL PRIMARY KEY, col2 int) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;") tk.MustExec("insert into t values('a', 1), ('b', 2);") tk.MustExec("set @a='a', @b='b', @z='z';") tk.MustExec(`prepare stmt from 'select col1 from t where col1 = ? and col2 in (1, 2);';`) tk.MustQuery("execute stmt using @a").Check(testkit.Rows("a")) tk.MustQuery("execute stmt using @b").Check(testkit.Rows("b")) tk.MustQuery("select @@last_plan_from_cache").Check(testkit.Rows("1")) tk.MustQuery("execute stmt using @z").Check(testkit.Rows()) // The length of range have been changed, so the plan can not be cached. tk.MustQuery("select @@last_plan_from_cache").Check(testkit.Rows("0")) tk.MustQuery("execute stmt using @z").Check(testkit.Rows()) // test batchPointGet + non cluster index tk.MustExec("drop table if exists t;") tk.MustExec("CREATE TABLE `t` (`COL1` enum('a', 'b') NOT NULL, col2 int, PRIMARY KEY(col1, col2)) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;") tk.MustExec("insert into t values('a', 1), ('b', 2);") tk.MustExec("set @a='a', @b='b', @z='z';") tk.MustExec(`prepare stmt from 'select col1 from t where (col1, col2) in ((?, 1));';`) tk.MustQuery("execute stmt using @a").Check(testkit.Rows("a")) tk.MustQuery("execute stmt using @b").Check(testkit.Rows()) tk.MustQuery("select @@last_plan_from_cache").Check(testkit.Rows("1")) tk.MustQuery("execute stmt using @z").Check(testkit.Rows()) tk.MustQuery("select @@last_plan_from_cache").Check(testkit.Rows("1")) tk.MustQuery("execute stmt using @z").Check(testkit.Rows()) }
explode_data.jsonl/5535
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1527 }
[ 2830, 3393, 42006, 17, 24, 24, 24, 18, 1155, 353, 8840, 836, 8, 341, 57279, 11, 4240, 1669, 1273, 8226, 7251, 11571, 6093, 1155, 340, 16867, 4240, 741, 87625, 11084, 1669, 6200, 28770, 7212, 20485, 8233, 5462, 741, 16867, 6200, 4202, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestTConfiguration(t *testing.T) { invalidProtoID := THeaderProtocolID(-1) if invalidProtoID.Validate() == nil { t.Fatalf("Expected %v to be an invalid THeaderProtocolID, it passes the validation", invalidProtoID) } tlsConfig := &tls.Config{ Time: time.Now, } for _, c := range []struct { label string cfg *TConfiguration expectedMessageSize int32 expectedFrameSize int32 expectedConnectTimeout time.Duration expectedSocketTimeout time.Duration expectedTLSConfig *tls.Config expectedBinaryRead bool expectedBinaryWrite bool expectedProtoID THeaderProtocolID }{ { label: "nil", cfg: nil, expectedMessageSize: DEFAULT_MAX_MESSAGE_SIZE, expectedFrameSize: DEFAULT_MAX_FRAME_SIZE, expectedConnectTimeout: DEFAULT_CONNECT_TIMEOUT, expectedSocketTimeout: DEFAULT_SOCKET_TIMEOUT, expectedTLSConfig: nil, expectedBinaryRead: DEFAULT_TBINARY_STRICT_READ, expectedBinaryWrite: DEFAULT_TBINARY_STRICT_WRITE, expectedProtoID: THeaderProtocolDefault, }, { label: "empty", cfg: &TConfiguration{}, expectedMessageSize: DEFAULT_MAX_MESSAGE_SIZE, expectedFrameSize: DEFAULT_MAX_FRAME_SIZE, expectedConnectTimeout: DEFAULT_CONNECT_TIMEOUT, expectedSocketTimeout: DEFAULT_SOCKET_TIMEOUT, expectedTLSConfig: nil, expectedBinaryRead: DEFAULT_TBINARY_STRICT_READ, expectedBinaryWrite: DEFAULT_TBINARY_STRICT_WRITE, expectedProtoID: THeaderProtocolDefault, }, { label: "normal", cfg: &TConfiguration{ MaxMessageSize: 1024, MaxFrameSize: 1024, ConnectTimeout: time.Millisecond, SocketTimeout: time.Millisecond * 2, TLSConfig: tlsConfig, TBinaryStrictRead: BoolPtr(true), TBinaryStrictWrite: BoolPtr(false), THeaderProtocolID: THeaderProtocolIDPtrMust(THeaderProtocolCompact), }, expectedMessageSize: 1024, expectedFrameSize: 1024, expectedConnectTimeout: time.Millisecond, expectedSocketTimeout: time.Millisecond * 2, expectedTLSConfig: tlsConfig, expectedBinaryRead: true, expectedBinaryWrite: false, expectedProtoID: THeaderProtocolCompact, }, { label: "message<frame", cfg: &TConfiguration{ MaxMessageSize: 1024, MaxFrameSize: 4096, }, expectedMessageSize: 1024, expectedFrameSize: 1024, expectedConnectTimeout: DEFAULT_CONNECT_TIMEOUT, expectedSocketTimeout: DEFAULT_SOCKET_TIMEOUT, expectedTLSConfig: nil, expectedBinaryRead: DEFAULT_TBINARY_STRICT_READ, expectedBinaryWrite: DEFAULT_TBINARY_STRICT_WRITE, expectedProtoID: THeaderProtocolDefault, }, { label: "frame<message", cfg: &TConfiguration{ MaxMessageSize: 4096, MaxFrameSize: 1024, }, expectedMessageSize: 4096, expectedFrameSize: 1024, expectedConnectTimeout: DEFAULT_CONNECT_TIMEOUT, expectedSocketTimeout: DEFAULT_SOCKET_TIMEOUT, expectedTLSConfig: nil, expectedBinaryRead: DEFAULT_TBINARY_STRICT_READ, expectedBinaryWrite: DEFAULT_TBINARY_STRICT_WRITE, expectedProtoID: THeaderProtocolDefault, }, { label: "negative-message-size", cfg: &TConfiguration{ MaxMessageSize: -1, }, expectedMessageSize: DEFAULT_MAX_MESSAGE_SIZE, expectedFrameSize: DEFAULT_MAX_FRAME_SIZE, expectedConnectTimeout: DEFAULT_CONNECT_TIMEOUT, expectedSocketTimeout: DEFAULT_SOCKET_TIMEOUT, expectedTLSConfig: nil, expectedBinaryRead: DEFAULT_TBINARY_STRICT_READ, expectedBinaryWrite: DEFAULT_TBINARY_STRICT_WRITE, expectedProtoID: THeaderProtocolDefault, }, { label: "negative-frame-size", cfg: &TConfiguration{ MaxFrameSize: -1, }, expectedMessageSize: DEFAULT_MAX_MESSAGE_SIZE, expectedFrameSize: DEFAULT_MAX_FRAME_SIZE, expectedConnectTimeout: DEFAULT_CONNECT_TIMEOUT, expectedSocketTimeout: DEFAULT_SOCKET_TIMEOUT, expectedTLSConfig: nil, expectedBinaryRead: DEFAULT_TBINARY_STRICT_READ, expectedBinaryWrite: DEFAULT_TBINARY_STRICT_WRITE, expectedProtoID: THeaderProtocolDefault, }, { label: "negative-connect-timeout", cfg: &TConfiguration{ ConnectTimeout: -1, SocketTimeout: time.Millisecond, }, expectedMessageSize: DEFAULT_MAX_MESSAGE_SIZE, expectedFrameSize: DEFAULT_MAX_FRAME_SIZE, expectedConnectTimeout: DEFAULT_CONNECT_TIMEOUT, expectedSocketTimeout: time.Millisecond, expectedTLSConfig: nil, expectedBinaryRead: DEFAULT_TBINARY_STRICT_READ, expectedBinaryWrite: DEFAULT_TBINARY_STRICT_WRITE, expectedProtoID: THeaderProtocolDefault, }, { label: "negative-socket-timeout", cfg: &TConfiguration{ SocketTimeout: -1, }, expectedMessageSize: DEFAULT_MAX_MESSAGE_SIZE, expectedFrameSize: DEFAULT_MAX_FRAME_SIZE, expectedConnectTimeout: DEFAULT_CONNECT_TIMEOUT, expectedSocketTimeout: DEFAULT_SOCKET_TIMEOUT, expectedTLSConfig: nil, expectedBinaryRead: DEFAULT_TBINARY_STRICT_READ, expectedBinaryWrite: DEFAULT_TBINARY_STRICT_WRITE, expectedProtoID: THeaderProtocolDefault, }, { label: "invalid-proto-id", cfg: &TConfiguration{ THeaderProtocolID: &invalidProtoID, }, expectedMessageSize: DEFAULT_MAX_MESSAGE_SIZE, expectedFrameSize: DEFAULT_MAX_FRAME_SIZE, expectedConnectTimeout: DEFAULT_CONNECT_TIMEOUT, expectedSocketTimeout: DEFAULT_SOCKET_TIMEOUT, expectedTLSConfig: nil, expectedBinaryRead: DEFAULT_TBINARY_STRICT_READ, expectedBinaryWrite: DEFAULT_TBINARY_STRICT_WRITE, expectedProtoID: THeaderProtocolDefault, }, } { t.Run(c.label, func(t *testing.T) { t.Run("GetMaxMessageSize", func(t *testing.T) { actual := c.cfg.GetMaxMessageSize() if actual != c.expectedMessageSize { t.Errorf( "Expected %v, got %v", c.expectedMessageSize, actual, ) } }) t.Run("GetMaxFrameSize", func(t *testing.T) { actual := c.cfg.GetMaxFrameSize() if actual != c.expectedFrameSize { t.Errorf( "Expected %v, got %v", c.expectedFrameSize, actual, ) } }) t.Run("GetConnectTimeout", func(t *testing.T) { actual := c.cfg.GetConnectTimeout() if actual != c.expectedConnectTimeout { t.Errorf( "Expected %v, got %v", c.expectedConnectTimeout, actual, ) } }) t.Run("GetSocketTimeout", func(t *testing.T) { actual := c.cfg.GetSocketTimeout() if actual != c.expectedSocketTimeout { t.Errorf( "Expected %v, got %v", c.expectedSocketTimeout, actual, ) } }) t.Run("GetTLSConfig", func(t *testing.T) { actual := c.cfg.GetTLSConfig() if actual != c.expectedTLSConfig { t.Errorf( "Expected %p(%#v), got %p(%#v)", c.expectedTLSConfig, c.expectedTLSConfig, actual, actual, ) } }) t.Run("GetTBinaryStrictRead", func(t *testing.T) { actual := c.cfg.GetTBinaryStrictRead() if actual != c.expectedBinaryRead { t.Errorf( "Expected %v, got %v", c.expectedBinaryRead, actual, ) } }) t.Run("GetTBinaryStrictWrite", func(t *testing.T) { actual := c.cfg.GetTBinaryStrictWrite() if actual != c.expectedBinaryWrite { t.Errorf( "Expected %v, got %v", c.expectedBinaryWrite, actual, ) } }) t.Run("GetTHeaderProtocolID", func(t *testing.T) { actual := c.cfg.GetTHeaderProtocolID() if actual != c.expectedProtoID { t.Errorf( "Expected %v, got %v", c.expectedProtoID, actual, ) } }) }) } }
explode_data.jsonl/9726
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 3632 }
[ 2830, 3393, 51, 7688, 1155, 353, 8840, 836, 8, 341, 197, 11808, 31549, 915, 1669, 350, 4047, 20689, 915, 4080, 16, 340, 743, 8318, 31549, 915, 47667, 368, 621, 2092, 341, 197, 3244, 30762, 445, 18896, 1018, 85, 311, 387, 458, 8318, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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