test(molecule): update Vagrant boxes to current releases

- Use published Bento boxes for Ubuntu 26.04, Debian 13, and Rocky Linux 10.1.\n- Pin exact VirtualBox amd64 box versions in CI.\n- Remove the obsolete Ubuntu SSH workaround and update fixtures.
This commit is contained in:
Timothy Stewart
2026-08-01 13:06:11 -05:00
committed by Techno Tim
parent 2babd39c89
commit 68d03acc68
11 changed files with 40 additions and 89 deletions
@@ -70,14 +70,6 @@ write_prewarm_vagrantfile() {
printf '%s\n' "Vagrant.configure('2') do |config|"
printf ' config.vm.box = "%s"\n' "$box"
printf ' config.vm.box_version = "%s"\n' "$version"
# generic/ubuntu2204 does not accept Vagrant's bundled insecure key.
# Match the repository's Molecule connection settings for the short-lived
# prewarm clone so Vagrant can record its linked-clone master.
if [[ "$box" == 'generic/ubuntu2204' ]]; then
printf '%s\n' \
' config.ssh.username = "vagrant"' \
' config.ssh.password = "vagrant"'
fi
printf '%s\n' \
' config.vm.synced_folder ".", "/vagrant", disabled: true' \
' config.vm.hostname = "k3s-ansible-box-prewarm"' \
@@ -10,12 +10,12 @@ mock_bin="$fixture/bin"
mock_state="$fixture/state"
mock_home="$fixture/home"
mock_vagrant_home="$fixture/vagrant-home"
mock_box_dir="$mock_vagrant_home/boxes/generic-VAGRANTSLASH-ubuntu2204/4.3.12/amd64/virtualbox"
mock_box_dir="$mock_vagrant_home/boxes/bento-VAGRANTSLASH-ubuntu-26.04/202606.01.0/amd64/virtualbox"
mock_vbox_root="$mock_home/VirtualBox VMs"
mock_master_root="$mock_home/.cache/k3s-ci/vagrant-masters"
lock_file="$fixture/vagrant-boxes.lock"
mkdir -p -- "$mock_bin" "$mock_state" "$mock_box_dir" "$mock_vbox_root"
printf '%s\n' 'generic/ubuntu2204 4.3.12 amd64' > "$lock_file"
printf '%s\n' 'bento/ubuntu-26.04 202606.01.0 amd64' > "$lock_file"
ln -s "$repo_root/.github/scripts/test-fixtures/mock-vboxmanage" "$mock_bin/VBoxManage"
ln -s "$repo_root/.github/scripts/test-fixtures/mock-vagrant" "$mock_bin/vagrant"
ln -s "$repo_root/.github/scripts/test-fixtures/mock-flock" "$mock_bin/flock"
@@ -45,8 +45,6 @@ second_output="$fixture/second-output"
third_output="$fixture/third-output"
"$script" > "$first_output"
grep -Fq 'config.ssh.username = "vagrant"' "$MOCK_VAGRANTFILE_CAPTURE"
grep -Fq 'config.ssh.password = "vagrant"' "$MOCK_VAGRANTFILE_CAPTURE"
if grep -Fq 'config.ssh.insert_key' "$MOCK_VAGRANTFILE_CAPTURE"; then
printf 'prewarm Vagrantfile unexpectedly overrides Vagrant SSH key insertion\n' >&2
exit 1
@@ -54,7 +52,7 @@ fi
grep -Fq 'virtualbox.memory = 1024' "$MOCK_VAGRANTFILE_CAPTURE"
grep -Fq 'virtualbox.cpus = 2' "$MOCK_VAGRANTFILE_CAPTURE"
grep -Fq 'config.vm.boot_timeout = 600' "$MOCK_VAGRANTFILE_CAPTURE"
mapping_file="$mock_master_root/generic_ubuntu2204-4.3.12-amd64.uuid"
mapping_file="$mock_master_root/bento_ubuntu-26.04-202606.01.0-amd64.uuid"
test -s "$mapping_file"
cmp -s "$mapping_file" "$mock_box_dir/master_id"
grep -Fq 'Created and recorded owned master' "$first_output"
+19 -13
View File
@@ -17,23 +17,29 @@ trap 'rm -rf "$test_root"' EXIT
printf '%s\n' \
'#!/usr/bin/env bash' \
'set -Eeuo pipefail' \
'printf "%s\n" generic/debian12 generic/rocky9 generic/ubuntu2204' \
'printf "%s\n" bento/debian-13 bento/rockylinux-10.1 bento/ubuntu-26.04' \
>"$fake_bin/yq"
printf '%s\n' \
'#!/usr/bin/env bash' \
'set -Eeuo pipefail' \
'emit_box() {' \
' case "$1" in' \
' bento/debian-13) version=202510.26.0 ;;' \
' bento/rockylinux-10.1) version=202512.01.0 ;;' \
' bento/ubuntu-26.04) version=202606.01.0 ;;' \
' *) printf "Unexpected box: %s\n" "$1" >&2; exit 1 ;;' \
' esac' \
' printf "0,,box-name,%s\n" "$1"' \
' printf "0,,box-provider,virtualbox\n"' \
' printf "0,,box-version,4.3.12\n"' \
' printf "0,,box-version,%s\n" "$version"' \
' printf "0,,box-architecture,amd64\n"' \
'}' \
'if [[ "${1:-}" == box && "${2:-}" == list ]]; then' \
' emit_box generic/debian12' \
' emit_box generic/rocky9' \
' emit_box bento/debian-13' \
' emit_box bento/rockylinux-10.1' \
' if [[ "${FAKE_PRESENT_MODE:-all}" == all ]]; then' \
' emit_box generic/ubuntu2204' \
' emit_box bento/ubuntu-26.04' \
' fi' \
'elif [[ "${1:-}" == box && "${2:-}" == add ]]; then' \
' printf "%s\n" "$*" >>"${FAKE_VAGRANT_LOG:?}"' \
@@ -55,13 +61,13 @@ PATH="$fake_bin:$PATH" \
FAKE_VAGRANT_LOG="$fake_log" \
"$repo_root/.github/download-boxes.sh" >"$output"
grep -Fxq \
'box add --provider virtualbox --box-version 4.3.12 --architecture amd64 generic/ubuntu2204' \
'box add --provider virtualbox --box-version 202606.01.0 --architecture amd64 bento/ubuntu-26.04' \
"$fake_log"
incomplete_lock="$test_root/incomplete.lock"
printf '%s\n' \
'generic/debian12 4.3.12 amd64' \
'generic/rocky9 4.3.12 amd64' \
'bento/debian-13 202510.26.0 amd64' \
'bento/rockylinux-10.1 202512.01.0 amd64' \
>"$incomplete_lock"
if PATH="$fake_bin:$PATH" \
VAGRANT_BOX_LOCK_FILE="$incomplete_lock" \
@@ -71,14 +77,14 @@ if PATH="$fake_bin:$PATH" \
exit 1
fi
grep -Fq 'Scenario boxes missing from the lock file:' "$output"
grep -Fq 'generic/ubuntu2204' "$output"
grep -Fq 'bento/ubuntu-26.04' "$output"
duplicate_lock="$test_root/duplicate.lock"
printf '%s\n' \
'generic/debian12 4.3.12 amd64' \
'generic/debian12 4.3.11 amd64' \
'generic/rocky9 4.3.12 amd64' \
'generic/ubuntu2204 4.3.12 amd64' \
'bento/debian-13 202510.26.0 amd64' \
'bento/debian-13 202508.10.0 amd64' \
'bento/rockylinux-10.1 202512.01.0 amd64' \
'bento/ubuntu-26.04 202606.01.0 amd64' \
>"$duplicate_lock"
if PATH="$fake_bin:$PATH" \
VAGRANT_BOX_LOCK_FILE="$duplicate_lock" \
+3 -3
View File
@@ -1,4 +1,4 @@
# box version architecture
generic/debian12 4.3.12 amd64
generic/rocky9 4.3.12 amd64
generic/ubuntu2204 4.3.12 amd64
bento/debian-13 202510.26.0 amd64
bento/rockylinux-10.1 202512.01.0 amd64
bento/ubuntu-26.04 202606.01.0 amd64