diff --git a/src/main/kotlin/org/domaindrivenarchitecture/provs/server/infrastructure/K9s.kt b/src/main/kotlin/org/domaindrivenarchitecture/provs/server/infrastructure/K9s.kt index d1801da..d4ba30e 100644 --- a/src/main/kotlin/org/domaindrivenarchitecture/provs/server/infrastructure/K9s.kt +++ b/src/main/kotlin/org/domaindrivenarchitecture/provs/server/infrastructure/K9s.kt @@ -1,18 +1,15 @@ package org.domaindrivenarchitecture.provs.server.infrastructure import org.domaindrivenarchitecture.provs.framework.core.Prov -import org.domaindrivenarchitecture.provs.framework.ubuntu.filesystem.base.* import org.domaindrivenarchitecture.provs.framework.ubuntu.web.base.downloadFromURL -// ----------------------------------- versions -------------------------------- const val K9S_VERSION = "v0.32.5" -// ----------------------------------- public functions -------------------------------- - fun Prov.installK9s() = task { - createDir("/tmp", sudo = true) - 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") + 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") + cmd("sudo dpkg -i k9s_linux_amd64.deb", "/tmp") + } } diff --git a/src/test/kotlin/org/domaindrivenarchitecture/provs/desktop/infrastructure/GraalVMKtTest.kt b/src/test/kotlin/org/domaindrivenarchitecture/provs/desktop/infrastructure/GraalVMKtTest.kt index 04957aa..512eefb 100644 --- a/src/test/kotlin/org/domaindrivenarchitecture/provs/desktop/infrastructure/GraalVMKtTest.kt +++ b/src/test/kotlin/org/domaindrivenarchitecture/provs/desktop/infrastructure/GraalVMKtTest.kt @@ -14,7 +14,10 @@ class GraalVMKtTest { val prov = defaultTestContainer() // when - val res = prov.installGraalVM() + val res = prov.task { + installGraalVM() + installGraalVM() // test repeatability + } // then assertTrue(res.success) diff --git a/src/test/kotlin/org/domaindrivenarchitecture/provs/server/infrastructure/K9sKtTest.kt b/src/test/kotlin/org/domaindrivenarchitecture/provs/server/infrastructure/K9sKtTest.kt new file mode 100644 index 0000000..339e257 --- /dev/null +++ b/src/test/kotlin/org/domaindrivenarchitecture/provs/server/infrastructure/K9sKtTest.kt @@ -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) + } +} \ No newline at end of file