ipatests: test_ipahealthcheck: fix units

df uses 1024 bytes as its default display value, but this can be
tweaked by environment variables or a CLI knob.
Force the output unit to 1024 bytes using the CLI and parse it
accordingly.

Fixes: https://pagure.io/freeipa/issue/8674
Signed-off-by: François Cami <fcami@redhat.com>
Reviewed-By: Florence Blanc-Renaud <frenaud@redhat.com>
This commit is contained in:
François Cami
2021-01-19 15:25:44 +01:00
committed by Rob Crittenden
parent 8021a2066d
commit 6ebfbda203

View File

@@ -1957,8 +1957,10 @@ class TestIpaHealthCheckFilesystemSpace(IntegrationTest):
path = os.path.join('/tmp', str(uuid.uuid4()))
# CI has a single big disk so we may end up allocating most of it.
result = self.master.run_command(['df', '--output=avail', '/tmp'])
free = (int(result.stdout_text.split('\n')[1]) // 1000) - 50
result = self.master.run_command(
['df', '--block-size=1024', '--output=avail', '/tmp']
)
free = (int(result.stdout_text.split('\n')[1]) // 1024) - 50
self.master.run_command(['fallocate', '-l', '%dMiB' % free, path])
yield