Skip to content

Commit

Permalink
Stabilize iso format unit tests
Browse files Browse the repository at this point in the history
Some version of mkisofs does not properly handle if both the input and
the output file of the command are the same. So this commit changes the
unit tests depending on that binary to use a different files.

Related-Bug: #2059809
Change-Id: I6924eb23ff5804c22a48ec6fabcec25f061906bb
(cherry picked from commit c6d8c69)
(cherry picked from commit a8783a7)
(cherry picked from commit 02147b3)
(cherry picked from commit 47428f6)
  • Loading branch information
gibizer authored and Elod Illes committed Jul 16, 2024
1 parent dae4230 commit 11613e7
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions nova/tests/unit/image/test_format_inspector.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,15 @@ def _create_iso(self, image_size, subformat='9660'):
subprocess.check_output(
'dd if=/dev/zero of=%s bs=1M count=%i' % (fn, size),
shell=True)
# We need to use different file as input and output as the behavior
# of mkisofs is version dependent if both the input and the output
# are the same and can cause test failures
out_fn = "%s.iso" % fn
subprocess.check_output(
'%s -V "TEST" -o %s %s' % (base_cmd, fn, fn),
'%s -V "TEST" -o %s %s' % (base_cmd, out_fn, fn),
shell=True)
return fn
self._created_files.append(out_fn)
return out_fn

def _create_img(
self, fmt, size, subformat=None, options=None,
Expand Down

0 comments on commit 11613e7

Please sign in to comment.