flyway-test-extensions
flyway-test-extensions copied to clipboard
locationsForMigrate with missing location does not fail
When using the locationsForMigrate
directive, if any of the supplied locations are missing (i.e. the specified folder doesn't exist) then the tests are run with no complaint. I would expect the test to fail in this instance and report that the specified migrations could not be run.
The Test extensions used the Flyway location feature. This feature will not fail if a missing location is passed to it.
The currently behaviour will not change, because this change will possible break old test.
One solution can be that the @Flyway get a flag 'failOnMissingLocations' with a default 'false'. If 'true' will set a missing location will break the test!
The current Flyway implementation for the location scanning support not a enhancement or a notification support, so I see no possibility to get the information about location that not exist.
A detection can only be done by a own implementation. Such a implementation contains the possibility about wrong error detection - detect error for correct location or detect no error for missing location, because it do not use the real Flyway implementation. (See https://github.com/flyway/flyway/blob/master/flyway-core/src/main/java/org/flywaydb/core/internal/scanner/filesystem/FileSystemScanner.java or https://github.com/flyway/flyway/blob/master/flyway-core/src/main/java/org/flywaydb/core/internal/scanner/classpath/ClassPathScanner.java)
Currently I will postpone this feature
If this is Flyway's behaviour, you should certainly stick with their approach. While this behaviour was unexpected to me, I think it would be worse to start doing things differently. Emulating the parent system as closely as possible should be the goal.
It might be worth updating the documentation so it's clear what will happen.
Flyway 7.9.0 included a flag to allow fail-fast behavior in case of missing locations flyway.failOnMissingLocations https://github.com/flyway/flyway/issues/2205