From fac9bc6b28ea3fba4ec2290e8ac498d7504d61d5 Mon Sep 17 00:00:00 2001 From: Daniel Hoherd Date: Wed, 18 Sep 2024 13:44:52 -0400 Subject: [PATCH] =?UTF-8?q?Add=20Beyonc=C3=A9=20Rule=20tests=20for=20OSS?= =?UTF-8?q?=20airflow=20chart=20strategy=20(#536)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: pgvishnuram <81585115+pgvishnuram@users.noreply.github.com> --- tests/chart/test_airflow_scheduler.py | 31 +++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 tests/chart/test_airflow_scheduler.py diff --git a/tests/chart/test_airflow_scheduler.py b/tests/chart/test_airflow_scheduler.py new file mode 100644 index 00000000..174ad833 --- /dev/null +++ b/tests/chart/test_airflow_scheduler.py @@ -0,0 +1,31 @@ +# Beyoncé Rule tests for OSS airflow scheduler behaviors + +import pytest + +from tests.chart.helm_template_generator import render_chart + +from .. import supported_k8s_versions + + +@pytest.mark.parametrize("kube_version", supported_k8s_versions) +class TestAirflowScheduler: + def test_scheduler_defaults(self, kube_version): + """Test default behaviors of the scheduler that we rely on.""" + docs = render_chart(kube_version=kube_version, show_only=["charts/airflow/templates/scheduler/scheduler-deployment.yaml"]) + + assert len(docs) == 1 + doc = docs[0] + assert doc["kind"] == "Deployment" + assert doc["spec"]["strategy"] == {"type": "Recreate"} + + def test_scheduler_customizations(self, kube_version): + """Test custom behaviors of the scheduler that we rely on.""" + values = {"airflow": {"scheduler": {"strategy": {"type": "RollingUpdate"}}}} + docs = render_chart( + kube_version=kube_version, show_only=["charts/airflow/templates/scheduler/scheduler-deployment.yaml"], values=values + ) + + assert len(docs) == 1 + doc = docs[0] + assert doc["kind"] == "Deployment" + assert doc["spec"]["strategy"] == {"type": "RollingUpdate"}