From 7b06d446fc8805e4eab30cffabe74379d7e962d6 Mon Sep 17 00:00:00 2001 From: Sean Marlow Date: Mon, 13 Aug 2018 17:50:41 -0600 Subject: [PATCH] Update GCE services test. Some services are one shot and shutdown. Instead of checking for active check the exit status is success. --- .../tests/SLES/GCE/test_sles_gce_services.py | 27 ++++++++++++++----- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/usr/share/lib/ipa/tests/SLES/GCE/test_sles_gce_services.py b/usr/share/lib/ipa/tests/SLES/GCE/test_sles_gce_services.py index e32b684f..b2e1dd96 100644 --- a/usr/share/lib/ipa/tests/SLES/GCE/test_sles_gce_services.py +++ b/usr/share/lib/ipa/tests/SLES/GCE/test_sles_gce_services.py @@ -2,12 +2,25 @@ @pytest.mark.parametrize('name', [ - ('google-accunts-daemon.service'), - ('google-clock-skew-daemon.service'), - ('google-instance-setup.service'), - ('google-ip-forwarding-daemon.service'), - ('google-shutdown-scripts.service'), - ('google-startup-scripts.service'), + 'google-accounts-daemon.service', + 'google-clock-skew-daemon.service', + 'google-network-daemon.service', + 'google-shutdown-scripts.service' ]) -def test_sles_gce_services(check_service, name): +def test_sles_gce_running_services(check_service, name): assert check_service(name) + + +@pytest.mark.parametrize('name', [ + 'google-instance-setup.service', + 'google-startup-scripts.service', + 'google-shutdown-scripts.service' # Exits but remains active +]) +def test_sles_gce_one_shot_services(host, name): + service = host.service(name) + assert service.is_enabled + + output = host.run( + "systemctl show -p Result {0} | sed 's/Result=//g'".format(name) + ) + assert output.stdout.strip() == 'success'