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 TestBuildMultiStageCopy(t *testing.T) {
ctx := context.Background()
dockerfile, err := ioutil.ReadFile("testdata/Dockerfile." + t.Name())
assert.NilError(t, err)
source := fakecontext.New(t, "", fakecontext.WithDockerfile(string(dockerfile)))
defer source.Close()
apiclient := testEnv.APIClient()
for _, target := range []string{"copy_to_root", "copy_to_newdir", "copy_to_newdir_nested", "copy_to_existingdir", "copy_to_newsubdir"} {
t.Run(target, func(t *testing.T) {
imgName := strings.ToLower(t.Name())
resp, err := apiclient.ImageBuild(
ctx,
source.AsTarReader(t),
types.ImageBuildOptions{
Remove: true,
ForceRemove: true,
Target: target,
Tags: []string{imgName},
},
)
assert.NilError(t, err)
out := bytes.NewBuffer(nil)
_, err = io.Copy(out, resp.Body)
_ = resp.Body.Close()
if err != nil {
t.Log(out)
}
assert.NilError(t, err)
// verify the image was successfully built
_, _, err = apiclient.ImageInspectWithRaw(ctx, imgName)
if err != nil {
t.Log(out)
}
assert.NilError(t, err)
})
}
} | explode_data.jsonl/82580 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 499
} | [
2830,
3393,
11066,
20358,
19398,
12106,
1155,
353,
8840,
836,
8,
341,
20985,
1669,
2266,
19047,
2822,
2698,
13659,
1192,
11,
1848,
1669,
43144,
78976,
445,
92425,
14953,
13659,
1192,
1189,
488,
259,
2967,
2398,
6948,
59678,
1454,
1155,
11... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
func TestGetSANForRollout(t *testing.T) {
t.Parallel()
identifier := "identity"
identifierVal := "company.platform.server"
domain := "preprd"
rollout := argo.Rollout{Spec: argo.RolloutSpec{Template: corev1.PodTemplateSpec{ObjectMeta: v1.ObjectMeta{Labels: map[string]string{identifier: identifierVal}}}}}
rolloutWithAnnotation := argo.Rollout{Spec: argo.RolloutSpec{Template: corev1.PodTemplateSpec{ObjectMeta: v1.ObjectMeta{Annotations: map[string]string{identifier: identifierVal}}}}}
rolloutWithNoIdentifier := argo.Rollout{}
testCases := []struct {
name string
rollout argo.Rollout
domain string
wantSAN string
}{
{
name: "should return valid SAN (from label)",
rollout: rollout,
domain: domain,
wantSAN: "spiffe://" + domain + "/" + identifierVal,
},
{
name: "should return valid SAN (from annotation)",
rollout: rolloutWithAnnotation,
domain: domain,
wantSAN: "spiffe://" + domain + "/" + identifierVal,
},
{
name: "should return valid SAN with no domain prefix",
rollout: rollout,
domain: "",
wantSAN: "spiffe://" + identifierVal,
},
{
name: "should return empty SAN",
rollout: rolloutWithNoIdentifier,
domain: domain,
wantSAN: "",
},
}
for _, c := range testCases {
t.Run(c.name, func(t *testing.T) {
san := GetSANForRollout(c.domain, &c.rollout, identifier)
if !reflect.DeepEqual(san, c.wantSAN) {
t.Errorf("Wanted SAN: %s, got: %s", c.wantSAN, san)
}
})
}
} | explode_data.jsonl/73046 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 593
} | [
2830,
3393,
1949,
68691,
2461,
32355,
411,
1155,
353,
8840,
836,
8,
341,
3244,
41288,
7957,
2822,
197,
15909,
1669,
330,
16912,
698,
197,
15909,
2208,
1669,
330,
10139,
24695,
12638,
698,
2698,
3121,
1669,
330,
1726,
86222,
1837,
197,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
func TestEtcdSDBootstrapLease(t *testing.T) {
t.Parallel()
for _, table := range etcdSDTables {
t.Run(table.server.ID, func(t *testing.T) {
config := config.NewDefaultEtcdServiceDiscoveryConfig()
c, cli := helpers.GetTestEtcd(t)
defer c.Terminate(t)
e := getEtcdSD(t, *config, table.server, cli)
err := e.grantLease()
assert.NoError(t, err)
assert.NotEmpty(t, e.leaseID)
})
}
} | explode_data.jsonl/61556 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 186
} | [
2830,
3393,
31860,
4385,
5491,
45511,
2304,
519,
1155,
353,
8840,
836,
8,
341,
3244,
41288,
7957,
741,
2023,
8358,
1965,
1669,
2088,
1842,
4385,
5491,
21670,
341,
197,
3244,
16708,
15761,
12638,
9910,
11,
2915,
1155,
353,
8840,
836,
8,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestIfdBuilder_Find__Hit(t *testing.T) {
im := NewIfdMapping()
err := LoadStandardIfds(im)
log.PanicIf(err)
ti := NewTagIndex()
ib := NewIfdBuilder(im, ti, exifcommon.IfdStandardIfdIdentity, exifcommon.TestDefaultByteOrder)
bt := &BuilderTag{
ifdPath: exifcommon.IfdStandardIfdIdentity.UnindexedString(),
typeId: exifcommon.TypeByte,
tagId: 0x11,
value: NewIfdBuilderTagValueFromBytes([]byte("test string")),
}
err = ib.Add(bt)
log.PanicIf(err)
bt = &BuilderTag{
ifdPath: exifcommon.IfdStandardIfdIdentity.UnindexedString(),
typeId: exifcommon.TypeByte,
tagId: 0x22,
value: NewIfdBuilderTagValueFromBytes([]byte("test string2")),
}
err = ib.Add(bt)
log.PanicIf(err)
bt = &BuilderTag{
ifdPath: exifcommon.IfdStandardIfdIdentity.UnindexedString(),
typeId: exifcommon.TypeByte,
tagId: 0x33,
value: NewIfdBuilderTagValueFromBytes([]byte("test string3")),
}
err = ib.Add(bt)
log.PanicIf(err)
bt = &BuilderTag{
ifdPath: exifcommon.IfdStandardIfdIdentity.UnindexedString(),
typeId: exifcommon.TypeByte,
tagId: 0x11,
value: NewIfdBuilderTagValueFromBytes([]byte("test string4")),
}
err = ib.Add(bt)
log.PanicIf(err)
position, err := ib.Find(0x33)
log.PanicIf(err)
if position != 2 {
log.Panicf("Result was not in the right place: (%d)", position)
}
tags := ib.Tags()
bt = tags[position]
if bt.tagId != 0x33 {
log.Panicf("Found entry is not correct: (0x%04x)", bt.tagId)
}
} | explode_data.jsonl/36633 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 627
} | [
2830,
3393,
2679,
67,
3297,
95245,
563,
19498,
1155,
353,
8840,
836,
8,
341,
54892,
1669,
1532,
2679,
67,
6807,
2822,
9859,
1669,
8893,
19781,
2679,
5356,
25107,
340,
6725,
1069,
31270,
2679,
3964,
692,
72859,
1669,
1532,
5668,
1552,
74... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
func Test_ParseLocalConfig(t *testing.T) {
SetUp()
httpProfile := &HttpConf{}
err := lib.ParseLocalConfig("test.toml", httpProfile)
if err != nil {
t.Fatal(err)
}
fmt.Println(httpProfile)
TearDown()
} | explode_data.jsonl/16754 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 88
} | [
2830,
3393,
77337,
7319,
2648,
1155,
353,
8840,
836,
8,
341,
22212,
2324,
741,
28080,
8526,
1669,
609,
2905,
15578,
16094,
9859,
1669,
3051,
8937,
7319,
2648,
445,
1944,
73494,
75,
497,
1758,
8526,
340,
743,
1848,
961,
2092,
341,
197,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 2 |
func TestManager(t *testing.T) {
t.Parallel()
ctx := namespaces.WithNamespace(context.Background(), "buildkit-test")
tmpdir, err := ioutil.TempDir("", "cachemanager")
require.NoError(t, err)
defer os.RemoveAll(tmpdir)
snapshotter, err := native.NewSnapshotter(filepath.Join(tmpdir, "snapshots"))
require.NoError(t, err)
co, cleanup, err := newCacheManager(ctx, cmOpt{
snapshotter: snapshotter,
snapshotterName: "native",
})
require.NoError(t, err)
defer cleanup()
cm := co.manager
_, err = cm.Get(ctx, "foobar")
require.Error(t, err)
checkDiskUsage(ctx, t, cm, 0, 0)
active, err := cm.New(ctx, nil, nil, CachePolicyRetain)
require.NoError(t, err)
m, err := active.Mount(ctx, false, nil)
require.NoError(t, err)
lm := snapshot.LocalMounter(m)
target, err := lm.Mount()
require.NoError(t, err)
fi, err := os.Stat(target)
require.NoError(t, err)
require.Equal(t, fi.IsDir(), true)
err = lm.Unmount()
require.NoError(t, err)
_, err = cm.GetMutable(ctx, active.ID())
require.Error(t, err)
require.Equal(t, true, errors.Is(err, ErrLocked))
checkDiskUsage(ctx, t, cm, 1, 0)
snap, err := active.Commit(ctx)
require.NoError(t, err)
checkDiskUsage(ctx, t, cm, 1, 0)
_, err = cm.GetMutable(ctx, active.ID())
require.Error(t, err)
require.Equal(t, true, errors.Is(err, ErrLocked))
err = snap.Release(ctx)
require.NoError(t, err)
checkDiskUsage(ctx, t, cm, 0, 1)
active, err = cm.GetMutable(ctx, active.ID())
require.NoError(t, err)
checkDiskUsage(ctx, t, cm, 1, 0)
snap, err = active.Commit(ctx)
require.NoError(t, err)
checkDiskUsage(ctx, t, cm, 1, 0)
err = snap.(*immutableRef).finalizeLocked(ctx)
require.NoError(t, err)
err = snap.Release(ctx)
require.NoError(t, err)
_, err = cm.GetMutable(ctx, active.ID())
require.Error(t, err)
require.Equal(t, true, errors.Is(err, errNotFound))
_, err = cm.GetMutable(ctx, snap.ID())
require.Error(t, err)
require.Equal(t, true, errors.Is(err, errInvalid))
snap, err = cm.Get(ctx, snap.ID())
require.NoError(t, err)
snap2, err := cm.Get(ctx, snap.ID())
require.NoError(t, err)
checkDiskUsage(ctx, t, cm, 1, 0)
err = snap.Release(ctx)
require.NoError(t, err)
active2, err := cm.New(ctx, snap2, nil, CachePolicyRetain)
require.NoError(t, err)
checkDiskUsage(ctx, t, cm, 2, 0)
snap3, err := active2.Commit(ctx)
require.NoError(t, err)
err = snap2.Release(ctx)
require.NoError(t, err)
checkDiskUsage(ctx, t, cm, 2, 0)
err = snap3.Release(ctx)
require.NoError(t, err)
checkDiskUsage(ctx, t, cm, 0, 2)
buf := pruneResultBuffer()
err = cm.Prune(ctx, buf.C, client.PruneInfo{})
buf.close()
require.NoError(t, err)
checkDiskUsage(ctx, t, cm, 0, 0)
require.Equal(t, len(buf.all), 2)
err = cm.Close()
require.NoError(t, err)
dirs, err := ioutil.ReadDir(filepath.Join(tmpdir, "snapshots/snapshots"))
require.NoError(t, err)
require.Equal(t, 0, len(dirs))
} | explode_data.jsonl/3972 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 1209
} | [
2830,
3393,
2043,
1155,
353,
8840,
836,
8,
341,
3244,
41288,
7957,
2822,
20985,
1669,
58091,
26124,
22699,
5378,
19047,
1507,
330,
5834,
8226,
16839,
5130,
20082,
3741,
11,
1848,
1669,
43144,
65009,
6184,
19814,
330,
66,
610,
336,
8184,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestHead_TitleStatic(t *testing.T) {
t.Parallel()
pageFn := func() *l.Page {
page := l.NewPage()
page.DOM.Title.Add("value 1")
return page
}
h := setup(t, pageFn)
defer h.teardown()
hlivetest.Diff(t, "value 1", hlivetest.Title(t, h.pwpage))
} | explode_data.jsonl/27746 | {
"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,
12346,
72001,
11690,
1155,
353,
8840,
836,
8,
341,
3244,
41288,
7957,
2822,
35272,
24911,
1669,
2915,
368,
353,
75,
17558,
341,
197,
35272,
1669,
326,
7121,
2665,
2822,
197,
35272,
65796,
22967,
1904,
445,
957,
220,
16,
5130... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestShortCode_Equals(t *testing.T) {
a, _ := valueobject.NewShortCode("00FF")
b, _ := valueobject.NewShortCode("00FF")
assert.True(t, a.Equals(b))
} | explode_data.jsonl/28954 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 64
} | [
2830,
3393,
12472,
2078,
86567,
1155,
353,
8840,
836,
8,
341,
11323,
11,
716,
1669,
897,
1700,
7121,
12472,
2078,
445,
15,
15,
1748,
1138,
2233,
11,
716,
1669,
897,
1700,
7121,
12472,
2078,
445,
15,
15,
1748,
1138,
6948,
32443,
1155,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
func TestComplex(t *testing.T) {
runTestAWS(t, "complex.example.com", "complex", "v1alpha2", false, 1, true, false, nil)
runTestAWS(t, "complex.example.com", "complex", "legacy-v1alpha2", false, 1, true, false, nil)
runTestCloudformation(t, "complex.example.com", "complex", "v1alpha2", false, nil)
} | explode_data.jsonl/17486 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 116
} | [
2830,
3393,
31137,
1155,
353,
8840,
836,
8,
341,
56742,
2271,
36136,
1155,
11,
330,
23247,
7724,
905,
497,
330,
23247,
497,
330,
85,
16,
7141,
17,
497,
895,
11,
220,
16,
11,
830,
11,
895,
11,
2092,
340,
56742,
2271,
36136,
1155,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestFileSystemHandler(t *testing.T) {
const filename = "test.mp4"
const id = "test-id"
videoDir, _ := ioutil.TempDir(os.TempDir(), "TestFileSystemHandler")
filePath := filepath.Join(id, filename)
expectedPath := filepath.Join(videoDir, filePath)
expectedURL := filepath.Join("content", filePath)
defer os.RemoveAll(videoDir)
const content = "file content"
fs := NewFileSystemStorage(videoDir)
url, err := fs.StoreFile(filePath, strings.NewReader(content))
if err != nil {
t.Error("StoreFile failed")
}
if url != expectedURL {
t.Errorf("Invalid url received. Expected %s, got %s", expectedURL, url)
}
if _, err := os.Stat(expectedPath); os.IsNotExist(err) {
t.Error("File does not exists")
}
fileContent, err := ioutil.ReadFile(expectedPath)
if err != nil {
t.Error("Cannot read file content")
}
if string(fileContent) != content {
t.Error("File content does not match")
}
} | explode_data.jsonl/71167 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 324
} | [
2830,
3393,
50720,
3050,
1155,
353,
8840,
836,
8,
341,
4777,
3899,
284,
330,
1944,
16870,
19,
698,
4777,
877,
284,
330,
1944,
12897,
698,
96947,
6184,
11,
716,
1669,
43144,
65009,
6184,
9638,
65009,
6184,
1507,
330,
2271,
50720,
3050,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestTxQuery(t *testing.T) {
db := newTestDB(t, "")
defer closeDB(t, db)
exec(t, db, "CREATE|t1|name=string,age=int32,dead=bool")
exec(t, db, "INSERT|t1|name=Alice")
tx, err := db.Begin()
if err != nil {
t.Fatal(err)
}
defer tx.Rollback()
r, err := tx.Query("SELECT|t1|name|")
if err != nil {
t.Fatal(err)
}
defer r.Close()
if !r.Next() {
if r.Err() != nil {
t.Fatal(r.Err())
}
t.Fatal("expected one row")
}
var x string
err = r.Scan(&x)
if err != nil {
t.Fatal(err)
}
} | explode_data.jsonl/15976 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 258
} | [
2830,
3393,
31584,
2859,
1155,
353,
8840,
836,
8,
341,
20939,
1669,
501,
2271,
3506,
1155,
11,
14676,
16867,
3265,
3506,
1155,
11,
2927,
340,
67328,
1155,
11,
2927,
11,
330,
22599,
91,
83,
16,
91,
606,
28,
917,
11,
424,
16563,
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... | 6 |
func TestExpandArgs(t *testing.T) {
cases := []struct {
name string
args []string
env map[string]string
result []string
}{
{
name: "No Env",
args: []string{
"arg1",
},
result: []string{
"arg1",
},
},
{
name: "Simple Env",
args: []string{
"$ENV",
},
env: map[string]string{
"ENV": "test",
},
result: []string{
"test",
},
},
{
name: "Simple Env Multiple",
args: []string{
"$ENV",
"${ENV}",
"$ENV",
},
env: map[string]string{
"ENV": "test",
},
result: []string{
"test",
"test",
"test",
},
},
{
name: "Interpolation",
args: []string{
"This is $ENV property",
"This is ${ENV} property",
"This is $ENV property",
},
env: map[string]string{
"ENV": "test",
},
result: []string{
"This is test property",
"This is test property",
"This is test property",
},
},
{
name: "Multiple Env",
args: []string{
"This is $ENV property $ENV2",
},
env: map[string]string{
"ENV": "test",
"ENV2": "test2",
},
result: []string{
"This is test property test2",
},
},
}
for _, c := range cases {
setEnvFromMap(c.env)
command := &cobra.Command{}
ExpandArgs(command, c.args)
res := command.Flags().Args()
if !reflect.DeepEqual(res, c.result) {
t.Errorf("%s case failed: result args mismatch expected %s but got %s instead", c.name, c.result, res)
}
unsetEnvFromMap(c.env)
}
} | explode_data.jsonl/40213 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 757
} | [
2830,
3393,
38946,
4117,
1155,
353,
8840,
836,
8,
341,
1444,
2264,
1669,
3056,
1235,
341,
197,
11609,
256,
914,
198,
197,
31215,
256,
3056,
917,
198,
197,
57538,
262,
2415,
14032,
30953,
198,
197,
9559,
3056,
917,
198,
197,
59403,
197... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
func Test_removeLVGArtifacts_Success(t *testing.T) {
var (
c = setup(t, node1ID)
e = &mocks.GoMockExecutor{}
vg = lvgCR1.Name
err error
)
c.lvmOps = lvm.NewLVM(e, testLogger)
e.OnCommand(fmt.Sprintf(lvm.LVsInVGCmdTmpl, lvgCR1.Name)).Return("", "", nil)
e.OnCommand(fmt.Sprintf(lvm.VGRemoveCmdTmpl, vg)).Return("", "", nil)
e.OnCommand(fmt.Sprintf(lvm.PVsInVGCmdTmpl, lvm.EmptyName)).Return("", "", nil).Times(1)
err = c.removeLVGArtifacts(vg)
assert.Nil(t, err)
// expect that RemoveOrphanPVs failed and ignore it
e.OnCommand(fmt.Sprintf(lvm.PVsInVGCmdTmpl, lvm.EmptyName)).
Return("", "", errors.New("error")).Times(1)
err = c.removeLVGArtifacts(vg)
assert.Nil(t, err)
} | explode_data.jsonl/51724 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 329
} | [
2830,
3393,
18193,
40258,
38,
9286,
26401,
87161,
1155,
353,
8840,
836,
8,
341,
2405,
2399,
197,
1444,
256,
284,
6505,
1155,
11,
2436,
16,
915,
340,
197,
7727,
256,
284,
609,
16712,
82,
67131,
11571,
25255,
16094,
197,
5195,
70,
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 TestGetQueryParams(t *testing.T) {
for _, test := range queryParamsTestCases {
t.Run(test.name, func(t *testing.T) {
runQueryParamTestCase(t, test)
})
}
} | explode_data.jsonl/58006 | {
"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,
1949,
2859,
4870,
1155,
353,
8840,
836,
8,
341,
2023,
8358,
1273,
1669,
2088,
53469,
2271,
37302,
341,
197,
3244,
16708,
8623,
2644,
11,
2915,
1155,
353,
8840,
836,
8,
341,
298,
56742,
84085,
16458,
1155,
11,
1273,
340,
19... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
func TestDisconnectedFailure(t *testing.T) {
world, ri, sender, baseSender, listener, _, tlf := setupTest(t, 1)
defer world.Cleanup()
u := world.GetUsers()[0]
cl := world.Fc
trip := newConvTriple(t, tlf, u.Username)
res, err := ri.NewConversationRemote2(context.TODO(), chat1.NewConversationRemote2Arg{
IdTriple: trip,
TLFMessage: chat1.MessageBoxed{
ClientHeader: chat1.MessageClientHeader{
Conv: trip,
TlfName: u.Username,
TlfPublic: false,
},
KeyGeneration: 1,
},
})
require.NoError(t, err)
tc := userTc(t, world, u)
tc.G.MessageDeliverer.Disconnected(context.TODO())
tc.G.MessageDeliverer.(*Deliverer).SetSender(FailingSender{})
// Send nonblock
obids := []chat1.OutboxID{}
for i := 0; i < 3; i++ {
obid, _, _, err := sender.Send(context.TODO(), res.ConvID, chat1.MessagePlaintext{
ClientHeader: chat1.MessageClientHeader{
Conv: trip,
Sender: u.User.GetUID().ToBytes(),
TlfName: u.Username,
TlfPublic: false,
},
}, 0)
require.NoError(t, err)
obids = append(obids, obid)
cl.Advance(time.Millisecond)
}
var allrecvd []chat1.OutboxRecord
var recvd []chat1.OutboxRecord
appendUnique := func(a []chat1.OutboxRecord, r []chat1.OutboxRecord) (res []chat1.OutboxRecord) {
m := make(map[string]bool)
for _, i := range a {
m[hex.EncodeToString(i.OutboxID)] = true
res = append(res, i)
}
for _, i := range r {
if !m[hex.EncodeToString(i.OutboxID)] {
res = append(res, i)
}
}
return res
}
for {
select {
case recvd = <-listener.failing:
allrecvd = appendUnique(allrecvd, recvd)
if len(allrecvd) >= len(obids) {
break
}
continue
case <-time.After(20 * time.Second):
require.Fail(t, "timeout in failing loop")
break
}
break
}
require.Equal(t, len(obids), len(allrecvd), "invalid length")
recordCompare(t, obids, allrecvd)
t.Logf("reconnecting and checking for successes")
<-tc.G.MessageDeliverer.Stop(context.TODO())
<-tc.G.MessageDeliverer.Stop(context.TODO())
tc.G.MessageDeliverer.(*Deliverer).SetSender(baseSender)
f := func() libkb.SecretUI {
return &libkb.TestSecretUI{Passphrase: u.Passphrase}
}
outbox := storage.NewOutbox(tc.G, u.User.GetUID().ToBytes(), f)
for _, obid := range obids {
require.NoError(t, outbox.RetryMessage(context.TODO(), obid))
}
tc.G.MessageDeliverer.Connected(context.TODO())
tc.G.MessageDeliverer.Start(context.TODO(), u.User.GetUID().ToBytes())
for {
select {
case inc := <-listener.incoming:
if inc >= len(obids) {
break
}
continue
case <-time.After(20 * time.Second):
require.Fail(t, "timeout in incoming loop")
break
}
break
}
require.Equal(t, len(obids), len(listener.obids), "wrong amount of successes")
require.Equal(t, obids, listener.obids, "wrong obids for successes")
} | explode_data.jsonl/50757 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 1226
} | [
2830,
3393,
77021,
17507,
1155,
353,
8840,
836,
8,
1476,
76508,
11,
24185,
11,
4646,
11,
2331,
20381,
11,
11446,
11,
8358,
259,
11008,
1669,
6505,
2271,
1155,
11,
220,
16,
340,
16867,
1879,
727,
60639,
2822,
10676,
1669,
1879,
2234,
7... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 4 |
func TestAdHocPackages_Issue36951(t *testing.T) {
const adHoc = `
-- b/b.go --
package b
func Hello() {
var x int
}
`
runner.Run(t, adHoc, func(t *testing.T, env *Env) {
env.OpenFile("b/b.go")
env.Await(env.DiagnosticAtRegexp("b/b.go", "x"))
})
} | explode_data.jsonl/38913 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 125
} | [
2830,
3393,
2589,
39,
509,
69513,
7959,
83890,
18,
21,
24,
20,
16,
1155,
353,
8840,
836,
8,
341,
4777,
993,
39,
509,
284,
22074,
313,
293,
3470,
18002,
39514,
1722,
293,
271,
2830,
21927,
368,
341,
2405,
856,
526,
198,
532,
3989,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestMissingDependencyFixes(t *testing.T) {
testenv.NeedsGo1Point(t, 14)
const mod = `
-- go.mod --
module mod.com
go 1.12
-- main.go --
package main
import "example.com/blah"
import "random.org/blah"
var _, _ = blah.Name, hello.Name
`
const want = `module mod.com
go 1.12
require random.org v1.2.3
`
runModfileTest(t, mod, proxy, func(t *testing.T, env *Env) {
env.OpenFile("main.go")
var d protocol.PublishDiagnosticsParams
env.Await(
OnceMet(
env.DiagnosticAtRegexp("main.go", `"random.org/blah"`),
ReadDiagnostics("main.go", &d),
),
)
var randomDiag protocol.Diagnostic
for _, diag := range d.Diagnostics {
if strings.Contains(diag.Message, "random.org") {
randomDiag = diag
}
}
env.ApplyQuickFixes("main.go", []protocol.Diagnostic{randomDiag})
if got := env.ReadWorkspaceFile("go.mod"); got != want {
t.Fatalf("unexpected go.mod content:\n%s", tests.Diff(want, got))
}
})
} | explode_data.jsonl/3739 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 408
} | [
2830,
3393,
25080,
36387,
25958,
288,
1155,
353,
8840,
836,
8,
341,
18185,
3160,
2067,
68,
6767,
10850,
16,
2609,
1155,
11,
220,
16,
19,
340,
4777,
1463,
284,
22074,
313,
728,
10929,
39514,
4352,
1463,
905,
271,
3346,
220,
16,
13,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestFailSuspendedAndPendingNodesAfterShutdown(t *testing.T) {
wf := unmarshalWF(deadlineWf)
wf.Spec.Shutdown = wfv1.ShutdownStrategyStop
cancel, controller := newController(wf)
defer cancel()
ctx := context.Background()
woc := newWorkflowOperationCtx(wf, controller)
t.Run("After Shutdown", func(t *testing.T) {
woc.operate(ctx)
assert.Equal(t, wfv1.WorkflowFailed, woc.wf.Status.Phase)
for _, node := range woc.wf.Status.Nodes {
assert.Equal(t, wfv1.NodeFailed, node.Phase)
}
})
} | explode_data.jsonl/71027 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 213
} | [
2830,
3393,
19524,
50,
66349,
3036,
32027,
12288,
6025,
62004,
1155,
353,
8840,
836,
8,
341,
6692,
69,
1669,
650,
27121,
32131,
83207,
1056,
54,
69,
340,
6692,
69,
36473,
10849,
18452,
284,
289,
27890,
16,
10849,
18452,
19816,
10674,
19... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
func TestMkdir(t *testing.T) {
err := Mkdir(dirName, 0755)
if err != nil {
panic(err)
}
t.Cleanup(func() {
_ = Remove(dirs)
})
if !Exists(dirName) {
t.Error("Mkdir test failed!")
}
} | explode_data.jsonl/34162 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 97
} | [
2830,
3393,
44,
12438,
1155,
353,
8840,
836,
8,
1476,
9859,
1669,
386,
12438,
14161,
675,
11,
220,
15,
22,
20,
20,
340,
743,
1848,
961,
2092,
341,
197,
30764,
3964,
340,
197,
630,
3244,
727,
60639,
18552,
368,
341,
197,
197,
62,
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 TestApp01myCustomerHndlrRowUpdate(t *testing.T) {
var td *TestData_App01myCustomer
t.Logf("TestCustomer.RowUpdate()...\n")
td = &TestData_App01myCustomer{}
td.Setup(t)
t.Logf("TestCustomer.RowUpdate() - End of Test\n\n\n")
} | explode_data.jsonl/63219 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 115
} | [
2830,
3393,
2164,
15,
16,
2408,
12792,
39,
303,
19018,
3102,
4289,
1155,
353,
8840,
836,
8,
341,
262,
762,
17941,
688,
353,
83920,
36117,
15,
16,
2408,
12792,
271,
262,
259,
98954,
445,
2271,
12792,
14657,
4289,
368,
30801,
77,
1138,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestStream_PutBytesTo(t *testing.T) {
t.Run("test", func(t *testing.T) {
assert := base.NewAssert(t)
testRange := getTestRange(0, 3*streamBlockSize, 10, 10, 93)
for _, i := range testRange {
bytes := make([]byte, i)
for n := 0; n < i; n++ {
bytes[n] = byte(n)
}
for _, j := range testRange {
stream := NewStream()
if i+j < streamPosBody {
assert(stream.PutBytesTo(bytes, j)).IsFalse()
} else {
assert(stream.PutBytesTo(bytes, j)).IsTrue()
assert(stream.GetBuffer()[j:]).Equals(bytes)
assert(stream.GetWritePos()).Equals(i + j)
}
stream.Release()
}
}
})
} | explode_data.jsonl/21203 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 289
} | [
2830,
3393,
3027,
1088,
332,
7078,
1249,
1155,
353,
8840,
836,
8,
341,
3244,
16708,
445,
1944,
497,
2915,
1155,
353,
8840,
836,
8,
341,
197,
6948,
1669,
2331,
7121,
8534,
1155,
340,
197,
18185,
6046,
1669,
633,
2271,
6046,
7,
15,
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... | 5 |
func TestCloudTasksListTasks(t *testing.T) {
var nextPageToken string = ""
var tasksElement *taskspb.Task = &taskspb.Task{}
var tasks = []*taskspb.Task{tasksElement}
var expectedResponse = &taskspb.ListTasksResponse{
NextPageToken: nextPageToken,
Tasks: tasks,
}
mockCloudTasks.err = nil
mockCloudTasks.reqs = nil
mockCloudTasks.resps = append(mockCloudTasks.resps[:0], expectedResponse)
var formattedParent string = fmt.Sprintf("projects/%s/locations/%s/queues/%s", "[PROJECT]", "[LOCATION]", "[QUEUE]")
var request = &taskspb.ListTasksRequest{
Parent: formattedParent,
}
c, err := NewClient(context.Background(), clientOpt)
if err != nil {
t.Fatal(err)
}
resp, err := c.ListTasks(context.Background(), request).Next()
if err != nil {
t.Fatal(err)
}
if want, got := request, mockCloudTasks.reqs[0]; !proto.Equal(want, got) {
t.Errorf("wrong request %q, want %q", got, want)
}
want := (interface{})(expectedResponse.Tasks[0])
got := (interface{})(resp)
var ok bool
switch want := (want).(type) {
case proto.Message:
ok = proto.Equal(want, got.(proto.Message))
default:
ok = want == got
}
if !ok {
t.Errorf("wrong response %q, want %q)", got, want)
}
} | explode_data.jsonl/30861 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 479
} | [
2830,
3393,
16055,
25449,
852,
25449,
1155,
353,
8840,
836,
8,
341,
2405,
83595,
3323,
914,
284,
8389,
2405,
9079,
1691,
353,
8202,
43467,
28258,
284,
609,
8202,
43467,
28258,
16094,
2405,
9079,
284,
29838,
8202,
43467,
28258,
90,
24760,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestDocsOptions(t *testing.T) {
table := rifftesting.OptionsTable{
{
Name: "valid",
Options: &commands.DocsOptions{
Directory: "docs",
},
ShouldValidate: true,
},
{
Name: "invalid",
Options: &commands.DocsOptions{
Directory: "",
},
ExpectFieldErrors: cli.ErrMissingField(cli.DirectoryFlagName),
},
}
table.Run(t)
} | explode_data.jsonl/78286 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 164
} | [
2830,
3393,
63107,
3798,
1155,
353,
8840,
836,
8,
341,
26481,
1669,
36924,
723,
59855,
22179,
2556,
515,
197,
197,
515,
298,
21297,
25,
330,
1891,
756,
298,
197,
3798,
25,
609,
24270,
909,
14128,
3798,
515,
571,
197,
9310,
25,
330,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestEncodeMutation(t *testing.T) {
for _, test := range []struct {
name string
mutation Mutation
wantProto *sppb.Mutation
wantErr error
}{
{
"OpDelete",
Mutation{opDelete, "t_test", Key{1}, nil, nil},
&sppb.Mutation{
Operation: &sppb.Mutation_Delete_{
Delete: &sppb.Mutation_Delete{
Table: "t_test",
KeySet: &sppb.KeySet{
Keys: []*proto3.ListValue{listValueProto(intProto(1))},
},
},
},
},
nil,
},
{
"OpDelete - Key error",
Mutation{opDelete, "t_test", Key{struct{}{}}, nil, nil},
&sppb.Mutation{
Operation: &sppb.Mutation_Delete_{
Delete: &sppb.Mutation_Delete{
Table: "t_test",
KeySet: &sppb.KeySet{},
},
},
},
errInvdKeyPartType(struct{}{}),
},
{
"OpInsert",
Mutation{opInsert, "t_test", nil, []string{"key", "val"}, []interface{}{"foo", 1}},
&sppb.Mutation{
Operation: &sppb.Mutation_Insert{
Insert: &sppb.Mutation_Write{
Table: "t_test",
Columns: []string{"key", "val"},
Values: []*proto3.ListValue{listValueProto(stringProto("foo"), intProto(1))},
},
},
},
nil,
},
{
"OpInsert - Value Type Error",
Mutation{opInsert, "t_test", nil, []string{"key", "val"}, []interface{}{struct{}{}, 1}},
&sppb.Mutation{
Operation: &sppb.Mutation_Insert{
Insert: &sppb.Mutation_Write{},
},
},
errEncoderUnsupportedType(struct{}{}),
},
{
"OpInsertOrUpdate",
Mutation{opInsertOrUpdate, "t_test", nil, []string{"key", "val"}, []interface{}{"foo", 1}},
&sppb.Mutation{
Operation: &sppb.Mutation_InsertOrUpdate{
InsertOrUpdate: &sppb.Mutation_Write{
Table: "t_test",
Columns: []string{"key", "val"},
Values: []*proto3.ListValue{listValueProto(stringProto("foo"), intProto(1))},
},
},
},
nil,
},
{
"OpInsertOrUpdate - Value Type Error",
Mutation{opInsertOrUpdate, "t_test", nil, []string{"key", "val"}, []interface{}{struct{}{}, 1}},
&sppb.Mutation{
Operation: &sppb.Mutation_InsertOrUpdate{
InsertOrUpdate: &sppb.Mutation_Write{},
},
},
errEncoderUnsupportedType(struct{}{}),
},
{
"OpReplace",
Mutation{opReplace, "t_test", nil, []string{"key", "val"}, []interface{}{"foo", 1}},
&sppb.Mutation{
Operation: &sppb.Mutation_Replace{
Replace: &sppb.Mutation_Write{
Table: "t_test",
Columns: []string{"key", "val"},
Values: []*proto3.ListValue{listValueProto(stringProto("foo"), intProto(1))},
},
},
},
nil,
},
{
"OpReplace - Value Type Error",
Mutation{opReplace, "t_test", nil, []string{"key", "val"}, []interface{}{struct{}{}, 1}},
&sppb.Mutation{
Operation: &sppb.Mutation_Replace{
Replace: &sppb.Mutation_Write{},
},
},
errEncoderUnsupportedType(struct{}{}),
},
{
"OpUpdate",
Mutation{opUpdate, "t_test", nil, []string{"key", "val"}, []interface{}{"foo", 1}},
&sppb.Mutation{
Operation: &sppb.Mutation_Update{
Update: &sppb.Mutation_Write{
Table: "t_test",
Columns: []string{"key", "val"},
Values: []*proto3.ListValue{listValueProto(stringProto("foo"), intProto(1))},
},
},
},
nil,
},
{
"OpUpdate - Value Type Error",
Mutation{opUpdate, "t_test", nil, []string{"key", "val"}, []interface{}{struct{}{}, 1}},
&sppb.Mutation{
Operation: &sppb.Mutation_Update{
Update: &sppb.Mutation_Write{},
},
},
errEncoderUnsupportedType(struct{}{}),
},
{
"OpKnown - Unknown Mutation Operation Code",
Mutation{op(100), "t_test", nil, nil, nil},
&sppb.Mutation{},
errInvdMutationOp(Mutation{op(100), "t_test", nil, nil, nil}),
},
} {
gotProto, gotErr := test.mutation.proto()
if gotErr != nil {
if !reflect.DeepEqual(gotErr, test.wantErr) {
t.Errorf("%s: %v.proto() returns error %v, want %v", test.name, test.mutation, gotErr, test.wantErr)
}
continue
}
if !reflect.DeepEqual(gotProto, test.wantProto) {
t.Errorf("%s: %v.proto() = (%v, nil), want (%v, nil)", test.name, test.mutation, gotProto, test.wantProto)
}
}
} | explode_data.jsonl/50037 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 2013
} | [
2830,
3393,
32535,
53998,
1155,
353,
8840,
836,
8,
341,
2023,
8358,
1273,
1669,
2088,
3056,
1235,
341,
197,
11609,
414,
914,
198,
197,
2109,
22705,
220,
67203,
198,
197,
50780,
31549,
353,
82,
602,
65,
1321,
22705,
198,
197,
50780,
77... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 5 |
func TestNewSCRAMPassword(t *testing.T) {
password := "datalake"
scram := NewSCRAMPassword(password)
if scram.password != password {
t.Errorf("plaintext password not set properly. expected %q actual %q", password, scram.password)
return
}
if scram.Iterations != scramDefaultIterations {
t.Errorf("iterations not set properly. expected %d actual %d", scramDefaultIterations, scram.Iterations)
return
}
if scram.SaltLength != scramDefaultSaltLength {
t.Errorf("salt length not set properly. expected %d actual %d", scramDefaultSaltLength, scram.SaltLength)
return
}
} | explode_data.jsonl/28535 | {
"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,
3564,
3540,
33905,
4876,
1155,
353,
8840,
836,
8,
341,
58199,
1669,
330,
82553,
726,
1837,
29928,
2396,
1669,
1532,
3540,
33905,
4876,
22768,
692,
743,
34961,
11630,
961,
3552,
341,
197,
3244,
13080,
445,
71223,
3552,
537,
7... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 4 |
func TestServiceAccountAutoCreate(t *testing.T) {
c, _, stopFunc := startServiceAccountTestServer(t)
defer stopFunc()
ns := "test-service-account-creation"
// Create namespace
_, err := c.Core().Namespaces().Create(&api.Namespace{ObjectMeta: api.ObjectMeta{Name: ns}})
if err != nil {
t.Fatalf("could not create namespace: %v", err)
}
// Get service account
defaultUser, err := getServiceAccount(c, ns, "default", true)
if err != nil {
t.Fatalf("Default serviceaccount not created: %v", err)
}
// Delete service account
err = c.Core().ServiceAccounts(ns).Delete(defaultUser.Name, nil)
if err != nil {
t.Fatalf("Could not delete default serviceaccount: %v", err)
}
// Get recreated service account
defaultUser2, err := getServiceAccount(c, ns, "default", true)
if err != nil {
t.Fatalf("Default serviceaccount not created: %v", err)
}
if defaultUser2.UID == defaultUser.UID {
t.Fatalf("Expected different UID with recreated serviceaccount")
}
} | explode_data.jsonl/67128 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 328
} | [
2830,
3393,
1860,
7365,
13253,
4021,
1155,
353,
8840,
836,
8,
341,
1444,
11,
8358,
2936,
9626,
1669,
1191,
1860,
7365,
2271,
5475,
1155,
340,
16867,
2936,
9626,
2822,
84041,
1669,
330,
1944,
23461,
49982,
12,
37375,
1837,
197,
322,
4230... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestStressSurpriseServerCloses(t *testing.T) {
defer afterTest(t)
if testing.Short() {
t.Skip("skipping test in short mode")
}
ts := httptest.NewServer(HandlerFunc(func(w ResponseWriter, r *Request) {
w.Header().Set("Content-Length", "5")
w.Header().Set("Content-Type", "text/plain")
w.Write([]byte("Hello"))
w.(Flusher).Flush()
conn, buf, _ := w.(Hijacker).Hijack()
buf.Flush()
conn.Close()
}))
defer ts.Close()
tr := &Transport{DisableKeepAlives: false}
c := &Client{Transport: tr}
defer tr.CloseIdleConnections()
// Do a bunch of traffic from different goroutines. Send to activityc
// after each request completes, regardless of whether it failed.
// If these are too high, OS X exhausts its ephemeral ports
// and hangs waiting for them to transition TCP states. That's
// not what we want to test. TODO(bradfitz): use an io.Pipe
// dialer for this test instead?
const (
numClients = 20
reqsPerClient = 25
)
activityc := make(chan bool)
for i := 0; i < numClients; i++ {
go func() {
for i := 0; i < reqsPerClient; i++ {
res, err := c.Get(ts.URL)
if err == nil {
// We expect errors since the server is
// hanging up on us after telling us to
// send more requests, so we don't
// actually care what the error is.
// But we want to close the body in cases
// where we won the race.
res.Body.Close()
}
activityc <- true
}
}()
}
// Make sure all the request come back, one way or another.
for i := 0; i < numClients*reqsPerClient; i++ {
select {
case <-activityc:
case <-time.After(5 * time.Second):
t.Fatalf("presumed deadlock; no HTTP client activity seen in awhile")
}
}
} | explode_data.jsonl/4881 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 648
} | [
2830,
3393,
623,
673,
23043,
9671,
5475,
34,
49341,
1155,
353,
8840,
836,
8,
341,
16867,
1283,
2271,
1155,
340,
743,
7497,
55958,
368,
341,
197,
3244,
57776,
445,
4886,
5654,
1273,
304,
2805,
3856,
1138,
197,
532,
57441,
1669,
54320,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestStatefulSetPodManagementPolicy(t *testing.T) {
f := newIBDFixture(t, k8s.EnvGKE)
defer f.TearDown()
targName := "redis"
iTarget := NewSanchoDockerBuildImageTarget(f)
yaml := strings.Replace(
testyaml.RedisStatefulSetYAML,
`image: "docker.io/bitnami/redis:4.0.12"`,
fmt.Sprintf(`image: %q`, iTarget.Refs.LocalRef().String()), 1)
kTarget := k8s.MustTarget(model.TargetName(targName), yaml)
_, err := f.ibd.BuildAndDeploy(f.ctx, f.st,
[]model.TargetSpec{kTarget}, store.BuildStateSet{})
if err != nil {
t.Fatal(err)
}
assert.NoError(t, err)
assert.NotContains(t, f.k8s.Yaml, "podManagementPolicy: Parallel")
_, err = f.ibd.BuildAndDeploy(f.ctx, f.st,
[]model.TargetSpec{
iTarget,
kTarget.WithDependencyIDs([]model.TargetID{iTarget.ID()}),
},
store.BuildStateSet{})
if err != nil {
t.Fatal(err)
}
assert.NoError(t, err)
assert.Contains(t, f.k8s.Yaml, "podManagementPolicy: Parallel")
} | explode_data.jsonl/38256 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 413
} | [
2830,
3393,
1397,
1262,
1649,
23527,
22237,
13825,
1155,
353,
8840,
836,
8,
341,
1166,
1669,
501,
3256,
5262,
12735,
1155,
11,
595,
23,
82,
81214,
38,
3390,
340,
16867,
282,
836,
682,
4454,
2822,
3244,
858,
675,
1669,
330,
21748,
1837... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestMustBe(t *testing.T) {
typ := reflect.TypeOf(E1{})
mustBe(typ, reflect.Struct)
defer func() {
if r := recover(); r != nil {
valueErr, ok := r.(*reflect.ValueError)
if !ok {
t.Errorf("unexpected Method: %s", valueErr.Method)
t.Error("expected panic with *reflect.ValueError")
return
}
if valueErr.Method != "github.com/jmoiron/sqlx/reflectx.TestMustBe" {
}
if valueErr.Kind != reflect.String {
t.Errorf("unexpected Kind: %s", valueErr.Kind)
}
} else {
t.Error("expected panic")
}
}()
typ = reflect.TypeOf("string")
mustBe(typ, reflect.Struct)
t.Error("got here, didn't expect to")
} | explode_data.jsonl/59109 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 275
} | [
2830,
3393,
31776,
3430,
1155,
353,
8840,
836,
8,
341,
25314,
1669,
8708,
73921,
10722,
16,
37790,
2109,
590,
3430,
66783,
11,
8708,
51445,
692,
16867,
2915,
368,
341,
197,
743,
435,
1669,
11731,
2129,
435,
961,
2092,
341,
298,
16309,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestPanickingCarryOn_Handle(t *testing.T) {
defer func() {
if recover() == nil {
t.Error("panics should went thru when not our errors")
}
}()
panickingHandle()
} | explode_data.jsonl/23196 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 67
} | [
2830,
3393,
35693,
16272,
8852,
884,
1925,
42714,
1155,
353,
8840,
836,
8,
341,
16867,
2915,
368,
341,
197,
743,
11731,
368,
621,
2092,
341,
298,
3244,
6141,
445,
848,
1211,
1265,
3937,
40078,
979,
537,
1039,
5975,
1138,
197,
197,
532... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 2 |
func TestRemoveRepByMap(t *testing.T) {
type args struct {
members [][]byte
}
tests := []struct {
name string
args args
want [][]byte
}{
{
name: "single member",
args: args{
members: [][]byte{[]byte("value1")},
},
want: [][]byte{[]byte("value1")},
},
{
name: "multi members",
args: args{
members: [][]byte{[]byte("value1"), []byte("value2"), []byte("value3")},
},
want: [][]byte{[]byte("value1"), []byte("value2"), []byte("value3")},
},
{
name: "with duplicate members",
args: args{
members: [][]byte{[]byte("value1"), []byte("value2"), []byte("value1")},
},
want: [][]byte{[]byte("value1"), []byte("value2")},
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if got := RemoveRepByMap(tt.args.members); !reflect.DeepEqual(got, tt.want) {
t.Errorf("RemoveRepByMap() = %v, want %v", got, tt.want)
}
})
}
} | explode_data.jsonl/56408 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 417
} | [
2830,
3393,
13021,
18327,
1359,
2227,
1155,
353,
8840,
836,
8,
341,
13158,
2827,
2036,
341,
197,
2109,
7062,
52931,
3782,
198,
197,
532,
78216,
1669,
3056,
1235,
341,
197,
11609,
914,
198,
197,
31215,
2827,
198,
197,
50780,
52931,
3782,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
func TestCullCheckedRules(t *testing.T) {
availableRules := generateDummyRuleMatrices()
cases := []struct {
name string
history []shared.Accountability
evalRes map[shared.ClientID]shared.EvaluationReturn
expected []shared.Accountability
}{
{
name: "Basic cull test",
history: []shared.Accountability{
{
ClientID: shared.Teams["Team1"],
Pairs: []rules.VariableValuePair{
{
VariableName: rules.SanctionPaid,
Values: []float64{5},
},
{
VariableName: rules.SanctionExpected,
Values: []float64{5},
},
},
},
},
evalRes: map[shared.ClientID]shared.EvaluationReturn{
shared.Teams["Team1"]: {
Rules: []rules.RuleMatrix{
availableRules[9],
},
Evaluations: []bool{true},
},
},
expected: []shared.Accountability{},
},
{
name: "More Advanced Cull",
history: []shared.Accountability{
{
ClientID: shared.Teams["Team1"],
Pairs: []rules.VariableValuePair{
{
VariableName: rules.SanctionPaid,
Values: []float64{5},
},
{
VariableName: rules.SanctionExpected,
Values: []float64{5},
},
},
},
{
ClientID: shared.Teams["Team2"],
Pairs: []rules.VariableValuePair{
{
VariableName: rules.SanctionPaid,
Values: []float64{5},
},
{
VariableName: rules.SanctionExpected,
Values: []float64{5},
},
},
},
},
evalRes: map[shared.ClientID]shared.EvaluationReturn{
shared.Teams["Team1"]: {
Rules: []rules.RuleMatrix{
availableRules[9],
},
Evaluations: []bool{true},
},
},
expected: []shared.Accountability{
{
ClientID: shared.Teams["Team2"],
Pairs: []rules.VariableValuePair{
{
VariableName: rules.SanctionPaid,
Values: []float64{5},
},
{
VariableName: rules.SanctionExpected,
Values: []float64{5},
},
},
},
},
},
{
name: "Even More Advanced Cull",
history: []shared.Accountability{
{
ClientID: shared.Teams["Team1"],
Pairs: []rules.VariableValuePair{
{
VariableName: rules.SanctionPaid,
Values: []float64{5},
},
{
VariableName: rules.SanctionExpected,
Values: []float64{5},
},
},
},
{
ClientID: shared.Teams["Team2"],
Pairs: []rules.VariableValuePair{
{
VariableName: rules.SanctionPaid,
Values: []float64{5},
},
{
VariableName: rules.SanctionExpected,
Values: []float64{5},
},
},
},
},
evalRes: map[shared.ClientID]shared.EvaluationReturn{
shared.Teams["Team1"]: {
Rules: []rules.RuleMatrix{
availableRules[9],
},
Evaluations: []bool{true},
},
shared.Teams["Team2"]: {
Rules: []rules.RuleMatrix{
availableRules[8],
},
Evaluations: []bool{true},
},
},
expected: []shared.Accountability{
{
ClientID: shared.Teams["Team2"],
Pairs: []rules.VariableValuePair{
{
VariableName: rules.SanctionPaid,
Values: []float64{5},
},
{
VariableName: rules.SanctionExpected,
Values: []float64{5},
},
},
},
},
},
}
for _, tc := range cases {
t.Run(tc.name, func(t *testing.T) {
res := cullCheckedRules(tc.history, tc.evalRes, generateRuleStore(), generateDummyVariableCache())
if !reflect.DeepEqual(res, tc.expected) {
t.Errorf("Expected %v got %v", tc.expected, res)
}
})
}
} | explode_data.jsonl/74051 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 1869
} | [
2830,
3393,
34,
617,
12666,
26008,
1155,
353,
8840,
836,
8,
341,
197,
10334,
26008,
1669,
6923,
43344,
11337,
11575,
24419,
741,
1444,
2264,
1669,
3056,
1235,
341,
197,
11609,
257,
914,
198,
197,
9598,
2579,
220,
3056,
6100,
30877,
2897... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestHandlerWrapper_Metric(t *testing.T) {
Convey("A handler wrapper allows custom metrics to be added to a report", t, func() {
a := NewAgent(Config{})
hw := &HandlerWrapper{agent: a}
Convey("Doesnot panic if there is no report", func() {
So(hw.report, ShouldBeNil)
So(func() {
hw.Metric("foo", "bar")
}, ShouldNotPanic)
})
Convey("Add a custom string metric to the report", func() {
r := NewReport(context.TODO(), hw)
hw.report = r
So(len(hw.report.CustomMetrics), ShouldEqual, 0)
hw.Metric("foo", "bar")
So(len(hw.report.CustomMetrics), ShouldEqual, 1)
})
Convey("Add a custom numeric metric to the report", func() {
r := NewReport(context.TODO(), hw)
hw.report = r
So(len(hw.report.CustomMetrics), ShouldEqual, 0)
hw.Metric("meaning of life", 42)
So(len(hw.report.CustomMetrics), ShouldEqual, 1)
})
Convey("Does not add metric if name is too long", func() {
r := NewReport(context.TODO(), hw)
hw.report = r
So(len(hw.report.CustomMetrics), ShouldEqual, 0)
hw.Metric(strings.Repeat("X", 129), "bar")
So(len(hw.report.CustomMetrics), ShouldEqual, 0)
})
Convey("Does not add metric if value is not string or number", func() {
r := NewReport(context.TODO(), hw)
hw.report = r
So(len(hw.report.CustomMetrics), ShouldEqual, 0)
hw.Metric("foo", true)
So(len(hw.report.CustomMetrics), ShouldEqual, 0)
})
})
} | explode_data.jsonl/35582 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 578
} | [
2830,
3393,
3050,
11542,
1245,
16340,
1155,
353,
8840,
836,
8,
341,
93070,
5617,
445,
32,
7013,
13261,
6147,
2526,
16734,
311,
387,
3694,
311,
264,
1895,
497,
259,
11,
2915,
368,
341,
197,
11323,
1669,
1532,
16810,
33687,
37790,
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 TestCreateDirIfMissing(t *testing.T) {
dirPath := "./test_path"
common.CreateDirIfMissing(dirPath)
assert.DirExists(t, dirPath)
//clean up
os.Remove(dirPath)
} | explode_data.jsonl/21750 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 66
} | [
2830,
3393,
4021,
6184,
2679,
25080,
1155,
353,
8840,
836,
8,
1476,
48532,
1820,
1669,
5924,
1944,
2638,
1837,
83825,
7251,
6184,
2679,
25080,
14161,
1820,
340,
6948,
83757,
15575,
1155,
11,
5419,
1820,
692,
197,
322,
18377,
705,
198,
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 |
func TestMonaDecodeToString(t *testing.T) {
script1 := "76a9146e5bb7226a337fe8307b4192ae5c3fab9fa9edf588ac"
script2 := "a9146449f568c9cd2378138f2636e1567112a184a9e887"
script3 := "0014751e76e8199196d454941c45d1b3a323f1433bd6"
tests := []TestcaseDecode{
{
name: "P2PKH",
input: script1,
output: "MHxgS2XMXjeJ4if2PRRbWYcdwZPWfdwaDT",
},
{
name: "P2SH",
input: script2,
output: "PHjTKtgYLTJ9D2Bzw2f6xBB41KBm2HeGfg",
},
{
name: "Segwit",
input: script3,
output: "mona1qw508d6qejxtdg4y5r3zarvary0c5xw7kg5lnx5",
},
}
RunTestsDecode(t, slip44.MONACOIN, tests)
} | explode_data.jsonl/9953 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 354
} | [
2830,
3393,
44,
6721,
32564,
5870,
1155,
353,
8840,
836,
8,
341,
86956,
16,
1669,
330,
22,
21,
64,
24,
16,
19,
21,
68,
20,
6066,
22,
17,
17,
21,
64,
18,
18,
22,
1859,
23,
18,
15,
22,
65,
19,
16,
24,
17,
5918,
20,
66,
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 TestRuleIPString(t *testing.T) {
common.Log.Debug("Entering function: %s", common.GetFunctionName())
sqls := []string{
"insert into tbl (IP,name) values('10.20.306.122','test')",
}
for _, sql := range sqls {
q, err := NewQuery4Audit(sql)
if err == nil {
rule := q.RuleIPString()
if rule.Item != "LIT.001" {
t.Error("Rule not match:", rule.Item, "Expect : LIT.001")
}
} else {
t.Error("sqlparser.Parse Error:", err)
}
}
common.Log.Debug("Exiting function: %s", common.GetFunctionName())
} | explode_data.jsonl/76760 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 219
} | [
2830,
3393,
11337,
3298,
703,
1155,
353,
8840,
836,
8,
341,
83825,
5247,
20345,
445,
82867,
729,
25,
1018,
82,
497,
4185,
2234,
5152,
675,
2398,
30633,
82,
1669,
3056,
917,
515,
197,
197,
1,
4208,
1119,
21173,
320,
3298,
22006,
8,
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... | 4 |
func TestParseThreshold(t *testing.T) {
tests := []struct {
input string
eMin float64
eMax float64
eErr error
}{
{
input: "10",
eMin: 0,
eMax: 10,
eErr: nil,
},
{
input: "10:",
eMin: 10,
eMax: MaxFloat64,
eErr: nil,
},
{
input: "~:10",
eMin: MinFloat64,
eMax: 10,
eErr: nil,
},
{
input: "10:20",
eMin: 10,
eMax: 20,
eErr: nil,
},
{
input: "10:20",
eMin: 10,
eMax: 20,
eErr: nil,
},
{
input: "10:20:30",
eMin: 0,
eMax: 0,
eErr: ErrBadThresholdFormat,
},
}
for i := range tests {
min, max, err := parseThreshold(tests[i].input)
require.Equal(t, tests[i].eMin, min)
require.Equal(t, tests[i].eMax, max)
require.Equal(t, tests[i].eErr, err)
}
} | explode_data.jsonl/60292 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 453
} | [
2830,
3393,
14463,
37841,
1155,
353,
8840,
836,
8,
341,
78216,
1669,
3056,
1235,
341,
197,
22427,
914,
198,
197,
7727,
6217,
220,
2224,
21,
19,
198,
197,
7727,
5974,
220,
2224,
21,
19,
198,
197,
7727,
7747,
220,
1465,
198,
197,
5940... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
func TestDispatcherDropsWhenFull(t *testing.T) {
tf.UnitTest(t)
s := &mockSyncer{
headsCalled: make([]block.TipSetKey, 0),
}
nt := &noopTransitioner{}
testWorkSize := 20
testBufferSize := 30
testDispatch := dispatcher.NewDispatcherWithSizes(s, nt, testWorkSize, testBufferSize)
finished := moresync.NewLatch(1)
testDispatch.RegisterCallback(func(target dispatcher.Target) {
// Fail if the work that should be dropped gets processed
assert.False(t, target.Height == 100)
assert.False(t, target.Height == 101)
assert.False(t, target.Height == 102)
if target.Height == 0 {
// 0 has lowest priority of non-dropped
finished.Done()
}
})
for j := 0; j < testWorkSize; j++ {
ci := chainInfoFromHeight(t, j)
assert.NoError(t, testDispatch.SendHello(ci))
}
// Should be dropped
assert.NoError(t, testDispatch.SendHello(chainInfoFromHeight(t, 100)))
assert.NoError(t, testDispatch.SendHello(chainInfoFromHeight(t, 101)))
assert.NoError(t, testDispatch.SendHello(chainInfoFromHeight(t, 102)))
testDispatch.Start(context.Background())
finished.Wait()
} | explode_data.jsonl/82039 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 386
} | [
2830,
3393,
21839,
35,
3702,
4498,
9432,
1155,
353,
8840,
836,
8,
341,
3244,
69,
25159,
2271,
1155,
340,
1903,
1669,
609,
16712,
12154,
261,
515,
197,
197,
35810,
20960,
25,
1281,
10556,
4574,
836,
573,
1649,
1592,
11,
220,
15,
1326,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestGetDaemonEndpointsFromStringInvalid7(t *testing.T) {
dAddr := ""
dEndpt, err := GetDaemonEndpointsFromString(dAddr) // address passed is nil and env variable not set
assert.Nil(t, err)
assert.Nil(t, dEndpt)
} | explode_data.jsonl/49942 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 82
} | [
2830,
3393,
1949,
89177,
80786,
44491,
7928,
22,
1155,
353,
8840,
836,
8,
341,
2698,
13986,
1669,
8389,
2698,
3727,
417,
11,
1848,
1669,
2126,
89177,
80786,
44491,
1500,
13986,
8,
442,
2621,
5823,
374,
2092,
323,
6105,
3890,
537,
738,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestRenewRebindBackoff(t *testing.T) {
for i, tc := range []struct {
state dhcpClientState
rebindTime time.Duration
leaseExpiration time.Duration
wantTimeouts []time.Duration
}{
{
state: renewing,
rebindTime: 800 * time.Second,
wantTimeouts: []time.Duration{
400 * time.Second,
200 * time.Second,
100 * time.Second,
60 * time.Second,
60 * time.Second,
},
},
{
state: renewing,
rebindTime: 1600 * time.Second,
wantTimeouts: []time.Duration{
800 * time.Second,
400 * time.Second,
200 * time.Second,
100 * time.Second,
60 * time.Second,
60 * time.Second,
},
},
{
state: rebinding,
leaseExpiration: 800 * time.Second,
wantTimeouts: []time.Duration{
400 * time.Second,
200 * time.Second,
100 * time.Second,
60 * time.Second,
60 * time.Second,
},
},
} {
t.Run(fmt.Sprintf("%d:%s", i, tc.state), func(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
_, _, serverEP, c := setupTestEnv(ctx, t, defaultServerCfg)
now := time.Now()
c.rebindTime = now.Add(tc.rebindTime)
c.leaseExpirationTime = now.Add(tc.leaseExpiration)
serverEP.onWritePacket = func(*stack.PacketBuffer) *stack.PacketBuffer {
// Don't send any response, keep the client renewing / rebinding
// to test backoff in these states.
return nil
}
// Start from time 0, and then advance time in test based on expected
// timeouts. This plus the stubbed out `retransTimeout` below, simulates
// time passing in this test.
durationsBetweenNows := append(
[]time.Duration{0},
tc.wantTimeouts[:len(tc.wantTimeouts)-1]...,
)
c.now = stubTimeNow(ctx, now, durationsBetweenNows, nil)
timeoutCh := make(chan time.Time)
var gotTimeouts []time.Duration
c.retransTimeout = func(d time.Duration) <-chan time.Time {
gotTimeouts = append(gotTimeouts, d)
return timeoutCh
}
errs := make(chan error)
go func() {
info := c.Info()
info.State = tc.state
if tc.state == renewing {
// Pretend the server's address is broadcast to avoid ARP (which
// won't work because we don't have an IP address). This is not
// necessary in other states since DHCPDISCOVER is always sent to
// broadcast.
info.Server = header.IPv4Broadcast
} else {
info.Server = serverAddr
}
_, err := acquire(ctx, c, t.Name(), &info)
errs <- err
}()
// Block `acquire` after the last `now` is called (happens before timeout
// chan is used), so the test is consistent. Otherwise `acquire` in the
// goroutine above will continue to retry and extra timeouts will be
// appended to `gotTimeouts`.
for i := 0; i < len(durationsBetweenNows)-1; i++ {
select {
case timeoutCh <- time.Time{}:
case err := <-errs:
t.Fatalf("acquire(...) failed: %s", err)
}
}
cancel()
if err := <-errs; !errors.Is(err, context.Canceled) {
t.Fatalf("acquire(...) failed: %s", err)
}
if diff := cmp.Diff(tc.wantTimeouts, gotTimeouts); diff != "" {
t.Errorf("Got retransmission timeouts diff (-want +got):\n%s", diff)
}
})
}
} | explode_data.jsonl/20579 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 1358
} | [
2830,
3393,
34625,
365,
693,
7666,
3707,
1847,
1155,
353,
8840,
836,
8,
341,
2023,
600,
11,
17130,
1669,
2088,
3056,
1235,
341,
197,
24291,
1843,
85787,
2959,
1397,
198,
197,
17200,
7666,
1462,
414,
882,
33795,
198,
197,
197,
1623,
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... | 1 |
func TestAllocation_UpdateFileWithThumbnail(t *testing.T) {
const (
mockLocalPath = "1.txt"
mockThumbnailPath = "thumbnail_alloc"
)
type parameters struct {
localPath, remotePath, thumbnailPath string
status StatusCallback
}
tests := []struct {
name string
parameters parameters
wantErr bool
}{
{
"Test_Coverage",
parameters{
localPath: mockLocalPath,
remotePath: "/",
thumbnailPath: mockThumbnailPath,
},
false,
},
}
server := dev.NewBlobberServer()
defer server.Close()
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
require := require.New(t)
if teardown := setupMockFile(t, mockLocalPath); teardown != nil {
defer teardown(t)
}
a := &Allocation{
Tx: "TestAllocation_UpdateFileWithThumbnail",
ParityShards: 2,
DataShards: 2,
}
a.uploadChan = make(chan *UploadRequest, 10)
a.downloadChan = make(chan *DownloadRequest, 10)
a.repairChan = make(chan *RepairRequest, 1)
a.ctx, a.ctxCancelF = context.WithCancel(context.Background())
a.uploadProgressMap = make(map[string]*UploadRequest)
a.downloadProgressMap = make(map[string]*DownloadRequest)
a.mutex = &sync.Mutex{}
a.initialized = true
sdkInitialized = true
setupMockAllocation(t, a)
for i := 0; i < numBlobbers; i++ {
a.Blobbers = append(a.Blobbers, &blockchain.StorageNode{
ID: mockBlobberId + strconv.Itoa(i),
Baseurl: server.URL,
})
}
err := a.UpdateFileWithThumbnail(tt.parameters.localPath, tt.parameters.remotePath, tt.parameters.thumbnailPath, fileref.Attributes{}, tt.parameters.status)
if tt.wantErr {
require.Errorf(err, "expected error != nil")
return
}
require.NoErrorf(err, "Unexpected error %v", err)
})
}
} | explode_data.jsonl/4705 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 793
} | [
2830,
3393,
78316,
47393,
1703,
2354,
45970,
1155,
353,
8840,
836,
8,
341,
4777,
2399,
197,
77333,
7319,
1820,
257,
284,
330,
16,
3909,
698,
197,
77333,
45970,
1820,
284,
330,
27786,
14802,
698,
197,
692,
13158,
5029,
2036,
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 TestEncodeSignError(t *testing.T) {
h := defaultHeader()
p := mockIDTokenPayload{"key": "value"}
signer := &mockSigner{
err: errors.New("sign error"),
}
if s, err := encodeToken(signer, h, p); s != "" || err == nil {
t.Errorf("encodeToken() = (%v, %v); want = ('', error)", s, err)
}
} | explode_data.jsonl/42597 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 121
} | [
2830,
3393,
32535,
7264,
1454,
1155,
353,
8840,
836,
8,
341,
9598,
1669,
1638,
4047,
741,
3223,
1669,
7860,
915,
3323,
29683,
4913,
792,
788,
330,
957,
16707,
69054,
261,
1669,
609,
16712,
7264,
261,
515,
197,
9859,
25,
5975,
7121,
44... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
func TestGocloak_GetUserInfo(t *testing.T) {
t.Parallel()
cfg := GetConfig(t)
client := NewClientWithDebug(t)
token := GetClientToken(t, client)
userInfo, err := client.GetUserInfo(
token.AccessToken,
cfg.GoCloak.Realm)
FailIfErr(t, err, "Failed to fetch userinfo")
t.Log(userInfo)
FailRequest(client, nil, 1, 0)
_, err = client.GetUserInfo(
token.AccessToken,
cfg.GoCloak.Realm)
FailIfNotErr(t, err, "")
} | explode_data.jsonl/79505 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 179
} | [
2830,
3393,
38,
509,
385,
585,
13614,
36158,
1155,
353,
8840,
836,
8,
341,
3244,
41288,
7957,
741,
50286,
1669,
2126,
2648,
1155,
340,
25291,
1669,
1532,
2959,
2354,
7939,
1155,
340,
43947,
1669,
2126,
2959,
3323,
1155,
11,
2943,
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 Test_DomainPower(t *testing.T) {
client := NewClient("", "", false)
domain, _, err := client.Domain.Get(TestDomainID)
assert.Nil(t, err)
assert.NotEqual(t, domain.Id, "", "Domain Id can not be empty")
domain, _, err = client.Domain.Start(domain)
assert.Nil(t, err)
domain, _, err = client.Domain.Suspend(domain)
assert.Nil(t, err)
domain, _, err = client.Domain.Resume(domain)
assert.Nil(t, err)
domain, _, err = client.Domain.Reboot(domain, true)
assert.Nil(t, err)
domain, _, err = client.Domain.Shutdown(domain, true)
assert.Nil(t, err)
domain, _, err = client.Domain.Template(domain, true)
assert.Nil(t, err)
assert.True(t, domain.Template)
domain, _, err = client.Domain.Template(domain, false)
assert.Nil(t, err)
assert.False(t, domain.Template)
return
} | explode_data.jsonl/12039 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 309
} | [
2830,
3393,
1557,
3121,
14986,
1155,
353,
8840,
836,
8,
341,
25291,
1669,
1532,
2959,
19814,
7342,
895,
692,
2698,
3121,
11,
8358,
1848,
1669,
2943,
20442,
2234,
31159,
13636,
915,
340,
6948,
59678,
1155,
11,
1848,
340,
6948,
15000,
299... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestCache(t *testing.T) {
ctx := context.Background()
// Once more with NO_CACHE
t.Setenv("SIGSTORE_NO_CACHE", "false")
td := t.TempDir()
t.Setenv("TUF_ROOT", td)
// Make sure nothing is in that directory to start with
if l := dirLen(t, td); l != 0 {
t.Errorf("expected no filesystem writes, got %d entries", l)
}
// Nothing should get downloaded if everything is up to date
forceExpiration(t, false)
tuf, err := NewFromEnv(ctx)
if err != nil {
t.Fatal(err)
}
tuf.Close()
if l := dirLen(t, td); l != 0 {
t.Errorf("expected no filesystem writes, got %d entries", l)
}
// Force expiration so that content gets downloaded. This should write to disk
forceExpiration(t, true)
tuf, err = NewFromEnv(ctx)
if err != nil {
t.Fatal(err)
}
tuf.Close()
if l := dirLen(t, td); l == 0 {
t.Errorf("expected filesystem writes, got %d entries", l)
}
checkTargetsAndMeta(t, tuf)
} | explode_data.jsonl/9333 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 351
} | [
2830,
3393,
8233,
1155,
353,
8840,
836,
8,
341,
20985,
1669,
2266,
19047,
741,
197,
322,
9646,
803,
448,
5664,
29138,
198,
3244,
4202,
3160,
445,
50631,
43950,
9100,
29138,
497,
330,
3849,
1138,
76373,
1669,
259,
65009,
6184,
741,
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... | 6 |
func Test_parseProp(t *testing.T) {
type args struct {
str string
}
tests := []struct {
name string
args args
wantKey string
wantVal string
wantComment bool
wantErr bool
}{
{"1", args{" num = 77 "}, "num", "77", false, false},
{"2", args{"#num = 77 "}, "", "", true, false},
{"3", args{" num = "}, "num", "", false, false},
{"4", args{" blap! "}, "", "", false, true},
{"5", args{" = 77 "}, "", "", false, true},
{"6", args{" num = 77 77"}, "num", "77 77", false, false},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
gotKey, gotVal, gotComment, err := parseProp(tt.args.str)
if (err != nil) != tt.wantErr {
t.Errorf("parseProp() error = %v, wantErr %v", err, tt.wantErr)
return
}
if gotComment != tt.wantComment {
t.Errorf("parseProp() gotComment = %v, wantComment %v", gotComment, tt.wantComment)
}
if gotKey != tt.wantKey {
t.Errorf("parseProp() gotKey = %v, want %v", gotKey, tt.wantKey)
}
if gotVal != tt.wantVal {
t.Errorf("parseProp() gotVal = %v, want %v", gotVal, tt.wantVal)
}
})
}
} | explode_data.jsonl/62170 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 515
} | [
2830,
3393,
21039,
2008,
1155,
353,
8840,
836,
8,
341,
13158,
2827,
2036,
341,
197,
11355,
914,
198,
197,
532,
78216,
1669,
3056,
1235,
341,
197,
11609,
286,
914,
198,
197,
31215,
286,
2827,
198,
197,
50780,
1592,
257,
914,
198,
197,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 5 |
func TestGetEventRecorder(t *testing.T) {
ctx := context.Background()
if got := GetEventRecorder(ctx); got != nil {
t.Errorf("GetEventRecorder() = %v, wanted nil", got)
}
ctx = WithEventRecorder(ctx, record.NewFakeRecorder(1000))
if got := GetEventRecorder(ctx); got == nil {
t.Error("GetEventRecorder() = nil, wanted non-nil")
}
} | explode_data.jsonl/45303 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 124
} | [
2830,
3393,
1949,
1556,
47023,
1155,
353,
8840,
836,
8,
341,
20985,
1669,
2266,
19047,
2822,
743,
2684,
1669,
2126,
1556,
47023,
7502,
1215,
2684,
961,
2092,
341,
197,
3244,
13080,
445,
1949,
1556,
47023,
368,
284,
1018,
85,
11,
4829,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestPluginScans(t *testing.T) {
Convey("When scanning for plugins", t, func() {
setting.StaticRootPath, _ = filepath.Abs("../../public/")
setting.Raw = ini.Empty()
pm := &PluginManager{}
err := pm.Init()
So(err, ShouldBeNil)
So(len(DataSources), ShouldBeGreaterThan, 1)
So(len(Panels), ShouldBeGreaterThan, 1)
Convey("Should set module automatically", func() {
So(DataSources["graphite"].Module, ShouldEqual, "app/plugins/datasource/graphite/module")
})
})
Convey("When reading app plugin definition", t, func() {
setting.Raw = ini.Empty()
sec, _ := setting.Raw.NewSection("plugin.nginx-app")
sec.NewKey("path", "testdata/test-app")
pm := &PluginManager{}
err := pm.Init()
So(err, ShouldBeNil)
So(len(Apps), ShouldBeGreaterThan, 0)
So(Apps["test-app"].Info.Logos.Large, ShouldEqual, "public/plugins/test-app/img/logo_large.png")
So(Apps["test-app"].Info.Screenshots[1].Path, ShouldEqual, "public/plugins/test-app/img/screenshot2.png")
})
} | explode_data.jsonl/53327 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 389
} | [
2830,
3393,
11546,
3326,
596,
1155,
353,
8840,
836,
8,
1476,
93070,
5617,
445,
4498,
35101,
369,
17215,
497,
259,
11,
2915,
368,
341,
197,
8196,
1280,
58826,
8439,
1820,
11,
716,
284,
26054,
33255,
36800,
888,
53006,
197,
8196,
1280,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestDockerSecretNonExistent(t *testing.T) {
t.Parallel()
tc := testCase{
ns: &core_v1.Namespace{
TypeMeta: meta_v1.TypeMeta{},
ObjectMeta: meta_v1.ObjectMeta{
Name: namespaceName,
Labels: map[string]string{
voyager.ServiceNameLabel: serviceName,
},
},
},
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",
LoggingID: "some-logging-id",
Metadata: creator_v1.ServiceMetadata{
PagerDuty: &creator_v1.PagerDutyMetadata{},
},
SSAMContainerName: "some-ssam-container",
ResourceTags: map[voyager.Tag]string{
"foo": "bar",
"baz": "blah",
},
},
}
tc.scFake.On("GetService", mock.Anything, auth.NoUser(), serviceNameSc).Return(service, nil)
_, err := cntrlr.Process(ctx)
assert.Error(t, err, "Should return an error as the docker secret does not exist")
},
}
tc.run(t)
} | explode_data.jsonl/4280 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 501
} | [
2830,
3393,
35,
13659,
19773,
8121,
840,
18128,
1155,
353,
8840,
836,
8,
341,
3244,
41288,
7957,
2822,
78255,
1669,
54452,
515,
197,
84041,
25,
609,
2153,
2273,
16,
46011,
515,
298,
27725,
12175,
25,
8823,
2273,
16,
10184,
12175,
38837,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestPetStore(t *testing.T) {
var err error
// Here, we Initialize echo
e := echo.New()
// Now, we create our empty pet store
store := api.NewPetStore()
// Get the swagger description of our API
swagger, err := api.GetSwagger()
require.NoError(t, err)
// This disables swagger server name validation. It seems to work poorly,
// and requires our test server to be in that list.
swagger.Servers = nil
// Validate requests against the OpenAPI spec
e.Use(middleware.OapiRequestValidator(swagger))
// Log requests
e.Use(echo_middleware.Logger())
// We register the autogenerated boilerplate and bind our PetStore to this
// echo router.
api.RegisterHandlers(e, store)
// At this point, we can start sending simulated Http requests, and record
// the HTTP responses to check for validity. This exercises every part of
// the stack except the well-tested HTTP system in Go, which there is no
// point for us to test.
tag := "TagOfSpot"
name := "Spot"
newPet := api.NewPet{
Name: nil,
Tag: &tag,
Size: 20,
}
result := testutil.NewRequest().Post("/pets").WithJsonBody(newPet).Go(t, e)
// We expect 201 code on successful pet insertion
assert.Equal(t, http.StatusCreated, result.Code())
// We should have gotten a response from the server with the new pet. Make
// sure that its fields match.
var resultPet api.Pet
err = result.UnmarshalBodyToObject(&resultPet)
assert.NoError(t, err, "error unmarshaling response")
assert.Equal(t, newPet.Name, resultPet.Name)
assert.Equal(t, *newPet.Tag, *resultPet.Tag)
// This is the Id of the pet we inserted.
petId := resultPet.Id
// Test the getter function.
result = testutil.NewRequest().Get(fmt.Sprintf("/pets/%d", petId)).WithAcceptJson().Go(t, e)
var resultPet2 api.Pet
err = result.UnmarshalBodyToObject(&resultPet2)
assert.NoError(t, err, "error getting pet")
assert.Equal(t, resultPet, resultPet2)
// We should get a 404 on invalid ID
result = testutil.NewRequest().Get("/pets/27179095781").WithAcceptJson().Go(t, e)
assert.Equal(t, http.StatusNotFound, result.Code())
var petError api.Error
err = result.UnmarshalBodyToObject(&petError)
assert.NoError(t, err, "error getting response", err)
assert.Equal(t, int32(http.StatusNotFound), petError.Code)
// Let's insert another pet for subsequent tests.
tag = "TagOfFido"
name = "Fido"
newPet = api.NewPet{
Name: &name,
Tag: &tag,
Size: 10,
}
result = testutil.NewRequest().Post("/pets").WithJsonBody(newPet).Go(t, e)
// We expect 201 code on successful pet insertion
assert.Equal(t, http.StatusCreated, result.Code())
// We should have gotten a response from the server with the new pet. Make
// sure that its fields match.
err = result.UnmarshalBodyToObject(&resultPet)
assert.NoError(t, err, "error unmarshaling response")
petId2 := resultPet.Id
// Now, list all pets, we should have two
result = testutil.NewRequest().Get("/pets").WithAcceptJson().Go(t, e)
assert.Equal(t, http.StatusOK, result.Code())
var petList []api.Pet
err = result.UnmarshalBodyToObject(&petList)
assert.NoError(t, err, "error getting response", err)
assert.Equal(t, 2, len(petList))
// Filter pets by tag, we should have 1
petList = nil
result = testutil.NewRequest().Get("/pets?tags=TagOfFido").WithAcceptJson().Go(t, e)
assert.Equal(t, http.StatusOK, result.Code())
err = result.UnmarshalBodyToObject(&petList)
assert.NoError(t, err, "error getting response", err)
assert.Equal(t, 1, len(petList))
// Filter pets by non existent tag, we should have 0
petList = nil
result = testutil.NewRequest().Get("/pets?tags=NotExists").WithAcceptJson().Go(t, e)
assert.Equal(t, http.StatusOK, result.Code())
err = result.UnmarshalBodyToObject(&petList)
assert.NoError(t, err, "error getting response", err)
assert.Equal(t, 0, len(petList))
// Let's delete non-existent pet
result = testutil.NewRequest().Delete("/pets/7").Go(t, e)
assert.Equal(t, http.StatusNotFound, result.Code())
err = result.UnmarshalBodyToObject(&petError)
assert.NoError(t, err, "error unmarshaling PetError")
assert.Equal(t, int32(http.StatusNotFound), petError.Code)
// Now, delete both real pets
result = testutil.NewRequest().Delete(fmt.Sprintf("/pets/%d", petId)).Go(t, e)
assert.Equal(t, http.StatusNoContent, result.Code())
result = testutil.NewRequest().Delete(fmt.Sprintf("/pets/%d", petId2)).Go(t, e)
assert.Equal(t, http.StatusNoContent, result.Code())
// Should have no pets left.
petList = nil
result = testutil.NewRequest().Get("/pets").WithAcceptJson().Go(t, e)
assert.Equal(t, http.StatusOK, result.Code())
err = result.UnmarshalBodyToObject(&petList)
assert.NoError(t, err, "error getting response", err)
assert.Equal(t, 0, len(petList))
} | explode_data.jsonl/4145 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 1658
} | [
2830,
3393,
34819,
6093,
1155,
353,
8840,
836,
8,
341,
2405,
1848,
1465,
198,
197,
322,
5692,
11,
582,
9008,
1687,
198,
7727,
1669,
1687,
7121,
2822,
197,
322,
4695,
11,
582,
1855,
1039,
4287,
6753,
3553,
198,
57279,
1669,
6330,
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... | 1 |
func TestSprintf(t *testing.T) {
for _, randomString := range internal.RandomStrings {
testza.AssertEqual(t, randomString, pterm.Sprintf(randomString))
}
testza.AssertEqual(t, "Hello, World!", pterm.Sprintf("Hello, %s!", "World"))
} | explode_data.jsonl/49129 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 88
} | [
2830,
3393,
50,
2517,
1155,
353,
8840,
836,
8,
341,
2023,
8358,
4194,
703,
1669,
2088,
5306,
26709,
20859,
341,
197,
18185,
4360,
11711,
2993,
1155,
11,
4194,
703,
11,
281,
4991,
17305,
25110,
703,
1171,
197,
532,
18185,
4360,
11711,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestDecodeSmallTCPPacketHasEmptyPayload(t *testing.T) {
smallPacket := []byte{
0xbc, 0x30, 0x5b, 0xe8, 0xd3, 0x49, 0xb8, 0xac, 0x6f, 0x92, 0xd5, 0xbf,
0x08, 0x00, 0x45, 0x00, 0x00, 0x28, 0x00, 0x00, 0x40, 0x00, 0x40, 0x06,
0x3f, 0x9f, 0xac, 0x11, 0x51, 0xc5, 0xac, 0x11, 0x51, 0x49, 0x00, 0x63,
0x9a, 0xef, 0x00, 0x00, 0x00, 0x00, 0x2e, 0xc1, 0x27, 0x83, 0x50, 0x14,
0x00, 0x00, 0xc3, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
}
p := gopacket.NewPacket(smallPacket, LinkTypeEthernet, testDecodeOptions)
if payload := p.Layer(gopacket.LayerTypePayload); payload != nil {
t.Error("Payload found for empty TCP packet")
}
testSerialization(t, p, smallPacket)
} | explode_data.jsonl/42251 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 376
} | [
2830,
3393,
32564,
25307,
7749,
4406,
5709,
10281,
3522,
29683,
1155,
353,
8840,
836,
8,
341,
1903,
29532,
16679,
1669,
3056,
3782,
515,
197,
197,
15,
43416,
11,
220,
15,
87,
18,
15,
11,
220,
15,
87,
20,
65,
11,
220,
15,
8371,
23,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
func TestAdminTokenAuth200Status(t *testing.T) {
var (
baseTransport = &http.Transport{}
gun data.GUN = "test"
)
s := httptest.NewServer(http.HandlerFunc(NotAuthorizedTestHandler))
defer s.Close()
auth, err := tokenAuth(s.URL, baseTransport, gun, admin)
require.NoError(t, err)
require.NotNil(t, auth)
} | explode_data.jsonl/77488 | {
"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,
7210,
3323,
5087,
17,
15,
15,
2522,
1155,
353,
8840,
836,
8,
341,
2405,
2399,
197,
24195,
27560,
688,
284,
609,
1254,
87669,
16094,
197,
3174,
359,
1843,
821,
1224,
1861,
284,
330,
1944,
698,
197,
340,
1903,
1669,
54320,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestAddSm(t *testing.T) {
bsToken := getBusToken()
mSm := new(logics.SmLogic)
args := cards.ArgsAddSm{
BsToken: bsToken,
SmBase: cards.SmBase{
Name: "洗剪吹套餐5次zxxx",
SortDesc: "洗剪吹套餐5次,good",
RealPrice: 100,
Price: 150,
ServicePeriod: 3,
},
Notes: []cards.CardNote{
{
Notes: "提示1",
},
},
//IncludeSingles: []cards.IncSingle2{
// {
// SingleID: 11,
// Num: 2,
// SspId: 25,
// },
// {
// SingleID: 11,
// Num: 2,
// SspId: 26,
// },
// {
// SingleID: 18,
// Num: 3,
// SspId: 0,
// },
//},
GiveSingles: []cards.IncSingle{
{
SingleID: 12,
Num: 2,
},
{
SingleID: 18,
Num: 3,
},
},
ImgHash: "",
}
logs.Info(mSm.AddSm(context.Background(), &args))
} | explode_data.jsonl/35920 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 507
} | [
2830,
3393,
2212,
10673,
1155,
353,
8840,
836,
8,
341,
93801,
3323,
1669,
633,
15073,
3323,
741,
2109,
10673,
1669,
501,
12531,
1211,
92445,
26751,
340,
31215,
1669,
7411,
51015,
2212,
10673,
515,
197,
12791,
82,
3323,
25,
17065,
3323,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestTideContextPolicy_IsOptional(t *testing.T) {
testCases := []struct {
name string
skipUnknownContexts bool
required, optional []string
contexts []string
results []bool
}{
{
name: "only optional contexts registered - skipUnknownContexts false",
contexts: []string{"c1", "o1", "o2"},
optional: []string{"o1", "o2"},
results: []bool{false, true, true},
},
{
name: "no contexts registered - skipUnknownContexts false",
contexts: []string{"t2"},
results: []bool{false},
},
{
name: "only required contexts registered - skipUnknownContexts false",
required: []string{"c1", "c2", "c3"},
contexts: []string{"c1", "c2", "c3", "t1"},
results: []bool{false, false, false, false},
},
{
name: "optional and required contexts registered - skipUnknownContexts false",
optional: []string{"o1", "o2"},
required: []string{"c1", "c2", "c3"},
contexts: []string{"o1", "o2", "c1", "c2", "c3", "t1"},
results: []bool{true, true, false, false, false, false},
},
{
name: "only optional contexts registered - skipUnknownContexts true",
contexts: []string{"c1", "o1", "o2"},
optional: []string{"o1", "o2"},
skipUnknownContexts: true,
results: []bool{true, true, true},
},
{
name: "no contexts registered - skipUnknownContexts true",
contexts: []string{"t2"},
skipUnknownContexts: true,
results: []bool{true},
},
{
name: "only required contexts registered - skipUnknownContexts true",
required: []string{"c1", "c2", "c3"},
contexts: []string{"c1", "c2", "c3", "t1"},
skipUnknownContexts: true,
results: []bool{false, false, false, true},
},
{
name: "optional and required contexts registered - skipUnknownContexts true",
optional: []string{"o1", "o2"},
required: []string{"c1", "c2", "c3"},
contexts: []string{"o1", "o2", "c1", "c2", "c3", "t1"},
skipUnknownContexts: true,
results: []bool{true, true, false, false, false, true},
},
}
for _, tc := range testCases {
cp := TideContextPolicy{
SkipUnknownContexts: &tc.skipUnknownContexts,
RequiredContexts: tc.required,
OptionalContexts: tc.optional,
}
for i, c := range tc.contexts {
if cp.IsOptional(c) != tc.results[i] {
t.Errorf("%s - IsOptional for %s should return %t", tc.name, c, tc.results[i])
}
}
}
} | explode_data.jsonl/53862 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 1184
} | [
2830,
3393,
51,
577,
1972,
13825,
31879,
15309,
1155,
353,
8840,
836,
8,
341,
18185,
37302,
1669,
3056,
1235,
341,
197,
11609,
394,
914,
198,
197,
1903,
13389,
13790,
1972,
82,
1807,
198,
197,
58183,
11,
10101,
220,
3056,
917,
198,
19... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 4 |
func TestASN1ObjectIdentifier(t *testing.T) {
testData := []struct {
in []byte
ok bool
out []int
}{
{[]byte{}, false, []int{}},
{[]byte{6, 0}, false, []int{}},
{[]byte{5, 1, 85}, false, []int{2, 5}},
{[]byte{6, 1, 85}, true, []int{2, 5}},
{[]byte{6, 2, 85, 0x02}, true, []int{2, 5, 2}},
{[]byte{6, 4, 85, 0x02, 0xc0, 0x00}, true, []int{2, 5, 2, 0x2000}},
{[]byte{6, 3, 0x81, 0x34, 0x03}, true, []int{2, 100, 3}},
{[]byte{6, 7, 85, 0x02, 0xc0, 0x80, 0x80, 0x80, 0x80}, false, []int{}},
}
for i, test := range testData {
in := String(test.in)
var out encoding_asn1.ObjectIdentifier
ok := in.ReadASN1ObjectIdentifier(&out)
if ok != test.ok || ok && !out.Equal(test.out) {
t.Errorf("#%d: in.ReadASN1ObjectIdentifier() = %v, want %v; out = %v, want %v", i, ok, test.ok, out, test.out)
continue
}
var b Builder
b.AddASN1ObjectIdentifier(out)
result, err := b.Bytes()
if builderOk := err == nil; test.ok != builderOk {
t.Errorf("#%d: error from Builder.Bytes: %s", i, err)
continue
}
if test.ok && !bytes.Equal(result, test.in) {
t.Errorf("#%d: reserialisation didn't match, got %x, want %x", i, result, test.in)
continue
}
}
} | explode_data.jsonl/16727 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 572
} | [
2830,
3393,
68134,
16,
1190,
8714,
1155,
353,
8840,
836,
8,
341,
18185,
1043,
1669,
3056,
1235,
341,
197,
17430,
220,
3056,
3782,
198,
197,
59268,
220,
1807,
198,
197,
13967,
3056,
396,
198,
197,
59403,
197,
197,
90,
1294,
3782,
22655... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestRealErrorGetsThrough(t *testing.T) {
myErr := fmt.Errorf("this is an actual error")
fstore := failstore.NewFailstore(ds.NewMapDatastore(), func(op string) error {
return myErr
})
rds := &Datastore{
Batching: fstore,
Retries: 5,
TempErrFunc: func(err error) bool {
return false
},
}
k := ds.NewKey("test")
_, err := rds.Get(k)
if err != myErr {
t.Fatal("expected my own error")
}
_, err = rds.Has(k)
if err != myErr {
t.Fatal("expected my own error")
}
err = rds.Put(k, nil)
if err != myErr {
t.Fatal("expected my own error")
}
} | explode_data.jsonl/28916 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 254
} | [
2830,
3393,
12768,
1454,
49358,
23857,
1155,
353,
8840,
836,
8,
341,
13624,
7747,
1669,
8879,
13080,
445,
574,
374,
458,
5042,
1465,
1138,
1166,
4314,
1669,
3690,
4314,
7121,
19524,
4314,
33783,
7121,
2227,
1043,
4314,
1507,
2915,
17096,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestStreamMigrateCancelWithStoppedStreams(t *testing.T) {
ctx := context.Background()
tme := newTestShardMigrater(ctx, t, []string{"-40", "40-"}, []string{"-80", "80-"})
defer tme.stopTablets(t)
tme.expectNoPreviousJournals()
// Migrate reads
_, err := tme.wr.SwitchReads(ctx, tme.targetKeyspace, "test", rdOnly, nil, workflow.DirectionForward, false)
if err != nil {
t.Fatal(err)
}
tme.expectNoPreviousJournals()
_, err = tme.wr.SwitchReads(ctx, tme.targetKeyspace, "test", replica, nil, workflow.DirectionForward, false)
if err != nil {
t.Fatal(err)
}
tme.expectCheckJournals()
stopStreams := func() {
var sourceRows [][]string
for _, sourceTargetShard := range tme.sourceShards {
var rows []string
for j, sourceShard := range tme.sourceShards {
bls := &binlogdatapb.BinlogSource{
Keyspace: "ks1",
Shard: sourceShard,
Filter: &binlogdatapb.Filter{
Rules: []*binlogdatapb.Rule{{
Match: "t1",
Filter: fmt.Sprintf("select * from t1 where in_keyrange('%s')", sourceTargetShard),
}, {
Match: "t2",
Filter: fmt.Sprintf("select * from t2 where in_keyrange('%s')", sourceTargetShard),
}},
},
}
rows = append(rows, fmt.Sprintf("%d|t1t2|%v|MariaDB/5-456-888", j+1, bls))
}
sourceRows = append(sourceRows, rows)
}
for i, dbclient := range tme.dbSourceClients {
// sm.stopStreams->sm.readSourceStreams->readTabletStreams('') and VReplicationExec(_vt.copy_state)
dbclient.addQuery("select id, workflow, source, pos from _vt.vreplication where db_name='vt_ks' and workflow != 'test_reverse'", sqltypes.MakeTestResult(sqltypes.MakeTestFields(
"id|workflow|source|pos",
"int64|varbinary|varchar|varbinary"),
sourceRows[i]...),
nil)
dbclient.addQuery("select vrepl_id from _vt.copy_state where vrepl_id in (1, 2)", &sqltypes.Result{}, nil)
}
}
stopStreams()
// sm.migrateStreams->->sm.deleteTargetStreams (no previously migrated streams)
tme.dbTargetClients[0].addQuery("select id from _vt.vreplication where db_name = 'vt_ks' and workflow in ('t1t2')", &sqltypes.Result{}, nil)
tme.dbTargetClients[1].addQuery("select id from _vt.vreplication where db_name = 'vt_ks' and workflow in ('t1t2')", &sqltypes.Result{}, nil)
tme.expectCancelMigration()
_, _, err = tme.wr.SwitchWrites(ctx, tme.targetKeyspace, "test", 1*time.Second, true, false, false, false)
if err != nil {
t.Fatal(err)
}
verifyQueries(t, tme.allDBClients)
} | explode_data.jsonl/60571 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 1038
} | [
2830,
3393,
3027,
44,
34479,
9269,
2354,
59803,
73576,
1155,
353,
8840,
836,
8,
341,
20985,
1669,
2266,
19047,
741,
3244,
2660,
1669,
501,
2271,
2016,
567,
44,
5233,
962,
7502,
11,
259,
11,
3056,
917,
4913,
12,
19,
15,
497,
330,
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... | 4 |
func TestTransactionActions_Index(t *testing.T) {
ht := StartHTTPTest(t, "base")
defer ht.Finish()
w := ht.Get("/transactions")
if ht.Assert.Equal(200, w.Code) {
ht.Assert.PageOf(4, w.Body)
}
// filtered by ledger
w = ht.Get("/ledgers/1/transactions")
if ht.Assert.Equal(200, w.Code) {
ht.Assert.PageOf(0, w.Body)
}
w = ht.Get("/ledgers/2/transactions")
if ht.Assert.Equal(200, w.Code) {
ht.Assert.PageOf(3, w.Body)
}
w = ht.Get("/ledgers/3/transactions")
if ht.Assert.Equal(200, w.Code) {
ht.Assert.PageOf(1, w.Body)
}
// missing ledger
w = ht.Get("/ledgers/100/transactions")
ht.Assert.Equal(404, w.Code)
// filtering by account
w = ht.Get("/accounts/GBRPYHIL2CI3FNQ4BXLFMNDLFJUNPU2HY3ZMFSHONUCEOASW7QC7OX2H/transactions")
if ht.Assert.Equal(200, w.Code) {
ht.Assert.PageOf(3, w.Body)
}
w = ht.Get("/accounts/GA5WBPYA5Y4WAEHXWR2UKO2UO4BUGHUQ74EUPKON2QHV4WRHOIRNKKH2/transactions")
if ht.Assert.Equal(200, w.Code) {
ht.Assert.PageOf(1, w.Body)
}
w = ht.Get("/accounts/GCXKG6RN4ONIEPCMNFB732A436Z5PNDSRLGWK7GBLCMQLIFO4S7EYWVU/transactions")
if ht.Assert.Equal(200, w.Code) {
ht.Assert.PageOf(2, w.Body)
}
// regression: https://github.com/danielnapierski/go-alt/services/horizon/internal/issues/365
w = ht.Get("/transactions?limit=200")
ht.Require.Equal(200, w.Code)
w = ht.Get("/transactions?limit=201")
ht.Assert.Equal(400, w.Code)
w = ht.Get("/transactions?limit=0")
ht.Assert.Equal(400, w.Code)
} | explode_data.jsonl/18313 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 730
} | [
2830,
3393,
8070,
12948,
50361,
1155,
353,
8840,
836,
8,
341,
197,
426,
1669,
5145,
9230,
2271,
1155,
11,
330,
3152,
1138,
16867,
34323,
991,
18176,
2822,
6692,
1669,
34323,
2234,
4283,
41844,
1138,
743,
34323,
11711,
12808,
7,
17,
15,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 8 |
func TestWorkflowTemplateRefWithArgs(t *testing.T) {
wf := unmarshalWF(wfWithTmplRef)
wftmpl := unmarshalWFTmpl(wfTmpl)
t.Run("CheckArgumentPassing", func(t *testing.T) {
args := []wfv1.Parameter{
{
Name: "param1",
Value: wfv1.Int64OrStringPtr("test"),
},
}
wf.Spec.Arguments.Parameters = util.MergeParameters(wf.Spec.Arguments.Parameters, args)
cancel, controller := newController(wf, wftmpl)
defer cancel()
woc := newWorkflowOperationCtx(wf, controller)
woc.operate()
assert.Equal(t, "test", woc.globalParams["workflow.parameters.param1"])
})
} | explode_data.jsonl/30602 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 255
} | [
2830,
3393,
62768,
7275,
3945,
2354,
4117,
1155,
353,
8840,
836,
8,
341,
6692,
69,
1669,
650,
27121,
32131,
3622,
69,
2354,
51,
54010,
3945,
340,
6692,
723,
54010,
1669,
650,
27121,
54,
3994,
54010,
3622,
69,
51,
54010,
692,
3244,
167... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestTextSearchAllTheThingsRequestURL(t *testing.T) {
expectedQuery := "key=AIzaNotReallyAnAPIKey&language=es&location=1%2C2&maxprice=2&minprice=0&opennow=true&pagetoken=NextPageToken&query=Pizza+in+New+York&radius=1000&type=airport"
server := mockServerForQuery(expectedQuery, 200, `{"status":"OK"}"`)
defer server.s.Close()
c, _ := NewClient(WithAPIKey(apiKey))
c.baseURL = server.s.URL
r := &TextSearchRequest{
Query: "Pizza in New York",
Location: &LatLng{1.0, 2.0},
Radius: 1000,
Language: "es",
MinPrice: PriceLevelFree,
MaxPrice: PriceLevelModerate,
OpenNow: true,
Type: PlaceTypeAirport,
PageToken: "NextPageToken",
}
_, err := c.TextSearch(context.Background(), r)
if err != nil {
t.Errorf("Unexpected error in constructing request URL: %+v", err)
}
if server.successful != 1 {
t.Errorf("Got URL(s) %v, want %s", server.failed, expectedQuery)
}
} | explode_data.jsonl/76293 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 367
} | [
2830,
3393,
1178,
5890,
2403,
785,
41475,
1900,
3144,
1155,
353,
8840,
836,
8,
341,
42400,
2859,
1669,
330,
792,
28,
15469,
4360,
2623,
48785,
2082,
7082,
1592,
5,
11528,
28,
288,
5,
2527,
28,
16,
4,
17,
34,
17,
5,
2810,
6555,
28,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
func TestIntegrationHTTPDoRoundTripError(t *testing.T) {
ctx := context.Background()
results := HTTPDo(ctx, HTTPDoConfig{
URL: "http://ooni.io:443", // 443 with http
})
if results.Error == nil {
t.Fatal("expected an error here")
}
} | explode_data.jsonl/53536 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 88
} | [
2830,
3393,
52464,
9230,
5404,
27497,
56352,
1454,
1155,
353,
8840,
836,
8,
341,
20985,
1669,
2266,
19047,
741,
55497,
1669,
10130,
5404,
7502,
11,
10130,
5404,
2648,
515,
197,
79055,
25,
330,
1254,
1110,
9009,
72,
4245,
25,
19,
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... | 2 |
func TestGoManager_Select_WithLinkFailure(t *testing.T) {
invalidVersion := version.Must(version.NewVersion("1.14.9"))
tempDir := t.TempDir()
sut := &GoManager{
RootDirectory: tempDir,
InstalledVersions: version.Collection{invalidVersion},
SelectedVersion: nil,
task: &tasks.Task{
ErrorExitCode: 1,
Output: os.Stdout,
Error: os.Stderr,
},
}
require.NoError(t, os.MkdirAll(filepath.Join(tempDir, selectedDirectoryName), 0700))
assert.Error(t, sut.Select(invalidVersion))
setupInstallation(t, tempDir, true, invalidVersion.String())
assert.Error(t, sut.Select(invalidVersion))
} | explode_data.jsonl/19003 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 248
} | [
2830,
3393,
10850,
2043,
58073,
62,
2354,
3939,
17507,
1155,
353,
8840,
836,
8,
341,
197,
11808,
5637,
1669,
2319,
50463,
37770,
7121,
5637,
445,
16,
13,
16,
19,
13,
24,
28075,
16280,
6184,
1669,
259,
65009,
6184,
2822,
1903,
332,
166... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestAccCollection_FieldMapping(t *testing.T) {
var collection openapi.Collection
resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
ProviderFactories: testAccProviderFactories,
CheckDestroy: testAccCheckRocksetCollectionDestroy,
Steps: []resource.TestStep{
{
Config: testAccCheckCollectionFieldMapping(),
Check: resource.ComposeTestCheckFunc(
testAccCheckRocksetCollectionExists("rockset_collection.test", &collection),
resource.TestCheckResourceAttr("rockset_collection.test", "name", testCollectionNameFieldMappings),
resource.TestCheckResourceAttr("rockset_collection.test", "workspace", testCollectionWorkspace),
resource.TestCheckResourceAttr("rockset_collection.test", "description", testCollectionDescription),
testAccCheckFieldMappingMatches(&collection),
testAccCheckRetentionSecsMatches(&collection, 65),
),
ExpectNonEmptyPlan: false,
},
},
})
} | explode_data.jsonl/7136 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 333
} | [
2830,
3393,
14603,
6482,
46272,
6807,
1155,
353,
8840,
836,
8,
341,
2405,
4426,
1787,
2068,
28629,
271,
50346,
8787,
1155,
11,
5101,
31363,
515,
197,
197,
4703,
3973,
25,
688,
2915,
368,
314,
1273,
14603,
4703,
3973,
1155,
8,
1153,
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 TestGetObjectRange(t *testing.T) {
assertRange := func(ts *testServer, key string, hdr string, expected []byte, fail bool) {
ts.Helper()
svc := ts.s3Client()
obj, err := svc.GetObject(&s3.GetObjectInput{
Bucket: aws.String(defaultBucket),
Key: aws.String(key),
Range: aws.String(hdr),
})
if fail != (err != nil) {
ts.Fatal("failure expected:", fail, "found:", err)
}
if !fail {
ts.OK(err)
defer obj.Body.Close()
out, err := ioutil.ReadAll(obj.Body)
ts.OK(err)
if !bytes.Equal(expected, out) {
ts.Fatal("range failed", hdr, err)
}
}
}
in := randomFileBody(1024)
for idx, tc := range []struct {
hdr string
expected []byte
fail bool
}{
{"bytes=0-", in, false},
{"bytes=1-", in[1:], false},
{"bytes=0-0", in[:1], false},
{"bytes=0-1", in[:2], false},
{"bytes=1023-1023", in[1023:1024], false},
// if the requested end is beyond the real end, returns "remainder of the representation"
{"bytes=1023-1025", in[1023:1024], false},
// if the requested start is beyond the real end, it should fail
{"bytes=1024-1024", []byte{}, true},
// suffix-byte-range-spec:
{"bytes=-0", []byte{}, true},
{"bytes=-1", in[1023:1024], false},
{"bytes=-1024", in, false},
{"bytes=-1025", in, true},
} {
t.Run(fmt.Sprintf("%d/%s", idx, tc.hdr), func(t *testing.T) {
ts := newTestServer(t)
defer ts.Close()
ts.backendPutBytes(defaultBucket, "foo", nil, in)
assertRange(ts, "foo", tc.hdr, tc.expected, tc.fail)
})
}
} | explode_data.jsonl/22262 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 670
} | [
2830,
3393,
84540,
6046,
1155,
353,
8840,
836,
8,
341,
6948,
6046,
1669,
2915,
35864,
353,
1944,
5475,
11,
1376,
914,
11,
36615,
914,
11,
3601,
3056,
3782,
11,
3690,
1807,
8,
341,
197,
57441,
69282,
741,
197,
1903,
7362,
1669,
10591,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestThrottler_Error(t *testing.T) {
throttleID, throttlePeriod, store := setup()
store.On("Get", throttleID).Return("", false, time.Duration(0), errors.New("some error"))
subject := throttles.NewThrottler(store)
result, duration, err := subject.CanTrigger(throttleID, throttlePeriod)
assert.True(t, result)
assert.Equal(t, time.Duration(0), duration)
assert.EqualError(t, err, "some error")
store.AssertCalled(t, "Get", throttleID)
} | explode_data.jsonl/70683 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 157
} | [
2830,
3393,
1001,
46689,
1536,
28651,
1155,
353,
8840,
836,
8,
341,
70479,
27535,
915,
11,
42166,
23750,
11,
3553,
1669,
6505,
2822,
57279,
8071,
445,
1949,
497,
42166,
915,
568,
5598,
19814,
895,
11,
882,
33795,
7,
15,
701,
5975,
712... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_verifyToken_MissingToken(t *testing.T) {
t.Parallel()
testSetup()
r := mocks.MockRequest("GET")
if _, err := verifyToken(nil, r); err == nil {
t.Error("Expected error about missing token")
}
} | explode_data.jsonl/61507 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 79
} | [
2830,
3393,
35638,
3323,
1245,
13577,
3323,
1155,
353,
8840,
836,
8,
341,
3244,
41288,
7957,
2822,
18185,
21821,
741,
7000,
1669,
68909,
24664,
1900,
445,
3806,
5130,
743,
8358,
1848,
1669,
10146,
3323,
27907,
11,
435,
1215,
1848,
621,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestExecIn(t *testing.T) {
if testing.Short() {
return
}
rootfs, err := newRootfs()
ok(t, err)
defer remove(rootfs)
config := newTemplateConfig(rootfs)
container, err := newContainer(config)
ok(t, err)
defer container.Destroy()
// Execute a first process in the container
stdinR, stdinW, err := os.Pipe()
ok(t, err)
process := &libcontainer.Process{
Cwd: "/",
Args: []string{"cat"},
Env: standardEnvironment,
Stdin: stdinR,
}
err = container.Run(process)
stdinR.Close()
defer stdinW.Close()
ok(t, err)
buffers := newStdBuffers()
ps := &libcontainer.Process{
Cwd: "/",
Args: []string{"ps"},
Env: standardEnvironment,
Stdin: buffers.Stdin,
Stdout: buffers.Stdout,
Stderr: buffers.Stderr,
}
err = container.Run(ps)
ok(t, err)
waitProcess(ps, t)
stdinW.Close()
waitProcess(process, t)
out := buffers.Stdout.String()
if !strings.Contains(out, "cat") || !strings.Contains(out, "ps") {
t.Fatalf("unexpected running process, output %q", out)
}
if strings.Contains(out, "\r") {
t.Fatalf("unexpected carriage-return in output")
}
} | explode_data.jsonl/2985 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 457
} | [
2830,
3393,
10216,
641,
1155,
353,
8840,
836,
8,
341,
743,
7497,
55958,
368,
341,
197,
853,
198,
197,
532,
33698,
3848,
11,
1848,
1669,
501,
8439,
3848,
741,
59268,
1155,
11,
1848,
340,
16867,
4057,
9206,
3848,
340,
25873,
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 TestLock_ReclaimLock(t *testing.T) {
t.Parallel()
c, s := makeClient(t)
defer s.Stop()
session, _, err := c.Session().Create(&SessionEntry{}, nil)
if err != nil {
t.Fatalf("err: %v", err)
}
lock, err := c.LockOpts(&LockOptions{Key: "test/lock", Session: session})
if err != nil {
t.Fatalf("err: %v", err)
}
// Should work
leaderCh, err := lock.Lock(nil)
if err != nil {
t.Fatalf("err: %v", err)
}
if leaderCh == nil {
t.Fatalf("not leader")
}
defer lock.Unlock()
l2, err := c.LockOpts(&LockOptions{Key: "test/lock", Session: session})
if err != nil {
t.Fatalf("err: %v", err)
}
reclaimed := make(chan (<-chan struct{}), 1)
go func() {
l2Ch, err := l2.Lock(nil)
if err != nil {
t.Fatalf("not locked: %v", err)
}
reclaimed <- l2Ch
}()
// Should reclaim the lock
var leader2Ch <-chan struct{}
select {
case leader2Ch = <-reclaimed:
case <-time.After(time.Second):
t.Fatalf("should have locked")
}
// unlock should work
err = l2.Unlock()
if err != nil {
t.Fatalf("err: %v", err)
}
//Both locks should see the unlock
select {
case <-leader2Ch:
case <-time.After(time.Second):
t.Fatalf("should not be leader")
}
select {
case <-leaderCh:
case <-time.After(time.Second):
t.Fatalf("should not be leader")
}
} | explode_data.jsonl/27628 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 535
} | [
2830,
3393,
11989,
50693,
7859,
11989,
1155,
353,
8840,
836,
8,
341,
3244,
41288,
7957,
741,
1444,
11,
274,
1669,
1281,
2959,
1155,
340,
16867,
274,
30213,
2822,
25054,
11,
8358,
1848,
1669,
272,
20674,
1005,
4021,
2099,
5283,
5874,
226... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestGetPodKeys(t *testing.T) {
labelMap := map[string]string{"name": "foo"}
rs := newReplicaSet(1, labelMap)
pod1 := newPod("pod1", rs, v1.PodRunning, nil, true)
pod2 := newPod("pod2", rs, v1.PodRunning, nil, true)
tests := []struct {
name string
pods []*v1.Pod
expectedPodKeys []string
}{
{
"len(pods) = 0 (i.e., pods = nil)",
[]*v1.Pod{},
[]string{},
},
{
"len(pods) > 0",
[]*v1.Pod{
pod1,
pod2,
},
[]string{"default/pod1", "default/pod2"},
},
}
for _, test := range tests {
podKeys := getPodKeys(test.pods)
if len(podKeys) != len(test.expectedPodKeys) {
t.Errorf("%s: unexpected keys for pods to delete, expected %v, got %v", test.name, test.expectedPodKeys, podKeys)
}
for i := 0; i < len(podKeys); i++ {
if podKeys[i] != test.expectedPodKeys[i] {
t.Errorf("%s: unexpected keys for pods to delete, expected %v, got %v", test.name, test.expectedPodKeys, podKeys)
}
}
}
} | explode_data.jsonl/7993 | {
"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,
1949,
23527,
8850,
1155,
353,
8840,
836,
8,
341,
29277,
2227,
1669,
2415,
14032,
30953,
4913,
606,
788,
330,
7975,
16707,
41231,
1669,
501,
18327,
15317,
1649,
7,
16,
11,
2383,
2227,
340,
3223,
347,
16,
1669,
501,
23527,
4... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 5 |
func TestToml(t *testing.T) {
assert := assert.New(t)
settings := testutil.Settings().WithSections().Build()
expected, err := testutil.GetExpected("toml", "toml")
assert.Nil(err)
options := module.NewOptions()
module, err := testutil.GetModule(options)
assert.Nil(err)
printer := NewTOML(settings)
actual, err := printer.Print(module, settings)
assert.Nil(err)
assert.Equal(expected, actual)
} | explode_data.jsonl/36757 | {
"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,
24732,
75,
1155,
353,
8840,
836,
8,
341,
6948,
1669,
2060,
7121,
1155,
340,
62930,
1669,
1273,
1314,
27000,
1005,
2354,
38122,
1005,
11066,
2822,
42400,
11,
1848,
1669,
1273,
1314,
2234,
18896,
445,
37401,
75,
497,
330,
3740... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestCommit(t *testing.T) {
client := getAuthorizedClient(t)
commit, err := client.Commit("CDS/images", "1244a1ccf125a80abeb191fce98d3cdcad13b8c2")
test.NoError(t, err)
t.Logf("%+v", commit)
} | explode_data.jsonl/64192 | {
"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,
33441,
1155,
353,
8840,
836,
8,
341,
25291,
1669,
633,
60454,
2959,
1155,
340,
197,
17413,
11,
1848,
1669,
2943,
53036,
445,
34,
5936,
9737,
497,
330,
16,
17,
19,
19,
64,
16,
638,
69,
16,
17,
20,
64,
23,
15,
370,
306... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestCorruptPeersFile(t *testing.T) {
dir, err := ioutil.TempDir("", "testcorruptpeersfile")
if err != nil {
t.Fatal(err)
}
defer os.RemoveAll(dir)
peersFile := filepath.Join(dir, PeersFilename)
// create corrupt (empty) peers file
fp, err := os.Create(peersFile)
if err != nil {
t.Fatalf("Could not create empty peers file: %s", peersFile)
}
if err := fp.Close(); err != nil {
t.Fatalf("Could not write empty peers file: %s", peersFile)
}
amgr := New(dir, nil)
amgr.Start()
amgr.Stop()
if _, err := os.Stat(peersFile); err != nil {
t.Fatalf("Corrupt peers file has not been removed: %s", peersFile)
}
} | explode_data.jsonl/26485 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 250
} | [
2830,
3393,
10580,
6585,
10197,
388,
1703,
1155,
353,
8840,
836,
8,
341,
48532,
11,
1848,
1669,
43144,
65009,
6184,
19814,
330,
1944,
6005,
6585,
375,
388,
1192,
1138,
743,
1848,
961,
2092,
341,
197,
3244,
26133,
3964,
340,
197,
532,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 5 |
func TestReconcileServiceInstanceWithFailedCondition(t *testing.T) {
fakeKubeClient, fakeCatalogClient, fakeClusterServiceBrokerClient, testController, sharedInformers := newTestController(t, fakeosb.FakeClientConfiguration{
ProvisionReaction: &fakeosb.ProvisionReaction{
Response: &osb.ProvisionResponse{},
},
})
sharedInformers.ClusterServiceBrokers().Informer().GetStore().Add(getTestClusterServiceBroker())
sharedInformers.ClusterServiceClasses().Informer().GetStore().Add(getTestClusterServiceClass())
sharedInformers.ClusterServicePlans().Informer().GetStore().Add(getTestClusterServicePlan())
instance := getTestServiceInstanceWithFailedStatus()
if err := reconcileServiceInstance(t, testController, instance); err != nil {
t.Fatalf("unexpected error: %v", err)
}
instance = assertServiceInstanceProvisionInProgressIsTheOnlyCatalogClientAction(t, fakeCatalogClient, instance)
fakeCatalogClient.ClearActions()
fakeKubeClient.ClearActions()
if err := reconcileServiceInstance(t, testController, instance); err != nil {
t.Fatalf("This should not fail : %v", err)
}
brokerActions := fakeClusterServiceBrokerClient.Actions()
assertNumberOfBrokerActions(t, brokerActions, 1)
assertProvision(t, brokerActions[0], &osb.ProvisionRequest{
AcceptsIncomplete: true,
InstanceID: testServiceInstanceGUID,
ServiceID: testClusterServiceClassGUID,
PlanID: testClusterServicePlanGUID,
OrganizationGUID: testClusterID,
SpaceGUID: testNamespaceGUID,
Context: testContext,
})
instanceKey := testNamespace + "/" + testServiceInstanceName
if testController.instancePollingQueue.NumRequeues(instanceKey) != 0 {
t.Fatalf("Expected polling queue to not have any record of test instance")
}
actions := fakeCatalogClient.Actions()
assertNumberOfActions(t, actions, 1)
updatedServiceInstance := assertUpdateStatus(t, actions[0], instance)
assertServiceInstanceOperationSuccess(t, updatedServiceInstance, v1beta1.ServiceInstanceOperationProvision, testClusterServicePlanName, testClusterServicePlanGUID, instance)
kubeActions := fakeKubeClient.Actions()
assertNumberOfActions(t, kubeActions, 1)
// verify no kube resources created
// One single action comes from getting namespace uid
if err := checkKubeClientActions(kubeActions, []kubeClientAction{
{verb: "get", resourceName: "namespaces", checkType: checkGetActionType},
}); err != nil {
t.Fatal(err)
}
events := getRecordedEvents(testController)
assertNumEvents(t, events, 1)
expectedEvent := normalEventBuilder(successProvisionReason).msg("The instance was provisioned successfully")
if err := checkEvents(events, expectedEvent.stringArr()); err != nil {
t.Fatal(err)
}
} | explode_data.jsonl/58157 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 867
} | [
2830,
3393,
693,
40446,
457,
1860,
2523,
2354,
9408,
10547,
1155,
353,
8840,
836,
8,
341,
1166,
726,
42,
3760,
2959,
11,
12418,
41606,
2959,
11,
12418,
28678,
1860,
65545,
2959,
11,
1273,
2051,
11,
6094,
37891,
388,
1669,
501,
2271,
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... | 6 |
func TestHashMSet(t *testing.T) {
s, err := Run()
ok(t, err)
defer s.Close()
c, err := proto.Dial(s.Addr())
ok(t, err)
defer c.Close()
// New Hash
{
mustOK(t, c, "HMSET", "hash", "wim", "zus", "jet", "vuur")
equals(t, "zus", s.HGet("hash", "wim"))
equals(t, "vuur", s.HGet("hash", "jet"))
}
// Doesn't touch ttl.
{
s.SetTTL("hash", time.Second*999)
mustOK(t, c, "HMSET", "hash", "gijs", "lam")
equals(t, time.Second*999, s.TTL("hash"))
}
{
// Wrong key type
s.Set("str", "value")
mustDo(t, c, "HMSET", "str", "key", "value", proto.Error("WRONGTYPE Operation against a key holding the wrong kind of value"))
// Usage error
mustDo(t, c, "HMSET", "str", proto.Error(errWrongNumber("hmset")))
mustDo(t, c, "HMSET", "str", "odd", proto.Error(errWrongNumber("hmset")))
mustDo(t, c, "HMSET", "str", "key", "value", "odd", proto.Error(errWrongNumber("hmset")))
}
} | explode_data.jsonl/11369 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 419
} | [
2830,
3393,
6370,
44,
1649,
1155,
353,
8840,
836,
8,
341,
1903,
11,
1848,
1669,
6452,
741,
59268,
1155,
11,
1848,
340,
16867,
274,
10421,
741,
1444,
11,
1848,
1669,
18433,
98462,
1141,
93626,
2398,
59268,
1155,
11,
1848,
340,
16867,
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 TestFormatterPlaceholder(test *testing.T) {
f := formatter.New().SetPlaceholder("c")
formatted, err := f.Format("{c1} {c0}", "d", 4)
assert.NoError(test, err)
assert.Equal(test, "4 d", formatted)
assert.Equal(test, f, f.ResetPlaceholder())
assert.Equal(test, formatter.DefaultPlaceholder, f.GetPlaceholder())
} | explode_data.jsonl/39737 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 122
} | [
2830,
3393,
14183,
48305,
8623,
353,
8840,
836,
8,
341,
1166,
1669,
24814,
7121,
1005,
1649,
48305,
445,
66,
5130,
37410,
12127,
11,
1848,
1669,
282,
9978,
13976,
66,
16,
92,
314,
66,
15,
9545,
330,
67,
497,
220,
19,
692,
6948,
3569... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestImportPostAndRepliesWithAttachments(t *testing.T) {
th := Setup(t)
defer th.TearDown()
// Create a Team.
teamName := model.NewRandomTeamName()
th.App.importTeam(&TeamImportData{
Name: &teamName,
DisplayName: ptrStr("Display Name"),
Type: ptrStr("O"),
}, false)
team, err := th.App.GetTeamByName(teamName)
require.Nil(t, err, "Failed to get team from database.")
// Create a Channel.
channelName := model.NewId()
th.App.importChannel(&ChannelImportData{
Team: &teamName,
Name: &channelName,
DisplayName: ptrStr("Display Name"),
Type: ptrStr("O"),
}, false)
_, err = th.App.GetChannelByName(channelName, team.Id, false)
require.Nil(t, err, "Failed to get channel from database.")
// Create a user3.
username := model.NewId()
th.App.importUser(&UserImportData{
Username: &username,
Email: ptrStr(model.NewId() + "@example.com"),
}, false)
user3, err := th.App.GetUserByUsername(username)
require.Nil(t, err, "Failed to get user3 from database.")
username2 := model.NewId()
th.App.importUser(&UserImportData{
Username: &username2,
Email: ptrStr(model.NewId() + "@example.com"),
}, false)
user4, err := th.App.GetUserByUsername(username2)
require.Nil(t, err, "Failed to get user3 from database.")
// Post with attachments.
time := model.GetMillis()
attachmentsPostTime := time
attachmentsReplyTime := time + 1
testsDir, _ := fileutils.FindDir("tests")
testImage := filepath.Join(testsDir, "test.png")
testMarkDown := filepath.Join(testsDir, "test-attachments.md")
data := &PostImportData{
Team: &teamName,
Channel: &channelName,
User: &username,
Message: ptrStr("Message with reply"),
CreateAt: &attachmentsPostTime,
Attachments: &[]AttachmentImportData{{Path: &testImage}, {Path: &testMarkDown}},
Replies: &[]ReplyImportData{{
User: &user4.Username,
Message: ptrStr("Message reply"),
CreateAt: &attachmentsReplyTime,
Attachments: &[]AttachmentImportData{{Path: &testImage}},
}},
}
// import with attachments
err = th.App.importPost(data, false)
assert.Nil(t, err)
attachments := GetAttachments(user3.Id, th, t)
assert.Len(t, attachments, 2)
assert.Contains(t, attachments[0].Path, team.Id)
assert.Contains(t, attachments[1].Path, team.Id)
AssertFileIdsInPost(attachments, th, t)
// import existing post with new attachments
data.Attachments = &[]AttachmentImportData{{Path: &testImage}}
err = th.App.importPost(data, false)
assert.Nil(t, err)
attachments = GetAttachments(user3.Id, th, t)
assert.Len(t, attachments, 1)
assert.Contains(t, attachments[0].Path, team.Id)
AssertFileIdsInPost(attachments, th, t)
attachments = GetAttachments(user4.Id, th, t)
assert.Len(t, attachments, 1)
assert.Contains(t, attachments[0].Path, team.Id)
AssertFileIdsInPost(attachments, th, t)
// Reply with Attachments in Direct Post
// Create direct post users.
username3 := model.NewId()
th.App.importUser(&UserImportData{
Username: &username3,
Email: ptrStr(model.NewId() + "@example.com"),
}, false)
user3, err = th.App.GetUserByUsername(username3)
require.Nil(t, err, "Failed to get user3 from database.")
username4 := model.NewId()
th.App.importUser(&UserImportData{
Username: &username4,
Email: ptrStr(model.NewId() + "@example.com"),
}, false)
user4, err = th.App.GetUserByUsername(username4)
require.Nil(t, err, "Failed to get user3 from database.")
directImportData := &DirectPostImportData{
ChannelMembers: &[]string{
user3.Username,
user4.Username,
},
User: &user3.Username,
Message: ptrStr("Message with Replies"),
CreateAt: ptrInt64(model.GetMillis()),
Replies: &[]ReplyImportData{{
User: &user4.Username,
Message: ptrStr("Message reply with attachment"),
CreateAt: ptrInt64(model.GetMillis()),
Attachments: &[]AttachmentImportData{{Path: &testImage}},
}},
}
err = th.App.importDirectPost(directImportData, false)
require.Nil(t, err, "Expected success.")
attachments = GetAttachments(user4.Id, th, t)
assert.Len(t, attachments, 1)
assert.Contains(t, attachments[0].Path, "noteam")
AssertFileIdsInPost(attachments, th, t)
} | explode_data.jsonl/67145 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 1618
} | [
2830,
3393,
11511,
4133,
3036,
693,
7202,
2354,
75740,
1155,
353,
8840,
836,
8,
341,
70479,
1669,
18626,
1155,
340,
16867,
270,
836,
682,
4454,
2822,
197,
322,
4230,
264,
7909,
624,
197,
9196,
675,
1669,
1614,
7121,
13999,
14597,
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... | 1 |
func TestUpdateFleetReplicaAndSpec(t *testing.T) {
if !runtime.FeatureEnabled(runtime.FeatureRollingUpdateOnReady) {
t.SkipNow()
}
t.Parallel()
client := framework.AgonesClient.AgonesV1()
ctx := context.Background()
flt := defaultFleet(framework.Namespace)
flt.ApplyDefaults()
flt, err := client.Fleets(framework.Namespace).Create(ctx, flt, metav1.CreateOptions{})
require.NoError(t, err)
logrus.WithField("fleet", flt).Info("Created Fleet")
selector := labels.SelectorFromSet(labels.Set{agonesv1.FleetNameLabel: flt.ObjectMeta.Name})
framework.AssertFleetCondition(t, flt, e2e.FleetReadyCount(flt.Spec.Replicas))
require.Eventuallyf(t, func() bool {
list, err := client.GameServerSets(framework.Namespace).List(ctx,
metav1.ListOptions{LabelSelector: selector.String()})
require.NoError(t, err)
return len(list.Items) == 1
}, time.Minute, time.Second, "Wrong number of GameServerSets")
// update both replicas and template at the same time
flt, err = client.Fleets(framework.Namespace).Get(ctx, flt.ObjectMeta.GetName(), metav1.GetOptions{})
require.NoError(t, err)
fltCopy := flt.DeepCopy()
fltCopy.Spec.Replicas = 0
fltCopy.Spec.Template.Spec.Ports[0].ContainerPort++
require.NotEqual(t, flt.Spec.Template.Spec.Ports[0].ContainerPort, fltCopy.Spec.Template.Spec.Ports[0].ContainerPort)
flt, err = client.Fleets(framework.Namespace).Update(ctx, fltCopy, metav1.UpdateOptions{})
require.NoError(t, err)
require.Empty(t, flt.Spec.Replicas)
framework.AssertFleetCondition(t, flt, e2e.FleetReadyCount(flt.Spec.Replicas))
require.Eventuallyf(t, func() bool {
list, err := client.GameServerSets(framework.Namespace).List(ctx,
metav1.ListOptions{LabelSelector: selector.String()})
require.NoError(t, err)
return len(list.Items) == 1 && list.Items[0].Spec.Replicas == 0
}, time.Minute, time.Second, "Wrong number of GameServerSets")
} | explode_data.jsonl/15419 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 690
} | [
2830,
3393,
4289,
37,
18973,
18327,
15317,
3036,
8327,
1155,
353,
8840,
836,
8,
341,
743,
753,
22255,
58434,
5462,
89467,
58434,
32355,
287,
4289,
1925,
19202,
8,
341,
197,
3244,
57776,
7039,
741,
197,
532,
3244,
41288,
7957,
2822,
2529... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestBeginEnd(t *testing.T) {
scr := NewScript()
val := 123
scr.Begin = func(s *Script) { val *= 10 }
scr.End = func(s *Script) { val += 4 }
err := scr.Run(strings.NewReader("dummy data"))
if err != nil {
t.Fatal(err)
}
if val != 1234 {
t.Fatalf("Expected 1234 but received %d", val)
}
} | explode_data.jsonl/3004 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 131
} | [
2830,
3393,
11135,
3727,
1155,
353,
8840,
836,
8,
341,
1903,
5082,
1669,
1532,
5910,
741,
19302,
1669,
220,
16,
17,
18,
198,
1903,
5082,
28467,
284,
2915,
1141,
353,
5910,
8,
314,
1044,
11404,
220,
16,
15,
456,
1903,
5082,
18569,
28... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestCollectorPriorityClassName(t *testing.T) {
priorityClassName := "test-class"
jaeger := v1.NewJaeger(types.NamespacedName{Name: "my-instance"})
jaeger.Spec.Collector.PriorityClassName = priorityClassName
c := NewCollector(jaeger)
dep := c.Get()
assert.Equal(t, priorityClassName, dep.Spec.Template.Spec.PriorityClassName)
} | explode_data.jsonl/59540 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 122
} | [
2830,
3393,
53694,
20555,
14541,
1155,
353,
8840,
836,
8,
341,
3223,
8773,
14541,
1669,
330,
1944,
14800,
698,
197,
5580,
1878,
1669,
348,
16,
7121,
52445,
1878,
52613,
98932,
68552,
675,
63121,
25,
330,
2408,
73655,
23625,
197,
5580,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestSaltPasswordAndCompare(t *testing.T) {
saltP, err := auth.SaltPassword(password)
if err != nil {
t.Error("should not have error when salt a string")
}
err = auth.CompareHashAndPassword([]byte(saltP), []byte(password))
if err != nil {
t.Error("should not return an error if we compare the password and the salt one")
}
} | explode_data.jsonl/27196 | {
"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,
47318,
4876,
3036,
27374,
1155,
353,
8840,
836,
8,
341,
1903,
3145,
47,
11,
1848,
1669,
4166,
808,
3145,
4876,
22768,
340,
743,
1848,
961,
2092,
341,
197,
3244,
6141,
445,
5445,
537,
614,
1465,
979,
12021,
264,
914,
1138,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
func TestBase64Validation(t *testing.T) {
validate := New()
s := "dW5pY29ybg=="
errs := validate.Var(s, "base64")
Equal(t, errs, nil)
s = "dGhpIGlzIGEgdGVzdCBiYXNlNjQ="
errs = validate.Var(s, "base64")
Equal(t, errs, nil)
s = ""
errs = validate.Var(s, "base64")
NotEqual(t, errs, nil)
AssertError(t, errs, "", "", "", "", "base64")
s = "dW5pY29ybg== foo bar"
errs = validate.Var(s, "base64")
NotEqual(t, errs, nil)
AssertError(t, errs, "", "", "", "", "base64")
} | explode_data.jsonl/77289 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 243
} | [
2830,
3393,
3978,
21,
19,
13799,
1155,
353,
8840,
836,
8,
1476,
197,
7067,
1669,
1532,
2822,
1903,
1669,
330,
67,
54,
20,
79,
56,
17,
24,
88,
12220,
418,
1837,
9859,
82,
1669,
9593,
87968,
1141,
11,
330,
3152,
21,
19,
1138,
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 TestAddUnreachableNodeToleration(t *testing.T) {
podSpec := v1.PodSpec{}
// -------------------------------------------------------------------------
// Test one toleration of 5 seconds
expectedURToleration := newToleration(5, "node.kubernetes.io/unreachable")
// Change the UR toleration in the pod using env var and the tested function
os.Setenv("ROOK_UNREACHABLE_NODE_TOLERATION_SECONDS", "5")
AddUnreachableNodeToleration(&podSpec)
assert.Equal(t, 1, len(podSpec.Tolerations))
assert.Equal(t, expectedURToleration, podSpec.Tolerations[0])
//--------------------------------------------------------------------------
// Test adding one additional toleration, replaces the previous one,
// keeping only the last.
expectedURToleration = newToleration(6, "node.kubernetes.io/unreachable")
// Change the UR toleration in the pod using env var and the tested function
os.Setenv("ROOK_UNREACHABLE_NODE_TOLERATION_SECONDS", "6")
AddUnreachableNodeToleration(&podSpec)
assert.Equal(t, 1, len(podSpec.Tolerations))
assert.Equal(t, expectedURToleration, podSpec.Tolerations[0])
//--------------------------------------------------------------------------
// Changing the toleration at the beginning of the list
urTol := newToleration(10, "node.kubernetes.io/unreachable")
otherTol := newToleration(20, "node.kubernetes.io/network-unavailable")
podSpec.Tolerations = nil
podSpec.Tolerations = append(podSpec.Tolerations, urTol, otherTol)
expectedURToleration = newToleration(7, "node.kubernetes.io/unreachable")
// Change the Unreachable node toleration
os.Setenv("ROOK_UNREACHABLE_NODE_TOLERATION_SECONDS", "7")
AddUnreachableNodeToleration(&podSpec)
assert.Equal(t, 2, len(podSpec.Tolerations))
assert.Equal(t, expectedURToleration, podSpec.Tolerations[0])
//--------------------------------------------------------------------------
// Changing the toleration at the middle of the list
podSpec.Tolerations = nil
podSpec.Tolerations = append(podSpec.Tolerations, otherTol, urTol, otherTol)
expectedURToleration = newToleration(8, "node.kubernetes.io/unreachable")
// Change the Unreachable node toleration
os.Setenv("ROOK_UNREACHABLE_NODE_TOLERATION_SECONDS", "8")
AddUnreachableNodeToleration(&podSpec)
assert.Equal(t, 3, len(podSpec.Tolerations))
assert.Equal(t, expectedURToleration, podSpec.Tolerations[1])
//--------------------------------------------------------------------------
// Changing the toleration at the end of the list
podSpec.Tolerations = nil
podSpec.Tolerations = append(podSpec.Tolerations, otherTol, urTol)
expectedURToleration = newToleration(9, "node.kubernetes.io/unreachable")
// Change the Unreachable node toleration
os.Setenv("ROOK_UNREACHABLE_NODE_TOLERATION_SECONDS", "9")
AddUnreachableNodeToleration(&podSpec)
assert.Equal(t, 2, len(podSpec.Tolerations))
assert.Equal(t, expectedURToleration, podSpec.Tolerations[1])
// Environment var with wrong value format results in using default value
podSpec.Tolerations = nil
// The default value used for the Unreachable Node Toleration is 5 seconds
expectedURToleration = newToleration(5, "node.kubernetes.io/unreachable")
// Change the Unreachable node toleration using wrong format
os.Setenv("ROOK_UNREACHABLE_NODE_TOLERATION_SECONDS", "9s")
AddUnreachableNodeToleration(&podSpec)
assert.Equal(t, 1, len(podSpec.Tolerations))
assert.Equal(t, expectedURToleration, podSpec.Tolerations[0])
} | explode_data.jsonl/9466 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 1126
} | [
2830,
3393,
2212,
1806,
46550,
1955,
51,
337,
20927,
1155,
353,
8840,
836,
8,
341,
3223,
347,
8327,
1669,
348,
16,
88823,
8327,
31483,
197,
322,
80550,
197,
322,
3393,
825,
14885,
367,
315,
220,
20,
6486,
198,
42400,
87096,
337,
20927... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestMySQLClusterService_MarshalWithFields(t *testing.T) {
asst := assert.New(t)
entity, err := createMySQLCluster()
asst.Nil(err, common.CombineMessageWithError("test MarshalWithFields() failed", err))
s := initNewMySQLService()
err = s.GetByID(entity.Identity())
dataService, err := s.MarshalWithFields(clusterNameStruct)
asst.Nil(err, common.CombineMessageWithError("test MarshalWithFields() failed", err))
dataEntity, err := entity.MarshalJSONWithFields(clusterNameStruct)
asst.Nil(err, common.CombineMessageWithError("test MarshalWithFields() failed", err))
asst.Equal(string(dataService), fmt.Sprintf("[%s]", string(dataEntity)))
// delete
err = deleteMySQLClusterByID(entity.Identity())
asst.Nil(err, common.CombineMessageWithError("test Delete() failed", err))
} | explode_data.jsonl/6160 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 273
} | [
2830,
3393,
59224,
28678,
1860,
1245,
28423,
2354,
8941,
1155,
353,
8840,
836,
8,
341,
60451,
267,
1669,
2060,
7121,
1155,
692,
52987,
11,
1848,
1669,
1855,
59224,
28678,
741,
60451,
267,
59678,
3964,
11,
4185,
31124,
2052,
66102,
445,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestInvokeCmdEndorsementFailure(t *testing.T) {
defer resetFlags()
ccRespStatus := [2]int32{502, 400}
ccRespPayload := [][]byte{[]byte("Invalid function name"), []byte("Incorrect parameters")}
for i := 0; i < 2; i++ {
mockCF, err := getMockChaincodeCmdFactoryEndorsementFailure(ccRespStatus[i], ccRespPayload[i])
assert.NoError(t, err, "Error getting mock chaincode command factory")
cmd := invokeCmd(mockCF)
addFlags(cmd)
args := []string{"-C", "mychannel", "-n", "example02", "-c", "{\"Args\": [\"invokeinvalid\",\"a\",\"b\",\"10\"]}"}
cmd.SetArgs(args)
err = cmd.Execute()
assert.Error(t, err)
assert.Contains(t, err.Error(), "endorsement failure during invoke")
assert.Contains(t, err.Error(), fmt.Sprintf("response: status:%d payload:\"%s\"", ccRespStatus[i], ccRespPayload[i]))
}
} | explode_data.jsonl/65805 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 306
} | [
2830,
3393,
17604,
15613,
3727,
10836,
478,
17507,
1155,
353,
8840,
836,
8,
341,
16867,
7585,
9195,
741,
63517,
36555,
2522,
1669,
508,
17,
63025,
18,
17,
90,
20,
15,
17,
11,
220,
19,
15,
15,
532,
63517,
36555,
29683,
1669,
52931,
3... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
func TestSpecCpCase(t *testing.T) {
var f, g *[]string
init := func(c *Cmd) {
f = c.StringsArg("SRC", nil, "")
g = c.StringsArg("DST", nil, "")
}
spec := "SRC... DST"
okCmd(t, spec, init, []string{"A", "B"})
require.Equal(t, []string{"A"}, *f)
require.Equal(t, []string{"B"}, *g)
okCmd(t, spec, init, []string{"A", "B", "C"})
require.Equal(t, []string{"A", "B"}, *f)
require.Equal(t, []string{"C"}, *g)
okCmd(t, spec, init, []string{"A", "B", "C", "D"})
require.Equal(t, []string{"A", "B", "C"}, *f)
require.Equal(t, []string{"D"}, *g)
} | explode_data.jsonl/23933 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 266
} | [
2830,
3393,
8327,
34,
79,
4207,
1155,
353,
8840,
836,
8,
341,
2405,
282,
11,
342,
353,
1294,
917,
198,
28248,
1669,
2915,
1337,
353,
15613,
8,
341,
197,
1166,
284,
272,
89154,
2735,
445,
56017,
497,
2092,
11,
14676,
197,
3174,
284,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestVendorImports(t *testing.T) {
exported := packagestest.Export(t, packagestest.GOPATH, []packagestest.Module{{
Name: "golang.org/fake",
Files: map[string]interface{}{
"a/a.go": `package a; import _ "b"; import _ "golang.org/fake/c";`,
"a/vendor/b/b.go": `package b; import _ "golang.org/fake/c"`,
"c/c.go": `package c; import _ "b"`,
"c/vendor/b/b.go": `package b`,
}}})
defer exported.Cleanup()
exported.Config.Mode = packages.LoadImports
initial, err := packages.Load(exported.Config, "golang.org/fake/a", "golang.org/fake/c")
if err != nil {
t.Fatal(err)
}
graph, all := importGraph(initial)
wantGraph := `
* golang.org/fake/a
golang.org/fake/a/vendor/b
* golang.org/fake/c
golang.org/fake/c/vendor/b
golang.org/fake/a -> golang.org/fake/a/vendor/b
golang.org/fake/a -> golang.org/fake/c
golang.org/fake/a/vendor/b -> golang.org/fake/c
golang.org/fake/c -> golang.org/fake/c/vendor/b
`[1:]
if graph != wantGraph {
t.Errorf("wrong import graph: got <<%s>>, want <<%s>>", graph, wantGraph)
}
for _, test := range []struct {
pattern string
wantImports string
}{
{"golang.org/fake/a", "b:golang.org/fake/a/vendor/b golang.org/fake/c:golang.org/fake/c"},
{"golang.org/fake/c", "b:golang.org/fake/c/vendor/b"},
{"golang.org/fake/a/vendor/b", "golang.org/fake/c:golang.org/fake/c"},
{"golang.org/fake/c/vendor/b", ""},
} {
// Test the import paths.
pkg := all[test.pattern]
if imports := strings.Join(imports(pkg), " "); imports != test.wantImports {
t.Errorf("package %q: got %s, want %s", test.pattern, imports, test.wantImports)
}
}
} | explode_data.jsonl/45180 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 750
} | [
2830,
3393,
44691,
31250,
1155,
353,
8840,
836,
8,
341,
59440,
291,
1669,
6328,
267,
477,
81077,
1155,
11,
6328,
267,
477,
1224,
3067,
4827,
11,
3056,
1722,
267,
477,
26958,
90,
515,
197,
21297,
25,
330,
70,
37287,
2659,
6663,
726,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestCreateIndex(t *testing.T) {
catalogStore, err := store.Open("catalog_create_index", store.DefaultOptions())
require.NoError(t, err)
defer os.RemoveAll("catalog_create_index")
dataStore, err := store.Open("sqldata_create_index", store.DefaultOptions())
require.NoError(t, err)
defer os.RemoveAll("sqldata_create_index")
engine, err := NewEngine(catalogStore, dataStore, DefaultOptions().WithPrefix(sqlPrefix))
require.NoError(t, err)
_, err = engine.ExecStmt("CREATE DATABASE db1", nil, true)
require.NoError(t, err)
err = engine.UseDatabase("db1")
require.NoError(t, err)
_, err = engine.ExecStmt("CREATE TABLE table1 (id INTEGER, name VARCHAR[256], age INTEGER, active BOOLEAN, PRIMARY KEY id)", nil, true)
require.NoError(t, err)
db, err := engine.GetDatabaseByName("db1")
require.NoError(t, err)
require.NotNil(t, db)
table, err := engine.GetTableByName("db1", "table1")
require.NoError(t, err)
require.Len(t, table.indexes, 1)
_, err = engine.ExecStmt("CREATE INDEX ON table1(name)", nil, true)
require.NoError(t, err)
_, err = engine.ExecStmt("CREATE INDEX IF NOT EXISTS ON table1(name)", nil, true)
require.NoError(t, err)
col, err := table.GetColumnByName("name")
require.NoError(t, err)
indexed, err := table.IsIndexed(col.colName)
require.NoError(t, err)
require.True(t, indexed)
_, err = engine.ExecStmt("CREATE INDEX ON table1(id)", nil, true)
require.Equal(t, ErrIndexAlreadyExists, err)
_, err = engine.ExecStmt("CREATE UNIQUE INDEX IF NOT EXISTS ON table1(id)", nil, true)
require.NoError(t, err)
_, err = engine.ExecStmt("CREATE INDEX ON table1(age)", nil, true)
require.NoError(t, err)
col, err = table.GetColumnByName("age")
require.NoError(t, err)
indexed, err = table.IsIndexed(col.colName)
require.NoError(t, err)
require.True(t, indexed)
_, err = engine.ExecStmt("CREATE INDEX ON table1(name)", nil, true)
require.Equal(t, ErrIndexAlreadyExists, err)
_, err = engine.ExecStmt("CREATE INDEX ON table2(name)", nil, true)
require.Equal(t, ErrTableDoesNotExist, err)
_, err = engine.ExecStmt("CREATE INDEX ON table1(title)", nil, true)
require.Equal(t, ErrColumnDoesNotExist, err)
_, err = engine.ExecStmt("INSERT INTO table1(id, name, age) VALUES (1, 'name1', 50)", nil, true)
require.NoError(t, err)
_, err = engine.ExecStmt("INSERT INTO table1(name, age) VALUES ('name2', 10)", nil, true)
require.ErrorIs(t, err, ErrPKCanNotBeNull)
_, err = engine.ExecStmt("CREATE INDEX ON table1(active)", nil, true)
require.Equal(t, ErrLimitedIndexCreation, err)
} | explode_data.jsonl/64057 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 971
} | [
2830,
3393,
4021,
1552,
1155,
353,
8840,
836,
8,
341,
1444,
7750,
6093,
11,
1848,
1669,
3553,
12953,
445,
26539,
8657,
3560,
497,
3553,
13275,
3798,
2398,
17957,
35699,
1155,
11,
1848,
340,
16867,
2643,
84427,
445,
26539,
8657,
3560,
51... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestEqInToSql(t *testing.T) {
b := Eq{"id": []int{1, 2, 3}}
sql, args, err := b.ToSql()
assert.NoError(t, err)
expectedSql := "id IN (?,?,?)"
assert.Equal(t, expectedSql, sql)
expectedArgs := []interface{}{1, 2, 3}
assert.Equal(t, expectedArgs, args)
} | explode_data.jsonl/44160 | {
"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,
27312,
641,
1249,
8269,
1155,
353,
8840,
836,
8,
341,
2233,
1669,
33122,
4913,
307,
788,
3056,
396,
90,
16,
11,
220,
17,
11,
220,
18,
11248,
30633,
11,
2827,
11,
1848,
1669,
293,
3274,
8269,
741,
6948,
35699,
1155,
11,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestBuildDependency(t *testing.T) {
expectedArgs := []string{"dependency", "build"}
helm, runner := createHelm(t, nil, "")
err := helm.BuildDependency()
assert.NoError(t, err, "should build helm repo dependencies without any error")
verifyArgs(t, helm, runner, expectedArgs...)
} | explode_data.jsonl/4647 | {
"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,
11066,
36387,
1155,
353,
8840,
836,
8,
341,
42400,
4117,
1669,
3056,
917,
4913,
53690,
497,
330,
5834,
16707,
9598,
23162,
11,
22259,
1669,
1855,
39,
23162,
1155,
11,
2092,
11,
85617,
9859,
1669,
33765,
25212,
36387,
741,
69... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestLookupHashCost(t *testing.T) {
lookuphash := createLookup(t, "lookup_hash", false)
lookuphashunique := createLookup(t, "lookup_hash_unique", false)
if lookuphash.Cost() != 20 {
t.Errorf("Cost(): %d, want 20", lookuphash.Cost())
}
if lookuphashunique.Cost() != 10 {
t.Errorf("Cost(): %d, want 10", lookuphashunique.Cost())
}
} | explode_data.jsonl/3414 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 135
} | [
2830,
3393,
34247,
6370,
14940,
1155,
353,
8840,
836,
8,
341,
197,
21020,
8296,
1669,
1855,
34247,
1155,
11,
330,
21020,
8950,
497,
895,
340,
197,
21020,
8296,
9587,
1669,
1855,
34247,
1155,
11,
330,
21020,
8950,
21218,
497,
895,
692,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
func TestAnonymousFields(t *testing.T) {
var field StructField
var ok bool
var t1 T1
type1 := TypeOf(t1)
if field, ok = type1.FieldByName("int"); !ok {
t.Fatal("no field 'int'")
}
if field.Index[0] != 1 {
t.Error("field index should be 1; is", field.Index)
}
} | explode_data.jsonl/29561 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 114
} | [
2830,
3393,
32684,
8941,
1155,
353,
8840,
836,
8,
341,
2405,
2070,
16139,
1877,
198,
2405,
5394,
1807,
198,
2405,
259,
16,
350,
16,
198,
13158,
16,
1669,
3990,
2124,
1155,
16,
340,
743,
2070,
11,
5394,
284,
943,
16,
17087,
16898,
44... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
func TestBuffer_RejectLeavesBatch(t *testing.T) {
m := Metric()
b := setup(NewBuffer("test", 5))
b.Add(m, m, m)
batch := b.Batch(2)
b.Reject(batch)
require.Equal(t, 3, b.Len())
} | explode_data.jsonl/17684 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 87
} | [
2830,
3393,
4095,
50693,
583,
2304,
4693,
21074,
1155,
353,
8840,
836,
8,
341,
2109,
1669,
52458,
741,
2233,
1669,
6505,
35063,
4095,
445,
1944,
497,
220,
20,
1171,
2233,
1904,
1255,
11,
296,
11,
296,
340,
2233,
754,
1669,
293,
45791,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestPart2(t *testing.T) {
for _, test := range tests2 {
t.Run(test.name, func(*testing.T) {
got := part2(test.input)
if got != test.want {
t.Errorf("got %v, want %v", got, test.want)
}
})
}
} | explode_data.jsonl/29928 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 103
} | [
2830,
3393,
5800,
17,
1155,
353,
8840,
836,
8,
341,
2023,
8358,
1273,
1669,
2088,
7032,
17,
341,
197,
3244,
16708,
8623,
2644,
11,
2915,
4071,
8840,
836,
8,
341,
298,
3174,
354,
1669,
949,
17,
8623,
10046,
340,
298,
743,
2684,
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... | 2 |
func TestInsertAtDot(t *testing.T) {
f := setup(t)
f.SetCodeBuffer(tk.CodeBuffer{Content: "ab", Dot: 1})
evals(f.Evaler, `edit:insert-at-dot XYZ`)
testCodeBuffer(t, f.Editor, tk.CodeBuffer{Content: "aXYZb", Dot: 4})
} | explode_data.jsonl/3300 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 99
} | [
2830,
3393,
13780,
1655,
34207,
1155,
353,
8840,
836,
8,
341,
1166,
1669,
6505,
1155,
692,
1166,
4202,
2078,
4095,
84960,
20274,
4095,
90,
2762,
25,
330,
370,
497,
31262,
25,
220,
16,
3518,
7727,
25596,
955,
5142,
831,
261,
11,
1565,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestGetNodeIP(t *testing.T) {
fKNodes := []struct {
cs *testclient.Clientset
n string
ea string
i bool
}{
// empty node list
{testclient.NewSimpleClientset(), "demo", "", true},
// node not exist
{testclient.NewSimpleClientset(&apiv1.NodeList{Items: []apiv1.Node{{
ObjectMeta: metav1.ObjectMeta{
Name: "demo",
},
Status: apiv1.NodeStatus{
Addresses: []apiv1.NodeAddress{
{
Type: apiv1.NodeInternalIP,
Address: "10.0.0.1",
},
},
},
}}}), "notexistnode", "", true},
// node exist
{testclient.NewSimpleClientset(&apiv1.NodeList{Items: []apiv1.Node{{
ObjectMeta: metav1.ObjectMeta{
Name: "demo",
},
Status: apiv1.NodeStatus{
Addresses: []apiv1.NodeAddress{
{
Type: apiv1.NodeInternalIP,
Address: "10.0.0.1",
},
},
},
}}}), "demo", "10.0.0.1", true},
// search the correct node
{testclient.NewSimpleClientset(&apiv1.NodeList{Items: []apiv1.Node{
{
ObjectMeta: metav1.ObjectMeta{
Name: "demo1",
},
Status: apiv1.NodeStatus{
Addresses: []apiv1.NodeAddress{
{
Type: apiv1.NodeInternalIP,
Address: "10.0.0.1",
},
},
},
},
{
ObjectMeta: metav1.ObjectMeta{
Name: "demo2",
},
Status: apiv1.NodeStatus{
Addresses: []apiv1.NodeAddress{
{
Type: apiv1.NodeInternalIP,
Address: "10.0.0.2",
},
},
},
},
}}), "demo2", "10.0.0.2", true},
// get NodeExternalIP
{testclient.NewSimpleClientset(&apiv1.NodeList{Items: []apiv1.Node{{
ObjectMeta: metav1.ObjectMeta{
Name: "demo",
},
Status: apiv1.NodeStatus{
Addresses: []apiv1.NodeAddress{
{
Type: apiv1.NodeInternalIP,
Address: "10.0.0.1",
}, {
Type: apiv1.NodeExternalIP,
Address: "10.0.0.2",
},
},
},
}}}), "demo", "10.0.0.2", false},
// get NodeInternalIP
{testclient.NewSimpleClientset(&apiv1.NodeList{Items: []apiv1.Node{{
ObjectMeta: metav1.ObjectMeta{
Name: "demo",
},
Status: apiv1.NodeStatus{
Addresses: []apiv1.NodeAddress{
{
Type: apiv1.NodeExternalIP,
Address: "",
}, {
Type: apiv1.NodeInternalIP,
Address: "10.0.0.2",
},
},
},
}}}), "demo", "10.0.0.2", true},
}
for _, fk := range fKNodes {
address := GetNodeIPOrName(fk.cs, fk.n, fk.i)
if address != fk.ea {
t.Errorf("expected %s, but returned %s", fk.ea, address)
}
}
} | explode_data.jsonl/5382 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 1307
} | [
2830,
3393,
1949,
1955,
3298,
1155,
353,
8840,
836,
8,
341,
1166,
42,
12288,
1669,
3056,
1235,
341,
197,
71899,
353,
1944,
2972,
11716,
746,
198,
197,
9038,
220,
914,
198,
197,
7727,
64,
914,
198,
197,
8230,
220,
1807,
198,
197,
594... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestContinueEmpty(t *testing.T) {
src := `<? while (1) { continue; }`
expected := &node.Root{
Position: &position.Position{
StartLine: 1,
EndLine: 1,
StartPos: 3,
EndPos: 26,
},
Stmts: []node.Node{
&stmt.While{
Position: &position.Position{
StartLine: 1,
EndLine: 1,
StartPos: 3,
EndPos: 26,
},
Cond: &scalar.Lnumber{
Position: &position.Position{
StartLine: 1,
EndLine: 1,
StartPos: 10,
EndPos: 11,
},
Value: "1",
},
Stmt: &stmt.StmtList{
Position: &position.Position{
StartLine: 1,
EndLine: 1,
StartPos: 13,
EndPos: 26,
},
Stmts: []node.Node{
&stmt.Continue{
Position: &position.Position{
StartLine: 1,
EndLine: 1,
StartPos: 15,
EndPos: 24,
},
},
},
},
},
},
}
php7parser := php7.NewParser([]byte(src), "7.4")
php7parser.Parse()
actual := php7parser.GetRootNode()
assert.DeepEqual(t, expected, actual)
php5parser := php5.NewParser([]byte(src), "5.6")
php5parser.Parse()
actual = php5parser.GetRootNode()
assert.DeepEqual(t, expected, actual)
} | explode_data.jsonl/63375 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 641
} | [
2830,
3393,
23526,
3522,
1155,
353,
8840,
836,
8,
341,
41144,
1669,
1565,
1316,
1393,
320,
16,
8,
314,
3060,
26,
335,
19324,
42400,
1669,
609,
3509,
45345,
515,
197,
197,
3812,
25,
609,
3487,
21954,
515,
298,
65999,
2460,
25,
220,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestRoaringRangeEnd(t *testing.T) {
r := New()
r.Add(roaring.MaxUint32)
assert.EqualValues(t, 1, r.GetCardinality())
r.RemoveRange(0, roaring.MaxUint32)
assert.EqualValues(t, 1, r.GetCardinality())
r.RemoveRange(0, math.MaxUint64)
assert.EqualValues(t, 0, r.GetCardinality())
r.Add(roaring.MaxUint32)
assert.EqualValues(t, 1, r.GetCardinality())
r.RemoveRange(0, 0x100000001)
assert.EqualValues(t, 0, r.GetCardinality())
r.Add(roaring.MaxUint32)
assert.EqualValues(t, 1, r.GetCardinality())
r.RemoveRange(0, 0x100000000)
assert.EqualValues(t, 0, r.GetCardinality())
} | explode_data.jsonl/20321 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 258
} | [
2830,
3393,
38872,
3249,
6046,
3727,
1155,
353,
8840,
836,
8,
341,
7000,
1669,
1532,
741,
7000,
1904,
78009,
3249,
14535,
21570,
18,
17,
340,
6948,
12808,
6227,
1155,
11,
220,
16,
11,
435,
2234,
5770,
80777,
12367,
7000,
13270,
6046,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestTypeConversion(t *testing.T) {
utc, err := time.LoadLocation("UTC")
if err != nil {
t.Fatal(err)
}
testcases := []struct {
PrestoType string
PrestoResponseUnmarshalledSample interface{}
ExpectedGoValue interface{}
}{
{
PrestoType: "boolean",
PrestoResponseUnmarshalledSample: true,
ExpectedGoValue: true,
},
{
PrestoType: "varchar(1)",
PrestoResponseUnmarshalledSample: "hello",
ExpectedGoValue: "hello",
},
{
PrestoType: "bigint",
PrestoResponseUnmarshalledSample: float64(1),
ExpectedGoValue: int64(1),
},
{
PrestoType: "double",
PrestoResponseUnmarshalledSample: float64(1),
ExpectedGoValue: float64(1),
},
{
PrestoType: "date",
PrestoResponseUnmarshalledSample: "2017-07-10",
ExpectedGoValue: time.Date(2017, 7, 10, 0, 0, 0, 0, utc),
},
{
PrestoType: "time",
PrestoResponseUnmarshalledSample: "01:02:03.000",
ExpectedGoValue: time.Date(0, 1, 1, 1, 2, 3, 0, utc),
},
{
PrestoType: "time with time zone",
PrestoResponseUnmarshalledSample: "01:02:03.000 UTC",
ExpectedGoValue: time.Date(0, 1, 1, 1, 2, 3, 0, utc),
},
{
PrestoType: "timestamp",
PrestoResponseUnmarshalledSample: "2017-07-10 01:02:03.000",
ExpectedGoValue: time.Date(2017, 7, 10, 1, 2, 3, 0, utc),
},
{
PrestoType: "timestamp with time zone",
PrestoResponseUnmarshalledSample: "2017-07-10 01:02:03.000 UTC",
ExpectedGoValue: time.Date(2017, 7, 10, 1, 2, 3, 0, utc),
},
{
PrestoType: "map",
PrestoResponseUnmarshalledSample: nil,
ExpectedGoValue: nil,
},
{
// arrays return data as-is for slice scanners
PrestoType: "array",
PrestoResponseUnmarshalledSample: nil,
ExpectedGoValue: nil,
},
}
for _, tc := range testcases {
converter := newTypeConverter(tc.PrestoType)
t.Run(tc.PrestoType+":nil", func(t *testing.T) {
if _, err := converter.ConvertValue(nil); err != nil {
t.Fatal(err)
}
})
t.Run(tc.PrestoType+":bogus", func(t *testing.T) {
if _, err := converter.ConvertValue(struct{}{}); err == nil {
t.Fatal("bogus data scanned with no error")
}
})
t.Run(tc.PrestoType+":sample", func(t *testing.T) {
v, err := converter.ConvertValue(tc.PrestoResponseUnmarshalledSample)
if err != nil {
t.Fatal(err)
}
if !reflect.DeepEqual(v, tc.ExpectedGoValue) {
t.Fatalf("unexpected data from sample:\nhave %+v\nwant %+v", v, tc.ExpectedGoValue)
}
})
}
} | explode_data.jsonl/62444 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 1590
} | [
2830,
3393,
929,
48237,
1155,
353,
8840,
836,
8,
341,
197,
28355,
11,
1848,
1669,
882,
13969,
4707,
445,
21183,
1138,
743,
1848,
961,
2092,
341,
197,
3244,
26133,
3964,
340,
197,
532,
18185,
23910,
1669,
3056,
1235,
341,
197,
10025,
3... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
func TestUpdateStartTime_UsesEarlierTime(t *testing.T) {
withRepository(func(r *RedisJobRepository) {
leasedJob := addLeasedJob(t, r, "queue1", "cluster1")
startTime := time.Now()
startTimePlusOneHour := time.Now().Add(4 * time.Hour)
jobErrors, err := r.UpdateStartTime([]*JobStartInfo{
{
JobId: leasedJob.Id,
ClusterId: "cluster1",
StartTime: startTime,
},
{
JobId: leasedJob.Id,
ClusterId: "cluster1",
StartTime: startTimePlusOneHour,
},
})
AssertUpdateStartTimeNoErrors(t, jobErrors, err)
runInfos, err := r.GetJobRunInfos([]string{leasedJob.Id})
assert.Nil(t, err)
assert.Equal(t, 1, len(runInfos))
assert.Equal(t, startTime.UTC(), runInfos[leasedJob.Id].StartTime.UTC())
assert.NotEqual(t, startTimePlusOneHour.UTC(), runInfos[leasedJob.Id].StartTime.UTC())
})
} | explode_data.jsonl/32055 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 364
} | [
2830,
3393,
4289,
40203,
62,
68965,
33041,
1462,
1155,
353,
8840,
836,
8,
341,
46948,
4624,
18552,
2601,
353,
48137,
12245,
4624,
8,
341,
197,
197,
4673,
12245,
1669,
912,
2304,
1475,
12245,
1155,
11,
435,
11,
330,
4584,
16,
497,
330,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.