Skip to content

Commit 6dabf34

Browse files
committed
Make test-misc template based on ubuntu-22.04 template
This is an integration test for the `base:` mechanism, and also updates the images used by `test-misc` to match the latest updates. Unrelated: also adds a test for setting the user shell Signed-off-by: Jan Dubois <[email protected]>
1 parent 32b9ccd commit 6dabf34

File tree

4 files changed

+18
-30
lines changed

4 files changed

+18
-30
lines changed

.github/workflows/test.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,8 @@ jobs:
253253
steps:
254254
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
255255
with:
256-
fetch-depth: 1
256+
# To avoid "failed to load YAML file \"templates/experimental/riscv64.yaml\": can't parse builtin Lima version \"3f3a6f6\": 3f3a6f6 is not in dotted-tri format"
257+
fetch-depth: 0
257258
- uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 # v5.3.0
258259
with:
259260
go-version: 1.24.x

hack/cache-common-inc.sh

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,18 @@ function error_exit() {
1818
# ```
1919
function download_template_if_needed() {
2020
local template="$1"
21-
case "${template}" in
22-
https://*)
23-
tmp_yaml=$(mktemp -d)/template.yaml
24-
curl -sSLf "${template}" >"${tmp_yaml}" || return
25-
echo "${tmp_yaml}"
26-
;;
27-
*)
28-
test -f "${template}" || return
29-
echo "${template}"
30-
;;
31-
esac
21+
tmp_yaml="$(mktemp -d)/template.yaml"
22+
# The upgrade test doesn't have limactl installed first. The old version wouldn't support `limactl tmpl` anyways.
23+
if command -v limactl >/dev/null; then
24+
limactl tmpl copy --embed-all "${template}" "${tmp_yaml}" || return
25+
else
26+
if [[ $template == https://* ]]; then
27+
curl -sSLf "${template}" >"${tmp_yaml}" || return
28+
else
29+
cp "${template}" "${tmp_yaml}"
30+
fi
31+
fi
32+
echo "${tmp_yaml}"
3233
}
3334

3435
# e.g.

hack/test-templates.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ fi
207207

208208
if [[ -n ${CHECKS["set-user"]} ]]; then
209209
INFO 'Testing that user settings can be provided by lima.yaml'
210-
limactl shell "$NAME" grep "^john:x:4711:4711:John Doe:/home/john-john" /etc/passwd
210+
limactl shell "$NAME" grep "^john:x:4711:4711:John Doe:/home/john-john:/usr/bin/bash" /etc/passwd
211211
fi
212212

213213
if [[ -n ${CHECKS["proxy-settings"]} ]]; then

hack/test-templates/test-misc.yaml

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,7 @@
33
# - snapshots
44
# - (More to come)
55
#
6-
# This template requires Lima v1.0.0-alpha.0 or later.
7-
images:
8-
# Try to use release-yyyyMMdd image if available. Note that release-yyyyMMdd will be removed after several months.
9-
- location: "https://cloud-images.ubuntu.com/releases/22.04/release-20220902/ubuntu-22.04-server-cloudimg-amd64.img"
10-
arch: "x86_64"
11-
digest: "sha256:c777670007cc5f132417b9e0bc01367ccfc2a989951ffa225bb1952917c3aa81"
12-
- location: "https://cloud-images.ubuntu.com/releases/22.04/release-20220902/ubuntu-22.04-server-cloudimg-arm64.img"
13-
arch: "aarch64"
14-
digest: "sha256:9620f479bd5a6cbf1e805654d41b27f4fc56ef20f916c8331558241734de81ae"
15-
# Fallback to the latest release image.
16-
# Hint: run `limactl prune` to invalidate the cache
17-
- location: "https://cloud-images.ubuntu.com/releases/24.04/release/ubuntu-24.04-server-cloudimg-amd64.img"
18-
arch: "x86_64"
19-
- location: "https://cloud-images.ubuntu.com/releases/24.04/release/ubuntu-24.04-server-cloudimg-arm64.img"
20-
arch: "aarch64"
6+
base: template://ubuntu-22.04
217

228
# 9p is not compatible with `limactl snapshot`
239
mountTypesUnsupported: ["9p"]
@@ -26,8 +12,6 @@ mounts:
2612
writable: true
2713
- location: "/tmp/lima test dir with spaces"
2814
writable: true
29-
- location: "/tmp/lima"
30-
writable: true
3115

3216
param:
3317
BOOT: boot
@@ -64,3 +48,5 @@ user:
6448
comment: John Doe
6549
home: "/home/{{.User}}-{{.User}}"
6650
uid: 4711
51+
# Ubuntu has identical /bin/bash and /usr/bin/bash
52+
shell: /usr/bin/bash

0 commit comments

Comments
 (0)