MCPcopy
hub / github.com/kubernetes/kubectl / TestListPlugins

Function TestListPlugins

pkg/cmd/plugin/plugin_test.go:182–209  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

180}
181
182func TestListPlugins(t *testing.T) {
183 pluginPath, _ := filepath.Abs("./testdata")
184 expectPlugins := []string{
185 filepath.Join(pluginPath, "kubectl-create-foo"),
186 filepath.Join(pluginPath, "kubectl-foo"),
187 filepath.Join(pluginPath, "kubectl-version"),
188 }
189
190 verifier := newFakePluginPathVerifier()
191 ioStreams, _, _, _ := genericiooptions.NewTestIOStreams()
192 pluginPaths := []string{pluginPath}
193
194 o := &PluginListOptions{
195 Verifier: verifier,
196 IOStreams: ioStreams,
197
198 PluginPaths: pluginPaths,
199 }
200
201 plugins, errs := o.ListPlugins()
202 if len(errs) > 0 {
203 t.Fatalf("unexpected errors: %v", errs)
204 }
205
206 if !reflect.DeepEqual(expectPlugins, plugins) {
207 t.Fatalf("saw unexpected plugins. Expecting %v, got %v", expectPlugins, plugins)
208 }
209}
210
211type duplicatePathError struct {
212 path string

Callers

nothing calls this directly

Calls 3

ListPluginsMethod · 0.95
JoinMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…