Repository navigation
test: run integration tests against a real server on every pull request - #8651
Merged
Merged
Conversation
- Missing SSH keys, Git blobs and references are 404 rather than 500. - Created labels report their IDs. - Git trees list each entry's real mode. - Creating a repository with a taken name through API v1 is 422. - Writing contents to an existing non-default branch works. - Deleting an upload that is already gone no longer fails. - /user/activate_email and /user/email2user redirect to the right pages.
The suite builds Gogs, starts it on Postgres and calls it over HTTP. Tests share the server's database and session files, so they seed data through the stores and read secrets, e.g., captcha text and TOTP secrets. A full run fails when any route other than a page of the web app gets no request, judged by the server's request spans. Runs on every pull request.
|
Preview deployment for your docs. Learn more about Mintlify Previews.
💡 Tip: Enable Automations to automatically generate PRs for you. |
Drop the test database after terminating its connections rather than with DROP DATABASE WITH (FORCE), which needs PostgreSQL 13, and run CI on the minimum supported version.
Rename the package to integrationtests and update the paths in CI, the moon task and the local development docs.
This was referenced Nov 17, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Describe the pull request
Adds integration tests that run against a real Gogs server on every pull request, and fixes the 10 bugs they found.
internal/integrationtestbuilds Gogs, startsgogs webon a new Postgres database with a configuration of its own, and calls it over HTTP. The test process loads the same configuration, so tests seed data through the stores and read what the server stores, e.g., captcha text from the session files and TOTP secrets, recovery codes and activation codes from the database. None of this code is built into Gogs..github/workflows/integration.ymlruns the suite on Postgres 17 on every pull request, andmoon run gogs:test-integrationruns it locally.Bugs fixed:
100644instead of120000for a regular file./user/activate_emailredirects to the email settings with?activated=1instead of an escaped path, and/user/email2userredirects to the profile instead of a page that is not found.Link to the issue: n/a
Checklist
Test plan
GOGS_INTEGRATION_TEST=1 PGHOST=localhost PGPORT=5432 PGUSER=postgres PGPASSWORD=... PGSSLMODE=disable go test -count=1 -shuffle=on ./internal/integrationtest/passes on Postgres 15 with every route covered, and drops its database afterwards. It also passed withpublic/distremoved.go test ./internal/database/ ./internal/git/ ./internal/route/api/v1/passes, andgolangci-lint runreports 0 issues.AI usage
Written with Amp, including parallel subagents for the tests of each area of routes. Reviewed and run as described above.