cli-plugins/manager: add test for empty / non-existing plugin dirs
Verify that listPluginCandidates returns an empty result if nothing was found. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
parent
fdcfd229aa
commit
40725aea3c
@ -1,6 +1,7 @@
|
|||||||
package manager
|
package manager
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"path/filepath"
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
@ -81,6 +82,12 @@ func TestListPluginCandidates(t *testing.T) {
|
|||||||
assert.DeepEqual(t, candidates, exp)
|
assert.DeepEqual(t, candidates, exp)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestListPluginCandidatesEmpty(t *testing.T) {
|
||||||
|
tmpDir := t.TempDir()
|
||||||
|
candidates := listPluginCandidates([]string{tmpDir, filepath.Join(tmpDir, "no-such-dir")})
|
||||||
|
assert.Assert(t, len(candidates) == 0)
|
||||||
|
}
|
||||||
|
|
||||||
// Regression test for https://github.com/docker/cli/issues/5643.
|
// Regression test for https://github.com/docker/cli/issues/5643.
|
||||||
// Check that inaccessible directories that come before accessible ones are ignored
|
// Check that inaccessible directories that come before accessible ones are ignored
|
||||||
// and do not prevent the latter from being processed.
|
// and do not prevent the latter from being processed.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user