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 TestRequestCtxWriteString(t *testing.T) {
var ctx RequestCtx
n, err := ctx.WriteString("foo")
if err != nil {
t.Fatalf("unexpected error: %s", err)
}
if n != 3 {
t.Fatalf("unexpected n %d. Expecting 3", n)
}
n, err = ctx.WriteString("привет")
if err != nil {
t.Fatalf("unexpected error: %s", err)
}
if n != 12 {
t.Fatalf("unexpected n=%d. Expecting 12", n)
}
s := ctx.Response.Body()
if string(s) != "fooпривет" {
t.Fatalf("unexpected response body %q. Expecting %q", s, "fooпривет")
}
} | explode_data.jsonl/73289 | {
"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,
1900,
23684,
7985,
703,
1155,
353,
8840,
836,
8,
341,
2405,
5635,
6145,
23684,
198,
9038,
11,
1848,
1669,
5635,
44747,
445,
7975,
1138,
743,
1848,
961,
2092,
341,
197,
3244,
30762,
445,
53859,
1465,
25,
1018,
82,
497,
1848... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 6 |
func TestKubeConfigCSubCommandsHasFlags(t *testing.T) {
subCmds := getKubeConfigSubCommands(nil, "", phaseTestK8sVersion)
commonFlags := []string{
"cert-dir",
"apiserver-advertise-address",
"apiserver-bind-port",
"kubeconfig-dir",
}
var tests = []struct {
command string
additionalFlags []string
}{
{
command: "all",
additionalFlags: []string{
"config",
"node-name",
},
},
{
command: "admin",
additionalFlags: []string{
"config",
},
},
{
command: "kubelet",
additionalFlags: []string{
"config",
"node-name",
},
},
{
command: "controller-manager",
additionalFlags: []string{
"config",
},
},
{
command: "scheduler",
additionalFlags: []string{
"config",
},
},
{
command: "user",
additionalFlags: []string{
"token",
"client-name",
},
},
}
for _, test := range tests {
expectedFlags := append(commonFlags, test.additionalFlags...)
cmdtestutil.AssertSubCommandHasFlags(t, subCmds, test.command, expectedFlags...)
}
} | explode_data.jsonl/9518 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 476
} | [
2830,
3393,
42,
3760,
2648,
34,
3136,
30479,
10281,
9195,
1155,
353,
8840,
836,
8,
1476,
28624,
15613,
82,
1669,
633,
42,
3760,
2648,
3136,
30479,
27907,
11,
7342,
10262,
2271,
42,
23,
82,
5637,
692,
83825,
9195,
1669,
3056,
917,
515,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
func TestCreateDaisyInflater_File_NotWindows(t *testing.T) {
source := fileSource{gcsPath: "gs://bucket/vmdk"}
inflater := createDaisyInflaterSafe(t, ImageImportRequest{
Source: source,
OS: "ubuntu-1804",
}, imagefile.Metadata{})
daisyutils.CheckWorkflow(inflater.worker, func(wf *daisy.Workflow, err error) {
inflatedDisk := getDisk(wf, 1)
assert.NotContains(t, inflatedDisk.GuestOsFeatures, &compute.GuestOsFeature{
Type: "WINDOWS",
})
})
} | explode_data.jsonl/75636 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 185
} | [
2830,
3393,
4021,
35,
49056,
12342,
34061,
60816,
13164,
1155,
353,
8840,
836,
8,
341,
47418,
1669,
1034,
3608,
90,
70,
4837,
1820,
25,
330,
5857,
1110,
30410,
5457,
2277,
74,
16707,
17430,
11729,
1669,
1855,
35,
49056,
12342,
25663,
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 Test_gap_in_body(t *testing.T) {
http := HttpModForTests()
data1 := []byte("HTTP/1.1 200 OK\r\n" +
"Date: Tue, 14 Aug 2012 22:31:45 GMT\r\n" +
"Expires: -1\r\n" +
"Cache-Control: private, max-age=0\r\n" +
"Content-Type: text/html; charset=UTF-8\r\n" +
"Content-Encoding: gzip\r\n" +
"Server: gws\r\n" +
"Content-Length: 40\r\n" +
"X-XSS-Protection: 1; mode=block\r\n" +
"X-Frame-Options: SAMEORIGIN\r\n" +
"\r\n" +
"xxxxxxxxxxxxxxxxxxxx")
stream := &HttpStream{data: data1, message: new(HttpMessage)}
ok, complete := http.messageParser(stream)
assert.Equal(t, true, ok)
assert.Equal(t, false, complete)
ok, complete = http.messageGap(stream, 10)
assert.Equal(t, true, ok)
assert.Equal(t, false, complete)
ok, complete = http.messageGap(stream, 10)
assert.Equal(t, true, ok)
assert.Equal(t, true, complete)
} | explode_data.jsonl/6849 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 384
} | [
2830,
3393,
51790,
1243,
14114,
1155,
353,
8840,
836,
8,
1476,
28080,
1669,
4823,
4459,
2461,
18200,
2822,
8924,
16,
1669,
3056,
3782,
445,
9230,
14,
16,
13,
16,
220,
17,
15,
15,
10402,
12016,
1699,
1,
3610,
197,
197,
1,
1916,
25,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestRGB_Printf(t *testing.T) {
RGBs := []RGB{{0, 0, 0}, {127, 127, 127}, {255, 255, 255}}
for _, rgb := range RGBs {
t.Run("", func(t *testing.T) {
internal.TestPrintfContains(t, func(w io.Writer, format string, a interface{}) {
p := rgb.Printf(format, a)
assert.NotNil(t, p)
})
})
}
} | explode_data.jsonl/62948 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 144
} | [
2830,
3393,
18184,
87257,
1155,
353,
8840,
836,
8,
341,
11143,
5381,
82,
1669,
3056,
18184,
2979,
15,
11,
220,
15,
11,
220,
15,
2137,
314,
16,
17,
22,
11,
220,
16,
17,
22,
11,
220,
16,
17,
22,
2137,
314,
17,
20,
20,
11,
220,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestObjectVersions(t *testing.T) {
create := func(ts *testServer, bucket, key string, contents []byte, version string) {
ts.Helper()
svc := ts.s3Client()
out, err := svc.PutObject(&s3.PutObjectInput{
Bucket: aws.String(bucket),
Key: aws.String(key),
Body: bytes.NewReader(contents),
})
ts.OK(err)
if aws.StringValue(out.VersionId) != version {
t.Fatal("version ID mismatch. found:", aws.StringValue(out.VersionId), "expected:", version)
}
}
get := func(ts *testServer, bucket, key string, contents []byte, version string) {
ts.Helper()
svc := ts.s3Client()
input := &s3.GetObjectInput{
Bucket: aws.String(bucket),
Key: aws.String(key),
}
if version != "" {
input.VersionId = aws.String(version)
}
out, err := svc.GetObject(input)
ts.OK(err)
defer out.Body.Close()
bts, err := ioutil.ReadAll(out.Body)
ts.OK(err)
if !bytes.Equal(bts, contents) {
ts.Fatal("body mismatch. found:", string(bts), "expected:", string(contents))
}
}
deleteVersion := func(ts *testServer, bucket, key, version string) {
ts.Helper()
svc := ts.s3Client()
input := &s3.DeleteObjectInput{
Bucket: aws.String(bucket),
Key: aws.String(key),
}
if version != "" {
input.VersionId = aws.String(version)
}
ts.OKAll(svc.DeleteObject(input))
}
deleteDirect := func(ts *testServer, bucket, key, version string) {
ts.Helper()
svc := ts.s3Client()
input := &s3.DeleteObjectInput{
Bucket: aws.String(bucket),
Key: aws.String(key),
}
out, err := svc.DeleteObject(input)
ts.OK(err)
if aws.StringValue(out.VersionId) != version {
t.Fatal("version ID mismatch. found:", aws.StringValue(out.VersionId), "expected:", version)
}
}
list := func(ts *testServer, bucket string, versions ...string) {
ts.Helper()
svc := ts.s3Client()
out, err := svc.ListObjectVersions(&s3.ListObjectVersionsInput{Bucket: aws.String(bucket)})
ts.OK(err)
var found []string
for _, ver := range out.Versions {
found = append(found, aws.StringValue(ver.VersionId))
}
for _, ver := range out.DeleteMarkers {
found = append(found, aws.StringValue(ver.VersionId))
}
// Unfortunately, the S3 client API destroys the order of Versions and
// DeleteMarkers, which are sibling elements in the XML body but separated
// into different lists by the client:
sort.Strings(found)
sort.Strings(versions)
if !reflect.DeepEqual(found, versions) {
ts.Fatal("versions mismatch. found:", found, "expected:", versions)
}
}
// XXX: version IDs are brittle; we control the seed, but the format may
// change at any time.
const v1 = "3/60O30C1G60O30C1G60O30C1G60O30C1G60O30C1G60O30C1H03F9QN5V72K21OG="
const v2 = "3/60O30C1G60O30C1G60O30C1G60O30C1G60O30C1G60O30C1I00G5II3TDAF7GRG="
const v3 = "3/60O30C1G60O30C1G60O30C1G60O30C1G60O30C1G60O30C1J01VFV0CD31ES81G="
t.Run("put-list-delete-versions", func(t *testing.T) {
ts := newTestServer(t, withVersioning())
defer ts.Close()
create(ts, defaultBucket, "object", []byte("body 1"), v1)
get(ts, defaultBucket, "object", []byte("body 1"), "")
list(ts, defaultBucket, v1)
create(ts, defaultBucket, "object", []byte("body 2"), v2)
get(ts, defaultBucket, "object", []byte("body 2"), "")
list(ts, defaultBucket, v1, v2)
create(ts, defaultBucket, "object", []byte("body 3"), v3)
get(ts, defaultBucket, "object", []byte("body 3"), "")
list(ts, defaultBucket, v1, v2, v3)
get(ts, defaultBucket, "object", []byte("body 1"), v1)
get(ts, defaultBucket, "object", []byte("body 2"), v2)
get(ts, defaultBucket, "object", []byte("body 3"), v3)
get(ts, defaultBucket, "object", []byte("body 3"), "")
deleteVersion(ts, defaultBucket, "object", v1)
list(ts, defaultBucket, v2, v3)
deleteVersion(ts, defaultBucket, "object", v2)
list(ts, defaultBucket, v3)
deleteVersion(ts, defaultBucket, "object", v3)
list(ts, defaultBucket)
})
t.Run("delete-direct", func(t *testing.T) {
ts := newTestServer(t, withVersioning())
defer ts.Close()
create(ts, defaultBucket, "object", []byte("body 1"), v1)
list(ts, defaultBucket, v1)
create(ts, defaultBucket, "object", []byte("body 2"), v2)
list(ts, defaultBucket, v1, v2)
get(ts, defaultBucket, "object", []byte("body 2"), "")
deleteDirect(ts, defaultBucket, "object", v3)
list(ts, defaultBucket, v1, v2, v3)
svc := ts.s3Client()
_, err := svc.GetObject(&s3.GetObjectInput{
Bucket: aws.String(defaultBucket),
Key: aws.String("object"),
})
if !hasErrorCode(err, gofakes3.ErrNoSuchKey) {
ts.Fatal("expected ErrNoSuchKey, found", err)
}
})
t.Run("list-never-versioned", func(t *testing.T) {
ts := newTestServer(t, withVersioning())
defer ts.Close()
const neverVerBucket = "neverver"
ts.backendCreateBucket(neverVerBucket)
ts.backendPutString(neverVerBucket, "object", nil, "body 1")
list(ts, neverVerBucket, "null") // S300005
})
} | explode_data.jsonl/22267 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 2050
} | [
2830,
3393,
1190,
69015,
1155,
353,
8840,
836,
8,
341,
39263,
1669,
2915,
35864,
353,
1944,
5475,
11,
15621,
11,
1376,
914,
11,
8794,
3056,
3782,
11,
2319,
914,
8,
341,
197,
57441,
69282,
741,
197,
1903,
7362,
1669,
10591,
514,
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... | 2 |
func TestEquality(t *testing.T) {
if js.Global.Get("Array") != js.Global.Get("Array") || js.Global.Get("Array") == js.Global.Get("String") {
t.Fail()
}
type S struct{ *js.Object }
o1 := js.Global.Get("Object").New()
o2 := js.Global.Get("Object").New()
a := S{o1}
b := S{o1}
c := S{o2}
if a != b || a == c {
t.Fail()
}
} | explode_data.jsonl/56790 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 152
} | [
2830,
3393,
50745,
1155,
353,
8840,
836,
8,
341,
743,
6994,
27381,
2234,
445,
1857,
899,
961,
6994,
27381,
2234,
445,
1857,
899,
1369,
6994,
27381,
2234,
445,
1857,
899,
621,
6994,
27381,
2234,
445,
703,
899,
341,
197,
3244,
57243,
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... | 5 |
func TestPeriodicalExecutor_QuitGoroutine(t *testing.T) {
ticker := timex.NewFakeTicker()
exec := NewPeriodicalExecutor(time.Millisecond, newContainer(time.Millisecond, nil))
exec.newTicker = func(d time.Duration) timex.Ticker {
return ticker
}
routines := runtime.NumGoroutine()
exec.Add(1)
ticker.Tick()
ticker.Wait(time.Millisecond * idleRound * 2)
ticker.Tick()
ticker.Wait(time.Millisecond * idleRound)
assert.Equal(t, routines, runtime.NumGoroutine())
} | explode_data.jsonl/57498 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 183
} | [
2830,
3393,
23750,
938,
25255,
62,
42856,
38,
269,
14159,
1155,
353,
8840,
836,
8,
341,
3244,
5215,
1669,
6792,
327,
7121,
52317,
87278,
741,
67328,
1669,
1532,
23750,
938,
25255,
9730,
71482,
11,
501,
4502,
9730,
71482,
11,
2092,
1171,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestValidation(t *testing.T) {
cases := []struct {
input string
searchType SearchType // nil value is regexp
want string
}{
{
input: "index:foo",
want: `invalid value "foo" for field "index". Valid values are: yes, only, no`,
},
{
input: "case:yes case:no",
want: `field "case" may not be used more than once`,
},
{
input: "repo:[",
want: "error parsing regexp: missing closing ]: `[`",
},
{
input: "-index:yes",
want: `field "index" does not support negation`,
},
{
input: "lang:c lang:go lang:stephenhas9cats",
want: `unknown language: "stephenhas9cats"`,
},
{
input: "count:sedonuts",
want: "field count has value sedonuts, sedonuts is not a number",
},
{
input: "count:10000000000000000",
want: "field count has a value that is out of range, try making it smaller",
},
{
input: "count:-1",
want: "field count requires a positive number",
},
{
input: "+",
want: "error parsing regexp: missing argument to repetition operator: `+`",
},
{
input: `\\\`,
want: "error parsing regexp: trailing backslash at end of expression: ``",
},
{
input: `-content:"foo"`,
want: "the query contains a negated search pattern. Structural search does not support negated search patterns at the moment",
searchType: SearchTypeStructural,
},
{
input: `NOT foo`,
want: "the query contains a negated search pattern. Structural search does not support negated search patterns at the moment",
searchType: SearchTypeStructural,
},
{
input: "repo:foo rev:a rev:b",
want: `field "rev" may not be used more than once`,
},
{
input: "repo:foo@a rev:b",
want: "invalid syntax. You specified both @ and rev: for a repo: filter and I don't know how to interpret this. Remove either @ or rev: and try again",
},
{
input: "rev:this is a good channel",
want: "invalid syntax. The query contains `rev:` without `repo:`. Add a `repo:` filter and try again",
},
{
input: `repo:'' rev:bedge`,
want: "invalid syntax. The query contains `rev:` without `repo:`. Add a `repo:` filter and try again",
},
{
input: "repo:foo author:rob@saucegraph.com",
want: `your query contains the field 'author', which requires type:commit or type:diff in the query`,
},
{
input: "repohasfile:README type:symbol yolo",
want: "repohasfile is not compatible for type:symbol. Subscribe to https://github.com/sourcegraph/sourcegraph/issues/4610 for updates",
},
{
input: "foo context:a context:b",
want: `field "context" may not be used more than once`,
},
{
input: "-context:a",
want: `field "context" does not support negation`,
},
{
input: "type:symbol select:symbol.timelime",
want: `invalid field "timelime" on select path "symbol.timelime"`,
},
{
input: "nice try type:repo",
want: "this structural search query specifies `type:` and is not supported. Structural search syntax only applies to searching file contents",
searchType: SearchTypeStructural,
},
{
input: "type:diff nice try",
want: "this structural search query specifies `type:` and is not supported. Structural search syntax only applies to searching file contents and is not currently supported for diff searches",
searchType: SearchTypeStructural,
},
}
for _, c := range cases {
t.Run("validate and/or query", func(t *testing.T) {
_, err := Pipeline(Init(c.input, c.searchType))
if err == nil {
t.Fatal(fmt.Sprintf("expected test for %s to fail", c.input))
}
if diff := cmp.Diff(c.want, err.Error()); diff != "" {
t.Fatal(diff)
}
})
}
} | explode_data.jsonl/58370 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 1432
} | [
2830,
3393,
13799,
1155,
353,
8840,
836,
8,
341,
1444,
2264,
1669,
3056,
1235,
341,
197,
22427,
414,
914,
198,
197,
45573,
929,
7542,
929,
442,
2092,
897,
374,
41877,
198,
197,
50780,
981,
914,
198,
197,
59403,
197,
197,
515,
298,
2... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
func TestApiTest_MatchesJSONResponseBodyWithFormatter(t *testing.T) {
handler := http.NewServeMux()
handler.HandleFunc("/hello", func(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(http.StatusCreated)
w.Header().Set("Content-Type", "application/json")
_, err := w.Write([]byte(`{"a": 12345}`))
if err != nil {
panic(err)
}
})
apitest.New().
Handler(handler).
Get("/hello").
Expect(t).
Bodyf(`{"a": %d}`, 12345).
Status(http.StatusCreated).
End()
} | explode_data.jsonl/54798 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 202
} | [
2830,
3393,
6563,
2271,
1245,
9118,
5370,
29637,
2354,
14183,
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,
9659,
8,
341,
197,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
func TestFinishError(t *testing.T) {
var b Builder
want := ErrNotStarted
if _, got := b.Finish(); got != want {
t.Errorf("got Builder{}.Finish() = %v, want = %v", got, want)
}
} | explode_data.jsonl/60561 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 72
} | [
2830,
3393,
25664,
1454,
1155,
353,
8840,
836,
8,
341,
2405,
293,
20626,
198,
50780,
1669,
15495,
2623,
32527,
198,
743,
8358,
2684,
1669,
293,
991,
18176,
2129,
2684,
961,
1366,
341,
197,
3244,
13080,
445,
22390,
20626,
46391,
25664,
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
] | 2 |
func TestAPIListUsersNonAdmin(t *testing.T) {
defer prepareTestEnv(t)()
nonAdminUsername := "user2"
session := loginUser(t, nonAdminUsername)
token := getTokenForLoggedInUser(t, session)
req := NewRequestf(t, "GET", "/api/v1/admin/users?token=%s", token)
session.MakeRequest(t, req, http.StatusForbidden)
} | explode_data.jsonl/71784 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 118
} | [
2830,
3393,
7082,
852,
7137,
8121,
7210,
1155,
353,
8840,
836,
8,
341,
16867,
10549,
2271,
14359,
1155,
8,
741,
197,
6280,
7210,
11115,
1669,
330,
872,
17,
698,
25054,
1669,
87169,
1155,
11,
2477,
7210,
11115,
340,
43947,
1669,
54111,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestProposalWithTxID(t *testing.T) {
//从chaincodeinvocationspec创建建议
prop, txid, err := utils.CreateChaincodeProposalWithTxIDAndTransient(
common.HeaderType_ENDORSER_TRANSACTION,
util.GetTestChainID(),
createCIS(),
[]byte("creator"),
"testtx",
map[string][]byte{"certx": []byte("transient")},
)
assert.Nil(t, err)
assert.NotNil(t, prop)
assert.Equal(t, txid, "testtx")
prop, txid, err = utils.CreateChaincodeProposalWithTxIDAndTransient(
common.HeaderType_ENDORSER_TRANSACTION,
util.GetTestChainID(),
createCIS(),
[]byte("creator"),
"",
map[string][]byte{"certx": []byte("transient")},
)
assert.Nil(t, err)
assert.NotNil(t, prop)
assert.NotEmpty(t, txid)
} | explode_data.jsonl/39990 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 299
} | [
2830,
3393,
98637,
2354,
31584,
915,
1155,
353,
8840,
836,
8,
341,
322,
45181,
8819,
1851,
14057,
55199,
992,
50377,
101898,
198,
79244,
11,
9854,
307,
11,
1848,
1669,
12439,
7251,
18837,
1851,
98637,
2354,
31584,
915,
3036,
48183,
1006,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestDelete(t *testing.T) {
if testing.Short() {
t.SkipNow()
}
t.Parallel()
// Create TurtleDexFileSet with TurtleDexFile
entry := newTestFile()
// Delete file.
if err := entry.Delete(); err != nil {
t.Fatal("Failed to delete file", err)
}
// Check if file was deleted and if deleted flag was set.
if !entry.Deleted() {
t.Fatal("Deleted flag was not set correctly")
}
if _, err := os.Open(entry.siaFilePath); !os.IsNotExist(err) {
t.Fatal("Expected a file doesn't exist error but got", err)
}
} | explode_data.jsonl/14691 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 194
} | [
2830,
3393,
6435,
1155,
353,
8840,
836,
8,
341,
743,
7497,
55958,
368,
341,
197,
3244,
57776,
7039,
741,
197,
532,
3244,
41288,
7957,
2822,
197,
322,
4230,
66806,
35,
327,
1703,
1649,
448,
66806,
35,
327,
1703,
198,
48344,
1669,
501,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestSubConjDistributiveInt64(t *testing.T) {
f := func(x, y *Int64) bool {
// t.Logf("x = %v, y = %v", x, y)
l, r := new(Int64), new(Int64)
l.Sub(x, y)
l.Conj(l)
r.Sub(r.Conj(x), new(Int64).Conj(y))
return l.Equals(r)
}
if err := quick.Check(f, nil); err != nil {
t.Error(err)
}
} | explode_data.jsonl/29674 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 163
} | [
2830,
3393,
3136,
1109,
73,
35,
4789,
6704,
1072,
21,
19,
1155,
353,
8840,
836,
8,
341,
1166,
1669,
2915,
2075,
11,
379,
353,
1072,
21,
19,
8,
1807,
341,
197,
197,
322,
259,
98954,
445,
87,
284,
1018,
85,
11,
379,
284,
1018,
85,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestProductCatalogService(t *testing.T) {
// Connecting
//url := "127.0.0.1:3550"
url := "productcatalogservice:3550"
conn := connect(t, url)
defer conn.Close()
// Creating context
ctx, cn := context.WithTimeout(context.Background(), timeout)
defer cn()
// Creating the stub
client := hipstershop.NewProductCatalogServiceClient(conn)
// ListProducts
t.Run("ListProducts", func(t *testing.T) {
})
products, err := client.ListProducts(ctx, &hipstershop.Empty{})
if err != nil {
t.Fatalf("error retrieving product list - %v", err)
}
t.Logf("%d products found", len(products.Products))
// GetProduct
t.Run("GetProduct", func(t *testing.T) {
for _, product := range products.Products {
t.Logf("%-10s %-30s %s $%10d.%02.0f\n", product.Id, product.Name, product.PriceUsd.CurrencyCode, product.PriceUsd.Units, float32(product.PriceUsd.Nanos/10000000))
pId, err := client.GetProduct(ctx, &hipstershop.GetProductRequest{Id: product.Id})
if err != nil {
t.Fatalf("error retrieving product by id - %s", err)
}
t.Logf("%-10s %-30s %s", pId.Id, pId.Name, pId.Description)
}
})
// SearchProducts
t.Run("SearchProducts", func(t *testing.T) {
for _, product := range products.Products {
res, err := client.SearchProducts(ctx, &hipstershop.SearchProductsRequest{Query: product.Name[0:3]})
if err != nil {
t.Fatalf("error searching products - %s", err)
}
t.Logf("%d products found using [%s]", len(res.Results), product.Name[0:3])
}
})
} | explode_data.jsonl/43998 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 573
} | [
2830,
3393,
4816,
41606,
1860,
1155,
353,
8840,
836,
8,
341,
197,
322,
83938,
198,
197,
322,
1085,
1669,
330,
16,
17,
22,
13,
15,
13,
15,
13,
16,
25,
18,
20,
20,
15,
698,
19320,
1669,
330,
3031,
26539,
7936,
25,
18,
20,
20,
15... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestList_PopBacks(t *testing.T) {
gtest.C(t, func(t *gtest.T) {
l := New()
a1 := []interface{}{1, 2, 3, 4}
a2 := []interface{}{"a", "c", "b", "e"}
l.PushFronts(a1)
i1 := l.PopBacks(2)
t.Assert(i1, []interface{}{1, 2})
l.PushBacks(a2) //4.3,a,c,b,e
i1 = l.PopBacks(3)
t.Assert(i1, []interface{}{"e", "b", "c"})
})
} | explode_data.jsonl/30899 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 194
} | [
2830,
3393,
852,
1088,
453,
3707,
82,
1155,
353,
8840,
836,
8,
341,
3174,
1944,
727,
1155,
11,
2915,
1155,
353,
82038,
836,
8,
341,
197,
8810,
1669,
1532,
741,
197,
11323,
16,
1669,
3056,
4970,
6257,
90,
16,
11,
220,
17,
11,
220,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestCreateSecretHandler(t *testing.T) {
type testConfig struct {
requestBody string
requestAction string
expectedHTTPStatusCode int
expectedBody string
}
testCases := []testConfig{
testConfig{
requestBody: "{\"plain_text\": \"test secret\"}",
requestAction: "POST",
expectedHTTPStatusCode: 200,
expectedBody: fmt.Sprintf("{\"id\":\"%s\"}", fmt.Sprintf("%x", md5.Sum([]byte("test secret")))),
},
testConfig{
requestBody: fmt.Sprintf("%x", md5.Sum([]byte("test secret"))),
requestAction: "GET",
expectedHTTPStatusCode: 200,
expectedBody: "{\"data\":\"test secret\"}",
},
testConfig{
requestBody: "{\"sometext\": \"test secret\"}",
requestAction: "POST",
expectedHTTPStatusCode: 400,
expectedBody: http.StatusText(http.StatusBadRequest),
},
testConfig{
requestBody: "{\"plaintext\": \"test secret\"",
requestAction: "POST",
expectedHTTPStatusCode: 400,
expectedBody: http.StatusText(http.StatusBadRequest),
},
testConfig{
requestBody: "",
requestAction: "POST",
expectedHTTPStatusCode: 400,
expectedBody: "No secret provided\n",
},
}
for _, tc := range testCases {
var writer *httptest.ResponseRecorder
writer = httptest.NewRecorder()
var request *http.Request
if tc.requestAction == "GET" {
request, _ = http.NewRequest("GET", "/"+tc.requestBody, strings.NewReader(""))
} else {
request, _ = http.NewRequest("POST", "/", strings.NewReader(tc.requestBody))
}
mux.ServeHTTP(writer, request)
if writer.Code != tc.expectedHTTPStatusCode {
t.Errorf("Response code is %v", writer.Code)
}
resp := string(writer.Body.Bytes())
if resp != tc.expectedBody {
t.Errorf("Response body is %s", resp)
}
}
} | explode_data.jsonl/70065 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 826
} | [
2830,
3393,
4021,
19773,
3050,
1155,
353,
8840,
836,
8,
1476,
13158,
1273,
2648,
2036,
341,
197,
23555,
5444,
310,
914,
198,
197,
23555,
2512,
688,
914,
198,
197,
42400,
9230,
15872,
526,
198,
197,
42400,
5444,
1843,
914,
198,
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... | 5 |
func Test_CLG_Input_UnknownInputSequence(t *testing.T) {
newCLG := MustNew()
newCtx := context.MustNew()
newServiceCollection := testMustNewServiceCollection(t)
newStorageCollection := testMustNewStorageCollection(t)
// Note we do not create a record for the test input. This test is about an
// unknown input sequence.
newInput := "test input"
// Set prepared storage to CLG we want to test.
newCLG.(*clg).ServiceCollection = newServiceCollection
newCLG.(*clg).StorageCollection = newStorageCollection
// Execute CLG.
err := newCLG.(*clg).calculate(newCtx, newInput)
if err != nil {
t.Fatal("expected", nil, "got", err)
}
// Check if the information ID was set to the context.
injectedInformationID, _ := newCtx.GetInformationID()
if injectedInformationID != "new-ID" {
t.Fatal("expected", true, "got", false)
}
} | explode_data.jsonl/52850 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 276
} | [
2830,
3393,
6843,
38,
48653,
62,
13790,
2505,
14076,
1155,
353,
8840,
836,
8,
341,
8638,
3140,
38,
1669,
15465,
3564,
741,
8638,
23684,
1669,
2266,
50463,
3564,
741,
8638,
1860,
6482,
1669,
1273,
31776,
3564,
1860,
6482,
1155,
340,
8638... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestFormattedProvider_SetStoreConfig(t *testing.T) {
t.Run("Fail to format tag names", func(t *testing.T) {
provider := formattedstore.NewProvider(mem.NewProvider(),
&mockFormatter{errFormat: errors.New("tags formatting failure"), useDeterministicKeyFormatting: true})
require.NotNil(t, provider)
store, err := provider.OpenStore("StoreName")
require.NoError(t, err)
require.NotNil(t, store)
err = provider.SetStoreConfig("StoreName", spi.StoreConfiguration{TagNames: []string{"TagName1"}})
require.EqualError(t, err, "failed to format tag names: tags formatting failure")
})
t.Run("Fail to store config in store config store", func(t *testing.T) {
provider := formattedstore.NewProvider(
&mock.Provider{OpenStoreReturn: &mock.Store{ErrPut: errors.New("put failure")}},
&exampleformatters.NoOpFormatter{})
require.NotNil(t, provider)
store, err := provider.OpenStore("StoreName")
require.NoError(t, err)
require.NotNil(t, store)
err = provider.SetStoreConfig("StoreName", spi.StoreConfiguration{TagNames: []string{"TagName1"}})
require.EqualError(t, err, "failed to store store configuration: "+
"failed to store config bytes in the store config store: failed to format and put data: "+
"failed to put formatted data in underlying store: put failure")
})
} | explode_data.jsonl/28236 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 434
} | [
2830,
3393,
43500,
5179,
14812,
6093,
2648,
1155,
353,
8840,
836,
8,
341,
3244,
16708,
445,
19524,
311,
3561,
4772,
5036,
497,
2915,
1155,
353,
8840,
836,
8,
341,
197,
197,
19979,
1669,
23126,
4314,
7121,
5179,
39908,
7121,
5179,
3148,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestRouter_Load_RegisterRoutes(t *testing.T) {
AddHandler(testHandlerFunc, "users.Handler")
AddCustomMatcher(testCustomMatcher, "true.CustomMatcher")
router := NewRouter()
loader := sliceLoader{
RouteDef{
Method: "GET",
Path: "/users",
Handler: "users.Handler",
Options: RouteDefOptions{
Name: "get.users",
CustomMatcher: "true.CustomMatcher",
},
},
}
err := router.Load(&loader)
assertNil(t, err)
assertRouteIsGenerated(t, router, "get.users", "/users", nil)
assertPathFound(t, router, "GET", "/users")
} | explode_data.jsonl/31759 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 227
} | [
2830,
3393,
9523,
19553,
73124,
26653,
1155,
353,
8840,
836,
8,
341,
37972,
3050,
8623,
3050,
9626,
11,
330,
4218,
31010,
1138,
37972,
10268,
37554,
8623,
10268,
37554,
11,
330,
1866,
27649,
37554,
5130,
67009,
1669,
1532,
9523,
741,
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 TestPrintConfigMap(t *testing.T) {
tests := []struct {
configMap api.ConfigMap
expected []metav1.TableRow
}{
// Basic config map with no data.
{
configMap: api.ConfigMap{
ObjectMeta: metav1.ObjectMeta{
Name: "configmap1",
CreationTimestamp: metav1.Time{Time: time.Now().Add(1.9e9)},
},
},
// Columns: Name, Data, Age
expected: []metav1.TableRow{{Cells: []interface{}{"configmap1", int64(0), "0s"}}},
},
// Basic config map with one data entry
{
configMap: api.ConfigMap{
ObjectMeta: metav1.ObjectMeta{
Name: "configmap2",
CreationTimestamp: metav1.Time{Time: time.Now().Add(1.9e9)},
},
Data: map[string]string{
"foo": "bar",
},
},
// Columns: Name, (Num) Data, Age
expected: []metav1.TableRow{{Cells: []interface{}{"configmap2", int64(1), "0s"}}},
},
// Basic config map with one data and one binary data entry.
{
configMap: api.ConfigMap{
ObjectMeta: metav1.ObjectMeta{
Name: "configmap3",
CreationTimestamp: metav1.Time{Time: time.Now().Add(1.9e9)},
},
Data: map[string]string{
"foo": "bar",
},
BinaryData: map[string][]byte{
"bin": []byte("binary data"),
},
},
// Columns: Name, (Num) Data, Age
expected: []metav1.TableRow{{Cells: []interface{}{"configmap3", int64(2), "0s"}}},
},
}
for i, test := range tests {
rows, err := printConfigMap(&test.configMap, printers.GenerateOptions{})
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/21617 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 792
} | [
2830,
3393,
8994,
2648,
2227,
1155,
353,
8840,
836,
8,
341,
78216,
1669,
3056,
1235,
341,
197,
25873,
2227,
6330,
10753,
2227,
198,
197,
42400,
220,
3056,
4059,
402,
16,
18257,
3102,
198,
197,
59403,
197,
197,
322,
14625,
2193,
2415,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestGetHistoricalIndex(t *testing.T) {
t.Parallel()
_, err := f.GetHistoricalIndex(context.Background(),
"BTC", 3600, time.Now().Add(-time.Hour*2), time.Now().Add(-time.Hour*1))
if err != nil {
t.Error(err)
}
_, err = f.GetHistoricalIndex(context.Background(),
"BTC", 3600, time.Time{}, time.Time{})
if err != nil {
t.Error(err)
}
} | explode_data.jsonl/15155 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 147
} | [
2830,
3393,
1949,
48983,
938,
1552,
1155,
353,
8840,
836,
8,
341,
3244,
41288,
7957,
741,
197,
6878,
1848,
1669,
282,
2234,
48983,
938,
1552,
5378,
19047,
3148,
197,
197,
1,
59118,
497,
220,
18,
21,
15,
15,
11,
882,
13244,
1005,
221... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestOrderedCallsWithPreReqMaxUnbounded(t *testing.T) {
reporter, ctrl, subjectOne, subjectTwo := commonTestOrderedCalls(t)
// Initially we should be able to call FooMethod("1") as many times as we
// want.
ctrl.Call(subjectOne, "FooMethod", "1")
ctrl.Call(subjectOne, "FooMethod", "1")
// But calling something that has it as a prerequite should remove it from
// the expected call set. This allows tests to ensure that FooMethod("1") is
// *not* called after FooMethod("2").
ctrl.Call(subjectTwo, "FooMethod", "2")
// Therefore this call should fail:
reporter.assertFatal(func() {
ctrl.Call(subjectOne, "FooMethod", "1")
})
} | explode_data.jsonl/17290 | {
"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,
54384,
55292,
2354,
4703,
27234,
5974,
1806,
65686,
1155,
353,
8840,
836,
8,
341,
69931,
261,
11,
23743,
11,
3832,
3966,
11,
3832,
11613,
1669,
4185,
2271,
54384,
55292,
1155,
692,
197,
322,
58556,
582,
1265,
387,
2952,
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... | 1 |
func TestDSNWithCustomTLS(t *testing.T) {
baseDSN := "User:password@tcp(localhost:5555)/dbname?tls="
tlsCfg := tls.Config{}
RegisterTLSConfig("utils_test", &tlsCfg)
// Custom TLS is missing
tst := baseDSN + "invalid_tls"
cfg, err := ParseDSN(tst)
if err == nil {
t.Errorf("invalid custom TLS in DSN (%s) but did not error. Got config: %#v", tst, cfg)
}
tst = baseDSN + "utils_test"
// Custom TLS with a server name
name := "foohost"
tlsCfg.ServerName = name
cfg, err = ParseDSN(tst)
if err != nil {
t.Error(err.Error())
} else if cfg.tls.ServerName != name {
t.Errorf("did not get the correct TLS ServerName (%s) parsing DSN (%s).", name, tst)
}
// Custom TLS without a server name
name = "localhost"
tlsCfg.ServerName = ""
cfg, err = ParseDSN(tst)
if err != nil {
t.Error(err.Error())
} else if cfg.tls.ServerName != name {
t.Errorf("did not get the correct ServerName (%s) parsing DSN (%s).", name, tst)
}
DeregisterTLSConfig("utils_test")
} | explode_data.jsonl/70844 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 449
} | [
2830,
3393,
5936,
45,
2354,
10268,
45439,
1155,
353,
8840,
836,
8,
972,
24195,
5936,
45,
1669,
330,
1474,
25,
3833,
31,
27161,
7,
8301,
25,
20,
20,
20,
20,
5620,
35265,
30,
34488,
428,
319,
3244,
4730,
42467,
1669,
55026,
10753,
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... | 6 |
func TestGetDishes(t *testing.T) {
expected := []Dish{
{Category: "Tagesgericht 1",
Name: "Zartweizen mit Tomaten, Zucchini und Auberginen"},
{Category: "Tagesgericht 3",
Name: "Cevapcici von der Pute mit Ajvar"},
{Category: "Aktionsessen 4",
Name: "Münchner Biergulasch (GQB) (R)(99)"},
{Category: "Self-Service",
Name: "Zartweizen mit Tomaten, Zucchini und Auberginen"},
{Category: "Self-Service",
Name: "Rigatoni mit Paprikapesto"},
{Category: "Self-Service",
Name: "Bunte Nudel-Hackfleisch-Pfanne (R)"},
}
got := GetDishes("http://www.studentenwerk-muenchen.de/mensa/speiseplan/speiseplan_2017-05-22_421_-de.html")
for i := range got {
if got[i] != expected[i] {
t.Errorf("Expected: %s, %s\n Got: %s, %s", expected[i].Category,
expected[i].Name, got[i].Category, got[i].Name)
}
}
} | explode_data.jsonl/67948 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 365
} | [
2830,
3393,
1949,
35,
20527,
1155,
353,
8840,
836,
8,
341,
42400,
1669,
3056,
35,
812,
515,
197,
197,
90,
6746,
25,
330,
51,
1134,
1389,
4865,
220,
16,
756,
298,
21297,
25,
330,
57,
471,
896,
23678,
5451,
8364,
13518,
11,
1863,
85... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
func TestSample1(t *testing.T) {
A := []int{10, 13, 12, 14, 15}
expect := 2
runSample(t, A, expect)
} | explode_data.jsonl/6469 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 48
} | [
2830,
3393,
17571,
16,
1155,
353,
8840,
836,
8,
341,
22985,
1669,
3056,
396,
90,
16,
15,
11,
220,
16,
18,
11,
220,
16,
17,
11,
220,
16,
19,
11,
220,
16,
20,
532,
24952,
1669,
220,
17,
198,
56742,
17571,
1155,
11,
362,
11,
1720... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestPushCommits_AvatarLink(t *testing.T) {
pushCommits := NewPushCommits()
pushCommits.Commits = []*PushCommit{
{
Sha1: "abcdef1",
CommitterEmail: "user2@example.com",
CommitterName: "User Two",
AuthorEmail: "user4@example.com",
AuthorName: "User Four",
Message: "message1",
},
{
Sha1: "abcdef2",
CommitterEmail: "user2@example.com",
CommitterName: "User Two",
AuthorEmail: "user2@example.com",
AuthorName: "User Two",
Message: "message2",
},
}
pushCommits.Len = len(pushCommits.Commits)
assert.Equal(t,
"https://secure.gravatar.com/avatar/ab53a2911ddf9b4817ac01ddcd3d975f?d=identicon",
pushCommits.AvatarLink("user2@example.com"))
assert.Equal(t,
"https://secure.gravatar.com/avatar/19ade630b94e1e0535b3df7387434154?d=identicon",
pushCommits.AvatarLink("nonexistent@example.com"))
} | explode_data.jsonl/74208 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 423
} | [
2830,
3393,
16644,
17977,
1199,
1566,
85,
6392,
3939,
1155,
353,
8840,
836,
8,
341,
43155,
17977,
1199,
1669,
1532,
16644,
17977,
1199,
741,
43155,
17977,
1199,
2961,
44703,
284,
29838,
16644,
33441,
515,
197,
197,
515,
298,
197,
62316,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestValueBasic(t *testing.T) {
dir, err := ioutil.TempDir("", "badger-test")
y.Check(err)
defer removeDir(dir)
kv, _ := Open(getTestOptions(dir))
defer kv.Close()
log := &kv.vlog
// Use value big enough that the value log writes them even if SyncWrites is false.
const val1 = "sampleval012345678901234567890123"
const val2 = "samplevalb012345678901234567890123"
require.True(t, len(val1) >= kv.opt.ValueThreshold)
e1 := &Entry{
Key: []byte("samplekey"),
Value: []byte(val1),
meta: bitValuePointer,
}
e2 := &Entry{
Key: []byte("samplekeyb"),
Value: []byte(val2),
meta: bitValuePointer,
}
b := new(request)
b.Entries = []*Entry{e1, e2}
log.write([]*request{b})
require.Len(t, b.Ptrs, 2)
t.Logf("Pointer written: %+v %+v\n", b.Ptrs[0], b.Ptrs[1])
s := new(y.Slice)
buf1, lf1, err1 := log.readValueBytes(b.Ptrs[0], s)
buf2, lf2, err2 := log.readValueBytes(b.Ptrs[1], s)
require.NoError(t, err1)
require.NoError(t, err2)
defer runCallback(log.getUnlockCallback(lf1))
defer runCallback(log.getUnlockCallback(lf2))
e1, err = lf1.decodeEntry(buf1, b.Ptrs[0].Offset)
require.NoError(t, err)
e2, err = lf1.decodeEntry(buf2, b.Ptrs[1].Offset)
require.NoError(t, err)
readEntries := []Entry{*e1, *e2}
require.EqualValues(t, []Entry{
{
Key: []byte("samplekey"),
Value: []byte(val1),
meta: bitValuePointer,
offset: b.Ptrs[0].Offset,
},
{
Key: []byte("samplekeyb"),
Value: []byte(val2),
meta: bitValuePointer,
offset: b.Ptrs[1].Offset,
},
}, readEntries)
} | explode_data.jsonl/39088 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 719
} | [
2830,
3393,
1130,
15944,
1155,
353,
8840,
836,
8,
341,
48532,
11,
1848,
1669,
43144,
65009,
6184,
19814,
330,
13855,
1389,
16839,
1138,
14522,
10600,
3964,
340,
16867,
4057,
6184,
14161,
692,
16463,
85,
11,
716,
1669,
5264,
5433,
2271,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestConfig_Decrypt_KnownIDGoodPassword_NoErr(t *testing.T) {
setup()
defer teardown()
id, _ := cfg.Encrypt(content)
if _, err := cfg.Decrypt(pw, id); err != nil {
t.Error(err)
}
} | explode_data.jsonl/6919 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 85
} | [
2830,
3393,
2648,
78668,
3571,
10102,
4169,
915,
15216,
4876,
36989,
7747,
1155,
353,
8840,
836,
8,
341,
220,
6505,
741,
220,
17956,
49304,
741,
220,
877,
11,
716,
1669,
13286,
26598,
3571,
15063,
340,
220,
421,
8358,
1848,
1669,
13286,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_Hoverfly_GetFilteredSimulation_WithUrlQueryContainingPath(t *testing.T) {
RegisterTestingT(t)
unit := NewHoverflyWithConfiguration(&Configuration{})
unit.Simulation.AddPair(&models.RequestMatcherResponsePair{
RequestMatcher: models.RequestMatcher{
Destination: []models.RequestFieldMatchers{
{
Matcher: matchers.Exact,
Value: "foo.com",
},
},
Path: []models.RequestFieldMatchers{
{
Matcher: matchers.Exact,
Value: "/api/v1",
},
},
},
})
unit.Simulation.AddPair(&models.RequestMatcherResponsePair{
RequestMatcher: models.RequestMatcher{
Destination: []models.RequestFieldMatchers{
{
Matcher: matchers.Exact,
Value: "foo.com",
},
},
Path: []models.RequestFieldMatchers{
{
Matcher: matchers.Exact,
Value: "/api/v2",
},
},
},
})
unit.Simulation.AddPair(&models.RequestMatcherResponsePair{
RequestMatcher: models.RequestMatcher{
Destination: []models.RequestFieldMatchers{
{
Matcher: matchers.Exact,
Value: "bar.com",
},
},
Path: []models.RequestFieldMatchers{
{
Matcher: matchers.Exact,
Value: "/api/v1",
},
},
},
})
simulation, err := unit.GetFilteredSimulation("foo.com/api/v1")
Expect(err).To(BeNil())
Expect(simulation.RequestResponsePairs).To(HaveLen(1))
Expect(simulation.RequestResponsePairs[0].RequestMatcher.Destination[0].Matcher).To(Equal("exact"))
Expect(simulation.RequestResponsePairs[0].RequestMatcher.Destination[0].Value).To(Equal("foo.com"))
Expect(simulation.RequestResponsePairs[0].RequestMatcher.Path[0].Matcher).To(Equal("exact"))
Expect(simulation.RequestResponsePairs[0].RequestMatcher.Path[0].Value).To(Equal("/api/v1"))
} | explode_data.jsonl/45375 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 740
} | [
2830,
3393,
2039,
1975,
21642,
13614,
67310,
64554,
62,
2354,
2864,
2859,
86641,
1820,
1155,
353,
8840,
836,
8,
341,
79096,
16451,
51,
1155,
692,
81189,
1669,
1532,
34379,
21642,
2354,
7688,
2099,
7688,
6257,
692,
81189,
808,
60361,
1904,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestPrePostGoInstall(t *testing.T) {
if !t.Run("pre", basicTest) {
return
}
cmd := exec.Command("go", "install", "myitcv.io/hybridimporter/_example")
want := `# myitcv.io/hybridimporter/_example
_example/example.go:7:13: undefined: Test
_example/example.go:12:27: undefined: asdf
`
out, err := cmd.CombinedOutput()
if err != nil {
if _, ok := err.(*exec.ExitError); !ok {
t.Fatalf("unexpected error: %v", err)
}
}
if got := string(out); got != want {
t.Fatalf("unexpected output; got\n%v\nwanted:\n%v", got, want)
}
t.Run("post", basicTest)
} | explode_data.jsonl/80542 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 234
} | [
2830,
3393,
4703,
4133,
10850,
24690,
1155,
353,
8840,
836,
8,
341,
743,
753,
83,
16708,
445,
1726,
497,
6770,
2271,
8,
341,
197,
853,
198,
197,
532,
25920,
1669,
3883,
12714,
445,
3346,
497,
330,
12248,
497,
330,
2408,
275,
13122,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestExtractGDPR(t *testing.T) {
tests := []struct {
description string
giveRegs *openrtb.Regs
wantGDPR gdpr.Signal
}{
{
description: "Regs Ext GDPR = 0",
giveRegs: &openrtb.Regs{Ext: json.RawMessage(`{"gdpr": 0}`)},
wantGDPR: gdpr.SignalNo,
},
{
description: "Regs Ext GDPR = 1",
giveRegs: &openrtb.Regs{Ext: json.RawMessage(`{"gdpr": 1}`)},
wantGDPR: gdpr.SignalYes,
},
{
description: "Regs Ext GDPR = null",
giveRegs: &openrtb.Regs{Ext: json.RawMessage(`{"gdpr": null}`)},
wantGDPR: gdpr.SignalAmbiguous,
},
{
description: "Regs is nil",
giveRegs: nil,
wantGDPR: gdpr.SignalAmbiguous,
},
{
description: "Regs Ext is nil",
giveRegs: &openrtb.Regs{Ext: nil},
wantGDPR: gdpr.SignalAmbiguous,
},
{
description: "JSON unmarshal error",
giveRegs: &openrtb.Regs{Ext: json.RawMessage(`{"`)},
wantGDPR: gdpr.SignalAmbiguous,
},
}
for _, tt := range tests {
bidReq := openrtb.BidRequest{
Regs: tt.giveRegs,
}
result := extractGDPR(&bidReq)
assert.Equal(t, tt.wantGDPR, result, tt.description)
}
} | explode_data.jsonl/20461 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 573
} | [
2830,
3393,
28959,
40849,
6480,
1155,
353,
8840,
836,
8,
341,
78216,
1669,
3056,
1235,
341,
197,
42407,
914,
198,
197,
3174,
533,
84470,
262,
353,
2508,
3342,
65,
2817,
5857,
198,
197,
50780,
40849,
6480,
262,
32630,
649,
75669,
198,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
func TestQueryStore_Series(t *testing.T) {
defer leaktest.CheckTimeout(t, 10*time.Second)()
cls := []Client{
&testClient{
StoreClient: &storeClient{
RespSet: []*storepb.SeriesResponse{
storeSeriesResponse(t, labels.FromStrings("a", "a"), []sample{{0, 0}, {2, 1}, {3, 2}}),
storepb.NewWarnSeriesResponse(errors.New("partial error")),
storeSeriesResponse(t, labels.FromStrings("a", "b"), []sample{{2, 2}, {3, 3}, {4, 4}}),
},
},
minTime: 1,
maxTime: 300,
},
&testClient{
StoreClient: &storeClient{
RespSet: []*storepb.SeriesResponse{
storeSeriesResponse(t, labels.FromStrings("a", "b"), []sample{{1, 1}, {2, 2}, {3, 3}}),
},
},
minTime: 1,
maxTime: 300,
},
&testClient{
StoreClient: &storeClient{
RespSet: []*storepb.SeriesResponse{
storepb.NewWarnSeriesResponse(errors.New("partial error")),
},
},
minTime: 1,
maxTime: 300,
},
&testClient{
StoreClient: &storeClient{
RespSet: []*storepb.SeriesResponse{
storeSeriesResponse(t, labels.FromStrings("a", "c"), []sample{{100, 1}, {300, 3}, {400, 4}}),
},
},
minTime: 1,
maxTime: 300,
},
&testClient{
StoreClient: &storeClient{
RespSet: []*storepb.SeriesResponse{
storeSeriesResponse(t, labels.FromStrings("a", "outside"), []sample{{1, 1}}),
},
},
// Outside range for store itself.
minTime: 301,
maxTime: 302,
},
}
q := NewProxyStore(nil,
func(context.Context) ([]Client, error) { return cls, nil },
tlabels.FromStrings("fed", "a"),
)
ctx := context.Background()
s1 := newStoreSeriesServer(ctx)
// This should return empty response, since there is external label mismatch.
err := q.Series(
&storepb.SeriesRequest{
MinTime: 1,
MaxTime: 300,
Matchers: []storepb.LabelMatcher{{Name: "fed", Value: "not-a", Type: storepb.LabelMatcher_EQ}},
}, s1,
)
testutil.Ok(t, err)
testutil.Equals(t, 0, len(s1.SeriesSet))
testutil.Equals(t, 0, len(s1.Warnings))
s2 := newStoreSeriesServer(ctx)
err = q.Series(
&storepb.SeriesRequest{
MinTime: 1,
MaxTime: 300,
Matchers: []storepb.LabelMatcher{{Name: "fed", Value: "a", Type: storepb.LabelMatcher_EQ}},
}, s2,
)
testutil.Ok(t, err)
expected := []rawSeries{
{
lset: []storepb.Label{{Name: "a", Value: "a"}},
samples: []sample{{0, 0}, {2, 1}, {3, 2}},
},
{
lset: []storepb.Label{{Name: "a", Value: "b"}},
samples: []sample{{2, 2}, {3, 3}, {4, 4}, {1, 1}, {2, 2}, {3, 3}},
},
{
lset: []storepb.Label{{Name: "a", Value: "c"}},
samples: []sample{{100, 1}, {300, 3}, {400, 4}},
},
}
// We should have all series given by all our clients.
seriesEqual(t, expected, s2.SeriesSet)
// We should have all warnings given by all our clients too.
testutil.Equals(t, 2, len(s2.Warnings))
} | explode_data.jsonl/24479 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 1241
} | [
2830,
3393,
2859,
6093,
1098,
4699,
1155,
353,
8840,
836,
8,
341,
16867,
23352,
1944,
10600,
7636,
1155,
11,
220,
16,
15,
77053,
32435,
8,
2822,
197,
18074,
1669,
3056,
2959,
515,
197,
197,
5,
1944,
2959,
515,
298,
197,
6093,
2959,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestCustomHTTPClientInterface(t *testing.T) {
// Start up a server just so we can make a working client later.
h := PickyHatmaker(1)
s := httptest.NewServer(NewHaberdasherServer(h, nil))
defer s.Close()
// Create a custom wrapper to wrap our default client
httpClient := &wrappedHTTPClient{
client: http.DefaultClient,
wasCalled: false,
}
// Test the JSON client and the Protobuf client with a custom http.Client interface
client := NewHaberdasherJSONClient(s.URL, httpClient)
_, err := client.MakeHat(context.Background(), &Size{Inches: 1})
if err != nil {
t.Errorf("MakeHat err=%s", err)
}
// Check if the Do function within the http.Client wrapper gets actually called
if !httpClient.wasCalled {
t.Errorf("HTTPClient.Do function was not called within the JSONClient")
}
// Reset bool for second test
httpClient.wasCalled = false
client = NewHaberdasherProtobufClient(s.URL, httpClient)
_, err = client.MakeHat(context.Background(), &Size{Inches: 1})
if err != nil {
t.Errorf("MakeHat err=%s", err)
}
// Check if the Do function within the http.Client wrapper gets actually called
if !httpClient.wasCalled {
t.Errorf("HTTPClient.Do function was not called within the ProtobufClient")
}
} | explode_data.jsonl/620 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 406
} | [
2830,
3393,
10268,
9230,
2959,
5051,
1155,
353,
8840,
836,
8,
341,
197,
322,
5145,
705,
264,
3538,
1101,
773,
582,
646,
1281,
264,
3238,
2943,
2937,
624,
9598,
1669,
393,
18964,
72287,
25766,
7,
16,
340,
1903,
1669,
54320,
70334,
7121... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestPAC_ClientInfo_Unmarshal(t *testing.T) {
t.Parallel()
b, err := hex.DecodeString(testdata.MarshaledPAC_Client_Info)
if err != nil {
t.Fatal("Could not decode test data hex string")
}
var k ClientInfo
err = k.Unmarshal(b)
if err != nil {
t.Fatalf("Error unmarshaling test data: %v", err)
}
assert.Equal(t, time.Date(2017, 5, 6, 15, 53, 11, 000000000, time.UTC), k.ClientID.Time(), "Client ID time not as expected.")
assert.Equal(t, uint16(18), k.NameLength, "Client name length not as expected")
assert.Equal(t, "testuser1", k.Name, "Client name not as expected")
} | explode_data.jsonl/21493 | {
"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,
47,
1706,
46102,
1731,
40687,
27121,
1155,
353,
8840,
836,
8,
341,
3244,
41288,
7957,
741,
2233,
11,
1848,
1669,
12371,
56372,
703,
8623,
691,
83691,
75303,
47,
1706,
46102,
39624,
340,
743,
1848,
961,
2092,
341,
197,
3244,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
func TestParseNonExportedJSONFields(t *testing.T) {
expected := `{
"swagger": "2.0",
"info": {
"description": "This is a sample server.",
"title": "Swagger Example API",
"contact": {},
"version": "1.0"
},
"host": "localhost:4000",
"basePath": "/api",
"paths": {
"/so-something": {
"get": {
"description": "Does something, but internal (non-exported) fields inside a struct won't be marshaled into JSON",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"summary": "Call DoSomething",
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/main.MyStruct"
}
}
}
}
}
},
"definitions": {
"main.MyStruct": {
"type": "object",
"properties": {
"data": {
"description": "Post data",
"type": "object",
"properties": {
"name": {
"description": "Post tag",
"type": "array",
"items": {
"type": "string"
}
}
}
},
"id": {
"type": "integer",
"format": "int64",
"example": 1
},
"name": {
"description": "Post name",
"type": "string",
"example": "poti"
}
}
}
}
}`
searchDir := "testdata/non_exported_json_fields"
p := New()
err := p.ParseAPI(searchDir, mainAPIFile, defaultParseDepth)
assert.NoError(t, err)
b, _ := json.MarshalIndent(p.swagger, "", " ")
assert.Equal(t, expected, string(b))
} | explode_data.jsonl/63557 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 1380
} | [
2830,
3393,
14463,
8121,
16894,
291,
5370,
8941,
1155,
353,
8840,
836,
8,
341,
42400,
1669,
1565,
515,
262,
330,
74755,
788,
330,
17,
13,
15,
756,
262,
330,
2733,
788,
341,
286,
330,
4684,
788,
330,
1986,
374,
264,
6077,
3538,
10346... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestManager_Prune(t *testing.T) {
store := setupStore(t)
manager := snapshots.NewManager(store, nil, nil)
pruned, err := manager.Prune(2)
require.NoError(t, err)
assert.EqualValues(t, 1, pruned)
list, err := manager.List()
require.NoError(t, err)
assert.Len(t, list, 3)
// Prune should error while a snapshot is being taken
manager = setupBusyManager(t)
_, err = manager.Prune(2)
require.Error(t, err)
} | explode_data.jsonl/24071 | {
"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,
2043,
32716,
2886,
1155,
353,
8840,
836,
8,
341,
57279,
1669,
6505,
6093,
1155,
340,
92272,
1669,
61823,
7121,
2043,
31200,
11,
2092,
11,
2092,
692,
25653,
48883,
11,
1848,
1669,
6645,
17947,
2886,
7,
17,
340,
17957,
35699,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestEnablePartition(t *testing.T) {
store, clean := realtikvtest.CreateMockStoreAndSetup(t)
defer clean()
tk := testkit.NewTestKit(t, store)
tk.MustExec("use test")
tk.MustExec("set tidb_enable_table_partition=off")
tk.MustQuery("show variables like 'tidb_enable_table_partition'").Check(testkit.Rows("tidb_enable_table_partition OFF"))
tk.MustExec("set global tidb_enable_table_partition = on")
tk.MustQuery("show variables like 'tidb_enable_table_partition'").Check(testkit.Rows("tidb_enable_table_partition OFF"))
tk.MustQuery("show global variables like 'tidb_enable_table_partition'").Check(testkit.Rows("tidb_enable_table_partition ON"))
tk.MustExec("set tidb_enable_list_partition=off")
tk.MustQuery("show variables like 'tidb_enable_list_partition'").Check(testkit.Rows("tidb_enable_list_partition OFF"))
tk.MustExec("set global tidb_enable_list_partition=on")
tk.MustQuery("show global variables like 'tidb_enable_list_partition'").Check(testkit.Rows("tidb_enable_list_partition ON"))
tk.MustQuery("show variables like 'tidb_enable_list_partition'").Check(testkit.Rows("tidb_enable_list_partition OFF"))
tk.MustExec("set tidb_enable_list_partition=1")
tk.MustQuery("show variables like 'tidb_enable_list_partition'").Check(testkit.Rows("tidb_enable_list_partition ON"))
tk.MustExec("set tidb_enable_list_partition=on")
tk.MustQuery("show variables like 'tidb_enable_list_partition'").Check(testkit.Rows("tidb_enable_list_partition ON"))
tk.MustQuery("show global variables like 'tidb_enable_list_partition'").Check(testkit.Rows("tidb_enable_list_partition ON"))
tk.MustExec("set global tidb_enable_list_partition=off")
tk.MustQuery("show global variables like 'tidb_enable_list_partition'").Check(testkit.Rows("tidb_enable_list_partition OFF"))
tk.MustQuery("show variables like 'tidb_enable_list_partition'").Check(testkit.Rows("tidb_enable_list_partition ON"))
tk.MustExec("set tidb_enable_list_partition=off")
tk.MustQuery("show variables like 'tidb_enable_list_partition'").Check(testkit.Rows("tidb_enable_list_partition OFF"))
tk.MustExec("set global tidb_enable_list_partition=on")
tk.MustQuery("show global variables like 'tidb_enable_list_partition'").Check(testkit.Rows("tidb_enable_list_partition ON"))
tk1 := testkit.NewTestKit(t, store)
tk1.MustExec("use test")
tk1.MustQuery("show variables like 'tidb_enable_table_partition'").Check(testkit.Rows("tidb_enable_table_partition ON"))
tk1.MustQuery("show variables like 'tidb_enable_list_partition'").Check(testkit.Rows("tidb_enable_list_partition ON"))
} | explode_data.jsonl/5767 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 930
} | [
2830,
3393,
11084,
49978,
1155,
353,
8840,
836,
8,
341,
57279,
11,
4240,
1669,
1931,
83,
1579,
85,
1944,
7251,
11571,
6093,
3036,
21821,
1155,
340,
16867,
4240,
2822,
3244,
74,
1669,
1273,
8226,
7121,
2271,
7695,
1155,
11,
3553,
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 TestSystemEndianness(t *testing.T) {
// Store out the determined system endianness before manually manipulating it
systemEndianness := endianness
if endianness != SystemEndianness() {
t.Fatalf("determined endianness does not match expected value")
}
endianness = binary.LittleEndian
if endianness != SystemEndianness() {
t.Fatalf("determined endianness does not match expected value")
}
endianness = binary.BigEndian
if endianness != SystemEndianness() {
t.Fatalf("determined endianness does not match expected value")
}
// Restore the determined system endianness
endianness = systemEndianness
} | explode_data.jsonl/1344 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 188
} | [
2830,
3393,
2320,
3727,
72,
82033,
1155,
353,
8840,
836,
8,
341,
197,
322,
9129,
700,
279,
10838,
1849,
835,
72,
82033,
1573,
20083,
62514,
432,
198,
40293,
3727,
72,
82033,
1669,
835,
72,
82033,
271,
743,
835,
72,
82033,
961,
739,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestFilterOwnedDescendants(t *testing.T) {
c := clusterv1.Cluster{
ObjectMeta: metav1.ObjectMeta{
Name: "c",
},
}
md1NotOwnedByCluster := newMachineDeploymentBuilder().named("md1").build()
md2OwnedByCluster := newMachineDeploymentBuilder().named("md2").ownedBy(&c).build()
md3NotOwnedByCluster := newMachineDeploymentBuilder().named("md3").build()
md4OwnedByCluster := newMachineDeploymentBuilder().named("md4").ownedBy(&c).build()
ms1NotOwnedByCluster := newMachineSetBuilder().named("ms1").build()
ms2OwnedByCluster := newMachineSetBuilder().named("ms2").ownedBy(&c).build()
ms3NotOwnedByCluster := newMachineSetBuilder().named("ms3").build()
ms4OwnedByCluster := newMachineSetBuilder().named("ms4").ownedBy(&c).build()
m1NotOwnedByCluster := newMachineBuilder().named("m1").build()
m2OwnedByCluster := newMachineBuilder().named("m2").ownedBy(&c).build()
m3ControlPlaneOwnedByCluster := newMachineBuilder().named("m3").ownedBy(&c).controlPlane().build()
m4NotOwnedByCluster := newMachineBuilder().named("m4").build()
m5OwnedByCluster := newMachineBuilder().named("m5").ownedBy(&c).build()
m6ControlPlaneOwnedByCluster := newMachineBuilder().named("m6").ownedBy(&c).controlPlane().build()
d := clusterDescendants{
machineDeployments: clusterv1.MachineDeploymentList{
Items: []clusterv1.MachineDeployment{
md1NotOwnedByCluster,
md2OwnedByCluster,
md3NotOwnedByCluster,
md4OwnedByCluster,
},
},
machineSets: clusterv1.MachineSetList{
Items: []clusterv1.MachineSet{
ms1NotOwnedByCluster,
ms2OwnedByCluster,
ms3NotOwnedByCluster,
ms4OwnedByCluster,
},
},
controlPlaneMachines: clusterv1.MachineList{
Items: []clusterv1.Machine{
m3ControlPlaneOwnedByCluster,
m6ControlPlaneOwnedByCluster,
},
},
workerMachines: clusterv1.MachineList{
Items: []clusterv1.Machine{
m1NotOwnedByCluster,
m2OwnedByCluster,
m4NotOwnedByCluster,
m5OwnedByCluster,
},
},
}
actual, err := d.filterOwnedDescendants(&c)
if err != nil {
t.Fatalf("unexpected error: %v", err)
}
expected := []runtime.Object{
&md2OwnedByCluster,
&md4OwnedByCluster,
&ms2OwnedByCluster,
&ms4OwnedByCluster,
&m2OwnedByCluster,
&m5OwnedByCluster,
&m3ControlPlaneOwnedByCluster,
&m6ControlPlaneOwnedByCluster,
}
if !reflect.DeepEqual(expected, actual) {
t.Errorf("expected %v, got %v", expected, actual)
}
} | explode_data.jsonl/71244 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 979
} | [
2830,
3393,
5632,
57641,
11065,
28310,
1155,
353,
8840,
836,
8,
341,
1444,
1669,
1185,
590,
648,
16,
72883,
515,
197,
23816,
12175,
25,
77520,
16,
80222,
515,
298,
21297,
25,
330,
66,
756,
197,
197,
1583,
197,
630,
84374,
16,
2623,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestTopDownRegex(t *testing.T) {
tests := []struct {
note string
rules []string
expected interface{}
}{
{"re_match", []string{`p = true { re_match("^[a-z]+\\[[0-9]+\\]$", "foo[1]") }`}, "true"},
{"re_match: undefined", []string{`p = true { re_match("^[a-z]+\\[[0-9]+\\]$", "foo[\"bar\"]") }`}, ""},
{"re_match: bad pattern err", []string{`p = true { re_match("][", "foo[\"bar\"]") }`}, fmt.Errorf("re_match: error parsing regexp: missing closing ]: `[`")},
{"re_match: ref", []string{`p[x] { re_match("^b.*$", d.e[x]) }`}, "[0,1]"},
{"re_match: raw", []string{fmt.Sprintf(`p = true { re_match(%s, "foo[1]") }`, "`^[a-z]+\\[[0-9]+\\]$`")}, "true"},
{"re_match: raw: undefined", []string{fmt.Sprintf(`p = true { re_match(%s, "foo[\"bar\"]") }`, "`^[a-z]+\\[[0-9]+\\]$`")}, ""},
}
data := loadSmallTestData()
for _, tc := range tests {
runTopDownTestCase(t, data, tc.note, tc.rules, tc.expected)
}
} | explode_data.jsonl/25211 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 430
} | [
2830,
3393,
5366,
4454,
32464,
1155,
353,
8840,
836,
8,
341,
78216,
1669,
3056,
1235,
341,
197,
9038,
1272,
257,
914,
198,
197,
7000,
2425,
262,
3056,
917,
198,
197,
42400,
3749,
16094,
197,
59403,
197,
197,
4913,
265,
10708,
497,
305... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestRoutingRule(t *testing.T) {
assert := assert.On(t)
type ruleTest struct {
input context.Context
output bool
}
cases := []struct {
rule *RoutingRule
test []ruleTest
}{
{
rule: &RoutingRule{
Domain: []*Domain{
{
Value: "v2ray.com",
Type: Domain_Plain,
},
{
Value: "google.com",
Type: Domain_Domain,
},
{
Value: "^facebook\\.com$",
Type: Domain_Regex,
},
},
},
test: []ruleTest{
ruleTest{
input: proxy.ContextWithTarget(context.Background(), net.TCPDestination(net.DomainAddress("v2ray.com"), 80)),
output: true,
},
ruleTest{
input: proxy.ContextWithTarget(context.Background(), net.TCPDestination(net.DomainAddress("www.v2ray.com.www"), 80)),
output: true,
},
ruleTest{
input: proxy.ContextWithTarget(context.Background(), net.TCPDestination(net.DomainAddress("v2ray.co"), 80)),
output: false,
},
ruleTest{
input: proxy.ContextWithTarget(context.Background(), net.TCPDestination(net.DomainAddress("www.google.com"), 80)),
output: true,
},
ruleTest{
input: proxy.ContextWithTarget(context.Background(), net.TCPDestination(net.DomainAddress("facebook.com"), 80)),
output: true,
},
ruleTest{
input: proxy.ContextWithTarget(context.Background(), net.TCPDestination(net.DomainAddress("www.facebook.com"), 80)),
output: false,
},
ruleTest{
input: context.Background(),
output: false,
},
},
},
{
rule: &RoutingRule{
Cidr: []*CIDR{
{
Ip: []byte{8, 8, 8, 8},
Prefix: 32,
},
{
Ip: []byte{8, 8, 8, 8},
Prefix: 32,
},
{
Ip: net.ParseAddress("2001:0db8:85a3:0000:0000:8a2e:0370:7334").IP(),
Prefix: 128,
},
},
},
test: []ruleTest{
ruleTest{
input: proxy.ContextWithTarget(context.Background(), net.TCPDestination(net.ParseAddress("8.8.8.8"), 80)),
output: true,
},
ruleTest{
input: proxy.ContextWithTarget(context.Background(), net.TCPDestination(net.ParseAddress("8.8.4.4"), 80)),
output: false,
},
ruleTest{
input: proxy.ContextWithTarget(context.Background(), net.TCPDestination(net.ParseAddress("2001:0db8:85a3:0000:0000:8a2e:0370:7334"), 80)),
output: true,
},
ruleTest{
input: context.Background(),
output: false,
},
},
},
{
rule: &RoutingRule{
UserEmail: []string{
"admin@v2ray.com",
},
},
test: []ruleTest{
ruleTest{
input: protocol.ContextWithUser(context.Background(), &protocol.User{Email: "admin@v2ray.com"}),
output: true,
},
ruleTest{
input: protocol.ContextWithUser(context.Background(), &protocol.User{Email: "love@v2ray.com"}),
output: false,
},
ruleTest{
input: context.Background(),
output: false,
},
},
},
}
for _, test := range cases {
cond, err := test.rule.BuildCondition()
assert.Error(err).IsNil()
for _, t := range test.test {
assert.Bool(cond.Apply(t.input)).Equals(t.output)
}
}
} | explode_data.jsonl/31301 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 1611
} | [
2830,
3393,
24701,
11337,
1155,
353,
8840,
836,
8,
972,
6948,
1669,
2060,
8071,
1155,
7229,
13158,
5912,
2271,
2036,
972,
197,
22427,
220,
2266,
9328,
319,
197,
21170,
1807,
319,
197,
2570,
1444,
2264,
1669,
3056,
1235,
972,
197,
7000,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestSmallBufferChunkData(t *testing.T) {
r := strings.NewReader(`[
[null,"hello world"],
["foo bar", null],
[null, null] ,
["foo bar", "hello world" ]
]`)
lcd := largeChunkDecoder{
r, 0, 0,
0, 0,
make([]byte, 1),
bytes.NewBuffer(make([]byte, defaultStringBufferSize)),
nil,
}
if _, err := lcd.decode(); err != nil {
t.Fatalf("failed with small buffer: %s", err)
}
} | explode_data.jsonl/23251 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 175
} | [
2830,
3393,
25307,
4095,
28304,
1043,
1155,
353,
8840,
836,
8,
341,
7000,
1669,
9069,
68587,
5809,
9640,
3677,
508,
2921,
1335,
14990,
1879,
8097,
3677,
4383,
7975,
3619,
497,
845,
1259,
3677,
508,
2921,
11,
845,
60,
13493,
3677,
4383,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestGoBuildIndex(t *testing.T) {
baseLayers := int64(3)
images := int64(2)
base, err := random.Index(1024, baseLayers, images)
if err != nil {
t.Fatalf("random.Image() = %v", err)
}
importpath := "github.com/google/ko"
creationTime := v1.Time{Time: time.Unix(5000, 0)}
ng, err := NewGo(
context.Background(),
"",
WithCreationTime(creationTime),
WithBaseImages(func(context.Context, string) (name.Reference, Result, error) { return baseRef, base, nil }),
WithPlatforms("all"),
withBuilder(writeTempFile),
withSBOMber(fauxSBOM),
)
if err != nil {
t.Fatalf("NewGo() = %v", err)
}
result, err := ng.Build(context.Background(), StrictScheme+filepath.Join(importpath, "test"))
if err != nil {
t.Fatalf("Build() = %v", err)
}
idx, ok := result.(oci.SignedImageIndex)
if !ok {
t.Fatalf("Build() not an image: %v", result)
}
im, err := idx.IndexManifest()
if err != nil {
t.Fatalf("IndexManifest() = %v", err)
}
for _, desc := range im.Manifests {
img, err := idx.SignedImage(desc.Digest)
if err != nil {
t.Fatalf("idx.Image(%s) = %v", desc.Digest, err)
}
validateImage(t, img, baseLayers, creationTime, false, true)
}
if want, got := images, int64(len(im.Manifests)); want != got {
t.Fatalf("len(Manifests()) = %v, want %v", got, want)
}
// Check that rebuilding the image again results in the same image digest.
t.Run("check determinism", func(t *testing.T) {
result2, err := ng.Build(context.Background(), StrictScheme+filepath.Join(importpath, "test"))
if err != nil {
t.Fatalf("Build() = %v", err)
}
d1, err := result.Digest()
if err != nil {
t.Fatalf("Digest() = %v", err)
}
d2, err := result2.Digest()
if err != nil {
t.Fatalf("Digest() = %v", err)
}
if d1 != d2 {
t.Errorf("Digest mismatch: %s != %s", d1, d2)
}
})
} | explode_data.jsonl/2486 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 760
} | [
2830,
3393,
10850,
11066,
1552,
1155,
353,
8840,
836,
8,
341,
24195,
40235,
1669,
526,
21,
19,
7,
18,
340,
197,
3642,
1669,
526,
21,
19,
7,
17,
340,
24195,
11,
1848,
1669,
4194,
18338,
7,
16,
15,
17,
19,
11,
2331,
40235,
11,
533... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestMultiBinCMDBuilder(t *testing.T) {
builder := multiBin{syncBasePort: 4000}
publicIP := "48.224.166.183"
inst := fakeInstance(publicIP, 1, 2, 3)
idAndSyncs := builder.startSlave(inst)
res1 := idsAndSync{ids: []string{" -id 1"}, sync: publicIP + ":4001"}
res2 := idsAndSync{ids: []string{" -id 2"}, sync: publicIP + ":4002"}
res3 := idsAndSync{ids: []string{" -id 3"}, sync: publicIP + ":4003"}
res := []idsAndSync{res1, res2, res3}
require.Equal(t, idAndSyncs, res)
} | explode_data.jsonl/31979 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 199
} | [
2830,
3393,
20358,
28794,
38680,
3297,
1155,
353,
8840,
836,
8,
341,
44546,
1669,
7299,
28794,
90,
12996,
3978,
7084,
25,
220,
19,
15,
15,
15,
532,
1219,
3298,
1669,
330,
19,
23,
13,
17,
17,
19,
13,
16,
21,
21,
13,
16,
23,
18,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestLoginWithADALUsernamePasswordAuth(t *testing.T) {
config, _, err := msdsn.Parse("sqlserver://localhost:1433?Workstation ID=localhost&log=128")
if err != nil {
t.Fatal(err)
}
conn, err := NewActiveDirectoryTokenConnector(
config,
FedAuthADALWorkflowPassword,
func(ctx context.Context, serverSPN, stsURL string) (string, error) {
return "<token>", nil
},
)
if err != nil {
t.Errorf("Unable to parse dummy DSN: %v", err)
}
tl := testLogger{t: t}
defer tl.StopLogging()
SetLogger(&tl)
mock := NewMockTransportDialer(
[]string{
" 12 01 00 35 00 00 01 00 00 00 1F 00 06 01 00 25\n" +
"00 01 02 00 26 00 01 03 00 27 00 04 04 00 2B 00\n" +
"01 06 00 2C 00 01 ff 00 00 00 00 00 00 00 00 00\n" +
"00 00 00 00 01\n",
" 10 01 00 aa 00 00 01 00 a2 00 00 00 04 00 00 74\n" +
"00 10 00 00 00 00 00 00 00 00 00 00 00 00 00 00\n" +
"A0 02 00 10 00 00 00 00 00 00 00 00 5e 00 09 00\n" +
"70 00 00 00 70 00 00 00 70 00 0a 00 84 00 09 00\n" +
"96 00 04 00 96 00 00 00 96 00 00 00 96 00 00 00\n" +
"00 00 00 00 00 00 96 00 00 00 96 00 00 00 96 00\n" +
"00 00 00 00 00 00 6c 00 6f 00 63 00 61 00 6c 00\n" +
"68 00 6f 00 73 00 74 00 67 00 6f 00 2d 00 6d 00\n" +
"73 00 73 00 71 00 6c 00 64 00 62 00 6c 00 6f 00\n" +
"63 00 61 00 6c 00 68 00 6f 00 73 00 74 00 9a 00\n" +
"00 00 02 02 00 00 00 05 01 ff\n",
" 08 01 00 1e 00 00 01 00 12 00 00 00 0e 00 00 00\n" +
"3c 00 74 00 6f 00 6b 00 65 00 6e 00 3e 00\n",
},
[]string{
" 04 01 00 20 00 00 01 00 00 00 10 00 06 01 00 16\n" +
"00 01 06 00 17 00 01 FF 0C 00 07 D0 00 00 02 01\n",
" 04 01 00 97 00 00 01 00 EE 8A 00 00 00 02 00 00\n" +
"00 02 3A 00 00 00 16 00 00 00 01 3A 00 00 00 50\n" +
"00 00 00 68 00 74 00 74 00 70 00 73 00 3A 00 2F\n" +
"00 2F 00 64 00 61 00 74 00 61 00 62 00 61 00 73\n" +
"00 65 00 2E 00 77 00 69 00 6E 00 64 00 6F 00 77\n" +
"00 73 00 2E 00 6E 00 65 00 74 00 2F 00 68 00 74\n" +
"00 74 00 70 00 73 00 3A 00 2F 00 2F 00 65 00 78\n" +
"00 61 00 6D 00 70 00 6C 00 65 00 2E 00 63 00 6F\n" +
"00 6D 00 2F 00 61 00 75 00 74 00 68 00 6F 00 72\n" +
"00 69 00 74 00 79 00\n",
" 04 01 00 4A 00 00 01 00 AD 32 00 01 74 00 00 04\n" +
"14 4d 00 69 00 63 00 72 00 6f 00 73 00 6f 00 66\n" +
"00 74 00 20 00 53 00 51 00 4c 00 20 00 53 00 65\n" +
"00 72 00 76 00 65 00 72 00 0c 00 07 d0 fd 00 00\n" +
"00 00 00 00 00 00 00 00 00 00\n",
},
)
conn.Dialer = mock
_, err = connect(context.Background(), conn, driverInstanceNoProcess.logger, conn.params)
if err != nil {
t.Error(err)
}
err = <-mock.result
if err != nil {
t.Error(err)
}
} | explode_data.jsonl/28159 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 1257
} | [
2830,
3393,
6231,
2354,
1808,
969,
11115,
4876,
5087,
1155,
353,
8840,
836,
8,
341,
25873,
11,
8358,
1848,
1669,
9829,
75136,
8937,
445,
3544,
4030,
1110,
8301,
25,
16,
19,
18,
18,
30,
6776,
20155,
3034,
84551,
5,
839,
28,
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 TestBodyLimit(t *testing.T) {
e := echo.New()
hw := []byte("Hello, World!")
req := httptest.NewRequest(echo.POST, "/", bytes.NewReader(hw))
rec := httptest.NewRecorder()
c := e.NewContext(req, rec)
h := func(c echo.Context) error {
body, err := ioutil.ReadAll(c.Request().Body)
if err != nil {
return err
}
return c.String(http.StatusOK, string(body))
}
// Based on content length (within limit)
if assert.NoError(t, BodyLimit("2M")(h)(c)) {
assert.Equal(t, http.StatusOK, rec.Code)
assert.Equal(t, hw, rec.Body.Bytes())
}
// Based on content read (overlimit)
he := BodyLimit("2B")(h)(c).(*echo.HTTPError)
assert.Equal(t, http.StatusRequestEntityTooLarge, he.Code)
// Based on content read (within limit)
req = httptest.NewRequest(echo.POST, "/", bytes.NewReader(hw))
rec = httptest.NewRecorder()
c = e.NewContext(req, rec)
if assert.NoError(t, BodyLimit("2M")(h)(c)) {
assert.Equal(t, http.StatusOK, rec.Code)
assert.Equal(t, "Hello, World!", rec.Body.String())
}
// Based on content read (overlimit)
req = httptest.NewRequest(echo.POST, "/", bytes.NewReader(hw))
rec = httptest.NewRecorder()
c = e.NewContext(req, rec)
he = BodyLimit("2B")(h)(c).(*echo.HTTPError)
assert.Equal(t, http.StatusRequestEntityTooLarge, he.Code)
} | explode_data.jsonl/51374 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 508
} | [
2830,
3393,
5444,
16527,
1155,
353,
8840,
836,
8,
341,
7727,
1669,
1687,
7121,
741,
9598,
86,
1669,
3056,
3782,
445,
9707,
11,
4337,
22988,
24395,
1669,
54320,
70334,
75274,
2026,
958,
14721,
11,
64657,
5820,
68587,
73751,
1171,
67904,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestUnmarshalTypeMismatch(t *testing.T) {
result := pointerMarshalTestStruct{}
err := Unmarshal([]byte("List = 123"), &result)
if !strings.HasPrefix(err.Error(), "(1, 1): Can't convert 123(int64) to []string(slice)") {
t.Errorf("Type mismatch must be reported: got %v", err.Error())
}
} | explode_data.jsonl/46322 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 110
} | [
2830,
3393,
1806,
27121,
929,
82572,
1155,
353,
8840,
836,
8,
341,
9559,
1669,
7445,
55438,
2271,
9422,
16094,
9859,
1669,
1230,
27121,
10556,
3782,
445,
852,
284,
220,
16,
17,
18,
3975,
609,
1382,
340,
743,
753,
18594,
94357,
3964,
6... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
func TestContextNegotiationNotSupport(t *testing.T) {
w := httptest.NewRecorder()
c, _ := CreateTestContext(w)
c.Request, _ = http.NewRequest("POST", "", nil)
c.Negotiate(http.StatusOK, Negotiate{
Offered: []string{MIMEPOSTForm},
})
assert.Equal(t, http.StatusNotAcceptable, w.Code)
assert.Equal(t, c.index, abortIndex)
assert.True(t, c.IsAborted())
} | explode_data.jsonl/26805 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 145
} | [
2830,
3393,
1972,
47800,
354,
7101,
2623,
7916,
1155,
353,
8840,
836,
8,
341,
6692,
1669,
54320,
70334,
7121,
47023,
741,
1444,
11,
716,
1669,
4230,
2271,
1972,
3622,
340,
1444,
9659,
11,
716,
284,
1758,
75274,
445,
2946,
497,
7342,
2... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestPopRNGs(t *testing.T) {
var conf = NewDefaultGAConfig()
conf.NPops = 4
var ga, err = conf.NewGA()
if err != nil {
t.Errorf("Expected nil, got %v", err)
}
if err = ga.init(NewVector); err != nil {
t.Errorf("Expected nil, got %v", err)
}
for i, pop1 := range ga.Populations {
for j, pop2 := range ga.Populations {
if i != j && reflect.DeepEqual(pop1.RNG, pop2.RNG) {
t.Error("Population should not share random number generators")
}
}
}
} | explode_data.jsonl/82077 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 199
} | [
2830,
3393,
11598,
49,
6140,
82,
1155,
353,
8840,
836,
8,
341,
2405,
2335,
284,
1532,
3675,
16128,
2648,
741,
67850,
2067,
47,
3721,
284,
220,
19,
198,
2405,
13510,
11,
1848,
284,
2335,
7121,
16128,
741,
743,
1848,
961,
2092,
341,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 7 |
func TestCommandDoNotIgnoreFlags(t *testing.T) {
app := cli.NewApp()
set := flag.NewFlagSet("test", 0)
test := []string{"blah", "blah", "-break"}
set.Parse(test)
c := cli.NewContext(app, set, nil)
command := cli.Command{
Name: "test-cmd",
Aliases: []string{"tc"},
Usage: "this is for testing",
Description: "testing",
Action: func(_ *cli.Context) {},
}
err := command.Run(c)
expect(t, err.Error(), "flag provided but not defined: -break")
} | explode_data.jsonl/77567 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 203
} | [
2830,
3393,
4062,
5404,
2623,
12497,
9195,
1155,
353,
8840,
836,
8,
341,
28236,
1669,
21348,
7121,
2164,
741,
8196,
1669,
5181,
7121,
12135,
1649,
445,
1944,
497,
220,
15,
340,
18185,
1669,
3056,
917,
4913,
70614,
497,
330,
70614,
497,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestUseGetRoutersHookWhenInitialRouterFails(t *testing.T) {
tried := []string{}
pool := &poolFake{
borrow: func(names []string, cancel context.CancelFunc, _ log.BoltLogger) (db.Connection, error) {
tried = append(tried, names...)
return nil, errors.New("fail")
},
}
rootRouter := "rootRouter"
backupRouters := []string{"bup1", "bup2"}
router := New(rootRouter, func() []string { return backupRouters }, nil, pool, logger, "routerid")
dbName := "dbname"
// Trigger read of routing table
router.Readers(context.Background(), nil, dbName, nil)
expected := []string{rootRouter}
expected = append(expected, backupRouters...)
if !reflect.DeepEqual(tried, expected) {
t.Errorf("Didn't try the expected routers, tried: %#v", tried)
}
} | explode_data.jsonl/40051 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 279
} | [
2830,
3393,
10253,
1949,
49,
66095,
31679,
4498,
6341,
9523,
37,
6209,
1155,
353,
8840,
836,
8,
341,
25583,
1122,
1669,
3056,
917,
16094,
85273,
1669,
609,
10285,
52317,
515,
197,
2233,
7768,
25,
2915,
40401,
3056,
917,
11,
9121,
2266,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestMessageTransaction_ApplyStateChanges(t *testing.T) {
xmss := helper.GetAliceXMSS(6) // Master XMSS
message := "hello"
fee := uint64(1)
initialBalance := uint64(10000000)
xmssPK := misc.UCharVectorToBytes(xmss.PK())
messageTx := NewTestMessageTransaction(message, fee, xmssPK, nil)
assert.NotNil(t, messageTx.tx)
messageTx.tx.Sign(xmss, misc.BytesToUCharVector(messageTx.tx.GetHashableBytes()))
addressesState := make(map[string]*addressstate.AddressState)
messageTx.tx.SetAffectedAddress(addressesState)
assert.Len(t, addressesState, 1)
addressesState[xmss.QAddress()] = addressstate.GetDefaultAddressState(misc.UCharVectorToBytes(xmss.Address()))
// Initializing balance
addressesState[xmss.QAddress()].PBData().Balance = initialBalance
messageTx.tx.ApplyStateChanges(addressesState)
assert.Equal(t, addressesState[xmss.QAddress()].Balance(), initialBalance-fee)
} | explode_data.jsonl/10393 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 310
} | [
2830,
3393,
2052,
8070,
36117,
398,
1397,
11317,
1155,
353,
8840,
836,
8,
341,
10225,
76,
778,
1669,
13137,
2234,
61686,
52337,
1220,
7,
21,
8,
442,
10824,
51020,
1220,
198,
24753,
1669,
330,
14990,
698,
1166,
2127,
1669,
2622,
21,
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 TestNewClient(t *testing.T) {
t.Parallel()
client, err := newClient(t, address)
if err != nil {
t.Fatal(err)
}
if client == nil {
t.Fatal("New() returned nil client")
}
if err := client.Close(); err != nil {
t.Errorf("client closed returned errror %v", err)
}
} | explode_data.jsonl/37731 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 112
} | [
2830,
3393,
3564,
2959,
1155,
353,
8840,
836,
8,
341,
3244,
41288,
7957,
2822,
25291,
11,
1848,
1669,
501,
2959,
1155,
11,
2621,
340,
743,
1848,
961,
2092,
341,
197,
3244,
26133,
3964,
340,
197,
532,
743,
2943,
621,
2092,
341,
197,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 4 |
func TestUntar_SingleFile(t *testing.T) {
testdir, err := ioutil.TempDir("", "test-untar")
require.NoError(t, err)
defer os.RemoveAll(testdir)
dest := filepath.Join(testdir, "target")
buf := &bytes.Buffer{}
tw := tar.NewWriter(buf)
const (
srcName = "source"
content = "file contents"
)
hdr := &tar.Header{
Name: srcName,
Mode: 0666,
Size: int64(len(content)),
}
require.NoError(t, tw.WriteHeader(hdr))
_, err = tw.Write([]byte(content))
require.NoError(t, err)
tw.Close()
// Capture warnings to stderr for debugging.
output := (*testWriter)(t)
opts := NewCopyOptions(genericclioptions.IOStreams{In: &bytes.Buffer{}, Out: output, ErrOut: output})
require.NoError(t, opts.untarAll(buf, filepath.Join(dest), srcName))
cmpFileData(t, dest, content)
} | explode_data.jsonl/58297 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 308
} | [
2830,
3393,
20250,
277,
1098,
2173,
1703,
1155,
353,
8840,
836,
8,
341,
18185,
3741,
11,
1848,
1669,
43144,
65009,
6184,
19814,
330,
1944,
12,
3850,
277,
1138,
17957,
35699,
1155,
11,
1848,
340,
16867,
2643,
84427,
8623,
3741,
692,
4961... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func Test_Silent(t *testing.T) {
expected := ""
cmder.New(echo, foo).Logger(testLogger{}).Silent().LogCmd()
actual := silentStr
msg := fmt.Sprintf("Expected '%s' Got '%s'", expected, actual)
assert.Equal(t, expected, actual, msg)
} | explode_data.jsonl/70672 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 92
} | [
2830,
3393,
1098,
68414,
1155,
353,
8840,
836,
8,
341,
42400,
1669,
35829,
98316,
1107,
7121,
2026,
958,
11,
15229,
568,
7395,
8623,
7395,
6257,
568,
27571,
306,
1005,
2201,
15613,
2822,
88814,
1669,
21059,
2580,
198,
21169,
1669,
8879,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestValueToProto(t *testing.T) {
tests := []struct {
desc string
valueYAML string
want string
wantErr string
}{
{
desc: "K8s resources translation",
valueYAML: `
pilot:
enabled: true
rollingMaxSurge: 100%
rollingMaxUnavailable: 25%
resources:
requests:
cpu: 1000m
memory: 1G
replicaCount: 1
nodeSelector:
beta.kubernetes.io/os: linux
tolerations:
- key: dedicated
operator: Exists
effect: NoSchedule
- key: CriticalAddonsOnly
operator: Exists
autoscaleEnabled: true
autoscaleMax: 3
autoscaleMin: 1
cpu:
targetAverageUtilization: 80
traceSampling: 1.0
image: pilot
env:
GODEBUG: gctrace=1
podAntiAffinityLabelSelector:
- key: istio
operator: In
values: pilot
topologyKey: "kubernetes.io/hostname"
global:
hub: docker.io/istio
istioNamespace: istio-system
policyNamespace: istio-policy
tag: 1.2.3
telemetryNamespace: istio-telemetry
proxy:
readinessInitialDelaySeconds: 2
controlPlaneSecurityEnabled: false
mixer:
policy:
enabled: true
image: mixer
replicaCount: 1
telemetry:
enabled: false
`,
want: `
hub: docker.io/istio
tag: 1.2.3
meshConfig:
rootNamespace: istio-system
components:
telemetry:
enabled: false
policy:
enabled: true
k8s:
replicaCount: 1
pilot:
enabled: true
k8s:
replicaCount: 1
env:
- name: GODEBUG
value: gctrace=1
hpaSpec:
maxReplicas: 3
minReplicas: 1
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: istio-pilot
metrics:
- resource:
name: cpu
targetAverageUtilization: 80
type: Resource
nodeSelector:
beta.kubernetes.io/os: linux
tolerations:
- key: dedicated
operator: Exists
effect: NoSchedule
- key: CriticalAddonsOnly
operator: Exists
resources:
requests:
cpu: 1000m
memory: 1G
strategy:
rollingUpdate:
maxSurge: 100%
maxUnavailable: 25%
values:
global:
controlPlaneSecurityEnabled: false
proxy:
readinessInitialDelaySeconds: 2
policyNamespace: istio-policy
telemetryNamespace: istio-telemetry
pilot:
image: pilot
autoscaleEnabled: true
traceSampling: 1
podAntiAffinityLabelSelector:
- key: istio
operator: In
values: pilot
topologyKey: "kubernetes.io/hostname"
mixer:
policy:
image: mixer
`,
},
{
desc: "All Enabled",
valueYAML: `
global:
hub: docker.io/istio
istioNamespace: istio-system
policyNamespace: istio-policy
tag: 1.2.3
telemetryNamespace: istio-telemetry
mixer:
policy:
enabled: true
telemetry:
enabled: true
pilot:
enabled: true
istiocoredns:
enabled: true
gateways:
enabled: true
istio-ingressgateway:
rollingMaxSurge: 4
rollingMaxUnavailable: 1
resources:
requests:
cpu: 1000m
memory: 1G
enabled: true
`,
want: `
hub: docker.io/istio
tag: 1.2.3
meshConfig:
rootNamespace: istio-system
components:
telemetry:
enabled: true
policy:
enabled: true
pilot:
enabled: true
ingressGateways:
- name: istio-ingressgateway
enabled: true
k8s:
resources:
requests:
cpu: 1000m
memory: 1G
strategy:
rollingUpdate:
maxSurge: 4
maxUnavailable: 1
addonComponents:
istiocoredns:
enabled: true
values:
global:
policyNamespace: istio-policy
telemetryNamespace: istio-telemetry
`,
},
{
desc: "Some components Disabled",
valueYAML: `
pilot:
enabled: true
global:
hub: docker.io/istio
istioNamespace: istio-system
policyNamespace: istio-policy
tag: 1.2.3
telemetryNamespace: istio-telemetry
mixer:
policy:
enabled: true
telemetry:
enabled: false
`,
want: `
hub: docker.io/istio
tag: 1.2.3
components:
telemetry:
enabled: false
policy:
enabled: true
pilot:
enabled: true
meshConfig:
rootNamespace: istio-system
values:
global:
telemetryNamespace: istio-telemetry
policyNamespace: istio-policy
`,
},
}
tr, err := NewReverseTranslator(version.NewMinorVersion(1, 5))
if err != nil {
t.Fatalf("fail to get helm value.yaml translator: %v", err)
}
for _, tt := range tests {
t.Run(tt.desc, func(t *testing.T) {
valueStruct := v1alpha1.Values{}
err = util.UnmarshalValuesWithJSONPB(tt.valueYAML, &valueStruct, false)
if err != nil {
t.Fatalf("unmarshal(%s): got error %s", tt.desc, err)
}
scope.Debugf("value struct: \n%s\n", pretty.Sprint(valueStruct))
gotSpec, err := tr.TranslateFromValueToSpec([]byte(tt.valueYAML), false)
if gotErr, wantErr := errToString(err), tt.wantErr; gotErr != wantErr {
t.Errorf("ValuesToProto(%s)(%v): gotErr:%s, wantErr:%s", tt.desc, tt.valueYAML, gotErr, wantErr)
}
if tt.wantErr == "" {
ms := jsonpb.Marshaler{}
gotString, err := ms.MarshalToString(gotSpec)
if err != nil {
t.Errorf("failed to marshal translated IstioOperatorSpec: %s", err)
}
cpYaml, _ := yaml.JSONToYAML([]byte(gotString))
if want := tt.want; !util.IsYAMLEqual(gotString, want) {
t.Errorf("ValuesToProto(%s): got:\n%s\n\nwant:\n%s\nDiff:\n%s\n", tt.desc, string(cpYaml), want, util.YAMLDiff(gotString, want))
}
}
})
}
} | explode_data.jsonl/8376 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 2524
} | [
2830,
3393,
1130,
1249,
31549,
1155,
353,
8840,
836,
8,
341,
78216,
1669,
3056,
1235,
341,
197,
41653,
414,
914,
198,
197,
16309,
56,
31102,
914,
198,
197,
50780,
414,
914,
198,
197,
50780,
7747,
256,
914,
198,
197,
59403,
197,
197,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 6 |
func TestEngine_Digest(t *testing.T) {
e := MustOpenEngine(inmem.IndexName)
defer e.Close()
if err := e.Open(); err != nil {
t.Fatalf("failed to open tsm1 engine: %s", err.Error())
}
// Create a few points.
points := []models.Point{
MustParsePointString("cpu,host=A value=1.1 1000000000"),
MustParsePointString("cpu,host=B value=1.2 2000000000"),
}
if err := e.WritePoints(points); err != nil {
t.Fatalf("failed to write points: %s", err.Error())
}
// Force a compaction.
e.ScheduleFullCompaction()
digest := func() ([]span, error) {
// Get a reader for the shard's digest.
r, sz, err := e.Digest()
if err != nil {
return nil, err
}
if sz <= 0 {
t.Fatalf("expected digest size > 0")
}
// Make sure the digest can be read.
dr, err := tsm1.NewDigestReader(r)
if err != nil {
r.Close()
return nil, err
}
defer dr.Close()
_, err = dr.ReadManifest()
if err != nil {
t.Fatal(err)
}
got := []span{}
for {
k, s, err := dr.ReadTimeSpan()
if err == io.EOF {
break
} else if err != nil {
return nil, err
}
got = append(got, span{
key: k,
tspan: s,
})
}
return got, nil
}
exp := []span{
span{
key: "cpu,host=A#!~#value",
tspan: &tsm1.DigestTimeSpan{
Ranges: []tsm1.DigestTimeRange{
tsm1.DigestTimeRange{
Min: 1000000000,
Max: 1000000000,
N: 1,
CRC: 1048747083,
},
},
},
},
span{
key: "cpu,host=B#!~#value",
tspan: &tsm1.DigestTimeSpan{
Ranges: []tsm1.DigestTimeRange{
tsm1.DigestTimeRange{
Min: 2000000000,
Max: 2000000000,
N: 1,
CRC: 734984746,
},
},
},
},
}
for n := 0; n < 2; n++ {
got, err := digest()
if err != nil {
t.Fatalf("n = %d: %s", n, err)
}
// Make sure the data in the digest was valid.
if !reflect.DeepEqual(exp, got) {
t.Fatalf("n = %d\nexp = %v\ngot = %v\n", n, exp, got)
}
}
// Test that writing more points causes the digest to be updated.
points = []models.Point{
MustParsePointString("cpu,host=C value=1.1 3000000000"),
}
if err := e.WritePoints(points); err != nil {
t.Fatalf("failed to write points: %s", err.Error())
}
// Force a compaction.
e.ScheduleFullCompaction()
// Get new digest.
got, err := digest()
if err != nil {
t.Fatal(err)
}
exp = append(exp, span{
key: "cpu,host=C#!~#value",
tspan: &tsm1.DigestTimeSpan{
Ranges: []tsm1.DigestTimeRange{
tsm1.DigestTimeRange{
Min: 3000000000,
Max: 3000000000,
N: 1,
CRC: 2553233514,
},
},
},
})
if !reflect.DeepEqual(exp, got) {
t.Fatalf("\nexp = %v\ngot = %v\n", exp, got)
}
} | explode_data.jsonl/28079 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 1284
} | [
2830,
3393,
4571,
1557,
15153,
1155,
353,
8840,
836,
8,
341,
7727,
1669,
15465,
5002,
4571,
5900,
10536,
18338,
675,
340,
16867,
384,
10421,
2822,
743,
1848,
1669,
384,
12953,
2129,
1848,
961,
2092,
341,
197,
3244,
30762,
445,
16091,
31... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestPutSnaplink(t *testing.T) {
storageClient := MockStorageClient()
do := func(ctx context.Context, sc *storage.StorageClient) error {
defer testutils.DeactivateClient()
return sc.SnapLinks().Put(ctx, &storage.PutSnapLinkInput{
LinkPath: linkPath,
SourcePath: sourcePath,
})
}
t.Run("successful", func(t *testing.T) {
testutils.RegisterResponder("PUT", path.Join("/", accountUrl, linkPath), putSnapLinkSuccess)
err := do(context.Background(), storageClient)
if err != nil {
t.Fatal(err)
}
})
t.Run("error", func(t *testing.T) {
testutils.RegisterResponder("PUT", path.Join("/", accountUrl, brokenLinkPath), putSnapLinkError)
err := do(context.Background(), storageClient)
if err == nil {
t.Fatal(err)
}
if !strings.Contains(err.Error(), "unable to put snaplink") {
t.Errorf("expected error to equal testError: found %v", err)
}
})
} | explode_data.jsonl/21239 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 332
} | [
2830,
3393,
19103,
61871,
2080,
1155,
353,
8840,
836,
8,
341,
197,
16172,
2959,
1669,
14563,
5793,
2959,
2822,
19935,
1669,
2915,
7502,
2266,
9328,
11,
1136,
353,
16172,
43771,
2959,
8,
1465,
341,
197,
16867,
1273,
6031,
8934,
16856,
29... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func Test_readFromSecret(t *testing.T) {
testCases := []struct {
content string
expectedErr bool
expectedValue string
}{
{
"value\n",
false,
"value",
},
{
" \t\n Hello, Gophers \n\t\r\n",
false,
"Hello, Gophers",
},
}
for _, testCase := range testCases {
testCase := testCase
t.Run("", func(t *testing.T) {
tmpfile, err := ioutil.TempFile("", "testfile")
if err != nil {
t.Error(err)
}
tmpfile.WriteString(testCase.content)
tmpfile.Sync()
tmpfile.Close()
value, err := readFromSecret(tmpfile.Name())
if err != nil && !testCase.expectedErr {
t.Error(err)
}
if err == nil && testCase.expectedErr {
t.Error(errors.New("expected error, found success"))
}
if value != testCase.expectedValue {
t.Errorf("Expected %s, got %s", testCase.expectedValue, value)
}
})
}
} | explode_data.jsonl/24505 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 392
} | [
2830,
3393,
6443,
3830,
19773,
1155,
353,
8840,
836,
8,
341,
18185,
37302,
1669,
3056,
1235,
341,
197,
27751,
981,
914,
198,
197,
42400,
7747,
256,
1807,
198,
197,
42400,
1130,
914,
198,
197,
59403,
197,
197,
515,
298,
197,
63307,
169... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 Test5RendersLP(t *testing.T) {
const nTiles = 15
rpool, err := NewRenderPool(sampledata.SlaveCmd, 5, 0, nTiles, 0, executionTimeout)
require.Nil(t, err)
coord := gopnik.TileCoord{
X: 0,
Y: 0,
Zoom: 1,
Size: 1,
}
ansCh := make(chan *RenderPoolResponse)
for i := 0; i < nTiles; i++ {
err = rpool.EnqueueRequest(coord, ansCh, gopnikrpc.Priority_LOW)
require.Nil(t, err)
}
for i := 0; i < nTiles; i++ {
ans := <-ansCh
require.Nil(t, ans.Error)
require.Equal(t, len(ans.Tiles), 1)
sampledata.CheckTile(t, ans.Tiles[0].Image, "1_0_0.png")
}
} | explode_data.jsonl/50616 | {
"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,
20,
49,
14506,
12567,
1155,
353,
8840,
836,
8,
341,
4777,
308,
58365,
284,
220,
16,
20,
271,
7000,
10285,
11,
1848,
1669,
1532,
6750,
10551,
32968,
691,
808,
75,
523,
15613,
11,
220,
20,
11,
220,
15,
11,
308,
58365,
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 Test_removeUnspecifiedValueWhenEmpty(t *testing.T) {
var values = make([]*gendoc.EnumValue, 0)
var fixture = gendoc.Enum{
Values: values,
}
removeUnspecifiedValue(&fixture)
require.Len(t, fixture.Values, 0, "size should be 0")
} | explode_data.jsonl/2455 | {
"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,
18193,
1806,
53434,
1130,
4498,
3522,
1155,
353,
8840,
836,
8,
341,
2405,
2750,
284,
1281,
85288,
57064,
509,
43225,
1130,
11,
220,
15,
340,
2405,
12507,
284,
342,
408,
509,
43225,
515,
197,
197,
6227,
25,
2750,
345,
197,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestSetTemplate(t *testing.T) {
testKey := "testSetKey"
testValue := &template.Template{}
templateMap[testKey] = testValue
SetTemplate(testKey, testValue)
if _, ok := templateMap[testKey]; !ok {
t.Errorf("key %s must not in templateMap %v", testKey, templateMap)
}
} | explode_data.jsonl/69674 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 101
} | [
2830,
3393,
1649,
7275,
1155,
353,
8840,
836,
8,
341,
18185,
1592,
1669,
330,
1944,
1649,
1592,
698,
18185,
1130,
1669,
609,
4214,
52530,
16094,
22832,
2227,
72626,
1592,
60,
284,
1273,
1130,
271,
22212,
7275,
8623,
1592,
11,
1273,
1130... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestCalcFrozen(t *testing.T) {
types.SetTitleOnlyForTest("chain33")
m, err := newMeans("LeftProportion", 15000000)
assert.Nil(t, err)
assert.NotNil(t, m)
cases := []struct {
start int64
now int64
period int64
total int64
tenThousandth int64
expect int64
}{
{10000, 10001, 10, 10000, 2, 9998},
{10000, 10011, 10, 10000, 2, 9996},
{10000, 10001, 10, 1e17, 2, 9998 * 1e13},
{10000, 10011, 10, 1e17, 2, 9998 * 9998 * 1e9},
}
for _, c := range cases {
c := c
t.Run("test LeftProportion", func(t *testing.T) {
create := pty.UnfreezeCreate{
StartTime: c.start,
AssetExec: "coins",
AssetSymbol: "bty",
TotalCount: c.total,
Beneficiary: "x",
Means: "LeftProportion",
MeansOpt: &pty.UnfreezeCreate_LeftProportion{
LeftProportion: &pty.LeftProportion{
Period: c.period,
TenThousandth: c.tenThousandth,
},
},
}
u := &pty.Unfreeze{
TotalCount: c.total,
Means: "LeftProportion",
StartTime: c.start,
MeansOpt: &pty.Unfreeze_LeftProportion{
LeftProportion: &pty.LeftProportion{
Period: c.period,
TenThousandth: c.tenThousandth,
},
},
}
u, err = m.setOpt(u, &create)
assert.Nil(t, err)
f, err := m.calcFrozen(u, c.now)
assert.Nil(t, err)
assert.Equal(t, c.expect, f)
})
}
} | explode_data.jsonl/22551 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 720
} | [
2830,
3393,
47168,
91318,
1155,
353,
8840,
836,
8,
341,
98785,
4202,
3851,
7308,
2461,
2271,
445,
8819,
18,
18,
1138,
2109,
11,
1848,
1669,
501,
83402,
445,
5415,
1336,
15388,
497,
220,
16,
20,
15,
15,
15,
15,
15,
15,
340,
6948,
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 TestBatchPointGetAlreadyLocked(t *testing.T) {
store, clean := createMockStoreAndSetup(t)
defer clean()
tk := testkit.NewTestKit(t, store)
tk.MustExec("use test")
tk.MustExec("drop table if exists t")
tk.MustExec("create table t (c1 int, c2 int, c3 int, primary key(c1, c2))")
tk.MustExec("insert t values (1, 1, 1), (2, 2, 2)")
tk.MustExec("begin pessimistic")
tk.MustQuery("select * from t where c1 > 1 for update").Check(testkit.Rows("2 2 2"))
tk.MustQuery("select * from t where (c1, c2) in ((2,2)) for update").Check(testkit.Rows("2 2 2"))
tk.MustExec("commit")
} | explode_data.jsonl/12480 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 226
} | [
2830,
3393,
21074,
2609,
1949,
38370,
49010,
1155,
353,
8840,
836,
8,
341,
57279,
11,
4240,
1669,
1855,
11571,
6093,
3036,
21821,
1155,
340,
16867,
4240,
2822,
3244,
74,
1669,
1273,
8226,
7121,
2271,
7695,
1155,
11,
3553,
340,
3244,
74,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func Test_ErrAddrMismatch(t *testing.T) {
e := &errAddrMismatch{
Expected: &testaddr{
tcp: true,
addr: "127.0.0.1",
},
Actual: &testaddr{
tcp: true,
addr: "0.0.0.0",
},
}
err := error(e)
expected := "address mismatch; expected: tcp:127.0.0.1; actual: tcp:0.0.0.0"
if err.Error() != expected {
t.Errorf(
"expected error message to be %q; got %q",
expected,
err.Error(),
)
}
} | explode_data.jsonl/51608 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 209
} | [
2830,
3393,
93623,
13986,
82572,
1155,
353,
8840,
836,
8,
341,
7727,
1669,
609,
615,
13986,
82572,
515,
197,
197,
18896,
25,
609,
1944,
6214,
515,
298,
3244,
4672,
25,
220,
830,
345,
298,
53183,
25,
330,
16,
17,
22,
13,
15,
13,
15... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
func TestServerUnreadRequestBodyLarge(t *testing.T) {
if testing.Short() && testenv.Builder() == "" {
t.Log("skipping in short mode")
}
conn := new(testConn)
body := strings.Repeat("x", 1<<20)
conn.readBuf.Write([]byte(fmt.Sprintf(
"POST / HTTP/1.1\r\n"+
"Host: test\r\n"+
"Content-Length: %d\r\n"+
"\r\n", len(body))))
conn.readBuf.Write([]byte(body))
conn.closec = make(chan bool, 1)
ls := &oneConnListener{conn}
go Serve(ls, HandlerFunc(func(rw ResponseWriter, req *Request) {
if conn.readBuf.Len() < len(body)/2 {
t.Errorf("on request, read buffer length is %d; expected about 1MB", conn.readBuf.Len())
}
rw.WriteHeader(200)
rw.(Flusher).Flush()
if conn.readBuf.Len() < len(body)/2 {
t.Errorf("post-WriteHeader, read buffer length is %d; expected about 1MB", conn.readBuf.Len())
}
}))
<-conn.closec
if res := conn.writeBuf.String(); !strings.Contains(res, "Connection: close") {
t.Errorf("Expected a Connection: close header; got response: %s", res)
}
} | explode_data.jsonl/22416 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 415
} | [
2830,
3393,
5475,
1806,
878,
33334,
34253,
1155,
353,
8840,
836,
8,
341,
743,
7497,
55958,
368,
1009,
1273,
3160,
15641,
368,
621,
1591,
341,
197,
3244,
5247,
445,
4886,
5654,
304,
2805,
3856,
1138,
197,
532,
32917,
1669,
501,
8623,
9... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestDecorate(t *testing.T) {
gCSCredentialsSecret := "gcs-secret"
defaultServiceAccountName := "default-sa"
censor := true
var testCases = []struct {
name string
spec *coreapi.PodSpec
pj *prowapi.ProwJob
rawEnv map[string]string
outputDir string
}{
{
name: "basic happy case",
spec: &coreapi.PodSpec{
Volumes: []coreapi.Volume{
{Name: "secret", VolumeSource: coreapi.VolumeSource{Secret: &coreapi.SecretVolumeSource{SecretName: "secretname"}}},
},
Containers: []coreapi.Container{
{Name: "test", Command: []string{"/bin/ls"}, Args: []string{"-l", "-a"}, VolumeMounts: []coreapi.VolumeMount{{Name: "secret", MountPath: "/secret"}}},
},
ServiceAccountName: "tester",
},
pj: &prowapi.ProwJob{
Spec: prowapi.ProwJobSpec{
DecorationConfig: &prowapi.DecorationConfig{
Timeout: &prowapi.Duration{Duration: time.Minute},
GracePeriod: &prowapi.Duration{Duration: time.Hour},
UtilityImages: &prowapi.UtilityImages{
CloneRefs: "cloneimage",
InitUpload: "initimage",
Entrypoint: "entrypointimage",
Sidecar: "sidecarimage",
},
Resources: &prowapi.Resources{
CloneRefs: &coreapi.ResourceRequirements{Limits: coreapi.ResourceList{"cpu": resource.Quantity{}}, Requests: coreapi.ResourceList{"memory": resource.Quantity{}}},
InitUpload: &coreapi.ResourceRequirements{Limits: coreapi.ResourceList{"cpu": resource.Quantity{}}, Requests: coreapi.ResourceList{"memory": resource.Quantity{}}},
PlaceEntrypoint: &coreapi.ResourceRequirements{Limits: coreapi.ResourceList{"cpu": resource.Quantity{}}, Requests: coreapi.ResourceList{"memory": resource.Quantity{}}},
Sidecar: &coreapi.ResourceRequirements{Limits: coreapi.ResourceList{"cpu": resource.Quantity{}}, Requests: coreapi.ResourceList{"memory": resource.Quantity{}}},
},
GCSConfiguration: &prowapi.GCSConfiguration{
Bucket: "bucket",
PathStrategy: "single",
DefaultOrg: "org",
DefaultRepo: "repo",
},
GCSCredentialsSecret: &gCSCredentialsSecret,
DefaultServiceAccountName: &defaultServiceAccountName,
},
Refs: &prowapi.Refs{
Org: "org", Repo: "repo", BaseRef: "main", BaseSHA: "abcd1234",
Pulls: []prowapi.Pull{{Number: 1, SHA: "aksdjhfkds"}},
},
ExtraRefs: []prowapi.Refs{{Org: "other", Repo: "something", BaseRef: "release", BaseSHA: "sldijfsd"}},
},
},
rawEnv: map[string]string{"custom": "env"},
},
{
name: "censor secrets in sidecar",
spec: &coreapi.PodSpec{
Volumes: []coreapi.Volume{
{Name: "secret", VolumeSource: coreapi.VolumeSource{Secret: &coreapi.SecretVolumeSource{SecretName: "secretname"}}},
},
Containers: []coreapi.Container{
{Name: "test", Command: []string{"/bin/ls"}, Args: []string{"-l", "-a"}, VolumeMounts: []coreapi.VolumeMount{{Name: "secret", MountPath: "/secret"}}},
},
ServiceAccountName: "tester",
},
pj: &prowapi.ProwJob{
Spec: prowapi.ProwJobSpec{
DecorationConfig: &prowapi.DecorationConfig{
Timeout: &prowapi.Duration{Duration: time.Minute},
GracePeriod: &prowapi.Duration{Duration: time.Hour},
UtilityImages: &prowapi.UtilityImages{
CloneRefs: "cloneimage",
InitUpload: "initimage",
Entrypoint: "entrypointimage",
Sidecar: "sidecarimage",
},
Resources: &prowapi.Resources{
CloneRefs: &coreapi.ResourceRequirements{Limits: coreapi.ResourceList{"cpu": resource.Quantity{}}, Requests: coreapi.ResourceList{"memory": resource.Quantity{}}},
InitUpload: &coreapi.ResourceRequirements{Limits: coreapi.ResourceList{"cpu": resource.Quantity{}}, Requests: coreapi.ResourceList{"memory": resource.Quantity{}}},
PlaceEntrypoint: &coreapi.ResourceRequirements{Limits: coreapi.ResourceList{"cpu": resource.Quantity{}}, Requests: coreapi.ResourceList{"memory": resource.Quantity{}}},
Sidecar: &coreapi.ResourceRequirements{Limits: coreapi.ResourceList{"cpu": resource.Quantity{}}, Requests: coreapi.ResourceList{"memory": resource.Quantity{}}},
},
GCSConfiguration: &prowapi.GCSConfiguration{
Bucket: "bucket",
PathStrategy: "single",
DefaultOrg: "org",
DefaultRepo: "repo",
},
GCSCredentialsSecret: &gCSCredentialsSecret,
DefaultServiceAccountName: &defaultServiceAccountName,
CensorSecrets: &censor,
},
Refs: &prowapi.Refs{
Org: "org", Repo: "repo", BaseRef: "main", BaseSHA: "abcd1234",
Pulls: []prowapi.Pull{{Number: 1, SHA: "aksdjhfkds"}},
},
ExtraRefs: []prowapi.Refs{{Org: "other", Repo: "something", BaseRef: "release", BaseSHA: "sldijfsd"}},
},
},
rawEnv: map[string]string{"custom": "env"},
},
}
for _, testCase := range testCases {
t.Run(testCase.name, func(t *testing.T) {
if err := decorate(testCase.spec, testCase.pj, testCase.rawEnv, testCase.outputDir); err != nil {
t.Fatalf("got an error from decorate(): %v", err)
}
testutil.CompareWithSerializedFixture(t, testCase.spec)
})
}
} | explode_data.jsonl/79317 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 2194
} | [
2830,
3393,
35227,
349,
1155,
353,
8840,
836,
8,
341,
3174,
34,
3540,
15735,
19773,
1669,
330,
70,
4837,
68892,
698,
11940,
1860,
7365,
675,
1669,
330,
2258,
1331,
64,
698,
1444,
3805,
1669,
830,
198,
2405,
1273,
37302,
284,
3056,
123... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestTable_IsEqual(t *testing.T) {
table := Table{
{{"a"}, {"b", "c"}},
{{"b"}, {"a", "c"}},
{{"c"}, {"a", "b"}},
}
cases := []struct {
tcmp Table
exp bool
}{{
// Empty.
}, {
tcmp: table,
exp: true,
}, {
tcmp: Table{
{{"c"}, {"a", "b"}},
{{"a"}, {"b", "c"}},
{{"b"}, {"a", "c"}},
},
exp: true,
}, {
tcmp: Table{
{{"c"}, {"a", "b"}},
{{"a"}, {"b", "c"}},
},
}, {
tcmp: Table{
{{"b"}, {"a", "b"}},
{{"c"}, {"a", "b"}},
{{"a"}, {"b", "c"}},
},
}}
for _, c := range cases {
got := table.IsEqual(c.tcmp)
test.Assert(t, "", c.exp, got)
}
} | explode_data.jsonl/58598 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 342
} | [
2830,
3393,
2556,
31879,
2993,
1155,
353,
8840,
836,
8,
341,
26481,
1669,
6633,
515,
197,
197,
2979,
1,
64,
14345,
5212,
65,
497,
330,
66,
48085,
197,
197,
2979,
1,
65,
14345,
5212,
64,
497,
330,
66,
48085,
197,
197,
2979,
1,
66,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
func TestConfigSelect_Service(t *testing.T) {
appName := "myapp"
testCases := map[string]struct {
setupMocks func(m configSelectMocks)
wantErr error
want string
}{
"with no services": {
setupMocks: func(m configSelectMocks) {
m.workloadLister.
EXPECT().
ListServices(gomock.Eq(appName)).
Return([]*config.Workload{}, nil).
Times(1)
m.prompt.
EXPECT().
SelectOne(gomock.Any(), gomock.Any(), gomock.Any()).
Times(0)
},
wantErr: fmt.Errorf("no services found in app myapp"),
},
"with only one service (skips prompting)": {
setupMocks: func(m configSelectMocks) {
m.workloadLister.
EXPECT().
ListServices(gomock.Eq(appName)).
Return([]*config.Workload{
{
App: appName,
Name: "service1",
Type: "load balanced web service",
},
}, nil).
Times(1)
m.prompt.
EXPECT().
SelectOne(gomock.Any(), gomock.Any(), gomock.Any()).
Times(0)
},
want: "service1",
},
"with multiple services": {
setupMocks: func(m configSelectMocks) {
m.workloadLister.
EXPECT().
ListServices(gomock.Eq(appName)).
Return([]*config.Workload{
{
App: appName,
Name: "service1",
Type: "load balanced web service",
},
{
App: appName,
Name: "service2",
Type: "backend service",
},
}, nil).
Times(1)
m.prompt.
EXPECT().
SelectOne(
gomock.Eq("Select a service"),
gomock.Eq("Help text"),
gomock.Eq([]string{"service1", "service2"})).
Return("service2", nil).
Times(1)
},
want: "service2",
},
"with error selecting services": {
setupMocks: func(m configSelectMocks) {
m.workloadLister.
EXPECT().
ListServices(gomock.Eq(appName)).
Return([]*config.Workload{
{
App: appName,
Name: "service1",
Type: "load balanced web service",
},
{
App: appName,
Name: "service2",
Type: "backend service",
},
}, nil).
Times(1)
m.prompt.
EXPECT().
SelectOne(gomock.Any(), gomock.Any(), gomock.Eq([]string{"service1", "service2"})).
Return("", fmt.Errorf("error selecting")).
Times(1)
},
wantErr: fmt.Errorf("select service: error selecting"),
},
}
for name, tc := range testCases {
t.Run(name, func(t *testing.T) {
ctrl := gomock.NewController(t)
defer ctrl.Finish()
mockconfigLister := mocks.NewMockConfigLister(ctrl)
mockprompt := mocks.NewMockPrompter(ctrl)
mocks := configSelectMocks{
workloadLister: mockconfigLister,
prompt: mockprompt,
}
tc.setupMocks(mocks)
sel := ConfigSelect{
Select: &Select{
prompt: mockprompt,
},
workloadLister: mockconfigLister,
}
got, err := sel.Service("Select a service", "Help text", appName)
if tc.wantErr != nil {
require.EqualError(t, tc.wantErr, err.Error())
} else {
require.Equal(t, tc.want, got)
}
})
}
} | explode_data.jsonl/44893 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 1492
} | [
2830,
3393,
2648,
3379,
52548,
1155,
353,
8840,
836,
8,
341,
28236,
675,
1669,
330,
2408,
676,
698,
18185,
37302,
1669,
2415,
14032,
60,
1235,
341,
197,
84571,
72577,
2915,
1255,
2193,
3379,
72577,
340,
197,
50780,
7747,
262,
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 |
func TestDeleteVolumeRecovery(t *testing.T) {
const (
backendName = "deleteRecoveryBackend"
scName = "deleteRecoveryBackendSC"
fullVolumeName = "deleteRecoveryVolumeFull"
txOnlyVolumeName = "deleteRecoveryVolumeTxOnly"
)
orchestrator := getOrchestrator(t)
prepRecoveryTest(t, orchestrator, backendName, scName)
// For the full test, we delete everything but the ending transaction.
fullVolumeConfig := tu.GenerateVolumeConfig(fullVolumeName, 50, scName, config.File)
if _, err := orchestrator.AddVolume(ctx(), fullVolumeConfig); err != nil {
t.Fatal("Unable to add volume: ", err)
}
if err := orchestrator.DeleteVolume(ctx(), fullVolumeName); err != nil {
t.Fatal("Unable to remove full volume: ", err)
}
txOnlyVolumeConfig := tu.GenerateVolumeConfig(txOnlyVolumeName, 50, scName, config.File)
if _, err := orchestrator.AddVolume(ctx(), txOnlyVolumeConfig); err != nil {
t.Fatal("Unable to add tx only volume: ", err)
}
// BEGIN actual test
runRecoveryTests(
t, orchestrator, backendName,
storage.DeleteVolume, []recoveryTest{
{name: "full", volumeConfig: fullVolumeConfig, expectDestroy: false},
{name: "txOnly", volumeConfig: txOnlyVolumeConfig, expectDestroy: true},
},
)
cleanup(t, orchestrator)
} | explode_data.jsonl/62728 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 435
} | [
2830,
3393,
6435,
18902,
693,
7449,
1155,
353,
8840,
836,
8,
341,
4777,
2399,
197,
197,
20942,
675,
414,
284,
330,
4542,
693,
7449,
29699,
698,
197,
29928,
675,
1843,
284,
330,
4542,
693,
7449,
29699,
3540,
698,
197,
94042,
18902,
675... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestQueryParams(t *testing.T) {
var g generator
g.apiName = "Awesome Mollusc API"
g.imports = map[pbinfo.ImportSpec]bool{}
g.opts = &options{transports: []transport{rest}}
for _, tst := range []struct {
name string
body string
url string
fields []string
expected map[string]*descriptor.FieldDescriptorProto
}{
{
name: "all_params_are_path",
url: "/kingdom/{kingdom}",
fields: []string{"kingdom"},
expected: map[string]*descriptor.FieldDescriptorProto{},
},
{
name: "no_fields",
url: "/kingdom/{kingdom}",
fields: []string{},
expected: map[string]*descriptor.FieldDescriptorProto{},
},
{
name: "no_path_params",
body: "guess",
url: "/kingdom",
fields: []string{"mass_kg", "guess"},
expected: map[string]*descriptor.FieldDescriptorProto{
"mass_kg": &descriptor.FieldDescriptorProto{
Name: proto.String("mass_kg"),
Number: proto.Int32(int32(0)),
Type: typep(descriptor.FieldDescriptorProto_TYPE_INT32),
},
},
},
{
name: "path_query_param_mix",
body: "guess",
url: "/kingdom/{kingdom}/phylum/{phylum}",
fields: []string{"kingdom", "phylum", "mass_kg", "guess"},
expected: map[string]*descriptor.FieldDescriptorProto{
"mass_kg": &descriptor.FieldDescriptorProto{
Name: proto.String("mass_kg"),
Number: proto.Int32(int32(2)),
Type: typep(descriptor.FieldDescriptorProto_TYPE_INT32),
},
},
},
} {
mthd, err := setupMethod(&g, tst.url, tst.body, tst.fields)
if err != nil {
t.Errorf("test %s setup got error: %s", tst.name, err.Error())
}
actual := g.queryParams(mthd)
if diff := cmp.Diff(actual, tst.expected, cmp.Comparer(proto.Equal)); diff != "" {
t.Errorf("test %s, got(-),want(+):\n%s", tst.name, diff)
}
}
} | explode_data.jsonl/32018 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 858
} | [
2830,
3393,
2859,
4870,
1155,
353,
8840,
836,
8,
341,
2405,
342,
13823,
198,
3174,
6183,
675,
284,
330,
26899,
386,
965,
25034,
5333,
698,
3174,
34897,
82,
284,
2415,
11407,
65,
2733,
67275,
8327,
96436,
16094,
3174,
56022,
284,
609,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 4 |
func TestRetryBackoffArgs(t *testing.T) {
const resCode = http.StatusInternalServerError
ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Replay-Nonce", "test-nonce")
w.WriteHeader(resCode)
}))
defer ts.Close()
// Canceled in backoff.
ctx, cancel := context.WithCancel(context.Background())
var nretry int
backoff := func(n int, r *http.Request, res *http.Response) time.Duration {
nretry++
if n != nretry {
t.Errorf("n = %d; want %d", n, nretry)
}
if nretry == 3 {
cancel()
}
if r == nil {
t.Error("r is nil")
}
if res.StatusCode != resCode {
t.Errorf("res.StatusCode = %d; want %d", res.StatusCode, resCode)
}
return time.Millisecond
}
client := &Client{
Key: testKey,
RetryBackoff: backoff,
dir: &Directory{AuthzURL: ts.URL},
}
if _, err := client.Authorize(ctx, "example.com"); err == nil {
t.Error("err is nil")
}
if nretry != 3 {
t.Errorf("nretry = %d; want 3", nretry)
}
} | explode_data.jsonl/38189 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 444
} | [
2830,
3393,
51560,
3707,
1847,
4117,
1155,
353,
8840,
836,
8,
341,
4777,
592,
2078,
284,
1758,
66760,
198,
57441,
1669,
54320,
70334,
7121,
5475,
19886,
89164,
18552,
3622,
1758,
37508,
11,
435,
353,
1254,
9659,
8,
341,
197,
6692,
15753... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestImageRef_Resize__Error(t *testing.T) {
Startup(nil)
image, err := NewImageFromFile(resources + "png-24bit.png")
require.NoError(t, err)
defer image.Close()
err = image.Resize(-1, KernelLanczos3)
require.Error(t, err)
} | explode_data.jsonl/38817 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 93
} | [
2830,
3393,
1906,
3945,
62,
30561,
563,
1454,
1155,
353,
8840,
836,
8,
341,
197,
39076,
27907,
692,
31426,
11,
1848,
1669,
1532,
1906,
43633,
52607,
488,
330,
14066,
12,
17,
19,
4489,
3508,
1138,
17957,
35699,
1155,
11,
1848,
340,
168... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestDeferredDiscoveryRESTMapper_CacheMiss(t *testing.T) {
assert := assert.New(t)
cdc := fakeCachedDiscoveryInterface{fresh: false}
m := NewDeferredDiscoveryRESTMapper(&cdc, nil)
assert.False(cdc.fresh, "should NOT be fresh after instantiation")
assert.Zero(cdc.invalidateCalls, "should not have called Invalidate()")
gvk, err := m.KindFor(schema.GroupVersionResource{
Group: "a",
Version: "v1",
Resource: "foo",
})
assert.NoError(err)
assert.True(cdc.fresh, "should be fresh after a cache-miss")
assert.Equal(cdc.invalidateCalls, 1, "should have called Invalidate() once")
assert.Equal(gvk.Kind, "Foo")
gvk, err = m.KindFor(schema.GroupVersionResource{
Group: "a",
Version: "v1",
Resource: "foo",
})
assert.NoError(err)
assert.Equal(cdc.invalidateCalls, 1, "should NOT have called Invalidate() again")
gvk, err = m.KindFor(schema.GroupVersionResource{
Group: "a",
Version: "v1",
Resource: "bar",
})
assert.Error(err)
assert.Equal(cdc.invalidateCalls, 1, "should NOT have called Invalidate() again after another cache-miss, but with fresh==true")
cdc.fresh = false
gvk, err = m.KindFor(schema.GroupVersionResource{
Group: "a",
Version: "v1",
Resource: "bar",
})
assert.Error(err)
assert.Equal(cdc.invalidateCalls, 2, "should HAVE called Invalidate() again after another cache-miss, but with fresh==false")
} | explode_data.jsonl/14798 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 532
} | [
2830,
3393,
88417,
67400,
38307,
10989,
920,
1777,
35312,
1155,
353,
8840,
836,
8,
341,
6948,
1669,
2060,
7121,
1155,
692,
1444,
7628,
1669,
12418,
70293,
67400,
5051,
90,
71308,
25,
895,
532,
2109,
1669,
1532,
88417,
67400,
38307,
10989,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestSetNumInstances(t *testing.T) {
c := aetesting.FakeSingleContext(t, "modules", "SetNumInstances", func(req *pb.SetNumInstancesRequest, res *pb.SetNumInstancesResponse) error {
if *req.Module != module {
t.Errorf("Module = %v, want %v", req.Module, module)
}
if *req.Version != version {
t.Errorf("Version = %v, want %v", req.Version, version)
}
if *req.Instances != instances {
t.Errorf("Instances = %v, want %d", req.Instances, instances)
}
return nil
})
err := SetNumInstances(c, module, version, instances)
if err != nil {
t.Fatalf("SetNumInstances: %v", err)
}
} | explode_data.jsonl/54563 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 253
} | [
2830,
3393,
1649,
4651,
42725,
1155,
353,
8840,
836,
8,
972,
1444,
1669,
264,
57824,
287,
991,
726,
10888,
1972,
1155,
11,
330,
11525,
497,
330,
1649,
4651,
42725,
497,
2915,
6881,
353,
16650,
4202,
4651,
42725,
1900,
11,
592,
353,
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... | 4 |
func TestMetricDescriptor_LabelsMap(t *testing.T) {
ms := NewMetricDescriptor()
ms.InitEmpty()
assert.EqualValues(t, NewStringMap(), ms.LabelsMap())
fillTestStringMap(ms.LabelsMap())
testValLabelsMap := generateTestStringMap()
assert.EqualValues(t, testValLabelsMap, ms.LabelsMap())
} | explode_data.jsonl/19522 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 107
} | [
2830,
3393,
54310,
11709,
53557,
82,
2227,
1155,
353,
8840,
836,
8,
341,
47691,
1669,
1532,
54310,
11709,
741,
47691,
26849,
3522,
741,
6948,
12808,
6227,
1155,
11,
1532,
703,
2227,
1507,
9829,
4679,
82,
2227,
2398,
65848,
2271,
703,
22... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestIssue1008(t *testing.T) {
skipOn(t, "broken - cgo stacktraces", "386")
protest.MustHaveCgo(t)
// The external linker on macOS inserts "end of sequence" extended opcodes
// in debug_line. which we should support correctly.
withTestProcess("cgostacktest/", t, func(p *proc.Target, fixture protest.Fixture) {
setFunctionBreakpoint(p, t, "main.main")
assertNoError(p.Continue(), t, "Continue()")
loc, err := p.CurrentThread().Location()
assertNoError(err, t, "CurrentThread().Location()")
t.Logf("location %v\n", loc)
if !strings.HasSuffix(loc.File, "/main.go") {
t.Errorf("unexpected location %s:%d\n", loc.File, loc.Line)
}
if loc.Line > 31 {
t.Errorf("unexpected location %s:%d (file only has 30 lines)\n", loc.File, loc.Line)
}
})
} | explode_data.jsonl/56300 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 295
} | [
2830,
3393,
42006,
16,
15,
15,
23,
1155,
353,
8840,
836,
8,
341,
1903,
13389,
1925,
1155,
11,
330,
48909,
481,
272,
3346,
5611,
376,
2434,
497,
330,
18,
23,
21,
1138,
197,
776,
1944,
50463,
12116,
34,
3346,
1155,
692,
197,
322,
57... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestOptions(t *testing.T) {
path, err := ioutil.TempDir(os.TempDir(), "testing_badger_")
if err != nil {
t.Fatal(err)
}
opts := DefaultOptions
opts.GcSleep = 0
opts.GcInterval = time.Second
opts.TTL = time.Minute
d, err := NewDatastore(path, &opts)
if err != nil {
t.Fatal(err)
}
if d.gcSleep != d.gcInterval {
t.Fatal("expected gcSleep=0 to get set to gcInterval")
}
if d.ttl != time.Minute {
t.Fatal("datastore ttl not set")
}
ratio := 0.5
interval := 2 * time.Second
sleep := 3 * time.Second
ttl := 4 * time.Second
o := DefaultOptions.
WithTTL(ttl).
WithGcDiscardRatio(ratio).
WithGcInterval(interval).
WithGcSleep(sleep)
assert.Equal(t, ttl, o.TTL)
assert.Equal(t, ratio, o.GcDiscardRatio)
assert.Equal(t, interval, o.GcInterval)
assert.Equal(t, sleep, o.GcSleep)
// Make sure DefaultOptions aren't changed
assert.Equal(t, time.Duration(0), DefaultOptions.TTL)
} | explode_data.jsonl/937 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 402
} | [
2830,
3393,
3798,
1155,
353,
8840,
836,
8,
341,
26781,
11,
1848,
1669,
43144,
65009,
6184,
9638,
65009,
6184,
1507,
330,
8840,
34199,
1389,
62,
1138,
743,
1848,
961,
2092,
341,
197,
3244,
26133,
3964,
340,
197,
532,
64734,
1669,
7899,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestReadOnlyOpenWithPartialAppendToValueLog(t *testing.T) {
dir, err := ioutil.TempDir("", "badger-test")
require.NoError(t, err)
defer removeDir(dir)
// Create skeleton files.
opts := getTestOptions(dir)
opts.ValueLogFileSize = 100 * 1024 * 1024 // 100Mb
kv, err := Open(opts)
require.NoError(t, err)
require.NoError(t, kv.Close())
var (
k0 = []byte("k0")
k1 = []byte("k1")
k2 = []byte("k2")
v0 = []byte("value0-012345678901234567890123")
v1 = []byte("value1-012345678901234567890123")
v2 = []byte("value2-012345678901234567890123")
)
// Create truncated vlog to simulate a partial append.
// k0 - single transaction, k1 and k2 in another transaction
buf := createVlog(t, []*Entry{
{Key: k0, Value: v0},
{Key: k1, Value: v1},
{Key: k2, Value: v2},
})
buf = buf[:len(buf)-6]
require.NoError(t, ioutil.WriteFile(vlogFilePath(dir, 0), buf, 0777))
opts.ReadOnly = true
// Badger should fail a read-only open with values to replay
_, err = Open(opts)
require.Error(t, err)
require.Regexp(t, "Database was not properly closed, cannot open read-only|Read-only mode is not supported on Windows", err.Error())
} | explode_data.jsonl/39097 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 471
} | [
2830,
3393,
20914,
5002,
2354,
37314,
23877,
1249,
1130,
2201,
1155,
353,
8840,
836,
8,
341,
48532,
11,
1848,
1669,
43144,
65009,
6184,
19814,
330,
13855,
1389,
16839,
1138,
17957,
35699,
1155,
11,
1848,
340,
16867,
4057,
6184,
14161,
692... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestTimestamp(t *testing.T) {
store, clean := testkit.CreateMockStore(t)
defer clean()
tk := testkit.NewTestKit(t, store)
tk.MustExec(`use test;`)
tk.MustExec("SET time_zone = '+00:00';")
defer tk.MustExec("SET time_zone = DEFAULT;")
timestampStr1 := fmt.Sprintf("%s", tk.MustQuery("SELECT @@timestamp;").Rows()[0])
timestampStr1 = timestampStr1[1:]
timestampStr1 = timestampStr1[:len(timestampStr1)-1]
timestamp1, err := strconv.ParseFloat(timestampStr1, 64)
require.NoError(t, err)
nowStr1 := fmt.Sprintf("%s", tk.MustQuery("SELECT NOW(6);").Rows()[0])
now1, err := time.Parse("[2006-01-02 15:04:05.000000]", nowStr1)
require.NoError(t, err)
tk.MustExec("set @@timestamp = 12345;")
tk.MustQuery("SELECT @@timestamp;").Check(testkit.Rows("12345"))
tk.MustQuery("SELECT NOW();").Check(testkit.Rows("1970-01-01 03:25:45"))
tk.MustQuery("SELECT NOW();").Check(testkit.Rows("1970-01-01 03:25:45"))
tk.MustExec("set @@timestamp = default;")
time.Sleep(2 * time.Microsecond)
timestampStr2 := fmt.Sprintf("%s", tk.MustQuery("SELECT @@timestamp;").Rows()[0])
timestampStr2 = timestampStr2[1:]
timestampStr2 = timestampStr2[:len(timestampStr2)-1]
timestamp2, err := strconv.ParseFloat(timestampStr2, 64)
require.NoError(t, err)
nowStr2 := fmt.Sprintf("%s", tk.MustQuery("SELECT NOW(6);").Rows()[0])
now2, err := time.Parse("[2006-01-02 15:04:05.000000]", nowStr2)
require.NoError(t, err)
require.Less(t, timestamp1, timestamp2)
require.Less(t, now1.UnixNano(), now2.UnixNano())
tk.MustExec("set @@timestamp = 12345;")
tk.MustQuery("SELECT @@timestamp;").Check(testkit.Rows("12345"))
tk.MustQuery("SELECT NOW();").Check(testkit.Rows("1970-01-01 03:25:45"))
tk.MustQuery("SELECT NOW();").Check(testkit.Rows("1970-01-01 03:25:45"))
tk.MustExec("set @@timestamp = 0;")
time.Sleep(2 * time.Microsecond)
timestampStr3 := fmt.Sprintf("%s", tk.MustQuery("SELECT @@timestamp;").Rows()[0])
timestampStr3 = timestampStr3[1:]
timestampStr3 = timestampStr3[:len(timestampStr3)-1]
timestamp3, err := strconv.ParseFloat(timestampStr3, 64)
require.NoError(t, err)
nowStr3 := fmt.Sprintf("%s", tk.MustQuery("SELECT NOW(6);").Rows()[0])
now3, err := time.Parse("[2006-01-02 15:04:05.000000]", nowStr3)
require.NoError(t, err)
require.Less(t, timestamp2, timestamp3)
require.Less(t, now2.UnixNano(), now3.UnixNano())
} | explode_data.jsonl/65609 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 952
} | [
2830,
3393,
20812,
1155,
353,
8840,
836,
8,
341,
57279,
11,
4240,
1669,
1273,
8226,
7251,
11571,
6093,
1155,
340,
16867,
4240,
2822,
3244,
74,
1669,
1273,
8226,
7121,
2271,
7695,
1155,
11,
3553,
340,
3244,
74,
50463,
10216,
5809,
810,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestTableSchemaDiff(t *testing.T) {
old := mkTable(
"table",
mkCol("removed", TextColumn, false, false, nil),
mkCol("shared", TextColumn, false, false, nil),
)
new := mkTable(
"table",
mkCol("new", TextColumn, false, false, nil),
mkCol("shared", TextColumn, false, false, nil),
)
expected := ChangeSet{
&DropColumn{"removed", "table"},
&AddColumn{mkCol("new", TextColumn, false, false, nil), "table"},
}
require.Equal(t, expected, TableSchemaDiff(old, new))
} | explode_data.jsonl/19114 | {
"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,
2556,
8632,
21751,
1155,
353,
8840,
836,
8,
341,
61828,
1669,
23789,
2556,
1006,
197,
197,
1,
2005,
756,
197,
2109,
74,
6127,
445,
45756,
497,
2918,
2933,
11,
895,
11,
895,
11,
2092,
1326,
197,
2109,
74,
6127,
445,
6100,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestRenderCode(t *testing.T) {
// force open color render for testing
oldVal = ForceColor()
defer resetColorRender()
is := assert.New(t)
is.True(SupportColor())
str := RenderCode("36;1", "Hi,", "babe")
is.Equal("\x1b[36;1mHi,babe\x1b[0m", str)
str = RenderWithSpaces("", "Hi,", "babe")
is.Equal("Hi, babe", str)
str = RenderWithSpaces("36;1", "Hi,", "babe")
is.Equal("\x1b[36;1mHi, babe\x1b[0m", str)
str = RenderCode("36;1", "Ab")
is.Equal("\x1b[36;1mAb\x1b[0m", str)
str = RenderCode("36;1")
is.Equal("", str)
Disable()
str = RenderCode("36;1", "Te", "xt")
is.Equal("Text", str)
str = RenderWithSpaces("36;1", "Te", "xt")
is.Equal("Te xt", str)
Enable = true
// RenderString
str = RenderString("36;1", "Text")
is.Equal("\x1b[36;1mText\x1b[0m", str)
str = RenderString("", "Text")
is.Equal("Text", str)
str = RenderString("36;1", "")
is.Equal("", str)
Disable()
str = RenderString("36;1", "Text")
is.Equal("Text", str)
Enable = true
Disable()
str = RenderString("36;1", "Text")
is.Equal("Text", str)
Enable = true
} | explode_data.jsonl/7001 | {
"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,
6750,
2078,
1155,
353,
8840,
836,
8,
341,
197,
322,
5344,
1787,
1894,
3141,
369,
7497,
198,
61828,
2208,
284,
11732,
1636,
741,
16867,
7585,
1636,
6750,
2822,
19907,
1669,
2060,
7121,
1155,
340,
19907,
32443,
3759,
2800,
163... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestIncludesPagerDutyForClusterEnvironment(t *testing.T) {
t.Parallel()
fullPagerDutyMetadata := fullPagerDutyMetadata()
envTypeCases := []struct {
envType voyager.EnvType
sourceMetadata creator_v1.PagerDutyEnvMetadata
}{
{
voyager.EnvTypeStaging,
fullPagerDutyMetadata.Staging,
},
{
voyager.EnvTypeProduction,
fullPagerDutyMetadata.Production,
},
}
for _, subCase := range envTypeCases {
t.Run(string(subCase.envType), func(t *testing.T) {
ns := &core_v1.Namespace{
TypeMeta: meta_v1.TypeMeta{
Kind: k8s.NamespaceKind,
APIVersion: core_v1.SchemeGroupVersion.String(),
},
ObjectMeta: meta_v1.ObjectMeta{
Name: namespaceName,
Labels: map[string]string{
voyager.ServiceNameLabel: serviceName,
},
},
}
tc := testCase{
ns: ns,
mainClientObjects: []runtime.Object{ns, existingDefaultDockerSecret()},
test: func(t *testing.T, cntrlr *Controller, ctx *ctrl.ProcessContext, tc *testCase) {
service := &creator_v1.Service{
ObjectMeta: meta_v1.ObjectMeta{
Name: serviceName,
},
Spec: creator_v1.ServiceSpec{
ResourceOwner: "somebody",
BusinessUnit: "the unit",
Metadata: creator_v1.ServiceMetadata{
PagerDuty: fullPagerDutyMetadata,
},
},
}
expected := basicServiceProperties(service, subCase.envType)
cwURL, err := pagerduty.KeyToCloudWatchURL(subCase.sourceMetadata.Main.Integrations.CloudWatch.IntegrationKey)
require.NoError(t, err)
expected.Notifications.PagerdutyEndpoint = orch_meta.PagerDuty{
Generic: subCase.sourceMetadata.Main.Integrations.Generic.IntegrationKey,
CloudWatch: cwURL,
}
cwURL, err = pagerduty.KeyToCloudWatchURL(subCase.sourceMetadata.LowPriority.Integrations.CloudWatch.IntegrationKey)
require.NoError(t, err)
expected.Notifications.LowPriorityPagerdutyEndpoint = orch_meta.PagerDuty{
Generic: subCase.sourceMetadata.LowPriority.Integrations.Generic.IntegrationKey,
CloudWatch: cwURL,
}
tc.scFake.On("GetService", mock.Anything, auth.NoUser(), serviceNameSc).Return(service, nil)
// make sure the controller knows we are our specific environment type
cntrlr.ClusterLocation = voyager.ClusterLocation{
EnvType: subCase.envType,
}
_, err = cntrlr.Process(ctx)
require.NoError(t, err)
actions := tc.mainFake.Actions()
cm, _ := findCreatedConfigMap(actions, namespaceName, apisynchronization.DefaultServiceMetadataConfigMapName)
require.NotNil(t, cm)
assert.Equal(t, cm.Name, apisynchronization.DefaultServiceMetadataConfigMapName)
assert.Contains(t, cm.Data, orch_meta.ConfigMapConfigKey)
data := cm.Data[orch_meta.ConfigMapConfigKey]
var actual orch_meta.ServiceProperties
err = yaml.Unmarshal([]byte(data), &actual)
require.NoError(t, err)
assert.Equal(t, expected, actual)
},
}
tc.run(t)
})
}
} | explode_data.jsonl/4267 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 1300
} | [
2830,
3393,
55834,
22640,
35,
20237,
2461,
28678,
12723,
1155,
353,
8840,
836,
8,
341,
3244,
41288,
7957,
2822,
94042,
22640,
35,
20237,
14610,
1669,
2480,
22640,
35,
20237,
14610,
2822,
57538,
929,
37302,
1669,
3056,
1235,
341,
197,
5753... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestGetAssetStatsOrderValidation(t *testing.T) {
tt := test.Start(t)
defer tt.Finish()
test.ResetHorizonDB(t, tt.HorizonDB)
q := &Q{tt.HorizonSession()}
page := db2.PageQuery{
Order: "invalid",
Limit: 5,
}
results, err := q.GetAssetStats("", "", page)
tt.Assert.Empty(results)
tt.Assert.NotNil(err)
tt.Assert.Contains(err.Error(), "invalid page order")
} | explode_data.jsonl/42378 | {
"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,
1949,
16604,
16635,
4431,
13799,
1155,
353,
8840,
836,
8,
341,
3244,
83,
1669,
1273,
12101,
1155,
340,
16867,
17853,
991,
18176,
741,
18185,
36660,
39601,
16973,
3506,
1155,
11,
17853,
3839,
269,
16973,
3506,
692,
18534,
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 Test_postWorkflowRollbackHandler(t *testing.T) {
api, db, router := newTestAPI(t)
// Init user
u, pass := assets.InsertAdminUser(t, api.mustDB())
// Init project
key := sdk.RandomString(10)
proj := assets.InsertTestProject(t, db, api.Cache, key, key)
// Init pipeline
pip := sdk.Pipeline{
Name: "pipeline1",
ProjectID: proj.ID,
}
test.NoError(t, pipeline.InsertPipeline(api.mustDB(), &pip))
// Create WORKFLOW NAME
//Prepare request
vars := map[string]string{
"permProjectKey": proj.Key,
}
uri := router.GetRoute("POST", api.postWorkflowHandler, vars)
test.NotEmpty(t, uri)
var wf = &sdk.Workflow{
Name: "Name",
Description: "Description",
WorkflowData: sdk.WorkflowData{
Node: sdk.Node{
Type: sdk.NodeTypePipeline,
Context: &sdk.NodeContext{
PipelineID: pip.ID,
},
},
},
}
req := assets.NewAuthentifiedRequest(t, u, pass, "POST", uri, &wf)
//Do the request
w := httptest.NewRecorder()
router.Mux.ServeHTTP(w, req)
assert.Equal(t, 201, w.Code)
test.NoError(t, json.Unmarshal(w.Body.Bytes(), &wf))
// UPDATE WORKFLOW : add APPLICATION ON ROOT NODE
//Prepare request
vars = map[string]string{
"key": proj.Key,
"permWorkflowName": "Name",
}
uri = router.GetRoute("PUT", api.putWorkflowHandler, vars)
test.NotEmpty(t, uri)
// Insert application
app := sdk.Application{
Name: "app1",
RepositoryFullname: "test/app1",
VCSServer: "github",
}
test.NoError(t, application.Insert(api.mustDB(), *proj, &app))
var workflow1 = &sdk.Workflow{
ID: wf.ID,
Name: "Name",
Description: "Description 2",
WorkflowData: sdk.WorkflowData{
Node: sdk.Node{
Type: sdk.NodeTypePipeline,
Context: &sdk.NodeContext{
ApplicationID: app.ID,
PipelineID: pip.ID,
},
},
},
}
req = assets.NewAuthentifiedRequest(t, u, pass, "PUT", uri, &workflow1)
//Do the request
w = httptest.NewRecorder()
router.Mux.ServeHTTP(w, req)
assert.Equal(t, 200, w.Code)
test.NoError(t, json.Unmarshal(w.Body.Bytes(), &workflow1))
assert.NotEqual(t, 0, workflow1.ID)
assert.Equal(t, "Description 2", workflow1.Description)
assert.NotEqual(t, 0, workflow1.WorkflowData.Node.Context.ApplicationID)
assert.NotNil(t, workflow1.WorkflowData.Node.Context.DefaultPayload)
payload, err := workflow1.WorkflowData.Node.Context.DefaultPayloadToMap()
test.NoError(t, err)
assert.NotEmpty(t, payload["git.branch"], "git.branch should not be empty")
test.NoError(t, workflow.CompleteWorkflow(context.Background(), db, wf, *proj, workflow.LoadOptions{}))
eWf, err := exportentities.NewWorkflow(context.TODO(), *wf)
test.NoError(t, err)
wfBts, err := yaml.Marshal(eWf)
test.NoError(t, err)
eWfUpdate, err := exportentities.NewWorkflow(context.TODO(), *workflow1)
test.NoError(t, err)
wfUpdatedBts, err := yaml.Marshal(eWfUpdate)
test.NoError(t, err)
// INSERT AUDIT
wfAudit := sdk.AuditWorkflow{
AuditCommon: sdk.AuditCommon{
Created: time.Now(),
EventType: "WorkflowUpdate",
TriggeredBy: u.Username,
},
ProjectKey: proj.Key,
WorkflowID: wf.ID,
DataType: "yaml",
DataBefore: string(wfBts),
DataAfter: string(wfUpdatedBts),
}
test.NoError(t, workflow.InsertAudit(api.mustDB(), &wfAudit))
// ROLLBACK TO PREVIOUS WORKFLOW
//Prepare request
vars = map[string]string{
"key": proj.Key,
"permWorkflowName": "Name",
"auditID": fmt.Sprintf("%d", wfAudit.ID),
}
uri = router.GetRoute("POST", api.postWorkflowRollbackHandler, vars)
test.NotEmpty(t, uri)
req = assets.NewAuthentifiedRequest(t, u, pass, "POST", uri, nil)
//Do the request
w = httptest.NewRecorder()
router.Mux.ServeHTTP(w, req)
assert.Equal(t, 200, w.Code)
var wfRollback sdk.Workflow
test.NoError(t, json.Unmarshal(w.Body.Bytes(), &wfRollback))
test.Equal(t, int64(0), wfRollback.WorkflowData.Node.Context.ApplicationID)
assert.Equal(t, true, wfRollback.Permissions.Readable)
assert.Equal(t, true, wfRollback.Permissions.Executable)
assert.Equal(t, true, wfRollback.Permissions.Writable)
} | explode_data.jsonl/31078 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 1776
} | [
2830,
3393,
6333,
62768,
32355,
1419,
3050,
1155,
353,
8840,
836,
8,
1476,
54299,
11,
2927,
11,
9273,
1669,
501,
2271,
7082,
1155,
692,
197,
322,
15690,
1196,
198,
10676,
11,
1494,
1669,
11770,
23142,
7210,
1474,
1155,
11,
6330,
69419,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestDependencyUpdateCmd(t *testing.T) {
hh, err := tempHelmHome(t)
if err != nil {
t.Fatal(err)
}
cleanup := resetEnv()
defer func() {
os.RemoveAll(hh.String())
cleanup()
}()
settings.Home = hh
srv := repotest.NewServer(hh.String())
defer srv.Stop()
copied, err := srv.CopyCharts("testdata/testcharts/*.tgz")
if err != nil {
t.Fatal(err)
}
t.Logf("Copied charts:\n%s", strings.Join(copied, "\n"))
t.Logf("Listening on directory %s", srv.Root())
chartname := "depup"
if err := createTestingChart(hh.String(), chartname, srv.URL()); err != nil {
t.Fatal(err)
}
out := bytes.NewBuffer(nil)
duc := &dependencyUpdateCmd{out: out}
duc.helmhome = helmpath.Home(hh)
duc.chartpath = filepath.Join(hh.String(), chartname)
if err := duc.run(); err != nil {
output := out.String()
t.Logf("Output: %s", output)
t.Fatal(err)
}
output := out.String()
// This is written directly to stdout, so we have to capture as is.
if !strings.Contains(output, `update from the "test" chart repository`) {
t.Errorf("Repo did not get updated\n%s", output)
}
// Make sure the actual file got downloaded.
expect := filepath.Join(hh.String(), chartname, "charts/reqtest-0.1.0.tgz")
if _, err := os.Stat(expect); err != nil {
t.Fatal(err)
}
hash, err := provenance.DigestFile(expect)
if err != nil {
t.Fatal(err)
}
i, err := repo.LoadIndexFile(duc.helmhome.CacheIndex("test"))
if err != nil {
t.Fatal(err)
}
reqver := i.Entries["reqtest"][0]
if h := reqver.Digest; h != hash {
t.Errorf("Failed hash match: expected %s, got %s", hash, h)
}
// Now change the dependencies and update. This verifies that on update,
// old dependencies are cleansed and new dependencies are added.
reqfile := &chartutil.Requirements{
Dependencies: []*chartutil.Dependency{
{Name: "reqtest", Version: "0.1.0", Repository: srv.URL()},
{Name: "compressedchart", Version: "0.3.0", Repository: srv.URL()},
},
}
dir := filepath.Join(hh.String(), chartname)
if err := writeRequirements(dir, reqfile); err != nil {
t.Fatal(err)
}
if err := duc.run(); err != nil {
output := out.String()
t.Logf("Output: %s", output)
t.Fatal(err)
}
// In this second run, we should see compressedchart-0.3.0.tgz, and not
// the 0.1.0 version.
expect = filepath.Join(hh.String(), chartname, "charts/compressedchart-0.3.0.tgz")
if _, err := os.Stat(expect); err != nil {
t.Fatalf("Expected %q: %s", expect, err)
}
dontExpect := filepath.Join(hh.String(), chartname, "charts/compressedchart-0.1.0.tgz")
if _, err := os.Stat(dontExpect); err == nil {
t.Fatalf("Unexpected %q", dontExpect)
}
} | explode_data.jsonl/34626 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 1061
} | [
2830,
3393,
36387,
4289,
15613,
1155,
353,
8840,
836,
8,
341,
9598,
71,
11,
1848,
1669,
2730,
39,
23162,
7623,
1155,
340,
743,
1848,
961,
2092,
341,
197,
3244,
26133,
3964,
340,
197,
532,
1444,
60639,
1669,
7585,
14359,
741,
16867,
29... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestEncodeUint64(t *testing.T) {
for _, test := range encodeUint64Tests {
enc := EncodeUint64(test.input.(uint64))
if enc != test.want {
t.Errorf("input %x: wrong encoding %s", test.input, enc)
}
}
} | explode_data.jsonl/63936 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 91
} | [
2830,
3393,
32535,
21570,
21,
19,
1155,
353,
8840,
836,
8,
341,
2023,
8358,
1273,
1669,
2088,
16164,
21570,
21,
19,
18200,
341,
197,
197,
954,
1669,
56562,
21570,
21,
19,
8623,
10046,
12832,
2496,
21,
19,
1171,
197,
743,
3209,
961,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
func TestRawMessage_Bytes(t *testing.T) {
for _, tt := range rawMessageTestCases {
if tt.bytes == nil {
continue
}
t.Run(tt.name, func(t *testing.T) {
got := tt.rawMessage.Bytes()
assert.Equal(t, tt.bytes, got)
})
}
} | explode_data.jsonl/14191 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 110
} | [
2830,
3393,
20015,
2052,
62,
7078,
1155,
353,
8840,
836,
8,
341,
2023,
8358,
17853,
1669,
2088,
7112,
2052,
2271,
37302,
341,
197,
743,
17853,
42697,
621,
2092,
341,
298,
11664,
198,
197,
197,
532,
197,
3244,
16708,
47152,
2644,
11,
2... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func Test_snmpSession_Configure(t *testing.T) {
tests := []struct {
name string
config checkconfig.CheckConfig
expectedError error
expectedVersion gosnmp.SnmpVersion
expectedTimeout time.Duration
expectedRetries int
expectedCommunity string
expectedMsgFlags gosnmp.SnmpV3MsgFlags
expectedContextName string
expectedSecurityParameters gosnmp.SnmpV3SecurityParameters
}{
{
name: "no auth method",
config: checkconfig.CheckConfig{
IPAddress: "1.2.3.4",
Port: uint16(1234),
},
expectedError: fmt.Errorf("an authentication method needs to be provided"),
},
{
name: "valid v1 config",
config: checkconfig.CheckConfig{
IPAddress: "1.2.3.4",
Port: uint16(1234),
SnmpVersion: "1",
Timeout: 4,
Retries: 3,
CommunityString: "abc",
},
expectedVersion: gosnmp.Version1,
expectedError: nil,
expectedTimeout: time.Duration(4) * time.Second,
expectedRetries: 3,
expectedCommunity: "abc",
expectedMsgFlags: gosnmp.NoAuthNoPriv,
},
{
name: "valid default v2 config",
config: checkconfig.CheckConfig{
IPAddress: "1.2.3.4",
Port: uint16(1234),
Timeout: 4,
Retries: 3,
CommunityString: "abc",
},
expectedVersion: gosnmp.Version2c,
expectedError: nil,
expectedTimeout: time.Duration(4) * time.Second,
expectedRetries: 3,
expectedCommunity: "abc",
expectedMsgFlags: gosnmp.NoAuthNoPriv,
},
{
name: "valid v2 config",
config: checkconfig.CheckConfig{
IPAddress: "1.2.3.4",
Port: uint16(1234),
Timeout: 4,
Retries: 3,
CommunityString: "abc",
},
expectedVersion: gosnmp.Version2c,
expectedError: nil,
expectedTimeout: time.Duration(4) * time.Second,
expectedRetries: 3,
expectedCommunity: "abc",
expectedMsgFlags: gosnmp.NoAuthNoPriv,
},
{
name: "valid v2c config",
config: checkconfig.CheckConfig{
IPAddress: "1.2.3.4",
Port: uint16(1234),
Timeout: 4,
Retries: 3,
CommunityString: "abc",
},
expectedVersion: gosnmp.Version2c,
expectedError: nil,
expectedTimeout: time.Duration(4) * time.Second,
expectedRetries: 3,
expectedCommunity: "abc",
expectedMsgFlags: gosnmp.NoAuthNoPriv,
},
{
name: "valid v3 AuthPriv config",
config: checkconfig.CheckConfig{
IPAddress: "1.2.3.4",
Port: uint16(1234),
Timeout: 4,
Retries: 3,
ContextName: "myContext",
User: "myUser",
AuthKey: "myAuthKey",
AuthProtocol: "md5",
PrivKey: "myPrivKey",
PrivProtocol: "aes",
},
expectedVersion: gosnmp.Version3,
expectedError: nil,
expectedTimeout: time.Duration(4) * time.Second,
expectedRetries: 3,
expectedCommunity: "",
expectedMsgFlags: gosnmp.AuthPriv,
expectedContextName: "myContext",
expectedSecurityParameters: &gosnmp.UsmSecurityParameters{
UserName: "myUser",
AuthenticationProtocol: gosnmp.MD5,
AuthenticationPassphrase: "myAuthKey",
PrivacyProtocol: gosnmp.AES,
PrivacyPassphrase: "myPrivKey",
},
},
{
name: "valid v3 AuthNoPriv config",
config: checkconfig.CheckConfig{
IPAddress: "1.2.3.4",
Port: uint16(1234),
Timeout: 4,
Retries: 3,
User: "myUser",
AuthKey: "myAuthKey",
AuthProtocol: "md5",
},
expectedVersion: gosnmp.Version3,
expectedError: nil,
expectedTimeout: time.Duration(4) * time.Second,
expectedRetries: 3,
expectedCommunity: "",
expectedMsgFlags: gosnmp.AuthNoPriv,
expectedSecurityParameters: &gosnmp.UsmSecurityParameters{
UserName: "myUser",
AuthenticationProtocol: gosnmp.MD5,
AuthenticationPassphrase: "myAuthKey",
PrivacyProtocol: gosnmp.NoPriv,
PrivacyPassphrase: "",
},
},
{
name: "invalid v3 authProtocol",
config: checkconfig.CheckConfig{
IPAddress: "1.2.3.4",
Port: uint16(1234),
Timeout: 4,
Retries: 3,
User: "myUser",
AuthKey: "myAuthKey",
AuthProtocol: "invalid",
},
expectedVersion: gosnmp.Version1, // default, not configured
expectedError: fmt.Errorf("unsupported authentication protocol: invalid"),
expectedSecurityParameters: nil, // default, not configured
},
{
name: "invalid v3 privProtocol",
config: checkconfig.CheckConfig{
IPAddress: "1.2.3.4",
Port: uint16(1234),
Timeout: 4,
Retries: 3,
User: "myUser",
AuthKey: "myAuthKey",
AuthProtocol: "md5",
PrivKey: "myPrivKey",
PrivProtocol: "invalid",
},
expectedVersion: gosnmp.Version1, // default, not configured
expectedError: fmt.Errorf("unsupported privacy protocol: invalid"),
expectedSecurityParameters: nil, // default, not configured
},
{
name: "batch size too big",
config: checkconfig.CheckConfig{
IPAddress: "1.2.3.4",
Port: uint16(1234),
Timeout: 4,
Retries: 3,
CommunityString: "abc",
OidBatchSize: 100,
},
expectedVersion: gosnmp.Version1,
expectedError: fmt.Errorf("config oidBatchSize (100) cannot be higher than gosnmp.MaxOids: 60"),
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
s, err := NewGosnmpSession(&tt.config)
assert.Equal(t, tt.expectedError, err)
if tt.expectedError == nil {
gosnmpSess := s.(*GosnmpSession)
assert.Equal(t, tt.expectedVersion, gosnmpSess.gosnmpInst.Version)
assert.Equal(t, tt.expectedRetries, gosnmpSess.gosnmpInst.Retries)
assert.Equal(t, tt.expectedTimeout, gosnmpSess.gosnmpInst.Timeout)
assert.Equal(t, tt.expectedCommunity, gosnmpSess.gosnmpInst.Community)
assert.Equal(t, tt.expectedContextName, gosnmpSess.gosnmpInst.ContextName)
assert.Equal(t, tt.expectedMsgFlags, gosnmpSess.gosnmpInst.MsgFlags)
assert.Equal(t, tt.expectedSecurityParameters, gosnmpSess.gosnmpInst.SecurityParameters)
}
})
}
} | explode_data.jsonl/59173 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 3126
} | [
2830,
3393,
28022,
1307,
5283,
15100,
17781,
1155,
353,
8840,
836,
8,
341,
78216,
1669,
3056,
1235,
341,
197,
11609,
5180,
914,
198,
197,
25873,
3824,
1779,
1676,
10600,
2648,
198,
197,
42400,
1454,
1060,
1465,
198,
197,
42400,
5637,
31... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestMergeStrSlicesEqual(t *testing.T) {
orig := []string{"a"}
new := []string{"a"}
res := mergeStrSlices(orig, new)
require.Len(t, res, 1)
require.Equal(t, "a", res[0])
} | explode_data.jsonl/66961 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 80
} | [
2830,
3393,
52096,
2580,
50,
37414,
2993,
1155,
353,
8840,
836,
8,
341,
197,
4670,
1669,
3056,
917,
4913,
64,
16707,
8638,
1669,
3056,
917,
4913,
64,
63159,
10202,
1669,
10880,
2580,
50,
37414,
54837,
11,
501,
340,
17957,
65819,
1155,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
func TestHtmlInstead(t *testing.T) {
r, err := FromString(robotsTextJustHTML)
// According to Google spec, invalid robots.txt file
// must be parsed silently.
require.NoError(t, err)
group := r.FindGroup("SuperBot")
require.NotNil(t, group)
assert.True(t, group.Test("/"))
} | explode_data.jsonl/51682 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 100
} | [
2830,
3393,
13591,
30787,
1155,
353,
8840,
836,
8,
341,
7000,
11,
1848,
1669,
5542,
703,
7,
60115,
1178,
9952,
5835,
340,
197,
322,
10548,
311,
5085,
1398,
11,
8318,
28707,
3909,
1034,
198,
197,
322,
1969,
387,
15676,
49394,
624,
1795... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestNoActionsForResourcesWhenForegroundDeletion(t *testing.T) {
t.Parallel()
now := meta_v1.Now()
tc := testCase{
mainClientObjects: []runtime.Object{
configMapNeedsDelete(),
configMapNeedsUpdate(),
},
scClientObjects: []runtime.Object{
serviceInstance(false, false, true),
},
bundle: &smith_v1.Bundle{
ObjectMeta: meta_v1.ObjectMeta{
Name: bundle1,
Namespace: testNamespace,
UID: bundle1uid,
DeletionTimestamp: &now,
Finalizers: []string{meta_v1.FinalizerDeleteDependents},
},
Spec: smith_v1.BundleSpec{
Resources: []smith_v1.Resource{
{
Name: resSi1,
Spec: smith_v1.ResourceSpec{
Object: &sc_v1b1.ServiceInstance{
TypeMeta: meta_v1.TypeMeta{
Kind: "ServiceInstance",
APIVersion: sc_v1b1.SchemeGroupVersion.String(),
},
ObjectMeta: meta_v1.ObjectMeta{
Name: si1,
},
Spec: serviceInstanceSpec,
},
},
},
{
Name: resMapNeedsAnUpdate,
References: []smith_v1.Reference{
{Resource: resSi1},
},
Spec: smith_v1.ResourceSpec{
Object: &core_v1.ConfigMap{
TypeMeta: meta_v1.TypeMeta{
Kind: "ConfigMap",
APIVersion: core_v1.SchemeGroupVersion.String(),
},
ObjectMeta: meta_v1.ObjectMeta{
Name: mapNeedsAnUpdate,
},
},
},
},
},
},
},
appName: testAppName,
namespace: testNamespace,
enableServiceCatalog: false,
test: func(t *testing.T, ctx context.Context, cntrlr *bundlec.Controller, tc *testCase) {
tc.defaultTest(t, ctx, cntrlr)
actions := tc.smithFake.Actions()
require.Len(t, actions, 2)
assert.Implements(t, (*kube_testing.ListAction)(nil), actions[0])
assert.Implements(t, (*kube_testing.WatchAction)(nil), actions[1])
assert.Empty(t, tc.bundle.Status.ObjectsToDelete)
},
}
tc.run(t)
} | explode_data.jsonl/28605 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 1008
} | [
2830,
3393,
2753,
12948,
2461,
11277,
4498,
25982,
1912,
52625,
1155,
353,
8840,
836,
8,
341,
3244,
41288,
7957,
741,
80922,
1669,
8823,
2273,
16,
13244,
741,
78255,
1669,
54452,
515,
197,
36641,
2959,
11543,
25,
3056,
22255,
8348,
515,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestHelmHome(t *testing.T) {
os.Setenv(xdg.CacheHomeEnvVar, "c:\\")
os.Setenv(xdg.ConfigHomeEnvVar, "d:\\")
os.Setenv(xdg.DataHomeEnvVar, "e:\\")
isEq := func(t *testing.T, a, b string) {
if a != b {
t.Errorf("Expected %q, got %q", b, a)
}
}
isEq(t, CachePath(), "c:\\helm")
isEq(t, ConfigPath(), "d:\\helm")
isEq(t, DataPath(), "e:\\helm")
// test to see if lazy-loading environment variables at runtime works
os.Setenv(xdg.CacheHomeEnvVar, "f:\\")
isEq(t, CachePath(), "f:\\helm")
} | explode_data.jsonl/52144 | {
"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,
39,
23162,
7623,
1155,
353,
8840,
836,
8,
341,
25078,
4202,
3160,
2075,
35138,
46130,
7623,
14359,
3962,
11,
330,
66,
23817,
1138,
25078,
4202,
3160,
2075,
35138,
10753,
7623,
14359,
3962,
11,
330,
67,
23817,
1138,
25078,
42... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_Mock_On_WithVariadicFuncWithInterface(t *testing.T) {
// make a test impl object
var mockedService = new(TestExampleImplementation)
c := mockedService.On("TheExampleMethodVariadicInterface", []interface{}{1, 2, 3}).
Return(nil)
assert.Equal(t, []*Call{c}, mockedService.ExpectedCalls)
assert.Equal(t, 1, len(c.Arguments))
assert.Equal(t, []interface{}{1, 2, 3}, c.Arguments[0])
assert.NotPanics(t, func() {
mockedService.TheExampleMethodVariadicInterface(1, 2, 3)
})
assert.Panics(t, func() {
mockedService.TheExampleMethodVariadicInterface(1, 2)
})
} | explode_data.jsonl/8575 | {
"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,
1245,
1176,
35482,
62,
2354,
56135,
36214,
9626,
2354,
5051,
1155,
353,
8840,
836,
8,
8022,
197,
322,
1281,
264,
1273,
11605,
1633,
319,
2405,
46149,
1860,
284,
501,
31159,
13314,
36850,
7229,
1444,
1669,
46149,
1860,
8071,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestLruCacheClass(t *testing.T) {
count := 0
cache := LruCache.NewWithCallback(8, func (kv MapEntry) { count++ })
checkCacheEntry(t, cache, "k1", nil, 0)
cache.Add("k1", "v1")
checkCacheEntry(t, cache, "k1", "v1", 1)
cache.Add("k2", "v2")
cache.Add("k3", "v3")
checkCacheEntry(t, cache, "k1", "v1", 3)
checkCacheEntry(t, cache, "k2", "v2", 3)
checkCacheEntry(t, cache, "k4", nil, 3)
cache.Add("k4", "v4")
cache.Add("k5", "v5")
checkCacheEntry(t, cache, "k4", "v4", 5)
checkCacheEntry(t, cache, "k5", "v5", 5)
checkCacheEntry(t, cache, "k6", nil, 5)
cache.Add("k6", "v6")
checkCacheEntry(t, cache, "k6", "v6", 6)
cache.Remove("k3")
checkCacheEntry(t, cache, "k3", nil, 5)
if count != 0 {
t.Errorf("No eviction exepcted yet (73)")
}
cache.Add("k7", "v7")
cache.Add("k8", "v8")
checkCacheEntry(t, cache, "k1", "v1", 7)
cache.Add("k9", "v9")
checkCacheEntry(t, cache, "k2", "v2", 8)
if count != 0 {
t.Errorf("No eviction exepcted yet (81)")
}
cache.Add("k10", "v10")
if count != 1 {
t.Errorf("1 eviction expected")
}
checkCacheEntry(t, cache, "k8", "v8", 8)
checkCacheEntry(t, cache, "k9", "v9", 8)
checkCacheEntry(t, cache, "k10", "v10", 8)
checkCacheEntry(t, cache, "k1", "v1", 8)
checkCacheEntry(t, cache, "k2", "v2", 8)
checkCacheEntry(t, cache, "k3", nil, 8)
cache.Add("k11", "v11")
cache.Add("k12", "v12")
if count != 3 {
t.Errorf("3 evictions expected (96)")
}
checkCacheEntry(t, cache, "k11", "v11", 8)
cache.Remove("k10")
checkCacheEntry(t, cache, "k12", "v12", 7)
if count != 3 {
t.Errorf("3 evictions expected (102)")
}
} | explode_data.jsonl/21836 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 747
} | [
2830,
3393,
43,
2672,
8233,
1957,
1155,
353,
8840,
836,
8,
341,
220,
1760,
1669,
220,
15,
198,
220,
6500,
1669,
444,
2672,
8233,
7121,
2354,
7494,
7,
23,
11,
2915,
320,
43408,
5027,
5874,
8,
314,
1760,
1027,
2751,
220,
1779,
8233,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestMsgMintNFTGetSignBytesMethod(t *testing.T) {
newMsgMintNFT := types.NewMsgMintNFT(id, denom, nftName, tokenURI, uriHash, tokenData, address.String(), address2.String())
sortedBytes := newMsgMintNFT.GetSignBytes()
expected := `{"type":"irismod/nft/MsgMintNFT","value":{"data":"https://google.com/token-1.json","denom_id":"denom","id":"id1","name":"report","recipient":"cosmos15ky9du8a2wlstz6fpx3p4mqpjyrm5cgp0ctjdj","sender":"cosmos15ky9du8a2wlstz6fpx3p4mqpjyrm5cgqjwl8sq","uri":"https://google.com/token-1.json","uri_hash":"uriHash"}}`
require.Equal(t, expected, string(sortedBytes))
} | explode_data.jsonl/28177 | {
"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,
6611,
44,
396,
45,
3994,
1949,
7264,
7078,
3523,
1155,
353,
8840,
836,
8,
341,
8638,
6611,
44,
396,
45,
3994,
1669,
4494,
7121,
6611,
44,
396,
45,
3994,
3724,
11,
49744,
11,
308,
723,
675,
11,
3950,
10301,
11,
13071,
6... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestGitHubWorkflowWithPolicyCheck(t *testing.T) {
if testing.Short() {
t.SkipNow()
}
// Ensure we have >= TF 0.14 locally.
ensureRunning014(t)
// Ensure we have >= Conftest 0.21 locally.
ensureRunningConftest(t)
cases := []struct {
Description string
// RepoDir is relative to testfixtures/test-repos.
RepoDir string
// ModifiedFiles are the list of files that have been modified in this
// pull request.
ModifiedFiles []string
// Comments are what our mock user writes to the pull request.
Comments []string
// ExpAutomerge is true if we expect Atlantis to automerge.
ExpAutomerge bool
// ExpAutoplan is true if we expect Atlantis to autoplan.
ExpAutoplan bool
// ExpParallel is true if we expect Atlantis to run parallel plans or applies.
ExpParallel bool
// ExpReplies is a list of files containing the expected replies that
// Atlantis writes to the pull request in order. A reply from a parallel operation
// will be matched using a substring check.
ExpReplies [][]string
}{
{
Description: "1 failing policy and 1 passing policy ",
RepoDir: "policy-checks-multi-projects",
ModifiedFiles: []string{"dir1/main.tf,", "dir2/main.tf"},
ExpAutoplan: true,
Comments: []string{
"atlantis apply",
},
ExpReplies: [][]string{
{"exp-output-autoplan.txt"},
{"exp-output-auto-policy-check.txt"},
{"exp-output-apply.txt"},
{"exp-output-merge.txt"},
},
},
{
Description: "failing policy without policies passing using extra args",
RepoDir: "policy-checks-extra-args",
ModifiedFiles: []string{"main.tf"},
ExpAutoplan: true,
Comments: []string{
"atlantis apply",
},
ExpReplies: [][]string{
{"exp-output-autoplan.txt"},
{"exp-output-auto-policy-check.txt"},
{"exp-output-apply-failed.txt"},
{"exp-output-merge.txt"},
},
},
{
Description: "failing policy without policies passing",
RepoDir: "policy-checks",
ModifiedFiles: []string{"main.tf"},
ExpAutoplan: true,
Comments: []string{
"atlantis apply",
},
ExpReplies: [][]string{
{"exp-output-autoplan.txt"},
{"exp-output-auto-policy-check.txt"},
{"exp-output-apply-failed.txt"},
{"exp-output-merge.txt"},
},
},
{
Description: "failing policy additional apply requirements specified",
RepoDir: "policy-checks-apply-reqs",
ModifiedFiles: []string{"main.tf"},
ExpAutoplan: true,
Comments: []string{
"atlantis apply",
},
ExpReplies: [][]string{
{"exp-output-autoplan.txt"},
{"exp-output-auto-policy-check.txt"},
{"exp-output-apply-failed.txt"},
{"exp-output-merge.txt"},
},
},
{
Description: "failing policy approved by non owner",
RepoDir: "policy-checks-diff-owner",
ModifiedFiles: []string{"main.tf"},
ExpAutoplan: true,
Comments: []string{
"atlantis approve_policies",
"atlantis apply",
},
ExpReplies: [][]string{
{"exp-output-autoplan.txt"},
{"exp-output-auto-policy-check.txt"},
{"exp-output-approve-policies.txt"},
{"exp-output-apply-failed.txt"},
{"exp-output-merge.txt"},
},
},
}
for _, c := range cases {
t.Run(c.Description, func(t *testing.T) {
RegisterMockTestingT(t)
// reset userConfig
userConfig = server.UserConfig{}
userConfig.EnablePolicyChecksFlag = true
ctrl, vcsClient, githubGetter, atlantisWorkspace := setupE2E(t, c.RepoDir)
// Set the repo to be cloned through the testing backdoor.
repoDir, headSHA, cleanup := initializeRepo(t, c.RepoDir)
defer cleanup()
atlantisWorkspace.TestingOverrideHeadCloneURL = fmt.Sprintf("file://%s", repoDir)
// Setup test dependencies.
w := httptest.NewRecorder()
When(vcsClient.PullIsMergeable(AnyRepo(), matchers.AnyModelsPullRequest())).ThenReturn(true, nil)
When(vcsClient.PullIsApproved(AnyRepo(), matchers.AnyModelsPullRequest())).ThenReturn(models.ApprovalStatus{
IsApproved: true,
}, nil)
When(githubGetter.GetPullRequest(AnyRepo(), AnyInt())).ThenReturn(GitHubPullRequestParsed(headSHA), nil)
When(vcsClient.GetModifiedFiles(AnyRepo(), matchers.AnyModelsPullRequest())).ThenReturn(c.ModifiedFiles, nil)
// First, send the open pull request event which triggers autoplan.
pullOpenedReq := GitHubPullRequestOpenedEvent(t, headSHA)
ctrl.Post(w, pullOpenedReq)
ResponseContains(t, w, 200, "Processing...")
// Now send any other comments.
for _, comment := range c.Comments {
commentReq := GitHubCommentEvent(t, comment)
w = httptest.NewRecorder()
ctrl.Post(w, commentReq)
ResponseContains(t, w, 200, "Processing...")
}
// Send the "pull closed" event which would be triggered by the
// automerge or a manual merge.
pullClosedReq := GitHubPullRequestClosedEvent(t)
w = httptest.NewRecorder()
ctrl.Post(w, pullClosedReq)
ResponseContains(t, w, 200, "Pull request cleaned successfully")
// Now we're ready to verify Atlantis made all the comments back (or
// replies) that we expect. We expect each plan to have 2 comments,
// one for plan one for policy check and apply have 1 for each
// comment plus one for the locks deleted at the end.
expNumReplies := len(c.Comments) + 1
if c.ExpAutoplan {
expNumReplies++
expNumReplies++
}
var planRegex = regexp.MustCompile("plan")
for _, comment := range c.Comments {
if planRegex.MatchString(comment) {
expNumReplies++
}
}
if c.ExpAutomerge {
expNumReplies++
}
_, _, actReplies, _ := vcsClient.VerifyWasCalled(Times(expNumReplies)).CreateComment(AnyRepo(), AnyInt(), AnyString(), AnyString()).GetAllCapturedArguments()
Assert(t, len(c.ExpReplies) == len(actReplies), "missing expected replies, got %d but expected %d", len(actReplies), len(c.ExpReplies))
for i, expReply := range c.ExpReplies {
assertCommentEquals(t, expReply, actReplies[i], c.RepoDir, c.ExpParallel)
}
if c.ExpAutomerge {
// Verify that the merge API call was made.
vcsClient.VerifyWasCalledOnce().MergePull(matchers.AnyModelsPullRequest(), matchers.AnyModelsPullRequestOptions())
} else {
vcsClient.VerifyWasCalled(Never()).MergePull(matchers.AnyModelsPullRequest(), matchers.AnyModelsPullRequestOptions())
}
})
}
} | explode_data.jsonl/53400 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 2438
} | [
2830,
3393,
75615,
62768,
2354,
13825,
3973,
1155,
353,
8840,
836,
8,
341,
743,
7497,
55958,
368,
341,
197,
3244,
57776,
7039,
741,
197,
532,
197,
322,
29279,
582,
614,
2604,
29145,
220,
15,
13,
16,
19,
23490,
624,
197,
27289,
18990,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestGetMetadata(t *testing.T) {
port, _ := freeport.GetFreePort()
fakeComponent := components_v1alpha.Component{}
fakeComponent.Name = "testComponent"
fakeAPI := &api{
id: "fakeAPI",
components: []components_v1alpha.Component{fakeComponent},
}
fakeAPI.extendedMetadata.Store("testKey", "testValue")
server := startDaprAPIServer(port, fakeAPI, "")
defer server.Stop()
clientConn := createTestClient(port)
defer clientConn.Close()
client := runtimev1pb.NewDaprClient(clientConn)
response, err := client.GetMetadata(context.Background(), &emptypb.Empty{})
assert.NoError(t, err, "Expected no error")
assert.Len(t, response.RegisteredComponents, 1, "One component should be returned")
assert.Equal(t, response.RegisteredComponents[0].Name, "testComponent")
assert.Contains(t, response.ExtendedMetadata, "testKey")
assert.Equal(t, response.ExtendedMetadata["testKey"], "testValue")
} | explode_data.jsonl/21742 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 314
} | [
2830,
3393,
1949,
14610,
1155,
353,
8840,
836,
8,
341,
52257,
11,
716,
1669,
1910,
403,
2234,
10940,
7084,
741,
1166,
726,
2189,
1669,
6813,
2273,
16,
7141,
5119,
16094,
1166,
726,
2189,
2967,
284,
330,
1944,
2189,
698,
1166,
726,
708... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.