How to properly run spock test using testcontainers in spring boot












2















I have a spring boot app, with test written using spock and testcontainers (mysql). What I've made is working fine, but it doesn't feel right (f.e. becuase @sql goes for each test iteration so I have to use INSERT IGNORE ... in my sql script. I am also not happy about the trick with static and non-static mysqlcontainer).
I am a total beginner when it comes to testcontainers (and spock actually) so If some could tell me how to make it better using spock, @sql, datasource and testcontainers I would be grateful.



@SpringBootTest
@ContextConfiguration(initializers = Initializer.class)
@Testcontainers
class GeneratorTest extends Specification {

public static MySQLContainer staticMySQLContainer = new MySQLContainer()
.withDatabaseName("test")
.withUsername("test")
.withPassword("test")

@Shared
public MySQLContainer mySQLContainer = mySQLContainer;

static class Initializer implements ApplicationContextInitializer<ConfigurableApplicationContext> {

@Override
void initialize(@NotNull ConfigurableApplicationContext configurableApplicationContext) {
TestPropertyValues values = TestPropertyValues.of(
"spring.datasource.url=" + staticMySQLContainer.getJdbcUrl(),
"spring.datasource.password=" + staticMySQLContainer.getPassword(),
"spring.datasource.username=" + staticMySQLContainer.getUsername()
)
values.applyTo(configurableApplicationContext)
}
}

@Autowired
private CarService carService
@Autowired
private BikeRepository bikeRepository

@Sql("/testdata/insert_into_cars.sql")
def "validate number of doors"(int carId, int expectedNrOfDoors) {
given:
Car car = carService.getById(carId)

expect:
car.getNrOfDoors() == expectedNrOfDoors

where:
carId || expectedNrOfDoors
1 || 3
2 || 3
3 || 5
}
}




Updated (use of jdbc-based containers):

When it comes to JDBC-based containers I'm not sure If I set it up correctly. I've created application-test.properties in test/resources directory. I've put there:



spring.datasource.url=jdbc:tc:mysql:8.0.12://localhost:3306/shop?createDatabaseIfNotExist=true&serverTimezone=UTC
spring.datasource.username=test
spring.datasource.password=test
spring.datasource.driver-class-name=org.testcontainers.jdbc.ContainerDatabaseDriver


and my test class looks like:



@SpringBootTest
@Testcontainers
@TestPropertySource(locations="classpath:application-test.properties")
class GeneratorTest extends Specification {

@Autowired
private CarService carService

<skipped for brevity>


When I try to run the test class I'm keep getting:



    2018-11-20 19:10:25.409 2612@DESKTOP-MLK30PF  INFO --- [main] 🐳 [mysql:8.0.12].waitUntilContainerStarted : Waiting for database connection to become available at jdbc:mysql://192.168.99.100:32770/shop using query 'SELECT 1' (JdbcDatabaseContainer.java:128) 
2018-11-20 19:12:25.420 2612@DESKTOP-MLK30PF ERROR --- [main] 🐳 [mysql:8.0.12].tryStart : Could not start container (GenericContainer.java:297)
org.rnorth.ducttape.TimeoutException: org.rnorth.ducttape.TimeoutException: java.util.concurrent.TimeoutException
at org.rnorth.ducttape.unreliables.Unreliables.retryUntilSuccess(Unreliables.java:53)
at org.testcontainers.containers.JdbcDatabaseContainer.waitUntilContainerStarted(JdbcDatabaseContainer.java:129)
at org.testcontainers.containers.GenericContainer.tryStart(GenericContainer.java:292)


followed by



2018-11-20 19:12:25.486 2612@DESKTOP-MLK30PF  INFO --- [tc-okhttp-stream-242833949] 🐳 [mysql:8.0.12].accept : STDERR: 2018-11-20T18:10:44.918132Z 0 [System] [MY-010931] [Server] /usr/sbin/mysqld: ready for connections. Version: '8.0.12'  socket: '/var/run/mysqld/mysqld.sock'  port: 3306  MySQL Community Server - GPL. (Slf4jLogConsumer.java:32) 
2018-11-20 19:12:25.487 2612@DESKTOP-MLK30PF INFO --- [main] 🐳 [mysql:8.0.12].tryStart : Creating container for image: mysql:8.0.12 (GenericContainer.java:253)
2018-11-20 19:12:25.609 2612@DESKTOP-MLK30PF INFO --- [main] 🐳 [mysql:8.0.12].tryStart : Starting container with ID: de75c9dafed8032b84cb827bf43a29c1964bfe4e168422272c9310a4803fd856 (GenericContainer.java:266)
2018-11-20 19:12:25.896 2612@DESKTOP-MLK30PF INFO --- [main] 🐳 [mysql:8.0.12].tryStart : Container mysql:8.0.12 is starting: de75c9dafed8032b84cb827bf43a29c1964bfe4e168422272c9310a4803fd856 (GenericContainer.java:273)
2018-11-20 19:12:25.901 2612@DESKTOP-MLK30PF INFO --- [main] 🐳 [mysql:8.0.12].waitUntilContainerStarted : Waiting for database connection to become available at jdbc:mysql://192.168.99.100:32772/shop using query 'SELECT 1' (JdbcDatabaseContainer.java:128)




for issues with mysql version 8 look here



UPDATE (solved):

As @bsideup pointed out jdbc-based containers is the best solution for this use case. It works perfectly fine as I decsribed above, but I had to change mysql version from 8 to lower.










share|improve this question





























