Skip to content

Commit

Permalink
Merge pull request #417 from liquibase/Rename_tests
Browse files Browse the repository at this point in the history
Rename tests (compatibility foundational)
  • Loading branch information
kristyldatical authored Nov 10, 2022
2 parents 0607baf + 0662b7d commit d787cbb
Show file tree
Hide file tree
Showing 14 changed files with 41 additions and 40 deletions.
7 changes: 3 additions & 4 deletions .github/workflows/aws.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ on:
- ChangeObjectTests
- ChangeDataTests
- SnapshotObjectTests
- BasicCompatibilityTest
- FoundationalCompatibilityTest
- CompatibilityTest
- FoundationalTest
databases:
description: Databases to start up. Comma separated list of "name:version"
required: true
Expand Down Expand Up @@ -250,5 +250,4 @@ jobs:
uses: actions/upload-artifact@v3
with:
name: aws-rds-${{ steps.setup.outputs.databasePlatform }}-${{ steps.setup.outputs.databaseVersion }}-test-results
path: build/spock-reports

path: build/spock-reports
4 changes: 2 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ on:
- ChangeObjectTests
- ChangeDataTests
- SnapshotObjectTests
- BasicCompatibilityTest
- FoundationalCompatibilityTest
- CompatibilityTest
- FoundationalTest
ignoreLiquibaseSnapshot:
type: boolean
description: Don't autoconfigure Liquibase Snapshot
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/snowflake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,4 @@ jobs:
uses: actions/upload-artifact@v3
with:
name: snowflake-test-results
path: build/spock-reports

path: build/spock-reports
4 changes: 2 additions & 2 deletions README.extensions.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,10 @@ This suite will run all Test Harness tests
## Adding Additional Tests and Configurations


#### Basic Compatibility Test
#### Compatibility Test

In case you don't know if the extension you are going to use works with Liquibase on basic level - you may use this test
to check it. Add new run configuration in extension project and choose class liquibase.harness.compatibility.BasicCompatibilityTest
to check it. Add new run configuration in extension project and choose class liquibase.harness.compatibility.basic.CompatibilityTest
from external libraries. Run the test.
This test will allow you to check if basic Liquibase functions work correctly with your database:
- Deploying simple change sets using all format types (.sql, .xml, .json, .yml);
Expand Down
15 changes: 8 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ The general pattern is that for each directory containing configuration files:
At each level in that hierarchy, new configurations can be added and/or can override configurations from a lower level.

Currently, there are five test types defined in the test harness:
* Base Compatibility test
* Compatibility test
* Foundational test
* Change Object Tests
* Change Data Tests
* Snapshot Command Test
Expand Down Expand Up @@ -79,7 +80,7 @@ For more information on using the test harness in your extension, see [README.ex

# Framework Tests

## BasicCompatibilityTest
## CompatibilityTest

This test validates work of basic Liquibase functions.
1) runs Liquibase validate command to ensure the changelog is valid;
Expand All @@ -94,8 +95,8 @@ it is not present in test**)
8) runs Liquibase rollback command;
9) runs verification query to ensure a test object was actually removed during Liquibase rollback command;

### Running BaseCompatibilityTest against your database
As far as this test validates work of Basic Liquibase functions it is essential to keep its configuration as simple as possible:
### Running CompatibilityTest against your database
As far as this test validates work of basic Liquibase functions it is essential to keep its configuration as simple as possible:
1. If you have your database instance up and running you need to just add appropriate configuration details to `src/test/resources/harness-config.yml` file.
Following the example:
- **name**: `database_name` (**mandatory**) </br>
Expand All @@ -107,14 +108,14 @@ Following the example:
2. Add driver dependency for you database to POM.xml file

3. To run the test go to you IDE run configurations and add new JUnit configuration. Add
`liquibase.harness.base.BaseCompatibilityTest` as target class and use -DdbName, -DdbVersion to set up
`liquibase.harness.compatibility.basic.CompatibilityTest` as target class and use -DdbName, -DdbVersion to set up
appropriate parameters. Or you may just comment out/delete all existing configurations in harness-config.yml
file leaving just your configuration and run BaseCompatibilityTest directly from the class file.
file leaving just your configuration and run CompatibilityTest directly from the class file.

