flyway-test-extensions icon indicating copy to clipboard operation
flyway-test-extensions copied to clipboard

locationsForMigrate with missing location does not fail

Open squaregoldfish opened this issue 6 years ago • 4 comments

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.

squaregoldfish avatar Feb 20 '19 13:02 squaregoldfish

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!

FlorianGWE avatar Apr 01 '19 07:04 FlorianGWE

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

FlorianGWE avatar May 05 '19 20:05 FlorianGWE

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.

squaregoldfish avatar May 06 '19 13:05 squaregoldfish

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

lrozenblyum avatar Jun 01 '21 06:06 lrozenblyum