Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR focuses on increasing automated test coverage in the copi.owasp.org Elixir/Phoenix app, particularly around rate limiting and IP extraction logic, and adds some supporting test-runner configuration.
Changes:
- Expanded/adjusted tests for rate limiting (Plug + LiveView) and IP extraction helpers to cover more branches.
- Added a new schema changeset test (
ContinueVote) to raise overall coverage. - Added/updated test environment tooling/config (Docker Compose test runner, test DB host env var, minor workflow tweak) and bumped
nimble_ownership.
Reviewed changes
Copilot reviewed 8 out of 9 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| copi.owasp.org/test/copi_web/plugs/rate_limiter_plug_test.exs | Reworked plug tests to cover forwarded vs remote vs missing IP paths and 429 behavior. |
| copi.owasp.org/test/copi_web/live/player_live_test.exs | Avoids heavy LiveView/DB loops by simulating rate limit saturation directly. |
| copi.owasp.org/test/copi_web/live/game_live_test.exs | More robust selector for starting a game; adds coverage for ignoring non-matching broadcast topics. |
| copi.owasp.org/test/copi/ip_helper_test.exs | Replaces/expands IP helper coverage across conn/socket/connect_info scenarios and formatting. |
| copi.owasp.org/test/copi/cornucopia/continue_vote_test.exs | Adds changeset validity tests for ContinueVote. |
| copi.owasp.org/mix.lock | Bumps nimble_ownership patch version. |
| copi.owasp.org/docker-compose.test.yml | Introduces a docker-compose-based test runner with Postgres for local/CI usage. |
| copi.owasp.org/config/test.exs | Makes test DB hostname configurable via DB_HOST. |
| .github/workflows/copi-deploy-staging.yml | Minor YAML change for test step formatting (no functional change expected). |
sydseter
approved these changes
Mar 1, 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.
Fixes #2157
This PR improves the overall test coverage for the
copiapplication to 81.9%. Let's review the approach and the changes that made this possible:Changes Include:
ADDGROUPerror to allow building the test image, and addedcoveralls.jsonto properly exclude non-testable boilerplate files (like migrations) from coverage metrics.CornucopiaLogicTestto cover the complex scoring and game logic helper functions.GameLiveandPlayerLiveto handle end-to-end interactions like card selection, voting, and rate-limiting rules.RateLimiterPlugTest,IpHelperTest, andCoreComponentsTest).Nested mappingsbug in the GitHub .github/workflows/copi-deploy-staging.yml file.Verification
Finished in 1.9 seconds (0.5s async, 1.4s sync)
57 tests, 0 failures