Merge lp:~smoser/curtin/trunk.trusty-raid5bcache into lp:~curtin-dev/curtin/trunk

Proposed by Scott Moser
Status: Merged
Merged at revision: 317
Proposed branch: lp:~smoser/curtin/trunk.trusty-raid5bcache
Merge into: lp:~curtin-dev/curtin/trunk
Diff against target: 11 lines (+4/-0)
1 file modified
tests/vmtests/test_raid5_bcache.py (+4/-0)
To merge this branch: bzr merge lp:~smoser/curtin/trunk.trusty-raid5bcache
Reviewer Review Type Date Requested Status
Server Team CI bot continuous-integration Approve
curtin developers Pending
Review via email: mp+279674@code.launchpad.net

Commit message

vmtest: do not expect sda-part2 to exist in /dev/disk/by-dname on trusty

This never worked, but we did not see failure before because of a
test case never properly executing.

Description of the change

trunk will now reliably fail like this:
======================================================================
FAIL: test_dname (vmtests.test_raid5_bcache.TrustyTestRaid5Bcache)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/opt/fast/curtin/fix-1514094-v1/tests/vmtests/__init__.py", line 577, in test_dname
    self.assertIn(link, contents)
AssertionError: 'sda-part2' not found in ['bcache0', 'md0']

The reason for that is not actually regression, but fix of the test. my change to tests/vmtests/__init__.py:
     def test_dname(self):
- if (os.path.exists(self.td.mnt + "ls_dname") and
- self.disk_to_check is not None):
- with open(os.path.join(self.td.mnt, "ls_dname"), "r") as fp:
+ fpath = os.path.join(self.td.collect, "ls_dname")
+ if (os.path.exists(fpath) and self.disk_to_check is not None):
+ with open(fpath, "r") as fp:
                 contents = fp.read().splitlines()
             for diskname, part in self.disk_to_check.items():
                 if part is not 0:

Previously the test was not actually doing anything as self.td.mnt did not have a trailing '/', resulting in os.path.exists always returning false. So this test would always pass but never did what was desired.

To post a comment you must log in.
Revision history for this message
Server Team CI bot (server-team-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Scott Moser (smoser) wrote :

trunk will now reliably fail like this:
======================================================================
FAIL: test_dname (vmtests.test_raid5_bcache.TrustyTestRaid5Bcache)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/opt/fast/curtin/fix-1514094-v1/tests/vmtests/__init__.py", line 577, in test_dname
    self.assertIn(link, contents)
AssertionError: 'sda-part2' not found in ['bcache0', 'md0']

The reason for that is not actually regression, but fix of the test. my change to tests/vmtests/__init__.py:
     def test_dname(self):
- if (os.path.exists(self.td.mnt + "ls_dname") and
- self.disk_to_check is not None):
- with open(os.path.join(self.td.mnt, "ls_dname"), "r") as fp:
+ fpath = os.path.join(self.td.collect, "ls_dname")
+ if (os.path.exists(fpath) and self.disk_to_check is not None):
+ with open(fpath, "r") as fp:
                 contents = fp.read().splitlines()
             for diskname, part in self.disk_to_check.items():
                 if part is not 0:

Previously the test was not actually doing anything as self.td.mnt did not have a trailing '/', resulting in os.path.exists always returning false. So this test would always pass but never did what was desired.

Revision history for this message
Diogo Matsubara (matsubara) wrote :

Tests passed successfully with the workaround: https://server-team-jenkins.canonical.com/job/curtin-vmtest/25/

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'tests/vmtests/test_raid5_bcache.py'
2--- tests/vmtests/test_raid5_bcache.py 2015-11-30 22:57:37 +0000
3+++ tests/vmtests/test_raid5_bcache.py 2015-12-05 03:10:55 +0000
4@@ -85,3 +85,7 @@
5 class TrustyTestRaid5Bcache(TestMdadmBcacheAbs):
6 __test__ = True
7 release = "trusty"
8+ # FIXME(LP: #1523037): dname does not work on trusty, so we cannot expect
9+ # sda-part2 to exist in /dev/disk/by-dname as we can on other releases
10+ # when dname works on trusty, then we need to re-enable the expectation
11+ disk_to_check = {'md0': 0}

Subscribers

People subscribed via source and target branches