Add end-to-end tests for publish and install commands#30
Merged
fullstackjam merged 1 commit intomainfrom Apr 19, 2026
Merged
Conversation
Covers three P7 invariants without requiring a real macOS environment: - snapshot --publish --slug X sends PUT with config_slug + Bearer token - snapshot --publish with a saved sync source resolves to PUT (update) - install user/slug --dry-run --silent sends GET with Bearer token Uses httptest.NewServer as the API backend; HOME and OPENBOOT_API_URL are isolated per test so state never leaks between runs. Tag is //go:build e2e (no vm or destructive tags) so CI can run it without a macOS VM. https://claude.ai/code/session_01DfSdBjWHaSGgwzkKRYoa9C
|
👋 Thanks for opening this pull request! Before merging:
@fullstackjam will review this soon. Thanks for contributing! 🚀 |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
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 does this PR do?
Adds comprehensive end-to-end tests for the
snapshot --publishandinstallcommands, verifying correct HTTP request behavior against a mock API server.Why?
These tests validate critical invariants (P7) around authentication, request methods, and payload structure:
snapshot --publish --slug Xmust use PUT (not POST) with the slug in the request bodysnapshot --publishwithout a slug must resolve to a PUT using a saved sync sourceinstall user/slugmust fetch the cloud config with proper Bearer token authenticationThe tests use a mock HTTP server to capture and verify the exact requests made by the binary, ensuring the client correctly implements the API contract.
Testing
Notes for reviewer
The test file uses the
//go:build e2ebuild tag to keep these integration tests separate from unit tests. The mock server infrastructure (reqLog,newMockServer) is reusable for future API contract tests. All tests properly clean up resources viat.Cleanup().https://claude.ai/code/session_01DfSdBjWHaSGgwzkKRYoa9C