Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DAT-12932. mongoDb foundational test. #326

Merged
merged 8 commits into from
Jan 25, 2023
43 changes: 43 additions & 0 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,46 @@ jobs:
cache: 'maven'
- name: Integration Test - Java ${{ matrix.java }}
run: mvn -B clean test verify -Prun-its --file pom.xml

harness-tests:
name: Harness Tests - Java ${{ matrix.java }}
runs-on: ubuntu-latest
strategy:
matrix:
java: [ 11, 17 ]
mongodb: [ 4 ]
services:
mongodb:
image: mongo:${{ matrix.mongodb }}
env:
MONGO_INITDB_DATABASE: lbcat
ports:
- 27020:27017

steps:
- uses: actions/checkout@v2

- name: Set up JDK ${{ matrix.java }}
uses: actions/setup-java@v3
with:
java-version: ${{ matrix.java }}
distribution: 'temurin'
cache: 'maven'

- name: Build Cache
uses: actions/cache@v3.0.5
with:
key: build-${{ github.run_number }}-${{ github.run_attempt }}
path: |
**/target/**
~/.m2/repository/org/liquibase/


- name: Harness Foundational Test Suite Run - Java ${{ matrix.java }}
run: mvn -Dtest="HarnessNoSqlCompatibility" -DdbName=mongodb -DdbUrl=mongodb://localhost:27020/lbcat clean package

- name: Archive Mongo Database Test Results
uses: actions/upload-artifact@v3
with:
name: mongodb-test-results
path: build/spock-reports
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
### Maven ###
!.mvn/wrapper/maven-wrapper.jar
target/
build/

### IntelliJ IDEA ###
.idea
Expand Down
78 changes: 76 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,40 @@
<artifactId>liquibase-core</artifactId>
<version>4.18.0</version>
</dependency>
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-all</artifactId>
<version>3.0.14</version>
<type>pom</type>
</dependency>
<dependency>
<groupId>org.spockframework</groupId>
<artifactId>spock-core</artifactId>
<version>2.4-M1-groovy-3.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.liquibase</groupId>
<artifactId>liquibase-test-harness</artifactId>
<version>1.0.9</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.yaml</groupId>
<artifactId>snakeyaml</artifactId>
<version>${snakeyaml.version}</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20220924</version>
</dependency>
<dependency>
<groupId>org.skyscreamer</groupId>
<artifactId>jsonassert</artifactId>
<version>1.5.1</version>
</dependency>
<dependency>
<groupId>org.mongodb</groupId>
<artifactId>mongodb-driver-sync</artifactId>
Expand Down Expand Up @@ -153,6 +180,34 @@
<version>${mockito-junit-jupiter.version}</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>com.athaydes</groupId>
<artifactId>spock-reports</artifactId>
<version>2.3.2-groovy-3.0</version>
<scope>test</scope>
<!-- this avoids affecting your version of Groovy/Spock -->
<exclusions>
<exclusion>
<groupId>*</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>

<!-- // if you don't already have slf4j-api and an implementation of it in the classpath, add this! -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>2.0.6</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>2.0.6</version>
<scope>test</scope>
</dependency>
</dependencies>

<build>
Expand All @@ -175,7 +230,19 @@
<encoding>${project.build.sourceEncoding}</encoding>
</configuration>
</plugin>

<plugin>
<groupId>org.codehaus.gmavenplus</groupId>
<artifactId>gmavenplus-plugin</artifactId>
<version>2.1.0</version>
<executions>
<execution>
<goals>
<goal>compile</goal>
<goal>compileTests</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
Expand Down Expand Up @@ -212,6 +279,13 @@
</configuration>
</execution>
</executions>
<dependencies>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this might be the way to allow Java/groovy/spock updates in test-harness itself

<dependency>
<groupId>org.apache.maven.surefire</groupId>
<artifactId>surefire-junit-platform</artifactId>
<version>2.22.2</version>
</dependency>
</dependencies>
</plugin>

<plugin>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<databaseChangeLog
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-latest.xsd
http://www.liquibase.org/xml/ns/dbchangelog-ext
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd">

<changeSet id="1" author="as">
<ext:adminCommand>
<ext:command>
{ buildInfo: 1 }
</ext:command>
</ext:adminCommand>
<rollback/>
</changeSet>
</databaseChangeLog>
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<databaseChangeLog
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-latest.xsd
http://www.liquibase.org/xml/ns/dbchangelog-ext
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd">

<changeSet id="1" author="as" labels="createCollectionLabel" context="createCollectionContext">
<comment>create_collection_comment</comment>
<ext:createCollection collectionName="towns"/>
</changeSet>

</databaseChangeLog>
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
<?xml version="1.0" encoding="UTF-8"?>
<databaseChangeLog
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-latest.xsd
http://www.liquibase.org/xml/ns/dbchangelog-ext
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd">


<changeSet id="1" author="as">
<ext:createCollection collectionName="countries"/>
</changeSet>


<changeSet id="2" author="as">
<ext:insertMany collectionName="countries">
<ext:documents>
[
{
_id : "us",
name : "United States",
exports : {
foods : [
{name : "bacon", tasty : "true" },
{name : "burger"}
]
}
},
{
_id : "ca",
name : "Canada",
exports : {
foods : [
{name : "bacon", tasty : false },
{name : "syrup", tasty : true}
]
}
},
{
_id : "mx",
name : "Mexico",
exports : {
foods : [
{name : "salsa", tasty : true, condiment : true}
]
}
}
]
</ext:documents>
</ext:insertMany>

<rollback>
<ext:runCommand>
<ext:command>
{
delete: "countries",
deletes: [ { q: { }, limit: 0 } ]
}
</ext:command>
</ext:runCommand>
</rollback>
</changeSet>

<changeSet id="3" author="as">
<ext:createIndex collectionName="countries">
<ext:keys>
{ name: 1, type: 1}
</ext:keys>
<ext:options>
{unique: true, name: "ui_countries"}
</ext:options>
</ext:createIndex>
</changeSet>
</databaseChangeLog>
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<databaseChangeLog
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-latest.xsd
http://www.liquibase.org/xml/ns/dbchangelog-ext
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd">

<changeSet id="1" author="as">
<ext:createCollection collectionName="towns"/>
<ext:dropCollection collectionName="towns"/>
<rollback/>
</changeSet>

</databaseChangeLog>
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
<?xml version="1.0" encoding="UTF-8"?>
<databaseChangeLog
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-latest.xsd
http://www.liquibase.org/xml/ns/dbchangelog-ext
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd">


<changeSet id="1" author="as">
<ext:createCollection collectionName="countries"/>
</changeSet>


<changeSet id="2" author="as">
<ext:insertMany collectionName="countries">
<ext:documents>
[
{
_id : "us",
name : "United States",
exports : {
foods : [
{name : "bacon", tasty : "true" },
{name : "burger"}
]
}
},
{
_id : "ca",
name : "Canada",
exports : {
foods : [
{name : "bacon", tasty : false },
{name : "syrup", tasty : true}
]
}
},
{
_id : "mx",
name : "Mexico",
exports : {
foods : [
{name : "salsa", tasty : true, condiment : true}
]
}
}
]
</ext:documents>
</ext:insertMany>

<rollback>
<ext:runCommand>
<ext:command>
{
delete: "countries",
deletes: [ { q: { }, limit: 0 } ]
}
</ext:command>
</ext:runCommand>
</rollback>
</changeSet>

<changeSet id="3" author="as">
<ext:createIndex collectionName="countries">
<ext:keys>
{ name: 1, type: 1}
</ext:keys>
<ext:options>
{unique: true, name: "ui_countries"}
</ext:options>
</ext:createIndex>

<ext:dropIndex collectionName="countries">
<ext:keys>
{ name: 1, type: 1}
</ext:keys>
<ext:options>
{unique: true, name: "ui_countries"}
</ext:options>
</ext:dropIndex>

<rollback/>
</changeSet>

</databaseChangeLog>
Loading