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 TestDecodeStore(t *testing.T) { cdc := app.MakeEncodingConfig().Marshaler dec := simulation.NewDecodeStore(cdc) testAttributeRecord := types.NewAttribute("test", "", types.AttributeType_Int, []byte{1}) kvPairs := kv.Pairs{ Pairs: []kv.Pair{ {Key: types.AttributeKeyPrefix, Value: cdc.MustMarshal(&testAttributeRecord)}, {Key: []byte{0x99}, Value: []byte{0x99}}, }, } tests := []struct { attribute string expectedLog string }{ {"Attribute Record", fmt.Sprintf("%v\n%v", testAttributeRecord, testAttributeRecord)}, {"other", ""}, } for i, tt := range tests { i, tt := i, tt t.Run(tt.attribute, func(t *testing.T) { switch i { case len(tests) - 1: require.Panics(t, func() { dec(kvPairs.Pairs[i], kvPairs.Pairs[i]) }, tt.attribute) default: require.Equal(t, tt.expectedLog, dec(kvPairs.Pairs[i], kvPairs.Pairs[i]), tt.attribute) } }) } }
explode_data.jsonl/44935
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 380 }
[ 2830, 3393, 32564, 6093, 1155, 353, 8840, 836, 8, 341, 1444, 7628, 1669, 906, 50133, 14690, 2648, 1005, 55438, 261, 198, 197, 8169, 1669, 19038, 7121, 32564, 6093, 1337, 7628, 692, 18185, 3907, 6471, 1669, 4494, 7121, 3907, 445, 1944, 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 TestFetchDepositHistory(t *testing.T) { t.Parallel() if !areTestAPIKeysSet() { t.Skip() } _, err := f.FetchDepositHistory(context.Background()) if err != nil { t.Error(err) } }
explode_data.jsonl/15181
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 82 }
[ 2830, 3393, 20714, 78982, 13424, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 741, 743, 753, 546, 2271, 7082, 8850, 1649, 368, 341, 197, 3244, 57776, 741, 197, 532, 197, 6878, 1848, 1669, 282, 78506, 78982, 13424, 5378, 19047, 2398,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestEdgeCaseRepos(t *testing.T) { opts := CheckOptions{} // repo where index is completely missing // => check and prune should fail t.Run("no-index", func(t *testing.T) { testEdgeCaseRepo(t, "repo-index-missing.tar.gz", opts, pruneDefaultOptions, false, false) }) // repo where an existing and used blob is missing from the index // => check and prune should fail t.Run("index-missing-blob", func(t *testing.T) { testEdgeCaseRepo(t, "repo-index-missing-blob.tar.gz", opts, pruneDefaultOptions, false, false) }) // repo where a blob is missing // => check and prune should fail t.Run("missing-data", func(t *testing.T) { testEdgeCaseRepo(t, "repo-data-missing.tar.gz", opts, pruneDefaultOptions, false, false) }) // repo where blobs which are not needed are missing or in invalid pack files // => check should fail and prune should repair this t.Run("missing-unused-data", func(t *testing.T) { testEdgeCaseRepo(t, "repo-unused-data-missing.tar.gz", opts, pruneDefaultOptions, false, true) }) // repo where data exists that is not referenced // => check and prune should fully work t.Run("unreferenced-data", func(t *testing.T) { testEdgeCaseRepo(t, "repo-unreferenced-data.tar.gz", opts, pruneDefaultOptions, true, true) }) // repo where an obsolete index still exists // => check and prune should fully work t.Run("obsolete-index", func(t *testing.T) { testEdgeCaseRepo(t, "repo-obsolete-index.tar.gz", opts, pruneDefaultOptions, true, true) }) // repo which contains mixed (data/tree) packs // => check and prune should fully work t.Run("mixed-packs", func(t *testing.T) { testEdgeCaseRepo(t, "repo-mixed.tar.gz", opts, pruneDefaultOptions, true, true) }) // repo which contains duplicate blobs // => checking for unused data should report an error and prune resolves the // situation opts = CheckOptions{ ReadData: true, CheckUnused: true, } t.Run("duplicates", func(t *testing.T) { testEdgeCaseRepo(t, "repo-duplicates.tar.gz", opts, pruneDefaultOptions, false, true) }) }
explode_data.jsonl/43571
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 723 }
[ 2830, 3393, 11656, 4207, 693, 966, 1155, 353, 8840, 836, 8, 341, 64734, 1669, 4248, 3798, 31483, 197, 322, 15867, 1380, 1922, 374, 6587, 7402, 198, 197, 322, 589, 1779, 323, 79526, 1265, 3690, 198, 3244, 16708, 445, 2152, 21492, 497, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestMinUInt8s(t *testing.T) { in := []uint8{2, 1, 3} out, err := Min(in) assert.NoError(t, err) assert.Equal(t, uint8(1), out) }
explode_data.jsonl/9590
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 68 }
[ 2830, 3393, 6217, 18777, 23, 82, 1155, 353, 8840, 836, 8, 341, 17430, 1669, 3056, 2496, 23, 90, 17, 11, 220, 16, 11, 220, 18, 532, 13967, 11, 1848, 1669, 3386, 5900, 340, 6948, 35699, 1155, 11, 1848, 340, 6948, 12808, 1155, 11, 26...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
func TestInsertFromSelectConflictRetryAutoID(t *testing.T) { store, clean := testkit.CreateMockStore(t) defer clean() tk := testkit.NewTestKit(t, store) tk.MustExec("use test") tk.MustExec("drop table if exists t;") tk.MustExec("create table t (id int not null auto_increment unique key, idx int unique key, c int);") tk.MustExec("create table src (a int);") concurrency := 2 var wg sync.WaitGroup var err []error wgCount := concurrency + 1 wg.Add(wgCount) err = make([]error, concurrency) for i := 0; i < concurrency; i++ { tk := testkit.NewTestKit(t, store) tk.MustExec("use test") go func(idx int) { for i := 0; i < 10; i++ { sql := fmt.Sprintf("insert into t(idx, c) select 1 as idx, 1 as c from src on duplicate key update c = %[1]d", i) _, e := tk.Exec(sql) if e != nil { err[idx] = e wg.Done() return } } wg.Done() }(i) } var insertErr error go func() { tk := testkit.NewTestKit(t, store) tk.MustExec("use test") for i := 0; i < 10; i++ { _, e := tk.Exec("insert into src values (null);") if e != nil { insertErr = e wg.Done() return } } wg.Done() }() wg.Wait() for _, e := range err { require.NoError(t, e) } require.NoError(t, insertErr) }
explode_data.jsonl/38150
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 562 }
[ 2830, 3393, 13780, 3830, 3379, 57974, 51560, 13253, 915, 1155, 353, 8840, 836, 8, 341, 57279, 11, 4240, 1669, 1273, 8226, 7251, 11571, 6093, 1155, 340, 16867, 4240, 2822, 3244, 74, 1669, 1273, 8226, 7121, 2271, 7695, 1155, 11, 3553, 340...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestBindObjectCons(t *testing.T) { env := environment(map[string]interface{}{ "a": StringType, "b": NumberType, "c": BoolType, "d": NewOutputType(StringType), "e": NewOutputType(NumberType), "f": NewOutputType(BoolType), "g": NewPromiseType(StringType), "h": NewPromiseType(NumberType), "i": NewPromiseType(BoolType), }) scope := env.scope() ot := NewObjectType(map[string]Type{"foo": StringType, "0": NumberType, "false": BoolType}) mt := NewMapType(StringType) cases := []exprTestCase{ // Standard operations {x: `{"foo": "oof", 0: 42, false: true}`, t: ot}, {x: `{(a): a, (b): b, (c): c}`, t: mt}, // Lifted operations {x: `{(d): a, (b): b, (c): c}`, t: NewOutputType(mt)}, {x: `{(a): a, (e): b, (c): c}`, t: NewOutputType(mt)}, {x: `{(a): a, (b): b, (f): c}`, t: NewOutputType(mt)}, {x: `{(g): a, (b): b, (c): c}`, t: NewPromiseType(mt)}, {x: `{(a): a, (h): b, (c): c}`, t: NewPromiseType(mt)}, {x: `{(a): a, (b): b, (i): c}`, t: NewPromiseType(mt)}, } for _, c := range cases { t.Run(c.x, func(t *testing.T) { expr, diags := BindExpressionText(c.x, scope, hcl.Pos{}) assert.Len(t, diags, 0) assert.Equal(t, c.t, expr.Type()) _, ok := expr.(*ObjectConsExpression) assert.True(t, ok) assert.Equal(t, c.x, fmt.Sprintf("%v", expr)) }) } }
explode_data.jsonl/42568
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 623 }
[ 2830, 3393, 9950, 1190, 15220, 1155, 353, 8840, 836, 8, 341, 57538, 1669, 4573, 9147, 14032, 31344, 67066, 197, 197, 56693, 788, 93635, 345, 197, 197, 1, 65, 788, 5624, 929, 345, 197, 197, 96946, 788, 12608, 929, 345, 197, 197, 44917,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestVerifyChallengeTxSigners_doesVerifyHomeDomainFailure(t *testing.T) { serverKP := newKeypair0() clientKP := newKeypair1() txSource := NewSimpleAccount(serverKP.Address(), -1) op := ManageData{ SourceAccount: clientKP.Address(), Name: "testanchor.stellar.org auth", Value: []byte(base64.StdEncoding.EncodeToString(make([]byte, 48))), } webAuthDomainOp := ManageData{ SourceAccount: serverKP.Address(), Name: "web_auth_domain", Value: []byte("testwebauth.stellar.org"), } tx64, err := newSignedTransaction( TransactionParams{ SourceAccount: &txSource, IncrementSequenceNum: true, Operations: []Operation{&op, &webAuthDomainOp}, BaseFee: MinBaseFee, Timebounds: NewTimeout(1000), }, network.TestNetworkPassphrase, serverKP, clientKP, ) assert.NoError(t, err) _, err = VerifyChallengeTxSigners(tx64, serverKP.Address(), network.TestNetworkPassphrase, "testwebauth.stellar.org", []string{"validation failed"}, clientKP.Address()) assert.EqualError(t, err, "operation key does not match any homeDomains passed (key=\"testanchor.stellar.org auth\", homeDomains=[validation failed])") }
explode_data.jsonl/20760
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 484 }
[ 2830, 3393, 32627, 62078, 31584, 7264, 388, 96374, 32627, 7623, 13636, 17507, 1155, 353, 8840, 836, 8, 341, 41057, 65036, 1669, 501, 6608, 1082, 1310, 15, 741, 25291, 65036, 1669, 501, 6608, 1082, 1310, 16, 741, 46237, 3608, 1669, 1532, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestImageScale(t *testing.T) { for _, scale := range []int{2, 3, 4} { img0, _, err := openEbitenImage() if err != nil { t.Fatal(err) return } w, h := img0.Size() img1, err := NewImage(w*scale, h*scale, FilterNearest) if err != nil { t.Fatal(err) return } op := &DrawImageOptions{} op.GeoM.Scale(float64(scale), float64(scale)) if err := img1.DrawImage(img0, op); err != nil { t.Fatal(err) return } for j := 0; j < h*scale; j++ { for i := 0; i < w*scale; i++ { c0 := img0.At(i/scale, j/scale).(color.RGBA) c1 := img1.At(i, j).(color.RGBA) if c0 != c1 { t.Fatalf("img0.At(%[1]d, %[2]d) should equal to img1.At(%[3]d, %[4]d) (with scale %[5]d) but not: %[6]v vs %[7]v", i/2, j/2, i, j, scale, c0, c1) } } } } }
explode_data.jsonl/10889
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 419 }
[ 2830, 3393, 1906, 6947, 1155, 353, 8840, 836, 8, 341, 2023, 8358, 5452, 1669, 2088, 3056, 396, 90, 17, 11, 220, 18, 11, 220, 19, 92, 341, 197, 39162, 15, 11, 8358, 1848, 1669, 1787, 36, 4489, 268, 1906, 741, 197, 743, 1848, 961, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
8
func Test_validPort(t *testing.T) { assert := assert.New(t) var tests = []struct { input int expected bool }{ {8080, true}, {1, true}, {0, false}, {-8080, false}, {65535, false}, {65536, false}, } for _, test := range tests { assert.Equal(validPort(test.input), test.expected, "input: %d", test.input) } }
explode_data.jsonl/70479
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 148 }
[ 2830, 3393, 8337, 7084, 1155, 353, 8840, 836, 8, 341, 6948, 1669, 2060, 7121, 1155, 692, 2405, 7032, 284, 3056, 1235, 341, 197, 22427, 262, 526, 198, 197, 42400, 1807, 198, 197, 59403, 197, 197, 90, 23, 15, 23, 15, 11, 830, 1583, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestDeliveryServiceServers(t *testing.T) { WithObjs(t, []TCObj{CDNs, Types, Tenants, Parameters, Profiles, Statuses, Divisions, Regions, PhysLocations, CacheGroups, Servers, Topologies, DeliveryServices}, func() { DeleteTestDeliveryServiceServers(t) AssignServersToTopologyBasedDeliveryService(t) AssignOriginsToTopologyBasedDeliveryServices(t) TryToRemoveLastServerInDeliveryService(t) AssignServersToNonTopologyBasedDeliveryServiceThatUsesMidTier(t) GetTestDSSIMS(t) }) }
explode_data.jsonl/30816
{ "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, 38121, 1860, 78139, 1155, 353, 8840, 836, 8, 341, 197, 2354, 4121, 2519, 1155, 11, 3056, 7749, 5261, 90, 6484, 47360, 11, 20768, 11, 17695, 1783, 11, 13522, 11, 71727, 11, 8104, 288, 11, 8765, 6805, 11, 77347, 11, 12809, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestGetSSGenVersion(t *testing.T) { var ssgen = ssgenMsgTx.Copy() missingVersion := uint32(stake.VoteConsensusVersionAbsent) version := stake.SSGenVersion(ssgen) if version != missingVersion { t.Errorf("Error thrown on TestGetSSGenVersion: Looking for "+ "version % x, got version % x", missingVersion, version) } vbBytes := []byte{0x01, 0x00, 0x01, 0xef, 0xcd, 0xab} expectedVersion := uint32(0xabcdef01) pkScript, err := txscript.GenerateProvablyPruneableOut(vbBytes) if err != nil { t.Errorf("GenerateProvablyPruneableOut error %v", err) } ssgen.TxOut[1].PkScript = pkScript version = stake.SSGenVersion(ssgen) if version != expectedVersion { t.Errorf("Error thrown on TestGetSSGenVersion: Looking for "+ "version % x, got version % x", expectedVersion, version) } }
explode_data.jsonl/70515
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 293 }
[ 2830, 3393, 1949, 1220, 9967, 5637, 1155, 353, 8840, 836, 8, 341, 2405, 274, 1991, 268, 284, 274, 1991, 268, 6611, 31584, 31770, 2822, 197, 30616, 5637, 1669, 2622, 18, 17, 5895, 726, 5058, 1272, 15220, 13626, 5637, 80251, 340, 74954, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestBasic(t *testing.T) { countFn := makeCountHandler("session", New(newDB(), []byte("secret"))) r1 := req(countFn, nil) match(t, r1, 200, "1") r2 := req(countFn, parseCookies(r1.Header().Get("Set-Cookie"))["session"]) match(t, r2, 200, "2") }
explode_data.jsonl/71330
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 108 }
[ 2830, 3393, 15944, 1155, 353, 8840, 836, 8, 341, 18032, 24911, 1669, 1281, 2507, 3050, 445, 5920, 497, 1532, 1755, 3506, 1507, 3056, 3782, 445, 20474, 29836, 7000, 16, 1669, 4232, 11512, 24911, 11, 2092, 340, 47706, 1155, 11, 435, 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 TestExportGateway(t *testing.T) { t.Run("converts a da gateway with basic information and capability list", func(t *testing.T) { mgwOne := mocks.Gateway{} defer mgwOne.AssertExpectations(t) mgwOne.On("Self").Return(da.BaseDevice{ DeviceIdentifier: SimpleIdentifier{id: "self"}, }) capOne := da.Capability(1) mockCapOne := mocks.BasicCapability{} defer mockCapOne.AssertExpectations(t) mockCapOne.On("Name").Return("capOne") capTwo := da.Capability(2) mockCapTwo := mocks.BasicCapability{} defer mockCapTwo.AssertExpectations(t) mockCapTwo.On("Name").Return("capTwo") mgwOne.On("Capabilities").Return([]da.Capability{capOne, capTwo}) mgwOne.On("Capability", capOne).Return(&mockCapOne) mgwOne.On("Capability", capTwo).Return(&mockCapTwo) expected := ExportedGateway{ Capabilities: []string{"capOne", "capTwo"}, SelfDevice: "self", } actual := ExportGateway(&mgwOne) assert.Equal(t, expected, actual) }) }
explode_data.jsonl/71146
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 381 }
[ 2830, 3393, 16894, 40709, 1155, 353, 8840, 836, 8, 341, 3244, 16708, 445, 14166, 82, 264, 2994, 28795, 448, 6770, 1995, 323, 22302, 1140, 497, 2915, 1155, 353, 8840, 836, 8, 341, 197, 2109, 54133, 3966, 1669, 68909, 1224, 12043, 16094, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestNCIPNetReserved(t *testing.T) { inputPath := "NCReservedIPNet.pem" expected := lint.Error out := test.TestLint("e_ext_nc_intersects_reserved_ip", inputPath) if out.Status != expected { t.Errorf("%s: expected %s, got %s", inputPath, expected, out.Status) } }
explode_data.jsonl/77521
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 108 }
[ 2830, 3393, 9949, 3298, 6954, 53003, 1155, 353, 8840, 836, 8, 341, 22427, 1820, 1669, 330, 9949, 53003, 3298, 6954, 49373, 698, 42400, 1669, 57920, 6141, 198, 13967, 1669, 1273, 8787, 47556, 445, 68, 9927, 52382, 15318, 54429, 74913, 1038...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestTLSClientCertsFromPem(t *testing.T) { clientTLSOverride := endpoint.MutualTLSConfig{} clientTLSOverride.Client.Cert.Path = "" clientTLSOverride.Client.Key.Path = "" clientTLSOverride.Client.Cert.Pem = `-----BEGIN CERTIFICATE----- MIIC5TCCAkagAwIBAgIUMYhiY5MS3jEmQ7Fz4X/e1Dx33J0wCgYIKoZIzj0EAwQw gYwxCzAJBgNVBAYTAkNBMRAwDgYDVQQIEwdPbnRhcmlvMRAwDgYDVQQHEwdUb3Jv bnRvMREwDwYDVQQKEwhsaW51eGN0bDEMMAoGA1UECxMDTGFiMTgwNgYDVQQDEy9s aW51eGN0bCBFQ0MgUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSAoTGFiKTAe Fw0xNzEyMDEyMTEzMDBaFw0xODEyMDEyMTEzMDBaMGMxCzAJBgNVBAYTAkNBMRAw DgYDVQQIEwdPbnRhcmlvMRAwDgYDVQQHEwdUb3JvbnRvMREwDwYDVQQKEwhsaW51 eGN0bDEMMAoGA1UECxMDTGFiMQ8wDQYDVQQDDAZzZGtfZ28wdjAQBgcqhkjOPQIB BgUrgQQAIgNiAAT6I1CGNrkchIAEmeJGo53XhDsoJwRiohBv2PotEEGuO6rMyaOu pulj2VOj+YtgWw4ZtU49g4Nv6rq1QlKwRYyMwwRJSAZHIUMhYZjcDi7YEOZ3Fs1h xKmIxR+TTR2vf9KjgZAwgY0wDgYDVR0PAQH/BAQDAgWgMBMGA1UdJQQMMAoGCCsG AQUFBwMCMAwGA1UdEwEB/wQCMAAwHQYDVR0OBBYEFDwS3xhpAWs81OVWvZt+iUNL z26DMB8GA1UdIwQYMBaAFLRasbknomawJKuQGiyKs/RzTCujMBgGA1UdEQQRMA+C DWZhYnJpY19zZGtfZ28wCgYIKoZIzj0EAwQDgYwAMIGIAkIAk1MxMogtMtNO0rM8 gw2rrxqbW67ulwmMQzp6EJbm/28T2pIoYWWyIwpzrquypI7BOuf8is5b7Jcgn9oz 7sdMTggCQgF7/8ZFl+wikAAPbciIL1I+LyCXKwXosdFL6KMT6/myYjsGNeeDeMbg 3YkZ9DhdH1tN4U/h+YulG/CkKOtUATtQxg== -----END CERTIFICATE-----` clientTLSOverride.Client.Key.Pem = `-----BEGIN EC PRIVATE KEY----- MIGkAgEBBDByldj7VTpqTQESGgJpR9PFW9b6YTTde2WN6/IiBo2nW+CIDmwQgmAl c/EOc9wmgu+gBwYFK4EEACKhZANiAAT6I1CGNrkchIAEmeJGo53XhDsoJwRiohBv 2PotEEGuO6rMyaOupulj2VOj+YtgWw4ZtU49g4Nv6rq1QlKwRYyMwwRJSAZHIUMh YZjcDi7YEOZ3Fs1hxKmIxR+TTR2vf9I= -----END EC PRIVATE KEY-----` backends, err := overrideClientTLSInBackend(configBackend, &clientTLSOverride) assert.Nil(t, err) config, err := ConfigFromBackend(backends...) assert.Nil(t, err) certs := config.TLSClientCerts() assert.Equal(t, 1, len(certs), "Expected only one tls cert struct") if reflect.DeepEqual(certs[0], tls.Certificate{}) { t.Fatal("Actual cert is empty") } }
explode_data.jsonl/34093
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1205 }
[ 2830, 3393, 45439, 2959, 34, 15546, 3830, 47, 336, 1155, 353, 8840, 836, 8, 1476, 25291, 45439, 2177, 1669, 14887, 1321, 332, 928, 45439, 2648, 31483, 25291, 45439, 2177, 11716, 727, 529, 17474, 284, 8389, 25291, 45439, 2177, 11716, 9610,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestWithdrawValidatorCommission(t *testing.T) { ctx, ak, keeper, _, _ := CreateTestInputDefault(t, false, 1000) valCommission := sdk.DecCoins{ sdk.NewDecCoinFromDec("mytoken", sdk.NewDec(5).Quo(sdk.NewDec(4))), sdk.NewDecCoinFromDec("stake", sdk.NewDec(3).Quo(sdk.NewDec(2))), } // set module account coins distrAcc := keeper.GetDistributionAccount(ctx) distrAcc.SetCoins(sdk.NewCoins( sdk.NewCoin("mytoken", sdk.NewInt(2)), sdk.NewCoin("stake", sdk.NewInt(2)), )) keeper.supplyKeeper.SetModuleAccount(ctx, distrAcc) // check initial balance balance := ak.GetAccount(ctx, sdk.AccAddress(valOpAddr3)).GetCoins() expTokens := sdk.TokensFromConsensusPower(1000) expCoins := sdk.NewCoins(sdk.NewCoin("stake", expTokens)) require.Equal(t, expCoins, balance) // set outstanding rewards keeper.SetValidatorOutstandingRewards(ctx, valOpAddr3, valCommission) // set commission keeper.SetValidatorAccumulatedCommission(ctx, valOpAddr3, valCommission) // withdraw commission keeper.WithdrawValidatorCommission(ctx, valOpAddr3) // check balance increase balance = ak.GetAccount(ctx, sdk.AccAddress(valOpAddr3)).GetCoins() require.Equal(t, sdk.NewCoins( sdk.NewCoin("mytoken", sdk.NewInt(1)), sdk.NewCoin("stake", expTokens.AddRaw(1)), ), balance) // check remainder remainder := keeper.GetValidatorAccumulatedCommission(ctx, valOpAddr3) require.Equal(t, sdk.DecCoins{ sdk.NewDecCoinFromDec("mytoken", sdk.NewDec(1).Quo(sdk.NewDec(4))), sdk.NewDecCoinFromDec("stake", sdk.NewDec(1).Quo(sdk.NewDec(2))), }, remainder) require.True(t, true) }
explode_data.jsonl/54423
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 619 }
[ 2830, 3393, 92261, 14256, 73750, 1155, 353, 8840, 836, 8, 341, 20985, 11, 17324, 11, 53416, 11, 8358, 716, 1669, 4230, 2271, 2505, 3675, 1155, 11, 895, 11, 220, 16, 15, 15, 15, 692, 19302, 73750, 1669, 45402, 22442, 69602, 515, 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 TestHashMapAddGet(t *testing.T) { hashMap := collections.NewHashMap() hashMap.Put("Hello", "World") v, _ := hashMap.Get("Hello") if v != "World" { t.Errorf("an error occured: v != World") } }
explode_data.jsonl/56483
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 82 }
[ 2830, 3393, 18497, 2212, 1949, 1155, 353, 8840, 836, 8, 220, 341, 50333, 2227, 1669, 15302, 7121, 18497, 741, 50333, 2227, 39825, 445, 9707, 497, 330, 10134, 5130, 5195, 11, 716, 1669, 67959, 2234, 445, 9707, 1138, 743, 348, 961, 330, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
2
func TestRun(t *testing.T) { tests := []struct { desc string ansibleAdhocCmd *AnsibleAdhocCmd prepareAssertFunc func(*AnsibleAdhocCmd) res string err error }{ { desc: "Testing run an adhoc command with a nil AnsibleAdhocCmd", ansibleAdhocCmd: nil, err: errors.New("(adhoc::Run)", "AnsibleAdhocCmd is nil"), }, { desc: "Testing run an adhoc command with unexisting binary file", ansibleAdhocCmd: &AnsibleAdhocCmd{ Binary: "unexisting", }, err: errors.New("(adhoc::Run)", "Binary file 'unexisting' does not exists", &execerrors.Error{Name: "unexisting", Err: goerrors.New("executable file not found in $PATH")}), }, { desc: "Testing run an adhoc command", ansibleAdhocCmd: &AnsibleAdhocCmd{ Binary: "ansible", Exec: execute.NewMockExecute(), Pattern: "all", Options: &AnsibleAdhocOptions{ Args: "args1 args2", AskVaultPassword: true, Background: 11, Check: true, Diff: true, ExtraVars: map[string]interface{}{ "extra": "var", }, ExtraVarsFile: []string{"@test/ansible/extra_vars.yml"}, Forks: "12", Inventory: "127.0.0.1,", Limit: "host", ListHosts: true, ModuleName: "ping", ModulePath: "/module/path", OneLine: true, PlaybookDir: "/playbook/dir", Poll: 13, SyntaxCheck: true, Tree: "/tree/log/output", VaultID: "vault-id", VaultPasswordFile: "vault-password-file", Verbose: true, Version: true, }, ConnectionOptions: &options.AnsibleConnectionOptions{ AskPass: true, Connection: "local", PrivateKey: "pk", SCPExtraArgs: "-o StrictHostKeyChecking=no", SFTPExtraArgs: "-o StrictHostKeyChecking=no", SSHCommonArgs: "-o StrictHostKeyChecking=no", Timeout: 10, User: "apenella", }, PrivilegeEscalationOptions: &options.AnsiblePrivilegeEscalationOptions{ Become: true, BecomeMethod: "sudo", BecomeUser: "apenella", AskBecomePass: true, }, StdoutCallback: "oneline", }, prepareAssertFunc: func(adhoc *AnsibleAdhocCmd) { adhoc.Exec.(*execute.MockExecute).On( "Execute", context.TODO(), []string{ "ansible", "all", "--args", "args1 args2", "--ask-vault-password", "--background", "11", "--check", "--diff", "--extra-vars", "{\"extra\":\"var\"}", "--extra-vars", "@test/ansible/extra_vars.yml", "--forks", "12", "--inventory", "127.0.0.1,", "--limit", "host", "--list-hosts", "--module-name", "ping", "--module-path", "/module/path", "--one-line", "--playbook-dir", "/playbook/dir", "--poll", "13", "--syntax-check", "--tree", "/tree/log/output", "--vault-id", "vault-id", "--vault-password-file", "vault-password-file", "-vvvv", "--version", "--ask-pass", "--connection", "local", "--private-key", "pk", "--scp-extra-args", "-o StrictHostKeyChecking=no", "--sftp-extra-args", "-o StrictHostKeyChecking=no", "--ssh-common-args", "-o StrictHostKeyChecking=no", "--timeout", "10", "--user", "apenella", "--ask-become-pass", "--become", "--become-method", "sudo", "--become-user", "apenella", }, mock.AnythingOfType("StdoutCallbackResultsFunc"), []execute.ExecuteOptions{}, ).Return(nil) }, }, } for _, test := range tests { t.Run(test.desc, func(t *testing.T) { t.Log(test.desc) if test.prepareAssertFunc != nil { test.prepareAssertFunc(test.ansibleAdhocCmd) } err := test.ansibleAdhocCmd.Run(context.TODO()) if err != nil && assert.Error(t, err) { assert.Equal(t, test.err, err) } else { test.ansibleAdhocCmd.Exec.(*execute.MockExecute).AssertExpectations(t) } }) } }
explode_data.jsonl/69685
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 2332 }
[ 2830, 3393, 6727, 1155, 353, 8840, 836, 8, 1476, 78216, 1669, 3056, 1235, 341, 197, 41653, 1060, 914, 198, 197, 43579, 1238, 2589, 88473, 15613, 256, 353, 69599, 1238, 2589, 88473, 15613, 198, 197, 197, 13609, 8534, 9626, 2915, 4071, 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 TestValidate_NoCircularFragmentSpreads_NoSpreadingItselfIndirectlyWithinInlineFragment(t *testing.T) { testutil.ExpectFailsRule(t, graphql.NoFragmentCyclesRule, ` fragment fragA on Pet { ... on Dog { ...fragB } } fragment fragB on Pet { ... on Dog { ...fragA } } `, []gqlerrors.FormattedError{ testutil.RuleError(`Cannot spread fragment "fragA" within itself via fragB.`, 4, 11, 9, 11), }) }
explode_data.jsonl/30374
{ "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, 17926, 36989, 82440, 9488, 6406, 30358, 36989, 6406, 6154, 2132, 721, 1425, 1226, 398, 41961, 25324, 9488, 1155, 353, 8840, 836, 8, 341, 18185, 1314, 81893, 37, 6209, 11337, 1155, 11, 48865, 16766, 9488, 34, 15805, 11337, 11, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestParsingFailure(test *testing.T) { parsingTests := []ParsingFailureTest{ ParsingFailureTest{ Name: "Invalid equality comparator", Input: "1 = 1", Expected: INVALID_TOKEN_KIND, }, ParsingFailureTest{ Name: "Invalid equality comparator", Input: "1 === 1", Expected: INVALID_TOKEN_KIND, }, ParsingFailureTest{ Name: "Too many characters for logical operator", Input: "true &&& false", Expected: INVALID_TOKEN_KIND, }, ParsingFailureTest{ Name: "Too many characters for logical operator", Input: "true ||| false", Expected: INVALID_TOKEN_KIND, }, ParsingFailureTest{ Name: "Premature end to expression, via modifier", Input: "10 > 5 +", Expected: UNEXPECTED_END, }, ParsingFailureTest{ Name: "Premature end to expression, via comparator", Input: "10 + 5 >", Expected: UNEXPECTED_END, }, ParsingFailureTest{ Name: "Premature end to expression, via logical operator", Input: "10 > 5 &&", Expected: UNEXPECTED_END, }, ParsingFailureTest{ Name: "Premature end to expression, via ternary operator", Input: "true ?", Expected: UNEXPECTED_END, }, ParsingFailureTest{ Name: "Hanging REQ", Input: "'wat' =~", Expected: UNEXPECTED_END, }, ParsingFailureTest{ Name: "Invalid operator change to REQ", Input: " / =~", Expected: INVALID_TOKEN_TRANSITION, }, ParsingFailureTest{ Name: "Invalid starting token, comparator", Input: "> 10", Expected: INVALID_TOKEN_TRANSITION, }, ParsingFailureTest{ Name: "Invalid starting token, modifier", Input: "+ 5", Expected: INVALID_TOKEN_TRANSITION, }, ParsingFailureTest{ Name: "Invalid starting token, logical operator", Input: "&& 5 < 10", Expected: INVALID_TOKEN_TRANSITION, }, ParsingFailureTest{ Name: "Invalid NUMERIC transition", Input: "10 10", Expected: INVALID_TOKEN_TRANSITION, }, ParsingFailureTest{ Name: "Invalid STRING transition", Input: "'foo' 'foo'", Expected: INVALID_TOKEN_TRANSITION, }, ParsingFailureTest{ Name: "Invalid operator transition", Input: "10 > < 10", Expected: INVALID_TOKEN_TRANSITION, }, ParsingFailureTest{ Name: "Starting with unbalanced parens", Input: " ) ( arg2", Expected: INVALID_TOKEN_TRANSITION, }, ParsingFailureTest{ Name: "Unclosed bracket", Input: "[foo bar", Expected: UNCLOSED_BRACKETS, }, ParsingFailureTest{ Name: "Unclosed quote", Input: "foo == 'responseTime", Expected: UNCLOSED_QUOTES, }, ParsingFailureTest{ Name: "Constant regex pattern fail to compile", Input: "foo =~ '[abc'", Expected: string(syntax.ErrMissingBracket), }, ParsingFailureTest{ Name: "Unbalanced parenthesis", Input: "10 > (1 + 50", Expected: UNBALANCED_PARENTHESIS, }, ParsingFailureTest{ Name: "Multiple radix", Input: "127.0.0.1", Expected: INVALID_NUMERIC, }, ParsingFailureTest{ Name: "Undefined function", Input: "foobar()", Expected: UNDEFINED_FUNCTION, }, ParsingFailureTest{ Name: "Hanging accessor", Input: "foo.Bar.", Expected: HANGING_ACCESSOR, }, ParsingFailureTest{ // this is expected to change once there are structtags in place that allow aliasing of fields Name: "Unexported parameter access", Input: "foo.bar", Expected: UNEXPORTED_ACCESSOR, }, ParsingFailureTest{ Name: "Incomplete Hex", Input: "0x", Expected: INVALID_TOKEN_TRANSITION, }, ParsingFailureTest{ Name: "Invalid Hex literal", Input: "0x > 0", Expected: INVALID_HEX, }, ParsingFailureTest{ Name: "Hex float (Unsupported)", Input: "0x1.1", Expected: INVALID_TOKEN_TRANSITION, }, ParsingFailureTest{ Name: "Hex invalid letter", Input: "0x12g1", Expected: INVALID_TOKEN_TRANSITION, }, } runParsingFailureTests(parsingTests, test) }
explode_data.jsonl/11625
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1857 }
[ 2830, 3393, 68839, 17507, 8623, 353, 8840, 836, 8, 1476, 3223, 28598, 18200, 1669, 3056, 68839, 17507, 2271, 4257, 197, 10025, 28598, 17507, 2271, 4257, 298, 21297, 25, 257, 330, 7928, 21777, 52040, 756, 298, 66588, 25, 262, 330, 16, 28...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestTypelinksSorted(t *testing.T) { var last string for i, n := range TypeLinks() { if n < last { t.Errorf("typelinks not sorted: %q [%d] > %q [%d]", last, i-1, n, i) } last = n } }
explode_data.jsonl/29614
{ "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, 12834, 301, 15504, 51051, 1155, 353, 8840, 836, 8, 341, 2405, 1537, 914, 198, 2023, 600, 11, 308, 1669, 2088, 3990, 24089, 368, 341, 197, 743, 308, 366, 1537, 341, 298, 3244, 13080, 445, 3653, 301, 15504, 537, 10615, 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 TestTransactionPayloadMatchJsonSchema(t *testing.T) { transactionProcSetup().PayloadAttrsMatchJsonSchema(t, transactionPayloadAttrsNotInJsonSchema(), tests.NewSet("transaction.context.user.email", "transaction.context.experimental")) }
explode_data.jsonl/65347
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 82 }
[ 2830, 3393, 8070, 29683, 8331, 5014, 8632, 1155, 353, 8840, 836, 8, 341, 197, 13528, 24508, 21821, 1005, 29683, 53671, 8331, 5014, 8632, 1155, 345, 197, 197, 13528, 29683, 53671, 2623, 641, 5014, 8632, 3148, 197, 78216, 7121, 1649, 445, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
func TestPacketDot11DataIP(t *testing.T) { p := gopacket.NewPacket(testPacketDot11DataIP, LinkTypeIEEE80211Radio, gopacket.Default) if p.ErrorLayer() != nil { t.Error("Failed to decode packet:", p.ErrorLayer().Error()) } checkLayers(p, []gopacket.LayerType{LayerTypeRadioTap, LayerTypeDot11, LayerTypeDot11Data, LayerTypeLLC, LayerTypeSNAP, LayerTypeIPv4, LayerTypeUDP, LayerTypeDHCPv4}, t) }
explode_data.jsonl/7566
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 153 }
[ 2830, 3393, 16679, 34207, 16, 16, 1043, 3298, 1155, 353, 8840, 836, 8, 341, 3223, 1669, 342, 453, 5709, 7121, 16679, 8623, 16679, 34207, 16, 16, 1043, 3298, 11, 5948, 929, 76705, 23, 15, 17, 16, 16, 28203, 11, 342, 453, 5709, 13275,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestReconcileSecurityGroupFromAnyDestinationAddressPrefixToLoadBalancerIP(t *testing.T) { az := getTestCloud() svc1 := getTestService("serviceea", v1.ProtocolTCP, 80) svc1.Spec.LoadBalancerIP = "192.168.0.0" sg := getTestSecurityGroup(az) // Simulate a pre-Kubernetes 1.8 NSG, where we do not specify the destination address prefix sg, err := az.reconcileSecurityGroup(testClusterName, &svc1, to.StringPtr(""), true) if err != nil { t.Errorf("Unexpected error: %q", err) } sg, err = az.reconcileSecurityGroup(testClusterName, &svc1, to.StringPtr(svc1.Spec.LoadBalancerIP), true) if err != nil { t.Errorf("Unexpected error: %q", err) } validateSecurityGroup(t, sg, svc1) }
explode_data.jsonl/50387
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 267 }
[ 2830, 3393, 693, 40446, 457, 15352, 2808, 3830, 8610, 33605, 4286, 14335, 1249, 5879, 93825, 3298, 1155, 353, 8840, 836, 8, 341, 197, 1370, 1669, 633, 2271, 16055, 741, 1903, 7362, 16, 1669, 633, 2271, 1860, 445, 7936, 12508, 497, 348, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestExpireat(t *testing.T) { s, err := Run() ok(t, err) defer s.Close() c, err := proto.Dial(s.Addr()) ok(t, err) defer c.Close() // Not volatile yet { equals(t, time.Duration(0), s.TTL("foo")) mustDo(t, c, "TTL", "foo", proto.Int(-2), ) } // Set something { mustOK(t, c, "SET", "foo", "bar") // Key exists, but no ttl set. mustDo(t, c, "TTL", "foo", proto.Int(-1), ) now := 1234567890 s.SetTime(time.Unix(int64(now), 0)) must1(t, c, "EXPIREAT", "foo", strconv.Itoa(now+100)) // EXPIREAT returns 1 on success. equals(t, 100*time.Second, s.TTL("foo")) equals(t, 100*time.Second, s.TTL("foo")) mustDo(t, c, "TTL", "foo", proto.Int(100)) } }
explode_data.jsonl/44810
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 350 }
[ 2830, 3393, 8033, 554, 266, 1155, 353, 8840, 836, 8, 341, 1903, 11, 1848, 1669, 6452, 741, 59268, 1155, 11, 1848, 340, 16867, 274, 10421, 741, 1444, 11, 1848, 1669, 18433, 98462, 1141, 93626, 2398, 59268, 1155, 11, 1848, 340, 16867, 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 TestIsMetric(t *testing.T) { ev := Event{ Event: map[string]interface{}{}, } assert.False(t, ev.IsMetric()) metric := Event{ Event: "metric", } assert.True(t, metric.IsMetric()) arr := Event{ Event: []interface{}{"foo", "bar"}, } assert.False(t, arr.IsMetric()) yo := Event{ Event: "yo", } assert.False(t, yo.IsMetric()) }
explode_data.jsonl/5171
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 153 }
[ 2830, 3393, 3872, 54310, 1155, 353, 8840, 836, 8, 341, 74837, 1669, 3665, 515, 197, 56055, 25, 2415, 14032, 31344, 6257, 38837, 197, 532, 6948, 50757, 1155, 11, 3637, 4506, 54310, 2398, 2109, 16340, 1669, 3665, 515, 197, 56055, 25, 330,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestDecodeSkin(t *testing.T) { cases := []struct { given string expect struct { id int err error } }{ { given: "[&CgQAAAA=]", expect: struct { id int err error }{ id: 4, }, }, } for _, c := range cases { result, err := DecodeSkin(c.given) if err != c.expect.err { t.Errorf("DecodeSkin returned an unexpected error: '%s'", err) } if result != c.expect.id { t.Errorf("DecodeSkin returned '%d' but '%d' was expected", result, c.expect.id) } } }
explode_data.jsonl/36256
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 243 }
[ 2830, 3393, 32564, 37186, 1155, 353, 8840, 836, 8, 341, 1444, 2264, 1669, 3056, 1235, 341, 197, 3174, 2071, 220, 914, 198, 197, 24952, 2036, 341, 298, 15710, 220, 526, 198, 298, 9859, 1465, 198, 197, 197, 532, 197, 59403, 197, 197, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
4
func TestWorkflowConditions_UpsertConditionMessage(t *testing.T) { wfCond := Conditions{Condition{Type: ConditionTypeCompleted, Message: "Hello"}} wfCond.UpsertConditionMessage(Condition{Type: ConditionTypeCompleted, Message: "world!"}) assert.Equal(t, "Hello, world!", wfCond[0].Message) }
explode_data.jsonl/26043
{ "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, 62768, 35435, 6665, 1690, 529, 10547, 2052, 1155, 353, 8840, 836, 8, 341, 6692, 69, 49696, 1669, 31834, 90, 10547, 90, 929, 25, 15180, 929, 22724, 11, 4856, 25, 330, 9707, 95642, 6692, 69, 49696, 5255, 1690, 529, 10547, 20...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestPrioritizeTags(t *testing.T) { tests := []struct { tags []string expected []string }{ { tags: []string{"other", "latest", "v5.5", "5.2.3", "v5.3.6-bother", "5.3.6-abba", "5.6"}, expected: []string{"latest", "5.6", "v5.5", "v5.3.6-bother", "5.3.6-abba", "5.2.3", "other"}, }, { tags: []string{"1.1-beta1", "1.2-rc1", "1.1-rc1", "1.1-beta2", "1.2-beta1", "1.2-alpha1", "1.2-beta4", "latest"}, expected: []string{"latest", "1.2-rc1", "1.2-beta4", "1.2-beta1", "1.2-alpha1", "1.1-rc1", "1.1-beta2", "1.1-beta1"}, }, } for i, tc := range tests { PrioritizeTags(tc.tags) if !reflect.DeepEqual(tc.tags, tc.expected) { t.Errorf("%d: unexpected order: %v", i, tc.tags) } } }
explode_data.jsonl/40836
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 380 }
[ 2830, 3393, 49471, 26310, 15930, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 3056, 1235, 341, 197, 3244, 2032, 257, 3056, 917, 198, 197, 42400, 3056, 917, 198, 197, 59403, 197, 197, 515, 298, 3244, 2032, 25, 257, 3056, 917, 4913, 1575,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestShouldUpdateApplicationConfigTerraformResourceStateFromModelWhenMatchSpecificationIsProvided(t *testing.T) { fullLabel := "prefix label suffix" applicationConfig := restapi.ApplicationConfig{ ID: applicationConfigID, Label: fullLabel, MatchSpecification: defaultMatchSpecificationModel, Scope: restapi.ApplicationConfigScopeIncludeNoDownstream, BoundaryScope: restapi.BoundaryScopeAll, } testHelper := NewTestHelper(t) sut := NewApplicationConfigResourceHandle() resourceData := testHelper.CreateEmptyResourceDataForResourceHandle(sut) err := sut.UpdateState(resourceData, &applicationConfig, testHelper.ResourceFormatter()) require.NoError(t, err) require.Equal(t, applicationConfigID, resourceData.Id()) require.Equal(t, defaultLabel, resourceData.Get(ApplicationConfigFieldLabel)) require.Equal(t, fullLabel, resourceData.Get(ApplicationConfigFieldFullLabel)) require.Equal(t, defaultNormalizedMatchSpecification, resourceData.Get(ApplicationConfigFieldMatchSpecification)) _, tagFilterSet := resourceData.GetOk(ApplicationConfigFieldTagFilter) require.False(t, tagFilterSet) require.Equal(t, string(restapi.ApplicationConfigScopeIncludeNoDownstream), resourceData.Get(ApplicationConfigFieldScope)) require.Equal(t, string(restapi.BoundaryScopeAll), resourceData.Get(ApplicationConfigFieldBoundaryScope)) }
explode_data.jsonl/64943
{ "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, 14996, 4289, 4988, 2648, 51, 13886, 627, 4783, 1397, 3830, 1712, 4498, 8331, 56139, 3872, 35819, 291, 1155, 353, 8840, 836, 8, 341, 94042, 2476, 1669, 330, 11849, 2383, 20525, 698, 197, 5132, 2648, 1669, 2732, 2068, 17521, 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 TestTemplateCaching(t *testing.T) { // Reset the template cache, to ensure size change. templateCache, _ = lru.New(10) const anotherTemplate = "{{.Namespace}}.{{.Name}}.{{.Domain}}.sad" actualConfig, err := NewConfigFromMap(map[string]string{ DomainTemplateKey: anotherTemplate, }) if err != nil { t.Fatal("Config parsing failure =", err) } if got, want := actualConfig.DomainTemplate, anotherTemplate; got != want { t.Errorf("DomainTemplate = %q, want: %q", got, want) } if got, want := templateCache.Len(), 2; got != want { t.Errorf("Cache size = %d, want = %d", got, want) } // Reset to default. And make sure it is cached. actualConfig, err = NewConfigFromMap(map[string]string{}) if err != nil { t.Fatal("Config parsing failure =", err) } if got, want := actualConfig.DomainTemplate, DefaultDomainTemplate; got != want { t.Errorf("DomainTemplate = %q, want: %q", got, want) } if got, want := templateCache.Len(), 3; got != want { t.Errorf("Cache size = %d, want = %d", got, want) } }
explode_data.jsonl/58825
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 363 }
[ 2830, 3393, 7275, 34, 11829, 1155, 353, 8840, 836, 8, 341, 197, 322, 16932, 279, 3811, 6500, 11, 311, 5978, 1379, 2297, 624, 22832, 8233, 11, 716, 284, 326, 2672, 7121, 7, 16, 15, 692, 4777, 2441, 7275, 284, 47219, 13, 22699, 3417, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestSizeRetentionMetric(t *testing.T) { cases := []struct { maxBytes int64 expMaxBytes int64 }{ {maxBytes: 1000, expMaxBytes: 1000}, {maxBytes: 0, expMaxBytes: 0}, {maxBytes: -1000, expMaxBytes: 0}, } for _, c := range cases { db, delete := openTestDB(t, &Options{ BlockRanges: []int64{100}, MaxBytes: c.maxBytes, }) actMaxBytes := int64(prom_testutil.ToFloat64(db.metrics.maxBytes)) testutil.Equals(t, actMaxBytes, c.expMaxBytes, "metric retention limit bytes mismatch") testutil.Ok(t, db.Close()) delete() } }
explode_data.jsonl/64379
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 231 }
[ 2830, 3393, 1695, 86329, 54310, 1155, 353, 8840, 836, 8, 341, 1444, 2264, 1669, 3056, 1235, 341, 197, 22543, 7078, 262, 526, 21, 19, 198, 197, 48558, 5974, 7078, 526, 21, 19, 198, 197, 59403, 197, 197, 90, 2810, 7078, 25, 220, 16, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestMSSQLQueryGetMeta(t *testing.T) { MSSQLQuery, ok := NewSqlserverSQLQuery(sMSSQLQuery) if ok != nil { t.Fail() } if len(MSSQLQuery.GetMeta()) == 0 { t.Fail() } }
explode_data.jsonl/22805
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 83 }
[ 2830, 3393, 44, 1220, 3588, 2859, 1949, 12175, 1155, 353, 8840, 836, 8, 341, 9209, 1220, 3588, 2859, 11, 5394, 1669, 1532, 8269, 4030, 6688, 2859, 1141, 44, 1220, 3588, 2859, 340, 743, 5394, 961, 2092, 341, 197, 3244, 57243, 741, 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 ]
3
func TestServiceResolversErr(t *testing.T) { expected := errors.New("mock") resolver := func(*broker.Context) (specs.ServiceList, error) { return nil, expected } ctx := logger.WithLogger(broker.NewBackground()) resolvers := ServiceResolvers{resolver} _, err := resolvers.Resolve(ctx) if err == nil { t.Fatal("unexpected pass") } if err != expected { t.Fatalf("unexpected error %s, expected %s", err, expected) } }
explode_data.jsonl/2208
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 160 }
[ 2830, 3393, 1860, 1061, 39435, 7747, 1155, 353, 8840, 836, 8, 341, 42400, 1669, 5975, 7121, 445, 16712, 1138, 10202, 7921, 1669, 2915, 4071, 69309, 9328, 8, 320, 94531, 13860, 852, 11, 1465, 8, 341, 197, 853, 2092, 11, 3601, 198, 197,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestBulkExistsBadResponse(t *testing.T) { ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { w.WriteHeader(http.StatusInternalServerError) })) defer ts.Close() client := &bundleManagerClientImpl{bundleManagerURL: ts.URL} _, err := client.Exists(context.Background(), []int{1, 2, 3, 4, 5}) if err == nil { t.Fatalf("unexpected nil error checking bulk exists") } }
explode_data.jsonl/21439
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 151 }
[ 2830, 3393, 88194, 15575, 17082, 2582, 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, 6692, 69794, 19886, 66760, 340, 197, 44194, 16867, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestPubackDecodeEncodeEquiv(t *testing.T) { msgBytes := []byte{ byte(PUBACK << 4), 2, 0, // packet ID MSB (0) 7, // packet ID LSB (7) } msg := NewPubackMessage() n, err := msg.Decode(msgBytes) require.NoError(t, err, "Error decoding message.") require.Equal(t, len(msgBytes), n, "Error decoding message.") dst := make([]byte, 100) n2, err := msg.Encode(dst) require.NoError(t, err, "Error decoding message.") require.Equal(t, len(msgBytes), n2, "Error decoding message.") require.Equal(t, msgBytes, dst[:n2], "Error decoding message.") n3, err := msg.Decode(dst) require.NoError(t, err, "Error decoding message.") require.Equal(t, len(msgBytes), n3, "Error decoding message.") }
explode_data.jsonl/23230
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 273 }
[ 2830, 3393, 29162, 473, 32564, 32535, 36, 15418, 1155, 353, 8840, 836, 8, 341, 21169, 7078, 1669, 3056, 3782, 515, 197, 31422, 5304, 4493, 4032, 1115, 220, 19, 1326, 197, 197, 17, 345, 197, 197, 15, 11, 442, 10151, 3034, 10292, 33, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestParseHeader(t *testing.T) { mandatorySize := binary.Size(mandatory{}) optionalSize := binary.Size(optional{}) sizeofHeader := mandatorySize + optionalSize for _, test := range []struct { flags testFlag offset int size int err error }{ {flags: flagGood, offset: 0, size: 8192, err: nil}, {flags: flagGood, offset: 2048, size: 8192, err: nil}, {flags: flagGood, offset: 8192 - sizeofHeader - 4, size: 8192, err: nil}, {flags: flagGood, offset: 8192 - sizeofHeader - 1, size: 8192, err: ErrHeaderNotFound}, {flags: flagGood, offset: 8192 - sizeofHeader, size: 8192, err: nil}, {flags: flagGood, offset: 8192 - 4, size: 8192, err: ErrHeaderNotFound}, {flags: flagGood, offset: 8192, size: 16384, err: ErrHeaderNotFound}, {flags: flagGood, offset: 0, size: 10, err: io.ErrUnexpectedEOF}, {flags: flagBad, offset: 0, size: 8192, err: ErrHeaderNotFound}, {flags: flagUnsupported, offset: 0, size: 8192, err: ErrFlagsNotSupported}, {flags: flagGood, offset: 8192 - mandatorySize, size: 8192, err: nil}, } { t.Run(fmt.Sprintf("flags:%v,off:%v,sz:%v,err:%v", test.flags, test.offset, test.size, test.err), func(t *testing.T) { want := createHeader(test.flags) r, err := createFile(&want, test.offset, test.size) if err != nil { t.Fatalf("Cannot create test file: %v", err) } got, err := parseHeader(r) if err != test.err { t.Fatalf("parseHeader() got error: %v, want: %v", err, test.err) } if err != nil { return } if test.size-test.offset > mandatorySize { if !reflect.DeepEqual(got, want) { t.Errorf("parseHeader() got %+v, want %+v", got, want) } } else { if !reflect.DeepEqual(got.mandatory, want.mandatory) { t.Errorf("parseHeader() got %+v, want %+v", got.mandatory, want.mandatory) } } }) } }
explode_data.jsonl/40517
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 743 }
[ 2830, 3393, 14463, 4047, 1155, 353, 8840, 836, 8, 341, 197, 80116, 1695, 1669, 7868, 2465, 1255, 62088, 37790, 197, 12807, 1695, 1669, 7868, 2465, 75191, 37790, 63435, 4047, 1669, 23042, 1695, 488, 10101, 1695, 271, 2023, 8358, 1273, 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...
7
func TestNetworkSetMTU(t *testing.T) { if testing.Short() { return } tl := testLink{name: "tstEth", linkType: "dummy"} mtu := 1400 addLink(t, tl.name, tl.linkType) defer deleteLink(t, tl.name) ifcBeforeSet := readLink(t, tl.name) if err := NetworkSetMTU(ifcBeforeSet, mtu); err != nil { t.Fatalf("Could not set %d MTU on %#v interface: err", mtu, tl, err) } ifcAfterSet := readLink(t, tl.name) if ifcAfterSet.MTU != mtu { t.Fatalf("Could not set %d MTU on %#v interface", mtu, tl) } }
explode_data.jsonl/76204
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 224 }
[ 2830, 3393, 12320, 1649, 8505, 52, 1155, 353, 8840, 836, 8, 341, 743, 7497, 55958, 368, 341, 197, 853, 198, 197, 630, 3244, 75, 1669, 1273, 3939, 47006, 25, 330, 83, 267, 65390, 497, 2656, 929, 25, 330, 31390, 16707, 2109, 24494, 16...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
4
func TestGlobalRegister(t *testing.T) { globalRegistry = newRegistry() foo := DriverDef{Name: "foo"} if err := Register(foo); err != nil { t.Errorf("Register = %v, expected nil", err) } if err := Register(foo); err == nil { t.Errorf("Register = nil, expected duplicate err") } }
explode_data.jsonl/15479
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 102 }
[ 2830, 3393, 11646, 8690, 1155, 353, 8840, 836, 8, 341, 18842, 15603, 284, 501, 15603, 741, 197, 7975, 1669, 14577, 2620, 63121, 25, 330, 7975, 16707, 743, 1848, 1669, 8451, 71880, 1215, 1848, 961, 2092, 341, 197, 3244, 13080, 445, 8690,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_ChunkIterator(t *testing.T) { for _, tt := range allSchemas { tt := tt t.Run(tt.schema, func(t *testing.T) { cm := storage.NewClientMetrics() defer cm.Unregister() store := newTestStore(t, cm) c1 := createChunk(t, "1", labels.Labels{labels.Label{Name: "foo", Value: "bar"}}, tt.from, tt.from.Add(1*time.Hour)) c2 := createChunk(t, "2", labels.Labels{labels.Label{Name: "foo", Value: "buzz"}, labels.Label{Name: "bar", Value: "foo"}}, tt.from, tt.from.Add(1*time.Hour)) require.NoError(t, store.Put(context.TODO(), []chunk.Chunk{ c1, c2, })) store.Stop() tables := store.indexTables() require.Len(t, tables, 1) var actual []ChunkEntry err := tables[0].DB.Update(func(tx *bbolt.Tx) error { it, err := NewChunkIndexIterator(tx.Bucket(local.IndexBucketName), tt.config) require.NoError(t, err) for it.Next() { require.NoError(t, it.Err()) actual = append(actual, it.Entry()) // delete the last entry if len(actual) == 2 { require.NoError(t, it.Delete()) } } return nil }) require.NoError(t, err) require.Equal(t, []ChunkEntry{ entryFromChunk(store.schemaCfg.SchemaConfig, c1), entryFromChunk(store.schemaCfg.SchemaConfig, c2), }, actual) // second pass we delete c2 actual = actual[:0] err = tables[0].DB.Update(func(tx *bbolt.Tx) error { it, err := NewChunkIndexIterator(tx.Bucket(local.IndexBucketName), tt.config) require.NoError(t, err) for it.Next() { actual = append(actual, it.Entry()) } return it.Err() }) require.NoError(t, err) require.Equal(t, []ChunkEntry{ entryFromChunk(store.schemaCfg.SchemaConfig, c1), }, actual) }) } }
explode_data.jsonl/29681
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 787 }
[ 2830, 3393, 27588, 3122, 11951, 1155, 353, 8840, 836, 8, 341, 2023, 8358, 17853, 1669, 2088, 678, 50, 31126, 341, 197, 3244, 83, 1669, 17853, 198, 197, 3244, 16708, 47152, 30892, 11, 2915, 1155, 353, 8840, 836, 8, 341, 298, 98316, 166...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestTruncateString(t *testing.T) { assert.Equal(t, "", TruncateString("foobar", 0)) assert.Equal(t, "f", TruncateString("foobar", 1)) assert.Equal(t, "fo", TruncateString("foobar", 2)) assert.Equal(t, "foo", TruncateString("foobar", 3)) assert.Equal(t, "foob", TruncateString("foobar", 4)) assert.Equal(t, "fooba", TruncateString("foobar", 5)) assert.Equal(t, "foobar", TruncateString("foobar", 6)) assert.Equal(t, "foobar", TruncateString("foobar", 7)) }
explode_data.jsonl/14318
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 195 }
[ 2830, 3393, 1282, 26900, 703, 1155, 353, 8840, 836, 8, 341, 6948, 12808, 1155, 11, 7342, 1163, 26900, 703, 445, 50267, 497, 220, 15, 1171, 6948, 12808, 1155, 11, 330, 69, 497, 1163, 26900, 703, 445, 50267, 497, 220, 16, 1171, 6948, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestEntryMaybeExpireWithExpiry(t *testing.T) { ctrl := gomock.NewController(t) defer ctrl.Finish() e, _, now := testEntry(ctrl, testEntryOptions{}) populateTestUntimedAggregations(t, e, testAggregationKeys, metric.CounterType) var elems []*CounterElem for _, agg := range e.aggregations { elems = append(elems, agg.elem.Value.(*CounterElem)) } // Try expiring this entry and assert it's not expired. require.False(t, e.TryExpire(*now)) // Try expiring the entry with time in the future and // assert it's expired. require.True(t, e.TryExpire(now.Add(e.opts.EntryTTL()).Add(time.Second))) // Assert elements have been tombstoned require.Equal(t, 0, len(e.aggregations)) require.NotNil(t, e.aggregations) require.Nil(t, e.lists) for _, elem := range elems { require.True(t, elem.tombstoned) } }
explode_data.jsonl/24246
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 314 }
[ 2830, 3393, 5874, 21390, 8033, 554, 2354, 840, 48209, 1155, 353, 8840, 836, 8, 341, 84381, 1669, 342, 316, 1176, 7121, 2051, 1155, 340, 16867, 23743, 991, 18176, 2822, 7727, 11, 8358, 1431, 1669, 1273, 5874, 62100, 11, 1273, 5874, 3798,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestProc_multiAction(t *testing.T) { p := New() const COUNT = 10 var called sync.WaitGroup called.Add(COUNT) // test FIFO property next := 0 for i := 0; i < COUNT; i++ { log.Infof("do'ing deferred action %d", i) idx := i err := p.Do(func() { defer called.Done() log.Infof("deferred action invoked") if next != idx { t.Fatalf("expected index %d instead of %d", idx, next) } next++ }) if err != nil { t.Fatalf("unexpected error: %v", err) } } fatalAfter(t, runtime.After(called.Wait), 2*time.Second, "timed out waiting for deferred actions to be invoked") p.End() fatalAfter(t, p.Done(), 5*time.Second, "timed out waiting for process death") }
explode_data.jsonl/45689
{ "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, 24508, 25133, 2512, 1155, 353, 8840, 836, 8, 341, 3223, 1669, 1532, 741, 4777, 23989, 284, 220, 16, 15, 198, 2405, 2598, 12811, 28384, 2808, 198, 1444, 4736, 1904, 3025, 7463, 692, 197, 322, 1273, 47007, 3343, 198, 28144, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestValidateSilence(t *testing.T) { var ( now = utcNow() zeroTimestamp = time.Time{} validTimestamp = now ) cases := []struct { s *pb.Silence err string }{ { s: &pb.Silence{ Id: "some_id", Matchers: []*pb.Matcher{ &pb.Matcher{Name: "a", Pattern: "b"}, }, StartsAt: validTimestamp, EndsAt: validTimestamp, UpdatedAt: validTimestamp, }, err: "", }, { s: &pb.Silence{ Id: "", Matchers: []*pb.Matcher{ &pb.Matcher{Name: "a", Pattern: "b"}, }, StartsAt: validTimestamp, EndsAt: validTimestamp, UpdatedAt: validTimestamp, }, err: "ID missing", }, { s: &pb.Silence{ Id: "some_id", Matchers: []*pb.Matcher{}, StartsAt: validTimestamp, EndsAt: validTimestamp, UpdatedAt: validTimestamp, }, err: "at least one matcher required", }, { s: &pb.Silence{ Id: "some_id", Matchers: []*pb.Matcher{ &pb.Matcher{Name: "a", Pattern: "b"}, &pb.Matcher{Name: "00", Pattern: "b"}, }, StartsAt: validTimestamp, EndsAt: validTimestamp, UpdatedAt: validTimestamp, }, err: "invalid label matcher", }, { s: &pb.Silence{ Id: "some_id", Matchers: []*pb.Matcher{ &pb.Matcher{Name: "a", Pattern: "b"}, }, StartsAt: now, EndsAt: now.Add(-time.Second), UpdatedAt: validTimestamp, }, err: "end time must not be before start time", }, { s: &pb.Silence{ Id: "some_id", Matchers: []*pb.Matcher{ &pb.Matcher{Name: "a", Pattern: "b"}, }, StartsAt: zeroTimestamp, EndsAt: validTimestamp, UpdatedAt: validTimestamp, }, err: "invalid zero start timestamp", }, { s: &pb.Silence{ Id: "some_id", Matchers: []*pb.Matcher{ &pb.Matcher{Name: "a", Pattern: "b"}, }, StartsAt: validTimestamp, EndsAt: zeroTimestamp, UpdatedAt: validTimestamp, }, err: "invalid zero end timestamp", }, { s: &pb.Silence{ Id: "some_id", Matchers: []*pb.Matcher{ &pb.Matcher{Name: "a", Pattern: "b"}, }, StartsAt: validTimestamp, EndsAt: validTimestamp, UpdatedAt: zeroTimestamp, }, err: "invalid zero update timestamp", }, } for _, c := range cases { err := validateSilence(c.s) if err == nil { if c.err != "" { t.Errorf("expected error containing %q but got none", c.err) } continue } if err != nil && c.err == "" { t.Errorf("unexpected error %q", err) continue } if !strings.Contains(err.Error(), c.err) { t.Errorf("expected error to contain %q but got %q", c.err, err) } } }
explode_data.jsonl/2694
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1342 }
[ 2830, 3393, 17926, 27571, 763, 1155, 353, 8840, 836, 8, 341, 2405, 2399, 197, 80922, 310, 284, 69596, 7039, 741, 197, 197, 14154, 20812, 220, 284, 882, 16299, 16094, 197, 56322, 20812, 284, 1431, 198, 197, 340, 1444, 2264, 1669, 3056, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
7
func TestExifEditor_SetImageDescription(t *testing.T) { je := getJpegEditor(LeicaImg, t) expImageDescription := "A new Image Description" if err := je.Exif().SetImageDescription(expImageDescription); err != nil { t.Fatalf("Could not set Image Description: %v", err) } md := jpegEditorMD(je, t) ret := md.exifData.GetIfdImageDescription() if ret != expImageDescription { t.Fatalf("Expected %s got %s", expImageDescription, ret) } }
explode_data.jsonl/79885
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 154 }
[ 2830, 3393, 840, 333, 9410, 14812, 1906, 5009, 1155, 353, 8840, 836, 8, 341, 197, 3756, 1669, 633, 41, 10311, 9410, 7, 2304, 3001, 13033, 11, 259, 340, 48558, 1906, 5009, 1669, 330, 32, 501, 4654, 7662, 698, 743, 1848, 1669, 4759, 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...
3
func TestIDPRejectsInvalidRequest(t *testing.T) { test := NewIdentifyProviderTest(t) test.IDP.SessionProvider = &mockSessionProvider{ GetSessionFunc: func(w http.ResponseWriter, r *http.Request, req *IdpAuthnRequest) *Session { panic("not reached") }, } w := httptest.NewRecorder() r, _ := http.NewRequest("GET", "https://idp.example.com/saml/sso?RelayState=ThisIsTheRelayState&SAMLRequest=XXX", nil) test.IDP.ServeSSO(w, r) assert.Check(t, is.Equal(http.StatusBadRequest, w.Code)) w = httptest.NewRecorder() r, _ = http.NewRequest("POST", "https://idp.example.com/saml/sso", strings.NewReader("RelayState=ThisIsTheRelayState&SAMLRequest=XXX")) r.Header.Set("Content-type", "application/x-www-form-urlencoded") test.IDP.ServeSSO(w, r) assert.Check(t, is.Equal(http.StatusBadRequest, w.Code)) }
explode_data.jsonl/19826
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 325 }
[ 2830, 3393, 915, 47, 78413, 82, 7928, 1900, 1155, 353, 8840, 836, 8, 341, 18185, 1669, 1532, 28301, 1437, 5179, 2271, 1155, 340, 18185, 9910, 47, 20674, 5179, 284, 609, 16712, 5283, 5179, 515, 197, 37654, 5283, 9626, 25, 2915, 3622, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestDashboardSnapshotApiEndpoint(t *testing.T) { Convey("Given a single snapshot", t, func() { var externalRequest *http.Request jsonModel, _ := simplejson.NewJson([]byte(`{"id":100}`)) mockSnapshotResult := &m.DashboardSnapshot{ Id: 1, Key: "12345", DeleteKey: "54321", Dashboard: jsonModel, Expires: time.Now().Add(time.Duration(1000) * time.Second), UserId: 999999, External: true, } bus.AddHandler("test", func(query *m.GetDashboardSnapshotQuery) error { query.Result = mockSnapshotResult return nil }) bus.AddHandler("test", func(cmd *m.DeleteDashboardSnapshotCommand) error { return nil }) viewerRole := m.ROLE_VIEWER editorRole := m.ROLE_EDITOR aclMockResp := []*m.DashboardAclInfoDTO{} bus.AddHandler("test", func(query *m.GetDashboardAclInfoListQuery) error { query.Result = aclMockResp return nil }) teamResp := []*m.TeamDTO{} bus.AddHandler("test", func(query *m.GetTeamsByUserQuery) error { query.Result = teamResp return nil }) setupRemoteServer := func(fn func(http.ResponseWriter, *http.Request)) *httptest.Server { return httptest.NewServer(http.HandlerFunc(func(rw http.ResponseWriter, r *http.Request) { fn(rw, r) })) } Convey("When user has editor role and is not in the ACL", func() { Convey("Should not be able to delete snapshot", func() { loggedInUserScenarioWithRole("When calling DELETE on", "DELETE", "/api/snapshots/12345", "/api/snapshots/:key", m.ROLE_EDITOR, func(sc *scenarioContext) { ts := setupRemoteServer(func(rw http.ResponseWriter, req *http.Request) { externalRequest = req }) mockSnapshotResult.ExternalDeleteUrl = ts.URL sc.handlerFunc = DeleteDashboardSnapshot sc.fakeReqWithParams("DELETE", sc.url, map[string]string{"key": "12345"}).exec() So(sc.resp.Code, ShouldEqual, 403) So(externalRequest, ShouldBeNil) }) }) }) Convey("When user is anonymous", func() { Convey("Should be able to delete snapshot by deleteKey", func() { anonymousUserScenario("When calling GET on", "GET", "/api/snapshots-delete/12345", "/api/snapshots-delete/:deleteKey", func(sc *scenarioContext) { ts := setupRemoteServer(func(rw http.ResponseWriter, req *http.Request) { rw.WriteHeader(200) externalRequest = req }) mockSnapshotResult.ExternalDeleteUrl = ts.URL sc.handlerFunc = DeleteDashboardSnapshotByDeleteKey sc.fakeReqWithParams("GET", sc.url, map[string]string{"deleteKey": "12345"}).exec() So(sc.resp.Code, ShouldEqual, 200) respJSON, err := simplejson.NewJson(sc.resp.Body.Bytes()) So(err, ShouldBeNil) So(respJSON.Get("message").MustString(), ShouldStartWith, "Snapshot deleted") So(externalRequest.Method, ShouldEqual, http.MethodGet) So(fmt.Sprintf("http://%s", externalRequest.Host), ShouldEqual, ts.URL) So(externalRequest.URL.EscapedPath(), ShouldEqual, "/") }) }) }) Convey("When user is editor and dashboard has default ACL", func() { aclMockResp = []*m.DashboardAclInfoDTO{ {Role: &viewerRole, Permission: m.PERMISSION_VIEW}, {Role: &editorRole, Permission: m.PERMISSION_EDIT}, } Convey("Should be able to delete a snapshot", func() { loggedInUserScenarioWithRole("When calling DELETE on", "DELETE", "/api/snapshots/12345", "/api/snapshots/:key", m.ROLE_EDITOR, func(sc *scenarioContext) { ts := setupRemoteServer(func(rw http.ResponseWriter, req *http.Request) { rw.WriteHeader(200) externalRequest = req }) mockSnapshotResult.ExternalDeleteUrl = ts.URL sc.handlerFunc = DeleteDashboardSnapshot sc.fakeReqWithParams("DELETE", sc.url, map[string]string{"key": "12345"}).exec() So(sc.resp.Code, ShouldEqual, 200) respJSON, err := simplejson.NewJson(sc.resp.Body.Bytes()) So(err, ShouldBeNil) So(respJSON.Get("message").MustString(), ShouldStartWith, "Snapshot deleted") So(fmt.Sprintf("http://%s", externalRequest.Host), ShouldEqual, ts.URL) So(externalRequest.URL.EscapedPath(), ShouldEqual, "/") }) }) }) Convey("When user is editor and is the creator of the snapshot", func() { aclMockResp = []*m.DashboardAclInfoDTO{} mockSnapshotResult.UserId = TestUserID mockSnapshotResult.External = false Convey("Should be able to delete a snapshot", func() { loggedInUserScenarioWithRole("When calling DELETE on", "DELETE", "/api/snapshots/12345", "/api/snapshots/:key", m.ROLE_EDITOR, func(sc *scenarioContext) { sc.handlerFunc = DeleteDashboardSnapshot sc.fakeReqWithParams("DELETE", sc.url, map[string]string{"key": "12345"}).exec() So(sc.resp.Code, ShouldEqual, 200) respJSON, err := simplejson.NewJson(sc.resp.Body.Bytes()) So(err, ShouldBeNil) So(respJSON.Get("message").MustString(), ShouldStartWith, "Snapshot deleted") }) }) }) Convey("When deleting an external snapshot", func() { aclMockResp = []*m.DashboardAclInfoDTO{} mockSnapshotResult.UserId = TestUserID Convey("Should gracefully delete local snapshot when remote snapshot has already been removed", func() { loggedInUserScenarioWithRole("When calling DELETE on", "DELETE", "/api/snapshots/12345", "/api/snapshots/:key", m.ROLE_EDITOR, func(sc *scenarioContext) { ts := setupRemoteServer(func(rw http.ResponseWriter, req *http.Request) { rw.Write([]byte(`{"message":"Failed to get dashboard snapshot"}`)) rw.WriteHeader(500) }) mockSnapshotResult.ExternalDeleteUrl = ts.URL sc.handlerFunc = DeleteDashboardSnapshot sc.fakeReqWithParams("DELETE", sc.url, map[string]string{"key": "12345"}).exec() So(sc.resp.Code, ShouldEqual, 200) }) }) Convey("Should fail to delete local snapshot when an unexpected 500 error occurs", func() { loggedInUserScenarioWithRole("When calling DELETE on", "DELETE", "/api/snapshots/12345", "/api/snapshots/:key", m.ROLE_EDITOR, func(sc *scenarioContext) { ts := setupRemoteServer(func(rw http.ResponseWriter, req *http.Request) { rw.WriteHeader(500) rw.Write([]byte(`{"message":"Unexpected"}`)) }) mockSnapshotResult.ExternalDeleteUrl = ts.URL sc.handlerFunc = DeleteDashboardSnapshot sc.fakeReqWithParams("DELETE", sc.url, map[string]string{"key": "12345"}).exec() So(sc.resp.Code, ShouldEqual, 500) }) }) Convey("Should fail to delete local snapshot when an unexpected remote error occurs", func() { loggedInUserScenarioWithRole("When calling DELETE on", "DELETE", "/api/snapshots/12345", "/api/snapshots/:key", m.ROLE_EDITOR, func(sc *scenarioContext) { ts := setupRemoteServer(func(rw http.ResponseWriter, req *http.Request) { rw.WriteHeader(404) }) mockSnapshotResult.ExternalDeleteUrl = ts.URL sc.handlerFunc = DeleteDashboardSnapshot sc.fakeReqWithParams("DELETE", sc.url, map[string]string{"key": "12345"}).exec() So(sc.resp.Code, ShouldEqual, 500) }) }) }) }) }
explode_data.jsonl/19316
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 2779 }
[ 2830, 3393, 26947, 15009, 6563, 27380, 1155, 353, 8840, 836, 8, 341, 93070, 5617, 445, 22043, 264, 3175, 16295, 497, 259, 11, 2915, 368, 341, 197, 2405, 9250, 1900, 353, 1254, 9659, 198, 197, 30847, 1712, 11, 716, 1669, 4285, 2236, 71...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_getBranch(t *testing.T) { type args struct { prSpec *v1alpha3.PipelineRunSpec } tests := []struct { name string args args want string wantErr bool }{{ name: "No SCM Pipeline", args: args{ prSpec: &v1alpha3.PipelineRunSpec{ PipelineSpec: &v1alpha3.PipelineSpec{ Type: v1alpha3.NoScmPipelineType, }, }, }, want: "", }, { name: "No SCM Pipeline but SCM set", args: args{ prSpec: &v1alpha3.PipelineRunSpec{ PipelineSpec: &v1alpha3.PipelineSpec{ Type: v1alpha3.NoScmPipelineType, }, SCM: &v1alpha3.SCM{ RefName: "main", RefType: "branch", }, }, }, want: "", }, { name: "Multi-branch Pipeline but not SCM set", args: args{ prSpec: &v1alpha3.PipelineRunSpec{ PipelineSpec: &v1alpha3.PipelineSpec{ Type: v1alpha3.MultiBranchPipelineType, }, }, }, wantErr: true, }, { name: "Multi-branch Pipeline and SCM set", args: args{ prSpec: &v1alpha3.PipelineRunSpec{ PipelineSpec: &v1alpha3.PipelineSpec{ Type: v1alpha3.MultiBranchPipelineType, }, SCM: &v1alpha3.SCM{ RefName: "main", RefType: "branch", }, }, }, want: "main", }, { name: "Multi-branch Pipeline and SCM set, but the name is invalid", args: args{ prSpec: &v1alpha3.PipelineRunSpec{ PipelineSpec: &v1alpha3.PipelineSpec{ Type: v1alpha3.MultiBranchPipelineType, }, SCM: &v1alpha3.SCM{ RefName: "测试分支", RefType: "branch", }, }, }, wantErr: true, }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { got, err := getSCMRefName(tt.args.prSpec) if (err != nil) != tt.wantErr { t.Errorf("getSCMRefName() error = %v, wantErr %v", err, tt.wantErr) return } if got != tt.want { t.Errorf("getSCMRefName() got = %v, want %v", got, tt.want) } }) } }
explode_data.jsonl/24647
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 966 }
[ 2830, 3393, 3062, 18197, 1155, 353, 8840, 836, 8, 341, 13158, 2827, 2036, 341, 197, 25653, 8327, 353, 85, 16, 7141, 18, 1069, 8790, 6727, 8327, 198, 197, 532, 78216, 1669, 3056, 1235, 341, 197, 11609, 262, 914, 198, 197, 31215, 262, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestDoubleEntryFailure(t *testing.T) { if testing.Short() { t.SkipNow() } _, mnt := setupIpnsTest(t, nil) defer mnt.Close() dname := mnt.Dir + "/local/thisisadir" err := os.Mkdir(dname, 0777) if err != nil { t.Fatal(err) } err = os.Mkdir(dname, 0777) if err == nil { t.Fatal("Should have gotten error one creating new directory.") } }
explode_data.jsonl/77469
{ "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, 7378, 5874, 17507, 1155, 353, 8840, 836, 8, 341, 743, 7497, 55958, 368, 341, 197, 3244, 57776, 7039, 741, 197, 532, 197, 6878, 296, 406, 1669, 6505, 23378, 4412, 2271, 1155, 11, 2092, 340, 16867, 296, 406, 10421, 2822, 269...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestStream_gotoNextReadByteUnsafe(t *testing.T) { t.Run("test", func(t *testing.T) { assert := base.NewAssert(t) testEnd := streamBlockSize * (streamFrameArrayInitSize + 2) stream := NewStream() stream.SetWritePos(streamBlockSize * (streamFrameArrayInitSize + 3)) for i := streamPosBody; i < testEnd; i++ { assert(stream.SetReadPos(i)).IsTrue() stream.gotoNextReadByteUnsafe() assert(stream.GetReadPos()).Equals(i + 1) } stream.Release() }) }
explode_data.jsonl/21192
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 183 }
[ 2830, 3393, 3027, 97732, 5847, 4418, 7153, 78770, 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, 3727, 1669, 4269, 89932, 353, 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...
2
func TestReturning(t *testing.T) { db := openTestConn(t) defer db.Close() _, err := db.Exec("CREATE TEMP TABLE distributors (did integer default 0, dname text)") if err != nil { t.Fatal(err) } rows, err := db.Query("INSERT INTO distributors (did, dname) VALUES (DEFAULT, 'XYZ Widgets') " + "RETURNING did;") if err != nil { t.Fatal(err) } if !rows.Next() { t.Fatal("no rows") } var did int err = rows.Scan(&did) if err != nil { t.Fatal(err) } if did != 0 { t.Fatalf("bad value for did: got %d, want %d", did, 0) } if rows.Next() { t.Fatal("unexpected next row") } err = rows.Err() if err != nil { t.Fatal(err) } }
explode_data.jsonl/63435
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 289 }
[ 2830, 3393, 84814, 1155, 353, 8840, 836, 8, 341, 20939, 1669, 1787, 2271, 9701, 1155, 340, 16867, 2927, 10421, 2822, 197, 6878, 1848, 1669, 2927, 30798, 445, 22599, 57431, 14363, 55594, 320, 22920, 7546, 1638, 220, 15, 11, 294, 606, 146...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestLargeMethod(t *testing.T) { testutils.WithTestServer(t, nil, func(t testing.TB, ts *testutils.TestServer) { ctx, cancel := NewContext(time.Second) defer cancel() largeMethod := testutils.RandBytes(16*1024 + 1) _, _, _, err := raw.Call(ctx, ts.Server(), ts.HostPort(), ts.ServiceName(), string(largeMethod), nil, nil) assert.Equal(t, ErrMethodTooLarge, err) }) }
explode_data.jsonl/78187
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 142 }
[ 2830, 3393, 34253, 3523, 1155, 353, 8840, 836, 8, 341, 18185, 6031, 26124, 2271, 5475, 1155, 11, 2092, 11, 2915, 1155, 7497, 836, 33, 11, 10591, 353, 1944, 6031, 8787, 5475, 8, 341, 197, 20985, 11, 9121, 1669, 1532, 1972, 9730, 32435,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestResourceRecordSetsAddDuplicateFail(t *testing.T) { zone := firstZone(t) sets := rrs(t, zone) rrset := getExampleRrs(zone) addRrsetOrFail(t, sets, rrset) defer sets.StartChangeset().Remove(rrset).Apply() t.Logf("Successfully added resource record set: %v", rrset) // Try to add it again, and verify that the call fails. err := sets.StartChangeset().Add(rrset).Apply() if err == nil { defer sets.StartChangeset().Remove(rrset).Apply() t.Errorf("Should have failed to add duplicate resource record %v, but succeeded instead.", rrset) } else { t.Logf("Correctly failed to add duplicate resource record %v: %v", rrset, err) } }
explode_data.jsonl/75413
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 229 }
[ 2830, 3393, 4783, 6471, 30175, 2212, 53979, 19524, 1155, 353, 8840, 836, 8, 341, 197, 8684, 1669, 1156, 15363, 1155, 340, 197, 4917, 1669, 435, 5428, 1155, 11, 10143, 340, 197, 634, 746, 1669, 633, 13314, 49, 5428, 74228, 340, 12718, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestProfileWeightedDirected(t *testing.T) { for _, test := range communityDirectedQTests { g := simple.NewWeightedDirectedGraph(0, 0) for u, e := range test.g { // Add nodes that are not defined by an edge. if g.Node(int64(u)) == nil { g.AddNode(simple.Node(u)) } for v := range e { g.SetWeightedEdge(simple.WeightedEdge{F: simple.Node(u), T: simple.Node(v), W: 1}) } } testProfileDirected(t, test, g) } }
explode_data.jsonl/27038
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 190 }
[ 2830, 3393, 8526, 8295, 291, 92669, 1155, 353, 8840, 836, 8, 341, 2023, 8358, 1273, 1669, 2088, 3942, 92669, 48, 18200, 341, 197, 3174, 1669, 4285, 7121, 8295, 291, 92669, 11212, 7, 15, 11, 220, 15, 340, 197, 2023, 575, 11, 384, 166...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
5
func TestLen(t *testing.T) { newFn := func() (toil.Toiler, error) { return nil, nil } toilForker := NewFunc(newFn) length := toilForker.Len() if expected, actual := 0, length; expected != actual { t.Errorf("Expected the number of registered toilers to be %d, but actually was %d.", expected, actual) return } }
explode_data.jsonl/15806
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 122 }
[ 2830, 3393, 11271, 1155, 353, 8840, 836, 8, 1476, 8638, 24911, 1669, 2915, 368, 320, 983, 321, 3274, 5769, 11, 1465, 8, 341, 197, 853, 2092, 11, 2092, 198, 197, 630, 31709, 321, 37, 669, 261, 1669, 1532, 9626, 1755, 24911, 692, 4904...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_isInContainer(t *testing.T) { // setup hDockerGrp, hLinuxGrp, err := createTestCgroupFiles() if err != nil { t.Fatal(err) } defer func() { // tear down removeTestFile(hDockerGrp) removeTestFile(hLinuxGrp) }() // TEST type args struct { cgroupPath string } tests := []struct { name string args args want bool wantErr bool }{ {"docker", args{hDockerGrp.Name()}, true, false}, {"linux", args{hLinuxGrp.Name()}, false, false}, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { got, err := isInContainer(tt.args.cgroupPath) if (err != nil) != tt.wantErr { t.Errorf("isInContainer() error = %v, wantErr %v", err, tt.wantErr) return } if got != tt.want { t.Errorf("isInContainer() = %v, want %v", got, tt.want) } }) } }
explode_data.jsonl/48581
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 415 }
[ 2830, 3393, 6892, 641, 4502, 1155, 353, 8840, 836, 8, 8022, 197, 322, 6505, 319, 9598, 35, 13659, 6464, 79, 11, 305, 46324, 6464, 79, 11, 1848, 1669, 1855, 2271, 34, 4074, 10809, 3568, 743, 1848, 961, 2092, 972, 197, 3244, 26133, 39...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestCollectVolumeSnapshotCRD(t *testing.T) { expectedRecords := map[string]v1beta1.CustomResourceDefinition{ "config/crd/volumesnapshots.snapshot.storage.k8s.io": {ObjectMeta: metav1.ObjectMeta{Name: "volumesnapshots.snapshot.storage.k8s.io"}}, "config/crd/volumesnapshotcontents.snapshot.storage.k8s.io": {ObjectMeta: metav1.ObjectMeta{Name: "volumesnapshotcontents.snapshot.storage.k8s.io"}}, } crdNames := []string{ "unrelated.custom.resource.definition.k8s.io", "volumesnapshots.snapshot.storage.k8s.io", "volumesnapshotcontents.snapshot.storage.k8s.io", "another.irrelevant.custom.resource.definition.k8s.io", "this.should.not.be.gathered.k8s.io", } crdClientset := apixv1beta1clientfake.NewSimpleClientset() for _, name := range crdNames { crdClientset.ApiextensionsV1beta1().CustomResourceDefinitions().Create(context.Background(), &v1beta1.CustomResourceDefinition{ ObjectMeta: metav1.ObjectMeta{Name: name}, }, metav1.CreateOptions{}) } gatherer := &Gatherer{crdClient: crdClientset.ApiextensionsV1beta1()} records, errs := GatherCRD(gatherer)() if len(errs) != 0 { t.Fatalf("gather CRDs resulted in error: %#v", errs) } if len(records) != len(expectedRecords) { t.Fatalf("unexpected number of records gathered: %d (expected %d)", len(records), len(expectedRecords)) } for _, rec := range records { if expectedItem, ok := expectedRecords[rec.Name]; !ok { t.Fatalf("unexpected gathered record name: %q", rec.Name) } else if reflect.DeepEqual(rec.Item, expectedItem) { t.Fatalf("gathered record %q has different item value than unexpected", rec.Name) } } }
explode_data.jsonl/32589
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 631 }
[ 2830, 3393, 47504, 18902, 15009, 8973, 35, 1155, 353, 8840, 836, 8, 341, 42400, 25876, 1669, 2415, 14032, 60, 85, 16, 19127, 16, 27649, 4783, 10398, 515, 197, 197, 1, 1676, 2899, 6498, 5457, 19705, 6861, 27634, 52677, 22403, 5202, 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...
7
func TestFindWorkingDay(t *testing.T) { jan10 := time.Date(2021, time.January, 10, 0, 0, 0, 0, time.UTC) monday := jan10.AddDate(0, 0, 1) jan9 := jan10.AddDate(0, 0, -1) friday := time.Date(2021, time.January, 15, 0, 0, 0, 0, time.UTC) assert.Equal(t, monday.Format("2006/1/2"), FindWorkingDay(jan10).Format("2006/1/2")) assert.Equal(t, monday.Format("2006/1/2"), FindWorkingDay(jan9).Format("2006/1/2")) assert.Equal(t, friday.Format("2006/1/2"), FindWorkingDay(friday).Format("2006/1/2")) }
explode_data.jsonl/66809
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 215 }
[ 2830, 3393, 9885, 33978, 10159, 1155, 353, 8840, 836, 8, 341, 12428, 276, 16, 15, 1669, 882, 8518, 7, 17, 15, 17, 16, 11, 882, 3503, 276, 3536, 11, 220, 16, 15, 11, 220, 15, 11, 220, 15, 11, 220, 15, 11, 220, 15, 11, 882, 87...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_Problem918(t *testing.T) { qs := []question918{ { para918{[]int{1, -2, 3, -2}}, ans918{3}, }, { para918{[]int{5, -3, 5}}, ans918{10}, }, { para918{[]int{3, -1, 2, -1}}, ans918{4}, }, { para918{[]int{3, -2, 2, -3}}, ans918{3}, }, { para918{[]int{-2, -3, -1}}, ans918{-1}, }, } fmt.Printf("------------------------Leetcode Problem 918------------------------\n") for _, q := range qs { _, p := q.ans918, q.para918 fmt.Printf("【input】:%v 【output】:%v\n", p, maxSubarraySumCircular(p.one)) } fmt.Printf("\n\n\n") }
explode_data.jsonl/30225
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 341 }
[ 2830, 3393, 16670, 10121, 24, 16, 23, 1155, 353, 8840, 836, 8, 1476, 18534, 82, 1669, 3056, 7841, 24, 16, 23, 4257, 197, 197, 515, 298, 197, 14794, 24, 16, 23, 90, 1294, 396, 90, 16, 11, 481, 17, 11, 220, 18, 11, 481, 17, 2205...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestBufferReader(t *testing.T) { v, cleanup := newChildProcess(t) defer cleanup() b, err := v.CurrentBuffer() if err != nil { t.Fatal(err) } for _, d := range readerData { if err := v.SetBufferLines(b, 0, -1, true, bytes.Split([]byte(strings.TrimSuffix(d, "\n")), []byte{'\n'})); err != nil { t.Fatal(err) } for n := 1; n < 20; n++ { var buf bytes.Buffer r := NewBufferReader(v, b) _, err := io.CopyBuffer(struct{ io.Writer }{&buf}, r, make([]byte, n)) if err != nil { t.Errorf("copy %q with buffer size %d returned error %v", d, n, err) continue } if d != buf.String() { t.Errorf("copy %q with buffer size %d = %q", d, n, buf.Bytes()) continue } } } }
explode_data.jsonl/74441
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 324 }
[ 2830, 3393, 4095, 5062, 1155, 353, 8840, 836, 8, 341, 5195, 11, 21290, 1669, 501, 3652, 7423, 1155, 340, 16867, 21290, 741, 2233, 11, 1848, 1669, 348, 11517, 4095, 741, 743, 1848, 961, 2092, 341, 197, 3244, 26133, 3964, 340, 197, 532,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestTraceflow(t *testing.T) { skipIfHasWindowsNodes(t) skipIfTraceflowDisabled(t) data, err := setupTest(t) if err != nil { t.Fatalf("Error when setting up test: %v", err) } defer teardownTest(t, data) t.Run("testTraceflowIntraNodeANP", func(t *testing.T) { skipIfAntreaPolicyDisabled(t) testTraceflowIntraNodeANP(t, data) }) t.Run("testTraceflowIntraNode", func(t *testing.T) { skipIfAntreaPolicyDisabled(t) testTraceflowIntraNode(t, data) }) t.Run("testTraceflowInterNode", func(t *testing.T) { skipIfNumNodesLessThan(t, 2) testTraceflowInterNode(t, data) }) t.Run("testTraceflowExternalIP", func(t *testing.T) { skipIfEncapModeIsNot(t, data, config.TrafficEncapModeEncap) testTraceflowExternalIP(t, data) }) }
explode_data.jsonl/506
{ "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, 6550, 4965, 1155, 353, 8840, 836, 8, 341, 1903, 13389, 2679, 10281, 13164, 12288, 1155, 340, 1903, 13389, 2679, 6550, 4965, 25907, 1155, 692, 8924, 11, 1848, 1669, 6505, 2271, 1155, 340, 743, 1848, 961, 2092, 341, 197, 3244,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestSyncPodGetsPodIPFromNetworkPlugin(t *testing.T) { const ( containerID = "123" infraContainerID = "9876" fakePodIP = "10.10.10.10" ) dm, fakeDocker := newTestDockerManager() dm.podInfraContainerImage = "pod_infra_image" ctrl := gomock.NewController(t) defer ctrl.Finish() fnp := mock_network.NewMockNetworkPlugin(ctrl) dm.networkPlugin = fnp pod := makePod("foo", &api.PodSpec{ Containers: []api.Container{ {Name: "bar"}, }, }) // Can be called multiple times due to GetPodStatus fnp.EXPECT().Name().Return("someNetworkPlugin").AnyTimes() fnp.EXPECT().GetPodNetworkStatus("new", "foo", gomock.Any()).Return(&network.PodNetworkStatus{IP: net.ParseIP(fakePodIP)}, nil).AnyTimes() fnp.EXPECT().SetUpPod("new", "foo", gomock.Any()).Return(nil) runSyncPod(t, dm, fakeDocker, pod, nil, false) verifyCalls(t, fakeDocker, []string{ // Create pod infra container. "create", "start", "inspect_container", "inspect_container", // Create container. "create", "start", "inspect_container", }) }
explode_data.jsonl/31201
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 404 }
[ 2830, 3393, 12154, 23527, 49358, 23527, 3298, 3830, 12320, 11546, 1155, 353, 8840, 836, 8, 341, 4777, 2399, 197, 53290, 915, 414, 284, 330, 16, 17, 18, 698, 197, 197, 92317, 4502, 915, 284, 330, 24, 23, 22, 21, 698, 197, 1166, 726, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestResource_YamlDecode(t *testing.T) { var filename1 = path.Join(os.Getenv("TMPDIR"), "resource1.yaml") var filename2 = path.Join(os.Getenv("TMPDIR"), "resource2.yaml") _ = toolbox.RemoveFileIfExist(filename1, filename2) var aMap = map[string]interface{}{ "a": 1, "b": "123", "c": []int{1, 3, 6}, } file, err := os.OpenFile(filename1, os.O_CREATE|os.O_RDWR, 0644) if assert.Nil(t, err) { err = toolbox.NewYamlEncoderFactory().Create(file).Encode(aMap) assert.Nil(t, err) } { var resource = url.NewResource(filename1) assert.EqualValues(t, resource.ParsedURL.String(), toolbox.FileSchema+filename1) var resourceData = make(map[string]interface{}) err = resource.YAMLDecode(&resourceData) assert.Nil(t, err) assert.EqualValues(t, resourceData["a"], 1) assert.EqualValues(t, resourceData["b"], "123") } YAML := `init: defaultUser: &defaultUser name: bob age: 18 pipeline: test: init: users: <<: *defaultUser age: 24 action: print message: I got $users` err = ioutil.WriteFile(filename2, []byte(YAML), 0644) assert.Nil(t, err) { var resource = url.NewResource(filename2) var resourceData = make(map[string]interface{}) err = resource.YAMLDecode(&resourceData) assert.Nil(t, err) if normalized, err := toolbox.NormalizeKVPairs(resourceData); err == nil { resourceData = toolbox.AsMap(normalized) } //TODO add actual test once yaml reference is patched //exposes issue with yaml reference } }
explode_data.jsonl/31248
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 619 }
[ 2830, 3393, 4783, 10626, 9467, 32564, 1155, 353, 8840, 836, 8, 1476, 2405, 3899, 16, 284, 1815, 22363, 9638, 64883, 445, 42234, 12251, 3975, 330, 9233, 16, 33406, 1138, 2405, 3899, 17, 284, 1815, 22363, 9638, 64883, 445, 42234, 12251, 3...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestMaxInt64(t *testing.T) { type args struct { a int64 b int64 } tests := []struct { name string args args want int64 }{ { "1", args{ a: 1, b: 2, }, 2, }, { "2", args{ a: 2, b: 1, }, 2, }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { if got := MaxInt64(tt.args.a, tt.args.b); got != tt.want { t.Errorf("MaxInt64() = %v, want %v", got, tt.want) } }) } }
explode_data.jsonl/6164
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 265 }
[ 2830, 3393, 5974, 1072, 21, 19, 1155, 353, 8840, 836, 8, 341, 13158, 2827, 2036, 341, 197, 11323, 526, 21, 19, 198, 197, 2233, 526, 21, 19, 198, 197, 532, 78216, 1669, 3056, 1235, 341, 197, 11609, 914, 198, 197, 31215, 2827, 198, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestDaoDelReplyZSetRds(t *testing.T) { convey.Convey("DelReplyZSetRds", t, func(ctx convey.C) { var ( names = []string{} oid = int64(0) tp = int(0) ) ctx.Convey("When everything goes positive", func(ctx convey.C) { err := d.DelReplyZSetRds(context.Background(), names, oid, tp) ctx.Convey("Then err should be nil.", func(ctx convey.C) { ctx.So(err, convey.ShouldBeNil) }) }) }) }
explode_data.jsonl/21801
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 191 }
[ 2830, 3393, 12197, 16532, 20841, 57, 1649, 49, 5356, 1155, 353, 8840, 836, 8, 341, 37203, 5617, 4801, 5617, 445, 16532, 20841, 57, 1649, 49, 5356, 497, 259, 11, 2915, 7502, 20001, 727, 8, 341, 197, 2405, 2399, 298, 93940, 284, 3056, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestPutAutoOrderID(t *testing.T) { index, err := Open("Doc") if err != nil { t.Fatalf("err from Open: %v", err) } c := aetesting.FakeSingleContext(t, "search", "IndexDocument", func(in *pb.IndexDocumentRequest, out *pb.IndexDocumentResponse) error { if len(in.Params.GetDocument()) < 1 { return fmt.Errorf("expected at least one Document, got %v", in) } got, want := in.Params.Document[0].GetOrderId(), int32(time.Since(orderIDEpoch).Seconds()) if d := got - want; -5 > d || d > 5 { return fmt.Errorf("got OrderId %d, want near %d", got, want) } *out = pb.IndexDocumentResponse{ Status: []*pb.RequestStatus{ {Code: pb.SearchServiceError_OK.Enum()}, }, DocId: []string{ "doc_id", }, } return nil }) if _, err := index.Put(c, "", &searchFields); err != nil { t.Fatal(err) } }
explode_data.jsonl/27960
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 346 }
[ 2830, 3393, 19103, 13253, 4431, 915, 1155, 353, 8840, 836, 8, 341, 26327, 11, 1848, 1669, 5264, 445, 9550, 1138, 743, 1848, 961, 2092, 341, 197, 3244, 30762, 445, 615, 504, 5264, 25, 1018, 85, 497, 1848, 340, 197, 630, 1444, 1669, 2...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
4
func TestEntGQL_buildTypes(t *testing.T) { graph, err := entc.LoadGraph("./internal/todoplugin/ent/schema", &gen.Config{}) require.NoError(t, err) disableRelayConnection(graph) plugin, err := newSchemaGenerator(graph) require.NoError(t, err) plugin.relaySpec = false types, err := plugin.buildTypes() require.NoError(t, err) require.Equal(t, `type Category implements Entity { id: ID! text: String! uuidA: UUID status: CategoryStatus! config: CategoryConfig! duration: Duration! count: Uint64! @deprecated(reason: "We don't use this field anymore") strings: [String!] } """ CategoryStatus is enum for the field status """ enum CategoryStatus @goModel(model: "entgo.io/contrib/entgql/internal/todoplugin/ent/category.Status") { ENABLED DISABLED } type MasterUser @goModel(model: "entgo.io/contrib/entgql/internal/todoplugin/ent.User") { id: ID username: String! age: Float! amount: Float! role: Role! nullableString: String } """ Role is enum for the field role """ enum Role @goModel(model: "entgo.io/contrib/entgql/internal/todoplugin/ent/role.Role") { ADMIN USER UNKNOWN } """ Status is enum for the field status """ enum Status @goModel(model: "entgo.io/contrib/entgql/internal/todoplugin/ent/todo.Status") { IN_PROGRESS COMPLETED } type Todo { id: ID! createdAt: Time! visibilityStatus: VisibilityStatus! status: Status! priority: Int! text: String! } """ VisibilityStatus is enum for the field visibility_status """ enum VisibilityStatus @goModel(model: "entgo.io/contrib/entgql/internal/todoplugin/ent/todo.VisibilityStatus") { LISTING HIDDEN } `, printSchema(&ast.Schema{ Types: types, })) }
explode_data.jsonl/63028
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 615 }
[ 2830, 3393, 2250, 38, 3588, 20801, 4173, 1155, 353, 8840, 836, 8, 341, 66616, 11, 1848, 1669, 1197, 66, 13969, 11212, 13988, 10481, 5523, 347, 55078, 3631, 14, 306, 61142, 497, 609, 4370, 10753, 37790, 17957, 35699, 1155, 11, 1848, 340,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestControllerExpandVolume(t *testing.T) { stdVolSize := int64(5 * 1024 * 1024 * 1024) stdCapRange := &csi.CapacityRange{RequiredBytes: stdVolSize} testCases := []struct { name string testFunc func(t *testing.T) }{ { name: "Volume ID missing", testFunc: func(t *testing.T) { req := &csi.ControllerExpandVolumeRequest{} ctx := context.Background() d, _ := NewFakeDriver(t) expectedErr := status.Error(codes.InvalidArgument, "Volume ID missing in request") _, err := d.ControllerExpandVolume(ctx, req) if !reflect.DeepEqual(err, expectedErr) { t.Errorf("Unexpected error: %v", err) } }, }, { name: "Volume capabilities missing", testFunc: func(t *testing.T) { req := &csi.ControllerExpandVolumeRequest{ VolumeId: "vol_1", } ctx := context.Background() d, _ := NewFakeDriver(t) var csc []*csi.ControllerServiceCapability d.Cap = csc expectedErr := status.Error(codes.InvalidArgument, "invalid expand volume request: volume_id:\"vol_1\" ") _, err := d.ControllerExpandVolume(ctx, req) if !reflect.DeepEqual(err, expectedErr) { t.Errorf("Unexpected error: %v", err) } }, }, { name: "Volume Capacity range missing", testFunc: func(t *testing.T) { req := &csi.ControllerExpandVolumeRequest{ VolumeId: "vol_1", } ctx := context.Background() d, _ := NewFakeDriver(t) expectedErr := status.Error(codes.InvalidArgument, "volume capacity range missing in request") _, err := d.ControllerExpandVolume(ctx, req) if !reflect.DeepEqual(err, expectedErr) { t.Errorf("Unexpected error: %v", err) } }, }, { name: "disk type is not managedDisk", testFunc: func(t *testing.T) { req := &csi.ControllerExpandVolumeRequest{ VolumeId: "httptest", CapacityRange: stdCapRange, } ctx := context.Background() d, _ := NewFakeDriver(t) expectedErr := status.Error(codes.InvalidArgument, "the disk type(httptest) is not ManagedDisk") _, err := d.ControllerExpandVolume(ctx, req) if !reflect.DeepEqual(err, expectedErr) { t.Errorf("Unexpected error: %v", err) } }, }, { name: "Disk URI not valid", testFunc: func(t *testing.T) { req := &csi.ControllerExpandVolumeRequest{ VolumeId: "vol_1", CapacityRange: stdCapRange, } ctx := context.Background() d, _ := NewFakeDriver(t) expectedErr := status.Errorf(codes.InvalidArgument, "disk URI(vol_1) is not valid: Inavlid DiskURI: vol_1, correct format: [/subscriptions/{sub-id}/resourcegroups/{group-name}/providers/microsoft.compute/disks/{disk-id}]") _, err := d.ControllerExpandVolume(ctx, req) if !reflect.DeepEqual(err, expectedErr) { t.Errorf("actualErr: (%v), expectedErr: (%v)", err, expectedErr) } }, }, { name: "DiskSize missing", testFunc: func(t *testing.T) { req := &csi.ControllerExpandVolumeRequest{ VolumeId: testVolumeID, CapacityRange: stdCapRange, } id := req.VolumeId diskProperties := compute.DiskProperties{} disk := compute.Disk{ ID: &id, DiskProperties: &diskProperties, } ctx := context.Background() d, _ := NewFakeDriver(t) ctrl := gomock.NewController(t) defer ctrl.Finish() mockDiskClient := mockdiskclient.NewMockInterface(ctrl) d.cloud = &azure.Cloud{} d.cloud.DisksClient = mockDiskClient mockDiskClient.EXPECT().Get(gomock.Any(), gomock.Any(), gomock.Any()).Return(disk, nil).AnyTimes() expectedErr := status.Errorf(codes.Internal, "could not get size of the disk(unit-test-volume)") _, err := d.ControllerExpandVolume(ctx, req) if !reflect.DeepEqual(err, expectedErr) { t.Errorf("actualErr: (%v), expectedErr: (%v)", err, expectedErr) } }, }, } for _, tc := range testCases { t.Run(tc.name, tc.testFunc) } }
explode_data.jsonl/59388
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1683 }
[ 2830, 3393, 2051, 38946, 18902, 1155, 353, 8840, 836, 8, 341, 6736, 36361, 1695, 1669, 526, 21, 19, 7, 20, 353, 220, 16, 15, 17, 19, 353, 220, 16, 15, 17, 19, 353, 220, 16, 15, 17, 19, 340, 6736, 12903, 6046, 1669, 609, 63229, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestMarshalAndUnmarshalString(t *testing.T) { const inputString = "INPUT STRING" inputValue := NewStringAttribute(inputString) marshaled, err := json.Marshal(inputValue) assert.Nil(t, err) var av DynamoDBAttributeValue err = json.Unmarshal(marshaled, &av) assert.Nil(t, err) assert.Equal(t, DataTypeString, av.DataType()) assert.Equal(t, inputString, av.String()) }
explode_data.jsonl/61708
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 144 }
[ 2830, 3393, 55438, 3036, 1806, 27121, 703, 1155, 353, 8840, 836, 8, 341, 4777, 1946, 703, 284, 330, 29421, 35255, 698, 22427, 1130, 1669, 1532, 703, 3907, 5384, 703, 340, 2109, 277, 75303, 11, 1848, 1669, 2951, 37271, 5384, 1130, 340, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestSTMSerialize(t *testing.T) { clus := NewClusterV3(t, &ClusterConfig{Size: 3}) defer clus.Terminate(t) etcdc := clus.RandClient() // set up initial keys keys := make([]string, 5) for i := 0; i < len(keys); i++ { keys[i] = fmt.Sprintf("foo-%d", i) } // update keys in full batches updatec := make(chan struct{}) go func() { defer close(updatec) for i := 0; i < 5; i++ { s := fmt.Sprintf("%d", i) ops := []v3.Op{} for _, k := range keys { ops = append(ops, v3.OpPut(k, s)) } if _, err := etcdc.Txn(context.TODO()).Then(ops...).Commit(); err != nil { t.Fatalf("couldn't put keys (%v)", err) } updatec <- struct{}{} } }() // read all keys in txn, make sure all values match errc := make(chan error) for range updatec { curEtcdc := clus.RandClient() applyf := func(stm concurrency.STM) error { vs := []string{} for i := range keys { vs = append(vs, stm.Get(keys[i])) } for i := range vs { if vs[0] != vs[i] { return fmt.Errorf("got vs[%d] = %v, want %v", i, vs[i], vs[0]) } } return nil } go func() { iso := concurrency.WithIsolation(concurrency.Serializable) _, err := concurrency.NewSTM(curEtcdc, applyf, iso) errc <- err }() } for i := 0; i < 5; i++ { if err := <-errc; err != nil { t.Error(err) } } }
explode_data.jsonl/51052
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 620 }
[ 2830, 3393, 784, 4826, 9050, 1155, 353, 8840, 836, 8, 341, 197, 4163, 1669, 1532, 28678, 53, 18, 1155, 11, 609, 28678, 2648, 90, 1695, 25, 220, 18, 3518, 16867, 1185, 355, 836, 261, 34016, 1155, 692, 197, 295, 72026, 1669, 1185, 355...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestValidFileFormat(t *testing.T) { const fullPath = "../../test/validConfig.json" fileConfig, loadErr := LoadConfig(fullPath) if loadErr != nil { t.Fatalf("Unexpected failure. Failed to read file: %s", loadErr) } const jsonString = `{ "scrapeTargets": [ { "url": "https://jsonplaceholder.typicode.com/users", "metrics": [ { "name": "name", "help": "help", "path": "json.path.01", "instrumentType": "gauge" }, { "name": "name", "help": "help", "path": "json.path.02", "instrumentType": "counter" } ], "labels": [ {"name": "LabelName", "value": "LabelValue"} ], "mimeType": "json", "jobName": "promName", "timeoutInSecs": 15 }, { "url": "https://jsonplaceholder.typicode.com/users", "metrics": [ { "name": "name", "help": "help", "path": "json.path.01", "instrumentType": "gauge" }, { "name": "name", "help": "help", "path": "json.path.02", "instrumentType": "counter" } ], "labels": [ {"name": "LabelName", "value": "LabelValue"} ], "mimeType": "json", "jobName": "promName", "timeoutInSecs": 15 } ], "pushGatewayUrl": "gateWayUrl" }` var jsonBytes = []byte(jsonString) var stringConfig *Config err := json.Unmarshal(jsonBytes, &stringConfig) if err != nil { t.Fatalf("Unexpected failure. Unable to unmarshal json: %s", err) } if !reflect.DeepEqual(fileConfig, stringConfig) { t.Fatalf("Config structs are not equal") } }
explode_data.jsonl/75884
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 848 }
[ 2830, 3393, 4088, 1703, 4061, 1155, 353, 8840, 836, 8, 1476, 4777, 85844, 284, 10208, 1944, 14, 1891, 2648, 4323, 1837, 17661, 2648, 11, 2795, 7747, 1669, 8893, 2648, 28907, 1820, 692, 743, 2795, 7747, 961, 2092, 341, 197, 3244, 30762, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestMuxMounts(t *testing.T) { r := NewRouter() r.Get("/{hash}", HandlerFunc(func(ctx context.Context, rc *fasthttp.RequestCtx) { v := URLParam(rc, "hash") rc.Write([]byte(fmt.Sprintf("/%s", v))) })) r.Route("/{hash}/share", func(r Router) { r.Get("/", HandlerFunc(func(ctx context.Context, rc *fasthttp.RequestCtx) { v := URLParam(rc, "hash") rc.Write([]byte(fmt.Sprintf("/%s/share", v))) })) r.Get("/{network}", HandlerFunc(func(ctx context.Context, rc *fasthttp.RequestCtx) { v := URLParam(rc, "hash") n := URLParam(rc, "network") rc.Write([]byte(fmt.Sprintf("/%s/share/%s", v, n))) })) }) m := NewRouter() m.Mount("/sharing", r) ts := NewTestServer(m) defer ts.Close() if _, body := testRequest(t, ts, "GET", "/sharing/aBc", nil); body != "/aBc" { t.Fatalf(body) } if _, body := testRequest(t, ts, "GET", "/sharing/aBc/share", nil); body != "/aBc/share" { t.Fatalf(body) } if _, body := testRequest(t, ts, "GET", "/sharing/aBc/share/twitter", nil); body != "/aBc/share/twitter" { t.Fatalf(body) } }
explode_data.jsonl/47940
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 483 }
[ 2830, 3393, 44, 2200, 16284, 82, 1155, 353, 8840, 836, 8, 341, 7000, 1669, 1532, 9523, 2822, 7000, 2234, 65871, 8296, 9545, 19954, 9626, 18552, 7502, 2266, 9328, 11, 10192, 353, 9349, 1254, 9659, 23684, 8, 341, 197, 5195, 1669, 5548, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestOneRender(t *testing.T) { rpool, err := NewRenderPool(sampledata.SlaveCmd, 1, 1, 1, 0, executionTimeout) require.Nil(t, err) coord := gopnik.TileCoord{ X: 0, Y: 0, Zoom: 1, Size: 1, } ansCh := make(chan *RenderPoolResponse) err = rpool.EnqueueRequest(coord, ansCh, gopnikrpc.Priority_HIGH) require.Nil(t, err) ans := <-ansCh require.Nil(t, ans.Error) require.Equal(t, len(ans.Tiles), 1) sampledata.CheckTile(t, ans.Tiles[0].Image, "1_0_0.png") }
explode_data.jsonl/50614
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 224 }
[ 2830, 3393, 3966, 6750, 1155, 353, 8840, 836, 8, 341, 7000, 10285, 11, 1848, 1669, 1532, 6750, 10551, 32968, 691, 808, 75, 523, 15613, 11, 220, 16, 11, 220, 16, 11, 220, 16, 11, 220, 15, 11, 11320, 7636, 340, 17957, 59678, 1155, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestStoreWatchExpireWithHiddenKey(t *testing.T) { s := newStore() fc := newFakeClock() s.clock = fc s.Create("/_foo", false, "bar", false, TTLOptionSet{ExpireTime: fc.Now().Add(500 * time.Millisecond)}) s.Create("/foofoo", false, "barbarbar", false, TTLOptionSet{ExpireTime: fc.Now().Add(1000 * time.Millisecond)}) w, _ := s.Watch("/", true, false, 0) c := w.EventChan() e := nbselect(c) testutil.AssertNil(t, e) fc.Advance(600 * time.Millisecond) s.DeleteExpiredKeys(fc.Now()) e = nbselect(c) testutil.AssertNil(t, e) fc.Advance(600 * time.Millisecond) s.DeleteExpiredKeys(fc.Now()) e = nbselect(c) testutil.AssertEqual(t, e.Action, "expire") testutil.AssertEqual(t, e.Node.Key, "/foofoo") }
explode_data.jsonl/44128
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 310 }
[ 2830, 3393, 6093, 14247, 8033, 554, 2354, 17506, 1592, 1155, 353, 8840, 836, 8, 341, 1903, 1669, 501, 6093, 741, 1166, 66, 1669, 501, 52317, 26104, 741, 1903, 50546, 284, 25563, 271, 1903, 7251, 4283, 62, 7975, 497, 895, 11, 330, 2257...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestNullValues(t *testing.T) { th := kusttest_test.NewKustTestHarness(t, "/app") th.WriteF("/app/deployment.yaml", ` apiVersion: apps/v1 kind: Deployment metadata: labels: app: example name: example spec: selector: matchLabels: app: example template: metadata: labels: app: example spec: containers: - args: null image: image name: example `) th.WriteF("/app/kustomization.yaml", ` apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization resources: - deployment.yaml `) m, err := th.MakeKustTarget().MakeCustomizedResMap() if err != nil { t.Fatalf("Err: %v", err) } th.AssertActualEqualsExpected(m, ` apiVersion: apps/v1 kind: Deployment metadata: labels: app: example name: example spec: selector: matchLabels: app: example template: metadata: labels: app: example spec: containers: - args: null image: image name: example `) }
explode_data.jsonl/17749
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 439 }
[ 2830, 3393, 3280, 6227, 1155, 353, 8840, 836, 8, 341, 70479, 1669, 595, 590, 1944, 4452, 7121, 42, 590, 2271, 74248, 1155, 11, 3521, 676, 1138, 70479, 4073, 37, 4283, 676, 22549, 52799, 33406, 497, 22074, 2068, 5637, 25, 10500, 5457, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestUpdateJobs_WhenOneOfThreeJobsIsMissing_SkipsMissingJob_OtherChangesSucceed_DifferentBatch(t *testing.T) { whenOneOfThreeJobsIsMissing_SkipsMissingJob_OtherChangesSucceed(t, 1) }
explode_data.jsonl/32074
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 65 }
[ 2830, 3393, 4289, 40667, 62, 4498, 3966, 2124, 19641, 40667, 3872, 25080, 1098, 74, 3077, 25080, 12245, 2232, 696, 11317, 50, 29264, 1557, 18277, 21074, 1155, 353, 8840, 836, 8, 341, 60180, 3966, 2124, 19641, 40667, 3872, 25080, 1098, 74,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestServiceBrokerDoesNotExist(t *testing.T) { // GIVEN require.NoError(t, v1beta1.AddToScheme(scheme.Scheme)) cli := fake.NewFakeClientWithScheme(scheme.Scheme) sut := NewBrokersFacade(cli, fixWorkingNs(), fixService(), logrus.New()) // WHEN sut.SetNamespace(fixDestNs()) ex, err := sut.Exist() // THEN require.NoError(t, err) assert.False(t, ex) }
explode_data.jsonl/24161
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 148 }
[ 2830, 3393, 1860, 65545, 21468, 45535, 1155, 353, 8840, 836, 8, 341, 197, 322, 89836, 198, 17957, 35699, 1155, 11, 348, 16, 19127, 16, 1904, 1249, 28906, 1141, 8058, 92719, 1171, 86448, 1669, 12418, 7121, 52317, 2959, 2354, 28906, 1141, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestInitEnvOpts_delegateDNSFromApp(t *testing.T) { testCases := map[string]struct { app *config.Application expectDeployer func(m *mocks.Mockdeployer) expectProgress func(m *mocks.Mockprogress) wantedErr string }{ "should call DelegateDNSPermissions when app and env are in different accounts": { app: &config.Application{ AccountID: "1234", Name: "crossaccountapp", Domain: "amazon.com", }, expectProgress: func(m *mocks.Mockprogress) { m.EXPECT().Start(fmt.Sprintf(fmtDNSDelegationStart, "4567")) m.EXPECT().Stop(log.Ssuccessf(fmtDNSDelegationComplete, "4567")) }, expectDeployer: func(m *mocks.Mockdeployer) { m.EXPECT().DelegateDNSPermissions(gomock.Any(), "4567").Return(nil) }, }, "should skip updating when app and env are in same account": { app: &config.Application{ AccountID: "4567", Name: "crossaccountapp", Domain: "amazon.com", }, expectProgress: func(m *mocks.Mockprogress) { m.EXPECT().Start(gomock.Any()).Times(0) }, expectDeployer: func(m *mocks.Mockdeployer) { m.EXPECT().DelegateDNSPermissions(gomock.Any(), gomock.Any()).Times(0) }, }, "should return errors from DelegateDNSPermissions": { app: &config.Application{ AccountID: "1234", Name: "crossaccountapp", Domain: "amazon.com", }, expectProgress: func(m *mocks.Mockprogress) { m.EXPECT().Start(fmt.Sprintf(fmtDNSDelegationStart, "4567")) m.EXPECT().Stop(log.Serrorf(fmtDNSDelegationFailed, "4567")) }, expectDeployer: func(m *mocks.Mockdeployer) { m.EXPECT().DelegateDNSPermissions(gomock.Any(), gomock.Any()).Return(fmt.Errorf("error")) }, wantedErr: "error", }, } for name, tc := range testCases { t.Run(name, func(t *testing.T) { // GIVEN ctrl := gomock.NewController(t) defer ctrl.Finish() mockDeployer := mocks.NewMockdeployer(ctrl) mockProgress := mocks.NewMockprogress(ctrl) if tc.expectDeployer != nil { tc.expectDeployer(mockDeployer) } if tc.expectProgress != nil { tc.expectProgress(mockProgress) } opts := &initEnvOpts{ initEnvVars: initEnvVars{ appName: tc.app.Name, }, appDeployer: mockDeployer, prog: mockProgress, } // WHEN err := opts.delegateDNSFromApp(tc.app, "4567") // THEN if tc.wantedErr != "" { require.EqualError(t, err, tc.wantedErr) } else { require.NoError(t, err) } }) } }
explode_data.jsonl/20011
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1143 }
[ 2830, 3393, 3803, 14359, 43451, 55312, 61088, 3830, 2164, 1155, 353, 8840, 836, 8, 341, 18185, 37302, 1669, 2415, 14032, 60, 1235, 341, 197, 28236, 310, 353, 1676, 17521, 198, 197, 24952, 69464, 261, 2915, 1255, 353, 16712, 82, 24664, 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 TestNewCollectorDirNotExist(t *testing.T) { _, err := NewCollector("dir-not-exist") if err == nil { t.Error("Expected to fail due to dir not exist") } }
explode_data.jsonl/36922
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 62 }
[ 2830, 3393, 3564, 53694, 6184, 45535, 1155, 353, 8840, 836, 8, 341, 197, 6878, 1848, 1669, 1532, 53694, 445, 3741, 29169, 10187, 380, 1138, 743, 1848, 621, 2092, 341, 197, 3244, 6141, 445, 18896, 311, 3690, 4152, 311, 5419, 537, 3000, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestStreamParser_Success2(t *testing.T) { s := ` <AAA> <CCC>c1</CCC> <BBB>b1</BBB> <DDD>d1</DDD> <BBB>b2</BBB> <CCC>c2</CCC> </AAA>` sp, err := CreateStreamParser(strings.NewReader(s), "/AAA/CCC | /AAA/DDD") if err != nil { t.Fatal(err.Error()) } // First Read() should return c1 n, err := sp.Read() if err != nil { t.Fatal(err.Error()) } testOutputXML(t, "first call result", `<CCC>c1</CCC>`, n) testOutputXML(t, "doc after first call", `<><?xml?><AAA><CCC>c1</CCC></AAA></>`, findRoot(n)) // Second Read() should return d1 n, err = sp.Read() if err != nil { t.Fatal(err.Error()) } testOutputXML(t, "second call result", `<DDD>d1</DDD>`, n) testOutputXML(t, "doc after second call", `<><?xml?><AAA><BBB>b1</BBB><DDD>d1</DDD></AAA></>`, findRoot(n)) // Third call should return c2 n, err = sp.Read() if err != nil { t.Fatal(err.Error()) } testOutputXML(t, "third call result", `<CCC>c2</CCC>`, n) testOutputXML(t, "doc after third call", `<><?xml?><AAA><BBB>b1</BBB><BBB>b2</BBB><CCC>c2</CCC></AAA></>`, findRoot(n)) _, err = sp.Read() if err != io.EOF { t.Fatalf("io.EOF expected, but got %v", err) } }
explode_data.jsonl/18850
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 548 }
[ 2830, 3393, 3027, 6570, 87161, 17, 1155, 353, 8840, 836, 8, 341, 1903, 1669, 22074, 197, 27, 50107, 397, 197, 197, 27, 53873, 56346, 16, 522, 53873, 397, 197, 197, 27, 10098, 33, 51407, 16, 522, 10098, 33, 397, 197, 197, 27, 91361, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestSyncReadStringTooShort(t *testing.T) { s := NewSyncScanner(strings.NewReader("\005\000\000\000h")) _, err := s.ReadString() assert.Equal(t, errIncompleteMessage("bytes", 1, 5), err) }
explode_data.jsonl/80531
{ "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, 12154, 4418, 703, 31246, 12472, 1155, 353, 8840, 836, 8, 341, 1903, 1669, 1532, 12154, 31002, 51442, 68587, 4921, 15, 15, 20, 59, 15, 15, 15, 59, 15, 15, 15, 59, 15, 15, 15, 71, 5455, 197, 6878, 1848, 1669, 274, 96738,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestSumOfDistancesInTree(t *testing.T) { testCases := []struct { got [][]int want []int }{ { got: [][]int{{0, 1}, {0, 2}, {2, 3}, {2, 4}, {2, 5}}, want: []int{8, 12, 6, 10, 10, 10}, }, { got: [][]int{}, want: []int{0}, }, { got: [][]int{{1, 0}}, want: []int{1, 1}, }, } for _, testCase := range testCases { actual := sumOfDistancesInTree(len(testCase.got)+1, testCase.got) assert.Check(t, is.DeepEqual(actual, testCase.want), fmt.Sprintf("%#v", testCase)) } }
explode_data.jsonl/159
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 260 }
[ 2830, 3393, 9190, 2124, 23356, 3020, 641, 6533, 1155, 353, 8840, 836, 8, 341, 18185, 37302, 1669, 3056, 1235, 341, 197, 3174, 354, 220, 52931, 396, 198, 197, 50780, 3056, 396, 198, 197, 59403, 197, 197, 515, 298, 3174, 354, 25, 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...
2
func TestGetTimeIntervalAligner(t *testing.T) { cases := []struct { title string ingestDelay time.Duration samplePeriod time.Duration collectionPeriod duration.Duration inputAligner string expectedAligner string }{ { "test collectionPeriod equals to samplePeriod", time.Duration(240) * time.Second, time.Duration(60) * time.Second, duration.Duration{ Seconds: int64(60), }, "", "ALIGN_NONE", }, { "test collectionPeriod larger than samplePeriod", time.Duration(240) * time.Second, time.Duration(60) * time.Second, duration.Duration{ Seconds: int64(300), }, "ALIGN_MEAN", "ALIGN_MEAN", }, { "test collectionPeriod smaller than samplePeriod", time.Duration(240) * time.Second, time.Duration(60) * time.Second, duration.Duration{ Seconds: int64(30), }, "ALIGN_MAX", "ALIGN_NONE", }, { "test collectionPeriod equals to samplePeriod with given aligner", time.Duration(240) * time.Second, time.Duration(60) * time.Second, duration.Duration{ Seconds: int64(60), }, "ALIGN_MEAN", "ALIGN_NONE", }, } for _, c := range cases { t.Run(c.title, func(t *testing.T) { _, aligner := getTimeIntervalAligner(c.ingestDelay, c.samplePeriod, c.collectionPeriod, c.inputAligner) assert.Equal(t, c.expectedAligner, aligner) }) } }
explode_data.jsonl/25014
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 609 }
[ 2830, 3393, 1949, 68041, 10069, 261, 1155, 353, 8840, 836, 8, 341, 1444, 2264, 1669, 3056, 1235, 341, 197, 24751, 310, 914, 198, 197, 197, 287, 477, 20039, 414, 882, 33795, 198, 197, 1903, 1516, 23750, 257, 882, 33795, 198, 197, 1444,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_wagerService_List(t *testing.T) { type fields struct { wagerRepository repositories.WagerRepository } type args struct { ctx context.Context req *dtos.ListWagersRequest } var ( wagerRepository = &mocksRepo.WagerRepository{} errWagerRepository = &mocksRepo.WagerRepository{} wagers = []*models.Wager{ { ID: 1, }, { ID: 2, }, } ) wagerRepository.On("List", mock.Anything, mock.Anything).Return(wagers, nil) errWagerRepository.On("List", mock.Anything, mock.Anything).Return(nil, errors.New("just an error")) tests := []struct { name string fields fields args args wantErr bool }{ { name: "good", fields: fields{ wagerRepository: wagerRepository, }, args: args{ ctx: context.Background(), req: &dtos.ListWagersRequest{}, }, wantErr: false, }, { name: "list error", fields: fields{ wagerRepository: errWagerRepository, }, args: args{ ctx: context.Background(), req: &dtos.ListWagersRequest{}, }, wantErr: true, }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { s := &wagerService{ wagerRepository: tt.fields.wagerRepository, } _, err := s.List(tt.args.ctx, tt.args.req) if (err != nil) != tt.wantErr { t.Errorf("List() error = %v, wantErr %v", err, tt.wantErr) return } if tt.wantErr { return } }) } }
explode_data.jsonl/47645
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 663 }
[ 2830, 3393, 1670, 1409, 1860, 27104, 1155, 353, 8840, 836, 8, 341, 13158, 5043, 2036, 341, 197, 6692, 1409, 4624, 49657, 1175, 1409, 4624, 198, 197, 532, 13158, 2827, 2036, 341, 197, 20985, 2266, 9328, 198, 197, 24395, 353, 8047, 436, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestPodContainer(t *testing.T) { cluster := &Cluster{rookVersion: "23", clusterInfo: cephclient.AdminClusterInfo("myosd")} cluster.clusterInfo.OwnerInfo = cephclient.NewMinimumOwnerInfo(t) osdProps := osdProperties{ crushHostname: "node", devices: []cephv1.Device{}, resources: v1.ResourceRequirements{}, storeConfig: config.StoreConfig{}, schedulerName: "custom-scheduler", } dataPathMap := &provisionConfig{ DataPathMap: opconfig.NewDatalessDaemonDataPathMap(cluster.clusterInfo.Namespace, "/var/lib/rook"), } c, err := cluster.provisionPodTemplateSpec(osdProps, v1.RestartPolicyAlways, dataPathMap) assert.NotNil(t, c) assert.Nil(t, err) assert.Equal(t, 1, len(c.Spec.InitContainers)) assert.Equal(t, 1, len(c.Spec.Containers)) assert.Equal(t, "custom-scheduler", c.Spec.SchedulerName) container := c.Spec.InitContainers[0] logger.Infof("container: %+v", container) assert.Equal(t, "copy-binaries", container.Args[0]) container = c.Spec.Containers[0] assert.Equal(t, "/rook/tini", container.Command[0]) assert.Equal(t, "--", container.Args[0]) assert.Equal(t, "/rook/rook", container.Args[1]) assert.Equal(t, "ceph", container.Args[2]) assert.Equal(t, "osd", container.Args[3]) assert.Equal(t, "provision", container.Args[4]) for _, c := range c.Spec.Containers { vars := operatortest.FindDuplicateEnvVars(c) assert.Equal(t, 0, len(vars)) } }
explode_data.jsonl/73001
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 573 }
[ 2830, 3393, 23527, 4502, 1155, 353, 8840, 836, 8, 341, 197, 18855, 1669, 609, 28678, 90, 299, 562, 5637, 25, 330, 17, 18, 497, 10652, 1731, 25, 272, 23544, 2972, 39469, 28678, 1731, 445, 2408, 436, 67, 42132, 197, 18855, 40501, 1731, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestCallGenerator(t *testing.T) { ctx := context.Background() sandbox, err := newService(&observation.TestContext).CreateSandbox(ctx, CreateOptions{}) if err != nil { t.Fatalf("unexpected error creating sandbox: %s", err) } defer sandbox.Close() script := ` local value = 0 local callback = function(upperBound, multiplier) for i=1,upperBound-1 do value = value + 1 coroutine.yield(value * multiplier) end return (value + 1) * multiplier end return callback ` retValue, err := sandbox.RunScript(ctx, RunOptions{}, script) if err != nil { t.Fatalf("unexpected error running script: %s", err) } callback, ok := retValue.(*lua.LFunction) if !ok { t.Fatalf("unexpected return type") } upperBound := 5 multiplier := 6 retValues, err := sandbox.CallGenerator(ctx, RunOptions{}, callback, upperBound, multiplier) if err != nil { t.Fatalf("unexpected error invoking callback: %s", err) } values := make([]int, 0, len(retValues)) for _, retValue := range retValues { values = append(values, int(lua.LVAsNumber(retValue))) } expectedValues := []int{ 6, // 1 * 6 12, // 2*6 18, // 3*6 24, // 4*6 30, // 5 * 6 (the return) } if diff := cmp.Diff(expectedValues, values); diff != "" { t.Errorf("unexpected file contents (-want +got):\n%s", diff) } }
explode_data.jsonl/21502
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 492 }
[ 2830, 3393, 7220, 12561, 1155, 353, 8840, 836, 8, 341, 20985, 1669, 2266, 19047, 2822, 1903, 31536, 11, 1848, 1669, 501, 1860, 2099, 77960, 8787, 1972, 568, 4021, 50, 31536, 7502, 11, 4230, 3798, 37790, 743, 1848, 961, 2092, 341, 197, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
7
func TestWrongFormatter(t *testing.T) { diff := digest.Differences{} formatter := NewFormatter(nil, nil, Context{format: "random-str"}) err := formatter.Format(diff) assert.Error(t, err) }
explode_data.jsonl/40614
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 70 }
[ 2830, 3393, 29185, 14183, 1155, 353, 8840, 836, 8, 341, 80564, 1669, 20882, 909, 58326, 16094, 197, 32941, 1669, 1532, 14183, 27907, 11, 2092, 11, 9608, 90, 2243, 25, 330, 11463, 41628, 1, 8824, 9859, 1669, 24814, 9978, 37124, 692, 6948...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestMAASServer(t *testing.T) { // Ensure the type implements the interface var _ api.MAASServer = (*MAASServer)(nil) // Create a new client to be used in the tests maasClient := NewMAASServer(client) t.Run("Get", func(t *testing.T) { t.Parallel() want := "the_value" httpmock.RegisterResponder("GET", "/MAAS/api/2.0/maas/", httpmock.NewStringResponder(http.StatusOK, want)) got, err := maasClient.Get("the_key") if err != nil { t.Fatal(err) } if diff := cmp.Diff(want, got, cmpopts.EquateEmpty()); diff != "" { t.Fatalf("Returned value mismatch (-want +got):\n%s", diff) } }) t.Run("Post", func(t *testing.T) { t.Parallel() httpmock.RegisterResponder("POST", "/MAAS/api/2.0/maas/", httpmock.NewStringResponder(http.StatusOK, "OK")) err := maasClient.Post("key", "value") if err != nil { t.Fatal(err) } }) }
explode_data.jsonl/77827
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 364 }
[ 2830, 3393, 4835, 4939, 2836, 1155, 353, 8840, 836, 8, 341, 197, 322, 29279, 279, 943, 5169, 279, 3749, 198, 2405, 716, 6330, 1321, 32, 4939, 2836, 284, 4609, 4835, 4939, 2836, 2376, 8385, 692, 197, 322, 4230, 264, 501, 2943, 311, 3...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestVersionObjectDelete(t *testing.T) { ctx := context.Background() c, rollback := makeConnectionWithVersionsObject(t) defer rollback() if skipVersionTests { t.Log("Server doesn't support Versions - skipping test") return } // Delete Version 3 if err := c.ObjectDelete(ctx, CURRENT_CONTAINER, OBJECT); err != nil { t.Fatal(err) } // Delete Version 2 if err := c.ObjectDelete(ctx, CURRENT_CONTAINER, OBJECT); err != nil { t.Fatal(err) } // Contents should be reverted to Version 1 if contents, err := c.ObjectGetString(ctx, CURRENT_CONTAINER, OBJECT); err != nil { t.Fatal(err) } else if contents != CONTENTS { t.Error("Contents wrong") } }
explode_data.jsonl/12712
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 239 }
[ 2830, 3393, 5637, 1190, 6435, 1155, 353, 8840, 836, 8, 341, 20985, 1669, 2266, 19047, 741, 1444, 11, 60414, 1669, 1281, 4526, 2354, 69015, 1190, 1155, 340, 16867, 60414, 741, 743, 10706, 5637, 18200, 341, 197, 3244, 5247, 445, 5475, 317...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestGroupKey(t *testing.T) { tests := []struct { name string ip string expected string }{ // Local addresses. {name: "ipv4 localhost", ip: "127.0.0.1", expected: "local"}, {name: "ipv6 localhost", ip: "::1", expected: "local"}, {name: "ipv4 zero", ip: "0.0.0.0", expected: "local"}, {name: "ipv4 first octet zero", ip: "0.1.2.3", expected: "local"}, // Unroutable addresses. {name: "ipv4 invalid bcast", ip: "255.255.255.255", expected: "unroutable"}, {name: "ipv4 rfc1918 10/8", ip: "10.1.2.3", expected: "unroutable"}, {name: "ipv4 rfc1918 172.16/12", ip: "172.16.1.2", expected: "unroutable"}, {name: "ipv4 rfc1918 192.168/16", ip: "192.168.1.2", expected: "unroutable"}, {name: "ipv6 rfc3849 2001:db8::/32", ip: "2001:db8::1234", expected: "unroutable"}, {name: "ipv4 rfc3927 169.254/16", ip: "169.254.1.2", expected: "unroutable"}, {name: "ipv6 rfc4193 fc00::/7", ip: "fc00::1234", expected: "unroutable"}, {name: "ipv6 rfc4843 2001:10::/28", ip: "2001:10::1234", expected: "unroutable"}, {name: "ipv6 rfc4862 fe80::/64", ip: "fe80::1234", expected: "unroutable"}, // IPv4 normal. {name: "ipv4 normal class a", ip: "12.1.2.3", expected: "12.1.0.0"}, {name: "ipv4 normal class b", ip: "173.1.2.3", expected: "173.1.0.0"}, {name: "ipv4 normal class c", ip: "196.1.2.3", expected: "196.1.0.0"}, // IPv6/IPv4 translations. {name: "ipv6 rfc3964 with ipv4 encap", ip: "2002:0c01:0203::", expected: "12.1.0.0"}, {name: "ipv6 rfc4380 toredo ipv4", ip: "2001:0:1234::f3fe:fdfc", expected: "12.1.0.0"}, {name: "ipv6 rfc6052 well-known prefix with ipv4", ip: "64:ff9b::0c01:0203", expected: "12.1.0.0"}, {name: "ipv6 rfc6145 translated ipv4", ip: "::ffff:0:0c01:0203", expected: "12.1.0.0"}, // Tor. {name: "ipv6 tor onioncat", ip: "fd87:d87e:eb43:1234::5678", expected: "tor:2"}, {name: "ipv6 tor onioncat 2", ip: "fd87:d87e:eb43:1245::6789", expected: "tor:2"}, {name: "ipv6 tor onioncat 3", ip: "fd87:d87e:eb43:1345::6789", expected: "tor:3"}, // IPv6 normal. {name: "ipv6 normal", ip: "2602:100::1", expected: "2602:100::"}, {name: "ipv6 normal 2", ip: "2602:0100::1234", expected: "2602:100::"}, {name: "ipv6 hurricane electric", ip: "2001:470:1f10:a1::2", expected: "2001:470:1000::"}, {name: "ipv6 hurricane electric 2", ip: "2001:0470:1f10:a1::2", expected: "2001:470:1000::"}, } for i, test := range tests { nip := net.ParseIP(test.ip) na := *wire.NewNetAddressIPPort(nip, 21102, wire.SFNodeNetwork) if key := addrmgr.GroupKey(&na); key != test.expected { t.Errorf("TestGroupKey #%d (%s): unexpected group key "+ "- got '%s', want '%s'", i, test.name, key, test.expected) } } }
explode_data.jsonl/10727
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1256 }
[ 2830, 3393, 2808, 1592, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 3056, 1235, 341, 197, 11609, 257, 914, 198, 197, 46531, 981, 914, 198, 197, 42400, 914, 198, 197, 59403, 197, 197, 322, 8774, 14230, 624, 197, 197, 47006, 25, 330, 4...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestSearch__fedwireCityOnlySearchRequest(t *testing.T) { u, _ := url.Parse("https://moov.io/fed/wire/search?city=IOWA City") req := readFEDSearchRequest(u) if req.City != "IOWA CITY" { t.Errorf("req.City=%s", req.City) } if !req.cityOnly() { t.Errorf("req is not city only") } }
explode_data.jsonl/71100
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 126 }
[ 2830, 3393, 5890, 563, 51123, 35531, 12730, 7308, 5890, 1900, 1155, 353, 8840, 836, 8, 341, 10676, 11, 716, 1669, 2515, 8937, 445, 2428, 1110, 6355, 859, 4245, 6663, 291, 6324, 554, 23167, 30, 8926, 28, 40, 3307, 32, 4311, 1138, 24395...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestParseFailure(t *testing.T) { testCases := []struct { desc string executable *executable.Executable env sshenv.Env arguments []string expectedError string }{ { desc: "It fails if SSH connection is not set", executable: &executable.Executable{Name: executable.GitlabShell}, arguments: []string{}, expectedError: "Only SSH allowed", }, { desc: "It fails if SSH command is invalid", executable: &executable.Executable{Name: executable.GitlabShell}, env: sshenv.Env{IsSSHConnection: true, OriginalCommand: `git receive-pack "`}, arguments: []string{}, expectedError: "Invalid SSH command", }, { desc: "With not enough arguments for the AuthorizedKeysCheck", executable: &executable.Executable{Name: executable.AuthorizedKeysCheck}, arguments: []string{"user"}, expectedError: "# Insufficient arguments. 1. Usage\n#\tgitlab-shell-authorized-keys-check <expected-username> <actual-username> <key>", }, { desc: "With too many arguments for the AuthorizedKeysCheck", executable: &executable.Executable{Name: executable.AuthorizedKeysCheck}, arguments: []string{"user", "user", "key", "something-else"}, expectedError: "# Insufficient arguments. 4. Usage\n#\tgitlab-shell-authorized-keys-check <expected-username> <actual-username> <key>", }, { desc: "With missing username for the AuthorizedKeysCheck", executable: &executable.Executable{Name: executable.AuthorizedKeysCheck}, arguments: []string{"user", "", "key"}, expectedError: "# No username provided", }, { desc: "With missing key for the AuthorizedKeysCheck", executable: &executable.Executable{Name: executable.AuthorizedKeysCheck}, arguments: []string{"user", "user", ""}, expectedError: "# No key provided", }, { desc: "With not enough arguments for the AuthorizedPrincipalsCheck", executable: &executable.Executable{Name: executable.AuthorizedPrincipalsCheck}, arguments: []string{"key"}, expectedError: "# Insufficient arguments. 1. Usage\n#\tgitlab-shell-authorized-principals-check <key-id> <principal1> [<principal2>...]", }, { desc: "With missing key_id for the AuthorizedPrincipalsCheck", executable: &executable.Executable{Name: executable.AuthorizedPrincipalsCheck}, arguments: []string{"", "principal"}, expectedError: "# No key_id provided", }, { desc: "With blank principal for the AuthorizedPrincipalsCheck", executable: &executable.Executable{Name: executable.AuthorizedPrincipalsCheck}, arguments: []string{"key", "principal", ""}, expectedError: "# An invalid principal was provided", }, } for _, tc := range testCases { t.Run(tc.desc, func(t *testing.T) { _, err := Parse(tc.executable, tc.arguments, tc.env) require.EqualError(t, err, tc.expectedError) }) } }
explode_data.jsonl/77817
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1164 }
[ 2830, 3393, 14463, 17507, 1155, 353, 8840, 836, 8, 341, 18185, 37302, 1669, 3056, 1235, 341, 197, 41653, 688, 914, 198, 197, 67328, 5922, 262, 353, 95924, 30798, 5922, 198, 197, 57538, 1843, 29230, 3160, 81214, 198, 197, 197, 16370, 257...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestPredicatePushDown(t *testing.T) { var input, output []string planSuiteUnexportedData.GetTestCases(t, &input, &output) s := createPlannerSuite() ctx := context.Background() for ith, ca := range input { comment := fmt.Sprintf("for %s", ca) stmt, err := s.p.ParseOneStmt(ca, "", "") require.NoError(t, err, comment) p, _, err := BuildLogicalPlanForTest(ctx, s.ctx, stmt, s.is) require.NoError(t, err) p, err = logicalOptimize(context.TODO(), flagPredicatePushDown|flagDecorrelate|flagPrunColumns|flagPrunColumnsAgain, p.(LogicalPlan)) require.NoError(t, err) testdata.OnRecord(func() { output[ith] = ToString(p) }) require.Equal(t, output[ith], ToString(p), fmt.Sprintf("for %s %d", ca, ith)) } }
explode_data.jsonl/50199
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 299 }
[ 2830, 3393, 36329, 16644, 4454, 1155, 353, 8840, 836, 8, 341, 2405, 1946, 11, 2550, 3056, 917, 198, 197, 10393, 28000, 1806, 1533, 291, 1043, 2234, 2271, 37302, 1155, 11, 609, 1355, 11, 609, 3006, 340, 1903, 1669, 1855, 2120, 4887, 28...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestGetFsInfo(t *testing.T) { r := fstest.NewRun(t) defer r.Finalise() f := r.Fremote info := operations.GetFsInfo(f) assert.Equal(t, f.Name(), info.Name) assert.Equal(t, f.Root(), info.Root) assert.Equal(t, f.String(), info.String) assert.Equal(t, f.Precision(), info.Precision) hashSet := hash.NewHashSet() for _, hashName := range info.Hashes { var ht hash.Type require.NoError(t, ht.Set(hashName)) hashSet.Add(ht) } assert.Equal(t, f.Hashes(), hashSet) assert.Equal(t, f.Features().Enabled(), info.Features) }
explode_data.jsonl/51951
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 228 }
[ 2830, 3393, 1949, 48300, 1731, 1155, 353, 8840, 836, 8, 341, 7000, 1669, 48434, 477, 7121, 6727, 1155, 340, 16867, 435, 991, 977, 1064, 2822, 1166, 1669, 435, 991, 18147, 198, 27043, 1669, 7525, 2234, 48300, 1731, 955, 340, 6948, 12808,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestTrimAllPrefixNonExistingPrefix(t *testing.T) { prefixes := []string{"value/", "fruit/"} assert.Equal(t, "type/legume/potiron", TrimAllPrefix(prefixes)("type/legume/potiron")) }
explode_data.jsonl/16595
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 73 }
[ 2830, 3393, 25656, 2403, 14335, 8121, 53067, 14335, 1155, 353, 8840, 836, 8, 341, 3223, 5060, 288, 1669, 3056, 917, 4913, 957, 28105, 330, 35598, 11225, 630, 6948, 12808, 1155, 11, 330, 1313, 14, 1937, 3885, 4322, 354, 2475, 497, 44376,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestGetBinaries(t *testing.T) { cases := []struct { config map[string]interface{} psOut string exp map[string]string expectErr bool }{ { config: map[string]interface{}{"components": []string{"apiserver"}, "apiserver": map[string]interface{}{"bins": []string{"apiserver", "kube-apiserver"}}}, psOut: "kube-apiserver", exp: map[string]string{"apiserver": "kube-apiserver"}, expectErr: false, }, { // "thing" is not in the list of components config: map[string]interface{}{"components": []string{"apiserver"}, "apiserver": map[string]interface{}{"bins": []string{"apiserver", "kube-apiserver"}}, "thing": map[string]interface{}{"bins": []string{"something else", "thing"}}}, psOut: "kube-apiserver thing", exp: map[string]string{"apiserver": "kube-apiserver"}, expectErr: false, }, { // "anotherthing" in list of components but doesn't have a definition config: map[string]interface{}{"components": []string{"apiserver", "anotherthing"}, "apiserver": map[string]interface{}{"bins": []string{"apiserver", "kube-apiserver"}}, "thing": map[string]interface{}{"bins": []string{"something else", "thing"}}}, psOut: "kube-apiserver thing", exp: map[string]string{"apiserver": "kube-apiserver"}, expectErr: false, }, { // more than one component config: map[string]interface{}{"components": []string{"apiserver", "thing"}, "apiserver": map[string]interface{}{"bins": []string{"apiserver", "kube-apiserver"}}, "thing": map[string]interface{}{"bins": []string{"something else", "thing"}}}, psOut: "kube-apiserver \nthing", exp: map[string]string{"apiserver": "kube-apiserver", "thing": "thing"}, expectErr: false, }, { // default binary to component name config: map[string]interface{}{"components": []string{"apiserver", "thing"}, "apiserver": map[string]interface{}{"bins": []string{"apiserver", "kube-apiserver"}}, "thing": map[string]interface{}{"bins": []string{"something else", "thing"}, "optional": true}}, psOut: "kube-apiserver \notherthing some params", exp: map[string]string{"apiserver": "kube-apiserver", "thing": "thing"}, expectErr: false, }, { // missing mandatory component config: map[string]interface{}{"components": []string{"apiserver", "thing"}, "apiserver": map[string]interface{}{"bins": []string{"apiserver", "kube-apiserver"}}, "thing": map[string]interface{}{"bins": []string{"something else", "thing"}, "optional": true}}, psOut: "otherthing some params", exp: map[string]string{"apiserver": "kube-apiserver", "thing": "thing"}, expectErr: true, }, } v := viper.New() psFunc = fakeps for id, c := range cases { t.Run(strconv.Itoa(id), func(t *testing.T) { g = c.psOut for k, val := range c.config { v.Set(k, val) } m, err := getBinaries(v, check.MASTER) if c.expectErr { if err == nil { t.Fatal("Got nil Expected error") } } else if !reflect.DeepEqual(m, c.exp) { t.Fatalf("Got %v\nExpected %v", m, c.exp) } }) } }
explode_data.jsonl/60196
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1290 }
[ 2830, 3393, 1949, 28794, 5431, 1155, 353, 8840, 836, 8, 341, 1444, 2264, 1669, 3056, 1235, 341, 197, 25873, 262, 2415, 14032, 31344, 16094, 197, 35009, 2662, 257, 914, 198, 197, 48558, 981, 2415, 14032, 30953, 198, 197, 24952, 7747, 180...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
5
func Test_parsePortsFromConfigMap(t *testing.T) { type args struct { configMap *v1.ConfigMap } tests := []struct { name string args args wantPorts []int wantErr bool }{ { name: "parsePortsFromConfigMap", args: args{configMap: &v1.ConfigMap{ Data: map[string]string{ "data": valuesConfigMapData, }, }}, wantPorts: []int{20000, 20001, 20002, 20003, 20004, 20005, 20006, 20007, 20008}, wantErr: false, }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { gotPorts, err := parsePortsFromConfigMap(tt.args.configMap) if (err != nil) != tt.wantErr { t.Errorf("parsePortsFromConfigMap() error = %v, wantErr %v", err, tt.wantErr) return } if !reflect.DeepEqual(gotPorts, tt.wantPorts) { t.Errorf("parsePortsFromConfigMap() gotPorts = %v, want %v", gotPorts, tt.wantPorts) } }) } }
explode_data.jsonl/66523
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 414 }
[ 2830, 3393, 21039, 68273, 3830, 2648, 2227, 1155, 353, 8840, 836, 8, 341, 13158, 2827, 2036, 341, 197, 25873, 2227, 353, 85, 16, 10753, 2227, 198, 197, 532, 78216, 1669, 3056, 1235, 341, 197, 11609, 414, 914, 198, 197, 31215, 414, 282...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestGetPvtDataCacheSize(t *testing.T) { oldVal := viper.Get(confPvtDataCacheSize) defer viper.Set(confPvtDataCacheSize, oldVal) val := GetPvtDataCacheSize() assert.Equal(t, val, 10) viper.Set(confPvtDataCacheSize, 99) val = GetPvtDataCacheSize() assert.Equal(t, val, 99) }
explode_data.jsonl/32264
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 119 }
[ 2830, 3393, 1949, 47, 9708, 1043, 8233, 1695, 1155, 353, 8840, 836, 8, 341, 61828, 2208, 1669, 95132, 2234, 29879, 47, 9708, 1043, 8233, 1695, 340, 16867, 95132, 4202, 29879, 47, 9708, 1043, 8233, 1695, 11, 2310, 2208, 692, 19302, 1669,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestNewReverseTranslator(t *testing.T) { tests := []struct { name string minorVersion version.MinorVersion wantVer string wantErr bool }{ { name: "version 1.4", minorVersion: version.NewMinorVersion(1, 4), wantVer: "1.4", wantErr: false, }, // TODO: implement 1.5 and fallback logic. { name: "version 1.99", minorVersion: version.NewMinorVersion(1, 99), wantVer: "", wantErr: true, }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { got, err := NewReverseTranslator(tt.minorVersion) if (err != nil) != tt.wantErr { t.Errorf("NewReverseTranslator() error = %v, wantErr %v", err, tt.wantErr) return } if got != nil && tt.wantVer != got.Version.String() { t.Errorf("NewReverseTranslator() got = %v, want %v", got.Version.String(), tt.wantVer) } }) } }
explode_data.jsonl/8377
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 436 }
[ 2830, 3393, 3564, 45695, 51653, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 3056, 1235, 341, 197, 11609, 260, 914, 198, 197, 25320, 269, 5637, 2319, 17070, 269, 5637, 198, 197, 50780, 10141, 414, 914, 198, 197, 50780, 7747, 414, 1807, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestWaitSelected(t *testing.T) { t.Parallel() ctx, cancel := testAllocate(t, "js.html") defer cancel() if err := Run(ctx, Click("#button3", ByID), WaitEnabled("#select1", ByID), ); err != nil { t.Fatalf("got error: %v", err) } var attr string ok := false if err := Run(ctx, AttributeValue(`//*[@id="select1"]/option[1]`, "selected", &attr, &ok)); err != nil { t.Fatalf("got error: %v", err) } if ok { t.Fatal("expected element to be not selected") } if err := Run(ctx, SetAttributeValue(`//*[@id="select1"]/option[1]`, "selected", "true"), WaitSelected(`//*[@id="select1"]/option[1]`), AttributeValue(`//*[@id="select1"]/option[1]`, "selected", &attr, nil), ); err != nil { t.Fatalf("got error: %v", err) } if attr != "true" { t.Fatal("expected element to be selected") } }
explode_data.jsonl/59460
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 345 }
[ 2830, 3393, 14190, 6316, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 2822, 20985, 11, 9121, 1669, 1273, 75380, 1155, 11, 330, 2519, 2564, 1138, 16867, 9121, 2822, 743, 1848, 1669, 6452, 7502, 345, 197, 197, 2612, 3584, 2159, 18, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
6