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 TestAPIRequest_TokenTx(t *testing.T) { kp := types.CreateKeyPair() adiUrl := "greentractor" message, err := createTokenTx(adiUrl) if err != nil { t.Fatal(err) } params := createRequest(t, adiUrl, &kp, message) validate, err := protocol.NewValidator() require.NoError(t, err) req := &APIRequestRaw{} // unmarshal req if err = json.Unmarshal(params, &req); err != nil { t.Fatal(err) } // validate request if err = validate.Struct(req); err != nil { t.Fatal(err) } //tx, err := json.MarshalIndent(&req,"", " ") tx, err := json.Marshal(&req) if err != nil { t.Fatal(err) } fmt.Printf("%s", string(tx)) }
explode_data.jsonl/16535
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 268 }
[ 2830, 3393, 7082, 1900, 1139, 1679, 31584, 1155, 353, 8840, 836, 8, 341, 16463, 79, 1669, 4494, 7251, 1592, 12443, 2822, 197, 2767, 2864, 1669, 330, 15525, 23745, 5621, 1837, 24753, 11, 1848, 1669, 1855, 3323, 31584, 7, 2767, 2864, 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...
5
func TestHandshakeServerSNIGetCertificate(t *testing.T) { config := testConfig.Clone() // Replace the NameToCertificate map with a GetCertificate function nameToCert := config.NameToCertificate config.NameToCertificate = nil config.GetCertificate = func(clientHello *ClientHelloInfo) (*Certificate, error) { cert := nameToCert[clientHello.ServerName] return cert, nil } test := &serverTest{ name: "SNI-GetCertificate", command: []string{"openssl", "s_client", "-no_ticket", "-cipher", "AES128-SHA", "-servername", "snitest.com"}, config: config, } runServerTestTLS12(t, test) }
explode_data.jsonl/36341
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 209 }
[ 2830, 3393, 2314, 29661, 5475, 18966, 1914, 295, 33202, 1155, 353, 8840, 836, 8, 341, 25873, 1669, 1273, 2648, 64463, 2822, 197, 322, 29558, 279, 3988, 1249, 33202, 2415, 448, 264, 2126, 33202, 729, 198, 11609, 1249, 36934, 1669, 2193, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestUnmarshalMap(t *testing.T) { input := []byte(` { "M": { "Name": { "S": "Joe" }, "Age": { "N": "35" } } }`) var av DynamoDBAttributeValue err := json.Unmarshal(input, &av) assert.Nil(t, err) assert.Equal(t, DataTypeMap, av.DataType()) assert.Equal(t, 2, len(av.Map())) assert.Equal(t, "Joe", av.Map()["Name"].String()) assert.Equal(t, "35", av.Map()["Age"].Number()) }
explode_data.jsonl/61697
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 247 }
[ 2830, 3393, 1806, 27121, 2227, 1155, 353, 8840, 836, 8, 341, 22427, 1669, 3056, 3782, 61528, 286, 314, 330, 44, 788, 715, 310, 341, 394, 330, 675, 788, 314, 330, 50, 788, 330, 40344, 1, 1153, 394, 330, 16749, 788, 220, 314, 330, 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 TestUpdateFirewallRule(t *testing.T) { handler := APIMock{ T: t, ExpectMethod: "PUT", ExpectURL: "/1.0/firewall_rules/fwr-k32ls", ExpectBody: map[string]string{ "protocol": "tcp", "source": "grp-xxxxx", "destination": ""}, GiveBody: readJSON("firewall_rule"), } ts := httptest.NewServer(&handler) defer ts.Close() client, err := brightbox.NewClient(ts.URL, "", nil) if err != nil { t.Fatal(err) } proto := "tcp" dst := "" src := "grp-xxxxx" opts := brightbox.FirewallRuleOptions{ Id: "fwr-k32ls", Protocol: &proto, Source: &src, Destination: &dst, } p, err := client.UpdateFirewallRule(&opts) if err != nil { t.Fatal(err) } if p == nil { t.Errorf("Didn't return a firewall rule") } if p.Id != "fwr-k32ls" { t.Errorf("firewall rule id is %s", p.Id) } }
explode_data.jsonl/17595
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 415 }
[ 2830, 3393, 4289, 16697, 16431, 11337, 1155, 353, 8840, 836, 8, 341, 53326, 1669, 10106, 1791, 1176, 515, 197, 10261, 25, 310, 259, 345, 197, 35911, 3523, 25, 330, 6221, 756, 197, 35911, 3144, 25, 262, 3521, 16, 13, 15, 53010, 16431, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestSeriesDescGT(t *testing.T) { db, err := sqlx.Open("sqlite3", ":memory:") if err != nil { t.Fatal(err) } defer db.Close() totalBefore := totalIterations var contents []string err = db.Select(&contents, "select value from series(0, 100, 1) where value > 50 order by value desc") if err != nil { t.Fatal(err) } iterations := totalIterations - totalBefore assert.Equal(t, 49, len(contents)) assert.Equal(t, 50, iterations) assert.Equal(t, "99", contents[0]) assert.Equal(t, "98", contents[1]) assert.Equal(t, "52", contents[47]) assert.Equal(t, "51", contents[48]) }
explode_data.jsonl/13439
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 233 }
[ 2830, 3393, 25544, 11065, 25388, 1155, 353, 8840, 836, 8, 341, 20939, 11, 1848, 1669, 5704, 87, 12953, 445, 37042, 18, 497, 13022, 17269, 34403, 743, 1848, 961, 2092, 341, 197, 3244, 26133, 3964, 340, 197, 532, 16867, 2927, 10421, 2822,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestRowContainerIterators(t *testing.T) { defer leaktest.AfterTest(t)() ctx := context.Background() st := cluster.MakeTestingClusterSettings() evalCtx := tree.NewTestingEvalContext(st) defer evalCtx.Stop(ctx) const numRows = 10 const numCols = 1 rows := sqlbase.MakeIntRows(numRows, numCols) ordering := sqlbase.ColumnOrdering{{ColIdx: 0, Direction: encoding.Ascending}} var mc MemRowContainer mc.Init( ordering, sqlbase.OneIntCol, evalCtx, ) defer mc.Close(ctx) for _, row := range rows { if err := mc.AddRow(ctx, row); err != nil { t.Fatal(err) } } // NewIterator verifies that we read the expected rows from the // MemRowContainer and can recreate an iterator. t.Run("NewIterator", func(t *testing.T) { for k := 0; k < 2; k++ { func() { i := mc.NewIterator(ctx) defer i.Close() if err := verifyRows(ctx, i, rows, evalCtx, ordering); err != nil { t.Fatalf("rows mismatch on the run number %d: %s", k+1, err) } }() } }) // NewFinalIterator verifies that we read the expected rows from the // MemRowContainer and as we do so, these rows are deleted from the // MemRowContainer. t.Run("NewFinalIterator", func(t *testing.T) { i := mc.NewFinalIterator(ctx) defer i.Close() if err := verifyRows(ctx, i, rows, evalCtx, ordering); err != nil { t.Fatal(err) } if mc.Len() != 0 { t.Fatal("MemRowContainer is not empty") } }) }
explode_data.jsonl/67169
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 558 }
[ 2830, 3393, 3102, 4502, 8537, 2973, 1155, 353, 8840, 836, 8, 341, 16867, 23352, 1944, 36892, 2271, 1155, 8, 2822, 20985, 1669, 2266, 19047, 741, 18388, 1669, 10652, 50133, 16451, 28678, 6086, 741, 93413, 23684, 1669, 4916, 7121, 16451, 54...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestTSExponentiation(t *testing.T) { // More info: https://github.com/microsoft/TypeScript/issues/41755 expectParseErrorTS(t, "await x! ** 2", "<stdin>: error: Unexpected \"**\"\n") expectPrintedTS(t, "await x as any ** 2", "(await x) ** 2;\n") }
explode_data.jsonl/82330
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 100 }
[ 2830, 3393, 9951, 840, 1146, 7101, 1155, 353, 8840, 836, 8, 341, 197, 322, 4398, 3546, 25, 3703, 1110, 5204, 905, 3183, 3929, 14, 929, 5910, 38745, 14, 19, 16, 22, 20, 20, 198, 24952, 14463, 1454, 9951, 1155, 11, 330, 11421, 856, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestZeroMatrix(t *testing.T) { n := 4 matrix := make([][]int, n) matrix[0] = []int{1, 1, 1, 1} matrix[1] = []int{1, 0, 1, 1} matrix[2] = []int{1, 1, 1, 1} matrix[3] = []int{1, 1, 0, 1} expectedMatrix := make([][]int, n) expectedMatrix[0] = []int{1, 0, 0, 1} expectedMatrix[1] = []int{0, 0, 0, 0} expectedMatrix[2] = []int{1, 0, 0, 1} expectedMatrix[3] = []int{0, 0, 0, 0} testCases := []struct { Name string Matrix [][]int Expected [][]int }{ {"zero matrix", matrix, expectedMatrix}, } for _, tc := range testCases { t.Run(tc.Name, func(t *testing.T) { actualMatrix := ZeroMatrix(tc.Matrix) if !util.EqualMatrices(actualMatrix, expectedMatrix) { t.Errorf("Expect \n%s \n Actual \n%s \n", util.MatrixToString(expectedMatrix), util.MatrixToString(actualMatrix)) } }) } }
explode_data.jsonl/31628
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 374 }
[ 2830, 3393, 17999, 6689, 1155, 353, 8840, 836, 8, 341, 9038, 1669, 220, 19, 198, 60930, 1669, 1281, 10556, 1294, 396, 11, 308, 340, 60930, 58, 15, 60, 284, 3056, 396, 90, 16, 11, 220, 16, 11, 220, 16, 11, 220, 16, 532, 60930, 58...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestHeaders(t *testing.T) { // Reset memory counters helpers.ResetMemoryStats() code := fmt.Sprintf(` d = datadog_agent.headers(http_host="myhost", ignore_me="snafu") with open(r'%s', 'w') as f: f.write(",".join(sorted(d.keys()))) `, tmpfile.Name()) out, err := run(code) if err != nil { t.Fatal(err) } if out != "Accept,Content-Type,Host,User-Agent" { t.Errorf("Unexpected printed value: '%s'", out) } // Check for leaks helpers.AssertMemoryUsage(t) }
explode_data.jsonl/24541
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 200 }
[ 2830, 3393, 10574, 1155, 353, 8840, 836, 8, 341, 197, 322, 16932, 4938, 31532, 198, 197, 21723, 36660, 10642, 16635, 2822, 43343, 1669, 8879, 17305, 61528, 2698, 284, 3258, 329, 538, 25730, 18022, 19886, 12848, 428, 2408, 3790, 497, 10034...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestCaseMatching(t *testing.T) { conf := config.NewConfig() config.Set(conf) assert := assert.New(t) gwObject := data.AddServerToGateway(data.CreateServer( []string{ "NOTFINE.example.com", "notfine.example.com", }, 80, "http", "http"), data.CreateEmptyGateway("foxxed", "test", map[string]string{ "app": "canidae", })) gws := [][]kubernetes.IstioObject{[]kubernetes.IstioObject{gwObject}} validations := MultiMatchChecker{ GatewaysPerNamespace: gws, }.Check() assert.NotEmpty(validations) assert.Equal(1, len(validations)) validation, ok := validations[models.IstioValidationKey{ObjectType: "gateway", Namespace: "test", Name: "foxxed"}] assert.True(ok) assert.True(validation.Valid) }
explode_data.jsonl/54036
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 285 }
[ 2830, 30573, 64430, 1155, 353, 8840, 836, 8, 341, 67850, 1669, 2193, 7121, 2648, 741, 25873, 4202, 29879, 692, 6948, 1669, 2060, 7121, 1155, 692, 3174, 86, 1190, 1669, 821, 1904, 5475, 1249, 40709, 2592, 7251, 5475, 1006, 197, 197, 1294...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestCreateComment(t *testing.T) { ts := httptest.NewTLSServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { if r.Method != http.MethodPost { t.Errorf("Bad method: %s", r.Method) } if r.URL.Path != "/repos/k8s/kuber/issues/5/comments" { t.Errorf("Bad request path: %s", r.URL.Path) } b, err := ioutil.ReadAll(r.Body) if err != nil { t.Fatalf("Could not read request body: %v", err) } var ic IssueComment if err := json.Unmarshal(b, &ic); err != nil { t.Errorf("Could not unmarshal request: %v", err) } else if ic.Body != "hello" { t.Errorf("Wrong body: %s", ic.Body) } http.Error(w, "201 Created", http.StatusCreated) })) defer ts.Close() c := getClient(ts.URL) if err := c.CreateComment("k8s", "kuber", 5, "hello"); err != nil { t.Errorf("Didn't expect error: %v", err) } }
explode_data.jsonl/6249
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 366 }
[ 2830, 3393, 4021, 10677, 1155, 353, 8840, 836, 8, 341, 57441, 1669, 54320, 70334, 7121, 13470, 1220, 2836, 19886, 89164, 18552, 3622, 1758, 37508, 11, 435, 353, 1254, 9659, 8, 341, 197, 743, 435, 20798, 961, 1758, 20798, 4133, 341, 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...
6
func TestValidateListeners(t *testing.T) { listeners := []v1alpha1.Listener{ { Name: "tcp-listener", Port: 53, Protocol: "TCP", }, { Name: "udp-listener", Port: 53, Protocol: "UDP", }, } gcv := createGlobalConfigurationValidator() allErrs := gcv.validateListeners(listeners, field.NewPath("listeners")) if len(allErrs) > 0 { t.Errorf("validateListeners() returned errors %v for valid intput", allErrs) } }
explode_data.jsonl/11995
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 205 }
[ 2830, 3393, 17926, 31570, 1155, 353, 8840, 836, 8, 341, 14440, 18223, 1669, 3056, 85, 16, 7141, 16, 64091, 515, 197, 197, 515, 298, 21297, 25, 257, 330, 27161, 9029, 798, 756, 298, 98459, 25, 257, 220, 20, 18, 345, 298, 197, 20689, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestEndpointsDiscoveryEmptySubsets(t *testing.T) { n, _, eps, _ := makeTestEndpointsDiscovery() eps.GetStore().Add(makeEndpoints()) k8sDiscoveryTest{ discovery: n, afterStart: func() { go func() { eps.Update(&v1.Endpoints{ ObjectMeta: metav1.ObjectMeta{ Name: "testendpoints", Namespace: "default", }, Subsets: []v1.EndpointSubset{}, }) }() }, expectedRes: []*targetgroup.Group{ { Labels: model.LabelSet{ "__meta_kubernetes_namespace": "default", "__meta_kubernetes_endpoints_name": "testendpoints", }, Source: "endpoints/default/testendpoints", }, }, }.Run(t) }
explode_data.jsonl/36701
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 310 }
[ 2830, 3393, 80786, 67400, 3522, 3136, 4917, 1155, 353, 8840, 836, 8, 341, 9038, 11, 8358, 17986, 11, 716, 1669, 1281, 2271, 80786, 67400, 741, 197, 7124, 2234, 6093, 1005, 2212, 36944, 80786, 12367, 16463, 23, 82, 67400, 2271, 515, 197,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestController_GetNode(t *testing.T) { node1 := getTestNode("1", "aws") node2 := getTestNode("2", "openstack") node3 := getTestNode("3", "") node4 := getTestNode("4", "hetzner") nodeList := []*corev1.Node{&node1, &node2, &node3, &node4} tests := []struct { name string instance instance.Instance resNode *corev1.Node exists bool err error provider providerconfigtypes.CloudProvider }{ { name: "node not found - no nodeList", provider: "", resNode: nil, exists: false, err: nil, instance: &fakeInstance{id: "99", addresses: map[string]corev1.NodeAddressType{"192.168.1.99": corev1.NodeInternalIP}}, }, { name: "node not found - no suitable node", provider: "", resNode: nil, exists: false, err: nil, instance: &fakeInstance{id: "99", addresses: map[string]corev1.NodeAddressType{"192.168.1.99": corev1.NodeInternalIP}}, }, { name: "node found by provider id", provider: "aws", resNode: &node1, exists: true, err: nil, instance: &fakeInstance{id: "1", addresses: map[string]corev1.NodeAddressType{"": ""}}, }, { name: "node found by internal ip", provider: "", resNode: &node3, exists: true, err: nil, instance: &fakeInstance{id: "3", addresses: map[string]corev1.NodeAddressType{"192.168.1.3": corev1.NodeInternalIP}}, }, { name: "node found by external ip", provider: "", resNode: &node3, exists: true, err: nil, instance: &fakeInstance{id: "3", addresses: map[string]corev1.NodeAddressType{"172.16.1.3": corev1.NodeInternalIP}}, }, { name: "hetzner node found by internal ip", provider: "hetzner", resNode: &node3, exists: true, err: nil, instance: &fakeInstance{id: "3", name: "node3", addresses: map[string]corev1.NodeAddressType{"192.168.1.3": corev1.NodeInternalIP}}, }, { name: "hetzner node found by external ip", provider: "hetzner", resNode: &node3, exists: true, err: nil, instance: &fakeInstance{id: "3", name: "node3", addresses: map[string]corev1.NodeAddressType{"172.16.1.3": corev1.NodeExternalIP}}, }, { name: "hetzner node not found - node and instance names mismatch", provider: "hetzner", resNode: nil, exists: false, err: nil, instance: &fakeInstance{id: "3", name: "instance3", addresses: map[string]corev1.NodeAddressType{"192.168.1.3": corev1.NodeInternalIP}}, }, { name: "hetzner node found by provider id", provider: "hetzner", resNode: &node4, exists: true, err: nil, instance: &fakeInstance{id: "4", addresses: map[string]corev1.NodeAddressType{"": ""}}, }, } for _, test := range tests { t.Run(test.name, func(t *testing.T) { nodes := []runtime.Object{} for _, node := range nodeList { nodes = append(nodes, node) } client := ctrlruntimefake.NewFakeClient(nodes...) reconciler := Reconciler{client: client} node, exists, err := reconciler.getNode(test.instance, test.provider) if diff := deep.Equal(err, test.err); diff != nil { t.Errorf("expected to get %v instead got: %v", test.err, err) } if err != nil { return } if exists != test.exists { t.Errorf("expected to get %v instead got: %v", test.exists, exists) } if !exists { return } if diff := deep.Equal(node, test.resNode); diff != nil { t.Errorf("expected to get %v instead got: %v", test.resNode, node) } }) } }
explode_data.jsonl/59419
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1574 }
[ 2830, 3393, 2051, 13614, 1955, 1155, 353, 8840, 836, 8, 341, 20831, 16, 1669, 633, 2271, 1955, 445, 16, 497, 330, 8635, 1138, 20831, 17, 1669, 633, 2271, 1955, 445, 17, 497, 330, 2508, 7693, 1138, 20831, 18, 1669, 633, 2271, 1955, 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...
7
func TestRequestParserMiddlewareReturns404WhenSetURLParamsFailsValidation(t *testing.T) { r := NewRouter() r.Get("/users/:id", func(Context) (Handler, error) { return &urlParamsHandler{handle: func(Context) error { t.Fatal("handle called unexpectedly") return nil }}, nil }) req := httptest.NewRequest("GET", "/users/abcd", nil) rec := httptest.NewRecorder() r.ServeHTTP(rec, req) rec.Flush() assert.Equal(t, http.StatusNotFound, rec.Result().StatusCode) }
explode_data.jsonl/18948
{ "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, 1900, 6570, 24684, 16446, 19, 15, 19, 4498, 1649, 3144, 4870, 37, 6209, 13799, 1155, 353, 8840, 836, 8, 341, 7000, 1669, 1532, 9523, 741, 7000, 2234, 4283, 4218, 11315, 307, 497, 2915, 14001, 8, 320, 3050, 11, 1465, 8, 3...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestInterfaceToInt8(t *testing.T) { var out int8 var ok bool out, ok = InterfaceToInt8(int(1)) require.True(t, ok) require.Equal(t, int8(1), out) _, ok = InterfaceToInt8(float32(2)) require.False(t, ok) _, ok = InterfaceToInt8("test") require.False(t, ok) }
explode_data.jsonl/52296
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 117 }
[ 2830, 3393, 5051, 38544, 23, 1155, 353, 8840, 836, 8, 341, 2405, 700, 526, 23, 198, 2405, 5394, 1807, 271, 13967, 11, 5394, 284, 20019, 38544, 23, 1548, 7, 16, 1171, 17957, 32443, 1155, 11, 5394, 340, 17957, 12808, 1155, 11, 526, 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 TestNativeClient(t *testing.T) { initTestData() auth := Auth{Keys: []string{key}} client, err := NewNativeClient("ubuntu", vers, testServers[0], 22, &auth, timeout, nil) //client.AddHop(testServers[1]) require.Nil(t, err, "NewNativeClient") // run 3 tests concurrently 4 times numThread := 5 results := make(chan Result, numThread) // test cached connection api with multiple threads client.StartPersistentConn(timeout) for i := 0; i < numThread; i++ { go func(i int) { expected := fmt.Sprintf("testing: %d", i) out, err := client.Output("echo " + expected) results <- Result{expected, out, err} }(i) } for i := 0; i < numThread; i++ { result := <-results require.Nil(t, result.err, "result") require.Equal(t, result.expected, result.out, result.expected) } client.StopPersistentConn() for hopTest := 0; hopTest < len(testServers); hopTest++ { if hopTest != 0 { newclient, err := client.AddHop(testServers[hopTest], 22) client = newclient.(Client) require.Nil(t, err, "addhop") } for i := 0; i < numThread; i++ { go func(i int) { expected := fmt.Sprintf("testing: %d", i) out, err := client.Output("echo " + expected) results <- Result{expected, out, err} }(i) } for i := 0; i < numThread; i++ { result := <-results require.Nil(t, result.err, "result") require.Equal(t, result.expected, result.out, result.expected) } } //now add bad hop and check for error badClient, _ := client.AddHop("10.10.10.10", 22) _, err = badClient.Output("echo hello") require.NotNil(t, err) require.Contains(t, err.Error(), "ssh client timeout") // test non-default timeout - connect to client, err = NewNativeClient("ubuntu", vers, nullServer, 22, &auth, timeout, nil) require.Nil(t, err, "NewNativeClient") ch := make(chan Result, 1) go func() { out, err := client.OutputWithTimeout("echo abc", nonDefaultTimeout) ch <- Result{"", out, err} }() // we should make sure that a non-default timeout is used select { case result := <-ch: require.NotNil(t, result.err) require.Contains(t, result.err.Error(), "timeout") case <-time.After(timeout / 2): require.Fail(t, "Error - Non-default timeout was ignored") } }
explode_data.jsonl/80245
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 824 }
[ 2830, 3393, 20800, 2959, 1155, 353, 8840, 836, 8, 341, 28248, 83920, 741, 78011, 1669, 7366, 90, 8850, 25, 3056, 917, 90, 792, 11248, 25291, 11, 1848, 1669, 1532, 20800, 2959, 445, 37979, 497, 5436, 11, 1273, 78139, 58, 15, 1125, 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 TestCheckpointInactive(t *testing.T) { h := newHarness(t) builder := mock.NewBuilder(builtin.StoragePowerActorAddr).WithCaller(builtin.SystemActorAddr, builtin.SystemActorCodeID) rt := builder.Build(t) h.constructAndVerify(rt) SubnetActorAddr := tutil.NewIDAddr(t, 101) t.Log("register new subnet successfully") // Send 2FIL of stake value := abi.NewTokenAmount(2e18) rt.SetCaller(SubnetActorAddr, actors.SubnetActorCodeID) rt.SetReceived(value) rt.SetBalance(value) // Only subnet actors can call. rt.ExpectValidateCallerType(actors.SubnetActorCodeID) // Call Register function ret := rt.Call(h.SubnetCoordActor.Register, nil) res, ok := ret.(*actor.SubnetIDParam) require.True(t, ok) shid := address.NewSubnetID(address.RootSubnet, SubnetActorAddr) // Verify the return value is correct. require.Equal(t, res.ID, shid.String()) rt.Verify() require.Equal(t, getState(rt).TotalSubnets, uint64(1)) // Verify instantiated subnet sh, found := h.getSubnet(rt, shid) nn1 := sh.ID require.True(h.t, found) require.Equal(t, sh.Stake, value) require.Equal(t, sh.ID, address.NewSubnetID(address.RootSubnet, SubnetActorAddr)) require.Equal(t, sh.ParentID.String(), "/root") require.Equal(t, sh.Status, actor.Active) t.Log("release some stake to inactivate") releaseVal := abi.NewTokenAmount(2e18) params := &actor.FundParams{Value: releaseVal} rt.SetCaller(SubnetActorAddr, actors.SubnetActorCodeID) // Only subnet actors can call. rt.ExpectValidateCallerType(actors.SubnetActorCodeID) rt.ExpectSend(SubnetActorAddr, builtin.MethodSend, nil, releaseVal, nil, exitcode.Ok) rt.Call(h.SubnetCoordActor.ReleaseStake, params) rt.Verify() sh, found = h.getSubnet(rt, shid) require.True(h.t, found) require.Equal(t, sh.Status, actor.Inactive) t.Log("trying to commit checkpoint for inactive subnet") epoch := abi.ChainEpoch(32) rt.SetCaller(SubnetActorAddr, actors.SubnetActorCodeID) // Only subnet actors can call. rt.ExpectValidateCallerType(actors.SubnetActorCodeID) rt.SetEpoch(epoch) ch := newCheckpoint(nn1, epoch+20) b, err := ch.MarshalBinary() require.NoError(t, err) rt.ExpectAbort(exitcode.ErrIllegalState, func() { rt.Call(h.SubnetCoordActor.CommitChildCheckpoint, &actor.CheckpointParams{b}) }) }
explode_data.jsonl/64794
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 868 }
[ 2830, 3393, 92688, 72214, 1155, 353, 8840, 836, 8, 341, 9598, 1669, 501, 74248, 1155, 340, 44546, 1669, 7860, 7121, 3297, 1883, 25628, 43771, 14986, 18870, 13986, 568, 2354, 58735, 1883, 25628, 16620, 18870, 13986, 11, 59626, 16620, 18870, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestScaleDeployment(t *testing.T) { testCases := []struct { testName string spaceName string appName string envName string expectPutURLs map[string]struct{} cassetteName string newReplicas int oldReplicas int shouldFail bool errorChecker func(error) (bool, error) }{ { testName: "Basic", spaceName: "mySpace", appName: "myApp", envName: "run", cassetteName: "scaledeployment", expectPutURLs: map[string]struct{}{ "http://api.myCluster/oapi/v1/namespaces/my-run/deploymentconfigs/myDeploy/scale": {}, }, newReplicas: 3, oldReplicas: 2, }, { testName: "Zero Replicas", spaceName: "mySpace", appName: "myApp", envName: "run", cassetteName: "scaledeployment-zero", expectPutURLs: map[string]struct{}{ "http://api.myCluster/oapi/v1/namespaces/my-run/deploymentconfigs/myDeploy/scale": {}, }, newReplicas: 1, oldReplicas: 0, }, { testName: "Scale Get Error", spaceName: "mySpace", appName: "myApp", envName: "run", cassetteName: "scaledeployment-get-error", expectPutURLs: map[string]struct{}{}, shouldFail: true, errorChecker: errors.IsBadParameterError, }, { testName: "Scale Put Error", spaceName: "mySpace", appName: "myApp", envName: "run", cassetteName: "scaledeployment-put-error", expectPutURLs: map[string]struct{}{ "http://api.myCluster/oapi/v1/namespaces/my-run/deploymentconfigs/myDeploy/scale": {}, }, shouldFail: true, errorChecker: errors.IsBadParameterError, }, } for _, testCase := range testCases { t.Run(testCase.testName, func(t *testing.T) { r, err := recorder.New(pathToTestJSON + testCase.cassetteName) r.SetMatcher(func(actual *http.Request, expected cassette.Request) bool { if cassette.DefaultMatcher(actual, expected) { // Check scale request body when sending PUT if actual.Method == "PUT" { var buf bytes.Buffer reqBody := actual.Body _, err := buf.ReadFrom(reqBody) require.NoError(t, err, "Error reading request body") defer reqBody.Close() // Mark interaction as seen reqURL := actual.URL.String() _, pres := testCase.expectPutURLs[reqURL] require.True(t, pres, "Unexpected PUT request %s", reqURL) delete(testCase.expectPutURLs, reqURL) // Check spec/replicas modified correctly var scaleOutput map[string]interface{} err = json.Unmarshal(buf.Bytes(), &scaleOutput) require.NoError(t, err, "Request body must be JSON object") spec, ok := scaleOutput["spec"].(map[string]interface{}) require.True(t, ok, "Spec property is missing or invalid") newReplicas, ok := spec["replicas"].(float64) require.True(t, ok, "Replicas property is missing or invalid") require.Equal(t, testCase.newReplicas, int(newReplicas), "Wrong modified number of replicas") // Replace body actual.Body = ioutil.NopCloser(&buf) } return true } return false }) require.NoError(t, err, "Failed to open cassette") defer r.Stop() fixture := &testFixture{} kc := getDefaultKubeClient(fixture, r.Transport, t) old, err := kc.ScaleDeployment(testCase.spaceName, testCase.appName, testCase.envName, testCase.newReplicas) if testCase.shouldFail { require.Error(t, err, "Expected an error") if testCase.errorChecker != nil { matches, _ := testCase.errorChecker(err) require.True(t, matches, "Error or cause must be the expected type") } } else { require.NoError(t, err, "Unexpected error occurred") require.NotNil(t, old, "Previous replicas are nil") require.Equal(t, testCase.oldReplicas, *old, "Wrong number of previous replicas") } // Check we saw all expected PUT requests require.Empty(t, testCase.expectPutURLs, "Not all PUT requests sent: %v", testCase.expectPutURLs) }) } }
explode_data.jsonl/41273
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1725 }
[ 2830, 3393, 6947, 75286, 1155, 353, 8840, 836, 8, 341, 18185, 37302, 1669, 3056, 1235, 341, 197, 18185, 675, 414, 914, 198, 197, 1903, 1306, 675, 257, 914, 198, 197, 28236, 675, 981, 914, 198, 197, 57538, 675, 981, 914, 198, 197, 24...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestHelperVMs(t *testing.T) { if os.Getenv("GO_WANT_HELPER_PROCESS") != "1" { return } fmt.Fprintf(os.Stdout, "[{\"zone\":\"us-central-1\",\"name\":\"app-central-as72\"}]") os.Exit(0) }
explode_data.jsonl/13295
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 96 }
[ 2830, 3393, 5511, 11187, 82, 1155, 353, 8840, 836, 8, 341, 743, 2643, 64883, 445, 15513, 2763, 2821, 85331, 36199, 899, 961, 330, 16, 1, 341, 197, 853, 198, 197, 630, 11009, 59559, 9638, 83225, 11, 10545, 64238, 8684, 23488, 355, 8408...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestBatchGenerator(t *testing.T) { var generateFuncCaled uint64 var postGeneratorFuncCalled uint64 generateFunc := func(ns string, index int) (string, string) { atomic.AddUint64(&generateFuncCaled, 1) return ns, fmt.Sprintf("%s-%d", ns, index) } postGeneratorFunc := func(ns, name string) error { atomic.AddUint64(&postGeneratorFuncCalled, 1) return nil } t.Run("should complete immediately since 0 ksvc is required to be created", func(t *testing.T) { generateFuncCaled = 0 postGeneratorFuncCalled = 0 start := time.Now().Unix() generator.NewBatchGenerator(time.Duration(1)*time.Second, 0, 2, 2, []string{"ns1", "ns2"}, generateFunc, postGeneratorFunc).Generate() duration := time.Now().Unix() - start // should complete immediately assert.Assert(t, duration < 1) assert.Assert(t, generateFuncCaled == 0) assert.Assert(t, postGeneratorFuncCalled == 0) }) t.Run("should complete in 4s", func(t *testing.T) { generateFuncCaled = 0 postGeneratorFuncCalled = 0 start := time.Now().Unix() generator.NewBatchGenerator(time.Duration(1)*time.Second, 8, 2, 2, []string{"ns1", "ns2"}, generateFunc, postGeneratorFunc).Generate() duration := time.Now().Unix() - start // should complete in count/batch = 4 seconds assert.Assert(t, duration >= 4 && duration <= 5) assert.Assert(t, generateFuncCaled == 8) assert.Assert(t, postGeneratorFuncCalled == 8) }) t.Run("should complete in 2s", func(t *testing.T) { generateFuncCaled = 0 postGeneratorFuncCalled = 0 start := time.Now().Unix() generator.NewBatchGenerator(time.Duration(1)*time.Second, 8, 4, 2, []string{"ns1", "ns2"}, generateFunc, postGeneratorFunc).Generate() duration := time.Now().Unix() - start // should complete in count/batch = 2 seconds assert.Assert(t, duration >= 2 && duration <= 3) assert.Assert(t, generateFuncCaled == 8) assert.Assert(t, postGeneratorFuncCalled == 8) }) t.Run("should complete in 1s", func(t *testing.T) { generateFuncCaled = 0 postGeneratorFuncCalled = 0 start := time.Now().Unix() generator.NewBatchGenerator(time.Duration(1)*time.Second, 8, 8, 16, []string{"ns1", "ns2"}, generateFunc, postGeneratorFunc).Generate() duration := time.Now().Unix() - start // should complete in count/batch = 1 second assert.Assert(t, duration >= 1 && duration <= 2) assert.Assert(t, generateFuncCaled == 8) assert.Assert(t, postGeneratorFuncCalled == 8) }) }
explode_data.jsonl/1505
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 909 }
[ 2830, 3393, 21074, 12561, 1155, 353, 8840, 836, 8, 341, 2405, 6923, 9626, 34, 5838, 2622, 21, 19, 198, 2405, 1736, 12561, 9626, 20960, 2622, 21, 19, 271, 3174, 13220, 9626, 1669, 2915, 39417, 914, 11, 1922, 526, 8, 320, 917, 11, 914...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestListSet(t *testing.T) { list := New() list.Set(0, "a") list.Set(1, "b") if actualValue := list.Size(); actualValue != 2 { t.Errorf("Got %v expected %v", actualValue, 2) } list.Set(2, "c") // append if actualValue := list.Size(); actualValue != 3 { t.Errorf("Got %v expected %v", actualValue, 3) } list.Set(4, "d") // ignore list.Set(1, "bb") // update if actualValue := list.Size(); actualValue != 3 { t.Errorf("Got %v expected %v", actualValue, 3) } if actualValue, expectedValue := fmt.Sprintf("%s%s%s", list.Values()...), "abbc"; actualValue != expectedValue { t.Errorf("Got %v expected %v", actualValue, expectedValue) } list.Set(2, "cc") // last to first traversal list.Set(0, "aa") // first to last traversal if actualValue, expectedValue := fmt.Sprintf("%s%s%s", list.Values()...), "aabbcc"; actualValue != expectedValue { t.Errorf("Got %v expected %v", actualValue, expectedValue) } }
explode_data.jsonl/18292
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 353 }
[ 2830, 3393, 852, 1649, 1155, 353, 8840, 836, 8, 341, 14440, 1669, 1532, 741, 14440, 4202, 7, 15, 11, 330, 64, 1138, 14440, 4202, 7, 16, 11, 330, 65, 1138, 743, 5042, 1130, 1669, 1140, 2465, 2129, 5042, 1130, 961, 220, 17, 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...
6
func Test_createBootClone_into_existing_directory_fails(t *testing.T) { log.SetOutput(ioutil.Discard) bootDir, err := ioutil.TempDir("", "boot-test") require.NoError(t, err) defer func() { _ = os.RemoveAll(bootDir) }() factory := cmd_mocks.NewMockFactory() commonOpts := opts.NewCommonOptionsWithFactory(factory) commonOpts.BatchMode = true o := BootOptions{ CommonOptions: &commonOpts, Dir: bootDir, } cloneDir, err := o.createBootClone(config.DefaultBootRepository, config.DefaultVersionsRef, bootDir) assert.Error(t, err) assert.Contains(t, err.Error(), "dir already exists") assert.Empty(t, cloneDir) }
explode_data.jsonl/63009
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 247 }
[ 2830, 3393, 8657, 17919, 37677, 45514, 62630, 14846, 761, 6209, 1155, 353, 8840, 836, 8, 341, 6725, 4202, 5097, 1956, 30158, 909, 47560, 340, 197, 4619, 6184, 11, 1848, 1669, 43144, 65009, 6184, 19814, 330, 4619, 16839, 1138, 17957, 35699...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestAzureVMNodes(t *testing.T) { if !mgrtesthelpers.CheckForCreds("azure") { t.Log("azure credentials missing; aborting") t.FailNow() } t.Log("Running Azure-VM nodes test.") ctx := context.Background() mgrConn, err := mgrtesthelpers.GetManagerConn() require.NoError(t, err) defer mgrConn.Close() // setup clients mgrClient := manager.NewNodeManagerServiceClient(mgrConn) nodesClient := nodes.NewNodesServiceClient(mgrConn) // delete all existing azure-vm managers, just in case err = mgrtesthelpers.DeleteAllManagersByType(ctx, mgrClient, "azure-vm") require.NoError(t, err) // create nodemanager t.Log("Creating azure-vm node manager.") mgrID, err := mgrtesthelpers.AddAzureManager(ctx, mgrClient, "azure-vm") require.NoError(t, err) require.NotZero(t, len(mgrID.Ids)) AzureVMManagerID = mgrID.GetIds()[0].Id t.Log("ensure some node were added") query := nodes.Query{ Filters: []*common.Filter{ {Key: "manager_id", Values: []string{AzureVMManagerID}}, }, } list, err := nodesClient.List(ctx, &query) require.NoError(t, err) assert.Equal(t, true, list.GetTotal() > 0) t.Log("ensure the manager id on the nodes is correct") assert.Equal(t, []string{AzureVMManagerID}, list.GetNodes()[0].GetManagerIds()) t.Log("ensure the tags on the nodes were read in and added to db") tagsExist := false for _, node := range list.GetNodes() { if len(node.Tags) > 0 { tagsExist = true break } } assert.Equal(t, true, tagsExist) }
explode_data.jsonl/21747
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 571 }
[ 2830, 3393, 78107, 11187, 12288, 1155, 353, 8840, 836, 8, 341, 743, 753, 48292, 1944, 21723, 10600, 2461, 34, 53369, 445, 39495, 899, 341, 197, 3244, 5247, 445, 39495, 16387, 7402, 26, 11326, 287, 1138, 197, 3244, 57243, 7039, 741, 197,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
4
func TestReconcileServiceInstanceUpdateMissingOrphanMitigation(t *testing.T) { _, fakeCatalogClient, fakeClusterServiceBrokerClient, testController, sharedInformers := newTestController(t, fakeosb.FakeClientConfiguration{ UpdateInstanceReaction: &fakeosb.UpdateInstanceReaction{ Response: &osb.UpdateInstanceResponse{}, }, }) sharedInformers.ClusterServiceBrokers().Informer().GetStore().Add(getTestClusterServiceBroker()) sharedInformers.ClusterServiceClasses().Informer().GetStore().Add(getTestClusterServiceClass()) sharedInformers.ClusterServicePlans().Informer().GetStore().Add(getTestClusterServicePlan()) instance := getTestServiceInstanceWithClusterRefs() instance.Generation = 2 instance.Status.ReconciledGeneration = 1 instance.Status.ObservedGeneration = 1 instance.Status.ProvisionStatus = v1beta1.ServiceInstanceProvisionStatusNotProvisioned instance.Status.DeprovisionStatus = v1beta1.ServiceInstanceDeprovisionStatusRequired // Set OrphanMitigationInProgress flag with OrphanMitigation condition missing instance.Status.OrphanMitigationInProgress = true instance.Status.ExternalProperties = &v1beta1.ServiceInstancePropertiesState{ ClusterServicePlanExternalName: testClusterServicePlanName, ClusterServicePlanExternalID: testClusterServicePlanGUID, } if err := reconcileServiceInstance(t, testController, instance); err != nil { t.Fatalf("This should not fail : %v", err) } brokerActions := fakeClusterServiceBrokerClient.Actions() assertNumberOfBrokerActions(t, brokerActions, 0) actions := fakeCatalogClient.Actions() assertNumberOfActions(t, actions, 1) updatedServiceInstance := assertUpdateStatus(t, actions[0], instance).(*v1beta1.ServiceInstance) if !isServiceInstanceOrphanMitigation(updatedServiceInstance) { t.Fatal("Expected instance status to have an OrphanMitigation condition set to True") } }
explode_data.jsonl/58205
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 550 }
[ 2830, 3393, 693, 40446, 457, 1860, 2523, 4289, 25080, 2195, 9943, 54370, 17930, 1155, 353, 8840, 836, 8, 341, 197, 6878, 12418, 41606, 2959, 11, 12418, 28678, 1860, 65545, 2959, 11, 1273, 2051, 11, 6094, 37891, 388, 1669, 501, 2271, 205...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestUndelegateSelfDelegationBelowMinSelfDelegation(t *testing.T) { _, app, ctx := createTestInput() addrDels := simapp.AddTestAddrsIncremental(app, ctx, 1, sdk.NewInt(10000)) addrVals := simapp.ConvertAddrsToValAddrs(addrDels) delTokens := sdk.TokensFromConsensusPower(10) delCoins := sdk.NewCoins(sdk.NewCoin(app.StakingKeeper.BondDenom(ctx), delTokens)) //create a validator with a self-delegation validator := types.NewValidator(addrVals[0], PKs[0], types.Description{}) validator.MinSelfDelegation = delTokens validator, issuedShares := validator.AddTokensFromDel(delTokens) require.Equal(t, delTokens, issuedShares.RoundInt()) // add bonded tokens to pool for delegations notBondedPool := app.StakingKeeper.GetNotBondedPool(ctx) oldNotBonded := app.BankKeeper.GetAllBalances(ctx, notBondedPool.GetAddress()) err := app.BankKeeper.SetBalances(ctx, notBondedPool.GetAddress(), oldNotBonded.Add(delCoins...)) require.NoError(t, err) app.AccountKeeper.SetModuleAccount(ctx, notBondedPool) validator = keeper.TestingUpdateValidator(app.StakingKeeper, ctx, validator, true) app.StakingKeeper.SetValidatorByConsAddr(ctx, validator) require.True(t, validator.IsBonded()) selfDelegation := types.NewDelegation(sdk.AccAddress(addrVals[0].Bytes()), addrVals[0], issuedShares) app.StakingKeeper.SetDelegation(ctx, selfDelegation) // add bonded tokens to pool for delegations bondedPool := app.StakingKeeper.GetBondedPool(ctx) oldBonded := app.BankKeeper.GetAllBalances(ctx, bondedPool.GetAddress()) err = app.BankKeeper.SetBalances(ctx, bondedPool.GetAddress(), oldBonded.Add(delCoins...)) require.NoError(t, err) app.AccountKeeper.SetModuleAccount(ctx, bondedPool) // create a second delegation to this validator app.StakingKeeper.DeleteValidatorByPowerIndex(ctx, validator) validator, issuedShares = validator.AddTokensFromDel(delTokens) require.True(t, validator.IsBonded()) require.Equal(t, delTokens, issuedShares.RoundInt()) // add bonded tokens to pool for delegations oldBonded = app.BankKeeper.GetAllBalances(ctx, bondedPool.GetAddress()) err = app.BankKeeper.SetBalances(ctx, bondedPool.GetAddress(), oldBonded.Add(delCoins...)) require.NoError(t, err) app.AccountKeeper.SetModuleAccount(ctx, bondedPool) validator = keeper.TestingUpdateValidator(app.StakingKeeper, ctx, validator, true) delegation := types.NewDelegation(addrDels[0], addrVals[0], issuedShares) app.StakingKeeper.SetDelegation(ctx, delegation) val0AccAddr := sdk.AccAddress(addrVals[0].Bytes()) _, err = app.StakingKeeper.Undelegate(ctx, val0AccAddr, addrVals[0], sdk.TokensFromConsensusPower(6).ToDec()) require.NoError(t, err) // end block updates := app.StakingKeeper.ApplyAndReturnValidatorSetUpdates(ctx) require.Equal(t, 1, len(updates)) validator, found := app.StakingKeeper.GetValidator(ctx, addrVals[0]) require.True(t, found) require.Equal(t, sdk.TokensFromConsensusPower(14), validator.Tokens) require.Equal(t, types.Unbonding, validator.Status) require.True(t, validator.Jailed) }
explode_data.jsonl/82047
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1087 }
[ 2830, 3393, 19957, 68, 4989, 12092, 1912, 87566, 38214, 6217, 12092, 1912, 87566, 1155, 353, 8840, 836, 8, 341, 197, 6878, 906, 11, 5635, 1669, 1855, 2271, 2505, 2822, 53183, 35, 2010, 1669, 1643, 676, 1904, 2271, 2212, 5428, 38311, 278...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_InstallPlugin_InstalledPlugins(t *testing.T) { assert := assert.New(t) defer setupLocalDistoForTesting()() execCommand = fakeExecCommand defer func() { execCommand = exec.Command }() // Try installing not-existing package testCase = testcaseInstallNotexists err := InstallPlugin("", "notexists", "v0.2.0") assert.NotNil(err) assert.Contains(err.Error(), "unable to find plugin 'notexists'") // Install login (standalone) package testCase = testcaseInstallLogin err = InstallPlugin("", "login", "v0.2.0") assert.Nil(err) // Verify installed plugin installedServerPlugins, installedStandalonePlugins, err := InstalledPlugins("") assert.Nil(err) assert.Equal(0, len(installedServerPlugins)) assert.Equal(1, len(installedStandalonePlugins)) assert.Equal("login", installedStandalonePlugins[0].Name) // Try installing cluster plugin through standalone discovery testCase = testcaseInstallCluster err = InstallPlugin("", "cluster", "v0.2.0") assert.NotNil(err) assert.Contains(err.Error(), "unable to find plugin 'cluster'") // Try installing cluster plugin through context discovery err = InstallPlugin("mgmt", "cluster", "v0.2.0") assert.Nil(err) // Verify installed plugins installedServerPlugins, installedStandalonePlugins, err = InstalledPlugins("mgmt") assert.Nil(err) assert.Equal(1, len(installedStandalonePlugins)) assert.Equal("login", installedStandalonePlugins[0].Name) assert.Equal(1, len(installedServerPlugins)) assert.Equal("cluster", installedServerPlugins[0].Name) }
explode_data.jsonl/71404
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 502 }
[ 2830, 3393, 62, 24690, 11546, 62, 60800, 45378, 1155, 353, 8840, 836, 8, 341, 6948, 1669, 2060, 7121, 1155, 692, 16867, 6505, 7319, 23356, 78, 2461, 16451, 368, 741, 67328, 4062, 284, 12418, 10216, 4062, 198, 16867, 2915, 368, 314, 3883...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestFormatEndpointIngressWithDefaults(t *testing.T) { j := &v1alpha1.Jira{ ObjectMeta: metav1.ObjectMeta{ Name: "test-jira", Namespace: "test-jira-namespace", }, Spec: v1alpha1.JiraSpec{ Ingress: &v1alpha1.JiraIngressPolicy{}, }, } j.SetDefaults() e := formatEndpoint(j) assert.NotNil(t, e) assert.Equal(t, "http://test-jira/", e) }
explode_data.jsonl/29201
{ "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, 4061, 27380, 641, 2483, 2354, 16273, 1155, 353, 8840, 836, 8, 341, 12428, 1669, 609, 85, 16, 7141, 16, 3503, 8832, 515, 197, 23816, 12175, 25, 77520, 16, 80222, 515, 298, 21297, 25, 414, 330, 1944, 13333, 8832, 756, 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...
1
func TestMarkdownTable_String(t *testing.T) { table := getTable() result := table.String() expected := `| packages | api-versions | | :--- | :--- | | compute | 2020-06-01 | | network | 2020-06-01 | | resources | 2020-09-01 |` if result != expected { t.Fatalf("expected %s, but got %s", expected, result) } }
explode_data.jsonl/6512
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 114 }
[ 2830, 3393, 68005, 2556, 31777, 1155, 353, 8840, 836, 8, 341, 26481, 1669, 633, 2556, 741, 9559, 1669, 1965, 6431, 741, 42400, 1669, 1565, 91, 14185, 760, 6330, 12, 28290, 9248, 91, 549, 4421, 760, 549, 4421, 9248, 91, 12564, 760, 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...
2
func TestReconcileIngressUpdate(t *testing.T) { var reconciler *Reconciler ctx, _, _, _, cancel := newTestSetup(t, func(r *Reconciler) { reconciler = r }) defer cancel() r := Route("test-ns", "test-route") ci := newTestIngress(t, r) if _, err := reconciler.reconcileIngress(ctx, r, ci); err != nil { t.Errorf("Unexpected error: %v", err) } updated := getRouteIngressFromClient(ctx, t, r) fakeciinformer.Get(ctx).Informer().GetIndexer().Add(updated) ci2 := newTestIngress(t, r, func(tc *traffic.Config) { tc.Targets[traffic.DefaultTarget][0].TrafficTarget.Percent = ptr.Int64(50) tc.Targets[traffic.DefaultTarget] = append(tc.Targets[traffic.DefaultTarget], traffic.RevisionTarget{ TrafficTarget: v1.TrafficTarget{ Percent: ptr.Int64(50), RevisionName: "revision2", }, }) }) if _, err := reconciler.reconcileIngress(ctx, r, ci2); err != nil { t.Errorf("Unexpected error: %v", err) } updated = getRouteIngressFromClient(ctx, t, r) if diff := cmp.Diff(ci2, updated); diff != "" { t.Errorf("Unexpected diff (-want +got): %v", diff) } if diff := cmp.Diff(ci, updated); diff == "" { t.Error("Expected difference, but found none") } }
explode_data.jsonl/64523
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 485 }
[ 2830, 3393, 693, 40446, 457, 641, 2483, 4289, 1155, 353, 8840, 836, 8, 341, 2405, 31445, 5769, 353, 693, 40446, 5769, 198, 20985, 11, 8358, 8358, 8358, 9121, 1669, 501, 2271, 21821, 1155, 11, 2915, 2601, 353, 693, 40446, 5769, 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 TestTrippableBreakerState(t *testing.T) { c := clock.NewMock() cb := NewBreaker() cb.Clock = c if !cb.Ready() { t.Fatal("expected breaker to be ready") } cb.Trip() if cb.Ready() { t.Fatal("expected breaker to not be ready") } c.Add(cb.nextBackOff + 1) if !cb.Ready() { t.Fatal("expected breaker to be ready after reset timeout") } cb.Fail() c.Add(cb.nextBackOff + 1) if !cb.Ready() { t.Fatal("expected breaker to be ready after reset timeout, post failure") } }
explode_data.jsonl/60798
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 198 }
[ 2830, 3393, 21884, 602, 480, 22524, 261, 1397, 1155, 353, 8840, 836, 8, 341, 1444, 1669, 8866, 7121, 11571, 741, 63810, 1669, 1532, 22524, 261, 741, 63810, 79248, 284, 272, 271, 743, 753, 7221, 6503, 88, 368, 341, 197, 3244, 26133, 44...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
5
func TestIf2(t *testing.T) { label1 := NewLabel("a") label2 := NewLabel("b") code := newBuilder(). Push(nil). JmpIf(exec.JcNil, label1). Push(5). Push(6). BuiltinOp(Int, OpMul). Jmp(label2). Label(label1). Push(5.0). Push(2.0). BuiltinOp(Float64, OpMul). Label(label2). Resolve() ctx := NewContext(code) ctx.Exec(0, code.Len()) if v := checkPop(ctx); v != 10.0 { t.Fatal("5.0 2.0 mul != 10.0, ret =", v) } }
explode_data.jsonl/74960
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 220 }
[ 2830, 3393, 2679, 17, 1155, 353, 8840, 836, 8, 341, 29277, 16, 1669, 1532, 2476, 445, 64, 1138, 29277, 17, 1669, 1532, 2476, 445, 65, 1138, 43343, 1669, 501, 3297, 25829, 197, 10025, 1116, 27907, 4292, 197, 17100, 1307, 2679, 46896, 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 TestVerifyRSASignature(t *testing.T) { t.Parallel() fName := "TestVerifySignature" defer cleanup(fName) writeOldFile(fName, t) opts := Options{ TargetPath: fName, Verifier: NewRSAVerifier(), } err := opts.SetPublicKeyPEM([]byte(rsaPublicKey)) if err != nil { t.Fatalf("Could not parse public key: %v", err) } opts.Signature = signrsa(rsaPrivateKey, newFile, t) err = Apply(bytes.NewReader(newFile), opts) validateUpdate(fName, err, t) }
explode_data.jsonl/73988
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 192 }
[ 2830, 3393, 32627, 11451, 1911, 622, 1568, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 2822, 1166, 675, 1669, 330, 2271, 32627, 25088, 698, 16867, 21290, 955, 675, 340, 24945, 18284, 1703, 955, 675, 11, 259, 692, 64734, 1669, 14566...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestMiddlewareShouldInterceptLinkHeaderPusherError(t *testing.T) { // given expectedHeaders := http.Header{"Accept-Encoding": []string{"br"}} request, err := http.NewRequest(http.MethodGet, "/index.html", nil) request.Header = http.Header{"Accept-Encoding": []string{"br"}, "Invalid-Header": []string{"Should be filter out"}} writer := httptest.NewRecorder() if err != nil { t.Fatalf("Could not create HTTP request: %v", err) } middleware := Middleware{ Next: httpserver.HandlerFunc(func(w http.ResponseWriter, r *http.Request) (int, error) { w.Header().Add("Link", "</index.css>; rel=preload; as=stylesheet;") w.Header().Add("Link", "</index2.css>; rel=preload; as=stylesheet;") return 0, nil }), Rules: []Rule{}, } pushingWriter := &MockedPusher{ResponseWriter: writer, returnedError: errors.New("Cannot push right now")} // when _, err2 := middleware.ServeHTTP(pushingWriter, request) // then if err2 != nil { t.Error("Should not return error") } expectedPushedResources := map[string]*http.PushOptions{ "/index.css": { Method: http.MethodGet, Header: expectedHeaders, }, } comparePushedResources(t, expectedPushedResources, pushingWriter.pushed) }
explode_data.jsonl/66106
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 429 }
[ 2830, 3393, 24684, 14996, 3306, 1484, 3939, 4047, 16644, 261, 1454, 1155, 353, 8840, 836, 8, 341, 197, 322, 2661, 198, 42400, 10574, 1669, 1758, 15753, 4913, 16646, 67358, 788, 3056, 917, 4913, 1323, 95642, 23555, 11, 1848, 1669, 1758, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestParseShowCreateTableQuery(t *testing.T) { testCases := []struct { query string result sql.Node err *errors.Kind }{ { "SHOW CREATE", nil, errUnsupportedShowCreateQuery, }, { "SHOW CREATE ANYTHING", nil, errUnsupportedShowCreateQuery, }, { "SHOW CREATE ASDF foo", nil, errUnsupportedShowCreateQuery, }, { "SHOW CREATE TABLE mytable", plan.NewShowCreateTable(sql.UnresolvedDatabase("").Name(), nil, "mytable"), nil, }, } for _, tt := range testCases { t.Run(tt.query, func(t *testing.T) { require := require.New(t) result, err := parseShowCreate(tt.query) if tt.err != nil { require.Error(err) require.True(tt.err.Is(err)) } else { require.NoError(err) require.Equal(tt.result, result) } }) } }
explode_data.jsonl/78338
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 379 }
[ 2830, 3393, 14463, 7812, 4021, 2556, 2859, 1155, 353, 8840, 836, 8, 341, 18185, 37302, 1669, 3056, 1235, 341, 197, 27274, 220, 914, 198, 197, 9559, 5704, 21714, 198, 197, 9859, 262, 353, 7650, 54199, 198, 197, 59403, 197, 197, 515, 29...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestPutBadToken(t *testing.T) { mb, _ := mailbox.Create("puttest.badtoken") accessKey := mailbox.AccessKey{MailboxId: mb.Id} accessKey.Create() req := api.PutMessageRequest{ Mailboxes: []string{mb.Id}, Body: "TEST MESSAGE", } req.Sign(accessKey.Name, accessKey.Secret) var resp api.PutMessageResponse code := doRequest(t, req, &resp, "put") if code == 200 { t.Fatal("Bad token should return error") } }
explode_data.jsonl/15712
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 167 }
[ 2830, 3393, 19103, 17082, 3323, 1155, 353, 8840, 836, 8, 341, 2109, 65, 11, 716, 1669, 45742, 7251, 445, 628, 1944, 31563, 5839, 1138, 197, 5211, 1592, 1669, 45742, 35645, 1592, 90, 16702, 2011, 764, 25, 10016, 6444, 532, 197, 5211, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestSendRstOnListenerRxAckV4(t *testing.T) { c := context.New(t, defaultMTU) defer c.Cleanup() c.Create(-1 /* epRcvBuf */) if err := c.EP.Bind(tcpip.FullAddress{Port: context.StackPort}); err != nil { t.Fatal("Bind failed:", err) } if err := c.EP.Listen(10 /* backlog */); err != nil { t.Fatal("Listen failed:", err) } c.SendPacket(nil, &context.Headers{ SrcPort: context.TestPort, DstPort: context.StackPort, Flags: header.TCPFlagFin | header.TCPFlagAck, SeqNum: 100, AckNum: 200, }) checker.IPv4(t, c.GetPacket(), checker.TCP( checker.DstPort(context.TestPort), checker.TCPFlags(header.TCPFlagRst), checker.TCPSeqNum(200))) }
explode_data.jsonl/75939
{ "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, 11505, 49, 267, 1925, 2743, 49, 14673, 377, 53, 19, 1155, 353, 8840, 836, 8, 341, 1444, 1669, 2266, 7121, 1155, 11, 1638, 8505, 52, 340, 16867, 272, 727, 60639, 2822, 1444, 7251, 4080, 16, 1391, 4155, 49, 13122, 15064, 6...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestFSGapsInSequenceWithMaxMsgsLimits(t *testing.T) { opts := testFSGetOptionsForGapsTests() for _, o := range opts { t.Run(o.name, func(t *testing.T) { cleanupFSDatastore(t) defer cleanupFSDatastore(t) s := createDefaultFileStore(t, o.opt) defer s.Close() limits := testDefaultStoreLimits limits.MaxMsgs = 3 if err := s.SetLimits(&limits); err != nil { t.Fatalf("Error setting limits: %v", err) } cs := storeCreateChannel(t, s, "foo") payload := []byte("msg") storeMsg(t, cs, "foo", 1, payload) storeMsg(t, cs, "foo", 2, payload) storeMsg(t, cs, "foo", 5, payload) s.Close() s, state := openDefaultFileStoreWithLimits(t, &limits, o.opt) defer s.Close() cs = getRecoveredChannel(t, state, "foo") n, _ := msgStoreState(t, cs.Msgs) if n != 3 { t.Fatalf("Expected 3 messages, got %v", n) } storeMsg(t, cs, "foo", 6, payload) storeMsg(t, cs, "foo", 7, payload) storeMsg(t, cs, "foo", 8, payload) n, _ = msgStoreState(t, cs.Msgs) if n != 3 { t.Fatalf("Expected 3 messages, got %v", n) } first, last := msgStoreFirstAndLastSequence(t, cs.Msgs) if first != 6 || last != 8 { t.Fatalf("Unexpected first/last: %v/%v", first, last) } }) } }
explode_data.jsonl/7782
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 571 }
[ 2830, 3393, 37, 7783, 2625, 641, 14076, 2354, 5974, 6611, 82, 94588, 1155, 353, 8840, 836, 8, 341, 64734, 1669, 1273, 8485, 1949, 3798, 2461, 38, 2625, 18200, 741, 2023, 8358, 297, 1669, 2088, 12185, 341, 197, 3244, 16708, 10108, 2644, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestApiTest_MatchesResponseHeaders_WithMixedKeyCase(t *testing.T) { handler := http.NewServeMux() handler.HandleFunc("/hello", func(w http.ResponseWriter, r *http.Request) { w.Header().Set("ABC", "12345") w.Header().Set("DEF", "67890") w.Header().Set("Authorization", "12345") w.Header().Add("authorizATION", "00000") w.Header().Add("Authorization", "98765") w.WriteHeader(http.StatusOK) }) apitest.New(). Handler(handler). Get("/hello"). Expect(t). Status(http.StatusOK). Headers(map[string]string{ "Abc": "12345", "Def": "67890", }). Header("Authorization", "12345"). Header("Authorization", "00000"). Header("authorization", "98765"). HeaderPresent("Def"). HeaderPresent("Authorization"). HeaderNotPresent("XYZ"). End() }
explode_data.jsonl/54806
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 307 }
[ 2830, 3393, 6563, 2271, 1245, 9118, 2582, 10574, 62, 2354, 86433, 1592, 4207, 1155, 353, 8840, 836, 8, 341, 53326, 1669, 1758, 7121, 60421, 44, 2200, 741, 53326, 63623, 4283, 14990, 497, 2915, 3622, 1758, 37508, 11, 435, 353, 1254, 9659...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestCreateSubscription(t *testing.T) { t.Run("Create subscription test", func(t *testing.T) { Init(clientId) err := Create(topicName) if err != nil { t.Error(err) } err = CreateSubscription(topicName, subName) if err != nil { t.Error(err) } else { log.Println("Create subscription test is successful.") } }) }
explode_data.jsonl/4857
{ "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, 4021, 33402, 1155, 353, 8840, 836, 8, 341, 3244, 16708, 445, 4021, 15142, 1273, 497, 2915, 1155, 353, 8840, 836, 8, 341, 197, 98762, 12805, 764, 692, 197, 9859, 1669, 4230, 43839, 675, 692, 197, 743, 1848, 961, 2092, 341, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestSliceForEach(t *testing.T) { tests := []struct { name string input []int }{ { name: "case", input: newArray(100), }, { name: "case", input: newArray(123), }, { name: "case", input: newArray(1000), }, { name: "case", input: newArray(1234), }, { name: "case", input: newArray(10000), }, { name: "case", input: newArray(12345), }, { name: "nil", input: nil, }, { name: "empty", input: []int{}, }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { got := NewSlice(tt.input).ForEach(func(i int, v int) { assert.Equal(t, tt.input[i], v) }).ToSlice() assert.Equal(t, tt.input, got) got = NewSliceByComparable(tt.input).ForEach(func(i int, v int) { assert.Equal(t, tt.input[i], v) }).ToSlice() assert.Equal(t, tt.input, got) got = NewSliceByOrdered(tt.input).ForEach(func(i int, v int) { assert.Equal(t, tt.input[i], v) }).ToSlice() assert.Equal(t, tt.input, got) got = NewSliceByMapping[int, int, int](tt.input).ForEach(func(i int, v int) { assert.Equal(t, tt.input[i], v) }).ToSlice() assert.Equal(t, tt.input, got) got = NewSlice(tt.input).Parallel(10).ForEach(func(i int, v int) { assert.Equal(t, tt.input[i], v) }).ToSlice() assert.Equal(t, tt.input, got) var count int64 = 0 NewSlice(tt.input).Parallel(10).ForEach(func(i int, v int) { atomic.AddInt64(&count, 1) }) assert.Equal(t, int64(len(tt.input)), count) }) } }
explode_data.jsonl/55745
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 731 }
[ 2830, 3393, 33236, 91392, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 3056, 1235, 341, 197, 11609, 220, 914, 198, 197, 22427, 3056, 396, 198, 197, 59403, 197, 197, 515, 298, 11609, 25, 220, 330, 5638, 756, 298, 22427, 25, 62917, 7, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestGetVar(t *testing.T) { ctx := createContext(t) dec := types.NewDecFromInt(5) timeDec := types.NewTime(types.FromGoTime(time.Now()), mysql.TypeTimestamp, 0) sessionVars := []struct { key string val interface{} }{ {"a", "中"}, {"b", "文字符chuan"}, {"c", ""}, {"e", int64(3)}, {"f", float64(2.5)}, {"g", dec}, {"h", timeDec}, } for _, kv := range sessionVars { ctx.GetSessionVars().Users[kv.key] = types.NewDatum(kv.val) var tp *types.FieldType if _, ok := kv.val.(types.Time); ok { tp = types.NewFieldType(mysql.TypeDatetime) } else { tp = types.NewFieldType(mysql.TypeVarString) } types.DefaultParamTypeForValue(kv.val, tp) ctx.GetSessionVars().UserVarTypes[kv.key] = tp } testCases := []struct { args []interface{} res interface{} }{ {[]interface{}{"a"}, "中"}, {[]interface{}{"b"}, "文字符chuan"}, {[]interface{}{"c"}, ""}, {[]interface{}{"d"}, nil}, {[]interface{}{"e"}, int64(3)}, {[]interface{}{"f"}, float64(2.5)}, {[]interface{}{"g"}, dec}, {[]interface{}{"h"}, timeDec.String()}, } for _, tc := range testCases { tp, ok := ctx.GetSessionVars().UserVarTypes[tc.args[0].(string)] if !ok { tp = types.NewFieldType(mysql.TypeVarString) } fn, err := BuildGetVarFunction(ctx, datumsToConstants(types.MakeDatums(tc.args...))[0], tp) require.NoError(t, err) d, err := fn.Eval(chunk.Row{}) require.NoError(t, err) require.Equal(t, tc.res, d.GetValue()) } }
explode_data.jsonl/19012
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 663 }
[ 2830, 3393, 1949, 3962, 1155, 353, 8840, 836, 8, 341, 20985, 1669, 83674, 1155, 340, 197, 8169, 1669, 4494, 7121, 4900, 3830, 1072, 7, 20, 340, 21957, 4900, 1669, 4494, 7121, 1462, 52613, 11439, 10850, 1462, 9730, 13244, 11858, 10564, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestIpListToString(t *testing.T) { r := require.New(t) in := []string{"192.168.0.100/24", "29.254.123.20"} out := snowflake.IpListToString(in) r.Equal("('192.168.0.100/24', '29.254.123.20')", out) }
explode_data.jsonl/50827
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 98 }
[ 2830, 3393, 23378, 852, 5870, 1155, 353, 8840, 836, 8, 341, 7000, 1669, 1373, 7121, 1155, 692, 17430, 1669, 3056, 917, 4913, 16, 24, 17, 13, 16, 21, 23, 13, 15, 13, 16, 15, 15, 14, 17, 19, 497, 330, 17, 24, 13, 17, 20, 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...
1
func TestInterpretEnumCaseUse(t *testing.T) { t.Parallel() inter := parseCheckAndInterpret(t, ` enum E: Int64 { case a case b } let a = E.a let b = E.b `) a := inter.Globals["a"].GetValue() require.IsType(t, &interpreter.CompositeValue{}, a, ) assert.Equal(t, common.CompositeKindEnum, a.(*interpreter.CompositeValue).Kind, ) b := inter.Globals["b"].GetValue() require.IsType(t, &interpreter.CompositeValue{}, b, ) assert.Equal(t, common.CompositeKindEnum, b.(*interpreter.CompositeValue).Kind, ) }
explode_data.jsonl/63663
{ "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, 3306, 8043, 10766, 4207, 10253, 1155, 353, 8840, 836, 8, 1476, 3244, 41288, 7957, 2822, 58915, 1669, 4715, 3973, 3036, 3306, 8043, 1155, 11, 22074, 414, 7618, 468, 25, 1333, 21, 19, 341, 688, 1142, 264, 198, 688, 1142, 293...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestSetEntrypointAndCommand(t *testing.T) { cases := []struct { name string container *api.Container envs []kubecontainer.EnvVar expected *dockertypes.ContainerCreateConfig }{ { name: "none", container: &api.Container{}, expected: &dockertypes.ContainerCreateConfig{ Config: &dockercontainer.Config{}, }, }, { name: "command", container: &api.Container{ Command: []string{"foo", "bar"}, }, expected: &dockertypes.ContainerCreateConfig{ Config: &dockercontainer.Config{ Entrypoint: dockerstrslice.StrSlice([]string{"foo", "bar"}), }, }, }, { name: "command expanded", container: &api.Container{ Command: []string{"foo", "$(VAR_TEST)", "$(VAR_TEST2)"}, }, envs: []kubecontainer.EnvVar{ { Name: "VAR_TEST", Value: "zoo", }, { Name: "VAR_TEST2", Value: "boo", }, }, expected: &dockertypes.ContainerCreateConfig{ Config: &dockercontainer.Config{ Entrypoint: dockerstrslice.StrSlice([]string{"foo", "zoo", "boo"}), }, }, }, { name: "args", container: &api.Container{ Args: []string{"foo", "bar"}, }, expected: &dockertypes.ContainerCreateConfig{ Config: &dockercontainer.Config{ Cmd: []string{"foo", "bar"}, }, }, }, { name: "args expanded", container: &api.Container{ Args: []string{"zap", "$(VAR_TEST)", "$(VAR_TEST2)"}, }, envs: []kubecontainer.EnvVar{ { Name: "VAR_TEST", Value: "hap", }, { Name: "VAR_TEST2", Value: "trap", }, }, expected: &dockertypes.ContainerCreateConfig{ Config: &dockercontainer.Config{ Cmd: dockerstrslice.StrSlice([]string{"zap", "hap", "trap"}), }, }, }, { name: "both", container: &api.Container{ Command: []string{"foo"}, Args: []string{"bar", "baz"}, }, expected: &dockertypes.ContainerCreateConfig{ Config: &dockercontainer.Config{ Entrypoint: dockerstrslice.StrSlice([]string{"foo"}), Cmd: dockerstrslice.StrSlice([]string{"bar", "baz"}), }, }, }, { name: "both expanded", container: &api.Container{ Command: []string{"$(VAR_TEST2)--$(VAR_TEST)", "foo", "$(VAR_TEST3)"}, Args: []string{"foo", "$(VAR_TEST)", "$(VAR_TEST2)"}, }, envs: []kubecontainer.EnvVar{ { Name: "VAR_TEST", Value: "zoo", }, { Name: "VAR_TEST2", Value: "boo", }, { Name: "VAR_TEST3", Value: "roo", }, }, expected: &dockertypes.ContainerCreateConfig{ Config: &dockercontainer.Config{ Entrypoint: dockerstrslice.StrSlice([]string{"boo--zoo", "foo", "roo"}), Cmd: dockerstrslice.StrSlice([]string{"foo", "zoo", "boo"}), }, }, }, } for _, tc := range cases { opts := &kubecontainer.RunContainerOptions{ Envs: tc.envs, } actualOpts := dockertypes.ContainerCreateConfig{ Config: &dockercontainer.Config{}, } setEntrypointAndCommand(tc.container, opts, actualOpts) if e, a := tc.expected.Config.Entrypoint, actualOpts.Config.Entrypoint; !api.Semantic.DeepEqual(e, a) { t.Errorf("%v: unexpected entrypoint: expected %v, got %v", tc.name, e, a) } if e, a := tc.expected.Config.Cmd, actualOpts.Config.Cmd; !api.Semantic.DeepEqual(e, a) { t.Errorf("%v: unexpected command: expected %v, got %v", tc.name, e, a) } } }
explode_data.jsonl/31152
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1621 }
[ 2830, 3393, 1649, 52048, 1082, 781, 3036, 4062, 1155, 353, 8840, 836, 8, 341, 1444, 2264, 1669, 3056, 1235, 341, 197, 11609, 414, 914, 198, 197, 53290, 353, 2068, 33672, 198, 197, 57538, 82, 414, 3056, 97717, 3586, 81214, 3962, 198, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
4
func TestValidateDNS1035Label(t *testing.T) { validNames := []string{ "test", "test-123", } for _, name := range validNames { allErrs := validateDNS1035Label(name, field.NewPath("name")) if len(allErrs) > 0 { t.Errorf("validateDNS1035Label(%q) returned errors %v for valid input", name, allErrs) } } invalidNames := []string{ "", "123", "test.123", } for _, name := range invalidNames { allErrs := validateDNS1035Label(name, field.NewPath("name")) if len(allErrs) == 0 { t.Errorf("validateDNS1035Label(%q) returned no errors for invalid input", name) } } }
explode_data.jsonl/65827
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 246 }
[ 2830, 3393, 17926, 61088, 16, 15, 18, 20, 2476, 1155, 353, 8840, 836, 8, 341, 56322, 7980, 1669, 3056, 917, 515, 197, 197, 1, 1944, 756, 197, 197, 1, 1944, 12, 16, 17, 18, 756, 197, 630, 2023, 8358, 829, 1669, 2088, 2697, 7980, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestAllowedSyncs(t *testing.T) { vendor2AndPurpose1Consent := "CPGWbY_PGWbY_GYAAAENABCAAIAAAAAAAAAAACEAAAAA" vendorListData := MarshalVendorList(vendorList{ VendorListVersion: 2, Vendors: map[string]*vendor{ "2": { ID: 2, Purposes: []int{1}, }, }, }) perms := permissionsImpl{ cfg: config.GDPR{ HostVendorID: 2, TCF2: config.TCF2{ Purpose1: config.TCF2Purpose{ Enabled: true, EnforceVendors: true, }, }, }, vendorIDs: map[openrtb_ext.BidderName]uint16{ openrtb_ext.BidderAppnexus: 2, }, fetchVendorList: map[uint8]func(ctx context.Context, id uint16) (vendorlist.VendorList, error){ tcf2SpecVersion: listFetcher(map[uint16]vendorlist.VendorList{ 1: parseVendorListDataV2(t, vendorListData), }), }, } perms.purposeConfigs = map[consentconstants.Purpose]config.TCF2Purpose{ consentconstants.Purpose(1): perms.cfg.TCF2.Purpose1, } allowSync, err := perms.HostCookiesAllowed(context.Background(), SignalYes, vendor2AndPurpose1Consent) assertNilErr(t, err) assertBoolsEqual(t, true, allowSync) allowSync, err = perms.BidderSyncAllowed(context.Background(), openrtb_ext.BidderAppnexus, SignalYes, vendor2AndPurpose1Consent) assertNilErr(t, err) assertBoolsEqual(t, true, allowSync) }
explode_data.jsonl/31089
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 577 }
[ 2830, 3393, 35382, 12154, 82, 1155, 353, 8840, 836, 8, 341, 5195, 8029, 17, 3036, 74033, 16, 15220, 306, 1669, 330, 7123, 62565, 65, 56, 1088, 62565, 65, 56, 2646, 56, 50107, 953, 1867, 28633, 5863, 57905, 32, 5576, 25699, 32, 698, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestExists(t *testing.T) { testStr := `{ "_source": { "docid": 123, "content": "hello", "arr": [ {"obj": 1, "name": "abbot"}, {"obj": 2, "name": "costello"} ] }, "hits": 1 }` jn := FromBytes([]byte(testStr)) exists := jn.Exists("_source", "docid") if !exists { t.Error("Should exist") } exists = jn.Exists("loch", "ness", "monster") if exists { t.Error("should not exist") } }
explode_data.jsonl/10435
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 203 }
[ 2830, 3393, 15575, 1155, 353, 8840, 836, 8, 341, 18185, 2580, 1669, 1565, 515, 197, 197, 35089, 2427, 788, 341, 298, 197, 1, 5236, 307, 788, 220, 16, 17, 18, 345, 298, 197, 1, 1796, 788, 330, 14990, 756, 298, 197, 1, 1118, 788, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestParseEnv(t *testing.T) { tests := []struct { name string envArray []string expected []v1.EnvVar expectErr bool test string }{ { name: "test1", envArray: []string{ "THIS_ENV=isOK", "this.dotted.env=isOKToo", "HAS_COMMAS=foo,bar", "HAS_EQUALS=jJnro54iUu75xNy==", }, expected: []v1.EnvVar{ { Name: "THIS_ENV", Value: "isOK", }, { Name: "this.dotted.env", Value: "isOKToo", }, { Name: "HAS_COMMAS", Value: "foo,bar", }, { Name: "HAS_EQUALS", Value: "jJnro54iUu75xNy==", }, }, expectErr: false, test: "test case 1", }, { name: "test2", envArray: []string{ "WITH_OUT_EQUALS", }, expected: []v1.EnvVar{}, expectErr: true, test: "test case 2", }, { name: "test3", envArray: []string{ "WITH_OUT_VALUES=", }, expected: []v1.EnvVar{ { Name: "WITH_OUT_VALUES", Value: "", }, }, expectErr: false, test: "test case 3", }, { name: "test4", envArray: []string{ "=WITH_OUT_NAME", }, expected: []v1.EnvVar{}, expectErr: true, test: "test case 4", }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { envs, err := parseEnvs(tt.envArray) if !tt.expectErr && err != nil { t.Errorf("unexpected error: %v (%s)", err, tt.test) } if tt.expectErr && err != nil { return } if !reflect.DeepEqual(envs, tt.expected) { t.Errorf("\nexpected:\n%#v\nsaw:\n%#v (%s)", tt.expected, envs, tt.test) } }) } }
explode_data.jsonl/65720
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 918 }
[ 2830, 3393, 14463, 14359, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 3056, 1235, 341, 197, 11609, 414, 914, 198, 197, 57538, 1857, 220, 3056, 917, 198, 197, 42400, 220, 3056, 85, 16, 81214, 3962, 198, 197, 24952, 7747, 1807, 198, 197,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
6
func TestFinalizeBlockCalled(t *testing.T) { for _, testCase := range []struct { name string voteNil bool expectCalled bool }{ { name: "finalize block called when block committed", voteNil: false, expectCalled: true, }, { name: "not called when block not committed", voteNil: true, expectCalled: false, }, } { t.Run(testCase.name, func(t *testing.T) { config := configSetup(t) ctx, cancel := context.WithCancel(context.Background()) defer cancel() m := abcimocks.NewApplication(t) m.On("ProcessProposal", mock.Anything, mock.Anything).Return(&abci.ResponseProcessProposal{ Status: abci.ResponseProcessProposal_ACCEPT, }, nil) m.On("PrepareProposal", mock.Anything, mock.Anything).Return(&abci.ResponsePrepareProposal{}, nil) // We only expect VerifyVoteExtension to be called on non-nil precommits. // https://github.com/tendermint/tendermint/issues/8487 if !testCase.voteNil { m.On("ExtendVote", mock.Anything, mock.Anything).Return(&abci.ResponseExtendVote{}, nil) m.On("VerifyVoteExtension", mock.Anything, mock.Anything).Return(&abci.ResponseVerifyVoteExtension{ Status: abci.ResponseVerifyVoteExtension_ACCEPT, }, nil) } m.On("FinalizeBlock", mock.Anything, mock.Anything).Return(&abci.ResponseFinalizeBlock{}, nil).Maybe() m.On("Commit", mock.Anything).Return(&abci.ResponseCommit{}, nil).Maybe() cs1, vss := makeState(ctx, t, makeStateArgs{config: config, application: m}) height, round := cs1.Height, cs1.Round proposalCh := subscribe(ctx, t, cs1.eventBus, types.EventQueryCompleteProposal) newRoundCh := subscribe(ctx, t, cs1.eventBus, types.EventQueryNewRound) pv1, err := cs1.privValidator.GetPubKey(ctx) require.NoError(t, err) addr := pv1.Address() voteCh := subscribeToVoter(ctx, t, cs1, addr) startTestRound(ctx, cs1, cs1.Height, round) ensureNewRound(t, newRoundCh, height, round) ensureNewProposal(t, proposalCh, height, round) rs := cs1.GetRoundState() blockID := types.BlockID{} nextRound := round + 1 nextHeight := height if !testCase.voteNil { nextRound = 0 nextHeight = height + 1 blockID = types.BlockID{ Hash: rs.ProposalBlock.Hash(), PartSetHeader: rs.ProposalBlockParts.Header(), } } signAddVotes(ctx, t, cs1, tmproto.PrevoteType, config.ChainID(), blockID, vss[1:]...) ensurePrevoteMatch(t, voteCh, height, round, rs.ProposalBlock.Hash()) signAddVotes(ctx, t, cs1, tmproto.PrecommitType, config.ChainID(), blockID, vss[1:]...) ensurePrecommit(t, voteCh, height, round) ensureNewRound(t, newRoundCh, nextHeight, nextRound) m.AssertExpectations(t) if !testCase.expectCalled { m.AssertNotCalled(t, "FinalizeBlock", ctx, mock.Anything) } else { m.AssertCalled(t, "FinalizeBlock", ctx, mock.Anything) } }) } }
explode_data.jsonl/54279
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1189 }
[ 2830, 3393, 19357, 551, 4713, 20960, 1155, 353, 8840, 836, 8, 341, 2023, 8358, 54452, 1669, 2088, 3056, 1235, 341, 197, 11609, 260, 914, 198, 197, 5195, 1272, 19064, 414, 1807, 198, 197, 24952, 20960, 1807, 198, 197, 59403, 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...
4
func TestPublishWithoutEventType(t *testing.T) { payload := buildDefaultTestPayloadWithoutEventType() body, statusCode := performPublishRequest(t, publishServer.URL, payload) assertExpectedError(t, body, statusCode, http.StatusBadRequest, api.FieldEventType, api.ErrorTypeValidationViolation) }
explode_data.jsonl/74412
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 87 }
[ 2830, 3393, 50145, 26040, 47906, 1155, 353, 8840, 836, 8, 341, 76272, 1669, 1936, 3675, 2271, 29683, 26040, 47906, 741, 35402, 11, 35532, 1669, 2736, 50145, 1900, 1155, 11, 3415, 5475, 20893, 11, 7729, 340, 6948, 18896, 1454, 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
func TestThreeLeggedCatDegenerateSlowNetwork(t *testing.T) { SkipUnlessEpic(t) conf := testutil.LatencyConfig{NetworkLatency: 400 * time.Millisecond} if err := RunThreeLeggedCat(RandomBytes(1*unit.KB), conf); err != nil { t.Fatal(err) } }
explode_data.jsonl/75507
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 93 }
[ 2830, 3393, 19641, 18910, 3556, 26801, 45657, 13220, 58289, 12320, 1155, 353, 8840, 836, 8, 341, 7568, 13389, 35587, 36, 15587, 1155, 340, 67850, 1669, 1273, 1314, 1214, 266, 2251, 2648, 90, 12320, 23140, 2251, 25, 220, 19, 15, 15, 353,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestMeasurementFailure(t *testing.T) { if testing.Short() { t.Skip("skip test in short mode") } sess := newSessionForTesting(t) defer sess.Close() builder, err := sess.NewExperimentBuilder("example") if err != nil { t.Fatal(err) } if err := builder.SetOptionBool("ReturnError", true); err != nil { t.Fatal(err) } measurement, err := builder.NewExperiment().Measure("") if err == nil { t.Fatal("expected an error here") } if err.Error() != "mocked error" { t.Fatal("unexpected error type") } if measurement == nil { t.Fatal("expected non nil measurement here") } }
explode_data.jsonl/26317
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 224 }
[ 2830, 3393, 76548, 17507, 1155, 353, 8840, 836, 8, 341, 743, 7497, 55958, 368, 341, 197, 3244, 57776, 445, 20599, 1273, 304, 2805, 3856, 1138, 197, 532, 1903, 433, 1669, 501, 5283, 2461, 16451, 1155, 340, 16867, 21875, 10421, 741, 44546...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestAppVersionSetterGetter(t *testing.T) { logger := defaultLogger() pruningOpt := SetPruning(store.PruneSyncable) db := dbm.NewMemDB() name := t.Name() app := NewBaseApp(name, logger, db, nil, pruningOpt) require.Equal(t, "", app.AppVersion()) res := app.Query(abci.RequestQuery{Path: "app/version"}) require.True(t, res.IsOK()) require.Equal(t, "", string(res.Value)) versionString := "1.0.0" app.SetAppVersion(versionString) require.Equal(t, versionString, app.AppVersion()) res = app.Query(abci.RequestQuery{Path: "app/version"}) require.True(t, res.IsOK()) require.Equal(t, versionString, string(res.Value)) }
explode_data.jsonl/67043
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 245 }
[ 2830, 3393, 2164, 5637, 44294, 31485, 1155, 353, 8840, 836, 8, 341, 17060, 1669, 1638, 7395, 741, 25653, 37202, 21367, 1669, 2573, 3533, 37202, 31200, 17947, 2886, 12154, 480, 340, 20939, 1669, 2927, 76, 7121, 18816, 3506, 741, 11609, 166...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func Test_imageToSarifReport(t *testing.T) { pres := createImagePresenter(t) s, err := pres.toSarifReport() assert.NoError(t, err) assert.Len(t, s.Runs, 1) run := s.Runs[0] // Sorted by vulnID, pkg name, ... assert.Len(t, run.Tool.Driver.Rules, 2) assert.Equal(t, "CVE-1999-0001-package-1", run.Tool.Driver.Rules[0].ID) assert.Equal(t, "CVE-1999-0002-package-2", run.Tool.Driver.Rules[1].ID) assert.Len(t, run.Results, 2) result := run.Results[0] assert.Equal(t, "CVE-1999-0001-package-1", *result.RuleID) assert.Len(t, result.Locations, 1) location := result.Locations[0] assert.Equal(t, "image/etc/pkg-1", *location.PhysicalLocation.ArtifactLocation.URI) result = run.Results[1] assert.Equal(t, "CVE-1999-0002-package-2", *result.RuleID) assert.Len(t, result.Locations, 1) location = result.Locations[0] assert.Equal(t, "image/pkg-2", *location.PhysicalLocation.ArtifactLocation.URI) }
explode_data.jsonl/25491
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 374 }
[ 2830, 3393, 4954, 1249, 50, 277, 333, 10361, 1155, 353, 8840, 836, 8, 341, 3223, 416, 1669, 1855, 1906, 33849, 1155, 340, 1903, 11, 1848, 1669, 1652, 2389, 50, 277, 333, 10361, 741, 6948, 35699, 1155, 11, 1848, 692, 6948, 65819, 1155,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestOpenShiftTraitsWithWebAndDisabledTrait(t *testing.T) { env := createTestEnv(t, v1alpha1.IntegrationPlatformClusterOpenShift, "from('undertow:http').to('log:info')") env.Integration.Spec.Traits = make(map[string]v1alpha1.TraitSpec) env.Integration.Spec.Traits["service"] = v1alpha1.TraitSpec{ Configuration: map[string]string{ "enabled": "false", "port": "7071", }, } res := processTestEnv(t, env) assert.Nil(t, env.GetTrait(ID("service"))) assert.Nil(t, env.GetTrait(ID("route"))) // No route without service assert.Nil(t, res.GetService(func(svc *corev1.Service) bool { return true })) }
explode_data.jsonl/54524
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 250 }
[ 2830, 3393, 5002, 24841, 42820, 2354, 5981, 3036, 25907, 49257, 1155, 353, 8840, 836, 8, 341, 57538, 1669, 1855, 2271, 14359, 1155, 11, 348, 16, 7141, 16, 7371, 17376, 17296, 28678, 5002, 24841, 11, 330, 1499, 492, 1241, 529, 363, 69459...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_CustomTag(t *testing.T) { gtest.C(t, func(t *gtest.T) { page := gpage.New(5, 1, 2, `/user/list/{.page}`) page.PrevPageTag = "《" page.NextPageTag = "》" page.FirstPageTag = "|《" page.LastPageTag = "》|" page.PrevBarTag = "《《" page.NextBarTag = "》》" t.Assert(page.NextPage(), `<a class="GPageLink" href="/user/list/3" title="">》</a>`) t.Assert(page.PrevPage(), `<a class="GPageLink" href="/user/list/1" title="">《</a>`) t.Assert(page.FirstPage(), `<a class="GPageLink" href="/user/list/1" title="">|《</a>`) t.Assert(page.LastPage(), `<a class="GPageLink" href="/user/list/5" title="">》|</a>`) t.Assert(page.PageBar(), `<a class="GPageLink" href="/user/list/1" title="1">1</a><span class="GPageSpan">2</span><a class="GPageLink" href="/user/list/3" title="3">3</a><a class="GPageLink" href="/user/list/4" title="4">4</a><a class="GPageLink" href="/user/list/5" title="5">5</a>`) }) }
explode_data.jsonl/55796
{ "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, 57402, 5668, 1155, 353, 8840, 836, 8, 341, 3174, 1944, 727, 1155, 11, 2915, 1155, 353, 82038, 836, 8, 341, 197, 35272, 1669, 342, 2893, 7121, 7, 20, 11, 220, 16, 11, 220, 17, 11, 37301, 872, 20936, 9388, 13, 2893, 2708...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestMakeDataSource(t *testing.T) { assert.Equal(t, "package:module/getSomething:getSomething", MakeDataSource("package", "module", "getSomething").String()) assert.Equal(t, "package:module/getSomething:GetSomething", MakeDataSource("package", "module", "GetSomething").String()) }
explode_data.jsonl/25440
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 85 }
[ 2830, 3393, 8078, 17173, 1155, 353, 8840, 836, 8, 341, 6948, 12808, 1155, 11, 330, 1722, 25, 4352, 23302, 23087, 24907, 23087, 497, 7405, 17173, 445, 1722, 497, 330, 4352, 497, 330, 455, 23087, 1827, 703, 2398, 6948, 12808, 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 TestPointBls12377G2Double(t *testing.T) { bls12377G2 := BLS12377G2() g := bls12377G2.Point.Generator() gg2 := g.Double() require.True(t, gg2.Equal(g.Mul(bls12377G2.Scalar.New(2)))) i := bls12377G2.Point.Identity() require.True(t, i.Double().Equal(i)) }
explode_data.jsonl/15767
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 129 }
[ 2830, 3393, 2609, 33, 4730, 16, 17, 18, 22, 22, 38, 17, 7378, 1155, 353, 8840, 836, 8, 341, 96421, 82, 16, 17, 18, 22, 22, 38, 17, 1669, 425, 7268, 16, 17, 18, 22, 22, 38, 17, 741, 3174, 1669, 1501, 82, 16, 17, 18, 22, 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 TestGroupUint8(t *testing.T) { v := &Value{data: []uint8{uint8(1), uint8(1), uint8(1), uint8(1), uint8(1), uint8(1)}} grouped := v.GroupUint8(func(i int, val uint8) string { return fmt.Sprintf("%v", i%2 == 0) }).data.(map[string][]uint8) assert.Equal(t, 2, len(grouped)) assert.Equal(t, 3, len(grouped["true"])) assert.Equal(t, 3, len(grouped["false"])) }
explode_data.jsonl/23469
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 170 }
[ 2830, 3393, 2808, 21570, 23, 1155, 353, 8840, 836, 8, 1476, 5195, 1669, 609, 1130, 90, 691, 25, 3056, 2496, 23, 90, 2496, 23, 7, 16, 701, 2622, 23, 7, 16, 701, 2622, 23, 7, 16, 701, 2622, 23, 7, 16, 701, 2622, 23, 7, 16, 701...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestInterpreterComprehensions(t *testing.T) { s, err := parseFile("src/parse/asp/test_data/interpreter/comprehensions.build") require.NoError(t, err) assert.EqualValues(t, pyList{pyString("file1"), pyString("file2")}, s.Lookup("file_srcs")) assert.EqualValues(t, pyList{pyString("file1+file1"), pyString("file1+file2"), pyString("file1+:rule1"), pyString("file2+file1"), pyString("file2+file2"), pyString("file2+:rule1")}, s.Lookup("pairs")) }
explode_data.jsonl/81063
{ "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, 58426, 1092, 30782, 4664, 1155, 353, 8840, 836, 8, 341, 1903, 11, 1848, 1669, 4715, 1703, 445, 3548, 14, 6400, 14, 13367, 12697, 1769, 14, 90554, 25093, 30782, 4664, 13239, 1138, 17957, 35699, 1155, 11, 1848, 340, 6948, 1280...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestCreateRoute(t *testing.T) { fakeTable := newFakeRouteTablesClient() fakeVM := &fakeVMSet{} fakeRoutes := newFakeRoutesClient() cloud := &Cloud{ RouteTablesClient: fakeTable, RoutesClient: fakeRoutes, vmSet: fakeVM, Config: Config{ RouteTableResourceGroup: "foo", RouteTableName: "bar", Location: "location", }, unmanagedNodes: sets.NewString(), nodeInformerSynced: func() bool { return true }, } cache, _ := cloud.newRouteTableCache() cloud.rtCache = cache expectedTable := network.RouteTable{ Name: &cloud.RouteTableName, Location: &cloud.Location, } fakeTable.FakeStore = map[string]map[string]network.RouteTable{} fakeTable.FakeStore[cloud.RouteTableResourceGroup] = map[string]network.RouteTable{ cloud.RouteTableName: expectedTable, } route := cloudprovider.Route{TargetNode: "node", DestinationCIDR: "1.2.3.4/24"} nodeIP := "2.4.6.8" fakeVM.NodeToIP = map[string]string{ "node": nodeIP, } err := cloud.CreateRoute(context.TODO(), "cluster", "unused", &route) if err != nil { t.Errorf("unexpected error create if not exists route table: %v", err) t.FailNow() } if len(fakeTable.Calls) != 1 || fakeTable.Calls[0] != "Get" { t.Errorf("unexpected calls create if not exists, exists: %v", fakeTable.Calls) } routeName := mapNodeNameToRouteName(route.TargetNode, string(route.DestinationCIDR)) routeInfo, found := fakeRoutes.FakeStore[cloud.RouteTableName][routeName] if !found { t.Errorf("could not find route: %v in %v", routeName, fakeRoutes.FakeStore) t.FailNow() } if *routeInfo.AddressPrefix != route.DestinationCIDR { t.Errorf("Expected cidr: %s, saw %s", *routeInfo.AddressPrefix, route.DestinationCIDR) } if routeInfo.NextHopType != network.RouteNextHopTypeVirtualAppliance { t.Errorf("Expected next hop: %v, saw %v", network.RouteNextHopTypeVirtualAppliance, routeInfo.NextHopType) } if *routeInfo.NextHopIPAddress != nodeIP { t.Errorf("Expected IP address: %s, saw %s", nodeIP, *routeInfo.NextHopIPAddress) } // test create route for unmanaged nodes. nodeName := "node1" nodeCIDR := "4.3.2.1/24" cloud.unmanagedNodes.Insert(nodeName) cloud.routeCIDRs = map[string]string{} route1 := cloudprovider.Route{ TargetNode: mapRouteNameToNodeName(nodeName), DestinationCIDR: nodeCIDR, } err = cloud.CreateRoute(context.TODO(), "cluster", "unused", &route1) if err != nil { t.Errorf("unexpected error creating route: %v", err) t.FailNow() } cidr, found := cloud.routeCIDRs[nodeName] if !found { t.Errorf("unexpected missing item for %s", nodeName) t.FailNow() } if cidr != nodeCIDR { t.Errorf("unexpected cidr %s, saw %s", nodeCIDR, cidr) } }
explode_data.jsonl/70930
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1079 }
[ 2830, 3393, 4021, 4899, 1155, 353, 8840, 836, 8, 341, 1166, 726, 2556, 1669, 501, 52317, 4899, 21670, 2959, 741, 1166, 726, 11187, 1669, 609, 30570, 11187, 1649, 16094, 1166, 726, 26653, 1669, 501, 52317, 26653, 2959, 2822, 197, 12361, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestUnitCreateJSONFailure(t *testing.T) { var headers httpbinheaders client := newClient() client.BaseURL = "\t\t\t\t" err := client.PostJSON(context.Background(), "/headers", &headers, &headers) if err == nil || !strings.HasSuffix(err.Error(), "invalid control character in URL") { t.Fatal("not the error we expected") } }
explode_data.jsonl/60976
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 113 }
[ 2830, 3393, 4562, 4021, 5370, 17507, 1155, 353, 8840, 836, 8, 341, 2405, 7102, 1758, 6863, 7713, 198, 25291, 1669, 501, 2959, 741, 25291, 13018, 3144, 284, 2917, 83, 4955, 4955, 4955, 698, 9859, 1669, 2943, 23442, 5370, 5378, 19047, 150...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestJobLeaseExpiry(t *testing.T) { withRepository(func(r *RedisJobRepository) { job := addLeasedJob(t, r, "queue1", "cluster1") deadline := time.Now() addLeasedJob(t, r, "queue1", "cluster1") _, e := r.ExpireLeases("queue1", deadline) assert.Nil(t, e) queued, e := r.PeekQueue("queue1", 10) assert.Nil(t, e) assert.Equal(t, 1, len(queued), "Queue should have one job which expired") assert.Equal(t, job.Id, queued[0].Id) }) }
explode_data.jsonl/32038
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 201 }
[ 2830, 3393, 12245, 2304, 519, 840, 48209, 1155, 353, 8840, 836, 8, 341, 46948, 4624, 18552, 2601, 353, 48137, 12245, 4624, 8, 341, 197, 68577, 1669, 912, 2304, 1475, 12245, 1155, 11, 435, 11, 330, 4584, 16, 497, 330, 18855, 16, 1138, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestDogeDecodeToString(t *testing.T) { script1 := "76a9144620b70031f0e9437e374a2100934fba4911046088ac" script2 := "a914f8f5d99a9fc21aa676e74d15e7b8134557615bda87" tests := []TestcaseDecode{ { name: "P2PKH", input: script1, output: "DBXu2kgc3xtvCUWFcxFE3r9hEYgmuaaCyD", }, { name: "P2SH", input: script2, output: "AF8ekvSf6eiSBRspJjnfzK6d1EM6pnPq3G", }, } RunTestsDecode(t, slip44.DOGECOIN, tests) }
explode_data.jsonl/9949
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 252 }
[ 2830, 3393, 35, 40532, 32564, 5870, 1155, 353, 8840, 836, 8, 341, 86956, 16, 1669, 330, 22, 21, 64, 24, 16, 19, 19, 21, 17, 15, 65, 22, 15, 15, 18, 16, 69, 15, 68, 24, 19, 18, 22, 68, 18, 22, 19, 64, 17, 16, 15, 15, 24, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestFixHTTP(t *testing.T) { client := &Client{ HorizonURL: "https://localhost/", } // No HTTP client is provided assert.Nil(t, client.HTTP, "client HTTP is nil") client.Root() // When a request is made, default HTTP client is set assert.IsType(t, client.HTTP, &http.Client{}) }
explode_data.jsonl/82465
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 103 }
[ 2830, 3393, 25958, 9230, 1155, 353, 8840, 836, 8, 341, 25291, 1669, 609, 2959, 515, 197, 13292, 269, 16973, 3144, 25, 330, 2428, 1110, 8301, 35075, 197, 532, 197, 322, 2308, 10130, 2943, 374, 3897, 198, 6948, 59678, 1155, 11, 2943, 27...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestPkiService_DeleteCertificate(t *testing.T) { mc := InitMockEnvironment(t) defer mc.Close() certId := "12345678" ps, err := NewPKIService(mc.conf) assert.NoError(t, err) mc.pki.EXPECT().DeleteClientCert(certId).Return(nil).Times(1) err = ps.DeleteClientCertificate(certId) assert.NoError(t, err) mc.pki.EXPECT().DeleteServerCert(certId).Return(nil).Times(1) err = ps.DeleteServerCertificate(certId) assert.NoError(t, err) }
explode_data.jsonl/67000
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 175 }
[ 2830, 3393, 47, 6642, 1860, 57418, 33202, 1155, 353, 8840, 836, 8, 341, 97662, 1669, 15690, 11571, 12723, 1155, 340, 16867, 19223, 10421, 2822, 1444, 529, 764, 1669, 330, 16, 17, 18, 19, 20, 21, 22, 23, 1837, 35009, 11, 1848, 1669, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestLoadConfig_IncompleteConfig_ShouldError(t *testing.T) { // Arrange testConfig := ` { "ServiceDescription" : { "DisplayName" : "My Service", "Description" : "My Service Desc" }, "ServiceConfig" : { "StopFile" : ".stop", "ReloadFile" : ".reload", "LogFile" : "${ServiceName}.log", "PidFile" : "${ServiceName}.pid" }, "Services" : [ { "Path" : "test/path/1", "Args" : ["arg1", "arg2"], "GracefulShutdownTimeoutSecs" : 12, "MaxCrashCountPerHour" : 999, "RestartDelaySecs" : 1, "MonitorPing" : { "URL" : "http://localhost:80/login", "IntervalSecs" : 30, "TimeoutSecs" : 10, "RestartOnFailureCount" : 3 } }, { "Path" : "test/path/2" } ] }` tmpFile := writeTestConfig(t, testConfig) defer os.Remove(tmpFile) // Act c, err := config.LoadConfig(tmpFile, config.ReplacementVars{}) // Assert if err != nil { t.Errorf("Error loading config: %v", err) } if len(c.Commands) != 0 { t.Error("Expected zero commands") } }
explode_data.jsonl/53031
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 729 }
[ 2830, 3393, 5879, 2648, 25972, 14737, 2648, 36578, 616, 1454, 1155, 353, 8840, 836, 8, 341, 197, 322, 40580, 198, 18185, 2648, 1669, 22074, 262, 341, 286, 330, 1860, 5009, 1, 549, 341, 310, 330, 26456, 1, 549, 330, 5050, 5362, 756, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestExecStatementCacheModes(t *testing.T) { t.Parallel() config := mustParseConfig(t, os.Getenv("PGX_TEST_DATABASE")) tests := []struct { name string buildStatementCache pgx.BuildStatementCacheFunc }{ { name: "disabled", buildStatementCache: nil, }, { name: "prepare", buildStatementCache: func(conn *pgconn.PgConn) stmtcache.Cache { return stmtcache.New(conn, stmtcache.ModePrepare, 32) }, }, { name: "describe", buildStatementCache: func(conn *pgconn.PgConn) stmtcache.Cache { return stmtcache.New(conn, stmtcache.ModeDescribe, 32) }, }, } for _, tt := range tests { func() { config.BuildStatementCache = tt.buildStatementCache conn := mustConnect(t, config) defer closeConn(t, conn) commandTag, err := conn.Exec(context.Background(), "select 1") assert.NoError(t, err, tt.name) assert.Equal(t, "SELECT 1", string(commandTag), tt.name) commandTag, err = conn.Exec(context.Background(), "select 1 union all select 1") assert.NoError(t, err, tt.name) assert.Equal(t, "SELECT 2", string(commandTag), tt.name) commandTag, err = conn.Exec(context.Background(), "select 1") assert.NoError(t, err, tt.name) assert.Equal(t, "SELECT 1", string(commandTag), tt.name) ensureConnValid(t, conn) }() } }
explode_data.jsonl/40011
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 558 }
[ 2830, 3393, 10216, 8636, 8233, 70035, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 2822, 25873, 1669, 1969, 14463, 2648, 1155, 11, 2643, 64883, 445, 11383, 55, 11641, 45510, 28075, 78216, 1669, 3056, 1235, 341, 197, 11609, 394, 914, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestAccDataSourceGoogleGlobalForwardingRule(t *testing.T) { t.Parallel() poolName := fmt.Sprintf("tf-%s", randString(t, 10)) ruleName := fmt.Sprintf("tf-%s", randString(t, 10)) vcrTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccDataSourceGoogleGlobalForwardingRuleConfig(poolName, ruleName), Check: checkDataSourceStateMatchesResourceStateWithIgnores("data.google_compute_global_forwarding_rule.my_forwarding_rule", "google_compute_global_forwarding_rule.foobar-fr", map[string]struct{}{"port_range": {}, "target": {}}), }, }, }) }
explode_data.jsonl/53527
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 245 }
[ 2830, 3393, 14603, 17173, 14444, 11646, 25925, 287, 11337, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 2822, 85273, 675, 1669, 8879, 17305, 445, 8935, 11069, 82, 497, 10382, 703, 1155, 11, 220, 16, 15, 1171, 7000, 1111, 675, 1669, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestExclusionAndPriority(t *testing.T) { newPeer := func(i int) *Peer { si := stateInfoWithHeight(uint64(i)) am, _ := aliveMessage(i).ToGossipMessage() return &Peer{ StateInfoMessage: si, AliveMessage: am, } } excludeFirst := selectionFunc(func(p Peer) bool { return p.AliveMessage.GetAliveMsg().Timestamp.SeqNum == uint64(1) }) givenPeers := Endorsers{newPeer(3), newPeer(5), newPeer(1), newPeer(4), newPeer(2), newPeer(3)} assert.Equal(t, []int{5, 4, 3, 3, 2}, heights(givenPeers.Filter(excludeFirst).Sort(PrioritiesByHeight))) }
explode_data.jsonl/38943
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 237 }
[ 2830, 3393, 840, 8957, 3036, 20555, 1155, 353, 8840, 836, 8, 341, 8638, 30888, 1669, 2915, 1956, 526, 8, 353, 30888, 341, 197, 1903, 72, 1669, 1584, 1731, 2354, 3640, 8488, 21, 19, 1956, 1171, 197, 197, 309, 11, 716, 1669, 13675, 20...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestCaptureStdoutAndStderr(t *testing.T) { stdout, stderr, err := CaptureStdoutAndStderr(func(stdoutWriter, stderrWriter io.Writer) error { fmt.Fprint(os.Stdout, "Hello") fmt.Fprint(os.Stderr, "World") return nil }) AssertEqual(t, stdout, "Hello") AssertEqual(t, stderr, "World") AssertNoError(t, err) }
explode_data.jsonl/32023
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 142 }
[ 2830, 3393, 27429, 22748, 411, 3036, 22748, 615, 1155, 353, 8840, 836, 8, 341, 6736, 411, 11, 26436, 11, 1848, 1669, 39885, 22748, 411, 3036, 22748, 615, 18552, 29376, 6492, 11, 26436, 6492, 6399, 47838, 8, 1465, 341, 197, 11009, 991, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestFileAccessLog(t *testing.T) { tests := map[string]struct { path string want []*envoy_accesslog.AccessLog }{ "stdout": { path: "/dev/stdout", want: []*envoy_accesslog.AccessLog{{ Name: wellknown.FileAccessLog, ConfigType: &envoy_accesslog.AccessLog_TypedConfig{ TypedConfig: toAny(&accesslog_v2.FileAccessLog{ Path: "/dev/stdout", }), }, }}, }, } for name, tc := range tests { t.Run(name, func(t *testing.T) { got := FileAccessLogEnvoy(tc.path) assert.Equal(t, tc.want, got) }) } }
explode_data.jsonl/58463
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 253 }
[ 2830, 3393, 1703, 6054, 2201, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 2415, 14032, 60, 1235, 341, 197, 26781, 914, 198, 197, 50780, 29838, 3160, 2253, 12759, 839, 35645, 2201, 198, 197, 59403, 197, 197, 1, 36358, 788, 341, 298, 267...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestSend(t *testing.T) { input := CreateTestInput(t) t.Run("store Ctx block hash", func(t *testing.T) { ctx := input.Ctx cvmk := input.CvmKeeper acc := input.AccountKeeper.GetAccount(ctx, Addrs[0]) coins := acc.GetCoins() require.Greater(t, coins.AmountOf("uctk").Int64(), int64(9999)) err := cvmk.Send(ctx, Addrs[0], Addrs[1], sdk.Coins{sdk.NewInt64Coin("uctk", 100000)}) require.NotNil(t, err) err = cvmk.Send(ctx, Addrs[0], Addrs[1], sdk.Coins{sdk.NewInt64Coin("uatk", 100000)}) require.NotNil(t, err) err = cvmk.Send(ctx, Addrs[0], Addrs[1], sdk.Coins{sdk.NewInt64Coin("uctk", 10)}) require.Nil(t, err) }) }
explode_data.jsonl/14839
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 297 }
[ 2830, 3393, 11505, 1155, 353, 8840, 836, 8, 341, 22427, 1669, 4230, 2271, 2505, 1155, 340, 3244, 16708, 445, 4314, 356, 3998, 2504, 5175, 497, 2915, 1155, 353, 8840, 836, 8, 341, 197, 20985, 1669, 1946, 727, 3998, 198, 197, 1444, 7338...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestRESTClientQpsEmptyMetrics(t *testing.T) { tc := restClientTestCase{ metricName: "qps", desiredError: fmt.Errorf("no metrics returned from custom metrics API"), reportedMetricPoints: []metricPoint{}, } tc.runTest(t) }
explode_data.jsonl/64904
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 104 }
[ 2830, 3393, 38307, 2959, 48, 1690, 3522, 27328, 1155, 353, 8840, 836, 8, 341, 78255, 1669, 2732, 2959, 16458, 515, 197, 2109, 16340, 675, 25, 1843, 330, 80, 1690, 756, 197, 52912, 2690, 1454, 25, 260, 8879, 13080, 445, 2152, 16734, 59...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestNoAuthorityKeyIdInSelfSignedCert(t *testing.T) { template := &Certificate{ SerialNumber: big.NewInt(1), Subject: pkix.Name{ CommonName: "Σ Acme Co", }, NotBefore: time.Unix(1000, 0), NotAfter: time.Unix(100000, 0), BasicConstraintsValid: true, IsCA: true, SubjectKeyId: []byte{1, 2, 3, 4}, } if cert := serialiseAndParse(t, template); len(cert.AuthorityKeyId) != 0 { t.Fatalf("self-signed certificate contained default authority key id") } template.AuthorityKeyId = []byte{1, 2, 3, 4} if cert := serialiseAndParse(t, template); len(cert.AuthorityKeyId) == 0 { t.Fatalf("self-signed certificate erased explicit authority key id") } }
explode_data.jsonl/68006
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 284 }
[ 2830, 3393, 2753, 45532, 81343, 641, 12092, 49312, 36934, 1155, 353, 8840, 836, 8, 341, 22832, 1669, 609, 33202, 515, 197, 93658, 2833, 25, 2409, 7121, 1072, 7, 16, 1326, 197, 197, 13019, 25, 22458, 941, 2967, 515, 298, 90580, 675, 25...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestCopyInfoDestinationPathSymlink(t *testing.T) { tmpDir, _ := getTestTempDirs(t) defer removeAllPaths(tmpDir) root := strings.TrimRight(tmpDir, "/") + "/" type FileTestData struct { resource FileData file string expected CopyInfo } testData := []FileTestData{ //Create a directory: /tmp/archive-copy-test*/dir1 //Test will "copy" file1 to dir1 {resource: FileData{filetype: Dir, path: "dir1", permissions: 0740}, file: "file1", expected: CopyInfo{Path: root + "dir1/file1", Exists: false, IsDir: false}}, //Create a symlink directory to dir1: /tmp/archive-copy-test*/dirSymlink -> dir1 //Test will "copy" file2 to dirSymlink {resource: FileData{filetype: Symlink, path: "dirSymlink", contents: root + "dir1", permissions: 0600}, file: "file2", expected: CopyInfo{Path: root + "dirSymlink/file2", Exists: false, IsDir: false}}, //Create a file in tmp directory: /tmp/archive-copy-test*/file1 //Test to cover when the full file path already exists. {resource: FileData{filetype: Regular, path: "file1", permissions: 0600}, file: "", expected: CopyInfo{Path: root + "file1", Exists: true}}, //Create a directory: /tmp/archive-copy*/dir2 //Test to cover when the full directory path already exists {resource: FileData{filetype: Dir, path: "dir2", permissions: 0740}, file: "", expected: CopyInfo{Path: root + "dir2", Exists: true, IsDir: true}}, //Create a symlink to a non-existent target: /tmp/archive-copy*/symlink1 -> noSuchTarget //Negative test to cover symlinking to a target that does not exit {resource: FileData{filetype: Symlink, path: "symlink1", contents: "noSuchTarget", permissions: 0600}, file: "", expected: CopyInfo{Path: root + "noSuchTarget", Exists: false}}, //Create a file in tmp directory for next test: /tmp/existingfile {resource: FileData{filetype: Regular, path: "existingfile", permissions: 0600}, file: "", expected: CopyInfo{Path: root + "existingfile", Exists: true}}, //Create a symlink to an existing file: /tmp/archive-copy*/symlink2 -> /tmp/existingfile //Test to cover when the parent directory of a new file is a symlink {resource: FileData{filetype: Symlink, path: "symlink2", contents: "existingfile", permissions: 0600}, file: "", expected: CopyInfo{Path: root + "existingfile", Exists: true}}, } var dirs []FileData for _, data := range testData { dirs = append(dirs, data.resource) } provisionSampleDir(t, tmpDir, dirs) for _, info := range testData { p := filepath.Join(tmpDir, info.resource.path, info.file) ci, err := CopyInfoDestinationPath(p) assert.Check(t, err) assert.Check(t, is.DeepEqual(info.expected, ci)) } }
explode_data.jsonl/81932
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 911 }
[ 2830, 3393, 12106, 1731, 33605, 1820, 34667, 44243, 1155, 353, 8840, 836, 8, 341, 20082, 6184, 11, 716, 1669, 633, 2271, 12151, 97384, 1155, 340, 16867, 65099, 26901, 10368, 6184, 692, 33698, 1669, 9069, 18815, 5979, 10368, 6184, 11, 3521...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestWriteNand(t *testing.T) { want := `package gepModel func gepModel(d []bool) bool { y := false y = (((!(d[0] && d[1])) && (d[0] || d[1])) || (!(d[1] && d[1]))) return y } ` g1 := gene.New("Or.And.Not.Not.Or.And.And.d0.d1.d1.d1.d0.d1.d1.d0", functions.Bool) gn := New([]*gene.Gene{g1}, "Or") grammar, err := grammars.LoadGoBooleanAllGatesGrammar() if err != nil { t.Fatalf("unable to LoadGoBooleanAllGatesGrammar(): %v", err) } b := new(bytes.Buffer) gn.Write(b, grammar) if b.String() != want { t.Errorf("gen.Write() got %v, want %v", b.String(), want) } }
explode_data.jsonl/18596
{ "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, 7985, 45, 437, 1155, 353, 8840, 836, 8, 341, 50780, 1669, 1565, 1722, 82942, 1712, 271, 2830, 82942, 1712, 1500, 3056, 2641, 8, 1807, 341, 14522, 1669, 895, 271, 14522, 284, 11600, 10297, 67, 58, 15, 60, 1009, 294, 58, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestParallel(t *testing.T) { numLayers := 10 cacheStore, client, parentPath, err := setup(t) if !assert.NoError(t, err) { return } vsStore := cacheStore.DataStore.(*ImageStore) defer cleanup(t, client, vsStore, parentPath) op := trace.NewOperation(context.Background(), "test") storeURL, err := cacheStore.CreateImageStore(op, "testStore") if !assert.NoError(t, err) { return } // base this image off scratch parent, err := cacheStore.GetImage(op, storeURL, portlayer.Scratch.ID) if !assert.NoError(t, err) { return } wg := sync.WaitGroup{} wg.Add(numLayers) for i := 0; i < numLayers; i++ { go func(idx int) { defer wg.Done() imageID := fmt.Sprintf("testStore-%d", idx) op := trace.NewOperation(context.Background(), imageID) // Write the image via the cache (which writes to the vsphere impl). We're passing a bogus sum so the image should fail to save. writtenImage, err := cacheStore.WriteImage(op, parent, imageID, nil, "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", new(bytes.Buffer)) if !assert.NoError(t, err) || !assert.NotNil(t, writtenImage) { t.FailNow() return } }(i) } wg.Wait() }
explode_data.jsonl/32485
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 475 }
[ 2830, 3393, 16547, 1155, 353, 8840, 836, 8, 341, 22431, 40235, 1669, 220, 16, 15, 271, 52680, 6093, 11, 2943, 11, 2681, 1820, 11, 1848, 1669, 6505, 1155, 340, 743, 753, 2207, 35699, 1155, 11, 1848, 8, 341, 197, 853, 198, 197, 630, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestHostnameDefaultsToMachineName(t *testing.T) { d, err := getTestDriver() if assert.NoError(t, err) { assert.Equal(t, machineTestName, d.deviceConfig.Hostname) } }
explode_data.jsonl/37428
{ "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, 88839, 16273, 1249, 21605, 675, 1155, 353, 8840, 836, 8, 341, 2698, 11, 1848, 1669, 633, 2271, 11349, 741, 743, 2060, 35699, 1155, 11, 1848, 8, 341, 197, 6948, 12808, 1155, 11, 5662, 2271, 675, 11, 294, 18355, 2648, 29840,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestIntegrationConfig_GetWebhookServerAddress(t *testing.T) { configs.CurrentExternalHostName = "test.host.com" ic := &IntegrationConfig{ ObjectMeta: metav1.ObjectMeta{ Name: "test-ic", Namespace: "test-ns", }, } require.Equal(t, "http://test.host.com/webhook/test-ns/test-ic", ic.GetWebhookServerAddress()) }
explode_data.jsonl/46138
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 132 }
[ 2830, 3393, 52464, 2648, 13614, 5981, 20873, 5475, 4286, 1155, 353, 8840, 836, 8, 341, 25873, 82, 11517, 25913, 85305, 284, 330, 1944, 17840, 905, 698, 197, 292, 1669, 609, 52464, 2648, 515, 197, 23816, 12175, 25, 77520, 16, 80222, 515,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestAllocIPAddress(t *testing.T) { ctrl, _, mockEC2 := setup(t) defer ctrl.Finish() testIP := ec2.AssignPrivateIpAddressesOutput{} mockEC2.EXPECT().AssignPrivateIpAddresses(gomock.Any()).Return(&testIP, nil) ins := &EC2InstanceMetadataCache{ec2SVC: mockEC2} err := ins.AllocIPAddress("eni-id") assert.NoError(t, err) }
explode_data.jsonl/19298
{ "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, 25154, 87976, 1155, 353, 8840, 836, 8, 341, 84381, 11, 8358, 7860, 7498, 17, 1669, 6505, 1155, 340, 16867, 23743, 991, 18176, 2822, 18185, 3298, 1669, 11942, 17, 86971, 16787, 23378, 52290, 5097, 16094, 77333, 7498, 17, 22402,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestNodeToMemberBad(t *testing.T) { tests := []*store.NodeExtern{ {Key: "/1234", Nodes: []*store.NodeExtern{ {Key: "/1234/strange"}, }}, {Key: "/1234", Nodes: []*store.NodeExtern{ {Key: "/1234/raftAttributes", Value: stringp("garbage")}, }}, {Key: "/1234", Nodes: []*store.NodeExtern{ {Key: "/1234/attributes", Value: stringp(`{"name":"node1","clientURLs":null}`)}, }}, {Key: "/1234", Nodes: []*store.NodeExtern{ {Key: "/1234/raftAttributes", Value: stringp(`{"peerURLs":null}`)}, {Key: "/1234/strange"}, }}, {Key: "/1234", Nodes: []*store.NodeExtern{ {Key: "/1234/raftAttributes", Value: stringp(`{"peerURLs":null}`)}, {Key: "/1234/attributes", Value: stringp("garbage")}, }}, {Key: "/1234", Nodes: []*store.NodeExtern{ {Key: "/1234/raftAttributes", Value: stringp(`{"peerURLs":null}`)}, {Key: "/1234/attributes", Value: stringp(`{"name":"node1","clientURLs":null}`)}, {Key: "/1234/strange"}, }}, } for i, tt := range tests { if _, err := nodeToMember(tt); err == nil { t.Errorf("#%d: unexpected nil error", i) } } }
explode_data.jsonl/52338
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 490 }
[ 2830, 3393, 1955, 1249, 9366, 17082, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 29838, 4314, 21714, 84210, 515, 197, 197, 90, 1592, 25, 3521, 16, 17, 18, 19, 497, 52501, 25, 29838, 4314, 21714, 84210, 515, 298, 197, 90, 1592, 25, 35...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestValidateParams(t *testing.T) { tests := []struct { testCase string Params expectPass bool }{ { "Minimum value", Params{ IssuePrice: sdk.NewCoin(types.BondDenom, sdk.ZeroInt()), }, true, }, { "Maximum value", Params{ IssuePrice: sdk.NewCoin(types.BondDenom, sdk.NewInt(math.MaxInt64)), }, true, }, { "IssuePrice is negative", Params{ IssuePrice: sdk.Coin{Denom: types.BondDenom, Amount: sdk.NewInt(-1)}, }, false, }, } for _, tc := range tests { if tc.expectPass { require.Nil(t, ValidateParams(tc.Params), "test: %v", tc.testCase) } else { require.NotNil(t, ValidateParams(tc.Params), "test: %v", tc.testCase) } } }
explode_data.jsonl/15694
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 338 }
[ 2830, 3393, 17926, 4870, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 3056, 1235, 341, 197, 18185, 4207, 914, 198, 197, 197, 4870, 198, 197, 24952, 12187, 1807, 198, 197, 59403, 197, 197, 515, 298, 197, 1, 28695, 897, 756, 298, 197, 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...
3
func TestAccAlicloudSlb_importVpc(t *testing.T) { resourceName := "alicloud_slb.vpc" resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, CheckDestroy: testAccCheckInstanceDestroy, Steps: []resource.TestStep{ resource.TestStep{ Config: testAccSlb4Vpc, }, resource.TestStep{ ResourceName: resourceName, ImportState: true, ImportStateVerify: true, }, }, }) }
explode_data.jsonl/11121
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 206 }
[ 2830, 3393, 14603, 32, 415, 52178, 7442, 65, 18434, 53, 3992, 1155, 353, 8840, 836, 8, 341, 50346, 675, 1669, 330, 31513, 52178, 11886, 65, 3133, 3992, 1837, 50346, 8787, 1155, 11, 5101, 31363, 515, 197, 197, 4703, 3973, 25, 257, 2915...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestSampleToModelAsJson(t *testing.T) { testJsonFromStruct(t, sample{items: []item{}}, `{ "swagger.item": { "id": "swagger.item", "required": [ "name" ], "properties": { "name": { "type": "string", "description": "", "format": "" } } }, "swagger.sample": { "id": "swagger.sample", "required": [ "id", "items", "root" ], "properties": { "id": { "type": "string", "description": "", "format": "" }, "items": { "type": "array", "description": "", "items": { "$ref": "swagger.item" }, "format": "" }, "root": { "type": "swagger.item", "description": "", "format": "" } } } }`) }
explode_data.jsonl/39923
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 368 }
[ 2830, 3393, 17571, 1249, 1712, 2121, 5014, 1155, 353, 8840, 836, 8, 341, 18185, 5014, 3830, 9422, 1155, 11, 6077, 90, 3615, 25, 3056, 1203, 6257, 2137, 1565, 515, 220, 330, 74755, 8984, 788, 341, 256, 330, 307, 788, 330, 74755, 8984, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestExpandVar(t *testing.T) { for _, tt := range []struct { in string out string }{ {"$0", "foo"}, {"${0}", "foo"}, {"${1:bar}", "bar"}, } { t.Run(tt.in, func(t *testing.T) { v := expandVar(tt.in, []string{"foo"}) if v != tt.out { t.Errorf("got %q, want %q", v, tt.out) } }) } }
explode_data.jsonl/40128
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 167 }
[ 2830, 3393, 38946, 3962, 1155, 353, 8840, 836, 8, 341, 2023, 8358, 17853, 1669, 2088, 3056, 1235, 341, 197, 17430, 220, 914, 198, 197, 13967, 914, 198, 197, 59403, 197, 197, 4913, 3, 15, 497, 330, 7975, 7115, 197, 197, 4913, 2365, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestShouldRegisterBoletoSantander(t *testing.T) { param := app.NewParams() param.DevMode = true param.DisableLog = true param.MockMode = true go app.Run(param) Convey("Deve-se registrar um boleto no Santander", t, func() { response, st, err := util.Post("http://localhost:3000/v1/boleto/register", getBody(models.Santander, 200), nil) So(err, ShouldEqual, nil) So(st, ShouldEqual, 200) boleto := models.BoletoResponse{} errJSON := json.Unmarshal([]byte(response), &boleto) So(errJSON, ShouldEqual, nil) Convey("Se o boleto foi registrado então ele tem que está disponível no formato HTML", func() { So(len(boleto.Links), ShouldBeGreaterThan, 0) html, st, err := util.Get(boleto.Links[0].Href, "", nil) So(err, ShouldEqual, nil) So(st, ShouldEqual, 200) htmlFromBoleto := strings.Contains(html, boleto.DigitableLine) So(htmlFromBoleto, ShouldBeTrue) }) }) Convey("Deve-se retornar uma falha ao registrar boleto no Santander", t, func() { response, st, err := util.Post("http://localhost:3000/v1/boleto/register", getBody(models.Santander, 3), nil) So(err, ShouldEqual, nil) So(st, ShouldEqual, 400) boleto := models.BoletoResponse{} errJSON := json.Unmarshal([]byte(response), &boleto) So(errJSON, ShouldEqual, nil) So(len(boleto.Errors), ShouldBeGreaterThan, 0) }) Convey("Deve-se retornar uma falha ao registrar boleto devido ao código do convenio invalido no Santander", t, func() { req := getModelBody(models.Santander, 200) req.Agreement.AgreementNumber = 0 response, st, err := util.Post("http://localhost:3000/v1/boleto/register", stringify(req), nil) So(err, ShouldEqual, nil) So(st, ShouldEqual, 400) boleto := models.BoletoResponse{} errJSON := json.Unmarshal([]byte(response), &boleto) So(errJSON, ShouldEqual, nil) So(len(boleto.Errors), ShouldBeGreaterThan, 0) So(boleto.Errors[0].Message, ShouldEqual, "O código do convênio deve ser preenchido") }) }
explode_data.jsonl/77180
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 832 }
[ 2830, 3393, 14996, 8690, 1233, 273, 983, 50, 517, 8199, 1155, 353, 8840, 836, 8, 972, 36037, 1669, 906, 7121, 4870, 3568, 36037, 77611, 3636, 284, 830, 319, 36037, 10166, 480, 2201, 284, 830, 319, 36037, 24664, 3636, 284, 830, 319, 30...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestDeleteStack(t *testing.T) { th.SetupHTTP() defer th.TeardownHTTP() HandleDeleteSuccessfully(t) err := stacks.Delete(fake.ServiceClient(), "golangsdk-test-stack-2", "db6977b2-27aa-4775-9ae7-6213212d4ada").ExtractErr() th.AssertNoErr(t, err) }
explode_data.jsonl/53522
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 110 }
[ 2830, 3393, 6435, 4336, 1155, 353, 8840, 836, 8, 341, 70479, 39820, 9230, 741, 16867, 270, 94849, 37496, 9230, 741, 197, 6999, 6435, 35959, 1155, 692, 9859, 1669, 39950, 18872, 74138, 13860, 2959, 1507, 330, 70, 37287, 51295, 16839, 56090...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestPrintServiceLoadBalancer(t *testing.T) { tests := []struct { service api.Service options printers.GenerateOptions expected []metav1.TableRow }{ // Test load balancer service with multiple external IP's { service: api.Service{ ObjectMeta: metav1.ObjectMeta{Name: "service1"}, Spec: api.ServiceSpec{ ClusterIP: "1.2.3.4", Type: "LoadBalancer", Ports: []api.ServicePort{{Port: 80, Protocol: "TCP"}}, }, Status: api.ServiceStatus{ LoadBalancer: api.LoadBalancerStatus{ Ingress: []api.LoadBalancerIngress{{IP: "2.3.4.5"}, {IP: "3.4.5.6"}}}, }, }, options: printers.GenerateOptions{}, // Columns: Name, Type, Cluster-IP, External-IP, Port(s), Age expected: []metav1.TableRow{{Cells: []interface{}{"service1", "LoadBalancer", "1.2.3.4", "2.3.4.5,3.4.5.6", "80/TCP", "<unknown>"}}}, }, // Test load balancer service with pending external IP. { service: api.Service{ ObjectMeta: metav1.ObjectMeta{Name: "service2"}, Spec: api.ServiceSpec{ ClusterIP: "1.3.4.5", Type: "LoadBalancer", Ports: []api.ServicePort{{Port: 80, Protocol: "TCP"}, {Port: 8090, Protocol: "UDP"}, {Port: 8000, Protocol: "TCP"}, {Port: 7777, Protocol: "SCTP"}}, }, }, options: printers.GenerateOptions{}, // Columns: Name, Type, Cluster-IP, External-IP, Port(s), Age expected: []metav1.TableRow{{Cells: []interface{}{"service2", "LoadBalancer", "1.3.4.5", "<pending>", "80/TCP,8090/UDP,8000/TCP,7777/SCTP", "<unknown>"}}}, }, // Test load balancer service with multiple ports. { service: api.Service{ ObjectMeta: metav1.ObjectMeta{Name: "service3"}, Spec: api.ServiceSpec{ ClusterIP: "1.4.5.6", Type: "LoadBalancer", Ports: []api.ServicePort{{Port: 80, Protocol: "TCP"}, {Port: 8090, Protocol: "UDP"}, {Port: 8000, Protocol: "TCP"}}, }, Status: api.ServiceStatus{ LoadBalancer: api.LoadBalancerStatus{ Ingress: []api.LoadBalancerIngress{{IP: "2.3.4.5"}}}, }, }, options: printers.GenerateOptions{}, // Columns: Name, Type, Cluster-IP, External-IP, Port(s), Age expected: []metav1.TableRow{{Cells: []interface{}{"service3", "LoadBalancer", "1.4.5.6", "2.3.4.5", "80/TCP,8090/UDP,8000/TCP", "<unknown>"}}}, }, // Long external IP's list gets elided. { service: api.Service{ ObjectMeta: metav1.ObjectMeta{Name: "service4"}, Spec: api.ServiceSpec{ ClusterIP: "1.5.6.7", Type: "LoadBalancer", Ports: []api.ServicePort{{Port: 80, Protocol: "TCP"}, {Port: 8090, Protocol: "UDP"}, {Port: 8000, Protocol: "TCP"}}, }, Status: api.ServiceStatus{ LoadBalancer: api.LoadBalancerStatus{ Ingress: []api.LoadBalancerIngress{{IP: "2.3.4.5"}, {IP: "3.4.5.6"}, {IP: "5.6.7.8", Hostname: "host5678"}}}, }, }, options: printers.GenerateOptions{}, // Columns: Name, Type, Cluster-IP, External-IP, Port(s), Age expected: []metav1.TableRow{{Cells: []interface{}{"service4", "LoadBalancer", "1.5.6.7", "2.3.4.5,3.4.5...", "80/TCP,8090/UDP,8000/TCP", "<unknown>"}}}, }, // Generate options: Wide, includes selectors. { service: api.Service{ ObjectMeta: metav1.ObjectMeta{Name: "service4"}, Spec: api.ServiceSpec{ ClusterIP: "1.5.6.7", Type: "LoadBalancer", Ports: []api.ServicePort{{Port: 80, Protocol: "TCP"}, {Port: 8090, Protocol: "UDP"}, {Port: 8000, Protocol: "TCP"}}, Selector: map[string]string{"foo": "bar"}, }, Status: api.ServiceStatus{ LoadBalancer: api.LoadBalancerStatus{ Ingress: []api.LoadBalancerIngress{{IP: "2.3.4.5"}, {IP: "3.4.5.6"}, {IP: "5.6.7.8", Hostname: "host5678"}}}, }, }, options: printers.GenerateOptions{Wide: true}, // Columns: Name, Type, Cluster-IP, External-IP, Port(s), Age expected: []metav1.TableRow{{Cells: []interface{}{"service4", "LoadBalancer", "1.5.6.7", "2.3.4.5,3.4.5.6,5.6.7.8", "80/TCP,8090/UDP,8000/TCP", "<unknown>", "foo=bar"}}}, }, } for i, test := range tests { rows, err := printService(&test.service, test.options) if err != nil { t.Fatalf("Error printing table rows for Service: %#v", err) } for i := range rows { rows[i].Object.Object = nil } if !reflect.DeepEqual(test.expected, rows) { t.Errorf("%d mismatch: %s", i, diff.ObjectReflectDiff(test.expected, rows)) } } }
explode_data.jsonl/21596
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1958 }
[ 2830, 3393, 8994, 1860, 5879, 93825, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 3056, 1235, 341, 197, 52934, 220, 6330, 13860, 198, 197, 35500, 220, 55953, 57582, 3798, 198, 197, 42400, 3056, 4059, 402, 16, 18257, 3102, 198, 197, 59403,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
5
func TestCreateJobRef(t *testing.T) { defer fixRandomJobID("RANDOM")() for _, test := range []struct { jobID string addJobIDSuffix bool want string }{ { jobID: "foo", addJobIDSuffix: false, want: "foo", }, { jobID: "", addJobIDSuffix: false, want: "RANDOM", }, { jobID: "", addJobIDSuffix: true, // irrelevant want: "RANDOM", }, { jobID: "foo", addJobIDSuffix: true, want: "foo-RANDOM", }, } { jr := createJobRef(test.jobID, test.addJobIDSuffix, "projectID") got := jr.JobId if got != test.want { t.Errorf("%q, %t: got %q, want %q", test.jobID, test.addJobIDSuffix, got, test.want) } } }
explode_data.jsonl/69216
{ "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, 4021, 12245, 3945, 1155, 353, 8840, 836, 8, 341, 16867, 5046, 13999, 12245, 915, 445, 97661, 899, 741, 2023, 8358, 1273, 1669, 2088, 3056, 1235, 341, 197, 68577, 915, 688, 914, 198, 197, 12718, 12245, 25614, 13554, 1807, 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...
3
func TestHTMLURL(t *testing.T) { htmlTests := []struct { url string html string expected string }{ {`http://example.com/`, `<a href=http://example.com/>link</a>`, `<a href=//example.com/>link</a>`}, {`https://example.com/`, `<a href=http://example.com/>link</a>`, `<a href=http://example.com/>link</a>`}, {`http://example.com/`, `<a href=https://example.com/>link</a>`, `<a href=https://example.com/>link</a>`}, {`https://example.com/`, `<a href=https://example.com/>link</a>`, `<a href=//example.com/>link</a>`}, {`http://example.com/`, `<a href=" http://example.com ">x</a>`, `<a href=//example.com>x</a>`}, {`http://example.com/`, `<link rel="stylesheet" type="text/css" href="http://example.com">`, `<link rel=stylesheet href=//example.com>`}, {`http://example.com/`, `<!doctype html> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> <head profile="http://dublincore.org/documents/dcq-html/"> <!-- Barlesque 2.75.0 --> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />`, `<!doctype html><html xmlns=//www.w3.org/1999/xhtml xml:lang=en><head profile=//dublincore.org/documents/dcq-html/><meta charset=utf-8>`}, {`http://example.com/`, `<html xmlns="http://www.w3.org/1999/xhtml"></html>`, `<html xmlns=//www.w3.org/1999/xhtml>`}, {`https://example.com/`, `<html xmlns="http://www.w3.org/1999/xhtml"></html>`, `<html xmlns=http://www.w3.org/1999/xhtml>`}, {`http://example.com/`, `<html xmlns="https://www.w3.org/1999/xhtml"></html>`, `<html xmlns=https://www.w3.org/1999/xhtml>`}, {`https://example.com/`, `<html xmlns="https://www.w3.org/1999/xhtml"></html>`, `<html xmlns=//www.w3.org/1999/xhtml>`}, } m := minify.New() m.AddFunc("text/html", Minify) for _, tt := range htmlTests { t.Run(tt.url, func(t *testing.T) { r := bytes.NewBufferString(tt.html) w := &bytes.Buffer{} m.URL, _ = url.Parse(tt.url) err := Minify(m, w, r, nil) test.Minify(t, tt.html, err, w.String(), tt.expected) }) } }
explode_data.jsonl/59586
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 880 }
[ 2830, 3393, 5835, 3144, 1155, 353, 8840, 836, 8, 341, 36126, 18200, 1669, 3056, 1235, 341, 197, 19320, 414, 914, 198, 197, 36126, 257, 914, 198, 197, 42400, 914, 198, 197, 59403, 197, 197, 90, 63, 1254, 1110, 8687, 905, 14, 7808, 30...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestExample(t *testing.T) { exampleFile := path.Join("test", "example.json") geojson, err := ioutil.ReadFile(exampleFile) if err != nil { t.Fatalf("unexpected error %v", err) } svgFile := path.Join("test", "example.svg") want, err := ioutil.ReadFile(svgFile) if err != nil { t.Fatalf("unexpected error %v", err) } svg := geojson2svg.New() err = svg.AddFeatureCollectionString(string(geojson)) if err != nil { t.Fatalf("unexpected error %v", err) } got := svg.Draw(1000, 510, geojson2svg.WithAttribute("xmlns", "http://www.w3.org/2000/svg"), geojson2svg.UseProperties([]string{"style"}), geojson2svg.WithPadding(geojson2svg.Padding{ Top: 10, Right: 10, Bottom: 10, Left: 10, })) if got != string(want) { t.Errorf("expected %s, got %s", string(want), got) } }
explode_data.jsonl/77431
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 358 }
[ 2830, 3393, 13314, 1155, 353, 8840, 836, 8, 341, 8122, 1516, 1703, 1669, 1815, 22363, 445, 1944, 497, 330, 8687, 4323, 1138, 197, 13052, 2236, 11, 1848, 1669, 43144, 78976, 66203, 1703, 340, 743, 1848, 961, 2092, 341, 197, 3244, 30762, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestChangefeedNemeses(t *testing.T) { defer leaktest.AfterTest(t)() defer func(i time.Duration) { jobs.DefaultAdoptInterval = i }(jobs.DefaultAdoptInterval) jobs.DefaultAdoptInterval = 10 * time.Millisecond testFn := func(t *testing.T, db *gosql.DB, f cdctest.TestFeedFactory) { v, err := cdctest.RunNemesis(f, db) if err != nil { t.Fatalf("%+v", err) } for _, failure := range v.Failures() { t.Error(failure) } } t.Run(`sinkless`, sinklessTest(testFn)) // TODO(dan): This deadlocks t.Run(`enterprise`, enterpriseTest(testFn)) // TODO(dan): This deadlocks t.Run(`poller`, pollerTest(sinklessTest, testFn)) t.Run(`cloudstorage`, cloudStorageTest(testFn)) }
explode_data.jsonl/50644
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 286 }
[ 2830, 3393, 1143, 524, 823, 12051, 45, 15660, 288, 1155, 353, 8840, 836, 8, 341, 16867, 23352, 1944, 36892, 2271, 1155, 8, 741, 16867, 2915, 1956, 882, 33795, 8, 314, 6887, 13275, 2589, 2912, 10256, 284, 600, 95916, 31105, 13275, 2589, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestNullByteParam(t *testing.T) { spec := nullTestSpec{"nullbyte", "byte", [6]nullTestRow{ {NullByte{31, true}, 1, NullByte{31, true}}, {NullByte{0, false}, 1, NullByte{0, false}}, {22, 1, NullByte{22, true}}, {NullByte{33, true}, 1, NullByte{33, true}}, {NullByte{222, false}, 1, NullByte{0, false}}, {0, NullByte{31, false}, nil}, }} nullTestRun(t, spec) }
explode_data.jsonl/15995
{ "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, 3280, 7153, 2001, 1155, 353, 8840, 836, 8, 341, 98100, 1669, 845, 2271, 8327, 4913, 2921, 3782, 497, 330, 3782, 497, 508, 21, 60, 2921, 2271, 3102, 515, 197, 197, 90, 3280, 7153, 90, 18, 16, 11, 830, 2137, 220, 16, 11,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestMuxNestedNotFound(t *testing.T) { r := NewRouter() r.Use(func(next Handler) Handler { return HandlerFunc(func(ctx context.Context, rc *fasthttp.RequestCtx) { ctx = context.WithValue(ctx, ctxKey{"mw"}, "mw") next.ServeHTTP(ctx, rc) }) }) r.Get("/hi", HandlerFunc(func(ctx context.Context, rc *fasthttp.RequestCtx) { rc.Write([]byte("bye")) })) r.With(func(next Handler) Handler { return HandlerFunc(func(ctx context.Context, rc *fasthttp.RequestCtx) { ctx = context.WithValue(ctx, ctxKey{"with"}, "with") next.ServeHTTP(ctx, rc) }) }).NotFound(HandlerFunc(func(ctx context.Context, rc *fasthttp.RequestCtx) { chkMw := ctx.Value(ctxKey{"mw"}).(string) chkWith := ctx.Value(ctxKey{"with"}).(string) rc.Response.SetStatusCode(404) rc.Write([]byte(fmt.Sprintf("root 404 %s %s", chkMw, chkWith))) })) sr1 := NewRouter() sr1.Get("/sub", HandlerFunc(func(ctx context.Context, rc *fasthttp.RequestCtx) { rc.Write([]byte("sub")) })) sr1.Group(func(sr1 Router) { sr1.Use(func(next Handler) Handler { return HandlerFunc(func(ctx context.Context, rc *fasthttp.RequestCtx) { ctx = context.WithValue(ctx, ctxKey{"mw2"}, "mw2") next.ServeHTTP(ctx, rc) }) }) sr1.NotFound(HandlerFunc(func(ctx context.Context, rc *fasthttp.RequestCtx) { chkMw2 := ctx.Value(ctxKey{"mw2"}).(string) rc.Response.SetStatusCode(404) rc.Write([]byte(fmt.Sprintf("sub 404 %s", chkMw2))) })) }) sr2 := NewRouter() sr2.Get("/sub", HandlerFunc(func(ctx context.Context, rc *fasthttp.RequestCtx) { rc.Write([]byte("sub2")) })) r.Mount("/admin1", sr1) r.Mount("/admin2", sr2) ts := NewTestServer(r) defer ts.Close() if _, body := testRequest(t, ts, "GET", "/hi", nil); body != "bye" { t.Fatalf(body) } if _, body := testRequest(t, ts, "GET", "/nothing-here", nil); body != "root 404 mw with" { t.Fatalf(body) } if _, body := testRequest(t, ts, "GET", "/admin1/sub", nil); body != "sub" { t.Fatalf(body) } if _, body := testRequest(t, ts, "GET", "/admin1/nope", nil); body != "sub 404 mw2" { t.Fatalf(body) } if _, body := testRequest(t, ts, "GET", "/admin2/sub", nil); body != "sub2" { t.Fatalf(body) } // Not found pages should bubble up to the root. if _, body := testRequest(t, ts, "GET", "/admin2/nope", nil); body != "root 404 mw with" { t.Fatalf(body) } }
explode_data.jsonl/47944
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1027 }
[ 2830, 3393, 44, 2200, 71986, 10372, 1155, 353, 8840, 836, 8, 341, 7000, 1669, 1532, 9523, 2822, 7000, 9046, 18552, 16913, 19954, 8, 19954, 341, 197, 853, 19954, 9626, 18552, 7502, 2266, 9328, 11, 10192, 353, 9349, 1254, 9659, 23684, 8, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestFSChecker(t *testing.T) { mm := memsys.DefaultPageMM() defer mm.Terminate() updateTestConfig() var ( failedMpath = fsCheckerTmpDir + "/3" dispatcher = newMockFSDispatcher(failedMpath) fshc = NewFSHC(dispatcher, testCheckerMountPaths(), mm, fs.CSM) ) // initial state = 2 available FSes - must pass availablePaths, disabledPaths := fshc.mountpaths.Get() if len(availablePaths) != 3 || len(disabledPaths) != 1 { t.Errorf("Invalid number of mountpaths at start: %v - %v", availablePaths, disabledPaths) } // inaccessible mountpath _, _, exists := fshc.testMountpath( fsCheckerTmpDir+"/3/testfile", fsCheckerTmpDir+"/3", 4, 1024) if exists { t.Error("Testing non-existing mountpath must fail") } // failed mountpath must be disabled fshc.runMpathTest(failedMpath, failedMpath+"/dir/testfile") if !dispatcher.faultDetected { t.Errorf("Faulty mountpath %s was not detected", failedMpath) } // decision making function type tstInfo struct { title string readErrs, writeErrs int avail, result bool } testList := []tstInfo{ {"Inaccessible mountpath", 0, 0, false, false}, {"Healthy mountpath", 0, 0, true, true}, {"Unstable but OK mountpath", 1, 1, true, true}, {"Reads failed", 3, 0, true, false}, {"Writes failed", 1, 3, true, false}, {"Reads and writes failed", 3, 3, true, false}, } for _, tst := range testList { t.Run(tst.title, func(t *testing.T) { res, _ := fshc.isTestPassed("/tmp", tst.readErrs, tst.writeErrs, tst.avail) if res != tst.result { t.Errorf("%s failed. %v expected but %v got", tst.title, tst.result, res) } }) } testCheckerCleanup() }
explode_data.jsonl/12442
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 683 }
[ 2830, 3393, 37, 3540, 1227, 261, 1155, 353, 8840, 836, 8, 341, 2109, 76, 1669, 1833, 7791, 13275, 2665, 8035, 741, 16867, 9465, 836, 261, 34016, 2822, 27175, 2271, 2648, 2822, 2405, 2399, 197, 1166, 5687, 44, 2343, 284, 8619, 35188, 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 TestStorageList(t *testing.T) { // initialize storage storage := Init(driver.NewMemory()) // setup storage with test releases setup := func() { // release records rls0 := ReleaseTestData{Name: "happy-catdog", Status: rspb.Status_SUPERSEDED}.ToRelease() rls1 := ReleaseTestData{Name: "livid-human", Status: rspb.Status_SUPERSEDED}.ToRelease() rls2 := ReleaseTestData{Name: "relaxed-cat", Status: rspb.Status_SUPERSEDED}.ToRelease() rls3 := ReleaseTestData{Name: "hungry-hippo", Status: rspb.Status_DEPLOYED}.ToRelease() rls4 := ReleaseTestData{Name: "angry-beaver", Status: rspb.Status_DEPLOYED}.ToRelease() rls5 := ReleaseTestData{Name: "opulent-frog", Status: rspb.Status_DELETED}.ToRelease() rls6 := ReleaseTestData{Name: "happy-liger", Status: rspb.Status_DELETED}.ToRelease() // create the release records in the storage assertErrNil(t.Fatal, storage.Create(rls0), "Storing release 'rls0'") assertErrNil(t.Fatal, storage.Create(rls1), "Storing release 'rls1'") assertErrNil(t.Fatal, storage.Create(rls2), "Storing release 'rls2'") assertErrNil(t.Fatal, storage.Create(rls3), "Storing release 'rls3'") assertErrNil(t.Fatal, storage.Create(rls4), "Storing release 'rls4'") assertErrNil(t.Fatal, storage.Create(rls5), "Storing release 'rls5'") assertErrNil(t.Fatal, storage.Create(rls6), "Storing release 'rls6'") } var listTests = []struct { Description string NumExpected int ListFunc func() ([]*rspb.Release, error) }{ {"ListDeleted", 2, storage.ListDeleted}, {"ListDeployed", 2, storage.ListDeployed}, {"ListReleases", 7, storage.ListReleases}, } setup() for _, tt := range listTests { list, err := tt.ListFunc() assertErrNil(t.Fatal, err, tt.Description) // verify the count of releases returned if len(list) != tt.NumExpected { t.Errorf("ListReleases(%s): expected %d, actual %d", tt.Description, tt.NumExpected, len(list)) } } }
explode_data.jsonl/35126
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 772 }
[ 2830, 3393, 5793, 852, 1155, 353, 8840, 836, 8, 341, 197, 322, 9468, 5819, 198, 197, 16172, 1669, 15690, 24032, 7121, 10642, 12367, 197, 322, 6505, 5819, 448, 1273, 19232, 198, 84571, 1669, 2915, 368, 341, 197, 197, 322, 4879, 7424, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestCreditNoteVoidCreditNote(t *testing.T) { params := &stripe.CreditNoteVoidParams{} cn, err := VoidCreditNote("cn_123", params) assert.Nil(t, err) assert.NotNil(t, cn) }
explode_data.jsonl/29994
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 74 }
[ 2830, 3393, 33493, 9112, 35882, 33493, 9112, 1155, 353, 8840, 836, 8, 341, 25856, 1669, 609, 61233, 727, 10827, 9112, 35882, 4870, 16094, 1444, 77, 11, 1848, 1669, 19193, 33493, 9112, 445, 14271, 62, 16, 17, 18, 497, 3628, 340, 6948, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
func TestFavoritesAddRemoveAdd(t *testing.T) { mockCtrl, config, ctx := favTestInit(t, false) f := NewFavorites(config) f.InitForTest() defer favTestShutdown(t, mockCtrl, config, f) fav1 := favorites.ToAdd{ Folder: favorites.Folder{ Name: "test", Type: tlf.Public, }, Data: favorites.Data{}, Created: false, } config.mockKbpki.EXPECT().FavoriteList(gomock.Any()).Return(keybase1.FavoritesResult{}, nil) folder1 := fav1.ToKBFolder() config.mockKbpki.EXPECT().FavoriteAdd(gomock.Any(), folder1). Times(2).Return(nil) config.mockKbpki.EXPECT().FavoriteDelete(gomock.Any(), folder1). Return(nil) config.mockClock.EXPECT().Now().Return(time.Unix(0, 0)).Times(3) if err := f.Add(ctx, fav1); err != nil { t.Fatalf("Couldn't add favorite: %v", err) } if err := f.Delete(ctx, fav1.Folder); err != nil { t.Fatalf("Couldn't delete favorite: %v", err) } // A second add shouldn't result in a KBPKI call if err := f.Add(ctx, fav1); err != nil { t.Fatalf("Couldn't re-add same favorite: %v", err) } }
explode_data.jsonl/14682
{ "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, 85221, 2212, 13021, 2212, 1155, 353, 8840, 836, 8, 341, 77333, 15001, 11, 2193, 11, 5635, 1669, 9244, 2271, 3803, 1155, 11, 895, 340, 1166, 1669, 1532, 85221, 8754, 340, 1166, 26849, 2461, 2271, 741, 16867, 9244, 2271, 62004...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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