temporarily exclude mockk and some tests

This commit is contained in:
az 2021-12-02 13:23:08 +01:00
parent 130a9b4786
commit 1c48d7353b
13 changed files with 91 additions and 63 deletions

View file

@ -79,7 +79,7 @@ dependencies {
api "ch.qos.logback:logback-core:1.2.5"
testFixturesApi group: 'org.junit.jupiter', name: 'junit-jupiter-api', version: '5.5.2'
testImplementation("io.mockk:mockk:1.12.0")
// testImplementation("io.mockk:mockk:1.12.0")
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.7.2'
}

View file

@ -1,61 +1,61 @@
package org.domaindrivenarchitecture.provs.core.cli
import io.mockk.every
import io.mockk.mockkStatic
import io.mockk.verify
import org.domaindrivenarchitecture.provs.core.Prov
import org.domaindrivenarchitecture.provs.core.Secret
import org.domaindrivenarchitecture.provs.core.local
import org.domaindrivenarchitecture.provs.core.processors.PrintOnlyProcessor
import org.domaindrivenarchitecture.provs.core.remote
import org.junit.jupiter.api.Test
internal class CliCommandKtTest {
@Test
fun createProvInstance_local() {
mockkStatic(::local)
// given
val cliCommand = CliCommand(true, null, null, false, null, false)
// when
createProvInstance(cliCommand)
// then
verify { local() }
}
@Test
fun createProvInstance_remote_with_sshKey() {
mockkStatic(::remote)
every { remote(any(), any(), any(), any()) } returns Prov.newInstance(PrintOnlyProcessor())
// given
val cliCommand = CliCommand(false, "host123", "user123", false, null, true)
// when
createProvInstance(cliCommand)
// then
verify { remote("host123", "user123", null, any()) }
}
@Test
fun createProvInstance_remote_with_interactive_password_retrieval() {
mockkStatic(::remote)
every { remote(any(), any(), any(), any()) } returns Prov.newInstance(PrintOnlyProcessor())
mockkStatic(::retrievePassword)
every { retrievePassword(any()) } returns Secret("sec")
// given
val cliCommand = CliCommand(false, "host123", "user123", true, null, false)
// when
createProvInstance(cliCommand)
// then
verify { remote("host123", "user123", Secret("sec"), any()) }
}
}
//package org.domaindrivenarchitecture.provs.core.cli
//
//import io.mockk.every
//import io.mockk.mockkStatic
//import io.mockk.verify
//import org.domaindrivenarchitecture.provs.core.Prov
//import org.domaindrivenarchitecture.provs.core.Secret
//import org.domaindrivenarchitecture.provs.core.local
//import org.domaindrivenarchitecture.provs.core.processors.PrintOnlyProcessor
//import org.domaindrivenarchitecture.provs.core.remote
//import org.junit.jupiter.api.Test
//
//internal class CliCommandKtTest {
//
// @Test
// fun createProvInstance_local() {
// mockkStatic(::local)
//
// // given
// val cliCommand = CliCommand(true, null, null, false, null, false)
//
// // when
// createProvInstance(cliCommand)
//
// // then
// verify { local() }
// }
//
// @Test
// fun createProvInstance_remote_with_sshKey() {
// mockkStatic(::remote)
// every { remote(any(), any(), any(), any()) } returns Prov.newInstance(PrintOnlyProcessor())
//
// // given
// val cliCommand = CliCommand(false, "host123", "user123", false, null, true)
//
// // when
// createProvInstance(cliCommand)
//
// // then
// verify { remote("host123", "user123", null, any()) }
// }
//
// @Test
// fun createProvInstance_remote_with_interactive_password_retrieval() {
// mockkStatic(::remote)
// every { remote(any(), any(), any(), any()) } returns Prov.newInstance(PrintOnlyProcessor())
//
// mockkStatic(::retrievePassword)
// every { retrievePassword(any()) } returns Secret("sec")
//
// // given
// val cliCommand = CliCommand(false, "host123", "user123", true, null, false)
//
// // when
// createProvInstance(cliCommand)
//
// // then
// verify { remote("host123", "user123", Secret("sec"), any()) }
// }
//}

View file

