(t *testing.T)
| 180 | } |
| 181 | |
| 182 | func 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 | |
| 211 | type duplicatePathError struct { |
| 212 | path string |
nothing calls this directly
no test coverage detected
searching dependent graphs…