From 05e48748d253251b120397e0347de2324171eb0b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Tue, 10 Sep 2019 03:33:42 +0200 Subject: [PATCH 1/2] tests: update for not needing custom kernel modules anymore kernel-devel package isn't needed in VMs anymore. --- qubes/tests/integ/grub.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/qubes/tests/integ/grub.py b/qubes/tests/integ/grub.py index 0ddd0166..1860b109 100644 --- a/qubes/tests/integ/grub.py +++ b/qubes/tests/integ/grub.py @@ -47,11 +47,7 @@ class GrubBase(object): if self.template.startswith('fedora-'): cmd_install1 = 'dnf clean expire-cache && ' \ 'dnf install -y qubes-kernel-vm-support grub2-tools' - cmd_install2 = 'dnf install -y kernel-core && ' \ - 'KVER=$(rpm -q --qf ' \ - '\'%{VERSION}-%{RELEASE}.%{ARCH}\\n\' kernel-core|head -1) && ' \ - 'dnf install --allowerasing -y kernel-devel-$KVER && ' \ - 'dkms autoinstall -k $KVER' + cmd_install2 = 'dnf install -y kernel-core' cmd_update_grub = 'grub2-mkconfig -o /boot/grub2/grub.cfg' elif self.template.startswith('debian-'): cmd_install1 = 'apt-get update && apt-get install -y ' \ From c5aaf3abd9dbd813c6f400a8c57578111d958dd1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Tue, 10 Sep 2019 03:34:11 +0200 Subject: [PATCH 2/2] tests: make libvirt mockup more robust If not in offline_mode, return actual mock for libvirt connection object instead of always raising exception. --- qubes/tests/vm/__init__.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/qubes/tests/vm/__init__.py b/qubes/tests/vm/__init__.py index 54564b75..ffb1f7c1 100644 --- a/qubes/tests/vm/__init__.py +++ b/qubes/tests/vm/__init__.py @@ -32,8 +32,14 @@ class TestVMM(object): @property def libvirt_conn(self): - import libvirt - raise libvirt.libvirtError('phony error') + if self.offline_mode: + import libvirt + raise libvirt.libvirtError('phony error') + else: + libvirt_mock = unittest.mock.Mock() + vm_mock = libvirt_mock.lookupByUUID.return_value + vm_mock.isActive.return_value = False + return libvirt_mock class TestHost(object): # pylint: disable=too-few-public-methods