Merge pull request #16559 from Microsoft/10662-fix16556
Fixes 16556 CI failures
This commit is contained in:
commit
7daeecd42d
5 changed files with 16 additions and 13 deletions
|
@ -191,7 +191,7 @@ func (s *DockerSuite) TestContainerApiStartVolumeBinds(c *check.C) {
|
|||
c.Assert(err, check.IsNil)
|
||||
c.Assert(status, check.Equals, http.StatusCreated)
|
||||
|
||||
bindPath := randomTmpDirPath("test")
|
||||
bindPath := randomTmpDirPath("test", daemonPlatform)
|
||||
config = map[string]interface{}{
|
||||
"Binds": []string{bindPath + ":/tmp"},
|
||||
}
|
||||
|
@ -222,8 +222,8 @@ func (s *DockerSuite) TestContainerApiStartDupVolumeBinds(c *check.C) {
|
|||
c.Assert(err, check.IsNil)
|
||||
c.Assert(status, check.Equals, http.StatusCreated)
|
||||
|
||||
bindPath1 := randomTmpDirPath("test1")
|
||||
bindPath2 := randomTmpDirPath("test2")
|
||||
bindPath1 := randomTmpDirPath("test1", daemonPlatform)
|
||||
bindPath2 := randomTmpDirPath("test2", daemonPlatform)
|
||||
|
||||
config = map[string]interface{}{
|
||||
"Binds": []string{bindPath1 + ":/tmp", bindPath2 + ":/tmp"},
|
||||
|
|
|
@ -322,8 +322,8 @@ func (s *DockerSuite) TestRunNoDupVolumes(c *check.C) {
|
|||
// TODO Windows: This test cannot run on a Windows daemon as Windows does
|
||||
// not support volumes
|
||||
testRequires(c, DaemonIsLinux)
|
||||
mountstr1 := randomTmpDirPath("test1") + ":/someplace"
|
||||
mountstr2 := randomTmpDirPath("test2") + ":/someplace"
|
||||
mountstr1 := randomTmpDirPath("test1", daemonPlatform) + ":/someplace"
|
||||
mountstr2 := randomTmpDirPath("test2", daemonPlatform) + ":/someplace"
|
||||
|
||||
if out, _, err := dockerCmdWithError("run", "-v", mountstr1, "-v", mountstr2, "busybox", "true"); err == nil {
|
||||
c.Fatal("Expected error about duplicate volume definitions")
|
||||
|
@ -2012,7 +2012,7 @@ func (s *DockerSuite) TestVolumesNoCopyData(c *check.C) {
|
|||
c.Fatalf("Data was copied on volumes-from but shouldn't be:\n%q", out)
|
||||
}
|
||||
|
||||
tmpDir := randomTmpDirPath("docker_test_bind_mount_copy_data")
|
||||
tmpDir := randomTmpDirPath("docker_test_bind_mount_copy_data", daemonPlatform)
|
||||
if out, _, err := dockerCmdWithError("run", "-v", tmpDir+":/foo", "dataimage", "ls", "-lh", "/foo/bar"); err == nil || !strings.Contains(out, "No such file or directory") {
|
||||
c.Fatalf("Data was copied on bind-mount but shouldn't be:\n%q", out)
|
||||
}
|
||||
|
|
|
@ -61,8 +61,8 @@ func listTar(f io.Reader) ([]string, error) {
|
|||
return integration.ListTar(f)
|
||||
}
|
||||
|
||||
func randomTmpDirPath(s string) string {
|
||||
return integration.RandomTmpDirPath(s)
|
||||
func randomTmpDirPath(s string, platform string) string {
|
||||
return integration.RandomTmpDirPath(s, platform)
|
||||
}
|
||||
|
||||
func consumeWithSpeed(reader io.Reader, chunkSize int, interval time.Duration, stop chan bool) (n int, err error) {
|
||||
|
|
|
@ -11,7 +11,6 @@ import (
|
|||
"os/exec"
|
||||
"path/filepath"
|
||||
"reflect"
|
||||
"runtime"
|
||||
"strings"
|
||||
"syscall"
|
||||
"time"
|
||||
|
@ -247,12 +246,16 @@ func ListTar(f io.Reader) ([]string, error) {
|
|||
|
||||
// RandomTmpDirPath provides a temporary path with rand string appended.
|
||||
// does not create or checks if it exists.
|
||||
func RandomTmpDirPath(s string) string {
|
||||
func RandomTmpDirPath(s string, platform string) string {
|
||||
tmp := "/tmp"
|
||||
if runtime.GOOS == "windows" {
|
||||
if platform == "windows" {
|
||||
tmp = os.Getenv("TEMP")
|
||||
}
|
||||
return filepath.Join(tmp, fmt.Sprintf("%s.%s", s, stringutils.GenerateRandomAlphaOnlyString(10)))
|
||||
path := filepath.Join(tmp, fmt.Sprintf("%s.%s", s, stringutils.GenerateRandomAlphaOnlyString(10)))
|
||||
if platform == "windows" {
|
||||
return filepath.FromSlash(path) // Using \
|
||||
}
|
||||
return filepath.ToSlash(path) // Using /
|
||||
}
|
||||
|
||||
// ConsumeWithSpeed reads chunkSize bytes from reader after every interval.
|
||||
|
|
|
@ -343,7 +343,7 @@ func TestListTar(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestRandomTmpDirPath(t *testing.T) {
|
||||
path := RandomTmpDirPath("something")
|
||||
path := RandomTmpDirPath("something", runtime.GOOS)
|
||||
|
||||
prefix := "/tmp/something"
|
||||
if runtime.GOOS == "windows" {
|
||||
|
|
Loading…
Reference in a new issue