|
| 1 | +"""Role testing files using testinfra.""" |
| 2 | + |
| 3 | + |
| 4 | +def test_vagrant_machine_is_fully_up(host): |
| 5 | + command = """cat myvm.log | grep -c 'myvm: SSH auth method: private key'""" |
| 6 | + cmd = host.run(command) |
| 7 | + assert '1' in cmd.stdout |
| 8 | + |
| 9 | + |
| 10 | +def test_vagrant_machine_is_running(host): |
| 11 | + command = r"""vagrant status | egrep -c 'myvm\s*running\s\(libvirt\)'""" |
| 12 | + cmd = host.run(command) |
| 13 | + assert '1' in cmd.stdout |
| 14 | + |
| 15 | + |
| 16 | +def test_pool_is_started(host): |
| 17 | + command = r""" sudo virsh pool-list --all | |
| 18 | + cut -d " " -f 5 | tail -n +3 | head -n +1 | egrep -c '^active$'""" |
| 19 | + cmd = host.run(command) |
| 20 | + assert '1' in cmd.stdout |
| 21 | + |
| 22 | + |
| 23 | +def test_pool_is_autostarted(host): |
| 24 | + command = r""" sudo virsh pool-list --all | |
| 25 | + cut -d " " -f 8 | tail -n +3 | head -n +1 | egrep -c '^yes$'""" |
| 26 | + cmd = host.run(command) |
| 27 | + assert '1' in cmd.stdout |
| 28 | + |
| 29 | + |
| 30 | +def test_net_is_started(host): |
| 31 | + command = r""" sudo virsh net-list --all | |
| 32 | + cut -d " " -f 5 | tail -n +3 | head -n +1 | egrep -c '^active$'""" |
| 33 | + cmd = host.run(command) |
| 34 | + assert '1' in cmd.stdout |
| 35 | + |
| 36 | + |
| 37 | +def test_net_is_autostarted(host): |
| 38 | + command = r""" sudo virsh net-list --all | |
| 39 | + cut -d " " -f 8 | tail -n +3 | head -n +1 | egrep -c '^yes$'""" |
| 40 | + cmd = host.run(command) |
| 41 | + assert '1' in cmd.stdout |
0 commit comments