Service(airflow_service).is_running fails testing airflow-scheduler
Closed this issue · 0 comments
jnogol commented
Due to the scheduler is not constantly up & running and reboots itself every five seconds, Service(airflow_service).is_running
assertion fails depending on the moment it is checked.
To fix this, we are going to add the @retry
decorator from retrying
Python module and make test_airflow_services
check if the services are running during a maximum of 5 seconds:
from retrying import retry
@retry(stop_max_delay=5000)
def test_airflow_services(Service, AnsibleDefaults):
airflow_services = AnsibleDefaults["airflow_services"]
for airflow_service in airflow_services:
if airflow_services[airflow_service]["enabled"]:
assert Service(airflow_service).is_enabled
assert Service(airflow_service).is_running