@ -7,6 +7,7 @@ import org.domaindrivenarchitecture.provs.core.docker.dockerProvideImage
import org.domaindrivenarchitecture.provs.core.docker.dockerimages.DockerImage
import org.domaindrivenarchitecture.provs.core.processors.ContainerStartMode
import org.domaindrivenarchitecture.provs.core.processors.ContainerUbuntuHostProcessor
import org.domaindrivenarchitecture.provs.test.tags.ContainerTest
import org.domaindrivenarchitecture.provs.test.tags.NonCi
import org.domaindrivenarchitecture.provs.test.testDockerWithSudo
import org.domaindrivenarchitecture.provs.test.testLocal
@ -14,7 +15,7 @@ import org.junit.jupiter.api.Assertions.assertEquals
import org.junit.jupiter.api.Assertions.assertFalse
import org.junit.jupiter.api.Test
internal class UbuntuProvTests {
internal class UbuntuProvTest {
private fun Prov.ping(url: String) = def {
xec("ping", "-c", "4", url)
@ -98,6 +99,7 @@ internal class UbuntuProvTests {
}
@Test
@ContainerTest
@NonCi
fun test_user_cannot_sudo_without_password() {
// given

View file

@ -8,6 +8,7 @@ import org.domaindrivenarchitecture.provs.core.local
import org.domaindrivenarchitecture.provs.core.processors.ContainerEndMode
import org.domaindrivenarchitecture.provs.core.processors.ContainerStartMode
import org.domaindrivenarchitecture.provs.core.processors.ContainerUbuntuHostProcessor
import org.domaindrivenarchitecture.provs.test.tags.ContainerTest
import org.domaindrivenarchitecture.provs.test.tags.NonCi
import org.domaindrivenarchitecture.provs.ubuntu.install.base.aptInstall
import org.junit.jupiter.api.Assertions.assertTrue
@ -17,6 +18,7 @@ import org.junit.jupiter.api.Test
internal class ProvisionFirewallKtTest {
@Test
@ContainerTest
@NonCi
fun configureFirewall() {
// given

View file

@ -5,6 +5,7 @@ import org.domaindrivenarchitecture.provs.test.tags.NonCi
import org.domaindrivenarchitecture.provs.ubuntu.filesystem.base.replaceTextInFile
import org.domaindrivenarchitecture.provs.ubuntu.install.base.aptInstall
import org.domaindrivenarchitecture.provs.extensions.server_software.standalone_server.nginx.base.*
import org.domaindrivenarchitecture.provs.test.tags.ContainerTest
import org.domaindrivenarchitecture.provs.ubuntu.filesystem.base.fileExists
import org.junit.jupiter.api.Assertions.assertTrue
import org.junit.jupiter.api.Test
@ -13,6 +14,7 @@ import org.junit.jupiter.api.Test
internal class ProvisionNginxKtTest {
@Test
@ContainerTest
@NonCi
fun provisionNginxStandAlone_customConfig() {
// given
@ -42,6 +44,7 @@ internal class ProvisionNginxKtTest {
}
@Test
@ContainerTest
@NonCi
fun provisionNginxStandAlone_defaultConfig() {
// given
@ -57,6 +60,7 @@ internal class ProvisionNginxKtTest {
}
@Test
@ContainerTest
@NonCi
fun provisionNginxStandAlone_sslConfig() {
// given

View file

@ -8,11 +8,13 @@ import org.junit.jupiter.api.Assertions.assertEquals
import org.junit.jupiter.api.Assertions.assertTrue
import org.junit.jupiter.api.Test
import org.domaindrivenarchitecture.provs.test.defaultTestContainer
import org.domaindrivenarchitecture.provs.test.tags.ContainerTest
import org.domaindrivenarchitecture.provs.test.tags.NonCi
internal class LocationsKtTest {
@Test
@ContainerTest
@NonCi
fun nginxIncludeLocationFolders() {
// given

View file

@ -5,11 +5,13 @@ import org.domaindrivenarchitecture.provs.workplace.domain.WorkplaceType
import org.junit.jupiter.api.Assertions.assertTrue
import org.junit.jupiter.api.Test
import org.domaindrivenarchitecture.provs.test.defaultTestContainer
import org.domaindrivenarchitecture.provs.test.tags.ContainerTest
import org.domaindrivenarchitecture.provs.workplace.infrastructure.getConfig
internal class ProvisionWorkplaceKtTest {
@Test
@ContainerTest
fun provisionWorkplace() {
// given
val a = defaultTestContainer()
@ -29,6 +31,7 @@ internal class ProvisionWorkplaceKtTest {
@Test
@ContainerTest
fun provisionWorkplaceFromConfigFile() {
// given
val a = defaultTestContainer()

View file

@ -1,12 +1,14 @@
package org.domaindrivenarchitecture.provs.extensions.workplace.base
import org.domaindrivenarchitecture.provs.test.defaultTestContainer
import org.domaindrivenarchitecture.provs.test.tags.ContainerTest
import org.junit.jupiter.api.Assertions.assertTrue
import org.junit.jupiter.api.Test
internal class FakturamaKtTest {
@Test
@ContainerTest
fun installFakturama() {
// given
val a = defaultTestContainer()

View file

@ -1,6 +1,7 @@
package org.domaindrivenarchitecture.provs.ubuntu.git.base
import org.domaindrivenarchitecture.provs.test.defaultTestContainer
import org.domaindrivenarchitecture.provs.test.tags.ContainerTest
import org.domaindrivenarchitecture.provs.ubuntu.install.base.aptInstall
import org.domaindrivenarchitecture.provs.ubuntu.keys.base.isHostKnown
import org.junit.jupiter.api.Assertions.assertTrue
@ -10,6 +11,7 @@ import org.junit.jupiter.api.Test
internal class GitKtTest {
@Test
@ContainerTest
fun trustGitServers(){
// given
val a = defaultTestContainer()
@ -28,6 +30,7 @@ internal class GitKtTest {
}
@Test
@ContainerTest
fun gitClone() {
// given
val prov = defaultTestContainer()

View file

@ -2,11 +2,13 @@ package org.domaindrivenarchitecture.provs.ubuntu.keys
import org.domaindrivenarchitecture.provs.core.Secret
import org.domaindrivenarchitecture.provs.test.defaultTestContainer
import org.domaindrivenarchitecture.provs.test.tags.ContainerTest
import org.junit.jupiter.api.Test
internal class ProvisionKeysTest {
@Test
@ContainerTest
fun provisionKeys() {
// given
val a = defaultTestContainer()

View file

@ -2,6 +2,7 @@ package org.domaindrivenarchitecture.provs.ubuntu.keys.base
import org.domaindrivenarchitecture.provs.core.Secret
import org.domaindrivenarchitecture.provs.test.defaultTestContainer
import org.domaindrivenarchitecture.provs.test.tags.ContainerTest
import org.domaindrivenarchitecture.provs.ubuntu.keys.*
import org.junit.jupiter.api.Test
@ -10,6 +11,7 @@ import org.junit.jupiter.api.Assertions.*
internal class SshKtTest {
@Test
@ContainerTest
fun configureSshKeys() {
// given
val a = defaultTestContainer()

View file

@ -1,6 +1,7 @@
package org.domaindrivenarchitecture.provs.ubuntu.user
import org.domaindrivenarchitecture.provs.test.defaultTestContainer
import org.domaindrivenarchitecture.provs.test.tags.ContainerTest
import org.domaindrivenarchitecture.provs.ubuntu.filesystem.base.createFile
import org.domaindrivenarchitecture.provs.ubuntu.filesystem.base.fileContent
import org.domaindrivenarchitecture.provs.ubuntu.keys.*
@ -17,6 +18,7 @@ import org.junit.jupiter.api.Test
internal class ProvisionUserKtTest {
@Test
@ContainerTest
fun configureUser() {
// given
val a = defaultTestContainer()
@ -36,6 +38,7 @@ internal class ProvisionUserKtTest {
}
@Test
@ContainerTest
fun createUser() {
// given
val a = defaultTestContainer()
@ -53,6 +56,7 @@ internal class ProvisionUserKtTest {
}
@Test
@ContainerTest
fun createUserWithSudo() {
// given
val a = defaultTestContainer()

View file

@ -2,6 +2,7 @@ package org.domaindrivenarchitecture.provs.workplace.infrastructure
import org.domaindrivenarchitecture.provs.core.getResourceAsText
import org.domaindrivenarchitecture.provs.test.defaultTestContainer
import org.domaindrivenarchitecture.provs.test.tags.ContainerTest
import org.domaindrivenarchitecture.provs.ubuntu.filesystem.base.createDir
import org.domaindrivenarchitecture.provs.ubuntu.filesystem.base.createDirs
import org.domaindrivenarchitecture.provs.ubuntu.filesystem.base.fileContainsText
@ -11,6 +12,7 @@ import org.junit.jupiter.api.Test
internal class DevOpsKtTest {
@Test
@ContainerTest
fun installKubectlAndTools() {
// given
defaultTestContainer().def {