Skip to content

Conversation

sksamuel
Copy link
Member

@sksamuel sksamuel commented Jul 7, 2025

No description provided.

@sksamuel sksamuel requested a review from a team as a code owner July 7, 2025 04:43
@sksamuel sksamuel added this to the 6.0 milestone Jul 7, 2025
Comment on lines +10 to +22
/**
* A Kotest [MountableExtension] for [GenericContainer]s that will launch the container
* upon first install, and close after the test suite has completed. This extension will only
* launch the container once per project, and will not reset it between specs.
*
* Note: This extension requires Kotest 6.0+
*
* @param container the specific test container type
*/
class TestContainerProjectExtension(
private val container: GenericContainer<*>,
) : MountableExtension<GenericContainer<*>, Unit>, AfterProjectListener, TestListener {

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would this be installed from an AbstractProjectConfig? Or would you just install it in every spec that uses the container anyway?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You install it in every one, but it's only started once, so your test suite is quick. It's like a "lazy" container basically.
We use this pattern everywhere at Grindr.

@sksamuel sksamuel merged commit 5dd011f into master Jul 7, 2025
7 checks passed
@sksamuel sksamuel deleted the sks/tcs branch July 7, 2025 07:42
Kantis pushed a commit to JesusMcCloud/kotest that referenced this pull request Jul 12, 2025
<!-- 
If this PR updates documentation, please update all relevant versions of
the docs, see:
https://github.com/kotest/kotest/tree/master/documentation/versioned_docs
The documentation at
https://github.com/kotest/kotest/tree/master/documentation/docs is the
documentation for the next minor or major version _TO BE RELEASED_
-->
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.

2 participants