mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-07-05 03:26:37 +00:00
tests/k8s: add setup common
Bring the setup_common() from CCv0 branch test's integration/kubernetes/confidential/tests_common.sh. It should be used to reduce boilerplates on the setup() of the tests. Unlike the original code, this won't export the `test_start_time` variable as it wouldn't be accurate to grab logs from the worker nodes due date/time mismatch between the running tests machine and the worker node. The function export the `node` variable which holds the name of a random node which has kata installed. Apart from that, it exports the `node_start_time` which capture the date/time when the test started, relative to the `node`. Tests that should inspect the logs can schedule pods/resources to the `node` and use `node_start_time` as the value reference to grep the logs. Fixes #7590 Co-authored-by: stevenhorsman <steven@uk.ibm.com> Signed-off-by: Wainer dos Santos Moschetta <wainersm@redhat.com>
This commit is contained in:
parent
220a2d9a15
commit
c6075c8627
@ -33,6 +33,23 @@ dragonball_limitations="https://github.com/kata-containers/kata-containers/issue
|
||||
# overwrite it.
|
||||
export KUBECONFIG="${KUBECONFIG:-$HOME/.kube/config}"
|
||||
|
||||
# Common setup for tests.
|
||||
#
|
||||
# Global variables exported:
|
||||
# $node - random picked node that has kata installed
|
||||
# $node_start_date - start date/time at the $node for the sake of
|
||||
# fetching logs
|
||||
#
|
||||
setup_common() {
|
||||
node=$(get_one_kata_node)
|
||||
[ -n "$node" ]
|
||||
node_start_time=$(exec_host "$node" date +\"%Y-%m-%d %H:%M:%S\")
|
||||
[ -n "$node_start_time" ]
|
||||
export node node_start_time
|
||||
|
||||
k8s_delete_all_pods_if_any_exists || true
|
||||
}
|
||||
|
||||
get_pod_config_dir() {
|
||||
pod_config_dir="${BATS_TEST_DIRNAME}/runtimeclass_workloads_work"
|
||||
info "k8s configured to use runtimeclass"
|
||||
|
Loading…
Reference in New Issue
Block a user