From 6a3daaa7aa5b89a150042cadcbe869b477bb62a1 Mon Sep 17 00:00:00 2001 From: Marc Khouzam Date: Sat, 10 Jul 2021 21:19:50 -0400 Subject: [PATCH] fix(tests): Remove unnecessary test Testing that a bad completion directive was being replaced by the default one was actually testing Cobra's behaviour. This is unnecessary especially since that behaviour changed in the 1.2.0 release. Helm tests should focus on testing Helm's behaviour. Signed-off-by: Marc Khouzam --- cmd/helm/plugin_test.go | 5 ----- .../testdata/helmhome/helm/plugins/echo/plugin.complete | 3 +-- cmd/helm/testdata/output/plugin_echo_bad_directive.txt | 6 ------ 3 files changed, 1 insertion(+), 13 deletions(-) delete mode 100644 cmd/helm/testdata/output/plugin_echo_bad_directive.txt diff --git a/cmd/helm/plugin_test.go b/cmd/helm/plugin_test.go index 87fd17681..4fb834189 100644 --- a/cmd/helm/plugin_test.go +++ b/cmd/helm/plugin_test.go @@ -277,11 +277,6 @@ func TestPluginDynamicCompletion(t *testing.T) { cmd: "__complete echo -n mynamespace ''", golden: "output/plugin_echo_no_directive.txt", rels: []*release.Release{}, - }, { - name: "completion for plugin bad directive", - cmd: "__complete echo ''", - golden: "output/plugin_echo_bad_directive.txt", - rels: []*release.Release{}, }} for _, test := range tests { settings.PluginsDirectory = "testdata/helmhome/helm/plugins" diff --git a/cmd/helm/testdata/helmhome/helm/plugins/echo/plugin.complete b/cmd/helm/testdata/helmhome/helm/plugins/echo/plugin.complete index 6bc73d130..63569aada 100755 --- a/cmd/helm/testdata/helmhome/helm/plugins/echo/plugin.complete +++ b/cmd/helm/testdata/helmhome/helm/plugins/echo/plugin.complete @@ -7,8 +7,7 @@ echo "Args received: ${@}" # Final printout is the optional completion directive of the form : if [ "$HELM_NAMESPACE" = "default" ]; then - # Output an invalid directive, which should be ignored - echo ":2222" + echo ":0" # else # Don't include the directive, to test it is really optional fi diff --git a/cmd/helm/testdata/output/plugin_echo_bad_directive.txt b/cmd/helm/testdata/output/plugin_echo_bad_directive.txt deleted file mode 100644 index 9f2802581..000000000 --- a/cmd/helm/testdata/output/plugin_echo_bad_directive.txt +++ /dev/null @@ -1,6 +0,0 @@ -echo plugin.complete was called -Namespace: default -Num args received: 1 -Args received: -:0 -Completion ended with directive: ShellCompDirectiveDefault