Skip to content

Commit

Permalink
Add extra permission check in removal test
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
  • Loading branch information
crosbymichael committed Jul 22, 2019
1 parent b006663 commit d6cbeee
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion integration/image/remove_unix_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"io/ioutil"
"os"
"strconv"
"strings"
"syscall"
"testing"
"unsafe"
Expand Down Expand Up @@ -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"])
Expand Down

0 comments on commit d6cbeee

Please sign in to comment.