diff --git a/.github/workflows/review-checks.yml b/.github/workflows/review-checks.yml index 84a82ed3c..c1d7508ed 100644 --- a/.github/workflows/review-checks.yml +++ b/.github/workflows/review-checks.yml @@ -155,6 +155,7 @@ jobs: - LabController os-target: - name: centos:7 + - name: fedora:41 - name: quay.io/centos/centos:stream9 additional_repos: "crb" additional_packages: "epel-release" diff --git a/.packit.yaml b/.packit.yaml index 346472804..8ff7409be 100644 --- a/.packit.yaml +++ b/.packit.yaml @@ -25,10 +25,6 @@ jobs: targets: - fedora-all-x86_64 identifier: fedora - actions: - post-upstream-clone: - # disable broken unit tests - - sed -i '/make check/d' beaker.spec - job: copr_build trigger: pull_request diff --git a/Client/src/bkr/client/tests/test_wizard.py b/Client/src/bkr/client/tests/test_wizard.py index ffdac2693..2605d9034 100644 --- a/Client/src/bkr/client/tests/test_wizard.py +++ b/Client/src/bkr/client/tests/test_wizard.py @@ -5,6 +5,8 @@ import unittest from datetime import date + +import six from six.moves import StringIO from bkr.client import wizard @@ -163,6 +165,6 @@ def test_prints_full_heading(self, cpt_stdout): type.heading() cpt_stdout.seek(0) printout = cpt_stdout.read() - self.assertRegexpMatches(printout, r'\bWhat is the type of test?\b') - self.assertRegexpMatches(printout, r'\bRecommended values\b') - self.assertRegexpMatches(printout, r'\bPossible values\b') + six.assertRegex(self, printout, r'\bWhat is the type of test?\b') + six.assertRegex(self, printout, r'\bRecommended values\b') + six.assertRegex(self, printout, r'\bPossible values\b') diff --git a/Common/bkr/common/test_schema.py b/Common/bkr/common/test_schema.py index a364ff727..93ab6ed80 100644 --- a/Common/bkr/common/test_schema.py +++ b/Common/bkr/common/test_schema.py @@ -18,9 +18,9 @@ def assert_valid(self, xml): def assert_not_valid(self, xml, error_message): schema = lxml.etree.RelaxNG(self.schema_doc) - self.assert_(not schema.validate(lxml.etree.fromstring(xml))) + self.assertTrue(not schema.validate(lxml.etree.fromstring(xml))) messages = [str(e.message) for e in schema.error_log] - self.assert_(error_message in messages, messages) + self.assertTrue(error_message in messages, messages) class TaskSchemaTest(SchemaTestBase): diff --git a/LabController/src/bkr/labcontroller/test_concurrency.py b/LabController/src/bkr/labcontroller/test_concurrency.py index ba9ab0ebb..db9c3727d 100644 --- a/LabController/src/bkr/labcontroller/test_concurrency.py +++ b/LabController/src/bkr/labcontroller/test_concurrency.py @@ -45,8 +45,8 @@ def _test(): timeout=5) p.dead.wait() out = p.stdout_reader.get() - self.assert_(len(out) <= 4096013, len(out)) - self.assert_(out.endswith('+++ DISCARDED'), out[:-10240]) + self.assertTrue(len(out) <= 4096013, len(out)) + self.assertTrue(out.endswith('+++ DISCARDED'), out[:-10240]) greenlet = gevent.spawn(_test) gevent_wait() @@ -56,7 +56,7 @@ def test_timeout_is_enforced(self): def _test(): p = MonitoredSubprocess(['sleep', '10'], timeout=1) p.dead.wait() - self.assertEquals(p.returncode, -signal.SIGTERM) + self.assertEqual(p.returncode, -signal.SIGTERM) greenlet = gevent.spawn(_test) gevent_wait() @@ -123,7 +123,7 @@ def _test(): # The rest of this test hinges on this assertion self._assert_child_is_process_group_leader(p) p.dead.wait() - self.assertEquals(p.returncode, 0) + self.assertEqual(p.returncode, 0) self._assert_process_group_is_removed(p.pid) greenlet = gevent.spawn(_test) diff --git a/LabController/src/bkr/labcontroller/test_netboot.py b/LabController/src/bkr/labcontroller/test_netboot.py index 609c1c32a..2bf92788e 100644 --- a/LabController/src/bkr/labcontroller/test_netboot.py +++ b/LabController/src/bkr/labcontroller/test_netboot.py @@ -164,8 +164,8 @@ def test_fetch_then_clear(self): self.check_netboot_configured("images") kernel_path = os.path.join(self.tftp_root, 'images', TEST_FQDN, 'kernel') initrd_path = os.path.join(self.tftp_root, 'images', TEST_FQDN, 'initrd') - self.assertEquals(os.path.getsize(kernel_path), 4 * 1024 * 1024) - self.assertEquals(os.path.getsize(initrd_path), 8 * 1024 * 1024) + self.assertEqual(os.path.getsize(kernel_path), 4 * 1024 * 1024) + self.assertEqual(os.path.getsize(initrd_path), 8 * 1024 * 1024) netboot.clear_images(TEST_FQDN) self.check_netboot_cleared("images") @@ -181,8 +181,8 @@ def test_fetch_twice(self): self.check_netboot_configured("images") kernel_path = os.path.join(self.tftp_root, 'images', TEST_FQDN, 'kernel') initrd_path = os.path.join(self.tftp_root, 'images', TEST_FQDN, 'initrd') - self.assertEquals(os.path.getsize(kernel_path), 4 * 1024 * 1024) - self.assertEquals(os.path.getsize(initrd_path), 8 * 1024 * 1024) + self.assertEqual(os.path.getsize(kernel_path), 4 * 1024 * 1024) + self.assertEqual(os.path.getsize(initrd_path), 8 * 1024 * 1024) class ArchBasedConfigTest(ImagesBaseTestCase): @@ -243,7 +243,7 @@ def test_configure_symlink_then_clear(self): pxelinux_config_path = os.path.join(pxelinux_bootloader_path, '7F0000FF') pxelinux_default_path = os.path.join(pxelinux_bootloader_path, 'default') open(pxelinux_config_path).readlines() - self.assertEquals(open(pxelinux_config_path).read(), + self.assertEqual(open(pxelinux_config_path).read(), '''default linux prompt 0 timeout 100 @@ -252,7 +252,7 @@ def test_configure_symlink_then_clear(self): ipappend 2 append initrd=../../images/fqdn.example.invalid/initrd console=ttyS0,115200 ks=http://lol/ netboot_method=pxe ''') - self.assertEquals(open(pxelinux_default_path).read(), + self.assertEqual(open(pxelinux_default_path).read(), '''default local prompt 0 timeout 0 @@ -262,14 +262,14 @@ def test_configure_symlink_then_clear(self): self.check_netbootloader_leak(pxelinux_config_path) netboot.clear_pxelinux(TEST_FQDN, bootloader_confs) - self.assert_(not os.path.exists(pxelinux_config_path)) + self.assertTrue(not os.path.exists(pxelinux_config_path)) def test_configure_then_clear(self): netboot.configure_pxelinux(TEST_FQDN, 'console=ttyS0,115200 ks=http://lol/', self.tftp_root) pxelinux_config_path = os.path.join(self.tftp_root, 'pxelinux.cfg', '7F0000FF') pxelinux_default_path = os.path.join(self.tftp_root, 'pxelinux.cfg', 'default') - self.assertEquals(open(pxelinux_config_path).read(), + self.assertEqual(open(pxelinux_config_path).read(), '''default linux prompt 0 timeout 100 @@ -278,7 +278,7 @@ def test_configure_then_clear(self): ipappend 2 append initrd=/images/fqdn.example.invalid/initrd console=ttyS0,115200 ks=http://lol/ netboot_method=pxe ''') - self.assertEquals(open(pxelinux_default_path).read(), + self.assertEqual(open(pxelinux_default_path).read(), '''default local prompt 0 timeout 0 @@ -287,13 +287,13 @@ def test_configure_then_clear(self): ''') self.check_netbootloader_leak(pxelinux_config_path) netboot.clear_pxelinux(TEST_FQDN, self.tftp_root) - self.assert_(not os.path.exists(pxelinux_config_path)) + self.assertTrue(not os.path.exists(pxelinux_config_path)) def test_multiple_initrds(self): netboot.configure_pxelinux(TEST_FQDN, 'initrd=/mydriverdisk.img ks=http://lol/', self.tftp_root) pxelinux_config_path = os.path.join(self.tftp_root, 'pxelinux.cfg', '7F0000FF') - self.assertEquals(open(pxelinux_config_path).read(), + self.assertEqual(open(pxelinux_config_path).read(), '''default linux prompt 0 timeout 100 @@ -332,7 +332,7 @@ def test_doesnt_overwrite_existing_default_config(self): open(pxelinux_default_path, mode).write(custom) netboot.configure_pxelinux(TEST_FQDN, 'console=ttyS0,115200 ks=http://lol/', self.tftp_root) - self.assertEquals(open(pxelinux_default_path).read(), custom) + self.assertEqual(open(pxelinux_default_path).read(), custom) class IpxeTest(NetBootTestCase): @@ -341,27 +341,27 @@ def test_configure_then_clear(self): 'console=ttyS0,115200 ks=http://lol/', self.tftp_root) ipxe_config_path = os.path.join(self.tftp_root, 'ipxe', '7f0000ff') ipxe_default_path = os.path.join(self.tftp_root, 'ipxe', 'default') - self.assertEquals(open(ipxe_config_path).read(), + self.assertEqual(open(ipxe_config_path).read(), '''#!ipxe kernel /images/fqdn.example.invalid/kernel initrd /images/fqdn.example.invalid/initrd imgargs kernel initrd=initrd console=ttyS0,115200 ks=http://lol/ netboot_method=ipxe BOOTIF=01-${netX/mac:hexhyp} boot || exit 1 ''') - self.assertEquals(open(ipxe_default_path).read(), + self.assertEqual(open(ipxe_default_path).read(), '''#!ipxe iseq ${builtin/platform} pcbios && sanboot --no-describe --drive 0x80 || exit 1 ''') self.check_netbootloader_leak(ipxe_config_path) netboot.clear_ipxe(TEST_FQDN, self.tftp_root) - self.assert_(not os.path.exists(ipxe_config_path)) + self.assertTrue(not os.path.exists(ipxe_config_path)) def test_multiple_initrds(self): netboot.configure_ipxe(TEST_FQDN, 'initrd=/mydriverdisk.img ks=http://lol/', self.tftp_root) ipxe_config_path = os.path.join(self.tftp_root, 'ipxe', '7f0000ff') - self.assertEquals(open(ipxe_config_path).read(), + self.assertEqual(open(ipxe_config_path).read(), '''#!ipxe kernel /images/fqdn.example.invalid/kernel initrd /images/fqdn.example.invalid/initrd @@ -393,7 +393,7 @@ def test_doesnt_overwrite_existing_default_config(self): open(ipxe_default_path, mode).write(custom) netboot.configure_ipxe(TEST_FQDN, 'console=ttyS0,115200 ks=http://lol/', self.tftp_root) - self.assertEquals(open(ipxe_default_path).read(), custom) + self.assertEqual(open(ipxe_default_path).read(), custom) class EfigrubTest(NetBootTestCase): @@ -402,7 +402,7 @@ def test_configure_then_clear(self): netboot.configure_efigrub(TEST_FQDN, 'console=ttyS0,115200 ks=http://lol/', self.tftp_root) grub_config_path = os.path.join(self.tftp_root, 'grub', '7F0000FF') - self.assertEquals(open(grub_config_path).read(), + self.assertEqual(open(grub_config_path).read(), '''default 0 timeout 10 title Beaker scheduled job for fqdn.example.invalid @@ -412,13 +412,13 @@ def test_configure_then_clear(self): ''') self.check_netbootloader_leak(grub_config_path) netboot.clear_efigrub(TEST_FQDN, self.tftp_root) - self.assert_(not os.path.exists(grub_config_path)) + self.assertTrue(not os.path.exists(grub_config_path)) def test_multiple_initrds(self): netboot.configure_efigrub(TEST_FQDN, 'initrd=/mydriverdisk.img ks=http://lol/', self.tftp_root) grub_config_path = os.path.join(self.tftp_root, 'grub', '7F0000FF') - self.assertEquals(open(grub_config_path).read(), + self.assertEqual(open(grub_config_path).read(), '''default 0 timeout 10 title Beaker scheduled job for fqdn.example.invalid @@ -452,29 +452,29 @@ def test_configure_then_clear(self): 'DNS=10.16.255.2 PORTNAME=z10-01 DASD=208C,218C,228C,238C ' 'GATEWAY=10.16.71.254 NETWORK=10.16.64.0 ' 'MACADDR=02:DE:AD:BE:EF:01 ks=http://lol/', self.tftp_root) - self.assertEquals(open(os.path.join(self.tftp_root, 's390x', + self.assertEqual(open(os.path.join(self.tftp_root, 's390x', 's_fqdn.example.invalid')).read(), '''ftp://lab.example.invalid/kernel.img ftp://lab.example.invalid/initrd.img ''') - self.assertEquals(open(os.path.join(self.tftp_root, 's390x', + self.assertEqual(open(os.path.join(self.tftp_root, 's390x', 's_fqdn.example.invalid_parm')).read(), '''LAYER2=1 NETTYPE=qeth PORTNO=0 IPADDR=10.16.66.192 SUBCHANNELS=0.0.8000,0.0.8001 ,0.0.8002 MTU=1500 BROADCAST=10.16.71.255 SEARCHDNS= NETMASK=255.255.248.0 DNS=1 0.16.255.2 PORTNAME=z10-01 DASD=208C,218C,228C,238C GATEWAY=10.16.71.254 NETWORK =10.16.64.0 MACADDR=02:DE:AD:BE:EF:01 ks=http://lol/ netboot_method=zpxe ''') - self.assertEquals(open(os.path.join(self.tftp_root, 's390x', + self.assertEqual(open(os.path.join(self.tftp_root, 's390x', 's_fqdn.example.invalid_conf')).read(), '') netboot.clear_zpxe(TEST_FQDN, self.tftp_root) - self.assertEquals(open(os.path.join(self.tftp_root, 's390x', + self.assertEqual(open(os.path.join(self.tftp_root, 's390x', 's_fqdn.example.invalid')).read(), 'local\n') - self.assert_(not os.path.exists(os.path.join(self.tftp_root, 's390x', + self.assertTrue(not os.path.exists(os.path.join(self.tftp_root, 's390x', 's_fqdn.example.invalid_parm'))) - self.assert_(not os.path.exists(os.path.join(self.tftp_root, 's390x', + self.assertTrue(not os.path.exists(os.path.join(self.tftp_root, 's390x', 's_fqdn.example.invalid_conf'))) @@ -484,7 +484,7 @@ def test_configure_then_clear(self): netboot.configure_elilo(TEST_FQDN, 'console=ttyS0,115200 ks=http://lol/', self.tftp_root) elilo_config_path = os.path.join(self.tftp_root, '7F0000FF.conf') - self.assertEquals(open(elilo_config_path).read(), + self.assertEqual(open(elilo_config_path).read(), '''relocatable image=/images/fqdn.example.invalid/kernel @@ -496,7 +496,7 @@ def test_configure_then_clear(self): ''') self.check_netbootloader_leak(elilo_config_path) netboot.clear_elilo(TEST_FQDN, self.tftp_root) - self.assert_(not os.path.exists(elilo_config_path)) + self.assertTrue(not os.path.exists(elilo_config_path)) class YabootTest(NetBootTestCase): @@ -505,7 +505,7 @@ def test_configure_then_clear(self): netboot.configure_yaboot(TEST_FQDN, 'console=ttyS0,115200 ks=http://lol/', self.tftp_root) yaboot_config_path = os.path.join(self.tftp_root, 'etc', '7f0000ff') - self.assertEquals(open(yaboot_config_path).read(), + self.assertEqual(open(yaboot_config_path).read(), '''init-message="Beaker scheduled job for fqdn.example.invalid" timeout=80 delay=10 @@ -517,11 +517,11 @@ def test_configure_then_clear(self): append="console=ttyS0,115200 ks=http://lol/ netboot_method=yaboot" ''') yaboot_symlink_path = os.path.join(self.tftp_root, 'ppc', '7f0000ff') - self.assertEquals(os.readlink(yaboot_symlink_path), '../yaboot') + self.assertEqual(os.readlink(yaboot_symlink_path), '../yaboot') self.check_netbootloader_leak(yaboot_config_path) netboot.clear_yaboot(TEST_FQDN, self.tftp_root) - self.assert_(not os.path.exists(yaboot_config_path)) - self.assert_(not os.path.exists(yaboot_symlink_path)) + self.assertTrue(not os.path.exists(yaboot_config_path)) + self.assertTrue(not os.path.exists(yaboot_symlink_path)) # https://bugzilla.redhat.com/show_bug.cgi?id=829984 def test_configure_twice(self): @@ -530,7 +530,7 @@ def test_configure_twice(self): netboot.configure_yaboot(TEST_FQDN, 'console=ttyS0,115200 ks=http://lol/', self.tftp_root) yaboot_symlink_path = os.path.join(self.tftp_root, 'ppc', '7f0000ff') - self.assertEquals(os.readlink(yaboot_symlink_path), '../yaboot') + self.assertEqual(os.readlink(yaboot_symlink_path), '../yaboot') class Grub2PPC64Test(NetBootTestCase): @@ -542,7 +542,7 @@ def test_configure_then_clear(self): os.path.join(self.tftp_root, 'boot', 'grub2', 'grub.cfg-7F0000FF'), os.path.join(self.tftp_root, 'grub.cfg-7F0000FF')] for path in grub2_configs_path: - self.assertEquals(open(path).read(), """\ + self.assertEqual(open(path).read(), """\ linux /images/fqdn.example.invalid/kernel console=ttyS0,115200 ks=http://lol/ netboot_method=grub2 initrd /images/fqdn.example.invalid/initrd @@ -550,13 +550,13 @@ def test_configure_then_clear(self): """) self.check_netbootloader_leak(path) grub2_symlink_path = os.path.join(self.tftp_root, 'ppc', '7f0000ff-grub2') - self.assertEquals(os.readlink(grub2_symlink_path), + self.assertEqual(os.readlink(grub2_symlink_path), '../boot/grub2/powerpc-ieee1275/core.elf') netboot.clear_ppc64(TEST_FQDN, self.tftp_root) for path in grub2_configs_path: - self.assert_(not os.path.exists(path)) - self.assert_(not os.path.exists(grub2_symlink_path)) + self.assertTrue(not os.path.exists(path)) + self.assertTrue(not os.path.exists(grub2_symlink_path)) class Grub2TestX8664(NetBootTestCase): @@ -570,7 +570,7 @@ def test_configure_then_clear(self): os.path.join(self.tftp_root, 'x86_64', 'grub.cfg')] for path in grub2_configs_path: - self.assertEquals(open(path).read(), """\ + self.assertEqual(open(path).read(), """\ linux /images/fqdn.example.invalid/kernel console=ttyS0,115200 ks=http://lol/ netboot_method=grub2 initrd /images/fqdn.example.invalid/initrd @@ -579,15 +579,15 @@ def test_configure_then_clear(self): self.check_netbootloader_leak(path) for path in grub2_default_path: - self.assertEquals(open(path).read(), 'exit\n') + self.assertEqual(open(path).read(), 'exit\n') netboot.clear_x86_64(TEST_FQDN, self.tftp_root) for path in grub2_configs_path: - self.assert_(not os.path.exists(path)) + self.assertTrue(not os.path.exists(path)) # Keep default for path in grub2_default_path: - self.assert_(os.path.exists(path)) + self.assertTrue(os.path.exists(path)) class Aarch64Test(NetBootTestCase): @@ -597,13 +597,13 @@ def test_configure_then_clear(self): 'console=ttyS0,115200 ks=http://lol/', self.tftp_root) grub_config_path = os.path.join(self.tftp_root, 'aarch64', 'grub.cfg-7F0000FF') grub_default_path = os.path.join(self.tftp_root, 'aarch64', 'grub.cfg') - self.assertEquals(open(grub_config_path).read(), """\ + self.assertEqual(open(grub_config_path).read(), """\ linux /images/fqdn.example.invalid/kernel console=ttyS0,115200 ks=http://lol/ netboot_method=grub2 initrd /images/fqdn.example.invalid/initrd boot """) - self.assertEquals(open(grub_default_path).read(), 'exit\n') + self.assertEqual(open(grub_default_path).read(), 'exit\n') self.check_netbootloader_leak(grub_config_path) netboot.clear_aarch64(TEST_FQDN, self.tftp_root) self.assertFalse(os.path.exists(grub_config_path)) @@ -613,7 +613,7 @@ def test_alternate_devicetree(self): netboot.configure_aarch64(TEST_FQDN, 'devicetree=custom.dtb ks=http://lol/', self.tftp_root) grub_config_path = os.path.join(self.tftp_root, 'aarch64', 'grub.cfg-7F0000FF') - self.assertEquals(open(grub_config_path).read(), """\ + self.assertEqual(open(grub_config_path).read(), """\ linux /images/fqdn.example.invalid/kernel ks=http://lol/ netboot_method=grub2 initrd /images/fqdn.example.invalid/initrd devicetree custom.dtb @@ -628,7 +628,7 @@ def test_configure_then_clear(self): 'ks=http://lol/ ksdevice=bootif', self.tftp_root) petitboot_config_path = os.path.join(self.tftp_root, 'bootloader', TEST_FQDN, 'petitboot.cfg') - self.assertEquals(open(petitboot_config_path).read(), """\ + self.assertEqual(open(petitboot_config_path).read(), """\ default Beaker scheduled job for fqdn.example.invalid label Beaker scheduled job for fqdn.example.invalid kernel ::/images/fqdn.example.invalid/kernel @@ -651,7 +651,7 @@ def test_configure_then_clear(self): ) bootloader_config_symlink = os.path.join(self.tftp_root, 'bootloader', TEST_FQDN, 'image') self.assertTrue(os.path.lexists(bootloader_config_symlink)) - self.assertEquals(os.path.realpath(bootloader_config_symlink), + self.assertEqual(os.path.realpath(bootloader_config_symlink), os.path.join(self.tftp_root, 'myawesome/netbootloader')) # this tests ppc64 netboot creation grub2_config_file = os.path.join(self.tftp_root, 'bootloader', TEST_FQDN,