jedcunningham commented on code in PR #34716:
URL: https://github.com/apache/airflow/pull/34716#discussion_r1356131694


##########
helm_tests/webserver/test_httproute_flower.py:
##########
@@ -0,0 +1,97 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+from __future__ import annotations
+
+import jmespath
+import pytest
+
+from tests.charts.helm_template_generator import render_chart
+
+
+class TestHttpRouteFlower:
+    """Tests httpRoute flower."""
+
+    def 
test_should_pass_validation_with_httproute_enabled_and_gateway_set(self):
+        render_chart(
+            values={"httpRoute": {"flower": {"enabled": True,
+                                          "gateway": {"name": "test-gateway", 
"namespace": "test"}}}},
+            show_only=["templates/flower/flower-httproute.yaml"],
+        )  # checks that no validation exception is raised
+
+    def 
test_should_check_that_both_httproute_and_healthcheckpolicy_are_created(self):
+        docs = render_chart(
+            values={"httpRoute": {"flower": {"enabled": True,
+                                          "gateway": {"name": "test-gateway", 
"namespace": "test"}}}},
+            show_only=["templates/flower/flower-httproute.yaml"],
+        )
+        assert 2 == len(docs)
+        assert "HTTPRoute" == jmespath.search("kind", docs[0])
+        assert "HealthCheckPolicy" == jmespath.search("kind", docs[1])
+
+    def test_should_allow_more_than_one_annotation(self):
+        docs = render_chart(
+            values={"httpRoute": {"flower": {"enabled": True,
+                                          "annotations": {"aa": "bb", "cc": 
"dd"},
+                                          "gateway": {"name": "test-gateway", 
"namespace": "test"}}}},
+            show_only=["templates/flower/flower-httproute.yaml"],
+        )
+        assert {"aa": "bb", "cc": "dd"} == 
jmespath.search("metadata.annotations", docs[0])
+
+    def test_should_set_httproute_gateway_name(self):
+        docs = render_chart(
+            values={"httpRoute": {"flower": {"enabled": True,
+                                          "gateway": {"name": "foo", 
"namespace": "bar"}}}},
+            show_only=["templates/flower/flower-httproute.yaml"],
+        )
+        assert "foo" == jmespath.search("spec.parentRefs[0].name", docs[0])
+
+    def test_should_httproute_hostnames_entry_not_exist(self):
+        docs = render_chart(
+            values={"httpRoute": {"flower": {"enabled": True,
+                                          "gateway": {"name": "test-gateway", 
"namespace": "test"}}}},
+            show_only=["templates/flower/flower-httproute.yaml"],
+        )
+        assert not jmespath.search("spec.hostnames", docs[0])

Review Comment:
   Yeah, let's just rewrite this test to cover them being added.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to