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" api "ch.qos.logback:logback-core:1.2.5"
testFixturesApi group: 'org.junit.jupiter', name: 'junit-jupiter-api', version: '5.5.2' 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' testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.7.2'
} }

View file

@ -1,61 +1,61 @@
package org.domaindrivenarchitecture.provs.core.cli //package org.domaindrivenarchitecture.provs.core.cli
//
import io.mockk.every //import io.mockk.every
import io.mockk.mockkStatic //import io.mockk.mockkStatic
import io.mockk.verify //import io.mockk.verify
import org.domaindrivenarchitecture.provs.core.Prov //import org.domaindrivenarchitecture.provs.core.Prov
import org.domaindrivenarchitecture.provs.core.Secret //import org.domaindrivenarchitecture.provs.core.Secret
import org.domaindrivenarchitecture.provs.core.local //import org.domaindrivenarchitecture.provs.core.local
import org.domaindrivenarchitecture.provs.core.processors.PrintOnlyProcessor //import org.domaindrivenarchitecture.provs.core.processors.PrintOnlyProcessor
import org.domaindrivenarchitecture.provs.core.remote //import org.domaindrivenarchitecture.provs.core.remote
import org.junit.jupiter.api.Test //import org.junit.jupiter.api.Test
//
internal class CliCommandKtTest { //internal class CliCommandKtTest {
//
@Test // @Test
fun createProvInstance_local() { // fun createProvInstance_local() {
mockkStatic(::local) // mockkStatic(::local)
//
// given // // given
val cliCommand = CliCommand(true, null, null, false, null, false) // val cliCommand = CliCommand(true, null, null, false, null, false)
//
// when // // when
createProvInstance(cliCommand) // createProvInstance(cliCommand)
//
// then // // then
verify { local() } // verify { local() }
} // }
//
@Test // @Test
fun createProvInstance_remote_with_sshKey() { // fun createProvInstance_remote_with_sshKey() {
mockkStatic(::remote) // mockkStatic(::remote)
every { remote(any(), any(), any(), any()) } returns Prov.newInstance(PrintOnlyProcessor()) // every { remote(any(), any(), any(), any()) } returns Prov.newInstance(PrintOnlyProcessor())
//
// given // // given
val cliCommand = CliCommand(false, "host123", "user123", false, null, true) // val cliCommand = CliCommand(false, "host123", "user123", false, null, true)
//
// when // // when
createProvInstance(cliCommand) // createProvInstance(cliCommand)
//
// then // // then
verify { remote("host123", "user123", null, any()) } // verify { remote("host123", "user123", null, any()) }
} // }
//
@Test // @Test
fun createProvInstance_remote_with_interactive_password_retrieval() { // fun createProvInstance_remote_with_interactive_password_retrieval() {
mockkStatic(::remote) // mockkStatic(::remote)
every { remote(any(), any(), any(), any()) } returns Prov.newInstance(PrintOnlyProcessor()) // every { remote(any(), any(), any(), any()) } returns Prov.newInstance(PrintOnlyProcessor())
//
mockkStatic(::retrievePassword) // mockkStatic(::retrievePassword)
every { retrievePassword(any()) } returns Secret("sec") // every { retrievePassword(any()) } returns Secret("sec")
//
// given // // given
val cliCommand = CliCommand(false, "host123", "user123", true, null, false) // val cliCommand = CliCommand(false, "host123", "user123", true, null, false)
//
// when // // when
createProvInstance(cliCommand) // createProvInstance(cliCommand)
//
// then // // then
verify { remote("host123", "user123", Secret("sec"), any()) } // 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.docker.dockerimages.DockerImage
import org.domaindrivenarchitecture.provs.core.processors.ContainerStartMode import org.domaindrivenarchitecture.provs.core.processors.ContainerStartMode
import org.domaindrivenarchitecture.provs.core.processors.ContainerUbuntuHostProcessor 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.tags.NonCi
import org.domaindrivenarchitecture.provs.test.testDockerWithSudo import org.domaindrivenarchitecture.provs.test.testDockerWithSudo
import org.domaindrivenarchitecture.provs.test.testLocal 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.Assertions.assertFalse
import org.junit.jupiter.api.Test import org.junit.jupiter.api.Test
internal class UbuntuProvTests { internal class UbuntuProvTest {
private fun Prov.ping(url: String) = def { private fun Prov.ping(url: String) = def {
xec("ping", "-c", "4", url) xec("ping", "-c", "4", url)
@ -98,6 +99,7 @@ internal class UbuntuProvTests {
} }
@Test @Test
@ContainerTest
@NonCi @NonCi
fun test_user_cannot_sudo_without_password() { fun test_user_cannot_sudo_without_password() {
// given // 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.ContainerEndMode
import org.domaindrivenarchitecture.provs.core.processors.ContainerStartMode import org.domaindrivenarchitecture.provs.core.processors.ContainerStartMode
import org.domaindrivenarchitecture.provs.core.processors.ContainerUbuntuHostProcessor 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.tags.NonCi
import org.domaindrivenarchitecture.provs.ubuntu.install.base.aptInstall import org.domaindrivenarchitecture.provs.ubuntu.install.base.aptInstall
import org.junit.jupiter.api.Assertions.assertTrue import org.junit.jupiter.api.Assertions.assertTrue
@ -17,6 +18,7 @@ import org.junit.jupiter.api.Test
internal class ProvisionFirewallKtTest { internal class ProvisionFirewallKtTest {
@Test @Test
@ContainerTest
@NonCi @NonCi
fun configureFirewall() { fun configureFirewall() {
// given // 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.filesystem.base.replaceTextInFile
import org.domaindrivenarchitecture.provs.ubuntu.install.base.aptInstall import org.domaindrivenarchitecture.provs.ubuntu.install.base.aptInstall
import org.domaindrivenarchitecture.provs.extensions.server_software.standalone_server.nginx.base.* 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.domaindrivenarchitecture.provs.ubuntu.filesystem.base.fileExists
import org.junit.jupiter.api.Assertions.assertTrue import org.junit.jupiter.api.Assertions.assertTrue
import org.junit.jupiter.api.Test import org.junit.jupiter.api.Test
@ -13,6 +14,7 @@ import org.junit.jupiter.api.Test
internal class ProvisionNginxKtTest { internal class ProvisionNginxKtTest {
@Test @Test
@ContainerTest
@NonCi @NonCi
fun provisionNginxStandAlone_customConfig() { fun provisionNginxStandAlone_customConfig() {
// given // given
@ -42,6 +44,7 @@ internal class ProvisionNginxKtTest {
} }
@Test @Test
@ContainerTest
@NonCi @NonCi
fun provisionNginxStandAlone_defaultConfig() { fun provisionNginxStandAlone_defaultConfig() {
// given // given
@ -57,6 +60,7 @@ internal class ProvisionNginxKtTest {
} }
@Test @Test
@ContainerTest
@NonCi @NonCi
fun provisionNginxStandAlone_sslConfig() { fun provisionNginxStandAlone_sslConfig() {
// given // 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.Assertions.assertTrue
import org.junit.jupiter.api.Test import org.junit.jupiter.api.Test
import org.domaindrivenarchitecture.provs.test.defaultTestContainer import org.domaindrivenarchitecture.provs.test.defaultTestContainer
import org.domaindrivenarchitecture.provs.test.tags.ContainerTest
import org.domaindrivenarchitecture.provs.test.tags.NonCi import org.domaindrivenarchitecture.provs.test.tags.NonCi
internal class LocationsKtTest { internal class LocationsKtTest {
@Test @Test
@ContainerTest
@NonCi @NonCi
fun nginxIncludeLocationFolders() { fun nginxIncludeLocationFolders() {
// given // 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.Assertions.assertTrue
import org.junit.jupiter.api.Test import org.junit.jupiter.api.Test
import org.domaindrivenarchitecture.provs.test.defaultTestContainer import org.domaindrivenarchitecture.provs.test.defaultTestContainer
import org.domaindrivenarchitecture.provs.test.tags.ContainerTest
import org.domaindrivenarchitecture.provs.workplace.infrastructure.getConfig import org.domaindrivenarchitecture.provs.workplace.infrastructure.getConfig
internal class ProvisionWorkplaceKtTest { internal class ProvisionWorkplaceKtTest {
@Test @Test
@ContainerTest
fun provisionWorkplace() { fun provisionWorkplace() {
// given // given
val a = defaultTestContainer() val a = defaultTestContainer()
@ -29,6 +31,7 @@ internal class ProvisionWorkplaceKtTest {
@Test @Test
@ContainerTest
fun provisionWorkplaceFromConfigFile() { fun provisionWorkplaceFromConfigFile() {
// given // given
val a = defaultTestContainer() val a = defaultTestContainer()

View file

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

View file

@ -1,6 +1,7 @@
package org.domaindrivenarchitecture.provs.ubuntu.git.base package org.domaindrivenarchitecture.provs.ubuntu.git.base
import org.domaindrivenarchitecture.provs.test.defaultTestContainer 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.install.base.aptInstall
import org.domaindrivenarchitecture.provs.ubuntu.keys.base.isHostKnown import org.domaindrivenarchitecture.provs.ubuntu.keys.base.isHostKnown
import org.junit.jupiter.api.Assertions.assertTrue import org.junit.jupiter.api.Assertions.assertTrue
@ -10,6 +11,7 @@ import org.junit.jupiter.api.Test
internal class GitKtTest { internal class GitKtTest {
@Test @Test
@ContainerTest
fun trustGitServers(){ fun trustGitServers(){
// given // given
val a = defaultTestContainer() val a = defaultTestContainer()
@ -28,6 +30,7 @@ internal class GitKtTest {
} }
@Test @Test
@ContainerTest
fun gitClone() { fun gitClone() {
// given // given
val prov = defaultTestContainer() 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.core.Secret
import org.domaindrivenarchitecture.provs.test.defaultTestContainer import org.domaindrivenarchitecture.provs.test.defaultTestContainer
import org.domaindrivenarchitecture.provs.test.tags.ContainerTest
import org.junit.jupiter.api.Test import org.junit.jupiter.api.Test
internal class ProvisionKeysTest { internal class ProvisionKeysTest {
@Test @Test
@ContainerTest
fun provisionKeys() { fun provisionKeys() {
// given // given
val a = defaultTestContainer() 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.core.Secret
import org.domaindrivenarchitecture.provs.test.defaultTestContainer import org.domaindrivenarchitecture.provs.test.defaultTestContainer
import org.domaindrivenarchitecture.provs.test.tags.ContainerTest
import org.domaindrivenarchitecture.provs.ubuntu.keys.* import org.domaindrivenarchitecture.provs.ubuntu.keys.*
import org.junit.jupiter.api.Test import org.junit.jupiter.api.Test
@ -10,6 +11,7 @@ import org.junit.jupiter.api.Assertions.*
internal class SshKtTest { internal class SshKtTest {
@Test @Test
@ContainerTest
fun configureSshKeys() { fun configureSshKeys() {
// given // given
val a = defaultTestContainer() val a = defaultTestContainer()

View file

@ -1,6 +1,7 @@
package org.domaindrivenarchitecture.provs.ubuntu.user package org.domaindrivenarchitecture.provs.ubuntu.user
import org.domaindrivenarchitecture.provs.test.defaultTestContainer 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.createFile
import org.domaindrivenarchitecture.provs.ubuntu.filesystem.base.fileContent import org.domaindrivenarchitecture.provs.ubuntu.filesystem.base.fileContent
import org.domaindrivenarchitecture.provs.ubuntu.keys.* import org.domaindrivenarchitecture.provs.ubuntu.keys.*
@ -17,6 +18,7 @@ import org.junit.jupiter.api.Test
internal class ProvisionUserKtTest { internal class ProvisionUserKtTest {
@Test @Test
@ContainerTest
fun configureUser() { fun configureUser() {
// given // given
val a = defaultTestContainer() val a = defaultTestContainer()
@ -36,6 +38,7 @@ internal class ProvisionUserKtTest {
} }
@Test @Test
@ContainerTest
fun createUser() { fun createUser() {
// given // given
val a = defaultTestContainer() val a = defaultTestContainer()
@ -53,6 +56,7 @@ internal class ProvisionUserKtTest {
} }
@Test @Test
@ContainerTest
fun createUserWithSudo() { fun createUserWithSudo() {
// given // given
val a = defaultTestContainer() 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.core.getResourceAsText
import org.domaindrivenarchitecture.provs.test.defaultTestContainer 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.createDir
import org.domaindrivenarchitecture.provs.ubuntu.filesystem.base.createDirs import org.domaindrivenarchitecture.provs.ubuntu.filesystem.base.createDirs
import org.domaindrivenarchitecture.provs.ubuntu.filesystem.base.fileContainsText import org.domaindrivenarchitecture.provs.ubuntu.filesystem.base.fileContainsText
@ -11,6 +12,7 @@ import org.junit.jupiter.api.Test
internal class DevOpsKtTest { internal class DevOpsKtTest {
@Test @Test
@ContainerTest
fun installKubectlAndTools() { fun installKubectlAndTools() {
// given // given
defaultTestContainer().def { defaultTestContainer().def {