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 TestClientUploadImage(t *testing.T) { t.Parallel() testImageFolder := "../tmp" laptopStore := service.NewInMemoryLaptopStore() imageStore := service.NewDiskImageStore(testImageFolder) laptop := sample.NewLaptop() err := laptopStore.Save(laptop) require.NoError(t, err) serverAddress := startTestLaptopServer(t, laptopStore, imageStore) laptopClient := newTestLaptopClient(t, serverAddress) imagePath := fmt.Sprintf("%s/laptop.jpg", testImageFolder) file, err := os.Open(imagePath) require.NoError(t, err) defer file.Close() stream, err := laptopClient.UploadImage(context.Background()) require.NoError(t, err) imageType := filepath.Ext(imagePath) req := &pb.UploadImageRequest{ Data: &pb.UploadImageRequest_Info{ Info: &pb.ImageInfo{ LaptopId: laptop.GetId(), ImageType: imageType, }, }, } err = stream.Send(req) require.NoError(t, err) reader := bufio.NewReader(file) buffer := make([]byte, 1024) size := 0 for { n, err := reader.Read(buffer) if err == io.EOF { break } require.NoError(t, err) size += n req := &pb.UploadImageRequest{ Data: &pb.UploadImageRequest_ChunkData{ ChunkData: buffer[:n], }, } err = stream.Send(req) require.NoError(t, err) } res, err := stream.CloseAndRecv() require.NoError(t, err) require.NotZero(t, res.GetId()) require.EqualValues(t, size, res.GetSize()) savedImagePath := fmt.Sprintf("%s/%s%s", testImageFolder, res.GetId(), imageType) require.FileExists(t, savedImagePath) require.NoError(t, os.Remove(savedImagePath)) }
explode_data.jsonl/13779
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 603 }
[ 2830, 3393, 2959, 13844, 1906, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 2822, 18185, 1906, 13682, 1669, 7005, 5173, 1837, 8810, 16386, 6093, 1669, 2473, 7121, 641, 10642, 43, 16386, 6093, 741, 31426, 6093, 1669, 2473, 7121, 47583,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestInitRotZapFromCfgFile(t *testing.T) { exePath, err := osext.ExecutableFolder() if err != nil { t.Fatal(err) } path := filepath.Join(exePath, "sample") zapLog, err := InitRotZapFromCfgFile(path) if err != nil { t.Fatal(err) } defer zapLog.Sync() zapLog.Info("[TestInitRotZapFromCfgFile] RotZap provide an easy way to initialize zap with file-rotatelogs") zapLog.Error("[TestInitRotZapFromCfgFile] RotZap provide an easy way to initialize zap with file-rotatelogs") }
explode_data.jsonl/53067
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 195 }
[ 2830, 3393, 3803, 36936, 57, 391, 3830, 42467, 1703, 1155, 353, 8840, 836, 8, 341, 8122, 68, 1820, 11, 1848, 1669, 297, 325, 2252, 30798, 5922, 13682, 741, 743, 1848, 961, 2092, 341, 197, 3244, 26133, 3964, 340, 197, 532, 26781, 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...
3
func Test_IntArray_Basic(t *testing.T) { gtest.C(t, func(t *gtest.T) { expect := []int{0, 1, 2, 3} expect2 := []int{} array := garray.NewIntArrayFrom(expect) array2 := garray.NewIntArrayFrom(expect2) t.Assert(array.Slice(), expect) t.Assert(array.Interfaces(), expect) array.Set(0, 100) v, ok := array.Get(0) t.Assert(v, 100) t.Assert(ok, true) v, ok = array.Get(1) t.Assert(v, 1) t.Assert(ok, true) t.Assert(array.Search(100), 0) t.Assert(array2.Search(100), -1) t.Assert(array.Contains(100), true) v, ok = array.Remove(0) t.Assert(v, 100) t.Assert(ok, true) v, ok = array.Remove(-1) t.Assert(v, 0) t.Assert(ok, false) v, ok = array.Remove(100000) t.Assert(v, 0) t.Assert(ok, false) t.Assert(array.Contains(100), false) array.Append(4) t.Assert(array.Len(), 4) array.InsertBefore(0, 100) array.InsertAfter(0, 200) t.Assert(array.Slice(), []int{100, 200, 1, 2, 3, 4}) array.InsertBefore(5, 300) array.InsertAfter(6, 400) t.Assert(array.Slice(), []int{100, 200, 1, 2, 3, 300, 4, 400}) t.Assert(array.Clear().Len(), 0) }) }
explode_data.jsonl/47594
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 544 }
[ 2830, 3393, 32054, 1857, 1668, 5971, 1155, 353, 8840, 836, 8, 341, 3174, 1944, 727, 1155, 11, 2915, 1155, 353, 82038, 836, 8, 341, 197, 24952, 1669, 3056, 396, 90, 15, 11, 220, 16, 11, 220, 17, 11, 220, 18, 532, 197, 24952, 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 TestVariableRefMaps(t *testing.T) { th := NewKustTestHarness(t, "/app/base") th.writeK("/app/base", ` resources: - deployment.yaml - namespace.yaml vars: - name: NAMESPACE objref: apiVersion: v1 kind: Namespace name: my-namespace `) th.writeF("/app/base/deployment.yaml", ` apiVersion: apps/v1 kind: Deployment metadata: name: my-deployment labels: my-label: $(NAMESPACE) spec: template: spec: containers: - name: app image: busybox `) th.writeF("/app/base/namespace.yaml", ` apiVersion: v1 kind: Namespace metadata: name: my-namespace `) m, err := th.makeKustTarget().MakeCustomizedResMap() if err != nil { t.Fatalf("Err: %v", err) } th.assertActualEqualsExpected(m, ` apiVersion: v1 kind: Namespace metadata: name: my-namespace --- apiVersion: apps/v1 kind: Deployment metadata: labels: my-label: my-namespace name: my-deployment spec: template: spec: containers: - image: busybox name: app `) }
explode_data.jsonl/35772
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 459 }
[ 2830, 3393, 7827, 3945, 36562, 1155, 353, 8840, 836, 8, 341, 70479, 1669, 1532, 42, 590, 2271, 74248, 1155, 11, 3521, 676, 26090, 1138, 70479, 3836, 42, 4283, 676, 26090, 497, 22074, 12745, 510, 12, 23172, 33406, 198, 12, 4473, 33406, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestElasticsearchTagsFileDoNotExist(t *testing.T) { f := NewFactory() mockConf := &mockClientBuilder{} mockConf.Tags.File = "fixtures/tags_foo.txt" f.primaryConfig = mockConf f.archiveConfig = mockConf assert.NoError(t, f.Initialize(metrics.NullFactory, zap.NewNop())) r, err := f.CreateSpanWriter() require.Error(t, err) assert.Nil(t, r) }
explode_data.jsonl/37906
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 141 }
[ 2830, 3393, 36, 51179, 1836, 15930, 1703, 5404, 45535, 1155, 353, 8840, 836, 8, 341, 1166, 1669, 1532, 4153, 741, 77333, 15578, 1669, 609, 16712, 2959, 3297, 16094, 77333, 15578, 73522, 8576, 284, 330, 45247, 84460, 761, 2624, 3909, 698, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestGrpcCasEmptySha256(t *testing.T) { // Check that we can "download" an empty blob, even if it hasn't // been uploaded. emptySum := sha256.Sum256([]byte{}) emptyDigest := pb.Digest{ Hash: hex.EncodeToString(emptySum[:]), SizeBytes: 0, } downReq := pb.BatchReadBlobsRequest{ Digests: []*pb.Digest{&emptyDigest}, } downResp, err := casClient.BatchReadBlobs(ctx, &downReq) if err != nil { t.Fatal(err) } if len(downResp.GetResponses()) != 1 { t.Fatal("Expected 1 response, got", len(downResp.GetResponses())) } }
explode_data.jsonl/61977
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 230 }
[ 2830, 3393, 6464, 3992, 49242, 3522, 62316, 17, 20, 21, 1155, 353, 8840, 836, 8, 1476, 197, 322, 4248, 429, 582, 646, 330, 12885, 1, 458, 4287, 23404, 11, 1496, 421, 432, 12492, 944, 198, 197, 322, 1012, 22853, 382, 197, 3194, 9190,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestFileSetFile(t *testing.T) { path, tearDown := setupConfigFile(t, minimalConfig) defer tearDown() fs, err := config.NewFileStore(path, true) require.NoError(t, err) defer fs.Close() t.Run("set new file", func(t *testing.T) { err := fs.SetFile("new", []byte("new file")) require.NoError(t, err) data, err := fs.GetFile("new") require.NoError(t, err) require.Equal(t, []byte("new file"), data) }) t.Run("overwrite existing file", func(t *testing.T) { err := fs.SetFile("existing", []byte("existing file")) require.NoError(t, err) err = fs.SetFile("existing", []byte("overwritten file")) require.NoError(t, err) data, err := fs.GetFile("existing") require.NoError(t, err) require.Equal(t, []byte("overwritten file"), data) }) t.Run("set via absolute path", func(t *testing.T) { absolutePath := filepath.Join(filepath.Dir(path), "new") err := fs.SetFile(absolutePath, []byte("new file")) require.NoError(t, err) data, err := fs.GetFile("new") require.NoError(t, err) require.Equal(t, []byte("new file"), data) }) t.Run("should set right permissions", func(t *testing.T) { absolutePath := filepath.Join(filepath.Dir(path), "new") err := fs.SetFile(absolutePath, []byte("data")) require.NoError(t, err) fi, err := os.Stat(absolutePath) require.NoError(t, err) require.Equal(t, os.FileMode(0600), fi.Mode().Perm()) }) }
explode_data.jsonl/32386
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 542 }
[ 2830, 3393, 1703, 1649, 1703, 1155, 353, 8840, 836, 8, 341, 26781, 11, 32825, 1669, 6505, 2648, 1703, 1155, 11, 17377, 2648, 340, 16867, 32825, 2822, 53584, 11, 1848, 1669, 2193, 7121, 1703, 6093, 5581, 11, 830, 340, 17957, 35699, 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 TestFloat32_SortedList(t *testing.T) { testcases := []struct { name string s Float32 expect []float32 }{ { name: "test Float32 List, s is empty", s: Float32{}, }, { name: "test Float32 SortedList, s is not empty", s: map[float32]struct{}{1: {}, 2: {}, 3: {}}, expect: []float32{1, 2, 3}, }, } for _, tc := range testcases { t.Logf("running scenario: %s", tc.name) actual := tc.s.SortedList(func(i, j float32) bool { return i < j }) if len(actual) != len(tc.expect) { t.Errorf("expect set len: %d, but got: %d", len(tc.expect), len(actual)) } for i := 0; i < len(tc.expect); i++ { if actual[i] != tc.expect[i] { t.Errorf("expect slice: %v, but got: %v", tc.expect, actual) } } } }
explode_data.jsonl/60111
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 371 }
[ 2830, 3393, 5442, 18, 17, 1098, 13595, 852, 1155, 353, 8840, 836, 8, 341, 18185, 23910, 1669, 3056, 1235, 341, 197, 11609, 256, 914, 198, 197, 1903, 414, 13001, 18, 17, 198, 197, 24952, 3056, 3649, 18, 17, 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 TestExtractDependencies(t *testing.T) { annotations := map[string]string{ meta.CellDependenciesAnnotationKey: "[{\"org\":\"izza\",\"name\":\"emp-comp\",\"version\":\"0.0.4\",\"instance\":\"emp-comp-0-0-4-a1471a5b\",\"kind\":\"Composite\"},{\"org\":\"izza\",\"name\":\"stock-comp\",\"version\":\"0.0.4\",\"instance\":\"stock-comp-0-0-4-7af583f3\",\"kind\":\"Cell\"}]", } expected := []map[string]string{ { "org": "izza", "name": "emp-comp", "version": "0.0.4", "instance": "emp-comp-0-0-4-a1471a5b", "kind": "Composite", }, { "org": "izza", "name": "stock-comp", "version": "0.0.4", "instance": "stock-comp-0-0-4-7af583f3", "kind": "Cell", }, } actual, err := ExtractDependencies(annotations) if err != nil { t.Errorf("Error while executing ExtractDependencies \n %v", err) } if diff := cmp.Diff(expected, actual); diff != "" { t.Errorf("ExtractDependencies (-expected, +actual)\n%v", diff) } }
explode_data.jsonl/54871
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 447 }
[ 2830, 3393, 28959, 48303, 1155, 353, 8840, 836, 8, 341, 197, 39626, 1669, 2415, 14032, 30953, 515, 197, 84004, 32409, 48303, 19711, 1592, 25, 10545, 64238, 1775, 23488, 13741, 34333, 606, 23488, 3262, 62150, 34333, 4366, 23488, 15, 13, 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 TestUTXOIDVerifyNil(t *testing.T) { utxoID := (*UTXOID)(nil) if err := utxoID.Verify(); err == nil { t.Fatalf("Should have errored due to a nil utxo ID") } }
explode_data.jsonl/13786
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 76 }
[ 2830, 3393, 1381, 55, 29805, 32627, 19064, 1155, 353, 8840, 836, 8, 341, 197, 332, 40822, 915, 1669, 4609, 1381, 55, 29805, 2376, 8385, 692, 743, 1848, 1669, 8621, 40822, 915, 54853, 2129, 1848, 621, 2092, 341, 197, 3244, 30762, 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 ]
2
func TestNextRecord(t *testing.T) { const ( path = "/tmp/master_client_TestFull" total = 50 ) l, err := net.Listen("tcp", ":0") if err != nil { panic(err) } ss := strings.Split(l.Addr().String(), ":") p, err := strconv.Atoi(ss[len(ss)-1]) if err != nil { panic(err) } go func(l net.Listener) { s, err := master.NewService(&master.InMemStore{}, 1, time.Second*60, 1) if err != nil { panic(err) } server := rpc.NewServer() err = server.Register(s) if err != nil { panic(err) } mux := http.NewServeMux() mux.Handle(rpc.DefaultRPCPath, server) err = http.Serve(l, mux) if err != nil { panic(err) } }(l) f, err := os.Create(path) if err != nil { panic(err) } w := recordio.NewWriter(f, 1, -1) for i := 0; i < total; i++ { _, err = w.Write([]byte{byte(i)}) if err != nil { panic(err) } } err = w.Close() if err != nil { panic(err) } err = f.Close() if err != nil { panic(err) } // start several client to test task fetching var wg sync.WaitGroup for i := 0; i < 4; i++ { wg.Add(1) // test for multiple concurrent clients go func() { defer wg.Done() // each go-routine needs a single client connection instance c, e := master.NewClient(master.WithAddr(fmt.Sprintf(":%d", p)), master.WithBuffer(1)) if e != nil { t.Fatal(e) } e = c.SetDataset([]string{path}) if e != nil { panic(e) } // test for n passes for pass := 0; pass < 10; pass++ { c.StartGetRecords(pass) received := make(map[byte]bool) taskid := 0 for { r, e := c.NextRecord() if e != nil { // ErrorPassAfter will wait, else break for next pass if e.Error() == master.ErrPassBefore.Error() || e.Error() == master.ErrNoMoreAvailable.Error() { break } t.Fatal(pass, taskid, "Read error:", e) } if len(r) != 1 { t.Fatal(pass, taskid, "Length should be 1.", r) } if received[r[0]] { t.Fatal(pass, taskid, "Received duplicate.", received, r) } taskid++ received[r[0]] = true } } }() } wg.Wait() }
explode_data.jsonl/63047
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1004 }
[ 2830, 3393, 5847, 6471, 1155, 353, 8840, 836, 8, 341, 4777, 2399, 197, 26781, 220, 284, 3521, 5173, 23303, 8179, 32541, 9432, 698, 197, 34493, 284, 220, 20, 15, 198, 197, 340, 8810, 11, 1848, 1669, 4179, 68334, 445, 27161, 497, 13022,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestClientRefreshMetadataBrokerOffline(t *testing.T) { seedBroker := NewMockBroker(t, 1) leader := NewMockBroker(t, 5) metadataResponse1 := new(MetadataResponse) metadataResponse1.AddBroker(leader.Addr(), leader.BrokerID()) metadataResponse1.AddBroker(seedBroker.Addr(), seedBroker.BrokerID()) seedBroker.Returns(metadataResponse1) client, err := NewClient([]string{seedBroker.Addr()}, NewTestConfig()) if err != nil { t.Fatal(err) } if len(client.Brokers()) != 2 { t.Error("Meta broker is not 2") } metadataResponse2 := new(MetadataResponse) metadataResponse2.AddBroker(leader.Addr(), leader.BrokerID()) seedBroker.Returns(metadataResponse2) if err := client.RefreshMetadata(); err != nil { t.Error(err) } if len(client.Brokers()) != 1 { t.Error("Meta broker is not 1") } }
explode_data.jsonl/54408
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 295 }
[ 2830, 3393, 2959, 14567, 14610, 65545, 52563, 1155, 353, 8840, 836, 8, 341, 197, 22602, 65545, 1669, 1532, 11571, 65545, 1155, 11, 220, 16, 340, 197, 37391, 1669, 1532, 11571, 65545, 1155, 11, 220, 20, 692, 2109, 7603, 2582, 16, 1669, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
5
func TestNewUser(t *testing.T) { type args struct { email string pass string } tests := map[string]struct { args args want *User err error }{ "メールアドレスにhoge@hoge.comとパスワードにpassを指定してインスタンスが作成されること": { args: args{"hoge@hoge.com", "pass"}, want: &User{ ID: "aG9nZUBob2dlLmNvbQ", EMail: "hoge@hoge.com", Password: "pass", Auth: 2, }, }, "メールアドレスにfuga@fuga.comとパスワードにpassを指定してインスタンスが作成されること": { args: args{"fuga@fuga.com", "pass"}, want: &User{ ID: "ZnVnYUBmdWdhLmNvbQ", EMail: "fuga@fuga.com", Password: "pass", Auth: 2, }, }, "メールアドレスがからのときにインスタンスがnilになりエラーが返ってくること": { args: args{"", "pass"}, err: errors.New("E-mail address is empty"), }, } for testName, arg := range tests { t.Run(testName, func(t *testing.T) { sut, err := NewUser(arg.args.email, arg.args.pass) if reflect.DeepEqual(err, arg.err) == false { t.Errorf("Error actual: %v, expected: %v", err, arg.err) } if reflect.DeepEqual(sut, arg.want) == false { t.Errorf("Not equals actual: %v, expected: %v", sut, arg.want) } }) } }
explode_data.jsonl/9500
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 633 }
[ 2830, 3393, 3564, 1474, 1155, 353, 8840, 836, 8, 341, 13158, 2827, 2036, 341, 197, 57549, 914, 198, 197, 41431, 220, 914, 198, 197, 532, 78216, 1669, 2415, 14032, 60, 1235, 341, 197, 31215, 2827, 198, 197, 50780, 353, 1474, 198, 197, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestTransformResponse(t *testing.T) { invalid := []byte("aaaaa") uri, _ := url.Parse("http://localhost") testCases := []struct { Response *http.Response Data []byte Created bool Error bool ErrFn func(err error) bool }{ {Response: &http.Response{StatusCode: 200}, Data: []byte{}}, {Response: &http.Response{StatusCode: 201}, Data: []byte{}, Created: true}, {Response: &http.Response{StatusCode: 199}, Error: true}, {Response: &http.Response{StatusCode: 500}, Error: true}, {Response: &http.Response{StatusCode: 422}, Error: true}, {Response: &http.Response{StatusCode: 409}, Error: true}, {Response: &http.Response{StatusCode: 404}, Error: true}, {Response: &http.Response{StatusCode: 401}, Error: true}, { Response: &http.Response{ StatusCode: 401, Header: http.Header{"Content-Type": []string{"application/json"}}, Body: ioutil.NopCloser(bytes.NewReader(invalid)), }, Error: true, ErrFn: func(err error) bool { return err.Error() != "aaaaa" && apierrors.IsUnauthorized(err) }, }, { Response: &http.Response{ StatusCode: 401, Header: http.Header{"Content-Type": []string{"text/any"}}, Body: ioutil.NopCloser(bytes.NewReader(invalid)), }, Error: true, ErrFn: func(err error) bool { return strings.Contains(err.Error(), "server has asked for the client to provide") && apierrors.IsUnauthorized(err) }, }, {Response: &http.Response{StatusCode: 403}, Error: true}, {Response: &http.Response{StatusCode: 200, Body: ioutil.NopCloser(bytes.NewReader(invalid))}, Data: invalid}, {Response: &http.Response{StatusCode: 200, Body: ioutil.NopCloser(bytes.NewReader(invalid))}, Data: invalid}, } for i, test := range testCases { r := NewRequest(nil, "", uri, "", defaultContentConfig(), defaultSerializers(t), nil, nil, 0) if test.Response.Body == nil { test.Response.Body = ioutil.NopCloser(bytes.NewReader([]byte{})) } result := r.transformResponse(test.Response, &http.Request{}) response, created, err := result.body, result.statusCode == http.StatusCreated, result.err hasErr := err != nil if hasErr != test.Error { t.Errorf("%d: unexpected error: %t %v", i, test.Error, err) } else if hasErr && test.Response.StatusCode > 399 { status, ok := err.(apierrors.APIStatus) if !ok { t.Errorf("%d: response should have been transformable into APIStatus: %v", i, err) continue } if int(status.Status().Code) != test.Response.StatusCode { t.Errorf("%d: status code did not match response: %#v", i, status.Status()) } } if test.ErrFn != nil && !test.ErrFn(err) { t.Errorf("%d: error function did not match: %v", i, err) } if !(test.Data == nil && response == nil) && !apiequality.Semantic.DeepDerivative(test.Data, response) { t.Errorf("%d: unexpected response: %#v %#v", i, test.Data, response) } if test.Created != created { t.Errorf("%d: expected created %t, got %t", i, test.Created, created) } } }
explode_data.jsonl/13264
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1179 }
[ 2830, 3393, 8963, 2582, 1155, 353, 8840, 836, 8, 341, 197, 11808, 1669, 3056, 3782, 445, 28458, 64, 1138, 197, 6070, 11, 716, 1669, 2515, 8937, 445, 1254, 1110, 8301, 1138, 18185, 37302, 1669, 3056, 1235, 341, 197, 69604, 353, 1254, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestMappingRuleClone(t *testing.T) { inputs := []*mappingRule{ testMappingRule1, testMappingRule2, testMappingRule3, } for _, input := range inputs { cloned := input.clone() require.True(t, cmp.Equal(&cloned, input, testMappingRuleCmpOpts...)) // Asserting that modifying the clone doesn't modify the original mapping rule. cloned2 := input.clone() require.True(t, cmp.Equal(&cloned2, input, testMappingRuleCmpOpts...)) cloned2.snapshots[0].tombstoned = true require.False(t, cmp.Equal(&cloned2, input, testMappingRuleCmpOpts...)) require.True(t, cmp.Equal(&cloned, input, testMappingRuleCmpOpts...)) } }
explode_data.jsonl/64574
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 251 }
[ 2830, 3393, 6807, 11337, 37677, 1155, 353, 8840, 836, 8, 341, 22427, 82, 1669, 29838, 40792, 11337, 515, 197, 18185, 6807, 11337, 16, 345, 197, 18185, 6807, 11337, 17, 345, 197, 18185, 6807, 11337, 18, 345, 197, 532, 2023, 8358, 1946, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestStopsAtRecursiveMessage(t *testing.T) { testConvert(t, ` file_to_generate: "foo.proto" proto_file < name: "foo.proto" package: "example_package.recursive" message_type < name: "FooProto" field < name: "i1" number: 1 type: TYPE_INT32 label: LABEL_OPTIONAL > field < name: "bar" number: 2 type: TYPE_MESSAGE label: LABEL_OPTIONAL type_name: "BarProto" > options < [gen_bq_schema.bigquery_opts] <table_name: "foo_table"> > > message_type < name: "BarProto" field < name: "i2" number: 1 type: TYPE_INT32 label: LABEL_OPTIONAL > field < name: "foo" number: 2 type: TYPE_MESSAGE label: LABEL_OPTIONAL type_name: "FooProto" > > > `, map[string]string{ "example_package/recursive/foo_table.schema": `[ { "name": "i1", "type": "INTEGER", "mode": "NULLABLE" }, { "name": "bar", "type": "RECORD", "mode": "NULLABLE", "fields": [{ "name": "i2", "type": "INTEGER", "mode": "NULLABLE" }] } ]`, }) }
explode_data.jsonl/41114
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 612 }
[ 2830, 3393, 623, 3721, 1655, 78542, 2052, 1155, 353, 8840, 836, 8, 341, 18185, 12012, 1155, 11, 22074, 298, 17661, 2346, 48851, 25, 330, 7975, 57322, 698, 298, 197, 15110, 2458, 77565, 571, 11609, 25, 330, 7975, 57322, 698, 571, 197, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func Test_initBasicConfig(t *testing.T) { tests := []struct { name string want baseConfig }{ { name: "test without viper", want: baseConfig{}, }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { if got := initBasicConfig(); !reflect.DeepEqual(got, tt.want) { t.Errorf("initBasicConfig() = %v, want %v", got, tt.want) } }) } workdir := filesystem.GetWorkdirOrDie() os.Create(workdir + "/.go-gadgeto-config.yml") file, _ := os.OpenFile(workdir+"/.go-gadgeto-config.yml", os.O_APPEND|os.O_WRONLY, 0644) defer file.Close() if _, err := file.WriteString("package: helloworld"); err != nil { log.Fatal(err) } tests = []struct { name string want baseConfig }{ { name: "test with viper", want: baseConfig{ ProjectPath: workdir, PackagePath: "helloworld", }, }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { if got := initBasicConfig(); !reflect.DeepEqual(got, tt.want) { t.Errorf("initBasicConfig() = %v, want %v", got, tt.want) } }) } os.Remove(workdir + "/.go-gadgeto-config.yml") }
explode_data.jsonl/27202
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 496 }
[ 2830, 3393, 6137, 15944, 2648, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 3056, 1235, 341, 197, 11609, 914, 198, 197, 50780, 2331, 2648, 198, 197, 59403, 197, 197, 515, 298, 11609, 25, 330, 1944, 2041, 95132, 756, 298, 50780, 25, 2331...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestGenerateDSNSupportsInsecureSkipVerify(t *testing.T) { os.Args = []string{ "cmd", "-hostname=dbhost", "-username=dbuser", "-password=dbpwd", "-port=1234", "-insecure_skip_verify", } _, err := integration.New(integrationName, integrationVersion, integration.Args(&args)) fatalIfErr(err) assert.Equal(t, "dbuser:dbpwd@tcp(dbhost:1234)/?tls=skip-verify", generateDSN(args)) flag.CommandLine = flag.NewFlagSet("cmd", flag.ContinueOnError) }
explode_data.jsonl/13423
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 186 }
[ 2830, 3393, 31115, 5936, 2448, 2800, 82, 641, 25132, 35134, 32627, 1155, 353, 8840, 836, 8, 341, 25078, 51015, 284, 3056, 917, 515, 197, 197, 1, 8710, 756, 197, 197, 34294, 27806, 57752, 3790, 756, 197, 197, 34294, 5113, 57752, 872, 7...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestAbbreviatedIDs(t *testing.T) { cids := []string{ "foo-" + testutil.UniqueContainerID(), "bar-" + testutil.UniqueContainerID(), "baz-" + testutil.UniqueContainerID(), } rootDir, err := testutil.SetupRootDir() if err != nil { t.Fatalf("error creating root dir: %v", err) } for _, cid := range cids { spec := testutil.NewSpecWithArgs("sleep", "100") conf := testutil.TestConfig() bundleDir, err := testutil.SetupContainerInRoot(rootDir, spec, conf) if err != nil { t.Fatalf("error setting up container: %v", err) } defer os.RemoveAll(rootDir) defer os.RemoveAll(bundleDir) // Create and start the container. cont, err := container.Create(cid, spec, conf, bundleDir, "", "") if err != nil { t.Fatalf("error creating container: %v", err) } defer cont.Destroy() } // These should all be unambigious. unambiguous := map[string]string{ "f": cids[0], cids[0]: cids[0], "bar": cids[1], cids[1]: cids[1], "baz": cids[2], cids[2]: cids[2], } for shortid, longid := range unambiguous { if _, err := container.Load(rootDir, shortid); err != nil { t.Errorf("%q should resolve to %q: %v", shortid, longid, err) } } // These should be ambiguous. ambiguous := []string{ "b", "ba", } for _, shortid := range ambiguous { if s, err := container.Load(rootDir, shortid); err == nil { t.Errorf("%q should be ambiguous, but resolved to %q", shortid, s.ID) } } }
explode_data.jsonl/48929
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 588 }
[ 2830, 3393, 80219, 7282, 10029, 30466, 1155, 353, 8840, 836, 8, 341, 1444, 3365, 1669, 3056, 917, 515, 197, 197, 1, 7975, 27651, 488, 1273, 1314, 87443, 4502, 915, 3148, 197, 197, 1, 2257, 27651, 488, 1273, 1314, 87443, 4502, 915, 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...
9
func TestHostSpoof(t *testing.T) { o := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) { w.Write([]byte("OK!")) })) originURL, _ := url.Parse(o.URL) p, c := testProxy(WithHosts([]Spoofer{ &spoof{regexp.MustCompile(`^test\.com:80$`), originURL.Host}, })) defer p.Close() defer o.Close() res, err := c.Get("http://test.com/") if err != nil { t.Fatal(err) } defer res.Body.Close() b, _ := ioutil.ReadAll(res.Body) if bytes.Compare(b, []byte("OK!")) != 0 { t.Fatalf("invalid response received from origin: expected response to contain '%s', got '%s'", "OK!", b) } }
explode_data.jsonl/12954
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 267 }
[ 2830, 3393, 9296, 68680, 1055, 1155, 353, 8840, 836, 8, 341, 22229, 1669, 54320, 70334, 7121, 5475, 19886, 89164, 18552, 3622, 1758, 37508, 11, 4232, 353, 1254, 9659, 8, 341, 197, 6692, 4073, 10556, 3782, 445, 3925, 0, 5455, 197, 44194,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestHitConditionBreakpoints(t *testing.T) { runTest(t, "break", func(client *daptest.Client, fixture protest.Fixture) { runDebugSessionWithBPs(t, client, "launch", // Launch func() { client.LaunchRequest("exec", fixture.Path, !stopOnEntry) }, // Set breakpoints fixture.Source, []int{4}, []onBreakpoint{{ execute: func() { client.SetHitConditionalBreakpointsRequest(fixture.Source, []int{7}, map[int]string{7: "4"}) expectSetBreakpointsResponse(t, client, []Breakpoint{{7, fixture.Source, true, ""}}) client.ContinueRequest(1) client.ExpectContinueResponse(t) client.ExpectStoppedEvent(t) checkStop(t, client, 1, "main.main", 7) // Check that we are stopped at the correct value of i. client.VariablesRequest(1001) locals := client.ExpectVariablesResponse(t) checkVarExact(t, locals, 0, "i", "i", "4", "int", noChildren) // Change the hit condition. client.SetHitConditionalBreakpointsRequest(fixture.Source, []int{7}, map[int]string{7: "% 2"}) expectSetBreakpointsResponse(t, client, []Breakpoint{{7, fixture.Source, true, ""}}) client.ContinueRequest(1) client.ExpectContinueResponse(t) client.ExpectStoppedEvent(t) checkStop(t, client, 1, "main.main", 7) // Check that we are stopped at the correct value of i. client.VariablesRequest(1001) locals = client.ExpectVariablesResponse(t) checkVarExact(t, locals, 0, "i", "i", "6", "int", noChildren) // Expect an error if an assignment is passed. client.SetHitConditionalBreakpointsRequest(fixture.Source, []int{7}, map[int]string{7: "= 2"}) expectSetBreakpointsResponse(t, client, []Breakpoint{{-1, "", false, ""}}) // Change the hit condition. client.SetHitConditionalBreakpointsRequest(fixture.Source, []int{7}, map[int]string{7: "< 8"}) expectSetBreakpointsResponse(t, client, []Breakpoint{{7, fixture.Source, true, ""}}) client.ContinueRequest(1) client.ExpectContinueResponse(t) client.ExpectStoppedEvent(t) checkStop(t, client, 1, "main.main", 7) // Check that we are stopped at the correct value of i. client.VariablesRequest(1001) locals = client.ExpectVariablesResponse(t) checkVarExact(t, locals, 0, "i", "i", "7", "int", noChildren) client.ContinueRequest(1) client.ExpectContinueResponse(t) client.ExpectTerminatedEvent(t) }, disconnect: false, }}) }) }
explode_data.jsonl/17329
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 979 }
[ 2830, 3393, 19498, 10547, 22524, 7706, 1155, 353, 8840, 836, 8, 341, 56742, 2271, 1155, 11, 330, 8960, 497, 2915, 12805, 353, 91294, 1944, 11716, 11, 12507, 8665, 991, 12735, 8, 341, 197, 56742, 7939, 5283, 2354, 33, 20420, 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 TestEncryption(t *testing.T) { s, c, err := newTestInstance(nil) if err != nil { t.Fatal(err) } defer s.close() defer c.Close() ctx := context.Background() if _, err = c.SendAcctRequest(ctx, testAcctReq); err != nil { t.Fatal(err) } c.Close() c.ConnConfig.Secret = []byte("bad secret") if _, err = c.SendAcctRequest(ctx, testAcctReq); err != errBadPacket { t.Fatal(err) } if err := s.err(); err != errBadPacket { t.Fatalf("want %v: got %v", errBadPacket, err) } }
explode_data.jsonl/53846
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 216 }
[ 2830, 3393, 79239, 1155, 353, 8840, 836, 8, 341, 1903, 11, 272, 11, 1848, 1669, 501, 2271, 2523, 27907, 340, 743, 1848, 961, 2092, 341, 197, 3244, 26133, 3964, 340, 197, 532, 16867, 274, 4653, 741, 16867, 272, 10421, 2822, 20985, 1669...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
5
func Test_transformIndex(t *testing.T) { tests := []struct { name string indexes []string transformRules []MetricIndexTransform expectedNewIndexes []string }{ { "no rule", []string{"10", "11", "12", "13"}, []MetricIndexTransform{}, nil, }, { "one", []string{"10", "11", "12", "13"}, []MetricIndexTransform{ {2, 3}, }, []string{"12", "13"}, }, { "multi", []string{"10", "11", "12", "13"}, []MetricIndexTransform{ {2, 2}, {0, 1}, }, []string{"12", "10", "11"}, }, { "out of index end", []string{"10", "11", "12", "13"}, []MetricIndexTransform{ {2, 1000}, }, nil, }, { "out of index start and end", []string{"10", "11", "12", "13"}, []MetricIndexTransform{ {1000, 2000}, }, nil, }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { newIndexes := transformIndex(tt.indexes, tt.transformRules) assert.Equal(t, tt.expectedNewIndexes, newIndexes) }) } }
explode_data.jsonl/74036
{ "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, 18449, 1552, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 3056, 1235, 341, 197, 11609, 2290, 914, 198, 197, 26327, 288, 310, 3056, 917, 198, 197, 50224, 26008, 257, 3056, 54310, 1552, 8963, 198, 197, 42400, 3564, 62229, 3056, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestGrtGcloudVMsError(t *testing.T) { execCommand = fakeVMsCommandError defer func() { execCommand = exec.Command }() project := projectDetails{ ProjectID: "irrelevant", } _, err := getGcloudVMs(project) assert.NotNil(t, err) }
explode_data.jsonl/13296
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 90 }
[ 2830, 3393, 38, 3342, 38, 12361, 11187, 82, 1454, 1155, 353, 8840, 836, 8, 341, 67328, 4062, 284, 12418, 11187, 82, 4062, 1454, 198, 16867, 2915, 368, 314, 3883, 4062, 284, 3883, 12714, 335, 2822, 72470, 1669, 2390, 7799, 515, 197, 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 TestScheduler_Stop(t *testing.T) { s := NewWithLocation(10, monitoring.NewRegistry(), tarawaTime()) executed := make(chan struct{}) require.NoError(t, s.Start()) require.NoError(t, s.Stop()) _, err := s.Add(testSchedule{}, "testPostStop", testTaskTimes(1, func(_ context.Context) []TaskFunc { executed <- struct{}{} return nil })) assert.Equal(t, ErrAlreadyStopped, err) }
explode_data.jsonl/68484
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 146 }
[ 2830, 3393, 38878, 80308, 1155, 353, 8840, 836, 8, 341, 1903, 1669, 1532, 2354, 4707, 7, 16, 15, 11, 16558, 7121, 15603, 1507, 12183, 14077, 1462, 12367, 67328, 2774, 1669, 1281, 35190, 2036, 6257, 692, 17957, 35699, 1155, 11, 274, 1210...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestGatherMachineConfigPool(t *testing.T) { var machineconfigpoolYAML = ` apiVersion: machineconfiguration.openshift.io/v1 kind: MachineConfigPool metadata: name: master-t ` gvr := schema.GroupVersionResource{Group: "machineconfiguration.openshift.io", Version: "v1", Resource: "machineconfigpools"} client := dynamicfake.NewSimpleDynamicClient(runtime.NewScheme()) decUnstructured := yaml.NewDecodingSerializer(unstructured.UnstructuredJSONScheme) testMachineConfigPools := &unstructured.Unstructured{} _, _, err := decUnstructured.Decode([]byte(machineconfigpoolYAML), nil, testMachineConfigPools) if err != nil { t.Fatal("unable to decode machineconfigpool ", err) } _, err = client.Resource(gvr).Create(context.Background(), testMachineConfigPools, metav1.CreateOptions{}) if err != nil { t.Fatal("unable to create fake machineconfigpool ", err) } gatherer := &Gatherer{dynamicClient: client} records, errs := GatherMachineConfigPool(gatherer)() if len(errs) > 0 { t.Errorf("unexpected errors: %#v", errs) return } if len(records) != 1 { t.Fatalf("unexpected number or records %d", len(records)) } if records[0].Name != "config/machineconfigpools/master-t" { t.Fatalf("unexpected machineconfigpool name %s", records[0].Name) } }
explode_data.jsonl/32593
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 441 }
[ 2830, 3393, 38, 1856, 21605, 2648, 10551, 1155, 353, 8840, 836, 8, 341, 2405, 5662, 1676, 10285, 56, 31102, 284, 22074, 2068, 5637, 25, 5662, 21138, 42515, 47833, 4245, 5457, 16, 198, 15314, 25, 12960, 2648, 10551, 198, 17637, 510, 262,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestPluralize(t *testing.T) { tfs := map[string]*schema.Schema{ "some_thing": { Type: schema.TypeSet, }, "some_other_thing": { Type: schema.TypeSet, MaxItems: 1, }, "all_things": { Type: schema.TypeSet, }, } terraformToPulumiName := func(k string) string { return TerraformToPulumiName(k, shimv1.NewSchema(tfs[k]), nil, false) } assert.Equal(t, "someThings", terraformToPulumiName("some_thing")) assert.Equal(t, "someOtherThing", terraformToPulumiName("some_other_thing")) assert.Equal(t, "allThings", terraformToPulumiName("all_things")) pulumiToTerraformName := func(k string) string { return PulumiToTerraformName(k, shimv1.NewSchemaMap(tfs), nil) } assert.Equal(t, "some_thing", pulumiToTerraformName("someThings")) assert.Equal(t, "some_other_things", pulumiToTerraformName("someOtherThings")) assert.Equal(t, "all_things", pulumiToTerraformName("allThings")) }
explode_data.jsonl/36108
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 384 }
[ 2830, 3393, 2120, 4176, 551, 1155, 353, 8840, 836, 8, 341, 3244, 3848, 1669, 2415, 14032, 8465, 17349, 21105, 515, 197, 197, 1, 14689, 62, 1596, 788, 341, 298, 27725, 25, 10802, 10184, 1649, 345, 197, 197, 1583, 197, 197, 1, 14689, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestBulkUpload(t *testing.T) { ctx := context.Background() c, rollback := makeConnectionWithContainer(t) defer rollback() buffer := new(bytes.Buffer) ds := tar.NewWriter(buffer) var files = []struct{ Name, Body string }{ {OBJECT, CONTENTS}, {OBJECT2, CONTENTS2}, } for _, file := range files { hdr := &tar.Header{ Name: file.Name, Size: int64(len(file.Body)), } if err := ds.WriteHeader(hdr); err != nil { t.Fatal(err) } if _, err := ds.Write([]byte(file.Body)); err != nil { t.Fatal(err) } } if err := ds.Close(); err != nil { t.Fatal(err) } result, err := c.BulkUpload(ctx, CONTAINER, buffer, swift.UploadTar, nil) if err == swift.Forbidden { t.Log("Server doesn't support BulkUpload - skipping test") return } if err != nil { t.Fatal(err) } defer func() { err = c.ObjectDelete(ctx, CONTAINER, OBJECT) if err != nil { t.Fatal(err) } err = c.ObjectDelete(ctx, CONTAINER, OBJECT2) if err != nil { t.Fatal(err) } }() if result.NumberCreated != 2 { t.Error("Expected 2, actual:", result.NumberCreated) } t.Log("Errors:", result.Errors) _, _, err = c.Object(ctx, CONTAINER, OBJECT) if err != nil { t.Error("Expecting object to be found") } _, _, err = c.Object(ctx, CONTAINER, OBJECT2) if err != nil { t.Error("Expecting object to be found") } }
explode_data.jsonl/12716
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 572 }
[ 2830, 3393, 88194, 13844, 1155, 353, 8840, 836, 8, 341, 20985, 1669, 2266, 19047, 741, 1444, 11, 60414, 1669, 1281, 4526, 2354, 4502, 1155, 340, 16867, 60414, 741, 31122, 1669, 501, 23158, 22622, 340, 83336, 1669, 12183, 7121, 6492, 12584...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestSecureDelete(t *testing.T) { trie := newEmptySecure() vals := []struct{ k, v string }{ {"do", "verb"}, {"ether", "wookiedoo"}, {"horse", "stallion"}, {"shaman", "horse"}, {"doge", "coin"}, {"ether", ""}, {"dog", "puppy"}, {"shaman", ""}, } for _, val := range vals { if val.v != "" { trie.Update([]byte(val.k), []byte(val.v)) } else { trie.Delete([]byte(val.k)) } } hash := trie.Hash() exp := digest.FromHex("29b235a58c3c25ab83010c327d5932bcf05324b7d6b1185e650798034783ca9d") if hash != exp { t.Errorf("expected %x got %x", exp, hash) } }
explode_data.jsonl/9325
{ "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, 49813, 6435, 1155, 353, 8840, 836, 8, 341, 197, 8927, 1669, 501, 3522, 49813, 741, 19302, 82, 1669, 3056, 1235, 90, 595, 11, 348, 914, 335, 515, 197, 197, 4913, 2982, 497, 330, 22328, 7115, 197, 197, 4913, 2723, 497, 330...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
4
func TestServiceGobUnregisteredFastFail(t *testing.T) { m, _, shutdown := newTestMachine(t, Services{"GobUnregistered": serviceGobUnregistered{}}) defer shutdown() select { case <-m.Wait(Running): if m.State() == Running { t.Fatalf("machine is running with broken service") } case <-time.After(2 * time.Minute): // If our test environment causes this to falsely fail, we almost // surely have lots of other problems, as this should otherwise fail // almost instantly. t.Fatalf("took too long to fail") } }
explode_data.jsonl/44586
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 171 }
[ 2830, 3393, 1860, 38, 674, 1806, 34909, 32174, 19524, 1155, 353, 8840, 836, 8, 341, 2109, 11, 8358, 23766, 1669, 501, 2271, 21605, 1155, 11, 8307, 4913, 38, 674, 1806, 34909, 788, 2473, 38, 674, 1806, 34909, 90, 71362, 16867, 23766, 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...
4
func TestFindRegistry(t *testing.T) { sys := &types.SystemContext{ SystemRegistriesConfPath: "testdata/find-registry.conf", SystemRegistriesConfDirPath: "testdata/registries.conf.d", } registries, err := GetRegistries(sys) assert.Nil(t, err) assert.Equal(t, 19, len(registries)) reg, err := FindRegistry(sys, "simple-prefix.com/foo/bar:latest") assert.Nil(t, err) assert.NotNil(t, reg) assert.Equal(t, "simple-prefix.com", reg.Prefix) assert.Equal(t, reg.Location, "registry.com:5000") // path match reg, err = FindRegistry(sys, "simple-prefix.com/") assert.Nil(t, err) assert.NotNil(t, reg) // hostname match reg, err = FindRegistry(sys, "simple-prefix.com") assert.Nil(t, err) assert.NotNil(t, reg) // subdomain prefix match reg, err = FindRegistry(sys, "not.so.simple-prefix.com/") assert.Nil(t, err) assert.NotNil(t, reg) assert.Equal(t, "subdomain-prefix.com", reg.Location) reg, err = FindRegistry(sys, "not.quite.simple-prefix.com/") assert.Nil(t, err) assert.NotNil(t, reg) assert.Equal(t, "subdomain-prefix-2.com", reg.Location) reg, err = FindRegistry(sys, "not.quite.simple-prefix.com:5000/with/path/and/beyond:tag") assert.Nil(t, err) assert.NotNil(t, reg) assert.Equal(t, "subdomain-prefix-2.com", reg.Location) // subdomain prefix match for *.not.quite.simple-prefix.com // location field overriden by /registries.conf.d/subdomain-override-1.conf reg, err = FindRegistry(sys, "really.not.quite.simple-prefix.com:5000/with/path/and/beyond:tag") assert.Nil(t, err) assert.NotNil(t, reg) assert.Equal(t, "subdomain-prefix-1-overridden-by-dropin-location.com", reg.Location) // In this case, the override does NOT occur because the dropin // prefix = "*.docker.com" which is not a match. reg, err = FindRegistry(sys, "foo.docker.io:5000/omg/wtf/bbq:foo") assert.Nil(t, err) assert.NotNil(t, reg) assert.Equal(t, "subdomain-prefix-2.com", reg.Location) // subdomain prefix match for *.bar.example.com // location field overriden by /registries.conf.d/subdomain-override-3.conf reg, err = FindRegistry(sys, "foo.bar.example.com:6000/omg/wtf/bbq@sha256:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") assert.Nil(t, err) assert.NotNil(t, reg) assert.Equal(t, "subdomain-prefix-3-overridden-by-dropin-location.com", reg.Location) // This case first matches with prefix = *.docker.io in find-registry.conf but // there's a longer match with *.bar.docker.io which gets used reg, err = FindRegistry(sys, "foo.bar.docker.io:5000/omg/wtf/bbq:foo") assert.Nil(t, err) assert.NotNil(t, reg) assert.Equal(t, "subdomain-prefix-4.com", reg.Location) // This case first matches with prefix = *.example.com in find-registry.conf but // there's a longer match with foo.bar.example.com:5000 which gets used reg, err = FindRegistry(sys, "foo.bar.example.com:5000/omg/wtf/bbq:foo") assert.Nil(t, err) assert.NotNil(t, reg) assert.Equal(t, "subdomain-prefix-5.com", reg.Location) // invalid match reg, err = FindRegistry(sys, "simple-prefix.comx") assert.Nil(t, err) assert.Nil(t, reg) reg, err = FindRegistry(sys, "complex-prefix.com:4000/with/path/and/beyond:tag") assert.Nil(t, err) assert.NotNil(t, reg) assert.Equal(t, "complex-prefix.com:4000/with/path", reg.Prefix) assert.Equal(t, "another-registry.com:5000", reg.Location) reg, err = FindRegistry(sys, "no-prefix.com/foo:tag") assert.Nil(t, err) assert.NotNil(t, reg) assert.Equal(t, "no-prefix.com", reg.Prefix) assert.Equal(t, "no-prefix.com", reg.Location) reg, err = FindRegistry(sys, "empty-prefix.com/foo:tag") assert.Nil(t, err) assert.NotNil(t, reg) assert.Equal(t, "empty-prefix.com", reg.Prefix) assert.Equal(t, "empty-prefix.com", reg.Location) _, err = FindRegistry(&types.SystemContext{SystemRegistriesConfPath: "testdata/this-does-not-exist.conf"}, "example.com") assert.Error(t, err) }
explode_data.jsonl/62228
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1541 }
[ 2830, 3393, 9885, 15603, 1155, 353, 8840, 836, 8, 341, 41709, 1669, 609, 9242, 16620, 1972, 515, 197, 5816, 3477, 380, 4019, 15578, 1820, 25, 262, 330, 92425, 81121, 12, 29172, 13937, 756, 197, 5816, 3477, 380, 4019, 15578, 6184, 1820, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_Hoverfly_DeletePACFile(t *testing.T) { RegisterTestingT(t) unit := NewHoverflyWithConfiguration(&Configuration{ PACFile: []byte("PACFILE"), }) unit.DeletePACFile() Expect(unit.Cfg.PACFile).To(BeNil()) }
explode_data.jsonl/45411
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 83 }
[ 2830, 3393, 2039, 1975, 21642, 57418, 47, 1706, 1703, 1155, 353, 8840, 836, 8, 341, 79096, 16451, 51, 1155, 692, 81189, 1669, 1532, 34379, 21642, 2354, 7688, 2099, 7688, 515, 197, 10025, 1706, 1703, 25, 3056, 3782, 445, 47, 1706, 6041, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestHttpParser_301_response(t *testing.T) { logp.TestingSetup(logp.WithSelectors("http")) data := "HTTP/1.1 301 Moved Permanently\r\n" + "Date: Sun, 29 Sep 2013 16:53:59 GMT\r\n" + "Server: Apache\r\n" + "Location: http://www.hotnews.ro/\r\n" + "Vary: Accept-Encoding\r\n" + "Content-Length: 290\r\n" + "Connection: close\r\n" + "Content-Type: text/html; charset=iso-8859-1\r\n" + "\r\n" + "<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML 2.0//EN\">\r\n" + "<html><head>\r\n" + "<title>301 Moved Permanently</title>\r\n" + "</head><body>\r\n" + "<h1>Moved Permanently</h1>\r\n" + "<p>The document has moved <a href=\"http://www.hotnews.ro/\">here</a>.</p>\r\n" + "<hr>\r\n" + "<address>Apache Server at hotnews.ro Port 80</address>\r\n" + "</body></html>" msg, ok, complete := testParse(nil, data) assert.True(t, ok) assert.True(t, complete) assert.Equal(t, 290, msg.contentLength) }
explode_data.jsonl/16502
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 442 }
[ 2830, 3393, 2905, 6570, 62, 18, 15, 16, 9655, 1155, 353, 8840, 836, 8, 341, 6725, 79, 8787, 287, 21821, 12531, 79, 26124, 96995, 445, 1254, 28075, 8924, 1669, 330, 9230, 14, 16, 13, 16, 220, 18, 15, 16, 89697, 3616, 1515, 4402, 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
func TestMultiSubOnce(t *testing.T) { ps := New(1) defer ps.Shutdown() ch := ps.SubOnce("t1", "t2") ps.Pub("hi", "t1") ps.Pub("hello", "t2") checkContents(t, ch, []string{"hi"}) }
explode_data.jsonl/44257
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 87 }
[ 2830, 3393, 20358, 3136, 12522, 1155, 353, 8840, 836, 8, 341, 35009, 1669, 1532, 7, 16, 340, 16867, 4726, 10849, 18452, 2822, 23049, 1669, 4726, 12391, 12522, 445, 83, 16, 497, 330, 83, 17, 5130, 35009, 1069, 392, 445, 6023, 497, 330,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestCRUDModel(t *testing.T) { db, _ := test.SetupPG(t) var p = &sdk.KafkaIntegration ok, err := ModelExists(db, p.Name) require.NoError(t, err) if !ok { err = InsertModel(db, p) require.NoError(t, err) } else { p1, err := LoadModelByName(context.TODO(), db, p.Name) require.NoError(t, err) p = &p1 } model, err := LoadModelByNameWithClearPassword(context.TODO(), db, p.Name) require.NoError(t, err) model.PublicConfigurations = sdk.IntegrationConfigMap{ "A": sdk.IntegrationConfig{}, "B": sdk.IntegrationConfig{}, } err = UpdateModel(context.TODO(), db, p) require.NoError(t, err) models, err := LoadModels(db) require.NoError(t, err) assert.True(t, len(models) > 1) }
explode_data.jsonl/1478
{ "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, 8973, 4656, 1712, 1155, 353, 8840, 836, 8, 341, 20939, 11, 716, 1669, 1273, 39820, 11383, 1155, 692, 2405, 281, 284, 609, 51295, 11352, 21883, 52464, 271, 59268, 11, 1848, 1669, 4903, 15575, 9791, 11, 281, 2967, 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...
2
func TestRemittanceOriginatorAddressLineSixAlphaNumeric(t *testing.T) { ro := mockRemittanceOriginator() ro.RemittanceData.AddressLineSix = "®" err := ro.Validate() require.EqualError(t, err, fieldError("AddressLineSix", ErrNonAlphanumeric, ro.RemittanceData.AddressLineSix).Error()) }
explode_data.jsonl/32937
{ "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, 6590, 87191, 13298, 850, 4286, 2460, 41460, 19384, 36296, 1155, 353, 8840, 836, 8, 341, 197, 299, 1669, 7860, 6590, 87191, 13298, 850, 741, 197, 299, 11398, 87191, 1043, 26979, 2460, 41460, 284, 330, 11909, 1837, 9859, 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 TestUnwrap(t *testing.T) { zdb.RunTest(t, func(t *testing.T, ctx context.Context) { db := zdb.MustGetDB(ctx) if zdb.Unwrap(db) != db { t.Error() } ldb := zdb.NewLogDB(db, os.Stdout, 0, "") if zdb.Unwrap(ldb) != db { t.Error() } ldb2 := zdb.NewLogDB(ldb, os.Stdout, 0, "") if zdb.Unwrap(ldb2) != db { t.Error() } }) }
explode_data.jsonl/57558
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 192 }
[ 2830, 3393, 1806, 10097, 1155, 353, 8840, 836, 8, 341, 20832, 1999, 16708, 2271, 1155, 11, 2915, 1155, 353, 8840, 836, 11, 5635, 2266, 9328, 8, 341, 197, 20939, 1669, 1147, 1999, 50463, 1949, 3506, 7502, 692, 197, 743, 1147, 1999, 106...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
4
func TestSvmByteArray(t *testing.T) { req := require.New(t) testAddress := func(val []byte) { ba := bytesCloneToSvmByteArray(val) goBytes := svmByteArrayCloneToBytes(ba) ba.Free() req.Equal(val, goBytes) } testRange := 100 b := make([]byte, testRange, testRange) for i := 0; i < testRange; i++ { b[i] = byte(i) // Assign some arbitrary value to the next additional byte we're testing. testAddress(b[:i]) } }
explode_data.jsonl/52021
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 171 }
[ 2830, 3393, 50, 7338, 18394, 1155, 353, 8840, 836, 8, 341, 24395, 1669, 1373, 7121, 1155, 692, 18185, 4286, 1669, 2915, 9098, 3056, 3782, 8, 341, 197, 2233, 64, 1669, 5820, 37677, 1249, 50, 7338, 18394, 9098, 340, 197, 30680, 7078, 16...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestWithLoadFiles(t *testing.T) { tmpDir := fs.NewDir(t, t.Name(), fs.WithFile("params.yaml", `param1: param2: value1 param3: 3 overridden: bar`)) defer tmpDir.Remove() var bundle *bundle.Bundle actual := map[string]string{ "overridden": "foo", } err := WithFileParameters([]string{tmpDir.Join("params.yaml")})( &MergeBundleConfig{ bundle: bundle, params: actual, }) assert.NilError(t, err) expected := map[string]string{ "param1.param2": "value1", "param3": "3", "overridden": "bar", } assert.Assert(t, cmp.DeepEqual(actual, expected)) }
explode_data.jsonl/17700
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 255 }
[ 2830, 3393, 2354, 5879, 10809, 1155, 353, 8840, 836, 8, 341, 20082, 6184, 1669, 8619, 7121, 6184, 1155, 345, 197, 3244, 2967, 3148, 197, 53584, 26124, 1703, 445, 3519, 33406, 497, 1565, 903, 16, 510, 220, 1685, 17, 25, 897, 16, 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
func TestPayload_Event(t *testing.T) { t.Parallel() payload := Payload{ "event": map[string]interface{}{ "test": "test", }, } t.Run("normal test", func(t *testing.T) { result := payload.Event() assert.NotNil(t, result) assert.Equal(t, "test", result.String("test")) }) }
explode_data.jsonl/29919
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 123 }
[ 2830, 3393, 29683, 39354, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 741, 76272, 1669, 52916, 515, 197, 197, 1, 3087, 788, 2415, 14032, 31344, 67066, 298, 197, 1, 1944, 788, 330, 1944, 756, 197, 197, 1583, 197, 630, 3244, 16708,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestDupNamespaces(t *testing.T) { spec := &specs.Spec{ Linux: &specs.Linux{ Namespaces: []specs.LinuxNamespace{ { Type: "pid", }, { Type: "pid", Path: "/proc/1/ns/pid", }, }, }, } _, err := CreateLibcontainerConfig(&CreateOpts{ Spec: spec, }) if err == nil { t.Errorf("Duplicated namespaces should be forbidden") } }
explode_data.jsonl/6065
{ "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, 85713, 7980, 27338, 1155, 353, 8840, 836, 8, 341, 98100, 1669, 609, 94531, 36473, 515, 197, 15070, 19559, 25, 609, 94531, 1214, 19559, 515, 298, 197, 7980, 27338, 25, 3056, 94531, 1214, 19559, 22699, 515, 571, 197, 515, 464,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestNoEchoOldServer(t *testing.T) { opts := GetDefaultOptions() opts.Url = DefaultURL opts.NoEcho = true nc := &Conn{Opts: opts} if err := nc.setupServerPool(); err != nil { t.Fatalf("Problem setting up Server Pool: %v\n", err) } // Old style with no proto, meaning 0. We need Proto:1 for NoEcho support. oldInfo := "{\"server_id\":\"22\",\"version\":\"1.1.0\",\"go\":\"go1.10.2\",\"port\":4222,\"max_payload\":1048576}" err := nc.processInfo(oldInfo) if err != nil { t.Fatalf("Error processing old style INFO: %v\n", err) } // Make sure connectProto generates an error. _, err = nc.connectProto() if err == nil { t.Fatalf("Expected an error but got none\n") } }
explode_data.jsonl/44923
{ "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, 2753, 74994, 18284, 5475, 1155, 353, 8840, 836, 8, 341, 64734, 1669, 2126, 3675, 3798, 741, 64734, 41024, 284, 7899, 3144, 198, 64734, 16766, 74994, 284, 830, 271, 197, 1016, 1669, 609, 9701, 90, 43451, 25, 12185, 532, 743, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
4
func TestCanGetTwoProvidersForOneVersion(t *testing.T) { assert := assert.New(t) bh := BoxHandler{} boxes := []SimpleBox{SimpleBox{Boxname: "dev", Username: "benphegan", Provider: "virtualbox", Version: "2.0", Location: "/tmp/benphegan-VAGRANTSLASH-dev__2.0__virtualbox.box"}, SimpleBox{Boxname: "dev", Username: "benphegan", Provider: "vmware", Version: "2.0", Location: "/tmp/benphegan-VAGRANTSLASH-dev__2.0__vmware.box"}} host := "localhost" bh.createBoxes(boxes, 80, &host) assert.Equal(2, len(bh.Boxes["benphegan"]["dev"].Versions[0].Providers)) assert.Equal("/tmp/benphegan-VAGRANTSLASH-dev__2.0__vmware.box", bh.GetBoxFileLocation("benphegan", "dev", "vmware", "2.0")) assert.Equal("/tmp/benphegan-VAGRANTSLASH-dev__2.0__virtualbox.box", bh.GetBoxFileLocation("benphegan", "dev", "virtualbox", "2.0")) }
explode_data.jsonl/51591
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 336 }
[ 2830, 3393, 6713, 1949, 11613, 37351, 2461, 3966, 5637, 1155, 353, 8840, 836, 8, 341, 6948, 1669, 2060, 7121, 1155, 340, 2233, 71, 1669, 8261, 3050, 16094, 197, 22204, 1669, 3056, 16374, 1611, 90, 16374, 1611, 90, 1611, 606, 25, 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 TestGetLoadBalancerAdditionalTags(t *testing.T) { tagTests := []struct { Annotations map[string]string Tags map[string]string }{ { Annotations: map[string]string{ ServiceAnnotationLoadBalancerAdditionalTags: "Key=Val", }, Tags: map[string]string{ "Key": "Val", }, }, { Annotations: map[string]string{ ServiceAnnotationLoadBalancerAdditionalTags: "Key1=Val1, Key2=Val2", }, Tags: map[string]string{ "Key1": "Val1", "Key2": "Val2", }, }, { Annotations: map[string]string{ ServiceAnnotationLoadBalancerAdditionalTags: "Key1=, Key2=Val2", "anotherKey": "anotherValue", }, Tags: map[string]string{ "Key1": "", "Key2": "Val2", }, }, { Annotations: map[string]string{ "Nothing": "Key1=, Key2=Val2, Key3", }, Tags: map[string]string{}, }, { Annotations: map[string]string{ ServiceAnnotationLoadBalancerAdditionalTags: "K=V K1=V2,Key1========, =====, ======Val, =Val, , 234,", }, Tags: map[string]string{ "K": "V K1", "Key1": "", "234": "", }, }, } for _, tagTest := range tagTests { result := getLoadBalancerAdditionalTags(tagTest.Annotations) for k, v := range result { if len(result) != len(tagTest.Tags) { t.Errorf("incorrect expected length: %v != %v", result, tagTest.Tags) continue } if tagTest.Tags[k] != v { t.Errorf("%s != %s", tagTest.Tags[k], v) continue } } } }
explode_data.jsonl/12863
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 704 }
[ 2830, 3393, 1949, 5879, 93825, 29019, 15930, 1155, 353, 8840, 836, 8, 341, 60439, 18200, 1669, 3056, 1235, 341, 197, 197, 21418, 2415, 14032, 30953, 198, 197, 10261, 2032, 286, 2415, 14032, 30953, 198, 197, 59403, 197, 197, 515, 298, 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 TestRemoveAllPushNotificationsBuildQueryParam(t *testing.T) { assert := assert.New(t) queryParam := map[string]string{ "q1": "v1", "q2": "v2", } opts := &removeAllPushChannelsForDeviceOpts{ DeviceIDForPush: "deviceId", PushType: PNPushTypeAPNS, pubnub: pubnub, QueryParam: queryParam, } u, err := opts.buildQuery() assert.Equal("apns", u.Get("type")) assert.Equal("v1", u.Get("q1")) assert.Equal("v2", u.Get("q2")) assert.Nil(err) }
explode_data.jsonl/51097
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 222 }
[ 2830, 3393, 13021, 2403, 16644, 34736, 11066, 84085, 1155, 353, 8840, 836, 8, 341, 6948, 1669, 2060, 7121, 1155, 340, 27274, 2001, 1669, 2415, 14032, 30953, 515, 197, 197, 1, 80, 16, 788, 330, 85, 16, 756, 197, 197, 1, 80, 17, 788, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestGetCallRatesNilReader(t *testing.T) { qs := NewMetricsQueryService(nil) qParams := &metricsstore.CallRateQueryParameters{} r, err := qs.GetCallRates(context.Background(), qParams) assert.Zero(t, r) assert.EqualError(t, err, errNilReader.Error()) }
explode_data.jsonl/12526
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 99 }
[ 2830, 3393, 1949, 7220, 82623, 19064, 5062, 1155, 353, 8840, 836, 8, 341, 18534, 82, 1669, 1532, 27328, 2859, 1860, 27907, 340, 18534, 4870, 1669, 609, 43262, 4314, 27017, 11564, 2859, 9706, 16094, 7000, 11, 1848, 1669, 32421, 2234, 7220,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestRollupIderivDuplicateTimestamps(t *testing.T) { rfa := &rollupFuncArg{ values: []float64{1, 2, 3, 4, 5}, timestamps: []int64{100, 100, 200, 300, 300}, } n := rollupIderiv(rfa) if n != 20 { t.Fatalf("unexpected value; got %v; want %v", n, 20) } rfa = &rollupFuncArg{ values: []float64{1, 2, 3, 4, 5}, timestamps: []int64{100, 100, 300, 300, 300}, } n = rollupIderiv(rfa) if n != 15 { t.Fatalf("unexpected value; got %v; want %v", n, 15) } rfa = &rollupFuncArg{ prevValue: nan, values: []float64{}, timestamps: []int64{}, } n = rollupIderiv(rfa) if !math.IsNaN(n) { t.Fatalf("unexpected value; got %v; want %v", n, nan) } rfa = &rollupFuncArg{ prevValue: nan, values: []float64{15}, timestamps: []int64{100}, } n = rollupIderiv(rfa) if !math.IsNaN(n) { t.Fatalf("unexpected value; got %v; want %v", n, nan) } rfa = &rollupFuncArg{ prevTimestamp: 90, prevValue: 10, values: []float64{15}, timestamps: []int64{100}, } n = rollupIderiv(rfa) if n != 500 { t.Fatalf("unexpected value; got %v; want %v", n, 0.5) } rfa = &rollupFuncArg{ prevTimestamp: 100, prevValue: 10, values: []float64{15}, timestamps: []int64{100}, } n = rollupIderiv(rfa) if n != inf { t.Fatalf("unexpected value; got %v; want %v", n, inf) } rfa = &rollupFuncArg{ prevTimestamp: 100, prevValue: 10, values: []float64{15, 20}, timestamps: []int64{100, 100}, } n = rollupIderiv(rfa) if n != inf { t.Fatalf("unexpected value; got %v; want %v", n, inf) } }
explode_data.jsonl/23110
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 800 }
[ 2830, 3393, 32355, 454, 764, 261, 344, 53979, 20812, 82, 1155, 353, 8840, 836, 8, 341, 7000, 3632, 1669, 609, 1100, 454, 9626, 2735, 515, 197, 45939, 25, 257, 3056, 3649, 21, 19, 90, 16, 11, 220, 17, 11, 220, 18, 11, 220, 19, 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...
8
func TestMaxMsgs(t *testing.T) { sOpts := GetDefaultOptions() sOpts.ID = clusterName sOpts.MaxMsgs = 10 s := runServerWithOpts(t, sOpts, nil) defer s.Shutdown() sc := NewDefaultConnection(t) defer sc.Close() for i := 0; i < 2*sOpts.MaxMsgs; i++ { sc.Publish("foo", []byte("msg")) } // We should not have more than MaxMsgs cs := channelsGet(t, s.channels, "foo") if n, _ := msgStoreState(t, cs.store.Msgs); n != sOpts.MaxMsgs { t.Fatalf("Expected msgs count to be %v, got %v", sOpts.MaxMsgs, n) } }
explode_data.jsonl/23092
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 225 }
[ 2830, 3393, 5974, 6611, 82, 1155, 353, 8840, 836, 8, 341, 1903, 43451, 1669, 2126, 3675, 3798, 741, 1903, 43451, 9910, 284, 10652, 675, 198, 1903, 43451, 14535, 6611, 82, 284, 220, 16, 15, 198, 1903, 1669, 1598, 5475, 2354, 43451, 115...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestTaskRunSpec_Invalidate(t *testing.T) { tests := []struct { name string spec v1beta1.TaskRunSpec wantErr *apis.FieldError }{{ name: "invalid taskspec", spec: v1beta1.TaskRunSpec{}, wantErr: apis.ErrMissingField("spec"), }, { name: "invalid taskref name", spec: v1beta1.TaskRunSpec{ TaskRef: &v1beta1.TaskRef{}, }, wantErr: apis.ErrMissingField("spec.taskref.name, spec.taskspec"), }, { name: "invalid taskref and taskspec together", spec: v1beta1.TaskRunSpec{ TaskRef: &v1beta1.TaskRef{ Name: "taskrefname", }, TaskSpec: &v1beta1.TaskSpec{ Steps: []v1beta1.Step{{Container: corev1.Container{ Name: "mystep", Image: "myimage", }}}, }, }, wantErr: apis.ErrDisallowedFields("spec.taskspec", "spec.taskref"), }, { name: "negative pipeline timeout", spec: v1beta1.TaskRunSpec{ TaskRef: &v1beta1.TaskRef{ Name: "taskrefname", }, Timeout: &metav1.Duration{Duration: -48 * time.Hour}, }, wantErr: apis.ErrInvalidValue("-48h0m0s should be >= 0", "spec.timeout"), }, { name: "wrong taskrun cancel", spec: v1beta1.TaskRunSpec{ TaskRef: &v1beta1.TaskRef{ Name: "taskrefname", }, Status: "TaskRunCancell", }, wantErr: apis.ErrInvalidValue("TaskRunCancell should be TaskRunCancelled", "spec.status"), }, { name: "invalid taskspec", spec: v1beta1.TaskRunSpec{ TaskSpec: &v1beta1.TaskSpec{ Steps: []v1beta1.Step{{Container: corev1.Container{ Name: "invalid-name-with-$weird-char/%", Image: "myimage", }}}, }, }, wantErr: &apis.FieldError{ Message: `invalid value "invalid-name-with-$weird-char/%"`, Paths: []string{"taskspec.steps.name"}, Details: "Task step name must be a valid DNS Label, For more info refer to https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names", }, }, { name: "invalid params", spec: v1beta1.TaskRunSpec{ Params: []v1beta1.Param{{ Name: "name", Value: *v1beta1.NewArrayOrString("value"), }, { Name: "name", Value: *v1beta1.NewArrayOrString("value"), }}, TaskRef: &v1beta1.TaskRef{Name: "mytask"}, }, wantErr: apis.ErrMultipleOneOf("spec.params.name"), }} for _, ts := range tests { t.Run(ts.name, func(t *testing.T) { err := ts.spec.Validate(context.Background()) if d := cmp.Diff(ts.wantErr.Error(), err.Error()); d != "" { t.Errorf("TaskRunSpec.Validate/%s %s", ts.name, diff.PrintWantGot(d)) } }) } }
explode_data.jsonl/82029
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1121 }
[ 2830, 3393, 6262, 6727, 8327, 25972, 7067, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 3056, 1235, 341, 197, 11609, 262, 914, 198, 197, 98100, 262, 348, 16, 19127, 16, 28258, 6727, 8327, 198, 197, 50780, 7747, 353, 13725, 17087, 1454, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestNoAttributeDisclosureSession(t *testing.T) { id := irma.NewAttributeTypeIdentifier("irma-demo.RU.studentCard") request := getDisclosureRequest(id) sessionHelper(t, request, "verification", nil) }
explode_data.jsonl/69988
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 69 }
[ 2830, 3393, 2753, 3907, 91065, 5283, 1155, 353, 8840, 836, 8, 341, 15710, 1669, 6216, 1728, 7121, 3907, 929, 8714, 445, 44011, 58893, 2013, 52, 40113, 5770, 1138, 23555, 1669, 633, 91065, 1900, 3724, 340, 25054, 5511, 1155, 11, 1681, 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
func TestFormatterColors(test *testing.T) { formatted, err := formatter.Format("{red}red{normal} {green}green{normal} {blue}blue{normal}") assert.NoError(test, err) assert.Equal(test, "\x1b[31mred\x1b[0m \x1b[32mgreen\x1b[0m \x1b[34mblue\x1b[0m", formatted) }
explode_data.jsonl/39744
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 119 }
[ 2830, 3393, 14183, 13108, 8623, 353, 8840, 836, 8, 341, 37410, 12127, 11, 1848, 1669, 24814, 9978, 13976, 1151, 92, 1151, 90, 8252, 92, 314, 13250, 92, 13250, 90, 8252, 92, 314, 12203, 92, 12203, 90, 8252, 55266, 6948, 35699, 8623, 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 TestChangefeedMultiTable(t *testing.T) { defer leaktest.AfterTest(t)() testFn := func(t *testing.T, db *gosql.DB, f testfeedFactory) { sqlDB := sqlutils.MakeSQLRunner(db) sqlDB.Exec(t, `CREATE TABLE foo (a INT PRIMARY KEY, b STRING)`) sqlDB.Exec(t, `INSERT INTO foo VALUES (1, 'a')`) sqlDB.Exec(t, `CREATE TABLE bar (a INT PRIMARY KEY, b STRING)`) sqlDB.Exec(t, `INSERT INTO bar VALUES (2, 'b')`) fooAndBar := f.Feed(t, `CREATE CHANGEFEED FOR foo, bar`) defer fooAndBar.Close(t) assertPayloads(t, fooAndBar, []string{ `foo: [1]->{"a": 1, "b": "a"}`, `bar: [2]->{"a": 2, "b": "b"}`, }) } t.Run(`sinkless`, sinklessTest(testFn)) t.Run(`enterprise`, enterpriseTest(testFn)) t.Run(`rangefeed`, rangefeedTest(sinklessTest, testFn)) }
explode_data.jsonl/21274
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 347 }
[ 2830, 3393, 1143, 524, 823, 12051, 20358, 2556, 1155, 353, 8840, 836, 8, 341, 16867, 23352, 1944, 36892, 2271, 1155, 8, 2822, 18185, 24911, 1669, 2915, 1155, 353, 8840, 836, 11, 2927, 353, 34073, 1470, 22537, 11, 282, 1273, 11184, 4153,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestParseSimpleApi1(t *testing.T) { expected, err := ioutil.ReadFile("testdata/simple/expected.json") assert.NoError(t, err) searchDir := "testdata/simple" p := New() p.PropNamingStrategy = PascalCase err = p.ParseAPI(searchDir, mainAPIFile, defaultParseDepth) assert.NoError(t, err) b, _ := json.MarshalIndent(p.swagger, "", " ") assert.Equal(t, string(expected), string(b)) }
explode_data.jsonl/63553
{ "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, 14463, 16374, 6563, 16, 1155, 353, 8840, 836, 8, 341, 42400, 11, 1848, 1669, 43144, 78976, 445, 92425, 67195, 14, 7325, 4323, 1138, 6948, 35699, 1155, 11, 1848, 340, 45573, 6184, 1669, 330, 92425, 67195, 698, 3223, 1669, 153...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestSaveHTMLContent(t *testing.T) { t.Run("saveHTMLContent: should saves html file to filesystem", func(t *testing.T) { filename := "temp.html" r := strings.NewReader(`<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8" /> <link rel="shortcut icon" href="/favicon.ico" /> <meta name="viewport" content="width=device-width, initial-scale=1" /> <meta name="theme-color" content="#000000" /> <link href="https://fonts.googleapis.com/css?family=Lato|Satisfy|Kristi&display=swap" rel="stylesheet" /> <link href="/assets/styles.css" rel="stylesheet"> <title>Gophercises | courses.calhoun.io</title> </head> <body class="bg-grey-100"> <div></div> </body> </html> `) saveHTMLContent(filename, r) _, err := os.Stat(filename) if err != nil { t.Error() return } assert.False(t, os.IsNotExist(err)) if err := os.Remove(filename); err != nil { t.Error() return } }) }
explode_data.jsonl/67949
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 415 }
[ 2830, 3393, 8784, 5835, 2762, 1155, 353, 8840, 836, 8, 341, 3244, 16708, 445, 6628, 5835, 2762, 25, 1265, 25935, 5272, 1034, 311, 38389, 497, 2915, 1155, 353, 8840, 836, 8, 341, 197, 66434, 1669, 330, 3888, 2564, 698, 197, 7000, 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...
3
func TestWorkspace_Summary(t *testing.T) { testCases := map[string]struct { expectedSummary Summary workingDir string expectedError error mockFileSystem func(fs afero.Fs) }{ "existing workspace summary": { expectedSummary: Summary{Application: "DavidsApp"}, workingDir: "test/", mockFileSystem: func(fs afero.Fs) { fs.MkdirAll("test/copilot", 0755) afero.WriteFile(fs, "test/copilot/.workspace", []byte(fmt.Sprintf("---\napplication: %s", "DavidsApp")), 0644) }, }, "no existing workspace summary": { workingDir: "test/", expectedError: fmt.Errorf("couldn't find an application associated with this workspace"), mockFileSystem: func(fs afero.Fs) { fs.MkdirAll("test/copilot", 0755) }, }, "no existing manifest dir": { workingDir: "test/", expectedError: fmt.Errorf("couldn't find a directory called copilot up to 5 levels up from test/"), mockFileSystem: func(fs afero.Fs) {}, }, } for name, tc := range testCases { t.Run(name, func(t *testing.T) { // Create an empty FileSystem fs := afero.NewMemMapFs() // Set it up tc.mockFileSystem(fs) ws := Workspace{ workingDir: tc.workingDir, fsUtils: &afero.Afero{Fs: fs}, } summary, err := ws.Summary() if tc.expectedError == nil { require.NoError(t, err) require.Equal(t, tc.expectedSummary, *summary) } else { require.Equal(t, tc.expectedError.Error(), err.Error()) } }) } }
explode_data.jsonl/30112
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 618 }
[ 2830, 3393, 45981, 1098, 372, 1534, 1155, 353, 8840, 836, 8, 341, 18185, 37302, 1669, 2415, 14032, 60, 1235, 341, 197, 42400, 19237, 21517, 198, 197, 197, 21152, 6184, 414, 914, 198, 197, 42400, 1454, 256, 1465, 198, 197, 77333, 50720, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestTransportGroupsPendingDials(t *testing.T) { st := newServerTester(t, func(w http.ResponseWriter, r *http.Request) { io.WriteString(w, r.RemoteAddr) }, optOnlyServer) defer st.Close() tr := &Transport{ TLSClientConfig: tlsConfigInsecure, } defer tr.CloseIdleConnections() var ( mu sync.Mutex dials = map[string]int{} ) var wg sync.WaitGroup for i := 0; i < 10; i++ { wg.Add(1) go func() { defer wg.Done() req, err := http.NewRequest("GET", st.ts.URL, nil) if err != nil { t.Error(err) return } res, err := tr.RoundTrip(req) if err != nil { t.Error(err) return } defer res.Body.Close() slurp, err := ioutil.ReadAll(res.Body) if err != nil { t.Errorf("Body read: %v", err) } addr := strings.TrimSpace(string(slurp)) if addr == "" { t.Errorf("didn't get an addr in response") } mu.Lock() dials[addr]++ mu.Unlock() }() } wg.Wait() if len(dials) != 1 { t.Errorf("saw %d dials; want 1: %v", len(dials), dials) } tr.CloseIdleConnections() if err := retry(50, 10*time.Millisecond, func() error { cp, ok := tr.connPool().(*clientConnPool) if !ok { return fmt.Errorf("Conn pool is %T; want *clientConnPool", tr.connPool()) } cp.mu.Lock() defer cp.mu.Unlock() if len(cp.dialing) != 0 { return fmt.Errorf("dialing map = %v; want empty", cp.dialing) } if len(cp.conns) != 0 { return fmt.Errorf("conns = %v; want empty", cp.conns) } if len(cp.keys) != 0 { return fmt.Errorf("keys = %v; want empty", cp.keys) } return nil }); err != nil { t.Errorf("State of pool after CloseIdleConnections: %v", err) } }
explode_data.jsonl/16051
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 766 }
[ 2830, 3393, 27560, 22173, 32027, 35, 10309, 1155, 353, 8840, 836, 8, 341, 18388, 1669, 501, 5475, 58699, 1155, 11, 2915, 3622, 1758, 37508, 11, 435, 353, 1254, 9659, 8, 341, 197, 53112, 44747, 3622, 11, 435, 51434, 13986, 340, 197, 21...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestNewIstioGatewaySource(t *testing.T) { for _, ti := range []struct { title string annotationFilter string fqdnTemplate string combineFQDNAndAnnotation bool expectError bool }{ { title: "invalid template", expectError: true, fqdnTemplate: "{{.Name", }, { title: "valid empty template", expectError: false, }, { title: "valid template", expectError: false, fqdnTemplate: "{{.Name}}-{{.Namespace}}.ext-dns.test.com", }, { title: "valid template", expectError: false, fqdnTemplate: "{{.Name}}-{{.Namespace}}.ext-dns.test.com, {{.Name}}-{{.Namespace}}.ext-dna.test.com", }, { title: "valid template", expectError: false, fqdnTemplate: "{{.Name}}-{{.Namespace}}.ext-dns.test.com, {{.Name}}-{{.Namespace}}.ext-dna.test.com", combineFQDNAndAnnotation: true, }, { title: "non-empty annotation filter label", expectError: false, annotationFilter: "kubernetes.io/gateway.class=nginx", }, } { t.Run(ti.title, func(t *testing.T) { _, err := NewIstioGatewaySource( fake.NewSimpleClientset(), NewFakeConfigStore(), "", ti.annotationFilter, ti.fqdnTemplate, ti.combineFQDNAndAnnotation, false, ) if ti.expectError { assert.Error(t, err) } else { assert.NoError(t, err) } }) } }
explode_data.jsonl/78114
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 749 }
[ 2830, 3393, 3564, 40, 267, 815, 40709, 3608, 1155, 353, 8840, 836, 8, 341, 2023, 8358, 8988, 1669, 2088, 3056, 1235, 341, 197, 24751, 503, 914, 198, 197, 197, 24674, 5632, 260, 914, 198, 197, 1166, 80, 17395, 7275, 1797, 914, 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 TestDeployerSpecDefault(t *testing.T) { tests := []struct { name string in *DeployerSpec want *DeployerSpec }{{ name: "ensure at least one container", in: &DeployerSpec{}, want: &DeployerSpec{ Template: &corev1.PodSpec{ Containers: []corev1.Container{ {}, }, }, IngressPolicy: IngressPolicyExternal, }, }} for _, test := range tests { t.Run(test.name, func(t *testing.T) { got := test.in got.Default() if diff := cmp.Diff(test.want, got); diff != "" { t.Errorf("Default (-want, +got) = %v", diff) } }) } }
explode_data.jsonl/5185
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 258 }
[ 2830, 3393, 69464, 261, 8327, 3675, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 3056, 1235, 341, 197, 11609, 914, 198, 197, 17430, 256, 353, 69464, 261, 8327, 198, 197, 50780, 353, 69464, 261, 8327, 198, 197, 15170, 515, 197, 11609, 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 TestAddOrUpdatePolicy(t *testing.T) { basicTestPolicy := &unstructured.Unstructured{ Object: map[string]interface{}{ "metadata": map[string]interface{}{ "namespace": "testing", }, "spec": map[string]interface{}{ "policy": map[string]interface{}{ "name": "TestPolicy", "signature-requirements": []interface{}{ map[string]interface{}{ "maxRevisionDatetime": "2019-04-01T18:32:02Z", "tag": "test", }, }, }, }, }, } basicTestPolicyNoReqs := &unstructured.Unstructured{ Object: map[string]interface{}{ "metadata": map[string]interface{}{ "namespace": "testing", }, "spec": map[string]interface{}{ "policy": map[string]interface{}{ "name": "TestPolicy", }, }, }, } invalidTestPolicy := &unstructured.Unstructured{ Object: map[string]interface{}{ "metadata": map[string]interface{}{ "namespace": "testing", }, "spec": map[string]interface{}{}, }, } testPolicyUnsatisfied := &unstructured.Unstructured{ Object: map[string]interface{}{ "metadata": map[string]interface{}{ "namespace": "testing", }, "spec": map[string]interface{}{ "policy": map[string]interface{}{ "name": "TestPolicy", "signature-requirements": []interface{}{ map[string]interface{}{ "minRevisionDatetime": "2021-04-01T18:32:02Z", "tag": "test", }, }, }, }, }, } apc := NewAppProtectConfiguration() apc.UserSigs["testing/TestUsersig"] = &AppProtectUserSigEx{Tag: "test", RevTime: parseTime("2019-01-01T18:32:02Z"), IsValid: true} tests := []struct { policy *unstructured.Unstructured expectedChanges []AppProtectChange expectedProblems []AppProtectProblem msg string }{ { policy: basicTestPolicy, expectedChanges: []AppProtectChange{ {Resource: &AppProtectPolicyEx{ Obj: basicTestPolicy, IsValid: true, SignatureReqs: []SignatureReq{ {Tag: "test", RevTimes: &RevTimes{ MaxRevTime: parseTime("2019-04-01T18:32:02Z"), }, }, }, }, Op: AddOrUpdate, }, }, expectedProblems: nil, msg: "Basic Case with sig reqs", }, { policy: basicTestPolicyNoReqs, expectedChanges: []AppProtectChange{ {Resource: &AppProtectPolicyEx{ Obj: basicTestPolicyNoReqs, IsValid: true, SignatureReqs: []SignatureReq{}, }, Op: AddOrUpdate, }, }, expectedProblems: nil, msg: "basic case no sig reqs", }, { policy: invalidTestPolicy, expectedChanges: []AppProtectChange{ {Resource: &AppProtectPolicyEx{ Obj: invalidTestPolicy, IsValid: false, ErrorMsg: "Validation Failed", }, Op: Delete, }, }, expectedProblems: []AppProtectProblem{ { Object: invalidTestPolicy, Reason: "Rejected", Message: "Error validating policy : Error validating App Protect Policy : Required field map[] not found", }, }, msg: "validation failed", }, { policy: testPolicyUnsatisfied, expectedChanges: []AppProtectChange{ {Resource: &AppProtectPolicyEx{ Obj: testPolicyUnsatisfied, IsValid: false, ErrorMsg: "Policy has unsatisfied signature requirements", SignatureReqs: []SignatureReq{ {Tag: "test", RevTimes: &RevTimes{ MinRevTime: parseTime("2021-04-01T18:32:02Z"), }, }, }, }, Op: Delete, }, }, expectedProblems: []AppProtectProblem{ { Object: testPolicyUnsatisfied, Reason: "Rejected", Message: "Policy has unsatisfied signature requirements", }, }, msg: "Missing sig reqs", }, } for _, test := range tests { aPChans, aPProbs := apc.AddOrUpdatePolicy(test.policy) if diff := cmp.Diff(test.expectedChanges, aPChans); diff != "" { t.Errorf("AddOrUpdatePolicy() %q changes returned unexpected result (-want +got):\n%s", test.msg, diff) } if diff := cmp.Diff(test.expectedProblems, aPProbs); diff != "" { t.Errorf("AddOrUpdatePolicy() %q problems returned unexpected result (-want +got):\n%s", test.msg, diff) } } }
explode_data.jsonl/19384
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1899 }
[ 2830, 3393, 2212, 56059, 13825, 1155, 353, 8840, 836, 8, 341, 2233, 5971, 2271, 13825, 1669, 609, 359, 51143, 10616, 51143, 515, 197, 23816, 25, 2415, 14032, 31344, 67066, 298, 197, 1, 17637, 788, 2415, 14032, 31344, 67066, 571, 197, 1,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
4
func TestLocale(t *testing.T) { trans := New() expected := "ar_SA" if trans.Locale() != expected { t.Errorf("Expected '%s' Got '%s'", expected, trans.Locale()) } }
explode_data.jsonl/54999
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 70 }
[ 2830, 3393, 19231, 1155, 353, 8840, 836, 8, 1476, 72453, 1669, 1532, 741, 42400, 1669, 330, 277, 81219, 1837, 743, 1356, 59094, 368, 961, 3601, 341, 197, 3244, 13080, 445, 18896, 7677, 82, 6, 24528, 7677, 82, 22772, 3601, 11, 1356, 59...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
2
func TestKubernetesSecretLoader_GetSecret(t *testing.T) { var tests = []struct { description string secretName string expected *map[string][]byte objs []runtime.Object wantErr bool }{ { "no secrets", "foo", nil, nil, true, }, { "matching secret", "secret1", &secret1Map, []runtime.Object{secret("secret1")}, false, }, { "non-matching secret", "secret2", nil, []runtime.Object{secret("secret1")}, true, }, } for _, test := range tests { t.Run(test.description, func(t *testing.T) { client := fake.NewSimpleClientset(test.objs...) loader := MakeKubernetesSecretLoaderFromClientset("ns1", client) actual, err := loader.GetSecret(test.secretName) if (err != nil) && !test.wantErr { t.Errorf("Unexpected error: %s", err) return } if (err == nil) && test.wantErr { t.Errorf("Expected an error, did not get one") return } if diff := cmp.Diff(actual, test.expected); diff != "" { t.Errorf("%T differ (-got, +want): %s", test.expected, diff) return } }) } }
explode_data.jsonl/45898
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 468 }
[ 2830, 3393, 42, 29827, 19773, 9181, 13614, 19773, 1155, 353, 8840, 836, 8, 341, 2405, 7032, 284, 3056, 1235, 341, 197, 42407, 914, 198, 197, 197, 20474, 675, 220, 914, 198, 197, 42400, 262, 353, 2186, 14032, 45725, 3782, 198, 197, 226...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestFindReturnAddress(t *testing.T) { protest.AllowRecording(t) withTestProcess("testnextprog", t, func(p *proc.Target, fixture protest.Fixture) { setFileBreakpoint(p, t, fixture.Source, 24) err := p.Continue() if err != nil { t.Fatal(err) } addr, err := returnAddress(p.CurrentThread()) if err != nil { t.Fatal(err) } _, l, _ := p.BinInfo().PCToLine(addr) if l != 40 { t.Fatalf("return address not found correctly, expected line 40") } }) }
explode_data.jsonl/56212
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 197 }
[ 2830, 3393, 9885, 5598, 4286, 1155, 353, 8840, 836, 8, 341, 197, 776, 1944, 29081, 52856, 1155, 340, 46948, 2271, 7423, 445, 1944, 3600, 32992, 497, 259, 11, 2915, 1295, 353, 15782, 35016, 11, 12507, 8665, 991, 12735, 8, 341, 197, 819...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestStrArray_RLockFunc(t *testing.T) { gtest.C(t, func(t *gtest.T) { s1 := []string{"a", "b", "c", "d"} a1 := garray.NewStrArrayFrom(s1, true) ch1 := make(chan int64, 3) ch2 := make(chan int64, 1) //go1 go a1.RLockFunc(func(n1 []string) { //读锁 time.Sleep(2 * time.Second) //暂停1秒 n1[2] = "g" ch2 <- gconv.Int64(time.Now().UnixNano() / 1000 / 1000) }) //go2 go func() { time.Sleep(100 * time.Millisecond) //故意暂停0.01秒,等go1执行锁后,再开始执行. ch1 <- gconv.Int64(time.Now().UnixNano() / 1000 / 1000) a1.Len() ch1 <- gconv.Int64(time.Now().UnixNano() / 1000 / 1000) }() t1 := <-ch1 t2 := <-ch1 <-ch2 //等待go1完成 // 防止ci抖动,以豪秒为单位 t.AssertLT(t2-t1, 20) //go1加的读锁,所go2读的时候,并没有阻塞。 t.Assert(a1.Contains("g"), true) }) }
explode_data.jsonl/53110
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 493 }
[ 2830, 3393, 2580, 1857, 2568, 11989, 9626, 1155, 353, 8840, 836, 8, 341, 3174, 1944, 727, 1155, 11, 2915, 1155, 353, 82038, 836, 8, 341, 197, 1903, 16, 1669, 3056, 917, 4913, 64, 497, 330, 65, 497, 330, 66, 497, 330, 67, 16707, 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 TestWalkSymlink(t *testing.T) { testenv.MustHaveSymlink(t) initOverlay(t, `{ "Replace": {"overlay_symlink": "symlink"} } -- dir/file --`) // Create symlink if err := os.Symlink("dir", "symlink"); err != nil { t.Error(err) } testCases := []struct { name string dir string wantFiles []string }{ {"control", "dir", []string{"dir", "dir" + string(filepath.Separator) + "file"}}, // ensure Walk doesn't walk into the directory pointed to by the symlink // (because it's supposed to use Lstat instead of Stat). {"symlink_to_dir", "symlink", []string{"symlink"}}, {"overlay_to_symlink_to_dir", "overlay_symlink", []string{"overlay_symlink"}}, } for _, tc := range testCases { t.Run(tc.name, func(t *testing.T) { var got []string err := Walk(tc.dir, func(path string, info fs.FileInfo, err error) error { got = append(got, path) if err != nil { t.Errorf("walkfn: got non nil err argument: %v, want nil err argument", err) } return nil }) if err != nil { t.Errorf("Walk: got error %q, want nil", err) } if !reflect.DeepEqual(got, tc.wantFiles) { t.Errorf("files examined by walk: got %v, want %v", got, tc.wantFiles) } }) } }
explode_data.jsonl/56055
{ "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, 48849, 34667, 44243, 1155, 353, 8840, 836, 8, 341, 18185, 3160, 50463, 12116, 34667, 44243, 1155, 692, 28248, 32755, 1155, 11, 1565, 515, 197, 1, 23107, 788, 5212, 21118, 58530, 44243, 788, 330, 22860, 44243, 16707, 532, 313, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestAddEquipmentTypeWithPositions(t *testing.T) { r := newTestResolver(t) defer r.drv.Close() ctx := viewertest.NewContext(r.client) mr, qr := r.Mutation(), r.Query() position1 := models.EquipmentPositionInput{ Name: "Position 1", } equipmentType, err := mr.AddEquipmentType(ctx, models.AddEquipmentTypeInput{ Name: "equipment_type_name_1", Positions: []*models.EquipmentPositionInput{&position1}, }) require.NoError(t, err) fetchedEquipmentType, err := qr.EquipmentType(ctx, equipmentType.ID) require.NoError(t, err) require.Equal(t, equipmentType.ID, fetchedEquipmentType.ID, "Verifying saved equipment type vs fetched equipmenttype : ID") require.Equal(t, equipmentType.Name, fetchedEquipmentType.Name, "Verifying saved equipment type vs fetched equipment type : Name") require.Equal(t, equipmentType.QueryPositionDefinitions().OnlyXID(ctx), fetchedEquipmentType.QueryPositionDefinitions().OnlyXID(ctx), "Verifying saved equipment type vs fetched equipment type: position definition") }
explode_data.jsonl/431
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 338 }
[ 2830, 3393, 2212, 58276, 929, 2354, 45793, 1155, 353, 8840, 836, 8, 341, 7000, 1669, 501, 2271, 18190, 1155, 340, 16867, 435, 950, 10553, 10421, 741, 20985, 1669, 1651, 83386, 7121, 1972, 2601, 6581, 692, 2109, 81, 11, 49290, 1669, 435,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestMainBeforeSubCommandsInvalidLogFormat(t *testing.T) { assert := assert.New(t) tmpdir, err := ioutil.TempDir(testDir, "") assert.NoError(err) defer os.RemoveAll(tmpdir) logFile := filepath.Join(tmpdir, "log") set := flag.NewFlagSet("", 0) set.Bool("debug", true, "") set.String("log", logFile, "") set.String("log-format", "captain-barnacles", "") set.Parse([]string{"create"}) logOut := kataLog.Logger.Out kataLog.Logger.Out = nil defer func() { kataLog.Logger.Out = logOut }() ctx := createCLIContext(set) err = beforeSubcommands(ctx) assert.Error(err) assert.NotNil(kataLog.Logger.Out) }
explode_data.jsonl/52194
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 256 }
[ 2830, 3393, 6202, 10227, 3136, 30479, 7928, 2201, 4061, 1155, 353, 8840, 836, 8, 341, 6948, 1669, 2060, 7121, 1155, 692, 20082, 3741, 11, 1848, 1669, 43144, 65009, 6184, 8623, 6184, 11, 14676, 6948, 35699, 3964, 340, 16867, 2643, 84427, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestStoreGateway_SyncOnRingTopologyChanged(t *testing.T) { registeredAt := time.Now() tests := map[string]struct { setupRing func(desc *ring.Desc) updateRing func(desc *ring.Desc) expectedSync bool }{ "should sync when an instance is added to the ring": { setupRing: func(desc *ring.Desc) { desc.AddIngester("instance-1", "127.0.0.1", "", ring.Tokens{1, 2, 3}, ring.ACTIVE, registeredAt) }, updateRing: func(desc *ring.Desc) { desc.AddIngester("instance-2", "127.0.0.2", "", ring.Tokens{4, 5, 6}, ring.ACTIVE, registeredAt) }, expectedSync: true, }, "should sync when an instance is removed from the ring": { setupRing: func(desc *ring.Desc) { desc.AddIngester("instance-1", "127.0.0.1", "", ring.Tokens{1, 2, 3}, ring.ACTIVE, registeredAt) desc.AddIngester("instance-2", "127.0.0.2", "", ring.Tokens{4, 5, 6}, ring.ACTIVE, registeredAt) }, updateRing: func(desc *ring.Desc) { desc.RemoveIngester("instance-1") }, expectedSync: true, }, "should sync when an instance changes state": { setupRing: func(desc *ring.Desc) { desc.AddIngester("instance-1", "127.0.0.1", "", ring.Tokens{1, 2, 3}, ring.ACTIVE, registeredAt) desc.AddIngester("instance-2", "127.0.0.2", "", ring.Tokens{4, 5, 6}, ring.JOINING, registeredAt) }, updateRing: func(desc *ring.Desc) { instance := desc.Ingesters["instance-2"] instance.State = ring.ACTIVE desc.Ingesters["instance-2"] = instance }, expectedSync: true, }, "should sync when an healthy instance becomes unhealthy": { setupRing: func(desc *ring.Desc) { desc.AddIngester("instance-1", "127.0.0.1", "", ring.Tokens{1, 2, 3}, ring.ACTIVE, registeredAt) desc.AddIngester("instance-2", "127.0.0.2", "", ring.Tokens{4, 5, 6}, ring.ACTIVE, registeredAt) }, updateRing: func(desc *ring.Desc) { instance := desc.Ingesters["instance-2"] instance.Timestamp = time.Now().Add(-time.Hour).Unix() desc.Ingesters["instance-2"] = instance }, expectedSync: true, }, "should sync when an unhealthy instance becomes healthy": { setupRing: func(desc *ring.Desc) { desc.AddIngester("instance-1", "127.0.0.1", "", ring.Tokens{1, 2, 3}, ring.ACTIVE, registeredAt) instance := desc.AddIngester("instance-2", "127.0.0.2", "", ring.Tokens{4, 5, 6}, ring.ACTIVE, registeredAt) instance.Timestamp = time.Now().Add(-time.Hour).Unix() desc.Ingesters["instance-2"] = instance }, updateRing: func(desc *ring.Desc) { instance := desc.Ingesters["instance-2"] instance.Timestamp = time.Now().Unix() desc.Ingesters["instance-2"] = instance }, expectedSync: true, }, "should NOT sync when an instance updates the heartbeat": { setupRing: func(desc *ring.Desc) { desc.AddIngester("instance-1", "127.0.0.1", "", ring.Tokens{1, 2, 3}, ring.ACTIVE, registeredAt) desc.AddIngester("instance-2", "127.0.0.2", "", ring.Tokens{4, 5, 6}, ring.ACTIVE, registeredAt) }, updateRing: func(desc *ring.Desc) { instance := desc.Ingesters["instance-2"] instance.Timestamp = time.Now().Add(time.Second).Unix() desc.Ingesters["instance-2"] = instance }, expectedSync: false, }, "should NOT sync when an instance is auto-forgotten in the ring but was already unhealthy in the previous state": { setupRing: func(desc *ring.Desc) { desc.AddIngester("instance-1", "127.0.0.1", "", ring.Tokens{1, 2, 3}, ring.ACTIVE, registeredAt) desc.AddIngester("instance-2", "127.0.0.2", "", ring.Tokens{4, 5, 6}, ring.ACTIVE, registeredAt) // Set it already unhealthy. instance := desc.Ingesters["instance-2"] instance.Timestamp = time.Now().Add(-time.Hour).Unix() desc.Ingesters["instance-2"] = instance }, updateRing: func(desc *ring.Desc) { // Remove the unhealthy instance from the ring. desc.RemoveIngester("instance-2") }, expectedSync: false, }, } for testName, testData := range tests { t.Run(testName, func(t *testing.T) { ctx := context.Background() gatewayCfg := mockGatewayConfig() gatewayCfg.ShardingEnabled = true gatewayCfg.ShardingRing.RingCheckPeriod = 100 * time.Millisecond storageCfg := mockStorageConfig(t) storageCfg.BucketStore.SyncInterval = time.Hour // Do not trigger the periodic sync in this test. reg := prometheus.NewPedanticRegistry() ringStore := consul.NewInMemoryClient(ring.GetCodec()) bucketClient := &bucket.ClientMock{} bucketClient.MockIter("", []string{}, nil) g, err := newStoreGateway(gatewayCfg, storageCfg, bucketClient, ringStore, defaultLimitsOverrides(t), mockLoggingLevel(), log.NewNopLogger(), reg) require.NoError(t, err) // Store the initial ring state before starting the gateway. require.NoError(t, ringStore.CAS(ctx, RingKey, func(in interface{}) (interface{}, bool, error) { ringDesc := ring.GetOrCreateRingDesc(in) testData.setupRing(ringDesc) return ringDesc, true, nil })) require.NoError(t, services.StartAndAwaitRunning(ctx, g)) defer services.StopAndAwaitTerminated(ctx, g) //nolint:errcheck // Assert on the initial state. regs := util.NewUserRegistries() regs.AddUserRegistry("test", reg) metrics := regs.BuildMetricFamiliesPerUser() assert.Equal(t, float64(1), metrics.GetSumOfCounters("cortex_storegateway_bucket_sync_total")) // Change the ring topology. require.NoError(t, ringStore.CAS(ctx, RingKey, func(in interface{}) (interface{}, bool, error) { ringDesc := ring.GetOrCreateRingDesc(in) testData.updateRing(ringDesc) return ringDesc, true, nil })) // Assert whether the sync triggered or not. if testData.expectedSync { test.Poll(t, time.Second, float64(2), func() interface{} { metrics := regs.BuildMetricFamiliesPerUser() return metrics.GetSumOfCounters("cortex_storegateway_bucket_sync_total") }) } else { // Give some time to the store-gateway to trigger the sync (if any). time.Sleep(250 * time.Millisecond) metrics := regs.BuildMetricFamiliesPerUser() assert.Equal(t, float64(1), metrics.GetSumOfCounters("cortex_storegateway_bucket_sync_total")) } }) } }
explode_data.jsonl/57962
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 2400 }
[ 2830, 3393, 6093, 40709, 1098, 1721, 1925, 43466, 60954, 5389, 1155, 353, 8840, 836, 8, 341, 29422, 291, 1655, 1669, 882, 13244, 2822, 78216, 1669, 2415, 14032, 60, 1235, 341, 197, 84571, 43466, 262, 2915, 37673, 353, 12640, 68428, 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 TestIsZeroHashStr(t *testing.T) { tests := []struct { name string hash string want bool }{ {"correctFromStringsRepeat", strings.Repeat("00", chainhash.HashSize), true}, {"correctFromZeroHashStringer", zeroHash.String(), true}, {"correctFromZeroValueHashStringer", chainhash.Hash{}.String(), true}, {"incorrectEmptyString", "", false}, {"incorrectRandomHashString", randomHash().String(), false}, {"incorrectNotAHashAtAll", "this is totally not a hash let alone the zero hash string", false}, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { if got := IsZeroHashStr(tt.hash); got != tt.want { t.Errorf("IsZeroHashStr() = %v, want %v", got, tt.want) } }) } }
explode_data.jsonl/54137
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 262 }
[ 2830, 3393, 3872, 17999, 6370, 2580, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 3056, 1235, 341, 197, 11609, 914, 198, 197, 50333, 914, 198, 197, 50780, 1807, 198, 197, 59403, 197, 197, 4913, 19928, 3830, 20859, 38718, 497, 9069, 2817, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestSmudge(t *testing.T) { repo := NewRepository(t, "empty") defer repo.Test() prePushHookFile := filepath.Join(repo.Path, ".git", "hooks", "pre-push") progressFile := filepath.Join(repo.Path, ".git", "progress") // simple smudge example cmd := repo.Command("smudge", "somefile") cmd.Input = bytes.NewBufferString("version https://git-lfs.github.com/spec/v1\noid sha256:SOMEOID\nsize 7\n") cmd.Output = "simple" cmd.Env = append(cmd.Env, "GIT_LFS_PROGRESS="+progressFile) cmd.Before(func() { path := filepath.Join(repo.Path, ".git", "lfs", "objects", "SO", "ME") file := filepath.Join(path, "SOMEOID") assert.Equal(t, nil, os.MkdirAll(path, 0755)) assert.Equal(t, nil, ioutil.WriteFile(file, []byte("simple\n"), 0755)) }) cmd.After(func() { // assert hook is created stat, err := os.Stat(prePushHookFile) assert.Equal(t, nil, err) assert.Equal(t, false, stat.IsDir()) // assert progress file progress, err := ioutil.ReadFile(progressFile) assert.Equal(t, nil, err) progLines := bytes.Split(progress, []byte("\n")) assert.Equal(t, 2, len(progLines)) assert.Equal(t, "smudge 1/1 7/7 somefile", string(progLines[0])) assert.Equal(t, "", string(progLines[1])) }) // smudge with custom hook cmd = repo.Command("smudge") cmd.Input = bytes.NewBufferString("version https://git-lfs.github.com/spec/v1\noid sha256:4d7a214614ab2935c943f9e0ff69d22eadbb8f32b1258daaa5e2ca24d17e2393\nsize 9") cmd.Output = "whatever" customHook := []byte("echo 'yo'") cmd.Before(func() { path := filepath.Join(repo.Path, ".git", "lfs", "objects", "4d", "7a") file := filepath.Join(path, "4d7a214614ab2935c943f9e0ff69d22eadbb8f32b1258daaa5e2ca24d17e2393") assert.Equal(t, nil, os.MkdirAll(path, 0755)) assert.Equal(t, nil, ioutil.WriteFile(file, []byte("whatever\n"), 0755)) assert.Equal(t, nil, ioutil.WriteFile(prePushHookFile, customHook, 0755)) }) cmd.After(func() { // assert custom hook is not overwritten by, err := ioutil.ReadFile(prePushHookFile) assert.Equal(t, nil, err) assert.Equal(t, string(customHook), string(by)) }) }
explode_data.jsonl/8396
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 895 }
[ 2830, 3393, 10673, 19561, 1155, 353, 8840, 836, 8, 341, 17200, 5368, 1669, 1532, 4624, 1155, 11, 330, 3194, 1138, 16867, 15867, 8787, 2822, 40346, 16644, 31679, 1703, 1669, 26054, 22363, 50608, 17474, 11, 5933, 12882, 497, 330, 38560, 497...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestTransferIXFRFallback(t *testing.T) { transfer := newTestTransfer() testPlugin := transfer.Transferers[0].(*transfererPlugin) ctx := context.TODO() w := dnstest.NewMultiRecorder(&test.ResponseWriter{}) m := &dns.Msg{} m.SetIxfr( transfer.xfrs[0].Zones[0], testPlugin.Serial-1, "ns.dns."+testPlugin.Zone, "hostmaster.dns."+testPlugin.Zone, ) _, err := transfer.ServeDNS(ctx, w, m) if err != nil { t.Error(err) } validateAXFRResponse(t, w) }
explode_data.jsonl/39439
{ "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, 21970, 5396, 10504, 87206, 1155, 353, 8840, 836, 8, 341, 197, 24188, 1669, 501, 2271, 21970, 2822, 18185, 11546, 1669, 8317, 95802, 388, 58, 15, 936, 4071, 24188, 261, 11546, 692, 20985, 1669, 2266, 90988, 741, 6692, 1669, 4...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func Test_DiscoverPlugins(t *testing.T) { assert := assert.New(t) defer setupLocalDistoForTesting()() serverPlugins, standalonePlugins, err := DiscoverPlugins("") assert.Nil(err) assert.Equal(0, len(serverPlugins)) assert.Equal(1, len(standalonePlugins)) serverPlugins, standalonePlugins, err = DiscoverPlugins("mgmt-does-not-exists") assert.Nil(err) assert.Equal(0, len(serverPlugins)) assert.Equal(1, len(standalonePlugins)) serverPlugins, standalonePlugins, err = DiscoverPlugins("mgmt") assert.Nil(err) assert.Equal(1, len(serverPlugins)) assert.Equal(1, len(standalonePlugins)) assert.Equal("cluster", serverPlugins[0].Name) assert.Equal("login", standalonePlugins[0].Name) }
explode_data.jsonl/71403
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 255 }
[ 2830, 3393, 45525, 3688, 45378, 1155, 353, 8840, 836, 8, 341, 6948, 1669, 2060, 7121, 1155, 692, 16867, 6505, 7319, 23356, 78, 2461, 16451, 368, 2822, 41057, 45378, 11, 43388, 45378, 11, 1848, 1669, 32939, 45378, 31764, 6948, 59678, 3964,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestImportWithDifferingImportIdentifierFormat(t *testing.T) { loaders := []*deploytest.ProviderLoader{ deploytest.NewProviderLoader("pkgA", semver.MustParse("1.0.0"), func() (plugin.Provider, error) { return &deploytest.Provider{ DiffF: func(urn resource.URN, id resource.ID, olds, news resource.PropertyMap, ignoreChanges []string) (plugin.DiffResult, error) { if olds["foo"].DeepEquals(news["foo"]) { return plugin.DiffResult{Changes: plugin.DiffNone}, nil } return plugin.DiffResult{ Changes: plugin.DiffSome, DetailedDiff: map[string]plugin.PropertyDiff{ "foo": {Kind: plugin.DiffUpdate}, }, }, nil }, CreateF: func(urn resource.URN, news resource.PropertyMap, timeout float64, preview bool) (resource.ID, resource.PropertyMap, resource.Status, error) { return "created-id", news, resource.StatusOK, nil }, ReadF: func(urn resource.URN, id resource.ID, inputs, state resource.PropertyMap) (plugin.ReadResult, resource.Status, error) { return plugin.ReadResult{ // This ID is deliberately not the same as the ID used to import. ID: "id", Inputs: resource.PropertyMap{ "foo": resource.NewStringProperty("bar"), }, Outputs: resource.PropertyMap{ "foo": resource.NewStringProperty("bar"), }, }, resource.StatusOK, nil }, }, nil }), } program := deploytest.NewLanguageRuntime(func(_ plugin.RunInfo, monitor *deploytest.ResourceMonitor) error { _, _, _, err := monitor.RegisterResource("pkgA:m:typA", "resA", true, deploytest.ResourceOptions{ Inputs: resource.PropertyMap{ "foo": resource.NewStringProperty("bar"), }, // The import ID is deliberately not the same as the ID returned from Read. ImportID: resource.ID("import-id"), }) assert.NoError(t, err) return nil }) host := deploytest.NewPluginHost(nil, nil, program, loaders...) p := &TestPlan{ Options: UpdateOptions{Host: host}, } provURN := p.NewProviderURN("pkgA", "default", "") resURN := p.NewURN("pkgA:m:typA", "resA", "") // Run the initial update. The import should succeed. project := p.GetProject() snap, res := TestOp(Update).Run(project, p.GetTarget(nil), p.Options, false, p.BackendClient, func(_ workspace.Project, _ deploy.Target, entries JournalEntries, _ []Event, res result.Result) result.Result { for _, entry := range entries { switch urn := entry.Step.URN(); urn { case provURN: assert.Equal(t, deploy.OpCreate, entry.Step.Op()) case resURN: assert.Equal(t, deploy.OpImport, entry.Step.Op()) default: t.Fatalf("unexpected resource %v", urn) } } return res }) assert.Nil(t, res) assert.Len(t, snap.Resources, 2) // Now, run another update. The update should succeed and there should be no diffs. snap, res = TestOp(Update).Run(project, p.GetTarget(snap), p.Options, false, p.BackendClient, func(_ workspace.Project, _ deploy.Target, entries JournalEntries, _ []Event, res result.Result) result.Result { for _, entry := range entries { switch urn := entry.Step.URN(); urn { case provURN, resURN: assert.Equal(t, deploy.OpSame, entry.Step.Op()) default: t.Fatalf("unexpected resource %v", urn) } } return res }) assert.Nil(t, res) }
explode_data.jsonl/4172
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1268 }
[ 2830, 3393, 11511, 2354, 35, 14320, 287, 11511, 8714, 4061, 1155, 353, 8840, 836, 8, 341, 49386, 388, 1669, 29838, 35794, 1944, 36208, 9181, 515, 197, 197, 35794, 1944, 7121, 5179, 9181, 445, 30069, 32, 497, 5234, 423, 50463, 14463, 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...
2
func TestDualstackLabelIsSet(t *testing.T) { source := &routeGroupSource{ cli: &fakeRouteGroupClient{ rg: &routeGroupList{ Items: []*routeGroup{ createTestRouteGroup( "namespace1", "rg1", map[string]string{ ALBDualstackAnnotationKey: ALBDualstackAnnotationValue, }, []string{"rg1.k8s.example"}, []routeGroupLoadBalancer{ { Hostname: "lb.example.org", }, }, ), }, }, }, } got, _ := source.Endpoints(context.Background()) for _, ep := range got { if v, ok := ep.Labels[endpoint.DualstackLabelKey]; !ok || v != "true" { t.Errorf("Failed to set resource label on ep %v", ep) } } }
explode_data.jsonl/55707
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 326 }
[ 2830, 3393, 85074, 7693, 2476, 3872, 1649, 1155, 353, 8840, 836, 8, 341, 47418, 1669, 609, 8966, 2808, 3608, 515, 197, 86448, 25, 609, 30570, 4899, 2808, 2959, 515, 298, 197, 1984, 25, 609, 8966, 2808, 852, 515, 571, 197, 4353, 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...
4
func TestHandleMsgVerifyInvariant(t *testing.T) { app, ctx, addrs := createTestApp() sender := addrs[0] cases := []struct { name string msg sdk.Msg expectedResult string }{ {"bad invariant route", crisis.NewMsgVerifyInvariant(sender, testModuleName, "route-that-doesnt-exist"), "fail"}, {"invariant broken", crisis.NewMsgVerifyInvariant(sender, testModuleName, dummyRouteWhichFails.Route), "fail"}, {"invariant passing", crisis.NewMsgVerifyInvariant(sender, testModuleName, dummyRouteWhichPasses.Route), "fail"}, {"invalid msg", sdk.NewTestMsg(), "fail"}, } for _, tc := range cases { tc := tc t.Run(tc.name, func(t *testing.T) { h := crisis.NewHandler(app.CrisisKeeper) switch tc.expectedResult { case "fail": res, err := h(ctx, tc.msg) require.Error(t, err) require.Nil(t, res) case "pass": res, err := h(ctx, tc.msg) require.NoError(t, err) require.NotNil(t, res) case "panic": require.Panics(t, func() { h(ctx, tc.msg) }) } }) } }
explode_data.jsonl/54741
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 452 }
[ 2830, 3393, 6999, 6611, 32627, 76621, 1155, 353, 8840, 836, 8, 341, 28236, 11, 5635, 11, 912, 5428, 1669, 1855, 2271, 2164, 741, 1903, 1659, 1669, 912, 5428, 58, 15, 2533, 1444, 2264, 1669, 3056, 1235, 341, 197, 11609, 1843, 914, 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
func TestGOPathShlib(t *testing.T) { goCmd(t, "install", "-buildmode=shared", "-linkshared", "dep") AssertIsLinkedTo(t, filepath.Join(gopathInstallDir, "libdep.so"), soname) goCmd(t, "install", "-linkshared", "exe") AssertIsLinkedTo(t, "./bin/exe", soname) AssertIsLinkedTo(t, "./bin/exe", "libdep.so") AssertHasRPath(t, "./bin/exe", gorootInstallDir) AssertHasRPath(t, "./bin/exe", gopathInstallDir) // And check it runs. run(t, "executable linked to GOPATH library", "./bin/exe") }
explode_data.jsonl/24191
{ "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, 15513, 1820, 2016, 2740, 1155, 353, 8840, 836, 8, 341, 30680, 15613, 1155, 11, 330, 12248, 497, 6523, 5834, 8516, 28, 6100, 497, 6523, 2080, 6100, 497, 330, 14891, 1138, 18017, 3872, 22070, 1249, 1155, 11, 26054, 22363, 3268...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestParseString(t *testing.T) { tests := []struct { in string out string ext string err string }{ {`""`, `""`, ``, ``}, {`"1234567890"`, `"1234567890"`, ``, ``}, {`"Hello World!"`, `"Hello World!"`, ``, ``}, {`"Hello\"World!"`, `"Hello\"World!"`, ``, ``}, {`"\\"`, `"\\"`, ``, ``}, {`"\u0061\u0062\u0063"`, `"\u0061\u0062\u0063"`, ``, ``}, {`"\u0"`, ``, ``, `json: unicode code point must have at least 4 characters: 0"`}, } for _, test := range tests { t.Run(test.in, func(t *testing.T) { out, ext, err := parseString([]byte(test.in)) if test.err == "" { if err != nil { t.Errorf("%s => %s", test.in, err) return } } else { if s := err.Error(); s != test.err { t.Error("invalid error") t.Logf("expected: %s", test.err) t.Logf("found: %s", s) } } if s := string(out); s != test.out { t.Error("invalid output") t.Logf("expected: %s", test.out) t.Logf("found: %s", s) } if s := string(ext); s != test.ext { t.Error("invalid extra bytes") t.Logf("expected: %s", test.ext) t.Logf("found: %s", s) } }) } }
explode_data.jsonl/54774
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 574 }
[ 2830, 3393, 14463, 703, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 3056, 1235, 341, 197, 17430, 220, 914, 198, 197, 13967, 914, 198, 197, 95450, 914, 198, 197, 9859, 914, 198, 197, 59403, 197, 197, 90, 63, 3014, 7808, 1565, 3014, 78...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestExtractResourceGroupByNicID(t *testing.T) { testCases := []struct { name string nicID string expectedRG string expectedErrMsg error }{ { name: "ExtractResourceGroupByNicID should return correct resource group", nicID: "/subscriptions/sub/resourceGroups/rg/providers/Microsoft.Network/networkInterfaces/nic", expectedRG: "rg", }, { name: "ExtractResourceGroupByNicID should report error if nicID is invalid", nicID: "/subscriptions/sub/resourceGroups/rg/providers/Microsoft.Compute/networkInterfaces/nic", expectedErrMsg: fmt.Errorf("error of extracting resourceGroup from nicID %q", "/subscriptions/sub/resourceGroups/rg/providers/Microsoft.Compute/networkInterfaces/nic"), }, } for _, test := range testCases { rgName, err := extractResourceGroupByNicID(test.nicID) assert.Equal(t, test.expectedErrMsg, err, test.name) assert.Equal(t, test.expectedRG, rgName, test.name) } }
explode_data.jsonl/7469
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 380 }
[ 2830, 3393, 28959, 4783, 2808, 1359, 57816, 915, 1155, 353, 8840, 836, 8, 341, 18185, 37302, 1669, 3056, 1235, 341, 197, 11609, 1843, 914, 198, 197, 9038, 292, 915, 688, 914, 198, 197, 42400, 32360, 257, 914, 198, 197, 42400, 75449, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestMakeTrusted(t *testing.T) { v := MakeTrusted(Null, []byte("abcd")) if !reflect.DeepEqual(v, NULL) { t.Errorf("MakeTrusted(Null...) = %v, want null", v) } v = MakeTrusted(Int64, []byte("1")) want := TestValue(Int64, "1") if !reflect.DeepEqual(v, want) { t.Errorf("MakeTrusted(Int64, \"1\") = %v, want %v", v, want) } }
explode_data.jsonl/30808
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 150 }
[ 2830, 3393, 8078, 1282, 27145, 1155, 353, 8840, 836, 8, 341, 5195, 1669, 7405, 1282, 27145, 7, 3280, 11, 3056, 3782, 445, 68644, 5455, 743, 753, 34913, 94750, 3747, 11, 1770, 8, 341, 197, 3244, 13080, 445, 8078, 1282, 27145, 7, 3280, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestWrongEncrypted(t *testing.T) { wrongEncrypted := "ca8e81c53958038846775d6f00c46df086e601d33bd0af78e1b4d396e90e42afe330e53787ea0832e3562e7e718feb71" _, err := NewAESCipher("hseRTo5bUFhdeI9W").AESDecrypt(wrongEncrypted) require.Error(t, err) }
explode_data.jsonl/10854
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 125 }
[ 2830, 3393, 29185, 7408, 14026, 1155, 353, 8840, 836, 8, 341, 6692, 14347, 7408, 14026, 1669, 330, 924, 23, 68, 23, 16, 66, 20, 18, 24, 20, 23, 15, 18, 23, 23, 19, 21, 22, 22, 20, 67, 21, 69, 15, 15, 66, 19, 21, 2940, 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 TestStickyLoadBalanaceWorksWithMultipleEndpointsRemoveOne(t *testing.T) { client1 := &net.TCPAddr{IP: net.IPv4(127, 0, 0, 1), Port: 0} client2 := &net.TCPAddr{IP: net.IPv4(127, 0, 0, 2), Port: 0} client3 := &net.TCPAddr{IP: net.IPv4(127, 0, 0, 3), Port: 0} client4 := &net.TCPAddr{IP: net.IPv4(127, 0, 0, 4), Port: 0} client5 := &net.TCPAddr{IP: net.IPv4(127, 0, 0, 5), Port: 0} client6 := &net.TCPAddr{IP: net.IPv4(127, 0, 0, 6), Port: 0} loadBalancer := NewLoadBalancerRR() service := proxy.ServicePortName{NamespacedName: types.NamespacedName{Namespace: "testnamespace", Name: "foo"}, Port: ""} endpoint, err := loadBalancer.NextEndpoint(service, nil, false) if err == nil || len(endpoint) != 0 { t.Errorf("Didn't fail with non-existent service") } loadBalancer.NewService(service, api.ServiceAffinityClientIP, 0) endpoints := make([]api.Endpoints, 1) endpoints[0] = api.Endpoints{ ObjectMeta: api.ObjectMeta{Name: service.Name, Namespace: service.Namespace}, Subsets: []api.EndpointSubset{ { Addresses: []api.EndpointAddress{{IP: "endpoint"}}, Ports: []api.EndpointPort{{Port: 1}, {Port: 2}, {Port: 3}}, }, }, } loadBalancer.OnEndpointsUpdate(endpoints) shuffledEndpoints := loadBalancer.services[service].endpoints expectEndpoint(t, loadBalancer, service, shuffledEndpoints[0], client1) client1Endpoint := shuffledEndpoints[0] expectEndpoint(t, loadBalancer, service, shuffledEndpoints[0], client1) expectEndpoint(t, loadBalancer, service, shuffledEndpoints[1], client2) client2Endpoint := shuffledEndpoints[1] expectEndpoint(t, loadBalancer, service, shuffledEndpoints[1], client2) expectEndpoint(t, loadBalancer, service, shuffledEndpoints[2], client3) client3Endpoint := shuffledEndpoints[2] endpoints[0] = api.Endpoints{ ObjectMeta: api.ObjectMeta{Name: service.Name, Namespace: service.Namespace}, Subsets: []api.EndpointSubset{ { Addresses: []api.EndpointAddress{{IP: "endpoint"}}, Ports: []api.EndpointPort{{Port: 1}, {Port: 2}}, }, }, } loadBalancer.OnEndpointsUpdate(endpoints) shuffledEndpoints = loadBalancer.services[service].endpoints if client1Endpoint == "endpoint:3" { client1Endpoint = shuffledEndpoints[0] } else if client2Endpoint == "endpoint:3" { client2Endpoint = shuffledEndpoints[0] } else if client3Endpoint == "endpoint:3" { client3Endpoint = shuffledEndpoints[0] } expectEndpoint(t, loadBalancer, service, client1Endpoint, client1) expectEndpoint(t, loadBalancer, service, client2Endpoint, client2) expectEndpoint(t, loadBalancer, service, client3Endpoint, client3) endpoints[0] = api.Endpoints{ ObjectMeta: api.ObjectMeta{Name: service.Name, Namespace: service.Namespace}, Subsets: []api.EndpointSubset{ { Addresses: []api.EndpointAddress{{IP: "endpoint"}}, Ports: []api.EndpointPort{{Port: 1}, {Port: 2}, {Port: 4}}, }, }, } loadBalancer.OnEndpointsUpdate(endpoints) shuffledEndpoints = loadBalancer.services[service].endpoints expectEndpoint(t, loadBalancer, service, client1Endpoint, client1) expectEndpoint(t, loadBalancer, service, client2Endpoint, client2) expectEndpoint(t, loadBalancer, service, client3Endpoint, client3) expectEndpoint(t, loadBalancer, service, shuffledEndpoints[0], client4) expectEndpoint(t, loadBalancer, service, shuffledEndpoints[1], client5) expectEndpoint(t, loadBalancer, service, shuffledEndpoints[2], client6) }
explode_data.jsonl/66181
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1308 }
[ 2830, 3393, 623, 18964, 5879, 33, 32283, 578, 6776, 16056, 32089, 80786, 13021, 3966, 1155, 353, 8840, 836, 8, 341, 25291, 16, 1669, 609, 4711, 836, 7123, 13986, 90, 3298, 25, 4179, 46917, 85, 19, 7, 16, 17, 22, 11, 220, 15, 11, 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...
6
func TestMovedModule(t *testing.T) { modulesPath, err := filepath.Abs("./test/moved_module") require.NoError(t, err) configs := []*ModuleConfig{ { Module: "old", Filesets: map[string]*FilesetConfig{ "test": {}, }, }, } reg, err := newModuleRegistry(modulesPath, configs, nil, beat.Info{Version: "5.2.0"}) require.NoError(t, err) assert.NotNil(t, reg) }
explode_data.jsonl/64755
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 164 }
[ 2830, 3393, 53232, 3332, 1155, 353, 8840, 836, 8, 341, 42228, 2425, 1820, 11, 1848, 1669, 26054, 33255, 13988, 1944, 3183, 4941, 10750, 1138, 17957, 35699, 1155, 11, 1848, 692, 25873, 82, 1669, 29838, 3332, 2648, 515, 197, 197, 515, 298...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestRestore(t *testing.T) { env, cleanup := withTestEnvironment(t) defer cleanup() testRunInit(t, env.gopts) for i := 0; i < 10; i++ { p := filepath.Join(env.testdata, fmt.Sprintf("foo/bar/testfile%v", i)) rtest.OK(t, os.MkdirAll(filepath.Dir(p), 0755)) rtest.OK(t, appendRandomData(p, uint(mrand.Intn(2<<21)))) } opts := BackupOptions{} testRunBackup(t, filepath.Dir(env.testdata), []string{filepath.Base(env.testdata)}, opts, env.gopts) testRunCheck(t, env.gopts) // Restore latest without any filters restoredir := filepath.Join(env.base, "restore") testRunRestoreLatest(t, env.gopts, restoredir, nil, nil) diff := directoriesContentsDiff(env.testdata, filepath.Join(restoredir, filepath.Base(env.testdata))) rtest.Assert(t, diff == "", "directories are not equal %v", diff) }
explode_data.jsonl/43558
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 321 }
[ 2830, 3393, 56284, 1155, 353, 8840, 836, 8, 341, 57538, 11, 21290, 1669, 448, 2271, 12723, 1155, 340, 16867, 21290, 2822, 18185, 6727, 3803, 1155, 11, 6105, 1302, 10518, 692, 2023, 600, 1669, 220, 15, 26, 600, 366, 220, 16, 15, 26, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestGenModel_Issue981(t *testing.T) { specDoc, err := loads.Spec("../fixtures/bugs/981/swagger.json") require.NoError(t, err) definitions := specDoc.Spec().Definitions k := "User" opts := opts() genModel, err := makeGenDefinition(k, "models", definitions[k], specDoc, opts) require.NoError(t, err) buf := bytes.NewBuffer(nil) require.NoError(t, opts.templates.MustGet("model").Execute(buf, genModel)) ct, err := opts.LanguageOpts.FormatContent("user.go", buf.Bytes()) require.NoError(t, err) res := string(ct) assertInCode(t, "FirstName string `json:\"first_name,omitempty\"`", res) assertInCode(t, "LastName string `json:\"last_name,omitempty\"`", res) assertInCode(t, "if swag.IsZero(m.Type)", res) assertInCode(t, `validate.MinimumInt("user_type", "body", m.Type, 1, false)`, res) assertInCode(t, `validate.MaximumInt("user_type", "body", m.Type, 5, false)`, res) }
explode_data.jsonl/2558
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 344 }
[ 2830, 3393, 9967, 1712, 7959, 83890, 24, 23, 16, 1155, 353, 8840, 836, 8, 341, 98100, 9550, 11, 1848, 1669, 20907, 36473, 17409, 45247, 14, 56176, 14, 24, 23, 16, 80930, 4323, 1138, 17957, 35699, 1155, 11, 1848, 692, 7452, 4054, 82, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestEnabledLogStreamEvents(t *testing.T) { tracer := mocktracer.New() tracing := newProxyTracing(&OpenTracingParams{ Tracer: tracer, LogStreamEvents: true, }) span := tracer.StartSpan("test") defer span.Finish() tracing.logStreamEvent(span, "test-filter", StartEvent) tracing.logStreamEvent(span, "test-filter", EndEvent) mockSpan := span.(*mocktracer.MockSpan) if len(mockSpan.Logs()) != 2 { t.Errorf("filter lifecycle events were not logged although it was enabled") } }
explode_data.jsonl/50653
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 191 }
[ 2830, 3393, 5462, 2201, 3027, 7900, 1155, 353, 8840, 836, 8, 341, 25583, 9584, 1669, 7860, 94941, 7121, 741, 25583, 4527, 1669, 501, 16219, 1282, 4527, 2099, 5002, 1282, 4527, 4870, 515, 197, 197, 1282, 9584, 25, 688, 64306, 345, 197, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestValidate(t *testing.T) { c := internal.NewConfigurationWithDefaults() viper.Set(configuration.ViperKeySubjectTypesSupported, []string{"pairwise", "public"}) viper.Set(configuration.ViperKeyDefaultClientScope, []string{"openid"}) v := NewValidator(c) for k, tc := range []struct { in *Client check func(t *testing.T, c *Client) expectErr bool v func(t *testing.T) *Validator }{ { in: new(Client), check: func(t *testing.T, c *Client) { assert.NotEmpty(t, c.ClientID) assert.NotEmpty(t, c.GetID()) assert.Equal(t, c.GetID(), c.ClientID) }, }, { in: &Client{ClientID: "foo"}, check: func(t *testing.T, c *Client) { assert.Equal(t, c.GetID(), c.ClientID) }, }, { in: &Client{ClientID: "foo"}, check: func(t *testing.T, c *Client) { assert.Equal(t, c.GetID(), c.ClientID) }, }, { in: &Client{ClientID: "foo", UserinfoSignedResponseAlg: "foo"}, expectErr: true, }, { in: &Client{ClientID: "foo", TokenEndpointAuthMethod: "private_key_jwt"}, expectErr: true, }, { in: &Client{ClientID: "foo", JSONWebKeys: &x.JoseJSONWebKeySet{JSONWebKeySet: new(jose.JSONWebKeySet)}, JSONWebKeysURI: "asdf", TokenEndpointAuthMethod: "private_key_jwt"}, expectErr: true, }, { in: &Client{ClientID: "foo", JSONWebKeys: &x.JoseJSONWebKeySet{JSONWebKeySet: new(jose.JSONWebKeySet)}, TokenEndpointAuthMethod: "private_key_jwt", TokenEndpointAuthSigningAlgorithm: "HS256"}, expectErr: true, }, { in: &Client{ClientID: "foo", PostLogoutRedirectURIs: []string{"https://bar/"}, RedirectURIs: []string{"https://foo/"}}, expectErr: true, }, { in: &Client{ClientID: "foo", PostLogoutRedirectURIs: []string{"http://foo/"}, RedirectURIs: []string{"https://foo/"}}, expectErr: true, }, { in: &Client{ClientID: "foo", PostLogoutRedirectURIs: []string{"https://foo:1234/"}, RedirectURIs: []string{"https://foo/"}}, expectErr: true, }, { in: &Client{ClientID: "foo", PostLogoutRedirectURIs: []string{"https://foo/"}, RedirectURIs: []string{"https://foo/"}}, check: func(t *testing.T, c *Client) { assert.Equal(t, []string{"https://foo/"}, []string(c.PostLogoutRedirectURIs)) }, }, { in: &Client{ClientID: "foo"}, check: func(t *testing.T, c *Client) { assert.Equal(t, "public", c.SubjectType) }, }, { v: func(t *testing.T) *Validator { viper.Set(configuration.ViperKeySubjectTypesSupported, []string{"pairwise"}) return NewValidator(c) }, in: &Client{ClientID: "foo"}, check: func(t *testing.T, c *Client) { assert.Equal(t, "pairwise", c.SubjectType) }, }, { in: &Client{ClientID: "foo", SubjectType: "pairwise"}, check: func(t *testing.T, c *Client) { assert.Equal(t, "pairwise", c.SubjectType) }, }, { in: &Client{ClientID: "foo", SubjectType: "foo"}, expectErr: true, }, } { t.Run(fmt.Sprintf("case=%d", k), func(t *testing.T) { if tc.v == nil { tc.v = func(t *testing.T) *Validator { return v } } err := tc.v(t).Validate(tc.in) if tc.expectErr { require.Error(t, err) } else { require.NoError(t, err) tc.check(t, tc.in) } }) } }
explode_data.jsonl/70141
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1519 }
[ 2830, 3393, 17926, 1155, 353, 8840, 836, 8, 341, 1444, 1669, 5306, 7121, 7688, 2354, 16273, 741, 5195, 12858, 4202, 48724, 5058, 12858, 1592, 13019, 4173, 34636, 11, 3056, 917, 4913, 12670, 4482, 497, 330, 888, 23625, 5195, 12858, 4202, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestClient_ShowTransaction(t *testing.T) { t.Parallel() app, cleanup := cltest.NewApplicationWithKey(t, cltest.LenientEthMock) defer cleanup() require.NoError(t, app.Start()) store := app.GetStore() from := cltest.GetAccountAddress(t, store) tx := cltest.CreateTx(t, store, from, 1) client, r := app.NewClientAndRenderer() set := flag.NewFlagSet("test get tx", 0) set.Parse([]string{tx.Hash.Hex()}) c := cli.NewContext(nil, set, nil) assert.NoError(t, client.ShowTransaction(c)) renderedTx := *r.Renders[0].(*presenters.Tx) assert.Equal(t, &tx.From, renderedTx.From) }
explode_data.jsonl/78859
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 228 }
[ 2830, 3393, 2959, 79665, 8070, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 2822, 28236, 11, 21290, 1669, 1185, 1944, 7121, 4988, 2354, 1592, 1155, 11, 1185, 1944, 65819, 1167, 65390, 11571, 340, 16867, 21290, 741, 17957, 35699, 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 TestGetAllSSMSecretRequirements(t *testing.T) { regionWest := "us-west-2" regionEast := "us-east-1" secret1 := apicontainer.Secret{ Provider: "ssm", Name: "secret1", Region: regionWest, ValueFrom: "/test/secretName1", } secret2 := apicontainer.Secret{ Provider: "asm", Name: "secret2", Region: regionWest, ValueFrom: "/test/secretName2", } secret3 := apicontainer.Secret{ Provider: "ssm", Name: "secret3", Region: regionEast, ValueFrom: "/test/secretName3", } container := &apicontainer.Container{ Name: "myName", Image: "image:tag", Secrets: []apicontainer.Secret{secret1, secret2, secret3}, TransitionDependenciesMap: make(map[apicontainerstatus.ContainerStatus]apicontainer.TransitionDependencySet), } task := &Task{ Arn: "test", ResourcesMapUnsafe: make(map[string][]taskresource.TaskResource), Containers: []*apicontainer.Container{container}, } reqs := task.getAllSSMSecretRequirements() assert.Equal(t, secret1, reqs[regionWest][0]) assert.Equal(t, 1, len(reqs[regionWest])) }
explode_data.jsonl/37240
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 517 }
[ 2830, 3393, 1949, 2403, 1220, 4826, 50856, 59202, 1155, 353, 8840, 836, 8, 341, 197, 3943, 23306, 1669, 330, 355, 37602, 12, 17, 698, 197, 3943, 36340, 1669, 330, 355, 39507, 12, 16, 1837, 197, 20474, 16, 1669, 1443, 51160, 1743, 7477...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestMissingValueInMIddle(t *testing.T) { var args struct { Foo string Bar string } err := parse("--foo --bar=abc", &args) assert.Error(t, err) }
explode_data.jsonl/13014
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 64 }
[ 2830, 3393, 25080, 1130, 641, 9773, 631, 273, 1155, 353, 8840, 836, 8, 341, 2405, 2827, 2036, 341, 197, 12727, 2624, 914, 198, 197, 197, 3428, 914, 198, 197, 532, 9859, 1669, 4715, 21549, 7975, 1177, 2257, 28, 13683, 497, 609, 2116, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestCreateCgroupPathExists(t *testing.T) { ctrl := gomock.NewController(t) defer ctrl.Finish() mockControl := mock_control.NewMockControl(ctrl) mockIO := mock_ioutilwrapper.NewMockIOUtil(ctrl) cgroupRoot := fmt.Sprintf("/ecs/%s", taskID) gomock.InOrder( mockControl.EXPECT().Exists(gomock.Any()).Return(true), ) cgroupResource := NewCgroupResource("taskArn", mockControl, mockIO, cgroupRoot, cgroupMountPath, specs.LinuxResources{}) assert.NoError(t, cgroupResource.Create()) }
explode_data.jsonl/68158
{ "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, 4021, 34, 4074, 1820, 15575, 1155, 353, 8840, 836, 8, 341, 84381, 1669, 342, 316, 1176, 7121, 2051, 1155, 340, 16867, 23743, 991, 18176, 2822, 77333, 3273, 1669, 7860, 13436, 7121, 11571, 3273, 62100, 340, 77333, 3810, 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 TestResourcesDuration_String(t *testing.T) { assert.Empty(t, ResourcesDuration{}.String(), "empty") assert.Equal(t, "1s*(100Mi memory)", ResourcesDuration{corev1.ResourceMemory: NewResourceDuration(1 * time.Second)}.String(), "memory") }
explode_data.jsonl/26040
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 77 }
[ 2830, 3393, 11277, 12945, 31777, 1155, 353, 8840, 836, 8, 341, 6948, 11180, 1155, 11, 16209, 12945, 46391, 703, 1507, 330, 3194, 1138, 6948, 12808, 1155, 11, 330, 16, 82, 6599, 16, 15, 15, 41887, 4938, 11583, 16209, 12945, 90, 98645, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestImage_OrderBySemverTagDesc(t *testing.T) { ti := time.Time{} aa := mustMakeInfo("my/image:3", ti) bb := mustMakeInfo("my/image:v1", ti) cc := mustMakeInfo("my/image:1.10", ti) dd := mustMakeInfo("my/image:1.2.30", ti) ee := mustMakeInfo("my/image:1.10.0", ti) // same as 1.10 but should be considered newer ff := mustMakeInfo("my/image:bbb-not-semver", ti) gg := mustMakeInfo("my/image:aaa-not-semver", ti) imgs := []Info{aa, bb, cc, dd, ee, ff, gg} Sort(imgs, NewerBySemver) expected := []Info{aa, ee, cc, dd, bb, gg, ff} assert.Equal(t, tags(expected), tags(imgs)) // stable? reverse(imgs) Sort(imgs, NewerBySemver) assert.Equal(t, tags(expected), tags(imgs)) }
explode_data.jsonl/60189
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 297 }
[ 2830, 3393, 1906, 62, 34605, 29499, 423, 5668, 11065, 1155, 353, 8840, 836, 8, 341, 72859, 1669, 882, 16299, 16094, 197, 5305, 1669, 1969, 8078, 1731, 445, 2408, 23349, 25, 18, 497, 8988, 340, 2233, 65, 1669, 1969, 8078, 1731, 445, 24...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func Test_Validate_DNS(t *testing.T) { for _, name := range []string{"test.-", "!", "-"} { errs := validation.IsDNS1123Subdomain(name) if len(errs) == 0 { t.Fatalf("Expected errors validating name %q", name) } } }
explode_data.jsonl/61613
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 94 }
[ 2830, 3393, 62, 17926, 1557, 2448, 1155, 353, 8840, 836, 8, 341, 2023, 8358, 829, 1669, 2088, 3056, 917, 4913, 1944, 12612, 497, 330, 18789, 6523, 9207, 341, 197, 9859, 82, 1669, 10519, 4506, 61088, 16, 16, 17, 18, 3136, 12204, 3153, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestMonInQuorum(t *testing.T) { entry := client.MonMapEntry{Name: "foo", Rank: 23} quorum := []int{} // Nothing in quorum assert.False(t, monInQuorum(entry, quorum)) // One or more members in quorum quorum = []int{23} assert.True(t, monInQuorum(entry, quorum)) quorum = []int{5, 6, 7, 23, 8} assert.True(t, monInQuorum(entry, quorum)) // Not in quorum entry.Rank = 1 assert.False(t, monInQuorum(entry, quorum)) }
explode_data.jsonl/39529
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 175 }
[ 2830, 3393, 11095, 641, 2183, 33006, 1155, 353, 8840, 836, 8, 341, 48344, 1669, 2943, 52211, 2227, 5874, 63121, 25, 330, 7975, 497, 19298, 25, 220, 17, 18, 532, 197, 446, 33006, 1669, 3056, 396, 16094, 197, 322, 12064, 304, 922, 33006...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestEqualWrapper_Funcs(t *testing.T) { assert := New(t) type f func() int var f1 f = func() int { return 1 } var f2 f = func() int { return 2 } var f1_copy f = f1 assert.Equal(f1_copy, f1, "Funcs are the same and should be considered equal") assert.NotEqual(f1, f2, "f1 and f2 are different") }
explode_data.jsonl/54977
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 124 }
[ 2830, 3393, 2993, 11542, 1400, 1347, 82, 1155, 353, 8840, 836, 8, 1476, 6948, 1669, 1532, 1155, 692, 13158, 282, 2915, 368, 526, 198, 2405, 282, 16, 282, 284, 2915, 368, 526, 314, 470, 220, 16, 456, 2405, 282, 17, 282, 284, 2915, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestMakeAlphanumeric(t *testing.T) { cases := []struct { text string length int bitLength int bytes []byte }{ {"", 0, 0, []byte{}}, {"A", 1, 6, []byte{0x0, 0x0, 0x1, 0x0, 0x1, 0x0}}, {"%:", 2, 11, []byte{0x1, 0x1, 0x0, 0x1, 0x1, 0x0, 0x1, 0x1, 0x0, 0x1, 0x0}}, {"Q R", 3, 17, []byte{0x1, 0x0, 0x0, 0x1, 0x0, 0x1, 0x1, 0x0, 0x1, 0x1, 0x0, 0x0, 0x1, 0x1, 0x0, 0x1, 0x1}}, } for _, tc := range cases { t.Run(fmt.Sprintf("TestMakeAlphanumeric %v", tc), func(t *testing.T) { seg := MakeAlphanumeric(tc.text) assert.Equal(t, Alphanumeric, seg.Mode) assert.Equal(t, tc.length, seg.NumChars) assert.Equal(t, tc.bitLength, len(seg.Data)) assert.Equal(t, tc.bytes, seg.Data) }) } }
explode_data.jsonl/54191
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 406 }
[ 2830, 3393, 8078, 2101, 65788, 1155, 353, 8840, 836, 8, 341, 1444, 2264, 1669, 3056, 1235, 341, 197, 15425, 414, 914, 198, 197, 49046, 262, 526, 198, 197, 79980, 4373, 526, 198, 197, 70326, 257, 3056, 3782, 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 TestBundle_AddApplicationsByBundleName(t *testing.T) { b := NewBundle(yaml.GetName()) //Add basisset err := b.AddApplicationsByBundleName(bundles.Caos) assert.NoError(t, err) apps := bundles.GetCaos() eqApps := b.GetApplications() assert.Equal(t, len(eqApps), len(apps)) for eqApp := range eqApps { assert.Contains(t, apps, eqApp) } }
explode_data.jsonl/48060
{ "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, 8409, 21346, 50359, 1359, 8409, 675, 1155, 353, 8840, 836, 8, 341, 2233, 1669, 1532, 8409, 7021, 9467, 60304, 12367, 197, 322, 2212, 3046, 4888, 198, 9859, 1669, 293, 1904, 50359, 1359, 8409, 675, 1883, 49204, 727, 64866, 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...
2
func TestBinaryExprName(t *testing.T) { for i, tt := range []struct { expr string name string }{ {expr: `value + 1`, name: `value`}, {expr: `"user" / total`, name: `user_total`}, {expr: `("user" + total) / total`, name: `user_total_total`}, } { expr := influxql.MustParseExpr(tt.expr) switch expr := expr.(type) { case *influxql.BinaryExpr: name := influxql.BinaryExprName(expr) if name != tt.name { t.Errorf("%d. unexpected name %s, got %s", i, name, tt.name) } default: t.Errorf("%d. unexpected expr type: %T", i, expr) } } }
explode_data.jsonl/24814
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 253 }
[ 2830, 3393, 21338, 16041, 675, 1155, 353, 8840, 836, 8, 341, 2023, 600, 11, 17853, 1669, 2088, 3056, 1235, 341, 197, 8122, 649, 914, 198, 197, 11609, 914, 198, 197, 59403, 197, 197, 90, 9413, 25, 1565, 957, 488, 220, 16, 7808, 829, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestNewLoggerFromConfig(t *testing.T) { c, _, _ := getTestConfig() _, atomicLevel := NewLoggerFromConfig(c, "queueproxy") if atomicLevel.Level() != zapcore.DebugLevel { t.Errorf("logger level wanted: DebugLevel, got: %v", atomicLevel) } }
explode_data.jsonl/37329
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 91 }
[ 2830, 3393, 3564, 7395, 3830, 2648, 1155, 353, 8840, 836, 8, 341, 1444, 11, 8358, 716, 1669, 633, 2271, 2648, 741, 197, 6878, 24510, 4449, 1669, 1532, 7395, 3830, 2648, 1337, 11, 330, 4584, 22803, 1138, 743, 24510, 4449, 25259, 368, 9...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestTryUpdatingCache(t *testing.T) { ctx := &types.SystemContext{ SystemRegistriesConfPath: "testdata/try-update-cache-valid.conf", SystemRegistriesConfDirPath: "testdata/this-does-not-exist", } InvalidateCache() registries, err := TryUpdatingCache(ctx) assert.Nil(t, err) assert.Equal(t, 1, len(registries.Registries)) assert.Equal(t, 1, len(configCache)) ctxInvalid := &types.SystemContext{ SystemRegistriesConfPath: "testdata/try-update-cache-invalid.conf", SystemRegistriesConfDirPath: "testdata/this-does-not-exist", } registries, err = TryUpdatingCache(ctxInvalid) assert.NotNil(t, err) assert.Nil(t, registries) assert.Equal(t, 1, len(configCache)) }
explode_data.jsonl/62239
{ "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, 21453, 46910, 8233, 1155, 353, 8840, 836, 8, 341, 20985, 1669, 609, 9242, 16620, 1972, 515, 197, 5816, 3477, 380, 4019, 15578, 1820, 25, 262, 330, 92425, 14, 1539, 38860, 36680, 84810, 13937, 756, 197, 5816, 3477, 380, 4019,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestFieldErrors_Also(t *testing.T) { expected := cli.FieldErrors{ &field.Error{Field: "field1"}, &field.Error{Field: "field2"}, &field.Error{Field: "field3"}, } actual := cli.FieldErrors{}.Also( cli.FieldErrors{ &field.Error{Field: "field1"}, &field.Error{Field: "field2"}, }, cli.FieldErrors{ &field.Error{Field: "field3"}, }, ) if diff := cmp.Diff(expected, actual); diff != "" { t.Errorf("(-expected, +actual): %s", diff) } }
explode_data.jsonl/13210
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 201 }
[ 2830, 3393, 1877, 13877, 40812, 704, 1155, 353, 8840, 836, 8, 341, 42400, 1669, 21348, 17087, 13877, 515, 197, 197, 5, 2566, 6141, 90, 1877, 25, 330, 2566, 16, 7115, 197, 197, 5, 2566, 6141, 90, 1877, 25, 330, 2566, 17, 7115, 197, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2