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 TestGenLogFileName(t *testing.T) { m := manager{} c := &Config{ TimeTagFormat: "200601021504", LogPath: "./", FileName: "file", } m.startAt = time.Now() dest := m.GenLogFileName(c) timetag := m.startAt.Format(c.TimeTagFormat) assert.Equal(t, path.Join("./", "file"+".log"+timetag), dest) c.Compress = true dest = m.GenLogFileName(c) timetag = m.startAt.Format(c.TimeTagFormat) fmt.Println(dest) assert.Equal(t, path.Join("./", "file"+".log.gz"+timetag), dest) }
explode_data.jsonl/18995
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 230 }
[ 2830, 3393, 9967, 2201, 10903, 1155, 353, 8840, 836, 8, 341, 2109, 1669, 6645, 16094, 1444, 1669, 609, 2648, 515, 197, 67567, 5668, 4061, 25, 330, 17, 15, 15, 21, 15, 16, 15, 17, 16, 20, 15, 19, 756, 197, 24201, 1820, 25, 981, 5...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestReversiAnz11(t *testing.T) { r := NewReversiAnz() r.SetEdgeCnt(1) if r.GetEdgeCnt() != 1 { t.Errorf("NG") } }
explode_data.jsonl/23034
{ "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, 693, 3004, 72, 2082, 89, 16, 16, 1155, 353, 8840, 836, 8, 341, 7000, 1669, 1532, 693, 3004, 72, 2082, 89, 741, 7000, 4202, 11656, 33747, 7, 16, 340, 743, 435, 2234, 11656, 33747, 368, 961, 220, 16, 341, 197, 3244, 1308...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestAddressList_String(t *testing.T) { accAddr, err := sdk.AccAddressFromBech32(addr) require.NoError(t, err) addrList := AddressList{accAddr, accAddr} require.Equal(t, expectedOutput, addrList.String()) }
explode_data.jsonl/60666
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 80 }
[ 2830, 3393, 4286, 852, 31777, 1155, 353, 8840, 836, 8, 341, 197, 4475, 13986, 11, 1848, 1669, 45402, 77538, 4286, 3830, 3430, 331, 18, 17, 24497, 340, 17957, 35699, 1155, 11, 1848, 692, 53183, 852, 1669, 9177, 852, 90, 4475, 13986, 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
func TestGetUniqueDimensionAndOptionsReturnsNotFound(t *testing.T) { t.Parallel() Convey("Get all unique dimensions returns not found", t, func() { r, err := createRequestWithToken("GET", "http://localhost:21800/instances/123/dimensions/age/options", nil) So(err, ShouldBeNil) w := httptest.NewRecorder() mockedDataStore, isLocked := storeMockWithLock(false) mockedDataStore.GetUniqueDimensionAndOptionsFunc = func(ctx context.Context, ID string, dimension string) ([]*string, int, error) { So(*isLocked, ShouldBeTrue) return nil, 0, errs.ErrInstanceNotFound } datasetAPI := getAPIWithCMDMocks(testContext, mockedDataStore, &mocks.DownloadsGeneratorMock{}) datasetAPI.Router.ServeHTTP(w, r) So(w.Code, ShouldEqual, http.StatusNotFound) So(w.Body.String(), ShouldContainSubstring, errs.ErrInstanceNotFound.Error()) So(mockedDataStore.GetInstanceCalls(), ShouldHaveLength, 1) So(mockedDataStore.GetInstanceCalls()[0].ID, ShouldEqual, "123") So(mockedDataStore.GetUniqueDimensionAndOptionsCalls(), ShouldHaveLength, 1) validateLock(mockedDataStore, "123") So(*isLocked, ShouldBeFalse) }) }
explode_data.jsonl/20844
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 407 }
[ 2830, 3393, 1949, 22811, 26121, 3036, 3798, 16446, 10372, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 741, 93070, 5617, 445, 1949, 678, 4911, 15336, 4675, 537, 1730, 497, 259, 11, 2915, 368, 341, 197, 7000, 11, 1848, 1669, 1855, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestOpMul(t *testing.T) { assert := assert.New(t) jl := NewEmpty() AddOpMul(jl) TestCases{ {Logic: `{"*":[]}`, Data: `null`, Err: true}, {Logic: `{"*":["3"]}`, Data: `null`, Result: float64(3)}, {Logic: `{"*":[2,"-2",2]}`, Data: `null`, Result: float64(-8)}, {Logic: `{"*":["a"]}`, Data: `null`, Err: true}, {Logic: `{"*":["inf"]}`, Data: `null`, Err: true}, {Logic: `{"*":[179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368.000000,179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368.000000]}`, Data: `null`, Err: true}, }.Run(assert, jl) }
explode_data.jsonl/43992
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 488 }
[ 2830, 3393, 7125, 59155, 1155, 353, 8840, 836, 8, 341, 6948, 1669, 2060, 7121, 1155, 340, 12428, 75, 1669, 1532, 3522, 741, 37972, 7125, 59155, 3325, 75, 340, 73866, 37302, 515, 197, 197, 90, 26751, 25, 1565, 4913, 9, 788, 1294, 28350...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestNotSupported(t *testing.T) { p := getProgram("notsupported", "1.0") operator := getTestOperator(t, downloadPath, installPath, p) err := operator.start(p, nil) if err == nil { t.Fatal("was expecting error but got none") } }
explode_data.jsonl/38843
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 85 }
[ 2830, 3393, 2623, 34636, 1155, 353, 8840, 836, 8, 341, 3223, 1669, 633, 10690, 445, 1921, 18216, 497, 330, 16, 13, 15, 5130, 83041, 1669, 633, 2271, 18461, 1155, 11, 4139, 1820, 11, 4582, 1820, 11, 281, 340, 9859, 1669, 5675, 4962, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestModifyOrder(t *testing.T) { sql, p := order("select ? from x", "field1") t.Log(sql) for _, v := range p { t.Log(v) } if strings.TrimSpace(sql) != "select ? from x ORDER BY `test` ASC" { t.Fail() } }
explode_data.jsonl/64346
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 97 }
[ 2830, 3393, 44427, 4431, 1155, 353, 8840, 836, 8, 341, 30633, 11, 281, 1669, 1973, 445, 1742, 937, 504, 856, 497, 330, 2566, 16, 1138, 3244, 5247, 13148, 340, 2023, 8358, 348, 1669, 2088, 281, 341, 197, 3244, 5247, 3747, 340, 197, 6...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestDefaultSet(t *testing.T) { var ctx = &context.Context{ Config: config.Project{ Builds: []config.Build{ {ID: "foo"}, {ID: "bar"}, }, NFPMs: []config.NFPM{ { Builds: []string{"foo"}, Bindir: "/bin", NFPMOverridables: config.NFPMOverridables{ FileNameTemplate: "foo", }, }, }, }, } require.NoError(t, Pipe{}.Default(ctx)) require.Equal(t, "/bin", ctx.Config.NFPMs[0].Bindir) require.Equal(t, "foo", ctx.Config.NFPMs[0].FileNameTemplate) require.Equal(t, []string{"foo"}, ctx.Config.NFPMs[0].Builds) }
explode_data.jsonl/21987
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 278 }
[ 2830, 3393, 3675, 1649, 1155, 353, 8840, 836, 8, 341, 2405, 5635, 284, 609, 2147, 9328, 515, 197, 66156, 25, 2193, 30944, 515, 298, 197, 11066, 82, 25, 3056, 1676, 25212, 515, 571, 197, 90, 915, 25, 330, 7975, 7115, 571, 197, 90, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestShopAddSm(t *testing.T) { bsToken := getBusToken() mSm := new(logics.SmLogic) args := cards.ArgsShopAddSm{ BsToken: bsToken, SmIds: []int{207}, } logs.Info(mSm.ShopAddSm(&args)) }
explode_data.jsonl/35927
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 92 }
[ 2830, 3393, 19795, 2212, 10673, 1155, 353, 8840, 836, 8, 341, 93801, 3323, 1669, 633, 15073, 3323, 741, 2109, 10673, 1669, 501, 12531, 1211, 92445, 26751, 340, 31215, 1669, 7411, 51015, 19795, 2212, 10673, 515, 197, 12791, 82, 3323, 25, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestParseProposal(t *testing.T) { cdc := codec.New() okJSON, err := ioutil.TempFile("", "proposal") require.Nil(t, err, "unexpected error") _, err = okJSON.WriteString(` { "title": "Community Pool Spend", "description": "Pay me some Atoms!", "recipient": "cosmos1s5afhd6gxevu37mkqcvvsj8qeylhn0rz46zdlq", "amount": "1000stake", "deposit": "1000stake" } `) require.NoError(t, err) proposal, err := ParseCommunityPoolSpendProposalJSON(cdc, okJSON.Name()) require.NoError(t, err) addr, err := sdk.AccAddressFromBech32("cosmos1s5afhd6gxevu37mkqcvvsj8qeylhn0rz46zdlq") require.NoError(t, err) require.Equal(t, "Community Pool Spend", proposal.Title) require.Equal(t, "Pay me some Atoms!", proposal.Description) require.Equal(t, addr, proposal.Recipient) require.Equal(t, "1000stake", proposal.Deposit) require.Equal(t, "1000stake", proposal.Amount) }
explode_data.jsonl/25282
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 357 }
[ 2830, 3393, 14463, 98637, 1155, 353, 8840, 836, 8, 341, 1444, 7628, 1669, 34647, 7121, 741, 59268, 5370, 11, 1848, 1669, 43144, 65009, 1703, 19814, 330, 73874, 1138, 17957, 59678, 1155, 11, 1848, 11, 330, 53859, 1465, 1138, 197, 6878, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestRollupHoltWinters(t *testing.T) { f := func(sf, tf, vExpected float64) { t.Helper() sfs := []*timeseries{{ Values: []float64{sf}, Timestamps: []int64{123}, }} tfs := []*timeseries{{ Values: []float64{tf}, Timestamps: []int64{123}, }} var me metricsql.MetricExpr args := []interface{}{&metricsql.RollupExpr{Expr: &me}, sfs, tfs} testRollupFunc(t, "holt_winters", args, &me, vExpected) } f(-1, 0.5, nan) f(0, 0.5, nan) f(1, 0.5, nan) f(2, 0.5, nan) f(0.5, -1, nan) f(0.5, 0, nan) f(0.5, 1, nan) f(0.5, 2, nan) f(0.5, 0.5, 34.97794532775879) f(0.1, 0.5, -131.30529492371622) f(0.1, 0.1, -397.3307790780296) f(0.5, 0.1, -5.791530520284198) f(0.5, 0.9, 25.498906408926757) f(0.9, 0.9, 33.99637566941818) }
explode_data.jsonl/23116
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 432 }
[ 2830, 3393, 32355, 454, 39, 6181, 54, 49940, 1155, 353, 8840, 836, 8, 341, 1166, 1669, 2915, 33804, 11, 6409, 11, 348, 18896, 2224, 21, 19, 8, 341, 197, 3244, 69282, 741, 197, 1903, 3848, 1669, 29838, 15136, 4699, 90, 515, 298, 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 TestStoreGateway_BlocksSyncWithDefaultSharding_RingTopologyChangedAfterScaleUp(t *testing.T) { const ( numUsers = 2 numBlocks = numUsers * 12 shardingStrategy = util.ShardingStrategyDefault replicationFactor = 3 numInitialGateways = 4 numScaleUpGateways = 6 expectedBlocksLoaded = 3 * numBlocks // blocks are replicated 3 times ) bucketClient, storageDir := cortex_testutil.PrepareFilesystemBucket(t) // This tests uses real TSDB blocks. 24h time range, 2h block range period, // 2 users = total (24 / 12) * 2 = 24 blocks. now := time.Now() mockTSDB(t, path.Join(storageDir, "user-1"), 24, 12, now.Add(-24*time.Hour).Unix()*1000, now.Unix()*1000) mockTSDB(t, path.Join(storageDir, "user-2"), 24, 12, now.Add(-24*time.Hour).Unix()*1000, now.Unix()*1000) // Write the bucket index. for _, userID := range []string{"user-1", "user-2"} { createBucketIndex(t, bucketClient, userID) } // Randomise the seed but log it in case we need to reproduce the test on failure. seed := time.Now().UnixNano() rand.Seed(seed) t.Log("random generator seed:", seed) ctx := context.Background() ringStore := consul.NewInMemoryClient(ring.GetCodec()) // Create the configured number of gateways. var initialGateways []*StoreGateway initialRegistries := util.NewUserRegistries() allRegistries := util.NewUserRegistries() createStoreGateway := func(id int, waitStabilityMin time.Duration) (*StoreGateway, string, *prometheus.Registry) { instanceID := fmt.Sprintf("gateway-%d", id) storageCfg := mockStorageConfig(t) storageCfg.BucketStore.SyncInterval = time.Hour // Do not trigger the periodic sync in this test. We want it to be triggered by ring topology changed. storageCfg.BucketStore.BucketIndex.Enabled = true limits := defaultLimitsConfig() gatewayCfg := mockGatewayConfig() gatewayCfg.ShardingRing.ReplicationFactor = replicationFactor gatewayCfg.ShardingRing.InstanceID = instanceID gatewayCfg.ShardingRing.InstanceAddr = fmt.Sprintf("127.0.0.%d", id) gatewayCfg.ShardingRing.RingCheckPeriod = 100 * time.Millisecond // Check it continuously. Topology will change on scale up. gatewayCfg.ShardingRing.WaitStabilityMinDuration = waitStabilityMin gatewayCfg.ShardingRing.WaitStabilityMaxDuration = 30 * time.Second gatewayCfg.ShardingEnabled = true gatewayCfg.ShardingStrategy = shardingStrategy overrides, err := validation.NewOverrides(limits, nil) require.NoError(t, err) reg := prometheus.NewPedanticRegistry() g, err := newStoreGateway(gatewayCfg, storageCfg, bucketClient, ringStore, overrides, mockLoggingLevel(), log.NewNopLogger(), reg) require.NoError(t, err) return g, instanceID, reg } for i := 1; i <= numInitialGateways; i++ { g, instanceID, reg := createStoreGateway(i, 2*time.Second) initialGateways = append(initialGateways, g) initialRegistries.AddUserRegistry(instanceID, reg) allRegistries.AddUserRegistry(instanceID, reg) } // Start all gateways concurrently. for _, g := range initialGateways { require.NoError(t, g.StartAsync(ctx)) defer services.StopAndAwaitTerminated(ctx, g) //nolint:errcheck } // Wait until all gateways are running. for _, g := range initialGateways { require.NoError(t, g.AwaitRunning(ctx)) } // At this point we expect that all gateways have done the initial sync and // they have synched only their own blocks. metrics := initialRegistries.BuildMetricFamiliesPerUser() assert.Equal(t, float64(expectedBlocksLoaded), metrics.GetSumOfGauges("cortex_bucket_store_blocks_loaded")) assert.Equal(t, float64(2*numInitialGateways), metrics.GetSumOfGauges("cortex_bucket_stores_tenants_discovered")) assert.Equal(t, float64(numInitialGateways*numBlocks), metrics.GetSumOfGauges("cortex_blocks_meta_synced")) assert.Equal(t, float64(numInitialGateways*numUsers), metrics.GetSumOfGauges("cortex_bucket_stores_tenants_synced")) // Scale up store-gateways. var scaleUpGateways []*StoreGateway scaleUpRegistries := util.NewUserRegistries() numAllGateways := numInitialGateways + numScaleUpGateways for i := numInitialGateways + 1; i <= numAllGateways; i++ { g, instanceID, reg := createStoreGateway(i, 10*time.Second) // Intentionally high "wait stability min duration". scaleUpGateways = append(scaleUpGateways, g) scaleUpRegistries.AddUserRegistry(instanceID, reg) allRegistries.AddUserRegistry(instanceID, reg) } // Start all new gateways concurrently. for _, g := range scaleUpGateways { require.NoError(t, g.StartAsync(ctx)) defer services.StopAndAwaitTerminated(ctx, g) //nolint:errcheck } // Since we configured the new store-gateways with an high "wait stability min duration", we expect // them to join the ring at start up (with JOINING state) but then wait at least the min duration // before syncing blocks and becoming ACTIVE. This give us enough time to check how the initial // store-gateways behaves with regards to blocks syncing while other replicas are JOINING. // Wait until all the initial store-gateways sees all new store-gateways too. test.Poll(t, 5*time.Second, float64(numAllGateways*numInitialGateways), func() interface{} { metrics := initialRegistries.BuildMetricFamiliesPerUser() return metrics.GetSumOfGauges("cortex_ring_members") }) // We expect each block to be available for querying on at least 1 initial store-gateway. for _, userID := range []string{"user-1", "user-2"} { idx, err := bucketindex.ReadIndex(ctx, bucketClient, userID, nil, log.NewNopLogger()) require.NoError(t, err) for _, block := range idx.Blocks { queried := false for _, g := range initialGateways { req := &storepb.SeriesRequest{MinTime: math.MinInt64, MaxTime: math.MaxInt64} srv := newBucketStoreSeriesServer(setUserIDToGRPCContext(ctx, userID)) require.NoError(t, g.Series(req, srv)) for _, b := range srv.Hints.QueriedBlocks { if b.Id == block.ID.String() { queried = true } } } assert.True(t, queried, "block %s has been successfully queried on initial store-gateways", block.ID.String()) } } // Wait until all new gateways are running. for _, g := range scaleUpGateways { require.NoError(t, g.AwaitRunning(ctx)) } // At this point the new store-gateways are expected to be ACTIVE in the ring and all the initial // store-gateways should unload blocks they don't own anymore. test.Poll(t, 5*time.Second, float64(expectedBlocksLoaded), func() interface{} { metrics := allRegistries.BuildMetricFamiliesPerUser() return metrics.GetSumOfGauges("cortex_bucket_store_blocks_loaded") }) }
explode_data.jsonl/57960
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 2251 }
[ 2830, 3393, 6093, 40709, 1668, 34936, 12154, 2354, 3675, 2016, 28410, 2568, 287, 60954, 5389, 6025, 6947, 2324, 1155, 353, 8840, 836, 8, 341, 4777, 2399, 197, 22431, 7137, 1797, 284, 220, 17, 198, 197, 22431, 29804, 310, 284, 1629, 7137...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestRestoreIgnoreSnapshot(t *testing.T) { previousEnts := []pb.Entry{{Term: 1, Index: 1}, {Term: 1, Index: 2}, {Term: 1, Index: 3}} commit := uint64(1) storage := NewMemoryStorage() sm := newRaft(1, []uint64{1, 2}, 10, 1, storage, 0) sm.raftLog.append(previousEnts...) sm.raftLog.commitTo(commit) s := pb.Snapshot{ Metadata: pb.SnapshotMetadata{ Index: commit, Term: 1, ConfState: pb.ConfState{Nodes: []uint64{1, 2}}, }, } // ignore snapshot if ok := sm.restore(s); ok { t.Errorf("restore = %t, want %t", ok, false) } if sm.raftLog.committed != commit { t.Errorf("commit = %d, want %d", sm.raftLog.committed, commit) } // ignore snapshot and fast forward commit s.Metadata.Index = commit + 1 if ok := sm.restore(s); ok { t.Errorf("restore = %t, want %t", ok, false) } if sm.raftLog.committed != commit+1 { t.Errorf("commit = %d, want %d", sm.raftLog.committed, commit+1) } }
explode_data.jsonl/67361
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 400 }
[ 2830, 3393, 56284, 12497, 15009, 1155, 353, 8840, 836, 8, 341, 197, 19702, 2250, 82, 1669, 3056, 16650, 22330, 2979, 17249, 25, 220, 16, 11, 8008, 25, 220, 16, 2137, 314, 17249, 25, 220, 16, 11, 8008, 25, 220, 17, 2137, 314, 17249, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestQuerytronGenerate(t *testing.T) { is := func(got, expect string, message string) { if got != expect { t.Errorf("%s failed - got [%s], expected [%s]\n", message, got, expect) } } u := qs.Generate(Strings{Name: "generator"}) is(u.Encode(), "name=generator", "string generator") u = qs.Generate(nil) is(u.Encode(), "", "nil generator") var nilStrings *Strings = nil u = qs.Generate(nilStrings) is(u.Encode(), "", "nil generator") u = qs.Generate(Strings{Version: "1.2.3"}) is(u.Encode(), "v=1.2.3", "alternate name string generator") u = qs.Generate(Numbers{Number: 42}) is(u.Encode(), "num=42", "number generator") u = qs.Generate(Optional{}) is(u.Encode(), "", "number pointer generator") u = qs.Generate(Optional{Number: qs.Uint(42)}) is(u.Encode(), "opt=42", "number pointer generator") u = qs.Generate(Bools{Bool: qs.True}) is(u.Encode(), "bool=", "default bool generator") u = qs.Generate(Bools{Bool: qs.False}) is(u.Encode(), "", "default bool generator") u = qs.Generate(Bools{Bool: nil}) is(u.Encode(), "", "default bool generator") u = qs.Generate(Bools{YesNo: qs.True}) is(u.Encode(), "bool=y", "y:n bool generator") u = qs.Generate(Bools{YesNo: qs.False}) is(u.Encode(), "bool=n", "y:n bool generator") u = qs.Generate(Bools{YesNo: nil}) is(u.Encode(), "", "y:n bool generator") u = qs.Generate(Bools{TF: qs.True}) is(u.Encode(), "bool=t", "t:f bool generator") u = qs.Generate(Bools{TF: qs.False}) is(u.Encode(), "bool=f", "t:f bool generator") u = qs.Generate(Bools{TF: nil}) is(u.Encode(), "", "t:f bool generator") u = qs.Generate(Bools{If: qs.True}) is(u.Encode(), "bool=yes", "2-arg bool generator") u = qs.Generate(Bools{If: qs.False}) is(u.Encode(), "", "2-arg bool generator") u = qs.Generate(Bools{If: nil}) is(u.Encode(), "", "2-arg bool generator") }
explode_data.jsonl/13877
{ "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, 2859, 34685, 31115, 1155, 353, 8840, 836, 8, 341, 19907, 1669, 2915, 3268, 354, 11, 1720, 914, 11, 1943, 914, 8, 341, 197, 743, 2684, 961, 1720, 341, 298, 3244, 13080, 4430, 82, 4641, 481, 2684, 23610, 82, 1125, 3601, 23...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestServer_Issue1648(t *testing.T) { log.SetOutput(ioutil.Discard) defer log.SetOutput(os.Stdout) gen, err := testAppGenerator(t, "../fixtures/bugs/1648/fixture-1648.yaml", "generate format with missing type in model") if assert.NoError(t, err) { _, err := gen.makeCodegenApp() assert.NoError(t, err) } }
explode_data.jsonl/3792
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 130 }
[ 2830, 3393, 5475, 7959, 83890, 16, 21, 19, 23, 1155, 353, 8840, 836, 8, 341, 6725, 4202, 5097, 1956, 30158, 909, 47560, 340, 16867, 1487, 4202, 5097, 9638, 83225, 340, 82281, 11, 1848, 1669, 1273, 2164, 12561, 1155, 11, 7005, 45247, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestIbispaintPSDFail(t *testing.T) { Debug = &testLogger{t} testOne(testImage{ Name: "PSD(ibispaint)", PSD: "ibispaint.psd", }, t) }
explode_data.jsonl/50818
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 71 }
[ 2830, 3393, 40, 65, 13090, 1641, 5012, 5262, 604, 1155, 353, 8840, 836, 8, 341, 34424, 284, 609, 1944, 7395, 90, 83, 532, 18185, 3966, 8623, 1906, 515, 197, 21297, 25, 330, 5012, 35, 93746, 13090, 1641, 15752, 197, 197, 5012, 35, 25...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
func TestPlayback_Tx(t *testing.T) { p := Playback{ Ops: []IO{ { W: []byte{10}, R: []byte{12}, }, }, DontPanic: true, } if p.Tx(nil, nil) == nil { t.Fatal("missing read and write") } if p.Close() == nil { t.Fatal("Ops is not empty") } v := [1]byte{} if p.Tx([]byte{10}, make([]byte, 2)) == nil { t.Fatal("invalid read size") } if err := p.Tx([]byte{10}, v[:]); err != nil { t.Fatal(err) } if v[0] != 12 { t.Fatalf("expected 12, got %v", v) } if err := p.Tx([]byte{10}, v[:]); err == nil { t.Fatal("Playback.Ops is empty") } if err := p.Close(); err != nil { t.Fatal(err) } }
explode_data.jsonl/44854
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 317 }
[ 2830, 3393, 87125, 1139, 87, 1155, 353, 8840, 836, 8, 341, 3223, 1669, 95301, 515, 197, 197, 38904, 25, 3056, 3810, 515, 298, 197, 515, 571, 17300, 25, 3056, 3782, 90, 16, 15, 1583, 571, 11143, 25, 3056, 3782, 90, 16, 17, 1583, 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...
8
func TestMappingNameNoSnapshot(t *testing.T) { rr := mappingRule{ uuid: "blah", snapshots: []*mappingRuleSnapshot{}, } _, err := rr.name() require.Equal(t, errNoRuleSnapshots, err) }
explode_data.jsonl/64580
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 86 }
[ 2830, 3393, 6807, 675, 2753, 15009, 1155, 353, 8840, 836, 8, 341, 197, 634, 1669, 12731, 11337, 515, 197, 10676, 2423, 25, 414, 330, 70614, 756, 197, 1903, 6861, 27634, 25, 29838, 40792, 11337, 15009, 38837, 197, 532, 197, 6878, 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
func TestGetFile_checksumURL(t *testing.T) { dst := tempFile(t) u := testModule("basic-file/foo.txt") + "?checksum=md5:09f7e02f1290be211da707a266f153b3" getter := &MockGetter{Proxy: new(FileGetter)} client := &Client{ Src: u, Dst: dst, Dir: false, Getters: map[string]Getter{ "file": getter, }, } if err := client.Get(); err != nil { t.Fatalf("err: %s", err) } if v := getter.GetFileURL.Query().Get("checksum"); v != "" { t.Fatalf("bad: %s", v) } }
explode_data.jsonl/825
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 222 }
[ 2830, 3393, 1949, 1703, 64038, 3144, 1155, 353, 8840, 836, 8, 341, 52051, 1669, 2730, 1703, 1155, 340, 10676, 1669, 1273, 3332, 445, 22342, 14203, 60555, 3909, 899, 488, 27244, 70740, 28, 2277, 20, 25, 15, 24, 69, 22, 68, 15, 17, 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...
3
func TestRouter_Register_ReturnsErrorIfInvalidPath(t *testing.T) { mainRouter := NewRouter() err := mainRouter.Register(http.MethodGet, "/some{", testHandlerFunc) assertNotNil(t, err) }
explode_data.jsonl/31749
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 67 }
[ 2830, 3393, 9523, 73124, 53316, 82, 1454, 2679, 7928, 1820, 1155, 353, 8840, 836, 8, 341, 36641, 9523, 1669, 1532, 9523, 2822, 9859, 1669, 1887, 9523, 19983, 19886, 20798, 1949, 11, 3521, 14689, 90, 497, 1273, 3050, 9626, 692, 6948, 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
func TestStream_ReadRTArray(t *testing.T) { t.Run("test", func(t *testing.T) { assert := base.NewAssert(t) testRange := getTestRange(streamPosBody, 3*streamBlockSize, 80, 80, 61) for _, testData := range streamTestSuccessCollections["array"] { for _, i := range testRange { testRuntime.thread.Reset() stream := NewStream() stream.SetWritePos(i) stream.SetReadPos(i) stream.Write(testData[0]) rtArray, err := stream.ReadRTArray(testRuntime) assert(err).IsNil() assert(stream.GetWritePos()). Equals(len(testData[1].([]byte)) + i) stream.SetWritePos(i) stream.SetReadPos(i) stream.writeRTArray(rtArray) assert(stream.ReadArray()).Equals(testData[0], nil) stream.Release() } } }) t.Run("test readIndex overflow (outer stream)", func(t *testing.T) { assert := base.NewAssert(t) testRange := getTestRange(streamPosBody, 3*streamBlockSize, 80, 80, 61) for _, testData := range streamTestSuccessCollections["array"] { for _, i := range testRange { testRuntime.thread.Reset() stream := NewStream() stream.SetWritePos(i) stream.SetReadPos(i) stream.Write(testData[0]) writePos := stream.GetWritePos() for idx := i; idx < writePos-1; idx++ { stream.SetReadPos(i) stream.SetWritePos(idx) assert(stream.ReadRTArray(testRuntime)). Equals(RTArray{}, base.ErrStream) assert(stream.GetReadPos()).Equals(i) } stream.Release() } } }) t.Run("test readIndex overflow (runtime stream)", func(t *testing.T) { assert := base.NewAssert(t) testRange := getTestRange(streamPosBody, 3*streamBlockSize, 80, 80, 61) for _, testData := range streamTestSuccessCollections["array"] { for _, i := range testRange { testRuntime.thread.Reset() stream := testRuntime.thread.rtStream stream.SetWritePos(i) stream.SetReadPos(i) stream.Write(testData[0]) writePos := stream.GetWritePos() for idx := i; idx < writePos-1; idx++ { stream.SetReadPos(i) stream.SetWritePos(idx) assert(stream.ReadRTArray(testRuntime)). Equals(RTArray{}, base.ErrStream) assert(stream.GetReadPos()).Equals(i) } stream.Reset() } } }) t.Run("test type not match", func(t *testing.T) { assert := base.NewAssert(t) testRange := getTestRange(streamPosBody, 3*streamBlockSize, 80, 80, 61) for _, i := range testRange { testRuntime.thread.Reset() stream := NewStream() stream.SetWritePos(i) stream.SetReadPos(i) stream.PutBytes([]byte{13}) assert(stream.ReadRTArray(testRuntime)). Equals(RTArray{}, base.ErrStream) assert(stream.GetReadPos()).Equals(i) stream.Release() } }) t.Run("error in stream", func(t *testing.T) { assert := base.NewAssert(t) testRange := getTestRange(streamPosBody, 3*streamBlockSize, 80, 80, 61) for _, i := range testRange { testRuntime.thread.Reset() stream := NewStream() stream.SetWritePos(i) stream.SetReadPos(i) stream.PutBytes([]byte{0x41, 0x07, 0x00, 0x00, 0x00, 0x02, 0x02}) assert(stream.ReadRTArray(testRuntime)). Equals(RTArray{}, base.ErrStream) assert(stream.GetReadPos()).Equals(i) stream.Release() } }) t.Run("error in stream", func(t *testing.T) { assert := base.NewAssert(t) testRange := getTestRange(streamPosBody, 3*streamBlockSize, 80, 80, 61) for _, i := range testRange { testRuntime.thread.Reset() stream := NewStream() stream.SetWritePos(i) stream.SetReadPos(i) stream.PutBytes([]byte{0x41, 0x06, 0x00, 0x00, 0x00, 0x0D}) assert(stream.ReadRTArray(testRuntime)). Equals(RTArray{}, base.ErrStream) assert(stream.GetReadPos()).Equals(i) stream.Release() } }) t.Run("error in stream", func(t *testing.T) { assert := base.NewAssert(t) testRange := getTestRange(streamPosBody, 3*streamBlockSize, 80, 80, 61) for _, i := range testRange { testRuntime.thread.Reset() stream := NewStream() stream.SetWritePos(i) stream.SetReadPos(i) stream.PutBytes([]byte{ 0x41, 0x08, 0x00, 0x00, 0x00, 0x82, 0x61, 0x00, }) assert(stream.ReadRTArray(testRuntime)). Equals(RTArray{}, base.ErrStream) assert(stream.GetReadPos()).Equals(i) stream.Release() } }) t.Run("runtime is not available", func(t *testing.T) { assert := base.NewAssert(t) stream := NewStream() type R = Runtime s := "" f := base.GetFileLine assert(stream.ReadRTArray((func() R { s = f(0); return R{} })())). Equals( RTArray{}, base.ErrRuntimeIllegalInCurrentGoroutine.AddDebug(s), ) }) }
explode_data.jsonl/21229
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1949 }
[ 2830, 3393, 3027, 38381, 5350, 1857, 1155, 353, 8840, 836, 8, 341, 3244, 16708, 445, 1944, 497, 2915, 1155, 353, 8840, 836, 8, 341, 197, 6948, 1669, 2331, 7121, 8534, 1155, 340, 197, 18185, 6046, 1669, 633, 2271, 6046, 20574, 4859, 54...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestDeleteFilesystemFailure(t *testing.T) { clientFunc := func(client RookRestClient) (interface{}, error) { return client.DeleteFilesystem(model.FilesystemRequest{Name: "myfs1"}) } verifyFunc := getStringVerifyFunc(t) ClientFailureHelperWithVerification(t, clientFunc, verifyFunc) }
explode_data.jsonl/27860
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 99 }
[ 2830, 3393, 6435, 1703, 8948, 17507, 1155, 353, 8840, 836, 8, 341, 25291, 9626, 1669, 2915, 12805, 431, 1941, 12416, 2959, 8, 320, 4970, 22655, 1465, 8, 341, 197, 853, 2943, 18872, 1703, 8948, 7635, 52009, 612, 1900, 63121, 25, 330, 2...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestHandleServerError(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() l, serverPort := test.FakeServer(t) defer l.Close() done := make(chan struct{}, 1) go func() { for { conn, err := l.Accept() if err != nil { log.Println(err) return } conn.Close() done <- struct{}{} } }() // Create BananaBoatBot b := bot.NewBananaBoatBot(ctx, &stdConfig) // Naive approach to faking error won't work properly (but here for coverage) b.HandleErrors(ctx, "test", errors.New("something went wrong")) handleErrors := makeErrorHandler(b, done) // Create settings for superfluous client settings := &client.IrcServerSettings{ Basic: client.BasicIrcServerSettings{ Host: "localhost", Port: serverPort, TLS: false, Nick: "testbot1", Realname: "testbotr", Username: "testbotu", Password: "yodel", }, ErrorCallback: handleErrors, InputCallback: func(ctx context.Context, svrName string, msg *irc.Message) { // Not relevant }, } // Create client svrI, svrCtx := client.NewIrcServer(ctx, "test", settings) // Replace existing client with our one b.Servers.Store("test", svrI) // Dial server svrI.(client.IrcServerInterface).Dial(svrCtx) // Wait for dropped connection <-done // Wait for error handling <-done }
explode_data.jsonl/53609
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 514 }
[ 2830, 3393, 6999, 38509, 1155, 353, 8840, 836, 8, 341, 20985, 11, 9121, 1669, 2266, 26124, 9269, 5378, 19047, 2398, 16867, 9121, 2822, 8810, 11, 3538, 7084, 1669, 1273, 991, 726, 5475, 1155, 340, 16867, 326, 10421, 2822, 40495, 1669, 12...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestEmbyHelper_RefreshEmbySubList(t *testing.T) { //config := config.GetConfig() //em := NewEmbyHelper(config.EmbyConfig) //bok, err := em.RefreshEmbySubList() //if err != nil { // t.Fatal(err) //} //println(bok) }
explode_data.jsonl/48285
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 96 }
[ 2830, 3393, 2269, 1694, 5511, 62, 14567, 2269, 1694, 3136, 852, 1155, 353, 8840, 836, 8, 341, 197, 322, 1676, 1669, 2193, 2234, 2648, 741, 197, 322, 336, 1669, 1532, 2269, 1694, 5511, 8754, 13, 2269, 1694, 2648, 340, 197, 322, 65, 5...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestUpdateNode(t *testing.T) { wizard.ClearCurrentWizardData() wizardData := wizard.GetCurrentWizard() wizardData.Nodes = []*wizard.Node{ { Name: "master1", Description: "desc1", MachineRoles: []constant.MachineRole{constant.MachineRoleMaster, constant.MachineRoleEtcd}, Labels: []*wizard.Label{ { Key: "kpaas.io/test", Value: "yes", }, }, Taints: []*wizard.Taint{ { Key: "taint1", Value: "taint-value", Effect: wizard.TaintEffectNoExecute, }, }, DockerRootDirectory: "/mnt/docker", ConnectionData: wizard.ConnectionData{ IP: "192.168.31.140", Port: 22, Username: "kpaas", AuthenticationType: wizard.AuthenticationTypePassword, Password: "123456", }, }, } var err error resp := httptest.NewRecorder() gin.SetMode(gin.TestMode) ctx, _ := gin.CreateTestContext(resp) body := api.NodeData{ NodeBaseData: api.NodeBaseData{ Name: "name", Description: "description", MachineRoles: []constant.MachineRole{constant.MachineRoleMaster, constant.MachineRoleEtcd}, Labels: []api.Label{ { Key: "label-key", Value: "value", }, }, Taints: []api.Taint{ { Key: "taint-key", Value: "value", Effect: api.TaintEffectNoExecute, }, }, DockerRootDirectory: "/var/lib/docker", }, ConnectionData: api.ConnectionData{ IP: "192.168.31.140", Port: uint16(22), SSHLoginData: api.SSHLoginData{ Username: "root", AuthenticationType: api.AuthenticationTypePassword, Password: "123456", }, }, } bodyContent, err := json.Marshal(body) assert.Nil(t, err) bodyReader := bytes.NewReader(bodyContent) ctx.Request = httptest.NewRequest("PUT", "/api/v1/deploy/wizard/nodes/192.168.31.140", bodyReader) ctx.Params = gin.Params{ { Key: "ip", Value: "192.168.31.140", }, } UpdateNode(ctx) resp.Flush() assert.True(t, resp.Body.Len() > 0) fmt.Printf("result: %s\n", resp.Body.String()) responseData := new(api.NodeData) err = json.Unmarshal(resp.Body.Bytes(), responseData) assert.Nil(t, err) assert.Equal(t, body, *responseData) }
explode_data.jsonl/38245
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1050 }
[ 2830, 3393, 4289, 1955, 1155, 353, 8840, 836, 8, 1476, 6692, 13722, 13524, 5405, 63094, 1043, 741, 6692, 13722, 1043, 1669, 33968, 44242, 63094, 741, 6692, 13722, 1043, 52184, 284, 29838, 58593, 21714, 515, 197, 197, 515, 298, 21297, 25, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestNewBytesResponse(t *testing.T) { type args struct { b []byte sc int } tests := []struct { name string args args want *BytesResponse }{ { name: "new response", args: args{ b: []byte(""), sc: 200, }, want: &BytesResponse{ Body: []byte(""), StatusCode: 200, }, }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { if got := NewBytesResponse(tt.args.b, tt.args.sc); !reflect.DeepEqual(got, tt.want) { t.Errorf("NewBytesResponse() = %v, want %v", got, tt.want) } }) } }
explode_data.jsonl/73823
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 271 }
[ 2830, 3393, 3564, 7078, 2582, 1155, 353, 8840, 836, 8, 341, 13158, 2827, 2036, 341, 197, 2233, 220, 3056, 3782, 198, 197, 29928, 526, 198, 197, 532, 78216, 1669, 3056, 1235, 341, 197, 11609, 914, 198, 197, 31215, 2827, 198, 197, 50780...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestCrMergedRenameWithParallelWrite(t *testing.T) { test(t, users("alice", "bob"), as(alice, mkdir("a"), mkdir("b"), write("a/foo", "hello"), ), as(bob, disableUpdates(), ), as(alice, rename("a/foo", "b/bar"), ), as(bob, noSync(), write("a/foo", "goodbye"), reenableUpdates(), lsdir("a", m{}), lsdir("b", m{"bar": "FILE"}), read("b/bar", "goodbye"), ), as(alice, lsdir("a", m{}), lsdir("b", m{"bar": "FILE"}), read("b/bar", "goodbye"), ), ) }
explode_data.jsonl/31368
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 271 }
[ 2830, 3393, 16001, 44, 51525, 88757, 2354, 16547, 7985, 1155, 353, 8840, 836, 8, 341, 18185, 1155, 345, 197, 90896, 445, 63195, 497, 330, 47086, 4461, 197, 60451, 17643, 558, 345, 298, 88650, 445, 64, 4461, 298, 88650, 445, 65, 4461, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestPerf(t *testing.T) { if os.Getenv("XYZM_PERF") != "1" { fmt.Printf("Use XYZM_PERF=1 to print performance details\n") return } rand.Seed(time.Now().UnixNano()) N := 1_000_000 xyzm := make([][4]float64, N*4) cells := make([]Cell, N) for i := 0; i < N; i++ { for j := 0; j < 4; j++ { xyzm[i][j] = rand.Float64() } cells[i] = Encode(xyzm[i][0], xyzm[i][1], xyzm[i][2], xyzm[i][3]) } lotsa.Output = os.Stdout print("encode: ") lotsa.Ops(N, 1, func(i, _ int) { Encode(xyzm[i][0], xyzm[i][1], xyzm[i][2], xyzm[i][3]) }) print("decode: ") lotsa.Ops(N, 1, func(i, _ int) { Decode(cells[i]) }) }
explode_data.jsonl/35233
{ "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, 3889, 69, 1155, 353, 8840, 836, 8, 341, 743, 2643, 64883, 445, 32196, 44, 10617, 37, 899, 961, 330, 16, 1, 341, 197, 11009, 19367, 445, 10253, 71089, 44, 10617, 37, 28, 16, 311, 1173, 5068, 3565, 1699, 1138, 197, 853, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestSetConfigError(t *testing.T) { ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { })) defer ts.Close() if err := os.Setenv("GCE_METADATA_HOST", strings.Trim(ts.URL, "http://")); err != nil { t.Fatalf("Error running os.Setenv: %v", err) } if err := WatchConfig(context.Background()); err == nil || !strings.Contains(err.Error(), "unexpected end of JSON input") { t.Errorf("Unexpected output %+v", err) } }
explode_data.jsonl/4158
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 175 }
[ 2830, 3393, 1649, 2648, 1454, 1155, 353, 8840, 836, 8, 341, 57441, 1669, 54320, 70334, 7121, 5475, 19886, 89164, 18552, 3622, 1758, 37508, 11, 435, 353, 1254, 9659, 8, 341, 197, 44194, 16867, 10591, 10421, 2822, 743, 1848, 1669, 2643, 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...
1
func TestSingleSQLTemplate(t *testing.T) { //Reset streamList := []string{"demo"} handleStream(false, streamList, t) //Data setup var tests = []ruleTest{ { name: `TestSingleSQLTemplateRule1`, sql: `SELECT * FROM demo`, r: []map[string]interface{}{ { "c": "red", "wrapper": "w1", }, { "c": "blue", "wrapper": "w1", }, { "c": "blue", "wrapper": "w1", }, { "c": "yellow", "wrapper": "w1", }, { "c": "red", "wrapper": "w1", }, }, m: map[string]interface{}{ "op_preprocessor_demo_0_exceptions_total": int64(0), "op_preprocessor_demo_0_process_latency_ms": int64(0), "op_preprocessor_demo_0_records_in_total": int64(5), "op_preprocessor_demo_0_records_out_total": int64(5), "op_project_0_exceptions_total": int64(0), "op_project_0_process_latency_ms": int64(0), "op_project_0_records_in_total": int64(5), "op_project_0_records_out_total": int64(5), "sink_mockSink_0_exceptions_total": int64(0), "sink_mockSink_0_records_in_total": int64(5), "sink_mockSink_0_records_out_total": int64(5), "source_demo_0_exceptions_total": int64(0), "source_demo_0_records_in_total": int64(5), "source_demo_0_records_out_total": int64(5), }, }, } handleStream(true, streamList, t) doRuleTestBySinkProps(t, tests, 0, &api.RuleOption{ BufferLength: 100, }, map[string]interface{}{ "dataTemplate": `{"wrapper":"w1", "c":"{{.color}}"}`, "sendSingle": true, }, func(result [][]byte) interface{} { var maps []map[string]interface{} for _, v := range result { var mapRes map[string]interface{} err := json.Unmarshal(v, &mapRes) if err != nil { t.Errorf("Failed to parse the input into map") continue } maps = append(maps, mapRes) } return maps }) }
explode_data.jsonl/76173
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 943 }
[ 2830, 3393, 10888, 6688, 7275, 1155, 353, 8840, 836, 8, 341, 197, 322, 14828, 198, 44440, 852, 1669, 3056, 917, 4913, 25762, 16707, 53822, 3027, 3576, 11, 4269, 852, 11, 259, 340, 197, 322, 1043, 6505, 198, 2405, 7032, 284, 3056, 1293...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestErrorPropagation(t *testing.T) { backend := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { panic("unreachable") })) defer backend.Close() backendURL, err := url.Parse(backend.URL) if err != nil { t.Fatal(err) } responder := &fakeResponder{t: t} expectedErr := errors.New("nasty error") proxyHandler := NewUpgradeAwareHandler(backendURL, &fakeRT{err: expectedErr}, true, false, responder) frontend := httptest.NewServer(proxyHandler) defer frontend.Close() req, _ := http.NewRequest("GET", frontend.URL, nil) req.Close = true ctx, cancel := context.WithTimeout(req.Context(), 10*time.Second) defer cancel() req = req.WithContext(ctx) res, err := frontend.Client().Do(req) if err != nil { t.Fatalf("Get: %v", err) } defer res.Body.Close() if res.StatusCode != fakeStatusCode { t.Fatalf("unexpected HTTP status code returned: %v, expected: %v", res.StatusCode, fakeStatusCode) } if !strings.Contains(responder.err.Error(), expectedErr.Error()) { t.Fatalf("responder got unexpected error: %v, expected the error to contain %q", responder.err.Error(), expectedErr.Error()) } }
explode_data.jsonl/35097
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 418 }
[ 2830, 3393, 1454, 35172, 1155, 353, 8840, 836, 8, 341, 197, 20942, 1669, 54320, 70334, 7121, 5475, 19886, 89164, 18552, 3622, 1758, 37508, 11, 435, 353, 1254, 9659, 8, 341, 197, 30764, 445, 359, 46550, 1138, 197, 44194, 16867, 19163, 10...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestAsStructuredWatcherNestedError(t *testing.T) { want := errors.New("this is what we expect") nwf := func(ctx context.Context, lo metav1.ListOptions) (watch.Interface, error) { return nil, want } wf := duck.AsStructuredWatcher(context.Background(), nwf, &duckv1alpha1.AddressableType{}) _, got := wf(metav1.ListOptions{}) if got != want { t.Errorf("WatchFunc() = %v, wanted %v", got, want) } }
explode_data.jsonl/51698
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 157 }
[ 2830, 3393, 2121, 97457, 47248, 71986, 1454, 1155, 353, 8840, 836, 8, 341, 50780, 1669, 5975, 7121, 445, 574, 374, 1128, 582, 1720, 1138, 9038, 43083, 1669, 2915, 7502, 2266, 9328, 11, 775, 77520, 16, 5814, 3798, 8, 320, 14321, 41065, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestRollbackApp(t *testing.T) { testApp := newTestApp() testApp.Status.History = []appsv1.RevisionHistory{{ ID: 1, Revision: "abc", Source: *testApp.Spec.Source.DeepCopy(), }} appServer := newTestAppServer(testApp) updatedApp, err := appServer.Rollback(context.Background(), &application.ApplicationRollbackRequest{ Name: &testApp.Name, ID: 1, }) assert.Nil(t, err) assert.NotNil(t, updatedApp.Operation) assert.NotNil(t, updatedApp.Operation.Sync) assert.NotNil(t, updatedApp.Operation.Sync.Source) assert.Equal(t, "abc", updatedApp.Operation.Sync.Revision) }
explode_data.jsonl/46619
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 230 }
[ 2830, 3393, 32355, 1419, 2164, 1155, 353, 8840, 836, 8, 341, 18185, 2164, 1669, 501, 2271, 2164, 741, 18185, 2164, 10538, 3839, 2579, 284, 3056, 676, 3492, 16, 2817, 13013, 13424, 90, 515, 197, 29580, 25, 981, 220, 16, 345, 197, 197, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestRequest_Payload(t *testing.T) { tests := []struct { name string request *alice.Request want map[string]interface{} wantErr bool }{ { name: "", request: getReq(0), want: nil, wantErr: true, }, { name: "", request: getReq(1), want: map[string]interface{}{"msg": "ok"}, wantErr: false, }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { req := tt.request got, err := req.Payload() if (err != nil) != tt.wantErr { t.Errorf("Request.Payload() error = %v, wantErr %v", err, tt.wantErr) return } assert.Equal(t, tt.want, got) }) } }
explode_data.jsonl/18227
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 322 }
[ 2830, 3393, 1900, 1088, 6989, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 3056, 1235, 341, 197, 11609, 262, 914, 198, 197, 23555, 353, 63195, 9659, 198, 197, 50780, 262, 2415, 14032, 31344, 16094, 197, 50780, 7747, 1807, 198, 197, 59403,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestChildSpanFromCustomTracer(t *testing.T) { tracer := mocktrace.NewTracer("test-tracer") handlerFunc := func(req *restful.Request, resp *restful.Response) { span := oteltrace.SpanFromContext(req.Request.Context()) _, ok := span.(*mocktrace.Span) assert.True(t, ok) spanTracer := span.Tracer() mockTracer, ok := spanTracer.(*mocktrace.Tracer) require.True(t, ok) assert.Equal(t, "test-tracer", mockTracer.Name) resp.WriteHeader(http.StatusOK) } ws := &restful.WebService{} ws.Route(ws.GET("/user/{id}").To(handlerFunc)) container := restful.NewContainer() container.Filter(restfultrace.OTelFilter("my-service", restfultrace.WithTracer(tracer))) container.Add(ws) r := httptest.NewRequest("GET", "/user/123", nil) w := httptest.NewRecorder() container.ServeHTTP(w, r) }
explode_data.jsonl/50851
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 318 }
[ 2830, 3393, 3652, 12485, 3830, 10268, 1282, 9584, 1155, 353, 8840, 836, 8, 341, 25583, 9584, 1669, 7860, 15067, 7121, 1282, 9584, 445, 1944, 10188, 9584, 5130, 53326, 9626, 1669, 2915, 6881, 353, 3927, 1262, 9659, 11, 9039, 353, 3927, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestReconciler_PausedOrFailedDeployment_NoMoreCanaries(t *testing.T) { job := mock.Job() job.TaskGroups[0].Update = canaryUpdate cases := []struct { name string deploymentStatus string stop uint64 }{ { name: "paused deployment", deploymentStatus: structs.DeploymentStatusPaused, stop: 0, }, { name: "failed deployment", deploymentStatus: structs.DeploymentStatusFailed, stop: 1, }, } for _, c := range cases { t.Run(c.name, func(t *testing.T) { // Create a deployment that is paused/failed and has placed some canaries d := structs.NewDeployment(job) d.Status = c.deploymentStatus d.TaskGroups[job.TaskGroups[0].Name] = &structs.DeploymentState{ Promoted: false, DesiredCanaries: 2, DesiredTotal: 10, PlacedAllocs: 1, } // Create 10 allocations for the original job var allocs []*structs.Allocation for i := 0; i < 10; i++ { alloc := mock.Alloc() alloc.Job = job alloc.JobID = job.ID alloc.NodeID = uuid.Generate() alloc.Name = structs.AllocName(job.ID, job.TaskGroups[0].Name, uint(i)) alloc.TaskGroup = job.TaskGroups[0].Name allocs = append(allocs, alloc) } // Create one canary canary := mock.Alloc() canary.Job = job canary.JobID = job.ID canary.NodeID = uuid.Generate() canary.Name = structs.AllocName(job.ID, job.TaskGroups[0].Name, 0) canary.TaskGroup = job.TaskGroups[0].Name canary.DeploymentID = d.ID allocs = append(allocs, canary) d.TaskGroups[canary.TaskGroup].PlacedCanaries = []string{canary.ID} mockUpdateFn := allocUpdateFnMock(map[string]allocUpdateType{canary.ID: allocUpdateFnIgnore}, allocUpdateFnDestructive) reconciler := NewAllocReconciler(testLogger(), mockUpdateFn, false, job.ID, job, d, allocs, nil) r := reconciler.Compute() // Assert the correct results assertResults(t, r, &resultExpectation{ createDeployment: nil, deploymentUpdates: nil, place: 0, inplace: 0, stop: int(c.stop), desiredTGUpdates: map[string]*structs.DesiredUpdates{ job.TaskGroups[0].Name: { Ignore: 11 - c.stop, Stop: c.stop, }, }, }) }) } }
explode_data.jsonl/67254
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1065 }
[ 2830, 3393, 693, 40446, 5769, 1088, 64, 2591, 2195, 9408, 75286, 36989, 7661, 6713, 5431, 1155, 353, 8840, 836, 8, 341, 68577, 1669, 7860, 45293, 741, 68577, 28258, 22173, 58, 15, 936, 4289, 284, 646, 658, 4289, 271, 1444, 2264, 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...
2
func TestRefMatchingPrefix(t *testing.T) { for _, c := range []struct { ref, prefix string expected int }{ // Prefix is a reference.Domain() value {"docker.io", "docker.io", len("docker.io")}, {"docker.io", "example.com", -1}, {"example.com:5000", "example.com:5000", len("example.com:5000")}, {"example.com:50000", "example.com:5000", -1}, {"example.com:5000", "example.com", len("example.com")}, // FIXME FIXME This is unintended and undocumented, don't rely on this behavior {"example.com/foo", "example.com", len("example.com")}, {"example.com/foo/bar", "example.com", len("example.com")}, {"example.com/foo/bar:baz", "example.com", len("example.com")}, {"example.com/foo/bar@sha256:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "example.com", len("example.com")}, // Prefix is a reference.Named.Name() value or a repo namespace {"docker.io", "docker.io/library", -1}, {"docker.io/library", "docker.io/library", len("docker.io/library")}, {"example.com/library", "docker.io/library", -1}, {"docker.io/libraryy", "docker.io/library", -1}, {"docker.io/library/busybox", "docker.io/library", len("docker.io/library")}, {"docker.io", "docker.io/library/busybox", -1}, {"docker.io/library/busybox", "docker.io/library/busybox", len("docker.io/library/busybox")}, {"example.com/library/busybox", "docker.io/library/busybox", -1}, {"docker.io/library/busybox2", "docker.io/library/busybox", -1}, // Prefix is a single image {"example.com", "example.com/foo:bar", -1}, {"example.com/foo", "example.com/foo:bar", -1}, {"example.com/foo:bar", "example.com/foo:bar", len("example.com/foo:bar")}, {"example.com/foo:bar2", "example.com/foo:bar", -1}, {"example.com", "example.com/foo@sha256:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", -1}, {"example.com/foo", "example.com/foo@sha256:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", -1}, {"example.com/foo@sha256:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "example.com/foo@sha256:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", len("example.com/foo@sha256:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")}, {"example.com/foo@sha256:bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb", "example.com/foo@sha256:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", -1}, } { prefixLen := refMatchingPrefix(c.ref, c.prefix) assert.Equal(t, c.expected, prefixLen, fmt.Sprintf("%s vs. %s", c.ref, c.prefix)) } }
explode_data.jsonl/62226
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 967 }
[ 2830, 3393, 3945, 64430, 14335, 1155, 353, 8840, 836, 8, 341, 2023, 8358, 272, 1669, 2088, 3056, 1235, 341, 197, 59504, 11, 9252, 914, 198, 197, 42400, 262, 526, 198, 197, 59403, 197, 197, 322, 56483, 374, 264, 5785, 20442, 368, 897, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestNewPrometheusProvider(t *testing.T) { clients := prometheusFake() template, err := clients.flaggerClient.FlaggerV1beta1().MetricTemplates("default").Get(context.TODO(), "prometheus", metav1.GetOptions{}) require.NoError(t, err) secret, err := clients.kubeClient.CoreV1().Secrets("default").Get(context.TODO(), "prometheus", metav1.GetOptions{}) require.NoError(t, err) prom, err := NewPrometheusProvider(template.Spec.Provider, secret.Data) require.NoError(t, err) assert.Equal(t, "http://prometheus:9090", prom.url.String()) assert.Equal(t, "password", prom.password) }
explode_data.jsonl/23613
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 206 }
[ 2830, 3393, 3564, 35186, 39705, 5179, 1155, 353, 8840, 836, 8, 341, 197, 31869, 1669, 2706, 39705, 52317, 2822, 22832, 11, 1848, 1669, 8239, 8103, 10114, 2959, 73459, 10114, 53, 16, 19127, 16, 1005, 54310, 51195, 445, 2258, 1827, 1949, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestBot_CopyMessage(t *testing.T) { type fields struct { Configuration Configuration apiClient apiClient } type args struct { request axon.O } tests := []struct { name string fields fields args args wantResult axon.O wantErr bool }{ { fields: fields{ apiClient: &mockAPIClient{ method: "copyMessage", interfaceMethod: func() interface{} { return map[string]interface{}{ "id": 123456., } }, bytesMethod: func() []byte { return []byte("") }, }, }, wantResult: axon.O{ "id": 123456., }, }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { b := &Bot{ Configuration: tt.fields.Configuration, apiClient: tt.fields.apiClient, } gotResult, err := b.CopyMessage(tt.args.request) if (err != nil) != tt.wantErr { t.Errorf("Bot.CopyMessage() error = %v, wantErr %v", err, tt.wantErr) return } if !reflect.DeepEqual(gotResult, tt.wantResult) { t.Errorf("Bot.CopyMessage() = %v, want %v", gotResult, tt.wantResult) } }) } }
explode_data.jsonl/46089
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 525 }
[ 2830, 3393, 23502, 77637, 2052, 1155, 353, 8840, 836, 8, 341, 13158, 5043, 2036, 341, 197, 197, 7688, 12221, 198, 197, 54299, 2959, 257, 6330, 2959, 198, 197, 532, 13158, 2827, 2036, 341, 197, 23555, 3859, 263, 8382, 198, 197, 532, 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...
1
func TestRequestTime(t *testing.T) { t.Parallel() srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { time.Sleep(100 * time.Millisecond) d, err := json.Marshal(struct{ Done bool }{true}) if err != nil { http.Error(w, err.Error(), http.StatusInternalServerError) return } w.Write(d) })) defer srv.Close() conf := DefaultConfig() conf.Address = srv.URL client, err := NewClient(conf) if err != nil { t.Fatalf("err: %v", err) } var out interface{} qm, err := client.query("/", &out, nil) if err != nil { t.Fatalf("query err: %v", err) } if qm.RequestTime == 0 { t.Errorf("bad request time: %d", qm.RequestTime) } wm, err := client.write("/", struct{ S string }{"input"}, &out, nil) if err != nil { t.Fatalf("write err: %v", err) } if wm.RequestTime == 0 { t.Errorf("bad request time: %d", wm.RequestTime) } wm, err = client.delete("/", &out, nil) if err != nil { t.Fatalf("delete err: %v", err) } if wm.RequestTime == 0 { t.Errorf("bad request time: %d", wm.RequestTime) } }
explode_data.jsonl/65016
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 452 }
[ 2830, 3393, 1900, 1462, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 741, 1903, 10553, 1669, 54320, 70334, 7121, 5475, 19886, 89164, 18552, 3622, 1758, 37508, 11, 435, 353, 1254, 9659, 8, 341, 197, 21957, 31586, 7, 16, 15, 15, 353...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestRGB_GetValues(t *testing.T) { type fields struct { R uint8 G uint8 B uint8 } tests := []struct { name string fields fields wantR uint8 wantG uint8 wantB uint8 }{ {name: "Zero", fields: fields{R: 0, G: 0, B: 0}, wantR: uint8(0), wantG: uint8(0), wantB: uint8(0)}, {name: "Max", fields: fields{R: 255, G: 255, B: 255}, wantR: uint8(255), wantG: uint8(255), wantB: uint8(255)}, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { p := RGB{ R: tt.fields.R, G: tt.fields.G, B: tt.fields.B, } gotR, gotG, gotB := p.GetValues() if gotR != tt.wantR { t.Errorf("GetValues() gotR = %v, want %v", gotR, tt.wantR) } if gotG != tt.wantG { t.Errorf("GetValues() gotG = %v, want %v", gotG, tt.wantG) } if gotB != tt.wantB { t.Errorf("GetValues() gotB = %v, want %v", gotB, tt.wantB) } }) } }
explode_data.jsonl/62946
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 456 }
[ 2830, 3393, 18184, 13614, 6227, 1155, 353, 8840, 836, 8, 341, 13158, 5043, 2036, 341, 197, 11143, 2622, 23, 198, 197, 9600, 2622, 23, 198, 197, 12791, 2622, 23, 198, 197, 532, 78216, 1669, 3056, 1235, 341, 197, 11609, 256, 914, 198, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
4
func TestReduce(t *testing.T) { var testData []int8 for i := int8(1); i < 100; i++ { testData = append(testData, i) } sum := slice.Reduce(testData, func(acc int16, v int8) int16 { return acc + int16(v) }) require.Equal(t, int16(4950), sum) }
explode_data.jsonl/78901
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 111 }
[ 2830, 3393, 50325, 1155, 353, 8840, 836, 8, 341, 2405, 67348, 3056, 396, 23, 198, 2023, 600, 1669, 526, 23, 7, 16, 1215, 600, 366, 220, 16, 15, 15, 26, 600, 1027, 341, 197, 18185, 1043, 284, 8737, 8623, 1043, 11, 600, 340, 197, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func Test_Runner_Run(t *testing.T) { bin := filepath.Join("test_fixtures", "writing_output") if runtime.GOOS == "windows" { bin += ".bat" } runner := gin.NewRunner(bin) cmd, err := runner.Run() expect(t, err, nil) expect(t, cmd.Process == nil, false) }
explode_data.jsonl/4504
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 105 }
[ 2830, 3393, 2568, 54415, 84158, 1155, 353, 8840, 836, 8, 341, 2233, 258, 1669, 26054, 22363, 445, 1944, 36060, 18513, 497, 330, 25304, 7645, 1138, 743, 15592, 97574, 3126, 621, 330, 27077, 1, 341, 197, 2233, 258, 1421, 5933, 13718, 698,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func Test_read(t *testing.T) { const fn = `testdata/t.json` b, err := ioutil.ReadFile(fn) if err != nil { t.Fatal(err) } proxy_re := regexp.MustCompile(`proxy; rspamd_task_write_log: α`) expect_ct := len(proxy_re.FindAllSubmatch(b, -1)) b = nil fp, err := os.Open(`testdata/t.json`) if err != nil { j.Err(err) return } defer fp.Close() c := New_listener(gg, fp) var ok bool ct := 0 defer func() { t.Logf("expected: %v, rx: %v", expect_ct, ct) if ct != expect_ct { t.Fatalf("fn lines != expected: %v vs %v", expect_ct, ct) } }() for { select { case <-gg.Done(): return case _, ok = <-c: if !ok { return } ct++ } } }
explode_data.jsonl/27171
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 340 }
[ 2830, 3393, 6443, 1155, 353, 8840, 836, 8, 341, 4777, 5168, 284, 1565, 92425, 5523, 4323, 3989, 2233, 11, 1848, 1669, 43144, 78976, 24008, 340, 743, 1848, 961, 2092, 341, 197, 3244, 26133, 3964, 340, 197, 532, 197, 22803, 1288, 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...
2
func TestEmptyFullClusterRestore(t *testing.T) { defer leaktest.AfterTest(t)() sqlDB, tempDir, cleanupFn := createEmptyCluster(t, singleNode) _, _, sqlDBRestore, cleanupEmptyCluster := backupRestoreTestSetupEmpty(t, singleNode, tempDir, initNone) defer cleanupFn() defer cleanupEmptyCluster() sqlDB.Exec(t, `CREATE USER alice`) sqlDB.Exec(t, `CREATE USER bob`) sqlDB.Exec(t, `BACKUP TO $1`, localFoo) sqlDBRestore.Exec(t, `RESTORE FROM $1`, localFoo) checkQuery := "SELECT * FROM system.users" sqlDBRestore.CheckQueryResults(t, checkQuery, sqlDB.QueryStr(t, checkQuery)) }
explode_data.jsonl/48478
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 222 }
[ 2830, 3393, 3522, 9432, 28678, 56284, 1155, 353, 8840, 836, 8, 341, 16867, 23352, 1944, 36892, 2271, 1155, 8, 2822, 30633, 3506, 11, 2730, 6184, 11, 21290, 24911, 1669, 1855, 3522, 28678, 1155, 11, 3175, 1955, 340, 197, 6878, 8358, 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...
1
func TestGRPCReplicationClient_Recv(t *testing.T) { tests := []struct { name string mockStreamClient pb.Replication_GetWALStreamClient want []byte wantErr bool }{ { name: "success", mockStreamClient: &mock.WALStreamClient{ Response: &pb.GetWALStreamResponse{TransactionGroup: []byte{1, 2, 3}}, Error: nil, }, want: []byte{1, 2, 3}, wantErr: false, }, { name: "error/received io.EOF", mockStreamClient: &mock.WALStreamClient{ Response: &pb.GetWALStreamResponse{TransactionGroup: nil}, Error: io.EOF, }, want: nil, wantErr: true, }, { name: "error/received an error", mockStreamClient: &mock.WALStreamClient{ Response: &pb.GetWALStreamResponse{TransactionGroup: nil}, Error: errors.New("some error"), }, want: nil, wantErr: true, }, { name: "error/received nil message", mockStreamClient: &mock.WALStreamClient{ Response: nil, // nil message Error: nil, }, want: nil, wantErr: true, }, } for _, tt := range tests { tt := tt t.Run(tt.name, func(t *testing.T) { // --- given --- client := replication.NewGRPCReplicationClient(&mock.ReplicationClient{StreamClient: tt.mockStreamClient}) _ = client.Connect(context.Background()) // --- when --- got, err := client.Recv() // --- then --- if (err != nil) != tt.wantErr { t.Errorf("NewGRPCReplicationClient() error = %v, wantErr %v", err, tt.wantErr) return } if !reflect.DeepEqual(got, tt.want) { t.Errorf("NewGRPCReplicationClient() got = %v, want %v", got, tt.want) } }) } }
explode_data.jsonl/7162
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 759 }
[ 2830, 3393, 8626, 4872, 18327, 1693, 2959, 62, 63483, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 3056, 1235, 341, 197, 11609, 1797, 914, 198, 197, 77333, 3027, 2959, 17310, 2817, 79, 1693, 13614, 54, 969, 3027, 2959, 198, 197, 50780, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestReadBitPacked(t *testing.T) { testData := [][]interface{}{ []interface{}{1, 2, 3, 4, 5, 6, 7, 8}, []interface{}{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, } for _, data := range testData { ln := len(data) header := ((ln/8)<<1 | 1) bitWidth := BitNum(uint64(data[ln-1].(int))) res, _ := ReadBitPacked(bytes.NewReader(WriteBitPacked(data, int64(bitWidth), false)), uint64(header), bitWidth) if fmt.Sprintf("%v", res) != fmt.Sprintf("%v", data) { } } }
explode_data.jsonl/23904
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 221 }
[ 2830, 3393, 4418, 8344, 47, 11191, 1155, 353, 8840, 836, 8, 341, 18185, 1043, 1669, 52931, 4970, 67066, 197, 197, 1294, 4970, 6257, 90, 16, 11, 220, 17, 11, 220, 18, 11, 220, 19, 11, 220, 20, 11, 220, 21, 11, 220, 22, 11, 220, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestUserFriendRequestALREADYEXIST(t *testing.T) { resp := sendPost("http://localhost:8080/EXAMPLE2&q=solicitation", APPJASON_UTF_8, UserFriendRequestALREADYEXIST) response := responseToString(resp) compareResults(t, response, HyperText.CustomResponses["error-database"]) }
explode_data.jsonl/59359
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 95 }
[ 2830, 3393, 1474, 41637, 1900, 969, 45578, 92827, 1155, 353, 8840, 836, 8, 341, 34653, 1669, 3624, 4133, 445, 1254, 1110, 8301, 25, 23, 15, 23, 15, 14, 95875, 17, 62735, 14149, 7762, 7556, 497, 17912, 41, 35304, 55061, 62, 23, 11, 2...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestObfuscateSql(t *testing.T) { helpers.ResetMemoryStats() code := fmt.Sprintf(` result = datadog_agent.obfuscate_sql("select * from table where id = 1") with open(r'%s', 'w') as f: f.write(str(result)) `, tmpfile.Name()) out, err := run(code) if err != nil { t.Fatal(err) } expected := "select * from table where id = ?" if out != expected { t.Fatalf("expected: '%s', found: '%s'", out, expected) } helpers.AssertMemoryUsage(t) }
explode_data.jsonl/24561
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 188 }
[ 2830, 3393, 4121, 51589, 349, 8269, 1155, 353, 8840, 836, 8, 341, 197, 21723, 36660, 10642, 16635, 2822, 43343, 1669, 8879, 17305, 61528, 9559, 284, 3258, 329, 538, 25730, 26605, 51589, 349, 18063, 445, 1742, 353, 504, 1965, 1380, 877, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestSemaphore(t *testing.T) { s := new(uint32); *s = 1; c := make(chan bool); for i := 0; i < 10; i++ { go HammerSemaphore(s, c); } for i := 0; i < 10; i++ { <-c; } }
explode_data.jsonl/82481
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 94 }
[ 2830, 3393, 74614, 1155, 353, 8840, 836, 8, 341, 1903, 1669, 501, 8488, 18, 17, 317, 197, 33454, 284, 220, 16, 280, 1444, 1669, 1281, 35190, 1807, 317, 2023, 600, 1669, 220, 15, 26, 600, 366, 220, 16, 15, 26, 600, 1027, 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...
3
func TestCheckRefreshTokens(t *testing.T) { cfg := newFakeKeycloakConfig() cfg.EnableRefreshTokens = true cfg.EncryptionKey = testEncryptionKey fn := func(no int, req *resty.Request, resp *resty.Response) { if no == 0 { <-time.After(1000 * time.Millisecond) } } p := newFakeProxy(cfg) p.idp.setTokenExpiration(1000 * time.Millisecond) requests := []fakeRequest{ { URI: fakeAuthAllURL, HasLogin: true, Redirects: true, OnResponse: fn, ExpectedProxy: true, ExpectedCode: http.StatusOK, }, { URI: fakeAuthAllURL, Redirects: false, ExpectedProxy: true, ExpectedCode: http.StatusOK, ExpectedCookies: map[string]string{cfg.CookieAccessName: ""}, }, } p.RunTests(t, requests) }
explode_data.jsonl/14759
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 352 }
[ 2830, 3393, 3973, 14567, 29300, 1155, 353, 8840, 836, 8, 341, 50286, 1669, 501, 52317, 1592, 88751, 2648, 741, 50286, 32287, 14567, 29300, 284, 830, 198, 50286, 26598, 15597, 1592, 284, 1273, 79239, 1592, 198, 40095, 1669, 2915, 39205, 52...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestCommitReadOnlyTransaction(t *testing.T) { defer leaktest.AfterTest(t)() defer log.Scope(t).Close(t) ctx := context.Background() clock := hlc.NewClock(hlc.UnixNano, time.Nanosecond) ambient := log.AmbientContext{Tracer: tracing.NewTracer()} sender := &mockSender{} stopper := stop.NewStopper() defer stopper.Stop(ctx) var calls []roachpb.Method sender.match(func(ba roachpb.BatchRequest) (*roachpb.BatchResponse, *roachpb.Error) { calls = append(calls, ba.Methods()...) return nil, nil }) factory := NewTxnCoordSenderFactory( TxnCoordSenderFactoryConfig{ AmbientCtx: ambient, Clock: clock, Stopper: stopper, Settings: cluster.MakeTestingClusterSettings(), }, sender, ) testutils.RunTrueAndFalse(t, "explicit txn", func(t *testing.T, explicitTxn bool) { testutils.RunTrueAndFalse(t, "with get", func(t *testing.T, withGet bool) { calls = nil db := kv.NewDB(testutils.MakeAmbientCtx(), factory, clock, stopper) if err := db.Txn(ctx, func(ctx context.Context, txn *kv.Txn) error { b := txn.NewBatch() if withGet { b.Get("foo") } if explicitTxn { return txn.CommitInBatch(ctx, b) } return txn.Run(ctx, b) }); err != nil { t.Fatal(err) } expectedCalls := []roachpb.Method(nil) if withGet { expectedCalls = append(expectedCalls, roachpb.Get) } if !reflect.DeepEqual(expectedCalls, calls) { t.Fatalf("expected %s, got %s", expectedCalls, calls) } }) }) }
explode_data.jsonl/76901
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 647 }
[ 2830, 3393, 33441, 20914, 8070, 1155, 353, 8840, 836, 8, 341, 16867, 23352, 1944, 36892, 2271, 1155, 8, 741, 16867, 1487, 77940, 1155, 568, 7925, 1155, 340, 20985, 1669, 2266, 19047, 741, 84165, 1669, 305, 17257, 7121, 26104, 3203, 17257,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestSimpleSend(t *testing.T) { c := context.New(t, defaultMTU) defer c.Cleanup() c.CreateConnected(context.TestInitialSequenceNumber, 30000, -1 /* epRcvBuf */) data := []byte{1, 2, 3} var r bytes.Reader r.Reset(data) if _, err := c.EP.Write(&r, tcpip.WriteOptions{}); err != nil { t.Fatalf("Write failed: %s", err) } // Check that data is received. b := c.GetPacket() iss := seqnum.Value(context.TestInitialSequenceNumber).Add(1) checker.IPv4(t, b, checker.PayloadLen(len(data)+header.TCPMinimumSize), checker.TCP( checker.DstPort(context.TestPort), checker.TCPSeqNum(uint32(c.IRS)+1), checker.TCPAckNum(uint32(iss)), checker.TCPFlagsMatch(header.TCPFlagAck, ^header.TCPFlagPsh), ), ) if p := b[header.IPv4MinimumSize+header.TCPMinimumSize:]; !bytes.Equal(data, p) { t.Fatalf("got data = %v, want = %v", p, data) } // Acknowledge the data. c.SendPacket(nil, &context.Headers{ SrcPort: context.TestPort, DstPort: c.Port, Flags: header.TCPFlagAck, SeqNum: iss, AckNum: c.IRS.Add(1 + seqnum.Size(len(data))), RcvWnd: 30000, }) }
explode_data.jsonl/75956
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 491 }
[ 2830, 3393, 16374, 11505, 1155, 353, 8840, 836, 8, 341, 1444, 1669, 2266, 7121, 1155, 11, 1638, 8505, 52, 340, 16867, 272, 727, 60639, 2822, 1444, 7251, 21146, 5378, 8787, 6341, 14076, 2833, 11, 220, 18, 15, 15, 15, 15, 11, 481, 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...
3
func TestVectorDeclConformsWithHandles(t *testing.T) { checkConforms(t, context{ handleDefs: []gidlir.HandleDef{ {Subtype: fidlir.Event}, {Subtype: fidlir.Event}, }, }, &VectorDecl{ schema: testSchema(t), typ: fidlir.Type{ Kind: fidlir.VectorType, ElementType: &fidlir.Type{ Kind: fidlir.HandleType, HandleSubtype: fidlir.Event, }, }, }, []conformTest{ conformOk{[]interface{}{}}, conformOk{[]interface{}{gidlir.Handle(0)}}, conformOk{[]interface{}{gidlir.Handle(0), gidlir.Handle(1)}}, conformOk{[]interface{}{gidlir.Handle(1), gidlir.Handle(0)}}, // The parser is responsible for ensuring handles are used exactly // once, not the mixer, so this passes. conformOk{[]interface{}{gidlir.Handle(0), gidlir.Handle(0)}}, conformFail{[]interface{}{uint64(0)}, "[0]: expecting handle"}, conformFail{[]interface{}{nil}, "[0]: expecting non-null handle"}, }, ) }
explode_data.jsonl/21408
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 426 }
[ 2830, 3393, 3781, 21629, 1109, 9807, 2354, 65928, 1155, 353, 8840, 836, 8, 341, 25157, 1109, 9807, 1155, 345, 197, 28413, 515, 298, 53822, 56031, 25, 3056, 34849, 75, 404, 31421, 2620, 515, 571, 197, 90, 3136, 1313, 25, 32104, 75, 404...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestProhibitedPurposeSyncTCF2(t *testing.T) { tcf2VendorList34 := buildTCF2VendorList34() tcf2VendorList34.Vendors["8"].Purposes = []int{7} vendorListData := tcf2MarshalVendorList(tcf2VendorList34) perms := permissionsImpl{ cfg: tcf2Config, vendorIDs: map[openrtb_ext.BidderName]uint16{ openrtb_ext.BidderAppnexus: 2, openrtb_ext.BidderPubmatic: 6, openrtb_ext.BidderRubicon: 8, }, fetchVendorList: map[uint8]func(ctx context.Context, id uint16) (vendorlist.VendorList, error){ tcf1SpecVersion: nil, tcf2SpecVersion: listFetcher(map[uint16]vendorlist.VendorList{ 34: parseVendorListDataV2(t, vendorListData), }), }, } perms.cfg.HostVendorID = 8 // COzTVhaOzTVhaGvAAAENAiCIAP_AAH_AAAAAAEEUACCKAAA : TCF2 with full consents to purposes for vendors 2, 6, 8 allowSync, err := perms.HostCookiesAllowed(context.Background(), "COzTVhaOzTVhaGvAAAENAiCIAP_AAH_AAAAAAEEUACCKAAA") assert.NoErrorf(t, err, "Error processing HostCookiesAllowed") assert.EqualValuesf(t, false, allowSync, "HostCookiesAllowed failure") allowSync, err = perms.BidderSyncAllowed(context.Background(), openrtb_ext.BidderRubicon, "COzTVhaOzTVhaGvAAAENAiCIAP_AAH_AAAAAAEEUACCKAAA") assert.NoErrorf(t, err, "Error processing BidderSyncAllowed") assert.EqualValuesf(t, false, allowSync, "BidderSyncAllowed failure") }
explode_data.jsonl/46168
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 557 }
[ 2830, 3393, 1336, 92517, 74033, 12154, 7749, 37, 17, 1155, 353, 8840, 836, 8, 341, 3244, 9792, 17, 44691, 852, 18, 19, 1669, 1936, 7749, 37, 17, 44691, 852, 18, 19, 741, 3244, 9792, 17, 44691, 852, 18, 19, 5058, 32885, 1183, 23, 5...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestSendAutoResponseSuccess(t *testing.T) { th := Setup().InitBasic() defer th.TearDown() user := th.CreateUser() defer th.App.PermanentDeleteUser(user) patch := &model.UserPatch{} patch.NotifyProps = make(map[string]string) patch.NotifyProps["auto_responder_active"] = "true" patch.NotifyProps["auto_responder_message"] = "Hello, I'm unavailable today." userUpdated1, err := th.App.PatchUser(user.Id, patch, true) require.Nil(t, err) firstPost, err := th.App.CreatePost(&model.Post{ ChannelId: th.BasicChannel.Id, Message: "zz" + model.NewId() + "a", UserId: th.BasicUser.Id}, th.BasicChannel, false) th.App.SendAutoResponse(th.BasicChannel, userUpdated1, firstPost.Id) if list, err := th.App.GetPosts(th.BasicChannel.Id, 0, 1); err != nil { require.Nil(t, err) } else { autoResponderPostFound := false autoResponderIsComment := false for _, post := range list.Posts { if post.Type == model.POST_AUTO_RESPONDER { autoResponderIsComment = post.RootId == firstPost.Id autoResponderPostFound = true } } assert.True(t, autoResponderPostFound) assert.True(t, autoResponderIsComment) } }
explode_data.jsonl/19808
{ "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, 11505, 13253, 2582, 7188, 1155, 353, 8840, 836, 8, 341, 70479, 1669, 18626, 1005, 3803, 15944, 741, 16867, 270, 836, 682, 4454, 2822, 19060, 1669, 270, 7251, 1474, 741, 16867, 270, 5105, 1069, 4753, 306, 6435, 1474, 4277, 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...
4
func TestOpenURL(t *testing.T) { testURL := func(url string) { db, err := openTestConnConninfo(url) if err != nil { t.Fatal(err) } defer db.Close() // database/sql might not call our Open at all unless we do something with // the connection txn, err := db.Begin() if err != nil { t.Fatal(err) } txn.Rollback() } testURL("postgres://") testURL("postgresql://") }
explode_data.jsonl/73471
{ "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, 5002, 3144, 1155, 353, 8840, 836, 8, 341, 18185, 3144, 1669, 2915, 6522, 914, 8, 341, 197, 20939, 11, 1848, 1669, 1787, 2271, 9701, 9701, 2733, 6522, 340, 197, 743, 1848, 961, 2092, 341, 298, 3244, 26133, 3964, 340, 197, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func Test_MapMerge(t *testing.T) { dtest.C(t, func(t *dtest.T) { m1 := d.Map{ "k1": "v1", } m2 := d.Map{ "k2": "v2", } m3 := d.Map{ "k3": "v3", } dutil.MapMerge(m1, m2, m3, nil) t.Assert(m1["k1"], "v1") t.Assert(m1["k2"], "v2") t.Assert(m1["k3"], "v3") t.Assert(m2["k1"], nil) t.Assert(m3["k1"], nil) }) }
explode_data.jsonl/16854
{ "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, 56992, 52096, 1155, 353, 8840, 836, 8, 341, 2698, 1944, 727, 1155, 11, 2915, 1155, 353, 67, 1944, 836, 8, 341, 197, 2109, 16, 1669, 294, 10104, 515, 298, 197, 62911, 16, 788, 330, 85, 16, 756, 197, 197, 532, 197, 2109,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestCompileTemplate(t *testing.T) { e := diffResultStruct{ BuildResult: "pass", BuildTime: time.Minute * 2, TestCount: 1234, FailingTests: 1, PassingTests: 1233, BuildNumber: 123, Tests: []diffResultTestStruct{ { Classname: "class", TestName: "runStuff", Duration: time.Second * 3, Message: `I fail fail again and again`, }, { Classname: "class", TestName: "runStuffAgain", Duration: time.Second * 2, Message: `I fail fail again and again and again and again`, }, }, } buf := &bytes.Buffer{} assert.Nil(t, diffResultTemplate.Execute(buf, e)) t.Log("*" + buf.String() + "*") }
explode_data.jsonl/80363
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 296 }
[ 2830, 3393, 46126, 7275, 1155, 353, 8840, 836, 8, 341, 7727, 1669, 3638, 2077, 9422, 515, 197, 197, 11066, 2077, 25, 220, 330, 6385, 756, 197, 197, 11066, 1462, 25, 262, 882, 75770, 353, 220, 17, 345, 197, 73866, 2507, 25, 262, 220,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestAdmin_Delete(t *testing.T) { ts, _, teardown := startupT(t) defer teardown() c1 := store.Comment{Text: "test test #1", User: store.User{ID: "id", Name: "name"}, Locator: store.Locator{SiteID: "radio-t", URL: "https://radio-t.com/blah"}} c2 := store.Comment{Text: "test test #2", User: store.User{ID: "id", Name: "name"}, ParentID: "p1", Locator: store.Locator{SiteID: "radio-t", URL: "https://radio-t.com/blah"}} id1 := addComment(t, c1, ts) addComment(t, c2, ts) // check last comments res, code := get(t, ts.URL+"/api/v1/last/2?site=radio-t") assert.Equal(t, 200, code) comments := []store.Comment{} err := json.Unmarshal([]byte(res), &comments) assert.Nil(t, err) assert.Equal(t, 2, len(comments), "should have 2 comments") // check multi count resp, err := post(t, ts.URL+"/api/v1/counts?site=radio-t", `["https://radio-t.com/blah","https://radio-t.com/blah2"]`) assert.Nil(t, err) assert.Equal(t, http.StatusOK, resp.StatusCode) bb, err := ioutil.ReadAll(resp.Body) assert.Nil(t, err) j := []store.PostInfo{} err = json.Unmarshal(bb, &j) assert.Nil(t, err) assert.Equal(t, []store.PostInfo([]store.PostInfo{{URL: "https://radio-t.com/blah", Count: 2}, {URL: "https://radio-t.com/blah2", Count: 0}}), j) // delete a comment req, err := http.NewRequest(http.MethodDelete, fmt.Sprintf("%s/api/v1/admin/comment/%s?site=radio-t&url=https://radio-t.com/blah", ts.URL, id1), nil) assert.Nil(t, err) requireAdminOnly(t, req) resp, err = sendReq(t, req, adminUmputunToken) assert.Nil(t, err) assert.Equal(t, 200, resp.StatusCode) body, code := getWithDevAuth(t, fmt.Sprintf("%s/api/v1/id/%s?site=radio-t&url=https://radio-t.com/blah", ts.URL, id1)) assert.Equal(t, 200, code) cr := store.Comment{} err = json.Unmarshal([]byte(body), &cr) assert.Nil(t, err) assert.Equal(t, "", cr.Text) assert.True(t, cr.Deleted) time.Sleep(250 * time.Millisecond) // check last comments updated res, code = get(t, ts.URL+"/api/v1/last/2?site=radio-t") assert.Equal(t, 200, code) comments = []store.Comment{} err = json.Unmarshal([]byte(res), &comments) assert.Nil(t, err) assert.Equal(t, 1, len(comments), "should have 1 comments") // check count updated res, code = get(t, ts.URL+"/api/v1/count?site=radio-t&url=https://radio-t.com/blah") assert.Equal(t, 200, code) b := map[string]interface{}{} err = json.Unmarshal([]byte(res), &b) assert.Nil(t, err) t.Logf("%#v", b) assert.Equal(t, 1.0, b["count"], "should report 1 comments") // check multi count updated resp, err = post(t, ts.URL+"/api/v1/counts?site=radio-t", `["https://radio-t.com/blah","https://radio-t.com/blah2"]`) assert.Nil(t, err) assert.Equal(t, http.StatusOK, resp.StatusCode) bb, err = ioutil.ReadAll(resp.Body) assert.Nil(t, err) j = []store.PostInfo{} err = json.Unmarshal(bb, &j) assert.Nil(t, err) assert.Equal(t, []store.PostInfo([]store.PostInfo{{URL: "https://radio-t.com/blah", Count: 1}, {URL: "https://radio-t.com/blah2", Count: 0}}), j) }
explode_data.jsonl/51822
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1310 }
[ 2830, 3393, 7210, 57418, 1155, 353, 8840, 836, 8, 341, 57441, 11, 8358, 49304, 1669, 20567, 51, 1155, 340, 16867, 49304, 2822, 1444, 16, 1669, 3553, 56730, 90, 1178, 25, 330, 1944, 1273, 671, 16, 497, 2657, 25, 3553, 7344, 90, 915, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestIsDNS1123Label(t *testing.T) { goodValues := []string{ "a", "ab", "abc", "a1", "a-1", "a--1--2--b", "0", "01", "012", "1a", "1-a", "1--a--b--2", strings.Repeat("a", 63), } for _, val := range goodValues { if !IsDNS1123Label(val) { t.Errorf("expected true for '%s'", val) } } badValues := []string{ "", "A", "ABC", "aBc", "A1", "A-1", "1-A", "-", "a-", "-a", "1-", "-1", "_", "a_", "_a", "a_b", "1_", "_1", "1_2", ".", "a.", ".a", "a.b", "1.", ".1", "1.2", " ", "a ", " a", "a b", "1 ", " 1", "1 2", strings.Repeat("a", 64), } for _, val := range badValues { if IsDNS1123Label(val) { t.Errorf("expected false for '%s'", val) } } }
explode_data.jsonl/58305
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 356 }
[ 2830, 3393, 3872, 61088, 16, 16, 17, 18, 2476, 1155, 353, 8840, 836, 8, 341, 3174, 1386, 6227, 1669, 3056, 917, 515, 197, 197, 56693, 497, 330, 370, 497, 330, 13683, 497, 330, 64, 16, 497, 330, 64, 12, 16, 497, 330, 64, 313, 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...
5
func TestAESEncrypt(t *testing.T) { t.Parallel() provider, _, cleanup := currentTestConfig.Provider(t) defer cleanup() k, err := provider.KeyGen(&bccsp.AESKeyGenOpts{Temporary: false}) if err != nil { t.Fatalf("Failed generating AES_256 key [%s]", err) } ct, err := provider.Encrypt(k, []byte("Hello World"), &bccsp.AESCBCPKCS7ModeOpts{}) if err != nil { t.Fatalf("Failed encrypting [%s]", err) } if len(ct) == 0 { t.Fatal("Failed encrypting. Nil ciphertext") } }
explode_data.jsonl/29272
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 199 }
[ 2830, 3393, 13669, 925, 1016, 3571, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 741, 197, 19979, 11, 8358, 21290, 1669, 1482, 2271, 2648, 36208, 1155, 340, 16867, 21290, 2822, 16463, 11, 1848, 1669, 9109, 9610, 9967, 2099, 69018, 2...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
4
func TestPoolCleanup(ot *testing.T) { birthdate := time.Now() maxLife := 1 * time.Second succeedingConnect := func(s string, _ log.BoltLogger) (db.Connection, error) { return &testutil.ConnFake{Name: s, Alive: true, Birth: birthdate}, nil } // Borrows a connection in server A and another in server B borrowConnections := func(t *testing.T, p *Pool) (db.Connection, db.Connection) { c1, err := p.Borrow(context.Background(), []string{"A"}, true, nil) assertConnection(t, c1, err) c2, err := p.Borrow(context.Background(), []string{"B"}, true, nil) assertConnection(t, c2, err) return c1, c2 } ot.Run("Should remove servers with only idle too old connections", func(t *testing.T) { p := New(0, maxLife, succeedingConnect, logger, "poolid") defer p.Close() p.now = func() time.Time { return birthdate } c1, c2 := borrowConnections(t, p) p.Return(c1) p.Return(c2) assertNumberOfServers(t, p, 2) assertNumberOfIdle(t, p, "A", 1) assertNumberOfIdle(t, p, "B", 1) // Now go into the future and cleanup, should remove both servers and close the connections p.now = func() time.Time { return birthdate.Add(maxLife).Add(1 * time.Second) } p.CleanUp() assertNumberOfServers(t, p, 0) }) ot.Run("Should not remove servers with busy connections", func(t *testing.T) { p := New(0, maxLife, succeedingConnect, logger, "poolid") defer p.Close() p.now = func() time.Time { return birthdate } _, c2 := borrowConnections(t, p) p.Return(c2) assertNumberOfServers(t, p, 2) assertNumberOfIdle(t, p, "A", 0) assertNumberOfIdle(t, p, "B", 1) // Now go into the future and cleanup, should only remove B p.now = func() time.Time { return birthdate.Add(maxLife).Add(1 * time.Second) } p.CleanUp() assertNumberOfServers(t, p, 1) }) ot.Run("Should not remove servers with only idle connections but with recent connect failures ", func(t *testing.T) { failingConnect := func(s string, _ log.BoltLogger) (db.Connection, error) { return nil, errors.New("an error") } p := New(0, maxLife, failingConnect, logger, "poolid") defer p.Close() c1, err := p.Borrow(context.Background(), []string{"A"}, true, nil) assertNoConnection(t, c1, err) assertNumberOfServers(t, p, 1) assertNumberOfIdle(t, p, "A", 0) // Now go into the future and cleanup, should not remove A even if has no connections since // we should remember the failure a bit longer p.now = func() time.Time { return birthdate.Add(maxLife).Add(1 * time.Second) } p.CleanUp() assertNumberOfServers(t, p, 1) // Further into the future, the failure should have been forgotten p.now = func() time.Time { return birthdate.Add(maxLife).Add(rememberFailedConnectDuration).Add(1 * time.Second) } p.CleanUp() assertNumberOfServers(t, p, 0) }) }
explode_data.jsonl/49912
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1036 }
[ 2830, 3393, 10551, 67335, 7, 354, 353, 8840, 836, 8, 341, 2233, 4809, 1028, 1669, 882, 13244, 741, 22543, 25749, 1669, 220, 16, 353, 882, 32435, 198, 1903, 29264, 287, 14611, 1669, 2915, 1141, 914, 11, 716, 1487, 1785, 6181, 7395, 8, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestConstructMetadataDBName(t *testing.T) { // Allowed pattern for chainName: [a-z][a-z0-9.-] chainName := "tob2g.y-z0f.qwp-rq5g4-ogid5g6oucyryg9sc16mz0t4vuake5q557esz7sn493nf0ghch0xih6dwuirokyoi4jvs67gh6r5v6mhz3-292un2-9egdcs88cstg3f7xa9m1i8v4gj0t3jedsm-woh3kgiqehwej6h93hdy5tr4v.1qmmqjzz0ox62k.507sh3fkw3-mfqh.ukfvxlm5szfbwtpfkd1r4j.cy8oft5obvwqpzjxb27xuw6" truncatedChainName := "tob2g.y-z0f.qwp-rq5g4-ogid5g6oucyryg9sc16mz0t4vuak" assert.Equal(t, chainNameAllowedLength, len(truncatedChainName)) // <first 50 chars (i.e., chainNameAllowedLength) of chainName> + 1 char for '(' + <64 chars for SHA256 hash // (hex encoding) of untruncated chainName> + 1 char for ')' + 1 char for '_' = 117 chars hash := hex.EncodeToString(util.ComputeSHA256([]byte(chainName))) expectedDBName := truncatedChainName + "(" + hash + ")" + "_" expectedDBNameLength := 117 constructedDBName := constructMetadataDBName(chainName) assert.Equal(t, expectedDBNameLength, len(constructedDBName)) assert.Equal(t, expectedDBName, constructedDBName) }
explode_data.jsonl/39980
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 478 }
[ 2830, 3393, 28468, 14610, 3506, 675, 1155, 353, 8840, 836, 8, 341, 197, 322, 57622, 5383, 369, 8781, 675, 25, 508, 64, 9141, 1457, 64, 9141, 15, 12, 24, 12612, 921, 197, 8819, 675, 1669, 330, 83, 674, 17, 70, 2384, 9141, 15, 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 TestRepository_GetChecks_CheckServiceError(t *testing.T) { githubErr := errors.New("github error") mocksChecksService := new(mocks.ChecksService) mocksChecksService. On("ListCheckRunsForRef", Anything, AnythingOfType("string"), AnythingOfType("string"), AnythingOfType("string"), Anything). Return(nil, nil, githubErr) repository := initRepository(t) if repository != nil { repository.checksService = mocksChecksService _, err := repository.GetChecks("test", "test", "master") if assert.Error(t, err) { assert.Contains(t, err.Error(), "github error") mocksChecksService.AssertNumberOfCalls(t, "ListCheckRunsForRef", 1) mocksChecksService.AssertExpectations(t) } } }
explode_data.jsonl/36433
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 248 }
[ 2830, 3393, 4624, 13614, 49820, 28188, 1860, 1454, 1155, 353, 8840, 836, 8, 341, 3174, 3827, 7747, 1669, 5975, 7121, 445, 5204, 1465, 5130, 2109, 25183, 49820, 1860, 1669, 501, 1255, 25183, 10600, 82, 1860, 340, 2109, 25183, 49820, 1860, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestGetHistoricalTrades(t *testing.T) { t.Parallel() _, err := b.GetHistoricalTrades(context.Background(), "BTCUSDT", 5, -1) if err != nil { t.Errorf("Binance GetHistoricalTrades() error: %v", err) } }
explode_data.jsonl/76645
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 85 }
[ 2830, 3393, 1949, 48983, 938, 1282, 3452, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 2822, 197, 6878, 1848, 1669, 293, 2234, 48983, 938, 1282, 3452, 5378, 19047, 1507, 330, 59118, 2034, 10599, 497, 220, 20, 11, 481, 16, 340, 743...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestListTrafficPolicies(t *testing.T) { assert := tassert.New(t) type listTrafficPoliciesTest struct { input service.MeshService output []trafficpolicy.TrafficTarget } listTrafficPoliciesTests := []listTrafficPoliciesTest{ { input: tests.BookstoreV1Service, output: []trafficpolicy.TrafficTarget{tests.BookstoreV1TrafficPolicy}, }, { input: tests.BookbuyerService, output: []trafficpolicy.TrafficTarget{tests.BookstoreV1TrafficPolicy, tests.BookstoreV2TrafficPolicy, tests.BookstoreApexTrafficPolicy}, }, } mc := newFakeMeshCatalog() for _, test := range listTrafficPoliciesTests { trafficTargets, err := mc.ListTrafficPolicies(test.input) assert.Nil(err) assert.ElementsMatch(trafficTargets, test.output) } }
explode_data.jsonl/69749
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 285 }
[ 2830, 3393, 852, 87229, 47, 42038, 1155, 353, 8840, 836, 8, 341, 6948, 1669, 259, 2207, 7121, 1155, 692, 13158, 1140, 87229, 47, 42038, 2271, 2036, 341, 197, 22427, 220, 2473, 50155, 1860, 198, 197, 21170, 3056, 53987, 34790, 836, 956, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestFormFieldBinder(t *testing.T) { e := New() body := `texta=foo&slice=5` req := httptest.NewRequest(http.MethodPost, "/api/search?id=1&nr=2&slice=3&slice=4", strings.NewReader(body)) req.Header.Set(HeaderContentLength, strconv.Itoa(len(body))) req.Header.Set(HeaderContentType, MIMEApplicationForm) rec := httptest.NewRecorder() c := e.NewContext(req, rec) b := FormFieldBinder(c) var texta string id := int64(99) nr := int64(88) var slice = make([]int64, 0) var notExisting = make([]int64, 0) err := b. Int64s("slice", &slice). Int64("id", &id). Int64("nr", &nr). String("texta", &texta). Int64s("notExisting", &notExisting). BindError() assert.NoError(t, err) assert.Equal(t, "foo", texta) assert.Equal(t, int64(1), id) assert.Equal(t, int64(2), nr) assert.Equal(t, []int64{5, 3, 4}, slice) assert.Equal(t, []int64{}, notExisting) }
explode_data.jsonl/82531
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 379 }
[ 2830, 3393, 45357, 44055, 1155, 353, 8840, 836, 8, 341, 7727, 1669, 1532, 741, 35402, 1669, 1565, 1318, 64, 28, 7975, 5, 24963, 28, 20, 3989, 24395, 1669, 54320, 70334, 75274, 19886, 20798, 4133, 11, 3521, 2068, 23167, 20348, 28, 16, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestPutsInStagingTxn(t *testing.T) { defer leaktest.AfterTest(t)() defer log.Scope(t).Close(t) ctx := context.Background() keyA := roachpb.Key("a") keyB := roachpb.Key("b") var putInStagingSeen bool var storeKnobs kvserver.StoreTestingKnobs storeKnobs.TestingRequestFilter = func(ctx context.Context, ba roachpb.BatchRequest) *roachpb.Error { put, ok := ba.GetArg(roachpb.Put) if !ok || !put.(*roachpb.PutRequest).Key.Equal(keyB) { return nil } txn := ba.Txn if txn == nil { return nil } if txn.Status == roachpb.STAGING { putInStagingSeen = true } return nil } // Disable the DistSender concurrency so that sub-batches split by the // DistSender are send serially and the transaction is updated from one to // another. See below. settings := cluster.MakeTestingClusterSettings() senderConcurrencyLimit.Override(&settings.SV, 0) s, _, db := serverutils.StartServer(t, base.TestServerArgs{ Settings: settings, Knobs: base.TestingKnobs{Store: &storeKnobs}, }) defer s.Stopper().Stop(ctx) require.NoError(t, db.AdminSplit(ctx, keyB /* splitKey */, hlc.MaxTimestamp /* expirationTimestamp */)) txn := db.NewTxn(ctx, "test") // Cause a write too old condition for the upcoming txn writes, to spicy up // the test. require.NoError(t, db.Put(ctx, keyB, "b")) // Send a batch that will be split into two sub-batches: [Put(a)+EndTxn, // Put(b)] (the EndTxn is grouped with the first write). These sub-batches are // sent serially since we've inhibited the DistSender's concurrency. The first // one will transition the txn to STAGING, and the DistSender will use that // updated txn when sending the 2nd sub-batch. b := txn.NewBatch() b.Put(keyA, "a") b.Put(keyB, "b") require.NoError(t, txn.CommitInBatch(ctx, b)) // Verify that the test isn't fooling itself by checking that we've indeed // seen a batch with the STAGING status. require.True(t, putInStagingSeen) }
explode_data.jsonl/76914
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 715 }
[ 2830, 3393, 47, 6128, 641, 623, 4118, 31584, 77, 1155, 353, 8840, 836, 8, 341, 16867, 23352, 1944, 36892, 2271, 1155, 8, 741, 16867, 1487, 77940, 1155, 568, 7925, 1155, 340, 20985, 1669, 2266, 19047, 2822, 23634, 32, 1669, 926, 610, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestDataset(t *testing.T) { rootFiler, err := filer.FromZIP("dataset.zip") assert.Nil(t, err) defer rootFiler.Close() projects, err := rootFiler.ReadDir("") assert.Nil(t, err) licenses := map[string]map[string]float32{} mutex := sync.Mutex{} wg := sync.WaitGroup{} wg.Add(len(projects)) for _, project := range projects { go func(project filer.File) { defer wg.Done() myLicenses, _ := Detect(filer.NestFiler(rootFiler, project.Name)) if len(myLicenses) > 0 { mutex.Lock() licenses[project.Name] = myLicenses mutex.Unlock() } }(project) } wg.Wait() assert.True(t, len(licenses) >= 893) // the rest len(projects) - 902 do not contain any license information fmt.Printf("%d %d %d%%\n", len(licenses), 902, (100*len(licenses))/902) if os.Getenv("LICENSE_TEST_DEBUG") != "" { for _, project := range projects { if _, exists := licenses[project.Name]; !exists { println(project.Name) } } } }
explode_data.jsonl/15659
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 413 }
[ 2830, 3393, 33363, 1155, 353, 8840, 836, 8, 341, 33698, 37, 5769, 11, 1848, 1669, 1461, 261, 11439, 61585, 445, 21378, 20991, 1138, 6948, 59678, 1155, 11, 1848, 340, 16867, 3704, 37, 5769, 10421, 741, 197, 17161, 11, 1848, 1669, 3704, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestIssueCreate(t *testing.T) { defer gock.Off() gock.New("https://try.gogs.io"). Post("/api/v1/repos/gogits/gogs/issues"). Reply(200). Type("application/json"). File("testdata/issue.json") input := scm.IssueInput{ Title: "Bug found", Body: "I'm having a problem with this.", } client, _ := New("https://try.gogs.io") got, _, err := client.Issues.Create(context.Background(), "gogits/gogs", &input) if err != nil { t.Error(err) } want := new(scm.Issue) raw, _ := ioutil.ReadFile("testdata/issue.json.golden") json.Unmarshal(raw, want) if diff := cmp.Diff(got, want); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } }
explode_data.jsonl/77749
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 282 }
[ 2830, 3393, 42006, 4021, 1155, 353, 8840, 836, 8, 341, 16867, 728, 377, 13, 4596, 2822, 3174, 1176, 7121, 445, 2428, 1110, 1539, 1302, 26307, 4245, 38609, 197, 197, 4133, 4283, 2068, 5457, 16, 49505, 4846, 538, 1199, 4846, 26307, 38745,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestChannelCreation(t *testing.T) { itest(t, func(ctx context.Context, guest, host *Starlightd) { steps := channelCreationSteps(guest, host, 0, 0, channelFundingAmount) for _, s := range steps { testStep(ctx, t, s, nil) } }) }
explode_data.jsonl/26080
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 96 }
[ 2830, 3393, 9629, 32701, 1155, 353, 8840, 836, 8, 341, 23374, 477, 1155, 11, 2915, 7502, 2266, 9328, 11, 8640, 11, 3468, 353, 12699, 4145, 67, 8, 341, 197, 18388, 7124, 1669, 5496, 32701, 33951, 3268, 3045, 11, 3468, 11, 220, 15, 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 TestTransportDiscardsUnneededConns(t *testing.T) { defer afterTest(t) cst := newClientServerTest(t, h2Mode, HandlerFunc(func(w ResponseWriter, r *Request) { fmt.Fprintf(w, "Hello, %v", r.RemoteAddr) })) defer cst.close() var numOpen, numClose int32 // atomic tlsConfig := &tls.Config{InsecureSkipVerify: true} tr := &Transport{ TLSClientConfig: tlsConfig, DialTLS: func(_, addr string) (net.Conn, error) { time.Sleep(10 * time.Millisecond) rc, err := net.Dial("tcp", addr) if err != nil { return nil, err } atomic.AddInt32(&numOpen, 1) c := noteCloseConn{rc, func() { atomic.AddInt32(&numClose, 1) }} return tls.Client(c, tlsConfig), nil }, } if err := ExportHttp2ConfigureTransport(tr); err != nil { t.Fatal(err) } defer tr.CloseIdleConnections() c := &Client{Transport: tr} const N = 10 gotBody := make(chan string, N) var wg sync.WaitGroup for i := 0; i < N; i++ { wg.Add(1) go func() { defer wg.Done() resp, err := c.Get(cst.ts.URL) if err != nil { t.Errorf("Get: %v", err) return } defer resp.Body.Close() slurp, err := ioutil.ReadAll(resp.Body) if err != nil { t.Error(err) } gotBody <- string(slurp) }() } wg.Wait() close(gotBody) var last string for got := range gotBody { if last == "" { last = got continue } if got != last { t.Errorf("Response body changed: %q -> %q", last, got) } } var open, close int32 for i := 0; i < 150; i++ { open, close = atomic.LoadInt32(&numOpen), atomic.LoadInt32(&numClose) if open < 1 { t.Fatalf("open = %d; want at least", open) } if close == open-1 { // Success return } time.Sleep(10 * time.Millisecond) } t.Errorf("%d connections opened, %d closed; want %d to close", open, close, open-1) }
explode_data.jsonl/4779
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 793 }
[ 2830, 3393, 27560, 23477, 2347, 1806, 40817, 1109, 4412, 1155, 353, 8840, 836, 8, 341, 16867, 1283, 2271, 1155, 340, 1444, 267, 1669, 501, 2959, 5475, 2271, 1155, 11, 305, 17, 3636, 11, 19954, 9626, 18552, 3622, 5949, 6492, 11, 435, 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 TestInt32_Intersection(t *testing.T) { testcases := []struct { name string s Int32 t Int32 expect []int32 }{ { name: "test Int32 Intersection, s is empty", s: Int32{}, t: map[int32]struct{}{2: {}, 9: {}, 4: {}}, expect: []int32{}, }, { name: "test Int32 Intersection, s is empty", s: map[int32]struct{}{2: {}, 9: {}, 4: {}}, t: Int32{}, expect: []int32{}, }, { name: "test Int32 Intersection, s ⊂ s", s: map[int32]struct{}{2: {}, 9: {}}, t: map[int32]struct{}{2: {}, 9: {}, 4: {}}, expect: []int32{2, 9}, }, { name: "test Int32 Intersection, s ⊃ s", s: map[int32]struct{}{2: {}, 9: {}, 4: {}}, t: map[int32]struct{}{2: {}, 9: {}}, expect: []int32{2, 9}, }, { name: "test Int32 Intersection, s = s", s: map[int32]struct{}{2: {}, 9: {}, 4: {}}, t: map[int32]struct{}{2: {}, 9: {}, 4: {}}, expect: []int32{2, 9, 4}, }, { name: "test Int32 Intersection, s ∩ s = Ø", s: map[int32]struct{}{1: {}, 4: {}}, t: map[int32]struct{}{2: {}, 6: {}}, expect: []int32{}, }, { name: "test Int32 Intersection, s ∩ s ≠ Ø", s: map[int32]struct{}{1: {}, 4: {}}, t: map[int32]struct{}{1: {}, 6: {}}, expect: []int32{1}, }, } for _, tc := range testcases { t.Logf("running scenario: %s", tc.name) actual := tc.s.Intersection(tc.t) validateInt32(t, actual, tc.expect) } }
explode_data.jsonl/62333
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 809 }
[ 2830, 3393, 1072, 18, 17, 62, 72927, 1155, 353, 8840, 836, 8, 341, 18185, 23910, 1669, 3056, 1235, 341, 197, 11609, 256, 914, 198, 197, 1903, 414, 1333, 18, 17, 198, 197, 3244, 414, 1333, 18, 17, 198, 197, 24952, 3056, 396, 18, 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 TestLogs_error_log_v1beta1(t *testing.T) { var ( pipelineName = "errlogs-pipeline" prName = "errlogs-run" ns = "namespace" taskName = "errlogs-task" errMsg = "Pipeline tektoncd/errlog-pipeline can't be Run; it contains Tasks that don't exist: Couldn't retrieve Task errlog-tasks: task.tekton.dev errlog-tasks not found" ) nsList := []*corev1.Namespace{ { ObjectMeta: metav1.ObjectMeta{ Name: ns, }, }, } ts := []*v1beta1.Task{ { ObjectMeta: metav1.ObjectMeta{ Namespace: ns, Name: taskName, }, }, } prs := []*v1beta1.PipelineRun{ { ObjectMeta: metav1.ObjectMeta{ Name: prName, Namespace: ns, Labels: map[string]string{"tekton.dev/pipeline": prName}, }, Spec: v1beta1.PipelineRunSpec{ PipelineRef: &v1beta1.PipelineRef{ Name: pipelineName, }, }, Status: v1beta1.PipelineRunStatus{ Status: duckv1beta1.Status{ Conditions: duckv1beta1.Conditions{ { Status: corev1.ConditionFalse, Message: errMsg, }, }, }, }, }, } ps := []*v1beta1.Pipeline{ { ObjectMeta: metav1.ObjectMeta{ Name: pipelineName, Namespace: ns, }, Spec: v1beta1.PipelineSpec{ Tasks: []v1beta1.PipelineTask{ { Name: taskName, TaskRef: &v1beta1.TaskRef{ Name: taskName, }, }, }, }, }, } cs, _ := test.SeedV1beta1TestData(t, pipelinev1beta1test.Data{PipelineRuns: prs, Pipelines: ps, Tasks: ts, Namespaces: nsList}) cs.Pipeline.Resources = cb.APIResourceList(versionB1, []string{"task", "pipeline", "pipelinerun"}) tdc := testDynamic.Options{} dc, err := tdc.Client( cb.UnstructuredV1beta1T(ts[0], versionB1), cb.UnstructuredV1beta1P(ps[0], versionB1), cb.UnstructuredV1beta1PR(prs[0], versionB1), ) if err != nil { t.Errorf("unable to create dynamic client: %v", err) } prlo := logOptsv1beta1(prName, ns, cs, dc, fake.Streamer([]fake.Log{}), false, false) output, err := fetchLogs(prlo) if err != nil { t.Errorf("Unexpected error: %v", err) } test.AssertOutput(t, errMsg+"\n", output) }
explode_data.jsonl/14870
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1057 }
[ 2830, 3393, 51053, 4096, 5224, 2273, 16, 19127, 16, 1155, 353, 8840, 836, 8, 341, 2405, 2399, 197, 3223, 8790, 675, 284, 330, 615, 22081, 2268, 8790, 698, 197, 25653, 675, 981, 284, 330, 615, 22081, 22973, 698, 197, 84041, 1843, 284, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestExpr_eval_with_env(t *testing.T) { _, err := expr.Eval("true", expr.Env(map[string]interface{}{})) assert.Error(t, err) assert.Contains(t, err.Error(), "misused") }
explode_data.jsonl/36903
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 74 }
[ 2830, 3393, 16041, 21296, 6615, 15879, 1155, 353, 8840, 836, 8, 341, 197, 6878, 1848, 1669, 15169, 5142, 831, 445, 1866, 497, 15169, 81214, 9147, 14032, 31344, 6257, 6257, 1171, 6948, 6141, 1155, 11, 1848, 340, 6948, 11545, 1155, 11, 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
func TestInsert(t *testing.T) { s := New() cmp := CompareBytes buf := s.MakeBuf() defer s.FreeBuf(buf) for i := 0; i < 2000; i++ { s.Insert(NewByteKeyItem([]byte(fmt.Sprintf("%010d", i))), cmp, buf, &s.Stats) } for i := 1750; i < 2000; i++ { s.Delete(NewByteKeyItem([]byte(fmt.Sprintf("%010d", i))), cmp, buf, &s.Stats) } itr := s.NewIterator(cmp, buf) count := 0 itr.SeekFirst() itr.Seek(NewByteKeyItem([]byte(fmt.Sprintf("%010d", 1500)))) for ; itr.Valid(); itr.Next() { expected := fmt.Sprintf("%010d", count+1500) got := string(*(*byteKeyItem)(itr.Get())) count++ if got != expected { t.Errorf("Expected %s, got %v", expected, got) } } if count != 250 { t.Errorf("Expected count = 250, got %v", count) } }
explode_data.jsonl/32466
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 337 }
[ 2830, 3393, 13780, 1155, 353, 8840, 836, 8, 341, 1903, 1669, 1532, 741, 1444, 1307, 1669, 23768, 7078, 198, 26398, 1669, 274, 50133, 15064, 741, 16867, 274, 52229, 15064, 10731, 692, 2023, 600, 1669, 220, 15, 26, 600, 366, 220, 17, 15...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
6
func TestProjectJsonMultiVersion(t *testing.T) { bp := ` rust_library { name: "liba1", srcs: ["a1/src/lib.rs"], crate_name: "a" } rust_library { name: "liba2", srcs: ["a2/src/lib.rs"], crate_name: "a", } rust_library { name: "libb", srcs: ["b/src/lib.rs"], crate_name: "b", rustlibs: ["liba1", "liba2"], } ` jsonContent := testProjectJson(t, bp) crates := validateJsonCrates(t, jsonContent) for _, c := range crates { crate := validateCrate(t, c) rootModule, ok := crate["root_module"].(string) if !ok { t.Fatalf("Unexpected type for root_module: %v", crate["root_module"]) } // Make sure that b has 2 different dependencies. if rootModule == "b/src/lib.rs" { aCount := 0 deps := validateDependencies(t, crate) for _, depName := range deps { if depName == "a" { aCount++ } } if aCount != 2 { t.Errorf("Unexpected number of liba dependencies want %v, got %v: %v", 2, aCount, deps) } return } } t.Errorf("libb crate has not been found: %v", crates) }
explode_data.jsonl/25966
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 473 }
[ 2830, 3393, 7849, 5014, 20358, 5637, 1155, 353, 8840, 836, 8, 341, 2233, 79, 1669, 22074, 7000, 590, 39461, 341, 197, 11609, 25, 330, 2740, 64, 16, 756, 197, 41144, 82, 25, 4383, 64, 16, 13437, 8194, 25638, 8097, 197, 1444, 7698, 12...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
7
func TestTLSPoolReconnect(t *testing.T) { u, err := AddressToUpstream("tls://one.one.one.one", Options{Bootstrap: []string{"8.8.8.8:53"}, Timeout: timeout}) if err != nil { t.Fatalf("cannot create upstream: %s", err) } // Send the first test message req := createTestMessage() reply, err := u.Exchange(req) if err != nil { t.Fatalf("first DNS message failed: %s", err) } assertResponse(t, reply) // Now let's close the pooled connection and return it back to the pool p := u.(*dnsOverTLS) conn, _ := p.pool.Get() conn.Close() p.pool.Put(conn) // Send the second test message req = createTestMessage() reply, err = u.Exchange(req) if err != nil { t.Fatalf("second DNS message failed: %s", err) } assertResponse(t, reply) // Now assert that the number of connections in the pool is not changed if len(p.pool.conns) != 1 { t.Fatal("wrong number of pooled connections") } }
explode_data.jsonl/19771
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 329 }
[ 2830, 3393, 13470, 4592, 1749, 693, 6459, 1155, 353, 8840, 836, 8, 341, 10676, 11, 1848, 1669, 9177, 1249, 2324, 4027, 445, 34488, 1110, 603, 30973, 30973, 30973, 497, 14566, 90, 45511, 25, 3056, 917, 4913, 23, 13, 23, 13, 23, 13, 2...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
5
func TestWithdrawFiat(t *testing.T) { h.SetDefaults() TestSetup(t) if areTestAPIKeysSet() && !canManipulateRealOrders { t.Skip("API keys set, canManipulateRealOrders false, skipping test") } var withdrawFiatRequest = exchange.WithdrawRequest{} _, err := h.WithdrawFiatFunds(&withdrawFiatRequest) if err != common.ErrFunctionNotSupported { t.Errorf("Expected '%v', received: '%v'", common.ErrFunctionNotSupported, err) } }
explode_data.jsonl/24353
{ "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, 92261, 37, 10358, 1155, 353, 8840, 836, 8, 341, 9598, 4202, 16273, 741, 73866, 21821, 1155, 692, 743, 525, 2271, 7082, 8850, 1649, 368, 1009, 753, 4814, 92876, 6334, 12768, 24898, 341, 197, 3244, 57776, 445, 7082, 6894, 738,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestRetryPolicySuccess(t *testing.T) { srv, close := mock.NewServer() defer close() srv.SetResponse(mock.WithStatusCode(http.StatusOK)) pl := NewPipeline(srv, NewRetryPolicy(nil)) req, err := NewRequest(context.Background(), http.MethodGet, srv.URL()) if err != nil { t.Fatalf("unexpected error: %v", err) } body := newRewindTrackingBody("stuff") if err := req.SetBody(body, "text/plain"); err != nil { t.Fatal(err) } resp, err := pl.Do(req) if err != nil { t.Fatalf("unexpected error: %v", err) } if resp.StatusCode != http.StatusOK { t.Fatalf("unexpected status code: %d", resp.StatusCode) } if body.rcount > 0 { t.Fatalf("unexpected rewind count: %d", body.rcount) } if !body.closed { t.Fatal("request body wasn't closed") } }
explode_data.jsonl/24376
{ "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, 51560, 13825, 7188, 1155, 353, 8840, 836, 8, 341, 1903, 10553, 11, 3265, 1669, 7860, 7121, 5475, 741, 16867, 3265, 741, 1903, 10553, 4202, 2582, 30389, 26124, 15872, 19886, 52989, 1171, 72213, 1669, 1532, 34656, 1141, 10553, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestFindAVPWithVendor(t *testing.T) { var nokiaXML = `<?xml version="1.0" encoding="UTF-8"?> <diameter> <application id="4"> <vendor id="94" name="Nokia" /> <avp name="Session-Start-Indicator" code="5105" must="V" may="P,M" must-not="-" may-encrypt="N" vendor-id="94"> <data type="UTF8String" /> </avp> </application> </diameter>` Default.Load(bytes.NewReader([]byte(nokiaXML))) if _, err := Default.FindAVPWithVendor(4, 999, UndefinedVendorID); err == nil { t.Error("Should get not found") } if avp, err := Default.FindAVPWithVendor(4, "Session-Id", UndefinedVendorID); err != nil { t.Fatal(err) } else if avp.Code != 263 { t.Fatalf("Unexpected code %d for Session-Id AVP", avp.Code) } if avp, err := Default.FindAVPWithVendor(4, "Session-Start-Indicator", 94); err != nil { t.Fatal(err) } else if avp.Code != 5105 { t.Fatalf("Unexpected code %d for Session-Id AVP", avp.Code) } if avp, err := Default.FindAVPWithVendor(4, "Session-Start-Indicator", UndefinedVendorID); err != nil { t.Fatal(err) } else if avp.Code != 5105 { t.Fatalf("Unexpected code %d for Session-Id AVP", avp.Code) } if _, err := Default.FindAVPWithVendor(4, "Session-Start-Indicator", 0); err == nil { t.Error("Should get not found") } }
explode_data.jsonl/9071
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 522 }
[ 2830, 3393, 9885, 8093, 47, 2354, 44691, 1155, 353, 8840, 836, 8, 341, 2405, 308, 27552, 10609, 284, 1565, 1316, 6455, 2319, 428, 16, 13, 15, 1, 11170, 428, 8561, 12, 23, 85990, 90707, 36044, 397, 220, 366, 5132, 877, 428, 19, 881, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestFactorilTrailingZeros(t *testing.T) { tests := []IntergerTest{ {Name: "has Zero", Input: 4, Output: 0}, {Name: "has one", Input: 5, Output: 1}, //{Name:"has Two", Input:25, Output:2}, //{Name:"has Three", Input:25, Output:2}, } for _, test := range tests { result := FactorilTrailingZeros(test.Input) if result != test.Output { t.Fatalf("test %s failed.", test.Name) } } }
explode_data.jsonl/15032
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 164 }
[ 2830, 3393, 20661, 321, 1282, 14277, 57, 6264, 1155, 353, 8840, 836, 8, 1476, 78216, 1669, 3056, 3306, 1389, 2271, 4257, 197, 197, 63121, 25, 330, 4648, 18306, 497, 5571, 25, 220, 19, 11, 9258, 25, 220, 15, 1583, 197, 197, 63121, 25...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestService_GetCerts(t *testing.T) { testCases := []struct { kname string cname string data []byte getErr error sshErr error expectedErr error }{ { data: nil, getErr: sgerrors.ErrNotFound, expectedErr: sgerrors.ErrNotFound, }, { kname: "kube-name-1234", data: []byte(`{"name":"kube-name-1234", "sshUser": "root", "sshKey": ""}`), sshErr: ssh.ErrHostNotSpecified, expectedErr: ssh.ErrHostNotSpecified, }, } prefix := DefaultStoragePrefix for _, testCase := range testCases { m := new(testutils.MockStorage) m.On("Get", context.Background(), prefix, mock.Anything). Return(testCase.data, testCase.getErr) service := NewService(prefix, m, nil) _, err := service.GetCerts(context.Background(), testCase.kname, testCase.cname) if testCase.expectedErr != errors.Cause(err) { t.Errorf("Wrong error expected %v actual %v", testCase.expectedErr, err) return } } }
explode_data.jsonl/2006
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 451 }
[ 2830, 3393, 1860, 13614, 34, 15546, 1155, 353, 8840, 836, 8, 341, 18185, 37302, 1669, 3056, 1235, 341, 197, 16463, 606, 981, 914, 198, 197, 1444, 606, 981, 914, 198, 197, 8924, 286, 3056, 3782, 198, 197, 10366, 7747, 414, 1465, 198, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestNasTypeLocalTimeZoneGetSetTimeZone(t *testing.T) { a := nasType.NewLocalTimeZone(nasMessage.ConfigurationUpdateCommandLocalTimeZoneType) for _, table := range nasTypeLocalTimeZoneOctetTable { a.SetTimeZone(table.in) assert.Equal(t, table.out, a.GetTimeZone()) } }
explode_data.jsonl/63595
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 98 }
[ 2830, 3393, 45, 300, 929, 7319, 77786, 1949, 1649, 77786, 1155, 353, 8840, 836, 8, 341, 11323, 1669, 17141, 929, 7121, 7319, 77786, 1445, 300, 2052, 17334, 4289, 4062, 7319, 77786, 929, 340, 2023, 8358, 1965, 1669, 2088, 17141, 929, 731...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestSQLNullInt16(t *testing.T) { v1, v2 := int16(7676), int16(7676) doSQLTest(t, v1, v2, &NullInt16{Int16: v1, Valid: true}, &NullInt16{}) doSQLTest(t, nil, nil, &NullInt16{Valid: false}, &NullInt16{}) doSQLTest(t, nil, nil, &NullInt16{Valid: false}, &NullInt16{Valid: true}) }
explode_data.jsonl/56187
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 128 }
[ 2830, 3393, 6688, 3280, 1072, 16, 21, 1155, 353, 8840, 836, 8, 341, 5195, 16, 11, 348, 17, 1669, 526, 16, 21, 7, 22, 21, 22, 21, 701, 526, 16, 21, 7, 22, 21, 22, 21, 340, 19935, 6688, 2271, 1155, 11, 348, 16, 11, 348, 17, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestTLSConnection(t *testing.T) { client, err := NewClient(ClientOptions{ URL: serviceURLTLS, TLSTrustCertsFilePath: caCertsPath, }) assert.NoError(t, err) producer, err := client.CreateProducer(ProducerOptions{ Topic: newTopicName(), }) assert.NoError(t, err) assert.NotNil(t, producer) client.Close() }
explode_data.jsonl/69303
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 143 }
[ 2830, 3393, 45439, 4526, 1155, 353, 8840, 836, 8, 341, 25291, 11, 1848, 1669, 1532, 2959, 46851, 3798, 515, 197, 79055, 25, 4293, 2473, 3144, 45439, 345, 197, 10261, 43, 784, 35788, 34, 15546, 19090, 25, 2162, 34, 15546, 1820, 345, 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 TestKillStopTTLManager(t *testing.T) { // Test killing an idle pessimistic session stop its ttlManager. defer setLockTTL(300).restore() store, clean := createMockStoreAndSetup(t) defer clean() tk := testkit.NewTestKit(t, store) tk2 := testkit.NewTestKit(t, store) tk.MustExec("use test") tk2.MustExec("use test") tk.MustExec("drop table if exists test_kill") tk.MustExec("create table test_kill (id int primary key, c int)") tk.MustExec("insert test_kill values (1, 1)") tk.MustExec("begin pessimistic") tk2.MustExec("begin pessimistic") tk.MustQuery("select * from test_kill where id = 1 for update") sessVars := tk.Session().GetSessionVars() succ := atomic.CompareAndSwapUint32(&sessVars.Killed, 0, 1) require.True(t, succ) // This query should success rather than returning a ResolveLock error. tk2.MustExec("update test_kill set c = c + 1 where id = 1") succ = atomic.CompareAndSwapUint32(&sessVars.Killed, 1, 0) require.True(t, succ) tk.MustExec("rollback") tk2.MustExec("rollback") }
explode_data.jsonl/12465
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 366 }
[ 2830, 3393, 53734, 10674, 51, 13470, 2043, 1155, 353, 8840, 836, 8, 341, 197, 322, 3393, 13118, 458, 27647, 72523, 4532, 3797, 2936, 1181, 53932, 2043, 624, 16867, 738, 11989, 51, 13470, 7, 18, 15, 15, 568, 30804, 741, 57279, 11, 4240...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestInternalTables(t *testing.T) { if testing.Short() { t.Skip() } filter := &binlogdatapb.Filter{ FieldEventMode: binlogdatapb.Filter_BEST_EFFORT, Rules: []*binlogdatapb.Rule{{ Match: "/.*/", }}, } // Modeled after vttablet endtoend compatibility tests. execStatements(t, []string{ "create table vitess_test(id int, val varbinary(128), primary key(id))", "create table _1e275eef_3b20_11eb_a38f_04ed332e05c2_20201210204529_gho(id int, val varbinary(128), primary key(id))", "create table _vt_PURGE_1f9194b43b2011eb8a0104ed332e05c2_20201210194431(id int, val varbinary(128), primary key(id))", "create table _product_old(id int, val varbinary(128), primary key(id))", }) position := primaryPosition(t) execStatements(t, []string{ "insert into vitess_test values(1, 'abc')", "insert into _1e275eef_3b20_11eb_a38f_04ed332e05c2_20201210204529_gho values(1, 'abc')", "insert into _vt_PURGE_1f9194b43b2011eb8a0104ed332e05c2_20201210194431 values(1, 'abc')", "insert into _product_old values(1, 'abc')", }) defer execStatements(t, []string{ "drop table vitess_test", "drop table _1e275eef_3b20_11eb_a38f_04ed332e05c2_20201210204529_gho", "drop table _vt_PURGE_1f9194b43b2011eb8a0104ed332e05c2_20201210194431", "drop table _product_old", }) engine.se.Reload(context.Background()) testcases := []testcase{{ input: []string{ "insert into vitess_test values(2, 'abc')", }, // In this case, we don't have information about vitess_test since it was renamed to vitess_test_test. // information returned by binlog for val column == varchar (rather than varbinary). output: [][]string{{ `begin`, `type:FIELD field_event:{table_name:"vitess_test" fields:{name:"id" type:INT32 table:"vitess_test" org_table:"vitess_test" database:"vttest" org_name:"id" column_length:11 charset:63 column_type:"int(11)"} fields:{name:"val" type:VARBINARY table:"vitess_test" org_table:"vitess_test" database:"vttest" org_name:"val" column_length:128 charset:63 column_type:"varbinary(128)"}}`, `type:ROW row_event:{table_name:"vitess_test" row_changes:{after:{lengths:1 lengths:3 values:"1abc"}}}`, `gtid`, `commit`, }, {`begin`, `gtid`, `commit`}, {`begin`, `gtid`, `commit`}, {`begin`, `gtid`, `commit`}, // => inserts into the three internal comments { `begin`, `type:ROW row_event:{table_name:"vitess_test" row_changes:{after:{lengths:1 lengths:3 values:"2abc"}}}`, `gtid`, `commit`, }}, }} runCases(t, filter, testcases, position, nil) }
explode_data.jsonl/10420
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1039 }
[ 2830, 3393, 11569, 21670, 1155, 353, 8840, 836, 8, 341, 743, 7497, 55958, 368, 341, 197, 3244, 57776, 741, 197, 532, 50108, 1669, 609, 6863, 839, 93253, 65, 31696, 515, 197, 94478, 1556, 3636, 25, 9544, 839, 93253, 65, 31696, 1668, 51...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestValidate_NoCircularFragmentSpreads_SpreadingTwiceIsNotCircular(t *testing.T) { testutil.ExpectPassesRule(t, graphql.NoFragmentCyclesRule, ` fragment fragA on Dog { ...fragB, ...fragB } fragment fragB on Dog { name } `) }
explode_data.jsonl/30365
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 97 }
[ 2830, 3393, 17926, 36989, 82440, 9488, 6406, 30358, 1098, 79, 6154, 22816, 558, 3872, 2623, 82440, 1155, 353, 8840, 836, 8, 341, 18185, 1314, 81893, 12187, 288, 11337, 1155, 11, 48865, 16766, 9488, 34, 15805, 11337, 11, 22074, 414, 12289,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestDoPostRequest(t *testing.T) { testEnv := testutils.SetupTestEnv() defer testEnv.TearDownTestEnv() testEnv.Mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { w.Header().Add("Content-Type", "application/json") fmt.Fprint(w, "response") if r.Method != http.MethodPost { t.Errorf("got %s method, want POST", r.Method) } _, err := ioutil.ReadAll(r.Body) if err != nil { t.Errorf("unable to read the request body: %v", err) } }) endpoint := testEnv.Server.URL + "/" client := &selvpcclient.ServiceClient{ HTTPClient: &http.Client{}, Endpoint: endpoint, TokenID: "token", UserAgent: "agent", } requestBody, err := json.Marshal(&struct { ID string `json:"id"` }{ ID: "uuid", }) if err != nil { log.Fatalf("can't marshal JSON: %v", err) } ctx := context.Background() response, err := client.DoRequest(ctx, http.MethodPost, endpoint, bytes.NewReader(requestBody)) if err != nil { log.Fatalf("unexpected error: %v", err) } if response.Body == nil { log.Fatal("response body is empty") } if response.StatusCode != 200 { log.Fatalf("got %d response status, want 200", response.StatusCode) } }
explode_data.jsonl/62936
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 467 }
[ 2830, 3393, 5404, 4133, 1900, 1155, 353, 8840, 836, 8, 341, 18185, 14359, 1669, 1273, 6031, 39820, 2271, 14359, 741, 16867, 1273, 14359, 836, 682, 4454, 2271, 14359, 741, 18185, 14359, 1321, 2200, 63623, 35460, 2915, 3622, 1758, 37508, 11...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestParseV2TLV(t *testing.T) { for _, tc := range testCases { t.Run(tc.name, func(t *testing.T) { tlvs := checkTLVs(t, tc.name, tc.raw, tc.types) tc.valid(t, tc.name, tlvs) }) } }
explode_data.jsonl/45510
{ "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, 14463, 53, 17, 13470, 53, 1155, 353, 8840, 836, 8, 341, 2023, 8358, 17130, 1669, 2088, 1273, 37302, 341, 197, 3244, 16708, 44415, 2644, 11, 2915, 1155, 353, 8840, 836, 8, 341, 298, 3244, 75, 11562, 1669, 1779, 13470, 51737...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestGetPathProtection(t *testing.T) { testExt := "crt" perms := os.FileMode(0755) // Create our SimpleFileStore store := &SimpleFileStore{ baseDir: "/path/to/filestore/", fileExt: testExt, perms: perms, } // Should deny requests for paths outside the filestore if _, err := store.GetPath("../../etc/passwd"); err != ErrPathOutsideStore { t.Fatalf("expected ErrPathOutsideStore error from GetPath") } if _, err := store.GetPath("private/../../../etc/passwd"); err != ErrPathOutsideStore { t.Fatalf("expected ErrPathOutsideStore error from GetPath") } // Convoluted paths should work as long as they end up inside the store expected := "/path/to/filestore/filename.crt" result, err := store.GetPath("private/../../filestore/./filename") if err != nil { t.Fatalf("unexpected error from GetPath: %v", err) } if result != expected { t.Fatalf("Expecting: %s (got: %s)", expected, result) } // Repeat tests with a relative baseDir relStore := &SimpleFileStore{ baseDir: "relative/file/path", fileExt: testExt, perms: perms, } // Should deny requests for paths outside the filestore if _, err := relStore.GetPath("../../etc/passwd"); err != ErrPathOutsideStore { t.Fatalf("expected ErrPathOutsideStore error from GetPath") } if _, err := relStore.GetPath("private/../../../etc/passwd"); err != ErrPathOutsideStore { t.Fatalf("expected ErrPathOutsideStore error from GetPath") } // Convoluted paths should work as long as they end up inside the store expected = "relative/file/path/filename.crt" result, err = relStore.GetPath("private/../../path/./filename") if err != nil { t.Fatalf("unexpected error from GetPath: %v", err) } if result != expected { t.Fatalf("Expecting: %s (got: %s)", expected, result) } }
explode_data.jsonl/54578
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 611 }
[ 2830, 3393, 1949, 1820, 78998, 1155, 353, 8840, 836, 8, 341, 18185, 6756, 1669, 330, 66, 3342, 698, 197, 87772, 1669, 2643, 8576, 3636, 7, 15, 22, 20, 20, 692, 197, 322, 4230, 1039, 8993, 1703, 6093, 198, 57279, 1669, 609, 16374, 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...
9
func TestByteSubscriptions_linkSubset(t *testing.T) { tests := []struct { name string sub ByteSubscriptions want ByteSubscriptions }{ { "Subset linking test for ByteSubscriptions", ByteSubscriptions{ "0011": &PartialSubscription{0, "3", ByteSubscriptions{}}, "00110011": &PartialSubscription{0, "3-3", ByteSubscriptions{}}, "1111": &PartialSubscription{0, "15", ByteSubscriptions{}}, "00110000": &PartialSubscription{0, "3-0", ByteSubscriptions{}}, "001100110000": &PartialSubscription{0, "3-3-0", ByteSubscriptions{}}, }, ByteSubscriptions{ "0011": &PartialSubscription{0, "3", ByteSubscriptions{ "0000": &PartialSubscription{4, "3-0", ByteSubscriptions{}}, "0011": &PartialSubscription{4, "3-3", ByteSubscriptions{ "0000": &PartialSubscription{8, "3-3-0", ByteSubscriptions{}}, }}, }}, "1111": &PartialSubscription{0, "15", ByteSubscriptions{}}, }, }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { tt.sub.linkSubset() if tt.sub.Dump() != tt.want.Dump() { t.Errorf("ByteSubscriptions.linkSubset() -> \n%v, want \n%v", tt.sub.Dump(), tt.want.Dump()) } }) } }
explode_data.jsonl/38240
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 556 }
[ 2830, 3393, 7153, 3136, 29966, 7233, 70584, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 3056, 1235, 341, 197, 11609, 914, 198, 197, 28624, 220, 10906, 3136, 29966, 198, 197, 50780, 10906, 3136, 29966, 198, 197, 59403, 197, 197, 515, 298,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestNewWithLocation(t *testing.T) { scheduler := NewWithLocation(123, monitoring.NewRegistry(), tarawaTime()) assert.Equal(t, int64(123), scheduler.limit) assert.Equal(t, tarawaTime(), scheduler.location) }
explode_data.jsonl/68482
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 74 }
[ 2830, 3393, 3564, 2354, 4707, 1155, 353, 8840, 836, 8, 341, 1903, 15222, 1669, 1532, 2354, 4707, 7, 16, 17, 18, 11, 16558, 7121, 15603, 1507, 12183, 14077, 1462, 2398, 6948, 12808, 1155, 11, 526, 21, 19, 7, 16, 17, 18, 701, 28809, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestRetryRun(t *testing.T) { store, manager, runDetail := initWithOneTimeFailedRun(t) defer store.Close() actualRunDetail, err := manager.GetRun(runDetail.UUID) assert.Nil(t, err) assert.Contains(t, actualRunDetail.WorkflowRuntimeManifest, "Failed") err = manager.RetryRun(runDetail.UUID) assert.Nil(t, err) actualRunDetail, err = manager.GetRun(runDetail.UUID) assert.Nil(t, err) assert.Contains(t, actualRunDetail.WorkflowRuntimeManifest, "Running") }
explode_data.jsonl/77030
{ "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, 51560, 6727, 1155, 353, 8840, 836, 8, 341, 57279, 11, 6645, 11, 1598, 10649, 1669, 13864, 3966, 1462, 9408, 6727, 1155, 340, 16867, 3553, 10421, 2822, 88814, 6727, 10649, 11, 1848, 1669, 6645, 2234, 6727, 38772, 10649, 39636, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestUpdate(t *testing.T) { th.SetupHTTP() defer th.TeardownHTTP() HandleUpdateSuccessfully(t) actual, err := ports.Update(client.ServiceClient(), "5e56a480-f337-4985-8ca4-98546cb4fdae", ports.UpdateOpts{ Name: "ModifiedPort", }).Extract() th.AssertNoErr(t, err) th.CheckDeepEquals(t, &UpdateResponse, actual) }
explode_data.jsonl/73550
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 133 }
[ 2830, 3393, 4289, 1155, 353, 8840, 836, 8, 341, 70479, 39820, 9230, 741, 16867, 270, 94849, 37496, 9230, 741, 197, 6999, 4289, 35959, 1155, 692, 88814, 11, 1848, 1669, 20325, 16689, 12805, 13860, 2959, 1507, 330, 20, 68, 20, 21, 64, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestHasRemoteSuccess(t *testing.T) { testRepo := newTestRepo(t) defer testRepo.cleanup(t) err := testRepo.sut.AddRemote("test", "owner", "repo") require.Nil(t, err) remotes, err := testRepo.sut.Remotes() require.Nil(t, err) require.Len(t, remotes, 2) // The origin remote require.Equal(t, remotes[0].Name(), git.DefaultRemote) require.Len(t, remotes[0].URLs(), 1) require.Equal(t, remotes[0].URLs()[0], testRepo.dir) // Or via the API require.True(t, testRepo.sut.HasRemote("origin", testRepo.dir)) // The added test remote require.Equal(t, remotes[1].Name(), "test") require.Len(t, remotes[1].URLs(), 1) url := git.GetRepoURL("owner", "repo", true) require.Equal(t, remotes[1].URLs()[0], url) // Or via the API require.True(t, testRepo.sut.HasRemote("test", url)) }
explode_data.jsonl/14021
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 334 }
[ 2830, 3393, 10281, 24703, 7188, 1155, 353, 8840, 836, 8, 341, 18185, 25243, 1669, 501, 2271, 25243, 1155, 340, 16867, 1273, 25243, 87689, 1155, 692, 9859, 1669, 1273, 25243, 514, 332, 1904, 24703, 445, 1944, 497, 330, 8118, 497, 330, 23...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestClientTimeout(t *testing.T) { var defaultClientTimeout, defaultExtendedTimeout time.Duration defaultClientTimeout, clientTimeout = clientTimeout, time.Nanosecond defaultExtendedTimeout, extendedTimeout = extendedTimeout, time.Hour _, err := send("", false) if err == nil { t.Errorf(`send("", false) = (_, nil); want (_, !nil)`) } clientTimeout = time.Hour extendedTimeout = time.Nanosecond _, err = send("", true) if err == nil { t.Errorf(`send("", true) = (_, nil); want (_, !nil)`) } clientTimeout = defaultClientTimeout extendedTimeout = defaultExtendedTimeout }
explode_data.jsonl/22550
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 196 }
[ 2830, 3393, 2959, 7636, 1155, 353, 8840, 836, 8, 341, 2405, 1638, 2959, 7636, 11, 1638, 53190, 7636, 882, 33795, 198, 11940, 2959, 7636, 11, 2943, 7636, 284, 2943, 7636, 11, 882, 2067, 276, 960, 1297, 198, 11940, 53190, 7636, 11, 1157...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestPutToEmpty(t *testing.T) { t.Parallel() f := NewEtcdTestFixture(t) defer f.Cleanup() db, err := newEtcdBackend(f.BackendConfig()) require.NoError(t, err) apply := func(stm STM) error { stm.Put("123", "abc") return nil } err = RunSTM(db.cli, apply) require.NoError(t, err) require.Equal(t, "abc", f.Get("123")) }
explode_data.jsonl/24936
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 152 }
[ 2830, 3393, 19103, 1249, 3522, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 2822, 1166, 1669, 1532, 31860, 4385, 69356, 1155, 340, 16867, 282, 727, 60639, 2822, 20939, 11, 1848, 1669, 501, 31860, 4385, 29699, 955, 8864, 408, 2648, 2...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1