-
Notifications
You must be signed in to change notification settings - Fork 110
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* test fixed * Switch operator use based on features * Better env
- Loading branch information
Showing
7 changed files
with
75 additions
and
89 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Fixed `mirrord ls` E2E tests. Now there's only one test, and it uses a fresh namespace with a random name. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
#![cfg(test)] | ||
|
||
use fancy_regex::Regex; | ||
use rstest::rstest; | ||
|
||
use crate::utils::{kube_client, run_ls, service_for_mirrord_ls}; | ||
|
||
/// Test for the `mirrord ls` command. | ||
#[rstest] | ||
#[tokio::test(flavor = "multi_thread", worker_threads = 2)] | ||
pub async fn mirrord_ls() { | ||
let namespace = format!("test-namespace-{:x}", rand::random::<u32>()); | ||
// This function is implemented differently when the `operator` feature is enabled and when it | ||
// is disabled. | ||
let _setup = service_for_mirrord_ls( | ||
&namespace, | ||
"NodePort", | ||
"ghcr.io/metalbear-co/mirrord-pytest:latest", | ||
"ls-service", | ||
false, | ||
kube_client(), | ||
) | ||
.await; | ||
|
||
let mut process = run_ls(&namespace).await; | ||
let res = process.wait().await; | ||
assert!(res.success(), "mirrord ls command failed"); | ||
|
||
let stdout = process.get_stdout().await; | ||
let targets: Vec<String> = | ||
serde_json::from_str(&stdout).expect("mirrord ls output should be a valid JSON"); | ||
|
||
let types = [ | ||
"pod", | ||
"deployment", | ||
#[cfg(feature = "operator")] | ||
"statefulset", | ||
#[cfg(feature = "operator")] | ||
"cronjob", | ||
#[cfg(feature = "operator")] | ||
"job", | ||
#[cfg(feature = "operator")] | ||
"replicaset", | ||
#[cfg(feature = "operator")] | ||
"service", | ||
]; | ||
|
||
let pattern = format!(r"^({})/.+(/container/.+)?$", types.join("|")); | ||
let re = Regex::new(&pattern).unwrap(); | ||
|
||
targets.iter().for_each(|output| { | ||
assert!( | ||
re.is_match(output).expect("checking regex match panicked"), | ||
"output line does not match the pattern `{pattern}`: {output}" | ||
) | ||
}); | ||
|
||
for target_type in types { | ||
assert!( | ||
targets | ||
.iter() | ||
.any(|output| output.starts_with(&format!("{target_type}/ls-service"))), | ||
"target type {target_type} was not found in the output", | ||
) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,5 +3,4 @@ | |
mod concurrent_steal; | ||
mod policies; | ||
mod queue_splitting; | ||
mod sanity; | ||
mod setup; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters