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 TestContextNegotiationWithHTML(t *testing.T) { w := httptest.NewRecorder() c, router := CreateTestContext(w) c.Request, _ = http.NewRequest("POST", "", nil) templ := template.Must(template.New("t").Parse(`Hello {{.name}}`)) router.SetHTMLTemplate(templ) c.Negotiate(http.StatusOK, Negotiate{ Offered: []string{MIMEHTML}, Data: H{"name": "gin"}, HTMLName: "t", }) assert.Equal(t, http.StatusOK, w.Code) assert.Equal(t, "Hello gin", w.Body.String()) assert.Equal(t, "text/html; charset=utf-8", w.Header().Get("Content-Type")) }
explode_data.jsonl/26804
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 225 }
[ 2830, 3393, 1972, 47800, 354, 7101, 2354, 5835, 1155, 353, 8840, 836, 8, 341, 6692, 1669, 54320, 70334, 7121, 47023, 741, 1444, 11, 9273, 1669, 4230, 2271, 1972, 3622, 340, 1444, 9659, 11, 716, 284, 1758, 75274, 445, 2946, 497, 7342, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestAddNodeIDToDimensionReturnsNotFound(t *testing.T) { t.Parallel() Convey("Given a mocked Dataset API that fails to update dimension node ID due to DimensionNodeNotFound error", t, func() { w := httptest.NewRecorder() mockedDataStore, isLocked := storeMockWithLock(true) mockedDataStore.UpdateETagForOptionsFunc = func(ctx context.Context, currentInstance *models.Instance, upserts []*models.CachedDimensionOption, updates []*models.DimensionOption, eTagSelector string) (string, error) { So(*isLocked, ShouldBeTrue) return testETag, nil } mockedDataStore.UpdateDimensionsNodeIDAndOrderFunc = func(ctx context.Context, updates []*models.DimensionOption) error { So(*isLocked, ShouldBeTrue) return errs.ErrDimensionNodeNotFound } datasetAPI := getAPIWithCMDMocks(testContext, mockedDataStore, &mocks.DownloadsGeneratorMock{}) Convey("Add node id to a dimension returns status not found", func() { r, err := createRequestWithToken("PUT", "http://localhost:21800/instances/123/dimensions/age/options/55/node_id/11", nil) r.Header.Set("If-Match", testIfMatch) So(err, ShouldBeNil) datasetAPI.Router.ServeHTTP(w, r) So(w.Code, ShouldEqual, http.StatusNotFound) Convey("And the expected database calls are performed to update nodeID", func() { validateDimensionUpdates(mockedDataStore, []*models.DimensionOption{ { InstanceID: "123", Name: "age", NodeID: "11", Option: "55", Order: nil, }, }, testIfMatch) }) Convey("Then the db lock is acquired and released as expected", func() { validateLock(mockedDataStore, "123") So(*isLocked, ShouldBeFalse) }) }) }) }
explode_data.jsonl/20825
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 646 }
[ 2830, 3393, 2212, 1955, 915, 1249, 26121, 16446, 10372, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 2822, 93070, 5617, 445, 22043, 264, 46149, 39183, 5333, 429, 14525, 311, 2647, 12871, 2436, 3034, 4152, 311, 27923, 1955, 10372, 1465...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestArrayEx(t *testing.T) { jsonStr := ` [ { "c":[ {"a":10.11} ] }, { "c":[ {"a":11.11} ] } ]` res := Get(jsonStr, "@ugly|#.c.#[a=10.11]").String() if res != `[{"a":10.11}]` { t.Fatalf("expected '%v', got '%v'", `[{"a":10.11}]`, res) } res = Get(jsonStr, "@ugly|#.c.#").String() if res != `[1,1]` { t.Fatalf("expected '%v', got '%v'", `[1,1]`, res) } res = Get(jsonStr, "@reverse|0|c|0|a").String() if res != "11.11" { t.Fatalf("expected '%v', got '%v'", "11.11", res) } res = Get(jsonStr, "#.c|#").String() if res != "2" { t.Fatalf("expected '%v', got '%v'", "2", res) } }
explode_data.jsonl/43461
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 346 }
[ 2830, 3393, 1857, 840, 1155, 353, 8840, 836, 8, 341, 30847, 2580, 1669, 22074, 197, 9640, 197, 197, 515, 298, 197, 96946, 8899, 198, 571, 197, 4913, 64, 788, 16, 15, 13, 16, 16, 532, 298, 197, 921, 197, 197, 2137, 341, 298, 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...
5
func TestIsPrivateIP(t *testing.T) { t.Parallel() assert := assert.New(t) assert.True(IsPrivateIP(net.ParseIP("127.0.0.1"))) assert.False(IsPrivateIP(net.ParseIP("8.8.8.8"))) }
explode_data.jsonl/74923
{ "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, 3872, 16787, 3298, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 741, 6948, 1669, 2060, 7121, 1155, 692, 6948, 32443, 65473, 16787, 3298, 30723, 8937, 3298, 445, 16, 17, 22, 13, 15, 13, 15, 13, 16, 29836, 6948, 50757, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestMedia(t *testing.T) { valorEsperado := 7.28 valor := Media(7.2, 9.9, 6.1, 5.9) if valor != valorEsperado { t.Errorf(erroPadrao, valorEsperado, valor) } }
explode_data.jsonl/67671
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 86 }
[ 2830, 3393, 12661, 1155, 353, 8840, 836, 8, 341, 19302, 269, 17360, 712, 2123, 1669, 220, 22, 13, 17, 23, 198, 19302, 269, 1669, 7816, 7, 22, 13, 17, 11, 220, 24, 13, 24, 11, 220, 21, 13, 16, 11, 220, 20, 13, 24, 692, 743, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func Test_getLastPartOfURI(t *testing.T) { // uri of type baseFragment#fragment input := "baseFragment#fragment" expectedOutput := "fragment" output := getLastPartOfURI(input) if output != expectedOutput { t.Errorf("expected %s, found %s", expectedOutput, output) } // uri of type baseFragment/subFragment input = "baseFragment/subFragment" expectedOutput = "subFragment" output = getLastPartOfURI(input) if output != expectedOutput { t.Errorf("expected %s, found %s", expectedOutput, output) } // neither of the case mustn't raise any error. input = "www.github.com" expectedOutput = input output = getLastPartOfURI(input) if output != expectedOutput { t.Errorf("expected %s, found %s", expectedOutput, output) } }
explode_data.jsonl/52716
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 255 }
[ 2830, 3393, 3062, 5842, 5800, 2124, 10301, 1155, 353, 8840, 836, 8, 341, 197, 322, 13071, 315, 943, 2331, 9488, 2, 42202, 198, 22427, 1669, 330, 3152, 9488, 2, 42202, 698, 42400, 5097, 1669, 330, 42202, 698, 21170, 1669, 81479, 5800, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestMissingParameter(t *testing.T) { code := `vmthread main { DATA8 x CP_EQ8(x,,x) }` s, err := bytecodes.Scope("ev3", "official") if err != nil { t.Fatal("Failed to read bytecodes:", err) } fs := token.NewFileSet() f, err := parser.ParseFile(fs, "test.lms", code, s, parser.DeclarationErrors) if err != nil { t.Fatal("Failed to parse file:", err) } a := NewAssembler(fs, f) options := AssembleOptions{} _, err = a.Assemble(&options) if err == nil { t.Fatal("Compile should have failed because of missing parameter") } // verify that test was valid code = strings.Replace(code, ",,", ",0,", -1) f, err = parser.ParseFile(fs, "test.lms", code, s, parser.DeclarationErrors) if err != nil { t.Fatal("Failed to parse file:", err) } a = NewAssembler(fs, f) _, err = a.Assemble(&options) if err != nil { t.Fatalf("Compile should have succeeded: %v", err) } }
explode_data.jsonl/33722
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 364 }
[ 2830, 3393, 25080, 4971, 1155, 353, 8840, 836, 8, 341, 43343, 1669, 1565, 7338, 4528, 1887, 341, 197, 10957, 4485, 23, 856, 198, 197, 6258, 47, 9168, 23, 2075, 10631, 87, 340, 197, 31257, 1903, 11, 1848, 1669, 4922, 25814, 77940, 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...
6
func TestHasher(t *testing.T) { for _, tt := range []struct { key uint64 bucket []int }{ // Generated from the reference C++ code {0, []int{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}}, {1, []int{0, 0, 0, 0, 0, 0, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 17, 17}}, {0xdeadbeef, []int{0, 1, 2, 3, 3, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 16, 16, 16}}, {0x0ddc0ffeebadf00d, []int{0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 15, 15, 15, 15}}, } { for i, v := range tt.bucket { hasher := &jmphasher{} if got := hasher.Hash(tt.key, i+1); got != v { t.Errorf("hash(%v,%v)=%v, want %v", tt.key, i+1, got, v) } } } }
explode_data.jsonl/59877
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 372 }
[ 2830, 3393, 6370, 261, 1155, 353, 8840, 836, 8, 341, 2023, 8358, 17853, 1669, 2088, 3056, 1235, 341, 197, 23634, 262, 2622, 21, 19, 198, 197, 2233, 11152, 3056, 396, 198, 197, 59403, 197, 197, 322, 30488, 504, 279, 5785, 356, 1027, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestRecommendationNotAvailable(t *testing.T) { pod := test.Pod().WithName("pod1").AddContainer(test.BuildTestContainer("ctr-name", "", "")).Get() podRecommendation := vpa_types.RecommendedPodResources{ ContainerRecommendations: []vpa_types.RecommendedContainerResources{ { ContainerName: "ctr-name-other", Target: apiv1.ResourceList{ apiv1.ResourceCPU: *resource.NewScaledQuantity(100, 1), apiv1.ResourceMemory: *resource.NewScaledQuantity(50000, 1), }, }, }, } policy := vpa_types.PodResourcePolicy{} res, annotations, err := NewCappingRecommendationProcessor(&fakeLimitRangeCalculator{}).Apply(&podRecommendation, &policy, nil, pod) assert.Nil(t, err) assert.Empty(t, annotations) assert.Empty(t, res.ContainerRecommendations) }
explode_data.jsonl/10245
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 275 }
[ 2830, 3393, 67644, 367, 2623, 16485, 1155, 353, 8840, 836, 8, 341, 3223, 347, 1669, 1273, 88823, 1005, 54523, 445, 39073, 16, 1827, 2212, 4502, 8623, 25212, 2271, 4502, 445, 10597, 11494, 497, 7342, 11700, 568, 1949, 741, 3223, 347, 676...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestRecipientNotReadyReturnsError(t *testing.T) { // Use a unbuffered channel with no listener to simulate blocking handler := readyHandler(make(chan<- bool)) verifyState(t, handler, "/ready/false", http.StatusInternalServerError, http.MethodPost) }
explode_data.jsonl/19084
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 74 }
[ 2830, 3393, 74432, 2623, 19202, 16446, 1454, 1155, 353, 8840, 836, 8, 341, 197, 322, 5443, 264, 650, 7573, 291, 5496, 448, 902, 11446, 311, 37453, 22188, 198, 53326, 1669, 5527, 3050, 36944, 35190, 45342, 1807, 4390, 93587, 1397, 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
func TestGetOpenInterest(t *testing.T) { t.Parallel() _, err := b.GetOpenInterest(context.Background(), currency.NewPairWithDelimiter("BTCUSD", "PERP", "_")) if err != nil { t.Error(err) } }
explode_data.jsonl/76611
{ "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, 1949, 5002, 34556, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 741, 197, 6878, 1848, 1669, 293, 2234, 5002, 34556, 5378, 19047, 1507, 11413, 7121, 12443, 2354, 91098, 445, 59118, 26749, 497, 330, 9654, 47, 497, 9000, 54...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestLinuxConnSetOption(t *testing.T) { const ( level = unix.SOL_NETLINK length = uint32(unsafe.Sizeof(uint32(0))) ) tests := []struct { name string option ConnOption enable bool want setSockopt err error }{ { name: "invalid", option: 999, enable: true, err: unix.ENOPROTOOPT, }, { name: "packet info on", option: PacketInfo, enable: true, want: setSockopt{ name: unix.NETLINK_PKTINFO, v: 1, }, }, { name: "packet info off", option: PacketInfo, enable: false, want: setSockopt{ name: unix.NETLINK_PKTINFO, v: 0, }, }, { name: "broadcast error", option: BroadcastError, enable: true, want: setSockopt{ name: unix.NETLINK_BROADCAST_ERROR, v: 1, }, }, { name: "no ENOBUFS", option: NoENOBUFS, enable: true, want: setSockopt{ name: unix.NETLINK_NO_ENOBUFS, v: 1, }, }, { name: "listen all NSID", option: ListenAllNSID, enable: true, want: setSockopt{ name: unix.NETLINK_LISTEN_ALL_NSID, v: 1, }, }, { name: "cap acknowledge", option: CapAcknowledge, enable: true, want: setSockopt{ name: unix.NETLINK_CAP_ACK, v: 1, }, }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { c, s := testLinuxConn(t, nil) // Pre-populate fixed values. tt.want.level = level tt.want.l = length if err := c.SetOption(tt.option, tt.enable); err != nil { if want, got := tt.err, err; !reflect.DeepEqual(want, got) { t.Fatalf("unexpected error:\n- want: %v\n- got: %v", want, got) } return } if want, got := []setSockopt{tt.want}, s.setSockopt; !reflect.DeepEqual(want, got) { t.Fatalf("unexpected socket options:\n- want: %v\n- got: %v", want, got) } }) } }
explode_data.jsonl/33497
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 967 }
[ 2830, 3393, 46324, 9701, 1649, 5341, 1155, 353, 8840, 836, 8, 341, 4777, 2399, 197, 53743, 220, 284, 51866, 808, 1930, 26855, 35956, 198, 197, 49046, 284, 2622, 18, 17, 7, 38157, 2465, 1055, 8488, 18, 17, 7, 15, 5929, 197, 692, 7821...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestUntarHardlinkToSymlink(t *testing.T) { skip.If(t, runtime.GOOS != "windows" && os.Getuid() != 0, "skipping test that requires root") for i, headers := range [][]*tar.Header{ { { Name: "symlink1", Typeflag: tar.TypeSymlink, Linkname: "regfile", Mode: 0644, }, { Name: "symlink2", Typeflag: tar.TypeLink, Linkname: "symlink1", Mode: 0644, }, { Name: "regfile", Typeflag: tar.TypeReg, Mode: 0644, }, }, } { if err := testBreakout("untar", "docker-TestUntarHardlinkToSymlink", headers); err != nil { t.Fatalf("i=%d. %v", i, err) } } }
explode_data.jsonl/79256
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 329 }
[ 2830, 3393, 20250, 277, 26907, 2080, 1249, 34667, 44243, 1155, 353, 8840, 836, 8, 341, 1903, 13389, 32901, 1155, 11, 15592, 97574, 3126, 961, 330, 27077, 1, 1009, 2643, 2234, 2423, 368, 961, 220, 15, 11, 330, 4886, 5654, 1273, 429, 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...
4
func TestCRDSource(t *testing.T) { suite.Run(t, new(CRDSuite)) t.Run("Interface", testCRDSourceImplementsSource) t.Run("Endpoints", testCRDSourceEndpoints) }
explode_data.jsonl/75073
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 64 }
[ 2830, 3393, 8973, 35, 3608, 1155, 353, 8840, 836, 8, 341, 96572, 16708, 1155, 11, 501, 3025, 49, 5936, 9302, 1171, 3244, 16708, 445, 5051, 497, 1273, 8973, 35, 3608, 1427, 4674, 3608, 340, 3244, 16708, 445, 80786, 497, 1273, 8973, 35,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
func TestFramePage(t *testing.T) { p0 := page.NewDataPage(-1, -1, -1, 10) f := NewFrame(p0) if f.Page() != p0 { t.Errorf("NewFrame failed.") } p1 := page.NewDataPage(-1, -1, -1, 10) f.SetPage(p1) if f.Page() != p1 { t.Errorf("SetFrame failed.") } f.DeletePage() if f.Page() != nil { t.Errorf("DeleteFrame failed.") } }
explode_data.jsonl/52243
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 160 }
[ 2830, 3393, 4369, 2665, 1155, 353, 8840, 836, 8, 341, 3223, 15, 1669, 2150, 7121, 1043, 2665, 4080, 16, 11, 481, 16, 11, 481, 16, 11, 220, 16, 15, 340, 1166, 1669, 1532, 4369, 1295, 15, 340, 743, 282, 17558, 368, 961, 281, 15, 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...
4
func TestEmptyNotifications(t *testing.T) { cfg := initTest() r := gofight.New() // notifications is empty. r.POST("/api/push"). SetJSON(gofight.D{ "notifications": []notify.PushNotification{}, }). Run(routerEngine(cfg, q), func(r gofight.HTTPResponse, rq gofight.HTTPRequest) { assert.Equal(t, http.StatusBadRequest, r.Code) }) }
explode_data.jsonl/67611
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 142 }
[ 2830, 3393, 3522, 34736, 1155, 353, 8840, 836, 8, 341, 50286, 1669, 2930, 2271, 2822, 7000, 1669, 728, 21143, 7121, 2822, 197, 322, 21969, 374, 4287, 624, 7000, 14721, 4283, 2068, 4322, 1116, 38609, 197, 22212, 5370, 3268, 1055, 491, 90...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestP224Overflow(t *testing.T) { // This tests for a specific bug in the P224 implementation. p224 := P224() pointData, _ := hex.DecodeString("049B535B45FB0A2072398A6831834624C7E32CCFD5A4B933BCEAF77F1DD945E08BBE5178F5EDF5E733388F196D2A631D2E075BB16CBFEEA15B") x, y := Unmarshal(p224, pointData) if !p224.IsOnCurve(x, y) { t.Error("P224 failed to validate a correct point") } }
explode_data.jsonl/52843
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 177 }
[ 2830, 3393, 47, 17, 17, 19, 42124, 1155, 353, 8840, 836, 8, 341, 197, 322, 1096, 7032, 369, 264, 3151, 9876, 304, 279, 393, 17, 17, 19, 8129, 624, 3223, 17, 17, 19, 1669, 393, 17, 17, 19, 741, 58474, 1043, 11, 716, 1669, 12371, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func Test_StringIsPresent(t *testing.T) { r := require.New(t) v := StringIsPresent{"Name", "Mark"} errors := validate.NewErrors() v.IsValid(errors) r.Equal(errors.Count(), 0) v = StringIsPresent{"Name", ""} v.IsValid(errors) r.Equal(errors.Count(), 1) r.Equal(errors.Get("name"), []string{"Name can not be blank."}) }
explode_data.jsonl/48900
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 128 }
[ 2830, 3393, 31777, 3872, 21195, 1155, 353, 8840, 836, 8, 341, 7000, 1669, 1373, 7121, 1155, 692, 5195, 1669, 923, 3872, 21195, 4913, 675, 497, 330, 8949, 16707, 73424, 1669, 9593, 7121, 13877, 741, 5195, 28992, 38881, 340, 7000, 12808, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestNamespaceKey(t *testing.T) { app := testNode() assert.Equal(t, channel.NamespaceKey("ns"), app.namespaceKey("ns:channel")) assert.Equal(t, channel.NamespaceKey(""), app.namespaceKey("channel")) assert.Equal(t, channel.NamespaceKey("ns"), app.namespaceKey("ns:channel:opa")) assert.Equal(t, channel.NamespaceKey("ns"), app.namespaceKey("ns::channel")) }
explode_data.jsonl/53958
{ "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, 22699, 1592, 1155, 353, 8840, 836, 8, 341, 28236, 1669, 1273, 1955, 741, 6948, 12808, 1155, 11, 5496, 46011, 1592, 445, 4412, 3975, 906, 50409, 1592, 445, 4412, 25, 10119, 5455, 6948, 12808, 1155, 11, 5496, 46011, 1592, 8607...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestClientNonIdempotentRetry_BodyStream(t *testing.T) { t.Parallel() dialsCount := 0 c := &Client{ Dial: func(addr string) (net.Conn, error) { dialsCount++ switch dialsCount { case 1, 2: return &readErrorConn{}, nil case 3: return &singleEchoConn{ b: []byte("HTTP/1.1 345 OK\r\nContent-Type: foobar\r\n\r\n"), }, nil default: t.Fatalf("unexpected number of dials: %d", dialsCount) } panic("unreachable") }, } dialsCount = 0 req := Request{} res := Response{} req.SetRequestURI("http://foobar/a/b") req.Header.SetMethod("POST") body := bytes.NewBufferString("test") req.SetBodyStream(body, body.Len()) err := c.Do(&req, &res) if err == nil { t.Fatal("expected error from being unable to retry a bodyStream") } }
explode_data.jsonl/79370
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 334 }
[ 2830, 3393, 2959, 8121, 764, 3262, 63532, 51560, 1668, 1076, 3027, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 2822, 2698, 10309, 2507, 1669, 220, 15, 198, 1444, 1669, 609, 2959, 515, 197, 10957, 530, 25, 2915, 24497, 914, 8, 320...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestApplyTemplateTags(t *testing.T) { o := graphite.Options{ Separator: "_", Templates: []string{"current.* measurement.measurement region=us-west"}, } p, err := graphite.NewParserWithOptions(o) if err != nil { t.Fatalf("unexpected error creating parser, got %v", err) } measurement, tags, _, _ := p.ApplyTemplate("current.users") if measurement != "current_users" { t.Errorf("Parser.ApplyTemplate unexpected result. got %s, exp %s", measurement, "current_users") } region, ok := tags["region"] if !ok { t.Error("Expected for template to apply a 'region' tag, but not found") } if region != "us-west" { t.Errorf("Expected region='us-west' tag, got region='%s'", region) } }
explode_data.jsonl/32194
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 258 }
[ 2830, 3393, 28497, 7275, 15930, 1155, 353, 8840, 836, 8, 341, 22229, 1669, 94173, 22179, 515, 197, 7568, 91640, 25, 9000, 756, 197, 10261, 76793, 25, 3056, 917, 4913, 3231, 4908, 18662, 17326, 24359, 5537, 28, 355, 37602, 7115, 197, 532...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
5
func TestPointerParamsAndScans(t *testing.T) { db := newTestDB(t, "") defer closeDB(t, db) exec(t, db, "CREATE|t|id=int32,name=nullstring") bob := "bob" var name *string name = &bob exec(t, db, "INSERT|t|id=10,name=?", name) name = nil exec(t, db, "INSERT|t|id=20,name=?", name) err := db.QueryRow("SELECT|t|name|id=?", 10).Scan(&name) if err != nil { t.Fatalf("querying id 10: %v", err) } if name == nil { t.Errorf("id 10's name = nil; want bob") } else if *name != "bob" { t.Errorf("id 10's name = %q; want bob", *name) } err = db.QueryRow("SELECT|t|name|id=?", 20).Scan(&name) if err != nil { t.Fatalf("querying id 20: %v", err) } if name != nil { t.Errorf("id 20 = %q; want nil", *name) } }
explode_data.jsonl/15988
{ "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, 9084, 4870, 3036, 3326, 596, 1155, 353, 8840, 836, 8, 341, 20939, 1669, 501, 2271, 3506, 1155, 11, 14676, 16867, 3265, 3506, 1155, 11, 2927, 340, 67328, 1155, 11, 2927, 11, 330, 22599, 91, 83, 91, 307, 16563, 18, 17, 220...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
6
func TestStackIteratorFirst(t *testing.T) { stack := New() it := stack.Iterator() if actualValue, expectedValue := it.First(), false; actualValue != expectedValue { t.Errorf("Got %v expected %v", actualValue, expectedValue) } stack.Push("a") stack.Push("b") stack.Push("c") if actualValue, expectedValue := it.First(), true; actualValue != expectedValue { t.Errorf("Got %v expected %v", actualValue, expectedValue) } if index, value := it.Index(), it.Value(); index != 0 || value != "c" { t.Errorf("Got %v,%v expected %v,%v", index, value, 0, "c") } }
explode_data.jsonl/26072
{ "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, 4336, 11951, 5338, 1155, 353, 8840, 836, 8, 341, 48227, 1669, 1532, 741, 23374, 1669, 5611, 40846, 741, 743, 5042, 1130, 11, 3601, 1130, 1669, 432, 15926, 1507, 895, 26, 5042, 1130, 961, 3601, 1130, 341, 197, 3244, 13080, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
5
func TestIAVLNoPrune(t *testing.T) { db := dbm.NewMemDB() tree, err := iavl.NewMutableTree(db, cacheSize) require.NoError(t, err) iavlStore := UnsafeNewStore(tree) nextVersion(iavlStore) for i := 1; i < 100; i++ { for j := 1; j <= i; j++ { require.True(t, iavlStore.VersionExists(int64(j)), "Missing version %d with latest version %d. Should be storing all versions", j, i) } nextVersion(iavlStore) } }
explode_data.jsonl/38066
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 182 }
[ 2830, 3393, 5863, 30698, 2753, 3533, 2886, 1155, 353, 8840, 836, 8, 341, 20939, 1669, 2927, 76, 7121, 18816, 3506, 741, 51968, 11, 1848, 1669, 600, 67311, 7121, 11217, 6533, 9791, 11, 6500, 1695, 340, 17957, 35699, 1155, 11, 1848, 692, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestOpStrictEqual(t *testing.T) { assert := assert.New(t) jl := NewEmpty() AddOpStrictEqual(jl) TestCases{ // http://jsonlogic.com/operations.html {Logic: `{"===":[1,1]}`, Data: `null`, Result: true}, {Logic: `{"===":[1,"1"]}`, Data: `null`, Result: false}, // Zero/One param. {Logic: `{"===":[]}`, Data: `null`, Err: true}, {Logic: `{"===":[null]}`, Data: `null`, Err: true}, // Two params, primitives. {Logic: `{"===":[null,null]}`, Data: `null`, Result: true}, {Logic: `{"===":[false,false]}`, Data: `null`, Result: true}, {Logic: `{"===":[3.0,3]}`, Data: `null`, Result: true}, {Logic: `{"===":["",""]}`, Data: `null`, Result: true}, {Logic: `{"===":["",3.0]}`, Data: `null`, Result: false}, // Non-primitives. {Logic: `{"===":["",[]]}`, Data: `null`, Err: true}, }.Run(assert, jl) }
explode_data.jsonl/38296
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 354 }
[ 2830, 3393, 7125, 70486, 1155, 353, 8840, 836, 8, 341, 6948, 1669, 2060, 7121, 1155, 340, 12428, 75, 1669, 1532, 3522, 741, 37972, 7125, 70486, 3325, 75, 340, 73866, 37302, 515, 197, 197, 322, 1758, 1110, 2236, 24225, 905, 14, 38163, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestGetStateRPC(t *testing.T) { MarkIntegrationTest(t, CanRunWithoutGcp) rpcAddr := randomPort() // start a skaffold dev loop on an example setupSkaffoldWithArgs(t, "--rpc-port", rpcAddr) // start a grpc client and make sure we can connect properly var ( conn *grpc.ClientConn err error client proto.SkaffoldServiceClient ) for i := 0; i < connectionRetries; i++ { conn, err = grpc.Dial(fmt.Sprintf(":%s", rpcAddr), grpc.WithInsecure()) if err != nil { t.Logf("unable to establish skaffold grpc connection: retrying...") time.Sleep(waitTime) continue } defer conn.Close() client = proto.NewSkaffoldServiceClient(conn) break } if client == nil { t.Fatalf("error establishing skaffold grpc connection") } ctx, ctxCancel := context.WithCancel(context.Background()) defer ctxCancel() // try a few times and wait around until we see the build is complete, or fail. success := false var grpcState *proto.State for i := 0; i < readRetries; i++ { grpcState = retrieveRPCState(ctx, t, client) if grpcState != nil && checkBuildAndDeployComplete(*grpcState) { success = true break } time.Sleep(waitTime) } if !success { t.Errorf("skaffold build or deploy not complete. state: %+v\n", grpcState) } }
explode_data.jsonl/22969
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 478 }
[ 2830, 3393, 1949, 1397, 29528, 1155, 353, 8840, 836, 8, 341, 197, 8949, 52464, 2271, 1155, 11, 2980, 6727, 26040, 38, 4672, 692, 7000, 3992, 13986, 1669, 4194, 7084, 741, 197, 322, 1191, 264, 1901, 2649, 813, 3483, 6337, 389, 458, 311...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
8
func Test_reconcileForCSIBMNode(t *testing.T) { t.Run("CSIBMNode addresses length is 0", func(t *testing.T) { var ( c = setup(t) bmNode = testCSIBMNode1.DeepCopy() ) bmNode.Spec.Addresses = map[string]string{} createObjects(t, c.k8sClient, bmNode) res, err := c.reconcileForCSIBMNode(bmNode) assert.NotNil(t, err) assert.Contains(t, err.Error(), "addresses are missing") assert.Equal(t, ctrl.Result{Requeue: false}, res) }) t.Run("Unable to read k8s node", func(t *testing.T) { var ( c = setup(t) k8sNodeName = "k8s-node" bmNode = testCSIBMNode1.DeepCopy() ) c.cache.put(k8sNodeName, bmNode.Name) res, err := c.reconcileForCSIBMNode(bmNode) assert.NotNil(t, err) assert.Equal(t, ctrl.Result{Requeue: true}, res) }) t.Run("There is CSIBMNode that partially match k8s node", func(t *testing.T) { var ( c = setup(t) k8sNode = testNode1.DeepCopy() bmNode = testCSIBMNode1.DeepCopy() ) k8sNode.Status.Addresses = []coreV1.NodeAddress{k8sNode.Status.Addresses[0]} createObjects(t, c.k8sClient, k8sNode, bmNode) res, err := c.reconcileForCSIBMNode(bmNode) assert.Nil(t, err) assert.Equal(t, ctrl.Result{}, res) // read node obj nodeObj := new(coreV1.Node) assert.Nil(t, c.k8sClient.ReadCR(testCtx, k8sNode.Name, nodeObj)) _, ok := nodeObj.GetAnnotations()[nodeIDAnnotationKey] assert.False(t, ok) }) t.Run("More then one k8s node match CSIBMNode CR", func(t *testing.T) { var ( c = setup(t) k8sNode1 = testNode1.DeepCopy() k8sNode2 = testNode2.DeepCopy() bmNode = testCSIBMNode1.DeepCopy() ) k8sNode2.Status.Addresses = k8sNode1.Status.Addresses createObjects(t, c.k8sClient, k8sNode1, k8sNode2, bmNode) res, err := c.reconcileForCSIBMNode(bmNode) assert.Nil(t, err) assert.Equal(t, ctrl.Result{}, res) // read node obj nodeObj := new(coreV1.Node) assert.Nil(t, c.k8sClient.ReadCR(testCtx, k8sNode1.Name, nodeObj)) _, ok := nodeObj.GetAnnotations()[nodeIDAnnotationKey] assert.False(t, ok) assert.Nil(t, c.k8sClient.ReadCR(testCtx, k8sNode2.Name, nodeObj)) _, ok = nodeObj.GetAnnotations()[nodeIDAnnotationKey] assert.False(t, ok) }) }
explode_data.jsonl/50959
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1040 }
[ 2830, 3393, 1288, 40446, 457, 2461, 6412, 67738, 1955, 1155, 353, 8840, 836, 8, 341, 3244, 16708, 445, 6412, 67738, 1955, 14230, 3084, 374, 220, 15, 497, 2915, 1155, 353, 8840, 836, 8, 341, 197, 2405, 2399, 298, 1444, 414, 284, 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...
1
func TestGetAppByRegistry(t *testing.T) { api, router, mockCtl := initRegistryAPI(t) defer mockCtl.Finish() sApp := ms.NewMockApplicationService(mockCtl) sConfig := ms.NewMockConfigService(mockCtl) sSecret := ms.NewMockSecretService(mockCtl) api.AppCombinedService = &service.AppCombinedService{ App: sApp, Config: sConfig, Secret: sSecret, } sNode, sIndex := ms.NewMockNodeService(mockCtl), ms.NewMockIndexService(mockCtl) api.Node, api.Index = sNode, sIndex appNames := []string{"app1", "app2", "app3"} apps := []*specV1.Application{ { Namespace: "default", Name: appNames[0], }, { Namespace: "default", Name: appNames[1], }, { Namespace: "default", Name: appNames[2], }, } mConfSecret3 := &specV1.Secret{ Namespace: "default", Name: "abc", Description: "haha", Version: "5", Labels: map[string]string{ specV1.SecretLabel: specV1.SecretRegistry, }, } sSecret.EXPECT().Get(gomock.Any(), gomock.Any(), gomock.Any()).Return(mConfSecret3, nil) sIndex.EXPECT().ListAppIndexBySecret(mConfSecret3.Namespace, mConfSecret3.Name).Return(appNames, nil).Times(1) sApp.EXPECT().Get(mConfSecret3.Namespace, appNames[0], "").Return(apps[0], nil).AnyTimes() sApp.EXPECT().Get(mConfSecret3.Namespace, appNames[1], "").Return(apps[1], nil).AnyTimes() sApp.EXPECT().Get(mConfSecret3.Namespace, appNames[2], "").Return(apps[2], nil).AnyTimes() w4 := httptest.NewRecorder() req4, _ := http.NewRequest(http.MethodGet, "/v1/registries/abc/apps", nil) router.ServeHTTP(w4, req4) assert.Equal(t, http.StatusOK, w4.Code) }
explode_data.jsonl/41109
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 691 }
[ 2830, 3393, 1949, 2164, 1359, 15603, 1155, 353, 8840, 836, 8, 341, 54299, 11, 9273, 11, 7860, 94252, 1669, 2930, 15603, 7082, 1155, 340, 16867, 7860, 94252, 991, 18176, 2822, 1903, 2164, 1669, 9829, 7121, 11571, 4988, 1860, 30389, 94252, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestBlkioUsage(t *testing.T) { c, err := NewContainer(ContainerName) if err != nil { t.Errorf(err.Error()) } if _, err := c.BlkioUsage(); err != nil { t.Errorf(err.Error()) } }
explode_data.jsonl/2781
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 83 }
[ 2830, 3393, 4923, 74, 815, 14783, 1155, 353, 8840, 836, 8, 341, 1444, 11, 1848, 1669, 1532, 4502, 75145, 675, 340, 743, 1848, 961, 2092, 341, 197, 3244, 13080, 3964, 6141, 2398, 197, 630, 743, 8358, 1848, 1669, 272, 21569, 74, 815, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
3
func TestClient_BuildReadArgs(t *testing.T) { // success case args, err := buildReadArgs([]*queryObj{query1}) assert.NotNil(t, args) assert.NoError(t, err) fv, ok := args["id"] assert.True(t, ok) assert.Equal(t, dosa.FieldValue(int64(10)), fv) // fail case, input non-supported operator args, err = buildReadArgs([]*queryObj{query2}) assert.Nil(t, args) assert.Contains(t, err.Error(), "wrong operator used for read") }
explode_data.jsonl/53329
{ "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, 2959, 96686, 4418, 4117, 1155, 353, 8840, 836, 8, 341, 197, 322, 2393, 1142, 198, 31215, 11, 1848, 1669, 1936, 4418, 4117, 85288, 1631, 5261, 90, 1631, 16, 3518, 6948, 93882, 1155, 11, 2827, 340, 6948, 35699, 1155, 11, 184...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestSchemaRegistryClient_GetSchemaByVersionWithReferences(t *testing.T) { { refs := []Reference{ {Name: "name1", Subject: "subject1", Version: 1}, {Name: "name2", Subject: "subject2", Version: 2}, } server := httptest.NewServer(http.HandlerFunc(func(rw http.ResponseWriter, req *http.Request) { responsePayload := schemaResponse{ Subject: "test1", Version: 1, Schema: "payload", ID: 1, References: refs, } response, _ := json.Marshal(responsePayload) switch req.URL.String() { case "/subjects/test1/versions/1": // Send response to be tested rw.Write(response) default: require.Fail(t, "unhandled request") } })) srClient := CreateSchemaRegistryClient(server.URL) srClient.CodecCreationEnabled(false) schema, err := srClient.GetSchemaByVersion("test1", 1) // Test response assert.NoError(t, err) assert.Equal(t, schema.ID(), 1) assert.Nil(t, schema.codec) assert.Equal(t, schema.Schema(), "payload") assert.Equal(t, schema.Version(), 1) assert.Equal(t, schema.References(), refs) assert.Equal(t, len(schema.References()), 2) } { server, call := mockServerWithSchemaResponse(t, "test1", "1", schemaResponse{ Subject: "test1", Version: 1, Schema: "payload", ID: 1, References: nil, }) srClient := CreateSchemaRegistryClient(server.URL) srClient.CodecCreationEnabled(false) schema, err := srClient.GetSchemaByVersion("test1", 1) // Test response assert.NoError(t, err) assert.Equal(t, 1, *call) assert.Equal(t, schema.ID(), 1) assert.Nil(t, schema.codec) assert.Equal(t, schema.Schema(), "payload") assert.Equal(t, schema.Version(), 1) assert.Nil(t, schema.References()) assert.Equal(t, len(schema.References()), 0) } }
explode_data.jsonl/73764
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 762 }
[ 2830, 3393, 8632, 15603, 2959, 13614, 8632, 92389, 2354, 31712, 1155, 353, 8840, 836, 8, 341, 197, 515, 197, 197, 16149, 1669, 3056, 8856, 515, 298, 197, 63121, 25, 330, 606, 16, 497, 17450, 25, 330, 11501, 16, 497, 6079, 25, 220, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestServeHTTP(t *testing.T) { tests := []struct { desc string cfg *Config expNextCall bool expStatusCode int }{ { desc: "should return ok status", cfg: func() *Config { c := CreateConfig() c.URL = "https://example.com/" return c }(), expNextCall: true, expStatusCode: http.StatusOK, }, } for _, test := range tests { test := test // pin t.Run(test.desc, func(t *testing.T) { nextCall := false next := http.HandlerFunc(func(rw http.ResponseWriter, req *http.Request) { nextCall = true }) h, err := New(context.Background(), next, test.cfg, "forwardrequest") if err != nil { t.Fatal(err) } rec := httptest.NewRecorder() url := "https://example.com/" req := httptest.NewRequest(http.MethodPost, url, strings.NewReader("example")) h.ServeHTTP(rec, req) res := rec.Result() defer res.Body.Close() if nextCall != test.expNextCall { t.Errorf("next handler should not be called") } if res.StatusCode != test.expStatusCode { t.Errorf("got status code %d, want %d", rec.Code, test.expStatusCode) } }) } }
explode_data.jsonl/77548
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 490 }
[ 2830, 3393, 60421, 9230, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 3056, 1235, 341, 197, 41653, 688, 914, 198, 197, 50286, 1843, 353, 2648, 198, 197, 48558, 5847, 7220, 256, 1807, 198, 197, 48558, 15872, 526, 198, 197, 59403, 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 TestPushdownProjectionToTables(t *testing.T) { table := memory.NewTable("mytable", sql.NewPrimaryKeySchema(sql.Schema{ {Name: "i", Type: sql.Int32, Source: "mytable"}, {Name: "f", Type: sql.Float64, Source: "mytable"}, {Name: "t", Type: sql.Text, Source: "mytable"}, })) table2 := memory.NewTable("mytable2", sql.NewPrimaryKeySchema(sql.Schema{ {Name: "i2", Type: sql.Int32, Source: "mytable2"}, {Name: "f2", Type: sql.Float64, Source: "mytable2"}, {Name: "t2", Type: sql.Text, Source: "mytable2"}, })) db := memory.NewDatabase("mydb") db.AddTable("mytable", table) db.AddTable("mytable2", table2) a := NewDefault(sql.NewDatabaseProvider()) // TODO: test interaction with filtered tables tests := []analyzerFnTestCase{ { name: "pushdown projections to tables", node: plan.NewProject( []sql.Expression{ expression.NewGetFieldWithTable(2, sql.Text, "mytable2", "t2", false), }, plan.NewFilter( expression.NewOr( expression.NewEquals( expression.NewGetFieldWithTable(1, sql.Float64, "mytable", "f", false), expression.NewLiteral(3.14, sql.Float64), ), expression.NewIsNull( expression.NewGetFieldWithTable(0, sql.Int32, "mytable2", "i2", false), ), ), plan.NewCrossJoin( plan.NewResolvedTable(table, nil, nil), plan.NewResolvedTable(table2, nil, nil), ), ), ), expected: plan.NewProject( []sql.Expression{ expression.NewGetFieldWithTable(5, sql.Text, "mytable2", "t2", false), }, plan.NewFilter( expression.NewOr( expression.NewEquals( expression.NewGetFieldWithTable(1, sql.Float64, "mytable", "f", false), expression.NewLiteral(3.14, sql.Float64), ), expression.NewIsNull( expression.NewGetFieldWithTable(3, sql.Int32, "mytable2", "i2", false), ), ), plan.NewCrossJoin( plan.NewDecoratedNode("Projected table access on [f]", plan.NewResolvedTable(table.WithProjection([]string{"f"}), nil, nil)), plan.NewDecoratedNode("Projected table access on [t2 i2]", plan.NewResolvedTable(table2.WithProjection([]string{"t2", "i2"}), nil, nil)), ), ), ), }, } runTestCases(t, sql.NewEmptyContext(), tests, a, getRule("pushdown_projections")) }
explode_data.jsonl/66768
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 983 }
[ 2830, 3393, 16644, 2923, 46321, 1249, 21670, 1155, 353, 8840, 836, 8, 341, 26481, 1669, 4938, 7121, 2556, 445, 2408, 2005, 497, 5704, 7121, 25981, 8632, 13148, 21105, 515, 197, 197, 63121, 25, 330, 72, 497, 3990, 25, 5704, 7371, 18, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestRangeQuery(t *testing.T) { cases := []struct { Name string Load string Query string Result parser.Value Start time.Time End time.Time Interval time.Duration }{ { Name: "sum_over_time with all values", Load: `load 30s bar 0 1 10 100 1000`, Query: "sum_over_time(bar[30s])", Result: Matrix{ Series{ Points: []Point{{V: 0, T: 0}, {V: 11, T: 60000}, {V: 1100, T: 120000}}, Metric: labels.Labels{}, }, }, Start: time.Unix(0, 0), End: time.Unix(120, 0), Interval: 60 * time.Second, }, { Name: "sum_over_time with trailing values", Load: `load 30s bar 0 1 10 100 1000 0 0 0 0`, Query: "sum_over_time(bar[30s])", Result: Matrix{ Series{ Points: []Point{{V: 0, T: 0}, {V: 11, T: 60000}, {V: 1100, T: 120000}}, Metric: labels.Labels{}, }, }, Start: time.Unix(0, 0), End: time.Unix(120, 0), Interval: 60 * time.Second, }, { Name: "sum_over_time with all values long", Load: `load 30s bar 0 1 10 100 1000 10000 100000 1000000 10000000`, Query: "sum_over_time(bar[30s])", Result: Matrix{ Series{ Points: []Point{{V: 0, T: 0}, {V: 11, T: 60000}, {V: 1100, T: 120000}, {V: 110000, T: 180000}, {V: 11000000, T: 240000}}, Metric: labels.Labels{}, }, }, Start: time.Unix(0, 0), End: time.Unix(240, 0), Interval: 60 * time.Second, }, { Name: "sum_over_time with all values random", Load: `load 30s bar 5 17 42 2 7 905 51`, Query: "sum_over_time(bar[30s])", Result: Matrix{ Series{ Points: []Point{{V: 5, T: 0}, {V: 59, T: 60000}, {V: 9, T: 120000}, {V: 956, T: 180000}}, Metric: labels.Labels{}, }, }, Start: time.Unix(0, 0), End: time.Unix(180, 0), Interval: 60 * time.Second, }, { Name: "metric query", Load: `load 30s metric 1+1x4`, Query: "metric", Result: Matrix{ Series{ Points: []Point{{V: 1, T: 0}, {V: 3, T: 60000}, {V: 5, T: 120000}}, Metric: labels.Labels{labels.Label{Name: "__name__", Value: "metric"}}, }, }, Start: time.Unix(0, 0), End: time.Unix(120, 0), Interval: 1 * time.Minute, }, { Name: "metric query with trailing values", Load: `load 30s metric 1+1x8`, Query: "metric", Result: Matrix{ Series{ Points: []Point{{V: 1, T: 0}, {V: 3, T: 60000}, {V: 5, T: 120000}}, Metric: labels.Labels{labels.Label{Name: "__name__", Value: "metric"}}, }, }, Start: time.Unix(0, 0), End: time.Unix(120, 0), Interval: 1 * time.Minute, }, { Name: "short-circuit", Load: `load 30s foo{job="1"} 1+1x4 bar{job="2"} 1+1x4`, Query: `foo > 2 or bar`, Result: Matrix{ Series{ Points: []Point{{V: 1, T: 0}, {V: 3, T: 60000}, {V: 5, T: 120000}}, Metric: labels.Labels{ labels.Label{Name: "__name__", Value: "bar"}, labels.Label{Name: "job", Value: "2"}, }, }, Series{ Points: []Point{{V: 3, T: 60000}, {V: 5, T: 120000}}, Metric: labels.Labels{ labels.Label{Name: "__name__", Value: "foo"}, labels.Label{Name: "job", Value: "1"}, }, }, }, Start: time.Unix(0, 0), End: time.Unix(120, 0), Interval: 1 * time.Minute, }, } for _, c := range cases { t.Run(c.Name, func(t *testing.T) { test, err := NewTest(t, c.Load) require.NoError(t, err) defer test.Close() err = test.Run() require.NoError(t, err) qry, err := test.QueryEngine().NewRangeQuery(test.Queryable(), c.Query, c.Start, c.End, c.Interval) require.NoError(t, err) res := qry.Exec(test.Context()) require.NoError(t, res.Err) require.Equal(t, c.Result, res.Value) }) } }
explode_data.jsonl/35566
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1957 }
[ 2830, 3393, 6046, 2859, 1155, 353, 8840, 836, 8, 341, 1444, 2264, 1669, 3056, 1235, 341, 197, 21297, 257, 914, 198, 197, 197, 5879, 257, 914, 198, 197, 60362, 262, 914, 198, 197, 56503, 256, 6729, 6167, 198, 197, 65999, 262, 882, 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 TestMismatchedTypes_Nested(t *testing.T) { tests := []struct { name string in proto.Message recv proto.Message wantErr error }{ { name: "mismatched types.Any in G", in: &testdata.TestVersion1{ G: &types.Any{ TypeUrl: "/testdata.TestVersion4LoneNesting", Value: mustMarshal(&testdata.TestVersion3LoneNesting_Inner1{ Inner: &testdata.TestVersion3LoneNesting_Inner1_InnerInner{ Id: "ID", City: "Gotham", }, }), }, }, recv: new(testdata.TestVersion1), wantErr: &errMismatchedWireType{ Type: "*testdata.TestVersion3", TagNum: 1, GotWireType: 2, WantWireType: 0, }, }, { name: "From nested proto message, message index 0", in: &testdata.TestVersion3LoneNesting{ Inner1: &testdata.TestVersion3LoneNesting_Inner1{ Id: 10, Name: "foo", Inner: &testdata.TestVersion3LoneNesting_Inner1_InnerInner{ Id: "ID", City: "Palo Alto", }, }, }, recv: new(testdata.TestVersion4LoneNesting), wantErr: &errMismatchedWireType{ Type: "*testdata.TestVersion4LoneNesting_Inner1_InnerInner", TagNum: 1, GotWireType: 2, WantWireType: 0, }, }, { name: "From nested proto message, message index 1", in: &testdata.TestVersion3LoneNesting{ Inner2: &testdata.TestVersion3LoneNesting_Inner2{ Id: "ID", Country: "Maldives", Inner: &testdata.TestVersion3LoneNesting_Inner2_InnerInner{ Id: "ID", City: "Unknown", }, }, }, recv: new(testdata.TestVersion4LoneNesting), wantErr: &errMismatchedWireType{ Type: "*testdata.TestVersion4LoneNesting_Inner2_InnerInner", TagNum: 2, GotWireType: 2, WantWireType: 0, }, }, } for _, tt := range tests { tt := tt t.Run(tt.name, func(t *testing.T) { protoBlob, err := proto.Marshal(tt.in) if err != nil { t.Fatal(err) } _, gotErr := RejectUnknownFields(protoBlob, tt.recv, false) if !reflect.DeepEqual(gotErr, tt.wantErr) { t.Fatalf("Error mismatch\nGot:\n%s\n\nWant:\n%s", gotErr, tt.wantErr) } }) } }
explode_data.jsonl/34608
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1115 }
[ 2830, 3393, 82572, 291, 4173, 1604, 9980, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 3056, 1235, 341, 197, 11609, 262, 914, 198, 197, 17430, 414, 18433, 8472, 198, 197, 197, 33977, 262, 18433, 8472, 198, 197, 50780, 7747, 1465, 198, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestNewConfigNoType(t *testing.T) { viper := viper.New() _, err := config.New(viper, &config.Options{}) expectedError := "Must provide a supported Vault Type" if err.Error() != expectedError { t.Errorf("expected error %s to be thrown, got %s", expectedError, err) } }
explode_data.jsonl/54092
{ "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, 3564, 2648, 2753, 929, 1155, 353, 8840, 836, 8, 341, 5195, 12858, 1669, 95132, 7121, 741, 197, 6878, 1848, 1669, 2193, 7121, 3747, 12858, 11, 609, 1676, 22179, 37790, 42400, 1454, 1669, 330, 31776, 3410, 264, 7248, 41397, 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...
2
func Test_perE2SmKpmIndicationHeaderCompareBytes(t *testing.T) { ih, err := createE2SmKpmIndicationHeader() assert.NilError(t, err) per, err := encoder.PerEncodeE2SmKpmIndicationHeader(ih) assert.NilError(t, err) t.Logf("E2SM-KPM-IndicationHeader PER\n%v", hex.Dump(per)) //Comparing with reference bytes perRefBytes, err := hexlib.DumpToByte(refPerE2SmKpmIndicationHeader) assert.NilError(t, err) assert.DeepEqual(t, per, perRefBytes) }
explode_data.jsonl/70693
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 180 }
[ 2830, 3393, 5678, 36, 17, 10673, 42, 5187, 1425, 20285, 4047, 27374, 7078, 1155, 353, 8840, 836, 8, 1476, 197, 6996, 11, 1848, 1669, 1855, 36, 17, 10673, 42, 5187, 1425, 20285, 4047, 741, 6948, 59678, 1454, 1155, 11, 1848, 692, 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 TestRejecter_Reject(t *testing.T) { timeNow = func() time.Time { loc, _ := time.LoadLocation("UTC") return time.Date(2018, 12, 10, 0, 0, 0, 0, loc) } defer func() { timeNow = time.Now }() buff := bytes.NewBuffer(make([]byte, 1024)) logger, err := log.NewLogger("DEBUG", buff, "pref") if err != nil { t.Error("building the logger:", err.Error()) return } rejecter := NewRejecter(logger, &config.EndpointConfig{ Endpoint: "/", ExtraConfig: config.ExtraConfig{ internal.Namespace: []internal.InterpretableDefinition{ {CheckExpression: "has(JWT.user_id) && has(JWT.enabled_days) && (timestamp(now).getDayOfWeek() in JWT.enabled_days)"}, }, }, }) defer func() { fmt.Println(buff.String()) }() if rejecter == nil { t.Error("nil rejecter") return } for _, tc := range []struct { data map[string]interface{} expected bool }{ { data: map[string]interface{}{}, expected: true, }, { data: map[string]interface{}{ "user_id": 1, }, expected: true, }, { data: map[string]interface{}{ "user_id": 1, "enabled_days": []int{}, }, expected: true, }, { data: map[string]interface{}{ "user_id": 1, "enabled_days": []int{1, 2, 3, 4, 5}, }, expected: false, }, } { if res := rejecter.Reject(tc.data); res != tc.expected { t.Errorf("%+v => unexpected response %v", tc.data, res) } } }
explode_data.jsonl/13697
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 632 }
[ 2830, 3393, 78413, 261, 50693, 583, 1155, 353, 8840, 836, 8, 341, 21957, 7039, 284, 2915, 368, 882, 16299, 341, 197, 71128, 11, 716, 1669, 882, 13969, 4707, 445, 21183, 1138, 197, 853, 882, 8518, 7, 17, 15, 16, 23, 11, 220, 16, 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 TestAutoMigrateSelfReferential(t *testing.T) { type MigratePerson struct { ID uint Name string ManagerID *uint Manager *MigratePerson } DB.Migrator().DropTable(&MigratePerson{}) if err := DB.AutoMigrate(&MigratePerson{}); err != nil { t.Fatalf("Failed to auto migrate, but got error %v", err) } if !DB.Migrator().HasConstraint("migrate_people", "fk_migrate_people_manager") { t.Fatalf("Failed to find has one constraint between people and managers") } }
explode_data.jsonl/6493
{ "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, 13253, 44, 34479, 12092, 47447, 2283, 1155, 353, 8840, 836, 8, 341, 13158, 386, 34479, 10680, 2036, 341, 197, 29580, 286, 2622, 198, 197, 21297, 414, 914, 198, 197, 197, 2043, 915, 353, 2496, 198, 197, 197, 2043, 256, 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...
3
func TestGetAllFabrics(t *testing.T) { config.SetUpMockConfig(t) defer func() { err := common.TruncateDB(common.InMemory) if err != nil { t.Fatalf("error: %v", err) } err = common.TruncateDB(common.OnDisk) if err != nil { t.Fatalf("error: %v", err) } }() fabuuid := "6d4a0a66-7efa-578e-83cf-44dc68d2874e" mockFabricData(t, fabuuid, "CFM") fabuuid = "44dc0a66-7efa-578e-83cf-44dc68d2874e" mockFabricData(t, fabuuid, "CFM") fabrics, err := GetAllFabrics() assert.Nil(t, err, "Error Should be nil") assert.Equal(t, 2, len(fabrics), "there should be 2 fabrics details") }
explode_data.jsonl/49408
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 282 }
[ 2830, 3393, 1949, 2403, 52167, 6198, 1155, 353, 8840, 836, 8, 341, 25873, 4202, 2324, 11571, 2648, 1155, 340, 16867, 2915, 368, 341, 197, 9859, 1669, 4185, 8240, 26900, 3506, 57802, 5337, 10642, 340, 197, 743, 1848, 961, 2092, 341, 298,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestIntegration_ValidObjectNames(t *testing.T) { ctx := context.Background() client, bucket := testConfig(ctx, t) defer client.Close() bkt := client.Bucket(bucket) validNames := []string{ "gopher", "Гоферови", "a", strings.Repeat("a", 1024), } for _, name := range validNames { if err := writeObject(ctx, bkt.Object(name), "", []byte("data")); err != nil { t.Errorf("Object %q write failed: %v. Want success", name, err) continue } defer bkt.Object(name).Delete(ctx) } invalidNames := []string{ "", // Too short. strings.Repeat("a", 1025), // Too long. "new\nlines", "bad\xffunicode", } for _, name := range invalidNames { // Invalid object names will either cause failure during Write or Close. if err := writeObject(ctx, bkt.Object(name), "", []byte("data")); err != nil { continue } defer bkt.Object(name).Delete(ctx) t.Errorf("%q should have failed. Didn't", name) } }
explode_data.jsonl/8902
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 364 }
[ 2830, 3393, 52464, 97279, 1190, 7980, 1155, 353, 8840, 836, 8, 341, 20985, 1669, 2266, 19047, 741, 25291, 11, 15621, 1669, 1273, 2648, 7502, 11, 259, 340, 16867, 2943, 10421, 2822, 2233, 5840, 1669, 2943, 1785, 11152, 58934, 692, 56322, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestDecimalBytesLogicalTypeEncode(t *testing.T) { schema := `{"type": "bytes", "logicalType": "decimal", "precision": 4, "scale": 2}` testBinaryCodecPass(t, schema, big.NewRat(617, 50), []byte("\x04\x04\xd2")) testBinaryCodecPass(t, schema, big.NewRat(-617, 50), []byte("\x04\xfb\x2e")) testBinaryCodecPass(t, schema, big.NewRat(0, 1), []byte("\x02\x00")) }
explode_data.jsonl/12012
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 156 }
[ 2830, 3393, 11269, 7078, 64312, 929, 32535, 1155, 353, 8840, 836, 8, 341, 1903, 3416, 1669, 1565, 4913, 1313, 788, 330, 9651, 497, 330, 30256, 929, 788, 330, 23289, 497, 330, 27182, 788, 220, 19, 11, 330, 12445, 788, 220, 17, 31257, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestGetFilterForMetric(t *testing.T) { var logger = logp.NewLogger("test") cases := []struct { title string m string r stackdriverMetricsRequester expectedFilter string }{ { "compute service with zone in config", "compute.googleapis.com/firewall/dropped_bytes_count", stackdriverMetricsRequester{config: config{Zone: "us-central1-a"}}, "metric.type=\"compute.googleapis.com/firewall/dropped_bytes_count\" AND resource.labels.zone = starts_with(\"us-central1-a\")", }, { "pubsub service with zone in config", "pubsub.googleapis.com/subscription/ack_message_count", stackdriverMetricsRequester{config: config{Zone: "us-central1-a"}}, "metric.type=\"pubsub.googleapis.com/subscription/ack_message_count\"", }, { "loadbalancing service with zone in config", "loadbalancing.googleapis.com/https/backend_latencies", stackdriverMetricsRequester{config: config{Zone: "us-central1-a"}}, "metric.type=\"loadbalancing.googleapis.com/https/backend_latencies\"", }, { "compute service with region in config", "compute.googleapis.com/firewall/dropped_bytes_count", stackdriverMetricsRequester{config: config{Region: "us-east1"}}, "metric.type=\"compute.googleapis.com/firewall/dropped_bytes_count\" AND resource.labels.zone = starts_with(\"us-east1\")", }, { "pubsub service with region in config", "pubsub.googleapis.com/subscription/ack_message_count", stackdriverMetricsRequester{config: config{Region: "us-east1"}}, "metric.type=\"pubsub.googleapis.com/subscription/ack_message_count\"", }, { "loadbalancing service with region in config", "loadbalancing.googleapis.com/https/backend_latencies", stackdriverMetricsRequester{config: config{Region: "us-east1"}}, "metric.type=\"loadbalancing.googleapis.com/https/backend_latencies\"", }, { "compute service with both region and zone in config", "compute.googleapis.com/firewall/dropped_bytes_count", stackdriverMetricsRequester{config: config{Region: "us-central1", Zone: "us-central1-a"}, logger: logger}, "metric.type=\"compute.googleapis.com/firewall/dropped_bytes_count\" AND resource.labels.zone = starts_with(\"us-central1\")", }, { "compute uptime with partial region", "compute.googleapis.com/instance/uptime", stackdriverMetricsRequester{config: config{Region: "us-west"}, logger: logger}, "metric.type=\"compute.googleapis.com/instance/uptime\" AND resource.labels.zone = starts_with(\"us-west\")", }, { "compute uptime with partial zone", "compute.googleapis.com/instance/uptime", stackdriverMetricsRequester{config: config{Zone: "us-west1-"}, logger: logger}, "metric.type=\"compute.googleapis.com/instance/uptime\" AND resource.labels.zone = starts_with(\"us-west1-\")", }, { "compute uptime with wildcard in region", "compute.googleapis.com/instance/uptime", stackdriverMetricsRequester{config: config{Region: "us-*"}, logger: logger}, "metric.type=\"compute.googleapis.com/instance/uptime\" AND resource.labels.zone = starts_with(\"us-\")", }, { "compute uptime with wildcard in zone", "compute.googleapis.com/instance/uptime", stackdriverMetricsRequester{config: config{Zone: "us-west1-*"}, logger: logger}, "metric.type=\"compute.googleapis.com/instance/uptime\" AND resource.labels.zone = starts_with(\"us-west1-\")", }, } for _, c := range cases { t.Run(c.title, func(t *testing.T) { filter := c.r.getFilterForMetric(c.m) assert.Equal(t, c.expectedFilter, filter) }) } }
explode_data.jsonl/25013
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1396 }
[ 2830, 3393, 1949, 5632, 2461, 54310, 1155, 353, 8840, 836, 8, 341, 2405, 5925, 284, 1487, 79, 7121, 7395, 445, 1944, 1138, 1444, 2264, 1669, 3056, 1235, 341, 197, 24751, 688, 914, 198, 197, 2109, 1060, 914, 198, 197, 7000, 1060, 5611,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestShouldReturnNoErrorsAndWarningsWhenValidationOfMatchSpecificationOfApplicationConfigIsCalledAndValueCanBeParsed(t *testing.T) { resourceHandle := NewApplicationConfigResourceHandle() schema := resourceHandle.MetaData().Schema value := validMatchSpecification warns, errs := schema[ApplicationConfigFieldMatchSpecification].ValidateFunc(value, ApplicationConfigFieldMatchSpecification) require.Empty(t, warns) require.Empty(t, errs) }
explode_data.jsonl/64923
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 125 }
[ 2830, 3393, 14996, 5598, 2753, 13877, 3036, 20140, 4498, 13799, 2124, 8331, 56139, 2124, 4988, 2648, 3872, 20960, 3036, 1130, 69585, 82959, 1155, 353, 8840, 836, 8, 341, 50346, 6999, 1669, 1532, 4988, 2648, 4783, 6999, 741, 1903, 3416, 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 TestGenerateConfig(t *testing.T) { defer setupTestGenerateConfig(t)(t) if err := internal.GenerateConfig(); err != nil { t.Errorf("Unexpected error: %v", err) return } f, err := os.Open(testConfigPath) if err != nil { t.Errorf("config file was not created") return } defer f.Close() b, err := ioutil.ReadAll(f) if err != nil { t.Errorf("Unexpected error: %v", err) return } if want, got := internal.ConfigFileTemplate, string(b); want != got { t.Errorf("GenerateConfig() => config file text %v, want %v", got, want) } }
explode_data.jsonl/17825
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 215 }
[ 2830, 3393, 31115, 2648, 1155, 353, 8840, 836, 8, 341, 16867, 6505, 2271, 31115, 2648, 1155, 2376, 83, 692, 743, 1848, 1669, 5306, 57582, 2648, 2129, 1848, 961, 2092, 341, 197, 3244, 13080, 445, 29430, 1465, 25, 1018, 85, 497, 1848, 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...
5
func TestNewPlayedField(t *testing.T) { data, _ := hex.DecodeString("000000320000000101") buf := bytes.NewBuffer(data) hdr, err := field.NewHeader(buf) if err != nil { t.Fatalf("expected NewHeader err to be nil, got %v", err) } played, err := field.NewPlayedField(hdr, buf) if err != nil { t.Fatalf("expected NewPlayedField err to be nil, got %v", err) } if played == nil { t.Fatal("expected played to not be nil") } }
explode_data.jsonl/50104
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 169 }
[ 2830, 3393, 3564, 85930, 1877, 1155, 353, 8840, 836, 8, 341, 8924, 11, 716, 1669, 12371, 56372, 703, 445, 15, 15, 15, 15, 15, 15, 18, 17, 15, 15, 15, 15, 15, 15, 15, 16, 15, 16, 1138, 26398, 1669, 5820, 7121, 4095, 2592, 692, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
4
func TestStopOneTimeSchedule(t *testing.T) { c := &TestCheck{} s := getScheduler() // schedule a one-time check c.intl = 0 err := s.Enter(c) assert.Nil(t, err) s.Enter(c) s.Run() s.Stop() // this will panic if we didn't properly cancel all the one-time scheduling goroutines close(s.checksPipe) // sleep to make the runtime schedule the hanging goroutines, if there are any time.Sleep(time.Millisecond) }
explode_data.jsonl/23209
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 155 }
[ 2830, 3393, 10674, 3966, 1462, 32210, 1155, 353, 8840, 836, 8, 341, 1444, 1669, 609, 2271, 3973, 16094, 1903, 1669, 633, 38878, 2822, 197, 322, 9700, 264, 825, 7246, 1779, 198, 1444, 6403, 75, 284, 220, 15, 198, 9859, 1669, 274, 52267...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestRestoreWithPermissionFailure(t *testing.T) { env, cleanup := withTestEnvironment(t) defer cleanup() datafile := filepath.Join("testdata", "repo-restore-permissions-test.tar.gz") rtest.SetupTarTestFixture(t, env.base, datafile) snapshots := testRunList(t, "snapshots", env.gopts) rtest.Assert(t, len(snapshots) > 0, "no snapshots found in repo (%v)", datafile) globalOptions.stderr = ioutil.Discard defer func() { globalOptions.stderr = os.Stderr }() testRunRestore(t, env.gopts, filepath.Join(env.base, "restore"), snapshots[0]) // make sure that all files have been restored, regardless of any // permission errors files := testRunLs(t, env.gopts, snapshots[0].String()) for _, filename := range files { fi, err := os.Lstat(filepath.Join(env.base, "restore", filename)) rtest.OK(t, err) rtest.Assert(t, !isFile(fi) || fi.Size() > 0, "file %v restored, but filesize is 0", filename) } }
explode_data.jsonl/43560
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 350 }
[ 2830, 3393, 56284, 2354, 14966, 17507, 1155, 353, 8840, 836, 8, 341, 57538, 11, 21290, 1669, 448, 2271, 12723, 1155, 340, 16867, 21290, 2822, 8924, 1192, 1669, 26054, 22363, 445, 92425, 497, 330, 23476, 12, 30804, 17018, 5176, 16839, 2804...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestGetVMsSuccess(t *testing.T) { resources := initGetVMsTest(t) defer resources.ctrl.Finish() id1 := ids.GenerateTestID() id2 := ids.GenerateTestID() vmIDs := []ids.ID{id1, id2} // every vm is at least aliased to itself. alias1 := []string{id1.String(), "vm1-alias-1", "vm1-alias-2"} alias2 := []string{id2.String(), "vm2-alias-1", "vm2-alias-2"} // we expect that we dedup the redundant alias of vmId. expectedVMRegistry := map[ids.ID][]string{ id1: alias1[1:], id2: alias2[1:], } resources.mockLog.EXPECT().Debug(gomock.Any()).Times(1) resources.mockVMManager.EXPECT().ListVMs().Times(1).Return(vmIDs, nil) resources.mockVMManager.EXPECT().Aliases(id1).Times(1).Return(alias1, nil) resources.mockVMManager.EXPECT().Aliases(id2).Times(1).Return(alias2, nil) reply := GetVMsReply{} err := resources.info.GetVMs(nil, nil, &reply) assert.Equal(t, expectedVMRegistry, reply.VMs) assert.Equal(t, err, nil) }
explode_data.jsonl/27453
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 379 }
[ 2830, 3393, 1949, 11187, 82, 7188, 1155, 353, 8840, 836, 8, 341, 10202, 2360, 1669, 2930, 1949, 11187, 82, 2271, 1155, 340, 16867, 4963, 57078, 991, 18176, 2822, 15710, 16, 1669, 14151, 57582, 2271, 915, 741, 15710, 17, 1669, 14151, 575...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestIntStrLen(t *testing.T) { numbers := []int{-1, 0, 1} n1 := 1 n2 := -1 for i := 0; i < 10; i++ { n1 = n1*10 + i + 1 n2 = n2*10 - i - 1 numbers = append(numbers, n1, n2) } for _, n := range numbers { got := intStrLen(n) exp := len(strconv.Itoa(n)) assert.Equal(t, exp, got) } }
explode_data.jsonl/44798
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 158 }
[ 2830, 3393, 1072, 2580, 11271, 1155, 353, 8840, 836, 8, 341, 22431, 1902, 1669, 3056, 396, 19999, 16, 11, 220, 15, 11, 220, 16, 532, 9038, 16, 1669, 220, 16, 198, 9038, 17, 1669, 481, 16, 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...
3
func TestGetKeyInfo(t *testing.T) { addr := os.Getenv("TEST_REDIS_URI") db := dbNumStr c, err := redis.DialURL(addr) if err != nil { t.Fatalf("Couldn't connect to %#v: %#v", addr, err) } _, err = c.Do("SELECT", db) if err != nil { t.Errorf("Couldn't select database %#v", db) } fixtures := []keyFixture{ {"SET", "key_info_test_string", []interface{}{"Woohoo!"}}, {"HSET", "key_info_test_hash", []interface{}{"hashkey1", "hashval1"}}, {"PFADD", "key_info_test_hll", []interface{}{"hllval1", "hllval2"}}, {"LPUSH", "key_info_test_list", []interface{}{"listval1", "listval2", "listval3"}}, {"SADD", "key_info_test_set", []interface{}{"setval1", "setval2", "setval3", "setval4"}}, {"ZADD", "key_info_test_zset", []interface{}{ "1", "zsetval1", "2", "zsetval2", "3", "zsetval3", "4", "zsetval4", "5", "zsetval5", }}, {"XADD", "key_info_test_stream", []interface{}{"*", "field1", "str1"}}, } createKeyFixtures(t, c, fixtures) defer func() { deleteKeyFixtures(t, c, fixtures) c.Close() }() expectedSizes := map[string]float64{ "key_info_test_string": 7, "key_info_test_hash": 1, "key_info_test_hll": 2, "key_info_test_list": 3, "key_info_test_set": 4, "key_info_test_zset": 5, "key_info_test_stream": 1, } // Test all known types for _, f := range fixtures { info, err := getKeyInfo(c, f.key) if err != nil { t.Errorf("Error getting key info for %#v.", f.key) } expected := expectedSizes[f.key] if info.size != expected { t.Logf("%#v", info) t.Errorf("Wrong size for key: %#v. Expected: %#v; Actual: %#v", f.key, expected, info.size) } } // Test absent key returns the correct error _, err = getKeyInfo(c, "absent_key") if err != errNotFound { t.Error("Expected `errNotFound` for absent key. Got a different error.") } }
explode_data.jsonl/46990
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 827 }
[ 2830, 3393, 1949, 1592, 1731, 1155, 353, 8840, 836, 8, 341, 53183, 1669, 2643, 64883, 445, 10033, 2192, 21202, 23116, 1138, 20939, 1669, 2927, 4651, 2580, 271, 1444, 11, 1848, 1669, 20870, 98462, 3144, 24497, 340, 743, 1848, 961, 2092, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestAddCollisionListener(t *testing.T) { var c1, c2 c var li l simra := &simra{} simra.RemoveAllCollisionListener() if simra.comapLength() != 0 { t.Error("unexpected comap length. comapLength() =", simra.comapLength()) } simra.AddCollisionListener(&c1, &c2, &li) if simra.comapLength() != 1 { t.Error("unexpected comap length. comapLength() =", simra.comapLength()) } simra.collisionCheckAndNotify() waitOnCollision(t, true) if simra.comapLength() != 1 { t.Error("unexpected comap length. comapLength() =", simra.comapLength()) } simra.AddCollisionListener(&c1, &c2, &li) if simra.comapLength() != 2 { t.Error("unexpected comap length. comapLength() =", simra.comapLength()) } simra.RemoveAllCollisionListener() if simra.comapLength() != 0 { t.Error("unexpected comap length. comapLength() =", simra.comapLength()) } }
explode_data.jsonl/13384
{ "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, 2212, 32280, 2743, 1155, 353, 8840, 836, 8, 341, 2405, 272, 16, 11, 272, 17, 272, 198, 2405, 898, 326, 271, 1903, 318, 956, 1669, 609, 14781, 956, 16094, 1903, 318, 956, 84427, 32280, 2743, 741, 743, 1643, 956, 905, 391,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestApplyRemoveContainerPort(t *testing.T) { defer featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, genericfeatures.ServerSideApply, true)() _, client, closeFn := setup(t) defer closeFn() obj := []byte(`{ "apiVersion": "apps/v1", "kind": "Deployment", "metadata": { "name": "deployment", "labels": {"app": "nginx"} }, "spec": { "replicas": 3, "selector": { "matchLabels": { "app": "nginx" } }, "template": { "metadata": { "labels": { "app": "nginx" } }, "spec": { "containers": [{ "name": "nginx", "image": "nginx:latest", "ports": [{ "containerPort": 80, "protocol": "TCP" }] }] } } } }`) _, err := client.CoreV1().RESTClient().Patch(types.ApplyPatchType). AbsPath("/apis/apps/v1"). Namespace("default"). Resource("deployments"). Name("deployment"). Param("fieldManager", "apply_test"). Body(obj).Do(context.TODO()).Get() if err != nil { t.Fatalf("Failed to create object using Apply patch: %v", err) } obj = []byte(`{ "apiVersion": "apps/v1", "kind": "Deployment", "metadata": { "name": "deployment", "labels": {"app": "nginx"} }, "spec": { "replicas": 3, "selector": { "matchLabels": { "app": "nginx" } }, "template": { "metadata": { "labels": { "app": "nginx" } }, "spec": { "containers": [{ "name": "nginx", "image": "nginx:latest" }] } } } }`) _, err = client.CoreV1().RESTClient().Patch(types.ApplyPatchType). AbsPath("/apis/apps/v1"). Namespace("default"). Resource("deployments"). Name("deployment"). Param("fieldManager", "apply_test"). Body(obj).Do(context.TODO()).Get() if err != nil { t.Fatalf("Failed to remove container port using Apply patch: %v", err) } deployment, err := client.AppsV1().Deployments("default").Get(context.TODO(), "deployment", metav1.GetOptions{}) if err != nil { t.Fatalf("Failed to retrieve object: %v", err) } if len(deployment.Spec.Template.Spec.Containers[0].Ports) > 0 { t.Fatalf("Expected no container ports but got: %v, object: \n%#v", deployment.Spec.Template.Spec.Containers[0].Ports, deployment) } }
explode_data.jsonl/53473
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1055 }
[ 2830, 3393, 28497, 13021, 4502, 7084, 1155, 353, 8840, 836, 8, 341, 16867, 4565, 70, 266, 57824, 287, 4202, 13859, 42318, 16014, 2271, 1155, 11, 4094, 12753, 13275, 13859, 42318, 11, 13954, 20304, 22997, 16384, 28497, 11, 830, 8, 2822, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
5
func TestWithLogsUnmarshalers(t *testing.T) { unmarshaler := &customLogsUnmarshaler{} f := NewFactory(WithLogsUnmarshalers(unmarshaler)) cfg := createDefaultConfig().(*Config) // disable contacting broker cfg.Metadata.Full = false cfg.ProtocolVersion = "2.0.0" t.Run("custom_encoding", func(t *testing.T) { cfg.Encoding = unmarshaler.Encoding() exporter, err := f.CreateLogsReceiver(context.Background(), componenttest.NewNopReceiverCreateSettings(), cfg, nil) require.NoError(t, err) require.NotNil(t, exporter) }) t.Run("default_encoding", func(t *testing.T) { cfg.Encoding = defaultEncoding exporter, err := f.CreateLogsReceiver(context.Background(), componenttest.NewNopReceiverCreateSettings(), cfg, nil) require.NoError(t, err) assert.NotNil(t, exporter) }) }
explode_data.jsonl/70861
{ "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, 2354, 51053, 1806, 27121, 388, 1155, 353, 8840, 836, 8, 341, 20479, 27121, 261, 1669, 609, 9163, 51053, 1806, 27121, 261, 16094, 1166, 1669, 1532, 4153, 7, 2354, 51053, 1806, 27121, 388, 18364, 27121, 261, 1171, 50286, 1669, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestAnyValueArrayCreate(t *testing.T) { array := data.NewEmptyAnyValueArray() assert.Equal(t, 0, array.Len()) array = data.NewAnyValueArray([]interface{}{1, 2, 3}) assert.Equal(t, 3, array.Len()) assert.Equal(t, "1,2,3", array.String()) array = data.NewAnyValueArrayFromString("Fatal,Error,Info,", ",", true) assert.Equal(t, 3, array.Len()) array = data.NewAnyValueArray([]interface{}{1, 2, 3}) assert.Equal(t, 3, array.Len()) assert.True(t, array.Contains(1)) array = data.NewAnyValueArrayFromValue([]interface{}{1, 2, 3}) assert.Equal(t, 3, array.Len()) assert.Equal(t, int64(1), array.Get(0)) }
explode_data.jsonl/70849
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 249 }
[ 2830, 3393, 8610, 1130, 1857, 4021, 1155, 353, 8840, 836, 8, 341, 11923, 1669, 821, 7121, 3522, 8610, 1130, 1857, 741, 6948, 12808, 1155, 11, 220, 15, 11, 1334, 65819, 12367, 11923, 284, 821, 7121, 8610, 1130, 1857, 10556, 4970, 6257, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestInvoiceExpiryWatcherStartStop(t *testing.T) { watcher := NewInvoiceExpiryWatcher(clock.NewTestClock(testTime)) cancel := func(lntypes.Hash, bool) error { t.Fatalf("unexpected call") return nil } if err := watcher.Start(cancel); err != nil { t.Fatalf("unexpected error upon start: %v", err) } if err := watcher.Start(cancel); err == nil { t.Fatalf("expected error upon second start") } watcher.Stop() if err := watcher.Start(cancel); err != nil { t.Fatalf("unexpected error upon start: %v", err) } }
explode_data.jsonl/47243
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 200 }
[ 2830, 3393, 34674, 840, 48209, 47248, 3479, 10674, 1155, 353, 8840, 836, 8, 341, 6692, 28058, 1669, 1532, 34674, 840, 48209, 47248, 90911, 7121, 2271, 26104, 8623, 1462, 1171, 84441, 1669, 2915, 2333, 406, 1804, 15103, 11, 1807, 8, 1465, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestPushImageLayerRegistry(t *testing.T) { r := spawnTestRegistrySession(t) layer := strings.NewReader("") _, _, err := r.PushImageLayerRegistry(imageID, layer, makeURL("/v1/"), token, []byte{}) if err != nil { t.Fatal(err) } }
explode_data.jsonl/59064
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 94 }
[ 2830, 3393, 16644, 1906, 9188, 15603, 1155, 353, 8840, 836, 8, 341, 7000, 1669, 18042, 2271, 15603, 5283, 1155, 340, 65986, 1669, 9069, 68587, 31764, 197, 6878, 8358, 1848, 1669, 435, 34981, 1906, 9188, 15603, 10075, 915, 11, 6193, 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...
2
func TestMustParse(t *testing.T) { var args struct { Foo string } os.Args = []string{"example", "--foo", "bar"} parser := MustParse(&args) assert.Equal(t, "bar", args.Foo) assert.NotNil(t, parser) }
explode_data.jsonl/13033
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 87 }
[ 2830, 3393, 31776, 14463, 1155, 353, 8840, 836, 8, 341, 2405, 2827, 2036, 341, 197, 12727, 2624, 914, 198, 197, 532, 25078, 51015, 284, 3056, 917, 4913, 8687, 497, 14482, 7975, 497, 330, 2257, 16707, 55804, 1669, 15465, 14463, 2099, 211...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestConnExecutionTimeout(t *testing.T) { store, dom, clean := testkit.CreateMockStoreAndDomain(t) defer clean() // There is no underlying netCon, use failpoint to avoid panic require.NoError(t, failpoint.Enable("github.com/pingcap/tidb/server/FakeClientConn", "return(1)")) se, err := session.CreateSession4Test(store) require.NoError(t, err) connID := uint64(1) se.SetConnectionID(connID) tc := &TiDBContext{ Session: se, stmts: make(map[int]*TiDBStatement), } cc := &clientConn{ connectionID: connID, server: &Server{ capability: defaultCapability, }, alloc: arena.NewAllocator(32 * 1024), chunkAlloc: chunk.NewAllocator(), } cc.setCtx(tc) srv := &Server{ clients: map[uint64]*clientConn{ connID: cc, }, dom: dom, } handle := dom.ExpensiveQueryHandle().SetSessionManager(srv) go handle.Run() _, err = se.Execute(context.Background(), "use test;") require.NoError(t, err) _, err = se.Execute(context.Background(), "CREATE TABLE testTable2 (id bigint PRIMARY KEY, age int)") require.NoError(t, err) for i := 0; i < 10; i++ { str := fmt.Sprintf("insert into testTable2 values(%d, %d)", i, i%80) _, err = se.Execute(context.Background(), str) require.NoError(t, err) } _, err = se.Execute(context.Background(), "select SLEEP(1);") require.NoError(t, err) _, err = se.Execute(context.Background(), "set @@max_execution_time = 500;") require.NoError(t, err) err = cc.handleQuery(context.Background(), "select * FROM testTable2 WHERE SLEEP(1);") require.NoError(t, err) _, err = se.Execute(context.Background(), "set @@max_execution_time = 1500;") require.NoError(t, err) _, err = se.Execute(context.Background(), "set @@tidb_expensive_query_time_threshold = 1;") require.NoError(t, err) records, err := se.Execute(context.Background(), "select SLEEP(2);") require.NoError(t, err) tk := testkit.NewTestKit(t, store) tk.ResultSetToResult(records[0], fmt.Sprintf("%v", records[0])).Check(testkit.Rows("1")) _, err = se.Execute(context.Background(), "set @@max_execution_time = 0;") require.NoError(t, err) err = cc.handleQuery(context.Background(), "select * FROM testTable2 WHERE SLEEP(1);") require.NoError(t, err) err = cc.handleQuery(context.Background(), "select /*+ MAX_EXECUTION_TIME(100)*/ * FROM testTable2 WHERE SLEEP(1);") require.NoError(t, err) require.NoError(t, failpoint.Disable("github.com/pingcap/tidb/server/FakeClientConn")) }
explode_data.jsonl/73152
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 945 }
[ 2830, 3393, 9701, 20294, 7636, 1155, 353, 8840, 836, 8, 341, 57279, 11, 4719, 11, 4240, 1669, 1273, 8226, 7251, 11571, 6093, 3036, 13636, 1155, 340, 16867, 4240, 2822, 197, 322, 2619, 374, 902, 16533, 4179, 1109, 11, 990, 3690, 2768, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestDeleteRoute(t *testing.T) { fakeRoutes := newFakeRoutesClient() cloud := &Cloud{ RoutesClient: fakeRoutes, Config: Config{ RouteTableResourceGroup: "foo", RouteTableName: "bar", Location: "location", }, unmanagedNodes: sets.NewString(), nodeInformerSynced: func() bool { return true }, } route := cloudprovider.Route{TargetNode: "node", DestinationCIDR: "1.2.3.4/24"} routeName := mapNodeNameToRouteName(route.TargetNode, route.DestinationCIDR) fakeRoutes.FakeStore = map[string]map[string]network.Route{ cloud.RouteTableName: { routeName: {}, }, } err := cloud.DeleteRoute(context.TODO(), "cluster", &route) if err != nil { t.Errorf("unexpected error deleting route: %v", err) t.FailNow() } mp, found := fakeRoutes.FakeStore[cloud.RouteTableName] if !found { t.Errorf("unexpected missing item for %s", cloud.RouteTableName) t.FailNow() } ob, found := mp[routeName] if found { t.Errorf("unexpectedly found: %v that should have been deleted.", ob) t.FailNow() } // test delete route for unmanaged nodes. nodeName := "node1" nodeCIDR := "4.3.2.1/24" cloud.unmanagedNodes.Insert(nodeName) cloud.routeCIDRs = map[string]string{ nodeName: nodeCIDR, } route1 := cloudprovider.Route{ TargetNode: mapRouteNameToNodeName(nodeName), DestinationCIDR: nodeCIDR, } err = cloud.DeleteRoute(context.TODO(), "cluster", &route1) if err != nil { t.Errorf("unexpected error deleting route: %v", err) t.FailNow() } cidr, found := cloud.routeCIDRs[nodeName] if found { t.Errorf("unexpected CIDR item (%q) for %s", cidr, nodeName) } }
explode_data.jsonl/70929
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 668 }
[ 2830, 3393, 6435, 4899, 1155, 353, 8840, 836, 8, 341, 1166, 726, 26653, 1669, 501, 52317, 26653, 2959, 2822, 197, 12361, 1669, 609, 16055, 515, 197, 11143, 5495, 2959, 25, 12418, 26653, 345, 197, 66156, 25, 5532, 515, 298, 47501, 2556, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestGetCustomersBulkResponseFailure(t *testing.T) { srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { _, err := w.Write([]byte(`some junk value`)) assert.NoError(t, err) })) defer srv.Close() cli := common.NewClient("somesess", "someclient", "", nil, nil) cli.Url = srv.URL customersClient := NewClient(cli) _, err := customersClient.GetCustomersBulk( context.Background(), []map[string]interface{}{ { "recordsOnPage": 1, "pageNo": 1, }, }, map[string]string{}, ) assert.EqualError(t, err, `ERPLY API: failed to unmarshal GetCustomersResponseBulk from 'some junk value': invalid character 's' looking for beginning of value`) if err == nil { return } }
explode_data.jsonl/66216
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 293 }
[ 2830, 3393, 1949, 44845, 88194, 2582, 17507, 1155, 353, 8840, 836, 8, 341, 1903, 10553, 1669, 54320, 70334, 7121, 5475, 19886, 89164, 18552, 3622, 1758, 37508, 11, 435, 353, 1254, 9659, 8, 341, 197, 197, 6878, 1848, 1669, 289, 4073, 105...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestLogout(t *testing.T) { cookieName := "jwt" cookieDomain := "example.com" // the middleware to test authMiddleware, _ := New(&GinJWTMiddleware{ Realm: "test zone", Key: key, Timeout: time.Hour, Authenticator: defaultAuthenticator, SendCookie: true, CookieName: cookieName, CookieDomain: cookieDomain, }) handler := ginHandler(authMiddleware) r := gofight.New() r.POST("/logout"). Run(handler, func(r gofight.HTTPResponse, rq gofight.HTTPRequest) { assert.Equal(t, http.StatusOK, r.Code) assert.Equal(t, fmt.Sprintf("%s=; Path=/; Domain=%s; Max-Age=0", cookieName, cookieDomain), r.HeaderMap.Get("Set-Cookie")) }) }
explode_data.jsonl/64457
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 292 }
[ 2830, 3393, 27958, 1155, 353, 8840, 836, 8, 341, 197, 16236, 675, 1669, 330, 41592, 698, 197, 16236, 13636, 1669, 330, 8687, 905, 698, 197, 322, 279, 29679, 311, 1273, 198, 78011, 24684, 11, 716, 1669, 1532, 2099, 38, 258, 55172, 2468...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestPrintDeployment(t *testing.T) { testDeployment := apps.Deployment{ ObjectMeta: metav1.ObjectMeta{ Name: "test1", CreationTimestamp: metav1.Time{Time: time.Now().Add(1.9e9)}, }, Spec: apps.DeploymentSpec{ Replicas: 5, Template: api.PodTemplateSpec{ Spec: api.PodSpec{ Containers: []api.Container{ { Name: "fake-container1", Image: "fake-image1", }, { Name: "fake-container2", Image: "fake-image2", }, }, }, }, Selector: &metav1.LabelSelector{MatchLabels: map[string]string{"foo": "bar"}}, }, Status: apps.DeploymentStatus{ Replicas: 10, UpdatedReplicas: 2, AvailableReplicas: 1, UnavailableReplicas: 4, }, } tests := []struct { deployment apps.Deployment options printers.GenerateOptions expected []metav1.TableRow }{ // Test Deployment with no generate options. { deployment: testDeployment, options: printers.GenerateOptions{}, // Columns: Name, ReadyReplicas, UpdatedReplicas, AvailableReplicas, Age expected: []metav1.TableRow{{Cells: []interface{}{"test1", "0/5", int64(2), int64(1), "0s"}}}, }, // Test generate options: Wide. { deployment: testDeployment, options: printers.GenerateOptions{Wide: true}, // Columns: Name, ReadyReplicas, UpdatedReplicas, AvailableReplicas, Age, Containers, Images, Selectors expected: []metav1.TableRow{{Cells: []interface{}{"test1", "0/5", int64(2), int64(1), "0s", "fake-container1,fake-container2", "fake-image1,fake-image2", "foo=bar"}}}, }, } for i, test := range tests { rows, err := printDeployment(&test.deployment, test.options) if err != nil { t.Fatal(err) } for i := range rows { rows[i].Object.Object = nil } if !reflect.DeepEqual(test.expected, rows) { t.Errorf("%d mismatch: %s", i, diff.ObjectReflectDiff(test.expected, rows)) } } }
explode_data.jsonl/21606
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 835 }
[ 2830, 3393, 8994, 75286, 1155, 353, 8840, 836, 8, 1476, 18185, 75286, 1669, 10500, 34848, 39130, 515, 197, 23816, 12175, 25, 77520, 16, 80222, 515, 298, 21297, 25, 1060, 330, 1944, 16, 756, 298, 6258, 26453, 20812, 25, 77520, 16, 16299,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestHttpParser_eatBody(t *testing.T) { logp.TestingSetup(logp.WithSelectors("http", "httpdetailed")) http := httpModForTests(nil) http.parserConfig.sendHeaders = true http.parserConfig.sendAllHeaders = true data := []byte("POST / HTTP/1.1\r\n" + "user-agent: curl/7.35.0\r\n" + "host: localhost:9000\r\n" + "accept: */*\r\n" + "authorization: Company 1\r\n" + "content-length: 20\r\n" + "connection: close\r\n" + "\r\n" + "0123456789") st := &stream{data: data, message: new(message)} ok, complete := testParseStream(http, st, 0) assert.True(t, ok) assert.False(t, complete) assert.Equal(t, st.bodyReceived, 10) ok, complete = testParseStream(http, st, 5) assert.True(t, ok) assert.False(t, complete) assert.Equal(t, st.bodyReceived, 15) ok, complete = testParseStream(http, st, 5) assert.True(t, ok) assert.True(t, complete) assert.Equal(t, st.bodyReceived, 20) assert.Equal(t, st.message.end, len(data)) }
explode_data.jsonl/16491
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 409 }
[ 2830, 3393, 2905, 6570, 2204, 266, 5444, 1155, 353, 8840, 836, 8, 341, 6725, 79, 8787, 287, 21821, 12531, 79, 26124, 96995, 445, 1254, 497, 330, 1254, 67, 10111, 28075, 28080, 1669, 1758, 4459, 2461, 18200, 27907, 340, 28080, 25617, 264...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestSDCheckResult(t *testing.T) { targetGroups := []*targetgroup.Group{{ Targets: []model.LabelSet{ map[model.LabelName]model.LabelValue{"__address__": "localhost:8080", "foo": "bar"}, }, }} reg, err := relabel.NewRegexp("(.*)") require.Nil(t, err) scrapeConfig := &config.ScrapeConfig{ RelabelConfigs: []*relabel.Config{{ SourceLabels: model.LabelNames{"foo"}, Action: relabel.Replace, TargetLabel: "newfoo", Regex: reg, Replacement: "$1", }}, } expectedSDCheckResult := []sdCheckResult{ { DiscoveredLabels: labels.Labels{ labels.Label{Name: "__address__", Value: "localhost:8080"}, labels.Label{Name: "__scrape_interval__", Value: "0s"}, labels.Label{Name: "__scrape_timeout__", Value: "0s"}, labels.Label{Name: "foo", Value: "bar"}, }, Labels: labels.Labels{ labels.Label{Name: "__address__", Value: "localhost:8080"}, labels.Label{Name: "__scrape_interval__", Value: "0s"}, labels.Label{Name: "__scrape_timeout__", Value: "0s"}, labels.Label{Name: "foo", Value: "bar"}, labels.Label{Name: "instance", Value: "localhost:8080"}, labels.Label{Name: "newfoo", Value: "bar"}, }, Error: nil, }, } require.Equal(t, expectedSDCheckResult, getSDCheckResult(targetGroups, scrapeConfig)) }
explode_data.jsonl/45764
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 550 }
[ 2830, 3393, 5491, 3973, 2077, 1155, 353, 8840, 836, 8, 341, 28861, 22173, 1669, 29838, 5657, 4074, 5407, 90, 515, 197, 197, 49030, 25, 3056, 2528, 4679, 1649, 515, 298, 19567, 79938, 4679, 675, 60, 2528, 4679, 1130, 4913, 563, 4995, 5...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestParsePointsStringWithExtraBuffer(t *testing.T) { b := make([]byte, 70*5000) buf := bytes.NewBuffer(b) key := "cpu,host=A,region=uswest" buf.WriteString(fmt.Sprintf("%s value=%.3f 1\n", key, rand.Float64())) points, err := models.ParsePointsString(buf.String()) if err != nil { t.Fatalf("failed to write points: %s", err.Error()) } pointKey := string(points[0].Key()) if len(key) != len(pointKey) { t.Fatalf("expected length of both keys are same but got %d and %d", len(key), len(pointKey)) } if key != pointKey { t.Fatalf("expected both keys are same but got %s and %s", key, pointKey) } }
explode_data.jsonl/16967
{ "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, 14463, 11411, 703, 2354, 11612, 4095, 1155, 353, 8840, 836, 8, 341, 2233, 1669, 1281, 10556, 3782, 11, 220, 22, 15, 9, 20, 15, 15, 15, 340, 26398, 1669, 5820, 7121, 4095, 1883, 340, 23634, 1669, 330, 16475, 11, 3790, 466...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestEnableIPv6(t *testing.T) { if !testutils.IsRunningInContainer() { defer testutils.SetupTestOSContext(t)() } tmpResolvConf := []byte("search pommesfrites.fr\nnameserver 12.34.56.78\nnameserver 2001:4860:4860::8888\n") //take a copy of resolv.conf for restoring after test completes resolvConfSystem, err := ioutil.ReadFile("/etc/resolv.conf") if err != nil { t.Fatal(err) } //cleanup defer func() { if err := ioutil.WriteFile("/etc/resolv.conf", resolvConfSystem, 0644); err != nil { t.Fatal(err) } }() netOption := options.Generic{ netlabel.EnableIPv6: true, netlabel.GenericData: options.Generic{ "BridgeName": "testnetwork", }, } ipamV6ConfList := []*libnetwork.IpamConf{&libnetwork.IpamConf{PreferredPool: "fe80::/64"}} n, err := createTestNetwork("bridge", "testnetwork", netOption, nil, ipamV6ConfList) if err != nil { t.Fatal(err) } defer func() { if err := n.Delete(); err != nil { t.Fatal(err) } }() ep1, err := n.CreateEndpoint("ep1") if err != nil { t.Fatal(err) } if err := ioutil.WriteFile("/etc/resolv.conf", tmpResolvConf, 0644); err != nil { t.Fatal(err) } resolvConfPath := "/tmp/libnetwork_test/resolv.conf" defer os.Remove(resolvConfPath) sb, err := controller.NewSandbox(containerID, libnetwork.OptionResolvConfPath(resolvConfPath)) if err != nil { t.Fatal(err) } defer func() { if err := sb.Delete(); err != nil { t.Fatal(err) } }() err = ep1.Join(sb) if err != nil { t.Fatal(err) } content, err := ioutil.ReadFile(resolvConfPath) if err != nil { t.Fatal(err) } if !bytes.Equal(content, tmpResolvConf) { t.Fatalf("Expected:\n%s\nGot:\n%s", string(tmpResolvConf), string(content)) } if err != nil { t.Fatal(err) } }
explode_data.jsonl/6371
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 762 }
[ 2830, 3393, 11084, 58056, 21, 1155, 353, 8840, 836, 8, 341, 743, 753, 1944, 6031, 4506, 18990, 641, 4502, 368, 341, 197, 16867, 1273, 6031, 39820, 2271, 3126, 1972, 1155, 8, 741, 197, 630, 20082, 1061, 35315, 15578, 1669, 3056, 3782, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestEvalInCatchInStashlessFunc(t *testing.T) { const SCRIPT = ` function f() { var ex; try { throw "ex1"; } catch (er1) { eval("ex = er1"); } return ex; } f(); ` testScript1(SCRIPT, asciiString("ex1"), t) }
explode_data.jsonl/75240
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 116 }
[ 2830, 3393, 54469, 641, 57760, 641, 623, 988, 1717, 9626, 1155, 353, 8840, 836, 8, 341, 4777, 53679, 284, 22074, 7527, 282, 368, 341, 197, 2405, 505, 280, 197, 6799, 341, 298, 9581, 330, 327, 16, 876, 197, 197, 92, 2287, 320, 261, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestGetFileContentTypeTXT(t *testing.T) { file := `../testdata/files/test1.txt` fileType, err := GetFileContentType(file) if err != nil { t.Log("Error -> ", err) t.Fail() } if !strings.Contains(fileType, "text/plain") { t.Log(fileType) t.Fail() } }
explode_data.jsonl/24005
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 115 }
[ 2830, 3393, 1949, 1703, 29504, 62865, 1155, 353, 8840, 836, 8, 341, 17661, 1669, 1565, 1244, 92425, 33220, 12697, 16, 3909, 3989, 17661, 929, 11, 1848, 1669, 2126, 1703, 29504, 4866, 692, 743, 1848, 961, 2092, 341, 197, 3244, 5247, 445,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestInitializeAsserter(t *testing.T) { var tests = map[string]struct { network *types.NetworkIdentifier networkRequest *types.NetworkRequest // used for both /network/options and /network/status networkList *types.NetworkListResponse networkStatus *types.NetworkStatusResponse networkOptions *types.NetworkOptionsResponse expectedNetwork *types.NetworkIdentifier expectedStatus *types.NetworkStatusResponse expectedError error }{ "default network": { networkRequest: &types.NetworkRequest{ NetworkIdentifier: basicNetwork, }, networkList: basicNetworkList, networkStatus: basicNetworkStatus, networkOptions: basicNetworkOptions, expectedNetwork: basicNetwork, expectedStatus: basicNetworkStatus, }, "specify network": { network: basicNetwork, networkRequest: &types.NetworkRequest{ NetworkIdentifier: basicNetwork, }, networkList: basicNetworkList, networkStatus: basicNetworkStatus, networkOptions: basicNetworkOptions, expectedNetwork: basicNetwork, expectedStatus: basicNetworkStatus, }, "other network": { network: otherNetwork, networkRequest: &types.NetworkRequest{ NetworkIdentifier: otherNetwork, }, networkList: complexNetworkList, networkStatus: otherNetworkStatus, networkOptions: otherNetworkOptions, expectedNetwork: otherNetwork, expectedStatus: otherNetworkStatus, }, "no networks": { network: otherNetwork, networkRequest: &types.NetworkRequest{ NetworkIdentifier: otherNetwork, }, networkList: &types.NetworkListResponse{}, expectedError: ErrNoNetworks, }, "missing network": { network: otherNetwork, networkRequest: &types.NetworkRequest{ NetworkIdentifier: otherNetwork, }, networkList: basicNetworkList, networkOptions: basicNetworkOptions, expectedError: ErrNetworkMissing, }, "invalid options": { networkRequest: &types.NetworkRequest{ NetworkIdentifier: basicNetwork, }, networkList: basicNetworkList, networkStatus: basicNetworkStatus, networkOptions: &types.NetworkOptionsResponse{ Allow: &types.Allow{ OperationStatuses: []*types.OperationStatus{ { Status: "OTHER", Successful: false, }, { Status: "OTHER", Successful: true, }, }, }, }, expectedError: asserter.ErrVersionIsNil, }, } for name, test := range tests { t.Run(name, func(t *testing.T) { var ( assert = assert.New(t) ctx = context.Background() ) ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { assert.Equal("POST", r.Method) w.Header().Set("Content-Type", "application/json; charset=UTF-8") w.WriteHeader(http.StatusOK) switch r.URL.RequestURI() { case "/network/list": fmt.Fprintln(w, types.PrettyPrintStruct(test.networkList)) case "/network/status": var networkRequest *types.NetworkRequest assert.NoError(json.NewDecoder(r.Body).Decode(&networkRequest)) assert.Equal(test.networkRequest, networkRequest) fmt.Fprintln(w, types.PrettyPrintStruct(test.networkStatus)) case "/network/options": var networkRequest *types.NetworkRequest assert.NoError(json.NewDecoder(r.Body).Decode(&networkRequest)) assert.Equal(test.networkRequest, networkRequest) fmt.Fprintln(w, types.PrettyPrintStruct(test.networkOptions)) } })) defer ts.Close() f := New( ts.URL, WithRetryElapsedTime(5*time.Second), ) networkIdentifier, networkStatus, err := f.InitializeAsserter(ctx, test.network, "") assert.Equal(test.expectedNetwork, networkIdentifier) assert.Equal(test.expectedStatus, networkStatus) assert.True(checkError(err, test.expectedError)) }) } }
explode_data.jsonl/24509
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1430 }
[ 2830, 3393, 9928, 5615, 261, 465, 1155, 353, 8840, 836, 8, 341, 2405, 7032, 284, 2415, 14032, 60, 1235, 341, 197, 9038, 2349, 286, 353, 9242, 30149, 8714, 198, 197, 9038, 2349, 1900, 353, 9242, 30149, 1900, 442, 1483, 369, 2176, 608, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestRemoveStoppedMachine(t *testing.T) { machine, err := stubMachine() if err != nil { t.Fatalf("Unable to build test machine manifest: %v", err) } cases := []struct { name string output *ec2.DescribeInstancesOutput err error }{ { name: "DescribeInstances with error", output: &ec2.DescribeInstancesOutput{}, // any non-nil error will do err: fmt.Errorf("error describing instances"), }, { name: "No instances to stop", output: &ec2.DescribeInstancesOutput{ Reservations: []*ec2.Reservation{ { Instances: []*ec2.Instance{}, }, }, }, }, { name: "One instance to stop", output: &ec2.DescribeInstancesOutput{ Reservations: []*ec2.Reservation{ { Instances: []*ec2.Instance{ stubInstance("ami-a9acbbd6", "i-02fcb933c5da7085c"), }, }, }, }, }, { name: "Two instances to stop", output: &ec2.DescribeInstancesOutput{ Reservations: []*ec2.Reservation{ { Instances: []*ec2.Instance{ stubInstance("ami-a9acbbd6", "i-02fcb933c5da7085c"), stubInstance("ami-a9acbbd7", "i-02fcb933c5da7085d"), }, }, }, }, }, } for _, tc := range cases { t.Run(tc.name, func(t *testing.T) { mockCtrl := gomock.NewController(t) mockAWSClient := mockaws.NewMockClient(mockCtrl) // Not here to check how many times all the mocked methods get called. // Rather to provide fake outputs to get through all possible execution paths. mockAWSClient.EXPECT().DescribeInstances(gomock.Any()).Return(tc.output, tc.err).AnyTimes() mockAWSClient.EXPECT().TerminateInstances(gomock.Any()).AnyTimes() removeStoppedMachine(machine, mockAWSClient) }) } }
explode_data.jsonl/18754
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 768 }
[ 2830, 3393, 13021, 59803, 21605, 1155, 353, 8840, 836, 8, 341, 2109, 3814, 11, 1848, 1669, 13633, 21605, 741, 743, 1848, 961, 2092, 341, 197, 3244, 30762, 445, 17075, 311, 1936, 1273, 5662, 14455, 25, 1018, 85, 497, 1848, 340, 197, 63...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestPubKeySecp256k1Address(t *testing.T) { for _, d := range secpDataTable { privB, _ := hex.DecodeString(d.priv) pubB, _ := hex.DecodeString(d.pub) addrBbz, _, _ := base58.CheckDecode(d.addr) addrB := crypto.Address(addrBbz) var priv secp256k1.PrivKey = secp256k1.PrivKey(privB) pubKey := priv.PubKey() pubT, _ := pubKey.(secp256k1.PubKey) pub := pubT addr := pubKey.Address() assert.Equal(t, pub, secp256k1.PubKey(pubB), "Expected pub keys to match") assert.Equal(t, addr, addrB, "Expected addresses to match") } }
explode_data.jsonl/49292
{ "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, 29162, 1592, 8430, 79, 17, 20, 21, 74, 16, 4286, 1155, 353, 8840, 836, 8, 341, 2023, 8358, 294, 1669, 2088, 511, 4672, 30355, 341, 197, 71170, 33, 11, 716, 1669, 12371, 56372, 703, 1500, 82571, 340, 197, 62529, 33, 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...
2
func TestBucketStore_e2e(t *testing.T) { objtesting.ForeachStore(t, func(t *testing.T, bkt objstore.Bucket) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() dir, err := ioutil.TempDir("", "test_bucketstore_e2e") testutil.Ok(t, err) defer func() { testutil.Ok(t, os.RemoveAll(dir)) }() s := prepareStoreWithTestBlocks(t, dir, bkt, false, 0, emptyRelabelConfig, allowAllFilterConf) if ok := t.Run("no index cache", func(t *testing.T) { s.cache.SwapWith(noopCache{}) testBucketStore_e2e(t, ctx, s) }); !ok { return } if ok := t.Run("with large, sufficient index cache", func(t *testing.T) { indexCache, err := storecache.NewInMemoryIndexCacheWithConfig(s.logger, nil, storecache.InMemoryIndexCacheConfig{ MaxItemSize: 1e5, MaxSize: 2e5, }) testutil.Ok(t, err) s.cache.SwapWith(indexCache) testBucketStore_e2e(t, ctx, s) }); !ok { return } t.Run("with small index cache", func(t *testing.T) { indexCache2, err := storecache.NewInMemoryIndexCacheWithConfig(s.logger, nil, storecache.InMemoryIndexCacheConfig{ MaxItemSize: 50, MaxSize: 100, }) testutil.Ok(t, err) s.cache.SwapWith(indexCache2) testBucketStore_e2e(t, ctx, s) }) }) }
explode_data.jsonl/18714
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 545 }
[ 2830, 3393, 36018, 6093, 2204, 17, 68, 1155, 353, 8840, 836, 8, 341, 22671, 8840, 991, 8539, 6093, 1155, 11, 2915, 1155, 353, 8840, 836, 11, 293, 5840, 2839, 4314, 1785, 11152, 8, 341, 197, 20985, 11, 9121, 1669, 2266, 26124, 9269, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestStakingResponse_ValidateMetadataByItself(t *testing.T) { type fields struct { MetadataBase metadataCommon.MetadataBase status string txReqID string } tests := []struct { name string fields fields want bool }{ { name: "Invalid Input", fields: fields{ MetadataBase: metadataCommon.MetadataBase{ Type: metadataCommon.Pdexv3AddOrderRequestMeta, }, }, want: false, }, { name: "Valid Input", fields: fields{ MetadataBase: metadataCommon.MetadataBase{ Type: metadataCommon.Pdexv3StakingResponseMeta, }, }, want: true, }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { response := &StakingResponse{ MetadataBase: tt.fields.MetadataBase, status: tt.fields.status, txReqID: tt.fields.txReqID, } if got := response.ValidateMetadataByItself(); got != tt.want { t.Errorf("StakingResponse.ValidateMetadataByItself() = %v, want %v", got, tt.want) } }) } }
explode_data.jsonl/80860
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 447 }
[ 2830, 3393, 623, 1765, 2582, 62, 17926, 14610, 1359, 2132, 721, 1155, 353, 8840, 836, 8, 341, 13158, 5043, 2036, 341, 197, 9209, 7603, 3978, 11160, 10839, 46475, 3978, 198, 197, 23847, 981, 914, 198, 197, 46237, 27234, 915, 414, 914, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestTransactionFetcherFailedRescheduling(t *testing.T) { // Create a channel to control when tx requests can fail proceed := make(chan struct{}) testTransactionFetcherParallel(t, txFetcherTest{ init: func() *TxFetcher { return NewTxFetcher( func(common.Hash) bool { return false }, nil, func(origin string, hashes []common.Hash) error { <-proceed return errors.New("peer disconnected") }, ) }, steps: []interface{}{ // Push an initial announcement through to the scheduled stage doTxNotify{peer: "A", hashes: []common.Hash{{0x01}, {0x02}}}, isWaiting(map[string][]common.Hash{ "A": {{0x01}, {0x02}}, }), isScheduled{tracking: nil, fetching: nil}, doWait{time: txArriveTimeout, step: true}, isWaiting(nil), isScheduled{ tracking: map[string][]common.Hash{ "A": {{0x01}, {0x02}}, }, fetching: map[string][]common.Hash{ "A": {{0x01}, {0x02}}, }, }, // While the original peer is stuck in the request, push in an second // data source. doTxNotify{peer: "B", hashes: []common.Hash{{0x02}}}, isWaiting(nil), isScheduled{ tracking: map[string][]common.Hash{ "A": {{0x01}, {0x02}}, "B": {{0x02}}, }, fetching: map[string][]common.Hash{ "A": {{0x01}, {0x02}}, }, }, // Wait until the original request fails and check that transactions // are either rescheduled or dropped doFunc(func() { proceed <- struct{}{} // Allow peer A to return the failure }), doWait{time: 0, step: true}, isWaiting(nil), isScheduled{ tracking: map[string][]common.Hash{ "B": {{0x02}}, }, fetching: map[string][]common.Hash{ "B": {{0x02}}, }, }, doFunc(func() { proceed <- struct{}{} // Allow peer B to return the failure }), doWait{time: 0, step: true}, isWaiting(nil), isScheduled{nil, nil, nil}, }, }) }
explode_data.jsonl/52212
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 850 }
[ 2830, 3393, 8070, 97492, 9408, 1061, 44356, 1155, 353, 8840, 836, 8, 341, 197, 322, 4230, 264, 5496, 311, 2524, 979, 9854, 7388, 646, 3690, 198, 197, 776, 4635, 1669, 1281, 35190, 2036, 6257, 692, 18185, 8070, 97492, 16547, 1155, 11, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestSortLetters(t *testing.T) { testCases := map[string]struct { input map[rune]int expectedArr []string }{ "2 letters singles [a:1, b:1]": {input: map[rune]int{'a': 1, 'b': 1}, expectedArr: []string{"a:1", "b:1"}, }, "2 letters multiples": {input: map[rune]int{'a': 7, 'b': 7}, expectedArr: []string{"a:7", "b:7"}, }, "1 letter, 1 empty": {input: map[rune]int{' ': 2, 'a': 1}, expectedArr: []string{" :2", "a:1"}, }, "1 letter": {input: map[rune]int{'A': 7}, expectedArr: []string{"A:7"}, }, "3 letters": {input: map[rune]int{'A': 1, 'B': 1, 'c': 2}, expectedArr: []string{"A:1", "B:1", "c:2"}, }, "3 random order": {input: map[rune]int{'B': 1, 'A': 1, 'c': 2}, expectedArr: []string{"A:1", "B:1", "c:2"}, }, } for name, test := range testCases { test := test t.Run(name, func(t *testing.T) { resultArr := sortLetters(test.input) assert.Equalf(t, test.expectedArr, resultArr, "Input does not match expected output.") }) } }
explode_data.jsonl/18206
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 481 }
[ 2830, 3393, 10231, 72537, 1155, 353, 8840, 836, 8, 341, 18185, 37302, 1669, 2415, 14032, 60, 1235, 341, 197, 22427, 981, 2415, 16131, 2886, 63025, 198, 197, 42400, 8838, 3056, 917, 198, 197, 59403, 197, 197, 1, 17, 11931, 17389, 508, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestRuntime_ExportToNumbers(t *testing.T) { vm := New() t.Run("int8/no overflow", func(t *testing.T) { var i8 int8 err := vm.ExportTo(vm.ToValue(-123), &i8) if err != nil { t.Fatal(err) } if i8 != -123 { t.Fatalf("i8: %d", i8) } }) t.Run("int8/overflow", func(t *testing.T) { var i8 int8 err := vm.ExportTo(vm.ToValue(333), &i8) if err != nil { t.Fatal(err) } if i8 != 77 { t.Fatalf("i8: %d", i8) } }) t.Run("int64/uint64", func(t *testing.T) { var ui64 uint64 err := vm.ExportTo(vm.ToValue(-1), &ui64) if err != nil { t.Fatal(err) } if ui64 != math.MaxUint64 { t.Fatalf("ui64: %d", ui64) } }) t.Run("int8/float", func(t *testing.T) { var i8 int8 err := vm.ExportTo(vm.ToValue(333.9234), &i8) if err != nil { t.Fatal(err) } if i8 != 77 { t.Fatalf("i8: %d", i8) } }) t.Run("int8/object", func(t *testing.T) { var i8 int8 err := vm.ExportTo(vm.NewObject(), &i8) if err != nil { t.Fatal(err) } if i8 != 0 { t.Fatalf("i8: %d", i8) } }) t.Run("int/object_cust_valueOf", func(t *testing.T) { var i int obj, err := vm.RunString(` ({ valueOf: function() { return 42; } }) `) if err != nil { t.Fatal(err) } err = vm.ExportTo(obj, &i) if err != nil { t.Fatal(err) } if i != 42 { t.Fatalf("i: %d", i) } }) t.Run("float32/no_trunc", func(t *testing.T) { var f float32 err := vm.ExportTo(vm.ToValue(1.234567), &f) if err != nil { t.Fatal(err) } if f != 1.234567 { t.Fatalf("f: %f", f) } }) t.Run("float32/trunc", func(t *testing.T) { var f float32 err := vm.ExportTo(vm.ToValue(1.234567890), &f) if err != nil { t.Fatal(err) } if f != float32(1.234567890) { t.Fatalf("f: %f", f) } }) t.Run("float64", func(t *testing.T) { var f float64 err := vm.ExportTo(vm.ToValue(1.234567), &f) if err != nil { t.Fatal(err) } if f != 1.234567 { t.Fatalf("f: %f", f) } }) t.Run("float32/object", func(t *testing.T) { var f float32 err := vm.ExportTo(vm.NewObject(), &f) if err != nil { t.Fatal(err) } if f == f { // expecting NaN t.Fatalf("f: %f", f) } }) t.Run("float64/object", func(t *testing.T) { var f float64 err := vm.ExportTo(vm.NewObject(), &f) if err != nil { t.Fatal(err) } if f == f { // expecting NaN t.Fatalf("f: %f", f) } }) }
explode_data.jsonl/10468
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1271 }
[ 2830, 3393, 15123, 62, 16894, 1249, 27237, 1155, 353, 8840, 836, 8, 341, 54879, 1669, 1532, 741, 3244, 16708, 445, 396, 23, 33100, 16484, 497, 2915, 1155, 353, 8840, 836, 8, 341, 197, 2405, 600, 23, 526, 23, 198, 197, 9859, 1669, 10...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestValidateActionReturnFails(t *testing.T) { tests := []*v1.ActionReturn{ {}, { Code: 301, Body: "Hello World", }, { Code: 200, Type: `application/"json"`, Body: "Hello World", }, } for _, test := range tests { allErrs := validateActionReturn(test, field.NewPath("return"), returnBodySpecialVariables, returnBodyVariables) if len(allErrs) == 0 { t.Errorf("validateActionReturn(%v) returned no errors for invalid input", test) } } }
explode_data.jsonl/65893
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 189 }
[ 2830, 3393, 17926, 2512, 5598, 37, 6209, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 29838, 85, 16, 11360, 5598, 515, 197, 197, 38837, 197, 197, 515, 298, 90774, 25, 220, 18, 15, 16, 345, 298, 197, 5444, 25, 330, 9707, 4337, 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...
3
func TestBTreeCmp(t *testing.T) { // NB: go_generics doesn't do well with anonymous types, so name this type. // Avoid the slice literal syntax, which GofmtSimplify mandates the use of // anonymous constructors with. type testCase struct { spanA, spanB roachpb.Span idA, idB uint64 exp int } var testCases []testCase testCases = append(testCases, testCase{ spanA: roachpb.Span{Key: roachpb.Key("a")}, spanB: roachpb.Span{Key: roachpb.Key("a")}, idA: 1, idB: 1, exp: 0, }, testCase{ spanA: roachpb.Span{Key: roachpb.Key("a")}, spanB: roachpb.Span{Key: roachpb.Key("a"), EndKey: roachpb.Key("b")}, idA: 1, idB: 1, exp: -1, }, testCase{ spanA: roachpb.Span{Key: roachpb.Key("a"), EndKey: roachpb.Key("c")}, spanB: roachpb.Span{Key: roachpb.Key("a"), EndKey: roachpb.Key("b")}, idA: 1, idB: 1, exp: 1, }, testCase{ spanA: roachpb.Span{Key: roachpb.Key("a"), EndKey: roachpb.Key("c")}, spanB: roachpb.Span{Key: roachpb.Key("a"), EndKey: roachpb.Key("c")}, idA: 1, idB: 1, exp: 0, }, testCase{ spanA: roachpb.Span{Key: roachpb.Key("a")}, spanB: roachpb.Span{Key: roachpb.Key("a")}, idA: 1, idB: 2, exp: -1, }, testCase{ spanA: roachpb.Span{Key: roachpb.Key("a")}, spanB: roachpb.Span{Key: roachpb.Key("a")}, idA: 2, idB: 1, exp: 1, }, testCase{ spanA: roachpb.Span{Key: roachpb.Key("b")}, spanB: roachpb.Span{Key: roachpb.Key("a"), EndKey: roachpb.Key("c")}, idA: 1, idB: 1, exp: 1, }, testCase{ spanA: roachpb.Span{Key: roachpb.Key("b"), EndKey: roachpb.Key("e")}, spanB: roachpb.Span{Key: roachpb.Key("c"), EndKey: roachpb.Key("d")}, idA: 1, idB: 1, exp: -1, }, ) for _, tc := range testCases { name := fmt.Sprintf("cmp(%s:%d,%s:%d)", tc.spanA, tc.idA, tc.spanB, tc.idB) t.Run(name, func(t *testing.T) { laA := newItem(tc.spanA) laA.SetID(tc.idA) laB := newItem(tc.spanB) laB.SetID(tc.idB) require.Equal(t, tc.exp, cmp(laA, laB)) }) } }
explode_data.jsonl/24883
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1134 }
[ 2830, 3393, 33, 6533, 34, 1307, 1155, 353, 8840, 836, 8, 341, 197, 322, 34979, 25, 728, 71963, 1211, 3171, 944, 653, 1632, 448, 22151, 4494, 11, 773, 829, 419, 943, 624, 197, 322, 34006, 279, 15983, 23141, 19482, 11, 892, 479, 1055,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestGetClusterIP(t *testing.T) { tests := map[string]struct { expectedOutput string Volume VolumeInfo }{ "Fetching ClusterIP from openebs.io/cluster-ips": { Volume: VolumeInfo{ Volume: v1alpha1.CASVolume{ ObjectMeta: metav1.ObjectMeta{ Annotations: map[string]string{ "openebs.io/cluster-ips": "192.168.100.1", }, }, }, }, expectedOutput: "192.168.100.1", }, "Fetching ClusterIP from vsm.openebs.io/cluster-ips": { Volume: VolumeInfo{ Volume: v1alpha1.CASVolume{ ObjectMeta: metav1.ObjectMeta{ Annotations: map[string]string{ "vsm.openebs.io/cluster-ips": "192.168.100.1", }, }, }, }, expectedOutput: "192.168.100.1", }, "Fetching ClusterIP when both keys are present": { Volume: VolumeInfo{ Volume: v1alpha1.CASVolume{ ObjectMeta: metav1.ObjectMeta{ Annotations: map[string]string{ "vsm.openebs.io/cluster-ips": "192.168.100.1", "openebs.io/cluster-ips": "192.168.100.2", }, }, }, }, expectedOutput: "192.168.100.2", }, "Fetching ClusterIP when both keys are not present": { Volume: VolumeInfo{ Volume: v1alpha1.CASVolume{ ObjectMeta: metav1.ObjectMeta{ Annotations: map[string]string{}, }, }, }, expectedOutput: "", }, } for name, tt := range tests { t.Run(name, func(t *testing.T) { got := tt.Volume.GetClusterIP() if got != tt.expectedOutput { t.Fatalf("Test: %v Expected: %v but got: %v", name, tt.expectedOutput, got) } }) } }
explode_data.jsonl/78046
{ "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, 1949, 28678, 3298, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 2415, 14032, 60, 1235, 341, 197, 42400, 5097, 914, 198, 197, 17446, 4661, 260, 20265, 1731, 198, 197, 59403, 197, 197, 1, 52416, 35380, 3298, 504, 1787, 68, 127...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestNotEmptyWrapper(t *testing.T) { assert := New(t) mockAssert := New(new(testing.T)) assert.False(mockAssert.NotEmpty(""), "Empty string is empty") assert.False(mockAssert.NotEmpty(nil), "Nil is empty") assert.False(mockAssert.NotEmpty([]string{}), "Empty string array is empty") assert.False(mockAssert.NotEmpty(0), "Zero int value is empty") assert.False(mockAssert.NotEmpty(false), "False value is empty") assert.True(mockAssert.NotEmpty("something"), "Non Empty string is not empty") assert.True(mockAssert.NotEmpty(errors.New("something")), "Non nil object is not empty") assert.True(mockAssert.NotEmpty([]string{"something"}), "Non empty string array is not empty") assert.True(mockAssert.NotEmpty(1), "Non-zero int value is not empty") assert.True(mockAssert.NotEmpty(true), "True value is not empty") }
explode_data.jsonl/54982
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 285 }
[ 2830, 3393, 27416, 11542, 1155, 353, 8840, 836, 8, 341, 6948, 1669, 1532, 1155, 340, 77333, 8534, 1669, 1532, 1755, 8623, 287, 836, 4390, 6948, 50757, 30389, 8534, 15000, 3522, 86076, 330, 3522, 914, 374, 4287, 1138, 6948, 50757, 30389, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestRunInContainer(t *testing.T) { testKubelet := newTestKubelet(t) kubelet := testKubelet.kubelet fakeRuntime := testKubelet.fakeRuntime fakeCommandRunner := fakeContainerCommandRunner{} kubelet.runner = &fakeCommandRunner containerID := kubecontainer.ContainerID{"test", "abc1234"} fakeRuntime.PodList = []*kubecontainer.Pod{ { ID: "12345678", Name: "podFoo", Namespace: "nsFoo", Containers: []*kubecontainer.Container{ {Name: "containerFoo", ID: containerID, }, }, }, } cmd := []string{"ls"} _, err := kubelet.RunInContainer("podFoo_nsFoo", "", "containerFoo", cmd) if fakeCommandRunner.ID != containerID { t.Errorf("unexpected Name: %s", fakeCommandRunner.ID) } if !reflect.DeepEqual(fakeCommandRunner.Cmd, cmd) { t.Errorf("unexpected command: %s", fakeCommandRunner.Cmd) } if err != nil { t.Errorf("unexpected error: %v", err) } }
explode_data.jsonl/43312
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 374 }
[ 2830, 3393, 6727, 641, 4502, 1155, 353, 8840, 836, 8, 341, 18185, 42, 3760, 1149, 1669, 501, 2271, 42, 3760, 1149, 1155, 340, 16463, 3760, 1149, 1669, 1273, 42, 3760, 1149, 5202, 3760, 1149, 198, 1166, 726, 15123, 1669, 1273, 42, 3760...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestStubEnv(t *testing.T) { os.Setenv("STUBBY_T1", "V1") os.Setenv("STUBBY_T2", "V2") os.Unsetenv("STUBBY_NONE") stubs := New() stubs.SetEnv("STUBBY_NONE", "a") stubs.SetEnv("STUBBY_T1", "1") stubs.SetEnv("STUBBY_T1", "2") stubs.SetEnv("STUBBY_T1", "3") stubs.SetEnv("STUBBY_T2", "4") stubs.UnsetEnv("STUBBY_T2") assert.Equal(t, "3", os.Getenv("STUBBY_T1"), "Wrong value for T1") assert.Equal(t, "", os.Getenv("STUBBY_T2"), "Wrong value for T2") assert.Equal(t, "a", os.Getenv("STUBBY_NONE"), "Wrong value for NONE") stubs.Reset() _, ok := os.LookupEnv("STUBBY_NONE") assert.False(t, ok, "NONE should be unset") assert.Equal(t, "V1", os.Getenv("STUBBY_T1"), "Wrong reset value for T1") assert.Equal(t, "V2", os.Getenv("STUBBY_T2"), "Wrong reset value for T2") }
explode_data.jsonl/69257
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 395 }
[ 2830, 3393, 33838, 14359, 1155, 353, 8840, 836, 8, 341, 25078, 4202, 3160, 445, 784, 4493, 19912, 1139, 16, 497, 330, 53, 16, 1138, 25078, 4202, 3160, 445, 784, 4493, 19912, 1139, 17, 497, 330, 53, 17, 1138, 25078, 10616, 746, 3160, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestGC_TrackDeletedTags_PostponeReviewOnConflict(t *testing.T) { require.NoError(t, testutil.TruncateAllTables(suite.db)) // create repo r := randomRepository(t) rs := datastore.NewRepositoryStore(suite.db) r, err := rs.CreateByPath(suite.ctx, r.Path) require.NoError(t, err) // create manifest ms := datastore.NewManifestStore(suite.db) m := randomManifest(t, r, nil) err = ms.Create(suite.ctx, m) require.NoError(t, err) // tag manifest ts := datastore.NewTagStore(suite.db) err = ts.CreateOrUpdate(suite.ctx, &models.Tag{ Name: "latest", NamespaceID: r.NamespaceID, RepositoryID: r.ID, ManifestID: m.ID, }) require.NoError(t, err) // grab existing review record (created by the gc_track_manifest_uploads trigger) mrs := datastore.NewGCManifestTaskStore(suite.db) rr, err := mrs.FindAll(suite.ctx) require.NoError(t, err) require.Equal(t, 1, len(rr)) // delete tag ok, err := rs.DeleteTagByName(suite.ctx, r, "latest") require.NoError(t, err) require.True(t, ok) // check that we still have only one review record but its due date was postponed to now (delete time) + 1 day rr2, err := mrs.FindAll(suite.ctx) require.NoError(t, err) require.Equal(t, 1, len(rr2)) require.Equal(t, rr[0].RepositoryID, rr2[0].RepositoryID) require.Equal(t, rr[0].ManifestID, rr2[0].ManifestID) require.Equal(t, 0, rr2[0].ReviewCount) // review_after is only a few milliseconds ahead of the original time require.True(t, rr2[0].ReviewAfter.After(rr[0].ReviewAfter)) require.WithinDuration(t, rr[0].ReviewAfter, rr2[0].ReviewAfter, 100*time.Millisecond) }
explode_data.jsonl/48579
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 647 }
[ 2830, 3393, 22863, 21038, 473, 26039, 15930, 66726, 80917, 19432, 1925, 57974, 1155, 353, 8840, 836, 8, 341, 17957, 35699, 1155, 11, 1273, 1314, 8240, 26900, 2403, 21670, 89516, 7076, 4390, 197, 322, 1855, 15867, 198, 7000, 1669, 4194, 46...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestGetRecord(t *testing.T) { dec := NewDecoder(unsafe.Pointer(&dummyRecord), len(dummyRecord)) if dec == nil { t.Fatal("dec is nil") } ret, timestamp, record := GetRecord(dec) if ret < 0 { t.Fatal("ret is negative") } // test timestamp ts, ok := timestamp.(FLBTime) if !ok { t.Fatalf("cast error. Type is %s", reflect.TypeOf(timestamp)) } if ts.Unix() != int64(0x5ea917e0) { t.Errorf("ts.Unix() error. given %d", ts.Unix()) } // test record v, ok := record["schema"].(int64) if !ok { t.Fatalf("cast error. Type is %s", reflect.TypeOf(record["schema"])) } if v != 1 { t.Errorf(`record["schema"] is not 1 %d`, v) } }
explode_data.jsonl/49330
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 280 }
[ 2830, 3393, 1949, 6471, 1155, 353, 8840, 836, 8, 341, 197, 8169, 1669, 1532, 20732, 7, 38157, 41275, 2099, 31390, 6471, 701, 2422, 83671, 6471, 1171, 743, 1622, 621, 2092, 341, 197, 3244, 26133, 445, 8169, 374, 2092, 1138, 197, 630, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
7
func TestCreatePipelineFailedToUpdatePipeline(t *testing.T) { tmp, _ := ioutil.TempDir("", "TestCreatePipelineFailedToUpdatePipeline") gaia.Cfg = new(gaia.Config) gaia.Cfg.HomePath = tmp buf := new(bytes.Buffer) gaia.Cfg.Logger = hclog.New(&hclog.LoggerOptions{ Level: hclog.Trace, Output: buf, Name: "Gaia", }) mcp := new(mockCreatePipelineStore) mcp.Error = errors.New("failed") services.MockStorageService(mcp) defer func() { services.MockStorageService(nil) }() cp := new(gaia.CreatePipeline) cp.Pipeline.Type = gaia.PTypeGolang cp.Pipeline.Repo = &gaia.GitRepo{URL: "https://github.com/gaia-pipeline/pipeline-test"} pipelineService := NewGaiaPipelineService(Dependencies{ Scheduler: &mockScheduleService{}, }) pipelineService.CreatePipeline(cp) body, _ := ioutil.ReadAll(buf) if !bytes.Contains(body, []byte("cannot put create pipeline into store: error=failed")) { t.Fatal("expected log message was not there. was: ", string(body)) } }
explode_data.jsonl/13141
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 397 }
[ 2830, 3393, 4021, 34656, 9408, 93919, 34656, 1155, 353, 8840, 836, 8, 341, 20082, 11, 716, 1669, 43144, 65009, 6184, 19814, 330, 2271, 4021, 34656, 9408, 93919, 34656, 1138, 3174, 64, 685, 727, 4817, 284, 501, 3268, 64, 685, 10753, 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 TestJS(t *testing.T) { matches, _ := filepath.Glob("test/*.js") for _, filename := range matches { fmt.Printf("Testing: %s", filename) failure := testOneJS(filename) if failure == "" { fmt.Println(" - pass") } else { fmt.Println(" - FAIL") t.Errorf(failure) return } } }
explode_data.jsonl/64548
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 134 }
[ 2830, 3393, 12545, 1155, 353, 8840, 836, 8, 341, 2109, 9118, 11, 716, 1669, 26054, 1224, 1684, 445, 1944, 23540, 2519, 1138, 2023, 8358, 3899, 1669, 2088, 9071, 341, 197, 11009, 19367, 445, 16451, 25, 1018, 82, 497, 3899, 340, 197, 11...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestApiTest_AddsQueryParamCollectionToRequest_HandlesEmpty(t *testing.T) { handler := http.NewServeMux() handler.HandleFunc("/hello", func(w http.ResponseWriter, r *http.Request) { if "e=f" != r.URL.RawQuery { w.WriteHeader(http.StatusBadRequest) return } w.WriteHeader(http.StatusOK) }) apitest.New(). Handler(handler). Get("/hello"). QueryCollection(map[string][]string{}). QueryParams(map[string]string{"e": "f"}). Expect(t). Status(http.StatusOK). End() }
explode_data.jsonl/54789
{ "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, 6563, 2271, 21346, 82, 84085, 6482, 1249, 1900, 2039, 20125, 3522, 1155, 353, 8840, 836, 8, 341, 53326, 1669, 1758, 7121, 60421, 44, 2200, 741, 53326, 63623, 4283, 14990, 497, 2915, 3622, 1758, 37508, 11, 435, 353, 1254, 965...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestMacServiceImpl_AddMac(t *testing.T) { a := assert.New(t) ctrl := gomock.NewController(t) defer ctrl.Finish() mockMr := database.NewMockMacRepository(ctrl) input := &model.Mac{} { // success ipi := NewMacServiceImpl(mockMr) if ipi == nil { t.FailNow() } mockMr.EXPECT().AddMac(input).Return(nil) err := ipi.Add(input) a.NoError(err) } { // failed ipi := NewMacServiceImpl(mockMr) if ipi == nil { t.FailNow() } mockMr.EXPECT().AddMac(input).Return(fmt.Errorf("error")) err := ipi.Add(input) a.Error(err) } }
explode_data.jsonl/55039
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 260 }
[ 2830, 3393, 19552, 50603, 21346, 19552, 1155, 353, 8840, 836, 8, 341, 11323, 1669, 2060, 7121, 1155, 340, 84381, 1669, 342, 316, 1176, 7121, 2051, 1155, 340, 16867, 23743, 991, 18176, 741, 77333, 12275, 1669, 4625, 7121, 11571, 19552, 462...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestReconciler_MarkDeploymentComplete(t *testing.T) { job := mock.Job() job.TaskGroups[0].Update = noCanaryUpdate d := structs.NewDeployment(job) d.TaskGroups[job.TaskGroups[0].Name] = &structs.DeploymentState{ Promoted: true, DesiredTotal: 10, PlacedAllocs: 10, HealthyAllocs: 10, } // Create allocations from the old job var allocs []*structs.Allocation for i := 0; i < 10; i++ { alloc := mock.Alloc() alloc.Job = job alloc.JobID = job.ID alloc.NodeID = uuid.Generate() alloc.Name = structs.AllocName(job.ID, job.TaskGroups[0].Name, uint(i)) alloc.TaskGroup = job.TaskGroups[0].Name alloc.DeploymentID = d.ID alloc.DeploymentStatus = &structs.AllocDeploymentStatus{ Healthy: helper.BoolToPtr(true), } allocs = append(allocs, alloc) } reconciler := NewAllocReconciler(testLogger(), allocUpdateFnIgnore, false, job.ID, job, d, allocs, nil) r := reconciler.Compute() updates := []*structs.DeploymentStatusUpdate{ { DeploymentID: d.ID, Status: structs.DeploymentStatusSuccessful, StatusDescription: structs.DeploymentStatusDescriptionSuccessful, }, } // Assert the correct results assertResults(t, r, &resultExpectation{ createDeployment: nil, deploymentUpdates: updates, place: 0, inplace: 0, stop: 0, desiredTGUpdates: map[string]*structs.DesiredUpdates{ job.TaskGroups[0].Name: { Ignore: 10, }, }, }) }
explode_data.jsonl/67274
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 625 }
[ 2830, 3393, 693, 40446, 5769, 1245, 838, 75286, 12548, 1155, 353, 8840, 836, 8, 341, 68577, 1669, 7860, 45293, 741, 68577, 28258, 22173, 58, 15, 936, 4289, 284, 902, 6713, 658, 4289, 271, 2698, 1669, 62845, 7121, 75286, 28329, 340, 2698...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestExecSetID(t *testing.T) { e := newTestExec() newID := "oaijnifo" e.SetID(newID) if e.StatementID != newID { t.Errorf("Expected: %v\nGot: %v\n", newID, e.StatementID) } }
explode_data.jsonl/64297
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 90 }
[ 2830, 3393, 10216, 1649, 915, 1155, 353, 8840, 836, 8, 341, 7727, 1669, 501, 2271, 10216, 741, 8638, 915, 1669, 330, 78, 2143, 93808, 31497, 698, 7727, 4202, 915, 1755, 915, 340, 743, 384, 70215, 915, 961, 501, 915, 341, 197, 3244, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestErrorListIgnoresNilErrors(t *testing.T) { errs := errors.L(nil, nil) errs.Append(nil) err := errs.AsError() if err != nil { t.Fatalf("got error %v but want nil", err) } }
explode_data.jsonl/82010
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 81 }
[ 2830, 3393, 1454, 852, 40, 70, 2152, 416, 19064, 13877, 1155, 353, 8840, 836, 8, 341, 9859, 82, 1669, 5975, 1214, 27907, 11, 2092, 340, 9859, 82, 8982, 27907, 340, 9859, 1669, 70817, 20242, 1454, 741, 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 ]
2
func TestDataTypePrecisionScale(t *testing.T) { tts := []struct { typ oid.Oid mod int precision, scale int64 ok bool }{ {oid.T_int4, -1, 0, 0, false}, {oid.T_numeric, 589830, 9, 2, true}, {oid.T_text, -1, 0, 0, false}, } for i, tt := range tts { dt := fieldDesc{OID: tt.typ, Mod: tt.mod} p, s, k := dt.PrecisionScale() if k != tt.ok { t.Errorf("(%d) got: %t want: %t", i, k, tt.ok) } if p != tt.precision { t.Errorf("(%d) wrong precision got: %d want: %d", i, p, tt.precision) } if s != tt.scale { t.Errorf("(%d) wrong scale got: %d want: %d", i, s, tt.scale) } } }
explode_data.jsonl/24656
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 357 }
[ 2830, 3393, 22653, 55501, 6947, 1155, 353, 8840, 836, 8, 341, 3244, 2576, 1669, 3056, 1235, 341, 197, 25314, 1060, 48766, 8382, 307, 198, 197, 42228, 1060, 526, 198, 197, 197, 27182, 11, 5452, 526, 21, 19, 198, 197, 59268, 2290, 1807,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestWriteHumanReadableNested(t *testing.T) { vrw := newTestValueStore() l := NewList(vrw, Number(0), Number(1)) l2 := NewList(vrw, Number(2), Number(3)) s := NewSet(vrw, String("a"), String("b")) s2 := NewSet(vrw, String("c"), String("d")) m := NewMap(vrw, s, l, s2, l2) assertWriteHRSEqual(t, `map { set { "c", "d", }: [ 2, 3, ], set { "a", "b", }: [ 0, 1, ], }`, m) }
explode_data.jsonl/60899
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 216 }
[ 2830, 3393, 7985, 33975, 57938, 71986, 1155, 353, 8840, 836, 8, 341, 5195, 31768, 1669, 501, 2271, 1130, 6093, 2822, 8810, 1669, 1532, 852, 3747, 31768, 11, 5624, 7, 15, 701, 5624, 7, 16, 1171, 8810, 17, 1669, 1532, 852, 3747, 31768, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestBrancher_Intersects(t *testing.T) { testCases := []struct { name string a, b Brancher result bool }{ { name: "TwodifferentBranches", a: Brancher{ Branches: []string{"a"}, }, b: Brancher{ Branches: []string{"b"}, }, }, { name: "Opposite", a: Brancher{ SkipBranches: []string{"b"}, }, b: Brancher{ Branches: []string{"b"}, }, }, { name: "BothRunOnAllBranches", a: Brancher{}, b: Brancher{}, result: true, }, { name: "RunsOnAllBranchesAndSpecified", a: Brancher{}, b: Brancher{ Branches: []string{"b"}, }, result: true, }, { name: "SkipBranchesAndSet", a: Brancher{ SkipBranches: []string{"a", "b", "c"}, }, b: Brancher{ Branches: []string{"a"}, }, }, { name: "SkipBranchesAndSet", a: Brancher{ Branches: []string{"c"}, }, b: Brancher{ Branches: []string{"a"}, }, }, { name: "BothSkipBranches", a: Brancher{ SkipBranches: []string{"a", "b", "c"}, }, b: Brancher{ SkipBranches: []string{"d", "e", "f"}, }, result: true, }, { name: "BothSkipCommonBranches", a: Brancher{ SkipBranches: []string{"a", "b", "c"}, }, b: Brancher{ SkipBranches: []string{"b", "e", "f"}, }, result: true, }, { name: "NoIntersectionBecauseRegexSkip", a: Brancher{ SkipBranches: []string{`release-\d+\.\d+`}, }, b: Brancher{ Branches: []string{`release-1.14`, `release-1.13`}, }, result: false, }, { name: "IntersectionDespiteRegexSkip", a: Brancher{ SkipBranches: []string{`release-\d+\.\d+`}, }, b: Brancher{ Branches: []string{`release-1.14`, `master`}, }, result: true, }, } for _, tc := range testCases { t.Run(tc.name, func(st *testing.T) { a, err := setBrancherRegexes(tc.a) if err != nil { st.Fatalf("Failed to set brancher A regexes: %v", err) } b, err := setBrancherRegexes(tc.b) if err != nil { st.Fatalf("Failed to set brancher B regexes: %v", err) } r1 := a.Intersects(b) r2 := b.Intersects(a) for _, result := range []bool{r1, r2} { if result != tc.result { st.Errorf("Expected %v got %v", tc.result, result) } } }) } }
explode_data.jsonl/8080
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1180 }
[ 2830, 3393, 18197, 261, 79717, 54429, 1155, 353, 8840, 836, 8, 341, 18185, 37302, 1669, 3056, 1235, 341, 197, 11609, 256, 914, 198, 197, 11323, 11, 293, 256, 25119, 261, 198, 197, 9559, 1807, 198, 197, 59403, 197, 197, 515, 298, 11609...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestUnmodifiedStatSucceeds(t *testing.T) { for _, alg := range hashAlgs { vfsObj, root, ctx, err := newVerityRoot(t, alg) if err != nil { t.Fatalf("newVerityRoot: %v", err) } filename := "verity-test-file" fd, _, err := newFileFD(ctx, t, vfsObj, root, filename, 0644) if err != nil { t.Fatalf("newFileFD: %v", err) } // Enable verity on the file and confirm that stat succeeds. enableVerity(ctx, t, fd) if _, err := fd.Stat(ctx, vfs.StatOptions{}); err != nil { t.Errorf("fd.Stat: %v", err) } } }
explode_data.jsonl/56765
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 239 }
[ 2830, 3393, 1806, 27162, 15878, 50, 29264, 82, 1155, 353, 8840, 836, 8, 341, 2023, 8358, 17345, 1669, 2088, 5175, 2101, 5857, 341, 197, 5195, 3848, 5261, 11, 3704, 11, 5635, 11, 1848, 1669, 501, 10141, 487, 8439, 1155, 11, 17345, 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...
5
func TestProjectID(t *testing.T) { createClientFn := func(pid string) createClientFunc { return func(cfg *config.Params) (*monitoring.MetricClient, error) { if cfg.ProjectId != pid { return nil, fmt.Errorf("wanted %v got %v", pid, cfg.ProjectId) } return nil, nil } } tests := []struct { name string cfg *config.Params pid func() (string, error) want string }{ { "empty project id", &config.Params{ ProjectId: "", }, func() (string, error) { return "pid", nil }, "pid", }, { "empty project id", &config.Params{ ProjectId: "pid", }, func() (string, error) { return "meta-pid", nil }, "pid", }, } for idx, tt := range tests { t.Run(fmt.Sprintf("[%d] %s", idx, tt.name), func(t *testing.T) { mg := helper.NewMetadataGenerator(dummyShouldFill, tt.pid, dummyMetadataFn, dummyMetadataFn) b := &builder{createClient: createClientFn(tt.want), mg: mg} b.SetAdapterConfig(tt.cfg) _, err := b.Build(context.Background(), test.NewEnv(t)) if err != nil { t.Errorf("Project id is not expected: %v", err) } }) } }
explode_data.jsonl/54751
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 489 }
[ 2830, 3393, 7849, 915, 1155, 353, 8840, 836, 8, 341, 39263, 2959, 24911, 1669, 2915, 37844, 914, 8, 1855, 2959, 9626, 341, 197, 853, 2915, 28272, 353, 1676, 58268, 8, 4609, 32225, 287, 1321, 16340, 2959, 11, 1465, 8, 341, 298, 743, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestNotDuplicatedExpression(t *testing.T) { data, err := ioutil.ReadFile("../cases/argumentsExpression.php") assert.NoError(t, err) document := NewDocument("test1", data) document.Load() cupaloy.SnapshotT(t, document.hasTypesSymbols()) }
explode_data.jsonl/587
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 90 }
[ 2830, 3393, 2623, 35, 98984, 9595, 1155, 353, 8840, 836, 8, 341, 8924, 11, 1848, 1669, 43144, 78976, 17409, 23910, 14, 16370, 9595, 2296, 1138, 6948, 35699, 1155, 11, 1848, 340, 17470, 1669, 1532, 7524, 445, 1944, 16, 497, 821, 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
func TestKeepaliveClientResponse(t *testing.T) { t.Parallel() // set up GRPCServer instance kap := comm.KeepaliveOptions{ ServerKeepaliveTime: 2, ServerKeepaliveTimeout: 1, } comm.SetKeepaliveOptions(kap) testAddress := "localhost:9401" srv, err := comm.NewGRPCServer(testAddress, comm.SecureServerConfig{}) assert.NoError(t, err, "Unexpected error starting GRPCServer") go srv.Start() defer srv.Stop() // test that connection does not close with response to ping clientTransport, err := transport.NewClientTransport(context.Background(), transport.TargetInfo{Addr: testAddress}, transport.ConnectOptions{}) assert.NoError(t, err, "Unexpected error creating client transport") defer clientTransport.Close() // sleep past keepalive timeout time.Sleep(4 * time.Second) // try to create a stream _, err = clientTransport.NewStream(context.Background(), &transport.CallHdr{}) assert.NoError(t, err, "Unexpected error creating stream") }
explode_data.jsonl/2134
{ "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, 19434, 50961, 2959, 2582, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 741, 197, 322, 738, 705, 14773, 4872, 5475, 2867, 198, 16463, 391, 1669, 1063, 13, 19434, 50961, 3798, 515, 197, 92075, 19434, 50961, 1462, 25, 262, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestIDPIDPInitiatedBadServiceProvider(t *testing.T) { test := NewIdentifyProviderTest(t) test.IDP.SessionProvider = &mockSessionProvider{ GetSessionFunc: func(w http.ResponseWriter, r *http.Request, req *IdpAuthnRequest) *Session { return &Session{ ID: "f00df00df00d", UserName: "alice", } }, } w := httptest.NewRecorder() r, _ := http.NewRequest("GET", "https://idp.example.com/services/sp/whoami", nil) test.IDP.ServeIDPInitiated(w, r, "https://wrong.url/metadata", "ThisIsTheRelayState") assert.Check(t, is.Equal(http.StatusNotFound, w.Code)) }
explode_data.jsonl/19835
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 240 }
[ 2830, 3393, 915, 33751, 47, 3803, 10029, 17082, 32604, 1155, 353, 8840, 836, 8, 341, 18185, 1669, 1532, 28301, 1437, 5179, 2271, 1155, 340, 18185, 9910, 47, 20674, 5179, 284, 609, 16712, 5283, 5179, 515, 197, 37654, 5283, 9626, 25, 2915...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1