Skip to content
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

[Backport stable/8.0] Testcontainer engine lifecycle #313

Merged
merged 3 commits into from
Apr 12, 2022

Conversation

github-actions[bot]
Copy link

Description

Backport of #311 to stable/8.0.

relates to camunda-community-hub/spring-zeebe#189 #304

By not immediately starting the engine upon starting the container we become more flexible with the lifecycle of the engine in our extensions. This allows us to start it when we want to, instead of being tied to the testcontainer which has a different lifecycle from the engine.

(cherry picked from commit 8ea4c0d)
By default a testcontainer uses the HostPortWaitStrategy. This will wait until all the configured exposed ports have something running on them.
Since we no longer start the engine upon testcontainer start, there will by no process running that's using the gateway port. This results in the testcontainer waiting until timeout.

By changing the waiting strategy to a LogMessageWaitStrategy we can tell the testcontainer startup has finished by logging a line, without the need of starting the engine already.

(cherry picked from commit 66d0381)
The start of the engine was tied to the start of testcontainer. This resulted in the following lifecycle:
1. BeforeAll - start the testcontainer and the engine
2. BeforeEach - stop the engine, recreate it and start it (reset)

This causes some strange behaviour. Upon test start we are starting the engine and resetting it without using it. With this change the lifecycle becomes somewhat more natural:
1. BeforeAll - start the testcontainer
2. BeforeEach - start the engine
3. AfterEach - stop the engine and recreate it (new reset)

This new lifecycle also matches more closely with the embedded lifecycle where we do:
1. BeforeEach - create and start the engine
2. AfterEach - stop the engine

(cherry picked from commit 687bf5b)
@github-actions github-actions bot mentioned this pull request Apr 12, 2022
7 tasks
@remcowesterhoud remcowesterhoud self-requested a review April 12, 2022 14:54
@remcowesterhoud remcowesterhoud merged commit 45d7fc9 into stable/8.0 Apr 12, 2022
@remcowesterhoud remcowesterhoud deleted the backport-311-to-stable/8.0 branch April 12, 2022 15:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant