1

I have a spring boot web app with both unit tests and IT tests. The application also has a DAL, and I have unit tests in the DAL layer that use an in memory H2 database for tests. The h2 database is created using the same liquibase changelog as my production environment.

The changelogs are packaged in a jar and referenced in my DAL test by adding this to my application.yml file:

liquibase:
  change-log: classpath:src/changeLogs/db-changelog-master.xml

This works fine in my DAL project but not in my web project. In my web project I get this error:

Cannot find changelog location: class path resource [src/changeLogs/db-changelog-master.xml] 

The test that fails to find the changelog is a Spring Boot IT test. The class under test is a Spring Controller. The test is annotated like this:

@RunWith(SpringRunner.class)
@SpringBootTest
@ActiveProfiles({"IT","development"})

Any ideas what is happening here? Thanks.

SME
  • 489
  • 1
  • 10
  • 21
  • What happens if you switch from `classpath:` to `classpath*:` for the location of the change-log? – Sam Brannen Apr 28 '18 at 12:29
  • Hi Sam, I tried that but I get the same error message. – SME Apr 28 '18 at 15:43
  • Is the path within the classpath truly `src/changeLogs/db-changelog-master.xml`? Wouldn't it rather be simply `/db-changelog-master.xml` (assuming your build or IDE includes `./src/changeLogs/` in the classpath)? – Sam Brannen May 09 '18 at 09:56

0 Answers0