This commit is contained in:
ansgarz 2022-01-03 20:46:28 +01:00
parent 18989f34d4
commit 20369f6d92
4 changed files with 23 additions and 1 deletions

View file

@ -18,7 +18,7 @@ apply plugin: 'kotlinx-serialization'
group = 'org.domaindrivenarchitecture.provs'
version = '0.8.34-SNAPSHOT'
version = '0.8.34'
repositories {
mavenCentral()

View file

@ -1,6 +1,8 @@
package org.domaindrivenarchitecture.provs.core
import ch.qos.logback.classic.Level
import org.domaindrivenarchitecture.provs.core.docker.provideContainer
import org.domaindrivenarchitecture.provs.test.setRootLoggingLevel
import org.domaindrivenarchitecture.provs.test.tags.ContainerTest
import org.domaindrivenarchitecture.provs.test.tags.NonCi
import org.domaindrivenarchitecture.provs.test.testLocal
@ -280,6 +282,8 @@ internal class ProvTest {
fun runProv_printsCorrectOutput() {
// given
setRootLoggingLevel(Level.OFF)
val outContent = ByteArrayOutputStream()
val errContent = ByteArrayOutputStream()
val originalOut = System.out
@ -353,6 +357,8 @@ internal class ProvTest {
}
}
setRootLoggingLevel(Level.OFF)
val outContent = ByteArrayOutputStream()
val errContent = ByteArrayOutputStream()
val originalOut = System.out

View file

@ -1,5 +1,6 @@
package org.domaindrivenarchitecture.provs.workplace.application
import ch.qos.logback.classic.Level
import io.mockk.every
import io.mockk.mockkStatic
import io.mockk.unmockkStatic
@ -7,6 +8,7 @@ import io.mockk.verify
import org.domaindrivenarchitecture.provs.core.*
import org.domaindrivenarchitecture.provs.core.cli.retrievePassword
import org.domaindrivenarchitecture.provs.core.processors.PrintOnlyProcessor
import org.domaindrivenarchitecture.provs.test.setRootLoggingLevel
import org.domaindrivenarchitecture.provs.workplace.domain.WorkplaceConfig
import org.domaindrivenarchitecture.provs.workplace.domain.WorkplaceType
import org.domaindrivenarchitecture.provs.workplace.domain.provisionWorkplace
@ -97,6 +99,8 @@ internal class CliWorkplaceKtTest {
@Test
fun prints_error_message_if_config_not_found() {
// given
setRootLoggingLevel(Level.OFF)
val outContent = ByteArrayOutputStream()
val errContent = ByteArrayOutputStream()
val originalOut = System.out
@ -121,6 +125,8 @@ internal class CliWorkplaceKtTest {
@Test
fun prints_error_message_if_config_not_parsable() {
// given
setRootLoggingLevel(Level.OFF)
val outContent = ByteArrayOutputStream()
val errContent = ByteArrayOutputStream()
val originalOut = System.out

View file

@ -0,0 +1,10 @@
package org.domaindrivenarchitecture.provs.test
import ch.qos.logback.classic.Level
import ch.qos.logback.classic.Logger
import org.slf4j.LoggerFactory
fun setRootLoggingLevel(level: Level?) {
val root = LoggerFactory.getLogger(Logger.ROOT_LOGGER_NAME) as Logger
root.level = level
}