diff --git a/src/main/kotlin/org/domaindrivenarchitecture/provs/desktop/infrastructure/DevOps.kt b/src/main/kotlin/org/domaindrivenarchitecture/provs/desktop/infrastructure/DevOps.kt index 82ed567..52899e2 100644 --- a/src/main/kotlin/org/domaindrivenarchitecture/provs/desktop/infrastructure/DevOps.kt +++ b/src/main/kotlin/org/domaindrivenarchitecture/provs/desktop/infrastructure/DevOps.kt @@ -39,7 +39,7 @@ fun Prov.installKubectlAndTools(): ProvResult = task { val resourcePath = "org/domaindrivenarchitecture/provs/desktop/infrastructure" task("installKubectl") { - val kubeConfigFile = "~/.bashrc.d/kubectl.sh" + val kubeConfigFile = ".bashrc.d/kubectl.sh" if (!checkFile(kubeConfigFile)) { // prerequisites -- see https://kubernetes.io/docs/tasks/tools/install-kubectl-linux/ cmd("sudo apt-get update") @@ -48,6 +48,7 @@ fun Prov.installKubectlAndTools(): ProvResult = task { cmd("echo \"deb [signed-by=/usr/share/keyrings/kubernetes-archive-keyring.gpg] https://apt.kubernetes.io/ kubernetes-xenial main\" | sudo tee /etc/apt/sources.list.d/kubernetes.list") // kubectl and bash completion + cmd("sudo apt update") aptInstall("kubectl") cmd("kubectl completion bash >> /etc/bash_completion.d/kubernetes", sudo = true) createDir(".bashrc.d") diff --git a/src/test/kotlin/org/domaindrivenarchitecture/provs/desktop/infrastructure/DevOpsKtTest.kt b/src/test/kotlin/org/domaindrivenarchitecture/provs/desktop/infrastructure/DevOpsKtTest.kt index c64ab48..a42c39a 100644 --- a/src/test/kotlin/org/domaindrivenarchitecture/provs/desktop/infrastructure/DevOpsKtTest.kt +++ b/src/test/kotlin/org/domaindrivenarchitecture/provs/desktop/infrastructure/DevOpsKtTest.kt @@ -1,6 +1,7 @@ package org.domaindrivenarchitecture.provs.desktop.infrastructure import org.domaindrivenarchitecture.provs.framework.core.getResourceAsText +import org.domaindrivenarchitecture.provs.framework.ubuntu.filesystem.base.checkFile import org.domaindrivenarchitecture.provs.framework.ubuntu.filesystem.base.createDir import org.domaindrivenarchitecture.provs.framework.ubuntu.filesystem.base.createDirs import org.domaindrivenarchitecture.provs.framework.ubuntu.filesystem.base.fileContainsText @@ -30,10 +31,7 @@ internal class DevOpsKtTest { ) ) assertTrue( - defaultTestContainer().fileContainsText( - "/etc/bash_completion.d/kubernetes", - "\nkubectl completion bash\n" - ) + defaultTestContainer().checkFile("/etc/bash_completion.d/kubernetes", sudo = true) ) } }