Merge lp:~raharper/curtin/trunk.fix-build-deb-mock-udev-settle into lp:~curtin-dev/curtin/trunk

Proposed by Ryan Harper
Status: Merged
Merged at revision: 504
Proposed branch: lp:~raharper/curtin/trunk.fix-build-deb-mock-udev-settle
Merge into: lp:~curtin-dev/curtin/trunk
Diff against target: 20 lines (+3/-1)
1 file modified
tests/unittests/test_clear_holders.py (+3/-1)
To merge this branch: bzr merge lp:~raharper/curtin/trunk.fix-build-deb-mock-udev-settle
Reviewer Review Type Date Requested Status
Server Team CI bot continuous-integration Approve
Joshua Powers (community) Approve
Scott Moser (community) Approve
Review via email: mp+324793@code.launchpad.net

Description of the change

Fix deb build by mocking call to udevadm settle

The sbuild chroot environment does not have the 'udevadm' command. A
recent unittest now invokes 'udevadm settle' which is not mocked and
failed due to the missing command in the build environment. Fix by
adding a mock to the call to udevadm.

To post a comment you must log in.
Revision history for this message
Ryan Harper (raharper) wrote :

I've verified that sbuild'ing with this branch works.

1. ./tools/build-deb -S -us -uc
2. sbuild --arch-all -d xenial curtin_0.1.0~bzr504-0ubuntu1.dsc

The above fails on trunk, but is successful on this branch.

Revision history for this message
Scott Moser (smoser) wrote :

i'd like a link to the failure. but assuming the failure is that there is no 'udevadm' in the build environment (which is sane as we do not build-depend on it), then that seems fine.

review: Approve
Revision history for this message
Joshua Powers (powersj) wrote :

LGTM - thanks for fixing this :)

review: Approve
Revision history for this message
Ryan Harper (raharper) wrote :

On Tue, May 30, 2017 at 10:57 AM, Scott Moser <email address hidden> wrote:

> Review: Approve
>
> i'd like a link to the failure. but assuming the failure is that there is
> no 'udevadm' in the build environment (which is sane as we do not
> build-depend on it), then that seems fine.
>

 https://jenkins.ubuntu.com/server/job/curtin-build/179/console

>
> --
> https://code.launchpad.net/~raharper/curtin/trunk.fix-
> build-deb-mock-udev-settle/+merge/324793
> You are the owner of lp:~raharper/curtin/trunk.fix-
> build-deb-mock-udev-settle.
>

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 :

+1

======================================================================
ERROR: test clear_holders.shutdown_bcache
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/mock/mock.py", line 1305, in patched
    return func(*args, **keywargs)
  File "/<<PKGBUILDDIR>>/tests/unittests/test_clear_holders.py", line 159, in test_shutdown_bcache
    clear_holders.shutdown_bcache(device)
  File "/<<PKGBUILDDIR>>/curtin/block/clear_holders.py", line 144, in shutdown_bcache
    udev.udevadm_settle()
  File "/<<PKGBUILDDIR>>/curtin/udev.py", line 68, in udevadm_settle
    util.subp(settle_cmd)
  File "/<<PKGBUILDDIR>>/curtin/util.py", line 194, in subp
    return _subp(*args, **kwargs)
  File "/<<PKGBUILDDIR>>/curtin/util.py", line 115, in _subp
    raise ProcessExecutionError(cmd=args, reason=e)
ProcessExecutionError: Unexpected error while running command.
Command: ['udevadm', 'settle']
Exit code: -
Reason: [Errno 2] No such file or directory
Stdout: ''
Stderr: ''

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'tests/unittests/test_clear_holders.py'
2--- tests/unittests/test_clear_holders.py 2017-05-17 00:14:07 +0000
3+++ tests/unittests/test_clear_holders.py 2017-05-30 15:50:37 +0000
4@@ -129,13 +129,15 @@
5 mock_block.path_to_kname.assert_called_with(self.test_syspath)
6 mock_get_dmsetup_uuid.assert_called_with(self.test_syspath)
7
8+ @mock.patch('curtin.block.clear_holders.udev.udevadm_settle')
9 @mock.patch('curtin.block.clear_holders.get_bcache_sys_path')
10 @mock.patch('curtin.block.clear_holders.util')
11 @mock.patch('curtin.block.clear_holders.os')
12 @mock.patch('curtin.block.clear_holders.LOG')
13 @mock.patch('curtin.block.clear_holders.get_bcache_using_dev')
14 def test_shutdown_bcache(self, mock_get_bcache, mock_log, mock_os,
15- mock_util, mock_get_bcache_block):
16+ mock_util, mock_get_bcache_block,
17+ mock_udevadm_settle):
18 """test clear_holders.shutdown_bcache"""
19 #
20 # pass in a sysfs path to a bcache block device,

Subscribers

People subscribed via source and target branches