Refactor: run all E2E tests with isolated servers#133
Merged
josecelano merged 4 commits intotorrust:developfrom May 3, 2023
josecelano:run-all-e2e-test-wih-independend-servers
Merged
Refactor: run all E2E tests with isolated servers#133josecelano merged 4 commits intotorrust:developfrom josecelano:run-all-e2e-test-wih-independend-servers
josecelano merged 4 commits intotorrust:developfrom
josecelano:run-all-e2e-test-wih-independend-servers
Conversation
It shows a more user-friendly message when you run E2E tests and the server is not responding on the default location http://localhost:3000
E2E tests can be executed with an external shared running app (that must be started before running all the tests) or with an isolated env per test (that can be customized and it lasts only until the end of the test).
E2E tests can be executed with a shared app instance with: ``` TORRUST_IDX_BACK_E2E_SHARED=true cargo test ``` or with an isolated instance per test: ``` cargo test ``` In the first case, you have to start the env manbually before running the tests, and manually stop it when tests are finished. In the second test, the test will launch a new app on a different socket using a different database. Shared env: - Requires docker - It's slower - It comes with a real traker Isolated env: - Doesn't require docker - It's faster - You have to mock the TrackerService (not implemented yet)
Member
Author
|
ACK 14d0acb |
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.
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, we can run an isolated app instance for each test.
This PR allows E2E tests to be executed with isolated app instances:
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):
With isolated app instance (only rust):
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:
to skip the test when the test env does not provide a running tracker.