From d6cbeee470105df403b7ae716c923fd11003b67c Mon Sep 17 00:00:00 2001 From: Michael Crosby Date: Mon, 22 Jul 2019 20:39:22 +0000 Subject: [PATCH] Add extra permission check in removal test Signed-off-by: Michael Crosby --- integration/image/remove_unix_test.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/integration/image/remove_unix_test.go b/integration/image/remove_unix_test.go index 984ce5c9d7..428a312742 100644 --- a/integration/image/remove_unix_test.go +++ b/integration/image/remove_unix_test.go @@ -8,6 +8,7 @@ import ( "io/ioutil" "os" "strconv" + "strings" "syscall" "testing" "unsafe" @@ -75,7 +76,11 @@ func TestRemoveImageGarbageCollector(t *testing.T) { argp = uintptr(unsafe.Pointer(&attr)) _, _, errno = syscall.Syscall(syscall.SYS_IOCTL, file.Fd(), fsflags, argp) assert.Equal(t, "errno 0", errno.Error()) - assert.ErrorContains(t, err, "permission denied") + assert.Assert(t, err != nil) + errStr := err.Error() + if !(strings.Contains(errStr, "permission denied") || strings.Contains(errStr, "operation not permitted")) { + t.Errorf("ImageRemove error not an permission error %s", errStr) + } // Verify that layer remaining on disk dir, _ := os.Stat(data["UpperDir"])