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 TestDistributionGetParams(t *testing.T) { cleanup, _, _, port := InitializeTestLCD(t, 1, []sdk.AccAddress{}, true) defer cleanup() res, body := Request(t, port, "GET", "/distribution/parameters", nil) require.Equal(t, http.StatusOK, res.StatusCode, body) require.NoError(t, cdc.UnmarshalJSON([]byte(body), &dclcommon.PrettyParams{})) }
explode_data.jsonl/25417
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 133 }
[ 2830, 3393, 62377, 1949, 4870, 1155, 353, 8840, 836, 8, 341, 1444, 60639, 11, 8358, 8358, 2635, 1669, 9008, 2271, 64003, 1155, 11, 220, 16, 11, 3056, 51295, 77538, 4286, 22655, 830, 340, 16867, 21290, 2822, 10202, 11, 2487, 1669, 6145, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestRead_EmptyTimeoutConfig(t *testing.T) { defaults := NewEnvBucket() readConfig := types.ReadConfig{} config := readConfig.Read(defaults) defaultVal := time.Duration(10) * time.Second if (config.ReadTimeout) != defaultVal { t.Logf("ReadTimeout want: %s, got %s", defaultVal.String(), config.ReadTimeout.String()) t.Fail() } if (config.WriteTimeout) != defaultVal { t.Logf("WriteTimeout want: %s, got %s", defaultVal.String(), config.ReadTimeout.String()) t.Fail() } if (config.TCPPort) != 8080 { t.Logf("TCPPort want: %d, got %d", 8080, config.TCPPort) t.Fail() } }
explode_data.jsonl/37420
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 227 }
[ 2830, 3393, 4418, 76060, 1595, 7636, 2648, 1155, 353, 8840, 836, 8, 341, 11940, 82, 1669, 1532, 14359, 36018, 741, 37043, 2648, 1669, 4494, 6503, 2648, 31483, 25873, 1669, 1349, 2648, 6503, 18978, 82, 340, 11940, 2208, 1669, 882, 33795, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_translateEndpointsV1Beta1(t *testing.T) { s := &model.Stack{ Name: "stackName", Endpoints: map[string]model.Endpoint{ "endpoint1": { Labels: model.Labels{"label1": "value1"}, Annotations: model.Annotations{"annotation1": "value1"}, Rules: []model.EndpointRule{ {Path: "/", Service: "svcName", Port: 80}, }, }, }, Services: map[string]*model.Service{ "svcName": { Image: "image", }, }, } result := translateIngressV1Beta1("endpoint1", s) if result.Name != "endpoint1" { t.Errorf("Wrong service name: '%s'", result.Name) } annotations := map[string]string{ model.OktetoIngressAutoGenerateHost: "true", "annotation1": "value1", } if !reflect.DeepEqual(result.Annotations, annotations) { t.Errorf("Wrong service annotations: '%s'", result.Annotations) } paths := []networkingv1beta1.HTTPIngressPath{ {Path: "/", Backend: networkingv1beta1.IngressBackend{ ServiceName: "svcName", ServicePort: intstr.IntOrString{IntVal: 80}, }, }, } if !reflect.DeepEqual(result.Spec.Rules[0].HTTP.Paths, paths) { t.Errorf("Wrong ingress: '%v'", result.Spec.Rules[0].HTTP.Paths) } labels := map[string]string{ model.StackNameLabel: "stackName", model.StackEndpointNameLabel: "endpoint1", "label1": "value1", } if !reflect.DeepEqual(result.Labels, labels) { t.Errorf("Wrong labels: '%s'", result.Labels) } }
explode_data.jsonl/23651
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 664 }
[ 2830, 3393, 66381, 80786, 53, 16, 64811, 16, 1155, 353, 8840, 836, 8, 341, 1903, 1669, 609, 2528, 58646, 515, 197, 21297, 25, 330, 7693, 675, 756, 197, 38407, 7706, 25, 2415, 14032, 60, 2528, 90409, 515, 298, 197, 1, 32540, 16, 788,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestClient_do(t *testing.T) { body := map[string]interface{}{"key": "main.js", "value": "alert('this is javascript');"} var client *HTTPClient server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { assert.Equal(t, r.Header.Get("X-Custom-Header"), "Checksum") assert.Equal(t, r.Header.Get("X-Shopify-Access-Token"), client.password) assert.Equal(t, r.Header.Get("Content-Type"), "application/json") assert.Equal(t, r.Header.Get("Accept"), "application/json") assert.Equal(t, r.Header.Get("User-Agent"), fmt.Sprintf("go/themekit (%s; %s; %s)", runtime.GOOS, runtime.GOARCH, release.ThemeKitVersion.String())) reqBody, err := ioutil.ReadAll(r.Body) assert.Nil(t, err) asset := struct { Key string `json:"key"` Value string `json:"value"` }{} assert.Nil(t, json.Unmarshal(reqBody, &asset)) assert.Equal(t, asset.Key, body["key"]) assert.Equal(t, asset.Value, body["value"]) })) client, err := NewClient(Params{ Domain: server.URL, Password: "secret_password", }) client.baseURL.Scheme = "http" assert.NotNil(t, client) assert.Nil(t, err) resp, err := client.Post("/assets.json", body, map[string]string{"X-Custom-Header": "Checksum"}) assert.Nil(t, err) assert.NotNil(t, resp) resp, err = client.Put("/assets.json", body, map[string]string{"X-Custom-Header": "Checksum"}) assert.Nil(t, err) assert.NotNil(t, resp) server.Close() server = httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { assert.Equal(t, r.Header.Get("X-Custom-Header"), "Foo") assert.Equal(t, r.Header.Get("X-Shopify-Access-Token"), client.password) assert.Equal(t, r.Header.Get("Content-Type"), "application/json") assert.Equal(t, r.Header.Get("Accept"), "application/json") assert.Equal(t, r.Header.Get("User-Agent"), fmt.Sprintf("go/themekit (%s; %s; %s)", runtime.GOOS, runtime.GOARCH, release.ThemeKitVersion.String())) })) client, _ = NewClient(Params{ Domain: server.URL, Password: "secret_password", }) client.baseURL.Scheme = "http" resp, err = client.Get("/assets.json", map[string]string{"X-Custom-Header": "Foo"}) assert.Nil(t, err) assert.NotNil(t, resp) resp, err = client.Delete("/assets.json", map[string]string{"X-Custom-Header": "Foo"}) assert.Nil(t, err) assert.NotNil(t, resp) server.Close() var request uint64 var mut sync.Mutex server = httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { mut.Lock() if request == 0 { request++ mut.Unlock() time.Sleep(5 * time.Millisecond) } else { mut.Unlock() } })) client, _ = NewClient(Params{ Domain: server.URL, Timeout: 5 * time.Millisecond, }) client.baseURL.Scheme = "http" assert.NotNil(t, client) assert.Nil(t, err) _, err = client.do("POST", "/assets.json", body, nil) assert.Nil(t, err) server.Close() server = httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { time.Sleep(3 * time.Second) })) client, _ = NewClient(Params{ Domain: server.URL, Timeout: 5 * time.Millisecond, }) client.maxRetry = 1 client.baseURL.Scheme = "http" assert.NotNil(t, client) assert.Nil(t, err) _, err = client.do("POST", "/assets.json", body, nil) assert.Contains(t, err.Error(), "request failed after 1 retries with err: ", server.URL) server.Close() }
explode_data.jsonl/78631
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1352 }
[ 2830, 3393, 2959, 26309, 1155, 353, 8840, 836, 8, 341, 35402, 1669, 2415, 14032, 31344, 6257, 4913, 792, 788, 330, 3817, 2857, 497, 330, 957, 788, 330, 5083, 492, 574, 374, 35710, 4667, 63159, 2405, 2943, 353, 9230, 2959, 198, 41057, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestAgentPoolProfile_ValidateAvailabilityProfile(t *testing.T) { t.Run("Should fail for invalid availability profile", func(t *testing.T) { t.Parallel() cs := getK8sDefaultContainerService(false) agentPoolProfiles := cs.Properties.AgentPoolProfiles agentPoolProfiles[0].AvailabilityProfile = "InvalidAvailabilityProfile" expectedMsg := "unknown availability profile type 'InvalidAvailabilityProfile' for agent pool 'agentpool'. Specify either AvailabilitySet, or VirtualMachineScaleSets" if err := cs.Properties.validateAgentPoolProfiles(true); err.Error() != expectedMsg { t.Errorf("expected error with message : %s, but got %s", expectedMsg, err.Error()) } }) t.Run("Should fail for AvailabilitySet + SinglePlacementGroup true", func(t *testing.T) { t.Parallel() cs := getK8sDefaultContainerService(false) agentPoolProfiles := cs.Properties.AgentPoolProfiles agentPoolProfiles[0].SinglePlacementGroup = to.BoolPtr(true) expectedMsg := fmt.Sprintf("singlePlacementGroup is only supported with VirtualMachineScaleSets") if err := cs.Properties.validateAgentPoolProfiles(true); err.Error() != expectedMsg { t.Errorf("expected error with message : %s, but got %s", expectedMsg, err.Error()) } }) t.Run("Should fail for AvailabilitySet + SinglePlacementGroup false", func(t *testing.T) { t.Parallel() cs := getK8sDefaultContainerService(false) agentPoolProfiles := cs.Properties.AgentPoolProfiles agentPoolProfiles[0].SinglePlacementGroup = to.BoolPtr(false) expectedMsg := fmt.Sprintf("singlePlacementGroup is only supported with VirtualMachineScaleSets") if err := cs.Properties.validateAgentPoolProfiles(true); err.Error() != expectedMsg { t.Errorf("expected error with message : %s, but got %s", expectedMsg, err.Error()) } }) t.Run("Should fail for AvailabilitySet + invalid LoadBalancerBackendAddressPoolIDs", func(t *testing.T) { t.Parallel() cs := getK8sDefaultContainerService(false) agentPoolProfiles := cs.Properties.AgentPoolProfiles agentPoolProfiles[0].AvailabilityProfile = AvailabilitySet agentPoolProfiles[0].LoadBalancerBackendAddressPoolIDs = []string{"/subscriptions/123/resourceGroups/rg/providers/Microsoft.Network/loadBalancers/myVMSSSLB/backendAddressPools/myVMSSSLBBEPool", ""} expectedMsg := fmt.Sprintf("AgentPoolProfile.LoadBalancerBackendAddressPoolIDs can not contain empty string. Agent pool name: %s", agentPoolProfiles[0].Name) if err := cs.Properties.validateAgentPoolProfiles(false); err.Error() != expectedMsg { t.Errorf("expected error with message : %s, but got %s", expectedMsg, err.Error()) } }) }
explode_data.jsonl/17889
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 822 }
[ 2830, 3393, 16810, 10551, 8526, 62, 17926, 51703, 8526, 1155, 353, 8840, 836, 8, 341, 3244, 16708, 445, 14996, 3690, 369, 8318, 18048, 5526, 497, 2915, 1155, 353, 8840, 836, 8, 341, 197, 3244, 41288, 7957, 741, 197, 71899, 1669, 633, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestBadTrustedCIDRsForRunUnix(t *testing.T) { router := New() router.TrustedProxies = []string{"hello/world"} unixTestSocket := filepath.Join(os.TempDir(), "unix_unit_test") defer os.Remove(unixTestSocket) go func() { router.GET("/example", func(c *Context) { c.String(http.StatusOK, "it worked") }) assert.Error(t, router.RunUnix(unixTestSocket)) }() // have to wait for the goroutine to start and run the server // otherwise the main thread will complete time.Sleep(5 * time.Millisecond) }
explode_data.jsonl/1170
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 184 }
[ 2830, 3393, 17082, 1282, 27145, 54146, 42327, 2461, 6727, 55832, 1155, 353, 8840, 836, 8, 341, 67009, 1669, 1532, 741, 67009, 8240, 27145, 1336, 80934, 284, 3056, 917, 4913, 14990, 78892, 63159, 20479, 941, 2271, 10286, 1669, 26054, 22363, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestNetworkContext(t *testing.T) { networkID := stringid.GenerateRandomID() var ctx networkContext cases := []struct { networkCtx networkContext expValue string call func() string }{ {networkContext{ n: types.NetworkResource{ID: networkID}, trunc: false, }, networkID, ctx.ID}, {networkContext{ n: types.NetworkResource{ID: networkID}, trunc: true, }, stringid.TruncateID(networkID), ctx.ID}, {networkContext{ n: types.NetworkResource{Name: "network_name"}, }, "network_name", ctx.Name}, {networkContext{ n: types.NetworkResource{Driver: "driver_name"}, }, "driver_name", ctx.Driver}, {networkContext{ n: types.NetworkResource{EnableIPv6: true}, }, "true", ctx.IPv6}, {networkContext{ n: types.NetworkResource{EnableIPv6: false}, }, "false", ctx.IPv6}, {networkContext{ n: types.NetworkResource{Internal: true}, }, "true", ctx.Internal}, {networkContext{ n: types.NetworkResource{Internal: false}, }, "false", ctx.Internal}, {networkContext{ n: types.NetworkResource{}, }, "", ctx.Labels}, {networkContext{ n: types.NetworkResource{Labels: map[string]string{"label1": "value1", "label2": "value2"}}, }, "label1=value1,label2=value2", ctx.Labels}, } for _, c := range cases { ctx = c.networkCtx v := c.call() if strings.Contains(v, ",") { compareMultipleValues(t, v, c.expValue) } else if v != c.expValue { t.Fatalf("Expected %s, was %s\n", c.expValue, v) } } }
explode_data.jsonl/62458
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 610 }
[ 2830, 3393, 12320, 1972, 1155, 353, 8840, 836, 8, 341, 9038, 2349, 915, 1669, 914, 307, 57582, 13999, 915, 2822, 2405, 5635, 3922, 1972, 198, 1444, 2264, 1669, 3056, 1235, 341, 197, 9038, 2349, 23684, 3922, 1972, 198, 197, 48558, 1130, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestMultipleSessions(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() vnet := getVirtualNetwork() ig := testinstance.NewTestInstanceGenerator(vnet, nil, nil) defer ig.Close() bgen := blocksutil.NewBlockGenerator() blk := bgen.Blocks(1)[0] inst := ig.Instances(2) a := inst[0] b := inst[1] ctx1, cancel1 := context.WithCancel(ctx) ses := a.Exchange.NewSession(ctx1) blkch, err := ses.GetBlocks(ctx, []cid.Cid{blk.Cid()}) if err != nil { t.Fatal(err) } cancel1() ses2 := a.Exchange.NewSession(ctx) blkch2, err := ses2.GetBlocks(ctx, []cid.Cid{blk.Cid()}) if err != nil { t.Fatal(err) } time.Sleep(time.Millisecond * 10) if err := b.Exchange.HasBlock(blk); err != nil { t.Fatal(err) } select { case <-blkch2: case <-time.After(time.Second * 20): t.Fatal("bad juju") } _ = blkch }
explode_data.jsonl/2228
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 378 }
[ 2830, 3393, 32089, 59062, 1155, 353, 8840, 836, 8, 341, 20985, 11, 9121, 1669, 2266, 26124, 9269, 5378, 19047, 2398, 16867, 9121, 2822, 5195, 4711, 1669, 633, 33026, 12320, 741, 197, 343, 1669, 1273, 4851, 7121, 2271, 2523, 12561, 3747, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestErrMissingField(t *testing.T) { expected := cli.FieldErrors{ &field.Error{ Type: field.ErrorTypeRequired, Field: "test-field", BadValue: "", Detail: "", }, } actual := cli.ErrMissingField(rifftesting.TestField) if diff := cmp.Diff(expected, actual); diff != "" { t.Errorf("(-expected, +actual): %s", diff) } }
explode_data.jsonl/13219
{ "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, 7747, 25080, 1877, 1155, 353, 8840, 836, 8, 341, 42400, 1669, 21348, 17087, 13877, 515, 197, 197, 5, 2566, 6141, 515, 298, 27725, 25, 257, 2070, 6141, 929, 8164, 345, 298, 94478, 25, 262, 330, 1944, 19130, 756, 298, 12791,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestHandlerSetErrorsPercentageReadError(t *testing.T) { handler := api.Handler{} response := doSetErrorsPercentageRequest(&handler, iotest.ErrReader(errors.New("error"))) checkStatusCode(t, response, http.StatusInternalServerError) }
explode_data.jsonl/48342
{ "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, 3050, 1649, 13877, 36167, 4418, 1454, 1155, 353, 8840, 836, 8, 341, 53326, 1669, 6330, 31010, 31483, 21735, 1669, 653, 1649, 13877, 36167, 1900, 2099, 17905, 11, 600, 354, 477, 27862, 5062, 38881, 7121, 445, 841, 2761, 692, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
func TestServerGetWithContent(t *testing.T) { h := func(ctx *RequestCtx) { ctx.Success("foo/bar", []byte("success")) } s := &Server{ Handler: h, } rw := &readWriter{} rw.r.WriteString("GET / HTTP/1.1\r\nHost: mm.com\r\nContent-Length: 5\r\n\r\nabcde") ch := make(chan error) go func() { ch <- s.ServeConn(rw) }() select { case err := <-ch: if err != nil { t.Fatalf("Unexpected error from serveConn: %s.", err) } case <-time.After(100 * time.Millisecond): t.Fatalf("timeout") } resp := rw.w.String() if !strings.HasSuffix(resp, "success") { t.Fatalf("unexpected response %s.", resp) } }
explode_data.jsonl/73278
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 272 }
[ 2830, 3393, 5475, 1949, 2354, 2762, 1155, 353, 8840, 836, 8, 341, 9598, 1669, 2915, 7502, 353, 1900, 23684, 8, 341, 197, 20985, 33320, 445, 7975, 49513, 497, 3056, 3782, 445, 5630, 5455, 197, 532, 1903, 1669, 609, 5475, 515, 197, 197,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestErrorResponse(t *testing.T) { var fakeError = ErrorResponse{ ErrorID: "test-error-id", Errors: []ErrorDetail{ ErrorDetail{ Code: 12345, Message: "Test error message.", Metadata: map[string]interface{}{ "fields": "test", }, }, }, } Convey("A valid ErrorResponse Error method call", t, func() { stringErr := fakeError.Error() Convey("Should give a valid string", func() { So(stringErr, ShouldStartWith, "Error from API. Error ID: test-error-id") }) }) }
explode_data.jsonl/1743
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 205 }
[ 2830, 3393, 55901, 1155, 353, 8840, 836, 8, 341, 2405, 12418, 1454, 284, 95724, 515, 197, 58421, 915, 25, 330, 1944, 18917, 12897, 756, 197, 197, 13877, 25, 3056, 1454, 10649, 515, 298, 58421, 10649, 515, 571, 90774, 25, 262, 220, 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 TestEqualFunc(t *testing.T) { t.Parallel() s1 := []float64{1, 2, 3, 4} s2 := []float64{1, 2, 3, 4} eq := func(x, y float64) bool { return x == y } if !EqualFunc(s1, s2, eq) { t.Errorf("Equal slices returned as unequal") } s2 = []float64{1, 2, 3, 4 + 1e-14} if EqualFunc(s1, s2, eq) { t.Errorf("Unequal slices returned as equal") } if EqualFunc(s1, []float64{}, eq) { t.Errorf("Unequal slice lengths returned as equal") } }
explode_data.jsonl/1221
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 207 }
[ 2830, 3393, 2993, 9626, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 741, 1903, 16, 1669, 3056, 3649, 21, 19, 90, 16, 11, 220, 17, 11, 220, 18, 11, 220, 19, 532, 1903, 17, 1669, 3056, 3649, 21, 19, 90, 16, 11, 220, 17, 11,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestWindowsProfile_Validate(t *testing.T) { tests := []struct { name string orchestratorType string w *WindowsProfile expectedMsg string }{ { name: "unsupported orchestrator", orchestratorType: "Mesos", w: &WindowsProfile{ WindowsImageSourceURL: "http://fakeWindowsImageSourceURL", }, expectedMsg: "Windows Custom Images are only supported if the Orchestrator Type is DCOS or Kubernetes", }, { name: "empty adminUsername", orchestratorType: "Kubernetes", w: &WindowsProfile{ WindowsImageSourceURL: "http://fakeWindowsImageSourceURL", AdminUsername: "", AdminPassword: "password", }, expectedMsg: "WindowsProfile.AdminUsername is required, when agent pool specifies windows", }, { name: "empty password", orchestratorType: "DCOS", w: &WindowsProfile{ WindowsImageSourceURL: "http://fakeWindowsImageSourceURL", AdminUsername: "azure", AdminPassword: "", }, expectedMsg: "WindowsProfile.AdminPassword is required, when agent pool specifies windows", }, } for _, test := range tests { test := test t.Run(test.name, func(t *testing.T) { t.Parallel() err := test.w.Validate(test.orchestratorType) if err.Error() != test.expectedMsg { t.Errorf("should error on unsupported orchType with msg : %s, but got : %s", test.expectedMsg, err.Error()) } }) } }
explode_data.jsonl/17885
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 612 }
[ 2830, 3393, 13164, 8526, 62, 17926, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 3056, 1235, 341, 197, 11609, 1797, 914, 198, 197, 197, 21584, 15111, 850, 929, 914, 198, 197, 6692, 394, 353, 13164, 8526, 198, 197, 42400, 6611, 414, 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...
2
func TestCodeBytesSlice(t *testing.T) { var buf = make([]byte, 64) var v [][]byte = [][]byte{{1}, {2}} var n uint64 n = EncodeBytesSlice(buf, v) var v2 [][]byte = make([][]byte, 2) n = DecodeBytesSlice(buf[:n], &v2) if v[0][0] != v2[0][0] { t.Errorf("error %d != %d", v[0][0], v2[0][0]) } if n != SizeofBytesSlice(v) { t.Errorf("error %d != %d", n, len(buf[:n])) } }
explode_data.jsonl/58565
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 195 }
[ 2830, 3393, 2078, 7078, 33236, 1155, 353, 8840, 836, 8, 341, 2405, 6607, 284, 1281, 10556, 3782, 11, 220, 21, 19, 340, 2405, 348, 52931, 3782, 284, 52931, 3782, 2979, 16, 2137, 314, 17, 11248, 2405, 308, 2622, 21, 19, 198, 9038, 284...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestLoadGraphToElastic_fileFailsToInsert(t *testing.T) { const ( pkgpath = "github.com/korfuri/goref/testprograms/interfaces" main = "v1@0@github.com/korfuri/goref/testprograms/interfaces" lib = "v1@0@github.com/korfuri/goref/testprograms/interfaces/lib" ) client := &mocks.Client{} // fmt and simple don't exist for this test. client.On("GetPackage", mock.Anything, main).Return(nil, errors.New("not found")) client.On("GetPackage", mock.Anything, lib).Return(nil, errors.New("not found")) // Creating packages, files and refs always works, except to // create lib's file. client.On("CreatePackage", mock.Anything, mock.Anything).Return(nil) matchLibGo := func(f elasticsearch.File) bool { return f.Filename == "github.com/korfuri/goref/testprograms/interfaces/lib/lib.go" } matchNotLibGo := func(f elasticsearch.File) bool { return !matchLibGo(f) } client.On("CreateFile", mock.Anything, mock.MatchedBy(matchNotLibGo)).Return(&elastic.IndexResponse{}, nil) client.On("CreateFile", mock.Anything, mock.MatchedBy(matchLibGo)).Return(nil, errors.New("cannot create file lib.go")) client.On("CreateRef", mock.Anything, mock.Anything).Return(&elastic.IndexResponse{}, nil) pg := goref.NewPackageGraph(goref.ConstantVersion(0)) pg.LoadPackages([]string{pkgpath}, false) err := elasticsearch.LoadGraphToElastic(*pg, client) assert.Error(t, err) assert.Equal(t, "1 entries couldn't be imported. Errors were:\ncannot create file lib.go\n", err.Error()) }
explode_data.jsonl/54350
{ "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, 5879, 11212, 1249, 36, 51179, 2458, 37, 6209, 1249, 13780, 1155, 353, 8840, 836, 8, 341, 4777, 2399, 197, 3223, 7351, 2343, 284, 330, 5204, 905, 14109, 32842, 6070, 4846, 46752, 12697, 72953, 59771, 698, 197, 36641, 262, 284...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestConverterRecursiveNested(t *testing.T) { fieldMap := make(map[string]codegen.FieldMapperEntry) lines, err := convertTypes( "Foo", "Bar", ` struct StringFoo { 1: required string one 2: optional StringFoo recur } struct Foo { 1: required string three 2: required StringFoo recur } struct Bar { 1: required string three 2: required StringFoo recur }`, nil, fieldMap, ) assert.NoError(t, err) assertPrettyEqual(t, trim(` out.Three = string(in.Three) var convertStringFooHelper1 func(in *structs.StringFoo) (out *structs.StringFoo) convertStringFooHelper1 = func(in *structs.StringFoo) (out *structs.StringFoo) { if in != nil { out = &structs.StringFoo{} out.One = string(in.One) out.Recur = convertStringFooHelper1(in.Recur) } else { out = nil } return } out.Recur = convertStringFooHelper1(in.Recur) `), lines) }
explode_data.jsonl/62093
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 389 }
[ 2830, 3393, 14920, 78542, 71986, 1155, 353, 8840, 836, 8, 341, 39250, 2227, 1669, 1281, 9147, 14032, 60, 95859, 17087, 10989, 5874, 692, 78390, 11, 1848, 1669, 5508, 4173, 1006, 197, 197, 1, 40923, 497, 330, 3428, 756, 197, 197, 3989, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestHandleTestsOrderGet(t *testing.T) { tests := []struct { name string wantCode int wantBody string order []string tests config.Tests }{ { name: "Testing getting set of test names", wantCode: http.StatusOK, wantBody: `["test1","test2","test3"]` + "\n", order: []string{"test1", "test2", "test3"}, }, { name: "Testing getting set of test names, provision included", wantCode: http.StatusOK, wantBody: `["provision","test1","test2"]` + "\n", order: []string{"test1", "test2"}, tests: config.Tests{"provision": []config.Test{}}, }, { name: "Testing getting test order with no order specified", wantCode: http.StatusOK, wantBody: `[]` + "\n", order: []string{}, }, } for _, test := range tests { viper.Reset() t.Run(test.name, func(t *testing.T) { viper.Set("order", test.order) viper.Set("tests", test.tests) resRecorder := httptest.NewRecorder() request, _ := http.NewRequest("GET", "/test/order", nil) router := mux.NewRouter() router.HandleFunc("/test/order", handleTestsOrderGet).Methods("GET") router.ServeHTTP(resRecorder, request) if code := resRecorder.Code; code != test.wantCode { t.Errorf("Expected code %d, got %d", test.wantCode, code) } else if diff := cmp.Diff(test.wantBody, string(resRecorder.Body.Bytes())); diff != "" { t.Errorf("Error in getting test order (-want +got): %s", diff) } }) } }
explode_data.jsonl/18690
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 611 }
[ 2830, 3393, 6999, 18200, 4431, 1949, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 3056, 1235, 341, 197, 11609, 257, 914, 198, 197, 50780, 2078, 526, 198, 197, 50780, 5444, 914, 198, 197, 42245, 262, 3056, 917, 198, 197, 78216, 262, 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...
3
func TestBase64Credentials(t *testing.T) { username := "foo" password := "bar" expected := "Zm9vOmJhcg==" assert.Equal(t, expected, util.Base64Credentials(username, password)) }
explode_data.jsonl/45437
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 71 }
[ 2830, 3393, 3978, 21, 19, 27025, 1155, 353, 8840, 836, 8, 341, 72358, 1669, 330, 7975, 698, 58199, 1669, 330, 2257, 698, 42400, 1669, 330, 57, 76, 24, 85, 63488, 41, 71, 27446, 418, 1837, 6948, 12808, 1155, 11, 3601, 11, 4094, 13018...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestSessionService(t *testing.T) { tmpdir, err := ioutil.TempDir("", "test-session") require.NoError(t, err) ss, err := NewSessionService(tmpdir, securecookie.GenerateRandomKey(32)) require.NoError(t, err) r := httptest.NewRequest("GET", "/", nil) w := httptest.NewRecorder() _, errNoSession := ss.Get(w, r) assert.True(t, errors.Is(errNoSession, SessionNotValid)) if err := ss.New(w, r, AccountID(1)); err != nil { require.NoError(t, err) } assert.Greater(t, len(w.Header().Get("Set-Cookie")), 0) r2 := httptest.NewRequest("GET", "/", nil) r2.Header.Set("Cookie", w.Header().Get("Set-Cookie")) id, err := ss.Get(w, r2) assert.Equal(t, AccountID(1), id) assert.NoError(t, err) }
explode_data.jsonl/14195
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 289 }
[ 2830, 3393, 5283, 1860, 1155, 353, 8840, 836, 8, 341, 20082, 3741, 11, 1848, 1669, 43144, 65009, 6184, 19814, 330, 1944, 57181, 1138, 17957, 35699, 1155, 11, 1848, 340, 34472, 11, 1848, 1669, 1532, 5283, 1860, 10368, 3741, 11, 9767, 162...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestShouldResign(t *testing.T) { startTime := time.Date(1970, 9, 19, 12, 00, 00, 00, time.UTC) var tests = []struct { hold time.Duration odds int wantHold time.Duration wantProb float64 }{ {hold: 12 * time.Second, odds: 10, wantHold: 12 * time.Second, wantProb: 0.1}, {hold: time.Second, odds: 10, wantHold: 10 * time.Second, wantProb: 0.1}, {hold: 10 * time.Second, odds: 0, wantHold: 10 * time.Second, wantProb: 1.0}, {hold: 10 * time.Second, odds: 1, wantHold: 10 * time.Second, wantProb: 1.0}, {hold: 10 * time.Second, odds: -1, wantHold: 10 * time.Second, wantProb: 1.0}, } for _, test := range tests { fakeTimeSource := util.FakeTimeSource{} info := fixupElectionInfo(LogOperationInfo{ MasterHoldInterval: test.hold, ResignOdds: test.odds, TimeSource: &fakeTimeSource, }) er := electionRunner{info: &info} holdChecks := int64(10) holdNanos := test.wantHold.Nanoseconds() / holdChecks timeslot: for i := int64(-1); i < holdChecks; i++ { gapNanos := time.Duration(i * holdNanos) fakeTimeSource.Set(startTime.Add(gapNanos)) for j := 0; j < 100; j++ { if er.shouldResign(startTime) { t.Errorf("shouldResign(hold=%v,odds=%v @ start+%v)=true; want false", test.hold, test.odds, gapNanos) continue timeslot } } } fakeTimeSource.Set(startTime.Add(test.wantHold).Add(time.Nanosecond)) iterations := 10000 count := 0 for i := 0; i < iterations; i++ { if er.shouldResign(startTime) { count++ } } got := float64(count) / float64(iterations) deltaFraction := math.Abs(got-test.wantProb) / test.wantProb if deltaFraction > 0.05 { t.Errorf("P(shouldResign(hold=%v,odds=%v))=%f; want ~%f", test.hold, test.odds, got, test.wantProb) } } }
explode_data.jsonl/55526
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 770 }
[ 2830, 3393, 14996, 1061, 622, 1155, 353, 8840, 836, 8, 341, 21375, 1462, 1669, 882, 8518, 7, 16, 24, 22, 15, 11, 220, 24, 11, 220, 16, 24, 11, 220, 16, 17, 11, 220, 15, 15, 11, 220, 15, 15, 11, 220, 15, 15, 11, 882, 87069, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestValidateDeployOK(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) tx, err := createLSCCTx(ccname, ccver, lscc.DEPLOY, res) if err != nil { t.Fatalf("createTx returned err %s", err) } envBytes, err := protoutil.GetBytesEnvelope(tx) if err != nil { t.Fatalf("GetBytesEnvelope returned err %s", 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{envBytes}}} err = v.Validate(b, "lscc", 0, 0, policy) assert.NoError(t, err) }
explode_data.jsonl/42502
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 362 }
[ 2830, 3393, 17926, 69464, 3925, 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, 1669, 501, 13799, 2523, 8390, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestReferenceTraversal(t *testing.T) { sch, err := ioutil.ReadFile("testdata/draft-07_schema.json") if err != nil { t.Errorf("error reading file: %s", err.Error()) return } rs := &RootSchema{} if err := rs.UnmarshalJSON(sch); err != nil { t.Errorf("unexpected unmarshal error: %s", err.Error()) return } elements := 0 expectElements := 120 refs := 0 expectRefs := 29 walkJSON(rs, func(elem JSONPather) error { elements++ if sch, ok := elem.(*Schema); ok { if sch.Ref != "" { refs++ } } return nil }) if elements != expectElements { t.Errorf("expected %d elements, got: %d", expectElements, elements) } if refs != expectRefs { t.Errorf("expected %d references, got: %d", expectRefs, refs) } cases := []struct { input string elements int refs int }{ {`{ "not" : { "$ref":"#" }}`, 3, 1}, } for i, c := range cases { rs := &RootSchema{} if err := rs.UnmarshalJSON([]byte(c.input)); err != nil { t.Errorf("unexpected unmarshal error: %s", err.Error()) return } elements := 0 refs := 0 walkJSON(rs, func(elem JSONPather) error { elements++ if sch, ok := elem.(*Schema); ok { if sch.Ref != "" { refs++ } } return nil }) if elements != c.elements { t.Errorf("case %d: expected %d elements, got: %d", i, c.elements, elements) } if refs != c.refs { t.Errorf("case %d: expected %d references, got: %d", i, c.refs, refs) } } }
explode_data.jsonl/30316
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 646 }
[ 2830, 3393, 8856, 76276, 1155, 353, 8840, 836, 8, 341, 1903, 331, 11, 1848, 1669, 43144, 78976, 445, 92425, 3446, 2944, 12, 15, 22, 25371, 4323, 1138, 743, 1848, 961, 2092, 341, 197, 3244, 13080, 445, 841, 5290, 1034, 25, 1018, 82, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestAccCirconusCheckConsul_node(t *testing.T) { checkName := fmt.Sprintf("Terraform test: consul.service.consul mode=state check - %s", acctest.RandString(5)) checkNode := fmt.Sprintf("my-node-name-or-node-id-%s", acctest.RandString(5)) resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, CheckDestroy: testAccCheckDestroyCirconusCheckBundle, Steps: []resource.TestStep{ { Config: fmt.Sprintf(testAccCirconusCheckConsulConfigV1HealthNodeFmt, checkName, checkNode), Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttr("circonus_check.consul_server", "active", "true"), resource.TestMatchResourceAttr("circonus_check.consul_server", "check_id", regexp.MustCompile(config.CheckCIDRegex)), resource.TestCheckResourceAttr("circonus_check.consul_server", "collector.#", "1"), resource.TestCheckResourceAttr("circonus_check.consul_server", "collector.2084916526.id", "/broker/2110"), resource.TestCheckResourceAttr("circonus_check.consul_server", "consul.#", "1"), // resource.TestCheckResourceAttr("circonus_check.consul_server", "consul.0.ca_chain", ""), // resource.TestCheckResourceAttr("circonus_check.consul_server", "consul.0.certificate_file", ""), // resource.TestCheckResourceAttr("circonus_check.consul_server", "consul.0.ciphers", ""), // resource.TestCheckResourceAttr("circonus_check.consul_server", "consul.0.key_file", ""), resource.TestCheckResourceAttr("circonus_check.consul_server", "consul.0.dc", "dc2"), resource.TestCheckNoResourceAttr("circonus_check.consul_server", "consul.0.headers"), resource.TestCheckResourceAttr("circonus_check.consul_server", "consul.0.http_addr", "http://consul.service.consul:8501"), resource.TestCheckResourceAttr("circonus_check.consul_server", "consul.0.node", checkNode), resource.TestCheckResourceAttr("circonus_check.consul_server", "consul.0.node_blacklist.#", "3"), resource.TestCheckResourceAttr("circonus_check.consul_server", "consul.0.node_blacklist.0", "a"), resource.TestCheckResourceAttr("circonus_check.consul_server", "consul.0.node_blacklist.1", "bad"), resource.TestCheckResourceAttr("circonus_check.consul_server", "consul.0.node_blacklist.2", "node"), resource.TestCheckResourceAttr("circonus_check.consul_server", "notes", ""), resource.TestCheckResourceAttr("circonus_check.consul_server", "period", "60s"), resource.TestCheckResourceAttr("circonus_check.consul_server", "metric.#", "2"), resource.TestCheckResourceAttr("circonus_check.consul_server", "metric.3333874791.active", "true"), resource.TestCheckResourceAttr("circonus_check.consul_server", "metric.3333874791.name", "KnownLeader"), resource.TestCheckResourceAttr("circonus_check.consul_server", "metric.3333874791.tags.#", "2"), resource.TestCheckResourceAttr("circonus_check.consul_server", "metric.3333874791.tags.1401442048", "lifecycle:unittest"), resource.TestCheckResourceAttr("circonus_check.consul_server", "metric.3333874791.tags.2058715988", "source:consul"), resource.TestCheckResourceAttr("circonus_check.consul_server", "metric.3333874791.type", "text"), resource.TestCheckResourceAttr("circonus_check.consul_server", "metric.3148913305.active", "true"), resource.TestCheckResourceAttr("circonus_check.consul_server", "metric.3148913305.name", "LastContact"), resource.TestCheckResourceAttr("circonus_check.consul_server", "metric.3148913305.tags.#", "2"), resource.TestCheckResourceAttr("circonus_check.consul_server", "metric.3148913305.tags.1401442048", "lifecycle:unittest"), resource.TestCheckResourceAttr("circonus_check.consul_server", "metric.3148913305.tags.2058715988", "source:consul"), resource.TestCheckResourceAttr("circonus_check.consul_server", "metric.3148913305.type", "numeric"), resource.TestCheckResourceAttr("circonus_check.consul_server", "metric.3148913305.unit", "seconds"), resource.TestCheckResourceAttr("circonus_check.consul_server", "tags.#", "2"), resource.TestCheckResourceAttr("circonus_check.consul_server", "tags.1401442048", "lifecycle:unittest"), resource.TestCheckResourceAttr("circonus_check.consul_server", "tags.2058715988", "source:consul"), resource.TestCheckResourceAttr("circonus_check.consul_server", "target", "consul.service.consul"), resource.TestCheckResourceAttr("circonus_check.consul_server", "type", "consul"), ), }, }, }) }
explode_data.jsonl/28949
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1769 }
[ 2830, 3393, 14603, 34, 88276, 355, 3973, 15220, 360, 5084, 1155, 353, 8840, 836, 8, 341, 25157, 675, 1669, 8879, 17305, 445, 51, 13886, 627, 1273, 25, 74189, 5736, 63201, 360, 3856, 28, 2454, 1779, 481, 1018, 82, 497, 1613, 67880, 201...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestPasswordValidatorEncode(t *testing.T) { testCases := []encoderTestCase{ { name: `MinLen=0,MaxLen=0`, schema: schema.Schema{ Fields: schema.Fields{ "p": { Validator: &schema.Password{}, }, }, }, customValidate: fieldValidator("p", `{"type": "string", "format": "password"}`), }, { name: `MinLen=3,MaxLen=23`, schema: schema.Schema{ Fields: schema.Fields{ "p": { Validator: &schema.Password{ MinLen: 3, MaxLen: 23, }, }, }, }, customValidate: fieldValidator("p", `{"type": "string", "format": "password", "minLength": 3, "maxLength": 23}`), }, { name: `MaxLen=23`, schema: schema.Schema{ Fields: schema.Fields{ "s": { Validator: &schema.String{ MaxLen: 23, }, }, }, }, customValidate: fieldValidator("s", `{"type": "string", "maxLength": 23}`), }, { name: `MinLen=3`, schema: schema.Schema{ Fields: schema.Fields{ "s": { Validator: &schema.String{ MinLen: 3, }, }, }, }, customValidate: fieldValidator("s", `{"type": "string", "minLength": 3}`), }, } for i := range testCases { testCases[i].Run(t) } }
explode_data.jsonl/7607
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 629 }
[ 2830, 3393, 4876, 14256, 32535, 1155, 353, 8840, 836, 8, 341, 18185, 37302, 1669, 3056, 27008, 16458, 515, 197, 197, 515, 298, 11609, 25, 1565, 6217, 11271, 28, 15, 11, 5974, 11271, 28, 15, 12892, 298, 1903, 3416, 25, 10802, 21105, 51...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestExportLogsOp(t *testing.T) { tt, err := obsreporttest.SetupTelemetry() require.NoError(t, err) t.Cleanup(func() { require.NoError(t, tt.Shutdown(context.Background())) }) parentCtx, parentSpan := tt.TracerProvider.Tracer("test").Start(context.Background(), t.Name()) defer parentSpan.End() obsrep := NewExporter(ExporterSettings{ Level: configtelemetry.LevelNormal, ExporterID: exporter, ExporterCreateSettings: tt.ToExporterCreateSettings(), }) params := []testParams{ {items: 17, err: nil}, {items: 23, err: errFake}, } for i := range params { ctx := obsrep.StartLogsOp(parentCtx) assert.NotNil(t, ctx) obsrep.EndLogsOp(ctx, params[i].items, params[i].err) } spans := tt.SpanRecorder.Ended() require.Equal(t, len(params), len(spans)) var sentLogRecords, failedToSendLogRecords int for i, span := range spans { assert.Equal(t, "exporter/"+exporter.String()+"/logs", span.Name()) switch params[i].err { case nil: sentLogRecords += params[i].items require.Contains(t, span.Attributes(), attribute.KeyValue{Key: obsmetrics.SentLogRecordsKey, Value: attribute.Int64Value(int64(params[i].items))}) require.Contains(t, span.Attributes(), attribute.KeyValue{Key: obsmetrics.FailedToSendLogRecordsKey, Value: attribute.Int64Value(0)}) assert.Equal(t, codes.Unset, span.Status().Code) case errFake: failedToSendLogRecords += params[i].items require.Contains(t, span.Attributes(), attribute.KeyValue{Key: obsmetrics.SentLogRecordsKey, Value: attribute.Int64Value(0)}) require.Contains(t, span.Attributes(), attribute.KeyValue{Key: obsmetrics.FailedToSendLogRecordsKey, Value: attribute.Int64Value(int64(params[i].items))}) assert.Equal(t, codes.Error, span.Status().Code) assert.Equal(t, params[i].err.Error(), span.Status().Description) default: t.Fatalf("unexpected error: %v", params[i].err) } } require.NoError(t, obsreporttest.CheckExporterLogs(tt, exporter, int64(sentLogRecords), int64(failedToSendLogRecords))) }
explode_data.jsonl/57972
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 778 }
[ 2830, 3393, 16894, 51053, 7125, 1155, 353, 8840, 836, 8, 341, 3244, 83, 11, 1848, 1669, 7448, 11736, 1944, 39820, 6639, 35958, 741, 17957, 35699, 1155, 11, 1848, 340, 3244, 727, 60639, 18552, 368, 314, 1373, 35699, 1155, 11, 17853, 1084...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestDeleteUser_DB(t *testing.T) { userlist, _ = FindAllUser() cases := []struct { in User want []User }{ {t_users[0], t_users[1:3]}, {t_users[1], t_users[2:3]}, {t_users[2], []User{}}, } for _, c := range cases { DeleteUser_DB(&c.in) userlist, _ = FindAllUser() fmt.Printf("DeleteUser_DB userlist: %v want: %v\n", userlist, c.want) if got := userlist; !reflect.DeepEqual(got, c.want) { t.Errorf("DeleteUser_DB(%q) == %q, want %q", c.in, got, c.want) } } }
explode_data.jsonl/66506
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 307 }
[ 2830, 3393, 6435, 1474, 16310, 1155, 353, 8840, 836, 8, 341, 262, 1196, 1607, 11, 716, 284, 7379, 2403, 1474, 741, 262, 5048, 1669, 3056, 1235, 341, 286, 304, 2657, 198, 286, 1366, 3056, 1474, 198, 262, 335, 515, 286, 314, 83, 16348...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestShortFlag(t *testing.T) { app := New("test", "") f := app.Flag("long", "").Short('s').Bool() _, err := app.Parse([]string{"-s"}) assert.NoError(t, err) assert.True(t, *f) }
explode_data.jsonl/74862
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 83 }
[ 2830, 3393, 12472, 12135, 1155, 353, 8840, 836, 8, 341, 28236, 1669, 1532, 445, 1944, 497, 14676, 1166, 1669, 906, 80911, 445, 4825, 497, 35229, 12472, 492, 82, 1823, 11233, 741, 197, 6878, 1848, 1669, 906, 8937, 10556, 917, 4913, 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
func TestMetricSlice_RemoveIf(t *testing.T) { // Test RemoveIf on empty slice emptySlice := NewMetricSlice() emptySlice.RemoveIf(func(el Metric) bool { t.Fail() return false }) // Test RemoveIf filtered := generateTestMetricSlice() pos := 0 filtered.RemoveIf(func(el Metric) bool { pos++ return pos%3 == 0 }) assert.Equal(t, 5, filtered.Len()) }
explode_data.jsonl/32684
{ "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, 54310, 33236, 66843, 2679, 1155, 353, 8840, 836, 8, 341, 197, 322, 3393, 10783, 2679, 389, 4287, 15983, 198, 197, 3194, 33236, 1669, 1532, 54310, 33236, 741, 197, 3194, 33236, 13270, 2679, 18552, 18584, 52458, 8, 1807, 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...
1
func TestStateProposerSelection2(t *testing.T) { config := configSetup(t) ctx, cancel := context.WithCancel(context.Background()) defer cancel() cs1, vss := makeState(ctx, t, makeStateArgs{config: config}) // test needs more work for more than 3 validators height := cs1.Height newRoundCh := subscribe(ctx, t, cs1.eventBus, types.EventQueryNewRound) // this time we jump in at round 2 incrementRound(vss[1:]...) incrementRound(vss[1:]...) var round int32 = 2 startTestRound(ctx, cs1, height, round) ensureNewRound(t, newRoundCh, height, round) // wait for the new round // everyone just votes nil. we get a new proposer each round for i := int32(0); int(i) < len(vss); i++ { prop := cs1.GetRoundState().Validators.GetProposer() pvk, err := vss[int(i+round)%len(vss)].GetPubKey(ctx) require.NoError(t, err) addr := pvk.Address() correctProposer := addr require.True(t, bytes.Equal(prop.Address, correctProposer), "expected RoundState.Validators.GetProposer() to be validator %d. Got %X", int(i+2)%len(vss), prop.Address) signAddVotes(ctx, t, cs1, tmproto.PrecommitType, config.ChainID(), types.BlockID{}, vss[1:]...) ensureNewRound(t, newRoundCh, height, i+round+1) // wait for the new round event each round incrementRound(vss[1:]...) } }
explode_data.jsonl/54256
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 478 }
[ 2830, 3393, 1397, 2008, 23438, 11177, 17, 1155, 353, 8840, 836, 8, 341, 25873, 1669, 2193, 21821, 1155, 692, 20985, 11, 9121, 1669, 2266, 26124, 9269, 5378, 19047, 2398, 16867, 9121, 741, 71899, 16, 11, 348, 778, 1669, 1281, 1397, 7502,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestRest_Vote(t *testing.T) { ts, _, teardown := startupT(t) defer teardown() c1 := store.Comment{Text: "test test #1", Locator: store.Locator{SiteID: "remark42", URL: "https://radio-t.com/blah"}} c2 := store.Comment{Text: "test test #2", ParentID: "p1", Locator: store.Locator{SiteID: "remark42", URL: "https://radio-t.com/blah"}} id1 := addComment(t, c1, ts) addComment(t, c2, ts) vote := func(val int) int { client := http.Client{} req, err := http.NewRequest(http.MethodPut, fmt.Sprintf("%s/api/v1/vote/%s?site=remark42&url=https://radio-t.com/blah&vote=%d", ts.URL, id1, val), nil) assert.NoError(t, err) req.Header.Add("X-JWT", devToken) resp, err := client.Do(req) assert.NoError(t, err) assert.NoError(t, resp.Body.Close()) return resp.StatusCode } assert.Equal(t, 200, vote(1), "first vote allowed") assert.Equal(t, 400, vote(1), "second vote rejected") body, code := getWithDevAuth(t, fmt.Sprintf("%s/api/v1/id/%s?site=remark42&url=https://radio-t.com/blah", ts.URL, id1)) assert.Equal(t, 200, code) cr := store.Comment{} err := json.Unmarshal([]byte(body), &cr) assert.NoError(t, err) assert.Equal(t, 1, cr.Score) assert.Equal(t, 1, cr.Vote) assert.Equal(t, map[string]bool(nil), cr.Votes, "hidden") assert.Equal(t, map[string]store.VotedIPInfo(nil), cr.VotedIPs, "hidden") assert.Equal(t, 200, vote(-1), "opposite vote allowed") body, code = getWithDevAuth(t, fmt.Sprintf("%s/api/v1/id/%s?site=remark42&url=https://radio-t.com/blah", ts.URL, id1)) assert.Equal(t, 200, code) cr = store.Comment{} err = json.Unmarshal([]byte(body), &cr) assert.NoError(t, err) assert.Equal(t, 0, cr.Score) assert.Equal(t, 0, cr.Vote) assert.Equal(t, 200, vote(-1), "opposite vote allowed one more time") body, code = getWithDevAuth(t, fmt.Sprintf("%s/api/v1/id/%s?site=remark42&url=https://radio-t.com/blah", ts.URL, id1)) assert.Equal(t, 200, code) cr = store.Comment{} err = json.Unmarshal([]byte(body), &cr) assert.NoError(t, err) assert.Equal(t, -1, cr.Score) assert.Equal(t, -1, cr.Vote) assert.Equal(t, 400, vote(-1), "dbl vote not allowed") body, code = getWithDevAuth(t, fmt.Sprintf("%s/api/v1/id/%s?site=remark42&url=https://radio-t.com/blah", ts.URL, id1)) assert.Equal(t, 200, code) cr = store.Comment{} err = json.Unmarshal([]byte(body), &cr) assert.NoError(t, err) assert.Equal(t, -1, cr.Score) assert.Equal(t, -1, cr.Vote) body, code = get(t, fmt.Sprintf("%s/api/v1/id/%s?site=remark42&url=https://radio-t.com/blah", ts.URL, id1)) assert.Equal(t, 200, code) cr = store.Comment{} err = json.Unmarshal([]byte(body), &cr) assert.NoError(t, err) assert.Equal(t, -1, cr.Score) assert.Equal(t, 0, cr.Vote, "no vote info for not authed user") assert.Equal(t, map[string]bool(nil), cr.Votes, "hidden") assert.Equal(t, map[string]store.VotedIPInfo(nil), cr.VotedIPs, "hidden") req, err := http.NewRequest("GET", fmt.Sprintf("%s/api/v1/id/%s?site=remark42&url=https://radio-t.com/blah", ts.URL, id1), nil) assert.NoError(t, err) resp, err := sendReq(t, req, adminUmputunToken) assert.NoError(t, err) assert.Equal(t, 200, resp.StatusCode) cr = store.Comment{} err = json.NewDecoder(resp.Body).Decode(&cr) assert.NoError(t, err) assert.Equal(t, -1, cr.Score) assert.Equal(t, 0, cr.Vote, "no vote info for different user") assert.Equal(t, map[string]bool(nil), cr.Votes, "hidden") assert.Equal(t, map[string]store.VotedIPInfo(nil), cr.VotedIPs, "hidden") }
explode_data.jsonl/37398
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1535 }
[ 2830, 3393, 12416, 2334, 1272, 1155, 353, 8840, 836, 8, 341, 57441, 11, 8358, 49304, 1669, 20567, 51, 1155, 340, 16867, 49304, 2822, 1444, 16, 1669, 3553, 56730, 90, 1178, 25, 330, 1944, 1273, 671, 16, 756, 197, 197, 33831, 25, 3553, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestRemoveTriple(t *testing.T) { ts := MakeTestingMemstore() ts.RemoveTriple(graph.MakeTriple("E", "follows", "F", "")) fixed := ts.MakeFixed() fixed.AddValue(ts.GetIdFor("E")) lto := graph.NewLinksToIterator(ts, fixed, "s") fixed2 := ts.MakeFixed() fixed2.AddValue(ts.GetIdFor("follows")) lto2 := graph.NewLinksToIterator(ts, fixed2, "p") innerAnd := graph.NewAndIterator() innerAnd.AddSubIterator(lto2) innerAnd.AddSubIterator(lto) hasa := graph.NewHasaIterator(ts, innerAnd, "o") newIt, _ := hasa.Optimize() _, ok := newIt.Next() if ok { t.Error("E should not have any followers.") } }
explode_data.jsonl/76230
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 242 }
[ 2830, 3393, 13021, 82826, 1155, 353, 8840, 836, 8, 341, 57441, 1669, 7405, 16451, 18816, 4314, 741, 57441, 13270, 82826, 24312, 50133, 82826, 445, 36, 497, 330, 18559, 82, 497, 330, 37, 497, 77561, 1166, 3286, 1669, 10591, 50133, 13520, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestUnauthorized(t *testing.T) { runWithRealDB(t, func(si storage.Storage, be testBackend) error { ts := be.GetTestServer() var err error resp, err := http.Get(ts.URL + "/api/my/tags") if err != nil { return errors.Trace(err) } genResp, err := makeGenericRespFromHTTPResp(resp) if err != nil { return errors.Trace(err) } if err := expectErrorResp(genResp, http.StatusUnauthorized, "unauthorized"); err != nil { return errors.Trace(err) } // Any URL under "my" should return 401 resp, err = http.Get(ts.URL + "/api/my/foo/bar/baz") if err != nil { return errors.Trace(err) } genResp, err = makeGenericRespFromHTTPResp(resp) if err != nil { return errors.Trace(err) } if err := expectErrorResp(genResp, http.StatusUnauthorized, "unauthorized"); err != nil { return errors.Trace(err) } return nil }) }
explode_data.jsonl/75536
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 352 }
[ 2830, 3393, 51181, 1155, 353, 8840, 836, 8, 341, 56742, 2354, 12768, 3506, 1155, 11, 2915, 76352, 5819, 43771, 11, 387, 1273, 29699, 8, 1465, 341, 197, 57441, 1669, 387, 2234, 2271, 5475, 741, 197, 2405, 1848, 1465, 271, 197, 34653, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestChatSrvGracefulUnboxing(t *testing.T) { runWithMemberTypes(t, func(mt chat1.ConversationMembersType) { ctc := makeChatTestContext(t, "GracefulUnboxing", 2) defer ctc.cleanup() users := ctc.users() listener := newServerChatListener() ctc.as(t, users[0]).h.G().NotifyRouter.AddListener(listener) created := mustCreateConversationForTest(t, ctc, users[0], chat1.TopicType_CHAT, mt, ctc.as(t, users[1]).user()) mustPostLocalForTest(t, ctc, users[0], created, chat1.NewMessageBodyWithText(chat1.MessageText{Body: "innocent hello"})) mustPostLocalForTest(t, ctc, users[0], created, chat1.NewMessageBodyWithText(chat1.MessageText{Body: "evil hello"})) consumeNewMsgRemote(t, listener, chat1.MessageType_TEXT) consumeNewMsgRemote(t, listener, chat1.MessageType_TEXT) // make evil hello evil tc := ctc.world.Tcs[users[0].Username] uid := users[0].User.GetUID().ToBytes() require.NoError(t, tc.Context().ConvSource.Clear(context.TODO(), created.Id, uid)) ri := ctc.as(t, users[0]).ri sabRemote := messageSabotagerRemote{RemoteInterface: ri} tc.Context().ConvSource.SetRemoteInterface(func() chat1.RemoteInterface { return sabRemote }) ctx := ctc.as(t, users[0]).startCtx tv, err := ctc.as(t, users[0]).chatLocalHandler().GetThreadLocal(ctx, chat1.GetThreadLocalArg{ ConversationID: created.Id, }) tc.Context().ConvSource.SetRemoteInterface(func() chat1.RemoteInterface { return ri }) if err != nil { t.Fatalf("GetThreadLocal error: %v", err) } require.Len(t, tv.Thread.Messages, 3, "unexpected response from GetThreadLocal . number of messages") if tv.Thread.Messages[0].IsValid() || len(tv.Thread.Messages[0].Error().ErrMsg) == 0 { t.Fatalf("unexpected response from GetThreadLocal. expected an error message from bad msg, got %#+v\n", tv.Thread.Messages[0]) } if !tv.Thread.Messages[1].IsValid() || tv.Thread.Messages[1].Valid().MessageBody.Text().Body != "innocent hello" { t.Fatalf("unexpected response from GetThreadLocal. expected 'innocent hello' got %#+v\n", tv.Thread.Messages[1].Valid()) } }) }
explode_data.jsonl/63682
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 782 }
[ 2830, 3393, 15672, 50, 10553, 86543, 1262, 1806, 89174, 1155, 353, 8840, 836, 8, 341, 56742, 2354, 9366, 4173, 1155, 11, 2915, 81618, 6236, 16, 4801, 22323, 24371, 929, 8, 341, 197, 89216, 66, 1669, 1281, 15672, 2271, 1972, 1155, 11, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestMonthRange(t *testing.T) { tests := []struct { year uint month uint want Range }{ {2015, 1, Range{"20150101", "20150131"}}, {2018, 12, Range{"20181201", "20181231"}}, {2015, 2, Range{"20150201", "20150228"}}, {2016, 2, Range{"20160201", "20160229"}}, {2020, 2, Range{"20200201", "20200229"}}, {2020, 4, Range{"20200401", "20200430"}}, {2021, 6, Range{"20210601", "20210630"}}, } for _, tc := range tests { t.Run(fmt.Sprintf("%d-%02d", tc.year, tc.month), func(t *testing.T) { got := MonthRange(tc.year, tc.month) if got != tc.want { t.Errorf("MonthRange(%d, %d) got %+v, want %+v", tc.year, tc.month, got, tc.want) } }) } }
explode_data.jsonl/65320
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 315 }
[ 2830, 3393, 11318, 6046, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 3056, 1235, 341, 197, 197, 3157, 220, 2622, 198, 197, 197, 10249, 2622, 198, 197, 50780, 220, 16437, 198, 197, 59403, 197, 197, 90, 17, 15, 16, 20, 11, 220, 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...
2
func TestParse(t *testing.T) { t.Run("Empty bytes.Buffer", func(t *testing.T) { _, err := jws.Parse(&bytes.Buffer{}) if !assert.Error(t, err, "Parsing an empty buffer should result in an error") { return } }) t.Run("Compact missing parts", func(t *testing.T) { incoming := strings.Join( (strings.Split( exampleCompactSerialization, ".", ))[:2], ".", ) _, err := jws.ParseString(incoming) if !assert.Error(t, err, "Parsing compact serialization with less than 3 parts should be an error") { return } }) t.Run("Compact bad header", func(t *testing.T) { parts := strings.Split(exampleCompactSerialization, ".") parts[0] = "%badvalue%" incoming := strings.Join(parts, ".") _, err := jws.ParseString(incoming) if !assert.Error(t, err, "Parsing compact serialization with bad header should be an error") { return } }) t.Run("Compact bad payload", func(t *testing.T) { parts := strings.Split(exampleCompactSerialization, ".") parts[1] = "%badvalue%" incoming := strings.Join(parts, ".") _, err := jws.ParseString(incoming) if !assert.Error(t, err, "Parsing compact serialization with bad payload should be an error") { return } }) t.Run("Compact bad signature", func(t *testing.T) { parts := strings.Split(exampleCompactSerialization, ".") parts[2] = "%badvalue%" incoming := strings.Join(parts, ".") t.Logf("incoming = '%s'", incoming) _, err := jws.ParseString(incoming) if !assert.Error(t, err, "Parsing compact serialization with bad signature should be an error") { return } }) }
explode_data.jsonl/1559
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 608 }
[ 2830, 3393, 14463, 1155, 353, 8840, 836, 8, 341, 3244, 16708, 445, 3522, 5820, 22622, 497, 2915, 1155, 353, 8840, 836, 8, 341, 197, 197, 6878, 1848, 1669, 502, 8915, 8937, 2099, 9651, 22622, 37790, 197, 743, 753, 2207, 6141, 1155, 11,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestOpsGenieNoAPIKey(t *testing.T) { _, err := LoadFile("testdata/conf.opsgenie-no-apikey.yml") if err == nil { t.Fatalf("Expected an error parsing %s: %s", "testdata/conf.opsgenie-no-apikey.yml", err) } if err.Error() != "no global OpsGenie API Key set" { t.Errorf("Expected: %s\nGot: %s", "no global OpsGenie API Key set", err.Error()) } }
explode_data.jsonl/72924
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 151 }
[ 2830, 3393, 38904, 9967, 645, 2753, 7082, 1592, 1155, 353, 8840, 836, 8, 341, 197, 6878, 1848, 1669, 8893, 1703, 445, 92425, 59241, 12029, 1991, 61558, 28366, 23904, 792, 33936, 1138, 743, 1848, 621, 2092, 341, 197, 3244, 30762, 445, 18...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestHealthCheck(t *testing.T) { defer testutil.AfterTest(t) clus := NewClusterV3(t, &ClusterConfig{Size: 1}) defer clus.Terminate(t) cli := healthpb.NewHealthClient(clus.RandClient().ActiveConnection()) resp, err := cli.Check(context.TODO(), &healthpb.HealthCheckRequest{}) if err != nil { t.Fatal(err) } if resp.Status != healthpb.HealthCheckResponse_SERVING { t.Fatalf("status expected %s, got %s", healthpb.HealthCheckResponse_SERVING, resp.Status) } }
explode_data.jsonl/81854
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 177 }
[ 2830, 3393, 14542, 3973, 1155, 353, 8840, 836, 8, 341, 16867, 1273, 1314, 36892, 2271, 1155, 692, 197, 4163, 1669, 1532, 28678, 53, 18, 1155, 11, 609, 28678, 2648, 90, 1695, 25, 220, 16, 3518, 16867, 1185, 355, 836, 261, 34016, 1155, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestRoleListAssignmentForGroupOnProject(t *testing.T) { clients.RequireAdmin(t) client, err := clients.NewIdentityV3Client() th.AssertNoErr(t, err) project, err := CreateProject(t, client, nil) th.AssertNoErr(t, err) defer DeleteProject(t, client, project.ID) roleCreateOpts := roles.CreateOpts{ DomainID: "default", } role, err := CreateRole(t, client, &roleCreateOpts) th.AssertNoErr(t, err) defer DeleteRole(t, client, role.ID) groupCreateOpts := &groups.CreateOpts{ DomainID: "default", } group, err := CreateGroup(t, client, groupCreateOpts) th.AssertNoErr(t, err) defer DeleteGroup(t, client, group.ID) t.Logf("Attempting to assign a role %s to a group %s on a project %s", role.Name, group.Name, project.Name) assignOpts := roles.AssignOpts{ GroupID: group.ID, ProjectID: project.ID, } err = roles.Assign(client, role.ID, assignOpts).ExtractErr() th.AssertNoErr(t, err) t.Logf("Successfully assigned a role %s to a group %s on a project %s", role.Name, group.Name, project.Name) defer UnassignRole(t, client, role.ID, &roles.UnassignOpts{ GroupID: group.ID, ProjectID: project.ID, }) listAssignmentsOnResourceOpts := roles.ListAssignmentsOnResourceOpts{ GroupID: group.ID, ProjectID: project.ID, } allPages, err := roles.ListAssignmentsOnResource(client, listAssignmentsOnResourceOpts).AllPages() th.AssertNoErr(t, err) allRoles, err := roles.ExtractRoles(allPages) th.AssertNoErr(t, err) t.Logf("Role assignments of group %s on project %s:", group.Name, project.Name) var found bool for _, _role := range allRoles { tools.PrintResource(t, _role) if _role.ID == role.ID { found = true } } th.AssertEquals(t, found, true) }
explode_data.jsonl/57727
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 683 }
[ 2830, 3393, 9030, 852, 41613, 2461, 2808, 1925, 7849, 1155, 353, 8840, 836, 8, 341, 197, 31869, 81288, 7210, 1155, 692, 25291, 11, 1848, 1669, 8239, 7121, 18558, 53, 18, 2959, 741, 70479, 11711, 2753, 7747, 1155, 11, 1848, 692, 72470, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestMapProxy_KeySetWithPredicateWithNilPredicate(t *testing.T) { _, err := mp.KeySetWithPredicate(nil) AssertErrorNotNil(t, err, "keySetWithPredicate did not return an error for nil predicate") mp.Clear() }
explode_data.jsonl/57017
{ "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, 2227, 16219, 35253, 1649, 2354, 36329, 2354, 19064, 36329, 1155, 353, 8840, 836, 8, 341, 197, 6878, 1848, 1669, 10490, 9610, 1649, 2354, 36329, 27907, 340, 18017, 1454, 96144, 1155, 11, 1848, 11, 330, 792, 1649, 2354, 36329, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestNewPeerWithCertNoTLS(t *testing.T) { mockCtrl := gomock.NewController(t) defer mockCtrl.Finish() config := mockfab.DefaultMockConfig(mockCtrl) url := "http://example.com" p, err := New(config, WithURL(url)) if err != nil { t.Fatal("Expected peer to be constructed") } if p.URL() != url { t.Fatal("Unexpected peer URL") } }
explode_data.jsonl/4790
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 137 }
[ 2830, 3393, 3564, 30888, 2354, 36934, 2753, 45439, 1155, 353, 8840, 836, 8, 341, 77333, 15001, 1669, 342, 316, 1176, 7121, 2051, 1155, 340, 16867, 7860, 15001, 991, 18176, 741, 25873, 1669, 7860, 36855, 13275, 11571, 2648, 30389, 15001, 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...
3
func TestRangeMerge(t *testing.T) { for _, test := range []struct { new Range dst Range want Range wantMerged bool }{ { new: Range{Pos: 1, Size: 1}, // .N....... dst: Range{Pos: 3, Size: 3}, // ...DDD... want: Range{Pos: 3, Size: 3}, // ...DDD... wantMerged: false, }, { new: Range{Pos: 1, Size: 2}, // .NN...... dst: Range{Pos: 3, Size: 3}, // ...DDD... want: Range{Pos: 1, Size: 5}, // .XXXXX... wantMerged: true, }, { new: Range{Pos: 1, Size: 3}, // .NNN..... dst: Range{Pos: 3, Size: 3}, // ...DDD... want: Range{Pos: 1, Size: 5}, // .XXXXX... wantMerged: true, }, { new: Range{Pos: 1, Size: 5}, // .NNNNN... dst: Range{Pos: 3, Size: 3}, // ...DDD... want: Range{Pos: 1, Size: 5}, // .XXXXX... wantMerged: true, }, { new: Range{Pos: 1, Size: 6}, // .NNNNNN.. dst: Range{Pos: 3, Size: 3}, // ...DDD... want: Range{Pos: 1, Size: 6}, // .XXXXXX.. wantMerged: true, }, { new: Range{Pos: 3, Size: 3}, // ...NNN... dst: Range{Pos: 3, Size: 3}, // ...DDD... want: Range{Pos: 3, Size: 3}, // ...XXX... wantMerged: true, }, { new: Range{Pos: 3, Size: 2}, // ...NN.... dst: Range{Pos: 3, Size: 3}, // ...DDD... want: Range{Pos: 3, Size: 3}, // ...XXX... wantMerged: true, }, { new: Range{Pos: 3, Size: 4}, // ...NNNN.. dst: Range{Pos: 3, Size: 3}, // ...DDD... want: Range{Pos: 3, Size: 4}, // ...XXXX.. wantMerged: true, }, } { what := fmt.Sprintf("test new=%v, dst=%v", test.new, test.dst) gotMerged := merge(&test.new, &test.dst) assert.Equal(t, test.wantMerged, gotMerged) assert.Equal(t, test.want, test.dst, what) } }
explode_data.jsonl/2637
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 981 }
[ 2830, 3393, 6046, 52096, 1155, 353, 8840, 836, 8, 341, 2023, 8358, 1273, 1669, 2088, 3056, 1235, 341, 197, 8638, 286, 16437, 198, 197, 52051, 286, 16437, 198, 197, 50780, 981, 16437, 198, 197, 50780, 44, 51525, 1807, 198, 197, 59403, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestGetStateBasicRequest(t *testing.T) { assert := assert.New(t) pubnub.Config.UUID = "my-custom-uuid" opts := &getStateOpts{ Channels: []string{"ch"}, ChannelGroups: []string{"cg"}, pubnub: pubnub, } path, err := opts.buildPath() assert.Nil(err) u := &url.URL{ Path: path, } h.AssertPathsEqual(t, "/v2/presence/sub-key/sub_key/channel/ch/uuid/my-custom-uuid", u.EscapedPath(), []int{}) query, err := opts.buildQuery() assert.Nil(err) expected := &url.Values{} expected.Set("channel-group", "cg") h.AssertQueriesEqual(t, expected, query, []string{"pnsdk", "uuid"}, []string{}) body, err := opts.buildBody() assert.Nil(err) assert.Equal([]byte{}, body) }
explode_data.jsonl/32493
{ "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, 1949, 1397, 15944, 1900, 1155, 353, 8840, 836, 8, 341, 6948, 1669, 2060, 7121, 1155, 692, 62529, 77, 392, 10753, 39636, 284, 330, 2408, 36898, 12, 17128, 1837, 64734, 1669, 609, 62353, 43451, 515, 197, 197, 35925, 25, 414, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestAuthenticate(t *testing.T) { otpconf := &OTPConfig{ Secret: "2SH3V3GDW7ZNMGYE", WindowSize: 3, HotpCounter: 1, ScratchCodes: []int{11112222, 22223333}, } type attempt struct { code string result bool } var attempts = []attempt{ {"foobar", false}, // not digits {"1fooba", false}, // not valid number {"1111111", false}, // bad length { /* 1 */ "293240", true}, // hopt increments on success { /* 1 */ "293240", false}, // hopt failure {"33334444", false}, // scratch {"11112222", true}, {"11112222", false}, } for _, a := range attempts { r, _ := otpconf.Authenticate(a.code) if r != a.result { t.Errorf("bad result from code=%s: got %t expected %t\n", a.code, r, a.result) } } // let's check some time-based codes otpconf.HotpCounter = 0 // I haven't mocked the clock, so we'll just compute one var t0 int64 if otpconf.UTC { t0 = int64(time.Now().UTC().Unix() / 30) } else { t0 = int64(time.Now().Unix() / 30) } c := ComputeCode(otpconf.Secret, t0) invalid := c + 1 attempts = []attempt{ {strconv.Itoa(invalid), false}, {strconv.Itoa(c), true}, } for _, a := range attempts { r, _ := otpconf.Authenticate(a.code) if r != a.result { t.Errorf("bad result from code=%s: got %t expected %t\n", a.code, r, a.result) } otpconf.UTC = true r, _ = otpconf.Authenticate(a.code) if r != a.result { t.Errorf("bad result from code=%s: got %t expected %t\n", a.code, r, a.result) } otpconf.UTC = false } }
explode_data.jsonl/75091
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 683 }
[ 2830, 3393, 99087, 1155, 353, 8840, 836, 8, 1476, 197, 48708, 6135, 1669, 609, 90146, 2648, 515, 197, 7568, 50856, 25, 981, 330, 17, 8590, 18, 53, 18, 40849, 54, 22, 44847, 31939, 59644, 756, 197, 197, 87817, 25, 256, 220, 18, 345, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestOutputService2ProtocolTestBlobMembersCase1(t *testing.T) { svc := NewOutputService2ProtocolTest(nil) buf := bytes.NewReader([]byte("{\"BlobMember\": \"aGkh\", \"StructMember\": {\"foo\": \"dGhlcmUh\"}}")) req, out := svc.OutputService2TestCaseOperation1Request(nil) req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}} // set headers // unmarshal response restjson.UnmarshalMeta(req) restjson.Unmarshal(req) assert.NoError(t, req.Error) // assert response assert.NotNil(t, out) // ensure out variable is used assert.Equal(t, "hi!", string(out.BlobMember)) assert.Equal(t, "there!", string(out.StructMember.Foo)) }
explode_data.jsonl/8440
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 254 }
[ 2830, 3393, 5097, 1860, 17, 20689, 2271, 37985, 24371, 4207, 16, 1155, 353, 8840, 836, 8, 341, 1903, 7362, 1669, 1532, 5097, 1860, 17, 20689, 2271, 27907, 692, 26398, 1669, 5820, 68587, 10556, 3782, 99141, 37985, 9366, 11693, 7245, 64, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestUnreadByte(t *testing.T) { segments := []string{"Hello, ", "world"} r := NewReader(&StringReader{data: segments}) got := "" want := strings.Join(segments, "") // Normal execution. for { b1, err := r.ReadByte() if err != nil { if err != io.EOF { t.Error("unexpected error on ReadByte:", err) } break } got += string(b1) // Put it back and read it again. if err = r.UnreadByte(); err != nil { t.Fatal("unexpected error on UnreadByte:", err) } b2, err := r.ReadByte() if err != nil { t.Fatal("unexpected error reading after unreading:", err) } if b1 != b2 { t.Fatalf("incorrect byte after unread: got %q, want %q", b1, b2) } } if got != want { t.Errorf("got %q, want %q", got, want) } }
explode_data.jsonl/22853
{ "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, 1806, 878, 7153, 1155, 353, 8840, 836, 8, 341, 197, 56829, 1669, 3056, 917, 4913, 9707, 11, 3670, 330, 14615, 16707, 7000, 1669, 1532, 5062, 2099, 703, 5062, 90, 691, 25, 20632, 3518, 3174, 354, 1669, 8389, 50780, 1669, 90...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestStartHttpClient(t *testing.T) { resp, _ := http.Get("http://127.0.0.1:8080/go") defer resp.Body.Close() fmt.Println("Status: ", resp.Status) fmt.Println("StatusCode: ", resp.StatusCode) fmt.Println("Header: ", resp.Header) fmt.Println("ContentLength: ", resp.ContentLength) buf := make([]byte, 1024) for { n, err := resp.Body.Read(buf) if err != nil && err != io.EOF { fmt.Println(err) return } else { fmt.Println("读取完毕") res := string(buf[:n]) fmt.Println("res: ", res) break } } }
explode_data.jsonl/22357
{ "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, 3479, 26316, 1155, 353, 8840, 836, 8, 341, 34653, 11, 716, 1669, 1758, 2234, 445, 1254, 1110, 16, 17, 22, 13, 15, 13, 15, 13, 16, 25, 23, 15, 23, 15, 25525, 1138, 16867, 9039, 20934, 10421, 2822, 11009, 12419, 445, 252...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestOrdererV10(t *testing.T) { op := NewOrdererProvider(map[string]*cb.Capability{}) assert.NoError(t, op.Supported()) assert.Equal(t, ordererTypeName, op.Type()) assert.False(t, op.PredictableChannelTemplate()) assert.False(t, op.Resubmission()) assert.False(t, op.ExpirationCheck()) assert.False(t, op.ConsensusTypeMigration()) assert.False(t, op.UseChannelCreationPolicyAsAdmins()) }
explode_data.jsonl/13883
{ "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, 4431, 261, 53, 16, 15, 1155, 353, 8840, 836, 8, 341, 39703, 1669, 1532, 4431, 261, 5179, 9147, 14032, 8465, 7221, 78963, 2897, 37790, 6948, 35699, 1155, 11, 1179, 808, 12513, 2398, 6948, 12808, 1155, 11, 1973, 261, 39429, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestAdminStatus(t *testing.T) { db := tests.Tempfile() defer os.Remove(db) // Create the app app := glusterfs.NewTestApp(db) defer app.Close() // Setup the server ts := setupHeketiServer(app) defer ts.Close() c := NewClient(ts.URL, "admin", TEST_ADMIN_KEY) tests.Assert(t, c != nil, "NewClient failed:", c) as, err := c.AdminStatusGet() tests.Assert(t, err == nil, "expected err == nil, got:", err) tests.Assert(t, as.State == api.AdminStateNormal, "expected as.State == api.AdminStateNormal, got:", as.State) as.State = api.AdminStateLocal err = c.AdminStatusSet(as) tests.Assert(t, err == nil, "expected err == nil, got:", err) as, err = c.AdminStatusGet() tests.Assert(t, err == nil, "expected err == nil, got:", err) tests.Assert(t, as.State == api.AdminStateLocal, "expected as.State == api.AdminStateNormal, got:", as.State) as.State = api.AdminStateNormal err = c.AdminStatusSet(as) tests.Assert(t, err == nil, "expected err == nil, got:", err) as, err = c.AdminStatusGet() tests.Assert(t, err == nil, "expected err == nil, got:", err) tests.Assert(t, as.State == api.AdminStateNormal, "expected as.State == api.AdminStateNormal, got:", as.State) }
explode_data.jsonl/18020
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 455 }
[ 2830, 3393, 7210, 2522, 1155, 353, 8840, 836, 8, 341, 20939, 1669, 7032, 65009, 1192, 741, 16867, 2643, 13270, 9791, 692, 197, 322, 4230, 279, 906, 198, 28236, 1669, 2770, 4993, 3848, 7121, 2271, 2164, 9791, 340, 16867, 906, 10421, 2822...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestDecode(t *testing.T) { type ( d = map[string]interface{} l = []interface{} ) s := func(ks ...string) map[string]struct{} { if len(ks) == 0 { return nil } out := make(map[string]struct{}) for _, k := range ks { out[k] = struct{}{} } return out } t.Run("Basic", func(t *testing.T) { input := d{ "x": d{ "y": l{2}, }, "x.y.0": 3, // should always take precedence "z": l{ d{"q": 0}, d{"q": 1}, d{"q": 2}, }, "q": d{"f": 6}, // missing "f": "broken", // broken } type into struct { X struct { Y []int } Z []map[string]interface{} F int } var output into res := Decode(input, &output) assert.Error(t, res.Error) assert.DeepEqual(t, res.Used, s("x.y.0", "x.y.0", "z.0.q", "z.1.q", "z.2.q")) assert.DeepEqual(t, res.Missing, s("q.f")) assert.DeepEqual(t, res.Broken, s("f")) assert.DeepEqual(t, output, into{ X: struct{ Y []int }{Y: []int{3}}, Z: []map[string]interface{}{{"q": 0}, {"q": 1}, {"q": 2}}, }) }) t.Run("Compound In Map", func(t *testing.T) { var output struct{ X map[string]struct{ Y, Z int } } input := d{"x.a.y": 1, "x.a.z": 2} res := Decode(input, &output) assert.NoError(t, res.Error) assert.DeepEqual(t, res.Used, s("x.a.y", "x.a.z")) assert.DeepEqual(t, res.Missing, s()) assert.DeepEqual(t, res.Broken, s()) assert.Equal(t, output.X["a"].Y, 1) assert.Equal(t, output.X["a"].Z, 2) }) t.Run("Avoids Writes", func(t *testing.T) { var output map[string]*struct { X int Y *struct{ Z int } } input := d{"a.x": 1, "b.q": 2, "a.y.f": 3} res := Decode(input, &output) assert.NoError(t, res.Error) assert.DeepEqual(t, res.Used, s("a.x")) assert.DeepEqual(t, res.Missing, s("a.y.f", "b.q")) assert.DeepEqual(t, res.Broken, s()) assert.Equal(t, output["a"].X, 1) assert.Equal(t, output["a"].Y, (*struct{ Z int })(nil)) assert.Equal(t, len(output), 1) }) t.Run("Embedding", func(t *testing.T) { type E3 struct{ X int } type E2 struct{ *E3 } type E1 struct{ E2 } var output struct{ E1 } input := d{"x": 1} res := Decode(input, &output) assert.NoError(t, res.Error) assert.DeepEqual(t, res.Used, s("x")) assert.DeepEqual(t, res.Missing, s()) assert.DeepEqual(t, res.Broken, s()) assert.Equal(t, output.X, 1) }) t.Run("Embed Unexported", func(t *testing.T) { type e3 struct{ X int } type e2 struct{ *e3 } type e1 struct{ e2 } var output struct{ e1 } input := d{"x": 1} res := Decode(input, &output) assert.NoError(t, res.Error) assert.DeepEqual(t, res.Used, s()) assert.DeepEqual(t, res.Missing, s("x")) assert.DeepEqual(t, res.Broken, s()) assert.Equal(t, output.e1.e2.e3, (*e3)(nil)) }) }
explode_data.jsonl/71147
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1328 }
[ 2830, 3393, 32564, 1155, 353, 8840, 836, 8, 341, 13158, 2399, 197, 2698, 284, 2415, 14032, 31344, 16094, 197, 8810, 284, 3056, 4970, 16094, 197, 692, 1903, 1669, 2915, 7, 2787, 2503, 917, 8, 2415, 14032, 60, 1235, 6257, 341, 197, 743,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestValidSelfAuthenticatedPOST(t *testing.T) { wfe, _ := setupWFE(t) _, validKey, validJWSBody := signRequestEmbed(t, nil, "http://localhost/test", `{"test":"passed"}`, wfe.nonceService) _, _, keyIDJWSBody := signRequestKeyID(t, 1, nil, "http://localhost/test", `{"test":"passed"}`, wfe.nonceService) testCases := []struct { Name string Request *http.Request ExpectedProblem *probs.ProblemDetails ExpectedPayload string ExpectedJWK *jose.JSONWebKey ErrorStatType string }{ { Name: "Invalid JWS", Request: makePostRequestWithPath("test", "foo"), ExpectedProblem: &probs.ProblemDetails{ Type: probs.MalformedProblem, Detail: "Parse error reading JWS", HTTPStatus: http.StatusBadRequest, }, ErrorStatType: "JWSUnmarshalFailed", }, { Name: "JWS with key ID", Request: makePostRequestWithPath("test", keyIDJWSBody), ExpectedProblem: &probs.ProblemDetails{ Type: probs.MalformedProblem, Detail: "No embedded JWK in JWS header", HTTPStatus: http.StatusBadRequest, }, ErrorStatType: "JWSAuthTypeWrong", }, { Name: "Valid JWS", Request: makePostRequestWithPath("test", validJWSBody), ExpectedPayload: `{"test":"passed"}`, ExpectedJWK: validKey, }, } for _, tc := range testCases { t.Run(tc.Name, func(t *testing.T) { wfe.stats.joseErrorCount.Reset() inputLogEvent := newRequestEvent() outPayload, jwk, prob := wfe.validSelfAuthenticatedPOST(tc.Request, inputLogEvent) if tc.ExpectedProblem == nil && prob != nil { t.Fatal(fmt.Sprintf("Expected nil problem, got %#v\n", prob)) } else if tc.ExpectedProblem == nil { inThumb, _ := tc.ExpectedJWK.Thumbprint(crypto.SHA256) outThumb, _ := jwk.Thumbprint(crypto.SHA256) test.AssertDeepEquals(t, inThumb, outThumb) test.AssertEquals(t, inputLogEvent.Payload, tc.ExpectedPayload) test.AssertEquals(t, string(outPayload), tc.ExpectedPayload) } else { test.AssertMarshaledEquals(t, prob, tc.ExpectedProblem) } if tc.ErrorStatType != "" { test.AssertEquals(t, test.CountCounterVec( "type", tc.ErrorStatType, wfe.stats.joseErrorCount), 1) } }) } }
explode_data.jsonl/15359
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 970 }
[ 2830, 3393, 4088, 12092, 26712, 2946, 1155, 353, 8840, 836, 8, 341, 6692, 1859, 11, 716, 1669, 6505, 54, 11419, 1155, 692, 197, 6878, 2697, 1592, 11, 2697, 41, 7433, 5444, 1669, 1841, 1900, 25486, 1155, 11, 2092, 11, 330, 1254, 1110, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestProcessTracingConfigs(t *testing.T) { ProcessTracingOptions(nil, nil) o := New() o.SampleRate = 0 mo := map[string]*Options{ "test": o, } ProcessTracingOptions(mo, yamlx.KeyLookup{}) if int(o.SampleRate) != 1 { t.Errorf("expected 1 got %d", int(o.SampleRate)) } }
explode_data.jsonl/63659
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 120 }
[ 2830, 3393, 7423, 1282, 4527, 84905, 1155, 353, 8840, 836, 8, 1476, 197, 7423, 1282, 4527, 3798, 27907, 11, 2092, 692, 22229, 1669, 1532, 741, 22229, 76266, 11564, 284, 220, 15, 271, 2109, 78, 1669, 2415, 14032, 8465, 3798, 515, 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 TestGroupUintptr(t *testing.T) { v := &Value{data: []uintptr{uintptr(1), uintptr(1), uintptr(1), uintptr(1), uintptr(1), uintptr(1)}} grouped := v.GroupUintptr(func(i int, val uintptr) string { return fmt.Sprintf("%v", i%2 == 0) }).data.(map[string][]uintptr) assert.Equal(t, 2, len(grouped)) assert.Equal(t, 3, len(grouped["true"])) assert.Equal(t, 3, len(grouped["false"])) }
explode_data.jsonl/23501
{ "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, 2808, 21570, 3505, 1155, 353, 8840, 836, 8, 1476, 5195, 1669, 609, 1130, 90, 691, 25, 3056, 51380, 90, 51380, 7, 16, 701, 38190, 7, 16, 701, 38190, 7, 16, 701, 38190, 7, 16, 701, 38190, 7, 16, 701, 38190, 7, 16, 9139...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestGetByFlagKeyOrID(t *testing.T) { fixtureFlag := entity.GenFixtureFlag() db := entity.PopulateTestDB(fixtureFlag) defer db.Close() defer gostub.StubFunc(&getDB, db).Reset() ec := GetEvalCache() ec.reloadMapCache() f := ec.GetByFlagKeyOrID(fixtureFlag.ID) assert.Equal(t, f.ID, fixtureFlag.ID) assert.Equal(t, f.Tags[0].Value, fixtureFlag.Tags[0].Value) }
explode_data.jsonl/33086
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 156 }
[ 2830, 3393, 1949, 1359, 12135, 1592, 2195, 915, 1155, 353, 8840, 836, 8, 341, 1166, 12735, 12135, 1669, 5387, 65384, 18930, 12135, 741, 20939, 1669, 5387, 47424, 6334, 2271, 3506, 94886, 12135, 340, 16867, 2927, 10421, 741, 16867, 67934, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestIncrementsScoreKO(t *testing.T) { step = 1 exec = errors.New("") if err := repo.IncrementsScore("unknown"); err == nil { t.Error("Score incrementation succeed") } }
explode_data.jsonl/26730
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 62 }
[ 2830, 3393, 37981, 1368, 10570, 54947, 1155, 353, 8840, 836, 8, 341, 77093, 284, 220, 16, 198, 67328, 284, 5975, 7121, 445, 5130, 743, 1848, 1669, 15867, 5337, 837, 1368, 10570, 445, 16088, 5038, 1848, 621, 2092, 341, 197, 3244, 6141, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
2
func TestGenerateJob(t *testing.T) { tests := []struct { params map[string]interface{} expected *batch.Job expectErr bool }{ { params: map[string]interface{}{ "labels": "foo=bar,baz=blah", "name": "foo", "image": "someimage", "port": "80", "hostport": "80", "stdin": "true", "leave-stdin-open": "true", "command": "true", "args": []string{"bar", "baz", "blah"}, "env": []string{"a=b", "c=d"}, "requests": "cpu=100m,memory=100Mi", "limits": "cpu=400m,memory=200Mi", "restart": "OnFailure", }, expected: &batch.Job{ ObjectMeta: api.ObjectMeta{ Name: "foo", Labels: map[string]string{"foo": "bar", "baz": "blah"}, }, Spec: batch.JobSpec{ Selector: &unversioned.LabelSelector{ MatchLabels: map[string]string{"foo": "bar", "baz": "blah"}, }, ManualSelector: newBool(true), Template: api.PodTemplateSpec{ ObjectMeta: api.ObjectMeta{ Labels: map[string]string{"foo": "bar", "baz": "blah"}, }, Spec: api.PodSpec{ RestartPolicy: api.RestartPolicyOnFailure, Containers: []api.Container{ { Name: "foo", Image: "someimage", Stdin: true, StdinOnce: false, Ports: []api.ContainerPort{ { ContainerPort: 80, HostPort: 80, }, }, Command: []string{"bar", "baz", "blah"}, Env: []api.EnvVar{ { Name: "a", Value: "b", }, { Name: "c", Value: "d", }, }, Resources: api.ResourceRequirements{ Requests: api.ResourceList{ api.ResourceCPU: resource.MustParse("100m"), api.ResourceMemory: resource.MustParse("100Mi"), }, Limits: api.ResourceList{ api.ResourceCPU: resource.MustParse("400m"), api.ResourceMemory: resource.MustParse("200Mi"), }, }, }, }, }, }, }, }, }, } generator := JobV1Beta1{} for _, test := range tests { obj, err := generator.Generate(test.params) if !test.expectErr && err != nil { t.Errorf("unexpected error: %v", err) } if test.expectErr && err != nil { continue } if !reflect.DeepEqual(obj.(*batch.Job), test.expected) { t.Errorf("\nexpected:\n%#v\nsaw:\n%#v", test.expected, obj.(*batch.Job)) } } }
explode_data.jsonl/64188
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1443 }
[ 2830, 3393, 31115, 12245, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 3056, 1235, 341, 197, 25856, 262, 2415, 14032, 31344, 16094, 197, 42400, 220, 353, 14049, 45293, 198, 197, 24952, 7747, 1807, 198, 197, 59403, 197, 197, 515, 298, 2585...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 Test(t *testing.T) { // Start a local HTTP server server := httptest.NewServer(http.HandlerFunc(func(rw http.ResponseWriter, req *http.Request) { // Send response to be tested _, err := rw.Write([]byte(`{ "keyboards": { "cradio": { "keyboard_name": "Cradio", "layouts": { "LAYOUT_split_3x5_2": { "layout": [ { "x": 0, "y": 1.27, "w": 1, "label": "L01", "matrix": [0, 0] }, { "x": 1, "y": 0.31, "w": 1, "label": "L02", "matrix": [0, 1] }, { "x": 2, "y": 0, "w": 1, "label": "L03", "matrix": [0, 2] }, { "x": 3, "y": 0.28, "w": 1, "label": "L04", "matrix": [0, 3] }, { "x": 4, "y": 0.42, "w": 1, "label": "L05", "matrix": [0, 4] }, { "x": 8, "y": 0.42, "w": 1, "label": "R01", "matrix": [4, 0] }, { "x": 9, "y": 0.28, "w": 1, "label": "R02", "matrix": [4, 1] }, { "x": 10, "y": 0, "w": 1, "label": "R03", "matrix": [4, 2] }, { "x": 11, "y": 0.31, "w": 1, "label": "R04", "matrix": [4, 3] }, { "x": 12, "y": 1.27, "w": 1, "label": "R05", "matrix": [4, 4] }, { "x": 0, "y": 2.27, "w": 1, "label": "L06", "matrix": [1, 0] }, { "x": 1, "y": 1.31, "w": 1, "label": "L07", "matrix": [1, 1] }, { "x": 2, "y": 1, "w": 1, "label": "L08", "matrix": [1, 2] }, { "x": 3, "y": 1.28, "w": 1, "label": "L09", "matrix": [1, 3] }, { "x": 4, "y": 1.42, "w": 1, "label": "L10", "matrix": [1, 4] }, { "x": 8, "y": 1.42, "w": 1, "label": "R06", "matrix": [5, 0] }, { "x": 9, "y": 1.28, "w": 1, "label": "R07", "matrix": [5, 1] }, { "x": 10, "y": 1, "w": 1, "label": "R08", "matrix": [5, 2] }, { "x": 11, "y": 1.31, "w": 1, "label": "R09", "matrix": [5, 3] }, { "x": 12, "y": 2.27, "w": 1, "label": "R10", "matrix": [5, 4] }, { "x": 0, "y": 3.27, "w": 1, "label": "L11", "matrix": [2, 0] }, { "x": 1, "y": 2.31, "w": 1, "label": "L12", "matrix": [2, 1] }, { "x": 2, "y": 2, "w": 1, "label": "L13", "matrix": [2, 2] }, { "x": 3, "y": 2.28, "w": 1, "label": "L14", "matrix": [2, 3] }, { "x": 4, "y": 2.42, "w": 1, "label": "L15", "matrix": [2, 4] }, { "x": 8, "y": 2.42, "w": 1, "label": "R11", "matrix": [6, 0] }, { "x": 9, "y": 2.28, "w": 1, "label": "R12", "matrix": [6, 1] }, { "x": 10, "y": 2, "w": 1, "label": "R13", "matrix": [6, 2] }, { "x": 11, "y": 2.31, "w": 1, "label": "R14", "matrix": [6, 3] }, { "x": 12, "y": 3.27, "w": 1, "label": "R15", "matrix": [6, 4] }, { "x": 4, "y": 3.9, "w": 1, "label": "L16", "matrix": [3, 0] }, { "x": 5, "y": 3.7, "w": 1, "label": "L17", "matrix": [3, 1] }, { "x": 7, "y": 3.7, "w": 1, "label": "R16", "matrix": [7, 0] }, { "x": 8, "y": 3.9, "w": 1, "label": "R17", "matrix": [7, 1] } ] } } } } } `)) if err != nil { t.Fatal(err) } })) // Close the server when test finishes defer server.Close() file, err := fetch(server.URL) if err != nil { t.Fatal(err) } _, ok := file.Keyboards["cradio"] if !ok { t.Fatal("Unmarshaling error") } }
explode_data.jsonl/63407
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1725 }
[ 2830, 3393, 1155, 353, 8840, 836, 8, 341, 197, 322, 5145, 264, 2205, 10130, 3538, 198, 41057, 1669, 54320, 70334, 7121, 5475, 19886, 89164, 18552, 2601, 86, 1758, 37508, 11, 4232, 353, 1254, 9659, 8, 341, 197, 197, 322, 11000, 2033, 3...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestUnmarshalBadPaths(t *testing.T) { for _, tt := range badPathTests { err := Unmarshal([]byte(pathTestString), tt.v) if !reflect.DeepEqual(err, tt.e) { t.Fatalf("Unmarshal with %#v didn't fail properly:\nhave %#v,\nwant %#v", tt.v, err, tt.e) } } }
explode_data.jsonl/25291
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 128 }
[ 2830, 3393, 1806, 27121, 17082, 26901, 1155, 353, 8840, 836, 8, 341, 2023, 8358, 17853, 1669, 2088, 3873, 1820, 18200, 341, 197, 9859, 1669, 1230, 27121, 10556, 3782, 5581, 2271, 703, 701, 17853, 3133, 340, 197, 743, 753, 34913, 94750, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestTable_JoinCombination(t *testing.T) { cases := []struct { table Table s string exp Table }{{ table: Table{ {{"a"}, {"b"}, {"c"}}, }, s: "X", exp: Table{ {{"a", "X"}, {"b"}, {"c"}}, {{"a"}, {"b", "X"}, {"c"}}, {{"a"}, {"b"}, {"c", "X"}}, }, }, { table: Table{ {{"a"}, {"b"}, {"c"}}, {{"g"}, {"h"}}, }, s: "X", exp: Table{ {{"a", "X"}, {"b"}, {"c"}}, {{"a"}, {"b", "X"}, {"c"}}, {{"a"}, {"b"}, {"c", "X"}}, {{"g", "X"}, {"h"}}, {{"g"}, {"h", "X"}}, }, }} for _, c := range cases { got := c.table.JoinCombination(c.s) test.Assert(t, "", c.exp, got) } }
explode_data.jsonl/58599
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 344 }
[ 2830, 3393, 2556, 10598, 1961, 36192, 2554, 1155, 353, 8840, 836, 8, 341, 1444, 2264, 1669, 3056, 1235, 341, 197, 26481, 6633, 198, 197, 1903, 257, 914, 198, 197, 48558, 256, 6633, 198, 197, 15170, 515, 197, 26481, 25, 6633, 515, 298,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestDisableScheduler(t *testing.T) { tests := []struct { name string client *mockEC2client instanceID string scheduleTag string err bool }{ { name: "disable scheduler", client: &mockEC2client{}, instanceID: instanceID, scheduleTag: "#13:00-14:00", }, { name: "disable scheduler error", client: &mockEC2client{ err: fmt.Errorf("error creating tags"), }, instanceID: instanceID, scheduleTag: "#13:00-14:00", err: true, }, } for _, test := range tests { t.Run(test.name, func(t *testing.T) { err := createTags(context.Background(), test.client, test.instanceID, []types.Tag{{Key: aws.String("Schedule"), Value: aws.String(test.scheduleTag)}}) if test.err { assert.Error(t, err) return } assert.NoError(t, err) }) } }
explode_data.jsonl/5387
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 389 }
[ 2830, 3393, 25479, 38878, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 3056, 1235, 341, 197, 11609, 286, 914, 198, 197, 25291, 414, 353, 16712, 7498, 17, 2972, 198, 197, 56256, 915, 220, 914, 198, 197, 1903, 8796, 5668, 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...
2
func TestWithMissingKeys(t *testing.T) { g := gomega.NewGomegaWithT(t) _ = os.Setenv("JWT_PRIVATE_KEY", "") _ = os.Setenv("JWT_PUBLIC_KEY", "") j := New() _, err := j.Sign(jwt.StandardClaims{}) g.Expect(err).Should(gomega.Equal(ErrNoPrivateKeySpecified)) _, err = j.Validate("fake-token") g.Expect(err).Should(gomega.Equal(ErrNoPublicKeySpecified)) }
explode_data.jsonl/13924
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 163 }
[ 2830, 3393, 2354, 25080, 8850, 1155, 353, 8840, 836, 8, 341, 3174, 1669, 342, 32696, 7121, 38, 32696, 2354, 51, 1155, 692, 197, 62, 284, 2643, 4202, 3160, 445, 55172, 30470, 6600, 497, 14676, 197, 62, 284, 2643, 4202, 3160, 445, 55172...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestRuntimeTypeIDOf(t *testing.T) { type T1 struct { _ int } tid := RuntimeTypeIDOf(new(T1)) t.Log(tid) assert.Equal(t, RuntimeTypeID(reflect.TypeOf(new(T1))), tid) tid2 := RuntimeTypeIDOf(T1{}) assert.NotEqual(t, tid, tid2) }
explode_data.jsonl/29653
{ "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, 15123, 91981, 2124, 1155, 353, 8840, 836, 8, 341, 13158, 350, 16, 2036, 341, 197, 197, 62, 526, 198, 197, 532, 3244, 307, 1669, 10954, 91981, 2124, 1755, 4140, 16, 1171, 3244, 5247, 83519, 340, 6948, 12808, 1155, 11, 10954...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestDecodeTx2(t *testing.T) { bdata, err := common.FromHex("0a05636f696e73121018010a0c108084af5f1a05310a320a3320e8b31b30b9b69483d7f9d3f04c3a22314b67453376617969715a4b6866684d66744e3776743267447639486f4d6b393431") assert.Nil(t, err) var r types.Transaction err = types.Decode(bdata, &r) assert.Nil(t, err) data, err := DecodeTx(&r) assert.Nil(t, err) jsondata, err := json.Marshal(data) assert.Nil(t, err) assert.Equal(t, string(jsondata), `{"execer":"coins","payload":{"transfer":{"cointoken":"","amount":"200000000","note":"1\n2\n3","to":""},"ty":1},"rawPayload":"0x18010a0c108084af5f1a05310a320a33","signature":{"ty":0,"pubkey":"","signature":""},"fee":449000,"feefmt":"0.0045","expire":0,"nonce":5539796760414985017,"from":"1HT7xU2Ngenf7D4yocz2SAcnNLW7rK8d4E","to":"1KgE3vayiqZKhfhMftN7vt2gDv9HoMk941","hash":"0x6f9d543a345f6e17d8c3cc5f846c22570acf3b4b5851f48d0c2be5459d90c410"}`) }
explode_data.jsonl/69486
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 446 }
[ 2830, 3393, 32564, 31584, 17, 1155, 353, 8840, 836, 8, 341, 2233, 691, 11, 1848, 1669, 4185, 11439, 20335, 445, 15, 64, 15, 20, 21, 18, 21, 69, 21, 24, 21, 68, 22, 18, 16, 17, 16, 15, 16, 23, 15, 16, 15, 64, 15, 66, 16, 15...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestStringLengthEqual(t *testing.T) { tests := []struct { msg string len int result bool }{ { "data", 4, true, }, { "dataa", 4, false, }, { "", 4, false, }, } for _, c := range tests { got := IsStringOfLength(c.msg, c.len) assert.Equal(t, c.result, got, "result must match") } }
explode_data.jsonl/13331
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 183 }
[ 2830, 3393, 44421, 2993, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 3056, 1235, 341, 197, 21169, 262, 914, 198, 197, 33111, 262, 526, 198, 197, 9559, 1807, 198, 197, 59403, 197, 197, 515, 298, 197, 97115, 756, 298, 197, 19, 345, 298...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestIdEllen(t *testing.T) { tc := SetupEngineTest(t, "id") defer tc.Cleanup() idUI, _, err := runIdentify(&tc, "t_ellen") if err != nil { t.Fatal(err) } checkDisplayKeys(t, idUI, 0, 0) }
explode_data.jsonl/52986
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 92 }
[ 2830, 3393, 764, 42710, 268, 1155, 353, 8840, 836, 8, 341, 78255, 1669, 18626, 4571, 2271, 1155, 11, 330, 307, 1138, 16867, 17130, 727, 60639, 741, 15710, 2275, 11, 8358, 1848, 1669, 1598, 28301, 1437, 2099, 10413, 11, 330, 83, 62, 15...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestOpenShiftClusterStaticValidateClusterProfile(t *testing.T) { commonTests := []*validateTest{ { name: "valid", }, { name: "pull secret not a map", modify: func(oc *OpenShiftCluster) { oc.Properties.ClusterProfile.PullSecret = "1" }, wantErr: "400: InvalidParameter: properties.clusterProfile.pullSecret: The provided pull secret is invalid.", }, { name: "pull secret invalid", modify: func(oc *OpenShiftCluster) { oc.Properties.ClusterProfile.PullSecret = "{" }, wantErr: "400: InvalidParameter: properties.clusterProfile.pullSecret: The provided pull secret is invalid.", }, { name: "empty domain invalid", modify: func(oc *OpenShiftCluster) { oc.Properties.ClusterProfile.Domain = "" }, wantErr: "400: InvalidParameter: properties.clusterProfile.domain: The provided domain '' is invalid.", }, { name: "upper case domain invalid", modify: func(oc *OpenShiftCluster) { oc.Properties.ClusterProfile.Domain = "BAD" }, wantErr: "400: InvalidParameter: properties.clusterProfile.domain: The provided domain 'BAD' is invalid.", }, { name: "domain invalid", modify: func(oc *OpenShiftCluster) { oc.Properties.ClusterProfile.Domain = "!" }, wantErr: "400: InvalidParameter: properties.clusterProfile.domain: The provided domain '!' is invalid.", }, { name: "wrong location managed domain invalid", modify: func(oc *OpenShiftCluster) { oc.Properties.ClusterProfile.Domain = "cluster.wronglocation.aroapp.io" }, wantErr: "400: InvalidParameter: properties.clusterProfile.domain: The provided domain 'cluster.wronglocation.aroapp.io' is invalid.", }, { name: "double part managed domain invalid", modify: func(oc *OpenShiftCluster) { oc.Properties.ClusterProfile.Domain = "foo.bar.location.aroapp.io" }, wantErr: "400: InvalidParameter: properties.clusterProfile.domain: The provided domain 'foo.bar.location.aroapp.io' is invalid.", }, { name: "resourceGroupId invalid", modify: func(oc *OpenShiftCluster) { oc.Properties.ClusterProfile.ResourceGroupID = "invalid" }, wantErr: "400: InvalidParameter: properties.clusterProfile.resourceGroupId: The provided resource group 'invalid' is invalid.", }, { name: "cluster resource group subscriptionId not matching cluster subscriptionId", modify: func(oc *OpenShiftCluster) { oc.Properties.ClusterProfile.ResourceGroupID = "/subscriptions/7a3036d1-60a1-4605-8a41-44955e050804/resourcegroups/test-cluster" }, wantErr: "400: InvalidParameter: properties.clusterProfile.resourceGroupId: The provided resource group '/subscriptions/7a3036d1-60a1-4605-8a41-44955e050804/resourcegroups/test-cluster' is invalid: must be in same subscription as cluster.", }, } createTests := []*validateTest{ { name: "empty pull secret valid", modify: func(oc *OpenShiftCluster) { oc.Properties.ClusterProfile.PullSecret = "" }, }, { name: "version invalid", modify: func(oc *OpenShiftCluster) { oc.Properties.ClusterProfile.Version = "invalid" }, wantErr: "400: InvalidParameter: properties.clusterProfile.version: The provided version 'invalid' is invalid.", }, } runTests(t, testModeCreate, createTests) runTests(t, testModeCreate, commonTests) runTests(t, testModeUpdate, commonTests) }
explode_data.jsonl/39079
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1222 }
[ 2830, 3393, 5002, 24841, 28678, 11690, 17926, 28678, 8526, 1155, 353, 8840, 836, 8, 341, 83825, 18200, 1669, 29838, 7067, 2271, 515, 197, 197, 515, 298, 11609, 25, 330, 1891, 756, 197, 197, 1583, 197, 197, 515, 298, 11609, 25, 330, 23...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestEmptyCPURequest(t *testing.T) { tc := testCase{ minReplicas: 1, maxReplicas: 5, initialReplicas: 1, desiredReplicas: 1, CPUTarget: 100, reportedLevels: []uint64{200}, } tc.runTest(t) }
explode_data.jsonl/79494
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 108 }
[ 2830, 3393, 3522, 31615, 1900, 1155, 353, 8840, 836, 8, 341, 78255, 1669, 54452, 515, 197, 25320, 18327, 52210, 25, 257, 220, 16, 345, 197, 22543, 18327, 52210, 25, 257, 220, 20, 345, 197, 85270, 18327, 52210, 25, 220, 16, 345, 197, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestWatch(t *testing.T) { storage, server := newStorage(t) defer server.Terminate(t) defer storage.Store.DestroyFunc() test := registrytest.New(t, storage.Store).ClusterScope() test.TestWatch( validNewPodSecurityPolicy(), // matching labels []labels.Set{}, // not matching labels []labels.Set{ {"foo": "bar"}, }, // matching fields []fields.Set{ {"metadata.name": "foo"}, }, // not matching fields []fields.Set{ {"metadata.name": "bar"}, {"name": "foo"}, }, ) }
explode_data.jsonl/24900
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 202 }
[ 2830, 3393, 14247, 1155, 353, 8840, 836, 8, 341, 197, 16172, 11, 3538, 1669, 501, 5793, 1155, 340, 16867, 3538, 836, 261, 34016, 1155, 340, 16867, 5819, 38047, 57011, 9626, 741, 18185, 1669, 19424, 1944, 7121, 1155, 11, 5819, 38047, 568...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestBasicUint32(t *testing.T) { f := NewCuckooFilter(20, 0.001) n1 := make([]byte, 4) n2 := make([]byte, 4) n3 := make([]byte, 4) n4 := make([]byte, 4) binary.BigEndian.PutUint32(n1, 100) binary.BigEndian.PutUint32(n2, 101) binary.BigEndian.PutUint32(n3, 102) binary.BigEndian.PutUint32(n4, 103) f.Insert(n1) n1b := f.Lookup(n1) n2b := f.Lookup(n2) n3b := f.Lookup(n3) f.Lookup(n4) if !n1b { t.Errorf("%v should be in.", n1) } if n2b { t.Errorf("%v should not be in.", n2) } if n3b { t.Errorf("%v should not be in.", n3) } }
explode_data.jsonl/24417
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 297 }
[ 2830, 3393, 15944, 21570, 18, 17, 1155, 353, 8840, 836, 8, 341, 1166, 1669, 1532, 34, 1942, 2624, 5632, 7, 17, 15, 11, 220, 15, 13, 15, 15, 16, 340, 9038, 16, 1669, 1281, 10556, 3782, 11, 220, 19, 340, 9038, 17, 1669, 1281, 1055...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestEscapeQuotes(t *testing.T) { expect := func(expected, value string) { actual := string(escapeBytesQuotes([]byte{}, []byte(value))) if actual != expected { t.Errorf( "expected %s, got %s", expected, actual, ) } actual = string(escapeStringQuotes([]byte{}, value)) if actual != expected { t.Errorf( "expected %s, got %s", expected, actual, ) } } expect("foo\x00bar", "foo\x00bar") // not affected expect("foo\nbar", "foo\nbar") // not affected expect("foo\rbar", "foo\rbar") // not affected expect("foo\x1abar", "foo\x1abar") // not affected expect("foo''bar", "foo'bar") // affected expect("foo\"bar", "foo\"bar") // not affected }
explode_data.jsonl/71466
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 298 }
[ 2830, 3393, 48124, 43780, 1155, 353, 8840, 836, 8, 341, 24952, 1669, 2915, 15253, 11, 897, 914, 8, 341, 197, 88814, 1669, 914, 7, 12998, 7078, 43780, 10556, 3782, 22655, 3056, 3782, 3679, 5929, 197, 743, 5042, 961, 3601, 341, 298, 324...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestWordPress_Convert(t *testing.T) { wp := WordPress{} ch := wp.convert(strings.NewReader(xmlTestWP), "testWP") comments := []store.Comment{} for c := range ch { comments = append(comments, c) } require.Equal(t, 3, len(comments), "3 comments exported, 1 excluded") exp1 := store.Comment{ ID: "13", Locator: store.Locator{ SiteID: "testWP", URL: "https://realmenweardress.es/2010/07/do-you-rp/", }, Text: `<p>[…] I know I’m a bit loony with my attachment to my bankers.  I’m glad I’m not the only one. […]</p>` + "\n", User: store.User{ Name: "Wednesday Reading &laquo; Cynwise&#039;s Battlefield Manual", ID: "wordpress_" + store.EncodeID("Wednesday Reading &laquo; Cynwise&#039;s Battlefield Manual"), IP: "74.200.244.101", }, Imported: true, } exp1.Timestamp, _ = time.Parse(wpTimeLayout, "2010-07-21 14:02:08") assert.Equal(t, exp1, comments[1]) }
explode_data.jsonl/63328
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 379 }
[ 2830, 3393, 92202, 15100, 1621, 1155, 353, 8840, 836, 8, 341, 31595, 1669, 19807, 16094, 23049, 1669, 12609, 24012, 51442, 68587, 29932, 2271, 25674, 701, 330, 1944, 25674, 5130, 197, 14727, 1669, 3056, 4314, 56730, 16094, 2023, 272, 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 TestAddArtifact(t *testing.T) { alert := NewAlert() art, err := NewArtifact("file", "./testData/thehive.txt") if err != nil { t.Errorf("unexpected error: %s", err.Error()) } alert.AddArtifact(art) if len(alert.Artifacts) != 1 { t.Errorf("expecting one artifact, but found %d", len(alert.Artifacts)) } }
explode_data.jsonl/29241
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 125 }
[ 2830, 3393, 2212, 85578, 1155, 353, 8840, 836, 8, 341, 24192, 1669, 1532, 9676, 2822, 197, 471, 11, 1848, 1669, 1532, 85578, 445, 1192, 497, 5924, 1944, 1043, 51257, 88568, 3909, 1138, 743, 1848, 961, 2092, 341, 197, 3244, 13080, 445, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestGithubProviderCreateStatus(t *testing.T) { checkrunid := int64(2026) resultid := int64(666) runEvent := info.NewEvent() prname := "pr1" runEvent.Organization = "check" runEvent.Repository = "run" type args struct { runevent *info.Event status string conclusion string text string detailsURL string titleSubstr string nilCompletedAtDate bool } tests := []struct { name string args args want *github.CheckRun wantErr bool notoken bool }{ { name: "success", args: args{ runevent: runEvent, status: "completed", conclusion: "success", text: "Yay", detailsURL: "https://cireport.com", titleSubstr: "Success", }, want: &github.CheckRun{ID: &resultid}, wantErr: false, }, { name: "in_progress", args: args{ runevent: runEvent, status: "in_progress", conclusion: "", text: "Yay", detailsURL: "https://cireport.com", nilCompletedAtDate: true, }, want: &github.CheckRun{ID: &resultid}, wantErr: false, }, { name: "failure", args: args{ runevent: runEvent, status: "completed", conclusion: "failure", text: "Nay", detailsURL: "https://cireport.com", titleSubstr: "Failed", }, want: &github.CheckRun{ID: &resultid}, wantErr: false, }, { name: "skipped", args: args{ runevent: runEvent, status: "completed", conclusion: "skipped", text: "Skipit", detailsURL: "https://cireport.com", titleSubstr: "Skipped", }, want: &github.CheckRun{ID: &resultid}, wantErr: false, }, { name: "unknown", args: args{ runevent: runEvent, status: "completed", conclusion: "neutral", text: "Je sais pas ce qui se passe wesh", detailsURL: "https://cireport.com", titleSubstr: "Unknown", }, want: &github.CheckRun{ID: &resultid}, wantErr: false, }, { name: "no token set", wantErr: true, notoken: true, }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { fakeclient, mux, _, teardown := ghtesthelper.SetupGH() defer teardown() ctx, _ := rtesting.SetupFakeContext(t) gcvs := Provider{ Client: fakeclient, CheckRunIDS: &sync.Map{}, } gcvs.CheckRunIDS.Store(prname, &checkrunid) mux.HandleFunc(fmt.Sprintf("/repos/check/run/check-runs/%d", checkrunid), func(rw http.ResponseWriter, r *http.Request) { bit, _ := ioutil.ReadAll(r.Body) checkRun := &github.CheckRun{} err := json.Unmarshal(bit, checkRun) assert.NilError(t, err) if tt.args.nilCompletedAtDate { // I guess that's the way you check for an undefined year, // or maybe i don't understand fully how go works😅 assert.Assert(t, checkRun.GetCompletedAt().Year() == 0o001) } assert.Equal(t, checkRun.GetStatus(), tt.args.status) assert.Equal(t, checkRun.GetConclusion(), tt.args.conclusion) assert.Equal(t, checkRun.Output.GetText(), tt.args.text) assert.Equal(t, checkRun.GetDetailsURL(), tt.args.detailsURL) assert.Assert(t, strings.Contains(checkRun.Output.GetTitle(), tt.args.titleSubstr)) _, err = fmt.Fprintf(rw, `{"id": %d}`, resultid) assert.NilError(t, err) }) status := provider.StatusOpts{ PipelineRunName: prname, Status: tt.args.status, Conclusion: tt.args.conclusion, Text: tt.args.text, DetailsURL: tt.args.detailsURL, } pacopts := &info.PacOpts{ LogURL: "https://log", } if !tt.notoken { tt.args.runevent.Provider = &info.Provider{ Token: "hello", URL: "moto", } } else { tt.args.runevent = info.NewEvent() } err := gcvs.CreateStatus(ctx, tt.args.runevent, pacopts, status) if (err != nil) != tt.wantErr { t.Errorf("GithubProvider.CreateStatus() error = %v, wantErr %v", err, tt.wantErr) return } }) } }
explode_data.jsonl/40814
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1992 }
[ 2830, 3393, 78717, 5179, 4021, 2522, 1155, 353, 8840, 836, 8, 341, 25157, 6108, 307, 1669, 526, 21, 19, 7, 17, 15, 17, 21, 340, 9559, 307, 1669, 526, 21, 19, 7, 21, 21, 21, 340, 56742, 1556, 1669, 3546, 7121, 1556, 741, 25653, 6...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestConvertResources(t *testing.T) { validator := crdvalidation.NewIstioValidator(t) cases := []string{ "http", "tcp", "tls", "mismatch", "weighted", "backendpolicy", "mesh", "invalid", "multi-gateway", } for _, tt := range cases { t.Run(tt, func(t *testing.T) { input := readConfig(t, fmt.Sprintf("testdata/%s.yaml", tt), validator) kr := splitInput(input) output := convertResources(kr) goldenFile := fmt.Sprintf("testdata/%s.yaml.golden", tt) if util.Refresh() { res := append(output.Gateway, output.VirtualService...) res = append(res, output.DestinationRule...) if err := ioutil.WriteFile(goldenFile, marshalYaml(t, res), 0o644); err != nil { t.Fatal(err) } } golden := splitOutput(readConfig(t, goldenFile, validator)) if diff := cmp.Diff(golden, output); diff != "" { t.Fatalf("Diff:\n%s", diff) } outputStatus := getStatus(t, kr.GatewayClass, kr.Gateway, kr.HTTPRoute, kr.TLSRoute, kr.TCPRoute, kr.BackendPolicy) goldenStatusFile := fmt.Sprintf("testdata/%s.status.yaml.golden", tt) if util.Refresh() { if err := ioutil.WriteFile(goldenStatusFile, outputStatus, 0o644); err != nil { t.Fatal(err) } } goldenStatus, err := ioutil.ReadFile(goldenStatusFile) if err != nil { t.Fatal(err) } if diff := cmp.Diff(string(goldenStatus), string(outputStatus)); diff != "" { t.Fatalf("Diff:\n%s", diff) } }) } }
explode_data.jsonl/73940
{ "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, 12012, 11277, 1155, 353, 8840, 836, 8, 341, 197, 16112, 1669, 1560, 67, 12284, 7121, 40, 267, 815, 14256, 1155, 340, 1444, 2264, 1669, 3056, 917, 515, 197, 197, 76932, 756, 197, 197, 1, 27161, 756, 197, 197, 1, 34488, 75...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestImportExistingNamespace(t *testing.T) { tname := "public" ns := acctest.RandString(10) id := tname + "/" + ns resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) createNamespace(t, id) }, CheckDestroy: testPulsarNamespaceDestroy, Providers: testAccProviders, Steps: []resource.TestStep{ { ResourceName: "pulsar_namespace.test", ImportState: true, Config: testPulsarExistingNamespaceWithoutOptionals(testWebServiceURL, ns), ImportStateId: id, ImportStateCheck: testNamespaceImported(), }, }, }) }
explode_data.jsonl/4693
{ "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, 11511, 53067, 22699, 1155, 353, 8840, 836, 8, 341, 3244, 606, 1669, 330, 888, 698, 84041, 1669, 1613, 67880, 2013, 437, 703, 7, 16, 15, 692, 15710, 1669, 259, 606, 488, 16891, 488, 12268, 271, 50346, 8787, 1155, 11, 5101, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestHandleAlert(t *testing.T) { basicSetup := func() (*handler.Arguments, adaptor.SFnClient, adaptor.Repository) { dummySFn, _ := mock.NewSFnClient("") dummyRepo := mock.NewRepository("", "") args := &handler.Arguments{ NewRepository: func(string, string) adaptor.Repository { return dummyRepo }, NewSFn: func(string) (adaptor.SFnClient, error) { return dummySFn, nil }, EnvVars: handler.EnvVars{ InspectorMashine: "arn:aws:states:us-east-1:111122223333:stateMachine:blue", ReviewMachine: "arn:aws:states:us-east-1:111122223333:stateMachine:orange", }, } return args, dummySFn, dummyRepo } t.Run("Recept single alert", func(t *testing.T) { alert := &deepalert.Alert{ AlertKey: "5", RuleID: "five", RuleName: "fifth", Detector: "ao", } args, dummySFn, dummyRepo := basicSetup() report, err := usecase.HandleAlert(args, alert, time.Now()) require.NoError(t, err) assert.NotNil(t, report) assert.NotEqual(t, "", report.ID) repoSvc := service.NewRepositoryService(dummyRepo, 10) t.Run("StepFunctions should be executed", func(t *testing.T) { sfn, ok := dummySFn.(*mock.SFnClient) require.True(t, ok) require.Equal(t, 2, len(sfn.Input)) assert.Equal(t, "arn:aws:states:us-east-1:111122223333:stateMachine:blue", *sfn.Input[0].StateMachineArn) assert.Equal(t, "arn:aws:states:us-east-1:111122223333:stateMachine:orange", *sfn.Input[1].StateMachineArn) var report1, report2 deepalert.Report require.NoError(t, json.Unmarshal([]byte(*sfn.Input[0].Input), &report1)) require.Equal(t, 1, len(report1.Alerts)) assert.Equal(t, alert, report1.Alerts[0]) require.NoError(t, json.Unmarshal([]byte(*sfn.Input[1].Input), &report2)) require.Equal(t, 1, len(report2.Alerts)) assert.Equal(t, alert, report2.Alerts[0]) assert.Equal(t, report1, report2) }) t.Run("AlertCachce should be stored in repository", func(t *testing.T) { alertCache, err := repoSvc.FetchAlertCache(report.ID) require.NoError(t, err) require.Equal(t, 1, len(alertCache)) assert.Equal(t, alert, alertCache[0]) }) t.Run("Report should be stored in repository", func(t *testing.T) { report, err := repoSvc.GetReport(report.ID) require.NoError(t, err) require.Equal(t, 1, len(report.Alerts)) assert.Equal(t, alert, report.Alerts[0]) }) }) t.Run("Error cases", func(t *testing.T) { t.Run("Alert without Detector field is not allowed", func(t *testing.T) { alert := &deepalert.Alert{ AlertKey: "5", RuleID: "five", RuleName: "fifth", Detector: "", } args, dummySFn, _ := basicSetup() report, err := usecase.HandleAlert(args, alert, time.Now()) require.Error(t, err) assert.True(t, errors.Is(err, deepalert.ErrInvalidAlert)) assert.Nil(t, report) sfn, ok := dummySFn.(*mock.SFnClient) require.True(t, ok) require.Equal(t, 0, len(sfn.Input)) }) t.Run("Alert without RuleID field is not allowed", func(t *testing.T) { alert := &deepalert.Alert{ AlertKey: "5", RuleID: "", RuleName: "fifth", Detector: "ao", } args, dummySFn, _ := basicSetup() report, err := usecase.HandleAlert(args, alert, time.Now()) require.Error(t, err) assert.True(t, errors.Is(err, deepalert.ErrInvalidAlert)) assert.Nil(t, report) sfn, ok := dummySFn.(*mock.SFnClient) require.True(t, ok) require.Equal(t, 0, len(sfn.Input)) }) }) t.Run("Recept alerts with same AlertID", func(t *testing.T) { // AlertID is calculated by AlertKey, RuleID and Detector alert1 := &deepalert.Alert{ AlertKey: "123", RuleID: "blue", RuleName: "fifth", Detector: "ao", } alert2 := &deepalert.Alert{ AlertKey: "123", RuleID: "blue", RuleName: "five", Detector: "ao", } args, _, _ := basicSetup() report1, err := usecase.HandleAlert(args, alert1, time.Now()) require.NoError(t, err) assert.NotNil(t, report1) assert.NotEqual(t, "", report1.ID) report2, err := usecase.HandleAlert(args, alert2, time.Now()) require.NoError(t, err) assert.NotNil(t, report2) assert.NotEqual(t, "", report2.ID) t.Run("ReportIDs should be same", func(t *testing.T) { assert.Equal(t, report1.ID, report2.ID) }) }) t.Run("ReportIDs should be different if AlertID is not same", func(t *testing.T) { // AlertID is calculated by AlertKey, RuleID and Detector args, _, _ := basicSetup() t.Run("Different AlertKey", func(t *testing.T) { alert1 := &deepalert.Alert{ AlertKey: "234", RuleID: "blue", RuleName: "fifth", Detector: "ao", } alert2 := &deepalert.Alert{ AlertKey: "123", RuleID: "blue", RuleName: "five", Detector: "ao", } report1, err := usecase.HandleAlert(args, alert1, time.Now()) require.NoError(t, err) report2, err := usecase.HandleAlert(args, alert2, time.Now()) require.NoError(t, err) assert.NotEqual(t, report1.ID, report2.ID) }) t.Run("Different RuleID", func(t *testing.T) { alert1 := &deepalert.Alert{ AlertKey: "123", RuleID: "blue", RuleName: "fifth", Detector: "ao", } alert2 := &deepalert.Alert{ AlertKey: "123", RuleID: "orange", RuleName: "five", Detector: "ao", } report1, err := usecase.HandleAlert(args, alert1, time.Now()) require.NoError(t, err) report2, err := usecase.HandleAlert(args, alert2, time.Now()) require.NoError(t, err) assert.NotEqual(t, report1.ID, report2.ID) }) t.Run("Different Detector", func(t *testing.T) { alert1 := &deepalert.Alert{ AlertKey: "123", RuleID: "blue", RuleName: "fifth", Detector: "ao", } alert2 := &deepalert.Alert{ AlertKey: "123", RuleID: "blue", RuleName: "five", Detector: "tou", } report1, err := usecase.HandleAlert(args, alert1, time.Now()) require.NoError(t, err) report2, err := usecase.HandleAlert(args, alert2, time.Now()) require.NoError(t, err) assert.NotEqual(t, report1.ID, report2.ID) }) }) }
explode_data.jsonl/1266
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 2638 }
[ 2830, 3393, 6999, 9676, 1155, 353, 8840, 836, 8, 341, 2233, 5971, 21821, 1669, 2915, 368, 4609, 17905, 80108, 11, 91941, 808, 24911, 2959, 11, 91941, 25170, 8, 341, 197, 2698, 8574, 50, 24911, 11, 716, 1669, 7860, 7121, 50, 24911, 295...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestPickAll(t *testing.T) { p := New() p.Set("foo", "b", "a", "r") assert.Equal(t, []string{"b", "a", "r"}, p.PickAll("foo")) assert.False(t, p.Exists("foo")) }
explode_data.jsonl/1464
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 79 }
[ 2830, 3393, 36953, 2403, 1155, 353, 8840, 836, 8, 341, 3223, 1669, 1532, 741, 3223, 4202, 445, 7975, 497, 330, 65, 497, 330, 64, 497, 330, 81, 1138, 6948, 12808, 1155, 11, 3056, 917, 4913, 65, 497, 330, 64, 497, 330, 81, 14345, 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
func TestResources_Droplets(t *testing.T) { droplets := []*godo.Droplet{ {ID: 1}, {ID: 2}, } resources := &resources{ dropletIDMap: map[int]*godo.Droplet{ droplets[0].ID: droplets[0], droplets[1].ID: droplets[1], }, } foundDroplets := resources.Droplets() // order found droplets by id so we can compare sort.Slice(foundDroplets, func(a, b int) bool { return foundDroplets[a].ID < foundDroplets[b].ID }) if want, got := droplets, foundDroplets; !reflect.DeepEqual(want, got) { t.Errorf("incorrect droplets\nwant: %#v\n got: %#v", want, got) } }
explode_data.jsonl/28021
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 231 }
[ 2830, 3393, 11277, 1557, 299, 89492, 1155, 353, 8840, 836, 8, 341, 2698, 299, 89492, 1669, 29838, 70, 6004, 909, 299, 10819, 515, 197, 197, 90, 915, 25, 220, 16, 2137, 314, 915, 25, 220, 17, 1583, 197, 532, 10202, 2360, 1669, 609, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestLabeler(t *testing.T) { assert := assert.New(t) businessLayer := setupLabelerK8S() trafficMap, appNodeId, appNodeV1Id, appNodeV2Id, svcNodeId, wlNodeId := setupLabelerTrafficMap() assert.Equal(5, len(trafficMap)) assert.Equal(nil, trafficMap[appNodeId].Metadata[graph.Labels]) assert.Equal(nil, trafficMap[appNodeV1Id].Metadata[graph.Labels]) assert.Equal(nil, trafficMap[appNodeV2Id].Metadata[graph.Labels]) assert.Equal(nil, trafficMap[svcNodeId].Metadata[graph.Labels]) assert.Equal(nil, trafficMap[wlNodeId].Metadata[graph.Labels]) globalInfo := graph.NewAppenderGlobalInfo() globalInfo.Business = businessLayer a := LabelerAppender{} a.AppendGraph(trafficMap, globalInfo, nil) assert.Equal(5, len(trafficMap)) assert.Equal(1, len(trafficMap[appNodeId].Metadata[graph.Labels].(graph.LabelsMetadata))) assert.Equal("east,west", trafficMap[appNodeId].Metadata[graph.Labels].(graph.LabelsMetadata)["datacenter"]) assert.Equal(1, len(trafficMap[appNodeV1Id].Metadata[graph.Labels].(graph.LabelsMetadata))) assert.Equal("east", trafficMap[appNodeV1Id].Metadata[graph.Labels].(graph.LabelsMetadata)["datacenter"]) assert.Equal(1, len(trafficMap[appNodeV2Id].Metadata[graph.Labels].(graph.LabelsMetadata))) assert.Equal("west", trafficMap[appNodeV2Id].Metadata[graph.Labels].(graph.LabelsMetadata)["datacenter"]) assert.Equal(1, len(trafficMap[svcNodeId].Metadata[graph.Labels].(graph.LabelsMetadata))) assert.Equal("east", trafficMap[svcNodeId].Metadata[graph.Labels].(graph.LabelsMetadata)["datacenter"]) assert.Equal(1, len(trafficMap[wlNodeId].Metadata[graph.Labels].(graph.LabelsMetadata))) assert.Equal("east", trafficMap[wlNodeId].Metadata[graph.Labels].(graph.LabelsMetadata)["datacenter"]) }
explode_data.jsonl/46754
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 656 }
[ 2830, 3393, 2476, 261, 1155, 353, 8840, 836, 8, 341, 6948, 1669, 2060, 7121, 1155, 692, 2233, 2063, 9188, 1669, 6505, 2476, 261, 42, 23, 50, 741, 197, 53987, 2227, 11, 906, 79206, 11, 906, 1955, 53, 16, 764, 11, 906, 1955, 53, 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...
1
func Test_isUpToDate(t *testing.T) { type args struct { kube client.Client in *v1beta1.ReleaseParameters observed *release.Release } type want struct { out bool err error } cases := map[string]struct { args want }{ "InfoNilInObserved": { args: args{ observed: &release.Release{ Info: nil, }, }, want: want{ out: false, err: errors.New(errReleaseInfoNilInObservedRelease), }, }, "PendingReturnsNotUpToDate": { args: args{ observed: &release.Release{ Info: &release.Info{ Status: release.StatusPendingUpgrade, }, Chart: nil, Config: testReleaseConfig, }, }, want: want{ out: false, }, }, "ChartNilInObserved": { args: args{ observed: &release.Release{ Info: &release.Info{}, Chart: nil, Config: testReleaseConfig, }, }, want: want{ out: false, err: errors.New(errChartNilInObservedRelease), }, }, "ChartMetaNilInObserved": { args: args{ observed: &release.Release{ Info: &release.Info{}, Chart: &chart.Chart{ Raw: nil, Metadata: nil, }, Config: testReleaseConfig, }, }, want: want{ out: false, err: errors.New(errChartMetaNilInObservedRelease), }, }, "FailedToComposeValues": { args: args{ kube: &test.MockClient{ MockGet: nil, }, in: &v1beta1.ReleaseParameters{ Chart: v1beta1.ChartSpec{ Name: testChart, Version: testVersion, }, ValuesSpec: v1beta1.ValuesSpec{ Values: runtime.RawExtension{ Raw: []byte("invalid-yaml"), Object: nil, }, }, }, observed: &release.Release{ Info: &release.Info{}, Chart: &chart.Chart{ Raw: nil, Metadata: &chart.Metadata{ Name: testChart, Version: testVersion, }, }, Config: testReleaseConfig, }, }, want: want{ out: false, err: errors.Wrap( errors.Wrap(errors.New("error unmarshaling JSON: while decoding JSON: "+ "json: cannot unmarshal string into Go value of type map[string]interface {}"), errFailedToUnmarshalDesiredValues), errFailedToComposeValues), }, }, "NotUpToDate_ChartNameDifferent": { args: args{ kube: &test.MockClient{ MockGet: nil, }, in: &v1beta1.ReleaseParameters{ Chart: v1beta1.ChartSpec{ Name: "another-chart", Version: testVersion, }, ValuesSpec: v1beta1.ValuesSpec{ Values: runtime.RawExtension{ Raw: []byte(testReleaseConfigStr), }, }, }, observed: &release.Release{ Info: &release.Info{}, Chart: &chart.Chart{ Raw: nil, Metadata: &chart.Metadata{ Name: testChart, Version: testVersion, }, }, Config: testReleaseConfig, }, }, want: want{ out: false, err: nil, }, }, "NotUpToDate_ChartVersionDifferent": { args: args{ kube: &test.MockClient{ MockGet: nil, }, in: &v1beta1.ReleaseParameters{ Chart: v1beta1.ChartSpec{ Name: testChart, Version: "another-version", }, ValuesSpec: v1beta1.ValuesSpec{ Values: runtime.RawExtension{ Raw: []byte(testReleaseConfigStr), }, }, }, observed: &release.Release{ Info: &release.Info{}, Chart: &chart.Chart{ Raw: nil, Metadata: &chart.Metadata{ Name: testChart, Version: testVersion, }, }, Config: testReleaseConfig, }, }, want: want{ out: false, err: nil, }, }, "NotUpToDate_ConfigIsDifferent": { args: args{ kube: &test.MockClient{ MockGet: nil, }, in: &v1beta1.ReleaseParameters{ Chart: v1beta1.ChartSpec{ Name: testChart, Version: testVersion, }, ValuesSpec: v1beta1.ValuesSpec{ Values: runtime.RawExtension{ Raw: []byte("keyA: valX"), }, }, }, observed: &release.Release{ Info: &release.Info{}, Chart: &chart.Chart{ Raw: nil, Metadata: &chart.Metadata{ Name: testChart, Version: testVersion, }, }, Config: testReleaseConfig, }, }, want: want{ out: false, err: nil, }, }, "SuccessUpToDate": { args: args{ kube: &test.MockClient{ MockGet: nil, }, in: &v1beta1.ReleaseParameters{ Chart: v1beta1.ChartSpec{ Name: testChart, Version: testVersion, }, ValuesSpec: v1beta1.ValuesSpec{ Values: runtime.RawExtension{ Raw: []byte(testReleaseConfigStr), }, }, }, observed: &release.Release{ Info: &release.Info{}, Chart: &chart.Chart{ Raw: nil, Metadata: &chart.Metadata{ Name: testChart, Version: testVersion, }, }, Config: testReleaseConfig, }, }, want: want{ out: true, err: nil, }, }, "SuccessPatchesAdded": { args: args{ kube: &test.MockClient{ MockGet: nil, }, in: &v1beta1.ReleaseParameters{ Chart: v1beta1.ChartSpec{ Name: testChart, Version: testVersion, }, ValuesSpec: v1beta1.ValuesSpec{ Values: runtime.RawExtension{ Raw: []byte(testReleaseConfigStr), }, }, }, observed: &release.Release{ Info: &release.Info{}, Chart: &chart.Chart{ Raw: nil, Metadata: &chart.Metadata{ Name: testChart, Version: testVersion, }, }, Config: testReleaseConfig, }, }, want: want{ out: true, err: nil, }, }, } for name, tc := range cases { t.Run(name, func(t *testing.T) { got, gotErr := isUpToDate(context.Background(), tc.args.kube, tc.args.in, tc.args.observed, v1beta1.ReleaseStatus{}) if diff := cmp.Diff(tc.want.err, gotErr, test.EquateErrors()); diff != "" { t.Fatalf("isUpToDate(...): -want error, +got error: %s", diff) } if diff := cmp.Diff(tc.want.out, got); diff != "" { t.Errorf("isUpToDate(...): -want result, +got result: %s", diff) } }) } }
explode_data.jsonl/21510
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 3110 }
[ 2830, 3393, 6892, 2324, 76054, 1155, 353, 8840, 836, 8, 341, 13158, 2827, 2036, 341, 197, 16463, 3760, 257, 2943, 11716, 198, 197, 17430, 981, 353, 85, 16, 19127, 16, 58693, 9706, 198, 197, 197, 5481, 2771, 353, 22998, 58693, 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...
3
func TestRevocation(t *testing.T) { app, ctx, _, addrVals := bootstrapSlashTest(t, 5) consAddr := sdk.ConsAddress(PKs[0].Address()) // initial state val, found := app.StakingKeeper.GetValidator(ctx, addrVals[0]) require.True(t, found) require.False(t, val.IsJailed()) // test jail app.StakingKeeper.Jail(ctx, consAddr) val, found = app.StakingKeeper.GetValidator(ctx, addrVals[0]) require.True(t, found) require.True(t, val.IsJailed()) // test unjail app.StakingKeeper.Unjail(ctx, consAddr) val, found = app.StakingKeeper.GetValidator(ctx, addrVals[0]) require.True(t, found) require.False(t, val.IsJailed()) }
explode_data.jsonl/25497
{ "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, 36184, 2276, 1155, 353, 8840, 836, 8, 341, 28236, 11, 5635, 11, 8358, 10789, 52452, 1669, 26925, 88004, 2271, 1155, 11, 220, 20, 692, 197, 6254, 13986, 1669, 45402, 94594, 4286, 5304, 42, 82, 58, 15, 936, 4286, 12367, 197,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestDefaultRelease(t *testing.T) { var linuxDB = NewLinuxDB() result := linuxDB.GetDistro("ubuntu") if result == nil { t.Error("Cannot get distro 'ubuntu'") } release := result.GetRelease("default") if release == nil { t.Error("Cannot get release 'default' for distro 'ubuntu'") } }
explode_data.jsonl/49610
{ "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, 3675, 16077, 1155, 353, 8840, 836, 8, 341, 2405, 36245, 3506, 284, 1532, 46324, 3506, 741, 9559, 1669, 36245, 3506, 2234, 35, 15561, 445, 37979, 1138, 743, 1102, 621, 2092, 341, 197, 3244, 6141, 445, 17444, 633, 1582, 299, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestDelete(t *testing.T) { _, c, cleanup := createContexts(t) defer cleanup() ns := v23.GetNamespace(c) // Create a root mount table with mount tables mounted at mt1, mt1, ... root, _, _, stopper := createNamespace(t, c) defer stopper() ns.SetRoots(root.name) // We should be able to remove servers below the root. if err := ns.Delete(c, "mt1", false); err != nil { t.Errorf("Delete failed: %s", err) } // Create a server below one level down. if err := ns.Mount(c, "mt2/b/c", "/madeup:1111/server", time.Minute); err != nil { t.Errorf("Mount mt2/b/c failed: %s", err) } // We should not be able to delete mt2/b... if err := ns.Delete(c, "mt2/b", false); err == nil { t.Errorf("Delete mt2/b should have failed") } // ...unless we include its children. if err := ns.Delete(c, "mt2/b", true); err != nil { t.Errorf("Delete failed: %s", err) } }
explode_data.jsonl/8234
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 340 }
[ 2830, 3393, 6435, 1155, 353, 8840, 836, 8, 341, 197, 6878, 272, 11, 21290, 1669, 83674, 82, 1155, 340, 16867, 21290, 741, 84041, 1669, 348, 17, 18, 2234, 22699, 1337, 692, 197, 322, 4230, 264, 3704, 6470, 1965, 448, 6470, 12632, 21810...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestManageDataValidateValue(t *testing.T) { kp0 := newKeypair0() sourceAccount := NewSimpleAccount(kp0.Address(), int64(3556091187167235)) manageData := ManageData{ Name: "cars", Value: []byte("toyota, ford, porsche, lamborghini, hyundai, volkswagen, gmc, kia"), } _, err := NewTransaction( TransactionParams{ SourceAccount: &sourceAccount, IncrementSequenceNum: false, Operations: []Operation{&manageData}, BaseFee: MinBaseFee, Timebounds: NewInfiniteTimeout(), }, ) if assert.Error(t, err) { expected := "validation failed for *txnbuild.ManageData operation: Field: Value, Error: maximum length is 64 bytes" assert.Contains(t, err.Error(), expected) } }
explode_data.jsonl/62884
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 301 }
[ 2830, 3393, 33076, 1043, 17926, 1130, 1155, 353, 8840, 836, 8, 341, 16463, 79, 15, 1669, 501, 6608, 1082, 1310, 15, 741, 47418, 7365, 1669, 1532, 16374, 7365, 5969, 79, 15, 26979, 1507, 526, 21, 19, 7, 18, 20, 20, 21, 15, 24, 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...
2
func TestAuthOnlyEndpointUnauthorizedOnEmailValidationFailure(t *testing.T) { test, err := NewAuthOnlyEndpointTest("") if err != nil { t.Fatal(err) } created := time.Now() startSession := &sessions.SessionState{ Email: "michael.bland@gsa.gov", AccessToken: "my_access_token", CreatedAt: &created} err = test.SaveSession(startSession) assert.NoError(t, err) test.validateUser = false test.proxy.ServeHTTP(test.rw, test.req) assert.Equal(t, http.StatusUnauthorized, test.rw.Code) bodyBytes, _ := ioutil.ReadAll(test.rw.Body) assert.Equal(t, "Unauthorized\n", string(bodyBytes)) }
explode_data.jsonl/36407
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 227 }
[ 2830, 3393, 5087, 7308, 27380, 51181, 1925, 4781, 13799, 17507, 1155, 353, 8840, 836, 8, 341, 18185, 11, 1848, 1669, 1532, 5087, 7308, 27380, 2271, 31764, 743, 1848, 961, 2092, 341, 197, 3244, 26133, 3964, 340, 197, 630, 197, 7120, 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 TestSecondRetention(t *testing.T) { secs, err := RetentionSeconds("1s") if err != nil { t.Errorf("Unable to calculate retention") } if secs != uint32(1) { t.Errorf("Incorrect retention") } }
explode_data.jsonl/74567
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 81 }
[ 2830, 3393, 15666, 86329, 1155, 353, 8840, 836, 8, 341, 197, 53281, 11, 1848, 1669, 10392, 2939, 15343, 445, 16, 82, 1138, 743, 1848, 961, 2092, 341, 197, 3244, 13080, 445, 17075, 311, 11047, 37131, 1138, 197, 630, 743, 49749, 961, 26...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
3
func TestCleanupBlockRevFiles(t *testing.T) { testDir, err := initTestEnv(t) assert.Nil(t, err) defer os.RemoveAll(testDir) dirBlocks := filepath.Join(testDir, "blocks") err = os.Mkdir(dirBlocks, 0777) assert.Nil(t, err) // test delete blk file that index not continuous blkList := []string{ "blk00000.dat", "blk00001.dat", "blk00003.dat", } for _, filename := range blkList { _, err = os.Create(filepath.Join(dirBlocks, filename)) assert.Nil(t, err) } revList := []string{ "rev00000.dat", "rev00001.dat", } for _, filename := range revList { _, err = os.Create(filepath.Join(dirBlocks, filename)) assert.Nil(t, err) } CleanupBlockRevFiles() files, err := ioutil.ReadDir(dirBlocks) assert.Nil(t, err) for _, file := range files { is := isBlkFile(file.Name()) assert.True(t, is) } }
explode_data.jsonl/39305
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 352 }
[ 2830, 3393, 67335, 4713, 36184, 10809, 1155, 353, 8840, 836, 8, 341, 18185, 6184, 11, 1848, 1669, 2930, 2271, 14359, 1155, 340, 6948, 59678, 1155, 11, 1848, 692, 16867, 2643, 84427, 8623, 6184, 692, 48532, 29804, 1669, 26054, 22363, 8623,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestResolveWithCache(t *testing.T) { inspectCounter := 0 cli := &fakeClient{ nodeInspectFunc: func(nodeID string) (swarm.Node, []byte, error) { inspectCounter++ return *Node(NodeName("node-foo")), []byte{}, nil }, } idResolver := New(cli, false) ctx := context.Background() for i := 0; i < 2; i++ { id, err := idResolver.Resolve(ctx, swarm.Node{}, "nodeID") assert.NoError(t, err) assert.Equal(t, "node-foo", id) } assert.Equal(t, 1, inspectCounter) }
explode_data.jsonl/9039
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 199 }
[ 2830, 3393, 56808, 2354, 8233, 1155, 353, 8840, 836, 8, 341, 197, 82054, 14099, 1669, 220, 15, 198, 86448, 1669, 609, 30570, 2959, 515, 197, 20831, 58533, 9626, 25, 2915, 6958, 915, 914, 8, 320, 2280, 2178, 21714, 11, 3056, 3782, 11, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestWeakInput(t *testing.T) { input := map[string]interface{}{ "bool2string1": true, "bool2string2": false, "int2string": 0, "float2string": float64(0.0), "string2bool1": "true", "string2bool2": "false", "int2bool1": 0, "int2bool2": 100, "bool2int1": false, "bool2int2": true, "string2int1": "0", "string2int2": "1", "string2int3": "", "map2string": map[string]int{ "abc": 1, }, "slice2string1": []byte("hello"), "slice2string2": []string{"hello", "world"}, "slice2string3": []int{1, 2, 3}, "interface2string": map[string]interface{}{ "name": "zhaojkun", "age": 12, }, } var res WeakBasicResult config := &DecoderConfig{ WeaklyTypedInput: true, Result: &res, } decoder, err := NewDecoder(config) if err != nil { t.Fatalf("err: %s", err) } err = decoder.Decode(input) if err != nil { t.Fatalf("got an err: %s", err) } assert.Equal(t, "true", res.Bool2String1) assert.Equal(t, "false", res.Bool2String2) assert.Equal(t, "0", res.Int2String) assert.Equal(t, "0", res.Float2String) assert.Equal(t, true, res.String2Bool1) assert.Equal(t, false, res.String2Bool2) assert.Equal(t, false, res.Int2Bool1) assert.Equal(t, true, res.Int2Bool2) assert.Equal(t, 0, res.Bool2Int1) assert.Equal(t, 1, res.Bool2Int2) assert.Equal(t, 0, res.String2Int1) assert.Equal(t, 1, res.String2Int2) assert.Equal(t, 0, res.String2Int3) assert.Equal(t, `{"abc":1}`, res.Map2String) assert.Equal(t, "hello", res.Slice2String1) assert.Equal(t, `["hello","world"]`, res.Slice2String2) assert.Equal(t, `[1,2,3]`, res.Slice2String3) assert.Equal(t, `{"age":12,"name":"zhaojkun"}`, res.Interface2String) }
explode_data.jsonl/71181
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 803 }
[ 2830, 3393, 49649, 2505, 1155, 353, 8840, 836, 8, 341, 22427, 1669, 2415, 14032, 31344, 67066, 197, 197, 1, 2641, 17, 917, 16, 788, 830, 345, 197, 197, 1, 2641, 17, 917, 17, 788, 895, 345, 197, 197, 1, 396, 17, 917, 788, 256, 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...
3
func TestTransactionFetcherDropRescheduling(t *testing.T) { testTransactionFetcherParallel(t, txFetcherTest{ init: func() *TxFetcher { return NewTxFetcher( func(common.Hash) bool { return false }, func(txs []*types.Transaction) []error { return make([]error, len(txs)) }, func(string, []common.Hash) error { return nil }, ) }, steps: []interface{}{ // Set up a few hashes into various stages doTxNotify{peer: "A", hashes: []common.Hash{{0x01}}}, doWait{time: txArriveTimeout, step: true}, doTxNotify{peer: "B", hashes: []common.Hash{{0x01}}}, isWaiting(nil), isScheduled{ tracking: map[string][]common.Hash{ "A": {{0x01}}, "B": {{0x01}}, }, fetching: map[string][]common.Hash{ "A": {{0x01}}, }, }, // Drop the peer and ensure everything's cleaned out doDrop("A"), isWaiting(nil), isScheduled{ tracking: map[string][]common.Hash{ "B": {{0x01}}, }, fetching: map[string][]common.Hash{ "B": {{0x01}}, }, }, }, }) }
explode_data.jsonl/52227
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 484 }
[ 2830, 3393, 8070, 97492, 19871, 1061, 44356, 1155, 353, 8840, 836, 8, 341, 18185, 8070, 97492, 16547, 1155, 11, 259, 9770, 2995, 261, 2271, 515, 197, 28248, 25, 2915, 368, 353, 51, 9770, 2995, 261, 341, 298, 853, 1532, 51, 9770, 2995,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestWatcherWatchWithFilter(t *testing.T) { b, tmpPath := backend.NewDefaultTmpBackend() s := WatchableKV(newWatchableStore(zap.NewExample(), b, &lease.FakeLessor{}, nil, StoreConfig{})) defer cleanup(s, b, tmpPath) w := s.NewWatchStream() defer w.Close() filterPut := func(e mvccpb.Event) bool { return e.Type == mvccpb.PUT } w.Watch(0, []byte("foo"), nil, 0, filterPut) done := make(chan struct{}) go func() { <-w.Chan() done <- struct{}{} }() s.Put([]byte("foo"), []byte("bar"), 0) select { case <-done: t.Fatal("failed to filter put request") case <-time.After(100 * time.Millisecond): } s.DeleteRange([]byte("foo"), nil) select { case <-done: case <-time.After(100 * time.Millisecond): t.Fatal("failed to receive delete request") } }
explode_data.jsonl/39814
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 311 }
[ 2830, 3393, 47248, 14247, 2354, 5632, 1155, 353, 8840, 836, 8, 341, 2233, 11, 4174, 1820, 1669, 19163, 7121, 3675, 35986, 29699, 741, 1903, 1669, 10357, 480, 82707, 1755, 14247, 480, 6093, 13174, 391, 7121, 13314, 1507, 293, 11, 609, 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 TestCurrentBranchMain(t *testing.T) { testRepo := newTestRepo(t) defer testRepo.cleanup(t) require.Nil(t, testRepo.sut.Checkout(git.DefaultBranch)) branch, err := testRepo.sut.CurrentBranch() require.Nil(t, err) require.Equal(t, branch, git.DefaultBranch) }
explode_data.jsonl/14019
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 113 }
[ 2830, 3393, 5405, 18197, 6202, 1155, 353, 8840, 836, 8, 341, 18185, 25243, 1669, 501, 2271, 25243, 1155, 340, 16867, 1273, 25243, 87689, 1155, 340, 17957, 59678, 1155, 11, 1273, 25243, 514, 332, 10600, 411, 3268, 275, 13275, 18197, 4390, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestCalcX11Hash(t *testing.T) { //51b572209083576ea221c27e62b4e22063257571ccb6cc3dc3cd17eb67584eba b1 := []byte("") b1r := CalcX11Hash(b1) fmt.Println("b1r: ", hex.EncodeToString(b1r)) //534536a4e4f16b32447f02f77200449dc2f23b532e3d9878fe111c9de666bc5c b2 := []byte("The quick brown fox jumps over the lazy dog") b2r := CalcX11Hash(b2) fmt.Println("b2r: ", hex.EncodeToString(b2r)) //fe809ebca8753d907f6ad32cdcf8e5c4e090d7bece5df35b2147e10b88c12d26 b3 := []byte("DASH") b3r := CalcX11Hash(b3) fmt.Println("b3r: ", hex.EncodeToString(b3r)) //5c0996b9d49dbe84e29f1b818c1fa9e73549f894a71b8a258964b8f0ecf3c866 b4 := []byte("Take this kiss upon the brow! And, in parting from you now, Thus much let me avow-- You are not wrong, who deem That my days have been a dream; Yet if hope has flown away In a night, or in a day, In a vision, or in none, Is it therefore the less gone? All that we see or seem Is but a dream within a dream. I stand amid the roar Of a surf-tormented shore, And I hold within my hand Grains of the golden sand-- How few! yet how they creep Through my fingers to the deep, While I weep--while I weep! O God! can I not grasp Them with a tighter clasp? O God! can I not save One from the pitiless wave? Is all that we see or seem But a dream within a dream?") b4r := CalcX11Hash(b4) fmt.Println("b4r: ", hex.EncodeToString(b4r)) }
explode_data.jsonl/17109
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 563 }
[ 2830, 3393, 47168, 55, 16, 16, 6370, 1155, 353, 8840, 836, 8, 341, 197, 322, 20, 16, 65, 20, 22, 17, 17, 15, 24, 15, 23, 18, 20, 22, 21, 12508, 17, 17, 16, 66, 17, 22, 68, 21, 17, 65, 19, 68, 17, 17, 15, 21, 18, 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, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestBaseChunkSeries(t *testing.T) { type refdSeries struct { lset labels.Labels chunks []chunks.Meta ref uint64 } cases := []struct { series []refdSeries // Postings should be in the sorted order of the series postings []uint64 expIdxs []int }{ { series: []refdSeries{ { lset: labels.New([]labels.Label{{Name: "a", Value: "a"}}...), chunks: []chunks.Meta{ {Ref: 29}, {Ref: 45}, {Ref: 245}, {Ref: 123}, {Ref: 4232}, {Ref: 5344}, {Ref: 121}, }, ref: 12, }, { lset: labels.New([]labels.Label{{Name: "a", Value: "a"}, {Name: "b", Value: "b"}}...), chunks: []chunks.Meta{ {Ref: 82}, {Ref: 23}, {Ref: 234}, {Ref: 65}, {Ref: 26}, }, ref: 10, }, { lset: labels.New([]labels.Label{{Name: "b", Value: "c"}}...), chunks: []chunks.Meta{{Ref: 8282}}, ref: 1, }, { lset: labels.New([]labels.Label{{Name: "b", Value: "b"}}...), chunks: []chunks.Meta{ {Ref: 829}, {Ref: 239}, {Ref: 2349}, {Ref: 659}, {Ref: 269}, }, ref: 108, }, }, postings: []uint64{12, 13, 10, 108}, // 13 doesn't exist and should just be skipped over. expIdxs: []int{0, 1, 3}, }, { series: []refdSeries{ { lset: labels.New([]labels.Label{{Name: "a", Value: "a"}, {Name: "b", Value: "b"}}...), chunks: []chunks.Meta{ {Ref: 82}, {Ref: 23}, {Ref: 234}, {Ref: 65}, {Ref: 26}, }, ref: 10, }, { lset: labels.New([]labels.Label{{Name: "b", Value: "c"}}...), chunks: []chunks.Meta{{Ref: 8282}}, ref: 3, }, }, postings: []uint64{}, expIdxs: []int{}, }, } for _, tc := range cases { mi := newMockIndex() for _, s := range tc.series { testutil.Ok(t, mi.AddSeries(s.ref, s.lset, s.chunks...)) } bcs := &baseChunkSeries{ p: index.NewListPostings(tc.postings), index: mi, tombstones: tombstones.NewMemTombstones(), } i := 0 for bcs.Next() { lset, chks, _ := bcs.At() idx := tc.expIdxs[i] testutil.Equals(t, tc.series[idx].lset, lset) testutil.Equals(t, tc.series[idx].chunks, chks) i++ } testutil.Equals(t, len(tc.expIdxs), i) testutil.Ok(t, bcs.Err()) } }
explode_data.jsonl/50260
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1153 }
[ 2830, 3393, 3978, 28304, 25544, 1155, 353, 8840, 836, 8, 341, 13158, 2053, 67, 25544, 2036, 341, 197, 8810, 746, 256, 9201, 4679, 82, 198, 197, 23049, 15296, 3056, 84263, 58806, 271, 197, 59504, 2622, 21, 19, 198, 197, 630, 1444, 2264...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestWatchAccessList_Exists_ButRemoved(t *testing.T) { removed := make(chan string, 10) var fake *filewatcher.FakeWatcher newFileWatcher, fake = filewatcher.NewFakeWatcher(func(path string, _ bool) { removed <- path }) defer func() { newFileWatcher = filewatcher.NewWatcher readFile = ioutil.ReadFile watchEventHandledProbe = nil }() // No Pilot initial := ` allowed: - spiffe://cluster.local/ns/istio-system/sa/istio-mixer-service-account ` file, stopCh, checker, err := setupWatchAccessList(t, initial) defer close(stopCh) if err != nil { t.Fatalf("Unexpected error: %v", err) } if err = os.Remove(file); err != nil { t.Fatalf("Unexpected error deleting file: %v", err) } // fake the watch `Write` event and wait for the event to be handled and the accesslist updated. watchEventHandled := make(chan struct{}) watchEventHandledProbe = func() { close(watchEventHandled) } fake.InjectEvent(file, fsnotify.Event{ Name: file, Op: fsnotify.Remove, }) <-watchEventHandled // Check Pilot if !checker.Allowed("spiffe://cluster.local/ns/istio-system/sa/istio-pilot-service-account") { t.Fatal("Expected spiffe id to be allowed.") } }
explode_data.jsonl/78746
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 432 }
[ 2830, 3393, 14247, 6054, 852, 62, 15575, 1668, 332, 42642, 1155, 353, 8840, 836, 8, 341, 197, 45756, 1669, 1281, 35190, 914, 11, 220, 16, 15, 340, 2405, 12418, 353, 1192, 14321, 261, 991, 726, 47248, 198, 8638, 1703, 47248, 11, 12418,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestDecoderErrorStackOverflower(t *testing.T) { src := `{"a":[]}` N := _MaxStack for i:=0; i<N; i++ { var obj map[string]string err := NewDecoder(src).Decode(&obj) if err == nil { t.Fatal(err) } } }
explode_data.jsonl/6203
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 138 }
[ 2830, 3393, 20732, 1454, 4336, 1918, 38753, 1155, 353, 8840, 836, 8, 341, 262, 2286, 1669, 1565, 4913, 64, 788, 1294, 31257, 262, 451, 1669, 716, 5974, 4336, 198, 262, 369, 600, 14209, 15, 26, 600, 29198, 26, 600, 1027, 341, 286, 76...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestHandlers_GetMessageStamps(t *testing.T) { t.Parallel() path := "/api/v3/messages/{messageId}/stamps" env := Setup(t, common1) user := env.CreateUser(t, rand) ch := env.CreateChannel(t, rand) m := env.CreateMessage(t, user.GetID(), ch.ID, rand) stamp := env.CreateStamp(t, user.GetID(), rand) env.AddStampToMessage(t, m.GetID(), stamp.ID, user.GetID()) s := env.S(t, user.GetID()) var err error m, err = env.MM.Get(m.GetID()) require.NoError(t, err) require.Len(t, m.GetStamps(), 1) t.Run("not logged in", func(t *testing.T) { t.Parallel() e := env.R(t) e.GET(path, m.GetID()). Expect(). Status(http.StatusUnauthorized) }) t.Run("not found", func(t *testing.T) { t.Parallel() e := env.R(t) e.GET(path, uuid.Must(uuid.NewV4())). WithCookie(session.CookieName, s). Expect(). Status(http.StatusNotFound) }) t.Run("success", func(t *testing.T) { t.Parallel() e := env.R(t) obj := e.GET(path, m.GetID()). WithCookie(session.CookieName, s). Expect(). Status(http.StatusOK). JSON(). Array() obj.Length().Equal(1) first := obj.First().Object() messageStampEquals(t, m.GetStamps()[0], first) }) }
explode_data.jsonl/40155
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 537 }
[ 2830, 3393, 39949, 13614, 2052, 623, 14647, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 2822, 26781, 1669, 3521, 2068, 5457, 18, 71753, 9388, 1994, 764, 4472, 267, 14647, 698, 57538, 1669, 18626, 1155, 11, 4185, 16, 340, 19060, 166...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestOAuthComplete_AccessDenied(t *testing.T) { th := Setup().InitBasic() defer th.TearDown() c := &Context{ App: th.App, Params: &web.Params{ Service: "TestService", }, } responseWriter := httptest.NewRecorder() request, _ := http.NewRequest(http.MethodGet, th.App.GetSiteURL()+"/signup/TestService/complete?error=access_denied", nil) completeOAuth(c, responseWriter, request) response := responseWriter.Result() assert.Equal(t, http.StatusTemporaryRedirect, response.StatusCode) location, _ := url.Parse(response.Header.Get("Location")) assert.Equal(t, "oauth_access_denied", location.Query().Get("type")) assert.Equal(t, "TestService", location.Query().Get("service")) }
explode_data.jsonl/30136
{ "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, 57850, 12548, 1566, 1322, 54481, 1155, 353, 8840, 836, 8, 341, 70479, 1669, 18626, 1005, 3803, 15944, 741, 16867, 270, 836, 682, 4454, 2822, 1444, 1669, 609, 1972, 515, 197, 59557, 25, 270, 5105, 345, 197, 197, 4870, 25, 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 TestMuxMissingParams(t *testing.T) { r := NewRouter() r.Get(`/user/{userId:\d+}`, func(w http.ResponseWriter, r *http.Request) { userID := URLParam(r, "userId") w.Write([]byte(fmt.Sprintf("userId = '%s'", userID))) }) r.NotFound(func(w http.ResponseWriter, r *http.Request) { w.WriteHeader(404) w.Write([]byte("nothing here")) }) ts := httptest.NewServer(r) defer ts.Close() if _, body := testRequest(t, ts, "GET", "/user/123", nil); body != "userId = '123'" { t.Fatalf(body) } if _, body := testRequest(t, ts, "GET", "/user/", nil); body != "nothing here" { t.Fatalf(body) } }
explode_data.jsonl/42885
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 262 }
[ 2830, 3393, 44, 2200, 25080, 4870, 1155, 353, 8840, 836, 8, 341, 7000, 1669, 1532, 9523, 741, 7000, 2234, 31813, 872, 9388, 13508, 7190, 67, 10, 28350, 2915, 3622, 1758, 37508, 11, 435, 353, 1254, 9659, 8, 341, 197, 19060, 915, 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 TestAPIs(t *testing.T) { names := []string{ "any", "arrayofarray-1", "arrayofenum", "arrayofmapofobjects", "arrayofmapofstrings", "blogger-3", "getwithoutbody", "mapofany", "mapofarrayofobjects", "mapofobjects", "mapofstrings-1", "param-rename", "quotednum", "repeated", "resource-named-service", // appengine/v1/appengine-api.json "unfortunatedefaults", "variants", "wrapnewlines", } for _, name := range names { t.Logf("TEST %s", name) api, err := apiFromFile(filepath.Join("testdata", name+".json")) if err != nil { t.Errorf("Error loading API testdata/%s.json: %v", name, err) continue } clean, err := api.GenerateCode() if err != nil { t.Errorf("Error generating code for %s: %v", name, err) continue } goldenFile := filepath.Join("testdata", name+".want") if *updateGolden { if err := ioutil.WriteFile(goldenFile, clean, 0644); err != nil { t.Fatal(err) } } want, err := ioutil.ReadFile(goldenFile) if err != nil { t.Error(err) continue } if !bytes.Equal(want, clean) { tf, _ := ioutil.TempFile("", "api-"+name+"-got-json.") tf.Write(clean) tf.Close() t.Errorf("Output for API %s differs: diff -u %s %s", name, goldenFile, tf.Name()) } } }
explode_data.jsonl/77376
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 561 }
[ 2830, 3393, 7082, 82, 1155, 353, 8840, 836, 8, 341, 93940, 1669, 3056, 917, 515, 197, 197, 1, 3767, 756, 197, 197, 1, 1653, 1055, 1653, 12, 16, 756, 197, 197, 1, 1653, 1055, 9018, 756, 197, 197, 1, 1653, 1055, 2186, 1055, 19210, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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