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 Test_GetPools(t *testing.T) { server := "https://sero-light-node.ririniannian.com/" pools, err := getPools(server) require.NoError(t, err) for i, p := range pools { t.Logf("[%d] %v", i, p) } }
explode_data.jsonl/52542
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 92 }
[ 2830, 3393, 13614, 47, 6178, 1155, 353, 8840, 836, 8, 341, 41057, 1669, 330, 2428, 1110, 799, 78, 17709, 39054, 1746, 404, 6591, 1020, 1103, 905, 29555, 3223, 6178, 11, 1848, 1669, 57720, 6178, 21421, 340, 17957, 35699, 1155, 11, 1848, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestNumberCmd(t *testing.T) { tests := []testItem{ { Name: "basic", Input: "number", Output: "377457747\n", IsErr: false, }, { Name: "repeat", Input: "number -c 2", Output: "377457747\n532387611\n", IsErr: false, }, { Name: "unknown flag", Input: "number --unknown ", SubString: "Error: unknown flag: --unknown", IsErr: true, }, } runTestTable(t, tests) }
explode_data.jsonl/8930
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 220 }
[ 2830, 3393, 2833, 15613, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 3056, 1944, 1234, 515, 197, 197, 515, 298, 21297, 25, 256, 330, 22342, 756, 298, 66588, 25, 220, 330, 4082, 756, 298, 80487, 25, 330, 18, 22, 22, 19, 20, 22, 22, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestCustomTaintsAndTolerations_Configuration(t *testing.T) { sts := performReconciliationAndGetStatefulSet(t, "tolerations_example.yaml") assert.Len(t, sts.Spec.Template.Spec.Tolerations, 2) assert.Equal(t, "example-key", sts.Spec.Template.Spec.Tolerations[0].Key) assert.Equal(t, corev1.TolerationOpExists, sts.Spec.Template.Spec.Tolerations[0].Operator) assert.Equal(t, corev1.TaintEffectNoSchedule, sts.Spec.Template.Spec.Tolerations[0].Effect) assert.Equal(t, "example-key-2", sts.Spec.Template.Spec.Tolerations[1].Key) assert.Equal(t, corev1.TolerationOpEqual, sts.Spec.Template.Spec.Tolerations[1].Operator) assert.Equal(t, corev1.TaintEffectNoExecute, sts.Spec.Template.Spec.Tolerations[1].Effect) }
explode_data.jsonl/80693
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 278 }
[ 2830, 3393, 10268, 51, 1641, 82, 3036, 51, 22072, 804, 35412, 2017, 1155, 353, 8840, 836, 8, 341, 18388, 82, 1669, 2736, 693, 98240, 97726, 1397, 1262, 1649, 1155, 11, 330, 20576, 261, 804, 39304, 33406, 5130, 6948, 65819, 1155, 11, 5...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestConfigurableWatchProgressNotifyInterval(t *testing.T) { integration2.BeforeTest(t) progressInterval := 200 * time.Millisecond clus := integration2.NewClusterV3(t, &integration2.ClusterConfig{ Size: 3, WatchProgressNotifyInterval: progressInterval, }) defer clus.Terminate(t) opts := []clientv3.OpOption{clientv3.WithProgressNotify()} rch := clus.RandClient().Watch(context.Background(), "foo", opts...) timeout := 1 * time.Second // we expect to receive watch progress notify in 2 * progressInterval, // but for CPU-starved situation it may take longer. So we use 1 second here for timeout. select { case resp := <-rch: // waiting for a watch progress notify response if !resp.IsProgressNotify() { t.Fatalf("expected resp.IsProgressNotify() == true") } case <-time.After(timeout): t.Fatalf("timed out waiting for watch progress notify response in %v", timeout) } }
explode_data.jsonl/28933
{ "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, 2648, 18329, 14247, 9496, 28962, 10256, 1155, 353, 8840, 836, 8, 341, 2084, 17376, 17, 31153, 2271, 1155, 692, 88971, 10256, 1669, 220, 17, 15, 15, 353, 882, 71482, 198, 197, 4163, 1669, 17590, 17, 7121, 28678, 53, 18, 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...
4
func TestLimitedStreams(t *testing.T) { mn, err := FullMeshConnected(context.Background(), 2) if err != nil { t.Fatal(err) } var wg sync.WaitGroup messages := 4 messageSize := 500 handler := func(s network.Stream) { b := make([]byte, messageSize) for i := 0; i < messages; i++ { if _, err := io.ReadFull(s, b); err != nil { log.Fatal(err) } if !bytes.Equal(b[:4], []byte("ping")) { log.Fatal("bytes mismatch") } wg.Done() } s.Close() } hosts := mn.Hosts() for _, h := range mn.Hosts() { h.SetStreamHandler(protocol.TestingID, handler) } peers := mn.Peers() links := mn.LinksBetweenPeers(peers[0], peers[1]) // 1000 byte per second bandwidth bps := float64(1000) opts := links[0].Options() opts.Bandwidth = bps for _, link := range links { link.SetOptions(opts) } ctx := context.Background() s, err := hosts[0].NewStream(ctx, hosts[1].ID(), protocol.TestingID) if err != nil { t.Fatal(err) } filler := make([]byte, messageSize-4) data := append([]byte("ping"), filler...) before := time.Now() for i := 0; i < messages; i++ { wg.Add(1) if _, err := s.Write(data); err != nil { panic(err) } } wg.Wait() if !within(time.Since(before), time.Second*2, time.Second) { t.Fatal("Expected 2ish seconds but got ", time.Since(before)) } }
explode_data.jsonl/10782
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 558 }
[ 2830, 3393, 74477, 73576, 1155, 353, 8840, 836, 8, 341, 2109, 77, 11, 1848, 1669, 8627, 14194, 21146, 5378, 19047, 1507, 220, 17, 340, 743, 1848, 961, 2092, 341, 197, 3244, 26133, 3964, 340, 197, 630, 2405, 63581, 12811, 28384, 2808, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestInit(t *testing.T) { // Reset memory counters helpers.ResetMemoryStats() if err := runInit(); err != nil { t.Errorf("Expected nil, got: %v", err) } // Check for expected allocations helpers.AssertMemoryExpectation(t, helpers.Allocations, initAllocations) }
explode_data.jsonl/11237
{ "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, 3803, 1155, 353, 8840, 836, 8, 341, 197, 322, 16932, 4938, 31532, 198, 197, 21723, 36660, 10642, 16635, 2822, 743, 1848, 1669, 1598, 3803, 2129, 1848, 961, 2092, 341, 197, 3244, 13080, 445, 18896, 2092, 11, 2684, 25, 1018, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestFormatterPositionalArguments(test *testing.T) { formatted, err := formatter.New().Format("{p1} {p0}", 1, 2) assert.NoError(test, err) assert.Equal(test, "2 1", formatted) }
explode_data.jsonl/39731
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 71 }
[ 2830, 3393, 14183, 3812, 278, 19139, 8623, 353, 8840, 836, 8, 341, 37410, 12127, 11, 1848, 1669, 24814, 7121, 1005, 4061, 13976, 79, 16, 92, 314, 79, 15, 9545, 220, 16, 11, 220, 17, 692, 6948, 35699, 8623, 11, 1848, 340, 6948, 12808...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestDockerUnixSocket(t *testing.T) { s := log.Scope(t) defer s.Close(t) containerConfig := defaultContainerConfig() containerConfig.Cmd = []string{"stat", cluster.CockroachBinaryInContainer} ctx := context.Background() if err := testDockerOneShot(ctx, t, "cli_test", containerConfig); err != nil { skip.IgnoreLintf(t, `TODO(dt): No binary in one-shot container, see #6086: %s`, err) } containerConfig.Env = []string{fmt.Sprintf("PGUSER=%s", security.RootUser)} containerConfig.Cmd = append(cmdBase, "/mnt/data/psql/test-psql-unix.sh "+cluster.CockroachBinaryInContainer) if err := testDockerOneShot(ctx, t, "unix_socket_test", containerConfig); err != nil { t.Error(err) } }
explode_data.jsonl/63228
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 259 }
[ 2830, 3393, 35, 13659, 55832, 10286, 1155, 353, 8840, 836, 8, 341, 1903, 1669, 1487, 77940, 1155, 340, 16867, 274, 10421, 1155, 692, 53290, 2648, 1669, 1638, 4502, 2648, 741, 53290, 2648, 64512, 284, 3056, 917, 4913, 9878, 497, 10652, 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...
3
func TestCharsetErr(t *testing.T) { store, clean := testkit.CreateMockStore(t) defer clean() tk := testkit.NewTestKit(t, store) tk.MustExec("use test") tk.MustExec("create table charset_test(id int auto_increment primary key, c1 varchar(255) character set ascii)") err := tk.ExecToErr("insert into charset_test(c1) values ('aaa\xEF\xBF\xBDabcdef')") require.Error(t, err, "[table:1366]Incorrect string value '\\xEF\\xBF\\xBDabc...' for column 'c1'") err = tk.ExecToErr("insert into charset_test(c1) values ('aaa\xEF\xBF\xBD')") require.Error(t, err, "[table:1366]Incorrect string value '\\xEF\\xBF\\xBD' for column 'c1'") }
explode_data.jsonl/65595
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 254 }
[ 2830, 3393, 78172, 7747, 1155, 353, 8840, 836, 8, 341, 57279, 11, 4240, 1669, 1273, 8226, 7251, 11571, 6093, 1155, 340, 16867, 4240, 2822, 3244, 74, 1669, 1273, 8226, 7121, 2271, 7695, 1155, 11, 3553, 340, 3244, 74, 50463, 10216, 445, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestVeryLargeParallelBlockValidation(t *testing.T) { // here we test validation of a block with 4096 txes, // which is larger than both the number of workers in // the pool and the buffer in the channels testValidationWithNTXes(t, 4096) }
explode_data.jsonl/17518
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 72 }
[ 2830, 3393, 25756, 34253, 16547, 4713, 13799, 1155, 353, 8840, 836, 8, 341, 197, 322, 1588, 582, 1273, 10519, 315, 264, 2504, 448, 220, 19, 15, 24, 21, 9854, 288, 345, 197, 322, 892, 374, 8131, 1091, 2176, 279, 1372, 315, 7337, 304,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestState_GetStorageHashLatest(t *testing.T) { key := types.NewStorageKey(types.MustHexDecodeString("0x3a636f6465")) hash, err := state.GetStorageHashLatest(key) assert.NoError(t, err) var expected types.Hash copy(expected[:], types.MustHexDecodeString(mockSrv.storageHashHex)) assert.Equal(t, expected, hash) }
explode_data.jsonl/22981
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 121 }
[ 2830, 3393, 1397, 13614, 5793, 6370, 31992, 1155, 353, 8840, 836, 8, 341, 23634, 1669, 4494, 7121, 5793, 1592, 52613, 50463, 20335, 32564, 703, 445, 15, 87, 18, 64, 21, 18, 21, 69, 21, 19, 21, 20, 5455, 50333, 11, 1848, 1669, 1584, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestRowsCanHaveTextPanels(t *testing.T) { req := require.New(t) board := sdk.NewBoard("") panel := New(board, "", WithText("HTTP Rate")) req.Len(panel.builder.Panels, 1) }
explode_data.jsonl/39821
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 71 }
[ 2830, 3393, 9024, 6713, 12116, 1178, 35693, 2010, 1155, 353, 8840, 836, 8, 341, 24395, 1669, 1373, 7121, 1155, 340, 59868, 1669, 45402, 7121, 11932, 445, 5130, 44952, 1669, 1532, 20770, 11, 7342, 3085, 1178, 445, 9230, 19775, 28075, 24395...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_DeletePod_Positive_NodeDoesNotExist(t *testing.T) { // Arrange volumePluginMgr, _ := controllervolumetesting.GetTestVolumePluginMgr((t)) dsw := NewDesiredStateOfWorld(volumePluginMgr) podName := "pod-name" volumeName := api.UniqueDeviceName("volume-name") volumeSpec := controllervolumetesting.GetTestVolumeSpec(string(volumeName), volumeName) node1Name := "node1-name" dsw.AddNode(node1Name) generatedVolumeName, podAddErr := dsw.AddPod(podName, volumeSpec, node1Name) if podAddErr != nil { t.Fatalf( "AddPod failed for pod %q. Expected: <no error> Actual: <%v>", podName, podAddErr) } volumeExists := dsw.VolumeExists(generatedVolumeName, node1Name) if !volumeExists { t.Fatalf( "Added pod %q to volume %q/node %q. Volume does not exist, it should.", podName, generatedVolumeName, node1Name) } node2Name := "node2-name" // Act dsw.DeletePod(podName, generatedVolumeName, node2Name) // Assert volumeExists = dsw.VolumeExists(generatedVolumeName, node1Name) if !volumeExists { t.Fatalf( "Volume %q/node %q does not exist, it should.", generatedVolumeName, node1Name) } volumeExists = dsw.VolumeExists(generatedVolumeName, node2Name) if volumeExists { t.Fatalf( "node %q exists, it should not.", node2Name) } volumesToAttach := dsw.GetVolumesToAttach() if len(volumesToAttach) != 1 { t.Fatalf("len(volumesToAttach) Expected: <1> Actual: <%v>", len(volumesToAttach)) } verifyVolumeToAttach(t, volumesToAttach, node1Name, generatedVolumeName, string(volumeName)) }
explode_data.jsonl/40746
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 597 }
[ 2830, 3393, 57418, 23527, 44246, 3404, 41340, 21468, 45535, 1155, 353, 8840, 836, 8, 341, 197, 322, 40580, 198, 5195, 4661, 11546, 25567, 11, 716, 1669, 683, 1100, 648, 1132, 57824, 287, 2234, 2271, 18902, 11546, 25567, 1188, 83, 1171, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
6
func TestRWFileHandleSizeCreateNew(t *testing.T) { _, vfs, fh, cleanup := rwHandleCreateFlags(t, false, "file1", os.O_WRONLY|os.O_CREATE) defer cleanup() // check initial size after opening assertSize(t, vfs, fh, "file1", 0) // write some bytes n, err := fh.Write([]byte("hello")) assert.NoError(t, err) assert.Equal(t, 5, n) // check size after writing assertSize(t, vfs, fh, "file1", 5) // check size after writing assertSize(t, vfs, fh, "file1", 5) // close assert.NoError(t, fh.Close()) // check size after close assertSize(t, vfs, nil, "file1", 5) }
explode_data.jsonl/7350
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 233 }
[ 2830, 3393, 56368, 1703, 6999, 1695, 4021, 3564, 1155, 353, 8840, 836, 8, 341, 197, 6878, 92941, 11, 36075, 11, 21290, 1669, 25991, 6999, 4021, 9195, 1155, 11, 895, 11, 330, 1192, 16, 497, 2643, 8382, 88649, 91, 436, 8382, 25823, 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 TestParserRealWorld(t *testing.T) { m := newSnippetParser().parse("console.warn(${1: $TM_SELECTED_TEXT })", false, false) assertEqual(t, (*m)[0].String(), "console.warn(") assertMarkerTypes(t, (*m)[1], &placeholder{}) assertEqual(t, (*m)[2].String(), ")") ph := (*m)[1].(*placeholder) children := *ph.children() // assertEqual(t, placeholder, "false") assertEqual(t, ph.index, 1) assertEqual(t, len(children), 3) assertMarkerTypes(t, children[0], &text{}) assertMarkerTypes(t, children[1], &variable{}) assertMarkerTypes(t, children[2], &text{}) assertEqual(t, children[0].String(), " ") assertEqual(t, children[1].String(), "") assertEqual(t, children[2].String(), " ") nestedVariable := children[1].(*variable) assertEqual(t, nestedVariable.name, "TM_SELECTED_TEXT") assertEqual(t, len(*nestedVariable.children()), 0) m = newSnippetParser().parse("$TM_SELECTED_TEXT", false, false) assertEqual(t, len(*m), 1) assertMarkerTypes(t, (*m)[0], &variable{}) }
explode_data.jsonl/60280
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 379 }
[ 2830, 3393, 6570, 12768, 10134, 1155, 353, 8840, 836, 8, 341, 2109, 1669, 501, 87852, 6570, 1005, 6400, 445, 5354, 21408, 34812, 16, 25, 400, 22034, 59340, 10243, 6413, 497, 895, 11, 895, 692, 6948, 2993, 1155, 11, 4609, 76, 6620, 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 TestDecodeJsonWithNumberTime(t *testing.T) { dec := json.NewDecoder(strings.NewReader("{\"time\":1610760752.606,\"event\":\"hello\"}")) dec.More() var msg Event err := dec.Decode(&msg) assert.NoError(t, err) assert.Equal(t, 1610760752.606, *msg.Time) }
explode_data.jsonl/5174
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 107 }
[ 2830, 3393, 32564, 5014, 2354, 2833, 1462, 1155, 353, 8840, 836, 8, 341, 197, 8169, 1669, 2951, 7121, 20732, 51442, 68587, 99141, 1678, 11693, 16, 21, 16, 15, 22, 21, 15, 22, 20, 17, 13, 21, 15, 21, 52318, 3087, 23488, 14990, 2105, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestCheckInLookupLocationFailure(t *testing.T) { sess, err := NewSession() if err != nil { t.Fatal(err) } ctx := sess.NewContext() config := oonimkall.CheckInConfig{ Charging: true, OnWiFi: true, Platform: "android", RunType: "timed", SoftwareName: "ooniprobe-android", SoftwareVersion: "2.7.1", WebConnectivity: &oonimkall.CheckInConfigWebConnectivity{}, } config.WebConnectivity.Add("NEWS") config.WebConnectivity.Add("CULTR") ctx.Cancel() // immediate failure result, err := sess.CheckIn(ctx, &config) if !errors.Is(err, geolocate.ErrAllIPLookuppersFailed) { t.Fatalf("not the error we expected: %+v", err) } if result != nil { t.Fatal("expected nil result here") } }
explode_data.jsonl/78957
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 315 }
[ 2830, 3393, 3973, 641, 34247, 4707, 17507, 1155, 353, 8840, 836, 8, 341, 1903, 433, 11, 1848, 1669, 1532, 5283, 741, 743, 1848, 961, 2092, 341, 197, 3244, 26133, 3964, 340, 197, 532, 20985, 1669, 21875, 7121, 1972, 741, 25873, 1669, 2...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
4
func TestAddPictureErrors(t *testing.T) { xlsx, err := OpenFile(filepath.Join("test", "Book1.xlsx")) assert.NoError(t, err) // Test add picture to worksheet with invalid file path. err = xlsx.AddPicture("Sheet1", "G21", filepath.Join("test", "not_exists_dir", "not_exists.icon"), "") if assert.Error(t, err) { assert.True(t, os.IsNotExist(err), "Expected os.IsNotExist(err) == true") } // Test add picture to worksheet with unsupport file type. err = xlsx.AddPicture("Sheet1", "G21", filepath.Join("test", "Book1.xlsx"), "") assert.EqualError(t, err, "unsupported image extension") err = xlsx.AddPictureFromBytes("Sheet1", "G21", "", "Excel Logo", "jpg", make([]byte, 1)) assert.EqualError(t, err, "unsupported image extension") // Test add picture to worksheet with invalid file data. err = xlsx.AddPictureFromBytes("Sheet1", "G21", "", "Excel Logo", ".jpg", make([]byte, 1)) assert.EqualError(t, err, "image: unknown format") }
explode_data.jsonl/51745
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 354 }
[ 2830, 3393, 2212, 24669, 13877, 1155, 353, 8840, 836, 8, 341, 10225, 29017, 11, 1848, 1669, 5264, 1703, 34793, 22363, 445, 1944, 497, 330, 7134, 16, 46838, 5455, 6948, 35699, 1155, 11, 1848, 692, 197, 322, 3393, 912, 6802, 311, 36636, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestInt64DataPoint_InitEmpty(t *testing.T) { ms := NewInt64DataPoint() assert.True(t, ms.IsNil()) ms.InitEmpty() assert.False(t, ms.IsNil()) }
explode_data.jsonl/19527
{ "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, 1072, 21, 19, 1043, 2609, 15644, 3522, 1155, 353, 8840, 836, 8, 341, 47691, 1669, 1532, 1072, 21, 19, 1043, 2609, 741, 6948, 32443, 1155, 11, 9829, 4506, 19064, 2398, 47691, 26849, 3522, 741, 6948, 50757, 1155, 11, 9829, 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
func TestProcessARGS(t *testing.T) { p := process.Process{ Status: proc.Status{ Name: "foo-bar", }, CmdLine: []string{""}, } ctx := new(psContext) comm, err := processARGS(&p, ctx) assert.Nil(t, err) assert.Equal(t, "[foo-bar]", comm) p = process.Process{ CmdLine: []string{"/usr/bin/foo-bar -flag1 -flag2"}, } comm, err = processARGS(&p, ctx) assert.Nil(t, err) assert.Equal(t, "/usr/bin/foo-bar -flag1 -flag2", comm) }
explode_data.jsonl/53394
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 199 }
[ 2830, 3393, 7423, 47483, 1155, 353, 8840, 836, 8, 341, 3223, 1669, 1882, 29012, 515, 197, 58321, 25, 13674, 10538, 515, 298, 21297, 25, 330, 7975, 15773, 756, 197, 197, 1583, 197, 6258, 2277, 2460, 25, 3056, 917, 90, 3014, 1583, 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 TestFloat64SetRank_UpdateScore(t *testing.T) { z := NewFloat64() rand.Seed(time.Now().Unix()) var vs []string for i := 0; i < 100; i++ { v := fmt.Sprint(i) z.Add(rand.Float64(), v) vs = append(vs, v) } // Randomly update score for i := 0; i < 100; i++ { // 1/2 if rand.Float64() > 0.5 { continue } z.Add(float64(i), fmt.Sprint(i)) } for _, v := range vs { r := z.Rank(v) assert.NotEqual(t, -1, r) assert.Greater(t, z.Len(), r) // verify rank by traversing level 0 actualRank := 0 x := z.list.header for x != nil { x = x.loadNext(0) if x.value == v { break } actualRank++ } assert.Equal(t, v, x.value) assert.Equal(t, r, actualRank) } }
explode_data.jsonl/24993
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 342 }
[ 2830, 3393, 5442, 21, 19, 1649, 22550, 47393, 10570, 1155, 353, 8840, 836, 8, 341, 20832, 1669, 1532, 5442, 21, 19, 741, 7000, 437, 5732, 291, 9730, 13244, 1005, 55832, 12367, 2405, 6165, 3056, 917, 198, 2023, 600, 1669, 220, 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...
7
func TestMarshalUnmarshalCoders(t *testing.T) { foo := custom("foo", reflectx.Bool) bar := custom("bar", reflectx.String) baz := custom("baz", reflectx.Int) tests := []struct { name string c *coder.Coder }{ { "bytes", coder.NewBytes(), }, { "bool", coder.NewBool(), }, { "varint", coder.NewVarInt(), }, { "double", coder.NewDouble(), }, { "string", coder.NewString(), }, { "foo", foo, }, { "bar", bar, }, { "baz", baz, }, { "W<bytes>", coder.NewW(coder.NewBytes(), coder.NewGlobalWindow()), }, { "KV<foo,bar>", coder.NewKV([]*coder.Coder{foo, bar}), }, { "CoGBK<foo,bar>", coder.NewCoGBK([]*coder.Coder{foo, bar}), }, { "CoGBK<foo,bar,baz>", coder.NewCoGBK([]*coder.Coder{foo, bar, baz}), }, { name: "R[graphx.registeredNamedTypeForTest]", c: coder.NewR(typex.New(reflect.TypeOf((*registeredNamedTypeForTest)(nil)).Elem())), }, { name: "R[*graphx.registeredNamedTypeForTest]", c: coder.NewR(typex.New(reflect.TypeOf((*registeredNamedTypeForTest)(nil)))), }, } for _, test := range tests { t.Run(test.name, func(t *testing.T) { ids, marshalCoders, err := graphx.MarshalCoders([]*coder.Coder{test.c}) if err != nil { t.Fatalf("Marshal(%v) failed: %v", test.c, err) } coders, err := graphx.UnmarshalCoders(ids, marshalCoders) if err != nil { t.Fatalf("Unmarshal(Marshal(%v)) failed: %v", test.c, err) } if len(coders) != 1 || !test.c.Equals(coders[0]) { t.Errorf("Unmarshal(Marshal(%v)) = %v, want identity", test.c, coders) } }) } // These tests cover the pure dataflow to dataflow coder cases. for _, test := range tests { t.Run("dataflow:"+test.name, func(t *testing.T) { ref, err := graphx.EncodeCoderRef(test.c) if err != nil { t.Fatalf("EncodeCoderRef(%v) failed: %v", test.c, err) } got, err := graphx.DecodeCoderRef(ref) if err != nil { t.Fatalf("DecodeCoderRef(EncodeCoderRef(%v)) failed: %v", test.c, err) } if !test.c.Equals(got) { t.Errorf("DecodeCoderRef(EncodeCoderRef(%v)) = %v, want identity", test.c, got) } }) } }
explode_data.jsonl/36826
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1106 }
[ 2830, 3393, 55438, 1806, 27121, 34, 52498, 1155, 353, 8840, 836, 8, 341, 197, 7975, 1669, 2526, 445, 7975, 497, 8708, 87, 52497, 340, 90709, 1669, 2526, 445, 2257, 497, 8708, 87, 6431, 340, 2233, 1370, 1669, 2526, 445, 42573, 497, 870...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestFlipManagerRateLimit(t *testing.T) { t.Skip() ctc := makeChatTestContext(t, "TestFlipManagerRateLimit", 2) defer ctc.cleanup() users := ctc.users() useRemoteMock = false defer func() { useRemoteMock = true }() ui0 := kbtest.NewChatUI() ui1 := kbtest.NewChatUI() ctc.as(t, users[0]).h.mockChatUI = ui0 ctc.as(t, users[1]).h.mockChatUI = ui1 ctc.world.Tcs[users[0].Username].G.UIRouter = &fakeUIRouter{ui: ui0} ctc.world.Tcs[users[1].Username].G.UIRouter = &fakeUIRouter{ui: ui1} listener0 := newServerChatListener() listener1 := newServerChatListener() ctc.as(t, users[0]).h.G().NotifyRouter.AddListener(listener0) ctc.as(t, users[1]).h.G().NotifyRouter.AddListener(listener1) flip.DefaultCommitmentWindowMsec = 500 tc := ctc.world.Tcs[users[0].Username] tc1 := ctc.world.Tcs[users[1].Username] clock := clockwork.NewFakeClock() flipmgr := tc.Context().CoinFlipManager.(*FlipManager) flipmgr1 := tc1.Context().CoinFlipManager.(*FlipManager) flipmgr.clock = clock flipmgr1.clock = clock flipmgr.testingServerClock = clock flipmgr1.testingServerClock = clock flipmgr.maxConvParticipations = 1 <-flipmgr.Stop(context.TODO()) <-flipmgr1.Stop(context.TODO()) flipmgr.Start(context.TODO(), gregor1.UID(users[0].GetUID().ToBytes())) flipmgr1.Start(context.TODO(), gregor1.UID(users[1].GetUID().ToBytes())) simRealClock := func(stopCh chan struct{}) { t := time.NewTicker(100 * time.Millisecond) for { select { case <-t.C: clock.Advance(100 * time.Millisecond) case <-stopCh: return } } } t.Logf("uid0: %s", users[0].GetUID()) t.Logf("uid1: %s", users[1].GetUID()) conv := mustCreateConversationForTest(t, ctc, users[0], chat1.TopicType_CHAT, chat1.ConversationMembersType_IMPTEAMNATIVE, ctc.as(t, users[1]).user()) mustPostLocalForTest(t, ctc, users[0], conv, chat1.NewMessageBodyWithText(chat1.MessageText{ Body: "/flip", })) flipMsg := consumeNewMsgRemote(t, listener0, chat1.MessageType_FLIP) require.True(t, flipMsg.IsValid()) require.NotNil(t, flipMsg.Valid().FlipGameID) gameID := *flipMsg.Valid().FlipGameID t.Logf("gameID: %s", gameID) consumeNewMsgRemote(t, listener1, chat1.MessageType_FLIP) stopCh := make(chan struct{}) go simRealClock(stopCh) res := consumeFlipToResult(t, ui0, listener0, gameID, 2) require.True(t, res == "HEADS" || res == "TAILS") res1 := consumeFlipToResult(t, ui1, listener1, gameID, 2) require.Equal(t, res, res1) close(stopCh) clock.Advance(time.Minute) mustPostLocalForTest(t, ctc, users[1], conv, chat1.NewMessageBodyWithText(chat1.MessageText{ Body: "/flip", })) select { case <-ui0.CoinFlipUpdates: require.Fail(t, "no update for 0") default: } flipMsg = consumeNewMsgRemote(t, listener0, chat1.MessageType_FLIP) require.True(t, flipMsg.IsValid()) require.NotNil(t, flipMsg.Valid().FlipGameID) gameID = *flipMsg.Valid().FlipGameID t.Logf("gameID: %s", gameID) stopCh = make(chan struct{}) go simRealClock(stopCh) consumeNewMsgRemote(t, listener0, chat1.MessageType_FLIP) // get host msg res = consumeFlipToResult(t, ui1, listener1, gameID, 1) require.True(t, res == "HEADS" || res == "TAILS") close(stopCh) clock.Advance(10 * time.Minute) mustPostLocalForTest(t, ctc, users[1], conv, chat1.NewMessageBodyWithText(chat1.MessageText{ Body: "/flip", })) flipMsg = consumeNewMsgRemote(t, listener0, chat1.MessageType_FLIP) require.True(t, flipMsg.IsValid()) require.NotNil(t, flipMsg.Valid().FlipGameID) gameID = *flipMsg.Valid().FlipGameID t.Logf("gameID: %s", gameID) consumeNewMsgRemote(t, listener1, chat1.MessageType_FLIP) stopCh = make(chan struct{}) go simRealClock(stopCh) res = consumeFlipToResult(t, ui0, listener0, gameID, 2) require.True(t, res == "HEADS" || res == "TAILS") res1 = consumeFlipToResult(t, ui1, listener1, gameID, 2) require.Equal(t, res, res1) close(stopCh) }
explode_data.jsonl/51276
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1639 }
[ 2830, 3393, 46808, 2043, 11564, 16527, 1155, 353, 8840, 836, 8, 341, 3244, 57776, 741, 89216, 66, 1669, 1281, 15672, 2271, 1972, 1155, 11, 330, 2271, 46808, 2043, 11564, 16527, 497, 220, 17, 340, 16867, 272, 10413, 87689, 741, 90896, 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 TestGFMSpec(t *testing.T) { luteEngine := lute.New() luteEngine.SoftBreak2HardBreak = false luteEngine.AutoSpace = false luteEngine.GFMTaskListItemClass = "" // 关闭类名渲染 parse.AddAutoLinkDomainSuffix("baz") for _, test := range gfmSpecTests { html := luteEngine.MarkdownStr(test.name, test.from) if test.to != html { t.Fatalf("test case [%s] failed\nexpected\n\t%q\ngot\n\t%q\noriginal markdown text\n\t%q", test.name, test.to, html, test.from) } } }
explode_data.jsonl/47234
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 207 }
[ 2830, 3393, 36332, 4826, 992, 1155, 353, 8840, 836, 8, 341, 8810, 1070, 4571, 1669, 326, 1070, 7121, 741, 8810, 1070, 4571, 808, 14118, 22524, 17, 26907, 22524, 284, 895, 198, 8810, 1070, 4571, 6477, 9914, 284, 895, 198, 8810, 1070, 4...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestPartitionTable(t *testing.T) { if israce.RaceEnabled { t.Skip("exhaustive types test, skip race test") } store, clean := testkit.CreateMockStore(t) defer clean() orgEnable := core.PreparedPlanCacheEnabled() defer core.SetPreparedPlanCache(orgEnable) core.SetPreparedPlanCache(true) se, err := session.CreateSession4TestWithOpt(store, &session.Opt{ PreparedPlanCache: kvcache.NewSimpleLRUCache(100, 0.1, math.MaxUint64), }) require.NoError(t, err) tk := testkit.NewTestKitWithSession(t, store, se) // enable partition table dynamic mode tk.MustExec("create database test_plan_cache") tk.MustExec("use test_plan_cache") tk.MustExec("set @@tidb_partition_prune_mode = 'dynamic'") type testcase struct { t1Create string t2Create string rowGener func() string varGener func() string query string } randDateTime := func() string { return fmt.Sprintf("%v-%v-%v %v:%v:%v", 1950+rand.Intn(100), 1+rand.Intn(12), 1+rand.Intn(28), // date rand.Intn(24), rand.Intn(60), rand.Intn(60)) // time } randDate := func() string { return fmt.Sprintf("%v-%v-%v", 1950+rand.Intn(100), 1+rand.Intn(12), 1+rand.Intn(28)) } testcases := []testcase{ { // hash partition + int "create table t1(a int, b int) partition by hash(a) partitions 20", "create table t2(a int, b int)", func() string { return fmt.Sprintf("(%v, %v)", rand.Intn(100000000), rand.Intn(100000000)) }, func() string { return fmt.Sprintf("%v", rand.Intn(100000000)) }, `select * from %v where a > ?`, }, { // range partition + int `create table t1(a int, b int) partition by range(a) ( partition p0 values less than (20000000), partition p1 values less than (40000000), partition p2 values less than (60000000), partition p3 values less than (80000000), partition p4 values less than (100000000))`, `create table t2(a int, b int)`, func() string { return fmt.Sprintf("(%v, %v)", rand.Intn(100000000), rand.Intn(100000000)) }, func() string { return fmt.Sprintf("%v", rand.Intn(100000000)) }, `select * from %v where a > ?`, }, { // range partition + varchar `create table t1(a varchar(10), b varchar(10)) partition by range columns(a) ( partition p0 values less than ('200'), partition p1 values less than ('400'), partition p2 values less than ('600'), partition p3 values less than ('800'), partition p4 values less than ('9999'))`, `create table t2(a varchar(10), b varchar(10))`, func() string { return fmt.Sprintf(`("%v", "%v")`, rand.Intn(1000), rand.Intn(1000)) }, func() string { return fmt.Sprintf(`"%v"`, rand.Intn(1000)) }, `select * from %v where a > ?`, }, { // range partition + datetime `create table t1(a datetime, b datetime) partition by range columns(a) ( partition p0 values less than ('1970-01-01 00:00:00'), partition p1 values less than ('1990-01-01 00:00:00'), partition p2 values less than ('2010-01-01 00:00:00'), partition p3 values less than ('2030-01-01 00:00:00'), partition p4 values less than ('2060-01-01 00:00:00'))`, `create table t2(a datetime, b datetime)`, func() string { return fmt.Sprintf(`("%v", "%v")`, randDateTime(), randDateTime()) }, func() string { return fmt.Sprintf(`"%v"`, randDateTime()) }, `select * from %v where a > ?`, }, { // range partition + date `create table t1(a date, b date) partition by range columns(a) ( partition p0 values less than ('1970-01-01'), partition p1 values less than ('1990-01-01'), partition p2 values less than ('2010-01-01'), partition p3 values less than ('2030-01-01'), partition p4 values less than ('2060-01-01'))`, `create table t2(a date, b date)`, func() string { return fmt.Sprintf(`("%v", "%v")`, randDate(), randDate()) }, func() string { return fmt.Sprintf(`"%v"`, randDate()) }, `select * from %v where a > ?`, }, { // list partition + int `create table t1(a int, b int) partition by list(a) ( partition p0 values in (0, 1, 2, 3, 4), partition p1 values in (5, 6, 7, 8, 9), partition p2 values in (10, 11, 12, 13, 14), partition p3 values in (15, 16, 17, 18, 19))`, `create table t2(a int, b int)`, func() string { return fmt.Sprintf("(%v, %v)", rand.Intn(20), rand.Intn(20)) }, func() string { return fmt.Sprintf("%v", rand.Intn(20)) }, `select * from %v where a > ?`, }, } for _, tc := range testcases { // create tables and insert some records tk.MustExec("drop table if exists t1") tk.MustExec("drop table if exists t2") tk.MustExec(tc.t1Create) tk.MustExec(tc.t2Create) vals := make([]string, 0, 2048) for i := 0; i < 2048; i++ { vals = append(vals, tc.rowGener()) } tk.MustExec(fmt.Sprintf("insert into t1 values %s", strings.Join(vals, ","))) tk.MustExec(fmt.Sprintf("insert into t2 values %s", strings.Join(vals, ","))) // the first query, @last_plan_from_cache should be zero tk.MustExec(fmt.Sprintf(`prepare stmt1 from "%s"`, fmt.Sprintf(tc.query, "t1"))) tk.MustExec(fmt.Sprintf(`prepare stmt2 from "%s"`, fmt.Sprintf(tc.query, "t2"))) tk.MustExec(fmt.Sprintf("set @a=%v", tc.varGener())) result1 := tk.MustQuery("execute stmt1 using @a").Sort().Rows() tk.MustQuery("select @@last_plan_from_cache").Check(testkit.Rows("0")) tk.MustQuery("execute stmt2 using @a").Sort().Check(result1) tk.MustQuery("select @@last_plan_from_cache").Check(testkit.Rows("0")) for i := 0; i < 100; i++ { tk.MustExec(fmt.Sprintf("set @a=%v", tc.varGener())) result1 := tk.MustQuery("execute stmt1 using @a").Sort().Rows() tk.MustQuery("select @@last_plan_from_cache").Check(testkit.Rows("1")) tk.MustQuery("execute stmt2 using @a").Sort().Check(result1) tk.MustQuery("select @@last_plan_from_cache").Check(testkit.Rows("1")) } } }
explode_data.jsonl/5537
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 2365 }
[ 2830, 3393, 49978, 2556, 1155, 353, 8840, 836, 8, 341, 743, 374, 41183, 2013, 578, 5462, 341, 197, 3244, 57776, 445, 327, 15074, 533, 4494, 1273, 11, 10706, 6957, 1273, 1138, 197, 630, 57279, 11, 4240, 1669, 1273, 8226, 7251, 11571, 6...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestGetTeamMembersForUser(t *testing.T) { th := Setup(t).InitBasic() defer th.TearDown() Client := th.Client members, resp := Client.GetTeamMembersForUser(th.BasicUser.Id, "") CheckNoError(t, resp) found := false for _, m := range members { if m.TeamId == th.BasicTeam.Id { found = true } } require.True(t, found, "missing team member") _, resp = Client.GetTeamMembersForUser("junk", "") CheckBadRequestStatus(t, resp) _, resp = Client.GetTeamMembersForUser(model.NewId(), "") CheckForbiddenStatus(t, resp) Client.Logout() _, resp = Client.GetTeamMembersForUser(th.BasicUser.Id, "") CheckUnauthorizedStatus(t, resp) user := th.CreateUser() Client.Login(user.Email, user.Password) _, resp = Client.GetTeamMembersForUser(th.BasicUser.Id, "") CheckForbiddenStatus(t, resp) _, resp = th.SystemAdminClient.GetTeamMembersForUser(th.BasicUser.Id, "") CheckNoError(t, resp) }
explode_data.jsonl/70724
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 337 }
[ 2830, 3393, 1949, 14597, 24371, 2461, 1474, 1155, 353, 8840, 836, 8, 341, 70479, 1669, 18626, 1155, 568, 3803, 15944, 741, 16867, 270, 836, 682, 4454, 741, 71724, 1669, 270, 11716, 271, 2109, 7062, 11, 9039, 1669, 8423, 2234, 14597, 243...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestUserSetActive(t *testing.T) { options := server.DefaultOptions().WithAuth(true) bs := servertest.NewBufconnServer(options) bs.Start() defer bs.Stop() defer os.RemoveAll(options.Dir) defer os.Remove(".state-") ts := client.NewTokenService().WithTokenFileName("testTokenFile").WithHds(&test.HomedirServiceMock{}) ic := test.NewClientTest(&test.PasswordReader{ Pass: []string{"immudb"}, }, ts).WithOptions(client.DefaultOptions()) ic. Connect(bs.Dialer) ic.Login("immudb") ic.Pr = &test.PasswordReader{ Pass: []string{"MyUser@9", "MyUser@9"}, } ic.Connect(bs.Dialer) _, err := ic.Imc.UserCreate([]string{"myuser", "readwrite", "defaultdb"}) if err != nil { t.Fatal("TestUserCreate fail", err) } var userCreateTests = []struct { name string args []string password string expected string test func(*testing.T, string, []string, string) }{ { "SetActiveUser", []string{"myuser"}, "", "user status changed successfully", func(t *testing.T, password string, args []string, exp string) { msg, err := ic.Imc.SetActiveUser(args, true) if err != nil { t.Fatal("SetActiveUser fail", err) } if !strings.Contains(msg, exp) { t.Fatalf("SetActiveUser failed to change status: %s", msg) } }, }, { "Deactivate user", []string{"myuser"}, "", "user status changed successfully", func(t *testing.T, password string, args []string, exp string) { msg, err := ic.Imc.SetActiveUser(args, false) if err != nil { t.Fatal("Deactivate fail", err) } if !strings.Contains(msg, exp) { t.Fatalf("Deactivate failed to change status: %s", msg) } }, }, } for _, tt := range userCreateTests { t.Run(tt.name, func(t *testing.T) { tt.test(t, tt.password, tt.args, tt.expected) }) } }
explode_data.jsonl/47419
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 760 }
[ 2830, 3393, 1474, 83020, 1155, 353, 8840, 836, 8, 341, 35500, 1669, 3538, 13275, 3798, 1005, 2354, 5087, 3715, 340, 93801, 1669, 1420, 1621, 477, 7121, 15064, 5148, 5475, 12078, 692, 93801, 12101, 741, 16867, 17065, 30213, 2822, 16867, 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...
3
func TestRemoveExchangeAddress(t *testing.T) { newbase := Base{} exchangeName := "BallerExchange" coinType := "LTC" newbase.AddExchangeAddress(exchangeName, coinType, 420) if !newbase.ExchangeAddressExists(exchangeName, coinType) { t.Error("Test failed - portfolio_test.go - TestRemoveAddress") } newbase.RemoveExchangeAddress(exchangeName, coinType) if newbase.ExchangeAddressExists(exchangeName, coinType) { t.Error("Test failed - portfolio_test.go - TestRemoveAddress") } }
explode_data.jsonl/33739
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 168 }
[ 2830, 3393, 13021, 31564, 4286, 1155, 353, 8840, 836, 8, 341, 8638, 3152, 1669, 5351, 16094, 8122, 3373, 675, 1669, 330, 33, 13956, 31564, 698, 197, 7160, 929, 1669, 330, 43, 7749, 1837, 8638, 3152, 1904, 31564, 4286, 5463, 3373, 675, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestAccessApplications(t *testing.T) { setup() defer teardown() handler := func(w http.ResponseWriter, r *http.Request) { assert.Equal(t, r.Method, "GET", "Expected method 'GET', got %s", r.Method) w.Header().Set("content-type", "application/json") fmt.Fprintf(w, `{ "success": true, "errors": [], "messages": [], "result": [ { "id": "480f4f69-1a28-4fdd-9240-1ed29f0ac1db", "created_at": "2014-01-01T05:20:00.12345Z", "updated_at": "2014-01-01T05:20:00.12345Z", "aud": "737646a56ab1df6ec9bddc7e5ca84eaf3b0768850f3ffb5d74f1534911fe3893", "name": "Admin Site", "domain": "test.example.com/admin", "session_duration": "24h", "allowed_idps": ["f174e90a-fafe-4643-bbbc-4a0ed4fc8415"], "auto_redirect_to_identity": false, "enable_binding_cookie": false, "custom_deny_url": "https://www.cloudflare.com", "custom_deny_message": "denied!" } ], "result_info": { "page": 1, "per_page": 20, "count": 1, "total_count": 2000 } } `) } createdAt, _ := time.Parse(time.RFC3339, "2014-01-01T05:20:00.12345Z") updatedAt, _ := time.Parse(time.RFC3339, "2014-01-01T05:20:00.12345Z") want := []AccessApplication{{ ID: "480f4f69-1a28-4fdd-9240-1ed29f0ac1db", CreatedAt: &createdAt, UpdatedAt: &updatedAt, AUD: "737646a56ab1df6ec9bddc7e5ca84eaf3b0768850f3ffb5d74f1534911fe3893", Name: "Admin Site", Domain: "test.example.com/admin", SessionDuration: "24h", AllowedIdps: []string{"f174e90a-fafe-4643-bbbc-4a0ed4fc8415"}, AutoRedirectToIdentity: false, EnableBindingCookie: false, CustomDenyMessage: "denied!", CustomDenyURL: "https://www.cloudflare.com", }} mux.HandleFunc("/accounts/"+accountID+"/access/apps", handler) actual, _, err := client.AccessApplications(accountID, PaginationOptions{}) if assert.NoError(t, err) { assert.Equal(t, want, actual) } mux.HandleFunc("/zones/"+zoneID+"/access/apps", handler) actual, _, err = client.ZoneLevelAccessApplications(zoneID, PaginationOptions{}) if assert.NoError(t, err) { assert.Equal(t, want, actual) } }
explode_data.jsonl/45468
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1124 }
[ 2830, 3393, 6054, 50359, 1155, 353, 8840, 836, 8, 341, 84571, 741, 16867, 49304, 2822, 53326, 1669, 2915, 3622, 1758, 37508, 11, 435, 353, 1254, 9659, 8, 341, 197, 6948, 12808, 1155, 11, 435, 20798, 11, 330, 3806, 497, 330, 18896, 171...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestRepository_Commits_options(t *testing.T) { t.Parallel() ctx := context.Background() gitCommands := []string{ "GIT_COMMITTER_NAME=a GIT_COMMITTER_EMAIL=a@a.com GIT_COMMITTER_DATE=2006-01-02T15:04:05Z git commit --allow-empty -m foo --author='a <a@a.com>' --date 2006-01-02T15:04:05Z", "GIT_COMMITTER_NAME=c GIT_COMMITTER_EMAIL=c@c.com GIT_COMMITTER_DATE=2006-01-02T15:04:07Z git commit --allow-empty -m bar --author='a <a@a.com>' --date 2006-01-02T15:04:06Z", "GIT_COMMITTER_NAME=c GIT_COMMITTER_EMAIL=c@c.com GIT_COMMITTER_DATE=2006-01-02T15:04:08Z git commit --allow-empty -m qux --author='a <a@a.com>' --date 2006-01-02T15:04:08Z", } wantGitCommits := []*gitdomain.Commit{ { ID: "b266c7e3ca00b1a17ad0b1449825d0854225c007", Author: gitdomain.Signature{Name: "a", Email: "a@a.com", Date: MustParseTime(time.RFC3339, "2006-01-02T15:04:06Z")}, Committer: &gitdomain.Signature{Name: "c", Email: "c@c.com", Date: MustParseTime(time.RFC3339, "2006-01-02T15:04:07Z")}, Message: "bar", Parents: []api.CommitID{"ea167fe3d76b1e5fd3ed8ca44cbd2fe3897684f8"}, }, } wantGitCommits2 := []*gitdomain.Commit{ { ID: "ade564eba4cf904492fb56dcd287ac633e6e082c", Author: gitdomain.Signature{Name: "a", Email: "a@a.com", Date: MustParseTime(time.RFC3339, "2006-01-02T15:04:08Z")}, Committer: &gitdomain.Signature{Name: "c", Email: "c@c.com", Date: MustParseTime(time.RFC3339, "2006-01-02T15:04:08Z")}, Message: "qux", Parents: []api.CommitID{"b266c7e3ca00b1a17ad0b1449825d0854225c007"}, }, } tests := map[string]struct { repo api.RepoName opt CommitsOptions wantCommits []*gitdomain.Commit wantTotal uint }{ "git cmd": { repo: MakeGitRepository(t, gitCommands...), opt: CommitsOptions{Range: "ade564eba4cf904492fb56dcd287ac633e6e082c", N: 1, Skip: 1}, wantCommits: wantGitCommits, wantTotal: 1, }, "git cmd Head": { repo: MakeGitRepository(t, gitCommands...), opt: CommitsOptions{ Range: "b266c7e3ca00b1a17ad0b1449825d0854225c007...ade564eba4cf904492fb56dcd287ac633e6e082c", }, wantCommits: wantGitCommits2, wantTotal: 1, }, "before": { repo: MakeGitRepository(t, gitCommands...), opt: CommitsOptions{ Before: "2006-01-02T15:04:07Z", Range: "HEAD", N: 1, }, wantCommits: []*gitdomain.Commit{ { ID: "b266c7e3ca00b1a17ad0b1449825d0854225c007", Author: gitdomain.Signature{Name: "a", Email: "a@a.com", Date: MustParseTime(time.RFC3339, "2006-01-02T15:04:06Z")}, Committer: &gitdomain.Signature{Name: "c", Email: "c@c.com", Date: MustParseTime(time.RFC3339, "2006-01-02T15:04:07Z")}, Message: "bar", Parents: []api.CommitID{"ea167fe3d76b1e5fd3ed8ca44cbd2fe3897684f8"}, }, }, wantTotal: 1, }, } runCommitsTests := func(checker authz.SubRepoPermissionChecker) { for label, test := range tests { t.Run(label, func(t *testing.T) { testCommits(ctx, label, test.repo, test.opt, checker, test.wantTotal, test.wantCommits, t) }) } } runCommitsTests(nil) checker := getTestSubRepoPermsChecker() runCommitsTests(checker) }
explode_data.jsonl/8520
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1582 }
[ 2830, 3393, 4624, 16946, 44703, 8743, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 741, 20985, 1669, 2266, 19047, 2822, 90731, 30479, 1669, 3056, 917, 515, 197, 197, 89199, 952, 14025, 59837, 4708, 24239, 90092, 14025, 59837, 29548, 2...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestUnitScheduleSignTransactionValidate(t *testing.T) { client := ClientForTestnet() client.SetAutoValidateChecksums(true) scheduleID, err := ScheduleIDFromString("0.0.123-rmkyk") assert.NoError(t, err) scheduleSign := NewScheduleSignTransaction(). SetScheduleID(scheduleID) err = scheduleSign._ValidateNetworkOnIDs(client) assert.NoError(t, err) }
explode_data.jsonl/19816
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 126 }
[ 2830, 3393, 4562, 32210, 7264, 8070, 17926, 1155, 353, 8840, 836, 8, 341, 25291, 1669, 8423, 2461, 2271, 4711, 741, 25291, 4202, 13253, 17926, 73190, 82, 3715, 340, 1903, 8796, 915, 11, 1848, 1669, 23512, 915, 44491, 445, 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...
1
func TestPeriodicCleanup(t *testing.T) { db := newDB() store := New(db, []byte("secret")) store.SessionOpts.MaxAge = 1 countFn := makeCountHandler("session", store) quit := make(chan struct{}) go store.PeriodicCleanup(200*time.Millisecond, quit) // test that cleanup i done at least twice r1 := req(countFn, nil) id1 := r1.Header().Get("X-Session") if findSession(db, store, id1) == nil { t.Error("Expected r1 session to exist") } time.Sleep(2 * time.Second) if findSession(db, store, id1) != nil { t.Error("Expected r1 session to be deleted") } r2 := req(countFn, nil) id2 := r2.Header().Get("X-Session") if findSession(db, store, id2) == nil { t.Error("Expected r2 session to exist") } time.Sleep(2 * time.Second) if findSession(db, store, id2) != nil { t.Error("Expected r2 session to be deleted") } close(quit) // test that cleanup has stopped r3 := req(countFn, nil) id3 := r3.Header().Get("X-Session") if findSession(db, store, id3) == nil { t.Error("Expected r3 session to exist") } time.Sleep(2 * time.Second) if findSession(db, store, id3) == nil { t.Error("Expected r3 session to exist") } }
explode_data.jsonl/71338
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 448 }
[ 2830, 3393, 23750, 292, 67335, 1155, 353, 8840, 836, 8, 341, 20939, 1669, 501, 3506, 741, 57279, 1669, 1532, 9791, 11, 3056, 3782, 445, 20474, 5455, 57279, 20674, 43451, 14535, 16749, 284, 220, 16, 198, 18032, 24911, 1669, 1281, 2507, 3...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
7
func TestGitlabCloneURLs(t *testing.T) { repo := &gitlab.Project{ ProjectCommon: gitlab.ProjectCommon{ ID: 1, PathWithNamespace: "foo/bar", SSHURLToRepo: "git@gitlab.com:gitlab-org/gitaly.git", HTTPURLToRepo: "https://gitlab.com/gitlab-org/gitaly.git", }, } tests := []struct { Token string GitURLType string Want string }{ {"", "", "https://gitlab.com/gitlab-org/gitaly.git"}, {"abcd", "", "https://git:abcd@gitlab.com/gitlab-org/gitaly.git"}, {"abcd", "ssh", "git@gitlab.com:gitlab-org/gitaly.git"}, } for _, test := range tests { t.Run(fmt.Sprintf("Token(%q) / URLType(%q)", test.Token, test.GitURLType), func(t *testing.T) { cfg := schema.GitLabConnection{ Token: test.Token, GitURLType: test.GitURLType, } got := gitlabCloneURL(repo, &cfg) if got != test.Want { t.Fatalf("wrong cloneURL, got: %q, want: %q", got, test.Want) } }) } }
explode_data.jsonl/39378
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 461 }
[ 2830, 3393, 46562, 14380, 37677, 3144, 82, 1155, 353, 8840, 836, 8, 341, 17200, 5368, 1669, 609, 12882, 14380, 30944, 515, 197, 197, 7849, 10839, 25, 16345, 14380, 30944, 10839, 515, 298, 29580, 25, 394, 220, 16, 345, 298, 69640, 2354, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestRouter_Group_panic(t *testing.T) { t.Parallel() t.Run("wildcard ending", func(t *testing.T) { defer func() { if r := recover(); r == nil { t.Error("expected panic") } }() router := NewRouter() _ = router.Group("/api/*") }) }
explode_data.jsonl/73800
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 113 }
[ 2830, 3393, 9523, 52619, 620, 31270, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 2822, 3244, 16708, 445, 67874, 4951, 13391, 497, 2915, 1155, 353, 8840, 836, 8, 341, 197, 16867, 2915, 368, 341, 298, 743, 435, 1669, 11731, 2129, 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 TestIterGrowWithGC(t *testing.T) { m := make(map[int]int, 4) for i := 0; i < 8; i++ { m[i] = i } for i := 8; i < 16; i++ { m[i] += i } growflag := true bitmask := 0 for k := range m { if k < 16 { bitmask |= 1 << uint(k) } if growflag { // grow the table for i := 100; i < 1000; i++ { m[i] = i } // trigger a gc runtime.GC() growflag = false } } if bitmask != 1<<16-1 { t.Error("missing key", bitmask) } }
explode_data.jsonl/19910
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 236 }
[ 2830, 3393, 8537, 56788, 2354, 22863, 1155, 353, 8840, 836, 8, 341, 2109, 1669, 1281, 9147, 18640, 63025, 11, 220, 19, 340, 2023, 600, 1669, 220, 15, 26, 600, 366, 220, 23, 26, 600, 1027, 341, 197, 2109, 989, 60, 284, 600, 198, 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...
8
func TestContextRenderNoContentString(t *testing.T) { w := httptest.NewRecorder() c, _ := CreateTestContext(w) c.String(http.StatusNoContent, "test %s %d", "string", 2) assert.Equal(t, http.StatusNoContent, w.Code) assert.Empty(t, w.Body.String()) assert.Equal(t, "text/plain; charset=utf-8", w.Header().Get("Content-Type")) }
explode_data.jsonl/26787
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 129 }
[ 2830, 3393, 1972, 6750, 2753, 2762, 703, 1155, 353, 8840, 836, 8, 341, 6692, 1669, 54320, 70334, 7121, 47023, 741, 1444, 11, 716, 1669, 4230, 2271, 1972, 3622, 692, 1444, 6431, 19886, 10538, 2753, 2762, 11, 330, 1944, 1018, 82, 1018, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestNetworkConfig(t *testing.T) { endpointConfig, err := ConfigFromBackend(configBackend) if err != nil { t.Fatal("Failed to get endpoint config from backend") } conf := endpointConfig.NetworkConfig() assert.NotNil(t, conf) if len(conf.Orderers) == 0 { t.Fatal("Expected orderers to be set") } if len(conf.Organizations) == 0 { t.Fatal("Expected atleast one organisation to be set") } // viper map keys are lowercase if len(conf.Organizations[strings.ToLower(org1)].Peers) == 0 { t.Fatalf("Expected org %s to be present in network configuration and peers to be set", org1) } }
explode_data.jsonl/34085
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 212 }
[ 2830, 3393, 12320, 2648, 1155, 353, 8840, 836, 8, 341, 6246, 2768, 2648, 11, 1848, 1669, 5532, 3830, 29699, 8754, 29699, 340, 743, 1848, 961, 2092, 341, 197, 3244, 26133, 445, 9408, 311, 633, 14887, 2193, 504, 19163, 1138, 197, 630, 6...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
5
func TestCommand(t *testing.T) { tests := []struct { name string args []string wantErr string wantStdout string }{ { name: "NoArgsSucceeds", args: []string{}, }, { name: "Usage", args: []string{"-h"}, wantStdout: knownGoodUsage, }, { name: "OneArgFails", args: []string{"tuna"}, wantErr: `unknown command "tuna" for "pinniped-concierge"`, }, { name: "ShortConfigFlagSucceeds", args: []string{"-c", "some/path/to/config.yaml"}, }, { name: "LongConfigFlagSucceeds", args: []string{"--config", "some/path/to/config.yaml"}, }, { name: "OneArgWithConfigFlagFails", args: []string{ "--config", "some/path/to/config.yaml", "tuna", }, wantErr: `unknown command "tuna" for "pinniped-concierge"`, }, } for _, test := range tests { test := test t.Run(test.name, func(t *testing.T) { stdout := bytes.NewBuffer([]byte{}) stderr := bytes.NewBuffer([]byte{}) a := New(context.Background(), test.args, stdout, stderr) a.cmd.RunE = func(cmd *cobra.Command, args []string) error { return nil } err := a.Run() if test.wantErr != "" { require.EqualError(t, err, test.wantErr) } else { require.NoError(t, err) } if test.wantStdout != "" { require.Equal(t, strings.TrimSpace(test.wantStdout), strings.TrimSpace(stdout.String()), cmp.Diff(test.wantStdout, stdout.String())) } }) } }
explode_data.jsonl/39152
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 688 }
[ 2830, 3393, 4062, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 3056, 1235, 341, 197, 11609, 981, 914, 198, 197, 31215, 981, 3056, 917, 198, 197, 50780, 7747, 262, 914, 198, 197, 50780, 22748, 411, 914, 198, 197, 59403, 197, 197, 515, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestRemoveBranchProtection(t *testing.T) { ts := httptest.NewTLSServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { if r.Method != http.MethodDelete { t.Errorf("Bad method: %s", r.Method) } if r.URL.Path != "/repos/org/repo/branches/master/protection" { t.Errorf("Bad request path: %s", r.URL.Path) } http.Error(w, "204 No Content", http.StatusNoContent) })) defer ts.Close() c := getClient(ts.URL) if err := c.RemoveBranchProtection("org", "repo", "master"); err != nil { t.Errorf("Unexpected error: %v", err) } }
explode_data.jsonl/6297
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 229 }
[ 2830, 3393, 13021, 18197, 78998, 1155, 353, 8840, 836, 8, 341, 57441, 1669, 54320, 70334, 7121, 13470, 1220, 2836, 19886, 89164, 18552, 3622, 1758, 37508, 11, 435, 353, 1254, 9659, 8, 341, 197, 743, 435, 20798, 961, 1758, 20798, 6435, 3...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestSequentialTraceMapSize(t *testing.T) { traceIds, batches := generateIdsAndBatches(210) const maxSize = 100 cfg := Config{ DecisionWait: defaultTestDecisionWait, NumTraces: uint64(maxSize), ExpectedNewTracesPerSec: 64, PolicyCfgs: testPolicy, } sp, _ := newTraceProcessor(zap.NewNop(), consumertest.NewNop(), cfg) tsp := sp.(*tailSamplingSpanProcessor) for _, batch := range batches { tsp.ConsumeTraces(context.Background(), batch) } // On sequential insertion it is possible to know exactly which traces should be still on the map. for i := 0; i < len(traceIds)-maxSize; i++ { _, ok := tsp.idToTrace.Load(traceIds[i]) require.False(t, ok, "Found unexpected traceId[%d] still on map (id: %v)", i, traceIds[i]) } }
explode_data.jsonl/31671
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 319 }
[ 2830, 3393, 22046, 6550, 2227, 1695, 1155, 353, 8840, 836, 8, 341, 65058, 12701, 11, 44792, 1669, 6923, 12701, 3036, 33, 9118, 7, 17, 16, 15, 340, 4777, 61935, 284, 220, 16, 15, 15, 198, 50286, 1669, 5532, 515, 197, 197, 74846, 1419...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestNewRemoveCommandSuccess(t *testing.T) { testCases := []struct { name string args []string imageRemoveFunc func(image string, options types.ImageRemoveOptions) ([]types.ImageDeleteResponseItem, error) }{ { name: "Image Deleted", args: []string{"image1"}, imageRemoveFunc: func(image string, options types.ImageRemoveOptions) ([]types.ImageDeleteResponseItem, error) { assert.Equal(t, image, "image1") return []types.ImageDeleteResponseItem{{Deleted: image}}, nil }, }, { name: "Image Untagged", args: []string{"image1"}, imageRemoveFunc: func(image string, options types.ImageRemoveOptions) ([]types.ImageDeleteResponseItem, error) { assert.Equal(t, image, "image1") return []types.ImageDeleteResponseItem{{Untagged: image}}, nil }, }, { name: "Image Deleted and Untagged", args: []string{"image1", "image2"}, imageRemoveFunc: func(image string, options types.ImageRemoveOptions) ([]types.ImageDeleteResponseItem, error) { if image == "image1" { return []types.ImageDeleteResponseItem{{Untagged: image}}, nil } return []types.ImageDeleteResponseItem{{Deleted: image}}, nil }, }, } for _, tc := range testCases { buf := new(bytes.Buffer) cmd := NewRemoveCommand(test.NewFakeCli(&fakeClient{ imageRemoveFunc: tc.imageRemoveFunc, }, buf)) cmd.SetOutput(ioutil.Discard) cmd.SetArgs(tc.args) assert.NoError(t, cmd.Execute()) err := cmd.Execute() assert.NoError(t, err) actual := buf.String() expected := string(golden.Get(t, []byte(actual), fmt.Sprintf("remove-command-success.%s.golden", tc.name))[:]) testutil.EqualNormalizedString(t, testutil.RemoveSpace, actual, expected) } }
explode_data.jsonl/26901
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 655 }
[ 2830, 3393, 3564, 13021, 4062, 7188, 1155, 353, 8840, 836, 8, 341, 18185, 37302, 1669, 3056, 1235, 341, 197, 11609, 310, 914, 198, 197, 31215, 310, 3056, 917, 198, 197, 31426, 13021, 9626, 2915, 10075, 914, 11, 2606, 4494, 7528, 13021, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestFileDescriptor(t *testing.T) { router := New() addr, err := net.ResolveTCPAddr("tcp", "localhost:0") assert.NoError(t, err) listener, err := net.ListenTCP("tcp", addr) assert.NoError(t, err) socketFile, err := listener.File() assert.NoError(t, err) go func() { router.GET("/example", func(c *Context) { c.String(http.StatusOK, "it worked") }) assert.NoError(t, router.RunFd(int(socketFile.Fd()))) }() // have to wait for the goroutine to start and run the server // otherwise the main thread will complete time.Sleep(5 * time.Millisecond) c, err := net.Dial("tcp", listener.Addr().String()) assert.NoError(t, err) fmt.Fprintf(c, "GET /example HTTP/1.0\r\n\r\n") scanner := bufio.NewScanner(c) var response string for scanner.Scan() { response += scanner.Text() } assert.Contains(t, response, "HTTP/1.0 200", "should get a 200") assert.Contains(t, response, "it worked", "resp body should match") }
explode_data.jsonl/1181
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 358 }
[ 2830, 3393, 1703, 11709, 1155, 353, 8840, 836, 8, 341, 67009, 1669, 1532, 2822, 53183, 11, 1848, 1669, 4179, 57875, 49896, 13986, 445, 27161, 497, 330, 8301, 25, 15, 1138, 6948, 35699, 1155, 11, 1848, 340, 14440, 798, 11, 1848, 1669, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestGenerateRequestTypes(t *testing.T) { spec := `--- paths: /: get: operationId: Hoge parameters: - name: Foo in: header schema: type: string - name: Bar in: path required: true schema: type: string - name: Baz in: query schema: type: string - name: Qux in: cookie schema: type: string requestBody: content: application/json: schema: type: object properties: FooBar: type: string ` doc, err := openapi.Load([]byte(spec)) if err != nil { t.Fatal(err) } typ, err := generator.GenerateRequestTypes(doc) if err != nil { t.Error(err) return } expected := `package models // code generated by restgen. DO NOT EDIT. type HogeRequest struct { Query struct { Baz string } Header struct { Foo string } PathArgs struct { Bar string } Cookie struct { Qux string } Body struct { FooBar string } } ` if string(typ) != expected { t.Errorf("%s != %s", string(typ), expected) return } }
explode_data.jsonl/65727
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 614 }
[ 2830, 3393, 31115, 1900, 4173, 1155, 353, 8840, 836, 8, 341, 98100, 1669, 1565, 10952, 21623, 510, 220, 608, 510, 262, 633, 510, 414, 5666, 764, 25, 472, 40532, 198, 414, 5029, 510, 286, 481, 829, 25, 33428, 198, 688, 304, 25, 4247,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestTextGenerator_GenerateDataBySchema_MinLengthGreaterThanDefaultMaxLength_LengthOfStringInExpectedRange(t *testing.T) { randomSource := rand.NewSource(time.Now().UnixNano()) textGeneratorInstance := &textGenerator{ generator: &rangedTextGenerator{ random: rand.New(randomSource), }, } schema := openapi3.NewSchema() schema.MinLength = defaultMaxLength for i := 0; i < 1000; i++ { data, err := textGeneratorInstance.GenerateDataBySchema(context.Background(), schema) assert.NoError(t, err) assert.GreaterOrEqual(t, len(data.(string)), defaultMaxLength) assert.LessOrEqual(t, len(data.(string)), 2*defaultMaxLength) } }
explode_data.jsonl/45038
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 227 }
[ 2830, 3393, 1178, 12561, 2646, 13220, 1043, 1359, 8632, 62122, 4373, 85720, 3675, 35601, 81620, 66952, 641, 18896, 6046, 1155, 353, 8840, 836, 8, 341, 83628, 3608, 1669, 10382, 7121, 3608, 9730, 13244, 1005, 55832, 83819, 2398, 15425, 12561...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestIntersectionIterator(t *testing.T) { assert := assert.New(t) vs := newTestValueStore() byTwos, err := NewSet(context.Background(), vs, generateNumbersAsValuesFromToBy(0, 200, 2)...) assert.NoError(err) byThrees, err := NewSet(context.Background(), vs, generateNumbersAsValuesFromToBy(0, 200, 3)...) assert.NoError(err) byFives, err := NewSet(context.Background(), vs, generateNumbersAsValuesFromToBy(0, 200, 5)...) assert.NoError(err) i1, err := NewIntersectionIterator(context.Background(), Format_7_18, mustSIter(byTwos.Iterator(context.Background())), mustSIter(byThrees.Iterator(context.Background()))) assert.NoError(err) vals, err := iterToSlice(i1) assert.NoError(err) expectedRes := generateNumbersAsValuesFromToBy(0, 200, 6) assert.True(vals.Equals(expectedRes), "Expected: %v != actual: %v", expectedRes, vs) it1, err := NewIntersectionIterator(context.Background(), Format_7_18, mustSIter(byTwos.Iterator(context.Background())), mustSIter(byThrees.Iterator(context.Background()))) assert.NoError(err) it2, err := NewIntersectionIterator(context.Background(), Format_7_18, it1, mustSIter(byFives.Iterator(context.Background()))) assert.NoError(err) vals, err = iterToSlice(it2) assert.NoError(err) expectedRes = generateNumbersAsValuesFromToBy(0, 200, 30) assert.True(vals.Equals(expectedRes), "Expected: %v != actual: %v", expectedRes, vs) it1, err = NewIntersectionIterator(context.Background(), Format_7_18, mustSIter(byThrees.Iterator(context.Background())), mustSIter(byFives.Iterator(context.Background()))) assert.NoError(err) it2, err = NewIntersectionIterator(context.Background(), Format_7_18, it1, mustSIter(byTwos.Iterator(context.Background()))) assert.NoError(err) assert.Panics(func() { _, _ = it2.SkipTo(context.Background(), nil) }) assert.Equal(Float(30), mustValue(it2.SkipTo(context.Background(), Float(5)))) assert.Equal(Float(60), mustValue(it2.SkipTo(context.Background(), Float(60)))) assert.Equal(Float(90), mustValue(it2.SkipTo(context.Background(), Float(5)))) assert.Equal(Float(120), mustValue(it2.Next(context.Background()))) assert.Equal(Float(150), mustValue(it2.SkipTo(context.Background(), Float(150)))) assert.Nil(it2.SkipTo(context.Background(), Float(40000))) }
explode_data.jsonl/10999
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 774 }
[ 2830, 3393, 72927, 11951, 1155, 353, 8840, 836, 8, 341, 6948, 1669, 2060, 7121, 1155, 692, 5195, 82, 1669, 501, 2271, 1130, 6093, 2822, 197, 1694, 22816, 436, 11, 1848, 1669, 1532, 1649, 5378, 19047, 1507, 6165, 11, 6923, 27237, 2121, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestEmptySubsystem(t *testing.T) { const data = `10:devices:/user.slice 9:net_cls,net_prio:/ 8:blkio:/ 7:freezer:/ 6:perf_event:/ 5:cpuset:/ 4:memory:/ 3:pids:/user.slice/user-1000.slice/user@1000.service 2:cpu,cpuacct:/ 1:name=systemd:/user.slice/user-1000.slice/user@1000.service/gnome-terminal-server.service 0::/user.slice/user-1000.slice/user@1000.service/gnome-terminal-server.service` r := strings.NewReader(data) paths, err := parseCgroupFromReader(r) if err != nil { t.Fatal(err) } for subsystem, path := range paths { if subsystem == "" { t.Fatalf("empty subsystem for %q", path) } } }
explode_data.jsonl/1200
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 265 }
[ 2830, 3393, 3522, 81120, 1155, 353, 8840, 836, 8, 341, 4777, 821, 284, 1565, 16, 15, 25, 46966, 14375, 872, 14530, 198, 197, 24, 25, 4711, 38656, 11, 4711, 620, 10383, 25, 5894, 197, 23, 25, 34989, 815, 25, 5894, 197, 22, 25, 1059...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestGetStats(t *testing.T) { t.Parallel() _, err := b.GetStats("BTCUSD") if err != nil { t.Error("BitfinexGetStatsTest init error: ", err) } _, err = b.GetStats("wigwham") if err == nil { t.Error("Test Failed - GetStats() error") } }
explode_data.jsonl/79928
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 104 }
[ 2830, 3393, 1949, 16635, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 741, 197, 6878, 1848, 1669, 293, 2234, 16635, 445, 59118, 26749, 1138, 743, 1848, 961, 2092, 341, 197, 3244, 6141, 445, 8344, 5472, 327, 1949, 16635, 2271, 2930, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestCgroupv2CpuStats(t *testing.T) { checkCgroupMode(t) group := "/cpu-test-cg" groupPath := fmt.Sprintf("%s-%d", group, os.Getpid()) var ( quota int64 = 10000 period uint64 = 8000 weight uint64 = 100 ) max := "10000 8000" res := Resources{ CPU: &CPU{ Weight: &weight, Max: NewCPUMax(&quota, &period), Cpus: "0", Mems: "0", }, } c, err := NewManager(defaultCgroup2Path, groupPath, &res) if err != nil { t.Fatal("failed to init new cgroup manager: ", err) } defer os.Remove(c.path) checkFileContent(t, c.path, "cpu.weight", strconv.FormatUint(weight, 10)) checkFileContent(t, c.path, "cpu.max", max) checkFileContent(t, c.path, "cpuset.cpus", "0") checkFileContent(t, c.path, "cpuset.mems", "0") }
explode_data.jsonl/6725
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 334 }
[ 2830, 3393, 34, 4074, 85, 17, 34, 5584, 16635, 1155, 353, 8840, 836, 8, 341, 25157, 34, 4074, 3636, 1155, 340, 44260, 1669, 3521, 16475, 16839, 1786, 70, 698, 44260, 1820, 1669, 8879, 17305, 4430, 82, 11069, 67, 497, 1874, 11, 2643, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestGetDeadline(t *testing.T) { wf := wfv1.MustUnmarshalWorkflow(helloWorldWf) ctx := context.Background() woc := newWoc(*wf) mainCtr := woc.execWf.Spec.Templates[0].Container pod, _ := woc.createWorkflowPod(ctx, wf.Name, []apiv1.Container{*mainCtr}, &wf.Spec.Templates[0], &createWorkflowPodOpts{}) deadline, _ := getPodDeadline(pod) assert.Equal(t, time.Time{}, deadline) executionDeadline := time.Now().Add(5 * time.Minute) wf = wfv1.MustUnmarshalWorkflow(helloWorldWf) ctx = context.Background() woc = newWoc(*wf) mainCtr = woc.execWf.Spec.Templates[0].Container pod, _ = woc.createWorkflowPod(ctx, wf.Name, []apiv1.Container{*mainCtr}, &wf.Spec.Templates[0], &createWorkflowPodOpts{executionDeadline: executionDeadline}) deadline, _ = getPodDeadline(pod) assert.Equal(t, executionDeadline.Format(time.RFC3339), deadline.Format(time.RFC3339)) }
explode_data.jsonl/75402
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 352 }
[ 2830, 3393, 1949, 83593, 1155, 353, 8840, 836, 8, 341, 6692, 69, 1669, 289, 27890, 16, 50463, 1806, 27121, 62768, 3203, 4791, 10134, 54, 69, 340, 20985, 1669, 2266, 19047, 741, 6692, 509, 1669, 501, 54, 509, 4071, 43083, 340, 36641, 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 TestCheckResponse(t *testing.T) { req, err := NewClient(nil, "").NewRequest("GET", "test", nil, nil) if err != nil { t.Fatalf("Failed to create request: %v", err) } resp := &http.Response{ Request: req, StatusCode: http.StatusBadRequest, Body: ioutil.NopCloser(strings.NewReader(` { "message": { "prop1": [ "message 1", "message 2" ], "prop2":[ "message 3" ], "embed1": { "prop3": [ "msg 1", "msg2" ] }, "embed2": { "prop4": [ "some msg" ] } }, "error": "message 1" }`)), } errResp := CheckResponse(resp) if errResp == nil { t.Fatal("Expected error response.") } want := "GET https://gitlab.com/api/v4/test: 400 {error: message 1}, {message: {embed1: {prop3: [msg 1, msg2]}}, {embed2: {prop4: [some msg]}}, {prop1: [message 1, message 2]}, {prop2: [message 3]}}" if errResp.Error() != want { t.Errorf("Expected error: %s, got %s", want, errResp.Error()) } }
explode_data.jsonl/47241
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 473 }
[ 2830, 3393, 3973, 2582, 1155, 353, 8840, 836, 8, 341, 24395, 11, 1848, 1669, 1532, 2959, 27907, 11, 35229, 3564, 1900, 445, 3806, 497, 330, 1944, 497, 2092, 11, 2092, 340, 743, 1848, 961, 2092, 341, 197, 3244, 30762, 445, 9408, 311, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestFileUpload(t *testing.T) { t.Parallel() // create test server mux := http.NewServeMux() mux.HandleFunc("/", func(res http.ResponseWriter, req *http.Request) { fmt.Fprintf(res, "%s", uploadHTML) }) mux.HandleFunc("/upload", func(res http.ResponseWriter, req *http.Request) { f, _, err := req.FormFile("upload") if err != nil { http.Error(res, err.Error(), http.StatusBadRequest) return } defer f.Close() buf, err := ioutil.ReadAll(f) if err != nil { http.Error(res, err.Error(), http.StatusBadRequest) return } fmt.Fprintf(res, resultHTML, len(buf)) }) s := httptest.NewServer(mux) defer s.Close() // create temporary file on disk tmpfile, err := ioutil.TempFile("", "chromedp-upload-test") if err != nil { t.Fatal(err) } defer os.Remove(tmpfile.Name()) defer tmpfile.Close() if _, err := tmpfile.WriteString(uploadHTML); err != nil { t.Fatal(err) } if err := tmpfile.Close(); err != nil { t.Fatal(err) } tests := []struct { a Action }{ {SendKeys(`input[name="upload"]`, tmpfile.Name(), NodeVisible)}, {SetUploadFiles(`input[name="upload"]`, []string{tmpfile.Name()}, NodeVisible)}, } // Don't run these tests in parallel. The only way to do so would be to // fire a separate httptest server and tmpfile for each. There's no way // to share these resources easily among parallel subtests, as the // parent must finish for the children to run, made impossible by the // defers above. for i, test := range tests { t.Run(fmt.Sprintf("%02d", i), func(t *testing.T) { ctx, cancel := testAllocate(t, "") defer cancel() var result string if err := Run(ctx, Navigate(s.URL), test.a, Click(`input[name="submit"]`), Text(`#result`, &result, ByID, NodeVisible), ); err != nil { t.Fatalf("test %d expected no error, got: %v", i, err) } if result != fmt.Sprintf("%d", len(uploadHTML)) { t.Errorf("test %d expected result to be %d, got: %s", i, len(uploadHTML), result) } }) } }
explode_data.jsonl/59489
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 801 }
[ 2830, 3393, 1703, 13844, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 2822, 197, 322, 1855, 1273, 3538, 198, 2109, 2200, 1669, 1758, 7121, 60421, 44, 2200, 741, 2109, 2200, 63623, 35460, 2915, 4590, 1758, 37508, 11, 4232, 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
func TestClient_Write(t *testing.T) { ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { var data Response uncompressedBody, err := gzip.NewReader(r.Body) if err != nil { t.Error(err) } bod, err := ioutil.ReadAll(uncompressedBody) if err != nil { t.Error(err) } if r.Header.Get("Content-Encoding") != "gzip" { t.Errorf("expected gzip Content-Encoding but got %s", r.Header.Get("Content-Encoding")) } expected := "testpt,tag1=tag1 value=1i 942105600000000003\n" if string(bod) != expected { t.Errorf("unexpected send, expected '%s', got '%s'", expected, string(bod)) } w.WriteHeader(http.StatusNoContent) _ = json.NewEncoder(w).Encode(data) })) defer ts.Close() config := Config{URLs: []string{ts.URL}} c, _ := NewHTTPClient(config) bp, err := NewBatchPoints(BatchPointsConfig{}) bp.AddPoint(Point{ Name: "testpt", Tags: map[string]string{"tag1": "tag1"}, Fields: map[string]interface{}{"value": 1}, Time: time.Date(1999, 11, 9, 0, 0, 0, 3, time.UTC), }) if err != nil { t.Errorf("unexpected error. expected %v, actual %v", nil, err) } err = c.Write(bp) if err != nil { t.Errorf("unexpected error. expected %v, actual %v", nil, err) } }
explode_data.jsonl/17050
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 527 }
[ 2830, 3393, 2959, 31825, 1155, 353, 8840, 836, 8, 341, 57441, 1669, 54320, 70334, 7121, 5475, 19886, 89164, 18552, 3622, 1758, 37508, 11, 435, 353, 1254, 9659, 8, 341, 197, 2405, 821, 5949, 198, 197, 20479, 45703, 5444, 11, 1848, 1669, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
5
func TestSatAdd(t *testing.T) { tests := []struct { a, b, c uint8 }{{0, 0, 0}, {1, 1, 2}, {255, 0, 255}, {255, 1, 255}, {1, 255, 255}, {100, 155, 255}, {200, 200, 255}, {255, 255, 255}, {128, 128, 255}} for _, test := range tests { got := satAdd(test.a, test.b) if got != test.c { t.Errorf("%v: got %v; want %v", test, got, test.c) } } }
explode_data.jsonl/29421
{ "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, 34882, 2212, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 3056, 1235, 341, 197, 11323, 11, 293, 11, 272, 2622, 23, 198, 197, 92, 2979, 15, 11, 220, 15, 11, 220, 15, 2137, 314, 16, 11, 220, 16, 11, 220, 17, 2137, 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...
3
func TestProtFlags(t *testing.T) { if NoAccess().flag != 1 { t.Error("NoAccess value is", NoAccess().flag) } if ReadOnly().flag != 2 { t.Error("ReadOnly value is", ReadOnly().flag) } if ReadWrite().flag != 6 { t.Error("ReadWrite value is", ReadWrite().flag) } }
explode_data.jsonl/77100
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 104 }
[ 2830, 3393, 12423, 9195, 1155, 353, 8840, 836, 8, 341, 743, 2308, 6054, 1005, 9903, 961, 220, 16, 341, 197, 3244, 6141, 445, 2753, 6054, 897, 374, 497, 2308, 6054, 1005, 9903, 340, 197, 532, 743, 43406, 1005, 9903, 961, 220, 17, 341...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
4
func TestOrganization(t *testing.T) { mspHandler := mspconfig.NewMSPConfigHandler() og := NewOrganizationGroup("testGroup", mspHandler) assert.Equal(t, "testGroup", og.Name(), "Unexpected name returned") _, err := og.NewGroup("testGroup") assert.Error(t, err, "NewGroup should have returned error") oc := og.Allocate() _, ok := oc.(*OrganizationConfig) assert.Equal(t, true, ok, "Allocate should have returned an OrganizationConfig") og.OrganizationConfig = oc.(*OrganizationConfig) oc.(*OrganizationConfig).Commit() assert.Equal(t, oc, og.OrganizationConfig, "Failed to commit OrganizationConfig") mspDir, err := tacchainconfig.GetDevMspDir() assert.NoError(t, err, "Error getting MSP dev directory") mspConf, err := msp.GetVerifyingMspConfig(mspDir, "TestMSP") assert.NoError(t, err, "Error loading MSP config") oc.(*OrganizationConfig).protos.MSP = mspConf mspHandler.BeginConfig(t) err = oc.Validate(t, nil) assert.NoError(t, err, "Validate should not have returned error") assert.Equal(t, "TestMSP", og.MSPID(), "Unexpected MSPID returned") og.OrganizationConfig = &OrganizationConfig{ mspID: "ChangeMSP", } err = oc.Validate(t, nil) assert.Error(t, err, "Validate should have returned error for attempt to change MSPID") mspConf, err = msp.GetVerifyingMspConfig(mspDir, "") oc.(*OrganizationConfig).protos.MSP = mspConf err = oc.Validate(t, nil) assert.Error(t, err, "Validate should have returned error for empty MSP ID") oc.(*OrganizationConfig).protos.MSP = &mspprotos.MSPConfig{} err = oc.Validate(t, nil) assert.Error(t, err, "Validate should have returned error for empty MSPConfig") }
explode_data.jsonl/44199
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 589 }
[ 2830, 3393, 41574, 1155, 353, 8840, 836, 8, 341, 47691, 79, 3050, 1669, 296, 2154, 1676, 7121, 44, 4592, 2648, 3050, 741, 197, 538, 1669, 1532, 41574, 2808, 445, 1944, 2808, 497, 296, 2154, 3050, 340, 6948, 12808, 1155, 11, 330, 1944,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestFindSerialNumberForDevice(t *testing.T) { testCasesPerFile := map[string]map[string]string{ "fixtures/lsblk-mpath.json": { "/dev/mapper/mpatha": "BAINGOO2", "/dev/mapper/mpathak": "MI2IA7EL", "/dev/sda": "", "/dev/sda3": "usr", "/dev/null": "", }, "fixtures/lsblk-plain.json": { "/dev/sdc": "EJIOQU5P", "/dev/sdg": "XOHSOHW9", "/dev/sda": "", "/dev/sda3": "usr", "/dev/null": "", }, } for fileName, testCases := range testCasesPerFile { buf, err := os.ReadFile(fileName) if err != nil { t.Fatal(err.Error()) } output, err := ParseLsblkOutput(string(buf)) if err != nil { t.Fatal(err.Error()) } for devicePath, expectedSerialNumber := range testCases { actualSerialNumber := emptyIfNil(output.FindSerialNumberForDevice(devicePath)) if actualSerialNumber != expectedSerialNumber { t.Errorf("%s: expected %q to have serial number %q, but has serial number %q", fileName, devicePath, expectedSerialNumber, actualSerialNumber) } } } }
explode_data.jsonl/35265
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 490 }
[ 2830, 3393, 9885, 5915, 2833, 2461, 6985, 1155, 353, 8840, 836, 8, 341, 18185, 37302, 3889, 1703, 1669, 2415, 14032, 60, 2186, 14032, 30953, 515, 197, 197, 1, 45247, 14, 4730, 34989, 12, 1307, 587, 4323, 788, 341, 298, 197, 3115, 3583...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestSuspendResumeAfterTemplateNoWait(t *testing.T) { controller := newController() wfcset := controller.wfclientset.ArgoprojV1alpha1().Workflows("") // operate the workflow. it should become in a suspended state after wf := unmarshalWF(suspendResumeAfterTemplate) wf, err := wfcset.Create(wf) assert.NoError(t, err) woc := newWorkflowOperationCtx(wf, controller) woc.operate() wf, err = wfcset.Get(wf.ObjectMeta.Name, metav1.GetOptions{}) assert.NoError(t, err) assert.True(t, util.IsWorkflowSuspended(wf)) // operate again and verify no pods were scheduled woc = newWorkflowOperationCtx(wf, controller) woc.operate() pods, err := controller.kubeclientset.CoreV1().Pods("").List(metav1.ListOptions{}) assert.NoError(t, err) assert.Equal(t, 0, len(pods.Items)) // don't wait // operate the workflow. it should have not reached the second step since not enough time passed woc = newWorkflowOperationCtx(wf, controller) woc.operate() pods, err = controller.kubeclientset.CoreV1().Pods("").List(metav1.ListOptions{}) assert.NoError(t, err) assert.Equal(t, 0, len(pods.Items)) }
explode_data.jsonl/54372
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 410 }
[ 2830, 3393, 50, 12758, 28563, 6025, 7275, 2753, 14190, 1155, 353, 8840, 836, 8, 341, 61615, 1669, 501, 2051, 741, 6692, 8316, 746, 1669, 6461, 1418, 69, 2972, 746, 18979, 45926, 73, 53, 16, 7141, 16, 1005, 6776, 38140, 445, 5130, 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 TestLoopInSuccess(t *testing.T) { defer test.Guard(t)() ctx := newLoopInTestContext(t) height := int32(600) cfg := &swapConfig{ lnd: &ctx.lnd.LndServices, store: ctx.store, server: ctx.server, } swap, err := newLoopInSwap( context.Background(), cfg, height, &testLoopInRequest, ) if err != nil { t.Fatal(err) } ctx.store.assertLoopInStored() errChan := make(chan error) go func() { err := swap.execute(context.Background(), ctx.cfg, height) if err != nil { log.Error(err) } errChan <- err }() ctx.assertState(loopdb.StateInitiated) ctx.assertState(loopdb.StateHtlcPublished) ctx.store.assertLoopInState(loopdb.StateHtlcPublished) // Expect htlc to be published. htlcTx := <-ctx.lnd.SendOutputsChannel // Expect register for htlc conf. <-ctx.lnd.RegisterConfChannel // Confirm htlc. ctx.lnd.ConfChannel <- &chainntnfs.TxConfirmation{ Tx: &htlcTx, } // Client starts listening for spend of htlc. <-ctx.lnd.RegisterSpendChannel // Client starts listening for swap invoice updates. subscription := <-ctx.lnd.SingleInvoiceSubcribeChannel if subscription.Hash != ctx.server.swapHash { t.Fatal("client subscribing to wrong invoice") } // Server has already paid invoice before spending the htlc. Signal // settled. subscription.Update <- lndclient.InvoiceUpdate{ State: channeldb.ContractSettled, AmtPaid: 49000, } // Swap is expected to move to the state InvoiceSettled ctx.assertState(loopdb.StateInvoiceSettled) ctx.store.assertLoopInState(loopdb.StateInvoiceSettled) // Server spends htlc. successTx := wire.MsgTx{} successTx.AddTxIn(&wire.TxIn{ Witness: [][]byte{{}, {}, {}}, }) ctx.lnd.SpendChannel <- &chainntnfs.SpendDetail{ SpendingTx: &successTx, SpenderInputIndex: 0, } ctx.assertState(loopdb.StateSuccess) ctx.store.assertLoopInState(loopdb.StateSuccess) err = <-errChan if err != nil { t.Fatal(err) } }
explode_data.jsonl/10213
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 751 }
[ 2830, 3393, 14620, 641, 7188, 1155, 353, 8840, 836, 8, 341, 16867, 1273, 1224, 11034, 1155, 8, 2822, 20985, 1669, 501, 14620, 641, 2271, 1972, 1155, 692, 30500, 1669, 526, 18, 17, 7, 21, 15, 15, 692, 50286, 1669, 609, 25741, 2648, 5...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestCreateVolume(t *testing.T) { volumeDriverName := "fake1" dir, err := ioutil.TempDir("", "TestCreateVolume") if err != nil { t.Fatal(err) } defer os.RemoveAll(dir) // create volume core core, err := createVolumeCore(dir) if err != nil { t.Fatal(err) } driver.Register(driver.NewFakeDriver(volumeDriverName)) defer driver.Unregister(volumeDriverName) v, err := core.CreateVolume(types.VolumeContext{Name: "test1", Driver: volumeDriverName}) if err != nil { t.Fatalf("create volume error: %v", err) } if v.Name != "test1" { t.Fatalf("expect volume name is %s, but got %s", "test1", v.Name) } if v.Driver() != volumeDriverName { t.Fatalf("expect volume driver is %s, but got %s", volumeDriverName, v.Driver()) } _, err = core.CreateVolume(types.VolumeContext{Name: "none", Driver: "none"}) if err == nil { t.Fatal("expect get driver not found error, but err is nil") } }
explode_data.jsonl/51629
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 342 }
[ 2830, 3393, 4021, 18902, 1155, 353, 8840, 836, 8, 341, 5195, 4661, 11349, 675, 1669, 330, 30570, 16, 1837, 48532, 11, 1848, 1669, 43144, 65009, 6184, 19814, 330, 2271, 4021, 18902, 1138, 743, 1848, 961, 2092, 341, 197, 3244, 26133, 3964...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
7
func TestMacros(t *testing.T) { macros := []*rules.MacroDefinition{ { ID: "testmacro", Expression: `"{{.Root}}/test-macro"`, }, { ID: "testmacro2", Expression: `["{{.Root}}/test-macro"]`, }, } ruleDefs := []*rules.RuleDefinition{ { ID: "test_rule", Expression: `testmacro in testmacro2 && mkdir.file.path in testmacro2`, }, } test, err := newTestModule(t, macros, ruleDefs, testOpts{}) if err != nil { t.Fatal(err) } defer test.Close() testFile, _, err := test.Path("test-macro") if err != nil { t.Fatal(err) } test.WaitSignal(t, func() error { if err = os.Mkdir(testFile, 0777); err != nil { return err } return os.Remove(testFile) }, func(event *sprobe.Event, rule *rules.Rule) { assert.Equal(t, "mkdir", event.GetType(), "wrong event type") }) }
explode_data.jsonl/30088
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 390 }
[ 2830, 3393, 19552, 3630, 1155, 353, 8840, 836, 8, 341, 2109, 580, 3630, 1669, 29838, 21977, 1321, 49507, 10398, 515, 197, 197, 515, 298, 29580, 25, 260, 330, 1944, 32606, 756, 298, 197, 9595, 25, 53305, 2979, 13, 8439, 3417, 14, 1944,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestH12_RequestContentLength_Unknown(t *testing.T) { h12requestContentLength(t, func() io.Reader { return struct{ io.Reader }{strings.NewReader("Stuff")} }, -1) }
explode_data.jsonl/4758
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 57 }
[ 2830, 3393, 39, 16, 17, 44024, 2762, 4373, 62, 13790, 1155, 353, 8840, 836, 8, 341, 9598, 16, 17, 2035, 2762, 4373, 1155, 11, 2915, 368, 6399, 47431, 314, 470, 2036, 90, 6399, 47431, 335, 90, 18594, 68587, 445, 86622, 67455, 2470, 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
func TestTxExecutorRollbackBeginFail(t *testing.T) { txe, tsv, db := newTestTxExecutor(t) defer db.Close() defer tsv.StopService() txid := newTxForPrep(tsv) err := txe.Prepare(txid, "aa") require.NoError(t, err) db.AddRejectedQuery("begin", errors.New("begin fail")) err = txe.RollbackPrepared("aa", txid) require.Error(t, err) require.Contains(t, err.Error(), "begin fail") }
explode_data.jsonl/25169
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 157 }
[ 2830, 3393, 31584, 25255, 32355, 1419, 11135, 19524, 1155, 353, 8840, 836, 8, 341, 3244, 8371, 11, 259, 3492, 11, 2927, 1669, 501, 2271, 31584, 25255, 1155, 340, 16867, 2927, 10421, 741, 16867, 259, 3492, 30213, 1860, 741, 46237, 307, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestParseSuccess(t *testing.T) { event, err := ParseEvent([]byte(`{ "event": "accepted", "timestamp": 1420255392.850187, "user-variables": { "custom": "value", "parent": {"child": "user defined variable"}, "a-list": [1,2,3,4,5] }, "envelope": { "sender": "noreply@example.com", "transport": "smtp", "mail-from": null, "targets": "me@example.com" }, "message": { "headers": { "to": "me@example.com", "subject": "Test message going through the bus.", "message-id": "20150103032312.125890.23497@example.com", "from": "Example <noreply@example.com>" }, "recipients": [ "me@example.com" ], "attachments": [], "size": 6830 }, "tags": [ "sell_email_new" ], "campaigns": [ { "id": "d2yb8", "name": "wantlist" } ], "storage": { "key": "AgEASDSGFB8y4--TSDGxvccvmQB==", "url": "https://storage.eu.mailgun.net/v3/domains/example.com/messages/AgEASDSGFB8y4--TSDGxvccvmQB==" }, "recipient": "dude@example.com", "recipient-domain": "example.com", "method": "http", "flags": { "is-system-test": false, "is-big": false, "is-test-mode": false, "is-authenticated": false, "is-routed": null } }`)) ensure.Nil(t, err) ensure.DeepEqual(t, reflect.TypeOf(event).String(), "*events.Accepted") subject := event.(*events.Accepted).Message.Headers.Subject ensure.DeepEqual(t, subject, "Test message going through the bus.") ensure.DeepEqual(t, event.(*events.Accepted).Storage.Key, "AgEASDSGFB8y4--TSDGxvccvmQB==") // Make sure the next event parsing attempt will zero the fields. event2, err := ParseEvent([]byte(`{ "event": "accepted", "timestamp": 1533922516.538978, "recipient": "someone@example.com" }`)) ensure.Nil(t, err) ensure.DeepEqual(t, event2.GetTimestamp(), time.Date(2018, 8, 10, 17, 35, 16, 538978048, time.UTC)) ensure.DeepEqual(t, event2.(*events.Accepted).Message.Headers.Subject, "") // Make sure the second attempt of Parse doesn't overwrite the first event struct. ensure.DeepEqual(t, event.(*events.Accepted).Recipient, "dude@example.com") ensure.DeepEqual(t, event.(*events.Accepted).UserVariables.(map[string]interface{})["custom"], "value") child := event.(*events.Accepted).UserVariables.(map[string]interface{})["parent"].(map[string]interface{})["child"] ensure.DeepEqual(t, child, "user defined variable") aList := event.(*events.Accepted).UserVariables.(map[string]interface{})["a-list"].([]interface{}) ensure.DeepEqual(t, aList, []interface{}{1.0, 2.0, 3.0, 4.0, 5.0}) }
explode_data.jsonl/69098
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1156 }
[ 2830, 3393, 14463, 7188, 1155, 353, 8840, 836, 8, 341, 28302, 11, 1848, 1669, 14775, 1556, 10556, 3782, 5809, 515, 197, 197, 1, 3087, 788, 330, 54574, 756, 197, 197, 1, 13035, 788, 220, 16, 19, 17, 15, 17, 20, 20, 18, 24, 17, 13...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestVMSSDiskEncryptionEnabledToVLabs(t *testing.T) { cs := getDefaultContainerService() cs.Properties.AgentPoolProfiles[0].EnableVMSSDiskEncryption = to.BoolPtr(true) vlabsCS := ConvertContainerServiceToVLabs(cs) if vlabsCS == nil { t.Errorf("expected the converted containerService struct to be non-nil") } if !(*vlabsCS.Properties.AgentPoolProfiles[0].EnableVMSSDiskEncryption) { t.Errorf("expected the EnableVMSSDiskEncryption flag to be true") } }
explode_data.jsonl/11642
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 158 }
[ 2830, 3393, 11187, 1220, 47583, 79239, 5462, 1249, 30698, 3435, 1155, 353, 8840, 836, 8, 341, 71899, 1669, 69106, 4502, 1860, 741, 71899, 15945, 88869, 10551, 62719, 58, 15, 936, 11084, 11187, 1220, 47583, 79239, 284, 311, 52497, 5348, 37...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestEditor_WriteTo(t *testing.T) { s := "hello world" var buf bytes.Buffer e := new(Editor) e.SetText(s) n, err := io.Copy(&buf, e) if err != nil { t.Error(err) } if got, want := int(n), len(s); got != want { t.Errorf("got %d; want %d", got, want) } if got, want := buf.String(), s; got != want { t.Errorf("got %q; want %q", got, want) } }
explode_data.jsonl/27271
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 163 }
[ 2830, 3393, 9410, 31825, 1249, 1155, 353, 8840, 836, 8, 341, 1903, 1669, 330, 14990, 1879, 698, 2405, 6607, 5820, 22622, 198, 7727, 1669, 501, 87136, 340, 7727, 92259, 1141, 692, 9038, 11, 1848, 1669, 6399, 31770, 2099, 5909, 11, 384, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestDockerHostConfigNeuronRuntime(t *testing.T) { testTask := &Task{ Arn: "test", Containers: []*apicontainer.Container{ { Name: "myName1", Image: "image:tag", Environment: map[string]string{ "AWS_NEURON_VISIBLE_DEVICES": "all", }, }, }, } dockerHostConfig, _ := testTask.DockerHostConfig(testTask.Containers[0], dockerMap(testTask), defaultDockerClientAPIVersion, &config.Config{InferentiaSupportEnabled: true}) assert.Equal(t, neuronRuntime, dockerHostConfig.Runtime) }
explode_data.jsonl/37257
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 207 }
[ 2830, 3393, 35, 13659, 9296, 2648, 8813, 36090, 15123, 1155, 353, 8840, 836, 8, 341, 18185, 6262, 1669, 609, 6262, 515, 197, 197, 58331, 25, 330, 1944, 756, 197, 197, 74632, 25, 29838, 391, 51160, 1743, 33672, 515, 298, 197, 515, 571,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestCurrent(t *testing.T) { dsn, err := dockertest.RunRedis() require.Nil(t, err) defer dockertest.KillAllDockers() c := initCache(t, dsn) require.NotNil(t, c) d := initNewRefreshData(c) require.NotNil(t, d) err = d.Inc() require.Nil(t, err) cnt := d.Current() require.Equal(t, int(1), cnt) }
explode_data.jsonl/48650
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 145 }
[ 2830, 3393, 5405, 1155, 353, 8840, 836, 8, 341, 2698, 9613, 11, 1848, 1669, 27549, 83386, 16708, 48137, 741, 17957, 59678, 1155, 11, 1848, 340, 16867, 27549, 83386, 11352, 483, 2403, 41468, 388, 2822, 1444, 1669, 2930, 8233, 1155, 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...
1
func TestGetMarginLendingHistory(t *testing.T) { t.Parallel() tmNow := time.Now() _, err := f.GetMarginLendingHistory(context.Background(), currency.USD, tmNow.AddDate(0, 0, 1), tmNow) if !errors.Is(err, errStartTimeCannotBeAfterEndTime) { t.Errorf("expected %s, got %s", errStartTimeCannotBeAfterEndTime, err) } if !areTestAPIKeysSet() { t.Skip() } _, err = f.GetMarginLendingHistory(context.Background(), currency.USD, tmNow.AddDate(0, 0, -1), tmNow) if err != nil { t.Error(err) } }
explode_data.jsonl/15176
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 213 }
[ 2830, 3393, 1949, 21681, 43, 2459, 13424, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 2822, 3244, 76, 7039, 1669, 882, 13244, 741, 197, 6878, 1848, 1669, 282, 2234, 21681, 43, 2459, 13424, 5378, 19047, 3148, 197, 1444, 5088, 13, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestIs(t *testing.T) { err1 := errors.New("1") erra := fmt.Errorf("wrap 2: %w", err1) errb := fmt.Errorf("wrap 3: %w", erra) erro := errors.Opaque(err1) errco := fmt.Errorf("opaque: %w", erro) err3 := errors.New("3") poser := &poser{"either 1 or 3", func(err error) bool { return err == err1 || err == err3 }} testCases := []struct { err error target error match bool }{ {nil, nil, true}, {err1, nil, false}, {err1, err1, true}, {erra, err1, true}, {errb, err1, true}, {errco, erro, true}, {errco, err1, false}, {erro, erro, true}, {err1, err3, false}, {erra, err3, false}, {errb, err3, false}, {poser, err1, true}, {poser, err3, true}, {poser, erra, false}, {poser, errb, false}, {poser, erro, false}, {poser, errco, false}, } for _, tc := range testCases { t.Run("", func(t *testing.T) { if got := errors.Is(tc.err, tc.target); got != tc.match { t.Errorf("Is(%v, %v) = %v, want %v", tc.err, tc.target, got, tc.match) } }) } }
explode_data.jsonl/5220
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 484 }
[ 2830, 3393, 3872, 1155, 353, 8840, 836, 8, 341, 9859, 16, 1669, 5975, 7121, 445, 16, 1138, 9859, 64, 1669, 8879, 13080, 445, 10097, 220, 17, 25, 1018, 86, 497, 1848, 16, 340, 9859, 65, 1669, 8879, 13080, 445, 10097, 220, 18, 25, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestDestroyAllSnapshots(t *testing.T) { c, err := NewContainer(ContainerName) if err != nil { t.Errorf(err.Error()) } if err := c.DestroyAllSnapshots(); err != nil { t.Errorf(err.Error()) } }
explode_data.jsonl/2813
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 81 }
[ 2830, 3393, 14245, 2403, 61871, 27634, 1155, 353, 8840, 836, 8, 341, 1444, 11, 1848, 1669, 1532, 4502, 75145, 675, 340, 743, 1848, 961, 2092, 341, 197, 3244, 13080, 3964, 6141, 2398, 197, 630, 743, 1848, 1669, 272, 57011, 2403, 61871, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestInspect(t *testing.T) { metricName := "requests_per_s" metricNameUpper := "ReQuesTs_Per_S" testCases := map[string]struct { hpa *autoscalingv2.HorizontalPodAutoscaler expected []custommetrics.ExternalMetricValue }{ "with external metrics": { &autoscalingv2.HorizontalPodAutoscaler{ Spec: autoscalingv2.HorizontalPodAutoscalerSpec{ Metrics: []autoscalingv2.MetricSpec{ { Type: autoscalingv2.ExternalMetricSourceType, External: &autoscalingv2.ExternalMetricSource{ MetricName: metricName, MetricSelector: &metav1.LabelSelector{ MatchLabels: map[string]string{ "dcos_version": "1.9.4", }, }, }, }, { Type: autoscalingv2.ExternalMetricSourceType, External: &autoscalingv2.ExternalMetricSource{ MetricName: metricName, MetricSelector: &metav1.LabelSelector{ MatchLabels: map[string]string{ "dcos_version": "2.1.9", }, }, }, }, }, }, }, []custommetrics.ExternalMetricValue{ { MetricName: "requests_per_s", Labels: map[string]string{"dcos_version": "1.9.4"}, Ref: custommetrics.ObjectReference{ Type: "horizontal", }, Timestamp: 0, Value: 0, Valid: false, }, { MetricName: "requests_per_s", Labels: map[string]string{"dcos_version": "2.1.9"}, Ref: custommetrics.ObjectReference{ Type: "horizontal", }, Timestamp: 0, Value: 0, Valid: false, }, }, }, "no external metrics": { &autoscalingv2.HorizontalPodAutoscaler{ Spec: autoscalingv2.HorizontalPodAutoscalerSpec{ Metrics: []autoscalingv2.MetricSpec{ { Type: autoscalingv2.PodsMetricSourceType, Pods: &autoscalingv2.PodsMetricSource{ MetricName: metricName, TargetAverageValue: resource.MustParse("12"), }, }, }, }, }, []custommetrics.ExternalMetricValue{}, }, "missing labels, still OK": { &autoscalingv2.HorizontalPodAutoscaler{ Spec: autoscalingv2.HorizontalPodAutoscalerSpec{ Metrics: []autoscalingv2.MetricSpec{ { Type: autoscalingv2.ExternalMetricSourceType, External: &autoscalingv2.ExternalMetricSource{ MetricName: "foo", }, }, }, }, }, []custommetrics.ExternalMetricValue{ { MetricName: "foo", Ref: custommetrics.ObjectReference{ Type: "horizontal", }, Labels: nil, Timestamp: 0, Value: 0, Valid: false, }, }, }, "incomplete, missing external metrics": { &autoscalingv2.HorizontalPodAutoscaler{ Spec: autoscalingv2.HorizontalPodAutoscalerSpec{ Metrics: []autoscalingv2.MetricSpec{ { Type: autoscalingv2.ExternalMetricSourceType, External: nil, }, }, }, }, []custommetrics.ExternalMetricValue{}, }, "upper cases handled": { &autoscalingv2.HorizontalPodAutoscaler{ Spec: autoscalingv2.HorizontalPodAutoscalerSpec{ Metrics: []autoscalingv2.MetricSpec{ { Type: autoscalingv2.ExternalMetricSourceType, External: &autoscalingv2.ExternalMetricSource{ MetricName: metricNameUpper, MetricSelector: &metav1.LabelSelector{ MatchLabels: map[string]string{ // No need to try test upper cased labels/tags as they are not supported in Datadog "dcos_version": "1.9.4", }, }, }, }, }, }, }, []custommetrics.ExternalMetricValue{ { MetricName: metricNameUpper, Labels: map[string]string{"dcos_version": "1.9.4"}, Ref: custommetrics.ObjectReference{ Type: "horizontal", }, Timestamp: 0, Value: 0, Valid: false, }, }, }, } for name, testCase := range testCases { t.Run(name, func(t *testing.T) { got := InspectHPA(testCase.hpa) assert.ElementsMatch(t, testCase.expected, got) }) } }
explode_data.jsonl/63517
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 2050 }
[ 2830, 3393, 58533, 1155, 353, 8840, 836, 8, 341, 2109, 16340, 675, 1669, 330, 36242, 5678, 643, 698, 2109, 16340, 675, 14251, 1669, 330, 693, 48, 1137, 52793, 53918, 1098, 1837, 18185, 37302, 1669, 2415, 14032, 60, 1235, 341, 197, 9598,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestJobsController_Create_HappyPath_OffchainReportingSpec(t *testing.T) { app, client, cleanup := setupJobsControllerTests(t) defer cleanup() toml := string(cltest.MustReadFile(t, "testdata/oracle-spec.toml")) toml = strings.Replace(toml, "0xF67D0290337bca0847005C7ffD1BC75BA9AAE6e4", app.Key.Address.Hex(), 1) body, _ := json.Marshal(models.CreateJobSpecRequest{ TOML: toml, }) response, cleanup := client.Post("/v2/jobs", bytes.NewReader(body)) defer cleanup() require.Equal(t, http.StatusOK, response.StatusCode) jb := job.SpecDB{} require.NoError(t, app.Store.DB.Preload("OffchainreportingOracleSpec").First(&jb).Error) ocrJobSpec := job.SpecDB{} err := web.ParseJSONAPIResponse(cltest.ParseResponseBody(t, response), &ocrJobSpec) assert.NoError(t, err) assert.Equal(t, "web oracle spec", jb.Name.ValueOrZero()) assert.Equal(t, jb.OffchainreportingOracleSpec.P2PPeerID, ocrJobSpec.OffchainreportingOracleSpec.P2PPeerID) assert.Equal(t, jb.OffchainreportingOracleSpec.P2PBootstrapPeers, ocrJobSpec.OffchainreportingOracleSpec.P2PBootstrapPeers) assert.Equal(t, jb.OffchainreportingOracleSpec.IsBootstrapPeer, ocrJobSpec.OffchainreportingOracleSpec.IsBootstrapPeer) assert.Equal(t, jb.OffchainreportingOracleSpec.EncryptedOCRKeyBundleID, ocrJobSpec.OffchainreportingOracleSpec.EncryptedOCRKeyBundleID) assert.Equal(t, jb.OffchainreportingOracleSpec.TransmitterAddress, ocrJobSpec.OffchainreportingOracleSpec.TransmitterAddress) assert.Equal(t, jb.OffchainreportingOracleSpec.ObservationTimeout, ocrJobSpec.OffchainreportingOracleSpec.ObservationTimeout) assert.Equal(t, jb.OffchainreportingOracleSpec.BlockchainTimeout, ocrJobSpec.OffchainreportingOracleSpec.BlockchainTimeout) assert.Equal(t, jb.OffchainreportingOracleSpec.ContractConfigTrackerSubscribeInterval, ocrJobSpec.OffchainreportingOracleSpec.ContractConfigTrackerSubscribeInterval) assert.Equal(t, jb.OffchainreportingOracleSpec.ContractConfigTrackerSubscribeInterval, ocrJobSpec.OffchainreportingOracleSpec.ContractConfigTrackerSubscribeInterval) assert.Equal(t, jb.OffchainreportingOracleSpec.ContractConfigConfirmations, ocrJobSpec.OffchainreportingOracleSpec.ContractConfigConfirmations) assert.NotNil(t, ocrJobSpec.PipelineSpec.DotDagSource) // Sanity check to make sure it inserted correctly require.Equal(t, models.EIP55Address("0x613a38AC1659769640aaE063C651F48E0250454C"), jb.OffchainreportingOracleSpec.ContractAddress) }
explode_data.jsonl/1622
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 832 }
[ 2830, 3393, 40667, 2051, 34325, 2039, 11144, 1820, 94377, 8819, 70131, 8327, 1155, 353, 8840, 836, 8, 341, 28236, 11, 2943, 11, 21290, 1669, 6505, 40667, 2051, 18200, 1155, 340, 16867, 21290, 2822, 3244, 316, 75, 1669, 914, 9849, 1944, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestIssue11755(t *testing.T) { store, clean := testkit.CreateMockStore(t) defer clean() tk := testkit.NewTestKit(t, store) tk.MustExec("use test") tk.MustExec("drop table if exists lt;") tk.MustExec("create table lt (d decimal(10, 4));") tk.MustExec("insert into lt values(0.2),(0.2);") tk.MustQuery("select LEAD(d,1,1) OVER(), LAG(d,1,1) OVER() from lt;").Check(testkit.Rows("0.2000 1.0000", "1.0000 0.2000")) }
explode_data.jsonl/65553
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 178 }
[ 2830, 3393, 42006, 16, 16, 22, 20, 20, 1155, 353, 8840, 836, 8, 341, 57279, 11, 4240, 1669, 1273, 8226, 7251, 11571, 6093, 1155, 340, 16867, 4240, 2822, 3244, 74, 1669, 1273, 8226, 7121, 2271, 7695, 1155, 11, 3553, 340, 3244, 74, 50...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestListInsert(t *testing.T) { list := New() list.Insert(0, "b", "c") list.Insert(0, "a") list.Insert(10, "x") // ignore if actualValue := list.Size(); actualValue != 3 { t.Errorf("Got %v expected %v", actualValue, 3) } list.Insert(3, "d") // append if actualValue := list.Size(); actualValue != 4 { t.Errorf("Got %v expected %v", actualValue, 4) } if actualValue, expectedValue := fmt.Sprintf("%s%s%s%s", list.Values()...), "abcd"; actualValue != expectedValue { t.Errorf("Got %v expected %v", actualValue, expectedValue) } }
explode_data.jsonl/18291
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 210 }
[ 2830, 3393, 852, 13780, 1155, 353, 8840, 836, 8, 341, 14440, 1669, 1532, 741, 14440, 23142, 7, 15, 11, 330, 65, 497, 330, 66, 1138, 14440, 23142, 7, 15, 11, 330, 64, 1138, 14440, 23142, 7, 16, 15, 11, 330, 87, 899, 442, 10034, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
4
func TestArray_RemoveValue(t *testing.T) { slice := g.Slice{"a", "b", "d", "c"} array := garray.NewArrayFrom(slice) gtest.C(t, func(t *gtest.T) { t.Assert(array.RemoveValue("e"), false) t.Assert(array.RemoveValue("b"), true) t.Assert(array.RemoveValue("a"), true) t.Assert(array.RemoveValue("c"), true) t.Assert(array.RemoveValue("f"), false) }) }
explode_data.jsonl/13918
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 156 }
[ 2830, 3393, 1857, 66843, 1130, 1155, 353, 8840, 836, 8, 341, 1903, 4754, 1669, 342, 95495, 4913, 64, 497, 330, 65, 497, 330, 67, 497, 330, 66, 16707, 11923, 1669, 342, 1653, 7121, 1857, 3830, 75282, 340, 3174, 1944, 727, 1155, 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...
1
func TestPropertySet(t *testing.T) { dummy := newObject(ObjectType) cases := []invokeTestCase{ {args: wrapArgs(newProperty(nil, wrapFuncForTest(func(_ *Frame, _, _ *Object) (*Object, *BaseException) { return None, nil }), nil), dummy, 123), want: None}, {args: wrapArgs(newProperty(nil, wrapFuncForTest(func(f *Frame, _, _ *Object) (*Object, *BaseException) { return nil, f.RaiseType(ValueErrorType, "bar") }), nil), dummy, 123), wantExc: mustCreateException(ValueErrorType, "bar")}, {args: wrapArgs(newProperty(nil, nil, nil), dummy, 123), wantExc: mustCreateException(AttributeErrorType, "can't set attribute")}, } for _, cas := range cases { if err := runInvokeMethodTestCase(PropertyType, "__set__", &cas); err != "" { t.Error(err) } } }
explode_data.jsonl/79893
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 266 }
[ 2830, 3393, 3052, 1649, 1155, 353, 8840, 836, 8, 341, 2698, 8574, 1669, 501, 1190, 12526, 929, 340, 1444, 2264, 1669, 3056, 22430, 16458, 515, 197, 197, 90, 2116, 25, 15061, 4117, 1755, 3052, 27907, 11, 15061, 9626, 2461, 2271, 18552, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestCloud_InstanceExists(t *testing.T) { ctrl := gomock.NewController(t) defer ctrl.Finish() t.Run("should not return error when instance not found by node name", func(t *testing.T) { cloud := GetTestCloud(ctrl) cloud.VMSet = NewMockVMSet(ctrl) // FIXME(lodrem): implement MockCloud and init in MockCloud constructor ctx := context.Background() node := &v1.Node{ ObjectMeta: metav1.ObjectMeta{Name: "foo"}, } cloud.VMSet.(*MockVMSet).EXPECT().GetInstanceIDByNodeName("foo").Return("", cloudprovider.InstanceNotFound) exist, err := cloud.InstanceExists(ctx, node) assert.False(t, exist) assert.NoError(t, err) }) t.Run("should not return error when instance not found by provider id", func(t *testing.T) { cloud := GetTestCloud(ctrl) cloud.VMSet = NewMockVMSet(ctrl) // FIXME(lodrem): implement MockCloud and init in MockCloud constructor ctx := context.Background() node := &v1.Node{ Spec: v1.NodeSpec{ProviderID: "azure:///subscriptions/subscription/resourceGroups/rg/providers/Microsoft.Compute/VirtualMachines/vm"}, } cloud.VMSet.(*MockVMSet).EXPECT().GetNodeNameByProviderID(node.Spec.ProviderID).Return(types.NodeName(""), cloudprovider.InstanceNotFound) exist, err := cloud.InstanceExists(ctx, node) assert.NoError(t, err) assert.False(t, exist) }) }
explode_data.jsonl/60302
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 473 }
[ 2830, 3393, 16055, 70849, 15575, 1155, 353, 8840, 836, 8, 341, 84381, 1669, 342, 316, 1176, 7121, 2051, 1155, 340, 16867, 23743, 991, 18176, 2822, 3244, 16708, 445, 5445, 537, 470, 1465, 979, 2867, 537, 1730, 553, 2436, 829, 497, 2915, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestErrors(t *testing.T) { _, storage, _, _, destroyFunc := newStorage(t) defer destroyFunc() err := storage.Allocate(net.ParseIP("192.168.0.0")) if _, ok := err.(*ipallocator.ErrNotInRange); !ok { t.Fatal(err) } }
explode_data.jsonl/353
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 100 }
[ 2830, 3393, 13877, 1155, 353, 8840, 836, 8, 341, 197, 6878, 5819, 11, 8358, 8358, 6921, 9626, 1669, 501, 5793, 1155, 340, 16867, 6921, 9626, 741, 9859, 1669, 5819, 9636, 22401, 30723, 8937, 3298, 445, 16, 24, 17, 13, 16, 21, 23, 13,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestRCSubQuery(t *testing.T) { store, clean := createMockStoreAndSetup(t) defer clean() tk := testkit.NewTestKit(t, store) tk2 := testkit.NewTestKit(t, store) tk.MustExec("use test") tk2.MustExec("use test") tk.MustExec("drop table if exists t, t1") tk.MustExec("create table `t` ( `c1` int(11) not null, `c2` int(11) default null, primary key (`c1`) )") tk.MustExec("insert into t values(1, 3)") tk.MustExec("create table `t1` ( `c1` int(11) not null, `c2` int(11) default null, primary key (`c1`) )") tk.MustExec("insert into t1 values(1, 3)") tk.MustExec("set transaction isolation level read committed") tk.MustExec("begin pessimistic") tk2.MustExec("update t1 set c2 = c2 + 1") tk.MustQuery("select * from t1 where c1 = (select 1) and 1=1;").Check(testkit.Rows("1 4")) tk.MustQuery("select * from t1 where c1 = (select c1 from t where c1 = 1) and 1=1;").Check(testkit.Rows("1 4")) tk.MustExec("rollback") }
explode_data.jsonl/12482
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 366 }
[ 2830, 3393, 7380, 3136, 2859, 1155, 353, 8840, 836, 8, 341, 57279, 11, 4240, 1669, 1855, 11571, 6093, 3036, 21821, 1155, 340, 16867, 4240, 2822, 3244, 74, 1669, 1273, 8226, 7121, 2271, 7695, 1155, 11, 3553, 340, 3244, 74, 17, 1669, 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 TestKeysCustomValidation(t *testing.T) { type LangCode string type Label map[LangCode]string type TestMapStructPtr struct { Label Label `validate:"dive,keys,lang_code,endkeys,required"` } validate := New() err := validate.RegisterValidation("lang_code", func(fl FieldLevel) bool { validLangCodes := map[LangCode]struct{}{ "en": {}, "es": {}, "pt": {}, } _, ok := validLangCodes[fl.Field().Interface().(LangCode)] return ok }) Equal(t, err, nil) label := Label{ "en": "Good morning!", "pt": "", "es": "¡Buenos días!", "xx": "Bad key", "xxx": "", } err = validate.Struct(TestMapStructPtr{label}) NotEqual(t, err, nil) errs := err.(ValidationErrors) Equal(t, len(errs), 4) AssertDeepError(t, errs, "TestMapStructPtr.Label[xx]", "TestMapStructPtr.Label[xx]", "Label[xx]", "Label[xx]", "lang_code", "lang_code") AssertDeepError(t, errs, "TestMapStructPtr.Label[pt]", "TestMapStructPtr.Label[pt]", "Label[pt]", "Label[pt]", "required", "required") AssertDeepError(t, errs, "TestMapStructPtr.Label[xxx]", "TestMapStructPtr.Label[xxx]", "Label[xxx]", "Label[xxx]", "lang_code", "lang_code") AssertDeepError(t, errs, "TestMapStructPtr.Label[xxx]", "TestMapStructPtr.Label[xxx]", "Label[xxx]", "Label[xxx]", "required", "required") // find specific error var e FieldError for _, e = range errs { if e.Namespace() == "TestMapStructPtr.Label[xxx]" { break } } Equal(t, e.Param(), "") Equal(t, e.Value().(LangCode), LangCode("xxx")) for _, e = range errs { if e.Namespace() == "TestMapStructPtr.Label[xxx]" && e.Tag() == "required" { break } } Equal(t, e.Param(), "") Equal(t, e.Value().(string), "") }
explode_data.jsonl/77361
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 695 }
[ 2830, 3393, 8850, 10268, 13799, 1155, 353, 8840, 836, 8, 341, 13158, 22463, 2078, 914, 198, 13158, 9402, 2415, 58, 26223, 2078, 30953, 271, 13158, 3393, 2227, 9422, 5348, 2036, 341, 197, 82126, 9402, 1565, 7067, 2974, 67, 533, 11, 10563...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_versionedClient(t *testing.T) { process := helperProcess("test-versioned-plugins") c := NewClient(&ClientConfig{ Cmd: process, HandshakeConfig: testVersionedHandshake, VersionedPlugins: map[int]PluginSet{ 2: testGRPCPluginMap, }, AllowedProtocols: []Protocol{ProtocolGRPC}, }) defer c.Kill() if _, err := c.Start(); err != nil { t.Fatalf("err: %s", err) } if v := c.Protocol(); v != ProtocolGRPC { t.Fatalf("bad: %s", v) } // Grab the RPC client client, err := c.Client() if err != nil { t.Fatalf("err should be nil, got %s", err) } if c.NegotiatedVersion() != 2 { t.Fatal("using incorrect version", c.NegotiatedVersion()) } // Grab the impl raw, err := client.Dispense("test") if err != nil { t.Fatalf("err should be nil, got %s", err) } _, ok := raw.(testInterface) if !ok { t.Fatalf("bad: %#v", raw) } c.process.Kill() select { case <-c.doneCtx.Done(): case <-time.After(time.Second * 2): t.Fatal("Context was not closed") } }
explode_data.jsonl/57859
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 420 }
[ 2830, 3393, 2959, 9438, 291, 2959, 1155, 353, 8840, 836, 8, 341, 53314, 1669, 13137, 7423, 445, 1944, 45367, 291, 83746, 1138, 1444, 1669, 1532, 2959, 2099, 2959, 2648, 515, 197, 6258, 2277, 25, 1797, 1882, 345, 197, 197, 2314, 29661, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestGetSenderAddCheckCustomTagsService(t *testing.T) { resetAggregator() InitAggregator(nil, "testhostname") senderMetricSampleChan := make(chan senderMetricSample, 10) serviceCheckChan := make(chan metrics.ServiceCheck, 10) eventChan := make(chan metrics.Event, 10) bucketChan := make(chan senderHistogramBucket, 10) orchestratorChan := make(chan senderOrchestratorMetadata, 10) checkSender := newCheckSender(checkID1, "", senderMetricSampleChan, serviceCheckChan, eventChan, bucketChan, orchestratorChan) // no custom tags checkSender.ServiceCheck("test", metrics.ServiceCheckOK, "testhostname", nil, "test message") sc := <-serviceCheckChan assert.Nil(t, sc.Tags) // only tags added by the check checkTags := []string{"check:tag1", "check:tag2"} checkSender.ServiceCheck("test", metrics.ServiceCheckOK, "testhostname", checkTags, "test message") sc = <-serviceCheckChan assert.Equal(t, checkTags, sc.Tags) // simulate tags in the configuration file customTags := []string{"custom:tag1", "custom:tag2"} checkSender.SetCheckCustomTags(customTags) assert.Len(t, checkSender.checkTags, 2) // only tags coming from the configuration file checkSender.ServiceCheck("test", metrics.ServiceCheckOK, "testhostname", nil, "test message") sc = <-serviceCheckChan assert.Equal(t, customTags, sc.Tags) // tags added by the check + tags coming from the configuration file checkSender.ServiceCheck("test", metrics.ServiceCheckOK, "testhostname", checkTags, "test message") sc = <-serviceCheckChan assert.Equal(t, append(checkTags, customTags...), sc.Tags) }
explode_data.jsonl/78303
{ "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, 1949, 20381, 2212, 3973, 10268, 15930, 1860, 1155, 353, 8840, 836, 8, 341, 70343, 9042, 58131, 741, 98762, 9042, 58131, 27907, 11, 330, 1944, 27806, 5130, 1903, 1659, 54310, 17571, 46019, 1669, 1281, 35190, 4646, 54310, 17571, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestBuiltinGlobals(t *testing.T) { f := newFrame(nil) f.globals = newTestDict("foo", 1, "bar", 2, 42, None) globals := mustNotRaise(Builtins.GetItemString(f, "globals")) got, raised := globals.Call(f, nil, nil) want := newTestDict("foo", 1, "bar", 2, 42, None).ToObject() switch checkResult(got, want, raised, nil) { case checkInvokeResultExceptionMismatch: t.Errorf("globals() = %v, want %v", got, want) case checkInvokeResultReturnValueMismatch: t.Errorf("globals() raised %v, want nil", raised) } }
explode_data.jsonl/53153
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 207 }
[ 2830, 3393, 33, 25628, 48592, 1155, 353, 8840, 836, 8, 341, 1166, 1669, 501, 4369, 27907, 340, 1166, 1302, 16616, 284, 501, 2271, 13448, 445, 7975, 497, 220, 16, 11, 330, 2257, 497, 220, 17, 11, 220, 19, 17, 11, 2240, 340, 3174, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestTriggerCallback(t *testing.T) { var timesOfChecksum int // init context ConfigContext.Set("p-group", &SchedulerConfig{Checksum: []byte("abc")}) SchedulerConfigLoader = func(policyGroup string) (config *SchedulerConfig, e error) { timesOfChecksum++ return &SchedulerConfig{Checksum: []byte("abc")}, nil } // the original Checksum cw := CreateConfigWatcher("rm-id", "p-group", 3*time.Second) reloader := &FakeConfigReloader{} cw.RegisterCallback(reloader) // verify initial fields are correct assert.Equal(t, cw.rmId, "rm-id") assert.Equal(t, cw.policyGroup, "p-group") assert.Assert(t, cw.reloader != nil) // only run once cw.runOnce() // verify version is not changed assert.Equal(t, timesOfChecksum, 1) assert.Equal(t, reloader.timesOfReload, 0) // simulate file state changes SchedulerConfigLoader = func(policyGroup string) (config *SchedulerConfig, e error) { timesOfChecksum++ return &SchedulerConfig{Checksum: []byte("bcd")}, nil } cw.runOnce() // verify when config state is changed, // callback is called and version is updated in config watcher assert.Equal(t, timesOfChecksum, 2) assert.Equal(t, reloader.timesOfReload, 1) }
explode_data.jsonl/26849
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 428 }
[ 2830, 3393, 17939, 7494, 1155, 353, 8840, 836, 8, 341, 2405, 3039, 2124, 73190, 526, 198, 197, 322, 2930, 2266, 198, 66156, 1972, 4202, 445, 79, 4351, 497, 609, 38878, 2648, 90, 73190, 25, 3056, 3782, 445, 13683, 899, 3518, 7568, 1522...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestFilterAlwaysTrue(t *testing.T) { in := make(chan Image, 1) filter := filterGenerator(func(Image) bool { return true }, false) out := filter(in) in <- Image{} _, ok := <-out if !ok { t.Fatal("Filter closed unexpectedly") } close(in) _, ok = <-out if ok { t.Error("Filter remains unexpectedly open") } }
explode_data.jsonl/46233
{ "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, 5632, 37095, 2514, 1155, 353, 8840, 836, 8, 341, 17430, 1669, 1281, 35190, 4654, 11, 220, 16, 340, 50108, 1669, 4051, 12561, 18552, 30122, 8, 1807, 314, 470, 830, 2470, 895, 340, 13967, 1669, 4051, 5900, 340, 17430, 9119, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestServerTLS(t *testing.T) { text := []byte("Make fasthttp great again") ln := fasthttputil.NewInmemoryListener() certFile := "./ssl-cert-snakeoil.pem" keyFile := "./ssl-cert-snakeoil.key" s := &Server{ Handler: func(ctx *RequestCtx) { ctx.Write(text) }, } err := s.AppendCert(certFile, keyFile) if err != nil { t.Fatal(err) } go func() { err = s.ServeTLS(ln, "", "") if err != nil { t.Fatal(err) } }() c := &Client{ ReadTimeout: time.Second * 2, Dial: func(addr string) (net.Conn, error) { return ln.Dial() }, TLSConfig: &tls.Config{ InsecureSkipVerify: true, }, } req, res := AcquireRequest(), AcquireResponse() req.SetRequestURI("https://some.url") err = c.Do(req, res) if err != nil { t.Fatal(err) } if !bytes.Equal(text, res.Body()) { t.Fatal("error transmitting information") } }
explode_data.jsonl/73275
{ "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, 5475, 45439, 1155, 353, 8840, 836, 8, 341, 15425, 1669, 3056, 3782, 445, 8078, 4937, 1254, 2244, 1549, 1138, 197, 2261, 1669, 4937, 96336, 628, 321, 7121, 641, 17269, 2743, 2822, 1444, 529, 1703, 1669, 5924, 24635, 61034, 75...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestV4DXYZ(t *testing.T) { ctx := assert.Context(t) for _, test := range []struct { v f32.Vec4 r f32.Vec3 }{ {f32.Vec4{0, 0, 0, 0}, f32.Vec3{0, 0, 0}}, {f32.Vec4{1, 2, 3, 4}, f32.Vec3{1, 2, 3}}, } { assert.For(ctx, "%v.V3D", test.v).That(test.v.XYZ()).Equals(test.r) } }
explode_data.jsonl/8031
{ "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, 53, 19, 35, 32196, 1155, 353, 8840, 836, 8, 341, 20985, 1669, 2060, 9328, 1155, 340, 2023, 8358, 1273, 1669, 2088, 3056, 1235, 341, 197, 5195, 282, 18, 17, 5058, 757, 19, 198, 197, 7000, 282, 18, 17, 5058, 757, 18, 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...
2
func TestBaseParam_Table(t *testing.T) { tests := []struct { name string b *BaseParam want Table }{ { name: "1", b: NewBaseParam(newMockTable(NewBaseTable("db", "schema", "table")), nil), want: newMockTable(NewBaseTable("db", "schema", "table")), }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { if got := tt.b.Table(); !reflect.DeepEqual(got, tt.want) { t.Errorf("BaseParam.Table() = %v, want %v", got, tt.want) } }) } }
explode_data.jsonl/20043
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 227 }
[ 2830, 3393, 3978, 2001, 42544, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 3056, 1235, 341, 197, 11609, 914, 198, 197, 2233, 262, 353, 3978, 2001, 198, 197, 50780, 6633, 198, 197, 59403, 197, 197, 515, 298, 11609, 25, 330, 16, 756, 2...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestGetWithLastModified(t *testing.T) { resetTest() req, err := http.NewRequest("GET", s.server.URL+"/lastmodified", nil) if err != nil { t.Fatal(err) } { resp, err := s.client.Do(req) if err != nil { t.Fatal(err) } defer resp.Body.Close() if resp.Header.Get(XFromCache) != "" { t.Fatal("XFromCache header isn't blank") } _, err = ioutil.ReadAll(resp.Body) if err != nil { t.Fatal(err) } } { resp, err := s.client.Do(req) if err != nil { t.Fatal(err) } defer resp.Body.Close() if resp.Header.Get(XFromCache) != "1" { t.Fatalf(`XFromCache header isn't "1": %v`, resp.Header.Get(XFromCache)) } } }
explode_data.jsonl/77620
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 312 }
[ 2830, 3393, 1949, 2354, 5842, 19148, 1155, 353, 8840, 836, 8, 341, 70343, 2271, 741, 24395, 11, 1848, 1669, 1758, 75274, 445, 3806, 497, 274, 12638, 20893, 27569, 4259, 27162, 497, 2092, 340, 743, 1848, 961, 2092, 341, 197, 3244, 26133,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
7
func TestKubectlDeployerRemoteCleanup(t *testing.T) { tests := []struct { description string kubectl latestV1.KubectlDeploy commands util.Command }{ { description: "cleanup success", kubectl: latestV1.KubectlDeploy{ RemoteManifests: []string{"pod/leeroy-web"}, }, commands: testutil. CmdRun("kubectl --context kubecontext --namespace testNamespace get pod/leeroy-web -o yaml"). AndRun("kubectl --context kubecontext --namespace testNamespace delete --ignore-not-found=true --wait=false -f -"). AndRunInput("kubectl --context kubecontext --namespace testNamespace apply -f -", DeploymentWebYAML), }, { description: "cleanup error", kubectl: latestV1.KubectlDeploy{ RemoteManifests: []string{"anotherNamespace:pod/leeroy-web"}, }, commands: testutil. CmdRun("kubectl --context kubecontext --namespace anotherNamespace get pod/leeroy-web -o yaml"). AndRun("kubectl --context kubecontext --namespace testNamespace delete --ignore-not-found=true --wait=false -f -"). AndRunInput("kubectl --context kubecontext --namespace anotherNamespace apply -f -", DeploymentWebYAML), }, } for _, test := range tests { testutil.Run(t, "cleanup remote", func(t *testutil.T) { t.Override(&util.DefaultExecCommand, test.commands) t.NewTempDir(). Write("deployment.yaml", DeploymentWebYAML). Chdir() k, err := NewDeployer(&kubectlConfig{ workingDir: ".", RunContext: runcontext.RunContext{Opts: config.SkaffoldOptions{Namespace: TestNamespace}}, }, &label.DefaultLabeller{}, &test.kubectl) t.RequireNoError(err) err = k.Cleanup(context.Background(), ioutil.Discard) t.CheckNoError(err) }) } }
explode_data.jsonl/52876
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 686 }
[ 2830, 3393, 42, 53380, 69464, 261, 24703, 67335, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 3056, 1235, 341, 197, 42407, 914, 198, 197, 16463, 53380, 257, 5535, 53, 16, 11352, 53380, 69464, 198, 197, 197, 24270, 262, 4094, 12714, 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 TestPeerWithSubstitutedConfig_WithMultipleMatchings(t *testing.T) { _, fetchedConfig := testCommonConfigPeer(t, "peer0.org2.example.com", "peer2.example2.com:1234") //Both 2nd and 5th entityMatchers match, however we are only taking 2nd one as its the first one to match if fetchedConfig.URL == "peer0.org2.example.com:7051" { t.Fatal("fetched Config url should be matched with the first suitable matcher") } if fetchedConfig.GRPCOptions["ssl-target-name-override"] != "localhost" { t.Fatal("Fetched config should have the ssl-target-name-override as per first suitable matcher in yaml file") } }
explode_data.jsonl/34084
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 204 }
[ 2830, 3393, 30888, 2354, 3136, 3696, 2774, 2648, 62, 2354, 32089, 8331, 819, 1155, 353, 8840, 836, 8, 341, 197, 6878, 41442, 2648, 1669, 1273, 10839, 2648, 30888, 1155, 11, 330, 16537, 15, 2659, 17, 7724, 905, 497, 330, 16537, 17, 772...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestSnapshotAbort(t *testing.T) { storage := NewMemoryStorage() sm := newTestRaft(1, []uint64{1, 2}, 10, 1, storage) sm.restore(testingSnap) sm.becomeCandidate() sm.becomeLeader() sm.prs[2].Next = 1 sm.prs[2].becomeSnapshot(11) // A successful msgAppResp that has a higher/equal index than the // pending snapshot should abort the pending snapshot. sm.Step(pb.Message{From: 2, To: 1, Type: pb.MsgAppResp, Index: 11}) if sm.prs[2].PendingSnapshot != 0 { t.Fatalf("PendingSnapshot = %d, want 0", sm.prs[2].PendingSnapshot) } if sm.prs[2].Next != 12 { t.Fatalf("Next = %d, want 12", sm.prs[2].Next) } }
explode_data.jsonl/12911
{ "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, 15009, 85891, 1155, 353, 8840, 836, 8, 341, 197, 16172, 1669, 1532, 10642, 5793, 741, 72023, 1669, 501, 2271, 55535, 723, 7, 16, 11, 3056, 2496, 21, 19, 90, 16, 11, 220, 17, 2137, 220, 16, 15, 11, 220, 16, 11, 5819, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestUpdateL7PolicyNullRedirectURL(t *testing.T) { th.SetupHTTP() defer th.TeardownHTTP() HandleL7PolicyUpdateNullRedirectURLSuccessfully(t) client := fake.ServiceClient() newName := "NewL7PolicyName" redirectURL := "" actual, err := l7policies.Update(client, "8a1412f0-4c32-4257-8b07-af4770b604fd", l7policies.UpdateOpts{ Name: &newName, RedirectURL: &redirectURL, }).Extract() if err != nil { t.Fatalf("Unexpected Update error: %v", err) } th.CheckDeepEquals(t, L7PolicyNullRedirectURLUpdated, *actual) }
explode_data.jsonl/79638
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 226 }
[ 2830, 3393, 4289, 43, 22, 13825, 3280, 17725, 3144, 1155, 353, 8840, 836, 8, 341, 70479, 39820, 9230, 741, 16867, 270, 94849, 37496, 9230, 741, 197, 6999, 43, 22, 13825, 4289, 3280, 17725, 3144, 35959, 1155, 692, 25291, 1669, 12418, 138...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestEmptyApp(t *testing.T) { imj := ` { "acKind": "ImageManifest", "acVersion": "0.8.10", "name": "example.com/test" } ` var im ImageManifest err := im.UnmarshalJSON([]byte(imj)) if err != nil { t.Errorf("unexpected error: %v", err) } // Marshal and Unmarshal to verify that no "app": {} is generated on // Marshal and converted to empty struct on Unmarshal buf, err := im.MarshalJSON() if err != nil { t.Errorf("unexpected error: %v", err) } err = im.UnmarshalJSON(buf) if err != nil { t.Errorf("unexpected error: %v", err) } }
explode_data.jsonl/74171
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 246 }
[ 2830, 3393, 3522, 2164, 1155, 353, 8840, 836, 8, 341, 54892, 73, 1669, 22074, 197, 197, 515, 6449, 330, 580, 10629, 788, 330, 1906, 38495, 756, 6449, 330, 580, 5637, 788, 330, 15, 13, 23, 13, 16, 15, 756, 6449, 330, 606, 788, 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 TestConfigureSecurityGroupsMixed(t *testing.T) { groups := []string{"existingGroup", "newGroup"} recorder := fakeEC2SecurityGroupTestRecorder{} // First, a check is made for which groups already exist. initialLookupResult := ec2.DescribeSecurityGroupsOutput{SecurityGroups: []*ec2.SecurityGroup{ { GroupName: aws.String("existingGroup"), GroupId: aws.String("existingGroupId"), IpPermissions: []*ec2.IpPermission{ipPermission(testSSHPort)}, }, }} recorder.On("DescribeSecurityGroups", mock.MatchedBy(matchGroupLookup(groups))).Return( &initialLookupResult, nil) // An ingress permission is added to the existing group. recorder.On("AuthorizeSecurityGroupIngress", &ec2.AuthorizeSecurityGroupIngressInput{ GroupId: aws.String("existingGroupId"), IpPermissions: []*ec2.IpPermission{ipPermission(testDockerPort)}, }).Return( &ec2.AuthorizeSecurityGroupIngressOutput{}, nil) // The new security group is created. recorder.On("CreateSecurityGroup", &ec2.CreateSecurityGroupInput{ GroupName: aws.String("newGroup"), Description: aws.String("Rancher Nodes"), VpcId: aws.String(""), }).Return( &ec2.CreateSecurityGroupOutput{GroupId: aws.String("newGroupId")}, nil) // Ensuring the new security group exists. postCreateLookupResult := ec2.DescribeSecurityGroupsOutput{SecurityGroups: []*ec2.SecurityGroup{ { GroupName: aws.String("newGroup"), GroupId: aws.String("newGroupId"), }, }} recorder.On("DescribeSecurityGroups", &ec2.DescribeSecurityGroupsInput{GroupIds: []*string{aws.String("newGroupId")}}).Return( &postCreateLookupResult, nil) // Permissions are added to the new security group. recorder.On("AuthorizeSecurityGroupIngress", &ec2.AuthorizeSecurityGroupIngressInput{ GroupId: aws.String("newGroupId"), IpPermissions: []*ec2.IpPermission{ipPermission(testSSHPort), ipPermission(testDockerPort)}, }).Return( &ec2.AuthorizeSecurityGroupIngressOutput{}, nil) recorder.On("CreateTags", &ec2.CreateTagsInput{ Tags: []*ec2.Tag{ { Key: aws.String(machineTag), Value: aws.String(version.Version), }, }, Resources: []*string{aws.String("newGroupId")}, }).Return(&ec2.CreateTagsOutput{}, nil) driver := NewCustomTestDriver(&recorder) err := driver.configureSecurityGroups(groups) assert.Nil(t, err) recorder.AssertExpectations(t) }
explode_data.jsonl/7425
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 866 }
[ 2830, 3393, 28560, 15352, 22173, 86433, 1155, 353, 8840, 836, 8, 341, 44260, 82, 1669, 3056, 917, 4913, 36895, 2808, 497, 330, 931, 2808, 16707, 67904, 1358, 1669, 12418, 7498, 17, 15352, 2808, 2271, 47023, 31483, 197, 322, 5512, 11, 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...
1
func TestImmediateAnalytics(t *testing.T) { jwtClaims := &structpb.Struct{} headers := map[string]string{ "User-Agent": "User-Agent", "X-Forwarded-For": "X-Forwarded-For", headerAPI: "api", } requestPath := "path" uri := requestPath + "?x-api-key=foo" requestTime := time.Now() nowProto := timestamppb.New(requestTime) req := testutil.NewEnvoyRequest(http.MethodGet, uri, headers, map[string]*structpb.Struct{ jwtFilterMetadataKey: jwtClaims, }) req.Attributes.Request.Time = nowProto testAuthMan := &testAuthMan{} ac := &auth.Context{ ClientID: "client id", AccessToken: "token", Application: "app", APIProducts: []string{"product1"}, DeveloperEmail: "email", Scopes: []string{"scope"}, APIKey: "apikey", } testAuthMan.sendAuth(ac, auth.ErrBadAuth) testProductMan := &testProductMan{ resolve: true, api: "api", } testQuotaMan := &testQuotaMan{} testAnalyticsMan := &testAnalyticsMan{} server := AuthorizationServer{ handler: &Handler{ orgName: "org", envName: "env", apiKeyClaim: headerClientID, apiHeader: headerAPI, apiKeyHeader: "x-api-key", authMan: testAuthMan, productMan: testProductMan, quotaMan: testQuotaMan, analyticsMan: testAnalyticsMan, jwtProviderKey: "apigee", appendMetadataHeaders: true, ready: util.NewAtomicBool(true), }, gatewaySource: managedGatewaySource, } var resp *authv3.CheckResponse resp, err := server.Check(context.Background(), req) if err != nil { t.Errorf("should not get error. got: %s", err) } if resp.Status.Code != int32(rpc.PERMISSION_DENIED) { t.Errorf("got: %d, want: %d", resp.Status.Code, int32(rpc.PERMISSION_DENIED)) } if len(testAnalyticsMan.records) != 1 { t.Fatalf("got: %d, want: %d", len(testAnalyticsMan.records), 1) } if hasHeaderAdd(resp.GetDeniedResponse().GetHeaders(), headerFaultFlag, "true", false) { t.Errorf("unexpected response header add: %q", headerFaultFlag) } got := testAnalyticsMan.records[0] want := analytics.Record{ ClientReceivedStartTimestamp: requestTime.UnixNano() / 1000000, ClientReceivedEndTimestamp: requestTime.UnixNano() / 1000000, TargetSentStartTimestamp: 0, TargetSentEndTimestamp: 0, TargetReceivedStartTimestamp: 0, TargetReceivedEndTimestamp: 0, RecordType: "APIAnalytics", APIProxy: headers[headerAPI], RequestURI: uri, RequestPath: requestPath, RequestVerb: http.MethodGet, ClientIP: headers["X-Forwarded-For"], UserAgent: headers["User-Agent"], APIProxyRevision: 0, ResponseStatusCode: http.StatusForbidden, DeveloperEmail: ac.DeveloperEmail, DeveloperApp: ac.Application, AccessToken: ac.AccessToken, ClientID: ac.ClientID, APIProduct: ac.APIProducts[0], Organization: server.handler.orgName, Environment: server.handler.envName, GatewaySource: managedGatewaySource, // the following fields vary, ignore them ClientSentStartTimestamp: got.ClientSentStartTimestamp, ClientSentEndTimestamp: got.ClientSentEndTimestamp, GatewayFlowID: got.GatewayFlowID, } if got.ClientSentStartTimestamp < requestTime.Unix() { t.Errorf("got: %d, want >=: %d", got.ClientSentStartTimestamp, requestTime.Unix()) } if got.ClientSentEndTimestamp < got.ClientSentStartTimestamp { t.Errorf("got: %d, want >=: %d", got.ClientSentEndTimestamp, got.ClientSentStartTimestamp) } if got.GatewayFlowID == "" { t.Errorf("GatewayFlowID should not be empty") } if !reflect.DeepEqual(got, want) { t.Errorf("got: %#v, want: %#v", got, want) } }
explode_data.jsonl/73193
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1819 }
[ 2830, 3393, 52734, 60539, 1155, 353, 8840, 836, 8, 1476, 12428, 9306, 51133, 1669, 609, 1235, 16650, 51445, 31483, 67378, 1669, 2415, 14032, 30953, 515, 197, 197, 1, 1474, 45118, 788, 414, 330, 1474, 45118, 756, 197, 197, 1, 55, 12, 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...
9
func TestGenModel_XMLStructTags_Explicit(t *testing.T) { specDoc, err := loads.Spec("../fixtures/codegen/xml-model.yml") require.NoError(t, err) definitions := specDoc.Spec().Definitions k := "XmlWithAttribute" 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("xml_with_attribute.go", buf.Bytes()) require.NoErrorf(t, err, "format error: %v\n%s", err, buf.String()) res := string(ct) assertInCode(t, "Author *string `json:\"author\"`", res) assertInCode(t, "Children []*XMLChild `json:\"children\"`", res) assertInCode(t, "ID int64 `json:\"id,omitempty\" xml:\"id,attr,omitempty\"`", res) assertInCode(t, "IsPublished *bool `json:\"isPublished\" xml:\"published,attr\"`", res) assertInCode(t, "SingleChild *XMLChild `json:\"singleChild,omitempty\"`", res) assertInCode(t, "Title string `json:\"title,omitempty\" xml:\"xml-title,omitempty\"`", res) }
explode_data.jsonl/2576
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 410 }
[ 2830, 3393, 9967, 1712, 45617, 9422, 15930, 62, 98923, 1155, 353, 8840, 836, 8, 341, 98100, 9550, 11, 1848, 1669, 20907, 36473, 17409, 45247, 46928, 4370, 36524, 28244, 33936, 1138, 17957, 35699, 1155, 11, 1848, 692, 7452, 4054, 82, 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 TestReconcileExternalRemediationTemplate(t *testing.T) { ctx := context.Background() nodeHealthy := maotesting.NewNode("NodeHealthy", true) machineWithNodeHealthy := maotesting.NewMachine("Machine", nodeHealthy.Name) nodeUnHealthy := maotesting.NewNode("NodeUnhealthy", false) machineWithNodeUnHealthy := maotesting.NewMachine("Machine", nodeUnHealthy.Name) machineWithNodeUnHealthy.APIVersion = mapiv1beta1.SchemeGroupVersion.String() //external remediation machine template crd ermTemplate := maotesting.NewExternalRemediationTemplate() mhcWithRemediationTemplate := newMachineHealthCheckWithRemediationTemplate(ermTemplate) erm := maotesting.NewExternalRemediationMachine() testCases := []testCase{ { //When remediationTemplate is set and node transitions back to healthy, new Remediation Request should be deleted name: "external remediation is done", machine: machineWithNodeHealthy, node: nodeHealthy, mhc: mhcWithRemediationTemplate, externalRemediationMachine: erm, externalRemediationTemplate: ermTemplate, expected: expectedReconcile{ result: reconcile.Result{}, error: false, }, expectedEvents: []string{}, expectedStatus: &mapiv1beta1.MachineHealthCheckStatus{ ExpectedMachines: IntPtr(1), CurrentHealthy: IntPtr(1), RemediationsAllowed: 1, Conditions: mapiv1beta1.Conditions{ remediationAllowedCondition, }, }, }, { //When remediationTemplate is set and node transitions to unhealthy, new Remediation Request should be created name: "create new external remediation", machine: machineWithNodeUnHealthy, node: nodeUnHealthy, mhc: mhcWithRemediationTemplate, externalRemediationMachine: nil, externalRemediationTemplate: ermTemplate, expected: expectedReconcile{ result: reconcile.Result{}, error: false, }, expectedEvents: []string{}, expectedStatus: &mapiv1beta1.MachineHealthCheckStatus{ ExpectedMachines: IntPtr(1), CurrentHealthy: IntPtr(0), RemediationsAllowed: 0, Conditions: mapiv1beta1.Conditions{ remediationAllowedCondition, }, }, }, { //When remediationTemplate is set and node transitions to unhealthy, and a a Remediation Request already exist name: "external remediation is in process", machine: machineWithNodeUnHealthy, node: nodeUnHealthy, mhc: mhcWithRemediationTemplate, externalRemediationMachine: erm, externalRemediationTemplate: ermTemplate, expected: expectedReconcile{ result: reconcile.Result{}, error: false, }, expectedEvents: []string{}, expectedStatus: &mapiv1beta1.MachineHealthCheckStatus{ ExpectedMachines: IntPtr(1), CurrentHealthy: IntPtr(0), RemediationsAllowed: 0, Conditions: mapiv1beta1.Conditions{ remediationAllowedCondition, }, }, }, } for _, tc := range testCases { t.Run(tc.name, func(t *testing.T) { recorder := record.NewFakeRecorder(2) r := newFakeReconcilerWithCustomRecorder(recorder, buildRunTimeObjects(tc)...) assertBaseReconcile(t, tc, ctx, r) assertExternalRemediation(t, tc, ctx, r) }) } }
explode_data.jsonl/31391
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1426 }
[ 2830, 3393, 693, 40446, 457, 25913, 6590, 291, 7101, 7275, 1155, 353, 8840, 836, 8, 341, 20985, 1669, 2266, 19047, 2822, 20831, 96113, 1669, 7491, 354, 59855, 7121, 1955, 445, 1955, 96113, 497, 830, 340, 2109, 3814, 2354, 1955, 96113, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestColorCoverage(t *testing.T) { assert := assert.New(t) assert.Equal("\x1b[32m90.00\x1b[0m", colorCoverage(90)) assert.Equal("\x1b[33m75.00\x1b[0m", colorCoverage(75)) assert.Equal("\x1b[31m30.00\x1b[0m", colorCoverage(30)) assert.Equal("\x1b[90m0.00\x1b[0m", colorCoverage(0)) }
explode_data.jsonl/60259
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 149 }
[ 2830, 3393, 1636, 66312, 1155, 353, 8840, 836, 8, 341, 6948, 1669, 2060, 7121, 1155, 692, 6948, 12808, 4921, 87, 16, 65, 58, 18, 17, 76, 24, 15, 13, 15, 15, 3462, 16, 65, 58, 15, 76, 497, 1894, 66312, 7, 24, 15, 1171, 6948, 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 TestWriterPoolBasic(t *testing.T) { size := 1024 wp := newWriterPool(size) span := constructWriterPoolSpan() w := wp.borrow() assert.NotNil(t, w) assert.NotNil(t, w.buffer) assert.NotNil(t, w.encoder) assert.Equal(t, size, w.buffer.Cap()) assert.Equal(t, 0, w.buffer.Len()) resource := pcommon.NewResource() segment, _ := MakeSegment(span, resource, nil, false) if err := w.Encode(*segment); err != nil { assert.Fail(t, "invalid json") } jsonStr := w.String() assert.Equal(t, len(jsonStr), w.buffer.Len()) wp.release(w) }
explode_data.jsonl/72725
{ "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, 6492, 10551, 15944, 1155, 353, 8840, 836, 8, 341, 13832, 1669, 220, 16, 15, 17, 19, 198, 31595, 1669, 501, 6492, 10551, 6856, 340, 197, 1480, 1669, 9245, 6492, 10551, 12485, 741, 6692, 1669, 12609, 83640, 741, 6948, 93882, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2