Skip to content

Commit

Permalink
Add Beyoncé Rule tests for OSS airflow chart strategy (#536)
Browse files Browse the repository at this point in the history
Co-authored-by: pgvishnuram <[email protected]>
  • Loading branch information
danielhoherd and pgvishnuram authored Sep 18, 2024
1 parent fab84d1 commit fac9bc6
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions tests/chart/test_airflow_scheduler.py
Original file line number Diff line number Diff line change
@@ -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"}

0 comments on commit fac9bc6

Please sign in to comment.