Skip to content

Cassandra reuseContainer fails if the container was already created before (and has a keyspace) #1376

Open
@Aschraf

Description

@Aschraf

Describe the bug
In case the container is already running (from a previous test), and the keyspace already present, this init fails

The following script is used to initialize Cassandra keyspace:

https://github.com/PlaytikaOSS/testcontainers-spring-boot/blob/develop/embedded-cassandra/src/main/resources/cassandra-init.sql.template

Expected behavior
The keyspace should not be recreated if it already exists. The following could be used:

CREATE KEYSPACE IF NOT EXISTS {{keyspaceName}} WITH REPLICATION = { 'class':'SimpleStrategy', 'replication_factor' : {{replicationFactor}} }

Enviroment (please complete the following information):

  • OS name : [e.g. MacOS]
  • Docker Version: [e.g. 20.10.24]

Module:

  • Module Name: emdedded-cassandra
  • Module Version: 3.0.0-RC8

Additional context
A workaround is to add a new cassandra-init.sql.template as part of the tests with the script mentioned before.

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