This is an automated email from the ASF dual-hosted git repository.

potiuk pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git


The following commit(s) were added to refs/heads/main by this push:
     new 6e4623ab53 Revising flower_url_prefix considering default value 
(#33134)
6e4623ab53 is described below

commit 6e4623ab531a1b6755f6847d2587d014a387560d
Author: Amogh Desai <[email protected]>
AuthorDate: Tue Aug 8 01:34:32 2023 +0530

    Revising flower_url_prefix considering default value (#33134)
    
    * Setting overrides with default for flower_url_prefix
    
    * adding test cases
---
 chart/values.yaml                        |  2 +-
 helm_tests/airflow_aux/test_configmap.py | 32 ++++++++++++++++++++++++++++++++
 2 files changed, 33 insertions(+), 1 deletion(-)

diff --git a/chart/values.yaml b/chart/values.yaml
index 9b43582678..de17c8d104 100644
--- a/chart/values.yaml
+++ b/chart/values.yaml
@@ -2129,7 +2129,7 @@ config:
     # For Airflow 1.10
     rbac: 'True'
   celery:
-    flower_url_prefix: '{{ .Values.ingress.flower.path }}'
+    flower_url_prefix: '{{ ternary "" .Values.ingress.flower.path (eq 
.Values.ingress.flower.path "/") }}'
     worker_concurrency: 16
   scheduler:
     standalone_dag_processor: '{{ ternary "True" "False" 
.Values.dagProcessor.enabled }}'
diff --git a/helm_tests/airflow_aux/test_configmap.py 
b/helm_tests/airflow_aux/test_configmap.py
index 3560b19c18..b5df4d6237 100644
--- a/helm_tests/airflow_aux/test_configmap.py
+++ b/helm_tests/airflow_aux/test_configmap.py
@@ -115,3 +115,35 @@ metadata:
 
         pod_template_file = jmespath.search('data."pod_template_file.yaml"', 
docs[0])
         assert "mylabel: release-name" in pod_template_file
+
+    def test_default_flower_url_prefix(self):
+        docs = render_chart(
+            values={
+                "executor": "CeleryExecutor",
+            },
+            show_only=["templates/configmaps/configmap.yaml"],
+        )
+        expected = "flower_url_prefix = "
+        found = False
+        cfg = jmespath.search('data."airflow.cfg"', docs[0])
+        for item in cfg.split("\n"):
+            if item == expected:
+                found = True
+
+        assert found is True
+
+    def test_overriden_flower_url_prefix(self):
+        docs = render_chart(
+            values={"executor": "CeleryExecutor", "ingress": {"flower": 
{"path": "/overriden-path"}}},
+            show_only=["templates/configmaps/configmap.yaml"],
+        )
+
+        expected = "flower_url_prefix = /overriden-path"
+        found = False
+
+        cfg = jmespath.search('data."airflow.cfg"', docs[0])
+        for item in cfg.split("\n"):
+            if item == expected:
+                found = True
+
+        assert found is True

Reply via email to