    2















    I have a spring boot app, with test written using spock and testcontainers (mysql). What I've made is working fine, but it doesn't feel right (f.e. becuase @sql goes for each test iteration so I have to use INSERT IGNORE ... in my sql script. I am also not happy about the trick with static and non-static mysqlcontainer).
    I am a total beginner when it comes to testcontainers (and spock actually) so If some could tell me how to make it better using spock, @sql, datasource and testcontainers I would be grateful.



    @SpringBootTest
    @ContextConfiguration(initializers = Initializer.class)
    @Testcontainers
    class GeneratorTest extends Specification {

    public static MySQLContainer staticMySQLContainer = new MySQLContainer()
    .withDatabaseName("test")
    .withUsername("test")
    .withPassword("test")

    @Shared
    public MySQLContainer mySQLContainer = mySQLContainer;

    static class Initializer implements ApplicationContextInitializer<ConfigurableApplicationContext> {

    @Override
    void initialize(@NotNull ConfigurableApplicationContext configurableApplicationContext) {
    TestPropertyValues values = TestPropertyValues.of(
    "spring.datasource.url=" + staticMySQLContainer.getJdbcUrl(),
    "spring.datasource.password=" + staticMySQLContainer.getPassword(),
    "spring.datasource.username=" + staticMySQLContainer.getUsername()
    )
    values.applyTo(configurableApplicationContext)
    }
    }

    @Autowired
    private CarService carService
    @Autowired
    private BikeRepository bikeRepository

    @Sql("/testdata/insert_into_cars.sql")
    def "validate number of doors"(int carId, int expectedNrOfDoors) {
    given:
    Car car = carService.getById(carId)

    expect:
    car.getNrOfDoors() == expectedNrOfDoors

    where:
    carId || expectedNrOfDoors
    1 || 3
    2 || 3
    3 || 5
    }
    }




    Updated (use of jdbc-based containers):

    When it comes to JDBC-based containers I'm not sure If I set it up correctly. I've created application-test.properties in test/resources directory. I've put there:



    spring.datasource.url=jdbc:tc:mysql:8.0.12://localhost:3306/shop?createDatabaseIfNotExist=true&serverTimezone=UTC
    spring.datasource.username=test
    spring.datasource.password=test
    spring.datasource.driver-class-name=org.testcontainers.jdbc.ContainerDatabaseDriver


    and my test class looks like:



    @SpringBootTest
    @Testcontainers
    @TestPropertySource(locations="classpath:application-test.properties")
    class GeneratorTest extends Specification {

    @Autowired
    private CarService carService

    <skipped for brevity>


    When I try to run the test class I'm keep getting:



        2018-11-20 19:10:25.409 2612@DESKTOP-MLK30PF  INFO --- [main] 🐳 [mysql:8.0.12].waitUntilContainerStarted : Waiting for database connection to become available at jdbc:mysql://192.168.99.100:32770/shop using query 'SELECT 1' (JdbcDatabaseContainer.java:128) 
    2018-11-20 19:12:25.420 2612@DESKTOP-MLK30PF ERROR --- [main] 🐳 [mysql:8.0.12].tryStart : Could not start container (GenericContainer.java:297)
    org.rnorth.ducttape.TimeoutException: org.rnorth.ducttape.TimeoutException: java.util.concurrent.TimeoutException
    at org.rnorth.ducttape.unreliables.Unreliables.retryUntilSuccess(Unreliables.java:53)
    at org.testcontainers.containers.JdbcDatabaseContainer.waitUntilContainerStarted(JdbcDatabaseContainer.java:129)
    at org.testcontainers.containers.GenericContainer.tryStart(GenericContainer.java:292)


