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

Docker compose cluster shuts down after nested test class JUnit5 #367

Open
Dutzen opened this issue Sep 23, 2019 · 1 comment
Open

Docker compose cluster shuts down after nested test class JUnit5 #367

Dutzen opened this issue Sep 23, 2019 · 1 comment

Comments

@Dutzen
Copy link

Dutzen commented Sep 23, 2019

What happened?

The docker compose cluster shuts down after one of the nested testclasses finishes in JUnit 5.

23.09.2019 14:29:04.631: TRACE c.p.d.c.e.DefaultDockerCompose-[accept]:372 - Killing 18ff53d5_db_1 ... 
23.09.2019 14:29:04.933: TRACE c.p.d.c.e.DefaultDockerCompose-[accept]:372 - 
23.09.2019 14:29:04.933: TRACE c.p.d.c.e.DefaultDockerCompose-[accept]:372 - Killing 18ff53d5_db_1 ... done
23.09.2019 14:29:05.008: TRACE c.p.d.c.e.DefaultDockerCompose-[accept]:372 - 
23.09.2019 14:29:05.624: TRACE c.p.d.c.e.DefaultDockerCompose-[accept]:372 - db

I added the dockerComposeExtension as mentioned with @RegisterExtension

public static DockerComposeExtension docker = DockerComposeExtension.builder()
            .file("intTestResources/docker-compose.yml")
            .waitingForService(DATABASE, waitForDBInit, Duration.standardSeconds(60))
            .pullOnStartup(true)
            .saveLogsTo("dockerLogs/ConValTest")
            .build();

Afterwards i created some subclasses and annotated them as @nested

    @DisplayName("Article")
    @Nested
    class validateArticle {
       [...] 
    }

    @DisplayName("Media")
    @Nested
    class validateMedia {
       [...] 
    }

What did you want to happen?

When the first nested subclass (e.g. 'validateArticle' ) finishes executing all its tests, the docker compose cluster begins to stop the service. So the remaining classes can't be executed because they are missing the connection to the docker mysql container.

How can you configure the shutdown mechanism to be executed only after the whole testclass with all its subclasses has finished?

@kicktipp
Copy link

kicktipp commented Sep 6, 2022

I had a similar problem. Maybe this issue helps you.

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