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 TestWrappedErrors(t *testing.T) { t.Parallel() tests := []struct { err error is func(error) bool msg string }{ {err: retry.AbortedRetries(errors.New(`unable to continue`)), is: retry.HasAborted, msg: `Checks to see if an abort error correctly validates`}, {err: retry.ExceededRetries(errors.New(`too many attempts`)), is: retry.HasExceeded, msg: `Checks to see if an exceeded error correctly validates`}, {err: retry.AbortedRetries(errors.New(`doom`)), is: func(err error) bool { return !retry.HasExceeded(err) }, msg: `Ensures an abort error can not validate as exceeded error`}, {err: retry.ExceededRetries(errors.New(`too many attempts`)), is: func(err error) bool { return !retry.HasAborted(err) }, msg: `Ensures an exceeded error can not validate as an abort error`}, {err: nil, is: func(err error) bool { return !retry.HasAborted(err) }, msg: `Ensure that nil does not resolve as an abort`}, {err: nil, is: func(err error) bool { return !retry.HasExceeded(err) }, msg: `Ensure that nil does not resolve as an exceeded`}, } for _, test := range tests { assert.True(t, test.is(test.err), test.msg) } }
explode_data.jsonl/30062
{ "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, 67795, 13877, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 2822, 78216, 1669, 3056, 1235, 341, 197, 9859, 1465, 198, 197, 19907, 220, 2915, 6390, 8, 1807, 198, 197, 21169, 914, 198, 197, 59403, 197, 197, 90, 615, 25, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestDeleteImages(t *testing.T) { tests := map[string]struct { client docker.Docker wantErrorCount int }{ "simple": { client: FakeDockerClient{ deleteFails: false, }, wantErrorCount: 0, }, "fail": { client: FakeDockerClient{ deleteFails: true, }, wantErrorCount: 1, }, } for name, tc := range tests { t.Run(name, func(t *testing.T) { imgClient := ImageClient{ dockerClient: tc.client, } got := imgClient.DeleteImages(imgs, 0) if len(got) != tc.wantErrorCount { t.Fatalf("Expected errors: %d but got %d", tc.wantErrorCount, len(got)) } }) } }
explode_data.jsonl/61549
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 280 }
[ 2830, 3393, 6435, 14228, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 2415, 14032, 60, 1235, 341, 197, 25291, 260, 26588, 909, 13659, 198, 197, 50780, 1454, 2507, 526, 198, 197, 59403, 197, 197, 1, 22944, 788, 341, 298, 25291, 25, 36965...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestFilter(t *testing.T) { items := []int{23, 24, 2, 5, 10} interfaceItems := make([]interface{}, len(items)) for i, v := range items { interfaceItems[i] = v } a := New(interfaceItems) evenArray := a.Filter(isEven) if evenArray.Length() != 3 { t.Log("Filtered array should only contain even items") t.Log("Expected", 3, "\n Got", evenArray.Length()) t.Fail() } }
explode_data.jsonl/47093
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 148 }
[ 2830, 3393, 5632, 1155, 353, 8840, 836, 8, 341, 46413, 1669, 3056, 396, 90, 17, 18, 11, 220, 17, 19, 11, 220, 17, 11, 220, 20, 11, 220, 16, 15, 532, 58915, 1564, 4353, 1669, 1281, 10556, 4970, 22655, 2422, 24337, 4390, 2023, 600, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestPropagateTxnOnError(t *testing.T) { defer leaktest.AfterTest(t)() // Inject these two observed timestamps into the parts of the batch's // response that does not result in an error. Even though the batch as a // whole results in an error, the transaction should still propagate this // information. ot1 := roachpb.ObservedTimestamp{NodeID: 7, Timestamp: hlc.Timestamp{WallTime: 15}} ot2 := roachpb.ObservedTimestamp{NodeID: 8, Timestamp: hlc.Timestamp{WallTime: 16}} containsObservedTSs := func(txn *roachpb.Transaction) bool { contains := func(ot roachpb.ObservedTimestamp) bool { for _, ts := range txn.ObservedTimestamps { if ts.Equal(ot) { return true } } return false } return contains(ot1) && contains(ot2) } // Set up a filter to so that the first CPut operation will // get a ReadWithinUncertaintyIntervalError and so that the // Put operations on either side of the CPut will each return // with the new observed timestamp. keyA, keyB, keyC := roachpb.Key("a"), roachpb.Key("b"), roachpb.Key("c") var numCPuts int32 var storeKnobs storage.StoreTestingKnobs storeKnobs.EvalKnobs.TestingEvalFilter = func(fArgs storagebase.FilterArgs) *roachpb.Error { k := fArgs.Req.Header().Key switch fArgs.Req.(type) { case *roachpb.PutRequest: if k.Equal(keyA) { fArgs.Hdr.Txn.UpdateObservedTimestamp(ot1.NodeID, ot1.Timestamp) } else if k.Equal(keyC) { fArgs.Hdr.Txn.UpdateObservedTimestamp(ot2.NodeID, ot2.Timestamp) } case *roachpb.ConditionalPutRequest: if k.Equal(keyB) { if atomic.AddInt32(&numCPuts, 1) == 1 { pErr := roachpb.NewReadWithinUncertaintyIntervalError(hlc.Timestamp{}, hlc.Timestamp{}, nil) return roachpb.NewErrorWithTxn(pErr, fArgs.Hdr.Txn) } } } return nil } // Don't clobber the test's splits. storeKnobs.DisableMergeQueue = true s, _, _ := serverutils.StartServer(t, base.TestServerArgs{Knobs: base.TestingKnobs{Store: &storeKnobs}}) ctx := context.TODO() defer s.Stopper().Stop(ctx) db := s.DB() if err := setupMultipleRanges(ctx, db, "b", "c"); err != nil { t.Fatal(err) } // Set the initial value on the target key "b". origVal := "val" if err := db.Put(ctx, keyB, origVal); err != nil { t.Fatal(err) } // The following txn creates a batch request that is split into three // requests: Put, CPut, and Put. The CPut operation will get a // ReadWithinUncertaintyIntervalError and the txn will be retried. epoch := 0 if err := db.Txn(ctx, func(ctx context.Context, txn *client.Txn) error { // Observe the commit timestamp to prevent refreshes. _ = txn.CommitTimestamp() epoch++ proto := txn.Serialize() if epoch >= 2 { // ObservedTimestamps must contain the timestamp returned from the // Put operation. if !containsObservedTSs(proto) { t.Errorf("expected observed timestamp, found: %v", proto.ObservedTimestamps) } } else { // ObservedTimestamps must not contain the timestamp returned from // the Put operation. if containsObservedTSs(proto) { t.Errorf("unexpected observed timestamp, found: %v", proto.ObservedTimestamps) } } b := txn.NewBatch() b.Put(keyA, "val") b.CPut(keyB, "new_val", origVal) b.Put(keyC, "val2") err := txn.CommitInBatch(ctx, b) if epoch == 1 { if retErr, ok := err.(*roachpb.TransactionRetryWithProtoRefreshError); ok { if !testutils.IsError(retErr, "ReadWithinUncertaintyIntervalError") { t.Errorf("expected ReadWithinUncertaintyIntervalError, but got: %v", retErr) } } else { t.Errorf("expected a retryable error, but got: %v", err) } } return err }); err != nil { t.Errorf("unexpected error on transactional Puts: %s", err) } if epoch != 2 { t.Errorf("unexpected epoch; the txn must be retried exactly once, but got %d", epoch) } }
explode_data.jsonl/36468
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1506 }
[ 2830, 3393, 2008, 46836, 31584, 77, 74945, 1155, 353, 8840, 836, 8, 341, 16867, 23352, 1944, 36892, 2271, 1155, 8, 2822, 197, 322, 21843, 1493, 1378, 13166, 48781, 1119, 279, 5479, 315, 279, 7162, 594, 198, 197, 322, 2033, 429, 1558, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestMetrics(t *testing.T) { for _, testCase := range []struct { name string runTest func(node1, node2 *clusterNode, testMetrics *testMetrics) testMetrics *testMetrics }{ { name: "EgressQueueOccupancy", runTest: func(node1, node2 *clusterNode, testMetrics *testMetrics) { assertBiDiCommunication(t, node1, node2, testReq) assert.Equal(t, []string{"host", node2.nodeInfo.Endpoint, "msg_type", "transaction", "channel", testChannel}, testMetrics.egressQueueLength.WithArgsForCall(0)) assert.Equal(t, float64(0), testMetrics.egressQueueLength.SetArgsForCall(0)) assert.Equal(t, float64(1), testMetrics.egressQueueCapacity.SetArgsForCall(0)) var messageReceived sync.WaitGroup messageReceived.Add(1) node2.handler.On("OnConsensus", testChannel, node1.nodeInfo.ID, mock.Anything).Run(func(args mock.Arguments) { messageReceived.Done() }).Return(nil) rm, err := node1.c.Remote(testChannel, node2.nodeInfo.ID) assert.NoError(t, err) stream := assertEventualEstablishStream(t, rm) stream.Send(testConsensusReq) messageReceived.Wait() assert.Equal(t, []string{"host", node2.nodeInfo.Endpoint, "msg_type", "consensus", "channel", testChannel}, testMetrics.egressQueueLength.WithArgsForCall(1)) assert.Equal(t, float64(0), testMetrics.egressQueueLength.SetArgsForCall(1)) assert.Equal(t, float64(1), testMetrics.egressQueueCapacity.SetArgsForCall(1)) }, }, { name: "EgressStreamsCount", runTest: func(node1, node2 *clusterNode, testMetrics *testMetrics) { assertBiDiCommunication(t, node1, node2, testReq) assert.Equal(t, 1, testMetrics.egressStreamCount.SetCallCount()) assert.Equal(t, 1, testMetrics.egressStreamCount.WithCallCount()) assert.Equal(t, []string{"channel", testChannel}, testMetrics.egressStreamCount.WithArgsForCall(0)) assertBiDiCommunicationForChannel(t, node1, node2, testReq2, testChannel2) assert.Equal(t, 2, testMetrics.egressStreamCount.SetCallCount()) assert.Equal(t, 2, testMetrics.egressStreamCount.WithCallCount()) assert.Equal(t, []string{"channel", testChannel2}, testMetrics.egressStreamCount.WithArgsForCall(1)) }, }, { name: "EgressTLSConnCount", runTest: func(node1, node2 *clusterNode, testMetrics *testMetrics) { assertBiDiCommunication(t, node1, node2, testReq) assert.Equal(t, []string{"channel", testChannel}, testMetrics.egressStreamCount.WithArgsForCall(0)) assertBiDiCommunicationForChannel(t, node1, node2, testReq2, testChannel2) assert.Equal(t, []string{"channel", testChannel2}, testMetrics.egressStreamCount.WithArgsForCall(1)) // A single TLS connection despite 2 streams assert.Equal(t, float64(1), testMetrics.egressTLSConnCount.SetArgsForCall(0)) assert.Equal(t, 1, testMetrics.egressTLSConnCount.SetCallCount()) }, }, { name: "EgressWorkerSize", runTest: func(node1, node2 *clusterNode, testMetrics *testMetrics) { assertBiDiCommunication(t, node1, node2, testReq) assert.Equal(t, []string{"channel", testChannel}, testMetrics.egressStreamCount.WithArgsForCall(0)) assertBiDiCommunicationForChannel(t, node1, node2, testReq2, testChannel2) assert.Equal(t, []string{"channel", testChannel2}, testMetrics.egressStreamCount.WithArgsForCall(1)) assert.Equal(t, float64(1), testMetrics.egressWorkerSize.SetArgsForCall(0)) assert.Equal(t, float64(1), testMetrics.egressWorkerSize.SetArgsForCall(1)) }, }, { name: "MgSendTime", runTest: func(node1, node2 *clusterNode, testMetrics *testMetrics) { assertBiDiCommunication(t, node1, node2, testReq) assert.Equal(t, []string{"host", node2.nodeInfo.Endpoint, "channel", testChannel}, testMetrics.msgSendTime.WithArgsForCall(0)) assert.Equal(t, 1, testMetrics.msgSendTime.ObserveCallCount()) }, }, { name: "MsgDropCount", runTest: func(node1, node2 *clusterNode, testMetrics *testMetrics) { blockRecv := make(chan struct{}) wasReported := func() bool { select { case <-blockRecv: return true default: return false } } // When the drop count is reported, release the lock on the server side receive operation. testMetrics.msgDropCount.AddStub = func(float642 float64) { if !wasReported() { close(blockRecv) } } node2.handler.On("OnConsensus", testChannel, node1.nodeInfo.ID, mock.Anything).Run(func(args mock.Arguments) { // Block until the message drop is reported <-blockRecv }).Return(nil) rm, err := node1.c.Remote(testChannel, node2.nodeInfo.ID) assert.NoError(t, err) stream := assertEventualEstablishStream(t, rm) // Send too many messages while the server side is not reading from the stream for { stream.Send(testConsensusReq) if wasReported() { break } } assert.Equal(t, []string{"host", node2.nodeInfo.Endpoint, "channel", testChannel}, testMetrics.msgDropCount.WithArgsForCall(0)) assert.Equal(t, 1, testMetrics.msgDropCount.AddCallCount()) }, }, } { testCase := testCase t.Run(testCase.name, func(t *testing.T) { fakeProvider := &mocks.MetricsProvider{} testCase.testMetrics = &testMetrics{ fakeProvider: fakeProvider, } testCase.testMetrics.initialize() node1 := newTestNodeWithMetrics(t, fakeProvider, &testCase.testMetrics.egressTLSConnCount) defer node1.stop() node2 := newTestNode(t) defer node2.stop() configForNode1 := []cluster.RemoteNode{node2.nodeInfo} configForNode2 := []cluster.RemoteNode{node1.nodeInfo} node1.c.Configure(testChannel, configForNode1) node2.c.Configure(testChannel, configForNode2) node1.c.Configure(testChannel2, configForNode1) node2.c.Configure(testChannel2, configForNode2) testCase.runTest(node1, node2, testCase.testMetrics) }) } }
explode_data.jsonl/39845
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 2381 }
[ 2830, 3393, 27328, 1155, 353, 8840, 836, 8, 341, 2023, 8358, 54452, 1669, 2088, 3056, 1235, 341, 197, 11609, 286, 914, 198, 197, 56742, 2271, 257, 2915, 6958, 16, 11, 2436, 17, 353, 18855, 1955, 11, 1273, 27328, 353, 1944, 27328, 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 TestNaive(t *testing.T) { if runtime.GOOS == "windows" { t.Skip("snapshotter not implemented on windows") } testutil.RequiresRoot(t) testsuite.SnapshotterSuite(t, "Naive", newSnapshotter) }
explode_data.jsonl/68094
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 77 }
[ 2830, 3393, 16193, 533, 1155, 353, 8840, 836, 8, 341, 743, 15592, 97574, 3126, 621, 330, 27077, 1, 341, 197, 3244, 57776, 445, 35501, 465, 537, 11537, 389, 11030, 1138, 197, 532, 18185, 1314, 85012, 8439, 1155, 340, 18185, 49992, 808, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestIssue28804(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 perf_offline_day;") tk.MustExec(`CREATE TABLE perf_offline_day ( uuid varchar(50), ts timestamp NOT NULL, user_id varchar(50) COLLATE utf8mb4_general_ci DEFAULT NULL, platform varchar(50) COLLATE utf8mb4_general_ci DEFAULT NULL, host_id bigint(20) DEFAULT NULL, PRIMARY KEY (uuid,ts) /*T![clustered_index] NONCLUSTERED */ ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci PARTITION BY RANGE ( UNIX_TIMESTAMP(ts) ) ( PARTITION p20210906 VALUES LESS THAN (1630944000), PARTITION p20210907 VALUES LESS THAN (1631030400), PARTITION p20210908 VALUES LESS THAN (1631116800), PARTITION p20210909 VALUES LESS THAN (1631203200) );`) tk.MustExec("set @@tidb_partition_prune_mode = 'static'") tk.MustExec("INSERT INTO `perf_offline_day` VALUES ('dd082c8a-3bab-4431-943a-348fe0592abd','2021-09-08 13:00:07','Xg9C8zq81jGNbugM', 'pc', 12345);") tk.MustQuery("SELECT cast(floor(hour(ts) / 4) as char) as win_start FROM perf_offline_day partition (p20210907, p20210908) GROUP BY win_start;").Check(testkit.Rows("3")) }
explode_data.jsonl/65611
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 499 }
[ 2830, 3393, 42006, 17, 23, 23, 15, 19, 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 TestDeadlineExceeded_Is(t *testing.T) { mnr := &callbacks.DeadlineExceeded{} if errors.Is(nil, &callbacks.DeadlineExceeded{}) { t.Error(invalidErrorAssertion) } if errors.Is(fmt.Errorf(wrapMsg), &callbacks.DeadlineExceeded{}) { t.Error(invalidErrorAssertion) } if !errors.Is(mnr, &callbacks.DeadlineExceeded{}) { t.Errorf(invalidErrorAssertion) } }
explode_data.jsonl/56101
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 159 }
[ 2830, 3393, 83593, 840, 94206, 31879, 1155, 353, 8840, 836, 8, 341, 2109, 19618, 1669, 609, 68311, 909, 3149, 1056, 840, 94206, 31483, 743, 5975, 4506, 27907, 11, 609, 68311, 909, 3149, 1056, 840, 94206, 28875, 341, 197, 3244, 6141, 590...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestClient_ArchiveJobSpec(t *testing.T) { t.Parallel() app, cleanup := cltest.NewApplication(t, cltest.EthMockRegisterChainID) defer cleanup() require.NoError(t, app.Start()) job := cltest.NewJob() require.NoError(t, app.Store.CreateJob(&job)) client, _ := app.NewClientAndRenderer() set := flag.NewFlagSet("archive", 0) set.Parse([]string{job.ID.String()}) c := cli.NewContext(nil, set, nil) require.NoError(t, client.ArchiveJobSpec(c)) jobs := cltest.AllJobs(t, app.Store) require.Len(t, jobs, 0) }
explode_data.jsonl/78844
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 205 }
[ 2830, 3393, 2959, 1566, 96191, 12245, 8327, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 2822, 28236, 11, 21290, 1669, 1185, 1944, 7121, 4988, 1155, 11, 1185, 1944, 5142, 339, 11571, 8690, 18837, 915, 340, 16867, 21290, 741, 17957, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestSetTrace(t *testing.T) { obj := New() if obj.trace != false { t.Errorf("expected initial trace=false, got %s", strconv.FormatBool(obj.trace)) } obj.SetTrace(true) if obj.trace != true { t.Errorf("expected post-change trace=true, got %s", strconv.FormatBool(obj.trace)) } obj.tracePretty("test tracePretty output") obj.tracePrintln("test tracePrintln output") }
explode_data.jsonl/71386
{ "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, 1649, 6550, 1155, 353, 8840, 836, 8, 341, 22671, 1669, 1532, 741, 743, 2839, 34412, 961, 895, 341, 197, 3244, 13080, 445, 7325, 2856, 11655, 12219, 11, 2684, 1018, 82, 756, 298, 11355, 12027, 9978, 11233, 6779, 34412, 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...
3
func TestInitHelpFlagMergesFlags(t *testing.T) { usage := "custom flag" baseCmd := Command{Use: "testcmd"} baseCmd.PersistentFlags().Bool("help", false, usage) cmd := Command{Use: "do"} baseCmd.AddCommand(&cmd) cmd.initHelpFlag() actual := cmd.Flags().Lookup("help").Usage if actual != usage { t.Fatalf("Expected the help flag from the base command with usage '%s', but got the default with usage '%s'", usage, actual) } }
explode_data.jsonl/47430
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 148 }
[ 2830, 3393, 3803, 12689, 12135, 44, 2375, 288, 9195, 1155, 353, 8840, 836, 8, 341, 88777, 1669, 330, 9163, 5181, 698, 24195, 15613, 1669, 7348, 90, 10253, 25, 330, 1944, 8710, 16707, 24195, 15613, 61655, 9195, 1005, 11233, 445, 8653, 49...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestBatchesNotCreatedWhenBridgePaused(t *testing.T) { input := CreateTestEnv(t) defer func() { input.Context.Logger().Info("Asserting invariants at test end"); input.AssertInvariants() }() ctx := input.Context // pause the bridge params := input.GravityKeeper.GetParams(ctx) params.BridgeActive = false input.GravityKeeper.SetParams(ctx, params) var ( now = time.Now().UTC() mySender, _ = sdk.AccAddressFromBech32("gravity1ahx7f8wyertuus9r20284ej0asrs085ceqtfnm") myReceiver, _ = types.NewEthAddress("0xd041c41EA1bf0F006ADBb6d2c9ef9D425dE5eaD7") myTokenContractAddr, _ = types.NewEthAddress("0x429881672B9AE42b8EbA0E26cD9C73711b891Ca5") // Pickle token, err = types.NewInternalERC20Token(sdk.NewInt(99999), myTokenContractAddr.GetAddress()) allVouchers = sdk.NewCoins(token.GravityCoin()) ) require.NoError(t, err) // mint some voucher first require.NoError(t, input.BankKeeper.MintCoins(ctx, types.ModuleName, allVouchers)) // set senders balance input.AccountKeeper.NewAccountWithAddress(ctx, mySender) require.NoError(t, input.BankKeeper.SendCoinsFromModuleToAccount(ctx, types.ModuleName, mySender, allVouchers)) // CREATE FIRST BATCH // ================== // add some TX to the pool for i, v := range []uint64{2, 3, 2, 1} { amountToken, err := types.NewInternalERC20Token(sdk.NewInt(int64(i+100)), myTokenContractAddr.GetAddress()) require.NoError(t, err) amount := amountToken.GravityCoin() feeToken, err := types.NewInternalERC20Token(sdk.NewIntFromUint64(v), myTokenContractAddr.GetAddress()) require.NoError(t, err) fee := feeToken.GravityCoin() _, err = input.GravityKeeper.AddToOutgoingPool(ctx, mySender, *myReceiver, amount, fee) require.NoError(t, err) ctx.Logger().Info(fmt.Sprintf("Created transaction %v with amount %v and fee %v", i, amount, fee)) // Should create: // 1: tx amount is 100, fee is 2, id is 1 // 2: tx amount is 101, fee is 3, id is 2 // 3: tx amount is 102, fee is 2, id is 3 // 4: tx amount is 103, fee is 1, id is 4 } // when ctx = ctx.WithBlockTime(now) // tx batch size is 2, so that some of them stay behind _, err = input.GravityKeeper.BuildOutgoingTXBatch(ctx, *myTokenContractAddr, 2) require.Error(t, err) // then batch is persisted gotFirstBatch := input.GravityKeeper.GetOutgoingTXBatch(ctx, *myTokenContractAddr, 1) require.Nil(t, gotFirstBatch) // resume the bridge params.BridgeActive = true input.GravityKeeper.SetParams(ctx, params) // when ctx = ctx.WithBlockTime(now) // tx batch size is 2, so that some of them stay behind firstBatch, err := input.GravityKeeper.BuildOutgoingTXBatch(ctx, *myTokenContractAddr, 2) require.NoError(t, err) // then batch is persisted gotFirstBatch = input.GravityKeeper.GetOutgoingTXBatch(ctx, firstBatch.TokenContract, firstBatch.BatchNonce) require.NotNil(t, gotFirstBatch) }
explode_data.jsonl/21414
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1138 }
[ 2830, 3393, 33, 9118, 2623, 11694, 4498, 32848, 52749, 1155, 353, 8840, 836, 8, 341, 22427, 1669, 4230, 2271, 14359, 1155, 340, 16867, 2915, 368, 314, 1946, 9328, 12750, 1005, 1731, 445, 8534, 287, 304, 54611, 518, 1273, 835, 5038, 1946...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestOnGCE_Stress(t *testing.T) { if testing.Short() { t.Skip("skipping in -short mode") } var last bool for i := 0; i < 100; i++ { onGCEOnce = sync.Once{} now := OnGCE() if i > 0 && now != last { t.Errorf("%d. changed from %v to %v", i, last, now) } last = now } t.Logf("OnGCE() = %v", last) }
explode_data.jsonl/17303
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 152 }
[ 2830, 3393, 1925, 38, 2104, 70645, 673, 1155, 353, 8840, 836, 8, 341, 743, 7497, 55958, 368, 341, 197, 3244, 57776, 445, 4886, 5654, 304, 481, 8676, 3856, 1138, 197, 532, 2405, 1537, 1807, 198, 2023, 600, 1669, 220, 15, 26, 600, 366...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestSetAssetScript(t *testing.T) { to, path, err := createScriptsStorageTestObjects() assert.NoError(t, err, "createScriptsStorageTestObjects() failed") defer func() { to.stor.close(t) err = common.CleanTemporaryDirs(path) assert.NoError(t, err, "failed to clean test data dirs") }() to.stor.addBlock(t, blockID0) assetID := testGlobal.asset0.asset.ID err = to.scriptsStorage.setAssetScript(assetID, testGlobal.scriptBytes, testGlobal.senderInfo.pk, blockID0) assert.NoError(t, err, "setAssetScript() failed") // Test newest before flushing. isSmartAsset, err := to.scriptsStorage.newestIsSmartAsset(assetID, true) assert.NoError(t, err, "newestIsSmartAsset() failed") assert.Equal(t, true, isSmartAsset) scriptAst, err := to.scriptsStorage.newestScriptByAsset(assetID, true) assert.NoError(t, err, "newestScriptByAsset() failed") assert.Equal(t, testGlobal.scriptAst, scriptAst) // Test stable before flushing. isSmartAsset, err = to.scriptsStorage.isSmartAsset(assetID, true) assert.NoError(t, err, "isSmartAsset() failed") assert.Equal(t, false, isSmartAsset) _, err = to.scriptsStorage.scriptByAsset(assetID, true) assert.Error(t, err, "scriptByAsset() did not fail before flushing") to.stor.flush(t) // Test newest after flushing. isSmartAsset, err = to.scriptsStorage.newestIsSmartAsset(assetID, true) assert.NoError(t, err, "newestIsSmartAsset() failed") assert.Equal(t, true, isSmartAsset) scriptAst, err = to.scriptsStorage.newestScriptByAsset(assetID, true) assert.NoError(t, err, "newestScriptByAsset() failed") assert.Equal(t, testGlobal.scriptAst, scriptAst) // Test stable after flushing. isSmartAsset, err = to.scriptsStorage.isSmartAsset(assetID, true) assert.NoError(t, err, "isSmartAsset() failed") assert.Equal(t, true, isSmartAsset) scriptAst, err = to.scriptsStorage.scriptByAsset(assetID, true) assert.NoError(t, err, "scriptByAsset() failed after flushing") assert.Equal(t, testGlobal.scriptAst, scriptAst) // Test discarding script. err = to.scriptsStorage.setAssetScript(assetID, proto.Script{}, testGlobal.senderInfo.pk, blockID0) assert.NoError(t, err, "setAssetScript() failed") // Test newest before flushing. isSmartAsset, err = to.scriptsStorage.newestIsSmartAsset(assetID, true) assert.NoError(t, err, "newestIsSmartAsset() failed") assert.Equal(t, false, isSmartAsset) _, err = to.scriptsStorage.newestScriptByAsset(assetID, true) assert.Error(t, err) // Test stable before flushing. isSmartAsset, err = to.scriptsStorage.isSmartAsset(assetID, true) assert.NoError(t, err, "isSmartAsset() failed") assert.Equal(t, true, isSmartAsset) scriptAst, err = to.scriptsStorage.scriptByAsset(assetID, true) assert.NoError(t, err) assert.Equal(t, testGlobal.scriptAst, scriptAst) to.stor.flush(t) // Test newest after flushing. isSmartAsset, err = to.scriptsStorage.newestIsSmartAsset(assetID, true) assert.NoError(t, err, "newestIsSmartAsset() failed") assert.Equal(t, false, isSmartAsset) _, err = to.scriptsStorage.newestScriptByAsset(assetID, true) assert.Error(t, err) // Test stable after flushing. isSmartAsset, err = to.scriptsStorage.isSmartAsset(assetID, true) assert.NoError(t, err, "isSmartAsset() failed") assert.Equal(t, false, isSmartAsset) _, err = to.scriptsStorage.scriptByAsset(assetID, true) assert.Error(t, err) }
explode_data.jsonl/18595
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1196 }
[ 2830, 3393, 1649, 16604, 5910, 1155, 353, 8840, 836, 8, 341, 31709, 11, 1815, 11, 1848, 1669, 1855, 44942, 5793, 2271, 11543, 741, 6948, 35699, 1155, 11, 1848, 11, 330, 3182, 44942, 5793, 2271, 11543, 368, 4641, 5130, 16867, 2915, 368, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestEventNames(t *testing.T) { for name := range EventNames { event, err := ParseEvent([]byte(fmt.Sprintf(`{"event": "%s"}`, name))) ensure.Nil(t, err) ensure.DeepEqual(t, event.GetName(), name) } }
explode_data.jsonl/69102
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 88 }
[ 2830, 3393, 1556, 7980, 1155, 353, 8840, 836, 8, 341, 2023, 829, 1669, 2088, 3665, 7980, 341, 197, 28302, 11, 1848, 1669, 14775, 1556, 10556, 3782, 28197, 17305, 5809, 4913, 3087, 788, 5962, 82, 1, 28350, 829, 5929, 197, 197, 27289, 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 ]
2
func TestAlertManagerDefaultBaseImageFlag(t *testing.T) { alertManagerBaseImageConfig := Config{ ReloaderConfig: operator.ReloaderConfig{ Image: "quay.io/prometheus-operator/prometheus-config-reloader:latest", CPURequest: "100m", CPULimit: "100m", MemoryRequest: "50Mi", MemoryLimit: "50Mi", }, AlertmanagerDefaultBaseImage: "nondefaultuseflag/quay.io/prometheus/alertmanager", } labels := map[string]string{ "testlabel": "testlabelvalue", } annotations := map[string]string{ "testannotation": "testannotationvalue", } sset, err := makeStatefulSet(&monitoringv1.Alertmanager{ ObjectMeta: metav1.ObjectMeta{ Labels: labels, Annotations: annotations, }, }, alertManagerBaseImageConfig, "") require.NoError(t, err) image := sset.Spec.Template.Spec.Containers[0].Image expected := "nondefaultuseflag/quay.io/prometheus/alertmanager" + ":" + operator.DefaultAlertmanagerVersion if image != expected { t.Fatalf("Unexpected container image.\n\nExpected: %s\n\nGot: %s", expected, image) } }
explode_data.jsonl/25250
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 400 }
[ 2830, 3393, 9676, 2043, 3675, 3978, 1906, 12135, 1155, 353, 8840, 836, 8, 341, 24192, 2043, 3978, 1906, 2648, 1669, 5532, 515, 197, 197, 6740, 39966, 2648, 25, 5675, 2013, 20172, 998, 2648, 515, 298, 53397, 25, 260, 330, 446, 352, 424...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestSidecars(t *testing.T) { volumes := []apiv1.Volume{ { Name: "volume-name", VolumeSource: apiv1.VolumeSource{ EmptyDir: &apiv1.EmptyDirVolumeSource{}, }, }, { Name: "sidecar-volume-name", VolumeSource: apiv1.VolumeSource{ EmptyDir: &apiv1.EmptyDirVolumeSource{}, }, }, } volumeMounts := []apiv1.VolumeMount{ { Name: "volume-name", MountPath: "/test", }, } sidecarVolumeMounts := []apiv1.VolumeMount{ { Name: "sidecar-volume-name", MountPath: "/sidecar-test", }, } mirrorVolumeMounts := true ctx := context.Background() woc := newWoc() woc.volumes = volumes woc.execWf.Spec.Templates[0].Container.VolumeMounts = volumeMounts woc.execWf.Spec.Templates[0].Sidecars = []wfv1.UserContainer{ { MirrorVolumeMounts: &mirrorVolumeMounts, Container: apiv1.Container{ Name: "side-foo", VolumeMounts: sidecarVolumeMounts, Image: "argoproj/argosay:v2", }, }, } tmplCtx, err := woc.createTemplateContext(wfv1.ResourceScopeLocal, "") assert.NoError(t, err) _, err = woc.executeContainer(ctx, woc.execWf.Spec.Entrypoint, tmplCtx.GetTemplateScope(), &woc.execWf.Spec.Templates[0], &wfv1.WorkflowStep{}, &executeTemplateOpts{}) assert.NoError(t, err) pods, err := listPods(woc) assert.NoError(t, err) assert.Len(t, pods.Items, 1) pod := pods.Items[0] assert.Equal(t, 3, len(pod.Spec.Containers)) assert.Equal(t, "wait", pod.Spec.Containers[0].Name) assert.Equal(t, "main", pod.Spec.Containers[1].Name) assert.Equal(t, "side-foo", pod.Spec.Containers[2].Name) for _, v := range volumes { assert.Contains(t, pod.Spec.Volumes, v) } assert.Equal(t, 3, len(pod.Spec.Containers[2].VolumeMounts)) assert.Equal(t, "sidecar-volume-name", pod.Spec.Containers[2].VolumeMounts[0].Name) assert.Equal(t, "volume-name", pod.Spec.Containers[2].VolumeMounts[1].Name) }
explode_data.jsonl/75389
{ "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, 16384, 50708, 1155, 353, 8840, 836, 8, 341, 5195, 19705, 1669, 3056, 391, 344, 16, 79106, 515, 197, 197, 515, 298, 21297, 25, 330, 25060, 11494, 756, 298, 17446, 4661, 3608, 25, 1443, 344, 16, 79106, 3608, 515, 571, 197, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestRegisterProbe(t *testing.T) { expectedProbeList := make([]*controller.Probe, 0) fakeController := &controller.Controller{ Probes: make([]*controller.Probe, 0), Mutex: &sync.Mutex{}, } var i controller.ProbeInterface = &fakeProbe{} newRegisterProbe := &registerProbe{ name: "probe-1", state: true, pi: i, controller: fakeController, } newRegisterProbe.register() probe := &controller.Probe{ Name: newRegisterProbe.name, State: newRegisterProbe.state, Interface: newRegisterProbe.pi, } expectedProbeList = append(expectedProbeList, probe) tests := map[string]struct { actualProbeList []*controller.Probe expectedProbeList []*controller.Probe }{ "add one probe and check if it is present or not": {actualProbeList: fakeController.Probes, expectedProbeList: expectedProbeList}, } for name, test := range tests { t.Run(name, func(t *testing.T) { assert.Equal(t, test.expectedProbeList, test.actualProbeList) }) } }
explode_data.jsonl/13150
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 386 }
[ 2830, 3393, 8690, 81426, 1155, 353, 8840, 836, 8, 341, 42400, 81426, 852, 1669, 1281, 85288, 7152, 7763, 1371, 11, 220, 15, 340, 1166, 726, 2051, 1669, 609, 7152, 29112, 515, 197, 197, 1336, 9433, 25, 1281, 85288, 7152, 7763, 1371, 11...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestPipelineRunsController_Index_Pagination(t *testing.T) { client, jobID, runIDs, cleanup := setupPipelineRunsControllerTests(t) defer cleanup() response, cleanup := client.Get("/v2/jobs/" + fmt.Sprintf("%v", jobID) + "/runs?page=1&size=1") defer cleanup() cltest.AssertServerResponse(t, response, http.StatusOK) var parsedResponse []pipeline.Run responseBytes := cltest.ParseResponseBody(t, response) assert.Contains(t, string(responseBytes), `"meta":null,"errors":[null],"outputs":["3"]`) assert.Contains(t, string(responseBytes), `"meta":{"count":2}`) err := web.ParseJSONAPIResponse(responseBytes, &parsedResponse) assert.NoError(t, err) require.Len(t, parsedResponse, 1) assert.Equal(t, parsedResponse[0].ID, runIDs[1]) assert.NotNil(t, parsedResponse[0].CreatedAt) assert.NotNil(t, parsedResponse[0].FinishedAt) require.Len(t, parsedResponse[0].PipelineTaskRuns, 4) }
explode_data.jsonl/11653
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 329 }
[ 2830, 3393, 34656, 73920, 2051, 50361, 1088, 10353, 1155, 353, 8840, 836, 8, 341, 25291, 11, 2618, 915, 11, 1598, 30466, 11, 21290, 1669, 6505, 34656, 73920, 2051, 18200, 1155, 340, 16867, 21290, 2822, 21735, 11, 21290, 1669, 2943, 2234, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestBlkioStatsUnexpectedNumberOfFields(t *testing.T) { helper := NewCgroupTestUtil("blkio", t) defer helper.cleanup() helper.writeFileContents(map[string]string{ "blkio.io_service_bytes_recursive": "8:0 Read 100 100", "blkio.io_serviced_recursive": servicedRecursiveContents, "blkio.io_queued_recursive": queuedRecursiveContents, "blkio.sectors_recursive": sectorsRecursiveContents, "blkio.io_service_time_recursive": serviceTimeRecursiveContents, "blkio.io_wait_time_recursive": waitTimeRecursiveContents, "blkio.io_merged_recursive": mergedRecursiveContents, "blkio.time_recursive": timeRecursiveContents, }) blkio := &BlkioGroup{} actualStats := *cgroups.NewStats() err := blkio.GetStats(helper.CgroupPath, &actualStats) if err == nil { t.Fatal("Expected to fail, but did not") } }
explode_data.jsonl/45842
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 359 }
[ 2830, 3393, 4923, 74, 815, 16635, 29430, 40619, 8941, 1155, 353, 8840, 836, 8, 341, 9598, 2947, 1669, 1532, 34, 4074, 2271, 2742, 445, 34989, 815, 497, 259, 340, 16867, 13137, 87689, 741, 9598, 2947, 70007, 14803, 9147, 14032, 30953, 51...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestHistogramDataPoint_CopyTo(t *testing.T) { ms := NewHistogramDataPoint() NewHistogramDataPoint().CopyTo(ms) assert.True(t, ms.IsNil()) generateTestHistogramDataPoint().CopyTo(ms) assert.EqualValues(t, generateTestHistogramDataPoint(), ms) }
explode_data.jsonl/19548
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 90 }
[ 2830, 3393, 77210, 1043, 2609, 77637, 1249, 1155, 353, 8840, 836, 8, 341, 47691, 1669, 1532, 77210, 1043, 2609, 741, 197, 3564, 77210, 1043, 2609, 1005, 12106, 1249, 35680, 340, 6948, 32443, 1155, 11, 9829, 4506, 19064, 2398, 3174, 13220,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestStackPeek(t *testing.T) { stack := New() if actualValue, ok := stack.Peek(); actualValue != nil || ok { t.Errorf("Got %v expected %v", actualValue, nil) } stack.Push(1) stack.Push(2) stack.Push(3) if actualValue, ok := stack.Peek(); actualValue != 3 || !ok { t.Errorf("Got %v expected %v", actualValue, 3) } }
explode_data.jsonl/26068
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 132 }
[ 2830, 3393, 4336, 10197, 1225, 1155, 353, 8840, 836, 8, 341, 48227, 1669, 1532, 741, 743, 5042, 1130, 11, 5394, 1669, 5611, 94279, 2129, 5042, 1130, 961, 2092, 1369, 5394, 341, 197, 3244, 13080, 445, 32462, 1018, 85, 3601, 1018, 85, 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...
5
func TestEvalOrder(t *testing.T) { const SCRIPT = ` var o = {f: function() {return 42}, x: 0}; var trace = ""; function F1() { trace += "First!"; return o; } function F2() { trace += "Second!"; return "f"; } function F3() { trace += "Third!"; } var rv = F1()[F2()](F3()); rv += trace; ` testScript(SCRIPT, asciiString("42First!Second!Third!"), t) }
explode_data.jsonl/75248
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 177 }
[ 2830, 3393, 54469, 4431, 1155, 353, 8840, 836, 8, 341, 4777, 53679, 284, 22074, 2405, 297, 284, 314, 69, 25, 729, 368, 314, 689, 220, 19, 17, 2137, 856, 25, 220, 15, 2440, 2405, 11655, 284, 21238, 7527, 434, 16, 368, 341, 2760, 11...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestWithPathParametersCatchesNilURL(t *testing.T) { _, err := Prepare(&http.Request{}, WithPathParameters("", map[string]interface{}{"foo": "bar"})) if err == nil { t.Fatalf("autorest: WithPathParameters failed to catch a nil URL") } }
explode_data.jsonl/20975
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 88 }
[ 2830, 3393, 89534, 9706, 34, 9118, 19064, 3144, 1155, 353, 8840, 836, 8, 972, 197, 6878, 1848, 1669, 31166, 2099, 1254, 9659, 22655, 3085, 1820, 9706, 19814, 2415, 14032, 31344, 6257, 4913, 7975, 788, 330, 2257, 9207, 5784, 743, 1848, 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 ]
2
func TestDeletingConfigObject(t *testing.T) { t.Run("Delete config object", func(t *testing.T) { g := NewWithT(t) req := admission.Request{AdmissionRequest: k8sadm.AdmissionRequest{ Operation: k8sadm.Delete, Name: api.HNCConfigSingleton, }} config := &HNCConfig{Log: zap.New()} got := config.Handle(context.Background(), req) logResult(t, got.AdmissionResponse.Result) g.Expect(got.AdmissionResponse.Allowed).Should(BeFalse()) }) }
explode_data.jsonl/11109
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 181 }
[ 2830, 3393, 60475, 2648, 1190, 1155, 353, 8840, 836, 8, 341, 3244, 16708, 445, 6435, 2193, 1633, 497, 2915, 1155, 353, 8840, 836, 8, 341, 197, 3174, 1669, 1532, 2354, 51, 1155, 340, 197, 24395, 1669, 25293, 9659, 90, 2589, 2728, 1900,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestListenAddressIsValidated(t *testing.T) { testValues := map[string]bool{ ":8065": true, ":9917": true, "0.0.0.0:9917": true, "[2001:db8::68]:9918": true, "[::1]:8065": true, "localhost:8065": true, "test.com:8065": true, ":0": true, ":33147": true, "123:8065": false, "[::1]:99999": false, "[::1]:-1": false, "[::1]:8065a": false, "0.0.0:9917": false, "0.0.0.0:9917/": false, "0..0.0:9917/": false, "0.0.0222.0:9917/": false, "http://0.0.0.0:9917/": false, "http://0.0.0.0:9917": false, "8065": false, "[2001:db8::68]": false, } for key, expected := range testValues { ss := &ServiceSettings{ ListenAddress: NewString(key), } ss.SetDefaults(true) if expected { require.Nil(t, ss.isValid(), fmt.Sprintf("Got an error from '%v'.", key)) } else { err := ss.isValid() require.NotNil(t, err, fmt.Sprintf("Expected '%v' to throw an error.", key)) require.Equal(t, "model.config.is_valid.listen_address.app_error", err.Message) } } }
explode_data.jsonl/50698
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 676 }
[ 2830, 3393, 38714, 4286, 55470, 657, 1155, 353, 8840, 836, 8, 1476, 18185, 6227, 1669, 2415, 14032, 96436, 515, 197, 197, 788, 23, 15, 21, 20, 788, 394, 830, 345, 197, 197, 788, 24, 24, 16, 22, 788, 394, 830, 345, 197, 197, 1, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestInstCpuStats(t *testing.T) { tests := []struct { last *v1.ContainerStats cur *v1.ContainerStats want *CpuInstStats }{ // Last is missing { nil, &v1.ContainerStats{}, nil, }, // Goes back in time { &v1.ContainerStats{ Timestamp: time.Unix(100, 0).Add(time.Second), }, &v1.ContainerStats{ Timestamp: time.Unix(100, 0), }, nil, }, // Zero time delta { &v1.ContainerStats{ Timestamp: time.Unix(100, 0), }, &v1.ContainerStats{ Timestamp: time.Unix(100, 0), }, nil, }, // Unexpectedly small time delta { &v1.ContainerStats{ Timestamp: time.Unix(100, 0), }, &v1.ContainerStats{ Timestamp: time.Unix(100, 0).Add(30 * time.Millisecond), }, nil, }, // Different number of cpus { &v1.ContainerStats{ Timestamp: time.Unix(100, 0), Cpu: v1.CpuStats{ Usage: v1.CpuUsage{ PerCpu: []uint64{100, 200}, }, }, }, &v1.ContainerStats{ Timestamp: time.Unix(100, 0).Add(time.Second), Cpu: v1.CpuStats{ Usage: v1.CpuUsage{ PerCpu: []uint64{100, 200, 300}, }, }, }, nil, }, // Stat numbers decrease { &v1.ContainerStats{ Timestamp: time.Unix(100, 0), Cpu: v1.CpuStats{ Usage: v1.CpuUsage{ Total: 300, PerCpu: []uint64{100, 200}, User: 250, System: 50, }, }, }, &v1.ContainerStats{ Timestamp: time.Unix(100, 0).Add(time.Second), Cpu: v1.CpuStats{ Usage: v1.CpuUsage{ Total: 200, PerCpu: []uint64{100, 100}, User: 150, System: 50, }, }, }, nil, }, // One second elapsed { &v1.ContainerStats{ Timestamp: time.Unix(100, 0), Cpu: v1.CpuStats{ Usage: v1.CpuUsage{ Total: 300, PerCpu: []uint64{100, 200}, User: 250, System: 50, }, }, }, &v1.ContainerStats{ Timestamp: time.Unix(100, 0).Add(time.Second), Cpu: v1.CpuStats{ Usage: v1.CpuUsage{ Total: 500, PerCpu: []uint64{200, 300}, User: 400, System: 100, }, }, }, &CpuInstStats{ Usage: CpuInstUsage{ Total: 200, PerCpu: []uint64{100, 100}, User: 150, System: 50, }, }, }, // Two seconds elapsed { &v1.ContainerStats{ Timestamp: time.Unix(100, 0), Cpu: v1.CpuStats{ Usage: v1.CpuUsage{ Total: 300, PerCpu: []uint64{100, 200}, User: 250, System: 50, }, }, }, &v1.ContainerStats{ Timestamp: time.Unix(100, 0).Add(2 * time.Second), Cpu: v1.CpuStats{ Usage: v1.CpuUsage{ Total: 500, PerCpu: []uint64{200, 300}, User: 400, System: 100, }, }, }, &CpuInstStats{ Usage: CpuInstUsage{ Total: 100, PerCpu: []uint64{50, 50}, User: 75, System: 25, }, }, }, } for _, c := range tests { got, err := instCpuStats(c.last, c.cur) if err != nil { if c.want == nil { continue } t.Errorf("Unexpected error: %v", err) } assert.Equal(t, c.want, got) } }
explode_data.jsonl/10991
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1712 }
[ 2830, 3393, 8724, 34, 5584, 16635, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 3056, 1235, 341, 197, 33096, 353, 85, 16, 33672, 16635, 198, 197, 33209, 220, 353, 85, 16, 33672, 16635, 198, 197, 50780, 353, 34, 5584, 8724, 16635, 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...
4
func TestUpdateRangeAddressingSplitMeta1(t *testing.T) { defer leaktest.AfterTest(t)() left := &roachpb.RangeDescriptor{StartKey: roachpb.RKeyMin, EndKey: meta1Key(roachpb.RKey("a"))} right := &roachpb.RangeDescriptor{StartKey: meta1Key(roachpb.RKey("a")), EndKey: roachpb.RKeyMax} if err := splitRangeAddressing(&client.Batch{}, left, right); err == nil { t.Error("expected failure trying to update addressing records for meta1 split") } }
explode_data.jsonl/37505
{ "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, 4289, 6046, 4286, 287, 20193, 12175, 16, 1155, 353, 8840, 836, 8, 341, 16867, 23352, 1944, 36892, 2271, 1155, 8, 741, 35257, 1669, 609, 64500, 16650, 24783, 11709, 90, 3479, 1592, 25, 926, 610, 16650, 2013, 1592, 6217, 11, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestAESSIVPrimitiveWithInvalidKeys(t *testing.T) { km, err := registry.GetKeyManager(testutil.AESSIVTypeURL) if err != nil { t.Errorf("cannot obtain AESSIV key manager: %s", err) } invalidKeys := genInvalidAESSIVKeys() for _, key := range invalidKeys { serializedKey, _ := proto.Marshal(key) if _, err := km.Primitive(serializedKey); err == nil { t.Errorf("km.Primitive(%v) = _, nil; want _, err", serializedKey) } } }
explode_data.jsonl/58684
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 172 }
[ 2830, 3393, 32, 9996, 3090, 33313, 2354, 7928, 8850, 1155, 353, 8840, 836, 8, 341, 197, 16017, 11, 1848, 1669, 19424, 51723, 2043, 8623, 1314, 875, 9996, 3090, 929, 3144, 340, 743, 1848, 961, 2092, 341, 197, 3244, 13080, 445, 33260, 6...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
4
func TestColorHSLA(t *testing.T) { expectPrintedMangle(t, ".red { color: hsl(0, 100%, 50%) }", ".red {\n color: red;\n}\n") expectPrintedMangle(t, ".orange { color: hsl(30deg, 100%, 50%) }", ".orange {\n color: #ff8000;\n}\n") expectPrintedMangle(t, ".yellow { color: hsl(60 100% 50%) }", ".yellow {\n color: #ff0;\n}\n") expectPrintedMangle(t, ".green { color: hsl(120, 100%, 50%) }", ".green {\n color: #0f0;\n}\n") expectPrintedMangle(t, ".cyan { color: hsl(200grad, 100%, 50%) }", ".cyan {\n color: #0ff;\n}\n") expectPrintedMangle(t, ".blue { color: hsl(240, 100%, 50%) }", ".blue {\n color: #00f;\n}\n") expectPrintedMangle(t, ".purple { color: hsl(0.75turn 100% 50%) }", ".purple {\n color: #7f00ff;\n}\n") expectPrintedMangle(t, ".magenta { color: hsl(300, 100%, 50%) }", ".magenta {\n color: #f0f;\n}\n") expectPrintedMangle(t, "a { color: hsl(30 25% 50% / 50%) }", "a {\n color: #9f80607f;\n}\n") expectPrintedMangle(t, "a { color: hsla(30 25% 50% / 50%) }", "a {\n color: #9f80607f;\n}\n") }
explode_data.jsonl/32619
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 467 }
[ 2830, 3393, 1636, 39, 7984, 32, 1155, 353, 8840, 836, 8, 341, 24952, 8994, 291, 44, 4044, 1155, 11, 5933, 1151, 314, 1894, 25, 305, 3226, 7, 15, 11, 220, 16, 15, 15, 13384, 220, 20, 15, 11334, 335, 497, 5933, 1151, 28152, 77, 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 TestFieldSpec(t *testing.T) { index, err := Open("Doc") if err != nil { t.Fatalf("err from Open: %v", err) } errFoo := errors.New("foo") // sentinel error when there isn't one. testCases := []struct { desc string opts *SearchOptions want *pb.FieldSpec }{ { desc: "No options", want: &pb.FieldSpec{}, }, { desc: "Fields", opts: &SearchOptions{ Fields: []string{"one", "two"}, }, want: &pb.FieldSpec{ Name: []string{"one", "two"}, }, }, { desc: "Expressions", opts: &SearchOptions{ Expressions: []FieldExpression{ {Name: "one", Expr: "price * quantity"}, {Name: "two", Expr: "min(daily_use, 10) * rate"}, }, }, want: &pb.FieldSpec{ Expression: []*pb.FieldSpec_Expression{ {Name: proto.String("one"), Expression: proto.String("price * quantity")}, {Name: proto.String("two"), Expression: proto.String("min(daily_use, 10) * rate")}, }, }, }, } for _, tt := range testCases { c := aetesting.FakeSingleContext(t, "search", "Search", func(req *pb.SearchRequest, _ *pb.SearchResponse) error { params := req.Params if !reflect.DeepEqual(params.FieldSpec, tt.want) { t.Errorf("%s: params.FieldSpec=%v; want %v", tt.desc, params.FieldSpec, tt.want) } return errFoo // Always return some error to prevent response parsing. }) it := index.Search(c, "gopher", tt.opts) if _, err := it.Next(nil); err != errFoo { t.Fatalf("%s: got error %v; want %v", tt.desc, err, errFoo) } } }
explode_data.jsonl/27963
{ "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, 1877, 8327, 1155, 353, 8840, 836, 8, 341, 26327, 11, 1848, 1669, 5264, 445, 9550, 1138, 743, 1848, 961, 2092, 341, 197, 3244, 30762, 445, 615, 504, 5264, 25, 1018, 85, 497, 1848, 340, 197, 630, 9859, 40923, 1669, 5975, 7...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestSCRAMBuild(t *testing.T) { t.Run("scram-sha-256", func(t *testing.T) { t.Run("valid", func(t *testing.T) { // check a few different password combinations. note: the salt is kept the // same so we can get a reproducible result credentialList := []([]string){ []string{`datalake`, `SCRAM-SHA-256$4096:aDFwcDBwNHJ0eTIwMjA=$xHkOo65LX9eBB8a6v+axqvs3+aMBTH0sCT7w/Nxzh5M=:PXuFoeJNuAGSeExskYSqkwUyiUJu8LPC9DgwDWQ9ARQ=`}, []string{`øásis`, `SCRAM-SHA-256$4096:aDFwcDBwNHJ0eTIwMjA=$ySGUcYGGJXsigb0a24AfSqNRpGM+zqwlkfuzdlWCV9k=:GDITAfQzF7M9aJaP5OK04b6bT+XQ+wjU3qiGC2ERxeA=`}, []string{`md53a0689aa9e31a50b5621971fc89f0c64`, `SCRAM-SHA-256$4096:aDFwcDBwNHJ0eTIwMjA=$R93U562i0T1ewqfMD3JhD/eTnvTsVBDq1wzkBWx0+WU=:p+dt112MXgpsvAshbNU6jTSMegApKRzb9VT18yiQ/HY=`}, []string{`SCRAM-SHA-256$4096:aDFwcDBwNHJ0eTIwMjA=$xHkOo65LX9eBB8a6v+axqvs3+aMBTH0sCT7w/Nxzh5M=:PXuFoeJNuAGSeExskYSqkwUyiUJu8LPC9DgwDWQ9ARQ=`, `SCRAM-SHA-256$4096:aDFwcDBwNHJ0eTIwMjA=$s9HbNQBsfJwflGr4lvr4vEt/vvspp5Uu8IjWYLjMUMg=:3sUGJgo/70EQvjsma2I/RJsheqLhxN2rarUt7oqK6q8=`}, } mockGenerateSalt := func(length int) ([]byte, error) { // return the special salt return []byte("h1pp0p4rty2020"), nil } // a crednetial is valid if it generates the specified md5 hash for _, credentials := range credentialList { t.Run(credentials[0], func(t *testing.T) { scram := NewSCRAMPassword(credentials[0]) scram.generateSalt = mockGenerateSalt hash, err := scram.Build() if err != nil { t.Error(err) } if hash != credentials[1] { t.Errorf("expected: %q actual %q", credentials[1], hash) } }) } }) t.Run("invalid", func(t *testing.T) { // ensure the generate salt function returns an error mockGenerateSalt := func(length int) ([]byte, error) { return []byte{}, ErrSCRAMSaltLengthInvalid } t.Run("invalid salt generator value", func(t *testing.T) { scram := NewSCRAMPassword("datalake") scram.generateSalt = mockGenerateSalt if _, err := scram.Build(); err == nil { t.Errorf("error expected with invalid value to salt generator") } }) }) }) }
explode_data.jsonl/28537
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1099 }
[ 2830, 3393, 3540, 33905, 11066, 1155, 353, 8840, 836, 8, 341, 3244, 16708, 445, 2388, 2396, 7514, 64, 12, 17, 20, 21, 497, 2915, 1155, 353, 8840, 836, 8, 1476, 197, 3244, 16708, 445, 1891, 497, 2915, 1155, 353, 8840, 836, 8, 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...
1
func TestAwsEc2Client_DescribeInstances(t *testing.T) { ec2Controller := newAWSEc2Controller(newFakeAWSEc2Client()) params := &ec2.DescribeInstancesInput{} params.Filters = []*ec2.Filter{ ec2Controller.newEC2Filter("instance-state-name", "running"), } instancesOutput, _ := ec2Controller.describeInstances(params) if len(instancesOutput) < 1 { t.Error("Could not describe instances") } }
explode_data.jsonl/81483
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 142 }
[ 2830, 3393, 47359, 50730, 17, 2959, 98054, 3114, 42725, 1155, 353, 8840, 836, 8, 341, 197, 757, 17, 2051, 1669, 501, 14419, 925, 66, 17, 2051, 1755, 52317, 14419, 925, 66, 17, 2959, 2398, 25856, 1669, 609, 757, 17, 23548, 3114, 42725,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestUnrollMetrics(t *testing.T) { tests := []unrollTest{{ name: "empty", in: []MetricStat{}, out: map[string]MetricStat{}, }, { name: "simple", in: []MetricStat{ { statistic: "Sum", cloudwatchMetric: &cloudwatch.Metric{ Dimensions: []*cloudwatch.Dimension{ { Name: aws.String("QueueName"), Value: aws.String("dev-nosensitive-contact-profile-live"), }, { Name: aws.String("QueuePrio"), Value: aws.String("7"), }, }, MetricName: aws.String("ApproximateAgeOfOldestMessage"), Namespace: aws.String("AWS/SQS"), }, }, }, out: map[string]MetricStat{"i0": { statistic: "Sum", cloudwatchMetric: &cloudwatch.Metric{ Dimensions: []*cloudwatch.Dimension{ { Name: aws.String("QueueName"), Value: aws.String("dev-nosensitive-contact-profile-live"), }, { Name: aws.String("QueuePrio"), Value: aws.String("7"), }, }, MetricName: aws.String("ApproximateAgeOfOldestMessage"), Namespace: aws.String("AWS/SQS"), }, }}, }, { name: "complex", in: []MetricStat{ { statistic: "Maximum", cloudwatchMetric: &cloudwatch.Metric{ Dimensions: []*cloudwatch.Dimension{ { Name: aws.String("QueueName"), Value: aws.String("dev-nosensitive-contact-profile-live"), }, { Name: aws.String("QueuePrio"), Value: aws.String("7"), }, }, MetricName: aws.String("ApproximateAgeOfOldestMessage"), Namespace: aws.String("AWS/SQS"), }, }, { statistic: "Sum", cloudwatchMetric: &cloudwatch.Metric{ Dimensions: []*cloudwatch.Dimension{ { Name: aws.String("QueueName"), Value: aws.String("dev-nosensitive-contact-profile-live"), }, { Name: aws.String("QueuePrio"), Value: aws.String("7"), }, }, MetricName: aws.String("ApproximateAgeOfOldestMessage"), Namespace: aws.String("AWS/SQS"), }, }, }, out: map[string]MetricStat{ "i0": { statistic: "Maximum", cloudwatchMetric: &cloudwatch.Metric{ Dimensions: []*cloudwatch.Dimension{ { Name: aws.String("QueueName"), Value: aws.String("dev-nosensitive-contact-profile-live"), }, { Name: aws.String("QueuePrio"), Value: aws.String("7"), }, }, MetricName: aws.String("ApproximateAgeOfOldestMessage"), Namespace: aws.String("AWS/SQS"), }, }, "i1": { statistic: "Sum", cloudwatchMetric: &cloudwatch.Metric{ Dimensions: []*cloudwatch.Dimension{ { Name: aws.String("QueueName"), Value: aws.String("dev-nosensitive-contact-profile-live"), }, { Name: aws.String("QueuePrio"), Value: aws.String("7"), }, }, MetricName: aws.String("ApproximateAgeOfOldestMessage"), Namespace: aws.String("AWS/SQS"), }, }, }, }} for _, test := range tests { t.Run(test.name, func(t *testing.T) { got := unrollMetrics(test.in) assert.Equal(t, test.out, got) }) } }
explode_data.jsonl/3108
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1575 }
[ 2830, 3393, 1806, 1100, 27328, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 3056, 359, 1100, 2271, 90, 515, 197, 11609, 25, 330, 3194, 756, 197, 17430, 25, 256, 3056, 54310, 15878, 38837, 197, 13967, 25, 220, 2415, 14032, 60, 54310, 158...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestBuildWithGoModules(t *testing.T) { if runtime.GOOS == "android" || runtime.GOOS == "ios" { t.Skipf("gomobile are not available on %s", runtime.GOOS) } dir, err := ioutil.TempDir("", "gomobile-test") if err != nil { t.Fatal(err) } defer os.RemoveAll(dir) if out, err := exec.Command("go", "build", "-o="+dir, "golang.org/x/mobile/cmd/gomobile").CombinedOutput(); err != nil { t.Fatalf("%v: %s", err, string(out)) } path := dir if p := os.Getenv("PATH"); p != "" { path += string(filepath.ListSeparator) + p } for _, target := range []string{"android", "ios"} { t.Run(target, func(t *testing.T) { switch target { case "android": androidHome := os.Getenv("ANDROID_HOME") if androidHome == "" { t.Skip("ANDROID_HOME not found, skipping bind") } if _, err := androidAPIPath(); err != nil { t.Skip("No android API platform found in $ANDROID_HOME, skipping bind") } case "ios": if !xcodeAvailable() { t.Skip("Xcode is missing") } } var out string switch target { case "android": out = filepath.Join(dir, "basic.apk") case "ios": out = filepath.Join(dir, "Basic.app") } tests := []struct { Name string Path string Dir string }{ { Name: "Absolute Path", Path: "golang.org/x/mobile/example/basic", }, { Name: "Relative Path", Path: "./example/basic", Dir: filepath.Join("..", ".."), }, } for _, tc := range tests { tc := tc t.Run(tc.Name, func(t *testing.T) { args := []string{"build", "-target=" + target, "-o=" + out} if target == "ios" { args = append(args, "-bundleid=org.golang.gomobiletest") } args = append(args, tc.Path) cmd := exec.Command(filepath.Join(dir, "gomobile"), args...) cmd.Env = append(os.Environ(), "PATH="+path, "GO111MODULE=on") cmd.Dir = tc.Dir if out, err := cmd.CombinedOutput(); err != nil { t.Errorf("gomobile build failed: %v\n%s", err, string(out)) } }) } }) } }
explode_data.jsonl/33977
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 926 }
[ 2830, 3393, 11066, 2354, 10850, 28201, 1155, 353, 8840, 836, 8, 341, 743, 15592, 97574, 3126, 621, 330, 5954, 1, 1369, 15592, 97574, 3126, 621, 330, 3530, 1, 341, 197, 3244, 57776, 69, 445, 36083, 3372, 525, 537, 2500, 389, 1018, 82, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestUpdatePodOrphanSameLabels(t *testing.T) { for _, strategy := range updateStrategies() { manager, _, _, err := newTestController() if err != nil { t.Fatalf("error creating DaemonSets controller: %v", err) } ds1 := newDaemonSet("foo1") ds1.Spec.UpdateStrategy = *strategy ds2 := newDaemonSet("foo2") ds2.Spec.UpdateStrategy = *strategy manager.dsStore.Add(ds1) manager.dsStore.Add(ds2) pod := newPod("pod1-", "node-0", simpleDaemonSetLabel, nil) prev := *pod bumpResourceVersion(pod) manager.updatePod(&prev, pod) if got, want := manager.queue.Len(), 0; got != want { t.Fatalf("queue.Len() = %v, want %v", got, want) } } }
explode_data.jsonl/50356
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 272 }
[ 2830, 3393, 4289, 23527, 2195, 9943, 19198, 23674, 1155, 353, 8840, 836, 8, 341, 2023, 8358, 8282, 1669, 2088, 2647, 2580, 69388, 368, 341, 197, 92272, 11, 8358, 8358, 1848, 1669, 501, 2271, 2051, 741, 197, 743, 1848, 961, 2092, 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 TestSyncerRun(t *testing.T) { t.Run("Sync due", func(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) now := time.Now() store := MockSyncStore{ listChangesetSyncData: func(ctx context.Context, opts ListChangesetSyncDataOpts) ([]campaigns.ChangesetSyncData, error) { return []campaigns.ChangesetSyncData{ { ChangesetID: 1, UpdatedAt: now.Add(-2 * maxSyncDelay), LatestEvent: now.Add(-2 * maxSyncDelay), ExternalUpdatedAt: now.Add(-2 * maxSyncDelay), }, }, nil }, } syncFunc := func(ctx context.Context, ids int64) error { cancel() return nil } syncer := &ChangesetSyncer{ SyncStore: store, scheduleInterval: 10 * time.Minute, syncFunc: syncFunc, } go syncer.Run(ctx) select { case <-ctx.Done(): case <-time.After(50 * time.Millisecond): t.Fatal("Sync should have been triggered") } }) t.Run("Sync not due", func(t *testing.T) { ctx, cancel := context.WithTimeout(context.Background(), 10*time.Millisecond) defer cancel() now := time.Now() store := MockSyncStore{ listChangesetSyncData: func(ctx context.Context, opts ListChangesetSyncDataOpts) ([]campaigns.ChangesetSyncData, error) { return []campaigns.ChangesetSyncData{ { ChangesetID: 1, UpdatedAt: now, LatestEvent: now, ExternalUpdatedAt: now, }, }, nil }, } var syncCalled bool syncFunc := func(ctx context.Context, ids int64) error { syncCalled = true return nil } syncer := &ChangesetSyncer{ SyncStore: store, scheduleInterval: 10 * time.Minute, syncFunc: syncFunc, } syncer.Run(ctx) if syncCalled { t.Fatal("Sync should not have been triggered") } }) t.Run("Priority added", func(t *testing.T) { // Empty schedule but then we add an item ctx, cancel := context.WithCancel(context.Background()) store := MockSyncStore{ listChangesetSyncData: func(ctx context.Context, opts ListChangesetSyncDataOpts) ([]campaigns.ChangesetSyncData, error) { return []campaigns.ChangesetSyncData{}, nil }, } syncFunc := func(ctx context.Context, ids int64) error { cancel() return nil } syncer := &ChangesetSyncer{ SyncStore: store, scheduleInterval: 10 * time.Minute, syncFunc: syncFunc, priorityNotify: make(chan []int64, 1), } syncer.priorityNotify <- []int64{1} go syncer.Run(ctx) select { case <-ctx.Done(): case <-time.After(50 * time.Millisecond): t.Fatal("Sync not called") } }) }
explode_data.jsonl/4813
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1127 }
[ 2830, 3393, 12154, 261, 6727, 1155, 353, 8840, 836, 8, 341, 3244, 16708, 445, 12154, 4152, 497, 2915, 1155, 353, 8840, 836, 8, 341, 197, 20985, 11, 9121, 1669, 2266, 26124, 9269, 5378, 19047, 2398, 197, 80922, 1669, 882, 13244, 741, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestGetSNSStringAttribute_Success(t *testing.T) { RegisterFailHandler(test.FailedHandler(t)) v, err := utils.GetSNSStringAttribute(logger.NewEmptyLogger(), map[string]interface{}{"Value": "foo"}) Expect(err).To(BeNil()) Expect(v).To(Equal("foo")) }
explode_data.jsonl/18239
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 97 }
[ 2830, 3393, 1949, 50, 7118, 3907, 87161, 1155, 353, 8840, 836, 8, 341, 79096, 19524, 3050, 8623, 991, 5687, 3050, 1155, 1171, 5195, 11, 1848, 1669, 12439, 2234, 50, 7118, 3907, 37833, 7121, 3522, 7395, 1507, 2415, 14032, 31344, 6257, 49...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
func TestNoop(t *testing.T) { noopWriter := New() assert.NotPanics(t, func() { _ = noopWriter.Write(nil, nil) }) assert.NotPanics(t, func() { _ = noopWriter.Stream(block.Row{}) }) }
explode_data.jsonl/9723
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 85 }
[ 2830, 3393, 2753, 453, 1155, 353, 8840, 836, 8, 341, 197, 40162, 6492, 1669, 1532, 2822, 6948, 15000, 35693, 1211, 1155, 11, 2915, 368, 341, 197, 197, 62, 284, 60829, 6492, 4073, 27907, 11, 2092, 340, 197, 8824, 6948, 15000, 35693, 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
func TestInitialize_Activate_Err_Response(t *testing.T) { errResp := map[string]string{ "code": "ErrParam", "msg": "error msg", } data, err := json.Marshal(errResp) assert.NoError(t, err) r := []*mock.Response{mock.NewResponse(500, data)} ms := mock.NewServer(nil, r...) assert.NotNil(t, ms) defer ms.Close() ic := &config.InitConfig{} err = utils.UnmarshalYAML(nil, ic) assert.NoError(t, err) ic.Cloud.Active.Interval = 5 * time.Second ic.Cloud.HTTP.Address = ms.URL ic.ActivateConfig.Fingerprints = []config.Fingerprint{{ Proof: config.ProofHostName, }} ic.ActivateConfig.Attributes = []config.Attribute{} c := &config.Config{} c.Init = *ic nodeInfo := &v1.NodeInfo{ Hostname: "docker-desktop", } f, err := ioutil.TempFile("", t.Name()) assert.NoError(t, err) assert.NotNil(t, f) fmt.Println("-->tempfile", f.Name()) sto, err := store.NewBoltHold(f.Name()) assert.NoError(t, err) assert.NotNil(t, sto) mockCtl := gomock.NewController(t) defer mockCtl.Finish() ami := mc.NewMockAMI(mockCtl) ami.EXPECT().CollectNodeInfo().Return(nodeInfo, nil).AnyTimes() init := genInitialize(t, c, ami) init.Start() init.srv = &gohttp.Server{} init.Close() }
explode_data.jsonl/24504
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 503 }
[ 2830, 3393, 9928, 46672, 731, 93623, 65873, 1155, 353, 8840, 836, 8, 341, 9859, 36555, 1669, 2415, 14032, 30953, 515, 197, 197, 1, 1851, 788, 330, 7747, 2001, 756, 197, 197, 1, 3236, 788, 220, 330, 841, 3750, 756, 197, 532, 8924, 11...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestEnvironmentProviderConditionals(t *testing.T) { assert := assert.New(t) workflow := new(environmentWorkflow) workflow.environment = new(common.Environment) workflow.environment.Provider = common.EnvProviderEcs assert.True(workflow.isEcsProvider()()) assert.False(workflow.isEc2Provider()()) workflow.environment.Provider = common.EnvProviderEc2 assert.False(workflow.isEcsProvider()()) assert.True(workflow.isEc2Provider()()) }
explode_data.jsonl/15909
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 142 }
[ 2830, 3393, 12723, 5179, 10547, 1127, 1155, 353, 8840, 836, 8, 341, 6948, 1669, 2060, 7121, 1155, 692, 197, 56249, 1669, 501, 67591, 62768, 340, 197, 56249, 62145, 284, 501, 57802, 45651, 340, 197, 56249, 62145, 36208, 284, 4185, 81214, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestReadResponsePid(t *testing.T) { reader := bufio.NewReader(strings.NewReader(cResponsePid)) response, err := mi.ReadResponse(reader) assert.Nil(t, err) pid, err := mi.ParsePid(response) assert.Nil(t, err) assert.Equal(t, int64(10869), pid) }
explode_data.jsonl/48090
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 103 }
[ 2830, 3393, 4418, 2582, 32339, 1155, 353, 8840, 836, 8, 341, 61477, 1669, 96917, 68587, 51442, 68587, 1337, 2582, 32339, 1171, 21735, 11, 1848, 1669, 9497, 6503, 2582, 21987, 340, 6948, 59678, 1155, 11, 1848, 340, 78799, 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 TestMachineDeploymentSyncStatus(t *testing.T) { msStatusError := capierrors.MachineSetStatusError("some failure") var tests = map[string]struct { machineSets []*clusterv1.MachineSet newMachineSet *clusterv1.MachineSet deployment *clusterv1.MachineDeployment expectedStatus clusterv1.MachineDeploymentStatus }{ "all machines are running": { machineSets: []*clusterv1.MachineSet{{ Spec: clusterv1.MachineSetSpec{ Replicas: pointer.Int32Ptr(2), }, Status: clusterv1.MachineSetStatus{ Selector: "", AvailableReplicas: 2, ReadyReplicas: 2, Replicas: 2, ObservedGeneration: 1, }, }}, newMachineSet: &clusterv1.MachineSet{ Spec: clusterv1.MachineSetSpec{ Replicas: pointer.Int32Ptr(2), }, Status: clusterv1.MachineSetStatus{ Selector: "", AvailableReplicas: 2, ReadyReplicas: 2, Replicas: 2, ObservedGeneration: 1, }, }, deployment: &clusterv1.MachineDeployment{ ObjectMeta: metav1.ObjectMeta{ Generation: 2, }, Spec: clusterv1.MachineDeploymentSpec{ Replicas: pointer.Int32Ptr(2), }, }, expectedStatus: clusterv1.MachineDeploymentStatus{ ObservedGeneration: 2, Replicas: 2, UpdatedReplicas: 2, ReadyReplicas: 2, AvailableReplicas: 2, UnavailableReplicas: 0, Phase: "Running", }, }, "scaling up": { machineSets: []*clusterv1.MachineSet{{ Spec: clusterv1.MachineSetSpec{ Replicas: pointer.Int32Ptr(2), }, Status: clusterv1.MachineSetStatus{ Selector: "", AvailableReplicas: 1, ReadyReplicas: 1, Replicas: 2, ObservedGeneration: 1, }, }}, newMachineSet: &clusterv1.MachineSet{ Spec: clusterv1.MachineSetSpec{ Replicas: pointer.Int32Ptr(2), }, Status: clusterv1.MachineSetStatus{ Selector: "", AvailableReplicas: 1, ReadyReplicas: 1, Replicas: 2, ObservedGeneration: 1, }, }, deployment: &clusterv1.MachineDeployment{ ObjectMeta: metav1.ObjectMeta{ Generation: 2, }, Spec: clusterv1.MachineDeploymentSpec{ Replicas: pointer.Int32Ptr(2), }, }, expectedStatus: clusterv1.MachineDeploymentStatus{ ObservedGeneration: 2, Replicas: 2, UpdatedReplicas: 2, ReadyReplicas: 1, AvailableReplicas: 1, UnavailableReplicas: 1, Phase: "ScalingUp", }, }, "scaling down": { machineSets: []*clusterv1.MachineSet{{ Spec: clusterv1.MachineSetSpec{ Replicas: pointer.Int32Ptr(2), }, Status: clusterv1.MachineSetStatus{ Selector: "", AvailableReplicas: 3, ReadyReplicas: 2, Replicas: 2, ObservedGeneration: 1, }, }}, newMachineSet: &clusterv1.MachineSet{ Spec: clusterv1.MachineSetSpec{ Replicas: pointer.Int32Ptr(2), }, Status: clusterv1.MachineSetStatus{ Selector: "", AvailableReplicas: 3, ReadyReplicas: 2, Replicas: 2, ObservedGeneration: 1, }, }, deployment: &clusterv1.MachineDeployment{ ObjectMeta: metav1.ObjectMeta{ Generation: 2, }, Spec: clusterv1.MachineDeploymentSpec{ Replicas: pointer.Int32Ptr(2), }, }, expectedStatus: clusterv1.MachineDeploymentStatus{ ObservedGeneration: 2, Replicas: 2, UpdatedReplicas: 2, ReadyReplicas: 2, AvailableReplicas: 3, UnavailableReplicas: 0, Phase: "ScalingDown", }, }, "machine set failed": { machineSets: []*clusterv1.MachineSet{{ Spec: clusterv1.MachineSetSpec{ Replicas: pointer.Int32Ptr(2), }, Status: clusterv1.MachineSetStatus{ Selector: "", AvailableReplicas: 0, ReadyReplicas: 0, Replicas: 2, ObservedGeneration: 1, FailureReason: &msStatusError, }, }}, newMachineSet: &clusterv1.MachineSet{ Spec: clusterv1.MachineSetSpec{ Replicas: pointer.Int32Ptr(2), }, Status: clusterv1.MachineSetStatus{ Selector: "", AvailableReplicas: 0, ReadyReplicas: 0, Replicas: 2, ObservedGeneration: 1, }, }, deployment: &clusterv1.MachineDeployment{ ObjectMeta: metav1.ObjectMeta{ Generation: 2, }, Spec: clusterv1.MachineDeploymentSpec{ Replicas: pointer.Int32Ptr(2), }, }, expectedStatus: clusterv1.MachineDeploymentStatus{ ObservedGeneration: 2, Replicas: 2, UpdatedReplicas: 2, ReadyReplicas: 0, AvailableReplicas: 0, UnavailableReplicas: 2, Phase: "Failed", }, }, } for name, test := range tests { t.Run(name, func(t *testing.T) { g := NewWithT(t) actualStatus := calculateStatus(test.machineSets, test.newMachineSet, test.deployment) g.Expect(actualStatus).To(Equal(test.expectedStatus)) }) } }
explode_data.jsonl/58395
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 2547 }
[ 2830, 3393, 21605, 75286, 12154, 2522, 1155, 353, 8840, 836, 8, 341, 47691, 2522, 1454, 1669, 2062, 72, 7650, 1321, 3814, 1649, 2522, 1454, 445, 14689, 7901, 5130, 2405, 7032, 284, 2415, 14032, 60, 1235, 341, 197, 2109, 3814, 30175, 262...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestUpdatableApps_ErrorIfJniLibDoesntSupportMinSdkVersion(t *testing.T) { bp := cc.GatherRequiredDepsForTest(android.Android) + ` android_app { name: "foo", srcs: ["a.java"], updatable: true, sdk_version: "current", min_sdk_version: "29", // this APK should support 29 jni_libs: ["libjni"], } cc_library { name: "libjni", stl: "none", sdk_version: "current", } ` testJavaError(t, `"libjni" .*: sdk_version\(current\) is higher than min_sdk_version\(29\)`, bp) }
explode_data.jsonl/58481
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 228 }
[ 2830, 3393, 2324, 88831, 53602, 28651, 2679, 41, 7751, 9194, 21468, 406, 7916, 6217, 57175, 5637, 1155, 353, 8840, 836, 8, 341, 2233, 79, 1669, 12527, 1224, 1856, 8164, 35, 7124, 2461, 2271, 45632, 52924, 8, 488, 22074, 197, 197, 5954, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestRunPipeWithMainFuncNotInMainGoFile(t *testing.T) { folder := testlib.Mktmp(t) require.NoError(t, ioutil.WriteFile( filepath.Join(folder, "foo.go"), []byte("package main\nfunc main() {println(0)}"), 0o644, )) config := config.Project{ Builds: []config.Build{ { Env: []string{"GO111MODULE=off"}, Binary: "foo", Hooks: config.HookConfig{}, Targets: []string{ runtimeTarget, }, GoBinary: "go", }, }, } ctx := context.New(config) ctx.Git.CurrentTag = "5.6.7" t.Run("empty", func(t *testing.T) { ctx.Config.Builds[0].Main = "" require.NoError(t, Default.Build(ctx, ctx.Config.Builds[0], api.Options{ Target: runtimeTarget, })) }) t.Run("foo.go", func(t *testing.T) { ctx.Config.Builds[0].Main = "foo.go" require.NoError(t, Default.Build(ctx, ctx.Config.Builds[0], api.Options{ Target: runtimeTarget, })) }) t.Run("glob", func(t *testing.T) { ctx.Config.Builds[0].Main = "." require.NoError(t, Default.Build(ctx, ctx.Config.Builds[0], api.Options{ Target: runtimeTarget, })) }) }
explode_data.jsonl/54152
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 492 }
[ 2830, 3393, 6727, 34077, 2354, 6202, 9626, 2623, 641, 6202, 10850, 1703, 1155, 353, 8840, 836, 8, 341, 1166, 2018, 1669, 1273, 2740, 1321, 74, 5173, 1155, 340, 17957, 35699, 1155, 11, 43144, 4073, 1703, 1006, 197, 17661, 2343, 22363, 33...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestExportMetricDataFull(t *testing.T) { desc := "physical property of matter that quantitatively expresses hot and cold" unit := "K" md := consumerdata.MetricsData{ Node: &commonpb.Node{ ServiceInfo: &commonpb.ServiceInfo{Name: "test-service"}, }, Resource: &resourcepb.Resource{ Labels: map[string]string{ "resource": "R1", }, }, Metrics: []*metricspb.Metric{ { MetricDescriptor: &metricspb.MetricDescriptor{ Name: "temperature", Description: desc, Unit: unit, Type: metricspb.MetricDescriptor_GAUGE_DOUBLE, LabelKeys: []*metricspb.LabelKey{ {Key: "location"}, {Key: "elevation"}, }, }, Timeseries: []*metricspb.TimeSeries{ { LabelValues: []*metricspb.LabelValue{ {Value: "Portland", HasValue: true}, {Value: "0", HasValue: true}, }, Points: []*metricspb.Point{ { Timestamp: &timestamppb.Timestamp{ Seconds: 100, }, Value: &metricspb.Point_DoubleValue{ DoubleValue: 293.15, }, }, { Timestamp: &timestamppb.Timestamp{ Seconds: 101, }, Value: &metricspb.Point_DoubleValue{ DoubleValue: 293.15, }, }, { Timestamp: &timestamppb.Timestamp{ Seconds: 102, }, Value: &metricspb.Point_DoubleValue{ DoubleValue: 293.45, }, }, }, }, { LabelValues: []*metricspb.LabelValue{ {Value: "Denver", HasValue: true}, {Value: "5280", HasValue: true}, }, Points: []*metricspb.Point{ { Timestamp: &timestamppb.Timestamp{ Seconds: 99, }, Value: &metricspb.Point_DoubleValue{ DoubleValue: 290.05, }, }, { Timestamp: &timestamppb.Timestamp{ Seconds: 106, }, Value: &metricspb.Point_DoubleValue{ DoubleValue: 293.15, }, }, }, }, }, }, }, } expected := []Metric{ { Name: "temperature", Type: "gauge", Value: 293.15, Timestamp: int64(100 * time.Microsecond), Attributes: map[string]interface{}{ "collector.name": name, "collector.version": version, "description": desc, "unit": unit, "resource": "R1", "service.name": "test-service", "location": "Portland", "elevation": "0", }, }, { Name: "temperature", Type: "gauge", Value: 293.15, Timestamp: int64(101 * time.Microsecond), Attributes: map[string]interface{}{ "collector.name": name, "collector.version": version, "description": desc, "unit": unit, "resource": "R1", "service.name": "test-service", "location": "Portland", "elevation": "0", }, }, { Name: "temperature", Type: "gauge", Value: 293.45, Timestamp: int64(102 * time.Microsecond), Attributes: map[string]interface{}{ "collector.name": name, "collector.version": version, "description": desc, "unit": unit, "resource": "R1", "service.name": "test-service", "location": "Portland", "elevation": "0", }, }, { Name: "temperature", Type: "gauge", Value: 290.05, Timestamp: int64(99 * time.Microsecond), Attributes: map[string]interface{}{ "collector.name": name, "collector.version": version, "description": desc, "unit": unit, "resource": "R1", "service.name": "test-service", "location": "Denver", "elevation": "5280", }, }, { Name: "temperature", Type: "gauge", Value: 293.15, Timestamp: int64(106 * time.Microsecond), Attributes: map[string]interface{}{ "collector.name": name, "collector.version": version, "description": desc, "unit": unit, "resource": "R1", "service.name": "test-service", "location": "Denver", "elevation": "5280", }, }, } testExportMetricData(t, expected, md) }
explode_data.jsonl/16230
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 2337 }
[ 2830, 3393, 16894, 54310, 1043, 9432, 1155, 353, 8840, 836, 8, 341, 41653, 1669, 330, 46592, 3343, 315, 4925, 429, 10272, 275, 7887, 60020, 4017, 323, 9255, 698, 81189, 1669, 330, 42, 698, 84374, 1669, 11502, 691, 1321, 13468, 1043, 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 Test_case(t *testing.T) { res, _ := Pow(0, 0) if res == 1 { t.Log("Pass") } else { t.Error("Failed") } res, _ = Pow(2, -1) if res == 0.5 { t.Log("Pass") } else { t.Error("Failed value: ") } res, _ = Pow(2, 3) if res == 8 { t.Log("Pass") } else { t.Error("Failed") } res, _ = Pow(2, -2) if res == 0.25 { t.Log("Pass") } else { t.Error("Failed") } res, err := Pow(0, -2) if err != nil { t.Log("Pass") } else { t.Error("Failed") } }
explode_data.jsonl/4312
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 351 }
[ 2830, 3393, 19096, 1155, 353, 8840, 836, 8, 341, 262, 592, 11, 716, 1669, 23605, 7, 15, 11, 220, 15, 340, 262, 421, 592, 621, 220, 16, 341, 286, 259, 5247, 445, 12187, 1138, 262, 335, 770, 341, 286, 259, 6141, 445, 9408, 1138, 2...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
6
func TestDoGetRequest(t *testing.T) { testEnv := testutils.SetupTestEnv() defer testEnv.TearDownTestEnv() testEnv.Mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { w.Header().Add("Content-Type", "application/json") fmt.Fprint(w, "response") if r.Method != http.MethodGet { t.Errorf("got %s method, want GET", r.Method) } }) endpoint := testEnv.Server.URL + "/" client := &selvpcclient.ServiceClient{ HTTPClient: &http.Client{}, Endpoint: endpoint, TokenID: "token", UserAgent: "agent", } ctx := context.Background() response, err := client.DoRequest(ctx, http.MethodGet, endpoint, nil) if err != nil { log.Fatalf("unexpected error: %v", err) } if response.Body == nil { log.Fatal("response body is empty") } if response.StatusCode != 200 { log.Fatalf("got %d response status, want 200", response.StatusCode) } }
explode_data.jsonl/62935
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 340 }
[ 2830, 3393, 5404, 1949, 1900, 1155, 353, 8840, 836, 8, 341, 18185, 14359, 1669, 1273, 6031, 39820, 2271, 14359, 741, 16867, 1273, 14359, 836, 682, 4454, 2271, 14359, 741, 18185, 14359, 1321, 2200, 63623, 35460, 2915, 3622, 1758, 37508, 11...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestUPlaceBatchOrders(t *testing.T) { t.Parallel() if !areTestAPIKeysSet() || !canManipulateRealOrders { t.Skip("skipping test: api keys not set or canManipulateRealOrders set to false") } var data []PlaceBatchOrderData var tempData PlaceBatchOrderData tempData.Symbol = "BTCUSDT" tempData.Side = "BUY" tempData.OrderType = "LIMIT" tempData.Quantity = 4 tempData.Price = 1 tempData.TimeInForce = "GTC" data = append(data, tempData) _, err := b.UPlaceBatchOrders(context.Background(), data) if err != nil { t.Error(err) } }
explode_data.jsonl/76571
{ "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, 52, 17371, 21074, 24898, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 741, 743, 753, 546, 2271, 7082, 8850, 1649, 368, 1369, 753, 4814, 92876, 6334, 12768, 24898, 341, 197, 3244, 57776, 445, 4886, 5654, 1273, 25, 6330, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestCreateGetRotateKey_Failure(t *testing.T) { t.Run("test failure Create() and Rotate() calls with bad key template string", func(t *testing.T) { kmsStorage, err := New(testMasterKeyURI, &mockProvider{ storage: mockstorage.NewMockStoreProvider(), secretLock: &mocksecretlock.MockSecretLock{ ValEncrypt: "", ValDecrypt: "", }, }) require.NoError(t, err) require.NotEmpty(t, kmsStorage) id, kh, err := kmsStorage.Create("") require.Error(t, err) require.Empty(t, kh) require.Empty(t, id) id, kh, err = kmsStorage.Create("unsupported") require.Error(t, err) require.Empty(t, kh) require.Empty(t, id) // create a valid key to test Rotate() id, kh, err = kmsStorage.Create(kms.AES128GCMType) require.NoError(t, err) require.NotEmpty(t, kh) require.NotEmpty(t, id) newID, kh, err := kmsStorage.Rotate("", id) require.Error(t, err) require.Empty(t, kh) require.Empty(t, newID) newID, kh, err = kmsStorage.Rotate("unsupported", id) require.Error(t, err) require.Empty(t, kh) require.Empty(t, newID) }) t.Run("test Create() with failure to store key", func(t *testing.T) { putDataErr := fmt.Errorf("failed to put data") kmsStorage, err := New(testMasterKeyURI, &mockProvider{ storage: &mockstorage.MockStoreProvider{ Store: &mockstorage.MockStore{ ErrPut: putDataErr, }, }, secretLock: &mocksecretlock.MockSecretLock{ ValEncrypt: "", ValDecrypt: "", }, }) require.NoError(t, err) id, kh, err := kmsStorage.Create(kms.AES128GCMType) require.True(t, errors.Is(err, putDataErr)) require.Empty(t, kh) require.Empty(t, id) }) t.Run("test Create() success to store key but fail to get key from store", func(t *testing.T) { storeData := map[string][]byte{} kmsStorage, err := New(testMasterKeyURI, &mockProvider{ storage: &mockstorage.MockStoreProvider{ Store: &mockstorage.MockStore{ Store: storeData, }, }, secretLock: &mocksecretlock.MockSecretLock{ ValEncrypt: "", ValDecrypt: "", }, }) require.NoError(t, err) id, kh, err := kmsStorage.Create(kms.AES128GCMType) require.NoError(t, err) require.NotEmpty(t, kh) require.NotEmpty(t, id) // new create a new client with a store throwing an error during a Get() kmsStorage3, err := New(testMasterKeyURI, &mockProvider{ storage: &mockstorage.MockStoreProvider{ Store: &mockstorage.MockStore{ ErrGet: fmt.Errorf("failed to get data"), Store: storeData, }, }, secretLock: &mocksecretlock.MockSecretLock{ ValEncrypt: "", ValDecrypt: "", }, }) require.NoError(t, err) kh, err = kmsStorage3.Get(id) require.Contains(t, err.Error(), "failed to get data") require.Empty(t, kh) newID, kh, err := kmsStorage3.Rotate(kms.AES128GCMType, id) require.Contains(t, err.Error(), "failed to get data") require.Empty(t, kh) require.Empty(t, newID) }) t.Run("create valid key but not available for Export", func(t *testing.T) { storeData := map[string][]byte{} kmsStorage, err := New(testMasterKeyURI, &mockProvider{ storage: &mockstorage.MockStoreProvider{ Store: &mockstorage.MockStore{ Store: storeData, }, }, secretLock: &noop.NoLock{}, }) require.NoError(t, err) kid, _, err := kmsStorage.Create(kms.AES128GCM) require.NoError(t, err) _, err = kmsStorage.ExportPubKeyBytes(kid) require.EqualError(t, err, "exportPubKeyBytes: failed to export marshalled key: exportPubKeyBytes: "+ "failed to get public keyset handle: keyset.Handle: keyset.Handle: keyset contains a non-private key") }) t.Run("create And Export invalid key", func(t *testing.T) { storeData := map[string][]byte{} kmsStorage, err := New(testMasterKeyURI, &mockProvider{ storage: &mockstorage.MockStoreProvider{ Store: &mockstorage.MockStore{ Store: storeData, }, }, secretLock: &noop.NoLock{}, }) require.NoError(t, err) // try to create and export an unsupported key type. _, _, err = kmsStorage.CreateAndExportPubKeyBytes("unsupported") require.EqualError(t, err, "createAndExportPubKeyBytes: failed to create new key: create: failed to "+ "getKeyTemplate: getKeyTemplate: key type 'unsupported' unrecognized") // try to create and export a supported key type, but does not support export. _, _, err = kmsStorage.CreateAndExportPubKeyBytes(kms.HMACSHA256Tag256) require.EqualError(t, err, "createAndExportPubKeyBytes: failed to export new public key bytes: "+ "exportPubKeyBytes: failed to export marshalled key: exportPubKeyBytes: failed to get public keyset "+ "handle: keyset.Handle: keyset.Handle: keyset contains a non-private key") }) }
explode_data.jsonl/33099
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1875 }
[ 2830, 3393, 4021, 1949, 34540, 1592, 1400, 9373, 1155, 353, 8840, 836, 8, 341, 3244, 16708, 445, 1944, 7901, 4230, 368, 323, 49720, 368, 6738, 448, 3873, 1376, 3811, 914, 497, 2915, 1155, 353, 8840, 836, 8, 341, 197, 16463, 1011, 5793...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestMCP23017DriverWriteGPIO(t *testing.T) { mcp, adaptor := initTestMCP23017DriverWithStubbedAdaptor(0) gobottest.Assert(t, mcp.Start(), nil) adaptor.i2cReadImpl = func(b []byte) (int, error) { return len(b), nil } adaptor.i2cWriteImpl = func([]byte) (int, error) { return 0, nil } err := mcp.WriteGPIO(7, 0, "A") gobottest.Assert(t, err, nil) }
explode_data.jsonl/42316
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 160 }
[ 2830, 3393, 44, 7123, 17, 18, 15, 16, 22, 11349, 7985, 26337, 1155, 353, 8840, 836, 8, 341, 2109, 4672, 11, 91941, 1669, 2930, 2271, 44, 7123, 17, 18, 15, 16, 22, 11349, 2354, 33838, 2721, 2589, 32657, 7, 15, 340, 3174, 674, 1716,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestStreamDecompressionChunks(t *testing.T) { MB := 1024 * 1024 totalSize := 100 * MB chunk := 1 * MB rawData := make([]byte, totalSize) r := NewRandBytes() r.Read(rawData) compressed, _ := Compress(nil, rawData) streamDecompressed := bytes.NewReader(compressed) reader := NewReader(streamDecompressed) result := make([]byte, 0, totalSize) for { chunkBytes := make([]byte, chunk) n, err := reader.Read(chunkBytes) if err != nil && err != io.EOF { t.Fatalf("Got an error while reading: %s", err) } result = append(result, chunkBytes[:n]...) if err == io.EOF { break } } err := reader.Close() if err != nil { t.Fatalf("Failed to close writer: %s", err) } if !bytes.Equal(rawData, result) { t.Fatalf("Decompression data is not equal to original data") } }
explode_data.jsonl/70468
{ "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, 3027, 4900, 316, 4011, 89681, 1155, 353, 8840, 836, 8, 341, 197, 8412, 1669, 220, 16, 15, 17, 19, 353, 220, 16, 15, 17, 19, 198, 34493, 1695, 1669, 220, 16, 15, 15, 353, 13339, 198, 23049, 3122, 1669, 220, 16, 353, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestOpenBasenameApproverFilter(t *testing.T) { rule := &rules.RuleDefinition{ ID: "test_rule", Expression: `open.filename == "{{.Root}}/test-oba-1"`, } test, err := newTestModule(nil, []*rules.RuleDefinition{rule}, testOpts{wantProbeEvents: true}) if err != nil { t.Fatal(err) } defer test.Close() fd1, testFile1, err := openTestFile(test, "test-oba-1", syscall.O_CREAT) if err != nil { t.Fatal(err) } defer os.Remove(testFile1) defer syscall.Close(fd1) if _, err := waitForOpenProbeEvent(test, testFile1); err != nil { t.Fatal(err) } fd2, testFile2, err := openTestFile(test, "test-oba-2", syscall.O_CREAT) if err != nil { t.Fatal(err) } defer os.Remove(testFile2) defer syscall.Close(fd2) if event, err := waitForOpenProbeEvent(test, testFile2); err == nil { t.Fatalf("shouldn't get an event: %+v", event) } }
explode_data.jsonl/61815
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 375 }
[ 2830, 3393, 5002, 33, 27100, 28588, 423, 5632, 1155, 353, 8840, 836, 8, 341, 7000, 1111, 1669, 609, 21977, 63961, 10398, 515, 197, 29580, 25, 260, 330, 1944, 21124, 756, 197, 197, 9595, 25, 1565, 2508, 30882, 621, 47219, 13, 8439, 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...
6
func TestRavenDecodeToString(t *testing.T) { script1 := "76a9149451f4546e09fc2e49ef9b5303924712ec2b038e88ac" script2 := "a914bd92088bb7e82d611a9b94fbb74a0908152b784f87" tests := []TestcaseDecode{ { name: "P2PKH", input: script1, output: "RNoSGCX8SPFscj8epDaJjqEpuZa2B5in88", }, { name: "P2SH", input: script2, output: "rPWwn5h4QFZNaz1XmY39rc73sdYGGDdmq1", }, } RunTestsDecode(t, slip44.RAVENCOIN, tests) }
explode_data.jsonl/9963
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 250 }
[ 2830, 3393, 49, 5276, 32564, 5870, 1155, 353, 8840, 836, 8, 341, 86956, 16, 1669, 330, 22, 21, 64, 24, 16, 19, 24, 19, 20, 16, 69, 19, 20, 19, 21, 68, 15, 24, 8316, 17, 68, 19, 24, 823, 24, 65, 20, 18, 15, 18, 24, 17, 19...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestUpdateSecurityGroup(t *testing.T) { tests := []struct { name string existingSG *models.SecurityGroup requestedSG *models.SecurityGroup expectedSG *models.SecurityGroup fieldMaskPaths []string fails bool expectedStatusCode int }{ { name: "update security group", existingSG: &models.SecurityGroup{UUID: "sg_uuid", SecurityGroupID: 8000001}, requestedSG: &models.SecurityGroup{UUID: "sg_uuid"}, fieldMaskPaths: []string{}, }, { name: "update security group with explicit ID equal to the old ID", existingSG: &models.SecurityGroup{UUID: "sg_uuid", SecurityGroupID: 8000001}, requestedSG: &models.SecurityGroup{UUID: "sg_uuid", SecurityGroupID: 8000001}, fieldMaskPaths: []string{models.SecurityGroupFieldSecurityGroupID}, }, { name: "fail to update security group with explicit ID different than the old ID", existingSG: &models.SecurityGroup{UUID: "sg_uuid", SecurityGroupID: 8000001}, requestedSG: &models.SecurityGroup{UUID: "sg_uuid", SecurityGroupID: 8000002}, fieldMaskPaths: []string{models.SecurityGroupFieldSecurityGroupID}, fails: true, expectedStatusCode: http.StatusForbidden, }, } for _, tt := range tests { runTest(t, tt.name, func(t *testing.T, sv *ContrailTypeLogicService) { sv.ReadService.(*servicesmock.MockReadService).EXPECT().GetSecurityGroup( // nolint: errcheck gomock.Not(gomock.Nil()), &services.GetSecurityGroupRequest{ID: tt.requestedSG.UUID}, ).Return(&services.GetSecurityGroupResponse{SecurityGroup: tt.existingSG}, nil).Times(1) updateCall := sv.Next().(*servicesmock.MockService). EXPECT().UpdateSecurityGroup(gomock.Not(gomock.Nil()), gomock.Not(gomock.Nil())). DoAndReturn(func(_ context.Context, request *services.UpdateSecurityGroupRequest) ( *services.UpdateSecurityGroupResponse, error) { return &services.UpdateSecurityGroupResponse{ SecurityGroup: request.SecurityGroup, }, nil }) if tt.fails { updateCall.MaxTimes(1) } else { updateCall.Times(1) } ctx := context.Background() res, err := sv.UpdateSecurityGroup(ctx, &services.UpdateSecurityGroupRequest{ SecurityGroup: tt.requestedSG, FieldMask: types.FieldMask{ Paths: tt.fieldMaskPaths, }, }) if tt.fails { assert.Error(t, err) } else if assert.NoError(t, err) { assert.Equal(t, tt.requestedSG, res.SecurityGroup) } }) } }
explode_data.jsonl/47317
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1051 }
[ 2830, 3393, 4289, 15352, 2808, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 3056, 1235, 341, 197, 11609, 2290, 914, 198, 197, 8122, 11083, 7783, 260, 353, 6507, 21567, 2808, 198, 197, 23555, 291, 7783, 286, 353, 6507, 21567, 2808, 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 TestWorkloadSummaryChart(t *testing.T) { pwm := octant.PodWithMetric{} w := octant.NewWorkload("workload", "icon") w.SegmentCounter = map[component.NodeStatus][]octant.PodWithMetric{ component.NodeStatusOK: {pwm}, component.NodeStatusWarning: {pwm, pwm}, component.NodeStatusError: {pwm, pwm, pwm}, } cases := []struct { name string workload *octant.Workload expected *component.DonutChart isErr bool }{ { name: "in general", workload: w, expected: &component.DonutChart{ Config: component.DonutChartConfig{ Segments: []component.DonutSegment{ { Count: 3, Status: component.NodeStatusError, }, { Count: 1, Status: component.NodeStatusOK, }, { Count: 2, Status: component.NodeStatusWarning, }, }, Labels: component.DonutChartLabels{ Plural: "Pods", Singular: "Pod", }, }, }, }, } for _, c := range cases { t.Run(c.name, func(t *testing.T) { actual, err := c.workload.DonutChart() if c.isErr { require.Error(t, err) return } require.NoError(t, err) component.AssertEqual(t, c.expected, actual) }) } }
explode_data.jsonl/80938
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 584 }
[ 2830, 3393, 6776, 1078, 19237, 14488, 1155, 353, 8840, 836, 8, 341, 3223, 19557, 1669, 18491, 517, 88823, 2354, 54310, 31483, 6692, 1669, 18491, 517, 7121, 6776, 1078, 445, 1778, 1078, 497, 330, 1924, 5130, 6692, 808, 71080, 14099, 284, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestModifyGitCommitMessage(t *testing.T) { testCases := map[string]struct { input string branchName string output string errorContains string }{ "commit for feature branch": { input: "initial commit", branchName: "PROJECT-123", output: "PROJECT-123: initial commit", }, "commit for fix-branch with no feature reference": { input: "initial commit", branchName: "release/v1.0.1-fix", output: "", errorContains: "validation error for branch 'release/v1.0.1-fix'", }, "commit for fix-branch with feature reference": { input: "feature/PROJECT-123 initial commit", branchName: "release/v1.0.1-fix", output: "release/v1.0.1-fix: feature/PROJECT-123 initial commit", }, "commit for fix-branch with feature reference somewhere in the commit message": { input: "fixed something for PROJECT-123, should work now", branchName: "release/v1.0.1-fix", output: "release/v1.0.1-fix: fixed something for PROJECT-123, should work now", }, "commit for feature without commit message": { input: "", branchName: "PROJECT-123", output: "", errorContains: "commit message is empty", }, "commit with broken branch name detection, but with commit message": { input: "initial commit", branchName: "", output: "initial commit", errorContains: "", }, "commit with broken branch name detection and without commit message": { input: "", branchName: "", output: "", errorContains: "commit message is empty", }, } prjCfg := config.Project{ BranchTypes: map[string]config.BranchTypePattern{ "feature": `(?m)^((origin\/)*feature\/.*)|(?:\s|^|/)(([A-Z](_)*)+-[0-9]+)([\s,;:!.-]|$)`, "release": `(?m)^(origin\/)*release\/v([0-9]*\.*)*(-fix)*$`, }, Templates: map[string]config.BranchTypeTemplate{ "feature": "{{.BranchName}}: {{.CommitMessage}}", "release": "{{.BranchName}}: {{.CommitMessage}}", }, Validation: map[string]config.BranchValidationConfiguration{ "release": { `(?m)(?:\s|^|/)(([A-Z](_)*)+-[0-9]+)([\s,;:!.-]|$)`: "valid feature reference ID", }, }, } for testName, testData := range testCases { t.Run(testName, func(t *testing.T) { modifier := NewCommitMessageModifier(prjCfg) modifiedGitCommitMessage, err := modifier.ModifyGitCommitMessage(testData.input, testData.branchName) if testData.errorContains != "" { assert.Contains(t, err.Error(), testData.errorContains) } else { assert.NoError(t, err) } assert.Exactly(t, testData.output, modifiedGitCommitMessage) }) } }
explode_data.jsonl/19155
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1130 }
[ 2830, 3393, 44427, 46562, 33441, 2052, 1155, 353, 8840, 836, 8, 1476, 18185, 37302, 1669, 2415, 14032, 60, 1235, 341, 197, 22427, 260, 914, 198, 197, 197, 17940, 675, 262, 914, 198, 197, 21170, 286, 914, 198, 197, 18290, 23805, 914, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestEnviron(t *testing.T) { job := mkJob(t, "dummy") job.Setenv("foo", "bar") val, exists := job.Environ()["foo"] if !exists { t.Fatalf("foo not found in the environ") } if val != "bar" { t.Fatalf("bar not found in the environ") } }
explode_data.jsonl/15390
{ "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, 1702, 2772, 1155, 353, 8840, 836, 8, 341, 68577, 1669, 23789, 12245, 1155, 11, 330, 31390, 1138, 68577, 4202, 3160, 445, 7975, 497, 330, 2257, 1138, 19302, 11, 6724, 1669, 2618, 22834, 2772, 64322, 7975, 7026, 743, 753, 1630...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestEvaluateArray(t *testing.T) { floats := []float64{float64(2), float64(2)} b, err := EvalCondition(floats, "all(result, {# > 1})") assert.Nil(t, err) assert.True(t, b) }
explode_data.jsonl/51795
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 79 }
[ 2830, 3393, 82345, 1857, 1155, 353, 8840, 836, 8, 341, 8139, 82, 1669, 3056, 3649, 21, 19, 90, 3649, 21, 19, 7, 17, 701, 2224, 21, 19, 7, 17, 10569, 2233, 11, 1848, 1669, 58239, 10547, 8268, 82, 11, 330, 541, 4456, 11, 314, 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
func TestDockerKeyringLookup(t *testing.T) { ada := docker.AuthConfiguration{ Username: "ada", Password: "smash", Email: "ada@example.com", } grace := docker.AuthConfiguration{ Username: "grace", Password: "squash", Email: "grace@example.com", } dk := &credentialprovider.BasicDockerKeyring{} dk.Add(credentialprovider.DockerConfig{ "bar.example.com/pong": credentialprovider.DockerConfigEntry{ Username: grace.Username, Password: grace.Password, Email: grace.Email, }, "bar.example.com": credentialprovider.DockerConfigEntry{ Username: ada.Username, Password: ada.Password, Email: ada.Email, }, }) tests := []struct { image string match []docker.AuthConfiguration ok bool }{ // direct match {"bar.example.com", []docker.AuthConfiguration{ada}, true}, // direct match deeper than other possible matches {"bar.example.com/pong", []docker.AuthConfiguration{grace, ada}, true}, // no direct match, deeper path ignored {"bar.example.com/ping", []docker.AuthConfiguration{ada}, true}, // match first part of path token {"bar.example.com/pongz", []docker.AuthConfiguration{grace, ada}, true}, // match regardless of sub-path {"bar.example.com/pong/pang", []docker.AuthConfiguration{grace, ada}, true}, // no host match {"example.com", []docker.AuthConfiguration{}, false}, {"foo.example.com", []docker.AuthConfiguration{}, false}, } for i, tt := range tests { match, ok := dk.Lookup(tt.image) if tt.ok != ok { t.Errorf("case %d: expected ok=%t, got %t", i, tt.ok, ok) } if !reflect.DeepEqual(tt.match, match) { t.Errorf("case %d: expected match=%#v, got %#v", i, tt.match, match) } } }
explode_data.jsonl/11453
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 657 }
[ 2830, 3393, 35, 13659, 1592, 12640, 34247, 1155, 353, 8840, 836, 8, 1476, 197, 2584, 1669, 26588, 25233, 7688, 515, 197, 197, 11115, 25, 330, 2584, 756, 197, 197, 4876, 25, 330, 3563, 988, 756, 197, 197, 4781, 25, 262, 330, 2584, 35...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
4
func TestOpenHTTPArchive(t *testing.T) { const ( zipFile = "test.zip" entryName = "hello.txt" contents = "world" testRoot = "testdata/public" ) require.NoError(t, os.MkdirAll(testRoot, 0755)) f, err := os.Create(filepath.Join(testRoot, zipFile)) require.NoError(t, err, "create file") defer f.Close() zw := zip.NewWriter(f) w, err := zw.Create(entryName) require.NoError(t, err, "create zip entry") _, err = fmt.Fprint(w, contents) require.NoError(t, err, "write zip entry contents") require.NoError(t, zw.Close(), "close zip writer") require.NoError(t, f.Close(), "close file") srv := httptest.NewServer(http.FileServer(http.Dir(testRoot))) defer srv.Close() zr, err := OpenArchive(context.Background(), srv.URL+"/"+zipFile) require.NoError(t, err, "call OpenArchive") require.Len(t, zr.File, 1) zf := zr.File[0] require.Equal(t, entryName, zf.Name, "zip entry name") entry, err := zf.Open() require.NoError(t, err, "get zip entry reader") defer entry.Close() actualContents, err := ioutil.ReadAll(entry) require.NoError(t, err, "read zip entry contents") require.Equal(t, contents, string(actualContents), "compare zip entry contents") }
explode_data.jsonl/13606
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 463 }
[ 2830, 3393, 5002, 9230, 42502, 1155, 353, 8840, 836, 8, 341, 4777, 2399, 197, 197, 9964, 1703, 256, 284, 330, 1944, 20991, 698, 197, 48344, 675, 284, 330, 14990, 3909, 698, 197, 197, 17610, 220, 284, 330, 14615, 698, 197, 18185, 8439,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestBlockTxHashes(t *testing.T) { // Block 1, transaction 1 hash. hashStr := "55a25248c04dd8b6599ca2a708413c00d79ae90ce075c54e8a967a647d7e4bea" wantHash, err := chainhash.NewHashFromStr(hashStr) if err != nil { t.Errorf("NewHashFromStr: %v", err) return } wantHashes := []chainhash.Hash{*wantHash} hashes := testBlock.TxHashes() if !reflect.DeepEqual(hashes, wantHashes) { t.Errorf("TxHashes: wrong transaction hashes - got %v, want %v", spew.Sdump(hashes), spew.Sdump(wantHashes)) } }
explode_data.jsonl/20097
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 218 }
[ 2830, 3393, 4713, 31584, 6370, 288, 1155, 353, 8840, 836, 8, 341, 197, 322, 8362, 220, 16, 11, 7745, 220, 16, 5175, 624, 50333, 2580, 1669, 330, 20, 20, 64, 17, 20, 17, 19, 23, 66, 15, 19, 631, 23, 65, 21, 20, 24, 24, 924, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestContainerKillAll(t *testing.T) { t.Parallel() client, err := newClient(t, address) if err != nil { t.Fatal(err) } defer client.Close() var ( image Image ctx, cancel = testContext() id = t.Name() ) defer cancel() image, err = client.GetImage(ctx, testImage) if err != nil { t.Fatal(err) } container, err := client.NewContainer(ctx, id, WithNewSnapshot(id, image), WithNewSpec(oci.WithImageConfig(image), withProcessArgs("sh", "-c", "top"), oci.WithHostNamespace(specs.PIDNamespace), ), ) if err != nil { t.Fatal(err) } defer container.Delete(ctx, WithSnapshotCleanup) stdout := bytes.NewBuffer(nil) task, err := container.NewTask(ctx, cio.NewCreator(withByteBuffers(stdout))) if err != nil { t.Fatal(err) } defer task.Delete(ctx) statusC, err := task.Wait(ctx) if err != nil { t.Fatal(err) } if err := task.Start(ctx); err != nil { t.Fatal(err) } if err := task.Kill(ctx, syscall.SIGKILL, WithKillAll); err != nil { t.Error(err) } <-statusC if _, err := task.Delete(ctx); err != nil { t.Fatal(err) } }
explode_data.jsonl/39639
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 478 }
[ 2830, 3393, 4502, 53734, 2403, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 2822, 25291, 11, 1848, 1669, 501, 2959, 1155, 11, 2621, 340, 743, 1848, 961, 2092, 341, 197, 3244, 26133, 3964, 340, 197, 532, 16867, 2943, 10421, 2822, 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 TestEngineQuery(t *testing.T) { vdr, _, sender, vm, te, gBlk := setup(t) blk := &Blk{ parent: gBlk, id: GenerateID(), status: choices.Processing, bytes: []byte{1}, } blocked := new(bool) vm.GetBlockF = func(blkID ids.ID) (snowman.Block, error) { if *blocked { t.Fatalf("Sent multiple requests") } *blocked = true if !blkID.Equals(blk.ID()) { t.Fatalf("Wrong block requested") } return &Blk{id: blkID, status: choices.Unknown}, errUnknownBlock } asked := new(bool) getRequestID := new(uint32) sender.GetF = func(inVdr ids.ShortID, requestID uint32, blkID ids.ID) { if *asked { t.Fatalf("Asked multiple times") } *asked = true *getRequestID = requestID if !vdr.ID().Equals(inVdr) { t.Fatalf("Asking wrong validator for block") } if !blk.ID().Equals(blkID) { t.Fatalf("Asking for wrong block") } } te.PullQuery(vdr.ID(), 15, blk.ID()) if !*blocked { t.Fatalf("Didn't request block") } if !*asked { t.Fatalf("Didn't request block from validator") } queried := new(bool) queryRequestID := new(uint32) sender.PushQueryF = func(inVdrs ids.ShortSet, requestID uint32, blkID ids.ID, blkBytes []byte) { if *queried { t.Fatalf("Asked multiple times") } *queried = true *queryRequestID = requestID vdrSet := ids.ShortSet{} vdrSet.Add(vdr.ID()) if !inVdrs.Equals(vdrSet) { t.Fatalf("Asking wrong validator for preference") } if !blk.ID().Equals(blkID) { t.Fatalf("Asking for wrong block") } } chitted := new(bool) sender.ChitsF = func(inVdr ids.ShortID, requestID uint32, prefSet ids.Set) { if *chitted { t.Fatalf("Sent multiple chits") } *chitted = true if requestID != 15 { t.Fatalf("Wrong request ID") } if prefSet.Len() != 1 { t.Fatal("Should only be one vote") } if !blk.ID().Equals(prefSet.List()[0]) { t.Fatalf("Wrong chits block") } } vm.ParseBlockF = func(b []byte) (snowman.Block, error) { if !bytes.Equal(b, blk.Bytes()) { t.Fatalf("Wrong bytes") } return blk, nil } te.Put(vdr.ID(), *getRequestID, blk.ID(), blk.Bytes()) vm.ParseBlockF = nil if !*queried { t.Fatalf("Didn't ask for preferences") } if !*chitted { t.Fatalf("Didn't provide preferences") } blk1 := &Blk{ parent: blk, id: GenerateID(), height: 1, status: choices.Processing, bytes: []byte{5, 4, 3, 2, 1, 9}, } vm.GetBlockF = func(blkID ids.ID) (snowman.Block, error) { switch { case blkID.Equals(blk.ID()): return blk, nil case blkID.Equals(blk1.ID()): return &Blk{id: blkID, status: choices.Unknown}, errUnknownBlock } t.Fatalf("Wrong block requested") panic("Should have failed") } *asked = false sender.GetF = func(inVdr ids.ShortID, requestID uint32, blkID ids.ID) { if *asked { t.Fatalf("Asked multiple times") } *asked = true *getRequestID = requestID if !vdr.ID().Equals(inVdr) { t.Fatalf("Asking wrong validator for block") } if !blk1.ID().Equals(blkID) { t.Fatalf("Asking for wrong block") } } blkSet := ids.Set{} blkSet.Add(blk1.ID()) te.Chits(vdr.ID(), *queryRequestID, blkSet) *queried = false sender.PushQueryF = func(inVdrs ids.ShortSet, requestID uint32, blkID ids.ID, blkBytes []byte) { if *queried { t.Fatalf("Asked multiple times") } *queried = true *queryRequestID = requestID vdrSet := ids.ShortSet{} vdrSet.Add(vdr.ID()) if !inVdrs.Equals(vdrSet) { t.Fatalf("Asking wrong validator for preference") } if !blkID.Equals(blk1.ID()) { t.Fatalf("Asking for wrong block") } } vm.ParseBlockF = func(b []byte) (snowman.Block, error) { if !bytes.Equal(b, blk1.Bytes()) { t.Fatalf("Wrong bytes") } vm.GetBlockF = func(blkID ids.ID) (snowman.Block, error) { switch { case blkID.Equals(blk.ID()): return blk, nil case blkID.Equals(blk1.ID()): return blk1, nil } t.Fatalf("Wrong block requested") panic("Should have failed") } return blk1, nil } te.Put(vdr.ID(), *getRequestID, blk1.ID(), blk1.Bytes()) vm.ParseBlockF = nil if blk1.Status() != choices.Accepted { t.Fatalf("Should have executed block") } if len(te.blocked) != 0 { t.Fatalf("Should have finished blocking") } _ = te.polls.String() // Shouldn't panic te.QueryFailed(vdr.ID(), *queryRequestID) if len(te.blocked) != 0 { t.Fatalf("Should have finished blocking") } }
explode_data.jsonl/3557
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1988 }
[ 2830, 3393, 4571, 2859, 1155, 353, 8840, 836, 8, 341, 5195, 3612, 11, 8358, 4646, 11, 10995, 11, 1013, 11, 342, 4923, 74, 1669, 6505, 1155, 692, 197, 34989, 1669, 609, 4923, 74, 515, 197, 24804, 25, 342, 4923, 74, 345, 197, 15710, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestStartHttpServer(t *testing.T) { s := Server{ ListenPort: ":9090", MetricsPath: "/metrics", Handler: http.HandlerFunc(index), } ErrorMessages := make(chan error) go func() { //Block port 9090 and attempt to start http server at 9090. if p1, err := net.Listen("tcp", "localhost:9090"); err == nil { defer p1.Close() } ErrorMessages <- s.Start() }() msg := <-ErrorMessages if msg != nil { t.Log("Trying to start http server in a port which is busy.") t.Log(msg) } }
explode_data.jsonl/64184
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 202 }
[ 2830, 3393, 3479, 2905, 5475, 1155, 353, 8840, 836, 8, 1476, 1903, 1669, 8422, 515, 197, 10675, 268, 7084, 25, 220, 13022, 24, 15, 24, 15, 756, 197, 9209, 13468, 1820, 25, 3521, 43262, 756, 197, 197, 3050, 25, 257, 1758, 89164, 7195...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestAccAWSVPC_coreMismatchedDiffs(t *testing.T) { var vpc ec2.Vpc resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, CheckDestroy: testAccCheckVpcDestroy, Steps: []resource.TestStep{ resource.TestStep{ Config: testMatchedDiffs, Check: resource.ComposeTestCheckFunc( testAccCheckVpcExists("aws_vpc.test", &vpc), testAccCheckVpcCidr(&vpc, "10.0.0.0/16"), resource.TestCheckResourceAttr( "aws_vpc.test", "cidr_block", "10.0.0.0/16"), ), }, }, }) }
explode_data.jsonl/50912
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 264 }
[ 2830, 3393, 14603, 36136, 53, 4872, 15467, 82572, 291, 35, 18852, 1155, 353, 8840, 836, 8, 341, 2405, 348, 3992, 11942, 17, 5058, 3992, 271, 50346, 8787, 1155, 11, 5101, 31363, 515, 197, 197, 4703, 3973, 25, 257, 2915, 368, 314, 1273,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestGetTransferSenderRecipient(t *testing.T) { testCases := []struct { name string packet channeltypes.Packet expSender string expRecipient string expError bool }{ { "empty packet", channeltypes.Packet{}, "", "", true, }, { "invalid packet data", channeltypes.Packet{ Data: ibctesting.MockFailPacketData, }, "", "", true, }, { "empty FungibleTokenPacketData", channeltypes.Packet{ Data: transfertypes.ModuleCdc.MustMarshalJSON( &transfertypes.FungibleTokenPacketData{}, ), }, "", "", true, }, { "invalid sender", channeltypes.Packet{ Data: transfertypes.ModuleCdc.MustMarshalJSON( &transfertypes.FungibleTokenPacketData{ Sender: "cosmos1", Receiver: "evmos1x2w87cvt5mqjncav4lxy8yfreynn273xn5335v", Amount: "123456", }, ), }, "", "", true, }, { "invalid recipient", channeltypes.Packet{ Data: transfertypes.ModuleCdc.MustMarshalJSON( &transfertypes.FungibleTokenPacketData{ Sender: "cosmos1qql8ag4cluz6r4dz28p3w00dnc9w8ueulg2gmc", Receiver: "evmos1", Amount: "123456", }, ), }, "", "", true, }, { "valid - cosmos sender, evmos recipient", channeltypes.Packet{ Data: transfertypes.ModuleCdc.MustMarshalJSON( &transfertypes.FungibleTokenPacketData{ Sender: "cosmos1qql8ag4cluz6r4dz28p3w00dnc9w8ueulg2gmc", Receiver: "evmos1x2w87cvt5mqjncav4lxy8yfreynn273xn5335v", Amount: "123456", }, ), }, "evmos1qql8ag4cluz6r4dz28p3w00dnc9w8ueuafmxps", "evmos1x2w87cvt5mqjncav4lxy8yfreynn273xn5335v", false, }, { "valid - evmos sender, cosmos recipient", channeltypes.Packet{ Data: transfertypes.ModuleCdc.MustMarshalJSON( &transfertypes.FungibleTokenPacketData{ Sender: "evmos1x2w87cvt5mqjncav4lxy8yfreynn273xn5335v", Receiver: "cosmos1qql8ag4cluz6r4dz28p3w00dnc9w8ueulg2gmc", Amount: "123456", }, ), }, "evmos1x2w87cvt5mqjncav4lxy8yfreynn273xn5335v", "evmos1qql8ag4cluz6r4dz28p3w00dnc9w8ueuafmxps", false, }, { "valid - osmosis sender, evmos recipient", channeltypes.Packet{ Data: transfertypes.ModuleCdc.MustMarshalJSON( &transfertypes.FungibleTokenPacketData{ Sender: "osmo1qql8ag4cluz6r4dz28p3w00dnc9w8ueuhnecd2", Receiver: "evmos1x2w87cvt5mqjncav4lxy8yfreynn273xn5335v", Amount: "123456", }, ), }, "evmos1qql8ag4cluz6r4dz28p3w00dnc9w8ueuafmxps", "evmos1x2w87cvt5mqjncav4lxy8yfreynn273xn5335v", false, }, } for _, tc := range testCases { sender, recipient, _, _, err := GetTransferSenderRecipient(tc.packet) if tc.expError { require.Error(t, err, tc.name) } else { require.NoError(t, err, tc.name) require.Equal(t, tc.expSender, sender.String()) require.Equal(t, tc.expRecipient, recipient.String()) } } }
explode_data.jsonl/59293
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1561 }
[ 2830, 3393, 1949, 21970, 20381, 74432, 1155, 353, 8840, 836, 8, 341, 18185, 37302, 1669, 3056, 1235, 341, 197, 11609, 260, 914, 198, 197, 68802, 981, 5496, 9242, 93971, 198, 197, 48558, 20381, 262, 914, 198, 197, 48558, 74432, 914, 198,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestLoopBackManager_GetDrivesList(t *testing.T) { var mockexec = &mocks.GoMockExecutor{} var manager = NewLoopBackManager(mockexec, "", "", logger) fakeDevicePath := "/dev/loop" manager.updateDevicesFromConfig() for i, device := range manager.devices { device.devicePath = fmt.Sprintf(fakeDevicePath+"%d", i) } indexOfDriveToOffline := 0 manager.devices[indexOfDriveToOffline].Removed = true drives, err := manager.GetDrivesList() assert.Nil(t, err) assert.Equal(t, defaultNumberOfDevices, len(drives)) assert.Equal(t, apiV1.DriveStatusOffline, drives[indexOfDriveToOffline].Status) }
explode_data.jsonl/73569
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 217 }
[ 2830, 3393, 14620, 3707, 2043, 13614, 8847, 1886, 852, 1155, 353, 8840, 836, 8, 341, 2405, 7860, 11748, 284, 609, 16712, 82, 67131, 11571, 25255, 16094, 2405, 6645, 284, 1532, 14620, 3707, 2043, 30389, 11748, 11, 7342, 7342, 5925, 340, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestIsInter(t *testing.T) { var v *Value v = &Value{data: interface{}("something")} assert.True(t, v.IsInter()) v = &Value{data: []interface{}{interface{}("something")}} assert.True(t, v.IsInterSlice()) }
explode_data.jsonl/23378
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 85 }
[ 2830, 3393, 3872, 3306, 1155, 353, 8840, 836, 8, 1476, 2405, 348, 353, 1130, 271, 5195, 284, 609, 1130, 90, 691, 25, 3749, 6257, 445, 33331, 42132, 6948, 32443, 1155, 11, 348, 4506, 3306, 12367, 5195, 284, 609, 1130, 90, 691, 25, 30...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestSetMacAddress(t *testing.T) { if testing.Short() { return } name := "testmac" mac := randMacAddr() if err := NetworkLinkAdd(name, "bridge"); err != nil { t.Fatal(err) } defer NetworkLinkDel(name) if err := SetMacAddress(name, mac); err != nil { t.Fatal(err) } iface, err := net.InterfaceByName(name) if err != nil { t.Fatal(err) } if iface.HardwareAddr.String() != mac { t.Fatalf("mac address %q does not match %q", iface.HardwareAddr, mac) } }
explode_data.jsonl/76212
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 198 }
[ 2830, 3393, 1649, 19552, 4286, 1155, 353, 8840, 836, 8, 341, 743, 7497, 55958, 368, 341, 197, 853, 198, 197, 630, 11609, 1669, 330, 1944, 11948, 698, 2109, 580, 1669, 10382, 19552, 13986, 2822, 743, 1848, 1669, 8141, 3939, 2212, 3153, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
6
func TestSokuonY(t *testing.T) { const want = "yyayyuyyo" for _, v := range []string{"っやっゆっよ", "ッヤッユッヨ"} { got, err := KanaToRomaji(v) assert.Equal(t, want, got) assert.Nil(t, err) } }
explode_data.jsonl/11354
{ "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, 50, 16493, 263, 56, 1155, 353, 8840, 836, 8, 341, 4777, 1366, 284, 330, 4807, 352, 88, 4076, 16032, 1837, 2023, 8358, 348, 1669, 2088, 3056, 917, 4913, 41791, 70189, 41791, 126786, 41791, 56880, 497, 330, 25204, 126454, 2520...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestECDSASign(t *testing.T) { t.Parallel() provider, _, cleanup := currentTestConfig.Provider(t) defer cleanup() k, err := provider.KeyGen(&bccsp.ECDSAKeyGenOpts{Temporary: false}) if err != nil { t.Fatalf("Failed generating ECDSA key [%s]", err) } msg := []byte("Hello World") digest, err := provider.Hash(msg, &bccsp.SHAOpts{}) if err != nil { t.Fatalf("Failed computing HASH [%s]", err) } signature, err := provider.Sign(k, digest, nil) if err != nil { t.Fatalf("Failed generating ECDSA signature [%s]", err) } if len(signature) == 0 { t.Fatal("Failed generating ECDSA key. Signature must be different from nil") } }
explode_data.jsonl/29262
{ "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, 7498, 5936, 1911, 622, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 741, 197, 19979, 11, 8358, 21290, 1669, 1482, 2271, 2648, 36208, 1155, 340, 16867, 21290, 2822, 16463, 11, 1848, 1669, 9109, 9610, 9967, 2099, 69018, 21...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
5
func TestBuild_WithSemVerRange(t *testing.T) { // Dependency version is the form of SemVer range checkBuildWithOptionalFields(t, "with-semver-range", chart.Dependency{ Version: ">=0.1.0", }) }
explode_data.jsonl/24402
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 73 }
[ 2830, 3393, 11066, 62, 2354, 29499, 10141, 6046, 1155, 353, 8840, 836, 8, 341, 197, 322, 32977, 2319, 374, 279, 1352, 315, 14248, 10141, 2088, 198, 25157, 11066, 2354, 15309, 8941, 1155, 11, 330, 4197, 69689, 423, 30508, 497, 9487, 4991...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestFromString003(t *testing.T) { t.Parallel() r, err := FromString(robotsText001) require.NoError(t, err) expectAllAgents(t, r, false, "/administrator/") expectAllAgents(t, r, true, "/paruram") }
explode_data.jsonl/51675
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 85 }
[ 2830, 3393, 44491, 15, 15, 18, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 741, 7000, 11, 1848, 1669, 5542, 703, 7, 60115, 1178, 15, 15, 16, 340, 17957, 35699, 1155, 11, 1848, 340, 24952, 2403, 91804, 1155, 11, 435, 11, 895, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
func TestClearMilestone(t *testing.T) { ts := httptest.NewTLSServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { if r.Method != http.MethodPatch { t.Errorf("Bad method: %s", r.Method) } if r.URL.Path != "/repos/k8s/kuber/issues/5" { t.Errorf("Bad request path: %s", r.URL.Path) } b, err := ioutil.ReadAll(r.Body) if err != nil { t.Fatalf("Could not read request body: %v", err) } var issue Issue if err := json.Unmarshal(b, &issue); err != nil { t.Errorf("Could not unmarshal request: %v", err) } else if issue.Milestone.Title != "" { t.Errorf("Milestone title not empty: %v", issue.Milestone.Title) } })) defer ts.Close() c := getClient(ts.URL) if err := c.ClearMilestone("k8s", "kuber", 5); err != nil { t.Errorf("Didn't expect error: %v", err) } }
explode_data.jsonl/6299
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 350 }
[ 2830, 3393, 14008, 44, 93028, 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, 43622, 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...
6
func TestKVGetStoppedServerAndClose(t *testing.T) { defer testutil.AfterTest(t) clus := integration.NewClusterV3(t, &integration.ClusterConfig{Size: 1}) defer clus.Terminate(t) cli := clus.Client(0) clus.Members[0].Stop(t) ctx, cancel := context.WithTimeout(context.TODO(), time.Second) // this Get fails and triggers an asynchronous connection retry _, err := cli.Get(ctx, "abc") cancel() if err != nil && !(isCanceled(err) || isClientTimeout(err)) { t.Fatal(err) } }
explode_data.jsonl/16412
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 185 }
[ 2830, 3393, 82707, 1949, 59803, 5475, 3036, 7925, 1155, 353, 8840, 836, 8, 341, 16867, 1273, 1314, 36892, 2271, 1155, 692, 197, 4163, 1669, 17590, 7121, 28678, 53, 18, 1155, 11, 609, 60168, 72883, 2648, 90, 1695, 25, 220, 16, 3518, 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...
4
func TestServer_StartStop(t *testing.T) { s := makeService(t) serv, err := NewServer(&Config{Zone: s}) if err != nil { t.Fatalf("err: %v", err) } defer serv.Shutdown() }
explode_data.jsonl/6143
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 74 }
[ 2830, 3393, 5475, 38056, 10674, 1155, 353, 8840, 836, 8, 341, 1903, 1669, 1281, 1860, 1155, 340, 1903, 648, 11, 1848, 1669, 1532, 5475, 2099, 2648, 90, 15363, 25, 274, 3518, 743, 1848, 961, 2092, 341, 197, 3244, 30762, 445, 615, 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 ]
2
func TestGetSingleChangedKafkaSizeAndPurpose(t *testing.T) { helper := func(brokerSize, zookeeperSize, expectedNewSize string, dedicatedZookeeper, expectErr bool, expectedNodePurpose NodePurpose) { newSize, nodePurpose, err := getSingleChangedKafkaSizeAndPurpose(brokerSize, zookeeperSize, dedicatedZookeeper) if expectErr { if err == nil { t.Fatalf("expect error when using brokerSize: %s, zookeeperSize: %s, dedicatedZookeeper: %t", brokerSize, zookeeperSize, dedicatedZookeeper) } else { return } } if err != nil { t.Fatalf("got unexpected error: %s when using brokerSize: %s, zookeeperSize: %s, dedicatedZookeeper: %t", err.Error(), brokerSize, zookeeperSize, dedicatedZookeeper) } if newSize != expectedNewSize { t.Fatalf("newSize should be %s when using brokerSize: %s, zookeeperSize: %s, dedicatedZookeeper: %t", expectedNewSize, brokerSize, zookeeperSize, dedicatedZookeeper) } if nodePurpose.String() != expectedNodePurpose.String() { t.Fatalf("nodePurpose should be %s when using brokerSize: %s, zookeeperSize: %s, dedicatedZookeeper: %t", expectedNodePurpose, brokerSize, zookeeperSize, dedicatedZookeeper) } } helper("t3.small-v2", "t3.small-v2", "t3.small-v2", false, true, KAFKA_BROKER) helper("t3.small-v2", "t3.small-v2", "t3.small-v2", true, true, KAFKA_BROKER) helper("t3.small-v2", "", "t3.small-v2", false, false, KAFKA_BROKER) helper("t3.small-v2", "", "t3.small-v2", true, false, KAFKA_BROKER) helper("", "t3.small-v2", "t3.small-v2", true, false, KAFKA_DEDICATED_ZOOKEEPER) }
explode_data.jsonl/3826
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 621 }
[ 2830, 3393, 1949, 10888, 5389, 42, 21883, 1695, 3036, 74033, 1155, 353, 8840, 836, 8, 341, 9598, 2947, 1669, 2915, 1883, 45985, 1695, 11, 40914, 18861, 1695, 11, 3601, 3564, 1695, 914, 11, 12235, 57, 94171, 11, 1720, 7747, 1807, 11, 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...
6
func TestSNMPReader_getProperty_filter(t *testing.T) { var snmpClient network.MockSNMPClient ctx := network.NewContextWithDeviceConnection(context.Background(), &network.RequestDeviceConnection{ SNMP: &network.RequestDeviceConnectionSNMP{ SnmpClient: &snmpClient, }, }) snmpClient. On("SNMPWalk", ctx, "1"). Return([]network.SNMPResponse{ network.NewSNMPResponse("1.1", gosnmp.OctetString, "1"), network.NewSNMPResponse("1.2", gosnmp.OctetString, "2"), network.NewSNMPResponse("1.3", gosnmp.OctetString, "3"), }, nil). On("SNMPWalk", ctx, "2"). Return([]network.SNMPResponse{ network.NewSNMPResponse("2.1", gosnmp.OctetString, "Port 1"), network.NewSNMPResponse("2.2", gosnmp.OctetString, "Port 2"), network.NewSNMPResponse("2.3", gosnmp.OctetString, "Port 3"), }, nil) sut := baseReader{ reader: &snmpReader{ oids: &deviceClassOIDs{ "ifIndex": &deviceClassOID{ SNMPGetConfiguration: network.SNMPGetConfiguration{ OID: "1", }, }, "ifDescr": &deviceClassOID{ SNMPGetConfiguration: network.SNMPGetConfiguration{ OID: "2", }, }, }, }, } expectedPropertyGroups := PropertyGroups{ propertyGroup{ "ifIndex": value.New(1), "ifDescr": value.New("Port 1"), }, propertyGroup{ "ifIndex": value.New(3), "ifDescr": value.New("Port 3"), }, } expectedIndices := []value.Value{ value.New(1), value.New(3), } res, indices, err := sut.GetProperty(ctx, &groupFilter{ key: "ifDescr", regex: "2", }) if assert.NoError(t, err) { assert.Equal(t, expectedPropertyGroups, res) assert.Equal(t, expectedIndices, indices) } }
explode_data.jsonl/68087
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 726 }
[ 2830, 3393, 18966, 5781, 5062, 3062, 3052, 8727, 1155, 353, 8840, 836, 8, 341, 2405, 4131, 1307, 2959, 3922, 24664, 18966, 5781, 2959, 198, 20985, 1669, 3922, 7121, 1972, 2354, 6985, 4526, 5378, 19047, 1507, 609, 17511, 9659, 6985, 4526, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestExecuteProgram(t *testing.T) { testCases := []struct { name string program string input *[]byte inputFormat string outputFormat string programArgs ProgramArguments expectedOutput string }{ { name: "null input simple program", program: ".", input: nil, expectedOutput: "null\n", inputFormat: "json", outputFormat: "json", }, } for _, testCase := range testCases { testCase := testCase t.Run(testCase.name, func(t *testing.T) { encoder, _ := formats.ByName(testCase.outputFormat) var outputBuf bytes.Buffer err := ExecuteProgram(testCase.input, testCase.program, testCase.programArgs, &outputBuf, encoder, OutputConfig{}) if err != nil { t.Errorf("expected no err, got %#v", err) } output := outputBuf.String() if output != testCase.expectedOutput { t.Errorf("incorrect output expected=%s, got=%s", testCase.expectedOutput, output) } }) } }
explode_data.jsonl/23234
{ "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, 17174, 10690, 1155, 353, 8840, 836, 8, 341, 18185, 37302, 1669, 3056, 1235, 341, 197, 11609, 1843, 914, 198, 197, 197, 14906, 286, 914, 198, 197, 22427, 688, 353, 1294, 3782, 198, 197, 22427, 4061, 262, 914, 198, 197, 2117...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestConvertUserToBot(t *testing.T) { th := Setup(t).InitBasic() defer th.TearDown() bot, resp, err := th.Client.ConvertUserToBot(th.BasicUser.Id) require.Error(t, err) CheckForbiddenStatus(t, resp) require.Nil(t, bot) th.TestForSystemAdminAndLocal(t, func(t *testing.T, client *model.Client4) { user := model.User{Email: th.GenerateTestEmail(), Username: GenerateTestUsername(), Password: "password"} ruser, resp, err := client.CreateUser(&user) require.NoError(t, err) CheckCreatedStatus(t, resp) bot, _, err = client.ConvertUserToBot(ruser.Id) require.NoError(t, err) require.NotNil(t, bot) require.Equal(t, bot.UserId, ruser.Id) bot, _, err = client.GetBot(bot.UserId, "") require.NoError(t, err) require.NotNil(t, bot) }) }
explode_data.jsonl/47566
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 311 }
[ 2830, 3393, 12012, 1474, 1249, 23502, 1155, 353, 8840, 836, 8, 341, 70479, 1669, 18626, 1155, 568, 3803, 15944, 741, 16867, 270, 836, 682, 4454, 2822, 2233, 354, 11, 9039, 11, 1848, 1669, 270, 11716, 36179, 1474, 1249, 23502, 24365, 488...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestInitCopyChunkerParams(t *testing.T) { env, cleanup := withTestEnvironment(t) defer cleanup() env2, cleanup2 := withTestEnvironment(t) defer cleanup2() testRunInit(t, env2.gopts) initOpts := InitOptions{ secondaryRepoOptions: secondaryRepoOptions{ Repo: env2.gopts.Repo, password: env2.gopts.password, }, } rtest.Assert(t, runInit(initOpts, env.gopts, nil) != nil, "expected invalid init options to fail") initOpts.CopyChunkerParameters = true rtest.OK(t, runInit(initOpts, env.gopts, nil)) repo, err := OpenRepository(env.gopts) rtest.OK(t, err) otherRepo, err := OpenRepository(env2.gopts) rtest.OK(t, err) rtest.Assert(t, repo.Config().ChunkerPolynomial == otherRepo.Config().ChunkerPolynomial, "expected equal chunker polynomials, got %v expected %v", repo.Config().ChunkerPolynomial, otherRepo.Config().ChunkerPolynomial) }
explode_data.jsonl/43553
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 344 }
[ 2830, 3393, 3803, 12106, 28304, 261, 4870, 1155, 353, 8840, 836, 8, 341, 57538, 11, 21290, 1669, 448, 2271, 12723, 1155, 340, 16867, 21290, 741, 57538, 17, 11, 21290, 17, 1669, 448, 2271, 12723, 1155, 340, 16867, 21290, 17, 2822, 18185,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestDiscoverTelemetryEndpointAfterPollEndpointCacheHit(t *testing.T) { mockCtrl := gomock.NewController(t) defer mockCtrl.Finish() mockSDK := mock_api.NewMockECSSDK(mockCtrl) pollEndpoinCache := async.NewLRUCache(1, 10*time.Minute) client := &APIECSClient{ credentialProvider: credentials.AnonymousCredentials, config: &config.Config{ Cluster: configuredCluster, AWSRegion: "us-east-1", }, standardClient: mockSDK, ec2metadata: ec2.NewBlackholeEC2MetadataClient(), pollEndpoinCache: pollEndpoinCache, } pollEndpoint := "http://127.0.0.1" mockSDK.EXPECT().DiscoverPollEndpoint(gomock.Any()).Return( &ecs.DiscoverPollEndpointOutput{ Endpoint: &pollEndpoint, TelemetryEndpoint: &pollEndpoint, }, nil) endpoint, err := client.DiscoverPollEndpoint("containerInstance") if err != nil { t.Fatalf("Error in discoverPollEndpoint: %v", err) } if endpoint != pollEndpoint { t.Errorf("Mismatch in poll endpoint: %s", endpoint) } telemetryEndpoint, err := client.DiscoverTelemetryEndpoint("containerInstance") if err != nil { t.Fatalf("Error in discoverTelemetryEndpoint: %v", err) } if telemetryEndpoint != pollEndpoint { t.Errorf("Mismatch in poll endpoint: %s", endpoint) } }
explode_data.jsonl/61454
{ "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, 50002, 6639, 35958, 27380, 6025, 49207, 27380, 8233, 19498, 1155, 353, 8840, 836, 8, 341, 77333, 15001, 1669, 342, 316, 1176, 7121, 2051, 1155, 340, 16867, 7860, 15001, 991, 18176, 2822, 77333, 31534, 1669, 7860, 11697, 7121, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestBalance_InvalidAddress(t *testing.T) { mockJSONRPC := &mocks.JSONRPC{} mockGraphQL := &mocks.GraphQL{} c := &Client{ c: mockJSONRPC, g: mockGraphQL, traceSemaphore: semaphore.NewWeighted(100), } ctx := context.Background() mockJSONRPC.On( "CallContext", ctx, mock.Anything, "eth_getBlockByNumber", "latest", false, ).Return( nil, ).Run( func(args mock.Arguments) { r := args.Get(1).(*json.RawMessage) file, err := ioutil.ReadFile("testdata/block_10992.json") assert.NoError(t, err) *r = json.RawMessage(file) }, ).Once() mockJSONRPC.On( "BatchCallContext", ctx, mock.MatchedBy(func(rpcs []rpc.BatchElem) bool { return len(rpcs) == 3 && rpcs[0].Method == "eth_getBalance" && rpcs[1].Method == "eth_getTransactionCount" && rpcs[2].Method == "eth_getCode" }), ).Return( nil, ).Run( func(args mock.Arguments) { r := args.Get(1).([]rpc.BatchElem) assert.Len(t, r, 3) r[0].Error = fmt.Errorf("invalid argument 0") }, ).Once() resp, err := c.Balance( ctx, &RosettaTypes.AccountIdentifier{ Address: "0x4cfc400fed52f9681b42454c2db4b18ab98f8de", }, nil, ) assert.Nil(t, resp) assert.Error(t, err) mockJSONRPC.AssertExpectations(t) mockGraphQL.AssertExpectations(t) }
explode_data.jsonl/55492
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 617 }
[ 2830, 3393, 21190, 62, 7928, 4286, 1155, 353, 8840, 836, 8, 341, 77333, 5370, 29528, 1669, 609, 16712, 82, 18009, 29528, 16094, 77333, 88637, 1669, 609, 16712, 82, 40237, 3588, 31483, 1444, 1669, 609, 2959, 515, 197, 1444, 25, 1060, 786...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestAdd(t *testing.T) { tpl := `{{ 3 | add 1 2}}` if err := runt(tpl, `6`); err != nil { t.Error(err) } }
explode_data.jsonl/82265
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 58 }
[ 2830, 3393, 2212, 1155, 353, 8840, 836, 8, 341, 3244, 500, 1669, 1565, 2979, 220, 18, 760, 912, 220, 16, 220, 17, 3417, 3989, 743, 1848, 1669, 1598, 83, 1155, 500, 11, 1565, 21, 63, 1215, 1848, 961, 2092, 341, 197, 3244, 6141, 396...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestPairPriority(t *testing.T) { for _, tc := range []struct { G, D int Value int64 }{ {0, 0, 0}, {1, 1, 4294967298}, {1, 2, 4294967300}, {2, 1, 4294967301}, } { t.Run(fmt.Sprintf("%d_%d", tc.G, tc.D), func(t *testing.T) { if v := PairPriority(tc.G, tc.D); v != tc.Value { t.Errorf("%d (got) != %d (expected)", v, tc.Value) } }) } }
explode_data.jsonl/9179
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 197 }
[ 2830, 3393, 12443, 20555, 1155, 353, 8840, 836, 8, 341, 2023, 8358, 17130, 1669, 2088, 3056, 1235, 341, 197, 9600, 11, 422, 220, 526, 198, 197, 47399, 526, 21, 19, 198, 197, 59403, 197, 197, 90, 15, 11, 220, 15, 11, 220, 15, 1583,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestSumPerKeyWithPartitionsAddsNoiseInt(t *testing.T) { for _, tc := range []struct { desc string noiseKind NoiseKind epsilon float64 delta float64 inMemory bool }{ // Epsilon and delta are not split because partitions are public. All of them are used for the noise. { desc: "as PCollection w/ Gaussian", noiseKind: GaussianNoise{}, epsilon: 1e-15, delta: 1e-15, inMemory: false, }, { desc: "as slice w/ Gaussian", noiseKind: GaussianNoise{}, epsilon: 1e-15, delta: 1e-15, inMemory: false, }, { desc: "as PCollection w/ Laplace", noiseKind: LaplaceNoise{}, epsilon: 1e-15, delta: 0, // It is 0 because partitions are public and we are using Laplace noise. inMemory: true, }, { desc: "as slice w/ Laplace", noiseKind: LaplaceNoise{}, epsilon: 1e-15, delta: 0, // It is 0 because partitions are public and we are using Laplace noise. inMemory: true, }, } { // Because this is an integer aggregation, we can't use the regular complementary // tolerance computations. Instead, we do the following: // // If generated noise is between -0.5 and 0.5, it will be rounded to 0 and the // test will fail. For Laplace, this will happen with probability // P ~= Laplace_CDF(0.5) - Laplace_CDF(-0.5). // Given that Laplace scale = l1_sensitivity / ε = 10¹⁵, P ~= 5e-16. // For Gaussian, this will happen with probability // P ~= Gaussian_CDF(0.5) - Gaussian_CDF(-0.5). // For given ε=1e-15, δ=1e-15 => sigma = 261134011596800, P ~= 1e-15. // // Since no partitions selection / thresholding happens, numIDs doesn't depend // on ε & δ. We can use arbitrarily small ε & δ. tolerance := 0.0 l0Sensitivity, minValue, maxValue := int64(1), 0.0, 1.0 numIDs := 10 // triples contains {1,0,1}, {2,0,1}, …, {10,0,1}. triples := testutils.MakeSampleTripleWithIntValue(numIDs, 0) p, s, col := ptest.CreateList(triples) col = beam.ParDo(s, testutils.ExtractIDFromTripleWithIntValue, col) publicPartitionsSlice := []int{1, 2, 3, 4, 5, 6, 7, 8, 9, 10} var publicPartitions interface{} if tc.inMemory { publicPartitions = publicPartitionsSlice } else { publicPartitions = beam.CreateList(s, publicPartitionsSlice) } pcol := MakePrivate(s, col, NewPrivacySpec(tc.epsilon, tc.delta)) pcol = ParDo(s, testutils.TripleWithIntValueToKV, pcol) sumParams := SumParams{MaxPartitionsContributed: l0Sensitivity, MinValue: minValue, MaxValue: maxValue, NoiseKind: tc.noiseKind, PublicPartitions: publicPartitions} got := SumPerKey(s, pcol, sumParams) got = beam.ParDo(s, testutils.KVToInt64Metric, got) testutils.CheckInt64MetricsAreNoisy(s, got, numIDs, tolerance) if err := ptest.Run(p); err != nil { t.Errorf("SumPerKey with public partitions %s didn't add any noise with int inputs: %v", tc.desc, err) } } }
explode_data.jsonl/42963
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1204 }
[ 2830, 3393, 9190, 3889, 1592, 2354, 5800, 5930, 72111, 61819, 1072, 1155, 353, 8840, 836, 8, 341, 2023, 8358, 17130, 1669, 2088, 3056, 1235, 341, 197, 41653, 414, 914, 198, 197, 197, 52218, 10629, 50523, 10629, 198, 197, 197, 31767, 256...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestGameServerAllocationMetaDataPatch(t *testing.T) { t.Parallel() gs := defaultGameServer(defaultNs) gs.ObjectMeta.Labels = map[string]string{"test": t.Name()} gs, err := framework.CreateGameServerAndWaitUntilReady(defaultNs, gs) if !assert.Nil(t, err) { assert.FailNow(t, "could not create GameServer") } defer framework.AgonesClient.AgonesV1().GameServers(defaultNs).Delete(gs.ObjectMeta.Name, nil) // nolint: errcheck gsa := &allocationv1.GameServerAllocation{ObjectMeta: metav1.ObjectMeta{GenerateName: "allocation-"}, Spec: allocationv1.GameServerAllocationSpec{ Required: metav1.LabelSelector{MatchLabels: map[string]string{"test": t.Name()}}, MetaPatch: allocationv1.MetaPatch{ Labels: map[string]string{"red": "blue"}, Annotations: map[string]string{"dog": "good"}, }, }} err = wait.PollImmediate(time.Second, 30*time.Second, func() (bool, error) { gsa, err = framework.AgonesClient.AllocationV1().GameServerAllocations(defaultNs).Create(gsa.DeepCopy()) if err != nil { return true, err } return allocationv1.GameServerAllocationAllocated == gsa.Status.State, nil }) if err != nil { assert.FailNow(t, err.Error()) } gs, err = framework.AgonesClient.AgonesV1().GameServers(defaultNs).Get(gsa.Status.GameServerName, metav1.GetOptions{}) if assert.Nil(t, err) { assert.Equal(t, "blue", gs.ObjectMeta.Labels["red"]) assert.Equal(t, "good", gs.ObjectMeta.Annotations["dog"]) } }
explode_data.jsonl/63309
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 546 }
[ 2830, 3393, 4868, 5475, 78316, 37307, 43622, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 2822, 3174, 82, 1669, 1638, 4868, 5475, 18978, 47360, 340, 3174, 82, 80222, 4679, 82, 284, 2415, 14032, 30953, 4913, 1944, 788, 259, 2967, 368...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestServiceDiscoveryNamespaces(t *testing.T) { n, c := makeDiscovery(RoleService, NamespaceDiscovery{Names: []string{"ns1", "ns2"}}) k8sDiscoveryTest{ discovery: n, afterStart: func() { for _, ns := range []string{"ns1", "ns2"} { obj := makeService() obj.Namespace = ns c.CoreV1().Services(obj.Namespace).Create(obj) } }, expectedMaxItems: 2, expectedRes: map[string]*targetgroup.Group{ "svc/ns1/testservice": { Targets: []model.LabelSet{ { "__meta_kubernetes_service_port_protocol": "TCP", "__address__": "testservice.ns1.svc:30900", "__meta_kubernetes_service_cluster_ip": "10.0.0.1", "__meta_kubernetes_service_port_name": "testport", }, }, Labels: model.LabelSet{ "__meta_kubernetes_service_name": "testservice", "__meta_kubernetes_namespace": "ns1", }, Source: "svc/ns1/testservice", }, "svc/ns2/testservice": { Targets: []model.LabelSet{ { "__meta_kubernetes_service_port_protocol": "TCP", "__address__": "testservice.ns2.svc:30900", "__meta_kubernetes_service_cluster_ip": "10.0.0.1", "__meta_kubernetes_service_port_name": "testport", }, }, Labels: model.LabelSet{ "__meta_kubernetes_service_name": "testservice", "__meta_kubernetes_namespace": "ns2", }, Source: "svc/ns2/testservice", }, }, }.Run(t) }
explode_data.jsonl/21244
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 734 }
[ 2830, 3393, 1860, 67400, 7980, 27338, 1155, 353, 8840, 836, 8, 341, 9038, 11, 272, 1669, 1281, 67400, 73443, 1860, 11, 41962, 67400, 90, 7980, 25, 3056, 917, 4913, 4412, 16, 497, 330, 4412, 17, 30975, 692, 16463, 23, 82, 67400, 2271, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestSubtreeShared(t *testing.T) { if os.Getuid() != 0 { t.Skip("root required") } tmp := path.Join(os.TempDir(), "mount-tests") if err := os.MkdirAll(tmp, 0777); err != nil { t.Fatal(err) } defer os.RemoveAll(tmp) var ( sourceDir = path.Join(tmp, "source") targetDir = path.Join(tmp, "target") outsideDir = path.Join(tmp, "outside") outsidePath = path.Join(outsideDir, "file.txt") sourceCheckPath = path.Join(sourceDir, "a", "file.txt") ) if err := os.MkdirAll(path.Join(sourceDir, "a"), 0777); err != nil { t.Fatal(err) } if err := os.Mkdir(targetDir, 0777); err != nil { t.Fatal(err) } if err := os.Mkdir(outsideDir, 0777); err != nil { t.Fatal(err) } if err := createFile(outsidePath); err != nil { t.Fatal(err) } // mount the source as shared if err := MakeShared(sourceDir); err != nil { t.Fatal(err) } defer func() { if err := Unmount(sourceDir); err != nil { t.Fatal(err) } }() // mount the shared directory to a target if err := Mount(sourceDir, targetDir, "none", "bind,rw"); err != nil { t.Fatal(err) } defer func() { if err := Unmount(targetDir); err != nil { t.Fatal(err) } }() // mount in an outside path to a mounted path inside the target if err := Mount(outsideDir, path.Join(targetDir, "a"), "none", "bind,rw"); err != nil { t.Fatal(err) } defer func() { if err := Unmount(path.Join(targetDir, "a")); err != nil { t.Fatal(err) } }() // NOW, check that the file from the outside directory is available in the source directory if _, err := os.Stat(sourceCheckPath); err != nil { t.Fatal(err) } }
explode_data.jsonl/16598
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 669 }
[ 2830, 3393, 3136, 9344, 16997, 1155, 353, 8840, 836, 8, 341, 743, 2643, 2234, 2423, 368, 961, 220, 15, 341, 197, 3244, 57776, 445, 2888, 2567, 1138, 197, 630, 20082, 1669, 1815, 22363, 9638, 65009, 6184, 1507, 330, 16557, 81094, 1138, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestSimpleParsing(t *testing.T) { bigMsg := bytes.Repeat([]byte{'x'}, 1<<24) for _, test := range []struct { // input p []byte // outputs err error b []byte pt payloadFormat }{ {nil, io.EOF, nil, compressionNone}, {[]byte{0, 0, 0, 0, 0}, nil, nil, compressionNone}, {[]byte{0, 0, 0, 0, 1, 'a'}, nil, []byte{'a'}, compressionNone}, {[]byte{1, 0}, io.ErrUnexpectedEOF, nil, compressionNone}, {[]byte{0, 0, 0, 0, 10, 'a'}, io.ErrUnexpectedEOF, nil, compressionNone}, // Check that messages with length >= 2^24 are parsed. {append([]byte{0, 1, 0, 0, 0}, bigMsg...), nil, bigMsg, compressionNone}, } { buf := fullReader{bytes.NewReader(test.p)} parser := &parser{r: buf} pt, b, err := parser.recvMsg(math.MaxInt32) if err != test.err || !bytes.Equal(b, test.b) || pt != test.pt { t.Fatalf("parser{%v}.recvMsg(_) = %v, %v, %v\nwant %v, %v, %v", test.p, pt, b, err, test.pt, test.b, test.err) } } }
explode_data.jsonl/1896
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 418 }
[ 2830, 3393, 16374, 68839, 1155, 353, 8840, 836, 8, 341, 2233, 343, 6611, 1669, 5820, 2817, 10979, 10556, 3782, 13608, 87, 24731, 220, 16, 2442, 17, 19, 340, 2023, 8358, 1273, 1669, 2088, 3056, 1235, 341, 197, 197, 322, 1946, 198, 197,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
5
func TestDiagnostics_Get(t *testing.T) { client, mux, teardown := setup() defer teardown() path := fmt.Sprintf("/groups/%s/diagnostics", groupID) mux.HandleFunc(path, func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, http.MethodGet) _, _ = fmt.Fprint(w, "test") }) buf := new(bytes.Buffer) _, err := client.Diagnostics.Get(ctx, groupID, nil, buf) if err != nil { t.Fatalf("Diagnostics.Get returned error: %v", err) } if buf.String() != "test" { t.Fatalf("Diagnostics.Get returned error: %v", err) } }
explode_data.jsonl/50743
{ "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, 35, 18938, 13614, 1155, 353, 8840, 836, 8, 341, 25291, 11, 59807, 11, 49304, 1669, 6505, 741, 16867, 49304, 2822, 26781, 1669, 8879, 17305, 4283, 16753, 12627, 82, 3446, 18938, 497, 1874, 915, 692, 2109, 2200, 63623, 5581, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestMessageTransaction_GetHashableBytes(t *testing.T) { xmss := helper.GetAliceXMSS(6) message := "Hello World!!!" fee := uint64(1) xmssPK := misc.UCharVectorToBytes(xmss.PK()) messageTx := NewTestMessageTransaction(message, fee, xmssPK, nil) hashableBytes := "cd00dc04142a981d9b1a6cf671c76a5f134c1264cf6f9e18048c66a6ba149b16" assert.NotNil(t, messageTx.tx) assert.Equal(t, misc.Bin2HStr(messageTx.tx.GetHashableBytes()), hashableBytes) }
explode_data.jsonl/10383
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 189 }
[ 2830, 3393, 2052, 8070, 13614, 6370, 480, 7078, 1155, 353, 8840, 836, 8, 341, 10225, 76, 778, 1669, 13137, 2234, 61686, 52337, 1220, 7, 21, 340, 24753, 1669, 330, 9707, 4337, 12069, 698, 1166, 2127, 1669, 2622, 21, 19, 7, 16, 340, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestReaderPartitionWhenConsumerGroupsEnabled(t *testing.T) { invoke := func() (boom bool) { defer func() { if r := recover(); r != nil { boom = true } }() NewReader(ReaderConfig{ GroupID: "set", Partition: 1, }) return false } if !invoke() { t.Fatalf("expected panic; but NewReader worked?!") } }
explode_data.jsonl/80372
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 142 }
[ 2830, 3393, 5062, 49978, 4498, 29968, 22173, 5462, 1155, 353, 8840, 836, 8, 341, 17430, 7621, 1669, 2915, 368, 320, 95316, 1807, 8, 341, 197, 16867, 2915, 368, 341, 298, 743, 435, 1669, 11731, 2129, 435, 961, 2092, 341, 571, 197, 9531...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestWrite_Progress(t *testing.T) { img, err := random.Image(100000, 10) if err != nil { t.Fatal(err) } c := make(chan v1.Update, 200) // Set up a fake registry. s := httptest.NewServer(registry.New()) defer s.Close() u, err := url.Parse(s.URL) if err != nil { t.Fatal(err) } dst := fmt.Sprintf("%s/test/progress/upload", u.Host) ref, err := name.ParseReference(dst) if err != nil { t.Fatal(err) } if err := Write(ref, img, WithProgress(c)); err != nil { t.Fatalf("Write: %v", err) } if err := checkUpdates(c); err != nil { t.Fatal(err) } }
explode_data.jsonl/76474
{ "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, 7985, 16670, 2483, 1155, 353, 8840, 836, 8, 341, 39162, 11, 1848, 1669, 4194, 7528, 7, 16, 15, 15, 15, 15, 15, 11, 220, 16, 15, 340, 743, 1848, 961, 2092, 341, 197, 3244, 26133, 3964, 340, 197, 532, 1444, 1669, 1281, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestUpdateOrderbook(t *testing.T) { t.Parallel() cp := currency.NewPairWithDelimiter("BTC", "USDT", "/") _, err := c.UpdateOrderbook(cp, asset.Spot) if err != nil { t.Error(err) } _, err = c.UpdateOrderbook(cp, asset.PerpetualSwap) if err != nil { t.Error(err) } }
explode_data.jsonl/42936
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 122 }
[ 2830, 3393, 4289, 4431, 2190, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 741, 52018, 1669, 11413, 7121, 12443, 2354, 91098, 445, 59118, 497, 330, 2034, 10599, 497, 3521, 1138, 197, 6878, 1848, 1669, 272, 16689, 4431, 2190, 44075, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestFlattenNodes(t *testing.T) { for _, tt := range []struct { desc string conf config.Config expect map[string]*nodePing }{ { desc: "Flatten common address between storages", conf: config.Config{ VirtualStorages: []*config.VirtualStorage{ { Name: "meow", Nodes: []*models.Node{ { Storage: "foo", Address: "tcp://example.com", Token: "abc", DefaultPrimary: true, }, }, }, { Name: "woof", Nodes: []*models.Node{ { Storage: "bar", Address: "tcp://example.com", Token: "abc", DefaultPrimary: true, }, }, }, }, }, expect: map[string]*nodePing{ "tcp://example.com": &nodePing{ address: "tcp://example.com", storages: map[string]struct{}{ "foo": struct{}{}, "bar": struct{}{}, }, vStorages: map[string]struct{}{ "meow": struct{}{}, "woof": struct{}{}, }, token: "abc", }, }, }, } { t.Run(tt.desc, func(t *testing.T) { actual := flattenNodes(tt.conf) require.Equal(t, tt.expect, actual) }) } }
explode_data.jsonl/8632
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 669 }
[ 2830, 3393, 3882, 14456, 12288, 1155, 353, 8840, 836, 8, 341, 2023, 8358, 17853, 1669, 2088, 3056, 1235, 341, 197, 41653, 256, 914, 198, 197, 67850, 256, 2193, 10753, 198, 197, 24952, 2415, 14032, 8465, 3509, 69883, 198, 197, 59403, 197...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestIssue11648(t *testing.T) { store, clean := testkit.CreateMockStore(t) defer clean() tk := testkit.NewTestKit(t, store) tk.MustExec("use test") tk.MustExec("drop table if exists t") tk.MustExec("create table t (id int NOT NULL DEFAULT 8);") tk.MustExec("SET sql_mode = '';") tk.MustExec("insert into t values (1), (NULL), (2);") tk.MustQuery("show warnings").Check(testkit.Rows("Warning 1048 Column 'id' cannot be null")) tk.MustQuery("select * from t").Check(testkit.Rows("1", "0", "2")) }
explode_data.jsonl/65437
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 188 }
[ 2830, 3393, 42006, 16, 16, 21, 19, 23, 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 TestForwardProbeLabels(t *testing.T) { pr := NewForwardProbe("a.b.c.exaMple.cOm") iter := pr.Begin() z := pr.Zone(iter) if z != "b.c.example.com." { t.Error("Initial zone wrong", z) } z = pr.Zone(iter) // Shouldn't change unless iter is incremented if z != "b.c.example.com." { t.Error("Initial zone wrong", z) } lastZone := "" for iter = pr.Begin(); iter != pr.End(); iter = pr.Next(iter) { lastZone = pr.Zone(iter) } if lastZone != "com." { t.Error("Typical 'for loop' usaged failed", lastZone) } z = pr.Zone(pr.End()) if z != "" { t.Error("Post 'for loop' returned non-empty string", z) } iter = pr.Begin() z = pr.Zone(iter) if z != "b.c.example.com." { t.Error("Reset didn't", z) } }
explode_data.jsonl/14932
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 311 }
[ 2830, 3393, 25925, 81426, 23674, 1155, 353, 8840, 836, 8, 341, 25653, 1669, 1532, 25925, 81426, 445, 64, 948, 520, 2223, 64, 44, 694, 520, 63488, 1138, 79924, 1669, 548, 28467, 741, 20832, 1669, 548, 13476, 603, 27070, 340, 743, 1147, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestLoadDaemonConfigWithTrueDefaultValues(t *testing.T) { content := `{ "userland-proxy": false }` tempFile := tempfile.NewTempFile(t, "config", content) defer tempFile.Remove() opts := defaultOptions(tempFile.Name()) loadedConfig, err := loadDaemonCliConfig(opts) assert.NilError(t, err) assert.NotNil(t, loadedConfig) assert.NotNil(t, loadedConfig.ClusterOpts) assert.Equal(t, loadedConfig.EnableUserlandProxy, false) // make sure reloading doesn't generate configuration // conflicts after normalizing boolean values. reload := func(reloadedConfig *config.Config) { assert.Equal(t, reloadedConfig.EnableUserlandProxy, false) } assert.NilError(t, config.Reload(opts.configFile, opts.flags, reload)) }
explode_data.jsonl/12067
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 244 }
[ 2830, 3393, 5879, 89177, 2648, 2354, 2514, 3675, 6227, 1155, 353, 8840, 836, 8, 341, 27751, 1669, 53692, 330, 872, 1933, 83701, 788, 895, 335, 3989, 16280, 1703, 1669, 54819, 7121, 12151, 1703, 1155, 11, 330, 1676, 497, 2213, 340, 16867...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1