spring - Integration Testing with Flyway -
i'm using flyway handle database migration. working fine: default location of migration files is:
main/resource/db/migration/v1...
i running integration tests , setup uses separate database schema integration, manage flyway well. integration tests, though, located in test
folder (not main
). when flyway bean executes migrate()
, doesn't find migration files because in main
folder. if put migration files in test/resource/db/migration/v1...
works.
i don't want have copy these file test
resource folder, don't have maintain both. there way force flyway use same migration files integration test normal app?
i assume you're using maven? unit tests both test/resources
, main/resources
loaded classpath. test/resources
files take precedence, placed higher in classpath - if recall correctly. regardless, don't recommend this.
instead recommend make entirely different flyway configuration integration testing in separate directory (ie test/resources/integration/migration/
) , runs after main/resources/db/migration
default one.
even might easier not use flyway setup integration data fixtures , instead use other database data loading tools dbunit (i'm sure there others).
Comments
Post a Comment