mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-06-20 20:52:07 +00:00
Since we bumped to the 6.12.x LTS kernel, we've also adjusted the aggressivity of the OOM test, which may be enough to allow us to re-enable it for mariner. Fixes: #8821 Signed-off-by: Fabiano Fidêncio <fabiano@fidencio.org>
41 lines
910 B
Bash
41 lines
910 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
|
|
|
|
yaml_file="${pod_config_dir}/$pod_name.yaml"
|
|
auto_generate_policy "${pod_config_dir}" "${yaml_file}"
|
|
}
|
|
|
|
@test "Test OOM events for pods" {
|
|
# Create pod
|
|
kubectl create -f "${yaml_file}"
|
|
|
|
# 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"
|
|
}
|