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 TestStandardCheckWarning(t *testing.T) { v := warningCheck.Check() if v.Status != check.Warning { t.Errorf("Wrong status: %d", v.Status) } if v.Output != "WARNING: messMeth: 1.90" { t.Errorf("Wrong message: %s", v.Output) } }
explode_data.jsonl/49830
{ "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, 19781, 3973, 12087, 1155, 353, 8840, 836, 8, 341, 5195, 1669, 9958, 3973, 10600, 2822, 743, 348, 10538, 961, 1779, 51763, 341, 197, 3244, 13080, 445, 29185, 2639, 25, 1018, 67, 497, 348, 10538, 340, 197, 630, 743, 348, 342...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestSetting_Delete(t *testing.T) { t.Parallel() ctx := context.TODO() z, err := zone.New(ctx, t.Name()) require.NoError(t, err) m, err := mode.New(ctx, z.ID, t.Name(), 70, 80, 1) require.NoError(t, err) s, err := New(ctx, z.ID, m.ID, SCHEDULED, 1, time.Now(), time.Now().Add(time.Minute), 0, 50) require.NoError(t, err) assert.True(t, settingExists(t, ctx, s.ID)) err = s.Delete(ctx) require.NoError(t, err) assert.False(t, settingExists(t, ctx, s.ID)) }
explode_data.jsonl/13335
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 214 }
[ 2830, 3393, 15400, 57418, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 741, 20985, 1669, 2266, 90988, 2822, 20832, 11, 1848, 1669, 10143, 7121, 7502, 11, 259, 2967, 2398, 17957, 35699, 1155, 11, 1848, 340, 2109, 11, 1848, 1669, 3856...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestGoroutine(t *testing.T) { for i := 0; i < 10; i++ { // 值传递,每个协程所拥有的变量地址不一样 go func (i int){ fmt.Println(i) }(i) // go func() { // // 10 // // 共享变量,竞争,锁 // fmt.Println(i) // }() } time.Sleep(time.Millisecond*50) }
explode_data.jsonl/12916
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 184 }
[ 2830, 3393, 38, 269, 14159, 1155, 353, 8840, 836, 8, 341, 2023, 600, 1669, 220, 15, 26, 600, 366, 220, 16, 15, 26, 600, 1027, 341, 197, 197, 322, 4891, 222, 120, 104793, 3837, 103991, 99339, 38507, 31838, 100151, 99996, 115857, 46477,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestAutoscalerStressCreate(t *testing.T) { t.Parallel() alpha1 := framework.AgonesClient.StableV1alpha1() fleets := alpha1.Fleets(defaultNs) flt, err := fleets.Create(defaultFleet()) if assert.Nil(t, err) { defer fleets.Delete(flt.ObjectMeta.Name, nil) // nolint:errcheck } framework.WaitForFleetCondition(t, flt, e2e.FleetReadyCount(flt.Spec.Replicas)) r := rand.New(rand.NewSource(1783)) fleetautoscalers := framework.AgonesClient.AutoscalingV1().FleetAutoscalers(defaultNs) for i := 0; i < 5; i++ { fas := defaultFleetAutoscaler(flt) bufferSize := r.Int31n(5) minReplicas := r.Int31n(5) maxReplicas := r.Int31n(8) fas.Spec.Policy.Buffer.BufferSize = intstr.FromInt(int(bufferSize)) fas.Spec.Policy.Buffer.MinReplicas = minReplicas fas.Spec.Policy.Buffer.MaxReplicas = maxReplicas valid := bufferSize > 0 && fas.Spec.Policy.Buffer.MaxReplicas > 0 && fas.Spec.Policy.Buffer.MaxReplicas >= bufferSize && fas.Spec.Policy.Buffer.MinReplicas <= fas.Spec.Policy.Buffer.MaxReplicas && (fas.Spec.Policy.Buffer.MinReplicas == 0 || fas.Spec.Policy.Buffer.MinReplicas >= bufferSize) // create a closure to have defered delete func called on each loop iteration. func() { fas, err := fleetautoscalers.Create(fas) if err == nil { defer fleetautoscalers.Delete(fas.ObjectMeta.Name, nil) // nolint:errcheck assert.True(t, valid, fmt.Sprintf("FleetAutoscaler created even if the parameters are NOT valid: %d %d %d", bufferSize, fas.Spec.Policy.Buffer.MinReplicas, fas.Spec.Policy.Buffer.MaxReplicas)) expectedReplicas := bufferSize if expectedReplicas < fas.Spec.Policy.Buffer.MinReplicas { expectedReplicas = fas.Spec.Policy.Buffer.MinReplicas } if expectedReplicas > fas.Spec.Policy.Buffer.MaxReplicas { expectedReplicas = fas.Spec.Policy.Buffer.MaxReplicas } // the fleet autoscaler should scale the fleet now to expectedReplicas framework.WaitForFleetCondition(t, flt, e2e.FleetReadyCount(expectedReplicas)) } else { assert.False(t, valid, fmt.Sprintf("FleetAutoscaler NOT created even if the parameters are valid: %d %d %d (%s)", bufferSize, minReplicas, maxReplicas, err)) } }() } }
explode_data.jsonl/62770
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 897 }
[ 2830, 3393, 19602, 436, 63084, 623, 673, 4021, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 2822, 73063, 16, 1669, 12626, 49850, 3154, 2959, 7758, 480, 53, 16, 7141, 16, 741, 1166, 273, 1415, 1669, 8287, 16, 991, 273, 1415, 18978,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestShouldExecuteMiddlewaresInReverseOrder(t *testing.T) { // Reverse order means they will essentially execute in sequential order because // each middleware executes the *next* item from within itself items := make([]string, 0, 3) r := NewRouter() r.Use(func(next HandlerFunc) HandlerFunc { return func(c Context) error { items = append(items, "third") return next(c) } }, func(next HandlerFunc) HandlerFunc { return func(c Context) error { items = append(items, "second") return next(c) } }) r.Use(func(next HandlerFunc) HandlerFunc { return func(c Context) error { items = append(items, "first") return next(c) } }) r.MethodFunc(http.MethodGet, "/", func(c Context) error { return c.WriteStatus(200) }) rec := httptest.NewRecorder() r.ServeHTTP(rec, httptest.NewRequest("GET", "/", nil)) assert.Equal(t, []string{"first", "second", "third"}, items) }
explode_data.jsonl/18951
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 331 }
[ 2830, 3393, 14996, 17174, 43935, 37903, 641, 45695, 4431, 1155, 353, 8840, 836, 8, 341, 197, 322, 24277, 1973, 3363, 807, 686, 15791, 9026, 304, 51000, 1973, 1576, 198, 197, 322, 1817, 29679, 51435, 279, 353, 3600, 9, 1509, 504, 2878, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestCertificate(t *testing.T) { cert := parseCertificate(certPEM) ok := &api.SignResponse{ ServerPEM: api.Certificate{Certificate: cert}, CaPEM: api.Certificate{Certificate: parseCertificate(rootPEM)}, } tests := []struct { name string sign *api.SignResponse want *x509.Certificate wantErr bool }{ {"ok", ok, cert, false}, {"fail", &api.SignResponse{}, nil, true}, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { got, err := Certificate(tt.sign) if (err != nil) != tt.wantErr { t.Errorf("Certificate() error = %v, wantErr %v", err, tt.wantErr) return } if !reflect.DeepEqual(got, tt.want) { t.Errorf("Certificate() = %v, want %v", got, tt.want) } }) } }
explode_data.jsonl/58877
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 333 }
[ 2830, 3393, 33202, 1155, 353, 8840, 836, 8, 341, 1444, 529, 1669, 4715, 33202, 87793, 1740, 44, 340, 59268, 1669, 609, 2068, 41152, 2582, 515, 197, 92075, 1740, 44, 25, 6330, 727, 20962, 90, 33202, 25, 2777, 1583, 197, 6258, 64, 1740,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestClient_CreateTLSActivation_validation(t *testing.T) { t.Parallel() var err error record(t, "custom_tls_activation/create", func(c *Client) { _, err = c.CreateTLSActivation(&CreateTLSActivationInput{ Certificate: &CustomTLSCertificate{ID: "CERTIFICATE_ID"}, Configuration: &TLSConfiguration{ID: "CONFIGURATION_ID"}, Domain: &TLSDomain{ID: "DOMAIN_NAME"}, }) }) if err != nil { t.Fatal(err) } _, err = testClient.CreateTLSActivation(&CreateTLSActivationInput{ Configuration: &TLSConfiguration{ID: "CONFIGURATION_ID"}, Domain: &TLSDomain{ID: "DOMAIN_NAME"}, }) if err != ErrMissingTLSCertificate { t.Errorf("bad error: %s", err) } _, err = testClient.CreateTLSActivation(&CreateTLSActivationInput{ Certificate: &CustomTLSCertificate{ID: "CERTIFICATE_ID"}, Configuration: &TLSConfiguration{ID: "CONFIGURATION_ID"}, }) if err != ErrMissingTLSDomain { t.Errorf("bad error: %s", err) } }
explode_data.jsonl/2980
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 380 }
[ 2830, 3393, 2959, 34325, 45439, 61460, 19416, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 2822, 2405, 1848, 1465, 198, 71952, 1155, 11, 330, 9163, 71262, 52404, 25577, 497, 2915, 1337, 353, 2959, 8, 341, 197, 197, 6878, 1848, 284, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestAssignment(t *testing.T) { expect(t, "a = 5", func(p pfn) []ast.Stmt { return stmts( assignStmt( exprs(ident("a", p(1, 1))), exprs(intLit(5, p(1, 5))), token.Assign, p(1, 3))) }) expect(t, "a := 5", func(p pfn) []ast.Stmt { return stmts( assignStmt( exprs(ident("a", p(1, 1))), exprs(intLit(5, p(1, 6))), token.Define, p(1, 3))) }) expect(t, "a, b = 5, 10", func(p pfn) []ast.Stmt { return stmts( assignStmt( exprs( ident("a", p(1, 1)), ident("b", p(1, 4))), exprs( intLit(5, p(1, 8)), intLit(10, p(1, 11))), token.Assign, p(1, 6))) }) expect(t, "a, b := 5, 10", func(p pfn) []ast.Stmt { return stmts( assignStmt( exprs( ident("a", p(1, 1)), ident("b", p(1, 4))), exprs( intLit(5, p(1, 9)), intLit(10, p(1, 12))), token.Define, p(1, 6))) }) expect(t, "a, b = a + 2, b - 8", func(p pfn) []ast.Stmt { return stmts( assignStmt( exprs( ident("a", p(1, 1)), ident("b", p(1, 4))), exprs( binaryExpr( ident("a", p(1, 8)), intLit(2, p(1, 12)), token.Add, p(1, 10)), binaryExpr( ident("b", p(1, 15)), intLit(8, p(1, 19)), token.Sub, p(1, 17))), token.Assign, p(1, 6))) }) expect(t, "a = [1, 2, 3]", func(p pfn) []ast.Stmt { return stmts( assignStmt( exprs(ident("a", p(1, 1))), exprs(arrayLit(p(1, 5), p(1, 13), intLit(1, p(1, 6)), intLit(2, p(1, 9)), intLit(3, p(1, 12)))), token.Assign, p(1, 3))) }) expect(t, "a = [1 + 2, b * 4, [4, c]]", func(p pfn) []ast.Stmt { return stmts( assignStmt( exprs(ident("a", p(1, 1))), exprs(arrayLit(p(1, 5), p(1, 26), binaryExpr( intLit(1, p(1, 6)), intLit(2, p(1, 10)), token.Add, p(1, 8)), binaryExpr( ident("b", p(1, 13)), intLit(4, p(1, 17)), token.Mul, p(1, 15)), arrayLit(p(1, 20), p(1, 25), intLit(4, p(1, 21)), ident("c", p(1, 24))))), token.Assign, p(1, 3))) }) expect(t, "a += 5", func(p pfn) []ast.Stmt { return stmts( assignStmt( exprs(ident("a", p(1, 1))), exprs(intLit(5, p(1, 6))), token.AddAssign, p(1, 3))) }) expect(t, "a *= 5 + 10", func(p pfn) []ast.Stmt { return stmts( assignStmt( exprs(ident("a", p(1, 1))), exprs( binaryExpr( intLit(5, p(1, 6)), intLit(10, p(1, 10)), token.Add, p(1, 8))), token.MulAssign, p(1, 3))) }) }
explode_data.jsonl/58122
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1565 }
[ 2830, 3393, 41613, 1155, 353, 8840, 836, 8, 341, 24952, 1155, 11, 330, 64, 284, 220, 20, 497, 2915, 1295, 281, 8822, 8, 3056, 559, 7758, 2501, 341, 197, 853, 20020, 82, 1006, 298, 197, 6983, 31063, 1006, 571, 8122, 84305, 95270, 445...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestStateService(t *testing.T) { // Set up test networkID, hwID, and encode into context magmad_test_init.StartTestService(t) networkID, err := magmad.RegisterNetwork( &magmad_protos.MagmadNetworkRecord{Name: "State Service Test"}, "state_service_test_network") hwId := protos.AccessGatewayID{Id: testAgHwId} magmad.RegisterGateway( networkID, &magmad_protos.AccessGatewayRecord{HwId: &hwId, Name: "Test GW Name"}) ctx := test_utils.GetContextWithCertificate(t, testAgHwId) // Create States, IDs, values value0 := Name{Name: "name0"} value1 := Name{Name: "name1"} value2 := NameAndAge{Name: "name2", Age: 20} bundle0 := makeStateBundle(typeName, "key0", value0) bundle1 := makeStateBundle(typeName, "key1", value1) bundle2 := makeStateBundle(typeName, "key2", value2) test_service.StartTestService(t) err = serde.RegisterSerdes(&Serde{}) assert.NoError(t, err) // Check contract for empty network states, err := state.GetStates(networkID, []state.StateID{bundle0.ID}) assert.NoError(t, err) assert.Equal(t, 0, len(states)) // Report and read back err = reportStates(ctx, bundle0, bundle1) assert.NoError(t, err) states, err = state.GetStates(networkID, []state.StateID{bundle0.ID, bundle1.ID}) assert.NoError(t, err) testGetStatesResponse(t, states, bundle0, bundle1) // Report a state with fields the corresponding serde does not expect err = reportStates(ctx, bundle2) assert.NoError(t, err) states, err = state.GetStates(networkID, []state.StateID{bundle2.ID}) assert.NoError(t, err) testGetStatesResponse(t, states, bundle2) // Delete and read back err = state.DeleteStates(networkID, []state.StateID{bundle0.ID, bundle2.ID}) assert.NoError(t, err) states, err = state.GetStates(networkID, []state.StateID{bundle0.ID, bundle1.ID, bundle2.ID}) assert.NoError(t, err) assert.Equal(t, 1, len(states)) testGetStatesResponse(t, states, bundle1) }
explode_data.jsonl/5403
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 701 }
[ 2830, 3393, 1397, 1860, 1155, 353, 8840, 836, 8, 341, 197, 322, 2573, 705, 1273, 3922, 915, 11, 31256, 915, 11, 323, 16164, 1119, 2266, 198, 2109, 351, 20302, 4452, 6137, 12101, 2271, 1860, 1155, 340, 9038, 2349, 915, 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 TestResourceTokens(t *testing.T) { s, _, _, _, broker, err := setupHydraTest(true) if err != nil { t.Fatalf("setupHydraTest() failed: %v", err) } resp := sendResourceTokens(t, s, broker, consentStateID, false) if resp.StatusCode != http.StatusOK { t.Errorf("status = %d, wants %d", resp.StatusCode, http.StatusOK) } }
explode_data.jsonl/18505
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 128 }
[ 2830, 3393, 4783, 29300, 1155, 353, 8840, 836, 8, 341, 1903, 11, 8358, 8358, 8358, 22316, 11, 1848, 1669, 6505, 30816, 22248, 2271, 3715, 340, 743, 1848, 961, 2092, 341, 197, 3244, 30762, 445, 15188, 30816, 22248, 2271, 368, 4641, 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 TestSelectStatement_GroupByInterval(t *testing.T) { q := "SELECT sum(value) from foo where time < now() GROUP BY time(10m)" stmt, err := influxql.NewParser(strings.NewReader(q)).ParseStatement() if err != nil { t.Fatalf("invalid statement: %q: %s", stmt, err) } s := stmt.(*influxql.SelectStatement) d, err := s.GroupByInterval() if d != 10*time.Minute { t.Fatalf("group by interval not equal:\nexp=%s\ngot=%s", 10*time.Minute, d) } if err != nil { t.Fatalf("error parsing group by interval: %s", err.Error()) } }
explode_data.jsonl/24804
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 210 }
[ 2830, 3393, 3379, 8636, 52619, 1359, 10256, 1155, 353, 8840, 836, 8, 341, 18534, 1669, 330, 4858, 2629, 3679, 8, 504, 15229, 220, 1380, 882, 366, 1431, 368, 26870, 7710, 882, 7, 16, 15, 76, 12954, 55822, 11, 1848, 1669, 52852, 1470, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestFlattenResourceServiceAccountExternalPermissionInto(t *testing.T) { _default := map[string]interface{}{ "name": "", "namespace": "", "aws": nil, } type args struct { in kops.ServiceAccountExternalPermission } tests := []struct { name string args args want map[string]interface{} }{ { name: "default", args: args{ in: kops.ServiceAccountExternalPermission{}, }, want: _default, }, { name: "Name - default", args: args{ in: func() kops.ServiceAccountExternalPermission { subject := kops.ServiceAccountExternalPermission{} subject.Name = "" return subject }(), }, want: _default, }, { name: "Namespace - default", args: args{ in: func() kops.ServiceAccountExternalPermission { subject := kops.ServiceAccountExternalPermission{} subject.Namespace = "" return subject }(), }, want: _default, }, { name: "Aws - default", args: args{ in: func() kops.ServiceAccountExternalPermission { subject := kops.ServiceAccountExternalPermission{} subject.AWS = nil return subject }(), }, want: _default, }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { got := map[string]interface{}{} FlattenResourceServiceAccountExternalPermissionInto(tt.args.in, got) if diff := cmp.Diff(tt.want, got); diff != "" { t.Errorf("FlattenResourceServiceAccountExternalPermission() mismatch (-want +got):\n%s", diff) } }) } }
explode_data.jsonl/22381
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 631 }
[ 2830, 3393, 3882, 14456, 4783, 1860, 7365, 25913, 14966, 26591, 1155, 353, 8840, 836, 8, 341, 197, 9993, 1669, 2415, 14032, 31344, 67066, 197, 197, 31486, 788, 414, 8324, 197, 197, 1, 2231, 788, 8324, 197, 197, 1, 8635, 788, 981, 2092...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestRefetchSchemaWhenValidationFails(t *testing.T) { schema, err := loadSchemaForTest() if err != nil { t.Errorf("Error loading schema: %v", err) t.FailNow() } output, err := json.Marshal(schema) if err != nil { t.Errorf("Error serializing schema: %v", err) t.FailNow() } requests := map[string]int{} c := &manualfake.RESTClient{ NegotiatedSerializer: testapi.Default.NegotiatedSerializer(), Client: manualfake.CreateHTTPClient(func(req *http.Request) (*http.Response, error) { switch p, m := req.URL.Path, req.Method; { case strings.HasPrefix(p, "/swaggerapi") && m == "GET": requests[p] = requests[p] + 1 return &http.Response{StatusCode: 200, Header: header(), Body: ioutil.NopCloser(bytes.NewBuffer(output))}, nil default: t.Fatalf("unexpected request: %#v\n%#v", req.URL, req) return nil, nil } }), } dir := os.TempDir() + "/schemaCache" os.RemoveAll(dir) fullDir, err := substituteUserHome(dir) if err != nil { t.Errorf("Error getting fullDir: %v", err) t.FailNow() } cacheFile := path.Join(fullDir, "foo", "bar", schemaFileName) err = writeSchemaFile(output, fullDir, cacheFile, "foo", "bar") if err != nil { t.Errorf("Error building old cache schema: %v", err) t.FailNow() } obj := &extensions.Deployment{} data, err := runtime.Encode(testapi.Extensions.Codec(), obj) if err != nil { t.Errorf("unexpected error: %v", err) t.FailNow() } // Re-get request, should use HTTP and write if getSchemaAndValidate(c, data, "foo", "bar", dir, nil); err != nil { t.Errorf("unexpected error validating: %v", err) } if requests["/swaggerapi/foo/bar"] != 1 { t.Errorf("expected 1 schema request, saw: %d", requests["/swaggerapi/foo/bar"]) } }
explode_data.jsonl/43207
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 687 }
[ 2830, 3393, 3945, 2995, 8632, 4498, 13799, 37, 6209, 1155, 353, 8840, 836, 8, 341, 1903, 3416, 11, 1848, 1669, 2795, 8632, 2461, 2271, 741, 743, 1848, 961, 2092, 341, 197, 3244, 13080, 445, 1454, 8277, 10802, 25, 1018, 85, 497, 1848, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestRemoteNoRemoteStatus(t *testing.T) { output := `On branch test nothing to commit, working tree clean` mockRunner := NewMockRunner(output) git := NewCustomGit(mockRunner) repo := &Repo{Path: "/test/"} status := git.Status(repo) if !strings.HasPrefix(status, NO_REMOTE) { t.Errorf("Should be no remote status") } }
explode_data.jsonl/14066
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 120 }
[ 2830, 3393, 24703, 2753, 24703, 2522, 1155, 353, 8840, 836, 8, 341, 21170, 1669, 1565, 1925, 8870, 1273, 198, 41212, 311, 5266, 11, 3238, 4916, 4240, 19324, 77333, 19486, 1669, 1532, 11571, 19486, 11057, 340, 90731, 1669, 1532, 10268, 465...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestFragmentOnly(t *testing.T) { in := "#/fragment/only" r1, err := New(in) if err != nil { t.Errorf("New(%v) error %s", in, err.Error()) } if in != r1.String() { t.Errorf("New(%v) = %v, expect %v", in, r1.String(), in) } if r1.HasFragmentOnly != true { t.Errorf("New(%v)::HasFragmentOnly %v expect %v", in, r1.HasFragmentOnly, true) } if r1.HasFullURL != false { t.Errorf("New(%v)::HasFullURL %v expect %v", in, r1.HasFullURL, false) } if r1.HasURLPathOnly != false { t.Errorf("New(%v)::HasURLPathOnly %v expect %v", in, r1.HasURLPathOnly, false) } if r1.HasFileScheme != false { t.Errorf("New(%v)::HasFileScheme %v expect %v", in, r1.HasFileScheme, false) } if r1.GetPointer().String() != "/fragment/only" { t.Errorf("New(%v)::GetPointer() %v expect %v", in, r1.GetPointer().String(), "/fragment/only") } p, _ := jsonpointer.New(r1.referenceURL.Fragment) r2 := Ref{referencePointer: p, HasFragmentOnly: true} assert.Equal(t, r2.String(), in) r3 := Ref{referencePointer: p, HasFragmentOnly: false} assert.Equal(t, r3.String(), in[1:]) }
explode_data.jsonl/13765
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 481 }
[ 2830, 3393, 9488, 7308, 1155, 353, 8840, 836, 8, 1476, 17430, 1669, 5869, 14, 42202, 14, 3243, 1837, 7000, 16, 11, 1848, 1669, 1532, 5900, 340, 743, 1848, 961, 2092, 341, 197, 3244, 13080, 445, 3564, 15238, 85, 8, 1465, 1018, 82, 49...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
8
func TestReconcileAnalysisRunResumeInProgress(t *testing.T) { f := newFixture(t) defer f.Close() c, _, _ := f.newController(noResyncPeriodFunc) run := v1alpha1.AnalysisRun{ Spec: v1alpha1.AnalysisRunSpec{ Metrics: []v1alpha1.Metric{{ Name: "test", Provider: v1alpha1.MetricProvider{ Job: &v1alpha1.JobMetric{}, }, }}, }, Status: v1alpha1.AnalysisRunStatus{ Phase: v1alpha1.AnalysisPhaseRunning, MetricResults: []v1alpha1.MetricResult{{ Name: "test", Phase: v1alpha1.AnalysisPhaseRunning, Measurements: []v1alpha1.Measurement{{ Phase: v1alpha1.AnalysisPhaseRunning, StartedAt: timePtr(metav1.NewTime(time.Now().Add(-60 * time.Second))), }}, }}, }, } // mocks resume to complete the in-progress measurement f.provider.On("Resume", mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(newMeasurement(v1alpha1.AnalysisPhaseSuccessful), nil) newRun := c.reconcileAnalysisRun(&run) assert.Equal(t, v1alpha1.AnalysisPhaseSuccessful, newRun.Status.Phase) assert.Equal(t, v1alpha1.AnalysisPhaseSuccessful, newRun.Status.MetricResults[0].Phase) assert.Equal(t, v1alpha1.AnalysisPhaseSuccessful, newRun.Status.MetricResults[0].Measurements[0].Phase) assert.NotNil(t, newRun.Status.MetricResults[0].Measurements[0].FinishedAt) }
explode_data.jsonl/75831
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 529 }
[ 2830, 3393, 693, 40446, 457, 26573, 6727, 28563, 88711, 1155, 353, 8840, 836, 8, 341, 1166, 1669, 501, 18930, 1155, 340, 16867, 282, 10421, 741, 1444, 11, 8358, 716, 1669, 282, 4618, 2051, 39205, 1061, 1721, 23750, 9626, 692, 56742, 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 TestNewMultiError(t *testing.T) { var errorSet []error errorSet = append(errorSet, errors.New("invalid")) errorSet = append(errorSet, errors.New("fatal")) multiError := NewMultiError(errorSet) if fmt.Sprintf("%v", errorSet) != multiError.Error() { t.Fatal("Test NewMultiError()") } }
explode_data.jsonl/57817
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 106 }
[ 2830, 3393, 3564, 20358, 1454, 1155, 353, 8840, 836, 8, 341, 2405, 1465, 1649, 3056, 841, 198, 18290, 1649, 284, 8737, 6390, 1649, 11, 5975, 7121, 445, 11808, 5455, 18290, 1649, 284, 8737, 6390, 1649, 11, 5975, 7121, 445, 74394, 28075, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestAuthOnlyEndpointAccepted(t *testing.T) { test, err := NewAuthOnlyEndpointTest("") if err != nil { t.Fatal(err) } created := time.Now() startSession := &sessions.SessionState{ Email: "michael.bland@gsa.gov", AccessToken: "my_access_token", CreatedAt: &created} err = test.SaveSession(startSession) assert.NoError(t, err) test.proxy.ServeHTTP(test.rw, test.req) assert.Equal(t, http.StatusAccepted, test.rw.Code) bodyBytes, _ := ioutil.ReadAll(test.rw.Body) assert.Equal(t, "", string(bodyBytes)) }
explode_data.jsonl/36404
{ "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, 5087, 7308, 27380, 65906, 1155, 353, 8840, 836, 8, 341, 18185, 11, 1848, 1669, 1532, 5087, 7308, 27380, 2271, 31764, 743, 1848, 961, 2092, 341, 197, 3244, 26133, 3964, 340, 197, 630, 197, 7120, 1669, 882, 13244, 741, 21375, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestSaveRoles(t *testing.T) { auth := NewAuthenticator(gTestBucket, nil) role, _ := auth.NewRole("testRole", ch.SetOf("test")) err := auth.Save(role) assert.Equals(t, err, nil) role2, err := auth.GetRole("testRole") assert.Equals(t, err, nil) assert.DeepEquals(t, role2, role) }
explode_data.jsonl/31560
{ "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, 8784, 25116, 1155, 353, 8840, 836, 8, 341, 78011, 1669, 1532, 5087, 61393, 3268, 2271, 36018, 11, 2092, 340, 197, 5778, 11, 716, 1669, 4166, 7121, 9030, 445, 1944, 9030, 497, 521, 4202, 2124, 445, 1944, 5455, 9859, 1669, 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 TestDiffBasicNoDiffs(t *testing.T) { s := newScaffold(t) defer s.reset() d := &dg{cmValue: "bar"} s.client.getFunc = d.get err := s.executeCommand("diff", "dev", "-k", "configmaps", "--ignore-all-annotations", "--ignore-all-labels", "--show-deletes=false") require.NoError(t, err) }
explode_data.jsonl/72083
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 122 }
[ 2830, 3393, 21751, 15944, 2753, 35, 18852, 1155, 353, 8840, 836, 8, 341, 1903, 1669, 501, 50, 27864, 1155, 340, 16867, 274, 13857, 741, 2698, 1669, 609, 35138, 90, 6226, 1130, 25, 330, 2257, 16707, 1903, 6581, 670, 9626, 284, 294, 670...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestUpdateTeamMemberRoles(t *testing.T) { th := Setup(t).InitBasic() defer th.TearDown() Client := th.Client SystemAdminClient := th.SystemAdminClient const TEAM_MEMBER = "team_user" const TEAM_ADMIN = "team_user team_admin" // user 1 tries to promote user 2 ok, resp := Client.UpdateTeamMemberRoles(th.BasicTeam.Id, th.BasicUser2.Id, TEAM_ADMIN) CheckForbiddenStatus(t, resp) require.False(t, ok, "should have returned false") // user 1 tries to promote himself _, resp = Client.UpdateTeamMemberRoles(th.BasicTeam.Id, th.BasicUser.Id, TEAM_ADMIN) CheckForbiddenStatus(t, resp) // user 1 tries to demote someone _, resp = Client.UpdateTeamMemberRoles(th.BasicTeam.Id, th.SystemAdminUser.Id, TEAM_MEMBER) CheckForbiddenStatus(t, resp) // system admin promotes user 1 ok, resp = SystemAdminClient.UpdateTeamMemberRoles(th.BasicTeam.Id, th.BasicUser.Id, TEAM_ADMIN) CheckNoError(t, resp) require.True(t, ok, "should have returned true") // user 1 (team admin) promotes user 2 _, resp = Client.UpdateTeamMemberRoles(th.BasicTeam.Id, th.BasicUser2.Id, TEAM_ADMIN) CheckNoError(t, resp) // user 1 (team admin) demotes user 2 (team admin) _, resp = Client.UpdateTeamMemberRoles(th.BasicTeam.Id, th.BasicUser2.Id, TEAM_MEMBER) CheckNoError(t, resp) // user 1 (team admin) tries to demote system admin (not member of a team) _, resp = Client.UpdateTeamMemberRoles(th.BasicTeam.Id, th.SystemAdminUser.Id, TEAM_MEMBER) CheckNotFoundStatus(t, resp) // user 1 (team admin) demotes system admin (member of a team) th.LinkUserToTeam(th.SystemAdminUser, th.BasicTeam) _, resp = Client.UpdateTeamMemberRoles(th.BasicTeam.Id, th.SystemAdminUser.Id, TEAM_MEMBER) CheckNoError(t, resp) // Note from API v3 // Note to anyone who thinks this (above) test is wrong: // This operation will not affect the system admin's permissions because they have global access to all teams. // Their team level permissions are irrelevant. A team admin should be able to manage team level permissions. // System admins should be able to manipulate permission no matter what their team level permissions are. // system admin promotes user 2 _, resp = SystemAdminClient.UpdateTeamMemberRoles(th.BasicTeam.Id, th.BasicUser2.Id, TEAM_ADMIN) CheckNoError(t, resp) // system admin demotes user 2 (team admin) _, resp = SystemAdminClient.UpdateTeamMemberRoles(th.BasicTeam.Id, th.BasicUser2.Id, TEAM_MEMBER) CheckNoError(t, resp) // user 1 (team admin) tries to promote himself to a random team _, resp = Client.UpdateTeamMemberRoles(model.NewId(), th.BasicUser.Id, TEAM_ADMIN) CheckForbiddenStatus(t, resp) // user 1 (team admin) tries to promote a random user _, resp = Client.UpdateTeamMemberRoles(th.BasicTeam.Id, model.NewId(), TEAM_ADMIN) CheckNotFoundStatus(t, resp) // user 1 (team admin) tries to promote invalid team permission _, resp = Client.UpdateTeamMemberRoles(th.BasicTeam.Id, th.BasicUser.Id, "junk") CheckBadRequestStatus(t, resp) // user 1 (team admin) demotes himself _, resp = Client.UpdateTeamMemberRoles(th.BasicTeam.Id, th.BasicUser.Id, TEAM_MEMBER) CheckNoError(t, resp) }
explode_data.jsonl/70732
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1030 }
[ 2830, 3393, 4289, 14597, 9366, 25116, 1155, 353, 8840, 836, 8, 341, 70479, 1669, 18626, 1155, 568, 3803, 15944, 741, 16867, 270, 836, 682, 4454, 741, 71724, 1669, 270, 11716, 198, 5816, 7210, 2959, 1669, 270, 16620, 7210, 2959, 271, 477...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestCantMergeUnrelated(t *testing.T) { onGiteaRun(t, func(t *testing.T, giteaURL *url.URL) { session := loginUser(t, "user1") testRepoFork(t, session, "user2", "repo1", "user1", "repo1") testEditFileToNewBranch(t, session, "user1", "repo1", "master", "base", "README.md", "Hello, World (Edited Twice)\n") // Now we want to create a commit on a branch that is totally unrelated to our current head // Drop down to pure code at this point user1 := models.AssertExistsAndLoadBean(t, &models.User{ Name: "user1", }).(*models.User) repo1 := models.AssertExistsAndLoadBean(t, &models.Repository{ OwnerID: user1.ID, Name: "repo1", }).(*models.Repository) path := models.RepoPath(user1.Name, repo1.Name) _, err := git.NewCommand("read-tree", "--empty").RunInDir(path) assert.NoError(t, err) stdin := bytes.NewBufferString("Unrelated File") var stdout strings.Builder err = git.NewCommand("hash-object", "-w", "--stdin").RunInDirFullPipeline(path, &stdout, nil, stdin) assert.NoError(t, err) sha := strings.TrimSpace(stdout.String()) _, err = git.NewCommand("update-index", "--add", "--replace", "--cacheinfo", "100644", sha, "somewher-over-the-rainbow").RunInDir(path) assert.NoError(t, err) treeSha, err := git.NewCommand("write-tree").RunInDir(path) assert.NoError(t, err) treeSha = strings.TrimSpace(treeSha) commitTimeStr := time.Now().Format(time.RFC3339) doerSig := user1.NewGitSig() env := append(os.Environ(), "GIT_AUTHOR_NAME="+doerSig.Name, "GIT_AUTHOR_EMAIL="+doerSig.Email, "GIT_AUTHOR_DATE="+commitTimeStr, "GIT_COMMITTER_NAME="+doerSig.Name, "GIT_COMMITTER_EMAIL="+doerSig.Email, "GIT_COMMITTER_DATE="+commitTimeStr, ) messageBytes := new(bytes.Buffer) _, _ = messageBytes.WriteString("Unrelated") _, _ = messageBytes.WriteString("\n") stdout.Reset() err = git.NewCommand("commit-tree", treeSha).RunInDirTimeoutEnvFullPipeline(env, -1, path, &stdout, nil, messageBytes) assert.NoError(t, err) commitSha := strings.TrimSpace(stdout.String()) _, err = git.NewCommand("branch", "unrelated", commitSha).RunInDir(path) assert.NoError(t, err) testEditFileToNewBranch(t, session, "user1", "repo1", "master", "conflict", "README.md", "Hello, World (Edited Once)\n") // Use API to create a conflicting pr token := getTokenForLoggedInUser(t, session) req := NewRequestWithJSON(t, http.MethodPost, fmt.Sprintf("/api/v1/repos/%s/%s/pulls?token=%s", "user1", "repo1", token), &api.CreatePullRequestOption{ Head: "unrelated", Base: "base", Title: "create an unrelated pr", }) session.MakeRequest(t, req, 201) // Now this PR could be marked conflict - or at least a race may occur - so drop down to pure code at this point... gitRepo, err := git.OpenRepository(path) assert.NoError(t, err) pr := models.AssertExistsAndLoadBean(t, &models.PullRequest{ HeadRepoID: repo1.ID, BaseRepoID: repo1.ID, HeadBranch: "unrelated", BaseBranch: "base", }).(*models.PullRequest) err = pull.Merge(pr, user1, gitRepo, models.MergeStyleMerge, "UNRELATED") assert.Error(t, err, "Merge should return an error due to unrelated") assert.True(t, models.IsErrMergeUnrelatedHistories(err), "Merge error is not a unrelated histories error") gitRepo.Close() }) }
explode_data.jsonl/70640
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1335 }
[ 2830, 3393, 34, 517, 52096, 1806, 9721, 1155, 353, 8840, 836, 8, 341, 24630, 38, 632, 64, 6727, 1155, 11, 2915, 1155, 353, 8840, 836, 11, 342, 632, 64, 3144, 353, 1085, 20893, 8, 341, 197, 25054, 1669, 87169, 1155, 11, 330, 872, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestLookupNil(t *testing.T) { fm := File{Next: test.ErrorHandler(), Zones: Zones{Z: map[string]*Zone{testzone: nil}, Names: []string{testzone}}} ctx := context.TODO() m := dnsTestCases[0].Msg() rec := dnstest.NewRecorder(&test.ResponseWriter{}) fm.ServeDNS(ctx, rec, m) }
explode_data.jsonl/68725
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 115 }
[ 2830, 3393, 34247, 19064, 1155, 353, 8840, 836, 8, 341, 1166, 76, 1669, 2887, 90, 5847, 25, 1273, 6141, 3050, 1507, 94586, 25, 94586, 90, 57, 25, 2415, 14032, 8465, 15363, 90, 1944, 8684, 25, 2092, 2137, 34875, 25, 3056, 917, 90, 19...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestReaderBuf(t *testing.T) { testReaderBuf(t, 1024*1024, func(r io.Reader) io.Reader { return r }) testReaderBuf(t, 1024*1024, iotest.DataErrReader) testReaderBuf(t, 1024*1024, iotest.HalfReader) testReaderBuf(t, 1024*1024, iotest.OneByteReader) testReaderBuf(t, 64*1024+3, func(r io.Reader) io.Reader { return r }) testReaderBuf(t, 64*1024+3, iotest.DataErrReader) testReaderBuf(t, 64*1024+3, iotest.HalfReader) testReaderBuf(t, 64*1024+3, iotest.OneByteReader) }
explode_data.jsonl/11259
{ "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, 5062, 15064, 1155, 353, 8840, 836, 8, 341, 18185, 5062, 15064, 1155, 11, 220, 16, 15, 17, 19, 9, 16, 15, 17, 19, 11, 2915, 2601, 6399, 47431, 8, 6399, 47431, 314, 470, 435, 2751, 18185, 5062, 15064, 1155, 11, 220, 16, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestRouterStatic(t *testing.T) { e := New() r := e.router path := "/folders/a/files/echo.gif" r.Add(http.MethodGet, path, func(c Context) error { c.Set("path", path) return nil }) c := e.NewContext(nil, nil).(*context) r.Find(http.MethodGet, path, c) c.handler(c) assert.Equal(t, path, c.Get("path")) }
explode_data.jsonl/47114
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 140 }
[ 2830, 3393, 9523, 11690, 1155, 353, 8840, 836, 8, 341, 7727, 1669, 1532, 741, 7000, 1669, 384, 22125, 198, 26781, 1669, 3521, 67355, 14186, 33220, 14, 3047, 16008, 698, 7000, 1904, 19886, 20798, 1949, 11, 1815, 11, 2915, 1337, 9608, 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 TestRoundTripManagedFields(t *testing.T) { tests := []string{ `- apiVersion: v1 fieldsType: FieldsV1 fieldsV1: v:3: f:alsoPi: {} v:3.1415: f:pi: {} v:false: f:notTrue: {} manager: foo operation: Update time: "2001-02-03T04:05:06Z" - apiVersion: v1beta1 fieldsType: FieldsV1 fieldsV1: i:5: f:i: {} manager: foo operation: Update time: "2011-12-13T14:15:16Z" `, `- apiVersion: v1 fieldsType: FieldsV1 fieldsV1: f:spec: f:containers: k:{"name":"c"}: f:image: {} f:name: {} manager: foo operation: Apply `, `- apiVersion: v1 fieldsType: FieldsV1 fieldsV1: f:apiVersion: {} f:kind: {} f:metadata: f:labels: f:app: {} f:name: {} f:spec: f:replicas: {} f:selector: f:matchLabels: f:app: {} f:template: f:medatada: f:labels: f:app: {} f:spec: f:containers: k:{"name":"nginx"}: .: {} f:image: {} f:name: {} f:ports: i:0: f:containerPort: {} manager: foo operation: Update `, `- apiVersion: v1 fieldsType: FieldsV1 fieldsV1: f:allowVolumeExpansion: {} f:apiVersion: {} f:kind: {} f:metadata: f:name: {} f:parameters: f:resturl: {} f:restuser: {} f:secretName: {} f:secretNamespace: {} f:provisioner: {} manager: foo operation: Apply `, `- apiVersion: v1 fieldsType: FieldsV1 fieldsV1: f:apiVersion: {} f:kind: {} f:metadata: f:name: {} f:spec: f:group: {} f:names: f:kind: {} f:plural: {} f:shortNames: i:0: {} f:singular: {} f:scope: {} f:versions: k:{"name":"v1"}: f:name: {} f:served: {} f:storage: {} manager: foo operation: Update `, } for _, test := range tests { t.Run(test, func(t *testing.T) { var unmarshaled []metav1.ManagedFieldsEntry if err := yaml.Unmarshal([]byte(test), &unmarshaled); err != nil { t.Fatalf("did not expect yaml unmarshalling error but got: %v", err) } decoded, err := decodeManagedFields(unmarshaled) if err != nil { t.Fatalf("did not expect decoding error but got: %v", err) } encoded, err := encodeManagedFields(decoded) if err != nil { t.Fatalf("did not expect encoding error but got: %v", err) } marshaled, err := yaml.Marshal(&encoded) if err != nil { t.Fatalf("did not expect yaml marshalling error but got: %v", err) } if !reflect.DeepEqual(string(marshaled), test) { t.Fatalf("expected:\n%v\nbut got:\n%v", test, string(marshaled)) } }) } }
explode_data.jsonl/68834
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1459 }
[ 2830, 3393, 27497, 56352, 27192, 8941, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 3056, 917, 515, 197, 197, 63, 12, 6330, 5637, 25, 348, 16, 198, 220, 5043, 929, 25, 24580, 53, 16, 198, 220, 5043, 53, 16, 510, 262, 348, 25, 18, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
6
func TestHeader(t *testing.T) { mediaType := "text/plain" mediaParams := map[string]string{"charset": "utf-8"} desc := "Plan de complémentarité de l'Homme" disp := "attachment" dispParams := map[string]string{"filename": "complémentarité.txt"} var h Header h.SetContentType(mediaType, mediaParams) h.SetText("Content-Description", desc) h.SetContentDisposition(disp, dispParams) if gotMediaType, gotParams, err := h.ContentType(); err != nil { t.Error("Expected no error when parsing content type, but got:", err) } else if gotMediaType != mediaType { t.Errorf("Expected media type %q but got %q", mediaType, gotMediaType) } else if !reflect.DeepEqual(gotParams, mediaParams) { t.Errorf("Expected media params %v but got %v", mediaParams, gotParams) } if gotDesc, err := h.Text("Content-Description"); err != nil { t.Error("Expected no error when parsing content description, but got:", err) } else if gotDesc != desc { t.Errorf("Expected content description %q but got %q", desc, gotDesc) } if gotDisp, gotParams, err := h.ContentDisposition(); err != nil { t.Error("Expected no error when parsing content disposition, but got:", err) } else if gotDisp != disp { t.Errorf("Expected disposition %q but got %q", disp, gotDisp) } else if !reflect.DeepEqual(gotParams, dispParams) { t.Errorf("Expected disposition params %v but got %v", dispParams, gotParams) } }
explode_data.jsonl/55152
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 487 }
[ 2830, 3393, 4047, 1155, 353, 8840, 836, 8, 341, 197, 7399, 929, 1669, 330, 1318, 36971, 698, 197, 7399, 4870, 1669, 2415, 14032, 30953, 4913, 25327, 788, 330, 4762, 12, 23, 16707, 41653, 1669, 330, 20485, 409, 4581, 41525, 277, 12815, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
9
func TestAddRetractValidateVersion(t *testing.T) { for _, tt := range addRetractValidateVersionTests { t.Run(tt.dsc, func(t *testing.T) { f, err := Parse("in", []byte("module m"), nil) if err != nil { t.Fatal(err) } if err = f.AddRetract(VersionInterval{Low: tt.low, High: tt.high}, ""); err == nil { t.Fatal("expected AddRetract to complain about version format") } }) } }
explode_data.jsonl/74342
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 173 }
[ 2830, 3393, 2212, 12020, 81, 531, 17926, 5637, 1155, 353, 8840, 836, 8, 341, 2023, 8358, 17853, 1669, 2088, 912, 12020, 81, 531, 17926, 5637, 18200, 341, 197, 3244, 16708, 47152, 950, 2388, 11, 2915, 1155, 353, 8840, 836, 8, 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...
3
func TestTrimSpaceAndNonPrintable_space(t *testing.T) { extraChars := " state \r\t" want := "state" got := TrimSpaceAndNonPrintable(extraChars) if want != got { t.Fatalf("wrong trim, want: %q got: %q", want, got) } }
explode_data.jsonl/62250
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 92 }
[ 2830, 3393, 25656, 9914, 3036, 8121, 8994, 480, 14663, 1155, 353, 8840, 836, 8, 341, 8122, 2172, 32516, 1669, 330, 1584, 220, 1124, 81, 4955, 698, 50780, 1669, 330, 2454, 698, 3174, 354, 1669, 44376, 9914, 3036, 8121, 8994, 480, 83790, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestRSAKeyGenEphemeral(t *testing.T) { t.Parallel() provider, _, cleanup := currentTestConfig.Provider(t) defer cleanup() k, err := provider.KeyGen(&bccsp.RSAKeyGenOpts{Temporary: true}) if err != nil { t.Fatalf("Failed generating RSA key [%s]", err) } if k == nil { t.Fatal("Failed generating RSA key. Key must be different from nil") } if !k.Private() { t.Fatal("Failed generating RSA key. Key should be private") } if k.Symmetric() { t.Fatal("Failed generating RSA key. Key should be asymmetric") } pk, err := k.PublicKey() if err != nil { t.Fatalf("Failed generating RSA corresponding public key [%s]", err) } if pk == nil { t.Fatal("PK must be different from nil") } b, err := k.Bytes() if err == nil { t.Fatal("Secret keys cannot be exported. It must fail in this case") } if len(b) != 0 { t.Fatal("Secret keys cannot be exported. It must be nil") } }
explode_data.jsonl/29280
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 344 }
[ 2830, 3393, 73564, 1592, 9967, 36, 59941, 3253, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 741, 197, 19979, 11, 8358, 21290, 1669, 1482, 2271, 2648, 36208, 1155, 340, 16867, 21290, 2822, 16463, 11, 1848, 1669, 9109, 9610, 9967, 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...
9
func TestBuildServiceMapServiceUpdate(t *testing.T) { fp := newFakeProxier() servicev1 := makeTestService("ns1", "svc1", func(svc *v1.Service) { svc.Spec.Type = v1.ServiceTypeClusterIP svc.Spec.ClusterIP = "172.16.55.4" svc.Spec.Ports = addTestPort(svc.Spec.Ports, "p1", "UDP", 1234, 4321, 0) svc.Spec.Ports = addTestPort(svc.Spec.Ports, "p2", "TCP", 1235, 5321, 0) }) servicev2 := makeTestService("ns1", "svc1", func(svc *v1.Service) { svc.Spec.Type = v1.ServiceTypeLoadBalancer svc.Spec.ClusterIP = "172.16.55.4" svc.Spec.LoadBalancerIP = "5.6.7.8" svc.Spec.Ports = addTestPort(svc.Spec.Ports, "p1", "UDP", 1234, 4321, 7002) svc.Spec.Ports = addTestPort(svc.Spec.Ports, "p2", "TCP", 1235, 5321, 7003) svc.Status.LoadBalancer = v1.LoadBalancerStatus{ Ingress: []v1.LoadBalancerIngress{ {IP: "10.1.2.3"}, }, } svc.Spec.ExternalTrafficPolicy = v1.ServiceExternalTrafficPolicyTypeLocal svc.Spec.HealthCheckNodePort = 345 }) fp.addService(servicev1) result := UpdateServiceMap(fp.serviceMap, fp.serviceChanges) if len(fp.serviceMap) != 2 { t.Errorf("expected service map length 2, got %v", fp.serviceMap) } if len(result.HCServiceNodePorts) != 0 { t.Errorf("expected healthcheck ports length 0, got %v", result.HCServiceNodePorts) } if len(result.UDPStaleClusterIP) != 0 { // Services only added, so nothing stale yet t.Errorf("expected stale UDP services length 0, got %d", len(result.UDPStaleClusterIP)) } // Change service to load-balancer fp.updateService(servicev1, servicev2) result = UpdateServiceMap(fp.serviceMap, fp.serviceChanges) if len(fp.serviceMap) != 2 { t.Errorf("expected service map length 2, got %v", fp.serviceMap) } if len(result.HCServiceNodePorts) != 1 { t.Errorf("expected healthcheck ports length 1, got %v", result.HCServiceNodePorts) } if len(result.UDPStaleClusterIP) != 0 { t.Errorf("expected stale UDP services length 0, got %v", result.UDPStaleClusterIP.UnsortedList()) } // No change; make sure the service map stays the same and there are // no health-check changes fp.updateService(servicev2, servicev2) result = UpdateServiceMap(fp.serviceMap, fp.serviceChanges) if len(fp.serviceMap) != 2 { t.Errorf("expected service map length 2, got %v", fp.serviceMap) } if len(result.HCServiceNodePorts) != 1 { t.Errorf("expected healthcheck ports length 1, got %v", result.HCServiceNodePorts) } if len(result.UDPStaleClusterIP) != 0 { t.Errorf("expected stale UDP services length 0, got %v", result.UDPStaleClusterIP.UnsortedList()) } // And back to ClusterIP fp.updateService(servicev2, servicev1) result = UpdateServiceMap(fp.serviceMap, fp.serviceChanges) if len(fp.serviceMap) != 2 { t.Errorf("expected service map length 2, got %v", fp.serviceMap) } if len(result.HCServiceNodePorts) != 0 { t.Errorf("expected healthcheck ports length 0, got %v", result.HCServiceNodePorts) } if len(result.UDPStaleClusterIP) != 0 { // Services only added, so nothing stale yet t.Errorf("expected stale UDP services length 0, got %d", len(result.UDPStaleClusterIP)) } }
explode_data.jsonl/22233
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1222 }
[ 2830, 3393, 11066, 1860, 2227, 1860, 4289, 1155, 353, 8840, 836, 8, 341, 65219, 1669, 501, 52317, 1336, 87, 1268, 2822, 52934, 85, 16, 1669, 1281, 2271, 1860, 445, 4412, 16, 497, 330, 58094, 16, 497, 2915, 1141, 7362, 353, 85, 16, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestAnalyseRhyme1(t *testing.T) { rs := []rune("下中翁动守风空梦") strs := []string{} for _, zhch := range rs { strs = append(strs, string(zhch)) } var cr ChineseRhymes cr.ImportFile("ShiYunXinBian.txt") cr.AnalyseRhyme(strs) }
explode_data.jsonl/15080
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 123 }
[ 2830, 3393, 73307, 325, 72162, 30118, 16, 1155, 353, 8840, 836, 8, 341, 41231, 1669, 3056, 81, 2886, 445, 16872, 15946, 108017, 27733, 99821, 99208, 34794, 99815, 1138, 11355, 82, 1669, 3056, 917, 16094, 2023, 8358, 59748, 331, 1669, 2088...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestValidateServiceRole(t *testing.T) { cases := []struct { name string in proto.Message expectErrMsg string }{ { name: "invalid proto", expectErrMsg: "cannot cast to ServiceRole", }, { name: "empty rules", in: &rbac.ServiceRole{}, expectErrMsg: "at least 1 rule must be specified", }, { name: "no service", in: &rbac.ServiceRole{Rules: []*rbac.AccessRule{ { Services: []string{"service0"}, Methods: []string{"GET", "POST"}, Constraints: []*rbac.AccessRule_Constraint{ {Key: "key", Values: []string{"value"}}, {Key: "key", Values: []string{"value"}}, }, }, { Services: []string{}, Methods: []string{"GET", "POST"}, Constraints: []*rbac.AccessRule_Constraint{ {Key: "key", Values: []string{"value"}}, {Key: "key", Values: []string{"value"}}, }, }, }}, expectErrMsg: "at least 1 service must be specified for rule 1", }, { name: "no key in constraint", in: &rbac.ServiceRole{Rules: []*rbac.AccessRule{ { Services: []string{"service0"}, Methods: []string{"GET", "POST"}, Constraints: []*rbac.AccessRule_Constraint{ {Key: "key", Values: []string{"value"}}, {Key: "key", Values: []string{"value"}}, }, }, { Services: []string{"service0"}, Methods: []string{"GET", "POST"}, Constraints: []*rbac.AccessRule_Constraint{ {Key: "key", Values: []string{"value"}}, {Values: []string{"value"}}, }, }, }}, expectErrMsg: "key cannot be empty for constraint 1 in rule 1", }, { name: "no value in constraint", in: &rbac.ServiceRole{Rules: []*rbac.AccessRule{ { Services: []string{"service0"}, Methods: []string{"GET", "POST"}, Constraints: []*rbac.AccessRule_Constraint{ {Key: "key", Values: []string{"value"}}, {Key: "key", Values: []string{"value"}}, }, }, { Services: []string{"service0"}, Methods: []string{"GET", "POST"}, Constraints: []*rbac.AccessRule_Constraint{ {Key: "key", Values: []string{"value"}}, {Key: "key", Values: []string{}}, }, }, }}, expectErrMsg: "at least 1 value must be specified for constraint 1 in rule 1", }, { name: "success proto", in: &rbac.ServiceRole{Rules: []*rbac.AccessRule{ { Services: []string{"service0"}, Methods: []string{"GET", "POST"}, Constraints: []*rbac.AccessRule_Constraint{ {Key: "key", Values: []string{"value"}}, {Key: "key", Values: []string{"value"}}, }, }, { Services: []string{"service0"}, Methods: []string{"GET", "POST"}, Constraints: []*rbac.AccessRule_Constraint{ {Key: "key", Values: []string{"value"}}, {Key: "key", Values: []string{"value"}}, }, }, }}, }, } for _, c := range cases { err := ValidateServiceRole(someName, someNamespace, c.in) if err == nil { if len(c.expectErrMsg) != 0 { t.Errorf("ValidateServiceRole(%v): got nil but want %q\n", c.name, c.expectErrMsg) } } else if err.Error() != c.expectErrMsg { t.Errorf("ValidateServiceRole(%v): got %q but want %q\n", c.name, err.Error(), c.expectErrMsg) } } }
explode_data.jsonl/56931
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1517 }
[ 2830, 3393, 17926, 1860, 9030, 1155, 353, 8840, 836, 8, 341, 1444, 2264, 1669, 3056, 1235, 341, 197, 11609, 260, 914, 198, 197, 17430, 1843, 18433, 8472, 198, 197, 24952, 75449, 914, 198, 197, 59403, 197, 197, 515, 298, 11609, 25, 260...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestCreateGetDeleteAccessTokenSession(t *testing.T) { t.Parallel() for k, m := range fositeStores { t.Run(fmt.Sprintf("case=%s", k), TestHelperCreateGetDeleteAccessTokenSession(m)) } }
explode_data.jsonl/54416
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 72 }
[ 2830, 3393, 4021, 1949, 6435, 37649, 5283, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 741, 2023, 595, 11, 296, 1669, 2088, 48390, 632, 69026, 341, 197, 3244, 16708, 28197, 17305, 445, 5638, 7846, 82, 497, 595, 701, 3393, 5511, 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 ]
2
func TestLongName(t *testing.T) { tests := []struct { input, expected string }{ {"Foo", "Foo"}, {"*Foo", "Foo"}, {"map[Foo]Bar", "MapFooBar"}, {"[]map[Foo]Bar", "SliceMapFooBar"}, {"[]map[Foo]struct{}", "SliceMapFooStruct"}, } for _, test := range tests { typ := Type{ Name: test.input, } if typ.LongName() != test.expected { t.Errorf("expected %q, got %q", test.expected, typ.LongName()) } } }
explode_data.jsonl/59766
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 195 }
[ 2830, 3393, 6583, 675, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 3056, 1235, 341, 197, 22427, 11, 3601, 914, 198, 197, 59403, 197, 197, 4913, 40923, 497, 330, 40923, 7115, 197, 197, 4913, 9, 40923, 497, 330, 40923, 7115, 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...
3
func Test_marshal_struct_of_struct(t *testing.T) { should := require.New(t) for _, c := range test.MarshalCombinations { obj := struct_of_struct_test.TestObject{ struct_of_struct_test.EmbeddedObject{"abc"}, } output, err := c.Marshal(obj) should.NoError(err) output1, err := c.Marshal(&obj) should.NoError(err) should.Equal(output, output1) var val general.Struct should.NoError(c.Unmarshal(output, &val)) should.Equal(general.Struct{ protocol.FieldId(1): "abc", }, val[protocol.FieldId(1)]) } }
explode_data.jsonl/47463
{ "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, 717, 28423, 15126, 3575, 15126, 1155, 353, 8840, 836, 8, 341, 197, 5445, 1669, 1373, 7121, 1155, 340, 2023, 8358, 272, 1669, 2088, 1273, 37271, 1092, 73629, 341, 197, 22671, 1669, 2036, 3575, 15126, 4452, 8787, 1190, 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 TestResultString(t *testing.T) { testcases := []struct { r result want string }{ { resultIncreased, `rate was: increased from: 100 to: 100 alias: cell1-0000000101 lag: 1s last change: 1.2s rate: 99 good/bad? good skipped b/c: good/bad: 95/0 state (old/tested/new): I/I/I lag before: n/a (n/a ago) rates (master/replica): 99/0 backlog (old/new): 0/0 reason: increased the rate`, }, { resultDecreased, `rate was: decreased from: 200 to: 100 alias: cell1-0000000101 lag: 2s last change: 3.8s rate: 200 good/bad? bad skipped b/c: good/bad: 95/200 state (old/tested/new): I/D/D lag before: 1s (3.8s ago) rates (master/replica): 200/150 backlog (old/new): 10/20 reason: decreased the rate`, }, { resultEmergency, `rate was: decreased from: 100 to: 50 alias: cell1-0000000101 lag: 23s last change: 5.1s rate: 100 good/bad? bad skipped b/c: good/bad: 95/100 state (old/tested/new): D/E/E lag before: 2s (5.1s ago) rates (master/replica): 0/0 backlog (old/new): 0/0 reason: emergency state decreased the rate`, }, } for _, tc := range testcases { got := tc.r.String() if got != tc.want { t.Fatalf("record.String() = %v, want = %v for full record: %#v", got, tc.want, tc.r) } } }
explode_data.jsonl/82593
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 500 }
[ 2830, 3393, 2077, 703, 1155, 353, 8840, 836, 8, 341, 18185, 23910, 1669, 3056, 1235, 341, 197, 7000, 262, 1102, 198, 197, 50780, 914, 198, 197, 59403, 197, 197, 515, 298, 9559, 96841, 345, 298, 197, 63, 7698, 572, 25, 7172, 504, 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 TestCanSupport(t *testing.T) { tmpDir, err := utiltesting.MkTmpdir("fc_test") if err != nil { t.Fatalf("error creating temp dir: %v", err) } defer os.RemoveAll(tmpDir) plugMgr := volume.VolumePluginMgr{} plugMgr.InitPlugins(ProbeVolumePlugins(), volume.NewFakeVolumeHost(tmpDir, nil, nil)) plug, err := plugMgr.FindPluginByName("kubernetes.io/fc") if err != nil { t.Errorf("Can't find the plugin by name") } if plug.Name() != "kubernetes.io/fc" { t.Errorf("Wrong name: %s", plug.Name()) } if plug.CanSupport(&volume.Spec{Volume: &api.Volume{VolumeSource: api.VolumeSource{}}}) { t.Errorf("Expected false") } }
explode_data.jsonl/12299
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 255 }
[ 2830, 3393, 6713, 7916, 1155, 353, 8840, 836, 8, 341, 20082, 6184, 11, 1848, 1669, 4094, 8840, 1321, 74, 35986, 3741, 445, 8316, 4452, 1138, 743, 1848, 961, 2092, 341, 197, 3244, 30762, 445, 841, 6825, 2730, 5419, 25, 1018, 85, 497, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
5
func TestSuffixes(t *testing.T) { WithOptions( EditorConfig{ AllExperiments: true, }, ).Run(t, filesA, func(t *testing.T, env *Env) { env.OpenFile("a.tmpl") x := env.RegexpSearch("a.tmpl", `A`) file, pos := env.GoToDefinition("a.tmpl", x) refs := env.References(file, pos) if len(refs) != 2 { t.Fatalf("got %v reference(s), want 2", len(refs)) } // make sure we got one from b.gotmpl want := env.Sandbox.Workdir.URI("b.gotmpl") if refs[0].URI != want && refs[1].URI != want { t.Errorf("failed to find reference to %s", shorten(want)) for i, r := range refs { t.Logf("%d: URI:%s %v", i, shorten(r.URI), r.Range) } } content, npos := env.Hover(file, pos) if pos != npos { t.Errorf("pos? got %v, wanted %v", npos, pos) } if content.Value != "template A defined" { t.Errorf("got %s, wanted 'template A defined", content.Value) } }) }
explode_data.jsonl/12268
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 404 }
[ 2830, 3393, 40177, 288, 1155, 353, 8840, 836, 8, 341, 197, 74238, 1006, 197, 77351, 2648, 515, 298, 197, 2403, 840, 49632, 25, 830, 345, 197, 197, 1583, 197, 568, 6727, 1155, 11, 3542, 32, 11, 2915, 1155, 353, 8840, 836, 11, 6105, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestToASCII85(t *testing.T) { type args struct { r io.Reader } tests := []struct { name string args args want string }{ { name: "TestOne", args: args{r: strings.NewReader("This is only a test")}, want: "<+oue+DGm>Df0B:+CQC7ATMq", }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { if got, _ := io.ReadAll(ToASCII85(tt.args.r)); strings.Compare(string(got), tt.want) != 0 { t.Errorf("ToASCII85() = %v, want %v", string(got), tt.want) } }) } }
explode_data.jsonl/46459
{ "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, 1249, 56450, 23, 20, 1155, 353, 8840, 836, 8, 341, 13158, 2827, 2036, 341, 197, 7000, 6399, 47431, 198, 197, 532, 78216, 1669, 3056, 1235, 341, 197, 11609, 914, 198, 197, 31215, 2827, 198, 197, 50780, 914, 198, 197, 59403,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestIntArray_PushAndPop(t *testing.T) { gtest.C(t, func(t *gtest.T) { expect := []int{0, 1, 2, 3} array := garray.NewIntArrayFrom(expect) t.Assert(array.Slice(), expect) v, ok := array.PopLeft() t.Assert(v, 0) t.Assert(ok, true) v, ok = array.PopRight() t.Assert(v, 3) t.Assert(ok, true) v, ok = array.PopRand() t.AssertIN(v, []int{1, 2}) t.Assert(ok, true) v, ok = array.PopRand() t.AssertIN(v, []int{1, 2}) t.Assert(ok, true) v, ok = array.PopRand() t.Assert(v, 0) t.Assert(ok, false) t.Assert(array.Len(), 0) array.PushLeft(1).PushRight(2) t.Assert(array.Slice(), []int{1, 2}) }) }
explode_data.jsonl/47597
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 329 }
[ 2830, 3393, 95338, 1088, 1116, 3036, 11598, 1155, 353, 8840, 836, 8, 341, 3174, 1944, 727, 1155, 11, 2915, 1155, 353, 82038, 836, 8, 341, 197, 24952, 1669, 3056, 396, 90, 15, 11, 220, 16, 11, 220, 17, 11, 220, 18, 532, 197, 11923,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestRoundtripNoWrap(t *testing.T) { codec := RandMux() codec.Wrap = false f := func(o1 TestType) bool { var o2 TestType return mctest.RoundTripTest(t, codec, &o1, &o2) } if err := quick.Check(f, nil); err != nil { t.Error(err) } }
explode_data.jsonl/52651
{ "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, 27497, 32981, 2753, 26787, 1155, 353, 8840, 836, 8, 341, 43343, 66, 1669, 23963, 44, 2200, 741, 43343, 66, 38968, 284, 895, 198, 1166, 1669, 2915, 10108, 16, 3393, 929, 8, 1807, 341, 197, 2405, 297, 17, 3393, 929, 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...
1
func TestListMilestones(t *testing.T) { ts := httptest.NewTLSServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { if r.Method != http.MethodGet { t.Errorf("Bad method: %s", r.Method) } if r.URL.Path != "/repos/k8s/kuber/milestones" { t.Errorf("Bad request path: %s", r.URL.Path) } })) defer ts.Close() c := getClient(ts.URL) if err, _ := c.ListMilestones("k8s", "kuber"); err != nil { t.Errorf("Didn't expect error: %v", err) } }
explode_data.jsonl/6301
{ "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, 852, 44, 457, 32510, 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, 1949, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestTrafficSwitchStacksetExternalIngress(t *testing.T) { t.Parallel() stacksetName := "switch-traffic-stackset-external" firstVersion := "v1" firstStack := fmt.Sprintf("%s-%s", stacksetName, firstVersion) updatedVersion := "v2" updatedStack := fmt.Sprintf("%s-%s", stacksetName, updatedVersion) factory := NewTestStacksetSpecFactory(stacksetName).ExternalIngress() spec := factory.Create(firstVersion) err := createStackSet(stacksetName, 0, spec) require.NoError(t, err) _, err = waitForStack(t, stacksetName, firstVersion) require.NoError(t, err) spec = factory.Create(updatedVersion) err = updateStackset(stacksetName, spec) require.NoError(t, err) _, err = waitForStack(t, stacksetName, updatedVersion) require.NoError(t, err) initialWeights := map[string]float64{firstStack: 100} err = trafficWeightsUpdatedStackset(t, stacksetName, weightKindActual, initialWeights, nil).await() require.NoError(t, err) expectStackTrafficWeights(t, firstStack, 100, 100) expectStackTrafficWeights(t, updatedStack, 0, 0) // Switch traffic 50/50 desiredWeights := map[string]float64{firstStack: 50, updatedStack: 50} err = setDesiredTrafficWeightsStackset(stacksetName, desiredWeights) require.NoError(t, err) err = trafficWeightsUpdatedStackset(t, stacksetName, weightKindActual, desiredWeights, nil).await() require.NoError(t, err) expectStackTrafficWeights(t, firstStack, 50, 50) expectStackTrafficWeights(t, updatedStack, 50, 50) // Switch traffic 0/100 newDesiredWeights := map[string]float64{updatedStack: 100} err = setDesiredTrafficWeightsStackset(stacksetName, newDesiredWeights) require.NoError(t, err) err = trafficWeightsUpdatedStackset(t, stacksetName, weightKindActual, newDesiredWeights, nil).await() require.NoError(t, err) expectStackTrafficWeights(t, firstStack, 0, 0) expectStackTrafficWeights(t, updatedStack, 100, 100) }
explode_data.jsonl/14745
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 650 }
[ 2830, 3393, 87229, 16837, 4336, 746, 25913, 641, 2483, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 2822, 48227, 40730, 1669, 330, 17338, 12, 53987, 56090, 746, 12, 20921, 698, 42190, 5637, 1669, 330, 85, 16, 698, 42190, 4336, 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 Test_parseActivites(t *testing.T) { type args struct { activitySummariesData []plistutil.PlistData } tests := []struct { name string args args want []Activity wantErr bool }{ { name: "Simple case", args: args{[]plistutil.PlistData{{ "Title": "Start Test", "UUID": "CE23D189-E75A-437D-A4B5-B97F1658FC98", "StartTimeInterval": 568123776.87169898, }}}, want: []Activity{{ Title: "Start Test", UUID: "CE23D189-E75A-437D-A4B5-B97F1658FC98", Screenshots: nil, SubActivities: nil, }}, wantErr: false, }, { name: "Subactivty case", args: args{[]plistutil.PlistData{{ "Title": "Start Test", "UUID": "CE23D189-E75A-437D-A4B5-B97F1658FC98", "StartTimeInterval": 568123776.87169898, "SubActivities": []interface{}{ map[string]interface{}{ "Title": "Launch", "UUID": "1D7E1C6A-D0A3-432F-819F-64BE07C30517", "StartTimeInterval": 568123780.54294205, }, }, }}}, want: []Activity{{ Title: "Start Test", UUID: "CE23D189-E75A-437D-A4B5-B97F1658FC98", Screenshots: nil, SubActivities: []Activity{{ Title: "Launch", UUID: "1D7E1C6A-D0A3-432F-819F-64BE07C30517", Screenshots: nil, SubActivities: nil, }}, }}, wantErr: false, }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { got, err := parseActivites(tt.args.activitySummariesData) if (err != nil) != tt.wantErr { t.Errorf("parseActivites() error = %v, wantErr %v", err, tt.wantErr) return } if !reflect.DeepEqual(got, tt.want) { t.Errorf("parseActivites() = %v, want %v", pretty.Object(got), pretty.Object(tt.want)) } }) } }
explode_data.jsonl/12520
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 996 }
[ 2830, 3393, 21039, 23179, 3611, 1155, 353, 8840, 836, 8, 341, 13158, 2827, 2036, 341, 197, 197, 7175, 9190, 89333, 1043, 3056, 39934, 1314, 1069, 1607, 1043, 198, 197, 532, 78216, 1669, 3056, 1235, 341, 197, 11609, 262, 914, 198, 197, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestPermissionWithScopedRepo(t *testing.T) { projName := "argo-project" projectFixture. Given(t). Name(projName). Destination("*,*"). When(). Create() repoFixture.Given(t, true). When(). Path(RepoURL(RepoURLTypeFile)). Project(projName). Create() GivenWithSameState(t). Project(projName). RepoURLType(RepoURLTypeFile). Path("two-nice-pods"). When(). PatchFile("pod-1.yaml", `[{"op": "add", "path": "/metadata/annotations", "value": {"argocd.argoproj.io/sync-options": "Prune=false"}}]`). CreateApp(). Sync(). Then(). Expect(OperationPhaseIs(OperationSucceeded)). Expect(SyncStatusIs(SyncStatusCodeSynced)). When(). DeleteFile("pod-1.yaml"). Refresh(RefreshTypeHard). IgnoreErrors(). Sync(). Then(). Expect(OperationPhaseIs(OperationSucceeded)). Expect(SyncStatusIs(SyncStatusCodeOutOfSync)). Expect(ResourceSyncStatusIs("Pod", "pod-1", SyncStatusCodeOutOfSync)) }
explode_data.jsonl/35646
{ "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, 14966, 2354, 39437, 25243, 1155, 353, 8840, 836, 8, 341, 197, 30386, 675, 1669, 330, 12088, 33696, 698, 72470, 18930, 624, 197, 9600, 2071, 1155, 4292, 197, 21297, 92047, 675, 4292, 197, 10957, 20646, 445, 12314, 9, 38609, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestRolesAssignToUserOnProject(t *testing.T) { clients.RequireAdmin(t) client, err := clients.NewIdentityV3Client() th.AssertNoErr(t, err) project, err := CreateProject(t, client, nil) th.AssertNoErr(t, err) defer DeleteProject(t, client, project.ID) roleCreateOpts := roles.CreateOpts{ DomainID: "default", } role, err := CreateRole(t, client, &roleCreateOpts) th.AssertNoErr(t, err) defer DeleteRole(t, client, role.ID) user, err := CreateUser(t, client, nil) th.AssertNoErr(t, err) defer DeleteUser(t, client, user.ID) t.Logf("Attempting to assign a role %s to a user %s on a project %s", role.Name, user.Name, project.Name) assignOpts := roles.AssignOpts{ UserID: user.ID, ProjectID: project.ID, } err = roles.Assign(client, role.ID, assignOpts).ExtractErr() th.AssertNoErr(t, err) t.Logf("Successfully assigned a role %s to a user %s on a project %s", role.Name, user.Name, project.Name) defer UnassignRole(t, client, role.ID, &roles.UnassignOpts{ UserID: user.ID, ProjectID: project.ID, }) iTrue := true lao := roles.ListAssignmentsOpts{ RoleID: role.ID, ScopeProjectID: project.ID, UserID: user.ID, IncludeNames: &iTrue, } allPages, err := roles.ListAssignments(client, lao).AllPages() th.AssertNoErr(t, err) allRoleAssignments, err := roles.ExtractRoleAssignments(allPages) th.AssertNoErr(t, err) t.Logf("Role assignments of user %s on project %s:", user.Name, project.Name) var found bool for _, roleAssignment := range allRoleAssignments { tools.PrintResource(t, roleAssignment) if roleAssignment.Role.ID == role.ID { found = true } if roleAssignment.User.Domain.ID == "" || roleAssignment.Scope.Project.Domain.ID == "" { found = false } } th.AssertEquals(t, found, true) }
explode_data.jsonl/57729
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 736 }
[ 2830, 3393, 25116, 28933, 1249, 1474, 1925, 7849, 1155, 353, 8840, 836, 8, 341, 197, 31869, 81288, 7210, 1155, 692, 25291, 11, 1848, 1669, 8239, 7121, 18558, 53, 18, 2959, 741, 70479, 11711, 2753, 7747, 1155, 11, 1848, 692, 72470, 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...
5
func TestSolution(t *testing.T) { bytes, err := os.ReadFile("example.txt") if err != nil { panic(err) } example := string(bytes) sum, middle := solution(example) expectedSum := 26397 expectedMid := 288957 if sum != expectedSum { t.Errorf("want %v, got %v", expectedSum, sum) } if middle != expectedMid { t.Errorf("want %v, got %v", expectedMid, middle) } }
explode_data.jsonl/48843
{ "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, 36842, 1155, 353, 8840, 836, 8, 341, 70326, 11, 1848, 1669, 2643, 78976, 445, 8687, 3909, 1138, 743, 1848, 961, 2092, 341, 197, 30764, 3964, 340, 197, 532, 8122, 1516, 1669, 914, 23158, 340, 31479, 11, 6149, 1669, 6291, 66...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
4
func Test_SessionFromJSON(t *testing.T) { t.Parallel() a := assert.New(t) p := deezerProvider() session, err := p.UnmarshalSession(`{"AuthURL":"https://connect.deezer.com/oauth/auth.php","AccessToken":"1234567890"}`) a.NoError(err) s := session.(*deezer.Session) a.Equal(s.AuthURL, "https://connect.deezer.com/oauth/auth.php") a.Equal(s.AccessToken, "1234567890") }
explode_data.jsonl/82099
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 158 }
[ 2830, 3393, 84664, 3830, 5370, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 741, 11323, 1669, 2060, 7121, 1155, 692, 3223, 1669, 44733, 7070, 5179, 741, 25054, 11, 1848, 1669, 281, 38097, 5283, 5809, 4913, 5087, 3144, 3252, 2428, 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 TestJvFromFloat(t *testing.T) { const exampleFloat = 1.23 jv := jq.JvFromFloat(exampleFloat) if jv.Kind() != jq.JvKindNumber { t.Errorf("jv kind is not Number when initialized by a float") } gv := jv.ToGoVal() n, ok := gv.(float64) if !ok { t.Errorf("failed to cast jv float to Go float64") } if n != float64(exampleFloat) { t.Errorf("float value casted from jv is not equal to original Go value") } }
explode_data.jsonl/38757
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 171 }
[ 2830, 3393, 41, 85, 3830, 5442, 1155, 353, 8840, 836, 8, 341, 4777, 3110, 5442, 284, 220, 16, 13, 17, 18, 271, 12428, 85, 1669, 44648, 3503, 85, 3830, 5442, 66203, 5442, 340, 743, 502, 85, 54199, 368, 961, 44648, 3503, 85, 10629, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestGeneratePKIXPublicKeyIdFromPublicKey(t *testing.T) { tcs := []struct { name string publicKey []byte expectedError bool }{ { name: "generate rsa public key id successful", publicKey: []byte(rsa2048PubKey), expectedError: false, }, { name: "generate ecdsa public key id successful", publicKey: []byte(ec256PubKey), expectedError: false, }, } for _, tc := range tcs { t.Run(tc.name, func(t *testing.T) { keyId, err := generatePkixPublicKeyId(tc.publicKey) if tc.expectedError { if err == nil { t.Errorf("generatePkixPublicKeyId(...) = nil, expected non nil") } } else { if err != nil { t.Errorf("generatePkixPublicKeyId(..) = %v, expected nil", err) } else if !strings.HasPrefix(keyId, "ni:///sha-256;") { t.Errorf("generatePkixPublicKeyId(..) = %s, expected key id to have prefix ni:///sha-256;", keyId) } } }) } }
explode_data.jsonl/59158
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 433 }
[ 2830, 3393, 31115, 22242, 5396, 61822, 764, 3830, 61822, 1155, 353, 8840, 836, 8, 341, 3244, 4837, 1669, 3056, 1235, 341, 197, 11609, 688, 914, 198, 197, 1219, 1592, 257, 3056, 3782, 198, 197, 42400, 1454, 1807, 198, 197, 59403, 197, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
5
func TestMetadataPayloadMatchJsonSchema(t *testing.T) { metadataProcSetup().AttrsMatchJsonSchema(t, getMetadataEventAttrs(t, ""), tests.NewSet(tests.Group("labels")), nil, ) }
explode_data.jsonl/64806
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 76 }
[ 2830, 3393, 14610, 29683, 8331, 5014, 8632, 1155, 353, 8840, 836, 8, 341, 2109, 7603, 24508, 21821, 1005, 53671, 8331, 5014, 8632, 1155, 345, 197, 10366, 14610, 1556, 53671, 1155, 11, 72712, 197, 78216, 7121, 1649, 8623, 82, 5407, 445, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
func TestValidate(t *testing.T) { tt := []struct { name string from string to string alter string expectErr error }{ { name: "add column", from: "create table t (id int primary key)", alter: "alter table t add column i int", to: "create table t (id int primary key, i int)", }, { name: "add key", from: "create table t (id int primary key, i int)", alter: "alter table t add key i_idx(i)", to: "create table t (id int primary key, i int, key i_idx(i))", }, { name: "add column and key", from: "create table t (id int primary key)", alter: "alter table t add column i int, add key i_idx(i)", to: "create table t (id int primary key, i int, key i_idx(i))", }, { name: "add key, missing column", from: "create table t (id int primary key, i int)", alter: "alter table t add key j_idx(j)", expectErr: ErrInvalidColumnInKey, }, { name: "add key, missing column 2", from: "create table t (id int primary key, i int)", alter: "alter table t add key j_idx(j, i)", expectErr: ErrInvalidColumnInKey, }, { name: "drop column, ok", from: "create table t (id int primary key, i int, i2 int, key i_idx(i))", alter: "alter table t drop column i2", to: "create table t (id int primary key, i int, key i_idx(i))", }, { name: "drop column, affect keys", from: "create table t (id int primary key, i int, key i_idx(i))", alter: "alter table t drop column i", to: "create table t (id int primary key)", }, { name: "drop column, affect keys 2", from: "create table t (id int primary key, i int, i2 int, key i_idx(i, i2))", alter: "alter table t drop column i", to: "create table t (id int primary key, i2 int, key i_idx(i2))", }, { name: "drop column, affect keys 3", from: "create table t (id int primary key, i int, i2 int, key i_idx(i, i2))", alter: "alter table t drop column i2", to: "create table t (id int primary key, i int, key i_idx(i))", }, { name: "drop column, affect keys 4", from: "create table t (id int primary key, i int, i2 int, key some_key(id, i), key i_idx(i, i2))", alter: "alter table t drop column i2", to: "create table t (id int primary key, i int, key some_key(id, i), key i_idx(i))", }, { name: "add multiple keys, multi columns, ok", from: "create table t (id int primary key, i1 int, i2 int, i3 int)", alter: "alter table t add key i12_idx(i1, i2), add key i32_idx(i3, i2), add key i21_idx(i2, i1)", to: "create table t (id int primary key, i1 int, i2 int, i3 int, key i12_idx(i1, i2), key i32_idx(i3, i2), key i21_idx(i2, i1))", }, { name: "add multiple keys, multi columns, missing column", from: "create table t (id int primary key, i1 int, i2 int, i4 int)", alter: "alter table t add key i12_idx(i1, i2), add key i32_idx(i3, i2), add key i21_idx(i2, i1)", expectErr: ErrInvalidColumnInKey, }, } hints := DiffHints{} for _, ts := range tt { t.Run(ts.name, func(t *testing.T) { stmt, err := sqlparser.Parse(ts.from) require.NoError(t, err) fromCreateTable, ok := stmt.(*sqlparser.CreateTable) require.True(t, ok) stmt, err = sqlparser.Parse(ts.alter) require.NoError(t, err) alterTable, ok := stmt.(*sqlparser.AlterTable) require.True(t, ok) from := NewCreateTableEntity(fromCreateTable) a := &AlterTableEntityDiff{from: from, alterTable: alterTable} applied, err := from.Apply(a) if ts.expectErr != nil { assert.Error(t, err) assert.True(t, errors.Is(err, ts.expectErr)) } else { assert.NoError(t, err) assert.NotNil(t, applied) stmt, err := sqlparser.Parse(ts.to) require.NoError(t, err) toCreateTable, ok := stmt.(*sqlparser.CreateTable) require.True(t, ok) to := NewCreateTableEntity(toCreateTable) diff, err := applied.Diff(to, &hints) require.NoError(t, err) assert.Empty(t, diff, "diff found: %v.\applied: %v\nto: %v", diff.CanonicalStatementString(), applied.Create().CanonicalStatementString(), to.Create().CanonicalStatementString()) } }) } }
explode_data.jsonl/69106
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1838 }
[ 2830, 3393, 17926, 1155, 353, 8840, 836, 8, 341, 3244, 83, 1669, 3056, 1235, 341, 197, 11609, 414, 914, 198, 197, 42727, 414, 914, 198, 197, 31709, 286, 914, 198, 197, 197, 37277, 257, 914, 198, 197, 24952, 7747, 1465, 198, 197, 594...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestScaleToZeroPodRetention(t *testing.T) { cases := []struct { name string pa *PodAutoscaler want time.Duration wantOK bool }{{ name: "nil", pa: pa(nil), }, { name: "not present", pa: pa(map[string]string{}), }, { name: "present", pa: pa(map[string]string{ autoscaling.ScaleToZeroPodRetentionPeriodKey: "311s", }), want: 311 * time.Second, wantOK: true, }, { name: "complex", pa: pa(map[string]string{ autoscaling.ScaleToZeroPodRetentionPeriodKey: "4m21s", }), want: 261 * time.Second, wantOK: true, }, { name: "invalid", pa: pa(map[string]string{ autoscaling.ScaleToZeroPodRetentionPeriodKey: "365d", }), }} for _, tc := range cases { t.Run(tc.name, func(t *testing.T) { got, gotOK := tc.pa.ScaleToZeroPodRetention() if got != tc.want { t.Errorf("ScaleToZeroPodRetention = %v, want: %v", got, tc.want) } if gotOK != tc.wantOK { t.Errorf("OK = %v, want: %v", gotOK, tc.wantOK) } }) } }
explode_data.jsonl/27241
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 468 }
[ 2830, 3393, 6947, 1249, 17999, 23527, 86329, 1155, 353, 8840, 836, 8, 341, 1444, 2264, 1669, 3056, 1235, 341, 197, 11609, 256, 914, 198, 197, 3223, 64, 257, 353, 23527, 19602, 436, 63084, 198, 197, 50780, 256, 882, 33795, 198, 197, 50...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestGetMarketCandles(t *testing.T) { t.Parallel() _, err := b.GetMarketCandles(BTCAUD, "", "", "", 0, 0, 5) if err != nil { t.Error(err) } }
explode_data.jsonl/33144
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 70 }
[ 2830, 3393, 1949, 38822, 34, 20125, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 741, 197, 6878, 1848, 1669, 293, 2234, 38822, 34, 20125, 5349, 51, 5049, 4656, 11, 7342, 7342, 7342, 220, 15, 11, 220, 15, 11, 220, 20, 340, 743, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
2
func TestHTTPHandlerNotJSON(t *testing.T) { lvl, _ := newHandler() code, body := makeRequest(t, "PUT", lvl, strings.NewReader(`{`)) assertCodeBadRequest(t, code) assertJSONError(t, body) }
explode_data.jsonl/7604
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 71 }
[ 2830, 3393, 9230, 3050, 2623, 5370, 1155, 353, 8840, 836, 8, 341, 8810, 14536, 11, 716, 1669, 501, 3050, 741, 43343, 11, 2487, 1669, 1281, 1900, 1155, 11, 330, 6221, 497, 46129, 11, 9069, 68587, 5809, 90, 63, 1171, 6948, 2078, 46015, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestCrConflictMoveAndSetMtimeWrittenFile(t *testing.T) { targetMtime := time.Now().Add(1 * time.Minute) test(t, users("alice", "bob"), as(alice, mkdir("a"), write("a/b", "hello"), ), as(bob, disableUpdates(), ), as(alice, write("a/b", "world"), ), as(bob, noSync(), rename("a/b", "a/c"), setmtime("a/c", targetMtime), reenableUpdates(), lsdir("a/", m{"c$": "FILE"}), read("a/c", "world"), mtime("a/c", targetMtime), ), as(alice, lsdir("a/", m{"c$": "FILE"}), read("a/c", "world"), mtime("a/c", targetMtime), ), ) }
explode_data.jsonl/31380
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 303 }
[ 2830, 3393, 16001, 57974, 9860, 3036, 1649, 44, 1678, 35624, 1703, 1155, 353, 8840, 836, 8, 341, 28861, 44, 1678, 1669, 882, 13244, 1005, 2212, 7, 16, 353, 882, 75770, 340, 18185, 1155, 345, 197, 90896, 445, 63195, 497, 330, 47086, 44...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func Test_ConflictErrorReason(t *testing.T) { gv := schema.GroupResource{Group: "testing", Resource: "testing"} statusError := k8serrors.NewConflict(gv, "conflict_test", errors.New("A test error for confict")) status, reason := processErrorReasons(statusError) if status != http.StatusConflict { t.Errorf("Unexpected default status code: %d", status) } if !k8serrors.IsConflict(statusError) { t.Errorf("Unexpected default reason: %s", reason) } }
explode_data.jsonl/57947
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 156 }
[ 2830, 3393, 15100, 69, 21242, 1454, 25139, 1155, 353, 8840, 836, 8, 341, 3174, 85, 1669, 10802, 5407, 4783, 90, 2808, 25, 330, 8840, 497, 11765, 25, 330, 8840, 16707, 23847, 1454, 1669, 595, 23, 82, 7650, 7121, 57974, 3268, 85, 11, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestStrucureHash(t *testing.T) { cases := []struct { r *Structure hash string err error }{ {&Structure{Qri: KindStructure.String(), Format: "csv"}, "QmXKrm8qWRuY5HeU12Y6Ld83L9SGCxWfi4BW87a9yGpwfj", nil}, //QmUqNTfVuJamhRfXLC1QUZ8RLaGhUaTY31ChX4GbtamW2o", nil}, } for i, c := range cases { hash, err := c.r.Hash() if err != c.err { t.Errorf("case %d error mismatch. expected %s, got %s", i, c.err, err) continue } if hash != c.hash { t.Errorf("case %d hash mismatch. expected %s, got %s", i, c.hash, hash) continue } } }
explode_data.jsonl/16432
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 281 }
[ 2830, 3393, 2580, 1754, 552, 6370, 1155, 353, 8840, 836, 8, 341, 1444, 2264, 1669, 3056, 1235, 341, 197, 7000, 262, 353, 22952, 198, 197, 50333, 914, 198, 197, 9859, 220, 1465, 198, 197, 59403, 197, 197, 90, 5, 22952, 90, 48, 461, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestResourceMetricsSlice(t *testing.T) { es := NewResourceMetricsSlice() assert.EqualValues(t, 0, es.Len()) es = newResourceMetricsSlice(&[]*otlpmetrics.ResourceMetrics{}) assert.EqualValues(t, 0, es.Len()) es.EnsureCapacity(7) emptyVal := newResourceMetrics(&otlpmetrics.ResourceMetrics{}) testVal := generateTestResourceMetrics() assert.EqualValues(t, 7, cap(*es.orig)) for i := 0; i < es.Len(); i++ { el := es.AppendEmpty() assert.EqualValues(t, emptyVal, el) fillTestResourceMetrics(el) assert.EqualValues(t, testVal, el) } }
explode_data.jsonl/32664
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 216 }
[ 2830, 3393, 4783, 27328, 33236, 1155, 353, 8840, 836, 8, 341, 78966, 1669, 1532, 4783, 27328, 33236, 741, 6948, 12808, 6227, 1155, 11, 220, 15, 11, 1531, 65819, 2398, 78966, 284, 501, 4783, 27328, 33236, 2099, 1294, 9, 354, 13545, 43262...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestEncodingAndDecoding(t *testing.T) { for k := 0; k < 10; k++ { testEncDecLoop(t, randAlphabet()) } BTCAlphabet, err := NewAlphabet(ab) if err != nil { t.Fail() } testEncDecLoop(t, BTCAlphabet) }
explode_data.jsonl/30880
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 92 }
[ 2830, 3393, 14690, 3036, 4900, 3700, 1155, 353, 8840, 836, 8, 341, 2023, 595, 1669, 220, 15, 26, 595, 366, 220, 16, 15, 26, 595, 1027, 341, 197, 18185, 7408, 4900, 14620, 1155, 11, 10382, 2101, 18485, 2398, 197, 532, 12791, 7749, 21...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestMakeClient(t *testing.T) { os.RemoveAll(profile.FullProfilePath("")) t.Cleanup(func() { os.RemoveAll(profile.FullProfilePath("")) }) var conf CLIConf // empty config won't work: tc, err := makeClient(&conf, true) require.Nil(t, tc) require.Error(t, err) // minimal configuration (with defaults) conf.Proxy = "proxy" conf.UserHost = "localhost" tc, err = makeClient(&conf, true) require.NoError(t, err) require.NotNil(t, tc) require.Equal(t, "proxy:3023", tc.Config.SSHProxyAddr) require.Equal(t, "proxy:3080", tc.Config.WebProxyAddr) localUser, err := client.Username() require.NoError(t, err) require.Equal(t, localUser, tc.Config.HostLogin) require.Equal(t, apidefaults.CertDuration, tc.Config.KeyTTL) // specific configuration conf.MinsToLive = 5 conf.UserHost = "root@localhost" conf.NodePort = 46528 conf.LocalForwardPorts = []string{"80:remote:180"} conf.DynamicForwardedPorts = []string{":8080"} tc, err = makeClient(&conf, true) require.NoError(t, err) require.Equal(t, time.Minute*time.Duration(conf.MinsToLive), tc.Config.KeyTTL) require.Equal(t, "root", tc.Config.HostLogin) require.Equal(t, client.ForwardedPorts{ { SrcIP: "127.0.0.1", SrcPort: 80, DestHost: "remote", DestPort: 180, }, }, tc.Config.LocalForwardPorts) require.Equal(t, client.DynamicForwardedPorts{ { SrcIP: "127.0.0.1", SrcPort: 8080, }, }, tc.Config.DynamicForwardedPorts) // specific configuration with email like user conf.MinsToLive = 5 conf.UserHost = "root@example.com@localhost" conf.NodePort = 46528 conf.LocalForwardPorts = []string{"80:remote:180"} conf.DynamicForwardedPorts = []string{":8080"} tc, err = makeClient(&conf, true) require.NoError(t, err) require.Equal(t, time.Minute*time.Duration(conf.MinsToLive), tc.Config.KeyTTL) require.Equal(t, "root@example.com", tc.Config.HostLogin) require.Equal(t, client.ForwardedPorts{ { SrcIP: "127.0.0.1", SrcPort: 80, DestHost: "remote", DestPort: 180, }, }, tc.Config.LocalForwardPorts) require.Equal(t, client.DynamicForwardedPorts{ { SrcIP: "127.0.0.1", SrcPort: 8080, }, }, tc.Config.DynamicForwardedPorts) _, proxy := makeTestServers(t) proxyWebAddr, err := proxy.ProxyWebAddr() require.NoError(t, err) proxySSHAddr, err := proxy.ProxySSHAddr() require.NoError(t, err) // With provided identity file. // // makeClient should call Ping on the proxy to fetch SSHProxyAddr, which is // different from the default. conf = CLIConf{ Proxy: proxyWebAddr.String(), IdentityFileIn: "../../fixtures/certs/identities/key-cert-ca.pem", Context: context.Background(), InsecureSkipVerify: true, } tc, err = makeClient(&conf, true) require.NoError(t, err) require.NotNil(t, tc) require.Equal(t, proxyWebAddr.String(), tc.Config.WebProxyAddr) require.Equal(t, proxySSHAddr.Addr, tc.Config.SSHProxyAddr) require.NotNil(t, tc.LocalAgent().Agent) // Client should have an in-memory agent with keys loaded, in case agent // forwarding is required for proxy recording mode. agentKeys, err := tc.LocalAgent().Agent.List() require.NoError(t, err) require.Greater(t, len(agentKeys), 0) }
explode_data.jsonl/21928
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1288 }
[ 2830, 3393, 8078, 2959, 1155, 353, 8840, 836, 8, 341, 25078, 84427, 36606, 32038, 8526, 1820, 73303, 3244, 727, 60639, 18552, 368, 341, 197, 25078, 84427, 36606, 32038, 8526, 1820, 73303, 197, 8824, 2405, 2335, 39277, 15578, 271, 197, 322...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestRuleAddDefaultValue(t *testing.T) { common.Log.Debug("Entering function: %s", common.GetFunctionName()) sqls := [][]string{ { "create table test(id int)", `ALTER TABLE test change id id varchar(10);`, `ALTER TABLE test modify id varchar(10);`, }, { `ALTER TABLE test modify id varchar(10) DEFAULT '';`, `ALTER TABLE test CHANGE id id varchar(10) DEFAULT '';`, "create table test(id int not null default 0 comment '用户id')", `create table tb (a text)`, `alter table tb add a text`, }, } for _, sql := range sqls[0] { q, err := NewQuery4Audit(sql) if err == nil { rule := q.RuleAddDefaultValue() if rule.Item != "COL.004" { t.Error("Rule not match:", rule.Item, "Expect : COL.004") } } else { t.Error("sqlparser.Parse Error:", err) } } for _, sql := range sqls[1] { q, err := NewQuery4Audit(sql) if err == nil { rule := q.RuleAddDefaultValue() if rule.Item != "OK" { t.Error("Rule not match:", rule.Item, "Expect : OK") } } else { t.Error("sqlparser.Parse Error:", err) } } common.Log.Debug("Exiting function: %s", common.GetFunctionName()) }
explode_data.jsonl/76758
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 483 }
[ 2830, 3393, 11337, 2212, 41533, 1155, 353, 8840, 836, 8, 341, 83825, 5247, 20345, 445, 82867, 729, 25, 1018, 82, 497, 4185, 2234, 5152, 675, 2398, 30633, 82, 1669, 52931, 917, 515, 197, 197, 515, 298, 197, 1, 3182, 1965, 1273, 3724, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestArtifactoryArtifact(t *testing.T) { a := &ArtifactoryArtifact{URL: "http://my-host"} assert.False(t, a.HasLocation()) assert.NoError(t, a.SetKey("my-key")) key, err := a.GetKey() assert.NoError(t, err) assert.Equal(t, "http://my-host/my-key", a.URL) assert.Equal(t, "/my-key", key, "has leading slash") }
explode_data.jsonl/26018
{ "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, 9286, 333, 2919, 85578, 1155, 353, 8840, 836, 8, 341, 11323, 1669, 609, 9286, 333, 2919, 85578, 90, 3144, 25, 330, 1254, 1110, 2408, 38589, 16707, 6948, 50757, 1155, 11, 264, 16152, 4707, 2398, 6948, 35699, 1155, 11, 264, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestApplicationRouterGivenBinding(t *testing.T) { router := createApplicationRouter(ctx, testSettings) for _, verb := range verbs { req, err := http.NewRequest(verb, "/given/rest/assured", nil) require.NoError(t, err) resp := httptest.NewRecorder() router.ServeHTTP(resp, req) require.Equal(t, http.StatusOK, resp.Code) require.Equal(t, "*", resp.Header().Get("Access-Control-Allow-Origin")) } }
explode_data.jsonl/20246
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 155 }
[ 2830, 3393, 4988, 9523, 22043, 15059, 1155, 353, 8840, 836, 8, 341, 67009, 1669, 1855, 4988, 9523, 7502, 11, 1273, 6086, 692, 2023, 8358, 18607, 1669, 2088, 61846, 341, 197, 24395, 11, 1848, 1669, 1758, 75274, 7, 22328, 11, 3521, 41968,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestDefaultTracesMarshalers(t *testing.T) { expectedEncodings := []string{ "otlp_proto", "jaeger_proto", "jaeger_json", } marshalers := tracesMarshalers() assert.Equal(t, len(expectedEncodings), len(marshalers)) for _, e := range expectedEncodings { t.Run(e, func(t *testing.T) { m, ok := marshalers[e] require.True(t, ok) assert.NotNil(t, m) }) } }
explode_data.jsonl/76089
{ "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, 3675, 1282, 2434, 55438, 388, 1155, 353, 8840, 836, 8, 341, 42400, 7408, 58335, 1669, 3056, 917, 515, 197, 197, 1, 354, 13545, 37689, 756, 197, 197, 1, 5580, 1878, 37689, 756, 197, 197, 1, 5580, 1878, 9455, 756, 197, 532...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestPopulateMetricsWithZeroValuesInData(t *testing.T) { rawMetrics := map[string]interface{}{ "Qcache_free_blocks": 0, "Qcache_total_blocks": 0, "Qcache_not_cached": 0, "Qcache_hits": 0, "Queries": 0, "Threads_created": 0, "Connections": 0, "Key_blocks_unused": 0, "Key_cache_block_size": 0, "Key_buffer_size": 0, } ms := metric.NewSet("eventType", nil) populatePartialMetrics(ms, rawMetrics, defaultMetrics) populatePartialMetrics(ms, rawMetrics, extendedMetrics) populatePartialMetrics(ms, rawMetrics, myisamMetrics) testMetrics := []string{"db.qCacheUtilization", "db.qCacheHitRatio", "db.threadCacheMissRate", "db.myisam.keyCacheUtilization"} expected := float64(0) for _, metricName := range testMetrics { actual := ms.Metrics[metricName] if actual != expected { t.Errorf("For metric '%s', expected value: %f. Actual value: %f", metricName, expected, actual) } } }
explode_data.jsonl/13419
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 412 }
[ 2830, 3393, 11598, 6334, 27328, 2354, 17999, 6227, 641, 1043, 1155, 353, 8840, 836, 8, 341, 76559, 27328, 1669, 2415, 14032, 31344, 67066, 197, 197, 1, 48, 9360, 8905, 25201, 788, 256, 220, 15, 345, 197, 197, 1, 48, 9360, 10784, 25201...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestConvertFrom(t *testing.T) { // Using the same inputs from TestConvertTo, test the reverse mapping. for _, test := range converterScalarInputs { if test.expected != nil { testConvertFrom(t, test) } } }
explode_data.jsonl/20444
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 78 }
[ 2830, 3393, 12012, 3830, 1155, 353, 8840, 836, 8, 341, 197, 322, 12091, 279, 1852, 11127, 504, 3393, 12012, 1249, 11, 1273, 279, 9931, 12731, 624, 2023, 8358, 1273, 1669, 2088, 27058, 20639, 31946, 341, 197, 743, 1273, 56835, 961, 2092,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
3
func TestStream_SetVersion(t *testing.T) { t.Run("test", func(t *testing.T) { assert := base.NewAssert(t) for i := 0; i < 256; i++ { v := NewStream() v.SetVersion(uint8(i)) assert(v.GetVersion()).Equals(uint8(i)) v.Release() } }) }
explode_data.jsonl/21156
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 119 }
[ 2830, 3393, 3027, 14812, 5637, 1155, 353, 8840, 836, 8, 341, 3244, 16708, 445, 1944, 497, 2915, 1155, 353, 8840, 836, 8, 341, 197, 6948, 1669, 2331, 7121, 8534, 1155, 340, 197, 2023, 600, 1669, 220, 15, 26, 600, 366, 220, 17, 20, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func Test_Hoverfly_SetModeWithArguments_SettingModeToCaptureWipesCache(t *testing.T) { RegisterTestingT(t) unit := NewHoverflyWithConfiguration(&Configuration{}) unit.CacheMatcher.RequestCache.Set("test", "test_bytes") Expect(unit.SetModeWithArguments( v2.ModeView{ Mode: "capture", })).To(BeNil()) Expect(unit.Cfg.Mode).To(Equal("capture")) Expect(unit.CacheMatcher.RequestCache.RecordsCount()).To(Equal(0)) }
explode_data.jsonl/45400
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 161 }
[ 2830, 3393, 2039, 1975, 21642, 14812, 3636, 2354, 19139, 14812, 1280, 3636, 1249, 27429, 54, 8923, 8233, 1155, 353, 8840, 836, 8, 341, 79096, 16451, 51, 1155, 692, 81189, 1669, 1532, 34379, 21642, 2354, 7688, 2099, 7688, 6257, 692, 81189,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestPullerFromOnly1Peer(t *testing.T) { // Scenario: p1 pulls from p2 and not from p3 // and succeeds - p1 asks from p2 (and not from p3!) for the // expected digest gn := &gossipNetwork{} policyStore := newCollectionStore().withPolicy("col1", uint64(100)).thatMapsTo("p2") factoryMock1 := &mocks.CollectionAccessFactory{} policyMock1 := &mocks.CollectionAccessPolicy{} Setup(policyMock1, 1, 2, func(data protoutil.SignedData) bool { return bytes.Equal(data.Identity, []byte("p2")) }, map[string]struct{}{"org1": {}, "org2": {}}, false) factoryMock1.On("AccessPolicy", mock.Anything, mock.Anything).Return(policyMock1, nil) p1 := gn.newPuller("p1", policyStore, factoryMock1, membership(peerData{"p2", uint64(1)}, peerData{"p3", uint64(1)})...) p2TransientStore := &util.PrivateRWSetWithConfig{ RWSet: newPRWSet(), CollectionConfig: &peer.CollectionConfig{ Payload: &peer.CollectionConfig_StaticCollectionConfig{ StaticCollectionConfig: &peer.StaticCollectionConfig{ Name: "col1", }, }, }, } policyStore = newCollectionStore().withPolicy("col1", uint64(100)).thatMapsTo("p1") factoryMock2 := &mocks.CollectionAccessFactory{} policyMock2 := &mocks.CollectionAccessPolicy{} Setup(policyMock2, 1, 2, func(data protoutil.SignedData) bool { return bytes.Equal(data.Identity, []byte("p1")) }, map[string]struct{}{"org1": {}, "org2": {}}, false) factoryMock2.On("AccessPolicy", mock.Anything, mock.Anything).Return(policyMock2, nil) p2 := gn.newPuller("p2", policyStore, factoryMock2) dig := &proto.PvtDataDigest{ TxId: "txID1", Collection: "col1", Namespace: "ns1", } store := Dig2PvtRWSetWithConfig{ privdatacommon.DigKey{ TxId: "txID1", Collection: "col1", Namespace: "ns1", }: p2TransientStore, } p2.PrivateDataRetriever.(*dataRetrieverMock).On("CollectionRWSet", mock.MatchedBy(protoMatcher(dig)), uint64(0)).Return(store, true, nil) factoryMock3 := &mocks.CollectionAccessFactory{} policyMock3 := &mocks.CollectionAccessPolicy{} Setup(policyMock3, 1, 2, func(data protoutil.SignedData) bool { return false }, map[string]struct{}{"org1": {}, "org2": {}}, false) factoryMock3.On("AccessPolicy", mock.Anything, mock.Anything).Return(policyMock3, nil) p3 := gn.newPuller("p3", newCollectionStore(), factoryMock3) p3.PrivateDataRetriever.(*dataRetrieverMock).On("CollectionRWSet", mock.MatchedBy(protoMatcher(dig)), uint64(0)).Run(func(_ mock.Arguments) { t.Fatal("p3 shouldn't have been selected for pull") }) dasf := &digestsAndSourceFactory{} fetchedMessages, err := p1.fetch(dasf.mapDigest(toDigKey(dig)).toSources().create()) rws1 := util.PrivateRWSet(fetchedMessages.AvailableElements[0].Payload[0]) rws2 := util.PrivateRWSet(fetchedMessages.AvailableElements[0].Payload[1]) fetched := []util.PrivateRWSet{rws1, rws2} assert.NoError(t, err) assert.Equal(t, p2TransientStore.RWSet, fetched) }
explode_data.jsonl/53260
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1116 }
[ 2830, 3393, 36068, 261, 3830, 7308, 16, 30888, 1155, 353, 8840, 836, 8, 341, 197, 322, 58663, 25, 281, 16, 33045, 504, 281, 17, 323, 537, 504, 281, 18, 198, 197, 322, 323, 50081, 481, 281, 16, 17064, 504, 281, 17, 320, 437, 537, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestDeployPodWithMultipleImages(t *testing.T) { f := newIBDFixture(t, k8s.EnvGKE) defer f.TearDown() iTarget1 := NewSanchoDockerBuildImageTarget(f) iTarget2 := NewSanchoSidecarDockerBuildImageTarget(f) kTarget := k8s.MustTarget("sancho", testyaml.SanchoSidecarYAML). WithDependencyIDs([]model.TargetID{iTarget1.ID(), iTarget2.ID()}) targets := []model.TargetSpec{iTarget1, iTarget2, kTarget} result, err := f.ibd.BuildAndDeploy(f.ctx, f.st, targets, store.BuildStateSet{}) if err != nil { t.Fatal(err) } assert.Equal(t, 2, f.docker.BuildCount) expectedSanchoRef := "gcr.io/some-project-162817/sancho:tilt-11cd0b38bc3ceb95" image := store.ClusterImageRefFromBuildResult(result[iTarget1.ID()]) assert.Equal(t, expectedSanchoRef, image.String()) assert.Equalf(t, 1, strings.Count(f.k8s.Yaml, expectedSanchoRef), "Expected image to appear once in YAML: %s", f.k8s.Yaml) expectedSidecarRef := "gcr.io/some-project-162817/sancho-sidecar:tilt-11cd0b38bc3ceb95" image = store.ClusterImageRefFromBuildResult(result[iTarget2.ID()]) assert.Equal(t, expectedSidecarRef, image.String()) assert.Equalf(t, 1, strings.Count(f.k8s.Yaml, expectedSidecarRef), "Expected image to appear once in YAML: %s", f.k8s.Yaml) }
explode_data.jsonl/38253
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 513 }
[ 2830, 3393, 69464, 23527, 2354, 32089, 14228, 1155, 353, 8840, 836, 8, 341, 1166, 1669, 501, 3256, 5262, 12735, 1155, 11, 595, 23, 82, 81214, 38, 3390, 340, 16867, 282, 836, 682, 4454, 2822, 8230, 6397, 16, 1669, 1532, 23729, 958, 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...
2
func TestReconcileOnPendingPipelineRun(t *testing.T) { // TestReconcileOnPendingPipelineRun runs "Reconcile" on a PipelineRun that is pending. // It verifies that reconcile is successful, the pipeline status updated and events generated. prs := []*v1beta1.PipelineRun{{ ObjectMeta: baseObjectMeta("test-pipeline-run-pending", "foo"), Spec: v1beta1.PipelineRunSpec{ PipelineRef: &v1beta1.PipelineRef{Name: "test-pipeline"}, ServiceAccountName: "test-sa", Status: v1beta1.PipelineRunSpecStatusPending, }, }} ps := []*v1beta1.Pipeline{simpleHelloWorldPipeline} ts := []*v1beta1.Task{} trs := []*v1beta1.TaskRun{} d := test.Data{ PipelineRuns: prs, Pipelines: ps, Tasks: ts, TaskRuns: trs, } prt := newPipelineRunTest(d, t) defer prt.Cancel() wantEvents := []string{} reconciledRun, _ := prt.reconcileRun("foo", "test-pipeline-run-pending", wantEvents, false) condition := reconciledRun.Status.GetCondition(apis.ConditionSucceeded) if !condition.IsUnknown() || condition.Reason != ReasonPending { t.Errorf("Expected PipelineRun condition to indicate the pending failed but reason was %s", condition.Reason) } if reconciledRun.Status.StartTime != nil { t.Errorf("Start time should be nil, not: %s", reconciledRun.Status.StartTime) } }
explode_data.jsonl/68269
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 522 }
[ 2830, 3393, 693, 40446, 457, 1925, 32027, 34656, 6727, 1155, 353, 8840, 836, 8, 341, 197, 322, 3393, 693, 40446, 457, 1925, 32027, 34656, 6727, 8473, 330, 693, 40446, 457, 1, 389, 264, 40907, 6727, 429, 374, 15280, 624, 197, 322, 1084...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
4
func TestData(t *testing.T) { f := mbtest.NewReportingMetricSetV2(t, getConfig()) events, errs := mbtest.ReportingFetchV2(f) if len(errs) > 0 { t.Fatalf("Expected 0 error, had %d. %v\n", len(errs), errs) } assert.NotEmpty(t, events) if err := mbtest.WriteEventsReporterV2(f, t, ""); err != nil { t.Fatal("write", err) } }
explode_data.jsonl/68076
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 149 }
[ 2830, 93200, 1155, 353, 8840, 836, 8, 341, 1166, 1669, 10016, 1944, 7121, 70131, 54310, 1649, 53, 17, 1155, 11, 66763, 2398, 90873, 11, 70817, 1669, 10016, 1944, 43648, 20714, 53, 17, 955, 340, 743, 2422, 3964, 82, 8, 861, 220, 15, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestWeeklyStats_String(t *testing.T) { v := WeeklyStats{ Week: &Timestamp{}, Additions: Int(0), Deletions: Int(0), Commits: Int(0), } want := `github.WeeklyStats{Week:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}, Additions:0, Deletions:0, Commits:0}` if got := v.String(); got != want { t.Errorf("WeeklyStats.String = %v, want %v", got, want) } }
explode_data.jsonl/33305
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 165 }
[ 2830, 3393, 80516, 16635, 31777, 1155, 353, 8840, 836, 8, 341, 5195, 1669, 33014, 16635, 515, 197, 197, 17053, 25, 414, 609, 20812, 38837, 197, 37972, 5930, 25, 1333, 7, 15, 1326, 197, 197, 1912, 1149, 908, 25, 1333, 7, 15, 1326, 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...
2
func TestMergeManifestConditions(t *testing.T) { transitionTime := metav1.Now() cases := []struct { name string startingConditions []workapiv1.ManifestCondition newConditions []workapiv1.ManifestCondition expectedConditions []workapiv1.ManifestCondition }{ { name: "add to empty", startingConditions: []workapiv1.ManifestCondition{}, newConditions: []workapiv1.ManifestCondition{ newManifestCondition(0, "resource1", newCondition("one", "True", "my-reason", "my-message", nil)), }, expectedConditions: []workapiv1.ManifestCondition{ newManifestCondition(0, "resource1", newCondition("one", "True", "my-reason", "my-message", nil)), }, }, { name: "add new conddtion", startingConditions: []workapiv1.ManifestCondition{ newManifestCondition(0, "resource1", newCondition("one", "True", "my-reason", "my-message", nil)), }, newConditions: []workapiv1.ManifestCondition{ newManifestCondition(0, "resource1", newCondition("one", "True", "my-reason", "my-message", nil)), newManifestCondition(0, "resource2", newCondition("two", "True", "my-reason", "my-message", nil)), }, expectedConditions: []workapiv1.ManifestCondition{ newManifestCondition(0, "resource1", newCondition("one", "True", "my-reason", "my-message", nil)), newManifestCondition(0, "resource2", newCondition("two", "True", "my-reason", "my-message", nil)), }, }, { name: "update existing", startingConditions: []workapiv1.ManifestCondition{ newManifestCondition(0, "resource1", newCondition("one", "True", "my-reason", "my-message", nil)), }, newConditions: []workapiv1.ManifestCondition{ newManifestCondition(0, "resource1", newCondition("one", "False", "my-reason", "my-message", nil)), }, expectedConditions: []workapiv1.ManifestCondition{ newManifestCondition(0, "resource1", newCondition("one", "False", "my-reason", "my-message", nil)), }, }, { name: "merge new", startingConditions: []workapiv1.ManifestCondition{ newManifestCondition(0, "resource1", newCondition("one", "True", "my-reason", "my-message", nil)), }, newConditions: []workapiv1.ManifestCondition{ newManifestCondition(0, "resource1", newCondition("two", "False", "my-reason", "my-message", nil)), }, expectedConditions: []workapiv1.ManifestCondition{ newManifestCondition(0, "resource1", newCondition("one", "True", "my-reason", "my-message", nil), newCondition("two", "False", "my-reason", "my-message", nil)), }, }, { name: "remove useless", startingConditions: []workapiv1.ManifestCondition{ newManifestCondition(0, "resource1", newCondition("one", "True", "my-reason", "my-message", nil)), newManifestCondition(1, "resource2", newCondition("two", "True", "my-reason", "my-message", &transitionTime)), }, newConditions: []workapiv1.ManifestCondition{ newManifestCondition(0, "resource2", newCondition("two", "True", "my-reason", "my-message", nil)), }, expectedConditions: []workapiv1.ManifestCondition{ newManifestCondition(0, "resource2", newCondition("two", "True", "my-reason", "my-message", &transitionTime)), }, }, } for _, c := range cases { t.Run(c.name, func(t *testing.T) { merged := MergeManifestConditions(c.startingConditions, c.newConditions) if len(merged) != len(c.expectedConditions) { t.Errorf("expected condition size %d but got: %d", len(c.expectedConditions), len(merged)) } for i, expectedCondition := range c.expectedConditions { actualCondition := merged[i] if len(actualCondition.Conditions) != len(expectedCondition.Conditions) { t.Errorf("expected condition size %d but got: %d", len(expectedCondition.Conditions), len(actualCondition.Conditions)) } for j, expect := range expectedCondition.Conditions { if expect.LastTransitionTime == (metav1.Time{}) { actualCondition.Conditions[j].LastTransitionTime = metav1.Time{} } } if !equality.Semantic.DeepEqual(actualCondition, expectedCondition) { t.Errorf(diff.ObjectDiff(actualCondition, expectedCondition)) } } }) } }
explode_data.jsonl/32202
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1554 }
[ 2830, 3393, 52096, 38495, 35435, 1155, 353, 8840, 836, 8, 341, 197, 20454, 1462, 1669, 77520, 16, 13244, 2822, 1444, 2264, 1669, 3056, 1235, 341, 197, 11609, 2290, 914, 198, 197, 21375, 287, 35435, 3056, 1778, 391, 344, 16, 72272, 10547...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestValidateVariable(t *testing.T) { var validVars = map[string]bool{ "scheme": true, "http_x_forwarded_proto": true, "request_uri": true, "host": true, } tests := []struct { nVar string }{ {"scheme"}, {"http_x_forwarded_proto"}, {"request_uri"}, {"host"}, } for _, test := range tests { allErrs := validateVariable(test.nVar, validVars, field.NewPath("url")) if len(allErrs) != 0 { t.Errorf("validateVariable(%v) returned errors %v for valid input", test.nVar, allErrs) } } }
explode_data.jsonl/65885
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 262 }
[ 2830, 3393, 17926, 7827, 1155, 353, 8840, 836, 8, 341, 2405, 2697, 28305, 284, 2415, 14032, 96436, 515, 197, 197, 40787, 8058, 788, 338, 830, 345, 197, 197, 76932, 3212, 32121, 291, 37689, 788, 830, 345, 197, 197, 1, 2035, 15572, 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 TestHeadTracker_Start_NewHeads(t *testing.T) { t.Parallel() store, cleanup := cltest.NewStore(t) defer cleanup() logger := store.Config.CreateProductionLogger() ethClient := new(mocks.Client) store.EthClient = ethClient ethClient.On("ChainID", mock.Anything).Return(store.Config.ChainID(), nil) sub := new(mocks.Subscription) sub.On("Err").Return(nil) sub.On("Unsubscribe").Return(nil) chStarted := make(chan struct{}) ethClient.On("SubscribeNewHead", mock.Anything, mock.Anything). Run(func(mock.Arguments) { close(chStarted) }). Return(sub, nil) ht := services.NewHeadTracker(logger, store, []strpkg.HeadTrackable{}) assert.NoError(t, ht.Start()) <-chStarted ht.Stop() <-ht.ExportedDone() ethClient.AssertExpectations(t) }
explode_data.jsonl/9094
{ "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, 12346, 31133, 38056, 39582, 1519, 7664, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 2822, 57279, 11, 21290, 1669, 1185, 1944, 7121, 6093, 1155, 340, 16867, 21290, 741, 17060, 1669, 3553, 10753, 7251, 44967, 7395, 2822, 19...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestParsing(t *testing.T) { kws := "a,b,c" keywords, err := parseKws(kws) if err != nil { t.Error(err) } if len(keywords) != 3 { t.Error("Found ", len(keywords), " should be 3") } kws = "a,b,\"d,e\"" keywords, err = parseKws(kws) if err != nil { t.Error(err) } if len(keywords) != 3 { t.Error("Found ", len(keywords), " should be 3") } kws = "AAA,AaA,aaaAAAaaa," keywords, err = parseKws(kws) if err != nil { t.Error(err) } if len(keywords) != 4 { t.Error("Found ", len(keywords), " should be 3") } }
explode_data.jsonl/14278
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 257 }
[ 2830, 3393, 68839, 1155, 353, 8840, 836, 8, 341, 16463, 8915, 1669, 330, 64, 8402, 10109, 1837, 23634, 5761, 11, 1848, 1669, 4715, 42, 8915, 5969, 8915, 692, 743, 1848, 961, 2092, 341, 197, 3244, 6141, 3964, 340, 197, 630, 743, 2422, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestFormatEndpointIngressWithoutTLS(t *testing.T) { j := &v1alpha1.Jira{ ObjectMeta: metav1.ObjectMeta{ Name: "test-jira", Namespace: "test-jira-namespace", }, Spec: v1alpha1.JiraSpec{ Ingress: &v1alpha1.JiraIngressPolicy{ Host: "test-ingress-host", }, }, } e := formatEndpoint(j) assert.NotNil(t, e) assert.Equal(t, "http://test-ingress-host", e) }
explode_data.jsonl/29198
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 186 }
[ 2830, 3393, 4061, 27380, 641, 2483, 26040, 45439, 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 TestNew(t *testing.T) { // Given store := &mocksStore.StoreInterface{} // When codec := New(store) // Then assert.IsType(t, new(Codec), codec) }
explode_data.jsonl/29037
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 63 }
[ 2830, 3393, 3564, 1155, 353, 8840, 836, 8, 341, 197, 322, 16246, 198, 57279, 1669, 609, 16712, 82, 6093, 38047, 5051, 31483, 197, 322, 3197, 198, 43343, 66, 1669, 1532, 31200, 692, 197, 322, 5005, 198, 6948, 4506, 929, 1155, 11, 501, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestFileJSONSpecPlugin(t *testing.T) { tmpdir, unregister := Setup(t) defer unregister() p := filepath.Join(tmpdir, "example.json") spec := `{ "Name": "plugin-example", "Addr": "https://example.com/docker/plugin", "TLSConfig": { "CAFile": "/usr/shared/docker/certs/example-ca.pem", "CertFile": "/usr/shared/docker/certs/example-cert.pem", "KeyFile": "/usr/shared/docker/certs/example-key.pem" } }` if err := ioutil.WriteFile(p, []byte(spec), 0644); err != nil { t.Fatal(err) } r := newLocalRegistry() plugin, err := r.Plugin("example") if err != nil { t.Fatal(err) } if plugin.name != "example" { t.Fatalf("Expected plugin `plugin-example`, got %s\n", plugin.Name) } if plugin.Addr != "https://example.com/docker/plugin" { t.Fatalf("Expected plugin addr `https://example.com/docker/plugin`, got %s\n", plugin.Addr) } if plugin.TLSConfig.CAFile != "/usr/shared/docker/certs/example-ca.pem" { t.Fatalf("Expected plugin CA `/usr/shared/docker/certs/example-ca.pem`, got %s\n", plugin.TLSConfig.CAFile) } if plugin.TLSConfig.CertFile != "/usr/shared/docker/certs/example-cert.pem" { t.Fatalf("Expected plugin Certificate `/usr/shared/docker/certs/example-cert.pem`, got %s\n", plugin.TLSConfig.CertFile) } if plugin.TLSConfig.KeyFile != "/usr/shared/docker/certs/example-key.pem" { t.Fatalf("Expected plugin Key `/usr/shared/docker/certs/example-key.pem`, got %s\n", plugin.TLSConfig.KeyFile) } }
explode_data.jsonl/9023
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 585 }
[ 2830, 3393, 1703, 5370, 8327, 11546, 1155, 353, 8840, 836, 8, 341, 20082, 3741, 11, 62113, 1669, 18626, 1155, 340, 16867, 62113, 2822, 3223, 1669, 26054, 22363, 10368, 3741, 11, 330, 8687, 4323, 1138, 98100, 1669, 1565, 515, 220, 330, 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...
8
func TestTeamsService_ListIDPGroupsInOrganization(t *testing.T) { client, mux, _, teardown := setup() defer teardown() mux.HandleFunc("/orgs/o/team-sync/groups", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "GET") testFormValues(t, r, values{ "page": "url-encoded-next-page-token", }) fmt.Fprint(w, `{"groups": [{"group_id": "1", "group_name": "n", "group_description": "d"}]}`) }) opt := &ListCursorOptions{Page: "url-encoded-next-page-token"} ctx := context.Background() groups, _, err := client.Teams.ListIDPGroupsInOrganization(ctx, "o", opt) if err != nil { t.Errorf("Teams.ListIDPGroupsInOrganization returned error: %v", err) } want := &IDPGroupList{ Groups: []*IDPGroup{ { GroupID: String("1"), GroupName: String("n"), GroupDescription: String("d"), }, }, } if !cmp.Equal(groups, want) { t.Errorf("Teams.ListIDPGroupsInOrganization returned %+v. want %+v", groups, want) } const methodName = "ListIDPGroupsInOrganization" testBadOptions(t, methodName, func() (err error) { _, _, err = client.Teams.ListIDPGroupsInOrganization(ctx, "\n", opt) return err }) testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { got, resp, err := client.Teams.ListIDPGroupsInOrganization(ctx, "o", opt) if got != nil { t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got) } return resp, err }) }
explode_data.jsonl/4553
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 589 }
[ 2830, 3393, 60669, 1860, 27104, 915, 47, 22173, 641, 41574, 1155, 353, 8840, 836, 8, 341, 25291, 11, 59807, 11, 8358, 49304, 1669, 6505, 741, 16867, 49304, 2822, 2109, 2200, 63623, 4283, 1775, 82, 20271, 78015, 65034, 77685, 497, 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 TestStreams(t *testing.T) { ctx := context.Background() mn, err := FullMeshConnected(context.Background(), 3) if err != nil { t.Fatal(err) } handler := func(s network.Stream) { b := make([]byte, 4) if _, err := io.ReadFull(s, b); err != nil { panic(err) } if !bytes.Equal(b, []byte("beep")) { panic("bytes mismatch") } if _, err := s.Write([]byte("boop")); err != nil { panic(err) } s.Close() } hosts := mn.Hosts() for _, h := range mn.Hosts() { h.SetStreamHandler(protocol.TestingID, handler) } s, err := hosts[0].NewStream(ctx, hosts[1].ID(), protocol.TestingID) if err != nil { t.Fatal(err) } if _, err := s.Write([]byte("beep")); err != nil { panic(err) } b := make([]byte, 4) if _, err := io.ReadFull(s, b); err != nil { panic(err) } if !bytes.Equal(b, []byte("boop")) { panic("bytes mismatch 2") } }
explode_data.jsonl/10778
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 389 }
[ 2830, 3393, 73576, 1155, 353, 8840, 836, 8, 341, 20985, 1669, 2266, 19047, 2822, 2109, 77, 11, 1848, 1669, 8627, 14194, 21146, 5378, 19047, 1507, 220, 18, 340, 743, 1848, 961, 2092, 341, 197, 3244, 26133, 3964, 340, 197, 630, 53326, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestLog(t *testing.T) { t.Parallel() ctx := context.Background() Convey("Log with bad project", t, func() { srv, c := newMockClient(func(w http.ResponseWriter, r *http.Request) {}) defer srv.Close() _, err := c.Log(ctx, &gitiles.LogRequest{}) So(err, ShouldErrLike, "project is required") }) Convey("Log w/o pages", t, func() { srv, c := newMockClient(func(w http.ResponseWriter, r *http.Request) { w.WriteHeader(200) w.Header().Set("Content-Type", "application/json") fmt.Fprintf(w, ")]}'\n{\"log\": [%s, %s]}\n", fakeCommit1Str, fakeCommit2Str) }) defer srv.Close() Convey("Return All", func() { res, err := c.Log(ctx, &gitiles.LogRequest{ Project: "repo", Committish: "8de6836858c99e48f3c58164ab717bda728e95dd", ExcludeAncestorsOf: "master", PageSize: 10, }) So(err, ShouldBeNil) So(len(res.Log), ShouldEqual, 2) So(res.Log[0].Author.Name, ShouldEqual, "Author 1") So(res.Log[1].Id, ShouldEqual, "dc1dbf1aa56e4dd4cbfaab61c4d30a35adce5f40") }) }) }
explode_data.jsonl/78108
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 499 }
[ 2830, 3393, 2201, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 741, 20985, 1669, 2266, 19047, 2822, 93070, 5617, 445, 2201, 448, 3873, 2390, 497, 259, 11, 2915, 368, 341, 197, 1903, 10553, 11, 272, 1669, 501, 11571, 2959, 18552, 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 TestGetVotedAnswer(t *testing.T) { for name, test := range map[string]struct { Poll poll.Poll UserID string ShouldError bool ExpectedResponse *poll.VotedAnswerResponse }{ "Voted an Answer": { Poll: poll.Poll{ ID: testutils.GetPollID(), AnswerOptions: []*poll.AnswerOption{ {Answer: "Answer 1", Voter: []string{"a"}}, {Answer: "Answer 2", Voter: []string{"b"}}, {Answer: "Answer 3", Voter: []string{"b"}}, }, }, UserID: "a", ShouldError: false, ExpectedResponse: &poll.VotedAnswerResponse{PollID: testutils.GetPollID(), UserID: "a", VotedAnswers: []string{"Answer 1"}}, }, "Voted two Answers": { Poll: poll.Poll{ ID: testutils.GetPollID(), AnswerOptions: []*poll.AnswerOption{ {Answer: "Answer 1", Voter: []string{"a"}}, {Answer: "Answer 2", Voter: []string{"b"}}, {Answer: "Answer 3", Voter: []string{"b"}}, }, }, UserID: "b", ShouldError: false, ExpectedResponse: &poll.VotedAnswerResponse{PollID: testutils.GetPollID(), UserID: "b", VotedAnswers: []string{"Answer 2", "Answer 3"}}, }, "Voted no Answers": { Poll: poll.Poll{ ID: testutils.GetPollID(), AnswerOptions: []*poll.AnswerOption{ {Answer: "Answer 1", Voter: []string{"a"}}, {Answer: "Answer 2", Voter: []string{"b"}}, {Answer: "Answer 3", Voter: []string{"b"}}, }, }, UserID: "c", ShouldError: false, ExpectedResponse: &poll.VotedAnswerResponse{PollID: testutils.GetPollID(), UserID: "c", VotedAnswers: []string{}}, }, "Invalid userID": { Poll: poll.Poll{ ID: testutils.GetPollID(), AnswerOptions: []*poll.AnswerOption{ {Answer: "Answer 1", Voter: []string{"a"}}, {Answer: "Answer 2", Voter: []string{"b"}}, {Answer: "Answer 3", Voter: []string{"b"}}, }, }, UserID: "", ShouldError: true, }, } { t.Run(name, func(t *testing.T) { assert := assert.New(t) answers, err := test.Poll.GetVotedAnswer(test.UserID) if test.ShouldError { assert.NotNil(err) assert.Nil(answers) } else { assert.Nil(err) assert.Equal(test.ExpectedResponse, answers) } }) } }
explode_data.jsonl/30288
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1002 }
[ 2830, 3393, 1949, 53, 9253, 16141, 1155, 353, 8840, 836, 8, 341, 2023, 829, 11, 1273, 1669, 2088, 2415, 14032, 60, 1235, 341, 197, 10025, 965, 1797, 7085, 1069, 965, 198, 197, 31672, 915, 1843, 914, 198, 197, 197, 14996, 1454, 414, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestStoreCustomExport(t *testing.T) { podA := api.Pod{ ObjectMeta: api.ObjectMeta{ Namespace: "test", Name: "foo", Labels: map[string]string{}, }, Spec: api.PodSpec{NodeName: "machine"}, } server, registry := NewTestGenericStoreRegistry(t) defer server.Terminate(t) registry.ExportStrategy = testPodExport{} testContext := api.WithNamespace(api.NewContext(), "test") registry.UpdateStrategy.(*testRESTStrategy).allowCreateOnUpdate = true if !updateAndVerify(t, testContext, registry, &podA) { t.Errorf("Unexpected error updating podA") } obj, err := registry.Export(testContext, podA.Name, unversioned.ExportOptions{}) if err != nil { t.Errorf("unexpected error: %v", err) } exportedPod := obj.(*api.Pod) if exportedPod.Labels["exported"] != "true" { t.Errorf("expected: exported->true, found: %s", exportedPod.Labels["exported"]) } if exportedPod.Labels["exact"] != "false" { t.Errorf("expected: exact->false, found: %s", exportedPod.Labels["exact"]) } if exportedPod.Labels["prepare_create"] != "true" { t.Errorf("expected: prepare_create->true, found: %s", exportedPod.Labels["prepare_create"]) } delete(exportedPod.Labels, "exported") delete(exportedPod.Labels, "exact") delete(exportedPod.Labels, "prepare_create") exportObjectMeta(&podA.ObjectMeta, false) podA.Spec = exportedPod.Spec if !reflect.DeepEqual(&podA, exportedPod) { t.Errorf("expected:\n%v\nsaw:\n%v\n", &podA, exportedPod) } }
explode_data.jsonl/231
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 560 }
[ 2830, 3393, 6093, 10268, 16894, 1155, 353, 8840, 836, 8, 341, 3223, 347, 32, 1669, 6330, 88823, 515, 197, 23816, 12175, 25, 6330, 80222, 515, 298, 90823, 25, 330, 1944, 756, 298, 21297, 25, 414, 330, 7975, 756, 298, 197, 23674, 25, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
7
func TestRefreshMetaDataWithDifferentController(t *testing.T) { seedBroker1 := NewMockBroker(t, 1) seedBroker2 := NewMockBroker(t, 2) defer seedBroker1.Close() defer seedBroker2.Close() seedBroker1.SetHandlerByMap(map[string]MockResponse{ "MetadataRequest": NewMockMetadataResponse(t). SetController(seedBroker1.BrokerID()). SetBroker(seedBroker1.Addr(), seedBroker1.BrokerID()). SetBroker(seedBroker2.Addr(), seedBroker2.BrokerID()), }) config := NewTestConfig() config.Version = V1_1_0_0 client, err := NewClient([]string{seedBroker1.Addr()}, config) if err != nil { t.Fatal(err) } ca := clusterAdmin{client: client, conf: config} if b, _ := ca.Controller(); seedBroker1.BrokerID() != b.ID() { t.Fatalf("expected cached controller to be %d rather than %d", seedBroker1.BrokerID(), b.ID()) } seedBroker1.SetHandlerByMap(map[string]MockResponse{ "MetadataRequest": NewMockMetadataResponse(t). SetController(seedBroker2.BrokerID()). SetBroker(seedBroker1.Addr(), seedBroker1.BrokerID()). SetBroker(seedBroker2.Addr(), seedBroker2.BrokerID()), }) if b, _ := ca.refreshController(); seedBroker2.BrokerID() != b.ID() { t.Fatalf("expected refreshed controller to be %d rather than %d", seedBroker2.BrokerID(), b.ID()) } if b, _ := ca.Controller(); seedBroker2.BrokerID() != b.ID() { t.Fatalf("expected cached controller to be %d rather than %d", seedBroker2.BrokerID(), b.ID()) } }
explode_data.jsonl/40810
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 573 }
[ 2830, 3393, 14567, 37307, 2354, 69123, 2051, 1155, 353, 8840, 836, 8, 341, 197, 22602, 65545, 16, 1669, 1532, 11571, 65545, 1155, 11, 220, 16, 340, 197, 22602, 65545, 17, 1669, 1532, 11571, 65545, 1155, 11, 220, 17, 340, 16867, 10320, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestConvertLabel(t *testing.T) { testConvertLabel(t, "example2.com:80/path=81", []PortRule{ PortRule{ Hostname: "example2.com", SourcePort: 80, Path: "/path", TargetPort: 81, }, }) testConvertLabel(t, "example2.com:80/path/a", []PortRule{ PortRule{ Hostname: "example2.com", SourcePort: 80, Path: "/path/a", }, }) testConvertLabel(t, "example2.com:80=81", []PortRule{ PortRule{ Hostname: "example2.com", SourcePort: 80, TargetPort: 81, }, }) testConvertLabel(t, "example2.com:80", []PortRule{ PortRule{ Hostname: "example2.com", SourcePort: 80, }, }) testConvertLabel(t, "example2.com/path/b/c=81", []PortRule{ PortRule{ Hostname: "example2.com", Path: "/path/b/c", TargetPort: 81, }, }) testConvertLabel(t, "example2.com/path", []PortRule{ PortRule{ Hostname: "example2.com", Path: "/path", }, }) testConvertLabel(t, "example2.com=81", []PortRule{ PortRule{ Hostname: "example2.com", TargetPort: 81, }, }) testConvertLabel(t, "example2.com", []PortRule{ PortRule{ Hostname: "example2.com", }, }) testConvertLabel(t, "80/path=81", []PortRule{ PortRule{ SourcePort: 80, Path: "/path", TargetPort: 81, }, }) testConvertLabel(t, "80/path", []PortRule{ PortRule{ SourcePort: 80, Path: "/path", }, }) testConvertLabel(t, "80=81", []PortRule{ PortRule{ SourcePort: 80, TargetPort: 81, }, }) testConvertLabel(t, "/path=81", []PortRule{ PortRule{ Path: "/path", TargetPort: 81, }, }) testConvertLabel(t, "www.abc.com", []PortRule{ PortRule{ Hostname: "www.abc.com", }, }) testConvertLabel(t, "www.abc2.com", []PortRule{ PortRule{ Hostname: "www.abc2.com", }, }) testConvertLabel(t, "/path", []PortRule{ PortRule{ Path: "/path", }, }) testConvertLabel(t, "www.abc2.com/service.html", []PortRule{ PortRule{ Hostname: "www.abc2.com", Path: "/service.html", }, }) testConvertLabel(t, "81", []PortRule{ PortRule{ TargetPort: 81, }, }) testConvertLabel(t, "81,82", []PortRule{ PortRule{ TargetPort: 81, }, PortRule{ TargetPort: 82, }, }) testConvertLabel(t, "example2.com:80/path=81,example2.com:82/path2=83", []PortRule{ PortRule{ Hostname: "example2.com", SourcePort: 80, Path: "/path", TargetPort: 81, }, PortRule{ Hostname: "example2.com", SourcePort: 82, Path: "/path2", TargetPort: 83, }, }) }
explode_data.jsonl/31960
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1234 }
[ 2830, 3393, 12012, 2476, 1155, 353, 8840, 836, 8, 341, 18185, 12012, 2476, 1155, 11, 330, 8687, 17, 905, 25, 23, 15, 50976, 28, 23, 16, 497, 3056, 7084, 11337, 515, 197, 98459, 11337, 515, 298, 197, 88839, 25, 256, 330, 8687, 17, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func Test_SqlTriggerGetResults_Status_WhenPropertiesConverted_RoundTripsWithoutLoss(t *testing.T) { t.Parallel() parameters := gopter.DefaultTestParameters() parameters.MaxSize = 10 properties := gopter.NewProperties(parameters) properties.Property( "Round trip from SqlTriggerGetResults_Status to SqlTriggerGetResults_Status via AssignPropertiesToSqlTriggerGetResultsStatus & AssignPropertiesFromSqlTriggerGetResultsStatus returns original", prop.ForAll(RunPropertyAssignmentTestForSqlTriggerGetResultsStatus, SqlTriggerGetResultsStatusGenerator())) properties.TestingRun(t, gopter.NewFormatedReporter(false, 240, os.Stdout)) }
explode_data.jsonl/18745
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 189 }
[ 2830, 3393, 1098, 1470, 17939, 1949, 9801, 36449, 62, 4498, 7903, 61941, 2568, 795, 21884, 1690, 26040, 39838, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 741, 67543, 1669, 728, 73137, 13275, 2271, 9706, 741, 67543, 14535, 1695, 284,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestNodeGetManifestH(t *testing.T) { stg, _ := storage.Get("mock") cg := cache.NewCache() envs.Get().SetStorage(stg) envs.Get().SetCache(cg) viper.Set("verbose", 0) var ( n1 = getNodeAsset("test1", "", true) n2 = getNodeAsset("test2", "", true) p1 = "test1" p2 = "test2" nm = new(types.NodeManifest) ) nm.Meta.Initial = true nm.Meta.Discovery = make(map[string]*types.ResolverManifest, 0) nm.Network = make(map[string]*types.SubnetManifest, 0) nm.Pods = make(map[string]*types.PodManifest, 0) nm.Pods[p1] = getPodManifest() nm.Pods[p2] = getPodManifest() nm.Volumes = make(map[string]*types.VolumeManifest, 0) nm.Endpoints = make(map[string]*types.EndpointManifest, 0) v, err := v1.View().Node().NewManifest(nm).ToJson() assert.NoError(t, err) tests := []struct { name string url string headers map[string]string handler func(http.ResponseWriter, *http.Request) expectedBody string expectedCode int }{ { name: "node spec failed not found", url: fmt.Sprintf("/cluster/node/%s/spec", n2.Meta.Name), handler: node.NodeGetSpecH, expectedBody: "{\"code\":404,\"status\":\"Not Found\",\"message\":\"Node not found\"}", expectedCode: http.StatusNotFound, }, { name: "node spec successfully", url: fmt.Sprintf("/cluster/node/%s/spec", n1.Meta.Name), handler: node.NodeGetSpecH, expectedBody: string(v), expectedCode: http.StatusOK, }, } for _, tc := range tests { t.Run(tc.name, func(t *testing.T) { err = envs.Get().GetStorage().Del(context.Background(), stg.Collection().Node().Info(), types.EmptyString) assert.NoError(t, err) err = envs.Get().GetStorage().Del(context.Background(), stg.Collection().Manifest().Pod(n1.Meta.Name), types.EmptyString) assert.NoError(t, err) err = stg.Put(context.Background(), stg.Collection().Node().Info(), stg.Key().Node(n1.Meta.Name), &n1, nil) assert.NoError(t, err) err = stg.Put(context.Background(), stg.Collection().Manifest().Pod(n1.Meta.Name), p1, getPodManifest(), nil) assert.NoError(t, err) err = stg.Put(context.Background(), stg.Collection().Manifest().Pod(n1.Meta.Name), p2, getPodManifest(), nil) assert.NoError(t, err) // Create assert request to pass to our handler. We don't have any query parameters for now, so we'll // pass 'nil' as the third parameter. req, err := http.NewRequest("GET", tc.url, nil) assert.NoError(t, err) if tc.headers != nil { for key, val := range tc.headers { req.Header.Set(key, val) } } r := mux.NewRouter() r.HandleFunc("/cluster/node/{node}/spec", tc.handler) setRequestVars(r, req) // We create assert ResponseRecorder (which satisfies http.ResponseWriter) to record the response. res := httptest.NewRecorder() // Our handlers satisfy http.Handler, so we can call their ServeHTTP method // directly and pass in our Request and ResponseRecorder. r.ServeHTTP(res, req) // Check the status code is what we expect. if !assert.Equal(t, tc.expectedCode, res.Code, "status code not equal") { return } body, err := ioutil.ReadAll(res.Body) if !assert.NoError(t, err) { return } assert.Equal(t, tc.expectedBody, string(body), "incorrect status code") }) } }
explode_data.jsonl/47396
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1363 }
[ 2830, 3393, 1955, 1949, 38495, 39, 1155, 353, 8840, 836, 8, 341, 18388, 70, 11, 716, 1669, 5819, 2234, 445, 16712, 1138, 1444, 70, 1669, 6500, 7121, 8233, 2822, 57538, 82, 2234, 1005, 1649, 5793, 5895, 70, 340, 57538, 82, 2234, 1005, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func Test_FieldsAligned(t *testing.T) { p1 := new(DB) testAligned(t, "DB.seq", unsafe.Offsetof(p1.seq)) p2 := new(session) testAligned(t, "session.stFileNum", unsafe.Offsetof(p2.stFileNum)) testAligned(t, "session.stJournalNum", unsafe.Offsetof(p2.stJournalNum)) testAligned(t, "session.stPrevJournalNum", unsafe.Offsetof(p2.stPrevJournalNum)) testAligned(t, "session.stSeq", unsafe.Offsetof(p2.stSeq)) }
explode_data.jsonl/5999
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 168 }
[ 2830, 3393, 1400, 6907, 93305, 1155, 353, 8840, 836, 8, 341, 3223, 16, 1669, 501, 32184, 340, 18185, 93305, 1155, 11, 330, 3506, 43867, 497, 19860, 61958, 1055, 1295, 16, 43867, 1171, 3223, 17, 1669, 501, 16264, 340, 18185, 93305, 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 TestNonPointerAdapter(t *testing.T) { templates := data.BuildTemplates(nil) adapters := map[string]*adapter.Info{ "acheck": { Name: "acheck", SupportedTemplates: []string{"tcheck", "thalt"}, DefaultConfig: &types.Struct{}, NewBuilder: func() adapter.HandlerBuilder { return nonPointerBuilder{} }, }, } globalConfigs := []string{ data.HandlerACheck1, data.InstanceCheck1, data.InstanceCheck2, data.RuleCheck1WithInstance1And2, } expected := ` [Routing ExpectedTable] ID: 1 [#0] TEMPLATE_VARIETY_CHECK {V} [#0] istio-system {NS} [#0] hcheck1.acheck.istio-system {H} [#0] Condition: <NONE> [#0] icheck1.tcheck.istio-system {I} [#1] icheck2.tcheck.istio-system {I} ` table, _ := buildTableWithTemplatesAndAdapters(templates, adapters, data.ServiceConfig, globalConfigs, true) actual := table.String() if normalize(actual) != normalize(expected) { t.Fatalf("got:\n%v\nwant:\n%v\n", actual, expected) } }
explode_data.jsonl/12915
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 441 }
[ 2830, 3393, 8121, 9084, 5940, 1155, 353, 8840, 836, 8, 1476, 197, 15463, 1669, 821, 25212, 51195, 27907, 692, 98780, 17425, 1669, 2415, 14032, 8465, 19731, 20132, 515, 197, 197, 1, 1777, 377, 788, 341, 298, 21297, 25, 2290, 330, 1777, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestNoPopulateLocationConstraintIfProvided(t *testing.T) { s := s3.New(unit.Session) req, _ := s.CreateBucketRequest(&s3.CreateBucketInput{ Bucket: aws.String("bucket"), CreateBucketConfiguration: &s3.CreateBucketConfiguration{}, }) err := req.Build() assert.NoError(t, err) v, _ := awsutil.ValuesAtPath(req.Params, "CreateBucketConfiguration.LocationConstraint") assert.Equal(t, 0, len(v)) }
explode_data.jsonl/771
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 155 }
[ 2830, 3393, 2753, 11598, 6334, 4707, 17890, 2679, 35819, 291, 1155, 353, 8840, 836, 8, 341, 1903, 1669, 274, 18, 7121, 24144, 20674, 340, 24395, 11, 716, 1669, 274, 7251, 36018, 1900, 2099, 82, 18, 7251, 36018, 2505, 515, 197, 12791, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestConfig(t *testing.T) { t.Run("Should return config with default values", func(t *testing.T) { if getEnvBoolOrDefault("FIONA_DEBUG", false) { t.Skip("Skipping default config test when FIONA_DEBUG is true") } confreader := ConfReader{} config, err := confreader.ReadConfig() assert.Nil(t, err) assert.Equal(t, "localhost", config.S3Config.S3Host) assert.Equal(t, "9000", config.S3Config.S3Port) assert.Equal(t, false, config.S3Config.S3UseSSL) assert.Equal(t, "us-east-1", config.S3Config.S3Region) assert.Equal(t, true, config.S3Config.RandomUserpass) assert.Equal(t, "S3userpass", config.S3Config.DefaultUserpass) assert.Equal(t, "aurora", config.S3Config.AccessKey) assert.Equal(t, "fragleberget", config.S3Config.SecretKey) assert.Equal(t, "utv", config.S3Config.DefaultBucket) assert.Equal(t, false, config.DebugLog) }) }
explode_data.jsonl/37660
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 356 }
[ 2830, 3393, 2648, 1155, 353, 8840, 836, 8, 341, 3244, 16708, 445, 14996, 470, 2193, 448, 1638, 2750, 497, 2915, 1155, 353, 8840, 836, 8, 341, 197, 743, 633, 14359, 11233, 14188, 445, 37, 1271, 32, 11139, 497, 895, 8, 341, 298, 3244,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestMimeHandler(t *testing.T) { mimes := Config{ ".html": "text/html", ".txt": "text/plain", ".swf": "application/x-shockwave-flash", } m := Mime{Configs: mimes} w := httptest.NewRecorder() exts := []string{ ".html", ".txt", ".swf", } for _, e := range exts { url := "/file" + e r, err := http.NewRequest("GET", url, nil) if err != nil { t.Error(err) } m.Next = nextFunc(true, mimes[e]) _, err = m.ServeHTTP(w, r) if err != nil { t.Error(err) } } w = httptest.NewRecorder() exts = []string{ ".htm1", ".abc", ".mdx", } for _, e := range exts { url := "/file" + e r, err := http.NewRequest("GET", url, nil) if err != nil { t.Error(err) } m.Next = nextFunc(false, "") _, err = m.ServeHTTP(w, r) if err != nil { t.Error(err) } } }
explode_data.jsonl/40530
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 391 }
[ 2830, 3393, 44, 545, 3050, 1155, 353, 8840, 836, 8, 341, 2109, 1733, 1669, 5532, 515, 197, 197, 3263, 1551, 788, 330, 1318, 13739, 756, 197, 197, 3263, 8586, 788, 220, 330, 1318, 36971, 756, 197, 197, 3263, 2280, 69, 788, 220, 330, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
7
func TestGetFrontendIPConfigName(t *testing.T) { ctrl := gomock.NewController(t) defer ctrl.Finish() az := GetTestCloud(ctrl) az.PrimaryAvailabilitySetName = "primary" svc := &v1.Service{ ObjectMeta: meta.ObjectMeta{ Annotations: map[string]string{ ServiceAnnotationLoadBalancerInternalSubnet: "subnet", ServiceAnnotationLoadBalancerInternal: "true", }, UID: "257b9655-5137-4ad2-b091-ef3f07043ad3", }, } cases := []struct { description string subnetName string isInternal bool useStandardLB bool expected string }{ { description: "internal lb should have subnet name on the frontend ip configuration name", subnetName: "shortsubnet", isInternal: true, useStandardLB: true, expected: "a257b965551374ad2b091ef3f07043ad-shortsubnet", }, { description: "internal standard lb should have subnet name on the frontend ip configuration name but truncated to 80 characters", subnetName: "averylonnnngggnnnnnnnnnnnnnnnnnnnnnngggggggggggggggggggggggggggggggggggggsubet", isInternal: true, useStandardLB: true, expected: "a257b965551374ad2b091ef3f07043ad-averylonnnngggnnnnnnnnnnnnnnnnnnnnnnggggggggggg", }, { description: "internal basic lb should have subnet name on the frontend ip configuration name but truncated to 80 characters", subnetName: "averylonnnngggnnnnnnnnnnnnnnnnnnnnnngggggggggggggggggggggggggggggggggggggsubet", isInternal: true, useStandardLB: false, expected: "a257b965551374ad2b091ef3f07043ad-averylonnnngggnnnnnnnnnnnnnnnnnnnnnnggggggggggg", }, { description: "external standard lb should not have subnet name on the frontend ip configuration name", subnetName: "shortsubnet", isInternal: false, useStandardLB: true, expected: "a257b965551374ad2b091ef3f07043ad", }, { description: "external basic lb should not have subnet name on the frontend ip configuration name", subnetName: "shortsubnet", isInternal: false, useStandardLB: false, expected: "a257b965551374ad2b091ef3f07043ad", }, } for _, c := range cases { if c.useStandardLB { az.Config.LoadBalancerSku = loadBalancerSkuStandard } else { az.Config.LoadBalancerSku = loadBalancerSkuBasic } svc.Annotations[ServiceAnnotationLoadBalancerInternalSubnet] = c.subnetName svc.Annotations[ServiceAnnotationLoadBalancerInternal] = strconv.FormatBool(c.isInternal) ipconfigName := az.getDefaultFrontendIPConfigName(svc) assert.Equal(t, c.expected, ipconfigName, c.description) } }
explode_data.jsonl/7456
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1052 }
[ 2830, 3393, 1949, 23395, 408, 3298, 2648, 675, 1155, 353, 8840, 836, 8, 341, 84381, 1669, 342, 316, 1176, 7121, 2051, 1155, 340, 16867, 23743, 991, 18176, 741, 197, 1370, 1669, 2126, 2271, 16055, 62100, 340, 197, 1370, 34884, 51703, 697...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestGetStringFrom2ndSource(t *testing.T) { t.Parallel() b := NewConfigReaderBuilder() reader := b.AttachEnvPrefix("simple").WithConfigFile("testdata/config.yaml").Build() os.Setenv("SIMPLE_GENCODE_DOWNSTREAM_BAR_SERVICEURL", "") barURL, err := reader.GetString("genCode.downstream.bar.serviceURL") require.Nil(t, err) assert.Equal(t, "https://bar.example.com", barURL) }
explode_data.jsonl/53789
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 144 }
[ 2830, 3393, 48905, 3830, 17, 303, 3608, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 2822, 2233, 1669, 1532, 2648, 5062, 3297, 741, 61477, 1669, 293, 88284, 14359, 14335, 445, 22944, 1827, 2354, 2648, 1703, 445, 92425, 14730, 33406, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestStartServerTLSSuccess(t *testing.T) { s, err := NewServer() require.NoError(t, err) testDir, _ := fileutils.FindDir("tests") s.UpdateConfig(func(cfg *model.Config) { *cfg.ServiceSettings.ListenAddress = ":0" *cfg.ServiceSettings.ConnectionSecurity = "TLS" *cfg.ServiceSettings.TLSKeyFile = path.Join(testDir, "tls_test_key.pem") *cfg.ServiceSettings.TLSCertFile = path.Join(testDir, "tls_test_cert.pem") }) serverErr := s.Start() tr := &http.Transport{ TLSClientConfig: &tls.Config{InsecureSkipVerify: true}, } client := &http.Client{Transport: tr} checkEndpoint(t, client, "https://localhost:"+strconv.Itoa(s.ListenAddr.Port)+"/", http.StatusNotFound) s.Shutdown() require.NoError(t, serverErr) }
explode_data.jsonl/47829
{ "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, 3479, 5475, 13470, 1220, 2557, 1155, 353, 8840, 836, 8, 341, 1903, 11, 1848, 1669, 1532, 5475, 741, 17957, 35699, 1155, 11, 1848, 692, 18185, 6184, 11, 716, 1669, 1034, 6031, 9998, 6184, 445, 23841, 1138, 1903, 16689, 2648, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_ValidateConfig(t *testing.T) { clonedPath, teardown := setupGitRepo("repo1_bare", t) defer teardown() // test invalid plugin configurations tests := []struct { name string p *Plugin valid bool }{ { name: "Missing repo-url", p: &Plugin{ Config: &Config{ ChartsDir: testChartsDir, }, }, valid: false, }, { name: "Invalid charts-dir", p: &Plugin{ Config: &Config{ RepoURL: "http://charts.mycompany.com/", ChartsDir: "foo", }, }, valid: false, }, { name: "Invalid chart-path", p: &Plugin{ Config: &Config{ RepoURL: "http://charts.mycompany.com/", ChartsDir: testChartsDir, ChartPath: "foo", }, }, valid: false, }, { name: "Invalid git commit", p: &Plugin{ Config: &Config{ RepoURL: "http://charts.mycompany.com/", ChartsDir: clonedPath, CurrentCommitID: "foo", }, }, valid: false, }, } var err error for _, test := range tests { t.Run(test.name, func(t *testing.T) { err = test.p.ValidateConfig() if test.valid && err != nil { t.Errorf("expected valid config, but got %v", err) return } else if !test.valid && err == nil { t.Error("expected invalid config, but config passed") return } }) } }
explode_data.jsonl/58797
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 628 }
[ 2830, 3393, 62, 17926, 2648, 1155, 353, 8840, 836, 8, 341, 39407, 19684, 1820, 11, 49304, 1669, 6505, 46562, 25243, 445, 23476, 16, 880, 546, 497, 259, 340, 16867, 49304, 2822, 197, 322, 1273, 8318, 9006, 32383, 198, 78216, 1669, 3056, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
5