summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiloslav Trmač <mitr@redhat.com>2018-07-18 22:04:40 +0200
committerAtomic Bot <atomic-devel@projectatomic.io>2018-07-26 20:47:31 +0000
commit9ff4f40094c5863951c965f6cdf5844843a3fe1b (patch)
tree95d71f4711f4f1a1a598559ce5bba683d164dd51
parenta0575d6e469b15d9cf239dcddabe03fdb7059afd (diff)
downloadpodman-9ff4f40094c5863951c965f6cdf5844843a3fe1b.tar.gz
podman-9ff4f40094c5863951c965f6cdf5844843a3fe1b.tar.bz2
podman-9ff4f40094c5863951c965f6cdf5844843a3fe1b.zip
Skip unit tests which require storage when not running as root
On macOS NewImageRuntimeFromOptions fails with chown EPERM because the "vfs" driver tries to chown its home to root:root 0700; in fact running as root seems to be a generic requirement. So, skip the tests if not running as root. (This could maybe benefit from an extra state, maybe an environment variable like RUNNING_IN_CI, to make sure the tests are actually run often enough.) Signed-off-by: Miloslav Trmač <mitr@redhat.com> Closes: #1115 Approved by: rhatdan
-rw-r--r--libpod/image/image_test.go12
1 files changed, 12 insertions, 0 deletions
diff --git a/libpod/image/image_test.go b/libpod/image/image_test.go
index 2236b2010..0aa637dab 100644
--- a/libpod/image/image_test.go
+++ b/libpod/image/image_test.go
@@ -70,6 +70,10 @@ func makeLocalMatrix(b, bg *Image) ([]localImageTest, error) {
// TestImage_NewFromLocal tests finding the image locally by various names,
// tags, and aliases
func TestImage_NewFromLocal(t *testing.T) {
+ if os.Geteuid() != 0 { // containers/storage requires root access
+ t.Skipf("Test not running as root")
+ }
+
workdir, err := mkWorkDir()
assert.NoError(t, err)
so := storage.StoreOptions{
@@ -108,6 +112,10 @@ func TestImage_NewFromLocal(t *testing.T) {
// TestImage_New tests pulling the image by various names, tags, and from
// different registries
func TestImage_New(t *testing.T) {
+ if os.Geteuid() != 0 { // containers/storage requires root access
+ t.Skipf("Test not running as root")
+ }
+
var names []string
workdir, err := mkWorkDir()
assert.NoError(t, err)
@@ -141,6 +149,10 @@ func TestImage_New(t *testing.T) {
// TestImage_MatchRepoTag tests the various inputs we need to match
// against an image's reponames
func TestImage_MatchRepoTag(t *testing.T) {
+ if os.Geteuid() != 0 { // containers/storage requires root access
+ t.Skipf("Test not running as root")
+ }
+
//Set up
workdir, err := mkWorkDir()
assert.NoError(t, err)