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 TestUpdateEventUpdateLocalClusterObj(t *testing.T) { oldVersion := "123" newVersion := "321" oldObj := &api.EtcdCluster{ TypeMeta: metav1.TypeMeta{ APIVersion: api.SchemeGroupVersion.String(), }, ObjectMeta: metav1.ObjectMeta{ ResourceVersion: oldVersion, Name: "test", Namespace: metav1.NamespaceDefault, }, } newObj := oldObj.DeepCopy() newObj.ResourceVersion = newVersion c := &Cluster{ cluster: oldObj, } e := &clusterEvent{ typ: eventModifyCluster, cluster: newObj, } err := c.handleUpdateEvent(e) if err != nil { t.Fatal(err) } if c.cluster.ResourceVersion != newVersion { t.Errorf("expect version=%s, get=%s", newVersion, c.cluster.ResourceVersion) } }
explode_data.jsonl/57630
{ "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, 4289, 1556, 4289, 7319, 28678, 5261, 1155, 353, 8840, 836, 8, 341, 61828, 5637, 1669, 330, 16, 17, 18, 698, 8638, 5637, 1669, 330, 18, 17, 16, 1837, 61828, 5261, 1669, 609, 2068, 5142, 83, 4385, 28678, 515, 197, 27725, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestMaxNumberOfRoles_InChannel(t *testing.T) { expected := &discordgo.Channel{Name: mockconstants.TestChannel} mnr := &callbacks.MaxNumberOfRoles{Channel: expected} actual := mnr.InChannel() err := deepEqual(actual, expected) if err != nil { t.Error(err) } }
explode_data.jsonl/56100
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 100 }
[ 2830, 3393, 5974, 40619, 25116, 25972, 9629, 1155, 353, 8840, 836, 8, 341, 42400, 1669, 609, 42579, 3346, 38716, 63121, 25, 7860, 15763, 8787, 9629, 532, 2109, 19618, 1669, 609, 68311, 14535, 40619, 25116, 90, 9629, 25, 3601, 532, 88814, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestGetTriggeredTime(t *testing.T) { now := time.Now() p := spec.Pipeline{ PipelineExtra: spec.PipelineExtra{ Extra: spec.PipelineExtraInfo{ CronTriggerTime: &now, }, }, } triggerTime := getTriggeredTime(p) assert.Equal(t, now.Unix(), triggerTime.Unix()) }
explode_data.jsonl/18878
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 120 }
[ 2830, 3393, 1949, 17939, 291, 1462, 1155, 353, 8840, 836, 8, 341, 80922, 1669, 882, 13244, 741, 3223, 1669, 1398, 1069, 8790, 515, 197, 10025, 8790, 11612, 25, 1398, 1069, 8790, 11612, 515, 298, 197, 11612, 25, 1398, 1069, 8790, 11612, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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(t *testing.T) { c := BackendConfig{ "save_process": "HeadersParser|Debugger", "log_received_mails": true, "save_workers_size": "1", } gateway := &BackendGateway{} err := gateway.Initialize(c) if err != nil { t.Error("Gateway did not init because:", err) t.Fail() } if gateway.processors == nil { t.Error("gateway.chains should not be nil") } else if len(gateway.processors) != 1 { t.Error("len(gateway.chains) should be 1, but got", len(gateway.processors)) } if gateway.conveyor == nil { t.Error("gateway.conveyor should not be nil") } else if cap(gateway.conveyor) != gateway.workersSize() { t.Error("gateway.conveyor channel buffer cap does not match worker size, cap was", cap(gateway.conveyor)) } if gateway.State != BackendStateInitialized { t.Error("gateway.State is not in initialized state, got ", gateway.State) } }
explode_data.jsonl/79603
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 330 }
[ 2830, 3393, 9928, 1155, 353, 8840, 836, 8, 341, 1444, 1669, 55260, 2648, 515, 197, 197, 1, 6628, 11305, 788, 981, 330, 10574, 6570, 91, 67239, 756, 197, 197, 47012, 40783, 717, 6209, 788, 830, 345, 197, 197, 1, 6628, 43557, 2368, 78...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
7
func TestUint(t *testing.T) { { var v, r uint v = 8 if err := encdec(v, &r, func(code byte) bool { return def.PositiveFixIntMin <= uint8(code) && uint8(code) <= def.PositiveFixIntMax }); err != nil { t.Error(err) } } { var v, r uint v = 130 if err := encdec(v, &r, func(code byte) bool { return code == def.Uint8 }); err != nil { t.Error(err) } } { var v, r uint v = 30130 if err := encdec(v, &r, func(code byte) bool { return code == def.Uint16 }); err != nil { t.Error(err) } } { var v, r uint v = 1030130 if err := encdec(v, &r, func(code byte) bool { return code == def.Uint32 }); err != nil { t.Error(err) } } { var r uint64 if err := encdec(uint64(math.MaxUint64-12345), &r, func(code byte) bool { return code == def.Uint64 }); err != nil { t.Error(err) } } }
explode_data.jsonl/64208
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 416 }
[ 2830, 3393, 21570, 1155, 353, 8840, 836, 8, 341, 197, 515, 197, 2405, 348, 11, 435, 2622, 198, 197, 5195, 284, 220, 23, 198, 197, 743, 1848, 1669, 3209, 8169, 3747, 11, 609, 81, 11, 2915, 15842, 4922, 8, 1807, 341, 298, 853, 707, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestFieldMap(t *testing.T) { type Foo struct { A int B int C int } f := Foo{1, 2, 3} m := NewMapperFunc("db", strings.ToLower) fm := m.FieldMap(reflect.ValueOf(f)) if len(fm) != 3 { t.Errorf("Expecting %d keys, got %d", 3, len(fm)) } if fm["a"].Interface().(int) != 1 { t.Errorf("Expecting %d, got %d", 1, ival(fm["a"])) } if fm["b"].Interface().(int) != 2 { t.Errorf("Expecting %d, got %d", 2, ival(fm["b"])) } if fm["c"].Interface().(int) != 3 { t.Errorf("Expecting %d, got %d", 3, ival(fm["c"])) } }
explode_data.jsonl/59103
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 261 }
[ 2830, 3393, 1877, 2227, 1155, 353, 8840, 836, 8, 341, 13158, 33428, 2036, 341, 197, 22985, 526, 198, 197, 12791, 526, 198, 197, 6258, 526, 198, 197, 630, 1166, 1669, 33428, 90, 16, 11, 220, 17, 11, 220, 18, 532, 2109, 1669, 1532, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestResolveLock(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) wg := &sync.WaitGroup{} ch1 := make(chan *cdcpb.ChangeDataEvent, 10) srv1 := newMockChangeDataService(t, ch1) server1, addr1 := newMockService(ctx, t, srv1, wg) defer func() { close(ch1) server1.Stop() wg.Wait() }() rpcClient, cluster, pdClient, err := testutils.NewMockTiKV("", mockcopr.NewCoprRPCHandler()) require.Nil(t, err) pdClient = &mockPDClient{Client: pdClient, versionGen: defaultVersionGen} kvStorage, err := tikv.NewTestTiKVStore(rpcClient, pdClient, nil, nil, 0) require.Nil(t, err) defer kvStorage.Close() //nolint:errcheck regionID := uint64(3) cluster.AddStore(1, addr1) cluster.Bootstrap(regionID, []uint64{1}, []uint64{4}, 4) err = failpoint.Enable("github.com/pingcap/tiflow/cdc/kv/kvClientResolveLockInterval", "return(3)") require.Nil(t, err) defer func() { _ = failpoint.Disable("github.com/pingcap/tiflow/cdc/kv/kvClientResolveLockInterval") }() baseAllocatedID := currentRequestID() lockResolver := txnutil.NewLockerResolver(kvStorage, model.DefaultChangeFeedID("changefeed-test"), util.RoleTester) isPullInit := &mockPullerInit{} grpcPool := NewGrpcPoolImpl(ctx, &security.Credential{}) defer grpcPool.Close() regionCache := tikv.NewRegionCache(pdClient) defer regionCache.Close() cdcClient := NewCDCClient( ctx, pdClient, grpcPool, regionCache, pdutil.NewClock4Test(), model.DefaultChangeFeedID(""), config.GetDefaultServerConfig().KVClient) eventCh := make(chan model.RegionFeedEvent, 50) wg.Add(1) go func() { defer wg.Done() err := cdcClient.EventFeed(ctx, regionspan.ComparableSpan{Start: []byte("a"), End: []byte("b")}, 100, lockResolver, isPullInit, eventCh) require.Equal(t, context.Canceled, errors.Cause(err)) }() // wait request id allocated with: new session, new request waitRequestID(t, baseAllocatedID+1) initialized := mockInitializedEvent(regionID, currentRequestID()) ch1 <- initialized physical, logical, err := pdClient.GetTS(ctx) require.Nil(t, err) tso := oracle.ComposeTS(physical, logical) resolved := &cdcpb.ChangeDataEvent{Events: []*cdcpb.Event{ { RegionId: regionID, RequestId: currentRequestID(), Event: &cdcpb.Event_ResolvedTs{ResolvedTs: tso}, }, }} expected := []model.RegionFeedEvent{ { Resolved: &model.ResolvedSpan{ Span: regionspan.ComparableSpan{Start: []byte("a"), End: []byte("b")}, ResolvedTs: 100, }, RegionID: regionID, }, { Resolved: &model.ResolvedSpan{ Span: regionspan.ComparableSpan{Start: []byte("a"), End: []byte("b")}, ResolvedTs: tso, }, RegionID: regionID, }, } ch1 <- resolved for _, expectedEv := range expected { select { case event := <-eventCh: require.Equal(t, expectedEv, event) case <-time.After(time.Second): require.Fail(t, fmt.Sprintf("expected event %v not received", expectedEv)) } } // sleep 10s to simulate no resolved event longer than ResolveLockInterval // resolve lock check ticker is 5s. time.Sleep(10 * time.Second) cancel() }
explode_data.jsonl/32875
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1235 }
[ 2830, 3393, 56808, 11989, 1155, 353, 8840, 836, 8, 341, 20985, 11, 9121, 1669, 2266, 26124, 9269, 5378, 19047, 2398, 72079, 1669, 609, 12996, 28384, 2808, 31483, 23049, 16, 1669, 1281, 35190, 353, 4385, 4672, 65, 39348, 1043, 1556, 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 TestNative_UnquoteError(t *testing.T) { s := `asdf\` d := make([]byte, 0, len(s)) ep := -1 dp := (*rt.GoSlice)(unsafe.Pointer(&d)) sp := (*rt.GoString)(unsafe.Pointer(&s)) rv := __unquote(sp.Ptr, sp.Len, dp.Ptr, &ep, 0) assert.Equal(t, -int(types.ERR_EOF), rv) assert.Equal(t, 5, ep) s = `asdf\gqwer` d = make([]byte, 0, len(s)) ep = -1 dp = (*rt.GoSlice)(unsafe.Pointer(&d)) sp = (*rt.GoString)(unsafe.Pointer(&s)) rv = __unquote(sp.Ptr, sp.Len, dp.Ptr, &ep, 0) assert.Equal(t, -int(types.ERR_INVALID_ESCAPE), rv) assert.Equal(t, 5, ep) s = `asdf\u1gggqwer` d = make([]byte, 0, len(s)) ep = -1 dp = (*rt.GoSlice)(unsafe.Pointer(&d)) sp = (*rt.GoString)(unsafe.Pointer(&s)) rv = __unquote(sp.Ptr, sp.Len, dp.Ptr, &ep, 0) assert.Equal(t, -int(types.ERR_INVALID_CHAR), rv) assert.Equal(t, 7, ep) s = `asdf\ud800qwer` d = make([]byte, 0, len(s)) ep = -1 dp = (*rt.GoSlice)(unsafe.Pointer(&d)) sp = (*rt.GoString)(unsafe.Pointer(&s)) rv = __unquote(sp.Ptr, sp.Len, dp.Ptr, &ep, 0) assert.Equal(t, -int(types.ERR_INVALID_UNICODE), rv) assert.Equal(t, 6, ep) s = `asdf\\ud800qwer` d = make([]byte, 0, len(s)) ep = -1 dp = (*rt.GoSlice)(unsafe.Pointer(&d)) sp = (*rt.GoString)(unsafe.Pointer(&s)) rv = __unquote(sp.Ptr, sp.Len, dp.Ptr, &ep, types.F_DOUBLE_UNQUOTE) assert.Equal(t, -int(types.ERR_INVALID_UNICODE), rv) assert.Equal(t, 7, ep) s = `asdf\ud800\ud800qwer` d = make([]byte, 0, len(s)) ep = -1 dp = (*rt.GoSlice)(unsafe.Pointer(&d)) sp = (*rt.GoString)(unsafe.Pointer(&s)) rv = __unquote(sp.Ptr, sp.Len, dp.Ptr, &ep, 0) assert.Equal(t, -int(types.ERR_INVALID_UNICODE), rv) assert.Equal(t, 12, ep) s = `asdf\\ud800\\ud800qwer` d = make([]byte, 0, len(s)) ep = -1 dp = (*rt.GoSlice)(unsafe.Pointer(&d)) sp = (*rt.GoString)(unsafe.Pointer(&s)) rv = __unquote(sp.Ptr, sp.Len, dp.Ptr, &ep, types.F_DOUBLE_UNQUOTE) assert.Equal(t, -int(types.ERR_INVALID_UNICODE), rv) assert.Equal(t, 14, ep) }
explode_data.jsonl/60914
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1125 }
[ 2830, 3393, 20800, 40687, 2949, 1454, 1155, 353, 8840, 836, 8, 341, 262, 274, 1669, 1565, 76615, 59, 3989, 262, 294, 1669, 1281, 10556, 3782, 11, 220, 15, 11, 2422, 1141, 1171, 262, 4155, 1669, 481, 16, 198, 262, 11329, 1669, 4609, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestFillTxQueue(t *testing.T) { c := newTestContext(t, 20000, 1500, localLinkAddr) defer c.cleanup() // Prepare to send a packet. r := stack.Route{ RemoteLinkAddress: remoteLinkAddr, } buf := buffer.NewView(100) // Each packet is uses no more than 40 bytes, so write that many packets // until the tx queue if full. ids := make(map[uint64]struct{}) for i := queuePipeSize / 40; i > 0; i-- { hdr := buffer.NewPrependable(int(c.ep.MaxHeaderLength())) if err := c.ep.WritePacket(&r, &hdr, buf, header.IPv4ProtocolNumber); err != nil { t.Fatalf("WritePacket failed unexpectedly: %v", err) } // Check that they have different IDs. desc := c.txq.tx.Pull() pi := queue.DecodeTxPacketHeader(desc) if _, ok := ids[pi.ID]; ok { t.Fatalf("ID (%v) reused", pi.ID) } ids[pi.ID] = struct{}{} } // Next attempt to write must fail. hdr := buffer.NewPrependable(int(c.ep.MaxHeaderLength())) err := c.ep.WritePacket(&r, &hdr, buf, header.IPv4ProtocolNumber) if want := tcpip.ErrWouldBlock; err != want { t.Fatalf("WritePacket return unexpected result: got %v, want %v", err, want) } }
explode_data.jsonl/4234
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 438 }
[ 2830, 3393, 14449, 31584, 7554, 1155, 353, 8840, 836, 8, 341, 1444, 1669, 501, 2271, 1972, 1155, 11, 220, 17, 15, 15, 15, 15, 11, 220, 16, 20, 15, 15, 11, 2205, 3939, 13986, 340, 16867, 272, 87689, 2822, 197, 322, 31166, 311, 3624...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestUpdateRevWithWithUpdatedLoggingURL(t *testing.T) { controllerConfig := getTestControllerConfig() kubeClient, _, servingClient, cachingClient, _, controller, kubeInformer, _, servingInformer, cachingInformer, _, _ := newTestControllerWithConfig(t, controllerConfig, &corev1.ConfigMap{ ObjectMeta: metav1.ObjectMeta{ Namespace: system.Namespace, Name: config.ObservabilityConfigName, }, Data: map[string]string{ "logging.enable-var-log-collection": "true", "logging.fluentd-sidecar-image": testFluentdImage, "logging.fluentd-sidecar-output-config": testFluentdSidecarOutputConfig, "logging.revision-url-template": "http://old-logging.test.com?filter=${REVISION_UID}", }, }, getTestControllerConfigMap(), ) revClient := servingClient.ServingV1alpha1().Revisions(testNamespace) rev := getTestRevision() createRevision(t, kubeClient, kubeInformer, servingClient, servingInformer, cachingClient, cachingInformer, controller, rev) // Update controllers logging URL controller.Reconciler.(*Reconciler).receiveObservabilityConfig(&corev1.ConfigMap{ ObjectMeta: metav1.ObjectMeta{ Namespace: system.Namespace, Name: config.ObservabilityConfigName, }, Data: map[string]string{ "logging.enable-var-log-collection": "true", "logging.fluentd-sidecar-image": testFluentdImage, "logging.fluentd-sidecar-output-config": testFluentdSidecarOutputConfig, "logging.revision-url-template": "http://new-logging.test.com?filter=${REVISION_UID}", }, }) updateRevision(t, kubeClient, kubeInformer, servingClient, servingInformer, cachingClient, cachingInformer, controller, rev) updatedRev, err := revClient.Get(rev.Name, metav1.GetOptions{}) if err != nil { t.Fatalf("Couldn't get revision: %v", err) } expectedLoggingURL := fmt.Sprintf("http://new-logging.test.com?filter=%s", rev.UID) if updatedRev.Status.LogURL != expectedLoggingURL { t.Errorf("Updated revision does not have an updated logging URL: expected: %s, got: %s", expectedLoggingURL, updatedRev.Status.LogURL) } }
explode_data.jsonl/27418
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 763 }
[ 2830, 3393, 4289, 36184, 2354, 2354, 16196, 34575, 3144, 1155, 353, 8840, 836, 8, 341, 61615, 2648, 1669, 633, 2271, 2051, 2648, 741, 16463, 3760, 2959, 11, 8358, 13480, 2959, 11, 47430, 2959, 11, 8358, 6461, 11, 80958, 641, 34527, 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...
3
func TestCRDDeletionCascading(t *testing.T) { ctx := setup(t, 5) defer ctx.tearDown() clientSet, apiExtensionClient, clientPool := ctx.clientSet, ctx.apiExtensionClient, ctx.clientPool ns := createNamespaceOrDie("crd-mixed", clientSet, t) configMapClient := clientSet.CoreV1().ConfigMaps(ns.Name) definition, resourceClient := createRandomCustomResourceDefinition(t, apiExtensionClient, clientPool, ns.Name) // Create a custom owner resource. owner, err := resourceClient.Create(newCRDInstance(definition, ns.Name, names.SimpleNameGenerator.GenerateName("owner"))) if err != nil { t.Fatalf("failed to create owner: %v", err) } t.Logf("created owner %q", owner.GetName()) // Create a core dependent resource. dependent := newConfigMap(ns.Name, names.SimpleNameGenerator.GenerateName("dependent")) link(t, owner, dependent) dependent, err = configMapClient.Create(dependent) if err != nil { t.Fatalf("failed to create dependent: %v", err) } t.Logf("created dependent %q", dependent.GetName()) time.Sleep(ctx.syncPeriod + 5*time.Second) // Delete the definition, which should cascade to the owner and ultimately its dependents. if err := apiextensionstestserver.DeleteCustomResourceDefinition(definition, apiExtensionClient); err != nil { t.Fatalf("failed to delete %q: %v", definition.Name, err) } // Ensure the owner is deleted. if err := wait.Poll(5*time.Second, 60*time.Second, func() (bool, error) { _, err := resourceClient.Get(owner.GetName(), metav1.GetOptions{}) return errors.IsNotFound(err), nil }); err != nil { t.Fatalf("failed waiting for owner %q to be deleted", owner.GetName()) } // Ensure the dependent is deleted. if err := wait.Poll(5*time.Second, 60*time.Second, func() (bool, error) { _, err := configMapClient.Get(dependent.GetName(), metav1.GetOptions{}) return errors.IsNotFound(err), nil }); err != nil { t.Fatalf("failed waiting for dependent %q (owned by %q) to be deleted", dependent.GetName(), owner.GetName()) } }
explode_data.jsonl/73337
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 656 }
[ 2830, 3393, 8973, 35, 1912, 52625, 34, 5061, 2228, 1155, 353, 8840, 836, 8, 341, 20985, 1669, 6505, 1155, 11, 220, 20, 340, 16867, 5635, 31853, 59342, 2822, 25291, 1649, 11, 6330, 12049, 2959, 11, 2943, 10551, 1669, 5635, 6581, 1649, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestExecContextFailureWithoutCancelationWithArguments(t *testing.T) { t.Parallel() testWithAndWithoutPreferSimpleProtocol(t, func(t *testing.T, conn *pgx.Conn) { ctx, cancelFunc := context.WithCancel(context.Background()) defer cancelFunc() _, err := conn.Exec(ctx, "selct $1;", 1) if err == nil { t.Fatal("Expected SQL syntax error") } assert.False(t, pgconn.SafeToRetry(err)) }) }
explode_data.jsonl/40009
{ "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, 10216, 1972, 17507, 26040, 9269, 367, 2354, 19139, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 2822, 18185, 2354, 3036, 26040, 4703, 802, 16374, 20689, 1155, 11, 2915, 1155, 353, 8840, 836, 11, 4534, 353, 3517, 87, 5042...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestPreAppend(t *testing.T) { type testData struct { expectedValues, newElements, testValues []interface{} } tests := []testData{ {testValues: []interface{}{1, 2, -6, 111}, expectedValues: []interface{}{12, 3, 1, 2, -6, 111}, newElements: []interface{}{3, 12}}, {testValues: []interface{}{"Ciao", "Hello", "Car"}, expectedValues: []interface{}{"NewCiao", "Ciao", "Hello", "Car"}, newElements: []interface{}{"NewCiao"}}, {testValues: []interface{}{"Ciao", "Hello", "Car"}, expectedValues: []interface{}{123, "Ciao", "Hello", "Car"}, newElements: []interface{}{123}}, } for i, test := range tests { data := PreAppend(test.testValues, test.newElements...) if err := a.AssertSlicesEqual(a.DataSlicesMatch{Expected: test.expectedValues, Actual: data}); err != nil { t.Error(m.ErrorMessageTestCount(i+1, err)) } } }
explode_data.jsonl/9011
{ "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, 4703, 23877, 1155, 353, 8840, 836, 8, 341, 13158, 67348, 2036, 341, 197, 42400, 6227, 11, 501, 11868, 11, 1273, 6227, 3056, 4970, 16094, 197, 630, 78216, 1669, 3056, 1944, 1043, 515, 197, 197, 90, 1944, 6227, 25, 3056, 497...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestInvalidPtrValueKind(t *testing.T) { var simple interface{} switch obj := simple.(type) { default: _, err := EnforcePtr(obj) if err == nil { t.Errorf("Expected error on invalid kind") } } }
explode_data.jsonl/34483
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 81 }
[ 2830, 3393, 7928, 5348, 1130, 10629, 1155, 353, 8840, 836, 8, 341, 2405, 4285, 3749, 16094, 8961, 2839, 1669, 4285, 12832, 1313, 8, 341, 11940, 510, 197, 197, 6878, 1848, 1669, 2925, 8833, 5348, 6779, 340, 197, 743, 1848, 621, 2092, 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 ]
2
func TestZip64(t *testing.T) { if testing.Short() { t.Skip("slow test; skipping") } const size = 1 << 32 // before the "END\n" part buf := testZip64(t, size) testZip64DirectoryRecordLength(buf, t) }
explode_data.jsonl/18862
{ "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, 31047, 21, 19, 1155, 353, 8840, 836, 8, 341, 743, 7497, 55958, 368, 341, 197, 3244, 57776, 445, 35211, 1273, 26, 42659, 1138, 197, 532, 4777, 1379, 284, 220, 16, 1115, 220, 18, 17, 442, 1573, 279, 330, 4689, 1699, 1, 9...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestIssue29805(t *testing.T) { store, clean := testkit.CreateMockStore(t) defer clean() orgEnable := core.PreparedPlanCacheEnabled() defer core.SetPreparedPlanCache(orgEnable) core.SetPreparedPlanCache(true) se, err := session.CreateSession4TestWithOpt(store, &session.Opt{ PreparedPlanCache: kvcache.NewSimpleLRUCache(100, 0.1, math.MaxUint64), }) require.NoError(t, err) tk := testkit.NewTestKitWithSession(t, store, se) tk.MustExec("use test") tk.MustExec("set tidb_enable_clustered_index=on;") tk.MustExec("drop table if exists PK_TCOLLATION10197;") tk.MustExec("CREATE TABLE `PK_TCOLLATION10197` (`COL1` char(1) NOT NULL, PRIMARY KEY (`COL1`(1)) /*T![clustered_index] CLUSTERED */) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;") tk.MustExec("insert into PK_TCOLLATION10197 values('龺');") tk.MustExec("set @a='畻', @b='龺';") tk.MustExec(`prepare stmt from 'select/*+ hash_agg() */ count(distinct col1) from PK_TCOLLATION10197 where col1 > ?;';`) tk.MustQuery("execute stmt using @a").Check(testkit.Rows("1")) tk.MustQuery("execute stmt using @b").Check(testkit.Rows("0")) tk.MustQuery("select @@last_plan_from_cache").Check(testkit.Rows("1")) tk.MustExec(`prepare stmt from 'select/*+ hash_agg() */ count(distinct col1) from PK_TCOLLATION10197 where col1 > ?;';`) tk.MustQuery("execute stmt using @b").Check(testkit.Rows("0")) tk.MustQuery("select/*+ hash_agg() */ count(distinct col1) from PK_TCOLLATION10197 where col1 > '龺';").Check(testkit.Rows("0")) }
explode_data.jsonl/5534
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 591 }
[ 2830, 3393, 42006, 17, 24, 23, 15, 20, 1155, 353, 8840, 836, 8, 341, 57279, 11, 4240, 1669, 1273, 8226, 7251, 11571, 6093, 1155, 340, 16867, 4240, 741, 87625, 11084, 1669, 6200, 28770, 7212, 20485, 8233, 5462, 741, 16867, 6200, 4202, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestSlidingReader_ReadAll(t *testing.T) { t.Parallel() rwr, err := NewSlidingReader(func() io.Reader { return strings.NewReader("foobarbazqux") }, 4, func() hash.Hash { return crc32.NewIEEE() }) require.NoError(t, err) data, err := io.ReadAll(rwr) assert.NoError(t, err) assert.Equal(t, "foobarbazqux", string(data)) assert.NoError(t, rwr.Close()) }
explode_data.jsonl/41472
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 146 }
[ 2830, 3393, 7442, 6577, 5062, 38381, 2403, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 2822, 7000, 18718, 11, 1848, 1669, 1532, 7442, 6577, 5062, 18552, 368, 6399, 47431, 314, 470, 9069, 68587, 445, 50267, 42573, 446, 87, 899, 2470...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestContextRedirect(t *testing.T) { e := New() req := test.NewRequest(GET, "/", nil) rec := test.NewResponseRecorder() c := e.NewContext(req, rec) assert.Equal(t, nil, c.Redirect(http.StatusMovedPermanently, "http://labstack.github.io/echo")) assert.Equal(t, http.StatusMovedPermanently, rec.Status()) assert.Equal(t, "http://labstack.github.io/echo", rec.Header().Get(HeaderLocation)) assert.Error(t, c.Redirect(310, "http://labstack.github.io/echo")) }
explode_data.jsonl/35877
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 176 }
[ 2830, 3393, 1972, 17725, 1155, 353, 8840, 836, 8, 341, 7727, 1669, 1532, 741, 24395, 1669, 1273, 75274, 62918, 11, 64657, 2092, 340, 67904, 1669, 1273, 7121, 2582, 47023, 741, 1444, 1669, 384, 7121, 1972, 6881, 11, 1395, 340, 6948, 1280...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_ResolveMap(t *testing.T) { testCases := []struct { name string path string attributes map[string]interface{} result map[string]interface{} err error }{ { name: "empty attributes should produce error", path: "x.y.z", attributes: map[string]interface{}{}, result: nil, err: errors.New("map attribute `x.y.z` not found"), }, { name: "empty path should produce error", path: "", attributes: map[string]interface{}{ "xyz": "abc", }, result: nil, err: errors.New("map attribute `` not found"), }, { name: "nonempty attributes with correct path should produce nonempty map", path: "x.y.z", attributes: map[string]interface{}{ "x": map[string]interface{}{ "y": map[string]interface{}{ "z": map[string]interface{}{ "xyz": "abc", }, }, }, }, result: map[string]interface{}{ "xyz": "abc", }, err: nil, }, { name: "nonempty attributes with wrong value at path should produce error", path: "x.y.z", attributes: map[string]interface{}{ "x": map[string]interface{}{ "y": map[string]interface{}{ "xyz": "abc", }, }, }, result: nil, err: errors.New("map attribute `x.y.z` not found"), }, { name: "nonempty attributes with incorrect path should produce error", path: "a.b.c", attributes: map[string]interface{}{ "x": map[string]interface{}{ "y": map[string]interface{}{ "z": map[string]interface{}{ "xyz": "abc", }, }, }, }, result: nil, err: errors.New("map attribute `a.b.c` not found"), }, } for _, tc := range testCases { t.Run(tc.name, func(t *testing.T) { result, err := ResolveMap(tc.attributes, tc.path) assert.Equal(t, result, tc.result) assert.Equal(t, err, tc.err) }) } }
explode_data.jsonl/79608
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 880 }
[ 2830, 3393, 62, 56808, 2227, 1155, 353, 8840, 836, 8, 341, 18185, 37302, 1669, 3056, 1235, 341, 197, 11609, 981, 914, 198, 197, 26781, 981, 914, 198, 197, 197, 12340, 2415, 14032, 31344, 16094, 197, 9559, 257, 2415, 14032, 31344, 16094,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestConvertMapStringToStruct(t *testing.T) { lines, err := convertTypes( "Foo", "Bar", ` struct MapValue { 1: required string one 2: optional string two } struct Foo { 1: required map<string, MapValue> uuidMap } struct Bar { 1: required map<string, MapValue> uuidMap }`, nil, nil, ) assert.NoError(t, err) assertPrettyEqual(t, trim(` out.UUIDMap = make(map[string]*structs.MapValue, len(in.UUIDMap)) for key1, value2 := range in.UUIDMap { if value2 != nil { out.UUIDMap[key1] = &structs.MapValue{} out.UUIDMap[key1].One = string(in.UUIDMap[key1].One) out.UUIDMap[key1].Two = (*string)(in.UUIDMap[key1].Two) } else { out.UUIDMap[key1] = nil } } `), lines) }
explode_data.jsonl/62052
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 321 }
[ 2830, 3393, 12012, 2227, 703, 1249, 9422, 1155, 353, 8840, 836, 8, 341, 78390, 11, 1848, 1669, 5508, 4173, 1006, 197, 197, 1, 40923, 497, 330, 3428, 756, 197, 197, 3989, 197, 6472, 5027, 1130, 341, 298, 197, 16, 25, 2567, 914, 825, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestCodepage(t *testing.T) { for _, c := range testTable { u := ByteToUnicode(c.b) if u != c.u { t.Errorf("wrong unicode for byte=%x: expected=%x found=%x", c.b, c.u, u) } b := UnicodeToByte(c.u) if b != c.b { t.Errorf("wrong byte for unicode=%x: expected=%x found=%x", c.u, c.b, b) } } }
explode_data.jsonl/71595
{ "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, 2078, 2893, 1155, 353, 8840, 836, 8, 341, 2023, 8358, 272, 1669, 2088, 1273, 2556, 341, 197, 10676, 1669, 10906, 1249, 33920, 1337, 948, 340, 197, 743, 575, 961, 272, 11634, 341, 298, 3244, 13080, 445, 34870, 26077, 369, 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...
4
func TestRenderWithInvalidParameter(t *testing.T) { template := `version: 0.0.0 title: Test Plugin description: This is a test plugin parameters: - name: path label: Parameter description: A parameter type: int required: true pipeline: ` plugin, err := NewPlugin("plugin", []byte(template)) require.NoError(t, err) _, err = plugin.Render(map[string]interface{}{"path": "test"}) require.Error(t, err) require.Contains(t, err.Error(), "plugin parameter failed validation") }
explode_data.jsonl/43063
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 168 }
[ 2830, 3393, 6750, 2354, 7928, 4971, 1155, 353, 8840, 836, 8, 341, 22832, 1669, 1565, 4366, 25, 220, 15, 13, 15, 13, 15, 198, 2102, 25, 3393, 21245, 198, 4684, 25, 1096, 374, 264, 1273, 9006, 198, 13786, 510, 220, 481, 829, 25, 181...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestRelease(t *testing.T) { f, err := unix.Socket(unix.AF_UNIX, unix.SOCK_STREAM|unix.SOCK_NONBLOCK|unix.SOCK_CLOEXEC, 0) if err != nil { t.Fatal("Creating socket:", err) } c := &ConnectedEndpoint{queue: &waiter.Queue{}, file: fd.New(f)} want := &ConnectedEndpoint{queue: c.queue} ctx := contexttest.Context(t) want.ref.DecRef(ctx) fdnotifier.AddFD(int32(c.file.FD()), nil) c.Release(ctx) if !reflect.DeepEqual(c, want) { t.Errorf("got = %#v, want = %#v", c, want) } }
explode_data.jsonl/259
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 226 }
[ 2830, 3393, 16077, 1155, 353, 8840, 836, 8, 341, 1166, 11, 1848, 1669, 51866, 52089, 18364, 941, 70860, 82754, 11, 51866, 78922, 23584, 91, 56646, 78922, 22128, 39964, 91, 56646, 78922, 920, 1593, 46340, 11, 220, 15, 340, 743, 1848, 961...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestGenerateSimpleDockerApp(t *testing.T) { // TODO: determine if the repo is secured prior to fetching // TODO: determine whether we want to clone this repo, or use it directly. Using it directly would require setting hooks // if we have source, assume we are going to go into a build flow. // TODO: get info about git url: does this need STI? url, _ := git.Parse("https://github.com/openshift/origin.git") source := &SourceRef{URL: url} // generate a local name for the repo name, _ := source.SuggestName() // BUG: an image repo (if we want to create one) needs to tell other objects its pullspec, but we don't know what that will be // until the object is placed into a namespace and we lookup what registry (registries?) serve the object. // QUESTION: Is it ok for generation to require a namespace? Do we want to be able to create apps with builds, image repos, and // deployment configs in templates (hint: yes). // SOLUTION? Make deployment config accept unqualified image repo names (foo) and then prior to creating the RC resolve those. output := &ImageRef{ Reference: reference.DockerImageReference{ Name: name, }, AsImageStream: true, } // create our build based on source and input // TODO: we might need to pick a base image if this is STI build := &BuildRef{Source: source, Output: output} // take the output image and wire it into a deployment config deploy := &DeploymentConfigRef{Images: []*ImageRef{output}} outputRepo, _ := output.ImageStream() buildConfig, _ := build.BuildConfig() deployConfig, _ := deploy.DeploymentConfig() out := &corev1.List{ Items: []runtime.RawExtension{ {Object: outputRepo}, {Object: buildConfig}, {Object: deployConfig}, }, } _, codecs := apitesting.SchemeForOrDie(api.Install, api.InstallKube) data, err := runtime.Encode(codecs.LegacyCodec(schema.GroupVersion{Group: "", Version: "v1"}), out) if err != nil { log.Fatalf("Unable to generate output: %v", err) } log.Print(string(data)) // output: }
explode_data.jsonl/17586
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 624 }
[ 2830, 3393, 31115, 16374, 35, 13659, 2164, 1155, 353, 8840, 836, 8, 341, 197, 322, 5343, 25, 8253, 421, 279, 15867, 374, 26430, 4867, 311, 44234, 198, 197, 322, 5343, 25, 8253, 3425, 582, 1366, 311, 14715, 419, 15867, 11, 476, 990, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestServerBoundHandshake_IsForgeAddress(t *testing.T) { tt := []struct { addr string result bool }{ { addr: mc.ForgeSeparator, result: true, }, { addr: "example.com:1234" + mc.ForgeSeparator, result: true, }, { addr: "example.com" + mc.ForgeSeparator + "some data", result: true, }, { addr: "example.com" + mc.ForgeSeparator + "some data" + mc.RealIPSeparator + "more", result: true, }, { addr: "example.com", result: false, }, { addr: "", result: false, }, } for _, tc := range tt { hs := mc.ServerBoundHandshake{ServerAddress: tc.addr} if hs.IsForgeAddress() != tc.result { t.Errorf("%s: got: %v; want: %v", tc.addr, !tc.result, tc.result) } } }
explode_data.jsonl/45003
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 353 }
[ 2830, 3393, 5475, 19568, 2314, 29661, 31879, 58437, 4286, 1155, 353, 8840, 836, 8, 341, 3244, 83, 1669, 3056, 1235, 341, 197, 53183, 256, 914, 198, 197, 9559, 1807, 198, 197, 59403, 197, 197, 515, 298, 53183, 25, 256, 19223, 991, 6670...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestDict(t *testing.T) { Py_Initialize() dict := PyDict_New() assert.True(t, PyDict_Check(dict)) assert.True(t, PyDict_CheckExact(dict)) defer dict.DecRef() proxy := PyDictProxy_New(dict) assert.NotNil(t, proxy) proxy.DecRef() key1 := "key1" value1 := PyUnicode_FromString("value1") assert.NotNil(t, value1) defer value1.DecRef() key2 := PyUnicode_FromString("key2") assert.NotNil(t, key2) defer key2.DecRef() value2 := PyUnicode_FromString("value2") assert.NotNil(t, value2) defer value2.DecRef() key3 := PyUnicode_FromString("key3") assert.NotNil(t, key3) defer key3.DecRef() value3 := PyUnicode_FromString("value3") assert.NotNil(t, value3) defer value3.DecRef() err := PyDict_SetItem(dict, key2, value2) assert.Zero(t, err) err = PyDict_SetItemString(dict, key1, value1) assert.Zero(t, err) assert.Equal(t, value2, PyDict_GetItem(dict, key2)) assert.Equal(t, value2, PyDict_SetDefault(dict, key2, Py_None)) assert.Equal(t, value1, PyDict_GetItemString(dict, key1)) assert.Nil(t, PyDict_GetItemWithError(dict, key3)) b := PyDict_Contains(dict, key2) != 0 assert.True(t, b) assert.Equal(t, 2, PyDict_Size(dict)) keys := PyDict_Keys(dict) assert.True(t, PyList_Check(keys)) keys.DecRef() values := PyDict_Values(dict) assert.True(t, PyList_Check(values)) values.DecRef() items := PyDict_Items(dict) assert.True(t, PyList_Check(items)) items.DecRef() err = PyDict_SetItem(dict, key3, value3) assert.Zero(t, err) newDict := PyDict_Copy(dict) assert.Equal(t, 3, PyDict_Size(newDict)) defer newDict.DecRef() err = PyDict_DelItem(dict, key2) assert.Zero(t, err) err = PyDict_DelItemString(dict, key1) assert.Zero(t, err) assert.Equal(t, 1, PyDict_Size(dict)) PyDict_Clear(dict) assert.Equal(t, 0, PyDict_Size(dict)) dict.DecRef() PyDict_ClearFreeList() }
explode_data.jsonl/49867
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 812 }
[ 2830, 3393, 13448, 1155, 353, 8840, 836, 8, 341, 67363, 62, 9928, 2822, 2698, 849, 1669, 5355, 13448, 39582, 741, 6948, 32443, 1155, 11, 5355, 13448, 28188, 31278, 1171, 6948, 32443, 1155, 11, 5355, 13448, 28188, 57954, 31278, 1171, 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
func TestCreateBridgeWithMac(t *testing.T) { if testing.Short() { return } name := "testbridge" if err := CreateBridge(name, true); err != nil { t.Fatal(err) } if _, err := net.InterfaceByName(name); err != nil { t.Fatal(err) } // cleanup and tests if err := DeleteBridge(name); err != nil { t.Fatal(err) } if _, err := net.InterfaceByName(name); err == nil { t.Fatalf("expected error getting interface because %s bridge was deleted", name) } }
explode_data.jsonl/76211
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 176 }
[ 2830, 3393, 4021, 32848, 2354, 19552, 1155, 353, 8840, 836, 8, 341, 743, 7497, 55958, 368, 341, 197, 853, 198, 197, 630, 11609, 1669, 330, 1944, 13709, 1837, 743, 1848, 1669, 4230, 32848, 3153, 11, 830, 1215, 1848, 961, 2092, 341, 197...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
6
func TestParseConfig_ListObjectsV1(t *testing.T) { input := []byte(`bucket: "bucket-name" endpoint: "s3-endpoint"`) cfg, err := parseConfig(input) testutil.Ok(t, err) if cfg.ListObjectsVersion != "" { t.Errorf("when list_objects_version not set, it should default to empty") } input2 := []byte(`bucket: "bucket-name" endpoint: "s3-endpoint" list_objects_version: "abcd"`) cfg2, err := parseConfig(input2) testutil.Ok(t, err) if cfg2.ListObjectsVersion != "abcd" { t.Errorf("parsing of list_objects_version failed: got %v, expected %v", cfg.ListObjectsVersion, "abcd") } }
explode_data.jsonl/6240
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 237 }
[ 2830, 3393, 14463, 2648, 27104, 11543, 53, 16, 1155, 353, 8840, 836, 8, 341, 22427, 1669, 3056, 3782, 5809, 30410, 25, 330, 30410, 11494, 698, 32540, 25, 330, 82, 18, 13068, 2768, 39917, 692, 50286, 11, 1848, 1669, 4715, 2648, 5384, 3...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestCloneReturnsClone(t *testing.T) { testTime := time.Date(2011, 5, 13, 0, 0, 0, 0, time.UTC) lib, err := New(testTime) if assert.NoError(t, err) { clone := lib.Clone() assert.True(t, clone.ToTime().Equal(lib.ToTime())) clone.Add(1, "M") assert.False(t, clone.ToTime().Equal(lib.ToTime())) } }
explode_data.jsonl/73976
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 139 }
[ 2830, 3393, 37677, 16446, 37677, 1155, 353, 8840, 836, 8, 341, 18185, 1462, 1669, 882, 8518, 7, 17, 15, 16, 16, 11, 220, 20, 11, 220, 16, 18, 11, 220, 15, 11, 220, 15, 11, 220, 15, 11, 220, 15, 11, 882, 87069, 692, 93459, 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 TestCompositeLitTypes(t *testing.T) { for _, test := range []struct { lit, typ string }{ {`[16]byte{}`, `[16]byte`}, {`[...]byte{}`, `[0]byte`}, // test for issue #14092 {`[...]int{1, 2, 3}`, `[3]int`}, // test for issue #14092 {`[...]int{90: 0, 98: 1, 2}`, `[100]int`}, // test for issue #14092 {`[]int{}`, `[]int`}, {`map[string]bool{"foo": true}`, `map[string]bool`}, {`struct{}{}`, `struct{}`}, {`struct{x, y int; z complex128}{}`, `struct{x int; y int; z complex128}`}, } { fset := token.NewFileSet() f, err := parser.ParseFile(fset, test.lit, "package p; var _ = "+test.lit, 0) if err != nil { t.Fatalf("%s: %v", test.lit, err) } info := &Info{ Types: make(map[ast.Expr]TypeAndValue), } if _, err = new(Config).Check("p", fset, []*ast.File{f}, info); err != nil { t.Fatalf("%s: %v", test.lit, err) } cmptype := func(x ast.Expr, want string) { tv, ok := info.Types[x] if !ok { t.Errorf("%s: no Types entry found", test.lit) return } if tv.Type == nil { t.Errorf("%s: type is nil", test.lit) return } if got := tv.Type.String(); got != want { t.Errorf("%s: got %v, want %s", test.lit, got, want) } } // test type of composite literal expression rhs := f.Decls[0].(*ast.GenDecl).Specs[0].(*ast.ValueSpec).Values[0] cmptype(rhs, test.typ) // test type of composite literal type expression cmptype(rhs.(*ast.CompositeLit).Type, test.typ) } }
explode_data.jsonl/55557
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 704 }
[ 2830, 3393, 41685, 68954, 4173, 1155, 353, 8840, 836, 8, 341, 2023, 8358, 1273, 1669, 2088, 3056, 1235, 341, 197, 8810, 275, 11, 3582, 914, 198, 197, 59403, 197, 197, 90, 63, 58, 16, 21, 90184, 90, 28350, 77644, 16, 21, 90184, 63, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestStepReturnAndPanic(t *testing.T) { // Tests that Step works correctly when returning from functions // and when a deferred function is called when panic'ing. switch { case goversion.VersionAfterOrEqual(runtime.Version(), 1, 11): testseq("defercall", contStep, []nextTest{ {17, 6}, {6, 7}, {7, 18}, {18, 6}, {6, 7}}, "", t) case goversion.VersionAfterOrEqual(runtime.Version(), 1, 10): testseq("defercall", contStep, []nextTest{ {17, 5}, {5, 6}, {6, 7}, {7, 18}, {18, 5}, {5, 6}, {6, 7}}, "", t) case goversion.VersionAfterOrEqual(runtime.Version(), 1, 9): testseq("defercall", contStep, []nextTest{ {17, 5}, {5, 6}, {6, 7}, {7, 17}, {17, 18}, {18, 5}, {5, 6}, {6, 7}}, "", t) default: testseq("defercall", contStep, []nextTest{ {17, 5}, {5, 6}, {6, 7}, {7, 18}, {18, 5}, {5, 6}, {6, 7}}, "", t) } }
explode_data.jsonl/56262
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 446 }
[ 2830, 3393, 8304, 5598, 3036, 47, 31270, 1155, 353, 8840, 836, 8, 341, 197, 322, 20150, 429, 14822, 4278, 12440, 979, 13451, 504, 5746, 198, 197, 322, 323, 979, 264, 26239, 729, 374, 2598, 979, 21975, 6, 287, 624, 8961, 341, 2722, 7...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
4
func TestService_Organizations(t *testing.T) { type fields struct { OrganizationsStore chronograf.OrganizationsStore Logger chronograf.Logger } type args struct { w *httptest.ResponseRecorder r *http.Request } tests := []struct { name string fields fields args args wantStatus int wantContentType string wantBody string }{ { name: "Get Organizations", args: args{ w: httptest.NewRecorder(), r: httptest.NewRequest( "GET", "http://any.url", // can be any valid URL as we are bypassing mux nil, ), }, fields: fields{ Logger: log.New(log.DebugLevel), OrganizationsStore: &mocks.OrganizationsStore{ AllF: func(ctx context.Context) ([]chronograf.Organization, error) { return []chronograf.Organization{ chronograf.Organization{ ID: "1337", Name: "The Good Place", }, chronograf.Organization{ ID: "100", Name: "The Bad Place", }, }, nil }, }, }, wantStatus: http.StatusOK, wantContentType: "application/json", wantBody: `{"links":{"self":"/chronograf/v1/organizations"},"organizations":[{"links":{"self":"/chronograf/v1/organizations/1337"},"id":"1337","name":"The Good Place"},{"links":{"self":"/chronograf/v1/organizations/100"},"id":"100","name":"The Bad Place"}]}`, }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { s := &Service{ Store: &mocks.Store{ OrganizationsStore: tt.fields.OrganizationsStore, }, Logger: tt.fields.Logger, } s.Organizations(tt.args.w, tt.args.r) resp := tt.args.w.Result() content := resp.Header.Get("Content-Type") body, _ := ioutil.ReadAll(resp.Body) if resp.StatusCode != tt.wantStatus { t.Errorf("%q. Organizations() = %v, want %v", tt.name, resp.StatusCode, tt.wantStatus) } if tt.wantContentType != "" && content != tt.wantContentType { t.Errorf("%q. Organizations() = %v, want %v", tt.name, content, tt.wantContentType) } if eq, _ := jsonEqual(string(body), tt.wantBody); tt.wantBody != "" && !eq { t.Errorf("%q. Organizations() = \n***%v***\n,\nwant\n***%v***", tt.name, string(body), tt.wantBody) } }) } }
explode_data.jsonl/13411
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1026 }
[ 2830, 3393, 1860, 2232, 8443, 8040, 1155, 353, 8840, 836, 8, 341, 13158, 5043, 2036, 341, 197, 197, 23227, 8040, 6093, 25986, 25058, 8382, 8443, 8040, 6093, 198, 197, 55861, 1797, 25986, 25058, 12750, 198, 197, 532, 13158, 2827, 2036, 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...
1
func TestRollBackNominateCandidate(t *testing.T) { desc := &contract.TxDesc{ Module: "tdpos", Method: "nominate_candidate", Args: map[string]interface{}{ "candidates": []interface{}{"f3prTg9itaZY6m48wXXikXdcxiByW7zgk"}, "neturls": []interface{}{"/ip4/127.0.0.1/tcp/47101/p2p/QmVxeNubpg1ZQjQT8W5yZC9fD7ZB1ViArwvyGUB53sqf8e"}, }, } strDesc, _ := json.Marshal(desc) U, L, tdpos := commonWork(t) txCons, block := makeTxWithDesc(strDesc, U, L, t) tdpos.candidateBallots.LoadOrStore("D_candidate_ballots_f3prTg9itaZY6m48wXXikXdcxiByW7zgk", int64(1)) tdpos.context = &contract.TxContext{} tdpos.context.UtxoBatch = tdpos.utxoVM.NewBatch() key := "D_candidate_nominate_f3prTg9itaZY6m48wXXikXdcxiByW7zgk" tdpos.context.UtxoBatch.Put([]byte(key), []byte(txCons.Txid)) tdpos.context.UtxoBatch.Write() desc2 := &contract.TxDesc{ Module: "tdpos", Method: "rollback_nominate_candidate", Tx: txCons, Args: map[string]interface{}{ "candidate": "f3prTg9itaZY6m48wXXikXdcxiByW7zgk", "neturl": "/ip4/127.0.0.1/tcp/47101/p2p/QmVxeNubpg1ZQjQT8W5yZC9fD7ZB1ViArwvyGUB53sqf8e", }, } rollBackNomCandErr := tdpos.rollbackNominateCandidate(desc2, block) if rollBackNomCandErr != nil { t.Error("roll back nominate candidate error ", rollBackNomCandErr.Error()) } }
explode_data.jsonl/77202
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 642 }
[ 2830, 3393, 32355, 3707, 36312, 3277, 63901, 1155, 353, 8840, 836, 8, 341, 41653, 1669, 609, 20257, 81362, 11065, 515, 197, 197, 3332, 25, 330, 1296, 966, 756, 197, 84589, 25, 330, 16687, 3277, 62360, 756, 197, 197, 4117, 25, 2415, 14...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestShutdown(t *testing.T) { testServer := getConfiguredServer(mockHTTPServer, nil, nil, nil) go func() { if err := testServer.ListenAndServe(); err != nil { if err != http.ErrServerClosed { t.Errorf("Expected server to be gracefully shutdown with error: %q", http.ErrServerClosed) } } }() ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second) defer cancel() if err := testServer.Shutdown(ctx); err != nil { t.Fatal("Unexpected error: ", err) } }
explode_data.jsonl/41102
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 182 }
[ 2830, 3393, 62004, 1155, 353, 8840, 836, 8, 341, 18185, 5475, 1669, 66763, 3073, 5475, 30389, 9230, 5475, 11, 2092, 11, 2092, 11, 2092, 692, 30680, 2915, 368, 341, 197, 743, 1848, 1669, 1273, 5475, 68334, 96059, 2129, 1848, 961, 2092, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestQuoteRepo_Save(t *testing.T) { gdb, err := gorm.Open(sqlite.Open("gorm.db"), &gorm.Config{}) assert.NoError(t, err) type fields struct { DB *gorm.DB } type args struct { quote domain.Quote } tests := []struct { name string fields fields args args wantErr bool }{ { name: "Successful save", fields: fields{ DB: gdb, }, args: args{ quote: domain.Quote{ ID: 1, Body: "I'm a quote", Author: "John Doe", QuoteSource: "john books", }, }, wantErr: false, }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { repo := interfaces.QuoteRepo{ DB: tt.fields.DB, } if err := repo.Save(tt.args.quote); (err != nil) != tt.wantErr { t.Errorf("QuoteRepo.Save() error = %v, wantErr %v", err, tt.wantErr) } deleteAllRecords(t, tt.fields.DB) }) } }
explode_data.jsonl/47192
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 444 }
[ 2830, 3393, 19466, 25243, 78746, 1155, 353, 8840, 836, 8, 341, 3174, 1999, 11, 1848, 1669, 342, 493, 12953, 13148, 632, 12953, 445, 73281, 7076, 3975, 609, 73281, 10753, 37790, 6948, 35699, 1155, 11, 1848, 692, 13158, 5043, 2036, 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...
2
func TestIssue387(t *testing.T) { opts := &redis.Options{Addr: "127.0.0.1:6379"} client := NewClient(opts, WithServiceName("my-redis")) n := 1000 client.Set("test_key", "test_value", 0) var wg sync.WaitGroup wg.Add(n) for i := 0; i < n; i++ { go func() { defer wg.Done() _, err := client.WithContext(context.Background()).Get("test_key").Result() assert.Nil(t, err) }() } wg.Wait() // should not result in a race }
explode_data.jsonl/43234
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 194 }
[ 2830, 3393, 42006, 18, 23, 22, 1155, 353, 8840, 836, 8, 341, 64734, 1669, 609, 21748, 22179, 90, 13986, 25, 330, 16, 17, 22, 13, 15, 13, 15, 13, 16, 25, 21, 18, 22, 24, 16707, 25291, 1669, 1532, 2959, 30885, 11, 3085, 1860, 675,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestCodec(t *testing.T) { roleBinding := rbac.RoleBinding{} // We do want to use package registered rather than testapi here, because we // want to test if the package install and package registered work as expected. data, err := runtime.Encode(api.Codecs.LegacyCodec(registered.GroupOrDie(rbac.GroupName).GroupVersion), &roleBinding) if err != nil { t.Fatalf("unexpected error: %v", err) } other := rbac.RoleBinding{} if err := json.Unmarshal(data, &other); err != nil { t.Fatalf("unexpected error: %v", err) } if other.APIVersion != registered.GroupOrDie(rbac.GroupName).GroupVersion.String() || other.Kind != "RoleBinding" { t.Errorf("unexpected unmarshalled object %#v", other) } }
explode_data.jsonl/649
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 247 }
[ 2830, 3393, 36913, 1155, 353, 8840, 836, 8, 341, 197, 5778, 15059, 1669, 18717, 580, 35955, 15059, 16094, 197, 322, 1205, 653, 1366, 311, 990, 6328, 9681, 4751, 1091, 1273, 2068, 1588, 11, 1576, 582, 198, 197, 322, 1366, 311, 1273, 42...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestCandidateRecvOtherVote(t *testing.T) { ctx := startup_candidate_test(t) defer teardown_candidate_test(t, ctx) ctx.svr.election_timeout = 3 * time.Second for _, o := range ctx.svr.cluster_info { oo, _ := o.client.(*MockClient) // holy shit oo.ReplaceVoteFunctor(func(id string) func(ctx context.Context, req *pb.RequestVoteReq) (*pb.RequestVoteRes, error) { return func(ctx context.Context, req *pb.RequestVoteReq) (*pb.RequestVoteRes, error) { // mock timeout time.Sleep(3 * time.Second) rsp := new(pb.RequestVoteRes) rsp.Header = new(pb.ResHeader) rsp.Term = req.Term rsp.VoteGranted = id return rsp, nil } }(o.id)) } go ctx.svr.Elect() req := new(pb.RequestVoteReq) req.Header = new(pb.ReqHeader) req.Term = 2 req.CandidateId = "id1" req.LastLogIndex = -1 req.LastLogTerm = -1 ctx.svr.vote_pair.input <- req output := <-ctx.svr.vote_pair.output if output.VoteGranted != "id1" || output.Term != 2 { t.Errorf("bad vote result:%v", output) return } time.Sleep(1 * time.Second) if ctx.svr.state != pb.PeerState_Follower { t.Errorf("after success vote, peer should be follower:%v", ctx.svr.state) } }
explode_data.jsonl/59090
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 502 }
[ 2830, 3393, 63901, 63483, 11409, 41412, 1155, 353, 8840, 836, 8, 341, 20985, 1669, 20567, 62360, 4452, 1155, 340, 16867, 49304, 62360, 4452, 1155, 11, 5635, 340, 20985, 514, 18920, 1734, 1170, 20537, 284, 220, 18, 353, 882, 32435, 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 TestChannelGroup(t *testing.T) { cg := NewChannelGroup(nil) assert.NotNil(t, cg, "ChannelGroup should not be nil") assert.Nil(t, cg.OrdererConfig(), "OrdererConfig should be nil") assert.Nil(t, cg.ApplicationConfig(), "ApplicationConfig should be nil") assert.Nil(t, cg.ConsortiumsConfig(), "ConsortiumsConfig should be nil") _, err := cg.NewGroup(ApplicationGroupKey) assert.NoError(t, err, "Unexpected error for ApplicationGroupKey") _, err = cg.NewGroup(OrdererGroupKey) assert.NoError(t, err, "Unexpected error for OrdererGroupKey") _, err = cg.NewGroup(ConsortiumsGroupKey) assert.NoError(t, err, "Unexpected error for ConsortiumsGroupKey") _, err = cg.NewGroup("BadGroupKey") assert.Error(t, err, "Should have returned error for BadGroupKey") }
explode_data.jsonl/35099
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 268 }
[ 2830, 3393, 9629, 2808, 1155, 353, 8840, 836, 8, 341, 1444, 70, 1669, 1532, 9629, 2808, 27907, 340, 6948, 93882, 1155, 11, 35740, 11, 330, 9629, 2808, 1265, 537, 387, 2092, 1138, 6948, 59678, 1155, 11, 35740, 19664, 261, 2648, 1507, 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...
1
func TestCreateApp(t *testing.T) { testApp := newTestApp() appServer := newTestAppServer() testApp.Spec.Project = "" createReq := application.ApplicationCreateRequest{ Application: *testApp, } app, err := appServer.Create(context.Background(), &createReq) assert.NoError(t, err) assert.NotNil(t, app) assert.NotNil(t, app.Spec) assert.Equal(t, app.Spec.Project, "default") }
explode_data.jsonl/46613
{ "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, 4021, 2164, 1155, 353, 8840, 836, 8, 341, 18185, 2164, 1669, 501, 2271, 2164, 741, 28236, 5475, 1669, 501, 2271, 2164, 5475, 741, 18185, 2164, 36473, 30944, 284, 8389, 39263, 27234, 1669, 3766, 17521, 4021, 1900, 515, 197, 7...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestCommitResultForBuilder(t *testing.T) { c := &commit{ Desc: "x/build/cmd/coordinator: implement dashboard", Hash: "752029e171d535b0dd4ff7bbad5ad0275a3969a8", Time: "10 Nov 18:00", User: "Gopherbot <gopherbot@example.com>", ResultData: []string{"test-builder|true|SomeLog|752029e171d535b0dd4ff7bbad5ad0275a3969a8"}, } want := result{ OK: true, LogHash: "SomeLog", } got := c.ResultForBuilder("test-builder") if diff := cmp.Diff(want, got); diff != "" { t.Errorf("c.ResultForBuilder(%q) mismatch (-want +got):\n%s", "test-builder", diff) } }
explode_data.jsonl/45363
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 275 }
[ 2830, 3393, 33441, 2077, 2461, 3297, 1155, 353, 8840, 836, 8, 341, 1444, 1669, 609, 17413, 515, 197, 10957, 3300, 25, 981, 330, 87, 30593, 83033, 64942, 17442, 25, 4211, 26967, 756, 197, 197, 6370, 25, 981, 330, 22, 20, 17, 15, 17, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func Test_Params_SupportChars(t *testing.T) { p, _ := ports.PopRand() s := g.Server(p) s.BindHandler("/form-value", func(r *ghttp.Request) { r.Response.Write(r.GetQuery("test-value")) }) s.BindHandler("/form-array", func(r *ghttp.Request) { r.Response.Write(r.GetQuery("test-array")) }) s.SetPort(p) s.SetDumpRouterMap(false) s.Start() defer s.Shutdown() time.Sleep(100 * time.Millisecond) gtest.C(t, func(t *gtest.T) { prefix := fmt.Sprintf("http://127.0.0.1:%d", p) client := ghttp.NewClient() client.SetPrefix(prefix) t.Assert(client.PostContent("/form-value", "test-value=100"), "100") t.Assert(client.PostContent("/form-array", "test-array[]=1&test-array[]=2"), `["1","2"]`) }) }
explode_data.jsonl/1949
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 315 }
[ 2830, 3393, 44656, 1098, 2800, 32516, 1155, 353, 8840, 836, 8, 341, 3223, 11, 716, 1669, 20325, 47424, 56124, 741, 1903, 1669, 342, 22997, 1295, 340, 1903, 32451, 3050, 4283, 627, 19083, 497, 2915, 2601, 353, 70, 1254, 9659, 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...
1
func TestChildOrder(t *testing.T) { client := v1.New(&v1.Config{ Key: os.Getenv("BFKEY"), Secret: os.Getenv("BFSECRET"), }) o, err := client.ChildOrder(orders.NewForChildOrder( types.FXBTCJPY, types.LIMIT, types.BUY, types.GTC, 350000, types.ToSize(0.03), 1, )) assert.NoError(t, err) fmt.Printf("%+v\n", o) }
explode_data.jsonl/41210
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 168 }
[ 2830, 3393, 3652, 4431, 1155, 353, 8840, 836, 8, 341, 25291, 1669, 348, 16, 7121, 2099, 85, 16, 10753, 515, 197, 55242, 25, 262, 2643, 64883, 445, 19883, 4784, 4461, 197, 7568, 50856, 25, 2643, 64883, 445, 19883, 65310, 4461, 197, 351...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestFeatureKeySet(t *testing.T) { var a, b FeatureKeySet a.Merge(b) assert.Nil(t, a) f0 := featurefmt.PackageKey{Name: "a", Version: "v1"} f1 := featurefmt.PackageKey{Name: "b", Version: "v2"} f2 := featurefmt.PackageKey{Name: "c", Version: "v3"} a = FeatureKeySet{featurefmt.PackageKey{Name: "a", Version: "v1"}: {}} b.Merge(a) assert.Equal(t, a, b) a.Add(f1) b.Add(f2) a.Merge(b) assert.Len(t, a, 3) assert.Contains(t, a, f1, f2, f0) }
explode_data.jsonl/35736
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 223 }
[ 2830, 3393, 13859, 1592, 1649, 1155, 353, 8840, 836, 8, 341, 2405, 264, 11, 293, 19998, 1592, 1649, 198, 11323, 93855, 1883, 340, 6948, 59678, 1155, 11, 264, 692, 1166, 15, 1669, 4565, 12501, 49834, 1592, 63121, 25, 330, 64, 497, 6079...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestBuilder_ToBoundSQL(t *testing.T) { newSQL, err := Select("id").From("table").Where(In("a", 1, 2)).ToBoundSQL() assert.NoError(t, err) assert.EqualValues(t, "SELECT id FROM table WHERE a IN (1,2)", newSQL) }
explode_data.jsonl/63970
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 83 }
[ 2830, 3393, 3297, 38346, 19568, 6688, 1155, 353, 8840, 836, 8, 341, 8638, 6688, 11, 1848, 1669, 8427, 445, 307, 1827, 3830, 445, 2005, 1827, 9064, 47614, 445, 64, 497, 220, 16, 11, 220, 17, 4579, 1249, 19568, 6688, 741, 6948, 35699, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestValidateV1Beta1MissingSourceOnChartWhileUsingChartsSource(t *testing.T) { manifest := `--- apiVersion: manifests/v1beta1 metadata: name: test-manifest spec: sources: charts: - type: directory name: local location: ./charts charts: - name: chart1 namespace: default version: 1.0.0 ` _, err := Validate(manifest) if err == nil || !strings.Contains(err.Error(), "manifest validation errors") { t.Errorf("Didn't get expected error from manifest.TestValidateV1Beta1MissingSourceOnChartWhileUsingChartsSource(), instead got: %s", err) } }
explode_data.jsonl/80478
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 208 }
[ 2830, 3393, 17926, 53, 16, 64811, 16, 25080, 3608, 1925, 14488, 7983, 16429, 64878, 3608, 1155, 353, 8840, 836, 8, 341, 197, 42315, 1669, 1565, 10952, 2068, 5637, 25, 83232, 5457, 16, 19127, 16, 198, 17637, 510, 220, 829, 25, 1273, 20...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestStmtComment(t *testing.T) { if testing.Short() { t.Skip() } execStatements(t, []string{ "create table t1(id int, val varbinary(128), primary key(id))", }) defer execStatements(t, []string{ "drop table t1", }) engine.se.Reload(context.Background()) queries := []string{ "begin", "insert into t1 values (1, 'aaa')", "commit", "/*!40000 ALTER TABLE `t1` DISABLE KEYS */", } testcases := []testcase{{ input: queries, output: [][]string{{ `begin`, `type:FIELD field_event:{table_name:"t1" fields:{name:"id" type:INT32 table:"t1" org_table:"t1" database:"vttest" org_name:"id" column_length:11 charset:63 column_type:"int(11)"} fields:{name:"val" type:VARBINARY table:"t1" org_table:"t1" database:"vttest" org_name:"val" column_length:128 charset:63 column_type:"varbinary(128)"}}`, `type:ROW row_event:{table_name:"t1" row_changes:{after:{lengths:1 lengths:3 values:"1aaa"}}}`, `gtid`, `commit`, }, { `gtid`, `other`, }}, }} runCases(t, nil, testcases, "current", nil) }
explode_data.jsonl/10400
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 430 }
[ 2830, 3393, 31063, 10677, 1155, 353, 8840, 836, 8, 1476, 743, 7497, 55958, 368, 341, 197, 3244, 57776, 741, 197, 630, 67328, 93122, 1155, 11, 3056, 917, 515, 197, 197, 1, 3182, 1965, 259, 16, 3724, 526, 11, 1044, 762, 25891, 7, 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...
2
func TestCreateInstallScript(t *testing.T) { s1, err := CreateInstallScript("v3.2.12") if err != nil { t.Fatal(err) } fmt.Println(s1) s1, err = CreateInstallScript("3.2.12") if err != nil { t.Fatal(err) } fmt.Println(s1) s2, err := CreateInstallScript("master") if err != nil { t.Fatal(err) } fmt.Println(s2) s3, err := CreateInstallScript("9876") if err != nil { t.Fatal(err) } fmt.Println(s3) }
explode_data.jsonl/62584
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 201 }
[ 2830, 3393, 4021, 24690, 5910, 1155, 353, 8840, 836, 8, 341, 1903, 16, 11, 1848, 1669, 4230, 24690, 5910, 445, 85, 18, 13, 17, 13, 16, 17, 1138, 743, 1848, 961, 2092, 341, 197, 3244, 26133, 3964, 340, 197, 532, 11009, 12419, 1141, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
5
func TestMatEigen(t *testing.T) { src := NewMatWithSize(10, 10, MatTypeCV32F) eigenvalues := NewMat() eigenvectors := NewMat() Eigen(src, &eigenvalues, &eigenvectors) if eigenvectors.Empty() || eigenvalues.Empty() { t.Error("TestEigen should not have empty eigenvectors or eigenvalues.") } src.Close() eigenvectors.Close() eigenvalues.Close() }
explode_data.jsonl/81737
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 138 }
[ 2830, 3393, 11575, 71740, 1155, 353, 8840, 836, 8, 341, 41144, 1669, 1532, 11575, 2354, 1695, 7, 16, 15, 11, 220, 16, 15, 11, 6867, 929, 19589, 18, 17, 37, 340, 7727, 6433, 3661, 1669, 1532, 11575, 741, 7727, 343, 3160, 10605, 1669,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestRestClient(t *testing.T) { u, _ := url.Parse("http://www.test.com") rest, err := NewRestClient(*u, confighttp.HTTPClientSettings{}, zap.NewNop()) require.NoError(t, err) require.NotNil(t, rest) }
explode_data.jsonl/37452
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 84 }
[ 2830, 3393, 12416, 2959, 1155, 353, 8840, 836, 8, 341, 10676, 11, 716, 1669, 2515, 8937, 445, 1254, 1110, 2136, 5958, 905, 1138, 197, 3927, 11, 1848, 1669, 1532, 12416, 2959, 4071, 84, 11, 2335, 491, 790, 27358, 2959, 6086, 22655, 329...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestOverwrite(t *testing.T) { key := "test/overwrite" mock, cache := NewMock(createInitial( getParamName(key), fmt.Sprintf(`{"TTL":300,"Value":"%s"}`, uuid.NewString()), )) value := uuid.NewString() ttl := time.Hour cache.Set(context.Background(), key, value, ttl) got, _ := cache.Get(context.Background(), key) if *got != value { t.Fatalf("Got %v, expected %v", *got, value) } expectedCalls := []string{"PutParameter", "GetParameter"} if !reflect.DeepEqual(mock.calls, expectedCalls) { t.Fatalf("Calls = %v, expected %v", mock.calls, expectedCalls) } }
explode_data.jsonl/80141
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 225 }
[ 2830, 3393, 1918, 4934, 1155, 353, 8840, 836, 8, 341, 23634, 1669, 330, 1944, 14, 64915, 1837, 77333, 11, 6500, 1669, 1532, 11571, 32602, 6341, 1006, 197, 10366, 2001, 675, 4857, 701, 8879, 17305, 5809, 4913, 51, 13470, 788, 18, 15, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestSetReportState(t *testing.T) { err := reportManager.SetReportState("a.json") if err != nil { t.Errorf("SetReportState failed due to %v", err) } err = os.Remove("a.json") if err != nil { t.Errorf("Error removing telemetry file due to %v", err) } }
explode_data.jsonl/49203
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 101 }
[ 2830, 3393, 1649, 10361, 1397, 1155, 353, 8840, 836, 8, 341, 9859, 1669, 1895, 2043, 4202, 10361, 1397, 445, 64, 4323, 1138, 743, 1848, 961, 2092, 341, 197, 3244, 13080, 445, 1649, 10361, 1397, 4641, 4152, 311, 1018, 85, 497, 1848, 34...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestPrefixPoolValidation(t *testing.T) { _, err := prefixpool.New("10.20.0.0/24") require.Nil(t, err) _, err = prefixpool.New("10.20.0.0/56") if assert.Error(t, err) { require.Equal(t, &net.ParseError{Type: "CIDR address", Text: "10.20.0.0/56"}, err) } }
explode_data.jsonl/45824
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 125 }
[ 2830, 3393, 14335, 10551, 13799, 1155, 353, 8840, 836, 8, 341, 197, 6878, 1848, 1669, 9252, 10285, 7121, 445, 16, 15, 13, 17, 15, 13, 15, 13, 15, 14, 17, 19, 1138, 17957, 59678, 1155, 11, 1848, 340, 197, 6878, 1848, 284, 9252, 102...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestIfdBuilder_ReplaceN(t *testing.T) { im := NewIfdMapping() err := LoadStandardIfds(im) log.PanicIf(err) ti := NewTagIndex() ib := NewIfdBuilder(im, ti, exifcommon.IfdStandardIfdIdentity, exifcommon.TestDefaultByteOrder) bt := &BuilderTag{ ifdPath: exifcommon.IfdStandardIfdIdentity.UnindexedString(), typeId: exifcommon.TypeByte, tagId: 0x11, value: NewIfdBuilderTagValueFromBytes([]byte("test string")), } err = ib.Add(bt) log.PanicIf(err) bt = &BuilderTag{ ifdPath: exifcommon.IfdStandardIfdIdentity.UnindexedString(), typeId: exifcommon.TypeByte, tagId: 0x22, value: NewIfdBuilderTagValueFromBytes([]byte("test string2")), } err = ib.Add(bt) log.PanicIf(err) bt = &BuilderTag{ ifdPath: exifcommon.IfdStandardIfdIdentity.UnindexedString(), typeId: exifcommon.TypeByte, tagId: 0x33, value: NewIfdBuilderTagValueFromBytes([]byte("test string3")), } err = ib.Add(bt) log.PanicIf(err) currentIds := make([]uint16, 3) for i, bt := range ib.Tags() { currentIds[i] = bt.tagId } if reflect.DeepEqual([]uint16{0x11, 0x22, 0x33}, currentIds) == false { t.Fatalf("Pre-replace tags are not correct.") } bt = &BuilderTag{ ifdPath: exifcommon.IfdStandardIfdIdentity.UnindexedString(), typeId: exifcommon.TypeByte, tagId: 0xA9, value: NewIfdBuilderTagValueFromBytes([]byte("test string4")), } err = ib.ReplaceAt(1, bt) log.PanicIf(err) currentIds = make([]uint16, 3) for i, bt := range ib.Tags() { currentIds[i] = bt.tagId } if reflect.DeepEqual([]uint16{0x11, 0xA9, 0x33}, currentIds) == false { t.Fatalf("Post-replace tags are not correct.") } }
explode_data.jsonl/36636
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 712 }
[ 2830, 3393, 2679, 67, 3297, 62, 23107, 45, 1155, 353, 8840, 836, 8, 341, 54892, 1669, 1532, 2679, 67, 6807, 2822, 9859, 1669, 8893, 19781, 2679, 5356, 25107, 340, 6725, 1069, 31270, 2679, 3964, 692, 72859, 1669, 1532, 5668, 1552, 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...
5
func TestChainProviderWithNoValidProvider(t *testing.T) { errs := []error{ awserr.New("FirstError", "first provider error", nil), awserr.New("SecondError", "second provider error", nil), } p := &ChainProvider{ Providers: []Provider{ &stubProvider{err: errs[0]}, &stubProvider{err: errs[1]}, }, } if !p.IsExpired() { t.Errorf("Expect expired with no providers") } _, err := p.Retrieve() if e, a := ErrNoValidProvidersFoundInChain, err; e != a { t.Errorf("Expect no providers error returned, %v, got %v", e, a) } }
explode_data.jsonl/34839
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 215 }
[ 2830, 3393, 18837, 5179, 2354, 2753, 4088, 5179, 1155, 353, 8840, 836, 8, 341, 9859, 82, 1669, 3056, 841, 515, 197, 197, 8635, 615, 7121, 445, 5338, 1454, 497, 330, 3896, 9109, 1465, 497, 2092, 1326, 197, 197, 8635, 615, 7121, 445, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestContextHandler(t *testing.T) { c, _ := CreateTestContext(httptest.NewRecorder()) c.handlers = HandlersChain{func(c *Context) {}, handlerTest} assert.Equal(t, reflect.ValueOf(handlerTest).Pointer(), reflect.ValueOf(c.Handler()).Pointer()) }
explode_data.jsonl/26760
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 87 }
[ 2830, 3393, 1972, 3050, 1155, 353, 8840, 836, 8, 341, 1444, 11, 716, 1669, 4230, 2271, 1972, 73392, 83, 70334, 7121, 47023, 2398, 1444, 55001, 284, 95563, 18837, 90, 2830, 1337, 353, 1972, 8, 16452, 7013, 2271, 630, 6948, 12808, 1155, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
func TestZip(t *testing.T) { zips := getFiles(t, regexp.MustCompile(`^\w+beat-\S+.zip$`)) for _, zip := range zips { checkZip(t, zip) } }
explode_data.jsonl/2320
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 68 }
[ 2830, 3393, 31047, 1155, 353, 8840, 836, 8, 341, 20832, 3077, 1669, 633, 10809, 1155, 11, 41877, 98626, 5809, 24884, 86, 10, 22227, 30529, 50, 48920, 9964, 3, 63, 1171, 2023, 8358, 10308, 1669, 2088, 1147, 3077, 341, 197, 25157, 31047, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestLock_Conflict(t *testing.T) { t.Parallel() c, s := makeClient(t) defer s.Stop() sema, err := c.SemaphorePrefix("test/lock/", 2) if err != nil { t.Fatalf("err: %v", err) } // Should work lockCh, err := sema.Acquire(nil) if err != nil { t.Fatalf("err: %v", err) } if lockCh == nil { t.Fatalf("not hold") } defer sema.Release() lock, err := c.LockKey("test/lock/.lock") if err != nil { t.Fatalf("err: %v", err) } // Should conflict with semaphore _, err = lock.Lock(nil) if err != ErrLockConflict { t.Fatalf("err: %v", err) } // Should conflict with semaphore err = lock.Destroy() if err != ErrLockConflict { t.Fatalf("err: %v", err) } }
explode_data.jsonl/27627
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 301 }
[ 2830, 3393, 11989, 15100, 69, 21242, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 741, 1444, 11, 274, 1669, 1281, 2959, 1155, 340, 16867, 274, 30213, 2822, 84686, 1728, 11, 1848, 1669, 272, 808, 336, 25545, 14335, 445, 1944, 14, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
7
func TestDeleteStrategy(t *testing.T) { // Happy paths ds, err := NewDeleteStrategy("system") require.NoError(t, err) require.Equal(t, DeleteStrategySystem, ds) ds, err = NewDeleteStrategy("all") require.NoError(t, err) require.Equal(t, DeleteStrategyAll, ds) // Upper case resistant ds, err = NewDeleteStrategy("System") require.NoError(t, err) require.Equal(t, DeleteStrategySystem, ds) ds, err = NewDeleteStrategy("All") require.NoError(t, err) require.Equal(t, DeleteStrategyAll, ds) // empty value guard ds, err = NewDeleteStrategy("") require.NoError(t, err) require.Equal(t, DeleteStrategySystem, ds) // unsupported value _, err = NewDeleteStrategy("not-a-strategy") require.Error(t, err) }
explode_data.jsonl/20373
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 269 }
[ 2830, 3393, 6435, 19816, 1155, 353, 8840, 836, 8, 1476, 197, 322, 23355, 12716, 198, 83336, 11, 1848, 1669, 1532, 6435, 19816, 445, 8948, 1138, 17957, 35699, 1155, 11, 1848, 340, 17957, 12808, 1155, 11, 10428, 19816, 2320, 11, 11472, 69...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestDownloadAndHashErrors(t *testing.T) { var tests = []struct { be repository.Loader err string }{ { be: backend{rd: errorReader{errors.New("test error 1")}}, err: "test error 1", }, } for _, test := range tests { t.Run("", func(t *testing.T) { _, _, _, err := repository.DownloadAndHash(context.TODO(), test.be, restic.Handle{}) if err == nil { t.Fatalf("wanted error %q, got nil", test.err) } if errors.Cause(err).Error() != test.err { t.Fatalf("wanted error %q, got %q", test.err, err) } }) } }
explode_data.jsonl/71944
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 241 }
[ 2830, 3393, 11377, 3036, 6370, 13877, 1155, 353, 8840, 836, 8, 341, 2405, 7032, 284, 3056, 1235, 341, 197, 73142, 220, 12542, 82987, 198, 197, 9859, 914, 198, 197, 59403, 197, 197, 515, 298, 73142, 25, 220, 19163, 90, 6498, 25, 1465, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestStatsToDefaultMetrics(t *testing.T) { stats := statsJSON(t) containers := containerJSON(t) config := &Config{} md, err := ContainerStatsToMetrics(stats, containers, config) assert.Nil(t, err) assert.NotNil(t, md) assertMetricsDataEqual(t, defaultMetrics(), nil, md) }
explode_data.jsonl/4109
{ "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, 16635, 1249, 3675, 27328, 1155, 353, 8840, 836, 8, 341, 79659, 1669, 10472, 5370, 1155, 340, 197, 39399, 1669, 5476, 5370, 1155, 340, 25873, 1669, 609, 2648, 31483, 84374, 11, 1848, 1669, 9678, 16635, 1249, 27328, 50714, 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 TestCoveringQueries(t *testing.T) { if base.UnitTestUrlIsWalrus() || base.TestsDisableGSI() { t.Skip("This test is Couchbase Server and UseViews=false only") } db := setupTestDB(t) defer db.Close() gocbBucket, ok := base.AsGoCBBucket(db.Bucket) if !ok { t.Errorf("Unable to get gocbBucket for testBucket") } // channels channelsStatement, params := db.buildChannelsQuery("ABC", 0, 10, 100, false) plan, explainErr := gocbBucket.ExplainQuery(channelsStatement, params) assert.NoError(t, explainErr, "Error generating explain for channels query") covered := isCovered(plan) planJSON, err := base.JSONMarshal(plan) assert.NoError(t, err) assert.True(t, covered, "Channel query isn't covered by index: %s", planJSON) // star channel channelStarStatement, params := db.buildChannelsQuery("*", 0, 10, 100, false) plan, explainErr = gocbBucket.ExplainQuery(channelStarStatement, params) assert.NoError(t, explainErr, "Error generating explain for star channel query") covered = isCovered(plan) planJSON, err = base.JSONMarshal(plan) assert.NoError(t, err) assert.True(t, covered, "Star channel query isn't covered by index: %s", planJSON) // Access and roleAccess currently aren't covering, because of the need to target the user property by name // in the SELECT. // Including here for ease-of-conversion when we get an indexing enhancement to support covered queries. accessStatement := db.buildAccessQuery("user1") plan, explainErr = gocbBucket.ExplainQuery(accessStatement, nil) assert.NoError(t, explainErr, "Error generating explain for access query") covered = isCovered(plan) planJSON, err = base.JSONMarshal(plan) assert.NoError(t, err) //assert.True(t, covered, "Access query isn't covered by index: %s", planJSON) // roleAccess roleAccessStatement := db.buildRoleAccessQuery("user1") plan, explainErr = gocbBucket.ExplainQuery(roleAccessStatement, nil) assert.NoError(t, explainErr, "Error generating explain for roleAccess query") covered = isCovered(plan) planJSON, err = base.JSONMarshal(plan) assert.NoError(t, err) //assert.True(t, !covered, "RoleAccess query isn't covered by index: %s", planJSON) }
explode_data.jsonl/2707
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 713 }
[ 2830, 3393, 30896, 287, 55261, 1155, 353, 8840, 836, 8, 341, 743, 2331, 25159, 2271, 2864, 3872, 88298, 20341, 368, 1369, 2331, 37133, 25479, 38, 13817, 368, 341, 197, 3244, 57776, 445, 1986, 1273, 374, 61128, 3152, 8422, 323, 5443, 232...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestOutboundListenerAccessLogs(t *testing.T) { t.Helper() p := &fakePlugin{} listeners := buildAllListeners(p, nil) for _, l := range listeners { if l.Name == "virtual" { fc := &tcp_proxy.TcpProxy{} if err := getFilterConfig(l.FilterChains[0].Filters[0], fc); err != nil { t.Fatalf("failed to get TCP Proxy config: %s", err) } if fc.AccessLog == nil { t.Fatal("expected access log configuration") } } } }
explode_data.jsonl/61274
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 184 }
[ 2830, 3393, 2662, 10891, 2743, 6054, 51053, 1155, 353, 8840, 836, 8, 341, 3244, 69282, 741, 3223, 1669, 609, 30570, 11546, 16094, 14440, 18223, 1669, 1936, 2403, 31570, 1295, 11, 2092, 340, 2023, 8358, 326, 1669, 2088, 23562, 341, 197, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
5
func TestSubmitWithInvalidJSON(t *testing.T) { if testing.Short() { t.Skip("skip test in short mode") } sess, err := NewSession() if err != nil { t.Fatal(err) } ctx := sess.NewContext() result, err := sess.Submit(ctx, "{") if err == nil || err.Error() != "unexpected end of JSON input" { t.Fatalf("not the error we expected: %+v", err) } if result != nil { t.Fatal("expected nil result here") } }
explode_data.jsonl/78953
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 163 }
[ 2830, 3393, 8890, 2354, 7928, 5370, 1155, 353, 8840, 836, 8, 341, 743, 7497, 55958, 368, 341, 197, 3244, 57776, 445, 20599, 1273, 304, 2805, 3856, 1138, 197, 532, 1903, 433, 11, 1848, 1669, 1532, 5283, 741, 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...
6
func TestDispatchCheck_Success(t *testing.T) { h := &mockHandler{checkResult: adapter.CheckResult{ ValidUseCount: 23, }} r, err := executeDispatchCheck(t, h) if err != nil { t.Fatalf("Unexpected error found: '%v'", err) } if len(h.instances) != 1 { t.Fatalf("Unexpected number of instances: %d", len(h.instances)) } if instance, ok := h.instances[0].(*sample_check.Instance); !ok || instance.Name != "instance1" { t.Fatalf("Unexpected instance: %+v", h.instances[0]) } if !reflect.DeepEqual(h.checkResult, r) { t.Fatalf("The check result was not propagated correctly.") } }
explode_data.jsonl/64993
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 226 }
[ 2830, 3393, 11283, 3973, 87161, 1155, 353, 8840, 836, 8, 341, 9598, 1669, 609, 16712, 3050, 90, 2028, 2077, 25, 12956, 10600, 2077, 515, 197, 197, 4088, 10253, 2507, 25, 220, 17, 18, 345, 197, 47449, 7000, 11, 1848, 1669, 9026, 11283,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestRequestAgentAttributesPresent(t *testing.T) { req, err := http.NewRequest("GET", "http://www.newrelic.com?remove=me", nil) if nil != err { t.Fatal(err) } req.Header.Set("Accept", "the-accept") req.Header.Set("Content-Type", "the-content-type") req.Header.Set("Host", "the-host") req.Header.Set("User-Agent", "the-agent") req.Header.Set("Referer", "http://www.example.com") req.Header.Set("Content-Length", "123") cfg := CreateAttributeConfig(sampleAttributeConfigInput, true) attrs := NewAttributes(cfg) RequestAgentAttributes(attrs, req.Method, req.Header, req.URL) got := agentAttributesMap(attrs, DestAll) expectAttributes(t, got, map[string]interface{}{ "request.headers.contentType": "the-content-type", "request.headers.host": "the-host", "request.headers.User-Agent": "the-agent", "request.headers.referer": "http://www.example.com", "request.headers.contentLength": 123, "request.method": "GET", "request.uri": "http://www.newrelic.com", "request.headers.accept": "the-accept", }) }
explode_data.jsonl/20604
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 435 }
[ 2830, 3393, 1900, 16810, 10516, 21195, 1155, 353, 8840, 836, 8, 341, 24395, 11, 1848, 1669, 1758, 75274, 445, 3806, 497, 330, 1254, 1110, 2136, 4618, 265, 415, 905, 30, 5399, 28, 2660, 497, 2092, 340, 743, 2092, 961, 1848, 341, 197, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestStartOfDay(t *testing.T) { res := StartOfDay(testDate) str := Date(res, "Y-m-d H:i:s") require.Equal(t, "2020-03-10 00:00:00", str) }
explode_data.jsonl/45314
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 69 }
[ 2830, 3393, 3479, 55075, 1155, 353, 8840, 836, 8, 341, 10202, 1669, 5145, 55075, 8623, 1916, 340, 11355, 1669, 2631, 4590, 11, 330, 56, 1448, 1737, 472, 14665, 14495, 1138, 17957, 12808, 1155, 11, 330, 17, 15, 17, 15, 12, 15, 18, 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
func TestDecodeAssuredCallNilBody(t *testing.T) { decoded := false expected := &Call{ Path: "test/assured", StatusCode: http.StatusOK, Method: http.MethodDelete, Headers: map[string]string{}, Query: map[string]string{}, } testDecode := func(resp http.ResponseWriter, req *http.Request) { c, err := decodeAssuredCall(ctx, req) require.NoError(t, err) require.Equal(t, expected, c) decoded = true } req, err := http.NewRequest(http.MethodDelete, "/when/test/assured", nil) require.NoError(t, err) router := mux.NewRouter() router.HandleFunc("/when/{path:.*}", testDecode).Methods(http.MethodDelete) resp := httptest.NewRecorder() router.ServeHTTP(resp, req) require.True(t, decoded, "decode method was not hit") }
explode_data.jsonl/20254
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 306 }
[ 2830, 3393, 32564, 5615, 3073, 7220, 19064, 5444, 1155, 353, 8840, 836, 8, 341, 197, 62913, 1669, 895, 198, 42400, 1669, 609, 7220, 515, 197, 69640, 25, 981, 330, 1944, 14, 395, 3073, 756, 197, 197, 15872, 25, 1758, 52989, 345, 197, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestAppsGroupBackwardCompatibility(t *testing.T) { _, s, closeFn := framework.RunAMaster(nil) defer closeFn() transport := http.DefaultTransport requests := []struct { verb string URL string body string expectedStatusCodes map[int]bool expectedVersion string }{ // Post to extensions endpoint and get back from both: extensions and apps {"POST", extensionsPath("deployments", metav1.NamespaceDefault, ""), deploymentExtensions, integration.Code201, ""}, {"GET", extensionsPath("deployments", metav1.NamespaceDefault, "test-deployment1"), "", integration.Code200, testapi.Extensions.GroupVersion().String()}, {"GET", appsPath("deployments", metav1.NamespaceDefault, "test-deployment1"), "", integration.Code200, testapi.Apps.GroupVersion().String()}, {"DELETE", extensionsPath("deployments", metav1.NamespaceDefault, "test-deployment1"), "", integration.Code200, testapi.Extensions.GroupVersion().String()}, // Post to apps endpoint and get back from both: apps and extensions {"POST", appsPath("deployments", metav1.NamespaceDefault, ""), deploymentApps, integration.Code201, ""}, {"GET", appsPath("deployments", metav1.NamespaceDefault, "test-deployment2"), "", integration.Code200, testapi.Apps.GroupVersion().String()}, {"GET", extensionsPath("deployments", metav1.NamespaceDefault, "test-deployment2"), "", integration.Code200, testapi.Extensions.GroupVersion().String()}, {"DELETE", appsPath("deployments", metav1.NamespaceDefault, "test-deployment2"), "", integration.Code200, testapi.Apps.GroupVersion().String()}, } for _, r := range requests { bodyBytes := bytes.NewReader([]byte(r.body)) req, err := http.NewRequest(r.verb, s.URL+r.URL, bodyBytes) if err != nil { t.Logf("case %v", r) t.Fatalf("unexpected error: %v", err) } func() { resp, err := transport.RoundTrip(req) defer resp.Body.Close() if err != nil { t.Logf("case %v", r) t.Fatalf("unexpected error: %v", err) } b, _ := ioutil.ReadAll(resp.Body) body := string(b) if _, ok := r.expectedStatusCodes[resp.StatusCode]; !ok { t.Logf("case %v", r) t.Errorf("Expected status one of %v, but got %v", r.expectedStatusCodes, resp.StatusCode) t.Errorf("Body: %v", body) } if !strings.Contains(body, "\"apiVersion\":\""+r.expectedVersion) { t.Logf("case %v", r) t.Errorf("Expected version %v, got body %v", r.expectedVersion, body) } }() } }
explode_data.jsonl/67592
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 934 }
[ 2830, 3393, 53602, 2808, 3707, 1606, 85880, 1155, 353, 8840, 836, 8, 341, 197, 6878, 274, 11, 3265, 24911, 1669, 12626, 16708, 1402, 2300, 27907, 340, 16867, 3265, 24911, 741, 197, 26445, 1669, 1758, 13275, 27560, 271, 23555, 82, 1669, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
4
func TestArbitraryDelimiters(t *testing.T) { str1 := "ISA&00& &00& &ZZ&ZZ000 &ZZ&ZZ001 &030828&1128&U&00401&000010121&0&T&!+\n" str1 += "GS&HC&ZZ000&ZZ001&20030828&1128&17&X&004010X098+\n" str1 += "ST&837&11280001+\n" str1 += "TST&AA!1!1&BB!5+\n" str1 += "SE&3&11280001+\n" str1 += "GE&1&17+\n" str1 += "IEA&1&000010121+\n" inFile := strings.NewReader(str1) raw, err := NewRawX12FileReader(inFile) if err != nil { t.Errorf("NewRawX12FileReader failed") } //expectedDelimeters := Delimiters{'+', '&', '!', 0} expectedSegTerm := '+' expectedElementTerm := '&' expectedSubelementTerm := '!' expectedRepetitionTerm := 0 if raw.segmentTerm != byte(expectedSegTerm) { t.Errorf("Didn't get expected result [%c], instead got [%c]", expectedSegTerm, raw.segmentTerm) } if raw.elementTerm != byte(expectedElementTerm) { t.Errorf("Didn't get expected result [%c], instead got [%c]", expectedElementTerm, raw.elementTerm) } if raw.subelementTerm != byte(expectedSubelementTerm) { t.Errorf("Didn't get expected result [%c], instead got [%c]", expectedSubelementTerm, raw.subelementTerm) } if raw.repetitionTerm != byte(expectedRepetitionTerm) { t.Errorf("Didn't get expected result [%c], instead got [%c]", expectedRepetitionTerm, raw.repetitionTerm) } expectedCount := 7 ct := 0 for _ = range raw.GetSegments() { ct += 1 } if ct != expectedCount { t.Errorf("Didn't get expected segment count of %d, instead got %d", expectedCount, ct) } }
explode_data.jsonl/53722
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 643 }
[ 2830, 3393, 6953, 87851, 16532, 67645, 1155, 353, 8840, 836, 8, 341, 11355, 16, 1669, 330, 34201, 5, 15, 15, 5, 688, 609, 15, 15, 5, 688, 609, 33536, 5, 33536, 15, 15, 15, 688, 609, 33536, 5, 33536, 15, 15, 16, 688, 609, 15, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
8
func TestWildcard(t *testing.T) { testInputs(t, ` a*b ad `, []TestInput{ {URL: "", Matched: false}, {URL: "foo", Matched: false}, {URL: "a", Matched: false}, {URL: "ab", Matched: true}, {URL: "acb", Matched: true}, {URL: "cacb", Matched: true}, {URL: "cacbc", Matched: true}, {URL: "ad", Matched: true}, }) }
explode_data.jsonl/81613
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 166 }
[ 2830, 3393, 92988, 1155, 353, 8840, 836, 8, 341, 18185, 31946, 1155, 11, 22074, 64, 33279, 198, 329, 198, 12892, 197, 197, 1294, 2271, 2505, 515, 298, 197, 90, 3144, 25, 7342, 14152, 291, 25, 895, 1583, 298, 197, 90, 3144, 25, 330, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestMarshalingPartialCertToProto(t *testing.T) { pc1, _ := data.CreatePartialCert(config.ReplicaID(0), &pk, &testBlock) ppc := PartialCertToProto(pc1) pc2 := ppc.FromProto() if !bytes.Equal(pc1.BlockHash[:], pc2.BlockHash[:]) { t.Errorf("Hashes don't match! Got %v, want: %v\n", hex.EncodeToString(pc2.BlockHash[:]), hex.EncodeToString(pc1.BlockHash[:])) } if !data.VerifyPartialCert(&simpleRc, pc2) { t.Errorf("Cert failed to verify!\n") } }
explode_data.jsonl/69357
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 203 }
[ 2830, 3393, 79712, 6132, 37314, 36934, 1249, 31549, 1155, 353, 8840, 836, 8, 341, 82013, 16, 11, 716, 1669, 821, 7251, 37314, 36934, 8754, 2817, 79, 15317, 915, 7, 15, 701, 609, 20819, 11, 609, 1944, 4713, 692, 65729, 66, 1669, 24552,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestMultiError_Error(t *testing.T) { multiErrors := MultiError{} multiErrors.Errors = append(multiErrors.Errors, errors.New("invalid")) multiErrors.Errors = append(multiErrors.Errors, errors.New("fatal")) if "[invalid fatal]" != multiErrors.Error() { t.Fatal("Test Error()") } }
explode_data.jsonl/57819
{ "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, 20358, 1454, 28651, 1155, 353, 8840, 836, 8, 341, 2109, 7068, 13877, 1669, 17439, 1454, 16094, 2109, 7068, 13877, 61745, 284, 8737, 1255, 7068, 13877, 61745, 11, 5975, 7121, 445, 11808, 5455, 2109, 7068, 13877, 61745, 284, 873...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestIssue17697(t *testing.T) { _, err := ParseBytes(nil, nil, nil, nil, 0) // return with parser error, don't panic if err == nil { t.Errorf("no error reported") } }
explode_data.jsonl/24650
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 66 }
[ 2830, 3393, 42006, 16, 22, 21, 24, 22, 1155, 353, 8840, 836, 8, 341, 197, 6878, 1848, 1669, 14775, 7078, 27907, 11, 2092, 11, 2092, 11, 2092, 11, 220, 15, 8, 442, 470, 448, 6729, 1465, 11, 1513, 944, 21975, 198, 743, 1848, 621, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
2
func Test_sqlCollectionDataWhereAddedAfter(t *testing.T) { var b bytes.Buffer var testdata string t.Log("Test 1: get an error for invalid timestamp") if err := sqlCollectionDataWhereAddedAfter([]string{"20011"}, &b); err == nil { t.Error("no error returned") } t.Log("Test 2: do not get an error if year date is used for added after") if err := sqlCollectionDataWhereAddedAfter([]string{"2017"}, &b); err != nil { t.Error(err) } t.Log("Test 3: do not get an error if full date is used for added after") if err := sqlCollectionDataWhereAddedAfter([]string{"2017-03-02"}, &b); err != nil { t.Error(err) } t.Log("Test 4: do not get an error if a full timestamp (micro) is used for added after") if err := sqlCollectionDataWhereAddedAfter([]string{"2017-03-02T01:01:01.123456Z"}, &b); err != nil { t.Error(err) } t.Log("Test 5: do not get an error if a full timestamp (milli) is used for added after") if err := sqlCollectionDataWhereAddedAfter([]string{"2017-03-02T01:01:01.123Z"}, &b); err != nil { t.Error(err) } t.Log("Test 6: get an error if the timezone Z is left off") if err := sqlCollectionDataWhereAddedAfter([]string{"2017-03-02T01:01:01"}, &b); err == nil { t.Error("no error returned") } t.Log("Test 7: get an error if the timestamp is incorrectly formatted") if err := sqlCollectionDataWhereAddedAfter([]string{"2017-03-02 01:01:01"}, &b); err == nil { t.Error("no error returned") } t.Log("Test 8: get correct where statement for added after") b.Reset() testdata = ` AND t_collection_data.date_added > "2017"` if sqlCollectionDataWhereAddedAfter([]string{"2017"}, &b); testdata != b.String() { t.Error("sql where statement is not correct") } }
explode_data.jsonl/19850
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 587 }
[ 2830, 3393, 18063, 6482, 1043, 9064, 19337, 6025, 1155, 353, 8840, 836, 8, 341, 2405, 293, 5820, 22622, 198, 2405, 1273, 691, 914, 271, 3244, 5247, 445, 2271, 220, 16, 25, 633, 458, 1465, 369, 8318, 11441, 1138, 743, 1848, 1669, 5704,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestFinWithPendingDataCwndFull(t *testing.T) { c := context.New(t, defaultMTU) defer c.Cleanup() c.CreateConnected(789, 30000, nil) // Write enough segments to fill the congestion window before ACK'ing // any of them. view := buffer.NewView(10) for i := tcp.InitialCwnd; i > 0; i-- { if _, _, err := c.EP.Write(tcpip.SlicePayload(view), tcpip.WriteOptions{}); err != nil { t.Fatalf("Write failed: %v", err) } } next := uint32(c.IRS) + 1 for i := tcp.InitialCwnd; i > 0; i-- { checker.IPv4(t, c.GetPacket(), checker.PayloadLen(len(view)+header.TCPMinimumSize), checker.TCP( checker.DstPort(context.TestPort), checker.SeqNum(next), checker.AckNum(790), checker.TCPFlagsMatch(header.TCPFlagAck, ^uint8(header.TCPFlagPsh)), ), ) next += uint32(len(view)) } // Shutdown the connection, check that the FIN segment isn't sent // because the congestion window doesn't allow it. Wait until a // retransmit is received. if err := c.EP.Shutdown(tcpip.ShutdownWrite); err != nil { t.Fatalf("Shutdown failed: %v", err) } checker.IPv4(t, c.GetPacket(), checker.PayloadLen(len(view)+header.TCPMinimumSize), checker.TCP( checker.DstPort(context.TestPort), checker.SeqNum(uint32(c.IRS)+1), checker.AckNum(790), checker.TCPFlagsMatch(header.TCPFlagAck, ^uint8(header.TCPFlagPsh)), ), ) // Send the ACK that will allow the FIN to be sent as well. c.SendPacket(nil, &context.Headers{ SrcPort: context.TestPort, DstPort: c.Port, Flags: header.TCPFlagAck, SeqNum: 790, AckNum: seqnum.Value(next), RcvWnd: 30000, }) checker.IPv4(t, c.GetPacket(), checker.PayloadLen(header.TCPMinimumSize), checker.TCP( checker.DstPort(context.TestPort), checker.SeqNum(next), checker.AckNum(790), checker.TCPFlags(header.TCPFlagAck|header.TCPFlagFin), ), ) next++ // Send a FIN that acknowledges everything. Get an ACK back. c.SendPacket(nil, &context.Headers{ SrcPort: context.TestPort, DstPort: c.Port, Flags: header.TCPFlagAck | header.TCPFlagFin, SeqNum: 790, AckNum: seqnum.Value(next), RcvWnd: 30000, }) checker.IPv4(t, c.GetPacket(), checker.PayloadLen(header.TCPMinimumSize), checker.TCP( checker.DstPort(context.TestPort), checker.SeqNum(next), checker.AckNum(791), checker.TCPFlags(header.TCPFlagAck), ), ) }
explode_data.jsonl/22312
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1047 }
[ 2830, 3393, 9134, 2354, 32027, 1043, 34, 23152, 9432, 1155, 353, 8840, 836, 8, 341, 1444, 1669, 2266, 7121, 1155, 11, 1638, 8505, 52, 340, 16867, 272, 727, 60639, 2822, 1444, 7251, 21146, 7, 22, 23, 24, 11, 220, 18, 15, 15, 15, 15...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
5
func TestIsMethodAllowedReturnsFalseWithNoMethods(t *testing.T) { s := New(Options{ // Intentionally left blank. }) s.allowedMethods = []string{} if s.isMethodAllowed("") { t.Error("IsMethodAllowed should return false when c.allowedMethods is nil.") } }
explode_data.jsonl/57641
{ "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, 3872, 3523, 35382, 16446, 4049, 2354, 2753, 17856, 1155, 353, 8840, 836, 8, 341, 1903, 1669, 1532, 7, 3798, 515, 197, 322, 1333, 2939, 745, 2115, 10113, 624, 197, 3518, 1903, 99150, 17856, 284, 3056, 917, 16094, 743, 274, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestChainByteEncoding(t *testing.T) { suite.Run(t, &ByteEncodingSuite{ byteArrayEncoding: NewChainByteArrayEncoding(GzipEncoding, Base64URLEncoding), byteStreamEncoding: NewChainByteStreamEncoding(GzipEncoding, Base64URLEncoding), }) }
explode_data.jsonl/70557
{ "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, 18837, 7153, 14690, 1155, 353, 8840, 836, 8, 341, 96572, 16708, 1155, 11, 609, 7153, 14690, 28000, 515, 197, 31422, 1857, 14690, 25, 220, 1532, 18837, 18394, 14690, 6699, 9964, 14690, 11, 5351, 21, 19, 1511, 867, 1016, 3700,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestOutputService3ProtocolTestTimestampMembersCase1(t *testing.T) { svc := NewOutputService3ProtocolTest(nil) buf := bytes.NewReader([]byte("{\"TimeMember\": 1398796238, \"StructMember\": {\"foo\": 1398796238}}")) req, out := svc.OutputService3TestCaseOperation1Request(nil) req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}} // set headers // unmarshal response restjson.UnmarshalMeta(req) restjson.Unmarshal(req) assert.NoError(t, req.Error) // assert response assert.NotNil(t, out) // ensure out variable is used assert.Equal(t, time.Unix(1.398796238e+09, 0).UTC().String(), out.StructMember.Foo.String()) assert.Equal(t, time.Unix(1.398796238e+09, 0).UTC().String(), out.TimeMember.String()) }
explode_data.jsonl/8441
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 281 }
[ 2830, 3393, 5097, 1860, 18, 20689, 2271, 20812, 24371, 4207, 16, 1155, 353, 8840, 836, 8, 341, 1903, 7362, 1669, 1532, 5097, 1860, 18, 20689, 2271, 27907, 692, 26398, 1669, 5820, 68587, 10556, 3782, 99141, 1462, 9366, 11693, 220, 16, 18...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestProcessNewPod(t *testing.T) { config.Datadog.SetDefault("ac_include", []string{"name:baz"}) config.Datadog.SetDefault("ac_exclude", []string{"image:datadoghq.com/baz.*"}) config.Datadog.SetDefault("exclude_pause_container", true) defer func() { config.Datadog.SetDefault("ac_include", []string{}) config.Datadog.SetDefault("ac_exclude", []string{}) config.Datadog.SetDefault("exclude_pause_container", true) }() services := make(chan Service, 6) listener := KubeletListener{ newService: services, services: make(map[string]Service), } listener.filter, _ = containers.NewFilterFromConfigIncludePause() listener.processNewPods(getMockedPods(), false) select { case service := <-services: assert.Equal(t, "docker://foorandomhash", string(service.GetEntity())) adIdentifiers, err := service.GetADIdentifiers() assert.Nil(t, err) assert.Equal(t, []string{"docker://foorandomhash", "datadoghq.com/foo:latest", "foo"}, adIdentifiers) hosts, err := service.GetHosts() assert.Nil(t, err) assert.Equal(t, map[string]string{"pod": "127.0.0.1"}, hosts) ports, err := service.GetPorts() assert.Nil(t, err) assert.Equal(t, []ContainerPort{{1337, "footcpport"}, {1339, "fooudpport"}}, ports) _, err = service.GetPid() assert.Equal(t, ErrNotSupported, err) default: assert.FailNow(t, "first service not in channel") } select { case service := <-services: assert.Equal(t, "rkt://bar-random-hash", string(service.GetEntity())) adIdentifiers, err := service.GetADIdentifiers() assert.Nil(t, err) assert.Equal(t, []string{"rkt://bar-random-hash", "datadoghq.com/bar:latest", "bar"}, adIdentifiers) hosts, err := service.GetHosts() assert.Nil(t, err) assert.Equal(t, map[string]string{"pod": "127.0.0.1"}, hosts) ports, err := service.GetPorts() assert.Nil(t, err) assert.Equal(t, []ContainerPort{{1122, "barport"}}, ports) _, err = service.GetPid() assert.Equal(t, ErrNotSupported, err) default: assert.FailNow(t, "second service not in channel") } select { case service := <-services: assert.Equal(t, "docker://containerid", string(service.GetEntity())) adIdentifiers, err := service.GetADIdentifiers() assert.Nil(t, err) assert.Equal(t, []string{"docker://containerid"}, adIdentifiers) hosts, err := service.GetHosts() assert.Nil(t, err) assert.Equal(t, map[string]string{"pod": "127.0.0.1"}, hosts) ports, err := service.GetPorts() assert.Nil(t, err) assert.Equal(t, []ContainerPort{{1122, "barport"}}, ports) _, err = service.GetPid() assert.Equal(t, ErrNotSupported, err) default: assert.FailNow(t, "third service not in channel") } select { case service := <-services: assert.Equal(t, "docker://clustercheck", string(service.GetEntity())) adIdentifiers, err := service.GetADIdentifiers() assert.Nil(t, err) assert.Equal(t, []string{"docker://clustercheck", "k8s.gcr.io/pause:latest", "pause"}, adIdentifiers) hosts, err := service.GetHosts() assert.Nil(t, err) assert.Equal(t, map[string]string{"pod": "127.0.0.1"}, hosts) ports, err := service.GetPorts() assert.Nil(t, err) assert.Equal(t, []ContainerPort{{1122, "barport"}}, ports) _, err = service.GetPid() assert.Equal(t, ErrNotSupported, err) default: assert.FailNow(t, "fourth service not in channel") } // Fifth container is filtered out, should receive the pod service select { case service := <-services: assert.Equal(t, "kubernetes_pod://mock-pod-uid", string(service.GetEntity())) adIdentifiers, err := service.GetADIdentifiers() assert.Nil(t, err) assert.Equal(t, []string{"kubernetes_pod://mock-pod-uid"}, adIdentifiers) hosts, err := service.GetHosts() assert.Nil(t, err) assert.Equal(t, map[string]string{"pod": "127.0.0.1"}, hosts) ports, err := service.GetPorts() assert.Nil(t, err) assert.Equal(t, []ContainerPort{{1122, "barport"}, {1122, "barport"}, {1122, "barport"}, {1122, "barport"}, {1337, "footcpport"}, {1339, "fooudpport"}}, ports) _, err = service.GetPid() assert.Equal(t, ErrNotSupported, err) default: assert.FailNow(t, "pod service not in channel") } select { case <-services: assert.FailNow(t, "6 services in channel, filtering is broken") default: // all good } }
explode_data.jsonl/18337
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1652 }
[ 2830, 3393, 7423, 3564, 23527, 1155, 353, 8840, 836, 8, 341, 25873, 909, 266, 329, 538, 4202, 3675, 445, 580, 37878, 497, 3056, 917, 4913, 606, 25, 42573, 23625, 25873, 909, 266, 329, 538, 4202, 3675, 445, 580, 88668, 497, 3056, 917, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestTagNewline(t *testing.T) { var opts = struct { Value bool `long:"verbose" description:"verbose something"` }{} assertParseFail(t, ErrTag, "unexpected newline in tag value `description' (in `long:\"verbose\" description:\"verbose\nsomething\"`)", &opts, "") }
explode_data.jsonl/44078
{ "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, 5668, 3564, 1056, 1155, 353, 8840, 836, 8, 972, 2405, 12185, 284, 2036, 972, 197, 47399, 1807, 1565, 4825, 2974, 14883, 1, 4008, 2974, 14883, 319, 33331, 39917, 319, 197, 15170, 2570, 6948, 14463, 19524, 1155, 11, 15495, 566...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestKeeper_GetOrSetFunc(t *testing.T) { tempDir, err := ioutil.TempDir("", config.TempDirPrefix) if err != nil { t.Fatal(err) } defer func() { _ = os.RemoveAll(tempDir) }() c, err := New(tempDir) if err != nil { t.Fatal(err) } key := "somekey" cachedValue := []byte("Yep this is the shit") v1, err := c.GetOrSetFunc(key, func() (interface{}, error) { return cachedValue, nil }) if err != nil { t.Fatal(err) } if v1 == nil { t.Fatal("v should not be nil") } assert.Equal(t, v1.([]byte), cachedValue) v2, err := c.GetOrSetFunc(key, func() (interface{}, error) { t.Fatal("This should not be called") return nil, nil }) assert.NotNil(t, v2) assert.Equal(t, v2.([]byte), cachedValue) }
explode_data.jsonl/46236
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 321 }
[ 2830, 3393, 77233, 13614, 2195, 1649, 9626, 1155, 353, 8840, 836, 8, 341, 16280, 6184, 11, 1848, 1669, 43144, 65009, 6184, 19814, 2193, 65009, 6184, 14335, 340, 743, 1848, 961, 2092, 341, 197, 3244, 26133, 3964, 340, 197, 532, 16867, 29...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestTransactionStatusCheck(t *testing.T) { t.Parallel() // Create the pool to test the status retrievals with statedb, _ := state.New(common.Hash{}, state.NewDatabase(rawdb.NewMemoryDatabase()), nil) blockchain := &testBlockChain{statedb, 1000000, new(notify.Feed)} pool := NewTxPool(testTxPoolConfig, params.TestChainConfig, blockchain) defer pool.Stop() // Create the test accounts to check various transaction statuses with keys := make([]*ecdsa.PrivateKey, 3) for i := 0; i < len(keys); i++ { keys[i], _ = crypto.GenerateKey() pool.currentState.AddBalance(crypto.PubkeyToAddress(keys[i].PublicKey), big.NewInt(1000000)) } // Generate and queue a batch of transactions, both pending and queued txs := types.Transactions{} txs = append(txs, pricedTransaction(0, 100000, big.NewInt(1), keys[0])) // Pending only txs = append(txs, pricedTransaction(0, 100000, big.NewInt(1), keys[1])) // Pending and queued txs = append(txs, pricedTransaction(2, 100000, big.NewInt(1), keys[1])) txs = append(txs, pricedTransaction(2, 100000, big.NewInt(1), keys[2])) // Queued only // Import the transaction and ensure they are correctly added pool.AddRemotesSync(txs) pending, queued := pool.Stats() if pending != 2 { t.Fatalf("pending transactions mismatched: have %d, want %d", pending, 2) } if queued != 2 { t.Fatalf("queued transactions mismatched: have %d, want %d", queued, 2) } if err := validateTxPoolInternals(pool); err != nil { t.Fatalf("pool internal state corrupted: %v", err) } // Retrieve the status of each transaction and validate them hashes := make([]common.Hash, len(txs)) for i, tx := range txs { hashes[i] = tx.Hash() } hashes = append(hashes, common.Hash{}) statuses := pool.Status(hashes) expect := []TxStatus{TxStatusPending, TxStatusPending, TxStatusQueued, TxStatusQueued, TxStatusUnknown} for i := 0; i < len(statuses); i++ { if statuses[i] != expect[i] { t.Errorf("transaction %d: status mismatch: have %v, want %v", i, statuses[i], expect[i]) } } }
explode_data.jsonl/7884
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 724 }
[ 2830, 3393, 8070, 2522, 3973, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 2822, 197, 322, 4230, 279, 7314, 311, 1273, 279, 2639, 10759, 25596, 448, 198, 18388, 657, 65, 11, 716, 1669, 1584, 7121, 57802, 15103, 22655, 1584, 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...
8
func TestModulePathStripping(t *testing.T) { assert.Equal(t, "foo", stripModuleClassName("clients", "clients/foo")) assert.Equal(t, "a/b/d", stripModuleClassName("c", "a/b/c/d")) assert.Equal(t, "tchannel/foo", stripModuleClassName("endpoints", "endpoints/tchannel/foo")) }
explode_data.jsonl/34598
{ "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, 3332, 1820, 2580, 5654, 1155, 353, 8840, 836, 8, 341, 6948, 12808, 1155, 11, 330, 7975, 497, 13316, 3332, 14541, 445, 31869, 497, 330, 31869, 60555, 5455, 6948, 12808, 1155, 11, 330, 64, 3470, 3446, 497, 13316, 3332, 14541, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestVariableRefMountPath(t *testing.T) { th := kusttest_test.NewKustTestHarness(t, "/app/base") th.WriteK("/app/base", ` resources: - deployment.yaml - namespace.yaml vars: - name: NAMESPACE objref: apiVersion: v1 kind: Namespace name: my-namespace `) th.WriteF("/app/base/deployment.yaml", ` apiVersion: apps/v1 kind: Deployment metadata: name: my-deployment spec: template: spec: containers: - name: app image: busybox volumeMounts: - name: my-volume mountPath: "/$(NAMESPACE)" env: - name: NAMESPACE value: $(NAMESPACE) volumes: - name: my-volume emptyDir: {} `) th.WriteF("/app/base/namespace.yaml", ` apiVersion: v1 kind: Namespace metadata: name: my-namespace `) m, err := th.MakeKustTarget().MakeCustomizedResMap() if err != nil { t.Fatalf("Err: %v", err) } th.AssertActualEqualsExpected(m, ` apiVersion: apps/v1 kind: Deployment metadata: name: my-deployment spec: template: spec: containers: - env: - name: NAMESPACE value: my-namespace image: busybox name: app volumeMounts: - mountPath: /my-namespace name: my-volume volumes: - emptyDir: {} name: my-volume --- apiVersion: v1 kind: Namespace metadata: name: my-namespace `) }
explode_data.jsonl/53707
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 686 }
[ 2830, 3393, 7827, 3945, 16284, 1820, 1155, 353, 8840, 836, 8, 341, 70479, 1669, 595, 590, 1944, 4452, 7121, 42, 590, 2271, 74248, 1155, 11, 3521, 676, 26090, 1138, 70479, 4073, 42, 4283, 676, 26090, 497, 22074, 12745, 510, 12, 23172, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestNew(t *testing.T) { tests := []struct { name string config *Config wantErr bool wantErrMessage string }{ { name: "nil config fails", wantErr: true, wantErrMessage: "nil config", }, { name: "bad config fails", config: &Config{ ExporterSettings: config.NewExporterSettings(typeStr), APIURL: "abc", }, wantErr: true, }, { name: "fails to create metrics converter", config: &Config{ ExporterSettings: config.NewExporterSettings(typeStr), AccessToken: "test", Realm: "realm", ExcludeMetrics: []dpfilters.MetricFilter{{}}, }, wantErr: true, }, { name: "successfully create exporter", config: &Config{ ExporterSettings: config.NewExporterSettings(typeStr), AccessToken: "someToken", Realm: "xyz", TimeoutSettings: exporterhelper.TimeoutSettings{Timeout: 1 * time.Second}, Headers: nil, }, }, { name: "create exporter with host metadata syncer", config: &Config{ ExporterSettings: config.NewExporterSettings(typeStr), AccessToken: "someToken", Realm: "xyz", TimeoutSettings: exporterhelper.TimeoutSettings{Timeout: 1 * time.Second}, Headers: nil, SyncHostMetadata: true, }, }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { got, err := newSignalFxExporter(tt.config, zap.NewNop()) if tt.wantErr { require.Error(t, err) if tt.wantErrMessage != "" { require.EqualError(t, err, tt.wantErrMessage) } } else { require.NotNil(t, got) } }) } }
explode_data.jsonl/61014
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 799 }
[ 2830, 3393, 3564, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 3056, 1235, 341, 197, 11609, 1843, 914, 198, 197, 25873, 260, 353, 2648, 198, 197, 50780, 7747, 286, 1807, 198, 197, 50780, 7747, 2052, 914, 198, 197, 59403, 197, 197, 515, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestSortPeriodicJobOrder(t *testing.T) { tests := []struct { name string periodics []prowConfig.Periodic expectedPeriodics []prowConfig.Periodic }{ { name: "empty list of periodics", periodics: []prowConfig.Periodic{}, expectedPeriodics: []prowConfig.Periodic{}, }, { name: "unordered list of periodics", periodics: []prowConfig.Periodic{ { JobBase: prowConfig.JobBase{ Name: "ESPv2-continuous-build", }, }, { JobBase: prowConfig.JobBase{ Name: "everlast-bump", }, }, { JobBase: prowConfig.JobBase{ Name: "ci-oss-test-infra-autobump-prow", }, }, }, expectedPeriodics: []prowConfig.Periodic{ { JobBase: prowConfig.JobBase{ Name: "ESPv2-continuous-build", }, }, { JobBase: prowConfig.JobBase{ Name: "ci-oss-test-infra-autobump-prow", }, }, { JobBase: prowConfig.JobBase{ Name: "everlast-bump", }, }, }, }, } for _, test := range tests { t.Run(test.name, func(t *testing.T) { sortPeriodics(test.periodics) if !reflect.DeepEqual(test.expectedPeriodics, test.periodics) { t.Fatalf("Periodic jobs do not match; actual: %v\n expected %v\n", test.expectedPeriodics, test.periodics) } }) } }
explode_data.jsonl/22114
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 680 }
[ 2830, 3393, 10231, 23750, 292, 12245, 4431, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 3056, 1235, 341, 197, 11609, 1060, 914, 198, 197, 197, 19304, 1211, 260, 3056, 79, 651, 2648, 14834, 3127, 292, 198, 197, 42400, 23750, 1211, 3056, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestParseNetboot(t *testing.T) { b, _, err := parseNetbootFlags("dhcpv4", "aa:bb:cc:dd:ee:ff", []string{}) if err != nil { t.Errorf(`parseNetbootFlags("dhcpv4", "aa:bb:cc:dd:ee:ff", []string{}) = _, _, %v, want nil`, err) } if b.Type != "netboot" || b.Method != "dhcpv4" || b.MAC != "aa:bb:cc:dd:ee:ff" || b.OverrideURL != nil || b.Retries != nil { t.Errorf(`b.Type, b.Method, b.MAC, b.OverrideURL, b.Retries = %q, %q, %q, %v, %v, want "netboot, "dpcpv4", "aa:bb:cc:dd:ee:ff", nil, nil`, b.Type, b.Method, b.MAC, b.OverrideURL, b.Retries) } }
explode_data.jsonl/25072
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 268 }
[ 2830, 3393, 14463, 6954, 4619, 1155, 353, 8840, 836, 8, 341, 2233, 11, 8358, 1848, 1669, 4715, 6954, 4619, 9195, 445, 96220, 85, 19, 497, 330, 5305, 25, 6066, 25, 638, 25, 631, 25, 2127, 25, 542, 497, 3056, 917, 37790, 743, 1848, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
7
func TestReadFieldFromGlobal(t *testing.T) { t.Parallel() ctx := NewIsolate().NewContext() _, err := ctx.Eval(`foo = "bar";`, "my_file.js") if err != nil { t.Fatalf("Error evaluating javascript, err: %v", err) } val, err := ctx.Global().Get("foo") if err != nil { t.Fatalf("Error trying to get field: %v", err) } if str := val.String(); str != "bar" { t.Errorf("Expected 'bar', got %q", str) } }
explode_data.jsonl/81553
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 170 }
[ 2830, 3393, 4418, 1877, 3830, 11646, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 741, 20985, 1669, 1532, 3872, 33066, 1005, 3564, 1972, 741, 197, 6878, 1848, 1669, 5635, 5142, 831, 5809, 7975, 284, 330, 2257, 5123, 7808, 330, 2408,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestFileHelper_IsPathFileString_01(t *testing.T) { fh := FileHelper{} pathFile := fh.AdjustPathSlash("../../filesfortest/levelfilesfortest/level_01_dir/" + "level_02_dir/level_03_dir/level_3_1_test.txt") expectedPathFile := fh.AdjustPathSlash("..\\..\\filesfortest\\levelfilesfortest\\level_01_dir\\" + "level_02_dir\\level_03_dir\\level_3_1_test.txt") pathFileType, absolutePath, err := fh.IsPathFileString(pathFile) if err != nil { t.Errorf("Error returned from fh.IsPathFileString(pathFile). "+ "pathFile='%v' Error='%v' ", pathFile, err.Error()) return } if pathFileType != PathFileType.PathFile() { t.Errorf("Expected PathFileTypeCode='PathFile'. Instead, PathFileTypeCode='%v' ", pathFileType.String()) } absExpectedPathFile, err := fh.MakeAbsolutePath(expectedPathFile) if err != nil { t.Errorf("Error returned by fh.MakeAbsolutePath(expectedPathFile). "+ "expectedPathFile='%v' Error='%v' ", expectedPathFile, err.Error()) } if absExpectedPathFile != absolutePath { t.Errorf("Error: Expected 'absolutePath'='%v'. Instead, 'absolutePath='%v'.", absExpectedPathFile, absolutePath) } }
explode_data.jsonl/14490
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 444 }
[ 2830, 3393, 1703, 5511, 31879, 1820, 1703, 703, 62, 15, 16, 1155, 353, 8840, 836, 8, 1476, 220, 36075, 1669, 2887, 5511, 16094, 220, 1815, 1703, 1669, 36075, 17865, 4250, 1820, 88004, 36800, 7198, 3969, 477, 14, 3449, 490, 3658, 3969, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
5
func Test_DeleteObjectHandler_ExecuteAndWaitFor(t *testing.T) { t.Run("should execute the DeleteObjectHandler successfully", func(t *testing.T) { // given customObject := fixCustomObject() handler := DeleteObjectHandler{handlerCfg{log: log.NewLogger(true), debug: true}} g := new(errgroup.Group) ctx := context.Background() defer ctx.Done() // when g.Go(func() error { err := handler.ExecuteAndWaitFor(ctx, *customObject) if err != nil { return err } return nil }) // then err := g.Wait() require.NoError(t, err) }) }
explode_data.jsonl/72042
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 214 }
[ 2830, 3393, 57418, 1190, 3050, 83453, 92812, 2461, 1155, 353, 8840, 836, 8, 341, 3244, 16708, 445, 5445, 9026, 279, 10428, 1190, 3050, 7790, 497, 2915, 1155, 353, 8840, 836, 8, 341, 197, 197, 322, 2661, 198, 197, 1444, 1450, 1190, 166...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestPrincipalMarshalJSON(t *testing.T) { testCases := []struct { principal Principal expectedResult []byte expectErr bool }{ {NewPrincipal("*"), []byte(`{"AWS":["*"]}`), false}, {NewPrincipal("arn:aws:iam::AccountNumber:*"), []byte(`{"AWS":["arn:aws:iam::AccountNumber:*"]}`), false}, {NewPrincipal(), nil, true}, } for i, testCase := range testCases { result, err := json.Marshal(testCase.principal) expectErr := (err != nil) if expectErr != testCase.expectErr { t.Fatalf("case %v: error: expected: %v, got: %v\n", i+1, testCase.expectErr, expectErr) } if !testCase.expectErr { if !reflect.DeepEqual(result, testCase.expectedResult) { t.Fatalf("case %v: result: expected: %v, got: %v\n", i+1, string(testCase.expectedResult), string(result)) } } } }
explode_data.jsonl/39965
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 342 }
[ 2830, 3393, 31771, 55438, 5370, 1155, 353, 8840, 836, 8, 341, 18185, 37302, 1669, 3056, 1235, 341, 197, 25653, 15702, 414, 36309, 198, 197, 42400, 2077, 3056, 3782, 198, 197, 24952, 7747, 414, 1807, 198, 197, 59403, 197, 197, 90, 3564, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
5
func Test_getVCpuCfg(t *testing.T) { type args struct { cfgVer string cfgPrj string cfgGroup string cfgService string cfgName string cfgUrl string cfgMode utils.CfgMode } tests := []struct { name string args args wantVCpuMap map[string]interface{} wantErr bool }{ { name: "normal", args: args{cfgVer: "1.0.0", cfgPrj: "guiderAllService", cfgGroup: "common", cfgService: "xsf", cfgName: "xsf.toml", cfgUrl: "http://10.1.87.69:6868", cfgMode: utils.Centre}, wantVCpuMap: map[string]interface{}{ "model1": int64(1), "model2": int64(2), "model3": int64(3), }, wantErr: false, }, } mapEqual := func(m1, m2 map[string]interface{}) bool { for k, v := range m1 { v1, v1Ok := m2[k] if !v1Ok { return false } if !reflect.DeepEqual(v, v1) { return false } } for k, v := range m2 { v1, v1Ok := m1[k] if !v1Ok { return false } if !reflect.DeepEqual(v, v1) { return false } } return true } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { gotVCpuMap, err := getVCpuCfg(tt.args.cfgVer, tt.args.cfgPrj, tt.args.cfgGroup, tt.args.cfgService, tt.args.cfgName, tt.args.cfgUrl, tt.args.cfgMode) if (err != nil) != tt.wantErr { t.Errorf("getVCpuCfg() error = %v, wantErr %v", err, tt.wantErr) return } if !mapEqual(gotVCpuMap, tt.wantVCpuMap) { t.Errorf("getVCpuCfg() = %v, want %v", gotVCpuMap, tt.wantVCpuMap) } }) } }
explode_data.jsonl/32570
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 837 }
[ 2830, 3393, 3062, 11287, 5584, 42467, 1155, 353, 8840, 836, 8, 972, 13158, 2827, 2036, 972, 197, 50286, 10141, 257, 914, 319, 197, 50286, 3533, 73, 257, 914, 319, 197, 50286, 2808, 256, 914, 319, 197, 50286, 1860, 914, 319, 197, 50286...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestRedirects(t *testing.T) { c := NewCtx(t) defer c.Close() checkRedirect(c, AccessUser, "/", "/test1", http.StatusFound) // redirect to default namespace checkRedirect(c, AccessAdmin, "/", "/admin", http.StatusFound) checkLoginRedirect(c, AccessPublic, "/access-user") // not accessible namespace _, err := c.httpRequest("GET", "/access-user", "", AccessUser) c.expectOK(err) }
explode_data.jsonl/392
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 135 }
[ 2830, 3393, 17725, 82, 1155, 353, 8840, 836, 8, 341, 1444, 1669, 1532, 23684, 1155, 340, 16867, 272, 10421, 2822, 25157, 17725, 1337, 11, 9549, 1474, 11, 64657, 3521, 1944, 16, 497, 1758, 10538, 6650, 8, 442, 6423, 311, 1638, 4473, 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 TestQuick(t *testing.T) { ctx, cancel := context.WithTimeout(context.Background(), defaultTestTimeout) defer cancel() ns, cleanup := getNamespace(t) defer cleanup() args := fmt.Sprintf("run --image-pull-policy IfNotPresent --wait --mode=quick -n %v", ns) mustRunSonobuoyCommandWithContext(ctx, t, args) checkStatusForPluginErrors(ctx, t, ns, "e2e", 0) tb := mustDownloadTarball(ctx, t, ns) tb = saveToArtifacts(t, tb) checkTarballPluginForErrors(t, tb, "e2e", 0) }
explode_data.jsonl/54728
{ "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, 24318, 1155, 353, 8840, 836, 8, 341, 20985, 11, 9121, 1669, 2266, 26124, 7636, 5378, 19047, 1507, 1638, 2271, 7636, 340, 16867, 9121, 2822, 84041, 11, 21290, 1669, 633, 22699, 1155, 340, 16867, 21290, 2822, 31215, 1669, 8879, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestAuthRepoURL(t *testing.T) { for _, test := range []struct { url string user string token string expected string }{ {"https://github.com/org/repo", "", "TOKEN", "https://buildbuddy:TOKEN@github.com/org/repo"}, {"https://gitlab.com/org/repo", "", "TOKEN", "https://buildbuddy:TOKEN@gitlab.com/org/repo"}, {"https://bitbucket.org/org/repo", "USER", "TOKEN", "https://USER:TOKEN@bitbucket.org/org/repo"}, {"https://github.com/org-public/repo", "", "", "https://github.com/org-public/repo"}, } { authURL, err := gitutil.AuthRepoURL(test.url, test.user, test.token) assert.NoError(t, err) assert.Equal(t, test.expected, authURL) } }
explode_data.jsonl/67877
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 286 }
[ 2830, 3393, 5087, 25243, 3144, 1155, 353, 8840, 836, 8, 341, 2023, 8358, 1273, 1669, 2088, 3056, 1235, 341, 197, 19320, 414, 914, 198, 197, 19060, 257, 914, 198, 197, 43947, 262, 914, 198, 197, 42400, 914, 198, 197, 59403, 197, 197, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestMaterializerDeploySchema(t *testing.T) { ms := &vtctldatapb.MaterializeSettings{ Workflow: "workflow", SourceKeyspace: "sourceks", TargetKeyspace: "targetks", TableSettings: []*vtctldatapb.TableMaterializeSettings{{ TargetTable: "t1", SourceExpression: "select * from t1", CreateDdl: "t1ddl", }, { TargetTable: "t2", SourceExpression: "select * from t3", CreateDdl: "t2ddl", }}, } env := newTestMaterializerEnv(t, ms, []string{"0"}, []string{"0"}) defer env.close() delete(env.tmc.schema, "targetks.t2") env.tmc.expectVRQuery(200, mzSelectFrozenQuery, &sqltypes.Result{}) env.tmc.expectVRQuery(200, `t2ddl`, &sqltypes.Result{}) env.tmc.expectVRQuery( 200, insertPrefix+ `\('workflow', 'keyspace:\\"sourceks\\" shard:\\"0\\" filter:{rules:{match:\\"t1\\" filter:\\"select.*t1\\"} rules:{match:\\"t2\\" filter:\\"select.*t3\\"}}', '', [0-9]*, [0-9]*, '', '', [0-9]*, 0, 'Stopped', 'vt_targetks'\)`+ eol, &sqltypes.Result{}, ) env.tmc.expectVRQuery(200, mzUpdateQuery, &sqltypes.Result{}) err := env.wr.Materialize(context.Background(), ms) require.NoError(t, err) env.tmc.verifyQueries(t) require.Equal(t, env.tmc.getSchemaRequestCount(100), 1) require.Equal(t, env.tmc.getSchemaRequestCount(200), 1) }
explode_data.jsonl/61868
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 587 }
[ 2830, 3393, 13415, 3135, 69464, 8632, 1155, 353, 8840, 836, 8, 341, 47691, 1669, 609, 9708, 302, 507, 266, 391, 65, 44253, 551, 6086, 515, 197, 197, 62768, 25, 981, 330, 56249, 756, 197, 197, 3608, 8850, 1306, 25, 330, 2427, 2787, 7...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestAssessNodeStatus(t *testing.T) { daemoned := true tests := []struct { name string pod *apiv1.Pod node *wfv1.NodeStatus want wfv1.NodePhase }{{ name: "pod pending", pod: &apiv1.Pod{ Status: apiv1.PodStatus{ Phase: apiv1.PodPending, }, }, node: &wfv1.NodeStatus{}, want: wfv1.NodePending, }, { name: "pod succeeded", pod: &apiv1.Pod{ Status: apiv1.PodStatus{ Phase: apiv1.PodSucceeded, }, }, node: &wfv1.NodeStatus{}, want: wfv1.NodeSucceeded, }, { name: "pod failed - daemoned", pod: &apiv1.Pod{ Status: apiv1.PodStatus{ Phase: apiv1.PodFailed, }, }, node: &wfv1.NodeStatus{Daemoned: &daemoned}, want: wfv1.NodeSucceeded, }, { name: "pod failed - not daemoned", pod: &apiv1.Pod{ Status: apiv1.PodStatus{ Message: "failed for some reason", Phase: apiv1.PodFailed, }, }, node: &wfv1.NodeStatus{}, want: wfv1.NodeFailed, }, { name: "pod termination", pod: &apiv1.Pod{ ObjectMeta: metav1.ObjectMeta{DeletionTimestamp: &metav1.Time{Time: time.Now()}}, Status: apiv1.PodStatus{ Phase: apiv1.PodRunning, }, }, node: &wfv1.NodeStatus{}, want: wfv1.NodeFailed, }, { name: "pod running", pod: &apiv1.Pod{ ObjectMeta: metav1.ObjectMeta{ Annotations: map[string]string{ common.AnnotationKeyTemplate: "{}", }, }, Status: apiv1.PodStatus{ Phase: apiv1.PodRunning, }, }, node: &wfv1.NodeStatus{}, want: wfv1.NodeRunning, }, { name: "default", pod: &apiv1.Pod{ Status: apiv1.PodStatus{ Phase: apiv1.PodUnknown, }, }, node: &wfv1.NodeStatus{}, want: wfv1.NodeError, }} for _, test := range tests { t.Run(test.name, func(t *testing.T) { got := assessNodeStatus(test.pod, test.node) assert.Equal(t, test.want, got.Phase) }) } }
explode_data.jsonl/54358
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 903 }
[ 2830, 3393, 5615, 433, 1955, 2522, 1155, 353, 8840, 836, 8, 341, 2698, 64, 7291, 291, 1669, 830, 198, 78216, 1669, 3056, 1235, 341, 197, 11609, 914, 198, 197, 3223, 347, 220, 353, 391, 344, 16, 88823, 198, 197, 20831, 353, 86, 27890...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestGroup_Name(t *testing.T) { tests := []struct { name string path string want string }{ // TODO: Add test cases. // {"empty", "", map[int]string{}}, // {"named", "{**:path}/file.js", map[int]string{0: "path"}}, // {"transformed", "{**|dashed}/file.js", map[int]string{0: "path"}}, // {"named and transformed", "{**|dashed:path}/file.js", map[int]string{0: "path"}}, // {"constant", "src/{controllers}/file.js", map[int]string{0: "path"}}, // {"constant and named", "src/{controllers:type}/file.js", map[int]string{0: "type"}}, // {"constant, transformed and named", "src/{controllers|dashed:type}/file.js", map[int]string{0: "type"}}, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { if got := (Group{str: tt.path}).Name(); got != tt.want { t.Errorf("Group.Name() = %v, want %v", got, tt.want) } }) } }
explode_data.jsonl/56175
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 373 }
[ 2830, 3393, 2808, 19015, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 3056, 1235, 341, 197, 11609, 914, 198, 197, 26781, 914, 198, 197, 50780, 914, 198, 197, 59403, 197, 197, 322, 5343, 25, 2691, 1273, 5048, 624, 197, 197, 322, 5212, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestPrepareProposalErrorOnTooManyTxs(t *testing.T) { const height = 2 ctx, cancel := context.WithCancel(context.Background()) defer cancel() logger := log.NewNopLogger() eventBus := eventbus.NewDefault(logger) require.NoError(t, eventBus.Start(ctx)) state, stateDB, privVals := makeState(t, 1, height) // limit max block size state.ConsensusParams.Block.MaxBytes = 60 * 1024 stateStore := sm.NewStore(stateDB) evpool := &mocks.EvidencePool{} evpool.On("PendingEvidence", mock.Anything).Return([]types.Evidence{}, int64(0)) const nValidators = 1 var bytesPerTx int64 = 3 maxDataBytes := types.MaxDataBytes(state.ConsensusParams.Block.MaxBytes, 0, nValidators) txs := factory.MakeNTxs(height, maxDataBytes/bytesPerTx+2) // +2 so that tx don't fit mp := &mpmocks.Mempool{} mp.On("ReapMaxBytesMaxGas", mock.Anything, mock.Anything).Return(types.Txs(txs)) trs := txsToTxRecords(types.Txs(txs)) app := abcimocks.NewApplication(t) app.On("PrepareProposal", mock.Anything, mock.Anything).Return(&abci.ResponsePrepareProposal{ TxRecords: trs, }, nil) cc := abciclient.NewLocalClient(logger, app) proxyApp := proxy.New(cc, logger, proxy.NopMetrics()) err := proxyApp.Start(ctx) require.NoError(t, err) blockExec := sm.NewBlockExecutor( stateStore, logger, proxyApp, mp, evpool, nil, eventBus, sm.NopMetrics(), ) pa, _ := state.Validators.GetByIndex(0) commit, _ := makeValidCommit(ctx, t, height, types.BlockID{}, state.Validators, privVals) block, err := blockExec.CreateProposalBlock(ctx, height, state, commit, pa) require.ErrorContains(t, err, "transaction data size exceeds maximum") require.Nil(t, block, "") mp.AssertExpectations(t) }
explode_data.jsonl/49124
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 638 }
[ 2830, 3393, 50590, 98637, 1454, 1925, 31246, 8441, 51, 18561, 1155, 353, 8840, 836, 8, 341, 4777, 2608, 284, 220, 17, 198, 20985, 11, 9121, 1669, 2266, 26124, 9269, 5378, 19047, 2398, 16867, 9121, 2822, 17060, 1669, 1487, 7121, 45, 453,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1