I'm using SpringBoot
and Flyway
in my current project,
At the time of test execution (./gradlew test
because Gradle
is used in this project),
There was a phenomenon that Migrate
of Flyway
ran.
It will be one of the solutions at that time.
It may be obvious to those who know it,
SpringBoot
changes the priority of the configuration file when the test is executed.
Specifically, assuming that the configuration is as follows
/project
├── build.gradle
├── gradlew
└── src
├── main
│ ├── com
│ │ └── ...
│ └── resources
│ └── application.yml
└── test
├── com
│ └── ...
└── resources
└── application.yml
If you execute it with a jar file etc., it will read src/main/resources/application.yml
, but
When the test is executed, it reads src/test/resources/application.yml
.
Please refer to the following article for more details on this area. Spring Boot --Change DB to read during test
Using the above characteristics, in the setting file (setting file at the time of testing) on the src/test/resources/application.yml
side,
Added the following description to disable Flyway.
spring:
flyway:
enabled: false
It's nothing for those who know it, but for those who don't know it, it's a bit of a addictive point. Therefore, I wrote the article as a memorandum.
It ’s short, but that ’s it. Thank you very much.
Recommended Posts