Skip to content

Commit

Permalink
rm total broken "BenchmarkRepo"
Browse files Browse the repository at this point in the history
  • Loading branch information
6543 committed Apr 11, 2021
1 parent c22b916 commit e19a0d5
Showing 1 changed file with 0 additions and 53 deletions.
53 changes: 0 additions & 53 deletions integrations/benchmarks_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,59 +14,6 @@ import (
api "code.gitea.io/gitea/modules/structs"
)

func BenchmarkRepo(b *testing.B) {
b.Skip("benchmark broken") // TODO fix
samples := []struct {
url string
name string
skipShort bool
}{
{url: "https://github.com/go-gitea/test_repo.git", name: "test_repo"},
{url: "https://github.com/ethantkoenig/manyfiles.git", name: "manyfiles", skipShort: true},
}
defer prepareTestEnv(b)()
session := loginUser(b, "user2")
b.ResetTimer()

for _, s := range samples {
b.Run(s.name, func(b *testing.B) {
if testing.Short() && s.skipShort {
b.Skip("skipping test in short mode.")
}
b.Run("Migrate "+s.name, func(b *testing.B) {
for i := 0; i < b.N; i++ {
req := NewRequestf(b, "DELETE", "/api/v1/repos/%s/%s", "user2", s.name)
session.MakeRequest(b, req, NoExpectedStatus)
testRepoMigrate(b, session, s.url, s.name)
}
})
b.Run("Access", func(b *testing.B) {
var branches []*api.Branch
b.Run("APIBranchList", func(b *testing.B) {
for i := 0; i < b.N; i++ {
req := NewRequestf(b, "GET", "/api/v1/repos/%s/%s/branches?page=1&limit=1", "user2", s.name)
resp := session.MakeRequest(b, req, http.StatusOK)
b.StopTimer()
if len(branches) == 0 {
DecodeJSON(b, resp, &branches) //Store for next phase
}
b.StartTimer()
}
})

if len(branches) == 1 {
b.Run("WebViewCommit", func(b *testing.B) {
for i := 0; i < b.N; i++ {
req := NewRequestf(b, "GET", "/%s/%s/commit/%s", "user2", s.name, branches[0].Commit.ID)
session.MakeRequest(b, req, http.StatusOK)
}
})
}
})
})
}
}

// StringWithCharset random string (from https://www.calhoun.io/creating-random-strings-in-go/)
func StringWithCharset(length int, charset string) string {
b := make([]byte, length)
Expand Down

0 comments on commit e19a0d5

Please sign in to comment.