mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-04-01 09:30:29 +00:00
storage: tests: Ignore cases needing loop devices when not available
- In containers, loopback devices may not be available. Skip tests in this case by looking at the output of losetup setup utility. Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org> Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
parent
86829a29c1
commit
618501f8e6
@ -48,7 +48,13 @@ class Disk():
|
||||
command = 'losetup --show --find {file}'.format(
|
||||
file=self.disk_file.name)
|
||||
process = subprocess.run(command.split(), stdout=subprocess.PIPE,
|
||||
check=True)
|
||||
stderr=subprocess.PIPE)
|
||||
if process.returncode:
|
||||
if b'cannot find an unused loop device' in process.stderr:
|
||||
pytest.skip('Loopback devices not available')
|
||||
else:
|
||||
raise Exception(process.stderr)
|
||||
|
||||
device = process.stdout.decode().strip()
|
||||
|
||||
subprocess.run(['partprobe', device], check=True)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user