diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 0583782b4b1..8d9d7fdb3f4 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -570,3 +570,13 @@ cargo-zigbuild clippy --lib --bins --all-features --target x86_64-unknown-linux- If it doesn't work, try updating `cargo-zigbuild` (`cargo install cargo-zigbuild` or maybe `cargo install cargo-zigbuild --force`) or via `homebrew` if it was installed via homebrew. + +# Adding new target types + +Adding a new target type for mirrord requires changes in: + +1. `mirrord-config` crate - parsing the target from the user config; +2. `mirrord-cli` crate - verifying the user config; +3. `mirrord-kube` crate - resolving the target to the Kubernetes resource; +4. `mirrord-operator` crate - defining operator's `ClusterRole`; +5. `test` crate - testing `mirrord ls` command diff --git a/changelog.d/+ls-test.internal.md b/changelog.d/+ls-test.internal.md new file mode 100644 index 00000000000..f8c1eccecd5 --- /dev/null +++ b/changelog.d/+ls-test.internal.md @@ -0,0 +1 @@ +Updated `tests::operator::sanity::mirrord_ls` test after adding ReplicaSet support. diff --git a/tests/src/operator/sanity.rs b/tests/src/operator/sanity.rs index e9264a3681a..b219539f4f5 100644 --- a/tests/src/operator/sanity.rs +++ b/tests/src/operator/sanity.rs @@ -16,7 +16,22 @@ 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)/.+(/container/.+)?$").unwrap(); + + let expected_target_types = [ + "pod", + "deployment", + "statefulset", + "cronjob", + "job", + "replicaset", + "service", + ]; + + let re = Regex::new(&format!( + r"^({})/.+(/container/.+)?$", + expected_target_types.join("|") + )) + .unwrap(); targets.iter().for_each(|output| { assert!( re.is_match(output), @@ -24,7 +39,7 @@ pub async fn mirrord_ls(#[future] service_for_mirrord_ls: KubeService) { ); }); - for target_type in ["pod", "deployment", "statefulset", "cronjob", "job"] { + for target_type in expected_target_types { assert!( targets .iter()