github.com/dmaizel/tests@v0.0.0-20210728163746-cae6a2d9cee8/integration/kubernetes/run_kubernetes_tests.sh (about)

     1  #!/bin/bash
     2  #
     3  # Copyright (c) 2018 Intel Corporation
     4  #
     5  # SPDX-License-Identifier: Apache-2.0
     6  #
     7  
     8  set -e
     9  
    10  source /etc/os-release || source /usr/lib/os-release
    11  kubernetes_dir=$(dirname "$(readlink -f "$0")")
    12  cidir="${kubernetes_dir}/../../.ci/"
    13  source "${cidir}/lib.sh"
    14  
    15  arch="$(uname -m)"
    16  
    17  KATA_HYPERVISOR="${KATA_HYPERVISOR:-qemu}"
    18  
    19  # Using trap to ensure the cleanup occurs when the script exists.
    20  trap '${kubernetes_dir}/cleanup_env.sh' EXIT
    21  
    22  # Docker is required to initialize kubeadm, even if we are
    23  # using cri-o as the runtime.
    24  systemctl is-active --quiet docker || sudo systemctl start docker
    25  
    26  K8S_TEST_UNION=("k8s-attach-handlers.bats" \
    27  	"k8s-block-volume.bats" \
    28  	"k8s-configmap.bats" \
    29  	"k8s-copy-file.bats" \
    30  	"k8s-cpu-ns.bats" \
    31  	"k8s-credentials-secrets.bats" \
    32  	"k8s-custom-dns.bats" \
    33  	"k8s-empty-dirs.bats" \
    34  	"k8s-env.bats" \
    35  	"k8s-exec.bats" \
    36  	"k8s-expose-ip.bats" \
    37  	"k8s-job.bats" \
    38  	"k8s-limit-range.bats" \
    39  	"k8s-liveness-probes.bats" \
    40  	"k8s-memory.bats" \
    41  	"k8s-number-cpus.bats" \
    42  	"k8s-oom.bats" \
    43  	"k8s-parallel.bats" \
    44  	"k8s-pid-ns.bats" \
    45  	"k8s-pod-quota.bats" \
    46  	"k8s-port-forward.bats" \
    47  	"k8s-projected-volume.bats" \
    48  	"k8s-qos-pods.bats" \
    49  	"k8s-replication.bats" \
    50  	"k8s-scale-nginx.bats" \
    51  	"k8s-sysctls.bats" \
    52  	"k8s-security-context.bats" \
    53  	"k8s-shared-volume.bats" \
    54  	"k8s-volume.bats" \
    55  	"k8s-nginx-connectivity.bats" \
    56  	"k8s-hugepages.bats")
    57  
    58  # we may need to skip a few test cases when running on non-x86_64 arch
    59  if [ -f "${cidir}/${arch}/configuration_${arch}.yaml" ]; then
    60  	config_file="${cidir}/${arch}/configuration_${arch}.yaml"
    61  	arch_k8s_test_union=$(${cidir}/filter/filter_k8s_test.sh ${config_file} "${K8S_TEST_UNION[*]}")
    62  	mapfile -d " " -t K8S_TEST_UNION <<< "${arch_k8s_test_union}"
    63  fi
    64  
    65  pushd "$kubernetes_dir"
    66  ./init.sh
    67  for K8S_TEST_ENTRY in ${K8S_TEST_UNION[@]}
    68  do
    69  	bats "${K8S_TEST_ENTRY}"
    70  done
    71  popd