nyirit commented on code in PR #39132:
URL: https://github.com/apache/airflow/pull/39132#discussion_r1575951958
##########
helm_tests/airflow_aux/test_pod_template_file.py:
##########
@@ -900,3 +900,31 @@ def test_airflow_kerberos_init_container(
if expected_init_containers == 1:
assert initContainers[0]["name"] == "kerberos-init"
assert initContainers[0]["args"] == ["kerberos", "-o"]
+
+ @pytest.mark.parametrize(
+ "cmd, expected",
+ [
+ (["test", "command", "to", "run"], ["test", "command", "to",
"run"]),
+ (["cmd", "{{ .Release.Name }}"], ["cmd", "release-name"]),
+ ],
+ )
+ def test_should_add_command(self, cmd, expected):
+ docs = render_chart(
+ values={
+ "workers": {"command": cmd},
+ },
+ show_only=["templates/pod-template-file.yaml"],
+ chart_dir=self.temp_chart_dir,
+ )
+
+ assert expected == jmespath.search("spec.containers[0].command",
docs[0])
+
+ @pytest.mark.parametrize("values", [{"workers": {"command": None}},
{"workers": {"command": []}}, None])
+ def test_should_not_add_command(self, values):
+ docs = render_chart(
+ values=values,
+ show_only=["templates/pod-template-file.yaml"],
+ chart_dir=self.temp_chart_dir,
+ )
+
+ assert None is jmespath.search("spec.containers[0].command", docs[0])
Review Comment:
Fixed! Initially I added that to the `test_should_not_add_command`, but in
case the default value in `render_chart` changes, that can actually break. So
I've separated it to another test and simplified the other testin
[2d7b526](https://github.com/apache/airflow/pull/39132/commits/2d7b5265b9f88630f456a288c00cd01eeaa03957)
--
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]