Skip to content

Restart the tc_initscript before each test  #3239

Open
@rolintoucour

Description

@rolintoucour

Hi,

I successfully set up TestContainers in a quarkus application with this kind of configuration:

%test.quarkus.datasource.url=jdbc:tc:postgresql:11:///dbname?TC_INITSCRIPT=file:src/test/resources/init.sql

However in some tests I delete rows; and I'd like that each test start with the same database state.

Is there any way to force TestContainers to re-run the initscript before each test, or even each test class?

PS: I could probably init the containers myself from test classes to achieve it; however I set up 3 different databases and it would need lot of boilerplate code.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions