File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -46,16 +46,16 @@ async def test_services_have_matching_labels(
4646 # For Pods part of a replicaset we must ignore pods which template-hash do not match
4747 # the latest replicaset `pod-template-hash`
4848 if pod .metadata and pod .metadata .labels and pod .metadata .labels .get ("pod-template-hash" ):
49- async for _ in kube_client .list (
49+ async for rs in kube_client .list (
5050 ReplicaSet ,
5151 namespace = generated_data .ess_namespace ,
5252 labels = {"pod-template-hash" : op .equal (pod .metadata .labels ["pod-template-hash" ])},
5353 ):
54- # if any rs matches the pod's template hash,
55- # the pod is one of the current replicaset and must be checked
56- break
54+ # we check if the rs desires replicas
55+ if rs . spec and rs . spec . replicas :
56+ break
5757 else :
58- # Skip pods which do not have a ReplicaSet
58+ # Skip pods which do not have a ReplicaSet desiring replicas
5959 continue
6060 assert service .metadata , f"Encountered a service without metadata : { service } "
6161 assert pod .metadata , f"Encountered a pod without metadata : { pod } "
You can’t perform that action at this time.
0 commit comments