From 8fd8d635564715768bfc784b817373a0079ce36d Mon Sep 17 00:00:00 2001 From: guoxudong Date: Thu, 19 Nov 2020 15:09:18 +0800 Subject: [PATCH] add test Closes #65163. Signed-off-by: Dawid Dziurla Signed-off-by: chenrui --- Formula/kubecm.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Formula/kubecm.rb b/Formula/kubecm.rb index e60ddfe3b3a..de9f3500ee2 100644 --- a/Formula/kubecm.rb +++ b/Formula/kubecm.rb @@ -10,7 +10,7 @@ class Kubecm < Formula def install system "go", "build", "-ldflags", "-X github.com/sunny0826/kubecm/cmd.kubecmVersion=#{version}", - "-o", bin/"kubecm" + *std_go_args # Install bash completion output = Utils.safe_popen_read("#{bin}/kubecm", "completion", "bash") @@ -22,6 +22,8 @@ class Kubecm < Formula end test do - assert_match "\nKubeConfig Manager\n", shell_output("#{bin}/kubecm -h 2>&1") + # Should error out as switch context need kubeconfig + status_output = shell_output("#{bin}/kubecm switch 2>&1", 1) + assert_match "Error: open", status_output end end