Browse Source

integration-cli: don't use pkg/homedir in test

I'm considering deprecating the "Key()" utility, as it was only
used in tests.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 0215a62d5b97d866e29812b3b1a000f23546d23b)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Sebastiaan van Stijn 2 years ago
parent
commit
96534f015d
1 changed files with 11 additions and 3 deletions
  1. 11 3
      integration-cli/docker_cli_run_unix_test.go

+ 11 - 3
integration-cli/docker_cli_run_unix_test.go

@@ -12,6 +12,7 @@ import (
 	"os/exec"
 	"path/filepath"
 	"regexp"
+	"runtime"
 	"strconv"
 	"strings"
 	"syscall"
@@ -22,7 +23,6 @@ import (
 	"github.com/docker/docker/client"
 	"github.com/docker/docker/integration-cli/cli"
 	"github.com/docker/docker/integration-cli/cli/build"
-	"github.com/docker/docker/pkg/homedir"
 	"github.com/docker/docker/pkg/parsers"
 	"github.com/docker/docker/pkg/sysinfo"
 	"github.com/moby/sys/mount"
@@ -251,7 +251,11 @@ func (s *DockerCLIRunSuite) TestRunAttachDetachFromConfig(c *testing.T) {
 	os.Mkdir(dotDocker, 0600)
 	tmpCfg := filepath.Join(dotDocker, "config.json")
 
-	c.Setenv(homedir.Key(), tmpDir)
+	if runtime.GOOS == "windows" {
+		c.Setenv("USERPROFILE", tmpDir)
+	} else {
+		c.Setenv("HOME", tmpDir)
+	}
 
 	data := `{
 		"detachKeys": "ctrl-a,a"
@@ -331,7 +335,11 @@ func (s *DockerCLIRunSuite) TestRunAttachDetachKeysOverrideConfig(c *testing.T)
 	os.Mkdir(dotDocker, 0600)
 	tmpCfg := filepath.Join(dotDocker, "config.json")
 
-	c.Setenv(homedir.Key(), tmpDir)
+	if runtime.GOOS == "windows" {
+		c.Setenv("USERPROFILE", tmpDir)
+	} else {
+		c.Setenv("HOME", tmpDir)
+	}
 
 	data := `{
 		"detachKeys": "ctrl-e,e"