From 499a2068fb41dfbd36d1f35d267adc7e46722ba8 Mon Sep 17 00:00:00 2001 From: Xiangxuan Liu Date: Fri, 22 Nov 2019 10:56:39 +0800 Subject: [PATCH] Add test for unknown subcommand Signed-off-by: Xiangxuan Liu (cherry picked from commit d5a2963cc95027951ea9654210786c639d5891ff) --- cmd/helm/root_test.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/cmd/helm/root_test.go b/cmd/helm/root_test.go index df592a96d..e1fa1fc27 100644 --- a/cmd/helm/root_test.go +++ b/cmd/helm/root_test.go @@ -95,3 +95,11 @@ func TestRootCmd(t *testing.T) { }) } } + +func TestUnknownSubCmd(t *testing.T) { + _, _, err := executeActionCommand("foobar") + + if err == nil || err.Error() != `unknown command "foobar" for "helm"` { + t.Errorf("Expect unknown command error, got %q", err) + } +}