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 TestDontSelectRSAWithECDSAKey(t *testing.T) { // Test that, even when both sides support an RSA cipher suite, it // won't be selected if the server's private key doesn't support it. clientHello := &clientHelloMsg{ vers: VersionTLS12, random: make([]byte, 32), cipherSuites: []uint16{TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA}, compressionMethods: []uint8{compressionNone}, supportedCurves: []CurveID{CurveP256}, supportedPoints: []uint8{pointFormatUncompressed}, } serverConfig := testConfig.Clone() serverConfig.CipherSuites = clientHello.cipherSuites // First test that it *does* work when the server's key is RSA. testClientHello(t, serverConfig, clientHello) // Now test that switching to an ECDSA key causes the expected error // (and not an internal error about a signing failure). serverConfig.Certificates = make([]Certificate, 1) serverConfig.Certificates[0].Certificate = [][]byte{testECDSACertificate} serverConfig.Certificates[0].PrivateKey = testECDSAPrivateKey serverConfig.BuildNameToCertificate() testClientHelloFailure(t, serverConfig, clientHello, "no cipher suite supported by both client and server") }
explode_data.jsonl/36314
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 403 }
[ 2830, 3393, 35, 544, 3379, 73564, 2354, 7498, 72638, 1592, 1155, 353, 8840, 836, 8, 341, 197, 322, 3393, 429, 11, 1496, 979, 2176, 11067, 1824, 458, 45641, 31088, 16182, 11, 432, 198, 197, 322, 2765, 944, 387, 4091, 421, 279, 3538, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_Mock_AssertNumberOfCalls(t *testing.T) { var mockedService = new(TestExampleImplementation) mockedService.On("Test_Mock_AssertNumberOfCalls", 1, 2, 3).Return(5, 6, 7) mockedService.Called(1, 2, 3) assert.True(t, mockedService.AssertNumberOfCalls(t, "Test_Mock_AssertNumberOfCalls", 1)) mockedService.Called(1, 2, 3) assert.True(t, mockedService.AssertNumberOfCalls(t, "Test_Mock_AssertNumberOfCalls", 2)) }
explode_data.jsonl/8606
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 186 }
[ 2830, 3393, 1245, 1176, 62222, 529, 40619, 55292, 1155, 353, 8840, 836, 8, 8022, 2405, 46149, 1860, 284, 501, 31159, 13314, 36850, 7229, 2109, 67385, 1860, 8071, 445, 2271, 1245, 1176, 62222, 529, 40619, 55292, 497, 220, 16, 11, 220, 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 TestDecode(t *testing.T) { testCases := map[string]struct { Path epic.Path Serialized []byte }{ "Basic": { Path: epic.Path{ PktID: epic.PktID{ Timestamp: 1, Counter: 0x02000003, }, PHVF: []byte{1, 2, 3, 4}, LHVF: []byte{5, 6, 7, 8}, ScionPath: decodedScionPath, }, Serialized: rawEpicPath, }, } for name, tc := range testCases { name, tc := name, tc t.Run(name, func(t *testing.T) { got := epic.Path{} assert.NoError(t, got.DecodeFromBytes(tc.Serialized)) assert.Equal(t, tc.Path, got) }) } }
explode_data.jsonl/16862
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 302 }
[ 2830, 3393, 32564, 1155, 353, 8840, 836, 8, 341, 18185, 37302, 1669, 2415, 14032, 60, 1235, 341, 197, 69640, 981, 24679, 17474, 198, 197, 197, 77521, 3056, 3782, 198, 197, 59403, 197, 197, 1, 15944, 788, 341, 298, 69640, 25, 24679, 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 TestGetCategoryDetail(t *testing.T) { t.Log("Test catalogrepository category detail") catalogRepo := NewCatalogRepository(db) organization, err := catalogRepo.GetCategoryDetail(context.TODO(), "604488100f719d9c76a28fe5") assert.Nil(t, err) assert.Equal(t, organization.Name, "Steak") }
explode_data.jsonl/58786
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 111 }
[ 2830, 3393, 1949, 6746, 10649, 1155, 353, 8840, 836, 8, 341, 3244, 5247, 445, 2271, 16403, 23319, 5582, 7716, 5130, 1444, 7750, 25243, 1669, 1532, 41606, 4624, 9791, 692, 197, 23899, 11, 1848, 1669, 16403, 25243, 2234, 6746, 10649, 5378, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestSetGlobalLogger(t *testing.T) { defer globalLoggerBackup()() ctrl := gomock.NewController(t) defer ctrl.Finish() mockReceiver := mock_seelog.NewMockCustomReceiver(ctrl) mockReceiver.EXPECT().Flush().AnyTimes() mockReceiver.EXPECT().Close().AnyTimes() seeLog, err := seelog.LoggerFromCustomReceiver(mockReceiver) require.NoError(t, err) prevGlobalStructuredLogger := getGlobalStructuredLogger() setGlobalLogger(seeLog, jsonFmt) loggerMux.RLock() defer loggerMux.RUnlock() assert.Equal(t, seeLog, seelog.Current) assert.NotNil(t, globalStructuredLogger) assert.NotEqual(t, prevGlobalStructuredLogger, globalStructuredLogger) }
explode_data.jsonl/77977
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 245 }
[ 2830, 3393, 1649, 11646, 7395, 1155, 353, 8840, 836, 8, 341, 16867, 3644, 7395, 56245, 368, 2822, 84381, 1669, 342, 316, 1176, 7121, 2051, 1155, 340, 16867, 23743, 991, 18176, 741, 77333, 25436, 1669, 7860, 3453, 50571, 7121, 11571, 10268...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestIsScalar(t *testing.T) { tests := []struct { term string expected bool }{ {"null", true}, {`"string"`, true}, {"3.14", true}, {"false", true}, {"[1,2,3]", false}, {"{1,2,3}", false}, {`{"a": 1}`, false}, {`[x | x = 0]`, false}, } for _, tc := range tests { term := MustParseTerm(tc.term) if IsScalar(term.Value) != tc.expected { t.Errorf("Expected IsScalar(%v) = %v", term, tc.expected) } } }
explode_data.jsonl/2916
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 214 }
[ 2830, 3393, 3872, 20639, 1155, 353, 8840, 836, 8, 1476, 78216, 1669, 3056, 1235, 341, 197, 197, 4991, 257, 914, 198, 197, 42400, 1807, 198, 197, 59403, 197, 197, 4913, 2921, 497, 830, 1583, 197, 197, 90, 63, 1, 917, 1, 7808, 830, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestArrayOf(t *testing.T) { // check construction and use of type not in binary for _, table := range []struct { n int value func(i int) interface{} comparable bool want string }{ { n: 0, value: func(i int) interface{} { type Tint int; return Tint(i) }, comparable: true, want: "[]", }, { n: 10, value: func(i int) interface{} { type Tint int; return Tint(i) }, comparable: true, want: "[0 1 2 3 4 5 6 7 8 9]", }, { n: 10, value: func(i int) interface{} { type Tfloat float64; return Tfloat(i) }, comparable: true, want: "[0 1 2 3 4 5 6 7 8 9]", }, { n: 10, value: func(i int) interface{} { type Tstring string; return Tstring(strconv.Itoa(i)) }, comparable: true, want: "[0 1 2 3 4 5 6 7 8 9]", }, { n: 10, value: func(i int) interface{} { type Tstruct struct{ V int }; return Tstruct{i} }, comparable: true, want: "[{0} {1} {2} {3} {4} {5} {6} {7} {8} {9}]", }, { n: 10, value: func(i int) interface{} { type Tint int; return []Tint{Tint(i)} }, comparable: false, want: "[[0] [1] [2] [3] [4] [5] [6] [7] [8] [9]]", }, { n: 10, value: func(i int) interface{} { type Tint int; return [1]Tint{Tint(i)} }, comparable: true, want: "[[0] [1] [2] [3] [4] [5] [6] [7] [8] [9]]", }, { n: 10, value: func(i int) interface{} { type Tstruct struct{ V [1]int }; return Tstruct{[1]int{i}} }, comparable: true, want: "[{[0]} {[1]} {[2]} {[3]} {[4]} {[5]} {[6]} {[7]} {[8]} {[9]}]", }, { n: 10, value: func(i int) interface{} { type Tstruct struct{ V []int }; return Tstruct{[]int{i}} }, comparable: false, want: "[{[0]} {[1]} {[2]} {[3]} {[4]} {[5]} {[6]} {[7]} {[8]} {[9]}]", }, { n: 10, value: func(i int) interface{} { type TstructUV struct{ U, V int }; return TstructUV{i, i} }, comparable: true, want: "[{0 0} {1 1} {2 2} {3 3} {4 4} {5 5} {6 6} {7 7} {8 8} {9 9}]", }, { n: 10, value: func(i int) interface{} { type TstructUV struct { U int V float64 } return TstructUV{i, float64(i)} }, comparable: true, want: "[{0 0} {1 1} {2 2} {3 3} {4 4} {5 5} {6 6} {7 7} {8 8} {9 9}]", }, } { at := ArrayOf(table.n, TypeOf(table.value(0))) v := New(at).Elem() vok := New(at).Elem() vnot := New(at).Elem() for i := 0; i < v.Len(); i++ { v.Index(i).Set(ValueOf(table.value(i))) vok.Index(i).Set(ValueOf(table.value(i))) j := i if i+1 == v.Len() { j = i + 1 } vnot.Index(i).Set(ValueOf(table.value(j))) // make it differ only by last element } s := fmt.Sprint(v.Interface()) if s != table.want { t.Errorf("constructed array = %s, want %s", s, table.want) } if table.comparable != at.Comparable() { t.Errorf("constructed array (%#v) is comparable=%v, want=%v", v.Interface(), at.Comparable(), table.comparable) } if table.comparable { if table.n > 0 { if DeepEqual(vnot.Interface(), v.Interface()) { t.Errorf( "arrays (%#v) compare ok (but should not)", v.Interface(), ) } } if !DeepEqual(vok.Interface(), v.Interface()) { t.Errorf( "arrays (%#v) compare NOT-ok (but should)", v.Interface(), ) } } } // check that type already in binary is found type T int checkSameType(t, Zero(ArrayOf(5, TypeOf(T(1)))).Interface(), [5]T{}) }
explode_data.jsonl/29593
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1868 }
[ 2830, 3393, 62656, 1155, 353, 8840, 836, 8, 341, 197, 322, 1779, 8086, 323, 990, 315, 943, 537, 304, 7868, 198, 2023, 8358, 1965, 1669, 2088, 3056, 1235, 341, 197, 9038, 688, 526, 198, 197, 16309, 414, 2915, 1956, 526, 8, 3749, 1609...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestAccDataSourceCosmicNetworkACL_basic(t *testing.T) { var aclList cosmic.NetworkACLList resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccDataSourceCosmicNetworkACL_basic, Check: resource.ComposeTestCheckFunc( testAccCheckCosmicNetworkACLDataSourceExists("data.cosmic_network_acl.default_allow", &aclList), testAccCheckCosmicNetworkACLDataSourceAttributes(&aclList), ), }, }, }) }
explode_data.jsonl/60726
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 205 }
[ 2830, 3393, 14603, 17173, 54224, 21220, 12320, 55393, 34729, 1155, 353, 8840, 836, 8, 341, 2405, 57120, 852, 54701, 30149, 55393, 852, 271, 50346, 41288, 7957, 2271, 1155, 11, 5101, 31363, 515, 197, 197, 4703, 3973, 25, 220, 2915, 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, 1, 1...
1
func TestHandlerFactory(t *testing.T) { tests := []struct { name string factory factory want handler }{ { name: "SimpleCreate", factory: &handlerFactory{}, want: &stackInstallHandler{ kube: nil, jobCompleter: &stackInstallJobCompleter{client: nil, podLogReader: &K8sReader{Client: nil}}, executorInfo: &stacks.ExecutorInfo{Image: stackPackageImage}, ext: resource(), }, }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { got := tt.factory.newHandler(ctx, resource(), nil, nil, &stacks.ExecutorInfo{Image: stackPackageImage}) diff := cmp.Diff(tt.want, got, cmp.AllowUnexported( stackInstallHandler{}, stackInstallJobCompleter{}, K8sReader{}, )) if diff != "" { t.Errorf("newHandler() -want, +got:\n%v", diff) } }) } }
explode_data.jsonl/11562
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 380 }
[ 2830, 3393, 3050, 4153, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 3056, 1235, 341, 197, 11609, 262, 914, 198, 197, 1166, 2919, 8633, 198, 197, 50780, 262, 7013, 198, 197, 59403, 197, 197, 515, 298, 11609, 25, 262, 330, 16374, 4021, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestNewRsaPublicFailsWhenRsaExponentIsInvalid(t *testing.T) { // Setup var jwk jose.PublicRsaKey jwk.SetAlg(jose.AlgPS256) jwk.SetOps([]jose.KeyOps{jose.KeyOpsVerify}) jwk.N.SetBytes([]byte("AABABB")) jwk.E.SetBytes([]byte("=====")) // Act k, err := NewVerificationKey(&jwk) // Assert require.Equal(t, ErrInvalidExponent, err) require.Nil(t, k) }
explode_data.jsonl/20931
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 164 }
[ 2830, 3393, 3564, 49, 9081, 12676, 37, 6209, 4498, 49, 9081, 840, 1146, 3872, 7928, 1155, 353, 8840, 836, 8, 341, 197, 322, 18626, 198, 2405, 502, 50522, 89644, 49139, 49, 9081, 1592, 198, 12428, 50522, 4202, 86895, 3325, 960, 9636, 7...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestHDWalletDefaults(t *testing.T) { assert := assert.New(t) hd := newHDWallet(&HDWalletConf{}).(*hdWallet) assert.Equal(defaultAddressProp, hd.conf.PropNames.Address) assert.Equal(defaultPrivateKeyProp, hd.conf.PropNames.PrivateKey) }
explode_data.jsonl/33502
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 88 }
[ 2830, 3393, 19147, 38259, 16273, 1155, 353, 8840, 836, 8, 341, 6948, 1669, 2060, 7121, 1155, 692, 9598, 67, 1669, 501, 19147, 38259, 2099, 19147, 38259, 15578, 6257, 568, 4071, 15990, 38259, 692, 6948, 12808, 18978, 4286, 2008, 11, 17907,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestCloudTasksTestIamPermissions(t *testing.T) { var expectedResponse *iampb.TestIamPermissionsResponse = &iampb.TestIamPermissionsResponse{} mockCloudTasks.err = nil mockCloudTasks.reqs = nil mockCloudTasks.resps = append(mockCloudTasks.resps[:0], expectedResponse) var formattedResource string = fmt.Sprintf("projects/%s/locations/%s/queues/%s", "[PROJECT]", "[LOCATION]", "[QUEUE]") var permissions []string = nil var request = &iampb.TestIamPermissionsRequest{ Resource: formattedResource, Permissions: permissions, } c, err := NewClient(context.Background(), clientOpt) if err != nil { t.Fatal(err) } resp, err := c.TestIamPermissions(context.Background(), request) if err != nil { t.Fatal(err) } if want, got := request, mockCloudTasks.reqs[0]; !proto.Equal(want, got) { t.Errorf("wrong request %q, want %q", got, want) } if want, got := expectedResponse, resp; !proto.Equal(want, got) { t.Errorf("wrong response %q, want %q)", got, want) } }
explode_data.jsonl/30859
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 372 }
[ 2830, 3393, 16055, 25449, 2271, 40, 309, 23851, 1155, 353, 8840, 836, 8, 341, 2405, 3601, 2582, 353, 72, 1121, 65, 8787, 40, 309, 23851, 2582, 284, 609, 72, 1121, 65, 8787, 40, 309, 23851, 2582, 31483, 77333, 16055, 25449, 18441, 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...
5
func TestFixImportsVendorPackage(t *testing.T) { // Skip this test on go versions with no vendor support. if _, err := os.Stat(filepath.Join(runtime.GOROOT(), "src/vendor")); err != nil { t.Skip(err) } testConfig{ gopathFiles: map[string]string{ "mypkg.com/outpkg/vendor/mypkg.com/mypkg.v1/f.go": "package mypkg\nvar Foo = 123\n", }, }.test(t, func(t *goimportTest) { input := `package p import ( "fmt" "mypkg.com/mypkg.v1" ) var ( _ = fmt.Print _ = mypkg.Foo ) ` buf, err := Process(filepath.Join(t.gopath, "src/mypkg.com/outpkg/toformat.go"), []byte(input), &Options{}) if err != nil { t.Fatal(err) } if got := string(buf); got != input { t.Fatalf("results differ\nGOT:\n%s\nWANT:\n%s\n", got, input) } }) }
explode_data.jsonl/12424
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 340 }
[ 2830, 3393, 25958, 31250, 44691, 13100, 1155, 353, 8840, 836, 8, 341, 197, 322, 25784, 419, 1273, 389, 728, 10795, 448, 902, 20728, 1824, 624, 743, 8358, 1848, 1669, 2643, 53419, 34793, 22363, 89467, 1224, 868, 53837, 1507, 330, 3548, 3...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func Test_OptionsResource_StatusARM_WhenSerializedToJson_DeserializesAsEqual(t *testing.T) { t.Parallel() parameters := gopter.DefaultTestParameters() parameters.MaxSize = 10 properties := gopter.NewProperties(parameters) properties.Property( "Round trip of OptionsResource_StatusARM via JSON returns original", prop.ForAll(RunJSONSerializationTestForOptionsResourceStatusARM, OptionsResourceStatusARMGenerator())) properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout)) }
explode_data.jsonl/9505
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 152 }
[ 2830, 3393, 86101, 4783, 36449, 17911, 62, 4498, 77521, 78967, 98054, 2848, 4756, 2121, 2993, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 741, 67543, 1669, 728, 73137, 13275, 2271, 9706, 741, 67543, 14535, 1695, 284, 220, 16, 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...
1
func TestTaskPrintWithGlobalService(t *testing.T) { quiet := false trunc := false noResolve := true apiClient := &fakeClient{} cli := test.NewFakeCli(apiClient) tasks := []swarm.Task{ *Task(TaskServiceID("service-id-foo"), TaskNodeID("node-id-bar"), TaskSlot(0)), } err := Print(context.Background(), cli, tasks, idresolver.New(apiClient, noResolve), trunc, quiet, "{{ .Name }}") assert.NilError(t, err) golden.Assert(t, cli.OutBuffer().String(), "task-print-with-global-service.golden") }
explode_data.jsonl/43886
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 186 }
[ 2830, 3393, 6262, 8994, 2354, 11646, 1860, 1155, 353, 8840, 836, 8, 341, 197, 43650, 1669, 895, 198, 25583, 1347, 1669, 895, 198, 72104, 56808, 1669, 830, 198, 54299, 2959, 1669, 609, 30570, 2959, 16094, 86448, 1669, 1273, 7121, 52317, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestContextWithSignals(t *testing.T) { ctx, cancel := ContextWithSignals(context.TODO(), os.Interrupt) defer cancel() syscall.Kill(syscall.Getpid(), syscall.SIGINT) <-ctx.Done() require.Error(t, ctx.Err()) }
explode_data.jsonl/55726
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 87 }
[ 2830, 3393, 1972, 2354, 96659, 1155, 353, 8840, 836, 8, 341, 20985, 11, 9121, 1669, 9608, 2354, 96659, 5378, 90988, 1507, 2643, 7371, 10579, 340, 16867, 9121, 2822, 41709, 6659, 11352, 483, 18140, 6659, 2234, 10412, 1507, 49345, 85086, 32...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
func Test_pollQueue(t *testing.T) { tests := []struct { name string client *mockSQSclient err bool }{ { name: "poll SQS queue", client: &mockSQSclient{ receiveMessages: []types.Message{ { MessageId: aws.String("dc909f9a-377b-cc13-627d-6fdbc2ea458c"), Body: aws.String(`{"detail-type":"Tag Change on Resource","source":"aws.tag"}`), }, }, }, err: false, }, { name: "poll SQS queue - no messages", client: &mockSQSclient{ receiveMessages: []types.Message{}, }, err: false, }, { name: "poll SQS queue - prettyJSON", client: &mockSQSclient{ receiveMessages: []types.Message{ { MessageId: aws.String("dc909f9a-377b-cc13-627d-6fdbc2ea458c"), Body: aws.String(`{"detail-type":"Tag Change on Resource","source":"aws.tag"}`), }, }, }, err: false, }, } for _, test := range tests { t.Run(test.name, func(t *testing.T) { signalChan := make(chan os.Signal, 1) client := &sqsClient{ client: test.client, queueURL: queueURL, } go client.pollQueue(context.Background(), signalChan, true) time.Sleep(2 * time.Second) signalChan <- os.Interrupt }) } }
explode_data.jsonl/40275
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 576 }
[ 2830, 3393, 40002, 7554, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 3056, 1235, 341, 197, 11609, 914, 271, 197, 25291, 353, 16712, 64308, 50, 2972, 271, 197, 9859, 1807, 198, 197, 59403, 197, 197, 515, 298, 11609, 25, 330, 30141, 5161...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestPluginManager_Init(t *testing.T) { origRootPath := setting.StaticRootPath origRaw := setting.Raw origEnv := setting.Env t.Cleanup(func() { setting.StaticRootPath = origRootPath setting.Raw = origRaw setting.Env = origEnv }) var err error setting.StaticRootPath, err = filepath.Abs("../../public/") require.NoError(t, err) setting.Raw = ini.Empty() setting.Env = setting.Prod t.Run("Base case", func(t *testing.T) { pm := &PluginManager{ Cfg: &setting.Cfg{ PluginSettings: setting.PluginSettings{ "nginx-app": map[string]string{ "path": "testdata/test-app", }, }, }, } err := pm.Init() require.NoError(t, err) assert.Empty(t, pm.scanningErrors) assert.Greater(t, len(DataSources), 1) assert.Greater(t, len(Panels), 1) assert.Equal(t, "app/plugins/datasource/graphite/module", DataSources["graphite"].Module) assert.NotEmpty(t, Apps) assert.Equal(t, "public/plugins/test-app/img/logo_large.png", Apps["test-app"].Info.Logos.Large) assert.Equal(t, "public/plugins/test-app/img/screenshot2.png", Apps["test-app"].Info.Screenshots[1].Path) }) t.Run("With external back-end plugin lacking signature", func(t *testing.T) { origPluginsPath := setting.PluginsPath t.Cleanup(func() { setting.PluginsPath = origPluginsPath }) setting.PluginsPath = "testdata/unsigned" pm := &PluginManager{ Cfg: &setting.Cfg{}, } err := pm.Init() require.NoError(t, err) assert.Equal(t, []error{fmt.Errorf(`plugin "test" is unsigned`)}, pm.scanningErrors) }) t.Run("With external unsigned back-end plugin and configuration disabling signature check of this plugin", func(t *testing.T) { origPluginsPath := setting.PluginsPath t.Cleanup(func() { setting.PluginsPath = origPluginsPath }) setting.PluginsPath = "testdata/unsigned" pm := &PluginManager{ Cfg: &setting.Cfg{ PluginsAllowUnsigned: []string{"test"}, }, BackendPluginManager: &fakeBackendPluginManager{}, } err := pm.Init() require.NoError(t, err) assert.Empty(t, pm.scanningErrors) }) t.Run("With external back-end plugin with invalid signature", func(t *testing.T) { origPluginsPath := setting.PluginsPath t.Cleanup(func() { setting.PluginsPath = origPluginsPath }) setting.PluginsPath = "testdata/invalid-signature" pm := &PluginManager{ Cfg: &setting.Cfg{}, } err := pm.Init() require.NoError(t, err) assert.Equal(t, []error{fmt.Errorf(`plugin "test" has an invalid signature`)}, pm.scanningErrors) }) t.Run("With external back-end plugin lacking files listed in manifest", func(t *testing.T) { origPluginsPath := setting.PluginsPath t.Cleanup(func() { setting.PluginsPath = origPluginsPath }) setting.PluginsPath = "testdata/lacking-files" fm := &fakeBackendPluginManager{} pm := &PluginManager{ Cfg: &setting.Cfg{}, BackendPluginManager: fm, } err := pm.Init() require.NoError(t, err) assert.Equal(t, []error{fmt.Errorf(`plugin "test"'s signature has been modified`)}, pm.scanningErrors) }) t.Run("Transform plugins should be ignored when expressions feature is off", func(t *testing.T) { origPluginsPath := setting.PluginsPath t.Cleanup(func() { setting.PluginsPath = origPluginsPath }) setting.PluginsPath = "testdata/behind-feature-flag" fm := fakeBackendPluginManager{} pm := &PluginManager{ Cfg: &setting.Cfg{}, BackendPluginManager: &fm, } err := pm.Init() require.NoError(t, err) assert.Empty(t, pm.scanningErrors) assert.Empty(t, fm.registeredPlugins) }) t.Run("Transform plugins should be loaded when expressions feature is on", func(t *testing.T) { origPluginsPath := setting.PluginsPath t.Cleanup(func() { setting.PluginsPath = origPluginsPath }) setting.PluginsPath = "testdata/behind-feature-flag" fm := &fakeBackendPluginManager{} pm := &PluginManager{ Cfg: &setting.Cfg{ FeatureToggles: map[string]bool{ "expressions": true, }, }, BackendPluginManager: fm, } err := pm.Init() require.NoError(t, err) require.Empty(t, pm.scanningErrors) assert.Equal(t, []string{"gel"}, fm.registeredPlugins) }) t.Run("With nested plugin duplicating parent", func(t *testing.T) { origPluginsPath := setting.PluginsPath t.Cleanup(func() { setting.PluginsPath = origPluginsPath }) setting.PluginsPath = "testdata/duplicate-plugins" pm := &PluginManager{ Cfg: &setting.Cfg{}, } err := pm.Init() require.NoError(t, err) assert.Len(t, pm.scanningErrors, 1) assert.True(t, errors.Is(pm.scanningErrors[0], duplicatePluginError{})) }) }
explode_data.jsonl/62176
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1846 }
[ 2830, 3393, 11546, 2043, 15644, 1155, 353, 8840, 836, 8, 341, 197, 4670, 8439, 1820, 1669, 6243, 58826, 8439, 1820, 198, 197, 4670, 20015, 1669, 6243, 50575, 198, 197, 4670, 14359, 1669, 6243, 81214, 198, 3244, 727, 60639, 18552, 368, 3...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestLocalResolve(t *testing.T) { image := imagestore.Image{ ID: "sha256:c75bebcdd211f41b3a460c7bf82970ed6c75acaab9cd4c9a4e125b03ca113799", ChainID: "test-chain-id-1", References: []string{ "docker.io/library/busybox:latest", "docker.io/library/busybox@sha256:e6693c20186f837fc393390135d8a598a96a833917917789d63766cab6c59582", }, Size: 10, } c := newTestCRIService() var err error c.imageStore, err = imagestore.NewFakeStore([]imagestore.Image{image}) assert.NoError(t, err) for _, ref := range []string{ "sha256:c75bebcdd211f41b3a460c7bf82970ed6c75acaab9cd4c9a4e125b03ca113799", "busybox", "busybox:latest", "busybox@sha256:e6693c20186f837fc393390135d8a598a96a833917917789d63766cab6c59582", "library/busybox", "library/busybox:latest", "library/busybox@sha256:e6693c20186f837fc393390135d8a598a96a833917917789d63766cab6c59582", "docker.io/busybox", "docker.io/busybox:latest", "docker.io/busybox@sha256:e6693c20186f837fc393390135d8a598a96a833917917789d63766cab6c59582", "docker.io/library/busybox", "docker.io/library/busybox:latest", "docker.io/library/busybox@sha256:e6693c20186f837fc393390135d8a598a96a833917917789d63766cab6c59582", } { img, err := c.localResolve(ref) assert.NoError(t, err) assert.Equal(t, image, img) } img, err := c.localResolve("randomid") assert.Equal(t, errdefs.IsNotFound(err), true) assert.Equal(t, imagestore.Image{}, img) }
explode_data.jsonl/8826
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 701 }
[ 2830, 3393, 7319, 56808, 1155, 353, 8840, 836, 8, 341, 31426, 1669, 2168, 4314, 7528, 515, 197, 29580, 25, 414, 330, 15247, 17, 20, 21, 48031, 22, 20, 1371, 8904, 631, 17, 16, 16, 69, 19, 16, 65, 18, 64, 19, 21, 15, 66, 22, 13...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestDeleteJob_DbFailure(t *testing.T) { store, manager, job := initWithJob(t) defer store.Close() store.DB().Close() err := manager.DeleteJob(job.UUID) assert.Equal(t, codes.Internal, err.(*util.UserError).ExternalStatusCode()) assert.Contains(t, err.Error(), "database is closed") }
explode_data.jsonl/28388
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 104 }
[ 2830, 3393, 6435, 12245, 60968, 17507, 1155, 353, 8840, 836, 8, 341, 57279, 11, 6645, 11, 2618, 1669, 13864, 12245, 1155, 340, 16867, 3553, 10421, 2822, 57279, 22537, 1005, 7925, 741, 9859, 1669, 6645, 18872, 12245, 28329, 39636, 340, 694...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestEvenHandler3(t *testing.T) { eh, id := Bus() defer eh.Unsubscribe(id) ch := make(chan Event, 100) err := eh.SubscribeP(id, "EventWorkerError", ch) require.Error(t, err) }
explode_data.jsonl/29025
{ "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, 13159, 3050, 18, 1155, 353, 8840, 836, 8, 341, 197, 2636, 11, 877, 1669, 18598, 741, 16867, 35246, 10616, 9384, 3724, 692, 23049, 1669, 1281, 35190, 3665, 11, 220, 16, 15, 15, 340, 9859, 1669, 35246, 82628, 47, 3724, 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
func Test_getCanonicalChoiceIndexError(t *testing.T) { pd1 := perBitData{ bytes: []byte{0x40, 0x80, 0xFF, 0x00}, byteOffset: 0, bitsOffset: 2, } err1 := pd1.getCanonicalChoiceIndex() assert.Nil(t, err1) pd2 := perBitData{ bytes: []byte{0x40, 0x0F}, byteOffset: 0, bitsOffset: 2, } err2 := pd2.getCanonicalChoiceIndex() assert.Nil(t, err2) pd3 := perBitData{ bytes: []byte{0x40, 0x7F, 0x00, 0x00, 0x00}, byteOffset: 0, bitsOffset: 2, } err3 := pd3.getCanonicalChoiceIndex() assert.Nil(t, err3) }
explode_data.jsonl/71329
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 273 }
[ 2830, 3393, 3062, 70914, 24728, 1552, 1454, 1155, 353, 8840, 836, 8, 341, 3223, 67, 16, 1669, 817, 8344, 1043, 515, 197, 70326, 25, 414, 3056, 3782, 90, 15, 87, 19, 15, 11, 220, 15, 87, 23, 15, 11, 220, 15, 9264, 11, 220, 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 TestStreamCancelled(t *testing.T) { // Since the cancel message is unimplemented, the relay does not know that the // call was cancelled, andwill block closing till the timeout. opts := testutils.NewOpts().NoRelay() testutils.WithTestServer(t, opts, func(t testing.TB, ts *testutils.TestServer) { ts.Register(streamPartialHandler(t, false /* report errors */), "echoStream") ctx, cancel := NewContext(testutils.Timeout(time.Second)) defer cancel() helper := streamHelper{t} client := ts.NewClient(nil) cancelContext := make(chan struct{}) arg3Writer, arg3Reader := helper.startCall(ctx, client, ts.HostPort(), ts.ServiceName()) go func() { for i := 0; i < 10; i++ { assert.NoError(t, writeFlushBytes(arg3Writer, []byte{1}), "Write failed") } // Our reads and writes should fail now. <-cancelContext cancel() _, err := arg3Writer.Write([]byte{1}) // The write will succeed since it's buffered. assert.NoError(t, err, "Write after fail should be buffered") assert.Error(t, arg3Writer.Flush(), "writer.Flush should fail after cancel") assert.Error(t, arg3Writer.Close(), "writer.Close should fail after cancel") }() for i := 0; i < 10; i++ { arg3 := make([]byte, 1) n, err := arg3Reader.Read(arg3) assert.Equal(t, 1, n, "Read did not correct number of bytes") assert.NoError(t, err, "Read failed") } close(cancelContext) n, err := io.Copy(ioutil.Discard, arg3Reader) assert.EqualValues(t, 0, n, "Read should not read any bytes after cancel") assert.Error(t, err, "Read should fail after cancel") assert.Error(t, arg3Reader.Close(), "reader.Close should fail after cancel") // Close the client to clear out the pending exchange. Otherwise the test // waits for the timeout, causing a slowdown. client.Close() }) }
explode_data.jsonl/55428
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 642 }
[ 2830, 3393, 3027, 39473, 1155, 353, 8840, 836, 8, 341, 197, 322, 8704, 279, 9121, 1943, 374, 650, 54071, 11, 279, 31851, 1558, 537, 1414, 429, 279, 198, 197, 322, 1618, 572, 25681, 11, 323, 14387, 2504, 15316, 11956, 279, 9632, 624, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestSendTraceDataServerDownAndUp(t *testing.T) { // Find the addr, but don't start the server. ln, err := net.Listen("tcp", "localhost:") require.NoError(t, err, "Failed to find an available address to run the gRPC server: %v", err) // Start an OTLP exporter and point to the receiver. config := Config{ GRPCSettings: configgrpc.GRPCSettings{ Endpoint: ln.Addr().String(), }, } factory := &Factory{} creationParams := component.ExporterCreateParams{Logger: zap.NewNop()} exp, err := factory.CreateTraceExporter(context.Background(), creationParams, &config) require.NoError(t, err) require.NotNil(t, exp) defer func() { assert.NoError(t, exp.Shutdown(context.Background())) }() host := componenttest.NewNopHost() assert.NoError(t, exp.Start(context.Background(), host)) // A trace with 2 spans. td := testdata.GenerateTraceDataTwoSpansSameResource() ctx, cancel := context.WithTimeout(context.Background(), 1*time.Second) assert.Error(t, exp.ConsumeTraces(ctx, td)) assert.EqualValues(t, context.DeadlineExceeded, ctx.Err()) cancel() ctx, cancel = context.WithTimeout(context.Background(), 1*time.Second) assert.Error(t, exp.ConsumeTraces(ctx, td)) assert.EqualValues(t, context.DeadlineExceeded, ctx.Err()) cancel() startServerAndMakeRequest(t, exp, td, ln) ctx, cancel = context.WithTimeout(context.Background(), 1*time.Second) assert.Error(t, exp.ConsumeTraces(ctx, td)) assert.EqualValues(t, context.DeadlineExceeded, ctx.Err()) cancel() // First call to startServerAndMakeRequest closed the connection. There is a race condition here that the // port may be reused, if this gets flaky rethink what to do. ln, err = net.Listen("tcp", ln.Addr().String()) require.NoError(t, err, "Failed to find an available address to run the gRPC server: %v", err) startServerAndMakeRequest(t, exp, td, ln) ctx, cancel = context.WithTimeout(context.Background(), 1*time.Second) assert.Error(t, exp.ConsumeTraces(ctx, td)) assert.EqualValues(t, context.DeadlineExceeded, ctx.Err()) cancel() }
explode_data.jsonl/81766
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 717 }
[ 2830, 3393, 11505, 6550, 1043, 5475, 4454, 3036, 2324, 1155, 353, 8840, 836, 8, 341, 197, 322, 7379, 279, 10789, 11, 714, 1513, 944, 1191, 279, 3538, 624, 197, 2261, 11, 1848, 1669, 4179, 68334, 445, 27161, 497, 330, 8301, 34403, 1795...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestCancelInvoice(t *testing.T) { // Test cancellation both with garbage collection (meaning that canceled // invoice will be deleted) and without (meain it'll be kept). t.Run("garbage collect", func(t *testing.T) { testCancelInvoice(t, true) }) t.Run("no garbage collect", func(t *testing.T) { testCancelInvoice(t, false) }) }
explode_data.jsonl/59111
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 117 }
[ 2830, 3393, 9269, 34674, 1155, 353, 8840, 836, 8, 341, 197, 322, 3393, 35835, 2176, 448, 25878, 4426, 320, 56765, 429, 33446, 198, 197, 322, 24615, 686, 387, 11062, 8, 323, 2041, 320, 2660, 466, 432, 3278, 387, 8604, 4292, 3244, 16708...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestNative_VstringHangUpOnRandomData(t *testing.T) { v, e := hex.DecodeString( "228dc61efd54ef80a908fb6026b7f2d5f92a257ba8b347c995f259eb8685376a" + "8c4500262d9c308b3f3ec2577689cf345d9f86f9b5d18d3e463bec5c22df2d2e" + "4506010eba1dae7278", ) assert.Nil(t, e) p := 1 s := rt.Mem2Str(v) var js types.JsonState __vstring(&s, &p, &js) fmt.Printf("js: %s\n", spew.Sdump(js)) }
explode_data.jsonl/60918
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 247 }
[ 2830, 3393, 20800, 2334, 917, 57038, 2324, 1925, 13999, 1043, 1155, 353, 8840, 836, 8, 341, 262, 348, 11, 384, 1669, 12371, 56372, 703, 1006, 286, 330, 17, 17, 23, 7628, 21, 16, 93678, 20, 19, 823, 23, 15, 64, 24, 15, 23, 10798, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestInputName(t *testing.T) { t.Parallel() in := "(" want := "some-file.sh:1:1: reached EOF without matching ( with )" p := NewParser() _, err := p.Parse(strings.NewReader(in), "some-file.sh") if err == nil { t.Fatalf("Expected error in %q: %v", in, want) } got := err.Error() if got != want { t.Fatalf("Error mismatch in %q\nwant: %s\ngot: %s", in, want, got) } }
explode_data.jsonl/55125
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 170 }
[ 2830, 3393, 2505, 675, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 741, 17430, 1669, 33579, 198, 50780, 1669, 330, 14689, 14203, 2395, 25, 16, 25, 16, 25, 8643, 29457, 2041, 12579, 320, 448, 873, 698, 3223, 1669, 1532, 6570, 741,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestGetDockerServerVersion(t *testing.T) { fakeDocker := &FakeDockerClient{VersionInfo: docker.Env{"Client version=1.2", "Server version=1.1.3", "Server API version=1.15"}} runner := dockerContainerCommandRunner{fakeDocker} version, err := runner.getDockerServerVersion() if err != nil { t.Errorf("got error while getting docker server version - %s", err) } expectedVersion := []uint{1, 1, 3} if len(expectedVersion) != len(version) { t.Errorf("invalid docker server version. expected: %v, got: %v", expectedVersion, version) } else { for idx, val := range expectedVersion { if version[idx] != val { t.Errorf("invalid docker server version. expected: %v, got: %v", expectedVersion, version) } } } }
explode_data.jsonl/23972
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 253 }
[ 2830, 3393, 1949, 35, 13659, 5475, 5637, 1155, 353, 8840, 836, 8, 341, 1166, 726, 35, 13659, 1669, 609, 52317, 35, 13659, 2959, 90, 5637, 1731, 25, 26588, 81214, 4913, 2959, 2319, 28, 16, 13, 17, 497, 330, 5475, 2319, 28, 16, 13, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
5
func TestPgRepository_GetByExternalTenant(t *testing.T) { t.Run("Success", func(t *testing.T) { // GIVEN tenantMappingModel := newModelBusinessTenantMapping(testID, testName) tenantMappingEntity := newEntityBusinessTenantMapping(testID, testName) mockConverter := &automock.Converter{} defer mockConverter.AssertExpectations(t) mockConverter.On("FromEntity", tenantMappingEntity).Return(tenantMappingModel).Once() db, dbMock := testdb.MockDatabase(t) defer dbMock.AssertExpectations(t) rowsToReturn := fixSQLRows([]sqlRow{ {id: testID, name: testName, externalTenant: testExternal, parent: sql.NullString{}, typeRow: string(tenantEntity.Account), provider: "Compass", status: tenantEntity.Active}, }) dbMock.ExpectQuery(regexp.QuoteMeta(`SELECT id, external_name, external_tenant, parent, type, provider_name, status FROM public.business_tenant_mappings WHERE external_tenant = $1 AND status != $2 `)). WithArgs(testExternal, tenantEntity.Inactive). WillReturnRows(rowsToReturn) ctx := persistence.SaveToContext(context.TODO(), db) tenantMappingRepo := tenant.NewRepository(mockConverter) // WHEN result, err := tenantMappingRepo.GetByExternalTenant(ctx, testExternal) // THEN require.NoError(t, err) require.NotNil(t, result) assert.Equal(t, tenantMappingModel, result) }) t.Run("Error when getting", func(t *testing.T) { // GIVEN mockConverter := &automock.Converter{} defer mockConverter.AssertExpectations(t) db, dbMock := testdb.MockDatabase(t) defer dbMock.AssertExpectations(t) dbMock.ExpectQuery(regexp.QuoteMeta(`SELECT id, external_name, external_tenant, parent, type, provider_name, status FROM public.business_tenant_mappings WHERE external_tenant = $1 AND status != $ `)). WithArgs(testExternal, tenantEntity.Inactive). WillReturnError(testError) ctx := persistence.SaveToContext(context.TODO(), db) tenantMappingRepo := tenant.NewRepository(mockConverter) // WHEN result, err := tenantMappingRepo.GetByExternalTenant(ctx, testExternal) // THEN require.Error(t, err) assert.EqualError(t, err, "Internal Server Error: Unexpected error while executing SQL query") require.Nil(t, result) }) }
explode_data.jsonl/23361
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 796 }
[ 2830, 3393, 82540, 4624, 13614, 1359, 25913, 71252, 1155, 353, 8840, 836, 8, 341, 3244, 16708, 445, 7188, 497, 2915, 1155, 353, 8840, 836, 8, 341, 197, 197, 322, 89836, 198, 197, 197, 43919, 6807, 1712, 1669, 501, 1712, 22727, 71252, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestReplaceMSI(t *testing.T) { v := &Value{data: []map[string]interface{}{map[string]interface{}(map[string]interface{}{"name": "Tyler"}), map[string]interface{}(map[string]interface{}{"name": "Tyler"}), map[string]interface{}(map[string]interface{}{"name": "Tyler"}), map[string]interface{}(map[string]interface{}{"name": "Tyler"}), map[string]interface{}(map[string]interface{}{"name": "Tyler"}), map[string]interface{}(map[string]interface{}{"name": "Tyler"})}} rawArr := v.MustMSISlice() replaced := v.ReplaceMSI(func(index int, val map[string]interface{}) map[string]interface{} { if index < len(rawArr)-1 { return rawArr[index+1] } return rawArr[0] }) replacedArr := replaced.MustMSISlice() if assert.Equal(t, 6, len(replacedArr)) { assert.Equal(t, replacedArr[0], rawArr[1]) assert.Equal(t, replacedArr[1], rawArr[2]) assert.Equal(t, replacedArr[2], rawArr[3]) assert.Equal(t, replacedArr[3], rawArr[4]) assert.Equal(t, replacedArr[4], rawArr[5]) assert.Equal(t, replacedArr[5], rawArr[0]) } }
explode_data.jsonl/23390
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 428 }
[ 2830, 3393, 23107, 4826, 40, 1155, 353, 8840, 836, 8, 1476, 5195, 1669, 609, 1130, 90, 691, 25, 3056, 2186, 14032, 31344, 6257, 90, 2186, 14032, 31344, 6257, 7, 2186, 14032, 31344, 6257, 4913, 606, 788, 330, 99124, 9207, 701, 2415, 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 TestConverterRecursiveCyclic(t *testing.T) { fieldMap := make(map[string]codegen.FieldMapperEntry) lines, err := convertTypes( "Foo", "Bar", ` struct StringFooA { 1: required string one 2: optional StringFooB fooB } struct StringFooB { 1: required string two 2: optional StringFooA fooA } struct Foo { 1: required string three 2: required StringFooA recur } struct Bar { 1: required string three 2: required StringFooA recur }`, nil, fieldMap, ) assert.NoError(t, err) assertPrettyEqual(t, trim(` out.Three = string(in.Three) var convertStringFooAHelper1 func(in *structs.StringFooA) (out *structs.StringFooA) convertStringFooAHelper1 = func(in *structs.StringFooA) (out *structs.StringFooA) { if in != nil { out = &structs.StringFooA{} out.One = string(in.One) var convertStringFooBHelper2 func(in *structs.StringFooB) (out *structs.StringFooB) convertStringFooBHelper2 = func(in *structs.StringFooB) (out *structs.StringFooB) { if in != nil { out = &structs.StringFooB{} out.Two = string(in.Two) out.FooA = convertStringFooAHelper1(in.FooA) } else { out = nil } return } out.FooB = convertStringFooBHelper2(in.FooB) } else { out = nil } return } out.Recur = convertStringFooAHelper1(in.Recur) `), lines) }
explode_data.jsonl/62095
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 626 }
[ 2830, 3393, 14920, 78542, 34, 65304, 1155, 353, 8840, 836, 8, 341, 39250, 2227, 1669, 1281, 9147, 14032, 60, 95859, 17087, 10989, 5874, 692, 78390, 11, 1848, 1669, 5508, 4173, 1006, 197, 197, 1, 40923, 497, 330, 3428, 756, 197, 197, 3...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestApiDevAuthDeleteTenantLimit(t *testing.T) { t.Parallel() // enforce specific field naming in errors returned by API updateRestErrorFieldName() tcases := []struct { req *http.Request code int body string tenant string limit string err error }{ { req: test.MakeSimpleRequest("DELETE", "http://1.2.3.4/api/internal/v1/devauth/tenant/foo/limits/max_devices", nil), limit: model.LimitMaxDeviceCount, tenant: "foo", code: http.StatusNoContent, }, { req: test.MakeSimpleRequest("DELETE", "http://1.2.3.4/api/internal/v1/devauth/tenant/foo/limits/bogus-limit", nil), code: http.StatusBadRequest, body: RestError("unsupported limit bogus-limit"), }, { req: test.MakeSimpleRequest("DELETE", "http://1.2.3.4/api/internal/v1/devauth/tenant/foo/limits/max_devices", nil), tenant: "foo", limit: model.LimitMaxDeviceCount, code: http.StatusInternalServerError, err: errors.New("failed"), body: RestError("internal error"), }, } for i := range tcases { tc := tcases[i] t.Run(fmt.Sprintf("tc %d", i), func(t *testing.T) { t.Parallel() da := &mocks.App{} da.On("DeleteTenantLimit", mtest.ContextMatcher(), tc.tenant, tc.limit). Return(tc.err) apih := makeMockApiHandler(t, da, nil) runTestRequest(t, apih, tc.req, tc.code, tc.body) }) } }
explode_data.jsonl/637
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 622 }
[ 2830, 3393, 6563, 14592, 5087, 6435, 71252, 16527, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 2822, 197, 322, 28162, 3151, 2070, 34948, 304, 5975, 5927, 553, 5333, 198, 27175, 12416, 1454, 51241, 2822, 3244, 23910, 1669, 3056, 1235,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestPlayer_Velocity(t *testing.T) { entity := new(stfake.Entity) entity.On("PropertyValueMust", "localdata.m_vecVelocity[0]").Return(st.PropertyValue{FloatVal: 1}) entity.On("PropertyValueMust", "localdata.m_vecVelocity[1]").Return(st.PropertyValue{FloatVal: 2}) entity.On("PropertyValueMust", "localdata.m_vecVelocity[2]").Return(st.PropertyValue{FloatVal: 3}) pl := &Player{Entity: entity} expected := r3.Vector{X: 1, Y: 2, Z: 3} assert.Equal(t, expected, pl.Velocity()) }
explode_data.jsonl/12197
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 183 }
[ 2830, 3393, 4476, 2334, 19054, 1155, 353, 8840, 836, 8, 341, 52987, 1669, 501, 5895, 30570, 9899, 340, 52987, 8071, 445, 68634, 31776, 497, 330, 2438, 691, 744, 13251, 24179, 58, 15, 44891, 5598, 5895, 15727, 1130, 90, 5442, 2208, 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 TestReadThreads(t *testing.T) { th := Setup(t).InitBasic() defer th.TearDown() os.Setenv("MM_FEATUREFLAGS_COLLAPSEDTHREADS", "true") defer os.Unsetenv("MM_FEATUREFLAGS_COLLAPSEDTHREADS") th.App.UpdateConfig(func(cfg *model.Config) { *cfg.ServiceSettings.ThreadAutoFollow = true *cfg.ServiceSettings.CollapsedThreads = model.CollapsedThreadsDefaultOn }) client := th.Client t.Run("all threads", func(t *testing.T) { rpost, resp, err := client.CreatePost(&model.Post{ChannelId: th.BasicChannel.Id, Message: "testMsg"}) require.NoError(t, err) CheckCreatedStatus(t, resp) _, resp, err = client.CreatePost(&model.Post{ChannelId: th.BasicChannel.Id, Message: "testReply", RootId: rpost.Id}) require.NoError(t, err) CheckCreatedStatus(t, resp) defer th.App.Srv().Store.Post().PermanentDeleteByUser(th.BasicUser.Id) var uss, uss2 *model.Threads uss, _, err = th.Client.GetUserThreads(th.BasicUser.Id, th.BasicTeam.Id, model.GetUserThreadsOpts{ Deleted: false, }) require.NoError(t, err) require.Len(t, uss.Threads, 1) resp, err = th.Client.UpdateThreadsReadForUser(th.BasicUser.Id, th.BasicTeam.Id) require.NoError(t, err) CheckOKStatus(t, resp) uss2, _, err = th.Client.GetUserThreads(th.BasicUser.Id, th.BasicTeam.Id, model.GetUserThreadsOpts{ Deleted: false, }) require.NoError(t, err) require.Len(t, uss2.Threads, 1) require.Greater(t, uss2.Threads[0].LastViewedAt, uss.Threads[0].LastViewedAt) }) t.Run("1 thread", func(t *testing.T) { defer th.App.Srv().Store.Post().PermanentDeleteByUser(th.BasicUser.Id) defer th.App.Srv().Store.Post().PermanentDeleteByUser(th.SystemAdminUser.Id) rpost, _ := postAndCheck(t, client, &model.Post{ChannelId: th.BasicChannel.Id, Message: "testMsgC1"}) postAndCheck(t, th.SystemAdminClient, &model.Post{ChannelId: th.BasicChannel.Id, Message: "testReplyC1", RootId: rpost.Id}) rrpost, _ := postAndCheck(t, client, &model.Post{ChannelId: th.BasicChannel2.Id, Message: "testMsgC2"}) postAndCheck(t, th.SystemAdminClient, &model.Post{ChannelId: th.BasicChannel2.Id, Message: "testReplyC2", RootId: rrpost.Id}) uss, _ := checkThreadListReplies(t, th, th.Client, th.BasicUser.Id, 2, 2, nil) _, resp, err := th.Client.UpdateThreadReadForUser(th.BasicUser.Id, th.BasicTeam.Id, rrpost.Id, model.GetMillis()+10) require.NoError(t, err) CheckOKStatus(t, resp) uss2, _ := checkThreadListReplies(t, th, th.Client, th.BasicUser.Id, 1, 2, nil) require.Greater(t, uss2.Threads[0].LastViewedAt, uss.Threads[0].LastViewedAt) timestamp := model.GetMillis() _, resp, err = th.Client.UpdateThreadReadForUser(th.BasicUser.Id, th.BasicTeam.Id, rrpost.Id, timestamp) require.NoError(t, err) CheckOKStatus(t, resp) uss3, _ := checkThreadListReplies(t, th, th.Client, th.BasicUser.Id, 1, 2, nil) require.Equal(t, uss3.Threads[0].LastViewedAt, timestamp) }) }
explode_data.jsonl/47578
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1171 }
[ 2830, 3393, 4418, 38666, 1155, 353, 8840, 836, 8, 341, 70479, 1669, 18626, 1155, 568, 3803, 15944, 741, 16867, 270, 836, 682, 4454, 741, 25078, 4202, 3160, 445, 8035, 30827, 32748, 74317, 2537, 20275, 47519, 50, 497, 330, 1866, 1138, 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 TestArtifactLocation_IsArchiveLogs(t *testing.T) { var l *ArtifactLocation assert.False(t, l.IsArchiveLogs()) assert.False(t, (&ArtifactLocation{}).IsArchiveLogs()) assert.False(t, (&ArtifactLocation{ArchiveLogs: pointer.BoolPtr(false)}).IsArchiveLogs()) assert.True(t, (&ArtifactLocation{ArchiveLogs: pointer.BoolPtr(true)}).IsArchiveLogs()) }
explode_data.jsonl/26016
{ "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, 85578, 4707, 31879, 42502, 51053, 1155, 353, 8840, 836, 8, 341, 2405, 326, 353, 85578, 4707, 198, 6948, 50757, 1155, 11, 326, 4506, 42502, 51053, 2398, 6948, 50757, 1155, 11, 15899, 85578, 4707, 6257, 568, 3872, 42502, 51053, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestReceiveMessage(t *testing.T) { var err error adapter.count = 1 //emsg := createTestBlock() emsg := createTestChaincodeEvent("0xffffffff", "event1") if err = producer.Send(emsg); err != nil { t.Fail() t.Logf("Error sending message %s", err) } select { case <-adapter.notfy: case <-time.After(2 * time.Second): t.Fail() t.Logf("timed out on messge") } }
explode_data.jsonl/22616
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 153 }
[ 2830, 3393, 14742, 2052, 1155, 353, 8840, 836, 8, 341, 2405, 1848, 1465, 271, 197, 19731, 6501, 284, 220, 16, 198, 197, 322, 336, 1991, 1669, 1855, 2271, 4713, 741, 66204, 1991, 1669, 1855, 2271, 18837, 1851, 1556, 445, 15, 41798, 497...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
4
func TestFlaggingProvisioningFailedHosts(t *testing.T) { Convey("When flagging hosts whose provisioning failed", t, func() { // reset the db require.NoError(t, db.ClearCollections(host.Collection), "error clearing hosts collection") Convey("only hosts whose provisioning failed should be"+ " picked up", func() { host1 := &host.Host{ Id: "h1", Provider: evergreen.ProviderNameMock, Status: evergreen.HostRunning, } require.NoError(t, host1.Insert(), "error inserting host") host2 := &host.Host{ Id: "h2", Status: evergreen.HostUninitialized, Provider: evergreen.ProviderNameMock, } require.NoError(t, host2.Insert(), "error inserting host") host3 := &host.Host{ Id: "h3", Status: evergreen.HostProvisionFailed, Provider: evergreen.ProviderNameMock, } require.NoError(t, host3.Insert(), "error inserting host") unprovisioned, err := host.FindHostsToTerminate() So(err, ShouldBeNil) So(len(unprovisioned), ShouldEqual, 1) So(unprovisioned[0].Id, ShouldEqual, "h3") }) }) }
explode_data.jsonl/31498
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 441 }
[ 2830, 3393, 12135, 3173, 1336, 13013, 287, 9408, 9296, 82, 1155, 353, 8840, 836, 8, 341, 93070, 5617, 445, 4498, 5181, 3173, 18432, 6693, 97056, 4641, 497, 259, 11, 2915, 368, 1476, 197, 197, 322, 7585, 279, 2927, 198, 197, 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 TestTaskResponseWithV4Metadata(t *testing.T) { ctrl := gomock.NewController(t) defer ctrl.Finish() state := mock_dockerstate.NewMockTaskEngineState(ctrl) ecsClient := mock_api.NewMockECSClient(ctrl) now := time.Now() task := &apitask.Task{ Arn: taskARN, Family: family, Version: version, DesiredStatusUnsafe: apitaskstatus.TaskRunning, KnownStatusUnsafe: apitaskstatus.TaskRunning, ENIs: []*apieni.ENI{ { IPV4Addresses: []*apieni.ENIIPV4Address{ { Address: eniIPv4Address, }, }, }, }, CPU: cpu, Memory: memory, PullStartedAtUnsafe: now, PullStoppedAtUnsafe: now, ExecutionStoppedAtUnsafe: now, } container := &apicontainer.Container{ Name: containerName, Image: imageName, ImageID: imageID, DesiredStatusUnsafe: apicontainerstatus.ContainerRunning, KnownStatusUnsafe: apicontainerstatus.ContainerRunning, CPU: cpu, Memory: memory, Type: apicontainer.ContainerNormal, Ports: []apicontainer.PortBinding{ { ContainerPort: 80, Protocol: apicontainer.TransportProtocolTCP, }, }, VolumesUnsafe: []types.MountPoint{ { Name: volName, Source: volSource, Destination: volDestination, }, }, DockerConfig: apicontainer.DockerConfig{ HostConfig: aws.String(`{"LogConfig":{"Type":"awslogs","Config":{"awslogs-group":"myLogGroup"}}}`), }, } created := time.Now() container.SetCreatedAt(created) labels := map[string]string{ "foo": "bar", } container.SetLabels(labels) containerNameToDockerContainer := map[string]*apicontainer.DockerContainer{ taskARN: { DockerID: containerID, DockerName: containerName, Container: container, }, } gomock.InOrder( state.EXPECT().TaskByArn(taskARN).Return(task, true), state.EXPECT().ContainerMapByArn(taskARN).Return(containerNameToDockerContainer, true), ) taskResponse, err := NewTaskResponse(taskARN, state, ecsClient, cluster, availabilityZone, containerInstanceArn, false, true) assert.NoError(t, err) _, err = json.Marshal(taskResponse) assert.NoError(t, err) assert.Equal(t, created.UTC().String(), taskResponse.Containers[0].CreatedAt.String()) // LaunchType is populated by the v4 handler assert.Equal(t, "", taskResponse.LaunchType) // Log driver and config should be populated assert.Equal(t, "awslogs", taskResponse.Containers[0].LogDriver) assert.Equal(t, map[string]string{"awslogs-group": "myLogGroup"}, taskResponse.Containers[0].LogOptions) }
explode_data.jsonl/56939
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1159 }
[ 2830, 3393, 6262, 2582, 2354, 53, 19, 14610, 1155, 353, 8840, 836, 8, 341, 84381, 1669, 342, 316, 1176, 7121, 2051, 1155, 340, 16867, 23743, 991, 18176, 2822, 24291, 1669, 7860, 814, 13659, 2454, 7121, 11571, 6262, 4571, 1397, 62100, 34...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestUpdateRuntimeConfig(t *testing.T) { const ( testTemplate = ` { "name": "test-pod-network", "cniVersion": "0.3.1", "plugins": [ { "type": "ptp", "mtu": 1460, "ipam": { "type": "host-local", "subnet": "{{.PodCIDR}}", "ranges": [{{range $i, $range := .PodCIDRRanges}}{{if $i}}, {{end}}[{"subnet": "{{$range}}"}]{{end}}], "routes": [{{range $i, $route := .Routes}}{{if $i}}, {{end}}{"dst": "{{$route}}"}{{end}}] } }, ] }` testCIDR = "10.0.0.0/24, 2001:4860:4860::8888/32" expected = ` { "name": "test-pod-network", "cniVersion": "0.3.1", "plugins": [ { "type": "ptp", "mtu": 1460, "ipam": { "type": "host-local", "subnet": "10.0.0.0/24", "ranges": [[{"subnet": "10.0.0.0/24"}], [{"subnet": "2001:4860:4860::8888/32"}]], "routes": [{"dst": "0.0.0.0/0"}, {"dst": "::/0"}] } }, ] }` ) for name, test := range map[string]struct { noTemplate bool emptyCIDR bool networkReady bool expectCNIConfig bool }{ "should not generate cni config if cidr is empty": { emptyCIDR: true, expectCNIConfig: false, }, "should not generate cni config if template file is not specified": { noTemplate: true, expectCNIConfig: false, }, "should not generate cni config if network is ready": { networkReady: true, expectCNIConfig: false, }, "should generate cni config if template is specified and cidr is provided": { expectCNIConfig: true, }, } { t.Run(name, func(t *testing.T) { testDir, err := ioutil.TempDir(os.TempDir(), "test-runtime-config") require.NoError(t, err) defer os.RemoveAll(testDir) templateName := filepath.Join(testDir, "template") err = ioutil.WriteFile(templateName, []byte(testTemplate), 0666) require.NoError(t, err) confDir := filepath.Join(testDir, "net.d") confName := filepath.Join(confDir, cniConfigFileName) c := newTestCRIService() c.config.CniConfig = criconfig.CniConfig{ NetworkPluginConfDir: confDir, NetworkPluginConfTemplate: templateName, } req := &runtime.UpdateRuntimeConfigRequest{ RuntimeConfig: &runtime.RuntimeConfig{ NetworkConfig: &runtime.NetworkConfig{ PodCidr: testCIDR, }, }, } if test.noTemplate { c.config.CniConfig.NetworkPluginConfTemplate = "" } if test.emptyCIDR { req.RuntimeConfig.NetworkConfig.PodCidr = "" } if !test.networkReady { c.netPlugin.(*servertesting.FakeCNIPlugin).StatusErr = errors.New("random error") c.netPlugin.(*servertesting.FakeCNIPlugin).LoadErr = errors.New("random error") } _, err = c.UpdateRuntimeConfig(context.Background(), req) assert.NoError(t, err) if !test.expectCNIConfig { _, err := os.Stat(confName) assert.Error(t, err) } else { got, err := ioutil.ReadFile(confName) assert.NoError(t, err) assert.Equal(t, expected, string(got)) } }) } }
explode_data.jsonl/39458
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1321 }
[ 2830, 3393, 4289, 15123, 2648, 1155, 353, 8840, 836, 8, 341, 4777, 2399, 197, 18185, 7275, 284, 22074, 515, 197, 31486, 788, 330, 1944, 2268, 347, 56732, 756, 197, 96946, 7751, 5637, 788, 330, 15, 13, 18, 13, 16, 756, 197, 1, 18716,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestStdMapCast(t *testing.T) { inputData := map[string]string{ "String": "string", "Int": "-1", "Uint": "2", "NotTagged" : "not-tagged", "ObjectId": bson.NewObjectId().Hex(), } caster := NewMapCaster() caster.Input(StdFieldNamer) caster.Output(StdFieldNamer) targetStruct := inputStruct{} outputMap := caster.Cast(inputData, &targetStruct) expectedOutput := map[string]interface{}{ "String": "string", "Int": -1, "Uint": uint(2), "NotTagged" : "not-tagged", "ObjectId": bson.ObjectIdHex(inputData["ObjectId"]), } for key, val := range expectedOutput { if gotVal, found := outputMap[key]; found == true { if gotVal == val { t.Log("Value matches:", key, val, gotVal) continue } t.Errorf("output not as expected.\nExpected %+v\n Got %+v\n", val, gotVal) } t.Errorf("Key not found in output: %s\n", key) } }
explode_data.jsonl/30238
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 389 }
[ 2830, 3393, 22748, 2227, 18714, 1155, 353, 8840, 836, 8, 1476, 22427, 1043, 1669, 2415, 14032, 30953, 515, 197, 197, 1, 703, 788, 256, 330, 917, 756, 197, 197, 1, 1072, 788, 414, 6523, 16, 756, 197, 197, 1, 21570, 788, 257, 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...
4
func TestContainsUpdateAction(t *testing.T) { testCases := []struct { name string actions []UpdateAction input UpdateAction want bool }{ { "contains", []UpdateAction{StartPulsed, Pulse}, Pulse, true, }, { "not contains", []UpdateAction{StartPulsed}, Pulse, false, }, { "empty", nil, Pulse, false, }, } for _, tc := range testCases { t.Run(tc.name, func(t *testing.T) { d := &Data{UpdateActions: tc.actions} assert.Equal(t, tc.want, d.ContainsUpdateAction(tc.input)) }) } }
explode_data.jsonl/23181
{ "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, 23805, 4289, 2512, 1155, 353, 8840, 836, 8, 341, 18185, 37302, 1669, 3056, 1235, 341, 197, 11609, 262, 914, 198, 197, 197, 4020, 3056, 4289, 2512, 198, 197, 22427, 256, 5549, 2512, 198, 197, 50780, 262, 1807, 198, 197, 594...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestGroupAdminsIntegration(t *testing.T) { c := client() groups, err := c.Groups() if err != nil { t.Error(err) } gID := groups[0].ID admins, err := c.GroupAdmins(gID) if err != nil { t.Error(err) } if admins[0].UserName != "ok" { t.Error(fmt.Sprintf("unable to get group admins for group %s", gID)) } }
explode_data.jsonl/12113
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 142 }
[ 2830, 3393, 2808, 7210, 82, 52464, 1155, 353, 8840, 836, 8, 341, 1444, 1669, 2943, 741, 44260, 82, 11, 1848, 1669, 272, 59800, 741, 743, 1848, 961, 2092, 341, 197, 3244, 6141, 3964, 340, 197, 630, 3174, 915, 1669, 5203, 58, 15, 936,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestNewJob(t *testing.T) { job := mkJob(t, "dummy", "--level=awesome") if job.Name != "dummy" { t.Fatalf("Wrong job name: %s", job.Name) } if len(job.Args) != 1 { t.Fatalf("Wrong number of job arguments: %d", len(job.Args)) } if job.Args[0] != "--level=awesome" { t.Fatalf("Wrong job arguments: %s", job.Args[0]) } }
explode_data.jsonl/15385
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 151 }
[ 2830, 3393, 3564, 12245, 1155, 353, 8840, 836, 8, 341, 68577, 1669, 23789, 12245, 1155, 11, 330, 31390, 497, 14482, 3294, 28, 16875, 1138, 743, 2618, 2967, 961, 330, 31390, 1, 341, 197, 3244, 30762, 445, 29185, 2618, 829, 25, 1018, 82...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
4
func TestConvertToBase7(t *testing.T) { tests := []struct { num int want string }{ { 100, "202", }, { -7, "-10", }, } for _, tt := range tests { if got := convertToBase7(tt.num); got != tt.want { t.Errorf("convertToBase7() = %v, want %v", got, tt.want) } } }
explode_data.jsonl/5871
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 154 }
[ 2830, 3393, 12012, 1249, 3978, 22, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 3056, 1235, 341, 197, 22431, 220, 526, 198, 197, 50780, 914, 198, 197, 59403, 197, 197, 515, 298, 197, 16, 15, 15, 345, 298, 197, 1, 17, 15, 17, 756, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestRun(t *testing.T) { assert := assert.New(t) opts := aggregator.DefaultDemultiplexerOptions(nil) opts.DontStartForwarders = true aggregator.InitAndStartAgentDemultiplexer(opts, "foo") e := enterTempEnv(t) defer e.leave() reporter := &mocks.Reporter{} reporter.On( "Report", mock.MatchedBy( eventMatcher( eventMatch{ ruleID: "cis-docker-1", frameworkID: "cis-docker", resourceID: "the-host_daemon", resourceType: "docker_daemon", result: "passed", path: "/files/daemon.json", permissions: 0644, }, ), ), ).Once() reporter.On( "Report", mock.MatchedBy( eventMatcher( eventMatch{ ruleID: "cis-kubernetes-1", frameworkID: "cis-kubernetes", resourceID: "kube_system_uuid_kubernetes_node", resourceType: "kubernetes_node", result: "failed", path: "/files/kube-apiserver.yaml", permissions: 0644, }, ), ), ).Once() defer reporter.AssertExpectations(t) scheduler := &mocks.Scheduler{} defer scheduler.AssertExpectations(t) scheduler.On("Run").Once().Return(nil) scheduler.On("Stop").Once().Return(nil) scheduler.On("Enter", mock.Anything).Return(nil).Run(func(args mock.Arguments) { check := args.Get(0).(check.Check) check.Run() }) dockerClient := &mocks.DockerClient{} dockerClient.On("Close").Return(nil).Once() defer dockerClient.AssertExpectations(t) kubeClient := &mocks.KubeClient{} kubeClient.On("Resource", mock.Anything).Return(nil) nodeLabels := map[string]string{ "node-role.kubernetes.io/worker": "", } agent, err := New( reporter, scheduler, e.dir, &config.Endpoints{}, checks.WithHostname("the-host"), checks.WithHostRootMount(e.dir), checks.WithDockerClient(dockerClient), checks.WithNodeLabels(nodeLabels), checks.WithKubernetesClient(kubeClient, "kube_system_uuid"), ) assert.NoError(err) err = agent.Run() assert.NoError(err) agent.Stop() st := agent.builder.GetCheckStatus() assert.Len(st, 2) assert.Equal("cis-docker-1", st[0].RuleID) assert.Equal("passed", st[0].LastEvent.Result) assert.Equal("cis-kubernetes-1", st[1].RuleID) assert.Equal("failed", st[1].LastEvent.Result) v, err := json.Marshal(st) assert.NoError(err) // Check the expvar value assert.JSONEq(string(v), status.Get("Checks").String()) }
explode_data.jsonl/22791
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1050 }
[ 2830, 3393, 6727, 1155, 353, 8840, 836, 8, 341, 6948, 1669, 2060, 7121, 1155, 692, 64734, 1669, 96680, 13275, 32003, 9845, 38815, 3798, 27907, 340, 64734, 909, 544, 3479, 25925, 388, 284, 830, 198, 197, 351, 58131, 26849, 3036, 3479, 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 TestConfigDescribeLocation(t *testing.T) { assert := asrt.New(t) // Create a temporary directory and switch to it. tmpdir := testcommon.CreateTmpDir("config-show-location") defer testcommon.CleanupDir(tmpdir) defer testcommon.Chdir(tmpdir)() // Create a config args := []string{"config", "--docroot=."} out, err := exec.RunCommand(DdevBin, args) assert.NoError(err) assert.Contains(string(out), "Found a php codebase") // Now see if we can detect it args = []string{"config", "--show-config-location"} out, err = exec.RunCommand(DdevBin, args) assert.NoError(err) assert.Contains(string(out), tmpdir) // Now try it in a directory that doesn't have a config tmpdir = testcommon.CreateTmpDir("config_show_location") defer testcommon.CleanupDir(tmpdir) defer testcommon.Chdir(tmpdir)() args = []string{"config", "--show-config-location"} out, err = exec.RunCommand(DdevBin, args) assert.Error(err) assert.Contains(string(out), "No project configuration currently exists") }
explode_data.jsonl/76709
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 344 }
[ 2830, 3393, 2648, 74785, 4707, 1155, 353, 8840, 836, 8, 341, 6948, 1669, 438, 3342, 7121, 1155, 692, 197, 322, 4230, 264, 13340, 6220, 323, 3398, 311, 432, 624, 20082, 3741, 1669, 1273, 5464, 7251, 35986, 6184, 445, 1676, 30537, 60870, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestPreparedCommand_RunS_Verbose(t *testing.T) { os.Setenv(mg.VerboseEnv, "true") defer os.Unsetenv(mg.VerboseEnv) stdout := shx.RecordStdout() defer stdout.Release() stderr := shx.RecordStderr() defer stderr.Release() gotOutput, err := shx.OutputS("go", "run", "echo.go", "hello world") gotStdout := stdout.Output() gotStderr := stderr.Output() if err != nil { t.Fatal(err) } wantOutput := "hello world" assert.Equal(t, wantOutput, gotOutput) assert.Empty(t, gotStdout) wantStderr := "go run echo.go hello world" assert.Contains(t, gotStderr, wantStderr) }
explode_data.jsonl/57099
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 248 }
[ 2830, 3393, 4703, 7212, 4062, 84158, 50, 2334, 261, 8297, 1155, 353, 8840, 836, 8, 341, 25078, 4202, 3160, 1255, 70, 42505, 8297, 14359, 11, 330, 1866, 1138, 16867, 2643, 10616, 746, 3160, 1255, 70, 42505, 8297, 14359, 692, 6736, 411, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_storePipelineSpec(t *testing.T) { ctx := context.Background() pr := &v1beta1.PipelineRun{ObjectMeta: metav1.ObjectMeta{Name: "foo"}} ps := v1beta1.PipelineSpec{Description: "foo-pipeline"} ps1 := v1beta1.PipelineSpec{Description: "bar-pipeline"} want := ps.DeepCopy() // The first time we set it, it should get copied. if err := storePipelineSpec(ctx, pr, &ps); err != nil { t.Errorf("storePipelineSpec() error = %v", err) } if d := cmp.Diff(pr.Status.PipelineSpec, want); d != "" { t.Fatalf(diff.PrintWantGot(d)) } // The next time, it should not get overwritten if err := storePipelineSpec(ctx, pr, &ps1); err != nil { t.Errorf("storePipelineSpec() error = %v", err) } if d := cmp.Diff(pr.Status.PipelineSpec, want); d != "" { t.Fatalf(diff.PrintWantGot(d)) } }
explode_data.jsonl/68297
{ "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, 14809, 34656, 8327, 1155, 353, 8840, 836, 8, 341, 20985, 1669, 2266, 19047, 741, 25653, 1669, 609, 85, 16, 19127, 16, 1069, 8790, 6727, 90, 1190, 12175, 25, 77520, 16, 80222, 63121, 25, 330, 7975, 9207, 630, 35009, 1669, 3...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
5
func TestCheckPubKeyEncoding(t *testing.T) { t.Parallel() tests := []struct { name string key []byte isValid bool }{ { name: "uncompressed ok", key: hexToBytes("0411db93e1dcdb8a016b49840f8c53bc1eb68" + "a382e97b1482ecad7b148a6909a5cb2e0eaddfb84ccf" + "9744464f82e160bfa9b8b64f9d4c03f999b8643f656b" + "412a3"), isValid: true, }, { name: "compressed ok", key: hexToBytes("02ce0b14fb842b1ba549fdd675c98075f12e9" + "c510f8ef52bd021a9a1f4809d3b4d"), isValid: true, }, { name: "compressed ok", key: hexToBytes("032689c7c2dab13309fb143e0e8fe39634252" + "1887e976690b6b47f5b2a4b7d448e"), isValid: true, }, { name: "hybrid", key: hexToBytes("0679be667ef9dcbbac55a06295ce870b07029" + "bfcdb2dce28d959f2815b16f81798483ada7726a3c46" + "55da4fbfc0e1108a8fd17b448a68554199c47d08ffb1" + "0d4b8"), isValid: false, }, { name: "empty", key: nil, isValid: false, }, } vm := Engine{flags: ScriptVerifyStrictEncoding} for _, test := range tests { err := vm.checkPubKeyEncoding(test.key) if err != nil && test.isValid { t.Errorf("checkSignatureEncoding test '%s' failed "+ "when it should have succeeded: %v", test.name, err) } else if err == nil && !test.isValid { t.Errorf("checkSignatureEncooding test '%s' succeeded "+ "when it should have failed", test.name) } } }
explode_data.jsonl/45212
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 727 }
[ 2830, 3393, 3973, 29162, 1592, 14690, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 2822, 78216, 1669, 3056, 1235, 341, 197, 11609, 262, 914, 198, 197, 23634, 257, 3056, 3782, 198, 197, 19907, 4088, 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...
6
func TestTagSize(t *testing.T) { id := Tag{} typ := reflect.TypeOf(id) if typ.Size() > 24 { t.Errorf("size of Tag was %d; want 24", typ.Size()) } }
explode_data.jsonl/15827
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 67 }
[ 2830, 3393, 5668, 1695, 1155, 353, 8840, 836, 8, 341, 15710, 1669, 12353, 16094, 25314, 1669, 8708, 73921, 3724, 340, 743, 3582, 2465, 368, 861, 220, 17, 19, 341, 197, 3244, 13080, 445, 2141, 315, 12353, 572, 1018, 67, 26, 1366, 220, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
2
func TestAccAlicloudOssBucketObject_acl(t *testing.T) { tmpFile, err := ioutil.TempFile("", "tf-oss-object-test-acc-source") if err != nil { t.Fatal(err) } defer os.Remove(tmpFile.Name()) // first write some data to the tempfile just so it's not 0 bytes. err = ioutil.WriteFile(tmpFile.Name(), []byte("{anything will do }"), 0644) if err != nil { t.Fatal(err) } var obj http.Header bucket := fmt.Sprintf("tf-testacc-bucket-%d", acctest.RandInt()) resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, CheckDestroy: testAccCheckAlicloudOssBucketObjectDestroy, Steps: []resource.TestStep{ resource.TestStep{ Config: fmt.Sprintf(` resource "alicloud_oss_bucket" "bucket" { bucket = "%s" } resource "alicloud_oss_bucket_object" "acl" { bucket = "${alicloud_oss_bucket.bucket.bucket}" key = "test-object-acl-key" source = "%s" acl = "%s" } `, bucket, tmpFile.Name(), "public-read"), Check: resource.ComposeTestCheckFunc( testAccCheckAlicloudOssBucketObjectExists( "alicloud_oss_bucket_object.acl", bucket, obj), resource.TestCheckResourceAttr( "alicloud_oss_bucket_object.acl", "acl", "public-read"), ), }, }, }) }
explode_data.jsonl/1528
{ "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, 14603, 32, 415, 52178, 46, 778, 36018, 1190, 63692, 1155, 353, 8840, 836, 8, 341, 20082, 1703, 11, 1848, 1669, 43144, 65009, 1703, 19814, 330, 8935, 12, 3662, 40432, 16839, 12, 4475, 30774, 1138, 743, 1848, 961, 2092, 341, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestCreateEmoji(t *testing.T) { th := Setup().InitBasic() defer th.TearDown() Client := th.Client EnableCustomEmoji := *th.App.Config().ServiceSettings.EnableCustomEmoji defer func() { th.App.UpdateConfig(func(cfg *model.Config) { *cfg.ServiceSettings.EnableCustomEmoji = EnableCustomEmoji }) }() th.App.UpdateConfig(func(cfg *model.Config) { *cfg.ServiceSettings.EnableCustomEmoji = false }) defaultRolePermissions := th.SaveDefaultRolePermissions() defer func() { th.RestoreDefaultRolePermissions(defaultRolePermissions) }() emoji := &model.Emoji{ CreatorId: th.BasicUser.Id, Name: model.NewId(), } // try to create an emoji when they're disabled _, resp := Client.CreateEmoji(emoji, utils.CreateTestGif(t, 10, 10), "image.gif") CheckNotImplementedStatus(t, resp) th.App.UpdateConfig(func(cfg *model.Config) { *cfg.ServiceSettings.EnableCustomEmoji = true }) // try to create a valid gif emoji when they're enabled newEmoji, resp := Client.CreateEmoji(emoji, utils.CreateTestGif(t, 10, 10), "image.gif") CheckNoError(t, resp) if newEmoji.Name != emoji.Name { t.Fatal("create with wrong name") } // try to create an emoji with a duplicate name emoji2 := &model.Emoji{ CreatorId: th.BasicUser.Id, Name: newEmoji.Name, } _, resp = Client.CreateEmoji(emoji2, utils.CreateTestGif(t, 10, 10), "image.gif") CheckBadRequestStatus(t, resp) CheckErrorMessage(t, resp, "api.emoji.create.duplicate.app_error") // try to create a valid animated gif emoji emoji = &model.Emoji{ CreatorId: th.BasicUser.Id, Name: model.NewId(), } newEmoji, resp = Client.CreateEmoji(emoji, utils.CreateTestAnimatedGif(t, 10, 10, 10), "image.gif") CheckNoError(t, resp) if newEmoji.Name != emoji.Name { t.Fatal("create with wrong name") } // try to create a valid jpeg emoji emoji = &model.Emoji{ CreatorId: th.BasicUser.Id, Name: model.NewId(), } newEmoji, resp = Client.CreateEmoji(emoji, utils.CreateTestJpeg(t, 10, 10), "image.gif") CheckNoError(t, resp) if newEmoji.Name != emoji.Name { t.Fatal("create with wrong name") } // try to create a valid png emoji emoji = &model.Emoji{ CreatorId: th.BasicUser.Id, Name: model.NewId(), } newEmoji, resp = Client.CreateEmoji(emoji, utils.CreateTestPng(t, 10, 10), "image.gif") CheckNoError(t, resp) if newEmoji.Name != emoji.Name { t.Fatal("create with wrong name") } // try to create an emoji that's too wide emoji = &model.Emoji{ CreatorId: th.BasicUser.Id, Name: model.NewId(), } newEmoji, resp = Client.CreateEmoji(emoji, utils.CreateTestGif(t, 1000, 10), "image.gif") CheckNoError(t, resp) if newEmoji.Name != emoji.Name { t.Fatal("create with wrong name") } // try to create an emoji that's too wide emoji = &model.Emoji{ CreatorId: th.BasicUser.Id, Name: model.NewId(), } newEmoji, resp = Client.CreateEmoji(emoji, utils.CreateTestGif(t, 10, app.MaxEmojiOriginalWidth+1), "image.gif") if resp.Error == nil { t.Fatal("should fail - emoji is too wide") } // try to create an emoji that's too tall emoji = &model.Emoji{ CreatorId: th.BasicUser.Id, Name: model.NewId(), } newEmoji, resp = Client.CreateEmoji(emoji, utils.CreateTestGif(t, app.MaxEmojiOriginalHeight+1, 10), "image.gif") if resp.Error == nil { t.Fatal("should fail - emoji is too tall") } // try to create an emoji that's too large emoji = &model.Emoji{ CreatorId: th.BasicUser.Id, Name: model.NewId(), } _, resp = Client.CreateEmoji(emoji, utils.CreateTestAnimatedGif(t, 100, 100, 10000), "image.gif") if resp.Error == nil { t.Fatal("should fail - emoji is too big") } // try to create an emoji with data that isn't an image emoji = &model.Emoji{ CreatorId: th.BasicUser.Id, Name: model.NewId(), } _, resp = Client.CreateEmoji(emoji, make([]byte, 100), "image.gif") CheckBadRequestStatus(t, resp) CheckErrorMessage(t, resp, "api.emoji.upload.image.app_error") // try to create an emoji as another user emoji = &model.Emoji{ CreatorId: th.BasicUser2.Id, Name: model.NewId(), } _, resp = Client.CreateEmoji(emoji, utils.CreateTestGif(t, 10, 10), "image.gif") CheckForbiddenStatus(t, resp) // try to create an emoji without permissions th.RemovePermissionFromRole(model.PERMISSION_CREATE_EMOJIS.Id, model.SYSTEM_USER_ROLE_ID) emoji = &model.Emoji{ CreatorId: th.BasicUser.Id, Name: model.NewId(), } _, resp = Client.CreateEmoji(emoji, utils.CreateTestGif(t, 10, 10), "image.gif") CheckForbiddenStatus(t, resp) // create an emoji with permissions in one team th.AddPermissionToRole(model.PERMISSION_CREATE_EMOJIS.Id, model.TEAM_USER_ROLE_ID) emoji = &model.Emoji{ CreatorId: th.BasicUser.Id, Name: model.NewId(), } _, resp = Client.CreateEmoji(emoji, utils.CreateTestGif(t, 10, 10), "image.gif") CheckNoError(t, resp) }
explode_data.jsonl/76081
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1970 }
[ 2830, 3393, 4021, 92731, 1155, 353, 8840, 836, 8, 341, 70479, 1669, 18626, 1005, 3803, 15944, 741, 16867, 270, 836, 682, 4454, 741, 71724, 1669, 270, 11716, 271, 197, 11084, 10268, 92731, 1669, 353, 339, 5105, 10753, 1005, 1860, 6086, 3...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestRoute_GetService(t *testing.T) { route := Route{} route.service = "example" got := route.GetService() if got != route.service { t.Errorf("GetService() = %s, want %s", got, route.service) } }
explode_data.jsonl/67784
{ "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, 4899, 13614, 1860, 1155, 353, 8840, 836, 8, 341, 7000, 2133, 1669, 9572, 16094, 7000, 2133, 5736, 284, 330, 8687, 698, 3174, 354, 1669, 6021, 81342, 2822, 743, 2684, 961, 6021, 5736, 341, 197, 3244, 13080, 445, 1949, 1860, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
2
func TestIntHandling(t *testing.T) { in := []float64{1, 2, 3, 4, 5, 6, 7, 8} out := talib.MaxIndex(in, 5) want := []int32{4, 5, 6, 7} if !reflect.DeepEqual(out, want) { t.Fatalf("MaxIndex got %+v; want %+v", out, want) } }
explode_data.jsonl/51213
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 111 }
[ 2830, 3393, 1072, 38606, 1155, 353, 8840, 836, 8, 341, 17430, 1669, 3056, 3649, 21, 19, 90, 16, 11, 220, 17, 11, 220, 18, 11, 220, 19, 11, 220, 20, 11, 220, 21, 11, 220, 22, 11, 220, 23, 532, 13967, 1669, 8210, 579, 14535, 155...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestStartShutdownCalledOnDefaultSignals(t *testing.T) { c := make(chan int, 100) psm := NewPosixSignalManager() _ = psm.Start(startShutdownFunc(func(sm shutdown.ShutdownManager) { c <- 1 })) time.Sleep(time.Millisecond) _ = syscall.Kill(syscall.Getpid(), syscall.SIGINT) waitSig(t, c) _ = psm.Start(startShutdownFunc(func(sm shutdown.ShutdownManager) { c <- 1 })) time.Sleep(time.Millisecond) _ = syscall.Kill(syscall.Getpid(), syscall.SIGTERM) waitSig(t, c) }
explode_data.jsonl/72822
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 207 }
[ 2830, 3393, 3479, 62004, 20960, 1925, 3675, 96659, 1155, 353, 8840, 836, 8, 341, 1444, 1669, 1281, 35190, 526, 11, 220, 16, 15, 15, 692, 35009, 76, 1669, 1532, 4859, 941, 26810, 2043, 741, 197, 62, 284, 281, 3563, 12101, 10639, 62004,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestRebuildUserChannels(t *testing.T) { computer := mockComputer{channels: ch.AtSequence(ch.SetOf("derived1", "derived2"), 1)} auth := NewAuthenticator(gTestBucket, &computer) user, _ := auth.NewUser("testUser", "password", ch.SetOf("explicit1")) user.setChannels(nil) err := auth.Save(user) assert.Equals(t, err, nil) user2, err := auth.GetUser("testUser") assert.Equals(t, err, nil) assert.DeepEquals(t, user2.Channels(), ch.AtSequence(ch.SetOf("explicit1", "derived1", "derived2", "!"), 1)) }
explode_data.jsonl/31561
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 194 }
[ 2830, 3393, 693, 5834, 1474, 35925, 1155, 353, 8840, 836, 8, 341, 32810, 11281, 1669, 7860, 37332, 90, 32425, 25, 521, 15543, 14076, 7520, 4202, 2124, 445, 50082, 16, 497, 330, 50082, 17, 3975, 220, 16, 10569, 78011, 1669, 1532, 5087, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestEmptyLevel(t *testing.T) { c, err := NewConfigFromConfigMap(&corev1.ConfigMap{ ObjectMeta: metav1.ObjectMeta{ Namespace: system.Namespace(), Name: "config-logging", }, Data: map[string]string{ "zap-logger-config": "{\"level\": \"error\",\n\"outputPaths\": [\"stdout\"],\n\"errorOutputPaths\": [\"stderr\"],\n\"encoding\": \"json\"}", "loglevel.queueproxy": "", }, }) if err != nil { t.Errorf("Expected no errors, got: %v", err) } if got, want := c.LoggingLevel["queueproxy"], zapcore.InfoLevel; got != want { t.Errorf("LoggingLevel[queueproxy] = %v, want: %v", got, want) } }
explode_data.jsonl/37330
{ "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, 3522, 4449, 1155, 353, 8840, 836, 8, 341, 1444, 11, 1848, 1669, 1532, 2648, 3830, 2648, 2227, 2099, 98645, 16, 10753, 2227, 515, 197, 23816, 12175, 25, 77520, 16, 80222, 515, 298, 90823, 25, 1849, 46011, 3148, 298, 21297, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestConcurrentGameModel_Constructor1(t *testing.T) { // Create Simple Empty Concurrent Game Model cgm1 := ConcurrentGameModel{} // Try to get a state which is outside of the allowable range. if cgm1.o != nil { t.Errorf("Expected for uninitialized CGM to have nil transition function. But it is not nil!") } }
explode_data.jsonl/73373
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 101 }
[ 2830, 3393, 1109, 3231, 4868, 1712, 15100, 3086, 16, 1155, 353, 8840, 836, 8, 341, 197, 322, 4230, 8993, 22228, 42704, 4050, 4903, 198, 1444, 26186, 16, 1669, 42704, 4868, 1712, 31483, 197, 322, 9735, 311, 633, 264, 1584, 892, 374, 48...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestBridgeIpv6FromMac(t *testing.T) { if !testutils.IsRunningInContainer() { defer testutils.SetupTestOSContext(t)() } netOption := options.Generic{ netlabel.GenericData: options.Generic{ "BridgeName": "testipv6mac", "EnableIPv6": true, "EnableICC": true, "EnableIPMasquerade": true, }, } ipamV4ConfList := []*libnetwork.IpamConf{&libnetwork.IpamConf{PreferredPool: "192.168.100.0/24", Gateway: "192.168.100.1"}} ipamV6ConfList := []*libnetwork.IpamConf{&libnetwork.IpamConf{PreferredPool: "fe90::/64", Gateway: "fe90::22"}} network, err := controller.NewNetwork(bridgeNetType, "testipv6mac", libnetwork.NetworkOptionGeneric(netOption), libnetwork.NetworkOptionIpam(ipamapi.DefaultIPAM, "", ipamV4ConfList, ipamV6ConfList), libnetwork.NetworkOptionDeferIPv6Alloc(true)) if err != nil { t.Fatal(err) } mac := net.HardwareAddr{0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff} epOption := options.Generic{netlabel.MacAddress: mac} ep, err := network.CreateEndpoint("testep", libnetwork.EndpointOptionGeneric(epOption)) if err != nil { t.Fatal(err) } iface := ep.Info().Iface() if !bytes.Equal(iface.MacAddress(), mac) { t.Fatalf("Unexpected mac address: %v", iface.MacAddress()) } ip, expIP, _ := net.ParseCIDR("fe90::aabb:ccdd:eeff/64") expIP.IP = ip if !types.CompareIPNet(expIP, iface.AddressIPv6()) { t.Fatalf("Expected %v. Got: %v", expIP, iface.AddressIPv6()) } if err := ep.Delete(); err != nil { t.Fatal(err) } if err := network.Delete(); err != nil { t.Fatal(err) } }
explode_data.jsonl/6350
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 663 }
[ 2830, 3393, 32848, 80656, 21, 3830, 19552, 1155, 353, 8840, 836, 8, 341, 743, 753, 1944, 6031, 4506, 18990, 641, 4502, 368, 341, 197, 16867, 1273, 6031, 39820, 2271, 3126, 1972, 1155, 8, 741, 197, 630, 59486, 5341, 1669, 2606, 4341, 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...
8
func TestGetClientCertificate(t *testing.T) { t.Run("TLSv12", func(t *testing.T) { testGetClientCertificate(t, VersionTLS12) }) t.Run("TLSv13", func(t *testing.T) { testGetClientCertificate(t, VersionTLS13) }) }
explode_data.jsonl/27733
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 84 }
[ 2830, 3393, 1949, 2959, 33202, 1155, 353, 8840, 836, 8, 341, 3244, 16708, 445, 45439, 85, 16, 17, 497, 2915, 1155, 353, 8840, 836, 8, 314, 1273, 1949, 2959, 33202, 1155, 11, 6079, 45439, 16, 17, 8, 2751, 3244, 16708, 445, 45439, 85,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestGetServerStatusBad(t *testing.T) { _, err := GetServerStatus("", -1) if err == nil { t.Log("Bad request was made and no error was created") t.Fail() } }
explode_data.jsonl/24170
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 64 }
[ 2830, 3393, 1949, 5475, 2522, 17082, 1155, 353, 8840, 836, 8, 341, 197, 6878, 1848, 1669, 2126, 5475, 2522, 19814, 481, 16, 340, 743, 1848, 621, 2092, 341, 197, 3244, 5247, 445, 17082, 1681, 572, 1865, 323, 902, 1465, 572, 3465, 1138,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestWindowNoRepos(t *testing.T) { unittest.SmallTest(t) period := time.Hour w, err := New(context.Background(), period, 0, nil) require.NoError(t, err) now, err := time.Parse(time.RFC3339Nano, "2016-11-29T16:44:27.192070480Z") require.NoError(t, err) start := now.Add(-period) startTs := start.UnixNano() require.NoError(t, w.UpdateWithTime(now)) repo := "..." require.Equal(t, startTs, w.Start(repo).UnixNano()) require.False(t, w.TestTime(repo, time.Unix(0, 0))) require.False(t, w.TestTime(repo, time.Time{})) require.True(t, w.TestTime(repo, time.Now())) require.True(t, w.TestTime(repo, time.Unix(0, startTs))) // Inclusive. require.True(t, w.TestTime(repo, time.Unix(0, startTs+1))) require.False(t, w.TestTime(repo, time.Unix(0, startTs-1))) }
explode_data.jsonl/73997
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 329 }
[ 2830, 3393, 4267, 2753, 693, 966, 1155, 353, 8840, 836, 8, 341, 20479, 14267, 90183, 2271, 1155, 340, 197, 19304, 1669, 882, 73550, 198, 6692, 11, 1848, 1669, 1532, 5378, 19047, 1507, 4168, 11, 220, 15, 11, 2092, 340, 17957, 35699, 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 TestShouldBuild(t *testing.T) { t.Parallel() var past = time.Date(2009, 11, 17, 20, 34, 58, 651387237, time.UTC) var future = time.Date(2037, 11, 17, 20, 34, 58, 651387237, time.UTC) var zero = time.Time{} var publishSettings = []struct { buildFuture bool buildExpired bool buildDrafts bool draft bool publishDate time.Time expiryDate time.Time out bool }{ // publishDate and expiryDate {false, false, false, false, zero, zero, true}, {false, false, false, false, zero, future, true}, {false, false, false, false, past, zero, true}, {false, false, false, false, past, future, true}, {false, false, false, false, past, past, false}, {false, false, false, false, future, future, false}, {false, false, false, false, future, past, false}, // buildFuture and buildExpired {false, true, false, false, past, past, true}, {true, true, false, false, past, past, true}, {true, false, false, false, past, past, false}, {true, false, false, false, future, future, true}, {true, true, false, false, future, future, true}, {false, true, false, false, future, past, false}, // buildDrafts and draft {true, true, false, true, past, future, false}, {true, true, true, true, past, future, true}, {true, true, true, true, past, future, true}, } for _, ps := range publishSettings { s := shouldBuild(ps.buildFuture, ps.buildExpired, ps.buildDrafts, ps.draft, ps.publishDate, ps.expiryDate) if s != ps.out { t.Errorf("AssertShouldBuild unexpected output with params: %+v", ps) } } }
explode_data.jsonl/60636
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 592 }
[ 2830, 3393, 14996, 11066, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 741, 2405, 3267, 284, 882, 8518, 7, 17, 15, 15, 24, 11, 220, 16, 16, 11, 220, 16, 22, 11, 220, 17, 15, 11, 220, 18, 19, 11, 220, 20, 23, 11, 220, 21,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestRowTableTableBelongsToUserTrue(t *testing.T) { map_dao := &TableRowBelongsImpl{&DaoImpl{}} service := service.MakeTableRowService(map_dao) belongs := service.TableBelongsToUser("1432", 2) if !belongs { t.Errorf("TableBelongsToUser: authorized user denied access") } }
explode_data.jsonl/15454
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 103 }
[ 2830, 3393, 3102, 2556, 2556, 21666, 34225, 1474, 2514, 1155, 353, 8840, 836, 8, 341, 19567, 814, 3441, 1669, 609, 38558, 21666, 13181, 9673, 90, 5, 12197, 9673, 6257, 532, 52934, 1669, 2473, 50133, 38558, 1860, 9147, 814, 3441, 340, 22...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestSequential(t *testing.T) { // Verify that sequential non-concurrent Adds to a batcher produce single-item batches. // Since there is no concurrent work, the Batcher will always produce the items one at a time. ctx := context.Background() var got []int e := errors.New("e") b := batcher.New(reflect.TypeOf(int(0)), 1, func(items interface{}) error { got = items.([]int) return e }) for i := 0; i < 10; i++ { err := b.Add(ctx, i) if err != e { t.Errorf("got %v, want %v", err, e) } want := []int{i} if !cmp.Equal(got, want) { t.Errorf("got %+v, want %+v", got, want) } } }
explode_data.jsonl/16710
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 243 }
[ 2830, 3393, 22046, 1155, 353, 8840, 836, 8, 341, 197, 322, 25429, 429, 51000, 2477, 14859, 3231, 24475, 311, 264, 7162, 261, 8193, 3175, 6404, 44792, 624, 197, 322, 8704, 1052, 374, 902, 34035, 975, 11, 279, 425, 28058, 686, 2677, 819...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestMemory_ConfigureParseHclError(t *testing.T) { config := "'" ///This should throw and error on parsing. pluginConfig := &spi.ConfigureRequest{ Configuration: config, } m := &memoryPlugin{ mtx: &sync.RWMutex{}, } resp, err := m.Configure(pluginConfig) expectedError := "At 1:1: illegal char" expectedErrorList := []string{expectedError} assert.Equal(t, err.Error(), expectedError) assert.Equal(t, resp.GetErrorList(), expectedErrorList) }
explode_data.jsonl/73851
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 160 }
[ 2830, 3393, 10642, 15100, 17781, 14463, 39, 564, 1454, 1155, 353, 8840, 836, 8, 341, 25873, 1669, 37639, 1048, 1986, 1265, 2510, 323, 1465, 389, 22314, 624, 197, 9138, 2648, 1669, 609, 39157, 78281, 1900, 515, 197, 197, 7688, 25, 2193, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_VerifyEmailResend(t *testing.T) { tests := []struct { name string prep func(*testSetup) jwt string wantResCode int }{ { name: "should return 401 when authorizer returns ErrInvalidToken", jwt: testAuthToken, prep: func(setup *testSetup) { setup.mockAuthorizer.EXPECT().GetUserIdFromToken(testAuthToken). Return(primitive.ObjectID{}, authCommon.ErrInvalidToken).Times(1) }, wantResCode: http.StatusUnauthorized, }, { name: "should return 500 when authorizer returns unknown error", jwt: testAuthToken, prep: func(setup *testSetup) { setup.mockAuthorizer.EXPECT().GetUserIdFromToken(testAuthToken). Return(primitive.ObjectID{}, errors.New("authorizer err")).Times(1) }, wantResCode: http.StatusInternalServerError, }, { name: "should return 404 when user service returns ErrNotFound", jwt: testAuthToken, prep: func(setup *testSetup) { setup.mockAuthorizer.EXPECT().GetUserIdFromToken(testAuthToken). Return(testUserId, nil).Times(1) setup.mockUService.EXPECT().GetUserWithID(setup.testCtx, testUserId.Hex()). Return(nil, services.ErrNotFound).Times(1) }, wantResCode: http.StatusNotFound, }, { name: "should return 500 when user service returns unknown error", jwt: testAuthToken, prep: func(setup *testSetup) { setup.mockAuthorizer.EXPECT().GetUserIdFromToken(testAuthToken). Return(testUserId, nil).Times(1) setup.mockUService.EXPECT().GetUserWithID(setup.testCtx, testUserId.Hex()). Return(nil, errors.New("service err")).Times(1) }, wantResCode: http.StatusInternalServerError, }, { name: "should return 500 when email service returns error", jwt: testAuthToken, prep: func(setup *testSetup) { setup.mockAuthorizer.EXPECT().GetUserIdFromToken(testAuthToken). Return(testUserId, nil).Times(1) setup.mockUService.EXPECT().GetUserWithID(setup.testCtx, testUserId.Hex()). Return(&entities.User{ID: testUserId}, nil).Times(1) setup.mockEServiceV2.EXPECT().SendEmailVerificationEmail(setup.testCtx, entities.User{ID: testUserId}, emailVerificationURIs). Return(errors.New("service err")).Times(1) }, wantResCode: http.StatusInternalServerError, }, { name: "should return 200", jwt: testAuthToken, prep: func(setup *testSetup) { setup.mockAuthorizer.EXPECT().GetUserIdFromToken(testAuthToken). Return(testUserId, nil).Times(1) setup.mockUService.EXPECT().GetUserWithID(setup.testCtx, testUserId.Hex()). Return(&entities.User{ID: testUserId}, nil).Times(1) setup.mockEServiceV2.EXPECT().SendEmailVerificationEmail(setup.testCtx, entities.User{ID: testUserId}, emailVerificationURIs). Return(nil).Times(1) }, wantResCode: http.StatusOK, }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { setup := setupTest(t, map[string]string{ environment.JWTSecret: "test", }) defer setup.ctrl.Finish() mockRenderPageCall(setup) if tt.prep != nil { tt.prep(setup) } testutils.AddRequestWithFormParamsToCtx(setup.testCtx, http.MethodPost, map[string]string{}) setup.testCtx.Request.AddCookie(&http.Cookie{ Name: authCookieName, Value: tt.jwt, }) setup.router.VerifyEmailResend(setup.testCtx) assert.Equal(t, tt.wantResCode, setup.w.Code) }) } }
explode_data.jsonl/32972
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1395 }
[ 2830, 3393, 2334, 261, 1437, 4781, 1061, 408, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 3056, 1235, 341, 197, 11609, 286, 914, 198, 197, 40346, 79, 286, 2915, 4071, 1944, 21821, 340, 197, 12428, 9306, 260, 914, 198, 197, 50780, 1061,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestRemoveFile(t *testing.T) { testName := "docker.com/notary/certificate" testExt := "crt" perms := os.FileMode(0755) // Temporary directory where test files will be created tempBaseDir, err := ioutil.TempDir("", "notary-test-") if err != nil { t.Fatalf("failed to create a temporary directory: %v", err) } defer os.RemoveAll(tempBaseDir) // Since we're generating this manually we need to add the extension '.' expectedFilePath := filepath.Join(tempBaseDir, testName+"."+testExt) _, err = generateRandomFile(expectedFilePath, perms) if err != nil { t.Fatalf("failed to generate random file: %v", err) } // Create our SimpleFileStore store := &SimpleFileStore{ baseDir: tempBaseDir, fileExt: testExt, perms: perms, } // Call the Remove function err = store.Remove(testName) if err != nil { t.Fatalf("failed to remove file from store: %v", err) } // Check to see if file exists _, err = os.Stat(expectedFilePath) if err == nil { t.Fatalf("expected not to find file: %s", expectedFilePath) } }
explode_data.jsonl/54572
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 368 }
[ 2830, 3393, 13021, 1703, 1155, 353, 8840, 836, 8, 341, 18185, 675, 1669, 330, 28648, 905, 62441, 658, 2899, 20962, 698, 18185, 6756, 1669, 330, 66, 3342, 698, 197, 87772, 1669, 2643, 8576, 3636, 7, 15, 22, 20, 20, 692, 197, 322, 544...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestDetectThree(t *testing.T) { guesses := DetectThree(dkText) t.Logf("dkText: %+v", guesses) if !guesses.Reliable { t.Error("want result to be reliable") } if len(guesses.Estimates) < 1 { t.Error("want at least one language estimate") return } est := guesses.Estimates[0] if est.Percent < 10 { t.Errorf("want percent to be >10 in first estimate: %+v", est) } if est.Language != DANISH { t.Errorf("want language to be DANISH in first estimate: %+v", est) } guesses = DetectThree(``) t.Logf("empty: %+v", guesses) if guesses.Reliable { t.Error("do not want result to be reliable") } if len(guesses.Estimates) > 0 { t.Error("want no language estimates") return } guesses = DetectThree(`Stringer works best with`) t.Logf("short: %+v", guesses) if !guesses.Reliable { t.Error("want result to be reliable") } if len(guesses.Estimates) == 0 { t.Error("want at least one language estimate") return } }
explode_data.jsonl/18093
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 364 }
[ 2830, 3393, 57193, 19641, 1155, 353, 8840, 836, 8, 341, 3174, 33301, 288, 1669, 33287, 19641, 1500, 74, 1178, 340, 3244, 98954, 445, 7584, 1178, 25, 68524, 85, 497, 60537, 340, 743, 753, 51751, 288, 38939, 2156, 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...
9
func TestConn_DisconnectNotify_Close(t *testing.T) { c := jsonrpc2.NewConn(context.Background(), jsonrpc2.NewBufferedStream(&readWriteCloser{eof, eof}, jsonrpc2.VarintObjectCodec{}), nil) if err := c.Close(); err != nil { t.Error(err) } select { case <-c.DisconnectNotify(): case <-time.After(200 * time.Millisecond): t.Fatal("no disconnect notification") } }
explode_data.jsonl/50185
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 143 }
[ 2830, 3393, 9701, 45525, 6459, 28962, 68185, 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...
4
func TestLabelNew(t *testing.T) { g := NewGomegaWithT(t) l := New() g.Expect(l[NameLabelKey]).To(Equal("tidb-cluster")) g.Expect(l[ManagedByLabelKey]).To(Equal("tidb-operator")) }
explode_data.jsonl/22124
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 84 }
[ 2830, 3393, 2476, 3564, 1155, 353, 8840, 836, 8, 341, 3174, 1669, 1532, 38, 32696, 2354, 51, 1155, 692, 8810, 1669, 1532, 741, 3174, 81893, 2333, 58, 675, 2476, 1592, 10697, 1249, 67372, 445, 24449, 65, 93208, 5455, 3174, 81893, 2333, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestShouldReturnBadRequestWhenTimestampIsInvalid(t *testing.T) { // mock AccountsFetcher mockAccountsFetcher := &mockAccountsFetcher{} // mock PBS Analytics Module mockAnalyticsModule := &eventsMockAnalyticsModule{ Fail: false, } // mock config cfg := &config.Configuration{ AccountDefaults: config.Account{}, } // prepare reqData := "" req := httptest.NewRequest("GET", "/event?t=win&b=test&ts=q", strings.NewReader(reqData)) recorder := httptest.NewRecorder() e := NewEventEndpoint(cfg, mockAccountsFetcher, mockAnalyticsModule) // execute e(recorder, req, nil) d, err := ioutil.ReadAll(recorder.Result().Body) if err != nil { t.Fatal(err) } // validate assert.Equal(t, 400, recorder.Result().StatusCode, "Expected 400 on request with invalid timestamp parameter") assert.Equal(t, "invalid request: invalid request: error parsing timestamp 'q'\n", string(d)) }
explode_data.jsonl/135
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 311 }
[ 2830, 3393, 14996, 5598, 46015, 4498, 20812, 3872, 7928, 1155, 353, 8840, 836, 8, 1476, 197, 322, 7860, 40655, 97492, 198, 77333, 41369, 97492, 1669, 609, 16712, 41369, 97492, 31483, 197, 322, 7860, 59045, 32427, 13711, 198, 77333, 60539, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestAlterFuncMap_require(t *testing.T) { c := &chart.Chart{ Metadata: &chart.Metadata{Name: "conan"}, Templates: []*chart.File{ {Name: "templates/quote", Data: []byte(`All your base are belong to {{ required "A valid 'who' is required" .Values.who }}`)}, {Name: "templates/bases", Data: []byte(`All {{ required "A valid 'bases' is required" .Values.bases }} of them!`)}, }, } v := chartutil.Values{ "Values": chartutil.Values{ "who": "us", "bases": 2, }, "Chart": c.Metadata, "Release": chartutil.Values{ "Name": "That 90s meme", }, } out, err := Render(c, v) if err != nil { t.Fatal(err) } expectStr := "All your base are belong to us" if gotStr := out["conan/templates/quote"]; gotStr != expectStr { t.Errorf("Expected %q, got %q (%v)", expectStr, gotStr, out) } expectNum := "All 2 of them!" if gotNum := out["conan/templates/bases"]; gotNum != expectNum { t.Errorf("Expected %q, got %q (%v)", expectNum, gotNum, out) } // test required without passing in needed values with lint mode on // verifies lint replaces required with an empty string (should not fail) lintValues := chartutil.Values{ "Values": chartutil.Values{ "who": "us", }, "Chart": c.Metadata, "Release": chartutil.Values{ "Name": "That 90s meme", }, } var e Engine e.LintMode = true out, err = e.Render(c, lintValues) if err != nil { t.Fatal(err) } expectStr = "All your base are belong to us" if gotStr := out["conan/templates/quote"]; gotStr != expectStr { t.Errorf("Expected %q, got %q (%v)", expectStr, gotStr, out) } expectNum = "All of them!" if gotNum := out["conan/templates/bases"]; gotNum != expectNum { t.Errorf("Expected %q, got %q (%v)", expectNum, gotNum, out) } }
explode_data.jsonl/74709
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 703 }
[ 2830, 3393, 74290, 9626, 2227, 13793, 1155, 353, 8840, 836, 8, 341, 1444, 1669, 609, 15941, 42667, 515, 197, 9209, 7603, 25, 609, 15941, 46475, 63121, 25, 330, 443, 276, 7115, 197, 10261, 76793, 25, 29838, 15941, 8576, 515, 298, 197, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
7
func TestManualResultsWithNestedDetails(t *testing.T) { ctx, cancel := context.WithTimeout(context.Background(), defaultTestTimeout) defer cancel() ns, cleanup := getNamespace(t) defer cleanup() args := fmt.Sprintf("run --image-pull-policy IfNotPresent --wait -p testImage/yaml/manual-with-arbitrary-details.yaml -n %v", ns) mustRunSonobuoyCommandWithContext(ctx, t, args) tb := mustDownloadTarball(ctx, t, ns) tb = saveToArtifacts(t, tb) // Retrieve the sonobuoy results file from the tarball resultsArgs := fmt.Sprintf("results %v --plugin %v --mode dump", tb, "manual-with-arbitrary-details") resultsYaml := mustRunSonobuoyCommandWithContext(ctx, t, resultsArgs) var resultItem results.Item yaml.Unmarshal(resultsYaml.Bytes(), &resultItem) if len(resultItem.Items) != 1 { t.Fatalf("unexpected number of Items in results map, expected 1, got %v", len(resultItem.Items)) } actualDetails := resultItem.Items[0].Details expectedDetails := map[string]interface{}{ "nested-data": map[interface{}]interface{}{ "nested-key": "value", }, } if !reflect.DeepEqual(expectedDetails, actualDetails) { t.Errorf("unexpected value for details map, expected %q, got %q", expectedDetails, actualDetails) } }
explode_data.jsonl/66747
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 422 }
[ 2830, 3393, 52092, 9801, 2354, 71986, 7799, 1155, 353, 8840, 836, 8, 341, 20985, 11, 9121, 1669, 2266, 26124, 7636, 5378, 19047, 1507, 1638, 2271, 7636, 340, 16867, 9121, 2822, 84041, 11, 21290, 1669, 633, 22699, 1155, 340, 16867, 21290, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestConnectionEmptyUser(t *testing.T) { irccon := IRC("go-eventirc", "go-eventirc") // user may be changed after creation irccon.user = "" err := irccon.Connect("chat.freenode.net:6667") if err == nil { t.Fatal("empty 'user' not detected") } }
explode_data.jsonl/63348
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 98 }
[ 2830, 3393, 4526, 3522, 1474, 1155, 353, 8840, 836, 8, 341, 197, 2437, 443, 1669, 59328, 445, 3346, 39687, 2437, 497, 330, 3346, 39687, 2437, 1138, 197, 322, 1196, 1231, 387, 5497, 1283, 9688, 198, 197, 2437, 443, 3324, 284, 8389, 985...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestGet(t *testing.T) { key1 := Key{Path: "/service1/method1", KeyMap: "k1=v1,k2=v2"} key2 := Key{Path: "/service2/method2", KeyMap: "k1=v1,k2=v2"} val1 := Entry{HeaderData: "h1=v1"} val2 := Entry{HeaderData: "h2=v2"} tests := []struct { desc string keysToAdd []Key valsToAdd []*Entry keyToGet Key wantEntry *Entry }{ { desc: "Empty cache", keyToGet: Key{}, }, { desc: "Single entry miss", keysToAdd: []Key{key1}, valsToAdd: []*Entry{&val1}, keyToGet: Key{}, }, { desc: "Single entry hit", keysToAdd: []Key{key1}, valsToAdd: []*Entry{&val1}, keyToGet: key1, wantEntry: &val1, }, { desc: "Multi entry miss", keysToAdd: []Key{key1, key2}, valsToAdd: []*Entry{&val1, &val2}, keyToGet: Key{}, }, { desc: "Multi entry hit", keysToAdd: []Key{key1, key2}, valsToAdd: []*Entry{&val1, &val2}, keyToGet: key1, wantEntry: &val1, }, } for _, test := range tests { t.Run(test.desc, func(t *testing.T) { lru := NewLRU(testCacheMaxSize, nil) for i, key := range test.keysToAdd { lru.Add(key, test.valsToAdd[i]) } opts := []cmp.Option{ cmpopts.IgnoreInterfaces(struct{ sync.Locker }{}), cmpopts.IgnoreUnexported(Entry{}), } if gotEntry := lru.Get(test.keyToGet); !cmp.Equal(gotEntry, test.wantEntry, opts...) { t.Errorf("lru.Get(%+v) = %+v, want %+v", test.keyToGet, gotEntry, test.wantEntry) } }) } }
explode_data.jsonl/77596
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 740 }
[ 2830, 3393, 1949, 1155, 353, 8840, 836, 8, 341, 23634, 16, 1669, 5309, 90, 1820, 25, 3521, 7936, 16, 91837, 16, 497, 5309, 2227, 25, 330, 74, 16, 39254, 16, 16147, 17, 39254, 17, 16707, 23634, 17, 1669, 5309, 90, 1820, 25, 3521, 7...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestUntilStep(t *testing.T) { tests := map[string]string{ `{{range $i, $e := untilStep 0 5 1}}{{$i}}{{$e}}{{end}}`: "0011223344", `{{range $i, $e := untilStep 3 6 1}}{{$i}}{{$e}}{{end}}`: "031425", `{{range $i, $e := untilStep 0 -10 -2}}{{$i}}{{$e}} {{end}}`: "00 1-2 2-4 3-6 4-8 ", `{{range $i, $e := untilStep 3 0 1}}{{$i}}{{$e}}{{end}}`: "", `{{range $i, $e := untilStep 3 99 0}}{{$i}}{{$e}}{{end}}`: "", `{{range $i, $e := untilStep 3 99 -1}}{{$i}}{{$e}}{{end}}`: "", `{{range $i, $e := untilStep 3 0 0}}{{$i}}{{$e}}{{end}}`: "", } for tpl, expect := range tests { if err := runt(tpl, expect); err != nil { t.Error(err) } } }
explode_data.jsonl/82258
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 349 }
[ 2830, 3393, 24493, 8304, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 2415, 14032, 30953, 515, 197, 197, 63, 2979, 9669, 400, 72, 11, 400, 68, 1669, 3080, 8304, 220, 15, 220, 20, 220, 16, 3417, 29283, 72, 3417, 29283, 68, 77286, 408, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestHostnamesTostr(t *testing.T) { assert := tassert.New(t) actual := hostnamesTostr([]string{"foo", "bar", "baz"}) expected := "foo,bar,baz" assert.Equal(actual, expected) }
explode_data.jsonl/69759
{ "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, 9296, 11400, 1249, 495, 1155, 353, 8840, 836, 8, 341, 6948, 1669, 259, 2207, 7121, 1155, 340, 88814, 1669, 3468, 11400, 1249, 495, 10556, 917, 4913, 7975, 497, 330, 2257, 497, 330, 42573, 23625, 42400, 1669, 330, 7975, 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
func TestKojiJobTypeValidation(t *testing.T) { server, workers, _, cancel := newV2Server(t, t.TempDir(), []string{""}, false) handler := server.Handler("/api/image-builder-composer/v2") defer cancel() // Enqueue a compose job with N images (+ an Init and a Finalize job) // Enqueuing them manually gives us access to the job IDs to use in // requests. // TODO: set to 4 nImages := 1 initJob := worker.KojiInitJob{ Server: "test-server", Name: "test-job", Version: "42", Release: "1", } initID, err := workers.EnqueueKojiInit(&initJob, "") require.NoError(t, err) buildJobs := make([]worker.OSBuildKojiJob, nImages) buildJobIDs := make([]uuid.UUID, nImages) filenames := make([]string, nImages) for idx := 0; idx < nImages; idx++ { fname := fmt.Sprintf("image-file-%04d", idx) buildJob := worker.OSBuildKojiJob{ ImageName: fmt.Sprintf("build-job-%04d", idx), KojiServer: "test-server", KojiDirectory: "koji-server-test-dir", KojiFilename: fname, } buildID, err := workers.EnqueueOSBuildKoji(fmt.Sprintf("fake-arch-%d", idx), &buildJob, initID, "") require.NoError(t, err) buildJobs[idx] = buildJob buildJobIDs[idx] = buildID filenames[idx] = fname } finalizeJob := worker.KojiFinalizeJob{ Server: "test-server", Name: "test-job", Version: "42", Release: "1", KojiFilenames: filenames, KojiDirectory: "koji-server-test-dir", TaskID: 0, StartTime: uint64(time.Now().Unix()), } finalizeID, err := workers.EnqueueKojiFinalize(&finalizeJob, initID, buildJobIDs, "") require.NoError(t, err) // ----- Jobs queued - Test API endpoints (status, manifests, logs) ----- // for _, path := range []string{"", "/manifests", "/logs"} { // should return OK - actual result should be tested elsewhere test.TestRoute(t, handler, false, "GET", fmt.Sprintf("/api/image-builder-composer/v2/composes/%s%s", finalizeID, path), ``, http.StatusOK, "*") // The other IDs should fail test.TestRoute(t, handler, false, "GET", fmt.Sprintf("/api/image-builder-composer/v2/composes/%s%s", initID, path), ``, http.StatusNotFound, `{"code":"IMAGE-BUILDER-COMPOSER-26","href":"/api/image-builder-composer/v2/errors/26","id":"26","kind":"Error","reason":"Requested job has invalid type"}`, `operation_id`) for _, buildID := range buildJobIDs { test.TestRoute(t, handler, false, "GET", fmt.Sprintf("/api/image-builder-composer/v2/composes/%s%s", buildID, path), ``, http.StatusNotFound, `{"code":"IMAGE-BUILDER-COMPOSER-26","href":"/api/image-builder-composer/v2/errors/26","id":"26","kind":"Error","reason":"Requested job has invalid type"}`, `operation_id`) } badID := uuid.New() test.TestRoute(t, handler, false, "GET", fmt.Sprintf("/api/image-builder-composer/v2/composes/%s%s", badID, path), ``, http.StatusNotFound, `{"code":"IMAGE-BUILDER-COMPOSER-15","href":"/api/image-builder-composer/v2/errors/15","id":"15","kind":"Error","reason":"Compose with given id not found"}`, `operation_id`) } }
explode_data.jsonl/10378
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1195 }
[ 2830, 3393, 42, 26902, 12245, 929, 13799, 1155, 353, 8840, 836, 8, 341, 41057, 11, 7337, 11, 8358, 9121, 1669, 501, 53, 17, 5475, 1155, 11, 259, 65009, 6184, 1507, 3056, 917, 90, 3014, 2137, 895, 340, 53326, 1669, 3538, 31010, 4283, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestConfigPropagation(t *testing.T) { t.Run("ProcPath is passed down if not present", func(t *testing.T) { c := &Config{ ProcPath: "/hostfs/proc", Monitors: []MonitorConfig{ {}, {ProcPath: "/proc"}, }, } err := c.propagateValuesDown() require.Nil(t, err) require.Equal(t, c.Monitors[0].ProcPath, "/hostfs/proc") require.Equal(t, c.Monitors[1].ProcPath, "/proc") }) }
explode_data.jsonl/60379
{ "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, 2648, 35172, 1155, 353, 8840, 836, 8, 341, 3244, 16708, 445, 24508, 1820, 374, 5823, 1495, 421, 537, 3042, 497, 2915, 1155, 353, 8840, 836, 8, 341, 197, 1444, 1669, 609, 2648, 515, 298, 197, 24508, 1820, 25, 3521, 3790, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestMysqlDNSAddTimeout(t *testing.T) { tests := []struct { input string output string }{ { "", "tcp(127.0.0.1:3306)/?timeout=5s", }, { "tcp(192.168.1.1:3306)/", "tcp(192.168.1.1:3306)/?timeout=5s", }, { "root:passwd@tcp(192.168.1.1:3306)/?tls=false", "root:passwd@tcp(192.168.1.1:3306)/?timeout=5s&tls=false", }, { "root:passwd@tcp(192.168.1.1:3306)/?tls=false&timeout=10s", "root:passwd@tcp(192.168.1.1:3306)/?timeout=10s&tls=false", }, { "tcp(10.150.1.123:3306)/", "tcp(10.150.1.123:3306)/?timeout=5s", }, { "root:@!~(*&$#%(&@#(@&#Password@tcp(10.150.1.123:3306)/", "root:@!~(*&$#%(&@#(@&#Password@tcp(10.150.1.123:3306)/?timeout=5s", }, { "root:Test3a#@!@tcp(10.150.1.123:3306)/", "root:Test3a#@!@tcp(10.150.1.123:3306)/?timeout=5s", }, } for _, test := range tests { output, _ := dsnAddTimeout(test.input) if output != test.output { t.Errorf("Expected %s, got %s\n", test.output, output) } } }
explode_data.jsonl/71240
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 568 }
[ 2830, 3393, 44, 14869, 61088, 2212, 7636, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 3056, 1235, 341, 197, 22427, 220, 914, 198, 197, 21170, 914, 198, 197, 59403, 197, 197, 515, 298, 197, 39680, 298, 197, 1, 27161, 7, 16, 17, 22, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestListOffsetsRequest(t *testing.T) { prototest.TestRequest(t, v1, &listoffsets.Request{ ReplicaID: 1, Topics: []listoffsets.RequestTopic{ { Topic: "topic-1", Partitions: []listoffsets.RequestPartition{ {Partition: 0, Timestamp: 1e9}, {Partition: 1, Timestamp: 1e9}, {Partition: 2, Timestamp: 1e9}, }, }, }, }) prototest.TestRequest(t, v4, &listoffsets.Request{ ReplicaID: 1, IsolationLevel: 2, Topics: []listoffsets.RequestTopic{ { Topic: "topic-1", Partitions: []listoffsets.RequestPartition{ {Partition: 0, Timestamp: 1e9}, {Partition: 1, Timestamp: 1e9}, {Partition: 2, Timestamp: 1e9}, }, }, { Topic: "topic-2", Partitions: []listoffsets.RequestPartition{ {Partition: 0, CurrentLeaderEpoch: 10, Timestamp: 1e9}, {Partition: 1, CurrentLeaderEpoch: 11, Timestamp: 1e9}, {Partition: 2, CurrentLeaderEpoch: 12, Timestamp: 1e9}, }, }, }, }) }
explode_data.jsonl/30016
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 457 }
[ 2830, 3393, 852, 81095, 1900, 1155, 353, 8840, 836, 8, 341, 197, 4391, 354, 477, 8787, 1900, 1155, 11, 348, 16, 11, 609, 1607, 3176, 82, 9659, 515, 197, 197, 18327, 15317, 915, 25, 220, 16, 345, 197, 197, 45003, 25, 3056, 1607, 31...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestIdAlice(t *testing.T) { tc := SetupEngineTest(t, "id") defer tc.Cleanup() idUI, result, err := runIdentify(&tc, "t_alice") if err != nil { t.Fatal(err) } checkAliceProofs(t, idUI, &result.Upk) checkDisplayKeys(t, idUI, 1, 1) }
explode_data.jsonl/52982
{ "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, 764, 61686, 1155, 353, 8840, 836, 8, 341, 78255, 1669, 18626, 4571, 2271, 1155, 11, 330, 307, 1138, 16867, 17130, 727, 60639, 741, 15710, 2275, 11, 1102, 11, 1848, 1669, 1598, 28301, 1437, 2099, 10413, 11, 330, 83, 8418, 5...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestSelectableFieldLabelConversions(t *testing.T) { apitesting.TestSelectableFieldLabelConversionsOfKind(t, registered.GroupOrDie(api.GroupName).GroupVersion.String(), "PodTemplate", PodTemplateToSelectableFields(&api.PodTemplate{}), nil, ) }
explode_data.jsonl/43667
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 88 }
[ 2830, 3393, 68707, 1877, 2476, 1109, 28290, 1155, 353, 8840, 836, 8, 341, 69898, 275, 59855, 8787, 68707, 1877, 2476, 1109, 28290, 2124, 10629, 1155, 345, 197, 29422, 291, 5407, 2195, 18175, 24827, 5407, 675, 568, 2808, 5637, 6431, 3148, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestClientHeaderCase(t *testing.T) { t.Parallel() ln := fasthttputil.NewInmemoryListener() defer ln.Close() go func() { c, err := ln.Accept() if err != nil { t.Error(err) } c.Write([]byte("HTTP/1.1 200 OK\r\n" + //nolint:errcheck "content-type: text/plain\r\n" + "transfer-encoding: chunked\r\n\r\n" + "24\r\nThis is the data in the first chunk \r\n" + "1B\r\nand this is the second one \r\n" + "0\r\n\r\n", )) }() c := &Client{ Dial: func(addr string) (net.Conn, error) { return ln.Dial() }, ReadTimeout: time.Millisecond * 10, // Even without name normalizing we should parse headers correctly. DisableHeaderNamesNormalizing: true, } code, body, err := c.Get(nil, "http://example.com") if err != nil { t.Error(err) } else if code != 200 { t.Errorf("expected status code 200 got %d", code) } else if string(body) != "This is the data in the first chunk and this is the second one " { t.Errorf("wrong body: %q", body) } }
explode_data.jsonl/79342
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 419 }
[ 2830, 3393, 2959, 4047, 4207, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 2822, 197, 2261, 1669, 4937, 96336, 628, 321, 7121, 641, 17269, 2743, 741, 16867, 29390, 10421, 2822, 30680, 2915, 368, 341, 197, 1444, 11, 1848, 1669, 29390...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestCurrentBranchDefault(t *testing.T) { testRepo := newTestRepo(t) defer testRepo.cleanup(t) branch, err := testRepo.sut.CurrentBranch() require.Nil(t, err) require.Equal(t, branch, testRepo.branchName) }
explode_data.jsonl/14018
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 90 }
[ 2830, 3393, 5405, 18197, 3675, 1155, 353, 8840, 836, 8, 341, 18185, 25243, 1669, 501, 2271, 25243, 1155, 340, 16867, 1273, 25243, 87689, 1155, 692, 197, 17940, 11, 1848, 1669, 1273, 25243, 514, 332, 11517, 18197, 741, 17957, 59678, 1155, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
func TestSaveArtifactsRunError(t *testing.T) { tests := []error{ fmt.Errorf("Run error"), stierr.NewContainerError("", -1, ""), } expected := []error{ tests[0], stierr.NewSaveArtifactsError("", "", tests[1]), } // test with tar extract error or not tarError := []bool{true, false} for i := range tests { for _, te := range tarError { bh := testBuildHandler() fd := bh.docker.(*docker.FakeDocker) th := bh.tar.(*test.FakeTar) fd.RunContainerError = tests[i] if te { th.ExtractTarError = fmt.Errorf("tar error") } err := bh.Save(bh.config) if !te && err != expected[i] { t.Errorf("Unexpected error returned from saveArtifacts: %v", err) } else if te && err != th.ExtractTarError { t.Errorf("Expected tar error. Got %v", err) } } } }
explode_data.jsonl/59441
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 331 }
[ 2830, 3393, 8784, 9286, 26401, 6727, 1454, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 3056, 841, 515, 197, 11009, 13080, 445, 6727, 1465, 4461, 197, 18388, 72, 615, 7121, 4502, 1454, 19814, 481, 16, 11, 72712, 197, 532, 42400, 1669, 3...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
8
func TestPrepareReviewersBody(t *testing.T) { var tests = []struct { name string logins []string expectedBody map[string][]string }{ { name: "one reviewer", logins: []string{"george"}, expectedBody: map[string][]string{"reviewers": {"george"}}, }, { name: "three reviewers", logins: []string{"george", "jungle", "chimp"}, expectedBody: map[string][]string{"reviewers": {"george", "jungle", "chimp"}}, }, { name: "one team", logins: []string{"kubernetes/sig-testing-misc"}, expectedBody: map[string][]string{"team_reviewers": {"sig-testing-misc"}}, }, { name: "two teams", logins: []string{"kubernetes/sig-testing-misc", "kubernetes/sig-testing-bugs"}, expectedBody: map[string][]string{"team_reviewers": {"sig-testing-misc", "sig-testing-bugs"}}, }, { name: "one team not in org", logins: []string{"kubernetes/sig-testing-misc", "other-org/sig-testing-bugs"}, expectedBody: map[string][]string{"team_reviewers": {"sig-testing-misc"}}, }, { name: "mixed single", logins: []string{"george", "kubernetes/sig-testing-misc"}, expectedBody: map[string][]string{"reviewers": {"george"}, "team_reviewers": {"sig-testing-misc"}}, }, { name: "mixed multiple", logins: []string{"george", "kubernetes/sig-testing-misc", "kubernetes/sig-testing-bugs", "jungle", "chimp"}, expectedBody: map[string][]string{"reviewers": {"george", "jungle", "chimp"}, "team_reviewers": {"sig-testing-misc", "sig-testing-bugs"}}, }, } for _, test := range tests { body, _ := prepareReviewersBody(test.logins, "kubernetes") if !reflect.DeepEqual(body, test.expectedBody) { t.Errorf("%s: got %s instead of %s", test.name, body, test.expectedBody) } } }
explode_data.jsonl/6273
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 817 }
[ 2830, 3393, 50590, 19432, 388, 5444, 1155, 353, 8840, 836, 8, 341, 2405, 7032, 284, 3056, 1235, 341, 197, 11609, 260, 914, 198, 197, 6725, 1330, 981, 3056, 917, 198, 197, 42400, 5444, 2415, 14032, 45725, 917, 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...
3
func TestResponseWriterWriteString(t *testing.T) { r := httptest.NewRecorder() w := NewResponseWriter(r) s := "Don't communicate by sharing memory, share memory by communicating." _, err := w.WriteString(s) equal(t, nil, err) equal(t, s, r.Body.String()) }
explode_data.jsonl/22518
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 92 }
[ 2830, 3393, 2582, 6492, 7985, 703, 1155, 353, 8840, 836, 8, 341, 7000, 1669, 54320, 70334, 7121, 47023, 741, 6692, 1669, 1532, 2582, 6492, 2601, 340, 1903, 1669, 330, 8002, 944, 19032, 553, 11560, 4938, 11, 4332, 4938, 553, 41147, 2217,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestShouldReturnTrueWhenCheckingForSchemaDiffSuppressForTagFilterOfApplicationConfigAndValueCannotBeNormalizedAndOldAndNewValueAreEqual(t *testing.T) { resourceHandle := NewApplicationConfigResourceHandle() schema := resourceHandle.MetaData().Schema invalidValue := invalidTagFilter require.True(t, schema[ApplicationConfigFieldTagFilter].DiffSuppressFunc(ApplicationConfigFieldTagFilter, invalidValue, invalidValue, nil)) }
explode_data.jsonl/64927
{ "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, 14996, 5598, 2514, 4498, 40129, 2461, 8632, 21751, 17670, 2461, 5668, 5632, 2124, 4988, 2648, 3036, 1130, 17444, 3430, 79082, 3036, 18284, 3036, 3564, 1130, 11526, 2993, 1155, 353, 8840, 836, 8, 341, 50346, 6999, 1669, 1532, 4...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestFilterWithStringsSlice(t *testing.T) { p1 := New() p1.Set("1", "1") p1.Set("2", "2") p1.Set("3", "3") p1.Set("4", "4") p2 := New() p2.Set("2", "2") p2.Set("4", "4") p1.Filter([]string{"4", "2"}) assert.Equal(t, p2, p1) }
explode_data.jsonl/1468
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 135 }
[ 2830, 3393, 5632, 2354, 20859, 33236, 1155, 353, 8840, 836, 8, 341, 3223, 16, 1669, 1532, 741, 3223, 16, 4202, 445, 16, 497, 330, 16, 1138, 3223, 16, 4202, 445, 17, 497, 330, 17, 1138, 3223, 16, 4202, 445, 18, 497, 330, 18, 1138, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestNotifyClusterPluginEvent(t *testing.T) { th := Setup().InitBasic() defer th.TearDown() testCluster := &testlib.FakeClusterInterface{} th.Server.Cluster = testCluster th.App.UpdateConfig(func(cfg *model.Config) { *cfg.PluginSettings.Enable = true *cfg.PluginSettings.EnableUploads = true }) path, _ := fileutils.FindDir("tests") tarData, err := ioutil.ReadFile(filepath.Join(path, "testplugin.tar.gz")) require.NoError(t, err) testCluster.ClearMessages() // Successful upload manifest, resp := th.SystemAdminClient.UploadPlugin(bytes.NewReader(tarData)) CheckNoError(t, resp) require.Equal(t, "testplugin", manifest.Id) // Stored in File Store: Upload Plugin case expectedPath := filepath.Join("./plugins", manifest.Id) + ".tar.gz" pluginStored, err := th.App.FileExists(expectedPath) require.Nil(t, err) require.True(t, pluginStored) messages := testCluster.GetMessages() expectedPluginData := model.PluginEventData{ Id: manifest.Id, } expectedInstallMessage := &model.ClusterMessage{ Event: model.CLUSTER_EVENT_INSTALL_PLUGIN, SendType: model.CLUSTER_SEND_RELIABLE, WaitForAllToSend: true, Data: expectedPluginData.ToJson(), } actualMessages := findClusterMessages(model.CLUSTER_EVENT_INSTALL_PLUGIN, messages) require.Equal(t, []*model.ClusterMessage{expectedInstallMessage}, actualMessages) // Upgrade testCluster.ClearMessages() manifest, resp = th.SystemAdminClient.UploadPluginForced(bytes.NewReader(tarData)) CheckNoError(t, resp) require.Equal(t, "testplugin", manifest.Id) // Successful remove webSocketClient, err := th.CreateWebSocketSystemAdminClient() require.Nil(t, err) webSocketClient.Listen() defer webSocketClient.Close() done := make(chan bool) go func() { for { select { case resp := <-webSocketClient.EventChannel: if resp.EventType() == model.WEBSOCKET_EVENT_PLUGIN_STATUSES_CHANGED && len(resp.GetData()["plugin_statuses"].([]interface{})) == 0 { done <- true return } case <-time.After(5 * time.Second): done <- false return } } }() testCluster.ClearMessages() ok, resp := th.SystemAdminClient.RemovePlugin(manifest.Id) CheckNoError(t, resp) require.True(t, ok) result := <-done require.True(t, result, "plugin_statuses_changed websocket event was not received") messages = testCluster.GetMessages() expectedRemoveMessage := &model.ClusterMessage{ Event: model.CLUSTER_EVENT_REMOVE_PLUGIN, SendType: model.CLUSTER_SEND_RELIABLE, WaitForAllToSend: true, Data: expectedPluginData.ToJson(), } actualMessages = findClusterMessages(model.CLUSTER_EVENT_REMOVE_PLUGIN, messages) require.Equal(t, []*model.ClusterMessage{expectedRemoveMessage}, actualMessages) pluginStored, err = th.App.FileExists(expectedPath) require.Nil(t, err) require.False(t, pluginStored) }
explode_data.jsonl/27535
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1099 }
[ 2830, 3393, 28962, 28678, 11546, 1556, 1155, 353, 8840, 836, 8, 341, 70479, 1669, 18626, 1005, 3803, 15944, 741, 16867, 270, 836, 682, 4454, 2822, 18185, 28678, 1669, 609, 1944, 2740, 991, 726, 28678, 5051, 16094, 70479, 22997, 72883, 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...
1
func TestAsync(t *testing.T) { goqueue_tests.Async(t, func(size int) interface { goqueue.Owner goqueue.Enqueuer goqueue.Dequeuer goqueue.Info } { return finite.New(size) }) }
explode_data.jsonl/54516
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 80 }
[ 2830, 3393, 6525, 1155, 353, 8840, 836, 8, 341, 30680, 4584, 32509, 44119, 1155, 11, 2915, 6856, 526, 8, 3749, 341, 197, 30680, 4584, 49920, 198, 197, 30680, 4584, 22834, 591, 8801, 198, 197, 30680, 4584, 8934, 591, 8801, 198, 197, 30...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestClientTimeoutInternalError(t *testing.T) { c := dc().SetTimeout(time.Second * 1) _, _ = c.R().Get("http://localhost:9000/set-timeout-test") }
explode_data.jsonl/39339
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 56 }
[ 2830, 3393, 2959, 7636, 11569, 1454, 1155, 353, 8840, 836, 8, 341, 1444, 1669, 19402, 1005, 1649, 7636, 9730, 32435, 353, 220, 16, 340, 197, 6878, 716, 284, 272, 2013, 1005, 1949, 445, 1254, 1110, 8301, 25, 24, 15, 15, 15, 47267, 72...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_randBool(t *testing.T) { tests := []struct { name string want bool }{ // TODO: Add test cases. } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { if got := randBool(); got != tt.want { t.Errorf("randBool() = %v, want %v", got, tt.want) } }) } }
explode_data.jsonl/47731
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 140 }
[ 2830, 3393, 33864, 11233, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 3056, 1235, 341, 197, 11609, 914, 198, 197, 50780, 1807, 198, 197, 59403, 197, 197, 322, 5343, 25, 2691, 1273, 5048, 624, 197, 532, 2023, 8358, 17853, 1669, 2088, 70...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestRequest_SetAllFields(t *testing.T) { testCases := []struct { name string success bool request *Request expected string }{ { name: "Set simple request", success: true, request: NewRequest().SetID("fake_id").SetMethod("test").SetParams("test"), expected: `{"jsonrpc": "2.0", "method": "test", "id": "fake_id", "params": "test"}`, }, { name: "Set complex request", success: true, request: NewRequest().SetParams(struct { Foo string `json:"foo"` Bar []int `json:"bar"` Baz struct { Bool bool `json:"bool"` Dog []string `json:"dog"` } `json:"baz"` }{ Foo: "foo", Bar: []int{5, 6}, Baz: struct { Bool bool `json:"bool"` Dog []string `json:"dog"` }{ Bool: false, Dog: []string{"baz", "baz"}, }, }).SetID(4).SetMethod("complex"), expected: `{"jsonrpc": "2.0", "method": "complex", "id": 4, "params": {"bar": [5, 6], "baz": {"bool": false, "dog": ["baz", "baz"]}, "foo": "foo"}}`, }, } for _, tt := range testCases { t.Run(tt.name, func(t *testing.T) { data, err := json.Marshal(tt.request) assert.Nil(t, err, "marshal request should not fail") assert.JSONEq(t, tt.expected, string(data)) }) } }
explode_data.jsonl/66301
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 590 }
[ 2830, 3393, 1900, 14812, 2403, 8941, 1155, 353, 8840, 836, 8, 341, 18185, 37302, 1669, 3056, 1235, 341, 197, 11609, 257, 914, 198, 197, 30553, 220, 1807, 198, 197, 23555, 220, 353, 1900, 198, 197, 42400, 914, 198, 197, 59403, 197, 197...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestIPAddrFamily(t *testing.T) { for _, tt := range ipAddrFamilyTests { if af := tt.in.To4() != nil; af != tt.af4 { t.Errorf("verifying IPv4 address family for %q = %v, want %v", tt.in, af, tt.af4) } if af := len(tt.in) == IPv6len && tt.in.To4() == nil; af != tt.af6 { t.Errorf("verifying IPv6 address family for %q = %v, want %v", tt.in, af, tt.af6) } } }
explode_data.jsonl/14229
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 182 }
[ 2830, 3393, 3298, 13986, 15192, 1155, 353, 8840, 836, 8, 341, 2023, 8358, 17853, 1669, 2088, 5997, 13986, 15192, 18200, 341, 197, 743, 7977, 1669, 17853, 1858, 3274, 19, 368, 961, 2092, 26, 7977, 961, 17853, 60951, 19, 341, 298, 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...
5
func TestBidSizeValidate(t *testing.T) { bids := make(pbs.PBSBidSlice, 0) // bid1 will be rejected due to undefined size when adunit has multiple sizes bid1 := pbs.PBSBid{ BidID: "test_bidid1", AdUnitCode: "test_adunitcode1", BidderCode: "randNetwork", Price: 1.05, Adm: "test_adm", // Width: 100, // Height: 100, CreativeMediaType: "banner", } bids = append(bids, &bid1) // bid2 will be considered a normal ideal banner bid bid2 := pbs.PBSBid{ BidID: "test_bidid2", AdUnitCode: "test_adunitcode2", BidderCode: "randNetwork", Price: 1.05, Adm: "test_adm", Width: 100, Height: 100, CreativeMediaType: "banner", } bids = append(bids, &bid2) // bid3 will have it's dimensions set based on sizes defined in request bid3 := pbs.PBSBid{ BidID: "test_bidid3", AdUnitCode: "test_adunitcode3", BidderCode: "randNetwork", Price: 1.05, Adm: "test_adm", //Width: 200, //Height: 200, CreativeMediaType: "banner", } bids = append(bids, &bid3) // bid4 will be ignored as it's a video creative type bid4 := pbs.PBSBid{ BidID: "test_bidid_video", AdUnitCode: "test_adunitcode_video", BidderCode: "randNetwork", Price: 1.05, Adm: "test_adm", //Width: 400, //Height: 400, CreativeMediaType: "video", } bids = append(bids, &bid4) mybidder := pbs.PBSBidder{ BidderCode: "randNetwork", AdUnitCode: "test_adunitcode", AdUnits: []pbs.PBSAdUnit{ { BidID: "test_bidid1", Sizes: []openrtb.Format{ { W: 350, H: 250, }, { W: 300, H: 50, }, }, Code: "test_adunitcode1", MediaTypes: []pbs.MediaType{ pbs.MEDIA_TYPE_BANNER, }, }, { BidID: "test_bidid2", Sizes: []openrtb.Format{ { W: 100, H: 100, }, }, Code: "test_adunitcode2", MediaTypes: []pbs.MediaType{ pbs.MEDIA_TYPE_BANNER, }, }, { BidID: "test_bidid3", Sizes: []openrtb.Format{ { W: 200, H: 200, }, }, Code: "test_adunitcode3", MediaTypes: []pbs.MediaType{ pbs.MEDIA_TYPE_BANNER, }, }, { BidID: "test_bidid_video", Sizes: []openrtb.Format{ { W: 400, H: 400, }, }, Code: "test_adunitcode_video", MediaTypes: []pbs.MediaType{ pbs.MEDIA_TYPE_VIDEO, }, }, { BidID: "test_bidid3", Sizes: []openrtb.Format{ { W: 150, H: 150, }, }, Code: "test_adunitcode_x", MediaTypes: []pbs.MediaType{ pbs.MEDIA_TYPE_BANNER, }, }, { BidID: "test_bidid_y", Sizes: []openrtb.Format{ { W: 150, H: 150, }, }, Code: "test_adunitcode_3", MediaTypes: []pbs.MediaType{ pbs.MEDIA_TYPE_BANNER, }, }, }, } bids = checkForValidBidSize(bids, &mybidder) testdata, _ := json.MarshalIndent(bids, "", " ") if len(bids) != 3 { t.Errorf("Detected returned bid list did not contain only 3 bid objects as expected.\nBelow is the contents of the bid list\n%v", string(testdata)) } for _, bid := range bids { if bid.BidID == "test_bidid3" { if bid.Width == 0 && bid.Height == 0 { t.Errorf("Detected the Width & Height attributes in test bidID %v were not set to the dimensions used from the mybidder object", bid.BidID) } } } }
explode_data.jsonl/35894
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1899 }
[ 2830, 3393, 65452, 1695, 17926, 1155, 353, 8840, 836, 8, 341, 2233, 3365, 1669, 1281, 1295, 1279, 1069, 7347, 65452, 33236, 11, 220, 15, 340, 197, 322, 14103, 16, 686, 387, 17551, 4152, 311, 5614, 1379, 979, 993, 3843, 702, 5248, 1228...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestBuffer_LenOverfill(t *testing.T) { m := Metric() b := setup(NewBuffer("test", 5)) setup(b) b.Add(m, m, m, m, m, m) require.Equal(t, 5, b.Len()) }
explode_data.jsonl/17662
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 76 }
[ 2830, 3393, 4095, 2351, 268, 1918, 7559, 1155, 353, 8840, 836, 8, 341, 2109, 1669, 52458, 741, 2233, 1669, 6505, 35063, 4095, 445, 1944, 497, 220, 20, 1171, 84571, 1883, 340, 2233, 1904, 1255, 11, 296, 11, 296, 11, 296, 11, 296, 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
func TestRandomValidStrings(t *testing.T) { rand.Seed(time.Now().UnixNano()) b := make([]byte, 200) for i := 0; i < 1000; i++ { n, err := rand.Read(b[:rand.Int()%len(b)]) if err != nil { t.Fatal("get random data failed:", err) } sm, err := json.Marshal(string(b[:n])) if err != nil { t.Fatal("marshal data failed:",err) } var su string if err := json.Unmarshal(sm, &su); err != nil { t.Fatal("unmarshal data failed:",err) } token, err := GetFromString(`{"str":`+string(sm)+`}`, "str") if err != nil { t.Fatal("search data failed:",err) } x, _ := token.Interface() if x.(string) != su { t.Fatalf("string mismatch, exp: %v, got: %v", su, x) } } }
explode_data.jsonl/62343
{ "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, 13999, 4088, 20859, 1155, 353, 8840, 836, 8, 341, 262, 10382, 5732, 291, 9730, 13244, 1005, 55832, 83819, 2398, 262, 293, 1669, 1281, 10556, 3782, 11, 220, 17, 15, 15, 340, 262, 369, 600, 1669, 220, 15, 26, 600, 366, 220...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
7