Miretpl commented on code in PR #59418:
URL: https://github.com/apache/airflow/pull/59418#discussion_r2624637434
##########
helm-tests/tests/helm_tests/airflow_aux/test_configmap.py:
##########
@@ -302,6 +302,40 @@ def test_execution_api_server_url(
"execution_api_server_url should not be set for Airflow 2.x
versions"
)
+ @pytest.mark.parametrize(
+ ("git_sync_enabled", "ssh_key_secret", "ssh_key", "expected_volume"),
+ [
+ (True, "my-secret", None, True),
+ (True, None, "my-key", True),
+ (True, "my-secret", "my-key", True),
+ (True, None, None, False),
+ (False, "my-secret", None, False),
+ (False, None, "my-key", False),
+ ],
+ )
+ def test_pod_template_git_sync_ssh_key_volume(
+ self, git_sync_enabled, ssh_key_secret, ssh_key, expected_volume
+ ):
+ dag_values = {"gitSync": {"enabled": git_sync_enabled}}
+ if ssh_key_secret:
+ dag_values["gitSync"]["sshKeySecret"] = ssh_key_secret
+ if ssh_key:
+ dag_values["gitSync"]["sshKey"] = ssh_key
+
+ docs = render_chart(
+ values={
+ "executor": "KubernetesExecutor",
+ "dags": dag_values,
+ },
+ show_only=["templates/configmaps/configmap.yaml"],
+ )
+
+ pod_template_file = jmespath.search('data."pod_template_file.yaml"',
docs[0])
+ if expected_volume:
+ assert "git-sync-ssh-key" in pod_template_file
+ else:
+ assert "git-sync-ssh-key" not in pod_template_file
Review Comment:
```suggestion
assert ("git-sync-ssh-key" in pod_template_file) == expected_volume
```
##########
helm-tests/tests/helm_tests/airflow_aux/test_configmap.py:
##########
@@ -302,6 +302,40 @@ def test_execution_api_server_url(
"execution_api_server_url should not be set for Airflow 2.x
versions"
)
+ @pytest.mark.parametrize(
+ ("git_sync_enabled", "ssh_key_secret", "ssh_key", "expected_volume"),
+ [
+ (True, "my-secret", None, True),
+ (True, None, "my-key", True),
+ (True, "my-secret", "my-key", True),
+ (True, None, None, False),
+ (False, "my-secret", None, False),
+ (False, None, "my-key", False),
+ ],
+ )
+ def test_pod_template_git_sync_ssh_key_volume(
+ self, git_sync_enabled, ssh_key_secret, ssh_key, expected_volume
+ ):
+ dag_values = {"gitSync": {"enabled": git_sync_enabled}}
+ if ssh_key_secret:
+ dag_values["gitSync"]["sshKeySecret"] = ssh_key_secret
+ if ssh_key:
+ dag_values["gitSync"]["sshKey"] = ssh_key
Review Comment:
Let's split this test into two test cases based on the settings
(`sshKeySecret` or `sshKey`) that we set. It will be more readable, and in
general, there should be no logic in tests
--
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]