Skip to content

Stub the gem upstream in the server tests - #727

Merged
andrew merged 1 commit into
mainfrom
stub-gem-specs-test
Nov 15, 2026
Merged

andrew merged 1 commit into
mainfrom
stub-gem-specs-test

Conversation

@andrew

@andrew andrew commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

The test server in internal/server/server_test.go mounted the gem handler against rubygems.org, so TestGemSpecs downloaded the real specs.4.8.gz (about 6 MB) on every run. On a slow connection it hit the 30s upstream timeout and panicked with net/http: abort Handler.

The test server now points the gem handler at an httptest upstream, and TestGemSpecs checks that the upstream body comes back through /gem/specs.4.8.gz instead of only checking for a non-404.

Summary by CodeRabbit

  • Tests
    • Improved coverage for the Gem specs endpoint by verifying it returns HTTP 200 and the expected response body.

Copilot AI balanced review requested due to automatic review settings November 15, 2026 15:19
@coderabbitai

coderabbitai Bot commented Nov 15, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The test server now supplies the Gem handler with an upstream that returns specs. TestGemSpecs checks for HTTP 200 and the exact response body.

Changes: Gem specs response test

Layer / File(s) Summary
Gem handler response test
internal/server/server_test.go
The test server configures a test upstream that returns specs. TestGemSpecs checks for HTTP 200 and the exact response body.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Change: Other

Suggested reviewers: kokes, simonchrz

Merge Risk: Minimal · up to 1830e

This change only makes the Gem specs test use a local stub upstream instead of rubygems.org, which avoids slow downloads and timeouts. It does not affect production behavior and has no identified merge risk.

Security architecture risk: Minimal · up to 1830e

The change isolates a server test from an external service and strengthens its response checks. No introduced or worsened architecture-level security risk is established.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title "Stub the gem upstream in the server tests" matches the main change. The test server now points the gem handler at an httptest upstream instead of rubygems.org, and TestGemSpecs checks the u…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title "Stub the gem upstream in the server tests" matches the main change. The test server now points the gem handler at an httptest upstream instead of rubygems.org, and TestGemSpecs checks the upstream body. The title names the change and the area it touches, so it fully relates to the changeset.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 081c3d7c-2252-4574-95c7-95a6fca65323
Commits

Reviewing files that changed from the base of the PR and between e1ab4a6 and 1830e33.

Files selected for processing: 1

  • internal/server/server_test.go

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues remain for the change to make gem-route tests independent of rubygems.org.

No open issues 🎉

What changed in this PR

This PR removes the server tests’ dependency on rubygems.org, avoiding large downloads and upstream timeouts when testing the gem route.

Changes:

  • Replace the real gem upstream with a local httptest server and register cleanup.
  • Strengthen TestGemSpecs to require HTTP 200 and the exact upstream response body.
File Description
internal/​server/​server_test.go Stub the gem upstream and verify successful response forwarding through /gem/specs.4.8.gz.

Review effort: Balanced

@andrew
andrew merged commit d391e7f into main Nov 15, 2026
13 checks passed
@andrew
andrew deleted the stub-gem-specs-test branch November 15, 2026 15:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants