From d38d03953b01c7dd9d7ba3e325af133e4cf17e02 Mon Sep 17 00:00:00 2001 From: Hussein Awala Date: Thu, 1 Jun 2023 14:28:40 +0200 Subject: [PATCH] Improve helm chart wait_for_migration tests --- tests/charts/airflow_core/test_dag_processor.py | 4 +++- tests/charts/airflow_core/test_scheduler.py | 4 +++- tests/charts/airflow_core/test_triggerer.py | 4 +++- tests/charts/webserver/test_webserver.py | 4 +++- 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/tests/charts/airflow_core/test_dag_processor.py b/tests/charts/airflow_core/test_dag_processor.py index 97c2544a817a4..bbc811e447904 100644 --- a/tests/charts/airflow_core/test_dag_processor.py +++ b/tests/charts/airflow_core/test_dag_processor.py @@ -64,7 +64,9 @@ def test_disable_wait_for_migration(self): }, show_only=["templates/dag-processor/dag-processor-deployment.yaml"], ) - actual = jmespath.search("spec.template.spec.initContainers", docs[0]) + actual = jmespath.search( + "spec.template.spec.initContainers[?name=='wait-for-airflow-migrations']", docs[0] + ) assert actual is None def test_should_add_extra_containers(self): diff --git a/tests/charts/airflow_core/test_scheduler.py b/tests/charts/airflow_core/test_scheduler.py index dbf8161f6057c..42ce8549d66d1 100644 --- a/tests/charts/airflow_core/test_scheduler.py +++ b/tests/charts/airflow_core/test_scheduler.py @@ -79,7 +79,9 @@ def test_disable_wait_for_migration(self): }, show_only=["templates/scheduler/scheduler-deployment.yaml"], ) - actual = jmespath.search("spec.template.spec.initContainers", docs[0]) + actual = jmespath.search( + "spec.template.spec.initContainers[?name=='wait-for-airflow-migrations']", docs[0] + ) assert actual is None def test_should_add_extra_init_containers(self): diff --git a/tests/charts/airflow_core/test_triggerer.py b/tests/charts/airflow_core/test_triggerer.py index e5a227a170003..b4589877e07d3 100644 --- a/tests/charts/airflow_core/test_triggerer.py +++ b/tests/charts/airflow_core/test_triggerer.py @@ -82,7 +82,9 @@ def test_disable_wait_for_migration(self): }, show_only=["templates/triggerer/triggerer-deployment.yaml"], ) - actual = jmespath.search("spec.template.spec.initContainers", docs[0]) + actual = jmespath.search( + "spec.template.spec.initContainers[?name=='wait-for-airflow-migrations']", docs[0] + ) assert actual is None def test_should_add_extra_containers(self): diff --git a/tests/charts/webserver/test_webserver.py b/tests/charts/webserver/test_webserver.py index 06b0de62d2f39..d0488b1a8a393 100644 --- a/tests/charts/webserver/test_webserver.py +++ b/tests/charts/webserver/test_webserver.py @@ -254,7 +254,9 @@ def test_disable_wait_for_migration(self): }, show_only=["templates/webserver/webserver-deployment.yaml"], ) - actual = jmespath.search("spec.template.spec.initContainers", docs[0]) + actual = jmespath.search( + "spec.template.spec.initContainers[?name=='wait-for-airflow-migrations']", docs[0] + ) assert actual is None def test_should_add_extra_init_containers(self):