Skip to content

Commit 7bfa539

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 d575301 commit 7bfa539

4 files changed

Lines changed: 427 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
@@ -633,6 +633,35 @@ impl TestContext {
633633
Ok(())
634634
}
635635

636+
pub async fn wait_for_deployment_ready(
637+
&self,
638+
deployments_api: &Api<Deployment>,
639+
deployment_name: &str,
640+
timeout_secs: u64,
641+
) -> Result<()> {
642+
test_info!(
643+
&self.test_name,
644+
"Waiting for deployment {} to be ready",
645+
deployment_name
646+
);
647+
let has_available_replica = |d: Option<&Deployment>| {
648+
d.and_then(|d| d.status.as_ref())
649+
.and_then(|s| s.available_replicas)
650+
.is_some_and(|r| r >= 1)
651+
};
652+
let done = await_condition(
653+
deployments_api.clone(),
654+
deployment_name,
655+
has_available_replica,
656+
);
657+
timeout(Duration::from_secs(timeout_secs), done)
658+
.await
659+
.context(format!(
660+
"{deployment_name} deployment does not have 1 available replica after {timeout_secs} seconds"
661+
))??;
662+
Ok(())
663+
}
664+
636665
async fn create_certificate(
637666
&self,
638667
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)