Skip to content

Commit 44fc9e9

Browse files
committed
test(k8s): add coverage for include_run_tags=True path
1 parent 8e4a7bd commit 44fc9e9

1 file changed

Lines changed: 27 additions & 0 deletions

File tree

python_modules/libraries/dagster-k8s/dagster_k8s_tests/unit_tests/test_container_context.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -945,3 +945,30 @@ def test_launcher_run_k8s_config_precedence_preserves_non_conflicting_fields(
945945
pod_spec = result.run_k8s_config.pod_spec_config
946946
assert pod_spec.get("node_selector") == {"pool": "autoscaling-pool"}
947947
assert pod_spec.get("dns_policy") == "ClusterFirst"
948+
949+
950+
def test_launcher_run_k8s_config_takes_precedence_with_run_tags(
951+
kubeconfig_file,
952+
):
953+
launcher = K8sRunLauncher(
954+
service_account_name="webserver-admin",
955+
instance_config_map="dagster-instance",
956+
dagster_home="/opt/dagster/dagster_home",
957+
job_image="fake_job_image",
958+
load_incluster_config=False,
959+
kubeconfig_file=kubeconfig_file,
960+
run_k8s_config={"pod_spec_config": {"node_selector": {"pool": "autoscaling-pool"}}},
961+
)
962+
963+
run = _run_with_container_context(
964+
{
965+
"k8s": {
966+
"run_k8s_config": {"pod_spec_config": {"node_selector": {"pool": "default-pool"}}}
967+
}
968+
}
969+
)
970+
971+
result = K8sContainerContext.create_for_run(run, launcher, include_run_tags=True)
972+
973+
node_selector = result.run_k8s_config.pod_spec_config.get("node_selector")
974+
assert node_selector == {"pool": "autoscaling-pool"}

0 commit comments

Comments
 (0)