Table of Contents |
---|
...
You are also able to run all unit tests via the maven command - mvn test
.
<provide step by step on running the command via maven - please also include output>
Integration Tests
The goal of integration tests are to test:
How various Liquibase systems work in concert with each
Including end-to-end scenarios
How Liquibase interacts with external systems (especially databases)
Integration Database Configuration/Startup
Being able to connect to databases is central to running integration tests in Liquibase, but we also recognize that developers rarely have all possible databases running and available in their system. Therefore, we have a system that is able that is able to find your available databases and does not throw misleading errors when you do not have a database available.
Liquibase will automatically run tests against databases it is able to connect to based on the configuration files (see below) and will skip tests against databases it is not able to connect to.
Configuration Files
The primary configuration for the database setup is https://github.com/liquibase/liquibase/blob/master/liquibase-integration-tests/src/test/resources/liquibase/liquibase.integrationtest.properties . That file contains the default configuration for the database connections, which can be started using our docker-compose file (see below). The file contains a default username/password we generally use for all databases (username=lbuser, password=LiquibasePass1) as integration.test.username
and integration.test.password
and then per-database configuration options with a integration.test.DB_NAME
prefix. For example, derby configs start with integration.test.derby...
and oracle configs start with integration.test.oracle…
such as integration.test.derby.url
and integration.test.oracle.url
.
If you ever need to test against a connection with a different configuration, you can create a liquibase.integrationtest.local.properties
file in the same resources directory as liquibase.integrationtest.properties and override ONLY the configuration values you need. For example, if you are running against an oracle database on a different system, you can set integration.test.oracle.url=jdbc:oracle:thin:@//192.168.1.158/mydb
. The liquibase.integrationtest.local.properties is not checked into git because it is local to your environment.
Docker Databases
To standardize configuration/installation of different databases, we have a docker-compose file at https://github.com/liquibase/liquibase/blob/master/.travis/databases.docker-compose.yml. The databases started through this setup will match the default liquibase.integrationtest.properties settings and are used as part of the buildserver.
We currently only have mysql configured, but will be adding more soon.
To start the test databases:
...
Install Docker and docker-compose
from the .travis directory, run:
...
docker-compose up
Starts all databases
docker-compose up mysql
...