mirror of
https://github.com/containers/podman.git
synced 2025-06-12 02:45:09 +08:00
test: fix remote tests for rootless
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
This commit is contained in:
@ -18,6 +18,8 @@ then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
export PODMAN_VARLINK_ADDRESS=unix:/tmp/podman-$(id -u)
|
||||||
|
|
||||||
echo "."
|
echo "."
|
||||||
echo "Hello, my name is $USER and I live in $PWD can I be your friend?"
|
echo "Hello, my name is $USER and I live in $PWD can I be your friend?"
|
||||||
|
|
||||||
|
@ -139,19 +139,21 @@ func (p *PodmanTestIntegration) CleanupVolume() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func PodmanTestCreate(tempDir string) *PodmanTestIntegration {
|
func PodmanTestCreate(tempDir string) *PodmanTestIntegration {
|
||||||
if os.Geteuid() != 0 {
|
|
||||||
ginkgo.Skip("This function is not enabled for rootless podman")
|
|
||||||
}
|
|
||||||
pti := PodmanTestCreateUtil(tempDir, true)
|
pti := PodmanTestCreateUtil(tempDir, true)
|
||||||
pti.StartVarlink()
|
pti.StartVarlink()
|
||||||
return pti
|
return pti
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *PodmanTestIntegration) StartVarlink() {
|
func (p *PodmanTestIntegration) StartVarlink() {
|
||||||
if _, err := os.Stat("/path/to/whatever"); os.IsNotExist(err) {
|
if os.Geteuid() == 0 {
|
||||||
os.MkdirAll("/run/podman", 0755)
|
os.MkdirAll("/run/podman", 0755)
|
||||||
}
|
}
|
||||||
args := []string{"varlink", "--timeout", "0", "unix:/run/podman/io.podman"}
|
varlinkEndpoint := "unix:/run/podman/io.podman"
|
||||||
|
if addr := os.Getenv("PODMAN_VARLINK_ADDRESS"); addr != "" {
|
||||||
|
varlinkEndpoint = addr
|
||||||
|
}
|
||||||
|
|
||||||
|
args := []string{"varlink", "--timeout", "0", varlinkEndpoint}
|
||||||
podmanOptions := getVarlinkOptions(p, args)
|
podmanOptions := getVarlinkOptions(p, args)
|
||||||
command := exec.Command(p.PodmanBinary, podmanOptions...)
|
command := exec.Command(p.PodmanBinary, podmanOptions...)
|
||||||
fmt.Printf("Running: %s %s\n", p.PodmanBinary, strings.Join(podmanOptions, " "))
|
fmt.Printf("Running: %s %s\n", p.PodmanBinary, strings.Join(podmanOptions, " "))
|
||||||
|
Reference in New Issue
Block a user