Repository navigation
test: cut low-value tests, close coverage gaps and fix the test infrastructure - #418
Merged
Merged
Conversation
…structure Audit of the whole suite: remove tests that could not fail, tested the framework or duplicated each other; parameterise one-input-per-test files; rewrite weak assertions; replace random-id 404 checks with cross-user ownership checks; move pure-function cases from integration to unit tests. Coverage added: admin endpoints refusing non-admins and API tokens, API tokens unable to mint tokens, cross-user access on tokens, sessions, shockers and devices, public-share hub control, share-code linking, password reset with a wrong or reused secret, legacy PBKDF2 verification. Test infrastructure: stop Hangfire and the outbox listener in the Cron test host, share the container fixtures through IntegrationTests.Shared, set the client location per request instead of process-wide state, make the Turnstile fake check the secret, drop the unused Docker network, packages and data files, bootstrap the database through the production migration path. Production: extract the rate-limiter partition selectors into RateLimitPartitions so they can be unit tested, remove the uncalled DeleteSessionByTokenAsync and HostMatchesCookieDomain, fix three comments.
TestHelper.UniqueEmail/UniqueUsername only forwarded to UniqueNames, and PostgresFixture.ConnectionString only forwarded to a private static. Call the real targets directly.
Contributor
|
Important Review skippedToo many files! This PR contains 111 files, which is 11 over the limit of 100. To get a review, reduce the PR to 100 files or fewer by splitting it into smaller PRs or changing its base branch. Upgrade to a paid plan to raise the limit. This organization's CodeRabbit subscription is cancelled. Resubscribe in Billing to continue reviews beyond the free-tier limit.
|
The pinned image enables TimescaleDB through its default command, and Testcontainers replaces that command with its own flags, so the extension was not preloaded and every integration test failed in the session hook.
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.
What
An audit of the whole test suite, then the fixes. Test methods go from 565 to 420 while coverage goes up.
Removed or rewritten
[Range],[StringLength],required, JSON enum converter, BCrypt salting).AuthorizationTests; flows that were a prefix of another test.DomainUtils,UsernameValidator,SemVersion,PermissionUtils, ...).Coverage added
Test infrastructure
IntegrationTests.Sharedproject; the unused Docker network, packages and data files are gone.GeoLocatedWebApplicationFactoryremoved).Production changes (small)
Common/Utils/RateLimitPartitions.cs(behaviour unchanged) so they can be unit tested.ISessionService.DeleteSessionByTokenAsyncandDomainUtils.HostMatchesCookieDomain, which only tests called.Verification
Common.TestsandCron.Testspass.Review notes
ghcr.io/openshock/postgres-timescaledb:2.32.1-18.7-trixie(the image the compose files pin). It has not been confirmed to start under Testcontainers.TimescaleDbRequirementTestsare still on floating tags.LimitNormalizationMigrationTestsandPendingSignupsMigrationTestsare kept until their migrations have shipped.PasswordAttributebounds password length with the email-address length constants.