In case you want to set up your database instance using docker image then you may use
`src/test/resources/docker/docker-compose.yml` file for configuration.

## FoundationalCompatibilityTest
## FoundationalTest

Checks if your database doesn't "choke" while Liquibase tries to deploy very long queries (inserts and updates with 10k rows).

Expand Down
12 changes: 0 additions & 12 deletions src/main/groovy/liquibase/harness/CompatibilityHarnessSuite.groovy

This file was deleted.

12 changes: 12 additions & 0 deletions src/main/groovy/liquibase/harness/FoundationalHarnessSuite.groovy
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package liquibase.harness


import liquibase.harness.compatibility.basic.CompatibilityTest
import liquibase.harness.compatibility.foundational.FoundationalTest
import org.junit.runner.RunWith
import org.junit.runners.Suite

@RunWith(Suite.class)
@Suite.SuiteClasses([CompatibilityTest, FoundationalTest])
abstract class FoundationalHarnessSuite {
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@ import java.sql.SQLException
import static liquibase.harness.util.FileUtils.*
import static liquibase.harness.util.JSONUtils.*
import static liquibase.harness.util.TestUtils.*
import static BasicCompatibilityTestHelper.*
import static CompatibilityTestHelper.*

@Unroll
class BasicCompatibilityTest extends Specification {
class CompatibilityTest extends Specification {
@Shared
RollbackStrategy strategy;
RollbackStrategy strategy
@Shared
List<DatabaseUnderTest> databases;
List<DatabaseUnderTest> databases

def setupSpec() {
databases = TestConfig.instance.getFilteredDatabasesUnderTest()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import java.sql.DriverManager
import java.sql.ResultSet
import java.sql.SQLException

class BasicCompatibilityTestHelper {
class CompatibilityTestHelper {

final static String baseChangelogPath = "liquibase/harness/compatibility/basic/changelogs"
final static List supportedChangeLogFormats = ['xml', 'sql', 'json', 'yml', 'yaml'].asImmutable()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ import spock.lang.Shared
import spock.lang.Specification
import spock.lang.Unroll

import static liquibase.harness.compatibility.foundational.FoundationalCompatibilityTestHelper.buildTestInput
import static FoundationalTestHelper.buildTestInput
import static liquibase.harness.util.TestUtils.chooseRollbackStrategy
import static liquibase.harness.util.TestUtils.executeCommandScope

@Unroll
class FoundationalCompatibilityTest extends Specification {
class FoundationalTest extends Specification {
@Shared
RollbackStrategy strategy
@Shared
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import liquibase.harness.config.TestConfig
import liquibase.harness.util.DatabaseConnectionUtil
import liquibase.harness.util.FileUtils

class FoundationalCompatibilityTestHelper {
class FoundationalTestHelper {
final static String baseChangelogPath = "liquibase/harness/compatibility/foundational/"

static List<TestInput> buildTestInput() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
package liquibase.harness


import liquibase.harness.config.TestConfig

class BasicCompatibilityTest extends liquibase.harness.compatibility.basic.BasicCompatibilityTest {
class CompatibilityTest extends liquibase.harness.compatibility.basic.CompatibilityTest {

static {
//extensions don't distribute their files. Only we store them in src/main/resources.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package liquibase.harness

import liquibase.harness.config.TestConfig

class CompatibilityHarnessSuiteTest extends CompatibilityHarnessSuite {
class FoundationalHarnessSuiteTest extends FoundationalHarnessSuite {

static {
//extensions don't distribute their files. Only we store them in src/main/resources.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
package liquibase.harness


import liquibase.harness.config.TestConfig

class FoundationalCompatibilityTest extends liquibase.harness.compatibility.foundational.FoundationalCompatibilityTest {
class FoundationalTest extends liquibase.harness.compatibility.foundational.FoundationalTest {

static {
//extensions don't distribute their files. Only we store them in src/main/resources.
Expand Down

0 comments on commit d787cbb

Please sign in to comment.