Browse code

integration-cli: remove redundant platform checks

This condition was added in 0215a62d5b97d866e29812b3b1a000f23546d23b, which
removed pkg/homedir as abstraction, but didn't consider that this test
is currently only ran on Unix.

integration-cli/docker_cli_run_unix_test.go:254:5: SA4032: due to the file's build constraints, runtime.GOOS will never equal "windows" (staticcheck)
if runtime.GOOS == "windows" {
^
integration-cli/docker_cli_run_unix_test.go:338:5: SA4032: due to the file's build constraints, runtime.GOOS will never equal "windows" (staticcheck)
if runtime.GOOS == "windows" {
^

Added a TODO, because this functionality should also be tested on Windows,
probably as part of tests in docker/cli instead.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>

Sebastiaan van Stijn authored on 2024/08/21 21:54:52
Showing 1 changed files
... ...
@@ -10,7 +10,6 @@ import (
10 10
 	"os/exec"
11 11
 	"path/filepath"
12 12
 	"regexp"
13
-	"runtime"
14 13
 	"strconv"
15 14
 	"strings"
16 15
 	"syscall"
... ...
@@ -251,11 +250,8 @@ func (s *DockerCLIRunSuite) TestRunAttachDetachFromConfig(c *testing.T) {
251 251
 	os.Mkdir(dotDocker, 0o600)
252 252
 	tmpCfg := filepath.Join(dotDocker, "config.json")
253 253
 
254
-	if runtime.GOOS == "windows" {
255
-		c.Setenv("USERPROFILE", tmpDir)
256
-	} else {
257
-		c.Setenv("HOME", tmpDir)
258
-	}
254
+	// TODO(thaJeztah): migrate this test to docker/cli, and run on Windows as well (using USERPROFILE for home-dir)
255
+	c.Setenv("HOME", tmpDir)
259 256
 
260 257
 	data := `{
261 258
 		"detachKeys": "ctrl-a,a"
... ...
@@ -335,11 +331,8 @@ func (s *DockerCLIRunSuite) TestRunAttachDetachKeysOverrideConfig(c *testing.T)
335 335
 	os.Mkdir(dotDocker, 0o600)
336 336
 	tmpCfg := filepath.Join(dotDocker, "config.json")
337 337
 
338
-	if runtime.GOOS == "windows" {
339
-		c.Setenv("USERPROFILE", tmpDir)
340
-	} else {
341
-		c.Setenv("HOME", tmpDir)
342
-	}
338
+	// TODO(thaJeztah): migrate this test to docker/cli, and run on Windows as well (using USERPROFILE for home-dir)
339
+	c.Setenv("HOME", tmpDir)
343 340
 
344 341
 	data := `{
345 342
 		"detachKeys": "ctrl-e,e"