Add tests for ssh.kt

merge-requests/1/merge
bom 2 years ago
parent 93933af0d0
commit 7e1c25fc32

@ -0,0 +1,26 @@
package org.domaindrivenarchitecture.provs.server.infrastructure
import org.domaindrivenarchitecture.provs.framework.ubuntu.filesystem.base.checkFile
import org.domaindrivenarchitecture.provs.framework.ubuntu.filesystem.base.fileContainsText
import org.domaindrivenarchitecture.provs.test.defaultTestContainer
import org.domaindrivenarchitecture.provs.test.tags.ExtensiveContainerTest
import org.junit.jupiter.api.Assertions.assertTrue
class SshKtTest {
@ExtensiveContainerTest
fun test_configureSsh() {
// given
val p = defaultTestContainer()
// when
val res = p.configureSsh()
// then
assertTrue(res.success)
assertTrue(p.fileContainsText("/etc/ssh/ssh_config","PasswordAuthentication no", sudo=true))
assertTrue(p.fileContainsText("/etc/ssh/sshd_config","PasswordAuthentication no", sudo=true))
assertTrue(p.checkFile("/etc/ssh/sshd_config.d/sshd_hardening.conf"))
}
}
Loading…
Cancel
Save