Skip to main content
added 417 characters in body
Source Link
rieckpil
  • 12.2k
  • 3
  • 41
  • 66

This might due to an inconsistent behavior of the constructors of the different Testcontainers modules in the past. It was fixed with this commit and should be available since Testcontainers 1.15.0.

Not sure if your sample was pseudo test code, but the following example is a valid copy-pastable example:

public class MariaDbContainerTest { private static final JdbcDatabaseContainer DB = new MariaDBContainer("mariadb:10.5.8"); static { DB.start(); } @Test public void test() { } } 

I've tested it for both Testcontainers 1.15.0 and 1.15.1 and it works on my machine.

UPDATE: I've not seen that you also specify the JDBC support of Testcontainers inside your application.properties file in addition to your manual container definition as part of your test.

Pick either the JDBC support OR the manual container definition and your problem should be resolved.

When using the JDBC support you can also specify the version of your database: jdbc:tc:mariadb:10.5.8:///test

This might due to an inconsistent behavior of the constructors of the different Testcontainers modules in the past. It was fixed with this commit and should be available since Testcontainers 1.15.0.

Not sure if your sample was pseudo test code, but the following example is a valid copy-pastable example:

public class MariaDbContainerTest { private static final JdbcDatabaseContainer DB = new MariaDBContainer("mariadb:10.5.8"); static { DB.start(); } @Test public void test() { } } 

I've tested it for both Testcontainers 1.15.0 and 1.15.1 and it works on my machine.

This might due to an inconsistent behavior of the constructors of the different Testcontainers modules in the past. It was fixed with this commit and should be available since Testcontainers 1.15.0.

Not sure if your sample was pseudo test code, but the following example is a valid copy-pastable example:

public class MariaDbContainerTest { private static final JdbcDatabaseContainer DB = new MariaDBContainer("mariadb:10.5.8"); static { DB.start(); } @Test public void test() { } } 

I've tested it for both Testcontainers 1.15.0 and 1.15.1 and it works on my machine.

UPDATE: I've not seen that you also specify the JDBC support of Testcontainers inside your application.properties file in addition to your manual container definition as part of your test.

Pick either the JDBC support OR the manual container definition and your problem should be resolved.

When using the JDBC support you can also specify the version of your database: jdbc:tc:mariadb:10.5.8:///test

Source Link
rieckpil
  • 12.2k
  • 3
  • 41
  • 66

This might due to an inconsistent behavior of the constructors of the different Testcontainers modules in the past. It was fixed with this commit and should be available since Testcontainers 1.15.0.

Not sure if your sample was pseudo test code, but the following example is a valid copy-pastable example:

public class MariaDbContainerTest { private static final JdbcDatabaseContainer DB = new MariaDBContainer("mariadb:10.5.8"); static { DB.start(); } @Test public void test() { } } 

I've tested it for both Testcontainers 1.15.0 and 1.15.1 and it works on my machine.