@@ -14,59 +14,6 @@ import (
1414 api "code.gitea.io/gitea/modules/structs"
1515)
1616
17- func BenchmarkRepo (b * testing.B ) {
18- b .Skip ("benchmark broken" ) // TODO fix
19- samples := []struct {
20- url string
21- name string
22- skipShort bool
23- }{
24- {url : "https://github.com/go-gitea/test_repo.git" , name : "test_repo" },
25- {url : "https://github.com/ethantkoenig/manyfiles.git" , name : "manyfiles" , skipShort : true },
26- }
27- defer prepareTestEnv (b )()
28- session := loginUser (b , "user2" )
29- b .ResetTimer ()
30-
31- for _ , s := range samples {
32- b .Run (s .name , func (b * testing.B ) {
33- if testing .Short () && s .skipShort {
34- b .Skip ("skipping test in short mode." )
35- }
36- b .Run ("Migrate " + s .name , func (b * testing.B ) {
37- for i := 0 ; i < b .N ; i ++ {
38- req := NewRequestf (b , "DELETE" , "/api/v1/repos/%s/%s" , "user2" , s .name )
39- session .MakeRequest (b , req , NoExpectedStatus )
40- testRepoMigrate (b , session , s .url , s .name )
41- }
42- })
43- b .Run ("Access" , func (b * testing.B ) {
44- var branches []* api.Branch
45- b .Run ("APIBranchList" , func (b * testing.B ) {
46- for i := 0 ; i < b .N ; i ++ {
47- req := NewRequestf (b , "GET" , "/api/v1/repos/%s/%s/branches?page=1&limit=1" , "user2" , s .name )
48- resp := session .MakeRequest (b , req , http .StatusOK )
49- b .StopTimer ()
50- if len (branches ) == 0 {
51- DecodeJSON (b , resp , & branches ) //Store for next phase
52- }
53- b .StartTimer ()
54- }
55- })
56-
57- if len (branches ) == 1 {
58- b .Run ("WebViewCommit" , func (b * testing.B ) {
59- for i := 0 ; i < b .N ; i ++ {
60- req := NewRequestf (b , "GET" , "/%s/%s/commit/%s" , "user2" , s .name , branches [0 ].Commit .ID )
61- session .MakeRequest (b , req , http .StatusOK )
62- }
63- })
64- }
65- })
66- })
67- }
68- }
69-
7017// StringWithCharset random string (from https://www.calhoun.io/creating-random-strings-in-go/)
7118func StringWithCharset (length int , charset string ) string {
7219 b := make ([]byte , length )
0 commit comments