github.com/dmaizel/tests@v0.0.0-20210728163746-cae6a2d9cee8/integration/kubernetes/k8s-sysctls.bats (about) 1 #!/usr/bin/env bats 2 # 3 # Copyright (c) 2019 Intel Corporation 4 # 5 # SPDX-License-Identifier: Apache-2.0 6 # 7 8 load "${BATS_TEST_DIRNAME}/../../.ci/lib.sh" 9 load "${BATS_TEST_DIRNAME}/tests_common.sh" 10 11 setup() { 12 export KUBECONFIG="${KUBECONFIG:-$HOME/.kube/config}" 13 pod_name="sysctl-test" 14 get_pod_config_dir 15 } 16 17 @test "Setting sysctl" { 18 # Create pod 19 kubectl apply -f "${pod_config_dir}/pod-sysctl.yaml" 20 21 # Check pod creation 22 kubectl wait --for=condition=Ready --timeout=$timeout pod $pod_name 23 24 # Check sysctl configuration 25 cmd="cat /proc/sys/kernel/shm_rmid_forced" 26 result=$(kubectl exec $pod_name -- sh -c "$cmd") 27 [ "${result}" = 0 ] 28 } 29 30 teardown() { 31 # Debugging information 32 kubectl describe "pod/$pod_name" 33 34 kubectl delete pod "$pod_name" 35 }