@@ -110,31 +110,30 @@ func getExpectedFileResponseForCreate(repoFullName, commitID, treePath, latestCo
110
110
}
111
111
112
112
func 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
117
116
117
+ b .ResetTimer ()
118
118
for n := 0 ; n < b .N ; n ++ {
119
119
treePath := fmt .Sprintf ("update/file%d.txt" , n )
120
- createFileInBranch (user2 , repo1 , treePath , repo1 .DefaultBranch , treePath )
120
+ _ , _ = createFileInBranch (user2 , repo1 , treePath , repo1 .DefaultBranch , treePath )
121
121
}
122
122
})
123
123
}
124
124
125
125
func BenchmarkAPICreateFileMedium (b * testing.B ) {
126
126
data := make ([]byte , 10 * 1024 * 1024 )
127
127
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
132
131
133
132
b .ResetTimer ()
134
133
for n := 0 ; n < b .N ; n ++ {
135
134
treePath := fmt .Sprintf ("update/file%d.txt" , n )
136
135
copy (data , treePath )
137
- createFileInBranch (user2 , repo1 , treePath , repo1 .DefaultBranch , treePath )
136
+ _ , _ = createFileInBranch (user2 , repo1 , treePath , repo1 .DefaultBranch , treePath )
138
137
}
139
138
})
140
139
}
0 commit comments