From bfee18dd28423048bfde54b6e77c77a4d3bb5611 Mon Sep 17 00:00:00 2001 From: Adrian Benavides Date: Tue, 26 Nov 2024 20:26:55 +0100 Subject: [PATCH] test(rust): update tests using the `ENROLLMENT_TICKET` env var --- .../ockam/ockam_api/src/cli_state/cli_state.rs | 17 ----------------- .../tests/bats/orchestrator_enroll/nodes.bats | 16 ++++------------ 2 files changed, 4 insertions(+), 29 deletions(-) diff --git a/implementations/rust/ockam/ockam_api/src/cli_state/cli_state.rs b/implementations/rust/ockam/ockam_api/src/cli_state/cli_state.rs index 04f187dd93a..dd0fcfddc0d 100644 --- a/implementations/rust/ockam/ockam_api/src/cli_state/cli_state.rs +++ b/implementations/rust/ockam/ockam_api/src/cli_state/cli_state.rs @@ -405,21 +405,4 @@ mod tests { .map(|f| f.unwrap().file_name().to_string_lossy().to_string()) .collect() } - - #[tokio::test] - async fn random_name_generator() { - // Same process - let mut names = Vec::new(); - for _ in 0..100 { - names.push(random_name()); - } - assert_eq!(names.len(), names.iter().unique().count()); - - // In an async context - let mut names = Vec::new(); - for _ in 0..100 { - names.push(tokio::task::spawn_blocking(random_name).await.unwrap()); - } - assert_eq!(names.len(), names.iter().unique().count()); - } } diff --git a/implementations/rust/ockam/ockam_command/tests/bats/orchestrator_enroll/nodes.bats b/implementations/rust/ockam/ockam_command/tests/bats/orchestrator_enroll/nodes.bats index 78ea10679ba..d1031dd31fb 100644 --- a/implementations/rust/ockam/ockam_command/tests/bats/orchestrator_enroll/nodes.bats +++ b/implementations/rust/ockam/ockam_command/tests/bats/orchestrator_enroll/nodes.bats @@ -240,12 +240,9 @@ EOF export ENROLLMENT_TICKET=$(cat "$OCKAM_HOME/enrollment.ticket") setup_home_dir - cat <"$OCKAM_HOME/config.yaml" -ticket: ${ENROLLMENT_TICKET} -name: n1 -EOF - - run_success "$OCKAM" node create "$OCKAM_HOME/config.yaml" + # The ENROLLMENT_TICKET is parsed automatically, so the `node create` command will + # first use the ticket before creating the node + run_success "$OCKAM" node create n1 run_success "$OCKAM" node show n1 # Check that the identity can reach the project @@ -257,12 +254,7 @@ EOF export ENROLLMENT_TICKET=$(cat "$OCKAM_HOME/enrollment.ticket") setup_home_dir - cat <"$OCKAM_HOME/config.yaml" -ticket: ${ENROLLMENT_TICKET} -name: n1 -EOF - - run_success "$OCKAM" node create "$OCKAM_HOME/config.yaml" -f & + run_success "$OCKAM" node create n1 -f & sleep 10 run_success "$OCKAM" node show n1