-
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
Changes from all commits
6815eeb
db38c57
a1559d0
76db0f9
db3c908
c8381bb
2879ed3
9afa007
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -65,13 +65,37 @@ npm run test | |
|
|
||
| ### Mock Server for Client Tests | ||
|
|
||
| The `algod_client`, `indexer_client`, and `kmd_client` packages use a Docker-based mock server for deterministic API testing. By default, running tests will automatically start the mock server container. | ||
| The `algod_client`, `indexer_client`, and `kmd_client` packages use a mock server for deterministic API testing against pre-recorded HAR files. The mock server is managed externally (not by the test framework). | ||
|
|
||
| To use an external mock server (e.g., for local development): | ||
| **In CI:** Mock servers are automatically started via the [algokit-polytest](https://github.com/algorandfoundation/algokit-polytest) setup. | ||
|
|
||
| **Local development:** | ||
|
|
||
| 1. Clone algokit-polytest and start the mock servers: | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Wouldn't you have the polytest repo locally when after running |
||
|
|
||
| ```bash | ||
| npm run polytest:start-mock-servers | ||
| ``` | ||
|
|
||
| This starts algod (port 8000), indexer (port 8002), and kmd (port 8001) in the background. | ||
|
|
||
| 2. Set environment variables and run tests. | ||
|
|
||
| | Environment Variable | Description | Default Port | | ||
| | -------------------- | ----------------------- | ------------ | | ||
| | `MOCK_ALGOD_URL` | Algod mock server URL | 8000 | | ||
| | `MOCK_INDEXER_URL` | Indexer mock server URL | 8002 | | ||
| | `MOCK_KMD_URL` | KMD mock server URL | 8001 | | ||
|
|
||
| Environment variables can also be set via `.env` file in project root (copy from `.env.template`). | ||
|
|
||
| ```bash | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Probably need to add where these should be configured. |
||
| # after setting env vars via export or .env file | ||
| npm run test | ||
| ``` | ||
|
|
||
| 3. Stop servers when done: | ||
|
|
||
| ```bash | ||
| # Set one or more of these environment variables | ||
| export MOCK_ALGOD_URL=http://localhost:18000 | ||
| export MOCK_INDEXER_URL=http://localhost:18002 | ||
| export MOCK_KMD_URL=http://localhost:18001 | ||
| npm run polytest:stop-mock-servers | ||
| ``` | ||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Uh oh!
There was an error while loading. Please reload this page.