diff --git a/scripts/test b/scripts/test index ce89ff086e..57b9c88af3 100755 --- a/scripts/test +++ b/scripts/test @@ -18,6 +18,9 @@ docker ps . ./scripts/test-run-basics echo "Did test-run-basics $?" +. ./scripts/test-run-compat +echo "Did test-run-compat $?" + # --- [ "$ARCH" != 'amd64' ] && \ diff --git a/scripts/test-helpers b/scripts/test-helpers index 136253d818..bb3aa2a5a1 100755 --- a/scripts/test-helpers +++ b/scripts/test-helpers @@ -419,7 +419,7 @@ provision-server() { -e K3S_TOKEN=$(cat $TEST_DIR/metadata/secret) \ -e K3S_DEBUG=true \ ${REGISTRY_CLUSTER_ARGS:-} \ - $K3S_IMAGE server $ARGS $SERVER_ARGS ${!SERVER_INSTANCE_ARGS} + ${K3S_IMAGE_SERVER:-$K3S_IMAGE} server $ARGS $SERVER_ARGS ${!SERVER_INSTANCE_ARGS} local ip=$(docker inspect --format '{{ .NetworkSettings.IPAddress }}' $name | tee $TEST_DIR/servers/$count/metadata/ip) local url=$(echo "https://$ip:6443" | tee $TEST_DIR/servers/$count/metadata/url) @@ -446,7 +446,7 @@ provision-agent() { -e K3S_TOKEN=$(cat $TEST_DIR/metadata/secret) \ -e K3S_URL=$K3S_URL \ ${REGISTRY_CLUSTER_ARGS:-} \ - $K3S_IMAGE agent $ARGS $AGENT_ARGS ${!AGENT_INSTANCE_ARGS} + ${K3S_IMAGE_AGENT:-$K3S_IMAGE} agent $ARGS $AGENT_ARGS ${!AGENT_INSTANCE_ARGS} echo "Started $name" run-function agent-post-hook $count diff --git a/scripts/test-run-compat b/scripts/test-run-compat new file mode 100755 index 0000000000..4833e650e4 --- /dev/null +++ b/scripts/test-run-compat @@ -0,0 +1,37 @@ +#!/bin/bash + +all_services=( + coredns + local-path-provisioner + metrics-server + traefik +) + +export NUM_SERVERS=1 +export NUM_AGENTS=1 +export WAIT_SERVICES="${all_services[@]}" +export SERVER_ARGS="--node-taint=CriticalAddonsOnly=true:NoExecute" + +start-test() { + echo "Cluster is up" +} +export -f start-test + +REPO=${REPO:-rancher} +IMAGE_NAME=${IMAGE_NAME:-k3s} +PREVIOUS_CHANNEL=$(curl -s https://update.k3s.io/v1-release/channels/stable -o /dev/null -w '%{redirect_url}' | awk -F. '{print "v1." ($(NF - 1) - 1)}') +PREVIOUS_VERSION=$(curl -s https://update.k3s.io/v1-release/channels/${PREVIOUS_CHANNEL} -o /dev/null -w '%{redirect_url}' | awk -F/ '{print gensub(/\+/, "-", "g", $NF)}') +STABLE_VERSION=$(curl -s https://update.k3s.io/v1-release/channels/stable -o /dev/null -w '%{redirect_url}' | awk -F/ '{print gensub(/\+/, "-", "g", $NF)}') +LATEST_VERSION=$(curl -s https://update.k3s.io/v1-release/channels/latest -o /dev/null -w '%{redirect_url}' | awk -F/ '{print gensub(/\+/, "-", "g", $NF)}') + +# --- create a basic cluster to test for compat with the previous minor version of the server and agent +K3S_IMAGE_SERVER=${REPO}/${IMAGE_NAME}:${PREVIOUS_VERSION} LABEL=PREVIOUS-SERVER run-test +K3S_IMAGE_AGENT=${REPO}/${IMAGE_NAME}:${PREVIOUS_VERSION} LABEL=PREVIOUS-AGENT run-test + +# --- create a basic cluster to test for compat with the stable version of the server and agent +K3S_IMAGE_SERVER=${REPO}/${IMAGE_NAME}:${STABLE_VERSION} LABEL=STABLE-SERVER run-test +K3S_IMAGE_AGENT=${REPO}/${IMAGE_NAME}:${STABLE_VERSION} LABEL=STABLE-AGENT run-test + +# --- create a basic cluster to test for compat with the latest version of the server and agent +K3S_IMAGE_SERVER=${REPO}/${IMAGE_NAME}:${LATEST_VERSION} LABEL=LATEST-SERVER run-test +K3S_IMAGE_AGENT=${REPO}/${IMAGE_NAME}:${LATEST_VERSION} LABEL=LATEST-AGENT run-test