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 TestORM(t *testing.T) { ctx := context.Background() client, err := ent.Open("sqlite3", "file:ent?mode=memory&cache=shared&_fk=1") if err != nil { log.Fatalf("failed opening connection to sqlite: %v", err) } defer client.Close() // Run the auto migration tool. if err := client.Schema.Create(ctx); err != nil { log.Fatalf("failed creating schema resources: %v", err) } // Create account u, err := CreateAccount(ctx, client) if err != nil { log.Println(err) } o, err := CreateOrganization(ctx, client, u) if err != nil { log.Println(err) } fmt.Println(u) fmt.Println(o) a, err := QueryAccount(ctx, client) if err != nil { log.Println("err querying accounts:", err) } log.Println("account", a) log.Println("orgs", a.Edges.Organization) }
explode_data.jsonl/4934
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 303 }
[ 2830, 3393, 4365, 1155, 353, 8840, 836, 8, 341, 20985, 1669, 2266, 19047, 741, 25291, 11, 1848, 1669, 1197, 12953, 445, 37042, 18, 497, 330, 1192, 25, 306, 30, 8516, 28, 17269, 5, 9360, 28, 6100, 85047, 41718, 28, 16, 1138, 743, 184...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestResultRing(t *testing.T) { // Test data. r1 := result{Reason: "r1"} r2 := result{Reason: "r2"} r3 := result{Reason: "r3"} rr := newResultRing(2) // Use the ring partially. rr.add(r1) if got, want := rr.latestValues(), []result{r1}; !reflect.DeepEqual(got, want) { t.Fatalf("items not correctly added to resultRing. got = %v, want = %v", got, want) } // Use it fully. rr.add(r2) if got, want := rr.latestValues(), []result{r2, r1}; !reflect.DeepEqual(got, want) { t.Fatalf("items not correctly added to resultRing. got = %v, want = %v", got, want) } // Let it wrap. rr.add(r3) if got, want := rr.latestValues(), []result{r3, r2}; !reflect.DeepEqual(got, want) { t.Fatalf("resultRing did not wrap correctly. got = %v, want = %v", got, want) } }
explode_data.jsonl/82594
{ "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, 2077, 43466, 1155, 353, 8840, 836, 8, 341, 197, 322, 3393, 821, 624, 7000, 16, 1669, 1102, 90, 25139, 25, 330, 81, 16, 16707, 7000, 17, 1669, 1102, 90, 25139, 25, 330, 81, 17, 16707, 7000, 18, 1669, 1102, 90, 25139, 25...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
4
func TestTransportConfig(t *testing.T) { createParser := func() func(string) (proto.Message, error) { return func(s string) (proto.Message, error) { config := new(TransportConfig) if err := json.Unmarshal([]byte(s), config); err != nil { return nil, err } return config.Build() } } runMultiTestCase(t, []TestCase{ { Input: `{ "tcpSettings": { "header": { "type": "http", "request": { "version": "1.1", "method": "GET", "path": "/b", "headers": { "a": "b", "c": "d" } }, "response": { "version": "1.0", "status": "404", "reason": "Not Found" } } }, "kcpSettings": { "mtu": 1200, "header": { "type": "none" } }, "wsSettings": { "path": "/t" }, "quicSettings": { "key": "abcd", "header": { "type": "dtls" } } }`, Parser: createParser(), Output: &transport.Config{ TransportSettings: []*internet.TransportConfig{ { ProtocolName: "tcp", Settings: serial.ToTypedMessage(&tcp.Config{ HeaderSettings: serial.ToTypedMessage(&http.Config{ Request: &http.RequestConfig{ Version: &http.Version{Value: "1.1"}, Method: &http.Method{Value: "GET"}, Uri: []string{"/b"}, Header: []*http.Header{ {Name: "a", Value: []string{"b"}}, {Name: "c", Value: []string{"d"}}, }, }, Response: &http.ResponseConfig{ Version: &http.Version{Value: "1.0"}, Status: &http.Status{Code: "404", Reason: "Not Found"}, Header: []*http.Header{ { Name: "Content-Type", Value: []string{"application/octet-stream", "video/mpeg"}, }, { Name: "Transfer-Encoding", Value: []string{"chunked"}, }, { Name: "Connection", Value: []string{"keep-alive"}, }, { Name: "Pragma", Value: []string{"no-cache"}, }, { Name: "Cache-Control", Value: []string{"private", "no-cache"}, }, }, }, }), }), }, { ProtocolName: "mkcp", Settings: serial.ToTypedMessage(&kcp.Config{ Mtu: &kcp.MTU{Value: 1200}, HeaderConfig: serial.ToTypedMessage(&noop.Config{}), }), }, { ProtocolName: "websocket", Settings: serial.ToTypedMessage(&websocket.Config{ Path: "/t", }), }, { ProtocolName: "quic", Settings: serial.ToTypedMessage(&quic.Config{ Key: "abcd", Security: &protocol.SecurityConfig{ Type: protocol.SecurityType_NONE, }, Header: serial.ToTypedMessage(&tls.PacketConfig{}), }), }, }, }, }, }) }
explode_data.jsonl/15414
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1625 }
[ 2830, 3393, 27560, 2648, 1155, 353, 8840, 836, 8, 341, 39263, 6570, 1669, 2915, 368, 2915, 3609, 8, 320, 15110, 8472, 11, 1465, 8, 341, 197, 853, 2915, 1141, 914, 8, 320, 15110, 8472, 11, 1465, 8, 341, 298, 25873, 1669, 501, 7, 27...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestValidateConfig(t *testing.T) { tests := []struct { name string config *models.Config wantErr bool }{ { name: "empty config", config: &models.Config{}, wantErr: false, }, { name: "claim requirement without claim", config: &models.Config{ ClaimPolicies: map[string][]models.ClaimRequirement{ "Test": {models.ClaimRequirement{}}, }, RoutePolicies: []models.RoutePolicy{}, }, wantErr: true, }, { name: "route policy without path", config: &models.Config{ ClaimPolicies: map[string][]models.ClaimRequirement{}, RoutePolicies: []models.RoutePolicy{ {AllowAnonymous: true}, }, }, wantErr: true, }, { name: "route policy both allow anon and policy named", config: &models.Config{ ClaimPolicies: map[string][]models.ClaimRequirement{ "TestPolicy": { models.ClaimRequirement{Claim: "test"}, }, }, RoutePolicies: []models.RoutePolicy{ { Path: "/", AllowAnonymous: true, PolicyName: "TestPolicy", }, }, }, wantErr: true, }, { name: "route policy allow anon false but policy not named", config: &models.Config{ ClaimPolicies: map[string][]models.ClaimRequirement{}, RoutePolicies: []models.RoutePolicy{ { Path: "/", AllowAnonymous: false, }, }, }, wantErr: false, }, { name: "route policy names non-existing claim policy", config: &models.Config{ ClaimPolicies: map[string][]models.ClaimRequirement{}, RoutePolicies: []models.RoutePolicy{ { Path: "/", PolicyName: "NonExistingClaimPolicy", }, }, }, wantErr: true, }, { name: "valid allow anon", config: &models.Config{ ClaimPolicies: map[string][]models.ClaimRequirement{}, RoutePolicies: []models.RoutePolicy{ { Path: "/", AllowAnonymous: true, }, }, }, wantErr: false, }, { name: "valid route with policy", config: &models.Config{ ClaimPolicies: map[string][]models.ClaimRequirement{ "TestPolicy": {models.ClaimRequirement{Claim: "test"}}, }, RoutePolicies: []models.RoutePolicy{ { Path: "/", PolicyName: "TestPolicy", }, }, }, wantErr: false, }, { name: "invalid url scheme", config: &models.Config{ Server: models.ServerConfig{ UpstreamURL: "tcp://not/a/valid/scheme", }, }, wantErr: true, }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { if tt.config.Server.UpstreamURL != "" { var err error tt.config.Server.ParsedURL, err = url.Parse(tt.config.Server.UpstreamURL) if err != nil { t.Errorf("could not parse url") return } } if err := ValidateConfig(tt.config); (err != nil) != tt.wantErr { t.Errorf("ValidateConfig() error = %v, wantErr %v", err, tt.wantErr) } }) } }
explode_data.jsonl/32532
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1387 }
[ 2830, 3393, 17926, 2648, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 3056, 1235, 341, 197, 11609, 262, 914, 198, 197, 25873, 220, 353, 6507, 10753, 198, 197, 50780, 7747, 1807, 198, 197, 59403, 197, 197, 515, 298, 11609, 25, 262, 330, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
4
func Test_Hoverfly_SetMiddleware_WillErrorIfGivenScriptAndNoBinaryAndWillNotChangeMiddleware(t *testing.T) { RegisterTestingT(t) unit := NewHoverflyWithConfiguration(&Configuration{}) unit.Cfg.Middleware.SetBinary("python") unit.Cfg.Middleware.SetScript("test-script") err := unit.SetMiddleware("", pythonMiddlewareBasic, "") Expect(err).ToNot(BeNil()) Expect(unit.Cfg.Middleware.Binary).To(Equal("python")) script, _ := unit.Cfg.Middleware.GetScript() Expect(script).To(Equal("test-script")) }
explode_data.jsonl/45388
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 179 }
[ 2830, 3393, 2039, 1975, 21642, 14812, 24684, 2763, 483, 1454, 2679, 22043, 5910, 3036, 2753, 21338, 3036, 9945, 2623, 4072, 24684, 1155, 353, 8840, 836, 8, 341, 79096, 16451, 51, 1155, 692, 81189, 1669, 1532, 34379, 21642, 2354, 7688, 209...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestCheckErr(t *testing.T) { testErrMsg := "this is an error message" shouldBe := fmt.Sprintln("Error:", testErrMsg) if os.Getenv("GO_WANT_HELPER_PROCESS") == "1" { checkErr(testErrMsg) } var outbuf, errbuf bytes.Buffer cs := []string{"-test.run=TestCheckErr", "--"} cmd := exec.Command(os.Args[0], cs...) cmd.Env = append(os.Environ(), "GO_WANT_HELPER_PROCESS=1") cmd.Stdout = &outbuf cmd.Stderr = &errbuf err := cmd.Run() if e, ok := err.(*exec.ExitError); ok && !e.Success() { v := errbuf.String() if v != shouldBe { t.Fatalf("For \"%s\" expected \"%s\" got \"%s\"", testErrMsg, shouldBe, v, ) } return } t.Fatalf("process ran with err %v, want exit status 1", err) }
explode_data.jsonl/31052
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 314 }
[ 2830, 3393, 3973, 7747, 1155, 353, 8840, 836, 8, 341, 18185, 75449, 1669, 330, 574, 374, 458, 1465, 1943, 698, 197, 77261, 1669, 8879, 808, 33655, 445, 1454, 12147, 1273, 75449, 692, 743, 2643, 64883, 445, 15513, 2763, 2821, 85331, 3619...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestLastDropsAllButLastNLinesOfInput(t *testing.T) { t.Parallel() input := "a\nb\nc\n" want := "b\nc\n" got, err := script.Echo(input).Last(2).String() if err != nil { t.Fatal(err) } if want != got { t.Error(cmp.Diff(want, got)) } }
explode_data.jsonl/51489
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 117 }
[ 2830, 3393, 5842, 35, 3702, 2403, 3983, 5842, 45, 16794, 2124, 2505, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 741, 22427, 1669, 330, 64, 1699, 65, 59, 1016, 1699, 698, 50780, 1669, 330, 65, 59, 1016, 1699, 698, 3174, 354, 11...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func Test_objectToWorkflowTemplate(t *testing.T) { t.Run("NotUnstructured", func(t *testing.T) { v, err := objectToWorkflowTemplate(&corev1.Status{}) assert.EqualError(t, err, "malformed workflow template: expected \"*unstructured.Unstructured\", got \"\"") assert.NotNil(t, v) }) t.Run("MalformedWorkflowTemplate", func(t *testing.T) { v, err := objectToWorkflowTemplate(&unstructured.Unstructured{Object: map[string]interface{}{ "metadata": map[string]interface{}{"namespace": "my-ns", "name": "my-name"}, "spec": "ops", }}) assert.EqualError(t, err, "malformed workflow template \"my-ns/my-name\": cannot restore struct from: string") if assert.NotNil(t, v) { assert.Equal(t, "my-ns", v.Namespace) assert.Equal(t, "my-name", v.Name) } }) t.Run("WorkflowTemplate", func(t *testing.T) { v, err := objectToWorkflowTemplate(&unstructured.Unstructured{}) assert.NoError(t, err) assert.Equal(t, &wfv1.WorkflowTemplate{}, v) }) }
explode_data.jsonl/31348
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 385 }
[ 2830, 3393, 5314, 1249, 62768, 7275, 1155, 353, 8840, 836, 8, 341, 3244, 16708, 445, 2623, 1806, 51143, 497, 2915, 1155, 353, 8840, 836, 8, 341, 197, 5195, 11, 1848, 1669, 1633, 1249, 62768, 7275, 2099, 98645, 16, 10538, 37790, 197, 6...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestNamedPtrIssue797(t *testing.T) { gopClTest(t, ` type Bar *int func foo(a Bar) { var b int = *a } `, `package main type Bar *int func foo(a Bar) { var b int = *a } `) }
explode_data.jsonl/73663
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 84 }
[ 2830, 3393, 15810, 5348, 42006, 22, 24, 22, 1155, 353, 8840, 836, 8, 341, 3174, 453, 5066, 2271, 1155, 11, 22074, 1313, 4716, 353, 396, 271, 2830, 15229, 2877, 4716, 8, 341, 2405, 293, 526, 284, 353, 64, 198, 532, 7808, 1565, 1722, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestLoad(t *testing.T) { cfg := &Config{Path: "./testdata/valid"} spec, err := cfg.Load() require.NoError(t, err) require.Len(t, spec.Schemas, 3) require.Equal(t, "github.com/facebookincubator/ent/entc/load/testdata/valid", spec.PkgPath) require.Equal(t, "Group", spec.Schemas[0].Name, "ordered alphabetically") require.Equal(t, "Tag", spec.Schemas[1].Name) require.Equal(t, "User", spec.Schemas[2].Name) require.Len(t, spec.Schemas[2].StructFields, 3) fields := spec.Schemas[2].StructFields require.Equal(t, &StructField{Tag: "json:\"tenant,omitempty\"", Name: "Tenant", Type: "string"}, fields[0]) require.Equal(t, &StructField{Name: "Logger", Type: "*log.Logger", PkgPath: "log", Comment: "Comment."}, fields[1]) require.Equal(t, &StructField{Name: "Mutex", Type: "sync.Mutex", PkgPath: "sync", Embedded: true}, fields[2]) }
explode_data.jsonl/6882
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 336 }
[ 2830, 3393, 5879, 1155, 353, 8840, 836, 8, 341, 50286, 1669, 609, 2648, 90, 1820, 25, 5924, 92425, 14, 1891, 16707, 98100, 11, 1848, 1669, 13286, 13969, 741, 17957, 35699, 1155, 11, 1848, 340, 17957, 65819, 1155, 11, 1398, 808, 31126, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestConsortiumName(t *testing.T) { cc := &ChannelConfig{protos: &ChannelProtos{Consortium: &cb.Consortium{Name: "TestConsortium"}}} assert.Equal(t, "TestConsortium", cc.ConsortiumName(), "Unexpected consortium name returned") }
explode_data.jsonl/30625
{ "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, 1109, 6860, 2356, 675, 1155, 353, 8840, 836, 8, 341, 63517, 1669, 609, 9629, 2648, 90, 4391, 436, 25, 609, 9629, 12423, 436, 90, 1109, 6860, 2356, 25, 609, 7221, 94594, 371, 2356, 63121, 25, 330, 2271, 1109, 6860, 2356, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestExportTraceDataOp(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: 22, err: nil}, {items: 14, err: errFake}, } for i := range params { ctx := obsrep.StartTracesOp(parentCtx) assert.NotNil(t, ctx) obsrep.EndTracesOp(ctx, params[i].items, params[i].err) } spans := tt.SpanRecorder.Ended() require.Equal(t, len(params), len(spans)) var sentSpans, failedToSendSpans int for i, span := range spans { assert.Equal(t, "exporter/"+exporter.String()+"/traces", span.Name()) switch params[i].err { case nil: sentSpans += params[i].items require.Contains(t, span.Attributes(), attribute.KeyValue{Key: obsmetrics.SentSpansKey, Value: attribute.Int64Value(int64(params[i].items))}) require.Contains(t, span.Attributes(), attribute.KeyValue{Key: obsmetrics.FailedToSendSpansKey, Value: attribute.Int64Value(0)}) assert.Equal(t, codes.Unset, span.Status().Code) case errFake: failedToSendSpans += params[i].items require.Contains(t, span.Attributes(), attribute.KeyValue{Key: obsmetrics.SentSpansKey, Value: attribute.Int64Value(0)}) require.Contains(t, span.Attributes(), attribute.KeyValue{Key: obsmetrics.FailedToSendSpansKey, 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.CheckExporterTraces(tt, exporter, int64(sentSpans), int64(failedToSendSpans))) }
explode_data.jsonl/57970
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 769 }
[ 2830, 3393, 16894, 6550, 1043, 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,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestHandleReceivedNewView(t *testing.T) { smr, err := MakeSmr(t) if err != nil { t.Error("TestHandleReceivedNewView MakeSmr error", err) return } netMsg, err := MakeNewViewMsg(t) if err != nil { t.Error("TestHandleReceivedNewView MakeNewViewMsg error", err) return } err = smr.handleReceivedNewView(netMsg) if err != nil { t.Error("TestHandleReceivedNewView handleReceivedNewView error", err) } }
explode_data.jsonl/33027
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 161 }
[ 2830, 3393, 6999, 23260, 3564, 851, 1155, 353, 8840, 836, 8, 341, 1903, 20946, 11, 1848, 1669, 7405, 10673, 81, 1155, 340, 743, 1848, 961, 2092, 341, 197, 3244, 6141, 445, 2271, 6999, 23260, 3564, 851, 7405, 10673, 81, 1465, 497, 1848...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestSliceSink_(t *testing.T) { t.Parallel() tests := []struct { name string pipe *script.Pipe want []string }{ { name: "returns three elements for three lines of input", pipe: script.Echo("testdata/multiple_files/1.txt\ntestdata/multiple_files/2.txt\ntestdata/multiple_files/3.tar.zip\n"), want: []string{ "testdata/multiple_files/1.txt", "testdata/multiple_files/2.txt", "testdata/multiple_files/3.tar.zip", }, }, { name: "returns an empty slice given empty input", pipe: script.Echo(""), want: []string{}, }, { name: "returns one empty string given input containing a single newline", pipe: script.Echo("\n"), want: []string{""}, }, { name: "returns an empty string for each empty input line", pipe: script.Echo("testdata/multiple_files/1.txt\n\ntestdata/multiple_files/3.tar.zip"), want: []string{ "testdata/multiple_files/1.txt", "", "testdata/multiple_files/3.tar.zip", }, }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { p := tt.pipe got, err := p.Slice() if err != nil { t.Fatal(err) } if !cmp.Equal(tt.want, got) { t.Error(cmp.Diff(tt.want, got)) } }) } }
explode_data.jsonl/51524
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 546 }
[ 2830, 3393, 33236, 45094, 8361, 83, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 741, 78216, 1669, 3056, 1235, 341, 197, 11609, 914, 198, 197, 197, 13768, 353, 2282, 1069, 3444, 198, 197, 50780, 3056, 917, 198, 197, 59403, 197, 197, 515...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestV6V4(t *testing.T) { testUseFirst(t, loopbackV4, loopbackV4, loopbackV6) testUseFirst(t, loopbackV6, loopbackV6, loopbackV4) }
explode_data.jsonl/3801
{ "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, 53, 21, 53, 19, 1155, 353, 8840, 836, 8, 341, 18185, 10253, 5338, 1155, 11, 6337, 1419, 53, 19, 11, 6337, 1419, 53, 19, 11, 6337, 1419, 53, 21, 340, 18185, 10253, 5338, 1155, 11, 6337, 1419, 53, 21, 11, 6337, 1419, 5...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
func TestGetSetProposal(t *testing.T) { mapp, keeper, _, _, _, _ := getMockApp(t, 0, GenesisState{}, nil) header := abci.Header{Height: mapp.LastBlockHeight() + 1} mapp.BeginBlock(abci.RequestBeginBlock{Header: header}) ctx := mapp.BaseApp.NewContext(false, abci.Header{}) tp := testProposal() proposal, err := keeper.SubmitProposal(ctx, tp) require.NoError(t, err) proposalID := proposal.GetProposalID() keeper.SetProposal(ctx, proposal) gotProposal, ok := keeper.GetProposal(ctx, proposalID) require.True(t, ok) require.True(t, ProposalEqual(proposal, gotProposal)) }
explode_data.jsonl/60864
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 218 }
[ 2830, 3393, 1949, 1649, 98637, 1155, 353, 8840, 836, 8, 341, 2109, 676, 11, 53416, 11, 8358, 8358, 8358, 716, 1669, 633, 11571, 2164, 1155, 11, 220, 15, 11, 40788, 1397, 22655, 2092, 692, 20883, 1669, 668, 5855, 15753, 90, 3640, 25, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestSnapshotDeleteRestore(t *testing.T) { t.Parallel() runner := testenv.NewInProcRunner(t) e := testenv.NewCLITest(t, testenv.RepoFormatNotImportant, runner) defer e.RunAndExpectSuccess(t, "repo", "disconnect") e.RunAndExpectSuccess(t, "repo", "create", "filesystem", "--path", e.RepoDir) source := filepath.Join(testutil.TempDirectory(t), "source") testdirtree.MustCreateDirectoryTree(t, source, testdirtree.DirectoryTreeOptions{ Depth: 1, MaxSubdirsPerDirectory: 10, MaxFilesPerDirectory: 10, }) // Create snapshot e.RunAndExpectSuccess(t, "snapshot", "create", source) // obtain snapshot root id and use it for restore si := clitestutil.ListSnapshotsAndExpectSuccess(t, e, source) if got, want := len(si), 1; got != want { t.Fatalf("got %v sources, wanted %v", got, want) } if got, want := len(si[0].Snapshots), 1; got != want { t.Fatalf("got %v snapshots, wanted %v", got, want) } snapID := si[0].Snapshots[0].SnapshotID rootID := si[0].Snapshots[0].ObjectID restoreDir := testutil.TempDirectory(t) e.RunAndExpectSuccess(t, "restore", rootID, restoreDir) // Note: restore does not reset the permissions for the top directory due to // the way the top FS entry is created in snapshotfs. Force the permissions // of the top directory to match those of the source so the recursive // directory comparison has a chance of succeeding. require.NoError(t, os.Chmod(restoreDir, 0o700)) compareDirs(t, source, restoreDir) // snapshot delete should succeed e.RunAndExpectSuccess(t, "snapshot", "delete", snapID, "--delete") notRestoreDir := testutil.TempDirectory(t) // Make sure the restore did not happen from the deleted snapshot e.RunAndExpectFailure(t, "snapshot", "restore", snapID, notRestoreDir) assertEmptyDir(t, notRestoreDir) // Subsequent snapshot delete to the same ID should fail e.RunAndExpectFailure(t, "snapshot", "delete", snapID, "--delete") // garbage-collect to clean up the root object. e.RunAndExpectSuccess(t, "snapshot", "gc", "--delete", "--safety=none") // Run a restore on the deleted snapshot's root ID. The root should be // marked as deleted but still recoverable restoreDir2 := testutil.TempDirectory(t) e.RunAndExpectSuccess(t, "restore", rootID, restoreDir2) require.NoError(t, os.Chmod(restoreDir2, 0o700)) compareDirs(t, source, restoreDir2) }
explode_data.jsonl/61159
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 818 }
[ 2830, 3393, 15009, 6435, 56284, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 2822, 197, 41736, 1669, 1273, 3160, 7121, 641, 24508, 19486, 1155, 340, 7727, 1669, 1273, 3160, 7121, 3140, 952, 477, 1155, 11, 1273, 3160, 2817, 5368, 406...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestGetProgressDeadlineSecondsOrDefault(t *testing.T) { seconds := int32(2) rolloutNonDefaultValue := &v1alpha1.Rollout{ Spec: v1alpha1.RolloutSpec{ ProgressDeadlineSeconds: &seconds, }, } assert.Equal(t, seconds, GetProgressDeadlineSecondsOrDefault(rolloutNonDefaultValue)) rolloutDefaultValue := &v1alpha1.Rollout{} assert.Equal(t, DefaultProgressDeadlineSeconds, GetProgressDeadlineSecondsOrDefault(rolloutDefaultValue)) }
explode_data.jsonl/15132
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 153 }
[ 2830, 3393, 1949, 9496, 83593, 15343, 14188, 1155, 353, 8840, 836, 8, 341, 197, 17403, 1669, 526, 18, 17, 7, 17, 340, 197, 1100, 411, 8121, 41533, 1669, 609, 85, 16, 7141, 16, 71212, 411, 515, 197, 7568, 992, 25, 348, 16, 7141, 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 TestIssue8518(t *testing.T) { fset := token.NewFileSet() imports := make(testImporter) conf := Config{ Error: func(err error) { t.Log(err) }, // don't exit after first error Importer: imports, } makePkg := func(path, src string) { f, err := parser.ParseFile(fset, path, src, 0) if err != nil { t.Fatal(err) } pkg, _ := conf.Check(path, fset, []*ast.File{f}, nil) // errors logged via conf.Error imports[path] = pkg } const libSrc = ` package a import "missing" const C1 = foo const C2 = missing.C ` const mainSrc = ` package main import "a" var _ = a.C1 var _ = a.C2 ` makePkg("a", libSrc) makePkg("main", mainSrc) // don't crash when type-checking this package }
explode_data.jsonl/55547
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 288 }
[ 2830, 3393, 42006, 23, 20, 16, 23, 1155, 353, 8840, 836, 8, 341, 1166, 746, 1669, 3950, 7121, 1703, 1649, 741, 21918, 82, 1669, 1281, 8623, 77289, 340, 67850, 1669, 5532, 515, 197, 58421, 25, 262, 2915, 3964, 1465, 8, 314, 259, 5247...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestMockInstFunc(t *testing.T) { tt := new(Mock) defer tt.Close() // mock tt.MockInstFunc("Dosomething", new(T)) //collaborator tt.On("Dosomething", &T{1}, 1).Return(2) //test Dosomething(1) //assert tt.AssertExpectations(t) }
explode_data.jsonl/16781
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 112 }
[ 2830, 3393, 11571, 8724, 9626, 1155, 353, 8840, 836, 8, 341, 3244, 83, 1669, 501, 66436, 340, 16867, 17853, 10421, 2822, 197, 322, 7860, 198, 3244, 83, 24664, 8724, 9626, 445, 84343, 11532, 497, 501, 4140, 4390, 197, 322, 17222, 4324, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestPrivilegedDevices(t *testing.T) { testPid := uint32(1234) c := newTestCRIService() testSandboxID := "sandbox-id" containerConfig, sandboxConfig, imageConfig, _ := getCreateContainerTestData() for desc, test := range map[string]struct { privileged bool privilegedWithoutHostDevices bool expectHostDevices bool }{ "expect no host devices when privileged is false": { privileged: false, privilegedWithoutHostDevices: false, expectHostDevices: false, }, "expect no host devices when privileged is false and privilegedWithoutHostDevices is true": { privileged: false, privilegedWithoutHostDevices: true, expectHostDevices: false, }, "expect host devices when privileged is true": { privileged: true, privilegedWithoutHostDevices: false, expectHostDevices: true, }, "expect no host devices when privileged is true and privilegedWithoutHostDevices is true": { privileged: true, privilegedWithoutHostDevices: true, expectHostDevices: false, }, } { t.Logf("TestCase %q", desc) containerConfig.Linux.SecurityContext.Privileged = test.privileged sandboxConfig.Linux.SecurityContext.Privileged = test.privileged ociRuntime := config.Runtime{ PrivilegedWithoutHostDevices: test.privilegedWithoutHostDevices, } spec, err := c.containerSpec(t.Name(), testSandboxID, testPid, "", containerConfig, sandboxConfig, imageConfig, nil, ociRuntime) assert.NoError(t, err) hostDevices, err := devices.HostDevices() assert.NoError(t, err) if test.expectHostDevices { assert.Len(t, spec.Linux.Devices, len(hostDevices)) } else { assert.Empty(t, spec.Linux.Devices) } } }
explode_data.jsonl/6421
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 721 }
[ 2830, 3393, 32124, 68431, 40835, 1155, 353, 8840, 836, 8, 341, 18185, 32339, 1669, 2622, 18, 17, 7, 16, 17, 18, 19, 340, 1444, 1669, 501, 2271, 8973, 95125, 741, 18185, 50, 31536, 915, 1669, 330, 76756, 12897, 698, 53290, 2648, 11, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestUntil1(t *testing.T) { t.Run("not found", test.Case(func(ctx context.Context) { src := must.Call(parse.NewSource, strings.NewReader("abcd"), 2)[0].(*parse.Source) must.Equal([]byte{'a', 'b', 'c', 'd'}, read.Until1( src, 'g')) must.NotNil(src.FatalError()) })) t.Run("found", test.Case(func(ctx context.Context) { src := must.Call(parse.NewSource, strings.NewReader("abcd"), 2)[0].(*parse.Source) must.Equal([]byte{'a', 'b', 'c'}, read.Until1( src, 'd')) must.Nil(src.FatalError()) })) }
explode_data.jsonl/1645
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 237 }
[ 2830, 3393, 24493, 16, 1155, 353, 8840, 836, 8, 341, 3244, 16708, 445, 1921, 1730, 497, 1273, 727, 519, 18552, 7502, 2266, 9328, 8, 341, 197, 41144, 1669, 1969, 27017, 27762, 7121, 3608, 345, 298, 11355, 819, 68587, 445, 68644, 3975, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestHandlerSetErrorsPercentage(t *testing.T) { var errorsPercentage int config := mockConfig{ doSetErrorsPercentage: func(value int) error { errorsPercentage = value return nil }, } response := doSetErrorsPercentageRequest(handlerForConfig(config), strings.NewReader("12")) checkStatusCode(t, response, http.StatusOK) checkBody(t, response, "OK\n") checkIntEqual(t, "errors percentage", errorsPercentage, 12) }
explode_data.jsonl/48340
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 144 }
[ 2830, 3393, 3050, 1649, 13877, 36167, 1155, 353, 8840, 836, 8, 341, 2405, 5975, 36167, 526, 271, 25873, 1669, 7860, 2648, 515, 197, 19935, 1649, 13877, 36167, 25, 2915, 3679, 526, 8, 1465, 341, 298, 73424, 36167, 284, 897, 198, 298, 8...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestCacheKey(t *testing.T) { k := CacheKey(1) require.Equal(t, uint64(0x4320000000000000), k) }
explode_data.jsonl/55317
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 44 }
[ 2830, 3393, 8233, 1592, 1155, 353, 8840, 836, 8, 341, 16463, 1669, 19479, 1592, 7, 16, 340, 17957, 12808, 1155, 11, 2622, 21, 19, 7, 15, 87, 19, 18, 17, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 701, 595, 340, 92 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
func TestValidate_ScalarLeafs_InterfaceTypeMissingSelection(t *testing.T) { testutil.ExpectFailsRule(t, graphql.ScalarLeafsRule, ` { human { pets } } `, []gqlerrors.FormattedError{ testutil.RuleError(`Field "pets" of type "[Pet]" must have a sub selection.`, 3, 17), }) }
explode_data.jsonl/37570
{ "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, 17926, 1098, 59153, 31461, 82, 74626, 929, 25080, 11177, 1155, 353, 8840, 836, 8, 341, 18185, 1314, 81893, 37, 6209, 11337, 1155, 11, 48865, 808, 59153, 31461, 82, 11337, 11, 22074, 414, 341, 286, 3738, 314, 25103, 456, 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 TestOptionBool(t *testing.T) { bz := NewOptionBool(NewBool(true)) assert.False(t, bz.IsNone()) assert.True(t, bz.IsSome()) ok, val := bz.Unwrap() assert.True(t, ok) assert.Equal(t, val, NewBool(true)) bz.SetNone() assert.True(t, bz.IsNone()) assert.False(t, bz.IsSome()) ok2, val2 := bz.Unwrap() assert.False(t, ok2) assert.Equal(t, val2, NewBool(false)) bz.SetSome(NewBool(false)) assert.False(t, bz.IsNone()) assert.True(t, bz.IsSome()) ok3, val3 := bz.Unwrap() assert.True(t, ok3) assert.Equal(t, val3, NewBool(false)) }
explode_data.jsonl/40251
{ "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, 5341, 11233, 1155, 353, 8840, 836, 8, 341, 2233, 89, 1669, 1532, 5341, 11233, 35063, 11233, 3715, 1171, 6948, 50757, 1155, 11, 80167, 4506, 4064, 2398, 6948, 32443, 1155, 11, 80167, 4506, 8373, 2398, 59268, 11, 1044, 1669, 8...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestGetURLParameters_ReturnsEmptyBagIfNoContextValueExists(t *testing.T) { r, _ := http.NewRequest(http.MethodGet, "/dummy", nil) bag := GetURLParameters(r) assertBagSetting(t, bag, 0) }
explode_data.jsonl/31725
{ "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, 1949, 3144, 9706, 53316, 82, 3522, 12933, 2679, 2753, 1972, 1130, 15575, 1155, 353, 8840, 836, 8, 341, 7000, 11, 716, 1669, 1758, 75274, 19886, 20798, 1949, 11, 3521, 31390, 497, 2092, 692, 2233, 351, 1669, 2126, 3144, 9706,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestSubtractStrSlicesExclusive(t *testing.T) { orig := []string{"a"} new := []string{"b"} res := subtractStrSlices(orig, new) require.Len(t, res, 1) require.Equal(t, "a", res[0]) }
explode_data.jsonl/66962
{ "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, 3136, 2144, 2580, 50, 37414, 70405, 1155, 353, 8840, 836, 8, 341, 197, 4670, 1669, 3056, 917, 4913, 64, 16707, 8638, 1669, 3056, 917, 4913, 65, 63159, 10202, 1669, 32256, 2580, 50, 37414, 54837, 11, 501, 340, 17957, 65819, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestGetScenarioAndCompNameFromProviderKey(t *testing.T) { type args struct { providerKey string } tests := []struct { name string args args wantScenario string wantCompName string wantInstanceName string haveErr bool }{ { name: "issue-manage.content", args: args{ providerKey: "component-protocol.components.issue-manage.content", }, wantScenario: "issue-manage", wantCompName: "content", wantInstanceName: "content", haveErr: false, }, { name: "issue-manage.content@content2", args: args{ providerKey: "component-protocol.components.issue-manage.content@content2", }, wantScenario: "issue-manage", wantCompName: "content", wantInstanceName: "content2", haveErr: false, }, { name: "missing compName", args: args{ providerKey: "component-protocol.components.issue-manage", }, wantScenario: "", wantCompName: "", wantInstanceName: "", haveErr: true, }, { name: "invalid prefix", args: args{ providerKey: "xxx.components.issue-manage", }, wantScenario: "", wantCompName: "", wantInstanceName: "", haveErr: true, }, { name: "valid default namespace key", args: args{ providerKey: componentProviderDefaultNamespacePrefix + "filter", }, wantScenario: "", wantCompName: "filter", wantInstanceName: "filter", haveErr: false, }, { name: "valid default namespace key with label", args: args{ providerKey: componentProviderDefaultNamespacePrefix + "filter@filter2", }, wantScenario: "", wantCompName: "filter", wantInstanceName: "filter2", haveErr: false, }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { gotScenario, gotCompName, gotInstanceName, gotErr := GetScenarioAndCompNameFromProviderKey(tt.args.providerKey) if gotScenario != tt.wantScenario { t.Errorf("MustGetScenarioAndCompNameFromProviderKey() gotScenario = %v, want %v", gotScenario, tt.wantScenario) } if gotCompName != tt.wantCompName { t.Errorf("MustGetScenarioAndCompNameFromProviderKey() gotCompName = %v, want %v", gotCompName, tt.wantCompName) } if gotInstanceName != tt.wantInstanceName { t.Errorf("MustGetScenarioAndInstanceNameFromProviderKey() gotInstanceName = %v, want %v", gotInstanceName, tt.wantInstanceName) } if (tt.haveErr && gotErr == nil) || (!tt.haveErr && gotErr != nil) { t.Errorf("MustGetScenarioAndCompNameFromProviderKey() getErr = %v, haveErr %v", gotErr, tt.haveErr) } }) } }
explode_data.jsonl/51580
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1184 }
[ 2830, 3393, 1949, 54031, 3036, 13552, 675, 3830, 5179, 1592, 1155, 353, 8840, 836, 8, 341, 13158, 2827, 2036, 341, 197, 197, 19979, 1592, 914, 198, 197, 532, 78216, 1669, 3056, 1235, 341, 197, 11609, 1797, 914, 198, 197, 31215, 1797, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestSQLite_DefaultsHCL(t *testing.T) { n := "atlas_defaults" liteRun(t, func(t *liteTest) { ddl := ` create table atlas_defaults ( string varchar(255) default "hello_world", quoted varchar(100) default 'never say "never"', d date default current_timestamp, n integer default 0x100 ) ` t.dropTables(n) _, err := t.db.Exec(ddl) require.NoError(t, err) realm := t.loadRealm() spec, err := sqlite.MarshalHCL(realm.Schemas[0]) require.NoError(t, err) var s schema.Schema err = sqlite.UnmarshalHCL(spec, &s) require.NoError(t, err) t.dropTables(n) t.applyHcl(string(spec)) ensureNoChange(t, realm.Schemas[0].Tables[0]) }) }
explode_data.jsonl/20091
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 294 }
[ 2830, 3393, 81772, 60336, 82, 39, 3140, 1155, 353, 8840, 836, 8, 341, 9038, 1669, 330, 266, 14493, 42290, 698, 8810, 632, 6727, 1155, 11, 2915, 1155, 353, 68078, 2271, 8, 341, 197, 197, 78372, 1669, 22074, 3182, 1965, 60932, 42290, 19...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestReconcileServiceInstanceWithUpdateCallFailure(t *testing.T) { fakeKubeClient, fakeCatalogClient, fakeClusterServiceBrokerClient, testController, sharedInformers := newTestController(t, fakeosb.FakeClientConfiguration{ UpdateInstanceReaction: &fakeosb.UpdateInstanceReaction{ Error: errors.New("fake update failure"), }, }) sharedInformers.ClusterServiceBrokers().Informer().GetStore().Add(getTestClusterServiceBroker()) sharedInformers.ClusterServiceClasses().Informer().GetStore().Add(getTestClusterServiceClass()) sharedInformers.ClusterServicePlans().Informer().GetStore().Add(getTestClusterServicePlan()) instance := getTestServiceInstanceUpdatingPlan() if err := reconcileServiceInstance(t, testController, instance); err != nil { t.Fatalf("unexpected error: %v", err) } instance = assertServiceInstanceUpdateInProgressIsTheOnlyCatalogClientAction(t, fakeCatalogClient, instance) fakeCatalogClient.ClearActions() fakeKubeClient.ClearActions() if err := reconcileServiceInstance(t, testController, instance); err == nil { t.Fatalf("Should not be able to make the ServiceInstance.") } brokerActions := fakeClusterServiceBrokerClient.Actions() assertNumberOfBrokerActions(t, brokerActions, 1) expectedPlanID := testClusterServicePlanGUID assertUpdateInstance(t, brokerActions[0], &osb.UpdateInstanceRequest{ AcceptsIncomplete: true, InstanceID: testServiceInstanceGUID, ServiceID: testClusterServiceClassGUID, PlanID: &expectedPlanID, Context: testContext}) // verify no kube resources created // One single action comes from getting namespace uid kubeActions := fakeKubeClient.Actions() if err := checkKubeClientActions(kubeActions, []kubeClientAction{ {verb: "get", resourceName: "namespaces", checkType: checkGetActionType}, }); err != nil { t.Fatal(err) } actions := fakeCatalogClient.Actions() assertNumberOfActions(t, actions, 1) updatedServiceInstance := assertUpdateStatus(t, actions[0], instance) assertServiceInstanceRequestRetriableError(t, updatedServiceInstance, v1beta1.ServiceInstanceOperationUpdate, errorErrorCallingUpdateInstanceReason, testClusterServicePlanName, testClusterServicePlanGUID, instance) events := getRecordedEvents(testController) expectedEvent := warningEventBuilder(errorErrorCallingUpdateInstanceReason).msg("The update call failed and will be retried:").msg("Error communicating with broker for updating:").msg("fake update failure") if err := checkEvents(events, expectedEvent.stringArr()); err != nil { t.Fatal(err) } }
explode_data.jsonl/58191
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 776 }
[ 2830, 3393, 693, 40446, 457, 1860, 2523, 2354, 4289, 7220, 17507, 1155, 353, 8840, 836, 8, 341, 1166, 726, 42, 3760, 2959, 11, 12418, 41606, 2959, 11, 12418, 28678, 1860, 65545, 2959, 11, 1273, 2051, 11, 6094, 37891, 388, 1669, 501, 2...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
5
func TestSelectMetrics(t *testing.T) { duration, _ := time.ParseDuration("1m") internalDuration := config.Duration(duration) c := &CloudWatch{ Region: "us-east-1", Namespace: "AWS/ELB", Delay: internalDuration, Period: internalDuration, RateLimit: 200, Metrics: []*Metric{ { MetricNames: []string{"Latency", "RequestCount"}, Dimensions: []*Dimension{ { Name: "LoadBalancerName", Value: "*", }, { Name: "AvailabilityZone", Value: "*", }, }, }, }, } c.client = &mockSelectMetricsCloudWatchClient{} filtered, err := getFilteredMetrics(c) // We've asked for 2 (out of 4) metrics, over all 3 load balancers in all 2 // AZs. We should get 12 metrics. assert.Equal(t, 12, len(filtered[0].metrics)) assert.NoError(t, err) }
explode_data.jsonl/56717
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 358 }
[ 2830, 3393, 3379, 27328, 1155, 353, 8840, 836, 8, 341, 89300, 11, 716, 1669, 882, 8937, 12945, 445, 16, 76, 1138, 33343, 12945, 1669, 2193, 33795, 48148, 340, 1444, 1669, 609, 16055, 14247, 515, 197, 197, 14091, 25, 262, 330, 355, 395...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestBalancerUnderServerShutdownWatch(t *testing.T) { defer testutil.AfterTest(t) clus := integration.NewClusterV3(t, &integration.ClusterConfig{ Size: 3, SkipCreatingClient: true, }) defer clus.Terminate(t) eps := []string{clus.Members[0].GRPCAddr(), clus.Members[1].GRPCAddr(), clus.Members[2].GRPCAddr()} lead := clus.WaitLeader(t) // pin eps[lead] watchCli, err := clientv3.New(clientv3.Config{Endpoints: []string{eps[lead]}}) if err != nil { t.Fatal(err) } defer watchCli.Close() // wait for eps[lead] to be pinned mustWaitPinReady(t, watchCli) // add all eps to list, so that when the original pined one fails // the client can switch to other available eps watchCli.SetEndpoints(eps...) key, val := "foo", "bar" wch := watchCli.Watch(context.Background(), key, clientv3.WithCreatedNotify()) select { case <-wch: case <-time.After(integration.RequestWaitTimeout): t.Fatal("took too long to create watch") } donec := make(chan struct{}) go func() { defer close(donec) // switch to others when eps[lead] is shut down select { case ev := <-wch: if werr := ev.Err(); werr != nil { t.Fatal(werr) } if len(ev.Events) != 1 { t.Fatalf("expected one event, got %+v", ev) } if !bytes.Equal(ev.Events[0].Kv.Value, []byte(val)) { t.Fatalf("expected %q, got %+v", val, ev.Events[0].Kv) } case <-time.After(7 * time.Second): t.Fatal("took too long to receive events") } }() // shut down eps[lead] clus.Members[lead].Terminate(t) // writes to eps[lead+1] putCli, err := clientv3.New(clientv3.Config{Endpoints: []string{eps[(lead+1)%3]}}) if err != nil { t.Fatal(err) } defer putCli.Close() for { ctx, cancel := context.WithTimeout(context.Background(), 2*time.Second) _, err = putCli.Put(ctx, key, val) cancel() if err == nil { break } if isClientTimeout(err) || isServerCtxTimeout(err) || err == rpctypes.ErrTimeout || err == rpctypes.ErrTimeoutDueToLeaderFail { continue } t.Fatal(err) } select { case <-donec: case <-time.After(5 * time.Second): // enough time for balancer switch t.Fatal("took too long to receive events") } }
explode_data.jsonl/29446
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 903 }
[ 2830, 3393, 93825, 16250, 5475, 62004, 14247, 1155, 353, 8840, 836, 8, 341, 16867, 1273, 1314, 36892, 2271, 1155, 692, 197, 4163, 1669, 17590, 7121, 28678, 53, 18, 1155, 11, 609, 60168, 72883, 2648, 515, 197, 91224, 25, 2290, 220, 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...
6
func TestGetDeviceSubscriptions(t *testing.T) { common.SetUpMockConfig() defer func() { err := common.TruncateDB(common.OnDisk) if err != nil { t.Fatalf("error: %v", err) } }() var devSubscription = DeviceSubscription{ EventHostIP: "10.10.0.1", Location: "https://10.10.10.23/redfish/v1/EventService/Subscriptions/123", OriginResources: []string{"/redfish/v1/Systems/uuid.1"}, } if cerr := SaveDeviceSubscription(devSubscription); cerr != nil { t.Errorf("Error while saving device suscription: %v\n", cerr.Error()) } devSub, err := GetDeviceSubscriptions(devSubscription.EventHostIP) if err != nil { t.Errorf("Error while getting device suscription: %v\n", err.Error()) } assert.Equal(t, devSubscription.EventHostIP, devSub.EventHostIP, "event host ip should be 10.10.0.1") assert.Equal(t, devSubscription.Location, devSub.Location, "Location should be https://10.10.10.23/redfish/v1/EventService/Subscriptions/123") if !reflect.DeepEqual(devSubscription.OriginResources, devSub.OriginResources) { t.Errorf("Origin Resource are not same") } }
explode_data.jsonl/49411
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 410 }
[ 2830, 3393, 1949, 6985, 3136, 29966, 1155, 353, 8840, 836, 8, 341, 83825, 4202, 2324, 11571, 2648, 741, 16867, 2915, 368, 341, 197, 9859, 1669, 4185, 8240, 26900, 3506, 57802, 8071, 47583, 340, 197, 743, 1848, 961, 2092, 341, 298, 3244,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestCallbackProvideCorrectContext(t *testing.T) { t.Parallel() // greet is a generate callback handler that is not associated with a // particular context -- it uses the provided context to create a value // to return, even when used from different isolates. greet := func(in CallbackArgs) (*Value, error) { return in.Context.Create("Hello " + in.Arg(0).String()) } ctx1, ctx2 := NewIsolate().NewContext(), NewIsolate().NewContext() ctx1.Global().Set("greet", ctx1.Bind("greet", greet)) ctx2.Global().Set("greet", ctx2.Bind("greet", greet)) alice, err1 := ctx1.Eval("greet('Alice')", "ctx1.js") if err1 != nil { t.Errorf("Context 1 failed: %v", err1) } else if str := alice.String(); str != "Hello Alice" { t.Errorf("Bad result: %q", str) } bob, err2 := ctx2.Eval("greet('Bob')", "ctx2.js") if err2 != nil { t.Errorf("Context 2 failed: %v", err2) } else if str := bob.String(); str != "Hello Bob" { t.Errorf("Bad result: %q", str) } }
explode_data.jsonl/81584
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 360 }
[ 2830, 3393, 7494, 60424, 33092, 1972, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 2822, 197, 322, 40786, 374, 264, 6923, 4822, 7013, 429, 374, 537, 5815, 448, 264, 198, 197, 322, 3953, 2266, 1177, 432, 5711, 279, 3897, 2266, 311,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestProxyNeedsPush(t *testing.T) { const ( invalidKind = "INVALID_KIND" svcName = "svc1.com" drName = "dr1" vsName = "vs1" scName = "sc1" nsName = "ns1" nsRoot = "rootns" generalName = "name1" invalidNameSuffix = "invalid" ) type Case struct { name string proxy *model.Proxy configs map[model.ConfigKey]struct{} want bool } sidecar := &model.Proxy{ Type: model.SidecarProxy, IPAddresses: []string{"127.0.0.1"}, Metadata: &model.NodeMetadata{}, SidecarScope: &model.SidecarScope{Name: generalName, Namespace: nsName, RootNamespace: nsRoot}} gateway := &model.Proxy{Type: model.Router} sidecarScopeKindNames := map[config.GroupVersionKind]string{ gvk.ServiceEntry: svcName, gvk.VirtualService: vsName, gvk.DestinationRule: drName} for kind, name := range sidecarScopeKindNames { sidecar.SidecarScope.AddConfigDependencies(model.ConfigKey{Kind: kind, Name: name, Namespace: nsName}) } for kind, types := range configKindAffectedProxyTypes { for _, nodeType := range types { if nodeType == model.SidecarProxy { sidecar.SidecarScope.AddConfigDependencies(model.ConfigKey{ Kind: kind, Name: generalName, Namespace: nsName, }) } } } cases := []Case{ {"no namespace or configs", sidecar, nil, true}, {"gateway config for sidecar", sidecar, map[model.ConfigKey]struct{}{ { Kind: gvk.Gateway, Name: generalName, Namespace: nsName}: {}}, false}, {"gateway config for gateway", gateway, map[model.ConfigKey]struct{}{ { Kind: gvk.Gateway, Name: generalName, Namespace: nsName}: {}}, true}, {"sidecar config for gateway", gateway, map[model.ConfigKey]struct{}{ { Kind: gvk.Sidecar, Name: scName, Namespace: nsName}: {}}, false}, {"invalid config for sidecar", sidecar, map[model.ConfigKey]struct{}{ { Kind: config.GroupVersionKind{Kind: invalidKind}, Name: generalName, Namespace: nsName}: {}}, true}, {"mixture matched and unmatched config for sidecar", sidecar, map[model.ConfigKey]struct{}{ {Kind: gvk.DestinationRule, Name: drName, Namespace: nsName}: {}, {Kind: gvk.ServiceEntry, Name: svcName + invalidNameSuffix, Namespace: nsName}: {}, }, true}, {"mixture unmatched and unmatched config for sidecar", sidecar, map[model.ConfigKey]struct{}{ {Kind: gvk.DestinationRule, Name: drName + invalidNameSuffix, Namespace: nsName}: {}, {Kind: gvk.ServiceEntry, Name: svcName + invalidNameSuffix, Namespace: nsName}: {}, }, false}, {"empty configsUpdated for sidecar", sidecar, nil, true}, } for kind, name := range sidecarScopeKindNames { cases = append(cases, Case{ // valid name name: fmt.Sprintf("%s config for sidecar", kind.Kind), proxy: sidecar, configs: map[model.ConfigKey]struct{}{{Kind: kind, Name: name, Namespace: nsName}: {}}, want: true, }, Case{ // invalid name name: fmt.Sprintf("%s unmatched config for sidecar", kind.Kind), proxy: sidecar, configs: map[model.ConfigKey]struct{}{{Kind: kind, Name: name + invalidNameSuffix, Namespace: nsName}: {}}, want: false, }) } sidecarNamespaceScopeTypes := []config.GroupVersionKind{ gvk.Sidecar, gvk.EnvoyFilter, gvk.AuthorizationPolicy, gvk.RequestAuthentication, } for _, kind := range sidecarNamespaceScopeTypes { cases = append(cases, Case{ name: fmt.Sprintf("%s config for sidecar in same namespace", kind.Kind), proxy: sidecar, configs: map[model.ConfigKey]struct{}{{Kind: kind, Name: generalName, Namespace: nsName}: {}}, want: true, }, Case{ name: fmt.Sprintf("%s config for sidecar in different namespace", kind.Kind), proxy: sidecar, configs: map[model.ConfigKey]struct{}{{Kind: kind, Name: generalName, Namespace: "invalid-namespace"}: {}}, want: false, }, ) } // tests for kind-affect-proxy. for kind, types := range configKindAffectedProxyTypes { for _, nodeType := range types { proxy := gateway if nodeType == model.SidecarProxy { proxy = sidecar } cases = append(cases, Case{ name: fmt.Sprintf("kind %s affect %s", kind, nodeType), proxy: proxy, configs: map[model.ConfigKey]struct{}{ {Kind: kind, Name: generalName + invalidNameSuffix, Namespace: nsName}: {}}, want: true, }) } } for _, tt := range cases { t.Run(tt.name, func(t *testing.T) { pushEv := &Event{pushRequest: &model.PushRequest{ConfigsUpdated: tt.configs}} got := ProxyNeedsPush(tt.proxy, pushEv) if got != tt.want { t.Fatalf("Got needs push = %v, expected %v", got, tt.want) } }) } }
explode_data.jsonl/9262
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1867 }
[ 2830, 3393, 16219, 65064, 16644, 1155, 353, 8840, 836, 8, 341, 4777, 2399, 197, 197, 11808, 10629, 284, 330, 46859, 72959, 698, 197, 1903, 7362, 675, 257, 284, 330, 58094, 16, 905, 698, 197, 2698, 81, 675, 414, 284, 330, 3612, 16, 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 TestMergeJoinerRandomized(t *testing.T) { ctx := context.Background() for _, numInputBatches := range []int{1, 2, 16, 256} { for _, maxRunLength := range []int64{2, 3, 100} { for _, skipValues := range []bool{false, true} { for _, randomIncrement := range []int64{0, 1} { t.Run(fmt.Sprintf("numInputBatches=%dmaxRunLength=%dskipValues=%trandomIncrement=%d", numInputBatches, maxRunLength, skipValues, randomIncrement), func(t *testing.T) { nTuples := coldata.BatchSize * numInputBatches typs := []types.T{types.Int64} lCols, rCols, exp := newBatchesOfRandIntRows(nTuples, typs, maxRunLength, skipValues, randomIncrement) leftSource := newChunkingBatchSource(typs, lCols, uint64(nTuples)) rightSource := newChunkingBatchSource(typs, rCols, uint64(nTuples)) a, err := NewMergeJoinOp( sqlbase.InnerJoin, leftSource, rightSource, []uint32{0}, []uint32{0}, typs, typs, []distsqlpb.Ordering_Column{{ColIdx: 0, Direction: distsqlpb.Ordering_Column_ASC}}, []distsqlpb.Ordering_Column{{ColIdx: 0, Direction: distsqlpb.Ordering_Column_ASC}}, ) if err != nil { t.Fatal("Error in merge join op constructor", err) } a.(*mergeJoinOp).Init() i := 0 count := 0 cpIdx := 0 for b := a.Next(ctx); b.Length() != 0; b = a.Next(ctx) { count += int(b.Length()) outCol := b.ColVec(0).Int64() for j := 0; j < int(b.Length()); j++ { outVal := outCol[j] if exp[cpIdx].cardinality == 0 { cpIdx++ } expVal := exp[cpIdx].val exp[cpIdx].cardinality-- if expVal != outVal { t.Fatalf("Found val %d, expected %d, idx %d of batch %d", outVal, expVal, j, i) } } i++ } }) } } } } }
explode_data.jsonl/16871
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 974 }
[ 2830, 3393, 52096, 12292, 261, 13999, 1506, 1155, 353, 8840, 836, 8, 341, 20985, 1669, 2266, 19047, 741, 2023, 8358, 1629, 2505, 33, 9118, 1669, 2088, 3056, 396, 90, 16, 11, 220, 17, 11, 220, 16, 21, 11, 220, 17, 20, 21, 92, 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...
6
func TestIsFileExcluded(t *testing.T) { cases := []struct { note string file string pattern []string exp bool }{ { note: "exact", file: "data.json", pattern: []string{"data.json"}, exp: true, }, { note: "hidden", file: ".manifest", pattern: []string{".*"}, exp: true, }, { note: "no_match", file: "data.json", pattern: []string{".*"}, exp: false, }, { note: "dir_match", file: "/a/b/data.json", pattern: []string{"/a/b/*"}, exp: true, }, { note: "dir_no_match", file: "/a/b/c/data.json", pattern: []string{"/a/b/*"}, exp: false, }, } for _, tc := range cases { t.Run(tc.note, func(t *testing.T) { buf := archive.MustWriteTarGz([][2]string{}) vc := NewVerificationConfig(map[string]*KeyConfig{}, "", "", tc.pattern) reader := NewReader(buf).WithBundleVerificationConfig(vc) actual := reader.isFileExcluded(tc.file) if actual != tc.exp { t.Fatalf("Expected file exclude result for %v %v but got %v", tc.file, tc.exp, actual) } }) } }
explode_data.jsonl/55374
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 548 }
[ 2830, 3393, 3872, 1703, 840, 10181, 1155, 353, 8840, 836, 8, 341, 1444, 2264, 1669, 3056, 1235, 341, 197, 9038, 1272, 262, 914, 198, 197, 17661, 262, 914, 198, 197, 3223, 3227, 3056, 917, 198, 197, 48558, 257, 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 TestMedTieBreaker(t *testing.T) { nlri := bgp.NewIPAddrPrefix(24, "10.10.0.0") p0 := func() *Path { aspath := bgp.NewPathAttributeAsPath([]bgp.AsPathParamInterface{bgp.NewAs4PathParam(bgp.BGP_ASPATH_ATTR_TYPE_SEQ, []uint32{65001, 65002}), bgp.NewAs4PathParam(bgp.BGP_ASPATH_ATTR_TYPE_SEQ, []uint32{65003, 65004})}) attrs := []bgp.PathAttributeInterface{aspath, bgp.NewPathAttributeMultiExitDisc(0)} return NewPath(nil, nlri, false, attrs, time.Now(), false) }() p1 := func() *Path { aspath := bgp.NewPathAttributeAsPath([]bgp.AsPathParamInterface{bgp.NewAs4PathParam(bgp.BGP_ASPATH_ATTR_TYPE_SEQ, []uint32{65001, 65002}), bgp.NewAs4PathParam(bgp.BGP_ASPATH_ATTR_TYPE_SEQ, []uint32{65003, 65005})}) attrs := []bgp.PathAttributeInterface{aspath, bgp.NewPathAttributeMultiExitDisc(10)} return NewPath(nil, nlri, false, attrs, time.Now(), false) }() // same AS assert.Equal(t, compareByMED(p0, p1), p0) p2 := func() *Path { aspath := bgp.NewPathAttributeAsPath([]bgp.AsPathParamInterface{bgp.NewAs4PathParam(bgp.BGP_ASPATH_ATTR_TYPE_SEQ, []uint32{65003})}) attrs := []bgp.PathAttributeInterface{aspath, bgp.NewPathAttributeMultiExitDisc(10)} return NewPath(nil, nlri, false, attrs, time.Now(), false) }() // different AS assert.Equal(t, compareByMED(p0, p2), (*Path)(nil)) p3 := func() *Path { aspath := bgp.NewPathAttributeAsPath([]bgp.AsPathParamInterface{bgp.NewAs4PathParam(bgp.BGP_ASPATH_ATTR_TYPE_CONFED_SEQ, []uint32{65003, 65004}), bgp.NewAs4PathParam(bgp.BGP_ASPATH_ATTR_TYPE_SEQ, []uint32{65001, 65003})}) attrs := []bgp.PathAttributeInterface{aspath, bgp.NewPathAttributeMultiExitDisc(0)} return NewPath(nil, nlri, false, attrs, time.Now(), false) }() p4 := func() *Path { aspath := bgp.NewPathAttributeAsPath([]bgp.AsPathParamInterface{bgp.NewAs4PathParam(bgp.BGP_ASPATH_ATTR_TYPE_SEQ, []uint32{65001, 65002}), bgp.NewAs4PathParam(bgp.BGP_ASPATH_ATTR_TYPE_CONFED_SEQ, []uint32{65005, 65006})}) attrs := []bgp.PathAttributeInterface{aspath, bgp.NewPathAttributeMultiExitDisc(10)} return NewPath(nil, nlri, false, attrs, time.Now(), false) }() // ignore confed assert.Equal(t, compareByMED(p3, p4), p3) p5 := func() *Path { attrs := []bgp.PathAttributeInterface{bgp.NewPathAttributeMultiExitDisc(0)} return NewPath(nil, nlri, false, attrs, time.Now(), false) }() p6 := func() *Path { attrs := []bgp.PathAttributeInterface{bgp.NewPathAttributeMultiExitDisc(10)} return NewPath(nil, nlri, false, attrs, time.Now(), false) }() // no aspath assert.Equal(t, compareByMED(p5, p6), p5) }
explode_data.jsonl/14521
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1084 }
[ 2830, 3393, 13310, 51, 645, 22524, 261, 1155, 353, 8840, 836, 8, 341, 9038, 75, 461, 1669, 8951, 79, 7121, 3298, 13986, 14335, 7, 17, 19, 11, 330, 16, 15, 13, 16, 15, 13, 15, 13, 15, 5130, 3223, 15, 1669, 2915, 368, 353, 1820, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestGetNextTaskWithRetries(t *testing.T) { var taskCancelledByStatusState = PipelineRunState{{ PipelineTask: &pts[4], // 2 retries needed TaskRunName: "pipelinerun-mytask1", TaskRun: withCancelled(makeRetried(trs[0])), ResolvedTaskResources: &resources.ResolvedTaskResources{ TaskSpec: &task.Spec, }, }} var taskCancelledBySpecState = PipelineRunState{{ PipelineTask: &pts[4], TaskRunName: "pipelinerun-mytask1", TaskRun: withCancelledBySpec(makeRetried(trs[0])), ResolvedTaskResources: &resources.ResolvedTaskResources{ TaskSpec: &task.Spec, }, }} var taskRunningState = PipelineRunState{{ PipelineTask: &pts[4], TaskRunName: "pipelinerun-mytask1", TaskRun: makeStarted(trs[0]), ResolvedTaskResources: &resources.ResolvedTaskResources{ TaskSpec: &task.Spec, }, }} var taskSucceededState = PipelineRunState{{ PipelineTask: &pts[4], TaskRunName: "pipelinerun-mytask1", TaskRun: makeSucceeded(trs[0]), ResolvedTaskResources: &resources.ResolvedTaskResources{ TaskSpec: &task.Spec, }, }} var taskRetriedState = PipelineRunState{{ PipelineTask: &pts[3], // 1 retry needed TaskRunName: "pipelinerun-mytask1", TaskRun: withCancelled(makeRetried(trs[0])), ResolvedTaskResources: &resources.ResolvedTaskResources{ TaskSpec: &task.Spec, }, }} var taskExpectedState = PipelineRunState{{ PipelineTask: &pts[4], // 2 retries needed TaskRunName: "pipelinerun-mytask1", TaskRun: withRetries(makeFailed(trs[0])), ResolvedTaskResources: &resources.ResolvedTaskResources{ TaskSpec: &task.Spec, }, }} var runCancelledByStatusState = PipelineRunState{{ PipelineTask: &pts[4], // 2 retries needed RunName: "pipelinerun-mytask1", Run: withRunCancelled(withRunRetries(newRun(runs[0]))), CustomTask: true, ResolvedTaskResources: &resources.ResolvedTaskResources{ TaskSpec: &task.Spec, }, }} var runCancelledBySpecState = PipelineRunState{{ PipelineTask: &pts[4], RunName: "pipelinerun-mytask1", Run: withRunCancelledBySpec(withRunRetries(newRun(runs[0]))), CustomTask: true, ResolvedTaskResources: &resources.ResolvedTaskResources{ TaskSpec: &task.Spec, }, }} var runRunningState = PipelineRunState{{ PipelineTask: &pts[4], RunName: "pipelinerun-mytask1", Run: makeRunStarted(runs[0]), CustomTask: true, ResolvedTaskResources: &resources.ResolvedTaskResources{ TaskSpec: &task.Spec, }, }} var runSucceededState = PipelineRunState{{ PipelineTask: &pts[4], RunName: "pipelinerun-mytask1", Run: makeRunSucceeded(runs[0]), CustomTask: true, ResolvedTaskResources: &resources.ResolvedTaskResources{ TaskSpec: &task.Spec, }, }} var runRetriedState = PipelineRunState{{ PipelineTask: &pts[3], // 1 retry needed RunName: "pipelinerun-mytask1", Run: withRunCancelled(withRunRetries(newRun(runs[0]))), CustomTask: true, ResolvedTaskResources: &resources.ResolvedTaskResources{ TaskSpec: &task.Spec, }, }} var runExpectedState = PipelineRunState{{ PipelineTask: &pts[4], // 2 retries needed RunName: "pipelinerun-mytask1", Run: withRunRetries(makeRunFailed(runs[0])), CustomTask: true, ResolvedTaskResources: &resources.ResolvedTaskResources{ TaskSpec: &task.Spec, }, }} tcs := []struct { name string state PipelineRunState candidates sets.String expectedNext []*ResolvedPipelineRunTask }{{ name: "tasks-cancelled-no-candidates", state: taskCancelledByStatusState, candidates: sets.NewString("mytask5"), expectedNext: []*ResolvedPipelineRunTask{}, }, { name: "tasks-cancelled-bySpec-no-candidates", state: taskCancelledBySpecState, candidates: sets.NewString("mytask5"), expectedNext: []*ResolvedPipelineRunTask{}, }, { name: "tasks-running-no-candidates", state: taskRunningState, candidates: sets.NewString("mytask5"), expectedNext: []*ResolvedPipelineRunTask{}, }, { name: "tasks-succeeded-bySpec-no-candidates", state: taskSucceededState, candidates: sets.NewString("mytask5"), expectedNext: []*ResolvedPipelineRunTask{}, }, { name: "tasks-retried-no-candidates", state: taskRetriedState, candidates: sets.NewString("mytask5"), expectedNext: []*ResolvedPipelineRunTask{}, }, { name: "tasks-retried-one-candidates", state: taskExpectedState, candidates: sets.NewString("mytask5"), expectedNext: []*ResolvedPipelineRunTask{taskExpectedState[0]}, }, { name: "runs-cancelled-no-candidates", state: runCancelledByStatusState, candidates: sets.NewString("mytask5"), expectedNext: []*ResolvedPipelineRunTask{}, }, { name: "runs-cancelled-bySpec-no-candidates", state: runCancelledBySpecState, candidates: sets.NewString("mytask5"), expectedNext: []*ResolvedPipelineRunTask{}, }, { name: "runs-running-no-candidates", state: runRunningState, candidates: sets.NewString("mytask5"), expectedNext: []*ResolvedPipelineRunTask{}, }, { name: "run-succeeded-bySpec-no-candidates", state: runSucceededState, candidates: sets.NewString("mytask5"), expectedNext: []*ResolvedPipelineRunTask{}, }, { name: "run-retried-no-candidates", state: runRetriedState, candidates: sets.NewString("mytask5"), expectedNext: []*ResolvedPipelineRunTask{}, }, { name: "run-retried-one-candidates", state: runExpectedState, candidates: sets.NewString("mytask5"), expectedNext: []*ResolvedPipelineRunTask{runExpectedState[0]}, }} // iterate over *state* to get from candidate and check if TaskRun or Run is there. // Cancelled TaskRun should have a TaskRun cancelled and with a retry but should not retry and likewise for Runs. for _, tc := range tcs { t.Run(tc.name, func(t *testing.T) { next := tc.state.getNextTasks(tc.candidates) if d := cmp.Diff(next, tc.expectedNext); d != "" { t.Errorf("Didn't get expected next Tasks %s", diff.PrintWantGot(d)) } }) } }
explode_data.jsonl/18195
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 2644 }
[ 2830, 3393, 1949, 5847, 6262, 2354, 12020, 4019, 1155, 353, 8840, 836, 8, 1476, 2405, 3383, 39473, 1359, 2522, 1397, 284, 40907, 6727, 1397, 90, 515, 197, 10025, 8790, 6262, 25, 609, 12754, 58, 19, 1125, 442, 220, 17, 60601, 4362, 198...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestQuoteMeta(t *testing.T) { for _, tc := range metaTests { // Verify that QuoteMeta returns the expected string. quoted := QuoteMeta(tc.pattern) if quoted != tc.output { t.Errorf("QuoteMeta(`%s`) = `%s`; want `%s`", tc.pattern, quoted, tc.output) continue } // Verify that the quoted string is in fact treated as expected // by Compile -- i.e. that it matches the original, unquoted string. if tc.pattern != "" { re, err := Compile(quoted) if err != nil { t.Errorf("Unexpected error compiling QuoteMeta(`%s`): %v", tc.pattern, err) continue } src := "abc" + tc.pattern + "def" repl := "xyz" replaced := re.ReplaceAllString(src, repl) expected := "abcxyzdef" if replaced != expected { t.Errorf("QuoteMeta(`%s`).Replace(`%s`,`%s`) = `%s`; want `%s`", tc.pattern, src, repl, replaced, expected) } } } }
explode_data.jsonl/25607
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 366 }
[ 2830, 3393, 19466, 12175, 1155, 353, 8840, 836, 8, 341, 2023, 8358, 17130, 1669, 2088, 8823, 18200, 341, 197, 197, 322, 25429, 429, 24535, 12175, 4675, 279, 3601, 914, 624, 197, 197, 63725, 1669, 24535, 12175, 44415, 39109, 340, 197, 74...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestLogsPathMatcher_ValidVarLogPodSource(t *testing.T) { cfgLogsPath := "/var/log/pods/" cfgResourceType := "pod" sourcePath := "/var/log/pods/namespace_pod-name_%s/container/0.log.20220221-210912" if runtime.GOOS == "windows" { cfgLogsPath = "C:\\var\\log\\pods\\" sourcePath = "C:\\var\\log\\pods\\namespace_pod-name_%s\\container\\0.log.20220221-210912" } source := fmt.Sprintf(sourcePath, puid) expectedResult := puid executeTestWithResourceType(t, cfgLogsPath, cfgResourceType, source, expectedResult) }
explode_data.jsonl/34423
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 208 }
[ 2830, 3393, 51053, 1820, 37554, 97279, 3962, 2201, 23527, 3608, 1155, 353, 8840, 836, 8, 341, 50286, 51053, 1820, 1669, 3521, 947, 19413, 4322, 29697, 29555, 50286, 4783, 929, 1669, 330, 39073, 698, 47418, 1820, 1669, 3521, 947, 19413, 43...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestResolvConf(t *testing.T) { test.DropPrivilege(t) defer test.ResetPrivilege(t) _, err := ResolvConf([]string{}) if err == nil { t.Errorf("should have failed with empty dns") } _, err = ResolvConf([]string{"test"}) if err == nil { t.Errorf("should have failed with bad dns") } content, err := ResolvConf([]string{"8.8.8.8"}) if err != nil { t.Errorf("should have passed with valid dns") } if !bytes.Equal(content, []byte("nameserver 8.8.8.8\n")) { t.Errorf("ResolvConf returns a bad content") } }
explode_data.jsonl/74253
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 219 }
[ 2830, 3393, 1061, 35315, 15578, 1155, 353, 8840, 836, 8, 341, 18185, 21688, 32124, 42769, 1155, 340, 16867, 1273, 36660, 32124, 42769, 1155, 692, 197, 6878, 1848, 1669, 1800, 35315, 15578, 10556, 917, 37790, 743, 1848, 621, 2092, 341, 197...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
5
func TestUpdateRootSkew(t *testing.T) { ctx := context.Background() tree := proto.Clone(stestonly.LogTree).(*trillian.Tree) env, client := clientEnvForTest(ctx, t, tree) tree.TreeId = client.LogID defer env.Close() // Start with a single leaf. data := []byte("foo") if err := client.QueueLeaf(ctx, data); err != nil { t.Fatalf("QueueLeaf(%s): %v, want nil", data, err) } env.Sequencer.OperationSingle(ctx) root, err := client.UpdateRoot(ctx) if err != nil { t.Fatalf("UpdateRoot(): %v", err) } // Put in a second leaf after root. data2 := []byte("bar") if err := client.QueueLeaf(ctx, data2); err != nil { t.Fatalf("QueueLeaf(%s): %v, want nil", data2, err) } env.Sequencer.OperationSingle(ctx) // Now force a bad request. badRawClient := &MutatingLogClient{TrillianLogClient: env.Log, mutateRootSize: true} badClient, err := NewFromTree(badRawClient, tree, *root) if err != nil { t.Fatalf("failed to create mutating client: %v", err) } if _, err := badClient.UpdateRoot(ctx); err == nil { t.Error("UpdateRoot()=nil, want error") } }
explode_data.jsonl/54605
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 407 }
[ 2830, 3393, 4289, 8439, 19290, 365, 1155, 353, 8840, 836, 8, 341, 20985, 1669, 2266, 19047, 741, 51968, 1669, 18433, 64463, 5895, 477, 3243, 5247, 6533, 568, 4071, 376, 64721, 43640, 340, 57538, 11, 2943, 1669, 2943, 14359, 2461, 2271, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestDoubleReconfigure(t *testing.T) { // Scenario: Basic test that spawns 2 nodes // and configures node 1 twice, and checks that // the remote stub for node 1 wasn't re-created in the second // configuration since it already existed node1 := newTestNode(t) node2 := newTestNode(t) defer node1.stop() defer node2.stop() node1.c.Configure(testChannel, []cluster.RemoteNode{node2.nodeInfo}) rm1, err := node1.c.Remote(testChannel, node2.nodeInfo.ID) assert.NoError(t, err) node1.c.Configure(testChannel, []cluster.RemoteNode{node2.nodeInfo}) rm2, err := node1.c.Remote(testChannel, node2.nodeInfo.ID) assert.NoError(t, err) // Ensure the references are equal assert.True(t, rm1 == rm2) }
explode_data.jsonl/39835
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 252 }
[ 2830, 3393, 7378, 693, 21002, 1155, 353, 8840, 836, 8, 341, 197, 322, 58663, 25, 14625, 1273, 429, 92676, 220, 17, 7798, 198, 197, 322, 323, 2193, 1413, 2436, 220, 16, 10917, 11, 323, 12341, 429, 198, 197, 322, 279, 8699, 13633, 369...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestHelp(t *testing.T) { hitCount := 0 help := pluginhelp.Help{ AllRepos: []string{"org/repo"}, RepoPlugins: map[string][]string{"org": {"plugin"}}, RepoExternalPlugins: map[string][]string{"org/repo": {"external-plugin"}}, PluginHelp: map[string]pluginhelp.PluginHelp{"plugin": {Description: "plugin"}}, ExternalPluginHelp: map[string]pluginhelp.PluginHelp{"external-plugin": {Description: "external-plugin"}}, } s := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { hitCount++ b, err := json.Marshal(help) if err != nil { t.Fatalf("Marshaling: %v", err) } fmt.Fprintf(w, string(b)) })) ha := &helpAgent{ path: s.URL, } handler := handlePluginHelp(ha) handleAndCheck := func() { req, err := http.NewRequest(http.MethodGet, "/plugin-help.js", nil) if err != nil { t.Fatalf("Error making request: %v", err) } rr := httptest.NewRecorder() handler.ServeHTTP(rr, req) if rr.Code != http.StatusOK { t.Fatalf("Bad error code: %d", rr.Code) } resp := rr.Result() defer resp.Body.Close() body, err := ioutil.ReadAll(resp.Body) if err != nil { t.Fatalf("Error reading response body: %v", err) } var res pluginhelp.Help if err := yaml.Unmarshal(body, &res); err != nil { t.Fatalf("Error unmarshaling: %v", err) } if !reflect.DeepEqual(help, res) { t.Errorf("Invalid plugin help. Got %v, expected %v", res, help) } if hitCount != 1 { t.Errorf("Expected fake hook endpoint to be hit once, but endpoint was hit %d times.", hitCount) } } handleAndCheck() handleAndCheck() }
explode_data.jsonl/45433
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 666 }
[ 2830, 3393, 12689, 1155, 353, 8840, 836, 8, 341, 94778, 2507, 1669, 220, 15, 198, 87640, 1669, 9006, 8653, 70882, 515, 197, 197, 2403, 693, 966, 25, 310, 3056, 917, 4913, 1775, 10758, 5368, 7115, 197, 197, 25243, 45378, 25, 260, 2415,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestImagePullCheck(t *testing.T) { fcmd := fakeexec.FakeCmd{ RunScript: []fakeexec.FakeRunAction{ // Test case 1: pull 3 images successfully func() ([]byte, []byte, error) { return nil, nil, nil }, func() ([]byte, []byte, error) { return nil, nil, nil }, func() ([]byte, []byte, error) { return nil, nil, nil }, // Test case 2: image pull errors func() ([]byte, []byte, error) { return nil, nil, nil }, func() ([]byte, []byte, error) { return nil, nil, &fakeexec.FakeExitError{Status: 1} }, func() ([]byte, []byte, error) { return nil, nil, &fakeexec.FakeExitError{Status: 1} }, }, CombinedOutputScript: []fakeexec.FakeCombinedOutputAction{ // Test case1: pull 3 images func() ([]byte, error) { return nil, nil }, func() ([]byte, error) { return nil, nil }, func() ([]byte, error) { return nil, nil }, // Test case 2: fail to pull image2 and image3 func() ([]byte, error) { return nil, nil }, func() ([]byte, error) { return []byte("error"), &fakeexec.FakeExitError{Status: 1} }, func() ([]byte, error) { return []byte("error"), &fakeexec.FakeExitError{Status: 1} }, }, } fexec := fakeexec.FakeExec{ CommandScript: []fakeexec.FakeCommandAction{ func(cmd string, args ...string) exec.Cmd { return fakeexec.InitFakeCmd(&fcmd, cmd, args...) }, func(cmd string, args ...string) exec.Cmd { return fakeexec.InitFakeCmd(&fcmd, cmd, args...) }, func(cmd string, args ...string) exec.Cmd { return fakeexec.InitFakeCmd(&fcmd, cmd, args...) }, func(cmd string, args ...string) exec.Cmd { return fakeexec.InitFakeCmd(&fcmd, cmd, args...) }, func(cmd string, args ...string) exec.Cmd { return fakeexec.InitFakeCmd(&fcmd, cmd, args...) }, func(cmd string, args ...string) exec.Cmd { return fakeexec.InitFakeCmd(&fcmd, cmd, args...) }, }, LookPathFunc: func(cmd string) (string, error) { return "/usr/bin/docker", nil }, } containerRuntime, err := utilruntime.NewContainerRuntime(&fexec, constants.DefaultDockerCRISocket) if err != nil { t.Errorf("unexpected NewContainerRuntime error: %v", err) } check := ImagePullCheck{ runtime: containerRuntime, imageList: []string{"img1", "img2", "img3"}, } warnings, errors := check.Check() if len(warnings) != 0 { t.Fatalf("did not expect any warnings but got %q", warnings) } if len(errors) != 0 { t.Fatalf("expected 0 errors but got %d: %q", len(errors), errors) } warnings, errors = check.Check() if len(warnings) != 0 { t.Fatalf("did not expect any warnings but got %q", warnings) } if len(errors) != 2 { t.Fatalf("expected 2 errors but got %d: %q", len(errors), errors) } }
explode_data.jsonl/56072
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 941 }
[ 2830, 3393, 1906, 36068, 3973, 1155, 353, 8840, 836, 8, 341, 1166, 8710, 1669, 12418, 11748, 991, 726, 15613, 515, 197, 85952, 5910, 25, 3056, 30570, 11748, 991, 726, 6727, 2512, 515, 298, 197, 322, 3393, 1142, 220, 16, 25, 6815, 220,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func Test_ObjectTracker_Terminated_Expect(t *testing.T) { g := gomega.NewWithT(t) ot := newObjTracker(schema.GroupVersionKind{}, nil) ct := makeCT("test-ct") now := metav1.Now() ct.ObjectMeta.DeletionTimestamp = &now ot.Expect(ct) ot.ExpectationsDone() g.Expect(ot.Satisfied()).To(gomega.BeTrue(), "should be satisfied") }
explode_data.jsonl/52317
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 135 }
[ 2830, 3393, 27839, 31133, 1139, 261, 51199, 62, 17536, 1155, 353, 8840, 836, 8, 341, 3174, 1669, 342, 32696, 7121, 2354, 51, 1155, 340, 197, 354, 1669, 74259, 31133, 42735, 5407, 5637, 10629, 22655, 2092, 340, 89216, 1669, 1281, 1162, 4...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestArray(t *testing.T) { assignees := []string{"1", "2", "3"} exp := c.Equals(c.Field("system.assignees"), c.Literal(assignees)) where, _, _, compileErrors := workitem.Compile(exp) require.Empty(t, compileErrors) wiTbl := workitem.WorkItemStorage{}.TableName() assert.Equal(t, `(`+workitem.Column(wiTbl, "fields")+` @> '{"system.assignees" : ["1","2","3"]}')`, where) }
explode_data.jsonl/36709
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 158 }
[ 2830, 3393, 1857, 1155, 353, 8840, 836, 8, 341, 197, 6983, 5516, 1669, 3056, 917, 4913, 16, 497, 330, 17, 497, 330, 18, 63159, 48558, 1669, 272, 16207, 1337, 17087, 445, 8948, 17870, 5516, 3975, 272, 1214, 9953, 66882, 5516, 1171, 557...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestHashSrcDstService(t *testing.T) { assert := tassert.New(t) src := service.MeshService{ Namespace: "src-ns", Name: "source", } dst := service.MeshService{ Namespace: "dst-ns", Name: "destination", } srcDstServiceHash := hashSrcDstService(src, dst) assert.Equal(srcDstServiceHash, "src-ns/source:dst-ns/destination") }
explode_data.jsonl/69764
{ "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, 6370, 20360, 54600, 1860, 1155, 353, 8840, 836, 8, 341, 6948, 1669, 259, 2207, 7121, 1155, 692, 41144, 1669, 2473, 50155, 1860, 515, 197, 90823, 25, 330, 3548, 12, 4412, 756, 197, 21297, 25, 414, 330, 2427, 756, 197, 532, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestGC_TrackConfigurationBlobs_DoesNothingIfTriggerDisabled(t *testing.T) { require.NoError(t, testutil.TruncateAllTables(suite.db)) enable, err := testutil.GCTrackConfigurationBlobsTrigger.Disable(suite.db) require.NoError(t, err) defer enable() // create repo r := randomRepository(t) rs := datastore.NewRepositoryStore(suite.db) r, err = rs.CreateByPath(suite.ctx, r.Path) require.NoError(t, err) // create config blob bs := datastore.NewBlobStore(suite.db) b := randomBlob(t) err = bs.Create(suite.ctx, b) require.NoError(t, err) // create manifest ms := datastore.NewManifestStore(suite.db) m := randomManifest(t, r, b) err = ms.Create(suite.ctx, m) require.NoError(t, err) // check that no records were created brs := datastore.NewGCConfigLinkStore(suite.db) count, err := brs.Count(suite.ctx) require.NoError(t, err) require.Zero(t, count) }
explode_data.jsonl/48559
{ "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, 22863, 21038, 473, 7688, 33, 68164, 1557, 7072, 23780, 2679, 17939, 25907, 1155, 353, 8840, 836, 8, 341, 17957, 35699, 1155, 11, 1273, 1314, 8240, 26900, 2403, 21670, 89516, 7076, 4390, 197, 12552, 11, 1848, 1669, 1273, 1314, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestInts(t *testing.T) { ai := BackgroundBlue.Ints() bi := Blue.Background().Ints() if len(ai) != len(bi) { fmt.Println("A", ai) fmt.Println("B", bi) fmt.Println("length mismatch") t.Fail() } for i := 0; i < len(ai); i++ { if ai[i] != bi[i] { fmt.Println("NO") t.Fail() } } }
explode_data.jsonl/39709
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 155 }
[ 2830, 3393, 1072, 82, 1155, 353, 8840, 836, 8, 341, 197, 2143, 1669, 24800, 10331, 7371, 82, 741, 2233, 72, 1669, 8697, 19047, 1005, 1072, 82, 741, 743, 2422, 74092, 8, 961, 2422, 1883, 72, 8, 341, 197, 11009, 12419, 445, 32, 497, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
4
func TestSpaceSummary(t *testing.T) { Convey("Get space summary", t, func() { setup(MockRoute{"GET", "/v2/spaces/494d8b64-8181-4183-a6d3-6279db8fec6e/summary", spaceSummaryPayload, "", 200, "", nil}, t) defer teardown() c := &Config{ ApiAddress: server.URL, Token: "foobar", } client, err := NewClient(c) So(err, ShouldBeNil) space := &Space{ Guid: "494d8b64-8181-4183-a6d3-6279db8fec6e", c: client, } summary, err := space.Summary() So(err, ShouldBeNil) So(summary.Guid, ShouldEqual, "494d8b64-8181-4183-a6d3-6279db8fec6e") So(summary.Name, ShouldEqual, "test") So(len(summary.Apps), ShouldEqual, 1) So(summary.Apps[0].Guid, ShouldEqual, "b5f0d1bd-a3a9-40a4-af1a-312ad26e5379") So(summary.Apps[0].Name, ShouldEqual, "test-app") So(summary.Apps[0].ServiceCount, ShouldEqual, 1) So(summary.Apps[0].RunningInstances, ShouldEqual, 1) So(summary.Apps[0].SpaceGuid, ShouldEqual, "494d8b64-8181-4183-a6d3-6279db8fec6e") So(summary.Apps[0].StackGuid, ShouldEqual, "67e019a3-322a-407a-96e0-178e95bd0e55") So(summary.Apps[0].Buildpack, ShouldEqual, "ruby_buildpack") So(summary.Apps[0].DetectedBuildpack, ShouldEqual, "") So(summary.Apps[0].Memory, ShouldEqual, 256) So(summary.Apps[0].Instances, ShouldEqual, 1) So(summary.Apps[0].DiskQuota, ShouldEqual, 512) So(summary.Apps[0].State, ShouldEqual, "STARTED") So(summary.Apps[0].Command, ShouldEqual, "") So(summary.Apps[0].PackageState, ShouldEqual, "STAGED") So(summary.Apps[0].HealthCheckType, ShouldEqual, "port") So(summary.Apps[0].HealthCheckTimeout, ShouldEqual, 0) So(summary.Apps[0].StagingFailedReason, ShouldEqual, "") So(summary.Apps[0].StagingFailedDescription, ShouldEqual, "") So(summary.Apps[0].Diego, ShouldEqual, true) So(summary.Apps[0].DockerImage, ShouldEqual, "") So(summary.Apps[0].DetectedStartCommand, ShouldEqual, "rackup -p $PORT") So(summary.Apps[0].EnableSSH, ShouldEqual, true) So(summary.Apps[0].DockerCredentials["redacted_message"], ShouldEqual, "[PRIVATE DATA HIDDEN]") So(len(summary.Services), ShouldEqual, 1) So(summary.Services[0].Guid, ShouldEqual, "3c5c758c-6b76-46f6-89d5-677909bfc975") So(summary.Services[0].Name, ShouldEqual, "test-service") So(summary.Services[0].BoundAppCount, ShouldEqual, 1) }) }
explode_data.jsonl/59987
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1008 }
[ 2830, 3393, 9914, 19237, 1155, 353, 8840, 836, 8, 341, 93070, 5617, 445, 1949, 3550, 12126, 497, 259, 11, 2915, 368, 341, 197, 84571, 66436, 4899, 4913, 3806, 497, 3521, 85, 17, 26734, 2434, 14, 19, 24, 19, 67, 23, 65, 21, 19, 12,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestCreateRouteTableIfNotExists_NotExists(t *testing.T) { fake := newFakeRouteTablesClient() cloud := &Cloud{ RouteTablesClient: fake, Config: Config{ RouteTableResourceGroup: "foo", RouteTableName: "bar", Location: "location", }, } cache, _ := cloud.newRouteTableCache() cloud.rtCache = cache expectedTable := network.RouteTable{ Name: &cloud.RouteTableName, Location: &cloud.Location, } err := cloud.createRouteTableIfNotExists("clusterName", &cloudprovider.Route{TargetNode: "node", DestinationCIDR: "1.2.3.4/16"}) if err != nil { t.Errorf("unexpected error create if not exists route table: %v", err) t.FailNow() } table := fake.FakeStore[cloud.RouteTableResourceGroup][cloud.RouteTableName] if *table.Location != *expectedTable.Location { t.Errorf("mismatch: %s vs %s", *table.Location, *expectedTable.Location) } if *table.Name != *expectedTable.Name { t.Errorf("mismatch: %s vs %s", *table.Name, *expectedTable.Name) } if len(fake.Calls) != 2 || fake.Calls[0] != "Get" || fake.Calls[1] != "CreateOrUpdate" { t.Errorf("unexpected calls create if not exists, exists: %v", fake.Calls) } }
explode_data.jsonl/70932
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 452 }
[ 2830, 3393, 4021, 4899, 2556, 2679, 2623, 15575, 60816, 15575, 1155, 353, 8840, 836, 8, 341, 1166, 726, 1669, 501, 52317, 4899, 21670, 2959, 741, 197, 12361, 1669, 609, 16055, 515, 197, 47501, 21670, 2959, 25, 12418, 345, 197, 66156, 25...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
7
func TestIfBraces(t *testing.T) { testStr := `<?php if (true) { echo "hello world"; } else if (false) { echo "no hello world"; }` p := NewParser() p.disableScoping = true a, _ := p.Parse("test.php", testStr) tree := &ast.IfStmt{ Branches: []ast.IfBranch{ { Condition: &ast.Literal{Type: ast.Boolean, Value: "true"}, Block: &ast.Block{ Statements: []ast.Statement{ast.Echo(&ast.Literal{Type: ast.String, Value: `"hello world"`})}, }, }, { Condition: &ast.Literal{Type: ast.Boolean, Value: "false"}, Block: &ast.Block{ Statements: []ast.Statement{ast.Echo(&ast.Literal{Type: ast.String, Value: `"no hello world"`})}, }, }, }, } if !assertEquals(a.Nodes[0], tree) { t.Fatalf("If with braces did not correctly parse") } }
explode_data.jsonl/28432
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 365 }
[ 2830, 3393, 2679, 6828, 2434, 1155, 353, 8840, 836, 8, 341, 18185, 2580, 1669, 1565, 1316, 1208, 198, 262, 421, 320, 1866, 8, 341, 414, 1687, 330, 14990, 1879, 876, 262, 335, 770, 421, 320, 3849, 8, 341, 414, 1687, 330, 2152, 23811,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestRequireFSBrowser(t *testing.T) { default_suite.expectBundled(t, bundled{ files: map[string]string{ "/entry.js": ` console.log(require('fs')) `, }, entryPaths: []string{"/entry.js"}, options: config.Options{ Mode: config.ModeBundle, AbsOutputFile: "/out.js", Platform: config.PlatformBrowser, }, expectedScanLog: `entry.js: error: Could not resolve "fs" (use "Platform: api.PlatformNode" when building for node) `, }) }
explode_data.jsonl/38493
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 196 }
[ 2830, 3393, 17959, 8485, 17878, 1155, 353, 8840, 836, 8, 341, 11940, 57239, 25952, 33, 1241, 832, 1155, 11, 51450, 515, 197, 74075, 25, 2415, 14032, 30953, 515, 298, 197, 3115, 4085, 2857, 788, 22074, 571, 12160, 1665, 23482, 492, 3848,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestInvalidBoolsSlice(t *testing.T) { type config struct { BadBools []bool `env:"BADBOOLS"` } os.Setenv("BADBOOLS", "t,f,TRUE,faaaalse") cfg := &config{} assert.EqualError(t, Parse(cfg), "env: parse error on field \"BadBools\" of type \"[]bool\": strconv.ParseBool: parsing \"faaaalse\": invalid syntax") }
explode_data.jsonl/78771
{ "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, 7928, 1233, 3069, 33236, 1155, 353, 8840, 836, 8, 341, 13158, 2193, 2036, 341, 197, 12791, 329, 1233, 3069, 3056, 2641, 1565, 3160, 2974, 53572, 10395, 50, 8805, 197, 630, 25078, 4202, 3160, 445, 53572, 10395, 50, 497, 330, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func Test_NewPRWExporter(t *testing.T) { cfg := &Config{ ExporterSettings: config.NewExporterSettings(config.NewID(typeStr)), TimeoutSettings: exporterhelper.TimeoutSettings{}, RetrySettings: exporterhelper.RetrySettings{}, Namespace: "", ExternalLabels: map[string]string{}, HTTPClientSettings: confighttp.HTTPClientSettings{Endpoint: ""}, } buildInfo := component.BuildInfo{ Description: "OpenTelemetry Collector", Version: "1.0", } tests := []struct { name string config *Config namespace string endpoint string concurrency int externalLabels map[string]string returnErrorOnCreate bool buildInfo component.BuildInfo }{ { name: "invalid_URL", config: cfg, namespace: "test", endpoint: "invalid URL", concurrency: 5, externalLabels: map[string]string{"Key1": "Val1"}, returnErrorOnCreate: true, buildInfo: buildInfo, }, { name: "invalid_labels_case", config: cfg, namespace: "test", endpoint: "http://some.url:9411/api/prom/push", concurrency: 5, externalLabels: map[string]string{"Key1": ""}, returnErrorOnCreate: true, buildInfo: buildInfo, }, { name: "success_case", config: cfg, namespace: "test", endpoint: "http://some.url:9411/api/prom/push", concurrency: 5, externalLabels: map[string]string{"Key1": "Val1"}, buildInfo: buildInfo, }, { name: "success_case_no_labels", config: cfg, namespace: "test", endpoint: "http://some.url:9411/api/prom/push", concurrency: 5, externalLabels: map[string]string{}, buildInfo: buildInfo, }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { cfg.HTTPClientSettings.Endpoint = tt.endpoint cfg.ExternalLabels = tt.externalLabels cfg.Namespace = tt.namespace cfg.RemoteWriteQueue.NumConsumers = 1 prwe, err := NewPRWExporter(cfg, tt.buildInfo) if tt.returnErrorOnCreate { assert.Error(t, err) return } assert.NoError(t, err) require.NotNil(t, prwe) assert.NotNil(t, prwe.namespace) assert.NotNil(t, prwe.endpointURL) assert.NotNil(t, prwe.externalLabels) assert.NotNil(t, prwe.closeChan) assert.NotNil(t, prwe.wg) assert.NotNil(t, prwe.userAgentHeader) assert.NotNil(t, prwe.clientSettings) }) } }
explode_data.jsonl/78809
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1280 }
[ 2830, 3393, 39582, 6480, 54, 88025, 1155, 353, 8840, 836, 8, 341, 50286, 1669, 609, 2648, 515, 197, 197, 88025, 6086, 25, 256, 2193, 7121, 88025, 6086, 8754, 7121, 915, 5808, 2580, 6965, 197, 197, 7636, 6086, 25, 262, 57378, 18764, 63...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestEmptyCatalogConversion(t *testing.T) { serviceClasses, servicePlans, err := convertAndFilterCatalog(&osb.CatalogResponse{}, nil) if err != nil { t.Fatalf("Failed to convertAndFilterCatalog: %v", err) } if len(serviceClasses) != 0 { t.Fatalf("Expected 0 serviceclasses for empty catalog, but got: %d", len(serviceClasses)) } if len(servicePlans) != 0 { t.Fatalf("Expected 0 serviceplans for empty catalog, but got: %d", len(servicePlans)) } }
explode_data.jsonl/40485
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 162 }
[ 2830, 3393, 3522, 41606, 48237, 1155, 353, 8840, 836, 8, 341, 52934, 20077, 11, 2473, 97728, 11, 1848, 1669, 5508, 3036, 5632, 41606, 2099, 436, 65, 727, 7750, 2582, 22655, 2092, 340, 743, 1848, 961, 2092, 341, 197, 3244, 30762, 445, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
4
func Test_statesInformer_syncPods(t *testing.T) { client := clientsetfake.NewSimpleClientset() crdClient := koordclientfake.NewSimpleClientset() pleg, _ := pleg.NewPLEG(system.Conf.CgroupRootDir) stopCh := make(chan struct{}, 1) defer close(stopCh) c := NewDefaultConfig() c.KubeletSyncIntervalSeconds = 60 m := NewStatesInformer(c, client, crdClient, pleg, "localhost") m.(*statesInformer).kubelet = &testKubeletStub{pods: corev1.PodList{ Items: []corev1.Pod{ {}, }, }} m.(*statesInformer).syncKubelet() if len(m.(*statesInformer).GetAllPods()) != 1 { t.Errorf("failed to update pods") } }
explode_data.jsonl/22685
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 247 }
[ 2830, 3393, 22972, 641, 34527, 23008, 23527, 82, 1155, 353, 8840, 836, 8, 341, 25291, 1669, 2943, 746, 30570, 7121, 16374, 2959, 746, 741, 1444, 6498, 2959, 1669, 15236, 539, 2972, 30570, 7121, 16374, 2959, 746, 741, 197, 694, 70, 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 TestPriceSnapshot(t *testing.T) { stock, err := NewStock("ZZB AU", "AUD") if err != nil { t.Errorf("Error in NewStock - %s", err) } // set the stock price price := Price{Float64: 2.5, Valid: true} stock.SetPrice(price) // create our new snapshot and test timestamp := time.Date(2020, time.December, 14, 0, 0, 0, 0, time.UTC) snap := NewPriceSnapshot(timestamp, stock) if !snap.GetTime().Equal(timestamp) { t.Error("Unexpected timestamp") } if snap.GetPrice().Float64 != 2.50 { t.Error("Unexpected price") } }
explode_data.jsonl/39253
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 203 }
[ 2830, 3393, 6972, 15009, 1155, 353, 8840, 836, 8, 341, 197, 13479, 11, 1848, 1669, 1532, 19369, 445, 33536, 33, 39056, 497, 330, 61278, 1138, 743, 1848, 961, 2092, 341, 197, 3244, 13080, 445, 1454, 304, 1532, 19369, 481, 1018, 82, 497...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
4
func TestServerRun(t *testing.T) { p2pInstance.Run() storage.Run() defer storage.Close() defer p2pInstance.Close() server := NewServer(log, storage, p2pInstance, nil) port, err := strconv.ParseUint(apiPort, 10, 64) assert.NoError(t, err) go server.Run(uint(port)) defer server.Close() conn, err := grpc.Dial(serverAddr, grpc.WithInsecure()) assert.NoError(t, err) defer conn.Close() client := pb.NewOrderHandlerClient(conn) resp, err := client.GetAllOrders(context.Background(), &pb.Empty{}) assert.NoError(t, err) assert.NotNil(t, resp) }
explode_data.jsonl/33455
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 218 }
[ 2830, 3393, 5475, 6727, 1155, 353, 8840, 836, 8, 341, 3223, 17, 79, 2523, 16708, 741, 197, 16172, 16708, 741, 16867, 5819, 10421, 741, 16867, 281, 17, 79, 2523, 10421, 2822, 41057, 1669, 1532, 5475, 12531, 11, 5819, 11, 281, 17, 79, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestMainBeforeSubCommandsShowCCConfigPaths(t *testing.T) { assert := assert.New(t) tmpdir, err := ioutil.TempDir(testDir, "") assert.NoError(err) defer os.RemoveAll(tmpdir) set := flag.NewFlagSet("", 0) set.Bool("kata-show-default-config-paths", true, "") ctx := createCLIContext(set) savedExitFunc := exitFunc exitStatus := 99 exitFunc = func(status int) { exitStatus = status } defer func() { exitFunc = savedExitFunc }() savedOutputFile := defaultOutputFile defer func() { resetCLIGlobals() defaultOutputFile = savedOutputFile }() output := filepath.Join(tmpdir, "output") f, err := os.OpenFile(output, os.O_CREATE|os.O_WRONLY|os.O_SYNC, testFileMode) assert.NoError(err) defer f.Close() defaultOutputFile = f setCLIGlobals() _ = beforeSubcommands(ctx) assert.Equal(exitStatus, 0) text, err := katautils.GetFileContents(output) assert.NoError(err) lines := strings.Split(text, "\n") // Remove last line if empty length := len(lines) last := lines[length-1] if last == "" { lines = lines[:length-1] } assert.Equal(len(lines), 2) for i, line := range lines { switch i { case 0: assert.Equal(line, defaultSysConfRuntimeConfiguration) case 1: assert.Equal(line, defaultRuntimeConfiguration) } } }
explode_data.jsonl/52196
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 493 }
[ 2830, 3393, 6202, 10227, 3136, 30479, 7812, 3706, 2648, 26901, 1155, 353, 8840, 836, 8, 341, 6948, 1669, 2060, 7121, 1155, 692, 20082, 3741, 11, 1848, 1669, 43144, 65009, 6184, 8623, 6184, 11, 14676, 6948, 35699, 3964, 340, 16867, 2643, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestSetOutput(t *testing.T) { var flags FlagSet var buf bytes.Buffer flags.SetOutput(&buf) flags.Init("test", ContinueOnError) flags.Parse([]string{"-unknown"}) if out := buf.String(); !strings.Contains(out, "-unknown") { t.Logf("expected output mentioning unknown; got %q", out) } }
explode_data.jsonl/53996
{ "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, 1649, 5097, 1155, 353, 8840, 836, 8, 341, 2405, 8042, 22666, 1649, 198, 2405, 6607, 5820, 22622, 198, 59516, 4202, 5097, 2099, 5909, 340, 59516, 26849, 445, 1944, 497, 15003, 74945, 340, 59516, 8937, 10556, 917, 4913, 12, 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 TestWithPingInterval(t *testing.T) { t.Parallel() Convey("Given a ping interval and dialer", t, func() { dialer := &mockDialerStruct{} dialer.pingInterval = 5 * time.Second Convey("And Dial is called with ping interval", func() { _, err := mockDial(dialer, WithPingInterval(dialer.pingInterval)) Convey("Then no error should be encountered", func() { So(err, ShouldBeNil) }) }) }) }
explode_data.jsonl/53409
{ "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, 2354, 69883, 10256, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 2822, 93070, 5617, 445, 22043, 264, 29998, 9873, 323, 27860, 261, 497, 259, 11, 2915, 368, 341, 197, 2698, 530, 261, 1669, 609, 16712, 35, 530, 261, 9422...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestCapabilities_Has(t *testing.T) { t.Parallel() var tests = []struct { capabilities *Capabilities brfcID string alternateID string expectedFound bool }{ {&Capabilities{ StandardResponse: StandardResponse{StatusCode: http.StatusOK, Tracing: resty.TraceInfo{TotalTime: 200}}, BsvAlias: DefaultServiceName, Capabilities: map[string]interface{}{ "6745385c3fc0": true, "alternate_id": true, "0c4339ef99c2": "https://domain.com/" + DefaultServiceName + "/id/{alias}@{domain.tld}", }, }, "6745385c3fc0", "alternate_id", true}, {&Capabilities{ StandardResponse: StandardResponse{StatusCode: http.StatusOK, Tracing: resty.TraceInfo{TotalTime: 200}}, BsvAlias: DefaultServiceName, Capabilities: map[string]interface{}{ "6745385c3fc0": true, "alternate_id": true, "0c4339ef99c2": "https://domain.com/" + DefaultServiceName + "/id/{alias}@{domain.tld}", }, }, "6745385c3fc0", "", true}, {&Capabilities{ StandardResponse: StandardResponse{StatusCode: http.StatusOK, Tracing: resty.TraceInfo{TotalTime: 200}}, BsvAlias: DefaultServiceName, Capabilities: map[string]interface{}{ "6745385c3fc0": true, "alternate_id": true, "0c4339ef99c2": "https://domain.com/" + DefaultServiceName + "/id/{alias}@{domain.tld}", }, }, "alternate_id", "6745385c3fc0", true}, {&Capabilities{ StandardResponse: StandardResponse{StatusCode: http.StatusOK, Tracing: resty.TraceInfo{TotalTime: 200}}, BsvAlias: DefaultServiceName, Capabilities: map[string]interface{}{ "6745385c3fc0": true, "alternate_id": true, "0c4339ef99c2": "https://domain.com/" + DefaultServiceName + "/id/{alias}@{domain.tld}", }, }, "6745385c3fc0", "6745385c3fc0", true}, {&Capabilities{ StandardResponse: StandardResponse{StatusCode: http.StatusOK, Tracing: resty.TraceInfo{TotalTime: 200}}, BsvAlias: DefaultServiceName, Capabilities: map[string]interface{}{ "6745385c3fc0": true, "alternate_id": true, "0c4339ef99c2": "https://domain.com/" + DefaultServiceName + "/id/{alias}@{domain.tld}", }, }, "wrong", "wrong", false}, {&Capabilities{ StandardResponse: StandardResponse{StatusCode: http.StatusOK, Tracing: resty.TraceInfo{TotalTime: 200}}, BsvAlias: DefaultServiceName, Capabilities: map[string]interface{}{ "6745385c3fc0": true, "alternate_id": true, "0c4339ef99c2": "https://domain.com/" + DefaultServiceName + "/id/{alias}@{domain.tld}", }, }, "wrong", "6745385c3fc0", true}, } for _, test := range tests { if output := test.capabilities.Has(test.brfcID, test.alternateID); output != test.expectedFound { t.Errorf("%s Failed: [%s] [%s] inputted and [%v] expected, received: [%v]", t.Name(), test.brfcID, test.alternateID, test.expectedFound, output) } } }
explode_data.jsonl/54218
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1203 }
[ 2830, 3393, 55315, 2039, 300, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 2822, 2405, 7032, 284, 3056, 1235, 341, 197, 1444, 391, 8456, 220, 353, 55315, 198, 197, 80255, 8316, 915, 286, 914, 198, 197, 197, 75362, 915, 256, 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...
3
func TestStream_GetLength(t *testing.T) { t.Run("test", func(t *testing.T) { assert := base.NewAssert(t) for i := 0; i < 1000; i++ { randLen := rand.Int() % 10000 stream := NewStream() bytes := []byte(base.GetRandString(randLen)) stream.PutBytes(bytes) stream.BuildStreamCheck() assert(int(stream.GetLength())).Equals(stream.GetWritePos()) stream.Release() } }) }
explode_data.jsonl/21160
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 160 }
[ 2830, 3393, 3027, 13614, 4373, 1155, 353, 8840, 836, 8, 341, 3244, 16708, 445, 1944, 497, 2915, 1155, 353, 8840, 836, 8, 341, 197, 6948, 1669, 2331, 7121, 8534, 1155, 340, 197, 2023, 600, 1669, 220, 15, 26, 600, 366, 220, 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...
2
func TestRecreateServiceInstance(t *testing.T) { testServiceInstance := &servicecatalogv1beta1.ServiceInstance{ ObjectMeta: metav1.ObjectMeta{ Name: "my-events", Namespace: "ns", ResourceVersion: "00", }, Spec: servicecatalogv1beta1.ServiceInstanceSpec{ ServiceClassRef: &servicecatalogv1beta1.LocalObjectReference{ Name: "some-class", }, ServicePlanRef: &servicecatalogv1beta1.LocalObjectReference{ Name: "some-plan", }, }, } m := serviceInstanceManager{ svcCatalogClient: servicecatalogfakeclientset.NewSimpleClientset(testServiceInstance), } err := m.recreateServiceInstance(*testServiceInstance) if err != nil { t.Fatalf("Failed to recreate ServiceInstance: %s", err) } svci, err := m.svcCatalogClient.ServicecatalogV1beta1().ServiceInstances("ns").Get("my-events", metav1.GetOptions{}) if err != nil { t.Fatalf("Error getting ServiceInstance from cluster: %s", err) } if cmp.Diff(testServiceInstance, svci) == "" { t.Error("Expected new ServiceInstance to differ from original, got identical objects") } }
explode_data.jsonl/12244
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 396 }
[ 2830, 3393, 693, 3182, 1860, 2523, 1155, 353, 8840, 836, 8, 341, 18185, 1860, 2523, 1669, 609, 7936, 26539, 85, 16, 19127, 16, 13860, 2523, 515, 197, 23816, 12175, 25, 77520, 16, 80222, 515, 298, 21297, 25, 310, 330, 2408, 53803, 756,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestValSetUpdatesBasicTestsExecute(t *testing.T) { valSetUpdatesBasicTests := []struct { startVals []testVal updateVals []testVal expectedVals []testVal }{ { // no changes testValSet(2, 10), []testVal{}, testValSet(2, 10), }, { // voting power changes testValSet(2, 10), []testVal{{"v1", 11}, {"v2", 22}}, []testVal{{"v1", 11}, {"v2", 22}}, }, { // add new validators []testVal{{"v1", 10}, {"v2", 20}}, []testVal{{"v3", 30}, {"v4", 40}}, []testVal{{"v1", 10}, {"v2", 20}, {"v3", 30}, {"v4", 40}}, }, { // add new validator to middle []testVal{{"v1", 10}, {"v3", 20}}, []testVal{{"v2", 30}}, []testVal{{"v1", 10}, {"v2", 30}, {"v3", 20}}, }, { // add new validator to beginning []testVal{{"v2", 10}, {"v3", 20}}, []testVal{{"v1", 30}}, []testVal{{"v1", 30}, {"v2", 10}, {"v3", 20}}, }, { // delete validators []testVal{{"v1", 10}, {"v2", 20}, {"v3", 30}}, []testVal{{"v2", 0}}, []testVal{{"v1", 10}, {"v3", 30}}, }, } for i, tt := range valSetUpdatesBasicTests { // create a new set and apply updates, keeping copies for the checks valSet := createNewValidatorSet(tt.startVals) valList := createNewValidatorList(tt.updateVals) err := valSet.UpdateWithChangeSet(valList) assert.NoError(t, err, "test %d", i) valListCopy := validatorListCopy(valSet.Validators) // check that the voting power in the set's validators is not changing if the voting power // is changed in the list of validators previously passed as parameter to UpdateWithChangeSet. // this is to make sure copies of the validators are made by UpdateWithChangeSet. if len(valList) > 0 { valList[0].VotingPower++ assert.Equal(t, toTestValList(valListCopy), toTestValList(valSet.Validators), "test %v", i) } // check the final validator list is as expected and the set is properly scaled and centered. assert.Equal(t, tt.expectedVals, toTestValList(valSet.Validators), "test %v", i) verifyValidatorSet(t, valSet) } }
explode_data.jsonl/28331
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 831 }
[ 2830, 3393, 2208, 1649, 37091, 15944, 18200, 17174, 1155, 353, 8840, 836, 8, 341, 19302, 1649, 37091, 15944, 18200, 1669, 3056, 1235, 341, 197, 21375, 52452, 262, 3056, 1944, 2208, 198, 197, 27175, 52452, 256, 3056, 1944, 2208, 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 TestPongLatest(t *testing.T) { pver := wire.ProtocolVersion nonce, err := wire.RandomUint64() if err != nil { t.Errorf("RandomUint64: error generating nonce: %v", err) } msg := wire.NewMsgPong(nonce) if msg.Nonce != nonce { t.Errorf("NewMsgPong: wrong nonce - got %v, want %v", msg.Nonce, nonce) } // Ensure the command is expected value. wantCmd := "pong" if cmd := msg.Command(); cmd != wantCmd { t.Errorf("NewMsgPong: wrong command - got %v want %v", cmd, wantCmd) } // Ensure max payload is expected value for latest protocol version. wantPayload := uint32(8) maxPayload := msg.MaxPayloadLength(pver) if maxPayload != wantPayload { t.Errorf("MaxPayloadLength: wrong max payload length for "+ "protocol version %d - got %v, want %v", pver, maxPayload, wantPayload) } // Test encode with latest protocol version. var buf bytes.Buffer err = msg.BtcEncode(&buf, pver) if err != nil { t.Errorf("encode of MsgPong failed %v err <%v>", msg, err) } // Test decode with latest protocol version. readmsg := wire.NewMsgPong(0) err = readmsg.BtcDecode(&buf, pver) if err != nil { t.Errorf("decode of MsgPong failed [%v] err <%v>", buf, err) } // Ensure nonce is the same. if msg.Nonce != readmsg.Nonce { t.Errorf("Should get same nonce for protocol version %d", pver) } return }
explode_data.jsonl/6619
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 517 }
[ 2830, 3393, 47, 644, 31992, 1155, 353, 8840, 836, 8, 341, 3223, 423, 1669, 9067, 54096, 5637, 271, 197, 39593, 11, 1848, 1669, 9067, 26709, 21570, 21, 19, 741, 743, 1848, 961, 2092, 341, 197, 3244, 13080, 445, 13999, 21570, 21, 19, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
8
func TestStorageSmartContract_addBlobber_invalidParams(t *testing.T) { var ( ssc = newTestStorageSC() // balances = newTestBalances(t, false) // terms = avgTerms // copy tp int64 = 100 // ) var add = func(t *testing.T, ssc *StorageSmartContract, cap, now int64, terms Terms, balacne state.Balance, balances chainState.StateContextI) ( err error) { var blob = newClient(0, balances) blob.terms = terms blob.cap = cap _, err = blob.callAddBlobber(t, ssc, now, balances) return } setConfig(t, balances) var conf, err = ssc.getConfig(balances, false) require.NoError(t, err) terms.ChallengeCompletionTime = conf.MaxChallengeCompletionTime + 1*time.Second err = add(t, ssc, 2*GB, tp, terms, 0, balances) require.Error(t, err) terms.ChallengeCompletionTime = conf.MaxChallengeCompletionTime - 1*time.Second terms.MaxOfferDuration = conf.MinOfferDuration - 1*time.Second err = add(t, ssc, 2*GB, tp, terms, 0, balances) require.Error(t, err) }
explode_data.jsonl/32337
{ "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, 5793, 33817, 14067, 2891, 37985, 652, 31433, 4870, 1155, 353, 8840, 836, 8, 341, 2405, 2399, 197, 34472, 66, 310, 284, 501, 2271, 5793, 3540, 368, 286, 6475, 197, 2233, 278, 3020, 981, 284, 501, 2271, 37889, 3020, 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 TestDomains_DeleteRecordForDomainName(t *testing.T) { setup() defer teardown() mux.HandleFunc("/v2/domains/example.com/records/1", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, http.MethodDelete) }) _, err := client.Domains.DeleteRecord(ctx, "example.com", 1) if err != nil { t.Errorf("Domains.RecordDelete returned error: %v", err) } }
explode_data.jsonl/22677
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 144 }
[ 2830, 3393, 74713, 57418, 6471, 2461, 13636, 675, 1155, 353, 8840, 836, 8, 341, 84571, 741, 16867, 49304, 2822, 2109, 2200, 63623, 4283, 85, 17, 71344, 1735, 65182, 905, 14, 26203, 14, 16, 497, 2915, 3622, 1758, 37508, 11, 435, 353, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func Test_return_multiple_matches(t *testing.T) { projects := NewProjects() project1 := Project{Name: "A_PROJECT_1", FullPath: "FULL_PATH_1"} project2 := Project{Name: "A_PROJECT_2", FullPath: "FULL_PATH_2"} project3 := Project{Name: "B_PROJECT_3", FullPath: "FULL_PATH_3"} project4 := Project{Name: "B_PROJECT_4", FullPath: "FULL_PATH_4"} projects.AddAll([]Project{project1, project2, project3, project4}) filteredProjects := FuzzyMatch("B_PROJECT", projects) assert.EqualValues(t, []Project{project4, project3}, filteredProjects.List()) }
explode_data.jsonl/10979
{ "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, 12511, 45233, 38344, 1155, 353, 8840, 836, 8, 341, 197, 17161, 1669, 1532, 29958, 741, 72470, 16, 1669, 5787, 63121, 25, 330, 32, 43804, 62, 16, 497, 8627, 1820, 25, 330, 51649, 7944, 62, 16, 16707, 72470, 17, 1669, 5787, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestEngineMultipleQuery(t *testing.T) { config := DefaultConfig() config.Params = snowball.Parameters{ Metrics: prometheus.NewRegistry(), K: 3, Alpha: 2, BetaVirtuous: 1, BetaRogue: 2, ConcurrentRepolls: 1, } vdr0 := validators.GenerateRandomValidator(1) vdr1 := validators.GenerateRandomValidator(1) vdr2 := validators.GenerateRandomValidator(1) vals := validators.NewSet() config.Validators = vals vals.Add(vdr0) vals.Add(vdr1) vals.Add(vdr2) sender := &common.SenderTest{} sender.T = t config.Sender = sender sender.Default(true) vm := &VMTest{} vm.T = t config.VM = vm vm.Default(true) vm.CantSetPreference = false gBlk := &Blk{ id: GenerateID(), status: choices.Accepted, } vm.LastAcceptedF = func() ids.ID { return gBlk.ID() } sender.CantGetAcceptedFrontier = false te := &Transitive{} te.Initialize(config) te.finishBootstrapping() vm.LastAcceptedF = nil sender.CantGetAcceptedFrontier = true blk0 := &Blk{ parent: gBlk, id: GenerateID(), status: choices.Processing, bytes: []byte{1}, } queried := new(bool) queryRequestID := new(uint32) sender.PushQueryF = func(inVdrs ids.ShortSet, requestID uint32, blkID ids.ID, blkBytes []byte) { if *queried { t.Fatalf("Asked multiple times") } *queried = true *queryRequestID = requestID vdrSet := ids.ShortSet{} vdrSet.Add(vdr0.ID(), vdr1.ID(), vdr2.ID()) if !inVdrs.Equals(vdrSet) { t.Fatalf("Asking wrong validator for preference") } if !blk0.ID().Equals(blkID) { t.Fatalf("Asking for wrong block") } } te.insert(blk0) blk1 := &Blk{ parent: blk0, id: GenerateID(), status: choices.Processing, bytes: []byte{1}, } vm.GetBlockF = func(id ids.ID) (snowman.Block, error) { switch { case id.Equals(gBlk.ID()): return gBlk, nil case id.Equals(blk0.ID()): return blk0, nil case id.Equals(blk1.ID()): return &Blk{id: blk0.ID(), status: choices.Unknown}, errUnknownBlock } t.Fatalf("Unknown block") panic("Should have errored") } asked := new(bool) getRequestID := new(uint32) sender.GetF = func(inVdr ids.ShortID, requestID uint32, blkID ids.ID) { if *asked { t.Fatalf("Asked multiple times") } *asked = true *getRequestID = requestID if !vdr0.ID().Equals(inVdr) { t.Fatalf("Asking wrong validator for block") } if !blk1.ID().Equals(blkID) { t.Fatalf("Asking for wrong block") } } blkSet := ids.Set{} blkSet.Add(blk1.ID()) te.Chits(vdr0.ID(), *queryRequestID, blkSet) te.Chits(vdr1.ID(), *queryRequestID, blkSet) vm.ParseBlockF = func(b []byte) (snowman.Block, error) { vm.GetBlockF = func(blkID ids.ID) (snowman.Block, error) { switch { case blkID.Equals(blk0.ID()): return blk0, nil case blkID.Equals(blk1.ID()): return blk1, nil } t.Fatalf("Wrong block requested") panic("Should have failed") } return blk1, nil } *queried = false secondQueryRequestID := new(uint32) sender.PushQueryF = func(inVdrs ids.ShortSet, requestID uint32, blkID ids.ID, blkBytes []byte) { if *queried { t.Fatalf("Asked multiple times") } *queried = true *secondQueryRequestID = requestID vdrSet := ids.ShortSet{} vdrSet.Add(vdr0.ID(), vdr1.ID(), vdr2.ID()) if !inVdrs.Equals(vdrSet) { t.Fatalf("Asking wrong validator for preference") } if !blk1.ID().Equals(blkID) { t.Fatalf("Asking for wrong block") } } te.Put(vdr0.ID(), *getRequestID, blk1.ID(), blk1.Bytes()) // Should be dropped because the query was already filled blkSet = ids.Set{} blkSet.Add(blk0.ID()) te.Chits(vdr2.ID(), *queryRequestID, blkSet) if blk1.Status() != choices.Accepted { t.Fatalf("Should have executed block") } if len(te.blocked) != 0 { t.Fatalf("Should have finished blocking") } }
explode_data.jsonl/3558
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1735 }
[ 2830, 3393, 4571, 32089, 2859, 1155, 353, 8840, 836, 8, 341, 25873, 1669, 7899, 2648, 2822, 25873, 58268, 284, 11794, 3959, 13062, 515, 197, 9209, 13468, 25, 1843, 2706, 39705, 7121, 15603, 3148, 197, 39340, 25, 338, 220, 18, 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 TestStore_DeleteChunk(t *testing.T) { ctx := context.Background() metric1 := labels.Labels{ {Name: labels.MetricName, Value: "foo"}, {Name: "bar", Value: "baz"}, } metric2 := labels.Labels{ {Name: labels.MetricName, Value: "foo"}, {Name: "bar", Value: "baz2"}, } metric3 := labels.Labels{ {Name: labels.MetricName, Value: "foo"}, {Name: "bar", Value: "baz3"}, } fooChunk1 := dummyChunkForEncoding(model.Now(), metric1, encoding.Varbit, 200) err := fooChunk1.Encode() require.NoError(t, err) fooChunk2 := dummyChunkForEncoding(model.Now(), metric2, encoding.Varbit, 200) err = fooChunk2.Encode() require.NoError(t, err) nonExistentChunk := dummyChunkForEncoding(model.Now(), metric3, encoding.Varbit, 200) fooMetricNameMatcher, err := parser.ParseMetricSelector(`foo`) if err != nil { t.Fatal(err) } for _, tc := range []struct { name string chunks []Chunk chunkToDelete Chunk partialDeleteInterval *model.Interval err error numChunksToExpectAfterDeletion int }{ { name: "delete whole chunk", chunkToDelete: fooChunk1, numChunksToExpectAfterDeletion: 1, }, { name: "delete chunk partially at start", chunkToDelete: fooChunk1, partialDeleteInterval: &model.Interval{Start: fooChunk1.From, End: fooChunk1.From.Add(30 * time.Minute)}, numChunksToExpectAfterDeletion: 2, }, { name: "delete chunk partially at end", chunkToDelete: fooChunk1, partialDeleteInterval: &model.Interval{Start: fooChunk1.Through.Add(-30 * time.Minute), End: fooChunk1.Through}, numChunksToExpectAfterDeletion: 2, }, { name: "delete chunk partially in the middle", chunkToDelete: fooChunk1, partialDeleteInterval: &model.Interval{Start: fooChunk1.From.Add(15 * time.Minute), End: fooChunk1.Through.Add(-15 * time.Minute)}, numChunksToExpectAfterDeletion: 3, }, { name: "delete non-existent chunk", chunkToDelete: nonExistentChunk, numChunksToExpectAfterDeletion: 2, }, { name: "delete first second", chunkToDelete: fooChunk1, partialDeleteInterval: &model.Interval{Start: fooChunk1.From, End: fooChunk1.From}, numChunksToExpectAfterDeletion: 2, }, { name: "delete chunk out of range", chunkToDelete: fooChunk1, partialDeleteInterval: &model.Interval{Start: fooChunk1.Through.Add(time.Minute), End: fooChunk1.Through.Add(10 * time.Minute)}, numChunksToExpectAfterDeletion: 2, err: errors.Wrapf(ErrParialDeleteChunkNoOverlap, "chunkID=%s", fooChunk1.ExternalKey()), }, } { for _, schema := range schemas { t.Run(fmt.Sprintf("%s / %s", schema, tc.name), func(t *testing.T) { store := newTestChunkStore(t, schema) defer store.Stop() // inserting 2 chunks with different labels but same metric name err = store.Put(ctx, []Chunk{fooChunk1, fooChunk2}) require.NoError(t, err) // we expect to get 2 chunks back using just metric name matcher chunks, err := store.Get(ctx, userID, model.Now().Add(-time.Hour), model.Now(), fooMetricNameMatcher...) require.NoError(t, err) require.Equal(t, 2, len(chunks)) err = store.DeleteChunk(ctx, tc.chunkToDelete.From, tc.chunkToDelete.Through, userID, tc.chunkToDelete.ExternalKey(), tc.chunkToDelete.Metric, tc.partialDeleteInterval) if tc.err != nil { require.Error(t, err) require.Equal(t, tc.err.Error(), err.Error()) // we expect to get same results back if delete operation is expected to fail chunks, err := store.Get(ctx, userID, model.Now().Add(-time.Hour), model.Now(), fooMetricNameMatcher...) require.NoError(t, err) require.Equal(t, 2, len(chunks)) return } require.NoError(t, err) matchersForDeletedChunk, err := parser.ParseMetricSelector(tc.chunkToDelete.Metric.String()) require.NoError(t, err) var nonDeletedIntervals []model.Interval if tc.partialDeleteInterval != nil { nonDeletedIntervals = getNonDeletedIntervals(model.Interval{ Start: tc.chunkToDelete.From, End: tc.chunkToDelete.Through, }, *tc.partialDeleteInterval) } // we expect to get 1 non deleted chunk + new chunks that were created (if any) after partial deletion chunks, err = store.Get(ctx, userID, model.Now().Add(-time.Hour), model.Now(), fooMetricNameMatcher...) require.NoError(t, err) require.Equal(t, tc.numChunksToExpectAfterDeletion, len(chunks)) chunks, err = store.Get(ctx, userID, model.Now().Add(-time.Hour), model.Now(), matchersForDeletedChunk...) require.NoError(t, err) require.Equal(t, len(nonDeletedIntervals), len(chunks)) // comparing intervals of new chunks that were created after partial deletion for i, nonDeletedInterval := range nonDeletedIntervals { require.Equal(t, chunks[i].From, nonDeletedInterval.Start) require.Equal(t, chunks[i].Through, nonDeletedInterval.End) } }) } } }
explode_data.jsonl/43826
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 2440 }
[ 2830, 3393, 6093, 57418, 28304, 1155, 353, 8840, 836, 8, 341, 20985, 1669, 2266, 19047, 2822, 2109, 16340, 16, 1669, 9201, 4679, 82, 515, 197, 197, 63121, 25, 9201, 1321, 16340, 675, 11, 5162, 25, 330, 7975, 7115, 197, 197, 63121, 25,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
4
func TestMatchesDeploymentExclusion(t *testing.T) { cases := []struct { name string deployment *storage.Deployment policy *storage.Policy shouldMatch bool }{ { name: "No excluded scope", deployment: fixtures.GetDeployment(), policy: &storage.Policy{}, shouldMatch: false, }, { name: "Named excluded scope", deployment: fixtures.GetDeployment(), policy: &storage.Policy{ Exclusions: []*storage.Exclusion{ { Deployment: &storage.Exclusion_Deployment{Name: fixtures.GetDeployment().GetName()}, }, }, }, shouldMatch: true, }, { name: "Named excluded scope with matching regex", deployment: fixtures.GetDeployment(), policy: &storage.Policy{ Exclusions: []*storage.Exclusion{ { Deployment: &storage.Exclusion_Deployment{Name: "nginx.*"}, }, }, }, shouldMatch: true, }, { name: "Named excluded scope with non-matching regex", deployment: fixtures.GetDeployment(), policy: &storage.Policy{ Exclusions: []*storage.Exclusion{ { Deployment: &storage.Exclusion_Deployment{Name: "nginy.*"}, }, }, }, shouldMatch: false, }, { name: "Named excluded scope with invalid regex (ensure no error)", deployment: fixtures.GetDeployment(), policy: &storage.Policy{ Exclusions: []*storage.Exclusion{ { Deployment: &storage.Exclusion_Deployment{Name: "ngin\\K"}, }, }, }, shouldMatch: false, }, { name: "Named excluded scope, and another with a different name", deployment: fixtures.GetDeployment(), policy: &storage.Policy{ Exclusions: []*storage.Exclusion{ { Deployment: &storage.Exclusion_Deployment{Name: fixtures.GetDeployment().GetName()}, }, { Deployment: &storage.Exclusion_Deployment{Name: uuid.NewV4().String()}, }, }, }, shouldMatch: true, }, { name: "Named excluded scope with different name", deployment: fixtures.GetDeployment(), policy: &storage.Policy{ Exclusions: []*storage.Exclusion{ { Deployment: &storage.Exclusion_Deployment{Name: uuid.NewV4().String()}, }, }, }, shouldMatch: false, }, { name: "Scoped excluded scope", deployment: fixtures.GetDeployment(), policy: &storage.Policy{ Exclusions: []*storage.Exclusion{ { Deployment: &storage.Exclusion_Deployment{Scope: &storage.Scope{Namespace: fixtures.GetDeployment().GetNamespace()}}, }, }, }, shouldMatch: true, }, { name: "Scoped excluded scope with wrong name", deployment: fixtures.GetDeployment(), policy: &storage.Policy{ Exclusions: []*storage.Exclusion{ { Deployment: &storage.Exclusion_Deployment{Scope: &storage.Scope{Namespace: uuid.NewV4().String()}}, }, }, }, shouldMatch: false, }, { name: "Scoped excluded scope, but different name", deployment: fixtures.GetDeployment(), policy: &storage.Policy{ Exclusions: []*storage.Exclusion{ { Deployment: &storage.Exclusion_Deployment{Name: uuid.NewV4().String(), Scope: &storage.Scope{Namespace: fixtures.GetDeployment().GetNamespace()}}, }, }, }, shouldMatch: false, }, } for _, c := range cases { t.Run(c.name, func(t *testing.T) { compiledExclusions := make([]*compiledExclusion, 0, len(c.policy.GetExclusions())) for _, w := range c.policy.GetExclusions() { cw, err := newCompiledExclusion(w) require.NoError(t, err) compiledExclusions = append(compiledExclusions, cw) } got := deploymentMatchesExclusions(c.deployment, compiledExclusions) assert.Equal(t, c.shouldMatch, got) // If it should match, make sure it doesn't match if the exclusions are all expired. if c.shouldMatch { for _, exclusion := range c.policy.GetExclusions() { exclusion.Expiration = protoconv.MustConvertTimeToTimestamp(time.Now().Add(-1 * time.Hour)) } assert.False(t, deploymentMatchesExclusions(c.deployment, compiledExclusions)) for _, exclusion := range c.policy.GetExclusions() { exclusion.Expiration = protoconv.MustConvertTimeToTimestamp(time.Now().Add(time.Hour)) } assert.True(t, deploymentMatchesExclusions(c.deployment, compiledExclusions)) } c.policy.Exclusions = append(c.policy.Exclusions, &storage.Exclusion{Image: &storage.Exclusion_Image{Name: "BLAH"}}) assert.Equal(t, c.shouldMatch, got) }) } }
explode_data.jsonl/33210
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1886 }
[ 2830, 3393, 42470, 75286, 840, 8957, 1155, 353, 8840, 836, 8, 341, 1444, 2264, 1669, 3056, 1235, 341, 197, 11609, 286, 914, 198, 197, 197, 82213, 220, 353, 16172, 34848, 39130, 198, 197, 3223, 8018, 414, 353, 16172, 1069, 8018, 198, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
5
func TestMismatchedTime(t *testing.T) { tf.UnitTest(t) blockTime := clock.DefaultEpochDuration genTime := time.Unix(1234567890, 1234567890%int64(time.Second)) fc := clock.NewFake(genTime) mclock := clock.NewChainClockFromClock(uint64(genTime.Unix()), blockTime, fc) validator := consensus.NewDefaultBlockValidator(mclock) fc.Advance(blockTime) // Passes with correct timestamp c := &block.Block{Height: 1, Timestamp: uint64(fc.Now().Unix())} require.NoError(t, validator.TimeMatchesEpoch(c)) // fails with invalid timestamp c = &block.Block{Height: 1, Timestamp: uint64(genTime.Unix())} err := validator.TimeMatchesEpoch(c) assert.Error(t, err) assert.Contains(t, err.Error(), "wrong epoch") }
explode_data.jsonl/31026
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 256 }
[ 2830, 3393, 82572, 291, 1462, 1155, 353, 8840, 836, 8, 341, 3244, 69, 25159, 2271, 1155, 692, 47996, 1462, 1669, 8866, 13275, 44338, 12945, 198, 82281, 1462, 1669, 882, 10616, 941, 7, 16, 17, 18, 19, 20, 21, 22, 23, 24, 15, 11, 22...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestBuildOutputCycleResilience(t *testing.T) { config := &AppConfig{} mockIS := &image.ImageStream{ ObjectMeta: metav1.ObjectMeta{ Name: "mockimagestream", }, Spec: image.ImageStreamSpec{ Tags: make(map[string]image.TagReference), }, } mockIS.Spec.Tags["latest"] = image.TagReference{ From: &kapi.ObjectReference{ Kind: "DockerImage", Name: "mockimage:latest", }, } dfn := "mockdockerfilename" malOutputBC := &buildv1.BuildConfig{ ObjectMeta: metav1.ObjectMeta{ Name: "buildCfgWithWeirdOutputObjectRef", }, Spec: buildv1.BuildConfigSpec{ CommonSpec: buildv1.CommonSpec{ Source: buildv1.BuildSource{ Dockerfile: &dfn, }, Strategy: buildv1.BuildStrategy{ DockerStrategy: &buildv1.DockerBuildStrategy{ From: &corev1.ObjectReference{ Kind: "ImageStreamTag", Name: "mockimagestream:latest", }, }, }, Output: buildv1.BuildOutput{ To: &corev1.ObjectReference{ Kind: "NewTypeOfRef", Name: "Yet-to-be-implemented", }, }, }, }, } _, err := config.followRefToDockerImage(malOutputBC.Spec.Output.To, nil, []runtime.Object{malOutputBC, mockIS}) expected := "Unable to follow reference type: \"NewTypeOfRef\"" if err == nil || err.Error() != expected { t.Errorf("Expected error from followRefToDockerImage: got \"%v\" versus expected %q", err, expected) } }
explode_data.jsonl/42188
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 594 }
[ 2830, 3393, 11066, 5097, 44820, 1061, 321, 1835, 1155, 353, 8840, 836, 8, 1476, 25873, 1669, 609, 2164, 2648, 31483, 77333, 1637, 1669, 609, 1805, 7528, 3027, 515, 197, 23816, 12175, 25, 77520, 16, 80222, 515, 298, 21297, 25, 330, 16712...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestFastCard(t *testing.T) { bm := NewBitmap() bm.Add(1) bm.AddRange(21, 260000) bm2 := NewBitmap() bm2.Add(25) assert.EqualValues(t, 1, bm2.AndCardinality(bm)) assert.Equal(t, bm.GetCardinality(), bm2.OrCardinality(bm)) assert.EqualValues(t, 1, bm.AndCardinality(bm2)) assert.Equal(t, bm.GetCardinality(), bm.OrCardinality(bm2)) assert.EqualValues(t, 1, bm2.AndCardinality(bm)) assert.Equal(t, bm.GetCardinality(), bm2.OrCardinality(bm)) bm.RunOptimize() assert.EqualValues(t, 1, bm2.AndCardinality(bm)) assert.Equal(t, bm.GetCardinality(), bm2.OrCardinality(bm)) assert.EqualValues(t, 1, bm.AndCardinality(bm2)) assert.Equal(t, bm.GetCardinality(), bm.OrCardinality(bm2)) assert.EqualValues(t, 1, bm2.AndCardinality(bm)) assert.Equal(t, bm.GetCardinality(), bm2.OrCardinality(bm)) }
explode_data.jsonl/20329
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 374 }
[ 2830, 3393, 32174, 5770, 1155, 353, 8840, 836, 8, 341, 2233, 76, 1669, 1532, 16773, 741, 2233, 76, 1904, 7, 16, 340, 2233, 76, 19672, 7, 17, 16, 11, 220, 17, 21, 15, 15, 15, 15, 340, 2233, 76, 17, 1669, 1532, 16773, 741, 2233, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_ServiceFieldProvide(t *testing.T) { c := NewLidi(Settings{}) s1 := "awesome" s2 := 15 s3 := &S3{} if err := c.Provide(s1); err != nil { t.Fatal(err) } if err := c.Provide(s2); err != nil { t.Fatal(err) } if err := c.Provide(s3); err != nil { t.Fatal(err) } err := c.InvokeFunction(func(s *S3) { if s.Service1 != "awesome" { t.Fatal("Not Equal") } if s.Service2 != 15 { t.Fatal("Not Equal") } }) if err != nil { t.Error(err) } }
explode_data.jsonl/40204
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 240 }
[ 2830, 3393, 52548, 1877, 60424, 1155, 353, 8840, 836, 8, 341, 1444, 1669, 1532, 43, 12278, 57395, 6257, 692, 1903, 16, 1669, 330, 16875, 698, 1903, 17, 1669, 220, 16, 20, 198, 1903, 18, 1669, 609, 50, 18, 31483, 743, 1848, 1669, 272...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestOrderedAttributesWriteJSON(t *testing.T) { ats := map[string]interface{}{ "z": 123, "b": "hello", "a": true, "x": 13579, "m": "zap", "c": "zip", } got := string(MarshalOrderedAttributes(ats)) if got != `{"a":true,"b":"hello","c":"zip","m":"zap","x":13579,"z":123}` { t.Error(got) } }
explode_data.jsonl/73543
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 145 }
[ 2830, 3393, 54384, 10516, 7985, 5370, 1155, 353, 8840, 836, 8, 341, 197, 1862, 1669, 2415, 14032, 31344, 67066, 197, 197, 1, 89, 788, 220, 16, 17, 18, 345, 197, 197, 1, 65, 788, 330, 14990, 756, 197, 197, 56693, 788, 830, 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...
2
func TestNewMappingRuleSnapshotFromV2ProtoInvalidProto(t *testing.T) { filterOpts := testTagsFilterOptions() proto := &rulepb.MappingRuleSnapshot{ AggregationTypes: []aggregationpb.AggregationType{ aggregationpb.AggregationType_UNKNOWN, }, } _, err := newMappingRuleSnapshotFromProto(proto, filterOpts) require.Error(t, err) }
explode_data.jsonl/64563
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 123 }
[ 2830, 3393, 3564, 6807, 11337, 15009, 3830, 53, 17, 31549, 7928, 31549, 1155, 353, 8840, 836, 8, 341, 50108, 43451, 1669, 1273, 15930, 5632, 3798, 741, 197, 15110, 1669, 609, 12937, 16650, 76455, 11337, 15009, 515, 197, 197, 9042, 34442, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestWearAnotherItemAfterTakeOff(t *testing.T) { ctrl := gomock.NewController(t) char := character.New() item0 := mock_character.NewMockItem(ctrl) item1 := mock_character.NewMockItem(ctrl) char.AddItem(item0) char.AddItem(item1) item0.EXPECT().Wear(char).Return(nil) assert.NoError(t, char.WearOrTakeOff(0)) item0.EXPECT().TakeOff(char).Return(nil) assert.NoError(t, char.WearOrTakeOff(0)) item1.EXPECT().Wear(char).Return(nil) assert.NoError(t, char.WearOrTakeOff(1)) assert.Equal(t, item1, char.Wearing()) }
explode_data.jsonl/20230
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 217 }
[ 2830, 3393, 54, 682, 14037, 1234, 6025, 17814, 4596, 1155, 353, 8840, 836, 8, 341, 84381, 1669, 342, 316, 1176, 7121, 2051, 1155, 340, 7450, 1669, 3668, 7121, 2822, 22339, 15, 1669, 7860, 40988, 7121, 11571, 1234, 62100, 340, 22339, 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 TestCORS_AllowedOrigin_Subdomain(t *testing.T) { // Setup config to throttle our request buf := bytes.NewBufferString(H2ConfigJson) origConfigBuf := bytes.NewBuffer(config.Raw()) config.Load(buf) defer config.Load(origConfigBuf) time.Sleep(time.Second) // ...and a dummy thin API server server, apiClient := SetupTestServerAndClient(t) defer TeardownTestServer(t, server) request, err := http.NewRequest("OPTIONS", fmt.Sprintf("%s/throttle-test", server.URL), nil) request.Header.Set("Origin", "http://foo.bar-baz.boo.hailoweb.com") assert.NoError(t, err, "Request construction error") response, err := apiClient.Do(request) assert.NoError(t, err, "Request error") assert.Equal(t, 200, response.StatusCode) assert.Equal(t, "http://foo.bar-baz.boo.hailoweb.com", response.Header.Get("Access-Control-Allow-Origin"), "Access-Control-Allow-Origin header is not right") }
explode_data.jsonl/34490
{ "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, 34, 9821, 53629, 12817, 13298, 36359, 12204, 1155, 353, 8840, 836, 8, 341, 197, 322, 18626, 2193, 311, 42166, 1039, 1681, 198, 26398, 1669, 5820, 7121, 4095, 703, 10896, 17, 2648, 5014, 340, 197, 4670, 2648, 15064, 1669, 582...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestRunMinimumVersionDelegate(t *testing.T) { RegisterMockTestingT(t) mockDelegate := mocks.NewMockRunner() tfVersion12, _ := version.NewVersion("0.12.0") tfVersion11, _ := version.NewVersion("0.11.15") // these stay the same for all tests extraArgs := []string{"extra", "args"} envs := map[string]string{} path := "" expectedOut := "some valid output from delegate" t.Run("default version success", func(t *testing.T) { subject := &MinimumVersionStepRunnerDelegate{ defaultTfVersion: tfVersion12, minimumVersion: tfVersion12, delegate: mockDelegate, } ctx := models.ProjectCommandContext{} When(mockDelegate.Run(ctx, extraArgs, path, envs)).ThenReturn(expectedOut, nil) output, err := subject.Run( ctx, extraArgs, path, envs, ) Equals(t, expectedOut, output) Ok(t, err) }) t.Run("ctx version success", func(t *testing.T) { subject := &MinimumVersionStepRunnerDelegate{ defaultTfVersion: tfVersion11, minimumVersion: tfVersion12, delegate: mockDelegate, } ctx := models.ProjectCommandContext{ TerraformVersion: tfVersion12, } When(mockDelegate.Run(ctx, extraArgs, path, envs)).ThenReturn(expectedOut, nil) output, err := subject.Run( ctx, extraArgs, path, envs, ) Equals(t, expectedOut, output) Ok(t, err) }) t.Run("default version failure", func(t *testing.T) { subject := &MinimumVersionStepRunnerDelegate{ defaultTfVersion: tfVersion11, minimumVersion: tfVersion12, delegate: mockDelegate, } ctx := models.ProjectCommandContext{} output, err := subject.Run( ctx, extraArgs, path, envs, ) mockDelegate.VerifyWasCalled(Never()) Equals(t, "Version: 0.11.15 is unsupported for this step. Minimum version is: 0.12.0", output) Ok(t, err) }) t.Run("ctx version failure", func(t *testing.T) { subject := &MinimumVersionStepRunnerDelegate{ defaultTfVersion: tfVersion12, minimumVersion: tfVersion12, delegate: mockDelegate, } ctx := models.ProjectCommandContext{ TerraformVersion: tfVersion11, } output, err := subject.Run( ctx, extraArgs, path, envs, ) mockDelegate.VerifyWasCalled(Never()) Equals(t, "Version: 0.11.15 is unsupported for this step. Minimum version is: 0.12.0", output) Ok(t, err) }) }
explode_data.jsonl/30618
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 935 }
[ 2830, 3393, 6727, 28695, 5637, 9381, 1155, 353, 8840, 836, 8, 341, 79096, 11571, 16451, 51, 1155, 692, 77333, 9381, 1669, 68909, 7121, 11571, 19486, 2822, 3244, 69, 5637, 16, 17, 11, 716, 1669, 2319, 7121, 5637, 445, 15, 13, 16, 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_NodeExists_Positive_NodeExists(t *testing.T) { // Arrange volumePluginMgr, _ := controllervolumetesting.GetTestVolumePluginMgr((t)) dsw := NewDesiredStateOfWorld(volumePluginMgr) notAddedNodeName := "node-not-added-name" // Act notAddedNodeExists := dsw.NodeExists(notAddedNodeName) // Assert if notAddedNodeExists { t.Fatalf("Node %q exists, it should not.", notAddedNodeName) } volumesToAttach := dsw.GetVolumesToAttach() if len(volumesToAttach) != 0 { t.Fatalf("len(volumesToAttach) Expected: <0> Actual: <%v>", len(volumesToAttach)) } }
explode_data.jsonl/40748
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 217 }
[ 2830, 3393, 41340, 15575, 44246, 3404, 41340, 15575, 1155, 353, 8840, 836, 8, 341, 197, 322, 40580, 198, 5195, 4661, 11546, 25567, 11, 716, 1669, 683, 1100, 648, 1132, 57824, 287, 2234, 2271, 18902, 11546, 25567, 1188, 83, 1171, 2698, 2...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestHitBreakpointIds(t *testing.T) { runTest(t, "locationsprog", func(client *daptest.Client, fixture protest.Fixture) { runDebugSessionWithBPs(t, client, "launch", // Launch func() { client.LaunchRequest("exec", fixture.Path, !stopOnEntry) }, // Set breakpoints fixture.Source, []int{30}, // b main.main []onBreakpoint{{ execute: func() { checkStop(t, client, 1, "main.main", 30) // Set two source breakpoints and two function breakpoints. client.SetBreakpointsRequest(fixture.Source, []int{23, 33}) sourceBps := client.ExpectSetBreakpointsResponse(t).Body.Breakpoints checkBreakpoints(t, client, []Breakpoint{{line: 23, path: fixture.Source, verified: true}, {line: 33, path: fixture.Source, verified: true}}, sourceBps) client.SetFunctionBreakpointsRequest([]dap.FunctionBreakpoint{ {Name: "anotherFunction"}, {Name: "anotherFunction:1"}, }) functionBps := client.ExpectSetFunctionBreakpointsResponse(t).Body.Breakpoints checkBreakpoints(t, client, []Breakpoint{{line: 26, path: fixture.Source, verified: true}, {line: 27, path: fixture.Source, verified: true}}, functionBps) client.ContinueRequest(1) client.ExpectContinueResponse(t) se := client.ExpectStoppedEvent(t) checkHitBreakpointIds(t, se, "breakpoint", sourceBps[1].Id) checkStop(t, client, 1, "main.main", 33) client.ContinueRequest(1) client.ExpectContinueResponse(t) se = client.ExpectStoppedEvent(t) checkHitBreakpointIds(t, se, "breakpoint", sourceBps[0].Id) checkStop(t, client, 1, "main.(*SomeType).SomeFunction", 23) client.ContinueRequest(1) client.ExpectContinueResponse(t) se = client.ExpectStoppedEvent(t) checkHitBreakpointIds(t, se, "function breakpoint", functionBps[0].Id) checkStop(t, client, 1, "main.anotherFunction", 26) client.ContinueRequest(1) client.ExpectContinueResponse(t) se = client.ExpectStoppedEvent(t) checkHitBreakpointIds(t, se, "function breakpoint", functionBps[1].Id) checkStop(t, client, 1, "main.anotherFunction", 27) }, disconnect: true, }}) }) }
explode_data.jsonl/17325
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 850 }
[ 2830, 3393, 19498, 22524, 2768, 12701, 1155, 353, 8840, 836, 8, 341, 56742, 2271, 1155, 11, 330, 31309, 32992, 497, 2915, 12805, 353, 91294, 1944, 11716, 11, 12507, 8665, 991, 12735, 8, 341, 197, 56742, 7939, 5283, 2354, 33, 20420, 1155...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestGetPartitions(t *testing.T) { run := 0 executor := &exectest.MockExecutor{ MockExecuteCommandWithOutput: func(command string, arg ...string) (string, error) { run++ logger.Infof("run %d command %s", run, command) switch { case run == 1: return `NAME="sdc" SIZE="100000" TYPE="disk" PKNAME=""`, nil case run == 2: return `NAME="sdb" SIZE="65" TYPE="disk" PKNAME="" NAME="sdb2" SIZE="10" TYPE="part" PKNAME="sdb" NAME="sdb3" SIZE="20" TYPE="part" PKNAME="sdb" NAME="sdb1" SIZE="30" TYPE="part" PKNAME="sdb"`, nil case run == 3: return fmt.Sprintf(udevPartOutput, "ROOK-OSD0-DB"), nil case run == 4: return fmt.Sprintf(udevPartOutput, "ROOK-OSD0-BLOCK"), nil case run == 5: return fmt.Sprintf(udevPartOutput, "ROOK-OSD0-WAL"), nil case run == 6: return `NAME="sda" SIZE="19818086400" TYPE="disk" PKNAME="" NAME="sda4" SIZE="1073741824" TYPE="part" PKNAME="sda" NAME="sda2" SIZE="2097152" TYPE="part" PKNAME="sda" NAME="sda9" SIZE="17328766976" TYPE="part" PKNAME="sda" NAME="sda7" SIZE="67108864" TYPE="part" PKNAME="sda" NAME="sda3" SIZE="1073741824" TYPE="part" PKNAME="sda" NAME="usr" SIZE="1065345024" TYPE="crypt" PKNAME="sda3" NAME="sda1" SIZE="134217728" TYPE="part" PKNAME="sda" NAME="sda6" SIZE="134217728" TYPE="part" PKNAME="sda"`, nil case run == 14: return `NAME="dm-0" SIZE="100000" TYPE="lvm" PKNAME="" NAME="ceph--89fa04fa--b93a--4874--9364--c95be3ec01c6-osd--data--70847bdb--2ec1--4874--98ba--d87d4860a70d" SIZE="31138512896" TYPE="lvm" PKNAME=""`, nil } return "", nil }, } partitions, unused, err := GetDevicePartitions("sdc", executor) assert.Nil(t, err) assert.Equal(t, uint64(100000), unused) assert.Equal(t, 0, len(partitions)) partitions, unused, err = GetDevicePartitions("sdb", executor) assert.Nil(t, err) assert.Equal(t, uint64(5), unused) assert.Equal(t, 3, len(partitions)) assert.Equal(t, uint64(10), partitions[0].Size) assert.Equal(t, "ROOK-OSD0-DB", partitions[0].Label) assert.Equal(t, "sdb2", partitions[0].Name) partitions, unused, err = GetDevicePartitions("sda", executor) assert.Nil(t, err) assert.Equal(t, uint64(0x400000), unused) assert.Equal(t, 7, len(partitions)) partitions, _, err = GetDevicePartitions("dm-0", executor) assert.Nil(t, err) assert.Equal(t, 0, len(partitions)) partitions, _, err = GetDevicePartitions("sdx", executor) assert.Nil(t, err) assert.Equal(t, 0, len(partitions)) }
explode_data.jsonl/65041
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1065 }
[ 2830, 3393, 1949, 5800, 5930, 1155, 353, 8840, 836, 8, 341, 56742, 1669, 220, 15, 198, 67328, 4831, 1669, 609, 327, 439, 477, 24664, 25255, 515, 197, 9209, 1176, 17174, 4062, 2354, 5097, 25, 2915, 15143, 914, 11, 1392, 2503, 917, 8, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
8
func TestService_Register(t *testing.T) { service := Service{} server := grpc.NewServer() m := manager.GetManager() m.Dispatcher = dispatcher.NewDispatcher() service.Register(server) // If the registration does not crash with a fatal error it was successful }
explode_data.jsonl/40356
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 80 }
[ 2830, 3393, 1860, 73124, 1155, 353, 8840, 836, 8, 341, 52934, 1669, 5362, 16094, 41057, 1669, 47900, 7121, 5475, 741, 2109, 1669, 6645, 2234, 2043, 741, 2109, 96868, 284, 38799, 7121, 21839, 741, 52934, 19983, 21421, 340, 197, 322, 1416, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestAgent_ForceLeave_ACLDeny(t *testing.T) { t.Parallel() a := NewTestAgent(t.Name(), TestACLConfig()) defer a.Shutdown() t.Run("no token", func(t *testing.T) { req, _ := http.NewRequest("PUT", "/v1/agent/force-leave/nope", nil) if _, err := a.srv.AgentForceLeave(nil, req); !acl.IsErrPermissionDenied(err) { t.Fatalf("err: %v", err) } }) t.Run("agent master token", func(t *testing.T) { req, _ := http.NewRequest("PUT", "/v1/agent/force-leave/nope?token=towel", nil) if _, err := a.srv.AgentForceLeave(nil, req); err != nil { t.Fatalf("err: %v", err) } }) t.Run("read-only token", func(t *testing.T) { ro := makeReadOnlyAgentACL(t, a.srv) req, _ := http.NewRequest("PUT", fmt.Sprintf("/v1/agent/force-leave/nope?token=%s", ro), nil) if _, err := a.srv.AgentForceLeave(nil, req); !acl.IsErrPermissionDenied(err) { t.Fatalf("err: %v", err) } }) }
explode_data.jsonl/33609
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 398 }
[ 2830, 3393, 16810, 1400, 16316, 21833, 97627, 23619, 88, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 741, 11323, 1669, 1532, 2271, 16810, 1155, 2967, 1507, 3393, 55393, 2648, 2398, 16867, 264, 10849, 18452, 2822, 3244, 16708, 445, 21...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestHeightToHashRange(t *testing.T) { // Construct a synthetic block chain with a block index consisting of // the following structure. // genesis -> 1 -> 2 -> ... -> 15 -> 16 -> 17 -> 18 // \-> 16a -> 17a -> 18a (unvalidated) tip := tstTip chain := newFakeChain(&chaincfg.MainNetParams) branch0Nodes := chainedNodes(chain.bestChain.Genesis(), 18) branch1Nodes := chainedNodes(branch0Nodes[14], 3) for _, node := range branch0Nodes { chain.index.SetStatusFlags(node, statusValid) chain.index.AddNode(node) } for _, node := range branch1Nodes { if node.height < 18 { chain.index.SetStatusFlags(node, statusValid) } chain.index.AddNode(node) } chain.bestChain.SetTip(tip(branch0Nodes)) tests := []struct { name string startHeight int32 // locator for requested inventory endHash chainhash.Hash // stop hash for locator maxResults int // max to locate, 0 = wire const hashes []chainhash.Hash // expected located hashes expectError bool }{ { name: "blocks below tip", startHeight: 11, endHash: branch0Nodes[14].hash, maxResults: 10, hashes: nodeHashes(branch0Nodes, 10, 11, 12, 13, 14), }, { name: "blocks on main chain", startHeight: 15, endHash: branch0Nodes[17].hash, maxResults: 10, hashes: nodeHashes(branch0Nodes, 14, 15, 16, 17), }, { name: "blocks on stale chain", startHeight: 15, endHash: branch1Nodes[1].hash, maxResults: 10, hashes: append(nodeHashes(branch0Nodes, 14), nodeHashes(branch1Nodes, 0, 1)...), }, { name: "invalid start height", startHeight: 19, endHash: branch0Nodes[17].hash, maxResults: 10, expectError: true, }, { name: "too many results", startHeight: 1, endHash: branch0Nodes[17].hash, maxResults: 10, expectError: true, }, { name: "unvalidated block", startHeight: 15, endHash: branch1Nodes[2].hash, maxResults: 10, expectError: true, }, } for _, test := range tests { hashes, err := chain.HeightToHashRange(test.startHeight, &test.endHash, test.maxResults) if err != nil { if !test.expectError { t.Errorf("%s: unexpected error: %v", test.name, err) } continue } if !reflect.DeepEqual(hashes, test.hashes) { t.Errorf("%s: unxpected hashes -- got %v, want %v", test.name, hashes, test.hashes) } } }
explode_data.jsonl/77661
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1121 }
[ 2830, 3393, 3640, 1249, 6370, 6046, 1155, 353, 8840, 836, 8, 341, 197, 322, 18678, 264, 27268, 2504, 8781, 448, 264, 2504, 1922, 30606, 315, 198, 197, 322, 279, 2701, 5944, 624, 197, 322, 220, 82281, 13774, 1464, 220, 16, 1464, 220, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
8
func TestMatGemm(t *testing.T) { src1 := NewMatWithSize(3, 4, MatTypeCV32F) defer src1.Close() src2 := NewMatWithSize(4, 3, MatTypeCV32F) defer src2.Close() src3 := NewMat() defer src3.Close() dst := NewMat() defer dst.Close() Gemm(src1, src2, 1, src3, 0, &dst, 0) if dst.Empty() { t.Error("Gemm dst should not be empty.") } if dst.Rows() != src1.Rows() { t.Error("Gemm src and dst size should be same.") } }
explode_data.jsonl/81743
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 196 }
[ 2830, 3393, 11575, 38, 72419, 1155, 353, 8840, 836, 8, 341, 41144, 16, 1669, 1532, 11575, 2354, 1695, 7, 18, 11, 220, 19, 11, 6867, 929, 19589, 18, 17, 37, 340, 16867, 2286, 16, 10421, 2822, 41144, 17, 1669, 1532, 11575, 2354, 1695,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestShadowDSN(t *testing.T) { type args struct { dsn string } tests := []struct { name string args args want string }{ { name: "localhost:55432", args: args{ dsn: "postgres://userDsn:passwordDsn@localhost:55432/?sslmode=disabled", }, want: "postgres://userDsn:%2A%2A%2A%2A%2A%2A@localhost:55432/?sslmode=disabled", }, { name: "localhost:55432", args: args{ dsn: "postgres://gaussdb:Test@123@127.0.0.1:5432/postgres?sslmode=disable", }, want: "postgres://gaussdb:%2A%2A%2A%2A%2A%2A@127.0.0.1:5432/postgres?sslmode=disable", }, { name: "localhost:55432", args: args{ dsn: "postgres://userDsn:xxxxx@localhost:55432/?sslmode=disabled", }, want: "postgres://userDsn:%2A%2A%2A%2A%2A%2A@localhost:55432/?sslmode=disabled", }, { name: "127.0.0.1:5432", args: args{ dsn: "user=xxx password=xxx host=127.0.0.1 port=5432 dbname=postgres sslmode=disable", }, want: "user=xxx%20password=xxx%20host=127.0.0.1%20port=5432%20dbname=postgres%20sslmode=disable", }, { name: "localhost:1234", args: args{ dsn: "port=1234", }, want: "port=1234", }, { name: "example:5432", args: args{ dsn: "host=example", }, want: "host=example", }, { name: "xyz", args: args{ dsn: "xyz", }, want: "xyz", }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { if got := ShadowDSN(tt.args.dsn); got != tt.want { t.Errorf("ShadowDSN() = %v, want %v", got, tt.want) } }) } }
explode_data.jsonl/27589
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 783 }
[ 2830, 3393, 23667, 5936, 45, 1155, 353, 8840, 836, 8, 341, 13158, 2827, 2036, 341, 197, 2698, 9613, 914, 198, 197, 532, 78216, 1669, 3056, 1235, 341, 197, 11609, 914, 198, 197, 31215, 2827, 198, 197, 50780, 914, 198, 197, 59403, 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 TestCreateOnApplyFailsWithUID(t *testing.T) { defer featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, genericfeatures.ServerSideApply, true)() _, client, closeFn := setup(t) defer closeFn() _, err := client.CoreV1().RESTClient().Patch(types.ApplyPatchType). Namespace("default"). Resource("pods"). Name("test-pod-uid"). Param("fieldManager", "apply_test"). Body([]byte(`{ "apiVersion": "v1", "kind": "Pod", "metadata": { "name": "test-pod-uid", "uid": "88e00824-7f0e-11e8-94a1-c8d3ffb15800" }, "spec": { "containers": [{ "name": "test-container", "image": "test-image" }] } }`)). Do(context.TODO()). Get() if !apierrors.IsConflict(err) { t.Fatalf("Expected conflict error but got: %v", err) } }
explode_data.jsonl/53464
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 357 }
[ 2830, 3393, 4021, 1925, 28497, 37, 6209, 2354, 6463, 1155, 353, 8840, 836, 8, 341, 16867, 4565, 70, 266, 57824, 287, 4202, 13859, 42318, 16014, 2271, 1155, 11, 4094, 12753, 13275, 13859, 42318, 11, 13954, 20304, 22997, 16384, 28497, 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 TestGetActualWildcardAndLocalHost(t *testing.T) { tests := []struct { name string proxy *model.Proxy expected [2]string }{ { name: "ipv4 only", proxy: &model.Proxy{ IPAddresses: []string{"1.1.1.1", "127.0.0.1", "2.2.2.2"}, }, expected: [2]string{WildcardAddress, LocalhostAddress}, }, { name: "ipv6 only", proxy: &model.Proxy{ IPAddresses: []string{"1111:2222::1", "::1", "2222:3333::1"}, }, expected: [2]string{WildcardIPv6Address, LocalhostIPv6Address}, }, { name: "mixed ipv4 and ipv6", proxy: &model.Proxy{ IPAddresses: []string{"1111:2222::1", "::1", "127.0.0.1", "2.2.2.2", "2222:3333::1"}, }, expected: [2]string{WildcardAddress, LocalhostAddress}, }, } for _, tt := range tests { wm, lh := getActualWildcardAndLocalHost(tt.proxy) if wm != tt.expected[0] && lh != tt.expected[1] { t.Errorf("Test %s failed, expected: %s / %s got: %s / %s", tt.name, tt.expected[0], tt.expected[1], wm, lh) } } }
explode_data.jsonl/61273
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 474 }
[ 2830, 3393, 1949, 28123, 92988, 3036, 7319, 9296, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 3056, 1235, 341, 197, 11609, 257, 914, 198, 197, 197, 22803, 262, 353, 2528, 75200, 198, 197, 42400, 508, 17, 30953, 198, 197, 59403, 197, 19...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
4
func TestCloseStmtBeforeRows(t *testing.T) { db := newTestDB(t, "people") defer closeDB(t, db) s, err := db.Prepare("SELECT|people|name|") if err != nil { t.Fatal(err) } r, err := s.Query() if err != nil { s.Close() t.Fatal(err) } err = s.Close() if err != nil { t.Fatal(err) } r.Close() }
explode_data.jsonl/15986
{ "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, 7925, 31063, 10227, 9024, 1155, 353, 8840, 836, 8, 341, 20939, 1669, 501, 2271, 3506, 1155, 11, 330, 16069, 1138, 16867, 3265, 3506, 1155, 11, 2927, 692, 1903, 11, 1848, 1669, 2927, 28770, 3380, 445, 4858, 91, 16069, 91, 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...
4
func Test_query_dsl_function_score_query_eff2fc92d46eb3c8f4d424eed18f54a2(t *testing.T) { es, _ := elasticsearch.NewDefaultClient() // tag:eff2fc92d46eb3c8f4d424eed18f54a2[] res, err := es.Search( es.Search.WithBody(strings.NewReader(`{ "query": { "function_score": { "query": { "match_all": {} }, "boost": "5", "random_score": {}, "boost_mode": "multiply" } } }`)), es.Search.WithPretty(), ) fmt.Println(res, err) if err != nil { // SKIP t.Fatalf("Error getting the response: %s", err) // SKIP } // SKIP defer res.Body.Close() // SKIP // end:eff2fc92d46eb3c8f4d424eed18f54a2[] }
explode_data.jsonl/39408
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 333 }
[ 2830, 3393, 5738, 814, 3226, 9174, 10405, 5738, 51945, 17, 8316, 24, 17, 67, 19, 21, 3065, 18, 66, 23, 69, 19, 67, 19, 17, 19, 12051, 16, 23, 69, 20, 19, 64, 17, 1155, 353, 8840, 836, 8, 341, 78966, 11, 716, 1669, 655, 27791, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestIDPartsExtraction(t *testing.T) { for i, v := range IDs { assert.Equal(t, v.id.Time(), time.Unix(v.timestamp, 0), "#%d timestamp", i) assert.Equal(t, v.id.Machine(), v.machine, "#%d machine", i) assert.Equal(t, v.id.Pid(), v.pid, "#%d pid", i) assert.Equal(t, v.id.Counter(), v.counter, "#%d counter", i) } }
explode_data.jsonl/58918
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 145 }
[ 2830, 3393, 915, 28921, 840, 26425, 1155, 353, 8840, 836, 8, 341, 2023, 600, 11, 348, 1669, 2088, 28360, 341, 197, 6948, 12808, 1155, 11, 348, 1764, 16299, 1507, 882, 10616, 941, 3747, 22511, 11, 220, 15, 701, 5869, 4, 67, 11441, 49...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestFilteredByNonExistingSuffix(t *testing.T) { name := "carotte" ghLabel := &github.Label{ Name: &name, } prefixes := []string{"to", "cour"} assert.False(t, FilteredBy(HasSuffix, prefixes)(ghLabel)) }
explode_data.jsonl/16585
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 86 }
[ 2830, 3393, 67310, 1359, 8121, 53067, 40177, 1155, 353, 8840, 836, 8, 341, 11609, 1669, 330, 6918, 50011, 698, 197, 866, 2476, 1669, 609, 5204, 4679, 515, 197, 21297, 25, 609, 606, 345, 197, 630, 3223, 5060, 288, 1669, 3056, 917, 4913...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
func TestEnableAggregatedAPIs(t *testing.T) { mockCS := getMockBaseContainerService("1.10.3") properties := mockCS.Properties properties.OrchestratorProfile.OrchestratorType = Kubernetes properties.OrchestratorProfile.KubernetesConfig.EnableRbac = to.BoolPtr(false) mockCS.setOrchestratorDefaults(true, true) if properties.OrchestratorProfile.KubernetesConfig.EnableAggregatedAPIs { t.Fatalf("got unexpected EnableAggregatedAPIs config value for EnableRbac=false: %t", properties.OrchestratorProfile.KubernetesConfig.EnableAggregatedAPIs) } mockCS = getMockBaseContainerService("1.10.3") properties = mockCS.Properties properties.OrchestratorProfile.OrchestratorType = Kubernetes properties.OrchestratorProfile.KubernetesConfig.EnableRbac = to.BoolPtr(true) mockCS.setOrchestratorDefaults(true, true) if !properties.OrchestratorProfile.KubernetesConfig.EnableAggregatedAPIs { t.Fatalf("got unexpected EnableAggregatedAPIs config value for EnableRbac=true: %t", properties.OrchestratorProfile.KubernetesConfig.EnableAggregatedAPIs) } }
explode_data.jsonl/33883
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 371 }
[ 2830, 3393, 11084, 9042, 93040, 7082, 82, 1155, 353, 8840, 836, 8, 341, 77333, 6412, 1669, 633, 11571, 3978, 4502, 1860, 445, 16, 13, 16, 15, 13, 18, 1138, 86928, 1669, 7860, 6412, 15945, 198, 86928, 90449, 331, 15111, 850, 8526, 9044...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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