github.com/dmaizel/tests@v0.0.0-20210728163746-cae6a2d9cee8/integration/kubernetes/k8s-hugepages.bats (about)

     1  #
     2  # Copyright (c) 2019 Intel Corporation
     3  #
     4  # SPDX-License-Identifier: Apache-2.0
     5  #
     6  
     7  load "${BATS_TEST_DIRNAME}/../../.ci/lib.sh"
     8  load "${BATS_TEST_DIRNAME}/tests_common.sh"
     9  issue="https://github.com/kata-containers/runtime/issues/2172"
    10  
    11  setup() {
    12  	skip "test not working see: ${issue}"
    13  	export KUBECONFIG="${KUBECONFIG:-$HOME/.kube/config}"
    14  	extract_kata_env
    15  
    16  	# Enable hugepages
    17  	sudo sed -i 's/#enable_hugepages = true/enable_hugepages = true/g' ${RUNTIME_CONFIG_PATH}
    18  
    19  	pod_name="test-env"
    20  	get_pod_config_dir
    21  }
    22  
    23  @test "Hugepages" {
    24  	skip "test not working see: ${issue}"
    25  	# Create pod
    26  	kubectl create -f "${pod_config_dir}/pod-env.yaml"
    27  
    28  	# Check pod creation
    29  	kubectl wait --for=condition=Ready --timeout=$timeout pod "$pod_name"
    30  
    31  	# Print environment variables
    32  	cmd="printenv"
    33  	kubectl exec $pod_name -- sh -c $cmd | grep "MY_POD_NAME=$pod_name"
    34  }
    35  
    36  
    37  @test "Hugepages and sandbox cgroup" {
    38  	skip "test not working see: ${issue}"
    39  	# Enable sandbox_cgroup_only
    40  	sudo sed -i 's/sandbox_cgroup_only=false/sandbox_cgroup_only=true/g' ${RUNTIME_CONFIG_PATH}
    41  
    42  	# Create pod
    43  	kubectl create -f "${pod_config_dir}/pod-env.yaml"
    44  
    45  	# Check pod creation
    46  	kubectl wait --for=condition=Ready --timeout=$timeout pod "$pod_name"
    47  
    48  	# Print environment variables
    49  	cmd="printenv"
    50  	kubectl exec $pod_name -- sh -c $cmd | grep "MY_POD_NAME=$pod_name"
    51  
    52  	# Disable sandbox_cgroup_only
    53  	sudo sed -i 's/sandbox_cgroup_only=false/sandbox_cgroup_only=true/g' ${RUNTIME_CONFIG_PATH}
    54  }
    55  
    56  teardown() {
    57  	skip "test not working see: ${issue}"
    58  	kubectl delete pod "$pod_name"
    59  
    60  	# Disable hugepages
    61  	sudo sed -i 's/enable_hugepages = true/#enable_hugepages = true/g' ${RUNTIME_CONFIG_PATH}
    62  }