Skip to content

Commit

Permalink
Add uninstall test to check mount points
Browse files Browse the repository at this point in the history
Signed-off-by: Vitor Savian <[email protected]>
  • Loading branch information
vitorsavian committed Aug 6, 2024
1 parent 19f8ba2 commit 1e79d84
Show file tree
Hide file tree
Showing 6 changed files with 66 additions and 1 deletion.
7 changes: 7 additions & 0 deletions tests/install/fedora/Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,13 @@ Vagrant.configure("2") do |config|

checkK3sProcesses(test.vm)

mountDirs(test.vm)

checkMountPoint(test.vm)

runUninstall(test.vm)

checkMountPoint(test.vm)
end

config.vm.provision 'selinux-status', type: 'shell', run: 'once', inline: 'sestatus'
Expand Down
33 changes: 32 additions & 1 deletion tests/install/install_util.rb
Original file line number Diff line number Diff line change
Expand Up @@ -89,4 +89,35 @@ def checkCGroupV2(vm)
k3s check-config | grep 'cgroups V2 mounted'
SHELL
end
end
end

def mountDirs(vm)
vm.provision "k3s-mount-directory", type: "shell", run: ENV['CI'] == 'true' ? 'never' : 'once' do |sh|
sh.inline = <<~SHELL
#!/usr/bin/env bash
set -eu -o pipefail
echo 'Mounting server dir'
mount --bind /var/lib/rancher/k3s/server /var/lib/rancher/k3s/server
SHELL
end
end
def runUninstall(vm)
vm.provision "k3s-uninstall", type: "shell", run: ENV['CI'] == 'true' ? 'never' : 'once' do |sh|
sh.inline = <<~SHELL
#!/usr/bin/env bash
set -eu -o pipefail
echo 'Uninstall k3s'
k3s-server-uninstall.sh
SHELL
end
end
def checkMountPoint(vm)
vm.provision "k3s-check-mount", type: "shell", run: ENV['CI'] == 'true' ? 'never' : 'once' do |sh|
sh.inline = <<~SHELL
#!/usr/bin/env bash
set -eu -o pipefail
echo 'Check the mount'
mount | grep /var/lib/rancher/k3s/server
SHELL
end
end
7 changes: 7 additions & 0 deletions tests/install/opensuse-leap/Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,13 @@ Vagrant.configure("2") do |config|

checkK3sProcesses(test.vm)

mountDirs(test.vm)

checkMountPoint(test.vm)

runUninstall(test.vm)

checkMountPoint(test.vm)
end

%w[libvirt virtualbox vmware_desktop].each do |p|
Expand Down
7 changes: 7 additions & 0 deletions tests/install/rocky-8/Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,13 @@ Vagrant.configure("2") do |config|

checkK3sProcesses(test.vm)

mountDirs(test.vm)

checkMountPoint(test.vm)

runUninstall(test.vm)

checkMountPoint(test.vm)
end

config.vm.provision 'selinux-status', type: 'shell', run: 'once', inline: 'sestatus'
Expand Down
6 changes: 6 additions & 0 deletions tests/install/rocky-9/Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,12 @@ Vagrant.configure("2") do |config|
checkK3sProcesses(test.vm)

checkCGroupV2(test.vm)

mountDirs(test.vm)

runUninstall(test.vm)

checkMountPoint(test.vm)
end

config.vm.provision 'selinux-status', type: 'shell', run: 'once', inline: 'sestatus'
Expand Down
7 changes: 7 additions & 0 deletions tests/install/ubuntu-2204/Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,13 @@ Vagrant.configure("2") do |config|

checkCGroupV2(test.vm)

mountDirs(test.vm)

checkMountPoint(test.vm)

runUninstall(test.vm)

checkMountPoint(test.vm)
end

%w[libvirt virtualbox vmware_desktop].each do |p|
Expand Down

0 comments on commit 1e79d84

Please sign in to comment.