@@ -110,31 +110,30 @@ func getExpectedFileResponseForCreate(repoFullName, commitID, treePath, latestCo
110110}
111111
112112func BenchmarkAPICreateFileSmall (b * testing.B ) {
113- onGiteaRunTB (b , func (t testing.TB , u * url.URL ) {
114- b := t .(* testing.B )
115- user2 := unittest .AssertExistsAndLoadBean (t , & user_model.User {ID : 2 }) // owner of the repo1 & repo16
116- repo1 := unittest .AssertExistsAndLoadBean (t , & repo_model.Repository {ID : 1 }) // public repo
113+ onGiteaRun (b , func (b * testing.B , u * url.URL ) {
114+ user2 := unittest .AssertExistsAndLoadBean (b , & user_model.User {ID : 2 }) // owner of the repo1 & repo16
115+ repo1 := unittest .AssertExistsAndLoadBean (b , & repo_model.Repository {ID : 1 }) // public repo
117116
117+ b .ResetTimer ()
118118 for n := 0 ; n < b .N ; n ++ {
119119 treePath := fmt .Sprintf ("update/file%d.txt" , n )
120- createFileInBranch (user2 , repo1 , treePath , repo1 .DefaultBranch , treePath )
120+ _ , _ = createFileInBranch (user2 , repo1 , treePath , repo1 .DefaultBranch , treePath )
121121 }
122122 })
123123}
124124
125125func BenchmarkAPICreateFileMedium (b * testing.B ) {
126126 data := make ([]byte , 10 * 1024 * 1024 )
127127
128- onGiteaRunTB (b , func (t testing.TB , u * url.URL ) {
129- b := t .(* testing.B )
130- user2 := unittest .AssertExistsAndLoadBean (t , & user_model.User {ID : 2 }) // owner of the repo1 & repo16
131- repo1 := unittest .AssertExistsAndLoadBean (t , & repo_model.Repository {ID : 1 }) // public repo
128+ onGiteaRun (b , func (b * testing.B , u * url.URL ) {
129+ user2 := unittest .AssertExistsAndLoadBean (b , & user_model.User {ID : 2 }) // owner of the repo1 & repo16
130+ repo1 := unittest .AssertExistsAndLoadBean (b , & repo_model.Repository {ID : 1 }) // public repo
132131
133132 b .ResetTimer ()
134133 for n := 0 ; n < b .N ; n ++ {
135134 treePath := fmt .Sprintf ("update/file%d.txt" , n )
136135 copy (data , treePath )
137- createFileInBranch (user2 , repo1 , treePath , repo1 .DefaultBranch , treePath )
136+ _ , _ = createFileInBranch (user2 , repo1 , treePath , repo1 .DefaultBranch , treePath )
138137 }
139138 })
140139}
0 commit comments