Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions helm-tests/tests/chart_utils/log_groomer.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ def test_log_groomer_command_and_args_overrides_are_templated(self):
assert jmespath.search("spec.template.spec.containers[1].command", docs[0]) == ["release-name"]
assert jmespath.search("spec.template.spec.containers[1].args", docs[0]) == ["Helm"]

@pytest.mark.parametrize("retention_days, retention_result", [(None, None), (30, "30")])
@pytest.mark.parametrize(("retention_days", "retention_result"), [(None, None), (30, "30")])
def test_log_groomer_retention_days_overrides(self, retention_days, retention_result):
if self.obj_name == "dag-processor":
values = {
Expand All @@ -191,7 +191,7 @@ def test_log_groomer_retention_days_overrides(self, retention_days, retention_re
else:
assert len(jmespath.search("spec.template.spec.containers[1].env", docs[0])) == 2

@pytest.mark.parametrize("frequency_minutes, frequency_result", [(None, None), (20, "20")])
@pytest.mark.parametrize(("frequency_minutes", "frequency_result"), [(None, None), (20, "20")])
def test_log_groomer_frequency_minutes_overrides(self, frequency_minutes, frequency_result):
if self.obj_name == "dag-processor":
values = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class TestAirflowCommon:
"""

@pytest.mark.parametrize(
"logs_values, expected_mount",
("logs_values", "expected_mount"),
[
(
{"persistence": {"enabled": True, "subPath": "test/logs"}},
Expand Down Expand Up @@ -74,7 +74,7 @@ def test_logs_mount(self, logs_values, expected_mount):
assert expected_mount in jmespath.search("spec.template.spec.containers[0].volumeMounts", doc)

@pytest.mark.parametrize(
"dag_values, expected_mount",
("dag_values", "expected_mount"),
[
(
{"gitSync": {"enabled": True}},
Expand Down Expand Up @@ -297,7 +297,7 @@ def test_global_affinity_tolerations_topology_spread_constraints_and_node_select
assert jmespath.search("topologySpreadConstraints[0].topologyKey", podSpec) == "foo"

@pytest.mark.parametrize(
"expected_image,tag,digest",
("expected_image", "tag", "digest"),
[
("apache/airflow:user-tag", "user-tag", None),
("apache/airflow@user-digest", None, "user-digest"),
Expand Down Expand Up @@ -328,7 +328,7 @@ def test_should_use_correct_image(self, expected_image, tag, digest):
assert expected_image == jmespath.search("spec.template.spec.initContainers[0].image", doc)

@pytest.mark.parametrize(
"expected_image,tag,digest",
("expected_image", "tag", "digest"),
[
("apache/airflow:user-tag", "user-tag", None),
("apache/airflow@user-digest", None, "user-digest"),
Expand Down
4 changes: 2 additions & 2 deletions helm-tests/tests/helm_tests/airflow_aux/test_annotations.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class TestServiceAccountAnnotations:
"""Tests Service Account Annotations."""

@pytest.mark.parametrize(
"values,show_only,expected_annotations",
("values", "show_only", "expected_annotations"),
[
(
{
Expand Down Expand Up @@ -350,7 +350,7 @@ def test_annotations_on_webserver(self):


@pytest.mark.parametrize(
"values,show_only,expected_annotations",
("values", "show_only", "expected_annotations"),
[
(
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def test_should_have_a_schedule_with_defaults(self):
]

@pytest.mark.parametrize(
"release_name,schedule_value,schedule_result",
("release_name", "schedule_value", "schedule_result"),
cron_tests,
ids=[x[0] for x in cron_tests],
)
Expand Down
12 changes: 6 additions & 6 deletions helm-tests/tests/helm_tests/airflow_aux/test_configmap.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def test_multiple_annotations(self):
assert annotations.get("key-two") == "value-two"

@pytest.mark.parametrize(
"af_version, secret_key, secret_key_name, expected",
("af_version", "secret_key", "secret_key_name", "expected"),
[
("3.0.0", None, None, False),
("2.2.0", None, None, True),
Expand Down Expand Up @@ -98,7 +98,7 @@ def test_kerberos_config_available_with_celery_executor(self):
assert jmespath.search('data."krb5.conf"', docs[0]) == "krb5\ncontent"

@pytest.mark.parametrize(
"executor, af_version, should_be_created",
("executor", "af_version", "should_be_created"),
[
("KubernetesExecutor", "1.10.11", False),
("KubernetesExecutor", "1.10.12", True),
Expand Down Expand Up @@ -166,7 +166,7 @@ def test_overridedn_flower_url_prefix(self):
assert expected in cfg.splitlines()

@pytest.mark.parametrize(
"dag_values, expected_default_dag_folder",
("dag_values", "expected_default_dag_folder"),
[
(
{"gitSync": {"enabled": True}},
Expand Down Expand Up @@ -203,7 +203,7 @@ def test_expected_default_dag_folder(self, dag_values, expected_default_dag_fold
assert expected_folder_config in cfg.splitlines()

@pytest.mark.parametrize(
"airflow_version, enabled",
("airflow_version", "enabled"),
[
("2.10.4", False),
("3.0.0", True),
Expand All @@ -220,7 +220,7 @@ def test_default_standalone_dag_processor_by_airflow_version(self, airflow_versi
assert expected_line in cfg.splitlines()

@pytest.mark.parametrize(
"airflow_version, enabled",
("airflow_version", "enabled"),
[
("2.10.4", False),
("2.10.4", True),
Expand All @@ -242,7 +242,7 @@ def test_standalone_dag_processor_explicit(self, airflow_version, enabled):
assert expected_line in cfg.splitlines()

@pytest.mark.parametrize(
"airflow_version, base_url, execution_api_server_url, expected_execution_url",
("airflow_version", "base_url", "execution_api_server_url", "expected_execution_url"),
[
(
"3.0.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ def test_job_ttl_after_finished_nil(self):
assert "ttlSecondsAfterFinished" not in spec

@pytest.mark.parametrize(
"airflow_version, expected_arg",
("airflow_version", "expected_arg"),
[
("1.10.14", "airflow create_user"),
("2.0.2", "airflow users create"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ def setup_class(cls) -> None:
cls.k8s_objects = render_chart(RELEASE_NAME, values=values)
cls.k8s_objects_by_key = prepare_k8s_lookup_dict(cls.k8s_objects)

@pytest.mark.parametrize("k8s_obj_key, env_paths", PARAMS)
@pytest.mark.parametrize(("k8s_obj_key", "env_paths"), PARAMS)
def test_extra_env(self, k8s_obj_key, env_paths):
expected_env_as_str = textwrap.dedent(
f"""
Expand All @@ -121,7 +121,7 @@ def test_extra_env(self, k8s_obj_key, env_paths):
env = jmespath.search(f"{path}.env", k8s_object)
assert expected_env_as_str in yaml.dump(env)

@pytest.mark.parametrize("k8s_obj_key, env_from_paths", PARAMS)
@pytest.mark.parametrize(("k8s_obj_key", "env_from_paths"), PARAMS)
def test_extra_env_from(self, k8s_obj_key, env_from_paths):
expected_env_from_as_str = textwrap.dedent(
f"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class TestJobLauncher:
"""Tests job launcher RBAC."""

@pytest.mark.parametrize(
"executor, rbac, allow, expected_accounts",
("executor", "rbac", "allow", "expected_accounts"),
[
("CeleryKubernetesExecutor", True, True, ["scheduler", "worker"]),
("KubernetesExecutor", True, True, ["scheduler", "worker"]),
Expand All @@ -51,7 +51,7 @@ def test_job_launcher_rolebinding(self, executor, rbac, allow, expected_accounts
assert docs == []

@pytest.mark.parametrize(
"multiNamespaceMode, namespace, expectedRole, expectedRoleBinding",
("multiNamespaceMode", "namespace", "expectedRole", "expectedRoleBinding"),
[
(
True,
Expand Down Expand Up @@ -93,7 +93,7 @@ def test_job_launcher_rolebinding_multi_namespace(
assert actualRoleRefKind == "Role"

@pytest.mark.parametrize(
"multiNamespaceMode, namespace, expectedRole",
("multiNamespaceMode", "namespace", "expectedRole"),
[
(True, "namespace", "namespace-release-name-job-launcher-role"),
(True, "other-ns", "other-ns-release-name-job-launcher-role"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def test_should_run_by_default(self):
assert jmespath.search("spec.template.spec.securityContext.runAsUser", docs[0]) == 50000

@pytest.mark.parametrize(
"migrate_database_job_enabled,created",
("migrate_database_job_enabled", "created"),
[
(False, False),
(True, True),
Expand Down Expand Up @@ -160,7 +160,7 @@ def test_scheduler_name(self):
)

@pytest.mark.parametrize(
"use_default_image,expected_image",
("use_default_image", "expected_image"),
[
(True, "apache/airflow:2.1.0"),
(False, "apache/airflow:user-image"),
Expand Down Expand Up @@ -352,7 +352,7 @@ def test_job_ttl_after_finished_nil(self):
assert "ttlSecondsAfterFinished" not in spec

@pytest.mark.parametrize(
"airflow_version, expected_arg",
("airflow_version", "expected_arg"),
[
("1.10.14", "airflow upgradedb"),
("2.0.2", "airflow db upgrade"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class TestPodLauncher:
"""Tests pod launcher."""

@pytest.mark.parametrize(
"executor, rbac, allow, expected_accounts",
("executor", "rbac", "allow", "expected_accounts"),
[
("CeleryKubernetesExecutor", True, True, ["scheduler", "worker"]),
("KubernetesExecutor", True, True, ["scheduler", "worker"]),
Expand All @@ -51,7 +51,7 @@ def test_pod_launcher_role(self, executor, rbac, allow, expected_accounts):
assert docs == []

@pytest.mark.parametrize(
"multiNamespaceMode, namespace, expectedRole, expectedRoleBinding",
("multiNamespaceMode", "namespace", "expectedRole", "expectedRoleBinding"),
[
(
True,
Expand Down Expand Up @@ -93,7 +93,7 @@ def test_pod_launcher_rolebinding_multi_namespace(
assert actualRoleRefKind == "Role"

@pytest.mark.parametrize(
"multiNamespaceMode, namespace, expectedRole",
("multiNamespaceMode", "namespace", "expectedRole"),
[
(True, "namespace", "namespace-release-name-pod-launcher-role"),
(True, "other-ns", "other-ns-release-name-pod-launcher-role"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ def test_should_not_add_init_container_if_dag_persistence_is_true(self):
assert jmespath.search("spec.initContainers", docs[0]) is None

@pytest.mark.parametrize(
"dag_values, expected_read_only",
("dag_values", "expected_read_only"),
[
({"gitSync": {"enabled": True}}, True),
({"persistence": {"enabled": True}}, False),
Expand Down Expand Up @@ -255,7 +255,7 @@ def test_validate_if_ssh_known_hosts_are_added(self):
} in jmespath.search("spec.initContainers[0].volumeMounts", docs[0])

@pytest.mark.parametrize(
"tag,expected_prefix",
("tag", "expected_prefix"),
[
("v3.6.7", "GIT_SYNC_"),
("v4.4.2", "GITSYNC_"),
Expand Down Expand Up @@ -306,7 +306,7 @@ def test_should_set_the_dags_volume_claim_correctly_when_using_an_existing_claim
)

@pytest.mark.parametrize(
"dags_gitsync_values, expected",
("dags_gitsync_values", "expected"),
[
({"enabled": True}, {"emptyDir": {}}),
({"enabled": True, "emptyDirConfig": {"sizeLimit": "10Gi"}}, {"emptyDir": {"sizeLimit": "10Gi"}}),
Expand All @@ -321,7 +321,7 @@ def test_should_use_empty_dir_for_gitsync_without_persistence(self, dags_gitsync
assert {"name": "dags", **expected} in jmespath.search("spec.volumes", docs[0])

@pytest.mark.parametrize(
"log_values, expected",
("log_values", "expected"),
[
({"persistence": {"enabled": False}}, {"emptyDir": {}}),
(
Expand Down Expand Up @@ -582,7 +582,7 @@ def test_affinity_tolerations_topology_spread_constraints_and_node_selector_prec
)

@pytest.mark.parametrize(
"base_scheduler_name, worker_scheduler_name, expected",
("base_scheduler_name", "worker_scheduler_name", "expected"),
[
("default-scheduler", "most-allocated", "most-allocated"),
("default-scheduler", None, "default-scheduler"),
Expand Down Expand Up @@ -998,7 +998,7 @@ def test_airflow_local_settings_kerberos_sidecar(self):
} in jmespath.search("spec.containers[1].volumeMounts", docs[0])

@pytest.mark.parametrize(
"airflow_version, init_container_enabled, expected_init_containers",
("airflow_version", "init_container_enabled", "expected_init_containers"),
[
("1.9.0", True, 0),
("1.9.0", False, 0),
Expand Down Expand Up @@ -1035,7 +1035,7 @@ def test_airflow_kerberos_init_container(
assert initContainers[0]["args"] == ["kerberos", "-o"]

@pytest.mark.parametrize(
"cmd, expected",
("cmd", "expected"),
[
(["test", "command", "to", "run"], ["test", "command", "to", "run"]),
(["cmd", "{{ .Release.Name }}"], ["cmd", "release-name"]),
Expand Down Expand Up @@ -1071,7 +1071,7 @@ def test_should_not_add_command_by_default(self):
assert jmespath.search("spec.containers[0].command", docs[0]) is None

@pytest.mark.parametrize(
"airflow_version, workers_values, kerberos_init_container, expected_config_name",
("airflow_version", "workers_values", "kerberos_init_container", "expected_config_name"),
[
(None, {"kerberosSidecar": {"enabled": True}}, False, "api-server-config"),
(None, {"kerberosInitContainer": {"enabled": True}}, True, "api-server-config"),
Expand Down