Skip to content

Commit 9f422e1

Browse files
committed
test/compose: use cdi option over mount
So that we don't have to overwrite a system dir and also can test rootless. Signed-off-by: Paul Holzinger <[email protected]>
1 parent 926ad11 commit 9f422e1

File tree

3 files changed

+6
-15
lines changed

3 files changed

+6
-15
lines changed

test/compose/cdi_device/setup.sh

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1 @@
1-
if is_rootless; then
2-
reason=" - can't write to /etc/cdi"
3-
_show_ok skip "$testname # skip$reason"
4-
exit 0
5-
fi
6-
7-
mkdir -p /etc/cdi
8-
mount -t tmpfs tmpfs /etc/cdi
9-
cp device.json /etc/cdi
1+
cp device.json $WORKDIR/cdi

test/compose/cdi_device/teardown.sh

Lines changed: 0 additions & 3 deletions
This file was deleted.

test/compose/test-compose

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -198,12 +198,12 @@ function start_service() {
198198

199199
# FIXME: use ${testname} subdir but we can't: 50-char limit in runroot
200200
if ! is_rootless; then
201-
rm -rf $WORKDIR/{root,runroot,networks}
201+
rm -rf $WORKDIR/{root,runroot,networks,cdi}
202202
else
203-
$PODMAN_BIN unshare rm -rf $WORKDIR/{root,runroot,networks}
203+
$PODMAN_BIN unshare rm -rf $WORKDIR/{root,runroot,networks,cdi}
204204
fi
205205
rm -f $DOCKER_SOCK
206-
mkdir --mode 0755 $WORKDIR/{root,runroot,networks}
206+
mkdir --mode 0755 $WORKDIR/{root,runroot,networks,cdi}
207207
chcon --reference=/var/lib/containers $WORKDIR/root
208208

209209
$PODMAN_BIN \
@@ -213,6 +213,7 @@ function start_service() {
213213
--runroot $WORKDIR/runroot \
214214
--cgroup-manager=systemd \
215215
--network-config-dir $WORKDIR/networks \
216+
--cdi-spec-dir $WORKDIR/cdi \
216217
system service \
217218
--time 0 unix://$DOCKER_SOCK \
218219
&> $WORKDIR/server.log &
@@ -240,6 +241,7 @@ function podman() {
240241
--root $WORKDIR/root \
241242
--runroot $WORKDIR/runroot \
242243
--network-config-dir $WORKDIR/networks \
244+
--cdi-spec-dir $WORKDIR/cdi \
243245
"$@")
244246
rc=$?
245247

0 commit comments

Comments
 (0)