github.com/kata-containers/tests@v0.0.0-20240307153542-772105b56064/functional/sandbox_cgroup/sandbox_cgroup_test.sh (about)

     1  #!/bin/bash
     2  #
     3  # Copyright (c) 2020-2021 Intel Corporation
     4  #
     5  # SPDX-License-Identifier: Apache-2.0
     6  #
     7  # This will enable the sandbox_cgroup_only
     8  # to true in order to test that ctr is
     9  # working properly when this feature is
    10  # enabled
    11  
    12  set -o errexit
    13  set -o nounset
    14  set -o pipefail
    15  set -o errtrace
    16  
    17  dir_path=$(dirname "$0")
    18  source "${dir_path}/../../lib/common.bash"
    19  source "${dir_path}/../../.ci/lib.sh"
    20  tests_repo="${tests_repo:-github.com/kata-containers/tests}"
    21  TEST_SANDBOX_CGROUP_ONLY="${TEST_SANDBOX_CGROUP_ONLY:-}"
    22  
    23  if [ -z "${TEST_SANDBOX_CGROUP_ONLY}" ]; then
    24  	info "Skip: TEST_SANDBOX_CGROUP_ONLY variable is not set"
    25  	exit 0
    26  fi
    27  
    28  function setup() {
    29  	restart_containerd_service
    30  	check_processes
    31  }
    32  
    33  function test_stability() {
    34  	pushd "${GOPATH}/src/${tests_repo}"
    35  	".ci/set_kata_config.sh" sandbox_cgroup_only true
    36  	sudo -E PATH="$PATH" bash -c "make stability"
    37  	".ci/set_kata_config.sh" sandbox_cgroup_only false
    38  	popd
    39  }
    40  
    41  function teardown() {
    42  	clean_env_ctr
    43  	check_processes
    44  }
    45  
    46  trap teardown EXIT
    47  
    48  echo "Running setup"
    49  setup
    50  
    51  echo "Running stability integration tests with sandbox cgroup enabled"
    52  test_stability