Files
NLnetLabs-krill/tests/benchmark.rs
T
Martin HoffmannandGitHub 6d253c22da Refactor cli to use clap’s derive. (#1228)
This PR changes how the clients -- krillc, krillta, as well as the
integration tests -- work to better fit the derive model provided by clap.
This results in basically everything in the cli module and all the
integration tests being different now.

The PR slightly changes the options for both krillc and krillta. For krillc,
the --server, --token, --format, and --api options are now before the first
subcommand (since they affect all commands). For krillta, those options are
now after krillta proxy but before the next subcommand, while --format is
now after krillta signer.

This PR also removes client support and integration tests for RTA.

This is a breaking change.
2024-08-20 14:05:06 +02:00

65 lines
1.7 KiB
Rust

//! Perform functional tests on a Krill instance, using the API
use krill::cli::client::KrillClient;
use krill::daemon::config::Benchmark;
use log::LevelFilter;
mod common;
#[tokio::test(flavor = "multi_thread")]
async fn benchmark() {
let (mut config, _dir) = common::TestConfig::mem_storage()
.enable_testbed()
.enable_second_signer()
.finalize();
let cas = 10;
let ca_roas = 10;
config.benchmark = Some(Benchmark { cas, ca_roas });
config.log_level = LevelFilter::Info;
let server = common::KrillServer::start_with_config(config).await;
wait_for_nr_cas_under_testbed(server.client(), cas).await;
// We expect all CAs, plus the testbed and the ta as publishers
wait_for_nr_cas_under_publication_server(server.client(), cas + 2).await;
server.abort().await;
}
async fn wait_for_nr_cas_under_testbed(
client: &KrillClient,
nr: usize
) {
let handle = common::ca_handle("testbed");
for _ in 0..300 {
if client.ca_details(&handle).await.unwrap().children().len() == nr {
return;
}
common::sleep_seconds(1).await
}
panic!("not all CAs appeared in time");
}
async fn wait_for_nr_cas_under_publication_server(
client: &KrillClient,
publishers_expected: usize,
) {
let mut publishers_found = client.publishers_list().await.unwrap()
.publishers().len();
for _ in 0..300 {
if publishers_found == publishers_expected {
return;
}
common::sleep_seconds(1).await;
publishers_found = client.publishers_list().await.unwrap()
.publishers().len();
}
panic!(
"Expected {} publishers, but found {}",
publishers_expected, publishers_found
);
}