Implement Salt test tests
Test the tests. Signed-off-by: Georg Pfuetzenreuter <mail@georg-pfuetzenreuter.net>
This commit is contained in:
parent
8506b12e36
commit
cc15766671
@ -150,7 +150,9 @@ def test_test_incomplete(script_runner, script, config):
|
||||
'one_minion_one_master',
|
||||
'two_minions_one_master',
|
||||
'one_minion_bootstrap',
|
||||
'one_minion_one_master_bootstrap'
|
||||
'one_minion_one_master_bootstrap',
|
||||
'one_minion_salt',
|
||||
'two_minions_one_master_salt'
|
||||
])
|
||||
def test_stop(script_runner, script, config, suite):
|
||||
cmd = (script, '--config', config, '--suite', suite, '--stop', '--force')
|
||||
|
@ -28,3 +28,32 @@ def test_salt(script_runner, script, config, suite):
|
||||
assert 'DEBUG - main_interactive: state.apply requested' in result.stderr
|
||||
assert script_runner.run(*cmd, '--stop')
|
||||
|
||||
@pytest.mark.parametrize('config', ['complete'], indirect=True)
|
||||
@pytest.mark.parametrize('suite,count', [
|
||||
('one_minion_salt', 0),
|
||||
('two_minions_one_master_salt', 1)
|
||||
])
|
||||
def test_salt_test(script_runner, script, config, suite, count):
|
||||
cmd = (script, '--config', config, '--suite', suite)
|
||||
result = script_runner.run(*cmd, '--debug', '--env', '--test')
|
||||
assert result.success
|
||||
for message in [
|
||||
'Comment: File /srv/hello_world.txt updated',
|
||||
'Succeeded: 1 (changed=1)',
|
||||
'DEBUG - main_interactive: state.apply requested',
|
||||
'INFO - main_interactive: Initiating tests ...',
|
||||
'DEBUG - runtests: Test result is 0',
|
||||
'DEBUG - runtests: Test succeeded'
|
||||
]:
|
||||
assert message in result.stderr
|
||||
assert not any(term in result.stderr for term in [
|
||||
'FAILED', 'WARNING - runtests: Tests failed',
|
||||
'DEBUG - runtests: Test result is 1', 'AssertionError'
|
||||
])
|
||||
if count > 0:
|
||||
minions = [0, 1]
|
||||
else:
|
||||
minions = [0]
|
||||
for m in minions:
|
||||
assert 'test_hello_world_content[paramiko://scullery-minion%i] PASSED' % m in result.stdout
|
||||
assert script_runner.run(*cmd, '--stop')
|
||||
|
@ -56,7 +56,7 @@ test=bogus
|
||||
|
||||
[test.hello]
|
||||
apply=hello_world
|
||||
test=salt/hello_world/tests/test_hello.py
|
||||
test=tests/salt/hello_world/tests/test_hello.py
|
||||
|
||||
[test.bogus]
|
||||
apply=cashew
|
||||
|
2
tests/salt/hello_world/tests/test_hello.py
Normal file
2
tests/salt/hello_world/tests/test_hello.py
Normal file
@ -0,0 +1,2 @@
|
||||
def test_hello_world_content(host):
|
||||
assert host.file('/srv/hello_world.txt').content.decode('UTF-8') == 'Hello salted world!\n'
|
Loading…
Reference in New Issue
Block a user