-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[DAT-12910]/[DAT-19440]/[DAT-19439] DiffTests changes (#982)
* DAT-12910 refactored data for Diff tests/Added additional assertion (check objects folder) * DAT-12910 small test fixes, (removed createPackage/createPackageBody PostgreSQL, MariaDB, MySQL, and SQL Server (MSSQL) do not have a direct CREATE PACKAGE) * DAT-12910 changed config to diff/diffChangelog * DAT-12910 changed create-infra.sh
- Loading branch information
1 parent
6ea55d4
commit 7d81e3b
Showing
35 changed files
with
1,307 additions
and
1,149 deletions.
There are no files selected for viewing
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
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
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
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,65 @@ | ||
package liquibase.harness.diff | ||
|
||
import com.datical.liquibase.ext.config.LiquibaseProConfiguration | ||
import liquibase.database.jvm.JdbcConnection | ||
import liquibase.harness.config.DatabaseUnderTest | ||
import liquibase.harness.config.TestConfig | ||
import liquibase.harness.util.rollback.RollbackStrategy | ||
import spock.lang.Shared | ||
import spock.lang.Specification | ||
import spock.lang.Unroll | ||
|
||
import static liquibase.harness.diff.DiffCommandTestHelper.* | ||
import static liquibase.harness.util.TestUtils.* | ||
import static liquibase.harness.util.FileUtils.* | ||
|
||
class DiffTests extends Specification { | ||
@Shared | ||
RollbackStrategy strategy | ||
@Shared | ||
List<DatabaseUnderTest> databases | ||
|
||
def setupSpec() { | ||
databases = TestConfig.instance.getFilteredDatabasesUnderTest() | ||
strategy = chooseRollbackStrategy() | ||
strategy.prepareForRollback(databases) | ||
} | ||
|
||
@Unroll | ||
def "apply diff test against #testInput.referenceDatabase.name #testInput.referenceDatabase.version to targetDatabase #testInput.targetDatabase.name #testInput.targetDatabase.version"() { | ||
given: "read input data for diff test" | ||
Map<String, Object> argsMap = new HashMap() | ||
argsMap.put("url", testInput.targetDatabase.url) | ||
argsMap.put("username", testInput.targetDatabase.username) | ||
argsMap.put("password", testInput.targetDatabase.password) | ||
argsMap.put("referenceUrl", testInput.referenceDatabase.url) | ||
argsMap.put("referenceUsername", testInput.referenceDatabase.username) | ||
argsMap.put("referencePassword", testInput.referenceDatabase.password) | ||
argsMap.put("changelogFile", testInput.pathToChangelogFile) | ||
|
||
and: "check databases are online" | ||
assert testInput.targetDatabase.database.getConnection() instanceof JdbcConnection: "Target database " + | ||
"${testInput.targetDatabase.name}${testInput.targetDatabase.version} is offline!" | ||
assert testInput.referenceDatabase.database.getConnection() instanceof JdbcConnection: "Reference database " + | ||
"${testInput.referenceDatabase.name}${testInput.referenceDatabase.version} is offline!" | ||
|
||
when: "execute update and diff commands" | ||
|
||
executeCommandScope("update", argsMap) | ||
argsMap.put("excludeObjects", "(?i)posts, (?i)authors, (?i)databasechangelog, (?i)databasechangeloglock") | ||
String generatedDiffContent = removeDatabaseInfoFromDiff(executeCommandScope("diff", argsMap).toString()) | ||
|
||
then: "validate generated diff" | ||
String expectedDiffContent = removeDatabaseInfoFromDiff(getResourceContent(testInput.pathToExpectedDiffFile)) | ||
assert expectedDiffContent == generatedDiffContent | ||
|
||
cleanup: "rollback changes" | ||
strategy.performRollback(argsMap) | ||
|
||
where: | ||
testInput << buildTestInput() | ||
} | ||
def cleanupSpec() { | ||
strategy.cleanupDatabase(databases) | ||
} | ||
} |
101 changes: 0 additions & 101 deletions
101
src/main/resources/liquibase/harness/diff/changelogs/mariadb10.3_to_mariadb10.2.xml
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.