quarkiverse / quarkus-amazon-services

Quarkus Amazon Services extensions
Apache License 2.0
41 stars 49 forks source link

Wait for localstack to be ready #1090

Closed dagrammy closed 9 months ago

dagrammy commented 9 months ago

Hi everybody,

we use quarkus.aws.devservices.localstack.init-scripts-folder to initialize localstack before starting tests (e.g. to write SSM parameters).

When the tests are executed, however, localstack may not yet be ready because the script has not yet been executed to completion. For example, the SSM parameters cannot yet be found.

I have a reproducer for the problem here: https://github.com/dagrammy/ssm-devservices-test

As a workaround we currently use a @QuarkusTestResource' and the localstack endpoint/_localstack/init` to wait for localstack until it is ready.

Could something like this be built directly into the start of localstack or the dev services?

I would like to have a look at this myself, maybe someone can point me in the right direction. 🙂

scrocquesel commented 9 months ago

You should be able to wait for a message with quarkus.aws.devservices.localstack.init-completion-msg

We do something similar here https://github.com/quarkiverse/quarkus-amazon-services/tree/main/integration-tests/src/test/resources

dagrammy commented 9 months ago

Thank you, I overlooked this configuration property in the documentation. 🤦

quarkus.aws.devservices.localstack.init-completion-msg works perfectly for this use case!