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

Is there a way to share the same single container instance between suites? #160

Open
pgorin opened this issue Jan 21, 2021 · 3 comments
Open

Comments

@pgorin
Copy link

pgorin commented Jan 21, 2021

Hi, first of all, thank you for your work, I use it extensively :)
I wll be glad if you can guide me with this issue!

Regards,
Pato.

@LMnet
Copy link
Contributor

LMnet commented Jan 22, 2021

Hi @pgorin. At the current moment, there is no supported way for doing this. It's because scalatest doesn't provide any functionality for sharing data like this between tests.

But there is a bit hacky way for sharing containers: you can start containers and just don't stop them. Testcontainers will eventually close all started containers after your tests. There is a special Ryuk container for that. Testcontainers always start it before any other container to avoid resource leaking.

@pgorin
Copy link
Author

pgorin commented Jan 26, 2021

Hi Yuriy, thank you for your reply.
What do you mean about a special Ryuk container? Can I still using TestContainerForAll approach or I have to perform custom before and after routines?

Again, thank you!

@LMnet
Copy link
Contributor

LMnet commented Jan 26, 2021

https://hub.docker.com/r/testcontainers/ryuk

Can I still using TestContainerForAll approach or I have to perform custom before and after routines?

No, you can't use TestContainerForAll or any other built-in traits for that approach. You will need to manually start containers and don't stop them after tests. Also, you will need to somehow share containers between tests (through some global state).

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

No branches or pull requests

2 participants