Skip to content

Commit a8a2381

Browse files
committed
test: Remove CLI parsing from env var test
1 parent 2ec9b73 commit a8a2381

File tree

1 file changed

+1
-32
lines changed
  • crates/stackable-operator/src

1 file changed

+1
-32
lines changed

crates/stackable-operator/src/cli.rs

Lines changed: 1 addition & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@ pub struct OperatorEnvironmentOptions {
317317

318318
#[cfg(test)]
319319
mod tests {
320-
use std::{env, fs::File};
320+
use std::fs::File;
321321

322322
use clap::Parser;
323323
use rstest::*;
@@ -328,10 +328,6 @@ mod tests {
328328
const USER_PROVIDED_PATH: &str = "user_provided_path_properties.yaml";
329329
const DEPLOY_FILE_PATH: &str = "deploy_config_spec_properties.yaml";
330330
const DEFAULT_FILE_PATH: &str = "default_file_path_properties.yaml";
331-
const WATCH_NAMESPACE: &str = "WATCH_NAMESPACE";
332-
const OPERATOR_NAMESPACE: &str = "OPERATOR_NAMESPACE";
333-
const OPERATOR_SERVICE_NAME: &str = "OPERATOR_SERVICE_NAME";
334-
const KUBERNETES_NODE_NAME: &str = "KUBERNETES_NODE_NAME";
335331

336332
#[test]
337333
fn verify_cli() {
@@ -418,9 +414,6 @@ mod tests {
418414

419415
#[test]
420416
fn product_operator_run_watch_namespace() {
421-
// clean env var to not interfere if already set
422-
unsafe { env::remove_var(WATCH_NAMESPACE) };
423-
424417
// cli with namespace
425418
let opts = ProductOperatorRun::parse_from([
426419
"run",
@@ -480,29 +473,5 @@ mod tests {
480473
}
481474
}
482475
);
483-
484-
// env with namespace
485-
unsafe { env::set_var(WATCH_NAMESPACE, "foo") };
486-
unsafe { env::set_var(OPERATOR_SERVICE_NAME, "foo-operator") };
487-
unsafe { env::set_var(OPERATOR_NAMESPACE, "stackable-operators") };
488-
unsafe { env::set_var(KUBERNETES_NODE_NAME, "baz") };
489-
490-
let opts = ProductOperatorRun::parse_from(["run", "--product-config", "bar"]);
491-
assert_eq!(
492-
opts,
493-
ProductOperatorRun {
494-
product_config: ProductConfigPath::from("bar".as_ref()),
495-
watch_namespace: WatchNamespace::One("foo".to_string()),
496-
cluster_info: KubernetesClusterInfoOptions {
497-
kubernetes_cluster_domain: None,
498-
kubernetes_node_name: "baz".to_string()
499-
},
500-
telemetry: Default::default(),
501-
operator_environment: OperatorEnvironmentOptions {
502-
operator_namespace: "stackable-operators".to_string(),
503-
operator_service_name: "foo-operator".to_string(),
504-
}
505-
}
506-
);
507476
}
508477
}

0 commit comments

Comments
 (0)