From 3aeeacfebf8cb0ce3e5e05f908faeb9fa5f5ab09 Mon Sep 17 00:00:00 2001 From: az Date: Mon, 3 Apr 2023 17:39:00 +0200 Subject: [PATCH] [skip ci] add tests test_verifySpecConfig_fails & test_verifySpecConfig_succeeds --- .../infrastructure/VerificationKtTest.kt | 31 ++++++++++++++++--- 1 file changed, 27 insertions(+), 4 deletions(-) diff --git a/src/test/kotlin/org/domaindrivenarchitecture/provs/syspec/infrastructure/VerificationKtTest.kt b/src/test/kotlin/org/domaindrivenarchitecture/provs/syspec/infrastructure/VerificationKtTest.kt index e1a7dec..ada979e 100644 --- a/src/test/kotlin/org/domaindrivenarchitecture/provs/syspec/infrastructure/VerificationKtTest.kt +++ b/src/test/kotlin/org/domaindrivenarchitecture/provs/syspec/infrastructure/VerificationKtTest.kt @@ -3,10 +3,7 @@ package org.domaindrivenarchitecture.provs.syspec.infrastructure import org.domaindrivenarchitecture.provs.framework.core.ProvResult import org.domaindrivenarchitecture.provs.framework.ubuntu.filesystem.base.createDirs import org.domaindrivenarchitecture.provs.framework.ubuntu.filesystem.base.createFile -import org.domaindrivenarchitecture.provs.syspec.domain.FileSpec -import org.domaindrivenarchitecture.provs.syspec.domain.FolderSpec -import org.domaindrivenarchitecture.provs.syspec.domain.SocketSpec -import org.domaindrivenarchitecture.provs.syspec.domain.SyspecConfig +import org.domaindrivenarchitecture.provs.syspec.domain.* import org.domaindrivenarchitecture.provs.test.defaultTestContainer import org.domaindrivenarchitecture.provs.test.tags.ContainerTest import org.domaindrivenarchitecture.provs.test.testLocal @@ -131,4 +128,30 @@ internal class VerificationKtTest { assertFalse(res3) } + @ContainerTest + fun test_verifySpecConfig_succeeds() { + // given + val dir = "/home/testuser" + val prov = defaultTestContainer() + + // when + val res = prov.verifySpecConfig(SyspecConfig(folder = listOf(FolderSpec(dir)), command = listOf(CommandSpec("echo bla")))) + + // then + assertTrue(res.success) + } + + @ContainerTest + fun test_verifySpecConfig_fails() { + // given + val dir = "/home/testuser" + val prov = defaultTestContainer() + + // when + val res = prov.verifySpecConfig(SyspecConfig(command = listOf(CommandSpec("echoo bla"), CommandSpec("echo bla")), folder = listOf(FolderSpec(dir)))) + + // then + assertFalse(res.success) + } + } \ No newline at end of file