From 0026bd6aeb8ca3559abd02f25ada83dd4dcec722 Mon Sep 17 00:00:00 2001 From: Rich Megginson Date: Thu, 8 Jan 2026 15:21:28 -0700 Subject: [PATCH] test: retry the check for masking/stopping - it may take several seconds to complete retry the check for masking/stopping - it may take several seconds for the unit to be masked and to be stopped Signed-off-by: Rich Megginson --- tests/tests_basic.yml | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/tests/tests_basic.yml b/tests/tests_basic.yml index e39aa5d..f4b7b3b 100644 --- a/tests/tests_basic.yml +++ b/tests/tests_basic.yml @@ -277,18 +277,19 @@ systemd_masked_units: - "{{ test_unit }}" - - name: Get test unit state - 2 + - name: Get test unit state and check status # noqa command-instead-of-module command: systemctl show -p UnitFileState -p SubState "{{ test_unit }}" register: test_unit_state changed_when: false - - - name: Ensure test unit stopped and masked - assert: - that: - - test_unit_state.stdout is search("UnitFileState=masked") or - test_unit_state.stdout is search("UnitFileState=bad") - - test_unit_state.stdout is search("SubState=dead") + until: condition + retries: 6 + delay: 10 + failed_when: not condition + vars: + condition: "{{ (test_unit_state.stdout is search('UnitFileState=masked') or + test_unit_state.stdout is search('UnitFileState=bad')) + and test_unit_state.stdout is search('SubState=dead') }}" - name: Ensure test unit is running and unmasked - 2 include_role: