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 TestCompileManifests(t *testing.T) { var tests = []struct { manifest string data interface{} expected bool }{ { manifest: KubeProxyConfigMap, data: struct{ MasterEndpoint string }{ MasterEndpoint: "foo", }, expected: true, }, { manifest: KubeProxyDaemonSet, data: struct{ ImageRepository, Arch, Version, ImageOverride, ClusterCIDR, MasterTaintKey, CloudTaintKey string }{ ImageRepository: "foo", Arch: "foo", Version: "foo", ImageOverride: "foo", ClusterCIDR: "foo", MasterTaintKey: "foo", CloudTaintKey: "foo", }, expected: true, }, { manifest: KubeDNSDeployment, data: struct{ ImageRepository, Arch, Version, DNSDomain, MasterTaintKey string }{ ImageRepository: "foo", Arch: "foo", Version: "foo", DNSDomain: "foo", MasterTaintKey: "foo", }, expected: true, }, { manifest: KubeDNSService, data: struct{ DNSIP string }{ DNSIP: "foo", }, expected: true, }, } for _, rt := range tests { _, actual := kubeadmutil.ParseTemplate(rt.manifest, rt.data) if (actual == nil) != rt.expected { t.Errorf( "failed CompileManifests:\n\texpected: %t\n\t actual: %t", rt.expected, (actual == nil), ) } } }
explode_data.jsonl/65722
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 622 }
[ 2830, 3393, 46126, 38495, 82, 1155, 353, 8840, 836, 8, 341, 2405, 7032, 284, 3056, 1235, 341, 197, 197, 42315, 914, 198, 197, 8924, 257, 3749, 16094, 197, 42400, 1807, 198, 197, 59403, 197, 197, 515, 298, 197, 42315, 25, 730, 3760, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestClientSecret(t *testing.T) { mocksecretname := "mocksecret" mocksecretnamenoexist := "mocksecretnoexist" mocksecretnamespace := "default" mocksecretdata := map[string][]byte{ "mockdata": []byte("mockdata"), } // clean if _, err := mockcli.GetSecret(context.TODO(), mocksecretnamespace, mocksecretname); err == nil { err := mockcli.DeleteSecret(context.TODO(), mocksecretnamespace, mocksecretname) require.NoError(t, err) } if _, err := mockcli.GetSecret(context.TODO(), mocksecretnamespace, mocksecretnamenoexist); err == nil { err := mockcli.DeleteSecret(context.TODO(), mocksecretnamespace, mocksecretnamenoexist) require.NoError(t, err) } t.Run("create:secret", func(t *testing.T) { secret := &corev1.Secret{ ObjectMeta: metav1.ObjectMeta{ Name: mocksecretname, Namespace: mocksecretnamespace, }, Data: mocksecretdata, } _, err := mockcli.CreateSecret(context.TODO(), secret) require.NoError(t, err) }) t.Run("create:secret:error", func(t *testing.T) { secret := &corev1.Secret{ ObjectMeta: metav1.ObjectMeta{ Name: mocksecretname, }, Data: mocksecretdata, } _, err := mockcli.CreateSecret(context.TODO(), secret) require.EqualError(t, err, ErrorMissingNamespace.Error()) }) t.Run("get:secret", func(t *testing.T) { secret, err := mockcli.GetSecret(context.TODO(), mocksecretnamespace, mocksecretname) require.NoError(t, err) assert.Equal(t, mocksecretdata, secret.Data) }) t.Run("get:secret:list", func(t *testing.T) { list, err := mockcli.GetSecrets(context.TODO(), mocksecretnamespace) require.NoError(t, err) if len(list.Items) == 0 { t.Fatal(err) } }) t.Run("update:secret", func(t *testing.T) { updatedata := map[string][]byte{ "mockdata": []byte("mockdata"), "mockdataupdate": []byte("mockdata"), } secret := &corev1.Secret{ ObjectMeta: metav1.ObjectMeta{ Name: mocksecretname, Namespace: mocksecretnamespace, }, Data: updatedata, } updated, err := mockcli.UpdateSecret(context.TODO(), secret) require.NoError(t, err) assert.Equal(t, updatedata, updated.Data) }) t.Run("apply:secret:exist", func(t *testing.T) { applydata := map[string]string{ "mockdata": "mockdata", "mockdataapply": "mockdataapply", } applyed, err := mockcli.ApplySecret(context.TODO(), mocksecretnamespace, mocksecretname, applydata) require.NoError(t, err) assert.Equal(t, map[string][]byte{ "mockdata": []byte("mockdata"), "mockdataapply": []byte("mockdataapply"), "mockdataupdate": []byte("mockdata"), }, applyed.Data) }) t.Run("apply:secret:no:exist", func(t *testing.T) { applydata := map[string]string{ "mockdata": "mockdata", "mockdataapply": "mockdataapply", } _, err := mockcli.ApplySecret(context.TODO(), mocksecretnamespace, mocksecretnamenoexist, applydata) require.NoError(t, err) }) t.Run("apply:secret:bytes:exist", func(t *testing.T) { applydata := map[string][]byte{ "mockdata": []byte("mockdata"), "mockdataapply": []byte("mockdataapply"), } applyed, err := mockcli.ApplySecretBytes(context.TODO(), mocksecretnamespace, mocksecretname, applydata) require.NoError(t, err) assert.Equal(t, applydata, applyed.Data) }) t.Run("apply:secret:bytes:no:exist", func(t *testing.T) { applydata := map[string][]byte{ "mockdata": []byte("mockdata"), "mockdataapply": []byte("mockdataapply"), } _, err := mockcli.ApplySecretBytes(context.TODO(), mocksecretnamespace, mocksecretnamenoexist, applydata) require.NoError(t, err) }) t.Run("delete:secret", func(t *testing.T) { err := mockcli.DeleteSecret(context.TODO(), mocksecretnamespace, mocksecretname) require.NoError(t, err) err = mockcli.DeleteSecret(context.TODO(), mocksecretnamespace, mocksecretnamenoexist) require.NoError(t, err) }) }
explode_data.jsonl/30934
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1563 }
[ 2830, 3393, 2959, 19773, 1155, 353, 8840, 836, 8, 341, 77333, 20474, 606, 1669, 330, 16712, 20474, 698, 77333, 325, 837, 1517, 309, 11790, 28575, 1669, 330, 16712, 325, 837, 1517, 78, 28575, 698, 77333, 325, 837, 1517, 1680, 1669, 330, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestComparable(t *testing.T) { for _, tt := range comparableTests { if ok := tt.typ.Comparable(); ok != tt.ok { t.Errorf("TypeOf(%v).Comparable() = %v, want %v", tt.typ, ok, tt.ok) } } }
explode_data.jsonl/29591
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 93 }
[ 2830, 3393, 62635, 1155, 353, 8840, 836, 8, 341, 2023, 8358, 17853, 1669, 2088, 29039, 18200, 341, 197, 743, 5394, 1669, 17853, 49286, 2961, 49156, 2129, 5394, 961, 17853, 18165, 341, 298, 3244, 13080, 445, 929, 2124, 15238, 85, 568, 62...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestPluginInterfaceResolveType(t *testing.T) { grpcClientMock, teardown := setupPluginDriverTests(t) defer teardown(t) plug := plugin.NewPlugin(plugin.Config{ Cmd: "fake-plugin-command", }) defer plug.Close() data := []struct { in driver.InterfaceResolveTypeInput out driver.InterfaceResolveTypeOutput outErr error }{ { in: driver.InterfaceResolveTypeInput{}, out: driver.InterfaceResolveTypeOutput{}, }, { in: driver.InterfaceResolveTypeInput{}, out: driver.InterfaceResolveTypeOutput{ Error: &driver.Error{ Message: "", }, }, outErr: errors.New(""), }, } for _, tt := range data { grpcClientMock.On("InterfaceResolveType", tt.in).Return(tt.out, tt.outErr).Once() out := plug.InterfaceResolveType(tt.in) assert.Equal(t, tt.out, out) } grpcClientMock.AssertNumberOfCalls(t, "InterfaceResolveType", len(data)) }
explode_data.jsonl/37053
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 364 }
[ 2830, 3393, 11546, 5051, 56808, 929, 1155, 353, 8840, 836, 8, 341, 197, 56585, 2959, 11571, 11, 49304, 1669, 6505, 11546, 11349, 18200, 1155, 340, 16867, 49304, 1155, 340, 197, 47474, 1669, 9006, 7121, 11546, 46801, 10753, 515, 197, 6258,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestLocation_PrettyPrint(t *testing.T) { m1 := &Location{ LocationID: 1, BookNumber: sql.NullInt32{Int32: 2, Valid: true}, ChapterNumber: sql.NullInt32{Int32: 3, Valid: true}, DocumentID: sql.NullInt32{Int32: 4, Valid: true}, Track: sql.NullInt32{Int32: 5, Valid: true}, IssueTagNumber: 6, KeySymbol: sql.NullString{String: "nwtsty", Valid: true}, MepsLanguage: 7, LocationType: 8, Title: sql.NullString{String: "A title", Valid: true}, } buf := new(bytes.Buffer) w := tabwriter.NewWriter(buf, 0, 0, 1, ' ', 0) fmt.Fprint(w, "\nTitle:\tA title") fmt.Fprint(w, "\nBookNumber:\t2") fmt.Fprint(w, "\nChapterNumber:\t3") fmt.Fprint(w, "\nDocumentID:\t4") fmt.Fprint(w, "\nTrack:\t5") fmt.Fprint(w, "\nIssueTagNumber:\t6") fmt.Fprint(w, "\nKeySymbol:\tnwtsty") fmt.Fprint(w, "\nMepsLanguage:\t7") w.Flush() expectedResult := buf.String() assert.Equal(t, expectedResult, m1.PrettyPrint(nil)) m1.KeySymbol.Valid = false buf.Reset() fmt.Fprint(w, "\nTitle:\tA title") fmt.Fprint(w, "\nBookNumber:\t2") fmt.Fprint(w, "\nChapterNumber:\t3") fmt.Fprint(w, "\nDocumentID:\t4") fmt.Fprint(w, "\nTrack:\t5") fmt.Fprint(w, "\nIssueTagNumber:\t6") fmt.Fprint(w, "\nMepsLanguage:\t7") w.Flush() expectedResult = buf.String() assert.Equal(t, expectedResult, m1.PrettyPrint(nil)) }
explode_data.jsonl/60844
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 624 }
[ 2830, 3393, 4707, 1088, 21322, 8994, 1155, 353, 8840, 836, 8, 341, 2109, 16, 1669, 609, 4707, 515, 197, 197, 4707, 915, 25, 257, 220, 16, 345, 197, 197, 7134, 2833, 25, 257, 5704, 23979, 1072, 18, 17, 90, 1072, 18, 17, 25, 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 TestWithdraw(t *testing.T) { t.Parallel() if !areTestAPIKeysSet() || !canManipulateRealOrders { t.Skip("skipping test, either api keys or canManipulateRealOrders isnt set correctly") } _, err := f.Withdraw(context.Background(), currency.NewCode("bTc"), core.BitcoinDonationAddress, "", "", "957378", 0.0009) if err != nil { t.Error(err) } }
explode_data.jsonl/15183
{ "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, 92261, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 741, 743, 753, 546, 2271, 7082, 8850, 1649, 368, 1369, 753, 4814, 92876, 6334, 12768, 24898, 341, 197, 3244, 57776, 445, 4886, 5654, 1273, 11, 2987, 6330, 6894, 476, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestReauthEndLoop(t *testing.T) { var info = struct { reauthAttempts int maxReauthReached bool mut *sync.RWMutex }{ 0, false, new(sync.RWMutex), } numconc := 20 mut := new(sync.RWMutex) p := new(gophercloud.ProviderClient) p.UseTokenLock() p.SetToken(client.TokenID) p.ReauthFunc = func() error { info.mut.Lock() defer info.mut.Unlock() if info.reauthAttempts > 5 { info.maxReauthReached = true return fmt.Errorf("Max reauthentication attempts reached") } p.SetThrowaway(true) p.AuthenticatedHeaders() p.SetThrowaway(false) info.reauthAttempts++ return nil } th.SetupHTTP() defer th.TeardownHTTP() th.Mux.HandleFunc("/route", func(w http.ResponseWriter, r *http.Request) { // route always return 401 w.WriteHeader(http.StatusUnauthorized) return }) reqopts := new(gophercloud.RequestOpts) // counters for the upcoming errors errAfter := 0 errUnable := 0 wg := new(sync.WaitGroup) for i := 0; i < numconc; i++ { wg.Add(1) go func() { defer wg.Done() _, err := p.Request("GET", fmt.Sprintf("%s/route", th.Endpoint()), reqopts) mut.Lock() defer mut.Unlock() // ErrErrorAfter... will happen after a successful reauthentication, // but the service still responds with a 401. if _, ok := err.(*gophercloud.ErrErrorAfterReauthentication); ok { errAfter++ } // ErrErrorUnable... will happen when the custom reauth func reports // an error. if _, ok := err.(*gophercloud.ErrUnableToReauthenticate); ok { errUnable++ } }() } wg.Wait() th.AssertEquals(t, info.reauthAttempts, 6) th.AssertEquals(t, info.maxReauthReached, true) th.AssertEquals(t, errAfter > 1, true) th.AssertEquals(t, errUnable < 20, true) }
explode_data.jsonl/5890
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 730 }
[ 2830, 3393, 693, 3242, 3727, 14620, 1155, 353, 8840, 836, 8, 341, 2405, 3546, 284, 2036, 341, 197, 17200, 3242, 81517, 256, 526, 198, 197, 22543, 693, 3242, 98526, 1807, 198, 197, 2109, 332, 1060, 353, 12996, 2013, 15210, 9371, 198, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestOutputService6ProtocolTestMapsCase1(t *testing.T) { svc := NewOutputService6ProtocolTest(nil) buf := bytes.NewReader([]byte("{\"MapMember\": {\"a\": [1, 2], \"b\": [3, 4]}}")) req, out := svc.OutputService6TestCaseOperation1Request(nil) req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}} // set headers // unmarshal response restjson.UnmarshalMeta(req) restjson.Unmarshal(req) assert.NoError(t, req.Error) // assert response assert.NotNil(t, out) // ensure out variable is used assert.Equal(t, int64(1), *out.MapMember["a"][0]) assert.Equal(t, int64(2), *out.MapMember["a"][1]) assert.Equal(t, int64(3), *out.MapMember["b"][0]) assert.Equal(t, int64(4), *out.MapMember["b"][1]) }
explode_data.jsonl/8444
{ "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, 5097, 1860, 21, 20689, 2271, 36562, 4207, 16, 1155, 353, 8840, 836, 8, 341, 1903, 7362, 1669, 1532, 5097, 1860, 21, 20689, 2271, 27907, 692, 26398, 1669, 5820, 68587, 10556, 3782, 99141, 2227, 9366, 11693, 314, 2105, 64, 116...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestStoreSendWithZeroTime(t *testing.T) { defer leaktest.AfterTest(t) store, mc, stopper := createTestStore(t) defer stopper.Stop() args := getArgs([]byte("a")) // Set clock to time 1. mc.Set(1) resp, err := client.SendWrapped(store.testSender(), nil, &args) if err != nil { t.Fatal(err) } reply := resp.(*roachpb.GetResponse) // The Logical time will increase over the course of the command // execution so we can only rely on comparing the WallTime. if reply.Timestamp.WallTime != store.ctx.Clock.Now().WallTime { t.Errorf("expected reply to have store clock time %s; got %s", store.ctx.Clock.Now(), reply.Timestamp) } }
explode_data.jsonl/44470
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 232 }
[ 2830, 3393, 6093, 11505, 2354, 17999, 1462, 1155, 353, 8840, 836, 8, 341, 16867, 23352, 1944, 36892, 2271, 1155, 340, 57279, 11, 19223, 11, 2936, 712, 1669, 1855, 2271, 6093, 1155, 340, 16867, 2936, 712, 30213, 741, 31215, 1669, 633, 41...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestDeletePicture(t *testing.T) { f, err := OpenFile(filepath.Join("test", "Book1.xlsx")) assert.NoError(t, err) assert.NoError(t, f.DeletePicture("Sheet1", "A1")) assert.NoError(t, f.AddPicture("Sheet1", "P1", filepath.Join("test", "images", "excel.jpg"), "")) assert.NoError(t, f.DeletePicture("Sheet1", "P1")) assert.NoError(t, f.SaveAs(filepath.Join("test", "TestDeletePicture.xlsx"))) // Test delete picture on not exists worksheet. assert.EqualError(t, f.DeletePicture("SheetN", "A1"), "sheet SheetN is not exist") // Test delete picture with invalid coordinates. assert.EqualError(t, f.DeletePicture("Sheet1", ""), `cannot convert cell "" to coordinates: invalid cell name ""`) // Test delete picture on no chart worksheet. assert.NoError(t, NewFile().DeletePicture("Sheet1", "A1")) }
explode_data.jsonl/51749
{ "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, 6435, 24669, 1155, 353, 8840, 836, 8, 341, 1166, 11, 1848, 1669, 5264, 1703, 34793, 22363, 445, 1944, 497, 330, 7134, 16, 46838, 5455, 6948, 35699, 1155, 11, 1848, 340, 6948, 35699, 1155, 11, 282, 18872, 24669, 445, 10541, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestClone_CheckoutMergeNoneExisting(t *testing.T) { // Initialize the git repo. repoDir, cleanup := initRepo(t) defer cleanup() // Add a commit to branch 'branch' that's not on master. runCmd(t, repoDir, "git", "checkout", "branch") runCmd(t, repoDir, "touch", "branch-file") runCmd(t, repoDir, "git", "add", "branch-file") runCmd(t, repoDir, "git", "commit", "-m", "branch-commit") branchCommit := runCmd(t, repoDir, "git", "rev-parse", "HEAD") // Now switch back to master and advance the master branch by another // commit. runCmd(t, repoDir, "git", "checkout", "master") runCmd(t, repoDir, "touch", "master-file") runCmd(t, repoDir, "git", "add", "master-file") runCmd(t, repoDir, "git", "commit", "-m", "master-commit") masterCommit := runCmd(t, repoDir, "git", "rev-parse", "HEAD") // Finally, perform a merge in another branch ourselves, just so we know // what the final state of the repo should be. runCmd(t, repoDir, "git", "checkout", "-b", "mergetest") runCmd(t, repoDir, "git", "merge", "-m", "atlantis-merge", "branch") expLsOutput := runCmd(t, repoDir, "ls") dataDir, cleanup2 := TempDir(t) defer cleanup2() overrideURL := fmt.Sprintf("file://%s", repoDir) wd := &events.FileWorkspace{ DataDir: dataDir, CheckoutMerge: true, TestingOverrideHeadCloneURL: overrideURL, TestingOverrideBaseCloneURL: overrideURL, } cloneDir, err := wd.Clone(nil, models.Repo{}, models.Repo{}, models.PullRequest{ HeadBranch: "branch", BaseBranch: "master", }, "default") Ok(t, err) // Check the commits. actBaseCommit := runCmd(t, cloneDir, "git", "rev-parse", "HEAD~1") actHeadCommit := runCmd(t, cloneDir, "git", "rev-parse", "HEAD^2") Equals(t, masterCommit, actBaseCommit) Equals(t, branchCommit, actHeadCommit) // Use ls to verify the repo looks good. actLsOutput := runCmd(t, cloneDir, "ls") Equals(t, expLsOutput, actLsOutput) }
explode_data.jsonl/17057
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 755 }
[ 2830, 3393, 37677, 28188, 411, 52096, 4064, 53067, 1155, 353, 8840, 836, 8, 341, 197, 322, 9008, 279, 16345, 15867, 624, 17200, 5368, 6184, 11, 21290, 1669, 2930, 25243, 1155, 340, 16867, 21290, 2822, 197, 322, 2691, 264, 5266, 311, 887...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestNewRequestTunnelingIsPossible(t *testing.T) { client := newClient() client.ProxyURL = &url.URL{Scheme: "socks5", Host: "[::1]:54321"} req, err := client.NewRequest( context.Background(), "GET", "/", nil, nil, ) if err != nil { t.Fatal(err) } cmp := cmp.Diff(dialer.ContextProxyURL(req.Context()), client.ProxyURL) if cmp != "" { t.Fatal(cmp) } }
explode_data.jsonl/60967
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 155 }
[ 2830, 3393, 3564, 1900, 51, 40292, 287, 3872, 65222, 1155, 353, 8840, 836, 8, 341, 25291, 1669, 501, 2959, 741, 25291, 75200, 3144, 284, 609, 1085, 20893, 90, 28906, 25, 330, 13199, 82, 20, 497, 16102, 25, 10545, 486, 16, 5669, 20, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func Test_WorkspaceCapping_Status_WhenPropertiesConverted_RoundTripsWithoutLoss(t *testing.T) { t.Parallel() parameters := gopter.DefaultTestParameters() parameters.MaxSize = 10 properties := gopter.NewProperties(parameters) properties.Property( "Round trip from WorkspaceCapping_Status to WorkspaceCapping_Status via AssignPropertiesToWorkspaceCappingStatus & AssignPropertiesFromWorkspaceCappingStatus returns original", prop.ForAll(RunPropertyAssignmentTestForWorkspaceCappingStatus, WorkspaceCappingStatusGenerator())) properties.TestingRun(t, gopter.NewFormatedReporter(false, 240, os.Stdout)) }
explode_data.jsonl/43368
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 182 }
[ 2830, 3393, 87471, 8746, 34, 3629, 36449, 62, 4498, 7903, 61941, 2568, 795, 21884, 1690, 26040, 39838, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 741, 67543, 1669, 728, 73137, 13275, 2271, 9706, 741, 67543, 14535, 1695, 284, 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 TestClusterMembers(t *testing.T) { cls := &cluster{ members: map[types.ID]*Member{ 1: &Member{ID: 1}, 20: &Member{ID: 20}, 100: &Member{ID: 100}, 5: &Member{ID: 5}, 50: &Member{ID: 50}, }, } w := []*Member{ &Member{ID: 1}, &Member{ID: 5}, &Member{ID: 20}, &Member{ID: 50}, &Member{ID: 100}, } if g := cls.Members(); !reflect.DeepEqual(g, w) { t.Fatalf("Members()=%#v, want %#v", g, w) } }
explode_data.jsonl/52340
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 226 }
[ 2830, 3393, 28678, 24371, 1155, 353, 8840, 836, 8, 341, 197, 18074, 1669, 609, 18855, 515, 197, 2109, 7062, 25, 2415, 58, 9242, 9910, 8465, 9366, 515, 298, 197, 16, 25, 256, 609, 9366, 90, 915, 25, 220, 16, 1583, 298, 197, 17, 15,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestStateProposerSelection2(t *testing.T) { cs1, vss := randState(4) // test needs more work for more than 3 validators height := cs1.Height newRoundCh := subscribe(cs1.eventBus, types.EventQueryNewRound) // this time we jump in at round 2 incrementRound(vss[1:]...) incrementRound(vss[1:]...) round := 2 startTestRound(cs1, height, round) ensureNewRound(newRoundCh, height, round) // wait for the new round // everyone just votes nil. we get a new proposer each round for i := 0; i < len(vss); i++ { prop := cs1.GetRoundState().Validators.GetProposer() pvk, err := vss[(i+round)%len(vss)].GetPubKey() require.NoError(t, err) addr := pvk.Address() correctProposer := addr if !bytes.Equal(prop.Address, correctProposer) { panic(fmt.Sprintf( "expected RoundState.Validators.GetProposer() to be validator %d. Got %X", (i+2)%len(vss), prop.Address)) } rs := cs1.GetRoundState() signAddVotes(cs1, types.PrecommitType, nil, rs.ProposalBlockParts.Header(), vss[1:]...) ensureNewRound(newRoundCh, height, i+round+1) // wait for the new round event each round incrementRound(vss[1:]...) } }
explode_data.jsonl/81641
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 435 }
[ 2830, 3393, 1397, 2008, 23438, 11177, 17, 1155, 353, 8840, 836, 8, 341, 71899, 16, 11, 348, 778, 1669, 10382, 1397, 7, 19, 8, 442, 1273, 3880, 803, 975, 369, 803, 1091, 220, 18, 38588, 198, 30500, 1669, 10532, 16, 17743, 198, 8638, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_DomainMultiCreate(t *testing.T) { client := NewClient("", "", false) nodesResponse, _, err := client.Node.List() require.Nil(t, err, err) if len(nodesResponse.Results) == 0 { t.SkipNow() } randomNode := nodesResponse.Results[rand.Intn(len(nodesResponse.Results))] config := new(DomainMultiCreateConfig) config.DomainId = TestDomainID config.VerboseName = TestDomainName config.Node = randomNode.Id domain, _, err := client.Domain.MultiCreate(*config) require.Nil(t, err, err) assert.NotEqual(t, domain.Id, "", "Domain Id can not be empty") status, _, err := client.Domain.Remove(TestDomainID) assert.Nil(t, err) assert.True(t, status) return }
explode_data.jsonl/12042
{ "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, 1557, 3121, 20358, 4021, 1155, 353, 8840, 836, 8, 341, 25291, 1669, 1532, 2959, 19814, 7342, 895, 692, 79756, 2582, 11, 8358, 1848, 1669, 2943, 21714, 5814, 741, 17957, 59678, 1155, 11, 1848, 11, 1848, 340, 743, 2422, 38705,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestSliceEqualFunc(t *testing.T) { tests := []struct { name string input []int input2 []int want bool }{ { name: "case", input: []int{1, 2}, input2: []int{1, 2}, want: true, }, { name: "case", input: []int{1, 2}, input2: []int{1, 2}, want: true, }, { name: "empty", input: []int{}, input2: []int{}, want: true, }, { name: "nil", input: nil, input2: nil, want: true, }, { name: "nil and empty", input: []int{}, input2: nil, want: true, }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { got := NewSlice(tt.input).EqualFunc(tt.input2, func(a int, b int) bool { return a == b }) assert.Equal(t, tt.want, got) }) } }
explode_data.jsonl/55744
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 417 }
[ 2830, 3393, 33236, 2993, 9626, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 3056, 1235, 341, 197, 11609, 256, 914, 198, 197, 22427, 220, 3056, 396, 198, 197, 22427, 17, 3056, 396, 198, 197, 50780, 256, 1807, 198, 197, 59403, 197, 197, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestResourceMetricsSlice_MoveAndAppendTo(t *testing.T) { // Test MoveAndAppendTo to empty expectedSlice := generateTestResourceMetricsSlice() dest := NewResourceMetricsSlice() src := generateTestResourceMetricsSlice() src.MoveAndAppendTo(dest) assert.EqualValues(t, generateTestResourceMetricsSlice(), dest) assert.EqualValues(t, 0, src.Len()) assert.EqualValues(t, expectedSlice.Len(), dest.Len()) // Test MoveAndAppendTo empty slice src.MoveAndAppendTo(dest) assert.EqualValues(t, generateTestResourceMetricsSlice(), dest) assert.EqualValues(t, 0, src.Len()) assert.EqualValues(t, expectedSlice.Len(), dest.Len()) // Test MoveAndAppendTo not empty slice generateTestResourceMetricsSlice().MoveAndAppendTo(dest) assert.EqualValues(t, 2*expectedSlice.Len(), dest.Len()) for i := 0; i < expectedSlice.Len(); i++ { assert.EqualValues(t, expectedSlice.At(i), dest.At(i)) assert.EqualValues(t, expectedSlice.At(i), dest.At(i+expectedSlice.Len())) } }
explode_data.jsonl/19490
{ "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, 4783, 27328, 33236, 66352, 3036, 23877, 1249, 1155, 353, 8840, 836, 8, 341, 197, 322, 3393, 14561, 3036, 23877, 1249, 311, 4287, 198, 42400, 33236, 1669, 6923, 2271, 4783, 27328, 33236, 741, 49616, 1669, 1532, 4783, 27328, 332...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestSend(t *testing.T) { t.Parallel() submitRequest := &orderer.SubmitRequest{Channel: "mychannel"} submitResponse := &orderer.StepResponse{ Payload: &orderer.StepResponse_SubmitRes{ SubmitRes: &orderer.SubmitResponse{Status: common.Status_SUCCESS}, }, } consensusRequest := &orderer.ConsensusRequest{ Channel: "mychannel", } submitReq := wrapSubmitReq(submitRequest) consensusReq := &orderer.StepRequest{ Payload: &orderer.StepRequest_ConsensusRequest{ ConsensusRequest: consensusRequest, }, } submit := func(rpc *cluster.RPC) error { err := rpc.SendSubmit(1, submitRequest) return err } step := func(rpc *cluster.RPC) error { return rpc.SendConsensus(1, consensusRequest) } type testCase struct { name string method func(rpc *cluster.RPC) error sendReturns error sendCalledWith *orderer.StepRequest receiveReturns []interface{} stepReturns []interface{} remoteError error expectedErr string } l := &sync.Mutex{} var tst testCase sent := make(chan struct{}) var sendCalls uint32 stream := &mocks.StepClient{} stream.On("Context", mock.Anything).Return(context.Background()) stream.On("Send", mock.Anything).Return(func(*orderer.StepRequest) error { l.Lock() defer l.Unlock() atomic.AddUint32(&sendCalls, 1) sent <- struct{}{} return tst.sendReturns }) for _, tst := range []testCase{ { name: "Send and Receive submit succeed", method: submit, sendReturns: nil, stepReturns: []interface{}{stream, nil}, receiveReturns: []interface{}{submitResponse, nil}, sendCalledWith: submitReq, }, { name: "Send step succeed", method: step, sendReturns: nil, stepReturns: []interface{}{stream, nil}, sendCalledWith: consensusReq, }, { name: "Send submit fails", method: submit, sendReturns: errors.New("oops"), stepReturns: []interface{}{stream, nil}, sendCalledWith: submitReq, expectedErr: "stream is aborted", }, { name: "Send step fails", method: step, sendReturns: errors.New("oops"), stepReturns: []interface{}{stream, nil}, sendCalledWith: consensusReq, expectedErr: "stream is aborted", }, { name: "Remote() fails", method: submit, remoteError: errors.New("timed out"), stepReturns: []interface{}{stream, nil}, expectedErr: "timed out", }, { name: "Submit fails with Send", method: submit, stepReturns: []interface{}{nil, errors.New("deadline exceeded")}, expectedErr: "deadline exceeded", }, } { l.Lock() testCase := tst l.Unlock() t.Run(testCase.name, func(t *testing.T) { atomic.StoreUint32(&sendCalls, 0) isSend := testCase.receiveReturns == nil comm := &mocks.Communicator{} client := &mocks.ClusterClient{} client.On("Step", mock.Anything).Return(testCase.stepReturns...) rm := &cluster.RemoteContext{ Metrics: cluster.NewMetrics(&disabled.Provider{}), SendBuffSize: 1, Logger: flogging.MustGetLogger("test"), ProbeConn: func(_ *grpc.ClientConn) error { return nil }, Client: client, } defer rm.Abort() comm.On("Remote", "mychannel", uint64(1)).Return(rm, testCase.remoteError) rpc := &cluster.RPC{ Logger: flogging.MustGetLogger("test"), Timeout: time.Hour, StreamsByType: cluster.NewStreamsByType(), Channel: "mychannel", Comm: comm, } var err error err = testCase.method(rpc) if testCase.remoteError == nil && testCase.stepReturns[1] == nil { <-sent } if testCase.stepReturns[1] == nil && testCase.remoteError == nil { assert.NoError(t, err) } else { assert.EqualError(t, err, testCase.expectedErr) } if testCase.remoteError == nil && testCase.expectedErr == "" && isSend { stream.AssertCalled(t, "Send", testCase.sendCalledWith) // Ensure that if we succeeded - only 1 stream was created despite 2 calls // to Send() were made err := testCase.method(rpc) <-sent assert.NoError(t, err) assert.Equal(t, 2, int(atomic.LoadUint32(&sendCalls))) client.AssertNumberOfCalls(t, "Step", 1) } }) } }
explode_data.jsonl/77745
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1813 }
[ 2830, 3393, 11505, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 741, 28624, 1763, 1900, 1669, 609, 1358, 261, 98309, 1900, 90, 9629, 25, 330, 2408, 10119, 16707, 28624, 1763, 2582, 1669, 609, 1358, 261, 68402, 2582, 515, 197, 10025,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestInsertProject_withWrongKey(t *testing.T) { db, cache, end := test.SetupPG(t, bootstrap.InitiliazeDB) defer end() u, _ := assets.InsertAdminUser(db) proj := sdk.Project{ Name: "test proj", Key: "error key", } assert.Error(t, project.Insert(db, cache, &proj, u)) }
explode_data.jsonl/76251
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 117 }
[ 2830, 3393, 13780, 7849, 6615, 29185, 1592, 1155, 353, 8840, 836, 8, 341, 20939, 11, 6500, 11, 835, 1669, 1273, 39820, 11383, 1155, 11, 26925, 26849, 24078, 2986, 3506, 340, 16867, 835, 741, 10676, 11, 716, 1669, 11770, 23142, 7210, 147...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestPatchDimensionsReturnsBadRequest(t *testing.T) { t.Parallel() Convey("Given a Dataset API instance with a mocked datastore GetInstance", t, func() { w := httptest.NewRecorder() mockedDataStore, isLocked := storeMockWithLock(false) datasetAPI := getAPIWithCMDMocks(testContext, mockedDataStore, &mocks.DownloadsGeneratorMock{}) bodies := map[string]io.Reader{ "Then patch dimensions with an invalid body returns bad request": strings.NewReader(`wrong`), "Then patch dimensions with a patch containing an unsupported method returns bad request": strings.NewReader(`[{ "op": "remove", "path": "/-" }]`), "Then patch dimensions with an unexpected path returns bad request": strings.NewReader(`[{ "op": "add", "path": "unexpected", "value": [{"option": "op1", "dimension": "TestDim"},{"option": "op2", "dimension": "TestDim"}] }]`), "Then patch dimensions with an unexpected value type for path '/-' returns bad request": strings.NewReader(`[{ "op": "add", "path": "/-", "value": {"option": "op1", "dimension": "TestDim"} }]`), "Then patch dimensions with an unexpected value type for path '/{dimension}/options/{option}/node_id' returns bad request": strings.NewReader(`[{ "op": "add", "path": "/dim1/options/op1/node_id", "value": 8 }]`), "Then patch dimensions with an unexpected value type for path '/{dimension}/options/{option}/order' returns bad request": strings.NewReader(`[{ "op": "add", "path": "/dim1/options/op1/order", "value": "wrong" }]`), "Then patch dimensions with an option with missing parameters returns bad request": strings.NewReader(`[{ "op": "add", "path": "/-", "value": [{"option": "op1"},{"option": "op2", "dimension": "TestDim"}] }]`), "Then patch dimensions with a total number of values greater than MaxRequestOptions in a single patch op returns bad request": strings.NewReader(`[{ "op": "add", "path": "/-", "value": [ {"option": "op01", "dimension": "TestDim"}, {"option": "op02", "dimension": "TestDim"}, {"option": "op03", "dimension": "TestDim"}, {"option": "op04", "dimension": "TestDim"}, {"option": "op05", "dimension": "TestDim"}, {"option": "op06", "dimension": "TestDim"}, {"option": "op07", "dimension": "TestDim"}, {"option": "op08", "dimension": "TestDim"}, {"option": "op09", "dimension": "TestDim"}, {"option": "op10", "dimension": "TestDim"}, {"option": "op11", "dimension": "TestDim"} ] }]`), "Then patch dimensions with a total number of values greater than MaxRequestOptions distributed in multiple patch ops returns bad request": strings.NewReader(`[ { "op": "add", "path": "/-", "value": [ {"option": "op01", "dimension": "TestDim"}, {"option": "op02", "dimension": "TestDim"}, {"option": "op03", "dimension": "TestDim"}, {"option": "op04", "dimension": "TestDim"}, {"option": "op05", "dimension": "TestDim"}, {"option": "op06", "dimension": "TestDim"}, {"option": "op07", "dimension": "TestDim"}, {"option": "op08", "dimension": "TestDim"}, {"option": "op09", "dimension": "TestDim"} ] }, { "op": "add", "path": "/TestDim/options/op1/order", "value": 10 }, { "op": "add", "path": "/TestDim/options/op1/node_id", "value": "testNodeID" }, { "op": "add", "path": "/-", "value": [ {"option": "op12", "dimension": "TestDim"} ] } ]`), } for msg, body := range bodies { Convey(msg, func() { r, err := createRequestWithToken(http.MethodPatch, "http://localhost:21800/instances/123/dimensions", body) So(err, ShouldBeNil) datasetAPI.Router.ServeHTTP(w, r) So(w.Code, ShouldEqual, http.StatusBadRequest) So(mockedDataStore.GetInstanceCalls(), ShouldHaveLength, 1) So(*isLocked, ShouldBeFalse) }) } }) }
explode_data.jsonl/20848
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1597 }
[ 2830, 3393, 43622, 21351, 16446, 46015, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 2822, 93070, 5617, 445, 22043, 264, 39183, 5333, 2867, 448, 264, 46149, 64986, 2126, 2523, 497, 259, 11, 2915, 368, 341, 197, 6692, 1669, 54320, 70...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_createBootClone_into_existing_git_repo_fails(t *testing.T) { log.SetOutput(ioutil.Discard) bootDir, err := ioutil.TempDir("", "boot-test") require.NoError(t, err) defer func() { _ = os.RemoveAll(bootDir) }() factory := cmd_mocks.NewMockFactory() commonOpts := opts.NewCommonOptionsWithFactory(factory) commonOpts.BatchMode = true o := BootOptions{ CommonOptions: &commonOpts, Dir: bootDir, } repoPath := filepath.Join(bootDir, "my-repo") err = os.MkdirAll(repoPath, 0700) require.NoError(t, err) gitter := gits.NewGitCLI() err = gitter.Init(repoPath) require.NoError(t, err) cloneDir, err := o.createBootClone(config.DefaultBootRepository, config.DefaultVersionsRef, repoPath) assert.Error(t, err) assert.Contains(t, err.Error(), "dir already exists") assert.Empty(t, cloneDir) }
explode_data.jsonl/63008
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 337 }
[ 2830, 3393, 8657, 17919, 37677, 45514, 62630, 68801, 37784, 761, 6209, 1155, 353, 8840, 836, 8, 341, 6725, 4202, 5097, 1956, 30158, 909, 47560, 340, 197, 4619, 6184, 11, 1848, 1669, 43144, 65009, 6184, 19814, 330, 4619, 16839, 1138, 17957...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestTags_Has(t *testing.T) { c := NewComment() c.Tags.Add("wow") if !c.Tags.Has("wow") { t.Error("Expected to have the tag \"wow\" but it did not!") } if c.Tags.Has("such") { t.Error("Expected to don't have the tag \"such\" but it did!") } }
explode_data.jsonl/58849
{ "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, 15930, 2039, 300, 1155, 353, 8840, 836, 8, 341, 1444, 1669, 1532, 10677, 741, 1444, 73522, 1904, 445, 57454, 1138, 743, 753, 66, 73522, 16152, 445, 57454, 899, 341, 197, 3244, 6141, 445, 18896, 311, 614, 279, 4772, 7245, 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...
3
func TestAccAWSS3BucketObject_content(t *testing.T) { var obj s3.GetObjectOutput resourceName := "aws_s3_bucket_object.object" rInt := acctest.RandInt() resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, CheckDestroy: testAccCheckAWSS3BucketObjectDestroy, Steps: []resource.TestStep{ { PreConfig: func() {}, Config: testAccAWSS3BucketObjectConfigContent(rInt, "some_bucket_content"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSS3BucketObjectExists(resourceName, &obj), testAccCheckAWSS3BucketObjectBody(&obj, "some_bucket_content"), ), }, }, }) }
explode_data.jsonl/64955
{ "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, 14603, 14419, 1220, 18, 36018, 1190, 7495, 1155, 353, 8840, 836, 8, 341, 2405, 2839, 274, 18, 25618, 5097, 198, 50346, 675, 1669, 330, 8635, 643, 18, 38749, 5314, 6035, 698, 7000, 1072, 1669, 1613, 67880, 2013, 437, 1072, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestCancelJobs(t *testing.T) { ctx := context.Background() s, err := standard.New(ctx, standard.WithLogLevel(zerolog.Disabled), standard.WithMonitor(&nullmetrics.Service{})) require.NoError(t, err) require.NotNil(t, s) run := 0 runFunc := func(ctx context.Context, data interface{}) { run++ } require.NoError(t, s.ScheduleJob(ctx, "Test", "Test job 1", time.Now().Add(100*time.Millisecond), runFunc, nil)) require.NoError(t, s.ScheduleJob(ctx, "Test", "Test job 2", time.Now().Add(100*time.Millisecond), runFunc, nil)) require.NoError(t, s.ScheduleJob(ctx, "Test", "No cancel job", time.Now().Add(100*time.Millisecond), runFunc, nil)) require.Equal(t, 0, run) require.Len(t, s.ListJobs(ctx), 3) s.CancelJobs(ctx, "Test job") require.Len(t, s.ListJobs(ctx), 1) time.Sleep(time.Duration(110) * time.Millisecond) assert.Equal(t, 1, run) require.Len(t, s.ListJobs(ctx), 0) }
explode_data.jsonl/44210
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 364 }
[ 2830, 3393, 9269, 40667, 1155, 353, 8840, 836, 8, 341, 20985, 1669, 2266, 19047, 741, 1903, 11, 1848, 1669, 5297, 7121, 7502, 11, 5297, 26124, 72676, 7, 7070, 1609, 89576, 701, 5297, 26124, 30098, 2099, 2921, 43262, 13860, 6257, 1171, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestPolicy_String(t *testing.T) { tests := []struct { name string p *Policy want string }{ // TODO: Add test cases. } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { if got := tt.p.String(); got != tt.want { t.Errorf("Policy.String() = %v, want %v", got, tt.want) } }) } }
explode_data.jsonl/10346
{ "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, 13825, 31777, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 3056, 1235, 341, 197, 11609, 914, 198, 197, 3223, 262, 353, 13825, 198, 197, 50780, 914, 198, 197, 59403, 197, 197, 322, 5343, 25, 2691, 1273, 5048, 624, 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...
2
func TestInterpretCharacterLiteralType(t *testing.T) { t.Parallel() inter := parseCheckAndInterpret(t, ` fun test(): Type { let c: Character = "x" return c.getType() } `) result, err := inter.Invoke("test") require.NoError(t, err) require.Equal(t, interpreter.TypeValue{Type: interpreter.PrimitiveStaticTypeCharacter}, result, ) }
explode_data.jsonl/73421
{ "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, 3306, 8043, 12404, 17350, 929, 1155, 353, 8840, 836, 8, 1476, 3244, 41288, 7957, 2822, 58915, 1669, 4715, 3973, 3036, 3306, 8043, 1155, 11, 22074, 262, 2464, 1273, 4555, 3990, 341, 286, 1077, 272, 25, 15633, 284, 330, 87, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestGetTracemallocEnabled(t *testing.T) { // Reset memory counters helpers.ResetMemoryStats() code := `assert datadog_agent.tracemalloc_enabled()` _, err := run(code) if err != nil { t.Fatal(err) } // Check for leaks helpers.AssertMemoryUsage(t) }
explode_data.jsonl/24546
{ "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, 1949, 1282, 580, 336, 4742, 5462, 1155, 353, 8840, 836, 8, 341, 197, 322, 16932, 4938, 31532, 198, 197, 21723, 36660, 10642, 16635, 2822, 43343, 1669, 1565, 2207, 3258, 329, 538, 25730, 5427, 580, 336, 4742, 18220, 368, 3989...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestPodSpiffeId(t *testing.T) { for _, testCase := range []struct { name string expectedSpiffeID string configLabel string podLabel string configAnnotation string podAnnotation string podNamespace string podServiceAccount string }{ { name: "using namespace and serviceaccount", expectedSpiffeID: "spiffe://domain.test/ns/NS/sa/SA", podNamespace: "NS", podServiceAccount: "SA", }, { name: "using label", expectedSpiffeID: "spiffe://domain.test/LABEL", configLabel: "spiffe.io/label", podLabel: "LABEL", }, { name: "using annotation", expectedSpiffeID: "spiffe://domain.test/ANNOTATION", configAnnotation: "spiffe.io/annotation", podAnnotation: "ANNOTATION", }, { name: "ignore unannotated", configAnnotation: "someannotation", expectedSpiffeID: "", }, { name: "ignore unlabelled", configLabel: "somelabel", expectedSpiffeID: "", }, } { testCase := testCase t.Run(testCase.name, func(t *testing.T) { c, _ := newTestController(testCase.configLabel, testCase.configAnnotation) // Set up pod: pod := &corev1.Pod{ Spec: corev1.PodSpec{ ServiceAccountName: testCase.podServiceAccount, }, ObjectMeta: metav1.ObjectMeta{ Namespace: testCase.podNamespace, Labels: map[string]string{}, Annotations: map[string]string{}, }, } if testCase.configLabel != "" && testCase.podLabel != "" { pod.Labels[testCase.configLabel] = testCase.podLabel } if testCase.configAnnotation != "" && testCase.podAnnotation != "" { pod.Annotations[testCase.configAnnotation] = testCase.podAnnotation } // Test: spiffeID := c.podSpiffeID(pod) // Verify result: require.Equal(t, testCase.expectedSpiffeID, stringFromID(spiffeID)) }) } }
explode_data.jsonl/32156
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 864 }
[ 2830, 3393, 23527, 6406, 43414, 764, 1155, 353, 8840, 836, 8, 341, 2023, 8358, 54452, 1669, 2088, 3056, 1235, 341, 197, 11609, 1060, 914, 198, 197, 42400, 6406, 43414, 915, 220, 914, 198, 197, 25873, 2476, 981, 914, 198, 197, 3223, 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...
5
func TestIsReportFinished(t *testing.T) { const ( testNamespace = "default" testReportName = "test-report" testQueryName = "test-query" testReportMessage = "test-message" ) schedule := &metering.ReportSchedule{ Period: metering.ReportPeriodCron, Cron: &metering.ReportScheduleCron{Expression: "5 4 * * *"}, } reportStart := &time.Time{} reportEndTmp := reportStart.AddDate(0, 1, 0) reportEnd := &reportEndTmp testTable := []struct { name string report *metering.Report expectFinished bool }{ { name: "new report returns false", report: testhelpers.NewReport(testReportName, testNamespace, testQueryName, reportStart, reportEnd, metering.ReportStatus{}, nil, false, nil), expectFinished: false, }, { name: "finished status on run-once report returns true", report: testhelpers.NewReport(testReportName, testNamespace, testQueryName, reportStart, reportEnd, metering.ReportStatus{ Conditions: []metering.ReportCondition{ *meteringUtil.NewReportCondition(metering.ReportRunning, v1.ConditionFalse, meteringUtil.ReportFinishedReason, testReportMessage), }, }, nil, false, nil), expectFinished: true, }, { name: "unset reportingEnd returns false", report: testhelpers.NewReport(testReportName, testNamespace, testQueryName, reportStart, nil, metering.ReportStatus{ Conditions: []metering.ReportCondition{ *meteringUtil.NewReportCondition(metering.ReportRunning, v1.ConditionFalse, meteringUtil.ReportFinishedReason, testReportMessage), }, }, schedule, false, nil), expectFinished: false, }, { name: "reportingEnd > lastReportTime returns false", report: testhelpers.NewReport(testReportName, testNamespace, testQueryName, reportStart, reportEnd, metering.ReportStatus{ Conditions: []metering.ReportCondition{ *meteringUtil.NewReportCondition(metering.ReportRunning, v1.ConditionFalse, meteringUtil.ReportFinishedReason, testReportMessage), }, LastReportTime: &metav1.Time{Time: reportStart.AddDate(0, 0, 0)}, }, schedule, false, nil), expectFinished: false, }, { name: "reportingEnd < lastReportTime returns true", report: testhelpers.NewReport(testReportName, testNamespace, testQueryName, reportStart, reportEnd, metering.ReportStatus{ Conditions: []metering.ReportCondition{ *meteringUtil.NewReportCondition(metering.ReportRunning, v1.ConditionFalse, meteringUtil.ReportFinishedReason, testReportMessage), }, LastReportTime: &metav1.Time{Time: reportStart.AddDate(0, 2, 0)}, }, schedule, false, nil), expectFinished: true, }, { name: "when status running is false and reason is Scheduled return false", report: testhelpers.NewReport(testReportName, testNamespace, testQueryName, reportStart, reportEnd, metering.ReportStatus{ Conditions: []metering.ReportCondition{ *meteringUtil.NewReportCondition(metering.ReportRunning, v1.ConditionFalse, meteringUtil.ScheduledReason, testReportMessage), }, }, schedule, false, nil), expectFinished: false, }, { name: "when status running is true and reason is Scheduled return false", report: testhelpers.NewReport(testReportName, testNamespace, testQueryName, reportStart, reportEnd, metering.ReportStatus{ Conditions: []metering.ReportCondition{ *meteringUtil.NewReportCondition(metering.ReportRunning, v1.ConditionTrue, meteringUtil.ScheduledReason, testReportMessage), }, }, schedule, false, nil), expectFinished: false, }, { name: "when status running is false and reason is InvalidReport return false", report: testhelpers.NewReport(testReportName, testNamespace, testQueryName, reportStart, reportEnd, metering.ReportStatus{ Conditions: []metering.ReportCondition{ *meteringUtil.NewReportCondition(metering.ReportRunning, v1.ConditionFalse, meteringUtil.InvalidReportReason, testReportMessage), }, }, schedule, false, nil), expectFinished: false, }, { name: "when status running is true and reason is InvalidReport return false", report: testhelpers.NewReport(testReportName, testNamespace, testQueryName, reportStart, reportEnd, metering.ReportStatus{ Conditions: []metering.ReportCondition{ *meteringUtil.NewReportCondition(metering.ReportRunning, v1.ConditionTrue, meteringUtil.InvalidReportReason, testReportMessage), }, }, schedule, false, nil), expectFinished: false, }, { name: "when status running is false and reason is RunImmediately return false", report: testhelpers.NewReport(testReportName, testNamespace, testQueryName, reportStart, reportEnd, metering.ReportStatus{ Conditions: []metering.ReportCondition{ *meteringUtil.NewReportCondition(metering.ReportRunning, v1.ConditionFalse, meteringUtil.RunImmediatelyReason, testReportMessage), }, }, schedule, false, nil), expectFinished: false, }, { name: "when status running is true and reason is RunImmediately return false", report: testhelpers.NewReport(testReportName, testNamespace, testQueryName, reportStart, reportEnd, metering.ReportStatus{ Conditions: []metering.ReportCondition{ *meteringUtil.NewReportCondition(metering.ReportRunning, v1.ConditionTrue, meteringUtil.RunImmediatelyReason, testReportMessage), }, }, schedule, false, nil), expectFinished: false, }, } for _, testCase := range testTable { var mockLogger = logrus.New() testCase := testCase t.Run(testCase.name, func(t *testing.T) { runningCond := isReportFinished(mockLogger, testCase.report) assert.Equalf(t, runningCond, testCase.expectFinished, "expected the report would return '%t', but got '%t'", testCase.expectFinished, runningCond) }) } }
explode_data.jsonl/8849
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 2003 }
[ 2830, 3393, 3872, 10361, 24890, 1155, 353, 8840, 836, 8, 341, 4777, 2399, 197, 18185, 22699, 257, 284, 330, 2258, 698, 197, 18185, 10361, 675, 262, 284, 330, 1944, 47411, 698, 197, 18185, 2859, 675, 257, 284, 330, 1944, 65489, 698, 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 TestSeries_Trim(t *testing.T) { // assert that function returns correctly trimmed series s := NewSeries("test", "foo ", " BAR", " BaZ ", "march") assert.Equal(t, NewSeries("TrimSpace(test)", "foo", "BAR", "BaZ", "march"), s.Trim()) }
explode_data.jsonl/54085
{ "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, 25544, 1139, 6283, 1155, 353, 8840, 836, 8, 341, 197, 322, 2060, 429, 729, 4675, 12440, 50981, 4013, 198, 1903, 1669, 1532, 25544, 445, 1944, 497, 330, 7975, 3670, 330, 44187, 497, 330, 220, 14322, 57, 220, 3670, 330, 76, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestDecodeWord(t *testing.T) { tests := []struct { src, exp string hasErr bool }{ {"=?UTF-8?Q?=C2=A1Hola,_se=C3=B1or!?=", "¡Hola, señor!", false}, {"=?UTF-8?Q?Fran=C3=A7ois-J=C3=A9r=C3=B4me?=", "François-Jérôme", false}, {"=?UTF-8?q?ascii?=", "ascii", false}, {"=?utf-8?B?QW5kcsOp?=", "André", false}, {"=?ISO-8859-1?Q?Rapha=EBl_Dupont?=", "Raphaël Dupont", false}, {"=?utf-8?b?IkFudG9uaW8gSm9zw6kiIDxqb3NlQGV4YW1wbGUub3JnPg==?=", `"Antonio José" <jose@example.org>`, false}, {"=?UTF-8?A?Test?=", "", true}, {"=?UTF-8?Q?A=B?=", "", true}, {"=?UTF-8?Q?=A?=", "", true}, {"=?UTF-8?A?A?=", "", true}, } for _, test := range tests { dec := new(WordDecoder) s, err := dec.Decode(test.src) if test.hasErr && err == nil { t.Errorf("Decode(%q) should return an error", test.src) continue } if !test.hasErr && err != nil { t.Errorf("Decode(%q): %v", test.src, err) continue } if s != test.exp { t.Errorf("Decode(%q) = %q, want %q", test.src, s, test.exp) } } }
explode_data.jsonl/36204
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 564 }
[ 2830, 3393, 32564, 10879, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 3056, 1235, 341, 197, 41144, 11, 1343, 914, 198, 197, 63255, 7747, 256, 1807, 198, 197, 59403, 197, 197, 4913, 19884, 8561, 12, 23, 30, 48, 59567, 34, 17, 46623, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestMVCCStatsDelDelCommitMovesTimestamp(t *testing.T) { defer leaktest.AfterTest(t)() defer log.Scope(t).Close(t) for _, engineImpl := range mvccEngineImpls { t.Run(engineImpl.name, func(t *testing.T) { engine := engineImpl.create() defer engine.Close() ctx := context.Background() aggMS := &enginepb.MVCCStats{} assertEq(t, engine, "initially", aggMS, &enginepb.MVCCStats{}) key := roachpb.Key("a") ts1 := hlc.Timestamp{WallTime: 1e9} ts2 := hlc.Timestamp{WallTime: 2e9} ts3 := hlc.Timestamp{WallTime: 3e9} // Write a non-transactional tombstone at t=1s. if err := MVCCDelete(ctx, engine, aggMS, key, ts1, nil /* txn */); err != nil { t.Fatal(err) } mKeySize := int64(mvccKey(key).EncodedSize()) require.EqualValues(t, mKeySize, 2) vKeySize := MVCCVersionTimestampSize require.EqualValues(t, vKeySize, 12) expMS := enginepb.MVCCStats{ LastUpdateNanos: 1e9, KeyBytes: mKeySize + vKeySize, KeyCount: 1, ValBytes: 0, ValCount: 1, } assertEq(t, engine, "after non-transactional delete", aggMS, &expMS) // Write an tombstone intent at t=2s. txn := &roachpb.Transaction{ TxnMeta: enginepb.TxnMeta{ID: uuid.MakeV4(), WriteTimestamp: ts2}, ReadTimestamp: ts2, } if err := MVCCDelete(ctx, engine, aggMS, key, txn.ReadTimestamp, txn); err != nil { t.Fatal(err) } mValSize := int64((&enginepb.MVCCMetadata{ Timestamp: hlc.LegacyTimestamp(ts1), Deleted: true, Txn: &txn.TxnMeta, }).Size()) require.EqualValues(t, mValSize, 46) expMS = enginepb.MVCCStats{ LastUpdateNanos: 2e9, KeyBytes: mKeySize + 2*vKeySize, // 2+2*12 = 26 KeyCount: 1, ValBytes: mValSize, // 44 ValCount: 2, IntentCount: 1, IntentBytes: vKeySize, // TBD // The original non-transactional write (at 1s) has now aged one second. GCBytesAge: 1 * vKeySize, } assertEq(t, engine, "after put", aggMS, &expMS) // Now commit or abort the intent, respectively, but with a timestamp gap // (i.e. this is a push-commit as it would happen for a SNAPSHOT txn). t.Run("Commit", func(t *testing.T) { aggMS := *aggMS engine := engine.NewBatch() defer engine.Close() txnCommit := txn.Clone() txnCommit.Status = roachpb.COMMITTED txnCommit.WriteTimestamp.Forward(ts3) if _, err := MVCCResolveWriteIntent(ctx, engine, &aggMS, roachpb.MakeLockUpdate(txnCommit, roachpb.Span{Key: key}), ); err != nil { t.Fatal(err) } expAggMS := enginepb.MVCCStats{ LastUpdateNanos: 3e9, KeyBytes: mKeySize + 2*vKeySize, // 2+2*12 = 26 KeyCount: 1, ValBytes: 0, ValCount: 2, IntentCount: 0, IntentBytes: 0, // The very first write picks up another second of age. Before a bug fix, // this was failing to do so. GCBytesAge: 2 * vKeySize, } assertEq(t, engine, "after committing", &aggMS, &expAggMS) }) t.Run("Abort", func(t *testing.T) { aggMS := *aggMS engine := engine.NewBatch() defer engine.Close() txnAbort := txn.Clone() txnAbort.Status = roachpb.ABORTED txnAbort.WriteTimestamp.Forward(ts3) if _, err := MVCCResolveWriteIntent(ctx, engine, &aggMS, roachpb.MakeLockUpdate(txnAbort, roachpb.Span{Key: key}), ); err != nil { t.Fatal(err) } expAggMS := enginepb.MVCCStats{ LastUpdateNanos: 3e9, KeyBytes: mKeySize + vKeySize, // 2+12 = 14 KeyCount: 1, ValBytes: 0, ValCount: 1, IntentCount: 0, IntentBytes: 0, // We aborted our intent, but the value we first wrote was a tombstone, and // so it's expected to retain its age. Since it's now the only value, it // also contributes as a meta key. GCBytesAge: 2 * (mKeySize + vKeySize), } assertEq(t, engine, "after aborting", &aggMS, &expAggMS) }) }) } }
explode_data.jsonl/70079
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1926 }
[ 2830, 3393, 66626, 3706, 16635, 16532, 16532, 33441, 45789, 20812, 1155, 353, 8840, 836, 8, 341, 16867, 23352, 1944, 36892, 2271, 1155, 8, 741, 16867, 1487, 77940, 1155, 568, 7925, 1155, 340, 2023, 8358, 4712, 9673, 1669, 2088, 23164, 638...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestStoreDDBError(t *testing.T) { ddbMock := &mockDynamoDB{} ddbClient = ddbMock ddbMock.On("PutItem", mock.Anything).Return(&dynamodb.PutItemOutput{}, errors.New("error")) assert.Error(t, Store(testAlertDedupEvent)) }
explode_data.jsonl/39034
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 93 }
[ 2830, 3393, 6093, 35, 3506, 1454, 1155, 353, 8840, 836, 8, 341, 197, 89723, 11571, 1669, 609, 16712, 35, 85608, 3506, 16094, 197, 89723, 2959, 284, 294, 1999, 11571, 271, 197, 89723, 11571, 8071, 445, 19103, 1234, 497, 7860, 13311, 1596...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestEditor_Read(t *testing.T) { s := "hello world" buf := make([]byte, len(s)) e := new(Editor) e.SetText(s) _, err := e.Seek(0, io.SeekStart) if err != nil { t.Error(err) } n, err := io.ReadFull(e, buf) if err != nil { t.Error(err) } if got, want := n, len(s); got != want { t.Errorf("got %d; want %d", got, want) } if got, want := string(buf), s; got != want { t.Errorf("got %q; want %q", got, want) } }
explode_data.jsonl/27270
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 205 }
[ 2830, 3393, 9410, 38381, 1155, 353, 8840, 836, 8, 341, 1903, 1669, 330, 14990, 1879, 698, 26398, 1669, 1281, 10556, 3782, 11, 2422, 1141, 1171, 7727, 1669, 501, 87136, 340, 7727, 92259, 1141, 692, 197, 6878, 1848, 1669, 384, 76465, 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...
5
func TestEdgeutilInterpolateAntipodal(t *testing.T) { p1 := PointFromCoords(0.1, 1e-30, 0.3) // Test that interpolation on a 180 degree edge (antipodal endpoints) yields // a result with the correct distance from each endpoint. for dist := 0.0; dist <= 1.0; dist += 0.125 { actual := Interpolate(dist, p1, Point{p1.Mul(-1)}) if !float64Near(actual.Distance(p1).Radians(), dist*math.Pi, 3e-15) { t.Errorf("antipodal points Interpolate(%v, %v, %v) = %v, want %v", dist, p1, Point{p1.Mul(-1)}, actual, dist*math.Pi) } } }
explode_data.jsonl/74790
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 221 }
[ 2830, 3393, 11656, 1314, 3306, 45429, 17117, 573, 57597, 1155, 353, 8840, 836, 8, 341, 3223, 16, 1669, 5126, 3830, 34344, 7, 15, 13, 16, 11, 220, 16, 68, 12, 18, 15, 11, 220, 15, 13, 18, 692, 197, 322, 3393, 429, 36487, 389, 264...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestSetNonce(t *testing.T) { ms, _ := create() var addr common.Address ms.SetNonce(addr, 10) if ms.GetNonce(addr) != 10 { t.Error("Expected nonce of 10, got", ms.GetNonce(addr)) } addr[0] = 1 ms.StateDB.SetNonce(addr, 1) if ms.GetNonce(addr) != 1 { t.Error("Expected nonce of 1, got", ms.GetNonce(addr)) } }
explode_data.jsonl/57787
{ "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, 1649, 90528, 1155, 353, 8840, 836, 8, 341, 47691, 11, 716, 1669, 1855, 2822, 2405, 10789, 4185, 26979, 198, 47691, 4202, 90528, 24497, 11, 220, 16, 15, 692, 743, 9829, 2234, 90528, 24497, 8, 961, 220, 16, 15, 341, 197, 3...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestStringFlagSet(t *testing.T) { sv := new(StringFlag) err := sv.Set("foo") if err != nil { t.Fatalf("err: %s", err) } err = sv.Set("bar") if err != nil { t.Fatalf("err: %s", err) } expected := []string{"foo", "bar"} if !reflect.DeepEqual([]string(*sv), expected) { t.Fatalf("Bad: %#v", sv) } }
explode_data.jsonl/6642
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 143 }
[ 2830, 3393, 703, 12135, 1649, 1155, 353, 8840, 836, 8, 341, 1903, 85, 1669, 501, 2242, 12135, 340, 9859, 1669, 13559, 4202, 445, 7975, 1138, 743, 1848, 961, 2092, 341, 197, 3244, 30762, 445, 615, 25, 1018, 82, 497, 1848, 340, 197, 6...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
4
func TestPrintStreamInfo(t *testing.T) { var buf bytes.Buffer c := New() c.Verbose = true c.out = &buf fakeStreamName := "fake-stream-name" fakeStreamCreationTimestamp := time.Now() fakeEncryptionType := "fake-encryption-type" fakeRetentionPeriodHours := int64(336) fakeEndingSeqNum := "fake-ending-sequence-number" c.printStreamInfo(&kinesis.DescribeStreamOutput{ StreamDescription: &kinesis.StreamDescription{ StreamName: &fakeStreamName, StreamCreationTimestamp: &fakeStreamCreationTimestamp, EncryptionType: &fakeEncryptionType, RetentionPeriodHours: &fakeRetentionPeriodHours, Shards: []*kinesis.Shard{ // 2 active shards &kinesis.Shard{ SequenceNumberRange: &kinesis.SequenceNumberRange{}, }, &kinesis.Shard{ SequenceNumberRange: &kinesis.SequenceNumberRange{}, }, // 1 closed shard &kinesis.Shard{ SequenceNumberRange: &kinesis.SequenceNumberRange{ EndingSequenceNumber: &fakeEndingSeqNum, }, }, }, }, }) out := buf.String() assert.Regexp(t, "Stream name:.+"+fakeStreamName, out) assert.Regexp(t, "Created at:.+"+fakeStreamCreationTimestamp.Format(time.RFC1123), out) assert.Regexp(t, "Encryption:.+"+fakeEncryptionType, out) assert.Regexp(t, "Retention:.+336.+hours", out) assert.Regexp(t, "Active:.+2.+shards", out) assert.Regexp(t, "Closed:.+1.+shards", out) }
explode_data.jsonl/57241
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 595 }
[ 2830, 3393, 8994, 3027, 1731, 1155, 353, 8840, 836, 8, 341, 2405, 6607, 5820, 22622, 198, 1444, 1669, 1532, 741, 1444, 42505, 8297, 284, 830, 198, 1444, 2532, 284, 609, 5909, 271, 1166, 726, 3027, 675, 1669, 330, 30570, 38723, 11494, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestAddition(t *testing.T) { tev, fl := initialize(t) defer tev.tearDown() prevHash := fl.lastHash fl.Append(ledger.CreateNextBlock(fl, []*cb.Envelope{&cb.Envelope{Payload: []byte("My Data")}})) assert.Equal(t, uint64(2), fl.height, "Block height should be 2") block, found := fl.readBlock(1) assert.NotNil(t, block, "Error retrieving genesis block") assert.True(t, found, "Error retrieving genesis block") assert.Equal(t, prevHash, block.Header.PreviousHash, "Block hashes did no match") }
explode_data.jsonl/35028
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 185 }
[ 2830, 3393, 2212, 680, 1155, 353, 8840, 836, 8, 341, 197, 665, 85, 11, 1320, 1669, 9468, 1155, 340, 16867, 1013, 85, 31853, 59342, 741, 50728, 6370, 1669, 1320, 9110, 6370, 198, 1166, 75, 8982, 7, 50704, 7251, 5847, 4713, 49747, 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 TestIntegLogMetricDeployment_Deploy(t *testing.T) { var err error var creds *google.Credentials var core deploy.Core core.SolutionSettings.Hosting.ProjectID, creds = itst.GetIntegrationTestsProjectID() core.Ctx = context.Background() core.Services.LoggingService, err = logging.NewService(core.Ctx, option.WithCredentials(creds)) if err != nil { log.Fatalln(err) } projectsMetricsService = logging.NewProjectsMetricsService(core.Services.LoggingService) // Clean up gefore testing removeTestLogMetrics(core) testCases := []struct { name string metricPath string }{ { name: "Step1_CreateLogMetric", metricPath: "testdata/test_metric_1.yaml", }, { name: "Step2_UpdateLogMetric", }, { name: "Step3_LogMetricIdUptodate", }, } for _, tc := range testCases { t.Run(tc.name, func(t *testing.T) { logMetricDeployment := NewLogMetricDeployment() logMetricDeployment.Core = &core err := ffo.ReadUnmarshalYAML(tc.metricPath, &logMetricDeployment.Settings.Instance.GLO) if err != nil { log.Fatalln(err) } // logMetricDeployment.Settings.Instance.MON.Columns = tc.columns // logMetricDeployment.Artifacts.Widgets = []*monitoring.Widget{} // for _, microserviceName := range tc.microserviceNameList { // for _, widgetType := range tc.widgetTypeList { // widget, err := GetGCFWidget(microserviceName, widgetType) // if err != nil { // t.Fatalf("mon.GetGCFWidget %v", err) // } // logMetricDeployment.Artifacts.Widgets = append(logMetricDeployment.Artifacts.Widgets, &widget) // } // } // var buffer bytes.Buffer // log.SetOutput(&buffer) // defer func() { // log.SetOutput(os.Stderr) // }() // err := logMetricDeployment.Deploy() // msgString := buffer.String() // if err != nil { // t.Fatalf("logMetricDeployment.Deploy %v", err) // } // if strings.Contains(msgString, tc.wantMsgContains) { // t.Logf("OK got msg '%s'", msgString) // } else { // t.Errorf("want msg to contains '%s' and got \n'%s'", tc.wantMsgContains, msgString) // } }) } // Clean up after testing removeTestLogMetrics(core) }
explode_data.jsonl/58789
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 898 }
[ 2830, 3393, 1072, 791, 2201, 54310, 75286, 90680, 1989, 1155, 353, 8840, 836, 8, 341, 2405, 1848, 1465, 198, 2405, 73177, 353, 17485, 727, 15735, 198, 2405, 6200, 10517, 12777, 198, 71882, 808, 3214, 6086, 54097, 30944, 915, 11, 73177, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestRoutingHandlerPagination(t *testing.T) { dc, _ := testdataclient.NewDoc(` route1: CustomPredicate("custom1") -> "https://route1.example.org"; route2: CustomPredicate("custom2") -> "https://route2.example.org"; catchAll: * -> "https://route.example.org" `) cps := []routing.PredicateSpec{&predicate{}, &predicate{}} tr, _ := newTestRoutingWithPredicates(cps, dc) defer tr.close() mux := http.NewServeMux() mux.Handle("/", tr.routing) server := httptest.NewServer(mux) defer server.Close() tests := []struct { offset int limit int nroutes int }{ {0, 0, 0}, {0, 1, 1}, {10, 10, 0}, {0, 10, 3}, {0, 3, 3}, {1, 3, 2}, } for _, ti := range tests { u := fmt.Sprintf("%s?offset=%d&limit=%d", server.URL, ti.offset, ti.limit) req, _ := http.NewRequest("GET", u, nil) req.Header.Set("accept", "application/json") resp, _ := http.DefaultClient.Do(req) if resp.Header.Get("X-Count") != "3" { t.Error("invalid or missing route count header") } var routes []*eskip.Route if err := json.NewDecoder(resp.Body).Decode(&routes); err != nil { t.Errorf("failed to encode the response body: %v", err) } if got, want := len(routes), ti.nroutes; got != want { t.Errorf("number of routes = %v, want %v", got, want) } } }
explode_data.jsonl/58585
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 547 }
[ 2830, 3393, 24701, 3050, 44265, 1155, 353, 8840, 836, 8, 341, 87249, 11, 716, 1669, 1273, 691, 2972, 7121, 9550, 61528, 197, 7000, 2133, 16, 25, 8406, 36329, 445, 9163, 16, 899, 1464, 330, 2428, 1110, 8966, 16, 7724, 2659, 876, 197, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
5
func TestValidateSupplyChainItem(t *testing.T) { cases := map[string]struct { Arg SupplyChainItem Expected string }{ "empty name": {SupplyChainItem{Name: ""}, "name cannot be empty"}, "material rule": { SupplyChainItem{ Name: "test", ExpectedMaterials: [][]string{{"invalid"}}}, "invalid material rule"}, "product rule": { SupplyChainItem{ Name: "test", ExpectedProducts: [][]string{{"invalid"}}}, "invalid product rule"}, } for name, tc := range cases { err := validateSupplyChainItem(tc.Arg) if err == nil || !strings.Contains(err.Error(), tc.Expected) { t.Errorf("%s: '%s' not in '%s'", name, tc.Expected, err) } } }
explode_data.jsonl/51768
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 302 }
[ 2830, 3393, 17926, 51296, 18837, 1234, 1155, 353, 8840, 836, 8, 341, 1444, 2264, 1669, 2415, 14032, 60, 1235, 341, 197, 197, 2735, 414, 29809, 18837, 1234, 198, 197, 197, 18896, 914, 198, 197, 59403, 197, 197, 1, 3194, 829, 788, 314, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestRFC1034Label(t *testing.T) { tests := []struct { in, want string }{ {"a", "a"}, {"123", "-23"}, {"a.b.c", "a-b-c"}, {"a-b", "a-b"}, {"a:b", "a-b"}, {"a?b", "a-b"}, {"αβγ", "---"}, {"💩", "--"}, {"My App", "My-App"}, {"...", ""}, {".-.", "--"}, } for _, tc := range tests { if got := rfc1034Label(tc.in); got != tc.want { t.Errorf("rfc1034Label(%q) = %q, want %q", tc.in, got, tc.want) } } }
explode_data.jsonl/17101
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 237 }
[ 2830, 3393, 64371, 16, 15, 18, 19, 2476, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 3056, 1235, 341, 197, 17430, 11, 1366, 914, 198, 197, 59403, 197, 197, 4913, 64, 497, 330, 64, 7115, 197, 197, 4913, 16, 17, 18, 497, 6523, 17, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func Test_metricsForwarder_processReconcileError(t *testing.T) { nsn := types.NamespacedName{ Namespace: "foo", Name: "bar", } mf := &metricsForwarder{ namespacedName: nsn, } mf.initGlobalTags() tests := []struct { name string loadFunc func() (*metricsForwarder, *fakeMetricsForwarder) err error wantErr bool wantFunc func(*fakeMetricsForwarder) error }{ { name: "last error init value, new unknown error => send unsucess metric", loadFunc: func() (*metricsForwarder, *fakeMetricsForwarder) { f := &fakeMetricsForwarder{} f.On("delegatedSendReconcileMetric", 0.0, []string{"cr_namespace:foo", "cr_name:bar", "reconcile_err:err_msg"}).Once() mf.delegator = f mf.lastReconcileErr = errInitValue return mf, f }, err: errors.New("err_msg"), wantErr: false, wantFunc: func(f *fakeMetricsForwarder) error { f.AssertExpectations(t) return nil }, }, { name: "last error init value, new auth error => send unsucess metric", loadFunc: func() (*metricsForwarder, *fakeMetricsForwarder) { f := &fakeMetricsForwarder{} f.On("delegatedSendReconcileMetric", 0.0, []string{"cr_namespace:foo", "cr_name:bar", "reconcile_err:Unauthorized"}).Once() mf.delegator = f mf.lastReconcileErr = errInitValue return mf, f }, err: apierrors.NewUnauthorized("Auth error"), wantErr: false, wantFunc: func(f *fakeMetricsForwarder) error { f.AssertExpectations(t) return nil }, }, { name: "last error init value, new error is nil => send success metric", loadFunc: func() (*metricsForwarder, *fakeMetricsForwarder) { f := &fakeMetricsForwarder{} f.On("delegatedSendReconcileMetric", 1.0, []string{"cr_namespace:foo", "cr_name:bar", "reconcile_err:null"}).Once() mf.delegator = f mf.lastReconcileErr = errInitValue return mf, f }, err: nil, wantErr: false, wantFunc: func(f *fakeMetricsForwarder) error { f.AssertExpectations(t) return nil }, }, { name: "last error nil, new error is nil => don't send metric", loadFunc: func() (*metricsForwarder, *fakeMetricsForwarder) { f := &fakeMetricsForwarder{} mf.delegator = f mf.lastReconcileErr = nil return mf, f }, err: nil, wantErr: false, wantFunc: func(f *fakeMetricsForwarder) error { if !f.AssertNumberOfCalls(t, "delegatedSendReconcileMetric", 0) { return errors.New("Wrong number of calls") } f.AssertExpectations(t) return nil }, }, { name: "last error not nil and not init value, new error equals last error => don't send metric", loadFunc: func() (*metricsForwarder, *fakeMetricsForwarder) { f := &fakeMetricsForwarder{} mf.delegator = f mf.lastReconcileErr = apierrors.NewUnauthorized("Auth error") return mf, f }, err: apierrors.NewUnauthorized("Auth error"), wantErr: false, wantFunc: func(f *fakeMetricsForwarder) error { if !f.AssertNumberOfCalls(t, "delegatedSendReconcileMetric", 0) { return errors.New("Wrong number of calls") } f.AssertExpectations(t) return nil }, }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { dd, f := tt.loadFunc() if err := dd.processReconcileError(tt.err); (err != nil) != tt.wantErr { t.Errorf("metricsForwarder.processReconcileError() error = %v, wantErr %v", err, tt.wantErr) } if err := tt.wantFunc(f); err != nil { t.Errorf("metricsForwarder.processReconcileError() wantFunc validation error: %v", err) } }) } }
explode_data.jsonl/8873
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1601 }
[ 2830, 3393, 37686, 25925, 261, 11305, 693, 40446, 457, 1454, 1155, 353, 8840, 836, 8, 341, 84041, 77, 1669, 4494, 98932, 68552, 675, 515, 197, 90823, 25, 330, 7975, 756, 197, 21297, 25, 414, 330, 2257, 756, 197, 532, 2109, 69, 1669, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestParsesATextOnlyTemplate(t *testing.T) { template, _ := ParseString("it's over 9000", nil) assert.Equal(t, len(template.Code), 1) assertLiteral(t, template, 0, "it's over 9000") }
explode_data.jsonl/42406
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 72 }
[ 2830, 3393, 47, 1561, 288, 828, 427, 7308, 7275, 1155, 353, 8840, 836, 8, 341, 22832, 11, 716, 1669, 14775, 703, 445, 275, 594, 916, 220, 24, 15, 15, 15, 497, 2092, 340, 6948, 12808, 1155, 11, 2422, 29963, 20274, 701, 220, 16, 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 TestOrdersAdd(t *testing.T) { OrdersSetup(t) err := Bot.OrderManager.orderStore.Add(&order.Detail{ Exchange: testExchange, ID: "TestOrdersAdd", }) if err != nil { t.Error(err) } err = Bot.OrderManager.orderStore.Add(&order.Detail{ Exchange: "testTest", ID: "TestOrdersAdd", }) if err == nil { t.Error("Expected error from non existent exchange") } err = Bot.OrderManager.orderStore.Add(nil) if err == nil { t.Error("Expected error from nil order") } err = Bot.OrderManager.orderStore.Add(&order.Detail{ Exchange: testExchange, ID: "TestOrdersAdd", }) if err == nil { t.Error("Expected error re-adding order") } }
explode_data.jsonl/22035
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 280 }
[ 2830, 3393, 24898, 2212, 1155, 353, 8840, 836, 8, 341, 197, 24898, 21821, 1155, 340, 9859, 1669, 23007, 19664, 2043, 14041, 6093, 1904, 2099, 1358, 74396, 515, 197, 197, 31564, 25, 1273, 31564, 345, 197, 29580, 25, 981, 330, 2271, 24898...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestDuplicateFields(t *testing.T) { testCases := []struct { desc string fields FieldList errMsg string // Non-empty if we expect an error }{ { desc: "multi string", fields: FieldList{{Name: "FieldA", Value: "val1"}, {Name: "FieldA", Value: "val2"}, {Name: "FieldA", Value: "val3"}}, }, { desc: "multi atom", fields: FieldList{{Name: "FieldA", Value: Atom("val1")}, {Name: "FieldA", Value: Atom("val2")}, {Name: "FieldA", Value: Atom("val3")}}, }, { desc: "mixed", fields: FieldList{{Name: "FieldA", Value: testString}, {Name: "FieldA", Value: testTime}, {Name: "FieldA", Value: float}}, }, { desc: "multi time", fields: FieldList{{Name: "FieldA", Value: testTime}, {Name: "FieldA", Value: testTime}}, errMsg: `duplicate time field "FieldA"`, }, { desc: "multi num", fields: FieldList{{Name: "FieldA", Value: float}, {Name: "FieldA", Value: float}}, errMsg: `duplicate numeric field "FieldA"`, }, } for _, tc := range testCases { _, err := saveDoc(&tc.fields) if (err == nil) != (tc.errMsg == "") || (err != nil && !strings.Contains(err.Error(), tc.errMsg)) { t.Errorf("%s: got err %v, wanted %q", tc.desc, err, tc.errMsg) } } }
explode_data.jsonl/27956
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 511 }
[ 2830, 3393, 53979, 8941, 1155, 353, 8840, 836, 8, 341, 18185, 37302, 1669, 3056, 1235, 341, 197, 41653, 256, 914, 198, 197, 55276, 8601, 852, 198, 197, 9859, 6611, 914, 442, 11581, 39433, 421, 582, 1720, 458, 1465, 198, 197, 59403, 19...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
5
func TestTransportPersistConnContextLeakMaxConnsPerHost(t *testing.T) { defer afterTest(t) ts := httptest.NewServer(HandlerFunc(func(w ResponseWriter, r *Request) { runtime.Gosched() w.WriteHeader(StatusOK) })) defer ts.Close() c := ts.Client() c.Transport.(*Transport).MaxConnsPerHost = 1 ctx := context.Background() body := []byte("Hello") doPosts := func(cc *contextCounter) { var wg sync.WaitGroup for n := 64; n > 0; n-- { wg.Add(1) go func() { defer wg.Done() ctx := cc.Track(ctx) req, err := NewRequest("POST", ts.URL, bytes.NewReader(body)) if err != nil { t.Error(err) } _, err = c.Do(req.WithContext(ctx)) if err != nil { t.Errorf("Do failed with error: %v", err) } }() } wg.Wait() } var initialCC contextCounter doPosts(&initialCC) // flushCC exists only to put pressure on the GC to finalize the initialCC // contexts: the flushCC allocations should eventually displace the initialCC // allocations. var flushCC contextCounter for i := 0; ; i++ { live := initialCC.Read() if live == 0 { break } if i >= 100 { t.Fatalf("%d Contexts still not finalized after %d GC cycles.", live, i) } doPosts(&flushCC) runtime.GC() } }
explode_data.jsonl/14097
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 505 }
[ 2830, 3393, 27560, 61267, 9701, 1972, 2304, 585, 5974, 1109, 4412, 3889, 9296, 1155, 353, 8840, 836, 8, 341, 16867, 1283, 2271, 1155, 692, 57441, 1669, 54320, 70334, 7121, 5475, 7, 3050, 9626, 18552, 3622, 5949, 6492, 11, 435, 353, 1900...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestResourceMetricsSlice_RemoveIf(t *testing.T) { // Test RemoveIf on empty slice emptySlice := NewResourceMetricsSlice() emptySlice.RemoveIf(func(el ResourceMetrics) bool { t.Fail() return false }) // Test RemoveIf filtered := generateTestResourceMetricsSlice() pos := 0 filtered.RemoveIf(func(el ResourceMetrics) bool { pos++ return pos%3 == 0 }) assert.Equal(t, 5, filtered.Len()) }
explode_data.jsonl/32668
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 148 }
[ 2830, 3393, 4783, 27328, 33236, 66843, 2679, 1155, 353, 8840, 836, 8, 341, 197, 322, 3393, 10783, 2679, 389, 4287, 15983, 198, 197, 3194, 33236, 1669, 1532, 4783, 27328, 33236, 741, 197, 3194, 33236, 13270, 2679, 18552, 18584, 11765, 2732...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_GetAdd_Consistency(t *testing.T) { rand.Seed(time.Now().UnixNano()) var expects []int for i := 0; i < 100000; i++ { expects = append(expects, rand.Intn(100000000)) } encoder := NewFixedOffsetEncoder() encoder.FromValues(expects) decoder := NewFixedOffsetDecoder(encoder.MarshalBinary()) for i := 0; i < 100000; i++ { value, ok := decoder.Get(i) assert.Equal(t, expects[i], value) assert.True(t, ok) } }
explode_data.jsonl/13584
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 177 }
[ 2830, 3393, 13614, 2212, 920, 2382, 47094, 1155, 353, 8840, 836, 8, 341, 7000, 437, 5732, 291, 9730, 13244, 1005, 55832, 83819, 2398, 2405, 24297, 3056, 396, 198, 2023, 600, 1669, 220, 15, 26, 600, 366, 220, 16, 15, 15, 15, 15, 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 TestStartServerTLSVersion(t *testing.T) { s, err := NewServer() require.NoError(t, err) testDir, _ := fileutils.FindDir("tests") s.UpdateConfig(func(cfg *model.Config) { *cfg.ServiceSettings.ListenAddress = ":0" *cfg.ServiceSettings.ConnectionSecurity = "TLS" *cfg.ServiceSettings.TLSMinVer = "1.2" *cfg.ServiceSettings.TLSKeyFile = path.Join(testDir, "tls_test_key.pem") *cfg.ServiceSettings.TLSCertFile = path.Join(testDir, "tls_test_cert.pem") }) serverErr := s.Start() tr := &http.Transport{ TLSClientConfig: &tls.Config{ InsecureSkipVerify: true, MaxVersion: tls.VersionTLS11, }, } client := &http.Client{Transport: tr} err = checkEndpoint(t, client, "https://localhost:"+strconv.Itoa(s.ListenAddr.Port)+"/", http.StatusNotFound) if !strings.Contains(err.Error(), "remote error: tls: protocol version not supported") { t.Errorf("Expected protocol version error, got %s", err) } client.Transport = &http.Transport{ TLSClientConfig: &tls.Config{ InsecureSkipVerify: true, }, } err = checkEndpoint(t, client, "https://localhost:"+strconv.Itoa(s.ListenAddr.Port)+"/", http.StatusNotFound) if err != nil { t.Errorf("Expected nil, got %s", err) } s.Shutdown() require.NoError(t, serverErr) }
explode_data.jsonl/47830
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 501 }
[ 2830, 3393, 3479, 5475, 45439, 5637, 1155, 353, 8840, 836, 8, 341, 1903, 11, 1848, 1669, 1532, 5475, 741, 17957, 35699, 1155, 11, 1848, 692, 18185, 6184, 11, 716, 1669, 1034, 6031, 9998, 6184, 445, 23841, 1138, 1903, 16689, 2648, 18552,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_builder_RESTConfig(t *testing.T) { cases := []struct { name string overrideURL string overrideActive bool usePrimary bool useSecondary bool expectedHost string }{ { name: "no override", expectedHost: apiURL, }, { name: "no override, use primary", usePrimary: true, expectedHost: apiURL, }, { name: "no override, use secondary", useSecondary: true, expectedHost: apiURL, }, { name: "override inactive", overrideURL: "url-override", expectedHost: apiURL, }, { name: "override inactive, use primary", overrideURL: "url-override", usePrimary: true, expectedHost: "url-override", }, { name: "override inactive, use secondary", overrideURL: "url-override", useSecondary: true, expectedHost: apiURL, }, { name: "override active", overrideURL: "url-override", overrideActive: true, expectedHost: "url-override", }, { name: "override active, use primary", overrideURL: "url-override", overrideActive: true, usePrimary: true, expectedHost: "url-override", }, { name: "override active, use secondary", overrideURL: "url-override", overrideActive: true, useSecondary: true, expectedHost: apiURL, }, } for _, tc := range cases { t.Run(tc.name, func(t *testing.T) { cd := testClusterDeployment() setAPIURLOverride(cd, tc.overrideURL) if tc.overrideActive { setOverrideActive(cd) } kubeconfigSecret := testKubeconfigSecret(t) c := fakeClient(cd, kubeconfigSecret) builder := NewBuilder(c, cd, "test-controller-name") switch { case tc.usePrimary: builder.UsePrimaryAPIURL() case tc.useSecondary: builder.UseSecondaryAPIURL() } cfg, err := builder.RESTConfig() assert.NoError(t, err, "unexpected error getting REST config") assert.Equal(t, tc.expectedHost, cfg.Host, "unexpected host") }) } }
explode_data.jsonl/35044
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 922 }
[ 2830, 3393, 28532, 55133, 2648, 1155, 353, 8840, 836, 8, 341, 1444, 2264, 1669, 3056, 1235, 341, 197, 11609, 1843, 914, 198, 197, 50284, 3144, 262, 914, 198, 197, 50284, 5728, 1807, 198, 197, 41819, 15972, 257, 1807, 198, 197, 41819, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestInterpreterPartition(t *testing.T) { s, err := parseFile("src/parse/asp/test_data/interpreter/partition.build") assert.NoError(t, err) assert.EqualValues(t, "27", s.Lookup("major")) assert.EqualValues(t, ".0.", s.Lookup("mid")) assert.EqualValues(t, "3", s.Lookup("minor")) assert.EqualValues(t, "begin ", s.Lookup("start")) assert.EqualValues(t, "sep", s.Lookup("sep")) assert.EqualValues(t, " end", s.Lookup("end")) }
explode_data.jsonl/81078
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 179 }
[ 2830, 3393, 58426, 49978, 1155, 353, 8840, 836, 8, 341, 1903, 11, 1848, 1669, 4715, 1703, 445, 3548, 14, 6400, 14, 13367, 12697, 1769, 14, 90554, 48981, 680, 13239, 1138, 6948, 35699, 1155, 11, 1848, 340, 6948, 12808, 6227, 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 TestNewControllerForAllInOneAsDefault(t *testing.T) { jaeger := v1.NewJaeger(types.NamespacedName{Name: "my-instance"}) ctrl := For(context.TODO(), jaeger) assert.Equal(t, ctrl.Type(), v1.DeploymentStrategyAllInOne) }
explode_data.jsonl/21841
{ "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, 3564, 2051, 2461, 2403, 641, 3966, 2121, 3675, 1155, 353, 8840, 836, 8, 341, 197, 5580, 1878, 1669, 348, 16, 7121, 52445, 1878, 52613, 98932, 68552, 675, 63121, 25, 330, 2408, 73655, 1, 8824, 84381, 1669, 1752, 5378, 90988, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestCache_concurrent(t *testing.T) { testCache := &cache{} hosts := map[string]string{ dns.Fqdn("yandex.com"): "213.180.204.62", dns.Fqdn("google.com"): "8.8.8.8", dns.Fqdn("www.google.com"): "8.8.4.4", dns.Fqdn("youtube.com"): "173.194.221.198", dns.Fqdn("car.ru"): "37.220.161.35", dns.Fqdn("cat.ru"): "192.56.231.67", } g := &sync.WaitGroup{} g.Add(len(hosts)) for k, v := range hosts { go setAndGetCache(t, testCache, g, k, v) } g.Wait() }
explode_data.jsonl/18908
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 275 }
[ 2830, 3393, 8233, 3382, 3231, 1155, 353, 8840, 836, 8, 341, 18185, 8233, 1669, 609, 9360, 31483, 197, 44692, 1669, 2415, 14032, 30953, 515, 197, 2698, 4412, 991, 80, 17395, 445, 88, 44526, 905, 37051, 257, 330, 17, 16, 18, 13, 16, 2...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestDialWithBlockErrorOnNonTemporaryErrorDialer(t *testing.T) { ctx, _ := context.WithTimeout(context.Background(), 100*time.Millisecond) if _, err := DialContext(ctx, "", WithInsecure(), WithDialer(nonTemporaryErrorDialer), WithBlock(), FailOnNonTempDialError(true)); err != nonTemporaryError { t.Fatalf("Dial(%q) = %v, want %v", "", err, nonTemporaryError) } // Without FailOnNonTempDialError, gRPC will retry to connect, and dial should exit with time out error. if _, err := DialContext(ctx, "", WithInsecure(), WithDialer(nonTemporaryErrorDialer), WithBlock()); err != context.DeadlineExceeded { t.Fatalf("Dial(%q) = %v, want %v", "", err, context.DeadlineExceeded) } }
explode_data.jsonl/6668
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 234 }
[ 2830, 3393, 35, 530, 2354, 4713, 1454, 1925, 8121, 59362, 1454, 35, 530, 261, 1155, 353, 8840, 836, 8, 341, 20985, 11, 716, 1669, 2266, 26124, 7636, 5378, 19047, 1507, 220, 16, 15, 15, 77053, 71482, 340, 743, 8358, 1848, 1669, 66155, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestNewFsSource(t *testing.T) { fsys := os.DirFS("test") source, err := NewFsSource(fsys, "sample-migrations") if err != nil { t.Fatalf("unable to setup source: %v", err) } defer source.Close() }
explode_data.jsonl/81877
{ "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, 3564, 48300, 3608, 1155, 353, 8840, 836, 8, 341, 1166, 7791, 1669, 2643, 83757, 8485, 445, 1944, 1138, 47418, 11, 1848, 1669, 1532, 48300, 3608, 955, 7791, 11, 330, 13611, 1448, 17824, 1138, 743, 1848, 961, 2092, 341, 197, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
2
func TestDecimalDiv(t *testing.T) { store, clean := testkit.CreateMockStore(t) defer clean() tk := testkit.NewTestKit(t, store) tk.MustQuery("select cast(1 as decimal(60,30)) / cast(1 as decimal(60,30)) / cast(1 as decimal(60, 30))").Check(testkit.Rows("1.000000000000000000000000000000")) tk.MustQuery("select cast(1 as decimal(60,30)) / cast(3 as decimal(60,30)) / cast(7 as decimal(60, 30))").Check(testkit.Rows("0.047619047619047619047619047619")) tk.MustQuery("select cast(1 as decimal(60,30)) / cast(3 as decimal(60,30)) / cast(7 as decimal(60, 30)) / cast(13 as decimal(60, 30))").Check(testkit.Rows("0.003663003663003663003663003663")) }
explode_data.jsonl/65469
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 248 }
[ 2830, 3393, 11269, 12509, 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, 50463, 2859, 445, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestPlayerAlive(t *testing.T) { pl := newPlayer(0) pl.Entity = entityWithProperty("m_iHealth", st.PropertyValue{IntVal: 100}) assert.Equal(t, true, pl.IsAlive(), "Should be alive") pl.Entity = entityWithProperty("m_iHealth", st.PropertyValue{IntVal: 1}) assert.Equal(t, true, pl.IsAlive(), "Should be alive") pl.Entity = entityWithProperty("m_iHealth", st.PropertyValue{IntVal: 0}) assert.Equal(t, false, pl.IsAlive(), "Should be dead") pl.Entity = entityWithProperty("m_iHealth", st.PropertyValue{IntVal: -10}) assert.Equal(t, false, pl.IsAlive(), "Should be dead") }
explode_data.jsonl/12163
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 213 }
[ 2830, 3393, 4476, 32637, 1155, 353, 8840, 836, 8, 341, 72213, 1669, 501, 4476, 7, 15, 692, 72213, 9899, 284, 5387, 2354, 3052, 445, 76, 5318, 14542, 497, 357, 15727, 1130, 90, 1072, 2208, 25, 220, 16, 15, 15, 3518, 6948, 12808, 1155...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestPeerHeapOrdering(t *testing.T) { p1 := &peerScore{score: 1} p2 := &peerScore{score: 2} p3 := &peerScore{score: 3} // same score as p3, but always pushed after p3, so it will be returned last. p4 := &peerScore{score: 3} want := []*peerScore{p1, p2, p3, p4} tests := [][]*peerScore{ {p1, p2, p3, p4}, {p3, p4, p2, p1}, {p3, p1, p2, p4}, } for _, tt := range tests { var h peerHeap for _, ps := range tt { h.pushPeer(ps) } popped := popAndVerifyHeap(t, &h) assert.Equal(t, want, popped, "Unexpected ordering of peers") } }
explode_data.jsonl/11673
{ "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, 30888, 27909, 4431, 287, 1155, 353, 8840, 836, 8, 341, 3223, 16, 1669, 609, 16537, 10570, 90, 12338, 25, 220, 16, 532, 3223, 17, 1669, 609, 16537, 10570, 90, 12338, 25, 220, 17, 532, 3223, 18, 1669, 609, 16537, 10570, 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...
3
func TestPadHeaders(t *testing.T) { check := func(h http.Header, limit uint32, fillerLen int) { if h == nil { h = make(http.Header) } filler := strings.Repeat("f", fillerLen) padHeaders(t, h, uint64(limit), filler) gotSize := headerListSize(h) if gotSize != limit { t.Errorf("Got size = %v; want %v", gotSize, limit) } } // Try all possible combinations for small fillerLen and limit. hf := hpack.HeaderField{Name: "Pad-Headers", Value: ""} minLimit := hf.Size() for limit := minLimit; limit <= 128; limit++ { for fillerLen := 0; uint32(fillerLen) <= limit; fillerLen++ { check(nil, limit, fillerLen) } } // Try a few tests with larger limits, plus cumulative // tests. Since these tests are cumulative, tests[i+1].limit // must be >= tests[i].limit + minLimit. See the comment on // padHeaders for more info on why the limit arg has this // restriction. tests := []struct { fillerLen int limit uint32 }{ { fillerLen: 64, limit: 1024, }, { fillerLen: 1024, limit: 1286, }, { fillerLen: 256, limit: 2048, }, { fillerLen: 1024, limit: 10 * 1024, }, { fillerLen: 1023, limit: 11 * 1024, }, } h := make(http.Header) for _, tc := range tests { check(nil, tc.limit, tc.fillerLen) check(h, tc.limit, tc.fillerLen) } }
explode_data.jsonl/16106
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 563 }
[ 2830, 3393, 13731, 10574, 1155, 353, 8840, 836, 8, 341, 25157, 1669, 2915, 3203, 1758, 15753, 11, 3930, 2622, 18, 17, 11, 54710, 11271, 526, 8, 341, 197, 743, 305, 621, 2092, 341, 298, 9598, 284, 1281, 19886, 15753, 340, 197, 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...
3
func TestAccAzureRMLoadBalancerNatRule_zeroPortNumber(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_lb_nat_rule", "test") r := LoadBalancerNatRule{} data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.zeroPortNumber(data), Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, data.ImportStep(), }) }
explode_data.jsonl/29074
{ "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, 14603, 78107, 49, 2668, 2731, 93825, 65214, 11337, 19359, 7084, 2833, 1155, 353, 8840, 836, 8, 341, 8924, 1669, 25505, 25212, 83920, 1155, 11, 330, 1370, 324, 4195, 63601, 38169, 21124, 497, 330, 1944, 1138, 7000, 1669, 8893, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestNonexistentSubcommand(t *testing.T) { var args struct { sub *struct{} `arg:"subcommand"` } p, err := NewParser(Config{}, &args) require.NoError(t, err) var b bytes.Buffer err = p.WriteUsageForSubcommand(&b, "does_not_exist") assert.Error(t, err) err = p.WriteHelpForSubcommand(&b, "does_not_exist") assert.Error(t, err) err = p.FailSubcommand("something went wrong", "does_not_exist") assert.Error(t, err) err = p.WriteUsageForSubcommand(&b, "sub", "does_not_exist") assert.Error(t, err) err = p.WriteHelpForSubcommand(&b, "sub", "does_not_exist") assert.Error(t, err) err = p.FailSubcommand("something went wrong", "sub", "does_not_exist") assert.Error(t, err) }
explode_data.jsonl/20498
{ "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, 8121, 64085, 3136, 5631, 1155, 353, 8840, 836, 8, 341, 2405, 2827, 2036, 341, 197, 28624, 353, 1235, 6257, 1565, 858, 2974, 1966, 5631, 8805, 197, 532, 3223, 11, 1848, 1669, 1532, 6570, 33687, 22655, 609, 2116, 340, 17957, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestServer_Request_Get_Host(t *testing.T) { const host = "example.com" testServerRequest(t, func(st *serverTester) { st.writeHeaders(HeadersFrameParam{ StreamID: 1, // clients send odd numbers BlockFragment: st.encodeHeader(":authority", "", "host", host), EndStream: true, EndHeaders: true, }) }, func(r *http.Request) { if r.Host != host { t.Errorf("Host = %q; want %q", r.Host, host) } }) }
explode_data.jsonl/71614
{ "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, 5475, 44024, 13614, 2039, 535, 1155, 353, 8840, 836, 8, 341, 4777, 3468, 284, 330, 8687, 905, 698, 18185, 5475, 1900, 1155, 11, 2915, 5895, 353, 4030, 58699, 8, 341, 197, 18388, 3836, 10574, 7, 10574, 4369, 2001, 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...
1
func TestWorld_ColorAt(t *testing.T) { w := NewDefaultWorld() r := algebra.NewRay(0, 0, -5, 0, 1, 0) c := w.ColorAt(r, 0) res := 0.0 if !equals(c.Red(), res) { t.Errorf("Expected %f, Got %f", res, c.Red()) } if !equals(c.Green(), res) { t.Errorf("Expected %f, Got %f", res, c.Green()) } if !equals(c.Blue(), res) { t.Errorf("Expected %f, Got %f", res, c.Blue()) } r = algebra.NewRay(0, 0, -5, 0, 0, 1) c = w.ColorAt(r, 0) if !equals(c.Red(), 0.38066) { t.Errorf("Expected %f, Got %f", 0.38066, c.Red()) } if !equals(c.Green(), 0.47583) { t.Errorf("Expected %f, Got %f", 0.47583, c.Green()) } if !equals(c.Blue(), 0.2855) { t.Errorf("Expected %f, Got %f", 0.2855, c.Blue()) } w = NewDefaultWorld() outer := w.Objects[0] mat := outer.GetMaterial() mat.Ambient = 1.0 outer.SetMaterial(mat) inner := w.Objects[1] mat = inner.GetMaterial() mat.Ambient = 1.0 inner.SetMaterial(mat) r = algebra.NewRay(0, 0, 0.75, 0, 0, -1) c = w.ColorAt(r, 0) for i := 0; i < 3; i++ { if !equals(c[i], inner.GetMaterial().Color[i]) { t.Errorf("Expected: %f, Got: %f", c[i], inner.GetMaterial().Color[i]) } } // test that an "infinite recursion" terminates lights := make([]*canvas.PointLight, 0, 0) light1 := canvas.NewPointLight(&canvas.Color{1, 1, 1}, algebra.NewPoint(0, 0, 0)) lower := primitives.NewPlane(algebra.TranslationMatrix(0, -1, 0)) m := canvas.NewDefaultMaterial() m.Reflective = 1.0 lower.SetMaterial(m) upper := primitives.NewPlane(algebra.TranslationMatrix(0, 1, 0)) upper.SetMaterial(m) objs := make([]primitives.Shape, 0, 0) objs = append(objs, lower, upper) lights = append(lights, light1) w = &World{Lights: lights, Objects: objs} r = algebra.NewRay(0, 0, 0, 0, 1, 0) w.ColorAt(r, 10) }
explode_data.jsonl/27652
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 801 }
[ 2830, 3393, 10134, 43387, 1655, 1155, 353, 8840, 836, 8, 341, 6692, 1669, 1532, 3675, 10134, 741, 7000, 1669, 46876, 7121, 29187, 7, 15, 11, 220, 15, 11, 481, 20, 11, 220, 15, 11, 220, 16, 11, 220, 15, 340, 1444, 1669, 289, 6669, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestClient_Coins(t *testing.T) { cs, err := client.CoinsList(CoinsParams{}) require.NoError(t, err) require.NotEmpty(t, cs) require.NotEmpty(t, cs[0].Id) require.NotEmpty(t, cs[0].Symbol) require.NotEmpty(t, cs[0].Name) }
explode_data.jsonl/37789
{ "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, 2959, 920, 68798, 1155, 353, 8840, 836, 8, 341, 71899, 11, 1848, 1669, 2943, 52114, 1330, 852, 3025, 68798, 4870, 37790, 17957, 35699, 1155, 11, 1848, 340, 17957, 15000, 3522, 1155, 11, 10532, 340, 17957, 15000, 3522, 1155, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestTxOut_IsEqual(t *testing.T) { script := script.NewScriptRaw([]byte{opcodes.OP_RETURN, 0x01, 0x01}) txout := NewTxOut(9, script) txout2 := NewTxOut(9, script) assert.True(t, txout.IsEqual(txout2)) txout2.value = 8 assert.False(t, txout.IsEqual(txout2)) }
explode_data.jsonl/38887
{ "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, 31584, 2662, 31879, 2993, 1155, 353, 8840, 836, 8, 341, 86956, 1669, 5316, 7121, 5910, 20015, 10556, 3782, 90, 453, 25814, 81563, 21909, 11, 220, 15, 87, 15, 16, 11, 220, 15, 87, 15, 16, 3518, 46237, 411, 1669, 1532, 315...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestThingID(t *testing.T) { thingCache := redis.NewThingCache(redisClient) key, err := uuid.New().ID() require.Nil(t, err, fmt.Sprintf("got unexpected error: %s", err)) id := "123" err = thingCache.Save(context.Background(), key, id) require.Nil(t, err, fmt.Sprintf("Save thing to cache: expected nil got %s", err)) cases := map[string]struct { ID string key string err error }{ "Get ID by existing thing-key": { ID: id, key: key, err: nil, }, "Get ID by non-existing thing-key": { ID: "", key: wrongValue, err: r.Nil, }, } for desc, tc := range cases { cacheID, err := thingCache.ID(context.Background(), tc.key) assert.Equal(t, tc.ID, cacheID, fmt.Sprintf("%s: expected %s got %s\n", desc, tc.ID, cacheID)) assert.True(t, errors.Contains(err, tc.err), fmt.Sprintf("%s: expected %s got %s\n", desc, tc.err, err)) } }
explode_data.jsonl/44673
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 367 }
[ 2830, 3393, 52940, 915, 1155, 353, 8840, 836, 8, 341, 197, 1596, 8233, 1669, 20870, 7121, 52940, 8233, 97676, 2959, 692, 23634, 11, 1848, 1669, 16040, 7121, 1005, 915, 741, 17957, 59678, 1155, 11, 1848, 11, 8879, 17305, 445, 22390, 1650...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestFillSmallerStruct(t *testing.T) { user := User{Name: "SmallerUser", Age: 100} DB.Save(&user) type SimpleUser struct { ID int64 Name string UpdatedAt time.Time CreatedAt time.Time } var simpleUser SimpleUser if err := DB.Table("users").Where("name = ?", user.Name).First(&simpleUser).Error; err != nil { t.Fatalf("Failed to query smaller user, got error %v", err) } AssertObjEqual(t, user, simpleUser, "Name", "ID", "UpdatedAt", "CreatedAt") var simpleUser2 SimpleUser if err := DB.Model(&User{}).Select("id").First(&simpleUser2, user.ID).Error; err != nil { t.Fatalf("Failed to query smaller user, got error %v", err) } AssertObjEqual(t, user, simpleUser2, "ID") var simpleUsers []SimpleUser if err := DB.Model(&User{}).Select("id").Find(&simpleUsers, user.ID).Error; err != nil || len(simpleUsers) != 1 { t.Fatalf("Failed to query smaller user, got error %v", err) } AssertObjEqual(t, user, simpleUsers[0], "ID") result := DB.Session(&gorm.Session{DryRun: true}).Model(&User{}).Find(&simpleUsers, user.ID) if !regexp.MustCompile("SELECT .*id.*name.*updated_at.*created_at.* FROM .*users").MatchString(result.Statement.SQL.String()) { t.Fatalf("SQL should include selected names, but got %v", result.Statement.SQL.String()) } result = DB.Session(&gorm.Session{DryRun: true}).Model(&User{}).Find(&User{}, user.ID) if regexp.MustCompile("SELECT .*name.* FROM .*users").MatchString(result.Statement.SQL.String()) { t.Fatalf("SQL should not include selected names, but got %v", result.Statement.SQL.String()) } result = DB.Session(&gorm.Session{DryRun: true}).Model(&User{}).Find(&[]User{}, user.ID) if regexp.MustCompile("SELECT .*name.* FROM .*users").MatchString(result.Statement.SQL.String()) { t.Fatalf("SQL should not include selected names, but got %v", result.Statement.SQL.String()) } result = DB.Session(&gorm.Session{DryRun: true}).Model(&User{}).Find(&[]*User{}, user.ID) if regexp.MustCompile("SELECT .*name.* FROM .*users").MatchString(result.Statement.SQL.String()) { t.Fatalf("SQL should not include selected names, but got %v", result.Statement.SQL.String()) } }
explode_data.jsonl/48701
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 767 }
[ 2830, 3393, 14449, 10673, 13956, 9422, 1155, 353, 8840, 836, 8, 341, 19060, 1669, 2657, 63121, 25, 330, 10673, 13956, 1474, 497, 13081, 25, 220, 16, 15, 15, 532, 45409, 13599, 2099, 872, 340, 13158, 8993, 1474, 2036, 341, 197, 29580, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestFilteringServerGetSrvKeyspaceErrorPassthrough(t *testing.T) { wantErr := fmt.Errorf("some error") _, mock, f := newFiltering(stockFilters) mock.SrvKeyspace = stockKeyspaces["bar"] mock.SrvKeyspaceError = wantErr doTestGetSrvKeyspace(t, f, "badcell", "bar", stockKeyspaces["bar"], wantErr) }
explode_data.jsonl/2380
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 120 }
[ 2830, 3393, 5632, 287, 5475, 1949, 50, 10553, 8850, 1306, 1454, 70911, 86901, 1155, 353, 8840, 836, 8, 341, 50780, 7747, 1669, 8879, 13080, 445, 14689, 1465, 1138, 197, 6878, 7860, 11, 282, 1669, 501, 5632, 287, 67471, 28351, 340, 77333...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 Test1000(t *testing.T) { s, c := makeTestServer() defer s.Shutdown() for i := int64(0); i < 5000; i++ { filename := fmt.Sprintf("length-%d-bytes-%d", i, time.Now().UnixNano()) rf, err := c.Send(filename, "octet") if err != nil { t.Fatalf("requesting %s write: %v", filename, err) } r := io.LimitReader(newRandReader(rand.NewSource(i)), i) n, err := rf.ReadFrom(r) if err != nil { t.Fatalf("sending %s: %v", filename, err) } if n != i { t.Errorf("%s length mismatch: %d != %d", filename, n, i) } } }
explode_data.jsonl/17547
{ "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, 16, 15, 15, 15, 1155, 353, 8840, 836, 8, 341, 1903, 11, 272, 1669, 1281, 2271, 5475, 741, 16867, 274, 10849, 18452, 741, 2023, 600, 1669, 526, 21, 19, 7, 15, 1215, 600, 366, 220, 20, 15, 15, 15, 26, 600, 1027, 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 TestRangeCacheAssumptions(t *testing.T) { defer leaktest.AfterTest(t)() defer log.Scope(t).Close(t) expKeyMin := keys.RangeMetaKey(keys.RangeMetaKey(keys.RangeMetaKey(roachpb.RKey("test")))) if !bytes.Equal(expKeyMin, roachpb.RKeyMin) { t.Fatalf("RangeCache relies on RangeMetaKey returning KeyMin after two levels, but got %s", expKeyMin) } }
explode_data.jsonl/28182
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 133 }
[ 2830, 3393, 6046, 8233, 5615, 372, 1300, 1155, 353, 8840, 836, 8, 341, 16867, 23352, 1944, 36892, 2271, 1155, 8, 741, 16867, 1487, 77940, 1155, 568, 7925, 1155, 340, 48558, 1592, 6217, 1669, 6894, 24783, 12175, 1592, 36131, 24783, 12175, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestGrant_String(t *testing.T) { v := Grant{ ID: Int64(0), URL: String(""), App: &AuthorizationApp{}, CreatedAt: &Timestamp{}, UpdatedAt: &Timestamp{}, } want := `github.Grant{ID:0, URL:"", App:github.AuthorizationApp{}, CreatedAt:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}, UpdatedAt:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}}` if got := v.String(); got != want { t.Errorf("Grant.String = %v, want %v", got, want) } }
explode_data.jsonl/33244
{ "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, 67971, 31777, 1155, 353, 8840, 836, 8, 341, 5195, 1669, 23736, 515, 197, 29580, 25, 286, 1333, 21, 19, 7, 15, 1326, 197, 79055, 25, 981, 923, 445, 4461, 197, 59557, 25, 981, 609, 18124, 2164, 38837, 197, 84062, 1655, 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...
2
func TestServeHTTP(t *testing.T) { describeTests("Test ServeHTTP method") router := Router{} testMatchesRoot(router, t) testMatchesLongPath(router, t) testMatchesPathParam(router, t) testDefaultNotFound(router, t) testCustomNotFound(router, t) }
explode_data.jsonl/34493
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 97 }
[ 2830, 3393, 60421, 9230, 1155, 353, 8840, 836, 8, 341, 82860, 18200, 445, 2271, 52932, 9230, 1714, 5130, 67009, 1669, 10554, 31483, 18185, 42470, 8439, 61210, 11, 259, 340, 18185, 42470, 6583, 1820, 61210, 11, 259, 340, 18185, 42470, 9349...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestUpstreamHeadersUpdate(t *testing.T) { log.SetOutput(ioutil.Discard) defer log.SetOutput(os.Stderr) var actualHeaders http.Header var actualHost string backend := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { w.Write([]byte("Hello, client")) actualHeaders = r.Header actualHost = r.Host })) defer backend.Close() upstream := newFakeUpstream(backend.URL, false, 30*time.Second) upstream.host.UpstreamHeaders = http.Header{ "Connection": {"{>Connection}"}, "Upgrade": {"{>Upgrade}"}, "+Merge-Me": {"Merge-Value"}, "+Add-Me": {"Add-Value"}, "+Add-Empty": {"{}"}, "-Remove-Me": {""}, "Replace-Me": {"{hostname}"}, "Clear-Me": {""}, "Host": {"{>Host}"}, } // set up proxy p := &Proxy{ Next: httpserver.EmptyNext, // prevents panic in some cases when test fails Upstreams: []Upstream{upstream}, } // create request and response recorder r := httptest.NewRequest("GET", "/", nil) w := httptest.NewRecorder() const expectHost = "example.com" //add initial headers r.Header.Add("Merge-Me", "Initial") r.Header.Add("Remove-Me", "Remove-Value") r.Header.Add("Replace-Me", "Replace-Value") r.Header.Add("Host", expectHost) p.ServeHTTP(w, r) replacer := httpserver.NewReplacer(r, nil, "") for headerKey, expect := range map[string][]string{ "Merge-Me": {"Initial", "Merge-Value"}, "Add-Me": {"Add-Value"}, "Add-Empty": nil, "Remove-Me": nil, "Replace-Me": {replacer.Replace("{hostname}")}, "Clear-Me": nil, } { if got := actualHeaders[headerKey]; !reflect.DeepEqual(got, expect) { t.Errorf("Upstream request does not contain expected %v header: expect %v, but got %v", headerKey, expect, got) } } if actualHost != expectHost { t.Errorf("Request sent to upstream backend should have value of Host with %s, but got %s", expectHost, actualHost) } }
explode_data.jsonl/64236
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 748 }
[ 2830, 3393, 2324, 4027, 10574, 4289, 1155, 353, 8840, 836, 8, 341, 6725, 4202, 5097, 1956, 30158, 909, 47560, 340, 16867, 1487, 4202, 5097, 9638, 77319, 692, 2405, 5042, 10574, 1758, 15753, 198, 2405, 5042, 9296, 914, 198, 197, 20942, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestEvalGetProvider(t *testing.T) { var actual providers.Interface n := &EvalGetProvider{ Addr: addrs.RootModuleInstance.ProviderConfigDefault("foo"), Output: &actual, } provider := &MockProvider{} ctx := &MockEvalContext{ProviderProvider: provider} if _, err := n.Eval(ctx); err != nil { t.Fatalf("err: %s", err) } if actual != provider { t.Fatalf("bad: %#v", actual) } if !ctx.ProviderCalled { t.Fatal("should be called") } if ctx.ProviderAddr.String() != "provider.foo" { t.Fatalf("wrong provider address %s", ctx.ProviderAddr) } }
explode_data.jsonl/3216
{ "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, 54469, 1949, 5179, 1155, 353, 8840, 836, 8, 341, 2405, 5042, 12565, 41065, 198, 9038, 1669, 609, 54469, 1949, 5179, 515, 197, 197, 13986, 25, 256, 912, 5428, 45345, 3332, 2523, 36208, 2648, 3675, 445, 7975, 4461, 197, 80487,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestPulsar(t *testing.T) { cli, err := pulsar.NewClient(pulsar.ClientOptions{ URL: "pulsar://127.0.0.1:6650", }) if err != nil { fmt.Println("err:", err) t.Fail() return } defer cli.Close() // producer pro, err := producer.NewPulsarProducer("demo", cli) if err != nil || pro == nil { fmt.Println("err:", err) t.Fail() return } defer pro.CloseFunc() ctx := context.Background() if err := pro.SendMsg(ctx, []byte("hello")); err != nil { t.Fail() return } wg := sync.WaitGroup{} wg.Add(1) // consumer con, err := consumer.NewPulsarConsumer("demo", "consumer-one", cli) if err != nil || con == nil { t.Fail() return } defer con.CloseFunc() go func() { bytes, err := con.Consume(ctx) if err != nil { t.Fail() } fmt.Println("bytes:", string(bytes)) wg.Done() }() wg.Wait() }
explode_data.jsonl/57993
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 379 }
[ 2830, 3393, 47, 14295, 277, 1155, 353, 8840, 836, 8, 341, 86448, 11, 1848, 1669, 54937, 277, 7121, 2959, 1295, 14295, 277, 11716, 3798, 515, 197, 79055, 25, 330, 79, 14295, 277, 1110, 16, 17, 22, 13, 15, 13, 15, 13, 16, 25, 21, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestValidatorQuery(t *testing.T) { cleanup, valPubKeys, operAddrs, port := InitializeTestLCD(t, 1, []sdk.AccAddress{}, true) defer cleanup() require.Equal(t, 1, len(valPubKeys)) require.Equal(t, 1, len(operAddrs)) validator := getValidator(t, port, operAddrs[0]) require.Equal(t, validator.OperatorAddress, operAddrs[0], "The returned validator does not hold the correct data") }
explode_data.jsonl/25409
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 143 }
[ 2830, 3393, 14256, 2859, 1155, 353, 8840, 836, 8, 341, 1444, 60639, 11, 1044, 29162, 8850, 11, 1997, 2212, 5428, 11, 2635, 1669, 9008, 2271, 64003, 1155, 11, 220, 16, 11, 3056, 51295, 77538, 4286, 22655, 830, 340, 16867, 21290, 741, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestPatchRequest(t *testing.T) { setupServer() defer teardownServer() setupDefaultMux(`"body"`) var req = URL("http://example.com/url") if err := req.Patch(); err != nil { t.Error(err) } assertTextualBody(t, `"body"`, req.Response.Body) assertMethod(t, "PATCH", req.Request.Method) }
explode_data.jsonl/24761
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 118 }
[ 2830, 3393, 43622, 1900, 1155, 353, 8840, 836, 8, 341, 84571, 5475, 741, 16867, 49304, 5475, 741, 84571, 3675, 44, 2200, 5809, 1, 2599, 39917, 692, 2405, 4232, 284, 5548, 445, 1254, 1110, 8687, 905, 57254, 5130, 743, 1848, 1669, 4232, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestMarshal(t *testing.T) { md := &etcdraft.Metadata{ Consenters: []*etcdraft.Consenter{ { Host: "node-1.example.com", Port: 7050, ClientTlsCert: []byte("testdata/tls-client-1.pem"), ServerTlsCert: []byte("testdata/tls-server-1.pem"), }, { Host: "node-2.example.com", Port: 7050, ClientTlsCert: []byte("testdata/tls-client-2.pem"), ServerTlsCert: []byte("testdata/tls-server-2.pem"), }, { Host: "node-3.example.com", Port: 7050, ClientTlsCert: []byte("testdata/tls-client-3.pem"), ServerTlsCert: []byte("testdata/tls-server-3.pem"), }, }, } packed, err := etcdraft.Marshal(md) require.Nil(t, err, "marshalling should succeed") unpacked := &etcdraft.Metadata{} require.Nil(t, proto.Unmarshal(packed, unpacked), "unmarshalling should succeed") var outputCerts, inputCerts [3][]byte for i := range unpacked.GetConsenters() { outputCerts[i] = []byte(unpacked.GetConsenters()[i].GetClientTlsCert()) inputCerts[i], _ = ioutil.ReadFile(fmt.Sprintf("testdata/tls-client-%d.pem", i+1)) } for i := 0; i < len(inputCerts)-1; i++ { require.NotEqual(t, outputCerts[i+1], outputCerts[i], "expected extracted certs to differ from each other") } }
explode_data.jsonl/12940
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 605 }
[ 2830, 3393, 55438, 1155, 353, 8840, 836, 8, 341, 84374, 1669, 609, 295, 4385, 2944, 46475, 515, 197, 197, 15220, 306, 388, 25, 29838, 295, 4385, 2944, 94594, 1950, 515, 298, 197, 515, 571, 197, 9296, 25, 688, 330, 3509, 12, 16, 7724...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestPersistRevisionHistory(t *testing.T) { app := newFakeApp() app.Status.OperationState = nil app.Status.History = nil defaultProject := &v1alpha1.AppProject{ ObjectMeta: v1.ObjectMeta{ Namespace: test.FakeArgoCDNamespace, Name: "default", }, } data := fakeData{ apps: []runtime.Object{app, defaultProject}, manifestResponse: &apiclient.ManifestResponse{ Manifests: []*apiclient.Manifest{}, Namespace: test.FakeDestNamespace, Server: test.FakeClusterURL, Revision: "abc123", }, managedLiveObjs: make(map[kube.ResourceKey]*unstructured.Unstructured), } ctrl := newFakeController(&data) // Sync with source unspecified opState := &v1alpha1.OperationState{Operation: v1alpha1.Operation{ Sync: &v1alpha1.SyncOperation{}, }} ctrl.appStateManager.SyncAppState(app, opState) // Ensure we record spec.source into sync result assert.Equal(t, app.Spec.Source, opState.SyncResult.Source) updatedApp, err := ctrl.applicationClientset.ArgoprojV1alpha1().Applications(app.Namespace).Get(context.Background(), app.Name, v1.GetOptions{}) assert.Nil(t, err) assert.Equal(t, 1, len(updatedApp.Status.History)) assert.Equal(t, app.Spec.Source, updatedApp.Status.History[0].Source) assert.Equal(t, "abc123", updatedApp.Status.History[0].Revision) }
explode_data.jsonl/56513
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 481 }
[ 2830, 3393, 61267, 33602, 13424, 1155, 353, 8840, 836, 8, 341, 28236, 1669, 501, 52317, 2164, 741, 28236, 10538, 56297, 1397, 284, 2092, 198, 28236, 10538, 3839, 2579, 284, 2092, 271, 11940, 7849, 1669, 609, 85, 16, 7141, 16, 5105, 7849...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_WorkspaceCapping_WhenPropertiesConverted_RoundTripsWithoutLoss(t *testing.T) { t.Parallel() parameters := gopter.DefaultTestParameters() parameters.MaxSize = 10 properties := gopter.NewProperties(parameters) properties.Property( "Round trip from WorkspaceCapping to WorkspaceCapping via AssignPropertiesToWorkspaceCapping & AssignPropertiesFromWorkspaceCapping returns original", prop.ForAll(RunPropertyAssignmentTestForWorkspaceCapping, WorkspaceCappingGenerator())) properties.TestingRun(t, gopter.NewFormatedReporter(false, 240, os.Stdout)) }
explode_data.jsonl/43366
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 172 }
[ 2830, 3393, 87471, 8746, 34, 3629, 62, 4498, 7903, 61941, 2568, 795, 21884, 1690, 26040, 39838, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 741, 67543, 1669, 728, 73137, 13275, 2271, 9706, 741, 67543, 14535, 1695, 284, 220, 16, 15,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestToken_lexString(t *testing.T) { tests := []struct { string bool value string }{ { string: false, value: "a", }, { string: true, value: "'abc'", }, { string: true, value: "'a b'", }, { string: true, value: "'a' ", }, { string: true, value: "'a '' b'", }, // false tests { string: false, value: "'", }, { string: false, value: "", }, { string: false, value: " 'foo'", }, } for _, test := range tests { tok, _, ok := lexString(test.value, cursor{}) assert.Equal(t, test.string, ok, test.value) if ok { test.value = strings.TrimSpace(test.value) assert.Equal(t, test.value[1:len(test.value)-1], tok.Value, test.value) } } }
explode_data.jsonl/60000
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 376 }
[ 2830, 3393, 3323, 74547, 703, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 3056, 1235, 341, 197, 11357, 1807, 198, 197, 16309, 220, 914, 198, 197, 59403, 197, 197, 515, 298, 11357, 25, 895, 345, 298, 16309, 25, 220, 330, 64, 756, 197,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestCancelled(t *testing.T) { testutils.WithTestServer(t, nil, func(t testing.TB, ts *testutils.TestServer) { ts.Register(raw.Wrap(newTestHandler(t)), "echo") ctx, cancel := NewContext(time.Second) // Make a call first to make sure we have a connection. // We want to test the BeginCall path. _, _, _, err := raw.Call(ctx, ts.Server(), ts.HostPort(), ts.ServiceName(), "echo", []byte("Headers"), []byte("Body")) assert.NoError(t, err, "Call failed") // Now cancel the context. cancel() _, _, _, err = raw.Call(ctx, ts.Server(), ts.HostPort(), ts.ServiceName(), "echo", []byte("Headers"), []byte("Body")) assert.Equal(t, ErrRequestCancelled, err, "Unexpected error when making call with canceled context") }) }
explode_data.jsonl/78182
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 261 }
[ 2830, 3393, 39473, 1155, 353, 8840, 836, 8, 341, 18185, 6031, 26124, 2271, 5475, 1155, 11, 2092, 11, 2915, 1155, 7497, 836, 33, 11, 10591, 353, 1944, 6031, 8787, 5475, 8, 341, 197, 57441, 19983, 22460, 38968, 1755, 2271, 3050, 1155, 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 TestPAC_SignatureData_Unmarshal_KDC_Signature(t *testing.T) { t.Parallel() b, err := hex.DecodeString(testdata.MarshaledPAC_KDC_Signature) if err != nil { t.Fatal("Could not decode test data hex string") } var k SignatureData bz, err := k.Unmarshal(b) if err != nil { t.Fatalf("Error unmarshaling test data: %v", err) } sig, _ := hex.DecodeString("340be28b48765d0519ee9346cf53d822") zeroed, _ := hex.DecodeString("76ffffff00000000000000000000000000000000") assert.Equal(t, chksumtype.KERB_CHECKSUM_HMAC_MD5_UNSIGNED, k.SignatureType, "Server signature type not as expected") assert.Equal(t, sig, k.Signature, "Server signature not as expected") assert.Equal(t, uint16(0), k.RODCIdentifier, "RODC Identifier not as expected") assert.Equal(t, zeroed, bz, "Returned bytes with zeroed signature not as expected") }
explode_data.jsonl/60579
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 315 }
[ 2830, 3393, 47, 1706, 1098, 622, 1568, 1043, 40687, 27121, 10102, 5626, 1098, 622, 1568, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 741, 2233, 11, 1848, 1669, 12371, 56372, 703, 8623, 691, 83691, 75303, 47, 1706, 10102, 5626, 1098...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestReserve(t *testing.T) { th.SetupHTTP() defer th.TeardownHTTP() MockReserveResponse(t) err := volumeactions.Reserve(client.ServiceClient(), "cd281d77-8217-4830-be95-9528227c105c").ExtractErr() th.AssertNoErr(t, err) }
explode_data.jsonl/20628
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 98 }
[ 2830, 3393, 1061, 5852, 1155, 353, 8840, 836, 8, 341, 70479, 39820, 9230, 741, 16867, 270, 94849, 37496, 9230, 2822, 9209, 1176, 1061, 5852, 2582, 1155, 692, 9859, 1669, 8123, 4020, 8377, 5852, 12805, 13860, 2959, 1507, 330, 4385, 17, 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...
1
func TestIssue1101(t *testing.T) { // If a breakpoint is hit close to process death on a thread that isn't the // group leader the process could die while we are trying to stop it. // // This can be easily reproduced by having the goroutine that's executing // main.main (which will almost always run on the thread group leader) wait // for a second goroutine before exiting, then setting a breakpoint on the // second goroutine and stepping through it (see TestIssue1101 in // proc_test.go). // // When stepping over the return instruction of main.f the deferred // wg.Done() call will be executed which will cause the main goroutine to // resume and proceed to exit. Both the temporary breakpoint on wg.Done and // the temporary breakpoint on the return address of main.f will be in // close proximity to main.main calling os.Exit() and causing the death of // the thread group leader. withTestProcess("issue1101", t, func(p *proc.Target, fixture protest.Fixture) { setFunctionBreakpoint(p, t, "main.f") assertNoError(p.Continue(), t, "Continue()") assertNoError(p.Next(), t, "Next() 1") assertNoError(p.Next(), t, "Next() 2") lastCmd := "Next() 3" exitErr := p.Next() if exitErr == nil { lastCmd = "final Continue()" exitErr = p.Continue() } if pexit, exited := exitErr.(proc.ErrProcessExited); exited { if pexit.Status != 2 && testBackend != "lldb" && (runtime.GOOS != "linux" || runtime.GOARCH != "386") { // Looks like there's a bug with debugserver on macOS that sometimes // will report exit status 0 instead of the proper exit status. // // Also it seems that sometimes on linux/386 we will not receive the // exit status. This happens if the process exits at the same time as it // receives a signal. t.Fatalf("process exited status %d (expected 2)", pexit.Status) } } else { assertNoError(exitErr, t, lastCmd) t.Fatalf("process did not exit after %s", lastCmd) } }) }
explode_data.jsonl/56303
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 630 }
[ 2830, 3393, 42006, 16, 16, 15, 16, 1155, 353, 8840, 836, 8, 341, 197, 322, 1416, 264, 52745, 374, 4201, 3265, 311, 1882, 4545, 389, 264, 4516, 429, 4436, 944, 279, 198, 197, 322, 1874, 7653, 279, 1882, 1410, 2746, 1393, 582, 525, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestPropertyAs(t *testing.T) { // GIVEN graphName := "mygraph" g := NewGraph(graphName) require.NotNil(t, g) v := NewVertexG(g) require.NotNil(t, v) p := NewPropertyV(v) require.NotNil(t, p) label := "label1" // WHEN p = p.As(label) // THEN assert.NotNil(t, p) assert.Equal(t, fmt.Sprintf("%s.as(\"%s\")", graphName, label), p.String()) }
explode_data.jsonl/38220
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 168 }
[ 2830, 3393, 3052, 2121, 1155, 353, 8840, 836, 8, 1476, 197, 322, 89836, 198, 66616, 675, 1669, 330, 2408, 4439, 698, 3174, 1669, 1532, 11212, 24312, 675, 340, 17957, 93882, 1155, 11, 342, 340, 5195, 1669, 1532, 8320, 38, 3268, 340, 17...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestAllChains(t *testing.T) { tc := SetupTest(t, "test_all_chains", 1) defer tc.Cleanup() var testList TestList err := json.Unmarshal([]byte(testvectors.ChainTests), &testList) require.NoError(t, err, "failed to unmarshal the chain tests") // Always do the tests in alphabetical order. testNames := []string{} for name := range testList.Tests { testNames = append(testNames, name) } sort.Strings(testNames) for _, name := range testNames { testCase := testList.Tests[name] G.Log.Info("starting sigchain test case %s (%s)", name, testCase.Input) doChainTest(t, tc, testCase) } }
explode_data.jsonl/60508
{ "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, 2403, 1143, 1735, 1155, 353, 8840, 836, 8, 341, 78255, 1669, 18626, 2271, 1155, 11, 330, 1944, 5705, 4138, 1735, 497, 220, 16, 340, 16867, 17130, 727, 60639, 2822, 2405, 1273, 852, 3393, 852, 198, 9859, 1669, 2951, 38097, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestMoveTable(t *testing.T) { t.Parallel() ctrl := gomock.NewController(t) mo := mock_owner.NewMockOwner(ctrl) cp := capture.NewCapture4Test(mo) router := newRouter(cp, newStatusProvider()) // test move table succeeded data := struct { CaptureID string `json:"capture_id"` TableID int64 `json:"table_id"` }{captureID, 1} b, err := json.Marshal(&data) require.Nil(t, err) body := bytes.NewReader(b) mo.EXPECT(). ScheduleTable(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()). Do(func( cfID model.ChangeFeedID, toCapture model.CaptureID, tableID model.TableID, done chan<- error, ) { require.EqualValues(t, cfID, changeFeedID) require.EqualValues(t, toCapture, data.CaptureID) require.EqualValues(t, tableID, data.TableID) close(done) }) api := testCase{ url: fmt.Sprintf("/api/v1/changefeeds/%s/tables/move_table", changeFeedID), method: "POST", } w := httptest.NewRecorder() req, _ := http.NewRequestWithContext(context.Background(), api.method, api.url, body) router.ServeHTTP(w, req) require.Equal(t, 202, w.Code) // test move table failed from owner side. data = struct { CaptureID string `json:"capture_id"` TableID int64 `json:"table_id"` }{captureID, 1} b, err = json.Marshal(&data) require.Nil(t, err) body = bytes.NewReader(b) mo.EXPECT(). ScheduleTable(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()). Do(func( cfID model.ChangeFeedID, toCapture model.CaptureID, tableID model.TableID, done chan<- error, ) { require.EqualValues(t, cfID, changeFeedID) require.EqualValues(t, toCapture, data.CaptureID) require.EqualValues(t, tableID, data.TableID) done <- cerror.ErrChangeFeedNotExists.FastGenByArgs(cfID) close(done) }) api = testCase{ url: fmt.Sprintf("/api/v1/changefeeds/%s/tables/move_table", changeFeedID), method: "POST", } w = httptest.NewRecorder() req, _ = http.NewRequestWithContext(context.Background(), api.method, api.url, body) router.ServeHTTP(w, req) require.Equal(t, 400, w.Code) respErr := model.HTTPError{} err = json.NewDecoder(w.Body).Decode(&respErr) require.Nil(t, err) require.Contains(t, respErr.Error, "changefeed not exists") // test move table failed api = testCase{ url: fmt.Sprintf("/api/v1/changefeeds/%s/tables/move_table", nonExistChangefeedID), method: "POST", } w = httptest.NewRecorder() req, _ = http.NewRequestWithContext(context.Background(), api.method, api.url, body) router.ServeHTTP(w, req) require.Equal(t, 400, w.Code) respErr = model.HTTPError{} err = json.NewDecoder(w.Body).Decode(&respErr) require.Nil(t, err) require.Contains(t, respErr.Error, "changefeed not exists") }
explode_data.jsonl/75117
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1108 }
[ 2830, 3393, 9860, 2556, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 2822, 84381, 1669, 342, 316, 1176, 7121, 2051, 1155, 340, 2109, 78, 1669, 7860, 29027, 7121, 11571, 13801, 62100, 340, 52018, 1669, 12322, 7121, 27429, 19, 2271, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestPublishWithSourceIdInHeader(t *testing.T) { subject := buildDefaultTestSubject() requestPayload := buildDefaultTestPayloadWithoutSourceId() sub, _ := sc.Subscribe(subject, func(m *stan.Msg) { msg = m }) responseBody, statusCode := performPublishRequestWithHeaders(t, publishServer.URL, requestPayload, map[string]string{api.HeaderSourceId: testSourceID}) verifyPublish(t, statusCode, sub, responseBody, buildDefaultTestPayload()) }
explode_data.jsonl/74407
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 139 }
[ 2830, 3393, 50145, 2354, 3608, 764, 641, 4047, 1155, 353, 8840, 836, 8, 341, 28624, 583, 1669, 1936, 3675, 2271, 13019, 741, 23555, 29683, 1669, 1936, 3675, 2271, 29683, 26040, 3608, 764, 741, 28624, 11, 716, 1669, 1136, 82628, 29128, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestHeaderProviderDoCommand(t *testing.T) { th := Setup().InitBasic() defer th.TearDown() hp := HeaderProvider{} args := &model.CommandArgs{ T: func(s string, args ...interface{}) string { return s }, ChannelId: th.BasicChannel.Id, Session: model.Session{UserId: th.BasicUser.Id, TeamMembers: []*model.TeamMember{{TeamId: th.BasicTeam.Id, Roles: model.TEAM_USER_ROLE_ID}}}, } for msg, expected := range map[string]string{ "": "api.command_channel_header.message.app_error", "hello": "", } { actual := hp.DoCommand(th.App, args, msg).Text assert.Equal(t, expected, actual) } }
explode_data.jsonl/33539
{ "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, 4047, 5179, 5404, 4062, 1155, 353, 8840, 836, 8, 341, 70479, 1669, 18626, 1005, 3803, 15944, 741, 16867, 270, 836, 682, 4454, 2822, 9598, 79, 1669, 12104, 5179, 16094, 31215, 1669, 609, 2528, 12714, 4117, 515, 197, 10261, 25...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestHandshakeServerALPNNotConfigured(t *testing.T) { config := testConfig.Clone() config.NextProtos = nil test := &serverTest{ name: "ALPN-NotConfigured", // 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", "proto2,proto1", "-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/36338
{ "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, 2314, 29661, 5475, 969, 17896, 2623, 2648, 3073, 1155, 353, 8840, 836, 8, 341, 25873, 1669, 1273, 2648, 64463, 741, 25873, 18501, 12423, 436, 284, 2092, 271, 18185, 1669, 609, 4030, 2271, 515, 197, 11609, 25, 330, 969, 17896...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestRowTableUpdateGeomUpdateStyle(t *testing.T) { map_dao := &TableRowUpdateGeomImpl{&DaoImpl{}, "unknown", false, false, false} service := service.MakeTableRowService(map_dao) uri_params := map[string]string{"id": "1", "table_id": "1"} values := url.Values{} values.Set("column", "the_geom") values.Set("value", "SRID=4326;POINT(78.4622620046139 17.411652235651)") request := makeRequest(http.MethodPost, uri_params, values, true) result := service.Update(request) // wait for a second to make sure that trs.updateGeometryTypeStyle is called time.Sleep(1 * time.Millisecond) if !result.IsSuccess() { t.Errorf("Update geom field failed. %s", result.GetErrors()) } _, ok := result.GetDataByKey("update_hash") if !ok { t.Errorf("update_hash should be present for the_geom field") } if !map_dao.IsUpdateGeometryCalled() { t.Errorf("UpdateGeometry has not been called on dao class") } if !map_dao.IsFindWhereCalled() { t.Errorf("Geometry Type in layer table has not been queried for") } if !map_dao.IsFetchDataCalled() { t.Errorf("Geometry type has not been queried for on the table") } }
explode_data.jsonl/15445
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 417 }
[ 2830, 3393, 3102, 2556, 4289, 78708, 4289, 2323, 1155, 353, 8840, 836, 8, 341, 19567, 814, 3441, 1669, 609, 38558, 4289, 78708, 9673, 90, 5, 12197, 9673, 22655, 330, 16088, 497, 895, 11, 895, 11, 895, 532, 52934, 1669, 2473, 50133, 38...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestMixer(t *testing.T) { input := []wave.Audio{ &wave.Int16Interleaved{ Size: wave.ChunkInfo{Len: 1, Channels: 2, SamplingRate: 1234}, Data: []int16{1, 3}, }, &wave.Int16Interleaved{ Size: wave.ChunkInfo{Len: 3, Channels: 2, SamplingRate: 1234}, Data: []int16{2, 4, 3, 5, 4, 6}, }, } expected := []wave.Audio{ &wave.Int16Interleaved{ Size: wave.ChunkInfo{Len: 1, Channels: 1, SamplingRate: 1234}, Data: []int16{2}, }, &wave.Int16Interleaved{ Size: wave.ChunkInfo{Len: 3, Channels: 1, SamplingRate: 1234}, Data: []int16{3, 4, 5}, }, } trans := NewChannelMixer(1, &mixer.MonoMixer{}) var iSent int r := trans(ReaderFunc(func() (wave.Audio, func(), error) { if iSent < len(input) { iSent++ return input[iSent-1], func() {}, nil } return nil, func() {}, io.EOF })) for i := 0; ; i++ { a, _, err := r.Read() if err != nil { if err == io.EOF && i >= len(expected) { break } t.Fatal(err) } if !reflect.DeepEqual(expected[i], a) { t.Errorf("Expected wave[%d]: %v, got: %v", i, expected[i], a) } } }
explode_data.jsonl/59086
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 519 }
[ 2830, 3393, 44, 39014, 1155, 353, 8840, 836, 8, 341, 22427, 1669, 3056, 30398, 51511, 515, 197, 197, 5, 30398, 7371, 16, 21, 3306, 273, 4141, 515, 298, 91224, 25, 12060, 6353, 3122, 1731, 90, 11271, 25, 220, 16, 11, 62900, 25, 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 TestMessage(t *testing.T) { t.Run("Body", func(t *testing.T) { tests := map[gitdomain.Message]string{ "hello": "", "hello\n": "", "hello\n\n": "", "hello\nworld": "world", "hello\n\nworld": "world", "hello\n\nworld\nfoo": "world\nfoo", "hello\n\nworld\nfoo\n": "world\nfoo", } for input, want := range tests { got := input.Body() if got != want { t.Errorf("got %q, want %q", got, want) } } }) }
explode_data.jsonl/8522
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 277 }
[ 2830, 3393, 2052, 1155, 353, 8840, 836, 8, 341, 3244, 16708, 445, 5444, 497, 2915, 1155, 353, 8840, 836, 8, 341, 197, 78216, 1669, 2415, 58, 12882, 12204, 8472, 30953, 515, 298, 197, 1, 14990, 788, 338, 8324, 298, 197, 1, 14990, 169...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestDefaultEnv(t *testing.T) { cases := []struct { name string c corev1.Container env map[string]string expected corev1.Container }{ { name: "nothing set works", }, { name: "add env", env: map[string]string{ "hello": "world", }, expected: corev1.Container{ Env: []corev1.EnvVar{{Name: "hello", Value: "world"}}, }, }, { name: "do not override env", c: corev1.Container{ Env: []corev1.EnvVar{ {Name: "ignore", Value: "this"}, {Name: "keep", Value: "original value"}, }, }, env: map[string]string{ "hello": "world", "keep": "should not see this", }, expected: corev1.Container{ Env: []corev1.EnvVar{ {Name: "ignore", Value: "this"}, {Name: "keep", Value: "original value"}, {Name: "hello", Value: "world"}, }, }, }, } for _, tc := range cases { t.Run(tc.name, func(t *testing.T) { c := tc.c defaultEnv(&c, tc.env) if !equality.Semantic.DeepEqual(c, tc.expected) { t.Errorf("builds do not match:\n%s", diff.ObjectReflectDiff(&tc.expected, c)) } }) } }
explode_data.jsonl/78931
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 536 }
[ 2830, 3393, 3675, 14359, 1155, 353, 8840, 836, 8, 341, 1444, 2264, 1669, 3056, 1235, 341, 197, 11609, 257, 914, 198, 197, 1444, 286, 6200, 85, 16, 33672, 198, 197, 57538, 414, 2415, 14032, 30953, 198, 197, 42400, 6200, 85, 16, 33672, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestQueuedRetry_DropOnNoRetry(t *testing.T) { qCfg := CreateDefaultQueueSettings() rCfg := CreateDefaultRetrySettings() rCfg.Enabled = false be := newBaseExporter(defaultExporterCfg, zap.NewNop(), WithRetry(rCfg), WithQueue(qCfg)) ocs := newObservabilityConsumerSender(be.qrSender.consumerSender) be.qrSender.consumerSender = ocs require.NoError(t, be.Start(context.Background(), componenttest.NewNopHost())) t.Cleanup(func() { assert.NoError(t, be.Shutdown(context.Background())) }) mockR := newMockRequest(context.Background(), 2, errors.New("transient error")) ocs.run(func() { // This is asynchronous so it should just enqueue, no errors expected. droppedItems, err := be.sender.send(mockR) require.NoError(t, err) assert.Equal(t, 0, droppedItems) }) ocs.awaitAsyncProcessing() // In the newMockConcurrentExporter we count requests and items even for failed requests mockR.checkNumRequests(t, 1) ocs.checkSendItemsCount(t, 0) ocs.checkDroppedItemsCount(t, 2) }
explode_data.jsonl/46005
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 368 }
[ 2830, 3393, 25776, 3260, 51560, 1557, 887, 1925, 2753, 51560, 1155, 353, 8840, 836, 8, 341, 18534, 42467, 1669, 4230, 3675, 7554, 6086, 741, 7000, 42467, 1669, 4230, 3675, 51560, 6086, 741, 7000, 42467, 13690, 284, 895, 198, 73142, 1669, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestTerragruntBeforeHook(t *testing.T) { t.Parallel() cleanupTerraformFolder(t, TEST_FIXTURE_HOOKS_BEFORE_ONLY_PATH) tmpEnvPath := copyEnvironment(t, TEST_FIXTURE_HOOKS_BEFORE_ONLY_PATH) rootPath := util.JoinPath(tmpEnvPath, TEST_FIXTURE_HOOKS_BEFORE_ONLY_PATH) runTerragrunt(t, fmt.Sprintf("terragrunt apply -auto-approve --terragrunt-non-interactive --terragrunt-working-dir %s", rootPath)) _, exception := ioutil.ReadFile(rootPath + "/file.out") assert.NoError(t, exception) }
explode_data.jsonl/10064
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 202 }
[ 2830, 3393, 51402, 68305, 3850, 10227, 31679, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 2822, 1444, 60639, 51, 13886, 627, 13682, 1155, 11, 13602, 42635, 41486, 82251, 50, 82218, 31263, 7944, 340, 20082, 14359, 1820, 1669, 2975, 12...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1