diff --git a/build.gradle b/build.gradle index 23d2f97..6565c4b 100644 --- a/build.gradle +++ b/build.gradle @@ -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' } diff --git a/src/test/kotlin/org/domaindrivenarchitecture/provs/core/cli/CliCommandKtTest.kt b/src/test/kotlin/org/domaindrivenarchitecture/provs/core/cli/CliCommandKtTest.kt index 32f6614..0a964f2 100644 --- a/src/test/kotlin/org/domaindrivenarchitecture/provs/core/cli/CliCommandKtTest.kt +++ b/src/test/kotlin/org/domaindrivenarchitecture/provs/core/cli/CliCommandKtTest.kt @@ -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()) } - } -} \ No newline at end of file +//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()) } +// } +//} \ No newline at end of file diff --git a/src/test/kotlin/org/domaindrivenarchitecture/provs/core/platformTest/UbuntuProvTests.kt b/src/test/kotlin/org/domaindrivenarchitecture/provs/core/platformTest/UbuntuProvTest.kt similarity index 97% rename from src/test/kotlin/org/domaindrivenarchitecture/provs/core/platformTest/UbuntuProvTests.kt rename to src/test/kotlin/org/domaindrivenarchitecture/provs/core/platformTest/UbuntuProvTest.kt index bdd6fe8..2b40dc1 100644 --- a/src/test/kotlin/org/domaindrivenarchitecture/provs/core/platformTest/UbuntuProvTests.kt +++ b/src/test/kotlin/org/domaindrivenarchitecture/provs/core/platformTest/UbuntuProvTest.kt @@ -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 diff --git a/src/test/kotlin/org/domaindrivenarchitecture/provs/extensions/server_software/standalone_server/firewall/ProvisionFirewallKtTest.kt b/src/test/kotlin/org/domaindrivenarchitecture/provs/extensions/server_software/standalone_server/firewall/ProvisionFirewallKtTest.kt index ce025c4..9c8d35d 100644 --- a/src/test/kotlin/org/domaindrivenarchitecture/provs/extensions/server_software/standalone_server/firewall/ProvisionFirewallKtTest.kt +++ b/src/test/kotlin/org/domaindrivenarchitecture/provs/extensions/server_software/standalone_server/firewall/ProvisionFirewallKtTest.kt @@ -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 diff --git a/src/test/kotlin/org/domaindrivenarchitecture/provs/extensions/server_software/standalone_server/nginx/ProvisionNginxKtTest.kt b/src/test/kotlin/org/domaindrivenarchitecture/provs/extensions/server_software/standalone_server/nginx/ProvisionNginxKtTest.kt index 1caed6e..7bcb060 100644 --- a/src/test/kotlin/org/domaindrivenarchitecture/provs/extensions/server_software/standalone_server/nginx/ProvisionNginxKtTest.kt +++ b/src/test/kotlin/org/domaindrivenarchitecture/provs/extensions/server_software/standalone_server/nginx/ProvisionNginxKtTest.kt @@ -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 diff --git a/src/test/kotlin/org/domaindrivenarchitecture/provs/extensions/server_software/standalone_server/nginx/base/LocationsKtTest.kt b/src/test/kotlin/org/domaindrivenarchitecture/provs/extensions/server_software/standalone_server/nginx/base/LocationsKtTest.kt index 73d9b11..9d8b4a0 100644 --- a/src/test/kotlin/org/domaindrivenarchitecture/provs/extensions/server_software/standalone_server/nginx/base/LocationsKtTest.kt +++ b/src/test/kotlin/org/domaindrivenarchitecture/provs/extensions/server_software/standalone_server/nginx/base/LocationsKtTest.kt @@ -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 diff --git a/src/test/kotlin/org/domaindrivenarchitecture/provs/extensions/workplace/ProvisionWorkplaceKtTest.kt b/src/test/kotlin/org/domaindrivenarchitecture/provs/extensions/workplace/ProvisionWorkplaceKtTest.kt index 3ff94bd..d300ac1 100644 --- a/src/test/kotlin/org/domaindrivenarchitecture/provs/extensions/workplace/ProvisionWorkplaceKtTest.kt +++ b/src/test/kotlin/org/domaindrivenarchitecture/provs/extensions/workplace/ProvisionWorkplaceKtTest.kt @@ -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() diff --git a/src/test/kotlin/org/domaindrivenarchitecture/provs/extensions/workplace/base/FakturamaKtTest.kt b/src/test/kotlin/org/domaindrivenarchitecture/provs/extensions/workplace/base/FakturamaKtTest.kt index 4d3e47a..b2ce77a 100644 --- a/src/test/kotlin/org/domaindrivenarchitecture/provs/extensions/workplace/base/FakturamaKtTest.kt +++ b/src/test/kotlin/org/domaindrivenarchitecture/provs/extensions/workplace/base/FakturamaKtTest.kt @@ -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() diff --git a/src/test/kotlin/org/domaindrivenarchitecture/provs/ubuntu/git/base/GitKtTest.kt b/src/test/kotlin/org/domaindrivenarchitecture/provs/ubuntu/git/base/GitKtTest.kt index e6ea714..ca42c91 100644 --- a/src/test/kotlin/org/domaindrivenarchitecture/provs/ubuntu/git/base/GitKtTest.kt +++ b/src/test/kotlin/org/domaindrivenarchitecture/provs/ubuntu/git/base/GitKtTest.kt @@ -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() diff --git a/src/test/kotlin/org/domaindrivenarchitecture/provs/ubuntu/keys/ProvisionKeysTest.kt b/src/test/kotlin/org/domaindrivenarchitecture/provs/ubuntu/keys/ProvisionKeysTest.kt index e3372b9..6717dcb 100644 --- a/src/test/kotlin/org/domaindrivenarchitecture/provs/ubuntu/keys/ProvisionKeysTest.kt +++ b/src/test/kotlin/org/domaindrivenarchitecture/provs/ubuntu/keys/ProvisionKeysTest.kt @@ -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() diff --git a/src/test/kotlin/org/domaindrivenarchitecture/provs/ubuntu/keys/base/SshKtTest.kt b/src/test/kotlin/org/domaindrivenarchitecture/provs/ubuntu/keys/base/SshKtTest.kt index 88b542c..58fa7dd 100644 --- a/src/test/kotlin/org/domaindrivenarchitecture/provs/ubuntu/keys/base/SshKtTest.kt +++ b/src/test/kotlin/org/domaindrivenarchitecture/provs/ubuntu/keys/base/SshKtTest.kt @@ -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() diff --git a/src/test/kotlin/org/domaindrivenarchitecture/provs/ubuntu/user/ProvisionUserKtTest.kt b/src/test/kotlin/org/domaindrivenarchitecture/provs/ubuntu/user/ProvisionUserKtTest.kt index c7b021f..ded2d29 100644 --- a/src/test/kotlin/org/domaindrivenarchitecture/provs/ubuntu/user/ProvisionUserKtTest.kt +++ b/src/test/kotlin/org/domaindrivenarchitecture/provs/ubuntu/user/ProvisionUserKtTest.kt @@ -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() diff --git a/src/test/kotlin/org/domaindrivenarchitecture/provs/workplace/infrastructure/DevOpsKtTest.kt b/src/test/kotlin/org/domaindrivenarchitecture/provs/workplace/infrastructure/DevOpsKtTest.kt index a9d6d65..786a5b2 100644 --- a/src/test/kotlin/org/domaindrivenarchitecture/provs/workplace/infrastructure/DevOpsKtTest.kt +++ b/src/test/kotlin/org/domaindrivenarchitecture/provs/workplace/infrastructure/DevOpsKtTest.kt @@ -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 {