mirror of https://github.com/containers/podman.git
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
This commit is contained in:
parent
a0575d6e46
commit
9ff4f40094
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Reference in New Issue