diff --git a/tests/src/operator/sanity.rs b/tests/src/operator/sanity.rs index b9b1c5914a0..bd2ba2523b2 100644 --- a/tests/src/operator/sanity.rs +++ b/tests/src/operator/sanity.rs @@ -16,24 +16,33 @@ pub async fn mirrord_ls(#[future] service_for_mirrord_ls: KubeService) { assert!(res.success()); let stdout = process.get_stdout().await; let targets: Vec = serde_json::from_str(&stdout).unwrap(); - let re = - Regex::new(r"^(pod|deployment|statefulset|cronjob|job|replicaset)/.+(/container/.+)?$") - .unwrap(); - targets.iter().for_each(|output| { - assert!( - re.is_match(output), - "output line {output} does not match regex {re}" - ); - }); - for target_type in [ + let expected_target_types = [ "pod", "deployment", "statefulset", "cronjob", "job", "replicaset", - ] { + "service", + ]; + + let re = Regex::new(&format!( + r"^({})/.+(/container/.+)?$", + expected_target_types + .into_iter() + .collect::>() + .join("|") + )) + .unwrap(); + targets.iter().for_each(|output| { + assert!( + re.is_match(output), + "output line {output} does not match regex {re}" + ); + }); + + for target_type in expected_target_types { assert!( targets .iter()