8000 recorder: improve tests by maruel · Pull Request #120 · dnaeon/go-vcr · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

recorder: improve tests #120

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: v4
Choose a base branch
from

Conversation

maruel
Copy link
Contributor
@maruel maruel commented Jun 13, 2025

Test only change. No functional change.

Fixes #119.

  • Use t.TempDir() instead of creating a temporary directory. The temporary directories were leaking.
  • Make tests parallel to shave 70ms off test runtime on my machine. Woohoo!
  • Add unit test for recording and playback with query parameters

The test verifies that POST requests with query parameters (?foo=bar&baz=true) are properly recorded and can be replayed from cassette. This ensures both the recording phase captures the query parameters in the Form field and the playback phase returns the correct response without hitting the actual server.

Change-ID: s5b05187d5bf0a5c1k

Test only change. No functional change.

Fixes dnaeon#119.

- Use t.TempDir() instead of creating a temporary directory. The
  temporary directories were leaking.
- Make tests parallel to shave 70ms off test runtime on my machine. Woohoo!
- Add unit test for recording and playback with query parameters

The test verifies that POST requests with query parameters (?foo=bar&baz=true)
are properly recorded and can be replayed from cassette. This ensures both the
recording phase captures the query parameters in the Form field and the playback
phase returns the correct response without hitting the actual server.

Co-Authored-By: sketch <hello@sketch.dev>
Change-ID: s5b05187d5bf0a5c1k
@codecov-commenter
Copy link

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 51.38%. Comparing base (c4bdf46) to head (c0f7cec).

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##               v4     #120      +/-   ##
==========================================
+ Coverage   50.77%   51.38%   +0.61%     
==========================================
  Files           4        4              
  Lines         648      648              
==========================================
+ Hits          329      333       +4     
+ Misses        299      295       -4     
  Partials       20       20              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.


// Phase 2: Test playback without the server running
// Stop the test server to ensure we're replaying from cassette
server.Close()
Copy link
Owner

Choose a reason for hiding this comment

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

server will be closed already as deferred here.

}
}

{
Copy link
Owner

Choose a reason for hiding this comment

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

Any reason for the explicit scope introduced here?

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.

POST with query arguments ?foo=bar and body (e.g. JSON) fail to match
3 participants
0