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 TestDataProvenanceSingleFileBundle(t *testing.T) {
f := newFixture(t)
// Dummy up since we are not using ld...
// Note: No bundle 'revision'...
version.Version = "0.10.7"
version.Vcs = "ac23eb45"
version.Timestamp = "today"
version.Hostname = "foo.bar.com"
// No bundle plugin initialized, just a legacy revision set
f.server.legacyRevision = "r1"
req := newReqV1(http.MethodPost, "/data?provenance", "")
f.reset()
f.server.Handler.ServeHTTP(f.recorder, req)
result := types.DataResponseV1{}
if err := util.NewJSONDecoder(f.recorder.Body).Decode(&result); err != nil {
t.Fatalf("Unexpected JSON decode error: %v", err)
}
if result.Provenance == nil {
t.Fatalf("Expected non-nil provenance: %v", result.Provenance)
}
expectedProvenance := &types.ProvenanceV1{
Version: version.Version,
Vcs: version.Vcs,
Timestamp: version.Timestamp,
Hostname: version.Hostname,
}
expectedProvenance.Revision = "r1"
if !reflect.DeepEqual(result.Provenance, expectedProvenance) {
t.Errorf("Unexpected provenance data: \n\n%+v\n\nExpected:\n%+v\n\n", result.Provenance, expectedProvenance)
}
} | explode_data.jsonl/79000 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 441
} | [
2830,
93200,
1336,
1037,
681,
10888,
1703,
8409,
1155,
353,
8840,
836,
8,
1476,
1166,
1669,
501,
18930,
1155,
692,
197,
322,
50567,
705,
2474,
582,
525,
537,
1667,
26129,
9338,
197,
322,
7036,
25,
220,
2308,
12894,
364,
28342,
6,
9338... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestWithMetricsUnmarshalers(t *testing.T) {
unmarshaler := &customMetricsUnmarshaler{}
f := NewFactory(WithMetricsUnmarshalers(unmarshaler))
cfg := createDefaultConfig().(*Config)
// disable contacting broker
cfg.Metadata.Full = false
cfg.ProtocolVersion = "2.0.0"
t.Run("custom_encoding", func(t *testing.T) {
cfg.Encoding = unmarshaler.Encoding()
receiver, err := f.CreateMetricsReceiver(context.Background(), componenttest.NewNopReceiverCreateSettings(), cfg, nil)
require.NoError(t, err)
require.NotNil(t, receiver)
})
t.Run("default_encoding", func(t *testing.T) {
cfg.Encoding = defaultEncoding
receiver, err := f.CreateMetricsReceiver(context.Background(), componenttest.NewNopReceiverCreateSettings(), cfg, nil)
require.NoError(t, err)
assert.NotNil(t, receiver)
})
} | explode_data.jsonl/70858 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 294
} | [
2830,
3393,
2354,
27328,
1806,
27121,
388,
1155,
353,
8840,
836,
8,
341,
20479,
27121,
261,
1669,
609,
9163,
27328,
1806,
27121,
261,
16094,
1166,
1669,
1532,
4153,
7,
2354,
27328,
1806,
27121,
388,
18364,
27121,
261,
1171,
50286,
1669,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestRemittanceOriginatorCountryOfResidenceAlphaNumeric(t *testing.T) {
ro := mockRemittanceOriginator()
ro.RemittanceData.CountryOfResidence = "®"
err := ro.Validate()
require.EqualError(t, err, fieldError("CountryOfResidence", ErrNonAlphanumeric, ro.RemittanceData.CountryOfResidence).Error())
} | explode_data.jsonl/32939 | {
"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,
6590,
87191,
13298,
850,
16408,
2124,
1061,
7087,
19384,
36296,
1155,
353,
8840,
836,
8,
341,
197,
299,
1669,
7860,
6590,
87191,
13298,
850,
741,
197,
299,
11398,
87191,
1043,
62413,
2124,
1061,
7087,
284,
330,
11909,
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... | 1 |
func TestMaxLineLengthValidSpec(t *testing.T) {
ctx := context.TODO()
for _, f := range []string{"a", "b"} {
for _, err := range eclint.Lint(ctx, fmt.Sprintf("./testdata/max_line_length/%s", f)) {
if err != nil {
t.Fatalf("no errors where expected, got %s", err)
}
}
}
} | explode_data.jsonl/82394 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 126
} | [
2830,
3393,
5974,
2460,
4373,
4088,
8327,
1155,
353,
8840,
836,
8,
341,
20985,
1669,
2266,
90988,
2822,
2023,
8358,
282,
1669,
2088,
3056,
917,
4913,
64,
497,
330,
65,
9207,
341,
197,
2023,
8358,
1848,
1669,
2088,
59958,
396,
1214,
39... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 4 |
func TestGetMachineReadableFormat(t *testing.T) {
type args struct {
// client *occlient.Client
appName string
projectName string
active bool
}
tests := []struct {
name string
args args
want App
}{
{
name: "Test Case: machine readable output for application",
args: args{
appName: "myapp",
projectName: "myproject",
active: true,
},
want: App{
TypeMeta: metav1.TypeMeta{
Kind: appKind,
APIVersion: appAPIVersion,
},
ObjectMeta: metav1.ObjectMeta{
Name: "myapp",
Namespace: "myproject",
},
Spec: AppSpec{
Components: []string{"frontend"},
},
},
},
}
dcList := appsv1.DeploymentConfigList{
Items: []appsv1.DeploymentConfig{
{
ObjectMeta: metav1.ObjectMeta{
Name: "frontend-myapp",
Namespace: "myproject",
Labels: map[string]string{
applabels.ApplicationLabel: "myapp",
componentlabels.ComponentLabel: "frontend",
componentlabels.ComponentTypeLabel: "nodejs",
},
Annotations: map[string]string{
component.ComponentSourceTypeAnnotation: "local",
},
},
Spec: appsv1.DeploymentConfigSpec{
Template: &corev1.PodTemplateSpec{
Spec: corev1.PodSpec{
Containers: []corev1.Container{
{
Name: "dummyContainer",
},
},
},
},
},
},
{
ObjectMeta: metav1.ObjectMeta{
Name: "backend-app",
Namespace: "myproject",
Labels: map[string]string{
applabels.ApplicationLabel: "app",
componentlabels.ComponentLabel: "backend",
componentlabels.ComponentTypeLabel: "java",
},
Annotations: map[string]string{
component.ComponentSourceTypeAnnotation: "local",
},
},
Spec: appsv1.DeploymentConfigSpec{
Template: &corev1.PodTemplateSpec{
Spec: corev1.PodSpec{
Containers: []corev1.Container{
{
Name: "dummyContainer",
},
},
},
},
},
},
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
// Fake the client with the appropriate arguments
client, fakeClientSet := occlient.FakeNew()
//fake the dcs
fakeClientSet.AppsClientset.PrependReactor("list", "deploymentconfigs", func(action ktesting.Action) (bool, runtime.Object, error) {
return true, &dcList, nil
})
for i := range dcList.Items {
fakeClientSet.AppsClientset.PrependReactor("get", "deploymentconfigs", func(action ktesting.Action) (bool, runtime.Object, error) {
return true, &dcList.Items[i], nil
})
}
if got := GetMachineReadableFormat(client, tt.args.appName, tt.args.projectName); !reflect.DeepEqual(got, tt.want) {
t.Errorf("GetMachineReadableFormat() = %v,\n want %v", got, tt.want)
}
})
}
} | explode_data.jsonl/72393 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 1319
} | [
2830,
3393,
1949,
21605,
57938,
4061,
1155,
353,
8840,
836,
8,
341,
13158,
2827,
2036,
341,
197,
197,
322,
2943,
414,
353,
509,
2972,
11716,
198,
197,
28236,
675,
257,
914,
198,
197,
72470,
675,
914,
198,
197,
74770,
414,
1807,
198,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func Test_Hoverfly_SetMiddleware_CanSetRemote(t *testing.T) {
RegisterTestingT(t)
unit := NewHoverflyWithConfiguration(&Configuration{})
muxRouter := mux.NewRouter()
muxRouter.HandleFunc("/process", processHandlerOkay).Methods("POST")
server := httptest.NewServer(muxRouter)
defer server.Close()
err := unit.SetMiddleware("", "", server.URL+"/process")
Expect(err).To(BeNil())
Expect(unit.Cfg.Middleware.Binary).To(Equal(""))
script, _ := unit.Cfg.Middleware.GetScript()
Expect(script).To(Equal(""))
Expect(unit.Cfg.Middleware.Remote).To(Equal(server.URL + "/process"))
} | explode_data.jsonl/45386 | {
"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,
2039,
1975,
21642,
14812,
24684,
920,
276,
1649,
24703,
1155,
353,
8840,
836,
8,
341,
79096,
16451,
51,
1155,
692,
81189,
1669,
1532,
34379,
21642,
2354,
7688,
2099,
7688,
6257,
692,
2109,
2200,
9523,
1669,
59807,
7121,
9523,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestParseDefaultConfigEnv(t *testing.T) {
mount, err := CreateMount()
require.NoError(t, err)
require.NotNil(t, mount)
defer func() { assert.NoError(t, mount.Release()) }()
origVal, err := mount.GetConfigOption("log_file")
assert.NoError(t, err)
err = os.Setenv("CEPH_ARGS", "--log_file /dev/null")
assert.NoError(t, err)
err = mount.ParseDefaultConfigEnv()
assert.NoError(t, err)
currVal, err := mount.GetConfigOption("log_file")
assert.NoError(t, err)
assert.Equal(t, "/dev/null", currVal)
assert.NotEqual(t, "/dev/null", origVal)
} | explode_data.jsonl/29517 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 223
} | [
2830,
3393,
14463,
3675,
2648,
14359,
1155,
353,
8840,
836,
8,
341,
2109,
629,
11,
1848,
1669,
4230,
16284,
741,
17957,
35699,
1155,
11,
1848,
340,
17957,
93882,
1155,
11,
6470,
340,
16867,
2915,
368,
314,
2060,
35699,
1155,
11,
6470,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestHelmManifestFromChartRepo(t *testing.T) {
service := newService(".")
source := &argoappv1.ApplicationSource{Chart: "my-chart", TargetRevision: ">= 1.0.0"}
request := &apiclient.ManifestRequest{Repo: &argoappv1.Repository{}, ApplicationSource: source, NoCache: true}
response, err := service.GenerateManifest(context.Background(), request)
assert.NoError(t, err)
assert.NotNil(t, response)
assert.Equal(t, &apiclient.ManifestResponse{
Manifests: []string{"{\"apiVersion\":\"v1\",\"kind\":\"ConfigMap\",\"metadata\":{\"name\":\"my-map\"}}"},
Namespace: "",
Server: "",
Revision: "1.1.0",
SourceType: "Helm",
}, response)
} | explode_data.jsonl/5663 | {
"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,
39,
23162,
38495,
3830,
14488,
25243,
1155,
353,
8840,
836,
8,
341,
52934,
1669,
501,
1860,
5680,
1138,
47418,
1669,
609,
12088,
676,
85,
16,
17521,
3608,
90,
14488,
25,
330,
2408,
44627,
497,
13483,
33602,
25,
330,
9922,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestLogsExporter_Default(t *testing.T) {
ld := pdata.NewLogs()
le, err := NewLogsExporter(&fakeLogsExporterConfig, componenttest.NewNopExporterCreateSettings(), newPushLogsData(nil))
assert.NotNil(t, le)
assert.NoError(t, err)
assert.Equal(t, consumer.Capabilities{MutatesData: false}, le.Capabilities())
assert.NoError(t, le.Start(context.Background(), componenttest.NewNopHost()))
assert.NoError(t, le.ConsumeLogs(context.Background(), ld))
assert.NoError(t, le.Shutdown(context.Background()))
} | explode_data.jsonl/59604 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 183
} | [
2830,
3393,
51053,
88025,
60336,
1155,
353,
8840,
836,
8,
341,
197,
507,
1669,
70311,
7121,
51053,
741,
197,
273,
11,
1848,
1669,
1532,
51053,
88025,
2099,
30570,
51053,
88025,
2648,
11,
3692,
1944,
7121,
45,
453,
88025,
4021,
6086,
150... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestCrMergedRenameIntoNewDir(t *testing.T) {
test(t,
users("alice", "bob"),
as(alice,
mkfile("a/b", "hello"),
),
as(bob,
disableUpdates(),
),
as(alice,
rename("a/b", "d/e"),
),
as(bob, noSync(),
write("a/c", "world"),
reenableUpdates(),
lsdir("a/", m{"c": "FILE"}),
lsdir("d/", m{"e": "FILE"}),
read("a/c", "world"),
read("d/e", "hello"),
),
as(alice,
lsdir("a/", m{"c": "FILE"}),
lsdir("d/", m{"e": "FILE"}),
read("a/c", "world"),
read("d/e", "hello"),
),
)
} | explode_data.jsonl/31355 | {
"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,
16001,
44,
51525,
88757,
26591,
3564,
6184,
1155,
353,
8840,
836,
8,
341,
18185,
1155,
345,
197,
90896,
445,
63195,
497,
330,
47086,
4461,
197,
60451,
17643,
558,
345,
298,
2109,
74,
1192,
445,
64,
3470,
497,
330,
14990,
4... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestTx_DeleteBucket_ErrTxClosed(t *testing.T) {
db := MustOpenDB()
defer db.MustClose()
tx, err := db.Begin(true)
if err != nil {
t.Fatal(err)
}
if err := tx.Commit(); err != nil {
t.Fatal(err)
}
if err := tx.DeleteBucket([]byte("foo")); err != bolt.ErrTxClosed {
t.Fatalf("unexpected error: %s", err)
}
} | explode_data.jsonl/1695 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 146
} | [
2830,
3393,
31584,
57418,
36018,
93623,
51,
12125,
9259,
1155,
353,
8840,
836,
8,
341,
20939,
1669,
15465,
5002,
3506,
741,
16867,
2927,
50463,
7925,
741,
46237,
11,
1848,
1669,
2927,
28467,
3715,
340,
743,
1848,
961,
2092,
341,
197,
32... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestGetSourceMount(t *testing.T) {
// must be able to find source mount for /
mnt, _, err := getSourceMount("/")
assert.NilError(t, err)
assert.Equal(t, mnt, "/")
// must be able to find source mount for current directory
cwd, err := os.Getwd()
assert.NilError(t, err)
_, _, err = getSourceMount(cwd)
assert.NilError(t, err)
} | explode_data.jsonl/51546 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 132
} | [
2830,
3393,
1949,
3608,
16284,
1155,
353,
8840,
836,
8,
341,
197,
322,
1969,
387,
2952,
311,
1477,
2530,
6470,
369,
38981,
2109,
406,
11,
8358,
1848,
1669,
71003,
16284,
61710,
6948,
59678,
1454,
1155,
11,
1848,
340,
6948,
12808,
1155,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestPolicy_Set(t *testing.T) {
type args struct {
directive string
sources []string
}
tests := []struct {
name string
p *Policy
args args
}{
// TODO: Add test cases.
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
tt.p.Set(tt.args.directive, tt.args.sources)
})
}
} | explode_data.jsonl/10345 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 145
} | [
2830,
3393,
13825,
14812,
1155,
353,
8840,
836,
8,
341,
13158,
2827,
2036,
341,
197,
2698,
1226,
533,
914,
198,
197,
1903,
2360,
256,
3056,
917,
198,
197,
532,
78216,
1669,
3056,
1235,
341,
197,
11609,
914,
198,
197,
3223,
262,
353,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestMultiModule_OneBrokenModule(t *testing.T) {
testenv.NeedsGo1Point(t, 15)
const mod = `
-- a/go.mod --
module a.com
go 1.12
-- a/main.go --
package main
-- b/go.mod --
module b.com
go 1.12
require (
example.com v1.2.3
)
-- b/go.sum --
-- b/main.go --
package b
import "example.com/blah"
func main() {
blah.Hello()
}
`
WithOptions(
ProxyFiles(workspaceProxy),
Modes(Experimental),
).Run(t, mod, func(t *testing.T, env *Env) {
params := &protocol.PublishDiagnosticsParams{}
env.OpenFile("b/go.mod")
env.Await(
OnceMet(
env.GoSumDiagnostic("b/go.mod", `example.com v1.2.3`),
ReadDiagnostics("b/go.mod", params),
),
)
for _, d := range params.Diagnostics {
if !strings.Contains(d.Message, "go.sum is out of sync") {
continue
}
actions := env.GetQuickFixes("b/go.mod", []protocol.Diagnostic{d})
if len(actions) != 2 {
t.Fatalf("expected 2 code actions, got %v", len(actions))
}
env.ApplyQuickFixes("b/go.mod", []protocol.Diagnostic{d})
}
env.Await(
EmptyDiagnostics("b/go.mod"),
)
})
} | explode_data.jsonl/37375 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 486
} | [
2830,
3393,
20358,
3332,
68201,
90526,
3332,
1155,
353,
8840,
836,
8,
341,
18185,
3160,
2067,
68,
6767,
10850,
16,
2609,
1155,
11,
220,
16,
20,
692,
4777,
1463,
284,
22074,
313,
264,
25525,
10929,
39514,
4352,
264,
905,
271,
3346,
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... | 4 |
func TestReviewHandler_CheckReviewRights(t *testing.T) {
productId := uint64(4)
sess := models.Session{
Value: "fdsfdsfdsf",
UserData: models.UserId{
Id: 3,
},
}
t.Run("CheckReviewRights_success", func(t *testing.T) {
ctrl := gomock.NewController(t)
defer ctrl.Finish()
reviewUCase := mock.NewMockUseCase(ctrl)
reviewUCase.
EXPECT().
CheckReviewUserRights(gomock.Any(), productId).
Return(nil)
reviewHandler := NewHandler(reviewUCase)
ctx := context.WithValue(context.Background(), models.RequireIdKey, shortuuid.New())
cctx := context.WithValue(ctx, models.SessionContextKey, &sess)
req, _ := http.NewRequestWithContext(cctx, "GET", "/api/v1/review/rights/product/{id:[0-9]+}",
bytes.NewBuffer(nil))
vars := map[string]string{
"id": fmt.Sprintf("%d", productId),
}
req = mux.SetURLVars(req, vars)
rr := httptest.NewRecorder()
handler := http.HandlerFunc(reviewHandler.CheckReviewRights)
handler.ServeHTTP(rr, req)
assert.Equal(t, rr.Code, http.StatusOK, "incorrect http code")
})
t.Run("CheckReviewRights_bad_body", func(t *testing.T) {
ctrl := gomock.NewController(t)
defer ctrl.Finish()
productUCase := mock.NewMockUseCase(ctrl)
productHandler := NewHandler(productUCase)
ctx := context.WithValue(context.Background(), models.RequireIdKey, shortuuid.New())
cctx := context.WithValue(ctx, models.SessionContextKey, &sess)
req, _ := http.NewRequestWithContext(cctx, "POST", "/api/v1/review/rights/product/{id:[0-9]+}",
bytes.NewBuffer(nil))
rr := httptest.NewRecorder()
handler := http.HandlerFunc(productHandler.CheckReviewRights)
handler.ServeHTTP(rr, req)
assert.Equal(t, rr.Code, http.StatusBadRequest, "incorrect http code")
})
t.Run("CheckReviewRights_internal_error", func(t *testing.T) {
ctrl := gomock.NewController(t)
defer ctrl.Finish()
reviewUCase := mock.NewMockUseCase(ctrl)
reviewUCase.
EXPECT().
CheckReviewUserRights(gomock.Any(), productId).
Return(errors.ErrInternalError)
reviewHandler := NewHandler(reviewUCase)
ctx := context.WithValue(context.Background(), models.RequireIdKey, shortuuid.New())
cctx := context.WithValue(ctx, models.SessionContextKey, &sess)
req, _ := http.NewRequestWithContext(cctx, "GET", "/api/v1/review/rights/product/{id:[0-9]+}",
bytes.NewBuffer(nil))
vars := map[string]string{
"id": fmt.Sprintf("%d", productId),
}
req = mux.SetURLVars(req, vars)
rr := httptest.NewRecorder()
handler := http.HandlerFunc(reviewHandler.CheckReviewRights)
handler.ServeHTTP(rr, req)
assert.Equal(t, rr.Code, http.StatusConflict, "incorrect http code")
})
} | explode_data.jsonl/71561 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 1029
} | [
2830,
3393,
19432,
3050,
28188,
19432,
81875,
1155,
353,
8840,
836,
8,
341,
197,
46166,
1669,
2622,
21,
19,
7,
19,
340,
1903,
433,
1669,
4119,
20674,
515,
197,
47399,
25,
330,
64834,
64834,
64834,
69,
756,
197,
31672,
1043,
25,
4119,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestMakeDir(t *testing.T) {
//Successfully create directory
err := makeDir(targetTest)
assert.NoError(t, err)
//Failed case
err = makeDir("./azure.go")
var e *os.PathError
if !errors.As(err, &e) {
t.Errorf("Unexpected Error: %v", err)
}
// Remove the directory created
err = os.RemoveAll(targetTest)
assert.NoError(t, err)
} | explode_data.jsonl/36857 | {
"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,
8078,
6184,
1155,
353,
8840,
836,
8,
341,
197,
322,
35959,
1855,
6220,
198,
9859,
1669,
1281,
6184,
8637,
2271,
340,
6948,
35699,
1155,
11,
1848,
692,
197,
322,
9408,
1142,
198,
9859,
284,
1281,
6184,
13988,
39495,
18002,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestChannelMemberJson(t *testing.T) {
o := ChannelMember{ChannelId: NewId(), UserId: NewId()}
json := o.ToJson()
ro := ChannelMemberFromJson(strings.NewReader(json))
require.Equal(t, o.ChannelId, ro.ChannelId, "ids do not match")
} | explode_data.jsonl/80897 | {
"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,
9629,
9366,
5014,
1155,
353,
8840,
836,
8,
341,
22229,
1669,
13434,
9366,
90,
9629,
764,
25,
1532,
764,
1507,
40883,
25,
1532,
764,
23509,
30847,
1669,
297,
3274,
5014,
741,
197,
299,
1669,
13434,
9366,
3830,
5014,
51442,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestForm_Extended_Append(t *testing.T) {
form := &extendedForm{}
form.ExtendBaseWidget(form)
form.Items = []*FormItem{{Text: "test1", Widget: NewEntry()}}
assert.Equal(t, 1, len(form.Items))
form.Append("test2", NewEntry())
assert.True(t, len(form.Items) == 2)
item := &FormItem{Text: "test3", Widget: NewEntry()}
form.AppendItem(item)
assert.True(t, len(form.Items) == 3)
assert.Equal(t, item, form.Items[2])
} | explode_data.jsonl/8945 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 176
} | [
2830,
3393,
1838,
62,
53190,
36117,
408,
1155,
353,
8840,
836,
8,
341,
37410,
1669,
609,
41098,
1838,
16094,
37410,
16146,
408,
3978,
4548,
16760,
340,
37410,
12054,
284,
29838,
57559,
2979,
1178,
25,
330,
1944,
16,
497,
12980,
25,
1532... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestUnstructuredHash(t *testing.T) {
cases := []struct {
desc string
unstructured string
hash string
err string
}{
{"minimal", `
apiVersion: test/v1
kind: TestResource
metadata:
name: my-resource`, "244782mkb7", ""},
{"with spec", `
apiVersion: test/v1
kind: TestResource
metadata:
name: my-resource
spec:
foo: 1
bar: abc`, "59m2mdccg4", ""},
}
for _, c := range cases {
node, err := yaml.Parse(c.unstructured)
if err != nil {
t.Fatal(err)
}
h, err := HashRNode(node)
if SkipRest(t, c.desc, err, c.err) {
continue
}
if c.hash != h {
t.Errorf("case %q, expect hash %q but got %q", c.desc, c.hash, h)
}
}
} | explode_data.jsonl/32278 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 318
} | [
2830,
3393,
1806,
51143,
6370,
1155,
353,
8840,
836,
8,
341,
1444,
2264,
1669,
3056,
1235,
341,
197,
41653,
260,
914,
198,
197,
20479,
51143,
914,
198,
197,
50333,
260,
914,
198,
197,
9859,
688,
914,
198,
197,
59403,
197,
197,
4913,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestPlayerRecentlyPlayed(t *testing.T) {
client, server := testClientFile(http.StatusOK, "test_data/player_recently_played.txt")
defer server.Close()
items, err := client.PlayerRecentlyPlayed()
if err != nil {
t.Fatal(err)
}
if len(items) != 20 {
t.Error("Too few or too many items were returned")
}
actualTimePhrase := items[0].PlayedAt.Format("2006-01-02T15:04:05.999Z")
expectedTimePhrase := "2017-05-27T20:07:54.721Z"
if actualTimePhrase != expectedTimePhrase {
t.Errorf("Time of first track was not parsed correctly: [%s] != [%s]", actualTimePhrase, expectedTimePhrase)
}
} | explode_data.jsonl/80127 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 224
} | [
2830,
3393,
4476,
45137,
85930,
1155,
353,
8840,
836,
8,
341,
25291,
11,
3538,
1669,
1273,
2959,
1703,
19886,
52989,
11,
330,
1944,
1769,
59503,
62361,
398,
22144,
291,
3909,
1138,
16867,
3538,
10421,
2822,
46413,
11,
1848,
1669,
2943,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 4 |
func TestApp_ParseSliceFlags(t *testing.T) {
var parsedOption, firstArg string
var parsedIntSlice []int
var parsedStringSlice []string
app := &App{
Commands: []*Command{
{
Name: "cmd",
Flags: []Flag{
&IntSliceFlag{Name: "p", Value: NewIntSlice(), Usage: "set one or more ip addr"},
&StringSliceFlag{Name: "ip", Value: NewStringSlice(), Usage: "set one or more ports to open"},
},
Action: func(c *Context) error {
parsedIntSlice = c.IntSlice("p")
parsedStringSlice = c.StringSlice("ip")
parsedOption = c.String("option")
firstArg = c.Args().First()
return nil
},
},
},
}
app.Run([]string{"", "cmd", "-p", "22", "-p", "80", "-ip", "8.8.8.8", "-ip", "8.8.4.4", "my-arg"})
IntsEquals := func(a, b []int) bool {
if len(a) != len(b) {
return false
}
for i, v := range a {
if v != b[i] {
return false
}
}
return true
}
StrsEquals := func(a, b []string) bool {
if len(a) != len(b) {
return false
}
for i, v := range a {
if v != b[i] {
return false
}
}
return true
}
var expectedIntSlice = []int{22, 80}
var expectedStringSlice = []string{"8.8.8.8", "8.8.4.4"}
if !IntsEquals(parsedIntSlice, expectedIntSlice) {
t.Errorf("%v does not match %v", parsedIntSlice, expectedIntSlice)
}
if !StrsEquals(parsedStringSlice, expectedStringSlice) {
t.Errorf("%v does not match %v", parsedStringSlice, expectedStringSlice)
}
} | explode_data.jsonl/52572 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 654
} | [
2830,
3393,
2164,
77337,
33236,
9195,
1155,
353,
8840,
836,
8,
341,
2405,
15676,
5341,
11,
1156,
2735,
914,
198,
2405,
15676,
1072,
33236,
3056,
396,
198,
2405,
15676,
703,
33236,
3056,
917,
271,
28236,
1669,
609,
2164,
515,
197,
197,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestIsLoggingTerminalError(t *testing.T) {
terminalErrs := []error{
errors.New("docker returned: configured logging driver does not support reading"),
&docker.Error{
Status: 501,
Message: "configured logging driver does not support reading",
},
&docker.Error{
Status: 501,
Message: "not implemented",
},
}
for _, err := range terminalErrs {
require.Truef(t, isLoggingTerminalError(err), "error should be terminal: %v", err)
}
nonTerminalErrs := []error{
errors.New("not expected"),
&docker.Error{
Status: 503,
Message: "Service Unavailable",
},
}
for _, err := range nonTerminalErrs {
require.Falsef(t, isLoggingTerminalError(err), "error should be terminal: %v", err)
}
} | explode_data.jsonl/76336 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 265
} | [
2830,
3393,
3872,
34575,
47890,
1454,
1155,
353,
8840,
836,
8,
341,
197,
36327,
7747,
82,
1669,
3056,
841,
515,
197,
73424,
7121,
445,
28648,
5927,
25,
19755,
8392,
5579,
1558,
537,
1824,
5290,
4461,
197,
197,
5,
28648,
6141,
515,
298... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
func TestAccAWSDataSourceIAMServerCertificate_matchNamePrefix(t *testing.T) {
resource.ParallelTest(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
CheckDestroy: testAccCheckIAMServerCertificateDestroy,
Steps: []resource.TestStep{
{
Config: testAccAwsDataIAMServerCertConfigMatchNamePrefix,
ExpectError: regexp.MustCompile(`Search for AWS IAM server certificate returned no results`),
},
},
})
} | explode_data.jsonl/6773 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 178
} | [
2830,
3393,
14603,
36136,
17173,
73707,
5475,
33202,
10708,
675,
14335,
1155,
353,
8840,
836,
8,
341,
50346,
41288,
7957,
2271,
1155,
11,
5101,
31363,
515,
197,
197,
4703,
3973,
25,
257,
2915,
368,
314,
1273,
14603,
4703,
3973,
1155,
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 TestName_mangle(t *testing.T) {
tables := []struct{
input string
expect Expected
}{
{
"FILE",
Expected{ s: "FILE", e: nil },
},
{
"--counter",
Expected{ s: "counter", e: nil },
},
{
"--counter-strike",
Expected{ s: "counter_strike", e: nil },
},
{
"--",
Expected{ s: "", e: errors.New("fail"), },
},
{
"<key_word>",
Expected{ s: "key_word", e: nil },
},
{
"<key-word>",
Expected{ s: "key_word", e: nil },
},
{
"-A",
Expected{ s: "A", e: nil },
},
{
"-9",
Expected{ s: "", e: errors.New("fail") },
},
}
d := &Docopts{
Global_prefix: "",
Mangle_key: true,
}
for _, table := range tables {
res, err := d.Name_mangle(table.input)
if table.expect.e != nil && err == nil {
t.Errorf("Name_mangle for '%v'\ngot: '%v'\nwant: '%v'\n", table.input, err, table.expect.e)
}
if res != table.expect.s {
t.Errorf("Name_mangle for '%v'\ngot: '%v'\nwant: '%v'\n", table.input, res, table.expect.s)
}
}
} | explode_data.jsonl/35251 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 753
} | [
2830,
3393,
675,
717,
4044,
1155,
353,
8840,
836,
8,
341,
262,
12632,
1669,
3056,
1235,
515,
286,
1946,
914,
198,
286,
1720,
31021,
198,
262,
335,
515,
286,
341,
260,
330,
6041,
756,
260,
31021,
90,
274,
25,
330,
6041,
497,
384,
2... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 5 |
func TestChecksOfSameTypeOnSameFileGroupedTogether(t *testing.T) {
scanInstruction := testconfigcreator.NewFileScanInstruction([]*ipb.FileCheck{
&ipb.FileCheck{
FilesToCheck: []*ipb.FileSet{testconfigcreator.SingleFileWithPath("/path")},
CheckType: &ipb.FileCheck_Existence{Existence: &ipb.ExistenceCheck{ShouldExist: true}},
},
})
config1 := testconfigcreator.NewBenchmarkConfig(t, "id1", scanInstruction)
config2 := testconfigcreator.NewBenchmarkConfig(t, "id2", scanInstruction)
checks, err := configchecks.CreateChecksFromConfig(
context.Background(),
&apb.ScanConfig{
BenchmarkConfigs: []*apb.BenchmarkConfig{config1, config2},
},
&fakeAPI{fileContent: testFileContent},
)
if err != nil {
t.Fatalf("configchecks.CreateChecksFromConfig([%v %v]) returned an error: %v", config1, config2, err)
}
if len(checks) != 1 {
t.Fatalf("Expected 1 check to be created, got %d", len(checks))
}
expectedIDs := []string{"id1", "id2"}
actualIDs := checks[0].BenchmarkIDs()
sort.Strings(actualIDs)
if diff := cmp.Diff(expectedIDs, actualIDs); diff != "" {
t.Errorf("%v.BenchmarkIDs() returned unexpected diff (-want +got):\n%s", checks[0], diff)
}
} | explode_data.jsonl/24459 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 435
} | [
2830,
3393,
49820,
2124,
19198,
929,
1925,
19198,
1703,
2808,
291,
80987,
1155,
353,
8840,
836,
8,
341,
1903,
4814,
16664,
1669,
1273,
1676,
32398,
7121,
1703,
26570,
16664,
85288,
573,
65,
8576,
3973,
515,
197,
197,
5,
573,
65,
8576,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestServerStartClock(t *testing.T) {
defer leaktest.AfterTest(t)()
// Set a high max-offset so that, if the server's clock is pushed by
// MaxOffset, we don't hide that under the latency of the Start operation
// which would allow the physical clock to catch up to the pushed one.
params := base.TestServerArgs{
Knobs: base.TestingKnobs{
Store: &storage.StoreTestingKnobs{
MaxOffset: time.Second,
},
},
}
s, _, _ := serverutils.StartServer(t, params)
defer s.Stopper().Stop(context.TODO())
// Run a command so that we are sure to touch the timestamp cache. This is
// actually not needed because other commands run during server
// initialization, but we cannot guarantee that's going to stay that way.
get := &roachpb.GetRequest{
RequestHeader: roachpb.RequestHeader{Key: roachpb.Key("a")},
}
if _, err := client.SendWrapped(
context.Background(), s.DB().NonTransactionalSender(), get,
); err != nil {
t.Fatal(err)
}
now := s.Clock().Now()
physicalNow := s.Clock().PhysicalNow()
serverClockWasPushed := now.WallTime > physicalNow
if serverClockWasPushed {
t.Fatalf("time: server %s vs actual %d", now, physicalNow)
}
} | explode_data.jsonl/70827 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 390
} | [
2830,
3393,
5475,
3479,
26104,
1155,
353,
8840,
836,
8,
341,
16867,
23352,
1944,
36892,
2271,
1155,
8,
2822,
197,
322,
2573,
264,
1550,
1932,
23761,
773,
429,
11,
421,
279,
3538,
594,
8866,
374,
15391,
553,
198,
197,
322,
7487,
6446,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestQualifiedNameString(t *testing.T) {
testCases := []struct {
in, out string
}{
{"*", "*"},
// Keyword.
{"DATABASE", `"DATABASE"`},
{"dAtAbAse", `"dAtAbAse"`},
// Ident format: starts with [a-zA-Z_] or extended ascii,
// and is then followed by [a-zA-Z0-9$_] or extended ascii.
{"foo$09", "foo$09"},
{"_Ab10", "_Ab10"},
// Everything else quotes the string and escapes double quotes.
{".foobar", `".foobar"`},
{`".foobar"`, `""".foobar"""`},
{`\".foobar\"`, `"\"".foobar\"""`},
}
for _, tc := range testCases {
q := QualifiedName{tc.in}
if q.String() != tc.out {
t.Errorf("expected q.String() == %q, got %q", tc.out, q.String())
}
}
} | explode_data.jsonl/47775 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 312
} | [
2830,
3393,
92251,
703,
1155,
353,
8840,
836,
8,
341,
18185,
37302,
1669,
3056,
1235,
341,
197,
17430,
11,
700,
914,
198,
197,
59403,
197,
197,
4913,
78729,
15630,
7115,
197,
197,
322,
48970,
624,
197,
197,
4913,
46499,
497,
53305,
46... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
func TestFailGracefullyUnknownEntryType(t *testing.T) {
err := add("test", []string{})
if err.Error() != "unknown entry type" {
t.Errorf(`err.Error() = %q, want "unknown entry type"`, err.Error())
}
} | explode_data.jsonl/25080 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 76
} | [
2830,
3393,
19524,
86543,
3641,
13790,
5874,
929,
1155,
353,
8840,
836,
8,
341,
9859,
1669,
912,
445,
1944,
497,
3056,
917,
37790,
743,
1848,
6141,
368,
961,
330,
16088,
4343,
943,
1,
341,
197,
3244,
13080,
5809,
615,
6141,
368,
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
] | 2 |
func TestAllTemplates(t *testing.T) {
ch1 := &chart.Chart{
Metadata: &chart.Metadata{Name: "ch1"},
Templates: []*chart.File{
{Name: "templates/foo", Data: []byte("foo")},
{Name: "templates/bar", Data: []byte("bar")},
},
}
dep1 := &chart.Chart{
Metadata: &chart.Metadata{Name: "laboratory mice"},
Templates: []*chart.File{
{Name: "templates/pinky", Data: []byte("pinky")},
{Name: "templates/brain", Data: []byte("brain")},
},
}
ch1.AddDependency(dep1)
dep2 := &chart.Chart{
Metadata: &chart.Metadata{Name: "same thing we do every night"},
Templates: []*chart.File{
{Name: "templates/innermost", Data: []byte("innermost")},
},
}
dep1.AddDependency(dep2)
tpls := allTemplates(ch1, chartutil.Values{})
if len(tpls) != 5 {
t.Errorf("Expected 5 charts, got %d", len(tpls))
}
} | explode_data.jsonl/74704 | {
"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,
2403,
51195,
1155,
353,
8840,
836,
8,
341,
23049,
16,
1669,
609,
15941,
42667,
515,
197,
9209,
7603,
25,
609,
15941,
46475,
63121,
25,
330,
331,
16,
7115,
197,
10261,
76793,
25,
29838,
15941,
8576,
515,
298,
197,
63121,
25... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
func TestProcessMetrics(t *testing.T) {
// Reset hostname cache
cache.Cache.Flush()
cfg := &config.Config{
// Global tags should be ignored and sent as metadata
TagsConfig: config.TagsConfig{
Env: "test_env",
Tags: []string{"key:val"},
},
}
cfg.Sanitize(zap.NewNop())
ms := []datadog.Metric{
NewGauge(
"metric_name",
0,
0,
[]string{"key2:val2"},
),
NewGauge(
"system.cpu.time",
0,
0,
[]string{"key3:val3"},
),
}
ProcessMetrics(ms, cfg)
assert.Equal(t, "metric_name", *ms[0].Metric)
assert.ElementsMatch(t,
[]string{"key2:val2"},
ms[0].Tags,
)
assert.Equal(t, "otel.system.cpu.time", *ms[1].Metric)
assert.ElementsMatch(t,
[]string{"key3:val3"},
ms[1].Tags,
)
} | explode_data.jsonl/46798 | {
"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,
7423,
27328,
1155,
353,
8840,
836,
8,
341,
197,
322,
16932,
28115,
6500,
198,
52680,
46130,
61559,
2822,
50286,
1669,
609,
1676,
10753,
515,
197,
197,
322,
7962,
9492,
1265,
387,
12036,
323,
3208,
438,
11160,
198,
197,
10261... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestWorkflowRemoveTaskTemplate(t *testing.T) {
workflow := &Workflow{
TaskTemplates: []TaskTemplate{
TaskTemplate{
TaskName: "First",
Initial: true,
},
TaskTemplate{
TaskName: "Second",
Initial: false,
},
TaskTemplate{
TaskName: "Third",
Initial: false,
},
},
}
err := workflow.RemoveTaskTemplate("Second")
assert.Nil(t, err)
assert.Equal(t, 2, len(workflow.TaskTemplates))
assert.Equal(t, "First", workflow.TaskTemplates[0].TaskName)
assert.Equal(t, "Third", workflow.TaskTemplates[1].TaskName)
err = workflow.RemoveTaskTemplate("Fourth")
assert.NotNil(t, err)
} | explode_data.jsonl/19599 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 256
} | [
2830,
3393,
62768,
13021,
6262,
7275,
1155,
353,
8840,
836,
8,
341,
197,
56249,
1669,
609,
62768,
515,
197,
81153,
51195,
25,
3056,
6262,
7275,
515,
298,
81153,
7275,
515,
571,
81153,
675,
25,
330,
5338,
756,
571,
197,
6341,
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 |
func TestUpdateValidatorByPowerIndex(t *testing.T) {
app, ctx, _, _ := bootstrapValidatorTest(t, 0, 100)
_, addrVals := generateAddresses(app, ctx, 1)
bondedPool := app.StakingKeeper.GetBondedPool(ctx)
notBondedPool := app.StakingKeeper.GetNotBondedPool(ctx)
app.BankKeeper.SetBalances(ctx, bondedPool.GetAddress(), sdk.NewCoins(sdk.NewCoin(app.StakingKeeper.BondDenom(ctx), sdk.TokensFromConsensusPower(1234))))
app.BankKeeper.SetBalances(ctx, notBondedPool.GetAddress(), sdk.NewCoins(sdk.NewCoin(app.StakingKeeper.BondDenom(ctx), sdk.TokensFromConsensusPower(10000))))
app.SupplyKeeper.SetModuleAccount(ctx, bondedPool)
app.SupplyKeeper.SetModuleAccount(ctx, notBondedPool)
// add a validator
validator := types.NewValidator(addrVals[0], PKs[0], types.Description{})
validator, delSharesCreated := validator.AddTokensFromDel(sdk.TokensFromConsensusPower(100))
require.Equal(t, sdk.Unbonded, validator.Status)
require.Equal(t, sdk.TokensFromConsensusPower(100), validator.Tokens)
keeper.TestingUpdateValidator(app.StakingKeeper, ctx, validator, true)
validator, found := app.StakingKeeper.GetValidator(ctx, addrVals[0])
require.True(t, found)
require.Equal(t, sdk.TokensFromConsensusPower(100), validator.Tokens)
power := types.GetValidatorsByPowerIndexKey(validator)
require.True(t, keeper.ValidatorByPowerIndexExists(ctx, app.StakingKeeper, power))
// burn half the delegator shares
app.StakingKeeper.DeleteValidatorByPowerIndex(ctx, validator)
validator, burned := validator.RemoveDelShares(delSharesCreated.Quo(sdk.NewDec(2)))
require.Equal(t, sdk.TokensFromConsensusPower(50), burned)
keeper.TestingUpdateValidator(app.StakingKeeper, ctx, validator, true) // update the validator, possibly kicking it out
require.False(t, keeper.ValidatorByPowerIndexExists(ctx, app.StakingKeeper, power))
validator, found = app.StakingKeeper.GetValidator(ctx, addrVals[0])
require.True(t, found)
power = types.GetValidatorsByPowerIndexKey(validator)
require.True(t, keeper.ValidatorByPowerIndexExists(ctx, app.StakingKeeper, power))
} | explode_data.jsonl/6093 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 731
} | [
2830,
3393,
4289,
14256,
1359,
14986,
1552,
1155,
353,
8840,
836,
8,
341,
28236,
11,
5635,
11,
8358,
716,
1669,
26925,
14256,
2271,
1155,
11,
220,
15,
11,
220,
16,
15,
15,
340,
197,
6878,
10789,
52452,
1669,
6923,
52290,
11462,
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 TestMaxDocSize(t *testing.T) {
if testing.Verbose() {
logp.LogInit(logp.LOG_DEBUG, "", false, true, []string{"mongodb", "mongodbdetailed"})
}
// more docs than configured
trans := transaction{
documents: []interface{}{
"1234567",
"123",
"12",
},
}
mongodb := mongodbModForTests()
mongodb.sendResponse = true
mongodb.maxDocLength = 5
mongodb.publishTransaction(&trans)
res := expectTransaction(t, mongodb)
assert.Equal(t, "\"1234 ...\n\"123\"\n\"12\"", res["response"])
} | explode_data.jsonl/35545 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 210
} | [
2830,
3393,
5974,
9550,
1695,
1155,
353,
8840,
836,
8,
341,
743,
7497,
42505,
8297,
368,
341,
197,
6725,
79,
5247,
3803,
12531,
79,
36202,
11139,
11,
7342,
895,
11,
830,
11,
3056,
917,
4913,
37197,
497,
330,
71155,
347,
8940,
10111,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestCreateChainFromBlock(t *testing.T) {
viper.Set("peer.fileSystemPath", "/var/hyperledger/test/")
defer os.RemoveAll("/var/hyperledger/test/")
testChainID := "mytestchainid"
block, err := configtxtest.MakeGenesisBlock(testChainID)
if err != nil {
fmt.Printf("Failed to create a config block, err %s\n", err)
t.FailNow()
}
// Initialize gossip service
grpcServer := grpc.NewServer()
socket, err := net.Listen("tcp", fmt.Sprintf("%s:%d", "", 13611))
assert.NoError(t, err)
go grpcServer.Serve(socket)
defer grpcServer.Stop()
msptesttools.LoadMSPSetupForTesting()
identity, _ := mgmt.GetLocalSigningIdentityOrPanic().Serialize()
messageCryptoService := peergossip.NewMCS(&mocks.ChannelPolicyManagerGetter{}, localmsp.NewSigner(), mgmt.NewDeserializersManager())
secAdv := peergossip.NewSecurityAdvisor(mgmt.NewDeserializersManager())
var defaultSecureDialOpts = func() []grpc.DialOption {
var dialOpts []grpc.DialOption
dialOpts = append(dialOpts, grpc.WithInsecure())
return dialOpts
}
err = service.InitGossipServiceCustomDeliveryFactory(
identity, "localhost:13611", grpcServer,
&mockDeliveryClientFactory{},
messageCryptoService, secAdv, defaultSecureDialOpts)
assert.NoError(t, err)
err = CreateChainFromBlock(block)
if err != nil {
t.Fatalf("failed to create chain %s", err)
}
// Correct ledger
ledger := GetLedger(testChainID)
if ledger == nil {
t.Fatalf("failed to get correct ledger")
}
// Get config block from ledger
block, err = getCurrConfigBlockFromLedger(ledger)
assert.NoError(t, err, "Failed to get config block from ledger")
assert.NotNil(t, block, "Config block should not be nil")
assert.Equal(t, uint64(0), block.Header.Number, "config block should have been block 0")
// Bad ledger
ledger = GetLedger("BogusChain")
if ledger != nil {
t.Fatalf("got a bogus ledger")
}
// Correct block
block = GetCurrConfigBlock(testChainID)
if block == nil {
t.Fatalf("failed to get correct block")
}
// Bad block
block = GetCurrConfigBlock("BogusBlock")
if block != nil {
t.Fatalf("got a bogus block")
}
// Correct PolicyManager
pmgr := GetPolicyManager(testChainID)
if pmgr == nil {
t.Fatal("failed to get PolicyManager")
}
// Bad PolicyManager
pmgr = GetPolicyManager("BogusChain")
if pmgr != nil {
t.Fatal("got a bogus PolicyManager")
}
// PolicyManagerGetter
pmg := NewChannelPolicyManagerGetter()
assert.NotNil(t, pmg, "PolicyManagerGetter should not be nil")
pmgr, ok := pmg.Manager(testChainID)
assert.NotNil(t, pmgr, "PolicyManager should not be nil")
assert.Equal(t, true, ok, "expected Manage() to return true")
// Chaos monkey test
Initialize(nil)
SetCurrConfigBlock(block, testChainID)
channels := GetChannelsInfo()
if len(channels) != 1 {
t.Fatalf("incorrect number of channels")
}
} | explode_data.jsonl/47991 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 1005
} | [
2830,
3393,
4021,
18837,
3830,
4713,
1155,
353,
8840,
836,
8,
341,
5195,
12858,
4202,
445,
16537,
9715,
2320,
1820,
497,
3521,
947,
7530,
39252,
50704,
12697,
53006,
16867,
2643,
84427,
4283,
947,
7530,
39252,
50704,
12697,
53006,
18185,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestEcho(t *testing.T) {
ms := mock.MustCreateTestService(t)
ms.Start()
defer ms.Stop()
message := "hello"
args := &bounce.Bounce_Bounce_Args{
Msg: message,
}
ctx := context.Background()
var result bounce.Bounce_Bounce_Result
ms.MockClients().Echo.EXPECT().Echo(gomock.Any(), &echo.Request{Message: message}).
Return(&echo.Response{Message: message}, nil)
success, resHeaders, err := ms.MakeTChannelRequest(
ctx, "Bounce", "bounce", nil, args, &result,
)
require.NoError(t, err, "got tchannel error")
assert.True(t, success)
assert.Nil(t, resHeaders)
assert.Equal(t, message, *result.Success)
} | explode_data.jsonl/54098 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 239
} | [
2830,
3393,
74994,
1155,
353,
8840,
836,
8,
341,
47691,
1669,
7860,
50463,
4021,
2271,
1860,
1155,
340,
47691,
12101,
741,
16867,
9829,
30213,
2822,
24753,
1669,
330,
14990,
698,
31215,
1669,
609,
64302,
1785,
9734,
1668,
9734,
87581,
82,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestStringRel(t *testing.T) {
want := []struct {
a string
b string
rel float64
}{
{a: "foo", b: "bar", rel: 0.0},
{a: "foo", b: "foo", rel: 1.0},
{a: "foobar", b: "foobaz", rel: 1 - float64(1)/float64(6)},
{a: "", b: "b", rel: 0.0},
{a: "a", b: "", rel: 0.0},
{a: "", b: "", rel: 1.0},
{a: "ab", b: "ba", rel: 0.5},
{a: "abba", b: "aba", rel: 0.75},
{a: "aba", b: "abba", rel: 0.75},
{a: "résumé", b: "resume", rel: 1 - float64(2)/float64(6)},
}
for _, v := range want {
r := stringRel(v.a, v.b)
if r != v.rel {
t.Errorf(`Got %v, want rel("%v", "%v")==%v`, r, v.a, v.b, v.rel)
}
}
} | explode_data.jsonl/68144 | {
"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,
703,
6740,
1155,
353,
8840,
836,
8,
341,
50780,
1669,
3056,
1235,
341,
197,
11323,
256,
914,
198,
197,
2233,
256,
914,
198,
197,
197,
3748,
2224,
21,
19,
198,
197,
59403,
197,
197,
90,
64,
25,
330,
7975,
497,
293,
25,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
func TestGitCommandCatFile(t *testing.T) {
gitCmd := newDummyGitCommand()
gitCmd.OSCommand.command = func(cmd string, args ...string) *exec.Cmd {
assert.EqualValues(t, "cat", cmd)
assert.EqualValues(t, []string{"test.txt"}, args)
return exec.Command("echo", "-n", "test")
}
o, err := gitCmd.CatFile("test.txt")
assert.NoError(t, err)
assert.Equal(t, "test", o)
} | explode_data.jsonl/38373 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 149
} | [
2830,
3393,
46562,
4062,
26801,
1703,
1155,
353,
8840,
836,
8,
341,
90731,
15613,
1669,
501,
43344,
46562,
4062,
741,
90731,
15613,
57054,
4062,
14143,
284,
2915,
14160,
914,
11,
2827,
2503,
917,
8,
353,
11748,
64512,
341,
197,
6948,
12... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestAvgProposerPriority(t *testing.T) {
// Create Validator set without calling IncrementProposerPriority:
tcs := []struct {
vs ValidatorSet
want int64
}{
0: {ValidatorSet{Validators: []*Validator{{ProposerPriority: 0}, {ProposerPriority: 0}, {ProposerPriority: 0}}}, 0},
1: {ValidatorSet{Validators: []*Validator{{ProposerPriority: math.MaxInt64}, {ProposerPriority: 0}, {ProposerPriority: 0}}}, math.MaxInt64 / 3},
2: {ValidatorSet{Validators: []*Validator{{ProposerPriority: math.MaxInt64}, {ProposerPriority: 0}}}, math.MaxInt64 / 2},
3: {ValidatorSet{Validators: []*Validator{{ProposerPriority: math.MaxInt64}, {ProposerPriority: math.MaxInt64}}}, math.MaxInt64},
4: {ValidatorSet{Validators: []*Validator{{ProposerPriority: math.MinInt64}, {ProposerPriority: math.MinInt64}}}, math.MinInt64},
}
for i, tc := range tcs {
got := tc.vs.computeAvgProposerPriority()
assert.Equal(t, tc.want, got, "test case: %v", i)
}
} | explode_data.jsonl/28319 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 358
} | [
2830,
3393,
39447,
2008,
23438,
20555,
1155,
353,
8840,
836,
8,
341,
197,
322,
4230,
32566,
738,
2041,
8098,
52835,
2008,
23438,
20555,
510,
3244,
4837,
1669,
3056,
1235,
341,
197,
5195,
82,
256,
32566,
1649,
198,
197,
50780,
526,
21,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
func TestDeleteStmt(t *testing.T) {
buf := NewBuffer()
builder := DeleteFrom("table").Where(Eq("a", 1)).Comment("DELETE TEST")
err := builder.Build(dialect.MySQL, buf)
require.NoError(t, err)
require.Equal(t, "/* DELETE TEST */\nDELETE FROM `table` WHERE (`a` = ?)", buf.String())
require.Equal(t, []interface{}{1}, buf.Value())
} | explode_data.jsonl/76514 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 130
} | [
2830,
3393,
6435,
31063,
1155,
353,
8840,
836,
8,
341,
26398,
1669,
1532,
4095,
741,
44546,
1669,
10428,
3830,
445,
2005,
1827,
9064,
10722,
80,
445,
64,
497,
220,
16,
4579,
10677,
445,
14424,
13602,
1138,
9859,
1669,
7363,
25212,
1500,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestFirstMatchGetsNoRoute(t *testing.T) {
req := events.APIGatewayProxyRequest{
Path: "/test",
HTTPMethod: http.MethodGet,
}
route := &Route{
func(_ events.APIGatewayProxyRequest) bool {
return false
},
dummyHandler,
}
r := NewRouter()
r.AddRoute("test", route)
_, _, err := r.firstMatch(req)
assert.NotNil(t, err)
} | explode_data.jsonl/4497 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 151
} | [
2830,
3393,
5338,
8331,
49358,
2753,
4899,
1155,
353,
8840,
836,
8,
341,
24395,
1669,
4357,
24922,
40709,
16219,
1900,
515,
197,
69640,
25,
981,
3521,
1944,
756,
197,
197,
9230,
3523,
25,
1758,
20798,
1949,
345,
197,
630,
7000,
2133,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestRequestRetry(t *testing.T) {
var retryCounter uint
p := &gophercloud.ProviderClient{}
p.UseTokenLock()
p.SetToken(client.TokenID)
p.MaxBackoffRetries = 3
p.RetryBackoffFunc = retryTest(&retryCounter, t)
th.SetupHTTP()
defer th.TeardownHTTP()
th.Mux.HandleFunc("/route", func(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Retry-After", "1")
//always reply 429
http.Error(w, "retry later", http.StatusTooManyRequests)
})
_, err := p.Request("GET", th.Endpoint()+"/route", &gophercloud.RequestOpts{})
if err == nil {
t.Fatal("expecting error, got nil")
}
th.AssertEquals(t, retryCounter, p.MaxBackoffRetries)
} | explode_data.jsonl/5896 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 263
} | [
2830,
3393,
1900,
51560,
1155,
353,
8840,
836,
8,
341,
2405,
22683,
14099,
2622,
271,
3223,
1669,
609,
70,
16940,
12361,
36208,
2959,
16094,
3223,
9046,
3323,
11989,
741,
3223,
4202,
3323,
12805,
32277,
915,
340,
3223,
14535,
3707,
1847,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestExportedNonTagged(t *testing.T) {
type Bla struct {
A string
Another string `json:"another"`
yetAnother string // unused because unexported
EvenAYaml string `yaml:"even_a_yaml"`
}
schemaRef, _, err := NewSchemaRefForValue(&Bla{}, UseAllExportedFields())
require.NoError(t, err)
require.Equal(t, &openapi3.SchemaRef{Value: &openapi3.Schema{
Type: "object",
Properties: map[string]*openapi3.SchemaRef{
"A": {Value: &openapi3.Schema{Type: "string"}},
"another": {Value: &openapi3.Schema{Type: "string"}},
"even_a_yaml": {Value: &openapi3.Schema{Type: "string"}},
}}}, schemaRef)
} | explode_data.jsonl/55875 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 279
} | [
2830,
3393,
16894,
291,
8121,
5668,
3556,
1155,
353,
8840,
836,
8,
341,
13158,
2502,
64,
2036,
341,
197,
22985,
688,
914,
198,
197,
197,
14037,
262,
914,
1565,
2236,
2974,
41963,
8805,
197,
14522,
295,
14037,
914,
442,
20006,
1576,
65... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestGenerateMetricTasksError(t *testing.T) {
run := &v1alpha1.AnalysisRun{
Spec: v1alpha1.AnalysisRunSpec{
Metrics: []v1alpha1.Metric{{
Name: "success-rate",
}},
},
Status: v1alpha1.AnalysisRunStatus{
Phase: v1alpha1.AnalysisPhaseRunning,
MetricResults: []v1alpha1.MetricResult{{
Name: "success-rate",
Phase: v1alpha1.AnalysisPhaseRunning,
Error: 1,
Measurements: []v1alpha1.Measurement{{
Phase: v1alpha1.AnalysisPhaseError,
StartedAt: timePtr(metav1.NewTime(time.Now().Add(-120 * time.Second))),
FinishedAt: timePtr(metav1.NewTime(time.Now().Add(-120 * time.Second))),
}},
}},
},
}
{
run := run.DeepCopy()
tasks := generateMetricTasks(run, run.Spec.Metrics)
assert.Equal(t, 1, len(tasks))
}
{
run := run.DeepCopy()
run.Spec.Metrics[0].Interval = "5m"
tasks := generateMetricTasks(run, run.Spec.Metrics)
assert.Equal(t, 1, len(tasks))
}
} | explode_data.jsonl/75813 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 422
} | [
2830,
3393,
31115,
54310,
25449,
1454,
1155,
353,
8840,
836,
8,
341,
56742,
1669,
609,
85,
16,
7141,
16,
8624,
9092,
6727,
515,
197,
7568,
992,
25,
348,
16,
7141,
16,
8624,
9092,
6727,
8327,
515,
298,
9209,
13468,
25,
3056,
85,
16,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestMemberChangeRoleNoBoxes(t *testing.T) {
tc, owner, other, _, name := memberSetupMultiple(t)
defer tc.Cleanup()
assertRole(tc, name, owner.Username, keybase1.TeamRole_OWNER)
assertRole(tc, name, other.Username, keybase1.TeamRole_NONE)
// add other.Username as a writer
if err := SetRoleWriter(context.TODO(), tc.G, name, other.Username); err != nil {
t.Fatal(err)
}
assertRole(tc, name, owner.Username, keybase1.TeamRole_OWNER)
assertRole(tc, name, other.Username, keybase1.TeamRole_WRITER)
// this change request shouldn't generate any new boxes
req := keybase1.TeamChangeReq{Readers: []keybase1.UserVersion{other.GetUserVersion()}}
tm, err := GetForTestByStringName(context.TODO(), tc.G, name)
if err != nil {
t.Fatal(err)
}
_, boxes, _, _, err := tm.changeMembershipSection(context.TODO(), req)
if err != nil {
t.Fatal(err)
}
if boxes != nil && len(boxes.Boxes) > 0 {
t.Errorf("change role made new boxes: %+v", boxes)
}
} | explode_data.jsonl/13518 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 372
} | [
2830,
3393,
9366,
4072,
9030,
2753,
93665,
1155,
353,
8840,
836,
8,
341,
78255,
11,
6372,
11,
1008,
11,
8358,
829,
1669,
4462,
21821,
32089,
1155,
340,
16867,
17130,
727,
60639,
2822,
6948,
9030,
44415,
11,
829,
11,
6372,
42777,
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... | 6 |
func TestValidate_UniqueOperationNames_FragmentAndOperationNamedTheSame(t *testing.T) {
testutil.ExpectPassesRule(t, graphql.UniqueOperationNamesRule, `
query Foo {
...Foo
}
fragment Foo on Type {
field
}
`)
} | explode_data.jsonl/23172 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 109
} | [
2830,
3393,
17926,
62,
22811,
8432,
7980,
1400,
6017,
3036,
8432,
15810,
785,
19198,
1155,
353,
8840,
836,
8,
341,
18185,
1314,
81893,
12187,
288,
11337,
1155,
11,
48865,
87443,
8432,
7980,
11337,
11,
22074,
414,
3239,
33428,
341,
286,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
func TestGetHostPublicIPv4AddressFromEC2MetadataFailWithError(t *testing.T) {
ctrl := gomock.NewController(t)
defer ctrl.Finish()
ec2MetadataClient := mock_ec2.NewMockEC2MetadataClient(ctrl)
ec2Client := mock_ec2.NewMockClient(ctrl)
agent := &ecsAgent{
ec2MetadataClient: ec2MetadataClient,
ec2Client: ec2Client,
}
ec2MetadataClient.EXPECT().PublicIPv4Address().Return("", errors.New("Unable to get IP Address"))
assert.Empty(t, agent.getHostPublicIPv4AddressFromEC2Metadata())
} | explode_data.jsonl/41609 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 191
} | [
2830,
3393,
1949,
9296,
12676,
58056,
19,
4286,
3830,
7498,
17,
14610,
19524,
66102,
1155,
353,
8840,
836,
8,
341,
84381,
1669,
342,
316,
1176,
7121,
2051,
1155,
340,
16867,
23743,
991,
18176,
2822,
197,
757,
17,
14610,
2959,
1669,
7860... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestCustomerMetadata(t *testing.T) {
conn := NewConnection("", false)
m := make(map[string]interface{})
m["integration_name"] = "QBO"
mockCustomer := conn.NewCustomer()
mockCustomer.Id = 34
mockCustomer.Metadata = m
b, err := json.Marshal(mockCustomer)
if err != nil {
t.Fatal(err)
}
if string(b) != `{"id":34,"metadata":{"integration_name":"QBO"}}` {
t.Fatal("Json is wrong", "right json =>", string(b))
}
} | explode_data.jsonl/14999 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 169
} | [
2830,
3393,
12792,
14610,
1155,
353,
8840,
836,
8,
341,
32917,
1669,
1532,
4526,
19814,
895,
340,
2109,
1669,
1281,
9147,
14032,
31344,
37790,
2109,
1183,
60168,
1269,
1341,
284,
330,
48,
4677,
698,
77333,
12792,
1669,
4534,
7121,
12792,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestWorkflow_GetSemaphoreKeys(t *testing.T) {
assert := assert.New(t)
wf := Workflow{
ObjectMeta: metav1.ObjectMeta{
Name: "test",
Namespace: "test",
},
Spec: WorkflowSpec{
Synchronization: &Synchronization{
Semaphore: &SemaphoreRef{ConfigMapKeyRef: &corev1.ConfigMapKeySelector{
LocalObjectReference: corev1.LocalObjectReference{
Name: "test",
},
}},
},
},
}
keys := wf.GetSemaphoreKeys()
assert.Len(keys, 1)
assert.Contains(keys, "test/test")
wf.Spec.Templates = []Template{
{
Name: "t1",
Synchronization: &Synchronization{
Semaphore: &SemaphoreRef{ConfigMapKeyRef: &corev1.ConfigMapKeySelector{
LocalObjectReference: corev1.LocalObjectReference{
Name: "template",
},
}},
},
},
{
Name: "t1",
Synchronization: &Synchronization{
Semaphore: &SemaphoreRef{ConfigMapKeyRef: &corev1.ConfigMapKeySelector{
LocalObjectReference: corev1.LocalObjectReference{
Name: "template1",
},
}},
},
},
{
Name: "t2",
Synchronization: &Synchronization{
Semaphore: &SemaphoreRef{ConfigMapKeyRef: &corev1.ConfigMapKeySelector{
LocalObjectReference: corev1.LocalObjectReference{
Name: "template",
},
}},
},
},
}
keys = wf.GetSemaphoreKeys()
assert.Len(keys, 3)
assert.Contains(keys, "test/test")
assert.Contains(keys, "test/template")
assert.Contains(keys, "test/template1")
spec := wf.Spec.DeepCopy()
wf.Spec = WorkflowSpec{
WorkflowTemplateRef: &WorkflowTemplateRef{
Name: "test",
},
}
wf.Status.StoredWorkflowSpec = spec
keys = wf.GetSemaphoreKeys()
assert.Len(keys, 3)
assert.Contains(keys, "test/test")
assert.Contains(keys, "test/template")
assert.Contains(keys, "test/template1")
} | explode_data.jsonl/26051 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 774
} | [
2830,
3393,
62768,
13614,
74614,
8850,
1155,
353,
8840,
836,
8,
341,
6948,
1669,
2060,
7121,
1155,
340,
6692,
69,
1669,
60173,
515,
197,
23816,
12175,
25,
77520,
16,
80222,
515,
298,
21297,
25,
414,
330,
1944,
756,
298,
90823,
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 TestCertificateRequestOperation(t *testing.T) {
certificateARN := "arn:aws:acm:us-east-1:123456789012:certificate/12345678-1234-1234-1234-123456789012"
domainName := "example.com"
aliases := []string{"www.example.com"}
mockCtrl := gomock.NewController(t)
defer mockCtrl.Finish()
mockClient := client.NewMockClient(mockCtrl)
mockOutput := &mock.Output{}
operation := certificateRequestOperation{
acm: mockClient,
aliases: aliases,
domainName: domainName,
output: mockOutput,
}
mockClient.EXPECT().RequestCertificate(domainName, aliases).Return(certificateARN, nil)
operation.execute()
if len(mockOutput.InfoMsgs) == 0 {
t.Errorf("Expected info output from operation, got none")
}
} | explode_data.jsonl/29936 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 272
} | [
2830,
3393,
33202,
1900,
8432,
1155,
353,
8840,
836,
8,
341,
1444,
20962,
9051,
1669,
330,
1885,
25,
8635,
25,
580,
76,
25,
355,
39507,
12,
16,
25,
16,
17,
18,
19,
20,
21,
22,
23,
24,
15,
16,
17,
25,
63586,
14,
16,
17,
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... | 2 |
func TestTerminationPolicy(t *testing.T) {
sset, err := makeStatefulSet(&monitoringv1.Alertmanager{
Spec: monitoringv1.AlertmanagerSpec{},
}, defaultTestConfig, "")
if err != nil {
t.Fatalf("Unexpected error while making StatefulSet: %v", err)
}
for _, c := range sset.Spec.Template.Spec.Containers {
if c.TerminationMessagePolicy != v1.TerminationMessageFallbackToLogsOnError {
t.Fatalf("Unexpected TermintationMessagePolicy. Expected %v got %v", v1.TerminationMessageFallbackToLogsOnError, c.TerminationMessagePolicy)
}
}
} | explode_data.jsonl/25263 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 188
} | [
2830,
3393,
21209,
32096,
13825,
1155,
353,
8840,
836,
8,
341,
1903,
746,
11,
1848,
1669,
1281,
1397,
1262,
1649,
2099,
32225,
287,
85,
16,
40143,
13297,
515,
197,
7568,
992,
25,
16558,
85,
16,
40143,
13297,
8327,
38837,
197,
2137,
16... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 4 |
func Test_primePalindrome(t *testing.T) {
ast := assert.New(t)
for _, tc := range tcs {
fmt.Printf("~~%v~~\n", tc)
ast.Equal(tc.ans, primePalindrome(tc.N), "输入:%v", tc)
}
} | explode_data.jsonl/56736 | {
"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,
38217,
68694,
1155,
353,
8840,
836,
8,
341,
88836,
1669,
2060,
7121,
1155,
692,
2023,
8358,
17130,
1669,
2088,
259,
4837,
341,
197,
11009,
19367,
445,
5817,
4,
85,
5817,
59,
77,
497,
17130,
340,
197,
88836,
12808,
44415,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestContextTypedError(t *testing.T) {
c, _ := CreateTestContext(httptest.NewRecorder())
c.Error(errors.New("externo 0")).SetType(ErrorTypePublic) // nolint: errcheck
c.Error(errors.New("interno 0")).SetType(ErrorTypePrivate) // nolint: errcheck
for _, err := range c.Errors.ByType(ErrorTypePublic) {
assert.Equal(t, ErrorTypePublic, err.Type)
}
for _, err := range c.Errors.ByType(ErrorTypePrivate) {
assert.Equal(t, ErrorTypePrivate, err.Type)
}
assert.Equal(t, []string{"externo 0", "interno 0"}, c.Errors.Errors())
} | explode_data.jsonl/26814 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 208
} | [
2830,
3393,
1972,
44466,
1454,
1155,
353,
8840,
836,
8,
341,
1444,
11,
716,
1669,
4230,
2271,
1972,
73392,
83,
70334,
7121,
47023,
2398,
1444,
6141,
38881,
7121,
445,
4301,
78,
220,
15,
15197,
1649,
929,
37396,
929,
12676,
8,
220,
442... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestCreateRepoAndID(t *testing.T) {
ctx, cancel, config, tempdir := initConfig(t)
defer cancel()
defer os.RemoveAll(tempdir)
defer libkbfs.CheckConfigAndShutdown(ctx, t, config)
h, err := tlfhandle.ParseHandle(
ctx, config.KBPKI(), config.MDOps(), nil, "user1", tlf.Private)
require.NoError(t, err)
id1, err := CreateRepoAndID(ctx, config, h, "Repo1")
require.NoError(t, err)
id2, err := CreateRepoAndID(ctx, config, h, "Repo2")
require.NoError(t, err)
require.NotEqual(t, id1, id2)
_, err = CreateRepoAndID(ctx, config, h, "Repo1")
require.IsType(t, libkb.RepoAlreadyExistsError{}, err)
_, err = CreateRepoAndID(ctx, config, h, "rePo1")
require.IsType(t, libkb.RepoAlreadyExistsError{}, err)
_, err = CreateRepoAndID(ctx, config, h, "repo2")
require.IsType(t, libkb.RepoAlreadyExistsError{}, err)
rootNode, _, err := config.KBFSOps().GetOrCreateRootNode(
ctx, h, data.MasterBranch)
require.NoError(t, err)
jManager, err := libkbfs.GetJournalManager(config)
require.NoError(t, err)
err = jManager.FinishSingleOp(ctx, rootNode.GetFolderBranch().Tlf,
nil, keybase1.MDPriorityGit)
require.NoError(t, err)
} | explode_data.jsonl/26650 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 468
} | [
2830,
3393,
4021,
25243,
3036,
915,
1155,
353,
8840,
836,
8,
341,
20985,
11,
9121,
11,
2193,
11,
2730,
3741,
1669,
2930,
2648,
1155,
340,
16867,
9121,
741,
16867,
2643,
84427,
9758,
3741,
340,
16867,
3051,
21310,
3848,
10600,
2648,
3036... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestDisconnectOutput(t *testing.T) {
tt := TaskTemplate{
DataPipeTemplates: []DataPipeTemplate{
DataPipeTemplate{
SourceActionName: "Action1",
SourceOutputName: "out1",
TaskOutputName: "out2",
},
},
}
err := tt.DisconnectOutput("out2")
assert.Nil(t, err)
assert.Equal(t, 0, len(tt.DataPipeTemplates))
err = tt.DisconnectOutput("out4")
assert.Equal(t, errors.New("Not found"), err)
} | explode_data.jsonl/19606 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 177
} | [
2830,
3393,
60651,
5097,
1155,
353,
8840,
836,
8,
341,
3244,
83,
1669,
5430,
7275,
515,
197,
40927,
34077,
51195,
25,
3056,
1043,
34077,
7275,
515,
298,
40927,
34077,
7275,
515,
571,
197,
3608,
2512,
675,
25,
330,
2512,
16,
756,
571,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestETH_GetTransactionByBlockHashAndIndex(t *testing.T) {
txHash := sendTestTransaction(t)
time.Sleep(time.Second * 5)
param := []string{txHash.String()}
rpcRes := call(t, "eth_getTransactionReceipt", param)
require.Nil(t, rpcRes.Error)
receipt := make(map[string]interface{})
err := json.Unmarshal(rpcRes.Result, &receipt)
require.NoError(t, err)
require.NotEmpty(t, receipt)
blockHash := receipt["blockHash"].(string)
param = []string{blockHash, "0x0"}
rpcRes = call(t, "eth_getTransactionByBlockHashAndIndex", param)
tx := make(map[string]interface{})
err = json.Unmarshal(rpcRes.Result, &tx)
require.NoError(t, err)
require.NotNil(t, tx)
require.Equal(t, blockHash, tx["blockHash"].(string))
require.Equal(t, "0x0", tx["transactionIndex"].(string))
} | explode_data.jsonl/837 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 305
} | [
2830,
3393,
7625,
13614,
8070,
1359,
4713,
6370,
3036,
1552,
1155,
353,
8840,
836,
8,
341,
46237,
6370,
1669,
3624,
2271,
8070,
1155,
692,
21957,
31586,
9730,
32435,
353,
220,
20,
692,
36037,
1669,
3056,
917,
90,
3998,
6370,
6431,
23509... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_piecesOf(t *testing.T) {
var tests = []struct {
input string
output []string
}{
{"", []string{}},
{"foo", []string{"foo"}},
{"123", []string{"123"}},
{"foo1bar", []string{"foo", "1", "bar"}},
{"2bar3foo", []string{"2", "bar", "3", "foo"}},
}
for _, test := range tests {
result := piecesOf(test.input)
if reflect.DeepEqual(result, test.output) == false {
t.Errorf("piecesOf(%v) == %v. Want %v", test.input, result, test.output)
}
}
} | explode_data.jsonl/40686 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 200
} | [
2830,
3393,
83479,
2124,
1155,
353,
8840,
836,
8,
341,
2405,
7032,
284,
3056,
1235,
341,
197,
22427,
220,
914,
198,
197,
21170,
3056,
917,
198,
197,
59403,
197,
197,
4913,
497,
3056,
917,
6257,
1583,
197,
197,
4913,
7975,
497,
3056,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestSelectNullLookup(t *testing.T) {
ctx := context.Background()
conn, err := mysql.Connect(ctx, &vtParams)
require.NoError(t, err)
defer conn.Close()
exec(t, conn, "insert into t6(id1, id2) values(1, 'a'), (2, 'b'), (3, null)")
defer exec(t, conn, "set workload = oltp;delete from t6")
for _, workload := range []string{"oltp", "olap"} {
t.Run(workload, func(t *testing.T) {
exec(t, conn, "set workload = "+workload)
assertMatches(t, conn, "select id1, id2 from t6 order by id1", "[[INT64(1) VARCHAR(\"a\")] [INT64(2) VARCHAR(\"b\")] [INT64(3) NULL]]")
assertIsEmpty(t, conn, "select id1, id2 from t6 where id2 = null")
assertMatches(t, conn, "select id1, id2 from t6 where id2 is null", "[[INT64(3) NULL]]")
assertMatches(t, conn, "select id1, id2 from t6 where id2 is not null order by id1", "[[INT64(1) VARCHAR(\"a\")] [INT64(2) VARCHAR(\"b\")]]")
assertIsEmpty(t, conn, "select id1, id2 from t6 where id1 IN (null)")
assertMatches(t, conn, "select id1, id2 from t6 where id1 IN (1,2,null) order by id1", "[[INT64(1) VARCHAR(\"a\")] [INT64(2) VARCHAR(\"b\")]]")
assertIsEmpty(t, conn, "select id1, id2 from t6 where id1 NOT IN (1,null) order by id1")
assertMatches(t, conn, "select id1, id2 from t6 where id1 NOT IN (1,3)", "[[INT64(2) VARCHAR(\"b\")]]")
})
}
} | explode_data.jsonl/52408 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 569
} | [
2830,
3393,
3379,
3280,
34247,
1155,
353,
8840,
836,
8,
341,
20985,
1669,
2266,
19047,
741,
32917,
11,
1848,
1669,
10564,
43851,
7502,
11,
609,
9708,
4870,
340,
17957,
35699,
1155,
11,
1848,
340,
16867,
4534,
10421,
2822,
67328,
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 TestPush(t *testing.T) {
vwoInstance, err := getInstance("./testdata/testdata.json")
assert.Nil(t, err, "error fetching instance")
userID := testdata.GetRandomUser()
tagKey := ""
tagValue := ""
pushed := vwoInstance.Push(tagKey, tagValue, userID)
assert.False(t, pushed, "Invalid params")
tagKey = testdata.ValidTagKey
tagValue = testdata.ValidTagValue
pushed = vwoInstance.Push(tagKey, tagValue, userID)
assert.True(t, pushed, "Unable to Push")
tagKey = testdata.ValidTagKey
tagValue = testdata.InvalidTagValue
pushed = vwoInstance.Push(tagKey, tagValue, userID)
assert.False(t, pushed, "Unable to Push")
tagKey = testdata.InvalidTagKey
tagValue = testdata.ValidTagValue
pushed = vwoInstance.Push(tagKey, tagValue, userID)
assert.False(t, pushed, "Unable to Push")
} | explode_data.jsonl/14283 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 283
} | [
2830,
3393,
16644,
1155,
353,
8840,
836,
8,
341,
5195,
1126,
2523,
11,
1848,
1669,
37886,
13988,
92425,
12697,
691,
4323,
1138,
6948,
59678,
1155,
11,
1848,
11,
330,
841,
44234,
2867,
1138,
19060,
915,
1669,
1273,
691,
2234,
13999,
1474... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestScan(t *testing.T) {
s, err := Run()
ok(t, err)
defer s.Close()
c, err := redis.Dial("tcp", s.Addr())
ok(t, err)
// We cheat with scan. It always returns everything.
s.Set("key", "value")
// No problem
{
res, err := redis.Values(c.Do("SCAN", 0))
ok(t, err)
equals(t, 2, len(res))
var c int
var keys []string
_, err = redis.Scan(res, &c, &keys)
ok(t, err)
equals(t, 0, c)
equals(t, []string{"key"}, keys)
}
// Invalid cursor
{
res, err := redis.Values(c.Do("SCAN", 42))
ok(t, err)
equals(t, 2, len(res))
var c int
var keys []string
_, err = redis.Scan(res, &c, &keys)
ok(t, err)
equals(t, 0, c)
equals(t, []string(nil), keys)
}
// COUNT (ignored)
{
res, err := redis.Values(c.Do("SCAN", 0, "COUNT", 200))
ok(t, err)
equals(t, 2, len(res))
var c int
var keys []string
_, err = redis.Scan(res, &c, &keys)
ok(t, err)
equals(t, 0, c)
equals(t, []string{"key"}, keys)
}
// MATCH
{
s.Set("aap", "noot")
s.Set("mies", "wim")
res, err := redis.Values(c.Do("SCAN", 0, "MATCH", "mi*"))
ok(t, err)
equals(t, 2, len(res))
var c int
var keys []string
_, err = redis.Scan(res, &c, &keys)
ok(t, err)
equals(t, 0, c)
equals(t, []string{"mies"}, keys)
}
// Wrong usage
{
_, err := redis.Int(c.Do("SCAN"))
assert(t, err != nil, "do SCAN error")
_, err = redis.Int(c.Do("SCAN", "noint"))
assert(t, err != nil, "do SCAN error")
_, err = redis.Int(c.Do("SCAN", 1, "MATCH"))
assert(t, err != nil, "do SCAN error")
_, err = redis.Int(c.Do("SCAN", 1, "COUNT"))
assert(t, err != nil, "do SCAN error")
_, err = redis.Int(c.Do("SCAN", 1, "COUNT", "noint"))
assert(t, err != nil, "do SCAN error")
}
} | explode_data.jsonl/23153 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 848
} | [
2830,
3393,
26570,
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,
20870,
98462,
445,
27161,
497,
274,
93626,
2398,
59268,
1155,
11,
1848,
692,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestSubQuery(t *testing.T) {
catalogStore, err := store.Open("catalog_subq", store.DefaultOptions())
require.NoError(t, err)
defer os.RemoveAll("catalog_subq")
dataStore, err := store.Open("sqldata_subq", store.DefaultOptions())
require.NoError(t, err)
defer os.RemoveAll("sqldata_subq")
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, title VARCHAR, active BOOLEAN, payload BLOB, PRIMARY KEY id)", nil, true)
require.NoError(t, err)
rowCount := 10
for i := 0; i < rowCount; i++ {
encPayload := hex.EncodeToString([]byte(fmt.Sprintf("blob%d", i)))
_, err = engine.ExecStmt(fmt.Sprintf(`
UPSERT INTO table1 (id, title, active, payload) VALUES (%d, 'title%d', %v, x'%s')
`, i, i, i%2 == 0, encPayload), nil, true)
require.NoError(t, err)
}
r, err := engine.QueryStmt(`
SELECT id, title t
FROM (SELECT id, title, active FROM table1) t2
WHERE active AND t2.id >= 0`, nil, true)
require.NoError(t, err)
cols, err := r.Columns()
require.NoError(t, err)
require.Len(t, cols, 2)
for i := 0; i < rowCount; i += 2 {
row, err := r.Read()
require.NoError(t, err)
require.NotNil(t, row)
require.Len(t, row.Values, 2)
require.Equal(t, int64(i), row.Values[EncodeSelector("", "db1", "t2", "id")].Value())
require.Equal(t, fmt.Sprintf("title%d", i), row.Values[EncodeSelector("", "db1", "t2", "t")].Value())
}
err = r.Close()
require.NoError(t, err)
_, err = engine.ExecStmt("UPSERT INTO table1 (id, title) VALUES (0, 'title0')", nil, true)
require.NoError(t, err)
r, err = engine.QueryStmt("SELECT id, title, active FROM (SELECT id, title, active FROM table1) WHERE active", nil, true)
require.NoError(t, err)
_, err = r.Read()
require.NoError(t, err)
err = r.Close()
require.NoError(t, err)
r, err = engine.QueryStmt("SELECT id, title, active FROM (SELECT id, title, active FROM table1) WHERE title", nil, true)
require.NoError(t, err)
_, err = r.Read()
require.Equal(t, ErrInvalidCondition, err)
err = r.Close()
require.NoError(t, err)
err = engine.Close()
require.NoError(t, err)
} | explode_data.jsonl/64083 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 937
} | [
2830,
3393,
3136,
2859,
1155,
353,
8840,
836,
8,
341,
1444,
7750,
6093,
11,
1848,
1669,
3553,
12953,
445,
26539,
5228,
80,
497,
3553,
13275,
3798,
2398,
17957,
35699,
1155,
11,
1848,
340,
16867,
2643,
84427,
445,
26539,
5228,
80,
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... | 3 |
func TestObjectPutString(t *testing.T) {
ctx := context.Background()
c, rollback := makeConnectionWithContainer(t)
defer rollback()
err := c.ObjectPutString(ctx, CONTAINER, OBJECT, CONTENTS, "")
if err != nil {
t.Fatal(err)
}
defer func() {
err = c.ObjectDelete(ctx, CONTAINER, OBJECT)
if err != nil {
t.Fatal(err)
}
}()
info, _, err := c.Object(ctx, CONTAINER, OBJECT)
if err != nil {
t.Error(err)
}
if info.ContentType != "application/octet-stream" {
t.Error("Bad content type", info.ContentType)
}
if info.Bytes != CONTENT_SIZE {
t.Error("Bad length")
}
if info.Hash != CONTENT_MD5 {
t.Error("Bad length")
}
} | explode_data.jsonl/12671 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 268
} | [
2830,
3393,
1190,
19103,
703,
1155,
353,
8840,
836,
8,
341,
20985,
1669,
2266,
19047,
741,
1444,
11,
60414,
1669,
1281,
4526,
2354,
4502,
1155,
340,
16867,
60414,
741,
9859,
1669,
272,
8348,
19103,
703,
7502,
11,
16120,
34521,
11,
39786... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestConvertBoolsOptionalToRequired(t *testing.T) {
lines, err := convertTypes(
"Foo", "Bar",
`struct Foo {
1: required bool one
}
struct Bar {
1: optional bool one
}`,
nil,
nil,
)
assert.NoError(t, err)
assertPrettyEqual(t, trim(`
out.One = (*bool)(&(in.One))
`), lines)
} | explode_data.jsonl/62026 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 136
} | [
2830,
3393,
12012,
1233,
3069,
15309,
1249,
8164,
1155,
353,
8840,
836,
8,
341,
78390,
11,
1848,
1669,
5508,
4173,
1006,
197,
197,
1,
40923,
497,
330,
3428,
756,
197,
197,
63,
1235,
33428,
341,
298,
197,
16,
25,
2567,
1807,
825,
198... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestSignerAddCommandBadKeyPath(t *testing.T) {
tmpDir, err := ioutil.TempDir("", "docker-sign-test-")
assert.NilError(t, err)
defer os.RemoveAll(tmpDir)
config.SetDir(tmpDir)
cli := test.NewFakeCli(&fakeClient{})
cli.SetNotaryClient(notaryfake.GetEmptyTargetsNotaryRepository)
cmd := newSignerAddCommand(cli)
cmd.SetArgs([]string{"--key", "/path/to/key.pem", "alice", "alpine"})
cmd.SetOutput(ioutil.Discard)
expectedError := "unable to read public key from file: open /path/to/key.pem: no such file or directory"
if runtime.GOOS == "windows" {
expectedError = "unable to read public key from file: open /path/to/key.pem: The system cannot find the path specified."
}
assert.Error(t, cmd.Execute(), expectedError)
} | explode_data.jsonl/23300 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 270
} | [
2830,
3393,
7264,
261,
2212,
4062,
17082,
1592,
1820,
1155,
353,
8840,
836,
8,
341,
20082,
6184,
11,
1848,
1669,
43144,
65009,
6184,
19814,
330,
28648,
27953,
16839,
12,
1138,
6948,
59678,
1454,
1155,
11,
1848,
340,
16867,
2643,
84427,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestDecodeBytes(t *testing.T) {
t.Parallel()
re := require.New(t)
key := "abcdefghijklmnopqrstuvwxyz"
for i := 0; i < len(key); i++ {
_, k, err := DecodeBytes(EncodeBytes([]byte(key[:i])))
re.NoError(err)
re.Equal(key[:i], string(k))
}
} | explode_data.jsonl/7540 | {
"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,
32564,
7078,
1155,
353,
8840,
836,
8,
341,
3244,
41288,
7957,
741,
17200,
1669,
1373,
7121,
1155,
340,
23634,
1669,
330,
67512,
698,
2023,
600,
1669,
220,
15,
26,
600,
366,
2422,
4857,
1215,
600,
1027,
341,
197,
197,
6878,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestLessThanOrEqualToMatcherDatetime(t *testing.T) {
logger := logging.NewLogger(&logging.LoggerOptions{})
attrName := "value"
dto := &dtos.MatcherDTO{
MatcherType: "LESS_THAN_OR_EQUAL_TO",
UnaryNumeric: &dtos.UnaryNumericMatcherDataDTO{
DataType: "DATETIME",
Value: int64(960293532000), // 06/06/2000
},
KeySelector: &dtos.KeySelectorDTO{
Attribute: &attrName,
},
}
matcher, err := BuildMatcher(dto, nil, logger)
if err != nil {
t.Error("There should be no errors when building the matcher")
t.Error(err)
}
matcherType := reflect.TypeOf(matcher).String()
if matcherType != "*matchers.LessThanOrEqualToMatcher" {
t.Errorf("Incorrect matcher constructed. Should be *matchers.LessThanOrEqualToMatcher and was %s", matcherType)
}
attributes := make(map[string]interface{})
attributes["value"] = int64(960293532)
if !matcher.Match("asd", attributes, nil) {
t.Error("Equal should match")
}
attributes["value"] = int64(1275782400)
if matcher.Match("asd", attributes, nil) {
t.Error("Greater should not match")
}
attributes["value"] = int64(293532000)
if !matcher.Match("asd", attributes, nil) {
t.Error("Lower should match")
}
} | explode_data.jsonl/34809 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 475
} | [
2830,
3393,
27451,
89387,
37554,
94191,
1155,
353,
8840,
836,
8,
341,
17060,
1669,
8392,
7121,
7395,
2099,
25263,
12750,
3798,
37790,
60943,
675,
1669,
330,
957,
698,
98864,
1669,
609,
8047,
436,
76452,
14923,
515,
197,
197,
37554,
929,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestKubeletReserved(t *testing.T) {
validConfigs := []struct {
conf string
kubeReserved string
systemReserved string
}{
{
conf: `
`,
systemReserved: "",
kubeReserved: "",
},
{
conf: `
kubelet:
kubeReserved: "cpu=100m,memory=100Mi,ephemeral-storage=1Gi"
systemReserved: "cpu=200m,memory=200Mi,ephemeral-storage=2Gi"
`,
kubeReserved: "cpu=100m,memory=100Mi,ephemeral-storage=1Gi",
systemReserved: "cpu=200m,memory=200Mi,ephemeral-storage=2Gi",
},
{
conf: `
kubeReserved: "cpu=100m,memory=100Mi,ephemeral-storage=1Gi"
systemReserved: "cpu=200m,memory=200Mi,ephemeral-storage=2Gi"
`,
kubeReserved: "",
systemReserved: "",
},
}
for _, conf := range validConfigs {
confBody := singleAzConfigYaml + conf.conf
c, err := ClusterFromBytes([]byte(confBody))
if err != nil {
t.Errorf("failed to parse config %s: %v", confBody, err)
continue
}
if !reflect.DeepEqual(c.Kubelet.KubeReservedResources, conf.kubeReserved) || !reflect.DeepEqual(c.Kubelet.SystemReservedResources, conf.systemReserved) {
t.Errorf(
"parsed KubeReservedResources (%+v) and/or SystemReservedResources (%+v) settings does not match config: %s",
c.Kubelet.KubeReservedResources,
c.Kubelet.SystemReservedResources,
confBody,
)
}
}
} | explode_data.jsonl/4374 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 570
} | [
2830,
3393,
42,
3760,
1149,
53003,
1155,
353,
8840,
836,
8,
1476,
56322,
84905,
1669,
3056,
1235,
341,
197,
67850,
1843,
914,
198,
197,
16463,
3760,
53003,
256,
914,
198,
197,
40293,
53003,
914,
198,
197,
59403,
197,
197,
515,
298,
67... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestQueryCondition(t *testing.T) {
setup := func() *queryConditionTestContext {
ctx := &queryConditionTestContext{}
store := mockstore.NewSQLStoreMock()
store.ExpectedDatasource = &models.DataSource{Id: 1, Type: "graphite"}
ctx.reducer = `{"type":"avg"}`
ctx.evaluator = `{"type":"gt","params":[100]}`
ctx.result = &alerting.EvalContext{
Ctx: context.Background(),
Rule: &alerting.Rule{},
RequestValidator: &validations.OSSPluginRequestValidator{},
Store: store,
}
return ctx
}
t.Run("Can read query condition from json model", func(t *testing.T) {
ctx := setup()
_, err := ctx.exec(t)
require.Nil(t, err)
require.Equal(t, "5m", ctx.condition.Query.From)
require.Equal(t, "now", ctx.condition.Query.To)
require.Equal(t, int64(1), ctx.condition.Query.DatasourceID)
t.Run("Can read query reducer", func(t *testing.T) {
reducer := ctx.condition.Reducer
require.Equal(t, "avg", reducer.Type)
})
t.Run("Can read evaluator", func(t *testing.T) {
evaluator, ok := ctx.condition.Evaluator.(*thresholdEvaluator)
require.True(t, ok)
require.Equal(t, "gt", evaluator.Type)
})
})
t.Run("should fire when avg is above 100", func(t *testing.T) {
ctx := setup()
points := newTimeSeriesPointsFromArgs(120, 0)
ctx.series = legacydata.DataTimeSeriesSlice{legacydata.DataTimeSeries{Name: "test1", Points: points}}
cr, err := ctx.exec(t)
require.Nil(t, err)
require.True(t, cr.Firing)
})
t.Run("should fire when avg is above 100 on dataframe", func(t *testing.T) {
ctx := setup()
ctx.frame = data.NewFrame("",
data.NewField("time", nil, []time.Time{time.Now(), time.Now()}),
data.NewField("val", nil, []int64{120, 150}),
)
cr, err := ctx.exec(t)
require.Nil(t, err)
require.True(t, cr.Firing)
})
t.Run("Should not fire when avg is below 100", func(t *testing.T) {
ctx := setup()
points := newTimeSeriesPointsFromArgs(90, 0)
ctx.series = legacydata.DataTimeSeriesSlice{legacydata.DataTimeSeries{Name: "test1", Points: points}}
cr, err := ctx.exec(t)
require.Nil(t, err)
require.False(t, cr.Firing)
})
t.Run("Should not fire when avg is below 100 on dataframe", func(t *testing.T) {
ctx := setup()
ctx.frame = data.NewFrame("",
data.NewField("time", nil, []time.Time{time.Now(), time.Now()}),
data.NewField("val", nil, []int64{12, 47}),
)
cr, err := ctx.exec(t)
require.Nil(t, err)
require.False(t, cr.Firing)
})
t.Run("Should fire if only first series matches", func(t *testing.T) {
ctx := setup()
ctx.series = legacydata.DataTimeSeriesSlice{
legacydata.DataTimeSeries{Name: "test1", Points: newTimeSeriesPointsFromArgs(120, 0)},
legacydata.DataTimeSeries{Name: "test2", Points: newTimeSeriesPointsFromArgs(0, 0)},
}
cr, err := ctx.exec(t)
require.Nil(t, err)
require.True(t, cr.Firing)
})
t.Run("No series", func(t *testing.T) {
ctx := setup()
t.Run("Should set NoDataFound when condition is gt", func(t *testing.T) {
ctx.series = legacydata.DataTimeSeriesSlice{}
cr, err := ctx.exec(t)
require.Nil(t, err)
require.False(t, cr.Firing)
require.True(t, cr.NoDataFound)
})
t.Run("Should be firing when condition is no_value", func(t *testing.T) {
ctx.evaluator = `{"type": "no_value", "params": []}`
ctx.series = legacydata.DataTimeSeriesSlice{}
cr, err := ctx.exec(t)
require.Nil(t, err)
require.True(t, cr.Firing)
})
})
t.Run("Empty series", func(t *testing.T) {
ctx := setup()
t.Run("Should set Firing if eval match", func(t *testing.T) {
ctx.evaluator = `{"type": "no_value", "params": []}`
ctx.series = legacydata.DataTimeSeriesSlice{
legacydata.DataTimeSeries{Name: "test1", Points: newTimeSeriesPointsFromArgs()},
}
cr, err := ctx.exec(t)
require.Nil(t, err)
require.True(t, cr.Firing)
})
t.Run("Should set NoDataFound both series are empty", func(t *testing.T) {
ctx.series = legacydata.DataTimeSeriesSlice{
legacydata.DataTimeSeries{Name: "test1", Points: newTimeSeriesPointsFromArgs()},
legacydata.DataTimeSeries{Name: "test2", Points: newTimeSeriesPointsFromArgs()},
}
cr, err := ctx.exec(t)
require.Nil(t, err)
require.True(t, cr.NoDataFound)
})
t.Run("Should set NoDataFound both series contains null", func(t *testing.T) {
ctx.series = legacydata.DataTimeSeriesSlice{
legacydata.DataTimeSeries{Name: "test1", Points: legacydata.DataTimeSeriesPoints{legacydata.DataTimePoint{null.FloatFromPtr(nil), null.FloatFrom(0)}}},
legacydata.DataTimeSeries{Name: "test2", Points: legacydata.DataTimeSeriesPoints{legacydata.DataTimePoint{null.FloatFromPtr(nil), null.FloatFrom(0)}}},
}
cr, err := ctx.exec(t)
require.Nil(t, err)
require.True(t, cr.NoDataFound)
})
t.Run("Should not set NoDataFound if one series is empty", func(t *testing.T) {
ctx.series = legacydata.DataTimeSeriesSlice{
legacydata.DataTimeSeries{Name: "test1", Points: newTimeSeriesPointsFromArgs()},
legacydata.DataTimeSeries{Name: "test2", Points: newTimeSeriesPointsFromArgs(120, 0)},
}
cr, err := ctx.exec(t)
require.Nil(t, err)
require.False(t, cr.NoDataFound)
})
})
} | explode_data.jsonl/32630 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 2143
} | [
2830,
3393,
2859,
10547,
1155,
353,
8840,
836,
8,
341,
84571,
1669,
2915,
368,
353,
1631,
10547,
2271,
1972,
341,
197,
20985,
1669,
609,
1631,
10547,
2271,
1972,
16094,
197,
57279,
1669,
7860,
4314,
7121,
6688,
6093,
11571,
741,
197,
57... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestGenreService_Index(t *testing.T) {
f, err := ioutil.ReadFile(testGenreList)
if err != nil {
t.Fatal(err)
}
init := make([]*Genre, 0)
err = json.Unmarshal(f, &init)
if err != nil {
t.Fatal(err)
}
tests := []struct {
name string
file string
opts []Option
wantGenres []*Genre
wantErr error
}{
{"Valid response", testGenreList, []Option{SetLimit(5)}, init, nil},
{"Empty response", testFileEmpty, nil, nil, errInvalidJSON},
{"Invalid option", testFileEmpty, []Option{SetOffset(-99999)}, nil, ErrOutOfRange},
{"No results", testFileEmptyArray, nil, nil, ErrNoResults},
}
for _, test := range tests {
t.Run(test.name, func(t *testing.T) {
ts, c, err := testServerFile(http.StatusOK, test.file)
if err != nil {
t.Fatal(err)
}
defer ts.Close()
gen, err := c.Genres.Index(test.opts...)
if errors.Cause(err) != test.wantErr {
t.Errorf("got: <%v>, want: <%v>", errors.Cause(err), test.wantErr)
}
if !reflect.DeepEqual(gen, test.wantGenres) {
t.Errorf("got: <%v>, \nwant: <%v>", gen, test.wantGenres)
}
})
}
} | explode_data.jsonl/41086 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 497
} | [
2830,
3393,
37525,
1860,
50361,
1155,
353,
8840,
836,
8,
341,
1166,
11,
1848,
1669,
43144,
78976,
8623,
37525,
852,
340,
743,
1848,
961,
2092,
341,
197,
3244,
26133,
3964,
340,
197,
630,
28248,
1669,
1281,
85288,
37525,
11,
220,
15,
3... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 4 |
func TestChannelsService_DeleteVideo(t *testing.T) {
setup()
defer teardown()
mux.HandleFunc("/channels/ch/videos/1", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "DELETE")
})
_, err := client.Channels.DeleteVideo("ch", 1)
if err != nil {
t.Errorf("Channels.DeleteVideo returned unexpected error: %v", err)
}
} | explode_data.jsonl/49789 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 132
} | [
2830,
3393,
35925,
1860,
57418,
10724,
1155,
353,
8840,
836,
8,
341,
84571,
741,
16867,
49304,
2822,
2109,
2200,
63623,
4283,
32425,
21284,
72945,
14,
16,
497,
2915,
3622,
1758,
37508,
11,
435,
353,
1254,
9659,
8,
341,
197,
18185,
3523,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestTraceExporter_NilLogger(t *testing.T) {
te, err := NewTraceExporter(fakeTraceExporterConfig, nil, newTraceDataPusher(nil))
require.Nil(t, te)
require.Equal(t, errNilLogger, err)
} | explode_data.jsonl/70306 | {
"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,
6550,
88025,
1604,
321,
7395,
1155,
353,
8840,
836,
8,
341,
197,
665,
11,
1848,
1669,
1532,
6550,
88025,
74138,
6550,
88025,
2648,
11,
2092,
11,
501,
6550,
1043,
16644,
261,
27907,
1171,
17957,
59678,
1155,
11,
1013,
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 |
func TestPrivateActivityNoHeatmapHasContentForOtherUser(t *testing.T) {
defer prepareTestEnv(t)()
testPrivateActivityDoSomethingForActionEntries(t)
session := loginUser(t, privateActivityTestOtherUser)
hasContent := testPrivateActivityHelperHasHeatmapContentFromSession(t, session)
assert.True(t, hasContent, "user should have heatmap content")
} | explode_data.jsonl/51665 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 102
} | [
2830,
3393,
16787,
4052,
2753,
61306,
2186,
10281,
2762,
2461,
11409,
1474,
1155,
353,
8840,
836,
8,
341,
16867,
10549,
2271,
14359,
1155,
8,
741,
18185,
16787,
4052,
5404,
23087,
2461,
2512,
24533,
1155,
692,
25054,
1669,
87169,
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 TestInputBuilderFactoryForAzurePlan(t *testing.T) {
// given
var (
inputComponentList = fixKymaComponentList()
mappedComponentList = mapToGQLComponentConfigurationInput(inputComponentList)
toDisableComponents = []string{"kiali"}
kebOverrides = []*gqlschema.ConfigEntryInput{
{Key: "key-1", Value: "pico"},
{Key: "key-2", Value: "bello", Secret: ptr.Bool(true)},
}
)
optComponentsSvc := &automock.OptionalComponentService{}
defer optComponentsSvc.AssertExpectations(t)
optComponentsSvc.On("ComputeComponentsToDisable", []string{}).Return(toDisableComponents)
optComponentsSvc.On("ExecuteDisablers", mappedComponentList, toDisableComponents[0]).Return(mappedComponentList, nil)
config := Config{
URL: "",
}
componentsProvider := &automock.ComponentListProvider{}
componentsProvider.On("AllComponents", mock.AnythingOfType("string")).Return(inputComponentList, nil)
defer componentsProvider.AssertExpectations(t)
factory, err := NewInputBuilderFactory(optComponentsSvc, runtime.NewDisabledComponentsProvider(),
componentsProvider, config, "1.10.0", fixTrialRegionMapping())
assert.NoError(t, err)
pp := fixProvisioningParameters(broker.AzurePlanID, "")
// when
builder, err := factory.CreateProvisionInput(pp, internal.RuntimeVersionData{Version: "1.10.0", Origin: internal.Defaults})
// then
require.NoError(t, err)
// when
shootName := "c-51bcc12"
input, err := builder.
SetProvisioningParameters(internal.ProvisioningParameters{
Parameters: internal.ProvisioningParametersDTO{
Name: "azure-cluster",
TargetSecret: ptr.String("azure-secret"),
Purpose: ptr.String("development"),
},
}).
SetShootName(shootName).
SetLabel("label1", "value1").
AppendOverrides("keb", kebOverrides).CreateProvisionRuntimeInput()
// then
require.NoError(t, err)
assert.EqualValues(t, mappedComponentList, input.KymaConfig.Components)
assert.Contains(t, input.RuntimeInput.Name, "azure-cluster")
assert.Equal(t, "azure", input.ClusterConfig.GardenerConfig.Provider)
assert.Equal(t, "azure-secret", input.ClusterConfig.GardenerConfig.TargetSecret)
require.NotNil(t, input.ClusterConfig.GardenerConfig.Purpose)
assert.Equal(t, "development", *input.ClusterConfig.GardenerConfig.Purpose)
assert.Nil(t, input.ClusterConfig.GardenerConfig.LicenceType)
assert.EqualValues(t, mappedComponentList, input.KymaConfig.Components)
assert.Equal(t, shootName, input.ClusterConfig.GardenerConfig.Name)
assert.Equal(t, &gqlschema.Labels{
"label1": "value1",
}, input.RuntimeInput.Labels)
assertOverrides(t, "keb", input.KymaConfig.Components, kebOverrides)
} | explode_data.jsonl/69386 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 951
} | [
2830,
3393,
2505,
89139,
2461,
78107,
20485,
1155,
353,
8840,
836,
8,
341,
197,
322,
2661,
198,
2405,
2399,
197,
22427,
2189,
852,
220,
284,
5046,
42,
1600,
64,
2189,
852,
741,
197,
2109,
5677,
2189,
852,
284,
2415,
1249,
38,
3588,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestValueBinder_CustomFuncWithError(t *testing.T) {
c := createTestContext("/search?nr=en&id=1&id=101", nil, nil)
b := QueryParamsBinder(c)
id := int64(99)
givenCustomFunc := func(values []string) []error {
assert.Equal(t, []string{"1", "101"}, values)
return []error{
errors.New("first error"),
errors.New("second error"),
}
}
err := b.CustomFunc("id", givenCustomFunc).BindError()
assert.Equal(t, int64(99), id)
assert.EqualError(t, err, "first error")
} | explode_data.jsonl/82535 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 193
} | [
2830,
3393,
1130,
44055,
57402,
9626,
66102,
1155,
353,
8840,
836,
8,
341,
1444,
1669,
1855,
2271,
1972,
4283,
1836,
30,
19618,
61757,
42621,
28,
16,
42621,
28,
16,
15,
16,
497,
2092,
11,
2092,
340,
2233,
1669,
11361,
4870,
44055,
133... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestBackupErrors(t *testing.T) {
if runtime.GOOS == "windows" {
return
}
env, cleanup := withTestEnvironment(t)
defer cleanup()
testSetupBackupData(t, env)
// Assume failure
inaccessibleFile := filepath.Join(env.testdata, "0", "0", "9", "0")
rtest.OK(t, os.Chmod(inaccessibleFile, 0000))
defer func() {
rtest.OK(t, os.Chmod(inaccessibleFile, 0644))
}()
opts := BackupOptions{}
gopts := env.gopts
gopts.stderr = ioutil.Discard
err := testRunBackupAssumeFailure(t, filepath.Dir(env.testdata), []string{"testdata"}, opts, gopts)
rtest.Assert(t, err != nil, "Assumed failure, but no error occurred.")
rtest.Assert(t, err == ErrInvalidSourceData, "Wrong error returned")
snapshotIDs := testRunList(t, "snapshots", env.gopts)
rtest.Assert(t, len(snapshotIDs) == 1,
"expected one snapshot, got %v", snapshotIDs)
} | explode_data.jsonl/43547 | {
"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,
56245,
13877,
1155,
353,
8840,
836,
8,
341,
743,
15592,
97574,
3126,
621,
330,
27077,
1,
341,
197,
853,
198,
197,
532,
57538,
11,
21290,
1669,
448,
2271,
12723,
1155,
340,
16867,
21290,
2822,
18185,
21821,
56245,
1043,
1155,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestModifiersInMultipaths(t *testing.T) {
AddModifier("case", func(jsonStr, arg string) string {
if arg == "upper" {
return strings.ToUpper(jsonStr)
}
if arg == "lower" {
return strings.ToLower(jsonStr)
}
return jsonStr
})
jsonStr := `{"friends": [
{"age": 44, "first": "Dale", "last": "Murphy"},
{"age": 68, "first": "Roger", "last": "Craig"},
{"age": 47, "first": "Jane", "last": "Murphy"}
]}`
res := Get(jsonStr, `friends.#.{age,first|@case:upper}|@ugly`)
exp := `[{"age":44,"@case:upper":"DALE"},{"age":68,"@case:upper":"ROGER"},{"age":47,"@case:upper":"JANE"}]`
assert(t, res.Raw == exp)
res = Get(jsonStr, `{friends.#.{age,first:first|@case:upper}|0.first}`)
exp = `{"first":"DALE"}`
assert(t, res.Raw == exp)
res = Get(readmeJSON, `{"children":children|@case:upper,"name":name.first,"age":age}`)
exp = `{"children":["SARA","ALEX","JACK"],"name":"Tom","age":37}`
assert(t, res.Raw == exp)
} | explode_data.jsonl/43473 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 392
} | [
2830,
3393,
66937,
641,
57251,
26286,
1155,
353,
8840,
836,
8,
341,
37972,
34405,
445,
5638,
497,
2915,
9304,
2580,
11,
1392,
914,
8,
914,
341,
197,
743,
1392,
621,
330,
13574,
1,
341,
298,
853,
9069,
49396,
9304,
2580,
340,
197,
19... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
func TestUsageSingleTenant(t *testing.T) {
// TODO(emilien): This test is failing for now
t.Skip("This is not passing now, will fix later")
clients.RequireLong(t)
client, err := clients.NewComputeV2Client()
th.AssertNoErr(t, err)
server, err := CreateServer(t, client)
th.AssertNoErr(t, err)
DeleteServer(t, client, server)
endpointParts := strings.Split(client.Endpoint, "/")
tenantID := endpointParts[4]
end := time.Now()
start := end.AddDate(0, -1, 0)
opts := usage.SingleTenantOpts{
Start: &start,
End: &end,
}
err = usage.SingleTenant(client, tenantID, opts).EachPage(func(page pagination.Page) (bool, error) {
tenantUsage, err := usage.ExtractSingleTenant(page)
th.AssertNoErr(t, err)
tools.PrintResource(t, tenantUsage)
if tenantUsage.TotalHours == 0 {
t.Fatalf("TotalHours should not be 0")
}
return true, nil
})
th.AssertNoErr(t, err)
} | explode_data.jsonl/69634 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 350
} | [
2830,
3393,
14783,
10888,
71252,
1155,
353,
8840,
836,
8,
341,
197,
322,
5343,
52073,
321,
3591,
1648,
1096,
1273,
374,
21394,
369,
1431,
198,
3244,
57776,
445,
1986,
374,
537,
12299,
1431,
11,
686,
5046,
2937,
5130,
197,
31869,
81288,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestDaoReportUser(t *testing.T) {
var (
c = context.TODO()
id = int64(0)
)
convey.Convey("ReportUser", t, func(ctx convey.C) {
res, err := d.ReportUser(c, id)
ctx.Convey("Then err should be nil.res should not be nil.", func(ctx convey.C) {
ctx.So(err, convey.ShouldBeNil)
ctx.So(res, convey.ShouldNotBeNil)
})
})
} | explode_data.jsonl/51294 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 152
} | [
2830,
3393,
12197,
10361,
1474,
1155,
353,
8840,
836,
8,
341,
2405,
2399,
197,
1444,
220,
284,
2266,
90988,
741,
197,
15710,
284,
526,
21,
19,
7,
15,
340,
197,
340,
37203,
5617,
4801,
5617,
445,
10361,
1474,
497,
259,
11,
2915,
7502... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestDecodeAccountStore(t *testing.T) {
cdc := makeTestCodec()
acc := auth.NewBaseAccountWithAddress(delAddr1)
globalAccNumber := uint64(10)
kvPairs := cmn.KVPairs{
cmn.KVPair{Key: auth.AddressStoreKey(delAddr1), Value: cdc.MustMarshalBinaryBare(acc)},
cmn.KVPair{Key: auth.GlobalAccountNumberKey, Value: cdc.MustMarshalBinaryLengthPrefixed(globalAccNumber)},
cmn.KVPair{Key: []byte{0x99}, Value: []byte{0x99}},
}
tests := []struct {
name string
expectedLog string
}{
{"Minter", fmt.Sprintf("%v\n%v", acc, acc)},
{"GlobalAccNumber", fmt.Sprintf("GlobalAccNumberA: %d\nGlobalAccNumberB: %d", globalAccNumber, globalAccNumber)},
{"other", ""},
}
for i, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
switch i {
case len(tests) - 1:
require.Panics(t, func() { DecodeAccountStore(cdc, cdc, kvPairs[i], kvPairs[i]) }, tt.name)
default:
require.Equal(t, tt.expectedLog, DecodeAccountStore(cdc, cdc, kvPairs[i], kvPairs[i]), tt.name)
}
})
}
} | explode_data.jsonl/13738 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 436
} | [
2830,
3393,
32564,
7365,
6093,
1155,
353,
8840,
836,
8,
341,
1444,
7628,
1669,
1281,
2271,
36913,
741,
197,
4475,
1669,
4166,
7121,
3978,
7365,
2354,
4286,
55927,
13986,
16,
340,
18842,
14603,
2833,
1669,
2622,
21,
19,
7,
16,
15,
692,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestStaleIfErrorRequest(t *testing.T) {
resetTest()
now := time.Now()
tmock := transportMock{
response: &http.Response{
Status: http.StatusText(http.StatusOK),
StatusCode: http.StatusOK,
Header: http.Header{
"Date": []string{now.Format(time.RFC1123)},
"Cache-Control": []string{"no-cache"},
},
Body: ioutil.NopCloser(bytes.NewBuffer([]byte("some data"))),
},
err: nil,
}
tp := NewMemoryCacheTransport()
tp.Transport = &tmock
// First time, response is cached on success
r, _ := http.NewRequest("GET", "http://somewhere.com/", nil)
r.Header.Set("Cache-Control", "stale-if-error")
resp, err := tp.RoundTrip(r)
if err != nil {
t.Fatal(err)
}
if resp == nil {
t.Fatal("resp is nil")
}
_, err = ioutil.ReadAll(resp.Body)
if err != nil {
t.Fatal(err)
}
// On failure, response is returned from the cache
tmock.response = nil
tmock.err = errors.New("some error")
resp, err = tp.RoundTrip(r)
if err != nil {
t.Fatal(err)
}
if resp == nil {
t.Fatal("resp is nil")
}
} | explode_data.jsonl/77640 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 446
} | [
2830,
3393,
623,
1574,
2679,
1454,
1900,
1155,
353,
8840,
836,
8,
341,
70343,
2271,
741,
80922,
1669,
882,
13244,
741,
3244,
16712,
1669,
7557,
11571,
515,
197,
21735,
25,
609,
1254,
12574,
515,
298,
58321,
25,
257,
1758,
10538,
1178,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestMaxAcceptedHTLCs(t *testing.T) {
t.Parallel()
// We'll kick off the test by creating our channels which both are
// loaded with 5 BTC each.
aliceChannel, bobChannel, cleanUp, err := CreateTestChannels()
if err != nil {
t.Fatalf("unable to create test channels: %v", err)
}
defer cleanUp()
// One over the maximum number of HTLCs that either can accept.
const numHTLCs = 20
const numHTLCsReceived = 12
// Set the remote's required MaxAcceptedHtlcs. This means that alice
// can only offer the remote up to numHTLCs HTLCs.
aliceChannel.localChanCfg.MaxAcceptedHtlcs = numHTLCs
bobChannel.remoteChanCfg.MaxAcceptedHtlcs = numHTLCs
// Similarly, set the remote config's MaxAcceptedHtlcs. This means
// that the remote will be aware that Alice will only accept up to
// numHTLCsRecevied at a time.
aliceChannel.remoteChanCfg.MaxAcceptedHtlcs = numHTLCsReceived
bobChannel.localChanCfg.MaxAcceptedHtlcs = numHTLCsReceived
// Each HTLC amount is 0.1 BTC.
htlcAmt := lnwire.NewMSatFromSatoshis(0.1 * btcutil.SatoshiPerBitcoin)
// Send the maximum allowed number of HTLCs.
for i := 0; i < numHTLCs; i++ {
htlc, _ := createHTLC(i, htlcAmt)
if _, err := aliceChannel.AddHTLC(htlc, nil); err != nil {
t.Fatalf("unable to add htlc: %v", err)
}
if _, err := bobChannel.ReceiveHTLC(htlc); err != nil {
t.Fatalf("unable to recv htlc: %v", err)
}
}
// The next HTLC should fail with ErrMaxHTLCNumber.
htlc, _ := createHTLC(numHTLCs, htlcAmt)
_, err = aliceChannel.AddHTLC(htlc, nil)
if err != ErrMaxHTLCNumber {
t.Fatalf("expected ErrMaxHTLCNumber, instead received: %v", err)
}
// After receiving the next HTLC, next state transition should fail
// with ErrMaxHTLCNumber.
if _, err := bobChannel.ReceiveHTLC(htlc); err != nil {
t.Fatalf("unable to recv htlc: %v", err)
}
err = forceStateTransition(aliceChannel, bobChannel)
if err != ErrMaxHTLCNumber {
t.Fatalf("expected ErrMaxHTLCNumber, instead received: %v", err)
}
} | explode_data.jsonl/46449 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 742
} | [
2830,
3393,
5974,
65906,
2545,
8556,
82,
1155,
353,
8840,
836,
8,
341,
3244,
41288,
7957,
2822,
197,
322,
1205,
3278,
10323,
1007,
279,
1273,
553,
6825,
1039,
11744,
892,
2176,
525,
198,
197,
322,
6661,
448,
220,
20,
36045,
1817,
624,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestValidateOverhead(t *testing.T) {
successCase := []struct {
Name string
overhead core.ResourceList
}{
{
Name: "Valid Overhead for CPU + Memory",
overhead: core.ResourceList{
core.ResourceName(core.ResourceCPU): resource.MustParse("10"),
core.ResourceName(core.ResourceMemory): resource.MustParse("10G"),
},
},
}
for _, tc := range successCase {
if errs := validateOverhead(tc.overhead, field.NewPath("overheads")); len(errs) != 0 {
t.Errorf("%q unexpected error: %v", tc.Name, errs)
}
}
errorCase := []struct {
Name string
overhead core.ResourceList
}{
{
Name: "Invalid Overhead Resources",
overhead: core.ResourceList{
core.ResourceName("my.org"): resource.MustParse("10m"),
},
},
}
for _, tc := range errorCase {
if errs := validateOverhead(tc.overhead, field.NewPath("resources")); len(errs) == 0 {
t.Errorf("%q expected error", tc.Name)
}
}
} | explode_data.jsonl/25702 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 374
} | [
2830,
3393,
17926,
1918,
1983,
1155,
353,
8840,
836,
8,
341,
30553,
4207,
1669,
3056,
1235,
341,
197,
21297,
257,
914,
198,
197,
197,
1975,
1983,
6200,
20766,
852,
198,
197,
59403,
197,
197,
515,
298,
21297,
25,
330,
4088,
6065,
1983,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestRejectBadTransformer(t *testing.T) {
g := gomega.NewGomegaWithT(t)
isvc := makeTestInferenceService()
isvc.Spec.Default.Transformer = &TransformerSpec{}
g.Expect(isvc.validate(c)).Should(gomega.MatchError(ExactlyOneTransformerViolatedError))
} | explode_data.jsonl/1497 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 95
} | [
2830,
3393,
78413,
17082,
46358,
1155,
353,
8840,
836,
8,
341,
3174,
1669,
342,
32696,
7121,
38,
32696,
2354,
51,
1155,
340,
19907,
7362,
1669,
1281,
2271,
641,
2202,
1860,
741,
19907,
7362,
36473,
13275,
11815,
34527,
284,
609,
46358,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestSignature_Verify(t *testing.T) {
sign := "9BTmNxD/GsDQog3GdLZ9yUfzSnTc9ZJbvILMW+Hsxjo="
date := "1635008381"
path := "/v1/pay/method"
method := "POST"
params := `{
"port": "h5",
"area": "china",
"currency": "CNY"
}`
err := New(key, secret, ttl).Verify(path, method, json.RawMessage(params), sign, date)
t.Log(err)
} | explode_data.jsonl/40095 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 168
} | [
2830,
3393,
25088,
2334,
261,
1437,
1155,
353,
8840,
836,
8,
1476,
69054,
1669,
330,
24,
17602,
76,
45,
15764,
15792,
82,
35,
48,
538,
18,
38,
67,
43,
57,
24,
88,
52,
69,
89,
20720,
51,
66,
24,
57,
41,
54929,
1715,
54173,
10,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestNamespaceAggregateTilesSkipBootstrappingShards(t *testing.T) {
ctrl := xtest.NewController(t)
defer ctrl.Finish()
ctx := context.NewBackground()
defer ctx.Close()
start := xtime.Now().Truncate(targetBlockSize)
opts, err := NewAggregateTilesOptions(
start, start.Add(targetBlockSize), time.Second, targetNsID, AggregateTilesRegular,
false, false, nil, insOpts)
require.NoError(t, err)
sourceNs, sourceCloser := newTestNamespaceWithIDOpts(t, sourceNsID, namespace.NewOptions())
defer sourceCloser()
sourceNs.bootstrapState = Bootstrapped
sourceRetentionOpts := sourceNs.nopts.RetentionOptions().SetBlockSize(sourceBlockSize)
sourceNs.nopts = sourceNs.nopts.SetRetentionOptions(sourceRetentionOpts)
targetNs, targetCloser := newTestNamespaceWithIDOpts(t, targetNsID, namespace.NewOptions())
defer targetCloser()
targetNs.bootstrapState = Bootstrapped
targetNs.createEmptyWarmIndexIfNotExistsFn = func(blockStart xtime.UnixNano) error {
return nil
}
targetRetentionOpts := targetNs.nopts.RetentionOptions().SetBlockSize(targetBlockSize)
targetNs.nopts = targetNs.nopts.SetColdWritesEnabled(true).SetRetentionOptions(targetRetentionOpts)
targetShard0 := NewMockdatabaseShard(ctrl)
targetShard1 := NewMockdatabaseShard(ctrl)
targetNs.shards[0] = targetShard0
targetNs.shards[1] = targetShard1
targetShard0.EXPECT().IsBootstrapped().Return(false)
targetShard1.EXPECT().IsBootstrapped().Return(false)
targetShard0.EXPECT().ID().Return(uint32(10))
targetShard1.EXPECT().ID().Return(uint32(11))
processedTileCount, err := targetNs.AggregateTiles(ctx, sourceNs, opts)
require.NoError(t, err)
assert.Zero(t, processedTileCount)
} | explode_data.jsonl/35386 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 586
} | [
2830,
3393,
22699,
64580,
58365,
35134,
17919,
495,
3629,
2016,
2347,
1155,
353,
8840,
836,
8,
341,
84381,
1669,
856,
1944,
7121,
2051,
1155,
340,
16867,
23743,
991,
18176,
2822,
20985,
1669,
2266,
7121,
8706,
741,
16867,
5635,
10421,
282... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestStaticSplits(t *testing.T) {
defer leaktest.AfterTest(t)()
splits := config.StaticSplits()
for i := 1; i < len(splits); i++ {
if !splits[i-1].Less(splits[i]) {
t.Errorf("previous split %q should be less than next split %q", splits[i-1], splits[i])
}
}
} | explode_data.jsonl/25322 | {
"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,
11690,
50,
39033,
1155,
353,
8840,
836,
8,
341,
16867,
23352,
1944,
36892,
2271,
1155,
8,
2822,
1903,
39033,
1669,
2193,
58826,
50,
39033,
741,
2023,
600,
1669,
220,
16,
26,
600,
366,
2422,
1141,
39033,
1215,
600,
1027,
34... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestForCompositeResource(t *testing.T) {
name := "coolcomposites.example.org"
labels := map[string]string{"cool": "very"}
annotations := map[string]string{"example.org/cool": "very"}
group := "example.org"
version := "v1beta1"
kind := "CoolComposite"
listKind := "CoolCompositeList"
singular := "coolcomposite"
plural := "coolcomposites"
schema := `{"properties":{"spec":{"properties":{"engineVersion":{"enum":["5.6","5.7"],"type":"string"},"storageGB":{"type":"integer"}},"type":"object"}},"type":"object"}`
d := &v1beta1.CompositeResourceDefinition{
ObjectMeta: metav1.ObjectMeta{
Name: name,
Labels: labels,
Annotations: annotations,
UID: types.UID("you-you-eye-dee"),
},
Spec: v1beta1.CompositeResourceDefinitionSpec{
Group: group,
Names: extv1.CustomResourceDefinitionNames{
Plural: plural,
Singular: singular,
Kind: kind,
ListKind: listKind,
},
Versions: []v1beta1.CompositeResourceDefinitionVersion{{
Name: version,
Referenceable: true,
Served: true,
Schema: &v1beta1.CompositeResourceValidation{
OpenAPIV3Schema: runtime.RawExtension{Raw: []byte(schema)},
},
}},
},
}
want := &extv1.CustomResourceDefinition{
ObjectMeta: metav1.ObjectMeta{
Name: name,
Labels: labels,
Annotations: annotations,
OwnerReferences: []metav1.OwnerReference{
meta.AsController(meta.TypedReferenceTo(d, v1beta1.CompositeResourceDefinitionGroupVersionKind)),
},
},
Spec: extv1.CustomResourceDefinitionSpec{
Group: group,
Names: extv1.CustomResourceDefinitionNames{
Plural: plural,
Singular: singular,
Kind: kind,
ListKind: listKind,
Categories: []string{CategoryComposite},
},
Scope: extv1.ClusterScoped,
Versions: []extv1.CustomResourceDefinitionVersion{{
Name: version,
Served: true,
Storage: true,
Subresources: &extv1.CustomResourceSubresources{
Status: &extv1.CustomResourceSubresourceStatus{},
},
AdditionalPrinterColumns: []extv1.CustomResourceColumnDefinition{
{
Name: "READY",
Type: "string",
JSONPath: ".status.conditions[?(@.type=='Ready')].status",
},
{
Name: "COMPOSITION",
Type: "string",
JSONPath: ".spec.compositionRef.name",
},
},
Schema: &extv1.CustomResourceValidation{
OpenAPIV3Schema: &extv1.JSONSchemaProps{
Type: "object",
Properties: map[string]extv1.JSONSchemaProps{
"apiVersion": {
Type: "string",
},
"kind": {
Type: "string",
},
"metadata": {
// NOTE(muvaf): api-server takes care of validating
// metadata.
Type: "object",
},
"spec": {
Type: "object",
Properties: map[string]extv1.JSONSchemaProps{
// From CRDSpecTemplate.Validation
"storageGB": {Type: "integer"},
"engineVersion": {
Type: "string",
Enum: []extv1.JSON{
{Raw: []byte(`"5.6"`)},
{Raw: []byte(`"5.7"`)},
},
},
// From CompositeResourceSpecProps()
"compositionRef": {
Type: "object",
Required: []string{"name"},
Properties: map[string]extv1.JSONSchemaProps{
"name": {Type: "string"},
},
},
"compositionSelector": {
Type: "object",
Required: []string{"matchLabels"},
Properties: map[string]extv1.JSONSchemaProps{
"matchLabels": {
Type: "object",
AdditionalProperties: &extv1.JSONSchemaPropsOrBool{
Allows: true,
Schema: &extv1.JSONSchemaProps{Type: "string"},
},
},
},
},
"claimRef": {
Type: "object",
Required: []string{"apiVersion", "kind", "namespace", "name"},
Properties: map[string]extv1.JSONSchemaProps{
"apiVersion": {Type: "string"},
"kind": {Type: "string"},
"namespace": {Type: "string"},
"name": {Type: "string"},
},
},
"resourceRefs": {
Type: "array",
Items: &extv1.JSONSchemaPropsOrArray{
Schema: &extv1.JSONSchemaProps{
Type: "object",
Properties: map[string]extv1.JSONSchemaProps{
"apiVersion": {Type: "string"},
"name": {Type: "string"},
"kind": {Type: "string"},
"uid": {Type: "string"},
},
Required: []string{"apiVersion", "kind", "name"},
},
},
},
"writeConnectionSecretToRef": {
Type: "object",
Required: []string{"name", "namespace"},
Properties: map[string]extv1.JSONSchemaProps{
"name": {Type: "string"},
"namespace": {Type: "string"},
},
},
},
},
"status": {
Type: "object",
Properties: map[string]extv1.JSONSchemaProps{
// From CompositeResourceStatusProps()
"conditions": {
Description: "Conditions of the resource.",
Type: "array",
Items: &extv1.JSONSchemaPropsOrArray{
Schema: &extv1.JSONSchemaProps{
Type: "object",
Required: []string{"lastTransitionTime", "reason", "status", "type"},
Properties: map[string]extv1.JSONSchemaProps{
"lastTransitionTime": {Type: "string", Format: "date-time"},
"message": {Type: "string"},
"reason": {Type: "string"},
"status": {Type: "string"},
"type": {Type: "string"},
},
},
},
},
"connectionDetails": {
Type: "object",
Properties: map[string]extv1.JSONSchemaProps{
"lastPublishedTime": {Type: "string", Format: "date-time"},
},
},
},
},
},
},
},
}},
},
}
got, err := ForCompositeResource(d)
if err != nil {
t.Fatalf("ForCompositeResource(...): %s", err)
}
if diff := cmp.Diff(want, got); diff != "" {
t.Errorf("ForCompositeResource(...): -want, +got:\n%s", diff)
}
} | explode_data.jsonl/19843 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 3305
} | [
2830,
3393,
2461,
41685,
4783,
1155,
353,
8840,
836,
8,
341,
11609,
1669,
330,
42196,
874,
80139,
7724,
2659,
698,
95143,
1669,
2415,
14032,
30953,
4913,
42196,
788,
330,
1204,
16707,
197,
39626,
1669,
2415,
14032,
30953,
4913,
8687,
2659... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestWithCustomBaseURLwithInvalidURL(t *testing.T) {
_, err := Prepare(&http.Request{}, WithCustomBaseURL("hello/{account}.{service}.core.windows.net/",
map[string]interface{}{
"account": "myaccount",
"service": "blob",
}))
if err == nil {
t.Fatalf("autorest: WithCustomBaseURL should fail fo URL parse error")
}
} | explode_data.jsonl/20941 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 130
} | [
2830,
3393,
2354,
10268,
3978,
3144,
4197,
7928,
3144,
1155,
353,
8840,
836,
8,
972,
197,
6878,
1848,
1669,
31166,
2099,
1254,
9659,
22655,
3085,
10268,
3978,
3144,
445,
14990,
9388,
4608,
65884,
7936,
7810,
2153,
68113,
5071,
14,
4723,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestUserStoreGetByAuthData(t *testing.T) {
Setup()
teamId := model.NewId()
auth := "123" + model.NewId()
u1 := &model.User{}
u1.Email = model.NewId()
u1.AuthData = &auth
u1.AuthService = "service"
Must(store.User().Save(u1))
Must(store.Team().SaveMember(&model.TeamMember{TeamId: teamId, UserId: u1.Id}))
if err := (<-store.User().GetByAuth(u1.AuthData, u1.AuthService)).Err; err != nil {
t.Fatal(err)
}
rauth := ""
if err := (<-store.User().GetByAuth(&rauth, "")).Err; err == nil {
t.Fatal("Should have failed because of missing auth data")
}
} | explode_data.jsonl/5099 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 234
} | [
2830,
3393,
1474,
6093,
1949,
1359,
5087,
1043,
1155,
353,
8840,
836,
8,
341,
197,
21821,
2822,
197,
9196,
764,
1669,
1614,
7121,
764,
2822,
78011,
1669,
330,
16,
17,
18,
1,
488,
1614,
7121,
764,
2822,
10676,
16,
1669,
609,
2528,
73... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestExample(t *testing.T) {
for i, tc := range tests {
tc := tc
t.Run(fmt.Sprintf("Test %v", i), func(t *testing.T) {
t.Parallel()
input, err := aoc2020.ReadStringRecords(tc.input)
if err != nil {
t.Errorf(err.Error())
}
rules := ParseRules(input[0])
answer := MatchingMessages(input[1], rules)
assert.Equal(t, tc.answer1, answer)
answer = MatchingMessages2(input[1], rules)
assert.Equal(t, tc.answer2, answer)
})
}
} | explode_data.jsonl/22369 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 207
} | [
2830,
3393,
13314,
1155,
353,
8840,
836,
8,
341,
2023,
600,
11,
17130,
1669,
2088,
7032,
341,
197,
78255,
1669,
17130,
198,
197,
3244,
16708,
28197,
17305,
445,
2271,
1018,
85,
497,
600,
701,
2915,
1155,
353,
8840,
836,
8,
341,
298,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
func TestOpen(t *testing.T) {
const filename = "mmap_test.go"
r, err := Open(filename)
if err != nil {
t.Fatalf("Open: %v", err)
}
got := make([]byte, r.Len())
if _, err := r.ReadAt(got, 0); err != nil && err != io.EOF {
t.Fatalf("ReadAt: %v", err)
}
want, err := ioutil.ReadFile(filename)
if err != nil {
t.Fatalf("ioutil.ReadFile: %v", err)
}
if len(got) != len(want) {
t.Fatalf("got %d bytes, want %d", len(got), len(want))
}
if !bytes.Equal(got, want) {
t.Fatalf("\ngot %q\nwant %q", string(got), string(want))
}
} | explode_data.jsonl/54582 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 251
} | [
2830,
3393,
5002,
1155,
353,
8840,
836,
8,
341,
4777,
3899,
284,
330,
76,
2186,
4452,
18002,
698,
7000,
11,
1848,
1669,
5264,
10961,
340,
743,
1848,
961,
2092,
341,
197,
3244,
30762,
445,
5002,
25,
1018,
85,
497,
1848,
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... | 7 |
func TestWFLevelServiceAccount(t *testing.T) {
woc := newWoc()
woc.execWf.Spec.ServiceAccountName = "foo"
tmplCtx, err := woc.createTemplateContext(wfv1.ResourceScopeLocal, "")
assert.NoError(t, err)
ctx := context.Background()
_, err = woc.executeContainer(ctx, woc.execWf.Spec.Entrypoint, tmplCtx.GetTemplateScope(), &woc.execWf.Spec.Templates[0], &wfv1.WorkflowStep{}, &executeTemplateOpts{})
assert.NoError(t, err)
pods, err := listPods(woc)
assert.NoError(t, err)
assert.Len(t, pods.Items, 1)
pod := pods.Items[0]
assert.Equal(t, pod.Spec.ServiceAccountName, "foo")
} | explode_data.jsonl/75364 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 238
} | [
2830,
3393,
32131,
4449,
1860,
7365,
1155,
353,
8840,
836,
8,
341,
6692,
509,
1669,
501,
54,
509,
741,
6692,
509,
15776,
54,
69,
36473,
13860,
7365,
675,
284,
330,
7975,
698,
3244,
54010,
23684,
11,
1848,
1669,
289,
509,
2520,
7275,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestCreatedUpdatedInt64(t *testing.T) {
assert.NoError(t, PrepareEngine())
type CreatedUpdatedInt64 struct {
Id int64
Name string
Value float64 `xorm:"numeric"`
Created int64 `xorm:"created"`
Created2 int64 `xorm:"created"`
Updated int64 `xorm:"updated"`
}
assertSync(t, &CreatedUpdatedInt64{})
c := &CreatedUpdatedInt64{Name: "test"}
_, err := testEngine.Insert(c)
assert.NoError(t, err)
c2 := new(CreatedUpdatedInt64)
has, err := testEngine.ID(c.Id).Get(c2)
assert.NoError(t, err)
assert.True(t, has)
c2.Value--
_, err = testEngine.ID(c2.Id).Update(c2)
assert.NoError(t, err)
} | explode_data.jsonl/19206 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 271
} | [
2830,
3393,
11694,
16196,
1072,
21,
19,
1155,
353,
8840,
836,
8,
341,
6948,
35699,
1155,
11,
31166,
4571,
12367,
13158,
4290,
16196,
1072,
21,
19,
2036,
341,
197,
67211,
981,
526,
21,
19,
198,
197,
21297,
257,
914,
198,
197,
47399,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestMigrateEmptyRecord(t *testing.T) {
type args struct {
accounts v034accounts.GenesisState
deposits []v034gov.DepositWithMetadata
}
tests := []struct {
name string
args args
}{
{"No Accounts", args{v034accounts.GenesisState{}, []v034gov.DepositWithMetadata{}}},
{"Deposited account", args{v034accounts.GenesisState{accountDeposited}, []v034gov.DepositWithMetadata{deposit}}},
{"Burned account", args{v034accounts.GenesisState{accountBurned}, []v034gov.DepositWithMetadata{}}},
{"Burned and deposited accounts", args{v034accounts.GenesisState{accountDeposited, accountBurned}, []v034gov.DepositWithMetadata{deposit}}},
}
for _, tt := range tests {
tt := tt
t.Run(tt.name, func(t *testing.T) {
require.NotPanics(t, func() {
Migrate(
tt.args.accounts,
types.Coins{},
types.DecCoins{},
tt.args.deposits,
v034staking.Validators{},
[]v034staking.UnbondingDelegation{},
[]v034distr.ValidatorOutstandingRewardsRecord{},
types.DefaultBondDenom,
v034distr.ModuleName,
v034gov.ModuleName,
)
})
})
}
} | explode_data.jsonl/20850 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 456
} | [
2830,
3393,
44,
34479,
3522,
6471,
1155,
353,
8840,
836,
8,
1476,
13158,
2827,
2036,
341,
197,
197,
26206,
348,
15,
18,
19,
26206,
65384,
13774,
1397,
198,
197,
58351,
966,
1199,
3056,
85,
15,
18,
19,
53203,
34848,
34054,
2354,
14610,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestUintJsonUnmarshalAndMarshal(t *testing.T) {
var ts TestUintStruct
jstr := `{"int":10,"float":1.0,"bool":true,"string":"50","null_value":null}`
expected := `{"int":10,"float":1,"bool":1,"string":50,"null_value":null}`
err := json.Unmarshal([]byte(jstr), &ts)
if err != nil {
t.Errorf("Not Expected error when json.Unmarshal. error:%v", err.Error())
}
b, err := json.Marshal(ts)
if err != nil {
t.Errorf("Not Expected error when json.Marshal. error:%v", err.Error())
}
actual := string(b)
if actual != expected {
t.Errorf("actual:%s, expected:%s", actual, expected)
}
} | explode_data.jsonl/13388 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 241
} | [
2830,
3393,
21570,
5014,
1806,
27121,
3036,
55438,
1155,
353,
8840,
836,
8,
341,
2405,
10591,
3393,
21570,
9422,
198,
12428,
495,
1669,
1565,
4913,
396,
788,
16,
15,
1335,
3649,
788,
16,
13,
15,
1335,
2641,
788,
1866,
1335,
917,
3252,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestMigrateWrongDeposit(t *testing.T) {
require.Panics(t, func() {
Migrate(
v034accounts.GenesisState{
accountDeposited,
accountBurned,
},
types.Coins{},
types.DecCoins{},
[]v034gov.DepositWithMetadata{
{
ProposalID: 1,
Deposit: v034gov.Deposit{
ProposalID: 1,
Depositor: addr,
Amount: halfCoins,
},
},
},
v034staking.Validators{},
[]v034staking.UnbondingDelegation{},
[]v034distr.ValidatorOutstandingRewardsRecord{},
types.DefaultBondDenom,
v034distr.ModuleName,
v034gov.ModuleName,
)
})
} | explode_data.jsonl/20851 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 295
} | [
2830,
3393,
44,
34479,
29185,
78982,
1155,
353,
8840,
836,
8,
341,
17957,
1069,
276,
1211,
1155,
11,
2915,
368,
341,
197,
9209,
34479,
1006,
298,
5195,
15,
18,
19,
26206,
65384,
13774,
1397,
515,
571,
86866,
7839,
436,
1608,
345,
571,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestParamsQuery(t *testing.T) {
keeper, ctx := testkeeper.OracleKeeper(t)
wctx := sdk.WrapSDKContext(ctx)
params := types.DefaultParams()
keeper.SetParams(ctx, params)
response, err := keeper.Params(wctx, &types.QueryParamsRequest{})
require.NoError(t, err)
require.Equal(t, &types.QueryParamsResponse{Params: params}, response)
} | explode_data.jsonl/28408 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 127
} | [
2830,
3393,
4870,
2859,
1155,
353,
8840,
836,
8,
341,
197,
18861,
11,
5635,
1669,
1273,
18861,
13,
48663,
77233,
1155,
340,
6692,
3773,
1669,
45402,
38968,
31534,
1972,
7502,
340,
25856,
1669,
4494,
13275,
4870,
741,
197,
18861,
4202,
4... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestGenTestFilename(t *testing.T) {
cases := []struct {
str string
want string
}{
{"abc", "Abc"},
{"ABC", "aBC"},
{"AbC", "abC"},
{"αβγ", "Αβγ"},
{"123", "123"},
{"1a2", "1A2"},
{"12a", "12A"},
{"⌘", "⌘"},
}
for _, c := range cases {
got := genTestFilename(c.str)
if c.want != got {
t.Fatalf("str: %q, expected: %q, got: %q", c.str, c.want, got)
}
}
} | explode_data.jsonl/72204 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 226
} | [
2830,
3393,
9967,
2271,
20759,
1155,
353,
8840,
836,
8,
972,
1444,
2264,
1669,
3056,
1235,
972,
197,
11355,
220,
914,
319,
197,
50780,
914,
319,
197,
92,
1666,
197,
197,
4913,
13683,
497,
330,
5830,
66,
45426,
197,
197,
4913,
25411,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestLegacyQueryTaxCaps(t *testing.T) {
input := CreateTestInput(t)
querier := NewLegacyQuerier(input.TreasuryKeeper, input.Cdc)
input.TreasuryKeeper.SetTaxCap(input.Ctx, "ukrw", sdk.NewInt(1000000000))
input.TreasuryKeeper.SetTaxCap(input.Ctx, "usdr", sdk.NewInt(1000000))
input.TreasuryKeeper.SetTaxCap(input.Ctx, "uusd", sdk.NewInt(1200000))
// Get a currency super random; should default to policy coin.
queriedTaxCaps := getQueriedTaxCaps(t, input.Ctx, input.Cdc, querier)
require.Equal(t, queriedTaxCaps,
types.TaxCapsQueryResponse{
{
Denom: "ukrw",
TaxCap: sdk.NewInt(1000000000),
},
{
Denom: "usdr",
TaxCap: sdk.NewInt(1000000),
},
{
Denom: "uusd",
TaxCap: sdk.NewInt(1200000),
},
},
)
} | explode_data.jsonl/6691 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 348
} | [
2830,
3393,
77415,
2859,
31349,
60741,
1155,
353,
8840,
836,
8,
341,
22427,
1669,
4230,
2271,
2505,
1155,
340,
197,
15959,
1268,
1669,
1532,
77415,
2183,
261,
1268,
5384,
836,
265,
26102,
77233,
11,
1946,
727,
7628,
692,
22427,
836,
265... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestResolveTerraformModulesOneModuleWithIncludesNoDependencies(t *testing.T) {
t.Parallel()
moduleB := &TerraformModule{
Path: canonical(t, "../test/fixture-modules/module-b/module-b-child"),
Dependencies: []*TerraformModule{},
Config: config.TerragruntConfig{
Terraform: &config.TerraformConfig{Source: ptr("...")},
IsPartial: true,
},
TerragruntOptions: mockOptions.Clone(canonical(t, "../test/fixture-modules/module-b/module-b-child/"+config.DefaultTerragruntConfigPath)),
}
configPaths := []string{"../test/fixture-modules/module-b/module-b-child/" + config.DefaultTerragruntConfigPath}
expected := []*TerraformModule{moduleB}
actualModules, actualErr := ResolveTerraformModules(configPaths, mockOptions, mockHowThesePathsWereFound)
assert.Nil(t, actualErr, "Unexpected error: %v", actualErr)
assertModuleListsEqual(t, expected, actualModules)
} | explode_data.jsonl/26635 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 330
} | [
2830,
3393,
56808,
51,
13886,
627,
28201,
3966,
3332,
2354,
55834,
2753,
48303,
1155,
353,
8840,
836,
8,
341,
3244,
41288,
7957,
2822,
54020,
33,
1669,
609,
51,
13886,
627,
3332,
515,
197,
69640,
25,
260,
42453,
1155,
11,
7005,
1944,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestRowsImplicitClose(t *testing.T) {
db := newTestDB(t, "people")
defer closeDB(t, db)
rows, err := db.Query("SELECT|people|age,name|")
if err != nil {
t.Fatal(err)
}
want, fail := 2, errors.New("fail")
r := rows.rowsi.(*rowsCursor)
r.errPos, r.err = want, fail
got := 0
for rows.Next() {
got++
}
if got != want {
t.Errorf("got %d rows, want %d", got, want)
}
if err := rows.Err(); err != fail {
t.Errorf("got error %v, want %v", err, fail)
}
if !r.closed {
t.Errorf("r.closed is false, want true")
}
} | explode_data.jsonl/16012 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 240
} | [
2830,
3393,
9024,
59558,
7925,
1155,
353,
8840,
836,
8,
341,
20939,
1669,
501,
2271,
3506,
1155,
11,
330,
16069,
1138,
16867,
3265,
3506,
1155,
11,
2927,
692,
68438,
11,
1848,
1669,
2927,
15685,
445,
4858,
91,
16069,
91,
424,
22006,
9... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 6 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.