Skip to content

Commit

Permalink
Merge pull request #1187 from giuseppe/fix-idmap-test
Browse files Browse the repository at this point in the history
tests: fix idmap mount test
  • Loading branch information
giuseppe authored Apr 7, 2023
2 parents 51b2e07 + 898ffb5 commit 7521731
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 19 deletions.
2 changes: 1 addition & 1 deletion tests/cri-o/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ ENV PATH=/usr/bin:/usr/sbin:/root/go/bin:/usr/local/bin::/usr/local/sbin
RUN yum install -y python git gcc automake autoconf libcap-devel \
systemd-devel yajl-devel libseccomp-devel go-md2man conntrack-tools which \
glibc-static python3-libmount libtool make podman xz nmap-ncat jq bats \
libgcrypt-devel iproute openssl iputils socat criu-libs && \
libgcrypt-devel iproute openssl iputils socat criu-libs irqbalance && \
dnf install -y 'dnf-command(builddep)' && dnf builddep -y podman && \
dnf remove -y golang && \
sudo dnf update -y && \
Expand Down
22 changes: 4 additions & 18 deletions tests/test_mounts.py
Original file line number Diff line number Diff line change
Expand Up @@ -384,27 +384,13 @@ def check(annotation, uidMappings, gidMappings, expected):
return True
return False

# first test with the custom crun annotation
if check("idmap", None, None, "0:0"):
return 1

if check("idmap=uids=0-1-10;gids=0-1-10", None, None, "0:0"):
return 1

if check("idmap=uids=0-2-10#10-100-10;gids=0-1-10", None, None, "1:0"):
return 1

os.chown(target, 1, 2)
if check("idmap=uids=@0-1-10;gids=+0-1-10", None, None, "2:2"):
return 1

# and now test with uidMappings and gidMappings
os.chown(target, 0, 0)

mountMappings = [
{
"hostID": 0,
"containerID": 1,
"containerID": 0,
"hostID": 1,
"size": 10
}
]
Expand All @@ -413,8 +399,8 @@ def check(annotation, uidMappings, gidMappings, expected):

mountMappings = [
{
"hostID": 0,
"containerID": 2,
"containerID": 0,
"hostID": 2,
"size": 10
}
]
Expand Down

0 comments on commit 7521731

Please sign in to comment.