Skip to content

Commit 6140a8c

Browse files
authored
Merge pull request #4370 from thaJeztah/no_homedir
cli/command/context: don't use pkg/homedir in test
2 parents 41384b0 + 79ff64f commit 6140a8c

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

cli/command/context/use_test.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@ import (
66
"io"
77
"os"
88
"path/filepath"
9+
"runtime"
910
"testing"
1011

1112
"github.com/docker/cli/cli/command"
1213
"github.com/docker/cli/cli/config"
1314
"github.com/docker/cli/cli/config/configfile"
1415
"github.com/docker/cli/cli/flags"
1516
"github.com/docker/docker/errdefs"
16-
"github.com/docker/docker/pkg/homedir"
1717
"gotest.tools/v3/assert"
1818
is "gotest.tools/v3/assert/cmp"
1919
)
@@ -57,7 +57,11 @@ func TestUseDefaultWithoutConfigFile(t *testing.T) {
5757
// the _default_ configuration file. If we specify a custom configuration
5858
// file, the CLI produces an error if the file doesn't exist.
5959
tmpHomeDir := t.TempDir()
60-
t.Setenv(homedir.Key(), tmpHomeDir)
60+
if runtime.GOOS == "windows" {
61+
t.Setenv("USERPROFILE", tmpHomeDir)
62+
} else {
63+
t.Setenv("HOME", tmpHomeDir)
64+
}
6165
configDir := filepath.Join(tmpHomeDir, ".docker")
6266
configFilePath := filepath.Join(configDir, "config.json")
6367

0 commit comments

Comments
 (0)