Files
kata-containers/tests/integration/kubernetes/k8s-inotify.bats
Dan Mihai 9af3e4cc4a tests: k8s-inotify.bats allow all policy
Use the "allow all" policy for k8s-inotify.bats, instead of relying
on the Kata Guest image to use the same policy as its default.

Signed-off-by: Dan Mihai <dmihai@microsoft.com>
2024-04-03 03:00:08 +00:00

54 lines
1.9 KiB
Bash

#!/usr/bin/env bats
#
# Copyright (c) 2021 Apple Inc.
#
# SPDX-License-Identifier: Apache-2.0
#
load "${BATS_TEST_DIRNAME}/../../common.bash"
load "${BATS_TEST_DIRNAME}/tests_common.sh"
setup() {
[ "${KATA_HYPERVISOR}" == "firecracker" ] && skip "test not working see: ${fc_limitations}"
[ "${KATA_HYPERVISOR}" == "fc" ] && skip "test not working see: ${fc_limitations}"
issue_url="https://github.com/kata-containers/kata-containers/issues/8906"
[ "${KATA_HYPERVISOR}" == "qemu-se" ] && skip "test not working for IBM Z LPAR (see ${issue_url})"
get_pod_config_dir
pod_yaml="${pod_config_dir}"/inotify-configmap-pod.yaml
add_allow_all_policy_to_yaml "${pod_yaml}"
}
@test "configmap update works, and preserves symlinks" {
pod_name="inotify-configmap-testing"
# Create configmap for my deployment
kubectl apply -f "${pod_config_dir}"/inotify-configmap.yaml
# Create deployment that expects identity-certs
kubectl apply -f "${pod_yaml}"
kubectl wait --for=condition=Ready --timeout=$timeout pod "$pod_name"
# Update configmap
kubectl apply -f "${pod_config_dir}"/inotify-updated-configmap.yaml
# Ideally we'd wait for the pod to complete...
sleep 120
# Verify we saw the update
result=$(kubectl get pod "$pod_name" --output="jsonpath={.status.containerStatuses[]}")
echo $result | grep -vq Error
kubectl delete configmap cm
}
teardown() {
[ "${KATA_HYPERVISOR}" == "firecracker" ] && skip "test not working see: ${fc_limitations}"
[ "${KATA_HYPERVISOR}" == "fc" ] && skip "test not working see: ${fc_limitations}"
issue_url="https://github.com/kata-containers/kata-containers/issues/8906"
[ "${KATA_HYPERVISOR}" == "qemu-se" ] && skip "test not working for IBM Z LPAR (see ${issue_url})"
# Debugging information
kubectl describe "pod/$pod_name"
kubectl delete pod "$pod_name"
}