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 TestTeamsService_DeleteTeamBySlug(t *testing.T) { client, mux, _, teardown := setup() defer teardown() mux.HandleFunc("/orgs/o/teams/s", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "DELETE") }) ctx := context.Background() _, err := client.Teams.DeleteTeamBySlug(ctx, "o", "s") if err != nil { t.Errorf("Teams.DeleteTeamBySlug returned error: %v", err) } const methodName = "DeleteTeamBySlug" testBadOptions(t, methodName, func() (err error) { _, err = client.Teams.DeleteTeamBySlug(ctx, "\n", "\n") return err }) testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { return client.Teams.DeleteTeamBySlug(ctx, "o", "s") }) }
explode_data.jsonl/4521
{ "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, 60669, 1860, 57418, 14597, 1359, 54968, 1155, 353, 8840, 836, 8, 341, 25291, 11, 59807, 11, 8358, 49304, 1669, 6505, 741, 16867, 49304, 2822, 2109, 2200, 63623, 4283, 1775, 82, 20271, 14, 38496, 2687, 497, 2915, 3622, 1758, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestOperatorRestartHostNetwork(t *testing.T) { namespace := "ns" context := newTestStartCluster(namespace) c := newCluster(context, namespace, false, v1.ResourceRequirements{}) c.clusterInfo = test.CreateConfigDir(1) // start a basic cluster err := c.Start() assert.Nil(t, err) validateStart(t, c) c = newCluster(context, namespace, true, v1.ResourceRequirements{}) // starting again should be a no-op, but still results in an error err = c.Start() assert.Nil(t, err) validateStart(t, c) }
explode_data.jsonl/39527
{ "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, 18461, 59354, 9296, 12320, 1155, 353, 8840, 836, 8, 341, 56623, 1669, 330, 4412, 698, 28413, 1669, 501, 2271, 3479, 28678, 52397, 340, 1444, 1669, 501, 28678, 5378, 11, 4473, 11, 895, 11, 348, 16, 20766, 59202, 37790, 1444, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestGetChannelStateChannelIdIncorrectSignature(t *testing.T) { reply, err := stateServiceTest.service.GetChannelState( nil, &ChannelStateRequest{ ChannelId: bigIntToBytes(stateServiceTest.defaultChannelId), Signature: []byte{0x00}, }, ) assert.Equal(t, errors.New("incorrect signature"), err) assert.Nil(t, reply) }
explode_data.jsonl/6073
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 121 }
[ 2830, 3393, 1949, 9629, 1397, 9629, 764, 40468, 25088, 1155, 353, 8840, 836, 8, 341, 86149, 11, 1848, 1669, 1584, 1860, 2271, 5736, 2234, 9629, 1397, 1006, 197, 84131, 345, 197, 197, 5, 9629, 1397, 1900, 515, 298, 197, 9629, 764, 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 TestBindRequest_BodyValidation(t *testing.T) { spec, api := petstore.NewAPI(t) ctx := NewContext(spec, api, nil) api.DefaultConsumes = runtime.JSONMime ctx.router = DefaultRouter(spec, ctx.api) req, err := http.NewRequest("GET", path.Join(spec.BasePath(), "/pets"), new(eofReader)) if assert.NoError(t, err) { req.Header.Set("Content-Type", runtime.JSONMime) ri, rCtx, ok := ctx.RouteInfo(req) if assert.True(t, ok) { req = rCtx err := ctx.BindValidRequest(req, ri, rbn(func(r *http.Request, rr *MatchedRoute) error { defer r.Body.Close() var data interface{} err := runtime.JSONConsumer().Consume(r.Body, &data) _ = data return err })) assert.Error(t, err) assert.Equal(t, io.EOF, err) } } }
explode_data.jsonl/19158
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 322 }
[ 2830, 3393, 9950, 1900, 1668, 1076, 13799, 1155, 353, 8840, 836, 8, 341, 98100, 11, 6330, 1669, 6753, 4314, 7121, 7082, 1155, 340, 20985, 1669, 1532, 1972, 38209, 11, 6330, 11, 2092, 340, 54299, 13275, 41966, 288, 284, 15592, 18009, 44,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestValidateChecksum(t *testing.T) { //goland:noinspection GoImportUsedAsName assert := assert.New(t) for _, tt := range tests { data := append(tt.data, 0, 0) binary.LittleEndian.PutUint16(data[len(data)-2:], tt.expectedCrc) assert.True(ValidateChecksum(data)) binary.LittleEndian.PutUint16(data[len(data)-2:], tt.expectedCrc + 1) assert.False(ValidateChecksum(data)) binary.LittleEndian.PutUint16(data[len(data)-2:], tt.expectedCrc - 1) assert.False(ValidateChecksum(data)) } }
explode_data.jsonl/37606
{ "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, 17926, 73190, 1155, 353, 8840, 836, 8, 341, 262, 442, 70, 96440, 66479, 53395, 5994, 11511, 22743, 2121, 675, 198, 262, 2060, 1669, 2060, 7121, 1155, 340, 1066, 262, 369, 8358, 17853, 1669, 2088, 7032, 341, 286, 821, 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...
2
func TestFStatelessNatsServer(t *testing.T) { s := runServer(nil) defer s.Shutdown() conn, err := nats.Connect(fmt.Sprintf("nats://localhost:%d", defaultOptions.Port)) if err != nil { t.Fatal(err) } processor := &processor{t} protoFactory := NewFProtocolFactory(thrift.NewTBinaryProtocolFactoryDefault()) server := NewFNatsServerBuilder(conn, processor, protoFactory, []string{"foo"}).WithQueueGroup("queue").Build() go func() { assert.Nil(t, server.Serve()) }() time.Sleep(10 * time.Millisecond) defer server.Stop() tr := NewFNatsTransport(conn, "foo", "bar").(*fNatsTransport) ctx := NewFContext("") assert.Nil(t, tr.Open()) // Send a request. buffer := NewTMemoryOutputBuffer(0) proto := protoFactory.GetProtocol(buffer) proto.WriteRequestHeader(ctx) proto.WriteBinary([]byte{1, 2, 3, 4, 5}) resultTrans, err := tr.Request(ctx, buffer.Bytes()) assert.Nil(t, err) resultProto := protoFactory.GetProtocol(resultTrans) ctx = NewFContext("") err = resultProto.ReadResponseHeader(ctx) assert.Nil(t, err) resultBytes, err := resultProto.ReadBinary() assert.Nil(t, err) assert.Equal(t, "foo", string(resultBytes)) }
explode_data.jsonl/29847
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 430 }
[ 2830, 3393, 37, 1397, 1717, 45, 1862, 5475, 1155, 353, 8840, 836, 8, 341, 1903, 1669, 1598, 5475, 27907, 340, 16867, 274, 10849, 18452, 741, 32917, 11, 1848, 1669, 308, 1862, 43851, 28197, 17305, 445, 77, 1862, 1110, 8301, 7533, 67, 4...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestAuthorizationEndpointDiscovery(t *testing.T) { mux := http.NewServeMux() var serverURL string mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { // From the spec (https://www.w3.org/TR/indieauth/#x4-1-discovery-by-clients): // >>> the first HTTP Link header takes precedence, followed by the first <link> element in document order. // The client should discover `serverURL + "/lol"` w.Header().Set("Link", fmt.Sprintf("<%s/lol>; rel=\"authorization_endpoint\"", serverURL)) w.Write([]byte(fmt.Sprintf(`<!doctype html><html><head><meta charset=utf-8><link rel="authorization_endpoint" href="/indieauth"></head></html>`))) }) server := httptest.NewServer(mux) serverURL = server.URL authEndpoint, err := getAuthEndpoint(server.URL) if err != nil { panic(err) } if authEndpoint != serverURL+"/lol" { t.Errorf("failed to discover authorization endpoint, expected \"%s/lol\", got %q", serverURL, authEndpoint) } }
explode_data.jsonl/7018
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 342 }
[ 2830, 3393, 18124, 27380, 67400, 1155, 353, 8840, 836, 8, 341, 2109, 2200, 1669, 1758, 7121, 60421, 44, 2200, 741, 2405, 3538, 3144, 914, 198, 2109, 2200, 63623, 35460, 2915, 3622, 1758, 37508, 11, 435, 353, 1254, 9659, 8, 341, 197, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestMongo_Last(t *testing.T) { m, skip := prepMongo(t, true) // adds two comments if skip { return } res, err := m.Last("radio-t", 0) assert.Nil(t, err) assert.Equal(t, 2, len(res)) assert.Equal(t, "some text2", res[0].Text) res, err = m.Last("radio-t", 1) assert.Nil(t, err) assert.Equal(t, 1, len(res)) assert.Equal(t, "some text2", res[0].Text) }
explode_data.jsonl/54197
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 170 }
[ 2830, 3393, 54998, 84672, 1155, 353, 8840, 836, 8, 341, 2109, 11, 10706, 1669, 21327, 54998, 1155, 11, 830, 8, 442, 11367, 1378, 6042, 198, 743, 10706, 341, 197, 853, 198, 197, 532, 10202, 11, 1848, 1669, 296, 24682, 445, 12636, 2385,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestPushImages(t *testing.T) { var privateImgs = map[string]Config{ "test": Config{ name: "test1", registry: "private.io/sonobuoy", version: "x.y", }, } tests := map[string]struct { client docker.Docker privateImgs map[string]Config wantErrorCount int }{ "simple": { client: FakeDockerClient{ pushFails: false, tagFails: false, }, privateImgs: privateImgs, wantErrorCount: 0, }, "tag fails": { client: FakeDockerClient{ pushFails: false, tagFails: true, }, privateImgs: privateImgs, wantErrorCount: 1, }, "push fails": { client: FakeDockerClient{ pushFails: true, tagFails: true, }, privateImgs: privateImgs, wantErrorCount: 2, }, "source images equal destination images": { client: FakeDockerClient{ pushFails: true, tagFails: true, }, privateImgs: imgs, wantErrorCount: 0, }, } for name, tc := range tests { t.Run(name, func(t *testing.T) { imgClient := ImageClient{ dockerClient: tc.client, } got := imgClient.PushImages(imgs, tc.privateImgs, 0) if len(got) != tc.wantErrorCount { t.Fatalf("Expected errors: %d but got %d", tc.wantErrorCount, len(got)) } }) } }
explode_data.jsonl/61546
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 580 }
[ 2830, 3393, 16644, 14228, 1155, 353, 8840, 836, 8, 341, 2405, 869, 1427, 5857, 284, 2415, 14032, 60, 2648, 515, 197, 197, 1, 1944, 788, 5532, 515, 298, 11609, 25, 257, 330, 1944, 16, 756, 298, 197, 29172, 25, 330, 1996, 4245, 14, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestChanOfGC(t *testing.T) { done := make(chan bool, 1) go func() { select { case <-done: case <-time.After(5 * time.Second): panic("deadlock in TestChanOfGC") } }() defer func() { done <- true }() type T *uintptr tt := TypeOf(T(nil)) ct := ChanOf(BothDir, tt) // NOTE: The garbage collector handles allocated channels specially, // so we have to save pointers to channels in x; the pointer code will // use the gc info in the newly constructed chan type. const n = 100 var x []interface{} for i := 0; i < n; i++ { v := MakeChan(ct, n) for j := 0; j < n; j++ { p := new(uintptr) *p = uintptr(i*n + j) v.Send(ValueOf(p).Convert(tt)) } pv := New(ct) pv.Elem().Set(v) x = append(x, pv.Interface()) } runtime.GC() for i, xi := range x { v := ValueOf(xi).Elem() for j := 0; j < n; j++ { pv, _ := v.Recv() k := pv.Elem().Interface() if k != uintptr(i*n+j) { t.Errorf("lost x[%d][%d] = %d, want %d", i, j, k, i*n+j) } } } }
explode_data.jsonl/29610
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 461 }
[ 2830, 3393, 46019, 2124, 22863, 1155, 353, 8840, 836, 8, 341, 40495, 1669, 1281, 35190, 1807, 11, 220, 16, 340, 30680, 2915, 368, 341, 197, 38010, 341, 197, 2722, 9119, 10438, 510, 197, 2722, 9119, 1678, 36892, 7, 20, 353, 882, 32435,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestDeviceFilter_Nil(t *testing.T) { expected := ` // load parameters into registers 0: LdXMemW dst: r2 src: r1 off: 0 imm: 0 1: And32Imm dst: r2 imm: 65535 2: LdXMemW dst: r3 src: r1 off: 0 imm: 0 3: RSh32Imm dst: r3 imm: 16 4: LdXMemW dst: r4 src: r1 off: 4 imm: 0 5: LdXMemW dst: r5 src: r1 off: 8 imm: 0 block-0: // return 0 (reject) 6: Mov32Imm dst: r0 imm: 0 7: Exit ` testDeviceFilter(t, nil, expected) }
explode_data.jsonl/2941
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 245 }
[ 2830, 3393, 6985, 5632, 1604, 321, 1155, 353, 8840, 836, 8, 341, 42400, 1669, 22074, 322, 2795, 5029, 1119, 24740, 198, 286, 220, 15, 25, 444, 67, 55, 18816, 54, 10648, 25, 435, 17, 2286, 25, 435, 16, 1007, 25, 220, 15, 4893, 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 TestParseCheckLevel(t *testing.T) { expected := make(map[string]checks.CheckStatus) expected["Warning"] = checks.Warning expected["WARNING"] = checks.Warning expected["warning"] = checks.Warning expected["WaRnInG"] = checks.Warning expected["Critical"] = checks.Critical expected["CRITICAL"] = checks.Critical expected["critical"] = checks.Critical expected["CrItIcAl"] = checks.Critical expected["Pass"] = checks.Pass expected["pass"] = checks.Pass expected["PASS"] = checks.Pass expected["PaSs"] = checks.Pass expected["Resolved"] = checks.Resolved expected["resolved"] = checks.Resolved expected["RESOLVED"] = checks.Resolved expected["ReSoLvEd"] = checks.Resolved for input, expectedOutput := range expected { output, err := parseCheckLevel(input) assert.NoError(t, err) assert.Equal(t, expectedOutput, output) } _, err := parseCheckLevel("invalid-check-level") assert.Error(t, err) }
explode_data.jsonl/42336
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 296 }
[ 2830, 3393, 14463, 3973, 4449, 1155, 353, 8840, 836, 8, 341, 42400, 1669, 1281, 9147, 14032, 60, 49383, 10600, 2522, 340, 42400, 1183, 12087, 1341, 284, 12341, 51763, 198, 42400, 1183, 32704, 1341, 284, 12341, 51763, 198, 42400, 1183, 189...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestDBAppenderAddRef(t *testing.T) { db, delete := openTestDB(t, nil) defer func() { testutil.Ok(t, db.Close()) delete() }() app1 := db.Appender() ref1, err := app1.Add(labels.FromStrings("a", "b"), 123, 0) testutil.Ok(t, err) // Reference should already work before commit. err = app1.AddFast(ref1, 124, 1) testutil.Ok(t, err) err = app1.Commit() testutil.Ok(t, err) app2 := db.Appender() // first ref should already work in next transaction. err = app2.AddFast(ref1, 125, 0) testutil.Ok(t, err) ref2, err := app2.Add(labels.FromStrings("a", "b"), 133, 1) testutil.Ok(t, err) testutil.Assert(t, ref1 == ref2, "") // Reference must be valid to add another sample. err = app2.AddFast(ref2, 143, 2) testutil.Ok(t, err) err = app2.AddFast(9999999, 1, 1) testutil.Equals(t, ErrNotFound, errors.Cause(err)) testutil.Ok(t, app2.Commit()) q, err := db.Querier(0, 200) testutil.Ok(t, err) res := query(t, q, labels.NewEqualMatcher("a", "b")) testutil.Equals(t, map[string][]tsdbutil.Sample{ labels.FromStrings("a", "b").String(): { sample{t: 123, v: 0}, sample{t: 124, v: 1}, sample{t: 125, v: 0}, sample{t: 133, v: 1}, sample{t: 143, v: 2}, }, }, res) }
explode_data.jsonl/64362
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 538 }
[ 2830, 3393, 3506, 2164, 1659, 2212, 3945, 1155, 353, 8840, 836, 8, 341, 20939, 11, 3698, 1669, 1787, 2271, 3506, 1155, 11, 2092, 340, 16867, 2915, 368, 341, 197, 18185, 1314, 54282, 1155, 11, 2927, 10421, 2398, 197, 15618, 741, 197, 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 TestSqlSecretKeeper_GetSecret(t *testing.T) { keeper := SqlSecretKeeper{ nil, "apps", "app_key", "app_secret", } _, err := keeper.GetSecret("thekey") assert.NotNil(t, err) keeper.Db = getdb() _, err = keeper.GetSecret("thekey") assert.NotNil(t, err) val, _ := sqlKeeper.GetSecret("thekey") assert.True(t, len(val) > 0) }
explode_data.jsonl/38397
{ "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, 8269, 19773, 77233, 13614, 19773, 1155, 353, 8840, 836, 8, 341, 197, 18861, 1669, 7224, 19773, 77233, 515, 197, 84131, 345, 197, 197, 1, 27635, 756, 197, 197, 1, 676, 3097, 756, 197, 197, 1, 676, 21962, 756, 197, 532, 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 TestEngineBlockingChitRequest(t *testing.T) { vdr, _, sender, vm, te, gBlk := setup(t) sender.Default(true) missingBlk := &Blk{ parent: gBlk, id: GenerateID(), status: choices.Unknown, bytes: []byte{1}, } parentBlk := &Blk{ parent: missingBlk, id: GenerateID(), status: choices.Processing, bytes: []byte{1}, } blockingBlk := &Blk{ parent: parentBlk, id: GenerateID(), status: choices.Processing, bytes: []byte{1}, } te.insert(parentBlk) vm.ParseBlockF = func(b []byte) (snowman.Block, error) { switch { case bytes.Equal(b, blockingBlk.Bytes()): return blockingBlk, nil default: t.Fatalf("Loaded unknown block") panic("Should have failed") } } vm.GetBlockF = func(blkID ids.ID) (snowman.Block, error) { switch { case blkID.Equals(blockingBlk.ID()): return blockingBlk, nil default: t.Fatalf("Loaded unknown block") panic("Should have failed") } } te.PushQuery(vdr.ID(), 0, blockingBlk.ID(), blockingBlk.Bytes()) if len(te.blocked) != 3 { t.Fatalf("Both inserts should be blocking in addition to the chit request") } sender.CantPushQuery = false sender.CantChits = false missingBlk.status = choices.Processing te.insert(missingBlk) if len(te.blocked) != 0 { t.Fatalf("Both inserts should not longer be blocking") } }
explode_data.jsonl/3570
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 555 }
[ 2830, 3393, 4571, 48266, 1143, 275, 1900, 1155, 353, 8840, 836, 8, 341, 5195, 3612, 11, 8358, 4646, 11, 10995, 11, 1013, 11, 342, 4923, 74, 1669, 6505, 1155, 692, 1903, 1659, 13275, 3715, 692, 197, 30616, 4923, 74, 1669, 609, 4923, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestMapProxy_Replace(t *testing.T) { mp.Put("testingKey1", "testingValue1") replaced, err := mp.Replace("testingKey1", "testingValue2") AssertEqualf(t, err, replaced, "testingValue1", "Map Replace returned wrong old value.") newValue, err := mp.Get("testingKey1") AssertEqualf(t, err, newValue, "testingValue2", "Map Replace failed.") mp.Clear() }
explode_data.jsonl/56997
{ "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, 2227, 16219, 62, 23107, 1155, 353, 8840, 836, 8, 341, 53230, 39825, 445, 8840, 1592, 16, 497, 330, 8840, 1130, 16, 1138, 17200, 36369, 11, 1848, 1669, 10490, 20858, 445, 8840, 1592, 16, 497, 330, 8840, 1130, 17, 1138, 1801...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestAuthServer_LoginAPIKey(t *testing.T) { ctrl := gomock.NewController(t) defer ctrl.Finish() _, mockClients, cleanup := testutils.CreateTestAPIEnv(t) defer cleanup() md := map[string][]string{ "pixie-api-key": []string{"test-token"}, } ctx := metadata.NewIncomingContext(context.Background(), md) mockClients.MockAuth.EXPECT().GetAugmentedTokenForAPIKey(gomock.Any(), &authpb.GetAugmentedTokenForAPIKeyRequest{ APIKey: "test-token", }). Return(&authpb.GetAugmentedTokenForAPIKeyResponse{ Token: "auth-token", ExpiresAt: 10, }, nil) authServer := &controllers.AuthServer{mockClients.MockAuth} resp, err := authServer.Login(ctx, &cloudpb.LoginRequest{}) require.NoError(t, err) assert.Equal(t, &cloudpb.LoginReply{ Token: "auth-token", ExpiresAt: 10, }, resp) }
explode_data.jsonl/37840
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 316 }
[ 2830, 3393, 5087, 5475, 79232, 7082, 1592, 1155, 353, 8840, 836, 8, 341, 84381, 1669, 342, 316, 1176, 7121, 2051, 1155, 340, 16867, 23743, 991, 18176, 2822, 197, 6878, 7860, 47174, 11, 21290, 1669, 1273, 6031, 7251, 2271, 7082, 14359, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestGetCacheControlOpts(t *testing.T) { testCases := []struct { cacheControlHeaderVal string expiryHeaderVal string expectedCacheControl cacheControl expectedErr bool }{ {"", "", cacheControl{}, false}, {"max-age=2592000, public", "", cacheControl{maxAge: 2592000, sMaxAge: 0, minFresh: 0, expiry: time.Time{}, exclude: false}, false}, {"max-age=2592000, no-store", "", cacheControl{maxAge: 2592000, sMaxAge: 0, minFresh: 0, expiry: time.Time{}, exclude: true}, false}, {"must-revalidate, max-age=600", "", cacheControl{maxAge: 600, sMaxAge: 0, minFresh: 0, expiry: time.Time{}, exclude: true}, false}, {"s-maxAge=2500, max-age=600", "", cacheControl{maxAge: 600, sMaxAge: 2500, minFresh: 0, expiry: time.Time{}, exclude: false}, false}, {"s-maxAge=2500, max-age=600", "Wed, 21 Oct 2015 07:28:00 GMT", cacheControl{maxAge: 600, sMaxAge: 2500, minFresh: 0, expiry: time.Date(2015, time.October, 21, 07, 28, 00, 00, time.UTC), exclude: false}, false}, {"s-maxAge=2500, max-age=600s", "", cacheControl{maxAge: 600, sMaxAge: 2500, minFresh: 0, expiry: time.Time{}, exclude: false}, true}, } var m map[string]string for i, testCase := range testCases { m = make(map[string]string) m["cache-control"] = testCase.cacheControlHeaderVal if testCase.expiryHeaderVal != "" { m["expires"] = testCase.expiryHeaderVal } c, err := getCacheControlOpts(m) if testCase.expectedErr && err == nil { t.Errorf("expected err for case %d", i) } if !testCase.expectedErr && !reflect.DeepEqual(c, testCase.expectedCacheControl) { t.Errorf("expected %v got %v for case %d", testCase.expectedCacheControl, c, i) } } }
explode_data.jsonl/74498
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 645 }
[ 2830, 3393, 1949, 8233, 3273, 43451, 1155, 353, 8840, 836, 8, 341, 18185, 37302, 1669, 3056, 1235, 341, 197, 52680, 3273, 4047, 2208, 914, 198, 197, 48558, 33770, 4047, 2208, 981, 914, 198, 197, 42400, 8233, 3273, 220, 6500, 3273, 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...
7
func TestColIdent(t *testing.T) { str := NewColIdent("Ab") if str.String() != "Ab" { t.Errorf("String=%s, want Ab", str.String()) } if str.String() != "Ab" { t.Errorf("Val=%s, want Ab", str.String()) } if str.Lowered() != "ab" { t.Errorf("Val=%s, want ab", str.Lowered()) } if !str.Equal(NewColIdent("aB")) { t.Error("str.Equal(NewColIdent(aB))=false, want true") } if !str.EqualString("ab") { t.Error("str.EqualString(ab)=false, want true") } str = NewColIdent("") if str.Lowered() != "" { t.Errorf("Val=%s, want \"\"", str.Lowered()) } }
explode_data.jsonl/3382
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 257 }
[ 2830, 3393, 6127, 28301, 1155, 353, 8840, 836, 8, 341, 11355, 1669, 1532, 6127, 28301, 445, 5830, 1138, 743, 607, 6431, 368, 961, 330, 5830, 1, 341, 197, 3244, 13080, 445, 703, 7846, 82, 11, 1366, 3680, 497, 607, 6431, 2398, 197, 53...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestUpdateBondedValidatorsDecreaseCliff(t *testing.T) { numVals := 10 maxVals := 5 // create context, keeper, and pool for tests app, ctx, _, valAddrs := bootstrapValidatorTest(t, 0, 100) bondedPool := app.StakingKeeper.GetBondedPool(ctx) notBondedPool := app.StakingKeeper.GetNotBondedPool(ctx) // create keeper parameters params := app.StakingKeeper.GetParams(ctx) params.MaxValidators = uint32(maxVals) app.StakingKeeper.SetParams(ctx, params) // create a random pool app.BankKeeper.SetBalances(ctx, bondedPool.GetAddress(), sdk.NewCoins(sdk.NewCoin(app.StakingKeeper.BondDenom(ctx), sdk.TokensFromConsensusPower(1234)))) app.BankKeeper.SetBalances(ctx, notBondedPool.GetAddress(), sdk.NewCoins(sdk.NewCoin(app.StakingKeeper.BondDenom(ctx), sdk.TokensFromConsensusPower(10000)))) app.SupplyKeeper.SetModuleAccount(ctx, bondedPool) app.SupplyKeeper.SetModuleAccount(ctx, notBondedPool) validators := make([]types.Validator, numVals) for i := 0; i < len(validators); i++ { moniker := fmt.Sprintf("val#%d", int64(i)) val := types.NewValidator(valAddrs[i], PKs[i], types.Description{Moniker: moniker}) delTokens := sdk.TokensFromConsensusPower(int64((i + 1) * 10)) val, _ = val.AddTokensFromDel(delTokens) val = keeper.TestingUpdateValidator(app.StakingKeeper, ctx, val, true) validators[i] = val } nextCliffVal := validators[numVals-maxVals+1] // remove enough tokens to kick out the validator below the current cliff // validator and next in line cliff validator app.StakingKeeper.DeleteValidatorByPowerIndex(ctx, nextCliffVal) shares := sdk.TokensFromConsensusPower(21) nextCliffVal, _ = nextCliffVal.RemoveDelShares(shares.ToDec()) nextCliffVal = keeper.TestingUpdateValidator(app.StakingKeeper, ctx, nextCliffVal, true) expectedValStatus := map[int]sdk.BondStatus{ 9: sdk.Bonded, 8: sdk.Bonded, 7: sdk.Bonded, 5: sdk.Bonded, 4: sdk.Bonded, 0: sdk.Unbonding, 1: sdk.Unbonding, 2: sdk.Unbonding, 3: sdk.Unbonding, 6: sdk.Unbonding, } // require all the validators have their respective statuses for valIdx, status := range expectedValStatus { valAddr := validators[valIdx].OperatorAddress val, _ := app.StakingKeeper.GetValidator(ctx, valAddr) assert.Equal( t, status, val.GetStatus(), fmt.Sprintf("expected validator at index %v to have status: %s", valIdx, status), ) } }
explode_data.jsonl/6094
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 891 }
[ 2830, 3393, 4289, 89844, 291, 31748, 94843, 519, 5066, 3092, 1155, 353, 8840, 836, 8, 341, 22431, 52452, 1669, 220, 16, 15, 198, 22543, 52452, 1669, 220, 20, 271, 197, 322, 1855, 2266, 11, 53416, 11, 323, 7314, 369, 7032, 198, 28236, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestGetDaemonEndpointsFromStringInvalid1(t *testing.T) { // "udp:127.0.0.5:2001 udp:127.0.0.5:2001" udpAddr := "127.0.0.2:2001" tcpAddr := "127.0.0.1:2000" dAddr := "udp:" + udpAddr + " udp:" + tcpAddr dEndpt, err := GetDaemonEndpointsFromString(dAddr) assert.NotNil(t, err) assert.True(t, strings.Contains(fmt.Sprint(err), addrErr)) assert.Nil(t, dEndpt) }
explode_data.jsonl/49936
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 178 }
[ 2830, 3393, 1949, 89177, 80786, 44491, 7928, 16, 1155, 353, 8840, 836, 8, 314, 442, 330, 31101, 25, 16, 17, 22, 13, 15, 13, 15, 13, 20, 25, 17, 15, 15, 16, 49219, 25, 16, 17, 22, 13, 15, 13, 15, 13, 20, 25, 17, 15, 15, 16,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestWhiteList(t *testing.T) { testCases := []struct { desc string labels map[string]string expected *types.WhiteList }{ { desc: "should return nil when no white list labels", labels: map[string]string{}, expected: nil, }, { desc: "should return a struct when deprecated label", labels: map[string]string{ TraefikFrontendWhitelistSourceRange: "10.10.10.10", }, expected: &types.WhiteList{ SourceRange: []string{ "10.10.10.10", }, UseXForwardedFor: false, }, }, { desc: "should return a struct when only range", labels: map[string]string{ TraefikFrontendWhiteListSourceRange: "10.10.10.10", }, expected: &types.WhiteList{ SourceRange: []string{ "10.10.10.10", }, UseXForwardedFor: false, }, }, { desc: "should return a struct when range and UseXForwardedFor", labels: map[string]string{ TraefikFrontendWhiteListSourceRange: "10.10.10.10", TraefikFrontendWhiteListUseXForwardedFor: "true", }, expected: &types.WhiteList{ SourceRange: []string{ "10.10.10.10", }, UseXForwardedFor: true, }, }, { desc: "should return a struct when mix deprecated label and new labels", labels: map[string]string{ TraefikFrontendWhitelistSourceRange: "20.20.20.20", TraefikFrontendWhiteListSourceRange: "10.10.10.10", TraefikFrontendWhiteListUseXForwardedFor: "true", }, expected: &types.WhiteList{ SourceRange: []string{ "10.10.10.10", }, UseXForwardedFor: true, }, }, { desc: "should return nil when only UseXForwardedFor", labels: map[string]string{ TraefikFrontendWhiteListUseXForwardedFor: "true", }, expected: nil, }, } for _, test := range testCases { test := test t.Run(test.desc, func(t *testing.T) { t.Parallel() actual := GetWhiteList(test.labels) assert.Equal(t, test.expected, actual) }) } }
explode_data.jsonl/51857
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 868 }
[ 2830, 3393, 14075, 852, 1155, 353, 8840, 836, 8, 341, 18185, 37302, 1669, 3056, 1235, 341, 197, 41653, 257, 914, 198, 197, 95143, 256, 2415, 14032, 30953, 198, 197, 42400, 353, 9242, 20723, 852, 198, 197, 59403, 197, 197, 515, 298, 41...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestRoleDelete(t *testing.T) { _, roleServ := initRoleTest() samples := []struct { fix types.FixedCol err error }{ { fix: types.FixedCol{ ID: 7, CompanyID: 1001, NodeID: 101, }, err: nil, }, { fix: types.FixedCol{ ID: 99999999, CompanyID: 1001, NodeID: 101, }, err: errors.New("record not found"), }, } for _, v := range samples { _, err := roleServ.Delete(v.fix) if (v.err == nil && err != nil) || (v.err != nil && err == nil) { t.Errorf("ERROR FOR ::::%+v::: \nRETURNS :::%+v:::, \nIT SHOULD BE :::%+v:::", v.fix.ID, err, v.err) } } }
explode_data.jsonl/15123
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 321 }
[ 2830, 3393, 9030, 6435, 1155, 353, 8840, 836, 8, 341, 197, 6878, 3476, 39159, 1669, 2930, 9030, 2271, 2822, 1903, 4023, 1669, 3056, 1235, 341, 197, 1166, 941, 4494, 35571, 6127, 198, 197, 9859, 1465, 198, 197, 59403, 197, 197, 515, 29...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
6
func TestPageWithZeroFile(t *testing.T) { newTestSitesBuilder(t).WithLogger(loggers.NewWarningLogger()).WithSimpleConfigFile(). WithTemplatesAdded("index.html", "{{ .File.Filename }}{{ with .File }}{{ .Dir }}{{ end }}").Build(BuildCfg{}) }
explode_data.jsonl/60634
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 86 }
[ 2830, 3393, 2665, 2354, 17999, 1703, 1155, 353, 8840, 836, 8, 341, 8638, 2271, 93690, 3297, 1155, 568, 2354, 7395, 12531, 10637, 7121, 12087, 7395, 6011, 2354, 16374, 2648, 1703, 25829, 197, 197, 2354, 51195, 19337, 445, 1252, 2564, 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 TestWSBasicAuth(t *testing.T) { for _, test := range []struct { name string opts func() *Options user string pass string err string }{ { "top level auth, no override, wrong u/p", func() *Options { o := testWSOptions() o.Username = "normal" o.Password = "client" return o }, "websocket", "client", "-ERR 'Authorization Violation'", }, { "top level auth, no override, correct u/p", func() *Options { o := testWSOptions() o.Username = "normal" o.Password = "client" return o }, "normal", "client", "", }, { "no top level auth, ws auth, wrong u/p", func() *Options { o := testWSOptions() o.Websocket.Username = "websocket" o.Websocket.Password = "client" return o }, "normal", "client", "-ERR 'Authorization Violation'", }, { "no top level auth, ws auth, correct u/p", func() *Options { o := testWSOptions() o.Websocket.Username = "websocket" o.Websocket.Password = "client" return o }, "websocket", "client", "", }, { "top level auth, ws override, wrong u/p", func() *Options { o := testWSOptions() o.Username = "normal" o.Password = "client" o.Websocket.Username = "websocket" o.Websocket.Password = "client" return o }, "normal", "client", "-ERR 'Authorization Violation'", }, { "top level auth, ws override, correct u/p", func() *Options { o := testWSOptions() o.Username = "normal" o.Password = "client" o.Websocket.Username = "websocket" o.Websocket.Password = "client" return o }, "websocket", "client", "", }, } { t.Run(test.name, func(t *testing.T) { o := test.opts() s := RunServer(o) defer s.Shutdown() wsc, br, _ := testWSCreateClientGetInfo(t, false, false, o.Websocket.Host, o.Websocket.Port) defer wsc.Close() connectProto := fmt.Sprintf("CONNECT {\"verbose\":false,\"protocol\":1,\"user\":\"%s\",\"pass\":\"%s\"}\r\nPING\r\n", test.user, test.pass) wsmsg := testWSCreateClientMsg(wsBinaryMessage, 1, true, false, []byte(connectProto)) if _, err := wsc.Write(wsmsg); err != nil { t.Fatalf("Error sending message: %v", err) } msg := testWSReadFrame(t, br) if test.err == "" && !bytes.HasPrefix(msg, []byte("PONG\r\n")) { t.Fatalf("Expected to receive PONG, got %q", msg) } else if test.err != "" && !bytes.HasPrefix(msg, []byte(test.err)) { t.Fatalf("Expected to receive %q, got %q", test.err, msg) } }) } }
explode_data.jsonl/42727
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1147 }
[ 2830, 3393, 7433, 15944, 5087, 1155, 353, 8840, 836, 8, 341, 2023, 8358, 1273, 1669, 2088, 3056, 1235, 341, 197, 11609, 914, 198, 197, 64734, 2915, 368, 353, 3798, 198, 197, 19060, 914, 198, 197, 41431, 914, 198, 197, 9859, 220, 914, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestTwilioVoiceStop(t *testing.T) { t.Parallel() sql := ` insert into users (id, name, email) values ({{uuid "user"}}, 'bob', 'joe'); insert into user_contact_methods (id, user_id, name, type, value) values ({{uuid "cm1"}}, {{uuid "user"}}, 'personal', 'VOICE', {{phone "1"}}), ({{uuid "cm2"}}, {{uuid "user"}}, 'personal', 'SMS', {{phone "1"}}); insert into user_notification_rules (user_id, contact_method_id, delay_minutes) values ({{uuid "user"}}, {{uuid "cm1"}}, 0), ({{uuid "user"}}, {{uuid "cm1"}}, 1), ({{uuid "user"}}, {{uuid "cm2"}}, 1); insert into escalation_policies (id, name) values ({{uuid "eid"}}, 'esc policy'); insert into escalation_policy_steps (id, escalation_policy_id) values ({{uuid "esid"}}, {{uuid "eid"}}); insert into escalation_policy_actions (escalation_policy_step_id, user_id) values ({{uuid "esid"}}, {{uuid "user"}}); insert into services (id, escalation_policy_id, name) values ({{uuid "sid"}}, {{uuid "eid"}}, 'service'); insert into alerts (service_id, description) values ({{uuid "sid"}}, 'testing'); ` h := harness.NewHarness(t, sql, "ids-to-uuids") defer h.Close() d1 := h.Twilio().Device(h.Phone("1")) d1.ExpectVoice("testing"). ThenPress("1"). ThenExpect("unenrollment"). ThenPress("3"). ThenExpect("goodbye") // should not unenroll from SMS d1.ExpectSMS("test") // should unenroll only from VOICE h.Twilio().WaitAndAssert() }
explode_data.jsonl/37353
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 594 }
[ 2830, 3393, 22816, 33329, 51167, 10674, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 2822, 30633, 1669, 22074, 59847, 1119, 3847, 320, 307, 11, 829, 11, 2551, 8, 715, 45939, 715, 197, 197, 2306, 90, 17128, 330, 872, 9207, 2137, 36...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestSigning(t *testing.T) { sr := newRequest(1) sr.UnsignedJSON = fmt.Sprintf(`{"camliVersion": 1, "foo": "fooVal", "camliSigner": %q }`, pubKeyBlob1.BlobRef().String()) signed, err := sr.Sign(ctxbg) AssertNil(t, err, "no error signing") Assert(t, strings.Contains(signed, `"camliSig":`), "got a camliSig") vr := NewVerificationRequest(signed, testFetcher) if _, err := vr.Verify(ctxbg); err != nil { t.Fatalf("verification failed on signed json [%s]: %v", signed, err) } ExpectString(t, "fooVal", vr.PayloadMap["foo"].(string), "PayloadMap") ExpectString(t, "2931A67C26F5ABDA", vr.SignerKeyId, "SignerKeyId") // Test a non-matching signature. fakeSigned := strings.Replace(signed, pubKeyBlob1.BlobRef().String(), pubKeyBlob2.BlobRef().String(), 1) vr = NewVerificationRequest(fakeSigned, testFetcher) if _, err := vr.Verify(ctxbg); err == nil { t.Fatalf("unexpected verification of faked signature") } AssertErrorContains(t, vr.Err, "openpgp: invalid signature: hash tag doesn't match", "expected signature verification error") t.Logf("TODO: verify GPG-vs-Go sign & verify interop both ways, once implemented.") }
explode_data.jsonl/44737
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 439 }
[ 2830, 3393, 93358, 1155, 353, 8840, 836, 8, 341, 1903, 81, 1669, 501, 1900, 7, 16, 340, 1903, 81, 10616, 2215, 5370, 284, 8879, 17305, 5809, 4913, 11599, 742, 5637, 788, 220, 16, 11, 330, 7975, 788, 330, 7975, 2208, 497, 330, 11599,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestJobSpecsController_Show_FluxMonitorJob(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() j := cltest.NewJobWithFluxMonitorInitiator() app.Store.CreateJob(&j) resp, cleanup := client.Get("/v2/specs/" + j.ID.String()) defer cleanup() cltest.AssertServerResponse(t, resp, http.StatusOK) var respJob presenters.JobSpec require.NoError(t, cltest.ParseJSONAPIResponse(t, resp, &respJob)) require.Equal(t, len(respJob.Initiators), len(j.Initiators)) require.Equal(t, respJob.Initiators[0].Address, j.Initiators[0].Address) require.Equal(t, respJob.Initiators[0].RequestData, j.Initiators[0].RequestData) require.Equal(t, respJob.Initiators[0].Feeds, j.Initiators[0].Feeds) require.Equal(t, respJob.Initiators[0].Threshold, j.Initiators[0].Threshold) require.Equal(t, respJob.Initiators[0].AbsoluteThreshold, j.Initiators[0].AbsoluteThreshold) require.Equal(t, respJob.Initiators[0].IdleTimer, j.Initiators[0].IdleTimer) require.Equal(t, respJob.Initiators[0].PollTimer, j.Initiators[0].PollTimer) require.Equal(t, respJob.Initiators[0].Precision, j.Initiators[0].Precision) }
explode_data.jsonl/31819
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 538 }
[ 2830, 3393, 12245, 8327, 82, 2051, 79665, 1400, 62859, 30098, 12245, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 2822, 7000, 3992, 2959, 11, 633, 71, 2959, 11, 8358, 2060, 72577, 20960, 1669, 1185, 1944, 7121, 65390, 11571, 16056, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestHelmWithMissingValueFiles(t *testing.T) { service := newService("../..") missingValuesFile := "values-prod-overrides.yaml" req := &apiclient.ManifestRequest{ Repo: &argoappv1.Repository{}, AppName: "test", ApplicationSource: &argoappv1.ApplicationSource{ Path: "./util/helm/testdata/redis", Helm: &argoappv1.ApplicationSourceHelm{ ValueFiles: []string{"values-production.yaml", missingValuesFile}, }, }, } // Should fail since we're passing a non-existent values file, and error should indicate that _, err := service.GenerateManifest(context.Background(), req) assert.Error(t, err) assert.Contains(t, err.Error(), fmt.Sprintf("%s: no such file or directory", missingValuesFile)) // Should template without error even if defining a non-existent values file req.ApplicationSource.Helm.IgnoreMissingValueFiles = true _, err = service.GenerateManifest(context.Background(), req) assert.NoError(t, err) }
explode_data.jsonl/5675
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 318 }
[ 2830, 3393, 39, 23162, 2354, 25080, 1130, 10809, 1155, 353, 8840, 836, 8, 341, 52934, 1669, 501, 1860, 17409, 496, 1138, 197, 30616, 6227, 1703, 1669, 330, 3661, 9838, 67, 28252, 18245, 33406, 1837, 24395, 1669, 609, 391, 292, 1451, 722...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestReturnsAnnotatedPodRole(t *testing.T) { defer leaktest.Check(t)() ctx, cancel := context.WithCancel(context.Background()) defer cancel() source := kt.NewFakeControllerSource() defer source.Shutdown() source.Add(testutil.NewPodWithRole("ns", "name", "192.168.0.1", "Running", "running_role")) podCache := k8s.NewPodCache(sts.DefaultResolver("arn:account:"), source, time.Second, defaultBuffer) podCache.Run(ctx) server := &KiamServer{pods: podCache, assumePolicy: &allowPolicy{}, credentialsProvider: &stubCredentialsProvider{accessKey: "A1234"}} r, _ := server.GetPodRole(ctx, &pb.GetPodRoleRequest{Ip: "192.168.0.1"}) if r.GetName() != "running_role" { t.Error("expected running_role, was", r.GetName()) } }
explode_data.jsonl/43096
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 266 }
[ 2830, 3393, 16446, 2082, 87029, 23527, 9030, 1155, 353, 8840, 836, 8, 341, 16867, 23352, 1944, 10600, 1155, 8, 741, 20985, 11, 9121, 1669, 2266, 26124, 9269, 5378, 19047, 2398, 16867, 9121, 2822, 47418, 1669, 18541, 7121, 52317, 2051, 360...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestPublishWithSourceIdInPayload(t *testing.T) { subject, requestPayload := buildDefaultTestSubjectAndPayload() sub, _ := sc.Subscribe(subject, func(m *stan.Msg) { msg = m }) responseBody, statusCode := performPublishRequest(t, publishServer.URL, requestPayload) verifyPublish(t, statusCode, sub, responseBody, requestPayload) }
explode_data.jsonl/74406
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 111 }
[ 2830, 3393, 50145, 2354, 3608, 764, 641, 29683, 1155, 353, 8840, 836, 8, 341, 28624, 583, 11, 1681, 29683, 1669, 1936, 3675, 2271, 13019, 3036, 29683, 741, 28624, 11, 716, 1669, 1136, 82628, 29128, 11, 2915, 1255, 353, 24025, 30365, 8, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestStorageBoxClient_List(t *testing.T) { client, s := testServer(t) defer s.Close() l, err := client.StorageBox().List() require.NoError(t, err) expected := []*StorageBoxSummary{ { ID: 123, Login: "u1234", Name: "", Product: "BX10 - inclusive", Cancelled: false, Locked: false, Location: "FSN1", LinkedServer: 4567, PaidUntil: "2021-12-31", }, } require.Equal(t, expected, l) }
explode_data.jsonl/45862
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 237 }
[ 2830, 3393, 5793, 1611, 2959, 27104, 1155, 353, 8840, 836, 8, 341, 25291, 11, 274, 1669, 1273, 5475, 1155, 340, 16867, 274, 10421, 2822, 8810, 11, 1848, 1669, 2943, 43771, 1611, 1005, 852, 741, 17957, 35699, 1155, 11, 1848, 692, 42400, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestCanvas_Dragged(t *testing.T) { dragged := false var draggedObj fyne.Draggable scroll := container.NewScroll(widget.NewLabel("Hi\nHi\nHi")) c := NewCanvas().(*mobileCanvas) c.SetContent(scroll) c.resize(fyne.NewSize(40, 24)) assert.Equal(t, float32(0), scroll.Offset.Y) c.tapDown(fyne.NewPos(32, 3), 0) c.tapMove(fyne.NewPos(32, 10), 0, func(wid fyne.Draggable, ev *fyne.DragEvent) { wid.Dragged(ev) dragged = true draggedObj = wid }) assert.True(t, dragged) assert.Equal(t, scroll, draggedObj) // TODO find a way to get the test driver to report as mobile dragged = false c.tapMove(fyne.NewPos(32, 5), 0, func(wid fyne.Draggable, ev *fyne.DragEvent) { wid.Dragged(ev) dragged = true }) }
explode_data.jsonl/43163
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 305 }
[ 2830, 3393, 18226, 1557, 4101, 3556, 1155, 353, 8840, 836, 8, 341, 2698, 4101, 3556, 1669, 895, 198, 2405, 37147, 5261, 51941, 811, 909, 4101, 35034, 198, 75746, 1669, 5476, 7121, 8425, 34690, 7121, 2476, 445, 13048, 1699, 13048, 1699, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestPickAvailabilityZone(t *testing.T) { testCases := []struct { name string testFunc func(t *testing.T) }{ { name: "requirement missing ", testFunc: func(t *testing.T) { expectedresponse := "" region := "test" actualresponse := pickAvailabilityZone(nil, region) if !reflect.DeepEqual(expectedresponse, actualresponse) { t.Errorf("actualresponse: (%v), expectedresponse: (%v)", actualresponse, expectedresponse) } }, }, { name: "valid get preferred", testFunc: func(t *testing.T) { expectedresponse := "test-01" region := "test" mp := make(map[string]string) mp["N/A"] = "test-01" topology := &csi.Topology{ Segments: mp, } topologies := []*csi.Topology{} topologies = append(topologies, topology) req := &csi.TopologyRequirement{ Preferred: topologies, } actualresponse := pickAvailabilityZone(req, region) if !reflect.DeepEqual(expectedresponse, actualresponse) { t.Errorf("actualresponse: (%v), expectedresponse: (%v)", actualresponse, expectedresponse) } }, }, { name: "valid get requisite", testFunc: func(t *testing.T) { expectedresponse := "test-01" region := "test" mp := make(map[string]string) mp["N/A"] = "test-01" topology := &csi.Topology{ Segments: mp, } topologies := []*csi.Topology{} topologies = append(topologies, topology) req := &csi.TopologyRequirement{ Requisite: topologies, } actualresponse := pickAvailabilityZone(req, region) if !reflect.DeepEqual(expectedresponse, actualresponse) { t.Errorf("actualresponse: (%v), expectedresponse: (%v)", actualresponse, expectedresponse) } }, }, { name: "empty request ", testFunc: func(t *testing.T) { req := &csi.TopologyRequirement{} expectedresponse := "" region := "test" actualresponse := pickAvailabilityZone(req, region) if !reflect.DeepEqual(expectedresponse, actualresponse) { t.Errorf("actualresponse: (%v), expectedresponse: (%v)", actualresponse, expectedresponse) } }, }, } for _, tc := range testCases { t.Run(tc.name, tc.testFunc) } }
explode_data.jsonl/59397
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 895 }
[ 2830, 3393, 36953, 51703, 15363, 1155, 353, 8840, 836, 8, 341, 18185, 37302, 1669, 3056, 1235, 341, 197, 11609, 257, 914, 198, 197, 18185, 9626, 2915, 1155, 353, 8840, 836, 340, 197, 59403, 197, 197, 515, 298, 11609, 25, 330, 4310, 47...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestSwitchAccount(t *testing.T) { th := Setup(t).InitBasic() defer th.TearDown() th.App.UpdateConfig(func(cfg *model.Config) { *cfg.GitLabSettings.Enable = true }) th.Client.Logout() sr := &model.SwitchRequest{ CurrentService: model.UserAuthServiceEmail, NewService: model.UserAuthServiceGitlab, Email: th.BasicUser.Email, Password: th.BasicUser.Password, } link, _, err := th.Client.SwitchAccountType(sr) require.NoError(t, err) require.NotEmpty(t, link, "bad link") th.App.Srv().SetLicense(model.NewTestLicense()) th.App.UpdateConfig(func(cfg *model.Config) { *cfg.ServiceSettings.ExperimentalEnableAuthenticationTransfer = false }) sr = &model.SwitchRequest{ CurrentService: model.UserAuthServiceEmail, NewService: model.UserAuthServiceGitlab, } _, resp, err := th.Client.SwitchAccountType(sr) require.Error(t, err) CheckForbiddenStatus(t, resp) th.LoginBasic() sr = &model.SwitchRequest{ CurrentService: model.UserAuthServiceSaml, NewService: model.UserAuthServiceEmail, Email: th.BasicUser.Email, NewPassword: th.BasicUser.Password, } _, resp, err = th.Client.SwitchAccountType(sr) require.Error(t, err) CheckForbiddenStatus(t, resp) sr = &model.SwitchRequest{ CurrentService: model.UserAuthServiceEmail, NewService: model.UserAuthServiceLdap, } _, resp, err = th.Client.SwitchAccountType(sr) require.Error(t, err) CheckForbiddenStatus(t, resp) sr = &model.SwitchRequest{ CurrentService: model.UserAuthServiceLdap, NewService: model.UserAuthServiceEmail, } _, resp, err = th.Client.SwitchAccountType(sr) require.Error(t, err) CheckForbiddenStatus(t, resp) th.App.UpdateConfig(func(cfg *model.Config) { *cfg.ServiceSettings.ExperimentalEnableAuthenticationTransfer = true }) th.LoginBasic() fakeAuthData := model.NewId() _, appErr := th.App.Srv().Store.User().UpdateAuthData(th.BasicUser.Id, model.UserAuthServiceGitlab, &fakeAuthData, th.BasicUser.Email, true) require.NoError(t, appErr) sr = &model.SwitchRequest{ CurrentService: model.UserAuthServiceGitlab, NewService: model.UserAuthServiceEmail, Email: th.BasicUser.Email, NewPassword: th.BasicUser.Password, } link, _, err = th.Client.SwitchAccountType(sr) require.NoError(t, err) require.Equal(t, "/login?extra=signin_change", link) th.Client.Logout() _, _, err = th.Client.Login(th.BasicUser.Email, th.BasicUser.Password) require.NoError(t, err) th.Client.Logout() sr = &model.SwitchRequest{ CurrentService: model.UserAuthServiceGitlab, NewService: model.ServiceGoogle, } _, resp, err = th.Client.SwitchAccountType(sr) require.Error(t, err) CheckBadRequestStatus(t, resp) sr = &model.SwitchRequest{ CurrentService: model.UserAuthServiceEmail, NewService: model.UserAuthServiceGitlab, Password: th.BasicUser.Password, } _, resp, err = th.Client.SwitchAccountType(sr) require.Error(t, err) CheckNotFoundStatus(t, resp) sr = &model.SwitchRequest{ CurrentService: model.UserAuthServiceEmail, NewService: model.UserAuthServiceGitlab, Email: th.BasicUser.Email, } _, resp, err = th.Client.SwitchAccountType(sr) require.Error(t, err) CheckUnauthorizedStatus(t, resp) sr = &model.SwitchRequest{ CurrentService: model.UserAuthServiceGitlab, NewService: model.UserAuthServiceEmail, Email: th.BasicUser.Email, NewPassword: th.BasicUser.Password, } _, resp, err = th.Client.SwitchAccountType(sr) require.Error(t, err) CheckUnauthorizedStatus(t, resp) }
explode_data.jsonl/47544
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1354 }
[ 2830, 3393, 16837, 7365, 1155, 353, 8840, 836, 8, 341, 70479, 1669, 18626, 1155, 568, 3803, 15944, 741, 16867, 270, 836, 682, 4454, 2822, 70479, 5105, 16689, 2648, 18552, 28272, 353, 2528, 10753, 8, 314, 353, 14072, 1224, 275, 29046, 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...
1
func TestStoreSendBadRange(t *testing.T) { defer leaktest.AfterTest(t)() stopper := stop.NewStopper() defer stopper.Stop(context.Background()) store, _ := createTestStore(t, testStoreOpts{createSystemRanges: true}, stopper) args := getArgs([]byte("0")) if _, pErr := kv.SendWrappedWith(context.Background(), store.TestSender(), roachpb.Header{ RangeID: 2, // no such range }, &args); pErr == nil { t.Error("expected invalid range") } }
explode_data.jsonl/95
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 165 }
[ 2830, 3393, 6093, 11505, 17082, 6046, 1155, 353, 8840, 836, 8, 341, 16867, 23352, 1944, 36892, 2271, 1155, 8, 741, 62644, 712, 1669, 2936, 7121, 10674, 712, 741, 16867, 2936, 712, 30213, 5378, 19047, 2398, 57279, 11, 716, 1669, 1855, 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...
2
func TestBlockingSend(t *testing.T) { // Scenario: Basic test that spawns 2 nodes and sends from the first node // to the second node, three SubmitRequests, or three consensus requests. // SubmitRequests should block, but consensus requests should not. for _, testCase := range []struct { description string messageToSend *orderer.StepRequest streamUnblocks bool elapsedGreaterThan time.Duration overflowErr string }{ { description: "SubmitRequest", messageToSend: wrapSubmitReq(testReq), streamUnblocks: true, elapsedGreaterThan: time.Second / 2, }, { description: "ConsensusRequest", messageToSend: testConsensusReq, overflowErr: "send queue overflown", }, } { t.Run(testCase.description, func(t *testing.T) { node1 := newTestNode(t) node2 := newTestNode(t) node1.c.SendBufferSize = 1 node2.c.SendBufferSize = 1 defer node1.stop() defer node2.stop() config := []cluster.RemoteNode{node1.nodeInfo, node2.nodeInfo} node1.c.Configure(testChannel, config) node2.c.Configure(testChannel, config) rm, err := node1.c.Remote(testChannel, node2.nodeInfo.ID) assert.NoError(t, err) client := &mocks.ClusterClient{} fakeStream := &mocks.StepClient{} // Replace real client with a mock client rm.Client = client rm.ProbeConn = func(_ *grpc.ClientConn) error { return nil } // Configure client to return the mock stream fakeStream.On("Context", mock.Anything).Return(context.Background()) client.On("Step", mock.Anything).Return(fakeStream, nil).Once() unBlock := make(chan struct{}) var sendInvoked sync.WaitGroup sendInvoked.Add(1) var once sync.Once fakeStream.On("Send", mock.Anything).Run(func(_ mock.Arguments) { once.Do(sendInvoked.Done) <-unBlock }).Return(errors.New("oops")) stream, err := rm.NewStream(time.Hour) assert.NoError(t, err) // The first send doesn't block, even though the Send operation blocks. err = stream.Send(testCase.messageToSend) assert.NoError(t, err) // The second once doesn't either. // After this point, we have 1 goroutine which is blocked on Send(), // and one message in the buffer. sendInvoked.Wait() err = stream.Send(testCase.messageToSend) assert.NoError(t, err) // The third blocks, so we need to unblock it ourselves // in order for it to go through, unless the operation // is non blocking. go func() { time.Sleep(time.Second) if testCase.streamUnblocks { close(unBlock) } }() t1 := time.Now() err = stream.Send(testCase.messageToSend) // The third send always overflows or blocks. // If we expect to receive an overflow error - assert it. if testCase.overflowErr != "" { assert.EqualError(t, err, testCase.overflowErr) } elapsed := time.Since(t1) t.Log("Elapsed time:", elapsed) assert.True(t, elapsed > testCase.elapsedGreaterThan) if !testCase.streamUnblocks { close(unBlock) } }) } }
explode_data.jsonl/39830
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1177 }
[ 2830, 3393, 48266, 11505, 1155, 353, 8840, 836, 8, 341, 197, 322, 58663, 25, 14625, 1273, 429, 92676, 220, 17, 7798, 323, 21308, 504, 279, 1156, 2436, 198, 197, 322, 311, 279, 2086, 2436, 11, 2326, 29170, 35295, 11, 476, 2326, 23869, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestEvaluateCondition_True2(t *testing.T) { condition := "services.frontend[0].name == \"angular\"" result := EvaluateCondition(condition, templateData, varMap) assert.True(t, result) }
explode_data.jsonl/67925
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 63 }
[ 2830, 3393, 82345, 10547, 93577, 17, 1155, 353, 8840, 836, 8, 341, 197, 9056, 1669, 330, 12779, 23445, 408, 58, 15, 936, 606, 621, 7245, 4234, 2105, 698, 9559, 1669, 54115, 10547, 47489, 11, 3811, 1043, 11, 762, 2227, 340, 6948, 32443...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestRoles(t *testing.T) { for _, tc := range rolesTests { gotRoles := make([]fuzzy.RuneRole, len(tc.str)) fuzzy.RuneRoles([]byte(tc.str), gotRoles) got := rolesString(gotRoles) if got != tc.want { t.Errorf("roles(%s) = %v; want %v", tc.str, got, tc.want) } } }
explode_data.jsonl/58124
{ "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, 25116, 1155, 353, 8840, 836, 8, 341, 2023, 8358, 17130, 1669, 2088, 12783, 18200, 341, 197, 3174, 354, 25116, 1669, 1281, 10556, 69, 34758, 2013, 2886, 9030, 11, 2422, 44415, 9528, 1171, 197, 1166, 34758, 2013, 2886, 25116, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func Test_hasSecretWhenSSLEnabled(t *testing.T) { helmChartParser := NewHelmConfigParser( NewHelmTest(t, helmChartRelativePath, map[string]string{ "traefik.enabled": "true", "traefik.ports.websecure.tls.enabled": "true", }), ) var deployment v12.Deployment helmChartParser.Find(SearchResourceOption{ Name: "pega-traefik", Kind: "Deployment", }, &deployment) require.Contains(t, deployment.Spec.Template.Spec.Containers[0].Args, "--entrypoints.websecure.http.tls=true") }
explode_data.jsonl/14602
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 208 }
[ 2830, 3393, 21778, 19773, 4498, 1220, 867, 77, 2312, 1155, 353, 8840, 836, 8, 341, 9598, 23162, 14488, 6570, 1669, 1532, 39, 23162, 2648, 6570, 1006, 197, 197, 3564, 39, 23162, 2271, 1155, 11, 33765, 14488, 28442, 1820, 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 TestCheckDatabaseNamesAndUsers(t *testing.T) { roleEmpty := &types.RoleV4{ Metadata: types.Metadata{Name: "roleA", Namespace: apidefaults.Namespace}, Spec: types.RoleSpecV4{ Options: types.RoleOptions{MaxSessionTTL: types.Duration(time.Hour)}, Allow: types.RoleConditions{ Namespaces: []string{apidefaults.Namespace}, }, }, } roleA := &types.RoleV4{ Metadata: types.Metadata{Name: "roleA", Namespace: apidefaults.Namespace}, Spec: types.RoleSpecV4{ Options: types.RoleOptions{MaxSessionTTL: types.Duration(2 * time.Hour)}, Allow: types.RoleConditions{ Namespaces: []string{apidefaults.Namespace}, DatabaseNames: []string{"postgres", "main"}, DatabaseUsers: []string{"postgres", "alice"}, }, }, } roleB := &types.RoleV4{ Metadata: types.Metadata{Name: "roleB", Namespace: apidefaults.Namespace}, Spec: types.RoleSpecV4{ Options: types.RoleOptions{MaxSessionTTL: types.Duration(time.Hour)}, Allow: types.RoleConditions{ Namespaces: []string{apidefaults.Namespace}, DatabaseNames: []string{"metrics"}, DatabaseUsers: []string{"bob"}, }, Deny: types.RoleConditions{ Namespaces: []string{apidefaults.Namespace}, DatabaseNames: []string{"postgres"}, DatabaseUsers: []string{"postgres"}, }, }, } testCases := []struct { name string roles RoleSet ttl time.Duration overrideTTL bool namesOut []string usersOut []string accessDenied bool notFound bool }{ { name: "single role", roles: RoleSet{roleA}, ttl: time.Hour, namesOut: []string{"postgres", "main"}, usersOut: []string{"postgres", "alice"}, }, { name: "combined roles", roles: RoleSet{roleA, roleB}, ttl: time.Hour, namesOut: []string{"main", "metrics"}, usersOut: []string{"alice", "bob"}, }, { name: "ttl doesn't match", roles: RoleSet{roleA}, ttl: 5 * time.Hour, accessDenied: true, }, { name: "empty role", roles: RoleSet{roleEmpty}, ttl: time.Hour, notFound: true, }, } for _, tc := range testCases { t.Run(tc.name, func(t *testing.T) { names, users, err := tc.roles.CheckDatabaseNamesAndUsers(tc.ttl, tc.overrideTTL) if tc.accessDenied { require.Error(t, err) require.True(t, trace.IsAccessDenied(err)) } else if tc.notFound { require.Error(t, err) require.True(t, trace.IsNotFound(err)) } else { require.NoError(t, err) require.ElementsMatch(t, tc.namesOut, names) require.ElementsMatch(t, tc.usersOut, users) } }) } }
explode_data.jsonl/40084
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1171 }
[ 2830, 3393, 3973, 5988, 7980, 3036, 7137, 1155, 353, 8840, 836, 8, 341, 197, 5778, 3522, 1669, 609, 9242, 35955, 53, 19, 515, 197, 9209, 7603, 25, 4494, 46475, 63121, 25, 330, 5778, 32, 497, 41962, 25, 1443, 577, 59572, 82, 46011, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestConcatStrings(t *testing.T) { cases := []struct { args []string expect string }{ { args: []string{}, expect: "", }, { args: nil, expect: "", }, { args: []string{"a", "", "b"}, expect: "ab", }, } var s string for _, c := range cases { s = ConcatStrings(c.args...) if s != c.expect { t.Errorf("the func return failed. expect: %s, actual: %s\n", c.expect, s) return } } }
explode_data.jsonl/76278
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 220 }
[ 2830, 3393, 78440, 20859, 1155, 353, 8840, 836, 8, 341, 1444, 2264, 1669, 3056, 1235, 341, 197, 31215, 256, 3056, 917, 198, 197, 24952, 914, 198, 197, 59403, 197, 197, 515, 298, 31215, 25, 256, 3056, 917, 38837, 298, 24952, 25, 8324, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestRouterMultiLevelWildcard(t *testing.T) { // Create empty handler h := new(Handler) // Create empty context c := new(Context) c.Params = Params{} // Create route r := Route("/a/b/*/d", h) // Matching routes rs := []string{"/a/b/c/d", "a/b/c/d", "/a/b/*/d", "a/b/something/d"} // Check for _, s := range rs { if !r.Match(s, c) { t.Errorf("'%s' should match against '/a/b/*/d", s) } } }
explode_data.jsonl/35796
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 187 }
[ 2830, 3393, 9523, 20358, 4449, 92988, 1155, 353, 8840, 836, 8, 341, 197, 322, 4230, 4287, 7013, 198, 9598, 1669, 501, 7, 3050, 692, 197, 322, 4230, 4287, 2266, 198, 1444, 1669, 501, 14001, 340, 1444, 58268, 284, 34352, 31483, 197, 322...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestSyncReadString(t *testing.T) { s := NewSyncScanner(strings.NewReader("\005\000\000\000hello")) str, err := s.ReadString() assert.NoError(t, err) assert.Equal(t, "hello", str) }
explode_data.jsonl/80530
{ "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, 12154, 4418, 703, 1155, 353, 8840, 836, 8, 341, 1903, 1669, 1532, 12154, 31002, 51442, 68587, 4921, 15, 15, 20, 59, 15, 15, 15, 59, 15, 15, 15, 59, 15, 15, 15, 14990, 5455, 11355, 11, 1848, 1669, 274, 96738, 741, 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, 1, 1, 1, 1, 1, 1 ]
1
func TestStartStoppedHost(t *testing.T) { RegisterMockDriver(t) api := tests.NewMockAPI(t) // Create an initial host. h, err := createHost(api, defaultMachineConfig) if err != nil { t.Fatalf("Error creating host: %v", err) } d := tests.MockDriver{T: t} h.Driver = &d d.CurrentState = state.Stopped md := &tests.MockDetector{Provisioner: &tests.MockProvisioner{}} provision.SetDetector(md) h, err = StartHost(api, defaultMachineConfig) if err != nil { t.Fatal("Error starting host.") } if h.Name != config.GetMachineName() { t.Fatalf("Machine created with incorrect name: %s", h.Name) } if s, _ := h.Driver.GetState(); s != state.Running { t.Fatalf("Machine not started.") } if !api.SaveCalled { t.Fatalf("Machine must be saved after starting.") } if !md.Provisioner.Provisioned { t.Fatalf("Expected provision to be called") } }
explode_data.jsonl/4182
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 328 }
[ 2830, 3393, 3479, 59803, 9296, 1155, 353, 8840, 836, 8, 341, 79096, 11571, 11349, 1155, 340, 54299, 1669, 7032, 7121, 11571, 7082, 1155, 340, 197, 322, 4230, 458, 2856, 3468, 624, 9598, 11, 1848, 1669, 1855, 9296, 24827, 11, 1638, 21605...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestLatLng_Clone(t *testing.T) { tests := []struct { Name string LL, Expected *LatLng }{ { Name: "nil latlng", }, { Name: "cloned", LL: &LatLng{ Lat: 10, Lng: 11, }, Expected: &LatLng{ Lat: 10, Lng: 11, }, }, } for _, tc := range tests { tc := tc t.Run(tc.Name, func(t *testing.T) { t.Parallel() res := tc.LL.Clone() assert.Equal(t, tc.Expected, res) if tc.Expected != nil { assert.NotSame(t, tc.Expected, res) } }) } }
explode_data.jsonl/10030
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 283 }
[ 2830, 3393, 64922, 85110, 603, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 3056, 1235, 341, 197, 21297, 260, 914, 198, 197, 93881, 11, 31021, 353, 64922, 198, 197, 59403, 197, 197, 515, 298, 21297, 25, 330, 8385, 6844, 20810, 756, 197,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestNew(t *testing.T) { regions := []string{"us-east-1", "us-west25"} cfg, _ := ptypes.MarshalAny(&awsv1.Config{ Regions: regions, }) log := zaptest.NewLogger(t) scope := tally.NewTestScope("", nil) s, err := New(cfg, log, scope) assert.NoError(t, err) // Test conformance to public interface. _, ok := s.(Client) assert.True(t, ok) // Test private interface. c, ok := s.(*client) assert.True(t, ok) assert.NotNil(t, c.log) assert.NotNil(t, c.scope) assert.Len(t, c.clients, len(regions)) addedRegions := make([]string, 0, len(regions)) for key, rc := range c.clients { addedRegions = append(addedRegions, key) assert.Equal(t, key, rc.region) } assert.ElementsMatch(t, addedRegions, regions) }
explode_data.jsonl/3398
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 300 }
[ 2830, 3393, 3564, 1155, 353, 8840, 836, 8, 341, 37013, 908, 1669, 3056, 917, 4913, 355, 39507, 12, 16, 497, 330, 355, 37602, 17, 20, 63159, 50286, 11, 716, 1669, 281, 9242, 37271, 8610, 2099, 672, 3492, 16, 10753, 515, 197, 197, 792...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestApplication_Serve(t *testing.T) { logger := yetlog.NewNullLogger() serverWrapper := NewEmbeddableServerWrapper(logger, 0) serverWrapperTestInstance, testPort := serverWrapper.createTestInstance(t) ctx, cancelFunc := context.WithCancel(context.Background()) t.Run("should successfully start a server", func(t *testing.T) { assert := assert.New(t) err := serverWrapperTestInstance.Serve(ctx, DefaultRoutesFunc) require.NoError(t, err) assert.Eventually(func() bool { isInUse, err := yetnet.IsPortInUse(testPort) require.NoError(t, err) return isInUse }, time.Second, 5*time.Millisecond) }) t.Run("should stop server successfully and execute afterShutdownFunc", func(t *testing.T) { assert := assert.New(t) shutdownChan := make(chan bool) afterShutdownFunc := func() { close(shutdownChan) } serverWrapperTestInstance.AddAfterShutdownFunc(afterShutdownFunc) cancelFunc() assert.Eventually(func() bool { <-shutdownChan isOpen, err := yetnet.IsPortOpen(testPort) require.NoError(t, err) return isOpen }, time.Second, 5*time.Millisecond) }) }
explode_data.jsonl/48258
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 410 }
[ 2830, 3393, 4988, 1098, 5852, 1155, 353, 8840, 836, 8, 341, 17060, 1669, 3602, 839, 7121, 3280, 7395, 741, 41057, 11542, 1669, 1532, 25486, 67, 480, 5475, 11542, 37833, 11, 220, 15, 692, 41057, 11542, 2271, 2523, 11, 1273, 7084, 1669, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestWorkflowYAMLAndBack(t *testing.T) { workflow := &Workflow{ Name: "testWorkflow", Version: "v0.0.0.0.1", TaskTemplates: []TaskTemplate{ TaskTemplate{ TaskName: "GetHTML", Initial: true, ActionTemplates: []ActionTemplate{ ActionTemplate{ Name: "HTTP1", StructName: "HTTPAction", ConstructorParams: map[string]Value{ "baseURL": Value{ ValueType: ValueTypeString, StringValue: "https://news.ycombinator.com/", }, "method": Value{ ValueType: ValueTypeString, StringValue: "GET", }, "canFail": Value{ ValueType: ValueTypeBool, BoolValue: false, }, }, }, ActionTemplate{ Name: "UTF8Decode", StructName: "UTF8DecodeAction", ConstructorParams: map[string]Value{}, }, ActionTemplate{ Name: "MakePromise", StructName: "TaskPromiseAction", ConstructorParams: map[string]Value{ "inputNames": Value{ ValueType: ValueTypeStrings, StringsValue: []string{"htmlStr1", "htmlStr2"}, }, "taskName": Value{ ValueType: ValueTypeString, StringValue: "ParseHTML", }, }, }, }, DataPipeTemplates: []DataPipeTemplate{ DataPipeTemplate{ SourceActionName: "HTTP1", SourceOutputName: HTTPActionOutputBody, DestActionName: "UTF8Decode", DestInputName: UTF8DecodeActionInputBytes, }, DataPipeTemplate{ SourceActionName: "UTF8Decode", SourceOutputName: UTF8DecodeActionOutputStr, DestActionName: "MakePromise", DestInputName: "htmlStr1", }, DataPipeTemplate{ SourceActionName: "UTF8Decode", SourceOutputName: UTF8DecodeActionOutputStr, DestActionName: "MakePromise", DestInputName: "htmlStr2", }, DataPipeTemplate{ SourceActionName: "MakePromise", SourceOutputName: TaskPromiseActionOutputPromise, TaskOutputName: "promise", }, }, }, TaskTemplate{ TaskName: "ParseHTML", Initial: false, ActionTemplates: []ActionTemplate{ ActionTemplate{ Name: "TitleExtraction", StructName: "XPathAction", ConstructorParams: map[string]Value{ "xpath": Value{ ValueType: ValueTypeString, StringValue: "//a[@class='storylink']/text()", }, "expectMany": Value{ ValueType: ValueTypeBool, BoolValue: true, }, }, }, ActionTemplate{ Name: "LinkExtraction", StructName: "XPathAction", ConstructorParams: map[string]Value{ "xpath": Value{ ValueType: ValueTypeString, StringValue: "//a[@class='storylink']/@href", }, "expectMany": Value{ ValueType: ValueTypeBool, BoolValue: true, }, }, }, ActionTemplate{ Name: "YieldItem", StructName: "FieldJoinAction", ConstructorParams: map[string]Value{ "inputNames": Value{ ValueType: ValueTypeStrings, StringsValue: []string{"title", "link"}, }, "itemName": Value{ ValueType: ValueTypeString, StringValue: "HNItem", }, }, }, }, DataPipeTemplates: []DataPipeTemplate{ DataPipeTemplate{ TaskInputName: "htmlStr1", DestActionName: "TitleExtraction", DestInputName: XPathActionInputHTMLStr, }, DataPipeTemplate{ TaskInputName: "htmlStr2", DestActionName: "LinkExtraction", DestInputName: XPathActionInputHTMLStr, }, DataPipeTemplate{ SourceActionName: "TitleExtraction", SourceOutputName: XPathActionOutputStr, DestActionName: "YieldItem", DestInputName: "title", }, DataPipeTemplate{ SourceActionName: "LinkExtraction", SourceOutputName: XPathActionOutputStr, DestActionName: "YieldItem", DestInputName: "link", }, DataPipeTemplate{ SourceActionName: "YieldItem", SourceOutputName: FieldJoinActionOutputItem, TaskOutputName: "items", }, }, }, }, } yamlStr := workflow.ToYAML() gotWorkflow := NewWorkflowFromYAML(yamlStr) assert.Equal(t, workflow, gotWorkflow) }
explode_data.jsonl/19591
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 2141 }
[ 2830, 3393, 62768, 56, 31102, 3036, 3707, 1155, 353, 8840, 836, 8, 341, 197, 56249, 1669, 609, 62768, 515, 197, 21297, 25, 262, 330, 1944, 62768, 756, 197, 77847, 25, 330, 85, 15, 13, 15, 13, 15, 13, 15, 13, 16, 756, 197, 81153, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestGetServiceLoadBalancer(t *testing.T) { testCases := []struct { desc string existingLBs []network.LoadBalancer service v1.Service annotations map[string]string sku string wantLB bool expectedLB *network.LoadBalancer expectedStatus *v1.LoadBalancerStatus expectedExists bool expectedError bool }{ { desc: "getServiceLoadBalancer shall return corresponding lb, status, exists if there are existed lbs", existingLBs: []network.LoadBalancer{ { Name: to.StringPtr("lb1"), LoadBalancerPropertiesFormat: &network.LoadBalancerPropertiesFormat{ FrontendIPConfigurations: &[]network.FrontendIPConfiguration{ { Name: to.StringPtr("aservice1"), FrontendIPConfigurationPropertiesFormat: &network.FrontendIPConfigurationPropertiesFormat{ PublicIPAddress: &network.PublicIPAddress{ID: to.StringPtr("testCluster-aservice1")}, }, }, }, }, }, }, service: getTestService("service1", v1.ProtocolTCP, nil, false, 80), wantLB: false, expectedLB: &network.LoadBalancer{ Name: to.StringPtr("lb1"), LoadBalancerPropertiesFormat: &network.LoadBalancerPropertiesFormat{ FrontendIPConfigurations: &[]network.FrontendIPConfiguration{ { Name: to.StringPtr("aservice1"), FrontendIPConfigurationPropertiesFormat: &network.FrontendIPConfigurationPropertiesFormat{ PublicIPAddress: &network.PublicIPAddress{ID: to.StringPtr("testCluster-aservice1")}, }, }, }, }, }, expectedStatus: &v1.LoadBalancerStatus{Ingress: []v1.LoadBalancerIngress{{IP: "1.2.3.4", Hostname: ""}}}, expectedExists: true, expectedError: false, }, { desc: "getServiceLoadBalancer shall report error if there're loadbalancer mode annotations on a standard lb", service: getTestService("service1", v1.ProtocolTCP, nil, false, 80), annotations: map[string]string{ServiceAnnotationLoadBalancerMode: "__auto__"}, sku: "standard", expectedExists: false, expectedError: true, }, { desc: "getServiceLoadBalancer shall select the lb with minimum lb rules if wantLb is true, the sku is " + "not standard and there are existing lbs already", existingLBs: []network.LoadBalancer{ { Name: to.StringPtr("testCluster"), LoadBalancerPropertiesFormat: &network.LoadBalancerPropertiesFormat{ LoadBalancingRules: &[]network.LoadBalancingRule{ {Name: to.StringPtr("rule1")}, }, }, }, { Name: to.StringPtr("as-1"), LoadBalancerPropertiesFormat: &network.LoadBalancerPropertiesFormat{ LoadBalancingRules: &[]network.LoadBalancingRule{ {Name: to.StringPtr("rule1")}, {Name: to.StringPtr("rule2")}, }, }, }, { Name: to.StringPtr("as-2"), LoadBalancerPropertiesFormat: &network.LoadBalancerPropertiesFormat{ LoadBalancingRules: &[]network.LoadBalancingRule{ {Name: to.StringPtr("rule1")}, {Name: to.StringPtr("rule2")}, {Name: to.StringPtr("rule3")}, }, }, }, }, service: getTestService("service1", v1.ProtocolTCP, nil, false, 80), annotations: map[string]string{ServiceAnnotationLoadBalancerMode: "__auto__"}, wantLB: true, expectedLB: &network.LoadBalancer{ Name: to.StringPtr("testCluster"), LoadBalancerPropertiesFormat: &network.LoadBalancerPropertiesFormat{ LoadBalancingRules: &[]network.LoadBalancingRule{ {Name: to.StringPtr("rule1")}, }, }, }, expectedExists: false, expectedError: false, }, { desc: "getServiceLoadBalancer shall create a new lb otherwise", service: getTestService("service1", v1.ProtocolTCP, nil, false, 80), expectedLB: &network.LoadBalancer{ Name: to.StringPtr("testCluster"), Location: to.StringPtr("westus"), LoadBalancerPropertiesFormat: &network.LoadBalancerPropertiesFormat{}, }, expectedExists: false, expectedError: false, }, } ctrl := gomock.NewController(t) defer ctrl.Finish() for i, test := range testCases { az := GetTestCloud(ctrl) clusterResources, expectedInterfaces, expectedVirtualMachines := getClusterResources(az, 3, 3) setMockEnv(az, ctrl, expectedInterfaces, expectedVirtualMachines, 1) mockLBsClient := mockloadbalancerclient.NewMockInterface(ctrl) mockLBsClient.EXPECT().CreateOrUpdate(gomock.Any(), "rg", gomock.Any(), gomock.Any(), gomock.Any()).Return(nil).AnyTimes() mockLBsClient.EXPECT().List(gomock.Any(), "rg").Return(test.existingLBs, nil) az.LoadBalancerClient = mockLBsClient for _, existingLB := range test.existingLBs { err := az.LoadBalancerClient.CreateOrUpdate(context.TODO(), "rg", *existingLB.Name, existingLB, "") if err != nil { t.Fatalf("TestCase[%d] meets unexpected error: %v", i, err) } } test.service.Annotations = test.annotations az.LoadBalancerSku = test.sku lb, status, exists, err := az.getServiceLoadBalancer(&test.service, testClusterName, clusterResources.nodes, test.wantLB) assert.Equal(t, test.expectedLB, lb, "TestCase[%d]: %s", i, test.desc) assert.Equal(t, test.expectedStatus, status, "TestCase[%d]: %s", i, test.desc) assert.Equal(t, test.expectedExists, exists, "TestCase[%d]: %s", i, test.desc) assert.Equal(t, test.expectedError, err != nil, "TestCase[%d]: %s", i, test.desc) } }
explode_data.jsonl/33999
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 2250 }
[ 2830, 3393, 1949, 1860, 5879, 93825, 1155, 353, 8840, 836, 8, 341, 18185, 37302, 1669, 3056, 1235, 341, 197, 41653, 1843, 914, 198, 197, 8122, 11083, 34068, 82, 262, 3056, 17511, 13969, 93825, 198, 197, 52934, 286, 348, 16, 13860, 198, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
4
func TestResponseErrorWhenAdapterReturn(t *testing.T) { a := assert.New(t) ctx := context.Background() response := &mavsdk_rpc_action.ReturnToLaunchResponse{ ActionResult: &mavsdk_rpc_action.ActionResult{ Result: mavsdk_rpc_action.ActionResult_BUSY, }, } actionMock := &actionServiceClientMock{} actionMock.On("ReturnToLaunch", mock.Anything, mock.Anything).Return(response, nil) ret := AdapterReturnInternal(ctx, actionMock) a.Equal("rtl command error: no rtl command success", ret.Error()) }
explode_data.jsonl/76180
{ "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, 2582, 1454, 4498, 5940, 5598, 1155, 353, 8840, 836, 8, 341, 11323, 1669, 2060, 7121, 1155, 692, 20985, 1669, 2266, 19047, 2822, 21735, 1669, 609, 76, 38751, 7584, 60799, 7931, 46350, 1249, 32067, 2582, 515, 197, 197, 17301, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestIKSEnvVariables(t *testing.T) { coreops.SetInstance(coreops.New(fakek8sclient.NewSimpleClientset())) nodeName := "testNode" cluster := &corev1.StorageCluster{ ObjectMeta: metav1.ObjectMeta{ Name: "px-cluster", Namespace: "kube-test", Annotations: map[string]string{ pxutil.AnnotationIsIKS: "true", }, }, Spec: corev1.StorageClusterSpec{ Image: "portworx/oci-monitor:2.6.0", }, } expectedPodIPEnv := v1.EnvVar{ Name: "PX_POD_IP", ValueFrom: &v1.EnvVarSource{ FieldRef: &v1.ObjectFieldSelector{ APIVersion: "v1", FieldPath: "status.podIP", }, }, } driver := portworx{} actual, err := driver.GetStoragePodSpec(cluster, nodeName) assert.NoError(t, err, "Unexpected error on GetStoragePodSpec") assert.Len(t, actual.Containers[0].Env, 5) var podIPEnv *v1.EnvVar for _, env := range actual.Containers[0].Env { if env.Name == "PX_POD_IP" { podIPEnv = env.DeepCopy() } } assert.Equal(t, expectedPodIPEnv, *podIPEnv) // TestCase: When IKS is not enabled cluster.Annotations[pxutil.AnnotationIsIKS] = "false" actual, err = driver.GetStoragePodSpec(cluster, nodeName) assert.NoError(t, err, "Unexpected error on GetStoragePodSpec") assert.Len(t, actual.Containers[0].Env, 4) podIPEnv = nil for _, env := range actual.Containers[0].Env { if env.Name == "PX_POD_IP" { podIPEnv = env.DeepCopy() } } assert.Nil(t, podIPEnv) }
explode_data.jsonl/55475
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 626 }
[ 2830, 3393, 28561, 925, 36941, 22678, 1155, 353, 8840, 836, 8, 341, 71882, 3721, 4202, 2523, 47867, 3721, 7121, 74138, 74, 23, 82, 2972, 7121, 16374, 2959, 746, 12145, 20831, 675, 1669, 330, 1944, 1955, 1837, 197, 18855, 1669, 609, 9864...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestXRateErroring(t *testing.T) { limit := rate.NewLimiter(rate.Every(time.Minute), 1) testSuccessThenFailure( t, ratelimit.NewErroringLimiter(limit)(nopEndpoint), ratelimit.ErrLimited.Error()) }
explode_data.jsonl/40233
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 80 }
[ 2830, 3393, 55, 11564, 1454, 287, 1155, 353, 8840, 836, 8, 341, 8810, 2353, 1669, 4379, 7121, 43, 17700, 76723, 5142, 1204, 9730, 75770, 701, 220, 16, 340, 18185, 7188, 12209, 17507, 1006, 197, 3244, 345, 197, 7000, 83326, 2353, 7121, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
func TestWritePlanText(t *testing.T) { inner := bytes.NewBufferString("") w := NewAnsiColorWriter(inner) expected := "plain text" fmt.Fprintf(w, expected) actual := inner.String() if actual != expected { t.Errorf("Get %q, want %q", actual, expected) } }
explode_data.jsonl/3540
{ "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, 7985, 20485, 1178, 1155, 353, 8840, 836, 8, 972, 197, 4382, 1669, 5820, 7121, 4095, 703, 445, 6060, 6692, 1669, 1532, 2082, 6321, 1636, 6492, 68603, 1218, 42400, 1669, 330, 20772, 1467, 5031, 11009, 59559, 3622, 11, 3601, 12...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestStepsFailFast(t *testing.T) { wf := unmarshalWF(stepsFailFast) cancel, controller := newController(wf) defer cancel() ctx := context.Background() woc := newWorkflowOperationCtx(wf, controller) woc.operate(ctx) assert.Equal(t, wfv1.WorkflowFailed, woc.wf.Status.Phase) node := woc.wf.Status.Nodes.FindByDisplayName("iteration(0:a)") if assert.NotNil(t, node) { assert.Equal(t, wfv1.NodeFailed, node.Phase) } node = woc.wf.Status.Nodes.FindByDisplayName("seq-loop-pz4hh") if assert.NotNil(t, node) { assert.Equal(t, wfv1.NodeFailed, node.Phase) } }
explode_data.jsonl/71041
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 250 }
[ 2830, 3393, 33951, 19524, 32174, 1155, 353, 8840, 836, 8, 341, 6692, 69, 1669, 650, 27121, 32131, 84271, 19524, 32174, 340, 84441, 11, 6461, 1669, 501, 2051, 3622, 69, 340, 16867, 9121, 2822, 20985, 1669, 2266, 19047, 741, 6692, 509, 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 TestNew(t *testing.T) { s, etcdserver, config, assert := newMaster(t) defer etcdserver.Terminate(t) // Verify many of the variables match their config counterparts assert.Equal(s.legacyAPIGroupPrefixes, config.LegacyAPIGroupPrefixes) assert.Equal(s.admissionControl, config.AdmissionControl) assert.Equal(s.RequestContextMapper(), config.RequestContextMapper) // these values get defaulted assert.Equal(net.JoinHostPort(config.PublicAddress.String(), "443"), s.ExternalAddress) assert.NotNil(s.swaggerConfig) assert.Equal("http://"+s.ExternalAddress, s.swaggerConfig.WebServicesUrl) }
explode_data.jsonl/18758
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 200 }
[ 2830, 3393, 3564, 1155, 353, 8840, 836, 8, 341, 1903, 11, 1842, 4385, 4030, 11, 2193, 11, 2060, 1669, 501, 18041, 1155, 340, 16867, 1842, 4385, 4030, 836, 261, 34016, 1155, 692, 197, 322, 25429, 1657, 315, 279, 7332, 2432, 862, 2193, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestNodeUnpublishVolumeUnmount(t *testing.T) { // Create server and client connection s := newTestServer(t) defer s.Stop() // Make a call c := csi.NewNodeClient(s.Conn()) name := "myvol" size := uint64(10) targetPath := "/tmp/mnttest" gomock.InOrder( s.MockDriver(). EXPECT(). Inspect([]string{name}). Return([]*api.Volume{ &api.Volume{ Id: name, Locator: &api.VolumeLocator{ Name: name, }, Spec: &api.VolumeSpec{ Size: size, }, AttachPath: []string{targetPath}, AttachedOn: "node1", State: api.VolumeState_VOLUME_STATE_ATTACHED, AttachedState: api.AttachState_ATTACH_STATE_EXTERNAL, }, }, nil). Times(1), s.MockDriver(). EXPECT(). Unmount(name, targetPath, nil). Return(nil). Times(1), s.MockDriver(). EXPECT(). Type(). Return(api.DriverType_DRIVER_TYPE_BLOCK). Times(1), s.MockDriver(). EXPECT(). Detach(name, gomock.Any()). Return(nil). Times(1), ) req := &csi.NodeUnpublishVolumeRequest{ VolumeId: name, TargetPath: targetPath, } r, err := c.NodeUnpublishVolume(context.Background(), req) assert.Nil(t, err) assert.NotNil(t, r) }
explode_data.jsonl/51453
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 566 }
[ 2830, 3393, 1955, 1806, 27502, 18902, 59539, 1155, 353, 8840, 836, 8, 341, 197, 322, 4230, 3538, 323, 2943, 3633, 198, 1903, 1669, 501, 2271, 5475, 1155, 340, 16867, 274, 30213, 2822, 197, 322, 7405, 264, 1618, 198, 1444, 1669, 272, 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 TestSubmitJobInvalidResponse(t *testing.T) { httpmock.Activate() defer httpmock.DeactivateAndReset() ctx := context.Background() responder, _ := httpmock.NewJsonResponder(200, invalidTestResponse) httpmock.RegisterResponder("POST", fakeSubmitURL, responder) client := getTestJobManagerClient() resp, err := client.SubmitJob(ctx, testURL, "1", SubmitJobRequest{ Parallelism: 10, }) assert.Nil(t, resp) assert.NotNil(t, err) }
explode_data.jsonl/32365
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 157 }
[ 2830, 3393, 8890, 12245, 7928, 2582, 1155, 353, 8840, 836, 8, 341, 28080, 16712, 14140, 731, 741, 16867, 1758, 16712, 8934, 16856, 3036, 14828, 741, 20985, 1669, 2266, 19047, 741, 10202, 20328, 11, 716, 1669, 1758, 16712, 7121, 5014, 3088...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestTLSAuthError(t *testing.T) { client, err := NewClient(ClientOptions{ URL: serviceURLTLS, TLSTrustCertsFilePath: caCertsPath, }) assert.NoError(t, err) producer, err := client.CreateProducer(ProducerOptions{ Topic: newAuthTopicName(), }) assert.Error(t, err) assert.Nil(t, producer) client.Close() }
explode_data.jsonl/69306
{ "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, 45439, 5087, 1454, 1155, 353, 8840, 836, 8, 341, 25291, 11, 1848, 1669, 1532, 2959, 46851, 3798, 515, 197, 79055, 25, 4293, 2473, 3144, 45439, 345, 197, 10261, 43, 784, 35788, 34, 15546, 19090, 25, 2162, 34, 15546, 1820, 3...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestContentManager_GenerateContent(t *testing.T) { controller := gomock.NewController(t) defer controller.Finish() params := map[string][]string{} dashConfig := configFake.NewMockDash(controller) moduleManager := moduleFake.NewMockManagerInterface(controller) state := octantFake.NewMockState(controller) state.EXPECT().GetContentPath().Return("/path").AnyTimes() state.EXPECT().OnContentPathUpdate(gomock.Any()).DoAndReturn(func(fn octant.ContentPathUpdateFunc) octant.UpdateCancelFunc { fn("foo") return func() {} }) octantClient := fake.NewMockOctantClient(controller) stopCh := make(chan struct{}, 1) contentResponse := component.ContentResponse{} contentEvent := api.CreateContentEvent(contentResponse, "default", "/path", params) octantClient.EXPECT().Send(contentEvent).AnyTimes() octantClient.EXPECT().StopCh().Return(stopCh).AnyTimes() logger := log.NopLogger() poller := api.NewSingleRunPoller() contentGenerator := func(ctx context.Context, state octant.State) (api.Content, bool, error) { return api.Content{Response: contentResponse}, false, nil } manager := api.NewContentManager(moduleManager, dashConfig, logger, api.WithContentGenerator(contentGenerator), api.WithContentGeneratorPoller(poller)) ctx := context.Background() manager.Start(ctx, state, octantClient) }
explode_data.jsonl/1648
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 418 }
[ 2830, 3393, 2762, 2043, 2646, 13220, 2762, 1155, 353, 8840, 836, 8, 341, 61615, 1669, 342, 316, 1176, 7121, 2051, 1155, 340, 16867, 6461, 991, 18176, 2822, 25856, 1669, 2415, 14032, 45725, 917, 31483, 2698, 988, 2648, 1669, 2193, 52317, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestCreateEmptyFile1(t *testing.T) { fi, err := file.CreateFile("D:/tmp/placeholder.txt") if err != nil { log.Fatal(err) } defer fi.Close() fmt.Println(fi.WriteAt([]byte{222}, 1023)) //206,905,344 }
explode_data.jsonl/22065
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 93 }
[ 2830, 3393, 4021, 3522, 1703, 16, 1155, 353, 8840, 836, 8, 341, 30839, 11, 1848, 1669, 1034, 7251, 1703, 445, 35, 14375, 5173, 14, 12384, 3909, 1138, 743, 1848, 961, 2092, 341, 197, 6725, 26133, 3964, 340, 197, 532, 16867, 9136, 10421...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestInt32_IsEmpty(t *testing.T) { testcases := []struct { name string s Int32 expect bool }{ { name: "test Int32 Empty, s is empty", s: Int32{}, expect: true, }, { name: "test interface Empty, s is not empty", s: map[int32]struct{}{1: {}, 2: {}, 3: {}}, expect: false, }, } for _, tc := range testcases { t.Logf("running scenario: %s", tc.name) actual := tc.s.IsEmpty() if actual != tc.expect { t.Errorf("expect return: %v, but got: %v", tc.expect, actual) } } }
explode_data.jsonl/62322
{ "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, 1072, 18, 17, 31879, 3522, 1155, 353, 8840, 836, 8, 341, 18185, 23910, 1669, 3056, 1235, 341, 197, 11609, 256, 914, 198, 197, 1903, 414, 1333, 18, 17, 198, 197, 24952, 1807, 198, 197, 59403, 197, 197, 515, 298, 11609, 25...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestDefaults(t *testing.T) { require.Equal(t, hd.PubKeyType("multi"), hd.MultiType) require.Equal(t, hd.PubKeyType("secp256k1"), hd.Secp256k1Type) require.Equal(t, hd.PubKeyType("ed25519"), hd.Ed25519Type) require.Equal(t, hd.PubKeyType("sr25519"), hd.Sr25519Type) }
explode_data.jsonl/61736
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 127 }
[ 2830, 3393, 16273, 1155, 353, 8840, 836, 8, 341, 17957, 12808, 1155, 11, 17907, 1069, 392, 97964, 445, 26268, 3975, 17907, 57706, 929, 340, 17957, 12808, 1155, 11, 17907, 1069, 392, 97964, 445, 325, 4672, 17, 20, 21, 74, 16, 3975, 179...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestNextInDeferReturn(t *testing.T) { // runtime.deferreturn updates the G struct in a way that for one // instruction leaves the curg._defer field non-nil but with curg._defer.fn // field being nil. // We need to deal with this without panicing. protest.AllowRecording(t) withTestProcess("defercall", t, func(p *proc.Target, fixture protest.Fixture) { setFunctionBreakpoint(p, t, "runtime.deferreturn") assertNoError(p.Continue(), t, "First Continue()") // Set a breakpoint on the deferred function so that the following loop // can not step out of the runtime.deferreturn and all the way to the // point where the target program panics. setFunctionBreakpoint(p, t, "main.sampleFunction") for i := 0; i < 20; i++ { loc, err := p.CurrentThread().Location() assertNoError(err, t, "CurrentThread().Location()") t.Logf("at %#x %s:%d", loc.PC, loc.File, loc.Line) if loc.Fn != nil && loc.Fn.Name == "main.sampleFunction" { break } assertNoError(p.Next(), t, fmt.Sprintf("Next() %d", i)) } }) }
explode_data.jsonl/56282
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 372 }
[ 2830, 3393, 5847, 641, 1912, 802, 5598, 1155, 353, 8840, 836, 8, 341, 197, 322, 15592, 60043, 689, 8837, 279, 479, 2036, 304, 264, 1616, 429, 369, 825, 198, 197, 322, 7600, 10901, 279, 2847, 70, 1436, 62095, 2070, 2477, 83248, 714, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestCgoLookupIP(t *testing.T) { host := "localhost" _, err, ok := cgoLookupIP(host) if !ok { t.Errorf("cgoLookupIP must not be a placeholder") } if err != nil { t.Error(err) } if _, err := goLookupIP(host); err != nil { t.Error(err) } }
explode_data.jsonl/8389
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 117 }
[ 2830, 3393, 34, 3346, 34247, 3298, 1155, 353, 8840, 836, 8, 341, 63104, 1669, 330, 8301, 698, 197, 6878, 1848, 11, 5394, 1669, 272, 3346, 34247, 3298, 19973, 340, 743, 753, 562, 341, 197, 3244, 13080, 445, 66, 3346, 34247, 3298, 1969,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_Handler_StructWithValues_ExpectValuesCopied(t *testing.T) { var mock = mockStruct{ Field1: "moq1", Field2: "moq2", } t.Run("Pass struct type by value as ctor", testForMockFunc( mock, func(v reflect.Value) { assert.Equal(t, v.Interface(), mock) }, ), ) t.Run("Pass struct pointer as ctor", testForMockFunc( &mock, func(v reflect.Value) { assert.Equal(t, v.Interface(), &mock) }, ), ) t.Run("Pass func what returns struct type", testForMockFunc( func() mockStruct { return mock }, func(v reflect.Value) { assert.Equal(t, v.Interface(), mock) }, ), ) t.Run("Pass func what returns pointer to struct", testForMockFunc( func() *mockStruct { return &mock }, func(v reflect.Value) { assert.Equal(t, v.Interface(), &mock) }, ), ) t.Run("Pass func what returns reflect.Value of struct type", testForMockFunc( func() reflect.Value { return reflect.ValueOf(mock) }, func(v reflect.Value) { assert.Equal(t, v.Interface(), mock) }, ), ) t.Run("Pass func what returns reflect.Value of pointer to struct type", testForMockFunc( func() reflect.Value { return reflect.ValueOf(&mock) }, func(v reflect.Value) { assert.Equal(t, v.Interface(), &mock) }, ), ) }
explode_data.jsonl/45769
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 566 }
[ 2830, 3393, 41879, 72246, 2354, 6227, 62, 17536, 6227, 56277, 1122, 1155, 353, 8840, 836, 8, 341, 2405, 7860, 284, 7860, 9422, 515, 197, 94478, 16, 25, 330, 6355, 80, 16, 497, 8601, 17, 25, 330, 6355, 80, 17, 756, 197, 630, 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...
1
func TestSend(t *testing.T) { ctrl, teardown := setupIpTest(t) defer teardown() devMock := mw.NewMockIDevice(ctrl) devMock.EXPECT().IsUp().Return(true) devMock.EXPECT().Name().Return("net0") devMock.EXPECT().Flag().Return(mw.BroadcastFlag | mw.NeedArpFlag) devMock.EXPECT().MTU().Return(uint16(mw.EthPayloadLenMax)).AnyTimes() devMock.EXPECT().Priv().Return(mw.Privilege{FD: 3, Name: "tap0"}) devMock.EXPECT().Transmit(any, any, any).Return(psErr.OK) iface := createIface() _ = repo.IfaceRepo.Register(iface, devMock) arpMock := arp.NewMockIResolver(ctrl) arpMock.EXPECT().Resolve(any, any).Return(mw.EthAddr{11, 12, 13, 14, 15, 16}, arp.Complete) arp.Resolver = arpMock payload := []byte{1, 2, 3, 4, 5, 6, 7, 8, 9, 10} src := mw.IP{192, 168, 0, 1} dst := mw.IP{192, 168, 0, 2} want := psErr.OK got := Send(mw.PnICMP, payload, src, dst) if got != want { t.Errorf("Send() = %s; want %s", got, want) } }
explode_data.jsonl/8508
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 423 }
[ 2830, 3393, 11505, 1155, 353, 8840, 836, 8, 341, 84381, 11, 49304, 1669, 6505, 23378, 2271, 1155, 340, 16867, 49304, 2822, 27302, 11571, 1669, 52810, 7121, 11571, 915, 63924, 62100, 340, 27302, 11571, 22402, 7285, 1005, 3872, 2324, 1005, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestGetPubKey(t *testing.T) { pv := mock.NewPV() pk, err := pv.GetPubKey() require.NoError(t, err) require.Equal(t, "ed25519", pk.Type()) }
explode_data.jsonl/35537
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 70 }
[ 2830, 3393, 1949, 29162, 1592, 1155, 353, 8840, 836, 8, 341, 3223, 85, 1669, 7860, 7121, 48469, 741, 3223, 74, 11, 1848, 1669, 33491, 2234, 29162, 1592, 741, 17957, 35699, 1155, 11, 1848, 340, 17957, 12808, 1155, 11, 330, 291, 17, 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
func TestSizeLedgerWithNames(t *testing.T) { templates, err := testutils.LoadTemplates("test-data-alltemplates.yaml") if err != nil || len(templates) < 1 { t.Errorf("cannot load test templates! %v", err) return } ld := NewJSONLedger("flavor") err = ld.ReadNameMap("test-size-names.json") if err != nil { t.Errorf("unexpected error: %v", err) } summaries := ld.Summarize(templates) expected := []Summary{ Summary{ ID: "large", Name: "pretty big instance type", }, Summary{ ID: "medium", Name: "average instance type", }, Summary{ ID: "small", Name: "small instance type", }, Summary{ ID: "tiny", Name: "minuscule instance type", }, } checkSummaries(t, summaries, expected) }
explode_data.jsonl/45685
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 308 }
[ 2830, 3393, 1695, 60850, 1389, 2354, 7980, 1155, 353, 8840, 836, 8, 341, 197, 15463, 11, 1848, 1669, 1273, 6031, 13969, 51195, 445, 1944, 13945, 22346, 15463, 33406, 1138, 743, 1848, 961, 2092, 1369, 2422, 7, 15463, 8, 366, 220, 16, 3...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
4
func TestFSMsgFileWithExtraZeros(t *testing.T) { cleanupFSDatastore(t) defer cleanupFSDatastore(t) s := createDefaultFileStore(t) defer s.Close() c := storeCreateChannel(t, s, "foo") ms := c.Msgs msg1 := storeMsg(t, c, "foo", 1, []byte("msg1")) ms.(*FileMsgStore).RLock() datname := ms.(*FileMsgStore).writeSlice.file.name idxname := ms.(*FileMsgStore).writeSlice.idxFile.name ms.(*FileMsgStore).RUnlock() s.Close() // Remove index file to make store use dat file on recovery os.Remove(idxname) // Add zeros at end of datafile f, err := openFileWithFlags(datname, os.O_CREATE|os.O_RDWR|os.O_APPEND) if err != nil { t.Fatalf("Error opening file: %v", err) } defer f.Close() b := make([]byte, recordHeaderSize) if _, err := f.Write(b); err != nil { t.Fatalf("Error adding zeros: %v", err) } f.Close() // Reopen file store s, rs := openDefaultFileStore(t) defer s.Close() rc := getRecoveredChannel(t, rs, "foo") msg := msgStoreLookup(t, rc.Msgs, msg1.Sequence) if !reflect.DeepEqual(msg, msg1) { t.Fatalf("Expected message %v, got %v", msg1, msg) } // Add one more message msg2 := storeMsg(t, rc, "foo", 2, []byte("msg2")) s.Close() // Reopen file store s, rs = openDefaultFileStore(t) defer s.Close() rc = getRecoveredChannel(t, rs, "foo") msgs := []*pb.MsgProto{msg1, msg2} for _, omsg := range msgs { msg := msgStoreLookup(t, rc.Msgs, omsg.Sequence) if !reflect.DeepEqual(msg, omsg) { t.Fatalf("Expected message %v, got %v", omsg, msg) } } }
explode_data.jsonl/7780
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 633 }
[ 2830, 3393, 8485, 6611, 1703, 2354, 11612, 57, 6264, 1155, 353, 8840, 836, 8, 341, 1444, 60639, 8485, 1043, 4314, 1155, 340, 16867, 21290, 8485, 1043, 4314, 1155, 692, 1903, 1669, 1855, 3675, 1703, 6093, 1155, 340, 16867, 274, 10421, 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...
6
func TestComplexShowVariables(t *testing.T) { // This is an example SHOW VARIABLES from mysql-connector-java-5.1.34 // It returns 19 rows in MySQL 5.7 (the language sysvar no longer exists in 5.6+) // and 16 rows in MySQL 8.0 (the aliases for tx_isolation is removed, along with query cache) // In the event that we hide noop sysvars in future, we must keep these variables. store, clean := testkit.CreateMockStore(t) defer clean() tk := testkit.NewTestKit(t, store) require.Len(t, tk.MustQuery(`SHOW VARIABLES WHERE Variable_name ='language' OR Variable_name = 'net_write_timeout' OR Variable_name = 'interactive_timeout' OR Variable_name = 'wait_timeout' OR Variable_name = 'character_set_client' OR Variable_name = 'character_set_connection' OR Variable_name = 'character_set' OR Variable_name = 'character_set_server' OR Variable_name = 'tx_isolation' OR Variable_name = 'transaction_isolation' OR Variable_name = 'character_set_results' OR Variable_name = 'timezone' OR Variable_name = 'time_zone' OR Variable_name = 'system_time_zone' OR Variable_name = 'lower_case_table_names' OR Variable_name = 'max_allowed_packet' OR Variable_name = 'net_buffer_length' OR Variable_name = 'sql_mode' OR Variable_name = 'query_cache_type' OR Variable_name = 'query_cache_size' OR Variable_name = 'license' OR Variable_name = 'init_connect'`).Rows(), 19) }
explode_data.jsonl/65591
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 437 }
[ 2830, 3393, 31137, 7812, 22678, 1155, 353, 8840, 836, 8, 341, 197, 322, 1096, 374, 458, 3110, 38481, 76753, 504, 10564, 12, 53700, 85339, 12, 20, 13, 16, 13, 18, 19, 198, 197, 322, 1084, 4675, 220, 16, 24, 6978, 304, 26339, 220, 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 TestExecContextFailureWithoutCancelation(t *testing.T) { t.Parallel() testWithAndWithoutPreferSimpleProtocol(t, func(t *testing.T, conn *pgx.Conn) { ctx, cancelFunc := context.WithCancel(context.Background()) defer cancelFunc() _, err := conn.Exec(ctx, "selct;") if err == nil { t.Fatal("Expected SQL syntax error") } assert.False(t, pgconn.SafeToRetry(err)) rows, _ := conn.Query(context.Background(), "select 1") rows.Close() if rows.Err() != nil { t.Fatalf("ExecEx failure appears to have broken connection: %v", rows.Err()) } assert.False(t, pgconn.SafeToRetry(err)) }) }
explode_data.jsonl/40008
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 238 }
[ 2830, 3393, 10216, 1972, 17507, 26040, 9269, 367, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 2822, 18185, 2354, 3036, 26040, 4703, 802, 16374, 20689, 1155, 11, 2915, 1155, 353, 8840, 836, 11, 4534, 353, 3517, 87, 50422, 8, 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...
3
func TestWithdrawInternationalBank(t *testing.T) { t.Parallel() _, err := b.WithdrawFiatFundsToInternationalBank(context.Background(), &withdraw.Request{}) if err != common.ErrFunctionNotSupported { t.Errorf("Expected '%v', received: '%v'", common.ErrFunctionNotSupported, err) } }
explode_data.jsonl/76679
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 102 }
[ 2830, 3393, 92261, 33646, 25828, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 741, 197, 6878, 1848, 1669, 293, 26124, 7633, 37, 10358, 37, 42950, 1249, 33646, 25828, 5378, 19047, 3148, 197, 197, 5, 62446, 9659, 37790, 743, 1848, 961...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestNatto(t *testing.T) { jsre, dir := newWithTestJS(t, `setTimeout(function(){msg = "testMsg"}, 1);`) defer os.RemoveAll(dir) err := jsre.Exec("test.js") if err != nil { t.Errorf("expected no error, got %v", err) } time.Sleep(100 * time.Millisecond) val, err := jsre.Run("msg") if err != nil { t.Errorf("expected no error, got %v", err) } if !val.IsString() { t.Errorf("expected string value, got %v", val) } exp := "testMsg" got, _ := val.ToString() if exp != got { t.Errorf("expected '%v', got '%v'", exp, got) } jsre.Stop(false) }
explode_data.jsonl/1908
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 243 }
[ 2830, 3393, 45, 16755, 1155, 353, 8840, 836, 8, 341, 95636, 265, 11, 5419, 1669, 501, 2354, 2271, 12545, 1155, 11, 1565, 78700, 2920, 11895, 3236, 284, 330, 1944, 6611, 14345, 220, 16, 1215, 24183, 16867, 2643, 84427, 14161, 692, 9859, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestReOpening(t *testing.T) { catalogStore, err := store.Open("catalog_reopening", store.DefaultOptions()) require.NoError(t, err) defer os.RemoveAll("catalog_reopening") dataStore, err := store.Open("sqldata_reopening", store.DefaultOptions()) require.NoError(t, err) defer os.RemoveAll("sqldata_reopening") engine, err := NewEngine(catalogStore, dataStore, DefaultOptions().WithPrefix(sqlPrefix)) require.NoError(t, err) _, err = engine.ExecStmt("CREATE DATABASE db1", nil, true) require.NoError(t, err) _, err = engine.ExecStmt("USE DATABASE db1; CREATE TABLE table1 (id INTEGER, name VARCHAR[30], PRIMARY KEY id)", nil, true) require.NoError(t, err) _, err = engine.ExecStmt("USE DATABASE db1; CREATE INDEX ON table1(name)", nil, true) require.NoError(t, err) engine, err = NewEngine(catalogStore, dataStore, DefaultOptions().WithPrefix(sqlPrefix)) require.NoError(t, err) _, err = engine.ExistDatabase("db1") require.ErrorIs(t, err, ErrCatalogNotReady) _, err = engine.GetDatabaseByName("db1") require.ErrorIs(t, err, ErrCatalogNotReady) _, err = engine.GetTableByName("db1", "table1") require.ErrorIs(t, err, ErrCatalogNotReady) err = engine.EnsureCatalogReady(nil) require.NoError(t, err) exists, err := engine.ExistDatabase("db1") require.NoError(t, err) require.True(t, exists) db, err := engine.GetDatabaseByName("db1") require.NoError(t, err) exists = db.ExistTable("table1") require.True(t, exists) table, err := db.GetTableByName("table1") require.NoError(t, err) require.NotNil(t, table.primaryIndex) require.Len(t, table.primaryIndex.cols, 1) require.Equal(t, "id", table.primaryIndex.cols[0].colName) require.Len(t, table.Cols(), 2) col, err := table.GetColumnByName("id") require.NoError(t, err) require.Equal(t, IntegerType, col.colType) col, err = table.GetColumnByName("name") require.NoError(t, err) require.Equal(t, VarcharType, col.colType) indexed, err := table.IsIndexed(col.colName) require.NoError(t, err) require.True(t, indexed) err = engine.Close() require.NoError(t, err) }
explode_data.jsonl/64082
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 786 }
[ 2830, 3393, 693, 51298, 1155, 353, 8840, 836, 8, 341, 1444, 7750, 6093, 11, 1848, 1669, 3553, 12953, 445, 26539, 1288, 67685, 497, 3553, 13275, 3798, 2398, 17957, 35699, 1155, 11, 1848, 340, 16867, 2643, 84427, 445, 26539, 1288, 67685, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestConstantTimeByteEq(t *testing.T) { for i, test := range testConstandTimeByteEqData { if r := ConstantTimeByteEq(test.a, test.b); r != test.out { t.Errorf("#%d bad result (got %x, want %x)", i, r, test.out) } } err := quick.CheckEqual(ConstantTimeByteEq, byteEq, nil) if err != nil { t.Error(err) } }
explode_data.jsonl/79468
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 141 }
[ 2830, 3393, 15472, 1462, 7153, 27312, 1155, 353, 8840, 836, 8, 341, 2023, 600, 11, 1273, 1669, 2088, 1273, 1109, 2685, 1462, 7153, 27312, 1043, 341, 197, 743, 435, 1669, 19305, 1462, 7153, 27312, 8623, 5849, 11, 1273, 948, 1215, 435, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestEndlessWrite(t *testing.T) { t.Parallel() c := make(chan bool) server := func(cs *TCPConn) error { cs.CloseWrite() <-c return nil } client := func(ss *TCPConn) error { // Tell the server to return when we return. defer close(c) // Loop writing to the server. The server is not reading // anything, so this will eventually block, and then time out. b := bytes.Repeat([]byte{'a'}, 8192) cagain := 0 for { n, err := ss.conn.fd.pfd.WriteOnce(b) if n > 0 { cagain = 0 } switch err { case nil: case syscall.EAGAIN: if cagain == 0 { // We've written enough data to // start blocking. Set a deadline // so that we will stop. ss.SetWriteDeadline(time.Now().Add(5 * time.Millisecond)) } cagain++ if cagain > 20 { t.Error("looping on EAGAIN") return nil } if err = ss.conn.fd.pfd.WaitWrite(); err != nil { t.Logf("client WaitWrite: %v", err) return nil } default: // We expect to eventually get an error. t.Logf("client WriteOnce: %v", err) return nil } } } withTCPConnPair(t, client, server) }
explode_data.jsonl/22748
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 502 }
[ 2830, 3393, 3727, 1717, 7985, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 741, 1444, 1669, 1281, 35190, 1807, 340, 41057, 1669, 2915, 41153, 353, 49896, 9701, 8, 1465, 341, 197, 71899, 10421, 7985, 741, 197, 197, 45342, 66, 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 TestParseArgsWhenEnv(t *testing.T) { assertMatchArgs := func(t *testing.T, gotArgs, wantArgs *shell.CommandArgs) { t.Helper() if gotArgs.EnvName != wantArgs.EnvName { t.Errorf("EnvName: got %s want %s", gotArgs.EnvName, wantArgs.EnvName) } if gotArgs.Version != wantArgs.Version { t.Errorf("Version: got %s wnat %s", gotArgs.Version, wantArgs.Version) } if !Equals(gotArgs.ShellArgs, wantArgs.ShellArgs) { t.Errorf("ShellArgs: got %s want %s", gotArgs.ShellArgs, wantArgs.ShellArgs) } } assertError := func(t *testing.T, got, want error) { t.Helper() if got != nil && got.Error() != want.Error() { t.Errorf("Error: got %s want %s", got, want) } } t.Run("env", func(t *testing.T) { args := []string{"alfa"} gotArgs, gotError := shell.ParseArgs(args) var wantArgs shell.CommandArgs wantArgs.EnvName = "alfa" var wantError error = nil assertMatchArgs(t, gotArgs, &wantArgs) assertError(t, gotError, wantError) }) t.Run("env and -v", func(t *testing.T) { args := []string{"alfa", "-v", "beta"} gotArgs, gotError := shell.ParseArgs(args) var wantArgs shell.CommandArgs wantArgs.EnvName = "alfa" wantArgs.Version = "beta" var wantError error = nil assertMatchArgs(t, gotArgs, &wantArgs) assertError(t, gotError, wantError) }) t.Run("env and --version", func(t *testing.T) { args := []string{"alfa", "--version", "beta"} gotArgs, gotError := shell.ParseArgs(args) var wantArgs shell.CommandArgs wantArgs.EnvName = "alfa" wantArgs.Version = "beta" var wantError error = nil assertMatchArgs(t, gotArgs, &wantArgs) assertError(t, gotError, wantError) }) t.Run("env and --version=", func(t *testing.T) { args := []string{"alfa", "--version=beta"} gotArgs, gotError := shell.ParseArgs(args) var wantArgs shell.CommandArgs wantArgs.EnvName = "alfa" wantArgs.Version = "beta" var wantError error = nil assertMatchArgs(t, gotArgs, &wantArgs) assertError(t, gotError, wantError) }) t.Run("env and shellArgs", func(t *testing.T) { args := []string{"alfa", "--", "beta"} gotArgs, gotError := shell.ParseArgs(args) var wantArgs shell.CommandArgs wantArgs.EnvName = "alfa" wantArgs.ShellArgs = []string{"beta"} var wantError error = nil assertMatchArgs(t, gotArgs, &wantArgs) assertError(t, gotError, wantError) }) t.Run("env and version and shellArgs", func(t *testing.T) { args := []string{"alfa", "-v", "beta", "--", "charlie", "delta"} gotArgs, gotError := shell.ParseArgs(args) var wantArgs shell.CommandArgs wantArgs.EnvName = "alfa" wantArgs.Version = "beta" wantArgs.ShellArgs = []string{"charlie", "delta"} var wantError error = nil assertMatchArgs(t, gotArgs, &wantArgs) assertError(t, gotError, wantError) }) t.Run("missing env", func(t *testing.T) { args := []string{"-v", "beta", "--", "charlie"} _, gotError := shell.ParseArgs(args) var wantError error = errors.New("Env missing value") assertError(t, gotError, wantError) }) t.Run("empty args", func(t *testing.T) { args := []string{} _, gotError := shell.ParseArgs(args) var wantError error = errors.New("Env missing value") assertError(t, gotError, wantError) }) t.Run("missing version", func(t *testing.T) { args := []string{"alfa", "-v"} _, gotError := shell.ParseArgs(args) var wantError error = errors.New("missing value") assertError(t, gotError, wantError) }) }
explode_data.jsonl/78059
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1339 }
[ 2830, 3393, 14463, 4117, 4498, 14359, 1155, 353, 8840, 836, 8, 1476, 6948, 8331, 4117, 1669, 2915, 1155, 353, 8840, 836, 11, 2684, 4117, 11, 1366, 4117, 353, 21384, 12714, 4117, 8, 341, 197, 3244, 69282, 741, 197, 743, 2684, 4117, 812...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestServerIdleTimeout(t *testing.T) { if testing.Short() { t.Skip("skipping in short mode") } st := newServerTester(t, func(w http.ResponseWriter, r *http.Request) { }, func(h2s *Server) { h2s.IdleTimeout = 500 * time.Millisecond }) defer st.Close() st.greet() ga := st.wantGoAway() if ga.ErrCode != ErrCodeNo { t.Errorf("GOAWAY error = %v; want ErrCodeNo", ga.ErrCode) } }
explode_data.jsonl/71702
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 168 }
[ 2830, 3393, 5475, 41370, 7636, 1155, 353, 8840, 836, 8, 341, 743, 7497, 55958, 368, 341, 197, 3244, 57776, 445, 4886, 5654, 304, 2805, 3856, 1138, 197, 630, 18388, 1669, 501, 5475, 58699, 1155, 11, 2915, 3622, 1758, 37508, 11, 435, 35...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestCAConfigSecurityProvider(t *testing.T) { backend, err := config.FromFile(configTestFilePath)() if err != nil { t.Fatal("Failed to get config backend") } customBackend := getCustomBackend(backend...) cryptoConfig := ConfigFromBackend(customBackend).(*Config) // Test SecurityProvider provider val, ok := customBackend.Lookup("client.BCCSP.security.default.provider") if !ok || val == nil { t.Fatal("expected valid value") } if !strings.EqualFold(val.(string), cryptoConfig.SecurityProvider()) { t.Fatalf("Incorrect BCCSP SecurityProvider provider : %s", cryptoConfig.SecurityProvider()) } }
explode_data.jsonl/58379
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 201 }
[ 2830, 3393, 5049, 2648, 15352, 5179, 1155, 353, 8840, 836, 8, 341, 197, 20942, 11, 1848, 1669, 2193, 11439, 1703, 8754, 2271, 19090, 8, 741, 743, 1848, 961, 2092, 341, 197, 3244, 26133, 445, 9408, 311, 633, 2193, 19163, 1138, 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...
5
func TestCSDeleteChannel(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() if err := s.DeleteChannel("notfound"); err != ErrNotFound { t.Fatalf("Expected %v error, got %v", ErrNotFound, err) } storeCreateChannel(t, s, "foo") if err := s.DeleteChannel("foo"); err != nil { t.Fatalf("Error on delete: %v", err) } if !st.recoverable { return } // Restart the store and ensure channel "foo" is not reconvered s.Close() s, state := testReOpenStore(t, st, nil) defer s.Close() if state != nil && len(state.Channels) > 0 { t.Fatal("Channel recovered after restart") } }) } }
explode_data.jsonl/28304
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 332 }
[ 2830, 3393, 6412, 6435, 9629, 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, 741, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestParseVolumeWithRW(t *testing.T) { for _, path := range []string{"./foo", "/home/user"} { volume, err := parseVolume(path + ":/target:rw") expected := types.ServiceVolumeConfig{ Type: "bind", Source: path, Target: "/target", ReadOnly: false, } assert.NoError(t, err) assert.Equal(t, expected, volume) } }
explode_data.jsonl/70104
{ "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, 14463, 18902, 2354, 56368, 1155, 353, 8840, 836, 8, 341, 2023, 8358, 1815, 1669, 2088, 3056, 917, 4913, 1725, 7975, 497, 3521, 5117, 11739, 9207, 341, 197, 5195, 4661, 11, 1848, 1669, 4715, 18902, 5581, 488, 13022, 14, 5657,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestRuleOrderByExpr(t *testing.T) { common.Log.Debug("Entering function: %s", common.GetFunctionName()) sqls := [][]string{ { "SELECT col FROM tbl order by cola - cl;", // order by 列运算 "SELECT cola - cl col FROM tbl order by col;", // 别名为列运算 "SELECT cola FROM tbl order by from_unixtime(col);", // order by 函数运算 "SELECT from_unixtime(col) cola FROM tbl order by cola;", // 别名为函数运算 }, { `SELECT tbl.col FROM tbl ORDER BY col`, "SELECT sum(col) AS col FROM tbl ORDER BY dt", "SELECT tbl.col FROM tb, tbl WHERE tbl.tag_id = tb.id ORDER BY tbl.col", "SELECT col FROM tbl order by `timestamp`;", // 列名为关键字 "select col from tb where cl = 1 order by APPLY_TIME", // issue #104 case sensitive }, } for _, sql := range sqls[0] { q, err := NewQuery4Audit(sql) if err == nil { rule := q.RuleOrderByExpr() if rule.Item != "CLA.009" { t.Error("Rule not match:", rule.Item, "Expect : CLA.009") } } else { t.Error("sqlparser.Parse Error:", err) } } for _, sql := range sqls[1] { q, err := NewQuery4Audit(sql) if err == nil { rule := q.RuleOrderByExpr() if rule.Item != "OK" { t.Error("Rule not match:", rule.Item, "Expect : OK") } } else { t.Error("sqlparser.Parse Error:", err) } } common.Log.Debug("Exiting function: %s", common.GetFunctionName()) }
explode_data.jsonl/76753
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 654 }
[ 2830, 3393, 11337, 34605, 16041, 1155, 353, 8840, 836, 8, 341, 83825, 5247, 20345, 445, 82867, 729, 25, 1018, 82, 497, 4185, 2234, 5152, 675, 2398, 30633, 82, 1669, 52931, 917, 515, 197, 197, 515, 298, 197, 1, 4858, 1375, 4295, 21173,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestConfig_ForEachAdvisory(t *testing.T) { type args struct { source string pkgName string } tests := []struct { name string args args fixtures []string want map[string]types.Advisory wantErr string }{ { name: "single bucket", args: args{ source: "GitHub Security Advisory Composer", pkgName: "symfony/symfony", }, fixtures: []string{"testdata/fixtures/single-bucket.yaml"}, want: map[string]types.Advisory{ "CVE-2019-10909": { PatchedVersions: []string{"4.2.7", "3.4.26"}, VulnerableVersions: []string{">= 4.2.0, < 4.2.7", ">= 3.0.0, < 3.4.26"}, }, "CVE-2019-18889": { PatchedVersions: []string{"4.3.8", "3.4.35"}, VulnerableVersions: []string{">= 4.3.0, < 4.3.8", ">= 3.1.0, < 3.4.35"}, }, }, }, { name: "prefix scan", args: args{ source: "composer::", pkgName: "symfony/symfony", }, fixtures: []string{"testdata/fixtures/multiple-buckets.yaml"}, want: map[string]types.Advisory{ "CVE-2019-10909": { PatchedVersions: []string{"4.2.7"}, VulnerableVersions: []string{">= 4.2.0, < 4.2.7"}, }, "CVE-2020-5275": { VulnerableVersions: []string{">= 4.4.0, < 4.4.7"}, }, }, }, { name: "non-existent bucket", args: args{ source: "non-existent", pkgName: "symfony/symfony", }, fixtures: []string{"testdata/fixtures/single-bucket.yaml"}, want: map[string]types.Advisory{}, }, { name: "non-existent package", args: args{ source: "GitHub Security Advisory Composer", pkgName: "non-existent", }, fixtures: []string{"testdata/fixtures/single-bucket.yaml"}, want: map[string]types.Advisory{}, }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { // Initialize DB dbtest.InitDB(t, tt.fixtures) defer db.Close() dbc := db.Config{} got, err := dbc.ForEachAdvisory([]string{tt.args.source}, tt.args.pkgName) if tt.wantErr != "" { require.NotNil(t, err) assert.Contains(t, err.Error(), tt.wantErr) return } assert.NoError(t, err) // Compare assert.Equal(t, len(tt.want), len(got)) for cveID, g := range got { wantAdvisory, ok := tt.want[cveID] if !ok { assert.Fail(t, "no such key", "CVE-ID", cveID) } var gotAdvisory types.Advisory err = json.Unmarshal(g.Content, &gotAdvisory) require.NoError(t, err) assert.Equal(t, wantAdvisory, gotAdvisory) } }) } }
explode_data.jsonl/72884
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1206 }
[ 2830, 3393, 2648, 84368, 4854, 2589, 2682, 679, 1155, 353, 8840, 836, 8, 341, 13158, 2827, 2036, 341, 197, 47418, 220, 914, 198, 197, 3223, 7351, 675, 914, 198, 197, 532, 78216, 1669, 3056, 1235, 341, 197, 11609, 257, 914, 198, 197, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
4
func TestBlockNumber(t *testing.T) { t.Parallel() client := NewHTTPClient("https://api.myetherapi.com/eth") const min = 5132536 // Block number at time test was added. if block, err := client.BlockNumber(); err != nil { t.Fatal(err) } else if block < min { t.Fatal("block number is too low:", block, "<", min) } }
explode_data.jsonl/80662
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 118 }
[ 2830, 3393, 4713, 2833, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 2822, 25291, 1669, 1532, 9230, 2959, 445, 2428, 1110, 2068, 12618, 2723, 2068, 905, 14, 769, 5130, 4777, 1308, 284, 220, 20, 16, 18, 17, 20, 18, 21, 442, 8362,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestAddress(t *testing.T) { buf := []byte(`----one dot one ----one dot two ----two dot one two content lines `) pages, _ := pagesFrom(buf) want := []int{1, 4} var got []int for _, page := range pages { got = append(got, page.Address()) } if !reflect.DeepEqual(want, got) { t.Errorf("\nwant: %v\ngot: %v\n", want, got) } }
explode_data.jsonl/41281
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 146 }
[ 2830, 3393, 4286, 1155, 353, 8840, 836, 8, 341, 26398, 1669, 3056, 3782, 5809, 381, 603, 12756, 825, 198, 381, 603, 12756, 1378, 271, 381, 19789, 12756, 825, 271, 19789, 2213, 198, 7969, 271, 24183, 3223, 1134, 11, 716, 1669, 6816, 38...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestMMappedIndex(t *testing.T) { tempdir, err := ioutil.TempDir("", "weaviate-vector-test") if err != nil { t.Errorf("Could not create temporary directory, %v", err) } defer os.RemoveAll(tempdir) // First generate the csv input fileformat based on the test data. var dataset = "" for i := 0; i < len(vectorTests); i++ { vt := vectorTests[i] dataset += vt.word + " " for j := 0; j < len(vt.vec) - 1; j++ { dataset += fmt.Sprintf("%f ", vt.vec[j]) } dataset += fmt.Sprintf("%f\n", vt.vec[len(vt.vec)-1]) } err = ioutil.WriteFile(tempdir + "/glove.txt", []byte(dataset), 0644) if err != nil { t.Errorf("Could not create input file: %v", err) } t.Run("Generating index", func(t *testing.T) { // Now build an index based on this var gen_opts generator.Options gen_opts.VectorCSVPath = tempdir + "/glove.txt" gen_opts.TempDBPath = tempdir + "/tempdb" gen_opts.OutputPrefix = tempdir + "/glove" gen_opts.K = 3 generator.Generate(gen_opts) }) // And load the index. vi, err := LoadVectorFromDisk(tempdir + "/glove.knn", tempdir + "/glove.idx") if err != nil { t.Errorf("Could not load vectors from disk: %v", err) } shared_tests(t, vi) }
explode_data.jsonl/10277
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 509 }
[ 2830, 3393, 8035, 5677, 1552, 1155, 353, 8840, 836, 8, 341, 220, 2730, 3741, 11, 1848, 1669, 43144, 65009, 6184, 19814, 330, 896, 6190, 349, 65192, 16839, 5130, 220, 421, 1848, 961, 2092, 341, 262, 259, 13080, 445, 12895, 537, 1855, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestChouonpuA(t *testing.T) { input := []inp{ {input: "アー", want: "aa"}, {input: "カーカ", want: "kaaka"}, {input: "キャーカ", want: "kyaaka"}, {input: "ガーカ", want: "gaaka"}, {input: "ギャーカ", want: "gyaaka"}, {input: "サーカ", want: "saaka"}, {input: "シャーカ", want: "shaaka"}, {input: "ザーカ", want: "zaaka"}, {input: "ジャーカ", want: "jaaka"}, {input: "ターカ", want: "taaka"}, {input: "チャーカ", want: "chaaka"}, {input: "ダーカ", want: "daaka"}, {input: "ヂャーカ", want: "jaaka"}, {input: "ナーカ", want: "naaka"}, {input: "ニャーカ", want: "nyaaka"}, {input: "ハーカ", want: "haaka"}, {input: "ヒャーカ", want: "hyaaka"}, {input: "バーカ", want: "baaka"}, {input: "ビャーカ", want: "byaaka"}, {input: "パーカ", want: "paaka"}, {input: "ピャーカ", want: "pyaaka"}, {input: "マーカ", want: "maaka"}, {input: "ミャーカ", want: "myaaka"}, {input: "ヤーカ", want: "yaaka"}, {input: "ラーカ", want: "raaka"}, {input: "リャーカ", want: "ryaaka"}, {input: "ワーカ", want: "waaka"}, } for _, v := range input { got, err := KanaToRomaji(v.input) assert.Equal(t, v.want, got) assert.Nil(t, err) } }
explode_data.jsonl/11357
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 564 }
[ 2830, 3393, 1143, 283, 263, 5584, 32, 1155, 353, 8840, 836, 8, 341, 22427, 1669, 3056, 42092, 515, 197, 197, 90, 1355, 25, 330, 127599, 497, 1366, 25, 330, 5305, 7115, 197, 197, 90, 1355, 25, 330, 70393, 37148, 104, 497, 1366, 25, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestValidateDeployNOKNilChaincodeSpec(t *testing.T) { state := make(map[string]map[string][]byte) state["lscc"] = make(map[string][]byte) v := newValidationInstance(state) ccname := "mycc" ccver := "1" defaultPolicy, err := getSignedByMSPAdminPolicy(mspid) assert.NoError(t, err) res, err := createCCDataRWset(ccname, ccname, ccver, defaultPolicy) assert.NoError(t, err) // Create a ChaincodeDeploymentSpec with nil ChaincodeSpec for negative test cdsBytes, err := proto.Marshal(&peer.ChaincodeDeploymentSpec{}) assert.NoError(t, err) // ChaincodeDeploymentSpec/ChaincodeSpec are derived from cdsBytes (i.e., cis.ChaincodeSpec.Input.Args[2]) cis := &peer.ChaincodeInvocationSpec{ ChaincodeSpec: &peer.ChaincodeSpec{ ChaincodeId: &peer.ChaincodeID{Name: "lscc"}, Input: &peer.ChaincodeInput{ Args: [][]byte{[]byte(lscc.DEPLOY), []byte("barf"), cdsBytes}, }, Type: peer.ChaincodeSpec_GOLANG, }, } prop, _, err := protoutil.CreateProposalFromCIS(common.HeaderType_ENDORSER_TRANSACTION, "testchannelid", cis, sid) assert.NoError(t, err) ccid := &peer.ChaincodeID{Name: ccname, Version: ccver} presp, err := protoutil.CreateProposalResponse(prop.Header, prop.Payload, &peer.Response{Status: 200}, res, nil, ccid, id) assert.NoError(t, err) env, err := protoutil.CreateSignedTx(prop, id, presp) assert.NoError(t, err) // good path: signed by the right MSP policy, err := getSignedByMSPMemberPolicy(mspid) if err != nil { t.Fatalf("failed getting policy, err %s", err) } b := &common.Block{Data: &common.BlockData{Data: [][]byte{protoutil.MarshalOrPanic(env)}}, Header: &common.BlockHeader{}} err = v.Validate(b, "lscc", 0, 0, policy) assert.EqualError(t, err, "VSCC error: invocation of lscc(deploy) does not have appropriate arguments") }
explode_data.jsonl/42501
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 674 }
[ 2830, 3393, 17926, 69464, 45, 3925, 19064, 18837, 1851, 8327, 1155, 353, 8840, 836, 8, 341, 24291, 1669, 1281, 9147, 14032, 60, 2186, 14032, 45725, 3782, 340, 24291, 1183, 4730, 638, 1341, 284, 1281, 9147, 14032, 45725, 3782, 692, 5195, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestStateToTerminalViewPortForwards(t *testing.T) { m := model.Manifest{ Name: "foo", }.WithDeployTarget(model.K8sTarget{ KubernetesApplySpec: v1alpha1.KubernetesApplySpec{ PortForwardTemplateSpec: &v1alpha1.PortForwardTemplateSpec{ Forwards: []v1alpha1.Forward{ {LocalPort: 8000, ContainerPort: 5000}, {LocalPort: 7000, ContainerPort: 5001}, }, }, }, }) state := newState([]model.Manifest{m}) v := StateToTerminalView(*state, &sync.RWMutex{}) res, _ := v.Resource(m.Name) assert.Equal(t, []string{"http://localhost:8000/", "http://localhost:7000/"}, res.Endpoints) }
explode_data.jsonl/54851
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 251 }
[ 2830, 3393, 1397, 1249, 47890, 851, 7084, 2461, 4014, 1155, 353, 8840, 836, 8, 341, 2109, 1669, 1614, 72272, 515, 197, 21297, 25, 330, 7975, 756, 197, 7810, 2354, 69464, 6397, 7635, 11352, 23, 82, 6397, 515, 197, 39340, 29827, 28497, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestPSITableType(t *testing.T) { assert.Equal(t, PSITableTypeBAT, psiTableType(74)) for i := 78; i <= 111; i++ { assert.Equal(t, PSITableTypeEIT, psiTableType(i)) } assert.Equal(t, PSITableTypeDIT, psiTableType(126)) for i := 64; i <= 65; i++ { assert.Equal(t, PSITableTypeNIT, psiTableType(i)) } assert.Equal(t, PSITableTypeNull, psiTableType(255)) assert.Equal(t, PSITableTypePAT, psiTableType(0)) assert.Equal(t, PSITableTypePMT, psiTableType(2)) assert.Equal(t, PSITableTypeRST, psiTableType(113)) assert.Equal(t, PSITableTypeSDT, psiTableType(66)) assert.Equal(t, PSITableTypeSDT, psiTableType(70)) assert.Equal(t, PSITableTypeSIT, psiTableType(127)) assert.Equal(t, PSITableTypeST, psiTableType(114)) assert.Equal(t, PSITableTypeTDT, psiTableType(112)) assert.Equal(t, PSITableTypeTOT, psiTableType(115)) }
explode_data.jsonl/25233
{ "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, 5012, 952, 480, 929, 1155, 353, 8840, 836, 8, 341, 6948, 12808, 1155, 11, 11405, 952, 480, 929, 61303, 11, 38026, 2556, 929, 7, 22, 19, 1171, 2023, 600, 1669, 220, 22, 23, 26, 600, 2651, 220, 16, 16, 16, 26, 600, 102...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestCollectorWithKafkaStorageType(t *testing.T) { jaeger := &v1.Jaeger{ ObjectMeta: metav1.ObjectMeta{ Name: "TestCollectorWithIngesterStorageType", }, Spec: v1.JaegerSpec{ Strategy: "streaming", Collector: v1.JaegerCollectorSpec{ Options: v1.NewOptions(map[string]interface{}{ "kafka.producer.topic": "mytopic", }), }, Storage: v1.JaegerStorageSpec{ Type: "elasticsearch", Options: v1.NewOptions(map[string]interface{}{ "kafka.producer.brokers": "http://brokers", "es.server-urls": "http://somewhere", }), }, }, } collector := NewCollector(jaeger) dep := collector.Get() envvars := []corev1.EnvVar{ { Name: "SPAN_STORAGE_TYPE", Value: "kafka", }, { Name: "COLLECTOR_ZIPKIN_HTTP_PORT", Value: "9411", }, } assert.Equal(t, envvars, dep.Spec.Template.Spec.Containers[0].Env) assert.Len(t, dep.Spec.Template.Spec.Containers[0].Args, 3) assert.Equal(t, "--kafka.producer.brokers=http://brokers", dep.Spec.Template.Spec.Containers[0].Args[0]) assert.Equal(t, "--kafka.producer.topic=mytopic", dep.Spec.Template.Spec.Containers[0].Args[1]) }
explode_data.jsonl/69129
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 529 }
[ 2830, 3393, 53694, 2354, 42, 21883, 5793, 929, 1155, 353, 8840, 836, 8, 341, 197, 5580, 1878, 1669, 609, 85, 16, 3503, 64, 1878, 515, 197, 23816, 12175, 25, 77520, 16, 80222, 515, 298, 21297, 25, 330, 2271, 53694, 2354, 25416, 5191, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestUploadDownloadFilenameEscaping(t *testing.T) { filename := "file%foo.txt" id := os.Getenv(apiID) key := os.Getenv(apiKey) if id == "" || key == "" { t.Skipf("B2_ACCOUNT_ID or B2_SECRET_KEY unset; skipping integration tests") } ctx := context.Background() // b2_authorize_account b2, err := AuthorizeAccount(ctx, id, key, UserAgent("blazer-base-test")) if err != nil { t.Fatal(err) } // b2_create_bucket bname := id + "-" + bucketName bucket, err := b2.CreateBucket(ctx, bname, "", nil, nil) if err != nil { t.Fatal(err) } defer func() { // b2_delete_bucket if err := bucket.DeleteBucket(ctx); err != nil { t.Error(err) } }() // b2_get_upload_url ue, err := bucket.GetUploadURL(ctx) if err != nil { t.Fatal(err) } // b2_upload_file smallFile := io.LimitReader(zReader{}, 128) hash := sha1.New() buf := &bytes.Buffer{} w := io.MultiWriter(hash, buf) if _, err := io.Copy(w, smallFile); err != nil { t.Error(err) } smallSHA1 := fmt.Sprintf("%x", hash.Sum(nil)) file, err := ue.UploadFile(ctx, buf, buf.Len(), filename, "application/octet-stream", smallSHA1, nil) if err != nil { t.Fatal(err) } defer func() { // b2_delete_file_version if err := file.DeleteFileVersion(ctx); err != nil { t.Error(err) } }() // b2_download_file_by_name fr, err := bucket.DownloadFileByName(ctx, filename, 0, 0, false) if err != nil { t.Fatal(err) } lbuf := &bytes.Buffer{} if _, err := io.Copy(lbuf, fr); err != nil { t.Fatal(err) } }
explode_data.jsonl/46957
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 648 }
[ 2830, 3393, 13844, 11377, 20759, 36121, 14216, 1155, 353, 8840, 836, 8, 341, 66434, 1669, 330, 1192, 4, 7975, 3909, 1837, 15710, 1669, 2643, 64883, 24827, 915, 340, 23634, 1669, 2643, 64883, 24827, 1592, 692, 743, 877, 621, 1591, 1369, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestStateInitial_Execute(t *testing.T) { t.Run("handles inbound invitation", func(t *testing.T) { s := &stateInitial{} next, finish, halt, err := s.Execute(&context{Inbound: true}, nil) require.NoError(t, err) require.IsType(t, &statePrepareResponse{}, next) require.NotNil(t, finish) require.False(t, halt) }) }
explode_data.jsonl/11779
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 131 }
[ 2830, 3393, 1397, 6341, 83453, 1155, 353, 8840, 836, 8, 341, 3244, 16708, 445, 43931, 64943, 28688, 497, 2915, 1155, 353, 8840, 836, 8, 341, 197, 1903, 1669, 609, 2454, 6341, 16094, 197, 28144, 11, 6248, 11, 26269, 11, 1848, 1669, 274...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestBatchErrorOneError(t *testing.T) { var batch BatchError batch.Add(errors.New(err1)) assert.NotNil(t, batch) assert.Equal(t, err1, batch.Err().Error()) assert.True(t, batch.NotNil()) }
explode_data.jsonl/43670
{ "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, 21074, 1454, 3966, 1454, 1155, 353, 8840, 836, 8, 341, 2405, 7162, 33904, 1454, 198, 2233, 754, 1904, 38881, 7121, 3964, 16, 1171, 6948, 93882, 1155, 11, 7162, 340, 6948, 12808, 1155, 11, 1848, 16, 11, 7162, 27862, 1005, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestFileStoreSave(t *testing.T) { path, tearDown := setupConfigFile(t, minimalConfig) defer tearDown() fsInner, err := config.NewFileStore(path, false) require.NoError(t, err) fs, err := config.NewStoreFromBacking(fsInner, nil, false) require.NoError(t, err) defer fs.Close() newCfg := &model.Config{ ServiceSettings: model.ServiceSettings{ SiteURL: sToP("http://new"), }, } t.Run("set with automatic save", func(t *testing.T) { _, err = fs.Set(newCfg) require.NoError(t, err) err = fs.Load() require.NoError(t, err) assert.Equal(t, "http://new", *fs.Get().ServiceSettings.SiteURL) }) }
explode_data.jsonl/32384
{ "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, 1703, 6093, 8784, 1155, 353, 8840, 836, 8, 341, 26781, 11, 32825, 1669, 6505, 2648, 1703, 1155, 11, 17377, 2648, 340, 16867, 32825, 2822, 53584, 31597, 11, 1848, 1669, 2193, 7121, 1703, 6093, 5581, 11, 895, 340, 17957, 35699...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestFragmentationProcess(t *testing.T) { for _, c := range processTestCases { t.Run(c.comment, func(t *testing.T) { f := NewFragmentation(1024, 512, DefaultReassembleTimeout) for i, in := range c.in { vv, done := f.Process(in.id, in.first, in.last, in.more, in.vv) if !reflect.DeepEqual(vv, c.out[i].vv) { t.Errorf("got Process(%d) = %+v, want = %+v", i, vv, c.out[i].vv) } if done != c.out[i].done { t.Errorf("got Process(%d) = %+v, want = %+v", i, done, c.out[i].done) } if c.out[i].done { if _, ok := f.reassemblers[in.id]; ok { t.Errorf("Process(%d) did not remove buffer from reassemblers", i) } for n := f.rList.Front(); n != nil; n = n.Next() { if n.id == in.id { t.Errorf("Process(%d) did not remove buffer from rList", i) } } } } }) } }
explode_data.jsonl/58450
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 424 }
[ 2830, 3393, 9488, 367, 7423, 1155, 353, 8840, 836, 8, 341, 2023, 8358, 272, 1669, 2088, 1882, 2271, 37302, 341, 197, 3244, 16708, 1337, 30970, 11, 2915, 1155, 353, 8840, 836, 8, 341, 298, 1166, 1669, 1532, 9488, 367, 7, 16, 15, 17, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
8
func TestValidateCert(t *testing.T) { testCases := map[string]struct { CertFile string Modify func(*x509.Certificate) *x509.Certificate ExpectedType cppki.CertType AssertErr assert.ErrorAssertionFunc }{ "as cert": { CertFile: "cp-as.crt", ExpectedType: cppki.AS, AssertErr: assert.NoError, }, "ca cert": { CertFile: "cp-ca.crt", ExpectedType: cppki.CA, AssertErr: assert.NoError, }, "root cert": { CertFile: "cp-root.crt", ExpectedType: cppki.Root, AssertErr: assert.NoError, }, "regular voting cert": { CertFile: "regular-voting.crt", ExpectedType: cppki.Regular, AssertErr: assert.NoError, }, "sensitive voting cert": { CertFile: "sensitive-voting.crt", ExpectedType: cppki.Sensitive, AssertErr: assert.NoError, }, "nil cert": { CertFile: "sensitive-voting.crt", Modify: func(*x509.Certificate) *x509.Certificate { return nil }, ExpectedType: cppki.Invalid, AssertErr: assert.Error, }, "invalid cert": { CertFile: "sensitive-voting.crt", Modify: func(c *x509.Certificate) *x509.Certificate { c.UnknownExtKeyUsage = nil return c }, ExpectedType: cppki.Invalid, AssertErr: assert.Error, }, } for name, tc := range testCases { name, tc := name, tc t.Run(name, func(t *testing.T) { t.Parallel() validCert, err := cppki.ReadPEMCerts(filepath.Join("./testdata", tc.CertFile)) require.NoError(t, err) input := validCert[0] if tc.Modify != nil { input = tc.Modify(input) } ct, err := cppki.ValidateCert(input) tc.AssertErr(t, err) assert.Equal(t, tc.ExpectedType, ct) }) } }
explode_data.jsonl/9854
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 812 }
[ 2830, 3393, 17926, 36934, 1155, 353, 8840, 836, 8, 341, 18185, 37302, 1669, 2415, 14032, 60, 1235, 341, 197, 6258, 529, 1703, 257, 914, 198, 197, 197, 44427, 981, 2915, 4071, 87, 20, 15, 24, 727, 20962, 8, 353, 87, 20, 15, 24, 727...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestServer_NoCrash_HandlerClose_Then_ClientClose(t *testing.T) { testServerResponse(t, func(w http.ResponseWriter, r *http.Request) error { // nothing return nil }, func(st *serverTester) { st.writeHeaders(HeadersFrameParam{ StreamID: 1, BlockFragment: st.encodeHeader(), EndStream: false, // DATA is coming EndHeaders: true, }) hf := st.wantHeaders() if !hf.HeadersEnded() || !hf.StreamEnded() { t.Fatalf("want END_HEADERS+END_STREAM, got %v", hf) } // Sent when the a Handler closes while a client has // indicated it's still sending DATA: st.wantRSTStream(1, ErrCodeNo) // Now the handler has ended, so it's ended its // stream, but the client hasn't closed its side // (stateClosedLocal). So send more data and verify // it doesn't crash with an internal invariant panic, like // it did before. st.writeData(1, true, []byte("foo")) // Get our flow control bytes back, since the handler didn't get them. st.wantWindowUpdate(0, uint32(len("foo"))) // Sent after a peer sends data anyway (admittedly the // previous RST_STREAM might've still been in-flight), // but they'll get the more friendly 'cancel' code // first. st.wantRSTStream(1, ErrCodeStreamClosed) // Set up a bunch of machinery to record the panic we saw // previously. var ( panMu sync.Mutex panicVal interface{} ) testHookOnPanicMu.Lock() testHookOnPanic = func(sc *serverConn, pv interface{}) bool { panMu.Lock() panicVal = pv panMu.Unlock() return true } testHookOnPanicMu.Unlock() // Now force the serve loop to end, via closing the connection. st.cc.Close() select { case <-st.sc.doneServing: // Loop has exited. panMu.Lock() got := panicVal panMu.Unlock() if got != nil { t.Errorf("Got panic: %v", got) } case <-time.After(5 * time.Second): t.Error("timeout") } }) }
explode_data.jsonl/71677
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 737 }
[ 2830, 3393, 5475, 36989, 16001, 988, 41879, 7925, 62, 12209, 46102, 7925, 1155, 353, 8840, 836, 8, 341, 18185, 5475, 2582, 1155, 11, 2915, 3622, 1758, 37508, 11, 435, 353, 1254, 9659, 8, 1465, 341, 197, 197, 322, 4302, 198, 197, 853, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestAsObjectKey(t *testing.T) { assert.Equal(t, AsObjectKey( metav1.ObjectMeta{Namespace: "ns1", Name: "thing"}), client.ObjectKey{Namespace: "ns1", Name: "thing"}) }
explode_data.jsonl/22343
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 72 }
[ 2830, 3393, 2121, 1190, 1592, 1155, 353, 8840, 836, 8, 341, 6948, 12808, 1155, 11, 1634, 1190, 1592, 1006, 197, 2109, 295, 402, 16, 80222, 90, 22699, 25, 330, 4412, 16, 497, 3988, 25, 330, 1596, 67432, 197, 25291, 8348, 1592, 90, 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