v0.8.6 add testFixtures
This commit is contained in:
parent
fad5ba7c40
commit
fd6e993f18
11 changed files with 26 additions and 24 deletions
|
@ -1,5 +1,5 @@
|
|||
buildscript {
|
||||
ext.kotlin_version = '1.4.21'
|
||||
ext.kotlin_version = '1.4.31'
|
||||
repositories { jcenter() }
|
||||
|
||||
dependencies {
|
||||
|
@ -12,9 +12,11 @@ apply plugin: 'idea'
|
|||
apply plugin: 'org.jetbrains.kotlin.jvm'
|
||||
apply plugin: 'org.jetbrains.kotlin.plugin.serialization'
|
||||
apply plugin: 'maven-publish'
|
||||
apply plugin: 'java-test-fixtures'
|
||||
|
||||
|
||||
group = 'io.provs'
|
||||
version = '0.8.6-SNAPSHOT'
|
||||
version = '0.8.6'
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
|
|
|
@ -103,7 +103,7 @@ open class Prov protected constructor(private val processor: Processor, val name
|
|||
)
|
||||
}
|
||||
|
||||
fun cmdInContainer(containerName: String, vararg args: String): Array<String> {
|
||||
private fun cmdInContainer(containerName: String, vararg args: String): Array<String> {
|
||||
return arrayOf(SHELL, "-c", "sudo docker exec $containerName " + buildCommand(*args))
|
||||
}
|
||||
private fun buildCommand(vararg args: String) : String {
|
||||
|
@ -247,11 +247,11 @@ open class Prov protected constructor(private val processor: Processor, val name
|
|||
} else if (mode == ResultMode.NONE) {
|
||||
ProvResult(true)
|
||||
} else if (mode == ResultMode.FAILEXIT) {
|
||||
if (res.success) {
|
||||
return ProvResult(true)
|
||||
return if (res.success) {
|
||||
ProvResult(true)
|
||||
} else {
|
||||
exit = true
|
||||
return ProvResult(false)
|
||||
ProvResult(false)
|
||||
}
|
||||
} else {
|
||||
ProvResult(false, err = "mode unknown")
|
||||
|
@ -295,12 +295,12 @@ open class Prov protected constructor(private val processor: Processor, val name
|
|||
private data class InternalResult(val level: Int, val method: String?, var provResult: ProvResult?) {
|
||||
override fun toString() : String {
|
||||
val provResult = provResult
|
||||
if (provResult != null) {
|
||||
return prefix(level) + (if (provResult.success) "Success -- " else "FAILED -- ") +
|
||||
method + " " + (provResult.cmd ?: "") +
|
||||
(if (!provResult.success && provResult.err != null) " -- Error: " + provResult.err.escapeNewline() else "") }
|
||||
else
|
||||
return prefix(level) + " " + method + " " + "... in progress ... "
|
||||
return if (provResult != null) {
|
||||
prefix(level) + (if (provResult.success) "Success -- " else "FAILED -- ") +
|
||||
method + " " + (provResult.cmd ?: "") +
|
||||
(if (!provResult.success && provResult.err != null) " -- Error: " + provResult.err.escapeNewline() else "")
|
||||
} else
|
||||
prefix(level) + " " + method + " " + "... in progress ... "
|
||||
|
||||
}
|
||||
|
||||
|
@ -309,9 +309,9 @@ open class Prov protected constructor(private val processor: Processor, val name
|
|||
}
|
||||
}
|
||||
|
||||
val ANSI_RESET = "\u001B[0m"
|
||||
val ANSI_BRIGHT_RED = "\u001B[91m"
|
||||
val ANSI_BRIGHT_GREEN = "\u001B[92m"
|
||||
private val ANSI_RESET = "\u001B[0m"
|
||||
private val ANSI_BRIGHT_RED = "\u001B[91m"
|
||||
private val ANSI_BRIGHT_GREEN = "\u001B[92m"
|
||||
// uncomment if needed
|
||||
// val ANSI_BLACK = "\u001B[30m"
|
||||
// val ANSI_RED = "\u001B[31m"
|
||||
|
@ -336,7 +336,7 @@ open class Prov protected constructor(private val processor: Processor, val name
|
|||
if (internalResults.size > 1) {
|
||||
println("----------------------------------------------------------------------------------------------------- ")
|
||||
println(
|
||||
"Overall " + internalResults.get(0).toString().take(10)
|
||||
"Overall " + internalResults[0].toString().take(10)
|
||||
.replace("Success", ANSI_BRIGHT_GREEN + "Success" + ANSI_RESET)
|
||||
.replace("FAILED", ANSI_BRIGHT_RED + "FAILED" + ANSI_RESET)
|
||||
)
|
||||
|
|
|
@ -44,7 +44,7 @@ open class ContainerUbuntuHostProcessor(
|
|||
return localExecution.xNoLog("sh", "-c", dockerCmd + "exec $containerName " + buildCommand(*args))
|
||||
}
|
||||
|
||||
fun exitAndRm() {
|
||||
private fun exitAndRm() {
|
||||
localExecution.x(SHELL, "-c", dockerCmd + "stop $containerName")
|
||||
localExecution.x(SHELL, "-c", dockerCmd + "rm $containerName")
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package io.provs
|
||||
|
||||
import io.provs.testconfig.tags.CONTAINERTEST
|
||||
import io.provs.test.tags.CONTAINERTEST
|
||||
import org.junit.jupiter.api.Assertions.assertEquals
|
||||
import org.junit.jupiter.api.Tag
|
||||
import org.junit.jupiter.api.Test
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
package io.provs
|
||||
|
||||
import io.provs.docker.provideContainer
|
||||
import io.provs.testconfig.tags.CONTAINERTEST
|
||||
import io.provs.testconfig.tags.CONTAINER_NON_CI
|
||||
import io.provs.test.tags.CONTAINERTEST
|
||||
import io.provs.test.tags.CONTAINER_NON_CI
|
||||
import org.junit.jupiter.api.Assertions.*
|
||||
import org.junit.jupiter.api.Disabled
|
||||
import org.junit.jupiter.api.Tag
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package io.provs
|
||||
|
||||
import io.provs.testconfig.tags.CONTAINERTEST
|
||||
import io.provs.test.tags.CONTAINERTEST
|
||||
import org.junit.jupiter.api.Assertions
|
||||
import org.junit.jupiter.api.Tag
|
||||
import org.junit.jupiter.api.Test
|
||||
|
|
|
@ -5,7 +5,7 @@ import io.provs.docker.containerRuns
|
|||
import io.provs.docker.exitAndRmContainer
|
||||
import io.provs.docker.runContainer
|
||||
import io.provs.local
|
||||
import io.provs.testconfig.tags.CONTAINER_NON_CI
|
||||
import io.provs.test.tags.CONTAINER_NON_CI
|
||||
import org.junit.jupiter.api.Assertions.assertEquals
|
||||
import org.junit.jupiter.api.Tag
|
||||
import org.junit.jupiter.api.Test
|
||||
|
|
|
@ -3,7 +3,7 @@ package io.provs.processors
|
|||
import io.provs.DEFAULT_START_MODE_TEST_CONTAINER
|
||||
import io.provs.platforms.SHELL
|
||||
import io.provs.testDockerWithSudo
|
||||
import io.provs.testconfig.tags.CONTAINERTEST
|
||||
import io.provs.test.tags.CONTAINERTEST
|
||||
import org.junit.jupiter.api.Tag
|
||||
import org.junit.jupiter.api.Test
|
||||
import org.junit.jupiter.api.condition.EnabledOnOs
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package io.provs.testconfig.tags
|
||||
package io.provs.test.tags
|
||||
|
||||
const val CONTAINERTEST = "containertest"
|
||||
const val CONTAINER_NON_CI = "containernonci"
|
Loading…
Reference in a new issue