github.com/dmaizel/tests@v0.0.0-20210728163746-cae6a2d9cee8/integration/kubernetes/tests_common.sh (about) 1 # 2 # Copyright (c) 2021 Red Hat, Inc. 3 # 4 # SPDX-License-Identifier: Apache-2.0 5 # 6 # This script is evoked within an OpenShift Build to product the binary image, 7 # which will contain the Kata Containers installation into a given destination 8 # directory. 9 # 10 # This contains variables and functions common to all e2e tests. 11 12 # Timeout options, mainly for use with waitForProcess(). Use them unless the 13 # operation needs to wait longer. 14 wait_time=90 15 sleep_time=3 16 17 # Timeout for use with `kubectl wait`, unless it needs to wait longer. 18 # Note: try to keep timeout and wait_time equal. 19 timeout=90s 20 21 get_pod_config_dir() { 22 pod_config_dir="${BATS_TEST_DIRNAME}/runtimeclass_workloads" 23 info "k8s configured to use runtimeclass" 24 } 25 26 # Uses crictl to pull a container image passed in $1. 27 # If crictl is not found then it just prints a warning. 28 crictl_pull() { 29 local img="${1:-}" 30 local cmd="crictl" 31 if ! command -v "$cmd" &>/dev/null; then 32 warn "$cmd not found. Cannot pull image $img" 33 else 34 sudo -E "$cmd" pull "$img" 35 fi 36 }