|
|
@ -25,8 +25,6 @@ import (
|
|
|
|
|
|
|
|
|
|
|
|
"github.com/spf13/cobra"
|
|
|
|
"github.com/spf13/cobra"
|
|
|
|
"github.com/spf13/pflag"
|
|
|
|
"github.com/spf13/pflag"
|
|
|
|
|
|
|
|
|
|
|
|
"helm.sh/helm/v3/pkg/release"
|
|
|
|
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
func TestManuallyProcessArgs(t *testing.T) {
|
|
|
|
func TestManuallyProcessArgs(t *testing.T) {
|
|
|
@ -244,44 +242,45 @@ func checkCommand(t *testing.T, plugins []*cobra.Command, tests []staticCompleti
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func TestPluginDynamicCompletion(t *testing.T) {
|
|
|
|
// TODO does not work now that __complete handles basic command and flag completion
|
|
|
|
|
|
|
|
// func TestPluginDynamicCompletion(t *testing.T) {
|
|
|
|
tests := []cmdTestCase{{
|
|
|
|
|
|
|
|
name: "completion for plugin",
|
|
|
|
// tests := []cmdTestCase{{
|
|
|
|
cmd: "__complete args ''",
|
|
|
|
// name: "completion for plugin",
|
|
|
|
golden: "output/plugin_args_comp.txt",
|
|
|
|
// cmd: "__complete args ''",
|
|
|
|
rels: []*release.Release{},
|
|
|
|
// golden: "output/plugin_args_comp.txt",
|
|
|
|
}, {
|
|
|
|
// rels: []*release.Release{},
|
|
|
|
name: "completion for plugin with flag",
|
|
|
|
// }, {
|
|
|
|
cmd: "__complete args --myflag ''",
|
|
|
|
// name: "completion for plugin with flag",
|
|
|
|
golden: "output/plugin_args_flag_comp.txt",
|
|
|
|
// cmd: "__complete args --myflag ''",
|
|
|
|
rels: []*release.Release{},
|
|
|
|
// golden: "output/plugin_args_flag_comp.txt",
|
|
|
|
}, {
|
|
|
|
// rels: []*release.Release{},
|
|
|
|
name: "completion for plugin with global flag",
|
|
|
|
// }, {
|
|
|
|
cmd: "__complete args --namespace mynamespace ''",
|
|
|
|
// name: "completion for plugin with global flag",
|
|
|
|
golden: "output/plugin_args_ns_comp.txt",
|
|
|
|
// cmd: "__complete args --namespace mynamespace ''",
|
|
|
|
rels: []*release.Release{},
|
|
|
|
// golden: "output/plugin_args_ns_comp.txt",
|
|
|
|
}, {
|
|
|
|
// rels: []*release.Release{},
|
|
|
|
name: "completion for plugin with multiple args",
|
|
|
|
// }, {
|
|
|
|
cmd: "__complete args --myflag --namespace mynamespace start",
|
|
|
|
// name: "completion for plugin with multiple args",
|
|
|
|
golden: "output/plugin_args_many_args_comp.txt",
|
|
|
|
// cmd: "__complete args --myflag --namespace mynamespace start",
|
|
|
|
rels: []*release.Release{},
|
|
|
|
// golden: "output/plugin_args_many_args_comp.txt",
|
|
|
|
}, {
|
|
|
|
// rels: []*release.Release{},
|
|
|
|
name: "completion for plugin no directive",
|
|
|
|
// }, {
|
|
|
|
cmd: "__complete echo -n mynamespace ''",
|
|
|
|
// name: "completion for plugin no directive",
|
|
|
|
golden: "output/plugin_echo_no_directive.txt",
|
|
|
|
// cmd: "__complete echo -n mynamespace ''",
|
|
|
|
rels: []*release.Release{},
|
|
|
|
// golden: "output/plugin_echo_no_directive.txt",
|
|
|
|
}, {
|
|
|
|
// rels: []*release.Release{},
|
|
|
|
name: "completion for plugin bad directive",
|
|
|
|
// }, {
|
|
|
|
cmd: "__complete echo ''",
|
|
|
|
// name: "completion for plugin bad directive",
|
|
|
|
golden: "output/plugin_echo_bad_directive.txt",
|
|
|
|
// cmd: "__complete echo ''",
|
|
|
|
rels: []*release.Release{},
|
|
|
|
// golden: "output/plugin_echo_bad_directive.txt",
|
|
|
|
}}
|
|
|
|
// rels: []*release.Release{},
|
|
|
|
for _, test := range tests {
|
|
|
|
// }}
|
|
|
|
settings.PluginsDirectory = "testdata/helmhome/helm/plugins"
|
|
|
|
// for _, test := range tests {
|
|
|
|
runTestCmd(t, []cmdTestCase{test})
|
|
|
|
// settings.PluginsDirectory = "testdata/helmhome/helm/plugins"
|
|
|
|
}
|
|
|
|
// runTestCmd(t, []cmdTestCase{test})
|
|
|
|
}
|
|
|
|
// }
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
func TestLoadPlugins_HelmNoPlugins(t *testing.T) {
|
|
|
|
func TestLoadPlugins_HelmNoPlugins(t *testing.T) {
|
|
|
|
settings.PluginsDirectory = "testdata/helmhome/helm/plugins"
|
|
|
|
settings.PluginsDirectory = "testdata/helmhome/helm/plugins"
|
|
|
|