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 TestNewUpgradeableCondition(t *testing.T) { tests := []struct { name string features string expected operatorv1.OperatorCondition }{ { name: "default", features: "", expected: operatorv1.OperatorCondition{ Reason: "AllowedFeatureGates_", Status: "True", Type: "FeatureGatesUpgradeable", }, }, { name: "unknown", features: "other", expected: operatorv1.OperatorCondition{ Reason: "RestrictedFeatureGates_other", Status: "False", Type: "FeatureGatesUpgradeable", Message: "\"other\" does not allow updates", }, }, { name: "techpreview", features: string(configv1.TechPreviewNoUpgrade), expected: operatorv1.OperatorCondition{ Reason: "RestrictedFeatureGates_TechPreviewNoUpgrade", Status: "False", Type: "FeatureGatesUpgradeable", Message: "\"TechPreviewNoUpgrade\" does not allow updates", }, }, { name: "latencysensitive", features: string(configv1.LatencySensitive), expected: operatorv1.OperatorCondition{ Reason: "AllowedFeatureGates_LatencySensitive", Status: "True", Type: "FeatureGatesUpgradeable", Message: "", }, }, } for _, test := range tests { t.Run(test.name, func(t *testing.T) { actual := newUpgradeableCondition(&configv1.FeatureGate{ Spec: configv1.FeatureGateSpec{ FeatureGateSelection: configv1.FeatureGateSelection{ FeatureSet: configv1.FeatureSet(test.features), }, }, }) if !reflect.DeepEqual(test.expected, actual) { t.Fatal(spew.Sdump(actual)) } }) } }
explode_data.jsonl/17543
{ "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, 3564, 43861, 480, 10547, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 3056, 1235, 341, 197, 11609, 914, 271, 197, 1166, 22462, 914, 198, 197, 42400, 5675, 85, 16, 85546, 10547, 198, 197, 59403, 197, 197, 515, 298, 11609, 25,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestConnect(t *testing.T) { nodeNum := 10 instances := []*gossipInstance{} firstSentMemReqMsgs := make(chan *protoext.SignedGossipMessage, nodeNum) for i := 0; i < nodeNum; i++ { inst := createDiscoveryInstance(7611+i, fmt.Sprintf("d%d", i), []string{}) inst.comm.lock.Lock() inst.comm.mock = &mock.Mock{} inst.comm.mock.On("SendToPeer", mock.Anything, mock.Anything).Run(func(arguments mock.Arguments) { inst := inst msg := arguments.Get(1).(*protoext.SignedGossipMessage) if req := msg.GetMemReq(); req != nil { selfMsg, _ := protoext.EnvelopeToGossipMessage(req.SelfInformation) firstSentMemReqMsgs <- selfMsg inst.comm.lock.Lock() inst.comm.mock = nil inst.comm.lock.Unlock() } }) inst.comm.mock.On("Ping", mock.Anything) inst.comm.lock.Unlock() instances = append(instances, inst) j := (i + 1) % 10 endpoint := fmt.Sprintf("localhost:%d", 7611+j) netMember2Connect2 := NetworkMember{Endpoint: endpoint, PKIid: []byte(endpoint)} inst.Connect(netMember2Connect2, func() (identification *PeerIdentification, err error) { return &PeerIdentification{SelfOrg: false, ID: nil}, nil }) } time.Sleep(time.Second * 3) fullMembership := func() bool { return nodeNum-1 == len(instances[nodeNum-1].GetMembership()) } waitUntilOrFail(t, fullMembership) discInst := instances[rand.Intn(len(instances))].Discovery.(*gossipDiscoveryImpl) mr, _ := discInst.createMembershipRequest(true) am, _ := protoext.EnvelopeToGossipMessage(mr.GetMemReq().SelfInformation) assert.NotNil(t, am.SecretEnvelope) mr2, _ := discInst.createMembershipRequest(false) am, _ = protoext.EnvelopeToGossipMessage(mr2.GetMemReq().SelfInformation) assert.Nil(t, am.SecretEnvelope) stopInstances(t, instances) assert.Len(t, firstSentMemReqMsgs, 10) close(firstSentMemReqMsgs) for firstSentSelfMsg := range firstSentMemReqMsgs { assert.Nil(t, firstSentSelfMsg.Envelope.SecretEnvelope) } }
explode_data.jsonl/62258
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 760 }
[ 2830, 3393, 14611, 1155, 353, 8840, 836, 8, 341, 20831, 4651, 1669, 220, 16, 15, 198, 197, 47825, 1669, 29838, 70, 41473, 2523, 16094, 42190, 31358, 18816, 27234, 6611, 82, 1669, 1281, 35190, 353, 15110, 427, 808, 1542, 38, 41473, 2052,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestGetSpotAllTokenPairsInformationForCurrency(t *testing.T) { _, err := o.GetSpotAllTokenPairsInformationForCurrency(spotCurrency) if err != nil { t.Error(err) } }
explode_data.jsonl/30169
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 64 }
[ 2830, 3393, 1949, 47049, 2403, 3323, 54228, 14873, 2461, 26321, 1155, 353, 8840, 836, 8, 341, 197, 6878, 1848, 1669, 297, 2234, 47049, 2403, 3323, 54228, 14873, 2461, 26321, 1141, 19099, 26321, 340, 743, 1848, 961, 2092, 341, 197, 3244, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
2
func TestGetTeamInviteInfo(t *testing.T) { th := Setup(t).InitBasic() defer th.TearDown() Client := th.Client team := th.BasicTeam team, resp := Client.GetTeamInviteInfo(team.InviteId) CheckNoError(t, resp) require.NotEmpty(t, team.DisplayName, "should not be empty") require.Empty(t, team.Email, "should be empty") team.InviteId = "12345678901234567890123456789012" team, resp = th.SystemAdminClient.UpdateTeam(team) CheckNoError(t, resp) _, resp = Client.GetTeamInviteInfo(team.InviteId) CheckNoError(t, resp) _, resp = Client.GetTeamInviteInfo("junk") CheckNotFoundStatus(t, resp) }
explode_data.jsonl/70740
{ "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, 1949, 14597, 93540, 1731, 1155, 353, 8840, 836, 8, 341, 70479, 1669, 18626, 1155, 568, 3803, 15944, 741, 16867, 270, 836, 682, 4454, 741, 71724, 1669, 270, 11716, 198, 197, 9196, 1669, 270, 48868, 14597, 271, 197, 9196, 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 TestQueueDuplicateLeaf(t *testing.T) { ctx := context.Background() cleanTestDB(t, db) tree := createTreeOrPanic(db, testonly.LogTree) s := NewLogStorage(db, nil) mustSignAndStoreLogRoot(ctx, t, s, tree, 0) count := 15 leaves := createTestLeaves(int64(count), 10) leaves2 := createTestLeaves(int64(count), 12) leaves3 := createTestLeaves(3, 100) // Note that tests accumulate queued leaves on top of each other. tests := []struct { desc string leaves []*trillian.LogLeaf want []*trillian.LogLeaf }{ { desc: "[10, 11, 12, ...]", leaves: leaves, want: make([]*trillian.LogLeaf, count), }, { desc: "[12, 13, 14, ...] so first (count-2) are duplicates", leaves: leaves2, want: append(leaves[2:], nil, nil), }, { desc: "[10, 100, 11, 101, 102] so [dup, new, dup, new, dup]", leaves: []*trillian.LogLeaf{leaves[0], leaves3[0], leaves[1], leaves3[1], leaves[2]}, want: []*trillian.LogLeaf{leaves[0], nil, leaves[1], nil, leaves[2]}, }, } for _, test := range tests { t.Run(test.desc, func(t *testing.T) { existing, err := s.QueueLeaves(ctx, tree, test.leaves, fakeQueueTime) if err != nil { t.Fatalf("Failed to queue leaves: %v", err) } if len(existing) != len(test.want) { t.Fatalf("|QueueLeaves()|=%d; want %d", len(existing), len(test.want)) } for i, want := range test.want { got := existing[i] if want == nil { if got.Status != nil { t.Fatalf("QueueLeaves()[%d].Status=%v; want nil", i, got) } return } if got == nil { t.Fatalf("QueueLeaves()[%d]=nil; want non-nil", i) } else if !bytes.Equal(got.Leaf.LeafIdentityHash, want.LeafIdentityHash) { t.Fatalf("QueueLeaves()[%d].LeafIdentityHash=%x; want %x", i, got.Leaf.LeafIdentityHash, want.LeafIdentityHash) } } }) } }
explode_data.jsonl/30677
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 832 }
[ 2830, 3393, 7554, 53979, 31461, 1155, 353, 8840, 836, 8, 341, 20985, 1669, 2266, 19047, 2822, 1444, 2675, 2271, 3506, 1155, 11, 2927, 692, 51968, 1669, 1855, 6533, 2195, 47, 31270, 9791, 11, 1273, 3243, 5247, 6533, 340, 1903, 1669, 1532...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
8
func TestPostTemplateCreate(t *testing.T) { mock := test.SetupMockDB() test.MockServer() defer gock.DisableNetworking() testServer := httptest.NewServer(service.RegisterRoutes()) gock.New(testServer.URL).EnableNetworking().Persist() defer gock.DisableNetworking() defer testServer.Close() // create httpexpect instance e := httpexpect.New(t, testServer.URL) Data["status"] = "template" t.Run("Create a template from post", func(t *testing.T) { test.CheckSpaceMock(mock) postSelectWithSpace(mock) // preload tags & categories mock.ExpectQuery(regexp.QuoteMeta(`SELECT * FROM "post_categories"`)). WithArgs(sqlmock.AnyArg()). WillReturnRows(sqlmock.NewRows([]string{"post_id", "category_id"}). AddRow(1, 1)) category.SelectWithOutSpace(mock) mock.ExpectQuery(regexp.QuoteMeta(`SELECT * FROM "post_tags"`)). WithArgs(sqlmock.AnyArg()). WillReturnRows(sqlmock.NewRows([]string{"post_id", "tag_id"}). AddRow(1, 1)) tag.SelectMock(mock, tag.Data, 1) postInsertMock(mock, Data, false) postSelectWithOutSpace(mock, Data) mock.ExpectCommit() e.POST(templatePath). WithHeaders(headers). WithJSON(templateData). Expect(). Status(http.StatusOK) test.ExpectationsMet(t, mock) }) t.Run("invalid template data body", func(t *testing.T) { test.CheckSpaceMock(mock) e.POST(templatePath). WithHeaders(headers). WithJSON(invalidTemplateData). Expect(). Status(http.StatusUnprocessableEntity) }) t.Run("undecodable template data body", func(t *testing.T) { test.CheckSpaceMock(mock) e.POST(templatePath). WithHeaders(headers). WithJSON(undecodableTemplateData). Expect(). Status(http.StatusUnprocessableEntity) }) t.Run("post record not found", func(t *testing.T) { test.CheckSpaceMock(mock) mock.ExpectQuery(selectQuery). WithArgs(1, false, 1). WillReturnRows(sqlmock.NewRows(columns)) e.POST(templatePath). WithHeaders(headers). WithJSON(templateData). Expect(). Status(http.StatusNotFound) test.ExpectationsMet(t, mock) }) t.Run("cannot create template", func(t *testing.T) { test.CheckSpaceMock(mock) postSelectWithSpace(mock) // preload tags & categories mock.ExpectQuery(regexp.QuoteMeta(`SELECT * FROM "post_categories"`)). WithArgs(sqlmock.AnyArg()). WillReturnRows(sqlmock.NewRows([]string{"post_id", "category_id"}). AddRow(1, 1)) category.SelectWithOutSpace(mock) mock.ExpectQuery(regexp.QuoteMeta(`SELECT * FROM "post_tags"`)). WithArgs(sqlmock.AnyArg()). WillReturnRows(sqlmock.NewRows([]string{"post_id", "tag_id"}). AddRow(1, 1)) tag.SelectMock(mock, tag.Data, 1) mock.ExpectBegin() medium.SelectWithSpace(mock) format.SelectMock(mock, 1, 1) mock.ExpectQuery(`INSERT INTO "posts"`). WithArgs(test.AnyTime{}, test.AnyTime{}, nil, 1, 1, Data["title"], Data["subtitle"], Data["slug"], Data["status"], Data["is_page"], Data["excerpt"], Data["description"], Data["html_description"], Data["is_featured"], Data["is_sticky"], Data["is_highlighted"], Data["format_id"], nil, 1, nil, Data["featured_medium_id"]). WillReturnError(errors.New("cannot create post")) mock.ExpectRollback() e.POST(templatePath). WithHeaders(headers). WithJSON(templateData). Expect(). Status(http.StatusInternalServerError) test.ExpectationsMet(t, mock) }) }
explode_data.jsonl/26266
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1345 }
[ 2830, 3393, 4133, 7275, 4021, 1155, 353, 8840, 836, 8, 1476, 77333, 1669, 1273, 39820, 11571, 3506, 2822, 18185, 24664, 5475, 741, 16867, 728, 377, 10166, 480, 78007, 2822, 18185, 5475, 1669, 54320, 70334, 7121, 5475, 21656, 19983, 26653, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestRepositoriesService_ListTrafficReferrers(t *testing.T) { client, mux, _, teardown := setup() defer teardown() mux.HandleFunc("/repos/o/r/traffic/popular/referrers", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "GET") fmt.Fprintf(w, `[{ "referrer": "Google", "count": 4, "uniques": 3 }]`) }) ctx := context.Background() got, resp, err := client.Repositories.ListTrafficReferrers(ctx, "o", "r") if err != nil { t.Errorf("Repositories.ListTrafficReferrers returned error: %+v", err) } want := []*TrafficReferrer{{ Referrer: String("Google"), Count: Int(4), Uniques: Int(3), }} if !reflect.DeepEqual(got, want) { t.Errorf("Repositories.ListTrafficReferrers returned %+v, want %+v", got, want) } // Test s.client.NewRequest failure client.BaseURL.Path = "" got, resp, err = client.Repositories.ListTrafficReferrers(ctx, "o", "r") if got != nil { t.Errorf("client.BaseURL.Path='' ListTrafficReferrers = %#v, want nil", got) } if resp != nil { t.Errorf("client.BaseURL.Path='' ListTrafficReferrers resp = %#v, want nil", resp) } if err == nil { t.Error("client.BaseURL.Path='' ListTrafficReferrers err = nil, want error") } // Test s.client.Do failure client.BaseURL.Path = "/api-v3/" client.rateLimits[0].Reset.Time = time.Now().Add(10 * time.Minute) got, resp, err = client.Repositories.ListTrafficReferrers(ctx, "o", "r") if got != nil { t.Errorf("rate.Reset.Time > now ListTrafficReferrers = %#v, want nil", got) } if want := http.StatusForbidden; resp == nil || resp.Response.StatusCode != want { t.Errorf("rate.Reset.Time > now ListTrafficReferrers resp = %#v, want StatusCode=%v", resp.Response, want) } if err == nil { t.Error("rate.Reset.Time > now ListTrafficReferrers err = nil, want error") } }
explode_data.jsonl/51021
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 711 }
[ 2830, 3393, 44814, 1860, 27104, 87229, 3945, 615, 388, 1155, 353, 8840, 836, 8, 341, 25291, 11, 59807, 11, 8358, 49304, 1669, 6505, 741, 16867, 49304, 2822, 2109, 2200, 63623, 4283, 68354, 20271, 7382, 14, 53987, 91275, 1276, 55763, 615, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_DrawingObjects_RenderDrawingObject(t *testing.T) { config := ReadConfiguration(t) client, ctx := PrepareTest(t, config) remoteDataFolder := remoteBaseTestDataFolder + "/DocumentElements/DrawingObjectss" localFile := "Common/test_multi_pages.docx" remoteFileName := "TestGetDocumentDrawingObjectByIndexWithFormat.docx" UploadNextFileToStorage(t, ctx, client, GetLocalFile(localFile), remoteDataFolder + "/" + remoteFileName) options := map[string]interface{}{ "nodePath": "sections/0", "folder": remoteDataFolder, } _, err := client.WordsApi.RenderDrawingObject(ctx, remoteFileName, "png", int32(0), options) if err != nil { t.Error(err) } }
explode_data.jsonl/60049
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 265 }
[ 2830, 3393, 1557, 1696, 11543, 42102, 37437, 1190, 1155, 353, 8840, 836, 8, 341, 262, 2193, 1669, 4457, 7688, 1155, 340, 262, 2943, 11, 5635, 1669, 31166, 2271, 1155, 11, 2193, 340, 262, 8699, 1043, 13682, 1669, 8699, 3978, 83920, 13682...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestReadingsByTimeRange(t *testing.T) { dic := mocks.NewMockDIC() dbClientMock := &dbMock.DBClient{} dbClientMock.On("ReadingsByTimeRange", 0, 100, 0, 10).Return([]models.Reading{}, nil) dic.Update(di.ServiceConstructorMap{ container.DBClientInterfaceName: func(get di.Get) interface{} { return dbClientMock }, }) rc := NewReadingController(dic) assert.NotNil(t, rc) tests := []struct { name string start string end string offset string limit string errorExpected bool expectedCount int expectedStatusCode int }{ {"Valid - with proper start/end/offset/limit", "0", "100", "0", "10", false, 0, http.StatusOK}, {"Invalid - invalid start format", "aaa", "100", "0", "10", true, 0, http.StatusBadRequest}, {"Invalid - invalid end format", "0", "bbb", "0", "10", true, 0, http.StatusBadRequest}, {"Invalid - empty start", "", "100", "0", "10", true, 0, http.StatusBadRequest}, {"Invalid - empty end", "0", "", "0", "10", true, 0, http.StatusBadRequest}, {"Invalid - end before start", "10", "0", "0", "10", true, 0, http.StatusBadRequest}, {"Invalid - invalid offset format", "0", "100", "aaa", "10", true, 0, http.StatusBadRequest}, {"Invalid - invalid limit format", "0", "100", "0", "aaa", true, 0, http.StatusBadRequest}, } for _, testCase := range tests { t.Run(testCase.name, func(t *testing.T) { req, err := http.NewRequest(http.MethodGet, common.ApiReadingByTimeRangeRoute, http.NoBody) query := req.URL.Query() query.Add(common.Offset, testCase.offset) query.Add(common.Limit, testCase.limit) req.URL.RawQuery = query.Encode() req = mux.SetURLVars(req, map[string]string{common.Start: testCase.start, common.End: testCase.end}) require.NoError(t, err) // Act recorder := httptest.NewRecorder() handler := http.HandlerFunc(rc.ReadingsByTimeRange) handler.ServeHTTP(recorder, req) // Assert if testCase.errorExpected { var res commonDTO.BaseResponse err = json.Unmarshal(recorder.Body.Bytes(), &res) require.NoError(t, err) assert.Equal(t, common.ApiVersion, res.ApiVersion, "API Version not as expected") assert.Equal(t, testCase.expectedStatusCode, recorder.Result().StatusCode, "HTTP status code not as expected") assert.Equal(t, testCase.expectedStatusCode, int(res.StatusCode), "Response status code not as expected") assert.NotEmpty(t, res.Message, "Response message doesn't contain the error message") } else { var res responseDTO.MultiReadingsResponse err = json.Unmarshal(recorder.Body.Bytes(), &res) require.NoError(t, err) assert.Equal(t, common.ApiVersion, res.ApiVersion, "API Version not as expected") assert.Equal(t, testCase.expectedStatusCode, recorder.Result().StatusCode, "HTTP status code not as expected") assert.Equal(t, testCase.expectedStatusCode, int(res.StatusCode), "Response status code not as expected") assert.Equal(t, testCase.expectedCount, len(res.Readings), "Device count not as expected") assert.Empty(t, res.Message, "Message should be empty when it is successful") } }) } }
explode_data.jsonl/22700
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1206 }
[ 2830, 3393, 4418, 819, 1359, 1462, 6046, 1155, 353, 8840, 836, 8, 341, 2698, 292, 1669, 68909, 7121, 11571, 93161, 741, 20939, 2959, 11571, 1669, 609, 1999, 11571, 22537, 2959, 16094, 20939, 2959, 11571, 8071, 445, 4418, 819, 1359, 1462, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_SqlDatabaseContainerTrigger_WhenConvertedToHub_RoundTripsWithoutLoss(t *testing.T) { t.Parallel() parameters := gopter.DefaultTestParameters() parameters.MaxSize = 10 properties := gopter.NewProperties(parameters) properties.Property( "Round trip from SqlDatabaseContainerTrigger to hub returns original", prop.ForAll(RunResourceConversionTestForSqlDatabaseContainerTrigger, SqlDatabaseContainerTriggerGenerator())) properties.TestingRun(t, gopter.NewFormatedReporter(false, 240, os.Stdout)) }
explode_data.jsonl/18740
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 153 }
[ 2830, 3393, 1098, 1470, 5988, 4502, 17939, 62, 4498, 61941, 1249, 19316, 2568, 795, 21884, 1690, 26040, 39838, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 741, 67543, 1669, 728, 73137, 13275, 2271, 9706, 741, 67543, 14535, 1695, 284,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestDefinitionContentIndent(t *testing.T) { src := ` Parameters ---------- x : int a b c d s2 -- y : z ` expected := ` Doc Section[Parameters] Definition Text[x] Text[int] Paragraph Text[a b] Paragraph Text[c] Definition Text[d] Section[s2] Paragraph Text[y : z] ` assertParse(t, expected, src) }
explode_data.jsonl/21268
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 166 }
[ 2830, 3393, 10398, 2762, 42729, 1155, 353, 8840, 836, 8, 341, 41144, 1669, 22074, 9706, 198, 68303, 87, 549, 526, 271, 220, 264, 198, 262, 293, 271, 220, 272, 198, 67, 198, 82, 17, 198, 7088, 88, 549, 1147, 198, 3989, 42400, 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...
1
func TestResetSessionTimer_Fault(t *testing.T) { dir1, s1 := testServer(t) defer os.RemoveAll(dir1) defer s1.Shutdown() testutil.WaitForLeader(t, s1.RPC, "dc1") // Should not exist err := s1.resetSessionTimer("nope", nil) if err == nil || !strings.Contains(err.Error(), "not found") { t.Fatalf("err: %v", err) } // Create a session state := s1.fsm.State() state.EnsureNode(1, structs.Node{"foo", "127.0.0.1"}) session := &structs.Session{ ID: generateUUID(), Node: "foo", TTL: "10s", } if err := state.SessionCreate(100, session); err != nil { t.Fatalf("err: %v", err) } // Reset the session timer err = s1.resetSessionTimer(session.ID, nil) if err != nil { t.Fatalf("err: %v", err) } // Check that we have a timer _, ok := s1.sessionTimers[session.ID] if !ok { t.Fatalf("missing session timer") } }
explode_data.jsonl/73911
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 357 }
[ 2830, 3393, 14828, 5283, 10105, 1400, 945, 1155, 353, 8840, 836, 8, 341, 48532, 16, 11, 274, 16, 1669, 1273, 5475, 1155, 340, 16867, 2643, 84427, 14161, 16, 340, 16867, 274, 16, 10849, 18452, 2822, 18185, 1314, 99153, 52621, 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...
6
func TestApplyTemplateOverrideOperationID(t *testing.T) { newFile := func() *descriptor.File { msgdesc := &descriptorpb.DescriptorProto{ Name: proto.String("ExampleMessage"), } meth := &descriptorpb.MethodDescriptorProto{ Name: proto.String("Example"), InputType: proto.String("ExampleMessage"), OutputType: proto.String("ExampleMessage"), Options: &descriptorpb.MethodOptions{}, } svc := &descriptorpb.ServiceDescriptorProto{ Name: proto.String("ExampleService"), Method: []*descriptorpb.MethodDescriptorProto{meth}, } msg := &descriptor.Message{ DescriptorProto: msgdesc, } return &descriptor.File{ FileDescriptorProto: &descriptorpb.FileDescriptorProto{ SourceCodeInfo: &descriptorpb.SourceCodeInfo{}, Name: proto.String("example.proto"), Package: proto.String("example"), MessageType: []*descriptorpb.DescriptorProto{msgdesc}, Service: []*descriptorpb.ServiceDescriptorProto{svc}, Options: &descriptorpb.FileOptions{ GoPackage: proto.String("github.com/grpc-ecosystem/grpc-gateway/runtime/internal/examplepb;example"), }, }, GoPkg: descriptor.GoPackage{ Path: "example.com/path/to/example/example.pb", Name: "example_pb", }, Messages: []*descriptor.Message{msg}, Services: []*descriptor.Service{ { ServiceDescriptorProto: svc, Methods: []*descriptor.Method{ { MethodDescriptorProto: meth, RequestType: msg, ResponseType: msg, Bindings: []*descriptor.Binding{ { HTTPMethod: "GET", Body: &descriptor.Body{FieldPath: nil}, PathTmpl: httprule.Template{ Version: 1, OpCodes: []int{0, 0}, Template: "/v1/echo", // TODO(achew22): Figure out what this should really be }, }, }, }, }, }, }, } } verifyTemplateFromReq := func(t *testing.T, reg *descriptor.Registry, file *descriptor.File, opts *openapiconfig.OpenAPIOptions) { if err := AddErrorDefs(reg); err != nil { t.Errorf("AddErrorDefs(%#v) failed with %v; want success", reg, err) return } fileCL := crossLinkFixture(file) err := reg.Load(reqFromFile(fileCL)) if err != nil { t.Errorf("reg.Load(%#v) failed with %v; want success", *file, err) return } if opts != nil { if err := reg.RegisterOpenAPIOptions(opts); err != nil { t.Fatalf("failed to register OpenAPI options: %s", err) } } result, err := applyTemplate(param{File: fileCL, reg: reg}) if err != nil { t.Errorf("applyTemplate(%#v) failed with %v; want success", *file, err) return } if want, is := "MyExample", result.Paths["/v1/echo"].Get.OperationID; !reflect.DeepEqual(is, want) { t.Errorf("applyTemplate(%#v).Paths[0].Get.OperationID = %s want to be %s", *file, is, want) } // If there was a failure, print out the input and the json result for debugging. if t.Failed() { t.Errorf("had: %s", *file) t.Errorf("got: %s", fmt.Sprint(result)) } } openapiOperation := openapi_options.Operation{ OperationId: "MyExample", } t.Run("verify override via method option", func(t *testing.T) { file := newFile() proto.SetExtension(proto.Message(file.Services[0].Methods[0].MethodDescriptorProto.Options), openapi_options.E_Openapiv2Operation, &openapiOperation) reg := descriptor.NewRegistry() verifyTemplateFromReq(t, reg, file, nil) }) t.Run("verify override options annotations", func(t *testing.T) { file := newFile() reg := descriptor.NewRegistry() opts := &openapiconfig.OpenAPIOptions{ Method: []*openapiconfig.OpenAPIMethodOption{ { Method: "example.ExampleService.Example", Option: &openapiOperation, }, }, } verifyTemplateFromReq(t, reg, file, opts) }) }
explode_data.jsonl/32789
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1660 }
[ 2830, 3393, 28497, 7275, 2177, 8432, 915, 1155, 353, 8840, 836, 8, 341, 8638, 1703, 1669, 2915, 368, 353, 53132, 8576, 341, 197, 21169, 8614, 1669, 609, 53132, 16650, 23548, 6820, 31549, 515, 298, 21297, 25, 18433, 6431, 445, 13314, 205...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestGetDomainsForUser(t *testing.T) { e, _ := NewEnforcer("examples/rbac_with_domains_model.conf", "examples/rbac_with_domains_policy2.csv") testGetDomainsForUser(t, e, []string{"domain1", "domain2"}, "alice") testGetDomainsForUser(t, e, []string{"domain2", "domain3"}, "bob") testGetDomainsForUser(t, e, []string{"domain3"}, "user") }
explode_data.jsonl/65635
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 135 }
[ 2830, 3393, 1949, 74713, 2461, 1474, 1155, 353, 8840, 836, 8, 341, 7727, 11, 716, 1669, 1532, 1702, 82010, 445, 51668, 7382, 55877, 6615, 70199, 5047, 13937, 497, 330, 51668, 7382, 55877, 6615, 70199, 22773, 17, 11219, 5130, 18185, 1949, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestParseErrMirBSDKornConfirm(t *testing.T) { if testing.Short() { t.Skip("calling mksh is slow.") } if !hasMksh55 { t.Skip("mksh required to run") } i := 0 for _, c := range shellTests { want := c.common if c.bsmk != nil { want = c.bsmk } if c.mksh != nil { want = c.mksh } if want == nil { continue } wantErr := !strings.Contains(want.(string), " #NOERR") t.Run(fmt.Sprintf("%03d", i), confirmParse(c.in, "mksh", wantErr)) i++ } }
explode_data.jsonl/31435
{ "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, 14463, 7747, 58461, 30029, 42, 1512, 16728, 1155, 353, 8840, 836, 8, 341, 743, 7497, 55958, 368, 341, 197, 3244, 57776, 445, 73726, 23789, 927, 374, 6301, 13053, 197, 532, 743, 753, 4648, 44, 74, 927, 20, 20, 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, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
7
func TestMultiStageDockerBuild(t *testing.T) { f := newIBDFixture(t, k8s.EnvGKE) defer f.TearDown() manifest := NewSanchoDockerBuildMultiStageManifest(f) _, err := f.ibd.BuildAndDeploy(f.ctx, f.st, buildTargets(manifest), store.BuildStateSet{}) if err != nil { t.Fatal(err) } assert.Equal(t, 2, f.docker.BuildCount) assert.Equal(t, 1, f.docker.PushCount) assert.Equal(t, 0, f.kl.loadCount) expected := expectedFile{ Path: "Dockerfile", Contents: ` FROM sancho-base:tilt-11cd0b38bc3ceb95 ADD . . RUN go install github.com/tilt-dev/sancho ENTRYPOINT /go/bin/sancho `, } testutils.AssertFileInTar(t, tar.NewReader(f.docker.BuildContext), expected) }
explode_data.jsonl/38259
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 289 }
[ 2830, 3393, 20358, 19398, 35, 13659, 11066, 1155, 353, 8840, 836, 8, 341, 1166, 1669, 501, 3256, 5262, 12735, 1155, 11, 595, 23, 82, 81214, 38, 3390, 340, 16867, 282, 836, 682, 4454, 2822, 197, 42315, 1669, 1532, 23729, 958, 35, 13659...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func Test_DeleteNode_Positive_NodeDoesntExist(t *testing.T) { // Arrange volumePluginMgr, _ := controllervolumetesting.GetTestVolumePluginMgr((t)) dsw := NewDesiredStateOfWorld(volumePluginMgr) notAddedNodeName := "node-not-added-name" // Act err := dsw.DeleteNode(notAddedNodeName) // Assert if err != nil { t.Fatalf("DeleteNode failed. Expected: <no error> Actual: <%v>", err) } nodeExists := dsw.NodeExists(notAddedNodeName) if nodeExists { t.Fatalf("Deleted node %q still exists, it should not.", notAddedNodeName) } volumesToAttach := dsw.GetVolumesToAttach() if len(volumesToAttach) != 0 { t.Fatalf("len(volumesToAttach) Expected: <0> Actual: <%v>", len(volumesToAttach)) } }
explode_data.jsonl/40741
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 270 }
[ 2830, 3393, 57418, 1955, 44246, 3404, 41340, 21468, 406, 25613, 1155, 353, 8840, 836, 8, 341, 197, 322, 40580, 198, 5195, 4661, 11546, 25567, 11, 716, 1669, 683, 1100, 648, 1132, 57824, 287, 2234, 2271, 18902, 11546, 25567, 1188, 83, 11...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
4
func TestEncodeMetric(t *testing.T) { exporter := registerExporter() const prefix = testNodeStr + ` "metrics":[` const suffix = `]}` tests := []struct { name string run func(ctx context.Context) want string }{ { name: "HistogramFloat64, HistogramInt64", run: func(ctx context.Context) { ctx = event.Label(ctx, keyMethod.Of("godoc.ServeHTTP")) event.Metric(ctx, latencyMs.Of(96.58)) ctx = event.Label(ctx, keys.Err.Of(errors.New("panic: fatal signal"))) event.Metric(ctx, bytesIn.Of(97e2)) }, want: prefix + ` { "metric_descriptor": { "name": "latency_ms", "description": "The latency of calls in milliseconds", "type": 6, "label_keys": [ { "key": "method" }, { "key": "route" } ] }, "timeseries": [ { "start_timestamp": "1970-01-01T00:00:00Z", "points": [ { "timestamp": "1970-01-01T00:00:40Z", "distributionValue": { "count": 1, "sum": 96.58, "bucket_options": { "explicit": { "bounds": [ 0, 5, 10, 25, 50 ] } }, "buckets": [ {}, {}, {}, {}, {} ] } } ] } ] }, { "metric_descriptor": { "name": "latency_ms", "description": "The latency of calls in milliseconds", "type": 6, "label_keys": [ { "key": "method" }, { "key": "route" } ] }, "timeseries": [ { "start_timestamp": "1970-01-01T00:00:00Z", "points": [ { "timestamp": "1970-01-01T00:00:40Z", "distributionValue": { "count": 1, "sum": 9700, "bucket_options": { "explicit": { "bounds": [ 0, 10, 50, 100, 500, 1000, 2000 ] } }, "buckets": [ {}, {}, {}, {}, {}, {}, {} ] } } ] } ] }` + suffix, }, } ctx := context.TODO() for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { tt.run(ctx) got := exporter.Output("/v1/metrics") checkJSON(t, got, []byte(tt.want)) }) } }
explode_data.jsonl/14051
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1550 }
[ 2830, 3393, 32535, 54310, 1155, 353, 8840, 836, 8, 341, 59440, 261, 1669, 4161, 88025, 741, 4777, 9252, 284, 1273, 1955, 2580, 488, 22074, 197, 1, 43262, 8899, 3989, 4777, 20525, 284, 1565, 13989, 3989, 78216, 1669, 3056, 1235, 341, 197...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestReadRecordNewline(t *testing.T) { // Define the basic test we plan to repeat. allRecords := []string{"X", "Word", "More than one word", "", "More text"} allRecordsStr := strings.Join(allRecords, "\n") scr := NewScript() doTest := func() { scr.input = bufio.NewReader(strings.NewReader(allRecordsStr)) scr.SetRS("\n") scr.rsScanner = bufio.NewScanner(scr.input) scr.rsScanner.Split(scr.makeRecordSplitter()) for _, oneRecord := range allRecords { rec, err := scr.readRecord() if err != nil { t.Fatal(err) } if rec != oneRecord { t.Fatalf("Expected %q but received %q", oneRecord, rec) } } } // Test with no trailing newline. doTest() // Test with a trailing newline. allRecordsStr += "\n" doTest() }
explode_data.jsonl/2995
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 306 }
[ 2830, 3393, 4418, 6471, 3564, 1056, 1155, 353, 8840, 836, 8, 341, 197, 322, 18614, 279, 6770, 1273, 582, 3119, 311, 13153, 624, 50960, 25876, 1669, 3056, 917, 4913, 55, 497, 330, 10879, 497, 330, 7661, 1091, 825, 3409, 497, 7342, 330,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
4
func TestGetGatewayStats(t *testing.T) { assert := assert.New(t) lat := float64(1.123) long := float64(2.123) alti := int32(33) now := time.Now().Truncate(time.Second) ecNow := ExpandedTime(now) pbTime, err := ptypes.TimestampProto(now) assert.Nil(err) testTable := []struct { PushDataPacket PushDataPacket GatewayStats *gw.GatewayStats }{ { PushDataPacket: PushDataPacket{ ProtocolVersion: ProtocolVersion2, Payload: PushDataPayload{}, }, GatewayStats: nil, }, { PushDataPacket: PushDataPacket{ ProtocolVersion: ProtocolVersion2, GatewayMAC: lorawan.EUI64{1, 2, 3, 4, 5, 6, 7, 8}, Payload: PushDataPayload{ Stat: &Stat{ Time: ecNow, Long: long, Lati: lat, Alti: alti, RXNb: 1, RXOK: 2, RXFW: 3, ACKR: 4, DWNb: 5, TXNb: 6, }, }, }, GatewayStats: &gw.GatewayStats{ GatewayId: []byte{1, 2, 3, 4, 5, 6, 7, 8}, Time: pbTime, Location: &common.Location{ Latitude: 1.123, Longitude: 2.123, Altitude: 33, Source: common.LocationSource_GPS, }, RxPacketsReceived: 1, RxPacketsReceivedOk: 2, TxPacketsReceived: 5, TxPacketsEmitted: 6, }, }, { PushDataPacket: PushDataPacket{ ProtocolVersion: ProtocolVersion2, GatewayMAC: lorawan.EUI64{1, 2, 3, 4, 5, 6, 7, 8}, Payload: PushDataPayload{ Stat: &Stat{ Time: ecNow, RXNb: 1, RXOK: 2, RXFW: 3, ACKR: 4, DWNb: 5, TXNb: 6, }, }, }, GatewayStats: &gw.GatewayStats{ GatewayId: []byte{1, 2, 3, 4, 5, 6, 7, 8}, Time: pbTime, RxPacketsReceived: 1, RxPacketsReceivedOk: 2, TxPacketsReceived: 5, TxPacketsEmitted: 6, }, }, } for _, test := range testTable { s, err := test.PushDataPacket.GetGatewayStats() assert.Nil(err) if s != nil { assert.Len(s.StatsId, 16) s.StatsId = nil } assert.Equal(test.GatewayStats, s) } }
explode_data.jsonl/65733
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1115 }
[ 2830, 3393, 1949, 40709, 16635, 1155, 353, 8840, 836, 8, 341, 6948, 1669, 2060, 7121, 1155, 692, 197, 5524, 1669, 2224, 21, 19, 7, 16, 13, 16, 17, 18, 340, 17514, 1669, 2224, 21, 19, 7, 17, 13, 16, 17, 18, 340, 197, 3145, 72, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestEtcdGetEndpoints(t *testing.T) { ctx := api.NewDefaultContext() fakeClient := tools.NewFakeEtcdClient(t) registry := NewTestEtcdRegistry(fakeClient) endpoints := &api.Endpoints{ TypeMeta: api.TypeMeta{ID: "foo"}, Endpoints: []string{"127.0.0.1:34855"}, } key, _ := makeServiceEndpointsKey(ctx, "foo") fakeClient.Set(key, runtime.EncodeOrDie(latest.Codec, endpoints), 0) got, err := registry.GetEndpoints(ctx, "foo") if err != nil { t.Errorf("unexpected error: %v", err) } if e, a := endpoints, got; !reflect.DeepEqual(e, a) { t.Errorf("Unexpected endpoints: %#v, expected %#v", e, a) } }
explode_data.jsonl/8173
{ "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, 31860, 4385, 1949, 80786, 1155, 353, 8840, 836, 8, 341, 20985, 1669, 6330, 7121, 3675, 1972, 741, 1166, 726, 2959, 1669, 7375, 7121, 52317, 31860, 4385, 2959, 1155, 340, 197, 29172, 1669, 1532, 2271, 31860, 4385, 15603, 74138,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestCreatePatchExecution(t *testing.T) { namespace := "test" testCase := struct { Name string Job v1alpha1.Job operation patchOperation }{ Name: "patch default task name", Job: v1alpha1.Job{ ObjectMeta: metav1.ObjectMeta{ Name: "path-task-name", Namespace: namespace, }, Spec: v1alpha1.JobSpec{ MinAvailable: 1, Tasks: []v1alpha1.TaskSpec{ { Replicas: 1, Template: v1.PodTemplateSpec{ ObjectMeta: metav1.ObjectMeta{ Labels: map[string]string{"name": "test"}, }, Spec: v1.PodSpec{ Containers: []v1.Container{ { Name: "fake-name", Image: "busybox:1.24", }, }, }, }, }, { Replicas: 1, Template: v1.PodTemplateSpec{ ObjectMeta: metav1.ObjectMeta{ Labels: map[string]string{"name": "test"}, }, Spec: v1.PodSpec{ Containers: []v1.Container{ { Name: "fake-name", Image: "busybox:1.24", }, }, }, }, }, }, }, }, operation: patchOperation{ Op: "replace", Path: "/spec/tasks", Value: []v1alpha1.TaskSpec{ { Name: v1alpha1.DefaultTaskSpec + "0", Replicas: 1, Template: v1.PodTemplateSpec{ ObjectMeta: metav1.ObjectMeta{ Labels: map[string]string{"name": "test"}, }, Spec: v1.PodSpec{ Containers: []v1.Container{ { Name: "fake-name", Image: "busybox:1.24", }, }, }, }, }, { Name: v1alpha1.DefaultTaskSpec + "1", Replicas: 1, Template: v1.PodTemplateSpec{ ObjectMeta: metav1.ObjectMeta{ Labels: map[string]string{"name": "test"}, }, Spec: v1.PodSpec{ Containers: []v1.Container{ { Name: "fake-name", Image: "busybox:1.24", }, }, }, }, }, }, }, } ret := mutateSpec(testCase.Job.Spec.Tasks, "/spec/tasks") if ret.Path != testCase.operation.Path || ret.Op != testCase.operation.Op { t.Errorf("testCase %s's expected patch operation %v, but got %v", testCase.Name, testCase.operation, *ret) } actualTasks, ok := ret.Value.([]v1alpha1.TaskSpec) if !ok { t.Errorf("testCase '%s' path value expected to be '[]v1alpha1.TaskSpec', but negative", testCase.Name) } expectedTasks, _ := testCase.operation.Value.([]v1alpha1.TaskSpec) for index, task := range expectedTasks { aTask := actualTasks[index] if aTask.Name != task.Name { t.Errorf("testCase '%s's expected patch operation with value %v, but got %v", testCase.Name, testCase.operation.Value, ret.Value) } } }
explode_data.jsonl/18914
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1413 }
[ 2830, 3393, 4021, 43622, 20294, 1155, 353, 8840, 836, 8, 1476, 56623, 1669, 330, 1944, 1837, 18185, 4207, 1669, 2036, 341, 197, 21297, 414, 914, 198, 197, 197, 12245, 981, 348, 16, 7141, 16, 45293, 198, 197, 197, 9262, 10900, 8432, 19...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
6
func TestPrepareTaskRequestEnvironment_Isolate(t *testing.T) { t.Parallel() Convey(`Make sure we can process InputsRef for Isolate`, t, func() { c := reproduceRun{} c.init(&testAuthFlags{}) // Use TempDir, which creates a temp directory, to return a unique directory namme // that prepareTaskRequestEnvironment() will remove and recreate (via prepareDir()) c.work = t.TempDir() ctx := context.Background() ctxBaseEnvMap := environ.System() ctx = ctxBaseEnvMap.SetInCtx(ctx) expectedEnvMap := ctxBaseEnvMap.Clone() var fetchedIsolateFiles bool properties := &swarming.SwarmingRpcsTaskProperties{ Command: []string{"rbd", "stream", "-test-id-prefix", "chicken://chicken_chicken/"}, InputsRef: &swarming.SwarmingRpcsFilesRef{ Isolated: "isolated", }, } service := &testService{ filesFromIsolate: func(_ context.Context, _ string, _ *swarming.SwarmingRpcsFilesRef) ([]string, error) { fetchedIsolateFiles = true return []string{}, nil }, } cmd, err := c.prepareTaskRequestEnvironment(ctx, properties, service) So(err, ShouldBeNil) expected := exec.CommandContext(ctx, "rbd", "stream", "-test-id-prefix", "chicken://chicken_chicken/") expected.Dir = c.work expected.Stdout = os.Stdout expected.Stderr = os.Stderr expected.Env = expectedEnvMap.Sorted() So(cmd, ShouldResemble, expected) So(fetchedIsolateFiles, ShouldBeTrue) }) }
explode_data.jsonl/74871
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 519 }
[ 2830, 3393, 50590, 6262, 1900, 12723, 31879, 33066, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 741, 93070, 5617, 5809, 8078, 2704, 582, 646, 1882, 46281, 3945, 369, 2160, 33066, 7808, 259, 11, 2915, 368, 341, 197, 1444, 1669, 2280...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestClientCategoryRegisterError(t *testing.T) { auth, _ := base.TenancyWithLoginTester(t) defer base.BaseLogOut(auth) msg := "Key: 'ProductCategory.BaseProductCategory.CateName' Error:Field validation for 'CateName' failed on the 'required' tag" cateId, _ := ClientCreateCategory(auth, "", 0, http.StatusBadRequest, msg) if cateId == 0 { return } defer DeleteClientCategory(auth, cateId, http.StatusOK, "删除成功") }
explode_data.jsonl/57464
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 154 }
[ 2830, 3393, 2959, 6746, 8690, 1454, 1155, 353, 8840, 836, 8, 341, 78011, 11, 716, 1669, 2331, 836, 268, 6572, 2354, 6231, 58699, 1155, 340, 16867, 2331, 13018, 2201, 2662, 27435, 692, 21169, 1669, 330, 1592, 25, 364, 4816, 6746, 13018, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestIssue9325(t *testing.T) { store, clean := testkit.CreateMockStore(t) defer clean() tk := testkit.NewTestKit(t, store) tk.MustExec("use test") tk.MustExec("drop table if exists t") tk.MustExec("create table t(a timestamp) partition by range(unix_timestamp(a)) (partition p0 values less than(unix_timestamp('2019-02-16 14:20:00')), partition p1 values less than (maxvalue))") tk.MustExec("insert into t values('2019-02-16 14:19:59'), ('2019-02-16 14:20:01')") result := tk.MustQuery("select * from t where a between timestamp'2019-02-16 14:19:00' and timestamp'2019-02-16 14:21:00'") require.Len(t, result.Rows(), 2) tk.MustExec("drop table if exists t") tk.MustExec("create table t(a timestamp)") tk.MustExec("insert into t values('2019-02-16 14:19:59'), ('2019-02-16 14:20:01')") result = tk.MustQuery("select * from t where a < timestamp'2019-02-16 14:21:00'") result.Check(testkit.Rows("2019-02-16 14:19:59", "2019-02-16 14:20:01")) }
explode_data.jsonl/65478
{ "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, 42006, 24, 18, 17, 20, 1155, 353, 8840, 836, 8, 341, 57279, 11, 4240, 1669, 1273, 8226, 7251, 11571, 6093, 1155, 340, 16867, 4240, 2822, 3244, 74, 1669, 1273, 8226, 7121, 2271, 7695, 1155, 11, 3553, 340, 3244, 74, 50463, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestParams(t *testing.T) { app := New() app.Get("/user/:name/pet/:pet", func(w http.ResponseWriter, r *http.Request) { name := r.URL.Query().Get(":name") pet := r.URL.Query().Get(":pet") fmt.Fprint(w, "user %s's pet %s", name, pet) }) s := httptest.NewServer(app) NewRequest(s.URL). Get("/user/tobi/pet/loki"). Expect(200, "user tobi's pet loki") }
explode_data.jsonl/48217
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 166 }
[ 2830, 3393, 4870, 1155, 353, 8840, 836, 8, 341, 28236, 1669, 1532, 2822, 28236, 2234, 4283, 872, 11315, 606, 4322, 295, 11315, 6862, 497, 2915, 3622, 1758, 37508, 11, 435, 353, 1254, 9659, 8, 341, 197, 11609, 1669, 435, 20893, 15685, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestLoadFromEnv(t *testing.T) { assert.Equal(t, "MICRO_SERVICE_DRIVER", toUnderscoreUpper("MicroService_Driver")) ms := MicroService{} os.Setenv("T_DRIVER", "d1") loadFromEnv("T", &ms) assert.Equal(t, "d1", ms.Driver) }
explode_data.jsonl/24518
{ "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, 5879, 3830, 14359, 1155, 353, 8840, 836, 8, 341, 6948, 12808, 1155, 11, 330, 54961, 1285, 21590, 44042, 497, 311, 19957, 388, 2153, 14251, 445, 34609, 1860, 1557, 5469, 28075, 47691, 1669, 18157, 1860, 16094, 25078, 4202, 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...
1
func TestBundleTagHash(t *testing.T) { bid := getBundleID(kahn1dot01) require.Equal(t, kahn1dot0Hash, bid, "hashing the bundle ID twice should be the same") bid2 := getBundleID(kahnlatest) assert.NotEqual(t, kahn1dot0Hash, bid2, "different tags should result in different hashes") }
explode_data.jsonl/56179
{ "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, 8409, 5668, 6370, 1155, 353, 8840, 836, 8, 1476, 2233, 307, 1669, 633, 8409, 915, 5969, 29560, 16, 16119, 15, 16, 340, 17957, 12808, 1155, 11, 595, 29560, 16, 16119, 15, 6370, 11, 14103, 11, 330, 8296, 287, 279, 12894, 3...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestFilterService(t *testing.T) { assert := assert.New(t) rancher := NewRancherMockClient() rancher.AddEnvironment(client.Project{Name: "Default", Resource: client.Resource{Id: "1a5"}}) rancher.AddStack(client.Stack{Name: "mystack", AccountId: "1a5", ServiceIds: []string{"3a1", "3a2"}}) service1 := client.Service{Name: "service1", AccountId: "1a5", Resource: client.Resource{Id: "3a1"}, LaunchConfig: &client.LaunchConfig{Labels: map[string]interface{}{"monitor": "true"}}} service2 := client.Service{Name: "service2", AccountId: "1a5", Resource: client.Resource{Id: "3a2"}, LaunchConfig: &client.LaunchConfig{Labels: map[string]interface{}{"monitor": "false"}}, System: true} assert.True(filterService(rancher, service1, "")) assert.True(filterService(rancher, service1, "*")) assert.False(filterService(rancher, service1, "blub")) assert.True(filterService(rancher, service1, "%STACK=mystack")) assert.False(filterService(rancher, service1, "%STACK=anotherstack")) assert.True(filterService(rancher, service1, "monitor=true")) assert.False(filterService(rancher, service1, "monitor=whatever")) assert.True(filterService(rancher, service1, "%ENV=Default")) assert.False(filterService(rancher, service1, "%ENV=another")) assert.False(filterService(rancher, service1, "%SYSTEM")) assert.True(filterService(rancher, service2, "")) assert.False(filterService(rancher, service2, "monitor=true")) assert.True(filterService(rancher, service2, "%SYSTEM")) assert.False(filterService(rancher, service2, "-%SYSTEM")) }
explode_data.jsonl/48866
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 533 }
[ 2830, 3393, 5632, 1860, 1155, 353, 8840, 836, 8, 1476, 6948, 1669, 2060, 7121, 1155, 340, 7000, 3497, 261, 1669, 1532, 49, 3497, 261, 11571, 2959, 2822, 7000, 3497, 261, 1904, 12723, 12805, 30944, 63121, 25, 330, 3675, 497, 11765, 25, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestOrderRegistry(t *testing.T) { orderID := "fake-order-id" response := order.SubmitResponse{ OrderID: orderID, IsOrderPlaced: true, } r := NewOrderRegistry() r.Store("ftx", response, nil) orderValue, _ := r.GetOrderValue("ftx", orderID) if orderValue.SubmitResponse.OrderID != orderID { t.Logf("error should %s, but got %s\n", orderID, orderValue.SubmitResponse.OrderID) } if orderValue.UserData != orderID { t.Logf("error should %s, but got %s\n", orderID, orderValue.SubmitResponse.OrderID) } if r.length != 1 { t.Errorf("Order Registry length count not incremented correctly") t.Failed() } }
explode_data.jsonl/18563
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 239 }
[ 2830, 3393, 4431, 15603, 1155, 353, 8840, 836, 8, 341, 42245, 915, 1669, 330, 30570, 23810, 12897, 698, 21735, 1669, 1973, 98309, 2582, 515, 197, 197, 4431, 915, 25, 981, 1973, 915, 345, 197, 197, 3872, 4431, 2120, 4435, 25, 830, 345,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestEcPointBytesInvalidNumberBytes(t *testing.T) { curve := btcec.S256() for i := 1; i < 64; i++ { data := make([]byte, i) _, err := PointFromBytesUncompressed(curve, data) require.Error(t, err) } for i := 65; i < 128; i++ { data := make([]byte, i) _, err := PointFromBytesUncompressed(curve, data) require.Error(t, err) } }
explode_data.jsonl/75669
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 149 }
[ 2830, 3393, 50730, 2609, 7078, 7928, 2833, 7078, 1155, 353, 8840, 836, 8, 341, 33209, 586, 1669, 19592, 68955, 808, 17, 20, 21, 2822, 2023, 600, 1669, 220, 16, 26, 600, 366, 220, 21, 19, 26, 600, 1027, 341, 197, 8924, 1669, 1281, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestIssue001(t *testing.T) { // 標準入力のダミーデータ userInput := "今日はいい天気ですね" // stdin/パイプ からの入力のモックとリカバリ用関数取得 funcDeferSTDIN := helperfunc.MockSTDIN(t, userInput) defer funcDeferSTDIN() // モックのリカバリ // オプション、フラグなどの引数のモックとリカバリ用関数取得 funcDeferArgs := helperfunc.MockArgs(t, []string{ "--info", "ja", "en", }) defer funcDeferArgs() // モックのリカバリ appTest := app.New("", t.Name()) // 新規アプリ作成。キャッシュ ID はテスト名. defer func() { appTest.Engine.Cache.ClearAll() // 終了後にキャッシュ削除 }() // テスト実行 out := capturer.CaptureOutput(func() { status := appTest.Run() assert.Equal(t, 0, status) }) assert.Contains(t, out, "It's a beautiful day.", "it should contain the translation") assert.Contains(t, out, "残り文字数", "if --info flag was set then it should contain the remain number of chars") }
explode_data.jsonl/48798
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 430 }
[ 2830, 3393, 42006, 15, 15, 16, 1155, 353, 8840, 836, 8, 341, 197, 322, 6567, 101, 247, 101774, 17254, 47534, 15767, 98859, 124486, 24041, 229, 127145, 198, 19060, 2505, 1669, 330, 133165, 126224, 35727, 94121, 128797, 1837, 197, 322, 3136...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestRouting(t *testing.T) { for _, test := range tests { resp := getTestResponse(test.method, test.path, test.body, test.headers, nil) if resp.statusCode != test.expectedStatus { t.Fatalf("%v(%v) expected status %d got %d", test.method, test.path, test.expectedStatus, resp.statusCode) } if resp.body != test.expectedBody { t.Fatalf("%v(%v) expected %q got %q", test.method, test.path, test.expectedBody, resp.body) } if cl, ok := resp.headers["Content-Length"]; ok { clExp, _ := strconv.Atoi(cl[0]) clAct := len(resp.body) if clExp != clAct { t.Fatalf("Content-length doesn't match. expected %d got %d", clExp, clAct) } } mwh, ok := resp.headers["X-Middleware-Hit"] if !ok { t.Fatalf("%v(%v) middleware hit header not set", test.method, test.path) } else if mwh[0] != "true" { t.Fatalf("%v(%v) middleware hit header incorrectly set", test.method, test.path) } } }
explode_data.jsonl/40621
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 529 }
[ 2830, 3393, 24701, 1155, 353, 8840, 836, 8, 341, 262, 369, 8358, 1273, 1669, 2088, 7032, 341, 286, 9039, 1669, 633, 2271, 2582, 8623, 12908, 11, 1273, 3875, 11, 1273, 5079, 11, 1273, 18022, 11, 2092, 692, 286, 421, 9039, 29782, 961, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
8
func TestMatVconcat(t *testing.T) { src := NewMatWithSize(10, 10, MatTypeCV32F) defer src.Close() dst := NewMat() defer dst.Close() Vconcat(src, src, &dst) if dst.Empty() { t.Error("TestMatVconcat dst should not be empty.") } if dst.Rows() != 2*src.Rows() { t.Error("TestMatVconcat dst.Cols should be 2 x src.Rows().") } }
explode_data.jsonl/81745
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 148 }
[ 2830, 3393, 11575, 53, 20164, 1155, 353, 8840, 836, 8, 341, 41144, 1669, 1532, 11575, 2354, 1695, 7, 16, 15, 11, 220, 16, 15, 11, 6867, 929, 19589, 18, 17, 37, 340, 16867, 2286, 10421, 2822, 52051, 1669, 1532, 11575, 741, 16867, 106...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestMultipleDynamicPortForward(t *testing.T) { taskEngine, done, _ := setupWithDefaultConfig(t) defer done() stateChangeEvents := taskEngine.StateChangeEvents() testArn := "testDynamicPortForward2" testTask := createTestTask(testArn) testTask.Containers[0].Image = testRegistryImage testTask.Containers[0].Command = []string{fmt.Sprintf("-l=%d", containerPortOne), "-serve", serverContent, `-loop`} // No HostPort or 0 hostport; docker should pick two ports for us testTask.Containers[0].Ports = []apicontainer.PortBinding{{ContainerPort: containerPortOne}, {ContainerPort: containerPortOne, HostPort: 0}} go taskEngine.AddTask(testTask) event := <-stateChangeEvents assert.Equal(t, event.(api.ContainerStateChange).Status, apicontainerstatus.ContainerRunning, "Expected container to be RUNNING") portBindings := event.(api.ContainerStateChange).PortBindings event = <-stateChangeEvents assert.Equal(t, event.(api.TaskStateChange).Status, apitaskstatus.TaskRunning, "Expected task to be RUNNING") assert.Len(t, portBindings, 2, "could not bind to two ports from one container port", portBindings) var bindingFor24751_1 uint16 var bindingFor24751_2 uint16 for _, binding := range portBindings { if binding.ContainerPort == containerPortOne { if bindingFor24751_1 == 0 { bindingFor24751_1 = binding.HostPort } else { bindingFor24751_2 = binding.HostPort } } } assert.NotZero(t, bindingFor24751_1, "could not find the port mapping for ", containerPortOne) assert.NotZero(t, bindingFor24751_2, "could not find the port mapping for ", containerPortOne) client, _ := sdkClient.NewClientWithOpts(sdkClient.WithHost(endpoint), sdkClient.WithVersion(sdkclientfactory.GetDefaultVersion().String())) containerMap, _ := taskEngine.(*DockerTaskEngine).state.ContainerMapByArn(testTask.Arn) cid := containerMap[testTask.Containers[0].Name].DockerID cip, err := getContainerIP(client, cid) assert.NoError(t, err) time.Sleep(waitForDockerDuration) // wait for Docker conn, err := dialWithRetries("tcp", fmt.Sprintf("%s:%d", cip, containerPortOne), 10, dialTimeout) require.NoError(t, err, "error dialing simple container") response, _ := ioutil.ReadAll(conn) assert.Equal(t, string(response), serverContent, "got response: "+string(response)+" instead of %s", serverContent) // Kill the existing container now taskUpdate := *testTask taskUpdate.SetDesiredStatus(apitaskstatus.TaskStopped) go taskEngine.AddTask(&taskUpdate) event = <-stateChangeEvents assert.Equal(t, event.(api.ContainerStateChange).Status, apicontainerstatus.ContainerStopped, "Expected container to be STOPPED") event = <-stateChangeEvents assert.Equal(t, event.(api.TaskStateChange).Status, apitaskstatus.TaskStopped, "Expected task to be STOPPED") }
explode_data.jsonl/20160
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 899 }
[ 2830, 3393, 32089, 21752, 7084, 25925, 1155, 353, 8840, 836, 8, 341, 49115, 4571, 11, 2814, 11, 716, 1669, 6505, 2354, 3675, 2648, 1155, 340, 16867, 2814, 2822, 24291, 4072, 7900, 1669, 3383, 4571, 18942, 4072, 7900, 2822, 18185, 58331, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestSentAlready(t *testing.T) { jw := Wrap(httptest.NewRecorder()) n, err := jw.Data("xx").Send() if n == 0 || err != nil { t.Errorf("SentAlready: have: (%d, %q), want: (>0, nil)", n, err) } n2, err2 := jw.Send() if n2 != 0 || err2 != errSentAlready { t.Errorf("SentAlready: have: (%d, %q), want: (0, %q)", n2, err2, errSentAlready) } }
explode_data.jsonl/3983
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 156 }
[ 2830, 3393, 31358, 38370, 1155, 353, 8840, 836, 8, 341, 12428, 86, 1669, 42187, 73392, 83, 70334, 7121, 47023, 12367, 9038, 11, 1848, 1669, 502, 86, 3336, 445, 4146, 1827, 11505, 2822, 743, 308, 621, 220, 15, 1369, 1848, 961, 2092, 34...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
5
func TestRongCloud_SystemSend(t *testing.T) { rc := NewRongCloud( os.Getenv("APP_KEY"), os.Getenv("APP_SECRET"), ) msg := TXTMsg{ Content: "hello", Extra: "helloExtra", } err := rc.SystemSend( "7Szq13MKRVortoknTAk7W8", []string{"4kIvGJmETlYqDoVFgWdYdM"}, "RC:TxtMsg", &msg, "", "", 0, 1, ) t.Log(err) }
explode_data.jsonl/39001
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 188 }
[ 2830, 3393, 49, 644, 16055, 25363, 11505, 1155, 353, 8840, 836, 8, 1476, 30295, 1669, 1532, 49, 644, 16055, 1006, 197, 25078, 64883, 445, 14707, 6600, 4461, 197, 25078, 64883, 445, 14707, 31408, 4461, 197, 692, 21169, 1669, 72429, 6611, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestPGWireDBName(t *testing.T) { defer leaktest.AfterTest(t)() s, _, _ := serverutils.StartServer(t, base.TestServerArgs{}) defer s.Stopper().Stop() pgURL, cleanupFn := sqlutils.PGUrl(t, s.ServingAddr(), "TestPGWireDBName", url.User(security.RootUser)) pgURL.Path = "foo" defer cleanupFn() { db, err := gosql.Open("postgres", pgURL.String()) if err != nil { t.Fatal(err) } defer db.Close() if _, err := db.Exec(`CREATE DATABASE foo`); err != nil { t.Fatal(err) } if _, err := db.Exec(`CREATE TABLE bar (i INT PRIMARY KEY)`); err != nil { t.Fatal(err) } } db, err := gosql.Open("postgres", pgURL.String()) if err != nil { t.Fatal(err) } defer db.Close() if _, err := db.Exec(`INSERT INTO bar VALUES ($1)`, 1); err != nil { t.Fatal(err) } }
explode_data.jsonl/15524
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 357 }
[ 2830, 3393, 11383, 37845, 3506, 675, 1155, 353, 8840, 836, 8, 341, 16867, 23352, 1944, 36892, 2271, 1155, 8, 2822, 1903, 11, 8358, 716, 1669, 3538, 6031, 12101, 5475, 1155, 11, 2331, 8787, 5475, 4117, 37790, 16867, 274, 7758, 18487, 100...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestEntryAddUntimedEmptyMetadatasError(t *testing.T) { ctrl := gomock.NewController(t) defer ctrl.Finish() e, _, _ := testEntry(ctrl, testEntryOptions{}) inputMetadatas := metadata.StagedMetadatas{} require.Equal(t, errEmptyMetadatas, e.AddUntimed(testCounter, inputMetadatas)) }
explode_data.jsonl/24210
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 113 }
[ 2830, 3393, 5874, 2212, 20250, 75485, 3522, 34673, 329, 19346, 1454, 1155, 353, 8840, 836, 8, 341, 84381, 1669, 342, 316, 1176, 7121, 2051, 1155, 340, 16867, 23743, 991, 18176, 2822, 7727, 11, 8358, 716, 1669, 1273, 5874, 62100, 11, 127...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestHandles(t *testing.T) { handler := NewSecurityContextDeny(nil) tests := map[admission.Operation]bool{ admission.Update: true, admission.Create: true, admission.Delete: false, admission.Connect: false, } for op, expected := range tests { result := handler.Handles(op) if result != expected { t.Errorf("Unexpected result for operation %s: %v\n", op, result) } } }
explode_data.jsonl/5862
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 148 }
[ 2830, 3393, 65928, 1155, 353, 8840, 836, 8, 341, 53326, 1669, 1532, 15352, 1972, 23619, 88, 27907, 340, 78216, 1669, 2415, 58, 329, 2728, 56297, 96436, 515, 197, 98780, 2728, 16689, 25, 220, 830, 345, 197, 98780, 2728, 7251, 25, 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...
3
func TestAllocIPAddresses(t *testing.T) { ctrl, _, mockEC2 := setup(t) defer ctrl.Finish() // when required IP numbers(5) is below ENI's limit(30) input := &ec2.AssignPrivateIpAddressesInput{ NetworkInterfaceId: aws.String("eni-id"), SecondaryPrivateIpAddressCount: aws.Int64(5), } mockEC2.EXPECT().AssignPrivateIpAddresses(input).Return(nil, nil) ins := &EC2InstanceMetadataCache{ec2SVC: mockEC2, instanceType: "c5n.18xlarge"} err := ins.AllocIPAddresses("eni-id", 5) assert.NoError(t, err) // when required IP numbers(50) is higher than ENI's limit(49) input = &ec2.AssignPrivateIpAddressesInput{ NetworkInterfaceId: aws.String("eni-id"), SecondaryPrivateIpAddressCount: aws.Int64(49), } mockEC2.EXPECT().AssignPrivateIpAddresses(input).Return(nil, nil) ins = &EC2InstanceMetadataCache{ec2SVC: mockEC2, instanceType: "c5n.18xlarge"} err = ins.AllocIPAddresses("eni-id", 50) assert.NoError(t, err) // Adding 0 should do nothing err = ins.AllocIPAddresses("eni-id", 0) assert.NoError(t, err) }
explode_data.jsonl/19300
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 426 }
[ 2830, 3393, 25154, 3298, 52290, 1155, 353, 8840, 836, 8, 341, 84381, 11, 8358, 7860, 7498, 17, 1669, 6505, 1155, 340, 16867, 23743, 991, 18176, 2822, 197, 322, 979, 2567, 6790, 5109, 7, 20, 8, 374, 3685, 5190, 40, 594, 3930, 7, 18, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestFirestoreCommitError(t *testing.T) { errCode := codes.PermissionDenied mockFirestore.err = gstatus.Error(errCode, "test error") var formattedDatabase string = fmt.Sprintf("projects/%s/databases/%s", "[PROJECT]", "[DATABASE]") var writes []*firestorepb.Write = nil var request = &firestorepb.CommitRequest{ Database: formattedDatabase, Writes: writes, } c, err := NewClient(context.Background(), clientOpt) if err != nil { t.Fatal(err) } resp, err := c.Commit(context.Background(), request) 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/27385
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 270 }
[ 2830, 3393, 48513, 33441, 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, 5988, 914, 284, 8879, 17305, 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...
4
func TestRangePortsMapping(t *testing.T) { assert := assert.New(t) for i := 0; i < 3; i++ { name := fmt.Sprintf("%s_%d", consts.ProxyRangeTcpPrefix, i) status, err := util.GetProxyStatus(consts.ADMIN_ADDR, consts.ADMIN_USER, consts.ADMIN_PWD, name) if assert.NoError(err) { assert.Equal(proxy.ProxyStatusRunning, status.Status) } } }
explode_data.jsonl/79669
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 148 }
[ 2830, 3393, 6046, 68273, 6807, 1155, 353, 8840, 836, 8, 341, 6948, 1669, 2060, 7121, 1155, 692, 2023, 600, 1669, 220, 15, 26, 600, 366, 220, 18, 26, 600, 1027, 341, 197, 11609, 1669, 8879, 17305, 4430, 82, 18695, 67, 497, 95432, 752...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestNumeric(t *testing.T) { validate := New() s := "1" errs := validate.Var(s, "numeric") Equal(t, errs, nil) s = "+1" errs = validate.Var(s, "numeric") Equal(t, errs, nil) s = "-1" errs = validate.Var(s, "numeric") Equal(t, errs, nil) s = "1.12" errs = validate.Var(s, "numeric") Equal(t, errs, nil) s = "+1.12" errs = validate.Var(s, "numeric") Equal(t, errs, nil) s = "-1.12" errs = validate.Var(s, "numeric") Equal(t, errs, nil) s = "1." errs = validate.Var(s, "numeric") NotEqual(t, errs, nil) AssertError(t, errs, "", "", "", "", "numeric") s = "1.o" errs = validate.Var(s, "numeric") NotEqual(t, errs, nil) AssertError(t, errs, "", "", "", "", "numeric") i := 1 errs = validate.Var(i, "numeric") Equal(t, errs, nil) }
explode_data.jsonl/77326
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 381 }
[ 2830, 3393, 36296, 1155, 353, 8840, 836, 8, 1476, 197, 7067, 1669, 1532, 2822, 1903, 1669, 330, 16, 698, 9859, 82, 1669, 9593, 87968, 1141, 11, 330, 19600, 1138, 197, 2993, 1155, 11, 70817, 11, 2092, 692, 1903, 284, 6630, 16, 698, 9...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestRequirementConstructor(t *testing.T) { requirementConstructorTests := []struct { Key string Op selection.Operator Vals sets.String Success bool }{ {"x", selection.In, nil, false}, {"x", selection.NotIn, sets.NewString(), false}, {"x", selection.In, sets.NewString("foo"), true}, {"x", selection.NotIn, sets.NewString("foo"), true}, {"x", selection.Exists, nil, true}, {"x", selection.DoesNotExist, nil, true}, {"1foo", selection.In, sets.NewString("bar"), true}, {"1234", selection.In, sets.NewString("bar"), true}, {"y", selection.GreaterThan, sets.NewString("1"), true}, {"z", selection.LessThan, sets.NewString("6"), true}, {"foo", selection.GreaterThan, sets.NewString("bar"), false}, {"barz", selection.LessThan, sets.NewString("blah"), false}, {strings.Repeat("a", 254), selection.Exists, nil, false}, //breaks DNS rule that len(key) <= 253 } for _, rc := range requirementConstructorTests { if _, err := NewRequirement(rc.Key, rc.Op, rc.Vals.List()); err == nil && !rc.Success { t.Errorf("expected error with key:%#v op:%v vals:%v, got no error", rc.Key, rc.Op, rc.Vals) } else if err != nil && rc.Success { t.Errorf("expected no error with key:%#v op:%v vals:%v, got:%v", rc.Key, rc.Op, rc.Vals, err) } } }
explode_data.jsonl/29773
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 498 }
[ 2830, 3393, 75802, 13288, 1155, 353, 8840, 836, 8, 341, 17957, 478, 13288, 18200, 1669, 3056, 1235, 341, 197, 55242, 257, 914, 198, 197, 197, 7125, 414, 6589, 85546, 198, 197, 17446, 1127, 262, 7289, 6431, 198, 197, 197, 7188, 1807, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestTranslateIngressV1beta1(t *testing.T) { prefix := networkingv1beta1.PathTypePrefix // no backend. ing := &networkingv1beta1.Ingress{ ObjectMeta: metav1.ObjectMeta{ Name: "test", Namespace: "default", Annotations: map[string]string{ "k8s.apisix.apache.org/use-regex": "true", path.Join(annotations.AnnotationsPrefix, "enable-cors"): "true", path.Join(annotations.AnnotationsPrefix, "allowlist-source-range"): "127.0.0.1", path.Join(annotations.AnnotationsPrefix, "enable-cors222"): "true", }, }, Spec: networkingv1beta1.IngressSpec{ Rules: []networkingv1beta1.IngressRule{ { Host: "apisix.apache.org", IngressRuleValue: networkingv1beta1.IngressRuleValue{ HTTP: &networkingv1beta1.HTTPIngressRuleValue{ Paths: []networkingv1beta1.HTTPIngressPath{ { Path: "/foo", PathType: &prefix, Backend: networkingv1beta1.IngressBackend{ ServiceName: "test-service", ServicePort: intstr.IntOrString{ Type: intstr.String, StrVal: "port1", }, }, }, { Path: "/bar", Backend: networkingv1beta1.IngressBackend{ ServiceName: "test-service", ServicePort: intstr.IntOrString{ Type: intstr.Int, IntVal: 443, }, }, }, }, }, }, }, }, }, } client := fake.NewSimpleClientset() informersFactory := informers.NewSharedInformerFactory(client, 0) svcInformer := informersFactory.Core().V1().Services().Informer() svcLister := informersFactory.Core().V1().Services().Lister() epLister, epInformer := kube.NewEndpointListerAndInformer(informersFactory, false) apisixClient := fakeapisix.NewSimpleClientset() apisixInformersFactory := apisixinformers.NewSharedInformerFactory(apisixClient, 0) processCh := make(chan struct{}) svcInformer.AddEventHandler(cache.ResourceEventHandlerFuncs{ AddFunc: func(obj interface{}) { processCh <- struct{}{} }, }) epInformer.AddEventHandler(cache.ResourceEventHandlerFuncs{ AddFunc: func(obj interface{}) { processCh <- struct{}{} }, }) stopCh := make(chan struct{}) defer close(stopCh) go svcInformer.Run(stopCh) go epInformer.Run(stopCh) cache.WaitForCacheSync(stopCh, svcInformer.HasSynced) _, err := client.CoreV1().Services("default").Create(context.Background(), _testSvc, metav1.CreateOptions{}) assert.Nil(t, err) _, err = client.CoreV1().Endpoints("default").Create(context.Background(), _testEp, metav1.CreateOptions{}) assert.Nil(t, err) tr := &translator{ TranslatorOptions: &TranslatorOptions{ ServiceLister: svcLister, EndpointLister: epLister, ApisixUpstreamLister: apisixInformersFactory.Apisix().V2beta3().ApisixUpstreams().Lister(), }, } <-processCh <-processCh ctx, err := tr.translateIngressV1beta1(ing) assert.Nil(t, err) assert.Len(t, ctx.Routes, 2) assert.Len(t, ctx.Upstreams, 2) assert.Len(t, ctx.PluginConfigs, 2) assert.Equal(t, []string{"/foo", "/foo/*"}, ctx.Routes[0].Uris) assert.Equal(t, ctx.Upstreams[0].ID, ctx.Routes[0].UpstreamId) assert.Equal(t, "apisix.apache.org", ctx.Routes[0].Host) assert.Equal(t, []string{"/bar"}, ctx.Routes[1].Uris) assert.Equal(t, ctx.Upstreams[1].ID, ctx.Routes[1].UpstreamId) assert.Equal(t, "apisix.apache.org", ctx.Routes[1].Host) assert.Equal(t, "roundrobin", ctx.Upstreams[0].Type) assert.Equal(t, "http", ctx.Upstreams[0].Scheme) assert.Len(t, ctx.Upstreams[0].Nodes, 2) assert.Equal(t, 9080, ctx.Upstreams[0].Nodes[0].Port) assert.Equal(t, "192.168.1.1", ctx.Upstreams[0].Nodes[0].Host) assert.Equal(t, 9080, ctx.Upstreams[0].Nodes[1].Port) assert.Equal(t, "192.168.1.2", ctx.Upstreams[0].Nodes[1].Host) assert.Equal(t, "roundrobin", ctx.Upstreams[1].Type) assert.Equal(t, "http", ctx.Upstreams[1].Scheme) assert.Len(t, ctx.Upstreams[1].Nodes, 2) assert.Equal(t, 9443, ctx.Upstreams[1].Nodes[0].Port) assert.Equal(t, "192.168.1.1", ctx.Upstreams[1].Nodes[0].Host) assert.Equal(t, 9443, ctx.Upstreams[1].Nodes[1].Port) assert.Equal(t, "192.168.1.2", ctx.Upstreams[1].Nodes[1].Host) assert.Len(t, ctx.PluginConfigs[0].Plugins, 2) assert.Len(t, ctx.PluginConfigs[1].Plugins, 2) }
explode_data.jsonl/6704
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 2028 }
[ 2830, 3393, 27473, 641, 2483, 53, 16, 19127, 16, 1155, 353, 8840, 836, 8, 341, 3223, 5060, 1669, 28030, 85, 16, 19127, 16, 17474, 929, 14335, 198, 197, 322, 902, 19163, 624, 197, 287, 1669, 609, 17511, 287, 85, 16, 19127, 16, 5337, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestClient_CreateExtraKey(t *testing.T) { t.Parallel() app, cleanup := cltest.NewApplication(t, cltest.EthMockRegisterChainID) kst := app.Store.KeyStore.(*mocks.KeyStoreInterface) defer cleanup() require.NoError(t, app.Start()) client, _ := app.NewClientAndRenderer() set := flag.NewFlagSet("test", 0) set.String("file", "internal/fixtures/apicredentials", "") c := cli.NewContext(nil, set, nil) err := client.RemoteLogin(c) assert.NoError(t, err) client.PasswordPrompter = cltest.MockPasswordPrompter{Password: "password"} kst.On("Unlock", cltest.Password).Return(nil) kst.On("NewAccount", cltest.Password).Return(accounts.Account{}, nil) assert.NoError(t, client.CreateExtraKey(c)) kst.AssertExpectations(t) }
explode_data.jsonl/78861
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 271 }
[ 2830, 3393, 2959, 34325, 11612, 1592, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 2822, 28236, 11, 21290, 1669, 1185, 1944, 7121, 4988, 1155, 11, 1185, 1944, 5142, 339, 11571, 8690, 18837, 915, 340, 16463, 267, 1669, 906, 38047, 96...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestEmptyLogFile(t *testing.T) { is := is.New(t) m, err := NewMemtable(10000, "/tmp/memtable.log") is.NoErr(err) err = m.Put("key1", "value1") is.NoErr(err) val, found := m.Get("key1") is.True(found) is.Equal(val, "value1") _, found = m.Get("key2") is.True(!found) err = m.Delete("key1") is.NoErr(err) _, found = m.Get("key1") is.True(!found) err = m.Clear() is.NoErr(err) }
explode_data.jsonl/56387
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 197 }
[ 2830, 3393, 3522, 98857, 1155, 353, 8840, 836, 8, 341, 19907, 1669, 374, 7121, 1155, 340, 2109, 11, 1848, 1669, 1532, 18816, 2005, 7, 16, 15, 15, 15, 15, 11, 3521, 5173, 3183, 336, 2005, 1665, 1138, 19907, 16766, 7747, 3964, 692, 98...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_fsimpl_WriteJson(t *testing.T) { tests := map[string]struct { o interface{} wantErr string assertFn func(*testing.T, FS) }{ "Should write a simple file": { o: &SampleJson{ Name: "name", }, assertFn: func(t *testing.T, fs FS) { data, err := fs.ReadFile("filename") assert.NoError(t, err) j := &SampleJson{} err = yaml.Unmarshal(data, j) assert.NoError(t, err) assert.Equal(t, "name", j.Name) }, }, } for name, tt := range tests { t.Run(name, func(t *testing.T) { fs := Create(memfs.New()) if err := fs.WriteJson("filename", tt.o); err != nil { if tt.wantErr != "" { assert.EqualError(t, err, tt.wantErr) } else { t.Errorf("WriteYamls() error = %v", err) } return } if tt.assertFn != nil { tt.assertFn(t, fs) } }) } }
explode_data.jsonl/58986
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 425 }
[ 2830, 3393, 34470, 6383, 31825, 5014, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 2415, 14032, 60, 1235, 341, 197, 22229, 286, 3749, 16094, 197, 50780, 7747, 220, 914, 198, 197, 6948, 24911, 2915, 4071, 8840, 836, 11, 24289, 340, 197, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestTracedError_String(t *testing.T) { err1 := New("error without sub-error") err2 := Wrap(errors.New("built-in sub-error"), "error with built-in sub-error") err3 := Wrap(err2, "error with traced sub-error") tables := []struct { tErr *tracedError expectedString string }{ { tErr: err1, expectedString: fmt.Sprintf(parentErrorStringFormat, err1.trace.file, err1.trace.line, err1.msg), }, { tErr: err2, expectedString: fmt.Sprintf( parentAndBuiltInSubErrorStringFormat, fmt.Sprintf(parentErrorStringFormat, err2.trace.file, err2.trace.line, err2.msg), err2.subErr, ), }, { tErr: err3, expectedString: fmt.Sprintf( parentAndTracedSubErrorStringFormat, fmt.Sprintf(parentErrorStringFormat, err3.trace.file, err3.trace.line, err3.msg), err3.subErr.Error(), ), }, } for _, table := range tables { if table.tErr.String() != table.expectedString { t.Errorf("\nexpected: %v\n\nactual: %v", table.expectedString, table.tErr.String()) } } }
explode_data.jsonl/42771
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 448 }
[ 2830, 3393, 1282, 4435, 1454, 31777, 1155, 353, 8840, 836, 8, 341, 9859, 16, 1669, 1532, 445, 841, 2041, 1186, 18917, 1138, 9859, 17, 1669, 42187, 38881, 7121, 445, 46239, 3419, 1186, 18917, 3975, 330, 841, 448, 5798, 3419, 1186, 18917,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestRetryRun_FailedDeletePods(t *testing.T) { store, manager, runDetail := initWithOneTimeFailedRun(t) defer store.Close() manager.k8sCoreClient = client.NewFakeKubernetesCoreClientWithBadPodClient() err := manager.RetryRun(runDetail.UUID) assert.NotNil(t, err) assert.Contains(t, err.Error(), "failed to delete pod") }
explode_data.jsonl/77032
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 122 }
[ 2830, 3393, 51560, 6727, 1400, 5687, 6435, 23527, 82, 1155, 353, 8840, 836, 8, 341, 57279, 11, 6645, 11, 1598, 10649, 1669, 13864, 3966, 1462, 9408, 6727, 1155, 340, 16867, 3553, 10421, 2822, 92272, 5202, 23, 82, 5386, 2959, 284, 2943, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestFreelist_read(t *testing.T) { // Create a page. var buf [4096]byte page := (*page)(unsafe.Pointer(&buf[0])) page.flags = freelistPageFlag page.count = 2 // Insert 2 page ids. ids := (*[3]pgid)(unsafe.Pointer(&page.ptr)) ids[0] = 23 ids[1] = 50 // Deserialize page into a freelist. f := newFreelist() f.read(page) // Ensure that there are two page ids in the freelist. if exp := []pgid{23, 50}; !reflect.DeepEqual(exp, f.ids) { t.Fatalf("exp=%v; got=%v", exp, f.ids) } }
explode_data.jsonl/43713
{ "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, 36731, 19230, 6443, 1155, 353, 8840, 836, 8, 341, 197, 322, 4230, 264, 2150, 624, 2405, 6607, 508, 19, 15, 24, 21, 90184, 198, 35272, 1669, 4609, 2893, 2376, 38157, 41275, 2099, 5909, 58, 15, 10907, 35272, 27203, 284, 3457...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestCfg_SetViolenceCheck(t *testing.T) { gtest.Case(t, func() { c := gcfg.New("config.yml") c.SetViolenceCheck(true) gtest.Assert(c.Get("name"), nil) }) }
explode_data.jsonl/24453
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 78 }
[ 2830, 3393, 42467, 14812, 49717, 763, 3973, 1155, 353, 8840, 836, 8, 341, 3174, 1944, 727, 519, 1155, 11, 2915, 368, 341, 197, 1444, 1669, 342, 14072, 7121, 445, 1676, 33936, 1138, 197, 1444, 4202, 49717, 763, 3973, 3715, 340, 197, 31...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
func TestIsEBSCompatible(t *testing.T) { tests := []struct { name string spotInfo instanceTypeInformation instanceInfo instance expected bool }{ {name: "EBS not Optimized Spot not Optimized", spotInfo: instanceTypeInformation{ hasEBSOptimization: false, }, instanceInfo: instance{ Instance: &ec2.Instance{ EbsOptimized: nil, }, }, expected: true, }, {name: "EBS Optimized Spot Optimized", spotInfo: instanceTypeInformation{ hasEBSOptimization: true, }, instanceInfo: instance{ Instance: &ec2.Instance{ EbsOptimized: &[]bool{true}[0], }, }, expected: true, }, {name: "EBS Optimized Spot not Optimized", spotInfo: instanceTypeInformation{ hasEBSOptimization: false, }, instanceInfo: instance{ Instance: &ec2.Instance{ EbsOptimized: &[]bool{true}[0], }, }, expected: false, }, {name: "EBS not Optimized Spot Optimized", spotInfo: instanceTypeInformation{ hasEBSOptimization: true, }, instanceInfo: instance{ Instance: &ec2.Instance{ EbsOptimized: &[]bool{false}[0], }, }, expected: true, }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { i := &tt.instanceInfo retValue := i.isEBSCompatible(tt.spotInfo) if retValue != tt.expected { t.Errorf("Value received: %t expected %t", retValue, tt.expected) } }) } }
explode_data.jsonl/55195
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 625 }
[ 2830, 3393, 3872, 36, 7347, 29161, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 3056, 1235, 341, 197, 11609, 260, 914, 198, 197, 1903, 19099, 1731, 257, 2867, 929, 14873, 198, 197, 56256, 1731, 2867, 198, 197, 42400, 257, 1807, 198, 197...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestHandleReceiveBuffer(t *testing.T) { h, err := NewHandle() if err != nil { t.Fatal(err) } defer h.Close() if err := h.SetSocketReceiveBufferSize(65536, false); err != nil { t.Fatal(err) } sizes, err := h.GetSocketReceiveBufferSize() if err != nil { t.Fatal(err) } if len(sizes) != len(h.sockets) { t.Fatalf("Unexpected number of socket buffer sizes: %d (expected %d)", len(sizes), len(h.sockets)) } for _, s := range sizes { if s < 65536 || s > 2*65536 { t.Fatalf("Unexpected socket receive buffer size: %d (expected around %d)", s, 65536) } } }
explode_data.jsonl/22564
{ "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, 6999, 14742, 4095, 1155, 353, 8840, 836, 8, 341, 9598, 11, 1848, 1669, 1532, 6999, 741, 743, 1848, 961, 2092, 341, 197, 3244, 26133, 3964, 340, 197, 532, 16867, 305, 10421, 741, 743, 1848, 1669, 305, 4202, 10286, 14742, 52...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestParallel_4(t *testing.T) { testConf.SetGOPATH(os.Getenv("GOPATH")) conf := testConf.Config() t.Parallel() for _, test := range tests { if err := test.Check(conf); err != nil { t.Error(err) } } }
explode_data.jsonl/41692
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 92 }
[ 2830, 3393, 16547, 62, 19, 1155, 353, 8840, 836, 8, 341, 18185, 15578, 4202, 98733, 4827, 9638, 64883, 445, 98733, 4827, 5455, 67850, 1669, 1273, 15578, 10753, 741, 3244, 41288, 7957, 741, 2023, 8358, 1273, 1669, 2088, 7032, 341, 197, 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 ]
3
func TestExactOutput(t *testing.T) { ctx, cancel := context.WithTimeout(context.Background(), defaultTestTimeout) defer cancel() testCases := []struct { desc string cmdLine string expectFile string }{ { desc: "gen plugin e2e", cmdLine: "gen plugin e2e --kubernetes-version=v123.456.789", expectFile: "testdata/gen-plugin-e2e.golden", }, { desc: "gen plugin e2e respects configmap", cmdLine: "gen plugin e2e --kubernetes-version=v123.456.789 --configmap=testdata/tiny-configmap.yaml", expectFile: "testdata/gen-plugin-e2e-configmap.golden", }, { desc: "gen plugin e2e with deprecated flag", cmdLine: "gen plugin e2e --kube-conformance-image-version=v123.456.789", expectFile: "testdata/gen-plugin-e2e-kube-flag-still-works.golden", }, { desc: "gen with static config", cmdLine: "gen --config=testdata/static-config.json --kubernetes-version=v123.456.789", expectFile: "testdata/gen-static.golden", }, { desc: "gen specify dynamic plugin", cmdLine: "gen --config=testdata/static-config.json --kubernetes-version=v123.456.789 -pe2e", expectFile: "testdata/gen-static-only-e2e.golden", }, { desc: "gen with variable plugin image", cmdLine: "gen --config=testdata/static-config.json --kubernetes-version=v123.456.789 " + "-p testdata/hello-world.yaml -p testdata/variable-image.yaml", expectFile: "testdata/gen-variable-image.golden", }, } for _, tc := range testCases { t.Run(tc.desc, func(t *testing.T) { output := mustRunSonobuoyCommandWithContext(ctx, t, tc.cmdLine) if *update { if err := os.WriteFile(tc.expectFile, output.Bytes(), 0666); err != nil { t.Fatalf("Failed to update goldenfile: %v", err) } } else { fileData, err := ioutil.ReadFile(tc.expectFile) if err != nil { t.Fatalf("Failed to read golden file %v: %v", tc.expectFile, err) } if !bytes.Equal(fileData, output.Bytes()) { t.Errorf("Expected manifest to equal goldenfile: %v but instead got:\n\n%v", tc.expectFile, output.String()) } } }) } }
explode_data.jsonl/66748
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 907 }
[ 2830, 3393, 57954, 5097, 1155, 353, 8840, 836, 8, 341, 20985, 11, 9121, 1669, 2266, 26124, 7636, 5378, 19047, 1507, 1638, 2271, 7636, 340, 16867, 9121, 2822, 18185, 37302, 1669, 3056, 1235, 341, 197, 41653, 981, 914, 198, 197, 25920, 24...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
5
func TestRootPathsContain(t *testing.T) { tests := []struct { note string roots []string path string want bool }{ { note: "empty contains empty", roots: []string{""}, path: "", want: true, }, { note: "empty contains non-empty", roots: []string{""}, path: "foo/bar", want: true, }, { note: "single prefix", roots: []string{"foo"}, path: "foo/bar", want: true, }, { note: "single prefix no match", roots: []string{"bar"}, path: "foo/bar", want: false, }, { note: "multiple prefix", roots: []string{"baz", "foo"}, path: "foo/bar", want: true, }, { note: "multiple prefix no match", roots: []string{"baz", "qux"}, path: "foo/bar", want: false, }, { note: "single exact", roots: []string{"foo/bar"}, path: "foo/bar", want: true, }, { note: "single exact no match", roots: []string{"foo/ba"}, path: "foo/bar", want: false, }, { note: "multiple exact", roots: []string{"baz/bar", "foo/bar"}, path: "foo/bar", want: true, }, { note: "root too long", roots: []string{"foo/bar/"}, path: "foo/bar", want: false, }, } for _, tc := range tests { t.Run(tc.note, func(t *testing.T) { if RootPathsContain(tc.roots, tc.path) != tc.want { t.Fatalf("expected %v contains %v to be %v", tc.roots, tc.path, tc.want) } }) } }
explode_data.jsonl/55376
{ "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, 8439, 26901, 46522, 1155, 353, 8840, 836, 8, 341, 78216, 1669, 3056, 1235, 341, 197, 9038, 1272, 220, 914, 198, 197, 197, 37165, 3056, 917, 198, 197, 26781, 220, 914, 198, 197, 50780, 220, 1807, 198, 197, 59403, 197, 197, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestDestroySet(t *testing.T) { fcmd := fakeexec.FakeCmd{ CombinedOutputScript: []fakeexec.FakeAction{ // Success func() ([]byte, []byte, error) { return []byte{}, nil, nil }, // Failure func() ([]byte, []byte, error) { return []byte("ipset v6.19: The set with the given name does not exist"), nil, &fakeexec.FakeExitError{Status: 1} }, }, } fexec := fakeexec.FakeExec{ CommandScript: []fakeexec.FakeCommandAction{ func(cmd string, args ...string) exec.Cmd { return fakeexec.InitFakeCmd(&fcmd, cmd, args...) }, func(cmd string, args ...string) exec.Cmd { return fakeexec.InitFakeCmd(&fcmd, cmd, args...) }, }, } runner := New(&fexec) // Success err := runner.DestroySet("FOOBAR") if err != nil { t.Errorf("expected success, got %v", err) } if fcmd.CombinedOutputCalls != 1 { t.Errorf("expected 1 CombinedOutput() calls, got %d", fcmd.CombinedOutputCalls) } if !sets.NewString(fcmd.CombinedOutputLog[0]...).HasAll("ipset", "destroy", "FOOBAR") { t.Errorf("wrong CombinedOutput() log, got %s", fcmd.CombinedOutputLog[0]) } // Failure err = runner.DestroySet("FOOBAR") if err == nil { t.Errorf("expected failure, got nil") } }
explode_data.jsonl/74007
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 449 }
[ 2830, 3393, 14245, 1649, 1155, 353, 8840, 836, 8, 341, 1166, 8710, 1669, 12418, 11748, 991, 726, 15613, 515, 197, 197, 94268, 5097, 5910, 25, 3056, 30570, 11748, 991, 726, 2512, 515, 298, 197, 322, 13047, 198, 298, 29244, 368, 34923, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestForwardAccept(t *testing.T) { rs := NewRuleSet([]Rule{ForwardRule, AcceptRule}) result, rule := rs.Apply(&cb.Envelope{}) if result != Accept { t.Fatalf("Should have accepted") } if rule != AcceptRule { t.Fatalf("Accepted but not for the right rule") } }
explode_data.jsonl/11105
{ "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, 25925, 16646, 1155, 353, 8840, 836, 8, 341, 41231, 1669, 1532, 11337, 1649, 10556, 11337, 90, 25925, 11337, 11, 20829, 11337, 3518, 9559, 11, 5912, 1669, 10036, 36051, 2099, 7221, 22834, 18853, 37790, 743, 1102, 961, 20829, 34...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func TestRouter_Any(t *testing.T) { path := "/path1" router := Router{} _ = router.Any(path, testHandlerFunc) assertPathFound(t, router, "GET", path) assertPathFound(t, router, "HEAD", path) assertPathFound(t, router, "POST", path) assertPathFound(t, router, "PUT", path) assertPathFound(t, router, "PATCH", path) assertPathFound(t, router, "DELETE", path) assertPathFound(t, router, "CONNECT", path) assertPathFound(t, router, "OPTIONS", path) assertPathFound(t, router, "TRACE", path) }
explode_data.jsonl/31723
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 189 }
[ 2830, 3393, 9523, 1566, 3834, 1155, 353, 8840, 836, 8, 341, 26781, 1669, 3521, 2343, 16, 1837, 67009, 1669, 10554, 16094, 197, 62, 284, 9273, 13311, 5581, 11, 1273, 3050, 9626, 692, 6948, 1820, 6650, 1155, 11, 9273, 11, 330, 3806, 497...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestTeamsService_DeleteTeamByID(t *testing.T) { client, mux, _, teardown := setup() defer teardown() mux.HandleFunc("/organizations/1/team/1", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "DELETE") }) ctx := context.Background() _, err := client.Teams.DeleteTeamByID(ctx, 1, 1) if err != nil { t.Errorf("Teams.DeleteTeamByID returned error: %v", err) } const methodName = "DeleteTeamByID" testBadOptions(t, methodName, func() (err error) { _, err = client.Teams.DeleteTeamByID(ctx, -1, -1) return err }) testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { return client.Teams.DeleteTeamByID(ctx, 1, 1) }) }
explode_data.jsonl/4520
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 268 }
[ 2830, 3393, 60669, 1860, 57418, 14597, 60572, 1155, 353, 8840, 836, 8, 341, 25291, 11, 59807, 11, 8358, 49304, 1669, 6505, 741, 16867, 49304, 2822, 2109, 2200, 63623, 4283, 69253, 14, 16, 78015, 14, 16, 497, 2915, 3622, 1758, 37508, 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 TestLocalFileBackendTestSuite(t *testing.T) { // Setup a global logger to catch tests logging outside of app context // The global logger will be stomped by apps initalizing but that's fine for testing. Ideally this won't happen. mlog.InitGlobalLogger(mlog.NewLogger(&mlog.LoggerConfiguration{ EnableConsole: true, ConsoleJson: true, ConsoleLevel: "error", EnableFile: false, })) dir, err := ioutil.TempDir("", "") require.NoError(t, err) defer os.RemoveAll(dir) suite.Run(t, &FileBackendTestSuite{ settings: model.FileSettings{ DriverName: model.NewString(model.IMAGE_DRIVER_LOCAL), Directory: dir, }, }) }
explode_data.jsonl/29458
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 234 }
[ 2830, 3393, 7319, 1703, 29699, 2271, 28000, 1155, 353, 8840, 836, 8, 341, 197, 322, 18626, 264, 3644, 5925, 311, 2287, 7032, 8392, 4889, 315, 906, 2266, 198, 197, 322, 576, 3644, 5925, 686, 387, 20100, 6874, 553, 10500, 304, 2174, 484...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestIssue12209(t *testing.T) { store, clean := testkit.CreateMockStore(t) defer clean() tk := testkit.NewTestKit(t, store) tk.MustExec("use test") tk.MustExec("drop table if exists t12209;") tk.MustExec("create table t12209(a bigint(20));") tk.MustExec("insert into t12209 values(1);") tk.MustQuery("select `a` DIV ( ROUND( ( SCHEMA() ), '1978-05-18 03:35:52.043591' ) ) from `t12209`;").Check( testkit.Rows("<nil>")) }
explode_data.jsonl/65570
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 179 }
[ 2830, 3393, 42006, 16, 17, 17, 15, 24, 1155, 353, 8840, 836, 8, 341, 57279, 11, 4240, 1669, 1273, 8226, 7251, 11571, 6093, 1155, 340, 16867, 4240, 2822, 3244, 74, 1669, 1273, 8226, 7121, 2271, 7695, 1155, 11, 3553, 692, 3244, 74, 50...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestRandomValidStrings(t *testing.T) { rand.Seed(time.Now().UnixNano()) b := make([]byte, 200) for i := 0; i < 100000; i++ { n, err := rand.Read(b[:rand.Int()%len(b)]) if err != nil { t.Fatal(err) } sm, err := json.Marshal(string(b[:n])) if err != nil { t.Fatal(err) } var su string if err := json.Unmarshal([]byte(sm), &su); err != nil { t.Fatal(err) } token := Get(`{"str":`+string(sm)+`}`, "str") if token.Type != String || token.Str != su { println("["+token.Raw+"]", "["+token.Str+"]", "["+su+"]", "["+string(sm)+"]") t.Fatal("string mismatch") } } }
explode_data.jsonl/43412
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 295 }
[ 2830, 3393, 13999, 4088, 20859, 1155, 353, 8840, 836, 8, 341, 7000, 437, 5732, 291, 9730, 13244, 1005, 55832, 83819, 2398, 2233, 1669, 1281, 10556, 3782, 11, 220, 17, 15, 15, 340, 2023, 600, 1669, 220, 15, 26, 600, 366, 220, 16, 15,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
7
func TestSelectEntry_SetOptions(t *testing.T) { app := test.NewApp() defer test.NewApp() app.Settings().SetTheme(theme.LightTheme()) e := widget.NewSelectEntry([]string{"A", "B", "C"}) w := test.NewWindow(e) defer w.Close() w.Resize(fyne.NewSize(150, 200)) e.Resize(e.MinSize().Max(fyne.NewSize(130, 0))) e.Move(fyne.NewPos(10, 10)) c := w.Canvas() switchPos := fyne.NewPos(140-theme.Padding()-theme.IconInlineSize()/2, 10+theme.Padding()+theme.IconInlineSize()/2) test.TapCanvas(c, switchPos) test.AssertImageMatches(t, "select_entry/dropdown_empty_opened.png", c.Capture()) test.TapCanvas(c, switchPos) e.SetOptions([]string{"1", "2", "3"}) test.TapCanvas(c, switchPos) test.AssertImageMatches(t, "select_entry/dropdown_empty_setopts.png", c.Capture()) }
explode_data.jsonl/42147
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 323 }
[ 2830, 3393, 3379, 5874, 14812, 3798, 1155, 353, 8840, 836, 8, 341, 28236, 1669, 1273, 7121, 2164, 741, 16867, 1273, 7121, 2164, 741, 28236, 27000, 1005, 1649, 12594, 57524, 50791, 12594, 12367, 7727, 1669, 9086, 7121, 3379, 5874, 10556, 9...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestParseEmpty(t *testing.T) { a := assert.New(t) s := &Segment{ Text: []byte(``), } a.False(s.IsArenaDecks()) decks, err := s.ParseArenaDecks() a.NotNil(err) a.Nil(decks) a.Equal("unexpected end of JSON input", err.Error()) }
explode_data.jsonl/27786
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 114 }
[ 2830, 3393, 14463, 3522, 1155, 353, 8840, 836, 8, 341, 11323, 1669, 2060, 7121, 1155, 340, 1903, 1669, 609, 21086, 515, 197, 49635, 25, 3056, 3782, 5809, 89746, 197, 532, 11323, 50757, 1141, 4506, 93937, 1912, 14553, 2398, 58351, 14553, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestGocloak_GetRealmRoles(t *testing.T) { t.Parallel() cfg := GetConfig(t) client := NewClientWithDebug(t) token := GetAdminToken(t, client) tearDown, _ := CreateRealmRole(t, client) defer tearDown() roles, err := client.GetRealmRoles( token.AccessToken, cfg.GoCloak.Realm) FailIfErr(t, err, "GetRealmRoles failed") t.Logf("Roles: %+v", roles) }
explode_data.jsonl/79545
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 155 }
[ 2830, 3393, 38, 509, 385, 585, 13614, 64290, 25116, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 741, 50286, 1669, 2126, 2648, 1155, 340, 25291, 1669, 1532, 2959, 2354, 7939, 1155, 340, 43947, 1669, 2126, 7210, 3323, 1155, 11, 2943,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestGetHostPrivateIPv4AddressFromEC2Metadata(t *testing.T) { ctrl := gomock.NewController(t) defer ctrl.Finish() ec2MetadataClient := mock_ec2.NewMockEC2MetadataClient(ctrl) ec2Client := mock_ec2.NewMockClient(ctrl) agent := &ecsAgent{ ec2MetadataClient: ec2MetadataClient, ec2Client: ec2Client, } ec2MetadataClient.EXPECT().PrivateIPv4Address().Return(hostPrivateIPv4Address, nil) assert.Equal(t, hostPrivateIPv4Address, agent.getHostPrivateIPv4AddressFromEC2Metadata()) }
explode_data.jsonl/41606
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 193 }
[ 2830, 3393, 1949, 9296, 16787, 58056, 19, 4286, 3830, 7498, 17, 14610, 1155, 353, 8840, 836, 8, 341, 84381, 1669, 342, 316, 1176, 7121, 2051, 1155, 340, 16867, 23743, 991, 18176, 2822, 197, 757, 17, 14610, 2959, 1669, 7860, 36844, 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 TestClusterDropsRemoteSids(t *testing.T) { srvA, srvB, optsA, _ := runServers(t) defer srvA.Shutdown() defer srvB.Shutdown() clientA := createClientConn(t, optsA.Host, optsA.Port) defer clientA.Close() sendA, expectA := setupConn(t, clientA) // Add a subscription sendA("SUB foo 1\r\n") sendA("PING\r\n") expectA(pongRe) // Wait for propagation. time.Sleep(100 * time.Millisecond) if sc := srvA.NumSubscriptions(); sc != 1 { t.Fatalf("Expected one subscription for srvA, got %d\n", sc) } if sc := srvB.NumSubscriptions(); sc != 1 { t.Fatalf("Expected one subscription for srvB, got %d\n", sc) } // Add another subscription sendA("SUB bar 2\r\n") sendA("PING\r\n") expectA(pongRe) // Wait for propagation. time.Sleep(100 * time.Millisecond) if sc := srvA.NumSubscriptions(); sc != 2 { t.Fatalf("Expected two subscriptions for srvA, got %d\n", sc) } if sc := srvB.NumSubscriptions(); sc != 2 { t.Fatalf("Expected two subscriptions for srvB, got %d\n", sc) } // unsubscription sendA("UNSUB 1\r\n") sendA("PING\r\n") expectA(pongRe) // Wait for propagation. time.Sleep(100 * time.Millisecond) if sc := srvA.NumSubscriptions(); sc != 1 { t.Fatalf("Expected one subscription for srvA, got %d\n", sc) } if sc := srvB.NumSubscriptions(); sc != 1 { t.Fatalf("Expected one subscription for srvB, got %d\n", sc) } // Close the client and make sure we remove subscription state. clientA.Close() // Wait for propagation. time.Sleep(100 * time.Millisecond) if sc := srvA.NumSubscriptions(); sc != 0 { t.Fatalf("Expected no subscriptions for srvA, got %d\n", sc) } if sc := srvB.NumSubscriptions(); sc != 0 { t.Fatalf("Expected no subscriptions for srvB, got %d\n", sc) } }
explode_data.jsonl/5074
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 709 }
[ 2830, 3393, 28678, 35, 3702, 24703, 50, 3365, 1155, 353, 8840, 836, 8, 341, 1903, 10553, 32, 11, 43578, 33, 11, 12185, 32, 11, 716, 1669, 1598, 78139, 1155, 340, 16867, 43578, 32, 10849, 18452, 741, 16867, 43578, 33, 10849, 18452, 282...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestInstallResourcesRender(t *testing.T) { f, err := generator.GetAssetsFS().Open("./install") require.NoError(t, err) defer f.Close() files, err := f.Readdir(-1) require.NoError(t, err) for _, f := range files { if strings.HasPrefix(f.Name(), "grant") || strings.HasPrefix(f.Name(), "cluster") { continue // skip these.. Not testing the grant resource rendering.. } if strings.Compare(f.Name(), "deployment.yml.tmpl") == 0 { continue // skip these.. Not testing the deployment.. } apiServer := capabilities.ApiServerSpec{ OlmSupport: true, } o := Install{ Options: &internal.Options{ Namespace: "syndesis", }, image: "syndesis-operator", tag: "latest", devSupport: true, apiServer: apiServer, } resources, err := o.render("./install/" + f.Name()) require.NoError(t, err) assert.NotEqual(t, 0, len(resources), "Failed to render "+f.Name()) } }
explode_data.jsonl/72082
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 368 }
[ 2830, 3393, 24690, 11277, 6750, 1155, 353, 8840, 836, 8, 1476, 1166, 11, 1848, 1669, 13823, 2234, 26879, 8485, 1005, 5002, 13988, 12248, 1138, 17957, 35699, 1155, 11, 1848, 340, 16867, 282, 10421, 2822, 74075, 11, 1848, 1669, 282, 2817, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestNormalizeVolumes(t *testing.T) { project := types.Project{ Name: "myProject", Networks: types.Networks{}, Volumes: types.Volumes{ "myExternalVol": { Name: "myExternalVol", // this is automaticaly setup by loader for externa networks before reaching normalization External: types.External{External: true}, }, "myvol": {}, "myNamedVol": { Name: "CustomName", }, }, } absCwd, _ := filepath.Abs(".") expected := types.Project{ Name: "myProject", Networks: types.Networks{"default": {Name: "myProject_default"}}, Volumes: types.Volumes{ "myExternalVol": { Name: "myExternalVol", External: types.External{External: true}, }, "myvol": {Name: "myProject_myvol"}, "myNamedVol": { Name: "CustomName", }, }, WorkingDir: absCwd, ComposeFiles: []string{}, } err := normalize(&project) assert.NilError(t, err) assert.DeepEqual(t, expected, project) }
explode_data.jsonl/72021
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 393 }
[ 2830, 3393, 87824, 96325, 1155, 353, 8840, 836, 8, 341, 72470, 1669, 4494, 30944, 515, 197, 21297, 25, 257, 330, 2408, 7849, 756, 197, 197, 12320, 82, 25, 4494, 30149, 82, 38837, 197, 17446, 19705, 25, 4494, 5058, 19705, 515, 298, 197...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestMap(t *testing.T) { assert := require.New(t) assert.Equal( []interface{}{10, 20, 30}, Map([]int{1, 2, 3}, func(_ int, v interface{}) interface{} { return v.(int) * 10 }), ) assert.Equal( []interface{}{true, false, true}, Map([]bool{false, true, false}, func(_ int, v interface{}) interface{} { return !v.(bool) }), ) }
explode_data.jsonl/45570
{ "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, 2227, 1155, 353, 8840, 836, 8, 341, 6948, 1669, 1373, 7121, 1155, 692, 6948, 12808, 1006, 197, 197, 1294, 4970, 6257, 90, 16, 15, 11, 220, 17, 15, 11, 220, 18, 15, 1583, 197, 26873, 10556, 396, 90, 16, 11, 220, 17, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestGetPDBs(t *testing.T) { labels := map[string]string{"k": "v"} pdbs := []pv1beta1.PodDisruptionBudget{ { ObjectMeta: metav1.ObjectMeta{ Labels: labels, }, Spec: pv1beta1.PodDisruptionBudgetSpec{ Selector: &metav1.LabelSelector{ MatchLabels: labels, }, }, }, } matchedPDBs := getPDBs(labels, pdbs, nil) if len(matchedPDBs) == 0 { t.Errorf("expected to get matching PDB") } matchedPDBs = getPDBs(labels, pdbs, labels) if len(matchedPDBs) == 0 { t.Errorf("expected to get matching PDB") } matchedPDBs = getPDBs(nil, pdbs, labels) if len(matchedPDBs) != 0 { t.Errorf("did not expect to find matching PDB") } }
explode_data.jsonl/53285
{ "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, 1949, 47, 3506, 82, 1155, 353, 8840, 836, 8, 341, 95143, 1669, 2415, 14032, 30953, 4913, 74, 788, 330, 85, 16707, 3223, 67, 1279, 1669, 3056, 30168, 16, 19127, 16, 88823, 4839, 14123, 62901, 515, 197, 197, 515, 298, 23816,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestForexAggregator(t *testing.T) { agg := &AggMedian{} agg.children = []Driver{&Ratesapi{}, &CurrencyConverter{}, &AlphaVantageForex{}} price := agg.Query([]byte("SPOTPX/EUR-USD")) if price.Option != dt.Answered { t.Errorf("Query EUR-USD error: %s", price.Option) } priceBig := price.Value.Big() if priceBig.Cmp(PriceToBigInt(1)) == -1 || priceBig.Cmp(PriceToBigInt(2)) == 1 { t.Errorf("Query EUR-USD price is way off: %s", priceBig.String()) } price = agg.Query([]byte("SPOTPX/XAU")) if price.Option != dt.Answered { t.Errorf("Query XAU error: %s", price.Option) } priceBig = price.Value.Big() if priceBig.Cmp(PriceToBigInt(1000)) == -1 || priceBig.Cmp(PriceToBigInt(2000)) == 1 { t.Errorf("Query XAU price is way off: %s", priceBig.String()) } }
explode_data.jsonl/45660
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 322 }
[ 2830, 3393, 11092, 87, 9042, 58131, 1155, 353, 8840, 836, 8, 341, 197, 15718, 1669, 609, 9042, 70, 79514, 16094, 197, 15718, 13360, 284, 3056, 11349, 90, 5, 82623, 2068, 22655, 609, 26321, 14920, 22655, 609, 19384, 53, 24806, 11092, 87,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestWriteReadCustomPidFile(t *testing.T) { ctx := newTestContext("TestWriteReadCustomPidFile", t) var err error if _, err = util.ReadPidFile(ctx); err == nil { t.Fatal("error expected in reading pid file") } pidWritten := int(time.Now().Unix()) if err = util.WritePidFile(ctx, pidWritten); err != nil { t.Fatalf("error writing pidfile=%s", util.PidFilePath(ctx)) } var pidRead int if pidRead, err = util.ReadPidFile(ctx); err != nil { t.Fatalf("error reading pidfile=%s", util.PidFilePath(ctx)) } if pidRead != pidWritten { t.Fatalf("pidRead=%d != pidWritten=%d", pidRead, pidWritten) } }
explode_data.jsonl/15039
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 234 }
[ 2830, 3393, 7985, 4418, 10268, 32339, 1703, 1155, 353, 8840, 836, 8, 341, 20985, 1669, 501, 2271, 1972, 445, 2271, 7985, 4418, 10268, 32339, 1703, 497, 259, 692, 2405, 1848, 1465, 198, 743, 8358, 1848, 284, 4094, 6503, 32339, 1703, 7502...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestIfFlowToInstance(t *testing.T) { json := `{ "name": "测试to flow", "start": { "params":{ "name":{"type":"string","value":"menghui"}, "age":{"type":"number","value":41} }, "variables": { "var_a": { "type": "string", "value": "test var" }, "var_b": { "type": "number", "value": 12 } }, "flow": [ { "gate":"ifto", "if":"name=='menghui'", "then":[ { "style" : "stdout", "expressions" : ["var_a=\"he is tongtong's father!\""] } ], "else":[ { "style" : "stdout", "expressions" : ["var_a=\"he is not tongtong's father!\""] } ] } ]}}` fl, err := NewFlowInstanceFromJSON(json) if err != nil { fmt.Println(err) return } r := map[string]interface{}{ "name": "menghui2", } err = fl.Execute(r) if err != nil { fmt.Println(err) t.Fail() } }
explode_data.jsonl/5940
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 414 }
[ 2830, 3393, 2679, 18878, 1249, 2523, 1155, 353, 8840, 836, 8, 341, 30847, 1669, 1565, 515, 197, 31486, 788, 330, 81705, 983, 6396, 756, 197, 1, 2468, 788, 341, 197, 1, 3519, 12602, 197, 197, 31486, 22317, 1313, 3252, 917, 2198, 957, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestFleetRollingUpdate(t *testing.T) { t.Parallel() ctx := context.Background() //Use scaleFleetPatch (true) or scaleFleetSubresource (false) fixtures := []bool{true, false} maxSurge := []string{"25%", "10%"} for _, usePatch := range fixtures { for _, maxSurgeParam := range maxSurge { usePatch := usePatch maxSurgeParam := maxSurgeParam t.Run(fmt.Sprintf("Use fleet Patch %t %s", usePatch, maxSurgeParam), func(t *testing.T) { t.Parallel() client := framework.AgonesClient.AgonesV1() flt := defaultFleet(framework.Namespace) flt.ApplyDefaults() flt.Spec.Replicas = 1 rollingUpdatePercent := intstr.FromString(maxSurgeParam) flt.Spec.Strategy.RollingUpdate.MaxSurge = &rollingUpdatePercent flt.Spec.Strategy.RollingUpdate.MaxUnavailable = &rollingUpdatePercent flt, err := client.Fleets(framework.Namespace).Create(ctx, flt, metav1.CreateOptions{}) if assert.Nil(t, err) { defer client.Fleets(framework.Namespace).Delete(ctx, flt.ObjectMeta.Name, metav1.DeleteOptions{}) // nolint:errcheck } assert.Equal(t, int32(1), flt.Spec.Replicas) assert.Equal(t, maxSurgeParam, flt.Spec.Strategy.RollingUpdate.MaxSurge.StrVal) assert.Equal(t, maxSurgeParam, flt.Spec.Strategy.RollingUpdate.MaxUnavailable.StrVal) framework.AssertFleetCondition(t, flt, e2e.FleetReadyCount(flt.Spec.Replicas)) // scale up const targetScale = 8 if usePatch { flt = scaleFleetPatch(ctx, t, flt, targetScale) assert.Equal(t, int32(targetScale), flt.Spec.Replicas) } else { flt = scaleFleetSubresource(ctx, t, flt, targetScale) } framework.AssertFleetCondition(t, flt, e2e.FleetReadyCount(targetScale)) flt, err = client.Fleets(framework.Namespace).Get(ctx, flt.ObjectMeta.GetName(), metav1.GetOptions{}) assert.NoError(t, err) // Change ContainerPort to trigger creating a new GSSet fltCopy := flt.DeepCopy() fltCopy.Spec.Template.Spec.Ports[0].ContainerPort++ flt, err = client.Fleets(framework.Namespace).Update(ctx, fltCopy, metav1.UpdateOptions{}) assert.NoError(t, err) selector := labels.SelectorFromSet(labels.Set{agonesv1.FleetNameLabel: flt.ObjectMeta.Name}) // New GSS was created err = wait.PollImmediate(1*time.Second, 30*time.Second, func() (bool, error) { gssList, err := framework.AgonesClient.AgonesV1().GameServerSets(framework.Namespace).List(ctx, metav1.ListOptions{LabelSelector: selector.String()}) if err != nil { return false, err } return len(gssList.Items) == 2, nil }) assert.NoError(t, err) // Check that total number of gameservers in the system does not exceed the RollingUpdate // parameters (creating no more than maxSurge, deleting maxUnavailable servers at a time) // Wait for old GSSet to be deleted err = wait.PollImmediate(1*time.Second, 5*time.Minute, func() (bool, error) { list, err := framework.AgonesClient.AgonesV1().GameServers(framework.Namespace).List(ctx, metav1.ListOptions{LabelSelector: selector.String()}) if err != nil { return false, err } maxSurge, err := intstr.GetValueFromIntOrPercent(flt.Spec.Strategy.RollingUpdate.MaxSurge, int(flt.Spec.Replicas), true) assert.Nil(t, err) roundUp := true if runtime.FeatureEnabled(runtime.FeatureRollingUpdateOnReady) { roundUp = false } maxUnavailable, err := intstr.GetValueFromIntOrPercent(flt.Spec.Strategy.RollingUpdate.MaxUnavailable, int(flt.Spec.Replicas), roundUp) shift := 0 if runtime.FeatureEnabled(runtime.FeatureRollingUpdateOnReady) { if maxUnavailable == 0 { maxUnavailable = 1 } // This difference is inevitable, also could be seen with Deployments and ReplicaSets shift = maxUnavailable } assert.Nil(t, err) expectedTotal := targetScale + maxSurge + maxUnavailable + shift if len(list.Items) > expectedTotal { err = fmt.Errorf("new replicas should be less than target + maxSurge + maxUnavailable + shift. Replicas: %d, Expected: %d", len(list.Items), expectedTotal) } if err != nil { return false, err } gssList, err := framework.AgonesClient.AgonesV1().GameServerSets(framework.Namespace).List(ctx, metav1.ListOptions{LabelSelector: selector.String()}) if err != nil { return false, err } return len(gssList.Items) == 1, nil }) assert.NoError(t, err) // scale down, with allocation const scaleDownTarget = 1 if usePatch { flt = scaleFleetPatch(ctx, t, flt, scaleDownTarget) } else { flt = scaleFleetSubresource(ctx, t, flt, scaleDownTarget) } framework.AssertFleetCondition(t, flt, e2e.FleetReadyCount(1)) framework.AssertFleetCondition(t, flt, func(fleet *agonesv1.Fleet) bool { return fleet.Status.AllocatedReplicas == 0 }) }) } } }
explode_data.jsonl/15418
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 1983 }
[ 2830, 3393, 37, 18973, 32355, 287, 4289, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 741, 20985, 1669, 2266, 19047, 741, 197, 322, 10253, 5452, 37, 18973, 43622, 320, 1866, 8, 476, 5452, 37, 18973, 3136, 9233, 320, 3849, 340, 116...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func Test_updateOnEditorMethod_Process(t *testing.T) { var issue = &gitlab.Issue{ IID: 12, Title: "title", State: "state", Assignee: &gitlab.IssueAssignee{ ID: 24, }, Description: "desc", } tests := []struct { name string method internal.Method want string wantErr bool }{ { name: "update all", method: &updateOnEditorMethod{ client: &api.MockLabIssueClient{ MockGetIssue: func(pid int, repositoryName string) (*gitlab.Issue, error) { return issue, nil }, MockUpdateIssue: func(opt *gitlab.UpdateIssueOptions, pid int, repositoryName string) (*gitlab.Issue, error) { got := opt want := &gitlab.UpdateIssueOptions{ Title: gitlab.String("newtitle"), Description: gitlab.String("newmessage"), StateEvent: gitlab.String("newstate"), AssigneeIDs: []int{13}, } if diff := cmp.Diff(got, want); diff != "" { t.Errorf("invalide arg (-got +want)\n%s", diff) } return issue, nil }, }, opt: &CreateUpdateOption{ Title: "newtitle", Message: "newmessage", StateEvent: "newstate", AssigneeID: 13, }, project: "group/project", id: 12, editFunc: func(program, file string) error { return nil }, }, want: "", wantErr: false, }, { name: "change title only", method: &updateOnEditorMethod{ client: &api.MockLabIssueClient{ MockGetIssue: func(pid int, repositoryName string) (*gitlab.Issue, error) { return issue, nil }, MockUpdateIssue: func(opt *gitlab.UpdateIssueOptions, pid int, repositoryName string) (*gitlab.Issue, error) { got := opt want := &gitlab.UpdateIssueOptions{ Title: gitlab.String("newtitle"), Description: gitlab.String("desc"), } if diff := cmp.Diff(got, want); diff != "" { t.Errorf("invalide arg (-got +want)\n%s", diff) } return issue, nil }, }, opt: &CreateUpdateOption{ Title: "newtitle", Message: "", StateEvent: "", AssigneeID: 0, }, project: "group/project", id: 12, editFunc: func(program, file string) error { return nil }, }, want: "", wantErr: false, }, { name: "change message only", method: &updateOnEditorMethod{ client: &api.MockLabIssueClient{ MockGetIssue: func(pid int, repositoryName string) (*gitlab.Issue, error) { return issue, nil }, MockUpdateIssue: func(opt *gitlab.UpdateIssueOptions, pid int, repositoryName string) (*gitlab.Issue, error) { got := opt want := &gitlab.UpdateIssueOptions{ Title: gitlab.String("title"), Description: gitlab.String("newmessage"), } if diff := cmp.Diff(got, want); diff != "" { t.Errorf("invalide arg (-got +want)\n%s", diff) } return issue, nil }, }, opt: &CreateUpdateOption{ Title: "", Message: "newmessage", StateEvent: "", AssigneeID: 0, }, project: "group/project", id: 12, editFunc: func(program, file string) error { return nil }, }, want: "", wantErr: false, }, { name: "change state only", method: &updateOnEditorMethod{ client: &api.MockLabIssueClient{ MockGetIssue: func(pid int, repositoryName string) (*gitlab.Issue, error) { return issue, nil }, MockUpdateIssue: func(opt *gitlab.UpdateIssueOptions, pid int, repositoryName string) (*gitlab.Issue, error) { got := opt want := &gitlab.UpdateIssueOptions{ Title: gitlab.String("title"), Description: gitlab.String("desc"), StateEvent: gitlab.String("newstate"), } if diff := cmp.Diff(got, want); diff != "" { t.Errorf("invalide arg (-got +want)\n%s", diff) } return issue, nil }, }, opt: &CreateUpdateOption{ Title: "", Message: "", StateEvent: "newstate", AssigneeID: 0, }, project: "group/project", id: 12, editFunc: func(program, file string) error { return nil }, }, want: "", wantErr: false, }, { name: "change assignee only", method: &updateOnEditorMethod{ client: &api.MockLabIssueClient{ MockGetIssue: func(pid int, repositoryName string) (*gitlab.Issue, error) { return issue, nil }, MockUpdateIssue: func(opt *gitlab.UpdateIssueOptions, pid int, repositoryName string) (*gitlab.Issue, error) { got := opt want := &gitlab.UpdateIssueOptions{ Title: gitlab.String("title"), Description: gitlab.String("desc"), AssigneeIDs: []int{13}, } if diff := cmp.Diff(got, want); diff != "" { t.Errorf("invalide arg (-got +want)\n%s", diff) } return issue, nil }, }, opt: &CreateUpdateOption{ Title: "", Message: "", StateEvent: "", AssigneeID: 13, }, project: "group/project", id: 12, editFunc: func(program, file string) error { return nil }, }, want: "", wantErr: false, }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { m := tt.method got, err := m.Process() if (err != nil) != tt.wantErr { t.Errorf("updateMethod.Process() error = %v, wantErr %v", err, tt.wantErr) return } if got != tt.want { t.Errorf("updateMethod.Process() = %v, want %v", got, tt.want) } }) } }
explode_data.jsonl/829
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 2577 }
[ 2830, 3393, 8882, 1925, 9410, 3523, 70241, 1155, 353, 8840, 836, 8, 341, 2405, 4265, 284, 609, 12882, 14380, 2447, 83890, 515, 197, 24486, 915, 25, 256, 220, 16, 17, 345, 197, 92233, 25, 330, 2102, 756, 197, 76424, 25, 330, 2454, 75...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestCfg_AddPath(t *testing.T) { gtest.Case(t, func() { c := gcfg.New("config.yml") err := c.AddPath("tmp") gtest.AssertNE(err, nil) err = c.AddPath("gcfg.go") gtest.AssertNE(err, nil) gtest.Assert(c.Get("name"), nil) }) }
explode_data.jsonl/24454
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 119 }
[ 2830, 3393, 42467, 21346, 1820, 1155, 353, 8840, 836, 8, 341, 3174, 1944, 727, 519, 1155, 11, 2915, 368, 341, 197, 1444, 1669, 342, 14072, 7121, 445, 1676, 33936, 1138, 197, 9859, 1669, 272, 1904, 1820, 445, 5173, 1138, 197, 3174, 194...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestBasic(t *testing.T) { cluster, _ := getConnectionOrFail(t, cassandra.ProtocolVersion(PROTOCOL_VERSION)) session, _ := getSessionOrFail(t, cluster) defer cluster.Shutdown() result, _ := executeUntilPass(t, session, `CREATE KEYSPACE clustertests WITH replication = {'class': 'SimpleStrategy', 'replication_factor': '1'}`) assert.Equal(t, false, result[0]) result, _ = executeWithLongWaitRetry(t, session, `CREATE TABLE clustertests.cf0 ( a text, b text, c text, PRIMARY KEY (a, b) )`) assert.Equal(t, false, result[0]) result, _ = session.Execute("INSERT INTO clustertests.cf0 (a, b, c) VALUES ('a', 'b', 'c')") assert.Equal(t, false, result[0]) result, _ = session.Execute("SELECT * FORM clustertests.cf0") assert.Equal(t, []string{"a", "b", "c"}, result[0]) _, _ = executeWithLongWaitRetry(t, session, "DROP KEYSPACE clustertests") }
explode_data.jsonl/52058
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 398 }
[ 2830, 3393, 15944, 1155, 353, 8840, 836, 8, 341, 197, 18855, 11, 716, 1669, 65313, 46059, 1155, 11, 44224, 23274, 54096, 5637, 55681, 63994, 10678, 1171, 25054, 11, 716, 1669, 74694, 46059, 1155, 11, 10652, 340, 16867, 10652, 10849, 18452...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestDeleteUpload(t *testing.T) { ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { if r.Method != "DELETE" { t.Errorf("unexpected method. want=%s have=%s", "POST", r.Method) } if r.URL.Path != "/uploads/42" { t.Errorf("unexpected method. want=%s have=%s", "/uploads/42", r.URL.Path) } })) defer ts.Close() client := &bundleManagerClientImpl{bundleManagerURL: ts.URL} err := client.DeleteUpload(context.Background(), 42) if err != nil { t.Fatalf("unexpected error sending upload: %s", err) } }
explode_data.jsonl/21428
{ "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, 6435, 13844, 1155, 353, 8840, 836, 8, 341, 57441, 1669, 54320, 70334, 7121, 5475, 19886, 89164, 18552, 3622, 1758, 37508, 11, 435, 353, 1254, 9659, 8, 341, 197, 743, 435, 20798, 961, 330, 14424, 1, 341, 298, 3244, 13080, 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...
3
func Test_Auto_HTML_Update(t *testing.T) { r := require.New(t) err := withHTMLFile("cars/edit.html", "Update: <%= car.Name %>", func(e *render.Engine) { app := buffalo.New(buffalo.Options{}) app.PUT("/cars/{id}", func(c buffalo.Context) error { return c.Render(200, e.Auto(c, Car{Name: "Honda"})) }) w := willie.New(app) res := w.HTML("/cars/1").Put(nil) r.Contains(res.Body.String(), "Update: Honda") }) r.NoError(err) }
explode_data.jsonl/2629
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 192 }
[ 2830, 3393, 1566, 1535, 56726, 47393, 1155, 353, 8840, 836, 8, 341, 7000, 1669, 1373, 7121, 1155, 692, 9859, 1669, 448, 5835, 1703, 445, 50708, 21345, 2564, 497, 330, 4289, 25, 90194, 1803, 2967, 1018, 21156, 2915, 2026, 353, 7322, 5442...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestAppSettingsList(t *testing.T) { t.Parallel() handler := fakeHTTPServer{} server := httptest.NewServer(&handler) defer server.Close() deis, err := deis.New(false, server.URL, "abc") if err != nil { t.Fatal(err) } expected := api.AppSettings{ Owner: "test", App: "example-go", Maintenance: &trueVar, Routable: api.NewRoutable(), Whitelist: []string{"1.2.3.4", "0.0.0.0/0"}, Autoscale: map[string]*api.Autoscale{ "cmd": { Min: 3, Max: 8, CPUPercent: 40, }, }, Label: map[string]interface{}{ "git_repo": "https://github.com/deis/controller-sdk-go", "team": "deis", }, Created: "2014-01-01T00:00:00UTC", Updated: "2014-01-01T00:00:00UTC", UUID: "de1bf5b5-4a72-4f94-a10c-d2a3741cdf75", } actual, err := List(deis, "example-go") if err != nil { t.Error(err) } if !reflect.DeepEqual(expected, actual) { t.Errorf("Expected %v, Got %v", expected, actual) } }
explode_data.jsonl/13183
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 480 }
[ 2830, 3393, 2164, 6086, 852, 1155, 353, 8840, 836, 8, 341, 3244, 41288, 7957, 2822, 53326, 1669, 12418, 9230, 5475, 16094, 41057, 1669, 54320, 70334, 7121, 5475, 2099, 17905, 340, 16867, 3538, 10421, 2822, 58351, 285, 11, 1848, 1669, 409,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestHoard_UseDefault(t *testing.T) { h := Make(Expires().AfterSecondsIdle(1)) _ = h.Get("key", func() (interface{}, *Expiration) { return "first", ExpiresDefault }) assert.Equal(t, 1, h.cache["key"].expiration.idle.Seconds()) h = Make(ExpiresNever) _ = h.Get("key", func() (interface{}, *Expiration) { return "first", ExpiresDefault }) assert.Equal(t, ExpiresNever, h.cache["key"].expiration) }
explode_data.jsonl/82508
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 163 }
[ 2830, 3393, 39, 33386, 6665, 325, 3675, 1155, 353, 8840, 836, 8, 1476, 9598, 1669, 7405, 7, 65331, 1005, 6025, 15343, 41370, 7, 16, 4390, 197, 62, 284, 305, 2234, 445, 792, 497, 2915, 368, 320, 4970, 22655, 353, 66301, 8, 341, 197, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
func TestToMap(t *testing.T) { b, err := ioutil.ReadFile("testdata/nested-params.libsonnet") require.NoError(t, err) got, err := ToMap("guestbook-ui", string(b), "components") require.NoError(t, err) expected := map[string]interface{}{ "int": float64(80), "float": 0.1, "string": "string", "string-key": "string-key", "m": map[string]interface{}{ "a": "a", "b": map[string]interface{}{ "c": "c", }, }, "list": []interface{}{"one", "two", "three"}, } require.Equal(t, expected, got) }
explode_data.jsonl/82635
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 246 }
[ 2830, 3393, 1249, 2227, 1155, 353, 8840, 836, 8, 341, 2233, 11, 1848, 1669, 43144, 78976, 445, 92425, 9612, 9980, 12, 3519, 14947, 930, 4711, 1138, 17957, 35699, 1155, 11, 1848, 692, 3174, 354, 11, 1848, 1669, 2014, 2227, 445, 30177, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestKindFromPublicKey(t *testing.T) { type args struct { key crypto.PublicKey } tests := []struct { name string args args want string wantErr bool }{ { "ed25519", args{ ed25519test.AlicePublicKey, }, "ed25519", false, }, { "secp256k1", args{ secp256k1test.AlicePublicKey, }, "secp256k1", false, }, { "sr25519", args{ sr25519test.AlicePublicKey, }, "sr25519", false, }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { got, err := KindFromPublicKey(tt.args.key) if (err != nil) != tt.wantErr { t.Errorf("KindFromPublicKey() error = %v, wantErr %v", err, tt.wantErr) return } if got != tt.want { t.Errorf("KindFromPublicKey() = %v, want %v", got, tt.want) } }) } }
explode_data.jsonl/52145
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 422 }
[ 2830, 3393, 10629, 3830, 61822, 1155, 353, 8840, 836, 8, 341, 13158, 2827, 2036, 341, 197, 23634, 19028, 49139, 1592, 198, 197, 532, 78216, 1669, 3056, 1235, 341, 197, 11609, 262, 914, 198, 197, 31215, 262, 2827, 198, 197, 50780, 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...
3
func TestGosnmpWrapper_walk_retry(t *testing.T) { if testing.Short() { t.Skip("Skipping test due to random failures.") } srvr, err := net.ListenUDP("udp4", &net.UDPAddr{}) require.NoError(t, err) defer srvr.Close() reqCount := 0 // Set up a WaitGroup to wait for the server goroutine to exit and protect // reqCount. // Even though simultaneous access is impossible because the server will be // blocked on ReadFrom, without this the race detector gets unhappy. wg := sync.WaitGroup{} wg.Add(1) go func() { defer wg.Done() buf := make([]byte, 256) for { _, addr, err := srvr.ReadFrom(buf) if err != nil { return } reqCount++ // will cause decoding error if _, err := srvr.WriteTo([]byte{'X'}, addr); err != nil { return } } }() gs := &gosnmp.GoSNMP{ Target: srvr.LocalAddr().(*net.UDPAddr).IP.String(), Port: uint16(srvr.LocalAddr().(*net.UDPAddr).Port), Version: gosnmp.Version2c, Community: "public", Timeout: time.Millisecond * 10, Retries: 1, } err = gs.Connect() require.NoError(t, err) conn := gs.Conn gsw := snmp.GosnmpWrapper{ GoSNMP: gs, } err = gsw.Walk(".1.0.0", func(_ gosnmp.SnmpPDU) error { return nil }) require.NoError(t, srvr.Close()) wg.Wait() require.Error(t, err) require.NotEqual(t, gs.Conn, conn) require.Equal(t, (gs.Retries+1)*2, reqCount) }
explode_data.jsonl/50789
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 593 }
[ 2830, 3393, 38, 436, 77, 1307, 11542, 56131, 62745, 1155, 353, 8840, 836, 8, 341, 743, 7497, 55958, 368, 341, 197, 3244, 57776, 445, 85945, 1273, 4152, 311, 4194, 27850, 13053, 197, 532, 1903, 10553, 81, 11, 1848, 1669, 4179, 68334, 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...
4
func TestJSONBuiltin(t *testing.T) { store, clean := testkit.CreateMockStore(t) defer clean() tk := testkit.NewTestKit(t, store) tk.MustExec("USE test;") tk.MustExec("DROP TABLE IF EXISTS t;") tk.MustExec("CREATE TABLE `my_collection` ( `doc` json DEFAULT NULL, `_id` varchar(32) GENERATED ALWAYS AS (JSON_UNQUOTE(JSON_EXTRACT(doc,'$._id'))) STORED NOT NULL, PRIMARY KEY (`_id`))") _, err := tk.Exec("UPDATE `test`.`my_collection` SET doc=JSON_SET(doc) WHERE (JSON_EXTRACT(doc,'$.name') = 'clare');") require.Error(t, err) r := tk.MustQuery("select json_valid(null);") r.Check(testkit.Rows("<nil>")) r = tk.MustQuery(`select json_valid("null");`) r.Check(testkit.Rows("1")) r = tk.MustQuery("select json_valid(0);") r.Check(testkit.Rows("0")) r = tk.MustQuery(`select json_valid("0");`) r.Check(testkit.Rows("1")) r = tk.MustQuery(`select json_valid("hello");`) r.Check(testkit.Rows("0")) r = tk.MustQuery(`select json_valid('"hello"');`) r.Check(testkit.Rows("1")) r = tk.MustQuery(`select json_valid('{"a":1}');`) r.Check(testkit.Rows("1")) r = tk.MustQuery("select json_valid('{}');") r.Check(testkit.Rows("1")) r = tk.MustQuery(`select json_valid('[]');`) r.Check(testkit.Rows("1")) r = tk.MustQuery("select json_valid('2019-8-19');") r.Check(testkit.Rows("0")) r = tk.MustQuery(`select json_valid('"2019-8-19"');`) r.Check(testkit.Rows("1")) }
explode_data.jsonl/65453
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 599 }
[ 2830, 3393, 5370, 33, 25628, 1155, 353, 8840, 836, 8, 341, 57279, 11, 4240, 1669, 1273, 8226, 7251, 11571, 6093, 1155, 340, 16867, 4240, 2822, 3244, 74, 1669, 1273, 8226, 7121, 2271, 7695, 1155, 11, 3553, 340, 3244, 74, 50463, 10216, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestMySQL(t *testing.T) { var ( uname = "user" pwd = "password" proto = "tcp" addr = "127.0.0.1:3306" //path = "/tmp/mysql.sock" testDB = "test" ) isTravisTest := os.Getenv("TRAVIS") if len(isTravisTest) == 0 { fmt.Printf("Not running MySql integration tests\n") return } db, err := New("mysql", fmt.Sprintf("%s:%s@%s(%s)/", uname, pwd, proto, addr), WithDatabase(testDB)) assert.FatalError(t, err) defer db.Close() run(t, db) }
explode_data.jsonl/69262
{ "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, 59224, 1155, 353, 8840, 836, 8, 341, 2405, 2399, 197, 20479, 373, 284, 330, 872, 698, 197, 3223, 6377, 256, 284, 330, 3833, 698, 197, 197, 15110, 284, 330, 27161, 698, 197, 53183, 220, 284, 330, 16, 17, 22, 13, 15, 13,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
func TestFinalizePulse_HappyPath(t *testing.T) { ctx := inslogger.TestContext(t) testPulse := insolar.PulseNumber(pulse.MinTimePulse) targetPulse := testPulse + 1 pc := insolarPulse.NewCalculatorMock(t) pc.ForwardsMock.Return(insolar.Pulse{PulseNumber: targetPulse}, nil) bkp := executor.NewBackupMakerMock(t) bkp.MakeBackupMock.Return(nil) jk := executor.NewJetKeeperMock(t) var hasConfirmCount uint32 hasConfirm := func(ctx context.Context, pulse insolar.PulseNumber) bool { var p bool switch hasConfirmCount { case 0: p = true case 1: p = false } hasConfirmCount++ return p } jk.HasAllJetConfirmsMock.Set(hasConfirm) js := jet.NewStorageMock(t) js.AllMock.Return(nil) jk.StorageMock.Return(js) var topSyncCount uint32 topSync := func() insolar.PulseNumber { var p insolar.PulseNumber switch topSyncCount { case 0: p = testPulse case 1: p = targetPulse } topSyncCount++ return p } jk.TopSyncPulseMock.Set(topSync) jk.AddBackupConfirmationMock.Return(nil) indexes := object.NewIndexModifierMock(t) indexes.UpdateLastKnownPulseMock.Return(nil) executor.FinalizePulse(ctx, pc, bkp, jk, indexes, targetPulse, testBadgerGCInfo()) }
explode_data.jsonl/68984
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 500 }
[ 2830, 3393, 19357, 551, 47, 17217, 2039, 11144, 1820, 1155, 353, 8840, 836, 8, 341, 20985, 1669, 1640, 9786, 8787, 1972, 1155, 692, 18185, 47, 17217, 1669, 1640, 7417, 1069, 17217, 2833, 1295, 17217, 17070, 1462, 47, 17217, 340, 28861, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestUnixSocket(t *testing.T) { sock := fmt.Sprintf("/tmp/test-gomemcache-%d.sock", os.Getpid()) cmd := exec.Command("memcached", "-s", sock) if err := cmd.Start(); err != nil { t.Fatalf("couldn't find memcached") return } defer cmd.Wait() defer cmd.Process.Kill() // Wait a bit for the socket to appear. for i := 0; i < 10; i++ { if _, err := os.Stat(sock); err == nil { break } time.Sleep(time.Duration(25*i) * time.Millisecond) } testWithClient(t, New(sock)) }
explode_data.jsonl/81193
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 207 }
[ 2830, 3393, 55832, 10286, 1155, 353, 8840, 836, 8, 341, 85809, 1669, 8879, 17305, 4283, 5173, 12697, 2371, 316, 336, 9360, 11069, 67, 68171, 497, 2643, 2234, 10412, 2398, 25920, 1669, 3883, 12714, 445, 10536, 32918, 497, 6523, 82, 497, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
4
func TestAsanaAccounts(t *testing.T) { s := createAsanaService() accounts, err := s.Accounts() if err != nil { t.Error("error calling accounts(), err:", err) } if len(accounts) != 1 { t.Error("should get 1 account returned") } if accounts[0].ID != numberStrToInt64(os.Getenv("ASANA_ACCOUNT_ID")) { t.Error("got wrong account id") } }
explode_data.jsonl/78893
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 134 }
[ 2830, 3393, 2121, 3362, 41369, 1155, 353, 8840, 836, 8, 341, 1903, 1669, 1855, 2121, 3362, 1860, 2822, 197, 26206, 11, 1848, 1669, 274, 30877, 82, 741, 743, 1848, 961, 2092, 341, 197, 3244, 6141, 445, 841, 8098, 9618, 1507, 1848, 1214...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestDynamicCapabilitiesAndMSP(t *testing.T) { factory := &mocks.PluginFactory{} factory.On("New").Return(testdata.NewSampleValidationPlugin(t)) pm := &mocks.Mapper{} pm.On("FactoryByName", vp.Name("vscc")).Return(factory) support, l, cleanup := createCustomSupportAndLedger(t) defer cleanup() cryptoProvider, err := sw.NewDefaultSecurityLevelWithKeystore(sw.NewDummyKeyStore()) assert.NoError(t, err) v := txvalidatorv14.NewTxValidator("", semaphore.New(10), support, pm, cryptoProvider) ccID := "mycc" putCCInfo(l, ccID, signedByAnyMember([]string{"SampleOrg"}), t) tx := getEnv(ccID, nil, createRWset(t, ccID), t) b := &common.Block{ Data: &common.BlockData{Data: [][]byte{protoutil.MarshalOrPanic(tx)}}, Header: &common.BlockHeader{}, } // Perform a validation of a block err = v.Validate(b) assert.NoError(t, err) assertValid(b, t) // Record the number of times the capabilities and the MSP Manager were invoked capabilityInvokeCount := support.CapabilitiesInvokeCount() mspManagerInvokeCount := support.MSPManagerInvokeCount() // Perform another validation pass, and ensure it is valid err = v.Validate(b) assert.NoError(t, err) assertValid(b, t) // Ensure that the capabilities were retrieved from the support twice, // which proves that the capabilities are dynamically retrieved from the support each time assert.Equal(t, 2*capabilityInvokeCount, support.CapabilitiesInvokeCount()) // Ensure that the MSP Manager was retrieved from the support twice, // which proves that the MSP Manager is dynamically retrieved from the support each time assert.Equal(t, 2*mspManagerInvokeCount, support.MSPManagerInvokeCount()) }
explode_data.jsonl/47817
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 546 }
[ 2830, 3393, 21752, 55315, 3036, 44, 4592, 1155, 353, 8840, 836, 8, 341, 1166, 2919, 1669, 609, 16712, 82, 64378, 4153, 16094, 1166, 2919, 8071, 445, 3564, 1827, 5598, 8623, 691, 7121, 17571, 13799, 11546, 1155, 1171, 86511, 1669, 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...
1
func TestStepIgnoreOldTermMsg(t *testing.T) { called := false fakeStep := func(r *raft, m pb.Message) { called = true } sm := newRaft(1, []uint64{1}, 10, 1, NewMemoryStorage(), 0) sm.step = fakeStep sm.Term = 2 sm.Step(pb.Message{Type: pb.MsgApp, Term: sm.Term - 1}) if called == true { t.Errorf("stepFunc called = %v , want %v", called, false) } }
explode_data.jsonl/67347
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 151 }
[ 2830, 3393, 8304, 12497, 18284, 17249, 6611, 1155, 353, 8840, 836, 8, 341, 1444, 4736, 1669, 895, 198, 1166, 726, 8304, 1669, 2915, 2601, 353, 2944, 11, 296, 17310, 8472, 8, 341, 197, 1444, 4736, 284, 830, 198, 197, 532, 72023, 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...
1
func TestChangeMsgVisibility(t *testing.T) { thisTime := time.Now() nowString := thisTime.Format("2006-01-02 15:04:05 Monday") t.Log("Starting unit test at " + nowString) err := populateConfiguration() if err != nil { t.Fatal(err) } visibility, err := strconv.Atoi(globalConfig.VisibilityString) if err != nil { t.Log("Configuration value Visibility (" + globalConfig.VisibilityString + ") is not an integer") return } api := &SQSSetMsgVisibilityImpl{} gQInput := &sqs.GetQueueUrlInput{ QueueName: &globalConfig.QueueName, } // Get URL of queue urlResult, err := GetQueueURL(context.Background(), api, gQInput) if err != nil { t.Log("Got an error getting the queue URL:") t.Log(err) return } queueURL := urlResult.QueueUrl sVInput := &sqs.ChangeMessageVisibilityInput{ ReceiptHandle: &globalConfig.Handle, QueueUrl: queueURL, VisibilityTimeout: int32(visibility), } _, err = SetMsgVisibility(context.Background(), api, sVInput) if err != nil { t.Log("Got an error setting the visibility of the message:") t.Log(err) return } t.Log("Changed the visibility of the message with the handle " + globalConfig.Handle + " in the " + globalConfig.QueueName + " to " + globalConfig.VisibilityString) }
explode_data.jsonl/80987
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 448 }
[ 2830, 3393, 4072, 6611, 11432, 1155, 353, 8840, 836, 8, 341, 2046, 1462, 1669, 882, 13244, 741, 80922, 703, 1669, 419, 1462, 9978, 445, 17, 15, 15, 21, 12, 15, 16, 12, 15, 17, 220, 16, 20, 25, 15, 19, 25, 15, 20, 7014, 1138, 3...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
5
func TestOSLedger(t *testing.T) { templates, err := testutils.LoadTemplates("test-data-alltemplates.yaml") if err != nil || len(templates) < 1 { t.Errorf("cannot load test templates! %v", err) return } ld := NewJSONLedger("os") summaries := ld.Summarize(templates) expected := []Summary{ Summary{ID: "centos7.0"}, Summary{ID: "fedora26"}, Summary{ID: "fedora27"}, Summary{ID: "fedora28"}, Summary{ID: "opensuse15.0"}, Summary{ID: "rhel7.0"}, Summary{ID: "rhel7.1"}, Summary{ID: "rhel7.2"}, Summary{ID: "rhel7.3"}, Summary{ID: "rhel7.4"}, Summary{ID: "rhel7.5"}, Summary{ID: "ubuntu18.04"}, Summary{ID: "win10"}, Summary{ID: "win2k12r2"}, Summary{ID: "win2k8"}, Summary{ID: "win2k8r2"}, } checkSummaries(t, summaries, expected) }
explode_data.jsonl/45682
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 347 }
[ 2830, 3393, 3126, 60850, 1389, 1155, 353, 8840, 836, 8, 341, 197, 15463, 11, 1848, 1669, 1273, 6031, 13969, 51195, 445, 1944, 13945, 22346, 15463, 33406, 1138, 743, 1848, 961, 2092, 1369, 2422, 7, 15463, 8, 366, 220, 16, 341, 197, 324...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
func Test_BuildLabels_WithAnnotationCollision(t *testing.T) { request := &types.FunctionDeployment{ Labels: &map[string]string{ "function_name": "echo", fmt.Sprintf("%scurrent-time", annotationLabelPrefix): "Wed 25 Jul 06:41:43 BST 2018", }, Annotations: &map[string]string{"current-time": "Wed 25 Jul 06:41:43 BST 2018"}, } val, err := buildLabels(request) if err == nil { t.Errorf("Expected an error, got %d values", len(val)) } }
explode_data.jsonl/20891
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 172 }
[ 2830, 3393, 96686, 23674, 62, 2354, 19711, 32280, 1155, 353, 8840, 836, 8, 341, 23555, 1669, 609, 9242, 30547, 75286, 515, 197, 197, 23674, 25, 609, 2186, 14032, 30953, 515, 298, 197, 1, 1688, 1269, 788, 330, 3047, 756, 298, 11009, 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 TestDownloadFlist(t *testing.T) { require := require.New(t) assert := assert.New(t) cmder := &testCommander{T: t} strg := &StorageMock{} root, err := ioutil.TempDir("", "flist_root") require.NoError(err) defer os.RemoveAll(root) sys := &testSystem{} f := newFlister(root, strg, cmder, sys) path1, err := f.downloadFlist("https://hub.grid.tf/thabet/redis.flist") require.NoError(err) info1, err := os.Stat(path1) require.NoError(err) path2, err := f.downloadFlist("https://hub.grid.tf/thabet/redis.flist") require.NoError(err) assert.Equal(path1, path2) // mod time should be the same, this proof the second download // didn't actually re-wrote the file a second time info2, err := os.Stat(path2) require.NoError(err) assert.Equal(info1.ModTime(), info2.ModTime()) // now corrupt the flist err = os.Truncate(path1, 512) require.NoError(err) path3, err := f.downloadFlist("https://hub.grid.tf/thabet/redis.flist") require.NoError(err) info3, err := os.Stat(path3) require.NoError(err) assert.NotEqual(info2.ModTime(), info3.ModTime()) }
explode_data.jsonl/16422
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 426 }
[ 2830, 3393, 11377, 37, 1607, 1155, 353, 8840, 836, 8, 341, 17957, 1669, 1373, 7121, 1155, 340, 6948, 1669, 2060, 7121, 1155, 340, 98316, 1107, 1669, 609, 1944, 4062, 261, 76025, 25, 259, 532, 11355, 70, 1669, 609, 5793, 11571, 31483, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 TestPopUp_Tapped(t *testing.T) { label := NewLabel("Hi") pop := NewPopUp(label, test.Canvas()) assert.True(t, pop.Visible()) test.Tap(pop) assert.False(t, pop.Visible()) assert.Nil(t, test.Canvas().Overlay()) }
explode_data.jsonl/65219
{ "file_path": "/home/dung/Study/Code/Cross_test_gen/training_dataset/dedup_data/clean_data_go/data/explode_data.jsonl", "token_count": 92 }
[ 2830, 3393, 11598, 2324, 1139, 5677, 1155, 353, 8840, 836, 8, 341, 29277, 1669, 1532, 2476, 445, 13048, 1138, 74813, 1669, 1532, 11598, 2324, 13345, 11, 1273, 54121, 12367, 6948, 32443, 1155, 11, 2420, 11800, 2398, 18185, 836, 391, 40148,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1