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 TestIDPCanHandlePostRequestWithExistingSession(t *testing.T) { test := NewIdentifyProviderTest(t) test.IDP.SessionProvider = &mockSessionProvider{ GetSessionFunc: func(w http.ResponseWriter, r *http.Request, req *IdpAuthnRequest) *Session { return &Session{ ID: "f00df00df00d", UserName: "alice", } }, } w := httptest.NewRecorder() authRequest, err := test.SP.MakeAuthenticationRequest(test.SP.GetSSOBindingLocation(HTTPRedirectBinding), HTTPRedirectBinding) assert.Check(t, err) authRequestBuf, err := xml.Marshal(authRequest) assert.Check(t, err) q := url.Values{} q.Set("SAMLRequest", base64.StdEncoding.EncodeToString(authRequestBuf)) q.Set("RelayState", "ThisIsTheRelayState") r, _ := http.NewRequest("POST", "https://idp.example.com/saml/sso", strings.NewReader(q.Encode())) r.Header.Set("Content-type", "application/x-www-form-urlencoded") test.IDP.ServeSSO(w, r) assert.Check(t, is.Equal(200, w.Code)) golden.Assert(t, w.Body.String(), t.Name()+"_http_response_body") }
explode_data.jsonl/19825
{ "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, 915, 4872, 276, 6999, 4133, 1900, 2354, 53067, 5283, 1155, 353, 8840, 836, 8, 341, 18185, 1669, 1532, 28301, 1437, 5179, 2271, 1155, 340, 18185, 9910, 47, 20674, 5179, 284, 609, 16712, 5283, 5179, 515, 197, 37654, 5283, 9626...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestBeaconDiversity(t *testing.T) { var tests = []struct { name string beacon []common.IFIDType diversity int }{ { name: "Same beacon", beacon: []common.IFIDType{graph.If_130_A_110_X, graph.If_110_X_210_X, graph.If_210_X_220_X}, diversity: 0, }, { name: "Share one link", beacon: []common.IFIDType{graph.If_130_B_120_A, graph.If_120_A_110_X, graph.If_110_X_210_X, graph.If_210_X_220_X}, diversity: 1, }, { name: "Distinct", beacon: []common.IFIDType{graph.If_130_B_120_A, graph.If_120_B_220_X, graph.If_220_X_210_X, graph.If_210_X_220_X}, diversity: 2, }, } mctrl := gomock.NewController(t) defer mctrl.Finish() g := graph.NewDefaultGraph(mctrl) bseg := testBeaconOrErr(g, tests[0].beacon...) for _, test := range tests { t.Run(test.name, func(t *testing.T) { other := testBeaconOrErr(g, test.beacon...) diversity := bseg.Beacon.Diversity(other.Beacon) assert.Equal(t, test.diversity, diversity) }) } }
explode_data.jsonl/35788
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 486 }
[ 2830, 3393, 3430, 22379, 35, 2977, 1155, 353, 8840, 836, 8, 341, 2405, 7032, 284, 3056, 1235, 341, 197, 11609, 414, 914, 198, 197, 73142, 22379, 262, 3056, 5464, 2447, 37, 915, 929, 198, 197, 63278, 388, 487, 526, 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, 1...
1
func TestGetOSFileState(t *testing.T) { file, err := ioutil.TempFile("", "") assert.NoError(t, err) fileinfo, err := file.Stat() assert.NoError(t, err) state := GetOSState(fileinfo) assert.True(t, state.Inode > 0) if runtime.GOOS == "openbsd" { // The first device on OpenBSD has an ID of 0 so allow this. assert.True(t, state.Device >= 0, "Device %d", state.Device) } else { assert.True(t, state.Device > 0, "Device %d", state.Device) } }
explode_data.jsonl/69456
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 180 }
[ 2830, 3393, 1949, 3126, 1703, 1397, 1155, 353, 8840, 836, 8, 341, 17661, 11, 1848, 1669, 43144, 65009, 1703, 19814, 14676, 6948, 35699, 1155, 11, 1848, 692, 17661, 2733, 11, 1848, 1669, 1034, 53419, 741, 6948, 35699, 1155, 11, 1848, 692...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestOkMessage8(t *testing.T) { // Check header msg := NewPacket(VERSION_2).Ok(M_USER_AUTH) if msg.Header.GetSize() != 6 { t.Fail() } }
explode_data.jsonl/29150
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 64 }
[ 2830, 3393, 11578, 2052, 23, 1155, 353, 8840, 836, 8, 341, 197, 322, 4248, 4247, 198, 21169, 1669, 1532, 16679, 7, 17636, 62, 17, 568, 11578, 3189, 9107, 22675, 340, 743, 3750, 15753, 87472, 368, 961, 220, 21, 341, 197, 3244, 57243, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestGetInstanceStock(t *testing.T) { args := &CreateInstanceStockArgs{ FlavorId: "BBC-G4-PDDAS", ZoneName: "cn-su-a", } if res, err := BBC_CLIENT.GetInstanceCreateStock(args); err != nil { fmt.Println("Get specific instance eni failed: ", err) } else { fmt.Println("Get specific instance eni success, result: ", res) } }
explode_data.jsonl/4075
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 129 }
[ 2830, 3393, 42761, 19369, 1155, 353, 8840, 836, 8, 341, 31215, 1669, 609, 4021, 2523, 19369, 4117, 515, 197, 197, 3882, 3292, 764, 25, 330, 66755, 12010, 19, 9299, 4103, 1911, 756, 197, 197, 15363, 675, 25, 330, 14271, 86129, 7409, 75...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func Test_ReplaceDockerImageURL(t *testing.T) { const replacedWithData = "testImage!" testData := []struct { testName string data File expectedResult File shouldFail bool }{ { testName: "correct data test", data: File{Content: []map[string]interface{}{{ "apiVersion": "installer.kyma-project.io/v1alpha1", "kind": "Deployment", "spec": map[interface{}]interface{}{ "template": map[interface{}]interface{}{ "spec": map[interface{}]interface{}{ "serviceAccountName": "kyma-installer", "containers": []interface{}{ map[interface{}]interface{}{ "name": "kyma-installer-container", "image": "eu.gcr.io/kyma-project/kyma-installer:63f27f76", }, }, }, }, }, }, }, }, expectedResult: File{Content: []map[string]interface{}{ { "apiVersion": "installer.kyma-project.io/v1alpha1", "kind": "Deployment", "spec": map[interface{}]interface{}{ "template": map[interface{}]interface{}{ "spec": map[interface{}]interface{}{ "serviceAccountName": "kyma-installer", "containers": []interface{}{ map[interface{}]interface{}{ "name": "kyma-installer-container", "image": replacedWithData, }, }, }, }, }, }, }, }, shouldFail: false, }, } for _, tt := range testData { err := replaceInstallerImage(&tt.data, replacedWithData) if !tt.shouldFail { require.Nil(t, err, tt.testName) require.Equal(t, tt.data, tt.expectedResult, tt.testName) } else { require.NotNil(t, err, tt.testName) } } }
explode_data.jsonl/64711
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 809 }
[ 2830, 3393, 62, 23107, 35, 13659, 1906, 3144, 1155, 353, 8840, 836, 8, 341, 4777, 12575, 80356, 284, 330, 1944, 1906, 24734, 18185, 1043, 1669, 3056, 1235, 341, 197, 18185, 675, 981, 914, 198, 197, 8924, 1843, 2887, 198, 197, 42400, 2...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestInsertionSort(t *testing.T) { ints := []int{1, 2, 8, 9, 0, -9, 8} InsertionSortInts(ints) if !checkIntsInOrder(ints) { t.Error("insertion sort failed!") } }
explode_data.jsonl/77665
{ "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, 13780, 290, 10231, 1155, 353, 8840, 836, 8, 341, 2084, 82, 1669, 3056, 396, 90, 16, 11, 220, 17, 11, 220, 23, 11, 220, 24, 11, 220, 15, 11, 481, 24, 11, 220, 23, 532, 197, 13780, 290, 10231, 1072, 82, 1548, 82, 340...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestNewRunCommandFailingCompletion(t *testing.T) { var scripts []string f := newFakeKoolRun([]builder.Command{}, nil) f.parser.(*parser.FakeParser).MockScripts = []string{"testing_script"} f.parser.(*parser.FakeParser).MockParseAvailableScriptsError = errors.New("parsing error") cmd := NewRunCommand(f) scripts, _ = cmd.ValidArgsFunction(cmd, []string{}, "") if scripts != nil { t.Errorf("expecting no suggestion, got %v", scripts) } }
explode_data.jsonl/60862
{ "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, 3564, 6727, 4062, 37, 14277, 33190, 1155, 353, 8840, 836, 8, 341, 2405, 19502, 3056, 917, 198, 1166, 1669, 501, 52317, 42, 1749, 6727, 10556, 17850, 12714, 22655, 2092, 340, 1166, 25617, 41399, 9657, 991, 726, 6570, 568, 115...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestConcurrentT_Barrier(t *testing.T) { const N = 64 const M = 32 t.Run("happy", func(t *testing.T) { ct := test.NewConcurrent(t) for i := 0; i < N; i++ { go ct.StageN("loop", N, func(t test.ConcT) { for j := 0; j < M; j++ { t.BarrierN(fmt.Sprintf("barrier %d", j), N) } }) } ct.Wait("loop") }) t.Run("fail", func(t *testing.T) { test.AssertFatal(t, func(t test.T) { ct := test.NewConcurrent(t) for i := 0; i < N; i++ { i := i go ct.StageN("loop", N, func(t test.ConcT) { if i == N/2 { t.FailBarrierN("barrier", N) } else { t.BarrierN("barrier", N) } }) } ct.Wait("loop") }) }) }
explode_data.jsonl/69827
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 366 }
[ 2830, 3393, 1109, 3231, 51, 91069, 7253, 1155, 353, 8840, 836, 8, 341, 4777, 451, 284, 220, 21, 19, 198, 4777, 386, 284, 220, 18, 17, 271, 3244, 16708, 445, 56521, 497, 2915, 1155, 353, 8840, 836, 8, 341, 197, 89216, 1669, 1273, 7...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestServicePackageUpdate(t *testing.T) { assert := assert.New(t) k := servicePackagesCollection() svc1 := ServicePackage{ ServicePackage: konnect.ServicePackage{ ID: kong.String("foo-id"), Name: kong.String("foo-name"), }, } assert.Nil(k.Add(svc1)) svc1.Name = kong.String("bar-name") assert.Nil(k.Update(svc1)) r, err := k.Get("foo-id") assert.Nil(err) assert.NotNil(r) r, err = k.Get("bar-name") assert.Nil(err) assert.NotNil(r) r, err = k.Get("foo-name") assert.NotNil(err) assert.Nil(r) }
explode_data.jsonl/51006
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 241 }
[ 2830, 3393, 1860, 13100, 4289, 1155, 353, 8840, 836, 8, 341, 6948, 1669, 2060, 7121, 1155, 340, 16463, 1669, 2473, 69513, 6482, 741, 1903, 7362, 16, 1669, 5362, 13100, 515, 197, 91619, 13100, 25, 16540, 2321, 13860, 13100, 515, 298, 295...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestHTMLValidation(t *testing.T) { tests := []struct { param string expected bool }{ {"<html>", true}, {"<script>", true}, {"<stillworks>", true}, {"</html", false}, {"</script>", true}, {"<//script>", false}, {"<123nonsense>", false}, {"test", false}, {"&example", false}, } validate := New() for i, test := range tests { errs := validate.Var(test.param, "html") if test.expected { if !IsEqual(errs, nil) { t.Fatalf("Index: %d html failed Error: %v", i, errs) } } else { if IsEqual(errs, nil) { t.Fatalf("Index: %d html failed Error: %v", i, errs) } else { val := getError(errs, "", "") if val.Tag() != "html" { t.Fatalf("Index: %d html failed Error: %v", i, errs) } } } } }
explode_data.jsonl/77357
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 351 }
[ 2830, 3393, 5835, 13799, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 3056, 1235, 341, 197, 36037, 262, 914, 198, 197, 42400, 1807, 198, 197, 59403, 197, 197, 4913, 27, 1551, 21156, 830, 1583, 197, 197, 4913, 27, 2282, 21156, 830, 1583,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestEntry_SetText_Overflow(t *testing.T) { entry := widget.NewEntry() assert.Equal(t, 0, entry.CursorColumn) test.Type(entry, "test") assert.Equal(t, 4, entry.CursorColumn) entry.SetText("x") assert.Equal(t, 1, entry.CursorColumn) key := &fyne.KeyEvent{Name: fyne.KeyDelete} entry.TypedKey(key) assert.Equal(t, 1, entry.CursorColumn) assert.Equal(t, "x", entry.Text) key = &fyne.KeyEvent{Name: fyne.KeyBackspace} entry.TypedKey(key) assert.Equal(t, 0, entry.CursorColumn) assert.Equal(t, "", entry.Text) }
explode_data.jsonl/12370
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 223 }
[ 2830, 3393, 5874, 14812, 1178, 62, 42124, 1155, 353, 8840, 836, 8, 341, 48344, 1669, 9086, 7121, 5874, 2822, 6948, 12808, 1155, 11, 220, 15, 11, 4343, 29929, 2933, 692, 18185, 10184, 18238, 11, 330, 1944, 1138, 6948, 12808, 1155, 11, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestConnection(t *testing.T) { env.LoadEnv() // Generate random jwt key authenticate.GenerateRandomKey() // Make server sent event // Connect to database appDB, err := legatoDb.Connect() if err != nil { panic(err) } timeoutContext := time.Duration(viper.GetInt("context.timeout")) * time.Second userUseCase := NewUserUseCase(appDB, timeoutContext) _ = userUseCase.CreateDefaultUser() user, _ := userUseCase.GetUserByUsername("legato") createConnection() updateConnection() var nodeID []uint for _, con := range createConnections { s, _ := userUseCase.AddConnectionToDB(user.Username, con) nodeID = append(nodeID, s.ID) } for i, con := range updateConnections { con.ID = nodeID[i] userUseCase.UpdateDataConnectionByID(user.Username, con) } userUseCase.DeleteUserConnectionById(user.Username, nodeID[0]) userUseCase.DeleteUserConnectionById(user.Username, nodeID[1]) }
explode_data.jsonl/38805
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 314 }
[ 2830, 3393, 4526, 1155, 353, 8840, 836, 8, 1476, 57538, 13969, 14359, 2822, 197, 322, 19813, 4194, 24589, 1376, 198, 197, 50060, 57582, 13999, 1592, 2822, 197, 322, 7405, 3538, 3208, 1538, 271, 197, 322, 13015, 311, 4625, 198, 28236, 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...
4
func TestDNSNameValidTLD(t *testing.T) { inputPath := "dnsNameValidTLD.pem" expected := lint.Pass out := test.TestLint("e_dnsname_not_valid_tld", inputPath) if out.Status != expected { t.Errorf("%s: expected %s, got %s", inputPath, expected, out.Status) } }
explode_data.jsonl/24841
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 108 }
[ 2830, 3393, 61088, 675, 4088, 51, 12335, 1155, 353, 8840, 836, 8, 341, 22427, 1820, 1669, 330, 45226, 675, 4088, 51, 12335, 49373, 698, 42400, 1669, 57920, 87768, 198, 13967, 1669, 1273, 8787, 47556, 445, 68, 71125, 606, 7913, 8337, 528...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestCheckHypervisorConfig(t *testing.T) { assert := assert.New(t) dir, err := ioutil.TempDir(testDir, "") if err != nil { t.Fatal(err) } defer os.RemoveAll(dir) // Not created on purpose imageENOENT := filepath.Join(dir, "image-ENOENT.img") initrdENOENT := filepath.Join(dir, "initrd-ENOENT.img") imageEmpty := filepath.Join(dir, "image-empty.img") initrdEmpty := filepath.Join(dir, "initrd-empty.img") for _, file := range []string{imageEmpty, initrdEmpty} { err = createEmptyFile(file) assert.NoError(err) } image := filepath.Join(dir, "image.img") initrd := filepath.Join(dir, "initrd.img") mb := uint32(1024 * 1024) fileSizeMB := uint32(3) fileSizeBytes := fileSizeMB * mb fileData := strings.Repeat("X", int(fileSizeBytes)) for _, file := range []string{image, initrd} { err = WriteFile(file, fileData, testFileMode) assert.NoError(err) } type testData struct { imagePath string initrdPath string memBytes uint32 expectError bool expectLogWarning bool } // Note that checkHypervisorConfig() does not check to ensure an image // or an initrd has been specified - that's handled by a separate // function, hence no test for it here. data := []testData{ {"", "", 0, true, false}, {imageENOENT, "", 2, true, false}, {"", initrdENOENT, 2, true, false}, {imageEmpty, "", 2, true, false}, {"", initrdEmpty, 2, true, false}, {image, "", fileSizeMB + 2, false, false}, {image, "", fileSizeMB + 1, false, false}, {image, "", fileSizeMB + 0, false, true}, {image, "", fileSizeMB - 1, false, true}, {image, "", fileSizeMB - 2, false, true}, {"", initrd, fileSizeMB + 2, false, false}, {"", initrd, fileSizeMB + 1, false, false}, {"", initrd, fileSizeMB + 0, true, false}, {"", initrd, fileSizeMB - 1, true, false}, {"", initrd, fileSizeMB - 2, true, false}, } for i, d := range data { savedOut := kataUtilsLogger.Logger.Out // create buffer to save logger output logBuf := &bytes.Buffer{} // capture output to buffer kataUtilsLogger.Logger.Out = logBuf config := vc.HypervisorConfig{ ImagePath: d.imagePath, InitrdPath: d.initrdPath, MemorySize: d.memBytes, } err := checkHypervisorConfig(config) if d.expectError { assert.Error(err, "test %d (%+v)", i, d) } else { assert.NoError(err, "test %d (%+v)", i, d) } if d.expectLogWarning { assert.True(strings.Contains(logBuf.String(), "warning")) } else { assert.Empty(logBuf.String()) } // reset logger kataUtilsLogger.Logger.Out = savedOut } }
explode_data.jsonl/11751
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1022 }
[ 2830, 3393, 3973, 39, 1082, 31396, 2648, 1155, 353, 8840, 836, 8, 341, 6948, 1669, 2060, 7121, 1155, 692, 48532, 11, 1848, 1669, 43144, 65009, 6184, 8623, 6184, 11, 14676, 743, 1848, 961, 2092, 341, 197, 3244, 26133, 3964, 340, 197, 5...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
7
func TestCreateNamespace(t *testing.T) { namespaceObject := &v1.Namespace{} namespaceObject.Name = "my-namespace" f, tf, codec, ns := cmdtesting.NewAPIFactory() tf.Printer = &testPrinter{} tf.Client = &fake.RESTClient{ GroupVersion: schema.GroupVersion{Version: "v1"}, NegotiatedSerializer: ns, Client: fake.CreateHTTPClient(func(req *http.Request) (*http.Response, error) { switch p, m := req.URL.Path, req.Method; { case p == "/namespaces" && m == "POST": return &http.Response{StatusCode: 201, Header: defaultHeader(), Body: objBody(codec, namespaceObject)}, nil default: t.Fatalf("unexpected request: %#v\n%#v", req.URL, req) return nil, nil } }), } buf := bytes.NewBuffer([]byte{}) cmd := NewCmdCreateNamespace(f, buf) cmd.Flags().Set("output", "name") cmd.Run(cmd, []string{namespaceObject.Name}) expectedOutput := "namespace/" + namespaceObject.Name + "\n" if buf.String() != expectedOutput { t.Errorf("expected output: %s, but got: %s", expectedOutput, buf.String()) } }
explode_data.jsonl/20780
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 394 }
[ 2830, 3393, 4021, 22699, 1155, 353, 8840, 836, 8, 341, 56623, 1190, 1669, 609, 85, 16, 46011, 16094, 56623, 1190, 2967, 284, 330, 2408, 12, 2231, 698, 1166, 11, 6409, 11, 34647, 11, 12268, 1669, 5439, 8840, 7121, 7082, 4153, 741, 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...
3
func Test_Basic2(t *testing.T) { config := `log-path = "logs"` gtest.Case(t, func() { path := gcfg.DEFAULT_CONFIG_FILE err := gfile.PutContents(path, config) gtest.Assert(err, nil) defer func() { _ = gfile.Remove(path) }() c := gcfg.New() gtest.Assert(c.Get("log-path"), "logs") }) }
explode_data.jsonl/24447
{ "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, 1668, 5971, 17, 1155, 353, 8840, 836, 8, 341, 25873, 1669, 1565, 839, 33095, 284, 330, 22081, 8805, 3174, 1944, 727, 519, 1155, 11, 2915, 368, 341, 197, 26781, 1669, 342, 14072, 14864, 12568, 8087, 198, 197, 9859, 1669, 34...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestPrettyConsole_Write(t *testing.T) { color.NoColor = false tests := []struct { name string input string want string wantError bool }{ { "headline", `{"ts":1523537728.7260377, "level":"info", "msg":"top level"}`, "2018-04-12T12:55:28Z \x1b[37m[INFO] \x1b[0mtop level \x1b[34m\x1b[0m \n", false, }, { "details", `{"ts":1523537728, "level":"debug", "msg":"top level", "details":"nuances"}`, "2018-04-12T12:55:28Z \x1b[32m[DEBUG] \x1b[0mtop level \x1b[34m\x1b[0m \x1b[32mdetails\x1b[0m=nuances \n", false, }, { "blacklist", `{"ts":1523537728, "level":"warn", "msg":"top level", "hash":"nuances"}`, "2018-04-12T12:55:28Z \x1b[33m[WARN] \x1b[0mtop level \x1b[34m\x1b[0m \n", false, }, {"error", `{"broken":}`, `{}`, true}, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { tr := &testReader{} pc := PrettyConsole{tr} _, err := pc.Write([]byte(tt.input)) if tt.wantError { assert.Error(t, err) } else { assert.Equal(t, tt.want, tr.Written) } }) } }
explode_data.jsonl/51671
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 754 }
[ 2830, 3393, 51940, 12372, 31825, 1155, 353, 8840, 836, 8, 341, 21481, 16766, 1636, 284, 895, 271, 78216, 1669, 3056, 1235, 341, 197, 11609, 414, 914, 198, 197, 22427, 257, 914, 198, 197, 50780, 414, 914, 198, 197, 50780, 1454, 1807, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestRunInvalidTransaction(t *testing.T) { anteOpt := func(bapp *BaseApp) { bapp.SetAnteHandler(func(ctx sdk.Context, tx sdk.Tx, simulate bool) (newCtx sdk.Context, err error) { return }) } routerOpt := func(bapp *BaseApp) { bapp.Router().AddRoute(routeMsgCounter, func(ctx sdk.Context, msg sdk.Msg) (*sdk.Result, error) { return &sdk.Result{}, nil }) } app := setupBaseApp(t, anteOpt, routerOpt) header := abci.Header{Height: 1} app.BeginBlock(abci.RequestBeginBlock{Header: header}) // transaction with no messages { emptyTx := &txTest{} _, result, err := app.Deliver(emptyTx) require.Error(t, err) require.Nil(t, result) space, code, _ := sdkerrors.ABCIInfo(err, false) require.EqualValues(t, sdkerrors.ErrInvalidRequest.Codespace(), space, err) require.EqualValues(t, sdkerrors.ErrInvalidRequest.ABCICode(), code, err) } // transaction where ValidateBasic fails { testCases := []struct { tx *txTest fail bool }{ {newTxCounter(0, 0), false}, {newTxCounter(-1, 0), false}, {newTxCounter(100, 100), false}, {newTxCounter(100, 5, 4, 3, 2, 1), false}, {newTxCounter(0, -1), true}, {newTxCounter(0, 1, -2), true}, {newTxCounter(0, 1, 2, -10, 5), true}, } for _, testCase := range testCases { tx := testCase.tx _, result, err := app.Deliver(tx) if testCase.fail { require.Error(t, err) space, code, _ := sdkerrors.ABCIInfo(err, false) require.EqualValues(t, sdkerrors.ErrInvalidSequence.Codespace(), space, err) require.EqualValues(t, sdkerrors.ErrInvalidSequence.ABCICode(), code, err) } else { require.NotNil(t, result) } } } // transaction with no known route { unknownRouteTx := txTest{[]sdk.Msg{msgNoRoute{}}, 0, false} _, result, err := app.Deliver(unknownRouteTx) require.Error(t, err) require.Nil(t, result) space, code, _ := sdkerrors.ABCIInfo(err, false) require.EqualValues(t, sdkerrors.ErrUnknownRequest.Codespace(), space, err) require.EqualValues(t, sdkerrors.ErrUnknownRequest.ABCICode(), code, err) unknownRouteTx = txTest{[]sdk.Msg{msgCounter{}, msgNoRoute{}}, 0, false} _, result, err = app.Deliver(unknownRouteTx) require.Error(t, err) require.Nil(t, result) space, code, _ = sdkerrors.ABCIInfo(err, false) require.EqualValues(t, sdkerrors.ErrUnknownRequest.Codespace(), space, err) require.EqualValues(t, sdkerrors.ErrUnknownRequest.ABCICode(), code, err) } // Transaction with an unregistered message { tx := newTxCounter(0, 0) tx.Msgs = append(tx.Msgs, msgNoDecode{}) // new codec so we can encode the tx, but we shouldn't be able to decode newCdc := codec.New() registerTestCodec(newCdc) newCdc.RegisterConcrete(&msgNoDecode{}, "cosmos-sdk/baseapp/msgNoDecode", nil) txBytes, err := newCdc.MarshalBinaryBare(tx) require.NoError(t, err) res := app.DeliverTx(abci.RequestDeliverTx{Tx: txBytes}) require.EqualValues(t, sdkerrors.ErrTxDecode.ABCICode(), res.Code) require.EqualValues(t, sdkerrors.ErrTxDecode.Codespace(), res.Codespace) } }
explode_data.jsonl/67058
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1247 }
[ 2830, 3393, 6727, 7928, 8070, 1155, 353, 8840, 836, 8, 341, 197, 4942, 21367, 1669, 2915, 1883, 676, 353, 3978, 2164, 8, 341, 197, 2233, 676, 4202, 17117, 68, 3050, 18552, 7502, 45402, 9328, 11, 9854, 45402, 81362, 11, 37453, 1807, 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 TestPullRequestReviewDismissalRequest_String(t *testing.T) { v := PullRequestReviewDismissalRequest{ Message: String(""), } want := `github.PullRequestReviewDismissalRequest{Message:""}` if got := v.String(); got != want { t.Errorf("PullRequestReviewDismissalRequest.String = %v, want %v", got, want) } }
explode_data.jsonl/33272
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 112 }
[ 2830, 3393, 36068, 1900, 19432, 51702, 278, 1900, 31777, 1155, 353, 8840, 836, 8, 341, 5195, 1669, 31828, 1900, 19432, 51702, 278, 1900, 515, 197, 46733, 25, 923, 445, 4461, 197, 532, 50780, 1669, 1565, 5204, 97357, 1900, 19432, 51702, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestThrowNativeConstructorName(t *testing.T) { const SCRIPT = ` function A() { try { throw new TypeError(); } catch(e) { return e; } } A().constructor.name; ` testScript1(SCRIPT, asciiString("TypeError"), t) }
explode_data.jsonl/75229
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 99 }
[ 2830, 3393, 23079, 20800, 13288, 675, 1155, 353, 8840, 836, 8, 341, 4777, 53679, 284, 1565, 1406, 7527, 362, 368, 341, 197, 6799, 341, 298, 9581, 501, 25030, 543, 197, 197, 92, 2287, 2026, 8, 341, 298, 853, 384, 280, 197, 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 TestJoinIntSet(t *testing.T) { testCases := []struct { name string set map[int]struct{} delim string expect []string // maps are unordered, therefore we expect one of these to be correct }{ { name: "single value", set: map[int]struct{}{0: {}}, delim: ", ", expect: []string{"0"}, }, { name: "multiple values", set: map[int]struct{}{0: {}, 1: {}}, delim: ", ", expect: []string{"0, 1", "1, 0"}, }, } for _, c := range testCases { t.Run(c.name, func(t *testing.T) { join := joinIntSet(c.set, c.delim) for _, e := range c.expect { if assert.ObjectsAreEqual(e, join) { return } } assert.Equal(t, c.expect[0], join) // gen automatic diff }) } }
explode_data.jsonl/73737
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 349 }
[ 2830, 3393, 12292, 1072, 1649, 1155, 353, 8840, 836, 8, 341, 18185, 37302, 1669, 3056, 1235, 341, 197, 11609, 256, 914, 198, 197, 8196, 262, 2415, 18640, 60, 1235, 16094, 197, 2698, 39795, 220, 914, 198, 197, 24952, 3056, 917, 442, 14...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_Problem0060(t *testing.T) { ast := assert.New(t) qs := []question{ question{ para{ 4, 4, }, ans{ "1342", }, }, question{ para{ 0, 4, }, ans{ "", }, }, question{ para{ 3, 3, }, ans{ "213", }, }, // 如需多个测试,可以复制上方元素。 } for _, q := range qs { a, p := q.ans, q.para fmt.Printf("~~%v~~\n", p) ast.Equal(a.one, getPermutation(p.n, p.k), "输入:%v", p) } }
explode_data.jsonl/11541
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 319 }
[ 2830, 3393, 16670, 10121, 15, 15, 21, 15, 1155, 353, 8840, 836, 8, 341, 88836, 1669, 2060, 7121, 1155, 692, 18534, 82, 1669, 3056, 7841, 4257, 197, 197, 7841, 515, 298, 197, 14794, 515, 571, 197, 19, 345, 571, 197, 19, 345, 298, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestCloseTelemetryConnection(t *testing.T) { tb.Cancel() time.Sleep(300 * time.Millisecond) if len(tb.connections) != 0 { t.Errorf("server didn't close connection") } }
explode_data.jsonl/49197
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 69 }
[ 2830, 3393, 7925, 6639, 35958, 4526, 1155, 353, 8840, 836, 8, 341, 62842, 36491, 741, 21957, 31586, 7, 18, 15, 15, 353, 882, 71482, 340, 743, 2422, 61414, 78975, 8, 961, 220, 15, 341, 197, 3244, 13080, 445, 4030, 3207, 944, 3265, 36...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestRmSuccess(t *testing.T) { testRepo := newTestRepo(t) defer testRepo.cleanup(t) require.Nil(t, testRepo.sut.Rm(true, testRepo.testFileName)) _, err := os.Stat(testRepo.testFileName) require.True(t, os.IsNotExist(err)) }
explode_data.jsonl/14024
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 105 }
[ 2830, 3393, 49, 76, 7188, 1155, 353, 8840, 836, 8, 341, 18185, 25243, 1669, 501, 2271, 25243, 1155, 340, 16867, 1273, 25243, 87689, 1155, 692, 17957, 59678, 1155, 11, 1273, 25243, 514, 332, 2013, 76, 3715, 11, 1273, 25243, 5958, 10903, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestParseConfig_PartSize(t *testing.T) { input := []byte(`bucket: "bucket-name" endpoint: "s3-endpoint" access_key: "access_key" insecure: false signature_version2: false secret_key: "secret_key" http_config: insecure_skip_verify: false idle_conn_timeout: 50s`) cfg, err := parseConfig(input) testutil.Ok(t, err) testutil.Assert(t, cfg.PartSize == 1024*1024*64, "when part size not set it should default to 128MiB") input2 := []byte(`bucket: "bucket-name" endpoint: "s3-endpoint" access_key: "access_key" insecure: false signature_version2: false secret_key: "secret_key" part_size: 104857600 http_config: insecure_skip_verify: false idle_conn_timeout: 50s`) cfg2, err := parseConfig(input2) testutil.Ok(t, err) testutil.Assert(t, cfg2.PartSize == 1024*1024*100, "when part size should be set to 100MiB") }
explode_data.jsonl/6238
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 321 }
[ 2830, 3393, 14463, 2648, 97938, 1695, 1155, 353, 8840, 836, 8, 341, 22427, 1669, 3056, 3782, 5809, 30410, 25, 330, 30410, 11494, 698, 32540, 25, 330, 82, 18, 13068, 2768, 698, 5211, 3097, 25, 330, 5211, 3097, 698, 258, 25132, 25, 895,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestPreparedCommand_Output_Verbose(t *testing.T) { os.Setenv(mg.VerboseEnv, "true") defer os.Unsetenv(mg.VerboseEnv) stdout := shx.RecordStdout() defer stdout.Release() stderr := shx.RecordStderr() defer stderr.Release() gotOutput, err := shx.Output("go", "run", "echo.go", "hello world") gotStdout := stdout.Output() gotStderr := stderr.Output() if err != nil { t.Fatal(err) } wantOutput := "hello world" assert.Equal(t, wantOutput, gotOutput) wantStdout := "hello world\n" assert.Equal(t, wantStdout, gotStdout) wantStderr := "go run echo.go hello world" assert.Contains(t, gotStderr, wantStderr) }
explode_data.jsonl/57104
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 265 }
[ 2830, 3393, 4703, 7212, 4062, 65062, 2334, 261, 8297, 1155, 353, 8840, 836, 8, 341, 25078, 4202, 3160, 1255, 70, 42505, 8297, 14359, 11, 330, 1866, 1138, 16867, 2643, 10616, 746, 3160, 1255, 70, 42505, 8297, 14359, 692, 6736, 411, 1669,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestUnitReadJSONFailure(t *testing.T) { var headers httpbinheaders client := newClient() client.BaseURL = "\t\t\t\t" err := client.GetJSON(context.Background(), "/headers", &headers) if err == nil || !strings.HasSuffix(err.Error(), "invalid control character in URL") { t.Fatal("not the error we expected") } }
explode_data.jsonl/60975
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 110 }
[ 2830, 3393, 4562, 4418, 5370, 17507, 1155, 353, 8840, 836, 8, 341, 2405, 7102, 1758, 6863, 7713, 198, 25291, 1669, 501, 2959, 741, 25291, 13018, 3144, 284, 2917, 83, 4955, 4955, 4955, 698, 9859, 1669, 2943, 2234, 5370, 5378, 19047, 1507...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestHandleDynamoDbStream(t *testing.T) { region := testConfig.Aws.Region key := testConfig.Aws.AccessKey secret := testConfig.Aws.AccessSecret endpoint := testConfig.Aws.Sqs.Endpoint var awsConfig = aws.Config{ Endpoint: aws.String(endpoint), Region: aws.String(region), Credentials: credentials.NewStaticCredentials("default", key, secret), } var awsSession = session.Must(session.NewSession(&awsConfig)) var sqsSvc = sqs.New(awsSession) handler := &DynamoDbStreamHandler{ Sqs: sqsSvc, QueueNames: testConfig.Projections.QueueNames, } var testEvent events.DynamoDBEvent if err := json.Unmarshal([]byte(testStreamPayload), &testEvent); err != nil { panic(err) } err := handler.Handle(testEvent) assert.Nil(t, err) for _, queueName := range testConfig.Projections.QueueNames { queueUrl, _ := sqsSvc.GetQueueUrl(&sqs.GetQueueUrlInput{QueueName: aws.String(queueName)}) time.Sleep(1 * time.Second) msg, _ := sqsSvc.ReceiveMessage(&sqs.ReceiveMessageInput{ QueueUrl: queueUrl.QueueUrl, }) assert.NotNil(t, msg) assert.Equal(t, 1, len(msg.Messages)) var event Event _ = json.Unmarshal([]byte(*msg.Messages[0].Body), &event) } }
explode_data.jsonl/64856
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 471 }
[ 2830, 3393, 6999, 35, 85608, 7994, 3027, 1155, 353, 8840, 836, 8, 341, 197, 3943, 1669, 1273, 2648, 875, 8915, 65642, 198, 23634, 1669, 1273, 2648, 875, 8915, 35645, 1592, 198, 197, 20474, 1669, 1273, 2648, 875, 8915, 35645, 19773, 198,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestTCMDPostDataType(t *testing.T) { data := DataType{ Name: "test-type", Label: "test-type", Description: "test asset data type from import tool", BuiltIn: false, ComplexType: false, } resp, err := post(fmt.Sprintf("%s/%s/datatype", TCDataspace, TCDataset), data) assert.NoError(t, err, "POST data type should not return error %v", err) assert.NotNil(t, resp, "POST data type should not return nil") fmt.Println(string(resp)) var result DataType err = json.Unmarshal(resp, &result) assert.NoError(t, err, "POST data type result is not a valid JSON %v", err) assert.Lessf(t, 0, result.ID, "New data type ID $d should be greater than 0", result.ID) assert.Equal(t, "test-type", result.Label, "Data type label does not match") }
explode_data.jsonl/64293
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 296 }
[ 2830, 3393, 7749, 6076, 4133, 22653, 1155, 353, 8840, 836, 8, 341, 8924, 1669, 33172, 515, 197, 21297, 25, 286, 330, 1944, 10604, 756, 197, 82126, 25, 981, 330, 1944, 10604, 756, 197, 47414, 25, 330, 1944, 9329, 821, 943, 504, 1159, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestGetSNMPConnection_v3_blumenthal(t *testing.T) { testCases := []struct { Name string Algorithm gosnmp.SnmpV3PrivProtocol Config *Snmp }{ { Name: "AES192", Algorithm: gosnmp.AES192, Config: &Snmp{ Agents: []string{"1.2.3.4"}, ClientConfig: snmp.ClientConfig{ Version: 3, MaxRepetitions: 20, ContextName: "mycontext", SecLevel: "authPriv", SecName: "myuser", AuthProtocol: "md5", AuthPassword: "password123", PrivProtocol: "AES192", PrivPassword: "password123", EngineID: "myengineid", EngineBoots: 1, EngineTime: 2, }, }, }, { Name: "AES192C", Algorithm: gosnmp.AES192C, Config: &Snmp{ Agents: []string{"1.2.3.4"}, ClientConfig: snmp.ClientConfig{ Version: 3, MaxRepetitions: 20, ContextName: "mycontext", SecLevel: "authPriv", SecName: "myuser", AuthProtocol: "md5", AuthPassword: "password123", PrivProtocol: "AES192C", PrivPassword: "password123", EngineID: "myengineid", EngineBoots: 1, EngineTime: 2, }, }, }, { Name: "AES256", Algorithm: gosnmp.AES256, Config: &Snmp{ Agents: []string{"1.2.3.4"}, ClientConfig: snmp.ClientConfig{ Version: 3, MaxRepetitions: 20, ContextName: "mycontext", SecLevel: "authPriv", SecName: "myuser", AuthProtocol: "md5", AuthPassword: "password123", PrivProtocol: "AES256", PrivPassword: "password123", EngineID: "myengineid", EngineBoots: 1, EngineTime: 2, }, }, }, { Name: "AES256C", Algorithm: gosnmp.AES256C, Config: &Snmp{ Agents: []string{"1.2.3.4"}, ClientConfig: snmp.ClientConfig{ Version: 3, MaxRepetitions: 20, ContextName: "mycontext", SecLevel: "authPriv", SecName: "myuser", AuthProtocol: "md5", AuthPassword: "password123", PrivProtocol: "AES256C", PrivPassword: "password123", EngineID: "myengineid", EngineBoots: 1, EngineTime: 2, }, }, }, } for _, tc := range testCases { t.Run(tc.Name, func(t *testing.T) { s := tc.Config err := s.Init() require.NoError(t, err) gsc, err := s.getConnection(0) require.NoError(t, err) gs := gsc.(snmp.GosnmpWrapper) require.Equal(t, gs.Version, gosnmp.Version3) sp := gs.SecurityParameters.(*gosnmp.UsmSecurityParameters) require.Equal(t, "1.2.3.4", gsc.Host()) require.EqualValues(t, 20, gs.MaxRepetitions) require.Equal(t, "mycontext", gs.ContextName) require.Equal(t, gosnmp.AuthPriv, gs.MsgFlags&gosnmp.AuthPriv) require.Equal(t, "myuser", sp.UserName) require.Equal(t, gosnmp.MD5, sp.AuthenticationProtocol) require.Equal(t, "password123", sp.AuthenticationPassphrase) require.Equal(t, tc.Algorithm, sp.PrivacyProtocol) require.Equal(t, "password123", sp.PrivacyPassphrase) require.Equal(t, "myengineid", sp.AuthoritativeEngineID) require.EqualValues(t, 1, sp.AuthoritativeEngineBoots) require.EqualValues(t, 2, sp.AuthoritativeEngineTime) }) } }
explode_data.jsonl/50787
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1692 }
[ 2830, 3393, 1949, 18966, 5781, 4526, 2273, 18, 13141, 1123, 11866, 1155, 353, 8840, 836, 8, 341, 18185, 37302, 1669, 3056, 1235, 341, 197, 21297, 414, 914, 198, 197, 197, 27847, 342, 436, 77, 1307, 87066, 1307, 53, 18, 32124, 20689, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestRot1Left(t *testing.T) { table := []struct { input *RBNode expect string }{ {&RBNode{ 10, false, &RBNode{5, true, nil, nil}, &RBNode{ 20, true, &RBNode{17, false, nil, nil}, &RBNode{25, false, nil, nil}, }, }, "B:20(R:10(R:5(,),B:17(,)),B:25(,))"}, } for _, te := range table { result := te.input.Rot1Left() if result.String() != te.expect { t.Errorf("Rot1Left() => %q, want %q", result.String(), te.expect) } } }
explode_data.jsonl/9582
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 242 }
[ 2830, 3393, 36936, 16, 5415, 1155, 353, 8840, 836, 8, 341, 26481, 1669, 3056, 1235, 341, 197, 22427, 220, 353, 29259, 1955, 198, 197, 24952, 914, 198, 197, 59403, 197, 197, 90, 5, 29259, 1955, 515, 298, 197, 16, 15, 11, 895, 345, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestRangeCacheHandleDoubleSplit(t *testing.T) { defer leaktest.AfterTest(t)() defer log.Scope(t).Close(t) // The tests starts with the descriptor [a-an) in the cache. // There are 3 ranges of interest: [a-an)[an-at)[at-b). // We're going to start a bunch of range lookups in order, and we'll assert // what happens to each one. type exp int const ( cacheHit exp = iota lookupLeader lookupCoalesced lookupWronglyCoalesced ) testCases := []struct { reverseScan bool keys []struct { key string exp exp } }{ { // [forward case] // - "aa" will hit the cache // - all others will join a coalesced request to "an" // + will lookup the meta2 desc // + will lookup the ["an"-"at") desc // - "an" and "ao" will get the correct range back // - "at" and "az" will make a second lookup // + will lookup the ["at"-"b") desc reverseScan: false, keys: []struct { key string exp exp }{ {key: "aa", exp: cacheHit}, {key: "an", exp: lookupLeader}, {key: "ao", exp: lookupCoalesced}, {key: "at", exp: lookupWronglyCoalesced}, {key: "az", exp: lookupWronglyCoalesced}, }, }, { // [reverse case] // - "aa" and "an" will hit the cache // - all others will join a coalesced request to "ao" // + will lookup the meta2 desc // + will lookup the ["at"-"b") desc // - "ao" will get the right range back // - "at" and "az" will make a second lookup // + will lookup the ["an"-"at") desc reverseScan: true, keys: []struct { key string exp exp }{ {key: "aa", exp: cacheHit}, {key: "an", exp: cacheHit}, {key: "ao", exp: lookupLeader}, {key: "at", exp: lookupCoalesced}, {key: "az", exp: lookupWronglyCoalesced}, }, }, } for _, tc := range testCases { t.Run(fmt.Sprintf("reverse=%t", tc.reverseScan), func(t *testing.T) { db := initTestDescriptorDB(t) db.disablePrefetch = true ctx := context.Background() // A request initially looks up the range descriptor ["a"-"b"). doLookup(ctx, db.cache, "aa") db.assertLookupCountEq(t, 2, "aa") // A split breaks up the range into ["a"-"an"), ["an"-"at"), ["at"-"b"). db.splitRange(t, roachpb.RKey("an")) db.splitRange(t, roachpb.RKey("at")) // A request is sent to the stale descriptor on the right half // such that a RangeKeyMismatchError is returned. _, evictToken := doLookup(ctx, db.cache, "az") // mismatchErrRange mocks out a RangeKeyMismatchError.Range response. ranges, _, pErr := db.getDescriptors(roachpb.RKey("aa"), false) if pErr != nil { t.Fatal(pErr) } mismatchErrRange := ranges[0] // The stale descriptor is evicted, the new descriptor from the error is // replaced, and a new lookup is initialized. evictToken.EvictAndReplace(ctx, roachpb.RangeInfo{Desc: mismatchErrRange}) // wg will be used to wait for all the lookups to complete. wg := sync.WaitGroup{} wg.Add(len(tc.keys)) // lookup will kick of an async range lookup. If the request is expected // to block by either going to the db or be coalesced onto another // request, this function will wait until the request gets blocked. lookup := func(key roachpb.RKey, exp exp) { var blocked <-chan struct{} var expLog string switch exp { case lookupLeader: blocked = db.notifyOn(key) case lookupWronglyCoalesced: expLog = "bad lookup coalescing; retrying" ch := make(chan struct{}) db.cache.coalesced = ch blocked = ch case lookupCoalesced: expLog = "coalesced range lookup request onto in-flight one" ch := make(chan struct{}) db.cache.coalesced = ch blocked = ch } go func(ctx context.Context) { defer wg.Done() var desc *roachpb.RangeDescriptor // Each request goes to a different key. var err error ctx, getRecording, cancel := tracing.ContextWithRecordingSpan(ctx, "test") defer cancel() tok, err := db.cache.lookupInternal( ctx, key, evictToken, tc.reverseScan) require.NoError(t, err) desc = tok.Desc() if tc.reverseScan { if !desc.ContainsKeyInverted(key) { t.Errorf("desc %s does not contain exclusive end key %s", desc, key) } } else { if !desc.ContainsKey(key) { t.Errorf("desc %s does not contain key %s", desc, key) } } if expLog != "" { rec := getRecording() _, ok := rec.FindLogMessage(expLog) if !ok { t.Errorf("didn't find expected message in trace for %s: %s. Recording:\n%s", key, expLog, rec) } } }(ctx) // If we're expecting this request to block, wait for that. if blocked != nil { select { case <-blocked: case <-time.After(10 * time.Second): t.Errorf("request didn't block:%s", key) } } // Reset the notification channel; if the lookup is internally retried // we won't be waiting for a 2nd notification. db.cache.coalesced = nil } // Block all the lookups at the db level. db.pauseRangeLookups() // Kick off all the lookups, in order. The cache hits will finish, the rest // will get blocked. for _, look := range tc.keys { lookup(roachpb.RKey(look.key), look.exp) } // All the requests that didn't hit the cache are now blocked. Unblock // them. db.resumeRangeLookups() // Wait for all requests to finish. wg.Wait() db.assertLookupCountEq(t, 2, "an and az") // All three descriptors are now correctly cached. doLookup(ctx, db.cache, "aa") db.assertLookupCountEq(t, 0, "aa") doLookup(ctx, db.cache, "ao") db.assertLookupCountEq(t, 0, "ao") doLookup(ctx, db.cache, "az") db.assertLookupCountEq(t, 0, "az") }) } }
explode_data.jsonl/28189
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 2409 }
[ 2830, 3393, 6046, 8233, 6999, 7378, 20193, 1155, 353, 8840, 836, 8, 341, 16867, 23352, 1944, 36892, 2271, 1155, 8, 741, 16867, 1487, 77940, 1155, 568, 7925, 1155, 692, 197, 322, 576, 7032, 8471, 448, 279, 16414, 508, 64, 18883, 8, 304...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
6
func Test_ComponentList_Add(t *testing.T) { t.Run("Add Component in default namespace", func(t *testing.T) { compList := newCompList(t, "../test/data/componentlist.yaml") compList.Add("comp4", "") require.Equal(t, "comp4", compList.Components[3].Name) require.Equal(t, defaultNamespace, compList.Components[3].Namespace) }) t.Run("Add Component in custom namespace", func(t *testing.T) { compList := newCompList(t, "../test/data/componentlist.yaml") namespace := "test-namespace" compList.Add("comp4", namespace) require.Equal(t, "comp4", compList.Components[3].Name) require.Equal(t, namespace, compList.Components[3].Namespace) }) }
explode_data.jsonl/4587
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 247 }
[ 2830, 3393, 80760, 852, 21346, 1155, 353, 8840, 836, 8, 341, 3244, 16708, 445, 2212, 5578, 304, 1638, 4473, 497, 2915, 1155, 353, 8840, 836, 8, 341, 197, 197, 5689, 852, 1669, 501, 13552, 852, 1155, 11, 7005, 1944, 13167, 62958, 1607,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestReconcileServiceInstanceWithTemporaryProvisionFailure(t *testing.T) { fakeKubeClient, fakeCatalogClient, fakeClusterServiceBrokerClient, testController, sharedInformers := newTestController(t, fakeosb.FakeClientConfiguration{ ProvisionReaction: &fakeosb.ProvisionReaction{ Error: osb.HTTPStatusCodeError{ StatusCode: http.StatusInternalServerError, ErrorMessage: strPtr("InternalServerError"), Description: strPtr("Something went wrong!"), }, }, }) sharedInformers.ClusterServiceBrokers().Informer().GetStore().Add(getTestClusterServiceBroker()) sharedInformers.ClusterServiceClasses().Informer().GetStore().Add(getTestClusterServiceClass()) sharedInformers.ClusterServicePlans().Informer().GetStore().Add(getTestClusterServicePlan()) instance := getTestServiceInstanceWithClusterRefs() ////////////////////////////////////// // Check 1st reconcilliation iteration (prepare/validate request & set status to in progress) if err := reconcileServiceInstance(t, testController, instance); err != nil { t.Fatalf("Reconcile not expected to fail : %v", err) } brokerActions := fakeClusterServiceBrokerClient.Actions() assertNumberOfBrokerActions(t, brokerActions, 0) expectedKubeActions := []kubeClientAction{ {verb: "get", resourceName: "namespaces", checkType: checkGetActionType}, } kubeActions := fakeKubeClient.Actions() if err := checkKubeClientActions(kubeActions, expectedKubeActions); err != nil { t.Fatal(err) } actions := fakeCatalogClient.Actions() assertNumberOfActions(t, actions, 1) updatedServiceInstance := assertUpdateStatus(t, actions[0], instance) events := getRecordedEvents(testController) updatedServiceInstance = assertUpdateStatus(t, actions[0], instance) assertServiceInstanceOperationInProgress(t, updatedServiceInstance, v1beta1.ServiceInstanceOperationProvision, testClusterServicePlanName, testClusterServicePlanGUID, instance, ) ////////////////////////////////////// // Check 2nd reconcilliation iteration (actual broker request) fakeCatalogClient.ClearActions() fakeKubeClient.ClearActions() instance = updatedServiceInstance.(*v1beta1.ServiceInstance) if err := reconcileServiceInstance(t, testController, instance); err == nil { t.Fatalf("Should not be able to make the ServiceInstance") } brokerActions = fakeClusterServiceBrokerClient.Actions() assertNumberOfBrokerActions(t, brokerActions, 1) assertProvision(t, brokerActions[0], &osb.ProvisionRequest{ AcceptsIncomplete: true, InstanceID: testServiceInstanceGUID, ServiceID: testClusterServiceClassGUID, PlanID: testClusterServicePlanGUID, OrganizationGUID: testClusterID, SpaceGUID: testNamespaceGUID, Context: testContext, }) // verify no kube resources created // One single action comes from getting namespace uid kubeActions = fakeKubeClient.Actions() if err := checkKubeClientActions(kubeActions, []kubeClientAction{ {verb: "get", resourceName: "namespaces", checkType: checkGetActionType}, }); err != nil { t.Fatal(err) } actions = fakeCatalogClient.Actions() assertNumberOfActions(t, actions, 1) updatedServiceInstance = assertUpdateStatus(t, actions[0], instance) assertServiceInstanceRequestFailingErrorStartOrphanMitigation( t, updatedServiceInstance, v1beta1.ServiceInstanceOperationProvision, startingInstanceOrphanMitigationReason, "", errorProvisionCallFailedReason, instance, ) events = getRecordedEvents(testController) message := fmt.Sprintf( "Error provisioning ServiceInstance of ClusterServiceClass (K8S: %q ExternalName: %q) at ClusterServiceBroker %q: Status: %v; ErrorMessage: %s", "cscguid", "test-clusterserviceclass", "test-clusterservicebroker", 500, "InternalServerError; Description: Something went wrong!; ResponseError: <nil>", ) expectedProvisionCallEvent := warningEventBuilder(errorProvisionCallFailedReason).msg(message) expectedOrphanMitigationEvent := warningEventBuilder(startingInstanceOrphanMitigationReason). msg("The instance provision call failed with an ambiguous error; attempting to deprovision the instance in order to mitigate an orphaned resource") expectedEvents := []string{ expectedProvisionCallEvent.String(), expectedOrphanMitigationEvent.String(), } if err := checkEvents(events, expectedEvents); err != nil { t.Fatal(err) } }
explode_data.jsonl/58139
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1365 }
[ 2830, 3393, 693, 40446, 457, 1860, 2523, 2354, 59362, 1336, 13013, 17507, 1155, 353, 8840, 836, 8, 341, 1166, 726, 42, 3760, 2959, 11, 12418, 41606, 2959, 11, 12418, 28678, 1860, 65545, 2959, 11, 1273, 2051, 11, 6094, 37891, 388, 1669, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestRunWithCancelledContext(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) cancel() // cause failure measurer := tlstool.NewExperimentMeasurer(tlstool.Config{}) measurement := new(model.Measurement) measurement.Input = "dns.google:853" err := measurer.Run( ctx, &mockable.Session{}, measurement, model.NewPrinterCallbacks(log.Log), ) if err != nil { t.Fatal(err) } sk, err := measurer.GetSummaryKeys(measurement) if err != nil { t.Fatal(err) } if _, ok := sk.(tlstool.SummaryKeys); !ok { t.Fatal("invalid type for summary keys") } }
explode_data.jsonl/4139
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 240 }
[ 2830, 3393, 51918, 39473, 1972, 1155, 353, 8840, 836, 8, 341, 20985, 11, 9121, 1669, 2266, 26124, 9269, 5378, 19047, 2398, 84441, 368, 442, 5240, 7901, 198, 49294, 56294, 1669, 29796, 267, 1749, 7121, 77780, 7823, 56294, 1155, 36687, 1749...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestGetStateValidateChannel(t *testing.T) { assert := assert.New(t) pn := NewPubNub(NewDemoConfig()) opts := &getStateOpts{ pubnub: pn, } assert.Equal("pubnub/validation: pubnub: \v: Missing Channel or Channel Group", opts.validate().Error()) }
explode_data.jsonl/32499
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 100 }
[ 2830, 3393, 1949, 1397, 17926, 9629, 1155, 353, 8840, 836, 8, 341, 6948, 1669, 2060, 7121, 1155, 340, 3223, 77, 1669, 1532, 29162, 45, 392, 35063, 37413, 2648, 2398, 64734, 1669, 609, 62353, 43451, 515, 197, 62529, 77, 392, 25, 43050, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestSchemaParser_SimpleNonNullType(t *testing.T) { body := ` type Hello { world: String! }` astDoc := parse(t, body) expected := &ast.Document{ Loc: testLoc(1, 32), Definitions: []ast.Node{ &ast.ObjectDefinition{ Loc: testLoc(1, 32), Name: &ast.Name{ Value: "Hello", Loc: testLoc(6, 11), }, Fields: []*ast.FieldDefinition{ { Loc: testLoc(16, 30), Name: &ast.Name{ Value: "world", Loc: testLoc(16, 21), }, Type: &ast.NonNull{ Loc: testLoc(23, 30), Type: &ast.Named{ Loc: testLoc(23, 29), Name: &ast.Name{ Value: "String", Loc: testLoc(23, 29), }, }, }, }, }, }, }, } if !reflect.DeepEqual(astDoc, expected) { t.Fatalf("unexpected document, expected: %v, got: %v", expected, astDoc) } }
explode_data.jsonl/51219
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 459 }
[ 2830, 3393, 8632, 6570, 1098, 6456, 16834, 929, 1155, 353, 8840, 836, 8, 341, 35402, 1669, 22074, 1313, 21927, 341, 220, 1879, 25, 923, 4894, 31257, 88836, 9550, 1669, 4715, 1155, 11, 2487, 340, 42400, 1669, 609, 559, 26256, 515, 197, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestGetEvent_ReadAnnotations(t *testing.T) { want := map[string]string{ "topic": "function.deployed", } val, _ := json.Marshal(want) os.Setenv("Http_Annotations", string(val)) eventInfo, err := getEventFromEnv() if err != nil { t.Errorf(err.Error()) t.Fail() } for k, v := range want { if _, ok := eventInfo.Annotations[k]; !ok { t.Errorf("want %s to be present in event.Labels", k) continue } if vv, _ := eventInfo.Annotations[k]; vv != v { t.Errorf("value of %s, want: %s, got %s", k, v, vv) } } }
explode_data.jsonl/11971
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 235 }
[ 2830, 3393, 1949, 1556, 38381, 21418, 1155, 353, 8840, 836, 8, 1476, 50780, 1669, 2415, 14032, 30953, 515, 197, 197, 1, 16411, 788, 330, 1688, 67121, 291, 756, 197, 630, 19302, 11, 716, 1669, 2951, 37271, 3622, 517, 340, 25078, 4202, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestGetShortNameMode(t *testing.T) { tests := []struct { path string mode types.ShortNameMode mustFail bool }{ { "testdata/aliases.conf", types.ShortNameModeEnforcing, false, }, { "testdata/registries.conf.d/config-2.conf", types.ShortNameModePermissive, false, }, { "testdata/registries.conf.d/config-3.conf", types.ShortNameModePermissive, // empty -> default to permissive false, }, { "testdata/invalid-short-name-mode.conf", -1, true, }, } for _, test := range tests { sys := &types.SystemContext{ SystemRegistriesConfPath: test.path, SystemRegistriesConfDirPath: "testdata/this-does-not-exist", } mode, err := GetShortNameMode(sys) if test.mustFail { assert.Error(t, err) continue } require.NoError(t, err) assert.Equal(t, test.mode, mode, "%s", test.path) } }
explode_data.jsonl/62242
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 384 }
[ 2830, 3393, 1949, 12472, 675, 3636, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 3056, 1235, 341, 197, 26781, 257, 914, 198, 197, 60247, 257, 4494, 55958, 675, 3636, 198, 197, 2109, 590, 19524, 1807, 198, 197, 59403, 197, 197, 515, 298,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestIssue3797(t *testing.T) { rex := docker.AuthConfiguration{ Username: "rex", Password: "tiny arms", Email: "rex@example.com", } dk := &credentialprovider.BasicDockerKeyring{} dk.Add(credentialprovider.DockerConfig{ "https://quay.io/v1/": credentialprovider.DockerConfigEntry{ Username: rex.Username, Password: rex.Password, Email: rex.Email, }, }) tests := []struct { image string match []docker.AuthConfiguration ok bool }{ // direct match {"quay.io", []docker.AuthConfiguration{rex}, true}, // partial matches {"quay.io/foo", []docker.AuthConfiguration{rex}, true}, {"quay.io/foo/bar", []docker.AuthConfiguration{rex}, true}, } for i, tt := range tests { match, ok := dk.Lookup(tt.image) if tt.ok != ok { t.Errorf("case %d: expected ok=%t, got %t", i, tt.ok, ok) } if !reflect.DeepEqual(tt.match, match) { t.Errorf("case %d: expected match=%#v, got %#v", i, tt.match, match) } } }
explode_data.jsonl/11454
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 407 }
[ 2830, 3393, 42006, 18, 22, 24, 22, 1155, 353, 8840, 836, 8, 341, 17200, 87, 1669, 26588, 25233, 7688, 515, 197, 197, 11115, 25, 330, 37539, 756, 197, 197, 4876, 25, 330, 46116, 11715, 756, 197, 197, 4781, 25, 262, 330, 37539, 35487,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestStorageClassOnlyBootstrap(t *testing.T) { const scName = "storageclass-only" orchestrator := getOrchestrator(t) originalSC, err := orchestrator.AddStorageClass( ctx(), &storageclass.Config{ Name: scName, Attributes: map[string]sa.Request{ sa.Media: sa.NewStringRequest("hdd"), sa.ProvisioningType: sa.NewStringRequest("thick"), sa.RecoveryTest: sa.NewBoolRequest(true), }, }, ) if err != nil { t.Fatal("Unable to add storage class: ", err) } newOrchestrator := getOrchestrator(t) bootstrappedSC, err := newOrchestrator.GetStorageClass(ctx(), scName) if bootstrappedSC == nil || err != nil { t.Error("Unable to find storage class after bootstrapping.") } else if !reflect.DeepEqual(bootstrappedSC, originalSC) { t.Errorf("External storage classs differ:\n\tOriginal: %v\n\tBootstrapped: %v", originalSC, bootstrappedSC) } cleanup(t, orchestrator) }
explode_data.jsonl/62731
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 352 }
[ 2830, 3393, 5793, 1957, 7308, 45511, 1155, 353, 8840, 836, 8, 341, 4777, 1136, 675, 284, 330, 16172, 1040, 15382, 1837, 197, 21584, 15111, 850, 1669, 633, 2195, 331, 15111, 850, 1155, 340, 197, 9889, 3540, 11, 1848, 1669, 65128, 850, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 Test_Mock_Return_After(t *testing.T) { // make a test impl object var mockedService = new(TestExampleImplementation) c := mockedService.Mock. On("TheExampleMethod", "A", "B", true). Return(1, "two", true). After(time.Second) require.Equal(t, []*Call{c}, mockedService.ExpectedCalls) call := mockedService.Mock.ExpectedCalls[0] assert.Equal(t, "TheExampleMethod", call.Method) assert.Equal(t, "A", call.Arguments[0]) assert.Equal(t, "B", call.Arguments[1]) assert.Equal(t, true, call.Arguments[2]) assert.Equal(t, 1, call.ReturnArguments[0]) assert.Equal(t, "two", call.ReturnArguments[1]) assert.Equal(t, true, call.ReturnArguments[2]) assert.Equal(t, 0, call.Repeatability) assert.NotEqual(t, nil, call.WaitFor) }
explode_data.jsonl/8581
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 323 }
[ 2830, 3393, 1245, 1176, 53316, 1566, 1046, 1155, 353, 8840, 836, 8, 8022, 197, 322, 1281, 264, 1273, 11605, 1633, 319, 2405, 46149, 1860, 284, 501, 31159, 13314, 36850, 7229, 1444, 1669, 46149, 1860, 24664, 3224, 197, 86391, 445, 785, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_newFunctionTests(t *testing.T) { // Download templates templatePullLocalTemplateRepo(t) defer tearDownFetchTemplates(t) for _, testcase := range NewFunctionTests { t.Run(testcase.title, func(t *testing.T) { defer tearDownNewFunction(t, testcase.funcName) runNewFunctionTest(t, testcase) }) } }
explode_data.jsonl/47227
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 121 }
[ 2830, 3393, 5921, 5152, 18200, 1155, 353, 8840, 836, 8, 341, 197, 322, 8577, 19911, 198, 22832, 36068, 7319, 7275, 25243, 1155, 340, 16867, 32825, 20714, 51195, 1155, 692, 2023, 8358, 70080, 1669, 2088, 1532, 5152, 18200, 341, 197, 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...
1
func TestIssue11333(t *testing.T) { store, clean := testkit.CreateMockStore(t) defer clean() tk := testkit.NewTestKit(t, store) tk.MustExec("use test") tk.MustExec("drop table if exists t;") tk.MustExec("drop table if exists t1;") tk.MustExec("create table t(col1 decimal);") tk.MustExec(" insert into t values(0.00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000);") tk.MustQuery(`select * from t;`).Check(testkit.Rows("0")) tk.MustExec("create table t1(col1 decimal(65,30));") tk.MustExec(" insert into t1 values(0.00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000);") tk.MustQuery(`select * from t1;`).Check(testkit.Rows("0.000000000000000000000000000000")) tk.MustQuery(`select 0.00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000;`).Check(testkit.Rows("0.000000000000000000000000000000000000000000000000000000000000000000000000")) tk.MustQuery(`select 0.0000000000000000000000000000000000000000000000000000000000000000000000012;`).Check(testkit.Rows("0.000000000000000000000000000000000000000000000000000000000000000000000001")) tk.MustQuery(`select 0.000000000000000000000000000000000000000000000000000000000000000000000001;`).Check(testkit.Rows("0.000000000000000000000000000000000000000000000000000000000000000000000001")) }
explode_data.jsonl/65567
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 341 }
[ 2830, 3393, 42006, 16, 16, 18, 18, 18, 1155, 353, 8840, 836, 8, 341, 57279, 11, 4240, 1669, 1273, 8226, 7251, 11571, 6093, 1155, 340, 16867, 4240, 2822, 3244, 74, 1669, 1273, 8226, 7121, 2271, 7695, 1155, 11, 3553, 340, 3244, 74, 50...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestU128_EncodeDecode(t *testing.T) { assertRoundtrip(t, NewU128(*big.NewInt(0))) assertRoundtrip(t, NewU128(*big.NewInt(12))) bigPos := big.NewInt(0) bigPos.SetBytes([]byte{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}) assertRoundtrip(t, NewU128(*bigPos)) }
explode_data.jsonl/18415
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 127 }
[ 2830, 3393, 52, 16, 17, 23, 93529, 534, 32564, 1155, 353, 8840, 836, 8, 341, 6948, 27497, 32981, 1155, 11, 1532, 52, 16, 17, 23, 4071, 16154, 7121, 1072, 7, 15, 5929, 6948, 27497, 32981, 1155, 11, 1532, 52, 16, 17, 23, 4071, 16154...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestCStore_AnyContains(t *testing.T) { cs := New() cs.StoreKey("_com_liferay_portal_redirect") cs.StoreKey("some_body_once_told_me_the_world_is_gonna_roll_me") cs.StoreKey("potato") type args struct { pattern string } tests := []struct { name string args args want bool }{ {"contains substr", args{"redirect"}, true}, {"contains exactly", args{"potato"}, true}, {"doesnt_contain", args{"kiwi"}, false}, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { if got := cs.AnyContains(tt.args.pattern); got != tt.want { t.Errorf("CStore.AnyContains() = %v, want %v", got, tt.want) } }) } }
explode_data.jsonl/59222
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 274 }
[ 2830, 3393, 34, 6093, 1566, 3834, 23805, 1155, 353, 8840, 836, 8, 341, 71899, 1669, 1532, 2822, 71899, 38047, 1592, 16975, 874, 907, 33204, 97077, 30043, 1138, 71899, 38047, 1592, 445, 14689, 14114, 7630, 528, 813, 16612, 16068, 31792, 68...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestEmbeddedStructA2(t *testing.T) { testJsonFromStruct(t, A2{}, `{ "swagger.A2": { "id": "swagger.A2", "required": [ "B" ], "properties": { "B": { "type": "integer", "description": "", "format": "int32" } } } }`) }
explode_data.jsonl/39935
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 138 }
[ 2830, 3393, 83466, 9422, 32, 17, 1155, 353, 8840, 836, 8, 341, 18185, 5014, 3830, 9422, 1155, 11, 362, 17, 22655, 1565, 515, 220, 330, 74755, 875, 17, 788, 341, 256, 330, 307, 788, 330, 74755, 875, 17, 756, 256, 330, 6279, 788, 22...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestNumber(t *testing.T) { t.Parallel() fabBlock, err := getBlock("./mock/sampleblock.pb") assert.NoError(t, err) block, _ := FromFabricBlock(fabBlock) number := block.Number() assert.Equal(t, uint64(7), number) }
explode_data.jsonl/40040
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 89 }
[ 2830, 3393, 2833, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 2822, 1166, 370, 4713, 11, 1848, 1669, 633, 4713, 13988, 16712, 69851, 4574, 37916, 1138, 6948, 35699, 1155, 11, 1848, 692, 47996, 11, 716, 1669, 5542, 81731, 4713, 955,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestSnmpTableCache_hit(t *testing.T) { snmpTableCaches = map[string]snmpTableCache{ "foo": { mibName: "a", oidNum: "b", oidText: "c", fields: []Field{{Name: "d"}}, err: fmt.Errorf("e"), }, } mibName, oidNum, oidText, fields, err := snmpTable("foo") require.Equal(t, "a", mibName) require.Equal(t, "b", oidNum) require.Equal(t, "c", oidText) require.Equal(t, []Field{{Name: "d"}}, fields) require.Equal(t, fmt.Errorf("e"), err) }
explode_data.jsonl/50800
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 224 }
[ 2830, 3393, 20720, 1307, 2556, 8233, 37697, 1155, 353, 8840, 836, 8, 341, 48251, 1307, 2556, 34, 14242, 284, 2415, 14032, 60, 9613, 1307, 2556, 8233, 515, 197, 197, 1, 7975, 788, 341, 298, 2109, 59344, 25, 330, 64, 756, 298, 197, 58...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestJobRestrictedManager(t *testing.T) { c := NewCtx(t) defer c.Close() build := testBuild(1) build.Manager = "restricted-manager" c.client2.UploadBuild(build) crash := testCrash(build, 1) crash.ReproSyz = []byte("repro syz") c.client2.ReportCrash(crash) c.client2.pollAndFailBisectJob(build.Manager) sender := c.pollEmailBug().Sender // Testing on a wrong repo must fail and no test jobs passed to manager. c.incomingEmail(sender, "#syz test: git://mygit.com/git.git master\n", EmailOptMessageID(1)) c.expectEQ(strings.Contains((<-c.emailSink).Body, "you should test only on restricted.git"), true) pollResp := c.client2.pollJobs(build.Manager) c.expectEQ(pollResp.ID, "") // Testing on the right repo must succeed. c.incomingEmail(sender, "#syz test: git://restricted.git/restricted.git master\n", EmailOptMessageID(2)) pollResp = c.client2.pollJobs(build.Manager) c.expectNE(pollResp.ID, "") c.expectEQ(pollResp.Type, dashapi.JobTestPatch) c.expectEQ(pollResp.Manager, build.Manager) c.expectEQ(pollResp.KernelRepo, "git://restricted.git/restricted.git") }
explode_data.jsonl/51142
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 413 }
[ 2830, 3393, 12245, 86405, 2043, 1155, 353, 8840, 836, 8, 341, 1444, 1669, 1532, 23684, 1155, 340, 16867, 272, 10421, 2822, 69371, 1669, 1273, 11066, 7, 16, 340, 69371, 58298, 284, 330, 50797, 44896, 698, 1444, 6581, 17, 86597, 11066, 43...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestLaunchRequestNoDebug_GoodStatus(t *testing.T) { runTest(t, "increment", func(client *daptest.Client, fixture protest.Fixture) { runNoDebugDebugSession(t, client, func() { client.LaunchRequestWithArgs(map[string]interface{}{ "noDebug": true, "mode": "debug", "program": fixture.Source, "output": "__mybin"}) }, fixture.Source, []int{8}, 0) }) }
explode_data.jsonl/17347
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 151 }
[ 2830, 3393, 32067, 1900, 2753, 7939, 2646, 1386, 2522, 1155, 353, 8840, 836, 8, 341, 56742, 2271, 1155, 11, 330, 35744, 497, 2915, 12805, 353, 91294, 1944, 11716, 11, 12507, 8665, 991, 12735, 8, 341, 197, 56742, 2753, 7939, 7939, 5283, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestSub(t *testing.T) { t.Parallel() v := viper.New() v.Set("sub", map[string]interface{}{ "key": "value", }) provider := &Provider{v} sub := provider.Sub("sub") val := getString(sub.Get("key")) if val != "value" { t.Fatalf("expected 'value', got '%#v'", val) } }
explode_data.jsonl/74511
{ "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, 3136, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 741, 5195, 1669, 95132, 7121, 741, 5195, 4202, 445, 1966, 497, 2415, 14032, 31344, 67066, 197, 197, 1, 792, 788, 330, 957, 756, 197, 3518, 197, 19979, 1669, 609, 5179,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestAccPingFederateKerberosRealmResource(t *testing.T) { resourceName := "pingfederate_kerberos_realm.demo" resource.ParallelTest(t, resource.TestCase{ Providers: testAccProviders, CheckDestroy: testAccCheckPingFederateKerberosRealmResourceDestroy, Steps: []resource.TestStep{ { Config: testAccPingFederateKerberosRealmResourceConfig("bar.foo"), Check: resource.ComposeTestCheckFunc( testAccCheckPingFederateKerberosRealmResourceExists(resourceName), ), }, { Config: testAccPingFederateKerberosRealmResourceConfig("foo.foo"), Check: resource.ComposeTestCheckFunc( testAccCheckPingFederateKerberosRealmResourceExists(resourceName), ), }, { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ "kerberos_password", "kerberos_encrypted_password", }, }, }, }) }
explode_data.jsonl/78172
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 386 }
[ 2830, 3393, 14603, 69883, 37, 7294, 349, 42, 261, 92795, 64290, 4783, 1155, 353, 8840, 836, 8, 341, 50346, 675, 1669, 330, 9989, 69, 7294, 349, 4698, 261, 92795, 1288, 7673, 26260, 1837, 50346, 41288, 7957, 2271, 1155, 11, 5101, 31363, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestReadNodeConfigLocalVolumeDirQuota(t *testing.T) { tests := map[string]struct { config string expected string }{ "null quota": { config: ` apiVersion: v1 volumeConfig: localQuota: perFSGroup: null `, expected: "", }, "missing quota": { config: ` apiVersion: v1 volumeConfig: localQuota: `, expected: "", }, "missing localQuota": { config: ` apiVersion: v1 volumeConfig: `, expected: "", }, "missing volumeConfig": { config: ` apiVersion: v1 `, expected: "", }, "no unit (bytes) quota": { config: ` apiVersion: v1 volumeConfig: localQuota: perFSGroup: 200000 `, expected: "200k", }, "Kb quota": { config: ` apiVersion: v1 volumeConfig: localQuota: perFSGroup: 200Ki `, expected: "200Ki", }, "Mb quota": { config: ` apiVersion: v1 volumeConfig: localQuota: perFSGroup: 512Mi `, expected: "512Mi", }, "Gb quota": { config: ` apiVersion: v1 volumeConfig: localQuota: perFSGroup: 2Gi `, expected: "2Gi", }, "Tb quota": { config: ` apiVersion: v1 volumeConfig: localQuota: perFSGroup: 2Ti `, expected: "2Ti", }, // This is invalid config, would be caught by validation but just // testing it parses ok: "negative quota": { config: ` apiVersion: v1 volumeConfig: localQuota: perFSGroup: -512Mi `, expected: "-512Mi", }, "zero quota": { config: ` apiVersion: v1 volumeConfig: localQuota: perFSGroup: 0 `, expected: "0", }, } for name, test := range tests { t.Logf("Running test: %s", name) nodeConfig := &internal.NodeConfig{} if err := latest.ReadYAMLInto([]byte(test.config), nodeConfig); err != nil { t.Errorf("Error reading yaml: %s", err.Error()) } if test.expected == "" && nodeConfig.VolumeConfig.LocalQuota.PerFSGroup != nil { t.Errorf("Expected empty quota but got: %v", nodeConfig.VolumeConfig.LocalQuota.PerFSGroup) } if test.expected != "" { if nodeConfig.VolumeConfig.LocalQuota.PerFSGroup == nil { t.Errorf("Expected quota: %s, got: nil", test.expected) } else { amount := nodeConfig.VolumeConfig.LocalQuota.PerFSGroup t.Logf("%s", amount.String()) if test.expected != amount.String() { t.Errorf("Expected quota: %s, got: %s", test.expected, amount.String()) } } } } }
explode_data.jsonl/15630
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 977 }
[ 2830, 3393, 4418, 1955, 2648, 7319, 18902, 6184, 2183, 6089, 1155, 353, 8840, 836, 8, 1476, 78216, 1669, 2415, 14032, 60, 1235, 341, 197, 25873, 256, 914, 198, 197, 42400, 914, 198, 197, 59403, 197, 197, 1, 2921, 42042, 788, 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...
8
func TestHashDeterministicFieldsOnly(t *testing.T) { tr1 := abci.ExecTxResult{ Code: 1, Data: []byte("transaction"), Log: "nondeterministic data: abc", Info: "nondeterministic data: abc", GasWanted: 1000, GasUsed: 1000, Events: []abci.Event{}, Codespace: "nondeterministic.data.abc", } tr2 := abci.ExecTxResult{ Code: 1, Data: []byte("transaction"), Log: "nondeterministic data: def", Info: "nondeterministic data: def", GasWanted: 1000, GasUsed: 1000, Events: []abci.Event{}, Codespace: "nondeterministic.data.def", } r1, err := abci.MarshalTxResults([]*abci.ExecTxResult{&tr1}) require.NoError(t, err) r2, err := abci.MarshalTxResults([]*abci.ExecTxResult{&tr2}) require.NoError(t, err) require.Equal(t, merkle.HashFromByteSlices(r1), merkle.HashFromByteSlices(r2)) }
explode_data.jsonl/22082
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 402 }
[ 2830, 3393, 6370, 92648, 4532, 8941, 7308, 1155, 353, 8840, 836, 8, 341, 25583, 16, 1669, 668, 5855, 30798, 31584, 2077, 515, 197, 90774, 25, 414, 220, 16, 345, 197, 40927, 25, 414, 3056, 3782, 445, 13528, 4461, 197, 24201, 25, 981, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestMetricFromProto(t *testing.T) { var m Metric inputs := []metricpb.TimedMetric{testMetric1Proto, testMetric2Proto} expected := []Metric{testMetric1, testMetric2} for i := 0; i < len(inputs); i++ { require.NoError(t, m.FromProto(inputs[i])) require.Equal(t, expected[i], m) } }
explode_data.jsonl/75076
{ "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, 54310, 3830, 31549, 1155, 353, 8840, 836, 8, 341, 2405, 296, 52458, 198, 22427, 82, 1669, 3056, 15903, 16650, 836, 75485, 54310, 90, 1944, 54310, 16, 31549, 11, 1273, 54310, 17, 31549, 532, 42400, 1669, 3056, 54310, 90, 1944...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestAccessLog(t *testing.T) { server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {})) testCases := []struct { desc string routersConfig map[string]*dynamic.Router serviceConfig map[string]*dynamic.Service middlewaresConfig map[string]*dynamic.Middleware entryPoints []string expected string }{ { desc: "apply routerName in accesslog (first match)", routersConfig: map[string]*dynamic.Router{ "foo": { EntryPoints: []string{"web"}, Service: "foo-service", Rule: "Host(`foo.bar`)", }, "bar": { EntryPoints: []string{"web"}, Service: "foo-service", Rule: "Host(`bar.foo`)", }, }, serviceConfig: map[string]*dynamic.Service{ "foo-service": { LoadBalancer: &dynamic.ServersLoadBalancer{ Servers: []dynamic.Server{ { URL: server.URL, }, }, }, }, }, entryPoints: []string{"web"}, expected: "foo", }, { desc: "apply routerName in accesslog (second match)", routersConfig: map[string]*dynamic.Router{ "foo": { EntryPoints: []string{"web"}, Service: "foo-service", Rule: "Host(`bar.foo`)", }, "bar": { EntryPoints: []string{"web"}, Service: "foo-service", Rule: "Host(`foo.bar`)", }, }, serviceConfig: map[string]*dynamic.Service{ "foo-service": { LoadBalancer: &dynamic.ServersLoadBalancer{ Servers: []dynamic.Server{ { URL: server.URL, }, }, }, }, }, entryPoints: []string{"web"}, expected: "bar", }, } for _, test := range testCases { t.Run(test.desc, func(t *testing.T) { rtConf := runtime.NewConfig(dynamic.Configuration{ HTTP: &dynamic.HTTPConfiguration{ Services: test.serviceConfig, Routers: test.routersConfig, Middlewares: test.middlewaresConfig, }, }) serviceManager := service.NewManager(rtConf.Services, http.DefaultTransport, nil, nil) middlewaresBuilder := middleware.NewBuilder(rtConf.Middlewares, serviceManager) responseModifierFactory := responsemodifiers.NewBuilder(rtConf.Middlewares) chainBuilder := middleware.NewChainBuilder(static.Configuration{}, nil, nil) routerManager := NewManager(rtConf, serviceManager, middlewaresBuilder, responseModifierFactory, chainBuilder) handlers := routerManager.BuildHandlers(context.Background(), test.entryPoints, false) w := httptest.NewRecorder() req := testhelpers.MustNewRequest(http.MethodGet, "http://foo.bar/", nil) accesslogger, err := accesslog.NewHandler(&types.AccessLog{ Format: "json", }) require.NoError(t, err) reqHost := requestdecorator.New(nil) accesslogger.ServeHTTP(w, req, http.HandlerFunc(func(rw http.ResponseWriter, req *http.Request) { reqHost.ServeHTTP(w, req, handlers["web"].ServeHTTP) data := accesslog.GetLogData(req) require.NotNil(t, data) assert.Equal(t, test.expected, data.Core[accesslog.RouterName]) })) }) } }
explode_data.jsonl/25181
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1355 }
[ 2830, 3393, 6054, 2201, 1155, 353, 8840, 836, 8, 341, 41057, 1669, 54320, 70334, 7121, 5475, 19886, 89164, 18552, 3622, 1758, 37508, 11, 435, 353, 1254, 9659, 8, 4687, 4390, 18185, 37302, 1669, 3056, 1235, 341, 197, 41653, 1060, 914, 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 TestShouldHashArgon2idPassword(t *testing.T) { hash, err := HashPassword("password", "BpLnfgDsc2WD8F2q", HashingAlgorithmArgon2id, schema.DefaultCIPasswordConfiguration.Iterations, schema.DefaultCIPasswordConfiguration.Memory*1024, schema.DefaultCIPasswordConfiguration.Parallelism, schema.DefaultCIPasswordConfiguration.KeyLength, schema.DefaultCIPasswordConfiguration.SaltLength) assert.NoError(t, err) code, parameters, salt, key, err := crypt.DecodeSettings(hash) assert.NoError(t, err) assert.Equal(t, argon2id, code) assert.Equal(t, "BpLnfgDsc2WD8F2q", salt) assert.Equal(t, "f+Y+KaS12gkNHN0Llc9kqDZuk1OYvoXj8t+5DcPbgY4", key) assert.Equal(t, schema.DefaultCIPasswordConfiguration.Iterations, parameters.GetInt("t", HashingDefaultArgon2idTime)) assert.Equal(t, schema.DefaultCIPasswordConfiguration.Memory*1024, parameters.GetInt("m", HashingDefaultArgon2idMemory)) assert.Equal(t, schema.DefaultCIPasswordConfiguration.Parallelism, parameters.GetInt("p", HashingDefaultArgon2idParallelism)) assert.Equal(t, schema.DefaultCIPasswordConfiguration.KeyLength, parameters.GetInt("k", HashingDefaultArgon2idKeyLength)) }
explode_data.jsonl/40165
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 413 }
[ 2830, 3393, 14996, 6370, 2735, 263, 17, 307, 4876, 1155, 353, 8840, 836, 8, 341, 50333, 11, 1848, 1669, 6531, 4876, 445, 3833, 497, 330, 33, 79, 40101, 4817, 35, 2388, 17, 17563, 23, 37, 17, 80, 497, 6531, 287, 27847, 2735, 263, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestWsKlineUpdate(t *testing.T) { t.Parallel() pressXToJSON := []byte(`{"stream":"btcusdt@kline_1m","data":{ "e": "kline", "E": 123456789, "s": "BNBBTC", "k": { "t": 123400000, "T": 123460000, "s": "BNBBTC", "i": "1m", "f": 100, "L": 200, "o": "0.0010", "c": "0.0020", "h": "0.0025", "l": "0.0015", "v": "1000", "n": 100, "x": false, "q": "1.0000", "V": "500", "Q": "0.500", "B": "123456" } }}`) err := b.wsHandleData(pressXToJSON) if err != nil { t.Error(err) } }
explode_data.jsonl/76684
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 375 }
[ 2830, 3393, 74733, 42, 1056, 4289, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 741, 197, 1873, 55, 1249, 5370, 1669, 3056, 3782, 5809, 4913, 4027, 3252, 92634, 355, 8047, 31, 74, 1056, 62, 16, 76, 2198, 691, 12602, 3677, 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...
2
func TestIncident_SnoozeIncident(t *testing.T) { setup() defer teardown() mux.HandleFunc("/incidents/1/snooze", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "POST") _, _ = w.Write([]byte(`{"incident": {"id": "1", "pending_actions": [{"type": "unacknowledge", "at":"2019-12-31T16:58:35Z"}]}}`)) }) client := defaultTestClient(server.URL, "foo") var duration uint = 3600 id := "1" err := client.SnoozeIncident(id, duration) if err != nil { t.Fatal(err) } }
explode_data.jsonl/76398
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 209 }
[ 2830, 3393, 39245, 1713, 1098, 2152, 90153, 39245, 1713, 1155, 353, 8840, 836, 8, 341, 84571, 741, 16867, 49304, 2822, 2109, 2200, 63623, 4283, 2840, 6880, 14, 16, 2687, 2152, 90153, 497, 2915, 3622, 1758, 37508, 11, 435, 353, 1254, 965...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestMapOfGCKeys(t *testing.T) { type T *uintptr tt := TypeOf(T(nil)) mt := MapOf(tt, TypeOf(false)) // NOTE: The garbage collector handles allocated maps specially, // so we have to save pointers to maps in x; the pointer code will // use the gc info in the newly constructed map type. const n = 100 var x []interface{} for i := 0; i < n; i++ { v := MakeMap(mt) for j := 0; j < n; j++ { p := new(uintptr) *p = uintptr(i*n + j) v.SetMapIndex(ValueOf(p).Convert(tt), ValueOf(true)) } pv := New(mt) pv.Elem().Set(v) x = append(x, pv.Interface()) } runtime.GC() for i, xi := range x { v := ValueOf(xi).Elem() var out []int for _, kv := range v.MapKeys() { out = append(out, int(kv.Elem().Interface().(uintptr))) } sort.Ints(out) for j, k := range out { if k != i*n+j { t.Errorf("lost x[%d][%d] = %d, want %d", i, j, k, i*n+j) } } } }
explode_data.jsonl/29612
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 409 }
[ 2830, 3393, 2227, 2124, 38, 3021, 68, 1047, 1155, 353, 8840, 836, 8, 341, 13158, 350, 353, 51380, 198, 3244, 83, 1669, 3990, 2124, 4140, 27907, 1171, 2109, 83, 1669, 5027, 2124, 47152, 11, 3990, 2124, 3576, 4390, 197, 322, 16743, 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 TestValidateAccountAlias(t *testing.T) { validAliases := []string{ "tf-alias", "0tf-alias1", } for _, s := range validAliases { _, errors := validateAccountAlias(s, "account_alias") if len(errors) > 0 { t.Fatalf("%q should be a valid account alias: %v", s, errors) } } invalidAliases := []string{ "tf", "-tf", "tf-", "TF-Alias", "tf-alias-tf-alias-tf-alias-tf-alias-tf-alias-tf-alias-tf-alias-tf-alias", } for _, s := range invalidAliases { _, errors := validateAccountAlias(s, "account_alias") if len(errors) == 0 { t.Fatalf("%q should not be a valid account alias: %v", s, errors) } } }
explode_data.jsonl/78608
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 269 }
[ 2830, 3393, 17926, 7365, 22720, 1155, 353, 8840, 836, 8, 341, 56322, 95209, 1669, 3056, 917, 515, 197, 197, 1, 8935, 12, 14956, 756, 197, 197, 1, 15, 8935, 12, 14956, 16, 756, 197, 630, 2023, 8358, 274, 1669, 2088, 2697, 95209, 341,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
5
func TestPodLogOptions(t *testing.T) { sinceSeconds := int64(1) sinceTime := metav1.NewTime(time.Date(2000, 1, 1, 12, 34, 56, 0, time.UTC).Local()) tailLines := int64(2) limitBytes := int64(3) versionedLogOptions := &v1.PodLogOptions{ Container: "mycontainer", Follow: true, Previous: true, SinceSeconds: &sinceSeconds, SinceTime: &sinceTime, Timestamps: true, TailLines: &tailLines, LimitBytes: &limitBytes, } unversionedLogOptions := &core.PodLogOptions{ Container: "mycontainer", Follow: true, Previous: true, SinceSeconds: &sinceSeconds, SinceTime: &sinceTime, Timestamps: true, TailLines: &tailLines, LimitBytes: &limitBytes, } expectedParameters := url.Values{ "container": {"mycontainer"}, "follow": {"true"}, "previous": {"true"}, "sinceSeconds": {"1"}, "sinceTime": {"2000-01-01T12:34:56Z"}, "timestamps": {"true"}, "tailLines": {"2"}, "limitBytes": {"3"}, } codec := runtime.NewParameterCodec(legacyscheme.Scheme) // unversioned -> query params { actualParameters, err := codec.EncodeParameters(unversionedLogOptions, v1.SchemeGroupVersion) if err != nil { t.Fatal(err) } if !reflect.DeepEqual(actualParameters, expectedParameters) { t.Fatalf("Expected\n%#v\ngot\n%#v", expectedParameters, actualParameters) } } // versioned -> query params { actualParameters, err := codec.EncodeParameters(versionedLogOptions, v1.SchemeGroupVersion) if err != nil { t.Fatal(err) } if !reflect.DeepEqual(actualParameters, expectedParameters) { t.Fatalf("Expected\n%#v\ngot\n%#v", expectedParameters, actualParameters) } } // query params -> versioned { convertedLogOptions := &v1.PodLogOptions{} err := codec.DecodeParameters(expectedParameters, v1.SchemeGroupVersion, convertedLogOptions) if err != nil { t.Fatal(err) } if !reflect.DeepEqual(convertedLogOptions, versionedLogOptions) { t.Fatalf("Unexpected deserialization:\n%s", diff.ObjectGoPrintSideBySide(versionedLogOptions, convertedLogOptions)) } } // query params -> unversioned { convertedLogOptions := &core.PodLogOptions{} err := codec.DecodeParameters(expectedParameters, v1.SchemeGroupVersion, convertedLogOptions) if err != nil { t.Fatal(err) } if !reflect.DeepEqual(convertedLogOptions, unversionedLogOptions) { t.Fatalf("Unexpected deserialization:\n%s", diff.ObjectGoPrintSideBySide(unversionedLogOptions, convertedLogOptions)) } } }
explode_data.jsonl/27247
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 992 }
[ 2830, 3393, 23527, 2201, 3798, 1155, 353, 8840, 836, 8, 341, 1903, 1701, 15343, 1669, 526, 21, 19, 7, 16, 340, 1903, 1701, 1462, 1669, 77520, 16, 7121, 1462, 9730, 8518, 7, 17, 15, 15, 15, 11, 220, 16, 11, 220, 16, 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...
9
func TestMultipleLiteralReturnStatement(t *testing.T) { p := createParser(`return "twenty", "thirty"`) bvmUtils.Assert(t, isReturnStatement(p), "should detect return statement") parseReturnStatement(p) u := p.scope.Next() bvmUtils.AssertNow(t, u.Type() == ast.ReturnStatement, "wrong return type") r := u.(*ast.ReturnStatementNode) bvmUtils.AssertNow(t, len(r.Results) == 2, "wrong result length") bvmUtils.AssertNow(t, r.Results[0].Type() == ast.Literal, "wrong result 0 type") bvmUtils.AssertNow(t, r.Results[1].Type() == ast.Literal, "wrong result 1 type") }
explode_data.jsonl/49727
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 215 }
[ 2830, 3393, 32089, 17350, 5598, 8636, 1155, 353, 8840, 836, 8, 341, 3223, 1669, 1855, 6570, 5809, 689, 330, 93965, 497, 330, 339, 16531, 1, 24183, 2233, 7338, 4209, 11711, 1155, 11, 374, 5598, 8636, 1295, 701, 330, 5445, 11140, 470, 5...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func Test_BlindingFactors(t *testing.T) { p := new(eccutil.Point) p.X, p.Y = new(big.Int), new(big.Int) n := NewBlindingFactors(p) b, err := n.Marshal() if err != nil { t.Fatalf("Marshalling failed: %s", err) } _, err = n.Unmarshal(b) if err != nil { t.Fatalf("UnMarshalling failed: %s", err) } n.PubKey.X = big.NewInt(3) _, err = n.Unmarshal(b) if err == nil { t.Fatal("UnMarshalling must fail for foreign signer") } }
explode_data.jsonl/8838
{ "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, 56947, 3961, 97769, 1155, 353, 8840, 836, 8, 341, 3223, 1669, 501, 2026, 638, 1314, 3775, 340, 3223, 4338, 11, 281, 7507, 284, 501, 75616, 7371, 701, 501, 75616, 7371, 340, 9038, 1669, 1532, 4923, 3961, 97769, 1295, 340, 2...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
4
func TestPeerConnection_AnswerWithoutOffer(t *testing.T) { pc, err := NewPeerConnection(Configuration{}) if err != nil { t.Errorf("New PeerConnection: got error: %v", err) } _, err = pc.CreateAnswer(nil) if !reflect.DeepEqual(&rtcerr.InvalidStateError{Err: ErrNoRemoteDescription}, err) { t.Errorf("CreateAnswer without RemoteDescription: got error: %v", err) } }
explode_data.jsonl/37348
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 131 }
[ 2830, 3393, 30888, 4526, 32699, 3559, 26040, 39462, 1155, 353, 8840, 836, 8, 341, 82013, 11, 1848, 1669, 1532, 30888, 4526, 45443, 37790, 743, 1848, 961, 2092, 341, 197, 3244, 13080, 445, 3564, 45147, 4526, 25, 2684, 1465, 25, 1018, 85,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestHandshakeServerRSAAES(t *testing.T) { test := &serverTest{ name: "RSA-AES", command: []string{"openssl", "s_client", "-no_ticket", "-cipher", "AES128-SHA"}, } runServerTestTLS10(t, test) runServerTestTLS12(t, test) }
explode_data.jsonl/36326
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 102 }
[ 2830, 3393, 2314, 29661, 5475, 11451, 6029, 1570, 1155, 353, 8840, 836, 8, 341, 18185, 1669, 609, 4030, 2271, 515, 197, 11609, 25, 262, 330, 73564, 6691, 1570, 756, 197, 45566, 25, 3056, 917, 4913, 53612, 497, 330, 82, 8179, 497, 6523...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestPrometheusTracer_ValidationDidStart(t *testing.T) { mockTime, cleanup := mockTime() defer cleanup() tests := []struct { name string allowList []string delta time.Duration err error runs int want string }{ { name: "omitted from allow list", allowList: []string{KeyParse}, delta: 10, runs: 50, want: "", }, { name: "single run", allowList: []string{KeyValidate}, delta: 150, runs: 1, want: summaryMetadata + ` graphql_duration_seconds{err="<nil>",key="validate",platform_key="graphql.validate",quantile="0.5"} 150 graphql_duration_seconds{err="<nil>",key="validate",platform_key="graphql.validate",quantile="0.9"} 150 graphql_duration_seconds{err="<nil>",key="validate",platform_key="graphql.validate",quantile="0.99"} 150 graphql_duration_seconds_sum{err="<nil>",key="validate",platform_key="graphql.validate"} 150 graphql_duration_seconds_count{err="<nil>",key="validate",platform_key="graphql.validate"} 1 `, }, { name: "multiple runs", allowList: []string{KeyValidate}, delta: 15, runs: 8, want: summaryMetadata + ` graphql_duration_seconds{err="<nil>",key="validate",platform_key="graphql.validate",quantile="0.5"} 15 graphql_duration_seconds{err="<nil>",key="validate",platform_key="graphql.validate",quantile="0.9"} 15 graphql_duration_seconds{err="<nil>",key="validate",platform_key="graphql.validate",quantile="0.99"} 15 graphql_duration_seconds_sum{err="<nil>",key="validate",platform_key="graphql.validate"} 120 graphql_duration_seconds_count{err="<nil>",key="validate",platform_key="graphql.validate"} 8 `, }, { name: "encountered error", allowList: []string{KeyValidate}, delta: 15, runs: 8, err: context.DeadlineExceeded, want: summaryMetadata + ` graphql_duration_seconds{err="context.deadlineExceededError",key="validate",platform_key="graphql.validate",quantile="0.5"} 15 graphql_duration_seconds{err="context.deadlineExceededError",key="validate",platform_key="graphql.validate",quantile="0.9"} 15 graphql_duration_seconds{err="context.deadlineExceededError",key="validate",platform_key="graphql.validate",quantile="0.99"} 15 graphql_duration_seconds_sum{err="context.deadlineExceededError",key="validate",platform_key="graphql.validate"} 120 graphql_duration_seconds_count{err="context.deadlineExceededError",key="validate",platform_key="graphql.validate"} 8 `, }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { trace := newTracer(tt.allowList) for i := 0; i < tt.runs; i++ { _, fn := trace.ValidationDidStart(context.Background()) mockTime.Set(time.Now().Add(tt.delta * time.Millisecond)) var errs []gqlerrors.FormattedError if tt.err != nil { errs = gqlerrors.FormatErrors(tt.err) } fn(errs) } if err := testutil.CollectAndCompare(trace.Collector(), strings.NewReader(tt.want), "graphql_duration_seconds"); err != nil { t.Errorf("unexpected collecting result:\n%s", err) } }) } }
explode_data.jsonl/82524
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1372 }
[ 2830, 3393, 35186, 39705, 1282, 9584, 62, 13799, 6986, 3479, 1155, 353, 8840, 836, 8, 341, 77333, 1462, 11, 21290, 1669, 7860, 1462, 741, 16867, 21290, 2822, 78216, 1669, 3056, 1235, 341, 197, 11609, 414, 914, 198, 197, 197, 7183, 852, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestHandshakeServerALPNFallback(t *testing.T) { config := testConfig.Clone() config.NextProtos = []string{"proto1", "h2", "proto2"} test := &serverTest{ name: "ALPN-Fallback", // Note that this needs OpenSSL 1.0.2 because that is the first // version that supports the -alpn flag. command: []string{"openssl", "s_client", "-alpn", "proto3,http/1.1,proto4", "-cipher", "ECDHE-RSA-CHACHA20-POLY1305", "-ciphersuites", "TLS_CHACHA20_POLY1305_SHA256"}, config: config, validate: func(state ConnectionState) error { if state.NegotiatedProtocol != "" { return fmt.Errorf("Got protocol %q, wanted nothing", state.NegotiatedProtocol) } return nil }, } runServerTestTLS12(t, test) runServerTestTLS13(t, test) }
explode_data.jsonl/36339
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 293 }
[ 2830, 3393, 2314, 29661, 5475, 969, 17896, 87206, 1155, 353, 8840, 836, 8, 341, 25873, 1669, 1273, 2648, 64463, 741, 25873, 18501, 12423, 436, 284, 3056, 917, 4913, 15110, 16, 497, 330, 71, 17, 497, 330, 15110, 17, 63159, 18185, 1669, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestValidReferenceMode(t *testing.T) { wf := test.LoadTestWorkflow("testdata/workflow-template-ref.yaml") wfTmpl := test.LoadTestWorkflowTemplate("testdata/workflow-template-submittable.yaml") cancel, controller := newController(wf, wfTmpl) defer cancel() ctx := context.Background() controller.Config.WorkflowRestrictions = &config.WorkflowRestrictions{} controller.Config.WorkflowRestrictions.TemplateReferencing = config.TemplateReferencingSecure woc := newWorkflowOperationCtx(wf, controller) woc.operate(ctx) assert.Equal(t, wfv1.WorkflowRunning, woc.wf.Status.Phase) // Change stored Workflow Spec woc.wf.Status.StoredWorkflowSpec.Entrypoint = "different" woc = newWorkflowOperationCtx(woc.wf, controller) woc.operate(ctx) assert.Equal(t, wfv1.WorkflowError, woc.wf.Status.Phase) assert.Equal(t, "workflowTemplateRef reference may not change during execution when the controller is in reference mode", woc.wf.Status.Message) controller.Config.WorkflowRestrictions.TemplateReferencing = config.TemplateReferencingStrict woc = newWorkflowOperationCtx(wf, controller) woc.operate(ctx) assert.Equal(t, wfv1.WorkflowRunning, woc.wf.Status.Phase) // Change stored Workflow Spec woc.wf.Status.StoredWorkflowSpec.Entrypoint = "different" woc = newWorkflowOperationCtx(woc.wf, controller) woc.operate(ctx) assert.Equal(t, wfv1.WorkflowError, woc.wf.Status.Phase) }
explode_data.jsonl/71014
{ "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, 4088, 8856, 3636, 1155, 353, 8840, 836, 8, 341, 6692, 69, 1669, 1273, 13969, 2271, 62768, 445, 92425, 35062, 4965, 33409, 43007, 33406, 1138, 6692, 69, 51, 54010, 1669, 1273, 13969, 2271, 62768, 7275, 445, 92425, 35062, 4965, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestIsTChannelTimeoutError(t *testing.T) { tests := []struct { name string giveErr error wantResult bool }{ { name: "plain error", giveErr: errors.New("test"), wantResult: false, }, { name: "no timeout tchannel error", giveErr: tchannel.NewSystemError(tchannel.ErrCodeBusy, "test"), wantResult: false, }, { name: "tchannel timeout error", giveErr: tchannel.NewSystemError(tchannel.ErrCodeTimeout, "time out"), wantResult: true, }, } for _, tt := range tests { t.Run(string(tt.name), func(t *testing.T) { isTimeoutError := isTChannelTimeoutError(tt.giveErr) assert.Equal(t, tt.wantResult, isTimeoutError, "unexpected result, expected %t, got %t", tt.wantResult, isTimeoutError) }) } }
explode_data.jsonl/53843
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 342 }
[ 2830, 3393, 3872, 51, 9629, 7636, 1454, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 3056, 1235, 341, 197, 11609, 981, 914, 198, 197, 3174, 533, 7747, 262, 1465, 198, 197, 50780, 2077, 1807, 198, 197, 59403, 197, 197, 515, 298, 11609, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestJoinChannelNoAnchorPeers(t *testing.T) { // Scenario: The channel we're joining has 2 orgs but no anchor peers // The test ensures that JoinChan is called with a JoinChannelMessage with Members // that consist of the organizations of the configuration given. var joinChanCalled sync.WaitGroup joinChanCalled.Add(1) gMock := &gossipMock{} gMock.On("JoinChan", mock.Anything, mock.Anything).Run(func(args mock.Arguments) { defer joinChanCalled.Done() jcm := args.Get(0).(api.JoinChannelMessage) channel := args.Get(1).(common.ChainID) assert.Len(t, jcm.Members(), 2) assert.Contains(t, jcm.Members(), api.OrgIdentityType("Org0")) assert.Contains(t, jcm.Members(), api.OrgIdentityType("Org1")) assert.Equal(t, "A", string(channel)) }) g := &gossipServiceImpl{secAdv: &secAdvMock{}, peerIdentity: api.PeerIdentityType("Org0"), gossipSvc: gMock} appOrg0 := &appOrgMock{id: "Org0"} appOrg1 := &appOrgMock{id: "Org1"} // Make sure the ApplicationOrgs really have no anchor peers assert.Empty(t, appOrg0.AnchorPeers()) assert.Empty(t, appOrg1.AnchorPeers()) g.updateAnchors(&configMock{ orgs2AppOrgs: map[string]channelconfig.ApplicationOrg{ "Org0": appOrg0, "Org1": appOrg1, }, }) joinChanCalled.Wait() }
explode_data.jsonl/20854
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 471 }
[ 2830, 3393, 12292, 9629, 2753, 14677, 10197, 388, 1155, 353, 8840, 836, 8, 341, 197, 322, 58663, 25, 576, 5496, 582, 2299, 18169, 702, 220, 17, 1240, 82, 714, 902, 17105, 25029, 198, 197, 322, 576, 1273, 25351, 429, 16471, 46019, 374,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestInitPid_Negative(t *testing.T) { c, err := NewContainer(ContainerName) if err != nil { t.Errorf(err.Error()) } if c.InitPid() != -1 { t.Errorf("InitPid failed...") } }
explode_data.jsonl/2750
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 82 }
[ 2830, 3393, 3803, 32339, 1604, 15060, 1155, 353, 8840, 836, 8, 341, 1444, 11, 1848, 1669, 1532, 4502, 75145, 675, 340, 743, 1848, 961, 2092, 341, 197, 3244, 13080, 3964, 6141, 2398, 197, 630, 743, 272, 26849, 32339, 368, 961, 481, 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 ]
3
func TestGetSetValidatorSigningInfo(t *testing.T) { ctx, _, _, _, keeper := createTestInput(t, DefaultParams()) info, found := keeper.getValidatorSigningInfo(ctx, sdk.ConsAddress(addrs[0])) require.False(t, found) newInfo := NewValidatorSigningInfo( sdk.ConsAddress(addrs[0]), int64(4), int64(3), time.Unix(2, 0), false, int64(10), ) keeper.SetValidatorSigningInfo(ctx, sdk.ConsAddress(addrs[0]), newInfo) info, found = keeper.getValidatorSigningInfo(ctx, sdk.ConsAddress(addrs[0])) require.True(t, found) require.Equal(t, info.StartHeight, int64(4)) require.Equal(t, info.IndexOffset, int64(3)) require.Equal(t, info.JailedUntil, time.Unix(2, 0).UTC()) require.Equal(t, info.MissedBlocksCounter, int64(10)) }
explode_data.jsonl/30930
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 299 }
[ 2830, 3393, 1949, 1649, 14256, 93358, 1731, 1155, 353, 8840, 836, 8, 341, 20985, 11, 8358, 8358, 8358, 53416, 1669, 1855, 2271, 2505, 1155, 11, 7899, 4870, 2398, 27043, 11, 1730, 1669, 53416, 670, 14256, 93358, 1731, 7502, 11, 45402, 94...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestHMAC_Write(t *testing.T) { w := httptest.NewRecorder() sig := signed.ContentHMAC{ Algorithm: "sha512", } sig.Write(w, []byte(`Hello Gophers`)) const wantSig = `sha512 48656c6c6f20476f7068657273` if have, want := w.Header().Get(signed.HeaderContentHMAC), wantSig; have != want { t.Errorf("Have: %v Want: %v", have, want) } }
explode_data.jsonl/80671
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 147 }
[ 2830, 3393, 39, 25788, 31825, 1155, 353, 8840, 836, 8, 341, 6692, 1669, 54320, 70334, 7121, 47023, 741, 84841, 1669, 8499, 12614, 39, 25788, 515, 197, 197, 27847, 25, 330, 15247, 20, 16, 17, 756, 197, 532, 84841, 4073, 3622, 11, 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...
2
func TestSkipList_Search(t *testing.T) { sl := newSkipList() if sl == nil { t.Fatalf("%v: got nil", t.Name()) } if ok := sl.Search(1); ok { t.Fatalf("got %v want %v", ok, false) } sl.Set(1, 2) if got := sl.Len(); got != 1 { t.Fatalf("Len: got %d, want %d", got, 1) } if ok := sl.Search(1); !ok { t.Fatalf("got %v want %v", ok, true) } if v, ok := sl.Del(1); v != 2 || !ok { t.Fatalf("got %v,%v want %d", v, ok, 2) } if got := sl.Len(); got != 0 { t.Fatalf("Len: got %d, want %d", got, 1) } }
explode_data.jsonl/54834
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 256 }
[ 2830, 3393, 35134, 852, 65913, 1155, 353, 8840, 836, 8, 341, 78626, 1669, 501, 35134, 852, 741, 743, 1739, 621, 2092, 341, 197, 3244, 30762, 4430, 85, 25, 2684, 2092, 497, 259, 2967, 2398, 197, 630, 743, 5394, 1669, 1739, 31903, 7, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
8
func TestInferStringValue(t *testing.T) { a := assert.New(t) for _, s := range []string{"true", "TRUE", "True"} { a.Equal(inferStringValue(s), true) a.Equal(inferStringValue(fmt.Sprintf("\"%s\"", s)), s) a.Equal(inferStringValue(fmt.Sprintf("'%s'", s)), s) } for _, s := range []string{"false", "FALSE", "False"} { a.Equal(inferStringValue(s), false) a.Equal(inferStringValue(fmt.Sprintf("\"%s\"", s)), s) a.Equal(inferStringValue(fmt.Sprintf("'%s'", s)), s) } a.Equal(inferStringValue("t"), "t") a.Equal(inferStringValue("F"), "F") a.Equal(inferStringValue("1"), 1) a.Equal(inferStringValue("\"1\""), "1") a.Equal(inferStringValue("'1'"), "1") a.Equal(inferStringValue("2.3"), float32(2.3)) a.Equal(inferStringValue("\"2.3\""), "2.3") a.Equal(inferStringValue("'2.3'"), "2.3") }
explode_data.jsonl/45945
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 377 }
[ 2830, 3393, 641, 802, 82696, 1155, 353, 8840, 836, 8, 341, 11323, 1669, 2060, 7121, 1155, 340, 2023, 8358, 274, 1669, 2088, 3056, 917, 4913, 1866, 497, 330, 20611, 497, 330, 2514, 9207, 341, 197, 11323, 12808, 5900, 802, 82696, 1141, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestSetCgroupItem(t *testing.T) { c, err := NewContainer(ContainerName) if err != nil { t.Errorf(err.Error()) } maxMem := c.CgroupItem("memory.max_usage_in_bytes")[0] currentMem := c.CgroupItem("memory.limit_in_bytes")[0] if err := c.SetCgroupItem("memory.limit_in_bytes", maxMem); err != nil { t.Errorf(err.Error()) } newMem := c.CgroupItem("memory.limit_in_bytes")[0] if newMem == currentMem { t.Errorf("SetCgroupItem failed...") } }
explode_data.jsonl/2774
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 187 }
[ 2830, 3393, 1649, 34, 4074, 1234, 1155, 353, 8840, 836, 8, 341, 1444, 11, 1848, 1669, 1532, 4502, 75145, 675, 340, 743, 1848, 961, 2092, 341, 197, 3244, 13080, 3964, 6141, 2398, 197, 630, 22543, 18816, 1669, 272, 727, 4074, 1234, 445,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
4
func TestJob_FailedRecords(t *testing.T) { type fields struct { session session.ServiceFormatter info Response } tests := []struct { name string fields fields want []FailedRecord wantErr bool }{ { name: "Passing", fields: fields{ info: Response{ ID: "1234", ColumnDelimiter: string(Pipe), LineEnding: string(Linefeed), }, session: &mockSessionFormatter{ url: "https://test.salesforce.com", client: mockHTTPClient(func(req *http.Request) *http.Response { if req.URL.String() != "https://test.salesforce.com/jobs/ingest/1234/failedResults/" { return &http.Response{ StatusCode: 500, Status: "Invalid URL", Body: ioutil.NopCloser(strings.NewReader(req.URL.String())), Header: make(http.Header), } } if req.Method != http.MethodGet { return &http.Response{ StatusCode: 500, Status: "Invalid Method", Body: ioutil.NopCloser(strings.NewReader(req.Method)), Header: make(http.Header), } } resp := "\"sf__Error\"|\"sf__Id\"|FirstName|LastName|DOB\nREQUIRED_FIELD_MISSING:Required fields are missing: [Name]:Name --||John|Doe|1/1/1970\nREQUIRED_FIELD_MISSING:Required fields are missing: [Name]:Name --||Jane|Doe|1/1/1980\n" return &http.Response{ StatusCode: http.StatusOK, Status: "Good", Body: ioutil.NopCloser(strings.NewReader(resp)), Header: make(http.Header), } }), }, }, want: []FailedRecord{ { Error: "REQUIRED_FIELD_MISSING:Required fields are missing: [Name]:Name --", JobRecord: JobRecord{ UnprocessedRecord: UnprocessedRecord{ Fields: map[string]string{ "FirstName": "John", "LastName": "Doe", "DOB": "1/1/1970", }, }, }, }, { Error: "REQUIRED_FIELD_MISSING:Required fields are missing: [Name]:Name --", JobRecord: JobRecord{ UnprocessedRecord: UnprocessedRecord{ Fields: map[string]string{ "FirstName": "Jane", "LastName": "Doe", "DOB": "1/1/1980", }, }, }, }, }, wantErr: false, }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { j := &Job{ session: tt.fields.session, info: tt.fields.info, } got, err := j.FailedRecords() if (err != nil) != tt.wantErr { t.Errorf("Job.FailedRecords() error = %v, wantErr %v", err, tt.wantErr) return } if !reflect.DeepEqual(got, tt.want) { t.Errorf("Job.FailedRecords() = %v, want %v", got, tt.want) } }) } }
explode_data.jsonl/19887
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1362 }
[ 2830, 3393, 12245, 1400, 5687, 25876, 1155, 353, 8840, 836, 8, 341, 13158, 5043, 2036, 341, 197, 25054, 3797, 13860, 14183, 198, 197, 27043, 262, 5949, 198, 197, 532, 78216, 1669, 3056, 1235, 341, 197, 11609, 262, 914, 198, 197, 55276, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestContextNegotiationFormatWithAccept(t *testing.T) { c, _ := CreateTestContext(httptest.NewRecorder()) c.Request, _ = http.NewRequest("POST", "/", nil) c.Request.Header.Add("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9;q=0.8") assert.Equal(t, MIMEXML, c.NegotiateFormat(MIMEJSON, MIMEXML)) assert.Equal(t, MIMEHTML, c.NegotiateFormat(MIMEXML, MIMEHTML)) assert.Empty(t, c.NegotiateFormat(MIMEJSON)) }
explode_data.jsonl/26807
{ "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, 1972, 47800, 354, 7101, 4061, 2354, 16646, 1155, 353, 8840, 836, 8, 341, 1444, 11, 716, 1669, 4230, 2271, 1972, 73392, 83, 70334, 7121, 47023, 2398, 1444, 9659, 11, 716, 284, 1758, 75274, 445, 2946, 497, 64657, 2092, 340, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func Test_Handler_CheckPipeOrder(t *testing.T) { executionStep := 0 pipe1 := getPipeStep(t, 1, &executionStep) pipe2 := getPipeStep(t, 2, &executionStep) pipe3 := getPipeStep(t, 3, &executionStep) pipe4 := getPipeStep(t, 4, &executionStep) pipe5 := getPipeStep(t, 5, &executionStep) pipe6 := getPipeStep(t, 6, &executionStep) pipe7 := getPipeStep(t, 7, &executionStep) pipe8 := getPipeStep(t, 8, &executionStep) pipe9 := getPipeStep(t, 9, &executionStep) pipe10 := getPipeStep(t, 10, &executionStep) pipes := PipeGroup{ []Pipe{pipe1, pipe2}, []Pipe{pipe3, pipe4}, PipeGroup{ []Pipe{pipe5, pipe6}, PipeGroup{ []Pipe{pipe7, pipe8}, PipeGroup{ []Pipe{pipe9, pipe10}, }, }, }, } h, err := New(pipes, mockStruct{}, converterMock) assert.NoError(t, err) handler := h.Handler() err = handler.(func(*mockContext) error)(&mockContext{}) assert.NoError(t, err) }
explode_data.jsonl/45771
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 406 }
[ 2830, 3393, 41879, 28188, 34077, 4431, 1155, 353, 8840, 836, 8, 1476, 67328, 1488, 8304, 1669, 220, 15, 271, 197, 13768, 16, 1669, 633, 34077, 8304, 1155, 11, 220, 16, 11, 609, 52721, 8304, 340, 197, 13768, 17, 1669, 633, 34077, 8304,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestOnlyOneControlPlaneIsAllowedPerNamespace(t *testing.T) { controlPlane1 := newControlPlane("my-smcp", "istio-system") validator, _, _ := createControlPlaneValidatorTestFixture(controlPlane1) controlPlane2 := newControlPlane("my-smcp2", "istio-system") response := validator.Handle(ctx, createCreateRequest(controlPlane2)) assert.False(response.Response.Allowed, "Expected validator to reject ServiceMeshControlPlane with bad version", t) }
explode_data.jsonl/20788
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 145 }
[ 2830, 3393, 7308, 3966, 3273, 34570, 3872, 35382, 3889, 22699, 1155, 353, 8840, 836, 8, 341, 82786, 34570, 16, 1669, 501, 3273, 34570, 445, 2408, 4668, 4672, 497, 330, 380, 815, 36648, 1138, 197, 16112, 11, 8358, 716, 1669, 1855, 3273, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestSlashBoth(t *testing.T) { app, ctx, addrDels, addrVals := bootstrapSlashTest(t, 10) fraction := sdk.NewDecWithPrec(5, 1) bondDenom := app.StakingKeeper.BondDenom(ctx) // set a redelegation with expiration timestamp beyond which the // redelegation shouldn't be slashed rdATokens := sdk.TokensFromConsensusPower(6) rdA := types.NewRedelegation(addrDels[0], addrVals[0], addrVals[1], 11, time.Unix(0, 0), rdATokens, rdATokens.ToDec()) app.StakingKeeper.SetRedelegation(ctx, rdA) // set the associated delegation delA := types.NewDelegation(addrDels[0], addrVals[1], rdATokens.ToDec()) app.StakingKeeper.SetDelegation(ctx, delA) // set an unbonding delegation with expiration timestamp (beyond which the // unbonding delegation shouldn't be slashed) ubdATokens := sdk.TokensFromConsensusPower(4) ubdA := types.NewUnbondingDelegation(addrDels[0], addrVals[0], 11, time.Unix(0, 0), ubdATokens) app.StakingKeeper.SetUnbondingDelegation(ctx, ubdA) bondedCoins := sdk.NewCoins(sdk.NewCoin(bondDenom, rdATokens.MulRaw(2))) notBondedCoins := sdk.NewCoins(sdk.NewCoin(bondDenom, ubdATokens)) // update bonded tokens bondedPool := app.StakingKeeper.GetBondedPool(ctx) notBondedPool := app.StakingKeeper.GetNotBondedPool(ctx) bondedPoolBalances := app.BankKeeper.GetAllBalances(ctx, bondedPool.GetAddress()) require.NoError(t, app.BankKeeper.SetBalances(ctx, bondedPool.GetAddress(), bondedPoolBalances.Add(bondedCoins...))) notBondedPoolBalances := app.BankKeeper.GetAllBalances(ctx, notBondedPool.GetAddress()) require.NoError(t, app.BankKeeper.SetBalances(ctx, notBondedPool.GetAddress(), notBondedPoolBalances.Add(notBondedCoins...))) app.AccountKeeper.SetModuleAccount(ctx, bondedPool) app.AccountKeeper.SetModuleAccount(ctx, notBondedPool) oldBonded := app.BankKeeper.GetBalance(ctx, bondedPool.GetAddress(), bondDenom).Amount oldNotBonded := app.BankKeeper.GetBalance(ctx, notBondedPool.GetAddress(), bondDenom).Amount // slash validator ctx = ctx.WithBlockHeight(12) validator, found := app.StakingKeeper.GetValidatorByConsAddr(ctx, sdk.GetConsAddress(PKs[0])) require.True(t, found) consAddr0 := sdk.ConsAddress(PKs[0].Address()) app.StakingKeeper.Slash(ctx, consAddr0, 10, 10, fraction) burnedNotBondedAmount := fraction.MulInt(ubdATokens).TruncateInt() burnedBondAmount := sdk.TokensFromConsensusPower(10).ToDec().Mul(fraction).TruncateInt() burnedBondAmount = burnedBondAmount.Sub(burnedNotBondedAmount) // read updated pool bondedPool = app.StakingKeeper.GetBondedPool(ctx) notBondedPool = app.StakingKeeper.GetNotBondedPool(ctx) bondedPoolBalance := app.BankKeeper.GetBalance(ctx, bondedPool.GetAddress(), bondDenom).Amount require.True(sdk.IntEq(t, oldBonded.Sub(burnedBondAmount), bondedPoolBalance)) notBondedPoolBalance := app.BankKeeper.GetBalance(ctx, notBondedPool.GetAddress(), bondDenom).Amount require.True(sdk.IntEq(t, oldNotBonded.Sub(burnedNotBondedAmount), notBondedPoolBalance)) // read updating redelegation rdA, found = app.StakingKeeper.GetRedelegation(ctx, addrDels[0], addrVals[0], addrVals[1]) require.True(t, found) require.Len(t, rdA.Entries, 1) // read updated validator validator, found = app.StakingKeeper.GetValidatorByConsAddr(ctx, sdk.GetConsAddress(PKs[0])) require.True(t, found) // power not decreased, all stake was bonded since require.Equal(t, int64(10), validator.GetConsensusPower()) }
explode_data.jsonl/25505
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1292 }
[ 2830, 3393, 88004, 20629, 1155, 353, 8840, 836, 8, 341, 28236, 11, 5635, 11, 10789, 35, 2010, 11, 10789, 52452, 1669, 26925, 88004, 2271, 1155, 11, 220, 16, 15, 340, 1166, 16199, 1669, 45402, 7121, 4900, 2354, 68833, 7, 20, 11, 220, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestMalleability(t *testing.T) { // https://tools.ietf.org/html/rfc8032#section-5.1.7 adds an additional test // that s be in [0, order). This prevents someone from adding a multiple of // order to s and obtaining a second valid sig for the same message. message := []byte{0x54, 0x65, 0x73, 0x74} sig := []byte{ 0x7c, 0x38, 0xe0, 0x26, 0xf2, 0x9e, 0x14, 0xaa, 0xbd, 0x05, 0x9a, 0x0f, 0x2d, 0xb8, 0xb0, 0xcd, 0x78, 0x30, 0x40, 0x60, 0x9a, 0x8b, 0xe6, 0x84, 0xdb, 0x12, 0xf8, 0x2a, 0x27, 0x77, 0x4a, 0xb0, 0x67, 0x65, 0x4b, 0xce, 0x38, 0x32, 0xc2, 0xd7, 0x6f, 0x8f, 0x6f, 0x5d, 0xaf, 0xc0, 0x8d, 0x93, 0x39, 0xd4, 0xee, 0xf6, 0x76, 0x57, 0x33, 0x36, 0xa5, 0xc5, 0x1e, 0xb6, 0xf9, 0x46, 0xb3, 0x1d, } publicKey := []byte{ 0x7d, 0x4d, 0x0e, 0x7f, 0x61, 0x53, 0xa6, 0x9b, 0x62, 0x42, 0xb5, 0x22, 0xab, 0xbe, 0xe6, 0x85, 0xfd, 0xa4, 0x42, 0x0f, 0x88, 0x34, 0xb1, 0x08, 0xc3, 0xbd, 0xae, 0x36, 0x9e, 0xf5, 0x49, 0xfa, } assert.False(t, ed25519.Verify(publicKey, message, sig)) }
explode_data.jsonl/55568
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 584 }
[ 2830, 3393, 44, 5054, 2897, 1155, 353, 8840, 836, 8, 341, 197, 322, 3703, 1110, 15918, 13, 74068, 2659, 13739, 93982, 23, 15, 18, 17, 2, 2809, 12, 20, 13, 16, 13, 22, 11367, 458, 5107, 1273, 198, 197, 322, 429, 274, 387, 304, 50...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func Test_Web_Basic_NoRace(t *testing.T) { Convey("Make sure no race between requests", t, func() { m := New() handlers := []Handler{func() {}, func() {}} // Ensure append will not realloc to trigger the race condition m.handlers = handlers[:1] m.Get("/", func() {}) for i := 0; i < 2; i++ { go func() { req, _ := http.NewRequest("GET", "/", nil) resp := httptest.NewRecorder() m.ServeHTTP(resp, req) }() } }) }
explode_data.jsonl/44980
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 187 }
[ 2830, 3393, 62, 5981, 1668, 5971, 36989, 55991, 1155, 353, 8840, 836, 8, 341, 93070, 5617, 445, 8078, 2704, 902, 6957, 1948, 7388, 497, 259, 11, 2915, 368, 341, 197, 2109, 1669, 1532, 741, 197, 9598, 437, 9254, 1669, 3056, 3050, 90, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestCreateSigningRoundTripperWithCredentials(t *testing.T) { defaultRoundTripper := (http.RoundTripper)(http.DefaultTransport.(*http.Transport).Clone()) // Some form of AWS credentials must be set up for tests to succeed awsCreds := fetchMockCredentials() tests := []struct { name string creds *credentials.Credentials roundTripper http.RoundTripper authConfig AuthConfig authApplied bool returnError bool }{ { "success_case", awsCreds, defaultRoundTripper, AuthConfig{Region: "region", Service: "service"}, true, false, }, { "success_case_no_auth_applied", awsCreds, defaultRoundTripper, AuthConfig{Region: "", Service: ""}, false, false, }, { "no_credentials_provided_error", nil, defaultRoundTripper, AuthConfig{Region: "region", Service: "service"}, true, true, }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { rtp, err := newSigningRoundTripperWithCredentials(tt.authConfig, tt.creds, tt.roundTripper) if tt.returnError { assert.Error(t, err) return } assert.NoError(t, err) if tt.authApplied { sRtp := rtp.(*signingRoundTripper) assert.Equal(t, sRtp.transport, tt.roundTripper) assert.Equal(t, tt.authConfig.Service, sRtp.service) } }) } }
explode_data.jsonl/19763
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 576 }
[ 2830, 3393, 4021, 93358, 27497, 21884, 6922, 2354, 27025, 1155, 353, 8840, 836, 8, 341, 11940, 27497, 21884, 6922, 1669, 320, 1254, 37646, 21884, 6922, 2376, 1254, 13275, 27560, 41399, 1254, 87669, 568, 37677, 12367, 197, 322, 4329, 1352, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestConfigActiveNamespace(t *testing.T) { mk := NewMockKubeSettings() cfg := config.NewConfig(mk) assert.Nil(t, cfg.Load("testdata/k9s.yml")) assert.Equal(t, "kube-system", cfg.ActiveNamespace()) }
explode_data.jsonl/19253
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 84 }
[ 2830, 3393, 2648, 5728, 22699, 1155, 353, 8840, 836, 8, 341, 2109, 74, 1669, 1532, 11571, 42, 3760, 6086, 741, 50286, 1669, 2193, 7121, 2648, 1255, 74, 692, 6948, 59678, 1155, 11, 13286, 13969, 445, 92425, 14109, 24, 82, 33936, 5455, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestValidateIPSet(t *testing.T) { testCases := []struct { ipset *IPSet valid bool desc string }{ { // case[0] ipset: &IPSet{ Name: "test", SetType: HashIPPort, HashFamily: ProtocolFamilyIPV4, HashSize: 1024, MaxElem: 1024, }, valid: true, }, { // case[1] ipset: &IPSet{ Name: "SET", SetType: BitmapPort, HashFamily: ProtocolFamilyIPV6, HashSize: 65535, MaxElem: 2048, PortRange: DefaultPortRange, }, valid: true, }, { // case[2] ipset: &IPSet{ Name: "foo", SetType: BitmapPort, HashFamily: ProtocolFamilyIPV6, HashSize: 65535, MaxElem: 2048, }, valid: false, desc: "should specify right port range for bitmap type set", }, { // case[3] ipset: &IPSet{ Name: "bar", SetType: HashIPPort, HashFamily: ProtocolFamilyIPV6, HashSize: 0, MaxElem: 2048, }, valid: false, desc: "wrong hash size number", }, { // case[4] ipset: &IPSet{ Name: "baz", SetType: HashIPPort, HashFamily: ProtocolFamilyIPV6, HashSize: 1024, MaxElem: -1, }, valid: false, desc: "wrong hash max elem number", }, { // case[5] ipset: &IPSet{ Name: "baz", SetType: HashIPPortNet, HashFamily: "ip", HashSize: 1024, MaxElem: 1024, }, valid: false, desc: "wrong protocol", }, { // case[6] ipset: &IPSet{ Name: "foo-bar", SetType: "xxx", HashFamily: ProtocolFamilyIPV4, HashSize: 1024, MaxElem: 1024, }, valid: false, desc: "wrong set type", }, } for i := range testCases { valid := testCases[i].ipset.Validate() if valid != testCases[i].valid { t.Errorf("case [%d]: unexpected mismatch, expect valid[%v], got valid[%v], desc: %s", i, testCases[i].valid, valid, testCases[i].desc) } } }
explode_data.jsonl/74020
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 995 }
[ 2830, 3393, 17926, 3298, 1649, 1155, 353, 8840, 836, 8, 341, 18185, 37302, 1669, 3056, 1235, 341, 197, 46531, 746, 353, 3298, 1649, 198, 197, 56322, 1807, 198, 197, 41653, 220, 914, 198, 197, 59403, 197, 197, 90, 442, 1142, 58, 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 TestMarshalServerBoundLoginStart(t *testing.T) { tt := []struct { mcName string }{ { mcName: "test", }, { mcName: "infrared", }, { mcName: "", }, } for _, tc := range tt { t.Run(tc.mcName, func(t *testing.T) { expectedPk := mc.Packet{ ID: mc.ServerBoundLoginStartPacketID, Data: []byte(tc.mcName), } loginStart := mc.ServerLoginStart{} pk := loginStart.Marshal() if expectedPk.ID != pk.ID || bytes.Equal(expectedPk.Data, pk.Data) { t.Logf("expected:\t%v", expectedPk) t.Logf("got:\t\t%v", pk) t.Error("Difference be expected and received packet") } }) } }
explode_data.jsonl/45008
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 306 }
[ 2830, 3393, 55438, 5475, 19568, 6231, 3479, 1155, 353, 8840, 836, 8, 341, 3244, 83, 1669, 3056, 1235, 341, 197, 97662, 675, 914, 198, 197, 59403, 197, 197, 515, 298, 97662, 675, 25, 330, 1944, 756, 197, 197, 1583, 197, 197, 515, 298...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestBadQueryV1(t *testing.T) { f := newFixture(t) expectedErr := `{ "code": "invalid_parameter", "message": "error(s) occurred while parsing query", "errors": [ { "code": "rego_parse_error", "message": "no match found", "location": { "file": "", "row": 1, "col": 1 }, "details": { "line": "^ -i", "idx": 0 } } ] }` if err := f.v1(http.MethodGet, `/query?q=^ -i`, "", 400, expectedErr); err != nil { recvErr := f.recorder.Body.String() t.Fatalf(`Expected %v but got: %v`, expectedErr, recvErr) } }
explode_data.jsonl/79026
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 300 }
[ 2830, 3393, 17082, 2859, 53, 16, 1155, 353, 8840, 836, 8, 341, 1166, 1669, 501, 18930, 1155, 692, 42400, 7747, 1669, 1565, 515, 220, 330, 1851, 788, 330, 11808, 24899, 756, 220, 330, 1994, 788, 330, 841, 1141, 8, 10017, 1393, 22314, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestReverseInt(t *testing.T) { type args struct { s []int } tests := []struct { name string args args want []int }{ {name: "testcase1", args: args{s: []int{1, 2, 3, 4, 5}}, want: []int{5, 4, 3, 2, 1}}, {name: "testcase2", args: args{s: []int{}}, want: []int{}}, {name: "testcase3", args: args{s: []int{1, 2, 3, 4, 5, 6}}, want: []int{6, 5, 4, 3, 2, 1}}, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { ReverseInt(tt.args.s) if reflect.DeepEqual(tt.args.s, tt.want) != true { t.Errorf("ReverseInt() got = %v, want %v", tt.args.s, tt.want) } }) } }
explode_data.jsonl/73902
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 306 }
[ 2830, 3393, 45695, 1072, 1155, 353, 8840, 836, 8, 341, 13158, 2827, 2036, 341, 197, 1903, 3056, 396, 198, 197, 532, 78216, 1669, 3056, 1235, 341, 197, 11609, 914, 198, 197, 31215, 2827, 198, 197, 50780, 3056, 396, 198, 197, 59403, 197...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func Test_run(t *testing.T) { type args struct { cmd *cobra.Command args []string } before := func(file string, testWorkflow formatter.Workflow, testConfig formatter.Config) { os.Create(file) workflow = testWorkflow config = testConfig config.InputFile = formatter.InputFile(file) } after := func(file string) { os.Remove(file) workflow = nil config = formatter.Config{} } tests := []struct { name string input string workflow formatter.Workflow config formatter.Config args args runBefore bool wantErr bool }{ { name: "Fails validation during the run (no settings at all, will fail)", args: args{}, config: formatter.Config{ ShowVersion: false, }, wantErr: true, }, { name: "Workflow execution fails", input: path.Join(os.TempDir(), "formatter_cmd_run_1"), runBefore: true, workflow: &testWorkflow{ executeResult: errors.New("Bad failure"), }, config: formatter.Config{ OutputFormat: "csv", ShowVersion: false, }, args: args{}, wantErr: true, }, { name: "Shows version using flag", runBefore: true, config: formatter.Config{ ShowVersion: true, }, args: args{}, wantErr: false, }, { name: "Successful workflow execution", input: path.Join(os.TempDir(), "formatter_cmd_run_2"), runBefore: true, workflow: &testWorkflow{}, config: formatter.Config{ OutputFormat: "html", ShowVersion: false, // false by default }, args: args{}, wantErr: false, }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { if tt.runBefore { before(tt.input, tt.workflow, tt.config) defer after(tt.input) } if err := run(tt.args.cmd, tt.args.args); (err != nil) != tt.wantErr { t.Errorf("run() error = %v, wantErr %v", err, tt.wantErr) } }) } }
explode_data.jsonl/27050
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 844 }
[ 2830, 3393, 14007, 1155, 353, 8840, 836, 8, 341, 13158, 2827, 2036, 341, 197, 25920, 220, 353, 59410, 12714, 198, 197, 31215, 3056, 917, 198, 197, 532, 63234, 1669, 2915, 4866, 914, 11, 1273, 62768, 24814, 28748, 4965, 11, 1273, 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 TestMultiClusterAllocationOnLocalCluster(t *testing.T) { t.Parallel() fixtures := []apis.SchedulingStrategy{apis.Packed, apis.Distributed} for _, strategy := range fixtures { strategy := strategy t.Run(string(strategy), func(t *testing.T) { t.Parallel() namespace := fmt.Sprintf("gsa-multicluster-local-%s", uuid.NewUUID()) framework.CreateNamespace(t, namespace) defer framework.DeleteNamespace(t, namespace) fleets := framework.AgonesClient.AgonesV1().Fleets(namespace) fleet := defaultFleet(namespace) fleet.Spec.Scheduling = strategy flt, err := fleets.Create(fleet) if assert.Nil(t, err) { defer fleets.Delete(flt.ObjectMeta.Name, nil) // nolint:errcheck } framework.AssertFleetCondition(t, flt, e2e.FleetReadyCount(flt.Spec.Replicas)) // Allocation Policy #1: local cluster with desired label. // This policy allocates locally on the cluster due to matching namespace with gsa and not setting AllocationEndpoints. mca := &multiclusterv1alpha1.GameServerAllocationPolicy{ Spec: multiclusterv1alpha1.GameServerAllocationPolicySpec{ Priority: 1, Weight: 100, ConnectionInfo: multiclusterv1alpha1.ClusterConnectionInfo{ ClusterName: "multicluster1", SecretName: "sec1", Namespace: namespace, }, }, ObjectMeta: metav1.ObjectMeta{ Labels: map[string]string{"cluster": "onprem"}, GenerateName: "allocationpolicy-", }, } resp, err := framework.AgonesClient.MulticlusterV1alpha1().GameServerAllocationPolicies(fleet.ObjectMeta.Namespace).Create(mca) if !assert.Nil(t, err) { assert.FailNowf(t, "GameServerAllocationPolicies(%v).Create(%v)", fleet.ObjectMeta.Namespace, mca) } assert.Equal(t, mca.Spec, resp.Spec) // Allocation Policy #2: another cluster with desired label, but lower priority. // If the policy is selected due to a bug the request fails as it cannot find the secret. mca = &multiclusterv1alpha1.GameServerAllocationPolicy{ Spec: multiclusterv1alpha1.GameServerAllocationPolicySpec{ Priority: 2, Weight: 100, ConnectionInfo: multiclusterv1alpha1.ClusterConnectionInfo{ AllocationEndpoints: []string{"another-endpoint"}, ClusterName: "multicluster2", SecretName: "sec2", Namespace: namespace, }, }, ObjectMeta: metav1.ObjectMeta{ Labels: map[string]string{"cluster": "onprem"}, GenerateName: "allocationpolicy-", }, } resp, err = framework.AgonesClient.MulticlusterV1alpha1().GameServerAllocationPolicies(fleet.ObjectMeta.Namespace).Create(mca) if assert.Nil(t, err) { assert.Equal(t, mca.Spec, resp.Spec) } // Allocation Policy #3: another cluster with highest priority, but missing desired label (will not be selected) mca = &multiclusterv1alpha1.GameServerAllocationPolicy{ Spec: multiclusterv1alpha1.GameServerAllocationPolicySpec{ Priority: 1, Weight: 10, ConnectionInfo: multiclusterv1alpha1.ClusterConnectionInfo{ AllocationEndpoints: []string{"another-endpoint"}, ClusterName: "multicluster3", SecretName: "sec3", Namespace: namespace, }, }, ObjectMeta: metav1.ObjectMeta{ GenerateName: "allocationpolicy-", }, } resp, err = framework.AgonesClient.MulticlusterV1alpha1().GameServerAllocationPolicies(fleet.ObjectMeta.Namespace).Create(mca) if assert.Nil(t, err) { assert.Equal(t, mca.Spec, resp.Spec) } gsa := &allocationv1.GameServerAllocation{ Spec: allocationv1.GameServerAllocationSpec{ Scheduling: strategy, Required: metav1.LabelSelector{MatchLabels: map[string]string{agonesv1.FleetNameLabel: flt.ObjectMeta.Name}}, MultiClusterSetting: allocationv1.MultiClusterSetting{ Enabled: true, PolicySelector: metav1.LabelSelector{ MatchLabels: map[string]string{ "cluster": "onprem", }, }, }, }, ObjectMeta: metav1.ObjectMeta{ ClusterName: "multicluster1", GenerateName: "allocation-", Namespace: namespace, }, } // wait for the allocation policies to be added. err = wait.PollImmediate(2*time.Second, 2*time.Minute, func() (bool, error) { gsa, err = framework.AgonesClient.AllocationV1().GameServerAllocations(fleet.ObjectMeta.Namespace).Create(gsa) if err != nil { t.Logf("GameServerAllocations(%v).Create(%v) failed: %s", fleet.ObjectMeta.Namespace, gsa, err) return false, nil } assert.Equal(t, string(allocationv1.GameServerAllocationAllocated), string(gsa.Status.State)) return true, nil }) assert.NoError(t, err) }) } }
explode_data.jsonl/63307
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1932 }
[ 2830, 3393, 20358, 28678, 78316, 1925, 7319, 28678, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 2822, 1166, 941, 18513, 1669, 3056, 13725, 808, 44356, 19816, 90, 13725, 1069, 11191, 11, 97723, 909, 25146, 532, 2023, 8358, 8282, 1669,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestContext_Expand_Resource(t *testing.T) { manager := endly.New() context := manager.NewContext(toolbox.NewContext()) _, err := context.ExpandResource(nil) assert.NotNil(t, err) _, err = context.ExpandResource(&url.Resource{}) assert.NotNil(t, err) { state := context.State() state.Put("host", "127.0.0.1") expanded, err := context.ExpandResource(url.NewResource("scp://${host}/as")) if assert.Nil(t, err) { assert.EqualValues(t, "scp://127.0.0.1/as", expanded.URL) } } { _, err := context.ExpandResource(url.NewResource("path")) assert.Nil(t, err) } }
explode_data.jsonl/31799
{ "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, 1972, 62, 38946, 86346, 1155, 353, 8840, 836, 8, 341, 92272, 1669, 835, 398, 7121, 741, 28413, 1669, 6645, 7121, 1972, 48950, 2011, 7121, 1972, 12367, 197, 6878, 1848, 1669, 2266, 49844, 437, 4783, 27907, 340, 6948, 93882, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestGetLocalIp(t *testing.T) { addrs, err := net.InterfaceAddrs() if err != nil { fmt.Println(err) os.Exit(1) } for _, address := range addrs { if ipnet, ok := address.(*net.IPNet); ok && !ipnet.IP.IsLoopback() { if ipnet.IP.To4() != nil { fmt.Println(ipnet.IP.String()) } } } }
explode_data.jsonl/44307
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 146 }
[ 2830, 3393, 1949, 7319, 23378, 1155, 353, 8840, 836, 8, 341, 12718, 5428, 11, 1848, 1669, 4179, 41065, 2212, 5428, 741, 743, 1848, 961, 2092, 341, 197, 11009, 12419, 3964, 340, 197, 25078, 34358, 7, 16, 340, 197, 532, 2023, 8358, 2621...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestCreateOrdersHandlersCorrectly(t *testing.T) { middlewareBase := func(tag string) Middleware { return func(h http.Handler) http.Handler { return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { w.Write([]byte(tag)) h.ServeHTTP(w, r) }) } } t1 := middlewareBase("t1\n") t2 := middlewareBase("t2\n") t3 := middlewareBase("t3\n") testEndpoint := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { w.Write([]byte("endpoint\n")) }) chained := New(t1, t2, t3) t4 := middlewareBase("t4\n") createdChained := Create(chained, t4).Then(testEndpoint) w := httptest.NewRecorder() r, err := http.NewRequest(http.MethodGet, "/", nil) if err != nil { t.Fatal(err) } createdChained.ServeHTTP(w, r) if w.Body.String() != "t1\nt2\nt3\nt4\nendpoint\n" { t.Errorf("Then does not order handlers correctly (Order: %s)", w.Body.String()) return } }
explode_data.jsonl/46277
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 381 }
[ 2830, 3393, 4021, 24898, 39949, 33092, 398, 1155, 353, 8840, 836, 8, 1476, 2109, 11603, 3978, 1669, 2915, 19343, 914, 8, 72012, 341, 197, 853, 2915, 3203, 1758, 31010, 8, 1758, 31010, 341, 298, 853, 1758, 89164, 18552, 3622, 1758, 37508...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestPercentile(t *testing.T) { input := []struct { name string data []float64 percent float64 interpolate bool expected float64 absent bool }{ {"simple", []float64{1, 2, 3}, 50, false, 2, false}, {"80", []float64{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}, 80, false, 9, false}, } for _, test := range input { got, absent := Percentile(test.data, test.percent, test.interpolate) if got != test.expected { t.Errorf("Expected: %f. Got: %f. Test: %+v", test.expected, got, test) } if absent != test.absent { t.Errorf("Expected absent: %t. Got: %t. Test: %+v", test.absent, absent, test) } } }
explode_data.jsonl/74405
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 288 }
[ 2830, 3393, 32010, 457, 1155, 353, 8840, 836, 8, 341, 22427, 1669, 3056, 1235, 341, 197, 11609, 286, 914, 198, 197, 8924, 286, 3056, 3649, 21, 19, 198, 197, 197, 24422, 257, 2224, 21, 19, 198, 197, 58915, 45429, 1807, 198, 197, 4240...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestPerfCollector(t *testing.T) { canTestPerf(t) collector, err := NewPerfCollector(log.NewNopLogger()) if err != nil { t.Fatal(err) } // Setup background goroutine to capture metrics. metrics := make(chan prometheus.Metric) defer close(metrics) go func() { for range metrics { } }() if err := collector.Update(metrics); err != nil { t.Fatal(err) } }
explode_data.jsonl/30595
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 150 }
[ 2830, 3393, 3889, 69, 53694, 1155, 353, 8840, 836, 8, 341, 92936, 2271, 3889, 69, 1155, 340, 1444, 24605, 269, 11, 1848, 1669, 1532, 3889, 69, 53694, 12531, 7121, 45, 453, 7395, 2398, 743, 1848, 961, 2092, 341, 197, 3244, 26133, 3964,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestHealthCheck(t *testing.T) { defer leaktest.AfterTest(t)() cfg := config.DefaultZoneConfig() cfg.NumReplicas = proto.Int32(1) s, err := serverutils.StartServerRaw(base.TestServerArgs{ Knobs: base.TestingKnobs{ Server: &TestingKnobs{ DefaultZoneConfigOverride: &cfg, }, }, }) if err != nil { t.Fatal(err) } defer s.Stopper().Stop(context.TODO()) ctx := context.Background() recorder := s.(*TestServer).Server.recorder { summary := *recorder.GenerateNodeStatus(ctx) result := recorder.CheckHealth(ctx, summary) if len(result.Alerts) != 0 { t.Fatal(result) } } store, err := s.(*TestServer).Server.node.stores.GetStore(1) if err != nil { t.Fatal(err) } store.Metrics().UnavailableRangeCount.Inc(100) { summary := *recorder.GenerateNodeStatus(ctx) result := recorder.CheckHealth(ctx, summary) expAlerts := []statuspb.HealthAlert{ {StoreID: 1, Category: statuspb.HealthAlert_METRICS, Description: "ranges.unavailable", Value: 100.0}, } if !reflect.DeepEqual(expAlerts, result.Alerts) { t.Fatalf("expected %+v, got %+v", expAlerts, result.Alerts) } } }
explode_data.jsonl/70826
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 448 }
[ 2830, 3393, 14542, 3973, 1155, 353, 8840, 836, 8, 341, 16867, 23352, 1944, 36892, 2271, 1155, 8, 2822, 50286, 1669, 2193, 13275, 15363, 2648, 741, 50286, 39847, 18327, 52210, 284, 18433, 7371, 18, 17, 7, 16, 340, 1903, 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...
5