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 TestHeadBroadcaster_TrackableCallbackTimeout(t *testing.T) {
t.Parallel()
lggr := logger.TestLogger(t)
broadcaster := headtracker.NewHeadBroadcaster(lggr)
err := broadcaster.Start()
require.NoError(t, err)
slowAwaiter := cltest.NewAwaiter()
fastAwaiter := cltest.NewAwaiter()
slow := &sleepySubscriber{awaiter: slowAwaiter, delay: headtracker.TrackableCallbackTimeout * 2}
fast := &sleepySubscriber{awaiter: fastAwaiter, delay: headtracker.TrackableCallbackTimeout / 2}
_, unsubscribe1 := broadcaster.Subscribe(slow)
_, unsubscribe2 := broadcaster.Subscribe(fast)
broadcaster.BroadcastNewLongestChain(cltest.Head(1))
slowAwaiter.AwaitOrFail(t)
fastAwaiter.AwaitOrFail(t)
require.True(t, slow.contextDone)
require.False(t, fast.contextDone)
unsubscribe1()
unsubscribe2()
err = broadcaster.Close()
require.NoError(t, err)
} | explode_data.jsonl/19968 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 306
} | [
2830,
3393,
12346,
68324,
32020,
21038,
473,
480,
7494,
7636,
1155,
353,
8840,
836,
8,
341,
3244,
41288,
7957,
2822,
8810,
70,
901,
1669,
5925,
8787,
7395,
1155,
340,
2233,
8546,
32020,
1669,
1968,
50395,
7121,
12346,
68324,
32020,
2333,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestNewFunc(t *testing.T) {
t.Parallel()
tests := []struct {
Signature string
Returns string
WantFunc *Func
}{
{
Signature: "transfer(address,uint256)",
Returns: "bool",
WantFunc: &Func{
Signature: "transfer(address,uint256)",
Selector: [4]byte{0xa9, 0x05, 0x9c, 0xbb},
},
},
{
Signature: "transfer(address recipient, uint256 amount)",
Returns: "bool success",
WantFunc: &Func{
Signature: "transfer(address,uint256)",
Selector: [4]byte{0xa9, 0x05, 0x9c, 0xbb},
},
},
}
for i, test := range tests {
t.Run(strconv.Itoa(i), func(t *testing.T) {
gotFunc, err := NewFunc(test.Signature, test.Returns)
if err != nil {
t.Fatalf("Failed to create new FUnc: %v", err)
}
if diff := cmp.Diff(test.WantFunc, gotFunc, cmpopts.IgnoreFields(Func{}, "Args", "Returns")); diff != "" {
t.Fatalf("(-want, +got)\n%s", diff)
}
})
}
} | explode_data.jsonl/68053 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 433
} | [
2830,
3393,
3564,
9626,
1155,
353,
8840,
836,
8,
341,
3244,
41288,
7957,
2822,
78216,
1669,
3056,
1235,
341,
197,
197,
25088,
914,
198,
197,
76086,
256,
914,
198,
197,
17300,
517,
9626,
220,
353,
9626,
198,
197,
59403,
197,
197,
515,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
func TestDownStatuses(t *testing.T) {
for _, status := range downStatuses {
status := status
t.Run(fmt.Sprintf("test down status %d", status), func(t *testing.T) {
server, event := checkServer(t, hbtest.HelloWorldHandler(status))
port, err := hbtest.ServerPort(server)
require.NoError(t, err)
mapvaltest.Test(
t,
mapval.Strict(mapval.Compose(
hbtest.MonitorChecks("http@"+server.URL, server.URL, "127.0.0.1", "http", "down"),
hbtest.RespondingTCPChecks(port),
respondingHTTPChecks(server.URL, status),
hbtest.ErrorChecks(fmt.Sprintf("%d", status), "validate"),
)),
event.Fields,
)
})
}
} | explode_data.jsonl/39390 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 287
} | [
2830,
3393,
4454,
2522,
288,
1155,
353,
8840,
836,
8,
341,
2023,
8358,
2639,
1669,
2088,
1495,
2522,
288,
341,
197,
23847,
1669,
2639,
198,
197,
3244,
16708,
28197,
17305,
445,
1944,
1495,
2639,
1018,
67,
497,
2639,
701,
2915,
1155,
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... | 1 |
func TestCollateral(t *testing.T) {
client := v1.New(&v1.Config{
Key: os.Getenv("BFKEY"),
Secret: os.Getenv("BFSECRET"),
})
col, err := client.Collateral(collateral.New())
assert.NoError(t, err)
fmt.Printf("%+v\n", col)
} | explode_data.jsonl/41202 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 105
} | [
2830,
3393,
15265,
19165,
1155,
353,
8840,
836,
8,
341,
25291,
1669,
348,
16,
7121,
2099,
85,
16,
10753,
515,
197,
55242,
25,
262,
2643,
64883,
445,
19883,
4784,
4461,
197,
7568,
50856,
25,
2643,
64883,
445,
19883,
65310,
4461,
197,
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... | 1 |
func TestObfuscateSQLErrors(t *testing.T) {
helpers.ResetMemoryStats()
testCases := []struct {
input string
expected string
}{
{"\"\"", "result is empty"},
{"{1: 2}", "argument 1 must be str(ing)?, not dict"},
{"None", "argument 1 must be str(ing)?, not None"},
}
for _, c := range testCases {
code := fmt.Sprintf(`
try:
result = datadog_agent.obfuscate_sql(%s)
except Exception as e:
with open(r'%s', 'w') as f:
f.write(str(e))
`, c.input, tmpfile.Name())
out, err := run(code)
if err != nil {
t.Fatal(err)
}
matched, err := regexp.MatchString(c.expected, out)
if err != nil {
t.Fatal(err)
}
if !matched {
t.Fatalf("expected: '%s', found: '%s'", out, c.expected)
}
}
helpers.AssertMemoryUsage(t)
} | explode_data.jsonl/24562 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 338
} | [
2830,
3393,
4121,
51589,
349,
64308,
867,
634,
1087,
1155,
353,
8840,
836,
8,
341,
197,
21723,
36660,
10642,
16635,
2822,
18185,
37302,
1669,
3056,
1235,
341,
197,
22427,
262,
914,
198,
197,
42400,
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 TestModuleDecl(t *testing.T) {
factory := NewCompleteIdlLexerFactoryImpl(
log.New(os.Stdout, "test", 0),
scopedObjects.NewNextNumber(),
scoping.NewScopingContext("", scoping.NewDefaultTypeService(), nil))
t.Run("Empty Module", func(t *testing.T) {
stream := fmt.Sprintf(`
module ABC
{
};`)
controller := gomock.NewController(t)
defer controller.Finish()
reader := bufio.NewReader(strings.NewReader(stream))
actual, _ := factory.Create("(string test)", reader)
mock := NewMockCompleteIdlLexerInstanceWrapper(controller, actual)
mock.EXPECT().CreateModuleDcl(gomock.Any(), "ABC", nil).Times(1)
result := CompleteIdlParse(mock)
assert.Equal(t, 0, result, mock.LastError())
})
t.Run("Module with forward decls", func(t *testing.T) {
stream := fmt.Sprintf(`
module ABC
{
interface IDEF;
interface IGHI;
};
`)
controller := gomock.NewController(t)
defer controller.Finish()
reader := bufio.NewReader(strings.NewReader(stream))
actual, _ := factory.Create("(string test)", reader)
mock := NewMockCompleteIdlLexerInstanceWrapper(controller, actual)
mock.EXPECT().CreateModuleDcl(gomock.Any(), "ABC", gomock.Any()).Times(1)
mock.EXPECT().CreateInterfaceDcl(gomock.Any(), "IDEF", gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).Times(1)
mock.EXPECT().CreateInterfaceDcl(gomock.Any(), "IGHI", gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).Times(1)
result := CompleteIdlParse(mock)
assert.Equal(t, 0, result, mock.LastError())
spec, _ := actual.GetSpec()
assert.NotNil(t, spec)
moduleDcl := spec.(ScopingInterfaces.IIdlModuleDcl)
assert.NotNil(t, moduleDcl)
assert.Equal(t, "ABC", moduleDcl.GetName())
spec = moduleDcl.GetModuleExports()
assert.NotNil(t, spec)
assert.Equal(t, "IDEF", spec.GetName())
spec, _ = spec.GetNextTypeSpec()
assert.NotNil(t, spec)
assert.Equal(t, "IGHI", spec.GetName())
spec, _ = spec.GetNextTypeSpec()
assert.Nil(t, spec)
})
t.Run("Module with forward decls", func(t *testing.T) {
stream := fmt.Sprintf(`
module ABC
{
module DEF
{
interface IGHI;
interface IJKL;
};
struct MNO {
DEF::IGHI a;
};
};
`)
controller := gomock.NewController(t)
defer controller.Finish()
reader := bufio.NewReader(strings.NewReader(stream))
actual, _ := factory.Create("(string test)", reader)
mock := NewMockCompleteIdlLexerInstanceWrapper(controller, actual)
mock.EXPECT().CreateModuleDcl(gomock.Any(), "ABC", gomock.Any()).Times(1)
mock.EXPECT().CreateModuleDcl(gomock.Any(), "DEF", gomock.Any()).Times(1)
mock.EXPECT().CreateInterfaceDcl(gomock.Any(), "IGHI", gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).Times(1)
mock.EXPECT().CreateInterfaceDcl(gomock.Any(), "IJKL", gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).Times(1)
mock.EXPECT().NewStructType(gomock.Any(), "MNO", gomock.Any(), gomock.Any()).Times(1)
result := CompleteIdlParse(mock)
if !assert.Equal(t, 0, result, mock.LastError()) {
return
}
spec, _ := actual.GetSpec()
assert.NotNil(t, spec)
moduleDcl := spec.(ScopingInterfaces.IIdlModuleDcl)
assert.NotNil(t, moduleDcl)
assert.Equal(t, "ABC", moduleDcl.GetName())
spec = moduleDcl.GetModuleExports()
assert.NotNil(t, spec)
moduleDcl = spec.(ScopingInterfaces.IIdlModuleDcl)
assert.NotNil(t, moduleDcl)
assert.NotNil(t, spec)
assert.Equal(t, "DEF", spec.GetName())
spec = moduleDcl.GetModuleExports()
assert.NotNil(t, spec)
assert.Equal(t, "IGHI", spec.GetName())
spec, _ = spec.GetNextTypeSpec()
assert.NotNil(t, spec)
assert.Equal(t, "IJKL", spec.GetName())
spec, _ = spec.GetNextTypeSpec()
assert.Nil(t, spec)
})
} | explode_data.jsonl/22917 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 1551
} | [
2830,
3393,
3332,
21629,
1155,
353,
8840,
836,
8,
341,
1166,
2919,
1669,
1532,
12548,
764,
75,
92847,
4153,
9673,
1006,
197,
6725,
7121,
9638,
83225,
11,
330,
1944,
497,
220,
15,
1326,
197,
29928,
16367,
11543,
7121,
5847,
2833,
3148,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestResponseWriter(t *testing.T) {
rc := httptest.NewRecorder()
rw := newResponseWriter(rc, true)
_, err := rw.Write([]byte("test"))
assert.NoError(t, err)
rw.WriteHeader(202)
assert.Equal(t, 202, rw.status, "status expected 202 but got %d", rw.status)
assert.Len(t, rw.Header(), 1, "Header count expected to be 1")
assert.True(t, rw.statusHeaderWritten, "expected to be true")
assert.Equal(t, "test", rc.Body.String(), "body expected to be test but was %s", rc.Body.String())
} | explode_data.jsonl/52413 | {
"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,
2582,
6492,
1155,
353,
8840,
836,
8,
341,
30295,
1669,
54320,
70334,
7121,
47023,
741,
7000,
86,
1669,
501,
2582,
6492,
35429,
11,
830,
692,
197,
6878,
1848,
1669,
25991,
4073,
10556,
3782,
445,
1944,
5455,
6948,
35699,
1155... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestSimplyOuterJoinWithOnlyOuterExpr(t *testing.T) {
s := createPlannerSuite()
sql := "select * from t t1 right join t t0 ON TRUE where CONCAT_WS(t0.e=t0.e, 0, NULL) IS NULL"
ctx := context.TODO()
stmt, err := s.p.ParseOneStmt(sql, "", "")
require.NoError(t, err)
err = Preprocess(s.ctx, stmt, WithPreprocessorReturn(&PreprocessorReturn{InfoSchema: s.is}))
require.NoError(t, err)
sctx := MockContext()
builder, _ := NewPlanBuilder().Init(sctx, s.is, &hint.BlockHintProcessor{})
domain.GetDomain(sctx).MockInfoCacheAndLoadInfoSchema(s.is)
p, err := builder.Build(ctx, stmt)
require.NoError(t, err)
p, err = logicalOptimize(ctx, builder.optFlag, p.(LogicalPlan))
require.NoError(t, err)
proj, ok := p.(*LogicalProjection)
require.True(t, ok)
join, ok := proj.Children()[0].(*LogicalJoin)
require.True(t, ok)
// previous wrong JoinType is InnerJoin
require.Equal(t, RightOuterJoin, join.JoinType)
} | explode_data.jsonl/50235 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 365
} | [
2830,
3393,
60246,
51322,
12292,
2354,
7308,
51322,
16041,
1155,
353,
8840,
836,
8,
341,
1903,
1669,
1855,
2120,
4887,
28000,
741,
30633,
1669,
330,
1742,
353,
504,
259,
259,
16,
1290,
5138,
259,
259,
15,
6197,
8214,
1380,
78143,
68388,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestActivityService_MarkThreadRead(t *testing.T) {
setup()
defer teardown()
mux.HandleFunc("/notifications/threads/1", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "PATCH")
w.WriteHeader(http.StatusResetContent)
})
_, err := client.Activity.MarkThreadRead("1")
if err != nil {
t.Errorf("Activity.MarkThreadRead returned error: %v", err)
}
} | explode_data.jsonl/6720 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 142
} | [
2830,
3393,
4052,
1860,
1245,
838,
6855,
4418,
1155,
353,
8840,
836,
8,
341,
84571,
741,
16867,
49304,
2822,
2109,
2200,
63623,
4283,
38188,
14,
27286,
14,
16,
497,
2915,
3622,
1758,
37508,
11,
435,
353,
1254,
9659,
8,
341,
197,
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 TestPatternView(t *testing.T) {
// setup current context
utils.SetupContextEnv(t)
// initialize mock server for handling requests
utils.StartMockery(t)
// create a test helper
testContext := utils.NewTestHelper(t)
// get current directory
_, filename, _, ok := runtime.Caller(0)
if !ok {
t.Fatal("Not able to get current working directory")
}
currDir := filepath.Dir(filename)
fixturesDir := filepath.Join(currDir, "fixtures")
// test scenrios for fetching data
tests := []struct {
Name string
Args []string
URL string
Fixture string
Token string
ExpectedResponse string
ExpectError bool
}{
{
Name: "Fetch Filter View",
Args: []string{"view", "KumaTest"},
ExpectedResponse: "view.filter.output.golden",
Fixture: "view.filter.api.response.golden",
URL: testContext.BaseURL + "/api/experimental/filter",
Token: filepath.Join(fixturesDir, "token.golden"),
ExpectError: false,
},
{
Name: "Fetch Kuma Filter View with ID",
Args: []string{"view", "957fbc9b-a655-4892-823d-375102a9587c"},
ExpectedResponse: "view.id.filter.output.golden",
Fixture: "view.id.filter.api.response.golden",
URL: testContext.BaseURL + "/api/experimental/filter/957fbc9b-a655-4892-823d-375102a9587c",
Token: filepath.Join(fixturesDir, "token.golden"),
ExpectError: false,
},
{
Name: "Fetch Filter View for non existing filter",
Args: []string{"view", "xyz"},
ExpectedResponse: "view.nonexisting.filter.output.golden",
Fixture: "view.nonexisting.filter.api.response.golden",
URL: testContext.BaseURL + "/api/experimental/filter",
Token: filepath.Join(fixturesDir, "token.golden"),
ExpectError: false,
},
}
// Run tests
for _, tt := range tests {
t.Run(tt.Name, func(t *testing.T) {
// View api response from golden files
apiResponse := utils.NewGoldenFile(t, tt.Fixture, fixturesDir).Load()
// set token
tokenPath = tt.Token
// mock response
httpmock.RegisterResponder("GET", tt.URL,
httpmock.NewStringResponder(200, apiResponse))
// Expected response
testdataDir := filepath.Join(currDir, "testdata")
golden := utils.NewGoldenFile(t, tt.ExpectedResponse, testdataDir)
// setting up log to grab logs
var buf bytes.Buffer
log.SetOutput(&buf)
utils.SetupLogrusFormatter()
FilterCmd.SetArgs(tt.Args)
err := FilterCmd.Execute()
if err != nil {
// if we're supposed to get an error
if tt.ExpectError {
// write it in file
if *update {
golden.Write(err.Error())
}
expectedResponse := golden.Load()
utils.Equals(t, expectedResponse, err.Error())
return
}
t.Fatal(err)
}
// response being printed in console
output := buf.String()
actualResponse := output
// write it in file
if *update {
golden.Write(actualResponse)
}
expectedResponse := golden.Load()
utils.Equals(t, expectedResponse, actualResponse)
})
}
// stop mock server
utils.StopMockery(t)
} | explode_data.jsonl/5657 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 1420
} | [
2830,
3393,
15760,
851,
1155,
353,
8840,
836,
8,
341,
197,
322,
6505,
1482,
2266,
198,
80206,
39820,
1972,
14359,
1155,
692,
197,
322,
9468,
7860,
3538,
369,
11589,
7388,
198,
80206,
12101,
11571,
722,
1155,
692,
197,
322,
1855,
264,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 5 |
func Test_getFrom_fail(t *testing.T) {
address1 := &address.Address{}
envHandleUintptr := uintptr(unsafe.Pointer(address1))
jvmsCached, _ = lru.New(1000)
from := getFrom(envHandleUintptr)
assert.Equal(t, "", from)
jvmTestEnv := setupTestEnv()
jvmsCached.Add(envHandleUintptr, jvmTestEnv.jvm)
from = getFrom(envHandleUintptr)
assert.Equal(t, "", from)
} | explode_data.jsonl/38985 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 155
} | [
2830,
3393,
3062,
3830,
22121,
1155,
353,
8840,
836,
8,
341,
63202,
16,
1669,
609,
4995,
26979,
16094,
57538,
6999,
21570,
3505,
1669,
38190,
7,
38157,
41275,
15434,
16,
1171,
12428,
85,
1011,
70293,
11,
716,
284,
326,
2672,
7121,
7,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestFailingDefaultEnforced(t *testing.T) {
tests := []struct {
definition string
expectedError error
}{
{
definition: `
package foo
type Blah struct {
// +default=5
Int int
} `,
expectedError: fmt.Errorf("failed to generate default in base/foo.Blah: Int: invalid default value (5) for non-pointer/non-omitempty. If specified, must be: 0"),
},
{
definition: `
package foo
type Blah struct {
// +default={"foo": 5}
Struct struct{
foo int
}
} `,
expectedError: fmt.Errorf(`failed to generate default in base/foo.Blah: Struct: invalid default value (map[string]interface {}{"foo":5}) for non-pointer/non-omitempty. If specified, must be: {}`),
},
{
definition: `
package foo
type Blah struct {
List []Item
}
// +default="foo"
type Item string `,
expectedError: fmt.Errorf(`failed to generate slice property in base/foo.Blah: List: invalid default value ("foo") for non-pointer/non-omitempty. If specified, must be: ""`),
},
{
definition: `
package foo
type Blah struct {
Map map[string]Item
}
// +default="foo"
type Item string `,
expectedError: fmt.Errorf(`failed to generate map property in base/foo.Blah: Map: invalid default value ("foo") for non-pointer/non-omitempty. If specified, must be: ""`),
},
}
for i, test := range tests {
t.Run(fmt.Sprintf("%d", i), func(t *testing.T) {
_, funcErr, assert, _, _ := testOpenAPITypeWriter(t, test.definition)
if assert.Error(funcErr, "An error was expected") {
assert.Equal(funcErr, test.expectedError)
}
})
}
} | explode_data.jsonl/3353 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 572
} | [
2830,
3393,
37,
14277,
3675,
1702,
24246,
1155,
353,
8840,
836,
8,
341,
78216,
1669,
3056,
1235,
341,
197,
7452,
4054,
262,
914,
198,
197,
42400,
1454,
1465,
198,
197,
59403,
197,
197,
515,
298,
7452,
4054,
25,
22074,
1722,
15229,
271... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestPlayback(t *testing.T) {
p := Playback{}
if s := p.String(); s != "playback" {
t.Fatal(s)
}
if err := p.Close(); err != nil {
t.Fatal(err)
}
} | explode_data.jsonl/44852 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 77
} | [
2830,
3393,
87125,
1155,
353,
8840,
836,
8,
341,
3223,
1669,
95301,
16094,
743,
274,
1669,
281,
6431,
2129,
274,
961,
330,
1363,
1419,
1,
341,
197,
3244,
26133,
1141,
340,
197,
532,
743,
1848,
1669,
281,
10421,
2129,
1848,
961,
2092,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 3 |
func TestParseImportAliases(t *testing.T) {
searchDir := "testdata/alias_import"
p := New()
err := p.ParseAPI(searchDir, mainAPIFile, defaultParseDepth)
assert.NoError(t, err)
expected, err := ioutil.ReadFile(filepath.Join(searchDir, "expected.json"))
assert.NoError(t, err)
b, _ := json.MarshalIndent(p.swagger, "", " ")
//windows will fail: \r\n \n
assert.Equal(t, string(expected), string(b))
} | explode_data.jsonl/63561 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 163
} | [
2830,
3393,
14463,
11511,
95209,
1155,
353,
8840,
836,
8,
341,
45573,
6184,
1669,
330,
92425,
14,
14956,
18434,
698,
3223,
1669,
1532,
741,
9859,
1669,
281,
8937,
7082,
20447,
6184,
11,
1887,
7082,
1703,
11,
1638,
14463,
19776,
340,
694... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestIssue106(t *testing.T) {
m1 := struct {
I uint32
}{I: ^uint32(0)}
m2 := struct {
I int32
}{}
b, err := Marshal(&m1)
if err != nil {
t.Fatal(err)
}
if err := Unmarshal(b, &m2); err != nil {
t.Fatal(err)
}
if m2.I != -1 {
t.Error("unexpected value:", m2.I)
}
} | explode_data.jsonl/52779 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 150
} | [
2830,
3393,
42006,
16,
15,
21,
1155,
353,
8840,
836,
8,
341,
2109,
16,
1669,
2036,
341,
197,
24486,
2622,
18,
17,
198,
197,
15170,
40,
25,
6306,
2496,
18,
17,
7,
15,
73822,
2109,
17,
1669,
2036,
341,
197,
24486,
526,
18,
17,
198... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 4 |
func TestValidateMacaroon(t *testing.T) {
// First, initialize the service and unlock it.
tempDir := setupTestRootKeyStorage(t)
defer os.RemoveAll(tempDir)
service, err := macaroons.NewService(tempDir, macaroons.IPLockChecker)
defer service.Close()
if err != nil {
t.Fatalf("Error creating new service: %v", err)
}
err = service.CreateUnlock(&defaultPw)
if err != nil {
t.Fatalf("Error unlocking root key storage: %v", err)
}
// Then, create a new macaroon that we can serialize.
macaroon, err := service.Oven.NewMacaroon(nil, bakery.LatestVersion,
nil, testOperation)
if err != nil {
t.Fatalf("Error creating macaroon from service: %v", err)
}
macaroonBinary, err := macaroon.M().MarshalBinary()
if err != nil {
t.Fatalf("Error serializing macaroon: %v", err)
}
// Because the macaroons are always passed in a context, we need to
// mock one that has just the serialized macaroon as a value.
md := metadata.New(map[string]string{
"macaroon": hex.EncodeToString(macaroonBinary),
})
mockContext := metadata.NewIncomingContext(context.Background(), md)
// Finally, validate the macaroon against the required permissions.
err = service.ValidateMacaroon(mockContext, []bakery.Op{testOperation})
if err != nil {
t.Fatalf("Error validating the macaroon: %v", err)
}
} | explode_data.jsonl/3155 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 454
} | [
2830,
3393,
17926,
19552,
277,
9009,
1155,
353,
8840,
836,
8,
341,
197,
322,
5512,
11,
9468,
279,
2473,
323,
15055,
432,
624,
16280,
6184,
1669,
6505,
2271,
8439,
1592,
5793,
1155,
340,
16867,
2643,
84427,
9758,
6184,
340,
52934,
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... | 6 |
func TestGenerateCassandraStatefulSet(t *testing.T) {
assert := assert.New(t)
dcName := "dc1"
rackName := "rack1"
dcRackName := fmt.Sprintf("%s-%s", dcName, rackName)
_, cc := HelperInitCluster(t, "cassandracluster-2DC.yaml")
ccDefault := cc.DeepCopy()
cc.CheckDefaults()
labels, nodeSelector := k8s.DCRackLabelsAndNodeSelectorForStatefulSet(cc, 0, 0)
sts, _ := generateCassandraStatefulSet(cc, &cc.Status, dcName, dcRackName, labels, nodeSelector, nil)
assert.Equal(map[string]string{
"app": "cassandracluster",
"cassandracluster": "cassandra-demo",
"cassandraclusters.db.orange.com.dc": "dc1",
"cassandraclusters.db.orange.com.rack": "rack1",
"dc-rack": "dc1-rack1",
"cluster": "k8s.pic",
}, sts.Labels)
assert.Equal("my.custom.annotation", sts.Spec.Template.Annotations["exemple.com/test"])
assert.Equal([]v1.Toleration{
{
Key: "my_custom_taint",
Operator: v1.TolerationOpExists,
Effect: v1.TaintEffectNoSchedule,
},
}, sts.Spec.Template.Spec.Tolerations)
assert.Equal(int64(1001), *sts.Spec.Template.Spec.SecurityContext.RunAsUser)
assert.Equal(int64(1002), *sts.Spec.Template.Spec.SecurityContext.FSGroup)
checkVolumeClaimTemplates(t, labels, sts.Spec.VolumeClaimTemplates, "10Gi", "test-storage")
checkLiveAndReadiNessProbe(t, sts.Spec.Template.Spec.Containers,
1010, 201, 32, 7, 9, 1205, 151, 17, 50, 30)
checkVolumeMount(t, sts.Spec.Template.Spec.Containers)
checkVarEnv(t, sts.Spec.Template.Spec.Containers, cc, dcRackName)
checkDefaultInitContainerResources(t, sts.Spec.Template.Spec.InitContainers)
checkBackRestSidecar(t, sts.Spec.Template.Spec.Containers,
"gcr.io/cassandra-operator/instaclustr-icarus:1.0.9",
v1.PullAlways,
v1.ResourceRequirements{
Requests: generateResourceList("1", "1Gi"),
Limits: generateResourceList("2", "3Gi"),
})
checkResourcesConfiguration(t, sts.Spec.Template.Spec.Containers, "3", "3Gi")
cc.Spec.StorageConfigs[0].PVCSpec = nil
_, err := generateCassandraStatefulSet(cc, &cc.Status, dcName, dcRackName, labels, nodeSelector, nil)
assert.NotEqual(t, err, nil)
// Test default setup
dcNameDefault := "dc2"
rackNameDefault := "rack1"
dcRackNameDefault := fmt.Sprintf("%s-%s", dcNameDefault, rackNameDefault)
setupForDefaultTest(ccDefault)
ccDefault.CheckDefaults()
labelsDefault, nodeSelectorDefault := k8s.DCRackLabelsAndNodeSelectorForStatefulSet(ccDefault, 0, 0)
stsDefault, _ := generateCassandraStatefulSet(ccDefault, &ccDefault.Status, dcNameDefault, dcRackNameDefault,
labelsDefault, nodeSelectorDefault, nil)
checkVolumeClaimTemplates(t, labels, stsDefault.Spec.VolumeClaimTemplates, "3Gi", "local-storage")
checkLiveAndReadiNessProbe(t, stsDefault.Spec.Template.Spec.Containers,
60, 10, 10, 0, 0, 120, 20, 10, 0, 0)
checkDefaultInitContainerResources(t, stsDefault.Spec.Template.Spec.InitContainers)
resources := generateResourceList(defaultBackRestContainerRequestsCPU, defaultBackRestContainerRequestsMemory)
checkBackRestSidecar(t, stsDefault.Spec.Template.Spec.Containers,
api.DefaultBackRestImage,
"",
v1.ResourceRequirements{
Requests: resources,
Limits: resources,
})
checkResourcesConfiguration(t, stsDefault.Spec.Template.Spec.Containers, "1", "2Gi")
ccDefault.Spec.BackRestSidecar.Image = ""
ccDefault.CheckDefaults()
assert.Equal(ccDefault.Spec.BackRestSidecar.Image, api.DefaultBackRestImage)
} | explode_data.jsonl/54114 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 1383
} | [
2830,
3393,
31115,
34,
70093,
1397,
1262,
1649,
1155,
353,
8840,
836,
8,
341,
6948,
1669,
2060,
7121,
1155,
340,
87249,
675,
1669,
330,
7628,
16,
698,
7000,
473,
675,
1669,
330,
71685,
16,
698,
87249,
49,
473,
675,
1669,
8879,
17305,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestACLReplication_Sorter(t *testing.T) {
acls := structs.ACLs{
&structs.ACL{ID: "a"},
&structs.ACL{ID: "b"},
&structs.ACL{ID: "c"},
}
sorter := &aclIterator{acls, 0}
if len := sorter.Len(); len != 3 {
t.Fatalf("bad: %d", len)
}
if !sorter.Less(0, 1) {
t.Fatalf("should be less")
}
if sorter.Less(1, 0) {
t.Fatalf("should not be less")
}
if !sort.IsSorted(sorter) {
t.Fatalf("should be sorted")
}
expected := structs.ACLs{
&structs.ACL{ID: "b"},
&structs.ACL{ID: "a"},
&structs.ACL{ID: "c"},
}
sorter.Swap(0, 1)
if !reflect.DeepEqual(acls, expected) {
t.Fatalf("bad: %v", acls)
}
if sort.IsSorted(sorter) {
t.Fatalf("should not be sorted")
}
sort.Sort(sorter)
if !sort.IsSorted(sorter) {
t.Fatalf("should be sorted")
}
} | explode_data.jsonl/34820 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 386
} | [
2830,
3393,
55393,
18327,
1693,
1098,
371,
261,
1155,
353,
8840,
836,
8,
341,
11323,
18074,
1669,
62845,
875,
3140,
82,
515,
197,
197,
5,
1235,
82,
875,
3140,
90,
915,
25,
330,
64,
7115,
197,
197,
5,
1235,
82,
875,
3140,
90,
915,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestBuild_zipfileUrl(t *testing.T) {
tests := []struct {
name string
json string
want string
}{
{
name: "Simple test with valid url",
json: `
{
"start_time": "Mon, 19 Apr 2021 12:15:47 GMT",
"version": "8.0.0-SNAPSHOT",
"build_id": "8.0.0-ab7cd914",
"projects": {
"elasticsearch": {
"branch": "master",
"commit_hash": "d3be79018b5b70a118ea5a897a539428b728df5a",
"Packages": {
"rest-resources-zip-8.0.0-SNAPSHOT.zip": {
"url": "https://snapshots.elastic.co/8.0.0-ab7cd914/downloads/elasticsearch/rest-resources-zip-8.0.0-SNAPSHOT.zip",
"type": "zip"
}
}
}
}
}
`,
want: "https://snapshots.elastic.co/8.0.0-ab7cd914/downloads/elasticsearch/rest-resources-zip-8.0.0-SNAPSHOT.zip",
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
b := Build{}
if err := json.Unmarshal([]byte(tt.json), &b); err != nil {
t.Fatalf(err.Error())
}
if got := b.zipfileUrl(); got != tt.want {
t.Errorf("zipfileUrl() = %v, want %v", got, tt.want)
}
})
}
} | explode_data.jsonl/60127 | {
"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,
11066,
42131,
1192,
2864,
1155,
353,
8840,
836,
8,
341,
78216,
1669,
3056,
1235,
341,
197,
11609,
256,
914,
198,
197,
30847,
256,
914,
198,
197,
50780,
256,
914,
198,
197,
59403,
197,
197,
515,
298,
11609,
25,
330,
16374,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestNewFrom(t *testing.T) {
gtest.C(t, func(t *gtest.T) {
s1 := gset.NewFrom("a")
s2 := gset.NewFrom("b", false)
s3 := gset.NewFrom(3, true)
s4 := gset.NewFrom([]string{"s1", "s2"}, true)
t.Assert(s1.Contains("a"), true)
t.Assert(s2.Contains("b"), true)
t.Assert(s3.Contains(3), true)
t.Assert(s4.Contains("s1"), true)
t.Assert(s4.Contains("s3"), false)
})
} | explode_data.jsonl/34388 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 198
} | [
2830,
3393,
3564,
3830,
1155,
353,
8840,
836,
8,
341,
3174,
1944,
727,
1155,
11,
2915,
1155,
353,
82038,
836,
8,
341,
197,
1903,
16,
1669,
342,
746,
7121,
3830,
445,
64,
1138,
197,
1903,
17,
1669,
342,
746,
7121,
3830,
445,
65,
49... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestHTTPTask_Variables(t *testing.T) {
t.Parallel()
validMeta := map[string]interface{}{"theMeta": "yes"}
tests := []struct {
name string
requestData string
meta pipeline.JSONSerializable
inputs []pipeline.Result
vars pipeline.Vars
expectedRequestData map[string]interface{}
expectedErrorCause error
expectedErrorContains string
}{
{
"requestData (empty) + meta",
``,
pipeline.JSONSerializable{validMeta, true},
[]pipeline.Result{{Value: 123.45}},
pipeline.NewVarsFrom(map[string]interface{}{"some_data": map[string]interface{}{"foo": 543.21}}),
map[string]interface{}{},
nil,
"",
},
{
"requestData (pure variable) + meta",
`$(some_data)`,
pipeline.JSONSerializable{validMeta, true},
[]pipeline.Result{{Value: 123.45}},
pipeline.NewVarsFrom(map[string]interface{}{"some_data": map[string]interface{}{"foo": 543.21}}),
map[string]interface{}{"foo": 543.21},
nil,
"",
},
{
"requestData (pure variable)",
`$(some_data)`,
pipeline.JSONSerializable{nil, false},
[]pipeline.Result{{Value: 123.45}},
pipeline.NewVarsFrom(map[string]interface{}{"some_data": map[string]interface{}{"foo": 543.21}}),
map[string]interface{}{"foo": 543.21},
nil,
"",
},
{
"requestData (pure variable, missing)",
`$(some_data)`,
pipeline.JSONSerializable{validMeta, true},
[]pipeline.Result{{Value: 123.45}},
pipeline.NewVarsFrom(map[string]interface{}{"not_some_data": map[string]interface{}{"foo": 543.21}}),
nil,
pipeline.ErrKeypathNotFound,
"requestData",
},
{
"requestData (pure variable, not a map)",
`$(some_data)`,
pipeline.JSONSerializable{validMeta, true},
[]pipeline.Result{{Value: 123.45}},
pipeline.NewVarsFrom(map[string]interface{}{"some_data": 543.21}),
nil,
pipeline.ErrBadInput,
"requestData",
},
{
"requestData (interpolation) + meta",
`{"data":{"result":$(medianize)}}`,
pipeline.JSONSerializable{validMeta, true},
[]pipeline.Result{{Value: 123.45}},
pipeline.NewVarsFrom(map[string]interface{}{"medianize": 543.21}),
map[string]interface{}{"data": map[string]interface{}{"result": 543.21}},
nil,
"",
},
{
"requestData (interpolation, missing)",
`{"data":{"result":$(medianize)}}`,
pipeline.JSONSerializable{validMeta, true},
[]pipeline.Result{{Value: 123.45}},
pipeline.NewVarsFrom(map[string]interface{}{"nope": "foo bar"}),
nil,
pipeline.ErrKeypathNotFound,
"requestData",
},
}
for _, test := range tests {
test := test
t.Run(test.name, func(t *testing.T) {
t.Parallel()
db := pgtest.NewGormDB(t)
cfg := cltest.NewTestGeneralConfig(t)
s1 := httptest.NewServer(fakePriceResponder(t, test.expectedRequestData, decimal.NewFromInt(9700), "", nil))
defer s1.Close()
feedURL, err := url.ParseRequestURI(s1.URL)
require.NoError(t, err)
feedWebURL := (*models.WebURL)(feedURL)
task := pipeline.BridgeTask{
BaseTask: pipeline.NewBaseTask(0, "bridge", nil, nil, 0),
Name: "foo",
RequestData: test.requestData,
}
task.HelperSetDependencies(cfg, db, uuid.UUID{})
// Insert bridge
_, bridge := cltest.NewBridgeType(t, task.Name)
bridge.URL = *feedWebURL
require.NoError(t, db.Create(&bridge).Error)
test.vars.Set("meta", test.meta)
result, runInfo := task.Run(context.Background(), logger.TestLogger(t), test.vars, test.inputs)
assert.False(t, runInfo.IsPending)
assert.False(t, runInfo.IsRetryable)
if test.expectedErrorCause != nil {
require.Equal(t, test.expectedErrorCause, errors.Cause(result.Error))
if test.expectedErrorContains != "" {
require.Contains(t, result.Error.Error(), test.expectedErrorContains)
}
} else {
require.NoError(t, result.Error)
require.NotNil(t, result.Value)
var x struct {
Data struct {
Result decimal.Decimal `json:"result"`
} `json:"data"`
}
json.Unmarshal([]byte(result.Value.(string)), &x)
require.Equal(t, decimal.NewFromInt(9700), x.Data.Result)
}
})
}
} | explode_data.jsonl/81343 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 1826
} | [
2830,
3393,
2545,
51,
2828,
1073,
83932,
82,
1155,
353,
8840,
836,
8,
341,
3244,
41288,
7957,
2822,
56322,
12175,
1669,
2415,
14032,
31344,
6257,
4913,
1782,
12175,
788,
330,
9693,
63159,
78216,
1669,
3056,
1235,
341,
197,
11609,
1698,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestEntry_SelectHomeEnd(t *testing.T) {
e, window := setupSelection(false)
defer teardownImageTest(window)
c := window.Canvas()
test.AssertImageMatches(t, "entry/selection_initial.png", c.Capture())
// T e[s t i] n g -> end -> // T e[s t i n g]
typeKeys(e, fyne.KeyEnd)
test.AssertImageMatches(t, "entry/selection_add_to_end.png", c.Capture())
// T e s[t i n g] -> home -> ]T e[s t i n g
typeKeys(e, fyne.KeyHome)
test.AssertImageMatches(t, "entry/selection_add_to_home.png", c.Capture())
} | explode_data.jsonl/57316 | {
"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,
5874,
58073,
7623,
3727,
1155,
353,
8840,
836,
8,
341,
7727,
11,
3241,
1669,
6505,
11177,
3576,
340,
16867,
49304,
1906,
2271,
15906,
340,
1444,
1669,
3241,
54121,
2822,
18185,
11711,
1906,
42470,
1155,
11,
330,
4085,
14,
23... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestParseAddressString(t *testing.T) {
testCases := []struct {
name string
addr string
expected string
correct bool
}{
{"no node id and no protocol", "127.0.0.1:8080", "", false},
{"no node id w/ tcp input", "tcp://127.0.0.1:8080", "", false},
{"no node id w/ udp input", "udp://127.0.0.1:8080", "", false},
{
"no protocol",
"deadbeefdeadbeefdeadbeefdeadbeefdeadbeef@127.0.0.1:8080",
"deadbeefdeadbeefdeadbeefdeadbeefdeadbeef@127.0.0.1:8080",
true,
},
{
"tcp input",
"tcp://deadbeefdeadbeefdeadbeefdeadbeefdeadbeef@127.0.0.1:8080",
"deadbeefdeadbeefdeadbeefdeadbeefdeadbeef@127.0.0.1:8080",
true,
},
{
"udp input",
"udp://deadbeefdeadbeefdeadbeefdeadbeefdeadbeef@127.0.0.1:8080",
"deadbeefdeadbeefdeadbeefdeadbeefdeadbeef@127.0.0.1:8080",
true,
},
{"malformed tcp input", "tcp//deadbeefdeadbeefdeadbeefdeadbeefdeadbeef@127.0.0.1:8080", "", false},
{"malformed udp input", "udp//deadbeefdeadbeefdeadbeefdeadbeefdeadbeef@127.0.0.1:8080", "", false},
// {"127.0.0:8080", false},
{"invalid host", "notahost", "", false},
{"invalid port", "127.0.0.1:notapath", "", false},
{"invalid host w/ port", "notahost:8080", "", false},
{"just a port", "8082", "", false},
{"non-existent port", "127.0.0:8080000", "", false},
{"too short nodeId", "deadbeef@127.0.0.1:8080", "", false},
{"too short, not hex nodeId", "this-isnot-hex@127.0.0.1:8080", "", false},
{"not hex nodeId", "xxxxbeefdeadbeefdeadbeefdeadbeefdeadbeef@127.0.0.1:8080", "", false},
{"too short nodeId w/tcp", "tcp://deadbeef@127.0.0.1:8080", "", false},
{"too short notHex nodeId w/tcp", "tcp://this-isnot-hex@127.0.0.1:8080", "", false},
{"notHex nodeId w/tcp", "tcp://xxxxbeefdeadbeefdeadbeefdeadbeefdeadbeef@127.0.0.1:8080", "", false},
{
"correct nodeId w/tcp",
"tcp://deadbeefdeadbeefdeadbeefdeadbeefdeadbeef@127.0.0.1:8080",
"deadbeefdeadbeefdeadbeefdeadbeefdeadbeef@127.0.0.1:8080",
true,
},
{"no node id", "tcp://@127.0.0.1:8080", "", false},
{"no node id or IP", "tcp://@", "", false},
{"tcp no host, w/ port", "tcp://:26656", "", false},
{"empty", "", "", false},
{"node id delimiter 1", "@", "", false},
{"node id delimiter 2", " @", "", false},
{"node id delimiter 3", " @ ", "", false},
}
for _, tc := range testCases {
tc := tc
t.Run(tc.name, func(t *testing.T) {
na, err := ParseAddressString(tc.addr)
if tc.correct {
require.NoError(t, err, tc.addr)
assert.Contains(t, tc.expected, na.IP.String())
assert.Contains(t, tc.expected, fmt.Sprint(na.Port))
} else {
assert.Error(t, err, "%v", tc.addr)
}
})
}
} | explode_data.jsonl/14845 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 1254
} | [
2830,
3393,
14463,
4286,
703,
1155,
353,
8840,
836,
8,
341,
18185,
37302,
1669,
3056,
1235,
341,
197,
11609,
257,
914,
198,
197,
53183,
257,
914,
198,
197,
42400,
914,
198,
197,
1444,
27034,
220,
1807,
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... | 2 |
func TestEnvoyStatsCompleteAndRejectedCDS(t *testing.T) {
g := NewGomegaWithT(t)
stats := "cluster_manager.cds.update_rejected: 1\nlistener_manager.lds.update_success: 1"
server := createAndStartServer(stats)
defer server.Close()
err := probe.Check()
g.Expect(err).NotTo(HaveOccurred())
} | explode_data.jsonl/41347 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 112
} | [
2830,
3393,
14359,
2253,
16635,
12548,
3036,
77693,
34,
5936,
1155,
353,
8840,
836,
8,
341,
3174,
1669,
1532,
38,
32696,
2354,
51,
1155,
340,
79659,
1669,
330,
18855,
12144,
520,
5356,
5317,
1288,
28303,
25,
220,
16,
1699,
35039,
12144,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestBInput(t *testing.T) {
bytes, err := ioutil.ReadFile("./input.txt")
if err != nil {
t.Fail()
}
input := string(bytes[:])
result := answerB(input)
t.Logf("day 3: A: %d", result)
if result != 2639 {
t.Fail()
}
} | explode_data.jsonl/16879 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 104
} | [
2830,
3393,
33,
2505,
1155,
353,
8840,
836,
8,
341,
70326,
11,
1848,
1669,
43144,
78976,
13988,
1355,
3909,
1138,
743,
1848,
961,
2092,
341,
197,
3244,
57243,
741,
197,
532,
22427,
1669,
914,
23158,
3447,
2546,
9559,
1669,
4226,
33,
5... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
func TestIntegration(t *testing.T) {
s, err := initServer(testRoutes)
if err != nil {
t.Fatalf("Couldn't parse routes: %v", err)
}
res, code := hitEndpoint(s, http.MethodGet, "/echo/hello/3x", "")
assertEqual(t, code, http.StatusOK)
assertEqual(t, res, "hello hello hello")
res, code = hitEndpoint(s, http.MethodPost, "/count/l/grep/y", "y\nn\ny\nn\nn\nn\ny")
assertEqual(t, code, http.StatusOK)
assertEqual(t, res, "3")
res, code = hitEndpoint(s, http.MethodGet, "/the/static/files/text", "")
assertEqual(t, code, http.StatusOK)
assertEqual(t, res, "just some text")
res, code = hitEndpoint(s, http.MethodGet, "/not/a/real/path", "")
assertEqual(t, code, http.StatusNotFound)
res, code = hitEndpoint(s, http.MethodGet, "/echo/notquite", "")
assertEqual(t, code, http.StatusNotFound)
res, code = hitEndpoint(s, http.MethodGet, "/the/static/files/ignored", "")
assertEqual(t, code, http.StatusNotFound)
res, code = hitEndpoint(s, http.MethodGet, "/error", "")
assertEqual(t, code, http.StatusInternalServerError)
res, code = hitEndpoint(s, http.MethodGet, "/count/5", "")
assertEqual(t, code, http.StatusOK)
assertEqual(t, res, "0\n1\n2\n3\n4")
res, code = hitEndpoint(s, http.MethodGet, "/", "")
assertEqual(t, code, http.StatusOK)
assertEqual(t, res, "welcome")
} | explode_data.jsonl/20029 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 525
} | [
2830,
3393,
52464,
1155,
353,
8840,
836,
8,
341,
1903,
11,
1848,
1669,
2930,
5475,
8623,
26653,
340,
743,
1848,
961,
2092,
341,
197,
3244,
30762,
445,
38987,
944,
4715,
11291,
25,
1018,
85,
497,
1848,
340,
197,
630,
10202,
11,
2038,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestQuotasetGet(t *testing.T) {
client, err := clients.NewComputeV2Client()
if err != nil {
t.Fatalf("Unable to create a compute client: %v", err)
}
identityClient, err := clients.NewIdentityV2Client()
if err != nil {
t.Fatalf("Unable to get a new identity client: %v", err)
}
tenantID, err := getTenantID(t, identityClient)
if err != nil {
t.Fatal(err)
}
quotaSet, err := quotasets.Get(client, tenantID).Extract()
if err != nil {
t.Fatal(err)
}
tools.PrintResource(t, quotaSet)
} | explode_data.jsonl/62151 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 203
} | [
2830,
3393,
2183,
354,
5028,
1949,
1155,
353,
8840,
836,
8,
341,
25291,
11,
1848,
1669,
8239,
7121,
46254,
53,
17,
2959,
741,
743,
1848,
961,
2092,
341,
197,
3244,
30762,
445,
17075,
311,
1855,
264,
12564,
2943,
25,
1018,
85,
497,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 5 |
func TestGetTrades(t *testing.T) {
b.SetDefaults()
_, err := b.GetTrades("BTC-USD")
if err != nil {
t.Fatalf("Test failed. Err: %s", err)
}
} | explode_data.jsonl/14533 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 67
} | [
2830,
3393,
1949,
1282,
3452,
1155,
353,
8840,
836,
8,
341,
2233,
4202,
16273,
741,
197,
6878,
1848,
1669,
293,
2234,
1282,
3452,
445,
59118,
12,
26749,
1138,
743,
1848,
961,
2092,
341,
197,
3244,
30762,
445,
2271,
4641,
13,
15495,
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
] | 2 |
func TestSymmetricEncrypt(t *testing.T) {
symmetricPaseto, err := NewSymmetric("PrU5AbXJawKJIUOJFmd4f6ZwmifLvvoF")
assert.NoError(t, err)
now := time.Now()
token := paseto.JSONToken{
Audience: "Kitabisa services",
Issuer: "Kulonuwun",
Jti: "706cbfce-c031-4a44-815e-030f963f7d4e",
Subject: "cac2ee7e-70d0-4220-badd-7b5695f53ad8",
Expiration: now.Add(24 * time.Hour),
IssuedAt: now,
NotBefore: now,
}
token.Set("email", "budi@kitabisa.com")
token.Set("name", "Budi Ariyanto")
_, err = symmetricPaseto.Encrypt(token, "Kitabisa.com")
assert.NoError(t, err)
} | explode_data.jsonl/58335 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 299
} | [
2830,
3393,
27912,
15903,
61520,
1155,
353,
8840,
836,
8,
341,
1903,
29459,
47,
5028,
78,
11,
1848,
1669,
1532,
27912,
15903,
445,
3533,
52,
20,
5830,
55,
41,
672,
42,
45064,
52,
46,
41,
37,
2277,
19,
69,
21,
57,
19557,
333,
73757... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestChargeList(t *testing.T) {
params := &stripe.ChargeListParams{}
params.Filters.AddFilter("include[]", "", "total_count")
params.Filters.AddFilter("limit", "", "5")
params.Single = true
i := List(params)
for i.Next() {
if i.Charge() == nil {
t.Error("No nil values expected")
}
if i.Meta() == nil {
t.Error("No metadata returned")
}
}
if err := i.Err(); err != nil {
t.Error(err)
}
} | explode_data.jsonl/73937 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 172
} | [
2830,
3393,
55363,
852,
1155,
353,
8840,
836,
8,
341,
25856,
1669,
609,
61233,
6353,
2744,
852,
4870,
16094,
25856,
77714,
1904,
5632,
445,
997,
1294,
497,
7342,
330,
5035,
3180,
1138,
25856,
77714,
1904,
5632,
445,
9506,
497,
7342,
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... | 5 |
func TestImportVolumeFailures(t *testing.T) {
const (
backendName = "backend82"
scName = "sc01"
volumeName = "volume82"
originalName01 = "origVolume01"
backendProtocol = config.File
)
createPVandPVCError := func(volExternal *storage.VolumeExternal, driverType string) error {
return fmt.Errorf("failed to create PV")
}
orchestrator, volumeConfig := importVolumeSetup(t, backendName, scName, volumeName, originalName01, backendProtocol)
_, err := orchestrator.LegacyImportVolume(ctx(), volumeConfig, backendName, false, createPVandPVCError)
// verify that importVolumeCleanup renamed volume to originalName
backend, _ := orchestrator.getBackendByBackendName(backendName)
volExternal, err := backend.Driver().GetVolumeExternal(ctx(), originalName01)
if err != nil {
t.Fatalf("failed to get volumeExternal for %s", originalName01)
}
if volExternal.Config.Size != "1000000000" {
t.Errorf("falied to verify %s size %s", originalName01, volExternal.Config.Size)
}
// verify that we cleaned up the persisted state
if _, ok := orchestrator.volumes[volumeConfig.Name]; ok {
t.Errorf("volume %s should not exist in orchestrator's volume cache", volumeConfig.Name)
}
persistedVolume, err := orchestrator.storeClient.GetVolume(ctx(), volumeConfig.Name)
if persistedVolume != nil {
t.Errorf("volume %s should not be persisted", volumeConfig.Name)
}
cleanup(t, orchestrator)
} | explode_data.jsonl/62734 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 471
} | [
2830,
3393,
11511,
18902,
19524,
1413,
1155,
353,
8840,
836,
8,
341,
4777,
2399,
197,
197,
20942,
675,
257,
284,
330,
20942,
23,
17,
698,
197,
29928,
675,
688,
284,
330,
2388,
15,
16,
698,
197,
5195,
4661,
675,
414,
284,
330,
25060,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestRPC_QueryAccount(t *testing.T) {
codec.UpgradeHeight = 7000
_, _, cleanup := NewInMemoryTendermintNode(t, oneValTwoNodeGenesisState())
_, stopCli, evtChan := subscribeTo(t, tmTypes.EventNewBlock)
<-evtChan
kb := getInMemoryKeybase()
cb, err := kb.GetCoinbase()
assert.Nil(t, err)
var params = HeightAndAddrParams{
Height: 0,
Address: cb.GetAddress().String(),
}
q := newQueryRequest("account", newBody(params))
rec := httptest.NewRecorder()
Account(rec, q, httprouter.Params{})
resp := getJSONResponse(rec)
assert.Regexp(t, "upokt", string(resp))
<-evtChan
q = newQueryRequest("account", newBody(params))
rec = httptest.NewRecorder()
Account(rec, q, httprouter.Params{})
resp = getJSONResponse(rec)
assert.Regexp(t, "upokt", string(resp))
cleanup()
stopCli()
} | explode_data.jsonl/44711 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 315
} | [
2830,
3393,
29528,
48042,
7365,
1155,
353,
8840,
836,
8,
341,
43343,
66,
13,
43861,
3640,
284,
220,
22,
15,
15,
15,
198,
197,
6878,
8358,
21290,
1669,
1532,
641,
10642,
51,
1659,
67791,
1955,
1155,
11,
825,
2208,
11613,
1955,
84652,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestOldFilters(t *testing.T) {
t.Run("Make single filter properly", func(t *testing.T) {
f, _ := makeOldFilterSet([]MetricFilter{
{
MetricNames: []string{
"cpu.utilization",
"memory.utilization",
},
},
}, nil)
assert.True(t, f.Matches(&datapoint.Datapoint{Metric: "cpu.utilization"}))
assert.True(t, f.Matches(&datapoint.Datapoint{Metric: "memory.utilization"}))
assert.False(t, f.Matches(&datapoint.Datapoint{Metric: "disk.utilization"}))
})
t.Run("Merges two filters properly", func(t *testing.T) {
f, _ := makeOldFilterSet([]MetricFilter{
{
MetricNames: []string{
"cpu.utilization",
"memory.utilization",
},
Negated: true,
},
{
MetricNames: []string{
"disk.utilization",
},
Negated: true,
},
}, nil)
assert.False(t, f.Matches(&datapoint.Datapoint{Metric: "cpu.utilization"}))
assert.False(t, f.Matches(&datapoint.Datapoint{Metric: "memory.utilization"}))
assert.False(t, f.Matches(&datapoint.Datapoint{Metric: "disk.utilization"}))
assert.True(t, f.Matches(&datapoint.Datapoint{Metric: "other.utilization"}))
})
t.Run("Merges include filters properly", func(t *testing.T) {
f, _ := makeOldFilterSet([]MetricFilter{
{
MetricNames: []string{
"cpu.utilization",
"memory.utilization",
},
Negated: true,
},
{
MetricNames: []string{
"disk.utilization",
},
Negated: true,
},
}, []MetricFilter{
{
MetricNames: []string{
"my.metric",
},
},
})
assert.False(t, f.Matches(&datapoint.Datapoint{Metric: "cpu.utilization"}))
assert.False(t, f.Matches(&datapoint.Datapoint{Metric: "memory.utilization"}))
assert.False(t, f.Matches(&datapoint.Datapoint{Metric: "disk.utilization"}))
assert.False(t, f.Matches(&datapoint.Datapoint{Metric: "my.metric"}))
assert.True(t, f.Matches(&datapoint.Datapoint{Metric: "random.metric"}))
})
t.Run("Include filters with dims take priority", func(t *testing.T) {
f, _ := makeOldFilterSet([]MetricFilter{
{
MetricNames: []string{
"cpu.utilization",
"memory.utilization",
},
},
{
Dimensions: map[string]interface{}{
"app": "myapp",
},
},
}, []MetricFilter{
{
MetricNames: []string{
"cpu.utilization",
},
Dimensions: map[string]interface{}{
"app": "myapp",
},
},
})
assert.True(t, f.Matches(&datapoint.Datapoint{Metric: "cpu.utilization"}))
assert.False(t, f.Matches(&datapoint.Datapoint{Metric: "cpu.utilization", Dimensions: map[string]string{"app": "myapp"}}))
assert.True(t, f.Matches(&datapoint.Datapoint{Metric: "memory.utilization"}))
assert.False(t, f.Matches(&datapoint.Datapoint{Metric: "disk.utilization"}))
assert.False(t, f.Matches(&datapoint.Datapoint{Metric: "random.metric"}))
})
} | explode_data.jsonl/55629 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 1264
} | [
2830,
3393,
18284,
28351,
1155,
353,
8840,
836,
8,
341,
3244,
16708,
445,
8078,
3175,
4051,
10277,
497,
2915,
1155,
353,
8840,
836,
8,
341,
197,
1166,
11,
716,
1669,
1281,
18284,
5632,
1649,
10556,
54310,
5632,
515,
298,
197,
515,
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 TestService(t *testing.T) {
tests := []struct {
name string
steps []testStep
}{
{
name: "success-get_set_get_delete_get",
steps: []testStep{
{
name: "initial empty get",
givenURL: "/list.json",
givenMethod: http.MethodGet,
wantCode: http.StatusOK,
wantFixture: "list-empty.json",
},
{
name: "inserting initial link",
givenURL: "/link.json",
givenMethod: http.MethodPut,
givenPayloadFixture: "put-1.json",
wantCode: http.StatusOK,
wantFixture: "success-msg.json",
},
{
name: "verifying initial insert",
givenURL: "/list.json",
givenMethod: http.MethodGet,
wantCode: http.StatusOK,
wantFixture: "get-1.json",
},
{
name: "deleting initial link",
givenURL: "/link.json",
givenMethod: http.MethodPut,
givenPayloadFixture: "delete-1.json",
wantCode: http.StatusOK,
wantFixture: "success-msg.json",
},
{
name: "verifying delete",
givenURL: "/list.json",
givenMethod: http.MethodGet,
wantCode: http.StatusOK,
wantFixture: "list-empty.json",
},
},
},
{
name: "success-set_set-dupe_set_get",
steps: []testStep{
{
name: "inserting initial link",
givenURL: "/link.json",
givenMethod: http.MethodPut,
givenPayloadFixture: "put-1.json",
wantCode: http.StatusOK,
wantFixture: "success-msg.json",
},
{
name: "duping initial link",
givenURL: "/link.json",
givenMethod: http.MethodPut,
givenPayloadFixture: "put-1.json",
wantCode: http.StatusOK,
wantFixture: "success-msg.json",
},
{
name: "put second link",
givenURL: "/link.json",
givenMethod: http.MethodPut,
givenPayloadFixture: "put-2.json",
wantCode: http.StatusOK,
wantFixture: "success-msg.json",
},
{
name: "verifying list",
givenURL: "/list.json",
givenMethod: http.MethodGet,
wantCode: http.StatusOK,
wantFixture: "get-2.json",
},
{
name: "delete 1",
givenURL: "/link.json",
givenMethod: http.MethodPut,
givenPayloadFixture: "delete-1.json",
wantCode: http.StatusOK,
wantFixture: "success-msg.json",
},
{
name: "verify delete",
givenURL: "/list.json",
givenMethod: http.MethodGet,
wantCode: http.StatusOK,
wantFixture: "get-2-only.json",
},
},
},
{
name: "bad_requests",
steps: []testStep{
{
name: "bad put",
givenURL: "/link.json",
givenMethod: http.MethodPut,
givenPayloadFixture: "bad-put.json",
wantCode: http.StatusBadRequest,
wantFixture: "bad-req-msg.json",
},
},
},
}
// deal with AE context/dev_appserver initialization.
// this call is expensive so we only want to call it once.
ctx, ctxdone := marvintest.SetupTestContextWithContext(t)
defer ctxdone()
for _, test := range tests {
t.Run(test.name, func(t *testing.T) {
ctx, err := appengine.Namespace(ctx, test.name)
if err != nil {
t.Fatalf("unable to init namespace: %s", err)
}
// override context to set a namespace for this test step
// to isolate it from the other test steps' data
marvintest.SetServerContext(ctx)
// init the server so we can call ServeHTTP on it
svr := marvin.NewServer(NewService(NewDB()))
//go through each step and call the server/verify the response
for _, step := range test.steps {
var payload *os.File
// set up the request body if a fixture is given
if step.givenPayloadFixture != "" {
payload, err = os.Open("fixtures/" + step.givenPayloadFixture)
if err != nil {
t.Fatalf("unable to read test fixture: %s", err)
}
}
r, err := http.NewRequest(step.givenMethod, step.givenURL, payload)
if err != nil {
t.Fatalf("unable to create test request: %s", err)
}
w := httptest.NewRecorder()
// hit the server and capture the response
svr.ServeHTTP(w, r)
// check status code for what we want
if w.Code != step.wantCode {
t.Errorf("expected response of %d, got %d", step.wantCode, w.Code)
}
// compare response against expected fixture
if step.wantFixture != "" {
var resp map[string]interface{}
err = json.NewDecoder(w.Body).Decode(&resp)
if err != nil {
t.Fatalf("unable to read response: %s", err)
}
compareFixture(t, step.name, resp, "fixtures/"+step.wantFixture)
}
// le sigh, local datastore be slow :(
time.Sleep(1 * time.Second)
}
})
}
} | explode_data.jsonl/72949 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 2363
} | [
2830,
3393,
1860,
1155,
353,
8840,
836,
8,
1476,
78216,
1669,
3056,
1235,
341,
197,
11609,
914,
271,
197,
18388,
7124,
3056,
1944,
8304,
198,
197,
59403,
197,
197,
515,
298,
11609,
25,
330,
5630,
22491,
2602,
3062,
11353,
3062,
25897,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 9 |
func TestMarketSet(t *testing.T) {
market := getMarket()
user := models.User{
Credits: 100,
}
err := market.Buy(&user, "set_pack")
if err != nil {
t.Errorf("market.Buy error: %s", err)
}
if user.Credits != 800 {
t.Errorf("Buy(user, \"set_pack\"): expected %d, actual %d", 800, user.Credits)
}
} | explode_data.jsonl/10771 | {
"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,
38822,
1649,
1155,
353,
8840,
836,
8,
341,
2109,
54560,
1669,
633,
38822,
741,
19060,
1669,
4119,
7344,
515,
197,
6258,
29502,
25,
220,
16,
15,
15,
345,
197,
630,
9859,
1669,
3081,
1785,
4076,
2099,
872,
11,
330,
746,
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... | 3 |
func TestStartStandAlone(t *testing.T) {
home, cleanup := testutil.NewTestCaseDir(t)
t.Cleanup(cleanup)
t.Cleanup(setupClientHome(t))
logger := log.NewNopLogger()
cfg, err := createDefaultTendermintConfig(home)
require.NoError(t, err)
serverCtx := server.NewContext(viper.New(), cfg, logger)
clientCtx := client.Context{}.WithJSONMarshaler(makeCodec()).WithHomeDir(home)
ctx := context.Background()
ctx = context.WithValue(ctx, client.ClientContextKey, &clientCtx)
ctx = context.WithValue(ctx, server.ServerContextKey, serverCtx)
cmd := InitCmd(testMbm, home)
cmd.SetArgs([]string{"appnode-test"})
require.NoError(t, cmd.ExecuteContext(ctx))
app, err := mock.NewApp(home, logger)
require.NoError(t, err)
svrAddr, _, err := server.FreeTCPAddr()
require.NoError(t, err)
svr, err := abci_server.NewServer(svrAddr, "socket", app)
require.NoError(t, err, "error creating listener")
svr.SetLogger(logger.With("module", "abci-server"))
err = svr.Start()
require.NoError(t, err)
timer := time.NewTimer(time.Duration(2) * time.Second)
for range timer.C {
err = svr.Stop()
require.NoError(t, err)
break
}
} | explode_data.jsonl/58649 | {
"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,
3479,
48733,
2101,
603,
1155,
353,
8840,
836,
8,
341,
197,
5117,
11,
21290,
1669,
1273,
1314,
7121,
16458,
6184,
1155,
340,
3244,
727,
60639,
1337,
60639,
340,
3244,
727,
60639,
14171,
454,
2959,
7623,
1155,
4390,
17060,
166... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
func TestPermissionAPIInDomain(t *testing.T) {
e, _ := NewEnforcer("examples/rbac_with_domains_model.conf", "examples/rbac_with_domains_policy.csv")
testGetPermissionsInDomain(t, e, "alice", "domain1", [][]string{{"admin", "domain1", "data1", "read"}, {"admin", "domain1", "data1", "write"}})
testGetPermissionsInDomain(t, e, "bob", "domain1", [][]string{})
testGetPermissionsInDomain(t, e, "admin", "domain1", [][]string{{"admin", "domain1", "data1", "read"}, {"admin", "domain1", "data1", "write"}})
testGetPermissionsInDomain(t, e, "non_exist", "domain1", [][]string{})
testGetPermissionsInDomain(t, e, "alice", "domain2", [][]string{})
testGetPermissionsInDomain(t, e, "bob", "domain2", [][]string{{"admin", "domain2", "data2", "read"}, {"admin", "domain2", "data2", "write"}})
testGetPermissionsInDomain(t, e, "admin", "domain2", [][]string{{"admin", "domain2", "data2", "read"}, {"admin", "domain2", "data2", "write"}})
testGetPermissionsInDomain(t, e, "non_exist", "domain2", [][]string{})
} | explode_data.jsonl/65634 | {
"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,
14966,
7082,
641,
13636,
1155,
353,
8840,
836,
8,
341,
7727,
11,
716,
1669,
1532,
1702,
82010,
445,
51668,
7382,
55877,
6615,
70199,
5047,
13937,
497,
330,
51668,
7382,
55877,
6615,
70199,
22773,
11219,
5130,
18185,
1949,
2385... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestUnmarshalString(t *testing.T) {
tests := map[string]struct {
input []byte
output string
expectedError error
}{
"''": {[]byte("s:0:\"\";"), "", nil},
"'Hello world'": {[]byte("s:11:\"Hello world\";"), "Hello world", nil},
"'Björk Guðmundsdóttir'": {
[]byte(`s:23:"Björk Guðmundsdóttir";`),
"Björk Guðmundsdóttir",
nil,
},
"not a string": {[]byte("N;"), "", errors.New("not a string")},
}
for testName, test := range tests {
t.Run(testName, func(t *testing.T) {
var result string
err := phpserialize.Unmarshal(test.input, &result)
if test.expectedError == nil {
expectErrorToNotHaveOccurred(t, err)
if result != test.output {
t.Errorf("Expected '%v', got '%v'", test.output, result)
}
} else {
expectErrorToEqual(t, err, test.expectedError)
}
})
}
} | explode_data.jsonl/27019 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 400
} | [
2830,
3393,
1806,
27121,
703,
1155,
353,
8840,
836,
8,
341,
78216,
1669,
2415,
14032,
60,
1235,
341,
197,
22427,
260,
3056,
3782,
198,
197,
21170,
286,
914,
198,
197,
42400,
1454,
1465,
198,
197,
59403,
197,
197,
1,
4605,
788,
310,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestGetCluster_Error(t *testing.T) {
manager := GetManagerInstance()
manager.SetDBConnection(&database.MockDBConnection{
GetClusterReturnErr: true,
})
clearManager()
_, err := manager.GetCluster("test")
if err == nil {
t.Error("Expected err for missing Cluster in Cache")
}
} | explode_data.jsonl/24677 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 106
} | [
2830,
3393,
1949,
28678,
28651,
1155,
353,
8840,
836,
8,
341,
92272,
1669,
2126,
2043,
2523,
741,
92272,
4202,
3506,
4526,
2099,
12216,
24664,
3506,
4526,
515,
197,
37654,
28678,
5598,
7747,
25,
830,
345,
197,
3518,
40408,
2043,
2822,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
func TestGroup(t *testing.T) {
assert := assert.New(t)
var (
p1 int
p2 int
)
addr := fmt.Sprintf("127.0.0.1:%d", consts.TEST_TCP2_FRP_PORT)
for i := 0; i < 6; i++ {
res, err := util.SendTcpMsg(addr, consts.TEST_TCP_ECHO_STR)
assert.NoError(err)
switch res {
case consts.TEST_TCP_ECHO_STR:
p1++
case consts.TEST_TCP_ECHO_STR + consts.TEST_TCP_ECHO_STR:
p2++
}
}
assert.True(p1 > 0 && p2 > 0, "group proxies load balancing")
} | explode_data.jsonl/79670 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 230
} | [
2830,
3393,
2808,
1155,
353,
8840,
836,
8,
341,
6948,
1669,
2060,
7121,
1155,
692,
2405,
2399,
197,
3223,
16,
526,
198,
197,
3223,
17,
526,
198,
197,
340,
53183,
1669,
8879,
17305,
445,
16,
17,
22,
13,
15,
13,
15,
13,
16,
7533,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestReadFSMetadata(t *testing.T) {
disk := filepath.Join(globalTestTmpDir, "minio-"+nextSuffix())
defer removeAll(disk)
obj := initFSObjects(disk, t)
fs := obj.(*fsObjects)
bucketName := "bucket"
objectName := "object"
if err := obj.MakeBucket(bucketName); err != nil {
t.Fatal("Unexpected err: ", err)
}
sha256sum := ""
if _, err := obj.PutObject(bucketName, objectName, int64(len("abcd")), bytes.NewReader([]byte("abcd")),
map[string]string{"X-Amz-Meta-AppId": "a"}, sha256sum); err != nil {
t.Fatal("Unexpected err: ", err)
}
// Construct the full path of fs.json
fsPath := pathJoin("buckets", bucketName, objectName, "fs.json")
fsPath = pathJoin(fs.fsPath, minioMetaBucket, fsPath)
rlk, err := fs.rwPool.Open(fsPath)
if err != nil {
t.Fatal("Unexpected error ", err)
}
defer rlk.Close()
// Regular fs metadata reading, no errors expected
fsMeta := fsMetaV1{}
if _, err = fsMeta.ReadFrom(rlk.LockedFile); err != nil {
t.Fatal("Unexpected error ", err)
}
} | explode_data.jsonl/68541 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 394
} | [
2830,
3393,
4418,
8485,
14610,
1155,
353,
8840,
836,
8,
341,
2698,
3187,
1669,
26054,
22363,
31951,
2271,
35986,
6184,
11,
330,
1065,
815,
52077,
3600,
40177,
2398,
16867,
65099,
1500,
3187,
692,
22671,
1669,
2930,
8485,
11543,
1500,
3187... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestTruncationSafety(t *testing.T) {
maxSize := 3
newBlocks := 10
rl := NewTestChain(maxSize)
item := rl.newest
for i := 0; i < newBlocks; i++ {
rl.appendBlock(&cb.Block{Header: &cb.BlockHeader{Number: uint64(i + 1)}})
}
count := 0
for item.next != nil {
item = item.next
count++
}
if count != newBlocks {
t.Fatalf("The iterator should have found %d new blocks but found %d", newBlocks, count)
}
} | explode_data.jsonl/76440 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 165
} | [
2830,
3393,
1282,
1347,
367,
73037,
1155,
353,
8840,
836,
8,
341,
22543,
1695,
1669,
220,
18,
198,
8638,
29804,
1669,
220,
16,
15,
198,
197,
2381,
1669,
1532,
2271,
18837,
8739,
1695,
340,
22339,
1669,
38877,
4618,
477,
198,
2023,
600... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 4 |
func TestEtcdGetService(t *testing.T) {
ctx := api.NewDefaultContext()
fakeClient := tools.NewFakeEtcdClient(t)
key, _ := makeServiceKey(ctx, "foo")
fakeClient.Set(key, runtime.EncodeOrDie(latest.Codec, &api.Service{TypeMeta: api.TypeMeta{ID: "foo"}}), 0)
registry := NewTestEtcdRegistry(fakeClient)
service, err := registry.GetService(ctx, "foo")
if err != nil {
t.Errorf("unexpected error: %v", err)
}
if service.ID != "foo" {
t.Errorf("Unexpected service: %#v", service)
}
} | explode_data.jsonl/8168 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 192
} | [
2830,
3393,
31860,
4385,
1949,
1860,
1155,
353,
8840,
836,
8,
341,
20985,
1669,
6330,
7121,
3675,
1972,
741,
1166,
726,
2959,
1669,
7375,
7121,
52317,
31860,
4385,
2959,
1155,
340,
23634,
11,
716,
1669,
1281,
1860,
1592,
7502,
11,
330,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
func TestParseIndexRoot(t *testing.T) {
input := decodeHex(t, "30000000010000000010000001000000100000008800000088000000000000005fac0600000006006800520000000000398c060000003b00de3ef1e234dcd501de3ef1e234dcd50118dbd2e334dcd501de3ef1e234dcd501000000000000000000000000000000002000000000000000080374006500730074002e0074007800740000002800000000000000000000001000000002000000")
out, err := mft.ParseIndexRoot(input)
require.Nilf(t, err, "could not parse attribute: %v", err)
expected := mft.IndexRoot{
AttributeType: mft.AttributeTypeFileName,
CollationType: 1,
BytesPerRecord: 4096,
ClustersPerRecord: 1,
Flags: 0,
Entries: []mft.IndexEntry{
mft.IndexEntry{
FileReference: mft.FileReference{RecordNumber: 437343, SequenceNumber: 6},
Flags: 0,
FileName: mft.FileName{
ParentFileReference: mft.FileReference{RecordNumber: 429113, SequenceNumber: 59},
Creation: time.Date(2020, time.February, 5, 14, 59, 38, 116886200, time.UTC),
FileLastModified: time.Date(2020, time.February, 5, 14, 59, 38, 116886200, time.UTC),
MftLastModified: time.Date(2020, time.February, 5, 14, 59, 39, 595445600, time.UTC),
LastAccess: time.Date(2020, time.February, 5, 14, 59, 38, 116886200, time.UTC),
AllocatedSize: 0,
ActualSize: 0,
Flags: 32,
ExtendedData: 0,
Namespace: 3,
Name: "test.txt",
},
SubNodeVCN: 0x0,
},
mft.IndexEntry{FileReference: mft.FileReference{}, Flags: 2, FileName: mft.FileName{}, SubNodeVCN: 0x0},
},
}
assert.Equal(t, expected, out)
} | explode_data.jsonl/8275 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 746
} | [
2830,
3393,
14463,
1552,
8439,
1155,
353,
8840,
836,
8,
341,
22427,
1669,
16895,
20335,
1155,
11,
330,
18,
15,
15,
15,
15,
15,
15,
15,
15,
16,
15,
15,
15,
15,
15,
15,
15,
15,
16,
15,
15,
15,
15,
15,
15,
16,
15,
15,
15,
15,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestNewMapFromID(t *testing.T) {
testutils.SkipOnOldKernel(t, "4.13", "bpf_map_get_fd_by_id")
hash := createHash()
defer hash.Close()
var next MapID
var err error
next, err = hash.ID()
if err != nil {
t.Fatal("Could not get ID of map:", err)
}
if _, err = NewMapFromID(next); err != nil {
t.Fatalf("Can't get map for ID %d: %v", uint32(next), err)
}
// As there can be multiple maps, we use max(uint32) as MapID to trigger an expected error.
_, err = NewMapFromID(MapID(math.MaxUint32))
if !errors.Is(err, ErrNotExist) {
t.Fatal("Expected ErrNotExist, got:", err)
}
} | explode_data.jsonl/21677 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 246
} | [
2830,
3393,
3564,
2227,
3830,
915,
1155,
353,
8840,
836,
8,
341,
18185,
6031,
57776,
1925,
18284,
26343,
1155,
11,
330,
19,
13,
16,
18,
497,
330,
65,
15897,
5376,
3062,
17676,
3710,
842,
5130,
50333,
1669,
1855,
6370,
741,
16867,
5175... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestTopDownArithmetic(t *testing.T) {
tests := []struct {
note string
rules []string
expected interface{}
}{
{"plus", []string{`p[y] { a[i] = x; y = i + x }`}, "[1,3,5,7]"},
{"minus", []string{`p[y] { a[i] = x; y = i - x }`}, "[-1]"},
{"multiply", []string{`p[y] { a[i] = x; y = i * x }`}, "[0,2,6,12]"},
{"divide+round", []string{`p[z] { a[i] = x; y = i / x; round(y, z) }`}, "[0, 1]"},
{"divide+error", []string{`p[y] { a[i] = x; y = x / i }`}, fmt.Errorf("divide by zero")},
{"abs", []string{`p = true { abs(-10, x); x = 10 }`}, "true"},
{"arity 1 ref dest", []string{`p = true { abs(-4, a[3]) }`}, "true"},
{"arity 1 ref dest (2)", []string{`p = true { not abs(-5, a[3]) }`}, "true"},
{"arity 2 ref dest", []string{`p = true { a[2] = 1 + 2 }`}, "true"},
{"arity 2 ref dest (2)", []string{`p = true { not a[2] = 2 + 3 }`}, "true"},
}
data := loadSmallTestData()
for _, tc := range tests {
runTopDownTestCase(t, data, tc.note, tc.rules, tc.expected)
}
} | explode_data.jsonl/25209 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 467
} | [
2830,
3393,
5366,
4454,
6953,
25922,
1155,
353,
8840,
836,
8,
341,
78216,
1669,
3056,
1235,
341,
197,
9038,
1272,
257,
914,
198,
197,
7000,
2425,
262,
3056,
917,
198,
197,
42400,
3749,
16094,
197,
59403,
197,
197,
4913,
7138,
497,
305... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
func TestSleepWithContext_Canceled(t *testing.T) {
ctx := &awstesting.FakeContext{DoneCh: make(chan struct{})}
expectErr := fmt.Errorf("context canceled")
ctx.Error = expectErr
close(ctx.DoneCh)
err := aws.SleepWithContext(ctx, 1*time.Millisecond)
if err == nil {
t.Fatalf("expect error, did not get one")
}
if e, a := expectErr, err; e != a {
t.Errorf("expect %v error, got %v", e, a)
}
} | explode_data.jsonl/49373 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 164
} | [
2830,
3393,
41745,
91101,
920,
38392,
1155,
353,
8840,
836,
8,
341,
20985,
1669,
609,
672,
267,
59855,
991,
726,
1972,
90,
17453,
1143,
25,
1281,
35190,
2036,
28875,
630,
24952,
7747,
1669,
8879,
13080,
445,
2147,
33446,
5130,
20985,
61... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
func TestIntegrationTCPConnectGoodWithDoT(t *testing.T) {
ctx := context.Background()
results := TCPConnect(ctx, TCPConnectConfig{
Address: "ooni.io:443",
DNSServerNetwork: "dot",
DNSServerAddress: "9.9.9.9:853",
})
if results.Error != nil {
t.Fatal(results.Error)
}
} | explode_data.jsonl/53545 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 122
} | [
2830,
3393,
52464,
49896,
14611,
15216,
2354,
5404,
51,
1155,
353,
8840,
836,
8,
341,
20985,
1669,
2266,
19047,
741,
55497,
1669,
26656,
14611,
7502,
11,
26656,
14611,
2648,
515,
197,
98090,
25,
688,
330,
9009,
72,
4245,
25,
19,
19,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
func TestReconcileInstanceDeleteUsingOriginatingIdentity(t *testing.T) {
for _, tc := range originatingIdentityTestCases {
func() {
prevOrigIDEnablement := sctestutil.EnableOriginatingIdentity(t, tc.enableOriginatingIdentity)
defer utilfeature.DefaultMutableFeatureGate.Set(fmt.Sprintf("%v=%v", scfeatures.OriginatingIdentity, prevOrigIDEnablement))
_, fakeCatalogClient, fakeBrokerClient, testController, sharedInformers := newTestController(t, fakeosb.FakeClientConfiguration{
DeprovisionReaction: &fakeosb.DeprovisionReaction{
Response: &osb.DeprovisionResponse{},
},
})
sharedInformers.ClusterServiceBrokers().Informer().GetStore().Add(getTestClusterServiceBroker())
sharedInformers.ClusterServiceClasses().Informer().GetStore().Add(getTestClusterServiceClass())
sharedInformers.ClusterServicePlans().Informer().GetStore().Add(getTestClusterServicePlan())
instance := getTestServiceInstanceWithClusterRefs()
instance.ObjectMeta.DeletionTimestamp = &metav1.Time{}
instance.ObjectMeta.Finalizers = []string{v1beta1.FinalizerServiceCatalog}
// we only invoke the broker client to deprovision if we have a
// ReconciledGeneration set as that implies a previous success.
instance.Generation = 2
instance.Status.ReconciledGeneration = 1
instance.Status.ObservedGeneration = 1
instance.Status.ProvisionStatus = v1beta1.ServiceInstanceProvisionStatusProvisioned
instance.Status.DeprovisionStatus = v1beta1.ServiceInstanceDeprovisionStatusRequired
instance.Status.ExternalProperties = &v1beta1.ServiceInstancePropertiesState{
ClusterServicePlanExternalName: testClusterServicePlanName,
ClusterServicePlanExternalID: testClusterServicePlanGUID,
}
if tc.includeUserInfo {
instance.Spec.UserInfo = testUserInfo
}
fakeCatalogClient.AddReactor("get", "instances", func(action clientgotesting.Action) (bool, runtime.Object, error) {
return true, instance, nil
})
if err := reconcileServiceInstance(t, testController, instance); err != nil {
t.Fatalf("unexpected error: %v", err)
}
instance = assertServiceInstanceDeprovisionInProgressIsTheOnlyCatalogClientAction(t, fakeCatalogClient, instance)
fakeCatalogClient.ClearActions()
err := reconcileServiceInstance(t, testController, instance)
if err != nil {
t.Fatalf("This should not fail")
}
brokerActions := fakeBrokerClient.Actions()
assertNumberOfBrokerActions(t, brokerActions, 1)
actualRequest, ok := brokerActions[0].Request.(*osb.DeprovisionRequest)
if !ok {
t.Errorf("%v: unexpected request type; expected %T, got %T", tc.name, &osb.DeprovisionRequest{}, actualRequest)
return
}
var expectedOriginatingIdentity *osb.OriginatingIdentity
if tc.expectedOriginatingIdentity {
expectedOriginatingIdentity = testOriginatingIdentity
}
assertOriginatingIdentity(t, expectedOriginatingIdentity, actualRequest.OriginatingIdentity)
}()
}
} | explode_data.jsonl/58178 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 985
} | [
2830,
3393,
693,
40446,
457,
2523,
6435,
16429,
13298,
1095,
18558,
1155,
353,
8840,
836,
8,
341,
2023,
8358,
17130,
1669,
2088,
70273,
18558,
2271,
37302,
341,
197,
29244,
368,
1476,
298,
50728,
62726,
915,
11084,
478,
1669,
274,
67880,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestInstallPackagePath(t *testing.T) {
serverDir, err := ioutil.TempDir(os.TempDir(), "istio-test-server-*")
if err != nil {
t.Fatal(err)
}
defer os.RemoveAll(serverDir)
if err := tgz.Create(string(liveCharts), filepath.Join(serverDir, testTGZFilename)); err != nil {
t.Fatal(err)
}
srv := httpserver.NewServer(serverDir)
runTestGroup(t, testGroup{
{
// Use some arbitrary small test input (pilot only) since we are testing the local filesystem code here, not
// manifest generation.
desc: "install_package_path",
diffSelect: "Deployment:*:istiod",
flags: "--set installPackagePath=" + string(liveCharts),
},
{
// Specify both charts and profile from local filesystem.
desc: "install_package_path",
diffSelect: "Deployment:*:istiod",
flags: fmt.Sprintf("--set installPackagePath=%s --set profile=%s/profiles/default.yaml", string(liveCharts), string(liveCharts)),
},
{
// --force is needed for version mismatch.
desc: "install_package_path",
diffSelect: "Deployment:*:istiod",
flags: "--force --set installPackagePath=" + srv.URL() + "/" + testTGZFilename,
},
})
} | explode_data.jsonl/47919 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 451
} | [
2830,
3393,
24690,
13100,
1820,
1155,
353,
8840,
836,
8,
341,
41057,
6184,
11,
1848,
1669,
43144,
65009,
6184,
9638,
65009,
6184,
1507,
330,
380,
815,
16839,
26300,
44903,
1138,
743,
1848,
961,
2092,
341,
197,
3244,
26133,
3964,
340,
19... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
func TestStartServerTLSOverwriteCipher(t *testing.T) {
s, err := NewServer()
require.NoError(t, err)
testDir, _ := fileutils.FindDir("tests")
s.UpdateConfig(func(cfg *model.Config) {
*cfg.ServiceSettings.ListenAddress = ":0"
*cfg.ServiceSettings.ConnectionSecurity = "TLS"
cfg.ServiceSettings.TLSOverwriteCiphers = []string{
"TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256",
"TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256",
}
*cfg.ServiceSettings.TLSKeyFile = path.Join(testDir, "tls_test_key.pem")
*cfg.ServiceSettings.TLSCertFile = path.Join(testDir, "tls_test_cert.pem")
})
serverErr := s.Start()
tr := &http.Transport{
TLSClientConfig: &tls.Config{
InsecureSkipVerify: true,
CipherSuites: []uint16{
tls.TLS_RSA_WITH_AES_128_GCM_SHA256,
},
MaxVersion: tls.VersionTLS12,
},
}
client := &http.Client{Transport: tr}
err = checkEndpoint(t, client, "https://localhost:"+strconv.Itoa(s.ListenAddr.Port)+"/", http.StatusNotFound)
require.Error(t, err, "Expected error due to Cipher mismatch")
if !strings.Contains(err.Error(), "remote error: tls: handshake failure") {
t.Errorf("Expected protocol version error, got %s", err)
}
client.Transport = &http.Transport{
TLSClientConfig: &tls.Config{
InsecureSkipVerify: true,
CipherSuites: []uint16{
tls.TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,
tls.TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,
},
MaxVersion: tls.VersionTLS12,
},
}
err = checkEndpoint(t, client, "https://localhost:"+strconv.Itoa(s.ListenAddr.Port)+"/", http.StatusNotFound)
if err != nil {
t.Errorf("Expected nil, got %s", err)
}
s.Shutdown()
require.NoError(t, serverErr)
} | explode_data.jsonl/47831 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 714
} | [
2830,
3393,
3479,
5475,
45439,
1918,
4934,
79460,
1155,
353,
8840,
836,
8,
341,
1903,
11,
1848,
1669,
1532,
5475,
741,
17957,
35699,
1155,
11,
1848,
692,
18185,
6184,
11,
716,
1669,
1034,
6031,
9998,
6184,
445,
23841,
1138,
1903,
16689,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestRenameColumn(t *testing.T) {
store, clean := testkit.CreateMockStoreWithSchemaLease(t, columnModifyLease)
defer clean()
tk := testkit.NewTestKit(t, store)
tk.MustExec("use test")
assertColNames := func(tableName string, colNames ...string) {
cols := external.GetTableByName(t, tk, "test", tableName).Cols()
require.Equal(t, len(colNames), len(cols))
for i := range cols {
require.Equal(t, strings.ToLower(colNames[i]), cols[i].Name.L)
}
}
tk.MustExec("create table test_rename_column (id int not null primary key auto_increment, col1 int)")
tk.MustExec("alter table test_rename_column rename column col1 to col1")
assertColNames("test_rename_column", "id", "col1")
tk.MustExec("alter table test_rename_column rename column col1 to col2")
assertColNames("test_rename_column", "id", "col2")
// Test renaming non-exist columns.
tk.MustGetErrCode("alter table test_rename_column rename column non_exist_col to col3", errno.ErrBadField)
// Test renaming to an exist column.
tk.MustGetErrCode("alter table test_rename_column rename column col2 to id", errno.ErrDupFieldName)
// Test renaming the column with foreign key.
tk.MustExec("drop table test_rename_column")
tk.MustExec("create table test_rename_column_base (base int)")
tk.MustExec("create table test_rename_column (col int, foreign key (col) references test_rename_column_base(base))")
tk.MustGetErrCode("alter table test_rename_column rename column col to col1", errno.ErrFKIncompatibleColumns)
tk.MustExec("drop table test_rename_column_base")
// Test renaming generated columns.
tk.MustExec("drop table test_rename_column")
tk.MustExec("create table test_rename_column (id int, col1 int generated always as (id + 1))")
tk.MustExec("alter table test_rename_column rename column col1 to col2")
assertColNames("test_rename_column", "id", "col2")
tk.MustExec("alter table test_rename_column rename column col2 to col1")
assertColNames("test_rename_column", "id", "col1")
tk.MustGetErrCode("alter table test_rename_column rename column id to id1", errno.ErrDependentByGeneratedColumn)
// Test renaming view columns.
tk.MustExec("drop table test_rename_column")
tk.MustExec("create table test_rename_column (id int, col1 int)")
tk.MustExec("create view test_rename_column_view as select * from test_rename_column")
tk.MustExec("alter table test_rename_column rename column col1 to col2")
tk.MustGetErrCode("select * from test_rename_column_view", errno.ErrViewInvalid)
tk.MustExec("drop view test_rename_column_view")
tk.MustExec("drop table test_rename_column")
// Test rename a non-exists column. See https://github.com/pingcap/tidb/issues/34811.
tk.MustExec("drop table if exists t;")
tk.MustExec("create table t (a int);")
tk.MustGetErrCode("alter table t rename column b to b;", errno.ErrBadField)
} | explode_data.jsonl/51311 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 969
} | [
2830,
3393,
88757,
2933,
1155,
353,
8840,
836,
8,
341,
57279,
11,
4240,
1669,
1273,
8226,
7251,
11571,
6093,
2354,
8632,
2304,
519,
1155,
11,
3250,
44427,
2304,
519,
340,
16867,
4240,
2822,
3244,
74,
1669,
1273,
8226,
7121,
2271,
7695,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestECDSAKeyGenNonEphemeral(t *testing.T) {
t.Parallel()
provider, _, cleanup := currentTestConfig.Provider(t)
defer cleanup()
k, err := provider.KeyGen(&bccsp.ECDSAKeyGenOpts{Temporary: false})
if err != nil {
t.Fatalf("Failed generating ECDSA key [%s]", err)
}
if k == nil {
t.Fatal("Failed generating ECDSA key. Key must be different from nil")
}
if !k.Private() {
t.Fatal("Failed generating ECDSA key. Key should be private")
}
if k.Symmetric() {
t.Fatal("Failed generating ECDSA key. Key should be asymmetric")
}
} | explode_data.jsonl/29256 | {
"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,
7498,
72638,
1592,
9967,
8121,
36,
59941,
3253,
1155,
353,
8840,
836,
8,
341,
3244,
41288,
7957,
741,
197,
19979,
11,
8358,
21290,
1669,
1482,
2271,
2648,
36208,
1155,
340,
16867,
21290,
2822,
16463,
11,
1848,
1669,
9109,
96... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestParseError(t *testing.T) {
var args struct {
Foo string `arg:"this_is_not_valid"`
}
os.Args = []string{"example", "--bar"}
err := Parse(&args)
assert.Error(t, err)
} | explode_data.jsonl/13032 | {
"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,
14463,
1454,
1155,
353,
8840,
836,
8,
341,
2405,
2827,
2036,
341,
197,
12727,
2624,
914,
1565,
858,
2974,
574,
6892,
7913,
8337,
8805,
197,
532,
25078,
51015,
284,
3056,
917,
4913,
8687,
497,
14482,
2257,
16707,
9859,
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 |
func TestConsulDeleteRecord(t *testing.T) {
consulReset()
err := cache.DeleteRecord("nanobox.io")
cache.AddRecord(&nanopack)
err2 := cache.DeleteRecord("nanopack.io")
if err != nil || err2 != nil {
t.Errorf("Failed to delete record from consul cacher - %v%v", err, err2)
}
} | explode_data.jsonl/61011 | {
"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,
15220,
360,
6435,
6471,
1155,
353,
8840,
836,
8,
341,
197,
6254,
360,
14828,
741,
9859,
1669,
6500,
18872,
6471,
445,
18759,
32460,
4245,
1138,
52680,
1904,
6471,
2099,
18759,
453,
473,
340,
9859,
17,
1669,
6500,
18872,
6471... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestCSS(t *testing.T) {
config := asset.Info{
Folder: "testdata",
}
fm := config.Map("/")
temp, err := template.New("test").Funcs(fm).Parse(`{{CSS "/test.css" "all"}}`)
if err != nil {
t.Fatal(err)
}
buf := new(bytes.Buffer)
err = temp.Execute(buf, nil)
if err != nil {
t.Fatal(err)
}
expected := `<link media="all" rel="stylesheet" type="text/css" href="/test.css?`
received := buf.String()
if !strings.HasPrefix(received, expected) {
t.Errorf("\n got: %v\nwant: %v", received, expected)
}
} | explode_data.jsonl/46963 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 220
} | [
2830,
3393,
33658,
1155,
353,
8840,
836,
8,
341,
25873,
1669,
9329,
20132,
515,
197,
12727,
2018,
25,
330,
92425,
756,
197,
630,
1166,
76,
1669,
2193,
10104,
4283,
5130,
16280,
11,
1848,
1669,
3811,
7121,
445,
1944,
1827,
9626,
82,
91... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestTags_Delete(t *testing.T) {
setup()
defer teardown()
mux.HandleFunc("/v2/tags/testing-1", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "DELETE")
})
_, err := client.Tags.Delete("testing-1")
if err != nil {
t.Errorf("Tags.Delete returned error: %v", err)
}
} | explode_data.jsonl/19729 | {
"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,
15930,
57418,
1155,
353,
8840,
836,
8,
341,
84571,
741,
16867,
49304,
2822,
2109,
2200,
63623,
4283,
85,
17,
84460,
28801,
12,
16,
497,
2915,
3622,
1758,
37508,
11,
435,
353,
1254,
9659,
8,
341,
197,
18185,
3523,
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 TestRedis_Hvals(t *testing.T) {
runOnRedis(t, func(client *Redis) {
assert.NotNil(t, NewRedis(client.Addr, "").Hset("a", "aa", "aaa"))
assert.Nil(t, client.Hset("a", "aa", "aaa"))
assert.Nil(t, client.Hset("a", "bb", "bbb"))
_, err := NewRedis(client.Addr, "").Hvals("a")
assert.NotNil(t, err)
vals, err := client.Hvals("a")
assert.Nil(t, err)
assert.ElementsMatch(t, []string{"aaa", "bbb"}, vals)
})
} | explode_data.jsonl/39157 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 202
} | [
2830,
3393,
48137,
2039,
25596,
1155,
353,
8840,
836,
8,
341,
56742,
1925,
48137,
1155,
11,
2915,
12805,
353,
48137,
8,
341,
197,
6948,
93882,
1155,
11,
1532,
48137,
12805,
93626,
11,
35229,
39,
746,
445,
64,
497,
330,
5305,
497,
330,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestTextSearchMinimalRequestURL(t *testing.T) {
expectedQuery := "key=AIzaNotReallyAnAPIKey&query=Pizza+in+New+York"
server := mockServerForQuery(expectedQuery, 200, `{"status":"OK"}"`)
defer server.s.Close()
c, _ := NewClient(WithAPIKey(apiKey))
c.baseURL = server.s.URL
r := &TextSearchRequest{
Query: "Pizza in New York",
}
_, err := c.TextSearch(context.Background(), r)
if err != nil {
t.Errorf("Unexpected error in constructing request URL: %+v", err)
}
if server.successful != 1 {
t.Errorf("Got URL(s) %v, want %s", server.failed, expectedQuery)
}
} | explode_data.jsonl/76292 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 218
} | [
2830,
3393,
1178,
5890,
88328,
1900,
3144,
1155,
353,
8840,
836,
8,
341,
42400,
2859,
1669,
330,
792,
28,
15469,
4360,
2623,
48785,
2082,
7082,
1592,
5,
1631,
76778,
13741,
10,
258,
10,
3564,
10,
98977,
1837,
41057,
1669,
7860,
5475,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestConsulDiscovery_Deregister(t *testing.T) {
t.Parallel()
c, s := testConsulServer(t)
defer closecs(s)
d := testNewConsulDiscovery(c)
rs := RegisterService{
ID: "123",
GraphID: "ns",
TypeNode: "worker",
Address: "192.168.100.1",
Port: 8080,
}
d.Register(rs)
d.Deregister(rs.ID)
_, _, err := c.Agent().Service(rs.ID, &api.QueryOptions{})
assert.Contains(t, err.Error(), "404")
} | explode_data.jsonl/69057 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 195
} | [
2830,
3393,
15220,
360,
67400,
1557,
52633,
1571,
1155,
353,
8840,
836,
8,
341,
3244,
41288,
7957,
2822,
1444,
11,
274,
1669,
1273,
15220,
360,
5475,
1155,
340,
16867,
3265,
4837,
1141,
340,
2698,
1669,
1273,
3564,
15220,
360,
67400,
13... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestArrayFloat64(t *testing.T) {
descriptor := test.NewAggregatorTest(metric.ValueRecorderKind, metric.Float64NumberKind)
fpsf := func(sign int) []float64 {
// Check behavior of a bunch of odd floating
// points except for NaN, which is invalid.
return []float64{
0,
1 / math.Inf(sign),
1,
2,
1e100,
math.MaxFloat64,
math.SmallestNonzeroFloat64,
math.MaxFloat32,
math.SmallestNonzeroFloat32,
math.E,
math.Pi,
math.Phi,
math.Sqrt2,
math.SqrtE,
math.SqrtPi,
math.SqrtPhi,
math.Ln2,
math.Log2E,
math.Ln10,
math.Log10E,
}
}
all := test.NewNumbers(metric.Float64NumberKind)
agg, ckpt := new2()
for _, f := range fpsf(1) {
all.Append(metric.NewFloat64Number(f))
test.CheckedUpdate(t, agg, metric.NewFloat64Number(f), descriptor)
}
for _, f := range fpsf(-1) {
all.Append(metric.NewFloat64Number(f))
test.CheckedUpdate(t, agg, metric.NewFloat64Number(f), descriptor)
}
require.NoError(t, agg.SynchronizedMove(ckpt, descriptor))
all.Sort()
sum, err := ckpt.Sum()
require.Nil(t, err)
allSum := all.Sum()
require.InEpsilon(t, (&allSum).AsFloat64(), sum.AsFloat64(), 0.0000001, "Same sum")
count, err := ckpt.Count()
require.Equal(t, all.Count(), count, "Same count")
require.Nil(t, err)
min, err := ckpt.Min()
require.Nil(t, err)
require.Equal(t, all.Min(), min, "Same min")
max, err := ckpt.Max()
require.Nil(t, err)
require.Equal(t, all.Max(), max, "Same max")
qx, err := ckpt.Quantile(0.5)
require.Nil(t, err)
require.Equal(t, all.Median(), qx, "Same median")
po, err := ckpt.Points()
require.Nil(t, err)
require.Equal(t, all.Len(), len(po), "Points() must have same length of updates")
for i := 0; i < len(po); i++ {
require.Equal(t, all.Points()[i], po[i], "Wrong point at position %d", i)
}
} | explode_data.jsonl/28117 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 811
} | [
2830,
3393,
1857,
5442,
21,
19,
1155,
353,
8840,
836,
8,
341,
52912,
6820,
1669,
1273,
7121,
9042,
58131,
2271,
86265,
6167,
47023,
10629,
11,
18266,
29794,
21,
19,
2833,
10629,
692,
1166,
1690,
69,
1669,
2915,
40046,
526,
8,
3056,
36... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestValidatePodConditions(t *testing.T) {
successCases := []struct {
desc string
podConditions []core.PodCondition
}{
{
"no condition",
[]core.PodCondition{},
},
{
"one system condition",
[]core.PodCondition{
{
Type: core.PodReady,
Status: core.ConditionTrue,
},
},
},
{
"one system condition and one custom condition",
[]core.PodCondition{
{
Type: core.PodReady,
Status: core.ConditionTrue,
},
{
Type: core.PodConditionType("example.com/condition"),
Status: core.ConditionFalse,
},
},
},
{
"two custom condition",
[]core.PodCondition{
{
Type: core.PodConditionType("foobar"),
Status: core.ConditionTrue,
},
{
Type: core.PodConditionType("example.com/condition"),
Status: core.ConditionFalse,
},
},
},
}
for _, tc := range successCases {
if errs := validatePodConditions(tc.podConditions, field.NewPath("field")); len(errs) != 0 {
t.Errorf("expected tc %q to success, but got: %v", tc.desc, errs)
}
}
errorCases := []struct {
desc string
podConditions []core.PodCondition
}{
{
"one system condition and a invalid custom condition",
[]core.PodCondition{
{
Type: core.PodReady,
Status: core.ConditionStatus("True"),
},
{
Type: core.PodConditionType("invalid/custom/condition"),
Status: core.ConditionStatus("True"),
},
},
},
}
for _, tc := range errorCases {
if errs := validatePodConditions(tc.podConditions, field.NewPath("field")); len(errs) == 0 {
t.Errorf("expected tc %q to fail", tc.desc)
}
}
} | explode_data.jsonl/1028 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 726
} | [
2830,
3393,
17926,
23527,
35435,
1155,
353,
8840,
836,
8,
341,
30553,
37302,
1669,
3056,
1235,
341,
197,
41653,
688,
914,
198,
197,
3223,
347,
35435,
3056,
2153,
88823,
10547,
198,
197,
59403,
197,
197,
515,
298,
197,
1,
2152,
2971,
7... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 5 |
func TestRole(t *testing.T) {
config.TestInit(t)
ctx := context.Background()
db, err := database.NewDatabase(ctx)
require.NoError(t, err)
defer db.Close()
dummy := tools.NewDummyUser()
_, err = dummy.AddUserInfo(ctx, db)
require.NoError(t, err)
goretry.Retry(t, func() bool {
entity, err := models.GetUserDataByUserID(ctx, db, dummy.UserID)
require.NoError(t, err)
return entity != nil
}, "roleが追加されている")
err = admin.AddRole(ctx, db, "test", dummy.UserID)
require.NoError(t, err)
goretry.Retry(t, func() bool {
user, err := models.GetUserDataByUserID(ctx, db, dummy.UserID)
require.NoError(t, err)
role, err := models.GetRoleByUserID(ctx, db, dummy.UserID)
require.NoError(t, err)
return user != nil && role != nil && find(user.Role, "test") && find(role.Role, "test")
}, "")
err = admin.DeleteRole(ctx, db, "test", dummy.UserID)
require.NoError(t, err)
goretry.Retry(t, func() bool {
user, err := models.GetUserDataByUserID(ctx, db, dummy.UserID)
require.NoError(t, err)
role, err := models.GetRoleByUserID(ctx, db, dummy.UserID)
require.NoError(t, err)
return user != nil && role != nil && !find(user.Role, "test") && !find(role.Role, "test")
}, "roleが削除されている")
} | explode_data.jsonl/13350 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 502
} | [
2830,
3393,
9030,
1155,
353,
8840,
836,
8,
341,
25873,
8787,
3803,
1155,
692,
20985,
1669,
2266,
19047,
2822,
20939,
11,
1848,
1669,
4625,
7121,
5988,
7502,
340,
17957,
35699,
1155,
11,
1848,
340,
16867,
2927,
10421,
2822,
2698,
8574,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestAllocateTiny(t *testing.T) {
_, cidr, err := net.ParseCIDR("192.168.1.0/32")
if err != nil {
t.Fatal(err)
}
r, err := NewCIDRRange(cidr)
if err != nil {
t.Fatal(err)
}
if f := r.Free(); f != 0 {
t.Errorf("free: %d", f)
}
if _, err := r.AllocateNext(); err != ErrFull {
t.Error(err)
}
} | explode_data.jsonl/69569 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 161
} | [
2830,
3393,
75380,
85693,
1155,
353,
8840,
836,
8,
341,
197,
6878,
32141,
81,
11,
1848,
1669,
4179,
8937,
54146,
49,
445,
16,
24,
17,
13,
16,
21,
23,
13,
16,
13,
15,
14,
18,
17,
1138,
743,
1848,
961,
2092,
341,
197,
3244,
26133,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestStructType(t *testing.T) {
gopClTest(t, `
type bar = foo
type foo struct {
p *bar
A int
B string "tag1:123"
}
func main() {
type a struct {
p *a
}
type b = a
}
`, `package main
type bar = foo
type foo struct {
p *foo
A int
B string "tag1:123"
}
func main() {
type a struct {
p *a
}
type b = a
}
`)
} | explode_data.jsonl/73636 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 154
} | [
2830,
3393,
9422,
929,
1155,
353,
8840,
836,
8,
341,
3174,
453,
5066,
2271,
1155,
11,
22074,
1313,
3619,
284,
15229,
271,
1313,
15229,
2036,
341,
3223,
353,
2257,
198,
22985,
526,
198,
12791,
914,
330,
4578,
16,
25,
16,
17,
18,
698,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_invalid_float(t *testing.T) {
inputs := []string{
`1.e1`, // dot without following digit
`1.`, // dot can not be the last char
``, // empty number
`01`, // extra leading zero
`-`, // negative without digit
`--`, // double negative
`--2`, // double negative
}
for _, input := range inputs {
t.Run(input, func(t *testing.T) {
should := require.New(t)
iter := jsoniter.ParseString(jsoniter.ConfigDefault, input+",")
iter.Skip()
should.NotEqual(io.EOF, iter.Error)
should.NotNil(iter.Error)
v := float64(0)
should.NotNil(json.Unmarshal([]byte(input), &v))
iter = jsoniter.ParseString(jsoniter.ConfigDefault, input+",")
iter.ReadFloat64()
should.NotEqual(io.EOF, iter.Error)
should.NotNil(iter.Error)
iter = jsoniter.ParseString(jsoniter.ConfigDefault, input+",")
iter.ReadFloat32()
should.NotEqual(io.EOF, iter.Error)
should.NotNil(iter.Error)
})
}
} | explode_data.jsonl/73515 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 397
} | [
2830,
3393,
31433,
17586,
1155,
353,
8840,
836,
8,
341,
22427,
82,
1669,
3056,
917,
515,
197,
197,
63,
16,
1734,
16,
7808,
442,
12756,
2041,
2701,
15723,
198,
197,
197,
63,
16,
13,
7808,
256,
442,
12756,
646,
537,
387,
279,
1537,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestAbuseRateLimit(t *testing.T) {
tc := &testTime{now: time.Now()}
ts := httptest.NewTLSServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
if tc.slept == 0 {
w.Header().Set("Retry-After", "1")
http.Error(w, "403 Forbidden", http.StatusForbidden)
}
}))
defer ts.Close()
c := getClient(ts.URL)
c.time = tc
resp, err := c.requestRetry(http.MethodGet, "/", "", nil)
if err != nil {
t.Errorf("Error from request: %v", err)
} else if resp.StatusCode != 200 {
t.Errorf("Expected status code 200, got %d", resp.StatusCode)
} else if tc.slept < time.Second {
t.Errorf("Expected to sleep for at least a second, got %v", tc.slept)
}
} | explode_data.jsonl/6244 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 274
} | [
2830,
3393,
5830,
810,
11564,
16527,
1155,
353,
8840,
836,
8,
341,
78255,
1669,
609,
1944,
1462,
90,
3328,
25,
882,
13244,
23509,
57441,
1669,
54320,
70334,
7121,
13470,
1220,
2836,
19886,
89164,
18552,
3622,
1758,
37508,
11,
435,
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... | 2 |
func TestConfig_getDefaultConfigPathFromEnvURL(t *testing.T) {
ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(http.StatusOK)
}))
defer ts.Close()
c := NewConfig()
err := os.Setenv("TELEGRAF_CONFIG_PATH", ts.URL)
require.NoError(t, err)
configPath, err := getDefaultConfigPath()
require.NoError(t, err)
require.Equal(t, ts.URL, configPath)
err = c.LoadConfig("")
require.NoError(t, err)
} | explode_data.jsonl/72179 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 181
} | [
2830,
3393,
2648,
3062,
3675,
2648,
1820,
3830,
14359,
3144,
1155,
353,
8840,
836,
8,
341,
57441,
1669,
54320,
70334,
7121,
5475,
19886,
89164,
18552,
3622,
1758,
37508,
11,
435,
353,
1254,
9659,
8,
341,
197,
6692,
69794,
19886,
52989,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestParseRenamedStructDefinition(t *testing.T) {
src := `
package main
type Child struct {
Name string
}//@name Student
type Parent struct {
Name string
Child Child
}//@name Teacher
// @Param request body Parent true "query params"
// @Success 200 {object} Parent
// @Router /test [get]
func Fun() {
}
`
f, err := goparser.ParseFile(token.NewFileSet(), "", src, goparser.ParseComments)
assert.NoError(t, err)
p := New()
p.packages.CollectAstFile("api", "api/api.go", f)
_, err = p.packages.ParseTypes()
assert.NoError(t, err)
err = p.ParseRouterAPIInfo("", f)
assert.NoError(t, err)
assert.NoError(t, err)
teacher, ok := p.swagger.Definitions["Teacher"]
assert.True(t, ok)
ref := teacher.Properties["child"].SchemaProps.Ref
assert.Equal(t, "#/definitions/Student", ref.String())
_, ok = p.swagger.Definitions["Student"]
assert.True(t, ok)
path, ok := p.swagger.Paths.Paths["/test"]
assert.True(t, ok)
assert.Equal(t, "#/definitions/Teacher", path.Get.Parameters[0].Schema.Ref.String())
ref = path.Get.Responses.ResponsesProps.StatusCodeResponses[200].ResponseProps.Schema.Ref
assert.Equal(t, "#/definitions/Teacher", ref.String())
} | explode_data.jsonl/63588 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 447
} | [
2830,
3393,
14463,
34625,
3606,
9422,
10398,
1155,
353,
8840,
836,
8,
341,
41144,
1669,
22074,
1722,
1887,
271,
1313,
9391,
2036,
341,
21297,
914,
198,
29450,
31,
606,
11726,
271,
1313,
17022,
2036,
341,
21297,
914,
198,
197,
3652,
9391... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestDownloadChunkInvalidResponseBody(t *testing.T) {
numChunks := 2
cm := make([]execResponseChunk, 0)
for i := 0; i < numChunks; i++ {
cm = append(cm, execResponseChunk{URL: fmt.Sprintf(
"dummyURL%v", i+1), RowCount: rowsInChunk})
}
scd := &snowflakeChunkDownloader{
sc: &snowflakeConn{
rest: &snowflakeRestful{RequestTimeout: defaultRequestTimeout},
},
ctx: context.Background(),
ChunkMetas: cm,
TotalRowIndex: int64(-1),
Qrmk: "HOHOHO",
FuncDownload: downloadChunk,
FuncDownloadHelper: downloadChunkHelper,
FuncGet: getChunkTestInvalidResponseBody,
}
scd.ChunksMutex = &sync.Mutex{}
scd.DoneDownloadCond = sync.NewCond(scd.ChunksMutex)
scd.Chunks = make(map[int][]chunkRowType)
scd.ChunksError = make(chan *chunkError, 1)
scd.FuncDownload(scd.ctx, scd, 1)
select {
case errc := <-scd.ChunksError:
if errc.Index != 1 {
t.Fatalf("the error should have caused with chunk idx: %v", errc.Index)
}
default:
t.Fatal("should have caused an error and queued in scd.ChunksError")
}
} | explode_data.jsonl/1797 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 484
} | [
2830,
3393,
11377,
28304,
7928,
29637,
1155,
353,
8840,
836,
8,
341,
22431,
89681,
1669,
220,
17,
198,
98316,
1669,
1281,
10556,
11748,
2582,
28304,
11,
220,
15,
340,
2023,
600,
1669,
220,
15,
26,
600,
366,
1629,
89681,
26,
600,
1027,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 4 |
func Test_updateMaxIdletimeDuration(t *testing.T) {
testRE := newQueryRegexp()
testcases := []struct {
value string
usename string
datname string
state string
query string
want postgresActivityStat
}{
{value: "1", usename: "", datname: "", state: "", query: "",
want: newPostgresActivityStat(testRE),
},
{value: "10", usename: "testuser", datname: "testdb", state: "active", query: "UPDATE table",
want: newPostgresActivityStat(testRE),
},
{value: "qq", usename: "testuser", datname: "testdb", state: "idle in transaction", query: "UPDATE table",
want: newPostgresActivityStat(testRE),
},
{value: "10", usename: "testuser", datname: "testdb", state: "idle in transaction", query: "UPDATE table",
want: postgresActivityStat{
waitEvents: map[string]float64{},
maxIdleUser: map[string]float64{"testuser/testdb": 10}, maxIdleMaint: map[string]float64{},
maxActiveUser: map[string]float64{}, maxActiveMaint: map[string]float64{},
maxWaitUser: map[string]float64{}, maxWaitMaint: map[string]float64{},
vacuumOps: map[string]float64{"regular": 0, "user": 0, "wraparound": 0},
re: testRE,
},
},
{value: "10", usename: "testuser", datname: "testdb", state: "idle in transaction", query: "autovacuum: VACUUM table",
want: postgresActivityStat{
waitEvents: map[string]float64{},
maxIdleUser: map[string]float64{}, maxIdleMaint: map[string]float64{"testuser/testdb": 10},
maxActiveUser: map[string]float64{}, maxActiveMaint: map[string]float64{},
maxWaitUser: map[string]float64{}, maxWaitMaint: map[string]float64{},
vacuumOps: map[string]float64{"regular": 0, "user": 0, "wraparound": 0},
re: testRE,
},
},
{value: "10", usename: "testuser", datname: "testdb", state: "idle in transaction", query: "VACUUM table",
want: postgresActivityStat{
waitEvents: map[string]float64{},
maxIdleUser: map[string]float64{}, maxIdleMaint: map[string]float64{"testuser/testdb": 10},
maxActiveUser: map[string]float64{}, maxActiveMaint: map[string]float64{},
maxWaitUser: map[string]float64{}, maxWaitMaint: map[string]float64{},
vacuumOps: map[string]float64{"regular": 0, "user": 0, "wraparound": 0},
re: testRE,
},
},
}
for _, tc := range testcases {
s := newPostgresActivityStat(testRE)
s.updateMaxIdletimeDuration(tc.value, tc.usename, tc.datname, tc.state, tc.query)
assert.Equal(t, tc.want, s)
}
} | explode_data.jsonl/74548 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 1001
} | [
2830,
3393,
8882,
5974,
764,
1149,
545,
12945,
1155,
353,
8840,
836,
8,
341,
18185,
787,
1669,
501,
2859,
3477,
4580,
2822,
18185,
23910,
1669,
3056,
1235,
341,
197,
16309,
256,
914,
198,
197,
70175,
1840,
914,
198,
197,
2698,
266,
60... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestEnvPrefix(t *testing.T) {
initJSON()
SetEnvPrefix("foo") // will be uppercased automatically
BindEnv("id")
BindEnv("f", "FOOD") // not using prefix
os.Setenv("FOO_ID", "13")
os.Setenv("FOOD", "apple")
os.Setenv("FOO_NAME", "crunk")
assert.Equal(t, "13", Get("id"))
assert.Equal(t, "apple", Get("f"))
assert.Equal(t, "Cake", Get("name"))
AutomaticEnv()
assert.Equal(t, "crunk", Get("name"))
} | explode_data.jsonl/5560 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 179
} | [
2830,
3393,
14359,
14335,
1155,
353,
8840,
836,
8,
341,
28248,
5370,
2822,
22212,
14359,
14335,
445,
7975,
899,
442,
686,
387,
8416,
91126,
9463,
198,
197,
9950,
14359,
445,
307,
1138,
197,
9950,
14359,
445,
69,
497,
330,
3788,
2069,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestNewServer_NSENotPresented(t *testing.T) {
defer goleak.VerifyNone(t, goleak.IgnoreCurrent())
var localBypassRegistryServer registry.NetworkServiceEndpointRegistryServer
localBypassNetworkServiceServer := localbypass.NewServer(&localBypassRegistryServer)
server := next.NewNetworkServiceServer(localBypassNetworkServiceServer, &testNetworkServiceServer{})
request := &networkservice.NetworkServiceRequest{
Connection: &networkservice.Connection{
NetworkServiceEndpointName: "nse-1",
},
}
ctx := withTestData(context.Background(), &TestData{})
_, err := server.Request(ctx, request)
assert.Nil(t, err)
assert.Nil(t, testData(ctx).clientURL)
ctx = withTestData(context.Background(), &TestData{})
_, err = server.Close(ctx, request.GetConnection())
assert.Nil(t, err)
assert.Nil(t, testData(ctx).clientURL)
} | explode_data.jsonl/2439 | {
"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,
3564,
5475,
1604,
925,
2623,
21195,
291,
1155,
353,
8840,
836,
8,
341,
16867,
728,
273,
585,
54853,
4064,
1155,
11,
728,
273,
585,
48590,
5405,
2398,
2405,
2205,
33,
49911,
15603,
5475,
19424,
30149,
1860,
27380,
15603,
5475... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestHTTPHandlerDefaultFallback(t *testing.T) {
tt := []struct {
method, url string
wantCode int
wantLocation string
}{
{"GET", "http://example.org", 302, "https://example.org/"},
{"GET", "http://example.org/foo", 302, "https://example.org/foo"},
{"GET", "http://example.org/foo/bar/", 302, "https://example.org/foo/bar/"},
{"GET", "http://example.org/?a=b", 302, "https://example.org/?a=b"},
{"GET", "http://example.org/foo?a=b", 302, "https://example.org/foo?a=b"},
{"GET", "http://example.org:80/foo?a=b", 302, "https://example.org:443/foo?a=b"},
{"GET", "http://example.org:80/foo%20bar", 302, "https://example.org:443/foo%20bar"},
{"GET", "http://[2602:d1:xxxx::c60a]:1234", 302, "https://[2602:d1:xxxx::c60a]:443/"},
{"GET", "http://[2602:d1:xxxx::c60a]", 302, "https://[2602:d1:xxxx::c60a]/"},
{"GET", "http://[2602:d1:xxxx::c60a]/foo?a=b", 302, "https://[2602:d1:xxxx::c60a]/foo?a=b"},
{"HEAD", "http://example.org", 302, "https://example.org/"},
{"HEAD", "http://example.org/foo", 302, "https://example.org/foo"},
{"HEAD", "http://example.org/foo/bar/", 302, "https://example.org/foo/bar/"},
{"HEAD", "http://example.org/?a=b", 302, "https://example.org/?a=b"},
{"HEAD", "http://example.org/foo?a=b", 302, "https://example.org/foo?a=b"},
{"POST", "http://example.org", 400, ""},
{"PUT", "http://example.org", 400, ""},
{"GET", "http://example.org/.well-known/acme-challenge/x", 404, ""},
}
var m Manager
h := m.HTTPHandler(nil)
for i, test := range tt {
r := httptest.NewRequest(test.method, test.url, nil)
w := httptest.NewRecorder()
h.ServeHTTP(w, r)
if w.Code != test.wantCode {
t.Errorf("%d: w.Code = %d; want %d", i, w.Code, test.wantCode)
t.Errorf("%d: body: %s", i, w.Body.Bytes())
}
if v := w.Header().Get("Location"); v != test.wantLocation {
t.Errorf("%d: Location = %q; want %q", i, v, test.wantLocation)
}
}
} | explode_data.jsonl/65055 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 833
} | [
2830,
3393,
9230,
3050,
3675,
87206,
1155,
353,
8840,
836,
8,
341,
3244,
83,
1669,
3056,
1235,
341,
197,
42257,
11,
2515,
220,
914,
198,
197,
50780,
2078,
257,
526,
198,
197,
50780,
4707,
914,
198,
197,
59403,
197,
197,
4913,
3806,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestRepositoryBadDefaulting(t *testing.T) {
var berr *ErrBadName
if _, err := NewRepository("index.docker.io/foo", StrictValidation); !errors.As(err, &berr) {
t.Errorf("Not an ErrBadName: %v", err)
}
} | explode_data.jsonl/39010 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 85
} | [
2830,
3393,
4624,
17082,
3675,
287,
1155,
353,
8840,
836,
8,
341,
2405,
293,
615,
353,
7747,
17082,
675,
198,
743,
8358,
1848,
1669,
1532,
4624,
445,
1252,
91131,
4245,
60555,
497,
52881,
13799,
1215,
753,
7650,
20242,
3964,
11,
609,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 2 |
func TestReservedGameServerInFleet(t *testing.T) {
t.Parallel()
ctx := context.Background()
client := framework.AgonesClient.AgonesV1()
flt := defaultFleet(framework.Namespace)
flt.Spec.Replicas = 3
flt, err := client.Fleets(framework.Namespace).Create(ctx, flt, metav1.CreateOptions{})
if assert.NoError(t, err) {
defer client.Fleets(framework.Namespace).Delete(ctx, flt.ObjectMeta.Name, metav1.DeleteOptions{}) // nolint:errcheck
}
framework.AssertFleetCondition(t, flt, e2e.FleetReadyCount(flt.Spec.Replicas))
gsList, err := framework.ListGameServersFromFleet(flt)
assert.NoError(t, err)
assert.Len(t, gsList, int(flt.Spec.Replicas))
// mark one as reserved
gsCopy := gsList[0].DeepCopy()
gsCopy.Status.State = agonesv1.GameServerStateReserved
_, err = client.GameServers(framework.Namespace).Update(ctx, gsCopy, metav1.UpdateOptions{})
assert.NoError(t, err)
// make sure counts are correct
framework.AssertFleetCondition(t, flt, func(fleet *agonesv1.Fleet) bool {
return fleet.Status.ReadyReplicas == 2 && fleet.Status.ReservedReplicas == 1
})
// scale down to 0
flt = scaleFleetSubresource(ctx, t, flt, 0)
framework.AssertFleetCondition(t, flt, e2e.FleetReadyCount(0))
// one should be left behind
framework.AssertFleetCondition(t, flt, func(fleet *agonesv1.Fleet) bool {
result := fleet.Status.ReservedReplicas == 1
logrus.WithField("reserved", fleet.Status.ReservedReplicas).WithField("result", result).Info("waiting for 1 reserved replica")
return result
})
// check against gameservers directly too, just to be extra sure
err = wait.PollImmediate(2*time.Second, 5*time.Minute, func() (done bool, err error) {
list, err := framework.ListGameServersFromFleet(flt)
if err != nil {
return true, err
}
l := len(list)
logrus.WithField("len", l).WithField("state", list[0].Status.State).Info("waiting for 1 reserved gs")
return l == 1 && list[0].Status.State == agonesv1.GameServerStateReserved, nil
})
assert.NoError(t, err)
} | explode_data.jsonl/15423 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 723
} | [
2830,
3393,
53003,
4868,
5475,
641,
37,
18973,
1155,
353,
8840,
836,
8,
341,
3244,
41288,
7957,
741,
20985,
1669,
2266,
19047,
2822,
25291,
1669,
12626,
49850,
3154,
2959,
49850,
3154,
53,
16,
2822,
1166,
4832,
1669,
1638,
37,
18973,
95... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestRetrieveConfigCurrencyPairs(t *testing.T) {
cfg := GetConfig()
err := cfg.LoadConfig(ConfigTestFile)
if err != nil {
t.Errorf(
"Test failed. TestRetrieveConfigCurrencyPairs.LoadConfig: %s", err.Error(),
)
}
err = cfg.RetrieveConfigCurrencyPairs(true)
if err != nil {
t.Errorf(
"Test failed. TestRetrieveConfigCurrencyPairs.RetrieveConfigCurrencyPairs: %s",
err.Error(),
)
}
err = cfg.RetrieveConfigCurrencyPairs(false)
if err != nil {
t.Errorf(
"Test failed. TestRetrieveConfigCurrencyPairs.RetrieveConfigCurrencyPairs: %s",
err.Error(),
)
}
} | explode_data.jsonl/21902 | {
"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,
87665,
2648,
26321,
54228,
1155,
353,
8840,
836,
8,
341,
50286,
1669,
2126,
2648,
741,
9859,
1669,
13286,
13969,
2648,
33687,
2271,
1703,
340,
743,
1848,
961,
2092,
341,
197,
3244,
13080,
1006,
298,
197,
1,
2271,
4641,
13,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 4 |
func Test_getAndParseYaml(t *testing.T) {
testShipyard := `apiVersion: spec.keptn.sh/0.2.0
kind: Shipyard
metadata:
name: shipyard-sockshop
spec:
stages:
- name: dev
sequences:
- name: artifact-delivery
tasks:
- name: evaluation`
var returnedShipyardContent string
server := httptest.NewServer(http.HandlerFunc(func(writer http.ResponseWriter, request *http.Request) {
writer.WriteHeader(http.StatusOK)
writer.Write([]byte(returnedShipyardContent))
}))
type args struct {
arg string
out interface{}
}
tests := []struct {
name string
args args
shipyardContentFromHTTPServer string
expectedShipyard *keptnv2.Shipyard
wantErr bool
}{
{
name: "",
args: args{
arg: server.URL,
out: &keptnv2.Shipyard{},
},
shipyardContentFromHTTPServer: testShipyard,
expectedShipyard: &keptnv2.Shipyard{
ApiVersion: "spec.keptn.sh/0.2.0",
Kind: "Shipyard",
Metadata: keptnv2.Metadata{
Name: "shipyard-sockshop",
},
Spec: keptnv2.ShipyardSpec{
Stages: []keptnv2.Stage{
{
Name: "dev",
Sequences: []keptnv2.Sequence{
{
Name: "artifact-delivery",
Tasks: []keptnv2.Task{
{
Name: "evaluation",
Properties: nil,
},
},
},
},
},
},
},
},
wantErr: false,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
returnedShipyardContent = tt.shipyardContentFromHTTPServer
shipyard, err := retrieveShipyard(tt.args.arg)
assert.Equal(t, string(shipyard), testShipyard)
assert.Equal(t, tt.wantErr, err != nil)
})
}
} | explode_data.jsonl/10569 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 876
} | [
2830,
3393,
3062,
3036,
14463,
56,
9467,
1155,
353,
8840,
836,
8,
1476,
18185,
29624,
17428,
1669,
1565,
2068,
5637,
25,
1398,
71281,
417,
77,
2395,
14,
15,
13,
17,
13,
15,
198,
15314,
25,
26803,
17428,
198,
17637,
510,
220,
829,
25... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestMatExtractChannel(t *testing.T) {
src := NewMatWithSize(10, 10, MatTypeCV32F+MatChannels3)
dst := NewMat()
ExtractChannel(src, &dst, 1)
if dst.Empty() {
t.Error("TestExtractChannel dst should not be empty.")
}
src.Close()
dst.Close()
} | explode_data.jsonl/81740 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 103
} | [
2830,
3393,
11575,
28959,
9629,
1155,
353,
8840,
836,
8,
341,
41144,
1669,
1532,
11575,
2354,
1695,
7,
16,
15,
11,
220,
16,
15,
11,
6867,
929,
19589,
18,
17,
37,
10,
11575,
35925,
18,
340,
52051,
1669,
1532,
11575,
741,
197,
28959,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestMultipleDirectives(t *testing.T) {
src := `
.. d1:: p1
.. d2:: p2
.. [d3] p3
`
expected := `
Doc
Directive[d1]
Paragraph
Text[p1]
Directive[d2]
Paragraph
Text[p2]
Directive[[d3]]
Paragraph
Text[p3]
`
assertParse(t, expected, src)
} | explode_data.jsonl/21259 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 131
} | [
2830,
3393,
32089,
16027,
1886,
1155,
353,
8840,
836,
8,
341,
41144,
1669,
22074,
496,
294,
16,
486,
281,
16,
198,
496,
294,
17,
486,
281,
17,
198,
496,
508,
67,
18,
60,
281,
18,
198,
3989,
42400,
1669,
22074,
9550,
198,
10957,
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 TestEchoIPForwarded(t *testing.T) {
is := is.New(t)
req := httptest.NewRequest("GET", "/ip", nil)
req.Header.Set("X-Forwarded-For", "::1")
req.RemoteAddr = "127.0.0.1:56789"
res := httptest.NewRecorder()
svc.ServeHTTP(res, req)
is.Equal("::1\n", res.Body.String())
} | explode_data.jsonl/46788 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 129
} | [
2830,
3393,
74994,
3298,
25925,
291,
1155,
353,
8840,
836,
8,
341,
19907,
1669,
374,
7121,
1155,
340,
24395,
1669,
54320,
70334,
75274,
445,
3806,
497,
3521,
573,
497,
2092,
340,
24395,
15753,
4202,
445,
55,
12,
25925,
291,
12,
2461,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestService_Handshake(t *testing.T) {
type args struct {
ctx context.Context
}
tests := []struct {
name string
args args
wantErr bool
}{
{"background context", args{nil}, false},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
s := &Service{l: zaptest.NewLogger(t).Sugar()}
if tt.args.ctx == nil {
tt.args.ctx = context.Background()
}
_, err := s.Handshake(tt.args.ctx, &request.Empty{})
if (err != nil) != tt.wantErr {
t.Errorf("Service.Handshake() error = %v, wantErr %v", err, tt.wantErr)
return
}
})
}
} | explode_data.jsonl/22352 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 267
} | [
2830,
3393,
1860,
2039,
437,
29661,
1155,
353,
8840,
836,
8,
341,
13158,
2827,
2036,
341,
197,
20985,
2266,
9328,
198,
197,
532,
78216,
1669,
3056,
1235,
341,
197,
11609,
262,
914,
198,
197,
31215,
262,
2827,
198,
197,
50780,
7747,
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... | 3 |
func TestUintUint(t *testing.T) {
var expected uint = 123456789
ti := Uint{
ValidFlag: true,
uint: uint64(expected),
}
if ti.Uint() != expected {
t.Errorf("actual:%d, expected:%d", ti.Uint(), expected)
}
} | explode_data.jsonl/13395 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 98
} | [
2830,
3393,
21570,
21570,
1155,
353,
8840,
836,
8,
341,
2405,
3601,
2622,
284,
220,
16,
17,
18,
19,
20,
21,
22,
23,
24,
198,
72859,
1669,
27883,
515,
197,
197,
4088,
12135,
25,
830,
345,
197,
8254,
25,
414,
2622,
21,
19,
15253,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestUnmarshalAPReq(t *testing.T) {
t.Parallel()
var a APReq
b, err := hex.DecodeString(testdata.MarshaledKRB5ap_req)
if err != nil {
t.Fatalf("Test vector read error: %v", err)
}
err = a.Unmarshal(b)
if err != nil {
t.Fatalf("Unmarshal error: %v", err)
}
assert.Equal(t, iana.PVNO, a.PVNO, "PVNO not as expected")
assert.Equal(t, msgtype.KRB_AP_REQ, a.MsgType, "MsgType is not as expected")
assert.Equal(t, "fedcba98", hex.EncodeToString(a.APOptions.Bytes), "AP Options not as expected")
assert.Equal(t, iana.PVNO, a.Ticket.TktVNO, "Ticket VNO not as expected")
assert.Equal(t, testdata.TEST_REALM, a.Ticket.Realm, "Ticket realm not as expected")
assert.Equal(t, nametype.KRB_NT_PRINCIPAL, a.Ticket.SName.NameType, "Ticket SName NameType not as expected")
assert.Equal(t, len(testdata.TEST_PRINCIPALNAME_NAMESTRING), len(a.Ticket.SName.NameString), "Ticket SName does not have the expected number of NameStrings")
assert.Equal(t, testdata.TEST_PRINCIPALNAME_NAMESTRING, a.Ticket.SName.NameString, "Ticket SName name string entries not as expected")
assert.Equal(t, testdata.TEST_ETYPE, a.Ticket.EncPart.EType, "Ticket encPart etype not as expected")
assert.Equal(t, iana.PVNO, a.Ticket.EncPart.KVNO, "Ticket encPart KVNO not as expected")
assert.Equal(t, []byte(testdata.TEST_CIPHERTEXT), a.Ticket.EncPart.Cipher, "Ticket encPart cipher not as expected")
} | explode_data.jsonl/62185 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 573
} | [
2830,
3393,
1806,
27121,
2537,
27234,
1155,
353,
8840,
836,
8,
341,
3244,
41288,
7957,
741,
2405,
264,
10106,
27234,
198,
2233,
11,
1848,
1669,
12371,
56372,
703,
8623,
691,
83691,
75303,
42,
29259,
20,
391,
17644,
340,
743,
1848,
961,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
func TestHandshakeClientECDHERSAChaCha20(t *testing.T) {
config := testConfig.Clone()
config.CipherSuites = []uint16{TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305}
test := &clientTest{
name: "ECDHE-RSA-CHACHA20-POLY1305",
command: []string{"openssl", "s_server", "-cipher", "ECDHE-RSA-CHACHA20-POLY1305"},
config: config,
}
runClientTestTLS12(t, test)
} | explode_data.jsonl/71358 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 162
} | [
2830,
3393,
2314,
29661,
2959,
36,
6484,
3012,
7778,
95971,
95971,
17,
15,
1155,
353,
8840,
836,
8,
341,
25873,
1669,
1273,
2648,
64463,
741,
25873,
727,
10558,
62898,
288,
284,
3056,
2496,
16,
21,
90,
45439,
2089,
6484,
1799,
76994,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestRolesFilterList(t *testing.T) {
clients.RequireAdmin(t)
// For some reason this is not longer working.
clients.SkipRelease(t, "master")
clients.SkipRelease(t, "stable/mitaka")
clients.SkipRelease(t, "stable/newton")
clients.SkipRelease(t, "stable/ocata")
clients.SkipRelease(t, "stable/pike")
clients.SkipRelease(t, "stable/queens")
clients.SkipRelease(t, "stable/rocky")
clients.SkipRelease(t, "stable/stein")
clients.SkipRelease(t, "stable/train")
clients.SkipRelease(t, "stable/ussuri")
client, err := clients.NewIdentityV3Client()
th.AssertNoErr(t, err)
createOpts := roles.CreateOpts{
Name: "testrole",
DomainID: "default",
Extra: map[string]interface{}{
"description": "test role description",
},
}
// Create Role in the default domain
role, err := CreateRole(t, client, &createOpts)
th.AssertNoErr(t, err)
defer DeleteRole(t, client, role.ID)
var listOpts roles.ListOpts
listOpts.Filters = map[string]string{
"name__contains": "TEST",
}
allPages, err := roles.List(client, listOpts).AllPages()
th.AssertNoErr(t, err)
allRoles, err := roles.ExtractRoles(allPages)
th.AssertNoErr(t, err)
found := false
for _, r := range allRoles {
tools.PrintResource(t, r)
tools.PrintResource(t, r.Extra)
if r.Name == role.Name {
found = true
}
}
th.AssertEquals(t, found, true)
listOpts.Filters = map[string]string{
"name__contains": "reader",
}
allPages, err = roles.List(client, listOpts).AllPages()
th.AssertNoErr(t, err)
allRoles, err = roles.ExtractRoles(allPages)
th.AssertNoErr(t, err)
found = false
for _, r := range allRoles {
tools.PrintResource(t, r)
tools.PrintResource(t, r.Extra)
if r.Name == role.Name {
found = true
}
}
th.AssertEquals(t, found, false)
} | explode_data.jsonl/57724 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 716
} | [
2830,
3393,
25116,
5632,
852,
1155,
353,
8840,
836,
8,
341,
197,
31869,
81288,
7210,
1155,
692,
197,
322,
1752,
1045,
2874,
419,
374,
537,
5021,
3238,
624,
197,
31869,
57776,
16077,
1155,
11,
330,
13629,
1138,
197,
31869,
57776,
16077,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestDropMultipleBuildingDeferredIndexes(t *testing.T) {
log.Printf("In TestDropMultipleBuildingDeferredIndexes()")
var bucketName = "default"
var index1 = "id_company"
var index2 = "id_age"
var index3 = "id_gender"
var index4 = "id_isActive"
e := secondaryindex.DropAllSecondaryIndexes(indexManagementAddress)
FailTestIfError(e, "Error in DropAllSecondaryIndexes", t)
docsToCreate := generateDocs(30000, "users.prod")
UpdateKVDocs(docsToCreate, docs)
log.Printf("Setting JSON docs in KV")
kvutility.SetKeyValues(docsToCreate, "default", "", clusterconfig.KVAddress)
err := secondaryindex.CreateSecondaryIndex(index1, bucketName, indexManagementAddress, "", []string{"company"}, false, nil, true, defaultIndexActiveTimeout, nil)
FailTestIfError(err, "Error in creating the index", t)
time.Sleep(1 * time.Second)
err = secondaryindex.CreateSecondaryIndexAsync(index2, bucketName, indexManagementAddress, "", []string{"age"}, false, []byte("{\"defer_build\": true}"), true, nil)
FailTestIfError(err, "Error in creating the index", t)
err = secondaryindex.CreateSecondaryIndexAsync(index3, bucketName, indexManagementAddress, "", []string{"gender"}, false, []byte("{\"defer_build\": true}"), true, nil)
FailTestIfError(err, "Error in creating the index", t)
err = secondaryindex.CreateSecondaryIndexAsync(index4, bucketName, indexManagementAddress, "", []string{"isActive"}, false, []byte("{\"defer_build\": true}"), true, nil)
FailTestIfError(err, "Error in creating the index", t)
client, err := secondaryindex.GetOrCreateClient(indexManagementAddress, "test2client")
FailTestIfError(err, "Error while creating client", t)
defn2, _ := secondaryindex.GetDefnID(client, bucketName, index2)
defn3, _ := secondaryindex.GetDefnID(client, bucketName, index3)
defnIds := []uint64{defn2, defn3}
err = secondaryindex.BuildIndexesAsync(defnIds, indexManagementAddress, defaultIndexActiveTimeout)
FailTestIfError(err, "Error from BuildIndexesAsync", t)
time.Sleep(1 * time.Second)
err = secondaryindex.DropSecondaryIndex(index2, bucketName, indexManagementAddress)
FailTestIfError(err, "Error dropping index2", t)
err = secondaryindex.DropSecondaryIndex(index3, bucketName, indexManagementAddress)
FailTestIfError(err, "Error dropping index2", t)
err = secondaryindex.BuildIndexes([]string{index4}, bucketName, indexManagementAddress, defaultIndexActiveTimeout)
FailTestIfError(err, "Error in deferred index build index4", t)
time.Sleep(10 * time.Second)
docScanResults := datautility.ExpectedScanAllResponse(docs, "isActive")
scanResults, err := secondaryindex.ScanAll(index4, bucketName, indexScanAddress, defaultlimit, c.SessionConsistency, nil)
FailTestIfError(err, "Error in scan index4", t)
err = tv.Validate(docScanResults, scanResults)
FailTestIfError(err, "Error in scan result validation of index4", t)
log.Printf("Number of docScanResults and scanResults = %v and %v", len(docScanResults), len(scanResults))
docScanResults = datautility.ExpectedScanAllResponse(docs, "company")
scanResults, err = secondaryindex.ScanAll(index1, bucketName, indexScanAddress, defaultlimit, c.SessionConsistency, nil)
FailTestIfError(err, "Error in scan index1", t)
err = tv.Validate(docScanResults, scanResults)
FailTestIfError(err, "Error in scan result validation of index1", t)
log.Printf("Number of docScanResults and scanResults = %v and %v", len(docScanResults), len(scanResults))
} | explode_data.jsonl/59138 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 1070
} | [
2830,
3393,
19871,
32089,
30133,
88417,
62229,
1155,
353,
8840,
836,
8,
341,
6725,
19367,
445,
641,
3393,
19871,
32089,
30133,
88417,
62229,
368,
5130,
2405,
15621,
675,
284,
330,
2258,
698,
2405,
1922,
16,
284,
330,
307,
33403,
698,
24... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestMountWithRoot(t *testing.T) {
bMount := fsConnect(t)
defer fsDisconnect(t, bMount)
dir1 := "/test-mount-with-root"
err := bMount.MakeDir(dir1, 0755)
assert.NoError(t, err)
defer bMount.RemoveDir(dir1)
sub1 := "/i.was.here"
dir2 := dir1 + sub1
err = bMount.MakeDir(dir2, 0755)
assert.NoError(t, err)
defer bMount.RemoveDir(dir2)
t.Run("withRoot", func(t *testing.T) {
mount, err := CreateMount()
require.NoError(t, err)
require.NotNil(t, mount)
defer func() {
assert.NoError(t, mount.Release())
}()
err = mount.ReadDefaultConfigFile()
require.NoError(t, err)
err = mount.MountWithRoot(dir1)
assert.NoError(t, err)
defer func() {
assert.NoError(t, mount.Unmount())
}()
err = mount.ChangeDir(sub1)
assert.NoError(t, err)
})
t.Run("badRoot", func(t *testing.T) {
mount, err := CreateMount()
require.NoError(t, err)
require.NotNil(t, mount)
defer func() {
assert.NoError(t, mount.Release())
}()
err = mount.ReadDefaultConfigFile()
require.NoError(t, err)
err = mount.MountWithRoot("/i-yam-what-i-yam")
assert.Error(t, err)
})
} | explode_data.jsonl/29514 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 485
} | [
2830,
3393,
16284,
2354,
8439,
1155,
353,
8840,
836,
8,
341,
2233,
16284,
1669,
8619,
14611,
1155,
340,
16867,
8619,
60651,
1155,
11,
293,
16284,
692,
48532,
16,
1669,
3521,
1944,
59588,
26189,
39214,
698,
9859,
1669,
293,
16284,
50133,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestDelete(t *testing.T) {
ctx := context.Background()
fi := filter.GetConfig(ctx)
r := fstest.NewRun(t)
defer r.Finalise()
file1 := r.WriteObject(ctx, "small", "1234567890", t2) // 10 bytes
file2 := r.WriteObject(ctx, "medium", "------------------------------------------------------------", t1) // 60 bytes
file3 := r.WriteObject(ctx, "large", "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", t1) // 100 bytes
fstest.CheckItems(t, r.Fremote, file1, file2, file3)
fi.Opt.MaxSize = 60
defer func() {
fi.Opt.MaxSize = -1
}()
err := operations.Delete(ctx, r.Fremote)
require.NoError(t, err)
fstest.CheckItems(t, r.Fremote, file3)
} | explode_data.jsonl/51931 | {
"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,
6435,
1155,
353,
8840,
836,
8,
341,
20985,
1669,
2266,
19047,
741,
30839,
1669,
4051,
2234,
2648,
7502,
340,
7000,
1669,
48434,
477,
7121,
6727,
1155,
340,
16867,
435,
991,
977,
1064,
741,
17661,
16,
1669,
435,
4073,
1190,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestExtends2(t *testing.T) {
assert.NoError(t, PrepareEngine())
err := testEngine.DropTables(&Message{}, &MessageUser{}, &MessageType{})
assert.NoError(t, err)
err = testEngine.CreateTables(&Message{}, &MessageUser{}, &MessageType{})
assert.NoError(t, err)
var sender = MessageUser{Name: "sender"}
var receiver = MessageUser{Name: "receiver"}
var msgtype = MessageType{Name: "type"}
_, err = testEngine.Insert(&sender, &receiver, &msgtype)
assert.NoError(t, err)
msg := Message{
MessageBase: MessageBase{
Id: msgtype.Id,
},
Title: "test",
Content: "test",
Uid: sender.Id,
ToUid: receiver.Id,
}
session := testEngine.NewSession()
defer session.Close()
// MSSQL deny insert identity column excep declare as below
if testEngine.Dialect().URI().DBType == schemas.MSSQL {
err = session.Begin()
assert.NoError(t, err)
_, err = session.Exec("SET IDENTITY_INSERT message ON")
assert.NoError(t, err)
}
cnt, err := session.Insert(&msg)
assert.NoError(t, err)
assert.EqualValues(t, 1, cnt)
if testEngine.Dialect().URI().DBType == schemas.MSSQL {
err = session.Commit()
assert.NoError(t, err)
}
var mapper = testEngine.GetTableMapper().Obj2Table
var quote = testEngine.Quote
userTableName := quote(testEngine.TableName(mapper("MessageUser"), true))
typeTableName := quote(testEngine.TableName(mapper("MessageType"), true))
msgTableName := quote(testEngine.TableName(mapper("Message"), true))
list := make([]Message, 0)
err = session.Table(msgTableName).Join("LEFT", []string{userTableName, "sender"}, "`sender`.`"+mapper("Id")+"`="+msgTableName+".`"+mapper("Uid")+"`").
Join("LEFT", []string{userTableName, "receiver"}, "`receiver`.`"+mapper("Id")+"`="+msgTableName+".`"+mapper("ToUid")+"`").
Join("LEFT", []string{typeTableName, "type"}, "`type`.`"+mapper("Id")+"`="+msgTableName+".`"+mapper("Id")+"`").
Find(&list)
assert.NoError(t, err)
assert.EqualValues(t, 1, len(list), fmt.Sprintln("should have 1 message, got", len(list)))
assert.EqualValues(t, msg.Id, list[0].Id, fmt.Sprintln("should message equal", list[0], msg))
} | explode_data.jsonl/19195 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 805
} | [
2830,
3393,
6756,
1412,
17,
1155,
353,
8840,
836,
8,
341,
6948,
35699,
1155,
11,
31166,
4571,
12367,
9859,
1669,
1273,
4571,
21688,
21670,
2099,
2052,
22655,
609,
2052,
1474,
22655,
609,
82107,
37790,
6948,
35699,
1155,
11,
1848,
692,
9... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
func TestChats(t *testing.T) {
client := v1.New(nil)
chats, err := client.Chats(chat.New(time.Now().Add(-24 * time.Hour)))
assert.NoError(t, err)
fmt.Printf("%+v\n", strings.Join(chats.List(), "\n"))
} | explode_data.jsonl/41200 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 90
} | [
2830,
3393,
1143,
1862,
1155,
353,
8840,
836,
8,
341,
25291,
1669,
348,
16,
7121,
27907,
340,
23049,
1862,
11,
1848,
1669,
2943,
6353,
1862,
45438,
7121,
9730,
13244,
1005,
2212,
4080,
17,
19,
353,
882,
73550,
5929,
6948,
35699,
1155,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
func TestMakeApplication(t *testing.T) {
got := makeApplication("blue-app", "default", "testing-ns", "https://kubernetes.default.svc", argoappv1.ApplicationSource{RepoURL: "https://example.com/myorg/myproject.git", Path: "services/service-1/base"})
want := &argoappv1.Application{
TypeMeta: applicationTypeMeta,
ObjectMeta: metav1.ObjectMeta{
Name: "blue-app",
},
Spec: argoappv1.ApplicationSpec{
Project: "default",
Destination: argoappv1.ApplicationDestination{
Namespace: "testing-ns",
Server: "https://kubernetes.default.svc",
},
Source: argoappv1.ApplicationSource{
RepoURL: "https://example.com/myorg/myproject.git",
Path: "services/service-1/base",
},
SyncPolicy: syncPolicy,
},
}
if diff := cmp.Diff(want, got); diff != "" {
t.Fatalf("makeApplication() diff: %s\n", diff)
}
} | explode_data.jsonl/73884 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 338
} | [
2830,
3393,
8078,
4988,
1155,
353,
8840,
836,
8,
341,
3174,
354,
1669,
1281,
4988,
445,
12203,
20023,
497,
330,
2258,
497,
330,
8840,
12,
4412,
497,
330,
2428,
1110,
74,
29827,
8764,
514,
7362,
497,
1392,
78,
676,
85,
16,
17521,
360... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestLoadConfig(t *testing.T) {
factories, err := componenttest.NopFactories()
assert.Nil(t, err)
factory := NewFactory()
factories.Exporters[configmodels.Type(typeStr)] = factory
cfg, err := configtest.LoadConfigFile(
t, path.Join(".", "testdata", "config.yaml"), factories,
)
require.NoError(t, err)
require.NotNil(t, cfg)
assert.Equal(t, len(cfg.Exporters), 2)
r0 := cfg.Exporters["googlecloud"]
assert.Equal(t, r0, factory.CreateDefaultConfig())
r1 := cfg.Exporters["googlecloud/customname"].(*Config)
assert.Equal(t, r1,
&Config{
ExporterSettings: configmodels.ExporterSettings{TypeVal: configmodels.Type(typeStr), NameVal: "googlecloud/customname"},
ProjectID: "my-project",
UserAgent: "opentelemetry-collector-contrib {{version}}",
Endpoint: "test-endpoint",
UseInsecure: true,
TimeoutSettings: exporterhelper.TimeoutSettings{
Timeout: 20 * time.Second,
},
ResourceMappings: []ResourceMapping{
{
SourceType: "source.resource1",
TargetType: "target-resource1",
LabelMappings: []LabelMapping{
{
SourceKey: "contrib.opencensus.io/exporter/googlecloud/project_id",
TargetKey: "project_id",
Optional: true,
},
{
SourceKey: "source.label1",
TargetKey: "target_label_1",
Optional: false,
},
},
},
{
SourceType: "source.resource2",
TargetType: "target-resource2",
},
},
RetrySettings: exporterhelper.RetrySettings{
Enabled: true,
InitialInterval: 10 * time.Second,
MaxInterval: 1 * time.Minute,
MaxElapsedTime: 10 * time.Minute,
},
QueueSettings: exporterhelper.QueueSettings{
Enabled: true,
NumConsumers: 2,
QueueSize: 10,
},
MetricConfig: MetricConfig{
Prefix: "prefix",
SkipCreateMetricDescriptor: true,
},
})
} | explode_data.jsonl/8498 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 855
} | [
2830,
3393,
5879,
2648,
1155,
353,
8840,
836,
8,
341,
1166,
52893,
11,
1848,
1669,
3692,
1944,
2067,
453,
17417,
2433,
741,
6948,
59678,
1155,
11,
1848,
692,
1166,
2919,
1669,
1532,
4153,
741,
1166,
52893,
81077,
388,
58,
1676,
6507,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestWriteAndReadbackTombstones(t *testing.T) {
tmpdir, _ := ioutil.TempDir("", "test")
defer func() {
assert.NoError(t, os.RemoveAll(tmpdir))
}()
ref := uint64(0)
stones := NewMemTombstones()
// Generate the tombstones.
for i := 0; i < 100; i++ {
ref += uint64(rand.Int31n(10)) + 1
numRanges := rand.Intn(5) + 1
dranges := make(Intervals, 0, numRanges)
mint := rand.Int63n(time.Now().UnixNano())
for j := 0; j < numRanges; j++ {
dranges = dranges.Add(Interval{mint, mint + rand.Int63n(1000)})
mint += rand.Int63n(1000) + 1
}
stones.AddInterval(ref, dranges...)
}
_, err := WriteFile(log.NewNopLogger(), tmpdir, stones)
assert.NoError(t, err)
restr, _, err := ReadTombstones(tmpdir)
assert.NoError(t, err)
// Compare the two readers.
assert.Equal(t, stones, restr)
} | explode_data.jsonl/80239 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 343
} | [
2830,
3393,
7985,
3036,
4418,
1419,
51,
2855,
32510,
1155,
353,
8840,
836,
8,
341,
20082,
3741,
11,
716,
1669,
43144,
65009,
6184,
19814,
330,
1944,
1138,
16867,
2915,
368,
341,
197,
6948,
35699,
1155,
11,
2643,
84427,
10368,
3741,
1171... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestTopLevelDirective(t *testing.T) {
src := `
.. deprecated:: 0.1.1
paragraph
`
expected := `
Doc
Directive[deprecated]
Paragraph
Text[0.1.1 paragraph]
`
assertParse(t, expected, src)
} | explode_data.jsonl/21258 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 82
} | [
2830,
3393,
5366,
4449,
62076,
1155,
353,
8840,
836,
8,
341,
41144,
1669,
22074,
496,
31590,
486,
220,
15,
13,
16,
13,
16,
198,
220,
14311,
198,
3989,
42400,
1669,
22074,
9550,
198,
10957,
1226,
533,
58,
38189,
921,
197,
197,
42165,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestScanner_IsSupportedVersion(t *testing.T) {
type args struct {
osFamily string
osVer string
}
tests := []struct {
name string
now time.Time
args args
want bool
}{
{
name: "photon 1.0",
now: time.Date(2022, 1, 31, 23, 59, 59, 0, time.UTC),
args: args{
osFamily: "photon",
osVer: "1.0",
},
want: true,
},
{
name: "photon 1.0 EOL",
now: time.Date(2022, 3, 31, 23, 59, 59, 0, time.UTC),
args: args{
osFamily: "photon",
osVer: "1.0",
},
want: false,
},
{
name: "unknown",
now: time.Date(2022, 1, 31, 23, 59, 59, 0, time.UTC),
args: args{
osFamily: "photon",
osVer: "unknown",
},
want: false,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
s := photon.NewScanner(photon.WithClock(fake.NewFakeClock(tt.now)))
got := s.IsSupportedVersion(tt.args.osFamily, tt.args.osVer)
assert.Equal(t, tt.want, got)
})
}
} | explode_data.jsonl/15371 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 485
} | [
2830,
3393,
31002,
31879,
34636,
5637,
1155,
353,
8840,
836,
8,
341,
13158,
2827,
2036,
341,
197,
25078,
15192,
914,
198,
197,
25078,
10141,
262,
914,
198,
197,
532,
78216,
1669,
3056,
1235,
341,
197,
11609,
914,
198,
197,
80922,
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 TestNewRetrieveWithSubdir(t *testing.T) {
expected := map[string]string{"subdir/path/a.txt": "a"}
client := &fakeRetrievalService{
artifacts: expected,
}
dest := makeTempDir(t)
defer os.RemoveAll(dest)
ctx := grpcx.WriteWorkerID(context.Background(), "worker")
mds, err := newMaterializeWithClient(ctx, client, client.resolvedArtifactsWithStagingTo(), dest)
if err != nil {
t.Fatalf("materialize failed: %v", err)
}
checkStagedFiles(mds, dest, expected, t)
} | explode_data.jsonl/55339 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 175
} | [
2830,
3393,
3564,
87665,
2354,
3136,
3741,
1155,
353,
8840,
836,
8,
341,
42400,
1669,
2415,
14032,
30953,
4913,
1966,
3741,
50976,
14186,
3909,
788,
330,
64,
63159,
25291,
1669,
609,
30570,
12020,
7231,
831,
1860,
515,
197,
197,
471,
26... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
func TestNaughtyStrings(t *testing.T) {
err := os.Setenv("IGOR_CONFIG", "{\"token\": \"testtoken\", \"languagedir\": \"../language\"}")
if err != nil {
t.Error("Problem setting environment variable")
}
var list []string
filename, _ := filepath.Abs("../devtools/blns.json")
c, _ := ioutil.ReadFile(filename)
dec := json.NewDecoder(bytes.NewReader(c))
dec.Decode(&list)
config, err := config.GeneralConfig()
if err != nil {
t.Error("Problem getting config")
}
request := slack.Request{Text: "string"}
for _, plugin := range plugins.GetPlugins(request, config) {
t.Run("Plugin="+plugin.Name(), func(t *testing.T) {
for _, string := range list {
_, err := plugin.Work()
if err != nil {
switch err.(type) {
case *plugins.NoMatchError:
default:
t.Error(fmt.Sprintf("Failed naughty string: %s - %s > %s",
string,
plugin.Name(),
err.Error()))
}
}
}
})
}
} | explode_data.jsonl/78102 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 387
} | [
2830,
3393,
16193,
35516,
20859,
1155,
353,
8840,
836,
8,
341,
9859,
1669,
2643,
4202,
3160,
445,
1914,
868,
12568,
497,
54734,
5839,
11693,
7245,
1944,
5839,
16215,
7245,
75,
2325,
3279,
404,
11693,
7245,
1244,
11528,
2105,
14451,
743,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 4 |
func TestParseRSSDate(t *testing.T) {
date, err := Parse("Tue, 03 Jun 2003 09:39:21 GMT")
if err != nil {
t.Fatalf(`RSS dates should be parsed correctly`)
}
if date.Unix() != 1054633161 {
t.Fatal(`Invalid date parsed`)
}
} | explode_data.jsonl/21382 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 96
} | [
2830,
3393,
14463,
68980,
1916,
1155,
353,
8840,
836,
8,
341,
44086,
11,
1848,
1669,
14775,
445,
61048,
11,
220,
15,
18,
11782,
220,
17,
15,
15,
18,
220,
15,
24,
25,
18,
24,
25,
17,
16,
24488,
1138,
743,
1848,
961,
2092,
341,
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 TestPipeline_Secret_ParseShared_failure(t *testing.T) {
// setup tests
tests := []struct {
secret *Secret
org string
}{
{ // failure with bad key
secret: &Secret{
Name: "foo",
Value: "bar",
Key: "octocat",
Engine: "native",
Type: "repo",
},
org: "octocat",
},
{ // failure with bad engine
secret: &Secret{
Name: "foo",
Value: "bar",
Key: "octocat",
Engine: "invalid",
Type: "org",
},
org: "octocat",
},
}
// run tests
for _, test := range tests {
_, _, _, err := test.secret.ParseShared()
if err == nil {
t.Errorf("ParseShared should have failed")
}
}
} | explode_data.jsonl/51854 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 322
} | [
2830,
3393,
34656,
1098,
50856,
77337,
16997,
43618,
1155,
353,
8840,
836,
8,
341,
197,
322,
6505,
7032,
198,
78216,
1669,
3056,
1235,
341,
197,
197,
20474,
353,
19773,
198,
197,
87625,
262,
914,
198,
197,
59403,
197,
197,
90,
442,
79... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.