From d4a488f9d2ca5b5b16309bb9dc425e8f6817a977 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Thu, 17 Jul 2025 16:26:38 -1000 Subject: [PATCH] cover --- tests/integration/fixtures/delay_action_cancellation.yaml | 2 +- tests/integration/test_automations.py | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/tests/integration/fixtures/delay_action_cancellation.yaml b/tests/integration/fixtures/delay_action_cancellation.yaml index dfb7ee0929..1ef964509b 100644 --- a/tests/integration/fixtures/delay_action_cancellation.yaml +++ b/tests/integration/fixtures/delay_action_cancellation.yaml @@ -33,7 +33,7 @@ script: - logger.log: format: "Script execution started (run number %d)" args: ['id(delay_completed_count) + 1'] - - delay: 3s + - delay: 150ms - lambda: |- id(delay_completed_count)++; - logger.log: diff --git a/tests/integration/test_automations.py b/tests/integration/test_automations.py index f1466a3d40..9b697cad83 100644 --- a/tests/integration/test_automations.py +++ b/tests/integration/test_automations.py @@ -92,17 +92,16 @@ async def test_delay_action_cancellation( await asyncio.wait_for(script_started_future, timeout=5.0) assert script_started_count == 1, "Script should have started once" - # Wait a bit to ensure the delay is running - await asyncio.sleep(0.5) + # Restart immediately - no sleep needed since we're properly testing cancellation # Restart the script client.execute_service(restart_service, {}) # Wait for restart confirmation - await asyncio.wait_for(script_restarted_future, timeout=5.0) + await asyncio.wait_for(script_restarted_future, timeout=2.0) # Wait for the restarted script to complete its delay - await asyncio.wait_for(delay_completed_future, timeout=5.0) + await asyncio.wait_for(delay_completed_future, timeout=1.0) # Check the final result client.execute_service(check_result_service, {})