    followed by



    2018-11-20 19:12:25.486 2612@DESKTOP-MLK30PF  INFO --- [tc-okhttp-stream-242833949] 🐳 [mysql:8.0.12].accept : STDERR: 2018-11-20T18:10:44.918132Z 0 [System] [MY-010931] [Server] /usr/sbin/mysqld: ready for connections. Version: '8.0.12'  socket: '/var/run/mysqld/mysqld.sock'  port: 3306  MySQL Community Server - GPL. (Slf4jLogConsumer.java:32) 
    2018-11-20 19:12:25.487 2612@DESKTOP-MLK30PF INFO --- [main] 🐳 [mysql:8.0.12].tryStart : Creating container for image: mysql:8.0.12 (GenericContainer.java:253)
    2018-11-20 19:12:25.609 2612@DESKTOP-MLK30PF INFO --- [main] 🐳 [mysql:8.0.12].tryStart : Starting container with ID: de75c9dafed8032b84cb827bf43a29c1964bfe4e168422272c9310a4803fd856 (GenericContainer.java:266)
    2018-11-20 19:12:25.896 2612@DESKTOP-MLK30PF INFO --- [main] 🐳 [mysql:8.0.12].tryStart : Container mysql:8.0.12 is starting: de75c9dafed8032b84cb827bf43a29c1964bfe4e168422272c9310a4803fd856 (GenericContainer.java:273)
    2018-11-20 19:12:25.901 2612@DESKTOP-MLK30PF INFO --- [main] 🐳 [mysql:8.0.12].waitUntilContainerStarted : Waiting for database connection to become available at jdbc:mysql://192.168.99.100:32772/shop using query 'SELECT 1' (JdbcDatabaseContainer.java:128)




    for issues with mysql version 8 look here



    UPDATE (solved):

    As @bsideup pointed out jdbc-based containers is the best solution for this use case. It works perfectly fine as I decsribed above, but I had to change mysql version from 8 to lower.










    share|improve this question



























      2












      2








      2








      I have a spring boot app, with test written using spock and testcontainers (mysql). What I've made is working fine, but it doesn't feel right (f.e. becuase @sql goes for each test iteration so I have to use INSERT IGNORE ... in my sql script. I am also not happy about the trick with static and non-static mysqlcontainer).
      I am a total beginner when it comes to testcontainers (and spock actually) so If some could tell me how to make it better using spock, @sql, datasource and testcontainers I would be grateful.



      @SpringBootTest
      @ContextConfiguration(initializers = Initializer.class)
      @Testcontainers
      class GeneratorTest extends Specification {

      public static MySQLContainer staticMySQLContainer = new MySQLContainer()
      .withDatabaseName("test")
      .withUsername("test")
      .withPassword("test")

      @Shared
      public MySQLContainer mySQLContainer = mySQLContainer;

      static class Initializer implements ApplicationContextInitializer<ConfigurableApplicationContext> {

      @Override
      void initialize(@NotNull ConfigurableApplicationContext configurableApplicationContext) {
      TestPropertyValues values = TestPropertyValues.of(
      "spring.datasource.url=" + staticMySQLContainer.getJdbcUrl(),
      "spring.datasource.password=" + staticMySQLContainer.getPassword(),
      "spring.datasource.username=" + staticMySQLContainer.getUsername()
      )
      values.applyTo(configurableApplicationContext)
      }
      }

      @Autowired
      private CarService carService
      @Autowired
      private BikeRepository bikeRepository

      @Sql("/testdata/insert_into_cars.sql")
      def "validate number of doors"(int carId, int expectedNrOfDoors) {
      given:
      Car car = carService.getById(carId)

      expect:
      car.getNrOfDoors() == expectedNrOfDoors

      where:
      carId || expectedNrOfDoors
      1 || 3
      2 || 3
      3 || 5
      }
      }




      Updated (use of jdbc-based containers):

      When it comes to JDBC-based containers I'm not sure If I set it up correctly. I've created application-test.properties in test/resources directory. I've put there:



