Skip to content

Commit

Permalink
test: adjust tests to work in busybox image
Browse files Browse the repository at this point in the history
 * drop -P from grep
 * don't use long --format for 'stat'
 * mount - /usr/bin/mount -> /bin/mount

Signed-off-by: Scott Moser <[email protected]>
  • Loading branch information
smoser committed Nov 13, 2023
1 parent 6cf6ac8 commit e3bd7e2
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion test/env.bats
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ test:
url: $BUSYBOX_OCI
run: |
# make sure that /stacker is readonly
grep "/stacker" /proc/mounts | grep -P "\sro[\s,]"
grep "/stacker" /proc/mounts | grep "[[:space:]]ro[[:space:],]"
# make sure stacker deleted the non-import
[ ! -f /stacker/foo ]
Expand Down
5 changes: 3 additions & 2 deletions test/overlay-dirs.bats
Original file line number Diff line number Diff line change
Expand Up @@ -184,8 +184,9 @@ first:
dest: /usr/local
run: |
[ -f /usr/local/file ]
[ "\$(stat --format=%G /usr/local/file )" == "root" ]
[ "\$(stat --format=%U /usr/local/file )" == "root" ]
# -c == --format, but busybox does not support --format
[ "\$(stat -c%G /usr/local/file )" == "root" ]
[ "\$(stat -c%U /usr/local/file )" == "root" ]
EOF
stacker build

Expand Down
4 changes: 2 additions & 2 deletions test/unprivileged.bats
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,6 @@ EOF

mkdir layer0
mount -t squashfs oci/blobs/sha256/$layer0 layer0
echo "mount has uid $(stat --format "%u" layer0/usr/bin/mount)"
[ "$(stat --format "%u" layer0/usr/bin/mount)" = "0" ]
echo "mount has uid $(stat --format "%u" layer0/bin/mount)"
[ "$(stat --format "%u" layer0/bin/mount)" = "0" ]
}

0 comments on commit e3bd7e2

Please sign in to comment.