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 TestTypeSystem_ObjectFieldsMustHaveOutputTypes_RejectsAnEmptyObjectFieldType(t *testing.T) { _, err := schemaWithObjectFieldOfType(nil) expectedError := `BadObject.badField field type must be Output Type but got: <nil>.` if err == nil || err.Error() != expectedError { t.Fatalf("Expected error: %v, got %v", expectedError, err) } }
explode_data.jsonl/79177
{ "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, 929, 2320, 27839, 8941, 31776, 12116, 5097, 4173, 50693, 583, 82, 2082, 3522, 1190, 63733, 1155, 353, 8840, 836, 8, 341, 197, 6878, 1848, 1669, 10802, 2354, 1190, 1877, 34696, 27907, 340, 42400, 1454, 1669, 1565, 17082, 1190, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestZipkinExporter_invalidFormat(t *testing.T) { config := &Config{ HTTPClientSettings: confighttp.HTTPClientSettings{ Endpoint: "1.2.3.4", }, Format: "foobar", } f := NewFactory() params := component.ExporterCreateParams{Logger: zap.NewNop()} _, err := f.CreateTracesExporter(context.Background(), params, config) require.Error(t, err) }
explode_data.jsonl/33051
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 136 }
[ 2830, 3393, 31047, 7989, 88025, 31433, 4061, 1155, 353, 8840, 836, 8, 341, 25873, 1669, 609, 2648, 515, 197, 197, 9230, 2959, 6086, 25, 2335, 491, 790, 27358, 2959, 6086, 515, 298, 197, 27380, 25, 330, 16, 13, 17, 13, 18, 13, 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 TestContentTypeSaveForUpdate(t *testing.T) { var err error assert := assert.New(t) handler := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { assert.Equal(r.Method, "PUT") assert.Equal(r.RequestURI, "/spaces/"+spaceID+"/content_types/63Vgs0BFK0USe4i2mQUGK6") checkHeaders(r, assert) var payload map[string]interface{} err := json.NewDecoder(r.Body).Decode(&payload) assert.Nil(err) assert.Equal("ct-name-updated", payload["name"]) assert.Equal("ct-description-updated", payload["description"]) fields := payload["fields"].([]interface{}) assert.Equal(3, len(fields)) field1 := fields[0].(map[string]interface{}) field2 := fields[1].(map[string]interface{}) field3 := fields[2].(map[string]interface{}) assert.Equal("field1", field1["id"].(string)) assert.Equal("field1-name-updated", field1["name"].(string)) assert.Equal("String", field1["type"].(string)) assert.Equal("field2", field2["id"].(string)) assert.Equal("field2-name-updated", field2["name"].(string)) assert.Equal("Integer", field2["type"].(string)) assert.Nil(field2["disabled"]) assert.Equal("field3", field3["id"].(string)) assert.Equal("field3-name", field3["name"].(string)) assert.Equal("Date", field3["type"].(string)) assert.Equal(field3["id"].(string), payload["displayField"]) w.WriteHeader(200) fmt.Fprintln(w, string(readTestData("content_type-updated.json"))) }) // test server server := httptest.NewServer(handler) defer server.Close() // cma client cma = NewCMA(CMAToken) cma.BaseURL = server.URL // test content type ct, err := contentTypeFromTestData("content_type.json") assert.Nil(err) ct.Name = "ct-name-updated" ct.Description = "ct-description-updated" field1 := ct.Fields[0] field1.Name = "field1-name-updated" field1.Type = "String" field1.Required = false field2 := ct.Fields[1] field2.Name = "field2-name-updated" field2.Type = "Integer" field2.Disabled = false field3 := &Field{ ID: "field3", Name: "field3-name", Type: "Date", } ct.Fields = append(ct.Fields, field3) ct.DisplayField = ct.Fields[2].ID cma.ContentTypes.Upsert("id1", ct) assert.Nil(err) assert.Equal("63Vgs0BFK0USe4i2mQUGK6", ct.Sys.ID) assert.Equal("ct-name-updated", ct.Name) assert.Equal("ct-description-updated", ct.Description) assert.Equal(2, ct.Sys.Version) }
explode_data.jsonl/66080
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 948 }
[ 2830, 3393, 29504, 8784, 2461, 4289, 1155, 353, 8840, 836, 8, 341, 2405, 1848, 1465, 198, 6948, 1669, 2060, 7121, 1155, 692, 53326, 1669, 1758, 89164, 18552, 3622, 1758, 37508, 11, 435, 353, 1254, 9659, 8, 341, 197, 6948, 12808, 2601, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestDomainChainId(t *testing.T) { withoutChainID := core.TypedData{ Types: core.Types{ "EIP712Domain": []core.Type{ {Name: "name", Type: "string"}, }, }, Domain: core.TypedDataDomain{ Name: "test", }, } if _, ok := withoutChainID.Domain.Map()["chainId"]; ok { t.Errorf("Expected the chainId key to not be present in the domain map") } withChainID := core.TypedData{ Types: core.Types{ "EIP712Domain": []core.Type{ {Name: "name", Type: "string"}, {Name: "chainId", Type: "uint256"}, }, }, Domain: core.TypedDataDomain{ Name: "test", ChainId: big.NewInt(1), }, } if _, ok := withChainID.Domain.Map()["chainId"]; !ok { t.Errorf("Expected the chainId key be present in the domain map") } }
explode_data.jsonl/29996
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 323 }
[ 2830, 3393, 13636, 18837, 764, 1155, 353, 8840, 836, 8, 341, 197, 28996, 18837, 915, 1669, 6200, 98152, 1043, 515, 197, 197, 4173, 25, 6200, 29147, 515, 298, 197, 77199, 3298, 22, 16, 17, 13636, 788, 3056, 2153, 10184, 515, 571, 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 TestSwift(t *testing.T) { reader := strings.NewReader(`class NamedShape { var numberOfSides: Int = 0 var name: String init(name: String) { self.name = name } // example func simpleDescription() -> String { return "A shape with \(numberOfSides) sides." } } `) result, err := dialect.Examine("Swift", "foo.swift", reader, nil) if err != nil { t.Fatal(err) } if result == nil { t.Fatal("result was nil") } if result.Loc != 13 { t.Fatalf("result.Loc should have been 13, was %d", result.Loc) } if result.Sloc != 10 { t.Fatalf("result.Sloc should have been 10, was %d", result.Sloc) } if result.Comments != 1 { t.Fatalf("result.Comments should have been 1, was %d", result.Comments) } if result.Blanks != 2 { t.Fatalf("result.Blanks should have been 2, was %d", result.Blanks) } if result.IsTest { t.Fatal("result.IsTest should have been false, was true") } }
explode_data.jsonl/44408
{ "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, 55336, 1155, 353, 8840, 836, 8, 341, 61477, 1669, 9069, 68587, 5809, 1040, 40459, 12301, 341, 262, 762, 17512, 50, 3341, 25, 1333, 284, 220, 15, 198, 262, 762, 829, 25, 923, 271, 262, 2930, 3153, 25, 923, 8, 341, 286, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestPathRoot(t *testing.T) { orig, origExists := os.LookupEnv("GHW_CHROOT") if origExists { // For tests, save the original, test an override and then at the end // of the test, reset to the original defer os.Setenv("GHW_CHROOT", orig) os.Unsetenv("GHW_CHROOT") } else { defer os.Unsetenv("GHW_CHROOT") } ctx := context.FromEnv() paths := linuxpath.New(ctx) // No environment variable is set for GHW_CHROOT, so pathProcCpuinfo() should // return the default "/proc/cpuinfo" path := paths.ProcCpuinfo if path != "/proc/cpuinfo" { t.Fatalf("Expected pathProcCpuInfo() to return '/proc/cpuinfo' but got %s", path) } // Now set the GHW_CHROOT environ variable and verify that pathRoot() // returns that value os.Setenv("GHW_CHROOT", "/host") ctx = context.FromEnv() paths = linuxpath.New(ctx) path = paths.ProcCpuinfo if path != "/host/proc/cpuinfo" { t.Fatalf("Expected path.ProcCpuinfo to return '/host/proc/cpuinfo' but got %s", path) } }
explode_data.jsonl/1954
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 380 }
[ 2830, 3393, 1820, 8439, 1155, 353, 8840, 836, 8, 341, 197, 4670, 11, 2713, 15575, 1669, 2643, 79261, 14359, 445, 38, 38252, 6466, 23888, 1138, 743, 2713, 15575, 341, 197, 197, 322, 1752, 7032, 11, 3581, 279, 4024, 11, 1273, 458, 2812,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestE12ReceiverIsOperand(t *testing.T) { parameters := gopter.DefaultTestParameters() parameters.MinSuccessfulTests = 100 properties := gopter.NewProperties(parameters) genA := GenE12() genB := GenE12() properties.Property("[BLS381] Having the receiver as operand (addition) should output the same result", prop.ForAll( func(a, b *e12) bool { var c, d e12 d.Set(a) c.Add(a, b) a.Add(a, b) b.Add(&d, b) return a.Equal(b) && a.Equal(&c) && b.Equal(&c) }, genA, genB, )) properties.Property("[BLS381] Having the receiver as operand (sub) should output the same result", prop.ForAll( func(a, b *e12) bool { var c, d e12 d.Set(a) c.Sub(a, b) a.Sub(a, b) b.Sub(&d, b) return a.Equal(b) && a.Equal(&c) && b.Equal(&c) }, genA, genB, )) properties.Property("[BLS381] Having the receiver as operand (mul) should output the same result", prop.ForAll( func(a, b *e12) bool { var c, d e12 d.Set(a) c.Mul(a, b) a.Mul(a, b) b.Mul(&d, b) return a.Equal(b) && a.Equal(&c) && b.Equal(&c) }, genA, genB, )) properties.Property("[BLS381] Having the receiver as operand (square) should output the same result", prop.ForAll( func(a *e12) bool { var b e12 b.Square(a) a.Square(a) return a.Equal(&b) }, genA, )) properties.Property("[BLS381] Having the receiver as operand (double) should output the same result", prop.ForAll( func(a *e12) bool { var b e12 b.Double(a) a.Double(a) return a.Equal(&b) }, genA, )) properties.Property("[BLS381] Having the receiver as operand (Inverse) should output the same result", prop.ForAll( func(a *e12) bool { var b e12 b.Inverse(a) a.Inverse(a) return a.Equal(&b) }, genA, )) properties.Property("[BLS381] Having the receiver as operand (Cyclotomic square) should output the same result", prop.ForAll( func(a *e12) bool { var b e12 b.CyclotomicSquare(a) a.CyclotomicSquare(a) return a.Equal(&b) }, genA, )) properties.Property("[BLS381] Having the receiver as operand (Conjugate) should output the same result", prop.ForAll( func(a *e12) bool { var b e12 b.Conjugate(a) a.Conjugate(a) return a.Equal(&b) }, genA, )) properties.Property("[BLS381] Having the receiver as operand (Frobenius) should output the same result", prop.ForAll( func(a *e12) bool { var b e12 b.Frobenius(a) a.Frobenius(a) return a.Equal(&b) }, genA, )) properties.Property("[BLS381] Having the receiver as operand (FrobeniusSquare) should output the same result", prop.ForAll( func(a *e12) bool { var b e12 b.FrobeniusSquare(a) a.FrobeniusSquare(a) return a.Equal(&b) }, genA, )) properties.Property("[BLS381] Having the receiver as operand (FrobeniusCube) should output the same result", prop.ForAll( func(a *e12) bool { var b e12 b.FrobeniusCube(a) a.FrobeniusCube(a) return a.Equal(&b) }, genA, )) properties.TestingRun(t, gopter.ConsoleReporter(false)) }
explode_data.jsonl/58659
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1364 }
[ 2830, 3393, 36, 16, 17, 25436, 3872, 29940, 1155, 353, 8840, 836, 8, 1476, 67543, 1669, 728, 73137, 13275, 2271, 9706, 741, 67543, 17070, 36374, 18200, 284, 220, 16, 15, 15, 271, 86928, 1669, 728, 73137, 7121, 7903, 37959, 692, 82281, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestNewRsaPublicKeyImpl(t *testing.T) { require.NotNil(t, rand.Reader) rsaKey, err := rsa.GenerateKey(rand.Reader, 2048) require.NoError(t, err) require.Nil(t, rsaKey.Validate()) jwk, err := JwkFromPrivateKey(rsaKey, []jose.KeyOps{jose.KeyOpsDecrypt}, nil) require.NoError(t, err) k, err := NewRsaDecryptionKey(jwk) require.NoError(t, err) assert.NotNil(t, k) }
explode_data.jsonl/20927
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 164 }
[ 2830, 3393, 3564, 49, 9081, 61822, 9673, 1155, 353, 8840, 836, 8, 341, 17957, 93882, 1155, 11, 10382, 47431, 340, 41231, 64, 1592, 11, 1848, 1669, 68570, 57582, 1592, 37595, 47431, 11, 220, 17, 15, 19, 23, 340, 17957, 35699, 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 TestTypeForNameNotFound(t *testing.T) { for _, test := range []string{ "grpc.testing.not_exiting", } { _, err := s.typeForName(test) if err == nil { t.Errorf("typeForName(%q) = _, %v, want _, <non-nil>", test, err) } } }
explode_data.jsonl/79211
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 111 }
[ 2830, 3393, 929, 2461, 675, 10372, 1155, 353, 8840, 836, 8, 341, 2023, 8358, 1273, 1669, 2088, 3056, 917, 515, 197, 197, 1, 56585, 45056, 11971, 2702, 5853, 756, 197, 92, 341, 197, 197, 6878, 1848, 1669, 274, 4852, 2461, 675, 8623, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestMetricsForwarder_updateCredsIfNeeded(t *testing.T) { tests := []struct { name string loadFunc func() (*metricsForwarder, *fakeMetricsForwarder) apiKey string appKey string wantErr bool wantFunc func(*metricsForwarder, *fakeMetricsForwarder) error }{ { name: "same creds, no update", loadFunc: func() (*metricsForwarder, *fakeMetricsForwarder) { f := &fakeMetricsForwarder{} return &metricsForwarder{ delegator: f, keysHash: hashKeys("sameApiKey", "sameAppKey"), }, f }, apiKey: "sameApiKey", appKey: "sameAppKey", wantErr: false, wantFunc: func(m *metricsForwarder, f *fakeMetricsForwarder) error { if m.keysHash != hashKeys("sameApiKey", "sameAppKey") { return errors.New("Wrong hash update") } if !f.AssertNumberOfCalls(t, "delegatedValidateCreds", 0) { return errors.New("Wrong number of calls") } return nil }, }, { name: "new apiKey, update", loadFunc: func() (*metricsForwarder, *fakeMetricsForwarder) { f := &fakeMetricsForwarder{} f.On("delegatedValidateCreds", "newApiKey", "sameAppKey") return &metricsForwarder{ delegator: f, keysHash: hashKeys("oldApiKey", "sameAppKey"), }, f }, apiKey: "newApiKey", appKey: "sameAppKey", wantErr: false, wantFunc: func(m *metricsForwarder, f *fakeMetricsForwarder) error { if m.keysHash != hashKeys("newApiKey", "sameAppKey") { return errors.New("Wrong hash update") } if !f.AssertNumberOfCalls(t, "delegatedValidateCreds", 1) { return errors.New("Wrong number of calls") } return nil }, }, { name: "new appKey, update", loadFunc: func() (*metricsForwarder, *fakeMetricsForwarder) { f := &fakeMetricsForwarder{} f.On("delegatedValidateCreds", "sameApiKey", "newAppKey") return &metricsForwarder{ delegator: f, keysHash: hashKeys("sameApiKey", "oldAppKey"), }, f }, apiKey: "sameApiKey", appKey: "newAppKey", wantErr: false, wantFunc: func(m *metricsForwarder, f *fakeMetricsForwarder) error { if m.keysHash != hashKeys("sameApiKey", "newAppKey") { return errors.New("Wrong hash update") } if !f.AssertNumberOfCalls(t, "delegatedValidateCreds", 1) { return errors.New("Wrong number of calls") } return nil }, }, { name: "invalid creds, no update", loadFunc: func() (*metricsForwarder, *fakeMetricsForwarder) { f := &fakeMetricsForwarder{} f.On("delegatedValidateCreds", "invalidApiKey", "invalidAppKey") return &metricsForwarder{ delegator: f, keysHash: hashKeys("oldApiKey", "oldAppKey"), }, f }, apiKey: "invalidApiKey", appKey: "invalidAppKey", wantErr: true, wantFunc: func(m *metricsForwarder, f *fakeMetricsForwarder) error { if m.keysHash != hashKeys("oldApiKey", "oldAppKey") { return errors.New("Wrong hash update") } if !f.AssertNumberOfCalls(t, "delegatedValidateCreds", 1) { return errors.New("Wrong number of calls") } return nil }, }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { dd, f := tt.loadFunc() if err := dd.updateCredsIfNeeded(tt.apiKey, tt.appKey); (err != nil) != tt.wantErr { t.Errorf("metricsForwarder.updateCredsIfNeeded() error = %v, wantErr %v", err, tt.wantErr) } if err := tt.wantFunc(dd, f); err != nil { t.Errorf("metricsForwarder.updateCredsIfNeeded() wantFunc validation error: %v", err) } }) } }
explode_data.jsonl/8870
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1593 }
[ 2830, 3393, 27328, 25925, 261, 8882, 34, 53369, 95803, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 3056, 1235, 341, 197, 11609, 257, 914, 198, 197, 49386, 9626, 2915, 368, 4609, 43262, 25925, 261, 11, 353, 30570, 27328, 25925, 261, 340, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestValidation(t *testing.T) { re := require.New(t) registerDefaultSchedulers() cfg := NewConfig() re.NoError(cfg.Adjust(nil, false)) cfg.Log.File.Filename = path.Join(cfg.DataDir, "test") re.Error(cfg.Validate()) // check schedule config cfg.Schedule.HighSpaceRatio = -0.1 re.Error(cfg.Schedule.Validate()) cfg.Schedule.HighSpaceRatio = 0.6 re.NoError(cfg.Schedule.Validate()) cfg.Schedule.LowSpaceRatio = 1.1 re.Error(cfg.Schedule.Validate()) cfg.Schedule.LowSpaceRatio = 0.4 re.Error(cfg.Schedule.Validate()) cfg.Schedule.LowSpaceRatio = 0.8 re.NoError(cfg.Schedule.Validate()) cfg.Schedule.TolerantSizeRatio = -0.6 re.Error(cfg.Schedule.Validate()) // check quota re.Equal(defaultQuotaBackendBytes, cfg.QuotaBackendBytes) // check request bytes re.Equal(defaultMaxRequestBytes, cfg.MaxRequestBytes) re.Equal(defaultLogFormat, cfg.Log.Format) }
explode_data.jsonl/78164
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 345 }
[ 2830, 3393, 13799, 1155, 353, 8840, 836, 8, 341, 17200, 1669, 1373, 7121, 1155, 340, 29422, 3675, 74674, 741, 50286, 1669, 1532, 2648, 741, 17200, 35699, 28272, 17865, 4250, 27907, 11, 895, 4390, 50286, 5247, 8576, 991, 4033, 284, 1815, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestUserSignupChangedPredicate(t *testing.T) { // when pred := &UserSignupChangedPredicate{} userSignupName := uuid.Must(uuid.NewV4()).String() userSignupOld := &toolchainv1alpha1.UserSignup{ ObjectMeta: metav1.ObjectMeta{ Name: userSignupName, Namespace: test.HostOperatorNs, Annotations: map[string]string{ toolchainv1alpha1.UserSignupUserEmailAnnotationKey: "foo@redhat.com", }, Labels: map[string]string{ toolchainv1alpha1.UserSignupUserEmailHashLabelKey: "fd2addbd8d82f0d2dc088fa122377eaa", }, Generation: 1, }, Spec: toolchainv1alpha1.UserSignupSpec{ Username: "foo@redhat.com", }, } userSignupNewNotChanged := &toolchainv1alpha1.UserSignup{ ObjectMeta: metav1.ObjectMeta{ Name: userSignupName, Namespace: test.HostOperatorNs, Annotations: map[string]string{ toolchainv1alpha1.UserSignupUserEmailAnnotationKey: "foo@redhat.com", }, Labels: map[string]string{ toolchainv1alpha1.UserSignupUserEmailHashLabelKey: "fd2addbd8d82f0d2dc088fa122377eaa", }, Generation: 1, }, Spec: toolchainv1alpha1.UserSignupSpec{ Username: "alice.mayweather.doe@redhat.com", }, } userSignupNewChanged := &toolchainv1alpha1.UserSignup{ ObjectMeta: metav1.ObjectMeta{ Name: userSignupName, Namespace: test.HostOperatorNs, Annotations: map[string]string{ toolchainv1alpha1.UserSignupUserEmailAnnotationKey: "alice.mayweather.doe@redhat.com", }, Labels: map[string]string{ toolchainv1alpha1.UserSignupUserEmailHashLabelKey: "747a250430df0c7976bf2363ebb4014a", }, Generation: 2, }, Spec: toolchainv1alpha1.UserSignupSpec{ Username: "alice.mayweather.doe@redhat.com", }, } t.Run("test UserSignupChangedPredicate returns false when ObjectOld not set", func(t *testing.T) { e := event.UpdateEvent{ ObjectOld: nil, ObjectNew: userSignupNewNotChanged, } require.False(t, pred.Update(e)) }) t.Run("test UserSignupChangedPredicate returns false when ObjectNew not set", func(t *testing.T) { e := event.UpdateEvent{ ObjectOld: userSignupOld, ObjectNew: nil, } require.False(t, pred.Update(e)) }) t.Run("test UserSignupChangedPredicate returns false when generation unchanged and annoations unchanged", func(t *testing.T) { e := event.UpdateEvent{ ObjectOld: userSignupOld, ObjectNew: userSignupNewNotChanged, } require.False(t, pred.Update(e)) }) t.Run("test UserSignupChangedPredicate returns true when generation changed", func(t *testing.T) { e := event.UpdateEvent{ ObjectOld: userSignupOld, ObjectNew: userSignupNewChanged, } require.True(t, pred.Update(e)) }) }
explode_data.jsonl/61102
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1086 }
[ 2830, 3393, 1474, 56246, 5389, 36329, 1155, 353, 8840, 836, 8, 341, 197, 322, 979, 198, 3223, 1151, 1669, 609, 1474, 56246, 5389, 36329, 16094, 19060, 56246, 675, 1669, 16040, 50463, 41458, 7121, 53, 19, 6011, 703, 2822, 19060, 56246, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestUpdateNamedEntity(t *testing.T) { truncateAllTablesForTestingOnly() client, conn := GetTestAdminServiceClient() ctx := context.Background() defer conn.Close() insertTasksForTests(t, client) insertWorkflowsForTests(t, client) insertLaunchPlansForTests(t, client) identifier := admin.NamedEntityIdentifier{ Project: "admintests", Domain: "development", Name: "name_a", } for _, resourceType := range resourceTypes { _, err := client.UpdateNamedEntity(ctx, &admin.NamedEntityUpdateRequest{ ResourceType: resourceType, Id: &identifier, Metadata: &admin.NamedEntityMetadata{ Description: "updated description", }, }) assert.NoError(t, err) entity, err := client.GetNamedEntity(ctx, &admin.NamedEntityGetRequest{ ResourceType: resourceType, Id: &identifier, }) assert.NoError(t, err) assert.Equal(t, "updated description", entity.Metadata.Description) } }
explode_data.jsonl/71152
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 354 }
[ 2830, 3393, 4289, 15810, 3030, 1155, 353, 8840, 836, 8, 341, 25583, 26900, 2403, 21670, 2461, 16451, 7308, 741, 25291, 11, 4534, 1669, 2126, 2271, 7210, 1860, 2959, 741, 20985, 1669, 2266, 19047, 2822, 16867, 4534, 10421, 741, 59847, 2544...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestDefault(t *testing.T) { ht := SHA256 salt := []byte("12345") h, err := DefaultFactory.GetHasherWithSalt(ht, salt) if err != nil { t.Fatal("Unable to retrieve SHA256 Hasher") } if h.GetHashType() != ht { t.Fatal("Mismatch in HashType") } if !bytes.Equal(h.GetSalt(), salt) { t.Fatal("Mismatch in salts") } type testData struct { i interface{} h string } type testStruct struct { a int64 b string } data := []testData{ {nil, "589afb9f637093785273a735592d92a92e13a52f07a128770cde82c0e45b656a"}, {int64(1), "dd712114fb283417de4da3512e17486adbda004060d0d1646508c8a2740d29b4"}, {float32(-9992.3), "3568d479b826f1750d31755023a387a623cbbf97358841fbccf2af2e8f833880"}, {[]int64{1, 2, 3, 4, 5}, "cd5b761f3877aacab78715384f023546cbf462b1ece14de26f7e1ebad1ac591e"}, {map[string]interface{}{"a": 1, "b": "Hello", "c": []float64{2.3, 4.5}}, "50c7d2d1b89d346e1386244aa4d011c963795036064c6367838277f3c421e20d"}, {map[string]interface{}{"b": "Hello", "a": 1, "c": []float64{2.3, 4.5}}, "50c7d2d1b89d346e1386244aa4d011c963795036064c6367838277f3c421e20d"}, {[]*testStruct{{a: 1, b: "Hi"}, {a: 2, b: "There"}}, "20dfd7869c5d4609cf7afdf09ae8dc0967e554e10b8d8200b30834405fd7e4ca"}, {[]*testStruct{{a: 2, b: "There"}, {a: 1, b: "Hi"}}, "20dfd7869c5d4609cf7afdf09ae8dc0967e554e10b8d8200b30834405fd7e4ca"}, {[]*[]int64{{7, 8, 9, 0}, {1, 2, 3, 4}}, "ee2d93a36e99ca976ff5ec139e8c5e595f92160c203e6215d74f75f29cebe413"}, {map[int]*testStruct{1: {a: 1, b: "Hi"}, 2: {a: 2, b: "There"}}, "b0779c149603990ff73355a065894126966bdc129ffac6c4db07f5fb760b1e5a"}, {map[int]*testStruct{2: {a: 2, b: "There"}, 1: {a: 1, b: "Hi"}}, "b0779c149603990ff73355a065894126966bdc129ffac6c4db07f5fb760b1e5a"}, } for _, d := range data { if fmt.Sprintf("%x", h.Hash(d.i).H) != d.h { fmt.Printf("%x\n", h.Hash(d.i).H) t.Fatalf("Mismatch in hash for %v\n", d.i) } } }
explode_data.jsonl/42613
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1004 }
[ 2830, 3393, 3675, 1155, 353, 8840, 836, 8, 1476, 197, 426, 1669, 21721, 17, 20, 21, 198, 1903, 3145, 1669, 3056, 3782, 445, 16, 17, 18, 19, 20, 5130, 9598, 11, 1848, 1669, 7899, 4153, 2234, 6370, 261, 2354, 47318, 73392, 11, 12021, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestLookupFieldOrMethodOnNil(t *testing.T) { // LookupFieldOrMethod on a nil type is expected to produce a run-time panic. defer func() { const want = "LookupFieldOrMethod on nil type" p := recover() if s, ok := p.(string); !ok || s != want { t.Fatalf("got %v, want %s", p, want) } }() LookupFieldOrMethod(nil, false, nil, "") }
explode_data.jsonl/29386
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 136 }
[ 2830, 3393, 34247, 1877, 2195, 3523, 1925, 19064, 1155, 353, 8840, 836, 8, 341, 197, 322, 50311, 1877, 2195, 3523, 389, 264, 2092, 943, 374, 3601, 311, 8193, 264, 1598, 7246, 21975, 624, 16867, 2915, 368, 341, 197, 4777, 1366, 284, 33...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestUnsubscribe(t *testing.T) { s := pubsub.NewServer() s.SetLogger(log.TestingLogger()) s.Start() defer s.Stop() ctx := context.Background() subscription, err := s.Subscribe(ctx, clientID, query.MustParse("tm.events.type='NewBlock'")) require.NoError(t, err) err = s.Unsubscribe(ctx, clientID, query.MustParse("tm.events.type='NewBlock'")) require.NoError(t, err) err = s.Publish(ctx, "Nick Fury") require.NoError(t, err) assert.Zero(t, len(subscription.Out()), "Should not receive anything after Unsubscribe") assertCancelled(t, subscription, pubsub.ErrUnsubscribed) }
explode_data.jsonl/22059
{ "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, 1806, 9384, 1155, 353, 8840, 836, 8, 341, 1903, 1669, 6675, 1966, 7121, 5475, 741, 1903, 4202, 7395, 12531, 8787, 287, 7395, 2398, 1903, 12101, 741, 16867, 274, 30213, 2822, 20985, 1669, 2266, 19047, 741, 28624, 12124, 11, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestMake(t *testing.T) { ctx := log.Testing(t) ctx = database.Put(ctx, database.NewInMemory(ctx)) s := api.NewStateWithEmptyAllocator(device.Little32) cb := CommandBuilder{Thread: 0, Arena: s.Arena} idOfFirstPool, _ := s.Memory.New() assert.For(ctx, "initial NextPoolID").That(idOfFirstPool).Equals(memory.PoolID(1)) err := api.MutateCmds(ctx, s, nil, nil, cb.CmdMake(10), ) assert.For(ctx, "err").ThatError(err).Succeeded() assert.For(ctx, "buffer count").That(GetState(s).U8s().Size()).Equals(uint64(10)) idOfOneAfterLastPool, _ := s.Memory.New() assert.For(ctx, "final NextPoolID").That(idOfOneAfterLastPool).Equals(memory.PoolID(3)) assert.For(ctx, "pool count").That(s.Memory.Count()).Equals(4) }
explode_data.jsonl/61058
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 287 }
[ 2830, 3393, 8078, 1155, 353, 8840, 836, 8, 341, 20985, 1669, 1487, 8787, 287, 1155, 340, 20985, 284, 4625, 39825, 7502, 11, 4625, 7121, 641, 10642, 7502, 1171, 1903, 1669, 6330, 7121, 1397, 2354, 3522, 42730, 17848, 1214, 2377, 18, 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_CSRF_From_Form(t *testing.T) { app := fiber.New() app.Use(New(Config{TokenLookup: "form:_csrf"})) app.Post("/", func(c *fiber.Ctx) error { return c.SendStatus(fiber.StatusOK) }) h := app.Handler() ctx := &fasthttp.RequestCtx{} // Valid CSRF token token := utils.UUID() ctx.Request.Header.SetMethod("POST") ctx.Request.Header.Set(fiber.HeaderCookie, "_csrf="+token) ctx.Request.Header.Set(fiber.HeaderContentType, fiber.MIMEApplicationForm) h(ctx) utils.AssertEqual(t, 403, ctx.Response.StatusCode()) ctx.Request.Reset() ctx.Request.Header.SetMethod("POST") ctx.Request.Header.Set(fiber.HeaderCookie, "_csrf="+token) ctx.Request.Header.Set(fiber.HeaderContentType, fiber.MIMEApplicationForm) ctx.Request.SetBodyString("_csrf=" + token) h(ctx) utils.AssertEqual(t, 200, ctx.Response.StatusCode()) }
explode_data.jsonl/54025
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 329 }
[ 2830, 3393, 81449, 37, 53157, 28121, 1155, 353, 8840, 836, 8, 341, 28236, 1669, 23788, 7121, 2822, 28236, 9046, 35063, 33687, 90, 3323, 34247, 25, 330, 627, 22035, 24102, 9207, 4390, 28236, 23442, 35460, 2915, 1337, 353, 82945, 727, 3998,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestAuthService_InviteUser(t *testing.T) { var token = issueTestToken(user.ID, user.Username, createTestConfig().PrivKeyPath) var email = "bojack@horseman.com" var codeMatcher = func(code string) bool { return len(code) == 32 } var userMatcher = func(u *st.User) bool { return u.Email == email && len(u.InviteCode) == 32 } dao := dao.MockUserDao{} dao.On("GetByUsername", user.Username).Return(&user, nil) dao.On("Save", mock.MatchedBy(userMatcher)).Return(42) m := MailerMock{} m.On("SendInviteCode", email, mock.MatchedBy(codeMatcher)).Return(nil) s := AuthService{&m, &dao, createTestConfig()} err := s.InviteUser(email, token) assert.Nil(t, err) dao.AssertExpectations(t) m.AssertExpectations(t) }
explode_data.jsonl/18887
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 292 }
[ 2830, 3393, 90466, 62, 93540, 1474, 1155, 353, 8840, 836, 8, 341, 2405, 3950, 284, 4265, 2271, 3323, 4277, 9910, 11, 1196, 42777, 11, 1855, 2271, 2648, 1005, 32124, 1592, 1820, 340, 2405, 2551, 284, 330, 749, 27134, 31, 59675, 1515, 9...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestIdenticalFuzzing(t *testing.T) { t.Parallel() type S struct { ii int ui uint i8 int8 u8 uint8 i16 int16 u16 uint16 i32 int32 u32 uint32 i64 int64 u64 uint64 f32 float32 f64 float64 uPtr uintptr iiPtr *int uiPtr *uint i8Ptr *int8 u8Ptr *uint8 i16Ptr *int16 u16Ptr *uint16 i32Ptr *int32 u32Ptr *uint32 i64Ptr *int64 u64Ptr *uint64 f32Ptr *float32 f64Ptr *float64 uPtrPtr *uintptr s string sPtr *string b bool bPtr *bool } f := fuzz.New() var a, b S for i := 1; i < 1000; i++ { f.Fuzz(&a) p := NewStaticProvider(a) require.NoError(t, p.Get(Root).Populate(&b)) require.Equal(t, a, b) } }
explode_data.jsonl/35433
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 422 }
[ 2830, 3393, 28301, 938, 37, 8889, 287, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 2822, 13158, 328, 2036, 341, 197, 197, 3808, 414, 526, 198, 197, 37278, 414, 2622, 198, 197, 8230, 23, 414, 526, 23, 198, 197, 10676, 23, 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...
2
func TestSwitchAccount(t *testing.T) { th := Setup().InitBasic().InitSystemAdmin() defer th.TearDown() Client := th.Client th.App.UpdateConfig(func(cfg *model.Config) { cfg.GitLabSettings.Enable = true }) Client.Logout() sr := &model.SwitchRequest{ CurrentService: model.USER_AUTH_SERVICE_EMAIL, NewService: model.USER_AUTH_SERVICE_GITLAB, Email: th.BasicUser.Email, Password: th.BasicUser.Password, } link, resp := Client.SwitchAccountType(sr) CheckNoError(t, resp) if link == "" { t.Fatal("bad link") } th.App.SetLicense(model.NewTestLicense()) th.App.UpdateConfig(func(cfg *model.Config) { *cfg.ServiceSettings.ExperimentalEnableAuthenticationTransfer = false }) sr = &model.SwitchRequest{ CurrentService: model.USER_AUTH_SERVICE_EMAIL, NewService: model.USER_AUTH_SERVICE_GITLAB, } _, resp = Client.SwitchAccountType(sr) CheckForbiddenStatus(t, resp) th.LoginBasic() sr = &model.SwitchRequest{ CurrentService: model.USER_AUTH_SERVICE_SAML, NewService: model.USER_AUTH_SERVICE_EMAIL, Email: th.BasicUser.Email, NewPassword: th.BasicUser.Password, } _, resp = Client.SwitchAccountType(sr) CheckForbiddenStatus(t, resp) sr = &model.SwitchRequest{ CurrentService: model.USER_AUTH_SERVICE_EMAIL, NewService: model.USER_AUTH_SERVICE_LDAP, } _, resp = Client.SwitchAccountType(sr) CheckForbiddenStatus(t, resp) sr = &model.SwitchRequest{ CurrentService: model.USER_AUTH_SERVICE_LDAP, NewService: model.USER_AUTH_SERVICE_EMAIL, } _, resp = Client.SwitchAccountType(sr) CheckForbiddenStatus(t, resp) th.App.UpdateConfig(func(cfg *model.Config) { *cfg.ServiceSettings.ExperimentalEnableAuthenticationTransfer = true }) th.LoginBasic() fakeAuthData := model.NewId() if result := <-th.App.Srv.Store.User().UpdateAuthData(th.BasicUser.Id, model.USER_AUTH_SERVICE_GITLAB, &fakeAuthData, th.BasicUser.Email, true); result.Err != nil { t.Fatal(result.Err) } sr = &model.SwitchRequest{ CurrentService: model.USER_AUTH_SERVICE_GITLAB, NewService: model.USER_AUTH_SERVICE_EMAIL, Email: th.BasicUser.Email, NewPassword: th.BasicUser.Password, } link, resp = Client.SwitchAccountType(sr) CheckNoError(t, resp) if link != "/login?extra=signin_change" { t.Log(link) t.Fatal("bad link") } Client.Logout() _, resp = Client.Login(th.BasicUser.Email, th.BasicUser.Password) CheckNoError(t, resp) Client.Logout() sr = &model.SwitchRequest{ CurrentService: model.USER_AUTH_SERVICE_GITLAB, NewService: model.SERVICE_GOOGLE, } _, resp = Client.SwitchAccountType(sr) CheckBadRequestStatus(t, resp) sr = &model.SwitchRequest{ CurrentService: model.USER_AUTH_SERVICE_EMAIL, NewService: model.USER_AUTH_SERVICE_GITLAB, Password: th.BasicUser.Password, } _, resp = Client.SwitchAccountType(sr) CheckNotFoundStatus(t, resp) sr = &model.SwitchRequest{ CurrentService: model.USER_AUTH_SERVICE_EMAIL, NewService: model.USER_AUTH_SERVICE_GITLAB, Email: th.BasicUser.Email, } _, resp = Client.SwitchAccountType(sr) CheckUnauthorizedStatus(t, resp) sr = &model.SwitchRequest{ CurrentService: model.USER_AUTH_SERVICE_GITLAB, NewService: model.USER_AUTH_SERVICE_EMAIL, Email: th.BasicUser.Email, NewPassword: th.BasicUser.Password, } _, resp = Client.SwitchAccountType(sr) CheckUnauthorizedStatus(t, resp) }
explode_data.jsonl/21557
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1370 }
[ 2830, 3393, 16837, 7365, 1155, 353, 8840, 836, 8, 341, 70479, 1669, 18626, 1005, 3803, 15944, 1005, 3803, 2320, 7210, 741, 16867, 270, 836, 682, 4454, 741, 71724, 1669, 270, 11716, 271, 70479, 5105, 16689, 2648, 18552, 28272, 353, 2528, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestNewPeerSecured(t *testing.T) { mockCtrl := gomock.NewController(t) defer mockCtrl.Finish() config := mockfab.DefaultMockConfig(mockCtrl) url := "grpc://0.0.0.0:1234" conn, err := New(config, WithURL(url), WithInsecure()) if err != nil { t.Fatal("Peer conn should be constructed") } if !conn.inSecure { t.Fatal("Expected insecure to be true") } }
explode_data.jsonl/4800
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 148 }
[ 2830, 3393, 3564, 30888, 8430, 3073, 1155, 353, 8840, 836, 8, 341, 77333, 15001, 1669, 342, 316, 1176, 7121, 2051, 1155, 340, 16867, 7860, 15001, 991, 18176, 2822, 25873, 1669, 7860, 36855, 13275, 11571, 2648, 30389, 15001, 692, 19320, 16...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestEscapeMarkdown(t *testing.T) { provider := [][][]string{ { {"user", "repo"}, {"user", "repo"}, }, { {"user_name", "repo_name"}, {`user\_name`, `repo\_name`}, }, { {"user_name_long", "user_name_long"}, {`user\_name\_long`, `user\_name\_long`}, }, { {`user\_name\_long`, `repo\_name\_long`}, {`user\_name\_long`, `repo\_name\_long`}, }, { {`user\_name\_long`, `repo\_name\_long`, ""}, {`user\_name\_long`, `repo\_name\_long`}, }, } for _, testCase := range provider { assert.Equal(t, testCase[1], escapeMarkdown(testCase[0])) } }
explode_data.jsonl/17933
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 308 }
[ 2830, 3393, 48124, 68005, 1155, 353, 8840, 836, 8, 341, 197, 19979, 1669, 3056, 16613, 917, 515, 197, 197, 515, 298, 197, 4913, 872, 497, 330, 23476, 7115, 298, 197, 4913, 872, 497, 330, 23476, 7115, 197, 197, 1583, 197, 197, 515, 2...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestSumPerKeyReturnsNonNegativeFloat64(t *testing.T) { var triples []testutils.TripleWithFloatValue for key := 0; key < 100; key++ { triples = append(triples, testutils.TripleWithFloatValue{key, key, 0.01}) } p, s, col := ptest.CreateList(triples) col = beam.ParDo(s, testutils.ExtractIDFromTripleWithFloatValue, col) // Using a low epsilon, a high delta, and a high maxValue here to add a // lot of noise while keeping partitions. epsilon, delta, maxValue := 0.001, 0.999, 1e8 pcol := MakePrivate(s, col, NewPrivacySpec(epsilon, delta)) pcol = ParDo(s, testutils.TripleWithFloatValueToKV, pcol) sums := SumPerKey(s, pcol, SumParams{MinValue: 0, MaxValue: maxValue, MaxPartitionsContributed: 1, NoiseKind: GaussianNoise{}}) values := beam.DropKey(s, sums) beam.ParDo0(s, testutils.CheckNoNegativeValuesFloat64Fn, values) if err := ptest.Run(p); err != nil { t.Errorf("TestSumPerKeyReturnsNonNegativeFloat64 returned errors: %v", err) } }
explode_data.jsonl/42975
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 355 }
[ 2830, 3393, 9190, 3889, 1592, 16446, 8121, 38489, 5442, 21, 19, 1155, 353, 8840, 836, 8, 341, 2405, 88561, 3056, 1944, 6031, 836, 461, 694, 2354, 5442, 1130, 198, 2023, 1376, 1669, 220, 15, 26, 1376, 366, 220, 16, 15, 15, 26, 1376, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestDeployPodWithMultipleLiveUpdateImages(t *testing.T) { f := newIBDFixture(t, k8s.EnvGKE) defer f.TearDown() f.ibd.injectSynclet = true iTarget1 := NewSanchoLiveUpdateImageTarget(f) iTarget2 := NewSanchoSidecarLiveUpdateImageTarget(f) kTarget := k8s.MustTarget("sancho", testyaml.SanchoSidecarYAML). WithDependencyIDs([]model.TargetID{iTarget1.ID(), iTarget2.ID()}) targets := []model.TargetSpec{iTarget1, iTarget2, kTarget} result, err := f.ibd.BuildAndDeploy(f.ctx, f.st, targets, store.BuildStateSet{}) if err != nil { t.Fatal(err) } assert.Equal(t, 2, f.docker.BuildCount) expectedSanchoRef := "gcr.io/some-project-162817/sancho:tilt-11cd0b38bc3ceb95" image := store.ClusterImageRefFromBuildResult(result[iTarget1.ID()]) assert.Equal(t, expectedSanchoRef, image.String()) assert.Equalf(t, 1, strings.Count(f.k8s.Yaml, expectedSanchoRef), "Expected image to appear once in YAML: %s", f.k8s.Yaml) expectedSidecarRef := "gcr.io/some-project-162817/sancho-sidecar:tilt-11cd0b38bc3ceb95" image = store.ClusterImageRefFromBuildResult(result[iTarget2.ID()]) assert.Equal(t, expectedSidecarRef, image.String()) assert.Equalf(t, 1, strings.Count(f.k8s.Yaml, expectedSidecarRef), "Expected image to appear once in YAML: %s", f.k8s.Yaml) assert.Equalf(t, 1, strings.Count(f.k8s.Yaml, "gcr.io/windmill-public-containers/tilt-synclet:"), "Expected synclet to be injected once in YAML: %s", f.k8s.Yaml) }
explode_data.jsonl/38254
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 600 }
[ 2830, 3393, 69464, 23527, 2354, 32089, 20324, 4289, 14228, 1155, 353, 8840, 836, 8, 341, 1166, 1669, 501, 3256, 5262, 12735, 1155, 11, 595, 23, 82, 81214, 38, 3390, 340, 16867, 282, 836, 682, 4454, 741, 1166, 27944, 67, 24143, 12154, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestInt32_Copy(t *testing.T) { testcases := []struct { name string s Int32 expect []int32 }{ { name: "test Int32 Copy, s is empty", s: Int32{}, expect: []int32{}, }, { name: "test Int32 Copy, s is not empty", s: map[int32]struct{}{2: {}, 9: {}, 4: {}}, expect: []int32{2, 9, 4}, }, } for _, tc := range testcases { t.Logf("running scenario: %s", tc.name) actual := tc.s.Copy() validateInt32(t, actual, tc.expect) } }
explode_data.jsonl/62338
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 244 }
[ 2830, 3393, 1072, 18, 17, 77637, 1155, 353, 8840, 836, 8, 341, 18185, 23910, 1669, 3056, 1235, 341, 197, 11609, 256, 914, 198, 197, 1903, 414, 1333, 18, 17, 198, 197, 24952, 3056, 396, 18, 17, 198, 197, 59403, 197, 197, 515, 298, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestMurmurHash3_Sum128(t *testing.T) { type fields struct { k1 uint64 k2 uint64 h1 uint64 h2 uint64 } type args struct { data []byte } tests := []struct { name string fields fields args args want uint64 want1 uint64 }{ { name: "123456", fields: fields{ h1: 123456, h2: 123456, }, args: args{ data: []byte("helloqwertyuiophelloqwertyuiop"), }, want: 14288351280354662, want1: 2696564043591294180, }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { m := &MurmurHash3{ k1: tt.fields.k1, k2: tt.fields.k2, h1: tt.fields.h1, h2: tt.fields.h2, } got, got1 := m.Sum128(tt.args.data) if got != tt.want { t.Errorf("MurmurHash3.Sum128() got = %v, want %v", got, tt.want) } if got1 != tt.want1 { t.Errorf("MurmurHash3.Sum128() got1 = %v, want %v", got1, tt.want1) } }) } }
explode_data.jsonl/55814
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 484 }
[ 2830, 3393, 44, 52370, 324, 6370, 18, 1098, 372, 16, 17, 23, 1155, 353, 8840, 836, 8, 341, 13158, 5043, 2036, 341, 197, 16463, 16, 2622, 21, 19, 198, 197, 16463, 17, 2622, 21, 19, 198, 197, 9598, 16, 2622, 21, 19, 198, 197, 9598...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestLoadConfigurationEnvVariable(t *testing.T) { os.Clearenv() mustSetEnv(t, "INSIGHTS_RESULTS_SMART_PROXY_CONFIG_FILE", "../tests/config1") mustLoadConfiguration("foobar") }
explode_data.jsonl/61897
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 67 }
[ 2830, 3393, 5879, 7688, 14359, 7827, 1155, 353, 8840, 836, 8, 341, 25078, 727, 273, 9151, 85, 2822, 2109, 590, 1649, 14359, 1155, 11, 330, 9557, 4631, 50, 76015, 28845, 2992, 59065, 12568, 8087, 497, 7005, 23841, 14730, 16, 5130, 2109, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestClient_BindEip(t *testing.T) { args := &BindEipArgs{ InstanceType: "BCC", InstanceId: BCC_TEST_ID, ClientToken: getClientToken(), } err := EIP_CLIENT.BindEip(EIP_ADDRESS, args) ExpectEqual(t.Errorf, nil, err) }
explode_data.jsonl/3035
{ "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, 2959, 1668, 484, 36, 573, 1155, 353, 8840, 836, 8, 341, 31215, 1669, 609, 9950, 36, 573, 4117, 515, 197, 197, 2523, 929, 25, 330, 33, 3706, 756, 197, 197, 65918, 25, 256, 425, 3706, 11641, 3450, 345, 197, 71724, 3323, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestConnect(t *testing.T) { pro := &Properties{ ConfigurationProperties: at.ConfigurationProperties{}, Port: 0, Host: "", } client := newClient() err := client.Connect(pro) assert.Equal(t, nil, err) }
explode_data.jsonl/66185
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 120 }
[ 2830, 3393, 14611, 1155, 353, 8840, 836, 8, 341, 197, 776, 1669, 609, 7903, 515, 197, 197, 7688, 7903, 25, 518, 17334, 7903, 38837, 197, 98459, 25, 503, 220, 15, 345, 197, 197, 9296, 25, 503, 8324, 197, 532, 25291, 1669, 501, 2959, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestDeleteUsingWorkspaceUUID(t *testing.T) { testUtil.InitTestConfig() okResponse := ` { "data": { "deleteWorkspaceServiceAccount": { "id": "ckbvcbqs1014t0760u4bszmcs" } } }` client := testUtil.NewTestClient(func(req *http.Request) *http.Response { return &http.Response{ StatusCode: 200, Body: ioutil.NopCloser(bytes.NewBufferString(okResponse)), Header: make(http.Header), } }) api := houston.NewHoustonClient(client) serviceAccountId := "ckbvcbqs1014t0760u4bszmcs" workspaceUuid := "ck1qg6whg001r08691y117hub" buf := new(bytes.Buffer) err := DeleteUsingWorkspaceUUID(serviceAccountId, workspaceUuid, api, buf) assert.NoError(t, err) expectedOut := `Service Account (ckbvcbqs1014t0760u4bszmcs) successfully deleted ` assert.Equal(t, buf.String(), expectedOut) }
explode_data.jsonl/39482
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 339 }
[ 2830, 3393, 6435, 16429, 45981, 24754, 1155, 353, 8840, 836, 8, 341, 18185, 2742, 26849, 2271, 2648, 741, 59268, 2582, 1669, 22074, 515, 220, 330, 691, 788, 341, 262, 330, 4542, 45981, 1860, 7365, 788, 341, 414, 330, 307, 788, 330, 37...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestCheckUpdateFromInactive(t *testing.T) { mocks, checkService := newCheckSvcStack() latest := time.Now().UTC() checkService.Now = func() time.Time { return latest } ch := mocks.pipingCoordinator.taskUpdatedChan() mocks.checkSvc.UpdateCheckFn = func(_ context.Context, _ platform.ID, c influxdb.CheckCreate) (influxdb.Check, error) { c.SetTaskID(10) c.SetUpdatedAt(latest.Add(-20 * time.Hour)) return c, nil } mocks.checkSvc.PatchCheckFn = func(_ context.Context, _ platform.ID, c influxdb.CheckUpdate) (influxdb.Check, error) { ic := &check.Deadman{} ic.SetTaskID(10) ic.SetUpdatedAt(latest.Add(-20 * time.Hour)) return ic, nil } mocks.checkSvc.FindCheckByIDFn = func(_ context.Context, id platform.ID) (influxdb.Check, error) { c := &check.Deadman{} c.SetID(id) c.SetTaskID(1) return c, nil } mocks.taskSvc.FindTaskByIDFn = func(_ context.Context, id platform.ID) (*influxdb.Task, error) { if id == 1 { return &influxdb.Task{ID: id, Status: string(influxdb.TaskInactive)}, nil } else if id == 10 { return &influxdb.Task{ID: id, Status: string(influxdb.TaskActive)}, nil } return &influxdb.Task{ID: id}, nil } deadman := &check.Deadman{} deadman.SetTaskID(10) cc := influxdb.CheckCreate{ Check: deadman, Status: influxdb.Active, } thecheck, err := checkService.UpdateCheck(context.Background(), 1, cc) if err != nil { t.Fatal(err) } select { case task := <-ch: if task.ID != thecheck.GetTaskID() { t.Fatalf("task sent to coordinator doesn't match expected") } if task.LatestCompleted != latest { t.Fatalf("update returned incorrect LatestCompleted, expected %s got %s, or ", latest.Format(time.RFC3339), task.LatestCompleted) } default: t.Fatal("didn't receive task") } action := influxdb.Active thecheck, err = checkService.PatchCheck(context.Background(), 1, influxdb.CheckUpdate{Status: &action}) if err != nil { t.Fatal(err) } select { case task := <-ch: if task.ID != thecheck.GetTaskID() { t.Fatalf("task sent to coordinator doesn't match expected") } if task.LatestCompleted != latest { t.Fatalf("update returned incorrect LatestCompleted, expected %s got %s, or ", latest.Format(time.RFC3339), task.LatestCompleted) } default: t.Fatal("didn't receive task") } }
explode_data.jsonl/72194
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 875 }
[ 2830, 3393, 3973, 4289, 3830, 72214, 1155, 353, 8840, 836, 8, 341, 2109, 25183, 11, 1779, 1860, 1669, 501, 3973, 92766, 4336, 741, 197, 19350, 1669, 882, 13244, 1005, 21183, 741, 25157, 1860, 13244, 284, 2915, 368, 882, 16299, 341, 197,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestWeekday_ToStr(t *testing.T) { tests := []struct { name string w models.Weekday want string }{ {"m", models.Weekday(1), "Monday"}, {"tu", models.Weekday(2), "Tuesday"}, {"w", models.Weekday(3), "Wednesday"}, {"th", models.Weekday(4), "Thursday"}, {"f", models.Weekday(5), "Friday"}, {"sa", models.Weekday(6), "Saturday"}, {"su", models.Weekday(7), "Sunday"}, {"u1", models.Weekday(0), "ErrorWeekday"}, {"u2", models.Weekday(8), "ErrorWeekday"}, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { if got := tt.w.ToStr(); got != tt.want { t.Errorf("ToStr() = %v, want %v", got, tt.want) } }) } }
explode_data.jsonl/74983
{ "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, 17053, 1292, 38346, 2580, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 3056, 1235, 341, 197, 11609, 914, 198, 197, 6692, 262, 4119, 22404, 1225, 1292, 198, 197, 50780, 914, 198, 197, 59403, 197, 197, 4913, 76, 497, 4119, 224...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 Test_NumberIsValidUserUIDDive(t *testing.T) { r := require.New(t) var tests = []struct { field interface{} valid bool invalidIndexes []int }{ {[]int{1000, 01000, 0x1000}, false, []int{1}}, // 01000 = 512; 0x1000 = 4096 {[]uintptr{9, 99, 999, 0x999}, false, []int{0, 1, 2}}, {[]int32{-200, -1, 0, 1, 200}, false, []int{0, 2, 3, 4}}, // -1 is valid {[]uint64{59999, 60000, 60001}, false, []int{2}}, } for index, test := range tests { v := NumberSliceDive{ Validator: &NumberIsValidUserUID{Name: "UserUID"}, Field: test.field, } e := validator.NewErrors() v.Validate(e) r.Equalf(!test.valid, e.HasAny(), "tc %d expecting error=%v got=%v", index, !test.valid, e.HasAny()) if !test.valid { errnames := []string{} for _, i := range test.invalidIndexes { errnames = append(errnames, fmt.Sprintf("UserUID[%d]", i)) } for _, en := range errnames { r.Containsf(e.JSON(), en, "tc %d", index) } } } }
explode_data.jsonl/1886
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 456 }
[ 2830, 3393, 51799, 55470, 1474, 6463, 35, 533, 1155, 353, 8840, 836, 8, 341, 7000, 1669, 1373, 7121, 1155, 692, 2405, 7032, 284, 3056, 1235, 341, 197, 39250, 688, 3749, 16094, 197, 56322, 688, 1807, 198, 197, 197, 11808, 62229, 3056, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestCount(t *testing.T) { t.Parallel() s := []float64{3, 4, 1, 7, 5} f := func(v float64) bool { return v > 3.5 } truth := 3 n := Count(f, s) if n != truth { t.Errorf("Wrong number of elements counted") } }
explode_data.jsonl/1212
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 97 }
[ 2830, 3393, 2507, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 741, 1903, 1669, 3056, 3649, 21, 19, 90, 18, 11, 220, 19, 11, 220, 16, 11, 220, 22, 11, 220, 20, 532, 1166, 1669, 2915, 3747, 2224, 21, 19, 8, 1807, 314, 470, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestTSFunction(t *testing.T) { expectPrintedTS(t, "function foo(): void; function foo(): void {}", "function foo() {\n}\n") expectPrintedTS(t, "function foo<A>() {}", "function foo() {\n}\n") expectPrintedTS(t, "function foo<A extends B<A>>() {}", "function foo() {\n}\n") expectPrintedTS(t, "function foo<A extends B<C<A>>>() {}", "function foo() {\n}\n") expectPrintedTS(t, "function foo<A,B,C,>() {}", "function foo() {\n}\n") expectPrintedTS(t, "function foo<A extends B<C>= B<C>>() {}", "function foo() {\n}\n") expectPrintedTS(t, "function foo<A extends B<C<D>>= B<C<D>>>() {}", "function foo() {\n}\n") expectPrintedTS(t, "function foo<A extends B<C<D<E>>>= B<C<D<E>>>>() {}", "function foo() {\n}\n") expectParseErrorTS(t, "function foo<>() {}", "<stdin>: error: Expected identifier but found \">\"\n") expectParseErrorTS(t, "function foo<,>() {}", "<stdin>: error: Expected identifier but found \",\"\n") expectParseErrorTS(t, "function foo<T><T>() {}", "<stdin>: error: Expected \"(\" but found \"<\"\n") expectPrintedTS(t, "export default function <T>() {}", "export default function() {\n}\n") expectParseErrorTS(t, "export default function <>() {}", "<stdin>: error: Expected identifier but found \">\"\n") expectParseErrorTS(t, "export default function <,>() {}", "<stdin>: error: Expected identifier but found \",\"\n") expectParseErrorTS(t, "export default function <T><T>() {}", "<stdin>: error: Expected \"(\" but found \"<\"\n") expectPrintedTS(t, ` export default function foo(); export default function foo(x); export default function foo(x?, y?) {} `, "export default function foo(x, y) {\n}\n") }
explode_data.jsonl/82322
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 616 }
[ 2830, 3393, 9951, 5152, 1155, 353, 8840, 836, 8, 341, 24952, 8994, 291, 9951, 1155, 11, 330, 1688, 15229, 4555, 737, 26, 729, 15229, 4555, 737, 24689, 330, 1688, 15229, 368, 28152, 77, 11035, 77, 5130, 24952, 8994, 291, 9951, 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 TestGetFilesystems(t *testing.T) { mockServer := NewMockHttpServer(200, SuccessGetFilesystemsContent) defer mockServer.Close() mockHttpClient := NewMockHttpClient(mockServer.URL) client := NewRookNetworkRestClient(mockServer.URL, mockHttpClient) expectedFilesystems := []model.Filesystem{ {Name: "myfs1", MetadataPool: "myfs1-metadata", DataPools: []string{"myfs1-data"}}, } actualFilesystems, err := client.GetFilesystems() assert.Nil(t, err) assert.Equal(t, expectedFilesystems, actualFilesystems) }
explode_data.jsonl/27846
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 184 }
[ 2830, 3393, 1949, 1703, 45554, 1155, 353, 8840, 836, 8, 341, 77333, 5475, 1669, 1532, 11571, 2905, 5475, 7, 17, 15, 15, 11, 13047, 1949, 1703, 45554, 2762, 340, 16867, 7860, 5475, 10421, 741, 77333, 26316, 1669, 1532, 11571, 26316, 3038...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestDLOConcurrentWrite(t *testing.T) { ctx := context.Background() c, rollback := makeConnectionWithSegmentsContainer(t) defer rollback() nConcurrency := 5 nChunks := 100 var chunkSize int64 = 1024 writeFn := func(i int) { objName := fmt.Sprintf("%s_concurrent_dlo_%d", OBJECT, i) opts := swift.LargeObjectOpts{ Container: CONTAINER, ObjectName: objName, ContentType: "image/jpeg", } out, err := c.DynamicLargeObjectCreate(ctx, &opts) if err != nil { t.Fatal(err) } defer func() { err = c.DynamicLargeObjectDelete(ctx, CONTAINER, objName) if err != nil { t.Fatal(err) } }() buf := &bytes.Buffer{} for j := 0; j < nChunks; j++ { var data []byte var n int data, err = ioutil.ReadAll(io.LimitReader(rand.Reader, chunkSize)) if err != nil { t.Fatal(err) } multi := io.MultiWriter(buf, out) n, err = multi.Write(data) if err != nil { t.Fatal(err) } if int64(n) != chunkSize { t.Fatalf("expected to write %d, got: %d", chunkSize, n) } } err = out.CloseWithContext(ctx) if err != nil { t.Error(err) } expected := buf.String() contents, err := c.ObjectGetString(ctx, CONTAINER, objName) if err != nil { t.Error(err) } if contents != expected { t.Error("Contents wrong") } } wg := sync.WaitGroup{} for i := 0; i < nConcurrency; i++ { wg.Add(1) go func(i int) { defer wg.Done() writeFn(i) }(i) } wg.Wait() }
explode_data.jsonl/12728
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 668 }
[ 2830, 3393, 35, 1593, 1109, 3231, 7985, 1155, 353, 8840, 836, 8, 341, 20985, 1669, 2266, 19047, 741, 1444, 11, 60414, 1669, 1281, 4526, 2354, 64813, 4502, 1155, 340, 16867, 60414, 2822, 9038, 79611, 1669, 220, 20, 198, 9038, 89681, 1669...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestParsing(t *testing.T) { fmt.Println("TestParsing") testAnnot(t, "func", nil, true) testAnnot(t, "func:", nil, true) testAnnot(t, "func:*", nil, true) testAnnot(t, "func:\"a b\"", nil, true) testAnnot(t, "func:\"a\\cb\"", &FuncAnnot{ Name: "acb", }, false) }
explode_data.jsonl/19008
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 133 }
[ 2830, 3393, 68839, 1155, 353, 8840, 836, 8, 341, 11009, 12419, 445, 2271, 68839, 1138, 18185, 2082, 1921, 1155, 11, 330, 2830, 497, 2092, 11, 830, 340, 18185, 2082, 1921, 1155, 11, 330, 2830, 12147, 2092, 11, 830, 340, 18185, 2082, 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 TestTransportCancelRequest(t *testing.T) { defer afterTest(t) if testing.Short() { t.Skip("skipping test in -short mode") } unblockc := make(chan bool) ts := httptest.NewServer(HandlerFunc(func(w ResponseWriter, r *Request) { fmt.Fprintf(w, "Hello") w.(Flusher).Flush() // send headers and some body <-unblockc })) defer ts.Close() defer close(unblockc) tr := &Transport{} defer tr.CloseIdleConnections() c := &Client{Transport: tr} req, _ := NewRequest("GET", ts.URL, nil) res, err := c.Do(req) if err != nil { t.Fatal(err) } go func() { time.Sleep(1 * time.Second) tr.CancelRequest(req) }() t0 := time.Now() body, err := ioutil.ReadAll(res.Body) d := time.Since(t0) if err != ExportErrRequestCanceled { t.Errorf("Body.Read error = %v; want errRequestCanceled", err) } if string(body) != "Hello" { t.Errorf("Body = %q; want Hello", body) } if d < 500*time.Millisecond { t.Errorf("expected ~1 second delay; got %v", d) } // Verify no outstanding requests after readLoop/writeLoop // goroutines shut down. for tries := 5; tries > 0; tries-- { n := tr.NumPendingRequestsForTesting() if n == 0 { break } time.Sleep(100 * time.Millisecond) if tries == 1 { t.Errorf("pending requests = %d; want 0", n) } } }
explode_data.jsonl/4900
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 532 }
[ 2830, 3393, 27560, 9269, 1900, 1155, 353, 8840, 836, 8, 341, 16867, 1283, 2271, 1155, 340, 743, 7497, 55958, 368, 341, 197, 3244, 57776, 445, 4886, 5654, 1273, 304, 481, 8676, 3856, 1138, 197, 532, 20479, 4574, 66, 1669, 1281, 35190, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestKubeadmConfigReconciler_Reconcile_DiscoveryReconcileBehaviors(t *testing.T) { k := &KubeadmConfigReconciler{ Client: helpers.NewFakeClientWithScheme(setupScheme()), KubeadmInitLock: &myInitLocker{}, remoteClientGetter: fakeremote.NewClusterClient, } caHash := []string{"...."} bootstrapToken := kubeadmv1beta1.Discovery{ BootstrapToken: &kubeadmv1beta1.BootstrapTokenDiscovery{ CACertHashes: caHash, }, } goodcluster := &clusterv1.Cluster{ Spec: clusterv1.ClusterSpec{ ControlPlaneEndpoint: clusterv1.APIEndpoint{ Host: "example.com", Port: 6443, }, }, } testcases := []struct { name string cluster *clusterv1.Cluster config *bootstrapv1.KubeadmConfig validateDiscovery func(*WithT, *bootstrapv1.KubeadmConfig) error }{ { name: "Automatically generate token if discovery not specified", cluster: goodcluster, config: &bootstrapv1.KubeadmConfig{ Spec: bootstrapv1.KubeadmConfigSpec{ JoinConfiguration: &kubeadmv1beta1.JoinConfiguration{ Discovery: bootstrapToken, }, }, }, validateDiscovery: func(g *WithT, c *bootstrapv1.KubeadmConfig) error { d := c.Spec.JoinConfiguration.Discovery g.Expect(d.BootstrapToken).NotTo(BeNil()) g.Expect(d.BootstrapToken.Token).NotTo(Equal("")) g.Expect(d.BootstrapToken.APIServerEndpoint).To(Equal("example.com:6443")) g.Expect(d.BootstrapToken.UnsafeSkipCAVerification).To(BeFalse()) return nil }, }, { name: "Respect discoveryConfiguration.File", cluster: goodcluster, config: &bootstrapv1.KubeadmConfig{ Spec: bootstrapv1.KubeadmConfigSpec{ JoinConfiguration: &kubeadmv1beta1.JoinConfiguration{ Discovery: kubeadmv1beta1.Discovery{ File: &kubeadmv1beta1.FileDiscovery{}, }, }, }, }, validateDiscovery: func(g *WithT, c *bootstrapv1.KubeadmConfig) error { d := c.Spec.JoinConfiguration.Discovery g.Expect(d.BootstrapToken).To(BeNil()) return nil }, }, { name: "Respect discoveryConfiguration.BootstrapToken.APIServerEndpoint", cluster: goodcluster, config: &bootstrapv1.KubeadmConfig{ Spec: bootstrapv1.KubeadmConfigSpec{ JoinConfiguration: &kubeadmv1beta1.JoinConfiguration{ Discovery: kubeadmv1beta1.Discovery{ BootstrapToken: &kubeadmv1beta1.BootstrapTokenDiscovery{ CACertHashes: caHash, APIServerEndpoint: "bar.com:6443", }, }, }, }, }, validateDiscovery: func(g *WithT, c *bootstrapv1.KubeadmConfig) error { d := c.Spec.JoinConfiguration.Discovery g.Expect(d.BootstrapToken.APIServerEndpoint).To(Equal("bar.com:6443")) return nil }, }, { name: "Respect discoveryConfiguration.BootstrapToken.Token", cluster: goodcluster, config: &bootstrapv1.KubeadmConfig{ Spec: bootstrapv1.KubeadmConfigSpec{ JoinConfiguration: &kubeadmv1beta1.JoinConfiguration{ Discovery: kubeadmv1beta1.Discovery{ BootstrapToken: &kubeadmv1beta1.BootstrapTokenDiscovery{ CACertHashes: caHash, Token: "abcdef.0123456789abcdef", }, }, }, }, }, validateDiscovery: func(g *WithT, c *bootstrapv1.KubeadmConfig) error { d := c.Spec.JoinConfiguration.Discovery g.Expect(d.BootstrapToken.Token).To(Equal("abcdef.0123456789abcdef")) return nil }, }, { name: "Respect discoveryConfiguration.BootstrapToken.CACertHashes", cluster: goodcluster, config: &bootstrapv1.KubeadmConfig{ Spec: bootstrapv1.KubeadmConfigSpec{ JoinConfiguration: &kubeadmv1beta1.JoinConfiguration{ Discovery: kubeadmv1beta1.Discovery{ BootstrapToken: &kubeadmv1beta1.BootstrapTokenDiscovery{ CACertHashes: caHash, }, }, }, }, }, validateDiscovery: func(g *WithT, c *bootstrapv1.KubeadmConfig) error { d := c.Spec.JoinConfiguration.Discovery g.Expect(reflect.DeepEqual(d.BootstrapToken.CACertHashes, caHash)).To(BeTrue()) return nil }, }, } for _, tc := range testcases { t.Run(tc.name, func(t *testing.T) { g := NewWithT(t) res, err := k.reconcileDiscovery(ctx, tc.cluster, tc.config, secret.Certificates{}) g.Expect(res.IsZero()).To(BeTrue()) g.Expect(err).NotTo(HaveOccurred()) err = tc.validateDiscovery(g, tc.config) g.Expect(err).NotTo(HaveOccurred()) }) } }
explode_data.jsonl/44325
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 2039 }
[ 2830, 3393, 42, 392, 3149, 76, 2648, 693, 40446, 5769, 50693, 40446, 457, 45525, 7449, 693, 40446, 457, 10021, 22176, 1155, 353, 8840, 836, 8, 341, 16463, 1669, 609, 42, 392, 3149, 76, 2648, 693, 40446, 5769, 515, 197, 71724, 25, 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...
1
func TestNodes_IterateSortedPair(t *testing.T) { nodes := Nodes{ &Node{val: []byte("e")}, &Node{val: []byte("d")}, &Node{val: []byte("c")}, &Node{val: []byte("b")}, &Node{val: []byte("a")}, } t.Run("Should Return The Odd Node", func(t *testing.T) { odd := nodes.IterateSortedPair(func(i, j *Node) {}) if odd == nil { t.Errorf("expected odd Node to be returned") } else if bytes.Compare(nodes[len(nodes)-1].val, odd.val) != 0 { t.Errorf("wrong odd node was returned") } }) t.Run("Should Return A nil Odd Node", func(t *testing.T) { odd := nodes[:len(nodes)-1].IterateSortedPair(func(i, j *Node) {}) if odd != nil { t.Errorf("unexpected odd Node returned") } }) t.Run("Should Iterate And Sort Pair Correctly", func(t *testing.T) { exp4iters := map[int][]*Node{ 0: []*Node{nodes[1], nodes[0]}, 1: []*Node{nodes[3], nodes[2]}, } iteration := 0 nodes.IterateSortedPair(func(i, j *Node) { acti := i.val actj := j.val expi := exp4iters[iteration][0].val expj := exp4iters[iteration][1].val if bytes.Compare(acti, expi) != 0 { t.Errorf("expected i[%d] to be %s, got %s", iteration, expi, acti) } if bytes.Compare(actj, expj) != 0 { t.Errorf("expected j[%d] to be %s, got %s", iteration, expj, actj) } iteration++ }) }) }
explode_data.jsonl/57990
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 601 }
[ 2830, 3393, 12288, 7959, 465, 349, 51051, 12443, 1155, 353, 8840, 836, 8, 1476, 79756, 1669, 52501, 515, 197, 197, 5, 1955, 90, 831, 25, 3056, 3782, 445, 68, 79583, 197, 197, 5, 1955, 90, 831, 25, 3056, 3782, 445, 67, 79583, 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 TestGetAvoidPodsFromNode(t *testing.T) { controllerFlag := true testCases := []struct { node *v1.Node expectValue v1.AvoidPods expectErr bool }{ { node: &v1.Node{}, expectValue: v1.AvoidPods{}, expectErr: false, }, { node: &v1.Node{ ObjectMeta: metav1.ObjectMeta{ Annotations: map[string]string{ v1.PreferAvoidPodsAnnotationKey: ` { "preferAvoidPods": [ { "podSignature": { "podController": { "apiVersion": "v1", "kind": "ReplicationController", "name": "foo", "uid": "abcdef123456", "controller": true } }, "reason": "some reason", "message": "some message" } ] }`, }, }, }, expectValue: v1.AvoidPods{ PreferAvoidPods: []v1.PreferAvoidPodsEntry{ { PodSignature: v1.PodSignature{ PodController: &metav1.OwnerReference{ APIVersion: "v1", Kind: "ReplicationController", Name: "foo", UID: "abcdef123456", Controller: &controllerFlag, }, }, Reason: "some reason", Message: "some message", }, }, }, expectErr: false, }, { node: &v1.Node{ // Missing end symbol of "podController" and "podSignature" ObjectMeta: metav1.ObjectMeta{ Annotations: map[string]string{ v1.PreferAvoidPodsAnnotationKey: ` { "preferAvoidPods": [ { "podSignature": { "podController": { "kind": "ReplicationController", "apiVersion": "v1" "reason": "some reason", "message": "some message" } ] }`, }, }, }, expectValue: v1.AvoidPods{}, expectErr: true, }, } for i, tc := range testCases { v, err := GetAvoidPodsFromNodeAnnotations(tc.node.Annotations) if err == nil && tc.expectErr { t.Errorf("[%v]expected error but got none.", i) } if err != nil && !tc.expectErr { t.Errorf("[%v]did not expect error but got: %v", i, err) } if !reflect.DeepEqual(tc.expectValue, v) { t.Errorf("[%v]expect value %v but got %v with %v", i, tc.expectValue, v, v.PreferAvoidPods[0].PodSignature.PodController.Controller) } } }
explode_data.jsonl/25714
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1508 }
[ 2830, 3393, 1949, 52116, 23527, 82, 3830, 1955, 1155, 353, 8840, 836, 8, 341, 61615, 12135, 1669, 830, 198, 18185, 37302, 1669, 3056, 1235, 341, 197, 20831, 286, 353, 85, 16, 21714, 198, 197, 24952, 1130, 348, 16, 875, 1004, 23527, 82...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
7
func TestInvalid(t *testing.T) { invalidSQL := []struct { input string err string }{{ input: "select a, b from (select * from tbl) sort by a", err: "syntax error", }, { input: "/*!*/", err: "query was empty", }} for _, tcase := range invalidSQL { _, err := Parse(tcase.input) if err == nil { t.Errorf("Parse invalid query(%q), got: nil, want: %s...", tcase.input, tcase.err) } if err != nil && !strings.Contains(err.Error(), tcase.err) { t.Errorf("Parse invalid query(%q), got: %v, want: %s...", tcase.input, err, tcase.err) } } }
explode_data.jsonl/27180
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 248 }
[ 2830, 3393, 7928, 1155, 353, 8840, 836, 8, 341, 197, 11808, 6688, 1669, 3056, 1235, 341, 197, 22427, 914, 198, 197, 9859, 256, 914, 198, 197, 15170, 515, 197, 22427, 25, 330, 1742, 264, 11, 293, 504, 320, 1742, 353, 504, 21173, 8, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
5
func TestSchemaDeref(t *testing.T) { sch := []byte(`{ "definitions": { "a": {"type": "integer"}, "b": {"$ref": "#/definitions/a"}, "c": {"$ref": "#/definitions/b"} }, "$ref": "#/definitions/c" }`) rs := &RootSchema{} if err := rs.UnmarshalJSON(sch); err != nil { t.Errorf("unexpected unmarshal error: %s", err.Error()) return } got, err := rs.ValidateBytes([]byte(`"a"`)) if err != nil { t.Errorf("error validating bytes: %s", err.Error()) return } if got == nil { t.Errorf("expected error, got nil") return } }
explode_data.jsonl/30315
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 261 }
[ 2830, 3393, 8632, 35, 43970, 1155, 353, 8840, 836, 8, 341, 1903, 331, 1669, 3056, 3782, 5809, 515, 262, 330, 48563, 788, 341, 286, 330, 64, 788, 5212, 1313, 788, 330, 11662, 7115, 286, 330, 65, 788, 5212, 3, 1097, 788, 5869, 14, 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...
4
func TestValidatorSetVerifyCommit(t *testing.T) { privKey := ed25519.GenPrivKey() pubKey := privKey.PubKey() v1 := NewValidator(pubKey, 1000) vset := NewValidatorSet([]*Validator{v1}) chainID := "mychainID" blockID := BlockID{Hash: []byte("hello")} height := int64(5) vote := &Vote{ ValidatorAddress: v1.Address, ValidatorIndex: 0, Height: height, Round: 0, Timestamp: tmtime.Now(), Type: PrecommitType, BlockID: blockID, } sig, err := privKey.Sign(vote.SignBytes(chainID)) assert.NoError(t, err) vote.Signature = sig commit := NewCommit(blockID, []*CommitSig{vote.CommitSig()}) badChainID := "notmychainID" badBlockID := BlockID{Hash: []byte("goodbye")} badHeight := height + 1 badCommit := NewCommit(blockID, []*CommitSig{nil}) // test some error cases // TODO: test more cases! cases := []struct { chainID string blockID BlockID height int64 commit *Commit }{ {badChainID, blockID, height, commit}, {chainID, badBlockID, height, commit}, {chainID, blockID, badHeight, commit}, {chainID, blockID, height, badCommit}, } for i, c := range cases { err := vset.VerifyCommit(c.chainID, c.blockID, c.height, c.commit) assert.NotNil(t, err, i) } // test a good one err = vset.VerifyCommit(chainID, blockID, height, commit) assert.Nil(t, err) }
explode_data.jsonl/28325
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 579 }
[ 2830, 3393, 14256, 1649, 32627, 33441, 1155, 353, 8840, 836, 8, 341, 71170, 1592, 1669, 1578, 17, 20, 20, 16, 24, 65384, 32124, 1592, 741, 62529, 1592, 1669, 6095, 1592, 1069, 392, 1592, 741, 5195, 16, 1669, 1532, 14256, 74186, 1592, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestPatternDays(t *testing.T) { f := newTestLister(t) entries, err := days(context.Background(), f, "potato/", []string{"", "2020"}) require.NoError(t, err) assert.Equal(t, 366, len(entries)) assert.Equal(t, "potato/2020-01-01", entries[0].Remote()) assert.Equal(t, "potato/2020-12-31", entries[len(entries)-1].Remote()) }
explode_data.jsonl/24370
{ "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, 15760, 20557, 1155, 353, 8840, 836, 8, 341, 1166, 1669, 501, 2271, 852, 261, 1155, 340, 197, 12940, 11, 1848, 1669, 2849, 5378, 19047, 1507, 282, 11, 330, 19099, 4330, 28105, 3056, 917, 4913, 497, 330, 17, 15, 17, 15, 23...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestIssue26958(t *testing.T) { store, clean := testkit.CreateMockStore(t) defer clean() tk := testkit.NewTestKit(t, store) tk.MustExec("use test;") tk.MustExec("drop table if exists t1;") tk.MustExec("create table t1 (c_int int not null);") tk.MustExec("insert into t1 values (1), (2), (3),(1),(2),(3);") tk.MustExec("drop table if exists t2;") tk.MustExec("create table t2 (c_int int not null);") tk.MustExec("insert into t2 values (1), (2), (3),(1),(2),(3);") tk.MustQuery("select \n(select count(distinct c_int) from t2 where c_int >= t1.c_int) c1, \n(select count(distinct c_int) from t2 where c_int >= t1.c_int) c2\nfrom t1 group by c_int;\n"). Check(testkit.Rows("3 3", "2 2", "1 1")) }
explode_data.jsonl/65602
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 298 }
[ 2830, 3393, 42006, 17, 21, 24, 20, 23, 1155, 353, 8840, 836, 8, 341, 57279, 11, 4240, 1669, 1273, 8226, 7251, 11571, 6093, 1155, 340, 16867, 4240, 2822, 3244, 74, 1669, 1273, 8226, 7121, 2271, 7695, 1155, 11, 3553, 340, 3244, 74, 50...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestSendAlertFailureToGetRule(t *testing.T) { sqsMock := &mockSqs{} sqsClient = sqsMock mockRoundTripper := &mockRoundTripper{} httpClient = &http.Client{Transport: mockRoundTripper} mockRoundTripper.On("RoundTrip", mock.Anything).Return(generateResponse(testRuleResponse, http.StatusInternalServerError), nil).Once() assert.Error(t, SendAlert(testAlertDedupEvent)) sqsMock.AssertExpectations(t) mockRoundTripper.AssertExpectations(t) }
explode_data.jsonl/39037
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 164 }
[ 2830, 3393, 11505, 9676, 17507, 1249, 1949, 11337, 1155, 353, 8840, 836, 8, 341, 1903, 26358, 11571, 1669, 609, 16712, 50, 26358, 16094, 1903, 26358, 2959, 284, 18031, 82, 11571, 271, 77333, 27497, 21884, 6922, 1669, 609, 16712, 27497, 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...
1
func TestUserEntityVerifyWRONGBODY(t *testing.T) { resp := sendPost("http://localhost:8080/Login", APPJASON_UTF_8, UserEntityVerifyWRONGBODY) response := responseToString(resp) compareResults(t, response, HyperText.CustomResponses["wrong-body"]) }
explode_data.jsonl/59334
{ "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, 1474, 3030, 32627, 17925, 711, 5381, 21050, 1155, 353, 8840, 836, 8, 341, 34653, 1669, 3624, 4133, 445, 1254, 1110, 8301, 25, 23, 15, 23, 15, 54803, 497, 17912, 41, 35304, 55061, 62, 23, 11, 2657, 3030, 32627, 17925, 711, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestRegisterProcessor(t *testing.T) { err := RegisterProcessor(TaskTypeTestProcessorMockup1, new(processorMockupForProcessorTest1)) assert.NoError(t, err) proc, err := NewProcessor(TaskTypeTestProcessorMockup1) assert.NoError(t, err) assert.NotNil(t, proc) assert.IsType(t, new(processorMockupForProcessorTest1), proc) err = RegisterProcessor(TaskTypeTestProcessorMockup1, new(processorMockupForProcessorTest1)) assert.Error(t, err) // cleanup _processRegistry = nil }
explode_data.jsonl/45100
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 174 }
[ 2830, 3393, 8690, 22946, 1155, 353, 8840, 836, 8, 341, 9859, 1669, 8451, 22946, 47531, 929, 2271, 22946, 11571, 454, 16, 11, 501, 21929, 269, 11571, 454, 2461, 22946, 2271, 16, 1171, 6948, 35699, 1155, 11, 1848, 692, 197, 15782, 11, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestLoadBalancerCheckChanges(t *testing.T) { testCases := []struct { a, e, changes *LoadBalancer success bool }{ { a: nil, e: &LoadBalancer{Name: to.StringPtr("name")}, changes: nil, success: true, }, { a: nil, e: &LoadBalancer{Name: nil}, changes: nil, success: false, }, { a: &LoadBalancer{Name: to.StringPtr("name")}, changes: &LoadBalancer{Name: nil}, success: true, }, { a: &LoadBalancer{Name: to.StringPtr("name")}, changes: &LoadBalancer{Name: to.StringPtr("newName")}, success: false, }, } for i, tc := range testCases { t.Run(fmt.Sprintf("test case %d", i), func(t *testing.T) { loadBalancer := LoadBalancer{} err := loadBalancer.CheckChanges(tc.a, tc.e, tc.changes) if tc.success != (err == nil) { t.Errorf("expected success=%t, but got err=%v", tc.success, err) } }) } }
explode_data.jsonl/768
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 437 }
[ 2830, 3393, 5879, 93825, 3973, 11317, 1155, 353, 8840, 836, 8, 341, 18185, 37302, 1669, 3056, 1235, 341, 197, 11323, 11, 384, 11, 4344, 353, 5879, 93825, 198, 197, 30553, 981, 1807, 198, 197, 59403, 197, 197, 515, 298, 11323, 25, 981,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestKnownTypesInCRDDiffing(t *testing.T) { dummiesGVR := schema.GroupVersionResource{Group: "argoproj.io", Version: "v1alpha1", Resource: "dummies"} Given(t). Path("crd-creation"). When().CreateApp().Sync().Then(). Expect(OperationPhaseIs(OperationSucceeded)).Expect(SyncStatusIs(SyncStatusCodeSynced)). When(). And(func() { dummyResIf := DynamicClientset.Resource(dummiesGVR).Namespace(DeploymentNamespace()) patchData := []byte(`{"spec":{"cpu": "2"}}`) FailOnErr(dummyResIf.Patch(context.Background(), "dummy-crd-instance", types.MergePatchType, patchData, metav1.PatchOptions{})) }).Refresh(RefreshTypeNormal). Then(). Expect(SyncStatusIs(SyncStatusCodeOutOfSync)). When(). And(func() { SetResourceOverrides(map[string]ResourceOverride{ "argoproj.io/Dummy": { KnownTypeFields: []KnownTypeField{{ Field: "spec", Type: "core/v1/ResourceList", }}, }, }) }). Refresh(RefreshTypeNormal). Then(). Expect(SyncStatusIs(SyncStatusCodeSynced)) }
explode_data.jsonl/35633
{ "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, 48206, 4173, 641, 8973, 4103, 3092, 287, 1155, 353, 8840, 836, 8, 341, 2698, 49179, 38, 18800, 1669, 10802, 5407, 5637, 4783, 90, 2808, 25, 330, 858, 45926, 73, 4245, 497, 6079, 25, 330, 85, 16, 7141, 16, 497, 11765, 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 TestColorMAssign(t *testing.T) { m := ebiten.ColorM{} m.SetElement(0, 0, 1) m2 := m m.SetElement(0, 0, 0) got := m2.Element(0, 0) want := 1.0 if want != got { t.Errorf("m2.Element(%d, %d) = %f, want %f", 0, 0, got, want) } }
explode_data.jsonl/48448
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 125 }
[ 2830, 3393, 1636, 4835, 778, 622, 1155, 353, 8840, 836, 8, 341, 2109, 1669, 384, 4489, 268, 6669, 44, 16094, 2109, 4202, 1691, 7, 15, 11, 220, 15, 11, 220, 16, 340, 2109, 17, 1669, 296, 198, 2109, 4202, 1691, 7, 15, 11, 220, 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 TestIsElectionTimeout(t *testing.T) { tests := []struct { elapse int wprobability float64 round bool }{ {5, 0, false}, {13, 0.3, true}, {15, 0.5, true}, {18, 0.8, true}, {20, 1, false}, } for i, tt := range tests { sm := newRaft(1, []uint64{1}, 10, 1, NewMemoryStorage(), 0) sm.elapsed = tt.elapse c := 0 for j := 0; j < 10000; j++ { if sm.isElectionTimeout() { c++ } } got := float64(c) / 10000.0 if tt.round { got = math.Floor(got*10+0.5) / 10.0 } if got != tt.wprobability { t.Errorf("#%d: possibility = %v, want %v", i, got, tt.wprobability) } } }
explode_data.jsonl/67346
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 324 }
[ 2830, 3393, 3872, 36, 1170, 7636, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 3056, 1235, 341, 197, 59636, 7477, 981, 526, 198, 197, 6692, 87440, 2224, 21, 19, 198, 197, 197, 1049, 286, 1807, 198, 197, 59403, 197, 197, 90, 20, 11, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
6
func TestGuestClockDelta(t *testing.T) { local := time.Now() h := tests.NewMockHost() // Truncate remote clock so that it is between 0 and 1 second behind h.CommandOutput["date +%s.%N"] = fmt.Sprintf("%d.0000", local.Unix()) got, err := guestClockDelta(h, local) if err != nil { t.Fatalf("guestClock: %v", err) } if got > (0 * time.Second) { t.Errorf("unexpected positive delta (remote should be behind): %s", got) } if got < (-1 * time.Second) { t.Errorf("unexpectedly negative delta (remote too far behind): %s", got) } }
explode_data.jsonl/4194
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 202 }
[ 2830, 3393, 37804, 26104, 20277, 1155, 353, 8840, 836, 8, 341, 8854, 1669, 882, 13244, 741, 9598, 1669, 7032, 7121, 11571, 9296, 741, 197, 322, 1163, 26900, 8699, 8866, 773, 429, 432, 374, 1948, 220, 15, 323, 220, 16, 2086, 4815, 198,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
4
func TestDestroyAllNoUsers(t *testing.T) { testutil.LoadDatabase(t) core, _ := component.NewCoreMock() mux := router.New() user.New(core).Routes(mux) r := httptest.NewRequest("DELETE", "/v1/user", nil) r.Header.Add("Content-Type", "application/x-www-form-urlencoded") w := httptest.NewRecorder() mux.ServeHTTP(w, r) assert.Equal(t, http.StatusBadRequest, w.Code) assert.Contains(t, w.Body.String(), `no users to delete`) }
explode_data.jsonl/36368
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 177 }
[ 2830, 3393, 14245, 2403, 2753, 7137, 1155, 353, 8840, 836, 8, 341, 18185, 1314, 13969, 5988, 1155, 340, 71882, 11, 716, 1669, 3692, 7121, 5386, 11571, 2822, 2109, 2200, 1669, 9273, 7121, 741, 19060, 7121, 47867, 568, 26653, 1255, 2200, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestDecryptKMSNoEncryptionContext(t *testing.T) { client := mockKMSClientNoEncryptionContext{} result, _ := decryptKMS(client, mockEncryptedAPIKeyBase64) assert.Equal(t, expectedDecryptedAPIKey, result) }
explode_data.jsonl/4338
{ "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, 89660, 42, 4826, 2753, 79239, 1972, 1155, 353, 8840, 836, 8, 341, 25291, 1669, 7860, 42, 4826, 2959, 2753, 79239, 1972, 16094, 9559, 11, 716, 1669, 38126, 42, 4826, 12805, 11, 7860, 7408, 14026, 7082, 1592, 3978, 21, 19, 3...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
func TestLevelDBSanity(t *testing.T) { ldb, teardownFunc := prepareDatabaseForTest(t, "TestLevelDBSanity") defer teardownFunc() // Put something into the db key := database.MakeBucket(nil).Key([]byte("key")) putData := []byte("Hello world!") err := ldb.Put(key, putData) if err != nil { t.Fatalf("TestLevelDBSanity: Put returned "+ "unexpected error: %s", err) } // Get from the key previously put to getData, err := ldb.Get(key) if err != nil { t.Fatalf("TestLevelDBSanity: Get returned "+ "unexpected error: %s", err) } // Make sure that the put data and the get data are equal if !reflect.DeepEqual(getData, putData) { t.Fatalf("TestLevelDBSanity: get data and "+ "put data are not equal. Put: %s, got: %s", string(putData), string(getData)) } }
explode_data.jsonl/41514
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 298 }
[ 2830, 3393, 4449, 3506, 23729, 487, 1155, 353, 8840, 836, 8, 341, 197, 56925, 11, 49304, 9626, 1669, 10549, 5988, 2461, 2271, 1155, 11, 330, 2271, 4449, 3506, 23729, 487, 1138, 16867, 49304, 9626, 2822, 197, 322, 10224, 2494, 1119, 279,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestDominatorsMultPredFwd(t *testing.T) { c := testConfig(t) fun := Fun(c, "entry", Bloc("entry", Valu("mem", OpInitMem, TypeMem, 0, nil), Valu("p", OpConstBool, TypeBool, 1, nil), If("p", "a", "c")), Bloc("a", If("p", "b", "c")), Bloc("b", Goto("c")), Bloc("c", Goto("exit")), Bloc("exit", Exit("mem"))) doms := map[string]string{ "a": "entry", "b": "a", "c": "entry", "exit": "c", } CheckFunc(fun.f) verifyDominators(t, fun, dominators, doms) verifyDominators(t, fun, dominatorsSimple, doms) }
explode_data.jsonl/77583
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 282 }
[ 2830, 3393, 71541, 2973, 40404, 50925, 37, 6377, 1155, 353, 8840, 836, 8, 341, 1444, 1669, 1273, 2648, 1155, 340, 90126, 1669, 16071, 1337, 11, 330, 4085, 756, 197, 12791, 1074, 445, 4085, 756, 298, 197, 2208, 84, 445, 10536, 497, 106...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestLinuxConn_bindBindErrorCloseSocket(t *testing.T) { // Trigger an error during bind with Bind, meaning that the socket should be // closed to avoid leaking file descriptors. s := &testSocket{ bindErr: errors.New("cannot bind"), } if _, _, err := bind(s, &Config{}); err == nil { t.Fatal("no error occurred, but expected one") } if want, got := true, s.closed; want != got { t.Fatalf("unexpected socket closed:\n- want: %v\n- got: %v", want, got) } }
explode_data.jsonl/33484
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 170 }
[ 2830, 3393, 46324, 9701, 27461, 9950, 1454, 7925, 10286, 1155, 353, 8840, 836, 8, 341, 197, 322, 30291, 458, 1465, 2337, 10719, 448, 29189, 11, 7290, 429, 279, 7575, 1265, 387, 198, 197, 322, 7877, 311, 5648, 51829, 1034, 47517, 624, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestSeries_Contains(t *testing.T) { // assert that function returns a correct bool Series s := NewSeries("test", "we are", "leaving", nil, "right now", "now now!!") assert.Equal(t, NewSeries("Contains(test)", false, false, false, true, true), s.Contains("now")) }
explode_data.jsonl/54086
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 92 }
[ 2830, 3393, 25544, 62, 23805, 1155, 353, 8840, 836, 8, 341, 197, 322, 2060, 429, 729, 4675, 264, 4396, 1807, 11131, 198, 1903, 1669, 1532, 25544, 445, 1944, 497, 330, 896, 525, 497, 330, 273, 2317, 497, 2092, 11, 330, 1291, 1431, 49...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestParseCommandLine3(t *testing.T) { g := NewWithT(t) cmdLine := utils.ParseCommandLine("go test ./test/integration -test.timeout 300s -count 1 --run \"^(TestNSMHealLocalDieNSMD)$\\\\z\" --tags \"basic recover usecase\" --test.v") g.Expect(len(cmdLine)).To(Equal(12)) g.Expect(cmdLine[8]).To(Equal("^(TestNSMHealLocalDieNSMD)$\\z")) }
explode_data.jsonl/59871
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 140 }
[ 2830, 3393, 14463, 71885, 18, 1155, 353, 8840, 836, 8, 341, 3174, 1669, 1532, 2354, 51, 1155, 692, 25920, 2460, 1669, 12439, 8937, 71885, 445, 3346, 1273, 12991, 1944, 31114, 17376, 481, 1944, 36110, 220, 18, 15, 15, 82, 481, 1830, 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 TestCheckQuery(t *testing.T) { failureCases := []struct { name string query url.Values falseExpect url.Values }{ { name: "unequal", query: url.Values{ "foo": {"abc"}, "bar": {"123"}, }, falseExpect: url.Values{ "foo": {"def"}, "bar": {"456"}, }, }, { name: "unexpected field", query: url.Values{ "foo": {"present"}, }, falseExpect: url.Values{}, }, { name: "missing field", query: url.Values{}, falseExpect: url.Values{ "foo": {"I expected this to be here"}, }, }, { name: "empty query", query: url.Values{ "foo": {}, }, falseExpect: url.Values{ "foo": {"this should be filled"}, }, }, } t.Run("success", func(t *testing.T) { CheckQuery(t, url.Values{ "foo": {"present"}, "bar": {"123"}, }, url.Values{ "foo": {"present"}, "bar": {"123"}, }) }) t.Run("failure", func(t *testing.T) { for _, c := range failureCases { t.Run(c.name, func(t *testing.T) { tMock := new(testing.T) CheckQuery(tMock, c.query, c.falseExpect) assert.True(t, tMock.Failed()) }) } }) }
explode_data.jsonl/73734
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 556 }
[ 2830, 3393, 3973, 2859, 1155, 353, 8840, 836, 8, 341, 1166, 9373, 37302, 1669, 3056, 1235, 341, 197, 11609, 286, 914, 198, 197, 27274, 981, 2515, 35145, 198, 197, 36012, 17536, 2515, 35145, 198, 197, 59403, 197, 197, 515, 298, 11609, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestNetworkPolicyRead(t *testing.T) { r := require.New(t) in := map[string]interface{}{ "name": "good-network-policy", "allowed_ip_list": []interface{}{"192.168.1.0/24"}, "blocked_ip_list": []interface{}{"155.548.2.98"}, } d := networkPolicy(t, "good-network-policy", in) WithMockDb(t, func(db *sql.DB, mock sqlmock.Sqlmock) { // Test when resource is not found, checking if state will be empty r.NotEmpty(d.State()) q := snowflake.NetworkPolicy(d.Id()).ShowAllNetworkPolicies() mock.ExpectQuery(q).WillReturnError(sql.ErrNoRows) err1 := resources.ReadNetworkPolicy(d, db) r.Empty(d.State()) rows := sqlmock.NewRows([]string{ "created_on", "name", "comment", "entries_in_allowed_ip_list", "entries_in_blocked_ip_list", }).AddRow( time.Date(2000, 1, 1, 0, 0, 0, 0, time.UTC), "bad-network-policy", "this is a comment", 2, 1, ) mock.ExpectQuery(q).WillReturnRows(rows) err2 := resources.ReadNetworkPolicy(d, db) r.Nil(err1) r.Nil(err2) }) }
explode_data.jsonl/50828
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 432 }
[ 2830, 3393, 12320, 13825, 4418, 1155, 353, 8840, 836, 8, 341, 7000, 1669, 1373, 7121, 1155, 692, 17430, 1669, 2415, 14032, 31344, 67066, 197, 197, 31486, 788, 310, 330, 18536, 56732, 66420, 756, 197, 197, 1, 20967, 10385, 2019, 788, 305...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestPostgresStore_GC(t *testing.T) { ctx := context.Background() db, cleanup := newTestDB(t, ctx) t.Cleanup(func() { assert.Nil(t, cleanup()) }) now := time.Now() store, err := Initer()(ctx, Config{ nowFunc: func() time.Time { return now }, db: db, Lifetime: time.Second, InitTable: true, }, ) assert.Nil(t, err) sess1, err := store.Read(ctx, "1") assert.Nil(t, err) err = store.Save(ctx, sess1) assert.Nil(t, err) now = now.Add(-2 * time.Second) sess2, err := store.Read(ctx, "2") assert.Nil(t, err) sess2.Set("name", "flamego") err = store.Save(ctx, sess2) assert.Nil(t, err) // Read on an expired session should wipe data but preserve the record now = now.Add(2 * time.Second) tmp, err := store.Read(ctx, "2") assert.Nil(t, err) assert.Nil(t, tmp.Get("name")) now = now.Add(-2 * time.Second) sess3, err := store.Read(ctx, "3") assert.Nil(t, err) err = store.Save(ctx, sess3) assert.Nil(t, err) now = now.Add(2 * time.Second) err = store.GC(ctx) // sess3 should be recycled assert.Nil(t, err) assert.True(t, store.Exist(ctx, "1")) assert.False(t, store.Exist(ctx, "2")) assert.False(t, store.Exist(ctx, "3")) }
explode_data.jsonl/35244
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 531 }
[ 2830, 3393, 4133, 17818, 6093, 76915, 1155, 353, 8840, 836, 8, 341, 20985, 1669, 2266, 19047, 741, 20939, 11, 21290, 1669, 501, 2271, 3506, 1155, 11, 5635, 340, 3244, 727, 60639, 18552, 368, 341, 197, 6948, 59678, 1155, 11, 21290, 2398,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestDefaultAndApplyExpansionsToEnv(t *testing.T) { for testName, testCase := range map[string]func(t *testing.T, exp util.Expansions){ "SetsDefaultAndRequiredEnvWhenStandardValuesAreGiven": func(t *testing.T, exp util.Expansions) { opts := modifyEnvOptions{ taskID: "task_id", workingDir: "working_dir", tmpDir: "tmp_dir", } env := defaultAndApplyExpansionsToEnv(map[string]string{}, opts) assert.Len(t, env, 7) assert.Equal(t, opts.taskID, env[agentutil.MarkerTaskID]) assert.Contains(t, strconv.Itoa(os.Getpid()), env[agentutil.MarkerAgentPID]) assert.Contains(t, opts.tmpDir, env["TEMP"]) assert.Contains(t, opts.tmpDir, env["TMP"]) assert.Contains(t, opts.tmpDir, env["TMPDIR"]) assert.Equal(t, filepath.Join(opts.workingDir, ".gocache"), env["GOCACHE"]) assert.Equal(t, "true", env["CI"]) }, "SetsDefaultAndRequiredEnvEvenWhenStandardValuesAreZero": func(t *testing.T, exp util.Expansions) { env := defaultAndApplyExpansionsToEnv(map[string]string{}, modifyEnvOptions{}) assert.Len(t, env, 7) assert.Contains(t, env, agentutil.MarkerTaskID) assert.Contains(t, env, agentutil.MarkerAgentPID) assert.Contains(t, env, "TEMP") assert.Contains(t, env, "TMP") assert.Contains(t, env, "TMPDIR") assert.Equal(t, ".gocache", env["GOCACHE"]) assert.Equal(t, "true", env["CI"]) }, "AgentEnvVarsOverridesExplicitlySetEnvVars": func(t *testing.T, exp util.Expansions) { opts := modifyEnvOptions{ taskID: "real_task_id", } env := defaultAndApplyExpansionsToEnv(map[string]string{ agentutil.MarkerAgentPID: "12345", agentutil.MarkerTaskID: "fake_task_id", }, opts) assert.Equal(t, strconv.Itoa(os.Getpid()), env[agentutil.MarkerAgentPID]) assert.Equal(t, opts.taskID, env[agentutil.MarkerTaskID]) }, "ExplicitlySetEnVVarsOverrideDefaultEnvVars": func(t *testing.T, exp util.Expansions) { gocache := "/path/to/gocache" ci := "definitely not Jenkins" tmpDir := "/some/tmpdir" env := defaultAndApplyExpansionsToEnv(map[string]string{ "GOCACHE": gocache, "CI": ci, "TEMP": tmpDir, "TMP": "/some/tmpdir", "TMPDIR": tmpDir, }, modifyEnvOptions{tmpDir: "/tmp"}) assert.Equal(t, gocache, env["GOCACHE"]) assert.Equal(t, ci, env["CI"]) }, "AddExpansionsToEnvAddsAllExpansions": func(t *testing.T, exp util.Expansions) { env := defaultAndApplyExpansionsToEnv(map[string]string{ "key1": "val1", "key2": "val2", }, modifyEnvOptions{ expansions: exp, addExpansionsToEnv: true, }) assert.Equal(t, "val1", env["key1"]) assert.Equal(t, "val2", env["key2"]) for k, v := range exp.Map() { assert.Equal(t, v, env[k]) } }, "AddExpansionsToEnvOverridesDefaultEnvVars": func(t *testing.T, exp util.Expansions) { exp.Put("CI", "actually it's Jenkins") exp.Put("GOCACHE", "/path/to/gocache") env := defaultAndApplyExpansionsToEnv(map[string]string{}, modifyEnvOptions{ expansions: exp, addExpansionsToEnv: true, }) for k, v := range exp.Map() { assert.Equal(t, v, env[k]) } }, "AgentEnvVarsOverrideExpansionsAddedToEnv": func(t *testing.T, exp util.Expansions) { agentEnvVars := map[string]string{ agentutil.MarkerAgentPID: "12345", agentutil.MarkerTaskID: "fake_task_id", } exp.Update(agentEnvVars) opts := modifyEnvOptions{ taskID: "task_id", expansions: exp, addExpansionsToEnv: true, } env := defaultAndApplyExpansionsToEnv(map[string]string{}, opts) for k, v := range exp.Map() { if _, ok := agentEnvVars[k]; ok { continue } assert.Equal(t, v, env[k]) } assert.Equal(t, opts.taskID, env[agentutil.MarkerTaskID]) assert.Equal(t, strconv.Itoa(os.Getpid()), env[agentutil.MarkerAgentPID]) }, "IncludeExpansionsToEnvSelectivelyIncludesExpansions": func(t *testing.T, exp util.Expansions) { var include []string for k := range exp.Map() { include = append(include, k) break } opts := modifyEnvOptions{ taskID: "task_id", expansions: exp, includeExpansionsInEnv: include, } env := defaultAndApplyExpansionsToEnv(map[string]string{}, opts) for k, v := range exp.Map() { if utility.StringSliceContains(include, k) { assert.Equal(t, v, env[k]) } else { _, ok := env[k] assert.False(t, ok) } } }, "IncludeExpansionsInEnvOverridesDefaultEnvVars": func(t *testing.T, exp util.Expansions) { exp.Put("CI", "Travis") exp.Put("GOCACHE", "/path/to/gocache") include := []string{"GOCACHE", "CI"} opts := modifyEnvOptions{ expansions: exp, includeExpansionsInEnv: include, } env := defaultAndApplyExpansionsToEnv(map[string]string{}, opts) for k, v := range exp.Map() { if utility.StringSliceContains(include, k) { assert.Equal(t, v, env[k]) } else { _, ok := env[k] assert.False(t, ok) } } }, "AgentEnvVarsOverrideExpansionsIncludedInEnv": func(t *testing.T, exp util.Expansions) { agentEnvVars := map[string]string{ agentutil.MarkerAgentPID: "12345", agentutil.MarkerTaskID: "fake_task_id", } exp.Update(agentEnvVars) opts := modifyEnvOptions{ taskID: "task_id", expansions: exp, includeExpansionsInEnv: []string{agentutil.MarkerAgentPID, agentutil.MarkerTaskID}, } env := defaultAndApplyExpansionsToEnv(map[string]string{}, opts) assert.Equal(t, opts.taskID, env[agentutil.MarkerTaskID]) assert.Equal(t, strconv.Itoa(os.Getpid()), env[agentutil.MarkerAgentPID]) }, "IncludeExpansionsToEnvIgnoresNonexistentExpansions": func(t *testing.T, exp util.Expansions) { include := []string{"nonexistent1", "nonexistent2"} opts := modifyEnvOptions{ expansions: exp, includeExpansionsInEnv: include, } env := defaultAndApplyExpansionsToEnv(map[string]string{}, opts) for _, expName := range include { assert.NotContains(t, env, expName) } }, } { t.Run(testName, func(t *testing.T) { exp := util.NewExpansions(map[string]string{ "expansion1": "foo", "expansion2": "bar", }) testCase(t, *exp) }) } }
explode_data.jsonl/26276
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 2926 }
[ 2830, 3393, 3675, 3036, 28497, 8033, 596, 908, 1249, 14359, 1155, 353, 8840, 836, 8, 341, 2023, 94396, 11, 54452, 1669, 2088, 2415, 14032, 60, 2830, 1155, 353, 8840, 836, 11, 1343, 4094, 49844, 596, 908, 1264, 197, 197, 1, 30175, 3675...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestAdd(t *testing.T) { tests := []struct { name string catalog instanceMap expected instanceMap }{ {name: "map contains a nil pointer", catalog: instanceMap{ "inst1": {Instance: &ec2.Instance{InstanceId: aws.String("1")}}, "inst2": nil, }, expected: instanceMap{ "1": {Instance: &ec2.Instance{InstanceId: aws.String("1")}}, }, }, {name: "map has 1 instance", catalog: instanceMap{ "inst1": {Instance: &ec2.Instance{InstanceId: aws.String("1")}}, }, expected: instanceMap{ "1": {Instance: &ec2.Instance{InstanceId: aws.String("1")}}, }, }, {name: "map has several instances", catalog: instanceMap{ "inst1": {Instance: &ec2.Instance{InstanceId: aws.String("1")}}, "inst2": {Instance: &ec2.Instance{InstanceId: aws.String("2")}}, "inst3": {Instance: &ec2.Instance{InstanceId: aws.String("3")}}, }, expected: instanceMap{ "1": {Instance: &ec2.Instance{InstanceId: aws.String("1")}}, "2": {Instance: &ec2.Instance{InstanceId: aws.String("2")}}, "3": {Instance: &ec2.Instance{InstanceId: aws.String("3")}}, }, }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { is := &instanceManager{} is.make() for _, c := range tt.catalog { is.add(c) } if !reflect.DeepEqual(tt.expected, is.catalog) { t.Errorf("Value received: %v expected %v", is.catalog, tt.expected) } }) } }
explode_data.jsonl/55190
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 636 }
[ 2830, 3393, 2212, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 3056, 1235, 341, 197, 11609, 257, 914, 198, 197, 1444, 7750, 220, 2867, 2227, 198, 197, 42400, 2867, 2227, 198, 197, 59403, 197, 197, 47006, 25, 330, 2186, 5610, 264, 2092, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestEnsureLoggedInAuthenticated(t *testing.T) { r := getRouter(false) r.GET("/", setLoggedIn(true), EnsureLoggedIn(), func(c *gin.Context) { // Use the setLoggedIn middleware to set the is_logged_in flag to true // Since we are logged in, this handler should be executed. c.Status(http.StatusOK) }) // Use the helper method to execute process the request and test // the HTTP status code testMiddlewareRequest(t, r, http.StatusOK) }
explode_data.jsonl/57772
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 150 }
[ 2830, 3393, 64439, 28559, 26712, 1155, 353, 8840, 836, 8, 341, 7000, 1669, 633, 9523, 3576, 340, 7000, 17410, 35460, 738, 28559, 3715, 701, 29279, 28559, 1507, 2915, 1337, 353, 8163, 9328, 8, 341, 197, 197, 322, 5443, 279, 738, 28559, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestValidateWithHttpsPdAddressWithoutCertificate(t *testing.T) { cmd := new(cobra.Command) o := newOptions() o.addFlags(cmd) require.Nil(t, cmd.ParseFlags([]string{"--pd=https://aa"})) err := o.complete(cmd) require.Nil(t, err) err = o.validate() require.Regexp(t, ".*PD endpoint scheme is https, please provide certificate.*", err.Error()) }
explode_data.jsonl/41630
{ "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, 17926, 2354, 92869, 47, 67, 4286, 26040, 33202, 1155, 353, 8840, 836, 8, 341, 25920, 1669, 501, 1337, 28856, 12714, 340, 22229, 1669, 501, 3798, 741, 22229, 1364, 9195, 14160, 692, 17957, 59678, 1155, 11, 5439, 8937, 9195, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_AnyParamsInSetter(t *testing.T) { c1 := NewLidi(Settings{}) if err := c1.Provide(15); err != nil { t.Fatal(err) } if err := c1.Provide("awesome"); err != nil { t.Fatal(err) } if err := c1.Provide(&OneInjector{}); err != nil { if err.Error() != "lidi: setter method 'Injecter' cannot take more than one param" { t.Fatal("Not Equal") } } else { t.Fatal(err) } }
explode_data.jsonl/40209
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 176 }
[ 2830, 3393, 1566, 3834, 4870, 641, 44294, 1155, 353, 8840, 836, 8, 341, 1444, 16, 1669, 1532, 43, 12278, 57395, 6257, 692, 743, 1848, 1669, 272, 16, 7763, 19448, 7, 16, 20, 1215, 1848, 961, 2092, 341, 197, 3244, 26133, 3964, 340, 19...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
5
func TestDriver(t *testing.T) { Convey("createDriver", t, func() { Convey("Error when master URL can't be found", func() { scheduler := Scheduler{} driver, err := createDriver(&scheduler, &Settings{}) So(err.Error(), ShouldEqual, "Missing master location URL.") So(driver, ShouldBeNil) }) }) Convey("getFrameworkID", t, func() { Convey("Empty ID", func() { fid := getFrameworkID(&Scheduler{}) So(fid, ShouldBeNil) }) Convey("Some random string", func() { fid := getFrameworkID(&Scheduler{ frameworkID: "zoidberg", }) So(*fid.Value, ShouldEqual, "zoidberg") }) }) }
explode_data.jsonl/52924
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 251 }
[ 2830, 3393, 11349, 1155, 353, 8840, 836, 8, 341, 93070, 5617, 445, 3182, 11349, 497, 259, 11, 2915, 368, 341, 197, 93070, 5617, 445, 1454, 979, 7341, 5548, 646, 944, 387, 1730, 497, 2915, 368, 341, 298, 1903, 15222, 1669, 44759, 31483...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_reflect(t *testing.T) { metrics := []TestMetric{ {Value: 1}, {Value: 2, Time: time.Now()}, } printMetrics(metrics) }
explode_data.jsonl/28852
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 59 }
[ 2830, 3393, 7793, 767, 1155, 353, 8840, 836, 8, 341, 2109, 13468, 1669, 3056, 2271, 54310, 515, 197, 197, 90, 1130, 25, 220, 16, 1583, 197, 197, 90, 1130, 25, 220, 17, 11, 4120, 25, 882, 13244, 78108, 197, 532, 6900, 27328, 89788, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestDBReadOnlyClosing(t *testing.T) { dbDir, err := ioutil.TempDir("", "test") testutil.Ok(t, err) defer func() { testutil.Ok(t, os.RemoveAll(dbDir)) }() db, err := OpenDBReadOnly(dbDir, log.NewLogfmtLogger(log.NewSyncWriter(os.Stderr))) testutil.Ok(t, err) testutil.Ok(t, db.Close()) testutil.Equals(t, db.Close(), ErrClosed) _, err = db.Blocks() testutil.Equals(t, err, ErrClosed) _, err = db.Querier(0, 1) testutil.Equals(t, err, ErrClosed) }
explode_data.jsonl/64391
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 210 }
[ 2830, 3393, 3506, 20914, 36294, 1155, 353, 8840, 836, 8, 341, 20939, 6184, 11, 1848, 1669, 43144, 65009, 6184, 19814, 330, 1944, 1138, 18185, 1314, 54282, 1155, 11, 1848, 692, 16867, 2915, 368, 341, 197, 18185, 1314, 54282, 1155, 11, 26...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestAddHostNetworkPod(t *testing.T) { labels := map[string]string{ "app": "test-pod", } podObj := createPod("test-pod", "test-namespace", "0", "1.2.3.4", labels, HostNetwork, corev1.PodRunning) podKey := getKey(podObj, t) calls := []testutils.TestCmd{} fexec := testutils.GetFakeExecWithScripts(calls) defer testutils.VerifyCalls(t, fexec, calls) f := newFixture(t, fexec) f.podLister = append(f.podLister, podObj) f.kubeobjects = append(f.kubeobjects, podObj) stopCh := make(chan struct{}) defer close(stopCh) f.newPodController(stopCh) addPod(t, f, podObj) testCases := []expectedValues{ {0, 0, 0}, } checkPodTestResult("TestAddHostNetworkPod", f, testCases) if _, exists := f.podController.podMap[podKey]; exists { t.Error("TestAddHostNetworkPod failed @ cached pod obj exists check") } }
explode_data.jsonl/35406
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 327 }
[ 2830, 3393, 2212, 9296, 12320, 23527, 1155, 353, 8840, 836, 8, 341, 95143, 1669, 2415, 14032, 30953, 515, 197, 197, 1, 676, 788, 330, 1944, 2268, 347, 756, 197, 532, 3223, 347, 5261, 1669, 1855, 23527, 445, 1944, 2268, 347, 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...
2
func TestThingRemove(t *testing.T) { thingCache := redis.NewThingCache(redisClient) key, err := uuid.New().ID() require.Nil(t, err, fmt.Sprintf("got unexpected error: %s", err)) id := "123" id2 := "321" thingCache.Save(context.Background(), key, id) cases := []struct { desc string ID string err error }{ { desc: "Remove existing thing from cache", ID: id, err: nil, }, { desc: "Remove non-existing thing from cache", ID: id2, err: r.Nil, }, } for _, tc := range cases { err := thingCache.Remove(context.Background(), tc.ID) assert.True(t, errors.Contains(err, tc.err), fmt.Sprintf("%s: expected %s got %s\n", tc.desc, tc.err, err)) } }
explode_data.jsonl/44674
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 296 }
[ 2830, 3393, 52940, 13021, 1155, 353, 8840, 836, 8, 341, 197, 1596, 8233, 1669, 20870, 7121, 52940, 8233, 97676, 2959, 692, 23634, 11, 1848, 1669, 16040, 7121, 1005, 915, 741, 17957, 59678, 1155, 11, 1848, 11, 8879, 17305, 445, 22390, 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 TestFilterOrgs(t *testing.T) { type testcase struct { scopes []string orgs []string expected []string } testcases := []testcase{ {orgs: []string{}, scopes: []string{}, expected: []string{}}, {orgs: []string{"parentorg", "parentorg.suborg1", "parentorg.suborg2"}, scopes: []string{"user:organizations:parentorg"}, expected: []string{"parentorg", "parentorg.suborg1", "parentorg.suborg2"}}, {orgs: []string{"parentorg", "parentorg.suborg1", "parentorg.suborg2"}, scopes: []string{"user:organizations:parent"}, expected: []string{}}, {orgs: []string{"parentorg.suborg1", "parentorg.suborg2"}, scopes: []string{"user:organizations:parentorg"}, expected: []string{"parentorg.suborg1", "parentorg.suborg2"}}, {orgs: []string{"parentorg.suborg1.child", "parentorg.suborg2.child"}, scopes: []string{"user:organizations:parentorg.suborg1", "user:organizations:parentorg.suborg2"}, expected: []string{"parentorg.suborg1.child", "parentorg.suborg2.child"}}, } for _, test := range testcases { assert.Equal(t, test.expected, filterOrgs(test.orgs, test.scopes), "Failed") } }
explode_data.jsonl/6560
{ "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, 5632, 42437, 82, 1155, 353, 8840, 836, 8, 341, 13158, 70080, 2036, 341, 197, 29928, 18523, 256, 3056, 917, 198, 197, 87625, 82, 257, 3056, 917, 198, 197, 42400, 3056, 917, 198, 197, 532, 18185, 23910, 1669, 3056, 1944, 563...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestNew(t *testing.T) { // Generate 10 ids ids := make([]ID, 10) for i := 0; i < 10; i++ { ids[i] = New() } for i := 1; i < 10; i++ { prevID := ids[i-1] id := ids[i] // Test for uniqueness among all other 9 generated ids for j, tid := range ids { if j != i { assert.NotEqual(t, id, tid, "Generated ID is not unique") } } // Check that timestamp was incremented and is within 30 seconds of the previous one secs := id.Time().Sub(prevID.Time()).Seconds() assert.Equal(t, (secs >= 0 && secs <= 30), true, "Wrong timestamp in generated ID") // Check that machine ids are the same assert.Equal(t, id.Machine(), prevID.Machine()) // Check that pids are the same assert.Equal(t, id.Pid(), prevID.Pid()) // Test for proper increment delta := int(id.Counter() - prevID.Counter()) assert.Equal(t, delta, 1, "Wrong increment in generated ID") } }
explode_data.jsonl/58919
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 350 }
[ 2830, 3393, 3564, 1155, 353, 8840, 836, 8, 341, 197, 322, 19813, 220, 16, 15, 14151, 198, 197, 3365, 1669, 1281, 10556, 915, 11, 220, 16, 15, 340, 2023, 600, 1669, 220, 15, 26, 600, 366, 220, 16, 15, 26, 600, 1027, 341, 197, 197...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
6
func TestInboxBasic(t *testing.T) { _, inbox, _ := setupInboxTest(t, "basic") // Create an inbox with a bunch of convos, merge it and read it back out numConvs := 10 var convs []types.RemoteConversation for i := numConvs - 1; i >= 0; i-- { convs = append(convs, makeConvo(gregor1.Time(i), 1, 1)) } // Fetch with no query parameter require.NoError(t, inbox.Merge(context.TODO(), 1, utils.PluckConvs(convs), nil, nil)) vers, res, _, err := inbox.Read(context.TODO(), nil, nil) require.NoError(t, err) require.Equal(t, chat1.InboxVers(1), vers, "version mismatch") convListCompare(t, convs, res, "basic") require.Equal(t, gregor1.Time(numConvs-1), res[0].GetMtime(), "order wrong") // Fetch half of the messages (expect miss on first try) vers, res, _, err = inbox.Read(context.TODO(), nil, &chat1.Pagination{ Num: numConvs / 2, }) require.IsType(t, MissError{}, err, "expected miss error") require.NoError(t, inbox.Merge(context.TODO(), 2, utils.PluckConvs(convs), nil, &chat1.Pagination{ Num: numConvs / 2, })) vers, res, _, err = inbox.Read(context.TODO(), nil, &chat1.Pagination{ Num: numConvs / 2, }) require.NoError(t, err) require.Equal(t, chat1.InboxVers(2), vers, "version mismatch") convListCompare(t, convs[:numConvs/2], res, "half") }
explode_data.jsonl/16798
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 515 }
[ 2830, 3393, 641, 2011, 15944, 1155, 353, 8840, 836, 8, 1476, 197, 6878, 22883, 11, 716, 1669, 6505, 641, 2011, 2271, 1155, 11, 330, 22342, 5130, 197, 322, 4230, 458, 22883, 448, 264, 15493, 315, 5686, 436, 11, 10880, 432, 323, 1349, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestAccessor(t *testing.T) { t.Skip("FIXME") node := newMutableNode(testutils.RandomRef(), insolar.StaticRoleVirtual, nil, insolar.NodeReady, "127.0.0.1:0", "") node2 := newMutableNode(testutils.RandomRef(), insolar.StaticRoleVirtual, nil, insolar.NodePending, "127.0.0.1:0", "") node2.SetShortID(11) node3 := newMutableNode(testutils.RandomRef(), insolar.StaticRoleVirtual, nil, insolar.NodeLeaving, "127.0.0.1:0", "") node3.SetShortID(10) node4 := newMutableNode(testutils.RandomRef(), insolar.StaticRoleVirtual, nil, insolar.NodeUndefined, "127.0.0.1:0", "") snapshot := NewSnapshot(insolar.FirstPulseNumber, []insolar.NetworkNode{node, node2, node3, node4}) accessor := NewAccessor(snapshot) assert.Equal(t, 4, len(accessor.GetActiveNodes())) assert.Equal(t, 1, len(accessor.GetWorkingNodes())) assert.NotNil(t, accessor.GetWorkingNode(node.ID())) assert.Nil(t, accessor.GetWorkingNode(node2.ID())) assert.NotNil(t, accessor.GetActiveNode(node2.ID())) assert.NotNil(t, accessor.GetActiveNode(node3.ID())) assert.NotNil(t, accessor.GetActiveNode(node4.ID())) assert.NotNil(t, accessor.GetActiveNodeByShortID(10)) assert.NotNil(t, accessor.GetActiveNodeByShortID(11)) assert.Nil(t, accessor.GetActiveNodeByShortID(12)) }
explode_data.jsonl/66196
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 492 }
[ 2830, 3393, 29889, 1155, 353, 8840, 836, 8, 341, 3244, 57776, 445, 81019, 5130, 20831, 1669, 501, 11217, 1955, 8623, 6031, 26709, 3945, 1507, 1640, 7417, 58826, 9030, 33026, 11, 2092, 11, 1640, 7417, 21714, 19202, 11, 330, 16, 17, 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 TestParseConfigDefaultServiceWithConsole(t *testing.T) { services := []string{ "s0", "s1", "s3", } loggerConfig := []byte(fmt.Sprintf(`{ "console": true }`)) config, err := ParseConfig([]byte(loggerConfig), services, nil) if err != nil { t.Errorf("Unexpected error: %s", err) } if config.Service != "" { t.Errorf("Expected no service in config, actual = '%s'", config.Service) } }
explode_data.jsonl/27531
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 165 }
[ 2830, 3393, 14463, 2648, 3675, 1860, 2354, 12372, 1155, 353, 8840, 836, 8, 341, 1903, 2161, 1669, 3056, 917, 515, 197, 197, 40787, 15, 756, 197, 197, 40787, 16, 756, 197, 197, 40787, 18, 756, 197, 630, 17060, 2648, 1669, 3056, 3782, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestCensorHttpsPasswordKeepsSSHURLs(t *testing.T) { rawURL := "ssh://git@github.com/foo/bar.git" censoredURL := CensorHttpsPassword(rawURL) expectedCensoredURL := "ssh://git@github.com/foo/bar.git" if censoredURL != expectedCensoredURL { t.Error("incorrectly censored URL", "expected", expectedCensoredURL, "actual", censoredURL) } }
explode_data.jsonl/68336
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 126 }
[ 2830, 3393, 34, 3805, 92869, 4876, 6608, 7124, 62419, 3144, 82, 1155, 353, 8840, 836, 8, 341, 76559, 3144, 1669, 330, 25537, 1110, 12882, 31, 5204, 905, 60555, 49513, 32799, 698, 1444, 55778, 3144, 1669, 356, 3805, 92869, 4876, 22460, 3...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestAggregateMetadata(t *testing.T) { session := createSession(t) defer session.Close() createAggregate(t, session) aggregates, err := getAggregatesMetadata(session, "gocql_test") if err != nil { t.Fatalf("failed to query aggregate metadata with err: %v", err) } if aggregates == nil { t.Fatal("failed to query aggregate metadata, nil returned") } if len(aggregates) != 1 { t.Fatal("expected only a single aggregate") } aggregate := aggregates[0] expectedAggregrate := AggregateMetadata{ Keyspace: "gocql_test", Name: "average", ArgumentTypes: []TypeInfo{NativeType{typ: TypeInt}}, InitCond: "(0, 0)", ReturnType: NativeType{typ: TypeDouble}, StateType: TupleTypeInfo{ NativeType: NativeType{typ: TypeTuple}, Elems: []TypeInfo{ NativeType{typ: TypeInt}, NativeType{typ: TypeBigInt}, }, }, stateFunc: "avgstate", finalFunc: "avgfinal", } // In this case cassandra is returning a blob if flagCassVersion.Before(3, 0, 0) { expectedAggregrate.InitCond = string([]byte{0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 0}) } if !reflect.DeepEqual(aggregate, expectedAggregrate) { t.Fatalf("aggregate is %+v, but expected %+v", aggregate, expectedAggregrate) } }
explode_data.jsonl/11177
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 507 }
[ 2830, 3393, 64580, 14610, 1155, 353, 8840, 836, 8, 341, 25054, 1669, 1855, 5283, 1155, 340, 16867, 3797, 10421, 741, 39263, 64580, 1155, 11, 3797, 692, 197, 351, 7998, 973, 11, 1848, 1669, 633, 9042, 7998, 973, 14610, 16264, 11, 330, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
6
func TestResourceSpansSlice_RemoveIf(t *testing.T) { // Test RemoveIf on empty slice emptySlice := NewResourceSpansSlice() emptySlice.RemoveIf(func(el ResourceSpans) bool { t.Fail() return false }) // Test RemoveIf filtered := generateTestResourceSpansSlice() pos := 0 filtered.RemoveIf(func(el ResourceSpans) bool { pos++ return pos%3 == 0 }) assert.Equal(t, 5, filtered.Len()) }
explode_data.jsonl/63240
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 148 }
[ 2830, 3393, 4783, 6406, 596, 33236, 66843, 2679, 1155, 353, 8840, 836, 8, 341, 197, 322, 3393, 10783, 2679, 389, 4287, 15983, 198, 197, 3194, 33236, 1669, 1532, 4783, 6406, 596, 33236, 741, 197, 3194, 33236, 13270, 2679, 18552, 18584, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestIssue1137(t *testing.T) { withTestProcess("dotpackagesiface", t, func(p *proc.Target, fixture protest.Fixture) { assertNoError(p.Continue(), t, "Continue()") v := evalVariable(p, t, "iface") assertNoError(v.Unreadable, t, "iface unreadable") v2 := evalVariable(p, t, "iface2") assertNoError(v2.Unreadable, t, "iface2 unreadable") }) }
explode_data.jsonl/56302
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 139 }
[ 2830, 3393, 42006, 16, 16, 18, 22, 1155, 353, 8840, 836, 8, 341, 46948, 2271, 7423, 445, 16119, 43141, 52674, 497, 259, 11, 2915, 1295, 353, 15782, 35016, 11, 12507, 8665, 991, 12735, 8, 341, 197, 6948, 2753, 1454, 1295, 2451, 6232, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestUnauthorizedRequestOnExistingResource(t *testing.T) { authorizerMock := authorize_mock.Create() authorizerMock.On("IsAuthorizedWithReasonWithContext", mock.Anything, userID, policy.Action, resource).Return(false, authorize.ReasonAccessDenied, nil) middleware := New(WithAuthorizerClient(authorizerMock)) response := setupAndDoRequest(userID, policy, middleware) defer response.Body.Close() require.Equal(t, http.StatusForbidden, response.StatusCode) var problem problems.BasicProblem err := json.NewDecoder(response.Body).Decode(&problem) require.NoError(t, err) require.Equal(t, "application/problem+json", response.Header.Get("Content-Type")) require.Equal(t, "/problems/unauthorized-resource", problem.ProblemType()) }
explode_data.jsonl/52685
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 230 }
[ 2830, 3393, 51181, 1900, 1925, 53067, 4783, 1155, 353, 8840, 836, 8, 341, 197, 3094, 3135, 11571, 1669, 36826, 34134, 7251, 741, 197, 3094, 3135, 11571, 8071, 445, 3872, 60454, 2354, 25139, 91101, 497, 7860, 13311, 1596, 11, 35204, 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 TestActivityService_MarkRepositoryNotificationsRead(t *testing.T) { setup() defer teardown() mux.HandleFunc("/repos/o/r/notifications", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "PUT") testFormValues(t, r, values{ "last_read_at": "2006-01-02T15:04:05Z", }) w.WriteHeader(http.StatusResetContent) }) _, err := client.Activity.MarkRepositoryNotificationsRead("o", "r", time.Date(2006, 01, 02, 15, 04, 05, 0, time.UTC)) if err != nil { t.Errorf("Activity.MarkRepositoryNotificationsRead returned error: %v", err) } }
explode_data.jsonl/6718
{ "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, 4052, 1860, 1245, 838, 4624, 34736, 4418, 1155, 353, 8840, 836, 8, 341, 84571, 741, 16867, 49304, 2822, 2109, 2200, 63623, 4283, 68354, 20271, 7382, 14, 38188, 497, 2915, 3622, 1758, 37508, 11, 435, 353, 1254, 9659, 8, 341, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestRunAlreadyRunningServer(t *testing.T) { Convey("Run server on unavailable port", t, func() { port := test.GetFreePort() baseURL := test.GetBaseURL(port) conf := config.New() conf.HTTP.Port = port ctlr := api.NewController(conf) globalDir := t.TempDir() ctlr.Config.Storage.RootDirectory = globalDir go func() { if err := ctlr.Run(context.Background()); err != nil { return } }() // wait till ready for { _, err := resty.R().Get(baseURL) if err == nil { break } time.Sleep(100 * time.Millisecond) } defer func() { ctx := context.Background() _ = ctlr.Server.Shutdown(ctx) }() err := ctlr.Run(context.Background()) So(err, ShouldNotBeNil) }) }
explode_data.jsonl/77677
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 300 }
[ 2830, 3393, 6727, 38370, 18990, 5475, 1155, 353, 8840, 836, 8, 341, 93070, 5617, 445, 6727, 3538, 389, 34987, 2635, 497, 259, 11, 2915, 368, 341, 197, 52257, 1669, 1273, 2234, 10940, 7084, 741, 197, 24195, 3144, 1669, 1273, 2234, 3978, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestLocalUntrackedStatus(t *testing.T) { output := `On branch develop Your branch is up-to-date with 'origin/develop'. Untracked files: (use "git add <file>..." to include in what will be committed) untracked-file nothing added to commit but untracked files present (use "git add" to track)` mockRunner := NewMockRunner(output) git := NewCustomGit(mockRunner) repo := &Repo{Path: "/test/"} status := git.Status(repo) if !strings.HasSuffix(status, UNTRACKED) { t.Errorf("Should be untracked status") } }
explode_data.jsonl/14068
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 183 }
[ 2830, 3393, 7319, 1806, 58381, 2522, 1155, 353, 8840, 836, 8, 341, 21170, 1669, 1565, 1925, 8870, 2225, 198, 7771, 8870, 374, 705, 4686, 18413, 448, 364, 8611, 14, 15840, 23569, 1806, 58381, 3542, 510, 220, 320, 810, 330, 12882, 912, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestStart(t *testing.T) { expectedProbeList := make([]*controller.Probe, 0) fakeController := &controller.Controller{ Probes: make([]*controller.Probe, 0), Mutex: &sync.Mutex{}, } go func() { controller.ControllerBroadcastChannel <- fakeController }() var fakeProbeRegister = func() { ctrl := <-controller.ControllerBroadcastChannel if ctrl == nil { t.Fatal("controller struct should not be nil") } var pi controller.ProbeInterface = &fakeProbe{ctrl: ctrl} newRegisterProbe := &registerProbe{ name: "fake-probe", state: defaultEnabled, pi: pi, controller: ctrl, } newRegisterProbe.register() } var registeredProbes = []func(){fakeProbeRegister} Start(registeredProbes) var fi controller.ProbeInterface = &fakeProbe{ctrl: fakeController} probe := &controller.Probe{ Name: "fake-probe", State: defaultEnabled, Interface: fi, } expectedProbeList = append(expectedProbeList, probe) tests := map[string]struct { actualProbeList []*controller.Probe expectedProbeList []*controller.Probe }{ "register one probe and check if it is present or not": {actualProbeList: fakeController.Probes, expectedProbeList: expectedProbeList}, } for name, test := range tests { t.Run(name, func(t *testing.T) { assert.Equal(t, test.expectedProbeList, test.actualProbeList) }) } }
explode_data.jsonl/13151
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 507 }
[ 2830, 3393, 3479, 1155, 353, 8840, 836, 8, 341, 42400, 81426, 852, 1669, 1281, 85288, 7152, 7763, 1371, 11, 220, 15, 340, 1166, 726, 2051, 1669, 609, 7152, 29112, 515, 197, 197, 1336, 9433, 25, 1281, 85288, 7152, 7763, 1371, 11, 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 TestService_GetStatus(t *testing.T) { type args struct { ctx context.Context req *request.Status } tests := []struct { name string args args want *response.Status wantErr bool }{ { "get callback", args{nil, &request.Status{}}, &response.Status{}, false, }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { s := &Service{} got, err := s.GetStatus(tt.args.ctx, tt.args.req) if (err != nil) != tt.wantErr { t.Errorf("Service.GetStatus() error = %v, wantErr %v", err, tt.wantErr) return } if !reflect.DeepEqual(got, tt.want) { t.Errorf("Service.GetStatus() = %v, want %v", got, tt.want) } }) } }
explode_data.jsonl/22351
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 327 }
[ 2830, 3393, 1860, 13614, 2522, 1155, 353, 8840, 836, 8, 341, 13158, 2827, 2036, 341, 197, 20985, 2266, 9328, 198, 197, 24395, 353, 2035, 10538, 198, 197, 532, 78216, 1669, 3056, 1235, 341, 197, 11609, 262, 914, 198, 197, 31215, 262, 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 TestCreateSimpleChannel(t *testing.T) { channel := &Channel{} channel.ID = "C024BE91L" channel.Name = "fun" channel.IsChannel = true channel.Created = JSONTime(1360782804) channel.Creator = "U024BE7LH" channel.IsArchived = false channel.IsGeneral = false channel.IsMember = true channel.LastRead = "1401383885.000061" channel.UnreadCount = 0 channel.UnreadCountDisplay = 0 assertSimpleChannel(t, channel) }
explode_data.jsonl/78533
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 154 }
[ 2830, 3393, 4021, 16374, 9629, 1155, 353, 8840, 836, 8, 341, 71550, 1669, 609, 9629, 16094, 71550, 9910, 284, 330, 34, 15, 17, 19, 11594, 24, 16, 43, 698, 71550, 2967, 284, 330, 11894, 698, 71550, 4506, 9629, 284, 830, 198, 71550, 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 TestCheckExpire3(t *testing.T) { q, mem := initEnv(0) defer q.Close() defer mem.Close() // add tx err := add4Tx(mem.client) if err != nil { t.Error("add tx error", err.Error()) return } mem.setHeader(&types.Header{Height: 50, BlockTime: 1e9 + 1}) require.Equal(t, mem.Size(), 4) mem.removeExpired() require.Equal(t, mem.Size(), 3) }
explode_data.jsonl/16832
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 152 }
[ 2830, 3393, 3973, 8033, 554, 18, 1155, 353, 8840, 836, 8, 341, 18534, 11, 1833, 1669, 2930, 14359, 7, 15, 340, 16867, 2804, 10421, 741, 16867, 1833, 10421, 2822, 197, 322, 912, 9854, 198, 9859, 1669, 912, 19, 31584, 39908, 6581, 340, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestMultipleAddrsPerPeer(t *testing.T) { var bsps []config.BootstrapPeer for i := 0; i < 10; i++ { pid, err := testutil.RandPeerID() if err != nil { t.Fatal(err) } addr := fmt.Sprintf("/ip4/127.0.0.1/tcp/5001/ipfs/%s", pid.Pretty()) bsp1, err := config.ParseBootstrapPeer(addr) if err != nil { t.Fatal(err) } addr = fmt.Sprintf("/ip4/127.0.0.1/udp/5002/utp/ipfs/%s", pid.Pretty()) bsp2, err := config.ParseBootstrapPeer(addr) if err != nil { t.Fatal(err) } bsps = append(bsps, bsp1, bsp2) } pinfos := Peers.ToPeerInfos(bsps) if len(pinfos) != len(bsps)/2 { t.Fatal("expected fewer peers") } }
explode_data.jsonl/32033
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 318 }
[ 2830, 3393, 32089, 2212, 5428, 3889, 30888, 1155, 353, 8840, 836, 8, 341, 2405, 17065, 1690, 3056, 1676, 13, 45511, 30888, 198, 2023, 600, 1669, 220, 15, 26, 600, 366, 220, 16, 15, 26, 600, 1027, 341, 197, 78799, 11, 1848, 1669, 127...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestGocloak_RetrospectToken_InactiveToken(t *testing.T) { t.Parallel() cfg := GetConfig(t) client := NewClientWithDebug(t) rptResult, err := client.RetrospectToken( "foobar", cfg.GoCloak.ClientID, cfg.GoCloak.ClientSecret, cfg.GoCloak.Realm) t.Log(rptResult) FailIfErr(t, err, "inspection failed") FailIf(t, rptResult.Active, "That should never happen. Token is active") }
explode_data.jsonl/79510
{ "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, 38, 509, 385, 585, 2568, 34466, 987, 3323, 25972, 3028, 3323, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 741, 50286, 1669, 2126, 2648, 1155, 340, 25291, 1669, 1532, 2959, 2354, 7939, 1155, 692, 7000, 417, 2077, 11, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestForwardedMetricWithMetadataToProto(t *testing.T) { inputs := []struct { metric ForwardedMetric metadata metadata.ForwardMetadata expected metricpb.ForwardedMetricWithMetadata }{ { metric: testForwardedMetric1, metadata: testForwardMetadata1, expected: metricpb.ForwardedMetricWithMetadata{ Metric: testForwardedMetric1Proto, Metadata: testForwardMetadata1Proto, }, }, { metric: testForwardedMetric1, metadata: testForwardMetadata2, expected: metricpb.ForwardedMetricWithMetadata{ Metric: testForwardedMetric1Proto, Metadata: testForwardMetadata2Proto, }, }, { metric: testForwardedMetric2, metadata: testForwardMetadata1, expected: metricpb.ForwardedMetricWithMetadata{ Metric: testForwardedMetric2Proto, Metadata: testForwardMetadata1Proto, }, }, { metric: testForwardedMetric2, metadata: testForwardMetadata2, expected: metricpb.ForwardedMetricWithMetadata{ Metric: testForwardedMetric2Proto, Metadata: testForwardMetadata2Proto, }, }, } var pb metricpb.ForwardedMetricWithMetadata for _, input := range inputs { tm := ForwardedMetricWithMetadata{ ForwardedMetric: input.metric, ForwardMetadata: input.metadata, } require.NoError(t, tm.ToProto(&pb)) } }
explode_data.jsonl/75079
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 532 }
[ 2830, 3393, 25925, 291, 54310, 2354, 14610, 1249, 31549, 1155, 353, 8840, 836, 8, 341, 22427, 82, 1669, 3056, 1235, 341, 197, 2109, 16340, 256, 22164, 291, 54310, 198, 197, 2109, 7603, 11160, 26676, 1606, 14610, 198, 197, 42400, 18266, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestPathMatcher(t *testing.T) { for i, currCase := range []struct { matcherArgs []string path string want bool }{ {[]string{"foo"}, "foo/bar/regular", true}, {[]string{"foo"}, "bar/foo/inner", false}, // full match required {[]string{"foo"}, "fooLongerName/inner", false}, // glob matching {[]string{"foo*"}, "fooName", true}, // glob matching matches subdirectories {[]string{"foo*"}, "fooLongerName/inner", true}, // glob matching matches subdirectories {[]string{"foo/*/baz"}, "foo/bar/baz/inner", true}, // globs do not match through separators {[]string{"foo*/bar"}, "fooz/baz/bar", false}, {[]string{"foo/bar"}, "foo/bar", true}, {[]string{"foo/bar"}, "/foo/bar", false}, } { m := matcher.Path(currCase.matcherArgs...) got := m.Match(currCase.path) assert.Equal(t, currCase.want, got, "Case %d", i) } }
explode_data.jsonl/81367
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 347 }
[ 2830, 3393, 1820, 37554, 1155, 353, 8840, 836, 8, 341, 2023, 600, 11, 9804, 4207, 1669, 2088, 3056, 1235, 341, 197, 2109, 28058, 4117, 3056, 917, 198, 197, 26781, 286, 914, 198, 197, 50780, 286, 1807, 198, 197, 59403, 197, 197, 90, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestAttributes_HashValue(t *testing.T) { intVal := int64(24) intBytes := make([]byte, int64ByteSize) binary.LittleEndian.PutUint64(intBytes, uint64(intVal)) doubleVal := 2.4 doubleBytes := make([]byte, float64ByteSize) binary.LittleEndian.PutUint64(doubleBytes, math.Float64bits(doubleVal)) testCases := []testCase{ // Ensure no changes to the span as there is no attributes map. { name: "HashNoAttributes", inputAttributes: map[string]pdata.AttributeValue{}, expectedAttributes: map[string]pdata.AttributeValue{}, }, // Ensure no changes to the span as the key does not exist. { name: "HashKeyNoExist", inputAttributes: map[string]pdata.AttributeValue{ "boo": pdata.NewAttributeValueString("foo"), }, expectedAttributes: map[string]pdata.AttributeValue{ "boo": pdata.NewAttributeValueString("foo"), }, }, // Ensure string data types are hashed correctly { name: "HashString", inputAttributes: map[string]pdata.AttributeValue{ "updateme": pdata.NewAttributeValueString("foo"), }, expectedAttributes: map[string]pdata.AttributeValue{ "updateme": pdata.NewAttributeValueString(sha1Hash([]byte("foo"))), }, }, // Ensure int data types are hashed correctly { name: "HashInt", inputAttributes: map[string]pdata.AttributeValue{ "updateme": pdata.NewAttributeValueInt(intVal), }, expectedAttributes: map[string]pdata.AttributeValue{ "updateme": pdata.NewAttributeValueString(sha1Hash(intBytes)), }, }, // Ensure double data types are hashed correctly { name: "HashDouble", inputAttributes: map[string]pdata.AttributeValue{ "updateme": pdata.NewAttributeValueDouble(doubleVal), }, expectedAttributes: map[string]pdata.AttributeValue{ "updateme": pdata.NewAttributeValueString(sha1Hash(doubleBytes)), }, }, // Ensure bool data types are hashed correctly { name: "HashBoolTrue", inputAttributes: map[string]pdata.AttributeValue{ "updateme": pdata.NewAttributeValueBool(true), }, expectedAttributes: map[string]pdata.AttributeValue{ "updateme": pdata.NewAttributeValueString(sha1Hash([]byte{1})), }, }, // Ensure bool data types are hashed correctly { name: "HashBoolFalse", inputAttributes: map[string]pdata.AttributeValue{ "updateme": pdata.NewAttributeValueBool(false), }, expectedAttributes: map[string]pdata.AttributeValue{ "updateme": pdata.NewAttributeValueString(sha1Hash([]byte{0})), }, }, } cfg := &Settings{ Actions: []ActionKeyValue{ {Key: "updateme", Action: HASH}, }, } ap, err := NewAttrProc(cfg) require.Nil(t, err) require.NotNil(t, ap) for _, tt := range testCases { runIndividualTestCase(t, tt, ap) } }
explode_data.jsonl/11515
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1055 }
[ 2830, 3393, 10516, 2039, 988, 1130, 1155, 353, 8840, 836, 8, 1476, 2084, 2208, 1669, 526, 21, 19, 7, 17, 19, 340, 2084, 7078, 1669, 1281, 10556, 3782, 11, 526, 21, 19, 7153, 1695, 340, 2233, 3287, 1214, 2377, 43231, 39825, 21570, 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 TestDistinct(t *testing.T) { types := []struct { name string generateValue func(i, notUniqueCount int) (unique interface{}, notunique interface{}) }{ {`integer`, func(i, notUniqueCount int) (unique interface{}, notunique interface{}) { return i, i % notUniqueCount }}, {`double`, func(i, notUniqueCount int) (unique interface{}, notunique interface{}) { return float64(i), float64(i % notUniqueCount) }}, {`text`, func(i, notUniqueCount int) (unique interface{}, notunique interface{}) { return strconv.Itoa(i), strconv.Itoa(i % notUniqueCount) }}, {`array`, func(i, notUniqueCount int) (unique interface{}, notunique interface{}) { return []interface{}{i}, []interface{}{i % notUniqueCount} }}, } for _, typ := range types { total := 100 notUnique := total / 10 t.Run(typ.name, func(t *testing.T) { db, err := genji.Open(":memory:") require.NoError(t, err) defer db.Close() tx, err := db.Begin(true) require.NoError(t, err) defer tx.Rollback() err = tx.Exec("CREATE TABLE test(a " + typ.name + " PRIMARY KEY, b " + typ.name + ", doc DOCUMENT, nullable " + typ.name + ");") require.NoError(t, err) err = tx.Exec("CREATE UNIQUE INDEX test_doc_index ON test(doc);") require.NoError(t, err) for i := 0; i < total; i++ { unique, nonunique := typ.generateValue(i, notUnique) err = tx.Exec(`INSERT INTO test VALUES {a: ?, b: ?, doc: {a: ?, b: ?}, nullable: null}`, unique, nonunique, unique, nonunique) require.NoError(t, err) } err = tx.Commit() require.NoError(t, err) tests := []struct { name string query string expectedCount int }{ {`unique`, `SELECT DISTINCT a FROM test`, total}, {`non-unique`, `SELECT DISTINCT b FROM test`, notUnique}, {`documents`, `SELECT DISTINCT doc FROM test`, total}, {`null`, `SELECT DISTINCT nullable FROM test`, 1}, {`wildcard`, `SELECT DISTINCT * FROM test`, total}, {`literal`, `SELECT DISTINCT 'a' FROM test`, 1}, {`pk()`, `SELECT DISTINCT pk() FROM test`, total}, } for _, test := range tests { t.Run(test.name, func(t *testing.T) { q, err := db.Query(test.query) require.NoError(t, err) defer q.Close() var i int err = q.Iterate(func(d document.Document) error { i++ return nil }) require.NoError(t, err) require.Equal(t, test.expectedCount, i) }) } }) } }
explode_data.jsonl/62221
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1040 }
[ 2830, 3393, 72767, 1155, 353, 8840, 836, 8, 341, 98785, 1669, 3056, 1235, 341, 197, 11609, 688, 914, 198, 197, 3174, 13220, 1130, 2915, 1956, 11, 537, 22811, 2507, 526, 8, 320, 9587, 3749, 22655, 537, 9587, 3749, 37790, 197, 59403, 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 TestTranscoder(t *testing.T) { t.Run("#SetWhiteListProtocols", func(t *testing.T) { t.Run("Should not set -protocol_whitelist option if it isn't present", func(t *testing.T) { ts := Transcoder{} ts.SetMediaFile(&models.Mediafile{}) require.NotEqual(t, ts.GetCommand()[0:2], []string{"-protocol_whitelist", "file,http,https,tcp,tls"}) require.NotContains(t, ts.GetCommand(), "protocol_whitelist") }) t.Run("Should set -protocol_whitelist option if it's present", func(t *testing.T) { ts := Transcoder{} ts.SetMediaFile(&models.Mediafile{}) ts.SetWhiteListProtocols([]string{"file", "http", "https", "tcp", "tls"}) require.Equal(t, ts.GetCommand()[0:2], []string{"-protocol_whitelist", "file,http,https,tcp,tls"}) }) }) }
explode_data.jsonl/49536
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 318 }
[ 2830, 3393, 3167, 40170, 1155, 353, 8840, 836, 8, 341, 3244, 16708, 3584, 1649, 14075, 852, 12423, 22018, 497, 2915, 1155, 353, 8840, 836, 8, 341, 197, 3244, 16708, 445, 14996, 537, 738, 481, 17014, 36225, 57645, 2999, 421, 432, 4436, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1