(t *testing.T)
| 233 | } |
| 234 | |
| 235 | func TestLoadAllPluginsDir_Zero(t *testing.T) { |
| 236 | cases := []struct { |
| 237 | name string |
| 238 | plugdirs string |
| 239 | expected int |
| 240 | }{ |
| 241 | { |
| 242 | name: "plugdirs is empty", |
| 243 | plugdirs: t.TempDir(), |
| 244 | }, |
| 245 | { |
| 246 | name: "plugdirs isn't dir", |
| 247 | plugdirs: "./plugin_test.go", |
| 248 | }, |
| 249 | { |
| 250 | name: "plugdirs doesn't have plugin", |
| 251 | plugdirs: ".", |
| 252 | }, |
| 253 | } |
| 254 | for _, c := range cases { |
| 255 | t.Run(t.Name(), func(t *testing.T) { |
| 256 | plugin, err := LoadAllDir(c.plugdirs, func(_ string, err error) error { return err }) |
| 257 | require.NoError(t, err) |
| 258 | assert.Len(t, plugin, c.expected, "expected %d plugins, got %d", c.expected, len(plugin)) |
| 259 | }) |
| 260 | } |
| 261 | } |
| 262 | |
| 263 | func TestLoadMetadataLegacy(t *testing.T) { |
| 264 | testCases := map[string]struct { |
nothing calls this directly
no test coverage detected
searching dependent graphs…