Testing Your PR
The Liquibase Test-Harness is our primary test system for the following classes of changes:
- Data Type - code changes that affect a Data Type produced by Liquibase (for a specific database or set of databases)
- Incorrect SQL - code changes that affect the SQL that is generated by Liquibase for a changetype (for a specific database or set of databases)
NOTE: please continue to add any relevant unit or integration tests in the main liquibase repository, as appropriate.
The test-harness is a separate repo and project, so it needs to be set up separately from liquibase:
- Clone https://github.com/liquibase/liquibase-test-harness to a sibling directory of where liquibase is checked out
- Checkout the develop branch in liquibase-test-harness
- This is the base branch for testing and working on snapshot liquibase builds
- The liquibase-test-harness main branch is only used to test the latest released liquibase build, it is not used to test against snapshot builds
- Update your local liquibase-test-harness pom.xml file
- Update the liquibase-core dependency version from [4.3.0,0) to 0-SNAPSHOT
- Move the liquibase-test-harness pom.xml file to a “don’t commit” git changeset or whatever you need to do so you don’t commit that file
- (Optional) Import the liquibase-test-harness/pom.xml into your IDE to create your project
The liquibase-test-harness readme file explains how to run the test harness tests. Especially the “Running the Tests” section.
- The docker database configurations used by liquibase-test-harness conflict with the configurations used by the liquibase tests. “Conflicts” == same ports but different username/password/schema/etc. So you will have to stop and start containers as you work on different tests
- The
-D
settings from the Maven section for controlling which tests to run apply to running them via the IDE as well - The “Change Objects Test” is the type of test we use for testing both the Data Types and the Incorrect SQL. Datatypes are tested by adding to the
datatypes.*.xml
changelog files. Change objects are tested by adding new changelog xml files
As you develop, make code changes in liquibase and add/modify tests in liquibase-test-harness.
REMEMBER: test-harness runs whatever is installed in your local maven cache as version 0-SNAPSHOT
, so run mvn install
on liquibase when you want to test a new liquibase build.
Once you have liquibase and liquibase-test-harness changes that are ready to submit:
- Commit and push changes to liquibase to a branch
- Commit and push changes to liquibase-test-harness in the same named branch
- Open a PR in liquibase-test-harness
- The first build may fail because liquibase doesn’t have a PR yet. That’s fine, the liquibase PR will trigger it to run again
- Open a PR in liquibase
- In the PR description, include a reference to the test-harness PR
- Assign both PRs to whomever needs to review them
- Put the liquibase PR in “code review” on the Liquibase Community project board
- When the reviewer OKs them, they move the liquibase PR directly to “ready to merge”
- Community team member merges PRs in the “ready to merge” column when it is a good time
Talk to us on the Liquibase Forum, Liquibase Discord, or
clone it at https://github.com/liquibase/liquibase.wiki.git
and create an issue with a patch file.