loading up the forgejo repo on tangled to test page performance
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge pull request '[TESTS] prevent overriding testlogger when calling mainApp' (#2846) from oliverpool/forgejo:non_failing_test into forgejo

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/2846
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>

+365 -67
+279 -3
modules/testlogger/testlogger.go
··· 43 43 } 44 44 45 45 func (w *testLoggerWriterCloser) Log(level log.Level, msg string) { 46 - if len(msg) > 0 && msg[len(msg)-1] == '\n' { 47 - msg = msg[:len(msg)-1] 48 - } 46 + msg = strings.TrimSpace(msg) 49 47 50 48 w.printMsg(msg) 51 49 if level >= log.ERROR { ··· 111 109 112 110 // TestRebuildCargo 113 111 `RebuildCargoIndex() [E] RebuildIndex failed: GetRepositoryByOwnerAndName: repository does not exist [id: 0, uid: 0, owner_name: user2, name: _cargo-index]`, 112 + 113 + // TestCommitMail/Delete/Not_activated 114 + `/context_response.go:87:HTML() [E] Render failed: failed to render template: repo/editor/edit, error: template error: builtin(static):repo/editor/edit:13:13 : executing "repo/editor/edit" at <len .TreeNames>: error calling len: reflect: call of reflect.Value.Type on zero Value 115 + ---------------------------------------------------------------------- 116 + {{$n := len .TreeNames}} 117 + ^ 118 + ----------------------------------------------------------------------`, 119 + // TestCommitMail/Delete/Not_belong_to_user 120 + `/context_response.go:87:HTML() [E] Render failed: failed to render template: repo/editor/edit, error: template error: builtin(static):repo/editor/edit:13:13 : executing "repo/editor/edit" at <len .TreeNames>: error calling len: reflect: call of reflect.Value.Type on zero Value 121 + ---------------------------------------------------------------------- 122 + {{$n := len .TreeNames}} 123 + ^ 124 + ----------------------------------------------------------------------`, 125 + // TestCommitMail/Apply_patch/Not_activated 126 + `/context_response.go:87:HTML() [E] Render failed: failed to render template: repo/editor/edit, error: template error: builtin(static):repo/editor/edit:13:13 : executing "repo/editor/edit" at <len .TreeNames>: error calling len: reflect: call of reflect.Value.Type on zero Value 127 + ---------------------------------------------------------------------- 128 + {{$n := len .TreeNames}} 129 + ^ 130 + ----------------------------------------------------------------------`, 131 + // TestCommitMail/Apply_patch/Not_belong_to_user 132 + `/context_response.go:87:HTML() [E] Render failed: failed to render template: repo/editor/edit, error: template error: builtin(static):repo/editor/edit:13:13 : executing "repo/editor/edit" at <len .TreeNames>: error calling len: reflect: call of reflect.Value.Type on zero Value 133 + ---------------------------------------------------------------------- 134 + {{$n := len .TreeNames}} 135 + ^ 136 + ----------------------------------------------------------------------`, 137 + // TestCommitMail/Cherry_pick/Not_activated 138 + `/context_response.go:87:HTML() [E] Render failed: failed to render template: repo/editor/edit, error: template error: builtin(static):repo/editor/edit:13:13 : executing "repo/editor/edit" at <len .TreeNames>: error calling len: reflect: call of reflect.Value.Type on zero Value 139 + ---------------------------------------------------------------------- 140 + {{$n := len .TreeNames}} 141 + ^ 142 + ----------------------------------------------------------------------`, 143 + // TestCommitMail/Cherry_pick/Not_belong_to_user 144 + `/context_response.go:87:HTML() [E] Render failed: failed to render template: repo/editor/edit, error: template error: builtin(static):repo/editor/edit:13:13 : executing "repo/editor/edit" at <len .TreeNames>: error calling len: reflect: call of reflect.Value.Type on zero Value 145 + ---------------------------------------------------------------------- 146 + {{$n := len .TreeNames}} 147 + ^ 148 + ----------------------------------------------------------------------`, 149 + // TestDangerZoneConfirmation/Convert_fork/Fail 150 + `/gitea-repositories/user20/big_test_public_fork_7.git Error: no such file or directory`, 151 + // TestGitSmartHTTP 152 + `/web/repo/githttp.go:384:sendFile() [E] request file path contains invalid path: objects/info/..\..\..\..\custom\conf\app.ini`, 153 + // TestGit/HTTP/BranchProtectMerge 154 + `s/private/ssh_log.go:26:SSHLog() [E] ssh: Not allowed to push to protected branch protected. HookPreReceive(last) failed: internal API error response, status=403`, 155 + // TestGit/HTTP/BranchProtectMerge 156 + `s/private/ssh_log.go:26:SSHLog() [E] ssh: Not allowed to push to protected branch protected. HookPreReceive(last) failed: internal API error response, status=403`, 157 + // TestGit/HTTP/BranchProtectMerge 158 + `/gitea-repositories/user2/repo-tmp-17.git'`, 159 + // TestGit/HTTP/BranchProtectMerge 160 + `s/private/ssh_log.go:26:SSHLog() [E] ssh: branch protected is protected from force push. HookPreReceive(last) failed: internal API error response, status=403`, 161 + // TestGit/HTTP/MergeFork/CreatePRAndMerge 162 + `s/web/repo/branch.go:108:DeleteBranchPost() [E] DeleteBranch: GetBranch: branch does not exist [repo_id: 1099 name: user2:master]`, // sqlite 163 + "s/web/repo/branch.go:108:DeleteBranchPost() [E] DeleteBranch: GetBranch: branch does not exist [repo_id: 10000 name: user2:master]", // mysql 164 + "s/web/repo/branch.go:108:DeleteBranchPost() [E] DeleteBranch: GetBranch: branch does not exist [repo_id: 1060 name: user2:master]", // pgsql 165 + // TestGit/SSH/LFS/PushCommit/Little 166 + `s/private/ssh_log.go:26:SSHLog() [E] ssh: Unknown git command. Unknown git command git-lfs-transfer`, 167 + // TestGit/SSH/LFS/PushCommit/Little 168 + `s/private/ssh_log.go:26:SSHLog() [E] ssh: Unknown git command. Unknown git command git-lfs-transfer`, 169 + // TestGit/SSH/LFS/PushCommit/Big 170 + `s/private/ssh_log.go:26:SSHLog() [E] ssh: Unknown git command. Unknown git command git-lfs-transfer`, 171 + // TestGit/SSH/LFS/PushCommit/Big 172 + `s/private/ssh_log.go:26:SSHLog() [E] ssh: Unknown git command. Unknown git command git-lfs-transfer`, 173 + // TestGit/SSH/LFS/Locks 174 + `s/private/ssh_log.go:26:SSHLog() [E] ssh: Unknown git command. Unknown git command git-lfs-transfer`, 175 + // TestGit/SSH/LFS/Locks 176 + `s/private/ssh_log.go:26:SSHLog() [E] ssh: Unknown git command. Unknown git command git-lfs-transfer`, 177 + // TestGit/SSH/LFS/Locks 178 + `s/private/ssh_log.go:26:SSHLog() [E] ssh: Unknown git command. Unknown git command git-lfs-transfer`, 179 + // TestGit/SSH/LFS/Locks 180 + `s/private/ssh_log.go:26:SSHLog() [E] ssh: Unknown git command. Unknown git command git-lfs-transfer`, 181 + // TestGit/SSH/LFS/Locks 182 + `s/private/ssh_log.go:26:SSHLog() [E] ssh: Unknown git command. Unknown git command git-lfs-transfer`, 183 + // TestGit/SSH/CreateAgitFlowPull/PushParams/NoParams 184 + `s/private/ssh_log.go:26:SSHLog() [E] ssh: Unknown git command. Unknown git command git-lfs-transfer`, 185 + // TestGit/SSH/CreateAgitFlowPull/PushParams/NoParams 186 + `s/private/ssh_log.go:26:SSHLog() [E] ssh: Unknown git command. Unknown git command git-lfs-transfer`, 187 + // TestGit/SSH/CreateAgitFlowPull/PushParams/TitleOverride 188 + `s/private/ssh_log.go:26:SSHLog() [E] ssh: Unknown git command. Unknown git command git-lfs-transfer`, 189 + // TestGit/SSH/CreateAgitFlowPull/PushParams/TitleOverride 190 + `s/private/ssh_log.go:26:SSHLog() [E] ssh: Unknown git command. Unknown git command git-lfs-transfer`, 191 + // TestGit/SSH/CreateAgitFlowPull/PushParams/DescriptionOverride 192 + `s/private/ssh_log.go:26:SSHLog() [E] ssh: Unknown git command. Unknown git command git-lfs-transfer`, 193 + // TestGit/SSH/CreateAgitFlowPull/PushParams/DescriptionOverride 194 + `s/private/ssh_log.go:26:SSHLog() [E] ssh: Unknown git command. Unknown git command git-lfs-transfer`, 195 + // TestGit/SSH/CreateAgitFlowPull/Force_push/Fails 196 + `s/private/ssh_log.go:26:SSHLog() [E] ssh: Unknown git command. Unknown git command git-lfs-transfer`, 197 + // TestGit/SSH/CreateAgitFlowPull/Force_push/Fails 198 + `s/private/ssh_log.go:26:SSHLog() [E] ssh: Unknown git command. Unknown git command git-lfs-transfer`, 199 + // TestGit/SSH/CreateAgitFlowPull/Force_push/Succeeds 200 + `s/private/ssh_log.go:26:SSHLog() [E] ssh: Unknown git command. Unknown git command git-lfs-transfer`, 201 + // TestGit/SSH/CreateAgitFlowPull/Force_push/Succeeds 202 + `s/private/ssh_log.go:26:SSHLog() [E] ssh: Unknown git command. Unknown git command git-lfs-transfer`, 203 + // TestGit/SSH/CreateAgitFlowPull/Force_push 204 + `s/private/ssh_log.go:26:SSHLog() [E] ssh: Unknown git command. Unknown git command git-lfs-transfer`, 205 + // TestGit/SSH/CreateAgitFlowPull/Force_push 206 + `s/private/ssh_log.go:26:SSHLog() [E] ssh: Unknown git command. Unknown git command git-lfs-transfer`, 207 + // TestGit/SSH/CreateAgitFlowPull/Branch_already_contains_commit 208 + `s/private/ssh_log.go:26:SSHLog() [E] ssh: Unknown git command. Unknown git command git-lfs-transfer`, 209 + // TestGit/SSH/CreateAgitFlowPull/Branch_already_contains_commit 210 + `s/private/ssh_log.go:26:SSHLog() [E] ssh: Unknown git command. Unknown git command git-lfs-transfer`, 211 + // TestGit/SSH/CreateAgitFlowPull 212 + `s/private/ssh_log.go:26:SSHLog() [E] ssh: Unknown git command. Unknown git command git-lfs-transfer`, 213 + // TestGit/SSH/CreateAgitFlowPull 214 + `s/private/ssh_log.go:26:SSHLog() [E] ssh: Unknown git command. Unknown git command git-lfs-transfer`, 215 + // TestGit/SSH/CreateAgitFlowPull 216 + `s/private/ssh_log.go:26:SSHLog() [E] ssh: Unknown git command. Unknown git command git-lfs-transfer`, 217 + // TestGit/SSH/CreateAgitFlowPull 218 + `s/private/ssh_log.go:26:SSHLog() [E] ssh: Unknown git command. Unknown git command git-lfs-transfer`, 219 + // TestGit/SSH/CreateAgitFlowPull 220 + `s/private/ssh_log.go:26:SSHLog() [E] ssh: Unknown git command. Unknown git command git-lfs-transfer`, 221 + // TestGit/SSH/CreateAgitFlowPull 222 + `s/private/ssh_log.go:26:SSHLog() [E] ssh: Unknown git command. Unknown git command git-lfs-transfer`, 223 + // TestGit/SSH/CreateAgitFlowPull 224 + `s/private/ssh_log.go:26:SSHLog() [E] ssh: Unknown git command. Unknown git command git-lfs-transfer`, 225 + // TestGit/SSH/CreateAgitFlowPull 226 + `s/private/ssh_log.go:26:SSHLog() [E] ssh: Unknown git command. Unknown git command git-lfs-transfer`, 227 + // TestGit/SSH/BranchProtectMerge 228 + `s/private/ssh_log.go:26:SSHLog() [E] ssh: Unknown git command. Unknown git command git-lfs-transfer`, 229 + // TestGit/SSH/BranchProtectMerge 230 + `s/private/ssh_log.go:26:SSHLog() [E] ssh: Unknown git command. Unknown git command git-lfs-transfer`, 231 + // TestGit/SSH/BranchProtectMerge 232 + `s/private/ssh_log.go:26:SSHLog() [E] ssh: Unknown git command. Unknown git command git-lfs-transfer`, 233 + // TestGit/SSH/BranchProtectMerge 234 + `s/private/ssh_log.go:26:SSHLog() [E] ssh: Unknown git command. Unknown git command git-lfs-transfer`, 235 + // TestGit/SSH/BranchProtectMerge 236 + `s/private/ssh_log.go:26:SSHLog() [E] ssh: Not allowed to push to protected branch protected. HookPreReceive(last) failed: internal API error response, status=403`, 237 + // TestGit/SSH/BranchProtectMerge 238 + `s/private/ssh_log.go:26:SSHLog() [E] ssh: Unknown git command. Unknown git command git-lfs-transfer`, 239 + // TestGit/SSH/BranchProtectMerge 240 + `s/private/ssh_log.go:26:SSHLog() [E] ssh: Unknown git command. Unknown git command git-lfs-transfer`, 241 + // TestGit/SSH/BranchProtectMerge 242 + `s/private/ssh_log.go:26:SSHLog() [E] ssh: Unknown git command. Unknown git command git-lfs-transfer`, 243 + // TestGit/SSH/BranchProtectMerge 244 + `s/private/ssh_log.go:26:SSHLog() [E] ssh: Unknown git command. Unknown git command git-lfs-transfer`, 245 + // TestGit/SSH/BranchProtectMerge 246 + `/gitea-repositories/user2/repo-tmp-18.git'`, 247 + // TestGit/SSH/BranchProtectMerge 248 + `s/private/ssh_log.go:26:SSHLog() [E] ssh: Unknown git command. Unknown git command git-lfs-transfer`, 249 + // TestGit/SSH/BranchProtectMerge 250 + `s/private/ssh_log.go:26:SSHLog() [E] ssh: Unknown git command. Unknown git command git-lfs-transfer`, 251 + // TestGit/SSH/BranchProtectMerge 252 + `s/private/ssh_log.go:26:SSHLog() [E] ssh: Unknown git command. Unknown git command git-lfs-transfer`, 253 + // TestGit/SSH/BranchProtectMerge 254 + `s/private/ssh_log.go:26:SSHLog() [E] ssh: Unknown git command. Unknown git command git-lfs-transfer`, 255 + // TestGit/SSH/BranchProtectMerge 256 + `s/private/ssh_log.go:26:SSHLog() [E] ssh: branch protected is protected from force push. HookPreReceive(last) failed: internal API error response, status=403`, 257 + // TestGit/SSH/BranchProtectMerge 258 + `s/private/ssh_log.go:26:SSHLog() [E] ssh: Unknown git command. Unknown git command git-lfs-transfer`, 259 + // TestGit/SSH/BranchProtectMerge 260 + `s/private/ssh_log.go:26:SSHLog() [E] ssh: Unknown git command. Unknown git command git-lfs-transfer`, 261 + // TestGit/SSH/MergeFork/CreatePRAndMerge 262 + `s/web/repo/branch.go:108:DeleteBranchPost() [E] DeleteBranch: GetBranch: branch does not exist [repo_id: 1102 name: user2:master]`, // sqlite 263 + "s/web/repo/branch.go:108:DeleteBranchPost() [E] DeleteBranch: GetBranch: branch does not exist [repo_id: 10003 name: user2:master]", // mysql 264 + "s/web/repo/branch.go:108:DeleteBranchPost() [E] DeleteBranch: GetBranch: branch does not exist [repo_id: 1063 name: user2:master]", // pgsql 265 + // TestGit/SSH/PushCreate 266 + `s/private/ssh_log.go:26:SSHLog() [E] ssh: Push to create is not enabled for users. ServCommand failed: internal API error response, status=403`, 267 + // TestGit/SSH/PushCreate 268 + `s/private/ssh_log.go:26:SSHLog() [E] ssh: Cannot find repository: user2/repo-tmp-push-create-ssh. ServCommand failed: internal API error response, status=404`, 269 + // TestGit/SSH/PushCreate 270 + `s/private/ssh_log.go:26:SSHLog() [E] ssh: Invalid repo name. Invalid repo name: invalid/repo-tmp-push-create-ssh`, 271 + // TestIssueReaction 272 + `rs/web/repo/issue.go:3282:ChangeIssueReaction() [E] ChangeIssueReaction: '8ball' is not an allowed reaction`, 273 + // TestIssuePinMove 274 + `eb/repo/issue_pin.go:95:IssuePinMove() [E] Issue does not belong to this repository`, 275 + // TestLinksLogin 276 + `ervices/pull/pull.go:880:GetIssuesAllCommitStatus() [E] getAllCommitStatus: cant get commit statuses of pull [6]: object does not exist [id: refs/pull/2/head, rel_path: ]`, 277 + // TestLinksLogin 278 + `ervices/pull/pull.go:880:GetIssuesAllCommitStatus() [E] getAllCommitStatus: cant get commit statuses of pull [6]: object does not exist [id: refs/pull/2/head, rel_path: ]`, 279 + // TestLinksLogin 280 + `ervices/pull/pull.go:880:GetIssuesAllCommitStatus() [E] getAllCommitStatus: cant get commit statuses of pull [6]: object does not exist [id: refs/pull/2/head, rel_path: ]`, 281 + // TestLinksLogin 282 + `ervices/pull/pull.go:872:GetIssuesAllCommitStatus() [E] Cannot open git repository <Repository 23:org17/big_test_public_4> for issue #1[20]. Error: no such file or directory`, 283 + // TestMigrate 284 + `] for OwnerID[2] failed: error while listing issues: token does not have at least one of required scope(s): [read:issue]`, 285 + // TestMigrate 286 + `ervices/task/task.go:53:handler() [E] Run task failed: error while listing issues: token does not have at least one of required scope(s): [read:issue]`, 287 + // TestMigrate 288 + `] for OwnerID[2] failed: error while listing issues: token does not have at least one of required scope(s): [read:issue]`, 289 + // TestMigrate 290 + `ervices/task/task.go:53:handler() [E] Run task failed: error while listing issues: token does not have at least one of required scope(s): [read:issue]`, 291 + // TestMirrorPush 292 + `/web/repo/githttp.go:533:GetInfoRefs() [E] fork/exec /usr/bin/git: no such file or directory -`, 293 + 294 + // TestOrgMembers 295 + `nization/org_user.go:122:loadOrganizationOwners() [E] Organization does not have owner team: 25`, 296 + // TestOrgMembers 297 + `nization/org_user.go:122:loadOrganizationOwners() [E] Organization does not have owner team: 25`, 298 + // TestOrgMembers 299 + `nization/org_user.go:122:loadOrganizationOwners() [E] Organization does not have owner team: 25`, 300 + // TestRecentlyPushed/unrelated_branches_are_not_shown 301 + `repository/branch.go:30:SyncRepoBranches() [E] OpenRepository[user30/repo50]: %!w(*errors.errorString=&{no such file or directory})`, 302 + // TestRecentlyPushed/unrelated_branches_are_not_shown 303 + `repository/branch.go:488:handlerBranchSync() [E] syncRepoBranches [50] failed: no such file or directory`, 304 + // TestRecentlyPushed/unrelated_branches_are_not_shown 305 + `repository/branch.go:30:SyncRepoBranches() [E] OpenRepository[user30/repo51]: %!w(*errors.errorString=&{no such file or directory})`, 306 + // TestRecentlyPushed/unrelated_branches_are_not_shown 307 + `repository/branch.go:488:handlerBranchSync() [E] syncRepoBranches [51] failed: no such file or directory`, 308 + // TestRecentlyPushed/unrelated_branches_are_not_shown 309 + `repository/branch.go:30:SyncRepoBranches() [E] OpenRepository[user2/scoped_label]: %!w(*errors.errorString=&{no such file or directory})`, 310 + // TestRecentlyPushed/unrelated_branches_are_not_shown 311 + `repository/branch.go:488:handlerBranchSync() [E] syncRepoBranches [55] failed: no such file or directory`, 312 + // TestCantMergeConflict 313 + "]user1/repo1#1[base...conflict]> Unable to merge tracking into base: Merge Conflict Error: exit status 1: \nAuto-merging README.md\nCONFLICT (content): Merge conflict in README.md\nAutomatic merge failed; fix conflicts and then commit the result.", 314 + 315 + // TestCantMergeUnrelated 316 + `]user1/repo1#1[base...unrelated]> Unable to merge tracking into base: Merge UnrelatedHistories Error: exit status 128: fatal: refusing to merge unrelated histories`, 317 + // TestCantFastForwardOnlyMergeDiverging 318 + "]user1/repo1#1[master...diverging]> Unable to merge tracking into base: Merge DivergingFastForwardOnly Error: exit status 128: hint: Diverging branches can't be fast-forwarded, you need to either:\nhint: \nhint: \tgit merge --no-ff\nhint: \nhint: or:\nhint: \nhint: \tgit rebase\nhint: \nhint: Disable this message with \"git config advice.diverging false\"\nfatal: Not possible to fast-forward, aborting.", 319 + // TestPullrequestReopen/Base_branch_deleted 320 + `fatal: couldn't find remote ref base-branch`, 321 + // TestPullrequestReopen/Head_branch_deleted 322 + `]user2/reopen-base#1[base-branch...org26/reopen-head:head-branch]>]: branch does not exist [repo_id: 0 name: head-branch]`, 323 + // TestDatabaseMissingABranch 324 + `repository/branch.go:30:SyncRepoBranches() [E] OpenRepository[user30/repo50]: %!w(*errors.errorString=&{no such file or directory})`, 325 + // TestDatabaseMissingABranch 326 + `repository/branch.go:488:handlerBranchSync() [E] syncRepoBranches [50] failed: no such file or directory`, 327 + // TestDatabaseMissingABranch 328 + `repository/branch.go:30:SyncRepoBranches() [E] OpenRepository[user30/repo51]: %!w(*errors.errorString=&{no such file or directory})`, 329 + // TestDatabaseMissingABranch 330 + `repository/branch.go:488:handlerBranchSync() [E] syncRepoBranches [51] failed: no such file or directory`, 331 + // TestDatabaseMissingABranch 332 + `repository/branch.go:30:SyncRepoBranches() [E] OpenRepository[user2/scoped_label]: %!w(*errors.errorString=&{no such file or directory})`, 333 + // TestDatabaseMissingABranch 334 + `repository/branch.go:488:handlerBranchSync() [E] syncRepoBranches [55] failed: no such file or directory`, 335 + // TestDatabaseMissingABranch 336 + `repository/branch.go:100:LoadBranches() [E] loadOneBranch() on repo #1, branch 'will-be-missing' failed: CountDivergingCommits: exit status 128 - fatal: bad revision 'master...refs/heads/will-be-missing' 337 + - fatal: bad revision 'master...refs/heads/will-be-missing'`, 338 + // TestDatabaseMissingABranch 339 + `repository/branch.go:30:SyncRepoBranches() [E] OpenRepository[user30/repo50]: %!w(*errors.errorString=&{no such file or directory})`, 340 + // TestDatabaseMissingABranch 341 + `repository/branch.go:488:handlerBranchSync() [E] syncRepoBranches [50] failed: no such file or directory`, 342 + // TestDatabaseMissingABranch 343 + `repository/branch.go:30:SyncRepoBranches() [E] OpenRepository[user30/repo51]: %!w(*errors.errorString=&{no such file or directory})`, 344 + // TestDatabaseMissingABranch 345 + `repository/branch.go:488:handlerBranchSync() [E] syncRepoBranches [51] failed: no such file or directory`, 346 + // TestDatabaseMissingABranch 347 + `repository/branch.go:30:SyncRepoBranches() [E] OpenRepository[user2/scoped_label]: %!w(*errors.errorString=&{no such file or directory})`, 348 + // TestDatabaseMissingABranch 349 + `repository/branch.go:488:handlerBranchSync() [E] syncRepoBranches [55] failed: no such file or directory`, 350 + // TestDatabaseMissingABranch 351 + "LoadBranches() [E] loadOneBranch() on repo #1, branch 'will-be-missing' failed: CountDivergingCommits: exit status 128 - fatal: bad revision 'master...refs/heads/will-be-missing'\n - fatal: bad revision 'master...refs/heads/will-be-missing'", 352 + 353 + // TestCreateNewTagProtected/Git 354 + `s/private/ssh_log.go:26:SSHLog() [E] ssh: Tag v-2 is protected. HookPreReceive(last) failed: internal API error response, status=403`, 355 + // TestMarkDownReadmeImage 356 + `ers/web/repo/view.go:1167:checkOutdatedBranch() [E] GetBranch: branch does not exist [repo_id: 1 name: home-md-img-check]`, 357 + // TestMarkDownReadmeImage 358 + `ers/web/repo/view.go:1167:checkOutdatedBranch() [E] GetBranch: branch does not exist [repo_id: 1 name: home-md-img-check]`, 359 + // TestMarkDownReadmeImageSubfolder 360 + `ers/web/repo/view.go:1167:checkOutdatedBranch() [E] GetBranch: branch does not exist [repo_id: 1 name: sub-home-md-img-check]`, 361 + // TestMarkDownReadmeImageSubfolder 362 + `ers/web/repo/view.go:1167:checkOutdatedBranch() [E] GetBranch: branch does not exist [repo_id: 1 name: sub-home-md-img-check]`, 363 + 364 + // TestKeyOnlyOneType 365 + `:ssh-key-test-repo-push is not authorized to write to user2/ssh-key-test-repo. ServCommand failed: internal API error response, status=401`, 366 + 367 + // TestPullRebase 368 + "/gitea-repositories/user2/repo1.git' does not appear to be a git repository\nfatal: Could not read from remote repository.\n\nPlease make sure you have the correct access rights\nand the repository exists.", 369 + 370 + // TestPullRebaseMerge 371 + "]user2/repo1#3[master...branch2]>]: branch does not exist [repo_id: 0 name: branch2]", 372 + 373 + // TestAuthorizeNoClientID 374 + `TrString() [E] Missing translation "form.ResponseType"`, 375 + 376 + // TestWebhookForms 377 + `TrString() [E] Missing translation "form.AuthorizationHeader"`, 378 + `TrString() [E] Missing translation "form.Channel"`, 379 + `TrString() [E] Missing translation "form.ContentType"`, 380 + `TrString() [E] Missing translation "form.HTTPMethod"`, 381 + `TrString() [E] Missing translation "form.PayloadURL"`, 382 + 383 + // TestRenameInvalidUsername 384 + `TrString() [E] Missing translation "form.Name"`, 114 385 } 115 386 116 387 func (w *testLoggerWriterCloser) recordError(msg string) { ··· 126 397 err := w.err 127 398 if len(w.errs) > 0 { 128 399 err = w.errs[len(w.errs)-1] 400 + } 401 + 402 + if len(w.t) > 0 { 403 + // format error message to easily add it to the ignore list 404 + msg = fmt.Sprintf("// %s\n\t%q,", w.t[len(w.t)-1].Name(), msg) 129 405 } 130 406 131 407 err = errors.Join(err, errors.New(msg))
+19 -13
tests/integration/cmd_forgejo_actions_test.go
··· 4 4 5 5 import ( 6 6 gocontext "context" 7 + "errors" 8 + "io" 7 9 "net/url" 8 10 "os" 11 + "os/exec" 9 12 "strings" 10 13 "testing" 11 14 ··· 19 22 20 23 func Test_CmdForgejo_Actions(t *testing.T) { 21 24 onGiteaRun(t, func(*testing.T, *url.URL) { 22 - token, err := cmdForgejoCaptureOutput(t, []string{"forgejo", "forgejo-cli", "actions", "generate-runner-token"}) 25 + token, err := runMainApp("forgejo-cli", "actions", "generate-runner-token") 23 26 assert.NoError(t, err) 24 27 assert.EqualValues(t, 40, len(token)) 25 28 26 - secret, err := cmdForgejoCaptureOutput(t, []string{"forgejo", "forgejo-cli", "actions", "generate-secret"}) 29 + secret, err := runMainApp("forgejo-cli", "actions", "generate-secret") 27 30 assert.NoError(t, err) 28 31 assert.EqualValues(t, 40, len(secret)) 29 32 30 - _, err = cmdForgejoCaptureOutput(t, []string{"forgejo", "forgejo-cli", "actions", "register"}) 31 - assert.ErrorContains(t, err, "at least one of the --secret") 33 + _, err = runMainApp("forgejo-cli", "actions", "register") 34 + var exitErr *exec.ExitError 35 + assert.True(t, errors.As(err, &exitErr)) 36 + assert.Contains(t, string(exitErr.Stderr), "at least one of the --secret") 32 37 33 38 for _, testCase := range []struct { 34 39 testName string ··· 62 67 }, 63 68 } { 64 69 t.Run(testCase.testName, func(t *testing.T) { 65 - cmd := []string{"forgejo", "forgejo-cli", "actions", "register", "--secret", testCase.secret, "--scope", testCase.scope} 66 - output, err := cmdForgejoCaptureOutput(t, cmd) 67 - assert.ErrorContains(t, err, testCase.errorMessage) 70 + output, err := runMainApp("forgejo-cli", "actions", "register", "--secret", testCase.secret, "--scope", testCase.scope) 68 71 assert.EqualValues(t, "", output) 72 + 73 + var exitErr *exec.ExitError 74 + assert.True(t, errors.As(err, &exitErr)) 75 + assert.Contains(t, string(exitErr.Stderr), testCase.errorMessage) 69 76 }) 70 77 } 71 78 ··· 75 82 for _, testCase := range []struct { 76 83 testName string 77 84 secretOption func() string 78 - stdin []string 85 + stdin io.Reader 79 86 }{ 80 87 { 81 88 testName: "secret from argument", ··· 88 95 secretOption: func() string { 89 96 return "--secret-stdin" 90 97 }, 91 - stdin: []string{secret}, 98 + stdin: strings.NewReader(secret), 92 99 }, 93 100 { 94 101 testName: "secret from file", ··· 100 107 }, 101 108 } { 102 109 t.Run(testCase.testName, func(t *testing.T) { 103 - cmd := []string{"forgejo", "forgejo-cli", "actions", "register", testCase.secretOption(), "--scope=org26"} 104 - uuid, err := cmdForgejoCaptureOutput(t, cmd, testCase.stdin...) 110 + uuid, err := runMainAppWithStdin(testCase.stdin, "forgejo-cli", "actions", "register", testCase.secretOption(), "--scope=org26") 105 111 assert.NoError(t, err) 106 112 assert.EqualValues(t, expecteduuid, uuid) 107 113 }) ··· 161 167 } { 162 168 t.Run(testCase.testName, func(t *testing.T) { 163 169 cmd := []string{ 164 - "forgejo", "forgejo-cli", "actions", "register", 170 + "actions", "register", 165 171 "--secret", testCase.secret, "--scope", testCase.scope, 166 172 } 167 173 if testCase.name != "" { ··· 177 183 // Run twice to verify it is idempotent 178 184 // 179 185 for i := 0; i < 2; i++ { 180 - uuid, err := cmdForgejoCaptureOutput(t, cmd) 186 + uuid, err := runMainApp("forgejo-cli", cmd...) 181 187 assert.NoError(t, err) 182 188 if assert.EqualValues(t, testCase.uuid, uuid) { 183 189 ownerName, repoName, found := strings.Cut(testCase.scope, "/")
-36
tests/integration/cmd_forgejo_test.go
··· 1 - // SPDX-License-Identifier: MIT 2 - 3 - package integration 4 - 5 - import ( 6 - "bytes" 7 - "context" 8 - "strings" 9 - "testing" 10 - 11 - "code.gitea.io/gitea/cmd/forgejo" 12 - 13 - "github.com/urfave/cli/v2" 14 - ) 15 - 16 - func cmdForgejoCaptureOutput(t *testing.T, args []string, stdin ...string) (string, error) { 17 - buf := new(bytes.Buffer) 18 - 19 - app := cli.NewApp() 20 - app.Writer = buf 21 - app.ErrWriter = buf 22 - ctx := context.Background() 23 - ctx = forgejo.ContextSetNoInit(ctx, true) 24 - ctx = forgejo.ContextSetNoExit(ctx, true) 25 - ctx = forgejo.ContextSetStdout(ctx, buf) 26 - ctx = forgejo.ContextSetStderr(ctx, buf) 27 - if len(stdin) > 0 { 28 - ctx = forgejo.ContextSetStdin(ctx, strings.NewReader(strings.Join(stdin, ""))) 29 - } 30 - app.Commands = []*cli.Command{ 31 - forgejo.CmdForgejo(ctx), 32 - } 33 - err := app.Run(args) 34 - 35 - return buf.String(), err 36 - }
+13 -14
tests/integration/cmd_keys_test.go
··· 4 4 package integration 5 5 6 6 import ( 7 - "bytes" 7 + "errors" 8 8 "net/url" 9 + "os/exec" 9 10 "testing" 10 11 11 - "code.gitea.io/gitea/cmd" 12 12 "code.gitea.io/gitea/modules/setting" 13 13 "code.gitea.io/gitea/modules/util" 14 14 15 15 "github.com/stretchr/testify/assert" 16 - "github.com/urfave/cli/v2" 17 16 ) 18 17 19 18 func Test_CmdKeys(t *testing.T) { ··· 24 23 wantErr bool 25 24 expectedOutput string 26 25 }{ 27 - {"test_empty_1", []string{"keys", "--username=git", "--type=test", "--content=test"}, true, ""}, 28 - {"test_empty_2", []string{"keys", "-e", "git", "-u", "git", "-t", "test", "-k", "test"}, true, ""}, 26 + {"test_empty_1", []string{"--username=git", "--type=test", "--content=test"}, true, ""}, 27 + {"test_empty_2", []string{"-e", "git", "-u", "git", "-t", "test", "-k", "test"}, true, ""}, 29 28 { 30 29 "with_key", 31 - []string{"keys", "-e", "git", "-u", "git", "-t", "ssh-rsa", "-k", "AAAAB3NzaC1yc2EAAAADAQABAAABgQDWVj0fQ5N8wNc0LVNA41wDLYJ89ZIbejrPfg/avyj3u/ZohAKsQclxG4Ju0VirduBFF9EOiuxoiFBRr3xRpqzpsZtnMPkWVWb+akZwBFAx8p+jKdy4QXR/SZqbVobrGwip2UjSrri1CtBxpJikojRIZfCnDaMOyd9Jp6KkujvniFzUWdLmCPxUE9zhTaPu0JsEP7MW0m6yx7ZUhHyfss+NtqmFTaDO+QlMR7L2QkDliN2Jl3Xa3PhuWnKJfWhdAq1Cw4oraKUOmIgXLkuiuxVQ6mD3AiFupkmfqdHq6h+uHHmyQqv3gU+/sD8GbGAhf6ftqhTsXjnv1Aj4R8NoDf9BS6KRkzkeun5UisSzgtfQzjOMEiJtmrep2ZQrMGahrXa+q4VKr0aKJfm+KlLfwm/JztfsBcqQWNcTURiCFqz+fgZw0Ey/de0eyMzldYTdXXNRYCKjs9bvBK+6SSXRM7AhftfQ0ZuoW5+gtinPrnmoOaSCEJbAiEiTO/BzOHgowiM="}, 30 + []string{"-e", "git", "-u", "git", "-t", "ssh-rsa", "-k", "AAAAB3NzaC1yc2EAAAADAQABAAABgQDWVj0fQ5N8wNc0LVNA41wDLYJ89ZIbejrPfg/avyj3u/ZohAKsQclxG4Ju0VirduBFF9EOiuxoiFBRr3xRpqzpsZtnMPkWVWb+akZwBFAx8p+jKdy4QXR/SZqbVobrGwip2UjSrri1CtBxpJikojRIZfCnDaMOyd9Jp6KkujvniFzUWdLmCPxUE9zhTaPu0JsEP7MW0m6yx7ZUhHyfss+NtqmFTaDO+QlMR7L2QkDliN2Jl3Xa3PhuWnKJfWhdAq1Cw4oraKUOmIgXLkuiuxVQ6mD3AiFupkmfqdHq6h+uHHmyQqv3gU+/sD8GbGAhf6ftqhTsXjnv1Aj4R8NoDf9BS6KRkzkeun5UisSzgtfQzjOMEiJtmrep2ZQrMGahrXa+q4VKr0aKJfm+KlLfwm/JztfsBcqQWNcTURiCFqz+fgZw0Ey/de0eyMzldYTdXXNRYCKjs9bvBK+6SSXRM7AhftfQ0ZuoW5+gtinPrnmoOaSCEJbAiEiTO/BzOHgowiM="}, 32 31 false, 33 32 "# gitea public key\ncommand=\"" + setting.AppPath + " --config=" + util.ShellEscape(setting.CustomConf) + " serv key-1\",no-port-forwarding,no-X11-forwarding,no-agent-forwarding,no-pty,no-user-rc,restrict ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDWVj0fQ5N8wNc0LVNA41wDLYJ89ZIbejrPfg/avyj3u/ZohAKsQclxG4Ju0VirduBFF9EOiuxoiFBRr3xRpqzpsZtnMPkWVWb+akZwBFAx8p+jKdy4QXR/SZqbVobrGwip2UjSrri1CtBxpJikojRIZfCnDaMOyd9Jp6KkujvniFzUWdLmCPxUE9zhTaPu0JsEP7MW0m6yx7ZUhHyfss+NtqmFTaDO+QlMR7L2QkDliN2Jl3Xa3PhuWnKJfWhdAq1Cw4oraKUOmIgXLkuiuxVQ6mD3AiFupkmfqdHq6h+uHHmyQqv3gU+/sD8GbGAhf6ftqhTsXjnv1Aj4R8NoDf9BS6KRkzkeun5UisSzgtfQzjOMEiJtmrep2ZQrMGahrXa+q4VKr0aKJfm+KlLfwm/JztfsBcqQWNcTURiCFqz+fgZw0Ey/de0eyMzldYTdXXNRYCKjs9bvBK+6SSXRM7AhftfQ0ZuoW5+gtinPrnmoOaSCEJbAiEiTO/BzOHgowiM= user2@localhost\n", 34 33 }, 35 - {"invalid", []string{"keys", "--not-a-flag=git"}, true, "Incorrect Usage: flag provided but not defined: -not-a-flag\n\n"}, 34 + {"invalid", []string{"--not-a-flag=git"}, true, "Incorrect Usage: flag provided but not defined: -not-a-flag\n\n"}, 36 35 } 37 36 for _, tt := range tests { 38 37 t.Run(tt.name, func(t *testing.T) { 39 - out := new(bytes.Buffer) 40 - app := cli.NewApp() 41 - app.Writer = out 42 - app.Commands = []*cli.Command{cmd.CmdKeys} 43 - cmd.CmdKeys.HideHelp = true 44 - err := app.Run(append([]string{"prog"}, tt.args...)) 38 + out, err := runMainApp("keys", tt.args...) 39 + 40 + var exitErr *exec.ExitError 41 + if errors.As(err, &exitErr) { 42 + t.Log(string(exitErr.Stderr)) 43 + } 45 44 if tt.wantErr { 46 45 assert.Error(t, err) 47 46 } else { 48 47 assert.NoError(t, err) 49 48 } 50 - assert.Equal(t, tt.expectedOutput, out.String()) 49 + assert.Equal(t, tt.expectedOutput, out) 51 50 }) 52 51 } 53 52 })
+38
tests/integration/integration_test.go
··· 17 17 "net/http/httptest" 18 18 "net/url" 19 19 "os" 20 + "os/exec" 20 21 "path/filepath" 21 22 "strconv" 22 23 "strings" ··· 24 25 "testing" 25 26 "time" 26 27 28 + "code.gitea.io/gitea/cmd" 27 29 "code.gitea.io/gitea/models/auth" 28 30 "code.gitea.io/gitea/models/db" 29 31 repo_model "code.gitea.io/gitea/models/repo" ··· 93 95 } 94 96 } 95 97 98 + // runMainApp runs the subcommand and returns its standard output. Any returned error will usually be of type *ExitError. If c.Stderr was nil, Output populates ExitError.Stderr. 99 + func runMainApp(subcommand string, args ...string) (string, error) { 100 + return runMainAppWithStdin(nil, subcommand, args...) 101 + } 102 + 103 + // runMainAppWithStdin runs the subcommand and returns its standard output. Any returned error will usually be of type *ExitError. If c.Stderr was nil, Output populates ExitError.Stderr. 104 + func runMainAppWithStdin(stdin io.Reader, subcommand string, args ...string) (string, error) { 105 + // running the main app directly will very likely mess with the testing setup (logger & co.) 106 + // hence we run it as a subprocess and capture its output 107 + args = append([]string{subcommand}, args...) 108 + cmd := exec.Command(os.Args[0], args...) 109 + cmd.Env = append(os.Environ(), 110 + "GITEA_TEST_CLI=true", 111 + "GITEA_CONF="+setting.CustomConf, 112 + "GITEA_WORK_DIR="+setting.AppWorkPath) 113 + cmd.Stdin = stdin 114 + out, err := cmd.Output() 115 + return string(out), err 116 + } 117 + 96 118 func TestMain(m *testing.M) { 119 + // GITEA_TEST_CLI is set by runMainAppWithStdin 120 + // inspired by https://abhinavg.net/2022/05/15/hijack-testmain/ 121 + if testCLI := os.Getenv("GITEA_TEST_CLI"); testCLI == "true" { 122 + app := cmd.NewMainApp("test-version", "integration-test") 123 + args := append([]string{ 124 + "executable-name", // unused, but expected at position 1 125 + "--config", os.Getenv("GITEA_CONF"), 126 + }, 127 + os.Args[1:]..., // skip the executable name 128 + ) 129 + if err := cmd.RunMainApp(app, args...); err != nil { 130 + panic(err) // should never happen since RunMainApp exits on error 131 + } 132 + return 133 + } 134 + 97 135 defer log.GetManager().Close() 98 136 99 137 managerCtx, cancel := context.WithCancel(context.Background())
+16 -1
tests/integration/pull_merge_test.go
··· 26 26 "code.gitea.io/gitea/models/webhook" 27 27 "code.gitea.io/gitea/modules/git" 28 28 "code.gitea.io/gitea/modules/gitrepo" 29 + "code.gitea.io/gitea/modules/hostmatcher" 30 + "code.gitea.io/gitea/modules/setting" 29 31 api "code.gitea.io/gitea/modules/structs" 30 32 "code.gitea.io/gitea/modules/test" 31 33 "code.gitea.io/gitea/modules/translation" 32 34 "code.gitea.io/gitea/services/pull" 33 35 files_service "code.gitea.io/gitea/services/repository/files" 36 + webhook_service "code.gitea.io/gitea/services/webhook" 34 37 35 38 "github.com/stretchr/testify/assert" 36 39 ) ··· 83 86 func retrieveHookTasks(t *testing.T, hookID int64, activateWebhook bool) []*webhook.HookTask { 84 87 t.Helper() 85 88 if activateWebhook { 86 - updated, err := db.GetEngine(db.DefaultContext).ID(hookID).Cols("is_active").Update(webhook.Webhook{IsActive: true}) 89 + s := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { 90 + w.WriteHeader(http.StatusNoContent) 91 + })) 92 + t.Cleanup(s.Close) 93 + updated, err := db.GetEngine(db.DefaultContext).ID(hookID).Cols("is_active", "url").Update(webhook.Webhook{ 94 + IsActive: true, 95 + URL: s.URL, 96 + }) 97 + 98 + // allow webhook deliveries on localhost 99 + t.Cleanup(test.MockVariableValue(&setting.Webhook.AllowedHostList, hostmatcher.MatchBuiltinLoopback)) 100 + webhook_service.Init() 101 + 87 102 assert.Equal(t, int64(1), updated) 88 103 assert.NoError(t, err) 89 104 }