Skip to content

Commit

Permalink
test/e2e: Vagrantfile and vagrant usage fixes.
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
klihub authored and askervin committed Nov 15, 2023
1 parent b1a7009 commit cc0a631
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions test/e2e/lib/vm.bash
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand All @@ -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
Expand Down

0 comments on commit cc0a631

Please sign in to comment.