Compare commits
5 Commits
d0627af8e7
...
4d20916a96
Author | SHA1 | Date | |
---|---|---|---|
4d20916a96 | |||
43db99bfaa | |||
2cb6d95ec3 | |||
01162e78a3 | |||
22bdcada4a |
@ -23,14 +23,14 @@ Vagrant.configure("2") do |config|
|
||||
master_config.vm.provider :libvirt do |libvirt|
|
||||
libvirt.memory = 768
|
||||
end
|
||||
if salt_bootstrap
|
||||
master_config.vm.provision "shell", path: salt_bootstrap
|
||||
end
|
||||
master_config.vm.provision "shell", env: {'SALT_FILE_ROOTS': salt_file_roots}, inline: <<-SHELL
|
||||
printf 'auto_accept: True\n' > /etc/salt/master.d/notsecure.conf
|
||||
printf "$SALT_FILE_ROOTS" > /etc/salt/master.d/roots.conf
|
||||
systemctl enable --now salt-master
|
||||
SHELL
|
||||
if salt_bootstrap
|
||||
master_config.vm.provision "shell", path: salt_bootstrap
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
21
scullery.py
21
scullery.py
@ -106,6 +106,8 @@ def _setenv(envmap, dump=False):
|
||||
env[variable] = value
|
||||
if dump:
|
||||
fh.write(f'{variable}={value}\n')
|
||||
elif variable in env:
|
||||
del env[variable]
|
||||
if dump:
|
||||
fh.close()
|
||||
|
||||
@ -161,8 +163,7 @@ def runapply(state, target):
|
||||
log.info('\n{}\n'.format(str(sshout)))
|
||||
|
||||
def runtests(payload, hosts):
|
||||
if not os.path.isfile(sshfile):
|
||||
vagrant_sshconfig(sshfile)
|
||||
vagrant_sshconfig(sshfile)
|
||||
testresult = pytest.main(['--verbose', '--hosts={}'.format(','.join(hosts)), '--ssh-config={}'.format(sshfile), payload])
|
||||
log.debug('Test result is {}'.format(str(testresult.value)))
|
||||
if testresult == ExitCode.OK:
|
||||
@ -172,6 +173,13 @@ def runtests(payload, hosts):
|
||||
return False
|
||||
return True
|
||||
|
||||
def _cleanup():
|
||||
for file in [envfile, sshfile]:
|
||||
if os.path.isfile(file):
|
||||
log.debug('Removing {}'.format(file))
|
||||
os.remove(file)
|
||||
|
||||
|
||||
def main_interactive():
|
||||
configmap = _config()
|
||||
boxes = configmap['boxes']
|
||||
@ -208,10 +216,6 @@ def main_interactive():
|
||||
if True in [args.stop, args.force_stop]:
|
||||
log.info('Destroying machines ...')
|
||||
v.destroy()
|
||||
for file in [envfile, sshfile]:
|
||||
if os.path.isfile(file):
|
||||
log.debug('Removing {}'.format(file))
|
||||
os.remove(file)
|
||||
if vagrant_isup(suite)[0] is False:
|
||||
log.debug('OK')
|
||||
else:
|
||||
@ -220,7 +224,9 @@ def main_interactive():
|
||||
log.info('Deployment is already running')
|
||||
elif args.refresh:
|
||||
log.info('Deployment is running, initiating refresh ...')
|
||||
_cleanup()
|
||||
v.provision()
|
||||
vagrant_sshconfig(sshfile)
|
||||
elif status[0] is False:
|
||||
if status[1] is True:
|
||||
log.debug('Deployment is not running')
|
||||
@ -240,6 +246,9 @@ def main_interactive():
|
||||
else:
|
||||
_abort('Start failed')
|
||||
|
||||
if args.stop:
|
||||
_cleanup()
|
||||
|
||||
if args.test:
|
||||
test = suiteconf.get('test', None)
|
||||
if test is None:
|
||||
|
@ -12,7 +12,7 @@ Testing functions for Scullery - a SaltStack testing tool.
|
||||
"""
|
||||
|
||||
import pytest
|
||||
#import os
|
||||
import os
|
||||
import dotenv
|
||||
|
||||
|
||||
|
@ -13,21 +13,6 @@ Testing functions for Scullery - a SaltStack testing tool.
|
||||
|
||||
import pytest
|
||||
|
||||
@pytest.mark.parametrize('config', ['complete'], indirect=True)
|
||||
@pytest.mark.parametrize('suite', [
|
||||
'one_minion_salt',
|
||||
'two_minions_one_master_salt',
|
||||
])
|
||||
def test_salt(script_runner, script, config, suite):
|
||||
cmd = (script, '--config', config, '--suite', suite)
|
||||
result = script_runner.run(*cmd, '--debug', '--env', '--test')
|
||||
# not possible until we have a way to apply without invoking tests
|
||||
# assert result.success
|
||||
assert 'Comment: File /srv/hello_world.txt updated' in result.stderr
|
||||
assert 'Succeeded: 1 (changed=1)' in result.stderr
|
||||
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),
|
||||
@ -38,8 +23,8 @@ def test_salt_test(script_runner, script, config, suite, count):
|
||||
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)',
|
||||
'File /srv/hello_world.txt',
|
||||
'Succeeded: 1',
|
||||
'DEBUG - main_interactive: state.apply requested',
|
||||
'INFO - main_interactive: Initiating tests ...',
|
||||
'DEBUG - runtests: Test result is 0',
|
||||
|
@ -1,16 +1,14 @@
|
||||
[box]
|
||||
bootstrap=tests/scripts/bootstrap.sh
|
||||
image=https://download.opensuse.org/repositories/home:/crameleon:/appliances/openSUSE_Tumbleweed/Tumbleweed.x86_64-libvirt.box
|
||||
name=Tumbleweed.x86_64
|
||||
image=https://download.opensuse.org/repositories/home:/crameleon:/appliances/openSUSE_Tumbleweed/boxes/Tumbleweed.x86_64.json
|
||||
|
||||
[box.tumbleweed]
|
||||
name=tumbleweed
|
||||
|
||||
[box.tumbleweed_bootstrap]
|
||||
name=tumbleweed_bootstrap
|
||||
bootstrap=tests/scripts/bootstrap_hello_world.sh
|
||||
|
||||
[box.tumbleweed_salt]
|
||||
name=tumbleweed_salt
|
||||
bootstrap=tests/scripts/bootstrap_salt.sh
|
||||
|
||||
[suite.one_minion]
|
||||
|
@ -2,7 +2,7 @@
|
||||
bootstrap=scripts/bootstrap.sh
|
||||
|
||||
[box.tumbleweed]
|
||||
image=https://download.opensuse.org/repositories/home:/crameleon:/appliances/openSUSE_Tumbleweed/Tumbleweed.x86_64-libvirt.box
|
||||
image=https://download.opensuse.org/repositories/home:/crameleon:/appliances/openSUSE_Tumbleweed/boxes/Tumbleweed.x86_64.json
|
||||
|
||||
[suite.one_minion]
|
||||
minions=1
|
||||
|
@ -2,8 +2,8 @@
|
||||
bootstrap=scripts/bootstrap.sh
|
||||
|
||||
[box.tumbleweed]
|
||||
name=tumblweed
|
||||
image=https://download.opensuse.org/repositories/home:/crameleon:/appliances/openSUSE_Tumbleweed/Tumbleweed.x86_64-libvirt.box
|
||||
name=Tumbleweed.x86_64
|
||||
image=https://download.opensuse.org/repositories/home:/crameleon:/appliances/openSUSE_Tumbleweed/boxes/Tumbleweed.x86_64.json
|
||||
|
||||
[suite.one_minion]
|
||||
minions=1
|
||||
|
@ -1,9 +1,8 @@
|
||||
[box]
|
||||
bootstrap=tests/scripts/bootstrap_salt.sh
|
||||
image=https://download.opensuse.org/repositories/home:/crameleon:/appliances/openSUSE_Tumbleweed/Tumbleweed.x86_64-libvirt.box
|
||||
|
||||
[box.tumbleweed]
|
||||
name=tumbleweed
|
||||
bootstrap=tests/scripts/bootstrap_salt.sh
|
||||
name=Tumbleweed.x86_64
|
||||
image=https://download.opensuse.org/repositories/home:/crameleon:/appliances/openSUSE_Tumbleweed/boxes/Tumbleweed.x86_64.json
|
||||
|
||||
[suite.one_minion]
|
||||
minions=1
|
||||
|
@ -2,8 +2,8 @@
|
||||
bootstrap=scripts/bootstrap.sh
|
||||
|
||||
[box.tumbleweed]
|
||||
name=tumblweed
|
||||
image=https://download.opensuse.org/repositories/home:/crameleon:/appliances/openSUSE_Tumbleweed/Tumbleweed.x86_64-libvirt.box
|
||||
name=Tumbleweed.x86_64
|
||||
image=https://download.opensuse.org/repositories/home:/crameleon:/appliances/openSUSE_Tumbleweed/boxes/Tumbleweed.x86_64.json
|
||||
|
||||
[suite.one_minion]
|
||||
minions=1
|
||||
|
Loading…
x
Reference in New Issue
Block a user