diff --git a/tests/e2e/createreport/launchresults.html b/tests/e2e/createreport/launchresults.html index 5237ec227f..6897b7fed6 100644 --- a/tests/e2e/createreport/launchresults.html +++ b/tests/e2e/createreport/launchresults.html @@ -14,8 +14,8 @@

-

Ubuntu 20.04 Test Results

-

Rocky Linux8.7 Test Results

diff --git a/tests/e2e/dnscache/Vagrantfile b/tests/e2e/dnscache/Vagrantfile index c57e9c393f..6056d16ed0 100644 --- a/tests/e2e/dnscache/Vagrantfile +++ b/tests/e2e/dnscache/Vagrantfile @@ -1,6 +1,6 @@ ENV['VAGRANT_NO_PARALLEL'] = ENV['E2E_STANDUP_PARALLEL'] ? nil : 'no' NODE_ROLES = (ENV['E2E_NODE_ROLES'] || ["server-0", "agent-0" ]) -NODE_BOXES = (ENV['E2E_NODE_BOXES'] || ['generic/ubuntu2004', 'generic/ubuntu2004']) +NODE_BOXES = (ENV['E2E_NODE_BOXES'] || ['generic/ubuntu2310', 'generic/ubuntu2310']) GITHUB_BRANCH = (ENV['E2E_GITHUB_BRANCH'] || "master") RELEASE_VERSION = (ENV['E2E_RELEASE_VERSION'] || "") NODE_CPUS = (ENV['E2E_NODE_CPUS'] || 2).to_i diff --git a/tests/e2e/dnscache/dnscache_test.go b/tests/e2e/dnscache/dnscache_test.go index 1a7a732fb9..2dfa110497 100644 --- a/tests/e2e/dnscache/dnscache_test.go +++ b/tests/e2e/dnscache/dnscache_test.go @@ -13,8 +13,8 @@ import ( "github.com/rancher/rke2/tests/e2e" ) -// Valid nodeOS: generic/ubuntu2004, opensuse/Leap-15.3.x86_64 -var nodeOS = flag.String("nodeOS", "generic/ubuntu2004", "VM operating system") +// Valid nodeOS: generic/ubuntu2310, opensuse/Leap-15.3.x86_64 +var nodeOS = flag.String("nodeOS", "generic/ubuntu2310", "VM operating system") var serverCount = flag.Int("serverCount", 1, "number of server nodes") var agentCount = flag.Int("agentCount", 1, "number of agent nodes") var ci = flag.Bool("ci", false, "running on CI") diff --git a/tests/e2e/dualstack/Vagrantfile b/tests/e2e/dualstack/Vagrantfile index 4880418b39..7021b17004 100644 --- a/tests/e2e/dualstack/Vagrantfile +++ b/tests/e2e/dualstack/Vagrantfile @@ -2,7 +2,7 @@ ENV['VAGRANT_NO_PARALLEL'] = ENV['E2E_STANDUP_PARALLEL'] ? nil : 'no' NODE_ROLES = (ENV['E2E_NODE_ROLES'] || ["server-0", "server-1", "server-2", "agent-0" ]) NODE_BOXES = (ENV['E2E_NODE_BOXES'] || - ['generic/ubuntu2004', 'generic/ubuntu2004', 'generic/ubuntu2004', 'generic/ubuntu2004']) + ['generic/ubuntu2310', 'generic/ubuntu2310', 'generic/ubuntu2310', 'generic/ubuntu2310']) GITHUB_BRANCH = (ENV['E2E_GITHUB_BRANCH'] || "master") RELEASE_VERSION = (ENV['E2E_RELEASE_VERSION'] || "") NODE_CPUS = (ENV['E2E_NODE_CPUS'] || 2).to_i diff --git a/tests/e2e/dualstack/dualstack_test.go b/tests/e2e/dualstack/dualstack_test.go index e7c2c30962..38ecd21598 100644 --- a/tests/e2e/dualstack/dualstack_test.go +++ b/tests/e2e/dualstack/dualstack_test.go @@ -13,8 +13,8 @@ import ( "github.com/rancher/rke2/tests/e2e" ) -// Valid nodeOS: generic/ubuntu2004, opensuse/Leap-15.3.x86_64 -var nodeOS = flag.String("nodeOS", "generic/ubuntu2004", "VM operating system") +// Valid nodeOS: generic/ubuntu2310, opensuse/Leap-15.3.x86_64 +var nodeOS = flag.String("nodeOS", "generic/ubuntu2310", "VM operating system") var serverCount = flag.Int("serverCount", 3, "number of server nodes") var agentCount = flag.Int("agentCount", 1, "number of agent nodes") var ci = flag.Bool("ci", false, "running on CI") diff --git a/tests/e2e/mixedos/Vagrantfile b/tests/e2e/mixedos/Vagrantfile index 75c742bb07..5eb61749c6 100644 --- a/tests/e2e/mixedos/Vagrantfile +++ b/tests/e2e/mixedos/Vagrantfile @@ -2,7 +2,7 @@ ENV['VAGRANT_NO_PARALLEL'] = ENV['E2E_STANDUP_PARALLEL'] ? nil : 'no' NODE_ROLES = (ENV['E2E_NODE_ROLES'] || ["server-0", "linux-agent-0", "windows-agent-0" ]) NODE_BOXES = (ENV['E2E_NODE_BOXES'] || -['generic/ubuntu2004', 'generic/ubuntu2004', 'jborean93/WindowsServer2022']) +['generic/ubuntu2310', 'generic/ubuntu2310', 'jborean93/WindowsServer2022']) GITHUB_BRANCH = (ENV['E2E_GITHUB_BRANCH'] || "master") RELEASE_VERSION = (ENV['E2E_RELEASE_VERSION'] || "") NODE_CPUS = (ENV['E2E_NODE_CPUS'] || 2).to_i diff --git a/tests/e2e/mixedos/mixedos_test.go b/tests/e2e/mixedos/mixedos_test.go index a798efee27..56d9671f4b 100644 --- a/tests/e2e/mixedos/mixedos_test.go +++ b/tests/e2e/mixedos/mixedos_test.go @@ -12,8 +12,8 @@ import ( "github.com/rancher/rke2/tests/e2e" ) -// Valid nodeOS: generic/ubuntu2004, opensuse/Leap-15.3.x86_64 -var nodeOS = flag.String("nodeOS", "generic/ubuntu2004", "operating system for linux nodes") +// Valid nodeOS: generic/ubuntu2310, opensuse/Leap-15.3.x86_64 +var nodeOS = flag.String("nodeOS", "generic/ubuntu2310", "operating system for linux nodes") var serverCount = flag.Int("serverCount", 1, "number of server nodes") var linuxAgentCount = flag.Int("linuxAgentCount", 1, "number of linux agent nodes") var windowsAgentCount = flag.Int("windowsAgentCount", 1, "number of windows agent nodes") diff --git a/tests/e2e/mixedosbgp/Vagrantfile b/tests/e2e/mixedosbgp/Vagrantfile index 6fe1e218c2..427c5a5b6e 100644 --- a/tests/e2e/mixedosbgp/Vagrantfile +++ b/tests/e2e/mixedosbgp/Vagrantfile @@ -2,7 +2,7 @@ ENV['VAGRANT_NO_PARALLEL'] = ENV['E2E_STANDUP_PARALLEL'] ? nil : 'no' NODE_ROLES = (ENV['E2E_NODE_ROLES'] || ["server-0", "linux-agent-0", "windows-agent-0" ]) NODE_BOXES = (ENV['E2E_NODE_BOXES'] || -['generic/ubuntu2004', 'generic/ubuntu2004', 'jborean93/WindowsServer2022']) +['generic/ubuntu2310', 'generic/ubuntu2310', 'jborean93/WindowsServer2022']) GITHUB_BRANCH = (ENV['E2E_GITHUB_BRANCH'] || "master") RELEASE_VERSION = (ENV['E2E_RELEASE_VERSION'] || "") NODE_CPUS = (ENV['E2E_NODE_CPUS'] || 2).to_i diff --git a/tests/e2e/mixedosbgp/mixedosbgp_test.go b/tests/e2e/mixedosbgp/mixedosbgp_test.go index af3322e6b1..b1dce7adc1 100644 --- a/tests/e2e/mixedosbgp/mixedosbgp_test.go +++ b/tests/e2e/mixedosbgp/mixedosbgp_test.go @@ -12,8 +12,8 @@ import ( "github.com/rancher/rke2/tests/e2e" ) -// Valid nodeOS: generic/ubuntu2004, opensuse/Leap-15.3.x86_64 -var nodeOS = flag.String("nodeOS", "generic/ubuntu2004", "operating system for linux nodes") +// Valid nodeOS: generic/ubuntu2310, opensuse/Leap-15.3.x86_64 +var nodeOS = flag.String("nodeOS", "generic/ubuntu2310", "operating system for linux nodes") var serverCount = flag.Int("serverCount", 1, "number of server nodes") var linuxAgentCount = flag.Int("linuxAgentCount", 1, "number of linux agent nodes") var windowsAgentCount = flag.Int("windowsAgentCount", 1, "number of windows agent nodes") diff --git a/tests/e2e/multus/Vagrantfile b/tests/e2e/multus/Vagrantfile index 7d16d75489..51f71fe814 100644 --- a/tests/e2e/multus/Vagrantfile +++ b/tests/e2e/multus/Vagrantfile @@ -1,6 +1,6 @@ ENV['VAGRANT_NO_PARALLEL'] = ENV['E2E_STANDUP_PARALLEL'] ? nil : 'no' NODE_ROLES = (ENV['E2E_NODE_ROLES'] || ["server-0", "agent-0" ]) -NODE_BOXES = (ENV['E2E_NODE_BOXES'] || ['generic/ubuntu2004', 'generic/ubuntu2004']) +NODE_BOXES = (ENV['E2E_NODE_BOXES'] || ['generic/ubuntu2310', 'generic/ubuntu2310']) GITHUB_BRANCH = (ENV['E2E_GITHUB_BRANCH'] || "master") RELEASE_VERSION = (ENV['E2E_RELEASE_VERSION'] || "") NODE_CPUS = (ENV['E2E_NODE_CPUS'] || 2).to_i diff --git a/tests/e2e/multus/multus_test.go b/tests/e2e/multus/multus_test.go index 24f28a3b54..3c28429b0e 100644 --- a/tests/e2e/multus/multus_test.go +++ b/tests/e2e/multus/multus_test.go @@ -13,8 +13,8 @@ import ( "github.com/rancher/rke2/tests/e2e" ) -// Valid nodeOS: generic/ubuntu2004, opensuse/Leap-15.3.x86_64 -var nodeOS = flag.String("nodeOS", "generic/ubuntu2004", "VM operating system") +// Valid nodeOS: generic/ubuntu2310, opensuse/Leap-15.3.x86_64 +var nodeOS = flag.String("nodeOS", "generic/ubuntu2310", "VM operating system") var serverCount = flag.Int("serverCount", 1, "number of server nodes") var agentCount = flag.Int("agentCount", 1, "number of agent nodes") var ci = flag.Bool("ci", false, "running on CI") diff --git a/tests/e2e/scripts/latest_commit.sh b/tests/e2e/scripts/latest_commit.sh index af5f5f5e95..429e1f89dd 100755 --- a/tests/e2e/scripts/latest_commit.sh +++ b/tests/e2e/scripts/latest_commit.sh @@ -1,7 +1,22 @@ #!/bin/bash # Grabs the last 5 commit SHA's from the given branch, then purges any commits that do not have a passing CI build iterations=0 -curl -s -H 'Accept: application/vnd.github.v3+json' "https://api.github.com/repos/rancher/rke2/commits?per_page=5&sha=$1" | jq -r '.[] | .sha' &> "$2" +response=$(curl -s -H 'Accept: application/vnd.github.v3+json' "https://api.github.com/repos/rancher/rke2/commits?per_page=5&sha=$1") +type=$(echo "$response" | jq -r type) + +# Verify if the response is an array with the rke2 commits +if [[ $type == "object" ]]; then + message=$(echo "$response" | jq -r .message) + if [[ $message == "API rate limit exceeded for "* ]]; then + echo "Github API rate limit exceeded" + exit 1 + fi + echo "Github API returned a non-expected response ${message}" + exit 1 +elif [[ $type == "array" ]]; then + echo ${response} | jq -r '.[] | .sha' &> "$2" +fi + curl -s --fail https://rke2-ci-builds.s3.amazonaws.com/rke2-images.linux-amd64-$(head -n 1 $2).tar.zst.sha256sum while [ $? -ne 0 ]; do ((iterations++)) diff --git a/tests/e2e/scripts/run_tests.sh b/tests/e2e/scripts/run_tests.sh index 24e9a3ca5e..632632145b 100755 --- a/tests/e2e/scripts/run_tests.sh +++ b/tests/e2e/scripts/run_tests.sh @@ -1,22 +1,26 @@ #!/bin/bash -nodeOS=${1:-"generic/ubuntu2004"} -servercount=${2:-3} -agentcount=${3:-1} -db=${4:-"etcd"} -hardened=${5:-""} -rke2_version=${rke2_version} -rke2_channel=${rke2_channel:-"commit"} - -E2E_EXTERNAL_DB=$db && export E2E_EXTERNAL_DB +# Usage: ./run_tests.sh +# This script runs all the rke2 e2e tests and generates a report with the log +# The generated log is placed in createreport/rke2_${OS}.log +# +# This script must be run inside the rke2 directory where the tests exist +# +# Example: +# To run the script with default settings: +# ./run_tests.sh +# +set -x + +# tests to run +tests=("ciliumnokp" "dnscache" "dualstack" "mixedos" "mixedosbgp" "multus" "secretsencryption" "splitserver" "upgradecluster" "validatecluster") +nodeOS=${1:-"generic/ubuntu2310"} +OS=$(echo "$nodeOS"|cut -d'/' -f2) + E2E_REGISTRY=true && export E2E_REGISTRY -cd -cd rke2 && git pull --rebase origin master +git pull --rebase origin master /usr/local/go/bin/go mod tidy - cd tests/e2e -OS=$(echo "$nodeOS"|cut -d'/' -f2) -echo "$OS" # create directory to store reports if it does not exists if [ ! -d createreport ] @@ -24,39 +28,34 @@ then mkdir createreport fi +# Remove VMs which are in invalid state +vagrant global-status --prune + count=0 run_tests(){ - count=$(( count + 1 )) - vagrant global-status | awk '/running/'|cut -c1-7| xargs -r -d '\n' -n 1 -- vagrant destroy -f - - E2E_RELEASE_VERSION=$rke2_version && export E2E_RELEASE_VERSION - E2E_RELEASE_CHANNEL=$rke2_channel && export E2E_RELEASE_CHANNEL - - echo 'RUNNING CLUSTER UPGRADE TEST' - E2E_REGISTRY=true /usr/local/go/bin/go test -v ./upgradecluster/upgradecluster_test.go -nodeOS="$nodeOS" -serverCount=$((servercount)) -agentCount=$((agentcount)) -timeout=1h -json -ci |tee createreport/rke2_"$OS".log - - echo 'RUNNING DUALSTACK VALIDATION TEST' - E2E_HARDENED="$hardened" /usr/local/go/bin/go test -v dualstack/dualstack_test.go -nodeOS="$nodeOS" -serverCount=1 -agentCount=1 -timeout=30m -json -ci |tee -a createreport/rke2_"$OS".log - echo 'RUNNING CLUSTER VALIDATION TEST' - E2E_REGISTRY=true E2E_HARDENED="$hardened" /usr/local/go/bin/go test -v validatecluster/validatecluster_test.go -nodeOS="$nodeOS" -serverCount=$((servercount)) -agentCount=$((agentcount)) -timeout=30m -json -ci |tee -a createreport/rke2_"$OS".log + count=$(( count + 1 )) - echo 'RUNNING MIXEDOS TEST' - /usr/local/go/bin/go test -v mixedos/mixedos_test.go -nodeOS="$nodeOS" -serverCount=$((servercount)) -timeout=1h -json -ci |tee -a createreport/rke2_"$OS".log + for i in ${!tests[@]}; do + pushd ${tests[$i]} + vagrant destroy -f - echo 'RUNNING SPLIT SERVER VALIDATION TEST' - E2E_HARDENED="$hardened" /usr/local/go/bin/go test -v splitserver/splitserver_test.go -nodeOS="$nodeOS" -timeout=30m -json -ci |tee -a createreport/rke2_"$OS".log + echo "RUNNING ${tests[$i]} TEST" + /usr/local/go/bin/go test -v ${tests[$i]}_test.go -timeout=2h -nodeOS="$nodeOS" -json -ci |tee -a ../createreport/rke2_${OS}.log + + popd + done } -ls createreport/rke2_"$OS".log 2>/dev/null && rm createreport/rke2_"$OS".log +ls createreport/rke2_${OS}.log 2>/dev/null && rm createreport/rke2_${OS}.log run_tests # re-run test if first run fails and keep record of repeatedly failed test to debug -while [ -f createreport/rke2_"$OS".log ] && grep -w ":fail" createreport/rke2_"$OS".log && [ $count -le 2 ] +while [ -f createreport/rke2_${OS}.log ] && grep -w " FAIL:" createreport/rke2_${OS}.log && [ $count -le 2 ] do - cp createreport/rke2_"$OS".log createreport/rke2_"$OS"_"$count".log + cp createreport/rke2_${OS}.log createreport/rke2_${OS}_${count}.log run_tests done # Generate report and upload to s3 bucket -cd createreport && /usr/local/go/bin/go run -v report-template-bindata.go generate_report.go -f rke2_"OS".log +cd createreport && /usr/local/go/bin/go run -v report-template-bindata.go generate_report.go -f rke2_${OS}.log diff --git a/tests/e2e/splitserver/Vagrantfile b/tests/e2e/splitserver/Vagrantfile index 0b2cff593b..c99dd4017f 100644 --- a/tests/e2e/splitserver/Vagrantfile +++ b/tests/e2e/splitserver/Vagrantfile @@ -2,7 +2,7 @@ ENV['VAGRANT_NO_PARALLEL'] = ENV['E2E_STANDUP_PARALLEL'] ? nil : 'no' NODE_ROLES = (ENV['E2E_NODE_ROLES'] || ["server-etcd-0", "server-cp-0", "server-cp-1", "agent-0"]) NODE_BOXES = (ENV['E2E_NODE_BOXES'] || - ['generic/ubuntu2004', 'generic/ubuntu2004', 'generic/ubuntu2004', 'generic/ubuntu2004', 'generic/ubuntu2004']) + ['generic/ubuntu2310', 'generic/ubuntu2310', 'generic/ubuntu2310', 'generic/ubuntu2310', 'generic/ubuntu2310']) GITHUB_BRANCH = (ENV['E2E_GITHUB_BRANCH'] || "master") RELEASE_VERSION = (ENV['E2E_RELEASE_VERSION'] || "") NODE_CPUS = (ENV['E2E_NODE_CPUS'] || 2).to_i diff --git a/tests/e2e/splitserver/splitserver_test.go b/tests/e2e/splitserver/splitserver_test.go index aa330ca96c..abd4d89e87 100644 --- a/tests/e2e/splitserver/splitserver_test.go +++ b/tests/e2e/splitserver/splitserver_test.go @@ -13,8 +13,8 @@ import ( "github.com/rancher/rke2/tests/e2e" ) -// Valid nodeOS: generic/ubuntu2004, opensuse/Leap-15.3.x86_64 -var nodeOS = flag.String("nodeOS", "generic/ubuntu2004", "VM operating system") +// Valid nodeOS: generic/ubuntu2310, opensuse/Leap-15.3.x86_64 +var nodeOS = flag.String("nodeOS", "generic/ubuntu2310", "VM operating system") var etcdCount = flag.Int("etcdCount", 1, "number of server nodes only deploying etcd") var controlPlaneCount = flag.Int("controlPlaneCount", 1, "number of server nodes acting as control plane") var agentCount = flag.Int("agentCount", 1, "number of agent nodes") diff --git a/tests/e2e/upgradecluster/Vagrantfile b/tests/e2e/upgradecluster/Vagrantfile index af8bdb3631..e59b2a5483 100644 --- a/tests/e2e/upgradecluster/Vagrantfile +++ b/tests/e2e/upgradecluster/Vagrantfile @@ -2,7 +2,7 @@ ENV['VAGRANT_NO_PARALLEL'] = ENV['E2E_STANDUP_PARALLEL'] ? nil : 'no' NODE_ROLES = (ENV['E2E_NODE_ROLES'] || ["server-0", "server-1", "server-2", "agent-0"]) NODE_BOXES = (ENV['E2E_NODE_BOXES'] || - ['generic/ubuntu2004', 'generic/ubuntu2004', 'generic/ubuntu2004', 'generic/ubuntu2004']) + ['generic/ubuntu2310', 'generic/ubuntu2310', 'generic/ubuntu2310', 'generic/ubuntu2310']) RELEASE_CHANNEL = (ENV['E2E_RELEASE_CHANNEL'] || "latest") RELEASE_VERSION = (ENV['E2E_RELEASE_VERSION'] || "") NODE_CPUS = (ENV['E2E_NODE_CPUS'] || 2).to_i diff --git a/tests/e2e/upgradecluster/upgradecluster_test.go b/tests/e2e/upgradecluster/upgradecluster_test.go index b24946b2f5..d2e6df8c92 100644 --- a/tests/e2e/upgradecluster/upgradecluster_test.go +++ b/tests/e2e/upgradecluster/upgradecluster_test.go @@ -12,8 +12,8 @@ import ( "github.com/rancher/rke2/tests/e2e" ) -// Valid nodeOS: generic/ubuntu2004, opensuse/Leap-15.3.x86_64 -var nodeOS = flag.String("nodeOS", "generic/ubuntu2004", "VM operating system") +// Valid nodeOS: generic/ubuntu2310, opensuse/Leap-15.3.x86_64 +var nodeOS = flag.String("nodeOS", "generic/ubuntu2310", "VM operating system") var serverCount = flag.Int("serverCount", 3, "number of server nodes") var agentCount = flag.Int("agentCount", 1, "number of agent nodes") var ci = flag.Bool("ci", false, "running on CI") diff --git a/tests/e2e/validatecluster/Vagrantfile b/tests/e2e/validatecluster/Vagrantfile index c2a2270ad3..f52114b478 100644 --- a/tests/e2e/validatecluster/Vagrantfile +++ b/tests/e2e/validatecluster/Vagrantfile @@ -2,7 +2,7 @@ ENV['VAGRANT_NO_PARALLEL'] = ENV['E2E_STANDUP_PARALLEL'] ? nil : 'no' NODE_ROLES = (ENV['E2E_NODE_ROLES'] || ["server-0", "server-1", "server-2", "agent-0" ]) NODE_BOXES = (ENV['E2E_NODE_BOXES'] || - ['generic/ubuntu2004', 'generic/ubuntu2004', 'generic/ubuntu2004', 'generic/ubuntu2004']) + ['generic/ubuntu2310', 'generic/ubuntu2310', 'generic/ubuntu2310', 'generic/ubuntu2310']) GITHUB_BRANCH = (ENV['E2E_GITHUB_BRANCH'] || "master") RELEASE_VERSION = (ENV['E2E_RELEASE_VERSION'] || "") NODE_CPUS = (ENV['E2E_NODE_CPUS'] || 2).to_i diff --git a/tests/e2e/validatecluster/validatecluster_test.go b/tests/e2e/validatecluster/validatecluster_test.go index 48ed2a1a6a..c234a91ecc 100644 --- a/tests/e2e/validatecluster/validatecluster_test.go +++ b/tests/e2e/validatecluster/validatecluster_test.go @@ -13,8 +13,8 @@ import ( "github.com/rancher/rke2/tests/e2e" ) -// Valid nodeOS: generic/ubuntu2004, opensuse/Leap-15.3.x86_64 -var nodeOS = flag.String("nodeOS", "generic/ubuntu2004", "VM operating system") +// Valid nodeOS: generic/ubuntu2310, opensuse/Leap-15.3.x86_64 +var nodeOS = flag.String("nodeOS", "generic/ubuntu2310", "VM operating system") var serverCount = flag.Int("serverCount", 3, "number of server nodes") var agentCount = flag.Int("agentCount", 1, "number of agent nodes") var ci = flag.Bool("ci", false, "running on CI")