v0.8.8-SNAPSHOT - refactor test package in TestSetup.kt

This commit is contained in:
az 2021-03-31 11:16:54 +02:00
parent 0f23e49935
commit 4587938e0b
5 changed files with 11 additions and 7 deletions

View file

@ -16,7 +16,7 @@ apply plugin: 'java-test-fixtures'
group = 'io.provs'
version = '0.8.7-SNAPSHOT'
version = '0.8.8-SNAPSHOT'
repositories {
mavenCentral()

View file

@ -1,5 +1,6 @@
package io.provs
import io.provs.test.defaultTestContainer
import io.provs.test.tags.CONTAINERTEST
import org.junit.jupiter.api.Assertions.assertEquals
import org.junit.jupiter.api.Tag

View file

@ -1,5 +1,6 @@
package io.provs
import io.provs.test.defaultTestContainer
import io.provs.test.tags.CONTAINERTEST
import org.junit.jupiter.api.Assertions
import org.junit.jupiter.api.Tag

View file

@ -1,8 +1,8 @@
package io.provs.processors
import io.provs.DEFAULT_START_MODE_TEST_CONTAINER
import io.provs.test.DEFAULT_START_MODE_TEST_CONTAINER
import io.provs.platforms.SHELL
import io.provs.testDockerWithSudo
import io.provs.test.testDockerWithSudo
import io.provs.test.tags.CONTAINERTEST
import org.junit.jupiter.api.Tag
import org.junit.jupiter.api.Test

View file

@ -1,20 +1,22 @@
package io.provs
package io.provs.test
import io.provs.Prov
import io.provs.processors.ContainerStartMode
import io.provs.processors.ContainerUbuntuHostProcessor
val DEFAULT_START_MODE_TEST_CONTAINER = ContainerStartMode.USE_RUNNING_ELSE_CREATE
val testDockerWithSudo = !"true".equals(System.getProperty("testdockerwithoutsudo")?.toLowerCase())
val testDockerWithSudo = "true" != System.getProperty("testdockerwithoutsudo")?.toLowerCase()
const val defaultTestContainerName = "provs_test"
fun defaultTestContainer(): Prov {
fun defaultTestContainer(imageName: String = "ubuntu"): Prov {
return Prov.newInstance(
ContainerUbuntuHostProcessor(
defaultTestContainerName,
startMode = DEFAULT_START_MODE_TEST_CONTAINER,
sudo = testDockerWithSudo
sudo = testDockerWithSudo,
dockerImage = imageName
)
)
}