-
Notifications
You must be signed in to change notification settings - Fork 13
refactor: change test setup to use external mock servers without docker #477
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
Conversation
Updates the testing infrastructure to connect to externally managed mock servers instead of managing them internally via Docker. This change simplifies the test setup, improves consistency with the Python SDK, and allows for more flexible mock server configurations. The mock servers are now started and stopped separately, either via GitHub Actions in CI or manually for local development. The test framework connects to these servers using environment variables.
Refactors the test setup to leverage the algokit-polytest action for managing mock servers, providing a more robust and maintainable solution for integration tests. This change: - Updates the PR workflow to include the `decoupling-bun-mock-server` branch - Removes the local mock server start script - Uses the `algokit-polytest` action to start the mock servers - Adds a `--silent` flag to the test command to reduce output verbosity - Updates testing package to leverage default ports This ensures a consistent mock server environment and simplifies the setup process.
691c9cc to
a1559d0
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR refactors the test infrastructure from Docker-based mock servers to externally managed mock servers. The change removes local Docker container management logic in favor of relying on GitHub Actions (in CI) or manually started mock servers (for local development). This simplifies the test setup by delegating server lifecycle management to the algokit-polytest project.
- Replaced Docker-based mock server management with external server connections via environment variables
- Updated CI workflow to use dedicated GitHub Actions for starting mock servers
- Revised documentation to guide developers on starting mock servers locally using algokit-polytest scripts
Reviewed changes
Copilot reviewed 6 out of 67 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
packages/testing/src/mockServer.ts |
Removed Docker container management code; replaced startMockServer with simpler getMockServer that reads from environment variables |
packages/testing/src/index.ts |
Updated exports to remove Docker-specific functions and export new checkServerHealth function |
packages/testing/src/globalSetup.ts |
Simplified setup/teardown logic to connect/disconnect rather than start/stop containers |
packages/algod_client/tests/*.test.ts |
Added numerous new test files with placeholder implementations |
packages/algod_client/tests/__snapshots__/*.snap |
Added snapshot files for new test cases |
package.json |
Removed mock-server:start-algod script |
package-lock.json |
Added peer: true flags to various dependencies |
README.md |
Updated documentation with instructions for using external mock servers locally |
.github/workflows/pr.yml |
Restructured workflow to use algokit-polytest GitHub Actions for mock server management |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <[email protected]>
774021d to
5935c9a
Compare
Co-authored-by: Copilot <[email protected]>
5935c9a to
db3c908
Compare
|
|
||
| **Local development:** | ||
|
|
||
| 1. Clone algokit-polytest and start the mock servers: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't you have the polytest repo locally when after running npm run polytest:validate-algod. Maybe it's better to document the flow using npm run commands.
README.md
Outdated
| git clone https://github.com/algorandfoundation/algokit-polytest.git | ||
|
|
||
| # Start all mock servers (recommended) | ||
| cd algokit-polytest/resources/mock-server |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it makes sense to have an npm run command for this.
|
|
||
| 2. Set environment variables and run tests: | ||
|
|
||
| ```bash |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably need to add where these should be configured.
README.md
Outdated
| ./scripts/stop_all_servers.sh | ||
| ``` | ||
|
|
||
| | Environment Variable | Description | Default Port | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The env info is probably better placed in step 2
|
🎉 This PR is included in version 10.0.0-alpha.1 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Proposed Changes