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

Proposed by Scott Moser
Status: Merged
Merged at revision: 317
Proposed branch: lp://staging/~smoser/curtin/trunk.trusty-raid5bcache
Merge into: lp://staging/~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://staging/~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.staging.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
The diff is not available at this time. You can reload the page or download it.

Subscribers

People subscribed via source and target branches