      spring.datasource.url=jdbc:tc:mysql:8.0.12://localhost:3306/shop?createDatabaseIfNotExist=true&serverTimezone=UTC
      spring.datasource.username=test
      spring.datasource.password=test
      spring.datasource.driver-class-name=org.testcontainers.jdbc.ContainerDatabaseDriver


      and my test class looks like:



      @SpringBootTest
      @Testcontainers
      @TestPropertySource(locations="classpath:application-test.properties")
      class GeneratorTest extends Specification {

      @Autowired
      private CarService carService

      <skipped for brevity>


      When I try to run the test class I'm keep getting:



          2018-11-20 19:10:25.409 2612@DESKTOP-MLK30PF  INFO --- [main] 🐳 [mysql:8.0.12].waitUntilContainerStarted : Waiting for database connection to become available at jdbc:mysql://192.168.99.100:32770/shop using query 'SELECT 1' (JdbcDatabaseContainer.java:128) 
      2018-11-20 19:12:25.420 2612@DESKTOP-MLK30PF ERROR --- [main] 🐳 [mysql:8.0.12].tryStart : Could not start container (GenericContainer.java:297)
      org.rnorth.ducttape.TimeoutException: org.rnorth.ducttape.TimeoutException: java.util.concurrent.TimeoutException
      at org.rnorth.ducttape.unreliables.Unreliables.retryUntilSuccess(Unreliables.java:53)
      at org.testcontainers.containers.JdbcDatabaseContainer.waitUntilContainerStarted(JdbcDatabaseContainer.java:129)
      at org.testcontainers.containers.GenericContainer.tryStart(GenericContainer.java:292)


      followed by



      2018-11-20 19:12:25.486 2612@DESKTOP-MLK30PF  INFO --- [tc-okhttp-stream-242833949] 🐳 [mysql:8.0.12].accept : STDERR: 2018-11-20T18:10:44.918132Z 0 [System] [MY-010931] [Server] /usr/sbin/mysqld: ready for connections. Version: '8.0.12'  socket: '/var/run/mysqld/mysqld.sock'  port: 3306  MySQL Community Server - GPL. (Slf4jLogConsumer.java:32) 
      2018-11-20 19:12:25.487 2612@DESKTOP-MLK30PF INFO --- [main] 🐳 [mysql:8.0.12].tryStart : Creating container for image: mysql:8.0.12 (GenericContainer.java:253)
      2018-11-20 19:12:25.609 2612@DESKTOP-MLK30PF INFO --- [main] 🐳 [mysql:8.0.12].tryStart : Starting container with ID: de75c9dafed8032b84cb827bf43a29c1964bfe4e168422272c9310a4803fd856 (GenericContainer.java:266)
      2018-11-20 19:12:25.896 2612@DESKTOP-MLK30PF INFO --- [main] 🐳 [mysql:8.0.12].tryStart : Container mysql:8.0.12 is starting: de75c9dafed8032b84cb827bf43a29c1964bfe4e168422272c9310a4803fd856 (GenericContainer.java:273)
      2018-11-20 19:12:25.901 2612@DESKTOP-MLK30PF INFO --- [main] 🐳 [mysql:8.0.12].waitUntilContainerStarted : Waiting for database connection to become available at jdbc:mysql://192.168.99.100:32772/shop using query 'SELECT 1' (JdbcDatabaseContainer.java:128)




      for issues with mysql version 8 look here



      UPDATE (solved):

      As @bsideup pointed out jdbc-based containers is the best solution for this use case. It works perfectly fine as I decsribed above, but I had to change mysql version from 8 to lower.










      share|improve this question
















      I have a spring boot app, with test written using spock and testcontainers (mysql). What I've made is working fine, but it doesn't feel right (f.e. becuase @sql goes for each test iteration so I have to use INSERT IGNORE ... in my sql script. I am also not happy about the trick with static and non-static mysqlcontainer).
      I am a total beginner when it comes to testcontainers (and spock actually) so If some could tell me how to make it better using spock, @sql, datasource and testcontainers I would be grateful.



      @SpringBootTest
      @ContextConfiguration(initializers = Initializer.class)
      @Testcontainers
      class GeneratorTest extends Specification {

      public static MySQLContainer staticMySQLContainer = new MySQLContainer()
      .withDatabaseName("test")
      .withUsername("test")
      .withPassword("test")

      @Shared
      public MySQLContainer mySQLContainer = mySQLContainer;

      static class Initializer implements ApplicationContextInitializer<ConfigurableApplicationContext> {

