test: fix SkipIfRootless() helper

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
This commit is contained in:
Giuseppe Scrivano 2019-03-19 09:49:34 +01:00
parent 4ab7462add
commit 66d2190125
No known key found for this signature in database
GPG Key ID: E4730F97F60286ED
2 changed files with 16 additions and 3 deletions

View File

@ -18,7 +18,11 @@ func SkipIfRemote() {
ginkgo.Skip("This function is not enabled for remote podman")
}
func SkipIfRootless() {}
func SkipIfRootless() {
if os.Geteuid() != 0 {
ginkgo.Skip("This function is not enabled for remote podman")
}
}
// Cleanup cleans up the temporary store
func (p *PodmanTestIntegration) Cleanup() {
@ -135,6 +139,9 @@ func (p *PodmanTestIntegration) CleanupVolume() {
}
func PodmanTestCreate(tempDir string) *PodmanTestIntegration {
if os.Geteuid() != 0 {
ginkgo.Skip("This function is not enabled for rootless podman")
}
pti := PodmanTestCreateUtil(tempDir, true)
pti.StartVarlink()
return pti

View File

@ -20,10 +20,16 @@ import (
"github.com/onsi/gomega/gexec"
)
func SkipIfRemote() {}
func SkipIfRemote() {
if os.Geteuid() != 0 {
ginkgo.Skip("This function is not enabled for rootless podman")
}
}
func SkipIfRootless() {
ginkgo.Skip("This function is not enabled for rootless podman")
if os.Geteuid() != 0 {
ginkgo.Skip("This function is not enabled for rootless podman")
}
}
// Podman is the exec call to podman on the filesystem