test(metadata-io): Run metadata-io tests in parallel #3358
Merged
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.
The
metadata-io
project has a lot of tests that spin-up a Docker container, which takes 10-12s before the actual tests can run. There are 5 ElasticSearch containers. Soon there will be a Dgraph (#3261) and a Cassandra (#3286) container as well.The pure tests take around 2 minutes:
Gradle seems to instantiate all tests in a project first and call the
@BeforeTest
method which starts the required containers. All these containers are started sequentially, before the first test is run inmetadata-io
. Then, few tests run in parallel. SeeCREATED
:Especially if you run only a specific test class, e.g.
ElasticSearchGraphServiceTest
, gradle still starts all containers sequentially to finally run only the one test class:This change makes gradle run tests inside
metadata-io
in parallel (seeCREATED
):This cuts test time into almost half (down to 1m 20s). For
ElasticSearchGraphServiceTest
only, for instance, test time cuts down from 1m 10s to 48s. The benefit will be even larger when Dgraph and Cassandra containers are used for testing.