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 Test_UserLogin(t *testing.T) { if testUser == nil || testUser.Id == -1 { t.Skip("Skipping due to previous failure") } u, err := conn.UserLogin(testUser.Name, testUser.Password) if err != nil { t.Fatal(err) } if u == nil { t.Fatal("GetUser() returned a nil user and no error") } compareUsers(testUser, u, t) }
explode_data.jsonl/22011
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 132 }
[ 2830, 3393, 31339, 6231, 1155, 353, 8840, 836, 8, 341, 743, 1273, 1474, 621, 2092, 1369, 1273, 1474, 6444, 621, 481, 16, 341, 197, 3244, 57776, 445, 85945, 4152, 311, 3681, 7901, 1138, 197, 630, 10676, 11, 1848, 1669, 4534, 7344, 6231...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestPresubmitSpec(t *testing.T) { tests := []struct { name string p job.Presubmit refs v1alpha1.Refs expected v1alpha1.LighthouseJobSpec }{ { name: "can override path alias and cloneuri", p: job.Presubmit{ Base: job.Base{ UtilityConfig: job.UtilityConfig{ PathAlias: "foo", CloneURI: "bar", }, }, }, expected: v1alpha1.LighthouseJobSpec{ Type: job.PresubmitJob, Refs: &v1alpha1.Refs{ PathAlias: "foo", CloneURI: "bar", }, }, }, { name: "controller can default path alias and cloneuri", refs: v1alpha1.Refs{ PathAlias: "fancy", CloneURI: "cats", }, expected: v1alpha1.LighthouseJobSpec{ Type: job.PresubmitJob, Refs: &v1alpha1.Refs{ PathAlias: "fancy", CloneURI: "cats", }, }, }, { name: "job overrides take precedence over controller defaults", p: job.Presubmit{ Base: job.Base{ UtilityConfig: job.UtilityConfig{ PathAlias: "foo", CloneURI: "bar", }, }, }, refs: v1alpha1.Refs{ PathAlias: "fancy", CloneURI: "cats", }, expected: v1alpha1.LighthouseJobSpec{ Type: job.PresubmitJob, Refs: &v1alpha1.Refs{ PathAlias: "foo", CloneURI: "bar", }, }, }, { name: "pipeline_run_params are added to lighthouseJobSpec", p: job.Presubmit{ Base: job.Base{ PipelineRunParams: []job.PipelineRunParam{ { Name: "FOO_PARAM", ValueTemplate: "BAR_VALUE", }, }, }, }, refs: v1alpha1.Refs{ PathAlias: "fancy", CloneURI: "cats", }, expected: v1alpha1.LighthouseJobSpec{ Type: job.PresubmitJob, Refs: &v1alpha1.Refs{ PathAlias: "fancy", CloneURI: "cats", }, PipelineRunParams: []job.PipelineRunParam{ { Name: "FOO_PARAM", ValueTemplate: "BAR_VALUE", }, }, }, }, } for _, tc := range tests { actual := PresubmitSpec(tc.p, tc.refs) if expected := tc.expected; !reflect.DeepEqual(actual, expected) { t.Errorf("%s: actual %#v != expected %#v", tc.name, actual, expected) } } }
explode_data.jsonl/51114
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1118 }
[ 2830, 3393, 14367, 392, 1763, 8327, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 3056, 1235, 341, 197, 11609, 257, 914, 198, 197, 3223, 286, 2618, 1069, 416, 392, 1763, 198, 197, 197, 16149, 257, 348, 16, 7141, 16, 2817, 3848, 198, 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 TestStructFiltered(t *testing.T) { p1 := func(ns []byte) bool { if bytes.HasSuffix(ns, []byte("NoTag")) || bytes.HasSuffix(ns, []byte("Required")) { return false } return true } p2 := func(ns []byte) bool { if bytes.HasSuffix(ns, []byte("SubSlice[0].Test")) || bytes.HasSuffix(ns, []byte("SubSlice[0]")) || bytes.HasSuffix(ns, []byte("SubSlice")) || bytes.HasSuffix(ns, []byte("Sub")) || bytes.HasSuffix(ns, []byte("SubIgnore")) || bytes.HasSuffix(ns, []byte("Anonymous")) || bytes.HasSuffix(ns, []byte("Anonymous.A")) { return false } return true } p3 := func(ns []byte) bool { return !bytes.HasSuffix(ns, []byte("SubTest.Test")) } // p4 := []string{ // "A", // } tPartial := &TestPartial{ NoTag: "NoTag", Required: "Required", SubSlice: []*SubTest{ { Test: "Required", }, { Test: "Required", }, }, Sub: &SubTest{ Test: "1", }, SubIgnore: &SubTest{ Test: "", }, Anonymous: struct { A string `validate:"required"` ASubSlice []*SubTest `validate:"required,dive"` SubAnonStruct []struct { Test string `validate:"required"` OtherTest string `validate:"required"` } `validate:"required,dive"` }{ A: "1", ASubSlice: []*SubTest{ { Test: "Required", }, { Test: "Required", }, }, SubAnonStruct: []struct { Test string `validate:"required"` OtherTest string `validate:"required"` }{ {"Required", "RequiredOther"}, {"Required", "RequiredOther"}, }, }, } validate := New() // the following should all return no errors as everything is valid in // the default state errs := validate.StructFilteredCtx(context.Background(), tPartial, p1) Equal(t, errs, nil) errs = validate.StructFiltered(tPartial, p2) Equal(t, errs, nil) // this isn't really a robust test, but is ment to illustrate the ANON CASE below errs = validate.StructFiltered(tPartial.SubSlice[0], p3) Equal(t, errs, nil) // mod tParial for required feild and re-test making sure invalid fields are NOT required: tPartial.Required = "" // inversion and retesting Partial to generate failures: errs = validate.StructFiltered(tPartial, p1) NotEqual(t, errs, nil) AssertError(t, errs, "TestPartial.Required", "TestPartial.Required", "Required", "Required", "required") // reset Required field, and set nested struct tPartial.Required = "Required" tPartial.Anonymous.A = "" // will pass as unset feilds is not going to be tested errs = validate.StructFiltered(tPartial, p1) Equal(t, errs, nil) // will fail as unset feild is tested errs = validate.StructFiltered(tPartial, p2) NotEqual(t, errs, nil) AssertError(t, errs, "TestPartial.Anonymous.A", "TestPartial.Anonymous.A", "A", "A", "required") // reset nested struct and unset struct in slice tPartial.Anonymous.A = "Required" tPartial.SubSlice[0].Test = "" // these will pass as unset item is NOT tested errs = validate.StructFiltered(tPartial, p1) Equal(t, errs, nil) errs = validate.StructFiltered(tPartial, p2) NotEqual(t, errs, nil) AssertError(t, errs, "TestPartial.SubSlice[0].Test", "TestPartial.SubSlice[0].Test", "Test", "Test", "required") Equal(t, len(errs.(ValidationErrors)), 1) // Unset second slice member concurrently to test dive behavior: tPartial.SubSlice[1].Test = "" errs = validate.StructFiltered(tPartial, p1) Equal(t, errs, nil) errs = validate.StructFiltered(tPartial, p2) NotEqual(t, errs, nil) Equal(t, len(errs.(ValidationErrors)), 1) AssertError(t, errs, "TestPartial.SubSlice[0].Test", "TestPartial.SubSlice[0].Test", "Test", "Test", "required") // reset struct in slice, and unset struct in slice in unset posistion tPartial.SubSlice[0].Test = "Required" // these will pass as the unset item is NOT tested errs = validate.StructFiltered(tPartial, p1) Equal(t, errs, nil) errs = validate.StructFiltered(tPartial, p2) Equal(t, errs, nil) tPartial.SubSlice[1].Test = "Required" tPartial.Anonymous.SubAnonStruct[0].Test = "" // these will pass as the unset item is NOT tested errs = validate.StructFiltered(tPartial, p1) Equal(t, errs, nil) errs = validate.StructFiltered(tPartial, p2) Equal(t, errs, nil) dt := time.Now() err := validate.StructFiltered(&dt, func(ns []byte) bool { return true }) NotEqual(t, err, nil) Equal(t, err.Error(), "validator: (nil *time.Time)") }
explode_data.jsonl/77343
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1783 }
[ 2830, 3393, 9422, 67310, 1155, 353, 8840, 836, 8, 1476, 3223, 16, 1669, 2915, 39417, 3056, 3782, 8, 1807, 341, 197, 743, 5820, 16152, 40177, 39417, 11, 3056, 3782, 445, 2753, 5668, 2761, 1369, 5820, 16152, 40177, 39417, 11, 3056, 3782, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestRejectMultipleModelSpecs(t *testing.T) { g := gomega.NewGomegaWithT(t) kfsvc := makeTestKFService() kfsvc.Spec.Default.Predictor.Custom = &CustomSpec{Container: v1.Container{}} g.Expect(kfsvc.ValidateCreate()).Should(gomega.MatchError(ExactlyOnePredictorViolatedError)) }
explode_data.jsonl/7096
{ "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, 78413, 32089, 1712, 8327, 82, 1155, 353, 8840, 836, 8, 341, 3174, 1669, 342, 32696, 7121, 38, 32696, 2354, 51, 1155, 340, 16463, 69, 58094, 1669, 1281, 2271, 65008, 1860, 741, 16463, 69, 58094, 36473, 13275, 1069, 8861, 269,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestTCPResetsSentIncrement(t *testing.T) { c := context.New(t, defaultMTU) defer c.Cleanup() stats := c.Stack().Stats() wq := &waiter.Queue{} ep, err := c.Stack().NewEndpoint(tcp.ProtocolNumber, ipv4.ProtocolNumber, wq) if err != nil { t.Fatalf("NewEndpoint failed: %v", err) } want := stats.TCP.SegmentsSent.Value() + 1 if err := ep.Bind(tcpip.FullAddress{Port: context.StackPort}); err != nil { t.Fatalf("Bind failed: %v", err) } if err := ep.Listen(10); err != nil { t.Fatalf("Listen failed: %v", err) } // Send a SYN request. iss := seqnum.Value(789) c.SendPacket(nil, &context.Headers{ SrcPort: context.TestPort, DstPort: context.StackPort, Flags: header.TCPFlagSyn, SeqNum: iss, }) // Receive the SYN-ACK reply. b := c.GetPacket() tcpHdr := header.TCP(header.IPv4(b).Payload()) c.IRS = seqnum.Value(tcpHdr.SequenceNumber()) ackHeaders := &context.Headers{ SrcPort: context.TestPort, DstPort: context.StackPort, Flags: header.TCPFlagAck, SeqNum: iss + 1, // If the AckNum is not the increment of the last sequence number, a RST // segment is sent back in response. AckNum: c.IRS + 2, } // Send ACK. c.SendPacket(nil, ackHeaders) c.GetPacket() if got := stats.TCP.ResetsSent.Value(); got != want { t.Errorf("got stats.TCP.ResetsSent.Value() = %v, want = %v", got, want) } }
explode_data.jsonl/22276
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 572 }
[ 2830, 3393, 49896, 1061, 1415, 31358, 38311, 1155, 353, 8840, 836, 8, 341, 1444, 1669, 2266, 7121, 1155, 11, 1638, 8505, 52, 340, 16867, 272, 727, 60639, 741, 79659, 1669, 272, 58646, 1005, 16635, 741, 6692, 80, 1669, 609, 11489, 261, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestUnmarshalText(t *testing.T) { var unmarshalCase = struct { input string want List }{ "A list\n" + "======\n" + "- [X] First item\n" + " - [ ] First sub item\n" + " - [ ] Second sub item\n" + "- [ ] Second item\n", List{ &ListItem{ 0, TODO, "A list", []*ListItem{ &ListItem{ 1, DONE, "First item", []*ListItem{ &ListItem{ 2, TODO, "First sub item", nil, }, &ListItem{ 3, TODO, "Second sub item", nil, }, }, }, &ListItem{ 4, TODO, "Second item", nil, }, }, }, }, } var l List err := l.UnmarshalText([]byte(unmarshalCase.input)) if err != nil { t.Fatal(err) } want := unmarshalCase.want if l.rootItem.id != want.rootItem.id { t.Fatalf("Expected root item id to be %d, was %d", want.rootItem.id, l.rootItem.id) } if l.rootItem.desc != want.rootItem.desc { t.Fatalf("Exptected root item desc to be '%v', was '%v'", want.rootItem.desc, l.rootItem.desc) } if len(l.rootItem.items) != len(want.rootItem.items) { t.Fatalf("Exptected root item to have %d children, had %d", len(want.rootItem.items), len(l.rootItem.items)) } }
explode_data.jsonl/69493
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 690 }
[ 2830, 3393, 1806, 27121, 1178, 1155, 353, 8840, 836, 8, 341, 2405, 650, 27121, 4207, 284, 2036, 341, 197, 22427, 914, 198, 197, 50780, 220, 1759, 198, 197, 59403, 197, 197, 29133, 1140, 1699, 1, 3610, 298, 197, 1, 45347, 59, 77, 1, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestIntDataPoint_LabelsMap(t *testing.T) { ms := NewIntDataPoint() assert.EqualValues(t, NewStringMap(), ms.LabelsMap()) fillTestStringMap(ms.LabelsMap()) testValLabelsMap := generateTestStringMap() assert.EqualValues(t, testValLabelsMap, ms.LabelsMap()) }
explode_data.jsonl/32712
{ "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, 1072, 1043, 2609, 53557, 82, 2227, 1155, 353, 8840, 836, 8, 341, 47691, 1669, 1532, 1072, 1043, 2609, 741, 6948, 12808, 6227, 1155, 11, 1532, 703, 2227, 1507, 9829, 4679, 82, 2227, 2398, 65848, 2271, 703, 2227, 35680, 4679, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestUnmarshalBinary(t *testing.T) { input := []byte(`{ "B": "AAEqQQ=="}`) var av DynamoDBAttributeValue err := json.Unmarshal(input, &av) assert.Nil(t, err) assert.Equal(t, DataTypeBinary, av.DataType()) assert.Equal(t, "AAEqQQ==", base64.StdEncoding.EncodeToString(av.Binary())) }
explode_data.jsonl/61693
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 132 }
[ 2830, 3393, 1806, 27121, 21338, 1155, 353, 8840, 836, 8, 341, 22427, 1669, 3056, 3782, 5809, 90, 330, 33, 788, 330, 6029, 27312, 48026, 11036, 5541, 692, 2405, 1822, 71813, 3506, 78554, 198, 9859, 1669, 2951, 38097, 5384, 11, 609, 402, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestSet_Walk(t *testing.T) { gtest.C(t, func(t *gtest.T) { var set gset.Set set.Add(g.Slice{1, 2}...) set.Walk(func(item interface{}) interface{} { return gconv.Int(item) + 10 }) t.Assert(set.Size(), 2) t.Assert(set.Contains(11), true) t.Assert(set.Contains(12), true) }) }
explode_data.jsonl/34399
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 146 }
[ 2830, 3393, 1649, 2763, 1692, 1155, 353, 8840, 836, 8, 341, 3174, 1944, 727, 1155, 11, 2915, 1155, 353, 82038, 836, 8, 341, 197, 2405, 738, 342, 746, 4202, 198, 197, 8196, 1904, 3268, 95495, 90, 16, 11, 220, 17, 92, 31218, 197, 81...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestNameSuggestions_SuggestName(t *testing.T) { tests := map[string]struct { nameSuggestions NameSuggestions expectedName string expectedSuccess bool }{ "good suggestion from first": { nameSuggestions: []NameSuggester{&suggestWith{"foo", true}, &suggestWith{"", false}}, expectedName: "foo", expectedSuccess: true, }, "good suggestion from second": { nameSuggestions: []NameSuggester{&suggestWith{"foo", false}, &suggestWith{"bar", true}}, expectedName: "bar", expectedSuccess: true, }, "no good suggestions": { nameSuggestions: []NameSuggester{&suggestWith{"foo", false}, &suggestWith{"bar", false}}, expectedName: "", expectedSuccess: false, }, "nil suggestion": { nameSuggestions: []NameSuggester{nil, &suggestWith{"bar", true}}, expectedName: "bar", expectedSuccess: true, }, } for name, test := range tests { suggestedName, success := test.nameSuggestions.SuggestName() if suggestedName != test.expectedName { t.Errorf("%s expected name %s but recieved %s", name, test.expectedName, suggestedName) } if success != test.expectedSuccess { t.Errorf("%s expected success condition %t but recieved %t", name, test.expectedSuccess, success) } } }
explode_data.jsonl/17588
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 443 }
[ 2830, 3393, 675, 98846, 1098, 3799, 675, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 2415, 14032, 60, 1235, 341, 197, 11609, 98846, 3988, 98846, 198, 197, 42400, 675, 262, 914, 198, 197, 42400, 7188, 1807, 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, 1...
4
func TestLinuxConnSetBuffers(t *testing.T) { c, s := testLinuxConn(t, nil) n := uint32(64) if err := c.SetReadBuffer(int(n)); err != nil { t.Fatalf("failed to set read buffer size: %v", err) } if err := c.SetWriteBuffer(int(n)); err != nil { t.Fatalf("failed to set write buffer size: %v", err) } l := uint32(unsafe.Sizeof(n)) want := []setSockopt{ { level: unix.SOL_SOCKET, name: unix.SO_RCVBUF, v: n, l: l, }, { level: unix.SOL_SOCKET, name: unix.SO_SNDBUF, v: n, l: l, }, } if got := s.setSockopt; !reflect.DeepEqual(want, got) { t.Fatalf("unexpected socket options:\n- want: %v\n- got: %v", want, got) } }
explode_data.jsonl/33498
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 345 }
[ 2830, 3393, 46324, 9701, 1649, 36219, 1155, 353, 8840, 836, 8, 341, 1444, 11, 274, 1669, 1273, 46324, 9701, 1155, 11, 2092, 692, 9038, 1669, 2622, 18, 17, 7, 21, 19, 692, 743, 1848, 1669, 272, 4202, 4418, 4095, 1548, 1445, 5905, 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...
4
func TestAsJSON(t *testing.T) { r, err := Prepare(mocks.NewRequest(), AsJSON()) if err != nil { fmt.Printf("ERROR: %v", err) } if r.Header.Get(headerContentType) != mimeTypeJSON { t.Fatalf("autorest: AsJSON failed to add header (%s=%s)", headerContentType, r.Header.Get(headerContentType)) } }
explode_data.jsonl/20948
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 124 }
[ 2830, 3393, 2121, 5370, 1155, 353, 8840, 836, 8, 972, 7000, 11, 1848, 1669, 31166, 1255, 25183, 75274, 1507, 1634, 5370, 13116, 743, 1848, 961, 2092, 972, 197, 11009, 19367, 445, 3682, 25, 1018, 85, 497, 1848, 1218, 197, 1771, 743, 43...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestSubnet(t *testing.T) { c := &cache{} ip1234, ip2234, ip3234 := net.IP{1, 2, 3, 4}, net.IP{2, 2, 3, 4}, net.IP{3, 2, 3, 4} req := (&dns.Msg{}).SetQuestion("example.com.", dns.TypeA) t.Run("empty", func(t *testing.T) { ci, expired, key := c.getWithSubnet(req, &net.IPNet{ IP: ip1234, Mask: net.CIDRMask(24, netutil.IPv4BitLen), }) assert.False(t, expired) assert.Nil(t, key) assert.Nil(t, ci) }) item := &cacheItem{ u: testUpsAddr, } // Add a response with subnet. resp := (&dns.Msg{ MsgHdr: dns.MsgHdr{ Response: true, }, Answer: []dns.RR{newRR(t, "example.com. 1 IN A 1.1.1.1")}, }).SetQuestion("example.com.", dns.TypeA) item.m = resp c.setWithSubnet(item, &net.IPNet{IP: ip1234, Mask: net.CIDRMask(16, netutil.IPv4BitLen)}) t.Run("different_ip", func(t *testing.T) { ci, expired, key := c.getWithSubnet(req, &net.IPNet{ IP: ip2234, Mask: net.CIDRMask(24, netutil.IPv4BitLen), }) assert.False(t, expired) assert.Equal(t, msgToKeyWithSubnet(req, ip2234, 0), key) require.Nil(t, ci) }) // Add a response entry with subnet #2. resp = (&dns.Msg{ MsgHdr: dns.MsgHdr{ Response: true, }, Answer: []dns.RR{newRR(t, "example.com. 1 IN A 2.2.2.2")}, }).SetQuestion("example.com.", dns.TypeA) item.m = resp c.setWithSubnet(item, &net.IPNet{IP: ip2234, Mask: net.CIDRMask(16, netutil.IPv4BitLen)}) // Add a response entry without subnet. resp = (&dns.Msg{ MsgHdr: dns.MsgHdr{ Response: true, }, Answer: []dns.RR{newRR(t, "example.com. 1 IN A 3.3.3.3")}, }).SetQuestion("example.com.", dns.TypeA) item.m = resp c.setWithSubnet(item, &net.IPNet{IP: nil, Mask: nil}) t.Run("with_subnet_1", func(t *testing.T) { ci, expired, key := c.getWithSubnet(req, &net.IPNet{ IP: ip1234, Mask: net.CIDRMask(24, netutil.IPv4BitLen), }) assert.False(t, expired) assert.Equal(t, msgToKeyWithSubnet(req, ip1234, 16), key) require.NotNil(t, ci) require.NotNil(t, ci.m) require.NotEmpty(t, ci.m.Answer) a, ok := ci.m.Answer[0].(*dns.A) require.True(t, ok) assert.True(t, a.A.Equal(net.IP{1, 1, 1, 1})) }) t.Run("with_subnet_2", func(t *testing.T) { ci, expired, key := c.getWithSubnet(req, &net.IPNet{ IP: ip2234, Mask: net.CIDRMask(24, netutil.IPv4BitLen), }) assert.False(t, expired) assert.Equal(t, msgToKeyWithSubnet(req, ip2234, 16), key) require.NotNil(t, ci) require.NotNil(t, ci.m) require.NotEmpty(t, ci.m.Answer) a, ok := ci.m.Answer[0].(*dns.A) require.True(t, ok) assert.True(t, a.A.Equal(net.IP{2, 2, 2, 2})) }) t.Run("with_subnet_3", func(t *testing.T) { ci, expired, key := c.getWithSubnet(req, &net.IPNet{ IP: ip3234, Mask: net.CIDRMask(24, netutil.IPv4BitLen), }) assert.False(t, expired) assert.Equal(t, msgToKeyWithSubnet(req, ip1234, 0), key) require.NotNil(t, ci) require.NotNil(t, ci.m) require.NotEmpty(t, ci.m.Answer) a, ok := ci.m.Answer[0].(*dns.A) require.True(t, ok) assert.True(t, a.A.Equal(net.IP{3, 3, 3, 3})) }) }
explode_data.jsonl/18912
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1510 }
[ 2830, 3393, 3136, 4711, 1155, 353, 8840, 836, 8, 341, 1444, 1669, 609, 9360, 16094, 46531, 16, 17, 18, 19, 11, 5997, 17, 17, 18, 19, 11, 5997, 18, 17, 18, 19, 1669, 4179, 46917, 90, 16, 11, 220, 17, 11, 220, 18, 11, 220, 19, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func Test_parseTimeout(t *testing.T) { type args struct { timeout string } tests := []struct { name string args args want time.Duration }{ { name: "Check parseTimeout, invalid duration, return default value", args: args{ timeout: "", }, want: time.Second * 3, }, { name: "Check parseTimeout, parse duration success", args: args{ timeout: "140s", }, want: time.Second * 140, }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { if got := parseTimeout(tt.args.timeout); !reflect.DeepEqual(got, tt.want) { t.Errorf("parseTimeout() = %v, want %v", got, tt.want) } }) } }
explode_data.jsonl/7686
{ "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, 21039, 7636, 1155, 353, 8840, 836, 8, 341, 13158, 2827, 2036, 341, 197, 78395, 914, 198, 197, 532, 78216, 1669, 3056, 1235, 341, 197, 11609, 914, 198, 197, 31215, 2827, 198, 197, 50780, 882, 33795, 198, 197, 59403, 197, 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...
2
func TestGetCapabilities(t *testing.T) { log.Println("Test GetCapabilities") res, err := testDevice.GetCapabilities() if err != nil { t.Error(err) } js := prettyJSON(&res) fmt.Println(js) }
explode_data.jsonl/60354
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 78 }
[ 2830, 3393, 1949, 55315, 1155, 353, 8840, 836, 8, 341, 6725, 12419, 445, 2271, 2126, 55315, 5130, 10202, 11, 1848, 1669, 1273, 6985, 2234, 55315, 741, 743, 1848, 961, 2092, 341, 197, 3244, 6141, 3964, 340, 197, 630, 95636, 1669, 5020, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestCleanupCgroupDeletedError(t *testing.T) { ctrl := gomock.NewController(t) defer ctrl.Finish() mockControl := mock_control.NewMockControl(ctrl) cgroupRoot := fmt.Sprintf("/ecs/%s", taskID) err := cgroups.ErrCgroupDeleted wrappedErr := fmt.Errorf("cgroup remove: unable to obtain controller: %w", err) // check that the wrapped err unwraps to cgroups.ErrCgroupDeleted assert.True(t, errors.Is(wrappedErr, cgroups.ErrCgroupDeleted)) mockControl.EXPECT().Remove(gomock.Any()).Return(wrappedErr) cgroupResource := NewCgroupResource("taskArn", mockControl, nil, cgroupRoot, cgroupMountPath, specs.LinuxResources{}) // the ErrCgroupDeleted is caught and logs a warning, returns no error assert.NoError(t, cgroupResource.Cleanup()) }
explode_data.jsonl/68162
{ "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, 67335, 34, 4074, 26039, 1454, 1155, 353, 8840, 836, 8, 341, 84381, 1669, 342, 316, 1176, 7121, 2051, 1155, 340, 16867, 23743, 991, 18176, 2822, 77333, 3273, 1669, 7860, 13436, 7121, 11571, 3273, 62100, 340, 1444, 4074, 8439, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestChangelog(t *testing.T) { typeMap := map[string]string{ "foo": "Foo", } cl := New(typeMap, func(commit *repository.Commit) string { return fmt.Sprintf("%s\n", commit.Subject) }) commits := []*repository.Commit{ { Subject: "test1", Type: "foo", }, { Subject: "test2", Type: "", }, { Subject: "test3", Type: "", }, { Subject: "test4", Type: "foo", }, } version := semver.MustParse("2.1.3-rc123") log := cl.Create(commits, version) formattedLog := fmt.Sprintf(mylog, time.Now().Format("2006-01-02")) if log != formattedLog { t.Fatalf("changelog did not match\nexpected\n%#v\ngot\n%#v\n", formattedLog, log) } }
explode_data.jsonl/68095
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 324 }
[ 2830, 3393, 1143, 61873, 1155, 353, 8840, 836, 8, 341, 13158, 2227, 1669, 2415, 14032, 30953, 515, 197, 197, 1, 7975, 788, 330, 40923, 756, 197, 532, 39407, 1669, 1532, 5808, 2227, 11, 2915, 69570, 353, 23319, 53036, 8, 914, 341, 197,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestStressTestUDP(t *testing.T) { loggerFactory := logging.NewDefaultLoggerFactory() log := loggerFactory.NewLogger("test") t.Run("lan to wan", func(t *testing.T) { tt := test.TimeOut(30 * time.Second) defer tt.Stop() // WAN with a nic (net0) wan, err := NewRouter(&RouterConfig{ CIDR: "1.2.3.0/24", QueueSize: 1000, LoggerFactory: loggerFactory, }) assert.NoError(t, err, "should succeed") assert.NotNil(t, wan, "should succeed") net0 := NewNet(&NetConfig{ StaticIPs: []string{demoIP}, }) err = wan.AddNet(net0) assert.NoError(t, err, "should succeed") // LAN with a nic (net1) lan, err := NewRouter(&RouterConfig{ CIDR: "192.168.0.0/24", QueueSize: 1000, LoggerFactory: loggerFactory, }) assert.NoError(t, err, "should succeed") assert.NotNil(t, lan, "should succeed") net1 := NewNet(&NetConfig{}) err = lan.AddNet(net1) assert.NoError(t, err, "should succeed") err = wan.AddRouter(lan) assert.NoError(t, err, "should succeed") err = wan.Start() assert.NoError(t, err, "should succeed") defer func() { err = wan.Stop() assert.NoError(t, err, "should succeed") }() // Find IP address for net0 ifs, err := net0.Interfaces() if !assert.NoError(t, err, "should succeed") { return } log.Debugf("num ifs: %d", len(ifs)) var echoServerIP net.IP loop: for _, ifc := range ifs { log.Debugf("flags: %v", ifc.Flags) if ifc.Flags&net.FlagUp == 0 { continue } if ifc.Flags&net.FlagLoopback != 0 { continue } addrs, err2 := ifc.Addrs() if !assert.NoError(t, err2, "should succeed") { return } log.Debugf("num addrs: %d", len(addrs)) for _, addr := range addrs { log.Debugf("addr: %s", addr.String()) switch addr := addr.(type) { case *net.IPNet: echoServerIP = addr.IP break loop case *net.IPAddr: echoServerIP = addr.IP break loop } } } if !assert.NotNil(t, echoServerIP, "should have IP address") { return } log.Debugf("echo server IP: %s", echoServerIP.String()) // Set up an echo server on WAN conn0, err := net0.ListenPacket( "udp4", fmt.Sprintf("%s:0", echoServerIP)) if !assert.NoError(t, err, "should succeed") { return } doneCh0 := make(chan struct{}) go func() { buf := make([]byte, 1500) for { n, from, err2 := conn0.ReadFrom(buf) if err2 != nil { break } // echo back _, err2 = conn0.WriteTo(buf[:n], from) if err2 != nil { break } } close(doneCh0) }() var wg sync.WaitGroup runEchoTest := func() { // Set up a client var numRecvd int const numToSend int = 400 const pktSize int = 1200 conn1, err2 := net0.ListenPacket("udp4", "0.0.0.0:0") if !assert.NoError(t, err2, "should succeed") { return } doneCh1 := make(chan struct{}) go func() { buf := make([]byte, 1500) for { n, _, err3 := conn1.ReadFrom(buf) if err3 != nil { break } if n != pktSize { break } numRecvd++ } close(doneCh1) }() buf := make([]byte, pktSize) to := conn0.LocalAddr() for i := 0; i < numToSend; i++ { _, err3 := conn1.WriteTo(buf, to) assert.NoError(t, err3, "should succeed") time.Sleep(10 * time.Millisecond) } time.Sleep(time.Second) err2 = conn1.Close() assert.NoError(t, err2, "should succeed") <-doneCh1 // allow some packet loss assert.True(t, numRecvd >= numToSend*8/10, "majority should received") if numRecvd < numToSend { log.Infof("lost %d packets", numToSend-numRecvd) } wg.Done() } // Run echo tests concurrently for i := 0; i < 20; i++ { wg.Add(1) go runEchoTest() } wg.Wait() err = conn0.Close() assert.NoError(t, err, "should succeed") }) }
explode_data.jsonl/20476
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1795 }
[ 2830, 3393, 623, 673, 2271, 41648, 1155, 353, 8840, 836, 8, 341, 17060, 4153, 1669, 8392, 7121, 3675, 7395, 4153, 741, 6725, 1669, 5925, 4153, 7121, 7395, 445, 1944, 5130, 3244, 16708, 445, 10715, 311, 77753, 497, 2915, 1155, 353, 8840,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestUpdateMD5Cache(t *testing.T) { assert.Equal(t, maputil.LengthOfSyncMap(cache), int64(0)) cInfo := model.NewConfigInfo("linna", "DEFAULT_GROUP", "gdiamond", time.Now()) UpdateMD5Cache(cInfo) assert.Equal(t, maputil.LengthOfSyncMap(cache), int64(1)) }
explode_data.jsonl/81837
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 102 }
[ 2830, 3393, 4289, 6076, 20, 8233, 1155, 353, 8840, 836, 8, 341, 6948, 12808, 1155, 11, 2415, 1314, 6833, 2124, 12154, 2227, 31933, 701, 526, 21, 19, 7, 15, 1171, 1444, 1731, 1669, 1614, 7121, 2648, 1731, 445, 3732, 3376, 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, 1...
1
func TestClient_IndexBridges(t *testing.T) { t.Parallel() app, cleanup := cltest.NewApplication(t, cltest.EthMockRegisterChainID) defer cleanup() require.NoError(t, app.Start()) bt1 := &models.BridgeType{ Name: models.MustNewTaskType("testingbridges1"), URL: cltest.WebURL(t, "https://testing.com/bridges"), Confirmations: 0, } err := app.GetStore().CreateBridgeType(bt1) require.NoError(t, err) bt2 := &models.BridgeType{ Name: models.MustNewTaskType("testingbridges2"), URL: cltest.WebURL(t, "https://testing.com/bridges"), Confirmations: 0, } err = app.GetStore().CreateBridgeType(bt2) require.NoError(t, err) client, r := app.NewClientAndRenderer() require.Nil(t, client.IndexBridges(cltest.EmptyCLIContext())) bridges := *r.Renders[0].(*[]models.BridgeType) require.Equal(t, 2, len(bridges)) assert.Equal(t, bt1.Name, bridges[0].Name) }
explode_data.jsonl/78848
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 382 }
[ 2830, 3393, 2959, 50361, 33, 1869, 4188, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 2822, 28236, 11, 21290, 1669, 1185, 1944, 7121, 4988, 1155, 11, 1185, 1944, 5142, 339, 11571, 8690, 18837, 915, 340, 16867, 21290, 741, 17957, 356...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestWaitWithTimeoutTimesOut(t *testing.T) { wg := sync.WaitGroup{} wg.Add(1) // this will time out as wg.Done() is never called result := waitWithTimeout(&wg, 1*time.Millisecond) assert.Equal(t, result, true) }
explode_data.jsonl/59643
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 85 }
[ 2830, 3393, 14190, 2354, 7636, 18889, 2662, 1155, 353, 8840, 836, 8, 341, 72079, 1669, 12811, 28384, 2808, 16094, 72079, 1904, 7, 16, 340, 197, 322, 419, 686, 882, 700, 438, 63581, 60422, 368, 374, 2581, 2598, 198, 9559, 1669, 3783, 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
func TestMaxLength(t *testing.T) { GenerateValuesAsYaml(t, "maxLength.test.schema.json", func(console *tests.ConsoleWrapper, donec chan struct{}) { defer close(donec) // Test boolean type console.ExpectString("Enter a value for stringValue") console.SendLine("iamlongerthan10") console.ExpectString("Sorry, your reply was invalid: value is too long. Max length is 10") console.ExpectString("Enter a value for stringValue") console.SendLine("short") console.ExpectEOF() }) }
explode_data.jsonl/61757
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 178 }
[ 2830, 3393, 35601, 1155, 353, 8840, 836, 8, 341, 197, 31115, 6227, 2121, 56, 9467, 1155, 11, 330, 60992, 5958, 30892, 4323, 756, 197, 29244, 52818, 353, 23841, 46298, 11542, 11, 2814, 66, 26023, 2036, 28875, 341, 298, 16867, 3265, 34232...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_cancelOnErr(t *testing.T) { type args struct { ctx context.Context errs chan error err error } tests := []struct { name string args args cancelMocker *cancelMocker }{ { name: "error occured", args: args{ ctx: context.Background(), errs: make(chan error), err: ErrNoCondition, }, cancelMocker: &cancelMocker{ shouldBeCalled: true, wasCalled: make(chan bool, 1), }, }, { name: "ctx done", args: args{ ctx: canceledCtx(), errs: make(chan error), }, cancelMocker: &cancelMocker{ shouldBeCalled: false, }, }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { h := &ProjectionHandler{} go h.cancelOnErr(tt.args.ctx, tt.args.errs, tt.cancelMocker.mockCancel) if tt.args.err != nil { tt.args.errs <- tt.args.err } tt.cancelMocker.check(t) }) } }
explode_data.jsonl/81374
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 452 }
[ 2830, 3393, 28895, 1925, 7747, 1155, 353, 8840, 836, 8, 341, 13158, 2827, 2036, 341, 197, 20985, 220, 2266, 9328, 198, 197, 9859, 82, 26023, 1465, 198, 197, 9859, 220, 1465, 198, 197, 532, 78216, 1669, 3056, 1235, 341, 197, 11609, 260...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestValidateCloudWatchEventRuleName(t *testing.T) { validNames := []string{ "HelloWorl_d", "hello-world", "hello.World0125", } for _, v := range validNames { _, errors := validateCloudWatchEventRuleName(v, "name") if len(errors) != 0 { t.Fatalf("%q should be a valid CW event rule name: %q", v, errors) } } invalidNames := []string{ "special@character", "slash/in-the-middle", // Length > 64 "TooLooooooooooooooooooooooooooooooooooooooooooooooooooooooongName", } for _, v := range invalidNames { _, errors := validateCloudWatchEventRuleName(v, "name") if len(errors) == 0 { t.Fatalf("%q should be an invalid CW event rule name", v) } } }
explode_data.jsonl/78559
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 258 }
[ 2830, 3393, 17926, 16055, 14247, 1556, 11337, 675, 1155, 353, 8840, 836, 8, 341, 56322, 7980, 1669, 3056, 917, 515, 197, 197, 1, 9707, 54, 269, 75, 814, 756, 197, 197, 1, 14990, 30084, 756, 197, 197, 1, 14990, 44435, 15, 16, 17, 2...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
5
func TestListPresubmit(t *testing.T) { c := &Config{ JobConfig: JobConfig{ Presubmits: map[string][]Presubmit{ "r1": { { Name: "a", RunAfterSuccess: []Presubmit{ {Name: "aa"}, {Name: "ab"}, }, }, {Name: "b"}, }, "r2": { { Name: "c", RunAfterSuccess: []Presubmit{ {Name: "ca"}, {Name: "cb"}, }, }, {Name: "d"}, }, }, Postsubmits: map[string][]Postsubmit{ "r1": {{Name: "e"}}, }, Periodics: []Periodic{ {Name: "f"}, }, }, } var testcases = []struct { name string expected []string repos []string }{ { "all presubmits", []string{"a", "aa", "ab", "b", "c", "ca", "cb", "d"}, []string{}, }, { "r2 presubmits", []string{"c", "ca", "cb", "d"}, []string{"r2"}, }, } for _, tc := range testcases { actual := c.AllPresubmits(tc.repos) if len(actual) != len(tc.expected) { t.Fatalf("test %s - Wrong number of jobs. Got %v, expected %v", tc.name, actual, tc.expected) } for _, j1 := range tc.expected { found := false for _, j2 := range actual { if j1 == j2.Name { found = true break } } if !found { t.Errorf("test %s - Did not find job %s in output", tc.name, j1) } } } }
explode_data.jsonl/36539
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 691 }
[ 2830, 3393, 852, 14367, 392, 1763, 1155, 353, 8840, 836, 8, 341, 1444, 1669, 609, 2648, 515, 197, 197, 12245, 2648, 25, 12011, 2648, 515, 298, 10025, 416, 392, 44703, 25, 2415, 14032, 45725, 14367, 392, 1763, 515, 571, 197, 1, 81, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestWorkloadBool(t *testing.T) { for name, ct := range map[string]oracleColumnType{ "charB1": charB1, "charB1Null": charB1Null, "charC1": charC1, "charC1Null": charC1Null, } { t.Run(name, func(t *testing.T) { t.Parallel() //enableLogging(t) defer setC1Bool()() testWorkload(ct, t) }) } }
explode_data.jsonl/48073
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 168 }
[ 2830, 3393, 6776, 1078, 11233, 1155, 353, 8840, 836, 8, 341, 2023, 829, 11, 20251, 1669, 2088, 2415, 14032, 60, 69631, 62438, 515, 197, 197, 1, 1762, 33, 16, 788, 257, 1161, 33, 16, 345, 197, 197, 1, 1762, 33, 16, 3280, 788, 1161,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestReinterpretSign(t *testing.T) { for _, tt := range []struct { unsigned uint64 length uint8 signed int64 }{ // -1, byte aligned {unsigned: 0xf, length: 4, signed: -1}, {unsigned: 0xff, length: 8, signed: -1}, {unsigned: 0xfff, length: 12, signed: -1}, {unsigned: 0xffff, length: 16, signed: -1}, {unsigned: 0xfffff, length: 20, signed: -1}, {unsigned: 0xffffff, length: 24, signed: -1}, {unsigned: 0xfffffff, length: 28, signed: -1}, {unsigned: 0xffffffff, length: 32, signed: -1}, {unsigned: 0xfffffffff, length: 36, signed: -1}, {unsigned: 0xffffffffff, length: 40, signed: -1}, {unsigned: 0xfffffffffff, length: 44, signed: -1}, {unsigned: 0xffffffffffff, length: 48, signed: -1}, {unsigned: 0xfffffffffffff, length: 52, signed: -1}, {unsigned: 0xffffffffffffff, length: 56, signed: -1}, {unsigned: 0xfffffffffffffff, length: 60, signed: -1}, {unsigned: 0xffffffffffffffff, length: 64, signed: -1}, // 3 bits {unsigned: 0x0, length: 3, signed: 0}, {unsigned: 0x1, length: 3, signed: 1}, {unsigned: 0x2, length: 3, signed: 2}, {unsigned: 0x3, length: 3, signed: 3}, {unsigned: 0x4, length: 3, signed: -4}, {unsigned: 0x5, length: 3, signed: -3}, {unsigned: 0x6, length: 3, signed: -2}, {unsigned: 0x7, length: 3, signed: -1}, // 4 bits {unsigned: 0x0, length: 4, signed: 0}, {unsigned: 0x1, length: 4, signed: 1}, {unsigned: 0x2, length: 4, signed: 2}, {unsigned: 0x3, length: 4, signed: 3}, {unsigned: 0x4, length: 4, signed: 4}, {unsigned: 0x5, length: 4, signed: 5}, {unsigned: 0x6, length: 4, signed: 6}, {unsigned: 0x7, length: 4, signed: 7}, {unsigned: 0x8, length: 4, signed: -8}, {unsigned: 0x9, length: 4, signed: -7}, {unsigned: 0xa, length: 4, signed: -6}, {unsigned: 0xb, length: 4, signed: -5}, {unsigned: 0xc, length: 4, signed: -4}, {unsigned: 0xd, length: 4, signed: -3}, {unsigned: 0xe, length: 4, signed: -2}, {unsigned: 0xf, length: 4, signed: -1}, } { tt := tt t.Run(fmt.Sprintf("%+v", tt), func(t *testing.T) { assert.Equal(t, tt.signed, AsSigned(tt.unsigned, tt.length)) assert.Equal(t, tt.unsigned, AsUnsigned(tt.signed, tt.length)) assert.Equal(t, tt.signed, AsSigned(AsUnsigned(tt.signed, tt.length), tt.length)) assert.Equal(t, tt.unsigned, AsUnsigned(AsSigned(tt.unsigned, tt.length), tt.length)) }) } }
explode_data.jsonl/51628
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1018 }
[ 2830, 3393, 693, 16897, 7264, 1155, 353, 8840, 836, 8, 341, 2023, 8358, 17853, 1669, 2088, 3056, 1235, 341, 197, 9955, 2622, 21, 19, 198, 197, 49046, 256, 2622, 23, 198, 197, 1903, 1542, 256, 526, 21, 19, 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...
1
func TestStcp(t *testing.T) { assert := assert.New(t) // Normal addr := fmt.Sprintf("127.0.0.1:%d", consts.TEST_STCP_FRP_PORT) res, err := util.SendTcpMsg(addr, consts.TEST_STCP_ECHO_STR) if assert.NoError(err) { assert.Equal(consts.TEST_STCP_ECHO_STR, res) } // Encrytion and compression addr = fmt.Sprintf("127.0.0.1:%d", consts.TEST_STCP_EC_FRP_PORT) res, err = util.SendTcpMsg(addr, consts.TEST_STCP_ECHO_STR) if assert.NoError(err) { assert.Equal(consts.TEST_STCP_ECHO_STR, res) } }
explode_data.jsonl/79663
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 240 }
[ 2830, 3393, 623, 4672, 1155, 353, 8840, 836, 8, 341, 6948, 1669, 2060, 7121, 1155, 340, 197, 322, 18437, 198, 53183, 1669, 8879, 17305, 445, 16, 17, 22, 13, 15, 13, 15, 13, 16, 7533, 67, 497, 95432, 73501, 2402, 7123, 14220, 47, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestGetRef(t *testing.T) { testCases := []struct { name string githubResponse []byte expectedSHA string expectedError string expectedErrorType error }{ { name: "single ref", githubResponse: []byte(`{"object": {"sha":"abcde"}}`), expectedSHA: "abcde", }, { name: "multiple refs, no match", githubResponse: []byte(` [ { "ref": "refs/heads/feature-a", "node_id": "MDM6UmVmcmVmcy9oZWFkcy9mZWF0dXJlLWE=", "url": "https://api.github.com/repos/octocat/Hello-World/git/refs/heads/feature-a", "object": { "type": "commit", "sha": "aa218f56b14c9653891f9e74264a383fa43fefbd", "url": "https://api.github.com/repos/octocat/Hello-World/git/commits/aa218f56b14c9653891f9e74264a383fa43fefbd" } }, { "ref": "refs/heads/feature-b", "node_id": "MDM6UmVmcmVmcy9oZWFkcy9mZWF0dXJlLWI=", "url": "https://api.github.com/repos/octocat/Hello-World/git/refs/heads/feature-b", "object": { "type": "commit", "sha": "612077ae6dffb4d2fbd8ce0cccaa58893b07b5ac", "url": "https://api.github.com/repos/octocat/Hello-World/git/commits/612077ae6dffb4d2fbd8ce0cccaa58893b07b5ac" } } ]`), expectedError: "query for org/repo ref \"heads/branch\" didn't match one but multiple refs: [refs/heads/feature-a refs/heads/feature-b]", expectedErrorType: GetRefTooManyResultsError{}, }, { name: "multiple refs with match", githubResponse: []byte(` [ { "ref": "refs/heads/branch", "node_id": "MDM6UmVmcmVmcy9oZWFkcy9mZWF0dXJlLWE=", "url": "https://api.github.com/repos/octocat/Hello-World/git/refs/heads/feature-a", "object": { "type": "commit", "sha": "aa218f56b14c9653891f9e74264a383fa43fefbd", "url": "https://api.github.com/repos/octocat/Hello-World/git/commits/aa218f56b14c9653891f9e74264a383fa43fefbd" } }, { "ref": "refs/heads/feature-b", "node_id": "MDM6UmVmcmVmcy9oZWFkcy9mZWF0dXJlLWI=", "url": "https://api.github.com/repos/octocat/Hello-World/git/refs/heads/feature-b", "object": { "type": "commit", "sha": "612077ae6dffb4d2fbd8ce0cccaa58893b07b5ac", "url": "https://api.github.com/repos/octocat/Hello-World/git/commits/612077ae6dffb4d2fbd8ce0cccaa58893b07b5ac" } } ]`), expectedSHA: "aa218f56b14c9653891f9e74264a383fa43fefbd", }, } for _, tc := range testCases { t.Run(tc.name, func(t *testing.T) { ts := httptest.NewTLSServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { w.WriteHeader(200) if r.Method != http.MethodGet { t.Errorf("Bad method: %s", r.Method) } expectedPath := "/repos/org/repo/git/refs/heads/branch" if r.URL.Path != expectedPath { t.Errorf("expected path %s, got path %s", expectedPath, r.URL.Path) } w.Write(tc.githubResponse) })) defer ts.Close() c := getClient(ts.URL) var errMsg string sha, err := c.GetRef("org", "repo", "heads/branch") if err != nil { errMsg = err.Error() } if errMsg != tc.expectedError { t.Fatalf("expected error %q, got error %q", tc.expectedError, err) } if !errors.Is(err, tc.expectedErrorType) { t.Errorf("expected error of type %T, got %T", tc.expectedErrorType, err) } if sha != tc.expectedSHA { t.Errorf("expected sha %q, got sha %q", tc.expectedSHA, sha) } }) } }
explode_data.jsonl/6255
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1663 }
[ 2830, 3393, 1949, 3945, 1155, 353, 8840, 836, 8, 341, 18185, 37302, 1669, 3056, 1235, 341, 197, 11609, 1060, 914, 198, 197, 3174, 3827, 2582, 262, 3056, 3782, 198, 197, 42400, 33145, 981, 914, 198, 197, 42400, 1454, 257, 914, 198, 197...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestRuntime_WithContext(t *testing.T) { // setup types _engine, err := New(&Setup{ Driver: constants.DriverDocker, }) if err != nil { t.Errorf("unable to create runtime engine: %v", err) } // nolint: staticcheck,revive // ignore using string with context value want := context.WithValue(context.Background(), key, _engine) // run test got := WithContext(context.Background(), _engine) if !reflect.DeepEqual(got, want) { t.Errorf("WithContext is %v, want %v", got, want) } }
explode_data.jsonl/32851
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 172 }
[ 2830, 3393, 15123, 62, 91101, 1155, 353, 8840, 836, 8, 341, 197, 322, 6505, 4494, 198, 197, 24823, 11, 1848, 1669, 1532, 2099, 21821, 515, 197, 10957, 5469, 25, 18021, 41768, 35, 13659, 345, 197, 3518, 743, 1848, 961, 2092, 341, 197, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestExactOutput(t *testing.T) { ctx, cancel := context.WithTimeout(context.Background(), defaultTestTimeout) defer cancel() testCases := []struct { desc string cmdLine string expectFile string }{ { desc: "gen plugin e2e", cmdLine: "gen plugin e2e --kube-conformance-image-version=v123.456.789", expectFile: "testdata/gen-plugin-e2e", }, { desc: "gen plugin e2e respects configmap", cmdLine: "gen plugin e2e --kube-conformance-image-version=v123.456.789 --configmap=testdata/tiny-configmap.yaml", expectFile: "testdata/gen-plugin-e2e-configmap", }, } for _, tc := range testCases { t.Run(tc.desc, func(t *testing.T) { output := mustRunSonobuoyCommandWithContext(ctx, t, tc.cmdLine) if *update { if err := os.WriteFile(tc.expectFile, output.Bytes(), 0666); err != nil { t.Fatalf("Failed to update goldenfile: %v", err) } } else { fileData, err := ioutil.ReadFile(tc.expectFile) if err != nil { t.Fatalf("Failed to read golden file %v: %v", tc.expectFile, err) } if !bytes.Equal(fileData, output.Bytes()) { t.Errorf("Expected manifest to equal goldenfile: %v but instead got:\n\n%v", tc.expectFile, output.String()) } } }) } }
explode_data.jsonl/68654
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 541 }
[ 2830, 3393, 57954, 5097, 1155, 353, 8840, 836, 8, 341, 20985, 11, 9121, 1669, 2266, 26124, 7636, 5378, 19047, 1507, 1638, 2271, 7636, 340, 16867, 9121, 2822, 18185, 37302, 1669, 3056, 1235, 341, 197, 41653, 981, 914, 198, 197, 25920, 24...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestCreateMigrationsNoNamespace(t *testing.T) { cmdArgs := []string{"create", "migrations", "-c", "clusterPair1", "migration1"} expected := "error: Need to provide atleast one namespace to migrate" testCommon(t, cmdArgs, nil, expected, true) }
explode_data.jsonl/18254
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 83 }
[ 2830, 3393, 4021, 44, 17824, 2753, 22699, 1155, 353, 8840, 836, 8, 341, 25920, 4117, 1669, 3056, 917, 4913, 3182, 497, 330, 76, 17824, 497, 6523, 66, 497, 330, 18855, 12443, 16, 497, 330, 80227, 16, 63159, 42400, 1669, 330, 841, 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 TestFloat32Min(t *testing.T) { assert := assert.New(t) var verr error var val float32 = 10.0 verr = Float32(&val).Min(1)() assert.Nil(verr) val = 10.0 verr = Float32(&val).Min(10)() assert.Nil(verr) verr = Float32(nil).Min(10)() assert.NotNil(verr) assert.Nil(ErrValue(verr)) assert.Equal(ErrFloat32Min, ErrCause(verr)) val = 1.0 verr = Float32(&val).Min(10)() assert.NotNil(verr) assert.NotNil(ErrValue(verr)) assert.Equal(ErrFloat32Min, ErrCause(verr)) val = 10.0 verr = Float32(&val).Min(10)() assert.Nil(verr) }
explode_data.jsonl/11542
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 256 }
[ 2830, 3393, 5442, 18, 17, 6217, 1155, 353, 8840, 836, 8, 341, 6948, 1669, 2060, 7121, 1155, 692, 2405, 71467, 1465, 198, 2405, 1044, 2224, 18, 17, 284, 220, 16, 15, 13, 15, 198, 197, 423, 81, 284, 13001, 18, 17, 2099, 831, 568, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestJWT(t *testing.T) { th := NewTokenHandler("thesecret", "issuer") token, err := th.Create("username", 1*time.Hour, "namespace1", "namespace2") require.NoError(t, err) assert.NotEmpty(t, token) u, err := th.Validate(token) require.NoError(t, err) assert.Equal(t, u.Username, "username") assert.Equal(t, u.Namespaces, []string{"namespace1", "namespace2"}) assert.Equal(t, u.Kind, MachineToken) assert.True(t, u.ExpiresAt.After(time.Now())) }
explode_data.jsonl/70676
{ "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, 55172, 1155, 353, 8840, 836, 8, 341, 70479, 1669, 1532, 3323, 3050, 445, 6375, 50856, 497, 330, 66817, 5130, 43947, 11, 1848, 1669, 270, 7251, 445, 5113, 497, 220, 16, 77053, 73550, 11, 330, 2231, 16, 497, 330, 2231, 17, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestLoadGraphToElastic_somePkgsDontExist(t *testing.T) { const ( pkgpath = "github.com/korfuri/goref/testprograms/simple" simple = "v1@0@github.com/korfuri/goref/testprograms/simple" fmt = "v1@0@fmt" ) client := &mocks.Client{} // There are many other packages loaded transitively by // fmt. Let's say they already exist. client.On("GetPackage", mock.Anything, mock.MatchedBy(func(x string) bool { return (x != simple && x != fmt) })).Return(&elastic.GetResult{}, nil) // fmt and simple don't exist for this test. client.On("GetPackage", mock.Anything, simple).Return(nil, errors.New("not found")) client.On("GetPackage", mock.Anything, fmt).Return(nil, errors.New("not found")) // Creating packages, files and refs always works client.On("CreatePackage", mock.Anything, mock.Anything).Times(2).Return(nil) client.On("CreateFile", mock.Anything, mock.Anything).Return(&elastic.IndexResponse{}, nil) client.On("CreateRef", mock.Anything, mock.Anything).Return(&elastic.IndexResponse{}, nil) pg := goref.NewPackageGraph(goref.ConstantVersion(0)) pg.LoadPackages([]string{pkgpath}, false) assert.NoError(t, elasticsearch.LoadGraphToElastic(*pg, client)) }
explode_data.jsonl/54348
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 409 }
[ 2830, 3393, 5879, 11212, 1249, 36, 51179, 61855, 58415, 5857, 35, 544, 25613, 1155, 353, 8840, 836, 8, 341, 4777, 2399, 197, 3223, 7351, 2343, 284, 330, 5204, 905, 14109, 32842, 6070, 4846, 46752, 12697, 72953, 67195, 698, 197, 1903, 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...
2
func TestClient(t *testing.T) { confPath := "../config/collector_example.yaml" conf, err := config.NewCollectorConfig(confPath, "yaml") if err != nil { t.Error(err.Error()) return } wg.Add(2) go testLogClient(filepath.Join(conf.LogPath, "output.log")) go testRPCClient(conf) wg.Wait() }
explode_data.jsonl/73752
{ "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, 2959, 1155, 353, 8840, 836, 8, 341, 67850, 1820, 1669, 7005, 1676, 14, 91469, 39304, 33406, 698, 67850, 11, 1848, 1669, 2193, 7121, 53694, 2648, 29879, 1820, 11, 330, 41466, 1138, 743, 1848, 961, 2092, 341, 197, 3244, 6141, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestNewService(t *testing.T) { options := Opts{ SecretReader: token.SecretFunc(func(string) (string, error) { return "secret", nil }), TokenDuration: time.Hour, CookieDuration: time.Hour * 24, Issuer: "my-test-app", URL: "http://127.0.0.1:8089", AvatarStore: avatar.NewLocalFS("/tmp"), Logger: logger.Std, } svc := NewService(options) assert.NotNil(t, svc) assert.NotNil(t, svc.TokenService()) assert.NotNil(t, svc.AvatarProxy()) }
explode_data.jsonl/34037
{ "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, 3564, 1860, 1155, 353, 8840, 836, 8, 1476, 35500, 1669, 506, 12754, 515, 197, 7568, 50856, 5062, 25, 256, 3950, 74779, 9626, 18552, 3609, 8, 320, 917, 11, 1465, 8, 314, 470, 330, 20474, 497, 2092, 11973, 197, 33299, 12945,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestUnmapTableId(t *testing.T) { e := Engine{prefix: []byte("e-prefix.")} dbID, tableID, err := e.unmapTableID(nil) require.ErrorIs(t, err, ErrIllegalMappedKey) require.Zero(t, dbID) require.Zero(t, tableID) dbID, tableID, err = e.unmapTableID([]byte( "e-prefix.CTL.TABLE.a", )) require.ErrorIs(t, err, ErrCorruptedData) require.Zero(t, dbID) require.Zero(t, tableID) dbID, tableID, err = e.unmapTableID(append( []byte("e-prefix.CTL.TABLE."), 0x01, 0x02, 0x03, 0x04, 0x11, 0x12, 0x13, 0x14, )) require.NoError(t, err) require.EqualValues(t, 0x01020304, dbID) require.EqualValues(t, 0x11121314, tableID) }
explode_data.jsonl/64093
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 293 }
[ 2830, 3393, 1806, 2186, 2556, 764, 1155, 353, 8840, 836, 8, 341, 7727, 1669, 8200, 90, 11849, 25, 3056, 3782, 445, 68, 67181, 38739, 630, 20939, 915, 11, 1965, 915, 11, 1848, 1669, 384, 6307, 2186, 2556, 915, 27907, 340, 17957, 6141, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestIntegerExpressionGT_EQ(t *testing.T) { assertClauseSerialize(t, table1ColInt.GT_EQ(table2ColInt), "(table1.col_int >= table2.col_int)") assertClauseSerialize(t, table1ColInt.GT_EQ(Int(11)), "(table1.col_int >= $1)", int64(11)) }
explode_data.jsonl/41452
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 100 }
[ 2830, 3393, 3486, 9595, 25388, 9168, 1155, 353, 8840, 836, 8, 341, 6948, 28482, 15680, 1155, 11, 1965, 16, 6127, 1072, 1224, 51, 9168, 15761, 17, 6127, 1072, 701, 11993, 2005, 16, 13414, 4042, 2604, 1965, 17, 13414, 4042, 19107, 6948, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestDefaultMapper(t *testing.T) { // default mapper should be no-op var tests = map[string]string{ "": "", "foo": "foo", "foo_bar": "foo_bar", "FooBar": "FooBar", "FOOBAR": "FOOBAR", } for i, e := range tests { if v := Mapper(i); v != e { t.Errorf("Mapper(\"%s\"): expected %s, got %s", i, e, v) } } }
explode_data.jsonl/65313
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 172 }
[ 2830, 3393, 3675, 10989, 1155, 353, 8840, 836, 8, 341, 197, 322, 1638, 24501, 1265, 387, 902, 29492, 198, 2405, 7032, 284, 2415, 14032, 30953, 515, 197, 197, 28796, 286, 8324, 197, 197, 1, 7975, 788, 257, 330, 7975, 756, 197, 197, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestShutdown(t *testing.T) { resetVariables() defer checkVariables(t) flag.Set("enable_buffer", "true") defer resetFlagsForTesting() b := New() // Buffer one request. stopped1 := issueRequest(context.Background(), t, b, failoverErr) if err := waitForRequestsInFlight(b, 1); err != nil { t.Fatal(err) } // Shutdown buffer and unblock buffered request immediately. b.Shutdown() // Request must have been drained without an error. if err := <-stopped1; err != nil { t.Fatalf("request should have been buffered and not returned an error: %v", err) } if err := waitForPoolSlots(b, *size); err != nil { t.Fatal(err) } }
explode_data.jsonl/55865
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 227 }
[ 2830, 3393, 62004, 1155, 353, 8840, 836, 8, 341, 70343, 22678, 741, 16867, 1779, 22678, 1155, 692, 30589, 4202, 445, 12552, 7776, 497, 330, 1866, 1138, 16867, 7585, 9195, 2461, 16451, 741, 2233, 1669, 1532, 2822, 197, 322, 10312, 825, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
4
func TestGetWatchResource(t *testing.T) { r, _ := http.NewRequest("GET", "/", nil) req := restful.NewRequest(r) getNewTank = operator.GetMockTankNewFunc(&operator.MockTank{}) request := newReqWatch(req) defer request.exit() if _, err := request.get(); err != nil { t.Errorf("get() failed! err: %v", err) } }
explode_data.jsonl/24144
{ "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, 1949, 14247, 4783, 1155, 353, 8840, 836, 8, 341, 7000, 11, 716, 1669, 1758, 75274, 445, 3806, 497, 64657, 2092, 340, 24395, 1669, 2732, 1262, 75274, 2601, 692, 10366, 3564, 66033, 284, 5675, 2234, 11571, 66033, 3564, 9626, 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 TestFetchMessagesSecondPollingError(t *testing.T) { ctrl := gomock.NewController(t) defer ctrl.Finish() ch := randomChannelID(t) keys := keyOfChannel(ch) sl := domain.SubscriberLocator{ChannelID: ch, SubscriberID: "sbsc-1"} s, redisCmd, dispatcher := newMockedRedisStorageAndPubSubDispatcher(ctrl) // (1st fetchMessagesNow) MGET clock cursor clocksMget1 := redisCmd.EXPECT().MGet(gomock.Any(), keys.Clock(), keys.SubscriberCursor(sl.SubscriberID)).Return(strPList(t, "10", "10"), nil) // (1st fetchMessagesNow) MGET (no messages) bodyMget1 := redisCmd.EXPECT().MGet(gomock.Any()).Return(nil, nil).Do(func(ctx context.Context, keys ...string) { dispatcher.Resolve(s.redisPubSubKeyOf(ch)) }).After(clocksMget1) // (2nd fetchMessagesNow) MGET clock cursor errorToReturn := errors.New("Mocked redis error") redisCmd.EXPECT().MGet(gomock.Any(), keys.Clock(), keys.SubscriberCursor(sl.SubscriberID)).Return(nil, errorToReturn).After(bodyMget1) _, _, _, err := s.FetchMessages(context.Background(), sl, 100, domain.Duration{Duration: 3 * time.Second}) dspstesting.IsError(t, errorToReturn, err) assert.Contains(t, err.Error(), "FetchMessages failed due to Redis error (cursor MGET error)") }
explode_data.jsonl/51712
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 450 }
[ 2830, 3393, 20714, 15820, 15666, 49207, 287, 1454, 1155, 353, 8840, 836, 8, 341, 84381, 1669, 342, 316, 1176, 7121, 2051, 1155, 340, 16867, 23743, 991, 18176, 2822, 23049, 1669, 4194, 9629, 915, 1155, 340, 80112, 1669, 1376, 2124, 9629, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestInodeIdsGarbageCollection(t *testing.T) { runTestNoQfs(t, func(test *testHelper) { ids := newInodeIds(time.Millisecond, 100*time.Millisecond) c := test.newCtx() allocated := make([]InodeId, 100, 100) for i := 0; i < 100; i++ { allocated[i] = newInodeId(c, ids) } for i := 0; i < 100; i++ { ids.releaseInodeId(c, allocated[i]) } time.Sleep(time.Millisecond * 10) func() { defer ids.lock.Lock().Unlock() test.Assert(ids.highMark == 104, "Garbage collection happened too soon") }() time.Sleep(time.Millisecond * 100) // go through all the ids and ensure that we garbage collected for i := 0; i < 90; i++ { newInodeId(c, ids) } func() { defer ids.lock.Lock().Unlock() test.Assert(ids.highMark == 94, "Garbage collection happened too soon") }() test.Assert(newInodeId(c, ids) == 94, "inodeIds didn't resume counting after GC") }) }
explode_data.jsonl/1827
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 396 }
[ 2830, 3393, 641, 534, 12701, 43930, 20652, 6482, 1155, 353, 8840, 836, 8, 341, 56742, 2271, 2753, 48, 3848, 1155, 11, 2915, 8623, 353, 1944, 5511, 8, 341, 197, 197, 3365, 1669, 501, 641, 534, 12701, 9730, 71482, 11, 220, 16, 15, 15,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestBuildTrafficConfiguration_EmptyConfiguration(t *testing.T) { expected := &Config{ Targets: map[string]RevisionTargets{}, Configurations: map[string]*v1.Configuration{ emptyConfig.Name: emptyConfig, }, Revisions: map[string]*v1.Revision{}, } expectedErr := errUnreadyConfiguration(emptyConfig) if tc, err := BuildTrafficConfiguration(configLister, revLister, testRouteWithTrafficTargets(WithSpecTraffic(v1.TrafficTarget{ ConfigurationName: emptyConfig.Name, Percent: ptr.Int64(100), }))); err != nil && expectedErr.Error() != err.Error() { t.Errorf("Expected error %v, saw %v", expectedErr, err) } else if got, want := tc, expected; !cmp.Equal(want, got, cmpOpts...) { t.Errorf("Unexpected traffic diff (-want +got): %v", cmp.Diff(want, got, cmpOpts...)) } }
explode_data.jsonl/17618
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 297 }
[ 2830, 3393, 11066, 87229, 7688, 76060, 1595, 7688, 1155, 353, 8840, 836, 8, 341, 42400, 1669, 609, 2648, 515, 197, 197, 49030, 25, 2415, 14032, 60, 33602, 49030, 38837, 197, 66156, 21449, 25, 2415, 14032, 8465, 85, 16, 17334, 515, 298, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
4
func Test_ErrCouldNotInitialiseMigrationsTable_RollbackError(t *testing.T) { err := ErrCouldNotCreateMigrationsTable{ RollbackError: errors.New("rollback failed"), Wrapped: errors.New("the root cause"), } assert.Equal(t, "error rolling back after failed migrations initialisation, rollback error: rollback failed (the root cause)", err.Error()) }
explode_data.jsonl/55397
{ "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, 93623, 12895, 2623, 6341, 1064, 44, 17824, 2556, 2568, 965, 1419, 1454, 1155, 353, 8840, 836, 8, 341, 9859, 1669, 15495, 12895, 2623, 4021, 44, 17824, 2556, 515, 197, 11143, 965, 1419, 1454, 25, 5975, 7121, 445, 33559, 4641,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestData(t *testing.T) { f := mbtest.NewEventsFetcher(t, getConfig()) err := mbtest.WriteEvents(f, t) if err != nil { t.Fatal("write", err) } }
explode_data.jsonl/33192
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 69 }
[ 2830, 93200, 1155, 353, 8840, 836, 8, 341, 1166, 1669, 10016, 1944, 7121, 7900, 97492, 1155, 11, 66763, 2398, 9859, 1669, 10016, 1944, 4073, 7900, 955, 11, 259, 340, 743, 1848, 961, 2092, 341, 197, 3244, 26133, 445, 4934, 497, 1848, 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 ]
2
func TestParse(t *testing.T) { var books = make(map[string]interface{}) err := json.Unmarshal( []byte(`{ "store" : { "book" : [ { "category" : "reference" , "category.sub" : "quotes" , "author" : "Nigel Rees" , "title" : "Saying of the Century" , "price" : 8.95 } , { "category" : "fiction" , "author" : "Evelyn Waugh" , "title" : "Sword of Honor" , "price" : 12.99 } , { "category" : "fiction" , "author" : "Herman Melville" , "title" : "Moby Dick" , "isbn" : "0-553-21311-3" , "price" : 8.99 } , { "category" : "fiction" , "author" : "J. R. R. Tolkien" , "title" : "The Lord of the Rings" , "isbn" : "0-395-19395-8" , "price" : 22.99 } ] , "bicycle" : { "color" : "red" , "price" : 19.95 } } }`), &books, ) if err != nil { t.Fatal("Test Cast Parse error: ", err) return } testcases := []struct { t string expected interface{} perr error err error }{ { t: "$..author", expected: []interface{}{"Nigel Rees", "Evelyn Waugh", "Herman Melville", "J. R. R. Tolkien"}, }, { t: "store.bicycle", expected: map[string]interface{}{ "color": "red", "price": 19.95, }, }, { t: "store.bicycle.*", expected: []interface{}{ "red", 19.95, }, }, { t: "store.bicycle.@", expected: []interface{}{ "color", "price", }, }, { t: "store.book[0]", expected: map[string]interface{}{ "category": "reference", "category.sub": "quotes", "author": "Nigel Rees", "title": "Saying of the Century", "price": 8.95, }, }, { t: "store.book[0]*", expected: []interface{}{ "Nigel Rees", "reference", "quotes", 8.95, "Saying of the Century", }, }, { t: "store.book..isbn", expected: []interface{}{ "0-553-21311-3", "0-395-19395-8", }, }, { t: "store..isbn", expected: []interface{}{ "0-553-21311-3", "0-395-19395-8", }, }, { t: "store..[\"category.sub\"]", expected: []interface{}{ "quotes", }, }, { t: "..author..", expected: []interface{}{"Nigel Rees", "Evelyn Waugh", "Herman Melville", "J. R. R. Tolkien"}, }, { t: "store.book[?(@.price < 10)]", expected: []interface{}{map[string]interface{}{ "category": "reference", "category.sub": "quotes", "author": "Nigel Rees", "title": "Saying of the Century", "price": 8.95, }, map[string]interface{}{ "category": "fiction", "author": "Herman Melville", "title": "Moby Dick", "isbn": "0-553-21311-3", "price": 8.99, }, }, }, { t: `store.book[?(@.category == reference)]`, expected: []interface{}{map[string]interface{}{ "category": "reference", "category.sub": "quotes", "author": "Nigel Rees", "title": "Saying of the Century", "price": 8.95, }, }, }, } for i, test := range testcases { a, err := Parse(test.t) if err != test.perr { t.Errorf(`[%03d] Parse("%v") = %T, %v ; expected err to be %v`, i, test.t, a, err, test.perr) continue } ev, err := a.Apply(books) if err != test.err { t.Errorf(`[%03d] %v a.Apply(books) = %T, %v ; expected err to be %v`, i, test.t, ev, err, test.err) continue } evs := fmt.Sprintf("“%v”", ev) tevs := fmt.Sprintf("“%v”", test.expected) if !reflect.DeepEqual(ev, test.expected) { t.Errorf(`[%03d] a.Apply(books) = %v, nil ; expected to be %v`, i, evs, tevs) } } }
explode_data.jsonl/27829
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1954 }
[ 2830, 3393, 14463, 1155, 353, 8840, 836, 8, 341, 2405, 6467, 284, 1281, 9147, 14032, 31344, 37790, 9859, 1669, 2951, 38097, 1006, 197, 197, 1294, 3782, 5809, 90, 330, 4314, 1, 6260, 220, 314, 330, 2190, 1, 6260, 262, 508, 314, 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...
6
func TestAdmission(t *testing.T) { namespaceObj := &api.Namespace{ ObjectMeta: api.ObjectMeta{ Name: "test", Namespace: "", }, Status: api.NamespaceStatus{ Phase: api.NamespaceActive, }, } store := cache.NewStore(cache.MetaNamespaceKeyFunc) store.Add(namespaceObj) fakeWatch := watch.NewFake() mockClient := &testclient.Fake{} mockClient.AddWatchReactor("*", testclient.DefaultWatchReactor(fakeWatch, nil)) mockClient.AddReactor("get", "namespaces", func(action testclient.Action) (bool, runtime.Object, error) { if getAction, ok := action.(testclient.GetAction); ok && getAction.GetName() == namespaceObj.Name { return true, namespaceObj, nil } return true, nil, fmt.Errorf("No result for action %v", action) }) mockClient.AddReactor("list", "namespaces", func(action testclient.Action) (bool, runtime.Object, error) { return true, &api.NamespaceList{Items: []api.Namespace{*namespaceObj}}, nil }) lfhandler := NewLifecycle(mockClient).(*lifecycle) lfhandler.store = store handler := admission.NewChainHandler(lfhandler) pod := api.Pod{ ObjectMeta: api.ObjectMeta{Name: "123", Namespace: namespaceObj.Name}, Spec: api.PodSpec{ Volumes: []api.Volume{{Name: "vol"}}, Containers: []api.Container{{Name: "ctr", Image: "image"}}, }, } badPod := api.Pod{ ObjectMeta: api.ObjectMeta{Name: "456", Namespace: "doesnotexist"}, Spec: api.PodSpec{ Volumes: []api.Volume{{Name: "vol"}}, Containers: []api.Container{{Name: "ctr", Image: "image"}}, }, } err := handler.Admit(admission.NewAttributesRecord(&pod, "Pod", pod.Namespace, pod.Name, "pods", "", admission.Create, nil)) if err != nil { t.Errorf("Unexpected error returned from admission handler: %v", err) } // change namespace state to terminating namespaceObj.Status.Phase = api.NamespaceTerminating store.Add(namespaceObj) // verify create operations in the namespace cause an error err = handler.Admit(admission.NewAttributesRecord(&pod, "Pod", pod.Namespace, pod.Name, "pods", "", admission.Create, nil)) if err == nil { t.Errorf("Expected error rejecting creates in a namespace when it is terminating") } // verify update operations in the namespace can proceed err = handler.Admit(admission.NewAttributesRecord(&pod, "Pod", pod.Namespace, pod.Name, "pods", "", admission.Update, nil)) if err != nil { t.Errorf("Unexpected error returned from admission handler: %v", err) } // verify delete operations in the namespace can proceed err = handler.Admit(admission.NewAttributesRecord(nil, "Pod", pod.Namespace, pod.Name, "pods", "", admission.Delete, nil)) if err != nil { t.Errorf("Unexpected error returned from admission handler: %v", err) } // verify delete of namespace default can never proceed err = handler.Admit(admission.NewAttributesRecord(nil, "Namespace", "", api.NamespaceDefault, "namespaces", "", admission.Delete, nil)) if err == nil { t.Errorf("Expected an error that this namespace can never be deleted") } // verify delete of namespace other than default can proceed err = handler.Admit(admission.NewAttributesRecord(nil, "Namespace", "", "other", "namespaces", "", admission.Delete, nil)) if err != nil { t.Errorf("Did not expect an error %v", err) } // verify create/update/delete of object in non-existant namespace throws error err = handler.Admit(admission.NewAttributesRecord(&badPod, "Pod", badPod.Namespace, badPod.Name, "pods", "", admission.Create, nil)) if err == nil { t.Errorf("Expected an aerror that objects cannot be created in non-existant namespaces", err) } err = handler.Admit(admission.NewAttributesRecord(&badPod, "Pod", badPod.Namespace, badPod.Name, "pods", "", admission.Update, nil)) if err == nil { t.Errorf("Expected an aerror that objects cannot be updated in non-existant namespaces", err) } err = handler.Admit(admission.NewAttributesRecord(&badPod, "Pod", badPod.Namespace, badPod.Name, "pods", "", admission.Delete, nil)) if err == nil { t.Errorf("Expected an aerror that objects cannot be deleted in non-existant namespaces", err) } }
explode_data.jsonl/2953
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1357 }
[ 2830, 3393, 2589, 2728, 1155, 353, 8840, 836, 8, 341, 56623, 5261, 1669, 609, 2068, 46011, 515, 197, 23816, 12175, 25, 6330, 80222, 515, 298, 21297, 25, 414, 330, 1944, 756, 298, 90823, 25, 8324, 197, 197, 1583, 197, 58321, 25, 6330, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestAliasesOfAliases(t *testing.T) { Set("Title", "Checking Case") RegisterAlias("Foo", "Bar") RegisterAlias("Bar", "Title") assert.Equal(t, "Checking Case", Get("FOO")) }
explode_data.jsonl/5566
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 68 }
[ 2830, 3393, 95209, 2124, 95209, 1155, 353, 8840, 836, 8, 341, 22212, 445, 3851, 497, 330, 40129, 11538, 1138, 79096, 22720, 445, 40923, 497, 330, 3428, 1138, 79096, 22720, 445, 3428, 497, 330, 3851, 1138, 6948, 12808, 1155, 11, 330, 401...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestReaderLatestInclusiveHasNext(t *testing.T) { client, err := NewClient(ClientOptions{ URL: lookupURL, }) assert.Nil(t, err) defer client.Close() topic := newTopicName() ctx := context.Background() // create reader on the last message (inclusive) reader0, err := client.CreateReader(ReaderOptions{ Topic: topic, StartMessageID: LatestMessageID(), StartMessageIDInclusive: true, }) assert.Nil(t, err) defer reader0.Close() assert.False(t, reader0.HasNext()) // create producer producer, err := client.CreateProducer(ProducerOptions{ Topic: topic, DisableBatching: true, }) assert.Nil(t, err) defer producer.Close() // send 10 messages var lastMsgID MessageID for i := 0; i < 10; i++ { lastMsgID, err = producer.Send(ctx, &ProducerMessage{ Payload: []byte(fmt.Sprintf("hello-%d", i)), }) assert.NoError(t, err) assert.NotNil(t, lastMsgID) } // create reader on the last message (inclusive) reader, err := client.CreateReader(ReaderOptions{ Topic: topic, StartMessageID: LatestMessageID(), StartMessageIDInclusive: true, }) assert.Nil(t, err) defer reader.Close() if reader.HasNext() { msg, err := reader.Next(context.Background()) assert.NoError(t, err) assert.Equal(t, []byte("hello-9"), msg.Payload()) } }
explode_data.jsonl/46068
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 538 }
[ 2830, 3393, 5062, 31992, 641, 8336, 10281, 5847, 1155, 353, 8840, 836, 8, 341, 25291, 11, 1848, 1669, 1532, 2959, 46851, 3798, 515, 197, 79055, 25, 18615, 3144, 345, 197, 8824, 6948, 59678, 1155, 11, 1848, 340, 16867, 2943, 10421, 2822,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestGameServerPatch(t *testing.T) { fixture := &GameServer{ObjectMeta: metav1.ObjectMeta{Name: "lucy"}, Spec: GameServerSpec{Container: "goat"}} delta := fixture.DeepCopy() delta.Spec.Container = "bear" patch, err := fixture.Patch(delta) assert.Nil(t, err) assert.Contains(t, string(patch), `{"op":"replace","path":"/spec/container","value":"bear"}`) }
explode_data.jsonl/19637
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 133 }
[ 2830, 3393, 4868, 5475, 43622, 1155, 353, 8840, 836, 8, 341, 1166, 12735, 1669, 609, 4868, 5475, 90, 1190, 12175, 25, 77520, 16, 80222, 63121, 25, 330, 75, 1754, 88, 7115, 197, 7568, 992, 25, 4050, 5475, 8327, 90, 4502, 25, 330, 334...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestGetResourcesNoPolicy(t *testing.T) { const appStream = ` { "services": [ { "name": "erp" } ] } ` preparePolicyDataInStore([]byte(appStream), t) evaluator, err := NewWithStore(conf, testPS) if err != nil { t.Errorf("Unable to initialize evaluator due to error [%v].", err) return } subject := adsapi.Subject{ Principals: []*adsapi.Principal{ &adsapi.Principal{ Type: adsapi.PRINCIPAL_TYPE_USER, Name: "bill", }, }, } var resources []pms.Permission resources, err = evaluator.GetAllGrantedPermissions(adsapi.RequestContext{Subject: &subject, ServiceName: "erp"}) if err != nil { t.Errorf("Unexcepted error happened [%v].", err) return } if len(resources) > 0 { t.Fatalf("No resource should be returned, but returned %q.", resources) return } }
explode_data.jsonl/48854
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 330 }
[ 2830, 3393, 1949, 11277, 2753, 13825, 1155, 353, 8840, 836, 8, 341, 4777, 906, 3027, 284, 22074, 197, 515, 197, 197, 1, 12779, 788, 2278, 197, 197, 515, 298, 197, 31486, 788, 330, 22632, 698, 197, 197, 532, 197, 197, 921, 197, 532, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
4
func TestLocale(t *testing.T) { trans := New() expected := "os_RU" if trans.Locale() != expected { t.Errorf("Expected '%s' Got '%s'", expected, trans.Locale()) } }
explode_data.jsonl/74460
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 71 }
[ 2830, 3393, 19231, 1155, 353, 8840, 836, 8, 1476, 72453, 1669, 1532, 741, 42400, 1669, 330, 436, 2568, 52, 1837, 743, 1356, 59094, 368, 961, 3601, 341, 197, 3244, 13080, 445, 18896, 7677, 82, 6, 24528, 7677, 82, 22772, 3601, 11, 1356,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestSimultaneousDHCPClients(t *testing.T) { // clientLinkEPs are the endpoints on which to inject packets to the client. var clientLinkEPs [2]endpoint // Synchronize the clients using a "barrier" on the server's replies to them. var mu struct { sync.Mutex buffered int } cond := sync.Cond{L: &mu.Mutex} serverLinkEP := endpoint{ onWritePacket: func(b *stack.PacketBuffer) *stack.PacketBuffer { mu.Lock() mu.buffered++ for mu.buffered < len(clientLinkEPs) { cond.Wait() } mu.Unlock() return b }, } serverStack := createTestStack() addEndpointToStack(t, []tcpip.Address{serverAddr}, testNICID, serverStack, &serverLinkEP) for i := range clientLinkEPs { serverLinkEP.remote = append(serverLinkEP.remote, &clientLinkEPs[i]) clientLinkEPs[i].remote = append(clientLinkEPs[i].remote, &serverLinkEP) } errs := make(chan error) defer close(errs) defer func() { for range clientLinkEPs { if err := <-errs; !errors.Is(err, context.Canceled) { t.Error(err) } } }() ctx, cancel := context.WithCancel(context.Background()) defer cancel() clientStack := createTestStack() for i := range clientLinkEPs { clientNICID := tcpip.NICID(i + 1) addEndpointToStack(t, nil, clientNICID, clientStack, &clientLinkEPs[i]) c := newZeroJitterClient(clientStack, clientNICID, linkAddr1, defaultAcquireTimeout, defaultBackoffTime, defaultRetransTime, nil) info := c.Info() go func() { _, err := acquire(ctx, c, t.Name(), &info) errs <- err }() } if _, err := newEPConnServer(ctx, serverStack, defaultClientAddrs, defaultServerCfg); err != nil { t.Fatalf("newEPConnServer failed: %s", err) } }
explode_data.jsonl/20573
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 647 }
[ 2830, 3393, 14027, 494, 17666, 35, 22455, 4872, 7041, 1155, 353, 8840, 836, 8, 341, 197, 322, 2943, 3939, 9197, 82, 525, 279, 36342, 389, 892, 311, 15551, 27035, 311, 279, 2943, 624, 2405, 2943, 3939, 9197, 82, 508, 17, 60, 32540, 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 TestCRIImagesFsStats(t *testing.T) { var ( imageFsMountpoint = "/test/mount/point" imageFsInfo = getTestFsInfo(2000) imageFsUsage = makeFakeImageFsUsage(imageFsMountpoint) ) var ( mockCadvisor = new(cadvisortest.Mock) mockRuntimeCache = new(kubecontainertest.MockRuntimeCache) mockPodManager = new(kubepodtest.MockManager) resourceAnalyzer = new(fakeResourceAnalyzer) fakeRuntimeService = critest.NewFakeRuntimeService() fakeImageService = critest.NewFakeImageService() fakeLogStatsProvider = NewFakeLogMetricsService(nil) ) mockCadvisor.On("GetDirFsInfo", imageFsMountpoint).Return(imageFsInfo, nil) fakeImageService.SetFakeFilesystemUsage([]*runtimeapi.FilesystemUsage{ imageFsUsage, }) provider := NewCRIStatsProvider( mockCadvisor, resourceAnalyzer, mockPodManager, mockRuntimeCache, fakeRuntimeService, fakeImageService, fakeLogStatsProvider, &kubecontainertest.FakeOS{}, ) stats, err := provider.ImageFsStats() assert := assert.New(t) assert.NoError(err) assert.Equal(imageFsUsage.Timestamp, stats.Time.UnixNano()) assert.Equal(imageFsInfo.Available, *stats.AvailableBytes) assert.Equal(imageFsInfo.Capacity, *stats.CapacityBytes) assert.Equal(imageFsInfo.InodesFree, stats.InodesFree) assert.Equal(imageFsInfo.Inodes, stats.Inodes) assert.Equal(imageFsUsage.UsedBytes.Value, *stats.UsedBytes) assert.Equal(imageFsUsage.InodesUsed.Value, *stats.InodesUsed) mockCadvisor.AssertExpectations(t) }
explode_data.jsonl/7536
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 579 }
[ 2830, 3393, 34, 4305, 14228, 48300, 16635, 1155, 353, 8840, 836, 8, 341, 2405, 2399, 197, 31426, 48300, 16284, 2768, 284, 3521, 1944, 3183, 629, 14, 2768, 698, 197, 31426, 48300, 1731, 981, 284, 633, 2271, 48300, 1731, 7, 17, 15, 15, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestDBConfig_Success(t *testing.T) { assert := assertlib.New(t) globalConfig := viper.New() _ = os.Setenv("", "myself") globalConfig.Set("database.collation", "stuff") _ = os.Setenv("ALGOREA_DATABASE__TLSCONFIG", "v99") // env var which was not defined before defer func() { _ = os.Unsetenv("ALGOREA_DATABASE__TLSCONFIG") }() dbConfig, err := DBConfig(globalConfig) assert.NoError(err) assert.Equal("stuff", dbConfig.Collation) assert.Equal("v99", dbConfig.TLSConfig) }
explode_data.jsonl/61937
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 192 }
[ 2830, 3393, 3506, 2648, 87161, 1155, 353, 8840, 836, 8, 341, 6948, 1669, 2060, 2740, 7121, 1155, 340, 18842, 2648, 1669, 95132, 7121, 741, 197, 62, 284, 2643, 4202, 3160, 19814, 330, 2408, 721, 1138, 18842, 2648, 4202, 445, 12216, 48834...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestMemSeries_truncateChunks(t *testing.T) { s := newMemSeries(labels.FromStrings("a", "b"), 1, 2000) for i := 0; i < 4000; i += 5 { ok, _ := s.append(int64(i), float64(i)) testutil.Assert(t, ok == true, "sample append failed") } // Check that truncate removes half of the chunks and afterwards // that the ID of the last chunk still gives us the same chunk afterwards. countBefore := len(s.chunks) lastID := s.chunkID(countBefore - 1) lastChunk := s.chunk(lastID) testutil.Assert(t, s.chunk(0) != nil, "") testutil.Assert(t, lastChunk != nil, "") s.truncateChunksBefore(2000) testutil.Equals(t, int64(2000), s.chunks[0].minTime) testutil.Assert(t, s.chunk(0) == nil, "first chunks not gone") testutil.Equals(t, countBefore/2, len(s.chunks)) testutil.Equals(t, lastChunk, s.chunk(lastID)) // Validate that the series' sample buffer is applied correctly to the last chunk // after truncation. it1 := s.iterator(s.chunkID(len(s.chunks) - 1)) _, ok := it1.(*memSafeIterator) testutil.Assert(t, ok == true, "") it2 := s.iterator(s.chunkID(len(s.chunks) - 2)) _, ok = it2.(*memSafeIterator) testutil.Assert(t, ok == false, "non-last chunk incorrectly wrapped with sample buffer") }
explode_data.jsonl/38160
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 469 }
[ 2830, 3393, 18816, 25544, 3547, 26900, 89681, 1155, 353, 8840, 836, 8, 341, 1903, 1669, 501, 18816, 25544, 36915, 11439, 20859, 445, 64, 497, 330, 65, 3975, 220, 16, 11, 220, 17, 15, 15, 15, 692, 2023, 600, 1669, 220, 15, 26, 600, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestWorkspacePubSubCallback(t *testing.T) { runTest(t, func(test *testHelper) { workspace := test.NewWorkspace() filename := workspace + "/file" test.MakeFile(filename) test.SyncAllWorkspaces() test.WaitForLogString("Mux::handleWorkspaceChanges", "Workspace pubsub callback to be called") }) }
explode_data.jsonl/1825
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 109 }
[ 2830, 3393, 45981, 29162, 3136, 7494, 1155, 353, 8840, 836, 8, 341, 56742, 2271, 1155, 11, 2915, 8623, 353, 1944, 5511, 8, 341, 197, 197, 42909, 1669, 1273, 7121, 45981, 741, 197, 66434, 1669, 27514, 488, 3521, 1192, 1837, 197, 18185, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestSuccessAppEngineTaskExecution(t *testing.T) { serv, client := setUp(t) defer tearDown(t, serv) defer os.Unsetenv("APP_ENGINE_EMULATOR_HOST") os.Setenv("APP_ENGINE_EMULATOR_HOST", "http://localhost:5000") var receivedRequest *http.Request srv := startTestServer( func(req *http.Request) { receivedRequest = req }, func(req *http.Request) {}, ) defer srv.Shutdown(context.Background()) createdQueue := createTestQueue(t, client) createTaskRequest := taskspb.CreateTaskRequest{ Parent: createdQueue.GetName(), Task: &taskspb.Task{ Name: createdQueue.GetName() + "/tasks/my-test-task", MessageType: &taskspb.Task_AppEngineHttpRequest{ AppEngineHttpRequest: &taskspb.AppEngineHttpRequest{ RelativeUri: "/success", }, }, }, } createdTask, _ := client.CreateTask(context.Background(), &createTaskRequest) // Need to give it a chance to make the actual call time.Sleep(100 * time.Millisecond) assert.NotNil(t, createdTask) expectHeaders := map[string]string{ "X-AppEngine-TaskExecutionCount": "0", "X-AppEngine-TaskRetryCount": "0", "X-AppEngine-TaskName": "my-test-task", "X-AppEngine-QueueName": "test", } actualHeaders := make(map[string]string) for hdr := range expectHeaders { actualHeaders[hdr] = receivedRequest.Header.Get(hdr) } assert.Equal(t, expectHeaders, actualHeaders) assertIsRecentTimestamp(t, receivedRequest.Header.Get("X-AppEngine-TaskETA")) }
explode_data.jsonl/72422
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 556 }
[ 2830, 3393, 7188, 2164, 4571, 6262, 20294, 1155, 353, 8840, 836, 8, 341, 1903, 648, 11, 2943, 1669, 18620, 1155, 340, 16867, 32825, 1155, 11, 4853, 692, 16867, 2643, 10616, 746, 3160, 445, 14707, 62177, 27148, 71680, 17213, 1138, 25078, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestVerifyNonRoot(t *testing.T) { dm, fakeDocker := newTestDockerManager() // setup test cases. var rootUid int64 = 0 var nonRootUid int64 = 1 tests := map[string]struct { container *api.Container inspectImage *dockertypes.ImageInspect expectedError string }{ // success cases "non-root runAsUser": { container: &api.Container{ SecurityContext: &api.SecurityContext{ RunAsUser: &nonRootUid, }, }, }, "numeric non-root image user": { container: &api.Container{}, inspectImage: &dockertypes.ImageInspect{ Config: &dockercontainer.Config{ User: "1", }, }, }, "numeric non-root image user with gid": { container: &api.Container{}, inspectImage: &dockertypes.ImageInspect{ Config: &dockercontainer.Config{ User: "1:2", }, }, }, // failure cases "root runAsUser": { container: &api.Container{ SecurityContext: &api.SecurityContext{ RunAsUser: &rootUid, }, }, expectedError: "container's runAsUser breaks non-root policy", }, "non-numeric image user": { container: &api.Container{}, inspectImage: &dockertypes.ImageInspect{ Config: &dockercontainer.Config{ User: "foo", }, }, expectedError: "non-numeric user", }, "numeric root image user": { container: &api.Container{}, inspectImage: &dockertypes.ImageInspect{ Config: &dockercontainer.Config{ User: "0", }, }, expectedError: "container has no runAsUser and image will run as root", }, "numeric root image user with gid": { container: &api.Container{}, inspectImage: &dockertypes.ImageInspect{ Config: &dockercontainer.Config{ User: "0:1", }, }, expectedError: "container has no runAsUser and image will run as root", }, "nil image in inspect": { container: &api.Container{}, inspectImage: nil, expectedError: "unable to inspect image", }, "nil config in image inspect": { container: &api.Container{}, inspectImage: &dockertypes.ImageInspect{}, expectedError: "unable to inspect image", }, } for k, v := range tests { fakeDocker.Image = v.inspectImage err := dm.verifyNonRoot(v.container) if v.expectedError == "" && err != nil { t.Errorf("case[%q]: unexpected error: %v", k, err) } if v.expectedError != "" && !strings.Contains(err.Error(), v.expectedError) { t.Errorf("case[%q]: expected: %q, got: %q", k, v.expectedError, err.Error()) } } }
explode_data.jsonl/31178
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1017 }
[ 2830, 3393, 32627, 8121, 8439, 1155, 353, 8840, 836, 8, 341, 2698, 76, 11, 12418, 35, 13659, 1669, 501, 2271, 35, 13659, 2043, 2822, 197, 322, 6505, 1273, 5048, 624, 2405, 3704, 33507, 526, 21, 19, 284, 220, 15, 198, 2405, 2477, 843...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestParseCert(t *testing.T) { authKeyBytes := []byte(exampleSSHCert) key, _, _, rest, err := ParseAuthorizedKey(authKeyBytes) if err != nil { t.Fatalf("ParseAuthorizedKey: %v", err) } if len(rest) > 0 { t.Errorf("rest: got %q, want empty", rest) } if _, ok := key.(*Certificate); !ok { t.Fatalf("got %v (%T), want *Certificate", key, key) } marshaled := MarshalAuthorizedKey(key) // Before comparison, remove the trailing newline that // MarshalAuthorizedKey adds. marshaled = marshaled[:len(marshaled) - 1] if !bytes.Equal(authKeyBytes, marshaled) { t.Errorf("marshaled certificate does not match original: got %q, want %q", marshaled, authKeyBytes) } }
explode_data.jsonl/30246
{ "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, 14463, 36934, 1155, 353, 8840, 836, 8, 341, 262, 4166, 1592, 7078, 1669, 3056, 3782, 66203, 1220, 22455, 529, 692, 262, 1376, 11, 8358, 8358, 2732, 11, 1848, 1669, 14775, 60454, 1592, 27435, 1592, 7078, 340, 262, 421, 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...
5
func TestPendingPodsMetric(t *testing.T) { timestamp := time.Now() metrics.Register() total := 50 pInfos := makeQueuedPodInfos(total, timestamp) totalWithDelay := 20 pInfosWithDelay := makeQueuedPodInfos(totalWithDelay, timestamp.Add(2*time.Second)) tests := []struct { name string operations []operation operands [][]*framework.QueuedPodInfo metricsName string wants string }{ { name: "add pods to activeQ and unschedulableQ", operations: []operation{ addPodActiveQ, addPodUnschedulableQ, }, operands: [][]*framework.QueuedPodInfo{ pInfos[:30], pInfos[30:], }, metricsName: "scheduler_pending_pods", wants: ` # HELP scheduler_pending_pods [ALPHA] Number of pending pods, by the queue type. 'active' means number of pods in activeQ; 'backoff' means number of pods in backoffQ; 'unschedulable' means number of pods in unschedulableQ. # TYPE scheduler_pending_pods gauge scheduler_pending_pods{queue="active"} 30 scheduler_pending_pods{queue="backoff"} 0 scheduler_pending_pods{queue="unschedulable"} 20 `, }, { name: "add pods to all kinds of queues", operations: []operation{ addPodActiveQ, addPodBackoffQ, addPodUnschedulableQ, }, operands: [][]*framework.QueuedPodInfo{ pInfos[:15], pInfos[15:40], pInfos[40:], }, metricsName: "scheduler_pending_pods", wants: ` # HELP scheduler_pending_pods [ALPHA] Number of pending pods, by the queue type. 'active' means number of pods in activeQ; 'backoff' means number of pods in backoffQ; 'unschedulable' means number of pods in unschedulableQ. # TYPE scheduler_pending_pods gauge scheduler_pending_pods{queue="active"} 15 scheduler_pending_pods{queue="backoff"} 25 scheduler_pending_pods{queue="unschedulable"} 10 `, }, { name: "add pods to unschedulableQ and then move all to activeQ", operations: []operation{ addPodUnschedulableQ, moveClockForward, moveAllToActiveOrBackoffQ, }, operands: [][]*framework.QueuedPodInfo{ pInfos[:total], {nil}, {nil}, }, metricsName: "scheduler_pending_pods", wants: ` # HELP scheduler_pending_pods [ALPHA] Number of pending pods, by the queue type. 'active' means number of pods in activeQ; 'backoff' means number of pods in backoffQ; 'unschedulable' means number of pods in unschedulableQ. # TYPE scheduler_pending_pods gauge scheduler_pending_pods{queue="active"} 50 scheduler_pending_pods{queue="backoff"} 0 scheduler_pending_pods{queue="unschedulable"} 0 `, }, { name: "make some pods subject to backoff, add pods to unschedulableQ, and then move all to activeQ", operations: []operation{ addPodUnschedulableQ, moveClockForward, addPodUnschedulableQ, moveAllToActiveOrBackoffQ, }, operands: [][]*framework.QueuedPodInfo{ pInfos[20:total], {nil}, pInfosWithDelay[:20], {nil}, }, metricsName: "scheduler_pending_pods", wants: ` # HELP scheduler_pending_pods [ALPHA] Number of pending pods, by the queue type. 'active' means number of pods in activeQ; 'backoff' means number of pods in backoffQ; 'unschedulable' means number of pods in unschedulableQ. # TYPE scheduler_pending_pods gauge scheduler_pending_pods{queue="active"} 30 scheduler_pending_pods{queue="backoff"} 20 scheduler_pending_pods{queue="unschedulable"} 0 `, }, { name: "make some pods subject to backoff, add pods to unschedulableQ/activeQ, move all to activeQ, and finally flush backoffQ", operations: []operation{ addPodUnschedulableQ, addPodActiveQ, moveAllToActiveOrBackoffQ, flushBackoffQ, }, operands: [][]*framework.QueuedPodInfo{ pInfos[:40], pInfos[40:], {nil}, {nil}, }, metricsName: "scheduler_pending_pods", wants: ` # HELP scheduler_pending_pods [ALPHA] Number of pending pods, by the queue type. 'active' means number of pods in activeQ; 'backoff' means number of pods in backoffQ; 'unschedulable' means number of pods in unschedulableQ. # TYPE scheduler_pending_pods gauge scheduler_pending_pods{queue="active"} 50 scheduler_pending_pods{queue="backoff"} 0 scheduler_pending_pods{queue="unschedulable"} 0 `, }, } resetMetrics := func() { metrics.ActivePods().Set(0) metrics.BackoffPods().Set(0) metrics.UnschedulablePods().Set(0) } for _, test := range tests { t.Run(test.name, func(t *testing.T) { resetMetrics() queue := NewTestQueue(context.Background(), newDefaultQueueSort(), WithClock(clock.NewFakeClock(timestamp))) for i, op := range test.operations { for _, pInfo := range test.operands[i] { op(queue, pInfo) } } if err := testutil.GatherAndCompare(metrics.GetGather(), strings.NewReader(test.wants), test.metricsName); err != nil { t.Fatal(err) } }) } }
explode_data.jsonl/68203
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1955 }
[ 2830, 3393, 32027, 23527, 82, 54310, 1155, 353, 8840, 836, 8, 341, 3244, 4702, 1669, 882, 13244, 741, 2109, 13468, 19983, 741, 34493, 1669, 220, 20, 15, 198, 3223, 38059, 1669, 1281, 25776, 3260, 23527, 38059, 22842, 11, 11441, 340, 344...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestPDServerConfig(t *testing.T) { re := require.New(t) registerDefaultSchedulers() tests := []struct { cfgData string hasErr bool dashboardAddress string }{ { ` [pd-server] dashboard-address = "http://127.0.0.1:2379" `, false, "http://127.0.0.1:2379", }, { ` [pd-server] dashboard-address = "auto" `, false, "auto", }, { ` [pd-server] dashboard-address = "none" `, false, "none", }, { "", false, "auto", }, { ` [pd-server] dashboard-address = "127.0.0.1:2379" `, true, "", }, { ` [pd-server] dashboard-address = "foo" `, true, "", }, } for _, test := range tests { cfg := NewConfig() meta, err := toml.Decode(test.cfgData, &cfg) re.NoError(err) err = cfg.Adjust(&meta, false) re.Equal(test.hasErr, err != nil) if !test.hasErr { re.Equal(test.dashboardAddress, cfg.PDServerCfg.DashboardAddress) } } }
explode_data.jsonl/78167
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 485 }
[ 2830, 3393, 23025, 5475, 2648, 1155, 353, 8840, 836, 8, 341, 17200, 1669, 1373, 7121, 1155, 340, 29422, 3675, 74674, 741, 78216, 1669, 3056, 1235, 341, 197, 50286, 1043, 688, 914, 198, 197, 63255, 7747, 1843, 1807, 198, 197, 2698, 7349,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestUntypedNilIssue806(t *testing.T) { gopClTest(t, ` switch f := func() {}; f { case nil: } `, `package main func main() { switch f := func() { }; f { case nil: } } `) }
explode_data.jsonl/73586
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 82 }
[ 2830, 3393, 20250, 32501, 19064, 42006, 23, 15, 21, 1155, 353, 8840, 836, 8, 341, 3174, 453, 5066, 2271, 1155, 11, 22074, 17338, 282, 1669, 2915, 368, 52166, 282, 341, 5638, 2092, 510, 532, 7808, 1565, 1722, 1887, 271, 2830, 1887, 368...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestReadConfig(t *testing.T) { readConfig := GetConfig() err := readConfig.ReadConfig(ConfigTestFile) if err != nil { t.Errorf("Test failed. TestReadConfig %s", err.Error()) } err = readConfig.ReadConfig("bla") if err == nil { t.Error("Test failed. TestReadConfig " + err.Error()) } err = readConfig.ReadConfig("") if err != nil { t.Error("Test failed. TestReadConfig error") } }
explode_data.jsonl/21903
{ "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, 4418, 2648, 1155, 353, 8840, 836, 8, 341, 37043, 2648, 1669, 2126, 2648, 741, 9859, 1669, 1349, 2648, 6503, 2648, 33687, 2271, 1703, 340, 743, 1848, 961, 2092, 341, 197, 3244, 13080, 445, 2271, 4641, 13, 3393, 4418, 2648, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestPrivilegeContainerDisallowed(t *testing.T) { testKubelet := newTestKubelet(t) kubelet := testKubelet.kubelet capabilities.SetForTests(capabilities.Capabilities{ AllowPrivileged: false, }) privileged := true pod := &api.Pod{ ObjectMeta: api.ObjectMeta{ UID: "12345678", Name: "foo", Namespace: "new", }, Spec: api.PodSpec{ Containers: []api.Container{ {Name: "foo", SecurityContext: &api.SecurityContext{Privileged: &privileged}}, }, }, } err := kubelet.syncPod(pod, nil, &container.PodStatus{}, kubetypes.SyncPodUpdate) if err == nil { t.Errorf("expected pod infra creation to fail") } }
explode_data.jsonl/43344
{ "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, 32124, 42769, 4502, 4839, 20967, 1155, 353, 8840, 836, 8, 341, 18185, 42, 3760, 1149, 1669, 501, 2271, 42, 3760, 1149, 1155, 340, 16463, 3760, 1149, 1669, 1273, 42, 3760, 1149, 5202, 3760, 1149, 271, 1444, 391, 8456, 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...
2
func TestMapPin(t *testing.T) { m := createArray(t) c := qt.New(t) defer m.Close() if err := m.Put(uint32(0), uint32(42)); err != nil { t.Fatal("Can't put:", err) } tmp := testutils.TempBPFFS(t) path := filepath.Join(tmp, "map") if err := m.Pin(path); err != nil { t.Fatal(err) } pinned := m.IsPinned() c.Assert(pinned, qt.Equals, true) m.Close() m, err := LoadPinnedMap(path, nil) if err != nil { t.Fatal(err) } defer m.Close() var v uint32 if err := m.Lookup(uint32(0), &v); err != nil { t.Fatal("Can't lookup 0:", err) } if v != 42 { t.Error("Want value 42, got", v) } }
explode_data.jsonl/21649
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 289 }
[ 2830, 3393, 2227, 19861, 1155, 353, 8840, 836, 8, 341, 2109, 1669, 1855, 1857, 1155, 340, 1444, 1669, 38949, 7121, 1155, 340, 16867, 296, 10421, 2822, 743, 1848, 1669, 296, 39825, 8488, 18, 17, 7, 15, 701, 2622, 18, 17, 7, 19, 17, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
6
func TestCheckCollectionMemberPolicy(t *testing.T) { // error case: no msp manager set, no collection config set err := checkCollectionMemberPolicy(nil, nil) require.Error(t, err) mockmsp := new(mspmocks.MockMSP) mockmsp.On("DeserializeIdentity", []byte("signer0")).Return(&mspmocks.MockIdentity{}, nil) mockmsp.On("DeserializeIdentity", []byte("signer1")).Return(&mspmocks.MockIdentity{}, nil) mockmsp.On("GetIdentifier").Return("Org1", nil) mockmsp.On("GetType").Return(msp.FABRIC) mspmgmt.GetManagerForChain("foochannel") mgr := mspmgmt.GetManagerForChain("foochannel") // error case: msp manager not set up, no collection config set err = checkCollectionMemberPolicy(nil, nil) require.EqualError(t, err, "msp manager not set") // set up msp manager mgr.Setup([]msp.MSP{mockmsp}) // error case: no collection config set err = checkCollectionMemberPolicy(nil, mgr) require.EqualError(t, err, "collection configuration is not set") // error case: empty collection config cc := &peer.CollectionConfig{} err = checkCollectionMemberPolicy(cc, mgr) require.EqualError(t, err, "collection configuration is empty") // error case: no static collection config cc = &peer.CollectionConfig{Payload: &peer.CollectionConfig_StaticCollectionConfig{}} err = checkCollectionMemberPolicy(cc, mgr) require.EqualError(t, err, "collection configuration is empty") // error case: member org policy not set cc = &peer.CollectionConfig{ Payload: &peer.CollectionConfig_StaticCollectionConfig{ StaticCollectionConfig: &peer.StaticCollectionConfig{}, }, } err = checkCollectionMemberPolicy(cc, mgr) require.EqualError(t, err, "collection member policy is not set") // error case: member org policy config empty cc = &peer.CollectionConfig{ Payload: &peer.CollectionConfig_StaticCollectionConfig{ StaticCollectionConfig: &peer.StaticCollectionConfig{ Name: "mycollection", MemberOrgsPolicy: &peer.CollectionPolicyConfig{ Payload: &peer.CollectionPolicyConfig_SignaturePolicy{}, }, }, }, } err = checkCollectionMemberPolicy(cc, mgr) require.EqualError(t, err, "collection member org policy is empty") // error case: signd-by index is out of range of signers cc = &peer.CollectionConfig{ Payload: &peer.CollectionConfig_StaticCollectionConfig{ StaticCollectionConfig: &peer.StaticCollectionConfig{ Name: "mycollection", MemberOrgsPolicy: getBadAccessPolicy([]string{"signer0"}, 1), }, }, } err = checkCollectionMemberPolicy(cc, mgr) require.EqualError(t, err, "invalid member org policy for collection 'mycollection': identity index out of range, requested 1, but identities length is 1") // valid case: well-formed collection policy config cc = &peer.CollectionConfig{ Payload: &peer.CollectionConfig_StaticCollectionConfig{ StaticCollectionConfig: &peer.StaticCollectionConfig{ Name: "mycollection", MemberOrgsPolicy: &peer.CollectionPolicyConfig{ Payload: &peer.CollectionPolicyConfig_SignaturePolicy{ SignaturePolicy: testPolicyEnvelope, }, }, }, }, } err = checkCollectionMemberPolicy(cc, mgr) require.NoError(t, err) // check MSPPrincipal_IDENTITY type var signers = [][]byte{[]byte("signer0"), []byte("signer1")} signaturePolicyEnvelope := policydsl.Envelope(policydsl.Or(policydsl.SignedBy(0), policydsl.SignedBy(1)), signers) signaturePolicy := &peer.CollectionPolicyConfig_SignaturePolicy{ SignaturePolicy: signaturePolicyEnvelope, } accessPolicy := &peer.CollectionPolicyConfig{ Payload: signaturePolicy, } cc = &peer.CollectionConfig{ Payload: &peer.CollectionConfig_StaticCollectionConfig{ StaticCollectionConfig: &peer.StaticCollectionConfig{ Name: "mycollection", MemberOrgsPolicy: accessPolicy, }, }, } err = checkCollectionMemberPolicy(cc, mgr) require.NoError(t, err) mockmsp.AssertNumberOfCalls(t, "DeserializeIdentity", 3) // check MSPPrincipal_ROLE type signaturePolicyEnvelope = policydsl.SignedByAnyMember([]string{"Org1"}) signaturePolicy.SignaturePolicy = signaturePolicyEnvelope accessPolicy.Payload = signaturePolicy cc = &peer.CollectionConfig{ Payload: &peer.CollectionConfig_StaticCollectionConfig{ StaticCollectionConfig: &peer.StaticCollectionConfig{ Name: "mycollection", MemberOrgsPolicy: accessPolicy, }, }, } err = checkCollectionMemberPolicy(cc, mgr) require.NoError(t, err) // check MSPPrincipal_ROLE type for unknown org signaturePolicyEnvelope = policydsl.SignedByAnyMember([]string{"Org2"}) signaturePolicy.SignaturePolicy = signaturePolicyEnvelope accessPolicy.Payload = signaturePolicy cc = &peer.CollectionConfig{ Payload: &peer.CollectionConfig_StaticCollectionConfig{ StaticCollectionConfig: &peer.StaticCollectionConfig{ Name: "mycollection", MemberOrgsPolicy: accessPolicy, }, }, } err = checkCollectionMemberPolicy(cc, mgr) // this does not raise an error but prints a warning logging message instead require.NoError(t, err) // check MSPPrincipal_ORGANIZATION_UNIT type principal := &mb.MSPPrincipal{ PrincipalClassification: mb.MSPPrincipal_ORGANIZATION_UNIT, Principal: protoutil.MarshalOrPanic(&mb.OrganizationUnit{MspIdentifier: "Org1"}), } // create the policy: it requires exactly 1 signature from the first (and only) principal signaturePolicy.SignaturePolicy = &common.SignaturePolicyEnvelope{ Version: 0, Rule: policydsl.NOutOf(1, []*common.SignaturePolicy{policydsl.SignedBy(0)}), Identities: []*mb.MSPPrincipal{principal}, } accessPolicy.Payload = signaturePolicy cc = &peer.CollectionConfig{ Payload: &peer.CollectionConfig_StaticCollectionConfig{ StaticCollectionConfig: &peer.StaticCollectionConfig{ Name: "mycollection", MemberOrgsPolicy: accessPolicy, }, }, } err = checkCollectionMemberPolicy(cc, mgr) require.NoError(t, err) }
explode_data.jsonl/11802
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 2040 }
[ 2830, 3393, 3973, 6482, 9366, 13825, 1155, 353, 8840, 836, 8, 341, 197, 322, 1465, 1142, 25, 902, 296, 2154, 6645, 738, 11, 902, 4426, 2193, 738, 198, 9859, 1669, 1779, 6482, 9366, 13825, 27907, 11, 2092, 340, 17957, 6141, 1155, 11, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestHandlers_AddMessageStamp(t *testing.T) { t.Parallel() path := "/api/v3/messages/{messageId}/stamps/{stampId}" env := Setup(t, common1) user := env.CreateUser(t, rand) ch := env.CreateChannel(t, rand) archived := env.CreateChannel(t, rand) m := env.CreateMessage(t, user.GetID(), ch.ID, rand) archivedM := env.CreateMessage(t, user.GetID(), archived.ID, rand) require.NoError(t, env.CM.ArchiveChannel(archived.ID, user.GetID())) stamp := env.CreateStamp(t, user.GetID(), rand) s := env.S(t, user.GetID()) t.Run("not logged in", func(t *testing.T) { t.Parallel() e := env.R(t) e.POST(path, m.GetID(), stamp.ID). WithJSON(map[string]interface{}{}). Expect(). Status(http.StatusUnauthorized) }) t.Run("message not found", func(t *testing.T) { t.Parallel() e := env.R(t) e.POST(path, uuid.Must(uuid.NewV4()), stamp.ID). WithCookie(session.CookieName, s). WithJSON(map[string]interface{}{}). Expect(). Status(http.StatusNotFound) }) t.Run("stamp not found", func(t *testing.T) { t.Parallel() e := env.R(t) e.POST(path, m.GetID(), uuid.Must(uuid.NewV4())). WithCookie(session.CookieName, s). WithJSON(map[string]interface{}{}). Expect(). Status(http.StatusNotFound) }) t.Run("bad request", func(t *testing.T) { t.Parallel() e := env.R(t) e.POST(path, m.GetID(), stamp.ID). WithCookie(session.CookieName, s). WithJSON(&PostMessageStampRequest{Count: 1000}). Expect(). Status(http.StatusBadRequest) }) t.Run("archived", func(t *testing.T) { t.Parallel() e := env.R(t) e.POST(path, archivedM.GetID(), stamp.ID). WithCookie(session.CookieName, s). WithJSON(map[string]interface{}{}). Expect(). Status(http.StatusBadRequest) }) t.Run("success", func(t *testing.T) { t.Parallel() e := env.R(t) e.POST(path, m.GetID(), stamp.ID). WithCookie(session.CookieName, s). WithJSON(map[string]interface{}{}). Expect(). Status(http.StatusNoContent) m, err := env.MM.Get(m.GetID()) require.NoError(t, err) if assert.Len(t, m.GetStamps(), 1) { s := m.GetStamps()[0] assert.EqualValues(t, 1, s.Count) assert.EqualValues(t, stamp.ID, s.StampID) assert.EqualValues(t, m.GetID(), s.MessageID) assert.EqualValues(t, user.GetID(), s.UserID) } }) }
explode_data.jsonl/40157
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1027 }
[ 2830, 3393, 39949, 21346, 2052, 20906, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 2822, 26781, 1669, 3521, 2068, 5457, 18, 71753, 9388, 1994, 764, 4472, 267, 14647, 9388, 49113, 764, 11195, 57538, 1669, 18626, 1155, 11, 4185, 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 TestStateTransition(t *testing.T) { order := &Order{} CreateOrderAndExecuteTransition(order, OrderEventCheckout, t, true) if order.State != OrderStatePaying { t.Errorf("state doesn't transfered successfully") } }
explode_data.jsonl/44770
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 74 }
[ 2830, 3393, 1397, 21768, 1155, 353, 8840, 836, 8, 341, 42245, 1669, 609, 4431, 16094, 75569, 4431, 3036, 17174, 21768, 19385, 11, 7217, 1556, 55145, 11, 259, 11, 830, 692, 743, 1973, 18942, 961, 7217, 1397, 47, 17270, 341, 197, 3244, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
2
func TestSpan_TraceID(t *testing.T) { ms := NewSpan() assert.EqualValues(t, NewTraceID([16]byte{}), ms.TraceID()) testValTraceID := NewTraceID([16]byte{1, 2, 3, 4, 5, 6, 7, 8, 8, 7, 6, 5, 4, 3, 2, 1}) ms.SetTraceID(testValTraceID) assert.EqualValues(t, testValTraceID, ms.TraceID()) }
explode_data.jsonl/63263
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 139 }
[ 2830, 3393, 12485, 21038, 578, 915, 1155, 353, 8840, 836, 8, 341, 47691, 1669, 1532, 12485, 741, 6948, 12808, 6227, 1155, 11, 1532, 6550, 915, 2561, 16, 21, 90184, 6257, 701, 9829, 46920, 915, 2398, 18185, 2208, 6550, 915, 1669, 1532, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestAPIUserSearchNotLoggedInUserHidden(t *testing.T) { defer prepareTestEnv(t)() query := "user31" req := NewRequestf(t, "GET", "/api/v1/users/search?q=%s", query) resp := MakeRequest(t, req, http.StatusOK) var results SearchResults DecodeJSON(t, resp, &results) assert.Empty(t, results.Data) }
explode_data.jsonl/7511
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 118 }
[ 2830, 3393, 7082, 1474, 5890, 2623, 28559, 1474, 17506, 1155, 353, 8840, 836, 8, 341, 16867, 10549, 2271, 14359, 1155, 8, 741, 27274, 1669, 330, 872, 18, 16, 698, 24395, 1669, 1532, 1900, 69, 1155, 11, 330, 3806, 497, 3521, 2068, 5457...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestResumption(t *testing.T) { sessionFilePath := tempFile("") defer os.Remove(sessionFilePath) test := &serverTest{ name: "IssueTicket", command: []string{"openssl", "s_client", "-cipher", "RC4-SHA", "-sess_out", sessionFilePath}, } runServerTestTLS12(t, test) test = &serverTest{ name: "Resume", command: []string{"openssl", "s_client", "-cipher", "RC4-SHA", "-sess_in", sessionFilePath}, } runServerTestTLS12(t, test) }
explode_data.jsonl/80565
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 181 }
[ 2830, 3393, 1061, 60574, 1155, 353, 8840, 836, 8, 341, 25054, 19090, 1669, 2730, 1703, 31764, 16867, 2643, 13270, 16264, 19090, 692, 18185, 1669, 609, 4030, 2271, 515, 197, 11609, 25, 262, 330, 42006, 34058, 756, 197, 45566, 25, 3056, 9...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestCheckValidJSON(t *testing.T) { validJSON := `{"Args":["a","b","c"]}` input := &pb.ChaincodeInput{} if err := json.Unmarshal([]byte(validJSON), &input); err != nil { t.Fail() t.Logf("Chaincode argument error: %s", err) return } validJSON = `{"Function":"f", "Args":["a","b","c"]}` if err := json.Unmarshal([]byte(validJSON), &input); err != nil { t.Fail() t.Logf("Chaincode argument error: %s", err) return } validJSON = `{"Function":"f", "Args":[]}` if err := json.Unmarshal([]byte(validJSON), &input); err != nil { t.Fail() t.Logf("Chaincode argument error: %s", err) return } validJSON = `{"Function":"f"}` if err := json.Unmarshal([]byte(validJSON), &input); err != nil { t.Fail() t.Logf("Chaincode argument error: %s", err) return } }
explode_data.jsonl/22364
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 322 }
[ 2830, 3393, 3973, 4088, 5370, 1155, 353, 8840, 836, 8, 341, 56322, 5370, 1669, 1565, 4913, 4117, 36799, 64, 2198, 65, 2198, 66, 1341, 31257, 22427, 1669, 609, 16650, 98269, 1851, 2505, 16094, 743, 1848, 1669, 2951, 38097, 10556, 3782, 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...
5
func TestDyn_filterAndFixLinks(t *testing.T) { links := []string{ "/REST/ARecord/example.com/the-target.example.com/", "/REST/ARecord/example.com/the-target.google.com/", "/REST/TXTRecord/example.com/the-target.example.com/", "/REST/TXTRecord/example.com/the-target.google.com/", "/REST/CNAMERecord/example.com/the-target.google.com/", "/REST/CNAMERecord/example.com/the-target.example.com/", "/REST/NSRecord/example.com/the-target.google.com/", "/REST/NSRecord/example.com/the-target.example.com/", } filter := NewDomainFilter([]string{"example.com"}) result := filterAndFixLinks(links, filter) // should skip non-example.com records and NS records too assert.Equal(t, 3, len(result)) assert.Equal(t, "ARecord/example.com/the-target.example.com/", result[0]) assert.Equal(t, "TXTRecord/example.com/the-target.example.com/", result[1]) assert.Equal(t, "CNAMERecord/example.com/the-target.example.com/", result[2]) }
explode_data.jsonl/9815
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 388 }
[ 2830, 3393, 95709, 8727, 3036, 25958, 24089, 1155, 353, 8840, 836, 8, 341, 197, 15880, 1669, 3056, 917, 515, 197, 197, 3115, 38307, 10360, 6471, 65182, 905, 51257, 18489, 7724, 905, 35075, 197, 197, 3115, 38307, 10360, 6471, 65182, 905, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestSumPerKeyAddsNoiseFloat(t *testing.T) { for _, tc := range []struct { name string noiseKind NoiseKind // Differential privacy params used. epsilon float64 delta float64 }{ { name: "Gaussian", noiseKind: GaussianNoise{}, epsilon: 2, // It is split by 2: 1 for the noise and 1 for the partition selection. delta: 0.01, // It is split by 2: 0.005 for the noise and 0.005 for the partition selection. }, { name: "Laplace", noiseKind: LaplaceNoise{}, epsilon: 0.2, // It is split by 2: 0.1 for the noise and 0.1 for the partition selection. delta: 0.01, }, } { // We have 1 partition. So, to get an overall flakiness of 10⁻²³, // we need to have each partition pass with 1-10⁻²³ probability (k=23). noiseEpsilon, noiseDelta := tc.epsilon/2, 0.0 k := 23.0 l0Sensitivity, lInfSensitivity := 1.0, 1.0 partitionSelectionEpsilon, partitionSelectionDelta := tc.epsilon/2, tc.delta l1Sensitivity := l0Sensitivity * lInfSensitivity tolerance := testutils.ComplementaryLaplaceTolerance(k, l1Sensitivity, noiseEpsilon) if tc.noiseKind == gaussianNoise { noiseDelta = tc.delta / 2 partitionSelectionDelta = tc.delta / 2 tolerance = testutils.ComplementaryGaussianTolerance(k, l0Sensitivity, lInfSensitivity, noiseEpsilon, noiseDelta) } // Compute the number of IDs needed to keep the partition. sp, err := dpagg.NewPreAggSelectPartition( &dpagg.PreAggSelectPartitionOptions{ Epsilon: partitionSelectionEpsilon, Delta: partitionSelectionDelta, MaxPartitionsContributed: 1, }) if err != nil { t.Fatalf("Couldn't initialize PreAggSelectPartition necessary to compute the number of IDs needed: %v", err) } numIDs, err := sp.GetHardThreshold() if err != nil { t.Fatalf("Couldn't compute hard threshold: %v", err) } // triples contains {1,0,1}, {2,0,1}, …, {numIDs,0,1}. triples := testutils.MakeSampleTripleWithFloatValue(numIDs, 0) p, s, col := ptest.CreateList(triples) col = beam.ParDo(s, testutils.ExtractIDFromTripleWithFloatValue, col) pcol := MakePrivate(s, col, NewPrivacySpec(tc.epsilon, tc.delta)) pcol = ParDo(s, testutils.TripleWithFloatValueToKV, pcol) got := SumPerKey(s, pcol, SumParams{MaxPartitionsContributed: 1, MinValue: 0.0, MaxValue: 1.0, NoiseKind: tc.noiseKind}) got = beam.ParDo(s, testutils.KVToFloat64Metric, got) testutils.CheckFloat64MetricsAreNoisy(s, got, float64(numIDs), tolerance) if err := ptest.Run(p); err != nil { t.Errorf("SumPerKey didn't add any noise with float inputs and %s Noise: %v", tc.name, err) } } }
explode_data.jsonl/42964
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1075 }
[ 2830, 3393, 9190, 3889, 1592, 72111, 61819, 5442, 1155, 353, 8840, 836, 8, 341, 2023, 8358, 17130, 1669, 2088, 3056, 1235, 341, 197, 11609, 414, 914, 198, 197, 197, 52218, 10629, 50523, 10629, 198, 197, 197, 322, 98736, 12345, 3628, 148...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestAccKeycloakAttributeToRoleIdentityProviderMapper_basicUpdateAll(t *testing.T) { t.Parallel() identityProviderAliasName := acctest.RandomWithPrefix("tf-acc") firstMapper := &keycloak.IdentityProviderMapper{ Realm: testAccRealm.Realm, IdentityProviderAlias: identityProviderAliasName, Name: acctest.RandString(10), Config: &keycloak.IdentityProviderMapperConfig{ AttributeValue: acctest.RandString(10), Attribute: acctest.RandString(10), Role: acctest.RandString(10), }, } secondMapper := &keycloak.IdentityProviderMapper{ Realm: testAccRealm.Realm, IdentityProviderAlias: identityProviderAliasName, Name: acctest.RandString(10), Config: &keycloak.IdentityProviderMapperConfig{ AttributeValue: acctest.RandString(10), Attribute: acctest.RandString(10), Role: acctest.RandString(10), }, } resource.Test(t, resource.TestCase{ ProviderFactories: testAccProviderFactories, PreCheck: func() { testAccPreCheck(t) }, CheckDestroy: testAccCheckKeycloakAttributeToRoleIdentityProviderMapperDestroy(), Steps: []resource.TestStep{ { Config: testKeycloakAttributeToRoleIdentityProviderMapper_basicFromInterface(firstMapper), Check: testAccCheckKeycloakAttributeToRoleIdentityProviderMapperExists("keycloak_attribute_to_role_identity_provider_mapper.saml"), }, { Config: testKeycloakAttributeToRoleIdentityProviderMapper_basicFromInterface(secondMapper), Check: testAccCheckKeycloakAttributeToRoleIdentityProviderMapperExists("keycloak_attribute_to_role_identity_provider_mapper.saml"), }, }, }) }
explode_data.jsonl/33579
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 676 }
[ 2830, 3393, 14603, 1592, 88751, 3907, 1249, 9030, 18558, 5179, 10989, 34729, 4289, 2403, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 741, 197, 16912, 5179, 22720, 675, 1669, 1613, 67880, 26709, 2354, 14335, 445, 8935, 12, 4475, 5130,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestImageRef_HEIF(t *testing.T) { Startup(nil) raw, err := ioutil.ReadFile(resources + "heic-24bit-exif.heic") require.NoError(t, err) img, err := NewImageFromBuffer(raw) require.NoError(t, err) require.NotNil(t, img) defer img.Close() _, metadata, err := img.Export(nil) assert.NoError(t, err) assert.Equal(t, ImageTypeHEIF, metadata.Format) }
explode_data.jsonl/38810
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 150 }
[ 2830, 3393, 1906, 3945, 7867, 2773, 1155, 353, 8840, 836, 8, 341, 197, 39076, 27907, 692, 76559, 11, 1848, 1669, 43144, 78976, 52607, 488, 330, 383, 292, 12, 17, 19, 4489, 10187, 333, 48035, 292, 1138, 17957, 35699, 1155, 11, 1848, 69...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestLevelIterBoundaries(t *testing.T) { cmp := db.DefaultComparer.Compare fs := storage.NewMem() var readers []*sstable.Reader var files []fileMetadata newIters := func(meta *fileMetadata) (internalIterator, internalIterator, error) { return readers[meta.fileNum].NewIter(nil), nil, nil } datadriven.RunTest(t, "testdata/level_iter_boundaries", func(d *datadriven.TestData) string { switch d.Cmd { case "clear": fs = storage.NewMem() readers = nil files = nil return "" case "build": fileNum := uint64(len(readers)) name := fmt.Sprint(fileNum) f0, err := fs.Create(name) if err != nil { return err.Error() } w := sstable.NewWriter(f0, nil, db.LevelOptions{}) var tombstones []rangedel.Tombstone f := rangedel.Fragmenter{ Cmp: cmp, Emit: func(fragmented []rangedel.Tombstone) { tombstones = append(tombstones, fragmented...) }, } for _, key := range strings.Split(d.Input, "\n") { j := strings.Index(key, ":") ikey := db.ParseInternalKey(key[:j]) value := []byte(key[j+1:]) switch ikey.Kind() { case db.InternalKeyKindRangeDelete: f.Add(ikey, value) default: if err := w.Add(ikey, value); err != nil { return err.Error() } } } f.Finish() for _, v := range tombstones { if err := w.Add(v.Start, v.End); err != nil { return err.Error() } } if err := w.Close(); err != nil { return err.Error() } meta, err := w.Metadata() if err != nil { return err.Error() } f1, err := fs.Open(name) if err != nil { return err.Error() } readers = append(readers, sstable.NewReader(f1, 0, nil)) files = append(files, fileMetadata{ fileNum: fileNum, smallest: meta.Smallest(cmp), largest: meta.Largest(cmp), }) var buf bytes.Buffer for _, f := range files { fmt.Fprintf(&buf, "%d: %s-%s\n", f.fileNum, f.smallest, f.largest) } return buf.String() case "iter": iter := newLevelIter(nil, db.DefaultComparer.Compare, newIters, files) defer iter.Close() // Fake up the range deletion initialization. iter.initRangeDel(new(internalIterator)) return runInternalIterCmd(d, iter, iterCmdVerboseKey) default: return fmt.Sprintf("unknown command: %s", d.Cmd) } }) }
explode_data.jsonl/5195
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1003 }
[ 2830, 3393, 4449, 8537, 19568, 5431, 1155, 353, 8840, 836, 8, 341, 1444, 1307, 1669, 2927, 13275, 31942, 32377, 198, 53584, 1669, 5819, 7121, 18816, 741, 2405, 12726, 29838, 82, 27992, 47431, 198, 2405, 3542, 3056, 1192, 14610, 271, 8638,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestTabContainer_CurrentTabIndex(t *testing.T) { tabs := container.NewAppTabs(&container.TabItem{Text: "Test", Content: widget.NewLabel("Test")}) assert.Equal(t, 1, len(tabs.Items)) assert.Equal(t, 0, tabs.CurrentTabIndex()) }
explode_data.jsonl/32311
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 85 }
[ 2830, 3393, 8582, 4502, 40735, 98609, 1155, 353, 8840, 836, 8, 341, 3244, 3435, 1669, 5476, 7121, 2164, 36985, 2099, 3586, 4328, 1234, 90, 1178, 25, 330, 2271, 497, 8883, 25, 9086, 7121, 2476, 445, 2271, 899, 8824, 6948, 12808, 1155, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
func TestDKG(t *testing.T) { params, err := NewParams(btcec.S256(), curves.NewK256Scalar()) require.Nil(t, err) alice := NewAlice(params) bob := NewBob(params) alicePipe, bobPipe := NewPipeWrappers() require.Nil(t, testDKG(alice, bob, alicePipe, bobPipe)) }
explode_data.jsonl/79580
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 115 }
[ 2830, 3393, 18301, 38, 1155, 353, 8840, 836, 8, 341, 25856, 11, 1848, 1669, 1532, 4870, 68417, 68955, 808, 17, 20, 21, 1507, 35933, 7121, 42, 17, 20, 21, 20639, 2398, 17957, 59678, 1155, 11, 1848, 340, 197, 63195, 1669, 1532, 61686, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestConnRaw(t *testing.T) { db := newTestDB(t, "people") defer closeDB(t, db) ctx, cancel := context.WithCancel(context.Background()) defer cancel() conn, err := db.Conn(ctx) if err != nil { t.Fatal(err) } conn.dc.ci.(*fakeConn).skipDirtySession = true defer conn.Close() sawFunc := false err = conn.Raw(func(dc interface{}) error { sawFunc = true if _, ok := dc.(*fakeConn); !ok { return fmt.Errorf("got %T want *fakeConn", dc) } return nil }) if err != nil { t.Fatal(err) } if !sawFunc { t.Fatal("Raw func not called") } func() { defer func() { x := recover() if x == nil { t.Fatal("expected panic") } conn.closemu.Lock() closed := conn.dc == nil conn.closemu.Unlock() if !closed { t.Fatal("expected connection to be closed after panic") } }() err = conn.Raw(func(dc interface{}) error { panic("Conn.Raw panic should return an error") }) t.Fatal("expected panic from Raw func") }() }
explode_data.jsonl/15980
{ "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, 9701, 20015, 1155, 353, 8840, 836, 8, 341, 20939, 1669, 501, 2271, 3506, 1155, 11, 330, 16069, 1138, 16867, 3265, 3506, 1155, 11, 2927, 692, 20985, 11, 9121, 1669, 2266, 26124, 9269, 5378, 19047, 2398, 16867, 9121, 741, 3291...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func Test_crc8(t *testing.T) { tests := []struct { name string b []byte want byte }{ // crc of 0 is 0 {"a", []byte{0}, 0}, // crc of 1 is 0x1D (the polynomial for the 8 bit crc) {"b", []byte{1}, 0x1D}, // simple one {"c", []byte{1, 2, 3, 4}, 62}, // show that if we make a tiny change the crc changes a lot {"d", []byte("This is a test"), 214}, {"e", []byte("this is a test"), 59}, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { if got := crc8(tt.b); got != tt.want { t.Errorf("crc8() = %v, want %v", got, tt.want) } }) } }
explode_data.jsonl/32829
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 281 }
[ 2830, 3393, 59084, 23, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 3056, 1235, 341, 197, 11609, 914, 198, 197, 2233, 262, 3056, 3782, 198, 197, 50780, 4922, 198, 197, 59403, 197, 197, 322, 37180, 315, 220, 15, 374, 220, 15, 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...
2
func TestSet(t *testing.T) { s := NewSet() assert.Len(t, s.ToArray(), 0) assert.Equal(t, 0, s.Size()) assert.False(t, s.Exists(42)) s.Add(42) assert.True(t, s.Exists(42)) assert.Len(t, s.ToArray(), 1) assert.Equal(t, 1, s.Size()) s.Remove(42) assert.False(t, s.Exists(42)) assert.Equal(t, 0, s.Size()) s.Add(42) assert.True(t, s.Exists(42)) s.Clear() assert.False(t, s.Exists(42)) assert.Equal(t, 0, s.Size()) }
explode_data.jsonl/22087
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 215 }
[ 2830, 3393, 1649, 1155, 353, 8840, 836, 8, 341, 1903, 1669, 1532, 1649, 741, 6948, 65819, 1155, 11, 274, 33623, 1507, 220, 15, 340, 6948, 12808, 1155, 11, 220, 15, 11, 274, 2465, 2398, 6948, 50757, 1155, 11, 274, 26996, 7, 19, 17, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestJSONMarshal(t *testing.T) { c, err := LoadFile("testdata/conf.good.yml") if err != nil { t.Errorf("Error parsing %s: %s", "testdata/conf.good.yml", err) } _, err = json.Marshal(c) if err != nil { t.Fatal("JSON Marshaling failed:", err) } }
explode_data.jsonl/72907
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 112 }
[ 2830, 3393, 5370, 55438, 1155, 353, 8840, 836, 8, 341, 1444, 11, 1848, 1669, 8893, 1703, 445, 92425, 59241, 59569, 33936, 1138, 743, 1848, 961, 2092, 341, 197, 3244, 13080, 445, 1454, 22314, 1018, 82, 25, 1018, 82, 497, 330, 92425, 59...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestConn_Close_waitingForResponse(t *testing.T) { c := jsonrpc2.NewConn(context.Background(), jsonrpc2.NewBufferedStream(&readWriteCloser{eof, eof}, jsonrpc2.VarintObjectCodec{}), noopHandler{}) done := make(chan struct{}) go func() { if err := c.Call(context.Background(), "m", nil, nil); err != jsonrpc2.ErrClosed { t.Errorf("got error %v, want %v", err, jsonrpc2.ErrClosed) } close(done) }() if err := c.Close(); err != nil && err != jsonrpc2.ErrClosed { t.Error(err) } select { case <-c.DisconnectNotify(): case <-time.After(200 * time.Millisecond): t.Fatal("no disconnect notification") } <-done }
explode_data.jsonl/50187
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 257 }
[ 2830, 3393, 9701, 68185, 84683, 2461, 2582, 1155, 353, 8840, 836, 8, 341, 1444, 1669, 2951, 29414, 17, 7121, 9701, 5378, 19047, 1507, 2951, 29414, 17, 7121, 4095, 291, 3027, 2099, 878, 7985, 51236, 799, 90, 77594, 11, 76760, 2137, 2951,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestTransactionWithWriteOnlyColumn(t *testing.T) { store, dom, clean := testkit.CreateMockStoreAndDomainWithSchemaLease(t, columnModifyLease) defer clean() tk := testkit.NewTestKit(t, store) tk.MustExec("use test") tk.MustExec("drop table if exists t1") tk.MustExec("create table t1 (a int key);") transactions := [][]string{ { "begin", "insert into t1 set a=1", "update t1 set a=2 where a=1", "commit", }, } hook := &ddl.TestDDLCallback{Do: dom} var checkErr error hook.OnJobRunBeforeExported = func(job *model.Job) { if checkErr != nil { return } switch job.SchemaState { case model.StateWriteOnly: default: return } // do transaction. for _, transaction := range transactions { for _, sql := range transaction { if _, checkErr = tk.Exec(sql); checkErr != nil { checkErr = errors.Errorf("err: %s, sql: %s, job schema state: %s", checkErr.Error(), sql, job.SchemaState) return } } } } dom.DDL().SetHook(hook) done := make(chan error, 1) // test transaction on add column. go backgroundExec(store, "alter table t1 add column c int not null", done) err := <-done require.NoError(t, err) require.NoError(t, checkErr) tk.MustQuery("select a from t1").Check(testkit.Rows("2")) tk.MustExec("delete from t1") // test transaction on drop column. go backgroundExec(store, "alter table t1 drop column c", done) err = <-done require.NoError(t, err) require.NoError(t, checkErr) tk.MustQuery("select a from t1").Check(testkit.Rows("2")) }
explode_data.jsonl/51315
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 601 }
[ 2830, 3393, 8070, 2354, 7985, 7308, 2933, 1155, 353, 8840, 836, 8, 341, 57279, 11, 4719, 11, 4240, 1669, 1273, 8226, 7251, 11571, 6093, 3036, 13636, 2354, 8632, 2304, 519, 1155, 11, 3250, 44427, 2304, 519, 340, 16867, 4240, 741, 3244, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
6
func TestLocateMissingTokenInContext(t *testing.T) { ctx := context.Background() manager := createManager(t) _, err := manager.Locate(ctx) if err == nil { t.Error("Should have returned error on missing token in contex", err) } }
explode_data.jsonl/54988
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 78 }
[ 2830, 3393, 9152, 349, 25080, 3323, 641, 1972, 1155, 353, 8840, 836, 8, 341, 20985, 1669, 2266, 19047, 2822, 92272, 1669, 1855, 2043, 1155, 692, 197, 6878, 1848, 1669, 6645, 1214, 81515, 7502, 340, 743, 1848, 621, 2092, 341, 197, 3244, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
2
func TestGetSDSByAttribute(t *testing.T) { pd := getProtectionDomain(t) assert.NotNil(t, pd) if pd == nil { return } sds := getAllSds(t) assert.NotNil(t, sds) if sds == nil { return } found, err := pd.FindSds("Name", sds[0].Sds.Name) assert.Nil(t, err) assert.NotNil(t, found) assert.Equal(t, sds[0].Sds.Name, found.Name) found, err = pd.FindSds("ID", sds[0].Sds.ID) assert.Nil(t, err) assert.NotNil(t, found) assert.Equal(t, sds[0].Sds.ID, found.ID) }
explode_data.jsonl/30577
{ "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, 1949, 5491, 50, 1359, 3907, 1155, 353, 8840, 836, 8, 341, 3223, 67, 1669, 633, 78998, 13636, 1155, 340, 6948, 93882, 1155, 11, 7744, 340, 743, 7744, 621, 2092, 341, 197, 853, 198, 197, 630, 1903, 5356, 1669, 23955, 50, 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 TestRemove(t *testing.T) { allcoin.Set("ShitCoin", "SC") allcoin.Remove("ShitCoin") if allcoin.Exist("ShitCoin") { t.Fatal("ShitCoin should not exist, we removed it during a previous step") } }
explode_data.jsonl/74137
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 78 }
[ 2830, 3393, 13021, 1155, 353, 8840, 836, 8, 341, 50960, 7160, 4202, 445, 2016, 275, 41180, 497, 330, 3540, 5130, 50960, 7160, 13270, 445, 2016, 275, 41180, 5130, 743, 678, 7160, 5121, 380, 445, 2016, 275, 41180, 899, 341, 197, 3244, 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 ]
2
func TestWatchpointsBasic(t *testing.T) { skipOn(t, "not implemented", "freebsd") skipOn(t, "not implemented", "386") skipOn(t, "see https://github.com/go-delve/delve/issues/2768", "windows") protest.AllowRecording(t) position1 := 19 position5 := 41 if runtime.GOARCH == "arm64" { position1 = 18 position5 = 40 } withTestProcess("databpeasy", t, func(p *proc.Target, fixture protest.Fixture) { setFunctionBreakpoint(p, t, "main.main") setFileBreakpoint(p, t, fixture.Source, 21) // Position 2 breakpoint setFileBreakpoint(p, t, fixture.Source, 27) // Position 4 breakpoint assertNoError(p.Continue(), t, "Continue 0") assertLineNumber(p, t, 13, "Continue 0") // Position 0 scope, err := proc.GoroutineScope(p, p.CurrentThread()) assertNoError(err, t, "GoroutineScope") bp, err := p.SetWatchpoint(scope, "globalvar1", proc.WatchWrite, nil) assertNoError(err, t, "SetDataBreakpoint(write-only)") assertNoError(p.Continue(), t, "Continue 1") assertLineNumber(p, t, position1, "Continue 1") // Position 1 if curbp := p.CurrentThread().Breakpoint().Breakpoint; curbp == nil || (curbp.LogicalID() != bp.LogicalID()) { t.Fatal("breakpoint not set") } assertNoError(p.ClearBreakpoint(bp.Addr), t, "ClearBreakpoint") assertNoError(p.Continue(), t, "Continue 2") assertLineNumber(p, t, 21, "Continue 2") // Position 2 _, err = p.SetWatchpoint(scope, "globalvar1", proc.WatchWrite|proc.WatchRead, nil) assertNoError(err, t, "SetDataBreakpoint(read-write)") assertNoError(p.Continue(), t, "Continue 3") assertLineNumber(p, t, 22, "Continue 3") // Position 3 p.ClearBreakpoint(bp.Addr) assertNoError(p.Continue(), t, "Continue 4") assertLineNumber(p, t, 27, "Continue 4") // Position 4 t.Logf("setting final breakpoint") _, err = p.SetWatchpoint(scope, "globalvar1", proc.WatchWrite, nil) assertNoError(err, t, "SetDataBreakpoint(write-only, again)") assertNoError(p.Continue(), t, "Continue 5") assertLineNumber(p, t, position5, "Continue 5") // Position 5 }) }
explode_data.jsonl/56356
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 750 }
[ 2830, 3393, 14247, 7706, 15944, 1155, 353, 8840, 836, 8, 341, 1903, 13389, 1925, 1155, 11, 330, 1921, 11537, 497, 330, 10593, 51835, 1138, 1903, 13389, 1925, 1155, 11, 330, 1921, 11537, 497, 330, 18, 23, 21, 1138, 1903, 13389, 1925, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestConfigTxContext_AddAdmin(t *testing.T) { t.Skip("Add admin is a config update, TODO in issue: https://github.com/hyperledger-labs/orion-server/issues/148") clientCryptoDir := testutils.GenerateTestClientCrypto(t, []string{"admin", "admin2", "server"}) testServer, _, _, err := SetupTestServer(t, clientCryptoDir) defer func() { if testServer != nil { _ = testServer.Stop() } }() require.NoError(t, err) StartTestServer(t, testServer) serverPort, err := testServer.Port() require.NoError(t, err) adminCert, _ := testutils.LoadTestClientCrypto(t, clientCryptoDir, "admin") admin := &types.Admin{ Id: "admin", Certificate: adminCert.Raw, } admin2Cert, _ := testutils.LoadTestClientCrypto(t, clientCryptoDir, "admin2") admin2 := &types.Admin{Id: "admin2", Certificate: admin2Cert.Raw} bcdb := createDBInstance(t, clientCryptoDir, serverPort) session1 := openUserSession(t, bcdb, "admin", clientCryptoDir) // Add admin2 tx, err := session1.ConfigTx() require.NoError(t, err) require.NotNil(t, tx) err = tx.AddAdmin(admin) require.EqualError(t, err, "admin already exists in current config: admin") err = tx.AddAdmin(admin2) require.NoError(t, err) err = tx.AddAdmin(admin2) require.EqualError(t, err, "admin already exists in pending config: admin2") txID, receipt, err := tx.Commit(true) require.NoError(t, err) require.NotNil(t, txID) require.NotNil(t, receipt) tx2, err := session1.ConfigTx() require.NoError(t, err) clusterConfig, err := tx2.GetClusterConfig() require.NoError(t, err) require.NotNil(t, clusterConfig) require.Len(t, clusterConfig.Admins, 2) found, index := AdminExists("admin2", clusterConfig.Admins) require.True(t, found) require.EqualValues(t, clusterConfig.Admins[index].Certificate, admin2Cert.Raw) // do something with the new admin session2 := openUserSession(t, bcdb, "admin2", clientCryptoDir) tx3, err := session2.ConfigTx() require.NoError(t, err) clusterConfig2, err := tx3.GetClusterConfig() require.NoError(t, err) require.NotNil(t, clusterConfig2) }
explode_data.jsonl/65327
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 769 }
[ 2830, 3393, 2648, 31584, 1972, 21346, 7210, 1155, 353, 8840, 836, 8, 341, 3244, 57776, 445, 2212, 3986, 374, 264, 2193, 2647, 11, 5343, 304, 4265, 25, 3703, 1110, 5204, 905, 7530, 39252, 50704, 2852, 3435, 5144, 290, 26300, 38745, 14, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func Test_isInteractive(t *testing.T) { // setup hDockerGrp, hLinuxGrp, err := createTestCgroupFiles() if err != nil { t.Fatal(err) } defer func() { // tear down removeTestFile(hDockerGrp) removeTestFile(hLinuxGrp) }() // stack emulation for before() and after() for storing global values strStack := make(chan string, 4) // TEST tests := []struct { name string before func() after func() want bool wantErr bool }{ {"docker", func() { strStack <- cgroupFile cgroupFile = hDockerGrp.Name() }, func() { cgroupFile = <-strStack }, true, false, }, {"linux", func() { strStack <- cgroupFile cgroupFile = hLinuxGrp.Name() }, func() { cgroupFile = <-strStack }, true, false, }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { tt.before() got, err := isInteractive() tt.after() if (err != nil) != tt.wantErr { t.Errorf("isInteractive() error = %v, wantErr %v", err, tt.wantErr) return } if got != tt.want { t.Errorf("isInteractive() = %v, want %v", got, tt.want) } }) } }
explode_data.jsonl/48582
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 585 }
[ 2830, 3393, 6892, 71686, 1155, 353, 8840, 836, 8, 8022, 197, 322, 6505, 319, 9598, 35, 13659, 6464, 79, 11, 305, 46324, 6464, 79, 11, 1848, 1669, 1855, 2271, 34, 4074, 10809, 3568, 743, 1848, 961, 2092, 972, 197, 3244, 26133, 3964, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestEmptryPrefixPoolIsNotPanics(t *testing.T) { var p *prefixpool.PrefixPool var err error require.NotPanics(t, func() { p, err = prefixpool.New() }) require.Nil(t, err) require.NotNil(t, p) }
explode_data.jsonl/45809
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 89 }
[ 2830, 3393, 28731, 1539, 14335, 10551, 3872, 2623, 35693, 1211, 1155, 353, 8840, 836, 8, 341, 2405, 281, 353, 11849, 10285, 1069, 5060, 10551, 198, 2405, 1848, 1465, 198, 17957, 15000, 35693, 1211, 1155, 11, 2915, 368, 341, 197, 3223, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestTx_OnCommit_Rollback(t *testing.T) { db := MustOpenDB() defer db.MustClose() var x int if err := db.Update(func(tx *bolt.Tx) error { tx.OnCommit(func() { x += 1 }) tx.OnCommit(func() { x += 2 }) if _, err := tx.CreateBucket([]byte("widgets")); err != nil { t.Fatal(err) } return errors.New("rollback this commit") }); err == nil || err.Error() != "rollback this commit" { t.Fatalf("unexpected error: %s", err) } else if x != 0 { t.Fatalf("unexpected x: %d", x) } }
explode_data.jsonl/1701
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 211 }
[ 2830, 3393, 31584, 35482, 33441, 2568, 965, 1419, 1155, 353, 8840, 836, 8, 341, 20939, 1669, 15465, 5002, 3506, 741, 16867, 2927, 50463, 7925, 2822, 2405, 856, 526, 198, 743, 1848, 1669, 2927, 16689, 18552, 27301, 353, 52433, 81362, 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 TestScan1(t *testing.T) { var ( ls *LineScanner gotBool bool hadFailed bool s string ) ls = &LineScanner{} gotBool = ls.Scan() hadFailed, s = tstCheckBool("'returned bool'", gotBool, false) //false is the want bool if hadFailed == true { t.Error(s) } }
explode_data.jsonl/57237
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 138 }
[ 2830, 3393, 26570, 16, 1155, 353, 8840, 836, 8, 341, 2405, 2399, 197, 197, 4730, 286, 353, 2460, 31002, 198, 197, 3174, 354, 11233, 256, 1807, 198, 197, 9598, 329, 9408, 1807, 198, 197, 1903, 260, 914, 198, 197, 340, 197, 4730, 284,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestTwoChar1(t *testing.T) { expected := "he" actual := twoChar("hello", 0) if strings.Compare(expected, actual) != 0 { t.Fatalf("expected \"%s\", but actual is \"%s\"", expected, actual) } }
explode_data.jsonl/75024
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 75 }
[ 2830, 3393, 11613, 4768, 16, 1155, 353, 8840, 836, 8, 341, 42400, 1669, 330, 383, 698, 88814, 1669, 1378, 4768, 445, 14990, 497, 220, 15, 340, 743, 9069, 32377, 15253, 11, 5042, 8, 961, 220, 15, 341, 197, 3244, 30762, 445, 7325, 323...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
2
func Test_SelectMany_int_int(t *testing.T) { type args struct { source Enumerator[int] selector func(int) Enumerator[int] } tests := []struct { name string args args want Enumerator[int] }{ {name: "1", args: args{ source: NewOnSlice(1, 2, 3, 4), selector: func(i int) Enumerator[int] { return NewOnSlice(i, i*i) }, }, want: NewOnSlice(1, 1, 2, 4, 3, 9, 4, 16), }, {name: "2", args: args{ source: NewOnSlice(1, 2, 3, 4), selector: func(i int) Enumerator[int] { if i%2 == 0 { return Empty[int]() } return NewOnSlice(i, i*i) }, }, want: NewOnSlice(1, 1, 3, 9), }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { if got, _ := SelectMany(tt.args.source, tt.args.selector); !SequenceEqualMust(got, tt.want) { got.Reset() tt.want.Reset() t.Errorf("SelectMany() = '%v', want '%v'", String(got), String(tt.want)) } }) } }
explode_data.jsonl/63897
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 487 }
[ 2830, 3393, 58073, 8441, 4042, 4042, 1155, 353, 8840, 836, 8, 341, 13158, 2827, 2036, 341, 197, 47418, 256, 76511, 18640, 921, 197, 197, 8925, 2915, 1548, 8, 76511, 18640, 921, 197, 532, 78216, 1669, 3056, 1235, 341, 197, 11609, 914, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestInitFileExists(t *testing.T) { folder := setupInitTest(t) cmd := newInitCmd().cmd path := filepath.Join(folder, "twice.yaml") cmd.SetArgs([]string{"-f", path}) require.NoError(t, cmd.Execute()) require.EqualError(t, cmd.Execute(), "open "+path+": file exists") require.FileExists(t, path) }
explode_data.jsonl/25330
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 118 }
[ 2830, 3393, 3803, 1703, 15575, 1155, 353, 8840, 836, 8, 341, 1166, 2018, 1669, 6505, 3803, 2271, 1155, 340, 25920, 1669, 501, 3803, 15613, 1005, 8710, 198, 26781, 1669, 26054, 22363, 33929, 11, 330, 15560, 558, 33406, 1138, 25920, 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