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 TestAssigningSubscriberReassignmentHandlerReturnsError(t *testing.T) {
const subscription = "projects/123456/locations/us-central1-b/subscriptions/my-sub"
receiver := newTestMessageReceiver(t)
verifiers := test.NewVerifiers(t)
// Assignment stream
asnStream := test.NewRPCVerifier(t)
asnStream.Push(initAssignmentReq(subscription, fakeUUID[:]), assignmentResp([]int64{1}), nil)
verifiers.AddAssignmentStream(subscription, asnStream)
// Partition 1
subStream := test.NewRPCVerifier(t)
subStream.Push(initSubReqCommit(subscriptionPartition{Path: subscription, Partition: 1}), initSubResp(), nil)
subBarrier := subStream.PushWithBarrier(initFlowControlReq(), nil, nil)
verifiers.AddSubscribeStream(subscription, 1, subStream)
cmtStream := test.NewRPCVerifier(t)
cmtBarrier := cmtStream.PushWithBarrier(initCommitReq(subscriptionPartition{Path: subscription, Partition: 1}), initCommitResp(), nil)
verifiers.AddCommitStream(subscription, 1, cmtStream)
mockServer.OnTestStart(verifiers)
defer mockServer.OnTestEnd()
reassignmentErr := errors.New("reassignment handler error")
returnReassignmentErr := test.NewCondition("return reassignment error")
onAssignment := func(before, after PartitionSet) error {
if got, want := len(before.SortedInts()), 0; got != want {
t.Errorf("len(before): got %v, want %v", got, want)
}
if got, want := after.SortedInts(), []int{1}; !testutil.Equal(got, want) {
t.Errorf("after: got %v, want %v", got, want)
}
returnReassignmentErr.WaitUntilDone(t, serviceTestWaitTimeout)
return reassignmentErr
}
sub := newTestAssigningSubscriber(t, receiver.onMessage, onAssignment, subscription)
if gotErr := sub.WaitStarted(); gotErr != nil {
t.Errorf("Start() got err: (%v)", gotErr)
}
// Used to control order of execution to ensure the test is deterministic.
subBarrier.Release()
cmtBarrier.Release()
returnReassignmentErr.SetDone()
if gotErr := sub.WaitStopped(); !test.ErrorEqual(gotErr, reassignmentErr) {
t.Errorf("WaitStopped() got err: (%v), want err: (%v)", gotErr, reassignmentErr)
}
} | explode_data.jsonl/31659 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 728
} | [
2830,
3393,
28933,
287,
40236,
693,
29951,
3050,
16446,
1454,
1155,
353,
8840,
836,
8,
341,
4777,
15142,
284,
330,
17161,
14,
16,
17,
18,
19,
20,
21,
14,
31309,
62431,
84081,
16,
1455,
37885,
29966,
34198,
17967,
698,
17200,
12862,
16... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
func TestHistogramDataPoint_Timestamp(t *testing.T) {
ms := NewHistogramDataPoint()
ms.InitEmpty()
assert.EqualValues(t, TimestampUnixNano(0), ms.Timestamp())
testValTimestamp := TimestampUnixNano(1234567890)
ms.SetTimestamp(testValTimestamp)
assert.EqualValues(t, testValTimestamp, ms.Timestamp())
} | explode_data.jsonl/19551 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 110
} | [
2830,
3393,
77210,
1043,
2609,
1139,
4702,
1155,
353,
8840,
836,
8,
341,
47691,
1669,
1532,
77210,
1043,
2609,
741,
47691,
26849,
3522,
741,
6948,
12808,
6227,
1155,
11,
32758,
55832,
83819,
7,
15,
701,
9829,
49024,
2398,
18185,
2208,
2... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestFormatRetryAfter(t *testing.T) {
t.Parallel()
httputil.Now = func() time.Time {
return time.Date(2015, 10, 21, 7, 28, 15, 0, time.UTC)
}
table := []struct {
input time.Duration
expect string
}{
{input: time.Minute, expect: "60"},
{input: time.Hour, expect: "3600"},
{input: 0, expect: "0"},
{input: -60, expect: "0"},
}
for i, test := range table {
h := http.Header{}
httputil.FormatRetryAfter(h, test.input)
got := h.Get("Retry-After")
if test.expect != got {
t.Errorf("#%d - expect `Retry-After` to be %s, but got %s", i, test.expect, got)
}
}
} | explode_data.jsonl/25791 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 261
} | [
2830,
3393,
4061,
51560,
6025,
1155,
353,
8840,
836,
8,
341,
3244,
41288,
7957,
2822,
197,
96336,
628,
321,
13244,
284,
2915,
368,
882,
16299,
341,
197,
853,
882,
8518,
7,
17,
15,
16,
20,
11,
220,
16,
15,
11,
220,
17,
16,
11,
22... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestTLS12OnlyCipherSuites(t *testing.T) {
// Test that a Server doesn't select a TLS 1.2-only cipher suite when
// the client negotiates TLS 1.1.
var zeros [32]byte
clientHello := &clientHelloMsg{
vers: VersionTLS11,
random: zeros[:],
cipherSuites: []uint16{
// The Server, by default, will use the client's
// preference order. So the GCM cipher suite
// will be selected unless it's excluded because
// of the version in this ClientHello.
TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,
TLS_RSA_WITH_RC4_128_SHA,
},
compressionMethods: []uint8{compressionNone},
supportedCurves: []CurveID{CurveP256, CurveP384, CurveP521},
supportedPoints: []uint8{pointFormatUncompressed},
}
c, s := net.Pipe()
var reply interface{}
var clientErr error
go func() {
cli := Client(c, testConfig)
cli.vers = clientHello.vers
cli.writeRecord(recordTypeHandshake, clientHello.marshal())
reply, clientErr = cli.readHandshake()
c.Close()
}()
config := *testConfig
config.CipherSuites = clientHello.cipherSuites
Server(s, &config).Handshake()
s.Close()
if clientErr != nil {
t.Fatal(clientErr)
}
serverHello, ok := reply.(*serverHelloMsg)
if !ok {
t.Fatalf("didn't get ServerHello message in reply. Got %v\n", reply)
}
if s := serverHello.cipherSuite; s != TLS_RSA_WITH_RC4_128_SHA {
t.Fatalf("bad cipher suite from server: %x", s)
}
} | explode_data.jsonl/80548 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 544
} | [
2830,
3393,
45439,
16,
17,
7308,
79460,
62898,
288,
1155,
353,
8840,
836,
8,
341,
197,
322,
3393,
429,
264,
8422,
3171,
944,
3293,
264,
41654,
220,
16,
13,
17,
15382,
31088,
16182,
979,
198,
197,
322,
279,
2943,
11642,
42298,
41654,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestLog_pipelinerun_only_one_v1beta1(t *testing.T) {
var (
pipelineName = "pipeline1"
prName = "pr1"
ns = "namespaces"
taskName = "task1"
)
namespaces := []*corev1.Namespace{
{
ObjectMeta: metav1.ObjectMeta{
Name: ns,
},
},
}
pipelines := []*v1beta1.Pipeline{
{
ObjectMeta: metav1.ObjectMeta{
Name: pipelineName,
Namespace: ns,
},
Spec: v1beta1.PipelineSpec{
Tasks: []v1beta1.PipelineTask{
{
Name: taskName,
TaskRef: &v1beta1.TaskRef{
Name: taskName,
},
},
},
},
},
}
pipelineruns := []*v1beta1.PipelineRun{
{
ObjectMeta: metav1.ObjectMeta{
Name: prName,
Namespace: ns,
Labels: map[string]string{"tekton.dev/pipeline": pipelineName},
},
Spec: v1beta1.PipelineRunSpec{
PipelineRef: &v1beta1.PipelineRef{
Name: pipelineName,
},
},
Status: v1beta1.PipelineRunStatus{
Status: duckv1beta1.Status{
Conditions: duckv1beta1.Conditions{
{
Type: apis.ConditionSucceeded,
Status: corev1.ConditionUnknown,
Message: "Running",
},
},
},
},
},
}
cs, _ := test.SeedV1beta1TestData(t, pipelinev1beta1test.Data{PipelineRuns: pipelineruns, Pipelines: pipelines, Namespaces: namespaces})
cs.Pipeline.Resources = cb.APIResourceList(versionB1, []string{"pipelinerun"})
tdc := testDynamic.Options{}
dc, err := tdc.Client(
cb.UnstructuredV1beta1PR(pipelineruns[0], versionB1),
)
if err != nil {
t.Errorf("unable to create dynamic client: %v", err)
}
p := test.Params{
Kube: cs.Kube,
Tekton: cs.Pipeline,
Dynamic: dc,
}
p.SetNamespace(ns)
lopt := options.LogOptions{
Params: &p,
// This code https://git.io/JvCMV seems buggy so have to set the upper
// Limit.. but I guess that's another fight for another day.
Limit: len(pipelineruns),
}
err = askRunName(&lopt)
if err != nil {
t.Errorf("Unexpected error: %v", err)
}
test.AssertOutput(t, prName, lopt.PipelineRunName)
} | explode_data.jsonl/14876 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 988
} | [
2830,
3393,
2201,
620,
81079,
10453,
359,
18410,
11667,
2273,
16,
19127,
16,
1155,
353,
8840,
836,
8,
341,
2405,
2399,
197,
3223,
8790,
675,
284,
330,
51258,
16,
698,
197,
25653,
675,
981,
284,
330,
649,
16,
698,
197,
84041,
1843,
2... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
func TestPaintClippedTexture(t *testing.T) {
run(t, func(o *op.Ops) {
squares.Add(o)
clip.RRect{Rect: f32.Rect(0, 0, 40, 40)}.Add(o)
scale(80.0/512, 80.0/512).Add(o)
paint.PaintOp{}.Add(o)
}, func(r result) {
r.expect(40, 40, colornames.White)
r.expect(25, 35, colornames.Blue)
})
} | explode_data.jsonl/18107 | {
"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,
18098,
5066,
6450,
8783,
1155,
353,
8840,
836,
8,
341,
56742,
1155,
11,
2915,
10108,
353,
453,
8382,
1690,
8,
341,
197,
1903,
40856,
1904,
10108,
340,
197,
197,
7974,
2013,
4415,
90,
4415,
25,
282,
18,
17,
32153,
7,
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 TestEnvelope_Parse(t *testing.T) {
for i, test := range envelopeTests {
e := &Envelope{}
if err := e.Parse(test.fields); err != nil {
t.Error("Error parsing envelope:", err)
} else if !reflect.DeepEqual(e, test.envelope) {
t.Errorf("Invalid envelope for #%v: got %v but expected %v", i, e, test.envelope)
}
}
} | explode_data.jsonl/43046 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 138
} | [
2830,
3393,
62712,
77337,
1155,
353,
8840,
836,
8,
341,
2023,
600,
11,
1273,
1669,
2088,
34398,
18200,
341,
197,
7727,
1669,
609,
62712,
16094,
197,
743,
1848,
1669,
384,
8937,
8623,
12920,
1215,
1848,
961,
2092,
341,
298,
3244,
6141,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestEnumsResolver(t *testing.T) {
resolvers := &Stub{}
resolvers.QueryResolver.EnumInInput = func(ctx context.Context, input *InputWithEnumValue) (EnumTest, error) {
return input.Enum, nil
}
c := client.New(handler.NewDefaultServer(NewExecutableSchema(Config{Resolvers: resolvers})))
t.Run("input with valid enum value", func(t *testing.T) {
var resp struct {
EnumInInput EnumTest
}
c.MustPost(`query {
enumInInput(input: {enum: OK})
}
`, &resp)
require.Equal(t, resp.EnumInInput, EnumTestOk)
})
t.Run("input with invalid enum value", func(t *testing.T) {
var resp struct {
EnumInInput EnumTest
}
err := c.Post(`query {
enumInInput(input: {enum: INVALID})
}
`, &resp)
require.EqualError(t, err, `http 422: {"errors":[{"message":"Expected type EnumTest!, found INVALID.","locations":[{"line":2,"column":30}],"extensions":{"code":"GRAPHQL_VALIDATION_FAILED"}}],"data":null}`)
})
t.Run("input with invalid enum value via vars", func(t *testing.T) {
var resp struct {
EnumInInput EnumTest
}
err := c.Post(`query ($input: InputWithEnumValue) {
enumInInput(input: $input)
}
`, &resp, client.Var("input", map[string]interface{}{"enum": "INVALID"}))
require.EqualError(t, err, `http 422: {"errors":[{"message":"INVALID is not a valid EnumTest","path":["variable","input","enum"],"extensions":{"code":"GRAPHQL_VALIDATION_FAILED"}}],"data":null}`)
})
} | explode_data.jsonl/36158 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 553
} | [
2830,
3393,
71586,
18190,
1155,
353,
8840,
836,
8,
341,
10202,
39435,
1669,
609,
33838,
16094,
10202,
39435,
15685,
18190,
43225,
641,
2505,
284,
2915,
7502,
2266,
9328,
11,
1946,
353,
2505,
2354,
10766,
1130,
8,
320,
10766,
2271,
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... | 1 |
func TestRemoveElement(t *testing.T) {
s := NewSet()
e := "dummy"
s.Add(e)
if s.Size() <= 0 {
t.Fail()
}
s.Remove(e)
if s.Size() > 0 {
t.Fail()
}
} | explode_data.jsonl/16576 | {
"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,
13021,
1691,
1155,
353,
8840,
836,
8,
341,
1903,
1669,
1532,
1649,
741,
7727,
1669,
330,
31390,
1837,
1903,
1904,
2026,
340,
743,
274,
2465,
368,
2651,
220,
15,
341,
197,
3244,
57243,
741,
197,
630,
1903,
13270,
2026,
340,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 3 |
func TestExpNN(t *testing.T) {
for i, test := range expNNTests {
x, _, _ := nat(nil).scan(strings.NewReader(test.x), 0)
y, _, _ := nat(nil).scan(strings.NewReader(test.y), 0)
out, _, _ := nat(nil).scan(strings.NewReader(test.out), 0)
var m nat
if len(test.m) > 0 {
m, _, _ = nat(nil).scan(strings.NewReader(test.m), 0)
}
z := nat(nil).expNN(x, y, m)
if z.cmp(out) != 0 {
t.Errorf("#%d got %v want %v", i, z, out)
}
}
} | explode_data.jsonl/2195 | {
"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,
8033,
9745,
1155,
353,
8840,
836,
8,
341,
2023,
600,
11,
1273,
1669,
2088,
1343,
9745,
18200,
341,
197,
10225,
11,
8358,
716,
1669,
17588,
27907,
568,
16405,
51442,
68587,
8623,
1993,
701,
220,
15,
340,
197,
14522,
11,
835... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_hcsTask_DeleteExec_2ndExecID_RunningState_Error(t *testing.T) {
lt, init, second := setupTestHcsTask(t)
// start the init exec (required to have 2nd exec)
_ = init.Start(context.TODO())
// put the 2nd exec into the running state
_ = second.Start(context.TODO())
// try to delete the 2nd exec
pid, status, at, err := lt.DeleteExec(context.TODO(), second.id)
verifyExpectedError(t, nil, err, errdefs.ErrFailedPrecondition)
verifyDeleteFailureValues(t, pid, status, at)
} | explode_data.jsonl/56385 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 177
} | [
2830,
3393,
1523,
4837,
6262,
57418,
10216,
62,
17,
303,
10216,
915,
2568,
11216,
1397,
28651,
1155,
353,
8840,
836,
8,
341,
197,
4832,
11,
2930,
11,
2086,
1669,
6505,
2271,
39,
4837,
6262,
1155,
692,
197,
322,
1191,
279,
2930,
3883,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestEncodeM49(t *testing.T) {
tests := []struct {
m49 int
code string
ok bool
}{
{1, "001", true},
{840, "US", true},
{899, "ZZ", false},
}
for i, tt := range tests {
if r, err := EncodeM49(tt.m49); r.String() != tt.code || err == nil != tt.ok {
t.Errorf("%d:%d: was %s, %v; want %s, %v", i, tt.m49, r, err == nil, tt.code, tt.ok)
}
}
for i := 1; i <= 1000; i++ {
if r, err := EncodeM49(i); err == nil && r.M49() == 0 {
t.Errorf("%d has no error, but maps to undefined region", i)
}
}
} | explode_data.jsonl/15837 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 260
} | [
2830,
3393,
32535,
44,
19,
24,
1155,
353,
8840,
836,
8,
341,
78216,
1669,
3056,
1235,
341,
197,
2109,
19,
24,
220,
526,
198,
197,
43343,
914,
198,
197,
59268,
256,
1807,
198,
197,
59403,
197,
197,
90,
16,
11,
330,
15,
15,
16,
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... | 7 |
func TestNotify_Once(t *testing.T) {
callSize := 0
Once(syscall.SIGUSR1, func() { callSize++ })
syscall.Kill(pid, syscall.SIGUSR1)
time.Sleep(time.Millisecond)
syscall.Kill(pid, syscall.SIGUSR1)
time.Sleep(time.Millisecond)
if callSize != 1 {
t.Fail()
}
} | explode_data.jsonl/69854 | {
"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,
28962,
62,
12522,
1155,
353,
8840,
836,
8,
341,
67288,
1695,
1669,
220,
15,
198,
197,
12522,
18140,
6659,
85086,
49558,
16,
11,
2915,
368,
314,
1618,
1695,
1027,
2751,
41709,
6659,
11352,
483,
37844,
11,
49345,
85086,
49558,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestValidateStringPair(t *testing.T) {
t.Parallel()
Convey(`TestValidateStringPairs`, t, func() {
Convey(`empty`, func() {
err := ValidateStringPair(StringPair("", ""))
So(err, ShouldErrLike, `key: unspecified`)
})
Convey(`invalid key`, func() {
err := ValidateStringPair(StringPair("1", ""))
So(err, ShouldErrLike, `key: does not match`)
})
Convey(`long key`, func() {
err := ValidateStringPair(StringPair(strings.Repeat("a", 1000), ""))
So(err, ShouldErrLike, `key length must be less or equal to 64`)
})
Convey(`long value`, func() {
err := ValidateStringPair(StringPair("a", strings.Repeat("a", 1000)))
So(err, ShouldErrLike, `value length must be less or equal to 256`)
})
Convey(`valid`, func() {
err := ValidateStringPair(StringPair("a", "b"))
So(err, ShouldBeNil)
})
})
} | explode_data.jsonl/32599 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 344
} | [
2830,
3393,
17926,
703,
12443,
1155,
353,
8840,
836,
8,
341,
3244,
41288,
7957,
741,
93070,
5617,
5809,
2271,
17926,
703,
54228,
7808,
259,
11,
2915,
368,
341,
197,
93070,
5617,
5809,
3194,
7808,
2915,
368,
341,
298,
9859,
1669,
23282,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_Gauge(t *testing.T) {
resource := pdata.NewResource()
metric := pdata.NewMetric()
metric.SetName("gauge-metric")
metric.SetDataType(pdata.MetricDataTypeGauge)
dp := metric.Gauge().DataPoints().AppendEmpty()
dp.SetIntVal(1)
dp.SetTimestamp(createTimestamp())
lib := createInstrumentationLibrary()
documents, _ := Gauge(&resource, &lib, &metric)
assert.Equal(t, `{"@timestamp":"2022-01-01T10:00:05.000000123Z","instrumentationLibrary":{"name":"instlib","version":"v1"},"name":"gauge-metric","type":"gauge","value":1}`, string(documents[0]))
} | explode_data.jsonl/43639 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 216
} | [
2830,
3393,
2646,
19392,
1155,
353,
8840,
836,
8,
341,
50346,
1669,
70311,
7121,
4783,
741,
2109,
16340,
1669,
70311,
7121,
54310,
741,
2109,
16340,
4202,
675,
445,
70,
19392,
1448,
16340,
1138,
2109,
16340,
4202,
22653,
1295,
691,
1321,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestLoopBackManager_GetBackFileToLoopMap(t *testing.T) {
var mockexec = &mocks.GoMockExecutor{}
var manager = NewLoopBackManager(mockexec, "", "", logger)
testData := `NAME BACK-FILE
/dev/loop1 /root/test2.img
/dev/loop33 /root/test2.img
/dev/loop95 /root/test96.img
/dev/loop101 /foobar.img (deleted)
/dev/loop102 /foo bar.img
`
mockexec.On("RunCmd", readLoopBackDevicesMappingCmd).
Return(testData, "", nil)
mapping, err := manager.GetBackFileToLoopMap()
assert.Equal(t, []string{"/dev/loop95"}, mapping["/root/test96.img"])
assert.Equal(t, []string{"/dev/loop1", "/dev/loop33"}, mapping["/root/test2.img"])
assert.Equal(t, []string{"/dev/loop102"}, mapping["/foo bar.img"])
assert.Equal(t, []string{"/dev/loop101"}, mapping["/foobar.img (deleted)"])
assert.Nil(t, err)
} | explode_data.jsonl/73559 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 325
} | [
2830,
3393,
14620,
3707,
2043,
13614,
3707,
1703,
1249,
14620,
2227,
1155,
353,
8840,
836,
8,
341,
2405,
7860,
11748,
284,
609,
16712,
82,
67131,
11571,
25255,
16094,
2405,
6645,
284,
1532,
14620,
3707,
2043,
30389,
11748,
11,
7342,
7342,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestSBSConflicts(t *testing.T) {
test(t,
users("alice", "bob", "charlie"),
inPrivateTlf("alice,bob,charlie@twitter"),
as(alice,
mkfile("alice1.txt", "hello bob & charlie"),
),
as(bob,
read("alice1.txt", "hello bob & charlie"),
),
as(charlie,
expectError(initRoot(), "charlie does not have read access to directory /keybase/private/alice,bob,charlie@twitter"),
),
inPrivateTlf("alice,bob@twitter,charlie@twitter"),
as(alice,
mkfile("alice2.txt", "hello bob & charlie"),
),
as(bob,
expectError(initRoot(), "bob does not have read access to directory /keybase/private/alice,bob@twitter,charlie@twitter"),
),
as(charlie,
expectError(initRoot(), "charlie does not have read access to directory /keybase/private/alice,bob@twitter,charlie@twitter"),
),
inPrivateTlf("alice,bob,charlie"),
as(alice,
mkfile("alice3.txt", "hello bob & charlie"),
),
as(bob,
read("alice3.txt", "hello bob & charlie"),
),
as(charlie,
read("alice3.txt", "hello bob & charlie"),
),
addNewAssertion("bob", "bob@twitter"),
addNewAssertion("charlie", "charlie@twitter"),
as(alice,
// TODO: Ideally, we wouldn't have to do this,
// and we'd just wait for a rekey.
rekey(),
),
// TODO: Test that alice's favorites are updated.
// TODO: Test that the three folders are resolved with
// conflict markers. This will require changes to
// MDServerLocal.
)
} | explode_data.jsonl/41333 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 595
} | [
2830,
3393,
50,
7347,
15578,
56445,
1155,
353,
8840,
836,
8,
341,
18185,
1155,
345,
197,
90896,
445,
63195,
497,
330,
47086,
497,
330,
1762,
11567,
4461,
197,
17430,
16787,
51,
11008,
445,
63195,
8402,
674,
42381,
11567,
31,
14679,
4461... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestGAMinimizeBadGenome(t *testing.T) {
var ga, err = NewDefaultGAConfig().NewGA()
if err = ga.Minimize(NewErrorGenome); err == nil {
t.Error("Expected error")
}
} | explode_data.jsonl/82076 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 69
} | [
2830,
3393,
38,
1402,
258,
11853,
17082,
9967,
635,
1155,
353,
8840,
836,
8,
341,
2405,
13510,
11,
1848,
284,
1532,
3675,
16128,
2648,
1005,
3564,
16128,
741,
743,
1848,
284,
13510,
17070,
11853,
35063,
1454,
9967,
635,
1215,
1848,
621,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 2 |
func TestContainsExpressionNot(t *testing.T) {
ctx := test.NewTestContext(t)
c1 := ctx.NewCollection()
c1.MustAdd(hipathsys.NewInteger(10))
c1.MustAdd(hipathsys.NewInteger(11))
e := NewContainsExpression(newTestExpression(c1), NewNumberLiteralInt(12), false)
res, err := e.Evaluate(ctx, nil, nil)
assert.NoError(t, err, "no error expected")
if assert.Implements(t, (*hipathsys.BooleanAccessor)(nil), res) {
assert.Equal(t, false, res.(hipathsys.BooleanAccessor).Bool())
}
} | explode_data.jsonl/54554 | {
"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,
23805,
9595,
2623,
1155,
353,
8840,
836,
8,
341,
20985,
1669,
1273,
7121,
2271,
1972,
1155,
340,
1444,
16,
1669,
5635,
7121,
6482,
741,
1444,
16,
50463,
2212,
7,
2151,
587,
7791,
7121,
3486,
7,
16,
15,
1171,
1444,
16,
50... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestKillContainerWithError(t *testing.T) {
fakeDocker := &FakeDockerClient{
err: fmt.Errorf("sample error"),
containerList: []docker.APIContainers{
{
ID: "1234",
Names: []string{"/k8s--foo--qux--1234"},
},
{
ID: "5678",
Names: []string{"/k8s--bar--qux--5678"},
},
},
}
kubelet, _, _ := makeTestKubelet(t)
kubelet.dockerClient = fakeDocker
err := kubelet.killContainer(&fakeDocker.containerList[0])
if err == nil {
t.Errorf("expected error, found nil")
}
verifyCalls(t, fakeDocker, []string{"stop"})
} | explode_data.jsonl/2825 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 249
} | [
2830,
3393,
53734,
4502,
66102,
1155,
353,
8840,
836,
8,
341,
1166,
726,
35,
13659,
1669,
609,
52317,
35,
13659,
2959,
515,
197,
9859,
25,
8879,
13080,
445,
13611,
1465,
4461,
197,
53290,
852,
25,
3056,
28648,
24922,
74632,
515,
298,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
func TestQueryDenomToERC20(t *testing.T) {
var (
erc20 = "0xb462864E395d88d6bc7C5dd5F3F5eb4cc2599255"
denom = "uatom"
)
response := types.QueryDenomToERC20Response{
Erc20: erc20,
CosmosOriginated: true,
}
input := CreateTestEnv(t)
ctx := input.Context
input.GravityKeeper.setCosmosOriginatedDenomToERC20(ctx, denom, erc20)
queriedERC20, err := queryDenomToERC20(ctx, denom, input.GravityKeeper)
require.NoError(t, err)
correctBytes, err := codec.MarshalJSONIndent(types.ModuleCdc, response)
require.NoError(t, err)
assert.Equal(t, correctBytes, queriedERC20)
} | explode_data.jsonl/8805 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 256
} | [
2830,
3393,
2859,
23619,
316,
1249,
27434,
17,
15,
1155,
353,
8840,
836,
8,
341,
2405,
2399,
197,
197,
2962,
17,
15,
284,
330,
15,
7929,
19,
21,
17,
23,
21,
19,
36,
18,
24,
20,
67,
23,
23,
67,
21,
8904,
22,
34,
20,
631,
20,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func Test_Hoverfly_SetModeWithArguments_AsteriskCanOnlyBeValidAsTheOnlyHeader(t *testing.T) {
RegisterTestingT(t)
unit := NewHoverflyWithConfiguration(&Configuration{})
Expect(unit.SetModeWithArguments(
v2.ModeView{
Mode: "capture",
})).To(BeNil())
Expect(unit.Cfg.Mode).To(Equal("capture"))
Expect(unit.SetModeWithArguments(v2.ModeView{
Arguments: v2.ModeArgumentsView{
Headers: []string{"Content-Type", "*"},
},
})).ToNot(Succeed())
Expect(unit.SetModeWithArguments(v2.ModeView{
Arguments: v2.ModeArgumentsView{
Headers: []string{"*"},
},
})).ToNot(Succeed())
} | explode_data.jsonl/45402 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 244
} | [
2830,
3393,
2039,
1975,
21642,
14812,
3636,
2354,
19139,
1566,
3667,
3187,
6713,
7308,
3430,
4088,
2121,
785,
7308,
4047,
1155,
353,
8840,
836,
8,
341,
79096,
16451,
51,
1155,
692,
81189,
1669,
1532,
34379,
21642,
2354,
7688,
2099,
7688,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestStackVal_UnmarshalJSON_GotFalse(t *testing.T) {
var sampleOut struct {
Val BoolString `json:"val"`
}
var sampleIn = []byte(`{"val":false}`)
json.Unmarshal(sampleIn, &sampleOut)
if sampleOut.Val.Flag {
t.Errorf("should be false but got true")
}
if sampleOut.Val.Value != "" {
t.Error("string value should be empty")
}
} | explode_data.jsonl/31035 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 135
} | [
2830,
3393,
4336,
2208,
40687,
27121,
5370,
2646,
354,
4049,
1155,
353,
8840,
836,
8,
341,
2405,
6077,
2662,
2036,
341,
197,
197,
2208,
12608,
703,
1565,
2236,
2974,
831,
8805,
197,
532,
2405,
6077,
641,
284,
3056,
3782,
5809,
4913,
8... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
func TestEntry_DoubleTapped(t *testing.T) {
entry := widget.NewEntry()
entry.SetText("The quick brown fox\njumped over the lazy dog\n")
// select the word 'quick'
ev := getClickPosition("The qui", 0)
entry.Tapped(ev)
entry.DoubleTapped(ev)
assert.Equal(t, "quick", entry.SelectedText())
// select the whitespace after 'quick'
ev = getClickPosition("The quick", 0)
// add half a ' ' character
ev.Position.X += fyne.MeasureText(" ", theme.TextSize(), fyne.TextStyle{}).Width / 2
entry.Tapped(ev)
entry.DoubleTapped(ev)
assert.Equal(t, " ", entry.SelectedText())
// select all whitespace after 'jumped'
ev = getClickPosition("jumped ", 1)
entry.Tapped(ev)
entry.DoubleTapped(ev)
assert.Equal(t, " ", entry.SelectedText())
} | explode_data.jsonl/57280 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 275
} | [
2830,
3393,
5874,
84390,
51,
5677,
1155,
353,
8840,
836,
8,
341,
48344,
1669,
9086,
7121,
5874,
741,
48344,
92259,
445,
785,
3974,
13876,
38835,
1699,
43296,
291,
262,
916,
279,
15678,
5562,
1699,
5130,
197,
322,
3293,
279,
3409,
364,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestParseDurationString_ShouldParseDurationStringAllUnits(t *testing.T) {
duration, err := ParseDurationString("1y")
assert.NoError(t, err)
assert.Equal(t, time.Hour*24*365, duration)
duration, err = ParseDurationString("1M")
assert.NoError(t, err)
assert.Equal(t, time.Hour*24*30, duration)
duration, err = ParseDurationString("1w")
assert.NoError(t, err)
assert.Equal(t, time.Hour*24*7, duration)
duration, err = ParseDurationString("1d")
assert.NoError(t, err)
assert.Equal(t, time.Hour*24, duration)
duration, err = ParseDurationString("1h")
assert.NoError(t, err)
assert.Equal(t, time.Hour, duration)
duration, err = ParseDurationString("1s")
assert.NoError(t, err)
assert.Equal(t, time.Second, duration)
} | explode_data.jsonl/12146 | {
"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,
14463,
12945,
703,
36578,
616,
14463,
12945,
703,
2403,
26314,
1155,
353,
8840,
836,
8,
341,
89300,
11,
1848,
1669,
14775,
12945,
703,
445,
16,
88,
5130,
6948,
35699,
1155,
11,
1848,
340,
6948,
12808,
1155,
11,
882,
73550,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestMapProxy_LockWithNonSerializableKey(t *testing.T) {
err := mp.Lock(student{})
AssertErrorNotNil(t, err, "lock did not return an error for nonserializable key")
mp.Clear()
} | explode_data.jsonl/57056 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 64
} | [
2830,
3393,
2227,
16219,
2351,
1176,
2354,
8121,
29268,
1592,
1155,
353,
8840,
836,
8,
341,
9859,
1669,
10490,
31403,
39004,
37790,
18017,
1454,
96144,
1155,
11,
1848,
11,
330,
1023,
1521,
537,
470,
458,
1465,
369,
2477,
10182,
8335,
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 |
func TestCharsetMakeFromBytes(t *testing.T) {
testdata := []struct {
src string
printType int
str string
size uint32
}{
{"", print_as_int, "", 0},
{"\\x01\\002", print_as_int, "1-2", 2},
{"\\x01\\002-\\x05", print_as_int, "1-5", 5},
{"a-", print_as_char, "\\-, a", 2},
{"\\21", print_as_char, "1-2, \\\\", 3},
{"\\x05-\\x01", print_as_char, "\\x01-\\x05", 5},
{"a-d", print_each_char, "a, b, c, d", 4},
}
for i, v := range testdata {
v := v
t.Run(fmt.Sprintf("%d", i), func(t *testing.T) {
t.Parallel()
c := NewCharset()
c.MakeFromBytes([]byte(v.src))
str := c.toString(v.printType)
test.EXPECT_EQ(t, str, v.str, "")
test.EXPECT_EQ(t, c.Size(), v.size, "")
})
}
} | explode_data.jsonl/51962 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 415
} | [
2830,
3393,
78172,
8078,
3830,
7078,
1155,
353,
8840,
836,
8,
972,
18185,
691,
1669,
3056,
1235,
972,
197,
41144,
981,
914,
319,
197,
6900,
929,
526,
319,
197,
11355,
981,
914,
319,
197,
13832,
414,
2622,
18,
17,
319,
197,
92,
1666,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestTasksBatch(t *testing.T) {
gd, err := startDispatcher(DefaultConfig())
assert.NoError(t, err)
defer gd.Close()
var expectedSessionID string
var nodeID string
{
stream, err := gd.Clients[0].Session(context.Background(), &api.SessionRequest{})
assert.NoError(t, err)
defer stream.CloseSend()
resp, err := stream.Recv()
assert.NoError(t, err)
assert.NotEmpty(t, resp.SessionID)
expectedSessionID = resp.SessionID
nodeID = resp.Node.ID
}
testTask1 := &api.Task{
NodeID: nodeID,
ID: "testTask1",
Status: api.TaskStatus{State: api.TaskStateAssigned},
}
testTask2 := &api.Task{
NodeID: nodeID,
ID: "testTask2",
Status: api.TaskStatus{State: api.TaskStateAssigned},
}
stream, err := gd.Clients[0].Assignments(context.Background(), &api.AssignmentsRequest{SessionID: expectedSessionID})
assert.NoError(t, err)
resp, err := stream.Recv()
assert.NoError(t, err)
// initially no tasks
assert.Equal(t, 0, len(resp.Changes))
// Create, Update and Delete tasks.
err = gd.Store.Update(func(tx store.Tx) error {
assert.NoError(t, store.CreateTask(tx, testTask1))
assert.NoError(t, store.CreateTask(tx, testTask2))
return nil
})
assert.NoError(t, err)
err = gd.Store.Update(func(tx store.Tx) error {
assert.NoError(t, store.UpdateTask(tx, testTask1))
assert.NoError(t, store.UpdateTask(tx, testTask2))
return nil
})
assert.NoError(t, err)
err = gd.Store.Update(func(tx store.Tx) error {
assert.NoError(t, store.DeleteTask(tx, testTask1.ID))
assert.NoError(t, store.DeleteTask(tx, testTask2.ID))
return nil
})
assert.NoError(t, err)
resp, err = stream.Recv()
assert.NoError(t, err)
// all tasks have been deleted
tasks, secrets := collectTasksAndSecrets(resp.Changes)
assert.Len(t, tasks, 2)
assert.Len(t, secrets, 0)
assert.Equal(t, api.AssignmentChange_AssignmentActionRemove, resp.Changes[0].Action)
assert.Equal(t, api.AssignmentChange_AssignmentActionRemove, resp.Changes[1].Action)
} | explode_data.jsonl/13853 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 770
} | [
2830,
3393,
25449,
21074,
1155,
353,
8840,
836,
8,
341,
3174,
67,
11,
1848,
1669,
1191,
21839,
87874,
2648,
2398,
6948,
35699,
1155,
11,
1848,
340,
16867,
32630,
10421,
2822,
2405,
3601,
5283,
915,
914,
198,
2405,
2436,
915,
914,
198,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestIngest_Kahuna1(t *testing.T) {
tt := test.Start(t).ScenarioWithoutHorizon("kahuna")
defer tt.Finish()
s := ingest(tt, false)
tt.Require.NoError(s.Err)
tt.Assert.Equal(62, s.Ingested)
// Test that re-importing fails
s.Err = nil
s.Run()
tt.Require.Error(s.Err, "Reimport didn't fail as expected")
// Test that re-importing fails with allowing clear succeeds
s.Err = nil
s.ClearExisting = true
s.Run()
tt.Require.NoError(s.Err, "Couldn't re-import, even with clear allowed")
} | explode_data.jsonl/30788 | {
"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,
641,
6969,
10102,
1466,
8565,
16,
1155,
353,
8840,
836,
8,
341,
3244,
83,
1669,
1273,
12101,
1155,
568,
54031,
26040,
39601,
16973,
445,
83502,
8565,
1138,
16867,
17853,
991,
18176,
2822,
1903,
1669,
88272,
47152,
11,
895,
6... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestReloadUpgrade2(t *testing.T) {
re := require.New(t)
registerDefaultSchedulers()
opt, err := newTestScheduleOption()
re.NoError(err)
// Simulate an old configuration that does not contain ScheduleConfig.
type OldConfig struct {
Replication ReplicationConfig `toml:"replication" json:"replication"`
}
old := &OldConfig{
Replication: *opt.GetReplicationConfig(),
}
storage := storage.NewStorageWithMemoryBackend()
re.NoError(storage.SaveConfig(old))
newOpt, err := newTestScheduleOption()
re.NoError(err)
re.NoError(newOpt.Reload(storage))
re.Equal("", newOpt.GetScheduleConfig().RegionScoreFormulaVersion) // formulaVersion keep old value when reloading.
} | explode_data.jsonl/78163 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 223
} | [
2830,
3393,
50035,
43861,
17,
1155,
353,
8840,
836,
8,
341,
17200,
1669,
1373,
7121,
1155,
340,
29422,
3675,
74674,
741,
64838,
11,
1848,
1669,
501,
2271,
32210,
5341,
741,
17200,
35699,
3964,
692,
197,
322,
4467,
6334,
458,
2310,
6546,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestMysqlValueToDatum(t *testing.T) {
defer leaktest.AfterTest(t)()
date := func(s string) tree.Datum {
d, err := tree.ParseDDate(nil, s)
if err != nil {
t.Fatal(err)
}
return d
}
ts := func(s string) tree.Datum {
d, err := tree.ParseDTimestamp(nil, s, time.Microsecond)
if err != nil {
t.Fatal(err)
}
return d
}
tests := []struct {
raw mysql.Expr
typ *types.T
want tree.Datum
}{
{raw: mysql.NewStrVal([]byte("0000-00-00")), typ: types.Date, want: tree.DNull},
{raw: mysql.NewStrVal([]byte("2010-01-01")), typ: types.Date, want: date("2010-01-01")},
{raw: mysql.NewStrVal([]byte("0000-00-00 00:00:00")), typ: types.Timestamp, want: tree.DNull},
{raw: mysql.NewStrVal([]byte("2010-01-01 00:00:00")), typ: types.Timestamp, want: ts("2010-01-01 00:00:00")},
}
evalContext := tree.NewTestingEvalContext(nil)
for _, tc := range tests {
t.Run(fmt.Sprintf("%v", tc.raw), func(t *testing.T) {
got, err := mysqlValueToDatum(tc.raw, tc.typ, evalContext)
if err != nil {
t.Fatal(err)
}
if !reflect.DeepEqual(got, tc.want) {
t.Errorf("got %v, want %v", got, tc.want)
}
})
}
} | explode_data.jsonl/20244 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 528
} | [
2830,
3393,
44,
14869,
1130,
1249,
68036,
1155,
353,
8840,
836,
8,
341,
16867,
23352,
1944,
36892,
2271,
1155,
8,
2822,
44086,
1669,
2915,
1141,
914,
8,
4916,
909,
26253,
341,
197,
2698,
11,
1848,
1669,
4916,
8937,
35,
1916,
27907,
11... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
func TestBootstrapVolumeMissingBackend(t *testing.T) {
const (
offlineBackendName = "bootstrapVolBackend"
scName = "bootstrapVolSC"
volumeName = "bootstrapVolVolume"
backendProtocol = config.File
)
orchestrator := getOrchestrator(t)
defer cleanup(t, orchestrator)
addBackendStorageClass(t, orchestrator, offlineBackendName, scName, backendProtocol)
_, err := orchestrator.AddVolume(
ctx(), tu.GenerateVolumeConfig(
volumeName, 50,
scName, config.File,
),
)
if err != nil {
t.Fatal("Unable to create volume: ", err)
}
// Simulate deleting the existing backend without going through Trident then bootstrapping
backend, err := orchestrator.getBackendByBackendName(offlineBackendName)
if err != nil {
t.Fatalf("Unable to get backend from store: %v", err)
}
orchestrator.mutex.Lock()
err = orchestrator.storeClient.DeleteBackend(ctx(), backend)
if err != nil {
t.Fatalf("Unable to delete volume from store: %v", err)
}
orchestrator.mutex.Unlock()
newOrchestrator := getOrchestrator(t)
bootstrappedVolume, err := newOrchestrator.GetVolume(ctx(), volumeName)
if err != nil {
t.Fatalf("error getting volume: %v", err)
}
if bootstrappedVolume == nil {
t.Error("volume not found during bootstrap")
}
if !bootstrappedVolume.State.IsMissingBackend() {
t.Error("unexpected volume state")
}
// Delete volume in missing_backend state
err = newOrchestrator.DeleteVolume(ctx(), volumeName)
if err != nil {
t.Error("could not delete volume with missing backend")
}
} | explode_data.jsonl/62723 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 553
} | [
2830,
3393,
45511,
18902,
25080,
29699,
1155,
353,
8840,
836,
8,
341,
4777,
2399,
197,
197,
63529,
29699,
675,
284,
330,
6281,
36361,
29699,
698,
197,
29928,
675,
1797,
284,
330,
6281,
36361,
3540,
698,
197,
5195,
4661,
675,
260,
284,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 8 |
func TestIssue22098(t *testing.T) {
store, clean := testkit.CreateMockStore(t)
defer clean()
tk := testkit.NewTestKit(t, store)
tk.MustExec("use test")
tk.MustExec("CREATE TABLE `ta` (" +
" `k` varchar(32) NOT NULL DEFAULT ' '," +
" `c0` varchar(32) NOT NULL DEFAULT ' '," +
" `c` varchar(18) NOT NULL DEFAULT ' '," +
" `e0` varchar(1) NOT NULL DEFAULT ' '," +
" PRIMARY KEY (`k`,`c0`,`c`)," +
" KEY `idx` (`c`,`e0`)" +
") ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin")
tk.MustExec("CREATE TABLE `tb` (" +
" `k` varchar(32) NOT NULL DEFAULT ' '," +
" `e` int(11) NOT NULL DEFAULT '0'," +
" `i` int(11) NOT NULL DEFAULT '0'," +
" `s` varchar(1) NOT NULL DEFAULT ' '," +
" `c` varchar(50) NOT NULL DEFAULT ' '," +
" PRIMARY KEY (`k`)" +
") ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin")
tk.MustExec("prepare stmt from \"select a.* from ta a left join tb b on a.k = b.k where (a.k <> '000000' and ((b.s = ? and i = ? ) or (b.s = ? and e = ?) or (b.s not in(?, ?))) and b.c like '%1%') or (a.c <> '000000' and a.k = '000000')\"")
tk.MustExec("set @a=3;set @b=20200414;set @c='a';set @d=20200414;set @e=3;set @f='a';")
tk.MustQuery("execute stmt using @a,@b,@c,@d,@e,@f").Check(testkit.Rows())
} | explode_data.jsonl/65571 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 599
} | [
2830,
3393,
42006,
17,
17,
15,
24,
23,
1155,
353,
8840,
836,
8,
341,
57279,
11,
4240,
1669,
1273,
8226,
7251,
11571,
6093,
1155,
340,
16867,
4240,
2822,
3244,
74,
1669,
1273,
8226,
7121,
2271,
7695,
1155,
11,
3553,
692,
3244,
74,
50... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestVault_StoreServerError(t *testing.T) {
testVaultItems := []vault.VaultItem{
{
ItemType: vault.PrivateKeyWithMnemonic,
Value: "SomePrivateKey",
},
}
storeVaultMock := func(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(http.StatusUnauthorized)
_, _ = w.Write([]byte(`{ "message": "Unauthorized Error: Authorization token is invalid."}`))
}
serverMock := func() *httptest.Server {
handler := http.NewServeMux()
handler.HandleFunc("/vaults", storeVaultMock)
srv := httptest.NewServer(handler)
return srv
}
server := serverMock()
defer server.Close()
v := vault.New(
// "https://f4nmmmkstb.execute-api.us-west-2.amazonaws.com/dev", // UNCOMMENT TO TEST REAL SERVER
server.URL,
testSaltSecret,
)
storeRequest, err := v.Store(testUuid, testPassphrase, testAPIToken, testVaultItems)
assert.NotNil(t, err)
assert.Nil(t, storeRequest)
} | explode_data.jsonl/11926 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 356
} | [
2830,
3393,
79177,
92684,
38509,
1155,
353,
8840,
836,
8,
341,
18185,
79177,
4353,
1669,
3056,
82983,
5058,
945,
1234,
515,
197,
197,
515,
298,
61574,
929,
25,
34584,
87738,
1592,
2354,
44,
70775,
345,
298,
47399,
25,
262,
330,
8373,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_PrintString(t *testing.T) {
cases := []string{
"Howdy",
"Hello world",
"God\"s eye",
"Mamma mia",
}
for _, c := range cases {
output := Print(c)
assert.Equal(t, fmt.Sprintf("\"%+v\"\n", c), output)
}
} | explode_data.jsonl/43704 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 108
} | [
2830,
3393,
45788,
703,
1155,
353,
8840,
836,
8,
341,
1444,
2264,
1669,
3056,
917,
515,
197,
197,
70959,
10258,
756,
197,
197,
1,
9707,
1879,
756,
197,
197,
1,
27522,
2105,
82,
7912,
756,
197,
197,
73527,
13099,
56253,
756,
197,
630... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
func TestFileItem_FolderName(t *testing.T) {
f := &fileDialog{file: &FileDialog{}}
_ = f.makeUI()
item := f.newFileItem(storage.NewURI("file:///path/to/foldername/"), true)
assert.Equal(t, "foldername", item.name)
item = f.newFileItem(storage.NewURI("file:///path/to/myapp.app/"), true)
assert.Equal(t, "myapp.app", item.name)
item = f.newFileItem(storage.NewURI("file:///path/to/.maybeHidden/"), true)
assert.Equal(t, ".maybeHidden", item.name)
} | explode_data.jsonl/11115 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 180
} | [
2830,
3393,
1703,
1234,
1400,
2018,
675,
1155,
353,
8840,
836,
8,
341,
1166,
1669,
609,
1192,
4468,
90,
1192,
25,
609,
26596,
6257,
532,
197,
62,
284,
282,
10117,
2275,
2822,
22339,
1669,
282,
4618,
1703,
1234,
52463,
7121,
10301,
445... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestCreateRouteWithMultipleTargets(t *testing.T) {
_, sharedClient, servingClient, controller, _, _, servingInformer, _ := newTestReconciler(t)
// A standalone revision
rev := getTestRevision("test-rev")
servingClient.ServingV1alpha1().Revisions(testNamespace).Create(rev)
servingInformer.Serving().V1alpha1().Revisions().Informer().GetIndexer().Add(rev)
// A configuration and associated revision. Normally the revision would be
// created by the configuration controller.
config := getTestConfiguration()
cfgrev := getTestRevisionForConfig(config)
config.Status.SetLatestCreatedRevisionName(cfgrev.Name)
config.Status.SetLatestReadyRevisionName(cfgrev.Name)
servingClient.ServingV1alpha1().Configurations(testNamespace).Create(config)
// Since Reconcile looks in the lister, we need to add it to the informer
servingInformer.Serving().V1alpha1().Configurations().Informer().GetIndexer().Add(config)
servingClient.ServingV1alpha1().Revisions(testNamespace).Create(cfgrev)
servingInformer.Serving().V1alpha1().Revisions().Informer().GetIndexer().Add(cfgrev)
// A route targeting both the config and standalone revision
route := getTestRouteWithTrafficTargets(
[]v1alpha1.TrafficTarget{{
ConfigurationName: config.Name,
Percent: 90,
}, {
RevisionName: rev.Name,
Percent: 10,
}},
)
servingClient.ServingV1alpha1().Routes(testNamespace).Create(route)
// Since Reconcile looks in the lister, we need to add it to the informer
servingInformer.Serving().V1alpha1().Routes().Informer().GetIndexer().Add(route)
controller.Reconcile(context.TODO(), KeyOrDie(route))
vs, err := sharedClient.NetworkingV1alpha3().VirtualServices(testNamespace).Get(resourcenames.VirtualService(route), metav1.GetOptions{})
if err != nil {
t.Fatalf("error getting VirtualService: %v", err)
}
domain := strings.Join([]string{route.Name, route.Namespace, defaultDomainSuffix}, ".")
expectedSpec := v1alpha3.VirtualServiceSpec{
// We want to connect to two Gateways: the Route's ingress
// Gateway, and the 'mesh' Gateway. The former provides
// access from outside of the cluster, and the latter provides
// access for services from inside the cluster.
Gateways: []string{
resourcenames.K8sGatewayFullname,
"mesh",
},
Hosts: []string{
"*." + domain,
domain,
"test-route.test.svc.cluster.local",
},
Http: []v1alpha3.HTTPRoute{{
Match: []v1alpha3.HTTPMatchRequest{{
Authority: &v1alpha3.StringMatch{Exact: domain},
}, {
Authority: &v1alpha3.StringMatch{Exact: "test-route.test.svc.cluster.local"},
}, {
Authority: &v1alpha3.StringMatch{Exact: "test-route.test.svc"},
}, {
Authority: &v1alpha3.StringMatch{Exact: "test-route.test"},
}, {
Authority: &v1alpha3.StringMatch{Exact: "test-route"},
}},
Route: []v1alpha3.DestinationWeight{{
Destination: v1alpha3.Destination{
Host: fmt.Sprintf("%s-service.test.svc.cluster.local", cfgrev.Name),
Port: v1alpha3.PortSelector{Number: 80},
},
Weight: 90,
}, {
Destination: v1alpha3.Destination{
Host: fmt.Sprintf("%s-service.test.svc.cluster.local", rev.Name),
Port: v1alpha3.PortSelector{Number: 80},
},
Weight: 10,
}},
Timeout: resources.DefaultRouteTimeout,
}},
}
if diff := cmp.Diff(expectedSpec, vs.Spec); diff != "" {
t.Errorf("Unexpected rule spec diff (-want +got): %v", diff)
}
} | explode_data.jsonl/3280 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 1266
} | [
2830,
3393,
4021,
4899,
2354,
32089,
49030,
1155,
353,
8840,
836,
8,
341,
197,
6878,
6094,
2959,
11,
13480,
2959,
11,
6461,
11,
8358,
8358,
13480,
641,
34527,
11,
716,
1669,
501,
2271,
693,
40446,
5769,
1155,
340,
197,
322,
362,
43388... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestSeriesCopy(t *testing.T) {
// Create new series
init := []Series{
NewSeriesFloat64("test", &SeriesInit{1, 0}, 1, nil, 2, 3),
NewSeriesInt64("test", &SeriesInit{1, 0}, 1, nil, 2, 3),
NewSeriesString("test", &SeriesInit{1, 0}, "1", nil, "2", "3"),
NewSeriesTime("test", &SeriesInit{1, 0}, time.Now(), nil, time.Now(), time.Now()),
NewSeriesMixed("test", &SeriesInit{1, 0}, 1, nil, 2, 3),
NewSeriesGeneric("test", civil.Date{}, &SeriesInit{0, 1}, civil.Date{2018, time.May, 01}, nil, civil.Date{2018, time.May, 02}, civil.Date{2018, time.May, 03}),
}
for i := range init {
s := init[i]
cp := s.Copy()
if !cmp.Equal(s, cp, cmpopts.EquateNaNs(), cmpopts.IgnoreUnexported(SeriesFloat64{}, SeriesInt64{}, SeriesString{}, SeriesTime{}, SeriesMixed{}, SeriesGeneric{})) {
t.Errorf("wrong val: expected: %v actual: %v", s, cp)
}
}
} | explode_data.jsonl/10006 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 352
} | [
2830,
3393,
25544,
12106,
1155,
353,
8840,
836,
8,
1476,
197,
322,
4230,
501,
4013,
198,
28248,
1669,
3056,
25544,
515,
197,
197,
3564,
25544,
5442,
21,
19,
445,
1944,
497,
609,
25544,
3803,
90,
16,
11,
220,
15,
2137,
220,
16,
11,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
func TestRuntimeNew(t *testing.T) {
vm := New()
v, err := vm.New(vm.Get("Number"), vm.ToValue("12345"))
if err != nil {
t.Fatal(err)
}
if n, ok := v.Export().(int64); ok {
if n != 12345 {
t.Fatalf("n: %v", n)
}
} else {
t.Fatalf("v: %T", v)
}
} | explode_data.jsonl/10507 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 133
} | [
2830,
3393,
15123,
3564,
1155,
353,
8840,
836,
8,
341,
54879,
1669,
1532,
741,
5195,
11,
1848,
1669,
10995,
7121,
31723,
2234,
445,
2833,
3975,
10995,
3274,
1130,
445,
16,
17,
18,
19,
20,
5455,
743,
1848,
961,
2092,
341,
197,
3244,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 4 |
func TestErrInvalidValue(t *testing.T) {
expected := cli.FieldErrors{
&field.Error{
Type: field.ErrorTypeInvalid,
Field: "test-field",
BadValue: "value",
Detail: "",
},
}
actual := cli.ErrInvalidValue("value", rifftesting.TestField)
if diff := cmp.Diff(expected, actual); diff != "" {
t.Errorf("(-expected, +actual): %s", diff)
}
} | explode_data.jsonl/13218 | {
"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,
7747,
7928,
1130,
1155,
353,
8840,
836,
8,
341,
42400,
1669,
21348,
17087,
13877,
515,
197,
197,
5,
2566,
6141,
515,
298,
27725,
25,
257,
2070,
6141,
929,
7928,
345,
298,
94478,
25,
262,
330,
1944,
19130,
756,
298,
12791,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestRequestAllCheckpoint_RequestValue_Max(t *testing.T) {
req, err := http.NewRequest(http.MethodPost, "http://teaos.cn", bytes.NewBuffer([]byte(strings.Repeat("123456", 10240000))))
if err != nil {
t.Fatal(err)
}
checkpoint := new(RequestBodyCheckpoint)
value, err, _ := checkpoint.RequestValue(requests.NewRequest(req), "", nil)
if err != nil {
t.Fatal(err)
}
t.Log("value bytes:", len(types.String(value)))
body, err := ioutil.ReadAll(req.Body)
if err != nil {
t.Fatal(err)
}
t.Log("raw bytes:", len(body))
} | explode_data.jsonl/79079 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 209
} | [
2830,
3393,
1900,
2403,
92688,
44024,
1130,
58843,
1155,
353,
8840,
836,
8,
341,
24395,
11,
1848,
1669,
1758,
75274,
19886,
20798,
4133,
11,
330,
1254,
1110,
665,
64866,
22057,
497,
5820,
7121,
4095,
10556,
3782,
51442,
2817,
10979,
445,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 4 |
func TestRequestFactory(t *testing.T) {
mInfo, err := protoregistry.GitalyProtoPreregistered.LookupMethod("/gitaly.RepositoryService/RepositoryExists")
require.NoError(t, err)
pb, err := mInfo.UnmarshalRequestProto([]byte{})
require.NoError(t, err)
testhelper.ProtoEqual(t, &gitalypb.RepositoryExistsRequest{}, pb)
} | explode_data.jsonl/49679 | {
"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,
1900,
4153,
1155,
353,
8840,
836,
8,
341,
2109,
1731,
11,
1848,
1669,
1724,
460,
70,
4944,
1224,
2174,
88,
31549,
3533,
52633,
1571,
291,
79261,
3523,
4283,
70,
2174,
88,
25170,
1860,
14,
4624,
15575,
1138,
17957,
35699,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestGeometry(t *testing.T) {
for _, tc := range []struct {
g geom.T
s string
}{
{
g: geom.NewPoint(DefaultLayout),
s: `{"type":"Point","coordinates":[0,0]}`,
},
{
g: geom.NewPoint(geom.XY).MustSetCoords(geom.Coord{1, 2}),
s: `{"type":"Point","coordinates":[1,2]}`,
},
{
g: geom.NewPoint(geom.XYZ).MustSetCoords(geom.Coord{1, 2, 3}),
s: `{"type":"Point","coordinates":[1,2,3]}`,
},
{
g: geom.NewPoint(geom.XYZM).MustSetCoords(geom.Coord{1, 2, 3, 4}),
s: `{"type":"Point","coordinates":[1,2,3,4]}`,
},
{
g: geom.NewLineString(DefaultLayout),
s: `{"type":"LineString","coordinates":[]}`,
},
{
g: geom.NewLineString(geom.XY).MustSetCoords([]geom.Coord{{1, 2}, {3, 4}}),
s: `{"type":"LineString","coordinates":[[1,2],[3,4]]}`,
},
{
g: geom.NewLineString(geom.XYZ).MustSetCoords([]geom.Coord{{1, 2, 3}, {4, 5, 6}}),
s: `{"type":"LineString","coordinates":[[1,2,3],[4,5,6]]}`,
},
{
g: geom.NewLineString(geom.XYZM).MustSetCoords([]geom.Coord{{1, 2, 3, 4}, {5, 6, 7, 8}}),
s: `{"type":"LineString","coordinates":[[1,2,3,4],[5,6,7,8]]}`,
},
{
g: geom.NewPolygon(DefaultLayout),
s: `{"type":"Polygon","coordinates":[]}`,
},
{
g: geom.NewPolygon(geom.XY).MustSetCoords([][]geom.Coord{{{1, 2}, {3, 4}, {5, 6}, {1, 2}}}),
s: `{"type":"Polygon","coordinates":[[[1,2],[3,4],[5,6],[1,2]]]}`,
},
{
g: geom.NewPolygon(geom.XYZ).MustSetCoords([][]geom.Coord{{{1, 2, 3}, {4, 5, 6}, {7, 8, 9}, {1, 2, 3}}}),
s: `{"type":"Polygon","coordinates":[[[1,2,3],[4,5,6],[7,8,9],[1,2,3]]]}`,
},
{
g: geom.NewMultiPoint(DefaultLayout),
s: `{"type":"MultiPoint","coordinates":[]}`,
},
{
g: geom.NewMultiPoint(geom.XY).MustSetCoords([]geom.Coord{{1, 2}, {3, 4}}),
s: `{"type":"MultiPoint","coordinates":[[1,2],[3,4]]}`,
},
{
g: geom.NewMultiPoint(geom.XYZ).MustSetCoords([]geom.Coord{{1, 2, 3}, {4, 5, 6}}),
s: `{"type":"MultiPoint","coordinates":[[1,2,3],[4,5,6]]}`,
},
{
g: geom.NewMultiPoint(geom.XYZM).MustSetCoords([]geom.Coord{{1, 2, 3, 4}, {5, 6, 7, 8}}),
s: `{"type":"MultiPoint","coordinates":[[1,2,3,4],[5,6,7,8]]}`,
},
{
g: geom.NewMultiLineString(DefaultLayout),
s: `{"type":"MultiLineString","coordinates":[]}`,
},
{
g: geom.NewMultiLineString(geom.XY).MustSetCoords([][]geom.Coord{{{1, 2}, {3, 4}, {5, 6}, {1, 2}}}),
s: `{"type":"MultiLineString","coordinates":[[[1,2],[3,4],[5,6],[1,2]]]}`,
},
{
g: geom.NewMultiLineString(geom.XYZ).MustSetCoords([][]geom.Coord{{{1, 2, 3}, {4, 5, 6}, {7, 8, 9}, {1, 2, 3}}}),
s: `{"type":"MultiLineString","coordinates":[[[1,2,3],[4,5,6],[7,8,9],[1,2,3]]]}`,
},
{
g: geom.NewMultiPolygon(DefaultLayout),
s: `{"type":"MultiPolygon","coordinates":[]}`,
},
{
g: geom.NewMultiPolygon(geom.XYZ).MustSetCoords([][][]geom.Coord{{{{1, 2, 3}, {4, 5, 6}, {7, 8, 9}, {1, 2, 3}}, {{-1, -2, -3}, {-4, -5, -6}, {-7, -8, -9}, {-1, -2, -3}}}}),
s: `{"type":"MultiPolygon","coordinates":[[[[1,2,3],[4,5,6],[7,8,9],[1,2,3]],[[-1,-2,-3],[-4,-5,-6],[-7,-8,-9],[-1,-2,-3]]]]}`,
},
{
g: geom.NewGeometryCollection().MustPush(
geom.NewPoint(geom.XY).MustSetCoords(geom.Coord{100, 0}),
geom.NewLineString(geom.XY).MustSetCoords([]geom.Coord{{101, 0}, {102, 1}}),
),
s: `{"type":"GeometryCollection","geometries":[{"type":"Point","coordinates":[100,0]},{"type":"LineString","coordinates":[[101,0],[102,1]]}]}`,
},
} {
if got, err := Marshal(tc.g); err != nil || string(got) != tc.s {
t.Errorf("Marshal(%#v) == %#v, %v, want %#v, nil", tc.g, string(got), err, tc.s)
}
var g geom.T
if err := Unmarshal([]byte(tc.s), &g); err != nil || !reflect.DeepEqual(g, tc.g) {
t.Errorf("Unmarshal(%#v, %#v) == %v, want %#v, nil", tc.s, g, err, tc.g)
}
}
} | explode_data.jsonl/73811 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 1938
} | [
2830,
3393,
20787,
1155,
353,
8840,
836,
8,
341,
2023,
8358,
17130,
1669,
2088,
3056,
1235,
341,
197,
3174,
27256,
836,
198,
197,
1903,
914,
198,
197,
59403,
197,
197,
515,
298,
3174,
25,
27256,
7121,
2609,
87874,
2175,
1326,
298,
190... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestContextNegotiationFormat(t *testing.T) {
c, _ := CreateTestContext(httptest.NewRecorder())
c.Request, _ = http.NewRequest("POST", "", nil)
assert.Panics(t, func() { c.NegotiateFormat() })
assert.Equal(t, MIMEJSON, c.NegotiateFormat(MIMEJSON, MIMEXML))
assert.Equal(t, MIMEHTML, c.NegotiateFormat(MIMEHTML, MIMEJSON))
} | explode_data.jsonl/26806 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 130
} | [
2830,
3393,
1972,
47800,
354,
7101,
4061,
1155,
353,
8840,
836,
8,
341,
1444,
11,
716,
1669,
4230,
2271,
1972,
73392,
83,
70334,
7121,
47023,
2398,
1444,
9659,
11,
716,
284,
1758,
75274,
445,
2946,
497,
7342,
2092,
692,
6948,
1069,
27... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestNewSnowball(t *testing.T) {
t.Parallel()
defaultBeta := conf.GetSnowballBeta()
conf.Update(conf.WithSnowballBeta(10))
defer func() {
conf.Update(conf.WithSnowballBeta(defaultBeta))
}()
snowball := NewSnowball()
keys, err := skademlia.NewKeys(1, 1)
assert.NoError(t, err)
start := AttachSenderToTransaction(keys, NewTransaction(keys, sys.TagTransfer, nil))
endA := AttachSenderToTransaction(keys, NewTransaction(keys, sys.TagStake, nil))
endB := AttachSenderToTransaction(keys, NewTransaction(keys, sys.TagContract, nil))
a := NewRound(1, ZeroMerkleNodeID, 1337, start, endA)
b := NewRound(1, ZeroMerkleNodeID, 1010, start, endB)
// Check that Snowball terminates properly given unanimous sampling of Round A.
assert.Nil(t, snowball.Preferred())
var preferred *Round
for i := 0; i < 12; i++ {
assert.False(t, snowball.Decided())
snowball.Tick(&a)
preferred = snowball.Preferred().(*Round)
assert.Equal(t, *preferred, a)
}
assert.True(t, snowball.Decided())
preferred = snowball.Preferred().(*Round)
assert.Equal(t, *preferred, a)
assert.Equal(t, snowball.count, 11)
assert.Len(t, snowball.counts, 1)
assert.Len(t, snowball.candidates, 1)
// Try tick once more. Does absolutely nothing.
cloned := *snowball
snowball.Tick(&a)
assert.Equal(t, cloned, *snowball)
// Reset Snowball and assert everything is cleared properly.
snowball.Reset()
assert.False(t, snowball.Decided())
assert.Nil(t, snowball.Preferred())
assert.Equal(t, snowball.count, 0)
assert.Len(t, snowball.counts, 0)
assert.Len(t, snowball.candidates, 0)
// Check that Snowball terminates properly given unanimous sampling of Round A, with preference
// first initially to check for off-by-one errors.
snowball.Prefer(&a)
preferred = snowball.Preferred().(*Round)
assert.Equal(t, *preferred, a)
for i := 0; i < 12; i++ {
assert.False(t, snowball.Decided())
snowball.Tick(&a)
preferred = snowball.Preferred().(*Round)
assert.Equal(t, *preferred, a)
}
assert.True(t, snowball.Decided())
preferred = snowball.Preferred().(*Round)
assert.Equal(t, *preferred, a)
assert.Equal(t, snowball.count, 11)
assert.Len(t, snowball.counts, 1)
assert.Len(t, snowball.candidates, 1)
// Reset Snowball and assert everything is cleared properly.
snowball.Reset()
assert.False(t, snowball.Decided())
assert.Nil(t, snowball.Preferred())
assert.Equal(t, snowball.count, 0)
assert.Len(t, snowball.counts, 0)
assert.Len(t, snowball.candidates, 0)
// Check that Snowball terminates if we sample 11 times Round A, then sample 12 times Round B.
// This demonstrates the that we need a large amount of samplings to overthrow our preferred
// round, originally being A, such that it is B.
for i := 0; i < 11; i++ {
assert.False(t, snowball.Decided())
snowball.Tick(&a)
preferred = snowball.Preferred().(*Round)
assert.Equal(t, *preferred, a)
}
assert.False(t, snowball.Decided())
for i := 0; i < 12; i++ {
assert.False(t, snowball.Decided())
snowball.Tick(&b)
preferred = snowball.Preferred().(*Round)
if i == 11 {
assert.Equal(t, *preferred, b)
} else {
assert.Equal(t, *preferred, a)
}
}
assert.Equal(t, snowball.counts[a.GetID()], 11)
assert.Equal(t, snowball.counts[b.GetID()], 12)
assert.True(t, snowball.Decided())
preferred = snowball.Preferred().(*Round)
assert.Equal(t, *preferred, b)
assert.Equal(t, snowball.count, 11)
assert.Len(t, snowball.counts, 2)
assert.Len(t, snowball.candidates, 2)
// Try cause a panic by ticking with nil, or with an empty round.
empty := &Round{}
snowball.Tick(nil)
snowball.Tick(empty)
assert.Equal(t, snowball.counts[a.GetID()], 11)
assert.Equal(t, snowball.counts[b.GetID()], 12)
assert.True(t, snowball.Decided())
preferred = snowball.Preferred().(*Round)
assert.Equal(t, b, *preferred)
assert.Equal(t, 11, snowball.count)
assert.Len(t, snowball.counts, 2)
assert.Len(t, snowball.candidates, 2)
// Try tick with nil if Snowball has not decided yet.
snowball.Reset()
snowball.Tick(&a)
snowball.Tick(&a)
assert.Equal(t, a.GetID(), snowball.lastID)
assert.Equal(t, 1, snowball.Progress())
assert.Len(t, snowball.counts, 1)
snowball.Tick(nil)
assert.Equal(t, "", snowball.lastID)
assert.Equal(t, 0, snowball.Progress())
assert.Len(t, snowball.counts, 1)
} | explode_data.jsonl/75136 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 1619
} | [
2830,
3393,
3564,
62285,
3959,
1155,
353,
8840,
836,
8,
341,
3244,
41288,
7957,
2822,
11940,
64811,
1669,
2335,
2234,
62285,
3959,
64811,
741,
67850,
16689,
29879,
26124,
62285,
3959,
64811,
7,
16,
15,
1171,
16867,
2915,
368,
341,
197,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func Test_removeLVGArtifacts_Fail(t *testing.T) {
var (
c = setup(t, node1ID)
e = &mocks.GoMockExecutor{}
vg = lvgCR1.Name
err error
)
c.lvmOps = lvm.NewLVM(e, testLogger)
// expect that VG contains LV
e.OnCommand(fmt.Sprintf(lvm.LVsInVGCmdTmpl, vg)).Return("some-lv1", "", nil).Times(1)
err = c.removeLVGArtifacts(vg)
assert.Equal(t, fmt.Errorf("there are LVs in LogicalVolumeGroup %s", vg), err)
// expect that VGRemove failed
e.OnCommand(fmt.Sprintf(lvm.LVsInVGCmdTmpl, vg)).Return("", "", nil).Times(1)
e.OnCommand(fmt.Sprintf(lvm.VGRemoveCmdTmpl, vg)).Return("", "", errors.New("error"))
err = c.removeLVGArtifacts(vg)
assert.Contains(t, err.Error(), "unable to remove LogicalVolumeGroup")
} | explode_data.jsonl/51725 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 317
} | [
2830,
3393,
18193,
40258,
38,
9286,
26401,
1400,
604,
1155,
353,
8840,
836,
8,
341,
2405,
2399,
197,
1444,
256,
284,
6505,
1155,
11,
2436,
16,
915,
340,
197,
7727,
256,
284,
609,
16712,
82,
67131,
11571,
25255,
16094,
197,
5195,
70,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestAddCompleteFileSizeLessThanAllowed(t *testing.T) {
removeTestFiles()
t.Log("removing Least recently used")
var context = getTestContext()
context[C.MINFILESIZE] = "1"
index := 1
storage := getNewContextLessStorageManager(context)
createEmptyTestFile(index, t)
filename := storage.GetNextFileName()
if err := storage.AddCompleteFile(filename); err != nil {
t.Fatal(err)
}
checkFileDoesntExist(storage.Prefix()+fmt.Sprintf("%d", index)+storage.Suffix(), t)
checkFileNameNotStored(storage, t)
assert.Equal(t, index, storage.Index())
} | explode_data.jsonl/16210 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 196
} | [
2830,
3393,
2212,
12548,
67649,
27451,
26067,
35382,
1155,
353,
8840,
836,
8,
341,
47233,
2271,
10809,
741,
3244,
5247,
445,
1826,
9130,
90516,
5926,
1483,
5130,
2405,
2266,
284,
633,
2271,
1972,
2822,
28413,
43504,
37470,
20209,
3282,
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 TestClient_DownloadBill(t *testing.T) {
// 初始化参数结构体
bm := make(gopay.BodyMap)
bm.Set("nonce_str", util.GetRandomString(32)).
Set("sign_type", SignType_MD5).
Set("bill_date", "20190722").
Set("bill_type", "ALL")
// 请求下载对账单,成功后得到结果(string类型字符串)
wxRsp, err := client.DownloadBill(bm)
if err != nil {
xlog.Errorf("client.DownloadBill(%+v),error:%+v", bm, err)
return
}
xlog.Debug("wxRsp:", wxRsp)
} | explode_data.jsonl/56606 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 248
} | [
2830,
3393,
2959,
1557,
37702,
27476,
1155,
353,
8840,
836,
8,
341,
197,
322,
76090,
32665,
100166,
31914,
198,
2233,
76,
1669,
1281,
3268,
453,
352,
20934,
2227,
340,
2233,
76,
4202,
445,
39593,
2895,
497,
4094,
2234,
13999,
703,
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... | 2 |
func TestPipelineCreation(t *testing.T) {
appSess, err := testSession(nil)
require.NoError(t, err)
appId := identity.New(appSess)
appCallerInfo, err := appId.Get()
require.NoError(t, err)
appDeployer := cloudformation.New(appSess)
sm := secretsmanager.New(appSess)
secretId := "testGitHubSecret" + randStringBytes(10)
t.Run("creates a cross-region pipeline in a region with no environment", func(t *testing.T) {
createMockSecret(t, sm, secretId)
appCfClient := awsCF.New(appSess)
app := config.Application{
Name: randStringBytes(10),
AccountID: appCallerInfo.Account,
}
pipelineStackName := app.Name + "-pipepiper"
appRoleStackName := fmt.Sprintf("%s-infrastructure-roles", app.Name)
appStackSetName := fmt.Sprintf("%s-infrastructure", app.Name)
// find another region (different from the application region,
// i.e. *sess.Config.Region) for us to deploy an environment in.
envRegion, err := findUnusedRegion("us-west", *appSess.Config.Region)
require.NoError(t, err)
envSess, err := testSession(aws.String(envRegion.ID()))
require.NoError(t, err)
envCfClient := awsCF.New(envSess)
envId := identity.New(envSess)
envCallerInfo, err := envId.Get()
require.NoError(t, err)
envDeployer := cloudformation.New(envSess)
environmentToDeploy := deploy.CreateEnvironmentInput{
Name: randStringBytes(10),
AppName: app.Name,
ToolsAccountPrincipalARN: envCallerInfo.RootUserARN,
}
envStackName := fmt.Sprintf("%s-%s",
environmentToDeploy.AppName,
environmentToDeploy.Name)
// Make sure we delete the stacks after the test is done
defer func() {
// delete the pipeline first because it relies on stackset
_, err := appCfClient.DeleteStack(&awsCF.DeleteStackInput{
StackName: aws.String(pipelineStackName),
})
require.NoError(t, err)
err = appCfClient.WaitUntilStackDeleteComplete(&awsCF.DescribeStacksInput{
StackName: aws.String(pipelineStackName),
})
require.NoError(t, err)
// Clean up any StackInstances we may have created.
if stackInstances, err := appCfClient.ListStackInstances(&awsCF.ListStackInstancesInput{
StackSetName: aws.String(appStackSetName),
}); err == nil && stackInstances.Summaries != nil && stackInstances.Summaries[0] != nil {
appStackInstance := stackInstances.Summaries[0]
_, err := appCfClient.DeleteStackInstances(&awsCF.DeleteStackInstancesInput{
Accounts: []*string{appStackInstance.Account},
Regions: []*string{appStackInstance.Region},
RetainStacks: aws.Bool(false),
StackSetName: appStackInstance.StackSetId,
})
require.NoError(t, err)
err = appCfClient.WaitUntilStackDeleteComplete(&awsCF.DescribeStacksInput{
StackName: appStackInstance.StackId,
})
require.NoError(t, err)
}
// Delete the StackSet once all the StackInstances are cleaned up
_, err = appCfClient.DeleteStackSet(&awsCF.DeleteStackSetInput{
StackSetName: aws.String(appStackSetName),
})
require.NoError(t, err)
_, err = appCfClient.DeleteStack(&awsCF.DeleteStackInput{
StackName: aws.String(appRoleStackName),
})
require.NoError(t, err)
err = appCfClient.WaitUntilStackDeleteComplete(&awsCF.DescribeStacksInput{
StackName: aws.String(appRoleStackName),
})
require.NoError(t, err)
// delete the environment stack once we are done
_, err = envCfClient.DeleteStack(&awsCF.DeleteStackInput{
StackName: aws.String(envStackName),
})
require.NoError(t, err)
err = envCfClient.WaitUntilStackDeleteComplete(&awsCF.DescribeStacksInput{
StackName: aws.String(envStackName),
})
require.NoError(t, err)
deleteMockSecretImmediately(t, sm, secretId)
}()
// Given both the application stack and env we are deploying to do not
// exist
assertStackDoesNotExist(t, appCfClient, appRoleStackName)
assertStackDoesNotExist(t, envCfClient, envStackName)
// create a stackset
err = appDeployer.DeployApp(&deploy.CreateAppInput{
Name: app.Name,
AccountID: app.AccountID,
})
require.NoError(t, err)
// Deploy the environment in the same tools account but in different
// region and wait for it to be complete
require.NoError(t, envDeployer.DeployEnvironment(&environmentToDeploy))
// Make sure the environment was deployed succesfully
_, responses := envDeployer.StreamEnvironmentCreation(&environmentToDeploy)
resp := <-responses
require.NoError(t, resp.Err)
// Ensure that the newly created env stack exists
assertStackExists(t, envCfClient, envStackName)
// Provision resources needed to support a pipeline in a region with
// no existing copilot environment.
err = appDeployer.AddPipelineResourcesToApp(
&app,
*appSess.Config.Region)
require.NoError(t, err)
stackInstances, err := appCfClient.ListStackInstances(&awsCF.ListStackInstancesInput{
StackSetName: aws.String(appStackSetName),
})
require.NoError(t, err)
require.Equal(t, 1, len(stackInstances.Summaries),
"application stack instance should exist")
resources, err := appDeployer.GetRegionalAppResources(&app)
require.NoError(t, err)
artifactBuckets := regionalResourcesToArtifactBuckets(t, resources)
pipelineInput := &deploy.CreatePipelineInput{
AppName: app.Name,
Name: pipelineStackName,
Source: &deploy.Source{
ProviderName: manifest.GithubProviderName,
Properties: map[string]interface{}{
"repository": "chicken/wings",
"branch": "main",
manifest.GithubSecretIdKeyName: secretId,
},
},
Stages: []deploy.PipelineStage{
{
AssociatedEnvironment: &deploy.AssociatedEnvironment{
Name: environmentToDeploy.Name,
Region: *appSess.Config.Region,
AccountID: app.AccountID,
},
LocalWorkloads: []string{"frontend", "backend"},
},
},
ArtifactBuckets: artifactBuckets,
}
require.NoError(t, appDeployer.CreatePipeline(pipelineInput))
// Ensure that the new stack exists
assertStackExists(t, appCfClient, pipelineStackName)
})
} | explode_data.jsonl/27826 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 2337
} | [
2830,
3393,
34656,
32701,
1155,
353,
8840,
836,
8,
341,
28236,
50,
433,
11,
1848,
1669,
1273,
5283,
27907,
340,
17957,
35699,
1155,
11,
1848,
340,
28236,
764,
1669,
9569,
7121,
11462,
50,
433,
340,
28236,
58735,
1731,
11,
1848,
1669,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 4 |
func TestGetBidTypeVideo(t *testing.T) {
pubmaticExt := new(pubmaticBidExt)
pubmaticExt.BidType = new(int)
*pubmaticExt.BidType = 1
actualBidTypeValue := getBidType(pubmaticExt)
if actualBidTypeValue != openrtb_ext.BidTypeVideo {
t.Errorf("Expected Bid Type value was: %v, actual value is: %v", openrtb_ext.BidTypeVideo, actualBidTypeValue)
}
} | explode_data.jsonl/77924 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 139
} | [
2830,
3393,
1949,
65452,
929,
10724,
1155,
353,
8840,
836,
8,
341,
62529,
37244,
6756,
1669,
501,
74186,
37244,
65452,
6756,
340,
62529,
37244,
6756,
1785,
307,
929,
284,
501,
1548,
340,
197,
9,
9585,
37244,
6756,
1785,
307,
929,
284,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
func TestDeleteObjectOK(t *testing.T) {
testServer(func(s *core.Server) {
//test delete
headers := make(map[string]string)
headers["X-Api-Token"] = apiToken
headers["X-Api-Secret"] = apiSecret
url := "/api/v1/objects/" + "GameScore/" + objectID
//make request
res, err := testHTTPRequestWithHeaders("DELETE", url, ``, headers)
if err != nil {
t.Fatalf("unable to delete object: %v , %v", url, err)
} else {
body, _ := ioutil.ReadAll(res.Body)
if res.StatusCode != 200 {
t.Fatalf("unable to delete object: %v , %v", url, string(body))
}
//fmt.Printf("object delete response: %v\n ", string(body))
}
})
} | explode_data.jsonl/42223 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 264
} | [
2830,
3393,
6435,
1190,
3925,
1155,
353,
8840,
836,
8,
1476,
18185,
5475,
18552,
1141,
353,
2153,
22997,
8,
341,
197,
197,
322,
1944,
3698,
198,
197,
67378,
1669,
1281,
9147,
14032,
30953,
340,
197,
67378,
1183,
55,
12,
6563,
89022,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestCA_Sign(t *testing.T) {
rootPK, err := pki.GenerateECPrivateKey(256)
if err != nil {
t.Fatal(err)
}
rootCert, _ := generateSelfSignedCACert(t, rootPK, "root")
// Build test CSR
testpk, err := pki.GenerateECPrivateKey(256)
if err != nil {
t.Fatal(err)
}
testCSR := generateCSR(t, testpk, x509.ECDSAWithSHA256)
tests := map[string]struct {
givenCASecret *corev1.Secret
givenCAIssuer cmapi.GenericIssuer
givenCR *cmapi.CertificateRequest
assertSignedCert func(t *testing.T, got *x509.Certificate)
wantErr string
}{
"when the CertificateRequest has the duration field set, it should appear as notAfter on the signed ca": {
givenCASecret: gen.SecretFrom(gen.Secret("secret-1"), gen.SetSecretNamespace("default"), gen.SetSecretData(secretDataFor(t, rootPK, rootCert))),
givenCAIssuer: gen.Issuer("issuer-1", gen.SetIssuerCA(cmapi.CAIssuer{
SecretName: "secret-1",
})),
givenCR: gen.CertificateRequest("cr-1",
gen.SetCertificateRequestCSR(testCSR),
gen.SetCertificateRequestIssuer(cmmeta.ObjectReference{
Name: "issuer-1",
Group: certmanager.GroupName,
Kind: "Issuer",
}),
gen.SetCertificateRequestDuration(&metav1.Duration{
Duration: 30 * time.Minute,
}),
),
assertSignedCert: func(t *testing.T, got *x509.Certificate) {
// Although there is less than 1µs between the time.Now
// call made by the certificate template func (in the "pki"
// package) and the time.Now below, rounding or truncating
// will always end up with a flaky test. This is due to the
// rounding made to the notAfter value when serializing the
// certificate to ASN.1 [1].
//
// [1]: https://tools.ietf.org/html/rfc5280#section-4.1.2.5.1
//
// So instead of using a truncation or rounding in order to
// check the time, we use a delta of 1 second. One entire
// second is totally overkill since, as detailed above, the
// delay is probably less than a microsecond. But that will
// do for now!
//
// Note that we do have a plan to fix this. We want to be
// injecting a time (instead of time.Now) to the template
// functions. This work is being tracked in this issue:
// https://github.com/cert-manager/cert-manager/issues/3738
expectNotAfter := time.Now().UTC().Add(30 * time.Minute)
deltaSec := math.Abs(expectNotAfter.Sub(got.NotAfter).Seconds())
assert.LessOrEqualf(t, deltaSec, 1., "expected a time delta lower than 1 second. Time expected='%s', got='%s'", expectNotAfter.String(), got.NotAfter.String())
},
},
"when the CertificateRequest has the isCA field set, it should appear on the signed ca": {
givenCASecret: gen.SecretFrom(gen.Secret("secret-1"), gen.SetSecretNamespace("default"), gen.SetSecretData(secretDataFor(t, rootPK, rootCert))),
givenCAIssuer: gen.Issuer("issuer-1", gen.SetIssuerCA(cmapi.CAIssuer{
SecretName: "secret-1",
})),
givenCR: gen.CertificateRequest("cr-1",
gen.SetCertificateRequestCSR(testCSR),
gen.SetCertificateRequestIssuer(cmmeta.ObjectReference{
Name: "issuer-1",
Group: certmanager.GroupName,
Kind: "Issuer",
}),
gen.SetCertificateRequestIsCA(true),
),
assertSignedCert: func(t *testing.T, got *x509.Certificate) {
assert.Equal(t, true, got.IsCA)
},
},
"when the Issuer has ocspServers set, it should appear on the signed ca": {
givenCASecret: gen.SecretFrom(gen.Secret("secret-1"), gen.SetSecretNamespace("default"), gen.SetSecretData(secretDataFor(t, rootPK, rootCert))),
givenCAIssuer: gen.Issuer("issuer-1", gen.SetIssuerCA(cmapi.CAIssuer{
SecretName: "secret-1",
OCSPServers: []string{"http://ocsp-v3.example.org"},
})),
givenCR: gen.CertificateRequest("cr-1",
gen.SetCertificateRequestCSR(testCSR),
gen.SetCertificateRequestIssuer(cmmeta.ObjectReference{
Name: "issuer-1",
Group: certmanager.GroupName,
Kind: "Issuer",
}),
),
assertSignedCert: func(t *testing.T, got *x509.Certificate) {
assert.Equal(t, []string{"http://ocsp-v3.example.org"}, got.OCSPServer)
},
},
"when the Issuer has crlDistributionPoints set, it should appear on the signed ca ": {
givenCASecret: gen.SecretFrom(gen.Secret("secret-1"), gen.SetSecretNamespace("default"), gen.SetSecretData(secretDataFor(t, rootPK, rootCert))),
givenCAIssuer: gen.Issuer("issuer-1", gen.SetIssuerCA(cmapi.CAIssuer{
SecretName: "secret-1",
CRLDistributionPoints: []string{"http://www.example.com/crl/test.crl"},
})),
givenCR: gen.CertificateRequest("cr-1",
gen.SetCertificateRequestIsCA(true),
gen.SetCertificateRequestCSR(testCSR),
gen.SetCertificateRequestIssuer(cmmeta.ObjectReference{
Name: "issuer-1",
Group: certmanager.GroupName,
Kind: "Issuer",
}),
),
assertSignedCert: func(t *testing.T, gotCA *x509.Certificate) {
assert.Equal(t, []string{"http://www.example.com/crl/test.crl"}, gotCA.CRLDistributionPoints)
},
},
}
for name, test := range tests {
t.Run(name, func(t *testing.T) {
rec := &testpkg.FakeRecorder{}
c := &CA{
issuerOptions: controller.IssuerOptions{
ClusterResourceNamespace: "",
ClusterIssuerAmbientCredentials: false,
IssuerAmbientCredentials: false,
},
reporter: util.NewReporter(fixedClock, rec),
secretsLister: testlisters.FakeSecretListerFrom(testlisters.NewFakeSecretLister(),
testlisters.SetFakeSecretNamespaceListerGet(test.givenCASecret, nil),
),
templateGenerator: pki.GenerateTemplateFromCertificateRequest,
signingFn: pki.SignCSRTemplate,
}
gotIssueResp, gotErr := c.Sign(context.Background(), test.givenCR, test.givenCAIssuer)
if test.wantErr != "" {
require.EqualError(t, gotErr, test.wantErr)
} else {
require.NoError(t, gotErr)
require.NotNil(t, gotIssueResp)
gotCert, err := pki.DecodeX509CertificateBytes(gotIssueResp.Certificate)
require.NoError(t, err)
test.assertSignedCert(t, gotCert)
}
})
}
} | explode_data.jsonl/64412 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 2478
} | [
2830,
3393,
5049,
1098,
622,
1155,
353,
8840,
836,
8,
341,
33698,
22242,
11,
1848,
1669,
281,
6642,
57582,
7498,
75981,
7,
17,
20,
21,
340,
743,
1848,
961,
2092,
341,
197,
3244,
26133,
3964,
340,
197,
532,
33698,
36934,
11,
716,
166... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestCSPerChannelLimits(t *testing.T) {
for _, st := range testStores {
st := st
t.Run(st.name, func(t *testing.T) {
t.Parallel()
defer endTest(t, st)
s := startTest(t, st)
defer s.Close()
storeLimits := &StoreLimits{MaxChannels: 10}
storeLimits.MaxSubscriptions = 10
storeLimits.MaxMsgs = 100
storeLimits.MaxBytes = 100 * 1024
fooLimits := ChannelLimits{
MsgStoreLimits{
MaxMsgs: 3,
MaxBytes: 3 * 1024,
},
SubStoreLimits{
MaxSubscriptions: 1,
},
0,
}
barLimits := ChannelLimits{
MsgStoreLimits{
MaxMsgs: 5,
MaxBytes: 5 * 1024,
},
SubStoreLimits{
MaxSubscriptions: 2,
},
0,
}
noSubsOverrideLimits := ChannelLimits{
MsgStoreLimits{
MaxMsgs: 6,
MaxBytes: 6 * 1024,
},
SubStoreLimits{},
0,
}
noMaxMsgOverrideLimits := ChannelLimits{
MsgStoreLimits{
MaxBytes: 7 * 1024,
},
SubStoreLimits{},
0,
}
noMaxBytesOverrideLimits := ChannelLimits{
MsgStoreLimits{
MaxMsgs: 10,
},
SubStoreLimits{},
0,
}
storeLimits.AddPerChannel("foo", &fooLimits)
storeLimits.AddPerChannel("bar", &barLimits)
storeLimits.AddPerChannel("baz", &noSubsOverrideLimits)
storeLimits.AddPerChannel("abc", &noMaxMsgOverrideLimits)
storeLimits.AddPerChannel("def", &noMaxBytesOverrideLimits)
if err := s.SetLimits(storeLimits); err != nil {
t.Fatalf("Unexpected error setting limits: %v", err)
}
checkLimitsForChannel := func(channelName string, maxMsgs, maxSubs int) {
cs := storeCreateChannel(t, s, channelName)
for i := 0; i < maxMsgs+10; i++ {
storeMsg(t, cs, channelName, uint64(i+1), []byte("hello"))
}
if n, _ := msgStoreState(t, cs.Msgs); n != maxMsgs {
stackFatalf(t, "Expected %v messages, got %v", maxMsgs, n)
}
for i := 0; i < maxSubs+1; i++ {
err := cs.Subs.CreateSub(&spb.SubState{})
if i < maxSubs && err != nil {
stackFatalf(t, "Unexpected error on create sub: %v", err)
} else if i == maxSubs && err == nil {
stackFatalf(t, "Expected error on createSub, did not get one")
}
}
}
checkLimitsForChannel("foo", fooLimits.MaxMsgs, fooLimits.MaxSubscriptions)
checkLimitsForChannel("bar", barLimits.MaxMsgs, barLimits.MaxSubscriptions)
checkLimitsForChannel("baz", noSubsOverrideLimits.MaxMsgs, storeLimits.MaxSubscriptions)
checkLimitsForChannel("abc", storeLimits.MaxMsgs, storeLimits.MaxSubscriptions)
checkLimitsForChannel("def", noMaxBytesOverrideLimits.MaxMsgs, storeLimits.MaxSubscriptions)
checkLimitsForChannel("global", storeLimits.MaxMsgs, storeLimits.MaxSubscriptions)
})
}
} | explode_data.jsonl/28300 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 1215
} | [
2830,
3393,
6412,
3889,
9629,
94588,
1155,
353,
8840,
836,
8,
341,
2023,
8358,
357,
1669,
2088,
1273,
69026,
341,
197,
18388,
1669,
357,
198,
197,
3244,
16708,
5895,
2644,
11,
2915,
1155,
353,
8840,
836,
8,
341,
298,
3244,
41288,
7957... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestParse1(t *testing.T) {
querys := []string{
"insert into t1(a,b)values(1,3)",
"insert into t1 values",
"insert into t1 FORMAT xx",
}
for _, query := range querys {
_, err := Parse(query)
assert.Nil(t, err)
}
} | explode_data.jsonl/44458 | {
"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,
14463,
16,
1155,
353,
8840,
836,
8,
341,
27274,
82,
1669,
3056,
917,
515,
197,
197,
1,
4208,
1119,
259,
16,
2877,
8402,
8,
3661,
7,
16,
11,
18,
15752,
197,
197,
1,
4208,
1119,
259,
16,
2750,
756,
197,
197,
1,
4208,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestLiveExchange(t *testing.T) {
want, err := internal.Uniq("currencies.txt")
if err != nil {
t.Fatal(err)
}
got, err := LiveExchange().Currencies()
if err != nil {
t.Fatal(err)
}
if diff := cmp.Diff(want, got); diff != "" {
t.Errorf("Supported currencies (live exchange) -> (-) wanted vs. (+) got:\n%s", diff)
}
} | explode_data.jsonl/19275 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 135
} | [
2830,
3393,
20324,
31564,
1155,
353,
8840,
836,
8,
341,
50780,
11,
1848,
1669,
5306,
10616,
23740,
445,
66,
19607,
3909,
1138,
743,
1848,
961,
2092,
341,
197,
3244,
26133,
3964,
340,
197,
630,
3174,
354,
11,
1848,
1669,
11158,
31564,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestNonWorkspaceFileCreation(t *testing.T) {
testenv.NeedsGo1Point(t, 13)
const files = `
-- go.mod --
module mod.com
go 1.12
-- x.go --
package x
`
const code = `
package foo
import "fmt"
var _ = fmt.Printf
`
Run(t, files, func(t *testing.T, env *Env) {
env.CreateBuffer("/tmp/foo.go", "")
env.EditBuffer("/tmp/foo.go", fake.NewEdit(0, 0, 0, 0, code))
env.GoToDefinition("/tmp/foo.go", env.RegexpSearch("/tmp/foo.go", `Printf`))
})
} | explode_data.jsonl/37369 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 199
} | [
2830,
3393,
8121,
45981,
1703,
32701,
1155,
353,
8840,
836,
8,
341,
18185,
3160,
2067,
68,
6767,
10850,
16,
2609,
1155,
11,
220,
16,
18,
692,
4777,
3542,
284,
22074,
313,
728,
10929,
39514,
4352,
1463,
905,
271,
3346,
220,
16,
13,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestTxPoolAdd(t *testing.T) {
tx := GenTxEample(0)
ev := &core.NewTxEvent{
Tx: tx,
}
eventHub.Post(ev)
pending := txPool.Pending()
assert.Equal(t, pending[tx.From], tx)
} | explode_data.jsonl/58592 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 84
} | [
2830,
3393,
31584,
10551,
2212,
1155,
353,
8840,
836,
8,
341,
46237,
1669,
9316,
51,
12606,
1516,
7,
15,
340,
74837,
1669,
609,
2153,
7121,
31584,
1556,
515,
197,
10261,
87,
25,
9854,
345,
197,
532,
28302,
19316,
23442,
32647,
692,
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 |
func TestPushResult(t *testing.T) {
syncher := setupTest(len(failingTestConsts), failingTestConsts)
if syncher.ExpectedNumOfResults != len(failingTestConsts) {
t.Errorf("Expected number of stored results in object:%d does not match with the initalized value:%d", syncher.ExpectedNumOfResults, len(failingTestConsts))
}
if len(syncher.CniResults) != len(failingTestConsts) {
t.Errorf("Number of stored results in object:%d does not match with the number we have pushed:%d", len(syncher.CniResults), len(failingTestConsts))
}
for index, result := range failingTestConsts {
t.Run(result.cniName, func(t *testing.T) {
if syncher.CniResults[index].CniName != result.cniName {
t.Errorf("CNI name attribute stored inside object:%s does not match with expected:%s", syncher.CniResults[index].CniName, result.cniName)
}
if syncher.CniResults[index].OpResult != result.opRes {
t.Errorf("Operation result attribute stored inside object:%v does not match with expected:%v", syncher.CniResults[index].OpResult, result.opRes)
}
if syncher.CniResults[index].CniResult != result.cniRes {
t.Errorf("CNI operation result attribute stored inside object does not match with expected")
}
if syncher.CniResults[index].IfName != result.ifName {
t.Errorf("Created interface name attribute stored inside object does not match with expected")
}
})
}
} | explode_data.jsonl/69735 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 506
} | [
2830,
3393,
16644,
2077,
1155,
353,
8840,
836,
8,
341,
220,
6782,
9034,
1669,
6505,
2271,
6901,
955,
14277,
2271,
19167,
82,
701,
21394,
2271,
19167,
82,
340,
220,
421,
6782,
9034,
5121,
4046,
4651,
2124,
9801,
961,
2422,
955,
14277,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestWalker_Walk(t *testing.T) {
dir, err := ioutil.TempDir(os.TempDir(), "")
assert.NoError(t, err)
defer os.RemoveAll(dir)
assert.DirExists(t, dir)
for i := 0; i < 10; i++ {
var newDir string
if i%2 == 0 {
newDir = filepath.Join(dir, strconv.Itoa(i))
} else {
newDir = filepath.Join(dir, ".git")
}
assert.NoError(t, os.MkdirAll(newDir, 0777))
filename := filepath.Join(newDir, ".foo")
file, err := os.Create(filename)
assert.NoError(t, err)
assert.NoError(t, file.Close())
}
err = Walk(dir, func(p string, typ os.FileMode) error {
assert.False(t, isDotGit(p), "path should not be returned in walk: %s", p)
return nil
})
assert.NoError(t, err)
} | explode_data.jsonl/63955 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 302
} | [
2830,
3393,
84892,
2763,
1692,
1155,
353,
8840,
836,
8,
341,
48532,
11,
1848,
1669,
43144,
65009,
6184,
9638,
65009,
6184,
1507,
14676,
6948,
35699,
1155,
11,
1848,
340,
16867,
2643,
84427,
14161,
340,
6948,
83757,
15575,
1155,
11,
5419,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestRequest(t *testing.T) {
// request
url := "http://x.x.x.x"
r := NewRequest(DefaultConfig)
r.Get(url, nil)
r.Get(url, map[string]string{"a": "1", "b": "2"})
r.Post(url, map[string]interface{}{"a": "1", "b": "2"})
r.PostForm(url, map[string]string{"a": "1", "b": "2"})
r.Put(url, map[string]interface{}{"a": "1", "b": "2"})
r.Delete(url)
// session
loginUrl := "http://x.x.x.x/login"
s := NewSession(DefaultConfig)
s.Post(loginUrl, map[string]interface{}{"user": "username", "password": "password"})
s.Get(url, nil)
s.Get(url, map[string]string{"a": "1", "b": "2"})
s.Post(url, map[string]interface{}{"a": "1", "b": "2"})
s.PostForm(url, map[string]string{"a": "1", "b": "2"})
s.Put(url, map[string]interface{}{"a": "1", "b": "2"})
s.Delete(url)
} | explode_data.jsonl/76993 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 357
} | [
2830,
3393,
1900,
1155,
353,
8840,
836,
8,
341,
197,
322,
1681,
198,
19320,
1669,
330,
1254,
1110,
87,
1993,
1993,
1993,
698,
7000,
1669,
1532,
1900,
87874,
2648,
340,
7000,
2234,
6522,
11,
2092,
340,
7000,
2234,
6522,
11,
2415,
14032... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestGetConfigCurrencyPairFormat(t *testing.T) {
cfg := GetConfig()
err := cfg.LoadConfig(ConfigTestFile)
if err != nil {
t.Errorf(
"Test failed. TestGetConfigCurrencyPairFormat. LoadConfig Error: %s", err.Error(),
)
}
_, err = cfg.GetConfigCurrencyPairFormat("asdasdasd")
if err == nil {
t.Errorf(
"Test failed. TestGetRequestCurrencyPairFormat. Non-existent exchange returned nil error",
)
}
exchFmt, err := cfg.GetConfigCurrencyPairFormat("Liqui")
if !exchFmt.Uppercase || exchFmt.Delimiter != "_" {
t.Errorf(
"Test failed. TestGetConfigCurrencyPairFormat. Invalid values",
)
}
} | explode_data.jsonl/21894 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 244
} | [
2830,
3393,
1949,
2648,
26321,
12443,
4061,
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,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestInvalidType_Bool(t *testing.T) {
var testVar bool = true
err := Scrub(testVar, []string{"owner"})
assert.Error(t, err)
err = Scrub(&testVar, []string{"owner"})
assert.Error(t, err)
} | explode_data.jsonl/9428 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 78
} | [
2830,
3393,
7928,
929,
79948,
1155,
353,
8840,
836,
8,
1476,
2405,
1273,
3962,
1807,
284,
830,
198,
9859,
1669,
32134,
392,
8623,
3962,
11,
3056,
917,
4913,
8118,
23625,
6948,
6141,
1155,
11,
1848,
340,
9859,
284,
32134,
392,
2099,
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 |
func TestConnectionStore_ForAllConnectionsDo(t *testing.T) {
ctrl := gomock.NewController(t)
defer ctrl.Finish()
// Create two flows; one is already in ConnectionStore and other one is new
testFlows := make([]*flowexporter.Connection, 2)
testFlowKeys := make([]*flowexporter.ConnectionKey, 2)
refTime := time.Now()
// Flow-1, which is already in ConnectionStore
tuple1, revTuple1 := makeTuple(&net.IP{1, 2, 3, 4}, &net.IP{4, 3, 2, 1}, 6, 65280, 255)
testFlows[0] = &flowexporter.Connection{
StartTime: refTime.Add(-(time.Second * 50)),
StopTime: refTime,
OriginalPackets: 0xffff,
OriginalBytes: 0xbaaaaa0000000000,
ReversePackets: 0xff,
ReverseBytes: 0xbaaa,
TupleOrig: tuple1,
TupleReply: revTuple1,
IsActive: true,
}
// Flow-2, which is not in ConnectionStore
tuple2, revTuple2 := makeTuple(&net.IP{5, 6, 7, 8}, &net.IP{8, 7, 6, 5}, 6, 60001, 200)
testFlows[1] = &flowexporter.Connection{
StartTime: refTime.Add(-(time.Second * 20)),
StopTime: refTime,
OriginalPackets: 0xbb,
OriginalBytes: 0xcbbb,
ReversePackets: 0xbbbb,
ReverseBytes: 0xcbbbb0000000000,
TupleOrig: tuple2,
TupleReply: revTuple2,
IsActive: true,
}
for i, flow := range testFlows {
connKey := flowexporter.NewConnectionKey(flow)
testFlowKeys[i] = &connKey
}
// Create ConnectionStore
mockIfaceStore := interfacestoretest.NewMockInterfaceStore(ctrl)
mockConnDumper := connectionstest.NewMockConnTrackDumper(ctrl)
connStore := NewConnectionStore(mockConnDumper, mockIfaceStore, nil, nil, testPollInterval)
// Add flows to the Connection store
for i, flow := range testFlows {
connStore.connections[*testFlowKeys[i]] = *flow
}
resetTwoFields := func(key flowexporter.ConnectionKey, conn flowexporter.Connection) error {
conn.IsActive = false
conn.OriginalPackets = 0
connStore.connections[key] = conn
return nil
}
connStore.ForAllConnectionsDo(resetTwoFields)
// Check isActive and OriginalPackets, if they are reset or not.
for i := 0; i < len(testFlows); i++ {
conn, ok := connStore.GetConnByKey(*testFlowKeys[i])
assert.Equal(t, ok, true, "connection should be there in connection store")
assert.Equal(t, conn.IsActive, false, "isActive flag should be reset")
assert.Equal(t, conn.OriginalPackets, uint64(0), "OriginalPackets should be reset")
}
} | explode_data.jsonl/26095 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 938
} | [
2830,
3393,
4526,
6093,
84368,
2403,
54751,
5404,
1155,
353,
8840,
836,
8,
341,
84381,
1669,
342,
316,
1176,
7121,
2051,
1155,
340,
16867,
23743,
991,
18176,
741,
197,
322,
4230,
1378,
27455,
26,
825,
374,
2669,
304,
11032,
6093,
323,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestHookEvents(t *testing.T) {
tests := []struct {
in scm.HookEvents
out []string
}{
{
in: scm.HookEvents{Push: true},
out: []string{"push"},
},
{
in: scm.HookEvents{Branch: true},
out: []string{"create", "delete"},
},
{
in: scm.HookEvents{IssueComment: true},
out: []string{"issue_comment"},
},
{
in: scm.HookEvents{PullRequestComment: true},
out: []string{"pull_request_review_comment", "issue_comment"},
},
{
in: scm.HookEvents{Issue: true},
out: []string{"issues"},
},
{
in: scm.HookEvents{PullRequest: true},
out: []string{"pull_request"},
},
{
in: scm.HookEvents{
Branch: true,
Issue: true,
IssueComment: true,
PullRequest: true,
PullRequestComment: true,
Push: true,
ReviewComment: true,
Tag: true,
},
out: []string{"push", "pull_request", "pull_request_review_comment", "issues", "issue_comment", "create", "delete"},
},
}
for i, test := range tests {
got, want := convertHookEvents(test.in), test.out
if diff := cmp.Diff(got, want); diff != "" {
t.Errorf("Unexpected Results at index %d", i)
t.Log(diff)
}
}
} | explode_data.jsonl/29879 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 589
} | [
2830,
3393,
31679,
7900,
1155,
353,
8840,
836,
8,
341,
78216,
1669,
3056,
1235,
341,
197,
17430,
220,
85520,
3839,
1941,
7900,
198,
197,
13967,
3056,
917,
198,
197,
59403,
197,
197,
515,
298,
17430,
25,
220,
85520,
3839,
1941,
7900,
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 TestServer_HandlerWriteErrorOnDisconnect(t *testing.T) {
errc := make(chan error, 1)
testServerResponse(t, func(w http.ResponseWriter, r *http.Request) error {
p := []byte("some data.\n")
for {
_, err := w.Write(p)
if err != nil {
errc <- err
return nil
}
}
}, func(st *serverTester) {
st.writeHeaders(HeadersFrameParam{
StreamID: 1,
BlockFragment: st.encodeHeader(),
EndStream: false,
EndHeaders: true,
})
hf := st.wantHeaders()
if hf.StreamEnded() {
t.Fatal("unexpected END_STREAM flag")
}
if !hf.HeadersEnded() {
t.Fatal("want END_HEADERS flag")
}
// Close the connection and wait for the handler to (hopefully) notice.
st.cc.Close()
select {
case <-errc:
case <-time.After(5 * time.Second):
t.Error("timeout")
}
})
} | explode_data.jsonl/71674 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 359
} | [
2830,
3393,
5475,
41879,
7985,
1454,
1925,
60651,
1155,
353,
8840,
836,
8,
341,
9859,
66,
1669,
1281,
35190,
1465,
11,
220,
16,
340,
18185,
5475,
2582,
1155,
11,
2915,
3622,
1758,
37508,
11,
435,
353,
1254,
9659,
8,
1465,
341,
197,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
func TestWindowsServiceLoop(t *testing.T) {
npdo, cleanup := setupNPD(t)
defer cleanup()
setupLogging(false)
s := &npdService{
options: npdo,
}
r := make(chan svc.ChangeRequest, 2)
changes := make(chan svc.Status, 4)
defer func() {
close(r)
close(changes)
}()
r <- svc.ChangeRequest{
Cmd: svc.Shutdown,
}
r <- svc.ChangeRequest{
Cmd: svc.Shutdown,
}
ssec, errno := s.Execute([]string{}, r, changes)
if ssec != false {
t.Error("ssec should be false")
}
if errno != 0 {
t.Error("errno should be 0")
}
} | explode_data.jsonl/66302 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 233
} | [
2830,
3393,
13164,
1860,
14620,
1155,
353,
8840,
836,
8,
341,
197,
6199,
2982,
11,
21290,
1669,
6505,
45,
23025,
1155,
340,
16867,
21290,
2822,
84571,
34575,
3576,
692,
1903,
1669,
609,
6199,
67,
1860,
515,
197,
35500,
25,
2595,
2982,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestCrossAgentAttributes(t *testing.T) {
var tcs []json.RawMessage
err := crossagent.ReadJSON("attribute_configuration.json", &tcs)
if err != nil {
t.Fatal(err)
}
for _, tc := range tcs {
runAttributeTestcase(t, tc)
}
} | explode_data.jsonl/20594 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 92
} | [
2830,
3393,
28501,
16810,
10516,
1155,
353,
8840,
836,
8,
341,
2405,
259,
4837,
3056,
2236,
50575,
2052,
271,
9859,
1669,
5312,
8092,
6503,
5370,
445,
9116,
35726,
4323,
497,
609,
83,
4837,
340,
743,
1848,
961,
2092,
341,
197,
3244,
2... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
func TestXYEq(t *testing.T) {
assert.True(t, xy{}.eq(xy{}))
assert.True(t, xy{1, 2}.eq(xy{1, 2}))
assert.False(t, xy{1, 2}.eq(xy{3, 4}))
} | explode_data.jsonl/45330 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 81
} | [
2830,
3393,
16356,
27312,
1155,
353,
8840,
836,
8,
341,
6948,
32443,
1155,
11,
30784,
46391,
11006,
93219,
6257,
1171,
6948,
32443,
1155,
11,
30784,
90,
16,
11,
220,
17,
7810,
11006,
93219,
90,
16,
11,
220,
17,
44194,
6948,
50757,
115... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestGetSystemError(t *testing.T) {
tests := []struct {
giveErr error
wantCode tchannel.SystemErrCode
}{
{
giveErr: yarpcerrors.UnavailableErrorf("test"),
wantCode: tchannel.ErrCodeDeclined,
},
{
giveErr: errors.New("test"),
wantCode: tchannel.ErrCodeUnexpected,
},
{
giveErr: yarpcerrors.InvalidArgumentErrorf("test"),
wantCode: tchannel.ErrCodeBadRequest,
},
{
giveErr: tchannel.NewSystemError(tchannel.ErrCodeBusy, "test"),
wantCode: tchannel.ErrCodeBusy,
},
{
giveErr: yarpcerrors.Newf(yarpcerrors.Code(1235), "test"),
wantCode: tchannel.ErrCodeUnexpected,
},
}
for i, tt := range tests {
t.Run(string(i), func(t *testing.T) {
gotErr := getSystemError(tt.giveErr)
tchErr, ok := gotErr.(tchannel.SystemError)
require.True(t, ok, "did not return tchannel error")
assert.Equal(t, tt.wantCode, tchErr.Code())
})
}
} | explode_data.jsonl/53842 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 404
} | [
2830,
3393,
1949,
2320,
1454,
1155,
353,
8840,
836,
8,
341,
78216,
1669,
3056,
1235,
341,
197,
3174,
533,
7747,
220,
1465,
198,
197,
50780,
2078,
259,
10119,
16620,
7747,
2078,
198,
197,
59403,
197,
197,
515,
298,
3174,
533,
7747,
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 TestParseVolumeAnonymousVolumeWindows(t *testing.T) {
for _, path := range []string{"C:\\path", "Z:\\path\\foo"} {
volume, err := parseVolume(path)
expected := types.ServiceVolumeConfig{Type: "volume", Target: path}
assert.NoError(t, err)
assert.Equal(t, expected, volume)
}
} | explode_data.jsonl/70093 | {
"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,
14463,
18902,
32684,
18902,
13164,
1155,
353,
8840,
836,
8,
341,
2023,
8358,
1815,
1669,
2088,
3056,
917,
4913,
34,
23817,
2343,
497,
330,
57,
23817,
2343,
3422,
7975,
9207,
341,
197,
5195,
4661,
11,
1848,
1669,
4715,
18902,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestPublishFunc(t *testing.T) {
var gotname string
var gotv expvarFunc
clear()
Register(func(name string, v expvar.Var) {
gotname = name
gotv = v.(expvarFunc)
})
publish("Myfunc", expvarFunc(f))
if gotname != "Myfunc" {
t.Errorf("want Myfunc, got %s", gotname)
}
if gotv.String() != f() {
t.Errorf("want %v, got %#v", f(), gotv())
}
} | explode_data.jsonl/43070 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 159
} | [
2830,
3393,
50145,
9626,
1155,
353,
8840,
836,
8,
341,
2405,
2684,
606,
914,
198,
2405,
2684,
85,
1343,
947,
9626,
198,
40408,
741,
79096,
18552,
3153,
914,
11,
348,
1343,
947,
87968,
8,
341,
197,
3174,
354,
606,
284,
829,
198,
197,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func Test_fetchAndImportFiles(t *testing.T) {
index, _ := parseRepoIndex([]byte(validRepoIndexYAML))
repo := &models.RepoInternal{Name: "test", Namespace: "repo-namespace", URL: "http://testrepo.com"}
charts := chartsFromIndex(index, &models.Repo{Name: repo.Name, Namespace: repo.Namespace, URL: repo.URL})
cv := charts[0].ChartVersions[0]
t.Run("http error", func(t *testing.T) {
m := mock.Mock{}
m.On("One", mock.Anything).Return(errors.New("return an error when checking if readme already exists to force fetching"))
netClient = &badHTTPClient{}
manager := getMockManager(&m)
fImporter := fileImporter{manager}
assert.Err(t, io.EOF, fImporter.fetchAndImportFiles(charts[0].Name, repo, cv))
})
t.Run("file not found", func(t *testing.T) {
netClient = &goodTarballClient{c: charts[0], skipValues: true, skipReadme: true, skipSchema: true}
m := mock.Mock{}
m.On("One", mock.Anything).Return(errors.New("return an error when checking if files already exists to force fetching"))
chartFilesID := fmt.Sprintf("%s/%s-%s", charts[0].Repo.Name, charts[0].Name, cv.Version)
m.On("Upsert", bson.M{"file_id": chartFilesID, "repo.name": repo.Name, "repo.namespace": repo.Namespace}, models.ChartFiles{
ID: chartFilesID,
Readme: "",
Values: "",
Schema: "",
Repo: charts[0].Repo,
Digest: cv.Digest,
})
manager := getMockManager(&m)
fImporter := fileImporter{manager}
err := fImporter.fetchAndImportFiles(charts[0].Name, repo, cv)
assert.NoErr(t, err)
m.AssertExpectations(t)
})
t.Run("authenticated request", func(t *testing.T) {
netClient = &authenticatedTarballClient{c: charts[0]}
m := mock.Mock{}
m.On("One", mock.Anything).Return(errors.New("return an error when checking if files already exists to force fetching"))
chartFilesID := fmt.Sprintf("%s/%s-%s", charts[0].Repo.Name, charts[0].Name, cv.Version)
m.On("Upsert", bson.M{"file_id": chartFilesID, "repo.name": repo.Name, "repo.namespace": repo.Namespace}, models.ChartFiles{
ID: chartFilesID,
Readme: testChartReadme,
Values: testChartValues,
Schema: testChartSchema,
Repo: charts[0].Repo,
Digest: cv.Digest,
})
manager := getMockManager(&m)
fImporter := fileImporter{manager}
r := &models.RepoInternal{Name: repo.Name, Namespace: repo.Namespace, URL: repo.URL, AuthorizationHeader: "Bearer ThisSecretAccessTokenAuthenticatesTheClient"}
err := fImporter.fetchAndImportFiles(charts[0].Name, r, cv)
assert.NoErr(t, err)
m.AssertExpectations(t)
})
t.Run("valid tarball", func(t *testing.T) {
netClient = &goodTarballClient{c: charts[0]}
m := mock.Mock{}
m.On("One", mock.Anything).Return(errors.New("return an error when checking if files already exists to force fetching"))
chartFilesID := fmt.Sprintf("%s/%s-%s", charts[0].Repo.Name, charts[0].Name, cv.Version)
m.On("Upsert", bson.M{"file_id": chartFilesID, "repo.name": repo.Name, "repo.namespace": repo.Namespace}, models.ChartFiles{
ID: chartFilesID,
Readme: testChartReadme,
Values: testChartValues,
Schema: testChartSchema,
Repo: charts[0].Repo,
Digest: cv.Digest,
})
manager := getMockManager(&m)
fImporter := fileImporter{manager}
err := fImporter.fetchAndImportFiles(charts[0].Name, repo, cv)
assert.NoErr(t, err)
m.AssertExpectations(t)
})
t.Run("file exists", func(t *testing.T) {
m := mock.Mock{}
// don't return an error when checking if files already exists
m.On("One", mock.Anything).Return(nil)
manager := getMockManager(&m)
fImporter := fileImporter{manager}
err := fImporter.fetchAndImportFiles(charts[0].Name, repo, cv)
assert.NoErr(t, err)
m.AssertNotCalled(t, "UpsertId", mock.Anything, mock.Anything)
})
} | explode_data.jsonl/67810 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 1486
} | [
2830,
3393,
11803,
3036,
11511,
10809,
1155,
353,
8840,
836,
8,
341,
26327,
11,
716,
1669,
4715,
25243,
1552,
10556,
3782,
41529,
25243,
1552,
56,
31102,
1171,
17200,
5368,
1669,
609,
6507,
2817,
5368,
11569,
63121,
25,
330,
1944,
497,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func Test_FullLoggerNameGenerator_regularCases(t *testing.T) {
assert.ToBeEqual(t, "testing.T", FullLoggerNameGenerator(t))
assert.ToBeEqual(t, "github.com/echocat/slf4g/names.someStruct", FullLoggerNameGenerator(&someStruct{}))
assert.ToBeEqual(t, "github.com/echocat/slf4g/names.someStruct", FullLoggerNameGenerator(someStruct{}))
assert.ToBeEqual(t, "github.com/echocat/slf4g/names.someStruct", FullLoggerNameGenerator((*someStruct)(nil)))
assert.ToBeEqual(t, "github.com/echocat/slf4g/fields.empty", FullLoggerNameGenerator(fields.Empty()))
} | explode_data.jsonl/57923 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 216
} | [
2830,
3393,
1400,
617,
7395,
675,
12561,
49443,
37302,
1155,
353,
8840,
836,
8,
341,
6948,
3274,
3430,
2993,
1155,
11,
330,
8840,
836,
497,
8627,
7395,
675,
12561,
1155,
1171,
6948,
3274,
3430,
2993,
1155,
11,
330,
5204,
905,
14,
4737... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestValidateJob_VRF_Happy(t *testing.T) {
t.Parallel()
store, cleanup := cltest.NewStore(t)
defer cleanup()
input := cltest.MustReadFile(t, "testdata/randomness_job.json")
var j models.JobSpec
assert.NoError(t, json.Unmarshal(input, &j))
err := services.ValidateJob(j, store)
assert.NoError(t, err)
} | explode_data.jsonl/75338 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 125
} | [
2830,
3393,
17926,
12245,
2334,
17612,
2039,
11144,
1155,
353,
8840,
836,
8,
341,
3244,
41288,
7957,
2822,
57279,
11,
21290,
1669,
1185,
1944,
7121,
6093,
1155,
340,
16867,
21290,
2822,
22427,
1669,
1185,
1944,
50463,
4418,
1703,
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 TestValidate_NoCircularFragmentSpreads_NoSpreadingItselfDeeplyAndImmediately(t *testing.T) {
testutil.ExpectFailsRule(t, graphql.NoFragmentCyclesRule, `
fragment fragA on Dog { ...fragB }
fragment fragB on Dog { ...fragB, ...fragC }
fragment fragC on Dog { ...fragA, ...fragB }
`, []gqlerrors.FormattedError{
testutil.RuleError(`Cannot spread fragment "fragB" within itself.`, 3, 31),
testutil.RuleError(`Cannot spread fragment "fragA" within itself via fragB, fragC.`,
2, 31,
3, 41,
4, 31),
testutil.RuleError(`Cannot spread fragment "fragB" within itself via fragC.`,
3, 41,
4, 41),
})
} | explode_data.jsonl/30378 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 259
} | [
2830,
3393,
17926,
36989,
82440,
9488,
6406,
30358,
36989,
6406,
6154,
2132,
721,
33464,
398,
3036,
95693,
1155,
353,
8840,
836,
8,
341,
18185,
1314,
81893,
37,
6209,
11337,
1155,
11,
48865,
16766,
9488,
34,
15805,
11337,
11,
22074,
414,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestMultiSiteResource(t *testing.T) {
t.Parallel()
assert := require.New(t)
b := newMultiSiteTestDefaultBuilder(t)
b.CreateSites().Build(BuildCfg{})
// This build is multilingual, but not multihost. There should be only one pipes.txt
b.AssertFileContent("public/fr/index.html", "French Home Page", "String Resource: /blog/text/pipes.txt")
assert.False(b.CheckExists("public/fr/text/pipes.txt"))
assert.False(b.CheckExists("public/en/text/pipes.txt"))
b.AssertFileContent("public/en/index.html", "Default Home Page", "String Resource: /blog/text/pipes.txt")
b.AssertFileContent("public/text/pipes.txt", "Hugo Pipes")
} | explode_data.jsonl/79724 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 226
} | [
2830,
3393,
20358,
17597,
4783,
1155,
353,
8840,
836,
8,
341,
3244,
41288,
7957,
741,
6948,
1669,
1373,
7121,
1155,
692,
2233,
1669,
501,
20358,
17597,
2271,
3675,
3297,
1155,
692,
2233,
7251,
93690,
1005,
11066,
19184,
42467,
6257,
692,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestSubscriptionOptionsDatabaseSerialization(t *testing.T) {
firstEvent := SubOptsFirstEventNewest
readAhead := uint16(50)
yes := true
sub1 := &Subscription{
Options: SubscriptionOptions{
SubscriptionCoreOptions: SubscriptionCoreOptions{
FirstEvent: &firstEvent,
ReadAhead: &readAhead,
WithData: &yes,
},
},
}
sub1.Options.TransportOptions()["my-nested-opts"] = map[string]interface{}{
"myopt1": 12345,
"myopt2": "test",
}
// Verify it serializes as bytes to the database
b1, err := sub1.Options.Value()
assert.NoError(t, err)
assert.Equal(t, `{"firstEvent":"newest","my-nested-opts":{"myopt1":12345,"myopt2":"test"},"readAhead":50,"withData":true}`, string(b1.([]byte)))
// Verify it restores ok
sub2 := &Subscription{}
err = sub2.Options.Scan(b1)
assert.NoError(t, err)
b2, err := sub1.Options.Value()
assert.NoError(t, err)
assert.Equal(t, SubOptsFirstEventNewest, *sub2.Options.FirstEvent)
assert.Equal(t, uint16(50), *sub2.Options.ReadAhead)
assert.Equal(t, string(b1.([]byte)), string(b2.([]byte)))
// Confirm we don't pass core options, to transports
assert.Nil(t, sub2.Options.TransportOptions()["withData"])
assert.Nil(t, sub2.Options.TransportOptions()["firstEvent"])
assert.Nil(t, sub2.Options.TransportOptions()["readAhead"])
// Confirm we get back the transport options
assert.Equal(t, float64(12345), sub2.Options.TransportOptions().GetObject("my-nested-opts")["myopt1"])
assert.Equal(t, "test", sub2.Options.TransportOptions().GetObject("my-nested-opts")["myopt2"])
// Verify it can also scan as a string
err = sub2.Options.Scan(string(b1.([]byte)))
assert.NoError(t, err)
// Out of luck with anything else
err = sub2.Options.Scan(false)
assert.Regexp(t, "FF10125", err)
} | explode_data.jsonl/33951 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 675
} | [
2830,
3393,
33402,
3798,
5988,
35865,
1155,
353,
8840,
836,
8,
1476,
42190,
1556,
1669,
3719,
43451,
5338,
1556,
3564,
477,
198,
37043,
87962,
1669,
2622,
16,
21,
7,
20,
15,
340,
197,
9693,
1669,
830,
198,
28624,
16,
1669,
609,
33402,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestConfigMerger(t *testing.T) {
tests := []struct {
name string
input func() ([]byte, error)
output string
}{
{
name: "Merger should accept several configs and return a single merged config",
input: func() ([]byte, error) {
b1 := &ConsoleServerCLIConfigBuilder{}
conf1, _ := b1.ConfigYAML()
b2 := &ConsoleServerCLIConfigBuilder{}
conf2, _ := b2.
APIServerURL("https://shizzlepop.com/api").
Host("https://console-openshift-console.apps.shizzlepop.com").
LogoutURL("https://shizzlepop.com/logout").
ConfigYAML()
b3 := &ConsoleServerCLIConfigBuilder{}
b3.
Host("https://console-openshift-console.apps.foobar.com").
LogoutURL("https://foobar.com/logout").
Brand(v1.BrandOKD).
DocURL("https://foobar.com/docs").
APIServerURL("https://foobar.com/api").
StatusPageID("status-12345")
conf3, _ := b3.ConfigYAML()
merger := ConsoleYAMLMerger{}
return merger.Merge(conf1, conf2, conf3)
},
output: `apiVersion: console.openshift.io/v1
auth:
clientID: console
clientSecretFile: /var/oauth-config/clientSecret
logoutRedirect: https://foobar.com/logout
oauthEndpointCAFile: /var/run/secrets/kubernetes.io/serviceaccount/ca.crt
clusterInfo:
consoleBaseAddress: https://console-openshift-console.apps.foobar.com
masterPublicURL: https://foobar.com/api
customization:
branding: okd
documentationBaseURL: https://foobar.com/docs
kind: ConsoleConfig
providers:
statuspageID: status-12345
servingInfo:
bindAddress: https://[::]:8443
certFile: /var/serving-cert/tls.crt
keyFile: /var/serving-cert/tls.key
`,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
input, _ := tt.input()
if diff := deep.Equal(string(input), tt.output); diff != nil {
t.Error(diff)
}
})
}
} | explode_data.jsonl/70523 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 756
} | [
2830,
3393,
2648,
26716,
1389,
1155,
353,
8840,
836,
8,
341,
78216,
1669,
3056,
1235,
341,
197,
11609,
256,
914,
198,
197,
22427,
220,
2915,
368,
34923,
3782,
11,
1465,
340,
197,
21170,
914,
198,
197,
59403,
197,
197,
515,
298,
11609,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestAttrsAppendLDErrorContext(t *testing.T) {
c := setupTest([]string{"append", "attrs", "--host", "orion-ld", "--id", "urn:ngsi-ld:Product:010", "--data", "{\"specialOffer\":{\"value\": true}}", "--context", "[\"http://context\""})
err := attrsAppend(c, c.Ngsi, c.Client)
if assert.Error(t, err) {
ngsiErr := err.(*ngsierr.NgsiError)
assert.Equal(t, 2, ngsiErr.ErrNo)
assert.Equal(t, "unexpected EOF", ngsiErr.Message)
}
} | explode_data.jsonl/33067 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 193
} | [
2830,
3393,
53671,
23877,
43,
1150,
1275,
1972,
1155,
353,
8840,
836,
8,
341,
1444,
1669,
6505,
2271,
10556,
917,
4913,
5090,
497,
330,
20468,
497,
14482,
3790,
497,
330,
269,
290,
12,
507,
497,
14482,
307,
497,
330,
399,
25,
968,
6... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
func TestUpdateExistingKeyValue(t *testing.T) {
key := []byte("foo")
tr := New()
tr.Insert(key, 1)
if tr.Len() != 1 {
t.Fatalf("tree size does not match an expected one. got: %d, expected: %d", tr.Len(), 1)
}
v, found := tr.Get(key)
if !found {
t.Fatalf("failed to get a value from the tree. key: %v", key)
}
n, ok := v.(int)
if !ok {
t.Fatalf("returned value is not 'int' type value. type: %T", v)
}
if n != 1 {
t.Errorf("returned value does not match an expected one. got: %d, expected: %d", n, 1)
}
tr.Insert(key, 2)
if tr.Len() != 1 {
t.Fatalf("tree size does not match an expected one. got: %d, expected: %d", tr.Len(), 1)
}
v, found = tr.Get(key)
if !found {
t.Fatalf("failed to get a value from the tree. key: %v", key)
}
n, ok = v.(int)
if !ok {
t.Fatalf("returned value is not 'int' type value. type: %T", v)
}
if n != 2 {
t.Errorf("returned value does not match an expected one. got: %d, expected: %d", n, 2)
}
} | explode_data.jsonl/45929 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 408
} | [
2830,
3393,
4289,
53067,
72082,
1155,
353,
8840,
836,
8,
341,
23634,
1669,
3056,
3782,
445,
7975,
1138,
25583,
1669,
1532,
741,
25583,
23142,
4857,
11,
220,
16,
340,
743,
489,
65819,
368,
961,
220,
16,
341,
197,
3244,
30762,
445,
9344... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestChangeAllSendersDefaultHostname(t *testing.T) {
senderMetricSampleChan := make(chan senderMetricSample, 10)
serviceCheckChan := make(chan metrics.ServiceCheck, 10)
eventChan := make(chan metrics.Event, 10)
bucketChan := make(chan senderHistogramBucket, 10)
orchestratorChan := make(chan senderOrchestratorMetadata, 10)
checkSender := newCheckSender(checkID1, "hostname1", senderMetricSampleChan, serviceCheckChan, eventChan, bucketChan, orchestratorChan)
SetSender(checkSender, checkID1)
checkSender.Gauge("my.metric", 1.0, "", nil)
gaugeSenderSample := <-senderMetricSampleChan
assert.Equal(t, "hostname1", gaugeSenderSample.metricSample.Host)
changeAllSendersDefaultHostname("hostname2")
checkSender.Gauge("my.metric", 1.0, "", nil)
gaugeSenderSample = <-senderMetricSampleChan
assert.Equal(t, "hostname2", gaugeSenderSample.metricSample.Host)
changeAllSendersDefaultHostname("hostname1")
checkSender.Gauge("my.metric", 1.0, "", nil)
gaugeSenderSample = <-senderMetricSampleChan
assert.Equal(t, "hostname1", gaugeSenderSample.metricSample.Host)
} | explode_data.jsonl/78308 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 380
} | [
2830,
3393,
4072,
2403,
11505,
388,
3675,
88839,
1155,
353,
8840,
836,
8,
341,
1903,
1659,
54310,
17571,
46019,
1669,
1281,
35190,
4646,
54310,
17571,
11,
220,
16,
15,
340,
52934,
3973,
46019,
1669,
1281,
35190,
16734,
13860,
3973,
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 TestListBoxes(t *testing.T) {
msg := "TestListBoxes"
inFile := filepath.Join(inDir, "5116.DCT_Filter.pdf")
if _, err := api.ListBoxesFile(inFile, nil, nil, nil); err != nil {
t.Fatalf("%s: %v\n", msg, err)
}
// List crop box for all pages.
pb, err := api.PageBoundariesFromBoxList("crop")
if err != nil {
t.Fatalf("%s: %v\n", msg, err)
}
if _, err := api.ListBoxesFile(inFile, nil, pb, nil); err != nil {
t.Fatalf("%s: %v\n", msg, err)
}
} | explode_data.jsonl/37696 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 207
} | [
2830,
3393,
68287,
288,
1155,
353,
8840,
836,
8,
341,
21169,
1669,
330,
2271,
68287,
288,
698,
17430,
1703,
1669,
26054,
22363,
5900,
6184,
11,
330,
20,
16,
16,
21,
909,
1162,
68935,
15995,
5130,
743,
8358,
1848,
1669,
6330,
73633,
28... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 4 |
func TestRouter_MatchingOptions_MatchesByHeaders(t *testing.T) {
mainRouter := Router{}
_ = mainRouter.Get("/users", testHandlerFunc, NewMatchingOptions())
_ = mainRouter.Get("/users/{id}", testHandlerFunc, MatchingOptions{"", "", []string{}, map[string]string{"key1": "value1"}, map[string]string{}, nil})
_ = mainRouter.Get("/users/{id}/create", testHandlerFunc, MatchingOptions{"", "", []string{}, map[string]string{"key2": "value2"}, map[string]string{}, nil})
req, _ := http.NewRequest("GET", "/users/1/create", nil)
req.Header.Set("key2", "value2")
res := httptest.NewRecorder()
mainRouter.ServeHTTP(res, req)
assertEqual(t, 200, res.Code)
req, _ = http.NewRequest("GET", "/users/1/create", nil)
req.Header.Set("key2", "invalid")
res = httptest.NewRecorder()
mainRouter.ServeHTTP(res, req)
assertEqual(t, 404, res.Code)
req, _ = http.NewRequest("GET", "/users/1", nil)
res = httptest.NewRecorder()
mainRouter.ServeHTTP(res, req)
assertEqual(t, 404, res.Code)
req, _ = http.NewRequest("GET", "/users/1", nil)
req.Header.Set("key1", "value1")
res = httptest.NewRecorder()
mainRouter.ServeHTTP(res, req)
assertEqual(t, 200, res.Code)
} | explode_data.jsonl/31734 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 458
} | [
2830,
3393,
9523,
1245,
31924,
3798,
1245,
9118,
1359,
10574,
1155,
353,
8840,
836,
8,
341,
36641,
9523,
1669,
10554,
31483,
197,
62,
284,
1887,
9523,
2234,
4283,
4218,
497,
1273,
3050,
9626,
11,
1532,
64430,
3798,
2398,
197,
62,
284,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestDropTables(t *testing.T) {
err := DB.DropTables(UserProfile{}, Post{})
assert.Nil(t, err)
assert.False(t, DB.CheckIfTableExists("user_profiles"))
assert.False(t, DB.CheckIfTableExists("posts"))
} | explode_data.jsonl/59899 | {
"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,
19871,
21670,
1155,
353,
8840,
836,
8,
341,
9859,
1669,
5952,
21688,
21670,
13087,
8526,
22655,
3877,
37790,
6948,
59678,
1155,
11,
1848,
340,
6948,
50757,
1155,
11,
5952,
10600,
2679,
2556,
15575,
445,
872,
64021,
5455,
6948,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestEnsureVersionsMatch(t *testing.T) {
testlog.SetupLogger()
t.Run("ensure versions match", func(t *testing.T) {
err := EnsureVersionsMatch(expectedHosts, &Versions{hubVersion: version6X, agentVersion: version6X})
if err != nil {
t.Errorf("unexpected errr %#v", err)
}
})
t.Run("errors when failing to get version on the hub", func(t *testing.T) {
err := EnsureVersionsMatch(expectedHosts, &Versions{hubErr: expected})
if !errors.Is(err, expected) {
t.Errorf("got %v want %v", err, expected)
}
})
t.Run("errors when failing to get version on the agents", func(t *testing.T) {
err := EnsureVersionsMatch(expectedHosts, &Versions{hubVersion: version6X, agentErr: expected})
var expected errorlist.Errors
if !errors.As(err, &expected) {
t.Fatalf("got type %T, want type %T", err, expected)
}
if !reflect.DeepEqual(err, expected) {
t.Fatalf("got err %#v, want %#v", err, expected)
}
})
t.Run("reports version mismatch between hub and agent", func(t *testing.T) {
err := EnsureVersionsMatch(expectedHosts, &Versions{hubVersion: version6X, agentVersion: version5X})
if err == nil {
t.Errorf("expected an error")
}
expected := MismatchedVersions{version5X: expectedHosts}
if !strings.HasSuffix(err.Error(), expected.String()) {
t.Error("expected error to contain mismatched agents")
t.Logf("got err: %s", err)
t.Logf("want suffix: %s", expected)
}
})
} | explode_data.jsonl/46626 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 524
} | [
2830,
3393,
64439,
69015,
8331,
1155,
353,
8840,
836,
8,
341,
18185,
839,
39820,
7395,
2822,
3244,
16708,
445,
27289,
10795,
2432,
497,
2915,
1155,
353,
8840,
836,
8,
341,
197,
9859,
1669,
29279,
69015,
8331,
15253,
9296,
82,
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,
1... | 2 |
func TestYouonZ(t *testing.T) {
const want = "jajujojajijujejo"
for _, v := range [2]string{"じゃじゅじょじぁじぃじぅじぇじぉ", "ジャジュジョジァジィジゥジェジォ"} {
got, err := KanaToRomaji(v)
assert.Equal(t, want, got)
assert.Nil(t, err)
}
} | explode_data.jsonl/11321 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 143
} | [
2830,
3393,
2610,
263,
57,
1155,
353,
8840,
836,
8,
341,
4777,
1366,
284,
330,
73,
51413,
7305,
73,
1630,
3172,
33867,
7305,
1837,
2023,
8358,
348,
1669,
2088,
508,
17,
30953,
4913,
125817,
99104,
138218,
99104,
124180,
99104,
126025,
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... | 2 |
func TestSubscription(t *testing.T) {
if testing.Short() {
t.Skip()
}
tpt, err := createTpoolTester(t.Name())
if err != nil {
t.Fatal(err)
}
defer func() {
if err := tpt.Close(); err != nil {
t.Fatal(err)
}
}()
// Check the transaction pool is empty when initialized.
if len(tpt.tpool.transactionSets) != 0 {
t.Fatal("transaction pool is not empty")
}
// Create a mock subscriber and subscribe it to the transaction pool.
ms := mockSubscriber{
txnMap: make(map[modules.TransactionSetID][]types.Transaction),
}
tpt.tpool.TransactionPoolSubscribe(&ms)
if len(ms.txns) != 0 {
t.Fatalf("mock subscriber has received %v transactions; shouldn't have received any yet", len(ms.txns))
}
// Create a valid transaction set and check that the mock subscriber's
// transaction list is updated.
_, err = tpt.wallet.SendUplocoins(types.NewCurrency64(100), types.UnlockHash{})
if err != nil {
t.Fatal(err)
}
if len(tpt.tpool.transactionSets) != 1 {
t.Error("sending coins didn't increase the transaction sets by 1")
}
numTxns := 0
for _, txnSet := range tpt.tpool.transactionSets {
numTxns += len(txnSet)
}
if len(ms.txns) != numTxns {
t.Errorf("mock subscriber should've received %v transactions; received %v instead", numTxns, len(ms.txns))
}
numSubscribers := len(tpt.tpool.subscribers)
tpt.tpool.Unsubscribe(&ms)
if len(tpt.tpool.subscribers) != numSubscribers-1 {
t.Error("transaction pool failed to unsubscribe mock subscriber")
}
} | explode_data.jsonl/75053 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 558
} | [
2830,
3393,
33402,
1155,
353,
8840,
836,
8,
341,
743,
7497,
55958,
368,
341,
197,
3244,
57776,
741,
197,
630,
3244,
417,
11,
1848,
1669,
1855,
51,
10285,
58699,
1155,
2967,
2398,
743,
1848,
961,
2092,
341,
197,
3244,
26133,
3964,
340,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
func TestAdmitCreate(t *testing.T) {
defer featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, features.InPlacePodVerticalScaling, true)()
namespace := "test"
handler := NewPodResourceAllocation()
pod := api.Pod{
ObjectMeta: metav1.ObjectMeta{Name: "pod1", Namespace: namespace},
Spec: api.PodSpec{
Containers: []api.Container{
{
Name: "c1",
Image: "image",
},
},
},
}
res := api.ResourceList{
api.ResourceCPU: resource.MustParse("1"),
api.ResourceMemory: resource.MustParse("1Gi"),
}
cpuPolicyNoRestart := api.ResizePolicy{ResourceName: api.ResourceCPU, Policy: api.NoRestart}
memPolicyNoRestart := api.ResizePolicy{ResourceName: api.ResourceMemory, Policy: api.NoRestart}
cpuPolicyRestart := api.ResizePolicy{ResourceName: api.ResourceCPU, Policy: api.RestartContainer}
memPolicyRestart := api.ResizePolicy{ResourceName: api.ResourceMemory, Policy: api.RestartContainer}
tests := []struct {
name string
resources api.ResourceRequirements
resourcesAllocated api.ResourceList
expectedResourcesAllocated api.ResourceList
resizePolicy []api.ResizePolicy
expectedResizePolicy []api.ResizePolicy
}{
{
name: "create new pod - resource allocation not set, resize policy not set",
resources: api.ResourceRequirements{Requests: res, Limits: res},
resourcesAllocated: nil,
expectedResourcesAllocated: res,
resizePolicy: []api.ResizePolicy{},
expectedResizePolicy: []api.ResizePolicy{cpuPolicyNoRestart, memPolicyNoRestart},
},
{
name: "create new pod - resource allocation equals desired, norestart resize policy set",
resources: api.ResourceRequirements{Requests: res, Limits: res},
resourcesAllocated: res,
expectedResourcesAllocated: res,
resizePolicy: []api.ResizePolicy{cpuPolicyNoRestart, memPolicyNoRestart},
expectedResizePolicy: []api.ResizePolicy{cpuPolicyNoRestart, memPolicyNoRestart},
},
{
name: "create new pod - resources & resource allocation not set, cpu restart resize policy set",
resources: api.ResourceRequirements{},
resourcesAllocated: nil,
expectedResourcesAllocated: nil,
resizePolicy: []api.ResizePolicy{cpuPolicyRestart},
expectedResizePolicy: []api.ResizePolicy{},
},
{
name: "create new pod - resource allocation equals requests, mem restart resize policy set",
resources: api.ResourceRequirements{Requests: res},
resourcesAllocated: res,
expectedResourcesAllocated: res,
resizePolicy: []api.ResizePolicy{memPolicyRestart},
expectedResizePolicy: []api.ResizePolicy{memPolicyRestart, cpuPolicyNoRestart},
},
{
name: "create new pod - resource allocation not set, cpu & mem restart resize policy set",
resources: api.ResourceRequirements{Requests: res},
resourcesAllocated: nil,
expectedResourcesAllocated: res,
resizePolicy: []api.ResizePolicy{cpuPolicyRestart, memPolicyRestart},
expectedResizePolicy: []api.ResizePolicy{cpuPolicyRestart, memPolicyRestart},
},
//TODO: look into if more unit tests and negative tests could be added
}
for _, tc := range tests {
pod.Spec.Containers[0].Resources = tc.resources
pod.Spec.Containers[0].ResourcesAllocated = tc.resourcesAllocated
pod.Spec.Containers[0].ResizePolicy = tc.resizePolicy
err := handler.Admit(admission.NewAttributesRecord(&pod, nil, api.Kind("Pod").WithVersion("version"),
pod.Tenant, pod.Namespace, pod.Name, api.Resource("pods").WithVersion("version"), "",
admission.Create, nil, false, nil), nil)
if !apiequality.Semantic.DeepEqual(pod.Spec.Containers[0].ResourcesAllocated, tc.expectedResourcesAllocated) {
t.Fatal(fmt.Sprintf("Test: %s - resourcesAllocated mismatch\nExpected: %+v\nGot: %+v\nError: %+v", tc.name,
tc.expectedResourcesAllocated, pod.Spec.Containers[0].ResourcesAllocated, err))
}
if !apiequality.Semantic.DeepEqual(pod.Spec.Containers[0].ResizePolicy, tc.expectedResizePolicy) {
t.Fatal(fmt.Sprintf("Test: %s - resizePolicy mismatch\nExpected: %+v\nGot: %+v\nError: %+v", tc.name,
tc.expectedResizePolicy, pod.Spec.Containers[0].ResizePolicy, err))
}
}
} | explode_data.jsonl/16634 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 1799
} | [
2830,
3393,
2589,
1763,
4021,
1155,
353,
8840,
836,
8,
341,
16867,
4565,
70,
266,
57824,
287,
4202,
13859,
42318,
16014,
2271,
1155,
11,
4094,
12753,
13275,
13859,
42318,
11,
4419,
5337,
17371,
23527,
18612,
59684,
11,
830,
8,
741,
5662... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestFilterByReplicationLagUnhealthy(t *testing.T) {
// 1 healthy serving tablet, 1 not healhty
ts1 := &TabletStats{
Tablet: topo.NewTablet(1, "cell", "host1"),
Serving: true,
Stats: &querypb.RealtimeStats{},
}
ts2 := &TabletStats{
Tablet: topo.NewTablet(2, "cell", "host2"),
Serving: false,
Stats: &querypb.RealtimeStats{},
}
got := FilterByReplicationLag([]*TabletStats{ts1, ts2})
if len(got) != 1 {
t.Errorf("len(FilterByReplicationLag([{Tablet: {Uid: 1}, Serving: true}, {Tablet: {Uid: 2}, Serving: false}])) = %v, want 1", len(got))
}
if len(got) > 0 && !got[0].DeepEqual(ts1) {
t.Errorf("FilterByReplicationLag([{Tablet: {Uid: 1}, Serving: true}, {Tablet: {Uid: 2}, Serving: false}]) = %+v, want %+v", got[0], ts1)
}
} | explode_data.jsonl/260 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 334
} | [
2830,
3393,
5632,
1359,
18327,
1693,
43,
351,
1806,
37028,
1155,
353,
8840,
836,
8,
341,
197,
322,
220,
16,
9314,
13480,
20697,
11,
220,
16,
537,
26563,
426,
88,
198,
57441,
16,
1669,
609,
2556,
83,
16635,
515,
197,
197,
2556,
83,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestGCReconcile(t *testing.T) {
now := time.Now()
tenMinutesAgo := now.Add(-10 * time.Minute)
old := now.Add(-11 * time.Minute)
older := now.Add(-12 * time.Minute)
oldest := now.Add(-13 * time.Minute)
table := TableTest{{
Name: "delete oldest, keep two",
Objects: []runtime.Object{
cfg("keep-two", "foo", 5556,
WithLatestCreated("5556"),
WithLatestReady("5556"),
WithObservedGen),
rev("keep-two", "foo", 5554, MarkRevisionReady,
WithRevName("5554"),
WithCreationTimestamp(oldest),
WithLastPinned(tenMinutesAgo)),
rev("keep-two", "foo", 5555, MarkRevisionReady,
WithRevName("5555"),
WithCreationTimestamp(older),
WithLastPinned(tenMinutesAgo)),
rev("keep-two", "foo", 5556, MarkRevisionReady,
WithRevName("5556"),
WithCreationTimestamp(old),
WithLastPinned(tenMinutesAgo)),
},
WantDeletes: []clientgotesting.DeleteActionImpl{{
ActionImpl: clientgotesting.ActionImpl{
Namespace: "foo",
Verb: "delete",
Resource: schema.GroupVersionResource{
Group: "serving.knative.dev",
Version: "v1alpha1",
Resource: "revisions",
},
},
Name: "5554",
}},
Key: "foo/keep-two",
}, {
Name: "keep oldest when no lastPinned",
Objects: []runtime.Object{
cfg("keep-no-last-pinned", "foo", 5556,
WithLatestCreated("5556"),
WithLatestReady("5556"),
WithObservedGen),
// No lastPinned so we will keep this.
rev("keep-no-last-pinned", "foo", 5554, MarkRevisionReady,
WithRevName("5554"),
WithCreationTimestamp(oldest)),
rev("keep-no-last-pinned", "foo", 5555, MarkRevisionReady,
WithRevName("5555"),
WithCreationTimestamp(older),
WithLastPinned(tenMinutesAgo)),
rev("keep-no-last-pinned", "foo", 5556, MarkRevisionReady,
WithRevName("5556"),
WithCreationTimestamp(old),
WithLastPinned(tenMinutesAgo)),
},
Key: "foo/keep-no-last-pinned",
}, {
Name: "keep recent lastPinned",
Objects: []runtime.Object{
cfg("keep-recent-last-pinned", "foo", 5556,
WithLatestCreated("5556"),
WithLatestReady("5556"),
WithObservedGen),
rev("keep-recent-last-pinned", "foo", 5554, MarkRevisionReady,
WithRevName("5554"),
WithCreationTimestamp(oldest),
// This is an indication that things are still routing here.
WithLastPinned(now)),
rev("keep-recent-last-pinned", "foo", 5555, MarkRevisionReady,
WithRevName("5555"),
WithCreationTimestamp(older),
WithLastPinned(tenMinutesAgo)),
rev("keep-recent-last-pinned", "foo", 5556, MarkRevisionReady,
WithRevName("5556"),
WithCreationTimestamp(old),
WithLastPinned(tenMinutesAgo)),
},
Key: "foo/keep-recent-last-pinned",
}, {
Name: "keep LatestReadyRevision",
Objects: []runtime.Object{
// Create a revision where the LatestReady is 5554, but LatestCreated is 5556.
// We should keep LatestReady even if it is old.
cfg("keep-two", "foo", 5556,
WithLatestReady("5554"),
// This comes after 'WithLatestReady' so the
// Configuration's 'Ready' Status is 'Unknown'
WithLatestCreated("5556"),
WithObservedGen),
rev("keep-two", "foo", 5554, MarkRevisionReady,
WithRevName("5554"),
WithCreationTimestamp(oldest),
WithLastPinned(tenMinutesAgo)),
rev("keep-two", "foo", 5555, // Not Ready
WithRevName("5555"),
WithCreationTimestamp(older),
WithLastPinned(tenMinutesAgo)),
rev("keep-two", "foo", 5556, // Not Ready
WithRevName("5556"),
WithCreationTimestamp(old),
WithLastPinned(tenMinutesAgo)),
},
Key: "foo/keep-two",
}, {
Name: "keep stale revision because of minimum generations",
Objects: []runtime.Object{
cfg("keep-all", "foo", 5554,
// Don't set the latest ready revision here
// since those by default are always retained
WithLatestCreated("keep-all"),
WithObservedGen),
rev("keep-all", "foo", 5554,
WithRevName("keep-all"),
WithCreationTimestamp(oldest),
WithLastPinned(tenMinutesAgo)),
},
Key: "foo/keep-all",
}}
defer ClearAllLoggers()
table.Test(t, MakeFactory(func(listers *Listers, opt reconciler.Options) controller.Reconciler {
return &Reconciler{
Base: reconciler.NewBase(opt, controllerAgentName),
configurationLister: listers.GetConfigurationLister(),
revisionLister: listers.GetRevisionLister(),
configStore: &testConfigStore{
config: &config.Config{
RevisionGC: &gc.Config{
StaleRevisionCreateDelay: 5 * time.Minute,
StaleRevisionTimeout: 5 * time.Minute,
StaleRevisionMinimumGenerations: 2,
},
},
},
}
}))
} | explode_data.jsonl/70630 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 1925
} | [
2830,
3393,
22863,
693,
40446,
457,
1155,
353,
8840,
836,
8,
341,
80922,
1669,
882,
13244,
741,
197,
1960,
27720,
32,
3346,
1669,
1431,
1904,
4080,
16,
15,
353,
882,
75770,
692,
61828,
1669,
1431,
1904,
4080,
16,
16,
353,
882,
75770,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestSearch__fedachSearchRequest(t *testing.T) {
u, _ := url.Parse("https://moov.io/fed/ach/search?name=Farmers&routingNumber=044112187&city=CALDWELL&state=OH&postalCode=43724")
req := readFEDSearchRequest(u)
if req.Name != "FARMERS" {
t.Errorf("req.Name=%s", req.Name)
}
if req.RoutingNumber != "044112187" {
t.Errorf("req.RoutingNUmber=%s", req.RoutingNumber)
}
if req.City != "CALDWELL" {
t.Errorf("req.City=%s", req.City)
}
if req.State != "OH" {
t.Errorf("req.State=%s", req.State)
}
if req.PostalCode != "43724" {
t.Errorf("req.Zip=%s", req.PostalCode)
}
if req.empty() {
t.Error("req is not empty")
}
req = fedSearchRequest{}
if !req.empty() {
t.Error("req is empty now")
}
req.Name = "FARMERS"
if req.empty() {
t.Error("req is not empty now")
}
} | explode_data.jsonl/71084 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 361
} | [
2830,
3393,
5890,
563,
51123,
610,
5890,
1900,
1155,
353,
8840,
836,
8,
341,
10676,
11,
716,
1669,
2515,
8937,
445,
2428,
1110,
6355,
859,
4245,
6663,
291,
14,
610,
23167,
30,
606,
28,
70994,
388,
60617,
10909,
2833,
28,
15,
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... | 9 |
func Test_ObjectTracker_CancelBeforeExpect(t *testing.T) {
g := gomega.NewWithT(t)
ot := newObjTracker(schema.GroupVersionKind{}, nil)
ct := makeCT("test-ct")
ot.CancelExpect(ct)
ot.Expect(ct)
ot.ExpectationsDone()
g.Expect(ot.Satisfied()).To(gomega.BeTrue())
} | explode_data.jsonl/52320 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 116
} | [
2830,
3393,
27839,
31133,
97485,
10227,
17536,
1155,
353,
8840,
836,
8,
341,
3174,
1669,
342,
32696,
7121,
2354,
51,
1155,
340,
197,
354,
1669,
74259,
31133,
42735,
5407,
5637,
10629,
22655,
2092,
340,
89216,
1669,
1281,
1162,
445,
1944,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestGroupAssign(t *testing.T) {
ncf := cniNetConfig{Subnet: cnitypes.IPNet{IP: net.ParseIP("10.128.2.0"), Mask: net.CIDRMask(24, 32)}}
hcf := &HostAgentConfig{
NodeName: "node1",
EpRpcSock: "/tmp/aci-containers-ep-rpc.sock",
NetConfig: []cniNetConfig{ncf},
AciPrefix: "it",
GroupDefaults: GroupDefaults{
DefaultEg: metadata.OpflexGroup{
PolicySpace: "tenantA",
Name: "defaultEPG",
},
NamespaceDefaultEg: map[string]metadata.OpflexGroup{
"ns1": {
PolicySpace: "tenantA",
Name: "ns1EPG",
},
"ns2": {
PolicySpace: "tenantA",
Name: "ns2EPG",
},
},
},
}
it := SetupInteg(t, hcf)
it.setupNode(itIpam, true)
defer it.tearDown()
// add an annotated namespace
it.ta.fakeNamespaceSource.Add(mkNamespace("annNS", testEgAnnot3, sgAnnot1))
// add an annotated deployment
it.ta.fakeDeploymentSource.Add(mkDeployment("annNS", "testDeployment", testEgAnnot4, sgAnnot2))
// Add pods intf via cni
it.cniAddParallel(0, 2)
it.testNS = "ns1"
it.cniAddParallel(2, 3)
it.testNS = "ns2"
it.cniAddParallel(3, 5)
it.testNS = "annNS"
it.cniAddParallel(5, 7)
time.Sleep(10 * time.Millisecond)
it.addPodObj(0, testPodNS, "", "", nil)
it.addPodObj(1, testPodNS, testEgAnnot1, "", nil)
it.addPodObj(2, "ns1", "", "", nil)
it.addPodObj(3, "ns2", "", "", nil)
it.addPodObj(4, "ns2", testEgAnnot2, sgAnnot3, nil)
it.addPodObj(5, "annNS", "", "", nil)
depLabels := map[string]string{
"app": "sample-app",
"tier": "sample-tier",
"deer": "dear",
}
it.addPodObj(6, "annNS", "", "", depLabels)
// verify ep file
it.checkEpGroups(0, "defaultEPG", emptyJSON)
it.checkEpGroups(1, "test-prof|test-eg", emptyJSON)
it.checkEpGroups(2, "ns1EPG", emptyJSON)
it.checkEpGroups(3, "ns2EPG", emptyJSON)
it.checkEpGroups(4, "foo|bar", sgAnnot3)
it.checkEpGroups(5, "test-prof|ann-ns-eg", sgAnnot1)
it.checkEpGroups(6, "test-prof|ann-depl-eg", sgAnnot2)
it.cniDelParallel(5, 7)
it.testNS = "ns2"
it.cniDelParallel(3, 5)
it.testNS = "ns1"
it.cniDelParallel(2, 3)
it.testNS = testPodNS
it.cniDelParallel(0, 2)
} | explode_data.jsonl/53273 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 1030
} | [
2830,
3393,
2808,
28933,
1155,
353,
8840,
836,
8,
341,
197,
1016,
69,
1669,
272,
7751,
6954,
2648,
90,
3136,
4711,
25,
13665,
487,
20352,
46917,
6954,
90,
3298,
25,
4179,
8937,
3298,
445,
16,
15,
13,
16,
17,
23,
13,
17,
13,
15,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestGetFile_archiveNoUnarchive(t *testing.T) {
dst := tempFile(t)
u := testModule("basic-file-archive/archive.tar.gz")
u += "?archive=false"
if err := GetFile(dst, u); err != nil {
t.Fatalf("err: %s", err)
}
// Verify the main file exists
actual := testMD5(t, dst)
expected := "fbd90037dacc4b1ab40811d610dde2f0"
if actual != expected {
t.Fatalf("bad: %s", actual)
}
} | explode_data.jsonl/823 | {
"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,
1949,
1703,
42873,
2753,
1806,
16019,
1155,
353,
8840,
836,
8,
341,
52051,
1669,
2730,
1703,
1155,
340,
10676,
1669,
1273,
3332,
445,
22342,
14203,
95100,
71627,
28048,
20963,
1138,
10676,
1421,
27244,
16019,
12219,
1837,
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... | 3 |
func TestProxyConfig(t *testing.T) {
framework.NewTest(t).Features("usability.observability.proxy-config").
RequiresSingleCluster().
Run(func(t framework.TestContext) {
istioCtl := istioctl.NewOrFail(t, t, istioctl.Config{})
podID, err := getPodID(apps.PodA[0])
if err != nil {
t.Fatalf("Could not get Pod ID: %v", err)
}
var output string
var args []string
g := gomega.NewWithT(t)
args = []string{
"--namespace=dummy",
"pc", "bootstrap", fmt.Sprintf("%s.%s", podID, apps.Namespace.Name()),
}
output, _ = istioCtl.InvokeOrFail(t, args)
jsonOutput := jsonUnmarshallOrFail(t, strings.Join(args, " "), output)
g.Expect(jsonOutput).To(gomega.HaveKey("bootstrap"))
args = []string{
"--namespace=dummy",
"pc", "cluster", fmt.Sprintf("%s.%s", podID, apps.Namespace.Name()), "-o", "json",
}
output, _ = istioCtl.InvokeOrFail(t, args)
jsonOutput = jsonUnmarshallOrFail(t, strings.Join(args, " "), output)
g.Expect(jsonOutput).To(gomega.Not(gomega.BeEmpty()))
args = []string{
"--namespace=dummy",
"pc", "endpoint", fmt.Sprintf("%s.%s", podID, apps.Namespace.Name()), "-o", "json",
}
output, _ = istioCtl.InvokeOrFail(t, args)
jsonOutput = jsonUnmarshallOrFail(t, strings.Join(args, " "), output)
g.Expect(jsonOutput).To(gomega.Not(gomega.BeEmpty()))
args = []string{
"--namespace=dummy",
"pc", "listener", fmt.Sprintf("%s.%s", podID, apps.Namespace.Name()), "-o", "json",
}
output, _ = istioCtl.InvokeOrFail(t, args)
jsonOutput = jsonUnmarshallOrFail(t, strings.Join(args, " "), output)
g.Expect(jsonOutput).To(gomega.Not(gomega.BeEmpty()))
args = []string{
"--namespace=dummy",
"pc", "route", fmt.Sprintf("%s.%s", podID, apps.Namespace.Name()), "-o", "json",
}
output, _ = istioCtl.InvokeOrFail(t, args)
jsonOutput = jsonUnmarshallOrFail(t, strings.Join(args, " "), output)
g.Expect(jsonOutput).To(gomega.Not(gomega.BeEmpty()))
args = []string{
"--namespace=dummy",
"pc", "secret", fmt.Sprintf("%s.%s", podID, apps.Namespace.Name()), "-o", "json",
}
output, _ = istioCtl.InvokeOrFail(t, args)
jsonOutput = jsonUnmarshallOrFail(t, strings.Join(args, " "), output)
g.Expect(jsonOutput).To(gomega.HaveKey("dynamicActiveSecrets"))
dump := &admin.SecretsConfigDump{}
if err := jsonpb.UnmarshalString(output, dump); err != nil {
t.Fatal(err)
}
if len(dump.DynamicWarmingSecrets) > 0 {
t.Fatalf("found warming secrets: %v", output)
}
if len(dump.DynamicActiveSecrets) != 2 {
// If the config for the SDS does not align in all locations, we may get duplicates.
// This check ensures we do not. If this is failing, check to ensure the bootstrap config matches
// the XDS response.
t.Fatalf("found unexpected secrets, should have only default and ROOTCA: %v", output)
}
})
} | explode_data.jsonl/57534 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 1253
} | [
2830,
3393,
16219,
2648,
1155,
353,
8840,
836,
8,
341,
1166,
5794,
7121,
2271,
1155,
568,
21336,
445,
355,
2897,
13,
22764,
2897,
41103,
25130,
38609,
197,
197,
46961,
10888,
28678,
25829,
197,
85952,
18552,
1155,
12626,
8787,
1972,
8,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 5 |
func TestEidNonNumeric(t *testing.T) {
_, err := DecodeAndVerifyEid("A9033023426100000000000859956802")
if err == nil {
t.Fatalf(`Error: %v`, err)
}
} | explode_data.jsonl/25726 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 75
} | [
2830,
3393,
36,
307,
8121,
36296,
1155,
353,
8840,
836,
8,
972,
197,
6878,
1848,
1669,
50194,
3036,
32627,
36,
307,
445,
32,
24,
15,
18,
18,
15,
17,
18,
19,
17,
21,
16,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
23,
20,
2... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
func TestCamelYAMLLoadSuccess(t *testing.T) {
// loads the config
cfg := LoadFromFile("./testdata/config_camel.yml")
// config file take precedence over defaults
assert.Equal(t, "camelService", cfg.GetServiceName().GetValue())
assert.Equal(t, "http://35.233.143.122:9411/api/v2/spans", cfg.GetReporting().GetEndpoint().GetValue())
assert.Equal(t, true, cfg.GetDataCapture().GetHttpHeaders().GetRequest().GetValue())
} | explode_data.jsonl/64643 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 152
} | [
2830,
3393,
25406,
301,
56,
1402,
4086,
2731,
7188,
1155,
353,
8840,
836,
8,
341,
197,
322,
20907,
279,
2193,
198,
50286,
1669,
8893,
43633,
13988,
92425,
14730,
666,
35562,
33936,
5130,
197,
322,
2193,
1034,
1896,
53056,
916,
16674,
19... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
func TestIsOnline(t *testing.T) {
e := CreateTestBot(t)
var err error
e.connectionManager, err = setupConnectionManager(&e.Config.ConnectionMonitor)
if err != nil {
t.Fatal(err)
}
if r := e.IsOnline(); r {
t.Fatal("Unexpected result")
}
if err = e.connectionManager.Start(); err != nil {
t.Fatal(err)
}
tick := time.NewTicker(time.Second * 5)
defer tick.Stop()
for {
select {
case <-tick.C:
t.Fatal("Test timeout")
default:
if e.IsOnline() {
if err := e.connectionManager.Stop(); err != nil {
t.Fatal("unable to shutdown connection manager")
}
return
}
}
}
} | explode_data.jsonl/59228 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 256
} | [
2830,
3393,
3872,
19598,
1155,
353,
8840,
836,
8,
341,
7727,
1669,
4230,
2271,
23502,
1155,
340,
2405,
1848,
1465,
198,
7727,
20310,
2043,
11,
1848,
284,
6505,
4526,
2043,
2099,
68,
10753,
17463,
30098,
340,
743,
1848,
961,
2092,
341,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 8 |
func TestJobSpecsController_Create_Initiator_Only(t *testing.T) {
t.Parallel()
rpcClient, gethClient, _, assertMocksCalled := cltest.NewEthMocksWithStartupAssertions(t)
defer assertMocksCalled()
app, cleanup := cltest.NewApplication(t,
eth.NewClientWith(rpcClient, gethClient),
)
defer cleanup()
require.NoError(t, app.Start())
client := app.NewHTTPClient()
jsonStr := cltest.MustReadFile(t, "testdata/initiator_only_job.json")
resp, cleanup := client.Post("/v2/specs", bytes.NewBuffer(jsonStr))
defer cleanup()
assert.Equal(t, http.StatusBadRequest, resp.StatusCode, "Response should be caller error")
expected := `{"errors":[{"detail":"Must have at least one Initiator and one Task"}]}`
body := string(cltest.ParseResponseBody(t, resp))
assert.Equal(t, expected, strings.TrimSpace(body))
} | explode_data.jsonl/31816 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 284
} | [
2830,
3393,
12245,
8327,
82,
2051,
34325,
15644,
36122,
62,
7308,
1155,
353,
8840,
836,
8,
341,
3244,
41288,
7957,
741,
7000,
3992,
2959,
11,
633,
71,
2959,
11,
8358,
2060,
72577,
20960,
1669,
1185,
1944,
7121,
65390,
11571,
16056,
3907... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 TestConditionalAddArchiveLocationArchiveLogs(t *testing.T) {
ctx := context.Background()
woc := newWoc()
setArtifactRepository(woc.controller, &wfv1.ArtifactRepository{
S3: &wfv1.S3ArtifactRepository{
S3Bucket: wfv1.S3Bucket{
Bucket: "foo",
},
KeyFormat: "path/in/bucket",
},
ArchiveLogs: pointer.BoolPtr(true),
})
woc.operate(ctx)
assert.Equal(t, wfv1.WorkflowRunning, woc.wf.Status.Phase)
pods, err := listPods(woc)
assert.NoError(t, err)
assert.Len(t, pods.Items, 1)
pod := pods.Items[0]
tmpl, err := getPodTemplate(&pod)
assert.NoError(t, err)
assert.NotNil(t, tmpl.ArchiveLocation)
} | explode_data.jsonl/75377 | {
"file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl",
"token_count": 284
} | [
2830,
3393,
79233,
2212,
42502,
4707,
42502,
51053,
1155,
353,
8840,
836,
8,
341,
20985,
1669,
2266,
19047,
741,
6692,
509,
1669,
501,
54,
509,
741,
8196,
85578,
4624,
3622,
509,
14514,
11,
609,
86,
27890,
16,
50064,
20754,
4624,
515,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.