wc-s commented on a change in pull request #18481:
URL: https://github.com/apache/airflow/pull/18481#discussion_r715458676



##########
File path: chart/tests/test_annotations.py
##########
@@ -134,5 +138,114 @@ def test_service_account_annotations(self):
 
         self.assertCountEqual(
             list_of_annotation_values_in_objects,
-            CUSTOM_ANNOTATION_VALUES,
+            COMPONENTS_SUPPORTING_CUSTOM_SERVICEACCOUNT_ANNOTATIONS,
         )
+
+    def test_per_component_custom_annotations(self):
+        release_name = "RELEASE_NAME"
+
+        k8s_objects = render_chart(
+            name=release_name,
+            values={
+                "scheduler": {
+                    "podAnnotations": {
+                        "example": "scheduler",
+                    },
+                },
+                "webserver": {
+                    "podAnnotations": {
+                        "example": "webserver",
+                    },
+                },
+                "workers": {
+                    "podAnnotations": {
+                        "example": "worker",
+                    },
+                },
+                "flower": {
+                    "podAnnotations": {
+                        "example": "flower",
+                    },
+                },
+                "airflowVersion": "2.2.0",  # Needed for triggerer to be 
enabled.
+                "triggerer": {
+                    "podAnnotations": {
+                        "example": "triggerer",
+                    },
+                },
+            },
+            show_only=[
+                "templates/scheduler/scheduler-deployment.yaml",
+                "templates/workers/worker-deployment.yaml",
+                "templates/webserver/webserver-deployment.yaml",
+                "templates/flower/flower-deployment.yaml",
+                "templates/triggerer/triggerer-deployment.yaml",
+            ],
+        )
+
+        # The test relies on the convention that the Deployment name
+        # is always `{ Release.Name }-<component_name>`.
+        obj_by_component_name = {
+            obj["metadata"]["name"].replace(release_name + "-", ""): obj for 
obj in k8s_objects
+        }
+
+        self.assertCountEqual(obj_by_component_name, 
COMPONENTS_SUPPORTING_CUSTOM_POD_ANNOTATIONS)
+
+        for component_name, obj in obj_by_component_name.items():
+            self.assertIn("example", 
obj["spec"]["template"]["metadata"]["annotations"])
+            self.assertEqual(component_name, 
obj["spec"]["template"]["metadata"]["annotations"]["example"])

Review comment:
       Sounds good, and me too. Will change.




-- 
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