zonkyio / embedded-database-spring-test Goto Github PK
View Code? Open in Web Editor NEWA library for creating isolated embedded databases for Spring-powered integration tests.
License: Apache License 2.0
A library for creating isolated embedded databases for Spring-powered integration tests.
License: Apache License 2.0
This would be useful for use with docker images built on Alpine Linux.
I'm on a mac (10.13.15), and have postgres 10.4 installed locally via homebrew.
I'm using Spring Boot on the application side, and when embedded-database-spring-test calls resourceResolver.getResources(resourceLocation);
in the DefaultPostgresBinaryResolver
, no resources are returned. The resourceLocation is set to classpath*:postgres-darwin-x86_64.txz
.
My maven dependencies are:
<dependency>
<groupId>io.zonky.test.postgres</groupId>
<artifactId>embedded-postgres-binaries-bom</artifactId>
<version>10.4.0</version>
<type>pom</type>
</dependency>
I have also tried removing the embedded-postgres-binaries-bom dependency.
Full Stack:
java.util.concurrent.CompletionException: java.lang.IllegalStateException: Missing postgres binaries
at io.zonky.test.db.flyway.DefaultFlywayDataSourceContext.lambda$reload$2(DefaultFlywayDataSourceContext.java:144) ~[embedded-database-spring-test-1.3.0.jar:na]
at java.util.concurrent.CompletableFuture.uniApply(CompletableFuture.java:602) ~[na:1.8.0_172]
at java.util.concurrent.CompletableFuture$UniApply.tryFire(CompletableFuture.java:577) ~[na:1.8.0_172]
at java.util.concurrent.CompletableFuture$Completion.run(CompletableFuture.java:442) ~[na:1.8.0_172]
at java.util.concurrent.CompletableFuture$UniCompletion.claim(CompletableFuture.java:529) ~[na:1.8.0_172]
at java.util.concurrent.CompletableFuture.uniApply(CompletableFuture.java:599) ~[na:1.8.0_172]
at java.util.concurrent.CompletableFuture$UniApply.tryFire(CompletableFuture.java:577) ~[na:1.8.0_172]
at java.util.concurrent.CompletableFuture.uniApplyStage(CompletableFuture.java:617) ~[na:1.8.0_172]
at java.util.concurrent.CompletableFuture.thenApplyAsync(CompletableFuture.java:1993) ~[na:1.8.0_172]
at io.zonky.test.db.flyway.DefaultFlywayDataSourceContext.reload(DefaultFlywayDataSourceContext.java:133) ~[embedded-database-spring-test-1.3.0.jar:na]
at io.zonky.test.db.postgres.FlywayEmbeddedPostgresDataSourceFactoryBean.postProcessBeforeInitialization(FlywayEmbeddedPostgresDataSourceFactoryBean.java:81) ~[embedded-database-spring-test-1.3.0.jar:na]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:422) ~[spring-beans-5.0.6.RELEASE.jar:5.0.6.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1698) ~[spring-beans-5.0.6.RELEASE.jar:5.0.6.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:579) ~[spring-beans-5.0.6.RELEASE.jar:5.0.6.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:501) ~[spring-beans-5.0.6.RELEASE.jar:5.0.6.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:317) ~[spring-beans-5.0.6.RELEASE.jar:5.0.6.RELEASE]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:228) ~[spring-beans-5.0.6.RELEASE.jar:5.0.6.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:315) ~[spring-beans-5.0.6.RELEASE.jar:5.0.6.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) ~[spring-beans-5.0.6.RELEASE.jar:5.0.6.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:304) ~[spring-beans-5.0.6.RELEASE.jar:5.0.6.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) ~[spring-beans-5.0.6.RELEASE.jar:5.0.6.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1089) ~[spring-context-5.0.6.RELEASE.jar:5.0.6.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:859) ~[spring-context-5.0.6.RELEASE.jar:5.0.6.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:550) ~[spring-context-5.0.6.RELEASE.jar:5.0.6.RELEASE]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:759) ~[spring-boot-2.0.2.RELEASE.jar:2.0.2.RELEASE]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:395) ~[spring-boot-2.0.2.RELEASE.jar:2.0.2.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:327) ~[spring-boot-2.0.2.RELEASE.jar:2.0.2.RELEASE]
at org.springframework.boot.test.context.SpringBootContextLoader.loadContext(SpringBootContextLoader.java:139) ~[spring-boot-test-2.0.2.RELEASE.jar:2.0.2.RELEASE]
at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContextInternal(DefaultCacheAwareContextLoaderDelegate.java:99) ~[spring-test-5.0.6.RELEASE.jar:5.0.6.RELEASE]
at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.java:117) ~[spring-test-5.0.6.RELEASE.jar:5.0.6.RELEASE]
at org.springframework.test.context.support.DefaultTestContext.getApplicationContext(DefaultTestContext.java:108) ~[spring-test-5.0.6.RELEASE.jar:5.0.6.RELEASE]
at io.zonky.test.db.flyway.OptimizedFlywayTestExecutionListener.optimizedDbReset(OptimizedFlywayTestExecutionListener.java:135) ~[embedded-database-spring-test-1.3.0.jar:na]
at io.zonky.test.db.flyway.OptimizedFlywayTestExecutionListener.beforeTestClass(OptimizedFlywayTestExecutionListener.java:96) ~[embedded-database-spring-test-1.3.0.jar:na]
at org.springframework.test.context.TestContextManager.beforeTestClass(TestContextManager.java:215) ~[spring-test-5.0.6.RELEASE.jar:5.0.6.RELEASE]
at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:60) ~[spring-test-5.0.6.RELEASE.jar:5.0.6.RELEASE]
at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70) ~[spring-test-5.0.6.RELEASE.jar:5.0.6.RELEASE]
at org.junit.runners.ParentRunner.run(ParentRunner.java:363) ~[junit-4.12.jar:4.12]
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:190) ~[spring-test-5.0.6.RELEASE.jar:5.0.6.RELEASE]
at org.junit.runner.JUnitCore.run(JUnitCore.java:137) ~[junit-4.12.jar:4.12]
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68) ~[junit-rt.jar:na]
at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47) ~[junit-rt.jar:na]
at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242) ~[junit-rt.jar:na]
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70) ~[junit-rt.jar:na]
Caused by: java.lang.IllegalStateException: Missing postgres binaries
at io.zonky.test.db.postgres.embedded.DefaultPostgresBinaryResolver.getPgBinary(DefaultPostgresBinaryResolver.java:68) ~[embedded-database-spring-test-1.3.0.jar:na]
at io.zonky.test.db.shaded.com.opentable.db.postgres.embedded.EmbeddedPostgres.prepareBinaries(EmbeddedPostgres.java:701) ~[embedded-database-spring-test-1.3.0.jar:na]
at io.zonky.test.db.shaded.com.opentable.db.postgres.embedded.EmbeddedPostgres.<init>(EmbeddedPostgres.java:119) ~[embedded-database-spring-test-1.3.0.jar:na]
at io.zonky.test.db.shaded.com.opentable.db.postgres.embedded.EmbeddedPostgres$Builder.start(EmbeddedPostgres.java:572) ~[embedded-database-spring-test-1.3.0.jar:na]
at io.zonky.test.db.shaded.com.opentable.db.postgres.embedded.PreparedDbProvider.createOrFindPreparer(PreparedDbProvider.java:82) ~[embedded-database-spring-test-1.3.0.jar:na]
at io.zonky.test.db.shaded.com.opentable.db.postgres.embedded.PreparedDbProvider.<init>(PreparedDbProvider.java:63) ~[embedded-database-spring-test-1.3.0.jar:na]
at io.zonky.test.db.shaded.com.opentable.db.postgres.embedded.PreparedDbProvider.forPreparer(PreparedDbProvider.java:56) ~[embedded-database-spring-test-1.3.0.jar:na]
at io.zonky.test.db.flyway.DefaultFlywayDataSourceContext.lambda$reload$2(DefaultFlywayDataSourceContext.java:137) ~[embedded-database-spring-test-1.3.0.jar:na]
Any advice on how to debug this further would be much appreciated!
When Spring Boot’s @MockBean
annotation is used (and probably some others), the configuration of EmbeddedPostgres.Builder
customizers has no effect. It's because of internal processing of the @MockBean
annotation. There is a call tobeanFactory.getBeanNamesForType(DataSource.class, true, true)
method when AutowiredAnnotationBeanPostProcessor
is not fully prepared. So @Autowire
annotations are not processed correctly and the fields contain null values.
Consider the following Spring configuration:
@Configuration
public class DatasourceConfiguration {
@Bean(name="dataSource")
public DataSource dataSource() {
return DataSourceBuilder.create().build();
}
@Bean
public CustomBean someOtherBeanThatDependsOnDataSource() {
return new CustomBean(dataSource()); // <-- Invoking dataSource() here throws exception
}
}
And the following Spring test:
@RunWith(SpringRunner.class)
@SpringBootTest(classes = SpringEmbeddedPostgres.class)
@AutoConfigureEmbeddedDatabase
@FlywayTest
public class SpringEmbeddedPostgresTest {
@Test
public void should_start() {
Assert.assertTrue(true);
}
}
Which will result in this exception:
java.lang.ClassCastException: io.zonky.test.db.postgres.FlywayEmbeddedPostgresDataSourceFactoryBean$$EnhancerBySpringCGLIB$$d97cbff cannot be cast to javax.sql.DataSource
Runnable example here
When the class EmbeddedPostgres create the jdbc url, the parameter are defined in the static string
private static final String JDBC_FORMAT = "jdbc:postgresql://localhost:%s/%s?user=%s";
How could I add the currentSchema ?
Can I open a PR with the changes?
Configuration snapshot contains some collections that are mutable, so the snapshot is also mutable. This can cause rare problems with database prefetching when the configuration is changed while database tests are running.
Hi,
I'm trying to setup the module in a project, but I'm getting the following exception when starting the test:
org.postgresql.util.PSQLException: FATAL: the database system is starting up
at org.postgresql.core.v3.ConnectionFactoryImpl.doAuthentication(ConnectionFactoryImpl.java:438) ~[postgresql-42.1.4.jar:42.1.4]
at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:222) ~[postgresql-42.1.4.jar:42.1.4]
at org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:49) ~[postgresql-42.1.4.jar:42.1.4]
at org.postgresql.jdbc.PgConnection.(PgConnection.java:194) ~[postgresql-42.1.4.jar:42.1.4]
at org.postgresql.Driver.makeConnection(Driver.java:450) ~[postgresql-42.1.4.jar:42.1.4]
at org.postgresql.Driver.connect(Driver.java:252) ~[postgresql-42.1.4.jar:42.1.4]
at java.sql.DriverManager.getConnection(DriverManager.java:664) ~[?:1.8.0_151]
at java.sql.DriverManager.getConnection(DriverManager.java:247) ~[?:1.8.0_151]
at org.postgresql.ds.common.BaseDataSource.getConnection(BaseDataSource.java:94) ~[postgresql-42.1.4.jar:42.1.4]
at org.postgresql.ds.common.BaseDataSource.getConnection(BaseDataSource.java:79) ~[postgresql-42.1.4.jar:42.1.4]
at io.zonky.test.db.shaded.com.opentable.db.postgres.embedded.EmbeddedPostgres.verifyReady(EmbeddedPostgres.java:341) ~[embedded-database-spring-test-1.3.1.jar:?]
at io.zonky.test.db.shaded.com.opentable.db.postgres.embedded.EmbeddedPostgres.waitForServerStartup(EmbeddedPostgres.java:298) ~[embedded-database-spring-test-1.3.1.jar:?]
at io.zonky.test.db.shaded.com.opentable.db.postgres.embedded.EmbeddedPostgres.startPostmaster(EmbeddedPostgres.java:262) ~[embedded-database-spring-test-1.3.1.jar:?]
at io.zonky.test.db.shaded.com.opentable.db.postgres.embedded.EmbeddedPostgres.(EmbeddedPostgres.java:149) ~[embedded-database-spring-test-1.3.1.jar:?]
at io.zonky.test.db.shaded.com.opentable.db.postgres.embedded.EmbeddedPostgres$Builder.start(EmbeddedPostgres.java:572) ~[embedded-database-spring-test-1.3.1.jar:?]
at io.zonky.test.db.shaded.com.opentable.db.postgres.embedded.PreparedDbProvider.createOrFindPreparer(PreparedDbProvider.java:82) ~[embedded-database-spring-test-1.3.1.jar:?]
at io.zonky.test.db.shaded.com.opentable.db.postgres.embedded.PreparedDbProvider.(PreparedDbProvider.java:63) ~[embedded-database-spring-test-1.3.1.jar:?]
at io.zonky.test.db.shaded.com.opentable.db.postgres.embedded.PreparedDbProvider.forPreparer(PreparedDbProvider.java:56) ~[embedded-database-spring-test-1.3.1.jar:?]
at io.zonky.test.db.flyway.DefaultFlywayDataSourceContext.lambda$reload$2(DefaultFlywayDataSourceContext.java:137) ~[embedded-database-spring-test-1.3.1.jar:?]
at java.util.concurrent.CompletableFuture.uniApply(CompletableFuture.java:602) ~[?:1.8.0_151]
at java.util.concurrent.CompletableFuture$UniApply.tryFire(CompletableFuture.java:577) ~[?:1.8.0_151]
at java.util.concurrent.CompletableFuture$Completion.run(CompletableFuture.java:442) ~[?:1.8.0_151]
at java.util.concurrent.CompletableFuture$UniCompletion.claim(CompletableFuture.java:529) [?:1.8.0_151]
at java.util.concurrent.CompletableFuture.uniApply(CompletableFuture.java:599) [?:1.8.0_151]
at java.util.concurrent.CompletableFuture$UniApply.tryFire(CompletableFuture.java:577) [?:1.8.0_151]
at java.util.concurrent.CompletableFuture.uniApplyStage(CompletableFuture.java:617) [?:1.8.0_151]
at java.util.concurrent.CompletableFuture.thenApplyAsync(CompletableFuture.java:1993) [?:1.8.0_151]
at io.zonky.test.db.flyway.DefaultFlywayDataSourceContext.reload(DefaultFlywayDataSourceContext.java:133) [embedded-database-spring-test-1.3.1.jar:?]
at io.zonky.test.db.postgres.FlywayEmbeddedPostgresDataSourceFactoryBean.postProcessBeforeInitialization(FlywayEmbeddedPostgresDataSourceFactoryBean.java:82) [embedded-database-spring-test-1.3.1.jar:?]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:409) [spring-beans-4.3.12.RELEASE.jar:4.3.12.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1620) [spring-beans-4.3.12.RELEASE.jar:4.3.12.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:555) [spring-beans-4.3.12.RELEASE.jar:4.3.12.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483) [spring-beans-4.3.12.RELEASE.jar:4.3.12.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306) [spring-beans-4.3.12.RELEASE.jar:4.3.12.RELEASE]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) [spring-beans-4.3.12.RELEASE.jar:4.3.12.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302) [spring-beans-4.3.12.RELEASE.jar:4.3.12.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) [spring-beans-4.3.12.RELEASE.jar:4.3.12.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:296) [spring-beans-4.3.12.RELEASE.jar:4.3.12.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) [spring-beans-4.3.12.RELEASE.jar:4.3.12.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1078) [spring-context-4.3.12.RELEASE.jar:4.3.12.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:857) [spring-context-4.3.12.RELEASE.jar:4.3.12.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:543) [spring-context-4.3.12.RELEASE.jar:4.3.12.RELEASE]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:693) [spring-boot-1.5.8.RELEASE.jar:1.5.8.RELEASE]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:360) [spring-boot-1.5.8.RELEASE.jar:1.5.8.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:303) [spring-boot-1.5.8.RELEASE.jar:1.5.8.RELEASE]
at org.springframework.boot.test.context.SpringBootContextLoader.loadContext(SpringBootContextLoader.java:120) [spring-boot-test-1.5.8.RELEASE.jar:1.5.8.RELEASE]
at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContextInternal(DefaultCacheAwareContextLoaderDelegate.java:98) [spring-test-4.3.12.RELEASE.jar:4.3.12.RELEASE]
at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.java:116) [spring-test-4.3.12.RELEASE.jar:4.3.12.RELEASE]
at org.springframework.test.context.support.DefaultTestContext.getApplicationContext(DefaultTestContext.java:83) [spring-test-4.3.12.RELEASE.jar:4.3.12.RELEASE]
at io.zonky.test.db.flyway.OptimizedFlywayTestExecutionListener.optimizedDbReset(OptimizedFlywayTestExecutionListener.java:137) [embedded-database-spring-test-1.3.1.jar:?]
at io.zonky.test.db.flyway.OptimizedFlywayTestExecutionListener.beforeTestClass(OptimizedFlywayTestExecutionListener.java:98) [embedded-database-spring-test-1.3.1.jar:?]
at org.springframework.test.context.TestContextManager.beforeTestClass(TestContextManager.java:195) [spring-test-4.3.12.RELEASE.jar:4.3.12.RELEASE]
at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:60) [spring-test-4.3.12.RELEASE.jar:4.3.12.RELEASE]
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27) [junit-4.12.jar:4.12]
at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70) [spring-test-4.3.12.RELEASE.jar:4.3.12.RELEASE]
at org.junit.runners.ParentRunner.run(ParentRunner.java:363) [junit-4.12.jar:4.12]
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:191) [spring-test-4.3.12.RELEASE.jar:4.3.12.RELEASE]
at org.junit.runners.Suite.runChild(Suite.java:128) [junit-4.12.jar:4.12]
at org.junit.runners.Suite.runChild(Suite.java:27) [junit-4.12.jar:4.12]
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) [junit-4.12.jar:4.12]
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) [junit-4.12.jar:4.12]
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) [junit-4.12.jar:4.12]
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) [junit-4.12.jar:4.12]
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) [junit-4.12.jar:4.12]
at org.junit.runners.ParentRunner.run(ParentRunner.java:363) [junit-4.12.jar:4.12]
at org.junit.runner.JUnitCore.run(JUnitCore.java:137) [junit-4.12.jar:4.12]
at org.junit.runner.JUnitCore.run(JUnitCore.java:115) [junit-4.12.jar:4.12]
at org.apache.maven.surefire.junitcore.JUnitCoreWrapper.createRequestAndRun(JUnitCoreWrapper.java:108) [surefire-junit47-2.18.1.jar:2.18.1]
at org.apache.maven.surefire.junitcore.JUnitCoreWrapper.executeEager(JUnitCoreWrapper.java:78) [surefire-junit47-2.18.1.jar:2.18.1]
at org.apache.maven.surefire.junitcore.JUnitCoreWrapper.execute(JUnitCoreWrapper.java:54) [surefire-junit47-2.18.1.jar:2.18.1]
at org.apache.maven.surefire.junitcore.JUnitCoreProvider.invoke(JUnitCoreProvider.java:144) [surefire-junit47-2.18.1.jar:2.18.1]
at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:203) [surefire-booter-2.18.1.jar:2.18.1]
at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:155) [surefire-booter-2.18.1.jar:2.18.1]
at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:103) [surefire-booter-2.18.1.jar:2.18.1]
My test class looks like this:
@TestPropertySource(locations="classpath:application-test.properties")
@RunWith(SpringRunner.class)
@SpringBootTest
@AutoConfigureEmbeddedDatabase
@FlywayTest
@Category(IntegrationTest.class)
public class DerivedDataControllerIT extends ElasticSearchIT {
@Test
public void test() throws IOException {
assertThat(1, equalTo(1));
}
}
and sections of the pom file
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<includes>
<include>**/*.class</include>
</includes>
<excludedGroups>com.siemens.icv.bdo.eswriter.IntegrationTest</excludedGroups>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<configuration>
<groups>com.siemens.icv.bdo.eswriter.IntegrationTest</groups>
</configuration>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
</goals>
<configuration>
<includes>
<include>**/*.class</include>
</includes>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>com.github.alexcojocaru</groupId>
<artifactId>elasticsearch-maven-plugin</artifactId>
<version>5.3</version>
<configuration>
<clusterName>testCluster</clusterName>
<transportPort>9500</transportPort>
<httpPort>9400</httpPort>
<version>${elasticsearch.version}</version>
<!--<pathInitScript> src/test/resources/elasticsearch/Init.script</pathInitScript>-->
</configuration>
<executions>
<execution>
<id>start-elasticsearch</id>
<phase>pre-integration-test</phase>
<goals>
<goal>runforked</goal>
</goals>
</execution>
<execution>
<id>stop-elasticsearch</id>
<phase>post-integration-test</phase>
<goals>
<goal>stop</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- Testing -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.zonky.test</groupId>
<artifactId>embedded-database-spring-test</artifactId>
<version>1.3.1</version>
<scope>test</scope>
</dependency>
Any idea on what might cause this?
Thanks a lot.
Hi team,
I'm facing the issue with Transactional/Rollback annotations, the rollback process in PlatformTransactionManager doesn't affect the db. What should I change/declare in the configuration to get the Transactional annotations to work correctly?
Could you have a look at my test configuration (iozonky db and commented h2 one to compare the behavior):
@TestConfiguration
@PropertySource("application.properties")
public class TestConfig {
@Bean(destroyMethod = "close")
protected EmbeddedPostgres embeddedPostgres() throws IOException {
return EmbeddedPostgres.builder().setCleanDataDirectory(true).start();
}
@Bean
protected JdbcTemplate jdbcTemplate() throws IOException {
return new JdbcTemplate(embeddedPostgres().getPostgresDatabase());
// return new JdbcTemplate(dataSource());
}
@Bean(name = "txManager")
protected PlatformTransactionManager platformTransactionManager() throws IOException {
return new DataSourceTransactionManager(embeddedPostgres().getPostgresDatabase());
// return new DataSourceTransactionManager(dataSource());
}
@Bean
public DataSource dataSource() {
DriverManagerDataSource dataSource = new DriverManagerDataSource();
dataSource.setDriverClassName("org.h2.Driver");
dataSource.setUrl("jdbc:h2:mem:db;DB_CLOSE_DELAY=-1");
dataSource.setUsername("sa");
dataSource.setPassword("sa");
return dataSource;
}
}
And here is the simple test to check the rollback behavior:
@RunWith(SpringRunner.class)
@Transactional(transactionManager = "txManager")
@ContextConfiguration(classes = { TestConfig.class })
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class JdbcTest {
@Autowired
private JdbcTemplate jdbc;
@Test
@Rollback(value = false)
public void test1() {
jdbc.execute("create table test_table (test_field integer)");
jdbc.execute("insert into test_table values(1)");
List<Integer> results = jdbc.queryForList("select test_field from test_table", Integer.class);
Assert.assertTrue(CollectionUtils.isNotEmpty(results));
Assert.assertEquals(1, results.size());
}
@Test
@Rollback
public void test2() {
jdbc.execute("insert into test_table values(2)");
List<Integer> results = jdbc.queryForList("select test_field from test_table", Integer.class);
Assert.assertTrue(CollectionUtils.isNotEmpty(results));
Assert.assertEquals(2, results.size());
}
@Test
public void zTest() {
List<Integer> results = jdbc.queryForList("select test_field from test_table", Integer.class);
Assert.assertTrue(CollectionUtils.isNotEmpty(results));
Assert.assertEquals(1, results.size());
}
}
If the H2 is working tests will be passed. However if Zonky is on test will fail.
Mvn Dependencies:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jdbc</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>io.zonky.test</groupId>
<artifactId>embedded-postgres</artifactId>
<version>1.2.2</version>
<scope>test</scope>
</dependency>
Thanks in advance, sorry for bothering.
Best Regards,
Output:
2018-12-07 13:39:20.649 WARN 46190 --- [ main] org.flywaydb.core.Flyway : Direct configuration retrieval from the Flyway object has been deprecated and will be removed in Flyway 6.0. Use Flyway.getConfiguration() instead.
2018-12-07 13:39:20.650 WARN 46190 --- [ main] org.flywaydb.core.Flyway : Direct configuration retrieval from the Flyway object has been deprecated and will be removed in Flyway 6.0. Use Flyway.getConfiguration() instead.
2018-12-07 13:39:20.650 WARN 46190 --- [ main] org.flywaydb.core.Flyway : Direct configuration retrieval from the Flyway object has been deprecated and will be removed in Flyway 6.0. Use Flyway.getConfiguration() instead.
2018-12-07 13:39:20.651 WARN 46190 --- [ main] org.flywaydb.core.Flyway : Direct configuration retrieval from the Flyway object has been deprecated and will be removed in Flyway 6.0. Use Flyway.getConfiguration() instead.
2018-12-07 13:39:20.651 WARN 46190 --- [ main] org.flywaydb.core.Flyway : Direct configuration retrieval from the Flyway object has been deprecated and will be removed in Flyway 6.0. Use Flyway.getConfiguration() instead.
2018-12-07 13:39:20.651 WARN 46190 --- [ main] org.flywaydb.core.Flyway : Direct configuration retrieval from the Flyway object has been deprecated and will be removed in Flyway 6.0. Use Flyway.getConfiguration() instead.
2018-12-07 13:39:20.651 WARN 46190 --- [ main] org.flywaydb.core.Flyway : Direct configuration retrieval from the Flyway object has been deprecated and will be removed in Flyway 6.0. Use Flyway.getConfiguration() instead.
2018-12-07 13:39:20.651 WARN 46190 --- [ main] org.flywaydb.core.Flyway : Direct configuration retrieval from the Flyway object has been deprecated and will be removed in Flyway 6.0. Use Flyway.getConfiguration() instead.
2018-12-07 13:39:20.651 WARN 46190 --- [ main] org.flywaydb.core.Flyway : Direct configuration retrieval from the Flyway object has been deprecated and will be removed in Flyway 6.0. Use Flyway.getConfiguration() instead.
2018-12-07 13:39:20.651 WARN 46190 --- [ main] org.flywaydb.core.Flyway : Direct configuration retrieval from the Flyway object has been deprecated and will be removed in Flyway 6.0. Use Flyway.getConfiguration() instead.
2018-12-07 13:39:20.651 WARN 46190 --- [ main] org.flywaydb.core.Flyway : Direct configuration retrieval from the Flyway object has been deprecated and will be removed in Flyway 6.0. Use Flyway.getConfiguration() instead.
2018-12-07 13:39:20.651 WARN 46190 --- [ main] org.flywaydb.core.Flyway : Direct configuration retrieval from the Flyway object has been deprecated and will be removed in Flyway 6.0. Use Flyway.getConfiguration() instead.
2018-12-07 13:39:20.651 WARN 46190 --- [ main] org.flywaydb.core.Flyway : Direct configuration retrieval from the Flyway object has been deprecated and will be removed in Flyway 6.0. Use Flyway.getConfiguration() instead.
2018-12-07 13:39:20.652 WARN 46190 --- [ main] org.flywaydb.core.Flyway : Direct configuration retrieval from the Flyway object has been deprecated and will be removed in Flyway 6.0. Use Flyway.getConfiguration() instead.
2018-12-07 13:39:20.652 WARN 46190 --- [ main] org.flywaydb.core.Flyway : Direct configuration retrieval from the Flyway object has been deprecated and will be removed in Flyway 6.0. Use Flyway.getConfiguration() instead.
2018-12-07 13:39:20.652 WARN 46190 --- [ main] org.flywaydb.core.Flyway : Direct configuration retrieval from the Flyway object has been deprecated and will be removed in Flyway 6.0. Use Flyway.getConfiguration() instead.
2018-12-07 13:39:20.652 WARN 46190 --- [ main] org.flywaydb.core.Flyway : Direct configuration retrieval from the Flyway object has been deprecated and will be removed in Flyway 6.0. Use Flyway.getConfiguration() instead.
2018-12-07 13:39:20.652 WARN 46190 --- [ main] org.flywaydb.core.Flyway : Direct configuration retrieval from the Flyway object has been deprecated and will be removed in Flyway 6.0. Use Flyway.getConfiguration() instead.
2018-12-07 13:39:20.652 WARN 46190 --- [ main] org.flywaydb.core.Flyway : Direct configuration retrieval from the Flyway object has been deprecated and will be removed in Flyway 6.0. Use Flyway.getConfiguration() instead.
2018-12-07 13:39:20.652 WARN 46190 --- [ main] org.flywaydb.core.Flyway : Direct configuration retrieval from the Flyway object has been deprecated and will be removed in Flyway 6.0. Use Flyway.getConfiguration() instead.
2018-12-07 13:39:20.652 WARN 46190 --- [ main] org.flywaydb.core.Flyway : Direct configuration retrieval from the Flyway object has been deprecated and will be removed in Flyway 6.0. Use Flyway.getConfiguration() instead.
2018-12-07 13:39:20.652 WARN 46190 --- [ main] org.flywaydb.core.Flyway : Direct configuration retrieval from the Flyway object has been deprecated and will be removed in Flyway 6.0. Use Flyway.getConfiguration() instead.
2018-12-07 13:39:20.652 WARN 46190 --- [ main] org.flywaydb.core.Flyway : Direct configuration retrieval from the Flyway object has been deprecated and will be removed in Flyway 6.0. Use Flyway.getConfiguration() instead.
2018-12-07 13:39:20.652 WARN 46190 --- [ main] org.flywaydb.core.Flyway : Direct configuration retrieval from the Flyway object has been deprecated and will be removed in Flyway 6.0. Use Flyway.getConfiguration() instead.
2018-12-07 13:39:20.653 WARN 46190 --- [ main] org.flywaydb.core.Flyway : Direct configuration retrieval from the Flyway object has been deprecated and will be removed in Flyway 6.0. Use Flyway.getConfiguration() instead.
2018-12-07 13:39:20.653 WARN 46190 --- [ main] org.flywaydb.core.Flyway : Direct configuration retrieval from the Flyway object has been deprecated and will be removed in Flyway 6.0. Use Flyway.getConfiguration() instead.
2018-12-07 13:39:20.653 WARN 46190 --- [ main] org.flywaydb.core.Flyway : Direct configuration retrieval from the Flyway object has been deprecated and will be removed in Flyway 6.0. Use Flyway.getConfiguration() instead.
2018-12-07 13:39:20.653 WARN 46190 --- [ main] org.flywaydb.core.Flyway : Direct configuration retrieval from the Flyway object has been deprecated and will be removed in Flyway 6.0. Use Flyway.getConfiguration() instead.
2018-12-07 13:39:20.653 WARN 46190 --- [ main] org.flywaydb.core.Flyway : Direct configuration retrieval from the Flyway object has been deprecated and will be removed in Flyway 6.0. Use Flyway.getConfiguration() instead.
2018-12-07 13:39:20.653 WARN 46190 --- [ main] org.flywaydb.core.Flyway : Direct configuration retrieval from the Flyway object has been deprecated and will be removed in Flyway 6.0. Use Flyway.getConfiguration() instead.
2018-12-07 13:39:20.653 WARN 46190 --- [ main] org.flywaydb.core.Flyway : Direct configuration retrieval from the Flyway object has been deprecated and will be removed in Flyway 6.0. Use Flyway.getConfiguration() instead.
2018-12-07 13:39:20.653 WARN 46190 --- [ main] org.flywaydb.core.Flyway : Direct configuration retrieval from the Flyway object has been deprecated and will be removed in Flyway 6.0. Use Flyway.getConfiguration() instead.
2018-12-07 13:39:20.653 WARN 46190 --- [ main] org.flywaydb.core.Flyway : Direct configuration retrieval from the Flyway object has been deprecated and will be removed in Flyway 6.0. Use Flyway.getConfiguration() instead.
2018-12-07 13:39:20.653 WARN 46190 --- [ main] org.flywaydb.core.Flyway : Direct configuration retrieval from the Flyway object has been deprecated and will be removed in Flyway 6.0. Use Flyway.getConfiguration() instead.
2018-12-07 13:39:20.653 WARN 46190 --- [ main] org.flywaydb.core.Flyway : Direct configuration retrieval from the Flyway object has been deprecated and will be removed in Flyway 6.0. Use Flyway.getConfiguration() instead.
2018-12-07 13:39:20.653 WARN 46190 --- [ main] org.flywaydb.core.Flyway : Direct configuration retrieval from the Flyway object has been deprecated and will be removed in Flyway 6.0. Use Flyway.getConfiguration() instead.
Caused by: org.springframework.beans.factory.support.BeanDefinitionOverrideException: Invalid bean definition with name 'dataSource' defined in null: Cannot register bean definition [Root bean: class [io.zonky.test.db.postgres.FlywayEmbeddedPostgresDataSourceFactoryBean]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null] for bean 'dataSource': There is already [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=org.springframework.boot.autoconfigure.jdbc.DataSourceConfiguration$Hikari; factoryMethodName=dataSource; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [org/springframework/boot/autoconfigure/jdbc/DataSourceConfiguration$Hikari.class]] bound.
at org.springframework.beans.factory.support.DefaultListableBeanFactory.registerBeanDefinition(DefaultListableBeanFactory.java:877)
at io.zonky.test.db.postgres.EmbeddedPostgresContextCustomizerFactory$PreloadableEmbeddedPostgresRegistrar.postProcessBeanDefinitionRegistry(EmbeddedPostgresContextCustomizerFactory.java:162)
at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanDefinitionRegistryPostProcessors(PostProcessorRegistrationDelegate.java:275)
at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:125)
at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:693)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:530)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:785)
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:418)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:337)
at org.springframework.boot.test.context.SpringBootContextLoader.loadContext(SpringBootContextLoader.java:139)
at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContextInternal(DefaultCacheAwareContextLoaderDelegate.java:99)
at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.java:117)
Java version - 11
Spring Boot - v2.1.0.M2
Spring - v5.1.0.RC2
This feature should allow to use a postgres database with any extensions.
I'm interested in testing database failures and would like an easy way to close or kill the embedded database during a spring integration test. If this already exists could you add it to the README.md?
I can see in the documentation for maven, how to pick a different PostrgeSQL binary, however there I am missing a description how to do it in gradle.
Lets say I want to use version 9.6. I tried following gradle dependencies:
testCompile "io.zonky.test:embedded-database-spring-test:1.3.4"
compile "io.zonky.test.postgres:embedded-postgres-binaries-bom:9.6.10"
However, I still see version 10.6 in tests. Can you tell me what am I doing wrong? (I assume, that after adding the binary dependency, there is no further configuration required)
Using Flyway 5.1.4 produces the following error:
org.flywaydb.core.Flyway.getLocations()[Ljava/lang/String;
java.lang.NoSuchMethodError: org.flywaydb.core.Flyway.getLocations()[Ljava/lang/String;
at io.zonky.test.db.flyway.OptimizedFlywayTestExecutionListener.getFlywayLocations(OptimizedFlywayTestExecutionListener.java:262)
at io.zonky.test.db.flyway.OptimizedFlywayTestExecutionListener.createMigrationResolver(OptimizedFlywayTestExecutionListener.java:229)
at io.zonky.test.db.flyway.OptimizedFlywayTestExecutionListener.findFirstVersion(OptimizedFlywayTestExecutionListener.java:207)
at io.zonky.test.db.flyway.OptimizedFlywayTestExecutionListener.isAppendable(OptimizedFlywayTestExecutionListener.java:197)
at io.zonky.test.db.flyway.OptimizedFlywayTestExecutionListener.prepareDataSourceContext(OptimizedFlywayTestExecutionListener.java:168)
at io.zonky.test.db.flyway.OptimizedFlywayTestExecutionListener.optimizedDbReset(OptimizedFlywayTestExecutionListener.java:144)
at io.zonky.test.db.flyway.OptimizedFlywayTestExecutionListener.beforeTestClass(OptimizedFlywayTestExecutionListener.java:96)
at org.springframework.test.context.TestContextManager.beforeTestClass(TestContextManager.java:215)
at org.springframework.test.context.junit.jupiter.SpringExtension.beforeAll(SpringExtension.java:76)
at org.junit.jupiter.engine.descriptor.ClassTestDescriptor.lambda$invokeBeforeAllCallbacks$7(ClassTestDescriptor.java:358)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:72)
at org.junit.jupiter.engine.descriptor.ClassTestDescriptor.invokeBeforeAllCallbacks(ClassTestDescriptor.java:358)
at org.junit.jupiter.engine.descriptor.ClassTestDescriptor.before(ClassTestDescriptor.java:197)
at org.junit.jupiter.engine.descriptor.ClassTestDescriptor.before(ClassTestDescriptor.java:74)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$5(NodeTestTask.java:128)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:72)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:127)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:107)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1540)
at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:38)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$5(NodeTestTask.java:136)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:72)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:127)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:107)
at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.submit(SameThreadHierarchicalTestExecutorService.java:32)
at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor.execute(HierarchicalTestExecutor.java:52)
at org.junit.platform.engine.support.hierarchical.HierarchicalTestEngine.execute(HierarchicalTestEngine.java:51)
at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:170)
at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:154)
at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:90)
at org.gradle.api.internal.tasks.testing.junitplatform.JUnitPlatformTestClassProcessor$CollectAllTestClassesExecutor.processAllTestClasses(JUnitPlatformTestClassProcessor.java:92)
at org.gradle.api.internal.tasks.testing.junitplatform.JUnitPlatformTestClassProcessor$CollectAllTestClassesExecutor.access$100(JUnitPlatformTestClassProcessor.java:77)
at org.gradle.api.internal.tasks.testing.junitplatform.JUnitPlatformTestClassProcessor.stop(JUnitPlatformTestClassProcessor.java:73)
at org.gradle.api.internal.tasks.testing.SuiteTestClassProcessor.stop(SuiteTestClassProcessor.java:61)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:35)
at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
at org.gradle.internal.dispatch.ContextClassLoaderDispatch.dispatch(ContextClassLoaderDispatch.java:32)
at org.gradle.internal.dispatch.ProxyDispatchAdapter$DispatchingInvocationHandler.invoke(ProxyDispatchAdapter.java:93)
at com.sun.proxy.$Proxy2.stop(Unknown Source)
at org.gradle.api.internal.tasks.testing.worker.TestWorker.stop(TestWorker.java:131)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:35)
at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
at org.gradle.internal.remote.internal.hub.MessageHubBackedObjectConnection$DispatchWrapper.dispatch(MessageHubBackedObjectConnection.java:155)
at org.gradle.internal.remote.internal.hub.MessageHubBackedObjectConnection$DispatchWrapper.dispatch(MessageHubBackedObjectConnection.java:137)
at org.gradle.internal.remote.internal.hub.MessageHub$Handler.run(MessageHub.java:404)
at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63)
at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:46)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55)
at java.base/java.lang.Thread.run(Thread.java:834)
Hi. I just starting using this tool - thank you for making it public. All my tests work perfectly individually, but when I run my build (Maven), about 25% of my tests fail with this error:
java.lang.IllegalStateException: Failed to load ApplicationContext
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'flywayInitializer' defined in class path resource [org/springframework/boot/autoconfigure/flyway/FlywayAutoConfiguration$FlywayConfiguration.class]: Invocation of init method failed; nested exception is java.lang.reflect.UndeclaredThrowableException
Caused by: java.lang.reflect.UndeclaredThrowableException
Caused by: java.util.concurrent.ExecutionException: java.lang.RuntimeException: java.io.IOException: Gave up waiting for server to start after 10000ms
Caused by: java.lang.RuntimeException: java.io.IOException: Gave up waiting for server to start after 10000ms
Caused by: java.io.IOException: Gave up waiting for server to start after 10000ms
Caused by: org.postgresql.util.PSQLException: The connection attempt failed.
Caused by: java.net.SocketTimeoutException: connect timed out
Do you have any suggestions? Thanks.
java.lang.NullPointerException: null
at io.zonky.test.db.flyway.OptimizedFlywayTestExecutionListener.isAppendable(OptimizedFlywayTestExecutionListener.java:219)
at io.zonky.test.db.flyway.OptimizedFlywayTestExecutionListener.reloadDataSource(OptimizedFlywayTestExecutionListener.java:184)
at io.zonky.test.db.flyway.OptimizedFlywayTestExecutionListener.optimizedDbReset(OptimizedFlywayTestExecutionListener.java:150)
at io.zonky.test.db.flyway.OptimizedFlywayTestExecutionListener.beforeTestClass(OptimizedFlywayTestExecutionListener.java:103)
at org.springframework.test.context.TestContextManager.beforeTestClass(TestContextManager.java:195)
Do you plan to support Liquibase? Unfortunately flyway does not support Postgres 11
org/flywaydb/core/internal/util/scanner/Scanner
java.lang.NoClassDefFoundError: org/flywaydb/core/internal/util/scanner/Scanner
at io.zonky.test.db.flyway.OptimizedFlywayTestExecutionListener.createMigrationResolver(OptimizedFlywayTestExecutionListener.java:240)
at io.zonky.test.db.flyway.OptimizedFlywayTestExecutionListener.findFirstVersion(OptimizedFlywayTestExecutionListener.java:210)
at io.zonky.test.db.flyway.OptimizedFlywayTestExecutionListener.isAppendable(OptimizedFlywayTestExecutionListener.java:200)
Spring version - 5.1.1.RELEASE
Spring Boot version - 2.1.0.RC1
Flyway version - 5.2.0
Flyway test extension - 5.1.0
Embedded database spring test version - 1.3.2
I'm currently developing an API that use two datasource, each pointing to a different schema of the database, using Spring Boot 2.0.3, Hibernate 5.2.17 and Flyway 5.2.0
@Primary
@Bean(name = "ds1")
@ConfigurationProperties(prefix = "spring.datasource")
public DataSource dataSource() {
return DataSourceBuilder.create().build();
}
spring.datasource.jdbc-url=jdbc:postgresql://localhost:5432/db?currentSchema=sch1
spring.datasource.username=xxx
spring.datasource.password=xxx
spring.datasource.driver-class-name=org.postgresql.Driver
@Bean(name = "ds2")
@ConfigurationProperties(prefix = "ds2.datasource")
public DataSource dataSource() {
return DataSourceBuilder.create().build();
}
ds2.datasource.jdbc-url=jdbc:postgresql://localhost:5432/db?currentSchema=sch2
ds2.datasource.username=${spring.datasource.username}
ds2.datasource.password=${spring.datasource.password}
ds2.datasource.driver-class-name=${spring.datasource.driver-class-name}
In the tests, we are using two h2 datasource but we are confronted to more and more problems with the flyway migrations designed for postgres and not working in h2 (the last case was renaming a column).
I would like to switch to an embedded postgres for testing, but i can't find a way to make it work using two datasource, as AutoConfigureEmbeddedDatabase accept only one bean name and can't be set twice on a class.
How can I do that ?
Hello
I am running some unit tests using the embedded postgres. However whenever I run mvn test
I keep on getting this error.
MacBook-Pro-2:bulk-whatsapp arsenegandote$ mvn test
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------< com.messaging:rookie >------------------------
[INFO] Building demo 0.0.1
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-resources-plugin:3.1.0:resources (default-resources) @ rookie ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO] Copying 1 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.8.0:compile (default-compile) @ rookie ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:3.1.0:testResources (default-testResources) @ rookie ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.8.0:testCompile (default-testCompile) @ rookie ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-surefire-plugin:2.22.2:test (default-test) @ rookie ---
[INFO]
[INFO] -------------------------------------------------------
[INFO] T E S T S
[INFO] -------------------------------------------------------
[INFO] Running com.messaging.rookie.RookieApplicationTests
02:43:20.248 [main] DEBUG org.springframework.test.context.junit4.SpringJUnit4ClassRunner - SpringJUnit4ClassRunner constructor called with [class com.messaging.rookie.RookieApplicationTests]
02:43:20.259 [main] DEBUG org.springframework.test.context.BootstrapUtils - Instantiating CacheAwareContextLoaderDelegate from class [org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate]
02:43:20.270 [main] DEBUG org.springframework.test.context.BootstrapUtils - Instantiating BootstrapContext using constructor [public org.springframework.test.context.support.DefaultBootstrapContext(java.lang.Class,org.springframework.test.context.CacheAwareContextLoaderDelegate)]
02:43:20.301 [main] DEBUG org.springframework.test.context.BootstrapUtils - Instantiating TestContextBootstrapper for test class [com.messaging.rookie.RookieApplicationTests] from class [org.springframework.boot.test.context.SpringBootTestContextBootstrapper]
02:43:20.318 [main] INFO org.springframework.boot.test.context.SpringBootTestContextBootstrapper - Neither @ContextConfiguration nor @ContextHierarchy found for test class [com.messaging.rookie.RookieApplicationTests], using SpringBootContextLoader
02:43:20.324 [main] DEBUG org.springframework.test.context.support.AbstractContextLoader - Did not detect default resource location for test class [com.messaging.rookie.RookieApplicationTests]: class path resource [com/messaging/rookie/RookieApplicationTests-context.xml] does not exist
02:43:20.326 [main] DEBUG org.springframework.test.context.support.AbstractContextLoader - Did not detect default resource location for test class [com.messaging.rookie.RookieApplicationTests]: class path resource [com/messaging/rookie/RookieApplicationTestsContext.groovy] does not exist
02:43:20.327 [main] INFO org.springframework.test.context.support.AbstractContextLoader - Could not detect default resource locations for test class [com.messaging.rookie.RookieApplicationTests]: no resource found for suffixes {-context.xml, Context.groovy}.
02:43:20.330 [main] INFO org.springframework.test.context.support.AnnotationConfigContextLoaderUtils - Could not detect default configuration classes for test class [com.messaging.rookie.RookieApplicationTests]: RookieApplicationTests does not declare any static, non-private, non-final, nested classes annotated with @Configuration.
02:43:20.392 [main] DEBUG org.springframework.test.util.ReflectionTestUtils - Getting field 'configuration' from target object [org.flywaydb.core.Flyway@5a4041cc] or target class [class org.flywaydb.core.Flyway]
02:43:20.394 [main] DEBUG org.springframework.test.util.ReflectionTestUtils - Invoking method 'getUndoSqlMigrationPrefix' on target object [org.flywaydb.core.api.configuration.ClassicConfiguration@1068e947] with arguments {}
02:43:20.430 [main] DEBUG org.springframework.test.context.support.ActiveProfilesUtils - Could not find an 'annotation declaring class' for annotation type [org.springframework.test.context.ActiveProfiles] and class [com.messaging.rookie.RookieApplicationTests]
02:43:20.523 [main] DEBUG org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider - Identified candidate component class: file [/Users/arsenegandote/Applications/java/workspace/bulk-whatsapp/target/classes/com/messaging/rookie/RookieApplication.class]
02:43:20.524 [main] INFO org.springframework.boot.test.context.SpringBootTestContextBootstrapper - Found @SpringBootConfiguration com.messaging.rookie.RookieApplication for test class com.messaging.rookie.RookieApplicationTests
02:43:20.617 [main] DEBUG org.springframework.boot.test.context.SpringBootTestContextBootstrapper - @TestExecutionListeners is not present for class [com.messaging.rookie.RookieApplicationTests]: using defaults.
02:43:20.618 [main] INFO org.springframework.boot.test.context.SpringBootTestContextBootstrapper - Loaded default TestExecutionListener class names from location [META-INF/spring.factories]: [org.springframework.boot.test.mock.mockito.MockitoTestExecutionListener, org.springframework.boot.test.mock.mockito.ResetMocksTestExecutionListener, org.springframework.boot.test.autoconfigure.restdocs.RestDocsTestExecutionListener, org.springframework.boot.test.autoconfigure.web.client.MockRestServiceServerResetTestExecutionListener, org.springframework.boot.test.autoconfigure.web.servlet.MockMvcPrintOnlyOnFailureTestExecutionListener, org.springframework.boot.test.autoconfigure.web.servlet.WebDriverTestExecutionListener, org.springframework.test.context.web.ServletTestExecutionListener, org.springframework.test.context.support.DirtiesContextBeforeModesTestExecutionListener, org.springframework.test.context.support.DependencyInjectionTestExecutionListener, org.springframework.test.context.support.DirtiesContextTestExecutionListener, org.springframework.test.context.transaction.TransactionalTestExecutionListener, org.springframework.test.context.jdbc.SqlScriptsTestExecutionListener, org.springframework.security.test.context.support.WithSecurityContextTestExecutionListener, org.springframework.security.test.context.support.ReactorContextTestExecutionListener, io.zonky.test.db.flyway.OptimizedFlywayTestExecutionListener]
02:43:20.640 [main] INFO org.springframework.boot.test.context.SpringBootTestContextBootstrapper - Using TestExecutionListeners: [org.springframework.test.context.web.ServletTestExecutionListener@385e9564, org.springframework.test.context.support.DirtiesContextBeforeModesTestExecutionListener@5b94b04d, org.springframework.boot.test.mock.mockito.MockitoTestExecutionListener@8c3b9d, org.springframework.boot.test.autoconfigure.SpringBootDependencyInjectionTestExecutionListener@4c39bec8, org.springframework.test.context.support.DirtiesContextTestExecutionListener@f79e, io.zonky.test.db.flyway.OptimizedFlywayTestExecutionListener@7ee8290b, org.springframework.test.context.transaction.TransactionalTestExecutionListener@1f59a598, org.springframework.test.context.jdbc.SqlScriptsTestExecutionListener@1e178745, org.springframework.security.test.context.support.WithSecurityContextTestExecutionListener@192c3f1e, org.springframework.security.test.context.support.ReactorContextTestExecutionListener@26b3fd41, org.springframework.boot.test.mock.mockito.ResetMocksTestExecutionListener@7494f96a, org.springframework.boot.test.autoconfigure.restdocs.RestDocsTestExecutionListener@561b6512, org.springframework.boot.test.autoconfigure.web.client.MockRestServiceServerResetTestExecutionListener@2e377400, org.springframework.boot.test.autoconfigure.web.servlet.MockMvcPrintOnlyOnFailureTestExecutionListener@1757cd72, org.springframework.boot.test.autoconfigure.web.servlet.WebDriverTestExecutionListener@445b295b]
02:43:20.645 [main] DEBUG org.springframework.test.annotation.ProfileValueUtils - Retrieved @ProfileValueSourceConfiguration [null] for test class [com.messaging.rookie.RookieApplicationTests]
02:43:20.646 [main] DEBUG org.springframework.test.annotation.ProfileValueUtils - Retrieved ProfileValueSource type [class org.springframework.test.annotation.SystemProfileValueSource] for class [com.messaging.rookie.RookieApplicationTests]
02:43:20.648 [main] DEBUG org.springframework.test.annotation.ProfileValueUtils - Retrieved @ProfileValueSourceConfiguration [null] for test class [com.messaging.rookie.RookieApplicationTests]
02:43:20.648 [main] DEBUG org.springframework.test.annotation.ProfileValueUtils - Retrieved ProfileValueSource type [class org.springframework.test.annotation.SystemProfileValueSource] for class [com.messaging.rookie.RookieApplicationTests]
02:43:20.650 [main] DEBUG org.springframework.test.annotation.ProfileValueUtils - Retrieved @ProfileValueSourceConfiguration [null] for test class [com.messaging.rookie.RookieApplicationTests]
02:43:20.650 [main] DEBUG org.springframework.test.annotation.ProfileValueUtils - Retrieved ProfileValueSource type [class org.springframework.test.annotation.SystemProfileValueSource] for class [com.messaging.rookie.RookieApplicationTests]
02:43:20.659 [main] DEBUG org.springframework.test.context.support.AbstractDirtiesContextTestExecutionListener - Before test class: context [DefaultTestContext@7a675056 testClass = RookieApplicationTests, testInstance = [null], testMethod = [null], testException = [null], mergedContextConfiguration = [WebMergedContextConfiguration@d21a74c testClass = RookieApplicationTests, locations = '{}', classes = '{class com.messaging.rookie.RookieApplication}', contextInitializerClasses = '[]', activeProfiles = '{}', propertySourceLocations = '{}', propertySourceProperties = '{org.springframework.boot.test.context.SpringBootTestContextBootstrapper=true}', contextCustomizers = set[org.springframework.boot.test.context.filter.ExcludeFilterContextCustomizer@76b10754, org.springframework.boot.test.json.DuplicateJsonObjectContextCustomizerFactory$DuplicateJsonObjectContextCustomizer@2df32bf7, org.springframework.boot.test.mock.mockito.MockitoContextCustomizer@0, org.springframework.boot.test.web.client.TestRestTemplateContextCustomizer@32cf48b7, org.springframework.boot.test.web.reactive.server.WebTestClientContextCustomizer@12028586, org.springframework.boot.test.autoconfigure.properties.PropertyMappingContextCustomizer@0, org.springframework.boot.test.autoconfigure.web.servlet.WebDriverContextCustomizerFactory$Customizer@120d6fe6], resourceBasePath = 'src/main/webapp', contextLoader = 'org.springframework.boot.test.context.SpringBootContextLoader', parent = [null]], attributes = map['org.springframework.test.context.web.ServletTestExecutionListener.activateListener' -> true]], class annotated with @DirtiesContext [false] with mode [null].
02:43:20.669 [main] DEBUG org.springframework.test.annotation.ProfileValueUtils - Retrieved @ProfileValueSourceConfiguration [null] for test class [com.messaging.rookie.RookieApplicationTests]
02:43:20.669 [main] DEBUG org.springframework.test.annotation.ProfileValueUtils - Retrieved ProfileValueSource type [class org.springframework.test.annotation.SystemProfileValueSource] for class [com.messaging.rookie.RookieApplicationTests]
02:43:20.695 [main] DEBUG org.springframework.test.context.support.TestPropertySourceUtils - Adding inlined properties to environment: {spring.jmx.enabled=false, org.springframework.boot.test.context.SpringBootTestContextBootstrapper=true, server.port=-1}
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v2.1.4.RELEASE)
2019-05-12 02:43:20.978 INFO 23488 --- [ main] c.m.rookie.RookieApplicationTests : Starting RookieApplicationTests on MacBook-Pro-2 with PID 23488 (started by arsenegandote in /Users/arsenegandote/Applications/java/workspace/bulk-whatsapp)
2019-05-12 02:43:20.980 INFO 23488 --- [ main] c.m.rookie.RookieApplicationTests : No active profile set, falling back to default profiles: default
2019-05-12 02:43:22.374 INFO 23488 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Multiple Spring Data modules found, entering strict repository configuration mode!
2019-05-12 02:43:22.378 INFO 23488 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data repositories in DEFAULT mode.
2019-05-12 02:43:22.572 INFO 23488 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 186ms. Found 3 repository interfaces.
2019-05-12 02:43:22.588 INFO 23488 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Multiple Spring Data modules found, entering strict repository configuration mode!
2019-05-12 02:43:22.590 INFO 23488 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data repositories in DEFAULT mode.
2019-05-12 02:43:22.605 INFO 23488 --- [ main] .RepositoryConfigurationExtensionSupport : Spring Data Redis - Could not safely identify store assignment for repository candidate interface com.messaging.rookie.repositories.IAccountRepository.
2019-05-12 02:43:22.609 INFO 23488 --- [ main] .RepositoryConfigurationExtensionSupport : Spring Data Redis - Could not safely identify store assignment for repository candidate interface com.messaging.rookie.repositories.IContactRepository.
2019-05-12 02:43:22.611 INFO 23488 --- [ main] .RepositoryConfigurationExtensionSupport : Spring Data Redis - Could not safely identify store assignment for repository candidate interface com.messaging.rookie.repositories.ITransactionRepository.
2019-05-12 02:43:22.611 INFO 23488 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 11ms. Found 0 repository interfaces.
2019-05-12 02:43:23.422 INFO 23488 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration' of type [org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration$$EnhancerBySpringCGLIB$$7f81bfaf] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2019-05-12 02:43:23.552 WARN 23488 --- [ main] o.s.w.c.s.GenericWebApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.boot.autoconfigure.flyway.FlywayAutoConfiguration$FlywayConfiguration': Bean instantiation via constructor failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.boot.autoconfigure.flyway.FlywayAutoConfiguration$FlywayConfiguration$$EnhancerBySpringCGLIB$$ff7f8d4f]: Constructor threw exception; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in class path resource [org/springframework/boot/autoconfigure/jdbc/DataSourceConfiguration$Hikari.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.zaxxer.hikari.HikariDataSource]: Factory method 'dataSource' threw exception; nested exception is org.springframework.boot.autoconfigure.jdbc.DataSourceProperties$DataSourceBeanCreationException: Failed to determine a suitable driver class
2019-05-12 02:43:23.568 INFO 23488 --- [ main] ConditionEvaluationReportLoggingListener :
Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2019-05-12 02:43:23.570 ERROR 23488 --- [ main] o.s.b.d.LoggingFailureAnalysisReporter :
***************************
APPLICATION FAILED TO START
***************************
Description:
Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could be configured.
Reason: Failed to determine a suitable driver class
Action:
Consider the following:
If you want an embedded database (H2, HSQL or Derby), please put it on the classpath.
If you have database settings to be loaded from a particular profile you may need to activate it (no profiles are currently active).
2019-05-12 02:43:23.578 ERROR 23488 --- [ main] o.s.test.context.TestContextManager : Caught exception while allowing TestExecutionListener [org.springframework.test.context.web.ServletTestExecutionListener@385e9564] to prepare test instance [com.messaging.rookie.RookieApplicationTests@61f6d381]
java.lang.IllegalStateException: Failed to load ApplicationContext
at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.java:125) ~[spring-test-5.1.6.RELEASE.jar:5.1.6.RELEASE]
at org.springframework.test.context.support.DefaultTestContext.getApplicationContext(DefaultTestContext.java:108) ~[spring-test-5.1.6.RELEASE.jar:5.1.6.RELEASE]
at org.springframework.test.context.web.ServletTestExecutionListener.setUpRequestContextIfNecessary(ServletTestExecutionListener.java:190) ~[spring-test-5.1.6.RELEASE.jar:5.1.6.RELEASE]
at org.springframework.test.context.web.ServletTestExecutionListener.prepareTestInstance(ServletTestExecutionListener.java:132) ~[spring-test-5.1.6.RELEASE.jar:5.1.6.RELEASE]
at org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:246) ~[spring-test-5.1.6.RELEASE.jar:5.1.6.RELEASE]
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.createTest(SpringJUnit4ClassRunner.java:227) [spring-test-5.1.6.RELEASE.jar:5.1.6.RELEASE]
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner$1.runReflectiveCall(SpringJUnit4ClassRunner.java:289) [spring-test-5.1.6.RELEASE.jar:5.1.6.RELEASE]
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) [junit-4.12.jar:4.12]
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.methodBlock(SpringJUnit4ClassRunner.java:291) [spring-test-5.1.6.RELEASE.jar:5.1.6.RELEASE]
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:246) [spring-test-5.1.6.RELEASE.jar:5.1.6.RELEASE]
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:97) [spring-test-5.1.6.RELEASE.jar:5.1.6.RELEASE]
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) [junit-4.12.jar:4.12]
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) [junit-4.12.jar:4.12]
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) [junit-4.12.jar:4.12]
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) [junit-4.12.jar:4.12]
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) [junit-4.12.jar:4.12]
at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61) [spring-test-5.1.6.RELEASE.jar:5.1.6.RELEASE]
at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70) [spring-test-5.1.6.RELEASE.jar:5.1.6.RELEASE]
at org.junit.runners.ParentRunner.run(ParentRunner.java:363) [junit-4.12.jar:4.12]
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:190) [spring-test-5.1.6.RELEASE.jar:5.1.6.RELEASE]
at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:365) [surefire-junit4-2.22.2.jar:2.22.2]
at org.apache.maven.surefire.junit4.JUnit4Provider.executeWithRerun(JUnit4Provider.java:273) [surefire-junit4-2.22.2.jar:2.22.2]
at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:238) [surefire-junit4-2.22.2.jar:2.22.2]
at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:159) [surefire-junit4-2.22.2.jar:2.22.2]
at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:384) [surefire-booter-2.22.2.jar:2.22.2]
at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:345) [surefire-booter-2.22.2.jar:2.22.2]
at org.apache.maven.surefire.booter.ForkedBooter.execute(ForkedBooter.java:126) [surefire-booter-2.22.2.jar:2.22.2]
at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:418) [surefire-booter-2.22.2.jar:2.22.2]
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.boot.autoconfigure.flyway.FlywayAutoConfiguration$FlywayConfiguration': Bean instantiation via constructor failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.boot.autoconfigure.flyway.FlywayAutoConfiguration$FlywayConfiguration$$EnhancerBySpringCGLIB$$ff7f8d4f]: Constructor threw exception; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in class path resource [org/springframework/boot/autoconfigure/jdbc/DataSourceConfiguration$Hikari.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.zaxxer.hikari.HikariDataSource]: Factory method 'dataSource' threw exception; nested exception is org.springframework.boot.autoconfigure.jdbc.DataSourceProperties$DataSourceBeanCreationException: Failed to determine a suitable driver class
at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:304) ~[spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]
at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:285) ~[spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1341) ~[spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1187) ~[spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:555) ~[spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:515) ~[spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:320) ~[spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) ~[spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:318) ~[spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) ~[spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:392) ~[spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1321) ~[spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1160) ~[spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:555) ~[spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:515) ~[spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:320) ~[spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) ~[spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:318) ~[spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) ~[spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:307) ~[spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) ~[spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1105) ~[spring-context-5.1.6.RELEASE.jar:5.1.6.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:867) ~[spring-context-5.1.6.RELEASE.jar:5.1.6.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:549) ~[spring-context-5.1.6.RELEASE.jar:5.1.6.RELEASE]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:775) ~[spring-boot-2.1.4.RELEASE.jar:2.1.4.RELEASE]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397) ~[spring-boot-2.1.4.RELEASE.jar:2.1.4.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:316) ~[spring-boot-2.1.4.RELEASE.jar:2.1.4.RELEASE]
at org.springframework.boot.test.context.SpringBootContextLoader.loadContext(SpringBootContextLoader.java:127) ~[spring-boot-test-2.1.4.RELEASE.jar:2.1.4.RELEASE]
at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContextInternal(DefaultCacheAwareContextLoaderDelegate.java:99) ~[spring-test-5.1.6.RELEASE.jar:5.1.6.RELEASE]
at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.java:117) ~[spring-test-5.1.6.RELEASE.jar:5.1.6.RELEASE]
... 27 common frames omitted
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.boot.autoconfigure.flyway.FlywayAutoConfiguration$FlywayConfiguration$$EnhancerBySpringCGLIB$$ff7f8d4f]: Constructor threw exception; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in class path resource [org/springframework/boot/autoconfigure/jdbc/DataSourceConfiguration$Hikari.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.zaxxer.hikari.HikariDataSource]: Factory method 'dataSource' threw exception; nested exception is org.springframework.boot.autoconfigure.jdbc.DataSourceProperties$DataSourceBeanCreationException: Failed to determine a suitable driver class
at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:184) ~[spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:117) ~[spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]
at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:300) ~[spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]
... 56 common frames omitted
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in class path resource [org/springframework/boot/autoconfigure/jdbc/DataSourceConfiguration$Hikari.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.zaxxer.hikari.HikariDataSource]: Factory method 'dataSource' threw exception; nested exception is org.springframework.boot.autoconfigure.jdbc.DataSourceProperties$DataSourceBeanCreationException: Failed to determine a suitable driver class
at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:627) ~[spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:607) ~[spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1321) ~[spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1160) ~[spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:555) ~[spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:515) ~[spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:320) ~[spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) ~[spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:318) ~[spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) ~[spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]
at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:277) ~[spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1247) ~[spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]
at org.springframework.beans.factory.support.DefaultListableBeanFactory$DependencyObjectProvider.getIfUnique(DefaultListableBeanFactory.java:1901) ~[spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]
at org.springframework.boot.autoconfigure.flyway.FlywayAutoConfiguration$FlywayConfiguration.<init>(FlywayAutoConfiguration.java:139) ~[spring-boot-autoconfigure-2.1.4.RELEASE.jar:2.1.4.RELEASE]
at org.springframework.boot.autoconfigure.flyway.FlywayAutoConfiguration$FlywayConfiguration$$EnhancerBySpringCGLIB$$ff7f8d4f.<init>(<generated>) ~[spring-boot-autoconfigure-2.1.4.RELEASE.jar:2.1.4.RELEASE]
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[na:1.8.0_191]
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[na:1.8.0_191]
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[na:1.8.0_191]
at java.lang.reflect.Constructor.newInstance(Constructor.java:423) ~[na:1.8.0_191]
at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:172) ~[spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]
... 58 common frames omitted
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.zaxxer.hikari.HikariDataSource]: Factory method 'dataSource' threw exception; nested exception is org.springframework.boot.autoconfigure.jdbc.DataSourceProperties$DataSourceBeanCreationException: Failed to determine a suitable driver class
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:185) ~[spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]
at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:622) ~[spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]
... 77 common frames omitted
Caused by: org.springframework.boot.autoconfigure.jdbc.DataSourceProperties$DataSourceBeanCreationException: Failed to determine a suitable driver class
at org.springframework.boot.autoconfigure.jdbc.DataSourceProperties.determineDriverClassName(DataSourceProperties.java:236) ~[spring-boot-autoconfigure-2.1.4.RELEASE.jar:2.1.4.RELEASE]
at org.springframework.boot.autoconfigure.jdbc.DataSourceProperties.initializeDataSourceBuilder(DataSourceProperties.java:176) ~[spring-boot-autoconfigure-2.1.4.RELEASE.jar:2.1.4.RELEASE]
at org.springframework.boot.autoconfigure.jdbc.DataSourceConfiguration.createDataSource(DataSourceConfiguration.java:44) ~[spring-boot-autoconfigure-2.1.4.RELEASE.jar:2.1.4.RELEASE]
at org.springframework.boot.autoconfigure.jdbc.DataSourceConfiguration$Hikari.dataSource(DataSourceConfiguration.java:88) ~[spring-boot-autoconfigure-2.1.4.RELEASE.jar:2.1.4.RELEASE]
at org.springframework.boot.autoconfigure.jdbc.DataSourceConfiguration$Hikari$$EnhancerBySpringCGLIB$$c001299c.CGLIB$dataSource$0(<generated>) ~[spring-boot-autoconfigure-2.1.4.RELEASE.jar:2.1.4.RELEASE]
at org.springframework.boot.autoconfigure.jdbc.DataSourceConfiguration$Hikari$$EnhancerBySpringCGLIB$$c001299c$$FastClassBySpringCGLIB$$cc817b70.invoke(<generated>) ~[spring-boot-autoconfigure-2.1.4.RELEASE.jar:2.1.4.RELEASE]
at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:244) ~[spring-core-5.1.6.RELEASE.jar:5.1.6.RELEASE]
at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:363) ~[spring-context-5.1.6.RELEASE.jar:5.1.6.RELEASE]
at org.springframework.boot.autoconfigure.jdbc.DataSourceConfiguration$Hikari$$EnhancerBySpringCGLIB$$c001299c.dataSource(<generated>) ~[spring-boot-autoconfigure-2.1.4.RELEASE.jar:2.1.4.RELEASE]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_191]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_191]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_191]
at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_191]
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:154) ~[spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]
... 78 common frames omitted
[ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 3.535 s <<< FAILURE! - in com.messaging.rookie.RookieApplicationTests
[ERROR] contextLoads(com.messaging.rookie.RookieApplicationTests) Time elapsed: 0.001 s <<< ERROR!
java.lang.IllegalStateException: Failed to load ApplicationContext
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.boot.autoconfigure.flyway.FlywayAutoConfiguration$FlywayConfiguration': Bean instantiation via constructor failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.boot.autoconfigure.flyway.FlywayAutoConfiguration$FlywayConfiguration$$EnhancerBySpringCGLIB$$ff7f8d4f]: Constructor threw exception; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in class path resource [org/springframework/boot/autoconfigure/jdbc/DataSourceConfiguration$Hikari.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.zaxxer.hikari.HikariDataSource]: Factory method 'dataSource' threw exception; nested exception is org.springframework.boot.autoconfigure.jdbc.DataSourceProperties$DataSourceBeanCreationException: Failed to determine a suitable driver class
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.boot.autoconfigure.flyway.FlywayAutoConfiguration$FlywayConfiguration$$EnhancerBySpringCGLIB$$ff7f8d4f]: Constructor threw exception; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in class path resource [org/springframework/boot/autoconfigure/jdbc/DataSourceConfiguration$Hikari.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.zaxxer.hikari.HikariDataSource]: Factory method 'dataSource' threw exception; nested exception is org.springframework.boot.autoconfigure.jdbc.DataSourceProperties$DataSourceBeanCreationException: Failed to determine a suitable driver class
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in class path resource [org/springframework/boot/autoconfigure/jdbc/DataSourceConfiguration$Hikari.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.zaxxer.hikari.HikariDataSource]: Factory method 'dataSource' threw exception; nested exception is org.springframework.boot.autoconfigure.jdbc.DataSourceProperties$DataSourceBeanCreationException: Failed to determine a suitable driver class
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.zaxxer.hikari.HikariDataSource]: Factory method 'dataSource' threw exception; nested exception is org.springframework.boot.autoconfigure.jdbc.DataSourceProperties$DataSourceBeanCreationException: Failed to determine a suitable driver class
Caused by: org.springframework.boot.autoconfigure.jdbc.DataSourceProperties$DataSourceBeanCreationException: Failed to determine a suitable driver class
[INFO] Running com.messaging.rookie.AccountsServiceTests
2019-05-12 02:43:23.588 INFO 23488 --- [ main] .b.t.c.SpringBootTestContextBootstrapper : Neither @ContextConfiguration nor @ContextHierarchy found for test class [com.messaging.rookie.AccountsServiceTests], using SpringBootContextLoader
2019-05-12 02:43:23.595 INFO 23488 --- [ main] o.s.t.c.support.AbstractContextLoader : Could not detect default resource locations for test class [com.messaging.rookie.AccountsServiceTests]: no resource found for suffixes {-context.xml, Context.groovy}.
2019-05-12 02:43:23.595 INFO 23488 --- [ main] t.c.s.AnnotationConfigContextLoaderUtils : Could not detect default configuration classes for test class [com.messaging.rookie.AccountsServiceTests]: AccountsServiceTests does not declare any static, non-private, non-final, nested classes annotated with @Configuration.
2019-05-12 02:43:23.605 INFO 23488 --- [ main] .b.t.c.SpringBootTestContextBootstrapper : Found @SpringBootConfiguration com.messaging.rookie.RookieApplication for test class com.messaging.rookie.AccountsServiceTests
2019-05-12 02:43:23.606 INFO 23488 --- [ main] .b.t.c.SpringBootTestContextBootstrapper : Loaded default TestExecutionListener class names from location [META-INF/spring.factories]: [org.springframework.boot.test.mock.mockito.MockitoTestExecutionListener, org.springframework.boot.test.mock.mockito.ResetMocksTestExecutionListener, org.springframework.boot.test.autoconfigure.restdocs.RestDocsTestExecutionListener, org.springframework.boot.test.autoconfigure.web.client.MockRestServiceServerResetTestExecutionListener, org.springframework.boot.test.autoconfigure.web.servlet.MockMvcPrintOnlyOnFailureTestExecutionListener, org.springframework.boot.test.autoconfigure.web.servlet.WebDriverTestExecutionListener, org.springframework.test.context.web.ServletTestExecutionListener, org.springframework.test.context.support.DirtiesContextBeforeModesTestExecutionListener, org.springframework.test.context.support.DependencyInjectionTestExecutionListener, org.springframework.test.context.support.DirtiesContextTestExecutionListener, org.springframework.test.context.transaction.TransactionalTestExecutionListener, org.springframework.test.context.jdbc.SqlScriptsTestExecutionListener, org.springframework.security.test.context.support.WithSecurityContextTestExecutionListener, org.springframework.security.test.context.support.ReactorContextTestExecutionListener, io.zonky.test.db.flyway.OptimizedFlywayTestExecutionListener]
2019-05-12 02:43:23.606 INFO 23488 --- [ main] .b.t.c.SpringBootTestContextBootstrapper : Using TestExecutionListeners: [org.springframework.test.context.web.ServletTestExecutionListener@1c9fbb61, org.springframework.test.context.support.DirtiesContextBeforeModesTestExecutionListener@7b81616b, org.springframework.boot.test.mock.mockito.MockitoTestExecutionListener@15d42ccb, org.springframework.boot.test.autoconfigure.SpringBootDependencyInjectionTestExecutionListener@279dd959, org.springframework.test.context.support.DirtiesContextTestExecutionListener@46383a78, io.zonky.test.db.flyway.OptimizedFlywayTestExecutionListener@36c281ed, org.springframework.test.context.transaction.TransactionalTestExecutionListener@244418a, org.springframework.test.context.jdbc.SqlScriptsTestExecutionListener@4b5a078a, org.springframework.security.test.context.support.WithSecurityContextTestExecutionListener@4c361f63, org.springframework.security.test.context.support.ReactorContextTestExecutionListener@6ed922e1, org.springframework.boot.test.mock.mockito.ResetMocksTestExecutionListener@4eb166a1, org.springframework.boot.test.autoconfigure.restdocs.RestDocsTestExecutionListener@554c4eaa, org.springframework.boot.test.autoconfigure.web.client.MockRestServiceServerResetTestExecutionListener@29fd8e67, org.springframework.boot.test.autoconfigure.web.servlet.MockMvcPrintOnlyOnFailureTestExecutionListener@e146f93, org.springframework.boot.test.autoconfigure.web.servlet.WebDriverTestExecutionListener@4bd5849e]
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v2.1.4.RELEASE)
2019-05-12 02:43:23.672 INFO 23488 --- [ main] c.messaging.rookie.AccountsServiceTests : Starting AccountsServiceTests on MacBook-Pro-2 with PID 23488 (started by arsenegandote in /Users/arsenegandote/Applications/java/workspace/bulk-whatsapp)
2019-05-12 02:43:23.673 INFO 23488 --- [ main] c.messaging.rookie.AccountsServiceTests : No active profile set, falling back to default profiles: default
2019-05-12 02:43:24.047 INFO 23488 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Multiple Spring Data modules found, entering strict repository configuration mode!
2019-05-12 02:43:24.048 INFO 23488 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data repositories in DEFAULT mode.
2019-05-12 02:43:24.072 INFO 23488 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 21ms. Found 3 repository interfaces.
2019-05-12 02:43:24.075 INFO 23488 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Multiple Spring Data modules found, entering strict repository configuration mode!
2019-05-12 02:43:24.076 INFO 23488 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data repositories in DEFAULT mode.
2019-05-12 02:43:24.083 INFO 23488 --- [ main] .RepositoryConfigurationExtensionSupport : Spring Data Redis - Could not safely identify store assignment for repository candidate interface com.messaging.rookie.repositories.IAccountRepository.
2019-05-12 02:43:24.091 INFO 23488 --- [ main] .RepositoryConfigurationExtensionSupport : Spring Data Redis - Could not safely identify store assignment for repository candidate interface com.messaging.rookie.repositories.IContactRepository.
2019-05-12 02:43:24.091 INFO 23488 --- [ main] .RepositoryConfigurationExtensionSupport : Spring Data Redis - Could not safely identify store assignment for repository candidate interface com.messaging.rookie.repositories.ITransactionRepository.
2019-05-12 02:43:24.091 INFO 23488 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 15ms. Found 0 repository interfaces.
2019-05-12 02:43:24.147 INFO 23488 --- [ main] EmbeddedPostgresContextCustomizerFactory : Replacing 'dataSource' DataSource bean with embedded version
2019-05-12 02:43:24.253 INFO 23488 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration' of type [org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration$$EnhancerBySpringCGLIB$$7f81bfaf] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2019-05-12 02:43:24.348 INFO 23488 --- [ main] eProvider$PriorityThreadPoolTaskExecutor : Initializing ExecutorService
2019-05-12 02:43:24.537 INFO 23488 --- [ prefetching-1] i.z.t.d.p.embedded.EmbeddedPostgres : Detected a Darwin x86_64 system
2019-05-12 02:43:24.540 INFO 23488 --- [ prefetching-1] .z.t.d.p.e.DefaultPostgresBinaryResolver : Detected distribution: 'Unknown'
2019-05-12 02:43:24.542 INFO 23488 --- [ prefetching-1] .z.t.d.p.e.DefaultPostgresBinaryResolver : System specific postgres binaries found: postgres-darwin-x86_64.txz
2019-05-12 02:43:24.635 INFO 23488 --- [ prefetching-1] i.z.t.d.p.embedded.EmbeddedPostgres : Postgres binaries at /var/folders/_9/v2g8jyjj051bj38hln17lchw0000gn/T/embedded-pg/PG-54fb89bb6d8eed579b8402effb4712c2
2019-05-12 02:43:24.664 INFO 23488 --- [itdb:pid(23494)] i.z.t.d.p.embedded.EmbeddedPostgres : The files belonging to this database system will be owned by user "arsenegandote".
2019-05-12 02:43:24.665 INFO 23488 --- [itdb:pid(23494)] i.z.t.d.p.embedded.EmbeddedPostgres : This user must also own the server process.
2019-05-12 02:43:24.665 INFO 23488 --- [itdb:pid(23494)] i.z.t.d.p.embedded.EmbeddedPostgres :
2019-05-12 02:43:24.665 INFO 23488 --- [itdb:pid(23494)] i.z.t.d.p.embedded.EmbeddedPostgres : The database cluster will be initialized with locale "en_US.UTF-8".
2019-05-12 02:43:24.665 INFO 23488 --- [itdb:pid(23494)] i.z.t.d.p.embedded.EmbeddedPostgres : The default text search configuration will be set to "english".
2019-05-12 02:43:24.665 INFO 23488 --- [itdb:pid(23494)] i.z.t.d.p.embedded.EmbeddedPostgres :
2019-05-12 02:43:24.665 INFO 23488 --- [itdb:pid(23494)] i.z.t.d.p.embedded.EmbeddedPostgres : Data page checksums are disabled.
2019-05-12 02:43:24.665 INFO 23488 --- [itdb:pid(23494)] i.z.t.d.p.embedded.EmbeddedPostgres :
2019-05-12 02:43:24.665 INFO 23488 --- [itdb:pid(23494)] i.z.t.d.p.embedded.EmbeddedPostgres : fixing permissions on existing directory /var/folders/_9/v2g8jyjj051bj38hln17lchw0000gn/T/epg3037655960363376040 ... ok
2019-05-12 02:43:24.666 INFO 23488 --- [itdb:pid(23494)] i.z.t.d.p.embedded.EmbeddedPostgres : creating subdirectories ... ok
2019-05-12 02:43:24.689 INFO 23488 --- [itdb:pid(23494)] i.z.t.d.p.embedded.EmbeddedPostgres : selecting default max_connections ... 100
2019-05-12 02:43:24.710 INFO 23488 --- [itdb:pid(23494)] i.z.t.d.p.embedded.EmbeddedPostgres : selecting default shared_buffers ... 128MB
2019-05-12 02:43:24.710 INFO 23488 --- [itdb:pid(23494)] i.z.t.d.p.embedded.EmbeddedPostgres : selecting dynamic shared memory implementation ... posix
2019-05-12 02:43:24.791 INFO 23488 --- [itdb:pid(23494)] i.z.t.d.p.embedded.EmbeddedPostgres : creating configuration files ... ok
2019-05-12 02:43:25.009 INFO 23488 --- [itdb:pid(23494)] i.z.t.d.p.embedded.EmbeddedPostgres : running bootstrap script ... ok
2019-05-12 02:43:25.726 INFO 23488 --- [itdb:pid(23494)] i.z.t.d.p.embedded.EmbeddedPostgres : performing post-bootstrap initialization ... ok
2019-05-12 02:43:25.751 INFO 23488 --- [itdb:pid(23494)] i.z.t.d.p.embedded.EmbeddedPostgres : syncing data to disk ... ok
2019-05-12 02:43:25.751 INFO 23488 --- [itdb:pid(23494)] i.z.t.d.p.embedded.EmbeddedPostgres :
2019-05-12 02:43:25.751 INFO 23488 --- [itdb:pid(23494)] i.z.t.d.p.embedded.EmbeddedPostgres : Success. You can now start the database server using:
2019-05-12 02:43:25.751 INFO 23488 --- [itdb:pid(23494)] i.z.t.d.p.embedded.EmbeddedPostgres :
2019-05-12 02:43:25.751 INFO 23488 --- [itdb:pid(23494)] i.z.t.d.p.embedded.EmbeddedPostgres : /var/folders/_9/v2g8jyjj051bj38hln17lchw0000gn/T/embedded-pg/PG-54fb89bb6d8eed579b8402effb4712c2/bin/pg_ctl -D /var/folders/_9/v2g8jyjj051bj38hln17lchw0000gn/T/epg3037655960363376040 -l logfile start
2019-05-12 02:43:25.751 INFO 23488 --- [itdb:pid(23494)] i.z.t.d.p.embedded.EmbeddedPostgres :
2019-05-12 02:43:25.753 INFO 23488 --- [ prefetching-1] i.z.t.d.p.embedded.EmbeddedPostgres : c20d4926-be57-4456-879a-90964ed2f759 initdb completed in 00:00:01.115
2019-05-12 02:43:25.763 INFO 23488 --- [ prefetching-1] i.z.t.d.p.embedded.EmbeddedPostgres : c20d4926-be57-4456-879a-90964ed2f759 postmaster started as java.lang.UNIXProcess@1e63f40e on port 57308. Waiting up to PT20S for server startup to finish.
2019-05-12 02:43:25.801 INFO 23488 --- [_ctl:pid(23505)] i.z.t.d.p.embedded.EmbeddedPostgres : waiting for server to start....2019-05-12 02:43:25.800 GMT [23507] LOG: listening on IPv6 address "::1", port 57308
2019-05-12 02:43:25.801 INFO 23488 --- [_ctl:pid(23505)] i.z.t.d.p.embedded.EmbeddedPostgres : 2019-05-12 02:43:25.801 GMT [23507] LOG: listening on IPv4 address "127.0.0.1", port 57308
2019-05-12 02:43:25.801 INFO 23488 --- [_ctl:pid(23505)] i.z.t.d.p.embedded.EmbeddedPostgres : 2019-05-12 02:43:25.801 GMT [23507] LOG: listening on Unix socket "/tmp/.s.PGSQL.57308"
2019-05-12 02:43:25.816 INFO 23488 --- [_ctl:pid(23505)] i.z.t.d.p.embedded.EmbeddedPostgres : 2019-05-12 02:43:25.816 GMT [23508] LOG: database system was shut down at 2019-05-12 02:43:25 GMT
2019-05-12 02:43:25.821 INFO 23488 --- [_ctl:pid(23505)] i.z.t.d.p.embedded.EmbeddedPostgres : 2019-05-12 02:43:25.820 GMT [23507] LOG: database system is ready to accept connections
2019-05-12 02:43:25.879 INFO 23488 --- [_ctl:pid(23505)] i.z.t.d.p.embedded.EmbeddedPostgres : 2019-05-12 02:43:25.879 GMT [23515] LOG: incomplete startup packet
2019-05-12 02:43:25.887 INFO 23488 --- [_ctl:pid(23505)] i.z.t.d.p.embedded.EmbeddedPostgres : done
2019-05-12 02:43:25.888 INFO 23488 --- [_ctl:pid(23505)] i.z.t.d.p.embedded.EmbeddedPostgres : server started
2019-05-12 02:43:25.959 INFO 23488 --- [ prefetching-1] i.z.t.d.p.embedded.EmbeddedPostgres : c20d4926-be57-4456-879a-90964ed2f759 postmaster startup finished in 00:00:00.199
2019-05-12 02:43:26.229 INFO 23488 --- [ prefetching-2] o.f.c.internal.license.VersionPrinter : Flyway Community Edition 5.2.4 by Boxfuse
2019-05-12 02:43:26.253 INFO 23488 --- [ prefetching-2] o.f.c.internal.database.DatabaseFactory : Database: jdbc:postgresql://localhost:57308/cnandesiwiro (PostgreSQL 10.7)
2019-05-12 02:43:26.320 INFO 23488 --- [ prefetching-2] o.f.core.internal.command.DbValidate : Successfully validated 1 migration (execution time 00:00.023s)
2019-05-12 02:43:26.331 INFO 23488 --- [ prefetching-2] o.f.c.i.s.JdbcTableSchemaHistory : Creating Schema History table: "public"."flyway_schema_history"
2019-05-12 02:43:26.349 INFO 23488 --- [ prefetching-2] o.f.core.internal.command.DbMigrate : Current version of schema "public": << Empty Schema >>
2019-05-12 02:43:26.350 INFO 23488 --- [ prefetching-2] o.f.core.internal.command.DbMigrate : Migrating schema "public" to version 1 - init
2019-05-12 02:43:26.372 INFO 23488 --- [ prefetching-2] o.f.core.internal.command.DbMigrate : Successfully applied 1 migration to schema "public" (execution time 00:00.042s)
2019-05-12 02:43:26.679 INFO 23488 --- [ main] i.z.t.d.l.EmbeddedDatabaseReporter : JDBC URL to connect to the embedded database: jdbc:postgresql://localhost:57308/oixcnmxlsaft?user=postgres
2019-05-12 02:43:26.712 INFO 23488 --- [ main] o.f.core.internal.command.DbValidate : Successfully validated 1 migration (execution time 00:00.009s)
2019-05-12 02:43:26.722 INFO 23488 --- [ main] o.f.core.internal.command.DbMigrate : Current version of schema "public": 1
2019-05-12 02:43:26.723 INFO 23488 --- [ main] o.f.core.internal.command.DbMigrate : Schema "public" is up to date. No migration necessary.
2019-05-12 02:43:26.950 INFO 23488 --- [ main] o.hibernate.jpa.internal.util.LogHelper : HHH000204: Processing PersistenceUnitInfo [
name: default
...]
2019-05-12 02:43:27.023 INFO 23488 --- [ main] org.hibernate.Version : HHH000412: Hibernate Core {5.3.9.Final}
2019-05-12 02:43:27.024 INFO 23488 --- [ main] org.hibernate.cfg.Environment : HHH000206: hibernate.properties not found
2019-05-12 02:43:27.217 INFO 23488 --- [ main] o.hibernate.annotations.common.Version : HCANN000001: Hibernate Commons Annotations {5.0.4.Final}
2019-05-12 02:43:27.375 INFO 23488 --- [ main] org.hibernate.dialect.Dialect : HHH000400: Using dialect: org.hibernate.dialect.PostgreSQL95Dialect
2019-05-12 02:43:27.501 INFO 23488 --- [ main] o.h.e.j.e.i.LobCreatorBuilderImpl : HHH000421: Disabling contextual LOB creation as hibernate.jdbc.lob.non_contextual_creation is true
2019-05-12 02:43:27.507 INFO 23488 --- [ main] org.hibernate.type.BasicTypeRegistry : HHH000270: Type registration [java.util.UUID] overrides previous : org.hibernate.type.UUIDBinaryType@687a0e40
2019-05-12 02:43:28.259 INFO 23488 --- [ main] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'default'
2019-05-12 02:43:29.778 INFO 23488 --- [ main] o.s.s.concurrent.ThreadPoolTaskExecutor : Initializing ExecutorService 'applicationTaskExecutor'
2019-05-12 02:43:29.858 WARN 23488 --- [ main] aWebConfiguration$JpaWebMvcConfiguration : spring.jpa.open-in-view is enabled by default. Therefore, database queries may be performed during view rendering. Explicitly configure spring.jpa.open-in-view to disable this warning
2019-05-12 02:43:30.032 WARN 23488 --- [ main] ion$DefaultTemplateResolverConfiguration : Cannot find template location: classpath:/templates/ (please add some templates or check your Thymeleaf configuration)
2019-05-12 02:43:31.432 INFO 23488 --- [ main] .s.s.UserDetailsServiceAutoConfiguration :
Using generated security password: df91e831-a6ad-404b-b108-ce81ac571c24
2019-05-12 02:43:31.631 INFO 23488 --- [ main] o.s.s.web.DefaultSecurityFilterChain : Creating filter chain: any request, [org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter@29c76d75, org.springframework.security.web.context.SecurityContextPersistenceFilter@61d527ac, org.springframework.security.web.header.HeaderWriterFilter@6785786d, org.springframework.security.web.csrf.CsrfFilter@5a8835c6, org.springframework.security.web.authentication.logout.LogoutFilter@71806c64, org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter@663e1144, org.springframework.security.web.authentication.ui.DefaultLoginPageGeneratingFilter@1a56f608, org.springframework.security.web.authentication.ui.DefaultLogoutPageGeneratingFilter@346a2799, org.springframework.security.web.authentication.www.BasicAuthenticationFilter@7c0035dd, org.springframework.security.web.savedrequest.RequestCacheAwareFilter@380e3122, org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter@1574f323, org.springframework.security.web.authentication.AnonymousAuthenticationFilter@17344d7, org.springframework.security.web.session.SessionManagementFilter@6d38a81d, org.springframework.security.web.access.ExceptionTranslationFilter@5a5c2889, org.springframework.security.web.access.intercept.FilterSecurityInterceptor@3dc14f80]
2019-05-12 02:43:31.806 INFO 23488 --- [ main] o.s.b.a.e.web.EndpointLinksResolver : Exposing 2 endpoint(s) beneath base path '/actuator'
2019-05-12 02:43:32.057 INFO 23488 --- [ main] c.messaging.rookie.AccountsServiceTests : Started AccountsServiceTests in 8.447 seconds (JVM running for 12.305)
2019-05-12 02:43:32.798 DEBUG 23488 --- [ main] org.hibernate.SQL : insert into accounts (created_by, created_at, modified_at, modified_by, active, address, country, email, mobile_number, postal_box, whatsapp_number, is_admin, first_name, gender, last_name) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
2019-05-12 02:43:32.801 TRACE 23488 --- [ main] o.h.type.descriptor.sql.BasicBinder : binding parameter [1] as [VARCHAR] - [+233247063817]
2019-05-12 02:43:32.805 TRACE 23488 --- [ main] o.h.type.descriptor.sql.BasicBinder : binding parameter [2] as [TIMESTAMP] - [Sun May 12 02:43:32 GMT 2019]
2019-05-12 02:43:32.806 TRACE 23488 --- [ main] o.h.type.descriptor.sql.BasicBinder : binding parameter [3] as [TIMESTAMP] - [Sun May 12 02:43:32 GMT 2019]
2019-05-12 02:43:32.806 TRACE 23488 --- [ main] o.h.type.descriptor.sql.BasicBinder : binding parameter [4] as [VARCHAR] - [+233247063817]
2019-05-12 02:43:32.807 TRACE 23488 --- [ main] o.h.type.descriptor.sql.BasicBinder : binding parameter [5] as [BOOLEAN] - [false]
2019-05-12 02:43:32.807 TRACE 23488 --- [ main] o.h.type.descriptor.sql.BasicBinder : binding parameter [6] as [VARCHAR] - [Suite 818 37588 Zulauf Oval, East Eusebio, MD 48951]
2019-05-12 02:43:32.807 TRACE 23488 --- [ main] o.h.type.descriptor.sql.BasicBinder : binding parameter [7] as [VARCHAR] - [dz]
2019-05-12 02:43:32.807 TRACE 23488 --- [ main] o.h.type.descriptor.sql.BasicBinder : binding parameter [8] as [VARCHAR] - [[email protected]]
2019-05-12 02:43:32.807 TRACE 23488 --- [ main] o.h.type.descriptor.sql.BasicBinder : binding parameter [9] as [VARCHAR] - [890.356.8321]
2019-05-12 02:43:32.807 TRACE 23488 --- [ main] o.h.type.descriptor.sql.BasicBinder : binding parameter [10] as [VARCHAR] - [899 France Isle]
2019-05-12 02:43:32.807 TRACE 23488 --- [ main] o.h.type.descriptor.sql.BasicBinder : binding parameter [11] as [VARCHAR] - [1-434-742-2277]
2019-05-12 02:43:32.808 TRACE 23488 --- [ main] o.h.type.descriptor.sql.BasicBinder : binding parameter [12] as [BOOLEAN] - [false]
2019-05-12 02:43:32.808 TRACE 23488 --- [ main] o.h.type.descriptor.sql.BasicBinder : binding parameter [13] as [VARCHAR] - [Grazyna]
2019-05-12 02:43:32.808 TRACE 23488 --- [ main] o.h.type.descriptor.sql.BasicBinder : binding parameter [14] as [VARCHAR] - [M]
2019-05-12 02:43:32.808 TRACE 23488 --- [ main] o.h.type.descriptor.sql.BasicBinder : binding parameter [15] as [VARCHAR] - [Goldner]
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 9.162 s - in com.messaging.rookie.AccountsServiceTests
2019-05-12 02:43:32.865 INFO 23488 --- [ Thread-8] o.s.s.concurrent.ThreadPoolTaskExecutor : Shutting down ExecutorService 'applicationTaskExecutor'
2019-05-12 02:43:32.867 INFO 23488 --- [ Thread-8] j.LocalContainerEntityManagerFactoryBean : Closing JPA EntityManagerFactory for persistence unit 'default'
2019-05-12 02:43:32.869 INFO 23488 --- [ Thread-8] o.s.b.f.support.DisposableBeanAdapter : Invocation of destroy method failed on bean with name 'inMemoryDatabaseShutdownExecutor': org.springframework.boot.autoconfigure.jdbc.DataSourceProperties$DataSourceBeanCreationException: Failed to determine a suitable driver class
2019-05-12 02:43:32.960 INFO 23488 --- [_ctl:pid(23537)] i.z.t.d.p.embedded.EmbeddedPostgres : waiting for server to shut down.... done
2019-05-12 02:43:32.960 INFO 23488 --- [_ctl:pid(23537)] i.z.t.d.p.embedded.EmbeddedPostgres : server stopped
2019-05-12 02:43:32.961 INFO 23488 --- [4ed2f759-closer] i.z.t.d.p.embedded.EmbeddedPostgres : c20d4926-be57-4456-879a-90964ed2f759 shut down postmaster in 00:00:00.110
[INFO]
[INFO] Results:
[INFO]
[ERROR] Errors:
[ERROR] RookieApplicationTests.contextLoads » IllegalState Failed to load ApplicationC...
[INFO]
[ERROR] Tests run: 2, Failures: 0, Errors: 1, Skipped: 0
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 16.127 s
[INFO] Finished at: 2019-05-12T02:43:33Z
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.22.2:test (default-test) on project rookie: There are test failures.
[ERROR]
[ERROR] Please refer to /Users/arsenegandote/Applications/java/workspace/bulk-whatsapp/target/surefire-reports for the individual test results.
[ERROR] Please refer to dump files (if any exist) [date].dump, [date]-jvmRun[N].dump and [date].dumpstream.
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
MacBook-Pro-2:bulk-whatsapp arsenegandote$
This is my applications.properties file for the test
spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.PostgreSQLDialect
spring.jpa.properties.hibernate.jdbc.lob.non_contextual_creation=true
## Hibernate Logging
logging.level.org.hibernate.SQL= DEBUG
Hey, thanks for your great work!
I've just finished implementing this in a current project, and everything is working perfectly locally.
Having deployed this to a gradle:alpine Docker image, we're receiving the following error when running our tests:
ERROR i.z.t.d.p.FlywayEmbeddedPostgresDataSourceFactoryBean - Unexpected error during the initialization of embedded database
java.util.concurrent.CompletionException: java.lang.RuntimeException: java.io.IOException: Cannot run program "/tmp/embedded-pg/PG-785b618641f5eefce5b5079f2c9458dd/bin/initdb": error=2, No such file or directory
Having attempted to debug, I listed the output of the /tmp/embedded-pg/PG-785b618641f5eefce5b5079f2c9458dd/bin
directory, and it does contain the initdb script. I also verified the permissions of this folder and script, and they are the same permissions and user as the one that is running our tests.
ls -laR /tmp/embedded-pg/PG-785b618641f5eefce5b5079f2c9458dd/bin
/tmp/embedded-pg/PG-785b618641f5eefce5b5079f2c9458dd/bin:
total 6388
drwxr-xr-x 2 gradle gradle 4096 Mar 11 16:26 .
drwxr-xr-x 5 gradle gradle 4096 Mar 11 16:26 ..
-rwxr--r-- 1 gradle gradle 94704 Mar 11 16:26 initdb
-rwxr--r-- 1 gradle gradle 37928 Mar 11 16:26 pg_ctl
-rwxr--r-- 1 gradle gradle 6391624 Mar 11 16:26 postgres
~/project $
Larger stack trace:
Caused by: java.lang.RuntimeException: java.io.IOException: Cannot run program "/tmp/embedded-pg/PG-785b618641f5eefce5b5079f2c9458dd/bin/initdb": error=2, No such file or directory
at com.google.common.base.Throwables.propagate(Throwables.java:241)
at com.opentable.db.postgres.embedded.EmbeddedPostgres.system(EmbeddedPostgres.java:514)
at com.opentable.db.postgres.embedded.EmbeddedPostgres.initdb(EmbeddedPostgres.java:208)
at com.opentable.db.postgres.embedded.EmbeddedPostgres.<init>(EmbeddedPostgres.java:130)
at com.opentable.db.postgres.embedded.EmbeddedPostgres$Builder.start(EmbeddedPostgres.java:493)
at com.opentable.db.postgres.embedded.EmbeddedPostgres.start(EmbeddedPostgres.java:413)
at com.opentable.db.postgres.embedded.PreparedDbProvider.createOrFindPreparer(PreparedDbProvider.java:76)
at com.opentable.db.postgres.embedded.PreparedDbProvider.<init>(PreparedDbProvider.java:59)
at com.opentable.db.postgres.embedded.PreparedDbProvider.forPreparer(PreparedDbProvider.java:53)
at io.zonky.test.db.flyway.DefaultFlywayDataSourceContext.lambda$reload$0(DefaultFlywayDataSourceContext.java:111)
... 79 common frames omitted
Caused by: java.io.IOException: Cannot run program "/tmp/embedded-pg/PG-785b618641f5eefce5b5079f2c9458dd/bin/initdb": error=2, No such file or directory
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048)
at com.opentable.db.postgres.embedded.EmbeddedPostgres.system(EmbeddedPostgres.java:508)
... 87 common frames omitted
Caused by: java.io.IOException: error=2, No such file or directory
at java.lang.UNIXProcess.forkAndExec(Native Method)
at java.lang.UNIXProcess.<init>(UNIXProcess.java:247)
at java.lang.ProcessImpl.start(ProcessImpl.java:134)
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1029)
... 88 common frames omitted
Make flyway dependencies optional and introduce some alternative mechanism for database refreshing. Something like @AutoConfigureEmbeddedDatabase(refreshMode = RefreshMode.AFTER_EACH_TEST_METHOD)
.
When multiple flyway beans are used, each of them managing a different database schema, it may result in an inconsistent database. It is caused by an optimization that uses a template database for fast initialization of databases containing the same data. This optimization takes into account only the last Flyway migrations and all others are overwritten.
Now, when using @DataJpaTest
or @JdbcTest
annotation, you must first disable the default in-memory database by @AutoConfigureTestDatabase(replace = NONE)
and after that it is possible to use the embedded database. This may be a little confusing, and it would be useful to deactivate the default test database automatically.
The @ConditionalOnBean(DataSource.class)
annotation does not work properly when creating a new empty embedded database. It works only when replacing an existing data source.
Hello, @tomix26! You have written here that liquibase is basically supported. I don't have any flyway beans in my application context. I'm using liquibase. But when I add @AutoConfigureEmbeddedDatabase annotation, zonkyio loads flyway bean and tries to run migrate scripts and I become exception:
java.lang.IllegalStateException: Failed to load ApplicationContext at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.java:125) at org.springframework.test.context.support.DefaultTestContext.getApplicationContext(DefaultTestContext.java:108) at org.springframework.test.context.web.ServletTestExecutionListener.setUpRequestContextIfNecessary(ServletTestExecutionListener.java:190) at org.springframework.test.context.web.ServletTestExecutionListener.prepareTestInstance(ServletTestExecutionListener.java:132) at org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:246) at org.springframework.test.context.junit.jupiter.SpringExtension.postProcessTestInstance(SpringExtension.java:97) at org.junit.jupiter.engine.descriptor.ClassTestDescriptor.lambda$invokeTestInstancePostProcessors$5(ClassTestDescriptor.java:349) at org.junit.jupiter.engine.descriptor.JupiterTestDescriptor.executeAndMaskThrowable(JupiterTestDescriptor.java:215) at org.junit.jupiter.engine.descriptor.ClassTestDescriptor.lambda$invokeTestInstancePostProcessors$6(ClassTestDescriptor.java:349) at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193) at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:175) at java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1382) at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481) at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471) at java.util.stream.StreamSpliterators$WrappingSpliterator.forEachRemaining(StreamSpliterators.java:312) at java.util.stream.Streams$ConcatSpliterator.forEachRemaining(Streams.java:743) at java.util.stream.Streams$ConcatSpliterator.forEachRemaining(Streams.java:742) at java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:580) at org.junit.jupiter.engine.descriptor.ClassTestDescriptor.invokeTestInstancePostProcessors(ClassTestDescriptor.java:348) at org.junit.jupiter.engine.descriptor.ClassTestDescriptor.instantiateAndPostProcessTestInstance(ClassTestDescriptor.java:270) at org.junit.jupiter.engine.descriptor.ClassTestDescriptor.lambda$testInstanceProvider$2(ClassTestDescriptor.java:259) at org.junit.jupiter.engine.descriptor.ClassTestDescriptor.lambda$testInstanceProvider$3(ClassTestDescriptor.java:263) at java.util.Optional.orElseGet(Optional.java:267) at org.junit.jupiter.engine.descriptor.ClassTestDescriptor.lambda$testInstanceProvider$4(ClassTestDescriptor.java:262) at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.prepare(TestMethodTestDescriptor.java:82) at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.prepare(TestMethodTestDescriptor.java:59) at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$prepare$0(NodeTestTask.java:83) at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:72) at org.junit.platform.engine.support.hierarchical.NodeTestTask.prepare(NodeTestTask.java:83) at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:69) at java.util.ArrayList.forEach(ArrayList.java:1257) at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:38) at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$4(NodeTestTask.java:112) at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:72) at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:98) at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:74) at java.util.ArrayList.forEach(ArrayList.java:1257) at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:38) at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$4(NodeTestTask.java:112) at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:72) at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:98) at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:74) at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.submit(SameThreadHierarchicalTestExecutorService.java:32) at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor.execute(HierarchicalTestExecutor.java:57) at org.junit.platform.engine.support.hierarchical.HierarchicalTestEngine.execute(HierarchicalTestEngine.java:51) at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:220) at org.junit.platform.launcher.core.DefaultLauncher.lambda$execute$6(DefaultLauncher.java:188) at org.junit.platform.launcher.core.DefaultLauncher.withInterceptedStreams(DefaultLauncher.java:202) at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:181) at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:128) at com.intellij.junit5.JUnit5IdeaTestRunner.startRunnerWithArgs(JUnit5IdeaTestRunner.java:69) at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47) at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242) at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70) Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'flyway' defined in class path resource [org/springframework/boot/autoconfigure/flyway/FlywayAutoConfiguration$FlywayConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.flywaydb.core.Flyway]: Factory method 'flyway' threw exception; nested exception is java.lang.IllegalStateException: Cannot find migrations location in: [classpath:db/migration] (please add migrations or check your Flyway configuration) at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:627) at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:456) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1305) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1144) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:555) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:515) at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:320) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:318) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:307) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1105) at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:867) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:549) at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:775) at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397) at org.springframework.boot.SpringApplication.run(SpringApplication.java:316) at org.springframework.boot.test.context.SpringBootContextLoader.loadContext(SpringBootContextLoader.java:127) at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContextInternal(DefaultCacheAwareContextLoaderDelegate.java:99) at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.java:117) ... 53 more Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.flywaydb.core.Flyway]: Factory method 'flyway' threw exception; nested exception is java.lang.IllegalStateException: Cannot find migrations location in: [classpath:db/migration] (please add migrations or check your Flyway configuration) at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:185) at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:622) ... 73 more Caused by: java.lang.IllegalStateException: Cannot find migrations location in: [classpath:db/migration] (please add migrations or check your Flyway configuration) at org.springframework.util.Assert.state(Assert.java:94) at org.springframework.boot.autoconfigure.flyway.FlywayAutoConfiguration$FlywayConfiguration.checkLocationExists(FlywayAutoConfiguration.java:191) at org.springframework.boot.autoconfigure.flyway.FlywayAutoConfiguration$FlywayConfiguration.flyway(FlywayAutoConfiguration.java:150) at org.springframework.boot.autoconfigure.flyway.FlywayAutoConfiguration$FlywayConfiguration$$EnhancerBySpringCGLIB$$6691e677.CGLIB$flyway$0(<generated>) at org.springframework.boot.autoconfigure.flyway.FlywayAutoConfiguration$FlywayConfiguration$$EnhancerBySpringCGLIB$$6691e677$$FastClassBySpringCGLIB$$adedd2a7.invoke(<generated>) at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:244) at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:363) at org.springframework.boot.autoconfigure.flyway.FlywayAutoConfiguration$FlywayConfiguration$$EnhancerBySpringCGLIB$$6691e677.flyway(<generated>) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:154) ... 74 more
Hi!
I just came across your project with a hope to be able to bootstrap testing database that can handle ltree
column type as I am using in my real db.
pg_dump has successfully exported the definitions:
CREATE EXTENSION IF NOT EXISTS ltree WITH SCHEMA public;
...
CREATE TABLE public.document (
doc_uuid bigint NOT NULL,
entitystate character varying(255),
okm_path public.ltree,
);
now when I define @FlywayTest(locationsForMigrate = "test/db/migration")
i get:
Caused by: org.postgresql.util.PSQLException: ERROR: type "ltree" does not exist
so can you tell me whether this ltree
should be supported? I was using H2 which I'm not sure about but should be good with postgresql.
Hi,
this is an issue, only if there is no way to achieve what is explained hereinafter. Sorry if this is not the right place to ask, but I didn't know where else to ask.
In my project I use spring data jpa together with a postgres database. In that project I store Java Strings in a jsonb column of the postgres db. This is possible via setting the postgres connection parameter stringtype to the value unspecified. I did this in my spring configuration yaml and everything works fine in combination with my real non-embedded postgres db. But the configuration parameters aren't used when I use your emdedded postgres for integration testing. Is there a way to inject this connection property? I tried some stuff, but yet didn't find the right place.
Thx in advance!
We just upgraded to Spring 2.X and are having an issue using this with the latest version of Flyway. It errors out when creating the flywayInitializer bean:
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:190)
at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47)
at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)
Caused by: java.lang.NoSuchMethodError: org.flywaydb.core.Flyway.isAllowMixedMigrations()Z
at io.zonky.test.db.flyway.FlywayConfigSnapshot.(FlywayConfigSnapshot.java:118)
at io.zonky.test.db.flyway.DefaultFlywayDataSourceContext.createConfigSnapshot(DefaultFlywayDataSourceContext.java:161)
at io.zonky.test.db.flyway.DefaultFlywayDataSourceContext$FlywayDatabasePreparer.(DefaultFlywayDataSourceContext.java:170)
at io.zonky.test.db.flyway.DefaultFlywayDataSourceContext.lambda$reload$0(DefaultFlywayDataSourceContext.java:110)
at java.util.concurrent.CompletableFuture.uniApply(CompletableFuture.java:602)
... 52 common frames omitted
As you can see from the FlywayConfigSnapshot
it is trying to access a method that no longer exists!
Please could you verify?
I fixed it by migrating back to Flyway version 4.1.0: runtime("org.flywaydb:flyway-core:4.1.0")
We are currently upgrading to Spring Boot 2, which uses Flyway 5. It would be great if this tool could support Flyway 5 as well. My workaround of course is to stay on Flyway 4.2.0 but it would be nice to upgrade.
I use your lib for integration test in my backend project. It runs just fine.
I have a Javascript frontend and now I want to run some end-to-end tests. For this my backend project gets packaged and startet with the Spring Boot maven plugin:
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<executable>true</executable>
</configuration>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
<execution>
<id>pre-integration-test</id>
<goals>
<goal>start</goal>
</goals>
<configuration>
<workingDirectory>${project.basedir}</workingDirectory>
<skip>${skipTests}</skip>
<profiles>
<profile>integration</profile>
</profiles>
</configuration>
</execution>
<execution>
<id>post-integration-test</id>
<goals>
<goal>stop</goal>
</goals>
<configuration>
<skip>${skipTests}</skip>
</configuration>
</execution>
</executions>
</plugin>
After my spring-boot backend was started a plugin runs npm tests with Cypress and Chromium against the running backend.
<plugin>
<groupId>com.github.eirslett</groupId>
<artifactId>frontend-maven-plugin</artifactId>
<version>${frontend-maven-plugin.version}</version>
<executions>
<execution>
<id>run e2e tests</id>
<phase>integration-test</phase>
<goals>
<goal>npm</goal>
</goals>
<configuration>
<workingDirectory>../frontend</workingDirectory>
<arguments>run verify</arguments>
</configuration>
</execution>
</executions>
</plugin>
At the moment it uses a pre-configured test database on my developer machine. Everywhere I want to run the end-to-end tests I need to setup a postgresql Database.
I tried to move your lib from scope=test to scope=compile and just add a configuration like this to my main package:
@Configuration
@Profile("integration")
@AutoConfigureEmbeddedDatabase
public class PostgresqlIntegrationDatabase {}
This does not work as the @AutoConfigureEmbeddedDatabase annotation only works with a test class and in a test environment. This configuration just does nothing.
It would be nice to package this lib into the full-fledged JAR and have an embedded database with profile=integration.
This way we can use the same technique for integration and end-to-end testing. Otherwise we need to have a DockerContainer or Postgresql Database running on the machine.
The version of PostgreSQL binaries should be independent on the version of embedded-database-spring-test library.
Something like this:
<dependency>
<groupId>io.zonky.test</groupId>
<artifactId>embedded-database-spring-test</artifactId>
<version>1.3.0</version>
</dependency>
<dependency>
<groupId>io.zonky.test</groupId>
<artifactId>postgres-binaries</artifactId>
<version>9.6.8</version>
</dependency>
Hello,
I'm using embedded-database-spring-test with flyway-spring-test. It works great on my workstation when running the tests in either intellij or the maven command line directly. But when jenkins tries to run the tests I get an IllegalStateException.
I fully expect this is a configuration issue on my part but I'm not sure where to look based on the log output.
Here's the dependencies from my pom:
<dependency>
<groupId>io.zonky.test</groupId>
<artifactId>embedded-database-spring-test</artifactId>
<version>1.4.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.flywaydb.flyway-test-extensions</groupId>
<artifactId>flyway-spring-test</artifactId>
<version>5.2.1</version>
<scope>test</scope>
</dependency>
Here's the error I'm getting from the test when running on jenkins:
11:22:35
11:22:35 . ____ _ __ _ _
11:22:35 /\ / ' __ _ () __ __ _ \ \ \
11:22:35 ( ( )__ | '_ | '| | ' / ` | \ \ \
11:22:35 \/ )| |)| | | | | || (| | ) ) ) )
11:22:35 ' || .__|| ||| |_, | / / / /
11:22:35 =========||==============|/=////
11:22:35 :: Spring Boot :: (v2.1.4.RELEASE)
11:22:35
11:22:35 2019-04-26 18:22:35.118 INFO 18756 --- [ main] .l.RetentionEventListenerIntegrationTest : Starting RetentionEventListenerIntegrationTest on with PID 18756 (started by jenkins in /var/lib/jenkins/workspace/mdh-retention-enforcer)
11:22:35 2019-04-26 18:22:35.118 INFO 18756 --- [ main] .l.RetentionEventListenerIntegrationTest : No active profile set, falling back to default profiles: default
11:22:35 2019-04-26 18:22:35.729 INFO 18756 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data repositories in DEFAULT mode.
11:22:35 2019-04-26 18:22:35.734 INFO 18756 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 5ms. Found 0 repository interfaces.
11:22:35 2019-04-26 18:22:35.800 INFO 18756 --- [ main] EmbeddedPostgresContextCustomizerFactory : Replacing 'dataSource' DataSource bean with embedded version
11:22:36 2019-04-26 18:22:35.969 INFO 18756 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.kafka.annotation.KafkaBootstrapConfiguration' of type [org.springframework.kafka.annotation.KafkaBootstrapConfiguration$$EnhancerBySpringCGLIB$$b0685c37] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
11:22:36 2019-04-26 18:22:36.062 INFO 18756 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration' of type [org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration$$EnhancerBySpringCGLIB$$dcb64ab4] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
11:22:36 2019-04-26 18:22:36.162 ERROR 18756 --- [ main] wayEmbeddedPostgresDataSourceFactoryBean : Unexpected error during the initialization of embedded database
11:22:36
11:22:36 java.util.concurrent.CompletionException: com.google.common.util.concurrent.UncheckedExecutionException: java.lang.IllegalStateException: Process [/tmp/embedded-pg/PG-7010611ea87e721fb4b2e2a8657cce54/bin/initdb, -A, trust, -U, postgres, -D, /tmp/epg3169506516631789369, -E, UTF-8] failed
11:22:36
11:22:36 at io.zonky.test.db.flyway.DefaultFlywayDataSourceContext.lambda$reload$0(DefaultFlywayDataSourceContext.java:113) ~[embedded-database-spring-test-1.4.1.jar:na]
11:22:36 at java.util.concurrent.CompletableFuture.uniApply(CompletableFuture.java:602) ~[na:1.8.0_191]
11:22:36 at java.util.concurrent.CompletableFuture$UniApply.tryFire(CompletableFuture.java:577) ~[na:1.8.0_191]
11:22:36 at java.util.concurrent.CompletableFuture$Completion.run(CompletableFuture.java:442) ~[na:1.8.0_191]
11:22:36 at java.util.concurrent.CompletableFuture$UniCompletion.claim(CompletableFuture.java:529) ~[na:1.8.0_191]
11:22:36 at java.util.concurrent.CompletableFuture.uniApply(CompletableFuture.java:599) ~[na:1.8.0_191]
11:22:36 at java.util.concurrent.CompletableFuture$UniApply.tryFire(CompletableFuture.java:577) ~[na:1.8.0_191]
11:22:36 at java.util.concurrent.CompletableFuture.uniApplyStage(CompletableFuture.java:617) ~[na:1.8.0_191]
11:22:36 at java.util.concurrent.CompletableFuture.thenApplyAsync(CompletableFuture.java:1993) ~[na:1.8.0_191]
11:22:36 at io.zonky.test.db.flyway.DefaultFlywayDataSourceContext.reload(DefaultFlywayDataSourceContext.java:106) ~[embedded-database-spring-test-1.4.1.jar:na]
11:22:36 at io.zonky.test.db.postgres.FlywayEmbeddedPostgresDataSourceFactoryBean.postProcessBeforeInitialization(FlywayEmbeddedPostgresDataSourceFactoryBean.java:89) ~[embedded-database-spring-test-1.4.1.jar:na]
11:22:36 at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:414) ~[spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]
11:22:36 at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1770) ~[spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]
11:22:36 at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:593) ~[spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]
11:22:36 at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:515) ~[spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]
11:22:36 at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:320) ~[spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]
11:22:36 at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) ~[spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]
11:22:36 at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:318) ~[spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]
11:22:36 at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) ~[spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]
11:22:36 at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:307) ~[spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]
11:22:36 at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) ~[spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]
11:22:36 at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1105) ~[spring-context-5.1.6.RELEASE.jar:5.1.6.RELEASE]
11:22:36 at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:867) ~[spring-context-5.1.6.RELEASE.jar:5.1.6.RELEASE]
11:22:36 at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:549) ~[spring-context-5.1.6.RELEASE.jar:5.1.6.RELEASE]
11:22:36 at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:775) ~[spring-boot-2.1.4.RELEASE.jar:2.1.4.RELEASE]
11:22:36 at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397) ~[spring-boot-2.1.4.RELEASE.jar:2.1.4.RELEASE]
11:22:36 at org.springframework.boot.SpringApplication.run(SpringApplication.java:316) ~[spring-boot-2.1.4.RELEASE.jar:2.1.4.RELEASE]
11:22:36 at org.springframework.boot.test.context.SpringBootContextLoader.loadContext(SpringBootContextLoader.java:127) ~[spring-boot-test-2.1.4.RELEASE.jar:2.1.4.RELEASE]
11:22:36 at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContextInternal(DefaultCacheAwareContextLoaderDelegate.java:99) ~[spring-test-5.1.6.RELEASE.jar:5.1.6.RELEASE]
11:22:36 at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.java:117) ~[spring-test-5.1.6.RELEASE.jar:5.1.6.RELEASE]
11:22:36 at org.springframework.test.context.support.DefaultTestContext.getApplicationContext(DefaultTestContext.java:108) ~[spring-test-5.1.6.RELEASE.jar:5.1.6.RELEASE]
11:22:36 at org.springframework.test.context.web.ServletTestExecutionListener.setUpRequestContextIfNecessary(ServletTestExecutionListener.java:190) ~[spring-test-5.1.6.RELEASE.jar:5.1.6.RELEASE]
11:22:36 at org.springframework.test.context.web.ServletTestExecutionListener.prepareTestInstance(ServletTestExecutionListener.java:132) ~[spring-test-5.1.6.RELEASE.jar:5.1.6.RELEASE]
11:22:36 at org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:246) ~[spring-test-5.1.6.RELEASE.jar:5.1.6.RELEASE]
11:22:36 at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.createTest(SpringJUnit4ClassRunner.java:227) ~[spring-test-5.1.6.RELEASE.jar:5.1.6.RELEASE]
11:22:36 at org.springframework.test.context.junit4.SpringJUnit4ClassRunner$1.runReflectiveCall(SpringJUnit4ClassRunner.java:289) ~[spring-test-5.1.6.RELEASE.jar:5.1.6.RELEASE]
11:22:36 at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) ~[junit-4.12.jar:4.12]
11:22:36 at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.methodBlock(SpringJUnit4ClassRunner.java:291) ~[spring-test-5.1.6.RELEASE.jar:5.1.6.RELEASE]
11:22:36 at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:246) ~[spring-test-5.1.6.RELEASE.jar:5.1.6.RELEASE]
11:22:36 at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:97) ~[spring-test-5.1.6.RELEASE.jar:5.1.6.RELEASE]
11:22:36 at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) ~[junit-4.12.jar:4.12]
11:22:36 at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) ~[junit-4.12.jar:4.12]
11:22:36 at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) ~[junit-4.12.jar:4.12]
11:22:36 at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) ~[junit-4.12.jar:4.12]
11:22:36 at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) ~[junit-4.12.jar:4.12]
11:22:36 at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26) ~[junit-4.12.jar:4.12]
11:22:36 at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61) ~[spring-test-5.1.6.RELEASE.jar:5.1.6.RELEASE]
11:22:36 at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27) ~[junit-4.12.jar:4.12]
11:22:36 at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70) ~[spring-test-5.1.6.RELEASE.jar:5.1.6.RELEASE]
11:22:36 at org.junit.rules.ExternalResource$1.evaluate(ExternalResource.java:48) ~[junit-4.12.jar:4.12]
11:22:36 at org.junit.rules.RunRules.evaluate(RunRules.java:20) ~[junit-4.12.jar:4.12]
11:22:36 at org.junit.runners.ParentRunner.run(ParentRunner.java:363) ~[junit-4.12.jar:4.12]
11:22:36 at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:190) ~[spring-test-5.1.6.RELEASE.jar:5.1.6.RELEASE]
11:22:36 at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:365) ~[surefire-junit4-2.22.1.jar:2.22.1]
11:22:36 at org.apache.maven.surefire.junit4.JUnit4Provider.executeWithRerun(JUnit4Provider.java:273) ~[surefire-junit4-2.22.1.jar:2.22.1]
11:22:36 at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:238) ~[surefire-junit4-2.22.1.jar:2.22.1]
11:22:36 at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:159) ~[surefire-junit4-2.22.1.jar:2.22.1]
11:22:36 at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:384) ~[surefire-booter-2.22.1.jar:2.22.1]
11:22:36 at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:345) ~[surefire-booter-2.22.1.jar:2.22.1]
11:22:36 at org.apache.maven.surefire.booter.ForkedBooter.execute(ForkedBooter.java:126) ~[surefire-booter-2.22.1.jar:2.22.1]
11:22:36 at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:418) ~[surefire-booter-2.22.1.jar:2.22.1]
11:22:36 Caused by: com.google.common.util.concurrent.UncheckedExecutionException: java.lang.IllegalStateException: Process [/tmp/embedded-pg/PG-7010611ea87e721fb4b2e2a8657cce54/bin/initdb, -A, trust, -U, postgres, -D, /tmp/epg3169506516631789369, -E, UTF-8] failed
11:22:36
11:22:36 at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2050) ~[guava-27.0.1-jre.jar:na]
11:22:36 at com.google.common.cache.LocalCache.get(LocalCache.java:3952) ~[guava-27.0.1-jre.jar:na]
11:22:36 at com.google.common.cache.LocalCache.getOrLoad(LocalCache.java:3974) ~[guava-27.0.1-jre.jar:na]
11:22:36 at com.google.common.cache.LocalCache$LocalLoadingCache.get(LocalCache.java:4958) ~[guava-27.0.1-jre.jar:na]
11:22:36 at com.google.common.cache.LocalCache$LocalLoadingCache.getUnchecked(LocalCache.java:4964) ~[guava-27.0.1-jre.jar:na]
11:22:36 at io.zonky.test.db.provider.impl.ZonkyPostgresDatabaseProvider.getDatabase(ZonkyPostgresDatabaseProvider.java:92) ~[embedded-database-spring-test-1.4.1.jar:na]
11:22:36 at io.zonky.test.db.provider.impl.PrefetchingDatabaseProvider$PrefetchingTask.lambda$new$0(PrefetchingDatabaseProvider.java:252) ~[embedded-database-spring-test-1.4.1.jar:na]
11:22:36 at java.util.concurrent.FutureTask.run(FutureTask.java:266) ~[na:1.8.0_191]
11:22:36 at io.zonky.test.db.provider.impl.PrefetchingDatabaseProvider$PrefetchingTask.run(PrefetchingDatabaseProvider.java:259) ~[embedded-database-spring-test-1.4.1.jar:na]
11:22:36 at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) ~[na:1.8.0_191]
11:22:36 at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) ~[na:1.8.0_191]
11:22:36 at java.lang.Thread.run(Thread.java:748) ~[na:1.8.0_191]
11:22:36 Caused by: java.lang.IllegalStateException: Process [/tmp/embedded-pg/PG-7010611ea87e721fb4b2e2a8657cce54/bin/initdb, -A, trust, -U, postgres, -D, /tmp/epg3169506516631789369, -E, UTF-8] failed
11:22:36
11:22:36 at io.zonky.test.db.postgres.embedded.EmbeddedPostgres.system(EmbeddedPostgres.java:624) ~[embedded-postgres-1.2.3.jar:na]
11:22:36 at io.zonky.test.db.postgres.embedded.EmbeddedPostgres.initdb(EmbeddedPostgres.java:243) ~[embedded-postgres-1.2.3.jar:na]
11:22:36 at io.zonky.test.db.postgres.embedded.EmbeddedPostgres.(EmbeddedPostgres.java:156) ~[embedded-postgres-1.2.3.jar:na]
11:22:36 at io.zonky.test.db.postgres.embedded.EmbeddedPostgres$Builder.start(EmbeddedPostgres.java:577) ~[embedded-postgres-1.2.3.jar:na]
11:22:36 at io.zonky.test.db.provider.impl.ZonkyPostgresDatabaseProvider$DatabaseInstance.(ZonkyPostgresDatabaseProvider.java:127) ~[embedded-database-spring-test-1.4.1.jar:na]
11:22:36 at io.zonky.test.db.provider.impl.ZonkyPostgresDatabaseProvider$DatabaseInstance.(ZonkyPostgresDatabaseProvider.java:111) ~[embedded-database-spring-test-1.4.1.jar:na]
11:22:36 at io.zonky.test.db.provider.impl.ZonkyPostgresDatabaseProvider$1.load(ZonkyPostgresDatabaseProvider.java:59) ~[embedded-database-spring-test-1.4.1.jar:na]
11:22:36 at io.zonky.test.db.provider.impl.ZonkyPostgresDatabaseProvider$1.load(ZonkyPostgresDatabaseProvider.java:57) ~[embedded-database-spring-test-1.4.1.jar:na]
11:22:36 at com.google.common.cache.LocalCache$LoadingValueReference.loadFuture(LocalCache.java:3528) ~[guava-27.0.1-jre.jar:na]
11:22:36 at com.google.common.cache.LocalCache$Segment.loadSync(LocalCache.java:2277) ~[guava-27.0.1-jre.jar:na]
11:22:36 at com.google.common.cache.LocalCache$Segment.lockedGetOrLoad(LocalCache.java:2154) ~[guava-27.0.1-jre.jar:na]
11:22:36 at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2044) ~[guava-27.0.1-jre.jar:na]
11:22:36 ... 11 common frames omitted
11:22:36
11:22:36 2019-04-26 18:22:36.187 DEBUG 18756 --- [ main] org.flywaydb.core.Flyway : Memory usage: 209 of 636M
11:22:36 2019-04-26 18:22:36.187 WARN 18756 --- [ main] o.s.w.c.s.GenericWebApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'flywayInitializer' defined in class path resource [org/springframework/boot/autoconfigure/flyway/FlywayAutoConfiguration$FlywayConfiguration.class]: Invocation of init method failed; nested exception is java.lang.IllegalStateException: Unexpected error occurred while initializing the data source
11:22:36 2019-04-26 18:22:36.206 INFO 18756 --- [itdb:pid(18894)] i.z.t.d.p.embedded.EmbeddedPostgres : The files belonging to this database system will be owned by user "jenkins".
11:22:36 2019-04-26 18:22:36.207 INFO 18756 --- [itdb:pid(18894)] i.z.t.d.p.embedded.EmbeddedPostgres : This user must also own the server process.
11:22:36 2019-04-26 18:22:36.211 INFO 18756 --- [ main] ConditionEvaluationReportLoggingListener :
11:22:36
11:22:36 Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
11:22:36 2019-04-26 18:22:36.214 ERROR 18756 --- [ main] o.s.boot.SpringApplication : Application run failed
11:22:36
11:22:36 org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'flywayInitializer' defined in class path resource [org/springframework/boot/autoconfigure/flyway/FlywayAutoConfiguration$FlywayConfiguration.class]: Invocation of init method failed; nested exception is java.lang.IllegalStateException: Unexpected error occurred while initializing the data source
11:22:36 at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1778) ~[spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]
11:22:36 at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:593) ~[spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]
11:22:36 at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:515) ~[spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]
11:22:36 at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:320) ~[spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]
11:22:36 at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) ~[spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]
11:22:36 at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:318) ~[spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]
11:22:36 at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) ~[spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]
11:22:36 at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:307) ~[spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]
11:22:36 at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) ~[spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]
11:22:36 at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1105) ~[spring-context-5.1.6.RELEASE.jar:5.1.6.RELEASE]
11:22:36 at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:867) ~[spring-context-5.1.6.RELEASE.jar:5.1.6.RELEASE]
11:22:36 at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:549) ~[spring-context-5.1.6.RELEASE.jar:5.1.6.RELEASE]
11:22:36 at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:775) ~[spring-boot-2.1.4.RELEASE.jar:2.1.4.RELEASE]
11:22:36 at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397) ~[spring-boot-2.1.4.RELEASE.jar:2.1.4.RELEASE]
11:22:36 at org.springframework.boot.SpringApplication.run(SpringApplication.java:316) ~[spring-boot-2.1.4.RELEASE.jar:2.1.4.RELEASE]
11:22:36 at org.springframework.boot.test.context.SpringBootContextLoader.loadContext(SpringBootContextLoader.java:127) [spring-boot-test-2.1.4.RELEASE.jar:2.1.4.RELEASE]
11:22:36 at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContextInternal(DefaultCacheAwareContextLoaderDelegate.java:99) [spring-test-5.1.6.RELEASE.jar:5.1.6.RELEASE]
11:22:36 at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.java:117) [spring-test-5.1.6.RELEASE.jar:5.1.6.RELEASE]
11:22:36 at org.springframework.test.context.support.DefaultTestContext.getApplicationContext(DefaultTestContext.java:108) [spring-test-5.1.6.RELEASE.jar:5.1.6.RELEASE]
11:22:36 at org.springframework.test.context.web.ServletTestExecutionListener.setUpRequestContextIfNecessary(ServletTestExecutionListener.java:190) [spring-test-5.1.6.RELEASE.jar:5.1.6.RELEASE]
11:22:36 at org.springframework.test.context.web.ServletTestExecutionListener.prepareTestInstance(ServletTestExecutionListener.java:132) [spring-test-5.1.6.RELEASE.jar:5.1.6.RELEASE]
11:22:36 at org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:246) [spring-test-5.1.6.RELEASE.jar:5.1.6.RELEASE]
11:22:36 at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.createTest(SpringJUnit4ClassRunner.java:227) [spring-test-5.1.6.RELEASE.jar:5.1.6.RELEASE]
11:22:36 at org.springframework.test.context.junit4.SpringJUnit4ClassRunner$1.runReflectiveCall(SpringJUnit4ClassRunner.java:289) [spring-test-5.1.6.RELEASE.jar:5.1.6.RELEASE]
11:22:36 at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) [junit-4.12.jar:4.12]
11:22:36 at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.methodBlock(SpringJUnit4ClassRunner.java:291) [spring-test-5.1.6.RELEASE.jar:5.1.6.RELEASE]
11:22:36 at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:246) [spring-test-5.1.6.RELEASE.jar:5.1.6.RELEASE]
11:22:36 at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:97) [spring-test-5.1.6.RELEASE.jar:5.1.6.RELEASE]
11:22:36 at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) [junit-4.12.jar:4.12]
11:22:36 at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) [junit-4.12.jar:4.12]
11:22:36 at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) [junit-4.12.jar:4.12]
11:22:36 at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) [junit-4.12.jar:4.12]
11:22:36 at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) [junit-4.12.jar:4.12]
11:22:36 at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26) [junit-4.12.jar:4.12]
11:22:36 at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61) [spring-test-5.1.6.RELEASE.jar:5.1.6.RELEASE]
11:22:36 at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27) [junit-4.12.jar:4.12]
11:22:36 at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70) [spring-test-5.1.6.RELEASE.jar:5.1.6.RELEASE]
11:22:36 at org.junit.rules.ExternalResource$1.evaluate(ExternalResource.java:48) [junit-4.12.jar:4.12]
11:22:36 at org.junit.rules.RunRules.evaluate(RunRules.java:20) [junit-4.12.jar:4.12]
11:22:36 at org.junit.runners.ParentRunner.run(ParentRunner.java:363) [junit-4.12.jar:4.12]
11:22:36 at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:190) [spring-test-5.1.6.RELEASE.jar:5.1.6.RELEASE]
11:22:36 at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:365) [surefire-junit4-2.22.1.jar:2.22.1]
11:22:36 at org.apache.maven.surefire.junit4.JUnit4Provider.executeWithRerun(JUnit4Provider.java:273) [surefire-junit4-2.22.1.jar:2.22.1]
11:22:36 at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:238) [surefire-junit4-2.22.1.jar:2.22.1]
11:22:36 at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:159) [surefire-junit4-2.22.1.jar:2.22.1]
11:22:36 at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:384) [surefire-booter-2.22.1.jar:2.22.1]
11:22:36 at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:345) [surefire-booter-2.22.1.jar:2.22.1]
11:22:36 at org.apache.maven.surefire.booter.ForkedBooter.execute(ForkedBooter.java:126) [surefire-booter-2.22.1.jar:2.22.1]
11:22:36 at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:418) [surefire-booter-2.22.1.jar:2.22.1]
11:22:36 Caused by: java.lang.IllegalStateException: Unexpected error occurred while initializing the data source
11:22:36 at com.google.common.base.Preconditions.checkState(Preconditions.java:507) ~[guava-27.0.1-jre.jar:na]
11:22:36 at io.zonky.test.db.flyway.DefaultFlywayDataSourceContext.getTarget(DefaultFlywayDataSourceContext.java:88) ~[embedded-database-spring-test-1.4.1.jar:na]
11:22:36 at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:193) ~[spring-aop-5.1.6.RELEASE.jar:5.1.6.RELEASE]
11:22:36 at com.sun.proxy.$Proxy85.getConnection(Unknown Source) ~[na:na]
11:22:36 at org.flywaydb.core.internal.jdbc.JdbcUtils.openConnection(JdbcUtils.java:56) ~[flyway-core-5.2.4.jar:na]
11:22:36 at org.flywaydb.core.internal.database.DatabaseFactory.createDatabase(DatabaseFactory.java:72) ~[flyway-core-5.2.4.jar:na]
11:22:36 at org.flywaydb.core.Flyway.execute(Flyway.java:1670) ~[flyway-core-5.2.4.jar:na]
11:22:36 at org.flywaydb.core.Flyway.migrate(Flyway.java:1356) ~[flyway-core-5.2.4.jar:na]
11:22:36 at org.springframework.boot.autoconfigure.flyway.FlywayMigrationInitializer.afterPropertiesSet(FlywayMigrationInitializer.java:66) ~[spring-boot-autoconfigure-2.1.4.RELEASE.jar:2.1.4.RELEASE]
11:22:36 at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1837) ~[spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]
11:22:36 at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1774) ~[spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]
11:22:36 ... 48 common frames omitted
11:22:36
11:22:36 2019-04-26 18:22:36.215 ERROR 18756 --- [ main] o.s.test.context.TestContextManager : Caught exception while allowing TestExecutionListener [org.springframework.test.context.web.ServletTestExecutionListener@101cf747] to prepare test instance [com.marchex.datahub.listeners.RetentionEventListenerIntegrationTest@3e5c7588]
11:22:36
11:22:36 java.lang.IllegalStateException: Failed to load ApplicationContext
11:22:36 at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.java:125) ~[spring-test-5.1.6.RELEASE.jar:5.1.6.RELEASE]
11:22:36 at org.springframework.test.context.support.DefaultTestContext.getApplicationContext(DefaultTestContext.java:108) ~[spring-test-5.1.6.RELEASE.jar:5.1.6.RELEASE]
11:22:36 at org.springframework.test.context.web.ServletTestExecutionListener.setUpRequestContextIfNecessary(ServletTestExecutionListener.java:190) ~[spring-test-5.1.6.RELEASE.jar:5.1.6.RELEASE]
11:22:36 at org.springframework.test.context.web.ServletTestExecutionListener.prepareTestInstance(ServletTestExecutionListener.java:132) ~[spring-test-5.1.6.RELEASE.jar:5.1.6.RELEASE]
11:22:36 at org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:246) ~[spring-test-5.1.6.RELEASE.jar:5.1.6.RELEASE]
11:22:36 at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.createTest(SpringJUnit4ClassRunner.java:227) [spring-test-5.1.6.RELEASE.jar:5.1.6.RELEASE]
11:22:36 at org.springframework.test.context.junit4.SpringJUnit4ClassRunner$1.runReflectiveCall(SpringJUnit4ClassRunner.java:289) [spring-test-5.1.6.RELEASE.jar:5.1.6.RELEASE]
11:22:36 at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) [junit-4.12.jar:4.12]
11:22:36 at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.methodBlock(SpringJUnit4ClassRunner.java:291) [spring-test-5.1.6.RELEASE.jar:5.1.6.RELEASE]
11:22:36 at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:246) [spring-test-5.1.6.RELEASE.jar:5.1.6.RELEASE]
11:22:36 at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:97) [spring-test-5.1.6.RELEASE.jar:5.1.6.RELEASE]
11:22:36 at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) [junit-4.12.jar:4.12]
11:22:36 at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) [junit-4.12.jar:4.12]
11:22:36 at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) [junit-4.12.jar:4.12]
11:22:36 at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) [junit-4.12.jar:4.12]
11:22:36 at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) [junit-4.12.jar:4.12]
11:22:36 at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26) [junit-4.12.jar:4.12]
11:22:36 at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61) [spring-test-5.1.6.RELEASE.jar:5.1.6.RELEASE]
11:22:36 at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27) [junit-4.12.jar:4.12]
11:22:36 at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70) [spring-test-5.1.6.RELEASE.jar:5.1.6.RELEASE]
11:22:36 at org.junit.rules.ExternalResource$1.evaluate(ExternalResource.java:48) [junit-4.12.jar:4.12]
11:22:36 at org.junit.rules.RunRules.evaluate(RunRules.java:20) [junit-4.12.jar:4.12]
11:22:36 at org.junit.runners.ParentRunner.run(ParentRunner.java:363) [junit-4.12.jar:4.12]
11:22:36 at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:190) [spring-test-5.1.6.RELEASE.jar:5.1.6.RELEASE]
11:22:36 at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:365) [surefire-junit4-2.22.1.jar:2.22.1]
11:22:36 at org.apache.maven.surefire.junit4.JUnit4Provider.executeWithRerun(JUnit4Provider.java:273) [surefire-junit4-2.22.1.jar:2.22.1]
11:22:36 at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:238) [surefire-junit4-2.22.1.jar:2.22.1]
11:22:36 at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:159) [surefire-junit4-2.22.1.jar:2.22.1]
11:22:36 at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:384) [surefire-booter-2.22.1.jar:2.22.1]
11:22:36 at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:345) [surefire-booter-2.22.1.jar:2.22.1]
11:22:36 at org.apache.maven.surefire.booter.ForkedBooter.execute(ForkedBooter.java:126) [surefire-booter-2.22.1.jar:2.22.1]
11:22:36 at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:418) [surefire-booter-2.22.1.jar:2.22.1]
11:22:36 Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'flywayInitializer' defined in class path resource [org/springframework/boot/autoconfigure/flyway/FlywayAutoConfiguration$FlywayConfiguration.class]: Invocation of init method failed; nested exception is java.lang.IllegalStateException: Unexpected error occurred while initializing the data source
11:22:36 at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1778) ~[spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]
11:22:36 at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:593) ~[spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]
11:22:36 at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:515) ~[spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]
11:22:36 at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:320) ~[spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]
11:22:36 at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) ~[spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]
11:22:36 at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:318) ~[spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]
11:22:36 at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) ~[spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]
11:22:36 at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:307) ~[spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]
11:22:36 at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) ~[spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]
11:22:36 at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1105) ~[spring-context-5.1.6.RELEASE.jar:5.1.6.RELEASE]
11:22:36 at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:867) ~[spring-context-5.1.6.RELEASE.jar:5.1.6.RELEASE]
11:22:36 at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:549) ~[spring-context-5.1.6.RELEASE.jar:5.1.6.RELEASE]
11:22:36 at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:775) ~[spring-boot-2.1.4.RELEASE.jar:2.1.4.RELEASE]
11:22:36 at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397) ~[spring-boot-2.1.4.RELEASE.jar:2.1.4.RELEASE]
11:22:36 at org.springframework.boot.SpringApplication.run(SpringApplication.java:316) ~[spring-boot-2.1.4.RELEASE.jar:2.1.4.RELEASE]
11:22:36 at org.springframework.boot.test.context.SpringBootContextLoader.loadContext(SpringBootContextLoader.java:127) ~[spring-boot-test-2.1.4.RELEASE.jar:2.1.4.RELEASE]
11:22:36 at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContextInternal(DefaultCacheAwareContextLoaderDelegate.java:99) ~[spring-test-5.1.6.RELEASE.jar:5.1.6.RELEASE]
11:22:36 at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.java:117) ~[spring-test-5.1.6.RELEASE.jar:5.1.6.RELEASE]
11:22:36 ... 31 common frames omitted
11:22:36 Caused by: java.lang.IllegalStateException: Unexpected error occurred while initializing the data source
11:22:36 at com.google.common.base.Preconditions.checkState(Preconditions.java:507) ~[guava-27.0.1-jre.jar:na]
11:22:36 at io.zonky.test.db.flyway.DefaultFlywayDataSourceContext.getTarget(DefaultFlywayDataSourceContext.java:88) ~[embedded-database-spring-test-1.4.1.jar:na]
11:22:36 at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:193) ~[spring-aop-5.1.6.RELEASE.jar:5.1.6.RELEASE]
11:22:36 at com.sun.proxy.$Proxy85.getConnection(Unknown Source) ~[na:na]
11:22:36 at org.flywaydb.core.internal.jdbc.JdbcUtils.openConnection(JdbcUtils.java:56) ~[flyway-core-5.2.4.jar:na]
11:22:36 at org.flywaydb.core.internal.database.DatabaseFactory.createDatabase(DatabaseFactory.java:72) ~[flyway-core-5.2.4.jar:na]
11:22:36 at org.flywaydb.core.Flyway.execute(Flyway.java:1670) ~[flyway-core-5.2.4.jar:na]
11:22:36 at org.flywaydb.core.Flyway.migrate(Flyway.java:1356) ~[flyway-core-5.2.4.jar:na]
11:22:36 at org.springframework.boot.autoconfigure.flyway.FlywayMigrationInitializer.afterPropertiesSet(FlywayMigrationInitializer.java:66) ~[spring-boot-autoconfigure-2.1.4.RELEASE.jar:2.1.4.RELEASE]
11:22:36 at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1837) ~[spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]
11:22:36 at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1774) ~[spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]
11:22:36 ... 48 common frames omitted
11:22:36
Thanks for taking a look!
Jane
Hello! The problem from the topic will help to investigate an error among testing data. Now I need to stop test on a breakpoint and find database port and after that explore data on a database. It not convenient to do it every time.
I want to see some property in @AutoConfigureEmbeddedDatabase
to define do I want to dump data after a failure. And if yes when I want to dump data: after first or any test failure
Getting Error when starting with @AutoConfigureEmbeddedDatabase and
@flywaytest( locationsForMigrate = "./db/migration" )
I dont know why that happens, but it happens when i try to use embedded postgres.
Stacktracke:
java.util.concurrent.CompletionException: java.lang.NoSuchMethodError: com.google.common.base.Stopwatch.createStarted()Lcom/google/common/base/Stopwatch; at java.base/java.util.concurrent.CompletableFuture.encodeThrowable(CompletableFuture.java:314) ~[na:na] at java.base/java.util.concurrent.CompletableFuture.completeThrowable(CompletableFuture.java:319) ~[na:na] at java.base/java.util.concurrent.CompletableFuture$UniApply.tryFire(CompletableFuture.java:645) ~[na:na] at java.base/java.util.concurrent.CompletableFuture$Completion.run(CompletableFuture.java:478) ~[na:na] at java.base/java.util.concurrent.CompletableFuture.uniApplyNow(CompletableFuture.java:677) ~[na:na] at java.base/java.util.concurrent.CompletableFuture.uniApplyStage(CompletableFuture.java:658) ~[na:na] at java.base/java.util.concurrent.CompletableFuture.thenApplyAsync(CompletableFuture.java:2104) ~[na:na] at io.zonky.test.db.flyway.DefaultFlywayDataSourceContext.reload(DefaultFlywayDataSourceContext.java:106) ~[embedded-database-spring-test-1.4.1.jar:na] at io.zonky.test.db.postgres.FlywayEmbeddedPostgresDataSourceFactoryBean.postProcessBeforeInitialization(FlywayEmbeddedPostgresDataSourceFactoryBean.java:89) ~[embedded-database-spring-test-1.4.1.jar:na] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:414) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1754) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:593) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:515) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:320) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE] at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:318) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:307) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE] at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1105) ~[spring-context-5.1.5.RELEASE.jar:5.1.5.RELEASE] at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:867) ~[spring-context-5.1.5.RELEASE.jar:5.1.5.RELEASE] at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:549) ~[spring-context-5.1.5.RELEASE.jar:5.1.5.RELEASE] at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:775) ~[spring-boot-2.1.3.RELEASE.jar:2.1.3.RELEASE] at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397) ~[spring-boot-2.1.3.RELEASE.jar:2.1.3.RELEASE] at org.springframework.boot.SpringApplication.run(SpringApplication.java:316) ~[spring-boot-2.1.3.RELEASE.jar:2.1.3.RELEASE] at org.springframework.boot.test.context.SpringBootContextLoader.loadContext(SpringBootContextLoader.java:127) ~[spring-boot-test-2.1.3.RELEASE.jar:2.1.3.RELEASE] at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContextInternal(DefaultCacheAwareContextLoaderDelegate.java:99) ~[spring-test-5.1.5.RELEASE.jar:5.1.5.RELEASE] at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.java:117) ~[spring-test-5.1.5.RELEASE.jar:5.1.5.RELEASE] at org.springframework.test.context.support.DefaultTestContext.getApplicationContext(DefaultTestContext.java:108) ~[spring-test-5.1.5.RELEASE.jar:5.1.5.RELEASE] at org.springframework.test.context.web.ServletTestExecutionListener.setUpRequestContextIfNecessary(ServletTestExecutionListener.java:190) ~[spring-test-5.1.5.RELEASE.jar:5.1.5.RELEASE] at org.springframework.test.context.web.ServletTestExecutionListener.prepareTestInstance(ServletTestExecutionListener.java:132) ~[spring-test-5.1.5.RELEASE.jar:5.1.5.RELEASE] at org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:246) ~[spring-test-5.1.5.RELEASE.jar:5.1.5.RELEASE] at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.createTest(SpringJUnit4ClassRunner.java:227) ~[spring-test-5.1.5.RELEASE.jar:5.1.5.RELEASE] at org.springframework.test.context.junit4.SpringJUnit4ClassRunner$1.runReflectiveCall(SpringJUnit4ClassRunner.java:289) ~[spring-test-5.1.5.RELEASE.jar:5.1.5.RELEASE] at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) ~[junit-4.12.jar:4.12] at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.methodBlock(SpringJUnit4ClassRunner.java:291) ~[spring-test-5.1.5.RELEASE.jar:5.1.5.RELEASE] at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:246) ~[spring-test-5.1.5.RELEASE.jar:5.1.5.RELEASE] at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:97) ~[spring-test-5.1.5.RELEASE.jar:5.1.5.RELEASE] at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) ~[junit-4.12.jar:4.12] at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) ~[junit-4.12.jar:4.12] at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) ~[junit-4.12.jar:4.12] at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) ~[junit-4.12.jar:4.12] at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) ~[junit-4.12.jar:4.12] at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61) ~[spring-test-5.1.5.RELEASE.jar:5.1.5.RELEASE] at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70) ~[spring-test-5.1.5.RELEASE.jar:5.1.5.RELEASE] at org.junit.runners.ParentRunner.run(ParentRunner.java:363) ~[junit-4.12.jar:4.12] at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:190) ~[spring-test-5.1.5.RELEASE.jar:5.1.5.RELEASE] at org.junit.runner.JUnitCore.run(JUnitCore.java:137) ~[junit-4.12.jar:4.12] at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68) ~[junit-rt.jar:na] at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47) ~[junit-rt.jar:na] at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242) ~[junit-rt.jar:na] at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70) ~[junit-rt.jar:na] Caused by: java.lang.NoSuchMethodError: com.google.common.base.Stopwatch.createStarted()Lcom/google/common/base/Stopwatch; at io.zonky.test.db.provider.impl.PrefetchingDatabaseProvider.getDatabase(PrefetchingDatabaseProvider.java:92) ~[embedded-database-spring-test-1.4.1.jar:na] at io.zonky.test.db.flyway.DefaultFlywayDataSourceContext.lambda$reload$0(DefaultFlywayDataSourceContext.java:110) ~[embedded-database-spring-test-1.4.1.jar:na] at java.base/java.util.concurrent.CompletableFuture$UniApply.tryFire(CompletableFuture.java:642) ~[na:na] ... 49 common frames omitted
Steps to reproduce
Write a few tests that modifies the content of the database, or have a BeforeEach that inserts data. Do not write any manual cleanup scripts (those should not be needed, they should be default).
What happens
The state leaks from the tests influencing other tests
What I expected
The database is cleared and re-initialized after each test
Reason
Testing 101, all tests should be independent, thus database state must never! leak between tests.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.