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 TestExprEquals(t *testing.T) { // Scalars expr1 := &Expr{Terms: BooleanTerm(true)} expr2 := &Expr{Terms: BooleanTerm(true)} expr3 := &Expr{Terms: StringTerm("true")} assertExprEqual(t, expr1, expr2) assertExprNotEqual(t, expr1, expr3) // Vars, refs, and composites ref1 := RefTerm(VarTerm("foo"), StringTerm("bar"), VarTerm("i")) ref2 := RefTerm(VarTerm("foo"), StringTerm("bar"), VarTerm("i")) obj1 := ObjectTerm(Item(ref1, ArrayTerm(IntNumberTerm(1), NullTerm()))) obj2 := ObjectTerm(Item(ref2, ArrayTerm(IntNumberTerm(1), NullTerm()))) obj3 := ObjectTerm(Item(ref2, ArrayTerm(StringTerm("1"), NullTerm()))) expr10 := &Expr{Terms: obj1} expr11 := &Expr{Terms: obj2} expr12 := &Expr{Terms: obj3} assertExprEqual(t, expr10, expr11) assertExprNotEqual(t, expr10, expr12) // Builtins and negation expr20 := &Expr{ Negated: true, Terms: []*Term{StringTerm("="), VarTerm("x"), ref1}, } expr21 := &Expr{ Negated: true, Terms: []*Term{StringTerm("="), VarTerm("x"), ref1}, } expr22 := &Expr{ Negated: false, Terms: []*Term{StringTerm("="), VarTerm("x"), ref1}, } expr23 := &Expr{ Negated: true, Terms: []*Term{StringTerm("="), VarTerm("y"), ref1}, } assertExprEqual(t, expr20, expr21) assertExprNotEqual(t, expr20, expr22) assertExprNotEqual(t, expr20, expr23) // Modifiers expr30 := &Expr{ Terms: MustParseTerm("data.foo.bar"), With: []*With{ { Target: MustParseTerm("input"), Value: MustParseTerm("bar"), }, }, } expr31 := &Expr{ Terms: MustParseTerm("data.foo.bar"), With: []*With{ { Target: MustParseTerm("input"), Value: MustParseTerm("bar"), }, }, } expr32 := &Expr{ Terms: MustParseTerm("data.foo.bar"), With: []*With{ { Target: MustParseTerm("input.foo"), Value: MustParseTerm("baz"), }, }, } assertExprEqual(t, expr30, expr31) assertExprNotEqual(t, expr30, expr32) }
explode_data.jsonl/65303
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 841 }
[ 2830, 3393, 16041, 4315, 1155, 353, 8840, 836, 8, 1476, 197, 322, 80537, 198, 8122, 649, 16, 1669, 609, 16041, 90, 43128, 25, 6992, 17249, 3715, 10569, 8122, 649, 17, 1669, 609, 16041, 90, 43128, 25, 6992, 17249, 3715, 10569, 8122, 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 Test_Pool_Package_Option(t *testing.T) { p, _ := ports.PopRand() s := gtcp.NewServer(fmt.Sprintf(`:%d`, p), func(conn *gtcp.Conn) { defer conn.Close() option := gtcp.PkgOption{HeaderSize: 1} for { data, err := conn.RecvPkg(option) if err != nil { break } gtest.Assert(conn.SendPkg(data, option), nil) } }) go s.Run() defer s.Close() time.Sleep(100 * time.Millisecond) // SendRecvPkg with big data - failure. gtest.C(t, func(t *gtest.T) { conn, err := gtcp.NewPoolConn(fmt.Sprintf("127.0.0.1:%d", p)) t.Assert(err, nil) defer conn.Close() data := make([]byte, 0xFF+1) result, err := conn.SendRecvPkg(data, gtcp.PkgOption{HeaderSize: 1}) t.AssertNE(err, nil) t.Assert(result, nil) }) // SendRecvPkg with big data - success. gtest.C(t, func(t *gtest.T) { conn, err := gtcp.NewPoolConn(fmt.Sprintf("127.0.0.1:%d", p)) t.Assert(err, nil) defer conn.Close() data := make([]byte, 0xFF) data[100] = byte(65) data[200] = byte(85) result, err := conn.SendRecvPkg(data, gtcp.PkgOption{HeaderSize: 1}) t.Assert(err, nil) t.Assert(result, data) }) }
explode_data.jsonl/26288
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 530 }
[ 2830, 3393, 1088, 1749, 1088, 1434, 2232, 560, 1155, 353, 8840, 836, 8, 341, 3223, 11, 716, 1669, 20325, 47424, 56124, 741, 1903, 1669, 25161, 4672, 7121, 5475, 28197, 17305, 5809, 7533, 67, 7808, 281, 701, 2915, 20571, 353, 5178, 4672,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestUserUsageStatistics_LogSearchQuery(t *testing.T) { setupForTest(t) user := types.User{ ID: 1, } err := LogActivity(true, user.ID, "test-cookie-id", "SEARCHQUERY") if err != nil { t.Fatal(err) } a, err := GetByUserID(user.ID) if err != nil { t.Fatal(err) } if want := int32(1); a.SearchQueries != want { t.Errorf("got %d, want %d", a.SearchQueries, want) } }
explode_data.jsonl/27989
{ "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, 1474, 14783, 38599, 44083, 5890, 2859, 1155, 353, 8840, 836, 8, 341, 84571, 2461, 2271, 1155, 692, 19060, 1669, 4494, 7344, 515, 197, 29580, 25, 220, 16, 345, 197, 532, 9859, 1669, 2835, 4052, 3715, 11, 1196, 9910, 11, 330...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
4
func TestGeneratorDay(t *testing.T) { d1, err := epochdate.Parse(epochdate.RFC3339, "2013-08-02") if err != nil { t.Fatal(err) } d2, err := epochdate.Parse(epochdate.RFC3339, "2013-08-10") if err != nil { t.Fatal(err) } d3, err := epochdate.Parse(epochdate.RFC3339, "2013-08-05") if err != nil { t.Fatal(err) } // creates a new generator by day p, err := NewGenerator(d1, d2, DAY) if err != nil { t.Fatal(err) } ct := 0 for p.Next() { if ct == 3 && p.CurrentDate != d3 { t.Fatalf("Invalid date generated (%s - should be %s)", p.CurrentDate.String(), d3.String()) } ct++ } if ct != 9 { t.Fatalf("Should have generated 9 items, but generated %d", ct) } }
explode_data.jsonl/67727
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 313 }
[ 2830, 3393, 12561, 10159, 1155, 353, 8840, 836, 8, 341, 2698, 16, 11, 1848, 1669, 16342, 1028, 8937, 61290, 1028, 2013, 6754, 18, 18, 18, 24, 11, 330, 17, 15, 16, 18, 12, 15, 23, 12, 15, 17, 1138, 743, 1848, 961, 2092, 341, 197,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
9
func TestRequestParserMiddlewareReturnsErrorWhenSetQueryFails(t *testing.T) { handle := requestParserMiddleware(func(Context) (Handler, error) { return &badQueryHandler{}, nil }) req := httptest.NewRequest("GET", "/?hello=world", nil) ctrl := gomock.NewController(t) defer ctrl.Finish() mc := NewMockContext(ctrl) mc.EXPECT().Request().Return(req) err := handle(mc) assert.Error(t, err) }
explode_data.jsonl/18946
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 141 }
[ 2830, 3393, 1900, 6570, 24684, 16446, 1454, 4498, 1649, 2859, 37, 6209, 1155, 353, 8840, 836, 8, 341, 53822, 1669, 1681, 6570, 24684, 18552, 14001, 8, 320, 3050, 11, 1465, 8, 341, 197, 853, 609, 13855, 2859, 3050, 22655, 2092, 198, 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 TestRest_CreateAndGet(t *testing.T) { ts, _, teardown := startupT(t) defer teardown() // create comment resp, err := post(t, ts.URL+"/api/v1/comment", `{"text": "**test** *123*\n\n http://radio-t.com", "locator":{"url": "https://radio-t.com/blah1", "site": "remark42"}}`) require.NoError(t, err) require.Equal(t, http.StatusCreated, resp.StatusCode) b, err := ioutil.ReadAll(resp.Body) assert.NoError(t, err) c := R.JSON{} err = json.Unmarshal(b, &c) assert.NoError(t, err) id := c["id"].(string) // get created comment by id as admin res, code := getWithAdminAuth(t, fmt.Sprintf("%s/api/v1/id/%s?site=remark42&url=https://radio-t.com/blah1", ts.URL, id)) assert.Equal(t, 200, code) comment := store.Comment{} err = json.Unmarshal([]byte(res), &comment) assert.NoError(t, err) assert.Equal(t, "<p><strong>test</strong> <em>123</em></p>\n\n<p><a href=\"http://radio-t.com\" rel=\"nofollow\">http://radio-t.com</a></p>\n", comment.Text) assert.Equal(t, "**test** *123*\n\n http://radio-t.com", comment.Orig) assert.Equal(t, store.User{Name: "admin", ID: "admin", Admin: true, Blocked: false, IP: "dbc7c999343f003f189f70aaf52cc04443f90790"}, comment.User) // get created comment by id as non-admin res, code = getWithDevAuth(t, fmt.Sprintf("%s/api/v1/id/%s?site=remark42&url=https://radio-t.com/blah1", ts.URL, id)) assert.Equal(t, 200, code) comment = store.Comment{} err = json.Unmarshal([]byte(res), &comment) assert.NoError(t, err) assert.Equal(t, store.User{Name: "admin", ID: "admin", Admin: true, Blocked: false, IP: ""}, comment.User, "no ip") }
explode_data.jsonl/37392
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 684 }
[ 2830, 3393, 12416, 34325, 97726, 1155, 353, 8840, 836, 8, 341, 57441, 11, 8358, 49304, 1669, 20567, 51, 1155, 340, 16867, 49304, 2822, 197, 322, 1855, 3980, 198, 34653, 11, 1848, 1669, 1736, 1155, 11, 10591, 20893, 27569, 2068, 5457, 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 TestUnmarshal_WithTextUnmarshaler(t *testing.T) { type testStruct struct { Str testTextUnmarshaler Int testTextUnmarshaler Float testTextUnmarshaler Arraytable []testStruct } tests := []testcase{ { data: string(loadTestData("unmarshal-textunmarshaler.toml")), expect: &testStruct{ Str: "Unmarshaled: str", Int: "Unmarshaled: 11", Float: "Unmarshaled: 12.0", Arraytable: []testStruct{{Str: "Unmarshaled: str2", Int: "Unmarshaled: 22", Float: "Unmarshaled: 23.0"}}, }, }, { data: `str = "error"`, expect: &testStruct{Str: "Unmarshaled: error"}, err: lineErrorField(1, "toml.testStruct.Str", errTextUnmarshaler), }, } testUnmarshal(t, tests) }
explode_data.jsonl/52963
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 351 }
[ 2830, 3393, 1806, 27121, 62, 2354, 1178, 1806, 27121, 261, 1155, 353, 8840, 836, 8, 341, 13158, 1273, 9422, 2036, 341, 197, 197, 2580, 286, 1273, 1178, 1806, 27121, 261, 198, 197, 57152, 286, 1273, 1178, 1806, 27121, 261, 198, 197, 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 Test_Web_Before(t *testing.T) { Convey("Register before handlers", t, func() { m := New() m.Before(func(rw http.ResponseWriter, req *http.Request) bool { return false }) m.Before(func(rw http.ResponseWriter, req *http.Request) bool { return true }) resp := httptest.NewRecorder() req, err := http.NewRequest("GET", "/", nil) So(err, ShouldBeNil) m.ServeHTTP(resp, req) }) }
explode_data.jsonl/44975
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 162 }
[ 2830, 3393, 62, 5981, 1668, 4642, 1155, 353, 8840, 836, 8, 341, 93070, 5617, 445, 8690, 1573, 24083, 497, 259, 11, 2915, 368, 341, 197, 2109, 1669, 1532, 741, 197, 2109, 31153, 18552, 2601, 86, 1758, 37508, 11, 4232, 353, 1254, 9659, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestTerraformVariableWithNoDefault(t *testing.T) { resources := loadResourcesToTest(t, "./testdata/resources/uses_variables.tf") assert.Equal(t, len(resources), 1, "Expecting 1 resource") tags := getResourceTags(resources[0]) assert.Equal(t, tags["department"], "", "Unexpected value for variable with no default") }
explode_data.jsonl/49068
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 102 }
[ 2830, 3393, 51, 13886, 627, 7827, 2354, 2753, 3675, 1155, 353, 8840, 836, 8, 341, 10202, 2360, 1669, 2795, 11277, 1249, 2271, 1155, 11, 5924, 92425, 38900, 14, 4776, 28182, 68994, 1138, 6948, 12808, 1155, 11, 2422, 52607, 701, 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 TestDaoRemReplyZSetRds(t *testing.T) { convey.Convey("RemReplyZSetRds", t, func(ctx convey.C) { var ( name = "" oid = int64(0) tp = int(0) rpID = int64(0) ) ctx.Convey("When everything goes positive", func(ctx convey.C) { err := d.RemReplyZSetRds(context.Background(), name, oid, tp, rpID) ctx.Convey("Then err should be nil.", func(ctx convey.C) { ctx.So(err, convey.ShouldBeNil) }) }) }) }
explode_data.jsonl/21800
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 203 }
[ 2830, 3393, 12197, 6590, 20841, 57, 1649, 49, 5356, 1155, 353, 8840, 836, 8, 341, 37203, 5617, 4801, 5617, 445, 6590, 20841, 57, 1649, 49, 5356, 497, 259, 11, 2915, 7502, 20001, 727, 8, 341, 197, 2405, 2399, 298, 11609, 284, 8389, 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 TestNewOrder(t *testing.T) { t.Parallel() _, err := b.NewOrder("AUD", "BTC", 0, 0, "Bid", "limit", "testTest") if err == nil { t.Error("Test failed - NewOrder() error", err) } }
explode_data.jsonl/48990
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 79 }
[ 2830, 3393, 3564, 4431, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 741, 197, 6878, 1848, 1669, 293, 7121, 4431, 445, 61278, 497, 330, 59118, 497, 220, 15, 11, 220, 15, 11, 330, 65452, 497, 330, 9506, 497, 330, 1944, 2271, 1138...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestDockerComposeWithMultipleWaitStrategies(t *testing.T) { path := "./testresources/docker-compose-complex.yml" identifier := strings.ToLower(uuid.New().String()) compose := NewLocalDockerCompose([]string{path}, identifier, WithLogger(TestLogger(t))) destroyFn := func() { err := compose.Down() checkIfError(t, err) } defer destroyFn() err := compose. WithCommand([]string{"up", "-d"}). WithExposedService("mysql_1", 13306, wait.NewLogStrategy("started").WithStartupTimeout(10*time.Second)). WithExposedService("nginx_1", 9080, wait.NewHTTPStrategy("/").WithPort("80/tcp").WithStartupTimeout(10*time.Second)). Invoke() checkIfError(t, err) assert.Equal(t, 2, len(compose.Services)) assert.Contains(t, compose.Services, "nginx") assert.Contains(t, compose.Services, "mysql") }
explode_data.jsonl/43632
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 296 }
[ 2830, 3393, 35, 13659, 70492, 2354, 32089, 14190, 2580, 69388, 1155, 353, 8840, 836, 8, 341, 26781, 1669, 5924, 1944, 12745, 61764, 65070, 11476, 9111, 33936, 1837, 197, 15909, 1669, 9069, 29983, 41458, 7121, 1005, 703, 12367, 32810, 2900, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestTiKVMemberManagerSyncCreate(t *testing.T) { g := NewGomegaWithT(t) type testcase struct { name string prepare func(cluster *v1alpha1.TidbCluster) errWhenCreateStatefulSet bool errWhenCreateTiKVPeerService bool errWhenGetStores bool err bool tikvPeerSvcCreated bool setCreated bool pdStores *pdapi.StoresInfo tombstoneStores *pdapi.StoresInfo } testFn := func(test *testcase, t *testing.T) { t.Log(test.name) tc := newTidbClusterForPD() tc.Status.PD.Members = map[string]v1alpha1.PDMember{ "pd-0": {Name: "pd-0", Health: true}, "pd-1": {Name: "pd-1", Health: true}, "pd-2": {Name: "pd-2", Health: true}, } tc.Status.PD.StatefulSet = &apps.StatefulSetStatus{ReadyReplicas: 3} ns := tc.Namespace tcName := tc.Name oldSpec := tc.Spec if test.prepare != nil { test.prepare(tc) } tkmm, fakeSetControl, fakeSvcControl, pdClient, _, _ := newFakeTiKVMemberManager(tc) pdClient.AddReaction(pdapi.GetConfigActionType, func(action *pdapi.Action) (interface{}, error) { return &v1alpha1.PDConfig{ Replication: &v1alpha1.PDReplicationConfig{ LocationLabels: typeutil.StringSlice{"region", "zone", "rack", "host"}, }, }, nil }) if test.errWhenGetStores { pdClient.AddReaction(pdapi.GetStoresActionType, func(action *pdapi.Action) (interface{}, error) { return nil, fmt.Errorf("failed to get stores from tikv cluster") }) } else { pdClient.AddReaction(pdapi.GetStoresActionType, func(action *pdapi.Action) (interface{}, error) { return test.pdStores, nil }) pdClient.AddReaction(pdapi.GetTombStoneStoresActionType, func(action *pdapi.Action) (interface{}, error) { return test.tombstoneStores, nil }) pdClient.AddReaction(pdapi.SetStoreLabelsActionType, func(action *pdapi.Action) (interface{}, error) { return true, nil }) } if test.errWhenCreateStatefulSet { fakeSetControl.SetCreateStatefulSetError(errors.NewInternalError(fmt.Errorf("API server failed")), 0) } if test.errWhenCreateTiKVPeerService { fakeSvcControl.SetCreateServiceError(errors.NewInternalError(fmt.Errorf("API server failed")), 0) } err := tkmm.Sync(tc) if test.err { g.Expect(err).To(HaveOccurred()) } else { g.Expect(err).NotTo(HaveOccurred()) } g.Expect(tc.Spec).To(Equal(oldSpec)) svc, err := tkmm.svcLister.Services(ns).Get(controller.TiKVPeerMemberName(tcName)) if test.tikvPeerSvcCreated { g.Expect(err).NotTo(HaveOccurred()) g.Expect(svc).NotTo(Equal(nil)) } else { expectErrIsNotFound(g, err) } tc1, err := tkmm.setLister.StatefulSets(ns).Get(controller.TiKVMemberName(tcName)) if test.setCreated { g.Expect(err).NotTo(HaveOccurred()) g.Expect(tc1).NotTo(Equal(nil)) } else { expectErrIsNotFound(g, err) } } tests := []testcase{ { name: "normal", prepare: nil, errWhenCreateStatefulSet: false, errWhenCreateTiKVPeerService: false, err: false, tikvPeerSvcCreated: true, setCreated: true, pdStores: &pdapi.StoresInfo{Count: 0, Stores: []*pdapi.StoreInfo{}}, tombstoneStores: &pdapi.StoresInfo{Count: 0, Stores: []*pdapi.StoreInfo{}}, }, { name: "pd is not available", prepare: func(tc *v1alpha1.TidbCluster) { tc.Status.PD.Members = map[string]v1alpha1.PDMember{} }, errWhenCreateStatefulSet: false, errWhenCreateTiKVPeerService: false, err: true, tikvPeerSvcCreated: false, setCreated: false, pdStores: &pdapi.StoresInfo{Count: 0, Stores: []*pdapi.StoreInfo{}}, tombstoneStores: &pdapi.StoresInfo{Count: 0, Stores: []*pdapi.StoreInfo{}}, }, { name: "tidbcluster's storage format is wrong", prepare: func(tc *v1alpha1.TidbCluster) { tc.Spec.TiKV.Requests.Storage = "100xxxxi" }, errWhenCreateStatefulSet: false, errWhenCreateTiKVPeerService: false, err: true, tikvPeerSvcCreated: true, setCreated: false, pdStores: &pdapi.StoresInfo{Count: 0, Stores: []*pdapi.StoreInfo{}}, tombstoneStores: &pdapi.StoresInfo{Count: 0, Stores: []*pdapi.StoreInfo{}}, }, { name: "error when create statefulset", prepare: nil, errWhenCreateStatefulSet: true, errWhenCreateTiKVPeerService: false, err: true, tikvPeerSvcCreated: true, setCreated: false, pdStores: &pdapi.StoresInfo{Count: 0, Stores: []*pdapi.StoreInfo{}}, tombstoneStores: &pdapi.StoresInfo{Count: 0, Stores: []*pdapi.StoreInfo{}}, }, { name: "error when create tikv peer service", prepare: nil, errWhenCreateStatefulSet: false, errWhenCreateTiKVPeerService: true, err: true, tikvPeerSvcCreated: false, setCreated: false, pdStores: &pdapi.StoresInfo{Count: 0, Stores: []*pdapi.StoreInfo{}}, tombstoneStores: &pdapi.StoresInfo{Count: 0, Stores: []*pdapi.StoreInfo{}}, }, } for i := range tests { testFn(&tests[i], t) } }
explode_data.jsonl/37143
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 2820 }
[ 2830, 3393, 45351, 82707, 9366, 2043, 12154, 4021, 1155, 353, 8840, 836, 8, 341, 3174, 1669, 1532, 38, 32696, 2354, 51, 1155, 340, 13158, 70080, 2036, 341, 197, 11609, 5108, 914, 198, 197, 197, 13609, 2549, 2915, 48030, 353, 85, 16, 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 Test_NewPtrFromPtr_ReturnsPtrPtr(t *testing.T) { g := NewGomegaWithT(t) ptr := &DummyStruct{} ptrPtr := reflecthelpers.NewPtrFromValue(ptr) g.Expect(ptrPtr).To(BeAssignableToTypeOf(&ptr)) }
explode_data.jsonl/45832
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 82 }
[ 2830, 3393, 39582, 5348, 3830, 5348, 53316, 82, 5348, 5348, 1155, 353, 8840, 836, 8, 341, 3174, 1669, 1532, 38, 32696, 2354, 51, 1155, 692, 43811, 1669, 609, 43344, 9422, 16094, 43811, 5348, 1669, 8708, 21723, 7121, 5348, 3830, 1130, 23...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestTransferIXFRCurrent(t *testing.T) { transfer := newTestTransfer() testPlugin := transfer.Transferers[0].(*transfererPlugin) ctx := context.TODO() w := dnstest.NewMultiRecorder(&test.ResponseWriter{}) m := &dns.Msg{} m.SetIxfr(transfer.xfrs[0].Zones[0], testPlugin.Serial, "ns.dns."+testPlugin.Zone, "hostmaster.dns."+testPlugin.Zone) _, err := transfer.ServeDNS(ctx, w, m) if err != nil { t.Error(err) } if len(w.Msgs) == 0 { t.Fatal("Did not get back a zone response") } if len(w.Msgs[0].Answer) != 1 { t.Logf("%+v\n", w) t.Fatalf("Expected 1 answer, got %d", len(w.Msgs[0].Answer)) } // Ensure the answer is the SOA if w.Msgs[0].Answer[0].Header().Rrtype != dns.TypeSOA { t.Error("Answer does not contain the SOA record") } }
explode_data.jsonl/39438
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 326 }
[ 2830, 3393, 21970, 5396, 10504, 5405, 1155, 353, 8840, 836, 8, 341, 197, 24188, 1669, 501, 2271, 21970, 2822, 18185, 11546, 1669, 8317, 95802, 388, 58, 15, 936, 4071, 24188, 261, 11546, 692, 20985, 1669, 2266, 90988, 741, 6692, 1669, 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...
5
func TestSetLoggerWithClient(t *testing.T) { defer func() { client = nil logger = nil }() dialer := &mockDialer{} client, _ = grammes.Dial(dialer) Convey("Given a logger", t, func() { l := logging.NewBasicLogger() Convey("When SetLogger is called with a client established", func() { SetLogger(l) Convey("Then no errors should be encountered", func() { }) }) }) }
explode_data.jsonl/9673
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 152 }
[ 2830, 3393, 1649, 7395, 2354, 2959, 1155, 353, 8840, 836, 8, 341, 16867, 2915, 368, 341, 197, 25291, 284, 2092, 198, 197, 17060, 284, 2092, 198, 197, 69826, 2698, 530, 261, 1669, 609, 16712, 35, 530, 261, 16094, 25291, 11, 716, 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 TestGenConf(t *testing.T) { tmpl := "testdata/test_default.tmpl" tests := []struct { name string confInPath string confOutPath string confCorrectPath string }{ {"gen_new", "", "testdata/test_1.out", "testdata/test_1.out.correct"}, {"gen_update", "testdata/test_2.in", "testdata/test_2.out", "testdata/test_2.out.correct"}, {"gen_update_newvals", "testdata/test_3.in", "testdata/test_3.out", "testdata/test_3.out.correct"}, } for _, tt := range tests { t.Run(tt.name, test.WithoutPrivilege(func(t *testing.T) { defer os.Remove(tt.confOutPath) t.Log("Name:", tt.name) genConf(tmpl, tt.confInPath, tt.confOutPath) if eq, err := compareFile(tt.confOutPath, tt.confCorrectPath); err != nil { t.Fatalf("Unable to compare files: %v\n", err) } else if !eq { t.Fatalf("Output file %v does not match correct output %v\n", tt.confOutPath, tt.confCorrectPath) } })) } }
explode_data.jsonl/39274
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 410 }
[ 2830, 3393, 9967, 15578, 1155, 353, 8840, 836, 8, 341, 3244, 54010, 1669, 330, 92425, 12697, 9993, 33533, 500, 1837, 78216, 1669, 3056, 1235, 341, 197, 11609, 310, 914, 198, 197, 67850, 641, 1820, 414, 914, 198, 197, 67850, 2662, 1820, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestGetSignatureForDocument_fail_centrifugeId(t *testing.T) { client := &testingcommons.P2PMockClient{} coreDoc := testingcoredocument.GenerateCoreDocument() ctx := context.Background() centrifugeId, err := identity.ToCentID(utils.RandomSlice(identity.CentIDLength)) assert.Nil(t, err, "centrifugeId not initialized correctly ") randomBytes := utils.RandomSlice(identity.CentIDLength) signature := &coredocumentpb.Signature{EntityId: randomBytes, PublicKey: utils.RandomSlice(32)} sigResp := &p2ppb.SignatureResponse{ CentNodeVersion: version.GetVersion().String(), Signature: signature, } client.On("RequestDocumentSignature", ctx, mock.Anything, mock.Anything).Return(sigResp, nil).Once() resp, err := getSignatureForDocument(ctx, *coreDoc, client, centrifugeId) client.AssertExpectations(t) assert.Nil(t, resp, "must be nil") assert.Error(t, err, "must not be nil") assert.Contains(t, err.Error(), "[5]signature entity doesn't match provided centID") }
explode_data.jsonl/43227
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 340 }
[ 2830, 3393, 1949, 25088, 2461, 7524, 22121, 666, 23745, 333, 4733, 764, 1155, 353, 8840, 836, 8, 341, 25291, 1669, 609, 8840, 52361, 1069, 17, 8795, 1176, 2959, 16094, 71882, 9550, 1669, 7497, 2153, 6062, 57582, 5386, 7524, 741, 20985, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestErrorWhenProjectUpdateIDNotSent(t *testing.T) { event := &automate_event.EventMsg{ EventID: "lskdjflsdkfj", Type: &automate_event.EventType{Name: automate_event_type.ProjectRulesUpdate}, Published: ptypes.TimestampNow(), } _, err := suite.EventHandlerServer.HandleEvent(context.Background(), event) assert.Error(t, err) event = &automate_event.EventMsg{ EventID: "lskdjflsdkfj", Type: &automate_event.EventType{Name: automate_event_type.ProjectRulesUpdate}, Published: ptypes.TimestampNow(), Data: &_struct.Struct{ Fields: map[string]*_struct.Value{}, }, } assert.Error(t, err) event = &automate_event.EventMsg{ EventID: "lskdjflsdkfj", Type: &automate_event.EventType{Name: automate_event_type.ProjectRulesUpdate}, Published: ptypes.TimestampNow(), Data: &_struct.Struct{ Fields: map[string]*_struct.Value{ project_update_tags.ProjectUpdateIDTag: &_struct.Value{ Kind: &_struct.Value_StringValue{ StringValue: "", }, }, }, }, } assert.Error(t, err) }
explode_data.jsonl/17650
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 441 }
[ 2830, 3393, 1454, 4498, 7849, 4289, 915, 2623, 31358, 1155, 353, 8840, 836, 8, 341, 28302, 1669, 609, 27073, 349, 6748, 6904, 6611, 515, 197, 56055, 915, 25, 256, 330, 4730, 37744, 73, 1489, 51295, 69, 73, 756, 197, 27725, 25, 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...
1
func TestPoint_StringSize(t *testing.T) { testPoint_cube(t, func(p models.Point) { l := p.StringSize() s := p.String() if l != len(s) { t.Errorf("Incorrect length for %q. got %v, exp %v", s, l, len(s)) } }) }
explode_data.jsonl/16892
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 103 }
[ 2830, 3393, 2609, 31777, 1695, 1155, 353, 8840, 836, 8, 341, 18185, 2609, 64065, 1155, 11, 2915, 1295, 4119, 3775, 8, 341, 197, 8810, 1669, 281, 6431, 1695, 741, 197, 1903, 1669, 281, 6431, 2822, 197, 743, 326, 961, 2422, 1141, 8, 3...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestCopyFileSymlink(t *testing.T) { h := test.NewHelper(t) defer h.Cleanup() h.TempDir(".") testcases := map[string]string{ filepath.Join("./testdata/symlinks/file-symlink"): filepath.Join(h.Path("."), "dst-file"), filepath.Join("./testdata/symlinks/windows-file-symlink"): filepath.Join(h.Path("."), "windows-dst-file"), filepath.Join("./testdata/symlinks/invalid-symlink"): filepath.Join(h.Path("."), "invalid-symlink"), } for symlink, dst := range testcases { t.Run(symlink, func(t *testing.T) { var err error if err = copyFile(symlink, dst); err != nil { t.Fatalf("failed to copy symlink: %s", err) } var want, got string if runtime.GOOS == "windows" { // Creating symlinks on Windows require an additional permission // regular users aren't granted usually. So we copy the file // content as a fall back instead of creating a real symlink. srcb, err := ioutil.ReadFile(symlink) h.Must(err) dstb, err := ioutil.ReadFile(dst) h.Must(err) want = string(srcb) got = string(dstb) } else { want, err = os.Readlink(symlink) h.Must(err) got, err = os.Readlink(dst) if err != nil { t.Fatalf("could not resolve symlink: %s", err) } } if want != got { t.Fatalf("resolved path is incorrect. expected %s, got %s", want, got) } }) } }
explode_data.jsonl/72212
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 650 }
[ 2830, 3393, 12106, 1703, 34667, 44243, 1155, 353, 8840, 836, 8, 972, 9598, 1669, 1273, 7121, 5511, 1155, 1218, 16867, 305, 727, 60639, 3568, 9598, 65009, 6184, 5680, 30218, 18185, 23910, 1669, 2415, 14032, 30953, 1666, 197, 17661, 2343, 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...
5
func TestMsgDeposit(t *testing.T) { tests := []struct { proposalID uint64 depositorAddr sdk.AccAddress depositAmount sdk.Coins expectPass bool }{ {0, addrs[0], coinsPos, true}, {1, sdk.AccAddress{}, coinsPos, false}, {1, addrs[0], coinsZero, true}, {1, addrs[0], coinsMulti, true}, } for i, tc := range tests { msg := NewMsgDeposit(tc.depositorAddr, tc.proposalID, tc.depositAmount) if tc.expectPass { require.NoError(t, msg.ValidateBasic(), "test: %v", i) } else { require.Error(t, msg.ValidateBasic(), "test: %v", i) } } }
explode_data.jsonl/19186
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 251 }
[ 2830, 3393, 6611, 78982, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 3056, 1235, 341, 197, 197, 73874, 915, 262, 2622, 21, 19, 198, 197, 58351, 60950, 13986, 45402, 77538, 4286, 198, 197, 58351, 2724, 10093, 45402, 52114, 1330, 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...
3
func TestSyncPodWithHostNetwork(t *testing.T) { dm, fakeDocker := newTestDockerManager() pod := makePod("foo", &api.PodSpec{ Containers: []api.Container{ {Name: "bar"}, }, SecurityContext: &api.PodSecurityContext{ HostNetwork: true, }, }) runSyncPod(t, dm, fakeDocker, pod, nil, false) verifyCalls(t, fakeDocker, []string{ // Create pod infra container. "create", "start", "inspect_container", // Create container. "create", "start", "inspect_container", }) fakeDocker.Lock() if len(fakeDocker.Created) != 2 || !matchString(t, "/k8s_POD\\.[a-f0-9]+_foo_new_", fakeDocker.Created[0]) || !matchString(t, "/k8s_bar\\.[a-f0-9]+_foo_new_", fakeDocker.Created[1]) { t.Errorf("unexpected containers created %v", fakeDocker.Created) } fakeDocker.Unlock() newContainer, err := fakeDocker.InspectContainer(fakeDocker.Created[1]) if err != nil { t.Fatalf("unexpected error %v", err) } utsMode := newContainer.HostConfig.UTSMode if utsMode != "host" { t.Errorf("Pod with host network must have \"host\" utsMode, actual: \"%v\"", utsMode) } }
explode_data.jsonl/31177
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 430 }
[ 2830, 3393, 12154, 23527, 2354, 9296, 12320, 1155, 353, 8840, 836, 8, 341, 2698, 76, 11, 12418, 35, 13659, 1669, 501, 2271, 35, 13659, 2043, 741, 3223, 347, 1669, 1281, 23527, 445, 7975, 497, 609, 2068, 88823, 8327, 515, 197, 197, 746...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestRelogin(t *testing.T) { os.RemoveAll(profile.FullProfilePath("")) t.Cleanup(func() { os.RemoveAll(profile.FullProfilePath("")) }) connector := mockConnector(t) alice, err := types.NewUser("alice@example.com") require.NoError(t, err) alice.SetRoles([]string{"access"}) authProcess, proxyProcess := makeTestServers(t, connector, alice) authServer := authProcess.GetAuthServer() require.NotNil(t, authServer) proxyAddr, err := proxyProcess.ProxyWebAddr() require.NoError(t, err) err = Run([]string{ "login", "--insecure", "--debug", "--auth", connector.GetName(), "--proxy", proxyAddr.String(), }, cliOption(func(cf *CLIConf) error { cf.mockSSOLogin = mockSSOLogin(t, authServer, alice) return nil })) require.NoError(t, err) err = Run([]string{ "login", "--insecure", "--debug", "--proxy", proxyAddr.String(), "localhost", }) require.NoError(t, err) err = Run([]string{"logout"}) require.NoError(t, err) err = Run([]string{ "login", "--insecure", "--debug", "--auth", connector.GetName(), "--proxy", proxyAddr.String(), "localhost", }, cliOption(func(cf *CLIConf) error { cf.mockSSOLogin = mockSSOLogin(t, authServer, alice) return nil })) require.NoError(t, err) }
explode_data.jsonl/21927
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 515 }
[ 2830, 3393, 6740, 538, 258, 1155, 353, 8840, 836, 8, 341, 25078, 84427, 36606, 32038, 8526, 1820, 73303, 3244, 727, 60639, 18552, 368, 341, 197, 25078, 84427, 36606, 32038, 8526, 1820, 73303, 197, 8824, 32917, 1256, 1669, 7860, 35954, 115...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestACL_List(t *testing.T) { if CONSUL_ROOT == "" { t.SkipNow() } c := makeClient(t) c.config.Token = CONSUL_ROOT acl := c.ACL() acls, qm, err := acl.List(nil) if err != nil { t.Fatalf("err: %v", err) } if len(acls) < 2 { t.Fatalf("bad: %v", acls) } if qm.LastIndex == 0 { t.Fatalf("bad: %v", qm) } if !qm.KnownLeader { t.Fatalf("bad: %v", qm) } }
explode_data.jsonl/44595
{ "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, 55393, 27104, 1155, 353, 8840, 836, 8, 341, 743, 72906, 1094, 16197, 621, 1591, 341, 197, 3244, 57776, 7039, 741, 197, 532, 1444, 1669, 1281, 2959, 1155, 340, 1444, 5423, 32277, 284, 72906, 1094, 16197, 198, 11323, 564, 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...
6
func TestParseBoolEnv(t *testing.T) { const envKey = "ELASTIC_APM_TEST_BOOL" os.Unsetenv(envKey) defer os.Unsetenv(envKey) b, err := apmconfig.ParseBoolEnv(envKey, true) assert.NoError(t, err) assert.True(t, b) os.Setenv(envKey, "true") b, err = apmconfig.ParseBoolEnv(envKey, false) assert.NoError(t, err) assert.True(t, b) os.Setenv(envKey, "false") b, err = apmconfig.ParseBoolEnv(envKey, true) assert.NoError(t, err) assert.False(t, b) os.Setenv(envKey, "falsk") _, err = apmconfig.ParseBoolEnv(envKey, true) assert.EqualError(t, err, `failed to parse ELASTIC_APM_TEST_BOOL: strconv.ParseBool: parsing "falsk": invalid syntax`) }
explode_data.jsonl/63044
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 301 }
[ 2830, 3393, 14463, 11233, 14359, 1155, 353, 8840, 836, 8, 341, 4777, 6105, 1592, 284, 330, 2749, 6349, 1317, 1566, 8795, 11641, 32491, 698, 25078, 10616, 746, 3160, 16978, 1592, 340, 16867, 2643, 10616, 746, 3160, 16978, 1592, 692, 2233, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestTypeSystem_ScalarTypesMustBeSerializable_RejectsAScalarTypeDefiningParseLiteralButNotParseValue(t *testing.T) { _, err := schemaWithFieldType(graphql.NewScalar(graphql.ScalarConfig{ Name: "SomeScalar", Serialize: func(value interface{}) interface{} { return nil }, ParseLiteral: func(valueAST ast.Value) interface{} { return nil }, })) expectedError := `SomeScalar must provide both "parseValue" and "parseLiteral" functions.` if err == nil || err.Error() != expectedError { t.Fatalf("Expected error: %v, got %v", expectedError, err) } }
explode_data.jsonl/79171
{ "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, 929, 2320, 1098, 59153, 4173, 31776, 3430, 29268, 50693, 583, 82, 1911, 59153, 45102, 5740, 14463, 17350, 3983, 2623, 14463, 1130, 1155, 353, 8840, 836, 8, 1476, 197, 6878, 1848, 1669, 10802, 2354, 63733, 24312, 1470, 7121, 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 TestGetPutDel(t *testing.T) { t.Parallel() f := NewEtcdTestFixture(t) defer f.cleanup() testKeyValues := []KV{ {"a", "1"}, {"b", "2"}, {"c", "3"}, {"d", "4"}, {"e", "5"}, } for _, kv := range testKeyValues { f.Put(kv.key, kv.val) } db, err := newEtcdBackend(f.BackendConfig()) require.NoError(t, err) apply := func(stm STM) error { // Get some non existing keys. v, err := stm.Get("") require.NoError(t, err) require.Nil(t, v) v, err = stm.Get("x") require.NoError(t, err) require.Nil(t, v) // Get all existing keys. for _, kv := range testKeyValues { v, err = stm.Get(kv.key) require.NoError(t, err) require.Equal(t, []byte(kv.val), v) } // Overwrite, then delete an existing key. stm.Put("c", "6") v, err = stm.Get("c") require.NoError(t, err) require.Equal(t, []byte("6"), v) stm.Del("c") v, err = stm.Get("c") require.NoError(t, err) require.Nil(t, v) // Re-add the deleted key. stm.Put("c", "7") v, err = stm.Get("c") require.NoError(t, err) require.Equal(t, []byte("7"), v) // Add a new key. stm.Put("x", "x") v, err = stm.Get("x") require.NoError(t, err) require.Equal(t, []byte("x"), v) return nil } err = RunSTM(db.cli, apply) require.NoError(t, err) require.Equal(t, "1", f.Get("a")) require.Equal(t, "2", f.Get("b")) require.Equal(t, "7", f.Get("c")) require.Equal(t, "4", f.Get("d")) require.Equal(t, "5", f.Get("e")) require.Equal(t, "x", f.Get("x")) }
explode_data.jsonl/24937
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 733 }
[ 2830, 3393, 1949, 19103, 16532, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 2822, 1166, 1669, 1532, 31860, 4385, 69356, 1155, 340, 16867, 282, 87689, 2822, 18185, 1592, 6227, 1669, 3056, 82707, 515, 197, 197, 4913, 64, 497, 330, 16...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestTracepointErrors(t *testing.T) { c := qt.New(t) // Invalid Tracepoint incantations. _, err := Tracepoint("", "", nil, nil) // empty names c.Assert(errors.Is(err, errInvalidInput), qt.IsTrue) _, err = Tracepoint("_", "_", nil, nil) // empty prog c.Assert(errors.Is(err, errInvalidInput), qt.IsTrue) _, err = Tracepoint(".", "+", &ebpf.Program{}, nil) // illegal chars in group/name c.Assert(errors.Is(err, errInvalidInput), qt.IsTrue) _, err = Tracepoint("foo", "bar", &ebpf.Program{}, nil) // wrong prog type c.Assert(errors.Is(err, errInvalidInput), qt.IsTrue) }
explode_data.jsonl/27669
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 237 }
[ 2830, 3393, 6550, 2768, 13877, 1155, 353, 8840, 836, 8, 341, 1444, 1669, 38949, 7121, 1155, 692, 197, 322, 13882, 27163, 2768, 3625, 517, 804, 624, 197, 6878, 1848, 1669, 27163, 2768, 19814, 7342, 2092, 11, 2092, 8, 442, 4287, 5036, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestRetrieveInstanceIDFromPrivateDNS(t *testing.T) { ctrl := gomock.NewController(t) defer ctrl.Finish() api := mock.NewMockEC2API(ctrl) api.EXPECT().DescribeInstances(&ec2.DescribeInstancesInput{ Filters: []*ec2.Filter{ { Name: aws.String("private-dns-name"), Values: []*string{ aws.String("ip-10-0-1-23.ap-northeast-1.compute.internal"), }, }, }, }).Return(&ec2.DescribeInstancesOutput{ Reservations: []*ec2.Reservation{ { Instances: []*ec2.Instance{ { InstanceId: aws.String("i-1234abcd"), PrivateDnsName: aws.String("ip-10-0-1-23.ap-northeast-1.compute.internal"), }, }, }, }, }, nil) client := &Client{ api: api, } privateDNS := "ip-10-0-1-23.ap-northeast-1.compute.internal" expected := "i-1234abcd" got, err := client.RetrieveInstanceIDFromPrivateDNS(privateDNS) if err != nil { t.Errorf("error should not be raised: %s", err) } if got != expected { t.Errorf("instance ID does not match. expected: %q, got: %q", expected, got) } }
explode_data.jsonl/8895
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 471 }
[ 2830, 3393, 87665, 2523, 915, 3830, 16787, 61088, 1155, 353, 8840, 836, 8, 341, 84381, 1669, 342, 316, 1176, 7121, 2051, 1155, 340, 16867, 23743, 991, 18176, 2822, 54299, 1669, 7860, 7121, 11571, 7498, 17, 7082, 62100, 340, 54299, 22402, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestWorkerRetry(t *testing.T) { pool := newTestPool(":6379") ns := "work" job1 := "job1" deleteQueue(pool, ns, job1) deleteRetryAndDead(pool, ns) deletePausedAndLockedKeys(ns, job1, pool) jobTypes := make(map[string]*jobType) jobTypes[job1] = &jobType{ Name: job1, JobOptions: JobOptions{Priority: 1, MaxFails: 3}, IsGeneric: true, GenericHandler: func(job *Job) error { return fmt.Errorf("sorry kid") }, } enqueuer := NewEnqueuer(ns, pool) _, err := enqueuer.Enqueue(job1, Q{"a": 1}) assert.Nil(t, err) w := newWorker(ns, "1", pool, tstCtxType, nil, jobTypes, nil) w.start() w.drain() w.stop() // Ensure the right stuff is in our queues: assert.EqualValues(t, 1, zsetSize(pool, redisKeyRetry(ns))) assert.EqualValues(t, 0, zsetSize(pool, redisKeyDead(ns))) assert.EqualValues(t, 0, listSize(pool, redisKeyJobs(ns, job1))) assert.EqualValues(t, 0, listSize(pool, redisKeyJobsInProgress(ns, "1", job1))) assert.EqualValues(t, 0, getInt64(pool, redisKeyJobsLock(ns, job1))) assert.EqualValues(t, 0, hgetInt64(pool, redisKeyJobsLockInfo(ns, job1), w.poolID)) // Get the job on the retry queue ts, job := jobOnZset(pool, redisKeyRetry(ns)) assert.True(t, ts > nowEpochSeconds()) // enqueued in the future assert.True(t, ts < (nowEpochSeconds()+80)) // but less than a minute from now (first failure) assert.Equal(t, job1, job.Name) // basics are preserved assert.EqualValues(t, 1, job.Fails) assert.Equal(t, "sorry kid", job.LastErr) assert.True(t, (nowEpochSeconds()-job.FailedAt) <= 2) }
explode_data.jsonl/35597
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 649 }
[ 2830, 3393, 21936, 51560, 1155, 353, 8840, 836, 8, 341, 85273, 1669, 501, 2271, 10551, 18893, 21, 18, 22, 24, 1138, 84041, 1669, 330, 1778, 698, 68577, 16, 1669, 330, 8799, 16, 698, 15618, 7554, 41838, 11, 12268, 11, 2618, 16, 340, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestBuildQuery(t *testing.T) { pattern := ":[x~*]" want := "error parsing regexp: missing argument to repetition operator: `*`" t.Run("build query", func(t *testing.T) { _, err := buildQuery(&search.TextPatternInfo{Pattern: pattern}, nil, nil, false) if diff := cmp.Diff(err.Error(), want); diff != "" { t.Error(diff) } }) }
explode_data.jsonl/5450
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 126 }
[ 2830, 3393, 11066, 2859, 1155, 353, 8840, 836, 8, 341, 3223, 3227, 1669, 330, 7259, 87, 93, 9, 38445, 50780, 1669, 330, 841, 22314, 41877, 25, 7402, 5693, 311, 53415, 5675, 25, 1565, 9, 63, 698, 3244, 16708, 445, 5834, 3239, 497, 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...
2
func TestDetectTxnOrderViolation(t *testing.T) { var errOrderViolation = errors.New("DetectedOrderViolation") integration.BeforeTest(t) clus := integration.NewClusterV3(t, &integration.ClusterConfig{Size: 3}) defer clus.Terminate(t) cfg := clientv3.Config{ Endpoints: []string{ clus.Members[0].GRPCAddr(), clus.Members[1].GRPCAddr(), clus.Members[2].GRPCAddr(), }, } cli, err := clientv3.New(cfg) if err != nil { t.Fatal(err) } defer func() { assert.NoError(t, cli.Close()) }() ctx := context.TODO() if _, err = clus.Client(0).Put(ctx, "foo", "bar"); err != nil { t.Fatal(err) } // ensure that the second member has the current revision for the key foo if _, err = clus.Client(1).Get(ctx, "foo"); err != nil { t.Fatal(err) } // stop third member in order to force the member to have an outdated revision clus.Members[2].Stop(t) time.Sleep(1 * time.Second) // give enough time for operation if _, err = clus.Client(1).Put(ctx, "foo", "buzz"); err != nil { t.Fatal(err) } // perform get request against the first member, in order to // set up kvOrdering to expect "foo" revisions greater than that of // the third member. orderingKv := ordering.NewKV(cli.KV, func(op clientv3.Op, resp clientv3.OpResponse, prevRev int64) error { return errOrderViolation }) orderingTxn := orderingKv.Txn(ctx) _, err = orderingTxn.If( clientv3.Compare(clientv3.Value("b"), ">", "a"), ).Then( clientv3.OpGet("foo"), ).Commit() if err != nil { t.Fatal(err) } // ensure that only the third member is queried during requests clus.Members[0].Stop(t) clus.Members[1].Stop(t) assert.NoError(t, clus.Members[2].Restart(t)) // force OrderingKv to query the third member cli.SetEndpoints(clus.Members[2].GRPCAddr()) time.Sleep(2 * time.Second) // FIXME: Figure out how pause SetEndpoints sufficiently that this is not needed _, err = orderingKv.Get(ctx, "foo", clientv3.WithSerializable()) if err != errOrderViolation { t.Fatalf("expected %v, got %v", errOrderViolation, err) } orderingTxn = orderingKv.Txn(ctx) _, err = orderingTxn.If( clientv3.Compare(clientv3.Value("b"), ">", "a"), ).Then( clientv3.OpGet("foo", clientv3.WithSerializable()), ).Commit() if err != errOrderViolation { t.Fatalf("expected %v, got %v", errOrderViolation, err) } }
explode_data.jsonl/31205
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 893 }
[ 2830, 3393, 57193, 31584, 77, 4431, 74971, 1155, 353, 8840, 836, 8, 341, 2405, 1848, 4431, 74971, 284, 5975, 7121, 445, 17076, 1569, 4431, 74971, 5130, 2084, 17376, 31153, 2271, 1155, 340, 197, 4163, 1669, 17590, 7121, 28678, 53, 18, 11...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestGetHTML(t *testing.T) { if shoulSkip() { t.Skip("API_KEY required") return } parameter := map[string]string{ "q": "Coffee", "location": "Portland"} setup() client := NewGoogleSearch(parameter) data, err := client.GetHTML() if err != nil { t.Error("err must be nil") return } if !strings.Contains(*data, "</html>") { t.Error("data does not contains <html> tag") } }
explode_data.jsonl/19464
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 167 }
[ 2830, 3393, 1949, 5835, 1155, 353, 8840, 836, 8, 341, 743, 557, 10965, 35134, 368, 341, 197, 3244, 57776, 445, 7082, 6600, 2567, 1138, 197, 853, 198, 197, 630, 197, 16181, 1669, 2415, 14032, 30953, 515, 197, 197, 1, 80, 788, 286, 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...
4
func TestTopkGroupbyFields1(t *testing.T) { // Build the processor var topk TopK topk = *New() topk.Period = oneSecondDuration topk.K = 4 // This settings generate less than 3 groups topk.Aggregation = "mean" topk.AddAggregateFields = []string{"A"} topk.GroupBy = []string{"tag1", "tag2"} topk.Fields = []string{"A"} // Get the input input := deepCopy(MetricsSet2) // Generate the answer changeSet := map[int]metricChange{ 0: {newFields: fieldList(field{"A_topk_aggregate", float64(95.36)})}, 1: {newFields: fieldList(field{"A_topk_aggregate", float64(39.01)})}, 2: {newFields: fieldList(field{"A_topk_aggregate", float64(39.01)})}, 5: {newFields: fieldList(field{"A_topk_aggregate", float64(29.45)})}, } answer := generateAns(input, changeSet) // Run the test runAndCompare(&topk, input, answer, "GroupBy Fields test 1", t) }
explode_data.jsonl/64777
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 335 }
[ 2830, 3393, 5366, 74, 2808, 1694, 8941, 16, 1155, 353, 8840, 836, 8, 341, 197, 322, 7854, 279, 17654, 198, 2405, 1909, 74, 6909, 42, 198, 42118, 74, 284, 353, 3564, 741, 42118, 74, 14834, 3127, 284, 825, 15666, 12945, 198, 42118, 74...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestGetInstanceEni(t *testing.T) { instanceId := "instanceId" if res, err := BBC_CLIENT.GetInstanceEni(instanceId); err != nil { fmt.Println("Get specific instance eni failed: ", err) } else { fmt.Println("Get specific instance eni success, result: ", res) } }
explode_data.jsonl/4074
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 97 }
[ 2830, 3393, 42761, 1702, 72, 1155, 353, 8840, 836, 8, 341, 56256, 764, 1669, 330, 4851, 764, 698, 743, 592, 11, 1848, 1669, 18096, 22521, 53048, 1702, 72, 21650, 764, 1215, 1848, 961, 2092, 341, 197, 11009, 12419, 445, 1949, 3151, 286...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestCheckSyntax(t *testing.T) { type args struct { format model.ConfigFormat content string } tests := []struct { name string args args wantErr bool }{ { name: "INI syntax check", args: args{ format: model.ConfigFormatIni, content: `[hello] a= 1 1234`, }, wantErr: true, }, { name: "INI syntax check", args: args{ format: model.ConfigFormatIni, content: `[hello] a= 1 avc= 1234`, }, wantErr: false, }, { name: "YAML syntax check", args: args{ format: model.ConfigFormatYaml, content: `hello: nihao: 1 list: - item: 1 - item: 2 `, }, wantErr: false, }, { name: "YAML syntax check", args: args{ format: model.ConfigFormatYaml, content: `hello: nihao: 1 list: - item: 1 - item: { `, }, wantErr: true, }, { name: "TOML syntax check", args: args{ format: model.ConfigFormatToml, content: `[config] key = 123 value = 123 list = [1, 2, 3]`, }, wantErr: false, }, { name: "TOML syntax check", args: args{ format: model.ConfigFormatToml, content: `[config] key = 123 value = asdas 123 list = [1, 2, 3`, }, wantErr: true, }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { if err := CheckSyntax(tt.args.format, tt.args.content); (err != nil) != tt.wantErr { t.Errorf("CheckSyntax() error = %v, wantErr %v", err, tt.wantErr) } else { t.Logf("err = %v", err) } }) } }
explode_data.jsonl/61180
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 761 }
[ 2830, 3393, 3973, 33890, 1155, 353, 8840, 836, 8, 341, 13158, 2827, 2036, 341, 197, 59416, 220, 1614, 10753, 4061, 198, 197, 27751, 914, 198, 197, 532, 78216, 1669, 3056, 1235, 341, 197, 11609, 262, 914, 198, 197, 31215, 262, 2827, 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...
2
func TestListWithNextPage(t *testing.T) { ctrl := gomock.NewController(t) defer ctrl.Finish() resourceID := "/subscriptions/subscriptionID/resourceGroups/rg/providers/Microsoft.Compute/virtualMachines" armClient := mockarmclient.NewMockInterface(ctrl) vmList := []compute.VirtualMachine{getTestVM("vm1"), getTestVM("vm2"), getTestVM("vm3")} partialResponse, err := json.Marshal(compute.VirtualMachineListResult{Value: &vmList, NextLink: to.StringPtr("nextLink")}) assert.NoError(t, err) pagedResponse, err := json.Marshal(compute.VirtualMachineListResult{Value: &vmList}) assert.NoError(t, err) armClient.EXPECT().PrepareGetRequest(gomock.Any(), gomock.Any()).Return(&http.Request{}, nil) armClient.EXPECT().Send(gomock.Any(), gomock.Any()).Return( &http.Response{ StatusCode: http.StatusOK, Body: ioutil.NopCloser(bytes.NewReader(pagedResponse)), }, nil) armClient.EXPECT().GetResource(gomock.Any(), resourceID, "").Return( &http.Response{ StatusCode: http.StatusOK, Body: ioutil.NopCloser(bytes.NewReader(partialResponse)), }, nil).Times(1) armClient.EXPECT().CloseResponse(gomock.Any(), gomock.Any()).Times(2) vmClient := getTestVMClient(armClient) result, rerr := vmClient.List(context.TODO(), "rg") assert.Nil(t, rerr) assert.Equal(t, 6, len(result)) }
explode_data.jsonl/16691
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 491 }
[ 2830, 3393, 852, 2354, 5847, 2665, 1155, 353, 8840, 836, 8, 341, 84381, 1669, 342, 316, 1176, 7121, 2051, 1155, 340, 16867, 23743, 991, 18176, 2822, 50346, 915, 1669, 3521, 72560, 14, 34404, 915, 53100, 22173, 14, 1984, 82543, 10270, 39...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestPool(t *testing.T) { p := NewPool() p.Free <- Host{ID: "free_node", Status: "Active"} println("here") println(strconv.Itoa(len(p.Free))) for i := 0; i <= 10; i++ { p.Booting <- Host{ID: strconv.Itoa(i), Status: "Booting"} time.Sleep(1 * time.Second) } //time.Sleep(30 * time.Second) }
explode_data.jsonl/68819
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 131 }
[ 2830, 3393, 10551, 1155, 353, 8840, 836, 8, 341, 3223, 1669, 1532, 10551, 741, 3223, 52229, 9119, 16102, 90, 915, 25, 330, 10593, 5084, 497, 8104, 25, 330, 5728, 16707, 81168, 445, 6739, 1138, 81168, 4199, 12027, 64109, 6901, 1295, 5222...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestStraightPipeline_Process(t *testing.T) { spliter := NewSplitFilter("-") converter := NewToIntFileter() sum := NewSumFilter() sp := NewStraightPipeline("p1",spliter,converter,sum) ret,err := sp.Process("1-2-6") if err != nil { t.Fatal(err) } fmt.Println(ret) //if ret != 6 { // t.Fatalf("The expected is 6 ,but the actual is %d",ret) //} }
explode_data.jsonl/9189
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 154 }
[ 2830, 3393, 88854, 34656, 70241, 1155, 353, 8840, 836, 8, 341, 1903, 500, 2015, 1669, 1532, 20193, 5632, 13645, 1138, 37203, 8721, 1669, 1532, 38544, 1703, 465, 741, 31479, 1669, 1532, 9190, 5632, 741, 41378, 1669, 1532, 88854, 34656, 445...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestShouldEscape(t *testing.T) { for _, tt := range shouldEscapeTests { if shouldEscape(tt.in, tt.mode) != tt.escape { t.Errorf("shouldEscape(%q, %v) returned %v; expected %v", tt.in, tt.mode, !tt.escape, tt.escape) } } }
explode_data.jsonl/71733
{ "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, 14996, 48124, 1155, 353, 8840, 836, 8, 341, 2023, 8358, 17853, 1669, 2088, 1265, 48124, 18200, 341, 197, 743, 1265, 48124, 47152, 1858, 11, 17853, 22981, 8, 961, 17853, 57081, 341, 298, 3244, 13080, 445, 5445, 48124, 15238, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestRecordCodec_NativeToBinary_StructWithNestedList(t *testing.T) { record := struct { Age int `id:"1"` Name string `id:"2"` Address string `id:"3"` Date time.Time `id:"5"` OtherNames [][]string `id:"4"` }{ Age: 20, Name: "bob", Address: "20. Classy Street", Date: time.Now(), OtherNames: [][]string{ []string{"wreckage", "went into downtown"}, []string{"moppers guild", "God is Love"}, []string{"Is His always Faithful!"}, }, } var codec codecs.RecordCodec encoded, err := codec.NativeToBinary(record, []byte{}) if err != nil { tests.FailedWithError(err, "Should have successfully encoded value with record codec") } tests.Passed("Should have successfully encoded value with record codec") if jsonEncoded, err := json.Marshal(record); err == nil { tests.Info("JSON Encoded Length: %d", len(jsonEncoded)) tests.Info("Voxa Encoded Length: %d", len(encoded)) } res := &(struct { Age int `id:"1"` Name string `id:"2"` Address string `id:"3"` OtherNames [][]string `id:"4"` Date time.Time `id:"5"` }{}) err = codec.BinaryToNative(encoded, reflect.ValueOf(res)) if err != nil { tests.FailedWithError(err, "Should have successfully decoded value with record codec") } tests.Passed("Should have successfully decoded value with record codec") if res.Date.Unix() != record.Date.Unix() { tests.Failed("Date not matching") } if res.Name != record.Name { tests.Failed("Name not matching") } if res.Age != record.Age { tests.Failed("Age not matching") } if res.Address != record.Address { tests.Failed("Address not matching") } if !reflect.DeepEqual(res.OtherNames, record.OtherNames) { tests.Failed("Should have matching elements between input and res") } tests.Passed("Should have matching elements between input and res") }
explode_data.jsonl/29906
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 737 }
[ 2830, 3393, 6471, 36913, 98233, 1249, 21338, 72246, 2354, 71986, 852, 1155, 353, 8840, 836, 8, 341, 71952, 1669, 2036, 341, 197, 197, 16749, 286, 526, 286, 1565, 307, 2974, 16, 8805, 197, 21297, 981, 914, 257, 1565, 307, 2974, 17, 880...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
9
func TestEmptyProperties(t *testing.T) { callErr, funcErr, assert, callBuffer, funcBuffer := testOpenAPITypeWriter(t, ` package foo // Blah demonstrate a struct without fields. type Blah struct { } `) if callErr != nil { t.Fatal(callErr) } if funcErr != nil { t.Fatal(funcErr) } assert.Equal(`"base/foo.Blah": schema_base_foo_Blah(ref), `, callBuffer.String()) assert.Equal(`func schema_base_foo_Blah(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ SchemaProps: spec.SchemaProps{ Description: "Blah demonstrate a struct without fields.", Type: []string{"object"}, }, }, } } `, funcBuffer.String()) }
explode_data.jsonl/3341
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 251 }
[ 2830, 3393, 3522, 7903, 1155, 353, 8840, 836, 8, 341, 67288, 7747, 11, 2915, 7747, 11, 2060, 11, 1618, 4095, 11, 2915, 4095, 1669, 1273, 5002, 7082, 929, 6492, 1155, 11, 22074, 1722, 15229, 271, 322, 2502, 1466, 19869, 264, 2036, 2041...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestTemplateAddBlock(t *testing.T) { tpl := &Template{Blocks: map[string]*Block{}} b := &Block{Name: "name"} tpl.AddBlock(b.Name, b) if len(tpl.Blocks) != 1 || tpl.Blocks[b.Name] != b { t.Errorf("The template's blocks are invalid.") } }
explode_data.jsonl/74605
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 102 }
[ 2830, 3393, 7275, 2212, 4713, 1155, 353, 8840, 836, 8, 341, 3244, 500, 1669, 609, 7275, 90, 29804, 25, 2415, 14032, 8465, 4713, 6257, 532, 2233, 1669, 609, 4713, 63121, 25, 330, 606, 16707, 3244, 500, 1904, 4713, 1883, 2967, 11, 293, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestGetIDHappyPath(t *testing.T) { taskNormalARN := Task{ Arn: "arn:aws:ecs:region:account-id:task/task-id", } taskLongARN := Task{ Arn: "arn:aws:ecs:region:account-id:task/cluster-name/task-id", } taskID, err := taskNormalARN.GetID() assert.NoError(t, err) assert.Equal(t, "task-id", taskID) taskID, err = taskLongARN.GetID() assert.NoError(t, err) assert.Equal(t, "task-id", taskID) }
explode_data.jsonl/37220
{ "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, 1949, 915, 32847, 1820, 1155, 353, 8840, 836, 8, 341, 49115, 12206, 9051, 1669, 5430, 515, 197, 197, 58331, 25, 330, 1885, 25, 8635, 25, 53717, 25, 3943, 25, 4608, 12897, 25, 8202, 58186, 12897, 756, 197, 532, 49115, 6583,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestListPostsubmit(t *testing.T) { c := &Config{ JobConfig: JobConfig{ Presubmits: map[string][]Presubmit{ "r1": {{Name: "a"}}, }, Postsubmits: map[string][]Postsubmit{ "r1": { { Name: "c", RunAfterSuccess: []Postsubmit{ {Name: "ca"}, {Name: "cb"}, }, }, {Name: "d"}, }, "r2": {{Name: "e"}}, }, Periodics: []Periodic{ {Name: "f"}, }, }, } var testcases = []struct { name string expected []string repos []string }{ { "all postsubmits", []string{"c", "ca", "cb", "d", "e"}, []string{}, }, { "r2 presubmits", []string{"e"}, []string{"r2"}, }, } for _, tc := range testcases { actual := c.AllPostsubmits(tc.repos) if len(actual) != len(tc.expected) { t.Fatalf("%s - Wrong number of jobs. Got %v, expected %v", tc.name, actual, tc.expected) } for _, j1 := range tc.expected { found := false for _, j2 := range actual { if j1 == j2.Name { found = true break } } if !found { t.Errorf("Did not find job %s in output", j1) } } } }
explode_data.jsonl/36540
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 572 }
[ 2830, 3393, 852, 4133, 5955, 1155, 353, 8840, 836, 8, 341, 1444, 1669, 609, 2648, 515, 197, 197, 12245, 2648, 25, 12011, 2648, 515, 298, 10025, 416, 392, 44703, 25, 2415, 14032, 45725, 14367, 392, 1763, 515, 571, 197, 1, 81, 16, 788...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestPlanCacheSchemaChange(t *testing.T) { orgEnable := plannercore.PreparedPlanCacheEnabled() defer func() { plannercore.SetPreparedPlanCache(orgEnable) }() plannercore.SetPreparedPlanCache(true) store, clean := createMockStoreAndSetup(t) defer clean() tk := testkit.NewTestKit(t, store) tk2 := testkit.NewTestKit(t, store) tk3 := testkit.NewTestKit(t, store) ctx := context.Background() tk.MustExec("use test") tk2.MustExec("use test") tk3.MustExec("use test") tk.MustExec("drop table if exists t") tk.MustExec("create table t (id int primary key, v int, unique index iv (v), vv int)") tk.MustExec("insert into t values(1, 1, 1), (2, 2, 2), (4, 4, 4)") tk.MustExec("set tidb_enable_amend_pessimistic_txn = 1") tk2.MustExec("set tidb_enable_amend_pessimistic_txn = 1") // generate plan cache tk.MustExec("prepare update_stmt from 'update t set vv = vv + 1 where v = ?'") tk.MustExec("set @v = 1") tk.MustExec("execute update_stmt using @v") stmtID, _, _, err := tk2.Session().PrepareStmt("update t set vv = vv + 1 where v = ?") require.NoError(t, err) _, err = tk2.Session().ExecutePreparedStmt(ctx, stmtID, []types.Datum{types.NewDatum(1)}) require.NoError(t, err) tk.MustExec("begin pessimistic") tk2.MustExec("begin pessimistic") tk3.MustExec("alter table t drop index iv") tk3.MustExec("update t set v = 3 where v = 2") tk3.MustExec("update t set v = 5 where v = 4") tk.MustExec("set @v = 2") tk.MustExec("execute update_stmt using @v") tk.CheckExecResult(0, 0) tk.MustQuery("select @@last_plan_from_cache").Check(testkit.Rows("0")) tk.MustExec("set @v = 3") tk.MustExec("execute update_stmt using @v") tk.CheckExecResult(1, 0) tk.MustQuery("select @@last_plan_from_cache").Check(testkit.Rows("1")) _, err = tk2.Session().ExecutePreparedStmt(ctx, stmtID, []types.Datum{types.NewDatum(4)}) require.NoError(t, err) tk2.CheckExecResult(0, 0) tk2.MustQuery("select @@last_plan_from_cache").Check(testkit.Rows("0")) _, err = tk2.Session().ExecutePreparedStmt(ctx, stmtID, []types.Datum{types.NewDatum(5)}) require.NoError(t, err) tk2.CheckExecResult(1, 0) tk2.MustQuery("select @@last_plan_from_cache").Check(testkit.Rows("1")) tk.MustExec("commit") tk2.MustExec("commit") tk.MustQuery("select * from t").Check(testkit.Rows("1 1 3", "2 3 3", "4 5 5")) }
explode_data.jsonl/12503
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 921 }
[ 2830, 3393, 20485, 8233, 8632, 4072, 1155, 353, 8840, 836, 8, 341, 87625, 11084, 1669, 49711, 2153, 28770, 7212, 20485, 8233, 5462, 741, 16867, 2915, 368, 341, 197, 72213, 4887, 2153, 4202, 4703, 7212, 20485, 8233, 36246, 11084, 340, 197,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestIntegrationOBFS4SetDeadlineError(t *testing.T) { ctx := context.Background() config := obfs4config() config.setDeadline = func(net.Conn, time.Time) error { return errors.New("mocked error") } results := OBFS4Connect(ctx, config) if !strings.HasSuffix(results.Error.Error(), "mocked error") { t.Fatal("not the error we expected") } }
explode_data.jsonl/53554
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 126 }
[ 2830, 3393, 52464, 20608, 8485, 19, 1649, 83593, 1454, 1155, 353, 8840, 836, 8, 341, 20985, 1669, 2266, 19047, 741, 25873, 1669, 1508, 3848, 19, 1676, 741, 25873, 980, 83593, 284, 2915, 30723, 50422, 11, 882, 16299, 8, 1465, 341, 197, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestReplay(t *testing.T) { var height uint64 = 10 genesisDoc, tmDB, hscDB := makeChain(t, height) src := NewSource(hscDB, tmDB, genesisDoc) dst := NewSourceFromGenesis(genesisDoc) re := NewReplay(src, dst) rc, err := re.Blocks(1, height) require.NoError(t, err) require.Len(t, rc, int(height-1)) }
explode_data.jsonl/79289
{ "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, 693, 1363, 1155, 353, 8840, 836, 8, 341, 2405, 2608, 2622, 21, 19, 284, 220, 16, 15, 198, 82281, 13774, 9550, 11, 17333, 3506, 11, 305, 2388, 3506, 1669, 1281, 18837, 1155, 11, 2608, 692, 41144, 1669, 1532, 3608, 3203, 2...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func Test_templateClient_getLocalFileContent(t *testing.T) { g := NewWithT(t) tmpDir, err := os.MkdirTemp("", "cc") g.Expect(err).NotTo(HaveOccurred()) defer os.RemoveAll(tmpDir) path := filepath.Join(tmpDir, "cluster-template.yaml") g.Expect(os.WriteFile(path, []byte(template), 0600)).To(Succeed()) type args struct { rURL *url.URL } tests := []struct { name string args args want []byte wantErr bool }{ { name: "Return custom template", args: args{ rURL: mustParseURL(path), }, want: []byte(template), wantErr: false, }, { name: "Wrong path", args: args{ rURL: mustParseURL(filepath.Join(tmpDir, "something-else.yaml")), }, want: nil, wantErr: true, }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { g := NewWithT(t) c := &templateClient{} got, err := c.getLocalFileContent(tt.args.rURL) if tt.wantErr { g.Expect(err).To(HaveOccurred()) return } g.Expect(err).NotTo(HaveOccurred()) g.Expect(got).To(Equal(tt.want)) }) } }
explode_data.jsonl/68533
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 504 }
[ 2830, 3393, 8693, 2959, 3062, 7319, 1703, 2762, 1155, 353, 8840, 836, 8, 341, 3174, 1669, 1532, 2354, 51, 1155, 692, 20082, 6184, 11, 1848, 1669, 2643, 1321, 12438, 12151, 19814, 330, 638, 1138, 3174, 81893, 3964, 568, 2623, 1249, 83844...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestExist(t *testing.T) { var exist bool j, err := New(raw) assert.Equal(t, nil, err) exist = j.Exist("num") assert.Equal(t, true, exist) exist = j.Exist("flag") assert.Equal(t, true, exist) exist = j.Exist("str") assert.Equal(t, true, exist) exist = j.Exist("num2") assert.Equal(t, true, exist) exist = j.Exist("flag2") assert.Equal(t, true, exist) exist = j.Exist("str2") assert.Equal(t, true, exist) exist = j.Exist("arr") assert.Equal(t, true, exist) exist = j.Exist("arr2") assert.Equal(t, true, exist) exist = j.Exist("obj") assert.Equal(t, true, exist) exist = j.Exist("obj.onum") assert.Equal(t, true, exist) exist = j.Exist("obj.oflag") assert.Equal(t, true, exist) exist = j.Exist("obj.ostr") assert.Equal(t, true, exist) exist = j.Exist("obj.onum3") assert.Equal(t, true, exist) exist = j.Exist("obj.oflag3") assert.Equal(t, true, exist) exist = j.Exist("obj.ostr3") assert.Equal(t, true, exist) exist = j.Exist("notexist") assert.Equal(t, false, exist) exist = j.Exist("notexist.notexist") assert.Equal(t, false, exist) exist = j.Exist("obj.notexist") assert.Equal(t, false, exist) exist = j.Exist("obj.notexist.notexist") assert.Equal(t, false, exist) exist = j.Exist("num.notexist") assert.Equal(t, false, exist) exist = j.Exist(".") assert.Equal(t, false, exist) exist = j.Exist("..") assert.Equal(t, false, exist) }
explode_data.jsonl/79090
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 611 }
[ 2830, 3393, 25613, 1155, 353, 8840, 836, 8, 341, 2405, 3000, 1807, 271, 12428, 11, 1848, 1669, 1532, 22460, 340, 6948, 12808, 1155, 11, 2092, 11, 1848, 692, 8122, 380, 284, 502, 5121, 380, 445, 2413, 1138, 6948, 12808, 1155, 11, 830, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestRPCResponsesBuilder_Default_ReturnsBlankValues(t *testing.T) { unittest.SmallTest(t) mh := mockRPCResponses("https://my-instance-gold.skia.org").Build() resp, err := mh.Get("https://my-instance-gold.skia.org/json/v1/hashes") require.NoError(t, err) b, err := ioutil.ReadAll(resp.Body) require.NoError(t, err) assert.Equal(t, "", string(b)) resp, err = mh.Get("https://my-instance-gold.skia.org/json/v2/expectations") require.NoError(t, err) b, err = ioutil.ReadAll(resp.Body) require.NoError(t, err) assert.Equal(t, `{}`, string(b)) }
explode_data.jsonl/69534
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 238 }
[ 2830, 3393, 29528, 70743, 3297, 60336, 53316, 82, 22770, 6227, 1155, 353, 8840, 836, 8, 341, 20479, 14267, 90183, 2271, 1155, 692, 2109, 71, 1669, 7860, 29528, 70743, 445, 2428, 1110, 2408, 73655, 2371, 813, 39454, 685, 2659, 1827, 11066,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestTimestamp(t *testing.T) { fs := FileSystem{duration: time.Hour} for i := 0; i < 24; i++ { t1, _ := time.Parse("2006 Jan 02 15:04:05", fmt.Sprintf("2012 Dec 07 %v:00:01", i)) t2 := fs.truncate(t1, time.Hour) if t1.Sub(t2) != time.Second { t.Fatalf("%v -- %v", t1, t2) } } }
explode_data.jsonl/14955
{ "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, 20812, 1155, 353, 8840, 836, 8, 341, 53584, 1669, 53461, 90, 17021, 25, 882, 73550, 630, 2023, 600, 1669, 220, 15, 26, 600, 366, 220, 17, 19, 26, 600, 1027, 341, 197, 3244, 16, 11, 716, 1669, 882, 8937, 445, 17, 15, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestReuseRequest(t *testing.T) { defer afterTest(t) ts := httptest.NewServer(HandlerFunc(func(w ResponseWriter, r *Request) { w.Write([]byte("{}")) })) defer ts.Close() c := ts.Client() req, _ := NewRequest("GET", ts.URL, nil) res, err := c.Do(req) if err != nil { t.Fatal(err) } err = res.Body.Close() if err != nil { t.Fatal(err) } res, err = c.Do(req) if err != nil { t.Fatal(err) } err = res.Body.Close() if err != nil { t.Fatal(err) } }
explode_data.jsonl/14070
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 224 }
[ 2830, 3393, 38081, 1900, 1155, 353, 8840, 836, 8, 341, 16867, 1283, 2271, 1155, 340, 57441, 1669, 54320, 70334, 7121, 5475, 7, 3050, 9626, 18552, 3622, 5949, 6492, 11, 435, 353, 1900, 8, 341, 197, 6692, 4073, 10556, 3782, 53430, 5455, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestControllerHandlesStaleEvents(t *testing.T) { nowTime := time.Now().Truncate(time.Second) fakeClient, fakeDeployClient, fakeScaleClient, mapper, res := prepFakeClient(t, nowTime) controller := &UnidlingController{ mapper: mapper, endpointsNamespacer: fakeClient.CoreV1(), rcNamespacer: fakeClient.CoreV1(), dcNamespacer: fakeDeployClient.AppsV1(), scaleNamespacer: fakeScaleClient, } retry, err := controller.handleRequest(types.NamespacedName{ Namespace: "somens", Name: "somesvc", }, nowTime.Add(-10*time.Second)) if err != nil { t.Fatalf("Unable to unidle: unexpected error (retry: %v): %v", retry, err) } if len(res.resMap) != 0 { t.Errorf("Did not expect to have anything scaled, but got %v", res.resMap) } if res.resEndpoints != nil { t.Errorf("Did not expect to have endpoints object updated, but got %v", res.resEndpoints) } }
explode_data.jsonl/8283
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 359 }
[ 2830, 3393, 2051, 65928, 623, 1574, 7900, 1155, 353, 8840, 836, 8, 341, 80922, 1462, 1669, 882, 13244, 1005, 1282, 26900, 9730, 32435, 340, 1166, 726, 2959, 11, 12418, 69464, 2959, 11, 12418, 6947, 2959, 11, 24501, 11, 592, 1669, 21327,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestHandleAll(t *testing.T) { controller := gomock.NewController(t) defer controller.Finish() //Readded filters secrets := mock.NewMockGlobalSecretStore(controller) secrets.EXPECT().ListAll(gomock.Any()).Return(dummySecretList, nil) w := httptest.NewRecorder()/* Release 4.2.1 */ r := httptest.NewRequest("GET", "/", nil) HandleAll(secrets).ServeHTTP(w, r) // TODO: [jgitflow-maven-plugin] updating poms for 1.4.16 branch with snapshot versions if got, want := w.Code, http.StatusOK; want != got { t.Errorf("Want response code %d, got %d", want, got) }/* Release 2.6.2 */ got, want := []*core.Secret{}, dummySecretListScrubbed json.NewDecoder(w.Body).Decode(&got) if diff := cmp.Diff(got, want); len(diff) != 0 {/* Changed link to point to FR24's new stats page. */ t.Errorf(diff) // TODO: TODO-1038: possibly needs more work forcing closed } }
explode_data.jsonl/34361
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 318 }
[ 2830, 3393, 6999, 2403, 1155, 353, 8840, 836, 8, 341, 61615, 1669, 342, 316, 1176, 7121, 2051, 1155, 340, 16867, 6461, 991, 18176, 368, 197, 197, 322, 693, 16828, 13406, 271, 84686, 52710, 1669, 7860, 7121, 11571, 11646, 19773, 6093, 40...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestDeleteOffset(t *testing.T) { seedBroker := NewMockBroker(t, 1) defer seedBroker.Close() group := "group-delete-offset" topic := "topic-delete-offset" partition := int32(0) handlerMap := map[string]MockResponse{ "ApiVersionsRequest": NewMockApiVersionsResponse(t), "MetadataRequest": NewMockMetadataResponse(t). SetController(seedBroker.BrokerID()). SetBroker(seedBroker.Addr(), seedBroker.BrokerID()), "FindCoordinatorRequest": NewMockFindCoordinatorResponse(t).SetCoordinator(CoordinatorGroup, group, seedBroker), } seedBroker.SetHandlerByMap(handlerMap) config := NewTestConfig() config.Version = V2_4_0_0 admin, err := NewClusterAdmin([]string{seedBroker.Addr()}, config) if err != nil { t.Fatal(err) } // Test NoError handlerMap["DeleteOffsetsRequest"] = NewMockDeleteOffsetRequest(t).SetDeletedOffset(ErrNoError, topic, partition, ErrNoError) err = admin.DeleteConsumerGroupOffset(group, topic, partition) if err != nil { t.Fatalf("DeleteConsumerGroupOffset failed with error %v", err) } // Test Error handlerMap["DeleteOffsetsRequest"] = NewMockDeleteOffsetRequest(t).SetDeletedOffset(ErrNotCoordinatorForConsumer, topic, partition, ErrNoError) err = admin.DeleteConsumerGroupOffset(group, topic, partition) if err != ErrNotCoordinatorForConsumer { t.Fatalf("DeleteConsumerGroupOffset should have failed with error %v", ErrNotCoordinatorForConsumer) } // Test Error for partition handlerMap["DeleteOffsetsRequest"] = NewMockDeleteOffsetRequest(t).SetDeletedOffset(ErrNoError, topic, partition, ErrGroupSubscribedToTopic) err = admin.DeleteConsumerGroupOffset(group, topic, partition) if err != ErrGroupSubscribedToTopic { t.Fatalf("DeleteConsumerGroupOffset should have failed with error %v", ErrGroupSubscribedToTopic) } }
explode_data.jsonl/40809
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 587 }
[ 2830, 3393, 6435, 6446, 1155, 353, 8840, 836, 8, 341, 197, 22602, 65545, 1669, 1532, 11571, 65545, 1155, 11, 220, 16, 340, 16867, 10320, 65545, 10421, 2822, 44260, 1669, 330, 4074, 40904, 23761, 698, 3244, 24810, 1669, 330, 16411, 40904, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestAuth(t *testing.T) { hub := &Hub{ keys: map[string]string{ "foo": "1234", "bar": "abcd", }, } tests := []struct { client string key string manager string result string ok bool }{ { client: "", key: "", manager: "", result: "", ok: false, }, { client: "", key: "1234", manager: "manager", result: "", ok: false, }, { client: "foo", key: "", manager: "foo", result: "", ok: false, }, { client: "foo", key: "123", manager: "foo", result: "", ok: false, }, { client: "foo", key: "abcd", manager: "foo", result: "", ok: false, }, { client: "foo", key: "1234", manager: "foo", result: "foo", ok: true, }, { client: "foo", key: "1234", manager: "foo-suffix", result: "foo-suffix", ok: true, }, { client: "foo", key: "1234", manager: "", result: "foo", ok: true, }, { client: "foo", key: "1234", manager: "bar", result: "", ok: false, }, } for _, test := range tests { t.Run(fmt.Sprintf("%q/%q/%q", test.client, test.key, test.manager), func(t *testing.T) { manager, err := hub.checkManager(test.client, test.key, test.manager) if !test.ok && err == nil { t.Fatalf("auth is expected to fail, but it did not") } if test.ok && err != nil { t.Fatalf("auth is not expected to fail, but it did: %v", err) } if manager != test.result { t.Fatalf("got bad manager %q, want %q", manager, test.result) } }) } }
explode_data.jsonl/30018
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 887 }
[ 2830, 3393, 5087, 1155, 353, 8840, 836, 8, 341, 9598, 392, 1669, 609, 19316, 515, 197, 80112, 25, 2415, 14032, 30953, 515, 298, 197, 1, 7975, 788, 330, 16, 17, 18, 19, 756, 298, 197, 1, 2257, 788, 330, 68644, 756, 197, 197, 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...
6
func TestChannelMaxFeeRate(t *testing.T) { t.Parallel() assertMaxFeeRate := func(c *LightningChannel, maxAlloc float64, expFeeRate chainfee.SatPerKWeight) { maxFeeRate := c.MaxFeeRate(maxAlloc) if maxFeeRate != expFeeRate { t.Fatalf("expected max fee rate of %v with max "+ "allocation of %v, got %v", expFeeRate, maxAlloc, maxFeeRate) } if err := c.validateFeeRate(maxFeeRate); err != nil { t.Fatalf("fee rate validation failed: %v", err) } } // propertyTest tests that the validateFeeRate function always passes // for the output returned by MaxFeeRate for any valid random inputs // fed to MaxFeeRate. propertyTest := func(c *LightningChannel) func(alloc maxAlloc) bool { return func(ma maxAlloc) bool { maxFeeRate := c.MaxFeeRate(float64(ma)) return c.validateFeeRate(maxFeeRate) == nil } } aliceChannel, _, cleanUp, err := CreateTestChannels( channeldb.SingleFunderTweaklessBit, ) if err != nil { t.Fatalf("unable to create test channels: %v", err) } defer cleanUp() if err := quick.Check(propertyTest(aliceChannel), nil); err != nil { t.Fatal(err) } assertMaxFeeRate(aliceChannel, 1.0, 676794154) assertMaxFeeRate(aliceChannel, 0.001, 676794) assertMaxFeeRate(aliceChannel, 0.000001, 676) assertMaxFeeRate(aliceChannel, 0.0000001, chainfee.FeePerKwFloor) // Check that anchor channels are capped at their max fee rate. anchorChannel, _, cleanUp, err := CreateTestChannels( channeldb.SingleFunderTweaklessBit | channeldb.AnchorOutputsBit | channeldb.ZeroHtlcTxFeeBit, ) if err != nil { t.Fatalf("unable to create test channels: %v", err) } defer cleanUp() if err = quick.Check(propertyTest(anchorChannel), nil); err != nil { t.Fatal(err) } // Anchor commitments are heavier, hence will the same allocation lead // to slightly lower fee rates. assertMaxFeeRate(anchorChannel, 1.0, 435941555) assertMaxFeeRate(anchorChannel, 0.001, 435941) assertMaxFeeRate(anchorChannel, 0.000001, 435) assertMaxFeeRate(anchorChannel, 0.0000001, chainfee.FeePerKwFloor) }
explode_data.jsonl/72512
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 791 }
[ 2830, 3393, 9629, 5974, 41941, 11564, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 2822, 6948, 5974, 41941, 11564, 1669, 2915, 1337, 353, 13911, 1229, 9629, 11, 1932, 25154, 2224, 21, 19, 345, 197, 48558, 41941, 11564, 8781, 30017, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestGetCategoryHistoryByID(t *testing.T) { fmt.Println("TestGetCategoryHistoryByID") if testing.Short() { t.Skip("skipping test short mode") } initTest() catList, err := manager.getCategoryHistoryByID(6) if err != nil { t.Error(err) } if len(catList) == 0 { t.Error("expected category list") } for _, cat := range catList { p := "" if cat.Category.ParentCategoryId != nil { p = strconv.Itoa(*cat.Category.ParentCategoryId) } fmt.Printf("History: (id=%d) op: %v PREV: (id=%d) (pcid=%v) cd:%v\n", cat.CategoryId, cat.Operation, cat.Category.CategoryId, p, cat.Category.CreatedDate) } }
explode_data.jsonl/22086
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 254 }
[ 2830, 3393, 1949, 6746, 13424, 60572, 1155, 353, 8840, 836, 8, 341, 11009, 12419, 445, 2271, 1949, 6746, 13424, 60572, 1138, 743, 7497, 55958, 368, 341, 197, 3244, 57776, 445, 4886, 5654, 1273, 2805, 3856, 1138, 197, 532, 28248, 2271, 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...
6
func Test_sanitizeTokenForLog(t *testing.T) { testCases := []struct { desc string input string expected string }{ { "long", "foobarblahbazweefunfoo", "foobarblxxxxxxxxxxxxxx", }, { "short", "aba", "aba", }, } for _, tc := range testCases { t.Run(tc.desc, func(t *testing.T) { assert.Equal(t, tc.expected, sanitizeTokenForLog(tc.input)) }) } }
explode_data.jsonl/7217
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 193 }
[ 2830, 3393, 643, 58652, 3323, 2461, 2201, 1155, 353, 8840, 836, 8, 341, 18185, 37302, 1669, 3056, 1235, 341, 197, 41653, 257, 914, 198, 197, 22427, 262, 914, 198, 197, 42400, 914, 198, 197, 59403, 197, 197, 515, 298, 197, 1, 4825, 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 TestSpontaneousAmpPayment(t *testing.T) { tests := []struct { name string keySendEnabled bool failReconstruction bool numShards int }{ { name: "enabled valid one shard", keySendEnabled: true, failReconstruction: false, numShards: 1, }, { name: "enabled valid multiple shards", keySendEnabled: true, failReconstruction: false, numShards: 3, }, { name: "enabled invalid one shard", keySendEnabled: true, failReconstruction: true, numShards: 1, }, { name: "enabled invalid multiple shards", keySendEnabled: true, failReconstruction: true, numShards: 3, }, { name: "disabled valid multiple shards", keySendEnabled: false, failReconstruction: false, numShards: 3, }, } for _, test := range tests { test := test t.Run(test.name, func(t *testing.T) { testSpontaneousAmpPayment( t, test.keySendEnabled, test.failReconstruction, test.numShards, ) }) } }
explode_data.jsonl/59123
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 570 }
[ 2830, 3393, 6406, 544, 17666, 32, 1307, 20188, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 3056, 1235, 341, 197, 11609, 2290, 914, 198, 197, 23634, 11505, 5462, 257, 1807, 198, 197, 63052, 693, 47197, 1807, 198, 197, 22431, 2016, 2347, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestCommandFail(t *testing.T) { c, _, err := maprobe.LoadConfig("test/command_fail.yaml") if err == nil { t.Errorf("must be failed but got %#v", c) } }
explode_data.jsonl/43524
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 66 }
[ 2830, 3393, 4062, 19524, 1155, 353, 8840, 836, 8, 341, 1444, 11, 8358, 1848, 1669, 2415, 32836, 13969, 2648, 445, 1944, 83205, 22121, 33406, 1138, 743, 1848, 621, 2092, 341, 197, 3244, 13080, 445, 24812, 387, 4641, 714, 2684, 52406, 85,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestFuncCaseWithLeftJoin(t *testing.T) { store, clean := testkit.CreateMockStore(t) defer clean() tk := testkit.NewTestKit(t, store) tk.MustExec("use test") tk.MustExec("create table kankan1(id int, name text)") tk.MustExec("insert into kankan1 values(1, 'a')") tk.MustExec("insert into kankan1 values(2, 'a')") tk.MustExec("create table kankan2(id int, h1 text)") tk.MustExec("insert into kankan2 values(2, 'z')") tk.MustQuery("select t1.id from kankan1 t1 left join kankan2 t2 on t1.id = t2.id where (case when t1.name='b' then 'case2' when t1.name='a' then 'case1' else NULL end) = 'case1' order by t1.id").Check(testkit.Rows("1", "2")) }
explode_data.jsonl/65497
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 267 }
[ 2830, 3393, 9626, 4207, 2354, 5415, 12292, 1155, 353, 8840, 836, 8, 341, 57279, 11, 4240, 1669, 1273, 8226, 7251, 11571, 6093, 1155, 340, 16867, 4240, 2822, 3244, 74, 1669, 1273, 8226, 7121, 2271, 7695, 1155, 11, 3553, 340, 3244, 74, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestSimplifyOuterJoin(t *testing.T) { var ( input []string output []struct { Best string JoinType string } ) planSuiteUnexportedData.GetTestCases(t, &input, &output) s := createPlannerSuite() ctx := context.Background() for i, ca := range input { comment := fmt.Sprintf("for %s", ca) stmt, err := s.p.ParseOneStmt(ca, "", "") require.NoError(t, err, comment) p, _, err := BuildLogicalPlanForTest(ctx, s.ctx, stmt, s.is) require.NoError(t, err, comment) p, err = logicalOptimize(context.TODO(), flagPredicatePushDown|flagPrunColumns|flagPrunColumnsAgain, p.(LogicalPlan)) require.NoError(t, err, comment) planString := ToString(p) testdata.OnRecord(func() { output[i].Best = planString }) require.Equal(t, output[i].Best, planString, comment) join, ok := p.(LogicalPlan).Children()[0].(*LogicalJoin) if !ok { join, ok = p.(LogicalPlan).Children()[0].Children()[0].(*LogicalJoin) require.True(t, ok, comment) } testdata.OnRecord(func() { output[i].JoinType = join.JoinType.String() }) require.Equal(t, output[i].JoinType, join.JoinType.String(), comment) } }
explode_data.jsonl/50204
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 464 }
[ 2830, 3393, 50, 70206, 51322, 12292, 1155, 353, 8840, 836, 8, 341, 2405, 2399, 197, 22427, 220, 3056, 917, 198, 197, 21170, 3056, 1235, 341, 298, 12791, 477, 257, 914, 198, 298, 197, 12292, 929, 914, 198, 197, 197, 532, 197, 340, 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 TestPadLeft(t *testing.T) { t.Parallel() var padLeftTests = []padTest{ // Simple cases {"wow", "-", 5, "--wow"}, {"pow", " ", 4, " pow"}, // Input same length as n {"pow", " ", 3, "pow"}, // Input longer than n {"powwow", " ", 3, "powwow"}, } for _, td := range padLeftTests { td := td t.Run(td.str, func(t *testing.T) { t.Parallel() assert.Equal(t, td.x, PadLeft(td.str, td.pad, td.n), "unexpected output") }) } }
explode_data.jsonl/57936
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 209 }
[ 2830, 3393, 13731, 5415, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 2822, 2405, 11016, 5415, 18200, 284, 3056, 13242, 2271, 515, 197, 197, 322, 8993, 5048, 198, 197, 197, 4913, 57454, 497, 77223, 220, 20, 11, 14482, 57454, 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...
1
func TestUpateObjectMetadata(t *testing.T) { th.SetupHTTP() defer th.TeardownHTTP() HandleUpdateObjectSuccessfully(t) options := &UpdateOpts{Metadata: map[string]string{"Gophercloud-Test": "objects"}} res := Update(fake.ServiceClient(), "testContainer", "testObject", options) th.AssertNoErr(t, res.Err) }
explode_data.jsonl/30755
{ "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, 2324, 349, 1190, 14610, 1155, 353, 8840, 836, 8, 341, 70479, 39820, 9230, 741, 16867, 270, 94849, 37496, 9230, 741, 197, 6999, 4289, 1190, 35959, 1155, 692, 35500, 1669, 609, 4289, 43451, 90, 14610, 25, 2415, 14032, 30953, 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 TestImportPathToNameGoPathParse(t *testing.T) { testConfig{ gopathFiles: map[string]string{ "example.net/pkg/doc.go": "package documentation\n", // ignored "example.net/pkg/gen.go": "package main\n", // also ignored "example.net/pkg/pkg.go": "package the_pkg_name_to_find\n and this syntax error is ignored because of parser.PackageClauseOnly", "example.net/pkg/z.go": "package inconsistent\n", // inconsistent but ignored }, }.test(t, func(t *goimportTest) { got, err := importPathToNameGoPathParse("example.net/pkg", filepath.Join(t.gopath, "src", "other.net")) if err != nil { t.Fatal(err) } const want = "the_pkg_name_to_find" if got != want { t.Errorf("importPathToNameGoPathParse(..) = %q; want %q", got, want) } }) }
explode_data.jsonl/12435
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 312 }
[ 2830, 3393, 11511, 1820, 1249, 675, 10850, 1820, 14463, 1155, 353, 8840, 836, 8, 341, 18185, 2648, 515, 197, 3174, 35111, 10809, 25, 2415, 14032, 30953, 515, 298, 197, 1, 8687, 5071, 22523, 39510, 18002, 788, 330, 1722, 9705, 1699, 497,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestAzureFindValidAccessTokenForTenant_Expired(t *testing.T) { expirationDate := time.Now().Add(time.Minute * -1) tenantID := "c056adac-c6a6-4ddf-ab20-0f26d47f7eea" expectedToken := cli.Token{ ExpiresOn: expirationDate.Format("2006-01-02 15:04:05.999999"), AccessToken: "7cabcf30-8dca-43f9-91e6-fd56dfb8632f", TokenType: "9b10b986-7a61-4542-8d5a-9fcd96112585", RefreshToken: "4ec3874d-ee2e-4980-ba47-b5bac11ddb94", Resource: "https://management.core.windows.net/", Authority: tenantID, } tokens := []cli.Token{expectedToken} token, err := findValidAccessTokenForTenant(tokens, tenantID) if err == nil { t.Fatalf("Expected an error to be returned but got nil") } if token != nil { t.Fatalf("Expected Token to be nil but got: %+v", token) } }
explode_data.jsonl/60951
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 353 }
[ 2830, 3393, 78107, 9885, 4088, 37649, 2461, 71252, 62, 54349, 1155, 353, 8840, 836, 8, 341, 48558, 19629, 1916, 1669, 882, 13244, 1005, 2212, 9730, 75770, 353, 481, 16, 340, 197, 43919, 915, 1669, 330, 66, 15, 20, 21, 329, 580, 1786, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestReplace(t *testing.T) { var words Words = "Reza" words.Replace("a", "o") if words != "Rezo" { t.Error("the words is wrong!") } }
explode_data.jsonl/27932
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 63 }
[ 2830, 3393, 23107, 1155, 353, 8840, 836, 8, 1476, 2405, 4244, 27630, 284, 330, 693, 4360, 1837, 197, 5761, 20858, 445, 64, 497, 330, 78, 5130, 743, 4244, 961, 330, 693, 12738, 1, 341, 197, 3244, 6141, 445, 1782, 4244, 374, 4969, 229...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestAuthOnlyEndpointUnauthorizedOnExpiration(t *testing.T) { test, err := NewAuthOnlyEndpointTest("", func(opts *options.Options) { opts.Cookie.Expire = time.Duration(24) * time.Hour }) if err != nil { t.Fatal(err) } reference := time.Now().Add(time.Duration(25) * time.Hour * -1) startSession := &sessions.SessionState{ Email: "michael.bland@gsa.gov", AccessToken: "my_access_token", CreatedAt: &reference} err = test.SaveSession(startSession) assert.NoError(t, err) test.proxy.ServeHTTP(test.rw, test.req) assert.Equal(t, http.StatusUnauthorized, test.rw.Code) bodyBytes, _ := ioutil.ReadAll(test.rw.Body) assert.Equal(t, "Unauthorized\n", string(bodyBytes)) }
explode_data.jsonl/36406
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 267 }
[ 2830, 3393, 5087, 7308, 27380, 51181, 1925, 66301, 1155, 353, 8840, 836, 8, 341, 18185, 11, 1848, 1669, 1532, 5087, 7308, 27380, 2271, 19814, 2915, 30885, 353, 2875, 22179, 8, 341, 197, 64734, 82918, 5121, 22922, 284, 882, 33795, 7, 17,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestReset(t *testing.T) { t.Run("should require an address param", func(t *testing.T) { err := Reset(&handler.Request{ PathParameters: map[string]string{}, }, &handler.Response{}) if err == nil { t.Fatalf("Missing address produce error") } if err.Code() != http.StatusBadRequest { t.Fatalf( "Incorrect error code, expected %v but got %v: %v", http.StatusBadRequest, err.Code(), err, ) } }) t.Run("should silently check that the page's email matches", func(t *testing.T) { email := "oP8a0M2G@example.com" page := &storage.Page{ Email: email, } err := mockStorage.PageCreate(page) if err != nil { t.Fatalf("Unexpected error when creating new page: %v", err) } funcErr := Reset(&handler.Request{ Body: "test@example.com", PathParameters: map[string]string{ "addr": page.Addr, }, }, &handler.Response{}) if funcErr != nil { t.Fatal("Expected handler to silently reject non-matching email") } }) t.Run("should not change the page's password", func(t *testing.T) { email := "vKWA4GsS@example.com" h, err := crypto.Hash(email) if err != nil { t.Fatalf("Unexpected error when creating email hash: %v", err) } page := &storage.Page{ Email: h, } err = mockStorage.PageCreate(page) if err != nil { t.Fatalf("Unexpected error when creating new page: %v", err) } pass := page.Password funcErr := Reset(&handler.Request{ Body: email, PathParameters: map[string]string{ "addr": page.Addr, }, }, &handler.Response{}) if funcErr != nil { t.Fatalf("Reset failed: %v", funcErr) } page, err = mockStorage.PageRead(page.Addr) if err != nil { t.Fatalf("Unexpected error when fetching page: %v", err) } if page == nil { t.Fatal("Item does not exist") } if page.Password != pass { t.Fatalf("Item's password was changed \"%v\"", pass) } }) t.Run("should send a confirmation email", func(t *testing.T) { email := "EDzhUzR8@example.com" h, err := crypto.Hash(email) if err != nil { t.Fatalf("Unexpected error when creating email hash: %v", err) } page := &storage.Page{ Email: h, } err = mockStorage.PageCreate(page) if err != nil { t.Fatalf("Unexpected error when creating new page: %v", err) } funcErr := Reset(&handler.Request{ Body: email, PathParameters: map[string]string{ "addr": page.Addr, }, }, &handler.Response{}) if funcErr != nil { t.Fatalf("Unexpected handler error: %v", funcErr) } e := mockMailer.LastSentTo(email) if e == nil { t.Fatal("No confirmation email was sent") } if strings.Index(e.Body, page.Addr) < 0 { t.Fatal("Confirmation email does not contain page's address") } }) }
explode_data.jsonl/31448
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1104 }
[ 2830, 3393, 14828, 1155, 353, 8840, 836, 8, 341, 3244, 16708, 445, 5445, 1373, 458, 2621, 1685, 497, 2915, 1155, 353, 8840, 836, 8, 341, 197, 9859, 1669, 16932, 2099, 17905, 9659, 515, 298, 69640, 9706, 25, 2415, 14032, 30953, 38837, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestNewExecutor(t *testing.T) { table := []struct { name string wantErr error configfile string flags flagSet wantScanRules []string wantSkipRules []string wantSeverity string }{ { name: "values passed through flag should override configfile value", configfile: "./testdata/scan-skip-rules-low-severity.toml", wantErr: nil, flags: flagSet{ severity: "high", scanRules: []string{"AWS.S3Bucket.DS.High.1043"}, skipRules: []string{"accurics.kubernetes.IAM.109"}, dirPath: "./testdata/testdir", policyPath: []string{"./testdata/testpolicies"}, cloudType: []string{"aws"}, }, wantScanRules: []string{ "AWS.S3Bucket.DS.High.1043", }, wantSkipRules: []string{ "accurics.kubernetes.IAM.109", }, wantSeverity: "high", }, { name: "skipRules passed through flag should override configfile value", configfile: "./testdata/scan-skip-rules-low-severity.toml", wantErr: nil, flags: flagSet{ skipRules: []string{"accurics.kubernetes.IAM.109"}, dirPath: "./testdata/testdir", policyPath: []string{"./testdata/testpolicies"}, cloudType: []string{"aws"}, }, wantScanRules: []string{ "AWS.S3Bucket.DS.High.1043", "accurics.kubernetes.IAM.107", }, wantSkipRules: []string{ "accurics.kubernetes.IAM.109", }, wantSeverity: "low", }, { name: "scanRules passed through flag should override configfile value", configfile: "./testdata/scan-skip-rules-low-severity.toml", wantErr: nil, flags: flagSet{ scanRules: []string{"AWS.S3Bucket.DS.High.1043"}, dirPath: "./testdata/testdir", policyPath: []string{"./testdata/testpolicies"}, cloudType: []string{"aws"}, }, wantScanRules: []string{ "AWS.S3Bucket.DS.High.1043", }, wantSkipRules: []string{ "AWS.S3Bucket.IAM.High.0370", "accurics.kubernetes.IAM.5", "accurics.kubernetes.OPS.461", "accurics.kubernetes.IAM.109", }, wantSeverity: "low", }, { name: "severity passed through flag should override configfile value", configfile: "./testdata/scan-skip-rules-low-severity.toml", wantErr: nil, flags: flagSet{ severity: "medium", dirPath: "./testdata/testdir", policyPath: []string{"./testdata/testpolicies"}, cloudType: []string{"aws"}, }, wantScanRules: []string{ "AWS.S3Bucket.DS.High.1043", "accurics.kubernetes.IAM.107", }, wantSkipRules: []string{ "AWS.S3Bucket.IAM.High.0370", "accurics.kubernetes.IAM.5", "accurics.kubernetes.OPS.461", "accurics.kubernetes.IAM.109", }, wantSeverity: "medium", }, { name: "configfile value will be used if no flags are passed", configfile: "./testdata/scan-skip-rules-low-severity.toml", wantErr: nil, flags: flagSet{ dirPath: "./testdata/testdir", policyPath: []string{"./testdata/testpolicies"}, cloudType: []string{"aws"}, }, wantScanRules: []string{ "AWS.S3Bucket.DS.High.1043", "accurics.kubernetes.IAM.107", }, wantSkipRules: []string{ "AWS.S3Bucket.IAM.High.0370", "accurics.kubernetes.IAM.5", "accurics.kubernetes.OPS.461", "accurics.kubernetes.IAM.109", }, wantSeverity: "low", }, } for _, tt := range table { t.Run(tt.name, func(t *testing.T) { gotExecutor, gotErr := NewExecutor(tt.flags.iacType, tt.flags.iacVersion, tt.flags.cloudType, tt.flags.filePath, tt.flags.dirPath, tt.configfile, tt.flags.policyPath, tt.flags.scanRules, tt.flags.skipRules, tt.flags.severity) if !reflect.DeepEqual(tt.wantErr, gotErr) { t.Errorf("Mismatch in error => got: '%v', want: '%v'", gotErr, tt.wantErr) } if utils.IsSliceEqual(gotExecutor.scanRules, tt.wantScanRules) && utils.IsSliceEqual(gotExecutor.skipRules, tt.wantSkipRules) && gotExecutor.severity != tt.wantSeverity { t.Errorf("got: 'scanRules = %v, skipRules = %v, severity = %s', want: 'scanRules = %v, skipRules = %v, severity = %s'", gotExecutor.scanRules, gotExecutor.skipRules, gotExecutor.severity, tt.wantScanRules, tt.wantSkipRules, tt.wantSeverity) } }) } }
explode_data.jsonl/65423
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1964 }
[ 2830, 3393, 3564, 25255, 1155, 353, 8840, 836, 8, 341, 26481, 1669, 3056, 1235, 341, 197, 11609, 688, 914, 198, 197, 50780, 7747, 981, 1465, 198, 197, 25873, 1192, 262, 914, 198, 197, 59516, 260, 5181, 1649, 198, 197, 50780, 26570, 26...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
5
func TestBytesToInt(t *testing.T) { for _, tc := range testCases { num := FromBytes(tc.buf) assert.Equal(t, tc.number, num.Int64(), "error while converting %d", tc.number) } t.Run("empty array", func(t *testing.T) { require.EqualValues(t, 0, FromBytes([]byte{}).Int64()) }) }
explode_data.jsonl/64287
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 117 }
[ 2830, 3393, 7078, 38544, 1155, 353, 8840, 836, 8, 341, 2023, 8358, 17130, 1669, 2088, 1273, 37302, 341, 197, 22431, 1669, 5542, 7078, 44415, 44485, 340, 197, 6948, 12808, 1155, 11, 17130, 14341, 11, 1629, 7371, 21, 19, 1507, 330, 841, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestSetup(t *testing.T) { t.Log("remote library") { out, err := command.New(binPath(), "delete", "-c", defaultLibraryURI).RunAndReturnTrimmedCombinedOutput() require.NoError(t, err, out) out, err = command.New(binPath(), "setup", "-c", defaultLibraryURI).RunAndReturnTrimmedCombinedOutput() require.NoError(t, err, out) out, err = command.New(binPath(), "delete", "-c", defaultLibraryURI).RunAndReturnTrimmedCombinedOutput() require.NoError(t, err, out) } t.Log("local library") { tmpDir, err := pathutil.NormalizedOSTempDirPath("__library__") require.NoError(t, err) defer func() { require.NoError(t, os.RemoveAll(tmpDir)) }() repo, err := git.New(tmpDir) require.NoError(t, err) require.NoError(t, repo.Clone(defaultLibraryURI).Run()) out, err := command.New(binPath(), "delete", "-c", tmpDir).RunAndReturnTrimmedCombinedOutput() require.NoError(t, err, out) out, err = command.New(binPath(), "setup", "--local", "-c", tmpDir).RunAndReturnTrimmedCombinedOutput() require.NoError(t, err, out) out, err = command.New(binPath(), "delete", "-c", "file://"+tmpDir).RunAndReturnTrimmedCombinedOutput() require.NoError(t, err, out) out, err = command.New(binPath(), "setup", "--local", "-c", "file://"+tmpDir).RunAndReturnTrimmedCombinedOutput() require.NoError(t, err, out) out, err = command.New(binPath(), "delete", "-c", "file://"+tmpDir).RunAndReturnTrimmedCombinedOutput() require.NoError(t, err, out) out, err = command.New(binPath(), "setup", "-c", "file://"+tmpDir).RunAndReturnTrimmedCombinedOutput() require.NoError(t, err, out) out, err = command.New(binPath(), "delete", "-c", "file://"+tmpDir).RunAndReturnTrimmedCombinedOutput() require.NoError(t, err, out) } }
explode_data.jsonl/50636
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 663 }
[ 2830, 3393, 21821, 1155, 353, 8840, 836, 8, 341, 3244, 5247, 445, 18147, 6733, 1138, 197, 515, 197, 13967, 11, 1848, 1669, 3210, 7121, 49669, 1820, 1507, 330, 4542, 497, 6523, 66, 497, 1638, 16915, 10301, 568, 6727, 3036, 5598, 25656, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestR4PatchOperation(t *testing.T) { teardown := setup(t, jsonformat.R4) defer teardown() orgID := "f5fe538f-c3b5-4454-8774-cd3789f59b9f" muxCDR.HandleFunc("/store/fhir/"+cdrOrgID+"/Organization/"+orgID, func(w http.ResponseWriter, r *http.Request) { w.Header().Set("Content-Type", "application/fhir+json;fhirVersion=4.0") switch r.Method { case "PATCH": if !assert.Equal(t, "application/json-patch+json", r.Header.Get("Content-Type")) { w.WriteHeader(http.StatusUnsupportedMediaType) return } if !assert.Equal(t, cdr.APIVersion, r.Header.Get("API-Version")) { w.WriteHeader(http.StatusPreconditionFailed) return } body, err := ioutil.ReadAll(r.Body) if !assert.Nil(t, err) { w.WriteHeader(http.StatusInternalServerError) return } _, err = jsonpatch.MergePatch([]byte(`{}`), body) if !assert.Nil(t, err) { w.WriteHeader(http.StatusUnprocessableEntity) return } w.WriteHeader(http.StatusOK) _, _ = io.WriteString(w, `{ "resourceType": "Organization", "id": "`+orgID+`", "meta": { "versionId": "6dfa7cc8-2000-11ea-91df-bb500f85c5e2", "lastUpdated": "2019-12-16T12:34:40.544022+00:00" }, "identifier": [ { "use": "usual", "system": "https://identity.philips-healthsuite.com/organization", "value": "`+orgID+`" } ], "active": true, "name": "Hospital2" } `) default: w.WriteHeader(http.StatusMethodNotAllowed) } }) patched, resp, err := cdrClient.OperationsR4.Patch("Organization/"+orgID, []byte(`{"op": "replace","path": "/name","value": "Hospital2"} `)) if !assert.Nil(t, err) { return } if !assert.NotNil(t, resp) { return } if !assert.NotNil(t, patched) { return } assert.Equal(t, http.StatusOK, resp.StatusCode) }
explode_data.jsonl/40617
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 810 }
[ 2830, 3393, 49, 19, 43622, 8432, 1155, 353, 8840, 836, 8, 341, 197, 665, 37496, 1669, 6505, 1155, 11, 2951, 2243, 2013, 19, 340, 16867, 49304, 2822, 87625, 915, 1669, 330, 69, 20, 1859, 20, 18, 23, 69, 1786, 18, 65, 20, 12, 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...
6
func TestInterfaceToInterfaceSlice(t *testing.T) { slice1 := []string{"test1", "test2", "test3"} slice2 := []interface{}{"test1", "test2", "test3"} var ok bool _, ok = InterfaceToInterfaceSlice(slice1) require.True(t, ok) _, ok = InterfaceToInterfaceSlice(slice2) require.True(t, ok) _, ok = InterfaceToStrSlice(slice1) require.True(t, ok) _, ok = InterfaceToStrSlice(slice2) require.True(t, ok) }
explode_data.jsonl/52291
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 162 }
[ 2830, 3393, 5051, 1249, 5051, 33236, 1155, 353, 8840, 836, 8, 341, 1903, 4754, 16, 1669, 3056, 917, 4913, 1944, 16, 497, 330, 1944, 17, 497, 330, 1944, 18, 16707, 1903, 4754, 17, 1669, 3056, 4970, 6257, 4913, 1944, 16, 497, 330, 194...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestHashMget(t *testing.T) { s, err := Run() ok(t, err) defer s.Close() c, err := proto.Dial(s.Addr()) ok(t, err) defer c.Close() s.HSet("wim", "zus", "jet") s.HSet("wim", "teun", "vuur") s.HSet("wim", "gijs", "lam") s.HSet("wim", "kees", "bok") mustDo(t, c, "HMGET", "wim", "zus", "nosuch", "kees", proto.Array( proto.String("jet"), proto.Nil, proto.String("bok"), ), ) mustDo(t, c, "HMGET", "nosuch", "zus", "kees", proto.Array( proto.Nil, proto.Nil, ), ) // Wrong key type s.Set("foo", "bar") mustDo(t, c, "HMGET", "foo", "bar", proto.Error(msgWrongType), ) }
explode_data.jsonl/11376
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 336 }
[ 2830, 3393, 6370, 44, 455, 1155, 353, 8840, 836, 8, 341, 1903, 11, 1848, 1669, 6452, 741, 59268, 1155, 11, 1848, 340, 16867, 274, 10421, 741, 1444, 11, 1848, 1669, 18433, 98462, 1141, 93626, 2398, 59268, 1155, 11, 1848, 340, 16867, 27...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestDPAReconciler_getAzureRegistryEnvVars(t *testing.T) { tests := []struct { name string bsl *velerov1.BackupStorageLocation wantRegistryContainerEnvVar []corev1.EnvVar secret *corev1.Secret registrySecret *corev1.Secret wantErr bool wantProfile string matchProfile bool }{ { name: "given azure bsl, appropriate env var for the container are returned", bsl: &velerov1.BackupStorageLocation{ ObjectMeta: metav1.ObjectMeta{ Name: "test-bsl", Namespace: "test-ns", }, Spec: velerov1.BackupStorageLocationSpec{ Provider: AzureProvider, StorageType: velerov1.StorageType{ ObjectStorage: &velerov1.ObjectStorageLocation{ Bucket: "azure-bucket", }, }, Config: map[string]string{ StorageAccount: "velero-azure-account", ResourceGroup: testResourceGroup, RegistryStorageAzureAccountnameEnvVarKey: "velero-azure-account", "storageAccountKeyEnvVar": "AZURE_STORAGE_ACCOUNT_ACCESS_KEY", }, }, }, secret: &corev1.Secret{ ObjectMeta: metav1.ObjectMeta{ Name: "cloud-credentials-azure", Namespace: "test-ns", }, Data: secretAzureData, }, registrySecret: &corev1.Secret{ ObjectMeta: metav1.ObjectMeta{ Name: "oadp-test-bsl-azure-registry-secret", Namespace: "test-ns", }, Data: azureRegistrySecretData, }, wantProfile: "test-profile", matchProfile: true, }, { name: "given azure bsl & SP credentials, appropriate env var for the container are returned", bsl: &velerov1.BackupStorageLocation{ ObjectMeta: metav1.ObjectMeta{ Name: "test-bsl", Namespace: "test-ns", }, Spec: velerov1.BackupStorageLocationSpec{ Provider: AzureProvider, StorageType: velerov1.StorageType{ ObjectStorage: &velerov1.ObjectStorageLocation{ Bucket: "azure-bucket", }, }, Config: map[string]string{ StorageAccount: "velero-azure-account", ResourceGroup: testResourceGroup, "subscriptionId": testSubscriptionID, }, }, }, secret: &corev1.Secret{ ObjectMeta: metav1.ObjectMeta{ Name: "cloud-credentials-azure", Namespace: "test-ns", }, Data: secretAzureServicePrincipalData, }, registrySecret: &corev1.Secret{ ObjectMeta: metav1.ObjectMeta{ Name: "oadp-test-bsl-azure-registry-secret", Namespace: "test-ns", }, Data: azureRegistrySPSecretData, }, wantProfile: "test-sp-profile", matchProfile: true, }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { fakeClient, err := getFakeClientFromObjectsForRegistry(tt.secret, tt.bsl, tt.registrySecret) if err != nil { t.Errorf("error in creating fake client, likely programmer error") } r := &DPAReconciler{ Client: fakeClient, Scheme: fakeClient.Scheme(), Log: logr.Discard(), Context: newContextForTest(tt.name), NamespacedName: types.NamespacedName{ Namespace: tt.bsl.Namespace, Name: tt.bsl.Name, }, EventRecorder: record.NewFakeRecorder(10), } tt.wantRegistryContainerEnvVar = []corev1.EnvVar{ { Name: RegistryStorageEnvVarKey, Value: Azure, }, { Name: RegistryStorageAzureContainerEnvVarKey, Value: "azure-bucket", }, { Name: RegistryStorageAzureAccountnameEnvVarKey, Value: "velero-azure-account", }, { Name: RegistryStorageAzureAccountkeyEnvVarKey, ValueFrom: &corev1.EnvVarSource{ SecretKeyRef: &corev1.SecretKeySelector{ LocalObjectReference: corev1.LocalObjectReference{Name: "oadp-" + tt.bsl.Name + "-" + tt.bsl.Spec.Provider + "-registry-secret"}, Key: "storage_account_key", }, }, }, { Name: RegistryStorageAzureAADEndpointEnvVarKey, Value: "", }, { Name: RegistryStorageAzureSPNClientIDEnvVarKey, ValueFrom: &corev1.EnvVarSource{ SecretKeyRef: &corev1.SecretKeySelector{ LocalObjectReference: corev1.LocalObjectReference{Name: "oadp-" + tt.bsl.Name + "-" + tt.bsl.Spec.Provider + "-registry-secret"}, Key: "client_id_key", }, }, }, { Name: RegistryStorageAzureSPNClientSecretEnvVarKey, ValueFrom: &corev1.EnvVarSource{ SecretKeyRef: &corev1.SecretKeySelector{ LocalObjectReference: corev1.LocalObjectReference{Name: "oadp-" + tt.bsl.Name + "-" + tt.bsl.Spec.Provider + "-registry-secret"}, Key: "client_secret_key", }, }, }, { Name: RegistryStorageAzureSPNTenantIDEnvVarKey, ValueFrom: &corev1.EnvVarSource{ SecretKeyRef: &corev1.SecretKeySelector{ LocalObjectReference: corev1.LocalObjectReference{Name: "oadp-" + tt.bsl.Name + "-" + tt.bsl.Spec.Provider + "-registry-secret"}, Key: "tenant_id_key", }, }, }, } if tt.wantProfile == "test-sp-profile" { tt.wantRegistryContainerEnvVar = []corev1.EnvVar{ { Name: RegistryStorageEnvVarKey, Value: Azure, }, { Name: RegistryStorageAzureContainerEnvVarKey, Value: "azure-bucket", }, { Name: RegistryStorageAzureAccountnameEnvVarKey, Value: "velero-azure-account", }, { Name: RegistryStorageAzureAccountkeyEnvVarKey, ValueFrom: &corev1.EnvVarSource{ SecretKeyRef: &corev1.SecretKeySelector{ LocalObjectReference: corev1.LocalObjectReference{Name: "oadp-" + tt.bsl.Name + "-" + tt.bsl.Spec.Provider + "-registry-secret"}, Key: "storage_account_key", }, }, }, { Name: RegistryStorageAzureAADEndpointEnvVarKey, Value: "", }, { Name: RegistryStorageAzureSPNClientIDEnvVarKey, ValueFrom: &corev1.EnvVarSource{ SecretKeyRef: &corev1.SecretKeySelector{ LocalObjectReference: corev1.LocalObjectReference{Name: "oadp-" + tt.bsl.Name + "-" + tt.bsl.Spec.Provider + "-registry-secret"}, Key: "client_id_key", }, }, }, { Name: RegistryStorageAzureSPNClientSecretEnvVarKey, ValueFrom: &corev1.EnvVarSource{ SecretKeyRef: &corev1.SecretKeySelector{ LocalObjectReference: corev1.LocalObjectReference{Name: "oadp-" + tt.bsl.Name + "-" + tt.bsl.Spec.Provider + "-registry-secret"}, Key: "client_secret_key", }, }, }, { Name: RegistryStorageAzureSPNTenantIDEnvVarKey, ValueFrom: &corev1.EnvVarSource{ SecretKeyRef: &corev1.SecretKeySelector{ LocalObjectReference: corev1.LocalObjectReference{Name: "oadp-" + tt.bsl.Name + "-" + tt.bsl.Spec.Provider + "-registry-secret"}, Key: "tenant_id_key", }, }, }, } } gotRegistryContainerEnvVar, gotErr := r.getAzureRegistryEnvVars(tt.bsl, testAzureEnvVar) if tt.matchProfile && (gotErr != nil) != tt.wantErr { t.Errorf("ValidateBackupStorageLocations() gotErr = %v, wantErr %v", gotErr, tt.wantErr) return } if tt.matchProfile && !reflect.DeepEqual(tt.wantRegistryContainerEnvVar, gotRegistryContainerEnvVar) { t.Errorf("expected registry container env var to be %#v, got %#v", tt.wantRegistryContainerEnvVar, gotRegistryContainerEnvVar) } }) } }
explode_data.jsonl/45544
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 3728 }
[ 2830, 3393, 35, 8041, 693, 40446, 5769, 3062, 78107, 15603, 14359, 28305, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 3056, 1235, 341, 197, 11609, 664, 914, 198, 197, 93801, 75, 5108, 353, 889, 261, 859, 16, 8864, 454, 5793, 4707, 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...
7
func TestNBSDatabaseSpec(t *testing.T) { assert := assert.New(t) run := func(prefix string) { tmpDir, err := ioutil.TempDir("", "spec_test") assert.NoError(err) defer os.RemoveAll(tmpDir) s := types.String("string") // Existing database in the database are read from the spec. store1 := filepath.Join(tmpDir, "store1") os.Mkdir(store1, 0777) func() { cs, err := nbs.NewLocalStore(context.Background(), types.Format_Default.VersionString(), store1, 8*(1<<20)) assert.NoError(err) db := datas.NewDatabase(cs) defer db.Close() r, err := db.WriteValue(context.Background(), s) assert.NoError(err) ds, err := db.GetDataset(context.Background(), "datasetID") assert.NoError(err) _, err = db.CommitValue(context.Background(), ds, r) assert.NoError(err) }() spec1, err := ForDatabase(prefix + store1) assert.NoError(err) defer spec1.Close() assert.Equal("nbs", spec1.Protocol) assert.Equal(store1, spec1.DatabaseName) assert.Equal(s, mustValue(spec1.GetDatabase(context.Background()).ReadValue(context.Background(), mustHash(s.Hash(types.Format_7_18))))) // New databases can be created and read/written from. store2 := filepath.Join(tmpDir, "store2") os.Mkdir(store2, 0777) spec2, err := ForDatabase(prefix + store2) assert.NoError(err) defer spec2.Close() assert.Equal("nbs", spec2.Protocol) assert.Equal(store2, spec2.DatabaseName) db := spec2.GetDatabase(context.Background()) db.WriteValue(context.Background(), s) r, err := db.WriteValue(context.Background(), s) assert.NoError(err) ds, err := db.GetDataset(context.Background(), "datasetID") assert.NoError(err) _, err = db.CommitValue(context.Background(), ds, r) assert.NoError(err) assert.Equal(s, mustValue(db.ReadValue(context.Background(), mustHash(s.Hash(types.Format_7_18))))) } run("") run("nbs:") }
explode_data.jsonl/49590
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 736 }
[ 2830, 3393, 45, 30029, 2211, 8327, 1155, 353, 8840, 836, 8, 341, 6948, 1669, 2060, 7121, 1155, 692, 56742, 1669, 2915, 28918, 914, 8, 341, 197, 20082, 6184, 11, 1848, 1669, 43144, 65009, 6184, 19814, 330, 9535, 4452, 1138, 197, 6948, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func Test_GenericDriver_Exec_error(t *testing.T) { db, mock, err := sqlmock.New() if err != nil { t.Errorf("sqlmock.New().error != nil, wants nil") } defer db.Close() stmt := "CREATE TABLE HELLO (id INT);" dialect := MySQLDialect{} d, _ := NewGenericDriver(db, dialect) mock.ExpectBegin() mock.ExpectExec(escapeQuery(stmt)). WillReturnError(errors.New("Generic Error")) mock.ExpectRollback() d.Exec(stmt) if err := mock.ExpectationsWereMet(); err != nil { t.Errorf("there were unfulfilled expections: %s", err) } }
explode_data.jsonl/78095
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 210 }
[ 2830, 3393, 29085, 11349, 62, 10216, 4096, 1155, 353, 8840, 836, 8, 341, 20939, 11, 7860, 11, 1848, 1669, 5704, 16712, 7121, 2822, 743, 1848, 961, 2092, 341, 197, 3244, 13080, 445, 3544, 16712, 7121, 1005, 841, 961, 2092, 11, 6801, 20...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestContextContentType(t *testing.T) { c, _ := CreateTestContext(httptest.NewRecorder()) c.Request, _ = http.NewRequest("POST", "/", nil) c.Request.Header.Set("Content-Type", "application/json; charset=utf-8") assert.Equal(t, "application/json", c.ContentType()) }
explode_data.jsonl/26817
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 97 }
[ 2830, 3393, 1972, 29504, 1155, 353, 8840, 836, 8, 341, 1444, 11, 716, 1669, 4230, 2271, 1972, 73392, 83, 70334, 7121, 47023, 2398, 1444, 9659, 11, 716, 284, 1758, 75274, 445, 2946, 497, 64657, 2092, 340, 1444, 9659, 15753, 4202, 445, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestAnnotationsInDomainTemplate(t *testing.T) { networkConfigTests := []struct { name string wantErr bool wantDomainTemplate string config *corev1.ConfigMap data DomainTemplateValues }{{ name: "network configuration with annotations in template", wantErr: false, wantDomainTemplate: "foo.sub1.baz.com", config: &corev1.ConfigMap{ ObjectMeta: metav1.ObjectMeta{ Namespace: system.Namespace(), Name: ConfigName, }, Data: map[string]string{ DefaultIngressClassKey: "foo-ingress", DomainTemplateKey: `{{.Name}}.{{ index .Annotations "sub"}}.{{.Domain}}`, }, }, data: DomainTemplateValues{ Name: "foo", Namespace: "bar", Annotations: map[string]string{ "sub": "sub1"}, Domain: "baz.com"}, }, { name: "network configuration without annotations in template", wantErr: false, wantDomainTemplate: "foo.bar.baz.com", config: &corev1.ConfigMap{ ObjectMeta: metav1.ObjectMeta{ Namespace: system.Namespace(), Name: ConfigName, }, Data: map[string]string{ DefaultIngressClassKey: "foo-ingress", DomainTemplateKey: `{{.Name}}.{{.Namespace}}.{{.Domain}}`, }, }, data: DomainTemplateValues{ Name: "foo", Namespace: "bar", Domain: "baz.com"}, }} for _, tt := range networkConfigTests { t.Run(tt.name, func(t *testing.T) { actualConfigCM, err := NewConfigFromConfigMap(tt.config) if (err != nil) != tt.wantErr { t.Fatalf("NewConfigFromMap() error = %v, WantErr %v", err, tt.wantErr) } actualConfig, err := NewConfigFromMap(tt.config.Data) if (err != nil) != tt.wantErr { t.Fatalf("NewConfigFromMap() error = %v, WantErr %v", err, tt.wantErr) } if diff := cmp.Diff(actualConfigCM, actualConfig); diff != "" { t.Errorf("Config mismatch: diff(-want,+got):\n%s", diff) } if tt.wantErr { return } got := mustExecute(t, actualConfig.GetDomainTemplate(), tt.data) if got != tt.wantDomainTemplate { t.Errorf("DomainTemplate(data) = %s, wanted %s", got, tt.wantDomainTemplate) } }) } }
explode_data.jsonl/58826
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 997 }
[ 2830, 3393, 21418, 641, 13636, 7275, 1155, 353, 8840, 836, 8, 341, 9038, 2349, 2648, 18200, 1669, 3056, 1235, 341, 197, 11609, 2290, 914, 198, 197, 50780, 7747, 310, 1807, 198, 197, 50780, 13636, 7275, 914, 198, 197, 25873, 1797, 353, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
6
func TestNewPointsRejectsMaxKey(t *testing.T) { var key string // tsm field key is point key, separator (4 bytes) and field for i := 0; i < models.MaxKeyLength-len("value")-4; i++ { key += "a" } // Test max key len if _, err := models.NewPoint(key, nil, models.Fields{"value": 1, "ok": 2.0}, time.Now()); err != nil { t.Fatalf("new point with max key. got: %v, expected: nil", err) } if _, err := models.ParsePointsString(fmt.Sprintf("%v value=1,ok=2.0", key)); err != nil { t.Fatalf("parse point with max key. got: %v, expected: nil", err) } // Test 1 byte over max key len key += "a" if _, err := models.NewPoint(key, nil, models.Fields{"value": 1, "ok": 2.0}, time.Now()); err == nil { t.Fatalf("new point with max key. got: nil, expected: error") } if _, err := models.ParsePointsString(fmt.Sprintf("%v value=1,ok=2.0", key)); err == nil { t.Fatalf("parse point with max key. got: nil, expected: error") } }
explode_data.jsonl/16974
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 366 }
[ 2830, 3393, 3564, 11411, 78413, 82, 5974, 1592, 1155, 353, 8840, 836, 8, 341, 2405, 1376, 914, 198, 197, 322, 259, 3563, 2070, 1376, 374, 1459, 1376, 11, 24792, 320, 19, 5820, 8, 323, 2070, 198, 2023, 600, 1669, 220, 15, 26, 600, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestListNextResultsMultiPages(t *testing.T) { ctrl := gomock.NewController(t) defer ctrl.Finish() tests := []struct { name string prepareErr error sendErr *retry.Error expectedErrMsg string }{ { name: "testlistNextResultsSuccessful", prepareErr: nil, sendErr: nil, }, { name: "testPrepareGetRequestError", prepareErr: fmt.Errorf("error"), expectedErrMsg: "Failure preparing next results request", }, { name: "testSendError", sendErr: &retry.Error{RawError: fmt.Errorf("error")}, expectedErrMsg: "Failure sending next results request", }, } lastResult := compute.VirtualMachineListResult{ NextLink: to.StringPtr("next"), } for _, test := range tests { armClient := mockarmclient.NewMockInterface(ctrl) req := &http.Request{ Method: "GET", } armClient.EXPECT().PrepareGetRequest(gomock.Any(), gomock.Any()).Return(req, test.prepareErr) if test.prepareErr == nil { armClient.EXPECT().Send(gomock.Any(), req).Return(&http.Response{ StatusCode: http.StatusOK, Body: ioutil.NopCloser(bytes.NewReader([]byte(`{"foo":"bar"}`))), }, test.sendErr) armClient.EXPECT().CloseResponse(gomock.Any(), gomock.Any()) } vmssClient := getTestVMClient(armClient) result, err := vmssClient.listNextResults(context.TODO(), lastResult) if err != nil { assert.Equal(t, err.(autorest.DetailedError).Message, test.expectedErrMsg) } else { assert.NoError(t, err) } if test.prepareErr != nil { assert.Empty(t, result) } else { assert.NotEmpty(t, result) } } }
explode_data.jsonl/16694
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 695 }
[ 2830, 3393, 852, 5847, 9801, 20358, 17713, 1155, 353, 8840, 836, 8, 341, 84381, 1669, 342, 316, 1176, 7121, 2051, 1155, 340, 16867, 23743, 991, 18176, 2822, 78216, 1669, 3056, 1235, 341, 197, 11609, 1843, 914, 198, 197, 197, 13609, 7747...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestConnQuery(t *testing.T) { db := newTestDB(t, "people") defer closeDB(t, db) ctx, cancel := context.WithCancel(context.Background()) defer cancel() conn, err := db.Conn(ctx) if err != nil { t.Fatal(err) } conn.dc.ci.(*fakeConn).skipDirtySession = true defer conn.Close() var name string err = conn.QueryRowContext(ctx, "SELECT|people|name|age=?", 3).Scan(&name) if err != nil { t.Fatal(err) } if name != "Chris" { t.Fatalf("unexpected result, got %q want Chris", name) } err = conn.PingContext(ctx) if err != nil { t.Fatal(err) } }
explode_data.jsonl/15979
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 234 }
[ 2830, 3393, 9701, 2859, 1155, 353, 8840, 836, 8, 341, 20939, 1669, 501, 2271, 3506, 1155, 11, 330, 16069, 1138, 16867, 3265, 3506, 1155, 11, 2927, 692, 20985, 11, 9121, 1669, 2266, 26124, 9269, 5378, 19047, 2398, 16867, 9121, 741, 32917...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestPairId(t *testing.T) { b0, b1 := newBody(NewSphere(1)), newBody(NewSphere(1)) b0.bid, b1.bid = 1, 2 con := newContactPair(b0, b1) pid0, pid1 := b0.pairId(b1), b1.pairId(b0) if pid0 != 0x100000002 || pid1 != 0x100000002 || con.pid != 0x100000002 { t.Error("Pair id's should be the same regardless of body order") } }
explode_data.jsonl/4953
{ "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, 12443, 764, 1155, 353, 8840, 836, 8, 341, 2233, 15, 11, 293, 16, 1669, 501, 5444, 35063, 42959, 7, 16, 5731, 501, 5444, 35063, 42959, 7, 16, 1171, 2233, 15, 94615, 11, 293, 16, 94615, 284, 220, 16, 11, 220, 17, 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...
4
func TestVMCSyncStartContainer(t *testing.T) { testForSkip(t) var ctxt = context.Background() //creat a StartImageReq obj and send it to VMCProcess sir := StartImageReq{CCID: ccintf.CCID{ChaincodeSpec: &pb.ChaincodeSpec{ChaincodeId: &pb.ChaincodeID{Name: "simple"}}}} _, err := VMCProcess(ctxt, "Docker", sir) if err != nil { t.Fail() t.Logf("Error starting container: %s", err) return } stopr := StopImageReq{CCID: ccintf.CCID{ChaincodeSpec: &pb.ChaincodeSpec{ChaincodeId: &pb.ChaincodeID{Name: "simple"}}}, Timeout: 0, Dontremove: true} VMCProcess(ctxt, "Docker", stopr) }
explode_data.jsonl/74642
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 234 }
[ 2830, 3393, 11187, 6412, 1721, 3479, 4502, 1155, 353, 8840, 836, 8, 341, 18185, 2461, 35134, 1155, 692, 2405, 59162, 284, 2266, 19047, 2822, 197, 322, 94739, 264, 5145, 1906, 27234, 2839, 323, 3624, 432, 311, 647, 11604, 7423, 198, 1903...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestAddOrUpdateLogConf(t *testing.T) { validLogConf := &unstructured.Unstructured{ Object: map[string]interface{}{ "metadata": map[string]interface{}{ "namespace": "testing", "name": "testlogconf", }, "spec": map[string]interface{}{ "content": map[string]interface{}{}, "filter": map[string]interface{}{}, }, }, } invalidLogConf := &unstructured.Unstructured{ Object: map[string]interface{}{ "metadata": map[string]interface{}{ "namespace": "testing", "name": "testlogconf", }, "spec": map[string]interface{}{ "content": map[string]interface{}{}, }, }, } apc := NewAppProtectConfiguration() tests := []struct { logconf *unstructured.Unstructured expectedChanges []AppProtectChange expectedProblems []AppProtectProblem msg string }{ { logconf: validLogConf, expectedChanges: []AppProtectChange{ {Resource: &AppProtectLogConfEx{ Obj: validLogConf, IsValid: true, }, Op: AddOrUpdate, }, }, expectedProblems: nil, msg: "Basic Case", }, { logconf: invalidLogConf, expectedChanges: []AppProtectChange{ {Resource: &AppProtectLogConfEx{ Obj: invalidLogConf, IsValid: false, ErrorMsg: "Validation Failed", }, Op: Delete, }, }, expectedProblems: []AppProtectProblem{ { Object: invalidLogConf, Reason: "Rejected", Message: "Error validating App Protect Log Configuration testlogconf: Required field map[] not found", }, }, msg: "validation failed", }, } for _, test := range tests { aPChans, aPProbs := apc.AddOrUpdateLogConf(test.logconf) if diff := cmp.Diff(test.expectedChanges, aPChans); diff != "" { t.Errorf("AddOrUpdateLogConf() %q changes returned unexpected result (-want +got):\n%s", test.msg, diff) } if diff := cmp.Diff(test.expectedProblems, aPProbs); diff != "" { t.Errorf("AddOrUpdateLogConf() %q problems returned unexpected result (-want +got):\n%s", test.msg, diff) } } }
explode_data.jsonl/19385
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 872 }
[ 2830, 3393, 2212, 56059, 2201, 15578, 1155, 353, 8840, 836, 8, 341, 56322, 2201, 15578, 1669, 609, 359, 51143, 10616, 51143, 515, 197, 23816, 25, 2415, 14032, 31344, 67066, 298, 197, 1, 17637, 788, 2415, 14032, 31344, 67066, 571, 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...
4
func TestClient_ShowBridge(t *testing.T) { t.Parallel() app, cleanup := cltest.NewApplication(t, cltest.EthMockRegisterChainID) defer cleanup() require.NoError(t, app.StartAndConnect()) bt := &models.BridgeType{ Name: models.MustNewTaskType("testingbridges1"), URL: cltest.WebURL(t, "https://testing.com/bridges"), Confirmations: 0, } require.NoError(t, app.GetStore().CreateBridgeType(bt)) client, r := app.NewClientAndRenderer() set := flag.NewFlagSet("test", 0) set.Parse([]string{bt.Name.String()}) c := cli.NewContext(nil, set, nil) require.NoError(t, client.ShowBridge(c)) require.Len(t, r.Renders, 1) assert.Equal(t, bt.Name, r.Renders[0].(*models.BridgeType).Name) }
explode_data.jsonl/78849
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 291 }
[ 2830, 3393, 2959, 79665, 32848, 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, 17957, 35699, 1155, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestProcess_Address(t *testing.T) { var network, address string process := &phpfpm.Process{} process.Listen = "192.168.123.456:12345" network, address = process.Address() if want, have := "tcp", network; want != have { t.Errorf("expected %#v; got %#v", want, have) } if want, have := "192.168.123.456:12345", address; want != have { t.Errorf("expected %#v; got %#v", want, have) } process.Listen = "12345" network, address = process.Address() if want, have := "tcp", network; want != have { t.Errorf("expected %#v; got %#v", want, have) } if want, have := ":12345", address; want != have { t.Errorf("expected %#v; got %#v", want, have) } process.Listen = "hello.sock" network, address = process.Address() if want, have := "unix", network; want != have { t.Errorf("expected %#v; got %#v", want, have) } if want, have := "hello.sock", address; want != have { t.Errorf("expected %#v; got %#v", want, have) } process.Listen = "/path/to/hello.sock" network, address = process.Address() if want, have := "unix", network; want != have { t.Errorf("expected %#v; got %#v", want, have) } if want, have := "/path/to/hello.sock", address; want != have { t.Errorf("expected %#v; got %#v", want, have) } }
explode_data.jsonl/49281
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 484 }
[ 2830, 3393, 7423, 64899, 1155, 353, 8840, 836, 8, 341, 2405, 3922, 11, 2621, 914, 198, 53314, 1669, 609, 1208, 69, 5187, 29012, 31483, 53314, 68334, 284, 330, 16, 24, 17, 13, 16, 21, 23, 13, 16, 17, 18, 13, 19, 20, 21, 25, 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...
9
func TestCheckProgramBasic(t *testing.T) { input := `nop +0 acc +1 jmp +4 acc +3 jmp -3 acc -99 acc +1 jmp -4 acc +6` var want = 5 result, err := CheckProgramForInfiniteLoop(&input) if want != result || err != nil { t.Fatalf(`Error: "%v", want %v got %v`, err, want, result) } }
explode_data.jsonl/19333
{ "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, 3973, 10690, 15944, 1155, 353, 8840, 836, 8, 341, 22427, 1669, 1565, 62813, 488, 15, 198, 4475, 488, 16, 198, 61055, 488, 19, 198, 4475, 488, 18, 198, 61055, 481, 18, 198, 4475, 481, 24, 24, 198, 4475, 488, 16, 198, 61...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestAvailableStatusesCopy(t *testing.T) { num := 100 for i := 0; i < num; i++ { a := randAvailableStatuses() b := a.Copy() if !reflect.DeepEqual(a, b) { t.Errorf("expected a and b DeepEqual, actual copied map not equal", a, b) } // verify a and b don't point to the same map a[tc.CacheName(randStr())] = AvailableStatus{Available: randBool(), Status: randStr()} if reflect.DeepEqual(a, b) { t.Errorf("expected a != b, actual a and b point to the same map", a) } } }
explode_data.jsonl/72336
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 194 }
[ 2830, 3393, 16485, 2522, 288, 12106, 1155, 353, 8840, 836, 8, 341, 22431, 1669, 220, 16, 15, 15, 198, 2023, 600, 1669, 220, 15, 26, 600, 366, 1629, 26, 600, 1027, 341, 197, 11323, 1669, 10382, 16485, 2522, 288, 741, 197, 2233, 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 TestBitStream(t *testing.T) { buf := bytes.NewBuffer(nil) br := NewReader(strings.NewReader("hello")) bw := NewWriter(buf) for { bit, err := br.ReadBit() if err == io.EOF { break } if err != nil { t.Error("GetBit returned error err=", err.Error()) return } err = bw.WriteBit(bit) if err != nil { t.Errorf("unexpected writer error") } } s := buf.String() if s != "hello" { t.Error("expected 'hello', got=", []byte(s)) } }
explode_data.jsonl/13774
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 202 }
[ 2830, 3393, 8344, 3027, 1155, 353, 8840, 836, 8, 1476, 26398, 1669, 5820, 7121, 4095, 27907, 340, 80255, 1669, 1532, 5062, 51442, 68587, 445, 14990, 5455, 2233, 86, 1669, 1532, 6492, 10731, 692, 2023, 341, 197, 79980, 11, 1848, 1669, 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...
6
func TestWatchAccessList_Initial_Unparseable(t *testing.T) { initial := ` 332332 rfjeritojoi ` _, stopCh, _, err := setupWatchAccessList(t, initial) defer close(stopCh) if err == nil { t.Fatal("Expected error not found") } }
explode_data.jsonl/78747
{ "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, 14247, 6054, 852, 62, 6341, 40687, 6400, 480, 1155, 353, 8840, 836, 8, 341, 85270, 1669, 22074, 18, 18, 17, 18, 18, 17, 198, 7000, 69, 26360, 6357, 73, 6728, 198, 19324, 197, 6878, 2936, 1143, 11, 8358, 1848, 1669, 6505,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestCartesian_Coord(t *testing.T) { c := NewCartesian(1, 2) tests := map[int]int{ 0: 1, 1: 2, } for n, want := range tests { t.Run(string(rune(n)), func(t *testing.T) { got, err := c.Coord(n) if err != nil { t.Error(err) } if got != want { t.Errorf("expected %d, but got %d", want, got) } }) } // test for err t.Run("err", func(t *testing.T) { _, err := c.Coord(2) if err == nil { t.Errorf("expected and error for n == 2") } }) }
explode_data.jsonl/77438
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 242 }
[ 2830, 3393, 12593, 29221, 920, 81437, 1155, 353, 8840, 836, 8, 341, 1444, 1669, 1532, 12593, 29221, 7, 16, 11, 220, 17, 692, 78216, 1669, 2415, 18640, 63025, 515, 197, 197, 15, 25, 220, 16, 345, 197, 197, 16, 25, 220, 17, 345, 197...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestInitDefault(t *testing.T) { err := Init("") require.Nil(t, err) for k := range templates.Default { _, err := GetTemplate(k) require.Nilf(t, err, "%q template should exist") } }
explode_data.jsonl/69675
{ "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, 3803, 3675, 1155, 353, 8840, 836, 8, 341, 9859, 1669, 15690, 31764, 17957, 59678, 1155, 11, 1848, 692, 2023, 595, 1669, 2088, 19911, 13275, 341, 197, 197, 6878, 1848, 1669, 2126, 7275, 5969, 340, 197, 17957, 59678, 69, 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 ]
2
func TestRoundTripping(t *testing.T) { expected := []v1.TrafficTarget{{ RevisionName: goodOldRev.Name, Percent: ptr.Int64(100), LatestRevision: ptr.Bool(false), }, { Tag: "beta", RevisionName: goodNewRev.Name, URL: domains.URL(domains.HTTPScheme, "beta-test-route.test.example.com"), LatestRevision: ptr.Bool(false), }, { Tag: "alpha", RevisionName: niceNewRev.Name, URL: domains.URL(domains.HTTPScheme, "alpha-test-route.test.example.com"), LatestRevision: ptr.Bool(true), }} route := testRouteWithTrafficTargets(WithSpecTraffic(v1.TrafficTarget{ RevisionName: goodOldRev.Name, Percent: ptr.Int64(100), }, v1.TrafficTarget{ Tag: "beta", RevisionName: goodNewRev.Name, }, v1.TrafficTarget{ Tag: "alpha", ConfigurationName: niceConfig.Name, })) if tc, err := BuildTrafficConfiguration(configLister, revLister, route); err != nil { t.Error("Unexpected error", err) } else { targets, err := tc.GetRevisionTrafficTargets(getContext(), route) if err != nil { t.Error("Unexpected error:", err) } if got, want := targets, expected; !cmp.Equal(want, got) { t.Errorf("Unexpected traffic diff (-want +got):\n%s", cmp.Diff(want, got)) } } }
explode_data.jsonl/37890
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 564 }
[ 2830, 3393, 27497, 21884, 10732, 1155, 353, 8840, 836, 8, 341, 42400, 1669, 3056, 85, 16, 836, 956, 20615, 6397, 90, 515, 197, 197, 33602, 675, 25, 256, 1661, 18284, 36184, 2967, 345, 197, 197, 32010, 25, 286, 10087, 7371, 21, 19, 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...
4
func TestStructPartial(t *testing.T) { p1 := []string{ "NoTag", "Required", } p2 := []string{ "SubSlice[0].Test", "Sub", "SubIgnore", "Anonymous.A", } p3 := []string{ "SubTest.Test", } p4 := []string{ "A", } tPartial := &TestPartial{ NoTag: "NoTag", Required: "Required", SubSlice: []*SubTest{ { Test: "Required", }, { Test: "Required", }, }, Sub: &SubTest{ Test: "1", }, SubIgnore: &SubTest{ Test: "", }, Anonymous: struct { A string `validate:"required"` ASubSlice []*SubTest `validate:"required,dive"` SubAnonStruct []struct { Test string `validate:"required"` OtherTest string `validate:"required"` } `validate:"required,dive"` }{ A: "1", ASubSlice: []*SubTest{ { Test: "Required", }, { Test: "Required", }, }, SubAnonStruct: []struct { Test string `validate:"required"` OtherTest string `validate:"required"` }{ {"Required", "RequiredOther"}, {"Required", "RequiredOther"}, }, }, } validate := New() // the following should all return no errors as everything is valid in // the default state errs := validate.StructPartialCtx(context.Background(), tPartial, p1...) Equal(t, errs, nil) errs = validate.StructPartial(tPartial, p2...) Equal(t, errs, nil) // this isn't really a robust test, but is ment to illustrate the ANON CASE below errs = validate.StructPartial(tPartial.SubSlice[0], p3...) Equal(t, errs, nil) errs = validate.StructExceptCtx(context.Background(), tPartial, p1...) Equal(t, errs, nil) errs = validate.StructExcept(tPartial, p2...) Equal(t, errs, nil) // mod tParial for required feild and re-test making sure invalid fields are NOT required: tPartial.Required = "" errs = validate.StructExcept(tPartial, p1...) Equal(t, errs, nil) errs = validate.StructPartial(tPartial, p2...) Equal(t, errs, nil) // inversion and retesting Partial to generate failures: errs = validate.StructPartial(tPartial, p1...) NotEqual(t, errs, nil) AssertError(t, errs, "TestPartial.Required", "TestPartial.Required", "Required", "Required", "required") errs = validate.StructExcept(tPartial, p2...) AssertError(t, errs, "TestPartial.Required", "TestPartial.Required", "Required", "Required", "required") // reset Required field, and set nested struct tPartial.Required = "Required" tPartial.Anonymous.A = "" // will pass as unset feilds is not going to be tested errs = validate.StructPartial(tPartial, p1...) Equal(t, errs, nil) errs = validate.StructExcept(tPartial, p2...) Equal(t, errs, nil) // ANON CASE the response here is strange, it clearly does what it is being told to errs = validate.StructExcept(tPartial.Anonymous, p4...) Equal(t, errs, nil) // will fail as unset feild is tested errs = validate.StructPartial(tPartial, p2...) NotEqual(t, errs, nil) AssertError(t, errs, "TestPartial.Anonymous.A", "TestPartial.Anonymous.A", "A", "A", "required") errs = validate.StructExcept(tPartial, p1...) NotEqual(t, errs, nil) AssertError(t, errs, "TestPartial.Anonymous.A", "TestPartial.Anonymous.A", "A", "A", "required") // reset nested struct and unset struct in slice tPartial.Anonymous.A = "Required" tPartial.SubSlice[0].Test = "" // these will pass as unset item is NOT tested errs = validate.StructPartial(tPartial, p1...) Equal(t, errs, nil) errs = validate.StructExcept(tPartial, p2...) Equal(t, errs, nil) // these will fail as unset item IS tested errs = validate.StructExcept(tPartial, p1...) AssertError(t, errs, "TestPartial.SubSlice[0].Test", "TestPartial.SubSlice[0].Test", "Test", "Test", "required") Equal(t, len(errs.(ValidationErrors)), 1) errs = validate.StructPartial(tPartial, p2...) NotEqual(t, errs, nil) AssertError(t, errs, "TestPartial.SubSlice[0].Test", "TestPartial.SubSlice[0].Test", "Test", "Test", "required") Equal(t, len(errs.(ValidationErrors)), 1) // Unset second slice member concurrently to test dive behavior: tPartial.SubSlice[1].Test = "" errs = validate.StructPartial(tPartial, p1...) Equal(t, errs, nil) // NOTE: When specifying nested items, it is still the users responsibility // to specify the dive tag, the library does not override this. errs = validate.StructExcept(tPartial, p2...) NotEqual(t, errs, nil) AssertError(t, errs, "TestPartial.SubSlice[1].Test", "TestPartial.SubSlice[1].Test", "Test", "Test", "required") errs = validate.StructExcept(tPartial, p1...) Equal(t, len(errs.(ValidationErrors)), 2) AssertError(t, errs, "TestPartial.SubSlice[0].Test", "TestPartial.SubSlice[0].Test", "Test", "Test", "required") AssertError(t, errs, "TestPartial.SubSlice[1].Test", "TestPartial.SubSlice[1].Test", "Test", "Test", "required") errs = validate.StructPartial(tPartial, p2...) NotEqual(t, errs, nil) Equal(t, len(errs.(ValidationErrors)), 1) AssertError(t, errs, "TestPartial.SubSlice[0].Test", "TestPartial.SubSlice[0].Test", "Test", "Test", "required") // reset struct in slice, and unset struct in slice in unset posistion tPartial.SubSlice[0].Test = "Required" // these will pass as the unset item is NOT tested errs = validate.StructPartial(tPartial, p1...) Equal(t, errs, nil) errs = validate.StructPartial(tPartial, p2...) Equal(t, errs, nil) // testing for missing item by exception, yes it dives and fails errs = validate.StructExcept(tPartial, p1...) NotEqual(t, errs, nil) Equal(t, len(errs.(ValidationErrors)), 1) AssertError(t, errs, "TestPartial.SubSlice[1].Test", "TestPartial.SubSlice[1].Test", "Test", "Test", "required") errs = validate.StructExcept(tPartial, p2...) NotEqual(t, errs, nil) AssertError(t, errs, "TestPartial.SubSlice[1].Test", "TestPartial.SubSlice[1].Test", "Test", "Test", "required") tPartial.SubSlice[1].Test = "Required" tPartial.Anonymous.SubAnonStruct[0].Test = "" // these will pass as the unset item is NOT tested errs = validate.StructPartial(tPartial, p1...) Equal(t, errs, nil) errs = validate.StructPartial(tPartial, p2...) Equal(t, errs, nil) errs = validate.StructExcept(tPartial, p1...) NotEqual(t, errs, nil) AssertError(t, errs, "TestPartial.Anonymous.SubAnonStruct[0].Test", "TestPartial.Anonymous.SubAnonStruct[0].Test", "Test", "Test", "required") errs = validate.StructExcept(tPartial, p2...) NotEqual(t, errs, nil) AssertError(t, errs, "TestPartial.Anonymous.SubAnonStruct[0].Test", "TestPartial.Anonymous.SubAnonStruct[0].Test", "Test", "Test", "required") }
explode_data.jsonl/77224
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 2550 }
[ 2830, 3393, 9422, 37314, 1155, 353, 8840, 836, 8, 341, 3223, 16, 1669, 3056, 917, 515, 197, 197, 38422, 5668, 756, 197, 197, 1, 8164, 756, 197, 630, 3223, 17, 1669, 3056, 917, 515, 197, 197, 1, 3136, 33236, 58, 15, 936, 2271, 756,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestDateFormat(t *testing.T) { for i, this := range []struct { layout string value interface{} expect interface{} }{ {"Monday, Jan 2, 2006", "2015-01-21", "Wednesday, Jan 21, 2015"}, {"Monday, Jan 2, 2006", time.Date(2015, time.January, 21, 0, 0, 0, 0, time.UTC), "Wednesday, Jan 21, 2015"}, {"This isn't a date layout string", "2015-01-21", "This isn't a date layout string"}, {"Monday, Jan 2, 2006", 1421733600, "Tuesday, Jan 20, 2015"}, {"Monday, Jan 2, 2006", 1421733600.123, false}, {time.RFC3339, time.Date(2016, time.March, 3, 4, 5, 0, 0, time.UTC), "2016-03-03T04:05:00Z"}, {time.RFC1123, time.Date(2016, time.March, 3, 4, 5, 0, 0, time.UTC), "Thu, 03 Mar 2016 04:05:00 UTC"}, {time.RFC3339, "Thu, 03 Mar 2016 04:05:00 UTC", "2016-03-03T04:05:00Z"}, {time.RFC1123, "2016-03-03T04:05:00Z", "Thu, 03 Mar 2016 04:05:00 UTC"}, } { result, err := dateFormat(this.layout, this.value) if b, ok := this.expect.(bool); ok && !b { if err == nil { t.Errorf("[%d] DateFormat didn't return an expected error, got %v", i, result) } } else { if err != nil { t.Errorf("[%d] DateFormat failed: %s", i, err) continue } if result != this.expect { t.Errorf("[%d] DateFormat got %v but expected %v", i, result, this.expect) } } } }
explode_data.jsonl/9245
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 554 }
[ 2830, 3393, 16611, 1155, 353, 8840, 836, 8, 341, 2023, 600, 11, 419, 1669, 2088, 3056, 1235, 341, 197, 61104, 914, 198, 197, 16309, 220, 3749, 16094, 197, 24952, 3749, 16094, 197, 59403, 197, 197, 4913, 35239, 11, 4350, 220, 17, 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