Integration tests scaffolding#129
Merged
josecelano merged 3 commits intotorrust:developfrom Apr 29, 2023
josecelano:integration-tests-scaffolding
Merged
Integration tests scaffolding#129josecelano merged 3 commits intotorrust:developfrom josecelano:integration-tests-scaffolding
josecelano merged 3 commits intotorrust:developfrom
josecelano:integration-tests-scaffolding
Conversation
This allow the user to set the por to 0 and the OS will assign a free port to the server. This will be used by iuntegration tests to run each test with a different app instance running on a different port.
To be able to run it from tests.
It allows integration test to run a custom env (with a custom configuration) and totally isolated from other tests. The test env used a socket address assigned from the OS (free port). You can do that by setting the port number to 0 in the config.toml file: ``` [net] port = 0 ```
Member
Author
|
ACK 6d5e002 |
josecelano
added a commit
that referenced
this pull request
May 3, 2023
14d0acb refactor: run e2e tests with independent isolated servers too. (Jose Celano) 1df870b refactor: extract logic for setting up test envs (Jose Celano) 36f17f1 tests: panic when E2E server env is not running (Jose Celano) bce946f refactor: removed unneeded intermediary var (Jose Celano) Pull request description: We are running all E2E with the same application instance. The process is as follows: 1.- Start docker containers with E2E env. 2.- Run E2E tests. 3.- Stop containers. After merging this [PR](#129), we can run an isolated app instance for each test. This PR allows E2E tests to be executed with isolated app instances: - Without using docker. - And in a way, we can mock services, setting the initial test state easier, etcetera. For now, we can run most of the E2E tests twice: with the shared docker instance or with the isolated app instances. YOu can change the behaviour with an env var. With the shared app (docker): ```text TORRUST_IDX_BACK_E2E_SHARED=true cargo test ``` With isolated app instance (only rust): ```text cargo test ``` Some tests cannot be executed in an isolated env because they require a running tracker. We could change them to use a mock. In general, I would try to keep only a few E2E tests using the real tracker and most of them using the mock. In the future, we could differentiate them using a different folder. Right now, the ones that require the running tracker have this: ```rust if !env.provides_a_tracker() { return } ``` to skip the test when the test env does not provide a running tracker. ACKs for top commit: josecelano: ACK 14d0acb Tree-SHA512: 3ab562785938548caf238fd91d6894d0a1dc8e02eece10e157286fc9cb2950f9fdf5393c97b696ee5bde24577191c268fd95764eee5604f51b2ab314154f3125
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.
Changes needed to run tests with independent app instances running on different ports.