Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,6 @@ on: pull_request_target
jobs:
test:
runs-on: ubuntu-latest
services:
mongodb:
image: mongo:3.2
ports:
- 27017:27017
steps:
- name: Checkout source code
uses: actions/checkout@v2
Expand Down
5 changes: 0 additions & 5 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,6 @@ jobs:
name: "Stable Release"
runs-on: ubuntu-latest
environment: production
services:
mongodb:
image: mongo:3.2
ports:
- 27017:27017
steps:
- uses: actions/checkout@v2
with:
Expand Down
1 change: 1 addition & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ dependencies {

testCompile "org.codehaus.groovy:groovy-all:2.4.19"
testCompile "org.spockframework:spock-core:1.1-groovy-2.4"
testCompile "org.testcontainers:mongodb:1.16.0"
testRuntime "cglib:cglib-nodep:3.1"
testRuntime "org.objenesis:objenesis:2.1"

Expand Down
8 changes: 7 additions & 1 deletion src/funtest/groovy/support/MongoHelper.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import com.mongodb.MongoClient
import com.mongodb.WriteConcern
import com.mongodb.client.MongoDatabase
import org.bson.types.ObjectId
import org.testcontainers.containers.MongoDBContainer
import org.testcontainers.utility.DockerImageName

import java.util.concurrent.atomic.AtomicLong

Expand All @@ -16,7 +18,11 @@ class MongoHelper {
static id = new AtomicLong()

static prepareDB(){
def mongo = new MongoClient()
def mongoDBContainer = new MongoDBContainer(DockerImageName.parse("mongo:3.2"))
mongoDBContainer.setPortBindings(["27017:27017"])

mongoDBContainer.start()
def mongo = new MongoClient(mongoDBContainer.getHost(), mongoDBContainer.getFirstMappedPort())
mongo.writeConcern = WriteConcern.UNACKNOWLEDGED
mongo.getDatabase("sdkman")
}
Expand Down