Skip to content

Commit e26025f

Browse files
committed
test: add LUKS and Attestation Key sync tests
test_luks_key_sync - verify the initial LUKS key upload, re-sync after trustee restart, and LUKS key deletion on machine removal. test_attestation_key_sync - verify that attestation keys are registered with the KBS and re-registered after trustee restarts. Signed-off-by: Roy Kaufman <rkaufman@redhat.com>
1 parent 262b4af commit e26025f

4 files changed

Lines changed: 426 additions & 11 deletions

File tree

Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

test_utils/src/lib.rs

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -592,6 +592,35 @@ impl TestContext {
592592
Ok(())
593593
}
594594

595+
pub async fn wait_for_deployment_ready(
596+
&self,
597+
deployments_api: &Api<Deployment>,
598+
deployment_name: &str,
599+
timeout_secs: u64,
600+
) -> Result<()> {
601+
test_info!(
602+
&self.test_name,
603+
"Waiting for deployment {} to be ready",
604+
deployment_name
605+
);
606+
let has_available_replica = |d: Option<&Deployment>| {
607+
d.and_then(|d| d.status.as_ref())
608+
.and_then(|s| s.available_replicas)
609+
.is_some_and(|r| r >= 1)
610+
};
611+
let done = await_condition(
612+
deployments_api.clone(),
613+
deployment_name,
614+
has_available_replica,
615+
);
616+
timeout(Duration::from_secs(timeout_secs), done)
617+
.await
618+
.context(format!(
619+
"{deployment_name} deployment does not have 1 available replica after {timeout_secs} seconds"
620+
))??;
621+
Ok(())
622+
}
623+
595624
async fn create_certificate(
596625
&self,
597626
service_name: &str,

tests/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ virtualization = []
1515
[dependencies]
1616
anyhow.workspace = true
1717
cfg-if = "1.0.4"
18+
chrono.workspace = true
1819
compute-pcrs-lib.workspace = true
1920
k8s-openapi.workspace = true
2021
kube = { workspace = true }

0 commit comments

Comments
 (0)