From cc0a6318254c8be215c4f8b6500e9548292e55c2 Mon Sep 17 00:00:00 2001 From: Krisztian Litkey Date: Tue, 14 Nov 2023 12:26:07 +0200 Subject: [PATCH] test/e2e: Vagrantfile and vagrant usage fixes. Recent vagrants refuse to init if Vagrantfile already exists. Instead of pre-creating Vagrantfile, pass Vagrantfile.in as an ERB template to vagrant init. Also, actively check vagrant status and do fail tests for init-, provisioning-, and up-failures. Signed-off-by: Krisztian Litkey --- test/e2e/lib/vm.bash | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test/e2e/lib/vm.bash b/test/e2e/lib/vm.bash index a52269dff..69e5c9fb6 100644 --- a/test/e2e/lib/vm.bash +++ b/test/e2e/lib/vm.bash @@ -77,7 +77,7 @@ vm-setup() { -e "s/QEMU_MEM/$MEM/" \ -e "s/QEMU_SMP/$CPU/" \ -e "s/QEMU_EXTRA_ARGS/$EXTRA_ARGS/" \ - "$files/Vagrantfile.in" > "$vagrantdir/Vagrantfile" + "$files/Vagrantfile.in" > "$vagrantdir/Vagrantfile.erb" fi if [ ! -f "$vagrantdir/Makefile" ]; then @@ -110,7 +110,7 @@ vm-setup() { make install if [ ! -d .vagrant ]; then - vagrant init $distro + vagrant init --template Vagrantfile $distro || error "failed to vagrant init $distro" fi # If you want to force provisioning of already provisioned vm, @@ -119,10 +119,10 @@ vm-setup() { # cannot be called second time. But this could be used # if the provisioning failed before kubernetes was setup. if [ ! -z "$provision" ]; then - vagrant provision + vagrant provision || error "failed to provision VM" fi - vagrant up --provider qemu + vagrant up --provider qemu || error "failed to bring up VM" vagrant ssh-config > .ssh-config # Add hostname alias to the ssh config so that we can ssh