Skip to content

Commit 40725ae

Browse files
committed
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>
1 parent fdcfd22 commit 40725ae

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

cli-plugins/manager/manager_test.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package manager
22

33
import (
4+
"path/filepath"
45
"strings"
56
"testing"
67

@@ -81,6 +82,12 @@ func TestListPluginCandidates(t *testing.T) {
8182
assert.DeepEqual(t, candidates, exp)
8283
}
8384

85+
func TestListPluginCandidatesEmpty(t *testing.T) {
86+
tmpDir := t.TempDir()
87+
candidates := listPluginCandidates([]string{tmpDir, filepath.Join(tmpDir, "no-such-dir")})
88+
assert.Assert(t, len(candidates) == 0)
89+
}
90+
8491
// Regression test for https://github.com/docker/cli/issues/5643.
8592
// Check that inaccessible directories that come before accessible ones are ignored
8693
// and do not prevent the latter from being processed.

0 commit comments

Comments
 (0)