From b2c69b2d27674899260928f2d807c13bae97c70c Mon Sep 17 00:00:00 2001 From: Wainer dos Santos Moschetta Date: Wed, 12 Jul 2023 10:29:30 -0300 Subject: [PATCH] kubernetes: system logs on SEV tests's teardown() The SEV and SNP tests sometimes fail on CI and it is hard to determine what went wrong because they don't print debug messages. This changed the tests so that they behave like many others: print the system's logs since the test's begin time. Fixes #5708 Signed-off-by: Wainer dos Santos Moschetta --- integration/kubernetes/confidential/sev.bats | 6 ++++++ integration/kubernetes/confidential/snp.bats | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/integration/kubernetes/confidential/sev.bats b/integration/kubernetes/confidential/sev.bats index 76d43494a..8e8c3345c 100644 --- a/integration/kubernetes/confidential/sev.bats +++ b/integration/kubernetes/confidential/sev.bats @@ -110,6 +110,7 @@ teardown_file() { } setup() { + start_date=$(date +"%Y-%m-%d %H:%M:%S") # Remove any previous k8s test services echo "Deleting previous test services..." k8s_delete_all @@ -118,6 +119,11 @@ setup() { simple_kbs_delete_data } +teardown() { + # Print the logs and cleanup resources. + echo "-- Kata logs:" + sudo journalctl -xe -t kata --since "$start_date" -n 100000 +} @test "${TEST_TAG} Test SEV unencrypted container launch success" { # Start the service/deployment/pod diff --git a/integration/kubernetes/confidential/snp.bats b/integration/kubernetes/confidential/snp.bats index 3f03ebda2..8c3ff5c46 100644 --- a/integration/kubernetes/confidential/snp.bats +++ b/integration/kubernetes/confidential/snp.bats @@ -62,11 +62,17 @@ teardown_file() { } setup() { + start_date=$(date +"%Y-%m-%d %H:%M:%S") # Remove any previous k8s test services echo "Deleting previous test services..." k8s_delete_all } +teardown() { + # Print the logs and cleanup resources. + echo "-- Kata logs:" + sudo journalctl -xe -t kata --since "$start_date" -n 100000 +} @test "${TEST_TAG} Test SNP unencrypted container launch success" { # Start the service/deployment/pod