plugins {
id "io.advantageous.docker-test" version "0.1.2"
}
...
//For docker test annotations
dependencies {
testCompile 'io.advantageous.gradle:docker-test-plugin:0.1.0'
}
//Exclude docker tests as unit tests
test {
useJUnit {
excludeCategories 'io.advantageous.test.DockerTest'
}
}
testDockerContainers {
postgresql {
publishAll true
containerName "postgresql"
env (name:"PGSQL_ROLE_1_USERNAME", value:"docker")
env ("PGSQL_ROLE_1_PASSWORD":"docker", "PGSQL_DB_1_NAME":"mydb")
portMapping(container: 5432, host: 5432)
image "tozd/postgresql:9.5"
waitAfterRun 20
}
cassandra {
publishAll true
containerName "cassandra"
portMapping(container: 9042, host: 9042)
image "cassandra:2.2.5"
waitAfterRun 20
}
}
$ gradle startTestDocker
import io.advantageous.test.DockerTest
@Category(DockerTest::class)
public class FanCountBackFillJobTest {
@Test
fun doRun() {
$ gradle clean dockerTest build