tests/e2e: add step information and clean resources after every step

pull/467/head
iwilltry42 4 years ago
parent b043565852
commit 58cf15b0e5
No known key found for this signature in database
GPG Key ID: 7BA57AD1CFF16110
  1. 2
      tests/common.sh
  2. 2
      tests/extra_test_k3s_versions.sh
  3. 10
      tests/runner.sh
  4. 2
      tests/test_basic.sh
  5. 2
      tests/test_config_file.sh
  6. 2
      tests/test_full_lifecycle.sh
  7. 2
      tests/test_multi_master.sh
  8. 6
      tests/test_multi_master_start_stop.sh
  9. 2
      tests/test_registry.sh

@ -13,7 +13,7 @@ BLOCK='\033[1;37m'
PATH=/usr/local/bin:$PATH
export PATH
log() { >&2 printf "${BLOCK}>>>${END} $1\n"; }
log() { >&2 printf "$(date -u +"%Y-%m-%d %H:%M:%S %Z") [${CURRENT_STAGE:-undefined}] ${BLOCK}>>>${END} $1\n"; }
info() { log "${BLU}$1${END}"; }
highlight() { log "${MGT}$1${END}"; }

@ -11,6 +11,8 @@ source "$CURR_DIR/common.sh"
for version in "${K3S_VERSIONS[@]}"; do
export CURRENT_STAGE="Suite | k3s-versions | $version"
info "Creating a cluster with k3s version $version ..."
$EXE cluster create c1 --wait --timeout 60s --image "rancher/k3s:$version" || failed "could not create cluster with k3s version $version"

@ -7,7 +7,9 @@ CURR_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
: "${E2E_EXCLUDE:=""}"
: "${E2E_EXTRA:=""}"
# shellcheck source=./common.sh
export CURRENT_STAGE="Runner"
# shellcheck disable=SC1091
source "$CURR_DIR/common.sh"
#########################################################################################
@ -16,13 +18,13 @@ source "$CURR_DIR/common.sh"
info "Preparing filesystem and environment..."
mkdir -p $HOME/.kube
mkdir -p "$HOME"/.kube
echo "Start time inside runner: $(date)"
section "BASIC TESTS"
for i in $CURR_DIR/test_*.sh ; do
for i in "$CURR_DIR"/test_*.sh ; do
base=$(basename "$i" .sh)
skip=false
included=false
@ -64,7 +66,7 @@ done
# Additional (extra) tests
if [[ -n "$E2E_EXTRA" ]]; then
section "EXTRA TESTS"
for i in $CURR_DIR/extra_test_*.sh ; do
for i in "$CURR_DIR"/extra_test_*.sh ; do
base=$(basename "$i" .sh)
if [[ $E2E_EXCLUDE =~ (^| )$base($| ) ]]; then
highlight "***** Skipping $base *****"

@ -6,6 +6,8 @@ CURR_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
# shellcheck source=./common.sh
source "$CURR_DIR/common.sh"
export CURRENT_STAGE="Test | basic"
info "Creating two clusters..."
$EXE cluster create c1 --wait --timeout 60s --api-port 6443 --env 'TEST_VAR=user\@pass\\@server[0]' || failed "could not create cluster c1"
$EXE cluster create c2 --wait --timeout 60s || failed "could not create cluster c2"

@ -15,6 +15,8 @@ if [[ -n "$K3S_IMAGE_TAG" ]]; then
EXTRA_TITLE="(rancher/k3s:$K3S_IMAGE_TAG)"
fi
export CURRENT_STAGE="Test | config-file | $K3S_IMAGE_TAG"
clustername="ConfigTest"

@ -15,6 +15,8 @@ if [[ -n "$K3S_IMAGE_TAG" ]]; then
EXTRA_TITLE="(rancher/k3s:$K3S_IMAGE_TAG)"
fi
export CURRENT_STAGE="Test | lifecycle | $K3S_IMAGE_TAG"
clustername="lifecycletest"

@ -14,6 +14,8 @@ if [[ -n "$K3S_IMAGE_TAG" ]]; then
EXTRA_TITLE="(rancher/k3s:$K3S_IMAGE_TAG)"
fi
export CURRENT_STAGE="Test | multi-server | $K3S_IMAGE_TAG"
info "Creating cluster multiserver $EXTRA_TITLE ..."
$EXE cluster create "multiserver" --servers 3 --api-port 6443 --wait --timeout 360s $EXTRA_FLAG || failed "could not create cluster multiserver $EXTRA_TITLE"
info "Checking that we have access to the cluster..."

@ -14,6 +14,8 @@ if [[ -n "$K3S_IMAGE_TAG" ]]; then
EXTRA_TITLE="(rancher/k3s:$K3S_IMAGE_TAG)"
fi
export CURRENT_STAGE="Test | multi-server-start-stop | $K3S_IMAGE_TAG"
info "Creating cluster multiserver $EXTRA_TITLE ..."
$EXE cluster create "multiserver" --servers 3 --api-port 6443 --wait --timeout 360s $EXTRA_FLAG || failed "could not create cluster multiserver $EXTRA_TITLE"
info "Checking that we have access to the cluster..."
@ -31,8 +33,8 @@ $EXE cluster stop "multiserver" || failed "failed to stop cluster"
info "Waiting for a bit..."
sleep 5
info "Restarting cluster..."
$EXE cluster start multiserver || failed "failed to restart cluster"
info "Restarting cluster (time: $(date -u +"%Y-%m-%d %H:%M:%S %Z"))..."
$EXE cluster start multiserver --timeout 180s || failed "failed to restart cluster (timeout 180s)"
info "Sleeping for 5 seconds to give the cluster enough time to get ready..."
sleep 5

@ -15,6 +15,8 @@ if [[ -n "$K3S_IMAGE_TAG" ]]; then
EXTRA_TITLE="(rancher/k3s:$K3S_IMAGE_TAG)"
fi
export CURRENT_STAGE="Test | registry | $K3S_IMAGE_TAG"
clustername="registrytest"

Loading…
Cancel
Save