This commit is contained in:
ansgarz 2022-01-28 17:46:19 +01:00
parent 507dfc137d
commit c5052ce483

View file

@ -1,5 +1,6 @@
package org.domaindrivenarchitecture.provs.server.infrastructure
import org.domaindrivenarchitecture.provs.framework.core.processors.ContainerStartMode
import org.domaindrivenarchitecture.provs.framework.ubuntu.filesystem.base.createDirs
import org.domaindrivenarchitecture.provs.framework.ubuntu.filesystem.base.fileContainsText
import org.domaindrivenarchitecture.provs.framework.ubuntu.install.base.aptInstall
@ -15,7 +16,7 @@ internal class NetworkKtTest {
@ContainerTest
fun test_provisionNetwork() {
// given
val p = defaultTestContainer()
val p = defaultTestContainer(ContainerStartMode.CREATE_NEW_KILL_EXISTING)
p.task {
aptInstall("dbus netplan.io")
createDirs("/etc/netplan", sudo = true)
@ -23,12 +24,13 @@ internal class NetworkKtTest {
}
// when
val res = p.provisionNetwork()
val res = p.provisionNetwork( "192.168.5.1", loopbackIpv6 = "fc00::5:1")
// then
// assertTrue(res.success) -- netplan is not working in an unprivileged container - see also https://askubuntu.com/questions/813588/systemctl-failed-to-connect-to-bus-docker-ubuntu16-04-container
// check file content snippet
assertTrue(res.success)
assertTrue(p.fileContainsText("/etc/netplan/99-loopback.yaml", content = "- 192.168.5.1/32", sudo = true))
}
}