      @Override
      void initialize(@NotNull ConfigurableApplicationContext configurableApplicationContext) {
      TestPropertyValues values = TestPropertyValues.of(
      "spring.datasource.url=" + staticMySQLContainer.getJdbcUrl(),
      "spring.datasource.password=" + staticMySQLContainer.getPassword(),
      "spring.datasource.username=" + staticMySQLContainer.getUsername()
      )
      values.applyTo(configurableApplicationContext)
      }
      }

      @Autowired
      private CarService carService
      @Autowired
      private BikeRepository bikeRepository

      @Sql("/testdata/insert_into_cars.sql")
      def "validate number of doors"(int carId, int expectedNrOfDoors) {
      given:
      Car car = carService.getById(carId)

      expect:
      car.getNrOfDoors() == expectedNrOfDoors

      where:
      carId || expectedNrOfDoors
      1 || 3
      2 || 3
      3 || 5
      }
      }




      Updated (use of jdbc-based containers):

      When it comes to JDBC-based containers I'm not sure If I set it up correctly. I've created application-test.properties in test/resources directory. I've put there:



      spring.datasource.url=jdbc:tc:mysql:8.0.12://localhost:3306/shop?createDatabaseIfNotExist=true&serverTimezone=UTC
      spring.datasource.username=test
      spring.datasource.password=test
      spring.datasource.driver-class-name=org.testcontainers.jdbc.ContainerDatabaseDriver


      and my test class looks like:



      @SpringBootTest
      @Testcontainers
      @TestPropertySource(locations="classpath:application-test.properties")
      class GeneratorTest extends Specification {

      @Autowired
      private CarService carService

      <skipped for brevity>


      When I try to run the test class I'm keep getting:



          2018-11-20 19:10:25.409 2612@DESKTOP-MLK30PF  INFO --- [main] 🐳 [mysql:8.0.12].waitUntilContainerStarted : Waiting for database connection to become available at jdbc:mysql://192.168.99.100:32770/shop using query 'SELECT 1' (JdbcDatabaseContainer.java:128) 
      2018-11-20 19:12:25.420 2612@DESKTOP-MLK30PF ERROR --- [main] 🐳 [mysql:8.0.12].tryStart : Could not start container (GenericContainer.java:297)
      org.rnorth.ducttape.TimeoutException: org.rnorth.ducttape.TimeoutException: java.util.concurrent.TimeoutException
      at org.rnorth.ducttape.unreliables.Unreliables.retryUntilSuccess(Unreliables.java:53)
      at org.testcontainers.containers.JdbcDatabaseContainer.waitUntilContainerStarted(JdbcDatabaseContainer.java:129)
      at org.testcontainers.containers.GenericContainer.tryStart(GenericContainer.java:292)


      followed by



      2018-11-20 19:12:25.486 2612@DESKTOP-MLK30PF  INFO --- [tc-okhttp-stream-242833949] 🐳 [mysql:8.0.12].accept : STDERR: 2018-11-20T18:10:44.918132Z 0 [System] [MY-010931] [Server] /usr/sbin/mysqld: ready for connections. Version: '8.0.12'  socket: '/var/run/mysqld/mysqld.sock'  port: 3306  MySQL Community Server - GPL. (Slf4jLogConsumer.java:32) 
      2018-11-20 19:12:25.487 2612@DESKTOP-MLK30PF INFO --- [main] 🐳 [mysql:8.0.12].tryStart : Creating container for image: mysql:8.0.12 (GenericContainer.java:253)
      2018-11-20 19:12:25.609 2612@DESKTOP-MLK30PF INFO --- [main] 🐳 [mysql:8.0.12].tryStart : Starting container with ID: de75c9dafed8032b84cb827bf43a29c1964bfe4e168422272c9310a4803fd856 (GenericContainer.java:266)
      2018-11-20 19:12:25.896 2612@DESKTOP-MLK30PF INFO --- [main] 🐳 [mysql:8.0.12].tryStart : Container mysql:8.0.12 is starting: de75c9dafed8032b84cb827bf43a29c1964bfe4e168422272c9310a4803fd856 (GenericContainer.java:273)
      2018-11-20 19:12:25.901 2612@DESKTOP-MLK30PF INFO --- [main] 🐳 [mysql:8.0.12].waitUntilContainerStarted : Waiting for database connection to become available at jdbc:mysql://192.168.99.100:32772/shop using query 'SELECT 1' (JdbcDatabaseContainer.java:128)




