From 89b779b664e521b87b5ee999424c205369df965b Mon Sep 17 00:00:00 2001 From: Griffin Sullivan <48397354+Griffin-Sullivan@users.noreply.github.com> Date: Tue, 3 Oct 2023 12:33:42 -0400 Subject: [PATCH] Add coverage for 2055790 to service enable disable (#12756) * Adding wait for to service enable test * Add coverage for 2055790 to enable disable --- tests/foreman/maintain/test_service.py | 27 ++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/tests/foreman/maintain/test_service.py b/tests/foreman/maintain/test_service.py index 99bb6074ae5..5e9f24c6510 100644 --- a/tests/foreman/maintain/test_service.py +++ b/tests/foreman/maintain/test_service.py @@ -18,6 +18,7 @@ """ from fauxfactory import gen_string import pytest +from wait_for import wait_for from robottelo.config import settings from robottelo.constants import ( @@ -173,6 +174,10 @@ def test_positive_service_enable_disable(sat_maintain): 2. Run satellite-maintain service enable :expectedresults: Services should enable/disable + + :BZ: 1995783, 2055790 + + :customerscenario: true """ result = sat_maintain.cli.Service.stop() assert 'FAIL' not in result.stdout @@ -183,6 +188,28 @@ def test_positive_service_enable_disable(sat_maintain): result = sat_maintain.cli.Service.enable() assert 'FAIL' not in result.stdout assert result.status == 0 + sat_maintain.power_control(state='reboot') + if isinstance(sat_maintain, Satellite): + result, _ = wait_for( + sat_maintain.cli.Service.status, + func_kwargs={'options': {'brief': True, 'only': 'foreman.service'}}, + fail_condition=lambda res: "FAIL" in res.stdout, + handle_exception=True, + delay=30, + timeout=300, + ) + assert 'FAIL' not in sat_maintain.cli.Base.ping() + else: + result, _ = wait_for( + sat_maintain.cli.Service.status, + func_kwargs={'options': {'brief': True}}, + fail_condition=lambda res: "FAIL" in res.stdout, + handle_exception=True, + delay=30, + timeout=300, + ) + assert 'FAIL' not in result.stdout + assert result.status == 0 @pytest.mark.usefixtures('start_satellite_services')