forked from liquibase/liquibase
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
stop database containers when spock execution ends (liquibase#2843)
The existing integration test framework was configured to stop TestSystem's when the cleanup: method was called. Spock internally called this method when it finished executing all of the tests in a class. Thus, when a particular test class was completed, its TestSystem was stopped, which in some cases was premature, since other classes might use the same TestSystem. Instead, the TestSystem's should be stopped when Spock finishes executing all of the tests in all classes.
- Loading branch information
1 parent
8d3abcd
commit d2bea1a
Showing
3 changed files
with
32 additions
and
13 deletions.
There are no files selected for viewing
28 changes: 28 additions & 0 deletions
28
.../src/main/java/liquibase/extension/testing/testsystem/spock/LiquibaseGlobalExtension.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package liquibase.extension.testing.testsystem.spock; | ||
|
||
import liquibase.extension.testing.testsystem.TestSystem; | ||
import org.spockframework.runtime.extension.IGlobalExtension; | ||
import org.spockframework.runtime.model.SpecInfo; | ||
|
||
public class LiquibaseGlobalExtension implements IGlobalExtension { | ||
@Override | ||
public void start() { | ||
|
||
} | ||
|
||
@Override | ||
public void visitSpec(SpecInfo spec) { | ||
|
||
} | ||
|
||
@Override | ||
public void stop() { | ||
for (TestSystem startedTestSystem : LiquibaseIntegrationMethodInterceptor.startedTestSystems) { | ||
try { | ||
startedTestSystem.stop(); | ||
} catch (Exception e) { | ||
e.printStackTrace(); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
...rc/main/resources/META-INF/services/org.spockframework.runtime.extension.IGlobalExtension
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
liquibase.extension.testing.testsystem.spock.LiquibaseGlobalExtension |