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 TestFlowResolversErr(t *testing.T) { expected := errors.New("mock") resolver := func(*broker.Context) (specs.FlowListInterface, error) { return nil, expected } ctx := logger.WithLogger(broker.NewBackground()) resolvers := FlowsResolvers{resolver} _, err := resolvers.Resolve(ctx) if err == nil { t.Fatal("unexpected pass") } if err != expected { t.Fatalf("unexpected error %s, expected %s", err, expected) } }
explode_data.jsonl/2205
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 162 }
[ 2830, 3393, 18878, 1061, 39435, 7747, 1155, 353, 8840, 836, 8, 341, 42400, 1669, 5975, 7121, 445, 16712, 1138, 10202, 7921, 1669, 2915, 4071, 69309, 9328, 8, 320, 94531, 60732, 852, 5051, 11, 1465, 8, 341, 197, 853, 2092, 11, 3601, 19...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestNewRollupTargetV1ProtoInvalidProto(t *testing.T) { proto := &rulepb.RollupTarget{ Policies: []*policypb.Policy{ &policypb.Policy{ StoragePolicy: &policypb.StoragePolicy{ Resolution: policypb.Resolution{ WindowSize: 10 * time.Second.Nanoseconds(), Precision: time.Second.Nanoseconds(), }, Retention: policypb.Retention{ Period: 24 * time.Hour.Nanoseconds(), }, }, AggregationTypes: []aggregationpb.AggregationType{10, 1234567}, }, }, } _, err := newRollupTargetFromV1Proto(proto) require.Error(t, err) }
explode_data.jsonl/8361
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 261 }
[ 2830, 3393, 3564, 32355, 454, 6397, 53, 16, 31549, 7928, 31549, 1155, 353, 8840, 836, 8, 341, 197, 15110, 1669, 609, 12937, 16650, 71212, 454, 6397, 515, 197, 10025, 42038, 25, 29838, 79, 7762, 1082, 65, 1069, 8018, 515, 298, 197, 967...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestLimits(t *testing.T) { LimitTestN(0, t) LimitTestN(1, t) LimitTestN(2, t) LimitTestN(1024, t) OverLimitTestN(0, t) OverLimitTestN(1, t) OverLimitTestN(2, t) OverLimitTestN(1024, t) }
explode_data.jsonl/62840
{ "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, 94588, 1155, 353, 8840, 836, 8, 341, 15070, 2353, 2271, 45, 7, 15, 11, 259, 340, 15070, 2353, 2271, 45, 7, 16, 11, 259, 340, 15070, 2353, 2271, 45, 7, 17, 11, 259, 340, 15070, 2353, 2271, 45, 7, 16, 15, 17, 19, 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 Test_search_request_scroll_20a36eb5a76396b7febf7b7166366f30(t *testing.T) { es, _ := elasticsearch.NewDefaultClient() // tag:20a36eb5a76396b7febf7b7166366f30[] res, err := es.Search( es.Search.WithIndex("twitter"), es.Search.WithBody(strings.NewReader(`{ "size": 100, "query": { "match": { "title": "elasticsearch" } } }`)), es.Search.WithScroll(time.Duration(60000000000)), es.Search.WithPretty(), ) fmt.Println(res, err) if err != nil { // SKIP t.Fatalf("Error getting the response: %s", err) // SKIP } // SKIP defer res.Body.Close() // SKIP // end:20a36eb5a76396b7febf7b7166366f30[] }
explode_data.jsonl/51125
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 297 }
[ 2830, 3393, 10716, 7893, 41407, 62, 17, 15, 64, 18, 21, 3065, 20, 64, 22, 21, 18, 24, 21, 65, 22, 1859, 13233, 22, 65, 22, 16, 21, 21, 18, 21, 21, 69, 18, 15, 1155, 353, 8840, 836, 8, 341, 78966, 11, 716, 1669, 655, 27791, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestConfig_LoadSingleInput(t *testing.T) { c := NewConfig() c.LoadConfig("./testdata/single_plugin.toml") input := inputs.Inputs["memcached"]().(*MockupInputPlugin) input.Servers = []string{"localhost"} filter := models.Filter{ NameDrop: []string{"metricname2"}, NamePass: []string{"metricname1"}, FieldDrop: []string{"other", "stuff"}, FieldPass: []string{"some", "strings"}, TagDrop: []models.TagFilter{ { Name: "badtag", Filter: []string{"othertag"}, }, }, TagPass: []models.TagFilter{ { Name: "goodtag", Filter: []string{"mytag"}, }, }, } require.NoError(t, filter.Compile()) inputConfig := &models.InputConfig{ Name: "memcached", Filter: filter, Interval: 5 * time.Second, } inputConfig.Tags = make(map[string]string) // Ignore Log and Parser c.Inputs[0].Input.(*MockupInputPlugin).Log = nil c.Inputs[0].Input.(*MockupInputPlugin).parser = nil require.Equal(t, input, c.Inputs[0].Input, "Testdata did not produce a correct memcached struct.") require.Equal(t, inputConfig, c.Inputs[0].Config, "Testdata did not produce correct memcached metadata.") }
explode_data.jsonl/72167
{ "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, 2648, 19553, 10888, 2505, 1155, 353, 8840, 836, 8, 341, 1444, 1669, 1532, 2648, 741, 1444, 13969, 2648, 13988, 92425, 96562, 23110, 73494, 75, 5130, 22427, 1669, 11127, 16130, 82, 1183, 10536, 32918, 1341, 1005, 4071, 11571, 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 TestKafkaClient_readString(t *testing.T) { buf := bytes.NewBuffer([]byte("\x00\x04test")) result, err := readString(buf) assert.Equalf(t, "test", result, "Expected readString to return test, not %v", result) assert.Nil(t, err, "Expected readString to return no error") }
explode_data.jsonl/34257
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 100 }
[ 2830, 3393, 42, 21883, 2959, 6443, 703, 1155, 353, 8840, 836, 8, 341, 26398, 1669, 5820, 7121, 4095, 10556, 3782, 4921, 87, 15, 15, 3462, 15, 19, 1944, 5455, 9559, 11, 1848, 1669, 1349, 703, 10731, 692, 6948, 12808, 69, 1155, 11, 33...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestGetReturnsErrIfLocalFilePathIsADirectory(t *testing.T) { beforeTest(t) conn := _getConnection(t) defer conn.Close() client := agaveproto.NewSftpRelayClient(conn) // create a random directory name in our test dir tmpTestFilePath, err := _createTempFile("", ".bin") if err != nil { assert.FailNowf(t, err.Error(), "Unable to create temp test file: %s", err.Error()) } // this will be the path of FileName on the Get requet resolvedRemoteTmpTestFilePath := _resolveTestPath(tmpTestFilePath, SFTP_SHARED_TEST_DIR) // create a directory as the target of our get tmpDownloadTestDirPath, err := _createTempDirectory("") if err != nil { assert.FailNowf(t, err.Error(), "Unable to create temp test dir: %s", err.Error()) } resolvedTmpDownloadTestDirPath := _resolveTestPath(tmpDownloadTestDirPath, LocalSharedTestDir) req := &agaveproto.SrvGetRequest{ SystemConfig: _createRemoteSystemConfig(), RemotePath: resolvedRemoteTmpTestFilePath, LocalPath: resolvedTmpDownloadTestDirPath, Force: true, } grpcResponse, err := client.Get(context.Background(), req) if err != nil { assert.Nilf(t, err, "Error while invoking remote service: %v", err) } else { tmpDownloadTestDirInfo, err := os.Stat(resolvedTmpDownloadTestDirPath) if err != nil { assert.FailNowf(t, err.Error(), "Unable to open temp directory, %s, on remote host after put: %v", tmpDownloadTestDirPath, err) } assert.True(t, tmpDownloadTestDirInfo.IsDir(), "Getting a file to a directory should fail and preserve the target directory") assert.Contains(t, strings.ToLower(grpcResponse.Error), "destination path is a directory", "Error message in response should indicate the destination path is a directory") assert.Nil(t, grpcResponse.RemoteFileInfo, "Returned file info should be nil on error") } afterTest(t) }
explode_data.jsonl/32563
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 615 }
[ 2830, 3393, 1949, 16446, 7747, 2679, 7319, 19090, 3872, 1808, 4758, 1155, 353, 8840, 836, 8, 341, 63234, 2271, 1155, 692, 32917, 1669, 716, 52414, 1155, 340, 16867, 4534, 10421, 2822, 25291, 1669, 933, 523, 15110, 7121, 50, 25068, 6740, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestDenyOnRead(t *testing.T) { t.Parallel() g := gomega.NewGomegaWithT(t) // Set the logger to development mode for verbose logs. logf.SetLogger(zap.New(zap.UseDevMode(true))) namespaced := types.NamespacedName{ Name: "read-test", Namespace: "default", } application := &app.FybrikApplication{} g.Expect(readObjectFromFile("../../testdata/unittests/data-usage.yaml", application)).NotTo(gomega.HaveOccurred()) application.Spec.Data[0] = app.DataContext{ DataSetID: "s3/deny-dataset", Requirements: app.DataRequirements{Interface: app.InterfaceDetails{Protocol: app.S3, DataFormat: app.Parquet}}, } application.SetGeneration(1) // Objects to track in the fake client. objs := []runtime.Object{ application, } // Register operator types with the runtime scheme. s := utils.NewScheme(g) // Create a fake client to mock API calls. cl := fake.NewFakeClientWithScheme(s, objs...) // Create a FybrikApplicationReconciler object with the scheme and fake client. r := createTestFybrikApplicationController(cl, s) req := reconcile.Request{ NamespacedName: namespaced, } res, err := r.Reconcile(context.Background(), req) g.Expect(err).To(gomega.BeNil()) err = cl.Get(context.TODO(), req.NamespacedName, application) g.Expect(err).To(gomega.BeNil(), "Cannot fetch fybrikapplication") // Expect Deny condition cond := application.Status.AssetStates["s3/deny-dataset"].Conditions[DenyConditionIndex] g.Expect(cond.Status).To(gomega.BeIdenticalTo(corev1.ConditionTrue), "Deny condition is not set") g.Expect(cond.Message).To(gomega.ContainSubstring(app.ReadAccessDenied)) g.Expect(application.Status.Ready).To(gomega.BeTrue()) g.Expect(res).To(gomega.BeEquivalentTo(ctrl.Result{}), "Requests another reconcile") }
explode_data.jsonl/45016
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 643 }
[ 2830, 3393, 23619, 88, 1925, 4418, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 741, 3174, 1669, 342, 32696, 7121, 38, 32696, 2354, 51, 1155, 340, 197, 322, 2573, 279, 5925, 311, 4401, 3856, 369, 13694, 18422, 624, 6725, 69, 4202,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestCheckTagsDup(t *testing.T) { a := assert.New(t) tags := []*Tag{ {Slug: "1"}, {Slug: "2"}, {Slug: "3"}, } a.NotError(checkTagsDup(tags)) tags = append(tags, &Tag{Slug: "1"}) a.Error(checkTagsDup(tags)) }
explode_data.jsonl/40842
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 112 }
[ 2830, 3393, 3973, 15930, 85713, 1155, 353, 8840, 836, 8, 341, 11323, 1669, 2060, 7121, 1155, 692, 3244, 2032, 1669, 29838, 5668, 515, 197, 197, 90, 54968, 25, 330, 16, 7115, 197, 197, 90, 54968, 25, 330, 17, 7115, 197, 197, 90, 5496...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestJsonListValue_Contains_MixedElemType(t *testing.T) { list := NewJSONList(NewRegistry(), &structpb.ListValue{Values: []*structpb.Value{ {Kind: &structpb.Value_StringValue{StringValue: "hello"}}, {Kind: &structpb.Value_NumberValue{NumberValue: 1}}}}) if !list.Contains(Double(1)).(Bool) { t.Error("Expected value list to contain number '1'", list) } // Contains is semantically equivalent to unrolling the list and // applying a series of logical ORs between the first input value // each element in the list. When the value is present, the result // can be True. When the value is not present and the list is of // mixed element type, the result is an error. if !IsError(list.Contains(Double(2))) { t.Error("Expected value list to not contain number '2' and error", list) } }
explode_data.jsonl/55354
{ "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, 5014, 852, 1130, 62, 23805, 1245, 3286, 25586, 929, 1155, 353, 8840, 836, 8, 341, 14440, 1669, 1532, 5370, 852, 35063, 15603, 1507, 609, 1235, 16650, 5814, 1130, 90, 6227, 25, 29838, 1235, 16650, 6167, 515, 197, 197, 90, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestMemberRemove(t *testing.T) { tc, owner, other, _, name := memberSetupMultiple(t) defer tc.Cleanup() if err := SetRoleWriter(context.TODO(), tc.G, name, other.Username); err != nil { t.Fatal(err) } assertRole(tc, name, owner.Username, keybase1.TeamRole_OWNER) assertRole(tc, name, other.Username, keybase1.TeamRole_WRITER) if err := RemoveMember(context.TODO(), tc.G, name, other.Username); err != nil { t.Fatal(err) } assertRole(tc, name, owner.Username, keybase1.TeamRole_OWNER) assertRole(tc, name, other.Username, keybase1.TeamRole_NONE) }
explode_data.jsonl/13515
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 223 }
[ 2830, 3393, 9366, 13021, 1155, 353, 8840, 836, 8, 341, 78255, 11, 6372, 11, 1008, 11, 8358, 829, 1669, 4462, 21821, 32089, 1155, 340, 16867, 17130, 727, 60639, 2822, 743, 1848, 1669, 2573, 9030, 6492, 5378, 90988, 1507, 17130, 1224, 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...
3
func TestSome(t *testing.T) { items := []int{23, 24, 2, 5, 10} interfaceItems := make([]interface{}, len(items)) for i, v := range items { interfaceItems[i] = v } a := New(interfaceItems) someAreEven := a.Some(isEven) if !someAreEven { t.Log("Some items in the array are even") t.Log("Expected", true, "\n Got", false) t.Fail() } a.Fill(3, 0) someAreEven = a.Some(isEven) if someAreEven { t.Log("None of the items in the array is even") t.Log("Expected", true, "\n Got", false) t.Fail() } }
explode_data.jsonl/47094
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 217 }
[ 2830, 3393, 8373, 1155, 353, 8840, 836, 8, 341, 46413, 1669, 3056, 396, 90, 17, 18, 11, 220, 17, 19, 11, 220, 17, 11, 220, 20, 11, 220, 16, 15, 532, 58915, 1564, 4353, 1669, 1281, 10556, 4970, 22655, 2422, 24337, 4390, 2023, 600, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
4
func TestMapProxy_RemoveIfSameWithNonSerializableKey(t *testing.T) { _, err := mp.RemoveIfSame(student{}, "test") AssertErrorNotNil(t, err, "removeIfSame did not return an error for nonserializable key") mp.Clear() }
explode_data.jsonl/57049
{ "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, 2227, 16219, 66843, 2679, 19198, 2354, 8121, 29268, 1592, 1155, 353, 8840, 836, 8, 341, 197, 6878, 1848, 1669, 10490, 13270, 2679, 19198, 39004, 22655, 330, 1944, 1138, 18017, 1454, 96144, 1155, 11, 1848, 11, 330, 5399, 2679, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestQueryParameters_Error(t *testing.T) { t.Parallel() baseUrl := "http://example.com" cases := []struct { name string queryParams string startingUrl string expectedParams adapters.QueryParameters expectedURL string }{ { "odd number of params", `["firstKey","firstVal","secondKey","secondVal","bad"]`, baseUrl, adapters.QueryParameters{}, baseUrl, }, { "bad format of string", `"firstKey=firstVal&secondKey=secondVal&bad"`, baseUrl, adapters.QueryParameters{}, baseUrl, }, } for _, test := range cases { t.Run(test.name, func(t *testing.T) { qp := adapters.QueryParameters{} err := json.Unmarshal([]byte(test.queryParams), &qp) hga := adapters.HTTPGet{ URL: cltest.WebURL(t, test.startingUrl), QueryParams: qp, } hpa := adapters.HTTPPost{ URL: cltest.WebURL(t, test.startingUrl), QueryParams: qp, } requestGET, _ := hga.GetRequest() assert.Equal(t, test.expectedURL, requestGET.URL.String()) assert.Equal(t, test.expectedParams, hga.QueryParams) requestPOST, _ := hpa.GetRequest("") assert.Equal(t, test.expectedURL, requestPOST.URL.String()) assert.Equal(t, test.expectedParams, hpa.QueryParams) assert.NotNil(t, err) }) } }
explode_data.jsonl/36140
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 558 }
[ 2830, 3393, 2859, 9706, 28651, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 2822, 24195, 2864, 1669, 330, 1254, 1110, 8687, 905, 1837, 1444, 2264, 1669, 3056, 1235, 341, 197, 11609, 1843, 914, 198, 197, 27274, 4870, 262, 914, 198, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestLeague(t *testing.T) { t.Run("it returns the League table as JSON", func(t *testing.T) { wantedLeague := []poker.Player{ {Name: "Cleo", Wins: 32}, {Name: "Chris", Wins: 20}, {Name: "Tiest", Wins: 14}, } store := poker.StubPlayerStore{League: wantedLeague} server := mustMakePlayerServer(t, &store, dummyGame) request := newLeagueRequest() response := httptest.NewRecorder() server.ServeHTTP(response, request) got := getLeagueFromResponse(t, response.Body) assertStatus(t, response, http.StatusOK) assertLeague(t, got, wantedLeague) assertContentType(t, response, "application/json") }) }
explode_data.jsonl/4850
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 230 }
[ 2830, 3393, 70107, 1155, 353, 8840, 836, 8, 1476, 3244, 16708, 445, 275, 4675, 279, 8953, 1965, 438, 4718, 497, 2915, 1155, 353, 8840, 836, 8, 341, 197, 6692, 7566, 70107, 1669, 3056, 79, 10451, 23756, 515, 298, 197, 63121, 25, 330, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestGetSpotMarketData(t *testing.T) { request := &okgroup.GetMarketDataRequest{ Asset: asset.Spot, InstrumentID: spotCurrency, Granularity: "604800", } _, err := o.GetMarketData(request) if err != nil { t.Error(err) } }
explode_data.jsonl/30171
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 105 }
[ 2830, 3393, 1949, 47049, 38822, 1043, 1155, 353, 8840, 836, 8, 341, 23555, 1669, 609, 562, 4074, 2234, 38822, 1043, 1900, 515, 197, 197, 16604, 25, 286, 9329, 808, 19099, 345, 197, 197, 56324, 915, 25, 7702, 26321, 345, 197, 197, 9072...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestComputeinstanceagentComputeInstanceAgentClientGetInstanceAgentCommand(t *testing.T) { defer failTestOnPanic(t) enabled, err := testClient.isApiEnabled("computeinstanceagent", "GetInstanceAgentCommand") assert.NoError(t, err) if !enabled { t.Skip("GetInstanceAgentCommand is not enabled by the testing service") } cc, err := testClient.createClientForOperation("computeinstanceagent", "ComputeInstanceAgent", "GetInstanceAgentCommand", createComputeinstanceagentComputeInstanceAgentClientWithProvider) assert.NoError(t, err) c := cc.(computeinstanceagent.ComputeInstanceAgentClient) body, err := testClient.getRequests("computeinstanceagent", "GetInstanceAgentCommand") assert.NoError(t, err) type GetInstanceAgentCommandRequestInfo struct { ContainerId string Request computeinstanceagent.GetInstanceAgentCommandRequest } var requests []GetInstanceAgentCommandRequestInfo var dataHolder []map[string]interface{} err = json.Unmarshal([]byte(body), &dataHolder) assert.NoError(t, err) err = unmarshalRequestInfo(dataHolder, &requests, testClient.Log) assert.NoError(t, err) var retryPolicy *common.RetryPolicy for i, req := range requests { t.Run(fmt.Sprintf("request:%v", i), func(t *testing.T) { if withRetry == true { retryPolicy = retryPolicyForTests() } req.Request.RequestMetadata.RetryPolicy = retryPolicy response, err := c.GetInstanceAgentCommand(context.Background(), req.Request) message, err := testClient.validateResult(req.ContainerId, req.Request, response, err) assert.NoError(t, err) assert.Empty(t, message, message) }) } }
explode_data.jsonl/6900
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 523 }
[ 2830, 3393, 46254, 4851, 8092, 46254, 2523, 16810, 2959, 42761, 16810, 4062, 1155, 353, 8840, 836, 8, 341, 16867, 3690, 2271, 1925, 47, 31270, 1155, 692, 197, 15868, 11, 1848, 1669, 1273, 2959, 2079, 6563, 5462, 445, 27706, 4851, 8092, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestScanStruct(t *testing.T) { for _, tt := range scanStructTests { var reply []interface{} for _, v := range tt.reply { reply = append(reply, []byte(v)) } value := reflect.New(reflect.ValueOf(tt.value).Type().Elem()) if err := redis.ScanStruct(reply, value.Interface()); err != nil { t.Fatalf("ScanStruct(%s) returned error %v", tt.title, err) } if !reflect.DeepEqual(value.Interface(), tt.value) { t.Fatalf("ScanStruct(%s) returned %v, want %v", tt.title, value.Interface(), tt.value) } } }
explode_data.jsonl/44282
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 211 }
[ 2830, 3393, 26570, 9422, 1155, 353, 8840, 836, 8, 341, 2023, 8358, 17853, 1669, 2088, 8569, 9422, 18200, 1476, 197, 2405, 9851, 3056, 4970, 16094, 197, 2023, 8358, 348, 1669, 2088, 17853, 33853, 341, 298, 86149, 284, 8737, 51118, 11, 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, 1, 1, 1, 1, 1, 1...
5
func TestGooseFSEngine_HasDeprecatedCommonLabelname(t *testing.T) { // worker-name = e.name+"-worker" daemonSetWithSelector := &v1.DaemonSet{ ObjectMeta: metav1.ObjectMeta{ Name: "hbase-worker", Namespace: "fluid", }, Spec: v1.DaemonSetSpec{ Template: corev1.PodTemplateSpec{ Spec: corev1.PodSpec{NodeSelector: map[string]string{"data.fluid.io/storage-fluid-hbase": "selector"}}, }, }, } daemonSetWithoutSelector := &v1.DaemonSet{ ObjectMeta: metav1.ObjectMeta{ Name: "hadoop-worker", Namespace: "fluid", }, Spec: v1.DaemonSetSpec{ Template: corev1.PodTemplateSpec{ Spec: corev1.PodSpec{NodeSelector: map[string]string{"data.fluid.io/storage-fluid-hbase": "selector"}}, }, }, } runtimeObjs := []runtime.Object{} runtimeObjs = append(runtimeObjs, daemonSetWithSelector) runtimeObjs = append(runtimeObjs, daemonSetWithoutSelector) scheme := runtime.NewScheme() scheme.AddKnownTypes(v1.SchemeGroupVersion, daemonSetWithSelector) fakeClient := fake.NewFakeClientWithScheme(scheme, runtimeObjs...) testCases := []struct { name string namespace string out bool isErr bool }{ { name: "hbase", namespace: "fluid", out: true, isErr: false, }, { name: "none", namespace: "fluid", out: false, isErr: false, }, { name: "hadoop", namespace: "fluid", out: false, isErr: false, }, } for _, test := range testCases { engine := getTestGooseFSEngine(fakeClient, test.name, test.namespace) out, err := engine.HasDeprecatedCommonLabelname() if out != test.out { t.Errorf("input parameter is %s-%s,expected %t, got %t", test.namespace, test.name, test.out, out) } isErr := err != nil if isErr != test.isErr { t.Errorf("input parameter is %s-%s,expected %t, got %t", test.namespace, test.name, test.isErr, isErr) } } }
explode_data.jsonl/45598
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 857 }
[ 2830, 3393, 10850, 960, 37, 925, 70891, 2039, 300, 51344, 10839, 2476, 606, 1155, 353, 8840, 836, 8, 1476, 197, 322, 11864, 11494, 284, 384, 2644, 5172, 12, 21462, 698, 2698, 64, 7291, 1649, 2354, 5877, 1669, 609, 85, 16, 909, 64, 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...
4
func TestUnmarshalEncPrivPart(t *testing.T) { t.Parallel() var a EncKrbPrivPart b, err := hex.DecodeString(testdata.MarshaledKRB5enc_priv_part) if err != nil { t.Fatalf("Test vector read error: %v", err) } err = a.Unmarshal(b) if err != nil { t.Fatalf("Unmarshal error: %v", err) } //Parse the test time value into a time.Time type tt, _ := time.Parse(testdata.TEST_TIME_FORMAT, testdata.TEST_TIME) assert.Equal(t, "krb5data", string(a.UserData), "User data not as expected") assert.Equal(t, tt, a.Timestamp, "Timestamp not as expected") assert.Equal(t, 123456, a.Usec, "Microseconds not as expected") assert.Equal(t, int64(17), a.SequenceNumber, "Sequence number not as expected") assert.Equal(t, addrtype.IPv4, a.SAddress.AddrType, "SAddress type not as expected") assert.Equal(t, "12d00023", hex.EncodeToString(a.SAddress.Address), "Address not as expected for SAddress") assert.Equal(t, addrtype.IPv4, a.RAddress.AddrType, "RAddress type not as expected") assert.Equal(t, "12d00023", hex.EncodeToString(a.RAddress.Address), "Address not as expected for RAddress") }
explode_data.jsonl/69296
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 429 }
[ 2830, 3393, 1806, 27121, 7408, 32124, 5800, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 741, 2405, 264, 10751, 42, 10681, 32124, 5800, 198, 2233, 11, 1848, 1669, 12371, 56372, 703, 8623, 691, 83691, 75303, 42, 29259, 20, 954, 24726...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestManager(t *testing.T) { testManager := NewManager(utils.LocalDir("images"), "/tmp", defaultTestDockerLogDriver, defaultTestDockerLogOptions) if err := testManager.Start(); err != nil { t.Logf("expected no error got %s", err) t.Fatal() } cd1 := IServiceDefinition{ ID: "test1", Name: "test1", Repo: "ubuntu", Tag: "latest", Command: func() string { return `while true; do echo hello world; sleep 1; done` }, } container, err := NewIService(cd1) if err != nil { t.Logf("could not create container: %s", err) t.Fatal() } cd2 := IServiceDefinition{ ID: "test2", Name: "test2", Repo: "ubuntu", Tag: "latest", Command: func() string { return `while true; do echo hello world; sleep 1; done` }, } container2, err := NewIService(cd2) if err != nil { t.Logf("could not create container: %s", err) t.Fatal() } if err := testManager.Register(container); err != nil { t.Fatalf("expected nil got %s", err) } if err := testManager.Register(container2); err != nil { t.Fatalf("expected nil got %s", err) } if err := testManager.Start(); err != nil { t.Logf("expected no error got %s", err) t.Fail() } time.Sleep(time.Second * 10) testManager.Stop() }
explode_data.jsonl/66732
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 495 }
[ 2830, 3393, 2043, 1155, 353, 8840, 836, 8, 341, 18185, 2043, 1669, 1532, 2043, 64166, 20856, 6184, 445, 3642, 3975, 3521, 5173, 497, 1638, 2271, 35, 13659, 2201, 11349, 11, 1638, 2271, 35, 13659, 2201, 3798, 692, 743, 1848, 1669, 1273, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestArrayOfAlg(t *testing.T) { at := ArrayOf(6, TypeOf(byte(0))) v1 := New(at).Elem() v2 := New(at).Elem() if v1.Interface() != v1.Interface() { t.Errorf("constructed array %v not equal to itself", v1.Interface()) } v1.Index(5).Set(ValueOf(byte(1))) if i1, i2 := v1.Interface(), v2.Interface(); i1 == i2 { t.Errorf("constructed arrays %v and %v should not be equal", i1, i2) } at = ArrayOf(6, TypeOf([]int(nil))) v1 = New(at).Elem() shouldPanic(func() { _ = v1.Interface() == v1.Interface() }) }
explode_data.jsonl/29595
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 222 }
[ 2830, 3393, 62656, 86895, 1155, 353, 8840, 836, 8, 341, 35447, 1669, 2910, 2124, 7, 21, 11, 3990, 2124, 19738, 7, 15, 5929, 5195, 16, 1669, 1532, 19356, 568, 25586, 741, 5195, 17, 1669, 1532, 19356, 568, 25586, 741, 743, 348, 16, 41...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestWhere(t *testing.T) { q := NewQuery().Where("field1 = ?", args[:1]) if q.SQL.String() != " WHERE field1 = ?" { t.Fatalf("Where failed to create SQL successfully [%s]\n", q.SQL.String()) } if len(q.Args) != 1 { t.Fatalf("Where did not update q.Args properly [%d]\n", len(q.Args)) } }
explode_data.jsonl/76524
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 124 }
[ 2830, 3393, 9064, 1155, 353, 8840, 836, 8, 341, 18534, 1669, 1532, 2859, 1005, 9064, 445, 2566, 16, 284, 42313, 2827, 3447, 16, 2546, 743, 2804, 25095, 6431, 368, 961, 330, 5288, 2070, 16, 284, 937, 1, 341, 197, 3244, 30762, 445, 90...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestReconcileServiceInstanceUpdateParameters(t *testing.T) { fakeKubeClient, fakeCatalogClient, fakeClusterServiceBrokerClient, testController, sharedInformers := newTestController(t, fakeosb.FakeClientConfiguration{ UpdateInstanceReaction: &fakeosb.UpdateInstanceReaction{ Response: &osb.UpdateInstanceResponse{}, }, }) sharedInformers.ClusterServiceBrokers().Informer().GetStore().Add(getTestClusterServiceBroker()) sharedInformers.ClusterServiceClasses().Informer().GetStore().Add(getTestClusterServiceClass()) sharedInformers.ClusterServicePlans().Informer().GetStore().Add(getTestClusterServicePlan()) instance := getTestServiceInstanceWithClusterRefs() instance.Generation = 2 instance.Status.ReconciledGeneration = 1 instance.Status.ObservedGeneration = 1 instance.Status.ProvisionStatus = v1beta1.ServiceInstanceProvisionStatusProvisioned instance.Status.DeprovisionStatus = v1beta1.ServiceInstanceDeprovisionStatusRequired oldParameters := map[string]interface{}{ "args": map[string]interface{}{ "first": "first-arg", "second": "second-arg", }, "name": "test-param", } oldParametersMarshaled, err := MarshalRawParameters(oldParameters) if err != nil { t.Fatalf("Failed to marshal parameters: %v", err) } oldParametersRaw := &runtime.RawExtension{ Raw: oldParametersMarshaled, } instance.Status.ExternalProperties = &v1beta1.ServiceInstancePropertiesState{ ClusterServicePlanExternalName: testClusterServicePlanName, ClusterServicePlanExternalID: testClusterServicePlanGUID, Parameters: oldParametersRaw, ParameterChecksum: generateChecksumOfParametersOrFail(t, oldParameters), } parameters := instanceParameters{Name: "test-param", Args: make(map[string]string)} parameters.Args["first"] = "first-arg" parameters.Args["second"] = "new-second-arg" b, err := json.Marshal(parameters) if err != nil { t.Fatalf("Failed to marshal parameters %v : %v", parameters, err) } instance.Spec.Parameters = &runtime.RawExtension{Raw: b} if err := reconcileServiceInstance(t, testController, instance); err != nil { t.Fatalf("unexpected error: %v", err) } expectedParameters := map[string]interface{}{ "args": map[string]interface{}{ "first": "first-arg", "second": "new-second-arg", }, "name": "test-param", } expectedParametersChecksum := generateChecksumOfParametersOrFail(t, expectedParameters) instance = assertServiceInstanceOperationInProgressWithParametersIsTheOnlyCatalogClientAction(t, fakeCatalogClient, instance, v1beta1.ServiceInstanceOperationUpdate, testClusterServicePlanName, testClusterServicePlanGUID, expectedParameters, expectedParametersChecksum) fakeCatalogClient.ClearActions() fakeKubeClient.ClearActions() if err = reconcileServiceInstance(t, testController, instance); err != nil { t.Fatalf("This should not fail : %v", err) } brokerActions := fakeClusterServiceBrokerClient.Actions() assertNumberOfBrokerActions(t, brokerActions, 1) assertUpdateInstance(t, brokerActions[0], &osb.UpdateInstanceRequest{ AcceptsIncomplete: true, InstanceID: testServiceInstanceGUID, ServiceID: testClusterServiceClassGUID, PlanID: nil, // no change to plan Context: testContext, Parameters: map[string]interface{}{ "args": map[string]interface{}{ "first": "first-arg", "second": "new-second-arg", }, "name": "test-param", }, }) actions := fakeCatalogClient.Actions() assertNumberOfActions(t, actions, 1) updatedServiceInstance := assertUpdateStatus(t, actions[0], instance) assertServiceInstanceOperationSuccessWithParameters(t, updatedServiceInstance, v1beta1.ServiceInstanceOperationUpdate, testClusterServicePlanName, testClusterServicePlanGUID, expectedParameters, expectedParametersChecksum, instance) updateObject, ok := updatedServiceInstance.(*v1beta1.ServiceInstance) if !ok { t.Fatalf("couldn't convert to *v1beta1.ServiceInstance") } // Verify parameters are what we'd expect them to be, basically name, map with two values in it. if len(updateObject.Spec.Parameters.Raw) == 0 { t.Fatalf("Parameters was unexpectedly empty") } // verify no kube resources created // One single action comes from getting namespace uid kubeActions := fakeKubeClient.Actions() if err := checkKubeClientActions(kubeActions, []kubeClientAction{ {verb: "get", resourceName: "namespaces", checkType: checkGetActionType}, }); err != nil { t.Fatal(err) } events := getRecordedEvents(testController) expectedEvent := normalEventBuilder(successUpdateInstanceReason).msg("The instance was updated successfully") if err := checkEvents(events, expectedEvent.stringArr()); err != nil { t.Fatal(err) } }
explode_data.jsonl/58186
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1530 }
[ 2830, 3393, 693, 40446, 457, 1860, 2523, 4289, 9706, 1155, 353, 8840, 836, 8, 341, 1166, 726, 42, 3760, 2959, 11, 12418, 41606, 2959, 11, 12418, 28678, 1860, 65545, 2959, 11, 1273, 2051, 11, 6094, 37891, 388, 1669, 501, 2271, 2051, 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...
9
func TestUint128PairFace(t *testing.T) { popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) p := NewPopulatedUint128Pair(popr, true) msg := p.TestProto() if !p.Equal(msg) { t.Fatalf("%#v !Face Equal %#v", msg, p) } }
explode_data.jsonl/62654
{ "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, 21570, 16, 17, 23, 12443, 16281, 1155, 353, 8840, 836, 8, 341, 3223, 46288, 1669, 6888, 33864, 7121, 37270, 33864, 7121, 3608, 9730, 13244, 1005, 55832, 83819, 12145, 3223, 1669, 1532, 11598, 7757, 21570, 16, 17, 23, 12443, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestHTTPInvalidTLSCredentials(t *testing.T) { cfg := &Config{ ReceiverSettings: config.NewReceiverSettings(config.NewComponentID(typeStr)), Protocols: Protocols{ HTTP: &confighttp.HTTPServerSettings{ Endpoint: testutil.GetAvailableLocalAddress(t), TLSSetting: &configtls.TLSServerSetting{ TLSSetting: configtls.TLSSetting{ CertFile: "willfail", }, }, }, }, } // TLS is resolved during Start for HTTP. r, err := NewFactory().CreateTracesReceiver( context.Background(), componenttest.NewNopReceiverCreateSettings(), cfg, consumertest.NewNop()) require.NoError(t, err) assert.NotNil(t, r) assert.EqualError(t, r.Start(context.Background(), componenttest.NewNopHost()), `failed to load TLS config: for auth via TLS, either both certificate and key must be supplied, or neither`) }
explode_data.jsonl/74995
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 310 }
[ 2830, 3393, 9230, 7928, 13470, 3540, 15735, 1155, 353, 8840, 836, 8, 341, 50286, 1669, 609, 2648, 515, 197, 197, 25436, 6086, 25, 2193, 7121, 25436, 6086, 8754, 7121, 2189, 915, 5808, 2580, 6965, 197, 197, 12423, 22018, 25, 11708, 22018...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestUpdateSilence(t *testing.T) { for _, tc := range []struct { data string labelv string upstream http.Handler expCode int expBody []byte }{ { // No "namespace" parameter returns an error. expCode: http.StatusBadRequest, }, { // Invalid silence payload returns an error. data: "{", labelv: "default", expCode: http.StatusBadRequest, }, { // Creation of a valid silence without namespace label is ok. data: `{ "comment":"foo", "createdBy":"bar", "endsAt":"2020-02-13T13:00:02.084Z", "matchers": [ {"isRegex":false,"Name":"foo","Value":"bar"} ], "startsAt":"2020-02-13T12:02:01Z" }`, labelv: "default", upstream: createSilenceWithLabel("default"), expCode: http.StatusOK, expBody: okResponse, }, { // Creation of a silence with an existing namespace label is ok. data: `{ "comment":"foo", "createdBy":"bar", "endsAt":"2020-02-13T13:00:02.084Z", "matchers": [ {"isRegex":false,"Name":"foo","Value":"bar"}, {"isRegex":false,"Name":"namespace","Value":"not default"} ], "startsAt":"2020-02-13T12:02:01Z" }`, labelv: "default", upstream: createSilenceWithLabel("default"), expCode: http.StatusOK, expBody: okResponse, }, { // Creation of a silence without matcher returns an error. data: `{ "comment":"foo", "createdBy":"bar", "endsAt":"2020-02-13T13:00:02.084Z", "matchers": [], "startsAt":"2020-02-13T12:02:01Z" }`, labelv: "default", expCode: http.StatusBadRequest, }, { // Update of an existing silence with a matching label is ok. data: `{ "id":"` + silID + `", "comment":"foo", "createdBy":"bar", "endsAt":"2020-02-13T13:00:02.084Z", "matchers": [ {"isRegex":false,"Name":"foo","Value":"bar"} ], "startsAt":"2020-02-13T12:02:01Z" }`, labelv: "default", upstream: &chainedHandlers{ handlers: []http.Handler{ getSilenceWithLabel("default"), createSilenceWithLabel("default"), }, }, expCode: http.StatusOK, expBody: okResponse, }, { // Update of an existing silence with a non-matching label is denied. data: `{ "id":"` + silID + `", "comment":"foo", "createdBy":"bar", "endsAt":"2020-02-13T13:00:02.084Z", "matchers": [ {"isRegex":false,"Name":"foo","Value":"bar"} ], "startsAt":"2020-02-13T12:02:01Z" }`, labelv: "default", upstream: &chainedHandlers{ handlers: []http.Handler{ getSilenceWithLabel("not default"), createSilenceWithLabel("default"), }, }, expCode: http.StatusForbidden, }, { // Update of a non-existing silence fails. data: `{ "id":"does not exist", "comment":"foo", "createdBy":"bar", "endsAt":"2020-02-13T13:00:02.084Z", "matchers": [ {"isRegex":false,"Name":"foo","Value":"bar"} ], "startsAt":"2020-02-13T12:02:01Z" }`, labelv: "default", upstream: http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) { http.NotFound(w, req) }), expCode: http.StatusBadGateway, }, { // The silence has the expected value for the label but upstream returns an error. data: `{ "id":"` + silID + `", "comment":"foo", "createdBy":"bar", "endsAt":"2020-02-13T13:00:02.084Z", "matchers": [ {"isRegex":false,"Name":"foo","Value":"bar"} ], "startsAt":"2020-02-13T12:02:01Z" }`, labelv: "default", upstream: &chainedHandlers{ handlers: []http.Handler{ getSilenceWithLabel("default"), http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) { w.WriteHeader(http.StatusTeapot) }), }, }, expCode: http.StatusTeapot, }, } { t.Run("", func(t *testing.T) { m := newMockUpstream(tc.upstream) defer m.Close() r, err := NewRoutes(m.url, proxyLabel) if err != nil { t.Fatalf("unexpected error: %v", err) } u, err := url.Parse("http://alertmanager.example.com/api/v2/silences/") if err != nil { t.Fatalf("unexpected error: %v", err) } q := u.Query() q.Set(proxyLabel, tc.labelv) u.RawQuery = q.Encode() w := httptest.NewRecorder() req := httptest.NewRequest("POST", u.String(), bytes.NewBufferString(tc.data)) r.ServeHTTP(w, req) resp := w.Result() body, _ := ioutil.ReadAll(resp.Body) defer resp.Body.Close() if resp.StatusCode != tc.expCode { t.Logf("expected status code %d, got %d", tc.expCode, resp.StatusCode) t.Logf("%s", string(body)) t.FailNow() } if resp.StatusCode != http.StatusOK { return } if string(body) != string(tc.expBody) { t.Fatalf("expected body %q, got %q", string(tc.expBody), string(body)) } }) } }
explode_data.jsonl/75023
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 2145 }
[ 2830, 3393, 4289, 27571, 763, 1155, 353, 8840, 836, 8, 341, 2023, 8358, 17130, 1669, 2088, 3056, 1235, 341, 197, 8924, 257, 914, 198, 197, 29277, 85, 256, 914, 198, 197, 59810, 4027, 1758, 31010, 271, 197, 48558, 2078, 526, 198, 197, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func Test_resolveRef(t *testing.T) { cases := []struct { ref string expectType string expectName string }{ {"refs/heads/master", RefTypeBranch, "master"}, {"refs/heads/20190927/tests", RefTypeBranch, "20190927/tests"}, {"refs/tags/v1.0.0", RefTypeTag, "v1.0.0"}, {"refs/tags/v2.0.0-rc1", RefTypeTag, "v2.0.0-rc1"}, {"refs/pull/master", RefTypePull, "master"}, {"refs/pull/2019/09/27/pull", RefTypePull, "2019/09/27/pull"}, {"refs/unknown/master", "", "master"}, {"", "", ""}, } for _, c := range cases { typ, name := resolveRef(GitHub{Ref: c.ref}) if typ != c.expectType { t.Errorf("expect ref type is %s, actual is %s", c.expectType, typ) } if name != c.expectName { t.Errorf("expect ref name is %s, actual is %s", c.expectName, name) } } }
explode_data.jsonl/29140
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 361 }
[ 2830, 3393, 77291, 3945, 1155, 353, 8840, 836, 8, 341, 1444, 2264, 1669, 3056, 1235, 341, 197, 59504, 286, 914, 198, 197, 24952, 929, 914, 198, 197, 24952, 675, 914, 198, 197, 59403, 197, 197, 4913, 16149, 14, 35810, 23303, 497, 8550,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestSetBreakpoint(t *testing.T) { runTest(t, "loopprog", func(client *daptest.Client, fixture protest.Fixture) { runDebugSessionWithBPs(t, client, "launch", // Launch func() { client.LaunchRequest("exec", fixture.Path, !stopOnEntry) }, // Set breakpoints fixture.Source, []int{16}, // b main.main []onBreakpoint{{ execute: func() { checkStop(t, client, 1, "main.main", 16) // Set two breakpoints at the next two lines in main client.SetBreakpointsRequest(fixture.Source, []int{17, 18}) expectSetBreakpointsResponse(t, client, []Breakpoint{{17, fixture.Source, true, ""}, {18, fixture.Source, true, ""}}) // Clear 17, reset 18 client.SetBreakpointsRequest(fixture.Source, []int{18}) expectSetBreakpointsResponse(t, client, []Breakpoint{{18, fixture.Source, true, ""}}) // Skip 17, continue to 18 client.ContinueRequest(1) client.ExpectContinueResponse(t) client.ExpectStoppedEvent(t) checkStop(t, client, 1, "main.main", 18) // Set another breakpoint inside the loop in loop(), twice to trigger error client.SetBreakpointsRequest(fixture.Source, []int{8, 8}) expectSetBreakpointsResponse(t, client, []Breakpoint{{8, fixture.Source, true, ""}, {-1, "", false, "breakpoint exists"}}) // Continue into the loop client.ContinueRequest(1) client.ExpectContinueResponse(t) client.ExpectStoppedEvent(t) checkStop(t, client, 1, "main.loop", 8) client.VariablesRequest(1001) // Locals locals := client.ExpectVariablesResponse(t) checkVarExact(t, locals, 0, "i", "i", "0", "int", noChildren) // i == 0 // Edit the breakpoint to add a condition client.SetConditionalBreakpointsRequest(fixture.Source, []int{8}, map[int]string{8: "i == 3"}) expectSetBreakpointsResponse(t, client, []Breakpoint{{8, fixture.Source, true, ""}}) // Continue until condition is hit client.ContinueRequest(1) client.ExpectContinueResponse(t) client.ExpectStoppedEvent(t) checkStop(t, client, 1, "main.loop", 8) client.VariablesRequest(1001) // Locals locals = client.ExpectVariablesResponse(t) checkVarExact(t, locals, 0, "i", "i", "3", "int", noChildren) // i == 3 // Edit the breakpoint to remove a condition client.SetConditionalBreakpointsRequest(fixture.Source, []int{8}, map[int]string{8: ""}) expectSetBreakpointsResponse(t, client, []Breakpoint{{8, fixture.Source, true, ""}}) // Continue for one more loop iteration client.ContinueRequest(1) client.ExpectContinueResponse(t) client.ExpectStoppedEvent(t) checkStop(t, client, 1, "main.loop", 8) client.VariablesRequest(1001) // Locals locals = client.ExpectVariablesResponse(t) checkVarExact(t, locals, 0, "i", "i", "4", "int", noChildren) // i == 4 // Set at a line without a statement client.SetBreakpointsRequest(fixture.Source, []int{1000}) expectSetBreakpointsResponse(t, client, []Breakpoint{{-1, "", false, "could not find statement"}}) // all cleared, none set }, // The program has an infinite loop, so we must kill it by disconnecting. disconnect: true, }}) }) }
explode_data.jsonl/17324
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1236 }
[ 2830, 3393, 1649, 22524, 2768, 1155, 353, 8840, 836, 8, 341, 56742, 2271, 1155, 11, 330, 10498, 32992, 497, 2915, 12805, 353, 91294, 1944, 11716, 11, 12507, 8665, 991, 12735, 8, 341, 197, 56742, 7939, 5283, 2354, 33, 20420, 1155, 11, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func Test_AuthWithValidPassword_Gives200(t *testing.T) { handler := func(w http.ResponseWriter, r *http.Request) { io.WriteString(w, "<html><body>Hello World!</body></html>") } w := httptest.NewRecorder() wantUser := "admin" wantPassword := "password" r := httptest.NewRequest(http.MethodGet, "http://localhost:8080", nil) r.SetBasicAuth(wantUser, wantPassword) wantCredentials := &BasicAuthCredentials{ User: wantUser, Password: wantPassword, } decorated := DecorateWithBasicAuth(handler, wantCredentials) decorated.ServeHTTP(w, r) wantCode := http.StatusOK if w.Code != wantCode { t.Errorf("status code, want: %d, got: %d", wantCode, w.Code) t.Fail() } }
explode_data.jsonl/27515
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 262 }
[ 2830, 3393, 1566, 940, 2354, 4088, 4876, 2646, 1886, 17, 15, 15, 1155, 353, 8840, 836, 8, 1476, 53326, 1669, 2915, 3622, 1758, 37508, 11, 435, 353, 1254, 9659, 8, 341, 197, 53112, 44747, 3622, 11, 4055, 1551, 1784, 2599, 79497, 4337, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestParseJSON(t *testing.T) { testJSONProcessing(t, filepath.Join("testdata", "acme_v1.golden")) testJSONProcessing(t, filepath.Join("testdata", "acme_v2.golden")) }
explode_data.jsonl/5439
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 69 }
[ 2830, 3393, 14463, 5370, 1155, 353, 8840, 836, 8, 341, 18185, 5370, 28892, 1155, 11, 26054, 22363, 445, 92425, 497, 330, 580, 2660, 2273, 16, 92960, 268, 5455, 18185, 5370, 28892, 1155, 11, 26054, 22363, 445, 92425, 497, 330, 580, 2660,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestHorizontalSearcher(t *testing.T) { var endpoints atomicMap endpoints.Store(prefixMap{}) searcher := &HorizontalSearcher{ Map: &endpoints, Dial: func(endpoint string) zoekt.Searcher { var rle zoekt.RepoListEntry rle.Repository.Name = endpoint return &mockSearcher{ searchResult: &zoekt.SearchResult{ Files: []zoekt.FileMatch{{ Repository: endpoint, }}, RepoURLs: map[string]string{endpoint: endpoint}, }, listResult: &zoekt.RepoList{Repos: []*zoekt.RepoListEntry{&rle}}, } }, } defer searcher.Close() // Start up background goroutines which continuously hit the searcher // methods to ensure we are safe under concurrency. for i := 0; i < 5; i++ { cleanup := backgroundSearch(searcher) defer cleanup(t) } // each map is the set of servers at a point in time. This is to mainly // stress the management code. maps := []prefixMap{ // Start with a normal config of two replicas {"1", "2"}, // Add two {"1", "2", "3", "4"}, // Lose two {"2", "4"}, // Lose and add {"1", "2"}, // Lose all {}, // Lots {"1", "2", "3", "4", "5", "6", "7", "8", "9"}, } for _, m := range maps { t.Log("current", searcher.String(), "next", m) endpoints.Store(m) // Our search results should be one per server sr, err := searcher.Search(context.Background(), nil, nil) if err != nil { t.Fatal(err) } var got []string for _, fm := range sr.Files { got = append(got, fm.Repository) } sort.Strings(got) want := []string(m) if !cmp.Equal(want, got, cmpopts.EquateEmpty()) { t.Errorf("search mismatch (-want +got):\n%s", cmp.Diff(want, got)) } // repohasfile depends on RepoURLs aggregating got = got[:0] for repo := range sr.RepoURLs { got = append(got, repo) } sort.Strings(got) if !cmp.Equal(want, got, cmpopts.EquateEmpty()) { t.Errorf("search mismatch (-want +got):\n%s", cmp.Diff(want, got)) } // Our list results should be one per server rle, err := searcher.List(context.Background(), nil) if err != nil { t.Fatal(err) } got = []string{} for _, r := range rle.Repos { got = append(got, r.Repository.Name) } sort.Strings(got) if !cmp.Equal(want, got, cmpopts.EquateEmpty()) { t.Errorf("list mismatch (-want +got):\n%s", cmp.Diff(want, got)) } } searcher.Close() }
explode_data.jsonl/61636
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 990 }
[ 2830, 3393, 15837, 5890, 261, 1155, 353, 8840, 836, 8, 341, 2405, 36342, 24510, 2227, 198, 6246, 7706, 38047, 28918, 2227, 6257, 692, 45573, 261, 1669, 609, 15837, 5890, 261, 515, 197, 26873, 25, 609, 408, 7706, 345, 197, 10957, 530, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestOptionalValue_Clone(t *testing.T) { tests := []struct { name string target *OptionalValue }{ { name: "ok", target: &OptionalValue{ ov: *value.NewOptional(value.TypeString, value.TypeString.ValueFrom("foo", types)), }, }, { name: "empty", target: &OptionalValue{}, }, { name: "nil", target: nil, }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { res := tt.target.Clone() assert.Equal(t, tt.target, res) if tt.target != nil { assert.NotSame(t, tt.target, res) } }) } }
explode_data.jsonl/8893
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 269 }
[ 2830, 3393, 15309, 1130, 85110, 603, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 3056, 1235, 341, 197, 11609, 256, 914, 198, 197, 28861, 353, 15309, 1130, 198, 197, 59403, 197, 197, 515, 298, 11609, 25, 330, 562, 756, 298, 28861, 25, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestVarTerms(t *testing.T) { assertParseOneTerm(t, "var", "foo", VarTerm("foo")) assertParseOneTerm(t, "var", "foo_bar", VarTerm("foo_bar")) assertParseOneTerm(t, "var", "foo0", VarTerm("foo0")) assertParseOneTerm(t, "import prefix", "imports", VarTerm("imports")) assertParseOneTerm(t, "not prefix", "not_foo", VarTerm("not_foo")) assertParseOneTerm(t, `package prefix`, "packages", VarTerm("packages")) assertParseOneTerm(t, `true prefix`, "trueish", VarTerm("trueish")) assertParseOneTerm(t, `false prefix`, "false_flag", VarTerm("false_flag")) assertParseOneTerm(t, `null prefix`, "nullable", VarTerm("nullable")) assertParseError(t, "illegal token", `墳`) assertParseError(t, "not keyword", "not") assertParseError(t, `package keyword`, "package") assertParseError(t, "import keyword", "import") assertParseError(t, "import invalid path", "import x.") }
explode_data.jsonl/50450
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 315 }
[ 2830, 3393, 3962, 43128, 1155, 353, 8840, 836, 8, 341, 6948, 14463, 3966, 17249, 1155, 11, 330, 947, 497, 330, 7975, 497, 8735, 17249, 445, 7975, 5455, 6948, 14463, 3966, 17249, 1155, 11, 330, 947, 497, 330, 7975, 14388, 497, 8735, 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 TestDomainServicesUnmarshal(t *testing.T) { actual := &DomainServiceReports{} err := actual.UnmarshalJSON([]byte(domainServicesMockJSON)) th.AssertNoErr(t, err) th.CheckDeepEquals(t, domainMockServices, actual) }
explode_data.jsonl/266
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 81 }
[ 2830, 3393, 13636, 11025, 1806, 27121, 1155, 353, 8840, 836, 8, 341, 88814, 1669, 609, 13636, 1860, 23748, 16094, 9859, 1669, 5042, 38097, 5370, 10556, 3782, 41169, 11025, 11571, 5370, 1171, 70479, 11711, 2753, 7747, 1155, 11, 1848, 340, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
func TestDecay(t *testing.T) { config.Load("../config/test_config.gcfg") c := ChargeCarrier{} c.Charge(0.5) c.Decay() expected := 0.5 - config.Global.Brain.ChargeDecayRate if !testutils.FloatsAreEqual(c.currentCharge, expected) { t.Errorf("Should have had %v ChargeCarrier after Decay. Got %v", expected, c.currentCharge) } }
explode_data.jsonl/66636
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 128 }
[ 2830, 3393, 4900, 352, 1155, 353, 8840, 836, 8, 341, 25873, 13969, 17409, 1676, 12697, 5332, 1302, 14072, 1138, 1444, 1669, 36795, 96294, 16094, 1444, 6353, 2744, 7, 15, 13, 20, 340, 1444, 22442, 352, 2822, 42400, 1669, 220, 15, 13, 2...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestNilEndpointResolvers(t *testing.T) { ctx := logger.WithLogger(broker.NewBackground()) resolvers := EndpointResolvers{nil} _, err := resolvers.Resolve(ctx) if err != nil { t.Fatal(err) } }
explode_data.jsonl/2215
{ "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, 19064, 27380, 1061, 39435, 1155, 353, 8840, 836, 8, 341, 20985, 1669, 5925, 26124, 7395, 1883, 45985, 7121, 8706, 2398, 10202, 39435, 1669, 47269, 1061, 39435, 90, 8385, 532, 197, 6878, 1848, 1669, 592, 39435, 57875, 7502, 340...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
2
func TestParseWildcardPatternsEnv(t *testing.T) { const envKey = "ELASTIC_APM_TEST_WILDCARDS" os.Unsetenv(envKey) defer os.Unsetenv(envKey) newMatchers := func(p ...string) wildcard.Matchers { matchers := make(wildcard.Matchers, len(p)) for i, p := range p { matchers[i] = wildcard.NewMatcher(p, wildcard.CaseInsensitive) } return matchers } defaultMatchers := newMatchers("default") matchers := apmconfig.ParseWildcardPatternsEnv(envKey, defaultMatchers) assert.Equal(t, defaultMatchers, matchers) os.Setenv(envKey, "foo, bar") expected := newMatchers("foo", "bar") matchers = apmconfig.ParseWildcardPatternsEnv(envKey, defaultMatchers) assert.Equal(t, expected, matchers) os.Setenv(envKey, "foo, (?-i)bar") expected[1] = wildcard.NewMatcher("bar", wildcard.CaseSensitive) matchers = apmconfig.ParseWildcardPatternsEnv(envKey, defaultMatchers) assert.Equal(t, expected, matchers) os.Setenv(envKey, "(?i)foo, (?-i)bar") matchers = apmconfig.ParseWildcardPatternsEnv(envKey, defaultMatchers) assert.Equal(t, expected, matchers) }
explode_data.jsonl/63046
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 416 }
[ 2830, 3393, 14463, 92988, 57656, 14359, 1155, 353, 8840, 836, 8, 341, 4777, 6105, 1592, 284, 330, 2749, 6349, 1317, 1566, 8795, 11641, 2763, 1715, 5626, 59894, 698, 25078, 10616, 746, 3160, 16978, 1592, 340, 16867, 2643, 10616, 746, 3160,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestNewPeerTLSFromCertBad(t *testing.T) { mockCtrl := gomock.NewController(t) defer mockCtrl.Finish() config := mockfab.BadTLSClientMockConfig(mockCtrl) url := "grpcs://0.0.0.0:1234" _, err := New(config, WithURL(url)) if err == nil { t.Fatal("Expected peer construction to fail") } }
explode_data.jsonl/4793
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 123 }
[ 2830, 3393, 3564, 30888, 45439, 3830, 36934, 17082, 1155, 353, 8840, 836, 8, 341, 77333, 15001, 1669, 342, 316, 1176, 7121, 2051, 1155, 340, 16867, 7860, 15001, 991, 18176, 2822, 25873, 1669, 7860, 36855, 45946, 45439, 2959, 11571, 2648, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestEngineClose_RemoveIndex(t *testing.T) { engine := NewDefaultEngine() defer engine.Close() engine.MustOpen() pt := models.MustNewPoint( "cpu", models.Tags{ {Key: models.MeasurementTagKeyBytes, Value: []byte("cpu")}, {Key: []byte("host"), Value: []byte("server")}, {Key: models.FieldKeyTagKeyBytes, Value: []byte("value")}, }, map[string]interface{}{"value": 1.0}, time.Unix(1, 2), ) err := engine.Engine.WritePoints(context.TODO(), []models.Point{pt}) if err != nil { t.Fatal(err) } if got, exp := engine.SeriesCardinality(), int64(1); got != exp { t.Fatalf("got %d series, exp %d series in index", got, exp) } // ensure the index gets loaded after closing and opening the shard engine.Engine.Close() // Don't destroy temporary data. engine.Open(context.Background()) if got, exp := engine.SeriesCardinality(), int64(1); got != exp { t.Fatalf("got %d series, exp %d series in index", got, exp) } }
explode_data.jsonl/5990
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 348 }
[ 2830, 3393, 4571, 7925, 66843, 1552, 1155, 353, 8840, 836, 8, 341, 80118, 1669, 1532, 3675, 4571, 741, 16867, 4712, 10421, 741, 80118, 50463, 5002, 2822, 60796, 1669, 4119, 50463, 3564, 2609, 1006, 197, 197, 1, 16475, 756, 197, 19727, 8...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
4
func TestAccSnapshot_requiresImport(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_snapshot", "test") r := SnapshotResource{} data.ResourceTest(t, r, []acceptance.TestStep{ { Config: r.fromManagedDisk(data), Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, { Config: r.requiresImport(data), ExpectError: acceptance.RequiresImportError("azurerm_snapshot"), }, }) }
explode_data.jsonl/78016
{ "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, 14603, 15009, 54949, 11511, 1155, 353, 8840, 836, 8, 341, 8924, 1669, 25505, 25212, 83920, 1155, 11, 330, 1370, 324, 4195, 53265, 497, 330, 1944, 1138, 7000, 1669, 68697, 4783, 31483, 8924, 20766, 2271, 1155, 11, 435, 11, 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, 1, 1, 1, 1, 1, 1...
1
func TestCloseClientConnectionOnIdleServer(t *testing.T) { clientConn, serverConn := net.Pipe() client := Client(clientConn, testConfig.Clone()) go func() { var b [1]byte serverConn.Read(b[:]) client.Close() }() client.SetWriteDeadline(time.Now().Add(time.Second)) err := client.Handshake() if err != nil { if !strings.Contains(err.Error(), "read/write on closed pipe") { t.Errorf("Error expected containing 'read/write on closed pipe' but got '%s'", err.Error()) } } else { t.Errorf("Error expected, but no error returned") } }
explode_data.jsonl/71381
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 202 }
[ 2830, 3393, 7925, 2959, 4526, 1925, 41370, 5475, 1155, 353, 8840, 836, 8, 341, 25291, 9701, 11, 3538, 9701, 1669, 4179, 1069, 3444, 741, 25291, 1669, 8423, 12805, 9701, 11, 1273, 2648, 64463, 2398, 30680, 2915, 368, 341, 197, 2405, 293,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestFileWriter(t *testing.T) { os.Remove("temp.txt") tempfile, err := os.OpenFile("temp.txt", os.O_CREATE|os.O_WRONLY, 0755) if err != nil { t.Error("create tempfile fail:", err.Error()) } defer func() { os.Remove("temp.txt") }() writer := &FileWriter{File: tempfile} writer.Write([]byte("test")) tempfile.Close() content, err := ioutil.ReadFile("temp.txt") if err != nil { t.Error("read tempfile fail:", err.Error()) } else if string(content) != "test\n" { t.Error("unexpected file content:", string(content)) } }
explode_data.jsonl/72066
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 215 }
[ 2830, 3393, 1703, 6492, 1155, 353, 8840, 836, 8, 341, 25078, 13270, 445, 3888, 3909, 1138, 16280, 1192, 11, 1848, 1669, 2643, 12953, 1703, 445, 3888, 3909, 497, 2643, 8382, 25823, 91, 436, 8382, 88649, 11, 220, 15, 22, 20, 20, 340, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestCreateAppWithNoNameSpaceWhenRequired(t *testing.T) { Given(t). Path(guestbookPath). When(). CreateWithNoNameSpace(). Refresh(RefreshTypeNormal). Then(). And(func(app *Application) { updatedApp, err := AppClientset.ArgoprojV1alpha1().Applications(ArgoCDNamespace).Get(context.Background(), app.Name, metav1.GetOptions{}) require.NoError(t, err) assert.Len(t, updatedApp.Status.Conditions, 2) assert.Equal(t, updatedApp.Status.Conditions[0].Type, ApplicationConditionInvalidSpecError) assert.Equal(t, updatedApp.Status.Conditions[1].Type, ApplicationConditionInvalidSpecError) }) }
explode_data.jsonl/35658
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 220 }
[ 2830, 3393, 4021, 2164, 2354, 2753, 675, 9914, 4498, 8164, 1155, 353, 8840, 836, 8, 341, 9600, 2071, 1155, 4292, 197, 69640, 3268, 3045, 2190, 1820, 4292, 197, 197, 4498, 25829, 197, 75569, 2354, 2753, 675, 9914, 25829, 197, 197, 14567,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestDifference(t *testing.T) { specs := map[string]struct { srcA []interface{} srcB []interface{} expResult []interface{} expErr bool }{ "all of A": { srcA: []interface{}{"a", "b"}, srcB: []interface{}{"c"}, expResult: []interface{}{"a", "b"}, }, "A - B": { srcA: []interface{}{"a", "b"}, srcB: []interface{}{"b", "c", "d"}, expResult: []interface{}{"a"}, }, "type in A not allowed": { srcA: []interface{}{1}, srcB: []interface{}{"b", "c", "d"}, expErr: true, }, "type in B not allowed": { srcA: []interface{}{"b", "c", "d"}, srcB: []interface{}{1}, expErr: true, }, } for msg, spec := range specs { t.Run(msg, func(t *testing.T) { got, err := difference(spec.srcA, spec.srcB) if spec.expErr { require.Error(t, err) } else { require.NoError(t, err) assert.Equal(t, spec.expResult, got) } }) } }
explode_data.jsonl/42813
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 471 }
[ 2830, 3393, 62707, 1155, 353, 8840, 836, 8, 341, 98100, 82, 1669, 2415, 14032, 60, 1235, 341, 197, 41144, 32, 414, 3056, 4970, 16094, 197, 41144, 33, 414, 3056, 4970, 16094, 197, 48558, 2077, 3056, 4970, 16094, 197, 48558, 7747, 262, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestDropBuildingDeferredIndex(t *testing.T) { log.Printf("In TestDropBuildingDeferredIndex()") var bucketName = "default" var index1 = "id_company" var index2 = "id_age" var index3 = "id_gender" e := secondaryindex.DropAllSecondaryIndexes(indexManagementAddress) FailTestIfError(e, "Error in DropAllSecondaryIndexes", t) docsToCreate := generateDocs(10000, "users.prod") UpdateKVDocs(docsToCreate, docs) log.Printf("Setting JSON docs in KV") kvutility.SetKeyValues(docsToCreate, "default", "", clusterconfig.KVAddress) err := secondaryindex.CreateSecondaryIndexAsync(index1, bucketName, indexManagementAddress, "", []string{"company"}, false, []byte("{\"defer_build\": true}"), true, nil) FailTestIfError(err, "Error in creating the index", t) err = secondaryindex.CreateSecondaryIndexAsync(index2, bucketName, indexManagementAddress, "", []string{"age"}, false, []byte("{\"defer_build\": true}"), true, nil) FailTestIfError(err, "Error in creating the index", t) err = secondaryindex.CreateSecondaryIndexAsync(index3, bucketName, indexManagementAddress, "", []string{"gender"}, false, []byte("{\"defer_build\": true}"), true, nil) FailTestIfError(err, "Error in creating the index", t) client, err := secondaryindex.GetOrCreateClient(indexManagementAddress, "test2client") FailTestIfError(err, "Error while creating client", t) defn1, _ := secondaryindex.GetDefnID(client, bucketName, index1) defn2, _ := secondaryindex.GetDefnID(client, bucketName, index2) defnIds := []uint64{defn1, defn2} err = secondaryindex.BuildIndexesAsync(defnIds, indexManagementAddress, defaultIndexActiveTimeout) FailTestIfError(err, "Error from BuildIndexesAsync", t) time.Sleep(1 * time.Second) err = secondaryindex.DropSecondaryIndex(index2, bucketName, indexManagementAddress) FailTestIfError(err, "Error dropping index2", t) e = secondaryindex.WaitTillIndexActive(defn1, client, defaultIndexActiveTimeout) if e != nil { FailTestIfError(e, "Error in WaitTillIndexActive for index1", t) } err = secondaryindex.BuildIndexes([]string{index3}, bucketName, indexManagementAddress, defaultIndexActiveTimeout) FailTestIfError(err, "Error in deferred index build index3", t) time.Sleep(1 * time.Second) docScanResults := datautility.ExpectedScanResponse_string(docs, "company", "G", "L", 2) scanResults, err := secondaryindex.Range(index1, bucketName, indexScanAddress, []interface{}{"G"}, []interface{}{"L"}, 2, false, defaultlimit, c.SessionConsistency, nil) FailTestIfError(err, "Error in scan index1", t) err = tv.Validate(docScanResults, scanResults) FailTestIfError(err, "Error in scan result validation", t) docScanResults = datautility.ExpectedScanResponse_string(docs, "gender", "male", "male", 3) scanResults, err = secondaryindex.Range(index3, bucketName, indexScanAddress, []interface{}{"male"}, []interface{}{"male"}, 3, false, defaultlimit, c.SessionConsistency, nil) FailTestIfError(err, "Error in scan", t) err = tv.Validate(docScanResults, scanResults) FailTestIfError(err, "Error in scan result validation", t) docsToCreate = generateDocs(10000, "users.prod") UpdateKVDocs(docsToCreate, docs) log.Printf("Setting JSON docs in KV") kvutility.SetKeyValues(docsToCreate, "default", "", clusterconfig.KVAddress) docScanResults = datautility.ExpectedScanAllResponse(docs, "gender") scanResults, err = secondaryindex.ScanAll(index3, bucketName, indexScanAddress, defaultlimit, c.SessionConsistency, nil) FailTestIfError(err, "Error in scan index3", t) err = tv.Validate(docScanResults, scanResults) FailTestIfError(err, "Error in scan result validation", t) }
explode_data.jsonl/59137
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1157 }
[ 2830, 3393, 19871, 30133, 88417, 1552, 1155, 353, 8840, 836, 8, 341, 6725, 19367, 445, 641, 3393, 19871, 30133, 88417, 1552, 368, 5130, 2405, 15621, 675, 284, 330, 2258, 698, 2405, 1922, 16, 284, 330, 307, 33403, 698, 2405, 1922, 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...
2
func TestSyncPodsCreatesNetAndContainer(t *testing.T) { kubelet, _, fakeDocker := makeTestKubelet(t) fakeDocker.containerList = []docker.APIContainers{} err := kubelet.SyncPods([]Pod{ { Name: "foo", Namespace: "test", Manifest: api.ContainerManifest{ ID: "foo", Containers: []api.Container{ {Name: "bar"}, }, }, }, }) if err != nil { t.Errorf("unexpected error: %v", err) } kubelet.drainWorkers() verifyCalls(t, fakeDocker, []string{ "list", "list", "create", "start", "list", "inspect", "create", "start"}) fakeDocker.lock.Lock() if len(fakeDocker.Created) != 2 || !matchString(t, "k8s--net\\.[a-f0-9]+--foo.test--", fakeDocker.Created[0]) || !matchString(t, "k8s--bar\\.[a-f0-9]+--foo.test--", fakeDocker.Created[1]) { t.Errorf("Unexpected containers created %v", fakeDocker.Created) } fakeDocker.lock.Unlock() }
explode_data.jsonl/2828
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 387 }
[ 2830, 3393, 12154, 23527, 82, 54868, 6954, 3036, 4502, 1155, 353, 8840, 836, 8, 341, 16463, 3760, 1149, 11, 8358, 12418, 35, 13659, 1669, 1281, 2271, 42, 3760, 1149, 1155, 340, 1166, 726, 35, 13659, 18357, 852, 284, 3056, 28648, 24922, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestReadP384(t *testing.T) { v := New() const ( k1 = "did:key:z82Lm1MpAkeJcix9K8TMiLd5NMAhnwkjjCBeWHXyu3U4oT2MVJJKXkcVBgjGhnLBn2Kaau9" //nolint:lll k1KID = "did:key:z82Lm1MpAkeJcix9K8TMiLd5NMAhnwkjjCBeWHXyu3U4oT2MVJJKXkcVBgjGhnLBn2Kaau9#z82Lm1MpAkeJcix9K8TMiLd5NMAhnwkjjCBeWHXyu3U4oT2MVJJKXkcVBgjGhnLBn2Kaau9" //nolint:lll k1X = "lInTxl8fjLKp_UCrxI0WDklahi-7-_6JbtiHjiRvMvhedhKVdHBfi2HCY8t_QJyc" k1Y = "y6N1IC-2mXxHreETBW7K3mBcw0qGr3CWHCs-yl09yCQRLcyfGv7XhqAngHOu51Zv" k2 = "did:key:z82LkvCwHNreneWpsgPEbV3gu1C6NFJEBg4srfJ5gdxEsMGRJUz2sG9FE42shbn2xkZJh54" //nolint:lll k2KID = "did:key:z82LkvCwHNreneWpsgPEbV3gu1C6NFJEBg4srfJ5gdxEsMGRJUz2sG9FE42shbn2xkZJh54#z82LkvCwHNreneWpsgPEbV3gu1C6NFJEBg4srfJ5gdxEsMGRJUz2sG9FE42shbn2xkZJh54" //nolint:lll k2X = "CA-iNoHDg1lL8pvX3d1uvExzVfCz7Rn6tW781Ub8K5MrDf2IMPyL0RTDiaLHC1JT" k2Y = "Kpnrn8DkXUD3ge4mFxi-DKr0DYO2KuJdwNBrhzLRtfMa3WFMZBiPKUPfJj8dYNl_" ) t.Run("key 1", func(t *testing.T) { docResolution, err := v.Read(k1) require.NoError(t, err) require.NotNil(t, docResolution.DIDDocument) assertJSONWebKeyDoc(t, docResolution.DIDDocument, k1, k1KID, elliptic.P384(), readBigInt(t, k1X), readBigInt(t, k1Y)) }) t.Run("key 2", func(t *testing.T) { docResolution, err := v.Read(k2) require.NoError(t, err) require.NotNil(t, docResolution.DIDDocument) assertJSONWebKeyDoc(t, docResolution.DIDDocument, k2, k2KID, elliptic.P384(), readBigInt(t, k2X), readBigInt(t, k2Y)) }) }
explode_data.jsonl/16607
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1068 }
[ 2830, 3393, 4418, 47, 18, 23, 19, 1155, 353, 8840, 836, 8, 341, 5195, 1669, 1532, 2822, 4777, 2399, 197, 16463, 16, 262, 284, 330, 22920, 64849, 25, 89, 23, 17, 43, 76, 16, 72150, 32, 440, 41, 66, 941, 24, 42, 23, 22034, 72, 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 TestCreateFile(t *testing.T) { assert := assert.New(t) dir1, err := ioutil.TempDir("", "dir") assert.Nil(err) defer os.RemoveAll(dir1) file1, err := ioutil.TempFile("", "file*.txt") assert.Nil(err) file1.Close() defer os.Remove(file1.Name()) type args struct { filename string } tests := []struct { name string args args wantFile bool wantErr bool }{ { "directory already exists", args{ dir1, }, false, true, }, { "file already exists", args{ file1.Name(), }, false, true, }, { "filename is available", args{ filepath.Join(dir1, "file"), }, true, false, }, { "empty filename", args{ "", }, false, true, }, } for _, tt := range tests { got, gotErr := CreateFile(tt.args.filename) assert.Equal(tt.wantErr, gotErr != nil, tt.name) assert.Equal(tt.wantFile, got != nil, tt.name) if gotErr != nil { got.Close() } } }
explode_data.jsonl/11250
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 472 }
[ 2830, 3393, 4021, 1703, 1155, 353, 8840, 836, 8, 341, 6948, 1669, 2060, 7121, 1155, 692, 48532, 16, 11, 1848, 1669, 43144, 65009, 6184, 19814, 330, 3741, 1138, 6948, 59678, 3964, 340, 16867, 2643, 84427, 14161, 16, 692, 17661, 16, 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...
3
func TestLabelService_CreateLabelMapping(t *testing.T) { type fields struct { LabelService influxdb.LabelService } type args struct { mapping influxdb.LabelMapping permissions []influxdb.Permission } type wants struct { err error } tests := []struct { name string fields fields args args wants wants }{ { name: "authorized to create label mapping", fields: fields{ LabelService: &mock.LabelService{ FindLabelByIDFn: func(ctx context.Context, id platform.ID) (*influxdb.Label, error) { return &influxdb.Label{ ID: 1, OrgID: orgOneInfluxID, }, nil }, CreateLabelMappingFn: func(ctx context.Context, lm *influxdb.LabelMapping) error { return nil }, }, }, args: args{ mapping: influxdb.LabelMapping{ LabelID: 1, ResourceID: 2, ResourceType: influxdb.BucketsResourceType, }, permissions: []influxdb.Permission{ { Action: influxdb.WriteAction, Resource: influxdb.Resource{ Type: influxdb.LabelsResourceType, }, }, { Action: influxdb.WriteAction, Resource: influxdb.Resource{ Type: influxdb.BucketsResourceType, ID: influxdbtesting.IDPtr(2), }, }, }, }, wants: wants{ err: nil, }, }, { name: "unauthorized to create label mapping for resources on which the user does not have write access", fields: fields{ LabelService: &mock.LabelService{ FindLabelByIDFn: func(ctx context.Context, id platform.ID) (*influxdb.Label, error) { return &influxdb.Label{ ID: 1, OrgID: orgOneInfluxID, }, nil }, CreateLabelMappingFn: func(ctx context.Context, lm *influxdb.LabelMapping) error { return nil }, }, }, args: args{ mapping: influxdb.LabelMapping{ LabelID: 1, ResourceID: 2, ResourceType: influxdb.BucketsResourceType, }, permissions: []influxdb.Permission{ { Action: influxdb.WriteAction, Resource: influxdb.Resource{ Type: influxdb.LabelsResourceType, }, }, }, }, wants: wants{ err: &errors.Error{ Code: errors.EUnauthorized, Msg: "write:orgs/020f755c3c083000/buckets/0000000000000002 is unauthorized", }, }, }, { name: "unauthorized to create label mapping", fields: fields{ LabelService: &mock.LabelService{ FindLabelByIDFn: func(ctx context.Context, id platform.ID) (*influxdb.Label, error) { return &influxdb.Label{ ID: 1, OrgID: orgOneInfluxID, }, nil }, CreateLabelMappingFn: func(ctx context.Context, lm *influxdb.LabelMapping) error { return nil }, }, }, args: args{ mapping: influxdb.LabelMapping{ LabelID: 1, ResourceID: 2, ResourceType: influxdb.BucketsResourceType, }, permissions: []influxdb.Permission{ { Action: influxdb.ReadAction, Resource: influxdb.Resource{ Type: influxdb.LabelsResourceType, }, }, }, }, wants: wants{ err: &errors.Error{ Msg: "write:orgs/020f755c3c083000/labels/0000000000000001 is unauthorized", Code: errors.EUnauthorized, }, }, }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { s := NewAuthedLabelService(tt.fields.LabelService, orgSvc) ctx := context.Background() ctx = influxdbcontext.SetAuthorizer(ctx, mock.NewMockAuthorizer(false, tt.args.permissions)) err := s.CreateLabelMapping(ctx, &tt.args.mapping) influxdbtesting.ErrorsEqual(t, err, tt.wants.err) }) } }
explode_data.jsonl/35729
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1692 }
[ 2830, 3393, 2476, 1860, 34325, 2476, 6807, 1155, 353, 8840, 836, 8, 341, 13158, 5043, 2036, 341, 197, 82126, 1860, 52852, 1999, 4679, 1860, 198, 197, 532, 13158, 2827, 2036, 341, 197, 2109, 3629, 257, 52852, 1999, 4679, 6807, 198, 197, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestSamplerTicking(t *testing.T) { // Ensure that we're resetting the sampler's counter every tick. sampler, logs := fakeSampler(DebugLevel, 10*time.Millisecond, 5, 10) // If we log five or fewer messages every tick, none of them should be // dropped. for tick := 0; tick < 2; tick++ { for i := 1; i <= 5; i++ { writeSequence(sampler, i, InfoLevel) } zaptest.Sleep(15 * time.Millisecond) } assertSequence( t, logs.TakeAll(), InfoLevel, 1, 2, 3, 4, 5, // first tick 1, 2, 3, 4, 5, // second tick ) // If we log quickly, we should drop some logs. The first five statements // each tick should be logged, then every tenth. for tick := 0; tick < 3; tick++ { for i := 1; i < 18; i++ { writeSequence(sampler, i, InfoLevel) } zaptest.Sleep(10 * time.Millisecond) } assertSequence( t, logs.TakeAll(), InfoLevel, 1, 2, 3, 4, 5, 15, // first tick 1, 2, 3, 4, 5, 15, // second tick 1, 2, 3, 4, 5, 15, // third tick ) }
explode_data.jsonl/39114
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 395 }
[ 2830, 3393, 66048, 51, 16272, 1155, 353, 8840, 836, 8, 341, 197, 322, 29279, 429, 582, 2299, 78028, 279, 41799, 594, 5546, 1449, 9341, 624, 1903, 34501, 11, 18422, 1669, 12418, 66048, 42618, 4449, 11, 220, 16, 15, 77053, 71482, 11, 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...
5
func TestMatchCountForMultilineMatches(t *testing.T) { // If we are not on CI skip the test. if os.Getenv("CI") == "" { t.Skip("Not on CI, skipping comby-dependent test") } input := map[string]string{ "main.go": ` func foo() { fmt.Println("foo") } func bar() { fmt.Println("bar") } `, } wantMatchCount := 2 p := &protocol.PatternInfo{Pattern: "{:[body]}"} zipData, err := testutil.CreateZip(input) if err != nil { t.Fatal(err) } zf, cleanup, err := testutil.TempZipFileOnDisk(zipData) if err != nil { t.Fatal(err) } defer cleanup() t.Run("Strutural search match count", func(t *testing.T) { ctx, cancel, sender := newLimitedStreamCollector(context.Background(), 1000000000) defer cancel() err := structuralSearch(ctx, zf, Subset(p.IncludePatterns), "", p.Pattern, p.CombyRule, p.Languages, "repo_foo", sender) if err != nil { t.Fatal(err) } matches := sender.collected var gotMatchCount int for _, fileMatches := range matches { gotMatchCount += fileMatches.MatchCount } if gotMatchCount != wantMatchCount { t.Fatalf("got match count %d, want %d", gotMatchCount, wantMatchCount) } }) }
explode_data.jsonl/5449
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 452 }
[ 2830, 3393, 8331, 2507, 2461, 40404, 26560, 42470, 1155, 353, 8840, 836, 8, 341, 197, 322, 1416, 582, 525, 537, 389, 20694, 10706, 279, 1273, 624, 743, 2643, 64883, 445, 11237, 899, 621, 1591, 341, 197, 3244, 57776, 445, 2623, 389, 20...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
4
func TestAnyTimes(t *testing.T) { reporter, ctrl := createFixtures(t) subject := new(Subject) ctrl.RecordCall(subject, "FooMethod", "argument").AnyTimes() for i := 0; i < 100; i++ { ctrl.Call(subject, "FooMethod", "argument") } reporter.assertPass("After 100 method calls.") ctrl.Finish() }
explode_data.jsonl/17278
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 109 }
[ 2830, 3393, 8610, 18889, 1155, 353, 8840, 836, 8, 341, 69931, 261, 11, 23743, 1669, 1855, 25958, 18513, 1155, 340, 28624, 583, 1669, 501, 7, 13019, 692, 84381, 49959, 7220, 29128, 11, 330, 40923, 3523, 497, 330, 14479, 1827, 8610, 18889...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestMatrixInclude(t *testing.T) { axis, err := ParseString(fakeMatrixInclude) if err != nil { t.Error(err) return } if got, want := len(axis), 2; got != want { t.Errorf("Got %d matrix permutations, want %d", got, want) } if got, want := axis[0]["go_version"], "1.5"; got != want { t.Errorf("Got %s permutation, want %s", got, want) } if got, want := axis[1]["go_version"], "1.6"; got != want { t.Errorf("Got %s permutation, want %s", got, want) } if got, want := axis[0]["python_version"], "3.4"; got != want { t.Errorf("Got %s permutation, want %s", got, want) } if got, want := axis[1]["python_version"], "3.4"; got != want { t.Errorf("Got %s permutation, want %s", got, want) } }
explode_data.jsonl/13783
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 296 }
[ 2830, 3393, 6689, 22283, 1155, 353, 8840, 836, 8, 341, 197, 7184, 11, 1848, 1669, 14775, 703, 74138, 6689, 22283, 340, 743, 1848, 961, 2092, 341, 197, 3244, 6141, 3964, 340, 197, 853, 198, 197, 630, 743, 2684, 11, 1366, 1669, 2422, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestParseEntry(t *testing.T) { testkey := testKey(signingKeySeed) tests := []struct { input string e entry err error }{ // Subtrees: { input: "enrtree-branch:1,2", err: entryError{"branch", errInvalidChild}, }, { input: "enrtree-branch:AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", err: entryError{"branch", errInvalidChild}, }, { input: "enrtree-branch:", e: &branchEntry{}, }, { input: "enrtree-branch:AAAAAAAAAAAAAAAAAAAA", e: &branchEntry{[]string{"AAAAAAAAAAAAAAAAAAAA"}}, }, { input: "enrtree-branch:AAAAAAAAAAAAAAAAAAAA,BBBBBBBBBBBBBBBBBBBB", e: &branchEntry{[]string{"AAAAAAAAAAAAAAAAAAAA", "BBBBBBBBBBBBBBBBBBBB"}}, }, // Links { input: "enrtree://AKPYQIUQIL7PSIACI32J7FGZW56E5FKHEFCCOFHILBIMW3M6LWXS2@nodes.example.org", e: &linkEntry{"AKPYQIUQIL7PSIACI32J7FGZW56E5FKHEFCCOFHILBIMW3M6LWXS2@nodes.example.org", "nodes.example.org", &testkey.PublicKey}, }, { input: "enrtree://nodes.example.org", err: entryError{"link", errNoPubkey}, }, { input: "enrtree://AP62DT7WOTEQZGQZOU474PP3KMEGVTTE7A7NPRXKX3DUD57@nodes.example.org", err: entryError{"link", errBadPubkey}, }, { input: "enrtree://AP62DT7WONEQZGQZOU474PP3KMEGVTTE7A7NPRXKX3DUD57TQHGIA@nodes.example.org", err: entryError{"link", errBadPubkey}, }, // ENRs { input: "enr:-HW4QES8QIeXTYlDzbfr1WEzE-XKY4f8gJFJzjJL-9D7TC9lJb4Z3JPRRz1lP4pL_N_QpT6rGQjAU9Apnc-C1iMP36OAgmlkgnY0iXNlY3AyNTZrMaED5IdwfMxdmR8W37HqSFdQLjDkIwBd4Q_MjxgZifgKSdM", e: &enrEntry{node: testNode(nodesSeed1)}, }, { input: "enr:-HW4QLZHjM4vZXkbp-5xJoHsKSbE7W39FPC8283X-y8oHcHPTnDDlIlzL5ArvDUlHZVDPgmFASrh7cWgLOLxj4wprRkHgmlkgnY0iXNlY3AyNTZrMaEC3t2jLMhDpCDX5mbSEwDn4L3iUfyXzoO8G28XvjGRkrAg=", err: entryError{"enr", errInvalidENR}, }, // Invalid: {input: "", err: errUnknownEntry}, {input: "foo", err: errUnknownEntry}, {input: "enrtree", err: errUnknownEntry}, {input: "enrtree-x=", err: errUnknownEntry}, } for i, test := range tests { e, err := parseEntry(test.input, enode.ValidSchemes) if !reflect.DeepEqual(e, test.e) { t.Errorf("test %d: wrong entry %s, want %s", i, spew.Sdump(e), spew.Sdump(test.e)) } if err != test.err { t.Errorf("test %d: wrong error %q, want %q", i, err, test.err) } } }
explode_data.jsonl/55885
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1227 }
[ 2830, 3393, 14463, 5874, 1155, 353, 8840, 836, 8, 341, 18185, 792, 1669, 1273, 1592, 40046, 287, 1592, 41471, 340, 78216, 1669, 3056, 1235, 341, 197, 22427, 914, 198, 197, 7727, 257, 4343, 198, 197, 9859, 256, 1465, 198, 197, 59403, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
4
func TestWriter_removeOutDirIfExists(t *testing.T) { memMapFs := afero.NewMemMapFs() tests := map[string]struct { beforeTest func() cleanupTest func() expectedError string }{ "normal": { beforeTest: func() {}, cleanupTest: func() {}, }, "already exists": { beforeTest: func() { test.Ok(t, memMapFs.Mkdir(testOutPath, os.ModePerm)) file, err := memMapFs.Create(path.Join(testOutPath, "anyFile.txt")) test.Ok(t, err) _ = file.Close() }, cleanupTest: func() { err := memMapFs.RemoveAll(testOutPath) test.Ok(t, err) }, }, "already exists but without file": { beforeTest: func() { test.Ok(t, memMapFs.Mkdir(testOutPath, os.ModePerm)) }, cleanupTest: func() { err := memMapFs.RemoveAll(testOutPath) test.Ok(t, err) }, }, } for caseName, testCase := range tests { t.Logf("Testing '%s'", caseName) w := setupNewWriter(memMapFs) testCase.beforeTest() err := fs.Rmdir(memMapFs, w.ctx.OutputDir) if testCase.expectedError == "" { test.Ok(t, err) } else { test.Assert(t, err != nil && testCase.expectedError == err.Error(), "should error") } testCase.cleanupTest() } }
explode_data.jsonl/27783
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 525 }
[ 2830, 3393, 6492, 18193, 2662, 6184, 40232, 1155, 353, 8840, 836, 8, 341, 14145, 2227, 48300, 1669, 264, 802, 78, 7121, 18816, 2227, 48300, 2822, 78216, 1669, 2415, 14032, 60, 1235, 341, 197, 63234, 2271, 262, 2915, 741, 197, 1444, 6063...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestChatIsSuperGroup(t *testing.T) { chat := tgbotapi.Chat{ID: 10, Type: "supergroup"} if !chat.IsSuperGroup() { t.Fail() } }
explode_data.jsonl/25812
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 58 }
[ 2830, 3393, 15672, 3872, 19284, 2808, 1155, 353, 8840, 836, 8, 341, 197, 9686, 1669, 53188, 6331, 2068, 58844, 90, 915, 25, 220, 16, 15, 11, 3990, 25, 330, 12776, 2375, 886, 63159, 743, 753, 9686, 4506, 19284, 2808, 368, 341, 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 ]
2
func TestClientHealthcheckTimeoutLeak(t *testing.T) { // This test test checks if healthcheck requests are canceled // after timeout. // It contains couple of hacks which won't be needed once we // stop supporting Go1.7. // On Go1.7 it uses server side effects to monitor if connection // was closed, // and on Go 1.8+ we're additionally honestly monitoring routine // leaks via leaktest. mux := http.NewServeMux() var reqDoneMu sync.Mutex var reqDone bool mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { cn, ok := w.(http.CloseNotifier) if !ok { t.Fatalf("Writer is not CloseNotifier, but %v", reflect.TypeOf(w).Name()) } <-cn.CloseNotify() reqDoneMu.Lock() reqDone = true reqDoneMu.Unlock() }) lis, err := net.Listen("tcp", "127.0.0.1:0") if err != nil { t.Fatalf("Couldn't setup listener: %v", err) } addr := lis.Addr().String() srv := &http.Server{ Handler: mux, } go srv.Serve(lis) cli := &Client{ c: &http.Client{}, conns: []*conn{ &conn{ url: "http://" + addr + "/", }, }, } type closer interface { Shutdown(context.Context) error } // pre-Go1.8 Server can't Shutdown cl, isServerCloseable := (interface{}(srv)).(closer) // Since Go1.7 can't Shutdown() - there will be leak from server // Monitor leaks on Go 1.8+ if isServerCloseable { defer leaktest.CheckTimeout(t, time.Second*10)() } cli.healthcheck(time.Millisecond*500, true) if isServerCloseable { ctx, cancel := context.WithTimeout(context.Background(), time.Second) defer cancel() cl.Shutdown(ctx) } <-time.After(time.Second) reqDoneMu.Lock() if !reqDone { reqDoneMu.Unlock() t.Fatal("Request wasn't canceled or stopped") } reqDoneMu.Unlock() }
explode_data.jsonl/38002
{ "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, 2959, 14542, 2028, 7636, 2304, 585, 1155, 353, 8840, 836, 8, 341, 197, 322, 1096, 1273, 1273, 12341, 421, 2820, 2028, 7388, 525, 33446, 198, 197, 322, 1283, 9632, 624, 197, 322, 1084, 5610, 5625, 315, 59784, 892, 2765, 944...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestPathFromString(t *testing.T) { tests := []struct { desc string in string expect Path }{ { desc: "no-path", in: "", expect: Path{}, }, { desc: "valid-path", in: "a.b.c", expect: Path{"a", "b", "c"}, }, { desc: "surround-periods", in: ".a.", expect: Path{"a"}, }, } for _, tt := range tests { t.Run(tt.desc, func(t *testing.T) { if got := PathFromString(tt.in); !got.Equals(tt.expect) { t.Errorf("%s: expect %v got %v", tt.desc, tt.expect, got) } }) } }
explode_data.jsonl/70569
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 298 }
[ 2830, 3393, 1820, 44491, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 3056, 1235, 341, 197, 41653, 256, 914, 198, 197, 17430, 257, 914, 198, 197, 24952, 7933, 198, 197, 59403, 197, 197, 515, 298, 41653, 25, 256, 330, 2152, 33095, 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...
2
func TestConfigClients_Update_Success_Storage(t *testing.T) { s, _, _, h, iss, err := setupHydraTest(false) if err != nil { t.Fatalf("setupHydraTest() failed: %v", err) } clientName := "test_client" // Update the client RedirectUris. cli := &cpb.Client{ RedirectUris: []string{"http://client.example.com"}, } pname := "admin" h.UpdateClientResp = &hydraapi.Client{ ClientID: test.TestClientID, Name: clientName, Secret: "secret", RedirectURIs: cli.RedirectUris, Scope: defaultScope, GrantTypes: defaultGrantTypes, ResponseTypes: defaultResponseTypes, } resp := sendConfigClientsUpdate(t, pname, clientName, "master", test.TestClientID, test.TestClientSecret, cli, s, iss) if resp.StatusCode != http.StatusOK { t.Errorf("status=%d, wants %d", resp.StatusCode, http.StatusOK) } conf, err := s.loadConfig(nil, "master") if err != nil { t.Fatalf("s.loadConfig() failed %v", err) } updated, ok := conf.Clients[clientName] if !ok { t.Errorf("conf.Clients[%s] should exists in storage", clientName) } sec, err := s.loadSecrets(nil) if err != nil { t.Fatalf("s.loadSecrets() failed %v", err) } if sec.ClientSecrets[updated.ClientId] != h.UpdateClientResp.Secret { t.Errorf("client secret in storage = %s, wants %s", sec.ClientSecrets[updated.ClientId], h.UpdateClientResp.Secret) } }
explode_data.jsonl/18521
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 540 }
[ 2830, 3393, 2648, 47174, 47393, 87161, 62, 5793, 1155, 353, 8840, 836, 8, 341, 1903, 11, 8358, 8358, 305, 11, 2369, 11, 1848, 1669, 6505, 30816, 22248, 2271, 3576, 340, 743, 1848, 961, 2092, 341, 197, 3244, 30762, 445, 15188, 30816, 2...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
7
func TestUndirected(t *testing.T) { g := graphs.NewUndirectedGraph() node1 := nodes.NewSimpleNode(1) err := g.AddNode(node1) assert.NoError(t, err) output := Marshal(g) assert.Equal(t, `graph g { 1; }`, string(output)) }
explode_data.jsonl/57268
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 95 }
[ 2830, 3393, 19957, 74612, 1155, 353, 8840, 836, 8, 341, 3174, 1669, 38999, 7121, 19957, 74612, 11212, 741, 20831, 16, 1669, 7798, 7121, 16374, 1955, 7, 16, 340, 9859, 1669, 342, 1904, 1955, 6958, 16, 340, 6948, 35699, 1155, 11, 1848, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func Test_metaData(t *testing.T) { t.Run("Empty", func(t *testing.T) { data := metaData(context.TODO()) assert.Empty(t, data) }) t.Run("Headers", func(t *testing.T) { ctx := metadata.NewIncomingContext(context.TODO(), metadata.MD{ "x-valid": []string{"true"}, "ignored": []string{"false"}, }) data := metaData(ctx) if assert.Len(t, data, 1) { assert.Equal(t, []string{"true"}, data["x-valid"]) } }) }
explode_data.jsonl/12814
{ "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, 13381, 1043, 1155, 353, 8840, 836, 8, 341, 3244, 16708, 445, 3522, 497, 2915, 1155, 353, 8840, 836, 8, 341, 197, 8924, 1669, 81928, 5378, 90988, 2398, 197, 6948, 11180, 1155, 11, 821, 340, 197, 3518, 3244, 16708, 445, 1057...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestHandlers_GetDirectMessages(t *testing.T) { t.Parallel() path := "/api/v3/users/{userId}/messages" env := Setup(t, common1) user := env.CreateUser(t, rand) user2 := env.CreateUser(t, rand) user3 := env.CreateUser(t, rand) dm := env.CreateDMChannel(t, user.GetID(), user2.GetID()) m := env.CreateMessage(t, user.GetID(), dm.ID, rand) s := env.S(t, user.GetID()) t.Run("not logged in", func(t *testing.T) { t.Parallel() e := env.R(t) e.GET(path, user2.GetID()). Expect(). Status(http.StatusUnauthorized) }) t.Run("not found", func(t *testing.T) { t.Parallel() e := env.R(t) e.GET(path, uuid.Must(uuid.NewV4())). WithCookie(session.CookieName, s). Expect(). Status(http.StatusNotFound) }) t.Run("bad request", func(t *testing.T) { t.Parallel() e := env.R(t) e.GET(path, user2.GetID()). WithCookie(session.CookieName, s). WithQuery("limit", -1). Expect(). Status(http.StatusBadRequest) }) t.Run("success (existing dm)", func(t *testing.T) { t.Parallel() e := env.R(t) obj := e.GET(path, user2.GetID()). WithCookie(session.CookieName, s). Expect(). Status(http.StatusOK). JSON(). Array() obj.Length().Equal(1) messageEquals(t, m, obj.First().Object()) }) t.Run("success (creating dm)", func(t *testing.T) { t.Parallel() e := env.R(t) obj := e.GET(path, user3.GetID()). WithCookie(session.CookieName, s). Expect(). Status(http.StatusOK). JSON(). Array() obj.Length().Equal(0) }) }
explode_data.jsonl/40162
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 693 }
[ 2830, 3393, 39949, 13614, 16027, 15820, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 2822, 26781, 1669, 3521, 2068, 5457, 18, 19178, 9388, 13508, 4472, 16325, 698, 57538, 1669, 18626, 1155, 11, 4185, 16, 340, 19060, 1669, 6105, 7251, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_underscore_arrays_11(t *testing.T) { tt(t, func() { test, _ := test_() test(` test('zip', function() { var names = ['moe', 'larry', 'curly'], ages = [30, 40, 50], leaders = [true]; var stooges = _.zip(names, ages, leaders); equal(String(stooges), 'moe,30,true,larry,40,,curly,50,', 'zipped together arrays of different lengths'); }); `) }) }
explode_data.jsonl/68905
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 177 }
[ 2830, 3393, 62, 53933, 68983, 62, 16, 16, 1155, 353, 8840, 836, 8, 972, 3244, 83, 1155, 11, 2915, 368, 972, 197, 18185, 11, 716, 1669, 1273, 62, 18005, 197, 18185, 5809, 319, 220, 1273, 492, 9964, 516, 729, 368, 972, 262, 762, 503...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestSortedSetRange(t *testing.T) { testRaw(t, func(c *client) { c.Do("ZADD", "z", "1", "aap", "2", "noot", "3", "mies", "2", "nootagain", "3", "miesagain", "+Inf", "the stars", "+Inf", "more stars", "-Inf", "big bang", ) c.Do("ZRANGE", "z", "0", "-1") c.Do("ZRANGE", "z", "0", "-1", "WITHSCORES") c.Do("ZRANGE", "z", "0", "-1", "WiThScOrEs") c.Do("ZRANGE", "z", "0", "-2") c.Do("ZRANGE", "z", "0", "-1000") c.Do("ZRANGE", "z", "2", "-2") c.Do("ZRANGE", "z", "400", "-1") c.Do("ZRANGE", "z", "300", "-110") c.Do("ZREVRANGE", "z", "0", "-1") c.Do("ZREVRANGE", "z", "0", "-1", "WITHSCORES") c.Do("ZREVRANGE", "z", "0", "-1", "WiThScOrEs") c.Do("ZREVRANGE", "z", "0", "-2") c.Do("ZREVRANGE", "z", "0", "-1000") c.Do("ZREVRANGE", "z", "2", "-2") c.Do("ZREVRANGE", "z", "400", "-1") c.Do("ZREVRANGE", "z", "300", "-110") c.Do("ZADD", "zz", "0", "aap", "0", "Aap", "0", "AAP", "0", "aAP", "0", "aAp", ) c.Do("ZRANGE", "zz", "0", "-1") // failure cases c.Error("wrong number", "ZRANGE") c.Error("wrong number", "ZRANGE", "foo") c.Error("wrong number", "ZRANGE", "foo", "1") c.Error("syntax error", "ZRANGE", "foo", "2", "3", "toomany") c.Error("syntax error", "ZRANGE", "foo", "2", "3", "WITHSCORES", "toomany") c.Error("not an integer", "ZRANGE", "foo", "noint", "3") c.Error("not an integer", "ZRANGE", "foo", "2", "noint") c.Do("SET", "str", "I am a string") c.Error("wrong kind", "ZRANGE", "str", "300", "-110") c.Error("wrong number", "ZREVRANGE") c.Error("wrong kind", "ZREVRANGE", "str", "300", "-110") }) }
explode_data.jsonl/23342
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 852 }
[ 2830, 3393, 51051, 1649, 6046, 1155, 353, 8840, 836, 8, 341, 18185, 20015, 1155, 11, 2915, 1337, 353, 2972, 8, 341, 197, 1444, 33596, 445, 57, 15665, 497, 330, 89, 756, 298, 197, 1, 16, 497, 330, 64, 391, 756, 298, 197, 1, 17, 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 TestServiceProCheck(t *testing.T) { convey.Convey("ProCheck", t, func() { hid, err := s.ProCheck(context.Background(), 14771787, []int64{}, nil, "") convey.So(err, convey.ShouldBeNil) convey.So(hid, convey.ShouldNotBeNil) }) }
explode_data.jsonl/21124
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 99 }
[ 2830, 3393, 1860, 1336, 3973, 1155, 353, 8840, 836, 8, 341, 37203, 5617, 4801, 5617, 445, 1336, 3973, 497, 259, 11, 2915, 368, 341, 197, 9598, 307, 11, 1848, 1669, 274, 7763, 3973, 5378, 19047, 1507, 220, 16, 19, 22, 22, 16, 22, 2...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestClusterValidate(t *testing.T) { setup(t) ksMock := NewMockKubeSettings() m.When(ksMock.NamespaceNames()).ThenReturn([]string{"ns1", "ns2", "default"}, nil) c := config.NewCluster() c.Validate(ksMock) assert.Equal(t, "po", c.View.Active) assert.Equal(t, "default", c.Namespace.Active) assert.Equal(t, 1, len(c.Namespace.Favorites)) assert.Equal(t, []string{"default"}, c.Namespace.Favorites) }
explode_data.jsonl/14788
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 171 }
[ 2830, 3393, 28678, 17926, 1155, 353, 8840, 836, 8, 341, 84571, 1155, 692, 197, 2787, 11571, 1669, 1532, 11571, 42, 3760, 6086, 741, 2109, 50761, 7, 2787, 11571, 46011, 7980, 6011, 12209, 5598, 10556, 917, 4913, 4412, 16, 497, 330, 4412,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestContentString(t *testing.T) { for _, tt := range []struct { name string input Content want string }{ { name: "basic", input: Content{ Pattern: []byte("AA"), }, want: `content:"AA";`, }, { name: "basic escaped char", input: Content{ Pattern: []byte("AA;"), }, want: `content:"AA|3B|";`, }, { name: "negated content", input: Content{ Negate: true, Pattern: []byte("AA"), }, want: `content:!"AA";`, }, { name: "content with one option", input: Content{ Pattern: []byte("AA"), Options: []*ContentOption{ { Name: "http_uri", }, }, }, want: `content:"AA"; http_uri;`, }, { name: "content with multiple options", input: Content{ Pattern: []byte("AA"), Options: []*ContentOption{ { Name: "http_uri", }, { Name: "depth", Value: "0", }, }, }, want: `content:"AA"; http_uri; depth:0;`, }, { name: "content with multiple options and fast_pattern", input: Content{ Pattern: []byte("AA"), Options: []*ContentOption{ { Name: "http_uri", }, { Name: "depth", Value: "0", }, }, FastPattern: FastPattern{ Enabled: true, }, }, want: `content:"AA"; http_uri; depth:0; fast_pattern;`, }, } { got := tt.input.String() if got != tt.want { t.Fatalf("%s: got %v -- expected %v", tt.name, got, tt.want) } } }
explode_data.jsonl/59687
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 737 }
[ 2830, 3393, 2762, 703, 1155, 353, 8840, 836, 8, 341, 2023, 8358, 17853, 1669, 2088, 3056, 1235, 341, 197, 11609, 220, 914, 198, 197, 22427, 8883, 198, 197, 50780, 220, 914, 198, 197, 59403, 197, 197, 515, 298, 11609, 25, 330, 22342, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestEth_GetBalance(t *testing.T) { rpcRes := call(t, "eth_getBalance", []string{addrA, zeroString}) var res hexutil.Big err := res.UnmarshalJSON(rpcRes.Result) require.NoError(t, err) t.Logf("Got balance %s for %s\n", res.String(), addrA) // 0 if x == y; where x is res, y is 0 if res.ToInt().Cmp(big.NewInt(0)) != 0 { t.Errorf("expected balance: %d, got: %s", 0, res.String()) } }
explode_data.jsonl/844
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 168 }
[ 2830, 3393, 65390, 13614, 21190, 1155, 353, 8840, 836, 8, 341, 7000, 3992, 1061, 1669, 1618, 1155, 11, 330, 769, 3062, 21190, 497, 3056, 917, 90, 6214, 32, 11, 7168, 703, 8824, 2405, 592, 12371, 1314, 69223, 198, 9859, 1669, 592, 3809...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestGetPullRequestChanges(t *testing.T) { ts := httptest.NewTLSServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { if r.Method != http.MethodGet { t.Errorf("Bad method: %s", r.Method) } if r.URL.Path != "/repos/k8s/kuber/pulls/12/files" { t.Errorf("Bad request path: %s", r.URL.Path) } changes := []PullRequestChange{ {Filename: "foo.txt"}, } b, err := json.Marshal(&changes) if err != nil { t.Fatalf("Didn't expect error: %v", err) } fmt.Fprint(w, string(b)) })) defer ts.Close() c := getClient(ts.URL) cs, err := c.GetPullRequestChanges("k8s", "kuber", 12) if err != nil { t.Errorf("Didn't expect error: %v", err) } if len(cs) != 1 || cs[0].Filename != "foo.txt" { t.Errorf("Wrong result: %#v", cs) } }
explode_data.jsonl/6254
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 346 }
[ 2830, 3393, 1949, 36068, 1900, 11317, 1155, 353, 8840, 836, 8, 341, 57441, 1669, 54320, 70334, 7121, 13470, 1220, 2836, 19886, 89164, 18552, 3622, 1758, 37508, 11, 435, 353, 1254, 9659, 8, 341, 197, 743, 435, 20798, 961, 1758, 20798, 19...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
4
func TestIsArchivePathTar(t *testing.T) { cmd := exec.Command("sh", "-c", "touch /tmp/archivedata && tar -cf /tmp/archive /tmp/archivedata && gzip --stdout /tmp/archive > /tmp/archive.gz") output, err := cmd.CombinedOutput() if err != nil { t.Fatalf("Fail to create an archive file for test : %s.", output) } if !IsArchivePath(tmp + "/archive") { t.Fatalf("Did not recognise valid tar path as archive") } if !IsArchivePath(tmp + "archive.gz") { t.Fatalf("Did not recognise valid compressed tar path as archive") } }
explode_data.jsonl/81966
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 187 }
[ 2830, 3393, 3872, 42502, 1820, 62733, 1155, 353, 8840, 836, 8, 341, 25920, 1669, 3883, 12714, 445, 927, 497, 6523, 66, 497, 330, 22020, 608, 5173, 59973, 2221, 459, 1009, 12183, 481, 9792, 608, 5173, 71627, 608, 5173, 59973, 2221, 459, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestOKExMargin_GetOneOrder(t *testing.T) { t.Log(okex.OKExMargin.GetOneOrder("3174778420532224", goex.EOS_USDT)) }
explode_data.jsonl/3947
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 55 }
[ 2830, 3393, 3925, 840, 21681, 13614, 3966, 4431, 1155, 353, 8840, 836, 8, 341, 3244, 5247, 60207, 327, 15480, 840, 21681, 2234, 3966, 4431, 445, 18, 16, 22, 19, 22, 22, 23, 19, 17, 15, 20, 18, 17, 17, 17, 19, 497, 728, 327, 5142...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestStore_Query_Internal(t *testing.T) { t.Run("Failure sending tag name only query to find endpoint", func(t *testing.T) { store := &store{db: &mockDB{}} iterator, err := store.Query("tagName") require.EqualError(t, err, "failure while sending request to CouchDB find endpoint: mockDB Find always fails") require.Empty(t, iterator) }) t.Run("Failure sending tag name and value query to find endpoint", func(t *testing.T) { store := &store{db: &mockDB{}} iterator, err := store.Query("tagName:tagValue") require.EqualError(t, err, "failure while sending request to CouchDB find endpoint: mockDB Find always fails") require.Empty(t, iterator) }) }
explode_data.jsonl/72584
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 229 }
[ 2830, 3393, 6093, 48042, 37238, 1155, 353, 8840, 836, 8, 341, 3244, 16708, 445, 17507, 11628, 4772, 829, 1172, 3239, 311, 1477, 14887, 497, 2915, 1155, 353, 8840, 836, 8, 341, 197, 57279, 1669, 609, 4314, 90, 1999, 25, 609, 16712, 350...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestMakeComplex(t *testing.T) { for _, testCase := range []struct { literal string bitSize int expected complex64 }{ {"1,1", 64, 1 + 1i}, {"10.1,-6", 64, 10.1 + -6i}, } { if ok, got, err := fixture.MakeComplex(testCase.literal, testCase.bitSize); err != nil { t.Errorf("unexpected error: %s", err) } else if !ok { t.Errorf("expected complex %f to be made", testCase.expected) } else if complex64(got) != testCase.expected { t.Errorf("expected %f got %f", testCase.expected, got) } } for _, testCase := range []struct { literal string bitSize int expected complex128 }{ {"-200,-600", 128, -200 + -600i}, {"1234,56", 128, 1234 + 56i}, {"654321,123", 128, 654321 + 123i}, } { if ok, got, err := fixture.MakeComplex(testCase.literal, testCase.bitSize); err != nil { t.Errorf("unexpected error: %s", err) } else if !ok { t.Errorf("expected complex %f to be made", testCase.expected) } else if got != testCase.expected { t.Errorf("expected %f got %f", testCase.expected, got) } } }
explode_data.jsonl/31899
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 434 }
[ 2830, 3393, 8078, 31137, 1155, 353, 8840, 836, 8, 341, 2023, 8358, 54452, 1669, 2088, 3056, 1235, 341, 197, 8810, 9953, 220, 914, 198, 197, 79980, 1695, 220, 526, 198, 197, 42400, 6351, 21, 19, 198, 197, 59403, 197, 197, 4913, 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...
9
func TestPoolRequest(t *testing.T) { a := allocator{} pid, pool, _, err := a.RequestPool(defaultAS, "", "", nil, false) if err != nil { t.Fatal(err) } if !types.CompareIPNet(defaultPool, pool) { t.Fatalf("Unexpected pool returned. Expected %v. Got: %v", defaultPool, pool) } if pid != defaultPoolID { t.Fatalf("Unexpected pool id returned. Expected: %s. Got: %s", defaultPoolID, pid) } _, _, _, err = a.RequestPool("default", "", "", nil, false) if err == nil { t.Fatal("Unexpected success") } _, _, _, err = a.RequestPool(defaultAS, "192.168.0.0/16", "", nil, false) if err == nil { t.Fatal("Unexpected success") } _, _, _, err = a.RequestPool(defaultAS, "", "192.168.0.0/24", nil, false) if err == nil { t.Fatal("Unexpected success") } _, _, _, err = a.RequestPool(defaultAS, "", "", nil, true) if err == nil { t.Fatal("Unexpected success") } }
explode_data.jsonl/62136
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 367 }
[ 2830, 3393, 10551, 1900, 1155, 353, 8840, 836, 8, 341, 11323, 1669, 43655, 31483, 78799, 11, 7314, 11, 8358, 1848, 1669, 264, 9659, 10551, 18978, 1911, 11, 7342, 7342, 2092, 11, 895, 340, 743, 1848, 961, 2092, 341, 197, 3244, 26133, 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 TestJetStreamDomainInPubAck(t *testing.T) { conf := createConfFile(t, []byte(` listen: 127.0.0.1:-1 jetstream: {domain: "HUB"} `)) defer os.Remove(conf) s, _ := RunServerWithConfig(conf) defer s.Shutdown() config := s.JetStreamConfig() if config != nil { defer os.RemoveAll(config.StoreDir) } // Client for API requests. nc, err := nats.Connect(s.ClientURL()) if err != nil { t.Fatalf("Unexpected error: %v", err) } defer nc.Close() js, err := nc.JetStream() if err != nil { t.Fatalf("Got error during initialization %v", err) } cfg := &nats.StreamConfig{ Name: "TEST", Storage: nats.MemoryStorage, Subjects: []string{"foo"}, } if _, err := js.AddStream(cfg); err != nil { t.Fatalf("Unexpected error: %v", err) } pa, err := js.Publish("foo", []byte("msg")) if err != nil { t.Fatalf("Error on publish: %v", err) } if pa.Domain != "HUB" { t.Fatalf("Expected PubAck to have domain of %q, got %q", "HUB", pa.Domain) } }
explode_data.jsonl/29192
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 411 }
[ 2830, 3393, 35641, 3027, 13636, 641, 29162, 55559, 1155, 353, 8840, 836, 8, 341, 67850, 1669, 1855, 15578, 1703, 1155, 11, 3056, 3782, 61528, 197, 14440, 268, 25, 220, 16, 17, 22, 13, 15, 13, 15, 13, 16, 10944, 16, 198, 197, 12428, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestFirestoreRunQueryError(t *testing.T) { errCode := codes.PermissionDenied mockFirestore.err = gstatus.Error(errCode, "test error") var formattedParent string = fmt.Sprintf("projects/%s/databases/%s/documents/%s/%s", "[PROJECT]", "[DATABASE]", "[DOCUMENT]", "[ANY_PATH]") var request = &firestorepb.RunQueryRequest{ Parent: formattedParent, } c, err := NewClient(context.Background(), clientOpt) if err != nil { t.Fatal(err) } stream, err := c.RunQuery(context.Background(), request) if err != nil { t.Fatal(err) } resp, err := stream.Recv() if st, ok := gstatus.FromError(err); !ok { t.Errorf("got error %v, expected grpc error", err) } else if c := st.Code(); c != errCode { t.Errorf("got error code %q, want %q", c, errCode) } _ = resp }
explode_data.jsonl/27389
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 299 }
[ 2830, 3393, 48513, 6727, 2859, 1454, 1155, 353, 8840, 836, 8, 341, 9859, 2078, 1669, 13912, 73409, 54481, 198, 77333, 48513, 18441, 284, 342, 2829, 6141, 3964, 2078, 11, 330, 1944, 1465, 5130, 2405, 23126, 8387, 914, 284, 8879, 17305, 4...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
5
func TestSinkToDuckV1Beta1(t *testing.T) { originD := &duckv1.Destination{ Ref: &duckv1.KReference{ Kind: "service", APIVersion: "serving.knative.dev/v1", Name: "testsvc", Namespace: "default", }, URI: &apis.URL{ Scheme: "http", Host: "test-domain", }, } wantedD := &duckv1beta1.Destination{ Ref: &corev1.ObjectReference{ Kind: "service", APIVersion: "serving.knative.dev/v1", Name: "testsvc", Namespace: "default", }, URI: &apis.URL{ Scheme: "http", Host: "test-domain", }, } gotD := SinkToDuckV1Beta1(originD) assert.DeepEqual(t, gotD, wantedD) }
explode_data.jsonl/24089
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 325 }
[ 2830, 3393, 45094, 1249, 35, 1942, 53, 16, 64811, 16, 1155, 353, 8840, 836, 8, 341, 197, 8611, 35, 1669, 609, 72970, 85, 16, 909, 20646, 515, 197, 197, 3945, 25, 609, 72970, 85, 16, 11352, 8856, 515, 298, 197, 10629, 25, 981, 330,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestInstanceUpdateForUpdateRequests(t *testing.T) { cases := []struct { name string oldValue int64 newValue int64 expectedValue int64 }{ { name: "both default", oldValue: 0, newValue: 0, expectedValue: 0, }, { name: "old default", oldValue: 0, newValue: 1, expectedValue: 1, }, { name: "new default", oldValue: 1, newValue: 0, expectedValue: 1, }, { name: "neither default", oldValue: 1, newValue: 2, expectedValue: 2, }, } for _, tc := range cases { oldInstance := getTestInstance() oldInstance.Spec.UpdateRequests = tc.oldValue newInstance := getTestInstance() newInstance.Spec.UpdateRequests = tc.newValue instanceRESTStrategies.PrepareForUpdate(nil, newInstance, oldInstance) if e, a := tc.expectedValue, newInstance.Spec.UpdateRequests; e != a { t.Errorf("%s: got unexpected UpdateRequests: expected %v, got %v", tc.name, e, a) } } }
explode_data.jsonl/67003
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 485 }
[ 2830, 3393, 2523, 4289, 2461, 4289, 35295, 1155, 353, 8840, 836, 8, 341, 1444, 2264, 1669, 3056, 1235, 341, 197, 11609, 688, 914, 198, 197, 61828, 1130, 414, 526, 21, 19, 198, 197, 8638, 1130, 414, 526, 21, 19, 198, 197, 42400, 1130...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestGetRedisStore(t *testing.T) { t.Run("unmatched type", func(t *testing.T) { type store struct{ Store } err, rediStore := GetRedisStore(store{}) if err == nil || rediStore != nil { t.Fail() } }) }
explode_data.jsonl/25899
{ "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, 1949, 48137, 6093, 1155, 353, 8840, 836, 8, 341, 3244, 16708, 445, 359, 36734, 943, 497, 2915, 1155, 353, 8840, 836, 8, 341, 197, 13158, 3553, 2036, 90, 9129, 456, 197, 9859, 11, 2518, 72, 6093, 1669, 2126, 48137, 6093, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestMultipleParsing(t *testing.T) { // Set a byte stream consists of 3 messages with their headers. p := []byte{0, 0, 0, 0, 1, 'a', 0, 0, 0, 0, 2, 'b', 'c', 0, 0, 0, 0, 1, 'd'} b := fullReader{bytes.NewReader(p)} parser := &parser{r: b} wantRecvs := []struct { pt payloadFormat data []byte }{ {compressionNone, []byte("a")}, {compressionNone, []byte("bc")}, {compressionNone, []byte("d")}, } for i, want := range wantRecvs { pt, data, err := parser.recvMsg(math.MaxInt32) if err != nil || pt != want.pt || !reflect.DeepEqual(data, want.data) { t.Fatalf("after %d calls, parser{%v}.recvMsg(_) = %v, %v, %v\nwant %v, %v, <nil>", i, p, pt, data, err, want.pt, want.data) } } pt, data, err := parser.recvMsg(math.MaxInt32) if err != io.EOF { t.Fatalf("after %d recvMsgs calls, parser{%v}.recvMsg(_) = %v, %v, %v\nwant _, _, %v", len(wantRecvs), p, pt, data, err, io.EOF) } }
explode_data.jsonl/1897
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 416 }
[ 2830, 3393, 32089, 68839, 1155, 353, 8840, 836, 8, 341, 197, 322, 2573, 264, 4922, 4269, 17167, 315, 220, 18, 6605, 448, 862, 7102, 624, 3223, 1669, 3056, 3782, 90, 15, 11, 220, 15, 11, 220, 15, 11, 220, 15, 11, 220, 16, 11, 364...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestShouldValidateArgon2idHashWithTEqualOne(t *testing.T) { hash := "$argon2id$v=19$m=1024,t=1,p=1,k=16$c2FsdG9uY2U$Sk4UjzxXdCrBcyyMYiPEsQ" valid, err := CheckPassword("apple", hash) assert.True(t, valid) assert.NoError(t, err) }
explode_data.jsonl/40166
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 115 }
[ 2830, 3393, 14996, 17926, 2735, 263, 17, 307, 6370, 2354, 2446, 1751, 3966, 1155, 353, 8840, 836, 8, 341, 50333, 1669, 5201, 70821, 17, 307, 65020, 28, 16, 24, 53516, 28, 16, 15, 17, 19, 13960, 28, 16, 7237, 28, 16, 16147, 28, 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 TestAppendRemoveWithInvalidBytes(t *testing.T) { // TODO: revisit when msp serialization without PEM type is resolved t.Skip() t.Parallel() noPEMData := [][]byte{[]byte("badcert1"), []byte("badCert2")} //get the config for one of our Org1 test servers serverConfig := testOrgs[0].testServers(9200, [][]byte{})[0].config address := testOrgs[0].testServers(9200, [][]byte{})[0].address //create a GRPCServer srv, err := comm.NewGRPCServer(address, serverConfig) if err != nil { t.Fatalf("Failed to create GRPCServer due to: %s", err.Error()) } //append/remove nonPEMData noCertsFound := "No client root certificates found" err = srv.AppendClientRootCAs(noPEMData) if err == nil { t.Fatalf("Expected error: %s", noCertsFound) } err = srv.RemoveClientRootCAs(noPEMData) if err == nil { t.Fatalf("Expected error: %s", noCertsFound) } //apend/remove PEM without CERTIFICATE header err = srv.AppendClientRootCAs([][]byte{[]byte(pemNoCertificateHeader)}) if err == nil { t.Fatalf("Expected error: %s", noCertsFound) } err = srv.RemoveClientRootCAs([][]byte{[]byte(pemNoCertificateHeader)}) if err == nil { t.Fatalf("Expected error: %s", noCertsFound) } //append/remove bad PEM data err = srv.AppendClientRootCAs([][]byte{[]byte(badPEM)}) if err == nil { t.Fatalf("Expected error parsing bad PEM data") } err = srv.RemoveClientRootCAs([][]byte{[]byte(badPEM)}) if err == nil { t.Fatalf("Expected error parsing bad PEM data") } }
explode_data.jsonl/2128
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 577 }
[ 2830, 3393, 23877, 13021, 2354, 7928, 7078, 1155, 353, 8840, 836, 8, 1476, 197, 322, 5343, 25, 64778, 979, 296, 2154, 47443, 2041, 96734, 943, 374, 19673, 198, 3244, 57776, 741, 3244, 41288, 7957, 2822, 72104, 1740, 44, 1043, 1669, 5293...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestFloatWidth(t *testing.T) { testCases := []struct { testhelper.ID ff colfmt.Float expWidth int }{ { ID: testhelper.MkID("default"), expWidth: 1, }, { ID: testhelper.MkID("0 prec, non-0 width"), ff: colfmt.Float{W: 3}, expWidth: 3, }, { ID: testhelper.MkID("non-0 prec, non-0 width, too narrow"), ff: colfmt.Float{W: 3, Prec: 2}, expWidth: 4, }, { ID: testhelper.MkID("non-0 prec, non-0 width, wide enough"), ff: colfmt.Float{W: 5, Prec: 2}, expWidth: 5, }, } for _, tc := range testCases { testhelper.DiffInt(t, tc.IDStr(), "width", tc.ff.Width(), tc.expWidth) } }
explode_data.jsonl/45426
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 362 }
[ 2830, 3393, 5442, 3327, 1155, 353, 8840, 836, 8, 341, 18185, 37302, 1669, 3056, 1235, 341, 197, 18185, 18764, 9910, 198, 197, 67399, 981, 1375, 12501, 29794, 198, 197, 48558, 3327, 526, 198, 197, 59403, 197, 197, 515, 298, 29580, 25, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestEnumWindows(t *testing.T) { d := GetDLL(t, "user32.dll") isWindows := d.Proc("IsWindow") counter := 0 cb := syscall.NewCallback(func(hwnd syscall.Handle, lparam uintptr) uintptr { if lparam != 888 { t.Error("lparam was not passed to callback") } b, _, _ := isWindows.Call(uintptr(hwnd)) if b == 0 { t.Error("USER32.IsWindow returns FALSE") } counter++ return 1 // continue enumeration }) a, _, _ := d.Proc("EnumWindows").Call(cb, 888) if a == 0 { t.Error("USER32.EnumWindows returns FALSE") } if counter == 0 { t.Error("Callback has been never called or your have no windows") } }
explode_data.jsonl/54657
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 251 }
[ 2830, 3393, 10766, 13164, 1155, 353, 8840, 836, 8, 341, 2698, 1669, 2126, 64187, 1155, 11, 330, 872, 18, 17, 22200, 1138, 19907, 13164, 1669, 294, 7763, 66, 445, 3872, 4267, 1138, 58261, 1669, 220, 15, 198, 63810, 1669, 49345, 7121, 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 TestDecoder_EnumInvalidType(t *testing.T) { defer ConfigTeardown() data := []byte{0xE2, 0xA2, 0xF3, 0xAD, 0xAD, 0xAD} schema := `{"type":"enum", "name": "test", "symbols": ["foo", "bar"]}` dec, err := avro.NewDecoder(schema, bytes.NewReader(data)) assert.NoError(t, err) var str int err = dec.Decode(&str) assert.Error(t, err) }
explode_data.jsonl/22091
{ "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, 20732, 62, 10766, 7928, 929, 1155, 353, 8840, 836, 8, 341, 16867, 5532, 6639, 37496, 2822, 8924, 1669, 3056, 3782, 90, 15, 12606, 17, 11, 220, 15, 14673, 17, 11, 220, 15, 9770, 18, 11, 220, 15, 79447, 11, 220, 15, 7944...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestMissingKey(t *testing.T) { _, err := New(&GinJWTMiddleware{ Realm: "test zone", Timeout: time.Hour, MaxRefresh: time.Hour * 24, Authenticator: defaultAuthenticator, }) assert.Error(t, err) assert.Equal(t, ErrMissingSecretKey, err) }
explode_data.jsonl/64427
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 118 }
[ 2830, 3393, 25080, 1592, 1155, 353, 8840, 836, 8, 1476, 197, 6878, 1848, 1669, 1532, 2099, 38, 258, 55172, 24684, 515, 197, 197, 64290, 25, 260, 330, 1944, 10143, 756, 197, 197, 7636, 25, 981, 882, 73550, 345, 197, 197, 5974, 14567, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestGetValidDomain(t *testing.T) { testCases := []struct { desc string domains types.Domain wildcardAllowed bool dnsChallenge *DNSChallenge expectedErr string expectedDomains []string }{ { desc: "valid wildcard", domains: types.Domain{Main: "*.traefik.wtf"}, dnsChallenge: &DNSChallenge{}, wildcardAllowed: true, expectedErr: "", expectedDomains: []string{"*.traefik.wtf"}, }, { desc: "no wildcard", domains: types.Domain{Main: "traefik.wtf", SANs: []string{"foo.traefik.wtf"}}, dnsChallenge: &DNSChallenge{}, expectedErr: "", wildcardAllowed: true, expectedDomains: []string{"traefik.wtf", "foo.traefik.wtf"}, }, { desc: "unauthorized wildcard", domains: types.Domain{Main: "*.traefik.wtf"}, dnsChallenge: &DNSChallenge{}, wildcardAllowed: false, expectedErr: "unable to generate a wildcard certificate in ACME provider for domain \"*.traefik.wtf\" from a 'Host' rule", expectedDomains: nil, }, { desc: "no domain", domains: types.Domain{}, dnsChallenge: nil, wildcardAllowed: true, expectedErr: "unable to generate a certificate in ACME provider when no domain is given", expectedDomains: nil, }, { desc: "no DNSChallenge", domains: types.Domain{Main: "*.traefik.wtf", SANs: []string{"foo.traefik.wtf"}}, dnsChallenge: nil, wildcardAllowed: true, expectedErr: "unable to generate a wildcard certificate in ACME provider for domain \"*.traefik.wtf,foo.traefik.wtf\" : ACME needs a DNSChallenge", expectedDomains: nil, }, { desc: "unauthorized wildcard with SAN", domains: types.Domain{Main: "*.*.traefik.wtf", SANs: []string{"foo.traefik.wtf"}}, dnsChallenge: &DNSChallenge{}, wildcardAllowed: true, expectedErr: "unable to generate a wildcard certificate in ACME provider for domain \"*.*.traefik.wtf,foo.traefik.wtf\" : ACME does not allow '*.*' wildcard domain", expectedDomains: nil, }, { desc: "wildcard and SANs", domains: types.Domain{Main: "*.traefik.wtf", SANs: []string{"traefik.wtf"}}, dnsChallenge: &DNSChallenge{}, wildcardAllowed: true, expectedErr: "", expectedDomains: []string{"*.traefik.wtf", "traefik.wtf"}, }, { desc: "unexpected SANs", domains: types.Domain{Main: "*.traefik.wtf", SANs: []string{"*.acme.wtf"}}, dnsChallenge: &DNSChallenge{}, wildcardAllowed: true, expectedErr: "unable to generate a certificate in ACME provider for domains \"*.traefik.wtf,*.acme.wtf\": SAN \"*.acme.wtf\" can not be a wildcard domain", expectedDomains: nil, }, } for _, test := range testCases { test := test t.Run(test.desc, func(t *testing.T) { t.Parallel() acmeProvider := Provider{Configuration: &Configuration{DNSChallenge: test.dnsChallenge}} domains, err := acmeProvider.getValidDomains(context.Background(), test.domains, test.wildcardAllowed) if len(test.expectedErr) > 0 { assert.EqualError(t, err, test.expectedErr, "Unexpected error.") } else { assert.Equal(t, len(test.expectedDomains), len(domains), "Unexpected domains.") } }) } }
explode_data.jsonl/20640
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1500 }
[ 2830, 3393, 1949, 4088, 13636, 1155, 353, 8840, 836, 8, 341, 18185, 37302, 1669, 3056, 1235, 341, 197, 41653, 310, 914, 198, 197, 2698, 316, 1735, 260, 4494, 20442, 198, 197, 6692, 695, 4951, 35382, 1807, 198, 197, 2698, 4412, 62078, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestApp_Run_CommandSubcommandHelpName(t *testing.T) { app := &App{} buf := new(bytes.Buffer) app.Writer = buf app.Name = "base" subCmd := &Command{ Name: "bar", HelpName: "custom", Usage: "does bar things", } cmd := &Command{ Name: "foo", Description: "foo commands", Subcommands: []*Command{subCmd}, } app.Commands = []*Command{cmd} err := app.Run([]string{"command", "foo", "--help"}) if err != nil { t.Error(err) } output := buf.String() expected := "base foo - foo commands" if !strings.Contains(output, expected) { t.Errorf("expected %q in output: %q", expected, output) } expected = "base foo command [command options] [arguments...]" if !strings.Contains(output, expected) { t.Errorf("expected %q in output: %q", expected, output) } }
explode_data.jsonl/52587
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 313 }
[ 2830, 3393, 2164, 84158, 66751, 3136, 5631, 12689, 675, 1155, 353, 8840, 836, 8, 341, 28236, 1669, 609, 2164, 16094, 26398, 1669, 501, 23158, 22622, 340, 28236, 47838, 284, 6607, 198, 28236, 2967, 284, 330, 3152, 698, 28624, 15613, 1669, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
4
func TestDiagnosticClearingOnEdit(t *testing.T) { runner.Run(t, badPackage, func(t *testing.T, env *Env) { env.OpenFile("b.go") env.Await(env.DiagnosticAtRegexp("a.go", "a = 1"), env.DiagnosticAtRegexp("b.go", "a = 2")) // Fix the error by editing the const name in b.go to `b`. env.RegexpReplace("b.go", "(a) = 2", "b") env.Await( EmptyDiagnostics("a.go"), EmptyDiagnostics("b.go"), ) }) }
explode_data.jsonl/38902
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 187 }
[ 2830, 3393, 79388, 14008, 287, 1925, 4036, 1155, 353, 8840, 836, 8, 341, 197, 41736, 16708, 1155, 11, 3873, 13100, 11, 2915, 1155, 353, 8840, 836, 11, 6105, 353, 14359, 8, 341, 197, 57538, 12953, 1703, 445, 65, 18002, 1138, 197, 57538...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestMulti(t *testing.T) { ctx := context.Background() s, err := standard.New(ctx, standard.WithLogLevel(zerolog.Disabled), standard.WithMonitor(&nullmetrics.Service{})) require.NoError(t, err) require.NotNil(t, s) // Create a job for the future. run := uint32(0) jobFunc := func(ctx context.Context, data interface{}) { atomic.AddUint32(&run, 1) } require.NoError(t, s.ScheduleJob(ctx, "Test", "Test job", time.Now().Add(10*time.Second), jobFunc, nil)) require.Len(t, s.ListJobs(ctx), 1) // Create a number of runners that will try to start the job simultaneously. var runWG sync.WaitGroup var setupWG sync.WaitGroup starter := make(chan interface{}) for i := 0; i < 32; i++ { setupWG.Add(1) runWG.Add(1) go func() { setupWG.Done() <-starter //nolint s.RunJob(ctx, "Test job") runWG.Done() }() } // Wait for setup to complete. setupWG.Wait() // Start the jobs by closing the channel. close(starter) // Wait for run to complete runWG.Wait() // Ensure the job has only completed once. require.Equal(t, uint32(1), run) require.Len(t, s.ListJobs(ctx), 0) }
explode_data.jsonl/44227
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 438 }
[ 2830, 3393, 20358, 1155, 353, 8840, 836, 8, 341, 20985, 1669, 2266, 19047, 741, 1903, 11, 1848, 1669, 5297, 7121, 7502, 11, 5297, 26124, 72676, 7, 7070, 1609, 89576, 701, 5297, 26124, 30098, 2099, 2921, 43262, 13860, 6257, 1171, 17957, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestWalletTransfer(t *testing.T) { t.Parallel() _, err := b.WalletTransfer(0.01, "bla", "bla", "bla") if err == nil { t.Error("Test Failed - WalletTransfer() error") } }
explode_data.jsonl/79943
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 73 }
[ 2830, 3393, 38259, 21970, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 2822, 197, 6878, 1848, 1669, 293, 1175, 7464, 21970, 7, 15, 13, 15, 16, 11, 330, 64726, 497, 330, 64726, 497, 330, 64726, 1138, 743, 1848, 621, 2092, 341, 19...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
2
func TestScaleFailure(t *testing.T) { ctx, cancel, infs := SetupFakeContextWithCancel(t) waitInformers, err := controller.RunInformers(ctx.Done(), infs...) if err != nil { t.Fatal("Error starting up informers:", err) } defer func() { cancel() waitInformers() }() ctl := NewController(ctx, newConfigWatcher(), newTestDeciders()) // Only put the KPA in the lister, which will prompt failures scaling it. rev := newTestRevision(testNamespace, testRevision) kpa := revisionresources.MakePA(rev) fakepainformer.Get(ctx).Informer().GetIndexer().Add(kpa) newDeployment(t, fakedynamicclient.Get(ctx), testRevision+"-deployment", 3) // The Reconciler won't do any work until it becomes the leader. if la, ok := ctl.Reconciler.(reconciler.LeaderAware); ok { la.Promote(reconciler.UniversalBucket(), func(reconciler.Bucket, types.NamespacedName) {}) } if err := ctl.Reconciler.Reconcile(context.Background(), testNamespace+"/"+testRevision); err == nil { t.Error("Reconcile() = nil, wanted error") } }
explode_data.jsonl/35445
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 365 }
[ 2830, 3393, 6947, 17507, 1155, 353, 8840, 836, 8, 341, 20985, 11, 9121, 11, 304, 3848, 1669, 18626, 52317, 1972, 2354, 9269, 1155, 340, 48750, 37891, 388, 11, 1848, 1669, 6461, 16708, 37891, 388, 7502, 60422, 1507, 304, 3848, 31218, 743...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestInit_fromModule(t *testing.T) { t.Parallel() // This test reaches out to registry.terraform.io and github.com to lookup // and fetch a module. skipIfCannotAccessNetwork(t) fixturePath := filepath.Join("testdata", "empty") tf := e2e.NewBinary(terraformBin, fixturePath) defer tf.Close() cmd := tf.Cmd("init", "-from-module=hashicorp/vault/aws") cmd.Stdin = nil cmd.Stderr = &bytes.Buffer{} err := cmd.Run() if err != nil { t.Errorf("unexpected error: %s", err) } stderr := cmd.Stderr.(*bytes.Buffer).String() if stderr != "" { t.Errorf("unexpected stderr output:\n%s", stderr) } content, err := tf.ReadFile("main.tf") if err != nil { t.Fatalf("failed to read main.tf: %s", err) } if !bytes.Contains(content, []byte("vault")) { t.Fatalf("main.tf doesn't appear to be a vault configuration: \n%s", content) } }
explode_data.jsonl/57934
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 337 }
[ 2830, 3393, 3803, 5673, 3332, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 2822, 197, 322, 1096, 1273, 24491, 700, 311, 19424, 13, 61385, 4245, 323, 31004, 905, 311, 18615, 198, 197, 322, 323, 7807, 264, 4688, 624, 1903, 13389, 26...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
5
func TestTerragruntWorksWithGCSBackend(t *testing.T) { t.Parallel() cleanupTerraformFolder(t, TEST_FIXTURE_GCS_PATH) // We need a project to create the bucket in, so we pull one from the recommended environment variable. project := os.Getenv("GOOGLE_CLOUD_PROJECT") gcsBucketName := fmt.Sprintf("terragrunt-test-bucket-%s", strings.ToLower(uniqueId())) defer deleteGCSBucket(t, gcsBucketName) tmpTerragruntGCSConfigPath := createTmpTerragruntGCSConfig(t, TEST_FIXTURE_GCS_PATH, project, TERRAFORM_REMOTE_STATE_GCP_REGION, gcsBucketName, config.DefaultTerragruntConfigPath) runTerragrunt(t, fmt.Sprintf("terragrunt apply -auto-approve --terragrunt-non-interactive --terragrunt-config %s --terragrunt-working-dir %s", tmpTerragruntGCSConfigPath, TEST_FIXTURE_GCS_PATH)) var expectedGCSLabels = map[string]string{ "owner": "terragrunt_test", "name": "terraform_state_storage"} validateGCSBucketExistsAndIsLabeled(t, TERRAFORM_REMOTE_STATE_GCP_REGION, gcsBucketName, expectedGCSLabels) }
explode_data.jsonl/10077
{ "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, 51402, 68305, 3850, 6776, 16056, 38, 6412, 29699, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 2822, 1444, 60639, 51, 13886, 627, 13682, 1155, 11, 13602, 42635, 41486, 2646, 6412, 7944, 692, 197, 322, 1205, 1184, 264, 23...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestBleveIndexAndSearch(t *testing.T) { models.PrepareTestEnv(t) dir, err := ioutil.TempDir("", "bleve.index") assert.NoError(t, err) if err != nil { assert.Fail(t, "Unable to create temporary directory") return } defer util.RemoveAll(dir) idx, _, err := NewBleveIndexer(dir) if err != nil { assert.Fail(t, "Unable to create bleve indexer Error: %v", err) if idx != nil { idx.Close() } return } defer idx.Close() testIndexer("beleve", t, idx) }
explode_data.jsonl/21964
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 204 }
[ 2830, 3393, 33, 273, 586, 1552, 3036, 5890, 1155, 353, 8840, 836, 8, 341, 19727, 82, 28770, 3380, 2271, 14359, 1155, 692, 48532, 11, 1848, 1669, 43144, 65009, 6184, 19814, 330, 891, 586, 5154, 1138, 6948, 35699, 1155, 11, 1848, 340, 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...
4
func TestWorkerErrorInAction(t *testing.T) { worker := createDefaultWorker() worker.Start() rc := make(chan *ActionResult) action := new(MockFullAction) action.On("Run", nil, mock.AnythingOfType("map[string]interface {}"), mock.AnythingOfType("*runner.AsyncResultHandler")).Return(errors.New("Error in action")) actionData := &ActionData{arc: rc, action: action} // Create some work errorWorkRequest := ActionWorkRequest{ReqType: RtRun, actionData: actionData} // Send some work worker.Work <- errorWorkRequest // Check work result result := <-actionData.arc assert.NotNil(t, result.err) assert.Equal(t, "Error in action", result.err.Error()) }
explode_data.jsonl/16731
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 212 }
[ 2830, 3393, 21936, 1454, 641, 2512, 1155, 353, 8840, 836, 8, 341, 197, 21462, 1669, 1855, 3675, 21936, 741, 197, 21462, 12101, 2822, 30295, 1669, 1281, 35190, 353, 17301, 692, 38933, 1669, 501, 66436, 9432, 2512, 340, 38933, 8071, 445, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestSuperHashSetGetConcurrent(t *testing.T) { hashmap := New() k1, k2, k3 := 1, true, 3 count := 0 for count < 1000 { go func() { count++ hashmap.Set(k1, k2, k3, count) }() go func() { count++ hashmap.Set(k1, k2, k3, count) }() go func() { count++ hashmap.Set(k1, k2, k3, count) }() go func() { count++ hashmap.Set(k1, k2, k3, count) }() } }
explode_data.jsonl/82213
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 208 }
[ 2830, 3393, 19284, 44601, 1949, 1109, 3231, 1155, 353, 8840, 836, 8, 341, 50333, 2186, 1669, 1532, 741, 16463, 16, 11, 595, 17, 11, 595, 18, 1669, 220, 16, 11, 830, 11, 220, 18, 198, 18032, 1669, 220, 15, 198, 2023, 1760, 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...
1
func TestImplicitCastNotNullFlag(t *testing.T) { ctx := context.Background() ca := "select count(*) from t3 group by a having bit_and(b) > 1;" comment := fmt.Sprintf("for %s", ca) s := createPlannerSuite() stmt, err := s.p.ParseOneStmt(ca, "", "") require.NoError(t, err, comment) p, _, err := BuildLogicalPlanForTest(ctx, s.ctx, stmt, s.is) require.NoError(t, err) p, err = logicalOptimize(context.TODO(), flagPredicatePushDown|flagJoinReOrder|flagPrunColumns|flagEliminateProjection, p.(LogicalPlan)) require.NoError(t, err) // AggFuncs[0] is count; AggFuncs[1] is bit_and, args[0] is return type of the implicit cast castNotNullFlag := (p.(*LogicalProjection).children[0].(*LogicalSelection).children[0].(*LogicalAggregation).AggFuncs[1].Args[0].GetType().Flag) & mysql.NotNullFlag var nullableFlag uint = 0 require.Equal(t, nullableFlag, castNotNullFlag) }
explode_data.jsonl/50200
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 326 }
[ 2830, 3393, 59558, 18714, 11005, 12135, 1155, 353, 8840, 836, 8, 341, 20985, 1669, 2266, 19047, 741, 197, 924, 1669, 330, 1742, 1760, 28671, 504, 259, 18, 1874, 553, 264, 3432, 2699, 8378, 1883, 8, 861, 220, 16, 41655, 96268, 1669, 88...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestNoOpUpdates(t *testing.T) { server, registry := NewTestGenericStoreRegistry(t) defer server.Terminate(t) newPod := func() *api.Pod { return &api.Pod{ ObjectMeta: api.ObjectMeta{ Namespace: api.NamespaceDefault, Name: "foo", Labels: map[string]string{"prepare_create": "true"}, }, Spec: api.PodSpec{NodeName: "machine"}, } } var err error var createResult runtime.Object if createResult, err = registry.Create(api.NewDefaultContext(), newPod()); err != nil { t.Fatalf("Unexpected error: %v", err) } createdPod, err := registry.Get(api.NewDefaultContext(), "foo") if err != nil { t.Fatalf("Unexpected error: %v", err) } var updateResult runtime.Object p := newPod() if updateResult, _, err = registry.Update(api.NewDefaultContext(), p.Name, rest.DefaultUpdatedObjectInfo(p, api.Scheme)); err != nil { t.Fatalf("Unexpected error: %v", err) } // Check whether we do not return empty result on no-op update. if !reflect.DeepEqual(createResult, updateResult) { t.Errorf("no-op update should return a correct value, got: %#v", updateResult) } updatedPod, err := registry.Get(api.NewDefaultContext(), "foo") if err != nil { t.Fatalf("Unexpected error: %v", err) } createdMeta, err := meta.Accessor(createdPod) if err != nil { t.Fatalf("Unexpected error: %v", err) } updatedMeta, err := meta.Accessor(updatedPod) if err != nil { t.Fatalf("Unexpected error: %v", err) } if createdMeta.GetResourceVersion() != updatedMeta.GetResourceVersion() { t.Errorf("no-op update should be ignored and not written to etcd") } }
explode_data.jsonl/230
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 579 }
[ 2830, 3393, 2753, 7125, 37091, 1155, 353, 8840, 836, 8, 341, 41057, 11, 19424, 1669, 1532, 2271, 19964, 6093, 15603, 1155, 340, 16867, 3538, 836, 261, 34016, 1155, 692, 8638, 23527, 1669, 2915, 368, 353, 2068, 88823, 341, 197, 853, 609,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1