-
Notifications
You must be signed in to change notification settings - Fork 268
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor run_tests.sh script #6280
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,62 +1,61 @@ | ||
#!/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 ] | ||
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some tests have just server nodes and no agents. Some have HA and some single server single agent. Can we default then in Vagrantfile?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, vagrantfile defaults the number of servers and agents per test. Same for the OS