add test installK9s

This commit is contained in:
ansgarz 2024-08-20 17:15:51 +02:00
parent 6f5560274d
commit 09c6de5318
3 changed files with 31 additions and 8 deletions

View file

@ -1,18 +1,15 @@
package org.domaindrivenarchitecture.provs.server.infrastructure package org.domaindrivenarchitecture.provs.server.infrastructure
import org.domaindrivenarchitecture.provs.framework.core.Prov import org.domaindrivenarchitecture.provs.framework.core.Prov
import org.domaindrivenarchitecture.provs.framework.ubuntu.filesystem.base.*
import org.domaindrivenarchitecture.provs.framework.ubuntu.web.base.downloadFromURL import org.domaindrivenarchitecture.provs.framework.ubuntu.web.base.downloadFromURL
// ----------------------------------- versions --------------------------------
const val K9S_VERSION = "v0.32.5" const val K9S_VERSION = "v0.32.5"
// ----------------------------------- public functions --------------------------------
fun Prov.installK9s() = task { fun Prov.installK9s() = task {
createDir("/tmp", sudo = true) if (cmdNoEval("k9s version").out?.contains(K9S_VERSION) != true) {
downloadFromURL("https://github.com/derailed/k9s/releases/download/" + K9S_VERSION + "/k9s_linux_amd64.deb", "k9s_linux_amd64.deb", "/tmp") downloadFromURL("https://github.com/derailed/k9s/releases/download/$K9S_VERSION/k9s_linux_amd64.deb", "k9s_linux_amd64.deb", "/tmp")
cmd("sudo dpkg -i k9s_linux_amd64.deb", "/tmp") cmd("sudo dpkg -i k9s_linux_amd64.deb", "/tmp")
} }
}

View file

@ -14,7 +14,10 @@ class GraalVMKtTest {
val prov = defaultTestContainer() val prov = defaultTestContainer()
// when // when
val res = prov.installGraalVM() val res = prov.task {
installGraalVM()
installGraalVM() // test repeatability
}
// then // then
assertTrue(res.success) assertTrue(res.success)

View file

@ -0,0 +1,23 @@
package org.domaindrivenarchitecture.provs.server.infrastructure
import org.domaindrivenarchitecture.provs.test.defaultTestContainer
import org.domaindrivenarchitecture.provs.test.tags.ContainerTest
import org.junit.jupiter.api.Assertions.assertTrue
class K9sKtTest {
@ContainerTest
fun installK9s() {
// given
val prov = defaultTestContainer()
// when
val res = prov.task {
installK9s()
installK9s() // test repeatability
}
// then
assertTrue(res.success)
}
}