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 TestEntry_Disable_OnFocus(t *testing.T) { entry, window := setupImageTest(t, false) defer teardownImageTest(window) c := window.Canvas() entry.Disable() entry.FocusGained() test.AssertRendersToMarkup(t, "entry/focused_disabled.xml", c) entry.Enable() entry.FocusGained() test.AssertRendersToMarkup(t, "entry/focused_enabled.xml", c) }
explode_data.jsonl/12367
{ "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, 5874, 45525, 480, 35482, 13819, 1155, 353, 8840, 836, 8, 341, 48344, 11, 3241, 1669, 6505, 1906, 2271, 1155, 11, 895, 340, 16867, 49304, 1906, 2271, 15906, 340, 1444, 1669, 3241, 54121, 2822, 48344, 10166, 480, 741, 48344, 4...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestSelectableFieldLabelConversions(t *testing.T) { apitesting.TestSelectableFieldLabelConversionsOfKind(t, testapi.Extensions.GroupVersion().String(), "Ingress", IngressToSelectableFields(&extensions.Ingress{}), nil, ) }
explode_data.jsonl/36588
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 84 }
[ 2830, 3393, 68707, 1877, 2476, 1109, 28290, 1155, 353, 8840, 836, 8, 341, 69898, 275, 59855, 8787, 68707, 1877, 2476, 1109, 28290, 2124, 10629, 1155, 345, 197, 18185, 2068, 20526, 5407, 5637, 1005, 703, 3148, 197, 197, 32603, 2483, 756, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestFIFO_requeueOnPop(t *testing.T) { f := New(testFifoObjectKeyFunc) f.Add(mkFifoObj("foo", 10)) // nolint: errcheck _, err := f.Pop(func(obj interface{}) error { if obj.(testFifoObject).name != "foo" { t.Fatalf("unexpected object: %#v", obj) } return ErrRequeue{Err: nil} }) if err != nil { t.Fatalf("unexpected error: %v", err) } if _, ok, err := f.GetByKey("foo"); err != nil || !ok { t.Fatalf("object should have been requeued: %t %v", ok, err) } _, err = f.Pop(func(obj interface{}) error { if obj.(testFifoObject).name != "foo" { t.Fatalf("unexpected object: %#v", obj) } return ErrRequeue{Err: fmt.Errorf("test error")} }) if err == nil || err.Error() != "test error" { t.Fatalf("unexpected error: %v", err) } if _, ok, err := f.GetByKey("foo"); err != nil || !ok { t.Fatalf("object should have been requeued: %t %v", ok, err) } _, err = f.Pop(func(obj interface{}) error { if obj.(testFifoObject).name != "foo" { t.Fatalf("unexpected object: %#v", obj) } return nil }) if err != nil { t.Fatalf("unexpected error: %v", err) } if _, ok, err := f.GetByKey("foo"); ok || err != nil { t.Fatalf("object should have been removed: %t %v", ok, err) } }
explode_data.jsonl/69920
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 521 }
[ 2830, 3393, 37, 25997, 1288, 4584, 1925, 11598, 1155, 353, 8840, 836, 8, 341, 1166, 1669, 1532, 8623, 37, 31497, 1190, 1592, 9626, 692, 1166, 1904, 1255, 74, 37, 31497, 5261, 445, 7975, 497, 220, 16, 15, 593, 442, 308, 337, 396, 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 TestMongo_CreateAndFind(t *testing.T) { var m Interface m, skip := prepMongo(t, true) // adds two comments if skip { return } res, err := m.Find(store.Locator{URL: "https://radio-t.com", SiteID: "radio-t"}, "time") assert.Nil(t, err) require.Equal(t, 2, len(res)) assert.Equal(t, `some text, <a href="http://radio-t.com">link</a>`, res[0].Text) assert.Equal(t, "user1", res[0].User.ID) t.Log(res[0].ID) _, err = m.Create(store.Comment{ID: res[0].ID, Locator: store.Locator{URL: "https://radio-t.com", SiteID: "radio-t"}}) assert.NotNil(t, err, "reject dup") id, err := m.Create(store.Comment{ID: "id-3", Locator: store.Locator{URL: "https://radio-t2.com", SiteID: "radio-t2"}}) assert.Nil(t, err) assert.Equal(t, "id-3", id) res, err = m.Find(store.Locator{URL: "https://radio-t2.com", SiteID: "radio-t2"}, "time") assert.Nil(t, err) require.Equal(t, 1, len(res)) assert.NoError(t, m.Close()) }
explode_data.jsonl/54194
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 410 }
[ 2830, 3393, 54998, 34325, 3036, 9885, 1155, 353, 8840, 836, 8, 341, 2405, 296, 20019, 198, 2109, 11, 10706, 1669, 21327, 54998, 1155, 11, 830, 8, 442, 11367, 1378, 6042, 198, 743, 10706, 341, 197, 853, 198, 197, 532, 10202, 11, 1848, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestPCREString(t *testing.T) { for _, tt := range []struct { name string input PCRE want string }{ { name: "basic", input: PCRE{ Pattern: []byte("foo.*bar"), Options: []byte("iU"), }, want: `pcre:"/foo.*bar/iU";`, }, { name: "negate", input: PCRE{ Negate: true, Pattern: []byte("foo.*bar"), Options: []byte("iU"), }, want: `pcre:!"/foo.*bar/iU";`, }, { name: "no options", input: PCRE{ Pattern: []byte("foo.*bar"), }, want: `pcre:"/foo.*bar/";`, }, } { got := tt.input.String() if got != tt.want { t.Fatalf("%s: got %v -- expected %v", tt.name, got, tt.want) } } }
explode_data.jsonl/59688
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 344 }
[ 2830, 3393, 4872, 787, 703, 1155, 353, 8840, 836, 8, 341, 2023, 8358, 17853, 1669, 2088, 3056, 1235, 341, 197, 11609, 220, 914, 198, 197, 22427, 6673, 787, 198, 197, 50780, 220, 914, 198, 197, 59403, 197, 197, 515, 298, 11609, 25, 3...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestTypeCloseUnordered(t *testing.T) { conf := NewConfig() conf.Input.Type = input.TypeNanomsg conf.Output.Type = input.TypeNanomsg strm, err := New(conf) if err != nil { t.Fatal(err) } if err = strm.stopUnordered(time.Second); err != nil { t.Error(err) } conf.Buffer.Type = "memory" strm, err = New(conf) if err != nil { t.Fatal(err) } if err = strm.stopUnordered(time.Second); err != nil { t.Error(err) } conf.Pipeline.Processors = []processor.Config{ processor.NewConfig(), } strm, err = New(conf) if err != nil { t.Fatal(err) } if err = strm.stopUnordered(time.Second); err != nil { t.Error(err) } }
explode_data.jsonl/78330
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 280 }
[ 2830, 3393, 929, 7925, 1806, 10544, 1155, 353, 8840, 836, 8, 341, 67850, 1669, 1532, 2648, 741, 67850, 16130, 10184, 284, 1946, 10184, 45, 276, 316, 1991, 198, 67850, 34246, 10184, 284, 1946, 10184, 45, 276, 316, 1991, 271, 11355, 76, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestMSSQLQueryProcess(t *testing.T) { MSSQLQuery, ok := NewSqlserverSQLQuery(sMSSQLQuery) if ok != nil { t.Fail() } if MSSQLQuery.Process("") == nil { t.Fail() } }
explode_data.jsonl/22813
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 80 }
[ 2830, 3393, 44, 1220, 3588, 2859, 7423, 1155, 353, 8840, 836, 8, 341, 9209, 1220, 3588, 2859, 11, 5394, 1669, 1532, 8269, 4030, 6688, 2859, 1141, 44, 1220, 3588, 2859, 340, 743, 5394, 961, 2092, 341, 197, 3244, 57243, 741, 197, 630, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestSetKernelMemoryLimit(t *testing.T) { t.Skip("skipping the test as it requires memory.kmem.limit_in_bytes to be set") c, err := NewContainer(ContainerName) if err != nil { t.Errorf(err.Error()) } oldMemLimit, err := c.KernelMemoryLimit() if err != nil { t.Errorf(err.Error()) } if err := c.SetKernelMemoryLimit(oldMemLimit * 4); err != nil { t.Errorf(err.Error()) } newMemLimit, err := c.KernelMemoryLimit() if err != nil { t.Errorf(err.Error()) } // Floats aren't exactly exact, check that we did get something smaller if newMemLimit < oldMemLimit*3 { t.Errorf("SetKernelMemoryLimit failed") } }
explode_data.jsonl/2788
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 238 }
[ 2830, 3393, 1649, 26343, 10642, 16527, 1155, 353, 8840, 836, 8, 341, 3244, 57776, 445, 4886, 5654, 279, 1273, 438, 432, 7460, 4938, 5202, 10536, 38583, 1243, 12524, 311, 387, 738, 5130, 1444, 11, 1848, 1669, 1532, 4502, 75145, 675, 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...
6
func TestValidateWildcardDomain(t *testing.T) { tests := []struct { name string in string out string }{ {"empty", "", "empty"}, {"too long", strings.Repeat("x", 256), "too long"}, {"happy", strings.Repeat("x", 63), ""}, {"wildcard", "*", ""}, {"wildcard multi-segment", "*.bar.com", ""}, {"wildcard single segment", "*foo", ""}, {"wildcard prefix", "*foo.bar.com", ""}, {"wildcard prefix dash", "*-foo.bar.com", ""}, {"bad wildcard", "foo.*.com", "invalid"}, {"bad wildcard", "foo*.bar.com", "invalid"}, {"IP address", "1.1.1.1", "invalid"}, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { err := ValidateWildcardDomain(tt.in) if err == nil && tt.out != "" { t.Fatalf("ValidateWildcardDomain(%v) = nil, wanted %q", tt.in, tt.out) } else if err != nil && tt.out == "" { t.Fatalf("ValidateWildcardDomain(%v) = %v, wanted nil", tt.in, err) } else if err != nil && !strings.Contains(err.Error(), tt.out) { t.Fatalf("ValidateWildcardDomain(%v) = %v, wanted %q", tt.in, err, tt.out) } }) } }
explode_data.jsonl/56892
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 463 }
[ 2830, 3393, 17926, 92988, 13636, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 3056, 1235, 341, 197, 11609, 914, 198, 197, 17430, 256, 914, 198, 197, 13967, 220, 914, 198, 197, 59403, 197, 197, 4913, 3194, 497, 7342, 330, 3194, 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...
7
func TestInitEntry(t *testing.T) { validGUID := regexp.MustCompile(`^[a-zA-Z0-9]{8}-[a-zA-Z0-9]{4}-[a-zA-Z0-9]{4}-[a-zA-Z0-9]{4}-[a-zA-Z0-9]{12}$`) goodGUID := "5CA3360B-5DE6-4FCF-B4CE-419CEE433B51" var start, end, size uint64 = 2048, 3047, 1000 * 512 t.Run("missing GUID", func(t *testing.T) { p := Partition{ Start: start, End: end, Size: size, Name: "EFI System", GUID: "", Attributes: 0, Type: EFISystemPartition, } err := p.initEntry(512, 2048) if err != nil { t.Errorf("Unexpected error: %v", err) } if !validGUID.MatchString(p.GUID) { t.Errorf("did not initialize valid GUID, remains: %s", p.GUID) } }) t.Run("existing GUID", func(t *testing.T) { p := Partition{ Start: start, End: end, Size: size, Name: "EFI System", GUID: goodGUID, Attributes: 0, Type: EFISystemPartition, } err := p.initEntry(512, 2048) if err != nil { t.Errorf("Unexpected error: %v", err) } if p.GUID != goodGUID { t.Errorf("reset GUID even thought good ones existed") } }) t.Run("no size", func(t *testing.T) { p := Partition{ Start: start, End: end, Size: 0, Name: "EFI System", GUID: goodGUID, Attributes: 0, Type: EFISystemPartition, } err := p.initEntry(512, 2048) if err != nil { t.Errorf("Unexpected error: %v", err) } if p.Size == 0 { t.Errorf("Did not reset size even though 0") } if p.Size != size { t.Errorf("size set to %d instead of %d", p.Size, size) } }) t.Run("no end", func(t *testing.T) { p := Partition{ Start: start, End: 0, Size: size, Name: "EFI System", GUID: goodGUID, Attributes: 0, Type: EFISystemPartition, } err := p.initEntry(512, 2048) if err != nil { t.Errorf("Unexpected error: %v", err) } if p.End == 0 { t.Errorf("Did not reset end even though 0") } if p.End != end { t.Errorf("end set to %d instead of %d", p.End, end) } }) t.Run("only size", func(t *testing.T) { var starting uint64 = 2048 p := Partition{ Start: 0, End: 0, Size: size, Name: "EFI System", GUID: goodGUID, Attributes: 0, Type: EFISystemPartition, } err := p.initEntry(512, starting) if err != nil { t.Errorf("Unexpected error: %v", err) } if p.End == 0 { t.Errorf("Did not reset end even though 0") } if p.Start == 0 { t.Errorf("Did not reset start even though 0") } if p.End != end { t.Errorf("end set to %d instead of %d", p.End, end) } if p.Start != start { t.Errorf("start set to %d instead of %d", p.Start, start) } }) t.Run("mismatched sizes", func(t *testing.T) { var starting uint64 = 2048 p := Partition{ Start: start, End: end, Size: size + 1, Name: "EFI System", GUID: goodGUID, Attributes: 0, Type: EFISystemPartition, } err := p.initEntry(512, starting) if err == nil { t.Fatal("returned unexpected nil error") } expected := "Invalid partition entry" if !strings.HasPrefix(err.Error(), expected) { t.Errorf("Error type %s instead of expected %s", err.Error(), expected) } }) }
explode_data.jsonl/39145
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1666 }
[ 2830, 3393, 3803, 5874, 1155, 353, 8840, 836, 8, 341, 56322, 41778, 1669, 41877, 98626, 5809, 27736, 64, 21088, 11171, 15, 12, 24, 15370, 23, 19732, 58, 64, 21088, 11171, 15, 12, 24, 15370, 19, 19732, 58, 64, 21088, 11171, 15, 12, 2...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestScrub(t *testing.T) { tt := test.Start(t) defer tt.Finish() tt.Assert.Equal("scott", Scrub("scott")) tt.Assert.Equal("scött", Scrub("scött")) tt.Assert.Equal("�(", Scrub(string([]byte{0xC3, 0x28}))) }
explode_data.jsonl/11476
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 104 }
[ 2830, 3393, 3326, 59430, 1155, 353, 8840, 836, 8, 341, 3244, 83, 1669, 1273, 12101, 1155, 340, 16867, 17853, 991, 18176, 2822, 3244, 83, 11711, 12808, 445, 2388, 1716, 497, 32134, 392, 445, 2388, 1716, 5455, 3244, 83, 11711, 12808, 445,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestContextUnique(t *testing.T) { c := context.Background() c2 := AddEventToContext(c, "Hello") i := 0 v := c2.Value(i) if v != nil { t.Error("Should not be able to get value without opaque type") } v2 := GetEventFromContext(c2) if v2 != "Hello" { t.Errorf("Expected Hello, got %v", v2) } }
explode_data.jsonl/25070
{ "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, 1972, 22811, 1155, 353, 8840, 836, 8, 341, 1444, 1669, 2266, 19047, 741, 1444, 17, 1669, 2691, 1556, 1249, 1972, 1337, 11, 330, 9707, 1138, 8230, 1669, 220, 15, 198, 5195, 1669, 272, 17, 6167, 1956, 340, 743, 348, 961, 2...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func Test_NoActionHandler_ExecuteAndWaitFor(t *testing.T) { t.Run("should execute the NoActionHandler successfully", func(t *testing.T) { // given customObject := fixCustomObject() handler := NoActionHandler{} g := new(errgroup.Group) ctx := context.Background() defer ctx.Done() // when g.Go(func() error { err := handler.ExecuteAndWaitFor(ctx, *customObject) if err != nil { return err } return nil }) // then err := g.Wait() require.NoError(t, err) }) }
explode_data.jsonl/72041
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 197 }
[ 2830, 3393, 36989, 2512, 3050, 83453, 92812, 2461, 1155, 353, 8840, 836, 8, 341, 3244, 16708, 445, 5445, 9026, 279, 2308, 2512, 3050, 7790, 497, 2915, 1155, 353, 8840, 836, 8, 341, 197, 197, 322, 2661, 198, 197, 1444, 1450, 1190, 1669...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestPullListChanges(t *testing.T) { gock.New("https://gitlab.com"). Get("/api/v4/projects/diaspora/diaspora/merge_requests/1347/changes"). Reply(200). Type("application/json"). SetHeaders(mockHeaders). SetHeaders(mockPageHeaders). File("testdata/merge_diff.json") client := NewDefault() got, res, err := client.PullRequests.ListChanges(context.Background(), "diaspora/diaspora", 1347, scm.ListOptions{Page: 1, Size: 30}) if err != nil { t.Error(err) return } want := []*scm.Change{} raw, _ := ioutil.ReadFile("testdata/merge_diff.json.golden") json.Unmarshal(raw, &want) if diff := cmp.Diff(got, want); diff != "" { t.Errorf("Unexpected Results") t.Log(diff) } t.Run("Request", testRequest(res)) t.Run("Rate", testRate(res)) }
explode_data.jsonl/78653
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 314 }
[ 2830, 3393, 36068, 852, 11317, 1155, 353, 8840, 836, 8, 341, 3174, 1176, 7121, 445, 2428, 1110, 12882, 14380, 905, 38609, 197, 37654, 4283, 2068, 5457, 19, 39606, 3446, 3473, 70664, 3446, 3473, 70664, 14, 19052, 37216, 14, 16, 18, 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 TestUnitScheduleSignTransactionValidateWrong(t *testing.T) { client := ClientForTestnet() client.SetAutoValidateChecksums(true) scheduleID, err := ScheduleIDFromString("0.0.123-rmkykd") assert.NoError(t, err) scheduleSign := NewScheduleSignTransaction(). SetScheduleID(scheduleID) err = scheduleSign._ValidateNetworkOnIDs(client) assert.Error(t, err) if err != nil { assert.Equal(t, "network mismatch; some IDs have different networks set", err.Error()) } }
explode_data.jsonl/19817
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 163 }
[ 2830, 3393, 4562, 32210, 7264, 8070, 17926, 29185, 1155, 353, 8840, 836, 8, 341, 25291, 1669, 8423, 2461, 2271, 4711, 741, 25291, 4202, 13253, 17926, 73190, 82, 3715, 340, 1903, 8796, 915, 11, 1848, 1669, 23512, 915, 44491, 445, 15, 13,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestUpdateSanctionScore(t *testing.T) { cases := []struct { name string evaluationResults map[shared.ClientID]shared.EvaluationReturn ruleViolationPenalties map[string]shared.IIGOSanctionsScore expectedIslandScores map[shared.ClientID]shared.IIGOSanctionsScore }{ { name: "Basic update sanction score check", evaluationResults: map[shared.ClientID]shared.EvaluationReturn{ shared.Teams["Team1"]: { Rules: []rules.RuleMatrix{generateDummyRuleMatrices()[0]}, Evaluations: []bool{false}, }, }, ruleViolationPenalties: map[string]shared.IIGOSanctionsScore{ "inspect_ballot_rule": 50, }, expectedIslandScores: map[shared.ClientID]shared.IIGOSanctionsScore{ shared.Teams["Team1"]: 50, }, }, { name: "Normal update sanction score check", evaluationResults: map[shared.ClientID]shared.EvaluationReturn{ shared.Teams["Team1"]: { Rules: []rules.RuleMatrix{generateDummyRuleMatrices()[0]}, Evaluations: []bool{false}, }, shared.Teams["Team2"]: { Rules: []rules.RuleMatrix{generateDummyRuleMatrices()[0], generateDummyRuleMatrices()[1]}, Evaluations: []bool{false, true}, }, }, ruleViolationPenalties: map[string]shared.IIGOSanctionsScore{ "inspect_ballot_rule": 50, }, expectedIslandScores: map[shared.ClientID]shared.IIGOSanctionsScore{ shared.Teams["Team1"]: 50, shared.Teams["Team2"]: 50, }, }, { name: "Complex update sanction score scenario", evaluationResults: map[shared.ClientID]shared.EvaluationReturn{ shared.Teams["Team1"]: { Rules: []rules.RuleMatrix{generateDummyRuleMatrices()[0], generateDummyRuleMatrices()[0]}, Evaluations: []bool{false, false}, }, shared.Teams["Team2"]: { Rules: []rules.RuleMatrix{generateDummyRuleMatrices()[0], generateDummyRuleMatrices()[1]}, Evaluations: []bool{false, false}, }, shared.Teams["Team3"]: { Rules: []rules.RuleMatrix{generateDummyRuleMatrices()[4], generateDummyRuleMatrices()[5]}, Evaluations: []bool{false, true}, }, }, ruleViolationPenalties: map[string]shared.IIGOSanctionsScore{ "inspect_ballot_rule": 50, "iigo_economic_sanction_1": 100, }, expectedIslandScores: map[shared.ClientID]shared.IIGOSanctionsScore{ shared.Teams["Team1"]: 100, shared.Teams["Team2"]: 55, shared.Teams["Team3"]: 100, }, }, } for _, tc := range cases { t.Run(tc.name, func(t *testing.T) { judiciaryInst := defaultInitJudiciary() judiciaryInst.evaluationResults = tc.evaluationResults judiciaryInst.ruleViolationSeverity = tc.ruleViolationPenalties judiciaryInst.updateSanctionScore() if !reflect.DeepEqual(tc.expectedIslandScores, judiciaryInst.sanctionRecord) { t.Errorf("Expected %v got %v", tc.expectedIslandScores, judiciaryInst.sanctionRecord) } }) } }
explode_data.jsonl/74042
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1234 }
[ 2830, 3393, 4289, 23729, 407, 10570, 1155, 353, 8840, 836, 8, 341, 1444, 2264, 1669, 3056, 1235, 341, 197, 11609, 4293, 914, 198, 197, 7727, 23819, 9801, 414, 2415, 58, 6100, 11716, 915, 60, 6100, 5142, 23819, 5598, 198, 197, 7000, 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 TestCrRenameCycle(t *testing.T) { test(t, users("alice", "bob"), as(alice, mkdir("a"), mkdir("b"), ), as(bob, disableUpdates(), ), as(alice, rename("b", "a/b"), ), as(bob, noSync(), rename("a", "b/a"), reenableUpdates(), lsdir("a/", m{"b": "DIR"}), lsdir("a/b/", m{"a": "SYM"}), lsdir("a/b/a", m{"b": "DIR"}), ), as(alice, lsdir("a/", m{"b": "DIR"}), lsdir("a/b/", m{"a": "SYM"}), lsdir("a/b/a", m{"b": "DIR"}), write("a/c", "hello"), ), as(bob, read("a/b/a/c", "hello"), ), ) }
explode_data.jsonl/31356
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 326 }
[ 2830, 3393, 16001, 88757, 44820, 1155, 353, 8840, 836, 8, 341, 18185, 1155, 345, 197, 90896, 445, 63195, 497, 330, 47086, 4461, 197, 60451, 17643, 558, 345, 298, 88650, 445, 64, 4461, 298, 88650, 445, 65, 4461, 197, 197, 1326, 197, 60...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestErrorReadingFile(t *testing.T) { commandLineFile, _ := ioutil.TempFile("", "") defer os.Remove(commandLineFile.Name()) if err := ioutil.WriteFile(commandLineFile.Name(), []byte("bogus value"), 0644); err != nil { t.Fatalf("Error creating tempfile: %v", err) } loadingRules := ClientConfigLoadingRules{ ExplicitPath: commandLineFile.Name(), } _, err := loadingRules.Load() if err == nil { t.Fatalf("Expected error for unloadable file, got none") } if !strings.Contains(err.Error(), commandLineFile.Name()) { t.Fatalf("Expected error about '%s', got %s", commandLineFile.Name(), err.Error()) } }
explode_data.jsonl/67848
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 221 }
[ 2830, 3393, 1454, 31899, 1703, 1155, 353, 8840, 836, 8, 341, 45566, 2460, 1703, 11, 716, 1669, 43144, 65009, 1703, 19814, 14676, 16867, 2643, 13270, 15143, 2460, 1703, 2967, 12367, 743, 1848, 1669, 43144, 4073, 1703, 15143, 2460, 1703, 29...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
4
func TestNamespaceIndexInsert(t *testing.T) { ctrl := xtest.NewController(t) defer ctrl.Finish() truncateTypes := []series.TruncateType{series.TypeBlock, series.TypeNone} for _, truncateType := range truncateTypes { idx := NewMockNamespaceIndex(ctrl) ns, closer := newTestNamespaceWithTruncateType(t, idx, truncateType) ns.reverseIndex = idx defer closer() ctx := context.NewBackground() now := xtime.Now() shard := NewMockdatabaseShard(ctrl) opts := series.WriteOptions{ TruncateType: truncateType, } shard.EXPECT(). WriteTagged(ctx, ident.NewIDMatcher("a"), convert.EmptyTagMetadataResolver, now, 1.0, xtime.Second, nil, opts). Return(SeriesWrite{WasWritten: true}, nil) shard.EXPECT(). WriteTagged(ctx, ident.NewIDMatcher("a"), convert.EmptyTagMetadataResolver, now, 1.0, xtime.Second, nil, opts). Return(SeriesWrite{WasWritten: false}, nil) ns.shards[testShardIDs[0].ID()] = shard seriesWrite, err := ns.WriteTagged(ctx, ident.StringID("a"), convert.EmptyTagMetadataResolver, now, 1.0, xtime.Second, nil) require.NoError(t, err) require.True(t, seriesWrite.WasWritten) seriesWrite, err = ns.WriteTagged(ctx, ident.StringID("a"), convert.EmptyTagMetadataResolver, now, 1.0, xtime.Second, nil) require.NoError(t, err) require.False(t, seriesWrite.WasWritten) shard.EXPECT().Close() idx.EXPECT().Close().Return(nil) require.NoError(t, ns.Close()) } }
explode_data.jsonl/35375
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 569 }
[ 2830, 3393, 22699, 1552, 13780, 1155, 353, 8840, 836, 8, 341, 84381, 1669, 856, 1944, 7121, 2051, 1155, 340, 16867, 23743, 991, 18176, 2822, 25583, 26900, 4173, 1669, 3056, 19880, 8240, 26900, 929, 90, 19880, 10184, 4713, 11, 4013, 10184,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestAttributes_FromAttributeNoChange(t *testing.T) { tc := testCase{ name: "FromAttributeNoChange", inputAttributes: map[string]pdata.AttributeValue{ "boo": pdata.NewAttributeValueString("ghosts are scary"), }, expectedAttributes: map[string]pdata.AttributeValue{ "boo": pdata.NewAttributeValueString("ghosts are scary"), }, } cfg := &Settings{ Actions: []ActionKeyValue{ {Key: "boo", Action: INSERT, FromAttribute: "boo"}, {Key: "boo", Action: UPDATE, FromAttribute: "boo"}, {Key: "boo", Action: UPSERT, FromAttribute: "boo"}, }, } ap, err := NewAttrProc(cfg) require.Nil(t, err) require.NotNil(t, ap) runIndividualTestCase(t, tc, ap) }
explode_data.jsonl/11516
{ "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, 10516, 53157, 3907, 2753, 4072, 1155, 353, 8840, 836, 8, 341, 78255, 1669, 54452, 515, 197, 11609, 25, 330, 3830, 3907, 2753, 4072, 756, 197, 22427, 10516, 25, 2415, 14032, 60, 57796, 33775, 1130, 515, 298, 197, 1, 32993, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestHandshakeServerRSAPKCS1v15(t *testing.T) { test := &serverTest{ name: "RSA-RSAPKCS1v15", command: []string{"openssl", "s_client", "-no_ticket", "-cipher", "ECDHE-RSA-CHACHA20-POLY1305", "-sigalgs", "rsa_pkcs1_sha256"}, } runServerTestTLS12(t, test) }
explode_data.jsonl/36349
{ "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, 2314, 29661, 5475, 11451, 2537, 42, 6412, 16, 85, 16, 20, 1155, 353, 8840, 836, 8, 341, 18185, 1669, 609, 4030, 2271, 515, 197, 11609, 25, 262, 330, 73564, 10911, 50, 2537, 42, 6412, 16, 85, 16, 20, 756, 197, 45566, 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 TestBloomFilterFalsePositiveRate(t *testing.T) { f, err := os.Open(filepath.FromSlash("testdata/h.table-bloom.no-compression.sst")) require.NoError(t, err) c := &countingFilterPolicy{ FilterPolicy: bloom.FilterPolicy(1), } r, err := NewReader(f, ReaderOptions{ Filters: map[string]FilterPolicy{ c.Name(): c, }, }) require.NoError(t, err) const n = 10000 // key is a buffer that will be re-used for n Get calls, each with a // different key. The "m" in the 2-byte prefix means that the key falls in // the [minWord, maxWord] range and so will not be rejected prior to // applying the Bloom filter. The "!" in the 2-byte prefix means that the // key is not actually in the table. The filter will only see actual // negatives: false positives or true negatives. key := []byte("m!....") for i := 0; i < n; i++ { binary.LittleEndian.PutUint32(key[2:6], uint32(i)) r.get(key) } if c.truePositives != 0 { t.Errorf("true positives: got %d, want 0", c.truePositives) } if c.falseNegatives != 0 { t.Errorf("false negatives: got %d, want 0", c.falseNegatives) } if got := c.falsePositives + c.trueNegatives; got != n { t.Errorf("actual negatives (false positives + true negatives): got %d (%d + %d), want %d", got, c.falsePositives, c.trueNegatives, n) } // According the the comments in the C++ LevelDB code, the false positive // rate should be approximately 1% for for bloom.FilterPolicy(10). The 10 // was the parameter used to write the .sst file. When reading the file, // the 1 in the bloom.FilterPolicy(1) above doesn't matter, only the // bloom.FilterPolicy matters. if got := float64(100*c.falsePositives) / n; got < 0.2 || 5 < got { t.Errorf("false positive rate: got %v%%, want approximately 1%%", got) } require.NoError(t, r.Close()) }
explode_data.jsonl/40339
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 636 }
[ 2830, 3393, 33, 18474, 5632, 4049, 35490, 11564, 1155, 353, 8840, 836, 8, 341, 1166, 11, 1848, 1669, 2643, 12953, 34793, 11439, 88004, 445, 92425, 7530, 10336, 1455, 18474, 18341, 11476, 4011, 514, 267, 5455, 17957, 35699, 1155, 11, 1848,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
7
func TestRuleReadablePasswords(t *testing.T) { common.Log.Debug("Entering function: %s", common.GetFunctionName()) sqls := []string{ `create table test(id int,name varchar(20) not null,password varchar(200)not null);`, `alter table test add column password varchar(200) not null;`, } for _, sql := range sqls { q, err := NewQuery4Audit(sql) if err == nil { rule := q.RuleReadablePasswords() if rule.Item != "SEC.002" { t.Error("Rule not match:", rule.Item, "Expect : SEC.002") } } else { t.Error("sqlparser.Parse Error:", err) } } common.Log.Debug("Exiting function: %s", common.GetFunctionName()) }
explode_data.jsonl/76815
{ "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, 11337, 57938, 84546, 1155, 353, 8840, 836, 8, 341, 83825, 5247, 20345, 445, 82867, 729, 25, 1018, 82, 497, 4185, 2234, 5152, 675, 2398, 30633, 82, 1669, 3056, 917, 515, 197, 197, 63, 3182, 1965, 1273, 3724, 526, 22006, 329...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
4
func TestVendorExtensionStringSlice(t *testing.T) { var actual Swagger err := json.Unmarshal([]byte(specJSON), &actual) if assert.NoError(t, err) { schemes, ok := actual.Extensions.GetStringSlice("x-schemes") if assert.True(t, ok) { assert.EqualValues(t, []string{"unix", "amqp"}, schemes) } } }
explode_data.jsonl/25551
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 128 }
[ 2830, 3393, 44691, 12049, 703, 33236, 1155, 353, 8840, 836, 8, 341, 2405, 5042, 79631, 198, 9859, 1669, 2951, 38097, 10556, 3782, 38209, 5370, 701, 609, 11944, 340, 743, 2060, 35699, 1155, 11, 1848, 8, 341, 197, 1903, 66346, 11, 5394, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestVariables_ListsAndNullability_DoesNotAllowListOfNonNullsToContainNull(t *testing.T) { doc := ` query q($input: [String!]) { listNN(input: $input) } ` params := map[string]interface{}{ "input": []interface{}{"A", nil, "B"}, } expected := &graphql.Result{ Data: nil, Errors: []gqlerrors.FormattedError{ { Message: `Variable "$input" got invalid value ` + `["A",null,"B"].` + "\nIn element #1: Expected \"String!\", found null.", Locations: []location.SourceLocation{ { Line: 2, Column: 17, }, }, }, }, } ast := testutil.TestParse(t, doc) // execute ep := graphql.ExecuteParams{ Schema: variablesTestSchema, AST: ast, Args: params, } result := testutil.TestExecute(t, ep) if len(result.Errors) != len(expected.Errors) { t.Fatalf("Unexpected errors, Diff: %v", testutil.Diff(expected.Errors, result.Errors)) } if !reflect.DeepEqual(expected, result) { t.Fatalf("Unexpected result, Diff: %v", testutil.Diff(expected, result)) } }
explode_data.jsonl/6460
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 451 }
[ 2830, 3393, 22678, 27104, 82, 3036, 3280, 2897, 1557, 7072, 2623, 18605, 64090, 16834, 82, 1249, 46522, 3280, 1155, 353, 8840, 836, 8, 341, 59536, 1669, 22074, 286, 3239, 2804, 699, 1355, 25, 508, 703, 0, 2467, 341, 688, 1140, 9745, 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 TestCatalog_RegisterService_InvalidAddress(t *testing.T) { t.Parallel() dir1, s1 := testServer(t) defer os.RemoveAll(dir1) defer s1.Shutdown() codec := rpcClient(t, s1) defer codec.Close() for _, addr := range []string{"0.0.0.0", "::", "[::]"} { t.Run("addr "+addr, func(t *testing.T) { arg := structs.RegisterRequest{ Datacenter: "dc1", Node: "foo", Address: "127.0.0.1", Service: &structs.NodeService{ Service: "db", Address: addr, Port: 8000, }, } var out struct{} err := msgpackrpc.CallWithCodec(codec, "Catalog.Register", &arg, &out) if err == nil || err.Error() != "Invalid service address" { t.Fatalf("got error %v want 'Invalid service address'", err) } }) } }
explode_data.jsonl/49206
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 343 }
[ 2830, 3393, 41606, 73124, 1860, 62, 7928, 4286, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 741, 48532, 16, 11, 274, 16, 1669, 1273, 5475, 1155, 340, 16867, 2643, 84427, 14161, 16, 340, 16867, 274, 16, 10849, 18452, 741, 43343, 6...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestScrapeLoopOutOfBoundsTimeError(t *testing.T) { app := &collectResultAppender{} sl := newScrapeLoop(context.Background(), nil, nil, nil, nopMutator, nopMutator, func() storage.Appender { return &timeLimitAppender{ Appender: app, maxTime: timestamp.FromTime(time.Now().Add(10 * time.Minute)), } }, nil, 0, true, ) now := time.Now().Add(20 * time.Minute) total, added, seriesAdded, err := sl.append([]byte("normal 1\n"), "", now) testutil.Equals(t, 1, total) testutil.Equals(t, 0, added) testutil.Equals(t, 0, seriesAdded) if err != nil { t.Errorf("expect no error, got %s", err.Error()) } }
explode_data.jsonl/56135
{ "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, 3326, 19842, 14620, 61349, 1462, 1454, 1155, 353, 8840, 836, 8, 341, 28236, 1669, 609, 17384, 2077, 2164, 1659, 16094, 78626, 1669, 501, 3326, 19842, 14620, 5378, 19047, 3148, 197, 84131, 345, 197, 84131, 11, 2092, 345, 197, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestXMLNameGetLocalNameAndPrefix(t *testing.T) { var tests = []struct { name string expectedPrefix string expectedLocalPart string }{ {"elementName", "", "elementName"}, {"pfx:elementName", "pfx", "elementName"}, {"ns11111:abc", "ns11111", "abc"}, } for _, test := range tests { name := XMLName(test.name) actualPrefix := name.GetPrefix() actualLocalPart := name.GetLocalPart() if actualPrefix != test.expectedPrefix { t.Errorf("expected '%s', got '%s'", test.expectedPrefix, actualPrefix) } if actualLocalPart != test.expectedLocalPart { t.Errorf("expected '%s', got '%s'", test.expectedLocalPart, actualLocalPart) } } }
explode_data.jsonl/72039
{ "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, 10609, 675, 1949, 7319, 675, 3036, 14335, 1155, 353, 8840, 836, 8, 341, 2405, 7032, 284, 3056, 1235, 341, 197, 11609, 1060, 914, 198, 197, 42400, 14335, 262, 914, 198, 197, 42400, 7319, 5800, 914, 198, 197, 59403, 197, 197...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
4
func TestBaseAccountMarshal(t *testing.T) { _, pub, addr := testdata.KeyTestPubAddr() acc := types.NewBaseAccountWithAddress(addr) seq := uint64(7) // set everything on the account err := acc.SetPubKey(pub) require.Nil(t, err) err = acc.SetSequence(seq) require.Nil(t, err) bz, err := app.AccountKeeper.MarshalAccount(acc) require.Nil(t, err) acc2, err := app.AccountKeeper.UnmarshalAccount(bz) require.Nil(t, err) require.Equal(t, acc, acc2) // error on bad bytes _, err = app.AccountKeeper.UnmarshalAccount(bz[:len(bz)/2]) require.NotNil(t, err) }
explode_data.jsonl/80930
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 235 }
[ 2830, 3393, 3978, 7365, 55438, 1155, 353, 8840, 836, 8, 341, 197, 6878, 6675, 11, 10789, 1669, 1273, 691, 9610, 2271, 29162, 13986, 741, 197, 4475, 1669, 4494, 7121, 3978, 7365, 2354, 4286, 24497, 340, 78561, 1669, 2622, 21, 19, 7, 22...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestServer_Rejects_PrioritySelfDependence(t *testing.T) { testServerRejectsStream(t, ErrCodeProtocol, func(st *serverTester) { st.fr.AllowIllegalWrites = true st.writePriority(1, PriorityParam{StreamDep: 1}) }) }
explode_data.jsonl/71659
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 84 }
[ 2830, 3393, 5475, 50693, 583, 82, 1088, 8773, 12092, 7839, 408, 763, 1155, 353, 8840, 836, 8, 341, 18185, 5475, 78413, 82, 3027, 1155, 11, 15495, 2078, 20689, 11, 2915, 5895, 353, 4030, 58699, 8, 341, 197, 18388, 18798, 29081, 33713, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestWebhookLoadBalance(t *testing.T) { roots := x509.NewCertPool() if !roots.AppendCertsFromPEM(localhostCert) { t.Fatal("Failed to append Cert from PEM") } cert, err := tls.X509KeyPair(localhostCert, localhostKey) if err != nil { t.Fatalf("Failed to build cert with error: %+v", err) } localListener, err := net.Listen("tcp", "127.0.0.1:0") if err != nil { if localListener, err = net.Listen("tcp6", "[::1]:0"); err != nil { t.Fatal(err) } } trackingListener := &connectionTrackingListener{delegate: localListener} recorder := &connectionRecorder{} handler := newLoadBalanceWebhookHandler(recorder) httpServer := &http.Server{ Handler: handler, TLSConfig: &tls.Config{ RootCAs: roots, Certificates: []tls.Certificate{cert}, }, } go func() { httpServer.ServeTLS(trackingListener, "", "") }() defer httpServer.Close() webhookURL := "https://" + localListener.Addr().String() s := kubeapiservertesting.StartTestServerOrDie(t, kubeapiservertesting.NewDefaultTestServerOptions(), []string{ "--disable-admission-plugins=ServiceAccount", }, framework.SharedEtcd()) defer s.TearDownFn() // Configure a client with a distinct user name so that it is easy to distinguish requests // made by the client from requests made by controllers. We use this to filter out requests // before recording them to ensure we don't accidentally mistake requests from controllers // as requests made by the client. clientConfig := rest.CopyConfig(s.ClientConfig) clientConfig.QPS = 100 clientConfig.Burst = 200 clientConfig.Impersonate.UserName = testLoadBalanceClientUsername clientConfig.Impersonate.Groups = []string{"system:masters", "system:authenticated"} client, err := clientset.NewForConfig(clientConfig) if err != nil { t.Fatalf("unexpected error: %v", err) } _, err = client.CoreV1().Pods("default").Create(context.TODO(), loadBalanceMarkerFixture, metav1.CreateOptions{}) if err != nil { t.Fatal(err) } upCh := recorder.Reset() ns := "load-balance" _, err = client.CoreV1().Namespaces().Create(context.TODO(), &v1.Namespace{ObjectMeta: metav1.ObjectMeta{Name: ns}}, metav1.CreateOptions{}) if err != nil { t.Fatal(err) } fail := admissionregistrationv1.Fail mutatingCfg, err := client.AdmissionregistrationV1().MutatingWebhookConfigurations().Create(context.TODO(), &admissionregistrationv1.MutatingWebhookConfiguration{ ObjectMeta: metav1.ObjectMeta{Name: "admission.integration.test"}, Webhooks: []admissionregistrationv1.MutatingWebhook{{ Name: "admission.integration.test", ClientConfig: admissionregistrationv1.WebhookClientConfig{ URL: &webhookURL, CABundle: localhostCert, }, Rules: []admissionregistrationv1.RuleWithOperations{{ Operations: []admissionregistrationv1.OperationType{admissionregistrationv1.OperationAll}, Rule: admissionregistrationv1.Rule{APIGroups: []string{""}, APIVersions: []string{"v1"}, Resources: []string{"pods"}}, }}, FailurePolicy: &fail, AdmissionReviewVersions: []string{"v1beta1"}, SideEffects: &noSideEffects, }}, }, metav1.CreateOptions{}) if err != nil { t.Fatal(err) } defer func() { err := client.AdmissionregistrationV1().MutatingWebhookConfigurations().Delete(context.TODO(), mutatingCfg.GetName(), metav1.DeleteOptions{}) if err != nil { t.Fatal(err) } }() // wait until new webhook is called the first time if err := wait.PollImmediate(time.Millisecond*5, wait.ForeverTestTimeout, func() (bool, error) { _, err = client.CoreV1().Pods("default").Patch(context.TODO(), loadBalanceMarkerFixture.Name, types.JSONPatchType, []byte("[]"), metav1.PatchOptions{}) select { case <-upCh: return true, nil default: t.Logf("Waiting for webhook to become effective, getting marker object: %v", err) return false, nil } }); err != nil { t.Fatal(err) } pod := func() *corev1.Pod { return &corev1.Pod{ ObjectMeta: metav1.ObjectMeta{ Namespace: ns, GenerateName: "loadbalance-", }, Spec: corev1.PodSpec{ Containers: []v1.Container{{ Name: "fake-name", Image: "fakeimage", }}, }, } } // Submit 10 parallel requests wg := &sync.WaitGroup{} for i := 0; i < 10; i++ { wg.Add(1) go func() { defer wg.Done() _, err := client.CoreV1().Pods(ns).Create(context.TODO(), pod(), metav1.CreateOptions{}) if err != nil { t.Error(err) } }() } wg.Wait() if actual := atomic.LoadInt64(&trackingListener.connections); actual < 10 { t.Errorf("expected at least 10 connections, got %d", actual) } trackingListener.Reset() // Submit 10 more parallel requests wg = &sync.WaitGroup{} for i := 0; i < 10; i++ { wg.Add(1) go func() { defer wg.Done() _, err := client.CoreV1().Pods(ns).Create(context.TODO(), pod(), metav1.CreateOptions{}) if err != nil { t.Error(err) } }() } wg.Wait() if actual := atomic.LoadInt64(&trackingListener.connections); actual > 0 { t.Errorf("expected no additional connections (reusing kept-alive connections), got %d", actual) } }
explode_data.jsonl/12906
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1930 }
[ 2830, 3393, 5981, 20873, 5879, 21190, 1155, 353, 8840, 836, 8, 341, 197, 37165, 1669, 856, 20, 15, 24, 7121, 36934, 10551, 741, 743, 753, 37165, 8982, 34, 15546, 3830, 1740, 44, 7, 8301, 36934, 8, 341, 197, 3244, 26133, 445, 9408, 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 TestOrder(t *testing.T) { dryDB := DB.Session(&gorm.Session{DryRun: true}) result := dryDB.Order("age desc, name").Find(&User{}) if !regexp.MustCompile("SELECT \\* FROM .*users.* ORDER BY age desc, name").MatchString(result.Statement.SQL.String()) { t.Fatalf("Build Order condition, but got %v", result.Statement.SQL.String()) } result = dryDB.Order("age desc").Order("name").Find(&User{}) if !regexp.MustCompile("SELECT \\* FROM .*users.* ORDER BY age desc,name").MatchString(result.Statement.SQL.String()) { t.Fatalf("Build Order condition, but got %v", result.Statement.SQL.String()) } }
explode_data.jsonl/48713
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 207 }
[ 2830, 3393, 4431, 1155, 353, 8840, 836, 8, 341, 2698, 884, 3506, 1669, 5952, 20674, 2099, 73281, 20674, 90, 85215, 6727, 25, 830, 8824, 9559, 1669, 9058, 3506, 19664, 445, 424, 6560, 11, 829, 1827, 9885, 2099, 1474, 37790, 743, 753, 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 TestLatest(t *testing.T) { testenv.MustHaveExternalNetwork(t) tmpdir, err := ioutil.TempDir("", "vgo-modfetch-test-") if err != nil { t.Fatal(err) } defer os.RemoveAll(tmpdir) for _, tt := range latestTests { name := strings.Replace(tt.path, "/", "_", -1) t.Run(name, func(t *testing.T) { repo, err := Lookup(tt.path) if err != nil { t.Fatalf("Lookup(%q): %v", tt.path, err) } info, err := repo.Latest() if err != nil { if tt.err != "" { if err.Error() == tt.err { return } t.Fatalf("Latest(): %v, want %q", err, tt.err) } t.Fatalf("Latest(): %v", err) } if tt.err != "" { t.Fatalf("Latest() = %v, want error %q", info.Version, tt.err) } if info.Version != tt.version { t.Fatalf("Latest() = %v, want %v", info.Version, tt.version) } }) } }
explode_data.jsonl/62927
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 414 }
[ 2830, 3393, 31992, 1155, 353, 8840, 836, 8, 341, 18185, 3160, 50463, 12116, 25913, 12320, 1155, 692, 20082, 3741, 11, 1848, 1669, 43144, 65009, 6184, 19814, 330, 85, 3346, 17078, 9641, 16839, 12, 1138, 743, 1848, 961, 2092, 341, 197, 32...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 Test_runExpire(t *testing.T) { hashKey := []byte("TestExpiredHash") strKey := []byte("TestExpiredString") expireAt := (time.Now().Unix() - 30) * int64(time.Second) hashCall := func(t *testing.T, key []byte) []byte { hash, txn, err := getHash(t, []byte(key)) oldID := hash.meta.ID assert.NoError(t, err) assert.NotNil(t, txn) assert.NotNil(t, hash) hash.HSet([]byte("field1"), []byte("val")) kv := GetKv(txn) err = kv.ExpireAt([]byte(key), expireAt) assert.NoError(t, err) txn.Commit(context.TODO()) hash, txn, err = getHash(t, []byte(key)) newID := hash.meta.ID if bytes.Equal(oldID, newID) { assert.Fail(t, "old hash is not expired") return nil } assert.NoError(t, err) assert.NotNil(t, txn) assert.NotNil(t, hash) hash.HSet([]byte("field1"), []byte("val")) txn.Commit(context.TODO()) return oldID } stringCall := func(t *testing.T, key []byte) []byte { hash, txn, err := getHash(t, []byte(key)) oldID := hash.meta.ID assert.NoError(t, err) assert.NotNil(t, txn) assert.NotNil(t, hash) hash.HSet([]byte("field1"), []byte("val")) kv := GetKv(txn) err = kv.ExpireAt([]byte(key), expireAt) assert.NoError(t, err) txn.Commit(context.TODO()) txn = getTxn(t) s, err := GetString(txn, key) assert.NoError(t, err) newID := s.Meta.ID if bytes.Equal(oldID, newID) { assert.Fail(t, "old hash is not expired") return nil } err = s.Set([]byte("val")) assert.NoError(t, err) txn.Commit(context.TODO()) return oldID } type args struct { key []byte call func(*testing.T, []byte) []byte } type want struct { gckey bool } tests := []struct { name string args args want want }{ { name: "TestExpiredHash", args: args{ key: hashKey, call: hashCall, }, want: want{ gckey: true, }, }, { name: "TestExpiredString", args: args{ key: strKey, call: stringCall, }, want: want{ gckey: true, }, }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { id := tt.args.call(t, tt.args.key) txn := getTxn(t) runExpire(txn.db, 1) txn.Commit(context.TODO()) txn = getTxn(t) gcKey := toTiKVGCKey(toTiKVDataKey([]byte(txn.db.Namespace), txn.db.ID, id)) _, err := txn.t.Get(gcKey) txn.Commit(context.TODO()) if tt.want.gckey { assert.NoError(t, err) } else { assert.Equal(t, true, store.IsErrNotFound(err)) } }) } }
explode_data.jsonl/52396
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1187 }
[ 2830, 3393, 14007, 8033, 554, 1155, 353, 8840, 836, 8, 341, 50333, 1592, 1669, 3056, 3782, 445, 2271, 54349, 6370, 1138, 11355, 1592, 1669, 3056, 3782, 445, 2271, 54349, 703, 1138, 48558, 554, 1655, 1669, 320, 1678, 13244, 1005, 55832, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestEnglishAnalyzer(t *testing.T) { tests := []struct { input []byte output analysis.TokenStream }{ // stemming { input: []byte("books"), output: analysis.TokenStream{ &analysis.Token{ Term: []byte("book"), Position: 1, Start: 0, End: 5, }, }, }, { input: []byte("book"), output: analysis.TokenStream{ &analysis.Token{ Term: []byte("book"), Position: 1, Start: 0, End: 4, }, }, }, // stop word removal { input: []byte("the"), output: analysis.TokenStream{}, }, // possessive removal { input: []byte("steven's"), output: analysis.TokenStream{ &analysis.Token{ Term: []byte("steven"), Position: 1, Start: 0, End: 8, }, }, }, { input: []byte("steven\u2019s"), output: analysis.TokenStream{ &analysis.Token{ Term: []byte("steven"), Position: 1, Start: 0, End: 10, }, }, }, { input: []byte("steven\uFF07s"), output: analysis.TokenStream{ &analysis.Token{ Term: []byte("steven"), Position: 1, Start: 0, End: 10, }, }, }, } cache := registry.NewCache() analyzer, err := cache.AnalyzerNamed(AnalyzerName) if err != nil { t.Fatal(err) } for _, test := range tests { actual := analyzer.Analyze(test.input) if !reflect.DeepEqual(actual, test.output) { t.Errorf("expected %v, got %v", test.output, actual) } } }
explode_data.jsonl/80944
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 760 }
[ 2830, 3393, 22574, 54911, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 3056, 1235, 341, 197, 22427, 220, 3056, 3782, 198, 197, 21170, 6358, 32277, 3027, 198, 197, 59403, 197, 197, 322, 75944, 198, 197, 197, 515, 298, 22427, 25, 3056, 37...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestUtf8Chars(t *testing.T) { var all [][]rune all = append(all, testDigit) all = append(all, spaceTest) all = append(all, notletterTest) all = append(all, letterTest) all = append(all, notupperTest) all = append(all, upperTest) for _, tests := range all { for _, r := range tests { err := compareInOut(string(r)) if err != nil { t.Errorf("failed for utf8 %+q err: %v", r, err) break } } } }
explode_data.jsonl/71763
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 184 }
[ 2830, 3393, 38980, 23, 32516, 1155, 353, 8840, 836, 8, 341, 2405, 678, 52931, 81, 2886, 198, 50960, 284, 8737, 20388, 11, 1273, 36420, 340, 50960, 284, 8737, 20388, 11, 3550, 2271, 340, 50960, 284, 8737, 20388, 11, 537, 9451, 2271, 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...
4
func Test_Prism_Forbidden(t *testing.T) { test.RunHttpTest(t, func(t *testing.T, ts *httptest.Server, app *goapp.App) { manager := app.Get("gonode.manager").(*base.PgNodeManager) home := app.Get("gonode.handler_collection").(base.HandlerCollection).NewNode("core.root") home.Name = "Homepage" home.Access = []string{"node:prism:render", "IS_AUTHENTICATED_ANONYMOUSLY"} manager.Save(home, false) raw := app.Get("gonode.handler_collection").(base.HandlerCollection).NewNode("core.raw") raw.Name = "Humans.txt" raw.Slug = "humans.txt" raw.Access = []string{} manager.Save(raw, false) manager.Move(raw.Uuid, home.Uuid) res, _ := test.RunRequest("GET", fmt.Sprintf("%s/humans.txt", ts.URL)) assert.Equal(t, http.StatusForbidden, res.StatusCode) }) }
explode_data.jsonl/72817
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 305 }
[ 2830, 3393, 32716, 2142, 84368, 22108, 1155, 353, 8840, 836, 8, 341, 18185, 16708, 2905, 2271, 1155, 11, 2915, 1155, 353, 8840, 836, 11, 10591, 353, 96336, 70334, 22997, 11, 906, 353, 3346, 676, 5105, 8, 341, 197, 92272, 1669, 906, 22...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestServer_Response_ManyHeaders_With_Continuation(t *testing.T) { testServerResponse(t, func(w http.ResponseWriter, r *http.Request) error { h := w.Header() for i := 0; i < 5000; i++ { h.Set(fmt.Sprintf("x-header-%d", i), fmt.Sprintf("x-value-%d", i)) } return nil }, func(st *serverTester) { getSlash(st) hf := st.wantHeaders() if hf.HeadersEnded() { t.Fatal("got unwanted END_HEADERS flag") } n := 0 for { n++ cf := st.wantContinuation() if cf.HeadersEnded() { break } } if n < 5 { t.Errorf("Only got %d CONTINUATION frames; expected 5+ (currently 6)", n) } }) }
explode_data.jsonl/71676
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 284 }
[ 2830, 3393, 5475, 65873, 1245, 3767, 10574, 62, 2354, 62, 36139, 4002, 1155, 353, 8840, 836, 8, 341, 18185, 5475, 2582, 1155, 11, 2915, 3622, 1758, 37508, 11, 435, 353, 1254, 9659, 8, 1465, 341, 197, 9598, 1669, 289, 15753, 741, 197, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestSalesforceAPI_Insert(t *testing.T) { type fields struct { metadata *metadata describe *describe dml *dml query *query } type args struct { inserter Inserter } tests := []struct { name string fields fields args args want InsertValue wantErr bool }{ { name: "No DML field", want: InsertValue{}, wantErr: true, }, { name: "Invalid Args", fields: fields{ dml: &dml{ session: &session.Mock{ URL: "http://wwww.google.com", }, }, }, want: InsertValue{}, wantErr: true, }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { a := &Resources{ metadata: tt.fields.metadata, describe: tt.fields.describe, dml: tt.fields.dml, query: tt.fields.query, } got, err := a.Insert(tt.args.inserter) if (err != nil) != tt.wantErr { t.Errorf("SalesforceAPI.Insert() error = %v, wantErr %v", err, tt.wantErr) return } if !reflect.DeepEqual(got, tt.want) { t.Errorf("SalesforceAPI.Insert() = %v, want %v", got, tt.want) } }) } }
explode_data.jsonl/45140
{ "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, 35418, 8833, 7082, 76417, 1155, 353, 8840, 836, 8, 341, 13158, 5043, 2036, 341, 197, 2109, 7603, 353, 17637, 198, 197, 82860, 353, 12332, 198, 197, 2698, 1014, 414, 353, 67, 1014, 198, 197, 27274, 262, 353, 1631, 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 TestStopSignal(t *testing.T) { b := &Builder{flags: &BFlags{}, runConfig: &container.Config{}, disableCommit: true} signal := "SIGKILL" if err := stopSignal(b, []string{signal}, nil, ""); err != nil { t.Fatalf("Error should be empty, got: %s", err.Error()) } if b.runConfig.StopSignal != signal { t.Fatalf("StopSignal should be set to %s, got %s", signal, b.runConfig.StopSignal) } }
explode_data.jsonl/28287
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 155 }
[ 2830, 3393, 10674, 26810, 1155, 353, 8840, 836, 8, 341, 2233, 1669, 609, 3297, 90, 11161, 25, 609, 33, 9195, 22655, 1598, 2648, 25, 609, 3586, 10753, 22655, 11156, 33441, 25, 830, 630, 81319, 1669, 330, 50631, 42, 9228, 1837, 743, 184...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestMarkdownMessage_ToByte(t *testing.T) { msg := NewMarkdownMessage() _, _ = msg.ToByte() if msg.MsgType != MsgTypeMarkdown { t.Errorf("MarkdownMessage.ToByte() type error") } }
explode_data.jsonl/74058
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 73 }
[ 2830, 3393, 68005, 2052, 38346, 7153, 1155, 353, 8840, 836, 8, 341, 21169, 1669, 1532, 68005, 2052, 741, 197, 6878, 716, 284, 3750, 3274, 7153, 741, 743, 3750, 30365, 929, 961, 24205, 929, 68005, 341, 197, 3244, 13080, 445, 68005, 2052,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestSyncCreateTimeout(t *testing.T) { storage := SimpleRESTStorage{ injectedFunction: func(obj interface{}) (interface{}, error) { time.Sleep(400 * time.Millisecond) return obj, nil }, } handler := New(map[string]RESTStorage{ "foo": &storage, }, "/prefix/version") server := httptest.NewServer(handler) client := http.Client{} simple := Simple{Name: "foo"} data, _ := api.Encode(simple) request, err := http.NewRequest("POST", server.URL+"/prefix/version/foo?sync=true&timeout=200ms", bytes.NewBuffer(data)) expectNoError(t, err) wg := sync.WaitGroup{} wg.Add(1) var response *http.Response go func() { response, err = client.Do(request) wg.Done() }() wg.Wait() expectNoError(t, err) var itemOut api.Status _, err = extractBody(response, &itemOut) expectNoError(t, err) if itemOut.Status != api.StatusWorking || itemOut.Details == "" { t.Errorf("Unexpected status %#v", itemOut) } if response.StatusCode != http.StatusAccepted { t.Errorf("Unexpected status: %d, Expected: %d, %#v", response.StatusCode, 202, response) } }
explode_data.jsonl/30467
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 407 }
[ 2830, 3393, 12154, 4021, 7636, 1155, 353, 8840, 836, 8, 341, 197, 16172, 1669, 8993, 38307, 5793, 515, 197, 17430, 28303, 5152, 25, 2915, 6779, 3749, 28875, 320, 4970, 22655, 1465, 8, 341, 298, 21957, 31586, 7, 19, 15, 15, 353, 882, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestTable_pingReplace(t *testing.T) { run := func(newNodeResponding, lastInBucketResponding bool) { name := fmt.Sprintf("newNodeResponding=%t/lastInBucketResponding=%t", newNodeResponding, lastInBucketResponding) t.Run(name, func(t *testing.T) { t.Parallel() testPingReplace(t, newNodeResponding, lastInBucketResponding) }) } run(true, true) run(false, true) run(true, false) run(false, false) }
explode_data.jsonl/11763
{ "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, 2556, 71661, 23107, 1155, 353, 8840, 836, 8, 341, 56742, 1669, 2915, 1755, 1955, 65354, 287, 11, 1537, 641, 36018, 65354, 287, 1807, 8, 341, 197, 11609, 1669, 8879, 17305, 445, 931, 1955, 65354, 287, 7846, 83, 14, 4259, 64...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestReduceMapString(t *testing.T) { cases := []struct { name string m1 map[string]*string m2 map[string]string expected map[string]string }{ { name: "first", m1: map[string]*string{"foo": stringPtr("bar"), "abc": stringPtr("def")}, m2: map[string]string{"bar": "foo", "abc": "ghi"}, expected: map[string]string{"foo": "bar", "abc": "def", "bar": "foo"}, }, { name: "last", m1: map[string]*string{"bar": stringPtr("foo"), "abc": stringPtr("ghi")}, m2: map[string]string{"foo": "bar", "abc": "def"}, expected: map[string]string{"bar": "foo", "abc": "ghi", "foo": "bar"}, }, { name: "nilattr", m1: map[string]*string{"foo": stringPtr("bar"), "abc": stringPtr("fgh"), "baz": nil}, m2: map[string]string{"foo": "bar", "baz": "fuu"}, expected: map[string]string{"foo": "bar", "abc": "fgh", "baz": "fuu"}, }, { name: "null1", m1: nil, m2: map[string]string{"foo": "bar", "abc": "def"}, expected: map[string]string{"foo": "bar", "abc": "def"}, }, { name: "null2", m1: map[string]*string{"foo": stringPtr("bar"), "abc": stringPtr("def")}, m2: nil, expected: map[string]string{"foo": "bar", "abc": "def"}, }, } for _, tt := range cases { tt := tt t.Run(tt.name, func(t *testing.T) { require.Equal(t, tt.expected, reduceMapString(tt.m2, tt.m1)) }) } }
explode_data.jsonl/44400
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 705 }
[ 2830, 3393, 50325, 2227, 703, 1155, 353, 8840, 836, 8, 341, 1444, 2264, 1669, 3056, 1235, 341, 197, 11609, 257, 914, 198, 197, 2109, 16, 981, 2415, 14032, 8465, 917, 198, 197, 2109, 17, 981, 2415, 14032, 30953, 198, 197, 42400, 2415, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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(t *testing.T) { tests := []struct { name string nums1 []int nums2 []int expected float64 }{ {name: "Example1", nums1: []int{1, 3}, nums2: []int{2}, expected: 2.0}, {name: "Example2", nums1: []int{1, 2}, nums2: []int{3, 4}, expected: 2.5}, {name: "Example3", nums1: []int{0, 0}, nums2: []int{0, 0}, expected: 0.0}, {name: "Example4", nums1: []int{}, nums2: []int{1}, expected: 1.0}, {name: "Example5", nums1: []int{2}, nums2: []int{}, expected: 2.0}, } for _, test := range tests { t.Run(test.name, func(t *testing.T) { got := findMedianSortedArrays(test.nums1, test.nums2) if got != test.expected { t.Errorf("got %.2f want %.2f", got, test.expected) } }) } }
explode_data.jsonl/15940
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 346 }
[ 2830, 3393, 1155, 353, 8840, 836, 8, 1476, 78216, 1669, 3056, 1235, 341, 197, 11609, 257, 914, 198, 197, 22431, 82, 16, 262, 3056, 396, 198, 197, 22431, 82, 17, 262, 3056, 396, 198, 197, 42400, 2224, 21, 19, 198, 197, 59403, 197, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestEthereumBlacklistBatches(t *testing.T) { input := CreateTestEnv(t) defer func() { input.Context.Logger().Info("Asserting invariants at test end"); input.AssertInvariants() }() ctx := input.Context var ( now = time.Now().UTC() mySender, _ = sdk.AccAddressFromBech32("gravity1ahx7f8wyertuus9r20284ej0asrs085ceqtfnm") myReceiver, _ = types.NewEthAddress("0xd041c41EA1bf0F006ADBb6d2c9ef9D425dE5eaD7") blacklistedReceiver, _ = types.NewEthAddress("0x4d16b9E4a27c3313440923fEfCd013178149A5bD") myTokenContractAddr, _ = types.NewEthAddress("0x429881672B9AE42b8EbA0E26cD9C73711b891Ca5") // Pickle token, err = types.NewInternalERC20Token(sdk.NewInt(99999), myTokenContractAddr.GetAddress()) allVouchers = sdk.NewCoins(token.GravityCoin()) ) require.NoError(t, err) // add the blacklisted address to the blacklist params := input.GravityKeeper.GetParams(ctx) params.EthereumBlacklist = append(params.EthereumBlacklist, blacklistedReceiver.GetAddress()) input.GravityKeeper.SetParams(ctx, params) // mint some voucher first require.NoError(t, input.BankKeeper.MintCoins(ctx, types.ModuleName, allVouchers)) // set senders balance input.AccountKeeper.NewAccountWithAddress(ctx, mySender) require.NoError(t, input.BankKeeper.SendCoinsFromModuleToAccount(ctx, types.ModuleName, mySender, allVouchers)) // CREATE FIRST BATCH // ================== // add some TX to the pool for i, v := range []uint64{2, 3, 2, 1, 5} { amountToken, err := types.NewInternalERC20Token(sdk.NewInt(int64(i+100)), myTokenContractAddr.GetAddress()) require.NoError(t, err) amount := amountToken.GravityCoin() feeToken, err := types.NewInternalERC20Token(sdk.NewIntFromUint64(v), myTokenContractAddr.GetAddress()) require.NoError(t, err) fee := feeToken.GravityCoin() // one of the transactions should go to the blacklisted address if i == 4 { _, err = input.GravityKeeper.AddToOutgoingPool(ctx, mySender, *blacklistedReceiver, amount, fee) } else { _, err = input.GravityKeeper.AddToOutgoingPool(ctx, mySender, *myReceiver, amount, fee) } require.NoError(t, err) ctx.Logger().Info(fmt.Sprintf("Created transaction %v with amount %v and fee %v", i, amount, fee)) // Should create: // 1: tx amount is 100, fee is 2, id is 1 // 2: tx amount is 101, fee is 3, id is 2 // 3: tx amount is 102, fee is 2, id is 3 // 4: tx amount is 103, fee is 1, id is 4 // 5: tx amount is 104, fee is 5, id is 5 } //check that blacklisted tx fee is not insluded in profitability calculation currentFees := input.GravityKeeper.GetBatchFeeByTokenType(ctx, *myTokenContractAddr, 10) assert.NotNil(t, currentFees) assert.True(t, currentFees.TotalFees.Equal(sdk.NewInt(8))) // when ctx = ctx.WithBlockTime(now) // tx batch size is 10 firstBatch, err := input.GravityKeeper.BuildOutgoingTXBatch(ctx, *myTokenContractAddr, 10) require.NoError(t, err) // then batch is persisted gotFirstBatch := input.GravityKeeper.GetOutgoingTXBatch(ctx, firstBatch.TokenContract, firstBatch.BatchNonce) require.NotNil(t, gotFirstBatch) // Should have all from above except the banned dest ctx.Logger().Info(fmt.Sprintf("found batch %+v", gotFirstBatch)) // should be 4 not 5 transactions assert.Equal(t, 4, len(gotFirstBatch.Transactions)) // should not contain id 5 for i := 0; i < len(gotFirstBatch.Transactions); i++ { assert.NotEqual(t, gotFirstBatch.Transactions[i].Id, 5) } // and verify remaining available Tx in the pool // should only be 5 gotUnbatchedTx := input.GravityKeeper.GetUnbatchedTransactionsByContract(ctx, *myTokenContractAddr) assert.Equal(t, gotUnbatchedTx[0].Id, uint64(5)) }
explode_data.jsonl/21415
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1423 }
[ 2830, 3393, 36, 18532, 372, 14417, 1607, 33, 9118, 1155, 353, 8840, 836, 8, 341, 22427, 1669, 4230, 2271, 14359, 1155, 340, 16867, 2915, 368, 314, 1946, 9328, 12750, 1005, 1731, 445, 8534, 287, 304, 54611, 518, 1273, 835, 5038, 1946, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestGetSysVariables(t *testing.T) { store, clean := realtikvtest.CreateMockStoreAndSetup(t) defer clean() tk := testkit.NewTestKit(t, store) tk.MustExec("use test") // Test ScopeSession tk.MustExec("select @@warning_count") tk.MustExec("select @@session.warning_count") tk.MustExec("select @@local.warning_count") err := tk.ExecToErr("select @@global.warning_count") require.True(t, terror.ErrorEqual(err, variable.ErrIncorrectScope), fmt.Sprintf("err %v", err)) // Test ScopeGlobal tk.MustExec("select @@max_connections") tk.MustExec("select @@global.max_connections") tk.MustGetErrMsg("select @@session.max_connections", "[variable:1238]Variable 'max_connections' is a GLOBAL variable") tk.MustGetErrMsg("select @@local.max_connections", "[variable:1238]Variable 'max_connections' is a GLOBAL variable") // Test ScopeNone tk.MustExec("select @@performance_schema_max_mutex_classes") tk.MustExec("select @@global.performance_schema_max_mutex_classes") // For issue 19524, test tk.MustExec("select @@session.performance_schema_max_mutex_classes") tk.MustExec("select @@local.performance_schema_max_mutex_classes") tk.MustGetErrMsg("select @@global.last_insert_id", "[variable:1238]Variable 'last_insert_id' is a SESSION variable") }
explode_data.jsonl/5808
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 431 }
[ 2830, 3393, 1949, 32792, 22678, 1155, 353, 8840, 836, 8, 341, 57279, 11, 4240, 1669, 1931, 83, 1579, 85, 1944, 7251, 11571, 6093, 3036, 21821, 1155, 340, 16867, 4240, 2822, 3244, 74, 1669, 1273, 8226, 7121, 2271, 7695, 1155, 11, 3553, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestBinpackingEstimate(t *testing.T) { testCases := []struct { name string millicores int64 memory int64 maxNodes int pods []*apiv1.Pod topologySpreadingKey string expectNodeCount int expectPodCount int }{ { name: "simple resource-based binpacking", millicores: 350*3 - 50, memory: 2 * 1000, pods: makePods(350, 1000, 0, 0, "", 10), expectNodeCount: 5, expectPodCount: 10, }, { name: "pods-per-node bound binpacking", millicores: 10000, memory: 20000, pods: makePods(10, 100, 0, 0, "", 20), expectNodeCount: 2, expectPodCount: 20, }, { name: "hostport conflict forces pod-per-node", millicores: 1000, memory: 5000, pods: makePods(200, 1000, 5555, 0, "", 8), expectNodeCount: 8, expectPodCount: 8, }, { name: "limiter cuts binpacking", millicores: 1000, memory: 5000, pods: makePods(500, 1000, 0, 0, "", 20), maxNodes: 5, expectNodeCount: 5, expectPodCount: 10, }, { name: "hostname topology spreading with maxSkew=2 forces 2 pods/node", millicores: 1000, memory: 5000, pods: makePods(20, 100, 0, 2, "kubernetes.io/hostname", 8), expectNodeCount: 4, expectPodCount: 8, }, { name: "zonal topology spreading with maxSkew=2 only allows 2 pods to schedule", millicores: 1000, memory: 5000, pods: makePods(20, 100, 0, 2, "topology.kubernetes.io/zone", 8), expectNodeCount: 1, expectPodCount: 2, }, } for _, tc := range testCases { t.Run(tc.name, func(t *testing.T) { clusterSnapshot := simulator.NewBasicClusterSnapshot() // Add one node in different zone to trigger topology spread constraints clusterSnapshot.AddNode(makeNode(100, 100, "oldnode", "zone-jupiter")) predicateChecker, err := simulator.NewTestPredicateChecker() assert.NoError(t, err) limiter := NewThresholdBasedEstimationLimiter(tc.maxNodes, time.Duration(0)) estimator := NewBinpackingNodeEstimator(predicateChecker, clusterSnapshot, limiter) node := makeNode(tc.millicores, tc.memory, "template", "zone-mars") nodeInfo := schedulerframework.NewNodeInfo() nodeInfo.SetNode(node) estimatedNodes, estimatedPods := estimator.Estimate(tc.pods, nodeInfo, nil) assert.Equal(t, tc.expectNodeCount, estimatedNodes) assert.Equal(t, tc.expectPodCount, len(estimatedPods)) }) } }
explode_data.jsonl/54223
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1303 }
[ 2830, 3393, 28794, 95124, 13782, 3426, 1155, 353, 8840, 836, 8, 341, 18185, 37302, 1669, 3056, 1235, 341, 197, 11609, 338, 914, 198, 197, 2109, 321, 415, 4589, 1843, 526, 21, 19, 198, 197, 2109, 4731, 2290, 526, 21, 19, 198, 197, 22...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestDelete(t *testing.T) { results := []struct { Clauses []clause.Interface Result string Vars []interface{} }{ { []clause.Interface{clause.Delete{}, clause.From{}}, "DELETE FROM `users`", nil, }, { []clause.Interface{clause.Delete{Modifier: "LOW_PRIORITY"}, clause.From{}}, "DELETE LOW_PRIORITY FROM `users`", nil, }, } for idx, result := range results { t.Run(fmt.Sprintf("case #%v", idx), func(t *testing.T) { checkBuildClauses(t, result.Clauses, result.Result, result.Vars) }) } }
explode_data.jsonl/57465
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 232 }
[ 2830, 3393, 6435, 1155, 353, 8840, 836, 8, 341, 55497, 1669, 3056, 1235, 341, 197, 6258, 4260, 4776, 3056, 82082, 41065, 198, 197, 56503, 220, 914, 198, 197, 17446, 1561, 262, 3056, 4970, 16094, 197, 59403, 197, 197, 515, 298, 197, 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 TestCellObjectSize(t *testing.T) { if sz := unsafe.Sizeof(Cell{}); sz > maxCellSize { t.Errorf("Cell struct too big: %d bytes > %d bytes", sz, maxCellSize) } }
explode_data.jsonl/14350
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 67 }
[ 2830, 3393, 3599, 1190, 1695, 1155, 353, 8840, 836, 8, 341, 743, 10038, 1669, 19860, 2465, 1055, 82530, 6257, 1215, 10038, 861, 1932, 3599, 1695, 341, 197, 3244, 13080, 445, 3599, 2036, 2238, 2409, 25, 1018, 67, 5820, 861, 1018, 67, 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 ]
2
func TestNewCmdToken(t *testing.T) { var buf, bufErr bytes.Buffer testConfigTokenFile := "test-config-file" tmpDir, err := ioutil.TempDir("", "kubeadm-token-test") if err != nil { t.Errorf("Unable to create temporary directory: %v", err) } defer os.RemoveAll(tmpDir) fullPath := filepath.Join(tmpDir, testConfigTokenFile) f, err := os.Create(fullPath) if err != nil { t.Errorf("Unable to create test file %q: %v", fullPath, err) } defer f.Close() testCases := []struct { name string args []string configToWrite string kubeConfigEnv string expectedError bool }{ { name: "valid: generate", args: []string{"generate"}, configToWrite: "", expectedError: false, }, { name: "valid: delete from --kubeconfig", args: []string{"delete", "abcdef.1234567890123456", "--dry-run", "--kubeconfig=" + fullPath}, configToWrite: testConfigToken, expectedError: false, }, { name: "valid: delete from " + clientcmd.RecommendedConfigPathEnvVar, args: []string{"delete", "abcdef.1234567890123456", "--dry-run"}, configToWrite: testConfigToken, kubeConfigEnv: fullPath, expectedError: false, }, } for _, tc := range testCases { t.Run(tc.name, func(t *testing.T) { // the command is created for each test so that the kubeConfigFile // variable in NewCmdToken() is reset. cmd := NewCmdToken(&buf, &bufErr) if _, err = f.WriteString(tc.configToWrite); err != nil { t.Errorf("Unable to write test file %q: %v", fullPath, err) } // store the current value of the environment variable. storedEnv := os.Getenv(clientcmd.RecommendedConfigPathEnvVar) if tc.kubeConfigEnv != "" { os.Setenv(clientcmd.RecommendedConfigPathEnvVar, tc.kubeConfigEnv) } cmd.SetArgs(tc.args) err := cmd.Execute() if (err != nil) != tc.expectedError { t.Errorf("Test case %q: NewCmdToken expected error: %v, saw: %v", tc.name, tc.expectedError, (err != nil)) } // restore the environment variable. os.Setenv(clientcmd.RecommendedConfigPathEnvVar, storedEnv) }) } }
explode_data.jsonl/41071
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 885 }
[ 2830, 3393, 3564, 15613, 3323, 1155, 353, 8840, 836, 8, 341, 2405, 6607, 11, 6607, 7747, 5820, 22622, 198, 18185, 2648, 3323, 1703, 1669, 330, 1944, 25130, 14203, 1837, 20082, 6184, 11, 1848, 1669, 43144, 65009, 6184, 19814, 330, 74, 39...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
4
func TestAPIParsing(t *testing.T) { Convey("API Response Parsing Utilities", t, func() { Convey("When the response has failed", func() { badResponse := `{"ok":false,"error":"not_authed"}` dest := struct{}{} err := ParseResponse(bytes.NewBufferString(badResponse), &dest) So(err, ShouldEqual, ErrNotAuthed) }) Convey("When the response has failed with an error we don't know about", func() { badResponse := `{"ok":false,"error":"chicken"}` dest := struct{}{} err := ParseResponse(bytes.NewBufferString(badResponse), &dest) So(err.Error(), ShouldEqual, "slacker: unknown error returned: chicken") }) Convey("When the response is successful it decodes onto the destination", func() { goodResponse := `{"ok":true,"hello":"world"}` dest := &struct { Hello string `json:"hello"` }{} err := ParseResponse(bytes.NewBufferString(goodResponse), dest) So(err, ShouldBeNil) So(dest.Hello, ShouldEqual, "world") }) }) }
explode_data.jsonl/73840
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 348 }
[ 2830, 3393, 7082, 68839, 1155, 353, 8840, 836, 8, 341, 93070, 5617, 445, 7082, 5949, 74789, 34994, 497, 259, 11, 2915, 368, 341, 197, 93070, 5617, 445, 4498, 279, 2033, 702, 4641, 497, 2915, 368, 341, 298, 2233, 329, 2582, 1669, 1565,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestBoolInt_MarshalJSON_GotFalse(t *testing.T) { var sampleInp struct { Val BoolInt `json:"val"` } sampleInp.Val.Flag = false var sampleOut = []byte(`{"val":false}`) data, _ := json.Marshal(sampleInp) if bytes.Compare(data, sampleOut) != 0 { t.Errorf("should be %s but got %s", sampleOut, data) } }
explode_data.jsonl/31044
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 129 }
[ 2830, 3393, 11233, 1072, 1245, 28423, 5370, 2646, 354, 4049, 1155, 353, 8840, 836, 8, 341, 2405, 6077, 641, 79, 2036, 341, 197, 197, 2208, 12608, 1072, 1565, 2236, 2974, 831, 8805, 197, 532, 1903, 1516, 641, 79, 77819, 80911, 284, 895...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestNewExportedPort_PutFails(t *testing.T) { controller := gomock.NewController(t) mockKV := mock_etcd.NewMockKV(controller) mockLease := mock_etcd.NewMockLease(controller) ctx := context.TODO() mockLease.EXPECT().Grant(gomock.Eq(ctx), gomock.Eq(int64(30000))).Return( &clientv3.LeaseGrantResponse{ ID: 23, TTL: 30000, Error: "", }, nil) mockLease.EXPECT().KeepAlive( gomock.Eq(context.Background()), gomock.Eq(clientv3.LeaseID(23))).Return( make(chan *clientv3.LeaseKeepAliveResponse), nil) exporter, err := NewExporterFromClient(ctx, mockKV, mockLease, 30000) if err != nil { t.Error("NewExporterFromClient reports error: ", err) } if exporter == nil { t.Fatal("NewExporterFromClient returned nil exporter") } record := discovery.ExportedServiceRecord{ Protocol: "tcp", Address: "127.0.0.1", Port: 23456, } bData, err := proto.Marshal(&record) if err != nil { t.Error("Unable to marshal test ExportedServiceRecord proto") } errExpected := errors.New("etcd didn't like your value") mockKV.EXPECT().Put(ctx, "/ns/service/test/0000000000000017", string(bData), gomock.Any()).Return(nil, errExpected) l, err := exporter.NewExportedPort(ctx, "tcp", "127.0.0.1:23456", "test") if err != errExpected { t.Error("NewExportedPort reports unexpected error: ", err) } if l != nil { t.Fatal("NewExportedPort returned non-nil listener") } /* Call should not actually invoke delete as we did not successfully export anything. */ err = exporter.UnexportPort(ctx) if err != nil { t.Error("UnexportPort reports error: ", err) } }
explode_data.jsonl/66149
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 643 }
[ 2830, 3393, 3564, 16894, 291, 7084, 1088, 332, 37, 6209, 1155, 353, 8840, 836, 8, 341, 61615, 1669, 342, 316, 1176, 7121, 2051, 1155, 340, 77333, 82707, 1669, 7860, 45668, 4385, 7121, 11571, 82707, 40845, 340, 77333, 2304, 519, 1669, 78...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
7
func TestPrivateKeys(t *testing.T) { t.Run("active key not exist in private key", func(t *testing.T) { startCmd := GetStartCmd() args := []string{ "--" + hostURLFlagName, "localhost:8080", "--" + hostMetricsURLFlagName, "localhost:8081", "--" + casTypeFlagName, "local", "--" + vctURLFlagName, "localhost:8081", "--" + didNamespaceFlagName, "namespace", "--" + databaseTypeFlagName, databaseTypeMemOption, "--" + kmsSecretsDatabaseTypeFlagName, databaseTypeMemOption, "--" + anchorCredentialSignatureSuiteFlagName, "suite", "--" + anchorCredentialDomainFlagName, "domain.com", "--" + anchorCredentialIssuerFlagName, "issuer.com", "--" + anchorCredentialURLFlagName, "peer.com", "--" + privateKeysFlagName, "k1=value", "--" + activeKeyIDFlagName, "k2", } startCmd.SetArgs(args) err := startCmd.Execute() require.NotNil(t, err) require.Contains(t, err.Error(), "active key id k2 not exist in private keys") }) t.Run("private keys not optional if active key exist", func(t *testing.T) { startCmd := GetStartCmd() args := []string{ "--" + hostURLFlagName, "localhost:8080", "--" + hostMetricsURLFlagName, "localhost:8081", "--" + casTypeFlagName, "local", "--" + vctURLFlagName, "localhost:8081", "--" + didNamespaceFlagName, "namespace", "--" + databaseTypeFlagName, databaseTypeMemOption, "--" + kmsSecretsDatabaseTypeFlagName, databaseTypeMemOption, "--" + anchorCredentialSignatureSuiteFlagName, "suite", "--" + anchorCredentialDomainFlagName, "domain.com", "--" + anchorCredentialIssuerFlagName, "issuer.com", "--" + anchorCredentialURLFlagName, "peer.com", "--" + activeKeyIDFlagName, "k2", } startCmd.SetArgs(args) err := startCmd.Execute() require.NotNil(t, err) require.Contains(t, err.Error(), "Neither private-keys (command line flag) nor ORB_PRIVATE_KEYS (environment variable) have been set") }) }
explode_data.jsonl/57250
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 748 }
[ 2830, 3393, 16787, 8850, 1155, 353, 8840, 836, 8, 341, 3244, 16708, 445, 3028, 1376, 537, 3000, 304, 869, 1376, 497, 2915, 1155, 353, 8840, 836, 8, 341, 197, 21375, 15613, 1669, 2126, 3479, 15613, 2822, 197, 31215, 1669, 3056, 917, 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...
1
func TestIfServiceSpecifiesSharedRuleAndRuleDoesNotExistItIsCreated(t *testing.T) { az := getTestCloud() svc := getTestService("servicesr", v1.ProtocolTCP, 80) svc.Spec.LoadBalancerIP = "192.168.77.88" svc.Annotations[ServiceAnnotationSharedSecurityRule] = "true" sg := getTestSecurityGroup(az) sg, err := az.reconcileSecurityGroup(testClusterName, &svc, to.StringPtr(svc.Spec.LoadBalancerIP), true) if err != nil { t.Errorf("Unexpected error: %q", err) } validateSecurityGroup(t, sg, svc) expectedRuleName := "shared-TCP-80-Internet" _, securityRule, ruleFound := findSecurityRuleByName(*sg.SecurityRules, expectedRuleName) if !ruleFound { t.Fatalf("Expected security rule %q but it was not present", expectedRuleName) } err = securityRuleMatches("Internet", v1.ServicePort{Port: 80}, "192.168.77.88", securityRule) if err != nil { t.Errorf("Shared rule was not updated with new service IP: %v", err) } if securityRule.Priority == nil { t.Errorf("Shared rule %s had no priority", expectedRuleName) } if securityRule.Access != network.SecurityRuleAccessAllow { t.Errorf("Shared rule %s did not have Allow access", expectedRuleName) } if securityRule.Direction != network.SecurityRuleDirectionInbound { t.Errorf("Shared rule %s did not have Inbound direction", expectedRuleName) } }
explode_data.jsonl/50420
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 456 }
[ 2830, 3393, 2679, 1860, 94527, 16997, 11337, 3036, 11337, 21468, 45535, 2132, 3872, 11694, 1155, 353, 8840, 836, 8, 341, 197, 1370, 1669, 633, 2271, 16055, 741, 1903, 7362, 1669, 633, 2271, 1860, 445, 12779, 81, 497, 348, 16, 54096, 498...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestBuildSidecarListenerTlsContext(t *testing.T) { testCases := []struct { name string tls *networking.Server_TLSOptions nodeMeta *model.NodeMetadata sdsUdsPath string result *auth.DownstreamTlsContext }{ { name: "no tls", tls: nil, result: nil, }, { name: "tls SIMPLE", tls: &networking.Server_TLSOptions{ Mode: networking.Server_TLSOptions_SIMPLE, ServerCertificate: "server-cert", PrivateKey: "private-key", }, nodeMeta: &model.NodeMetadata{ UserSds: false, }, result: &auth.DownstreamTlsContext{ CommonTlsContext: &auth.CommonTlsContext{ AlpnProtocols: util.ALPNHttp, TlsCertificates: []*auth.TlsCertificate{ { CertificateChain: &core.DataSource{ Specifier: &core.DataSource_Filename{ Filename: "server-cert", }, }, PrivateKey: &core.DataSource{ Specifier: &core.DataSource_Filename{ Filename: "private-key", }, }, }, }, }, RequireClientCertificate: proto2.BoolFalse, }, }, { name: "tls MUTUAL without sds", tls: &networking.Server_TLSOptions{ Mode: networking.Server_TLSOptions_MUTUAL, ServerCertificate: "server-cert", PrivateKey: "private-key", CaCertificates: "ca", }, nodeMeta: &model.NodeMetadata{ UserSds: false, }, result: &auth.DownstreamTlsContext{ CommonTlsContext: &auth.CommonTlsContext{ AlpnProtocols: util.ALPNHttp, TlsCertificates: []*auth.TlsCertificate{ { CertificateChain: &core.DataSource{ Specifier: &core.DataSource_Filename{ Filename: "server-cert", }, }, PrivateKey: &core.DataSource{ Specifier: &core.DataSource_Filename{ Filename: "private-key", }, }, }, }, ValidationContextType: &auth.CommonTlsContext_ValidationContext{ ValidationContext: &auth.CertificateValidationContext{ TrustedCa: &core.DataSource{ Specifier: &core.DataSource_Filename{ Filename: "ca", }, }, }, }, }, RequireClientCertificate: proto2.BoolTrue, }, }, { name: "tls MUTUAL with san without sds", tls: &networking.Server_TLSOptions{ Mode: networking.Server_TLSOptions_MUTUAL, ServerCertificate: "server-cert", PrivateKey: "private-key", CaCertificates: "ca", SubjectAltNames: []string{"subject.name.a.com", "subject.name.b.com"}, }, nodeMeta: &model.NodeMetadata{ UserSds: false, }, result: &auth.DownstreamTlsContext{ CommonTlsContext: &auth.CommonTlsContext{ AlpnProtocols: util.ALPNHttp, TlsCertificates: []*auth.TlsCertificate{ { CertificateChain: &core.DataSource{ Specifier: &core.DataSource_Filename{ Filename: "server-cert", }, }, PrivateKey: &core.DataSource{ Specifier: &core.DataSource_Filename{ Filename: "private-key", }, }, }, }, ValidationContextType: &auth.CommonTlsContext_ValidationContext{ ValidationContext: &auth.CertificateValidationContext{ TrustedCa: &core.DataSource{ Specifier: &core.DataSource_Filename{ Filename: "ca", }, }, VerifySubjectAltName: []string{"subject.name.a.com", "subject.name.b.com"}, }, }, }, RequireClientCertificate: proto2.BoolTrue, }, }, { name: "tls MUTUAL with sds", tls: &networking.Server_TLSOptions{ Mode: networking.Server_TLSOptions_MUTUAL, CredentialName: "test", SubjectAltNames: []string{"subject.name.a.com", "subject.name.b.com"}, }, nodeMeta: &model.NodeMetadata{ UserSds: true, }, sdsUdsPath: "unix:/var/run/sidecar/sds", result: &auth.DownstreamTlsContext{ CommonTlsContext: &auth.CommonTlsContext{ AlpnProtocols: util.ALPNHttp, TlsCertificateSdsSecretConfigs: []*auth.SdsSecretConfig{ { Name: "test", SdsConfig: &core.ConfigSource{ InitialFetchTimeout: features.InitialFetchTimeout, ConfigSourceSpecifier: &core.ConfigSource_ApiConfigSource{ ApiConfigSource: &core.ApiConfigSource{ ApiType: core.ApiConfigSource_GRPC, GrpcServices: []*core.GrpcService{ { TargetSpecifier: &core.GrpcService_GoogleGrpc_{ GoogleGrpc: &core.GrpcService_GoogleGrpc{ TargetUri: "unix:/var/run/sidecar/sds", StatPrefix: authnmodel.SDSStatPrefix, }, }, }, }, }, }, }, }, }, ValidationContextType: &auth.CommonTlsContext_CombinedValidationContext{ CombinedValidationContext: &auth.CommonTlsContext_CombinedCertificateValidationContext{ DefaultValidationContext: &auth.CertificateValidationContext{ VerifySubjectAltName: []string{"subject.name.a.com", "subject.name.b.com"}, }, ValidationContextSdsSecretConfig: &auth.SdsSecretConfig{ Name: "test-cacert", SdsConfig: &core.ConfigSource{ InitialFetchTimeout: features.InitialFetchTimeout, ConfigSourceSpecifier: &core.ConfigSource_ApiConfigSource{ ApiConfigSource: &core.ApiConfigSource{ ApiType: core.ApiConfigSource_GRPC, GrpcServices: []*core.GrpcService{ { TargetSpecifier: &core.GrpcService_GoogleGrpc_{ GoogleGrpc: &core.GrpcService_GoogleGrpc{ TargetUri: "unix:/var/run/sidecar/sds", StatPrefix: authnmodel.SDSStatPrefix, }, }, }, }, }, }, }, }, }, }, }, RequireClientCertificate: proto2.BoolTrue, }, }, } for _, tc := range testCases { t.Run(tc.name, func(t *testing.T) { ret := buildSidecarListenerTLSContext(tc.tls, tc.nodeMeta, tc.sdsUdsPath) if !reflect.DeepEqual(tc.result, ret) { t.Errorf("expecting\n %v but got\n %v\n diff: %s", tc.result, ret, cmp.Diff(tc.result, ret)) } }) } }
explode_data.jsonl/61279
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 3101 }
[ 2830, 3393, 11066, 16384, 6918, 2743, 51, 4730, 1972, 1155, 353, 8840, 836, 8, 341, 18185, 37302, 1669, 3056, 1235, 341, 197, 11609, 981, 914, 198, 197, 3244, 4730, 286, 353, 17511, 287, 22997, 69067, 3798, 198, 197, 20831, 12175, 256, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestIssue28942(t *testing.T) { store, clean := testkit.CreateMockStore(t) defer clean() orgEnable := core.PreparedPlanCacheEnabled() defer core.SetPreparedPlanCache(orgEnable) core.SetPreparedPlanCache(true) se, err := session.CreateSession4TestWithOpt(store, &session.Opt{ PreparedPlanCache: kvcache.NewSimpleLRUCache(100, 0.1, math.MaxUint64), }) require.NoError(t, err) tk := testkit.NewTestKitWithSession(t, store, se) tk.MustExec(`use test`) tk.MustExec(`drop table if exists IDT_MULTI15853STROBJSTROBJ`) tk.MustExec(` CREATE TABLE IDT_MULTI15853STROBJSTROBJ ( COL1 enum('aa','bb','cc') DEFAULT NULL, COL2 mediumint(41) DEFAULT NULL, KEY U_M_COL4 (COL1,COL2) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin`) tk.MustExec(`insert into IDT_MULTI15853STROBJSTROBJ values("aa", 1)`) tk.MustExec(`prepare stmt from 'SELECT * FROM IDT_MULTI15853STROBJSTROBJ WHERE col1 = ? AND col1 != ?'`) tk.MustExec(`set @a="mm", @b="aa"`) tk.MustQuery(`execute stmt using @a,@b`).Check(testkit.Rows()) // empty result tk.MustExec(`set @a="aa", @b="aa"`) tk.MustQuery(`execute stmt using @a,@b`).Check(testkit.Rows()) // empty result }
explode_data.jsonl/5515
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 488 }
[ 2830, 3393, 42006, 17, 23, 24, 19, 17, 1155, 353, 8840, 836, 8, 341, 57279, 11, 4240, 1669, 1273, 8226, 7251, 11571, 6093, 1155, 340, 16867, 4240, 741, 87625, 11084, 1669, 6200, 28770, 7212, 20485, 8233, 5462, 741, 16867, 6200, 4202, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestColumnModifyingDefinition(t *testing.T) { store, clean := testkit.CreateMockStoreWithSchemaLease(t, columnModifyLease) defer clean() tk := testkit.NewTestKit(t, store) tk.MustExec("use test") tk.MustExec("create table test2 (c1 int, c2 int, c3 int default 1, index (c1));") tk.MustExec("alter table test2 change c2 a int not null;") is := domain.GetDomain(tk.Session()).InfoSchema() tbl, err := is.TableByName(model.NewCIStr("test"), model.NewCIStr("test2")) require.NoError(t, err) var c2 *table.Column for _, col := range tbl.Cols() { if col.Name.L == "a" { c2 = col } } require.True(t, mysql.HasNotNullFlag(c2.GetFlag())) tk.MustExec("drop table if exists test2;") tk.MustExec("create table test2 (c1 int, c2 int, c3 int default 1, index (c1));") tk.MustExec("insert into test2(c2) values (null);") tk.MustGetErrMsg("alter table test2 change c2 a int not null", "[ddl:1265]Data truncated for column 'a' at row 1") tk.MustGetErrCode("alter table test2 change c1 a1 bigint not null;", mysql.WarnDataTruncated) }
explode_data.jsonl/51314
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 402 }
[ 2830, 3393, 2933, 4459, 7766, 10398, 1155, 353, 8840, 836, 8, 341, 57279, 11, 4240, 1669, 1273, 8226, 7251, 11571, 6093, 2354, 8632, 2304, 519, 1155, 11, 3250, 44427, 2304, 519, 340, 16867, 4240, 741, 3244, 74, 1669, 1273, 8226, 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...
3
func TestIsNativeEDIFACT(t *testing.T) { tcs := []byte{' ', '!', '@', '0', 'A', '^'} fcs := []byte{'\r', '_', 'a', '~'} for _, c := range tcs { if isNativeEDIFACT(c) != true { t.Fatalf("isNativeEDIFACT(%v) must true", c) } } for _, c := range fcs { if isNativeEDIFACT(c) != false { t.Fatalf("isNativeEDIFACT(%v) must false", c) } } }
explode_data.jsonl/32229
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 177 }
[ 2830, 3393, 3872, 20800, 1479, 2773, 6823, 1155, 353, 8840, 836, 8, 341, 3244, 4837, 1669, 3056, 3782, 13608, 6614, 364, 38692, 3458, 516, 364, 15, 516, 364, 32, 516, 49438, 16418, 1166, 4837, 1669, 3056, 3782, 13608, 59, 81, 516, 909...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestAllowAcrossApp(t *testing.T) { err := AllowAcrossDimension(context.Background(), &discovery.MicroService{ AppId: "a", }, &discovery.MicroService{ AppId: "a", }) if err != nil { t.Fatalf("AllowAcrossApp with the same appId and no property failed") } err = AllowAcrossDimension(context.Background(), &discovery.MicroService{ AppId: "a", }, &discovery.MicroService{ AppId: "c", }) if err == nil { t.Fatalf("AllowAcrossApp with the diff appId and no property failed") } err = AllowAcrossDimension(context.Background(), &discovery.MicroService{ AppId: "a", Properties: map[string]string{ discovery.PropAllowCrossApp: "true", }, }, &discovery.MicroService{ AppId: "a", }) if err != nil { t.Fatalf("AllowAcrossApp with the same appId and allow property failed") } err = AllowAcrossDimension(context.Background(), &discovery.MicroService{ AppId: "a", Properties: map[string]string{ discovery.PropAllowCrossApp: "true", }, }, &discovery.MicroService{ AppId: "b", }) if err != nil { t.Fatalf("AllowAcrossApp with the diff appId and allow property failed") } err = AllowAcrossDimension(context.Background(), &discovery.MicroService{ AppId: "a", Properties: map[string]string{ discovery.PropAllowCrossApp: "false", }, }, &discovery.MicroService{ AppId: "b", }) if err == nil { t.Fatalf("AllowAcrossApp with the diff appId and deny property failed") } err = AllowAcrossDimension(context.Background(), &discovery.MicroService{ AppId: "a", Properties: map[string]string{ discovery.PropAllowCrossApp: "", }, }, &discovery.MicroService{ AppId: "b", }) if err == nil { t.Fatalf("AllowAcrossApp with the diff appId and empty property failed") } }
explode_data.jsonl/74436
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 630 }
[ 2830, 3393, 18605, 91931, 2164, 1155, 353, 8840, 836, 8, 341, 9859, 1669, 26530, 91931, 26121, 5378, 19047, 1507, 609, 4243, 7449, 1321, 2754, 1860, 515, 197, 59557, 764, 25, 330, 64, 756, 197, 2137, 609, 4243, 7449, 1321, 2754, 1860, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
7
func TestShardResultAddBlock(t *testing.T) { opts := testResultOptions() sr := NewShardResult(opts) start := time.Now() inputs := []struct { id string tags ident.Tags timestamp time.Time }{ {"foo", ident.NewTags(ident.StringTag("foo", "foe")), start}, {"foo", ident.NewTags(ident.StringTag("foo", "foe")), start.Add(2 * time.Hour)}, {"bar", ident.NewTags(ident.StringTag("bar", "baz")), start}, } for _, input := range inputs { block := opts.DatabaseBlockOptions().DatabaseBlockPool().Get() block.Reset(input.timestamp, time.Hour, ts.Segment{}, namespace.Context{}) sr.AddBlock(ident.StringID(input.id), input.tags, block) } allSeries := sr.AllSeries() require.Equal(t, 2, allSeries.Len()) fooBlocks, ok := allSeries.Get(ident.StringID("foo")) require.True(t, ok) require.Equal(t, 2, fooBlocks.Blocks.Len()) barBlocks, ok := allSeries.Get(ident.StringID("bar")) require.True(t, ok) require.Equal(t, 1, barBlocks.Blocks.Len()) }
explode_data.jsonl/4669
{ "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, 2016, 567, 2077, 2212, 4713, 1155, 353, 8840, 836, 8, 341, 64734, 1669, 1273, 2077, 3798, 741, 1903, 81, 1669, 1532, 2016, 567, 2077, 30885, 340, 21375, 1669, 882, 13244, 741, 22427, 82, 1669, 3056, 1235, 341, 197, 15710, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestNewRemoveCommandAlias(t *testing.T) { cmd := newRemoveCommand(test.NewFakeCli(&fakeClient{}, new(bytes.Buffer))) assert.Equal(t, cmd.HasAlias("rmi"), true) assert.Equal(t, cmd.HasAlias("remove"), true) assert.Equal(t, cmd.HasAlias("other"), false) }
explode_data.jsonl/26899
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 96 }
[ 2830, 3393, 3564, 13021, 4062, 22720, 1155, 353, 8840, 836, 8, 341, 25920, 1669, 501, 13021, 4062, 8623, 7121, 52317, 87014, 2099, 30570, 2959, 22655, 501, 23158, 22622, 5929, 6948, 12808, 1155, 11, 5439, 16152, 22720, 445, 81, 8155, 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 TestInitializeServerConfig(t *testing.T) { conf := &localconfig.TopLevel{ General: localconfig.General{ ConnectionTimeout: 7 * time.Second, TLS: localconfig.TLS{ Enabled: true, ClientAuthRequired: true, Certificate: "main.go", PrivateKey: "main.go", RootCAs: []string{"main.go"}, ClientRootCAs: []string{"main.go"}, }, }, } sc := initializeServerConfig(conf, nil) expectedContent, _ := ioutil.ReadFile("main.go") assert.Equal(t, expectedContent, sc.SecOpts.Certificate) assert.Equal(t, expectedContent, sc.SecOpts.Key) assert.Equal(t, [][]byte{expectedContent}, sc.SecOpts.ServerRootCAs) assert.Equal(t, [][]byte{expectedContent}, sc.SecOpts.ClientRootCAs) sc = initializeServerConfig(conf, nil) defaultOpts := comm.DefaultKeepaliveOptions assert.Equal(t, defaultOpts.ServerMinInterval, sc.KaOpts.ServerMinInterval) assert.Equal(t, time.Duration(0), sc.KaOpts.ServerInterval) assert.Equal(t, time.Duration(0), sc.KaOpts.ServerTimeout) assert.Equal(t, 7*time.Second, sc.ConnectionTimeout) testDuration := 10 * time.Second conf.General.Keepalive = localconfig.Keepalive{ ServerMinInterval: testDuration, ServerInterval: testDuration, ServerTimeout: testDuration, } sc = initializeServerConfig(conf, nil) assert.Equal(t, testDuration, sc.KaOpts.ServerMinInterval) assert.Equal(t, testDuration, sc.KaOpts.ServerInterval) assert.Equal(t, testDuration, sc.KaOpts.ServerTimeout) sc = initializeServerConfig(conf, nil) assert.NotNil(t, sc.Logger) assert.Equal(t, comm.NewServerStatsHandler(&disabled.Provider{}), sc.ServerStatsHandler) assert.Len(t, sc.UnaryInterceptors, 2) assert.Len(t, sc.StreamInterceptors, 2) sc = initializeServerConfig(conf, &prometheus.Provider{}) assert.NotNil(t, sc.ServerStatsHandler) goodFile := "main.go" badFile := "does_not_exist" oldLogger := logger defer func() { logger = oldLogger }() logger, _ = floggingtest.NewTestLogger(t) testCases := []struct { name string certificate string privateKey string rootCA string clientRootCert string clusterCert string clusterKey string clusterCA string }{ {"BadCertificate", badFile, goodFile, goodFile, goodFile, "", "", ""}, {"BadPrivateKey", goodFile, badFile, goodFile, goodFile, "", "", ""}, {"BadRootCA", goodFile, goodFile, badFile, goodFile, "", "", ""}, {"BadClientRootCertificate", goodFile, goodFile, goodFile, badFile, "", "", ""}, {"ClusterBadCertificate", goodFile, goodFile, goodFile, goodFile, badFile, goodFile, goodFile}, {"ClusterBadPrivateKey", goodFile, goodFile, goodFile, goodFile, goodFile, badFile, goodFile}, {"ClusterBadRootCA", goodFile, goodFile, goodFile, goodFile, goodFile, goodFile, badFile}, } for _, tc := range testCases { t.Run(tc.name, func(t *testing.T) { conf := &localconfig.TopLevel{ General: localconfig.General{ TLS: localconfig.TLS{ Enabled: true, ClientAuthRequired: true, Certificate: tc.certificate, PrivateKey: tc.privateKey, RootCAs: []string{tc.rootCA}, ClientRootCAs: []string{tc.clientRootCert}, }, Cluster: localconfig.Cluster{ ClientCertificate: tc.clusterCert, ClientPrivateKey: tc.clusterKey, RootCAs: []string{tc.clusterCA}, }, }, } assert.Panics(t, func() { if tc.clusterCert == "" { initializeServerConfig(conf, nil) } else { initializeClusterClientConfig(conf) } }, ) }) } }
explode_data.jsonl/32649
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1479 }
[ 2830, 3393, 9928, 5475, 2648, 1155, 353, 8840, 836, 8, 341, 67850, 1669, 609, 2438, 1676, 17557, 4449, 515, 197, 197, 15415, 25, 2205, 1676, 75749, 515, 298, 51625, 7636, 25, 220, 22, 353, 882, 32435, 345, 298, 10261, 7268, 25, 2205, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestDeploymentUpdate(t *testing.T) { g, requests, cancel, mgrStopped := setUp(t) defer func() { clean(g, c) cancel() mgrStopped.Wait() }() caseName := "test-deployment-update" instance := &appsv1alpha1.UnitedDeployment{ ObjectMeta: metav1.ObjectMeta{ Name: caseName, Namespace: "default", }, Spec: appsv1alpha1.UnitedDeploymentSpec{ Replicas: &two, Selector: &metav1.LabelSelector{ MatchLabels: map[string]string{ "name": caseName, }, }, Template: appsv1alpha1.SubsetTemplate{ DeploymentTemplate: &appsv1alpha1.DeploymentTemplateSpec{ ObjectMeta: metav1.ObjectMeta{ Labels: map[string]string{ "name": caseName, }, }, Spec: appsv1.DeploymentSpec{ Template: corev1.PodTemplateSpec{ ObjectMeta: metav1.ObjectMeta{ Labels: map[string]string{ "name": caseName, }, }, Spec: corev1.PodSpec{ Containers: []corev1.Container{ { Name: "container-a", Image: "nginx:1.0", }, }, }, }, }, }, }, Topology: appsv1alpha1.Topology{ Subsets: []appsv1alpha1.Subset{ { Name: "subset-a", NodeSelectorTerm: corev1.NodeSelectorTerm{ MatchExpressions: []corev1.NodeSelectorRequirement{ { Key: "node-name", Operator: corev1.NodeSelectorOpIn, Values: []string{"nodeA"}, }, }, }, }, { Name: "subset-b", NodeSelectorTerm: corev1.NodeSelectorTerm{ MatchExpressions: []corev1.NodeSelectorRequirement{ { Key: "node-name", Operator: corev1.NodeSelectorOpIn, Values: []string{"nodeB"}, }, }, }, }, }, }, RevisionHistoryLimit: &ten, }, } // Create the UnitedDeployment object and expect the Reconcile and Deployment to be created err := c.Create(context.TODO(), instance) // The instance object may not be a valid object because it might be missing some required fields. // Please modify the instance object by adding required fields and then remove the following if statement. if apierrors.IsInvalid(err) { t.Logf("failed to create object, got an invalid object error: %v", err) return } g.Expect(err).NotTo(gomega.HaveOccurred()) defer c.Delete(context.TODO(), instance) waitReconcilerProcessFinished(g, requests, 3) deploymentList := expectedDeploymentCount(g, instance, 2) g.Expect(*deploymentList.Items[0].Spec.Replicas + *deploymentList.Items[1].Spec.Replicas).Should(gomega.BeEquivalentTo(2)) revisionList := &appsv1.ControllerRevisionList{} g.Expect(c.List(context.TODO(), revisionList)) g.Expect(len(revisionList.Items)).Should(gomega.BeEquivalentTo(1)) g.Expect(c.Get(context.TODO(), client.ObjectKey{Namespace: instance.Namespace, Name: instance.Name}, instance)).Should(gomega.BeNil()) v1 := revisionList.Items[0].Name g.Expect(instance.Status.CurrentRevision).Should(gomega.BeEquivalentTo(v1)) instance.Spec.Template.DeploymentTemplate.Spec.Template.Spec.Containers[0].Image = "nginx:2.0" g.Expect(c.Update(context.TODO(), instance)).Should(gomega.BeNil()) waitReconcilerProcessFinished(g, requests, 2) deploymentList = expectedDeploymentCount(g, instance, 2) g.Expect(deploymentList.Items[0].Spec.Template.Spec.Containers[0].Image).Should(gomega.BeEquivalentTo("nginx:2.0")) g.Expect(deploymentList.Items[1].Spec.Template.Spec.Containers[0].Image).Should(gomega.BeEquivalentTo("nginx:2.0")) g.Expect(c.Get(context.TODO(), client.ObjectKey{Namespace: instance.Namespace, Name: instance.Name}, instance)).Should(gomega.BeNil()) revisionList = &appsv1.ControllerRevisionList{} g.Expect(c.List(context.TODO(), revisionList)) g.Expect(len(revisionList.Items)).Should(gomega.BeEquivalentTo(2)) v2 := revisionList.Items[0].Name if v2 == v1 { v2 = revisionList.Items[1].Name } g.Expect(instance.Status.UpdateStatus.UpdatedRevision).Should(gomega.BeEquivalentTo(v2)) }
explode_data.jsonl/59549
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1750 }
[ 2830, 3393, 75286, 4289, 1155, 353, 8840, 836, 8, 341, 3174, 11, 7388, 11, 9121, 11, 57897, 59803, 1669, 18620, 1155, 340, 16867, 2915, 368, 341, 197, 1444, 2675, 3268, 11, 272, 340, 197, 84441, 741, 197, 2109, 901, 59803, 28384, 741,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestDeclarativeFriendlyFieldsSingleton(t *testing.T) { for _, test := range []struct { name string Fields string want testutils.Problems }{ {"InvalidNoCreateTime", `string name = 1; string display_name = 2; google.protobuf.Timestamp update_time = 3;`, testutils.Problems{{Message: "create_time"}}}, {"ValidNoDeleteTimeNoUid", `string name = 1; string display_name = 2; ` + `google.protobuf.Timestamp create_time = 3; google.protobuf.Timestamp update_time = 4;`, nil}, } { t.Run(test.name, func(t *testing.T) { f := testutils.ParseProto3Tmpl(t, ` import "google/api/resource.proto"; import "google/protobuf/timestamp.proto"; message Book { option (google.api.resource) = { type: "library.googleapis.com/Settings" pattern: "publishers/{publisher}/settings" style: DECLARATIVE_FRIENDLY }; {{.Fields}} } `, test) m := f.GetMessageTypes()[0] got := declarativeFriendlyRequired.Lint(f) if diff := test.want.SetDescriptor(m).Diff(got); diff != "" { t.Error(diff) } }) } }
explode_data.jsonl/11809
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 458 }
[ 2830, 3393, 1912, 12821, 1388, 96505, 8941, 25915, 1155, 353, 8840, 836, 8, 341, 2023, 8358, 1273, 1669, 2088, 3056, 1235, 341, 197, 11609, 256, 914, 198, 197, 197, 8941, 914, 198, 197, 50780, 256, 1273, 6031, 7763, 21699, 198, 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...
2
func TestTrafficSwitchStackset(t *testing.T) { t.Parallel() stacksetName := "switch-traffic-stackset" firstVersion := "v1" firstStack := fmt.Sprintf("%s-%s", stacksetName, firstVersion) updatedVersion := "v2" updatedStack := fmt.Sprintf("%s-%s", stacksetName, updatedVersion) factory := NewTestStacksetSpecFactory(stacksetName).Ingress(nil) spec := factory.Create(firstVersion) err := createStackSet(stacksetName, 0, spec) require.NoError(t, err) _, err = waitForStack(t, stacksetName, firstVersion) require.NoError(t, err) spec = factory.Create(updatedVersion) err = updateStackset(stacksetName, spec) require.NoError(t, err) _, err = waitForStack(t, stacksetName, updatedVersion) require.NoError(t, err) _, err = waitForIngress(t, stacksetName) require.NoError(t, err) initialWeights := map[string]float64{firstStack: 100} expectActualTrafficWeights(t, stacksetName, initialWeights) err = trafficWeightsUpdatedStackset(t, stacksetName, weightKindDesired, initialWeights, nil).await() require.NoError(t, err) err = ingressTrafficAuthoritative(t, stacksetName, false).await() require.NoError(t, err) expectStackTrafficWeights(t, firstStack, 100, 100) expectStackTrafficWeights(t, updatedStack, 0, 0) // Switch traffic 50/50 desiredWeights := map[string]float64{firstStack: 50, updatedStack: 50} err = setDesiredTrafficWeightsStackset(stacksetName, desiredWeights) require.NoError(t, err) expectActualTrafficWeights(t, stacksetName, desiredWeights) err = ingressTrafficAuthoritative(t, stacksetName, false).await() require.NoError(t, err) expectStackTrafficWeights(t, firstStack, 50, 50) expectStackTrafficWeights(t, updatedStack, 50, 50) // Switch traffic 0/100 newDesiredWeights := map[string]float64{updatedStack: 100} err = setDesiredTrafficWeightsStackset(stacksetName, newDesiredWeights) require.NoError(t, err) expectActualTrafficWeights(t, stacksetName, newDesiredWeights) err = ingressTrafficAuthoritative(t, stacksetName, false).await() require.NoError(t, err) expectStackTrafficWeights(t, firstStack, 0, 0) expectStackTrafficWeights(t, updatedStack, 100, 100) }
explode_data.jsonl/14744
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 752 }
[ 2830, 3393, 87229, 16837, 4336, 746, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 2822, 48227, 40730, 1669, 330, 17338, 12, 53987, 56090, 746, 698, 42190, 5637, 1669, 330, 85, 16, 698, 42190, 4336, 1669, 8879, 17305, 4430, 82, 11069...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestAtomicRename(t *testing.T) { dirBase, cleanup := tempdir(t) defer cleanup() // Create base file origFilePath := dirBase + "original.txt" err := ioutil.WriteFile(origFilePath, []byte("tests"), 0644) if err != nil { t.Fatalf("Could not write original test file") } // Create secondary file tempFilePath := dirBase + "newTempFile.txt" err = ioutil.WriteFile(tempFilePath, []byte("success"), 0644) if err != nil { t.Fatalf("Could not write temp file") } // Execute our magic rename function err = rn.Rename(tempFilePath, origFilePath) if err != nil { t.Fatalf("Could not rename temp file") } // Let's read the renamed file and ensure that we get data renamedFileBytes, err := ioutil.ReadFile(origFilePath) if err != nil { t.Fatalf("Could not read renamed file") } // Let's compare the bytes of the renamed file if bytes.Compare(renamedFileBytes, []byte("success")) != 0 { t.Fatalf("Did not find expected bytes in renamed file %d vs %d", renamedFileBytes, []byte("success")) } }
explode_data.jsonl/3042
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 347 }
[ 2830, 3393, 65857, 88757, 1155, 353, 8840, 836, 8, 341, 48532, 3978, 11, 21290, 1669, 2730, 3741, 1155, 340, 16867, 21290, 2822, 197, 322, 4230, 2331, 1034, 198, 197, 4670, 19090, 1669, 5419, 3978, 488, 330, 9889, 3909, 698, 9859, 1669,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
6
func TestNested(t *testing.T) { testWrap(t, func(store *badgerhold.Store, t *testing.T) { for i := range nestedData { err := store.Insert(nestedData[i].Key, nestedData[i]) if err != nil { t.Fatalf("Error inserting nested test data for nested find test: %s", err) } } for _, tst := range nestedTests { t.Run(tst.name, func(t *testing.T) { var result []Nested err := store.Find(&result, tst.query) if err != nil { t.Fatalf("Error finding data from badgerhold: %s", err) } if len(result) != len(tst.result) { if testing.Verbose() { t.Fatalf("Find result count is %d wanted %d. Results: %v", len(result), len(tst.result), result) } t.Fatalf("Find result count is %d wanted %d.", len(result), len(tst.result)) } for i := range result { found := false for k := range tst.result { if reflect.DeepEqual(result[i], nestedData[tst.result[k]]) { found = true break } } if !found { if testing.Verbose() { t.Fatalf("%v should not be in the result set! Full results: %v", result[i], result) } t.Fatalf("%v should not be in the result set!", result[i]) } } }) } }) }
explode_data.jsonl/28404
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 574 }
[ 2830, 3393, 71986, 1155, 353, 8840, 836, 8, 341, 18185, 26787, 1155, 11, 2915, 31200, 353, 13855, 1389, 6282, 38047, 11, 259, 353, 8840, 836, 8, 341, 197, 2023, 600, 1669, 2088, 24034, 1043, 341, 298, 9859, 1669, 3553, 23142, 1445, 99...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestStringParemeter(t *testing.T) { var log = Init(INFO_LEVEL, false, false) const expected = "with parameter: 42, second" log.Info("with parameter: %d, %s", 42, "second") var msg = log.GetLastLog() if !strings.Contains(msg, expected) { t.Errorf("Got: %s expected: %s", msg, expected) } }
explode_data.jsonl/3659
{ "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, 703, 47, 546, 59422, 1155, 353, 8840, 836, 8, 341, 2405, 1487, 284, 15690, 62318, 17415, 11, 895, 11, 895, 340, 4777, 3601, 284, 330, 4197, 5733, 25, 220, 19, 17, 11, 2086, 1837, 6725, 20132, 445, 4197, 5733, 25, 1018, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestFindCommand(t *testing.T) { if cmd, err := Default.FindCommand(999, 257); err != nil { t.Error(err) } else if cmd.Short != "CE" { t.Fatalf("Unexpected command: %#v", cmd) } }
explode_data.jsonl/9074
{ "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, 9885, 4062, 1155, 353, 8840, 836, 8, 341, 743, 5439, 11, 1848, 1669, 7899, 9998, 4062, 7, 24, 24, 24, 11, 220, 17, 20, 22, 1215, 1848, 961, 2092, 341, 197, 3244, 6141, 3964, 340, 197, 92, 770, 421, 5439, 55958, 961, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
3
func TestPrivateActivityYesVisibleForUserItself(t *testing.T) { defer prepareTestEnv(t)() testPrivateActivityDoSomethingForActionEntries(t) testPrivateActivityHelperEnablePrivateActivity(t) session := loginUser(t, privateActivityTestUser) visible := testPrivateActivityHelperHasVisibleActivitiesFromSession(t, session) assert.True(t, visible, "user should have visible activities") }
explode_data.jsonl/51650
{ "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, 16787, 4052, 9454, 5715, 2461, 1474, 2132, 721, 1155, 353, 8840, 836, 8, 341, 16867, 10549, 2271, 14359, 1155, 8, 741, 18185, 16787, 4052, 5404, 23087, 2461, 2512, 24533, 1155, 340, 18185, 16787, 4052, 5511, 11084, 16787, 4052...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestJobCanBeLeasedOnlyOnce(t *testing.T) { withRepository(func(r *RedisJobRepository) { job := addLeasedJob(t, r, "queue1", "cluster1") leasedAgain, e := r.TryLeaseJobs("cluster2", "queue1", []*api.Job{job}) assert.Nil(t, e) assert.Equal(t, 0, len(leasedAgain)) }) }
explode_data.jsonl/32036
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 123 }
[ 2830, 3393, 12245, 69585, 2304, 1475, 7308, 12522, 1155, 353, 8840, 836, 8, 341, 46948, 4624, 18552, 2601, 353, 48137, 12245, 4624, 8, 1476, 197, 68577, 1669, 912, 2304, 1475, 12245, 1155, 11, 435, 11, 330, 4584, 16, 497, 330, 18855, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestListTeams(t *testing.T) { ts := simpleTestServer(t, "/orgs/foo/teams", []Team{{ID: 1}}) defer ts.Close() c := getClient(ts.URL) teams, err := c.ListTeams("foo") if err != nil { t.Errorf("Didn't expect error: %v", err) } else if len(teams) != 1 { t.Errorf("Expected one team, found %d: %v", len(teams), teams) } else if teams[0].ID != 1 { t.Errorf("Wrong team names: %v", teams) } }
explode_data.jsonl/6284
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 176 }
[ 2830, 3393, 852, 60669, 1155, 353, 8840, 836, 8, 341, 57441, 1669, 4285, 2271, 5475, 1155, 11, 3521, 1775, 82, 60555, 14, 38496, 497, 3056, 14597, 2979, 915, 25, 220, 16, 71362, 16867, 10591, 10421, 741, 1444, 1669, 86287, 35864, 20893,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestItemCanBeInterface(t *testing.T) { readerType := reflect.TypeOf([]io.Reader{}).Elem() called := false b := batcher.New(readerType, 1, func(items interface{}) error { called = true _, ok := items.([]io.Reader) if !ok { t.Fatal("items is not a []io.Reader") } return nil }) b.Add(context.Background(), &bytes.Buffer{}) if !called { t.Fatal("handler not called") } }
explode_data.jsonl/16713
{ "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, 1234, 69585, 5051, 1155, 353, 8840, 836, 8, 341, 61477, 929, 1669, 8708, 73921, 10556, 815, 47431, 6257, 568, 25586, 741, 1444, 4736, 1669, 895, 198, 2233, 1669, 7162, 261, 7121, 21987, 929, 11, 220, 16, 11, 2915, 24337, 3...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestSearchAndExtractExif(t *testing.T) { testImageFilepath := getTestImageFilepath() imageData, err := ioutil.ReadFile(testImageFilepath) log.PanicIf(err) rawExif, err := SearchAndExtractExif(imageData) log.PanicIf(err) testExifData := getTestExifData() if bytes.Compare(rawExif[:len(testExifData)], testExifData) != 0 { t.Fatalf("found EXIF data not correct") } }
explode_data.jsonl/70133
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 147 }
[ 2830, 3393, 5890, 3036, 28959, 840, 333, 1155, 353, 8840, 836, 8, 341, 18185, 1906, 1703, 2343, 1669, 633, 2271, 1906, 1703, 2343, 2822, 31426, 1043, 11, 1848, 1669, 43144, 78976, 8623, 1906, 1703, 2343, 340, 6725, 1069, 31270, 2679, 39...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestTransportDisableCompression(t *testing.T) { const body = "sup" st := newServerTester(t, func(w http.ResponseWriter, r *http.Request) { want := http.Header{ "User-Agent": []string{"Go-http-client/2.0"}, } if !reflect.DeepEqual(r.Header, want) { t.Errorf("request headers = %v; want %v", r.Header, want) } }, optOnlyServer) defer st.Close() tr := &Transport{ TLSClientConfig: tlsConfigInsecure, t1: &http.Transport{ DisableCompression: true, }, } defer tr.CloseIdleConnections() req, err := http.NewRequest("GET", st.ts.URL, nil) if err != nil { t.Fatal(err) } res, err := tr.RoundTrip(req) if err != nil { t.Fatal(err) } defer res.Body.Close() }
explode_data.jsonl/16115
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 296 }
[ 2830, 3393, 27560, 25479, 81411, 1155, 353, 8840, 836, 8, 341, 4777, 2487, 284, 330, 12776, 698, 18388, 1669, 501, 5475, 58699, 1155, 11, 2915, 3622, 1758, 37508, 11, 435, 353, 1254, 9659, 8, 341, 197, 50780, 1669, 1758, 15753, 515, 2...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestCountFiles(t *testing.T) { // Create temp dir to test in dir := t.TempDir() if err := setupTestDir(dir); err != nil { t.Fatalf("error creating test dir: %s\n", err) } result, err := CountFiles(dir) if err != nil { t.Fatalf("error counting files: %s\n", err) } // Check if the result is correct if result != len(files) { t.Fatalf("counted the wrong number of files: expected %d, actual: %d", len(files), result) } }
explode_data.jsonl/30983
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 163 }
[ 2830, 3393, 2507, 10809, 1155, 353, 8840, 836, 8, 341, 197, 322, 4230, 2730, 5419, 311, 1273, 304, 198, 48532, 1669, 259, 65009, 6184, 741, 743, 1848, 1669, 6505, 2271, 6184, 14161, 1215, 1848, 961, 2092, 341, 197, 3244, 30762, 445, 8...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
4
func TestAgingPayablesListEndpoint_GetPrimary(t *testing.T) { var want types.GUID n := &AgingPayablesList{AccountId: &want} if got := n.GetPrimary(); !reflect.DeepEqual(*got, want) { t.Errorf("AgingPayablesListEndpoint.GetPrimary() failed, got: %v, want: %v", *got, want) } }
explode_data.jsonl/28468
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 108 }
[ 2830, 3393, 32, 3173, 20595, 4788, 852, 27380, 13614, 15972, 1155, 353, 8840, 836, 8, 341, 2405, 1366, 4494, 1224, 6463, 198, 9038, 1669, 609, 32, 3173, 20595, 4788, 852, 90, 62545, 25, 609, 52657, 630, 743, 2684, 1669, 308, 2234, 159...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestDeleteGlobalReactsOnNumberOfRemovedObjects(t *testing.T) { givenID := uuidA() sut := repo.NewDeleterGlobal("users") cases := map[string]struct { methodToTest methodToTestWithoutTenant givenRowsAffected int64 expectedErrString string }{ "[DeleteOne] returns error when removed more than one object": { methodToTest: sut.DeleteOneGlobal, givenRowsAffected: 154, expectedErrString: "delete should remove single row, but removed 154 rows", }, "[DeleteOne] returns error when object not found": { methodToTest: sut.DeleteOneGlobal, givenRowsAffected: 0, expectedErrString: "delete should remove single row, but removed 0 rows", }, "[Delete Many] success when removed more than one object": { methodToTest: sut.DeleteManyGlobal, givenRowsAffected: 154, expectedErrString: "", }, "[Delete Many] success when not found objects to remove": { methodToTest: sut.DeleteManyGlobal, givenRowsAffected: 0, expectedErrString: "", }, } for tn, tc := range cases { t.Run(tn, func(t *testing.T) { // GIVEN expectedQuery := regexp.QuoteMeta("DELETE FROM users WHERE id_col = $1") db, mock := testdb.MockDatabase(t) ctx := persistence.SaveToContext(context.TODO(), db) defer mock.AssertExpectations(t) mock.ExpectExec(expectedQuery).WithArgs(givenID).WillReturnResult(sqlmock.NewResult(0, tc.givenRowsAffected)) // WHEN err := tc.methodToTest(ctx, repo.Conditions{repo.NewEqualCondition("id_col", givenID)}) // THEN if tc.expectedErrString != "" { require.EqualError(t, err, tc.expectedErrString) } }) } }
explode_data.jsonl/61040
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 627 }
[ 2830, 3393, 6435, 11646, 693, 11359, 1925, 40619, 42642, 11543, 1155, 353, 8840, 836, 8, 341, 3174, 2071, 915, 1669, 16040, 32, 741, 1903, 332, 1669, 15867, 7121, 1912, 273, 465, 11646, 445, 4218, 5130, 1444, 2264, 1669, 2415, 14032, 60...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestGetEnv(t *testing.T) { os.Setenv("FOO", "1") foo := GetEnv("FOO", "2") assert.Assert(t, foo == "1") bar := GetEnv("BAR", "42") assert.Assert(t, bar == "42") }
explode_data.jsonl/49268
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 84 }
[ 2830, 3393, 1949, 14359, 1155, 353, 8840, 836, 8, 341, 25078, 4202, 3160, 445, 3788, 46, 497, 330, 16, 1138, 197, 7975, 1669, 2126, 14359, 445, 3788, 46, 497, 330, 17, 1138, 6948, 11711, 1155, 11, 15229, 621, 330, 16, 1138, 90709, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestBatch(t *testing.T) { conn, err := dbtest.Connect() if err != nil { t.Error(err) return } defer func() { dbtest.Reset(conn) dbtest.Disconnect(conn) }() batcher := New(conn).(*batchUpdater) repos := repos.New(conn) perms := perm.New(conn) user, err := seedUser(batcher.db) if err != nil { t.Error(err) } t.Run("Insert", testBatchInsert(batcher, repos, perms, user)) t.Run("Update", testBatchUpdate(batcher, repos, perms, user)) t.Run("Delete", testBatchDelete(batcher, repos, perms, user)) }
explode_data.jsonl/11846
{ "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, 21074, 1155, 353, 8840, 836, 8, 341, 32917, 11, 1848, 1669, 2927, 1944, 43851, 741, 743, 1848, 961, 2092, 341, 197, 3244, 6141, 3964, 340, 197, 853, 198, 197, 532, 16867, 2915, 368, 341, 197, 20939, 1944, 36660, 20571, 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 TestAmbientCredentialsFromEnv(t *testing.T) { os.Setenv("AWS_ACCESS_KEY_ID", "123") os.Setenv("AWS_SECRET_ACCESS_KEY", "123") os.Setenv("AWS_REGION", "us-east-1") defer restoreRoute53Env() provider, err := NewDNSProvider("", "", "", "", "", true, util.RecursiveNameservers) assert.NoError(t, err, "Expected no error constructing DNSProvider") _, err = provider.client.Config.Credentials.Get() assert.NoError(t, err, "Expected credentials to be set from environment") assert.Equal(t, provider.client.Config.Region, aws.String("us-east-1")) }
explode_data.jsonl/65001
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 209 }
[ 2830, 3393, 54032, 1167, 27025, 3830, 14359, 1155, 353, 8840, 836, 8, 341, 25078, 4202, 3160, 445, 36136, 24420, 6600, 3450, 497, 330, 16, 17, 18, 1138, 25078, 4202, 3160, 445, 36136, 31408, 24420, 6600, 497, 330, 16, 17, 18, 1138, 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 TestComputeinstanceagentComputeInstanceAgentClientListInstanceAgentCommands(t *testing.T) { defer failTestOnPanic(t) enabled, err := testClient.isApiEnabled("computeinstanceagent", "ListInstanceAgentCommands") assert.NoError(t, err) if !enabled { t.Skip("ListInstanceAgentCommands is not enabled by the testing service") } cc, err := testClient.createClientForOperation("computeinstanceagent", "ComputeInstanceAgent", "ListInstanceAgentCommands", createComputeinstanceagentComputeInstanceAgentClientWithProvider) assert.NoError(t, err) c := cc.(computeinstanceagent.ComputeInstanceAgentClient) body, err := testClient.getRequests("computeinstanceagent", "ListInstanceAgentCommands") assert.NoError(t, err) type ListInstanceAgentCommandsRequestInfo struct { ContainerId string Request computeinstanceagent.ListInstanceAgentCommandsRequest } var requests []ListInstanceAgentCommandsRequestInfo var dataHolder []map[string]interface{} err = json.Unmarshal([]byte(body), &dataHolder) assert.NoError(t, err) err = unmarshalRequestInfo(dataHolder, &requests, testClient.Log) assert.NoError(t, err) var retryPolicy *common.RetryPolicy for i, request := range requests { t.Run(fmt.Sprintf("request:%v", i), func(t *testing.T) { if withRetry == true { retryPolicy = retryPolicyForTests() } request.Request.RequestMetadata.RetryPolicy = retryPolicy listFn := func(req common.OCIRequest) (common.OCIResponse, error) { r := req.(*computeinstanceagent.ListInstanceAgentCommandsRequest) return c.ListInstanceAgentCommands(context.Background(), *r) } listResponses, err := testClient.generateListResponses(&request.Request, listFn) typedListResponses := make([]computeinstanceagent.ListInstanceAgentCommandsResponse, len(listResponses)) for i, lr := range listResponses { typedListResponses[i] = lr.(computeinstanceagent.ListInstanceAgentCommandsResponse) } message, err := testClient.validateResult(request.ContainerId, request.Request, typedListResponses, err) assert.NoError(t, err) assert.Empty(t, message, message) }) } }
explode_data.jsonl/6903
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 701 }
[ 2830, 3393, 46254, 4851, 8092, 46254, 2523, 16810, 2959, 852, 2523, 16810, 30479, 1155, 353, 8840, 836, 8, 341, 16867, 3690, 2271, 1925, 47, 31270, 1155, 692, 197, 15868, 11, 1848, 1669, 1273, 2959, 2079, 6563, 5462, 445, 27706, 4851, 8...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestNewRequestWithQuery(t *testing.T) { client := newClient() q := url.Values{} q.Add("antani", "mascetti") q.Add("melandri", "conte") req, err := client.NewRequest( context.Background(), "GET", "/", q, nil, ) if err != nil { t.Fatal(err) } if req.URL.Query().Get("antani") != "mascetti" { t.Fatal("expected different query string here") } if req.URL.Query().Get("melandri") != "conte" { t.Fatal("expected different query string here") } }
explode_data.jsonl/60961
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 186 }
[ 2830, 3393, 3564, 1900, 2354, 2859, 1155, 353, 8840, 836, 8, 341, 25291, 1669, 501, 2959, 741, 18534, 1669, 2515, 35145, 16094, 18534, 1904, 445, 517, 5559, 497, 330, 76, 5061, 27937, 1138, 18534, 1904, 445, 76, 18123, 461, 497, 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...
4
func TestGetEnvAsInt(t *testing.T) { t.Parallel() testVarKey := "TEST_ONLY_FOR_UNIT_TEST_INT" res := util.GetEnvAsInt(testVarKey, 1) assert.Equal(t, 1, res) os.Setenv(testVarKey, "2") defer os.Unsetenv(testVarKey) res = util.GetEnvAsInt(testVarKey, 1) assert.Equal(t, 2, res) os.Setenv(testVarKey, "3x") res = util.GetEnvAsInt(testVarKey, 1) assert.Equal(t, 1, res) }
explode_data.jsonl/6084
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 183 }
[ 2830, 3393, 1949, 14359, 2121, 1072, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 2822, 18185, 3962, 1592, 1669, 330, 10033, 31263, 14516, 31718, 11641, 9161, 698, 10202, 1669, 4094, 2234, 14359, 2121, 1072, 8623, 3962, 1592, 11, 220,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestObjectPutMimeType(t *testing.T) { ctx := context.Background() c, rollback := makeConnectionWithContainer(t) defer rollback() err := c.ObjectPutString(ctx, CONTAINER, "test.jpg", CONTENTS, "") if err != nil { t.Fatal(err) } defer func() { err = c.ObjectDelete(ctx, CONTAINER, "test.jpg") if err != nil { t.Error(err) } }() info, _, err := c.Object(ctx, CONTAINER, "test.jpg") if err != nil { t.Error(err) } if info.ContentType != "image/jpeg" { t.Error("Bad content type", info.ContentType) } }
explode_data.jsonl/12679
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 222 }
[ 2830, 3393, 1190, 19103, 97081, 1155, 353, 8840, 836, 8, 341, 20985, 1669, 2266, 19047, 741, 1444, 11, 60414, 1669, 1281, 4526, 2354, 4502, 1155, 340, 16867, 60414, 741, 9859, 1669, 272, 8348, 19103, 703, 7502, 11, 16120, 34521, 11, 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...
2
func TestTLSClientCertsPemBeforeFiles(t *testing.T) { clientTLSOverride := endpoint.MutualTLSConfig{} // files have incorrect paths, but pems are loaded first clientTLSOverride.Client.Cert.Path = filepath.Clean("/pkg/config/testdata/certs/client_sdk_go.pem") clientTLSOverride.Client.Key.Path = filepath.Clean("/pkg/config/testdata/certs/client_sdk_go-key.pem") clientTLSOverride.Client.Cert.Pem = `-----BEGIN CERTIFICATE----- MIIC5TCCAkagAwIBAgIUMYhiY5MS3jEmQ7Fz4X/e1Dx33J0wCgYIKoZIzj0EAwQw gYwxCzAJBgNVBAYTAkNBMRAwDgYDVQQIEwdPbnRhcmlvMRAwDgYDVQQHEwdUb3Jv bnRvMREwDwYDVQQKEwhsaW51eGN0bDEMMAoGA1UECxMDTGFiMTgwNgYDVQQDEy9s aW51eGN0bCBFQ0MgUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSAoTGFiKTAe Fw0xNzEyMDEyMTEzMDBaFw0xODEyMDEyMTEzMDBaMGMxCzAJBgNVBAYTAkNBMRAw DgYDVQQIEwdPbnRhcmlvMRAwDgYDVQQHEwdUb3JvbnRvMREwDwYDVQQKEwhsaW51 eGN0bDEMMAoGA1UECxMDTGFiMQ8wDQYDVQQDDAZzZGtfZ28wdjAQBgcqhkjOPQIB BgUrgQQAIgNiAAT6I1CGNrkchIAEmeJGo53XhDsoJwRiohBv2PotEEGuO6rMyaOu pulj2VOj+YtgWw4ZtU49g4Nv6rq1QlKwRYyMwwRJSAZHIUMhYZjcDi7YEOZ3Fs1h xKmIxR+TTR2vf9KjgZAwgY0wDgYDVR0PAQH/BAQDAgWgMBMGA1UdJQQMMAoGCCsG AQUFBwMCMAwGA1UdEwEB/wQCMAAwHQYDVR0OBBYEFDwS3xhpAWs81OVWvZt+iUNL z26DMB8GA1UdIwQYMBaAFLRasbknomawJKuQGiyKs/RzTCujMBgGA1UdEQQRMA+C DWZhYnJpY19zZGtfZ28wCgYIKoZIzj0EAwQDgYwAMIGIAkIAk1MxMogtMtNO0rM8 gw2rrxqbW67ulwmMQzp6EJbm/28T2pIoYWWyIwpzrquypI7BOuf8is5b7Jcgn9oz 7sdMTggCQgF7/8ZFl+wikAAPbciIL1I+LyCXKwXosdFL6KMT6/myYjsGNeeDeMbg 3YkZ9DhdH1tN4U/h+YulG/CkKOtUATtQxg== -----END CERTIFICATE-----` clientTLSOverride.Client.Key.Pem = `-----BEGIN EC PRIVATE KEY----- MIGkAgEBBDByldj7VTpqTQESGgJpR9PFW9b6YTTde2WN6/IiBo2nW+CIDmwQgmAl c/EOc9wmgu+gBwYFK4EEACKhZANiAAT6I1CGNrkchIAEmeJGo53XhDsoJwRiohBv 2PotEEGuO6rMyaOupulj2VOj+YtgWw4ZtU49g4Nv6rq1QlKwRYyMwwRJSAZHIUMh YZjcDi7YEOZ3Fs1hxKmIxR+TTR2vf9I= -----END EC PRIVATE KEY-----` backends, err := overrideClientTLSInBackend(configBackend, &clientTLSOverride) assert.Nil(t, err) config, err := ConfigFromBackend(backends...) if err != nil { t.Fatal(err) } certs := config.TLSClientCerts() if len(certs) != 1 { t.Fatal("Expected only one tls cert struct") } if reflect.DeepEqual(certs[0], tls.Certificate{}) { t.Fatal("Actual cert is empty") } }
explode_data.jsonl/34096
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1286 }
[ 2830, 3393, 45439, 2959, 34, 15546, 47, 336, 10227, 10809, 1155, 353, 8840, 836, 8, 1476, 25291, 45439, 2177, 1669, 14887, 1321, 332, 928, 45439, 2648, 16094, 197, 322, 3542, 614, 15114, 12716, 11, 714, 281, 11852, 525, 6661, 1156, 198,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
4
func TestAutoRegexp(t *testing.T) { // Define a script and some test inputs and outputs. input := strings.Replace("It does not matter how slowly you go as long as you do not stop.", " ", "\n", -1) var output string desiredOutput := "go" scr := NewScript() re := regexp.MustCompile("Go") scr.Begin = func(s *Script) { scr.IgnoreCase(true) } scr.AppendStmt(Auto(re), func(s *Script) { output = s.F(1).String() }) // Run the script and validate the output. err := scr.Run(strings.NewReader(input)) if err != nil { t.Fatal(err) } if output != desiredOutput { t.Fatalf("Expected %q but received %q", desiredOutput, output) } }
explode_data.jsonl/3020
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 232 }
[ 2830, 3393, 13253, 3477, 4580, 1155, 353, 8840, 836, 8, 341, 197, 322, 18614, 264, 5316, 323, 1045, 1273, 11127, 323, 16275, 624, 22427, 1669, 9069, 20858, 445, 2132, 1558, 537, 4925, 1246, 13970, 498, 728, 438, 1293, 438, 498, 653, 5...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestCertificateChange(t *testing.T) { bootPeers := []string{bootPeer(42611), bootPeer(42612), bootPeer(42613)} p1 := createDiscoveryInstance(42611, "d1", bootPeers) p2 := createDiscoveryInstance(42612, "d2", bootPeers) p3 := createDiscoveryInstance(42613, "d3", bootPeers) // Wait for membership establishment assertMembership(t, []*gossipInstance{p1, p2, p3}, 2) // Shutdown the second peer waitUntilOrFailBlocking(t, p2.Stop) var pingCountFrom1 uint32 var pingCountFrom3 uint32 // Program mocks to increment ping counters p1.comm.lock.Lock() p1.comm.mock = &mock.Mock{} p1.comm.mock.On("SendToPeer", mock.Anything, mock.Anything) p1.comm.mock.On("Ping").Run(func(arguments mock.Arguments) { atomic.AddUint32(&pingCountFrom1, 1) }) p1.comm.lock.Unlock() p3.comm.lock.Lock() p3.comm.mock = &mock.Mock{} p3.comm.mock.On("SendToPeer", mock.Anything, mock.Anything) p3.comm.mock.On("Ping").Run(func(arguments mock.Arguments) { atomic.AddUint32(&pingCountFrom3, 1) }) p3.comm.lock.Unlock() pingCount1 := func() uint32 { return atomic.LoadUint32(&pingCountFrom1) } pingCount3 := func() uint32 { return atomic.LoadUint32(&pingCountFrom3) } c1 := pingCount1() c3 := pingCount3() // Ensure the first peer and third peer try to reconnect to it waitUntilTimeoutOrFail(t, func() bool { return pingCount1() > c1 && pingCount3() > c3 }, timeout) // Tell the first peer that the second peer's PKI-ID has changed // So that it will purge it from the membership entirely p1.comm.identitySwitch <- common.PKIidType("localhost:42612") c1 = pingCount1() c3 = pingCount3() // Ensure third peer tries to reconnect to it waitUntilTimeoutOrFail(t, func() bool { return pingCount3() > c3 }, timeout) // Ensure the first peer ceases from trying assert.Equal(t, c1, pingCount1()) waitUntilOrFailBlocking(t, p1.Stop) waitUntilOrFailBlocking(t, p3.Stop) }
explode_data.jsonl/62270
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 717 }
[ 2830, 3393, 33202, 4072, 1155, 353, 8840, 836, 8, 341, 197, 4619, 10197, 388, 1669, 3056, 917, 90, 4619, 30888, 7, 19, 17, 21, 16, 16, 701, 10459, 30888, 7, 19, 17, 21, 16, 17, 701, 10459, 30888, 7, 19, 17, 21, 16, 18, 10569, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestRandSeq(t *testing.T) { if len(RandSeq(10)) != 10 { t.Errorf("RandSeq return invalid length") } var isLetter = regexp.MustCompile(`^[a-zA-Z]+$`).MatchString if !isLetter(RandSeq(10)) { t.Errorf("RandSeq should be AlphaNumeric only") } }
explode_data.jsonl/20212
{ "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, 56124, 20183, 1155, 353, 8840, 836, 8, 341, 743, 2422, 2785, 437, 20183, 7, 16, 15, 593, 961, 220, 16, 15, 341, 197, 3244, 13080, 445, 56124, 20183, 470, 8318, 3084, 1138, 197, 630, 2405, 374, 34264, 284, 41877, 98626, 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 TestEncode(t *testing.T) { tt := []struct { desc string input []byte repeat int // input will be concatenated the input this many times. want string }{ // Inputs of 8, 248, and 264 bits from http://keccak.noekeon.org/ are included below. { desc: "short-8b", input: decodeHex("CC"), repeat: 1, want: "EEAD6DBFC7340A56CAEDC044696A168870549A6A7F6F56961E84A54BD9970B8A", }, { desc: "short-248b", input: decodeHex("84FB51B517DF6C5ACCB5D022F8F28DA09B10232D42320FFC32DBECC3835B29"), repeat: 1, want: "D477FB02CAAA95B3280EC8EE882C29D9E8A654B21EF178E0F97571BF9D4D3C1C", }, { desc: "short-264b", input: decodeHex("DE8F1B3FAA4B7040ED4563C3B8E598253178E87E4D0DF75E4FF2F2DEDD5A0BE046"), repeat: 1, want: "E78C421E6213AFF8DE1F025759A4F2C943DB62BBDE359C8737E19B3776ED2DD2", }, // The computed test vector is 64 MiB long and is a truncated version // of the ExtremelyLongMsgKAT taken from http://keccak.noekeon.org/. { desc: "long-64MiB", input: []byte("abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmnhijklmno"), repeat: 1024 * 1024, want: "5015A4935F0B51E091C6550A94DCD262C08998232CCAA22E7F0756DEAC0DC0D0", }, } for _, tc := range tt { input := []byte{} for i := 0; i < tc.repeat; i++ { input = append(input, tc.input...) } got := strings.ToUpper(hex.EncodeToString(Encode(input))) if got != tc.want { t.Errorf("%s, got %q, want %q", tc.desc, got, tc.want) } } }
explode_data.jsonl/75435
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 748 }
[ 2830, 3393, 32535, 1155, 353, 8840, 836, 8, 341, 3244, 83, 1669, 3056, 1235, 341, 197, 41653, 256, 914, 198, 197, 22427, 220, 3056, 3782, 198, 197, 17200, 10979, 526, 442, 1946, 686, 387, 97534, 279, 1946, 419, 1657, 3039, 624, 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 TestListTenants(t *testing.T) { th.SetupHTTP() defer th.TeardownHTTP() HandleListTenantsSuccessfully(t) count := 0 err := tenants.List(client.ServiceClient(), nil).EachPage(func(page pagination.Page) (bool, error) { count++ actual, err := tenants.ExtractTenants(page) th.AssertNoErr(t, err) th.CheckDeepEquals(t, ExpectedTenantSlice, actual) return true, nil }) th.AssertNoErr(t, err) th.CheckEquals(t, count, 1) }
explode_data.jsonl/82166
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 176 }
[ 2830, 3393, 852, 32687, 1783, 1155, 353, 8840, 836, 8, 341, 70479, 39820, 9230, 741, 16867, 270, 94849, 37496, 9230, 741, 197, 6999, 852, 32687, 1783, 35959, 1155, 692, 18032, 1669, 220, 15, 198, 9859, 1669, 39916, 5814, 12805, 13860, 2...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestProcessUpdate(t *testing.T) { t.Parallel() binanceOrderBookLock.Lock() defer binanceOrderBookLock.Unlock() p := currency.NewPair(currency.BTC, currency.USDT) var depth WebsocketDepthStream err := json.Unmarshal(websocketDepthUpdate, &depth) if err != nil { t.Fatal(err) } err = b.obm.stageWsUpdate(&depth, p, asset.Spot) if err != nil { t.Fatal(err) } err = b.obm.fetchBookViaREST(p) if err != nil { t.Fatal(err) } err = b.obm.cleanup(p) if err != nil { t.Fatal(err) } // reset order book sync status b.obm.state[currency.BTC][currency.USDT][asset.Spot].lastUpdateID = 0 }
explode_data.jsonl/76699
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 260 }
[ 2830, 3393, 7423, 4289, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 741, 2233, 24387, 4431, 7134, 11989, 31403, 741, 16867, 9544, 681, 4431, 7134, 11989, 39188, 741, 3223, 1669, 11413, 7121, 12443, 90475, 1785, 7749, 11, 11413, 67672...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestFlowResolvers(t *testing.T) { resolver := func(*broker.Context) (specs.FlowListInterface, error) { return specs.FlowListInterface{&specs.Flow{}}, nil } ctx := logger.WithLogger(broker.NewBackground()) resolvers := FlowsResolvers{resolver} flows, err := resolvers.Resolve(ctx) if err != nil { t.Fatal(err) } if len(flows) != 1 { t.Fatalf("unexpected flows %+v, expected 1 flow", flows) } }
explode_data.jsonl/2204
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 161 }
[ 2830, 3393, 18878, 1061, 39435, 1155, 353, 8840, 836, 8, 341, 10202, 7921, 1669, 2915, 4071, 69309, 9328, 8, 320, 94531, 60732, 852, 5051, 11, 1465, 8, 341, 197, 853, 32247, 60732, 852, 5051, 90, 5, 94531, 60732, 6257, 2137, 2092, 198...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestGetTickers(t *testing.T) { t.Parallel() temp := []string{BTCAUD, LTCAUD, ETHAUD} _, err := b.GetTickers(temp) if err != nil { t.Error(err) } }
explode_data.jsonl/33145
{ "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, 1949, 22213, 388, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 741, 16280, 1669, 3056, 917, 90, 17602, 5049, 4656, 11, 34469, 5049, 4656, 11, 37742, 61278, 532, 197, 6878, 1848, 1669, 293, 2234, 22213, 388, 9758, 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 ]
2
func TestPossibleOverflow(t *testing.T) { delShares := sdk.NewDec(391432570689183511).Quo(sdk.NewDec(40113011844664)) validator := Validator{ OperatorAddress: sdk.ValAddress(pk1.Address().Bytes()), ConsPubKey: pk1, Status: sdk.Bonded, Tokens: sdk.NewInt(2159), DelegatorShares: delShares, } newValidator, _ := validator.AddTokensFromDel(sdk.NewInt(71)) require.False(t, newValidator.DelegatorShares.IsNegative()) require.False(t, newValidator.Tokens.IsNegative()) }
explode_data.jsonl/744
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 219 }
[ 2830, 3393, 65222, 42124, 1155, 353, 8840, 836, 8, 341, 69509, 73015, 1669, 45402, 7121, 4900, 7, 18, 24, 16, 19, 18, 17, 20, 22, 15, 21, 23, 24, 16, 23, 18, 20, 16, 16, 568, 2183, 78, 1141, 7584, 7121, 4900, 7, 19, 15, 16, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestDecryptStringFromAlphabetToIntegerMapping3(t *testing.T) { s := "12345678910#11#12#13#14#15#16#17#18#19#20#21#22#23#24#25#26#" expected := "abcdefghijklmnopqrstuvwxyz" actual := FreqAlphabets(s) assert.Equal(t, expected, actual) }
explode_data.jsonl/79312
{ "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, 89660, 703, 3830, 2101, 18485, 1249, 3486, 6807, 18, 1155, 353, 8840, 836, 8, 341, 1903, 1669, 330, 16, 17, 18, 19, 20, 21, 22, 23, 24, 16, 15, 2, 16, 16, 2, 16, 17, 2, 16, 18, 2, 16, 19, 2, 16, 20, 2, 16, 21...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestParseAsc(t *testing.T) { s := "a=fmtp:97 profile-level-id=1;mode=AAC-hbr;sizelength=13;indexlength=3;indexdeltalength=3; config=1210" f, err := ParseAFmtPBase(s) assert.Equal(t, nil, err) asc, err := ParseAsc(&f) assert.Equal(t, nil, err) assert.Equal(t, []byte{0x12, 0x10}, asc) }
explode_data.jsonl/55595
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 145 }
[ 2830, 3393, 14463, 40103, 1155, 353, 8840, 836, 8, 341, 1903, 1669, 330, 64, 18111, 76, 790, 25, 24, 22, 5526, 11591, 12897, 28, 16, 26, 8516, 46623, 1706, 2832, 1323, 39414, 449, 301, 996, 28, 16, 18, 26, 1252, 4129, 28, 18, 26, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestApp01maVendorHndlrListIndex(t *testing.T) { var err error var td *TestData_App01maVendor //var r string t.Logf("TestVendor.HndlrListIndex()...\n") td = &TestData_App01maVendor{} td.Setup(t) if err != nil { t.Fatalf("Error: Cannot connect: %s\n", err.Error()) } // Issue a request for ???. //TODO: Create a first() request followed by next()'s'. // Check response. /*TODO: Uncomment when requests are actually being performed. r = td.ResponseBody() if r != "" { t.Logf("\t%s\n", r) } */ // Parse response to verify //TODO: Parse the response. t.Logf("TestVendor.HndlrListIndex() - End of Test\n\n\n") }
explode_data.jsonl/78271
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 334 }
[ 2830, 3393, 2164, 15, 16, 1728, 44691, 39, 303, 19018, 852, 1552, 1155, 353, 8840, 836, 8, 341, 262, 762, 1848, 260, 1465, 198, 262, 762, 17941, 688, 353, 83920, 36117, 15, 16, 1728, 44691, 198, 262, 442, 947, 435, 1843, 914, 271, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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