test: fix unit tests failing on repeated runs by silverwind · Pull Request #39915 · go-gitea/gitea · GitHub
Skip to content

test: fix unit tests failing on repeated runs - #39915

Merged
silverwind merged 2 commits into
go-gitea:mainfrom
silverwind:oauth2-code-test
Oct 22, 2026
Merged

silverwind merged 2 commits into
go-gitea:mainfrom
silverwind:oauth2-code-test

Conversation

@silverwind

Copy link
Copy Markdown
Member

go test -count=2 failed in 12 packages because tests leaked state into later runs.

  • Reset SQLite sequences after each fixture load, like PostgreSQL already does
  • Prepare the database in tests that relied on earlier tests doing it
  • Restore mutated globals with test.MockVariableValue

`go test -count=2` failed in 12 packages because tests leaked state into
later runs: SQLite kept auto-increment counters across fixture reloads
while PostgreSQL resets its sequences, some tests relied on earlier tests
to prepare the database, and others left mutated globals behind.

Assisted-by: Claude Code:claude-opus-5-5
@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Oct 21, 2026
@GiteaBot GiteaBot added lgtm/need 1 This PR needs approval from one additional maintainer to be merged. and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels Oct 21, 2026
@GiteaBot GiteaBot added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels Oct 21, 2026
@silverwind silverwind added the reviewed/wait-merge This pull request is part of the merge queue. It will be merged soon. label Oct 22, 2026
@silverwind
silverwind enabled auto-merge (squash) October 22, 2026 01:11
@silverwind
silverwind merged commit 98c613d into go-gitea:main Oct 22, 2026
23 checks passed
@silverwind
silverwind deleted the oauth2-code-test branch October 22, 2026 01:27
@GiteaBot GiteaBot removed the reviewed/wait-merge This pull request is part of the merge queue. It will be merged soon. label Oct 22, 2026
@GiteaBot GiteaBot added this to the 29.0.0 milestone Oct 22, 2026
silverwind added a commit to silverwind/gitea that referenced this pull request Oct 22, 2026
* origin/main: (51 commits)
  fix(oauth2): decode form-encoded client credentials in HTTP Basic auth (go-gitea#39926)
  fix(issues): keep one row per issue when sorting by exclusive label order (go-gitea#39364)
  test(e2e): enable async clipboard testing pref in Firefox (go-gitea#39838)
  chore(deps): update dependencies, migrate to connectrpc.com/connect v2 (go-gitea#39854)
  test: fix unit tests failing on repeated runs (go-gitea#39915)
  [skip ci] Updated translations via Crowdin
  refactor(api): load assignees list correctly (go-gitea#39917)
  chore(maintainers): add SudhanshuMatrix as maintainer (go-gitea#39922)
  fix(api): keep milestone due date when it is omitted in edit request (go-gitea#39869)
  fix(lfs): send the default branch as ref in batch download requests (go-gitea#39891)
  fix(api): return 4xx for invalid fork repository names (go-gitea#39909)
  chore(build): run golangci-lint via `go run` (go-gitea#39907)
  ci: update giteabot to v1.3.0 (go-gitea#39910)
  fix(compare): show the diff when a comparison has no commits (go-gitea#39247)
  enhance(webhook): mention release assets in notifications (go-gitea#39631)
  [skip ci] Updated translations via Crowdin
  fix: use clear error message when failed to parse git version (go-gitea#39898)
  fix: off-by-one errors in code comment patches (go-gitea#39887)
  fix(packages): reject newline-bearing rubygems dependency metadata (go-gitea#39782)
  refactor(git): replace git stderr matching with exit codes (go-gitea#39866)
  ...

# Conflicts:
#	services/pull/review.go
#	tests/integration/compare_test.go
silverwind added a commit to lunny/gitea that referenced this pull request Oct 22, 2026
* origin/main: (1891 commits)
  fix(oauth2): decode form-encoded client credentials in HTTP Basic auth (go-gitea#39926)
  fix(issues): keep one row per issue when sorting by exclusive label order (go-gitea#39364)
  test(e2e): enable async clipboard testing pref in Firefox (go-gitea#39838)
  chore(deps): update dependencies, migrate to connectrpc.com/connect v2 (go-gitea#39854)
  test: fix unit tests failing on repeated runs (go-gitea#39915)
  [skip ci] Updated translations via Crowdin
  refactor(api): load assignees list correctly (go-gitea#39917)
  chore(maintainers): add SudhanshuMatrix as maintainer (go-gitea#39922)
  fix(api): keep milestone due date when it is omitted in edit request (go-gitea#39869)
  fix(lfs): send the default branch as ref in batch download requests (go-gitea#39891)
  fix(api): return 4xx for invalid fork repository names (go-gitea#39909)
  chore(build): run golangci-lint via `go run` (go-gitea#39907)
  ci: update giteabot to v1.3.0 (go-gitea#39910)
  fix(compare): show the diff when a comparison has no commits (go-gitea#39247)
  enhance(webhook): mention release assets in notifications (go-gitea#39631)
  [skip ci] Updated translations via Crowdin
  fix: use clear error message when failed to parse git version (go-gitea#39898)
  fix: off-by-one errors in code comment patches (go-gitea#39887)
  fix(packages): reject newline-bearing rubygems dependency metadata (go-gitea#39782)
  refactor(git): replace git stderr matching with exit codes (go-gitea#39866)
  ...

# Conflicts:
#	options/locale/locale_en-US.ini
silverwind added a commit to lunny/gitea that referenced this pull request Oct 22, 2026
* origin/main: (351 commits)
  fix(oauth2): decode form-encoded client credentials in HTTP Basic auth (go-gitea#39926)
  fix(issues): keep one row per issue when sorting by exclusive label order (go-gitea#39364)
  test(e2e): enable async clipboard testing pref in Firefox (go-gitea#39838)
  chore(deps): update dependencies, migrate to connectrpc.com/connect v2 (go-gitea#39854)
  test: fix unit tests failing on repeated runs (go-gitea#39915)
  [skip ci] Updated translations via Crowdin
  refactor(api): load assignees list correctly (go-gitea#39917)
  chore(maintainers): add SudhanshuMatrix as maintainer (go-gitea#39922)
  fix(api): keep milestone due date when it is omitted in edit request (go-gitea#39869)
  fix(lfs): send the default branch as ref in batch download requests (go-gitea#39891)
  fix(api): return 4xx for invalid fork repository names (go-gitea#39909)
  chore(build): run golangci-lint via `go run` (go-gitea#39907)
  ci: update giteabot to v1.3.0 (go-gitea#39910)
  fix(compare): show the diff when a comparison has no commits (go-gitea#39247)
  enhance(webhook): mention release assets in notifications (go-gitea#39631)
  [skip ci] Updated translations via Crowdin
  fix: use clear error message when failed to parse git version (go-gitea#39898)
  fix: off-by-one errors in code comment patches (go-gitea#39887)
  fix(packages): reject newline-bearing rubygems dependency metadata (go-gitea#39782)
  refactor(git): replace git stderr matching with exit codes (go-gitea#39866)
  ...

# Conflicts:
#	tests/integration/api_project_test.go
silverwind added a commit to rremer/gitea that referenced this pull request Oct 22, 2026
* origin/main: (321 commits)
  fix(oauth2): decode form-encoded client credentials in HTTP Basic auth (go-gitea#39926)
  fix(issues): keep one row per issue when sorting by exclusive label order (go-gitea#39364)
  test(e2e): enable async clipboard testing pref in Firefox (go-gitea#39838)
  chore(deps): update dependencies, migrate to connectrpc.com/connect v2 (go-gitea#39854)
  test: fix unit tests failing on repeated runs (go-gitea#39915)
  [skip ci] Updated translations via Crowdin
  refactor(api): load assignees list correctly (go-gitea#39917)
  chore(maintainers): add SudhanshuMatrix as maintainer (go-gitea#39922)
  fix(api): keep milestone due date when it is omitted in edit request (go-gitea#39869)
  fix(lfs): send the default branch as ref in batch download requests (go-gitea#39891)
  fix(api): return 4xx for invalid fork repository names (go-gitea#39909)
  chore(build): run golangci-lint via `go run` (go-gitea#39907)
  ci: update giteabot to v1.3.0 (go-gitea#39910)
  fix(compare): show the diff when a comparison has no commits (go-gitea#39247)
  enhance(webhook): mention release assets in notifications (go-gitea#39631)
  [skip ci] Updated translations via Crowdin
  fix: use clear error message when failed to parse git version (go-gitea#39898)
  fix: off-by-one errors in code comment patches (go-gitea#39887)
  fix(packages): reject newline-bearing rubygems dependency metadata (go-gitea#39782)
  refactor(git): replace git stderr matching with exit codes (go-gitea#39866)
  ...

# Conflicts:
#	go.mod
silverwind added a commit to nllptrx/gitea that referenced this pull request Oct 22, 2026
* origin/main: (1484 commits)
  fix(oauth2): decode form-encoded client credentials in HTTP Basic auth (go-gitea#39926)
  fix(issues): keep one row per issue when sorting by exclusive label order (go-gitea#39364)
  test(e2e): enable async clipboard testing pref in Firefox (go-gitea#39838)
  chore(deps): update dependencies, migrate to connectrpc.com/connect v2 (go-gitea#39854)
  test: fix unit tests failing on repeated runs (go-gitea#39915)
  [skip ci] Updated translations via Crowdin
  refactor(api): load assignees list correctly (go-gitea#39917)
  chore(maintainers): add SudhanshuMatrix as maintainer (go-gitea#39922)
  fix(api): keep milestone due date when it is omitted in edit request (go-gitea#39869)
  fix(lfs): send the default branch as ref in batch download requests (go-gitea#39891)
  fix(api): return 4xx for invalid fork repository names (go-gitea#39909)
  chore(build): run golangci-lint via `go run` (go-gitea#39907)
  ci: update giteabot to v1.3.0 (go-gitea#39910)
  fix(compare): show the diff when a comparison has no commits (go-gitea#39247)
  enhance(webhook): mention release assets in notifications (go-gitea#39631)
  [skip ci] Updated translations via Crowdin
  fix: use clear error message when failed to parse git version (go-gitea#39898)
  fix: off-by-one errors in code comment patches (go-gitea#39887)
  fix(packages): reject newline-bearing rubygems dependency metadata (go-gitea#39782)
  refactor(git): replace git stderr matching with exit codes (go-gitea#39866)
  ...

# Conflicts:
#	modules/templates/util_render.go
#	routers/web/feed/convert.go
#	templates/user/dashboard/feeds.tmpl
silverwind added a commit to lunny/gitea that referenced this pull request Oct 22, 2026
* origin/main: (1760 commits)
  fix(oauth2): decode form-encoded client credentials in HTTP Basic auth (go-gitea#39926)
  fix(issues): keep one row per issue when sorting by exclusive label order (go-gitea#39364)
  test(e2e): enable async clipboard testing pref in Firefox (go-gitea#39838)
  chore(deps): update dependencies, migrate to connectrpc.com/connect v2 (go-gitea#39854)
  test: fix unit tests failing on repeated runs (go-gitea#39915)
  [skip ci] Updated translations via Crowdin
  refactor(api): load assignees list correctly (go-gitea#39917)
  chore(maintainers): add SudhanshuMatrix as maintainer (go-gitea#39922)
  fix(api): keep milestone due date when it is omitted in edit request (go-gitea#39869)
  fix(lfs): send the default branch as ref in batch download requests (go-gitea#39891)
  fix(api): return 4xx for invalid fork repository names (go-gitea#39909)
  chore(build): run golangci-lint via `go run` (go-gitea#39907)
  ci: update giteabot to v1.3.0 (go-gitea#39910)
  fix(compare): show the diff when a comparison has no commits (go-gitea#39247)
  enhance(webhook): mention release assets in notifications (go-gitea#39631)
  [skip ci] Updated translations via Crowdin
  fix: use clear error message when failed to parse git version (go-gitea#39898)
  fix: off-by-one errors in code comment patches (go-gitea#39887)
  fix(packages): reject newline-bearing rubygems dependency metadata (go-gitea#39782)
  refactor(git): replace git stderr matching with exit codes (go-gitea#39866)
  ...

# Conflicts:
#	models/issues/pull.go
#	models/issues/pull_test.go
#	routers/api/v1/repo/collaborators.go
#	routers/api/v1/repo/pull_review.go
#	routers/web/repo/issue_page_meta.go
#	routers/web/repo/pull_review.go
#	routers/web/repo/view_file.go
#	services/issue/assignee.go
#	services/issue/issue.go
#	services/pull/pull.go
#	services/pull/review_request_code_owner.go
#	tests/integration/api_pull_review_test.go
#	tests/integration/pull_review_test.go
silverwind added a commit to silverwind/gitea that referenced this pull request Oct 22, 2026
* origin/main: (26 commits)
  chore: sync pnpm engines version with packageManager (go-gitea#39950)
  fix(ui): commit hashes in the activity feed are misaligned (go-gitea#39883)
  fix(api): adding issue labels by name attaches both the repo and the org label (go-gitea#39873)
  fix(feed): hide release notes in tags feed without releases access (go-gitea#39944)
  build(tools): install playwright deps only when that needs no prompt (go-gitea#39905)
  fix(actions): bound requested artifact retention (go-gitea#39894)
  docs: clarify reverse proxy authentication requirements (go-gitea#39940)
  enhance: remove box-shadow from kbd elements (go-gitea#39943)
  refactor: prevent out-of-bounds read (go-gitea#39936)
  fix(migrations): use cursor pagination for GitHub issue migration too (go-gitea#39888)
  enhance(webhook): show sender avatar on Slack notifications (go-gitea#39656)
  fix(api): check unit read permission in issue sub-resource endpoints (go-gitea#39885)
  fix(oauth2): decode form-encoded client credentials in HTTP Basic auth (go-gitea#39926)
  fix(issues): keep one row per issue when sorting by exclusive label order (go-gitea#39364)
  test(e2e): enable async clipboard testing pref in Firefox (go-gitea#39838)
  chore(deps): update dependencies, migrate to connectrpc.com/connect v2 (go-gitea#39854)
  test: fix unit tests failing on repeated runs (go-gitea#39915)
  [skip ci] Updated translations via Crowdin
  refactor(api): load assignees list correctly (go-gitea#39917)
  chore(maintainers): add SudhanshuMatrix as maintainer (go-gitea#39922)
  ...

# Conflicts:
#	go.sum
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. type/testing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants