From e859aec7f3a6f5ce36b8f4c11e574cc26ddfaa0d Mon Sep 17 00:00:00 2001 From: Itxaka Date: Wed, 6 Sep 2023 10:52:09 +0200 Subject: [PATCH] de Signed-off-by: Itxaka --- .../workflows/reusable-provider-tests.yaml | 19 ++++++++++++++++++- tests/provider_upgrade_k8s_test.go | 15 --------------- 2 files changed, 18 insertions(+), 16 deletions(-) diff --git a/.github/workflows/reusable-provider-tests.yaml b/.github/workflows/reusable-provider-tests.yaml index cdaad5abb..c886901bb 100644 --- a/.github/workflows/reusable-provider-tests.yaml +++ b/.github/workflows/reusable-provider-tests.yaml @@ -12,7 +12,9 @@ on: jobs: test: - runs-on: ubuntu-latest + runs-on: + group: Kairos core + labels: release permissions: id-token: write # OIDC support contents: write @@ -32,6 +34,20 @@ jobs: run: | sudo apt-get update sudo apt-get install -y libvirt-clients libvirt-daemon-system libvirt-daemon virtinst bridge-utils qemu qemu-system-x86 qemu-system-x86 qemu-utils qemu-kvm acl udev + + # https://github.blog/changelog/2023-02-23-hardware-accelerated-android-virtualization-on-actions-windows-and-linux-larger-hosted-runners/ + echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules + sudo udevadm control --reload-rules + sudo udevadm trigger --name-match=kvm + sudo usermod -a -G kvm,libvirt runner + # + # TODO: Switch back to the above solution when we switch to the github runners + # https://askubuntu.com/a/1081326 + sudo setfacl -m u:runner:rwx /dev/kvm + - name: block all traffic to metadata ip + run: | + iptables -I INPUT -s 169.254.169.254 -j DROP + iptables -I OUTPUT -d 169.254.169.254 -j DROP - name: Install earthly uses: jimmykarily/luet-install-action@v1.2 with: @@ -45,6 +61,7 @@ jobs: - name: Run tests env: USE_QEMU: true + KVM: true MEMORY: 4000 CPUS: 2 DRIVE_SIZE: 30000 diff --git a/tests/provider_upgrade_k8s_test.go b/tests/provider_upgrade_k8s_test.go index 2094b6ecd..b05cc3cfc 100644 --- a/tests/provider_upgrade_k8s_test.go +++ b/tests/provider_upgrade_k8s_test.go @@ -53,26 +53,14 @@ var _ = Describe("k3s upgrade test", Label("provider", "provider-upgrade-k8s"), Expect(out).Should(ContainSubstring("active (waiting)")) } - vm.EventuallyConnects(1200) - By("find the correct device (qemu vs vbox)") device, err := vm.Sudo(`[[ -e /dev/sda ]] && echo "/dev/sda" || echo "/dev/vda"`) Expect(err).ToNot(HaveOccurred(), device) - vm.EventuallyConnects(1200) - - By("find the correct device (qemu vs vbox)") - device, err = vm.Sudo(`[[ -e /dev/sda ]] && echo "/dev/sda" || echo "/dev/vda"`) - Expect(err).ToNot(HaveOccurred(), device) - - vm.EventuallyConnects(1200) - By("copy the config") err = vm.Scp("assets/single.yaml", "/tmp/config.yaml", "0770") Expect(err).ToNot(HaveOccurred()) - vm.EventuallyConnects(1200) - By("installing") cmd := fmt.Sprintf("kairos-agent --debug manual-install --device %s /tmp/config.yaml", strings.TrimSpace(device)) out, err := vm.Sudo(cmd) @@ -96,7 +84,6 @@ var _ = Describe("k3s upgrade test", Label("provider", "provider-upgrade-k8s"), ContainSubstring("kairos-agent"))) } else { Eventually(func() string { - vm.EventuallyConnects(1200) out, _ := vm.Sudo("systemctl status kairos-agent") return out }, 30*time.Second, 10*time.Second).Should(ContainSubstring( @@ -109,11 +96,9 @@ var _ = Describe("k3s upgrade test", Label("provider", "provider-upgrade-k8s"), "loaded (/usr/lib/systemd/system/systemd-timesyncd.service; enabled; vendor preset: disabled)")) } - vm.EventuallyConnects(1200) By("checking if kairos-agent has started") Eventually(func() string { var out string - vm.EventuallyConnects(1200) if isFlavor(vm, "alpine") { out, _ = vm.Sudo("rc-service kairos-agent status") } else {