← Back to team overview

curtin-dev team mailing list archive

[Merge] ~raharper/curtin:fix/20200908-fix-vmtest-master into curtin:master

 

Ryan Harper has proposed merging ~raharper/curtin:fix/20200908-fix-vmtest-master into curtin:master.

Requested reviews:
  curtin developers (curtin-dev)
Related bugs:
  Bug #1888726 in systemd (Ubuntu): "systemd-udevd regression: some renamed network interfaces stuck in "pending" state"
  https://bugs.launchpad.net/ubuntu/+source/systemd/+bug/1888726
  Bug #1894910 in linux (Ubuntu): "fallocate swapfile has holes on 5.8 ext4, causes: swapon failed: Invalid argument"
  https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1894910

For more details, see:
https://code.launchpad.net/~raharper/curtin/+git/curtin/+merge/390491

vmtest: Fix multiple issues with vmtest on master

- vmtest: nvme-bcache: do not mark multiple devices bootable that are not bootable, unskip Focal
- vmtest: Fix PsuedoTest test_swaps_used
- vmtest: fix _serial_to_kname lookup of raid by-id paths
- vmtest: Skip test_swaps_used on Groovy until LP: #1894910 is fixed
- vmtest: vlans fail on groovy due to LP: #1888726
- distro: run apt-get clean after dist-upgrade, install, upgrade operations
    
I can submit each of these as a separate PRs, or we can not squash merge ... or I can
combine all of these into a big commit message.

-- 
Your team curtin developers is requested to review the proposed merge of ~raharper/curtin:fix/20200908-fix-vmtest-master into curtin:master.
diff --git a/curtin/distro.py b/curtin/distro.py
index e2af24a..82a4dd5 100644
--- a/curtin/distro.py
+++ b/curtin/distro.py
@@ -264,7 +264,7 @@ def apt_update(target=None, env=None, force=False, comment=None,
 
 
 def run_apt_command(mode, args=None, opts=None, env=None, target=None,
-                    execute=True, allow_daemons=False):
+                    execute=True, allow_daemons=False, clean=True):
     defopts = ['--quiet', '--assume-yes',
                '--option=Dpkg::options::=--force-unsafe-io',
                '--option=Dpkg::Options::=--force-confold']
@@ -289,7 +289,11 @@ def run_apt_command(mode, args=None, opts=None, env=None, target=None,
 
     apt_update(target, env=env, comment=' '.join(cmd))
     with ChrootableTarget(target, allow_daemons=allow_daemons) as inchroot:
-        return inchroot.subp(cmd, env=env)
+        cmd_rv = inchroot.subp(cmd, env=env)
+        if clean and mode in ['dist-upgrade', 'install', 'upgrade']:
+            inchroot.subp(['apt-get', 'clean'])
+
+    return cmd_rv
 
 
 def run_yum_command(mode, args=None, opts=None, env=None, target=None,
diff --git a/examples/tests/nvme_bcache.yaml b/examples/tests/nvme_bcache.yaml
index 4fefd94..ed705c4 100644
--- a/examples/tests/nvme_bcache.yaml
+++ b/examples/tests/nvme_bcache.yaml
@@ -1,8 +1,7 @@
 showtrace: true
 storage:
   config:
-  - grub_device: true
-    id: sda
+  - id: sda
     model: LOGICAL VOLUME
     name: sda
     ptable: gpt
@@ -23,7 +22,7 @@ storage:
     type: disk
     wipe: superblock
   - device: sda
-    flag: boot
+    grub_device: true
     id: sda-part1
     name: sda-part1
     number: 1
@@ -33,7 +32,6 @@ storage:
     uuid: 9f0fda16-c096-4cee-82ac-4f5f294253a2
     wipe: superblock
   - device: sda
-    flag: boot
     id: sda-part2
     name: sda-part2
     number: 2
diff --git a/tests/unittests/test_distro.py b/tests/unittests/test_distro.py
index 23c3fba..380680c 100644
--- a/tests/unittests/test_distro.py
+++ b/tests/unittests/test_distro.py
@@ -449,6 +449,7 @@ class TestSystemUpgrade(CiTestCase):
         auto_remove = apt_base + ['autoremove']
         expected_calls = [
             mock.call(apt_cmd, env=env, target=paths.target_path(target)),
+            mock.call(['apt-get', 'clean'], target=paths.target_path(target)),
             mock.call(auto_remove, env=env, target=paths.target_path(target)),
         ]
         which_calls = [mock.call('eatmydata', target=target)]
diff --git a/tests/vmtests/__init__.py b/tests/vmtests/__init__.py
index 1fc3650..0b19d8f 100644
--- a/tests/vmtests/__init__.py
+++ b/tests/vmtests/__init__.py
@@ -1763,7 +1763,10 @@ class VMBaseClass(TestCase):
                  for line in ls_byid.split('\n')
                  if ("virtio-" + serial) in line.split() or
                     ("scsi-" + serial) in line.split() or
-                    ("wwn-" + serial) in line.split()]
+                    ("wwn-" + serial) in line.split() or
+                    (serial) in line.split()]
+        print("Looking for serial %s in 'ls_al_byid' content\n%s" % (serial,
+                                                                     ls_byid))
         self.assertEqual(len(kname), 1)
         kname = kname.pop()
         self.assertIsNotNone(kname)
@@ -2044,6 +2047,17 @@ class VMBaseClass(TestCase):
 
             return swaps
 
+        # we don't yet have a skip_by_date on specific releases
+        if is_devel_release(self.target_release):
+            name = "test_swaps_used"
+            bug = "1894910"
+            fixby = "2020-10-15"
+            removeby = "2020-11-01"
+            raise SkipTest(
+                "skip_by_date({name}) LP: #{bug} "
+                "fixby={fixby} removeby={removeby}: ".format(
+                    name=name, bug=bug, fixby=fixby, removeby=removeby))
+
         expected_swaps = find_fstab_swaps()
         proc_swaps = self.load_collect_file("proc-swaps")
         for swap in expected_swaps:
@@ -2146,6 +2160,9 @@ class PsuedoVMBaseClass(VMBaseClass):
     def test_kernel_img_conf(self):
         pass
 
+    def test_swaps_used(self):
+        pass
+
     def _maybe_raise(self, exc):
         if self.allow_test_fails:
             raise exc
diff --git a/tests/vmtests/test_network_vlan.py b/tests/vmtests/test_network_vlan.py
index c0776d6..9f1094b 100644
--- a/tests/vmtests/test_network_vlan.py
+++ b/tests/vmtests/test_network_vlan.py
@@ -86,6 +86,7 @@ class FocalTestNetworkVlan(relbase.focal, TestNetworkVlanAbs):
 class GroovyTestNetworkVlan(relbase.groovy, TestNetworkVlanAbs):
     __test__ = True
 
+    @TestNetworkVlanAbs.skip_by_date("1888726", "2020-10-15")
     def test_ip_output(self):
         return super().test_ip_output()
 
diff --git a/tests/vmtests/test_nvme.py b/tests/vmtests/test_nvme.py
index 5da68cf..39f9f3c 100644
--- a/tests/vmtests/test_nvme.py
+++ b/tests/vmtests/test_nvme.py
@@ -139,7 +139,6 @@ class BionicTestNvmeBcache(relbase.bionic, TestNvmeBcacheAbs):
     __test__ = True
 
 
-@TestNvmeBcacheAbs.skip_by_date("1861941", fixby="2020-09-15")
 class FocalTestNvmeBcache(relbase.focal, TestNvmeBcacheAbs):
     __test__ = True
 

References