From 8bc3173bbf88b1baa724b2e4d182d690fc3e67e6 Mon Sep 17 00:00:00 2001 From: Georg Pfuetzenreuter Date: Sun, 21 May 2023 05:42:38 +0200 Subject: [PATCH] Re-order stop tests Signed-off-by: Georg Pfuetzenreuter --- tests/test_cli.py | 50 ++++++++++++++++++++++++++++++----------------- 1 file changed, 32 insertions(+), 18 deletions(-) diff --git a/tests/test_cli.py b/tests/test_cli.py index 308dc46..90dbf18 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -110,24 +110,6 @@ def test_launch_stop(script_runner, script, virt, config, suite): assert not any('scullery' in domain for domain in domains) -@pytest.mark.parametrize('config', ['complete'], indirect=True) -@pytest.mark.parametrize('suite', [ - 'one_minion', - 'two_minions', - 'one_master', - 'one_minion_one_master', - 'two_minions_one_master' - ]) -def test_stop(script_runner, script, virt, config, suite): - cmd = (script, '--config', config, '--suite', suite, '--stop') - result = script_runner.run(*cmd) - assert result.success - domains = [] - for domain in virt.listDomainsID(): - domains.append(virt.lookupByID(domain).name()) - assert not any('scullery' in domain for domain in domains) - - @pytest.mark.parametrize('config', ['complete'], indirect=True) @pytest.mark.parametrize('suite,masters,minions', [ ('one_minion', None, 'scullery-minion0'), @@ -150,3 +132,35 @@ def test_envfile(script_runner, script, config, suite, masters, minions): script_runner.run(*cmd, '--stop') assert os.path.isfile(envfile) is False + +@pytest.mark.parametrize('config', ['complete'], indirect=True) +@pytest.mark.parametrize('suite', [ + 'one_minion', + 'two_minions', + 'one_master', + 'one_minion_one_master', + 'two_minions_one_master' + ]) +def test_stop(script_runner, script, virt, config, suite): + cmd = (script, '--config', config, '--suite', suite, '--stop') + result = script_runner.run(*cmd) + assert result.success + domains = [] + for domain in virt.listDomainsID(): + domains.append(virt.lookupByID(domain).name()) + assert not any('scullery' in domain for domain in domains) + + +@pytest.mark.parametrize('config', ['complete'], indirect=True) +@pytest.mark.parametrize('suite', [ + 'one_minion', + 'two_minions', + 'one_master', + 'one_minion_one_master', + 'two_minions_one_master' + ]) +def test_already_stopped(script_runner, script, virt, config, suite): + cmd = (script, '--config', config, '--suite', suite, '--stop', '--debug') + result = script_runner.run(*cmd) + assert result.success + assert result.stderr.endswith('DEBUG - main_interactive: Deployment is not running\n')