浏览代码

testutil/daemon: shorten XDG_RUNTIME_DIR

XDG_RUNTIME_DIR will contain sockets so its path mustn't be too long.
Prior to this commit, it was set to very long path like
`/go/src/github.com/docker/docker/bundles/test-integration/TestDiskUsage/de4fb36576d7d/xdgrun`

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
Akihiro Suda 1 年之前
父节点
当前提交
ae9fbcb82c
共有 1 个文件被更改,包括 3 次插入1 次删除
  1. 3 1
      testutil/daemon/daemon.go

+ 3 - 1
testutil/daemon/daemon.go

@@ -174,7 +174,9 @@ func NewDaemon(workingDir string, ops ...Option) (*Daemon, error) {
 		if err := os.Chown(d.execRoot, uid, gid); err != nil {
 		if err := os.Chown(d.execRoot, uid, gid); err != nil {
 			return nil, err
 			return nil, err
 		}
 		}
-		d.rootlessXDGRuntimeDir = filepath.Join(d.Folder, "xdgrun")
+		// $XDG_RUNTIME_DIR mustn't be too long, as ${XDG_RUNTIME_DIR/dockerd-rootless
+		// contains Unix sockets
+		d.rootlessXDGRuntimeDir = filepath.Join(os.TempDir(), "xdgrun-"+id)
 		if err := os.MkdirAll(d.rootlessXDGRuntimeDir, 0o700); err != nil {
 		if err := os.MkdirAll(d.rootlessXDGRuntimeDir, 0o700); err != nil {
 			return nil, err
 			return nil, err
 		}
 		}