mirror of
https://github.com/NLnetLabs/krill.git
synced 2026-09-20 16:37:43 +02:00
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.
65 lines
1.7 KiB
Rust
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
|
|
);
|
|
}
|
|
|