      for issues with mysql version 8 look here



      UPDATE (solved):

      As @bsideup pointed out jdbc-based containers is the best solution for this use case. It works perfectly fine as I decsribed above, but I had to change mysql version from 8 to lower.







      spock spring-boot-test testcontainers






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 20 '18 at 21:31







      user3529850

















      asked Nov 19 '18 at 20:38









      user3529850user3529850

      456416




      456416
























          1 Answer
          1






          active

          oldest

          votes


















          1














          Have you tried JDBC-based containers?






          share|improve this answer
























          • good point, still some troubles, probably from wrong configuration, I've updated my post If you wanted to take a look, thanks.

            – user3529850
            Nov 20 '18 at 18:06






          • 1





            It doesn't work with version 8. It's suggested to use --default-authentication-plugin=mysql_native_password. Is it possible to pass in jdbc-based containers ? github.com/testcontainers/testcontainers-java/issues/736

            – user3529850
            Nov 20 '18 at 21:08











          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53382289%2fhow-to-properly-run-spock-test-using-testcontainers-in-spring-boot%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          1














          Have you tried JDBC-based containers?






          share|improve this answer
























          • good point, still some troubles, probably from wrong configuration, I've updated my post If you wanted to take a look, thanks.

            – user3529850
            Nov 20 '18 at 18:06






          • 1





            It doesn't work with version 8. It's suggested to use --default-authentication-plugin=mysql_native_password. Is it possible to pass in jdbc-based containers ? github.com/testcontainers/testcontainers-java/issues/736

            – user3529850
            Nov 20 '18 at 21:08
















          1














          Have you tried JDBC-based containers?






          share|improve this answer
























          • good point, still some troubles, probably from wrong configuration, I've updated my post If you wanted to take a look, thanks.

            – user3529850
            Nov 20 '18 at 18:06






          • 1





            It doesn't work with version 8. It's suggested to use --default-authentication-plugin=mysql_native_password. Is it possible to pass in jdbc-based containers ? github.com/testcontainers/testcontainers-java/issues/736

            – user3529850
            Nov 20 '18 at 21:08














          1












          1








          1







          Have you tried JDBC-based containers?






          share|improve this answer













          Have you tried JDBC-based containers?







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 20 '18 at 11:38









          bsideupbsideup

          46638




          46638













          • good point, still some troubles, probably from wrong configuration, I've updated my post If you wanted to take a look, thanks.

            – user3529850
            Nov 20 '18 at 18:06






          • 1





            It doesn't work with version 8. It's suggested to use --default-authentication-plugin=mysql_native_password. Is it possible to pass in jdbc-based containers ? github.com/testcontainers/testcontainers-java/issues/736

            – user3529850
            Nov 20 '18 at 21:08



















          • good point, still some troubles, probably from wrong configuration, I've updated my post If you wanted to take a look, thanks.

            – user3529850
            Nov 20 '18 at 18:06






          • 1





            It doesn't work with version 8. It's suggested to use --default-authentication-plugin=mysql_native_password. Is it possible to pass in jdbc-based containers ? github.com/testcontainers/testcontainers-java/issues/736

            – user3529850
            Nov 20 '18 at 21:08

















          good point, still some troubles, probably from wrong configuration, I've updated my post If you wanted to take a look, thanks.

          – user3529850
          Nov 20 '18 at 18:06





          good point, still some troubles, probably from wrong configuration, I've updated my post If you wanted to take a look, thanks.

          – user3529850
          Nov 20 '18 at 18:06




          1




          1





          It doesn't work with version 8. It's suggested to use --default-authentication-plugin=mysql_native_password. Is it possible to pass in jdbc-based containers ? github.com/testcontainers/testcontainers-java/issues/736

          – user3529850
          Nov 20 '18 at 21:08





          It doesn't work with version 8. It's suggested to use --default-authentication-plugin=mysql_native_password. Is it possible to pass in jdbc-based containers ? github.com/testcontainers/testcontainers-java/issues/736

          – user3529850
          Nov 20 '18 at 21:08


















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53382289%2fhow-to-properly-run-spock-test-using-testcontainers-in-spring-boot%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          How to change which sound is reproduced for terminal bell?

          Can I use Tabulator js library in my java Spring + Thymeleaf project?

          Title Spacing in Bjornstrup Chapter, Removing Chapter Number From Contents