Skip to content

Commit

Permalink
fixup! DASDDiscoverTask: use consolidated device configuration with z…
Browse files Browse the repository at this point in the history
…dev (#1802482,#1937049)

As blockdev was already mocked it's not clear to me how the test would mock
that sanitize_dev_input would actually canonicalize a DASD device bus-ID.

So just check that the new code calls execWithRedirect() exactly once and
ignore the arguments.

It would be a separate fix patch to improve a fake sanitize unit test. I
suppose it would need to start with a DASD device bus-ID that is not yet
canonical/sanitized, e.g. something along the lines of:

DASDDiscoverTask("A100").run()
blockdev.s390.sanitize_dev_input.return_value = "0.0.A100"
blockdev.s390.sanitize_dev_input.assert_called_once_with("A100")
sanitized_input = blockdev.s390.sanitize_dev_input.return_value
execWithRedirect.assert_called_once_with(...)

Not sure how much value that would have, though.

Signed-off-by: Steffen Maier <[email protected]>
  • Loading branch information
steffen-maier committed Oct 18, 2023
1 parent 80c3a42 commit 3168bff
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -124,13 +124,13 @@ def test_discovery_fails(self):
DASDDiscoverTask("x.y.z").run()

@patch('pyanaconda.modules.storage.dasd.discover.blockdev')
@patch('pyanaconda.modules.storage.dasd.discover.execWithRedirect')
def test_discovery(self, blockdev):
"""Test the discovery task."""
DASDDiscoverTask("0.0.A100").run()
blockdev.s390.sanitize_dev_input.assert_called_once_with("0.0.A100")

sanitized_input = blockdev.s390.sanitize_dev_input.return_value
blockdev.s390.dasd_online.assert_called_once_with(sanitized_input)
execWithRedirect.assert_called_once()

@patch('pyanaconda.modules.storage.dasd.format.blockdev')
def test_format(self, blockdev):
Expand Down

0 comments on commit 3168bff

Please sign in to comment.