fix problem with potential wrong color due to success not overwritten in logic in printResults

This commit is contained in:
ansgarz 2022-03-19 20:39:31 +01:00
parent 10e5bf933e
commit d2a2ee6b00
4 changed files with 18 additions and 13 deletions

View file

@ -349,18 +349,23 @@ open class Prov protected constructor(
private fun printResults() {
println(
"============================================== SUMMARY " + (if (instanceName != null) "(" + instanceName + ") " else "") +
"============================================== SUMMARY " +
(if (instanceName != null) "(" + instanceName + ") " else "") +
"============================================== "
)
val successPerLevel = arrayListOf<Boolean>()
for (result in internalResults) {
val currentLevel = result.level
// store level result
val currentLevelSucces = result.provResult?.success ?: false
if (currentLevel >= successPerLevel.size) successPerLevel.add(currentLevelSucces)
// store level success
val successOfCurrentLevel = result.provResult?.success ?: false
if (currentLevel < successPerLevel.size) {
successPerLevel[currentLevel] = successOfCurrentLevel
} else {
successPerLevel.add(successOfCurrentLevel)
}
val successOfLevelAbove = if (currentLevel == 0) currentLevelSucces else successPerLevel[currentLevel - 1]
val successOfLevelAbove = if (currentLevel == 0) successOfCurrentLevel else successPerLevel[currentLevel - 1]
println(result.toString().escapeControlChars().formattedAsResultLine(successOfLevelAbove))
}
if (internalResults.size > 1) {

View file

@ -1,16 +1,15 @@
package org.domaindrivenarchitecture.provs.desktop.infrastructure
import org.domaindrivenarchitecture.provs.test.defaultTestContainer
import org.domaindrivenarchitecture.provs.framework.ubuntu.install.base.aptInstall
import org.domaindrivenarchitecture.provs.test.tags.ContainerTest
import org.domaindrivenarchitecture.provs.test.defaultTestContainer
import org.domaindrivenarchitecture.provs.test.tags.ExtensiveContainerTest
import org.junit.jupiter.api.Assertions.assertTrue
import org.junit.jupiter.api.Test
import org.junit.jupiter.api.Assertions.*
internal class VSCodeKtTest {
@Test
@ContainerTest
@ExtensiveContainerTest
fun provisionAdditionalTools() {
// given
defaultTestContainer().aptInstall("curl unzip")

View file

@ -11,6 +11,7 @@ import org.domaindrivenarchitecture.provs.framework.ubuntu.user.base.configureUs
import org.domaindrivenarchitecture.provs.framework.ubuntu.user.base.createUser
import org.domaindrivenarchitecture.provs.framework.ubuntu.user.base.userExists
import org.domaindrivenarchitecture.provs.framework.ubuntu.user.base.userIsInGroupSudo
import org.domaindrivenarchitecture.provs.test.tags.ExtensiveContainerTest
import org.junit.jupiter.api.Assertions.assertEquals
import org.junit.jupiter.api.Assertions.assertTrue
import org.junit.jupiter.api.Test
@ -19,7 +20,7 @@ import org.junit.jupiter.api.Test
internal class ProvisionUserKtTest {
@Test
@ContainerTest
@ExtensiveContainerTest
fun configureUser() {
// given
val a = defaultTestContainer()

View file

@ -9,14 +9,14 @@ import org.domaindrivenarchitecture.provs.server.domain.k3s.K3sConfig
import org.domaindrivenarchitecture.provs.server.domain.k3s.Loopback
import org.domaindrivenarchitecture.provs.server.domain.k3s.Node
import org.domaindrivenarchitecture.provs.test.defaultTestContainer
import org.domaindrivenarchitecture.provs.test.tags.ContainerTest
import org.domaindrivenarchitecture.provs.test.tags.ExtensiveContainerTest
import org.junit.jupiter.api.Assertions.assertTrue
import org.junit.jupiter.api.Test
internal class NetworkKtTest {
@Test
@ContainerTest
@ExtensiveContainerTest
fun test_provisionNetwork() {
// given
val p = defaultTestContainer()