2022-08-05 16:16:10 +00:00
#!/bin/bash
2023-01-12 00:09:45 +00:00
2024-08-12 16:26:19 +00:00
nodeOS = ${ 1 :- "bento/ubuntu-24.04" }
2023-01-12 00:09:45 +00:00
servercount = ${ 2 :- 3 }
agentcount = ${ 3 :- 1 }
db = ${ 4 :- "etcd" }
hardened = ${ 5 :- "" }
2022-08-05 16:16:10 +00:00
2024-10-23 16:36:06 +00:00
cleanup( ) {
for net in $( virsh net-list --all | tail -n +2 | tr -s ' ' | cut -d ' ' -f2 | grep -v default) ; do
virsh net-destroy " $net "
virsh net-undefine " $net "
done
for domain in $( virsh list --all | tail -n +2 | tr -s ' ' | cut -d ' ' -f3) ; do
virsh destroy " $domain "
virsh undefine " $domain " --remove-all-storage
done
for vm in $( vagrant global-status | tr -s ' ' | tail +3 | grep "/" | cut -d ' ' -f5) ; do
cd $vm
vagrant destroy -f
cd ..
done
# Prune Vagrant global status
vagrant global-status --prune
}
2022-08-05 16:16:10 +00:00
E2E_EXTERNAL_DB = $db && export E2E_EXTERNAL_DB
2022-09-19 19:15:48 +00:00
E2E_REGISTRY = true && export E2E_REGISTRY
2022-08-05 16:16:10 +00:00
2023-01-12 00:09:45 +00:00
cd
cd k3s && git pull --rebase origin master
/usr/local/go/bin/go mod tidy
cd tests/e2e
OS = $( echo " $nodeOS " | cut -d'/' -f2)
echo " $OS "
2023-01-18 17:34:52 +00:00
vagrant global-status | awk '/running/' | cut -c1-7| xargs -r -d '\n' -n 1 -- vagrant destroy -f
2024-10-23 16:36:06 +00:00
# To reduce GH API requsts, we grab the latest commit on the host and pass it to the tests
./scripts/latest_commit.sh master latest_commit.txt
E2E_RELEASE_VERSION = $( cat latest_commit.txt) && export E2E_RELEASE_VERSION
2023-01-12 00:09:45 +00:00
2023-01-18 17:34:52 +00:00
echo 'RUNNING DUALSTACK 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 k3s_" $OS " .log
2023-01-12 00:09:45 +00:00
2023-01-18 17:34:52 +00:00
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 k3s_" $OS " .log
2022-08-05 16:16:10 +00:00
2023-01-18 17:34:52 +00:00
echo 'RUNNING SECRETS ENCRYPTION TEST'
/usr/local/go/bin/go test -v secretsencryption/secretsencryption_test.go -nodeOS= " $nodeOS " -serverCount= $(( servercount)) -timeout= 1h -json -ci | tee -a k3s_" $OS " .log
2022-10-31 18:02:44 +00:00
2023-01-18 17:34:52 +00:00
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 k3s_" $OS " .log
2022-08-05 16:16:10 +00:00
2023-02-06 18:39:46 +00:00
echo 'RUNNING STARTUP VALIDATION TEST'
/usr/local/go/bin/go test -v startup/startup_test.go -nodeOS= " $nodeOS " -timeout= 30m -json -ci | tee -a k3s_" $OS " .log
2022-10-31 18:02:44 +00:00
2023-01-18 17:34:52 +00:00
echo 'RUNNING EXTERNAL IP TEST'
/usr/local/go/bin/go test -v externalip/externalip_test.go -nodeOS= " $nodeOS " -serverCount= 1 -agentCount= 1 -timeout= 30m -json -ci | tee -a k3s_" $OS " .log
2022-10-31 18:02:44 +00:00
2023-01-18 17:34:52 +00:00
echo 'RUNNING SNAPSHOT AND RESTORE TEST'
/usr/local/go/bin/go test -v snapshotrestore/snapshotrestore_test.go -nodeOS= " $nodeOS " -serverCount= 1 -agentCount= 1 -timeout= 30m -json -ci | tee -a k3s_" $OS " .log
2022-08-05 16:16:10 +00:00
2023-03-17 00:56:17 +00:00
echo 'RUNNING ROTATE CUSTOM CA TEST'
/usr/local/go/bin/go test -v rotateca/rotateca_test.go -nodeOS= " $nodeOS " -serverCount= 1 -agentCount= 1 -timeout= 30m -json -ci | tee -a k3s_" $OS " .log
2024-10-23 16:36:06 +00:00
# For upgrade test we use the release channel install as the starting point
unset E2E_RELEASE_VERSION
2023-01-18 17:34:52 +00:00
E2E_RELEASE_CHANNEL = "latest" && 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 -a k3s_" $OS " .log