File tree Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -86,6 +86,30 @@ func TestListPluginCandidatesEmpty(t *testing.T) {
8686 assert .Assert (t , len (candidates ) == 0 )
8787}
8888
89+ func TestPluginDirEnvironmentVariableExpansion (t * testing.T ) {
90+ pluginDir := "plugins1"
91+ t .Setenv ("MY_PLUGIN_DIR" , pluginDir )
92+ dir := fs .NewDir (t , t .Name (),
93+ fs .WithDir ("${MY_PLUGIN_DIR}" ,
94+ fs .WithFile ("docker-plugin1" , "" ),
95+ ),
96+ )
97+ defer dir .Remove ()
98+
99+ t .Setenv ("DOCKER_CLI_E2E_PLUGINS_EXTRA_DIRS" , dir .Join (pluginDir ))
100+
101+ cli := test .NewFakeCli (nil )
102+ cli .SetConfigFile (& configfile.ConfigFile {CLIPluginsExtraDirs : []string {"$DOCKER_CLI_E2E_PLUGINS_EXTRA_DIRS" }})
103+
104+ pluginDirs := getPluginDirs (cli .ConfigFile ())
105+ expected := []string {
106+ dir .Join (pluginDir ),
107+ filepath .Join (config .Dir (), "cli-plugins" ),
108+ }
109+ expected = append (expected , defaultSystemPluginDirs ... )
110+ assert .DeepEqual (t , expected , pluginDirs )
111+ }
112+
89113// Regression test for https://github.com/docker/cli/issues/5643.
90114// Check that inaccessible directories that come before accessible ones are ignored
91115// and do not prevent the latter from being processed.
You can’t perform that action at this time.
0 commit comments