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 TestOverviewsSuccess(t *testing.T) { c := setupClient("testns", "ov1", false, false) d, err := c.Overviews(OverviewOptions{ Logger: &logfakes.Logger{}, Context: context.Background(), }) assert.Nil(t, err) assert.True(t, len(d) > 0) assert.Equal(t, "testns", d[0].Namespace) }
explode_data.jsonl/17750
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 121 }
[ 2830, 3393, 1918, 5072, 7188, 1155, 353, 8840, 836, 8, 341, 1444, 1669, 6505, 2959, 445, 1944, 4412, 497, 330, 859, 16, 497, 895, 11, 895, 692, 2698, 11, 1848, 1669, 272, 13, 1918, 5072, 7, 41044, 3798, 515, 197, 55861, 25, 220, 6...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestUPositionsADLEstimate(t *testing.T) { t.Parallel() if !areTestAPIKeysSet() { t.Skip("skipping test: api keys not set") } _, err := b.UPositionsADLEstimate(context.Background(), currency.NewPair(currency.BTC, currency.USDT)) if err != nil { t.Error(err) } }
explode_data.jsonl/76590
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 110 }
[ 2830, 3393, 3124, 2113, 82, 1808, 867, 267, 3426, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 741, 743, 753, 546, 2271, 7082, 8850, 1649, 368, 341, 197, 3244, 57776, 445, 4886, 5654, 1273, 25, 6330, 6894, 537, 738, 1138, 197, 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 TestBadServer(t *testing.T) { l, err := net.Listen("tcp", "localhost:0") if err != nil { t.Fatalf("Unable to listen: %s", err) } go func() { conn, err := l.Accept() if err == nil { if err := conn.Close(); err != nil { t.Fatalf("Unable to close connection: %v", err) } } }() dialer := NewDialer(Config{ DialServer: func() (net.Conn, error) { return net.Dial("tcp", l.Addr().String()) }, }) _, err = dialer.Dial("connect", "www.google.com") log.Debugf("Error: %v", err) assert.Error(t, err, "Dialing a server that disconnects too soon should have failed") }
explode_data.jsonl/15724
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 245 }
[ 2830, 3393, 17082, 5475, 1155, 353, 8840, 836, 8, 341, 8810, 11, 1848, 1669, 4179, 68334, 445, 27161, 497, 330, 8301, 25, 15, 1138, 743, 1848, 961, 2092, 341, 197, 3244, 30762, 445, 17075, 311, 8844, 25, 1018, 82, 497, 1848, 340, 19...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestChanRecvIssue789(t *testing.T) { gopClTest(t, ` func foo(ch chan int) (int, bool) { x, ok := (<-ch) return x, ok } `, `package main func foo(ch chan int) (int, bool) { x, ok := <-ch return x, ok } `) }
explode_data.jsonl/73579
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 100 }
[ 2830, 3393, 46019, 63483, 42006, 22, 23, 24, 1155, 353, 8840, 836, 8, 341, 3174, 453, 5066, 2271, 1155, 11, 22074, 2830, 15229, 7520, 26023, 526, 8, 320, 396, 11, 1807, 8, 341, 10225, 11, 5394, 1669, 22438, 12, 331, 340, 853, 856, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestScrapePoolReload(t *testing.T) { var mtx sync.Mutex numTargets := 20 stopped := map[uint64]bool{} reloadCfg := &config.ScrapeConfig{ ScrapeInterval: model.Duration(3 * time.Second), ScrapeTimeout: model.Duration(2 * time.Second), } // On starting to run, new loops created on reload check whether their preceding // equivalents have been stopped. newLoop := func(opts scrapeLoopOptions) loop { l := &testLoop{} l.startFunc = func(interval, timeout time.Duration, errc chan<- error) { if interval != 3*time.Second { t.Errorf("Expected scrape interval %d but got %d", 3*time.Second, interval) } if timeout != 2*time.Second { t.Errorf("Expected scrape timeout %d but got %d", 2*time.Second, timeout) } mtx.Lock() if !stopped[opts.scraper.(*targetScraper).hash()] { t.Errorf("Scrape loop for %v not stopped yet", opts.scraper.(*targetScraper)) } mtx.Unlock() } return l } sp := &scrapePool{ appendable: &nopAppendable{}, activeTargets: map[uint64]*Target{}, loops: map[uint64]loop{}, newLoop: newLoop, logger: nil, client: http.DefaultClient, } // Reloading a scrape pool with a new scrape configuration must stop all scrape // loops and start new ones. A new loop must not be started before the preceding // one terminated. for i := 0; i < numTargets; i++ { t := &Target{ labels: labels.FromStrings(model.AddressLabel, fmt.Sprintf("example.com:%d", i)), } l := &testLoop{} l.stopFunc = func() { time.Sleep(time.Duration(i*20) * time.Millisecond) mtx.Lock() stopped[t.hash()] = true mtx.Unlock() } sp.activeTargets[t.hash()] = t sp.loops[t.hash()] = l } done := make(chan struct{}) beforeTargets := map[uint64]*Target{} for h, t := range sp.activeTargets { beforeTargets[h] = t } reloadTime := time.Now() go func() { sp.reload(reloadCfg) close(done) }() select { case <-time.After(5 * time.Second): t.Fatalf("scrapeLoop.reload() did not return as expected") case <-done: // This should have taken at least as long as the last target slept. if time.Since(reloadTime) < time.Duration(numTargets*20)*time.Millisecond { t.Fatalf("scrapeLoop.stop() exited before all targets stopped") } } mtx.Lock() if len(stopped) != numTargets { t.Fatalf("Expected 20 stopped loops, got %d", len(stopped)) } mtx.Unlock() if !reflect.DeepEqual(sp.activeTargets, beforeTargets) { t.Fatalf("Reloading affected target states unexpectedly") } if len(sp.loops) != numTargets { t.Fatalf("Expected %d loops after reload but got %d", numTargets, len(sp.loops)) } }
explode_data.jsonl/56115
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1063 }
[ 2830, 3393, 3326, 19842, 10551, 50035, 1155, 353, 8840, 836, 8, 341, 2405, 81522, 12811, 99014, 198, 22431, 49030, 1669, 220, 17, 15, 271, 18388, 17573, 1669, 2415, 58, 2496, 21, 19, 96436, 31483, 91743, 42467, 1669, 609, 1676, 18326, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestMonitor_Stop(t *testing.T) { var mu sync.Mutex m := NewMonitor() var callCount int m.Comm = testComm{func() ([]Stats, error) { mu.Lock() callCount++ mu.Unlock() return make([]Stats, 0), nil }} s := <-m.Stream if s.Error != nil { t.Fatal(s.Error) } mu.Lock() expected := callCount mu.Unlock() m.Stop() // Read the values from the channel and ensure at the end that the channel // has been closed. for i := 0; i <= expected-1; i++ { select { case _, ok := <-m.Stream: if ok && i == expected-1 { t.Fatal("Expected stream to be closed after the last record is read") } } } // Ensure the callCount has stopped increasing. if expected != callCount { t.Fatalf("Unexpected callCount, Monitor should have stopped, expected=%v, got=%v", expected, callCount) } }
explode_data.jsonl/74154
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 308 }
[ 2830, 3393, 30098, 80308, 1155, 353, 8840, 836, 8, 341, 2405, 11834, 12811, 99014, 271, 2109, 1669, 1532, 30098, 741, 2405, 1618, 2507, 526, 198, 2109, 90852, 284, 1273, 17977, 90, 2830, 368, 34923, 16635, 11, 1465, 8, 341, 197, 2109, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestInPredicate4UnsignedInt(t *testing.T) { // for issue #6661 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 (a bigint unsigned,key (a));") tk.MustExec("INSERT INTO t VALUES (0), (4), (5), (6), (7), (8), (9223372036854775810), (18446744073709551614), (18446744073709551615);") r := tk.MustQuery(`SELECT a FROM t WHERE a NOT IN (-1, -2, 18446744073709551615);`) r.Check(testkit.Rows("0", "4", "5", "6", "7", "8", "9223372036854775810", "18446744073709551614")) r = tk.MustQuery(`SELECT a FROM t WHERE a NOT IN (-1, -2, 4, 9223372036854775810);`) r.Check(testkit.Rows("0", "5", "6", "7", "8", "18446744073709551614", "18446744073709551615")) r = tk.MustQuery(`SELECT a FROM t WHERE a NOT IN (-1, -2, 0, 4, 18446744073709551614);`) r.Check(testkit.Rows("5", "6", "7", "8", "9223372036854775810", "18446744073709551615")) // for issue #4473 tk.MustExec("drop table if exists t1") tk.MustExec("create table t1 (some_id smallint(5) unsigned,key (some_id) )") tk.MustExec("insert into t1 values (1),(2)") r = tk.MustQuery(`select some_id from t1 where some_id not in(2,-1);`) r.Check(testkit.Rows("1")) }
explode_data.jsonl/65461
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 551 }
[ 2830, 3393, 641, 36329, 19, 56421, 1072, 1155, 353, 8840, 836, 8, 341, 197, 322, 369, 4265, 671, 21, 21, 21, 16, 198, 57279, 11, 4240, 1669, 1273, 8226, 7251, 11571, 6093, 1155, 340, 16867, 4240, 2822, 3244, 74, 1669, 1273, 8226, 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 TestCSNothingRecoveredOnFreshStart(t *testing.T) { for _, st := range testStores { st := st t.Run(st.name, func(t *testing.T) { t.Parallel() defer endTest(t, st) s := startTest(t, st) defer s.Close() state, err := s.Recover() if err != nil { stackFatalf(t, "Error recovering state: %v", err) } if state != nil && (len(state.Channels) > 0 || len(state.Clients) > 0) { t.Fatalf("Nothing should have been recovered: %v", state) } }) } }
explode_data.jsonl/28293
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 214 }
[ 2830, 3393, 6412, 23780, 81476, 1925, 55653, 3479, 1155, 353, 8840, 836, 8, 341, 2023, 8358, 357, 1669, 2088, 1273, 69026, 341, 197, 18388, 1669, 357, 198, 197, 3244, 16708, 5895, 2644, 11, 2915, 1155, 353, 8840, 836, 8, 341, 298, 324...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestConfigUpdateError(t *testing.T) { client := &Client{ version: "1.30", client: newMockClient(errorMock(http.StatusInternalServerError, "Server error")), } err := client.ConfigUpdate(context.Background(), "config_id", swarm.Version{}, swarm.ConfigSpec{}) if err == nil || err.Error() != "Error response from daemon: Server error" { t.Fatalf("expected a Server Error, got %v", err) } }
explode_data.jsonl/59214
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 135 }
[ 2830, 3393, 2648, 4289, 1454, 1155, 353, 8840, 836, 8, 341, 25291, 1669, 609, 2959, 515, 197, 74954, 25, 330, 16, 13, 18, 15, 756, 197, 25291, 25, 220, 501, 11571, 2959, 6390, 11571, 19886, 66760, 11, 330, 5475, 1465, 30154, 197, 63...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestToValueFloat(t *testing.T) { vm := New() vm.Set("f64", float64(123)) vm.Set("f32", float32(321)) v, err := vm.RunString("f64 === 123 && f32 === 321") if err != nil { t.Fatal(err) } if v.Export().(bool) != true { t.Fatalf("StrictEquals for golang float failed") } }
explode_data.jsonl/10483
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 124 }
[ 2830, 3393, 1249, 1130, 5442, 1155, 353, 8840, 836, 8, 341, 54879, 1669, 1532, 741, 54879, 4202, 445, 69, 21, 19, 497, 2224, 21, 19, 7, 16, 17, 18, 1171, 54879, 4202, 445, 69, 18, 17, 497, 2224, 18, 17, 7, 18, 17, 16, 4390, 51...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestGetESURL(t *testing.T) { for _, v := range []struct { host string expected string useSSL bool }{ {"es-ssl", "https://es-ssl:9200", true}, {"es-bla", "http://es-bla:9200", false}, } { esURL := GetESURL(v.host, &v.useSSL) if esURL != v.expected { t.Errorf(fmt.Sprintf("Expected %s, got %s", v.expected, esURL)) } } }
explode_data.jsonl/81148
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 166 }
[ 2830, 3393, 1949, 1570, 3144, 1155, 353, 8840, 836, 8, 1476, 2023, 8358, 348, 1669, 2088, 3056, 1235, 341, 197, 63104, 257, 914, 198, 197, 42400, 914, 198, 197, 41819, 22594, 256, 1807, 198, 197, 59403, 197, 197, 4913, 288, 12, 24635,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestUCancelBatchOrders(t *testing.T) { t.Parallel() if !areTestAPIKeysSet() || !canManipulateRealOrders { t.Skip("skipping test: api keys not set or canManipulateRealOrders set to false") } _, err := b.UCancelBatchOrders(context.Background(), currency.NewPair(currency.BTC, currency.USDT), []string{"123"}, []string{}) if err != nil { t.Error(err) } }
explode_data.jsonl/76575
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 137 }
[ 2830, 3393, 5459, 4949, 21074, 24898, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 741, 743, 753, 546, 2271, 7082, 8850, 1649, 368, 1369, 753, 4814, 92876, 6334, 12768, 24898, 341, 197, 3244, 57776, 445, 4886, 5654, 1273, 25, 6330, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
4
func TestMakeFuncStackCopy(t *testing.T) { target := func(in []Value) []Value { runtime.GC() useStack(16) return []Value{ValueOf(9)} } var concrete func(*int, int) int fn := MakeFunc(ValueOf(concrete).Type(), target) ValueOf(&concrete).Elem().Set(fn) x := concrete(nil, 7) if x != 9 { t.Errorf("have %#q want 9", x) } }
explode_data.jsonl/29624
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 141 }
[ 2830, 3393, 8078, 9626, 4336, 12106, 1155, 353, 8840, 836, 8, 341, 28861, 1669, 2915, 5900, 3056, 1130, 8, 3056, 1130, 341, 197, 7000, 4466, 1224, 34, 741, 197, 41819, 4336, 7, 16, 21, 340, 197, 853, 3056, 1130, 90, 1130, 2124, 7, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestListVolumesWithFilter(t *testing.T) { type test struct { input []*model.VolumeSpec param map[string][]string expected []*model.VolumeSpec } tests := []test{ // select by storage type { input: []*model.VolumeSpec{ &SampleMultiVolumes[0], &SampleMultiVolumes[1], }, param: map[string][]string{ "size": {"1"}, }, expected: []*model.VolumeSpec{ &SampleMultiVolumes[1], }, }, // sort by name asc { input: []*model.VolumeSpec{ &SampleMultiVolumes[0], &SampleMultiVolumes[1], }, param: map[string][]string{ "sortKey": {"name"}, "sortDir": {"asc"}, }, expected: []*model.VolumeSpec{ &SampleMultiVolumes[0], &SampleMultiVolumes[1], }, }, // sort by name desc { input: []*model.VolumeSpec{ &SampleMultiVolumes[0], &SampleMultiVolumes[1], }, param: map[string][]string{ "sortKey": {"name"}, "sortDir": {"desc"}, }, expected: []*model.VolumeSpec{ &SampleMultiVolumes[1], &SampleMultiVolumes[0], }, }, // limit is 1 { input: []*model.VolumeSpec{ &SampleMultiVolumes[0], &SampleMultiVolumes[1], }, param: map[string][]string{ "limit": {"1"}, "offset": {"1"}, }, expected: []*model.VolumeSpec{ &SampleMultiVolumes[1], }, }, // DurableName Filter { input: []*model.VolumeSpec{ &SampleVolumeWithDurableName[0], }, param: map[string][]string{ "DurableName": {"6216b2326e974b5fb0b3d2af5cd6b25b"}, }, expected: []*model.VolumeSpec{ &SampleVolumeWithDurableName[0], }, }, } for _, testcase := range tests { ret := fc.FilterAndSort(testcase.input, testcase.param, sortableKeysMap[typeVolumes]) var res = []*model.VolumeSpec{} for _, data := range ret.([]interface{}) { res = append(res, data.(*model.VolumeSpec)) } if !reflect.DeepEqual(res, testcase.expected) { var expected []model.VolumeSpec for _, value := range testcase.expected { expected = append(expected, *value) } var got []model.VolumeSpec for _, value := range res { got = append(got, *value) } t.Errorf("Expected %+v\n", expected) t.Errorf("Got %+v\n", got) } } }
explode_data.jsonl/50717
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 994 }
[ 2830, 3393, 852, 96325, 2354, 5632, 1155, 353, 8840, 836, 8, 341, 13158, 1273, 2036, 341, 197, 22427, 262, 29838, 2528, 79106, 8327, 198, 197, 36037, 262, 2415, 14032, 45725, 917, 198, 197, 42400, 29838, 2528, 79106, 8327, 198, 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...
6
func TestChompBOM(t *testing.T) { t.Parallel() const utf8BOM = "\xef\xbb\xbf" cfg, fs := newTestCfg() writeSource(t, fs, filepath.Join("content", "simple.md"), utf8BOM+simplePage) s := buildSingleSite(t, deps.DepsCfg{Fs: fs, Cfg: cfg}, BuildCfg{SkipRender: true}) require.Len(t, s.RegularPages(), 1) p := s.RegularPages()[0] checkPageTitle(t, p, "Simple") }
explode_data.jsonl/60629
{ "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, 1143, 14435, 33, 1898, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 741, 4777, 10644, 23, 33, 1898, 284, 2917, 47510, 3462, 6066, 3462, 13233, 1837, 50286, 11, 8619, 1669, 501, 2271, 42467, 2822, 24945, 3608, 1155, 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 TestDownloadTo(t *testing.T) { srv := repotest.NewTempServerWithCleanupAndBasicAuth(t, "testdata/*.tgz*") defer srv.Stop() if err := srv.CreateIndex(); err != nil { t.Fatal(err) } if err := srv.LinkIndices(); err != nil { t.Fatal(err) } c := ChartDownloader{ Out: os.Stderr, Verify: VerifyAlways, Keyring: "testdata/helm-test-key.pub", RepositoryConfig: repoConfig, RepositoryCache: repoCache, Getters: getter.All(&cli.EnvSettings{ RepositoryConfig: repoConfig, RepositoryCache: repoCache, }), Options: []getter.Option{ getter.WithBasicAuth("username", "password"), getter.WithPassCredentialsAll(false), }, } cname := "/signtest-0.1.0.tgz" dest := srv.Root() where, v, err := c.DownloadTo(srv.URL()+cname, "", dest) if err != nil { t.Fatal(err) } if expect := filepath.Join(dest, cname); where != expect { t.Errorf("Expected download to %s, got %s", expect, where) } if v.FileHash == "" { t.Error("File hash was empty, but verification is required.") } if _, err := os.Stat(filepath.Join(dest, cname)); err != nil { t.Error(err) } }
explode_data.jsonl/1371
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 490 }
[ 2830, 3393, 11377, 1249, 1155, 353, 8840, 836, 8, 341, 1903, 10553, 1669, 2064, 354, 477, 7121, 12151, 5475, 2354, 67335, 3036, 15944, 5087, 1155, 11, 330, 92425, 23540, 41428, 89, 9, 1138, 16867, 43578, 30213, 741, 743, 1848, 1669, 435...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestFakeMapProtoText(t *testing.T) { seed := time.Now().UnixNano() popr := math_rand.New(math_rand.NewSource(seed)) p := NewPopulatedFakeMap(popr, true) dAtA := github_com_gogo_protobuf_proto.MarshalTextString(p) msg := &FakeMap{} if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } if err := p.VerboseEqual(msg); err != nil { t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err) } if !p.Equal(msg) { t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) } }
explode_data.jsonl/14892
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 264 }
[ 2830, 3393, 52317, 2227, 31549, 1178, 1155, 353, 8840, 836, 8, 341, 197, 22602, 1669, 882, 13244, 1005, 55832, 83819, 741, 3223, 46288, 1669, 6888, 33864, 7121, 37270, 33864, 7121, 3608, 44163, 1171, 3223, 1669, 1532, 11598, 7757, 52317, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestAutoScaling(t *testing.T) { // Create new backend with auto scaling enabled. b, err := New(context.Background(), map[string]interface{}{ "table_name": uuid.New() + "-test", "auto_scaling": true, "read_min_capacity": 10, "read_max_capacity": 20, "read_target_value": 50.0, "write_min_capacity": 10, "write_max_capacity": 20, "write_target_value": 50.0, }) require.NoError(t, err) // Remove table after tests are done. t.Cleanup(func() { require.NoError(t, deleteTable(context.Background(), b.svc, b.Config.TableName)) }) // Check auto scaling values match. resp, err := getAutoScaling(context.Background(), applicationautoscaling.New(b.session), b.Config.TableName) require.NoError(t, err) require.Equal(t, resp, &AutoScalingParams{ ReadMinCapacity: 10, ReadMaxCapacity: 20, ReadTargetValue: 50.0, WriteMinCapacity: 10, WriteMaxCapacity: 20, WriteTargetValue: 50.0, }) }
explode_data.jsonl/26990
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 371 }
[ 2830, 3393, 13253, 59684, 1155, 353, 8840, 836, 8, 341, 197, 322, 4230, 501, 19163, 448, 3233, 26943, 8970, 624, 2233, 11, 1848, 1669, 1532, 5378, 19047, 1507, 2415, 14032, 31344, 67066, 197, 197, 1, 2005, 1269, 788, 260, 16040, 7121, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestSQLCheck(t *testing.T) { var successCases = []struct { in string }{ {"select * from t"}, {" select * from t\n"}, {"/*!90620 set interpreter_mode=llvm*/"}, } for _, c := range successCases { if err := checkSQLQuery(c.in); err != nil { t.Errorf("Unexpected error checking query %s: %v", strconv.Quote(c.in), err) } } var failCases = []string{ "select * from t; select 1", "use db", "begin", } for _, c := range failCases { if err := checkSQLQuery(c); err == nil { t.Errorf("Unexpected success checking query %s", strconv.Quote(c)) } } }
explode_data.jsonl/51562
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 253 }
[ 2830, 3393, 6688, 3973, 1155, 353, 8840, 836, 8, 341, 2405, 2393, 37302, 284, 3056, 1235, 341, 197, 17430, 914, 198, 197, 59403, 197, 197, 4913, 1742, 353, 504, 259, 7115, 197, 197, 4913, 256, 3293, 353, 504, 259, 1699, 7115, 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...
5
func TestJet(t *testing.T) { var views = jet.NewHTMLSet("./jetviews") view, err := views.GetTemplate("bench.jet") if err != nil { t.Fatal(err) } rows := getBenchRows(10) var s strings.Builder err = view.Execute(&s, nil, rows) if err != nil { t.Fatal(err) } t.Logf("%s", s.String()) }
explode_data.jsonl/29300
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 131 }
[ 2830, 3393, 35641, 1155, 353, 8840, 836, 8, 341, 2405, 6194, 284, 16594, 7121, 5835, 1649, 13988, 15407, 5072, 5130, 36867, 11, 1848, 1669, 6194, 2234, 7275, 445, 27024, 30264, 1138, 743, 1848, 961, 2092, 341, 197, 3244, 26133, 3964, 34...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestUndirectWeighted(t *testing.T) { for i, test := range weightedDirectedGraphs { g := test.g() for _, e := range test.edges { g.SetWeightedEdge(e) } src := graph.UndirectWeighted{G: g, Absent: test.absent, Merge: test.merge} nodes := graph.NodesOf(src.Nodes()) dst := simple.NewUndirectedMatrixFrom(nodes, 0, 0, 0) for _, u := range nodes { for _, v := range graph.NodesOf(src.From(u.ID())) { dst.SetWeightedEdge(src.WeightedEdge(u.ID(), v.ID())) } } if !mat.Equal(dst.Matrix(), test.want) { t.Errorf("unexpected result for case %d:\ngot:\n%.4v\nwant:\n%.4v", i, mat.Formatted(dst.Matrix()), mat.Formatted(test.want), ) } } }
explode_data.jsonl/7636
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 312 }
[ 2830, 3393, 19957, 1226, 8295, 291, 1155, 353, 8840, 836, 8, 341, 2023, 600, 11, 1273, 1669, 2088, 36824, 92669, 11212, 82, 341, 197, 3174, 1669, 1273, 1302, 741, 197, 2023, 8358, 384, 1669, 2088, 1273, 44354, 341, 298, 3174, 4202, 82...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
6
func TestReRegisterContainerInstance(t *testing.T) { additionalAttributes := map[string]string{"my_custom_attribute": "Custom_Value1", "my_other_custom_attribute": "Custom_Value2", "attribute_name_with_no_value": "", } mockCtrl := gomock.NewController(t) defer mockCtrl.Finish() mockEC2Metadata := mock_ec2.NewMockEC2MetadataClient(mockCtrl) client, mc, _ := NewMockClient(mockCtrl, mockEC2Metadata, additionalAttributes) fakeCapabilities := []string{"capability1", "capability2"} expectedAttributes := map[string]string{ "ecs.os-type": config.OSType, } for i := range fakeCapabilities { expectedAttributes[fakeCapabilities[i]] = "" } capabilities := buildAttributeList(fakeCapabilities, nil) gomock.InOrder( mockEC2Metadata.EXPECT().GetDynamicData(ec2.InstanceIdentityDocumentResource).Return("instanceIdentityDocument", nil), mockEC2Metadata.EXPECT().GetDynamicData(ec2.InstanceIdentityDocumentSignatureResource).Return("signature", nil), mc.EXPECT().RegisterContainerInstance(gomock.Any()).Do(func(req *ecs.RegisterContainerInstanceInput) { assert.Equal(t, "arn:test", *req.ContainerInstanceArn, "Wrong container instance ARN") assert.Equal(t, configuredCluster, *req.Cluster, "Wrong cluster") assert.Equal(t, iid, *req.InstanceIdentityDocument, "Wrong IID") assert.Equal(t, iidSignature, *req.InstanceIdentityDocumentSignature, "Wrong IID sig") assert.Equal(t, 4, len(req.TotalResources), "Wrong length of TotalResources") resource, ok := findResource(req.TotalResources, "PORTS_UDP") assert.True(t, ok, `Could not find resource "PORTS_UDP"`) assert.Equal(t, "STRINGSET", *resource.Type, `Wrong type for resource "PORTS_UDP"`) // "ecs.os-type" and the 2 that we specified as additionalAttributes assert.Equal(t, 3, len(req.Attributes), "Wrong number of Attributes") reqAttributes := func() map[string]string { rv := make(map[string]string, len(req.Attributes)) for i := range req.Attributes { rv[*req.Attributes[i].Name] = aws.StringValue(req.Attributes[i].Value) } return rv }() for k, v := range reqAttributes { assert.Contains(t, expectedAttributes, k) assert.Equal(t, expectedAttributes[k], v) } }).Return(&ecs.RegisterContainerInstanceOutput{ ContainerInstance: &ecs.ContainerInstance{ ContainerInstanceArn: aws.String("registerArn"), Attributes: buildAttributeList(fakeCapabilities, expectedAttributes), }}, nil), ) arn, err := client.RegisterContainerInstance("arn:test", capabilities) if err != nil { t.Errorf("Should not be an error: %v", err) } if arn != "registerArn" { t.Errorf("Wrong arn: %v", arn) } }
explode_data.jsonl/61444
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 967 }
[ 2830, 3393, 693, 8690, 4502, 2523, 1155, 353, 8840, 836, 8, 341, 12718, 3005, 10516, 1669, 2415, 14032, 30953, 4913, 2408, 15875, 16791, 788, 330, 10268, 27867, 16, 756, 197, 197, 1, 2408, 30456, 15875, 16791, 788, 262, 330, 10268, 2786...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestSumMaxBlockedBW(t *testing.T) { cases := map[string]struct { blockedBW uint64 rsvsFcn func() []*segment.Reservation excludeID string }{ "empty": { blockedBW: 0, rsvsFcn: func() []*segment.Reservation { return nil }, excludeID: "ff0000010001beefcafe", }, "one reservation": { blockedBW: reservation.BWCls(5).ToKbps(), rsvsFcn: func() []*segment.Reservation { rsv := testNewRsv(t, "ff00:1:1", "01234567", 1, 2, 5, 5, 5) _, err := rsv.NewIndex(11, util.SecsToTime(3), 1, 1, 1, 1, reservation.CorePath) require.NoError(t, err) _, err = rsv.NewIndex(12, util.SecsToTime(3), 1, 1, 1, 1, reservation.CorePath) require.NoError(t, err) return []*segment.Reservation{rsv} }, excludeID: "ff0000010001beefcafe", }, "one reservation but excluded": { blockedBW: 0, rsvsFcn: func() []*segment.Reservation { rsv := testNewRsv(t, "ff00:1:1", "beefcafe", 1, 2, 5, 5, 5) _, err := rsv.NewIndex(11, util.SecsToTime(3), 1, 1, 1, 1, reservation.CorePath) require.NoError(t, err) _, err = rsv.NewIndex(12, util.SecsToTime(3), 1, 1, 1, 1, reservation.CorePath) require.NoError(t, err) return []*segment.Reservation{rsv} }, excludeID: "ff0000010001beefcafe", }, "many reservations": { blockedBW: 309, // 181 + 128 rsvsFcn: func() []*segment.Reservation { rsv := testNewRsv(t, "ff00:1:1", "beefcafe", 1, 2, 5, 5, 5) _, err := rsv.NewIndex(11, util.SecsToTime(3), 1, 17, 7, 1, reservation.CorePath) require.NoError(t, err) rsvs := []*segment.Reservation{rsv} rsv = testNewRsv(t, "ff00:1:1", "01234567", 1, 2, 5, 5, 5) _, err = rsv.NewIndex(11, util.SecsToTime(3), 1, 8, 8, 1, reservation.CorePath) require.NoError(t, err) _, err = rsv.NewIndex(12, util.SecsToTime(3), 1, 7, 7, 1, reservation.CorePath) require.NoError(t, err) rsvs = append(rsvs, rsv) rsv = testNewRsv(t, "ff00:1:2", "01234567", 1, 2, 5, 5, 5) _, err = rsv.NewIndex(11, util.SecsToTime(2), 1, 7, 7, 1, reservation.CorePath) require.NoError(t, err) rsvs = append(rsvs, rsv) return rsvs }, excludeID: "ff0000010001beefcafe", }, } for name, tc := range cases { name, tc := name, tc t.Run(name, func(t *testing.T) { t.Parallel() excludedID, err := reservation.IDFromRaw(xtest.MustParseHexString(tc.excludeID)) require.NoError(t, err) sum := sumMaxBlockedBW(tc.rsvsFcn(), *excludedID) require.Equal(t, tc.blockedBW, sum) }) } }
explode_data.jsonl/62139
{ "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, 9190, 5974, 95847, 77563, 1155, 353, 8840, 836, 8, 341, 1444, 2264, 1669, 2415, 14032, 60, 1235, 341, 197, 2233, 24633, 77563, 2622, 21, 19, 198, 197, 7000, 3492, 82, 62054, 256, 2915, 368, 29838, 23169, 8377, 8768, 198, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestInvalidECDecrypt(t *testing.T) { dec := ecDecrypterSigner{ privateKey: ecTestKey256, } generator := randomKeyGenerator{size: 16} // Missing epk header headers := rawHeader{ Alg: string(ECDH_ES), } _, err := dec.decryptKey(headers, nil, generator) if err == nil { t.Error("ec decrypter accepted object with missing epk header") } // Invalid epk header headers.Epk = &JSONWebKey{} _, err = dec.decryptKey(headers, nil, generator) if err == nil { t.Error("ec decrypter accepted object with invalid epk header") } }
explode_data.jsonl/63203
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 199 }
[ 2830, 3393, 7928, 7498, 89660, 1155, 353, 8840, 836, 8, 341, 197, 8169, 1669, 11942, 89660, 261, 7264, 261, 515, 197, 2455, 1592, 25, 11942, 2271, 1592, 17, 20, 21, 345, 197, 630, 3174, 15312, 1669, 4194, 1592, 12561, 90, 2141, 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 TestMarshalEtcdRaftMetadata(t *testing.T) { md := &etcdraft.ConfigMetadata{ Consenters: []*etcdraft.Consenter{ { Host: "node-1.example.com", Port: 7050, ClientTlsCert: []byte("testdata/tls-client-1.pem"), ServerTlsCert: []byte("testdata/tls-server-1.pem"), }, { Host: "node-2.example.com", Port: 7050, ClientTlsCert: []byte("testdata/tls-client-2.pem"), ServerTlsCert: []byte("testdata/tls-server-2.pem"), }, { Host: "node-3.example.com", Port: 7050, ClientTlsCert: []byte("testdata/tls-client-3.pem"), ServerTlsCert: []byte("testdata/tls-server-3.pem"), }, }, } packed, err := MarshalEtcdRaftMetadata(md) require.Nil(t, err, "marshalling should succeed") assert.NotNil(t, packed) packed, err = MarshalEtcdRaftMetadata(md) require.Nil(t, err, "marshalling should succeed a second time because we did not mutate ourselves") assert.NotNil(t, packed) unpacked := &etcdraft.ConfigMetadata{} require.Nil(t, proto.Unmarshal(packed, unpacked), "unmarshalling should succeed") var outputCerts, inputCerts [3][]byte for i := range unpacked.GetConsenters() { outputCerts[i] = []byte(unpacked.GetConsenters()[i].GetClientTlsCert()) inputCerts[i], _ = ioutil.ReadFile(fmt.Sprintf("testdata/tls-client-%d.pem", i+1)) } for i := 0; i < len(inputCerts)-1; i++ { require.NotEqual(t, outputCerts[i+1], outputCerts[i], "expected extracted certs to differ from each other") } }
explode_data.jsonl/53198
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 686 }
[ 2830, 3393, 55438, 31860, 4385, 55535, 723, 14610, 1155, 353, 8840, 836, 8, 341, 84374, 1669, 609, 295, 4385, 2944, 10753, 14610, 515, 197, 197, 15220, 306, 388, 25, 29838, 295, 4385, 2944, 94594, 1950, 515, 298, 197, 515, 571, 197, 9...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestFlusherSkipNow(t *testing.T) { dir, err := ioutil.TempDir("", "dcrtimed.test") if err != nil { t.Fatal(err) } defer os.RemoveAll(dir) fs, err := internalNew(dir) if err != nil { t.Fatal(err) } // Set testing flag. fs.testing = true // Put batch success in current time var hashes [][sha256.Size]byte count := 10 for i := 0; i < count; i++ { hash := [sha256.Size]byte{} hash[0] = byte(i) hashes = append(hashes, hash) } timestamp, me, err := fs.Put(hashes) if err != nil { t.Fatal(err) } if len(me) != count { t.Fatalf("expected %v multi error", count) } // Expect a 0 return because we skip current timestamp. flushed, err := fs.doFlush() if err != nil { t.Fatal(err) } if flushed != 0 { t.Fatalf("unexpected flushed got %v want 0", flushed) } // Check using isFlushed as well. if fs.isFlushed(timestamp) { t.Fatalf("unexpected now to not be flushed") } }
explode_data.jsonl/14962
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 379 }
[ 2830, 3393, 46874, 261, 35134, 7039, 1155, 353, 8840, 836, 8, 341, 48532, 11, 1848, 1669, 43144, 65009, 6184, 19814, 330, 7628, 3342, 75485, 5958, 1138, 743, 1848, 961, 2092, 341, 197, 3244, 26133, 3964, 340, 197, 630, 16867, 2643, 8442...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
9
func TestFills_GetFills(t *testing.T) { _ = godotenv.Load() ftx := New( WithAuth(os.Getenv("FTX_KEY"), os.Getenv("FTX_SECRET")), ) err := ftx.SetServerTimeDiff() require.NoError(t, err) market := "ETH/BTC" fills, err := ftx.Fills.GetFills(&models.GetFillsParams{ Market: &market, }) assert.NoError(t, err) assert.NotNil(t, fills) }
explode_data.jsonl/18188
{ "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, 37, 3305, 13614, 37, 3305, 1155, 353, 8840, 836, 8, 341, 197, 62, 284, 9886, 354, 3160, 13969, 2822, 18937, 87, 1669, 1532, 1006, 197, 197, 2354, 5087, 9638, 64883, 445, 3994, 55, 6600, 3975, 2643, 64883, 445, 3994, 55, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_WatchTable_KeepMinorNodeUpdates_AddNodeTwiceOnlyDiffIsTS_TwoOutputRow(t *testing.T) { ts1, err := ptypes.TimestampProto(someWatchTime) assert.Nil(t, err) ts2, err := ptypes.TimestampProto(someWatchTime.Add(time.Second)) assert.Nil(t, err) watchRec1 := &typed.KubeWatchResult{Kind: kubeextractor.NodeKind, WatchType: typed.KubeWatchResult_UPDATE, Timestamp: ts1, Payload: someNode} watchRec2 := &typed.KubeWatchResult{Kind: kubeextractor.NodeKind, WatchType: typed.KubeWatchResult_UPDATE, Timestamp: ts2, Payload: someNodeDiffTsAndRV} results := helper_runWatchTableProcessingOnInputs(t, []*typed.KubeWatchResult{watchRec1, watchRec2}, true) assert.Equal(t, 2, len(results)) }
explode_data.jsonl/38956
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 257 }
[ 2830, 3393, 2763, 754, 2556, 62, 19434, 57024, 1955, 37091, 21346, 1955, 22816, 558, 7308, 21751, 3872, 9951, 82989, 5097, 3102, 1155, 353, 8840, 836, 8, 341, 57441, 16, 11, 1848, 1669, 281, 9242, 49024, 31549, 1141, 635, 14247, 1462, 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 TestControllerDeletesMachinesOnJoinTimeout(t *testing.T) { tests := []struct { name string creationTimestamp metav1.Time hasNode bool ownerReferences []metav1.OwnerReference hasOwner bool getsDeleted bool joinTimeoutConfig *time.Duration }{ { name: "machine with node does not get deleted", creationTimestamp: metav1.Time{Time: time.Now().Add(-20 * time.Minute)}, hasNode: true, getsDeleted: false, joinTimeoutConfig: durationPtr(10 * time.Minute), }, { name: "machine without owner ref does not get deleted", creationTimestamp: metav1.Time{Time: time.Now().Add(-20 * time.Minute)}, hasNode: false, getsDeleted: false, joinTimeoutConfig: durationPtr(10 * time.Minute), }, { name: "machine younger than joinClusterTimeout does not get deleted", creationTimestamp: metav1.Time{Time: time.Now().Add(-9 * time.Minute)}, hasNode: false, ownerReferences: []metav1.OwnerReference{{Name: "owner", Kind: "MachineSet"}}, hasOwner: true, getsDeleted: false, joinTimeoutConfig: durationPtr(10 * time.Minute), }, { name: "machine older than joinClusterTimout gets deleted", creationTimestamp: metav1.Time{Time: time.Now().Add(-20 * time.Minute)}, hasNode: false, ownerReferences: []metav1.OwnerReference{{Name: "owner", Kind: "MachineSet"}}, getsDeleted: true, joinTimeoutConfig: durationPtr(10 * time.Minute), }, { name: "machine older than joinClusterTimout doesnt get deletet when ownerReference.Kind != MachineSet", creationTimestamp: metav1.Time{Time: time.Now().Add(-20 * time.Minute)}, hasNode: false, ownerReferences: []metav1.OwnerReference{{Name: "owner", Kind: "Cat"}}, getsDeleted: false, joinTimeoutConfig: durationPtr(10 * time.Minute), }, { name: "nil joinTimeoutConfig results in no deletions", creationTimestamp: metav1.Time{Time: time.Now().Add(-20 * time.Minute)}, hasNode: false, ownerReferences: []metav1.OwnerReference{{Name: "owner", Kind: "MachineSet"}}, getsDeleted: false, joinTimeoutConfig: nil, }, } for _, test := range tests { t.Run(test.name, func(t *testing.T) { machine := &clusterv1alpha1.Machine{ ObjectMeta: metav1.ObjectMeta{ Name: "my-machine", CreationTimestamp: test.creationTimestamp, OwnerReferences: test.ownerReferences}} node := &corev1.Node{} instance := &fakeInstance{} if test.hasNode { literalNode := getTestNode("test-id", "") node = &literalNode instance.id = "test-id" } providerConfig := &providerconfigtypes.Config{CloudProvider: providerconfigtypes.CloudProviderFake} client := ctrlruntimefake.NewFakeClient(node, machine) reconciler := Reconciler{ client: client, recorder: &record.FakeRecorder{}, joinClusterTimeout: test.joinTimeoutConfig, } if _, err := reconciler.ensureNodeOwnerRefAndConfigSource(instance, machine, providerConfig); err != nil { t.Fatalf("failed to call ensureNodeOwnerRefAndConfigSource: %v", err) } err := client.Get(context.Background(), types.NamespacedName{Name: machine.Name}, &clusterv1alpha1.Machine{}) wasDeleted := kerrors.IsNotFound(err) if wasDeleted != test.getsDeleted { t.Errorf("Machine was deleted: %v, but expectedDeletion: %v", wasDeleted, test.getsDeleted) } }) } }
explode_data.jsonl/59420
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1504 }
[ 2830, 3393, 2051, 61317, 44, 70142, 1925, 12292, 7636, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 3056, 1235, 341, 197, 11609, 1060, 914, 198, 197, 197, 37375, 20812, 77520, 16, 16299, 198, 197, 63255, 1955, 1843, 1807, 198, 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 TestFlatMap(t *testing.T) { op := func(v int) gs.Try[string] { return gs.Success(strconv.Itoa(v)) } assertTry(t, gs.Success("1"), try.FlatMap(gs.Success(1), op)) assertTry(t, gs.Failure[string](gs.ErrEmpty), try.FlatMap(gs.Failure[int](gs.ErrEmpty), op)) }
explode_data.jsonl/23075
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 125 }
[ 2830, 3393, 31019, 2227, 1155, 353, 8840, 836, 8, 341, 39703, 1669, 2915, 3747, 526, 8, 28081, 19824, 14032, 60, 341, 197, 853, 28081, 33320, 4199, 12027, 64109, 3747, 1171, 197, 630, 6948, 21453, 1155, 11, 28081, 33320, 445, 16, 3975, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_createWorkflowPod_containerName(t *testing.T) { woc := newWoc() pod, err := woc.createWorkflowPod(context.Background(), "", []apiv1.Container{{Name: "invalid", Command: []string{""}}}, &wfv1.Template{}, &createWorkflowPodOpts{}) assert.NoError(t, err) assert.Equal(t, common.MainContainerName, pod.Spec.Containers[1].Name) }
explode_data.jsonl/75381
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 125 }
[ 2830, 3393, 8657, 62768, 23527, 15847, 675, 1155, 353, 8840, 836, 8, 341, 6692, 509, 1669, 501, 54, 509, 741, 3223, 347, 11, 1848, 1669, 289, 509, 2520, 62768, 23527, 5378, 19047, 1507, 7342, 3056, 391, 344, 16, 33672, 2979, 675, 25, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestGetECDSAPublicKey(t *testing.T) { ctx := &MockCtx{} s := &Session{ctx, 0} // test attribute retrieval failing ctx.GetAttributeValueFunc = func(pkcs11.SessionHandle, pkcs11.ObjectHandle, []*pkcs11.Attribute) ([]*pkcs11.Attribute, error) { return nil, errors.New("yup") } _, err := s.GetECDSAPublicKey(0) test.AssertError(t, err, "ecPub didn't fail on GetAttributeValue error") // test we fail to construct key with missing params and point ctx.GetAttributeValueFunc = func(pkcs11.SessionHandle, pkcs11.ObjectHandle, []*pkcs11.Attribute) ([]*pkcs11.Attribute, error) { return []*pkcs11.Attribute{}, nil } _, err = s.GetECDSAPublicKey(0) test.AssertError(t, err, "ecPub didn't fail with empty attribute list") // test we fail to construct key with unknown curve ctx.GetAttributeValueFunc = func(pkcs11.SessionHandle, pkcs11.ObjectHandle, []*pkcs11.Attribute) ([]*pkcs11.Attribute, error) { return []*pkcs11.Attribute{ pkcs11.NewAttribute(pkcs11.CKA_EC_PARAMS, []byte{1, 2, 3}), }, nil } _, err = s.GetECDSAPublicKey(0) test.AssertError(t, err, "ecPub didn't fail with unknown curve") // test we fail to construct key with invalid EC point (invalid encoding) ctx.GetAttributeValueFunc = func(pkcs11.SessionHandle, pkcs11.ObjectHandle, []*pkcs11.Attribute) ([]*pkcs11.Attribute, error) { return []*pkcs11.Attribute{ pkcs11.NewAttribute(pkcs11.CKA_EC_PARAMS, []byte{6, 8, 42, 134, 72, 206, 61, 3, 1, 7}), pkcs11.NewAttribute(pkcs11.CKA_EC_POINT, []byte{255}), }, nil } _, err = s.GetECDSAPublicKey(0) test.AssertError(t, err, "ecPub didn't fail with invalid EC point (invalid encoding)") // test we fail to construct key with invalid EC point (empty octet string) ctx.GetAttributeValueFunc = func(pkcs11.SessionHandle, pkcs11.ObjectHandle, []*pkcs11.Attribute) ([]*pkcs11.Attribute, error) { return []*pkcs11.Attribute{ pkcs11.NewAttribute(pkcs11.CKA_EC_PARAMS, []byte{6, 8, 42, 134, 72, 206, 61, 3, 1, 7}), pkcs11.NewAttribute(pkcs11.CKA_EC_POINT, []byte{4, 0}), }, nil } _, err = s.GetECDSAPublicKey(0) test.AssertError(t, err, "ecPub didn't fail with invalid EC point (empty octet string)") // test we fail to construct key with invalid EC point (octet string, invalid contents) ctx.GetAttributeValueFunc = func(pkcs11.SessionHandle, pkcs11.ObjectHandle, []*pkcs11.Attribute) ([]*pkcs11.Attribute, error) { return []*pkcs11.Attribute{ pkcs11.NewAttribute(pkcs11.CKA_EC_PARAMS, []byte{6, 8, 42, 134, 72, 206, 61, 3, 1, 7}), pkcs11.NewAttribute(pkcs11.CKA_EC_POINT, []byte{4, 4, 4, 1, 2, 3}), }, nil } _, err = s.GetECDSAPublicKey(0) test.AssertError(t, err, "ecPub didn't fail with invalid EC point (octet string, invalid contents)") // test we don't fail with the correct attributes (traditional encoding) ctx.GetAttributeValueFunc = func(pkcs11.SessionHandle, pkcs11.ObjectHandle, []*pkcs11.Attribute) ([]*pkcs11.Attribute, error) { return []*pkcs11.Attribute{ pkcs11.NewAttribute(pkcs11.CKA_EC_PARAMS, []byte{6, 5, 43, 129, 4, 0, 33}), pkcs11.NewAttribute(pkcs11.CKA_EC_POINT, []byte{4, 217, 225, 246, 210, 153, 134, 246, 104, 95, 79, 122, 206, 135, 241, 37, 114, 199, 87, 56, 167, 83, 56, 136, 174, 6, 145, 97, 239, 221, 49, 67, 148, 13, 126, 65, 90, 208, 195, 193, 171, 105, 40, 98, 132, 124, 30, 189, 215, 197, 178, 226, 166, 238, 240, 57, 215}), }, nil } _, err = s.GetECDSAPublicKey(0) test.AssertNotError(t, err, "ecPub failed with valid attributes (traditional encoding)") // test we don't fail with the correct attributes (non-traditional encoding) ctx.GetAttributeValueFunc = func(pkcs11.SessionHandle, pkcs11.ObjectHandle, []*pkcs11.Attribute) ([]*pkcs11.Attribute, error) { return []*pkcs11.Attribute{ pkcs11.NewAttribute(pkcs11.CKA_EC_PARAMS, []byte{6, 5, 43, 129, 4, 0, 33}), pkcs11.NewAttribute(pkcs11.CKA_EC_POINT, []byte{4, 57, 4, 217, 225, 246, 210, 153, 134, 246, 104, 95, 79, 122, 206, 135, 241, 37, 114, 199, 87, 56, 167, 83, 56, 136, 174, 6, 145, 97, 239, 221, 49, 67, 148, 13, 126, 65, 90, 208, 195, 193, 171, 105, 40, 98, 132, 124, 30, 189, 215, 197, 178, 226, 166, 238, 240, 57, 215}), }, nil } _, err = s.GetECDSAPublicKey(0) test.AssertNotError(t, err, "ecPub failed with valid attributes (non-traditional encoding)") }
explode_data.jsonl/1152
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1733 }
[ 2830, 3393, 1949, 7498, 5936, 2537, 475, 1592, 1155, 353, 8840, 836, 8, 341, 20985, 1669, 609, 11571, 23684, 16094, 1903, 1669, 609, 5283, 90, 3773, 11, 220, 15, 630, 197, 322, 1273, 7035, 56370, 21394, 198, 20985, 2234, 78554, 9626, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestHandshakeClientALPNNoMatch(t *testing.T) { config := *testConfig config.NextProtos = []string{"proto3"} test := &clientTest{ name: "ALPN-NoMatch", // Note that this needs OpenSSL 1.0.2 because that is the first // version that supports the -alpn flag. command: []string{"openssl", "s_server", "-alpn", "proto1,proto2"}, config: &config, validate: func(state ConnectionState) error { // There's no overlap so OpenSSL will not select a protocol. if state.NegotiatedProtocol != "" { return fmt.Errorf("Got protocol %q, wanted ''", state.NegotiatedProtocol) } return nil }, } runClientTestTLS12(t, test) }
explode_data.jsonl/19956
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 237 }
[ 2830, 3393, 2314, 29661, 2959, 969, 17896, 2753, 8331, 1155, 353, 8840, 836, 8, 341, 25873, 1669, 353, 1944, 2648, 198, 25873, 18501, 12423, 436, 284, 3056, 917, 4913, 15110, 18, 63159, 18185, 1669, 609, 2972, 2271, 515, 197, 11609, 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...
2
func TestRowsFail(t *testing.T) { ri := newRows(&badResult1) var dest []driver.Value err := ri.Next(dest) want := "length mismatch: dest is 0, fields are 1" if err == nil || err.Error() != want { t.Errorf("Next: %v, want %s", err, want) } ri = newRows(&badResult1) dest = make([]driver.Value, 1) err = ri.Next(dest) want = "internal error: length mismatch: dest is 1, fields are 0" if err == nil || err.Error() != want { t.Errorf("Next: %v, want %s", err, want) } ri = newRows(&badResult2) dest = make([]driver.Value, 1) err = ri.Next(dest) want = `conversion error: field: {field1 3 0}, val: value: strconv.ParseInt: parsing "value": invalid syntax` if err == nil || err.Error() != want { t.Errorf("Next: %v, want %s", err, want) } }
explode_data.jsonl/30385
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 302 }
[ 2830, 3393, 9024, 19524, 1155, 353, 8840, 836, 8, 341, 197, 461, 1669, 501, 9024, 2099, 13855, 2077, 16, 340, 2405, 3201, 3056, 12521, 6167, 198, 9859, 1669, 24185, 18501, 27010, 340, 50780, 1669, 330, 4129, 35301, 25, 3201, 374, 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...
7
func TestString(t *testing.T) { t.Parallel() pair := NewCurrencyPair("BTC", "USD") actual := "BTCUSD" expected := pair.Pair().String() if actual != expected { t.Errorf("Test failed. String(): %s was not equal to expected value: %s", actual, expected) } }
explode_data.jsonl/55826
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 97 }
[ 2830, 3393, 703, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 741, 3223, 1310, 1669, 1532, 26321, 12443, 445, 59118, 497, 330, 26749, 1138, 88814, 1669, 330, 59118, 26749, 698, 42400, 1669, 6716, 1069, 1310, 1005, 703, 741, 743, 504...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestFunctionsTypeInference(t *testing.T) { functions := []string{ `foo([a, b]) = y { split(a, b, y) }`, `bar(x) = y { count(x, y) }`, `baz([x, y]) = z { sprintf("%s%s", [x, y], z) }`, `qux({"bar": x, "foo": y}) = {a: b} { upper(y, a); json.unmarshal(x, b) }`, `corge(x) = y { qux({"bar": x, "foo": x}, a); baz([a["{5: true}"], "BUZ"], y) }`, } body := strings.Join(functions, "\n") base := fmt.Sprintf("package base\n%s", body) c := NewCompiler() if c.Compile(map[string]*Module{"base": MustParseModule(base)}); c.Failed() { t.Fatalf("Failed to compile base module: %v", c.Errors) } tests := []struct { body string wantErr bool }{ { `fn(_) = y { data.base.foo(["hello", 5], y) }`, true, }, { `fn(_) = y { data.base.foo(["hello", "ll"], y) }`, false, }, { `fn(_) = y { data.base.baz(["hello", "ll"], y) }`, false, }, { `fn(_) = y { data.base.baz([5, ["foo", "bar", true]], y) }`, false, }, { `fn(_) = y { data.base.baz(["hello", {"a": "b", "c": 3}], y) }`, false, }, { `fn(_) = y { data.base.corge("this is not json", y) }`, false, }, { `fn(x) = y { data.non_existent(x, a); y = a[0] }`, true, }, { `fn(x) = y { y = [x] }`, false, }, { `f(x) = y { [x] = y }`, false, }, { `fn(x) = y { y = {"k": x} }`, false, }, { `f(x) = y { {"k": x} = y }`, false, }, { `p { [data.base.foo] }`, true, }, { `p { x = data.base.foo }`, true, }, { `p { data.base.foo(data.base.bar) }`, true, }, } for n, test := range tests { t.Run(fmt.Sprintf("Test Case %d", n), func(t *testing.T) { mod := MustParseModule(fmt.Sprintf("package test\n%s", test.body)) c := NewCompiler() c.Compile(map[string]*Module{"base": MustParseModule(base), "mod": mod}) if test.wantErr && !c.Failed() { t.Errorf("Expected error but got success") } else if !test.wantErr && c.Failed() { t.Errorf("Expected success but got error: %v", c.Errors) } }) } }
explode_data.jsonl/14568
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1051 }
[ 2830, 3393, 25207, 929, 641, 2202, 1155, 353, 8840, 836, 8, 341, 7527, 82, 1669, 3056, 917, 515, 197, 197, 63, 7975, 2561, 64, 11, 293, 2467, 284, 379, 314, 6718, 2877, 11, 293, 11, 379, 8, 335, 12892, 197, 197, 63, 2257, 2075, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestSyncPodsSetStatusToFailedForPodsThatRunTooLong(t *testing.T) { testKubelet := newTestKubelet(t) fakeRuntime := testKubelet.fakeRuntime testKubelet.fakeCadvisor.On("MachineInfo").Return(&cadvisorapi.MachineInfo{}, nil) kubelet := testKubelet.kubelet now := unversioned.Now() startTime := unversioned.NewTime(now.Time.Add(-1 * time.Minute)) exceededActiveDeadlineSeconds := int64(30) pods := []*api.Pod{ { ObjectMeta: api.ObjectMeta{ UID: "12345678", Name: "bar", Namespace: "new", }, Spec: api.PodSpec{ Containers: []api.Container{ {Name: "foo"}, }, ActiveDeadlineSeconds: &exceededActiveDeadlineSeconds, }, Status: api.PodStatus{ StartTime: &startTime, }, }, } fakeRuntime.PodList = []*kubecontainer.Pod{ { ID: "12345678", Name: "bar", Namespace: "new", Containers: []*kubecontainer.Container{ {Name: "foo"}, }, }, } // Let the pod worker sets the status to fail after this sync. kubelet.HandlePodUpdates(pods) status, found := kubelet.statusManager.GetPodStatus(pods[0].UID) if !found { t.Errorf("expected to found status for pod %q", pods[0].UID) } if status.Phase != api.PodFailed { t.Fatalf("expected pod status %q, ot %q.", api.PodFailed, status.Phase) } }
explode_data.jsonl/43349
{ "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, 12154, 23527, 82, 1649, 2522, 1249, 9408, 2461, 23527, 82, 4792, 6727, 31246, 6583, 1155, 353, 8840, 836, 8, 341, 18185, 42, 3760, 1149, 1669, 501, 2271, 42, 3760, 1149, 1155, 340, 1166, 726, 15123, 1669, 1273, 42, 3760, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestKeyExpiry(t *testing.T) { kring, _ := ReadKeyRing(readerFromHex(expiringKeyHex)) entity := kring[0] const timeFormat = "2006-01-02" time1, _ := time.Parse(timeFormat, "2013-07-01") // The expiringKeyHex key is structured as: // // pub 1024R/5E237D8C created: 2013-07-01 expires: 2013-07-31 usage: SC // sub 1024R/1ABB25A0 created: 2013-07-01 23:11:07 +0200 CEST expires: 2013-07-08 usage: E // sub 1024R/96A672F5 created: 2013-07-01 23:11:23 +0200 CEST expires: 2013-07-31 usage: E // // So this should select the newest, non-expired encryption key. key, _ := entity.encryptionKey(time1) if id := key.PublicKey.KeyIdShortString(); id != "96A672F5" { t.Errorf("Expected key 1ABB25A0 at time %s, but got key %s", time1.Format(timeFormat), id) } // Once the first encryption subkey has expired, the second should be // selected. time2, _ := time.Parse(timeFormat, "2013-07-09") key, _ = entity.encryptionKey(time2) if id := key.PublicKey.KeyIdShortString(); id != "96A672F5" { t.Errorf("Expected key 96A672F5 at time %s, but got key %s", time2.Format(timeFormat), id) } // Once all the keys have expired, nothing should be returned. time3, _ := time.Parse(timeFormat, "2013-08-01") if key, ok := entity.encryptionKey(time3); ok { t.Errorf("Expected no key at time %s, but got key %s", time3.Format(timeFormat), key.PublicKey.KeyIdShortString()) } }
explode_data.jsonl/14733
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 561 }
[ 2830, 3393, 1592, 840, 48209, 1155, 353, 8840, 836, 8, 341, 197, 9855, 287, 11, 716, 1669, 4457, 1592, 43466, 21987, 3830, 20335, 25865, 6191, 1592, 20335, 1171, 52987, 1669, 595, 12640, 58, 15, 2533, 4777, 882, 4061, 284, 330, 17, 15...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
4
func TestGetKeyAccessedTableID(t *testing.T) { tbPrefix := tablecodec.TablePrefix() prefix0 := encodeTableKey(0) prefixMax := encodeTableKey(math.MaxInt64) prefixNegative := encodeTableKey(-1) prefix1 := encodeTableKey(1) prefixA := encodeTableKey(math.MaxInt64 / 2) prefixB := encodeTableKey(math.MaxInt64 - 1) cases := []struct { name string key kv.Key ok bool testSuffix bool tbID int64 }{ {name: "empty", key: []byte{}, ok: false}, {name: "replace1", key: incLastByte(tbPrefix), ok: false}, {name: "replace2", key: decLastByte(tbPrefix), ok: false}, // key with not enough id len should not be regard as a valid table id {name: "tbPrefix", key: tbPrefix, ok: false}, {name: "back1", key: prefix1[:len(prefix1)-1], tbID: 1, ok: false}, {name: "back2", key: prefix1[:len(tbPrefix)+1], tbID: 1, ok: false}, // table with an id 0 should not be regard as a valid table id {name: "prefix0", key: prefix0, testSuffix: true, ok: false}, // table with id math.MaxInt64 should not regard as a valid table id {name: "prefixMax", key: prefixMax, testSuffix: true, ok: false}, // table with id negative should not regard as a valid table id {name: "prefixNegative", key: prefixNegative, testSuffix: true, ok: false}, // table with id > 0 && id < math.MaxInt64 regard as a valid table id {name: "prefix1", key: prefix1, tbID: 1, testSuffix: true, ok: true}, {name: "prefixA", key: prefixA, tbID: math.MaxInt64 / 2, testSuffix: true, ok: true}, {name: "prefixB", key: prefixB, tbID: math.MaxInt64 - 1, testSuffix: true, ok: true}, } for _, c := range cases { keys := []kv.Key{c.key} if c.testSuffix { for _, s := range [][]byte{ {0}, {1}, {0xFF}, codec.EncodeInt(nil, 0), codec.EncodeInt(nil, math.MaxInt64/2), codec.EncodeInt(nil, math.MaxInt64), } { newKey := append([]byte{}, c.key...) newKey = append(newKey, s...) keys = append(keys, newKey) } } for i, key := range keys { tblID, ok := getKeyAccessedTableID(key) require.Equal(t, c.ok, ok, "%s %d", c.name, i) if c.ok { require.Equal(t, c.tbID, tblID, "%s %d", c.name, i) } else { require.Equal(t, int64(0), tblID, "%s %d", c.name, i) } } } }
explode_data.jsonl/13197
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 982 }
[ 2830, 3393, 1949, 1592, 6054, 291, 2556, 915, 1155, 353, 8840, 836, 8, 341, 62842, 14335, 1669, 1965, 34607, 18257, 14335, 741, 3223, 5060, 15, 1669, 16164, 2556, 1592, 7, 15, 340, 3223, 5060, 5974, 1669, 16164, 2556, 1592, 37270, 14535...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestConfigSetActiveNamespace(t *testing.T) { mk := NewMockKubeSettings() cfg := config.NewConfig(mk) assert.Nil(t, cfg.Load("testdata/k9s.yml")) assert.Nil(t, cfg.SetActiveNamespace("default")) assert.Equal(t, "default", cfg.ActiveNamespace()) }
explode_data.jsonl/19255
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 101 }
[ 2830, 3393, 2648, 83020, 22699, 1155, 353, 8840, 836, 8, 341, 2109, 74, 1669, 1532, 11571, 42, 3760, 6086, 741, 50286, 1669, 2193, 7121, 2648, 1255, 74, 692, 6948, 59678, 1155, 11, 13286, 13969, 445, 92425, 14109, 24, 82, 33936, 5455, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestTriMul(t *testing.T) { t.Parallel() method := func(receiver, a, b Matrix) { type MulTrier interface { MulTri(a, b Triangular) } receiver.(MulTrier).MulTri(a.(Triangular), b.(Triangular)) } denseComparison := func(receiver, a, b *Dense) { receiver.Mul(a, b) } legalSizeTriMul := func(ar, ac, br, bc int) bool { // Need both to be square and the sizes to be the same return ar == ac && br == bc && ar == br } // The legal types are triangles with the same TriKind. // legalTypesTri returns whether both input arguments are Triangular. legalTypes := func(a, b Matrix) bool { at, ok := a.(Triangular) if !ok { return false } bt, ok := b.(Triangular) if !ok { return false } _, ak := at.Triangle() _, bk := bt.Triangle() return ak == bk } legalTypesLower := func(a, b Matrix) bool { legal := legalTypes(a, b) if !legal { return false } _, kind := a.(Triangular).Triangle() r := kind == Lower return r } receiver := NewTriDense(3, Lower, nil) testTwoInput(t, "TriMul", receiver, method, denseComparison, legalTypesLower, legalSizeTriMul, 1e-14) legalTypesUpper := func(a, b Matrix) bool { legal := legalTypes(a, b) if !legal { return false } _, kind := a.(Triangular).Triangle() r := kind == Upper return r } receiver = NewTriDense(3, Upper, nil) testTwoInput(t, "TriMul", receiver, method, denseComparison, legalTypesUpper, legalSizeTriMul, 1e-14) }
explode_data.jsonl/25862
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 577 }
[ 2830, 3393, 21884, 59155, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 741, 42257, 1669, 2915, 78126, 11, 264, 11, 293, 11631, 8, 341, 197, 13158, 29351, 51, 7253, 3749, 341, 298, 9209, 360, 21884, 2877, 11, 293, 12359, 4234, 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 TestSetFlag(t *testing.T) { defer initFlag(TestTx.Flags) ctx := context.Background() scope := NewReferenceScope(TestTx) for _, v := range setFlagTests { initFlag(TestTx.Flags) err := SetFlag(ctx, scope, v.Expr) if err != nil { if len(v.Error) < 1 { t.Errorf("%s: unexpected error %q", v.Name, err) } else if err.Error() != v.Error { t.Errorf("%s: error %q, want error %q", v.Name, err.Error(), v.Error) } continue } if 0 < len(v.Error) { t.Errorf("%s: no error, want error %q", v.Name, v.Error) continue } } }
explode_data.jsonl/50842
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 249 }
[ 2830, 3393, 1649, 12135, 1155, 353, 8840, 836, 8, 341, 16867, 2930, 12135, 31159, 31584, 51887, 692, 20985, 1669, 2266, 19047, 741, 66836, 1669, 1532, 8856, 10803, 31159, 31584, 692, 2023, 8358, 348, 1669, 2088, 738, 12135, 18200, 341, 19...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
6
func TestSyncEventTarget_Off(t *testing.T) { target:=NewSyncEventTarget() listener:=func() {} target.On(listener) target.Off(listener) if target.ListenerCount()!=0 { t.Failed() } }
explode_data.jsonl/71313
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 77 }
[ 2830, 3393, 12154, 1556, 6397, 94377, 1155, 353, 8840, 836, 8, 341, 28861, 14209, 3564, 12154, 1556, 6397, 741, 14440, 798, 14209, 2830, 368, 5613, 28861, 8071, 40610, 340, 28861, 13, 4596, 40610, 340, 743, 2169, 64091, 2507, 38657, 15, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
func Test_fsSource_First_NoMigrations(t *testing.T) { s := getTestSource(t, "no-migrations") version, err := s.First() if !errors.Is(err, fs.ErrNotExist) { t.Fatalf("expected ErrNotExist, got: %v", err) } if version != 0 { t.Fatalf("expected first version to be 0, got: %d", version) } }
explode_data.jsonl/81882
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 125 }
[ 2830, 3393, 34470, 3608, 79790, 36989, 44, 17824, 1155, 353, 8840, 836, 8, 341, 1903, 1669, 633, 2271, 3608, 1155, 11, 330, 2152, 1448, 17824, 1138, 74954, 11, 1848, 1669, 274, 15926, 741, 743, 753, 7650, 4506, 3964, 11, 8619, 27862, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestExtractOperatingSystemFromKubeEnv(t *testing.T) { type testCase struct { name string kubeEnv string expectedOperatingSystem OperatingSystem } testCases := []testCase{ { name: "linux", kubeEnv: "ENABLE_NODE_PROBLEM_DETECTOR: 'daemonset'\n" + "DNS_SERVER_IP: '10.0.0.10'\n" + "AUTOSCALER_ENV_VARS: node_labels=a=b,c=d,cloud.google.com/gke-nodepool=pool-3,cloud.google.com/gke-preemptible=true;" + "node_taints='dedicated=ml:NoSchedule,test=dev:PreferNoSchedule,a=b:c';" + "kube_reserved=cpu=1000m,memory=300000Mi;" + "os=linux\n" + "KUBELET_TEST_ARGS: --experimental-allocatable-ignore-eviction\n", expectedOperatingSystem: OperatingSystemLinux, }, { name: "windows", kubeEnv: "ENABLE_NODE_PROBLEM_DETECTOR: 'daemonset'\n" + "DNS_SERVER_IP: '10.0.0.10'\n" + "AUTOSCALER_ENV_VARS: node_labels=a=b,c=d,cloud.google.com/gke-nodepool=pool-3,cloud.google.com/gke-preemptible=true" + "node_taints='dedicated=ml:NoSchedule,test=dev:PreferNoSchedule,a=b:c';" + "kube_reserved=cpu=1000m,memory=300000Mi;" + "os=windows\n" + "KUBELET_TEST_ARGS: --experimental-allocatable-ignore-eviction\n", expectedOperatingSystem: OperatingSystemWindows, }, { name: "no AUTOSCALER_ENV_VARS", kubeEnv: "ENABLE_NODE_PROBLEM_DETECTOR: 'daemonset'\n" + "NODE_LABELS: a=b,c=d,cloud.google.com/gke-nodepool=pool-3,cloud.google.com/gke-preemptible=true\n" + "DNS_SERVER_IP: '10.0.0.10'\n" + "KUBELET_TEST_ARGS: --experimental-allocatable-ignore-eviction --kube-reserved=cpu=1000m,memory=300000Mi\n" + "NODE_TAINTS: 'dedicated=ml:NoSchedule,test=dev:PreferNoSchedule,a=b:c'\n", expectedOperatingSystem: OperatingSystemDefault, }, { name: "no os defined", kubeEnv: "ENABLE_NODE_PROBLEM_DETECTOR: 'daemonset'\n" + "DNS_SERVER_IP: '10.0.0.10'\n" + "AUTOSCALER_ENV_VARS: node_labels=a=b,c=d,cloud.google.com/gke-nodepool=pool-3,cloud.google.com/gke-preemptible=true;" + "node_taints='dedicated=ml:NoSchedule,test=dev:PreferNoSchedule,a=b:c';" + "kube_reserved=cpu=1000m,memory=300000Mi\n" + "KUBELET_TEST_ARGS: --experimental-allocatable-ignore-eviction\n", expectedOperatingSystem: OperatingSystemDefault, }, { name: "os is empty", kubeEnv: "ENABLE_NODE_PROBLEM_DETECTOR: 'daemonset'\n" + "DNS_SERVER_IP: '10.0.0.10'\n" + "AUTOSCALER_ENV_VARS: node_labels=a=b,c=d,cloud.google.com/gke-nodepool=pool-3,cloud.google.com/gke-preemptible=true;" + "node_taints='dedicated=ml:NoSchedule,test=dev:PreferNoSchedule,a=b:c';" + "kube_reserved=cpu=1000m,memory=300000Mi;" + "os=\n" + "KUBELET_TEST_ARGS: --experimental-allocatable-ignore-eviction\n", expectedOperatingSystem: OperatingSystemUnknown, }, { name: "unknown (macos)", kubeEnv: "ENABLE_NODE_PROBLEM_DETECTOR: 'daemonset'\n" + "DNS_SERVER_IP: '10.0.0.10'\n" + "AUTOSCALER_ENV_VARS: node_labels=a=b,c=d,cloud.google.com/gke-nodepool=pool-3,cloud.google.com/gke-preemptible=true" + "node_taints='dedicated=ml:NoSchedule,test=dev:PreferNoSchedule,a=b:c';" + "kube_reserved=cpu=1000m,memory=300000Mi;" + "os=macos\n" + "KUBELET_TEST_ARGS: --experimental-allocatable-ignore-eviction\n", expectedOperatingSystem: OperatingSystemUnknown, }, } for _, tc := range testCases { t.Run(tc.name, func(t *testing.T) { actualOperatingSystem := extractOperatingSystemFromKubeEnv(tc.kubeEnv) assert.Equal(t, tc.expectedOperatingSystem, actualOperatingSystem) }) } }
explode_data.jsonl/50924
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1756 }
[ 2830, 3393, 28959, 58147, 2320, 3830, 42, 3760, 14359, 1155, 353, 8840, 836, 8, 341, 13158, 54452, 2036, 341, 197, 11609, 503, 914, 198, 197, 16463, 3760, 14359, 338, 914, 198, 197, 42400, 58147, 2320, 35133, 2320, 198, 197, 630, 18185,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestPGPPullMultiplePrompts(t *testing.T) { tc := SetupEngineTest(t, "pgp_pull") defer tc.Cleanup() sigVersion := libkb.GetDefaultSigVersion(tc.G) createUserWhoTracks(tc, []string{}, sigVersion) gpgClient := createGpgClient(tc) assertKeysMissing(t, gpgClient, []string{aliceFp}) // Try the first time, declining in prompt. We expect keys not to // be imported. fui := &FakeIdentifyUI{FakeConfirm: false} uis := libkb.UIs{ LogUI: tc.G.UI.GetLogUI(), GPGUI: &gpgtestui{}, IdentifyUI: fui, } eng := NewPGPPullEngine(tc.G, &PGPPullEngineArg{ UserAsserts: []string{"t_alice"}, }) m := NewMetaContextForTest(tc).WithUIs(uis) err := RunEngine2(m, eng) require.NoError(t, err) require.Equal(t, 1, fui.StartCount, "Expected 1 ID UI prompt") assertKeysMissing(t, gpgClient, []string{aliceFp}) // Run again, declining like before, but make sure we got asked // second time and our answer wasn't just cached. err = RunEngine2(m, eng) require.NoError(t, err) require.Equal(t, 2, fui.StartCount, "Expected 2 ID UI prompts") assertKeysMissing(t, gpgClient, []string{aliceFp}) // Run again, attempt to confirm in prompt. PGP Pull should ask us // again even though we declined before, and successfully import // the keys. fui.FakeConfirm = true err = RunEngine2(m, eng) require.NoError(t, err) require.Equal(t, 3, fui.StartCount, "Expected 2 ID UI prompts") assertKeysPresent(t, gpgClient, []string{aliceFp}) }
explode_data.jsonl/44550
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 556 }
[ 2830, 3393, 11383, 4406, 617, 32089, 35186, 12754, 1155, 353, 8840, 836, 8, 341, 78255, 1669, 18626, 4571, 2271, 1155, 11, 330, 3517, 79, 65693, 1138, 16867, 17130, 727, 60639, 741, 84841, 5637, 1669, 3051, 21310, 2234, 3675, 47246, 5637,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestPushExporterServicer_Submit_InvalidName(t *testing.T) { // Submitting a metric with an invalid name should submit a renamed metric testInvalidName(t, "invalid metric name", "invalid_metric_name") testInvalidName(t, "0starts_with_number", "_0starts_with_number") testInvalidName(t, "bad?-/$chars", "bad____chars") }
explode_data.jsonl/61838
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 109 }
[ 2830, 3393, 16644, 88025, 39159, 12999, 36359, 1763, 62, 7928, 675, 1155, 353, 8840, 836, 8, 341, 197, 322, 29170, 1280, 264, 18266, 448, 458, 8318, 829, 1265, 9318, 264, 27280, 18266, 198, 18185, 7928, 675, 1155, 11, 330, 11808, 18266,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestOutOfOrderReceive(t *testing.T) { c := context.New(t, defaultMTU) defer c.Cleanup() c.CreateConnected(789, 30000, nil) we, ch := waiter.NewChannelEntry(nil) c.WQ.EventRegister(&we, waiter.EventIn) defer c.WQ.EventUnregister(&we) if _, _, err := c.EP.Read(nil); err != tcpip.ErrWouldBlock { t.Fatalf("got c.EP.Read(nil) = %v, want = %v", err, tcpip.ErrWouldBlock) } // Send second half of data first, with seqnum 3 ahead of expected. data := []byte{1, 2, 3, 4, 5, 6} c.SendPacket(data[3:], &context.Headers{ SrcPort: context.TestPort, DstPort: c.Port, Flags: header.TCPFlagAck, SeqNum: 793, AckNum: c.IRS.Add(1), RcvWnd: 30000, }) // Check that we get an ACK specifying which seqnum is expected. checker.IPv4(t, c.GetPacket(), checker.TCP( checker.DstPort(context.TestPort), checker.SeqNum(uint32(c.IRS)+1), checker.AckNum(790), checker.TCPFlags(header.TCPFlagAck), ), ) // Wait 200ms and check that no data has been received. time.Sleep(200 * time.Millisecond) if _, _, err := c.EP.Read(nil); err != tcpip.ErrWouldBlock { t.Fatalf("got c.EP.Read(nil) = %v, want = %v", err, tcpip.ErrWouldBlock) } // Send the first 3 bytes now. c.SendPacket(data[:3], &context.Headers{ SrcPort: context.TestPort, DstPort: c.Port, Flags: header.TCPFlagAck, SeqNum: 790, AckNum: c.IRS.Add(1), RcvWnd: 30000, }) // Receive data. read := make([]byte, 0, 6) for len(read) < len(data) { v, _, err := c.EP.Read(nil) if err != nil { if err == tcpip.ErrWouldBlock { // Wait for receive to be notified. select { case <-ch: case <-time.After(5 * time.Second): t.Fatalf("Timed out waiting for data to arrive") } continue } t.Fatalf("Read failed: %v", err) } read = append(read, v...) } // Check that we received the data in proper order. if !bytes.Equal(data, read) { t.Fatalf("got data = %v, want = %v", read, data) } // Check that the whole data is acknowledged. checker.IPv4(t, c.GetPacket(), checker.TCP( checker.DstPort(context.TestPort), checker.SeqNum(uint32(c.IRS)+1), checker.AckNum(uint32(790+len(data))), checker.TCPFlags(header.TCPFlagAck), ), ) }
explode_data.jsonl/22282
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 993 }
[ 2830, 3393, 31731, 4431, 14742, 1155, 353, 8840, 836, 8, 341, 1444, 1669, 2266, 7121, 1155, 11, 1638, 8505, 52, 340, 16867, 272, 727, 60639, 2822, 1444, 7251, 21146, 7, 22, 23, 24, 11, 220, 18, 15, 15, 15, 15, 11, 2092, 692, 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...
9
func TestDatabase_Client_UpdateStep_Invalid(t *testing.T) { // setup types s := testStep() s.SetID(1) s.SetBuildID(1) s.SetNumber(1) s.SetName("foo") s.SetImage("baz") // setup database db, _ := NewTest() defer func() { db.Database.Exec("delete from steps;") db.Database.Close() }() _ = db.CreateStep(s) // run test err := db.UpdateStep(s) if err == nil { t.Errorf("UpdateStep should have returned err") } }
explode_data.jsonl/69141
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 179 }
[ 2830, 3393, 5988, 46102, 47393, 8304, 62, 7928, 1155, 353, 8840, 836, 8, 341, 197, 322, 6505, 4494, 198, 1903, 1669, 1273, 8304, 741, 1903, 4202, 915, 7, 16, 340, 1903, 4202, 11066, 915, 7, 16, 340, 1903, 4202, 2833, 7, 16, 340, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestIsArchive7zip(t *testing.T) { header := []byte{0x50, 0x4b, 0x03, 0x04} out := IsArchive(header) if out { t.Fatalf("isArchive should return false as %s is a 7z header and it is not supported", header) } }
explode_data.jsonl/81963
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 89 }
[ 2830, 3393, 3872, 42502, 22, 9964, 1155, 353, 8840, 836, 8, 341, 20883, 1669, 3056, 3782, 90, 15, 87, 20, 15, 11, 220, 15, 87, 19, 65, 11, 220, 15, 87, 15, 18, 11, 220, 15, 87, 15, 19, 532, 13967, 1669, 2160, 42502, 25534, 340...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestBootThenShutdown(t *testing.T) { cleanup := integration.EnterTestDirectory() defer cleanup() //logger, _ := lifecycle.NewStdErrLogger() logger := logging.NewNoopLogger() privValidator := tendermint.NewPrivValidatorMemory(privateValidators[0], privateValidators[0]) assert.NoError(t, bootWaitBlocksShutdown(t, privValidator, integration.NewTestConfig(genesisDoc), logger, nil)) }
explode_data.jsonl/20907
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 127 }
[ 2830, 3393, 17919, 12209, 62004, 1155, 353, 8840, 836, 8, 341, 1444, 60639, 1669, 17590, 52267, 2271, 9310, 741, 16867, 21290, 741, 197, 322, 9786, 11, 716, 1669, 47508, 7121, 22748, 7747, 7395, 741, 17060, 1669, 8392, 7121, 2753, 453, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestGetJobsHappyCase(t *testing.T) { httpmock.Activate() defer httpmock.DeactivateAndReset() ctx := context.Background() response := GetJobsResponse{ Jobs: []FlinkJob{ { JobID: "j1", }, }, } responder, _ := httpmock.NewJsonResponder(200, response) httpmock.RegisterResponder("GET", fakeJobsURL, responder) client := getTestJobManagerClient() resp, err := client.GetJobs(ctx, testURL) assert.Equal(t, response, *resp) assert.NoError(t, err) }
explode_data.jsonl/32346
{ "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, 1949, 40667, 32847, 4207, 1155, 353, 8840, 836, 8, 341, 28080, 16712, 14140, 731, 741, 16867, 1758, 16712, 8934, 16856, 3036, 14828, 741, 20985, 1669, 2266, 19047, 741, 21735, 1669, 2126, 40667, 2582, 515, 197, 17100, 5481, 25...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestAltKeyring_ImportExportPubKey(t *testing.T) { keyring, err := New(t.Name(), BackendTest, t.TempDir(), nil) require.NoError(t, err) uid := theID _, _, err = keyring.NewMnemonic(uid, English, sdk.FullFundraiserPath, hd.Secp256k1) require.NoError(t, err) armor, err := keyring.ExportPubKeyArmor(uid) require.NoError(t, err) err = keyring.Delete(uid) require.NoError(t, err) newUID := otherID err = keyring.ImportPubKey(newUID, armor) require.NoError(t, err) // Should fail importing private key on existing key. err = keyring.ImportPubKey(newUID, armor) require.EqualError(t, err, fmt.Sprintf("cannot overwrite key: %s", newUID)) }
explode_data.jsonl/73464
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 249 }
[ 2830, 3393, 26017, 1592, 12640, 62, 11511, 16894, 29162, 1592, 1155, 353, 8840, 836, 8, 341, 23634, 12640, 11, 1848, 1669, 1532, 1155, 2967, 1507, 55260, 2271, 11, 259, 65009, 6184, 1507, 2092, 340, 17957, 35699, 1155, 11, 1848, 692, 19...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestServeHTTP10Close(t *testing.T) { testTCPConnectionCloses(t, "GET / HTTP/1.0\r\n\r\n", HandlerFunc(func(w ResponseWriter, r *Request) { ServeFile(w, r, "testdata/file") })) }
explode_data.jsonl/22399
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 81 }
[ 2830, 3393, 60421, 9230, 16, 15, 7925, 1155, 353, 8840, 836, 8, 341, 18185, 49896, 4526, 34, 49341, 1155, 11, 330, 3806, 608, 10130, 14, 16, 13, 15, 12016, 1699, 12016, 1699, 497, 19954, 9626, 18552, 3622, 5949, 6492, 11, 435, 353, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
func TestTemplateLookupSite(t *testing.T) { t.Run("basic", func(t *testing.T) { t.Parallel() b := newTestSitesBuilder(t).WithSimpleConfigFile() b.WithTemplates( "_default/single.html", `Single: {{ .Title }}`, "_default/list.html", `List: {{ .Title }}`, ) createContent := func(title string) string { return fmt.Sprintf(`--- title: %s ---`, title) } b.WithContent( "_index.md", createContent("Home Sweet Home"), "p1.md", createContent("P1")) b.CreateSites().Build(BuildCfg{}) b.AssertFileContent("public/index.html", `List: Home Sweet Home`) b.AssertFileContent("public/p1/index.html", `Single: P1`) }) t.Run("baseof", func(t *testing.T) { t.Parallel() b := newTestSitesBuilder(t).WithDefaultMultiSiteConfig() b.WithTemplatesAdded( "index.html", `{{ define "main" }}Main Home En{{ end }}`, "index.fr.html", `{{ define "main" }}Main Home Fr{{ end }}`, "baseof.html", `Baseof en: {{ block "main" . }}main block{{ end }}`, "baseof.fr.html", `Baseof fr: {{ block "main" . }}main block{{ end }}`, "mysection/baseof.html", `Baseof mysection: {{ block "main" . }}mysection block{{ end }}`, "_default/single.html", `{{ define "main" }}Main Default Single{{ end }}`, "_default/list.html", `{{ define "main" }}Main Default List{{ end }}`, ) b.WithContent("mysection/p1.md", `--- title: My Page --- `) b.CreateSites().Build(BuildCfg{}) b.AssertFileContent("public/en/index.html", `Baseof en: Main Home En`) b.AssertFileContent("public/fr/index.html", `Baseof fr: Main Home Fr`) b.AssertFileContent("public/en/mysection/index.html", `Baseof mysection: Main Default List`) b.AssertFileContent("public/en/mysection/p1/index.html", `Baseof mysection: Main Default Single`) }) }
explode_data.jsonl/60655
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 683 }
[ 2830, 3393, 7275, 34247, 17597, 1155, 353, 8840, 836, 8, 341, 3244, 16708, 445, 22342, 497, 2915, 1155, 353, 8840, 836, 8, 341, 197, 3244, 41288, 7957, 741, 197, 2233, 1669, 501, 2271, 93690, 3297, 1155, 568, 2354, 16374, 2648, 1703, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestCreateObject(t *testing.T) { ts := newTestServer(t) defer ts.Close() svc := ts.s3Client() out, err := svc.PutObject(&s3.PutObjectInput{ Bucket: aws.String(defaultBucket), Key: aws.String("object"), Body: bytes.NewReader([]byte("hello")), }) ts.OK(err) if *out.ETag != `"5d41402abc4b2a76b9719d911017c592"` { // md5("hello") ts.Fatal("bad etag", out.ETag) } obj := ts.backendGetString(defaultBucket, "object", nil) if obj != "hello" { t.Fatal("object creation failed") } }
explode_data.jsonl/22251
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 223 }
[ 2830, 3393, 4021, 1190, 1155, 353, 8840, 836, 8, 341, 57441, 1669, 501, 2271, 5475, 1155, 340, 16867, 10591, 10421, 741, 1903, 7362, 1669, 10591, 514, 18, 2959, 2822, 13967, 11, 1848, 1669, 46154, 39825, 1190, 2099, 82, 18, 39825, 1190,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestMVCCStatsPutIntentTimestampNotPutTimestamp(t *testing.T) { defer leaktest.AfterTest(t)() engine := createTestEngine() defer engine.Close() ctx := context.Background() aggMS := &enginepb.MVCCStats{} assertEq(t, engine, "initially", aggMS, &enginepb.MVCCStats{}) key := roachpb.Key("a") ts201 := hlc.Timestamp{WallTime: 2E9 + 1} ts099 := hlc.Timestamp{WallTime: 1E9 - 1} txn := &roachpb.Transaction{TxnMeta: enginepb.TxnMeta{ID: uuid.MakeV4(), Timestamp: ts201}} // Write an intent at 2s+1. value := roachpb.MakeValueFromString("value") if err := MVCCPut(ctx, engine, aggMS, key, ts201, value, txn); err != nil { t.Fatal(err) } mKeySize := int64(mvccKey(key).EncodedSize()) // 2 m1ValSize := int64((&enginepb.MVCCMetadata{ // 44 Timestamp: hlc.LegacyTimestamp(ts201), Txn: &txn.TxnMeta, }).Size()) vKeySize := mvccVersionTimestampSize // 12 vValSize := int64(len(value.RawBytes)) // 10 expMS := enginepb.MVCCStats{ LastUpdateNanos: 2E9 + 1, LiveBytes: mKeySize + m1ValSize + vKeySize + vValSize, // 2+44+12+10 = 68 LiveCount: 1, KeyBytes: mKeySize + vKeySize, // 14 KeyCount: 1, ValBytes: m1ValSize + vValSize, // 44+10 = 54 ValCount: 1, IntentCount: 1, IntentBytes: vKeySize + vValSize, // 12+10 = 22 } assertEq(t, engine, "after first put", aggMS, &expMS) // Replace the intent with an identical one, but we write it at 1s-1 now. If // you're confused, don't worry. There are two timestamps here: the one in // the txn (which is, perhaps surprisingly, only really used when // committing/aborting intents), and the timestamp passed directly to // MVCCPut (which is where the intent will actually end up being written at, // and which usually corresponds to txn.OrigTimestamp). txn.Sequence++ // Annoyingly, the new meta value is actually a little larger thanks to the // sequence number. m2ValSize := int64((&enginepb.MVCCMetadata{ // 46 Timestamp: hlc.LegacyTimestamp(ts201), Txn: &txn.TxnMeta, IntentHistory: []enginepb.MVCCMetadata_SequencedIntent{ {Sequence: 0, Value: value.RawBytes}, }, }).Size()) if err := MVCCPut(ctx, engine, aggMS, key, ts099, value, txn); err != nil { t.Fatal(err) } expAggMS := enginepb.MVCCStats{ // Even though we tried to put a new intent at an older timestamp, it // will have been written at 2E9+1, so the age will be 0. IntentAge: 0, LastUpdateNanos: 2E9 + 1, LiveBytes: mKeySize + m2ValSize + vKeySize + vValSize, // 2+46+12+10 = 70 LiveCount: 1, KeyBytes: mKeySize + vKeySize, // 14 KeyCount: 1, ValBytes: m2ValSize + vValSize, // 46+10 = 56 ValCount: 1, IntentCount: 1, IntentBytes: vKeySize + vValSize, // 12+10 = 22 } assertEq(t, engine, "after second put", aggMS, &expAggMS) }
explode_data.jsonl/41645
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1186 }
[ 2830, 3393, 66626, 3706, 16635, 19103, 11536, 20812, 2623, 19103, 20812, 1155, 353, 8840, 836, 8, 341, 16867, 23352, 1944, 36892, 2271, 1155, 8, 741, 80118, 1669, 1855, 2271, 4571, 741, 16867, 4712, 10421, 2822, 20985, 1669, 2266, 19047, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestRangeExpr7(t *testing.T) { gopClTest(t, ` println [x for x <- 0:3:1] `, `package main import ( fmt "fmt" builtin "github.com/goplus/gop/builtin" ) func main() { fmt.Println(func() (_gop_ret []int) { for _gop_it := builtin.NewRange__0(0, 3, 1).Gop_Enum(); ; { var _gop_ok bool x, _gop_ok := _gop_it.Next() if !_gop_ok { break } _gop_ret = append(_gop_ret, x) } return }()) } `) }
explode_data.jsonl/73701
{ "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, 6046, 16041, 22, 1155, 353, 8840, 836, 8, 341, 3174, 453, 5066, 2271, 1155, 11, 22074, 33655, 508, 87, 369, 856, 9119, 220, 15, 25, 18, 25, 16, 921, 7808, 1565, 1722, 1887, 271, 474, 2399, 11009, 330, 12501, 698, 2233, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestParseMissingMeasurement(t *testing.T) { _, err := graphite.NewParser([]string{"a.b.c"}, nil) if err == nil { t.Fatalf("expected error creating parser, got nil") } }
explode_data.jsonl/32174
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 66 }
[ 2830, 3393, 14463, 25080, 76548, 1155, 353, 8840, 836, 8, 341, 197, 6878, 1848, 1669, 94173, 7121, 6570, 10556, 917, 4913, 64, 948, 520, 14345, 2092, 340, 743, 1848, 621, 2092, 341, 197, 3244, 30762, 445, 7325, 1465, 6825, 6729, 11, 2...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
2
func TestUpdateOrderbook(t *testing.T) { t.Parallel() cp, err := currency.NewPairFromString("BTCUSDT") if err != nil { t.Error(err) } _, err = b.UpdateOrderbook(context.Background(), cp, asset.Spot) if err != nil { t.Error(err) } _, err = b.UpdateOrderbook(context.Background(), cp, asset.Margin) if err != nil { t.Error(err) } _, err = b.UpdateOrderbook(context.Background(), cp, asset.USDTMarginedFutures) if err != nil { t.Error(err) } cp2, err := currency.NewPairFromString("BTCUSD_PERP") if err != nil { t.Error(err) } _, err = b.UpdateOrderbook(context.Background(), cp2, asset.CoinMarginedFutures) if err != nil { t.Error(err) } }
explode_data.jsonl/76551
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 276 }
[ 2830, 3393, 4289, 4431, 2190, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 741, 52018, 11, 1848, 1669, 11413, 7121, 12443, 44491, 445, 59118, 2034, 10599, 1138, 743, 1848, 961, 2092, 341, 197, 3244, 6141, 3964, 340, 197, 532, 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 TestCreateEC2Session(t *testing.T) { testAWSClient( t, "EC2", func(t *testing.T, s *session.Session, region *string, role Role, fips bool) { iface := createEC2Session(s, region, role, fips) if iface == nil { t.Fail() } }) }
explode_data.jsonl/18788
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 114 }
[ 2830, 3393, 4021, 7498, 17, 5283, 1155, 353, 8840, 836, 8, 341, 18185, 36136, 2959, 1006, 197, 3244, 345, 197, 197, 1, 7498, 17, 756, 197, 29244, 1155, 353, 8840, 836, 11, 274, 353, 5920, 20674, 11, 5537, 353, 917, 11, 3476, 15404, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestNewPolicyErrorCase(t *testing.T) { provider := NewPolicyProvider(nil) pol1, msg1, err1 := provider.NewPolicy([]byte{0}) assert.Nil(t, pol1) assert.Nil(t, msg1) assert.EqualError(t, err1, "Error unmarshaling to SignaturePolicy: proto: common.SignaturePolicyEnvelope: illegal tag 0 (wire type 0)") sigPolicy2 := &cb.SignaturePolicyEnvelope{Version: -1} data2 := marshalOrPanic(sigPolicy2) pol2, msg2, err2 := provider.NewPolicy(data2) assert.Nil(t, pol2) assert.Nil(t, msg2) assert.EqualError(t, err2, "This evaluator only understands messages of version 0, but version was -1") pol3, msg3, err3 := provider.NewPolicy([]byte{}) assert.Nil(t, pol3) assert.Nil(t, msg3) assert.EqualError(t, err3, "Empty policy element") var pol4 *policy = nil err4 := pol4.Evaluate([]*protoutil.SignedData{}) assert.EqualError(t, err4, "No such policy") }
explode_data.jsonl/51383
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 338 }
[ 2830, 3393, 3564, 13825, 1454, 4207, 1155, 353, 8840, 836, 8, 341, 197, 19979, 1669, 1532, 13825, 5179, 27907, 692, 3223, 337, 16, 11, 3750, 16, 11, 1848, 16, 1669, 9109, 7121, 13825, 10556, 3782, 90, 15, 3518, 6948, 59678, 1155, 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 TestAgent_RegisterCheck_Service(t *testing.T) { t.Parallel() a := NewTestAgent(t.Name(), "") defer a.Shutdown() args := &structs.ServiceDefinition{ Name: "memcache", Port: 8000, Check: structs.CheckType{ TTL: 15 * time.Second, }, } // First register the service req, _ := http.NewRequest("PUT", "/v1/agent/service/register", jsonReader(args)) if _, err := a.srv.AgentRegisterService(nil, req); err != nil { t.Fatalf("err: %v", err) } // Now register an additional check checkArgs := &structs.CheckDefinition{ Name: "memcache_check2", ServiceID: "memcache", TTL: 15 * time.Second, } req, _ = http.NewRequest("PUT", "/v1/agent/check/register", jsonReader(checkArgs)) if _, err := a.srv.AgentRegisterCheck(nil, req); err != nil { t.Fatalf("err: %v", err) } // Ensure we have a check mapping result := a.State.Checks() if _, ok := result["service:memcache"]; !ok { t.Fatalf("missing memcached check") } if _, ok := result["memcache_check2"]; !ok { t.Fatalf("missing memcache_check2 check") } // Make sure the new check is associated with the service if result["memcache_check2"].ServiceID != "memcache" { t.Fatalf("bad: %#v", result["memcached_check2"]) } }
explode_data.jsonl/33646
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 475 }
[ 2830, 3393, 16810, 73124, 3973, 52548, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 741, 11323, 1669, 1532, 2271, 16810, 1155, 2967, 1507, 14676, 16867, 264, 10849, 18452, 2822, 31215, 1669, 609, 1235, 82, 13860, 10398, 515, 197, 2129...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestGetFileContentType(t *testing.T) { type args struct { path string } tests := []struct { name string args args want string wantErr bool }{ { name: "TestGetFileContentType", args: args{ path: os.Getenv("TELEGRAM_FILE_PATH"), }, want: os.Getenv("TELEGRAM_FILE_TYPE"), wantErr: false, }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { got, err := GetFileContentType(tt.args.path) if (err != nil) != tt.wantErr { t.Errorf("GetFileContentType() error = %v, wantErr %v", err, tt.wantErr) return } if got != tt.want { t.Errorf("GetFileContentType() = %v, want %v", got, tt.want) } }) } }
explode_data.jsonl/27761
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 330 }
[ 2830, 3393, 1949, 1703, 29504, 1155, 353, 8840, 836, 8, 341, 13158, 2827, 2036, 341, 197, 26781, 914, 198, 197, 532, 78216, 1669, 3056, 1235, 341, 197, 11609, 262, 914, 198, 197, 31215, 262, 2827, 198, 197, 50780, 262, 914, 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...
3
func TestMappingRuleProto(t *testing.T) { inputs := []*mappingRule{ testMappingRule2, testMappingRule3, } expected := []*rulepb.MappingRule{ testMappingRule2V2Proto, testMappingRule3V2Proto, } for i, input := range inputs { res, err := input.proto() require.NoError(t, err) require.Equal(t, expected[i], res) } }
explode_data.jsonl/64575
{ "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, 6807, 11337, 31549, 1155, 353, 8840, 836, 8, 341, 22427, 82, 1669, 29838, 40792, 11337, 515, 197, 18185, 6807, 11337, 17, 345, 197, 18185, 6807, 11337, 18, 345, 197, 532, 42400, 1669, 29838, 12937, 16650, 76455, 11337, 515, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestSQLQueryFactoryBadOp(t *testing.T) { s, _ := newMockProvider().init() _, err := s.filterSelectFinalized(context.Background(), "", &database.FilterInfo{ Op: database.FilterOp("wrong"), }, nil) assert.Regexp(t, "FF10150.*wrong", err) }
explode_data.jsonl/34919
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 91 }
[ 2830, 3393, 6688, 2859, 4153, 17082, 7125, 1155, 353, 8840, 836, 8, 1476, 1903, 11, 716, 1669, 501, 11571, 5179, 1005, 2327, 741, 197, 6878, 1848, 1669, 274, 6936, 3379, 19357, 1506, 5378, 19047, 1507, 7342, 609, 12216, 31696, 1731, 515...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestMultipleSpecsSameNBS(t *testing.T) { assert := assert.New(t) tmpDir, err := ioutil.TempDir("", "spec_test") assert.NoError(err) defer os.RemoveAll(tmpDir) spec1, err1 := ForDatabase(tmpDir) spec2, err2 := ForDatabase(tmpDir) assert.NoError(err1) assert.NoError(err2) s := types.String("hello") db := spec1.GetDatabase(context.Background()) r, err := db.WriteValue(context.Background(), s) assert.NoError(err) ds, err := db.GetDataset(context.Background(), "datasetID") assert.NoError(err) _, err = db.CommitValue(context.Background(), ds, r) assert.NoError(err) assert.Equal(s, mustValue(spec2.GetDatabase(context.Background()).ReadValue(context.Background(), mustHash(s.Hash(types.Format_7_18))))) }
explode_data.jsonl/49599
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 275 }
[ 2830, 3393, 32089, 8327, 82, 19198, 45, 7347, 1155, 353, 8840, 836, 8, 341, 6948, 1669, 2060, 7121, 1155, 692, 20082, 6184, 11, 1848, 1669, 43144, 65009, 6184, 19814, 330, 9535, 4452, 1138, 6948, 35699, 3964, 340, 16867, 2643, 84427, 10...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestOmit(t *testing.T) { user := User{Name: "OmitUser1", Age: 20} DB.Save(&user) var result User DB.Where("name = ?", user.Name).Omit("name").Find(&result) if result.ID == 0 { t.Errorf("Should not have ID because only selected name, %+v", result.ID) } if result.Name != "" || result.Age != 20 { t.Errorf("User Name should be omitted, got %v, Age should be ok, got %v", result.Name, result.Age) } }
explode_data.jsonl/48706
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 158 }
[ 2830, 3393, 46, 1763, 1155, 353, 8840, 836, 8, 341, 19060, 1669, 2657, 63121, 25, 330, 46, 1763, 1474, 16, 497, 13081, 25, 220, 17, 15, 532, 45409, 13599, 2099, 872, 692, 2405, 1102, 2657, 198, 45409, 17067, 445, 606, 284, 42313, 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...
4
func TestDirMapSendEntries(t *testing.T) { var got []string clearCallback := func() { got = nil } callback := func(entries fs.DirEntries) error { for _, entry := range entries { got = append(got, entry.Remote()) } return nil } // general test dm := newDirMap("") entries := fs.DirEntries{ mockobject.Object("dir/a"), mockobject.Object("dir/b"), mockdir.New("dir"), mockobject.Object("dir2/a"), mockobject.Object("dir2/b"), mockobject.Object("dir1/a"), mockobject.Object("dir3/b"), } require.NoError(t, dm.addEntries(entries)) clearCallback() err := dm.sendEntries(callback) require.NoError(t, err) assert.Equal(t, []string{ "dir1", "dir2", "dir3", }, got) // return error from callback callback2 := func(entries fs.DirEntries) error { return io.EOF } err = dm.sendEntries(callback2) require.Equal(t, io.EOF, err) // empty dm = newDirMap("") clearCallback() err = dm.sendEntries(callback) require.NoError(t, err) assert.Equal(t, []string(nil), got) }
explode_data.jsonl/65771
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 423 }
[ 2830, 3393, 6184, 2227, 11505, 24533, 1155, 353, 8840, 836, 8, 341, 2405, 2684, 3056, 917, 198, 40408, 7494, 1669, 2915, 368, 341, 197, 3174, 354, 284, 2092, 198, 197, 532, 43350, 1669, 2915, 72009, 8619, 83757, 24533, 8, 1465, 341, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestMinBalanceInRange(t *testing.T) { to, path, err := createBalances() assert.NoError(t, err, "createBalances() failed") defer func() { to.stor.close(t) err = common.CleanTemporaryDirs(path) assert.NoError(t, err, "failed to clean test data dirs") }() addr, err := proto.NewAddressFromString(addr0) assert.NoError(t, err, "NewAddressFromString() failed") for i := 1; i <= totalBlocksNumber; i++ { blockID := genBlockId(byte(i)) to.stor.addBlock(t, blockID) p := balanceProfile{uint64(i), 0, 0} if err := to.balances.setWavesBalance(addr.ID(), newWavesValueFromProfile(p), blockID); err != nil { t.Fatalf("Faied to set waves balance: %v\n", err) } } to.stor.flush(t) minBalance, err := to.balances.minEffectiveBalanceInRange(addr.ID(), 1, totalBlocksNumber) if err != nil { t.Fatalf("minEffectiveBalanceInRange(): %v\n", err) } if minBalance != 1 { t.Errorf("Invalid minimum balance in range: need %d, got %d.", 1, minBalance) } minBalance, err = to.balances.minEffectiveBalanceInRange(addr.ID(), 99, 150) if err != nil { t.Fatalf("minEffectiveBalanceInRange(): %v\n", err) } if minBalance != 99 { t.Errorf("Invalid minimum balance in range: need %d, got %d.", 99, minBalance) } }
explode_data.jsonl/37804
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 472 }
[ 2830, 3393, 6217, 21190, 76059, 1155, 353, 8840, 836, 8, 341, 31709, 11, 1815, 11, 1848, 1669, 1855, 37889, 3020, 741, 6948, 35699, 1155, 11, 1848, 11, 330, 3182, 37889, 3020, 368, 4641, 5130, 16867, 2915, 368, 341, 197, 31709, 1236, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestCustomTransferUploadConfig(t *testing.T) { path := "/path/to/binary" args := "-c 1 --whatever" cfg := config.NewFrom(config.Values{ Git: map[string]string{ "lfs.customtransfer.testupload.path": path, "lfs.customtransfer.testupload.args": args, "lfs.customtransfer.testupload.concurrent": "false", "lfs.customtransfer.testupload.direction": "upload", }, }) m := ConfigureManifest(NewManifest(), cfg) d := m.NewDownloadAdapter("testupload") assert.NotNil(t, d, "Download adapter should always be created") cd, _ := d.(*customAdapter) assert.Nil(t, cd, "Download adapter should NOT be custom (default to basic)") u := m.NewUploadAdapter("testupload") assert.NotNil(t, u, "Upload adapter should be present") cu, _ := u.(*customAdapter) assert.NotNil(t, cu, "Upload adapter should be customAdapter") assert.Equal(t, cu.path, path, "Path should be correct") assert.Equal(t, cu.args, args, "args should be correct") assert.Equal(t, cu.concurrent, false, "concurrent should be set") }
explode_data.jsonl/545
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 371 }
[ 2830, 3393, 10268, 21970, 13844, 2648, 1155, 353, 8840, 836, 8, 341, 26781, 1669, 3521, 2343, 32429, 3470, 3287, 698, 31215, 1669, 6523, 66, 220, 16, 1177, 68286, 698, 50286, 1669, 2193, 7121, 3830, 8754, 35145, 515, 197, 9600, 275, 25,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestStringArrayScanError(t *testing.T) { for _, tt := range []struct { input, err string }{ {``, "unable to parse array"}, {`{`, "unable to parse array"}, {`{{a},{b}}`, "cannot convert ARRAY[2][1] to StringArray"}, {`{NULL}`, "parsing array element index 0: cannot convert nil to string"}, {`{a,NULL}`, "parsing array element index 1: cannot convert nil to string"}, {`{a,b,NULL}`, "parsing array element index 2: cannot convert nil to string"}, } { arr := StringArray{"x", "x", "x"} err := arr.Scan(tt.input) if err == nil { t.Fatalf("Expected error for %q, got none", tt.input) } if !strings.Contains(err.Error(), tt.err) { t.Errorf("Expected error to contain %q for %q, got %q", tt.err, tt.input, err) } if !reflect.DeepEqual(arr, StringArray{"x", "x", "x"}) { t.Errorf("Expected destination not to change for %q, got %+v", tt.input, arr) } } }
explode_data.jsonl/5337
{ "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, 703, 1857, 26570, 1454, 1155, 353, 8840, 836, 8, 341, 2023, 8358, 17853, 1669, 2088, 3056, 1235, 341, 197, 22427, 11, 1848, 914, 198, 197, 59403, 197, 197, 90, 90716, 330, 45928, 311, 4715, 1334, 7115, 197, 197, 90, 63, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
5
func TestValidateDbOptionGroupName(t *testing.T) { cases := []struct { Value string ErrCount int }{ { Value: "testing123!", ErrCount: 1, }, { Value: "1testing123", ErrCount: 1, }, { Value: "testing--123", ErrCount: 1, }, { Value: "testing123-", ErrCount: 1, }, { Value: randomString(256), ErrCount: 1, }, } for _, tc := range cases { _, errors := validateDbOptionGroupName(tc.Value, "aws_db_option_group_name") if len(errors) != tc.ErrCount { t.Fatalf("Expected the DB Option Group Name to trigger a validation error") } } }
explode_data.jsonl/78617
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 287 }
[ 2830, 3393, 17926, 7994, 5341, 50569, 1155, 353, 8840, 836, 8, 341, 1444, 2264, 1669, 3056, 1235, 341, 197, 47399, 262, 914, 198, 197, 197, 7747, 2507, 526, 198, 197, 59403, 197, 197, 515, 298, 47399, 25, 262, 330, 8840, 16, 17, 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...
3
func TestQueueStoreListN(t *testing.T) { defer func() { if err := tearDownStore(); err != nil { t.Fatal("Failed to tear down store ", err) } }() store, err := setUpStore(queueDir, 10) if err != nil { t.Fatal("Failed to create a queue store ", err) } for i := 0; i < 10; i++ { if err := store.Put(testEvent); err != nil { t.Fatal("Failed to put to queue store ", err) } } // Should return all the event keys in the store. names, err := store.List() if err != nil { t.Fatal(err) } if len(names) != 10 { t.Fatalf("List() Expected: 10, got %d", len(names)) } if err = os.RemoveAll(queueDir); err != nil { t.Fatal(err) } _, err = store.List() if !os.IsNotExist(err) { t.Fatalf("Expected List() to fail with os.ErrNotExist, %s", err) } }
explode_data.jsonl/53363
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 327 }
[ 2830, 3393, 7554, 6093, 852, 45, 1155, 353, 8840, 836, 8, 341, 16867, 2915, 368, 341, 197, 743, 1848, 1669, 32825, 6093, 2129, 1848, 961, 2092, 341, 298, 3244, 26133, 445, 9408, 311, 17576, 1495, 3553, 3670, 1848, 340, 197, 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...
2
func TestClientStringer(t *testing.T) { type test struct { url string host string endpoint string post bool } tests := []test{ {"https://localhost:9669", "localhost:9669", "", true}, {"wss://localhost:9669/ws", "localhost:9669", "ws", false}, } for _, test := range tests { cfg := &ConnConfig{ Host: test.host, Endpoint: test.endpoint, HTTPPostMode: test.post, DisableTLS: false, DisableConnectOnNew: true, } c, err := New(cfg, nil) if err != nil { t.Errorf("%v rpcclient.New: %v", test.url, err) continue } s := c.String() if s != test.url { t.Errorf("Expected %q, got %q", test.url, s) } } }
explode_data.jsonl/62544
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 342 }
[ 2830, 3393, 2959, 703, 261, 1155, 353, 8840, 836, 8, 341, 13158, 1273, 2036, 341, 197, 19320, 414, 914, 198, 197, 63104, 257, 914, 198, 197, 6246, 2768, 914, 198, 197, 51172, 257, 1807, 198, 197, 532, 78216, 1669, 3056, 1944, 515, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
4
func TestResourceMetrics_CopyTo(t *testing.T) { ms := NewResourceMetrics() NewResourceMetrics().CopyTo(ms) assert.True(t, ms.IsNil()) generateTestResourceMetrics().CopyTo(ms) assert.EqualValues(t, generateTestResourceMetrics(), ms) }
explode_data.jsonl/19494
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 85 }
[ 2830, 3393, 4783, 27328, 77637, 1249, 1155, 353, 8840, 836, 8, 341, 47691, 1669, 1532, 4783, 27328, 741, 197, 3564, 4783, 27328, 1005, 12106, 1249, 35680, 340, 6948, 32443, 1155, 11, 9829, 4506, 19064, 2398, 3174, 13220, 2271, 4783, 27328...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestRandomIndex(t *testing.T) { const times = 10000 var tests = []struct { nums []int }{ {[]int{1, 2, 3, 3, 3}}, {[]int{1, 2, 3, 4, 5}}, {[]int{1, 2, 3, 4, 5, 5, 5, 5, 5}}, {[]int{1, 2, 3, 1, 2, 3, 1, 2, 3}}, } for _, tt := range tests { cnt := make(map[int]int) for _, num := range tt.nums { cnt[num]++ } s := Constructor(tt.nums) for target, c := range cnt { indexs := make(map[int]int) for i := 0; i < times; i++ { indexs[s.Pick(target)]++ } want := 1 / float64(c) for i, n := range indexs { got := float64(n) / times if math.Abs(got-want) > 1e-2 { t.Errorf("%v: the probability of index %v is %v, want %v", tt.nums, i, got, want) } } } } }
explode_data.jsonl/23721
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 377 }
[ 2830, 3393, 13999, 1552, 1155, 353, 8840, 836, 8, 341, 4777, 3039, 284, 220, 16, 15, 15, 15, 15, 271, 2405, 7032, 284, 3056, 1235, 341, 197, 22431, 82, 3056, 396, 198, 197, 59403, 197, 197, 90, 1294, 396, 90, 16, 11, 220, 17, 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...
7
func TestZeroX50_Valid(t *testing.T) { type fields struct { Version int32 EncryptedURL []byte DecryptedHash []byte } tests := []struct { name string fields fields wantErr bool }{ { "success", fields{ 0, []byte("EncryptedURL"), []byte("DecryptedHash"), }, false, }, { "err-decryptedHash", fields{ 0, []byte("EncryptedURL"), []byte{}, }, true, }, { "err-EncryptedURL", fields{ 0, []byte{}, []byte{}, }, true, }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { d := &ZeroX50{ Version: tt.fields.Version, EncryptedURL: tt.fields.EncryptedURL, DecryptedHash: tt.fields.DecryptedHash, } if err := d.Valid(); (err != nil) != tt.wantErr { t.Errorf("ZeroX50.Valid() error = %v, wantErr %v", err, tt.wantErr) } }) } }
explode_data.jsonl/48055
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 453 }
[ 2830, 3393, 17999, 55, 20, 15, 97279, 1155, 353, 8840, 836, 8, 341, 13158, 5043, 2036, 341, 197, 77847, 981, 526, 18, 17, 198, 197, 197, 7408, 14026, 3144, 220, 3056, 3782, 198, 197, 197, 4900, 14026, 6370, 3056, 3782, 198, 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...
2
func TestCheckWebserverConfigValues(t *testing.T) { checkWebserverConfigValues := GetConfig() err := checkWebserverConfigValues.LoadConfig(ConfigTestFile) if err != nil { t.Errorf( "Test failed. checkWebserverConfigValues.LoadConfig: %s", err.Error(), ) } err = checkWebserverConfigValues.CheckWebserverConfigValues() if err != nil { t.Errorf( "Test failed. checkWebserverConfigValues.CheckWebserverConfigValues: %s", err.Error(), ) } checkWebserverConfigValues.Webserver.WebsocketConnectionLimit = -1 err = checkWebserverConfigValues.CheckWebserverConfigValues() if err != nil { t.Errorf( "Test failed. checkWebserverConfigValues.CheckWebserverConfigValues: %s", err.Error(), ) } if checkWebserverConfigValues.Webserver.WebsocketConnectionLimit != 1 { t.Error( "Test failed. checkWebserverConfigValues.CheckWebserverConfigValues error", ) } checkWebserverConfigValues.Webserver.ListenAddress = ":0" err = checkWebserverConfigValues.CheckWebserverConfigValues() if err == nil { t.Error( "Test failed. checkWebserverConfigValues.CheckWebserverConfigValues error", ) } checkWebserverConfigValues.Webserver.ListenAddress = ":LOLOLOL" err = checkWebserverConfigValues.CheckWebserverConfigValues() if err == nil { t.Error( "Test failed. checkWebserverConfigValues.CheckWebserverConfigValues error", ) } checkWebserverConfigValues.Webserver.ListenAddress = "LOLOLOL" err = checkWebserverConfigValues.CheckWebserverConfigValues() if err == nil { t.Error( "Test failed. checkWebserverConfigValues.CheckWebserverConfigValues error", ) } checkWebserverConfigValues.Webserver.AdminUsername = "" err = checkWebserverConfigValues.CheckWebserverConfigValues() if err == nil { t.Error( "Test failed. checkWebserverConfigValues.CheckWebserverConfigValues error", ) } }
explode_data.jsonl/21901
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 652 }
[ 2830, 3393, 3973, 5981, 4030, 2648, 6227, 1155, 353, 8840, 836, 8, 341, 25157, 5981, 4030, 2648, 6227, 1669, 2126, 2648, 741, 9859, 1669, 1779, 5981, 4030, 2648, 6227, 13969, 2648, 33687, 2271, 1703, 340, 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...
9
func TestCopy(t *testing.T) { type Foo struct { A int B []*string C map[string]*int } // Create the initial value str1 := "hello" str2 := "bye bye" int1 := 1 int2 := 2 f1 := &Foo{ A: 1, B: []*string{&str1, &str2}, C: map[string]*int{ "A": &int1, "B": &int2, }, } // Do the copy var f2 Foo awsutil.Copy(&f2, f1) // Values are equal assert.Equal(t, f2.A, f1.A) assert.Equal(t, f2.B, f1.B) assert.Equal(t, f2.C, f1.C) // But pointers are not! str3 := "nothello" int3 := 57 f2.A = 100 f2.B[0] = &str3 f2.C["B"] = &int3 assert.NotEqual(t, f2.A, f1.A) assert.NotEqual(t, f2.B, f1.B) assert.NotEqual(t, f2.C, f1.C) }
explode_data.jsonl/57508
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 359 }
[ 2830, 3393, 12106, 1155, 353, 8840, 836, 8, 341, 13158, 33428, 2036, 341, 197, 22985, 526, 198, 197, 12791, 29838, 917, 198, 197, 6258, 2415, 14032, 8465, 396, 198, 197, 630, 197, 322, 4230, 279, 2856, 897, 198, 11355, 16, 1669, 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 TestBuffer_BatchLenExact(t *testing.T) { m := Metric() b := setup(NewBuffer("test", 5)) b.Add(m, m) batch := b.Batch(2) require.Len(t, batch, 2) }
explode_data.jsonl/17667
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 72 }
[ 2830, 3393, 4095, 1668, 754, 11271, 57954, 1155, 353, 8840, 836, 8, 341, 2109, 1669, 52458, 741, 2233, 1669, 6505, 35063, 4095, 445, 1944, 497, 220, 20, 1171, 2233, 1904, 1255, 11, 296, 340, 2233, 754, 1669, 293, 45791, 7, 17, 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
func TestGetURLEncodedName(t *testing.T) { testCases := []struct { // Input. inputStr string // Expected result. result string }{ // % should be encoded as %25 {"thisisthe%url", "thisisthe%25url"}, // UTF-8 encoding. {"本語", "%E6%9C%AC%E8%AA%9E"}, // UTF-8 encoding with ASCII. {"本語.1", "%E6%9C%AC%E8%AA%9E.1"}, // Unusual ASCII characters. {">123", "%3E123"}, // Fragment path characters. {"myurl#link", "myurl%23link"}, // Space should be set to %20 not '+'. {"space in url", "space%20in%20url"}, // '+' shouldn't be treated as space. {"url+path", "url%2Bpath"}, } // Tests generated values from url encoded name. for i, testCase := range testCases { result := getURLEncodedName(testCase.inputStr) if testCase.result != result { t.Errorf("Test %d: Expected URLEncoded result to be \"%s\", but found it to be \"%s\" instead", i+1, testCase.result, result) } } }
explode_data.jsonl/81627
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 378 }
[ 2830, 3393, 1949, 1511, 867, 1016, 6737, 675, 1155, 353, 8840, 836, 8, 341, 18185, 37302, 1669, 3056, 1235, 341, 197, 197, 322, 5571, 624, 197, 22427, 2580, 914, 198, 197, 197, 322, 31021, 1102, 624, 197, 9559, 914, 198, 197, 59403, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestPrepareRun(t *testing.T) { s, etcdserver, config, assert := newMaster(t) defer etcdserver.Terminate(t) assert.NotNil(config.SwaggerConfig) // assert.NotNil(config.OpenAPIConfig) server := httptest.NewServer(s.Handler.Director) defer server.Close() s.PrepareRun() // openapi is installed in PrepareRun // resp, err := http.Get(server.URL + "/swagger.json") // assert.NoError(err) // assert.Equal(http.StatusOK, resp.StatusCode) // swagger is installed in PrepareRun resp, err := http.Get(server.URL + "/swaggerapi/") assert.NoError(err) assert.Equal(http.StatusOK, resp.StatusCode) // healthz checks are installed in PrepareRun resp, err = http.Get(server.URL + "/healthz") assert.NoError(err) assert.Equal(http.StatusOK, resp.StatusCode) resp, err = http.Get(server.URL + "/healthz/ping") assert.NoError(err) assert.Equal(http.StatusOK, resp.StatusCode) }
explode_data.jsonl/18760
{ "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, 50590, 6727, 1155, 353, 8840, 836, 8, 341, 1903, 11, 1842, 4385, 4030, 11, 2193, 11, 2060, 1669, 501, 18041, 1155, 340, 16867, 1842, 4385, 4030, 836, 261, 34016, 1155, 692, 6948, 93882, 8754, 808, 86, 10114, 2648, 340, 197...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestGitService_DeleteRef(t *testing.T) { setup() defer teardown() mux.HandleFunc("/repos/o/r/git/refs/heads/b", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "DELETE") }) _, err := client.Git.DeleteRef("o", "r", "heads/b") if err != nil { t.Errorf("Git.DeleteRef returned error: %v", err) } }
explode_data.jsonl/27835
{ "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, 46562, 1860, 57418, 3945, 1155, 353, 8840, 836, 8, 341, 84571, 741, 16867, 49304, 2822, 2109, 2200, 63623, 4283, 68354, 20271, 7382, 60590, 14, 16149, 14, 35810, 3470, 497, 2915, 3622, 1758, 37508, 11, 435, 353, 1254, 9659, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestStructOfAlg(t *testing.T) { st := StructOf([]StructField{{Name: "X", Tag: "x", Type: TypeOf(int(0))}}) v1 := New(st).Elem() v2 := New(st).Elem() if !DeepEqual(v1.Interface(), v1.Interface()) { t.Errorf("constructed struct %v not equal to itself", v1.Interface()) } v1.FieldByName("X").Set(ValueOf(int(1))) if i1, i2 := v1.Interface(), v2.Interface(); DeepEqual(i1, i2) { t.Errorf("constructed structs %v and %v should not be equal", i1, i2) } st = StructOf([]StructField{{Name: "X", Tag: "x", Type: TypeOf([]int(nil))}}) v1 = New(st).Elem() shouldPanic(func() { _ = v1.Interface() == v1.Interface() }) }
explode_data.jsonl/29604
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 266 }
[ 2830, 3393, 9422, 2124, 86895, 1155, 353, 8840, 836, 8, 341, 18388, 1669, 16139, 2124, 10556, 9422, 1877, 2979, 675, 25, 330, 55, 497, 12353, 25, 330, 87, 497, 3990, 25, 3990, 2124, 1548, 7, 15, 593, 71362, 5195, 16, 1669, 1532, 589...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestSwap(t *testing.T) { t.Parallel() pair := NewCurrencyPair("BTC", "USD") actual := pair.Swap().Pair() expected := CurrencyItem("USDBTC") if actual != expected { t.Errorf( "Test failed. TestSwap: %s was not equal to expected value: %s", actual, expected, ) } }
explode_data.jsonl/55832
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 113 }
[ 2830, 3393, 46179, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 741, 3223, 1310, 1669, 1532, 26321, 12443, 445, 59118, 497, 330, 26749, 1138, 88814, 1669, 6716, 808, 21726, 1005, 12443, 741, 42400, 1669, 28453, 1234, 445, 2034, 3506, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestServiceToSchema(t *testing.T) { did := "did:factom:301a57c2e753d061928cf6b6a692ea052885d75d2af5640e9b5cbc8897bbf7d5" s, _ := NewService("kyc", "KYC", "https://kyc.example.com") // test priorityRequirement 0 not omited var i *int i = new(int) *i = 0 s.PriorityRequirement = i s2, err := s.toSchema(did) assert.NotEmpty(t, s2) assert.NoError(t, err) }
explode_data.jsonl/51899
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 174 }
[ 2830, 3393, 1860, 1249, 8632, 1155, 353, 8840, 836, 8, 1476, 2698, 307, 1669, 330, 22920, 25, 33110, 316, 25, 18, 15, 16, 64, 20, 22, 66, 17, 68, 22, 20, 18, 67, 15, 21, 16, 24, 17, 23, 9792, 21, 65, 21, 64, 21, 24, 17, 12...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestListImages(t *testing.T) { mockRepoName := "mockRepoName" mockError := errors.New("mockError") mockDigest := "mockDigest" mockNextToken := "next" tests := map[string]struct { mockECRClient func(m *mocks.Mockapi) wantImages []Image wantError error }{ "should wrap error returned by ECR DescribeImages": { mockECRClient: func(m *mocks.Mockapi) { m.EXPECT().DescribeImages(gomock.Any()).Return(nil, mockError) }, wantImages: nil, wantError: fmt.Errorf("ecr repo %s describe images: %w", mockRepoName, mockError), }, "should return Image list": { mockECRClient: func(m *mocks.Mockapi) { m.EXPECT().DescribeImages(gomock.Any()).Return(&ecr.DescribeImagesOutput{ ImageDetails: []*ecr.ImageDetail{ &ecr.ImageDetail{ ImageDigest: aws.String(mockDigest), }, }, }, nil) }, wantImages: []Image{Image{Digest: mockDigest}}, wantError: nil, }, "should return all images when paginated": { mockECRClient: func(m *mocks.Mockapi) { m.EXPECT().DescribeImages(&ecr.DescribeImagesInput{ RepositoryName: aws.String(mockRepoName), }).Return(&ecr.DescribeImagesOutput{ ImageDetails: []*ecr.ImageDetail{ &ecr.ImageDetail{ ImageDigest: aws.String(mockDigest), }, }, NextToken: &mockNextToken, }, nil) m.EXPECT().DescribeImages(&ecr.DescribeImagesInput{ RepositoryName: aws.String(mockRepoName), NextToken: &mockNextToken, }).Return(&ecr.DescribeImagesOutput{ ImageDetails: []*ecr.ImageDetail{ &ecr.ImageDetail{ ImageDigest: aws.String(mockDigest), }, }, }, nil) }, wantImages: []Image{Image{Digest: mockDigest}, Image{Digest: mockDigest}}, wantError: nil, }, } for name, tc := range tests { t.Run(name, func(t *testing.T) { // GIVEN ctrl := gomock.NewController(t) defer ctrl.Finish() mockECRAPI := mocks.NewMockapi(ctrl) tc.mockECRClient(mockECRAPI) client := ECR{ mockECRAPI, } gotImages, gotError := client.ListImages(mockRepoName) require.ElementsMatch(t, tc.wantImages, gotImages) require.Equal(t, tc.wantError, gotError) }) } }
explode_data.jsonl/31314
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 995 }
[ 2830, 3393, 852, 14228, 1155, 353, 8840, 836, 8, 341, 77333, 25243, 675, 1669, 330, 16712, 25243, 675, 698, 77333, 1454, 1669, 5975, 7121, 445, 16712, 1454, 1138, 77333, 45217, 1669, 330, 16712, 45217, 698, 77333, 5847, 3323, 1669, 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 TestClientGetClientIDs(t *testing.T) { cs := createClientStore() if count := cs.count(); count != 0 { t.Fatalf("Expected no client, got %v", count) } nuid := nuid.New() cs.register(&spb.ClientInfo{ID: "me", HbInbox: nuid.Next()}) cs.register(&spb.ClientInfo{ID: "me2", HbInbox: nuid.Next()}) clients := cs.getClients() if clients == nil || len(clients) != 2 { t.Fatalf("Expected to get 2 clients, got %v", len(clients)) } for _, c := range clients { if c.info.ID != "me" && c.info.ID != "me2" { t.Fatalf("Unexpected client ID: %v", c.info.ID) } } }
explode_data.jsonl/37759
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 244 }
[ 2830, 3393, 2959, 1949, 2959, 30466, 1155, 353, 8840, 836, 8, 341, 71899, 1669, 1855, 2959, 6093, 2822, 743, 1760, 1669, 10532, 6501, 2129, 1760, 961, 220, 15, 341, 197, 3244, 30762, 445, 18896, 902, 2943, 11, 2684, 1018, 85, 497, 176...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestClient_GetAlertConditions(t *testing.T) { ctx := context.Background() cl, err := client.NewClient("http://example.com/api", "admin", "admin") require.Nil(t, err) buf, err := ioutil.ReadFile("../testdata/alert_condition/alert_conditions.json") require.Nil(t, err) cl.SetHTTPClient(&http.Client{ Transport: &flute.Transport{ T: t, Services: []flute.Service{ { Endpoint: "http://example.com", Routes: []flute.Route{ { Tester: &flute.Tester{ Method: "GET", Path: "/api/alerts/conditions", PartOfHeader: getTestHeader(), }, Response: &flute.Response{ Base: http.Response{ StatusCode: 200, }, BodyString: string(buf), }, }, }, }, }, }, }) _, _, _, err = cl.GetAlertConditions(ctx) if err != nil { t.Fatal(err) } }
explode_data.jsonl/29837
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 437 }
[ 2830, 3393, 2959, 13614, 9676, 35435, 1155, 353, 8840, 836, 8, 341, 20985, 1669, 2266, 19047, 2822, 39407, 11, 1848, 1669, 2943, 7121, 2959, 445, 1254, 1110, 8687, 905, 10508, 497, 330, 2882, 497, 330, 2882, 1138, 17957, 59678, 1155, 11...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestParseKeyEncryptionKey(t *testing.T) { assert := assert.New(t) kek, err := models.ParseKeyEncryptionKey("8:0D17FE0FDA5F1CE46307561714C6938FDFE9408BF6712BE49D3FC4C757D0E62E") assert.NoError(err) assert.Equal(8, kek.ID) _, err = models.ParseKeyEncryptionKey("8:-D1%F0FD<A5F1<E46307561714C6938FDFE9408BF6712BE49D3FC4C757D0E62>") assert.Error(err) _, err = models.ParseKeyEncryptionKey("X:80A74BE621F75875BE56E4CD1AE1B2A8DF4722FB6C6A107779DDB198C78E4DAC") assert.Error(err) _, err = models.ParseKeyEncryptionKey("8:80A74BE621F75875BE56E4CD1AE1B2A8") assert.Error(err) }
explode_data.jsonl/16332
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 292 }
[ 2830, 3393, 14463, 1592, 79239, 1592, 1155, 353, 8840, 836, 8, 341, 6948, 1669, 2060, 7121, 1155, 692, 197, 85207, 11, 1848, 1669, 4119, 8937, 1592, 79239, 1592, 445, 23, 25, 15, 35, 16, 22, 11419, 15, 81069, 20, 37, 16, 2104, 19, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestTrustedJobs(t *testing.T) { // TODO(fejta): allow each config/jobs/kubernetes/foo/foo-trusted.yaml // that uses a foo-trusted cluster const trusted = "test-infra-trusted" trustedPath := path.Join(*jobConfigPath, "kubernetes", "test-infra", "test-infra-trusted.yaml") // Presubmits may not use trusted clusters. for _, pre := range c.AllStaticPresubmits(nil) { if pre.Cluster == trusted { t.Errorf("%s: presubmits cannot use trusted clusters", pre.Name) } } // Trusted postsubmits must be defined in trustedPath for _, post := range c.AllStaticPostsubmits(nil) { if post.Cluster == trusted && post.SourcePath != trustedPath { t.Errorf("%s defined in %s may not run in trusted cluster", post.Name, post.SourcePath) } } // Trusted periodics must be defined in trustedPath for _, per := range c.AllPeriodics() { if per.Cluster == trusted && per.SourcePath != trustedPath { t.Errorf("%s defined in %s may not run in trusted cluster", per.Name, per.SourcePath) } } }
explode_data.jsonl/55575
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 358 }
[ 2830, 3393, 1282, 27145, 40667, 1155, 353, 8840, 836, 8, 341, 197, 322, 5343, 955, 35468, 2565, 1648, 2138, 1817, 2193, 4437, 5481, 79587, 60555, 60555, 10188, 27145, 33406, 198, 197, 322, 429, 5711, 264, 15229, 10188, 27145, 10652, 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...
9
func TestStreamSelectScatter(t *testing.T) { // Special setup: Don't use createLegacyExecutorEnv. cell := "aa" hc := discovery.NewFakeLegacyHealthCheck() s := createSandbox("TestExecutor") s.VSchema = executorVSchema getSandbox(KsTestUnsharded).VSchema = unshardedVSchema serv := new(sandboxTopo) resolver := newTestLegacyResolver(hc, serv, cell) shards := []string{"-20", "20-40", "40-60", "60-80", "80-a0", "a0-c0", "c0-e0", "e0-"} for _, shard := range shards { _ = hc.AddTestTablet(cell, shard, 1, "TestExecutor", shard, topodatapb.TabletType_MASTER, true, 1, nil) } executor := NewExecutor(context.Background(), serv, cell, resolver, false, testBufferSize, testCacheSize) sql := "select id from user" result, err := executorStream(executor, sql) require.NoError(t, err) wantResult := &sqltypes.Result{ Fields: sandboxconn.SingleRowResult.Fields, Rows: [][]sqltypes.Value{ sandboxconn.StreamRowResult.Rows[0], sandboxconn.StreamRowResult.Rows[0], sandboxconn.StreamRowResult.Rows[0], sandboxconn.StreamRowResult.Rows[0], sandboxconn.StreamRowResult.Rows[0], sandboxconn.StreamRowResult.Rows[0], sandboxconn.StreamRowResult.Rows[0], sandboxconn.StreamRowResult.Rows[0], }, } if !result.Equal(wantResult) { t.Errorf("result: %+v, want %+v", result, wantResult) } }
explode_data.jsonl/67411
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 534 }
[ 2830, 3393, 3027, 3379, 3326, 1650, 1155, 353, 8840, 836, 8, 341, 197, 322, 9785, 6505, 25, 4320, 944, 990, 1855, 77415, 25255, 14359, 624, 45987, 1669, 330, 5305, 698, 9598, 66, 1669, 18335, 7121, 52317, 77415, 14542, 3973, 741, 1903, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestNewWithGlob(t *testing.T) { tests := []struct { name string prefetch bool }{ {"no prefetch", false}, {"prefetch", true}, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { fs, err := testFilesystem(t, "github.com/posener/gitfs/internal/testdata", tt.prefetch, []string{"*/*1"}) require.NoError(t, err) _, err = fs.Open("d1/d11") assert.NoError(t, err) _, err = fs.Open("d1") assert.NoError(t, err) _, err = fs.Open("f01") assert.Error(t, err) }) } }
explode_data.jsonl/11437
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 247 }
[ 2830, 3393, 3564, 2354, 38, 1684, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 3056, 1235, 341, 197, 11609, 257, 914, 198, 197, 3223, 1097, 2995, 1807, 198, 197, 59403, 197, 197, 4913, 2152, 90477, 497, 895, 1583, 197, 197, 4913, 30552,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestHandshakeClientP256(t *testing.T) { config := testConfig.Clone() config.CurvePreferences = []CurveID{CurveP256} test := &clientTest{ name: "P256-ECDHE", args: []string{"-cipher", "ECDHE-RSA-AES128-GCM-SHA256", "-curves", "P-256"}, config: config, } runClientTestTLS12(t, test) runClientTestTLS13(t, test) }
explode_data.jsonl/27701
{ "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, 2314, 29661, 2959, 47, 17, 20, 21, 1155, 353, 8840, 836, 8, 341, 25873, 1669, 1273, 2648, 64463, 741, 25873, 727, 73047, 14306, 284, 3056, 31325, 915, 90, 31325, 47, 17, 20, 21, 630, 18185, 1669, 609, 2972, 2271, 515, 19...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestRetrieveSubscriptionNotFound(t *testing.T) { ts := httptest.NewServer( http.HandlerFunc( func(w http.ResponseWriter, r *http.Request) { if strings.HasSuffix(r.URL.Path, "/v2") { apiResourcesHandler(w, r) } else { w.Header().Set("Content-Type", "application/json") w.WriteHeader(http.StatusNotFound) fmt.Fprintf(w, `{"error":"NotFound","description":"The requested subscription has not been found. Check id"}`) } })) defer ts.Close() cli, err := client.NewNgsiV2Client(client.SetUrl(ts.URL)) if err != nil { t.Fatalf("Unexpected error: '%v'", err) } if sub, err := cli.RetrieveSubscription("123456789012345678901234"); err == nil { t.Fatal("Expected an error") } else if sub != nil { t.Fatalf("Subscription should be nil, got '%+v' instead", sub) } }
explode_data.jsonl/64666
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 331 }
[ 2830, 3393, 87665, 33402, 10372, 1155, 353, 8840, 836, 8, 341, 57441, 1669, 54320, 70334, 7121, 5475, 1006, 197, 28080, 89164, 1006, 298, 29244, 3622, 1758, 37508, 11, 435, 353, 1254, 9659, 8, 341, 571, 743, 9069, 16152, 40177, 2601, 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...
2
func TestPurgeMessages(t *testing.T) { _, tsv, db := newTestTxExecutor(t) defer db.Close() defer tsv.StopService() target := querypb.Target{TabletType: topodatapb.TabletType_PRIMARY} _, err := tsv.messager.GetGenerator("nonmsg") want := "message table nonmsg not found in schema" require.Error(t, err) require.Contains(t, err.Error(), want) gen, err := tsv.messager.GetGenerator("msg") require.NoError(t, err) _, err = tsv.PurgeMessages(ctx, &target, gen, 0) want = "query: 'delete from msg where time_acked" require.Error(t, err) assert.Contains(t, err.Error(), want) db.AddQuery("delete from msg where time_acked < 3 limit 500", &sqltypes.Result{RowsAffected: 1}) count, err := tsv.PurgeMessages(ctx, &target, gen, 3) require.NoError(t, err) require.EqualValues(t, 1, count) }
explode_data.jsonl/80011
{ "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, 47, 39823, 15820, 1155, 353, 8840, 836, 8, 341, 197, 6878, 259, 3492, 11, 2927, 1669, 501, 2271, 31584, 25255, 1155, 340, 16867, 2927, 10421, 741, 16867, 259, 3492, 30213, 1860, 741, 28861, 1669, 3239, 16650, 35016, 90, 2556...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestAuthcryptPackerSuccess(t *testing.T) { k := createKMS(t) tests := []struct { name string keyType kms.KeyType encAlg afgjose.EncAlg cty string mediaType string }{ { name: "authcrypt using NISTP256ECDHKW and AES256-GCM", keyType: kms.NISTP256ECDHKWType, encAlg: afgjose.A256GCM, cty: transport.MediaTypeV1PlaintextPayload, mediaType: transport.MediaTypeV2EncryptedEnvelopeV1PlaintextPayload, }, { name: "authcrypt using NISTP384ECDHKW and AES256-GCM", keyType: kms.NISTP384ECDHKWType, encAlg: afgjose.A256GCM, cty: transport.MediaTypeV1PlaintextPayload, mediaType: transport.MediaTypeV2EncryptedEnvelopeV1PlaintextPayload, }, { name: "authcrypt using NISTP521ECDHKW and AES256-GCM", keyType: kms.NISTP521ECDHKWType, encAlg: afgjose.A256GCM, cty: transport.MediaTypeV1PlaintextPayload, mediaType: transport.MediaTypeV2EncryptedEnvelopeV1PlaintextPayload, }, { name: "authcrypt using X25519ECDHKWType and AES256-GCM", keyType: kms.X25519ECDHKWType, encAlg: afgjose.A256GCM, cty: transport.MediaTypeV1PlaintextPayload, mediaType: transport.MediaTypeV2EncryptedEnvelopeV1PlaintextPayload, }, { name: "authcrypt using NISTP256ECDHKW and XChacha20Poly1305", keyType: kms.NISTP256ECDHKW, encAlg: afgjose.XC20P, cty: transport.MediaTypeV1PlaintextPayload, mediaType: transport.MediaTypeV2EncryptedEnvelopeV1PlaintextPayload, }, { name: "authcrypt using NISTP384ECDHKW and XChacha20Poly1305", keyType: kms.NISTP384ECDHKW, encAlg: afgjose.XC20P, cty: transport.MediaTypeV1PlaintextPayload, mediaType: transport.MediaTypeV2EncryptedEnvelopeV1PlaintextPayload, }, { name: "authcrypt using NISTP521ECDHKW and XChacha20Poly1305", keyType: kms.NISTP521ECDHKW, encAlg: afgjose.XC20P, cty: transport.MediaTypeV1PlaintextPayload, mediaType: transport.MediaTypeV2EncryptedEnvelopeV1PlaintextPayload, }, { name: "authcrypt using X25519ECDHKWType and XChacha20Poly1305", keyType: kms.X25519ECDHKWType, encAlg: afgjose.XC20P, cty: transport.MediaTypeV1PlaintextPayload, mediaType: transport.MediaTypeV2EncryptedEnvelopeV1PlaintextPayload, }, { name: "authcrypt using NISTP256ECDHKW and AES256-GCM without cty", keyType: kms.NISTP256ECDHKWType, encAlg: afgjose.A256GCM, cty: transport.MediaTypeV1PlaintextPayload, mediaType: transport.MediaTypeV2EncryptedEnvelopeV1PlaintextPayload, }, { name: "authcrypt using X25519ECDHKW and XChacha20Poly1305 without cty", keyType: kms.X25519ECDHKWType, encAlg: afgjose.XC20P, cty: transport.MediaTypeV1PlaintextPayload, mediaType: transport.MediaTypeV2EncryptedEnvelopeV1PlaintextPayload, }, { name: "authcrypt using NISTP256ECDHKW and XChacha20Poly1305 without cty", keyType: kms.NISTP256ECDHKWType, encAlg: afgjose.XC20P, cty: transport.MediaTypeV1PlaintextPayload, mediaType: transport.MediaTypeV2EncryptedEnvelopeV1PlaintextPayload, }, { name: "authcrypt using X25519ECDHKW and AES256-GCM without cty", keyType: kms.X25519ECDHKWType, encAlg: afgjose.A256GCM, cty: transport.MediaTypeV1PlaintextPayload, mediaType: transport.MediaTypeV2EncryptedEnvelopeV1PlaintextPayload, }, } t.Parallel() for _, tt := range tests { tc := tt t.Run(fmt.Sprintf("running %s", tc.name), func(t *testing.T) { t.Logf("authcrypt packing - creating sender %s key...", tc.keyType) skid, senderKey, _ := createAndMarshalKeyByKeyType(t, k, tc.keyType) t.Logf("authcrypt packing - creating recipient %s keys...", tc.keyType) _, recipientsKeys, keyHandles := createRecipientsByKeyType(t, k, 3, tc.keyType) thirdPartyKeyStore := make(map[string]mockstorage.DBEntry) mockStoreProvider := &mockstorage.MockStoreProvider{Store: &mockstorage.MockStore{ Store: thirdPartyKeyStore, }} log.SetLevel("aries-framework/pkg/didcomm/packer/authcrypt", spilog.DEBUG) cryptoSvc, err := tinkcrypto.New() require.NoError(t, err) authPacker, err := New(newMockProvider(mockStoreProvider, k, cryptoSvc), tc.encAlg) require.NoError(t, err) // add sender key in thirdPartyKS (prep step before Authcrypt.Pack()/Unpack()) fromWrappedKID := prefix.StorageKIDPrefix + skid thirdPartyKeyStore[fromWrappedKID] = mockstorage.DBEntry{Value: senderKey} origMsg := []byte("secret message") ct, err := authPacker.Pack(tc.cty, origMsg, []byte(skid), recipientsKeys) require.NoError(t, err) jweStr, err := prettyPrint(ct) require.NoError(t, err) t.Logf("* authcrypt JWE: %s", jweStr) msg, err := authPacker.Unpack(ct) require.NoError(t, err) recKey, err := exportPubKeyBytes(keyHandles[0]) require.NoError(t, err) require.EqualValues(t, &transport.Envelope{MediaType: tc.mediaType, Message: origMsg, ToKey: recKey}, msg) jweJSON, err := afgjose.Deserialize(string(ct)) require.NoError(t, err) verifyJWETypes(t, tc.cty, jweJSON.ProtectedHeaders) // try with only 1 recipient to force compact JWE serialization ct, err = authPacker.Pack(tc.cty, origMsg, []byte(skid), [][]byte{recipientsKeys[0]}) require.NoError(t, err) t.Logf("* authcrypt JWE Compact serialization (using first recipient only): %s", ct) jweJSON, err = afgjose.Deserialize(string(ct)) require.NoError(t, err) jweStr, err = jweJSON.FullSerialize(json.Marshal) require.NoError(t, err) t.Logf("* authcrypt Flattened JWE JSON serialization (using first recipient only): %s", jweStr) msg, err = authPacker.Unpack(ct) require.NoError(t, err) require.EqualValues(t, &transport.Envelope{MediaType: tc.mediaType, Message: origMsg, ToKey: recKey}, msg) verifyJWETypes(t, tc.cty, jweJSON.ProtectedHeaders) }) } }
explode_data.jsonl/19839
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 2674 }
[ 2830, 3393, 5087, 48125, 47, 9683, 7188, 1155, 353, 8840, 836, 8, 341, 16463, 1669, 1855, 42, 4826, 1155, 692, 78216, 1669, 3056, 1235, 341, 197, 11609, 414, 914, 198, 197, 23634, 929, 256, 96677, 9610, 929, 198, 197, 197, 954, 86895,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestDestinationRuleNoWorkloadReferences(t *testing.T) { assert := assert.New(t) conf := config.NewConfig() config.Set(conf) // Setup mocks references := prepareTestForDestinationRule(data.CreateEmptyDestinationRule("reviews", "bookinfo", "reviews.bookinfo.svc.cluster.local"), getVirtualService(t)) assert.NotEmpty(references.ServiceReferences) assert.Empty(references.WorkloadReferences) }
explode_data.jsonl/26928
{ "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, 33605, 11337, 2753, 6776, 1078, 31712, 1155, 353, 8840, 836, 8, 341, 6948, 1669, 2060, 7121, 1155, 340, 67850, 1669, 2193, 7121, 2648, 741, 25873, 4202, 29879, 692, 197, 322, 18626, 68909, 198, 17200, 4901, 1669, 10549, 2271, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestWatch(t *testing.T) { storage, _, server := newStorage(t) defer server.Terminate(t) defer storage.Store.DestroyFunc() test := registrytest.New(t, storage.Store) test.TestWatch( validService(), // matching labels []labels.Set{}, // not matching labels []labels.Set{ {"foo": "bar"}, }, // matching fields []fields.Set{ {"metadata.name": "foo"}, }, // not matchin fields []fields.Set{ {"metadata.name": "bar"}, }, ) }
explode_data.jsonl/69214
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 188 }
[ 2830, 3393, 14247, 1155, 353, 8840, 836, 8, 341, 197, 16172, 11, 8358, 3538, 1669, 501, 5793, 1155, 340, 16867, 3538, 836, 261, 34016, 1155, 340, 16867, 5819, 38047, 57011, 9626, 741, 18185, 1669, 19424, 1944, 7121, 1155, 11, 5819, 3804...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1