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
1 change: 1 addition & 0 deletions newsfragments/598.internal.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Tests: don't check services matching labels against terminating pods.
7 changes: 5 additions & 2 deletions tests/integration/test_networking.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ async def test_services_have_matching_labels(
label_selectors = {label: value for label, value in service.spec.selector.items()}

async for pod in kube_client.list(Pod, namespace=generated_data.ess_namespace, labels=label_selectors):
if pod.status and pod.status.phase == "Terminating":
if pod.status and pod.status.phase not in ("Terminating", "Succeeded"):
continue # Skip terminating pods
assert service.metadata, f"Encountered a service without metadata : {service}"
assert pod.metadata, f"Encountered a pod without metadata : {pod}"
Expand All @@ -58,7 +58,10 @@ async def test_services_have_matching_labels(
assert value.startswith(
pod.metadata.labels[label.replace("k8s.element.io/target-", "app.kubernetes.io/")]
), (
f"{pod.metadata.name} does not have the correct label {label}={value} "
f"Service/{service.metadata.name} has {label=}={value=} "
f"which does not start with the value from the Pod/{pod.metadata.name} "
f"{label.replace('k8s.element.io/target-', 'app.kubernetes.io/')}="
f"{pod.metadata.labels[label.replace('k8s.element.io/target-', 'app.kubernetes.io/')]} "
f"(pod status phase : {pod.status.phase if pod.status else 'N/A'}"
)

Expand Down
Loading