File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ Tests : Dont check services matching labels against terminating pods.
Original file line number Diff line number Diff line change @@ -40,6 +40,8 @@ async def test_services_have_matching_labels(
4040 label_selectors = {label : value for label , value in service .spec .selector .items ()}
4141
4242 async for pod in kube_client .list (Pod , namespace = generated_data .ess_namespace , labels = label_selectors ):
43+ if pod .status and pod .status .phase == "Terminating" :
44+ continue # Skip terminating pods
4345 assert service .metadata , f"Encountered a service without metadata : { service } "
4446 assert pod .metadata , f"Encountered a pod without metadata : { pod } "
4547 assert pod .metadata .labels , f"Encountered a pod without labels : { pod } "
@@ -55,6 +57,9 @@ async def test_services_have_matching_labels(
5557 assert label .replace ("k8s.element.io/target-" , "app.kubernetes.io/" ) in pod .metadata .labels
5658 assert value .startswith (
5759 pod .metadata .labels [label .replace ("k8s.element.io/target-" , "app.kubernetes.io/" )]
60+ ), (
61+ f"{ pod .metadata .name } does not have the correct label { label } ={ value } "
62+ f"(pod status phase : { pod .status .phase if pod .status else 'N/A' } "
5863 )
5964
6065
You can’t perform that action at this time.
0 commit comments