From 98884931c50ffa54813de26d0473ad674d872f9f Mon Sep 17 00:00:00 2001 From: James Hodgkinson Date: Thu, 7 Sep 2023 19:04:54 +1000 Subject: [PATCH] minor tweaks to Orca (#2077) --- tools/orca/setup_orca.sh | 21 +++++++++++++++++++-- tools/orca/src/kani.rs | 13 ++++++++++--- tools/orca/src/opt.rs | 9 ++++++--- tools/orca/src/runner/search.rs | 3 ++- 4 files changed, 37 insertions(+), 9 deletions(-) diff --git a/tools/orca/setup_orca.sh b/tools/orca/setup_orca.sh index c5393eb12..3461d93ff 100755 --- a/tools/orca/setup_orca.sh +++ b/tools/orca/setup_orca.sh @@ -16,7 +16,7 @@ echo "Also, you'll need to start the server in another tab." echo "" echo "Hit ctrl-c to quit now if that's not what you intend!" -# read -rp "Press Enter to continue" +read -rp "Press Enter to continue" cd ../../server/daemon/ || exit 1 @@ -45,9 +45,26 @@ cd "$MYDIR" || exit 1 LDAP_DN="DN=$(grep domain "${KANIDM_CONFIG}" | awk '{print $NF}' | tr -d '"' | sed -E 's/\./,DN=/g')" +PROFILE_PATH="/tmp/kanidm/orca.toml" + cargo run --bin orca -- configure \ - --profile /tmp/kanidm/orca.toml \ + --profile "${PROFILE_PATH}" \ --admin-password "${ADMIN_PW}" \ --kanidm-uri "$(grep origin "${KANIDM_CONFIG}" | awk '{print $NF}' | tr -d '"')" \ --ldap-uri "ldaps://$(grep domain "${KANIDM_CONFIG}" | awk '{print $NF}' | tr -d '"'):636" \ --ldap-base-dn "${LDAP_DN}" + +echo "Generating data..." + +cargo run --bin orca -- generate --output /tmp/kanidm/orcatest + +echo "Running connection test..." + +cargo run --bin orca -- conntest --profile "${PROFILE_PATH}" kanidm + +echo "Now you can run things!" + +echo "To set up the environment, run:" +echo "cargo run --bin orca --release -- setup --profile /tmp/kanidm/orca.toml kanidm" +echo "cargo run --bin orca --release -- run --profile /tmp/kanidm/orca.toml kanidm search-basic" + diff --git a/tools/orca/src/kani.rs b/tools/orca/src/kani.rs index ce3014b04..766f7e5d6 100644 --- a/tools/orca/src/kani.rs +++ b/tools/orca/src/kani.rs @@ -99,9 +99,16 @@ impl KaniHttpServer { all_entities: &HashMap, ) -> Result<(), ()> { // Create all the accounts and groups - for u in targets { - let e = all_entities.get(u).unwrap(); - match e { + let num_uuids = targets.len(); + let mut current_slice = 1; + info!("Have to do {} uuids", num_uuids); + for (index, uuid) in targets.iter().enumerate() { + if num_uuids / 10 * current_slice > index { + info!("{}% complete", current_slice * 10); + current_slice += 1; + } + let entity = all_entities.get(uuid).unwrap(); + match entity { Entity::Account(a) => { self.client .idm_person_account_create(&a.name, &a.display_name) diff --git a/tools/orca/src/opt.rs b/tools/orca/src/opt.rs index f65cf0eec..5d421a7ad 100644 --- a/tools/orca/src/opt.rs +++ b/tools/orca/src/opt.rs @@ -45,7 +45,10 @@ struct RunOpt { pub copt: CommonOpt, #[clap(name = "target")] pub target: TargetOpt, - #[clap(name = "test-type")] + #[clap( + name = "test-type", + help = "Which type of test to run against this system: currently supports 'search-basic'" + )] /// Which type of test to run against this system pub test_type: TestTypeOpt, #[clap(value_parser, short, long = "profile")] @@ -67,7 +70,7 @@ struct ConfigOpt { #[clap(value_parser, short, long)] /// Update the LDAP URI pub ldap_uri: Option, - #[clap(value_parser, short = 'D', long)] + #[clap(value_parser, long)] /// Update the LDAP base DN pub ldap_base_dn: Option, @@ -75,7 +78,7 @@ struct ConfigOpt { /// Set the configuration name pub name: Option, - #[clap(value_parser, short, long)] + #[clap(value_parser, long)] /// The data file path to update (or create) pub data_file: Option, diff --git a/tools/orca/src/runner/search.rs b/tools/orca/src/runner/search.rs index 3b9fdeac4..973e2ba8f 100644 --- a/tools/orca/src/runner/search.rs +++ b/tools/orca/src/runner/search.rs @@ -269,6 +269,7 @@ pub(crate) async fn basic( .await }); } + info!("Starting the warmup..."); // Tell the arbiter to start the warm up counter now. broadcast_tx @@ -283,7 +284,7 @@ pub(crate) async fn basic( // Now signal the workers to stop. We don't care if this fails. let _ = broadcast_tx .send(TestPhase::Shutdown) - .map_err(|_| error!("Unable to broadcast stop state change")); + .map_err(|_| error!("Unable to broadcast stop state change, but that's OK.")); // Now we can finalise our data, based on what analysis we can actually do here. process_raw_results(&raw_results);