Skip to content

Commit

Permalink
[Test] Add argument that allows to use downloaded devworkspace file l…
Browse files Browse the repository at this point in the history
…oad-tests script (#22890)

* add argument that allows to specify devfile that will be used
  • Loading branch information
SkorikSergey committed Mar 25, 2024
1 parent ac6f4ef commit 799565a
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 4 deletions.
3 changes: 2 additions & 1 deletion tests/performance/load-tests/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ What do you need to run those tests
1. Log in to Openshift cluster with Openshift DevSpaces or Eclipse Che deployed from terminal
2. Start `load-test.sh` script from `test/e2e/performance/load-tests`. Set number of started workspaces by -c parameter(like ./load-test.sh -c 5). Set timeout for waiting workspaces to start by -t parameter in seconds(like ./load-test.sh -t 240).
3. This script uses local dewvorspace.yaml to starts workspaces.
4. As results there are average time of workspace starting and number of failed workspaces.
4. Also it is possible to get test devworkspace yam file by link using -l option(like `./load-test.sh -l https://gist.githubusercontent.com/SkorikSergey/1856af20514ecce6c0dbb71f44fc0bcb/raw/3f6a38f0f6adf017dcecf6486ffe507ebe6cfc31/load-test-devworkspace.yaml)`.
5. As results there are average time of workspace starting and number of failed workspaces.


## Results and logs
Expand Down
File renamed without changes.
29 changes: 26 additions & 3 deletions tests/performance/load-tests/load-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ function cleanup() {
}

function parseArguments() {
while getopts "t:c:" opt; do
while getopts "t:c:l:" opt; do
case $opt in
t)
export WORKSPACE_IDLE_TIMEOUT=$OPTARG
Expand All @@ -38,6 +38,9 @@ function parseArguments() {
fi
export COMPLETITIONS_COUNT=$OPTARG
;;
l)
export DEVWORKSPACE_LINK=$OPTARG
;;
\?)
print_error "Invalid option -c. Try for example something like ./load-test.sh -c 7"
exit 1
Expand All @@ -46,7 +49,7 @@ function parseArguments() {
done
}

function setCompletitionsCount() {
function checkScriptVariables() {
# Set the number of workspaces to start
if [ -z $COMPLETITIONS_COUNT ]; then
echo "Parameter -c wasn't set, setting completitions count to 3."
Expand All @@ -61,6 +64,26 @@ function setCompletitionsCount() {
else
echo "Parameter -t was set to $WORKSPACE_IDLE_TIMEOUT second."
fi

# Get devworkspace yaml from link if it is set
# example - https://gist.githubusercontent.com/SkorikSergey/1856af20514ecce6c0dbb71f44fc0bcb/raw/3f6a38f0f6adf017dcecf6486ffe507ebe6cfc31/load-test-devworkspace.yaml
if [ -n "$DEVWORKSPACE_LINK" ]; then
if curl --fail --insecure "$DEVWORKSPACE_LINK" -o devworkspace.yaml; then
echo "Download succeeded, saved to devworkspace.yaml file."

echo "Check the devworkspace.yaml file content correctness."
if ! kubectl apply -f devworkspace.yaml --dry-run=server; then
print_error "Devworkspace.yaml file is not correct."
exit 1
fi
else
print_error "Download of $DEVWORKSPACE_LINK file failed"
exit 1
fi
else
print "Local devworkspace.yaml file will be used."
cp -f example.yaml devworkspace.yaml
fi
}

function getTimestamp() {
Expand Down Expand Up @@ -130,7 +153,7 @@ function printResults() {
}

parseArguments "$@"
setCompletitionsCount
checkScriptVariables
cleanup
runTest
printResults
Expand Down

0 comments on commit 799565a

Please sign in to comment.