From 203bd1e734513068f6d7bc3f056e3732d9589376 Mon Sep 17 00:00:00 2001 From: Sean Marlow Date: Fri, 9 Oct 2020 17:48:34 -0500 Subject: [PATCH] Add cloud init tests for alibaba images. --- .../tests/SLES/Alibaba/test_sles_alibaba.yaml | 2 ++ .../SLES/Alibaba/test_sles_alibaba_services.py | 18 ++++++++++++++++++ 2 files changed, 20 insertions(+) create mode 100644 usr/share/lib/img_proof/tests/SLES/Alibaba/test_sles_alibaba.yaml create mode 100644 usr/share/lib/img_proof/tests/SLES/Alibaba/test_sles_alibaba_services.py diff --git a/usr/share/lib/img_proof/tests/SLES/Alibaba/test_sles_alibaba.yaml b/usr/share/lib/img_proof/tests/SLES/Alibaba/test_sles_alibaba.yaml new file mode 100644 index 00000000..dcd0515f --- /dev/null +++ b/usr/share/lib/img_proof/tests/SLES/Alibaba/test_sles_alibaba.yaml @@ -0,0 +1,2 @@ +tests: + - test_sles_alibaba_services diff --git a/usr/share/lib/img_proof/tests/SLES/Alibaba/test_sles_alibaba_services.py b/usr/share/lib/img_proof/tests/SLES/Alibaba/test_sles_alibaba_services.py new file mode 100644 index 00000000..9c406750 --- /dev/null +++ b/usr/share/lib/img_proof/tests/SLES/Alibaba/test_sles_alibaba_services.py @@ -0,0 +1,18 @@ +import pytest + + +@pytest.mark.parametrize('name', [ + ('cloud-init-local'), + ('cloud-init'), + ('cloud-config'), + ('cloud-final') +]) +def test_sles_alibaba_one_shot_services(check_service, host, name): + assert check_service(name, running=None) + + if host.exists('systemctl'): + # No clear way to check a service exited successfully using sysvinit + output = host.run( + "systemctl show -p Result {0} | sed 's/Result=//g'".format(name) + ) + assert output.stdout.strip() == 'success'