@@ -19,11 +19,13 @@ limactl validate "$FILE"
19
19
# --cpus=1 is needed for running vz on GHA: https://github.com/lima-vm/lima/pull/1511#issuecomment-1574937888
20
20
LIMACTL_CREATE=(limactl create --tty=false --cpus=1 --memory=1)
21
21
22
+ CONTAINER_ENGINE=" nerdctl"
23
+
22
24
declare -A CHECKS=(
23
25
[" systemd" ]=" 1"
24
26
[" systemd-strict" ]=" 1"
25
27
[" mount-home" ]=" 1"
26
- [" containerd-user " ]=" 1"
28
+ [" container-engine " ]=" 1"
27
29
[" restart" ]=" 1"
28
30
# snapshot tests are too flaky (especially with archlinux)
29
31
[" snapshot-online" ]=" "
@@ -38,7 +40,7 @@ case "$NAME" in
38
40
" alpine" )
39
41
WARNING " Alpine does not support systemd"
40
42
CHECKS[" systemd" ]=
41
- CHECKS[" containerd-user " ]=
43
+ CHECKS[" container-engine " ]=
42
44
;;
43
45
" k3s" )
44
46
ERROR " File \" $FILE \" is not testable with this script"
@@ -62,6 +64,9 @@ case "$NAME" in
62
64
CHECKS[" port-forwards" ]=" "
63
65
CHECKS[" user-v2" ]=1
64
66
;;
67
+ " docker" )
68
+ CONTAINER_ENGINE=" docker"
69
+ ;;
65
70
esac
66
71
67
72
if limactl ls -q | grep -q " $NAME " ; then
172
177
nginx_image=" ghcr.io/stargz-containers/nginx:1.19-alpine-org"
173
178
alpine_image=" ghcr.io/containerd/alpine:3.14.0"
174
179
175
- if [[ -n ${CHECKS["containerd-user "]} ]]; then
180
+ if [[ -n ${CHECKS["container-engine "]} ]]; then
176
181
INFO " Run a nginx container with port forwarding 127.0.0.1:8080"
177
182
set -x
178
- if ! limactl shell " $NAME " nerdctl info; then
183
+ if ! limactl shell " $NAME " $CONTAINER_ENGINE info; then
179
184
limactl shell " $NAME " sudo cat /var/log/cloud-init-output.log
180
- ERROR ' "nerdctl info" failed'
185
+ ERROR " \" ${CONTAINER_ENGINE} info\ " failed"
181
186
exit 1
182
187
fi
183
- limactl shell " $NAME " nerdctl pull --quiet ${nginx_image}
184
- limactl shell " $NAME " nerdctl run -d --name nginx -p 127.0.0.1:8080:80 ${nginx_image}
188
+ limactl shell " $NAME " $CONTAINER_ENGINE pull --quiet ${nginx_image}
189
+ limactl shell " $NAME " $CONTAINER_ENGINE run -d --name nginx -p 127.0.0.1:8080:80 ${nginx_image}
185
190
186
191
timeout 3m bash -euxc " until curl -f --retry 30 --retry-connrefused http://127.0.0.1:8080; do sleep 3; done"
187
192
188
- limactl shell " $NAME " nerdctl rm -f nginx
193
+ limactl shell " $NAME " $CONTAINER_ENGINE rm -f nginx
189
194
set +x
190
195
if [[ -n ${CHECKS["mount-home"]} ]]; then
191
- hometmp=" $HOME /lima-nerdctl -test-tmp"
196
+ hometmp=" $HOME /lima-container-engine -test-tmp"
192
197
# test for https://github.com/lima-vm/lima/issues/187
193
198
INFO " Testing home bind mount (\" $hometmp \" )"
194
199
rm -rf " $hometmp "
195
200
mkdir -p " $hometmp "
196
201
defer " rm -rf \" $hometmp \" "
197
202
set -x
198
- limactl shell " $NAME " nerdctl pull --quiet ${alpine_image}
203
+ limactl shell " $NAME " $CONTAINER_ENGINE pull --quiet ${alpine_image}
199
204
echo " random-content-${RANDOM} " > " $hometmp /random"
200
205
expected=" $( cat " $hometmp /random" ) "
201
- got=" $( limactl shell " $NAME " nerdctl run --rm -v " $hometmp /random" :/mnt/foo ${alpine_image} cat /mnt/foo) "
206
+ got=" $( limactl shell " $NAME " $CONTAINER_ENGINE run --rm -v " $hometmp /random" :/mnt/foo ${alpine_image} cat /mnt/foo) "
202
207
INFO " $hometmp /random: expected=${expected} , got=${got} "
203
208
if [ " $got " != " $expected " ]; then
204
209
ERROR " Home directory is not shared?"
@@ -225,8 +230,8 @@ if [[ -n ${CHECKS["port-forwards"]} ]]; then
225
230
fi
226
231
" ${scriptdir} /test-port-forwarding.pl" " ${NAME} "
227
232
228
- if [[ -n ${CHECKS["containerd-user "]} || ${NAME} == " alpine" ]]; then
229
- INFO " Testing that 'nerdctl run' binds to 0.0.0.0 by default and is forwarded to the host"
233
+ if [[ -n ${CHECKS["container-engine "]} || ${NAME} == " alpine" ]]; then
234
+ INFO " Testing that \" ${CONTAINER_ENGINE} run\" binds to 0.0.0.0 by default and is forwarded to the host"
230
235
if [ " $( uname) " = " Darwin" ]; then
231
236
# macOS runners seem to use `localhost` as the hostname, so the perl lookup just returns `127.0.0.1`
232
237
hostip=$( system_profiler SPNetworkDataType -json | jq -r ' first(.SPNetworkDataType[] | select(.ip_address) | .ip_address) | first' )
@@ -245,9 +250,9 @@ if [[ -n ${CHECKS["port-forwards"]} ]]; then
245
250
rm nerdctl-full.tgz
246
251
sudo=" sudo"
247
252
fi
248
- limactl shell " $NAME " $sudo nerdctl info
249
- limactl shell " $NAME " $sudo nerdctl pull --quiet ${nginx_image}
250
- limactl shell " $NAME " $sudo nerdctl run -d --name nginx -p 8888:80 ${nginx_image}
253
+ limactl shell " $NAME " $sudo $CONTAINER_ENGINE info
254
+ limactl shell " $NAME " $sudo $CONTAINER_ENGINE pull --quiet ${nginx_image}
255
+ limactl shell " $NAME " $sudo $CONTAINER_ENGINE run -d --name nginx -p 8888:80 ${nginx_image}
251
256
252
257
timeout 3m bash -euxc " until curl -f --retry 30 --retry-connrefused http://${hostip} :8888; do sleep 3; done"
253
258
fi
0 commit comments