homeserver/roles/mrlesmithjr.ansible-manage-lvm/molecule/default/tests/test_default.py
mg 169abbedff LVM Konfiguration für docker mit neuer Rolle umgesetzt (#363)
Co-authored-by: Michael Grote <michael.grote@posteo.de>
Reviewed-on: mg/ansible#363
Co-authored-by: mg <michael.grote@posteo.de>
Co-committed-by: mg <michael.grote@posteo.de>
2022-05-17 12:05:45 +02:00

33 lines
916 B
Python

"""Role testing files using testinfra."""
def test_lvm_package_shall_be_installed(host):
assert host.package("lvm2").is_installed
def test_non_persistent_volume_group_is_created(host):
command = """sudo vgdisplay | grep -c 'my_vg'"""
cmd = host.run(command)
assert '1' in cmd.stdout
def test_mylv_logical_volume_is_created(host):
command = """sudo lvs -o lv_name my_vg --separator='|' --noheadings \
| grep -c 'my_lv'"""
cmd = host.run(command)
assert int(cmd.stdout.rstrip()) >= 1
def test_mylv_logical_volume2_is_created(host):
command = """sudo lvs -o lv_name my_vg --separator='|' --noheadings \
| grep -c 'my_lw'"""
cmd = host.run(command)
assert int(cmd.stdout.rstrip()) >= 1
def test_volume_is_mounted(host):
host.file("/var/lib/mountpoint").mode == 0o731
def test_volume2_is_mounted(host):
host.file("/var/lib/mountpoint2").mode == 0o731