31 lines
1.1 KiB
Python
31 lines
1.1 KiB
Python
import pytest
|
|
import os
|
|
from conftest import loadenv
|
|
import sys
|
|
|
|
@pytest.mark.parametrize('config', ['complete'], indirect=True)
|
|
@pytest.mark.parametrize('suite', [
|
|
'one_minion_bootstrap',
|
|
'one_minion_one_master_bootstrap',
|
|
])
|
|
def test_bootstrap(script_runner, script, config, suite, vag, testbase):
|
|
bootstrap_script = '{}/scripts/bootstrap_hello_world.txt'.format(testbase)
|
|
do_digest = False
|
|
if sys.version_info[1] > 10:
|
|
do_digest = True
|
|
import hashlib
|
|
with open(bootstrap_script, 'rb') as fh:
|
|
digest_local = hashlib.file_digest(fh, 'md5')
|
|
cmd = (script, '--config', config, '--suite', suite)
|
|
result = script_runner.run(*cmd, '--env')
|
|
assert result.success
|
|
assert result.stderr.endswith('main_interactive: Launching {} ...\n'.format(suite))
|
|
v = vag
|
|
v.env = loadenv()
|
|
assert v.ssh(command='cat /srv/hello_world.txt') == 'Hello world!\n'
|
|
if do_digest:
|
|
digest_remote = v.ssh(command='md5sum /srv/hello_world.txt | awk "{ print $1 }"')
|
|
assert digest_local == digest_remote
|
|
assert script_runner.run(*cmd, '--stop')
|
|
|