diff --git a/newsfragments/1669.internal.md b/newsfragments/1669.internal.md new file mode 100644 index 00000000..5af55d3f --- /dev/null +++ b/newsfragments/1669.internal.md @@ -0,0 +1 @@ +CI: test that references in `Services` are fully-qualified. diff --git a/tests/manifests/test_services.py b/tests/manifests/test_services.py index 9341e610..153bffe5 100644 --- a/tests/manifests/test_services.py +++ b/tests/manifests/test_services.py @@ -514,7 +514,9 @@ async def test_not_too_many_ports_in_services(templates): @pytest.mark.parametrize("values_file", values_files_to_test) @pytest.mark.asyncio_cooperative -async def test_references_to_services_are_anchored_by_the_cluster_domain(values, make_templates): +async def test_references_to_services_are_anchored_by_the_cluster_domain( + values, make_templates, release_name, namespace +): """ Service references must use proper cluster domain anchoring. @@ -534,6 +536,12 @@ async def test_references_to_services_are_anchored_by_the_cluster_domain(values, f"Expected '.svc.cluster.local.' but found '{line.strip()}'. " f"Service references must be fully qualified with the cluster domain." ) + if f"://{release_name}-" in line: + assert f".{namespace}.svc.cluster.local." in line, ( + f"{template_id(template)} contains service reference that isn't properly anchored: {line=}. " + f"Expected '.{namespace}.svc.cluster.local.' but found '{line.strip()}'. " + f"Service references must be fully qualified with the cluster domain." + ) values["clusterDomain"] = "k8s.example.com." for template in await make_templates(values):