mirror of
https://github.com/containers/podman.git
synced 2025-12-16 20:47:47 +08:00
Refactor remote socket path determination in tests
Separate the code that determines the directory and file prefix from the code that chooses and applies a UUID; we will make the second part more complex in a bit. Should not change behavior. Signed-off-by: Miloslav Trmač <mitr@redhat.com>
This commit is contained in:
@@ -274,15 +274,15 @@ func PodmanTestCreateUtil(tempDir string, remote bool) *PodmanTestIntegration {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if remote {
|
if remote {
|
||||||
uuid := stringid.GenerateNonCryptoID()
|
var pathPrefix string
|
||||||
if !rootless.IsRootless() {
|
if !rootless.IsRootless() {
|
||||||
p.RemoteSocket = fmt.Sprintf("unix:/run/podman/podman-%s.sock", uuid)
|
pathPrefix = "/run/podman/podman"
|
||||||
} else {
|
} else {
|
||||||
runtimeDir := os.Getenv("XDG_RUNTIME_DIR")
|
runtimeDir := os.Getenv("XDG_RUNTIME_DIR")
|
||||||
socket := fmt.Sprintf("podman-%s.sock", uuid)
|
pathPrefix = filepath.Join(runtimeDir, "podman")
|
||||||
fqpath := filepath.Join(runtimeDir, socket)
|
|
||||||
p.RemoteSocket = fmt.Sprintf("unix:%s", fqpath)
|
|
||||||
}
|
}
|
||||||
|
uuid := stringid.GenerateNonCryptoID()
|
||||||
|
p.RemoteSocket = fmt.Sprintf("unix:%s-%s.sock", pathPrefix, uuid)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Setup registries.conf ENV variable
|
// Setup registries.conf ENV variable
|
||||||
|
|||||||
Reference in New Issue
Block a user