mirror of
https://github.com/aljazceru/kata-containers.git
synced 2025-12-17 14:24:27 +01:00
We've noticed this caused regressions with the k8s-oom tests, and then
decided to take a step back and do this in the same way it was done
before 67972ec48a.
Moreover, this step back is also more reasonable in terms of the
controlling logic.
And by doing this we can re-enable the k8s-oom.bats tests, which is done
as part of this PR.
Fixes: #7271
Depends-on: github.com/kata-containers/tests#5705
Signed-off-by: Yushuo <y-shuo@linux.alibaba.com>
38 lines
826 B
Bash
38 lines
826 B
Bash
#!/usr/bin/env bats
|
|
#
|
|
# Copyright (c) 2020 Ant Group
|
|
#
|
|
# SPDX-License-Identifier: Apache-2.0
|
|
#
|
|
|
|
load "${BATS_TEST_DIRNAME}/../../common.bash"
|
|
load "${BATS_TEST_DIRNAME}/tests_common.sh"
|
|
|
|
setup() {
|
|
pod_name="pod-oom"
|
|
get_pod_config_dir
|
|
}
|
|
|
|
@test "Test OOM events for pods" {
|
|
# Create pod
|
|
kubectl create -f "${pod_config_dir}/$pod_name.yaml"
|
|
|
|
# Check pod creation
|
|
kubectl wait --for=condition=Ready --timeout=$timeout pod "$pod_name"
|
|
|
|
# Check if OOMKilled
|
|
cmd="kubectl get pods "$pod_name" -o jsonpath='{.status.containerStatuses[0].state.terminated.reason}' | grep OOMKilled"
|
|
|
|
waitForProcess "$wait_time" "$sleep_time" "$cmd"
|
|
|
|
rm -f "${pod_config_dir}/test_pod_oom.yaml"
|
|
}
|
|
|
|
teardown() {
|
|
# Debugging information
|
|
kubectl describe "pod/$pod_name"
|
|
kubectl get "pod/$pod_name" -o yaml
|
|
|
|
kubectl delete pod "$pod_name"
|
|
}
|