Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
/components/ws-proxy @gitpod-io/engineering-workspace
/dev/gpctl @gitpod-io/engineering-workspace
/dev/loadgen @gitpod-io/engineering-workspace
/dev/preview @gitpod-io/platform
/operations/observability/mixins @gitpod-io/platform
/operations/observability/mixins/IDE @gitpod-io/engineering-ide
/operations/observability/mixins/meta @gitpod-io/engineering-webapp
Expand Down
71 changes: 71 additions & 0 deletions dev/preview/test/load-test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
#!/usr/bin/env bash
#
# This script makes it possible to run load tests against VM-based preview
# environments.
#
# Usage:
# ./dev/preview/test/load-test.sh
# ./dev/preview/test/load-test.sh --base-branch-name my-load-test-base-branch-name --start 1 --end 5
#

set -euo pipefail

function log {
echo "[$(date)] $*"
}

START=1
END=15
BASE_BRANCH_NAME="vm-load-test"

opts=$(getopt \
--longoptions "start:,end:,base-branch-name:" \
--name "$(basename "$0")" \
--options "" \
-- "$@"
)

eval set -- "$opts"

while [[ $# -gt 0 ]]; do
case "$1" in
--start) START=$2 ; shift 2 ;;
--end) END=$2 ; shift 2 ;;
--base-branch-name) BASE_BRANCH_NAME=$2 ; shift 2 ;;
*) break ;;
esac
done

while true; do
read -rp "
Are you sure you want to run the load test with the following configuration?

START=${START}
END=${END}
BASE_BRANCH_NAME=${BASE_BRANCH_NAME}

y/n: " yn
case "$yn" in
[Yy]* ) break;;
[Nn]* ) echo "Aborting load test" ; exit 0;;
* ) echo "Please answer y/n";;
esac
done

log "Creating base branch ${BASE_BRANCH_NAME}"
git checkout -b "${BASE_BRANCH_NAME}"
git commit --allow-empty -m "Prepare load test" -m "/werft with-vm=true"

for number in $(seq "${START}" "${END}"); do
branch="${BASE_BRANCH_NAME}-${number}"

log "Creating and pushing branch ${branch}"
git checkout -b "${branch}"
git push -u origin "${branch}"

log "Back to base branch ${BASE_BRANCH_NAME}"
git checkout "${BASE_BRANCH_NAME}"

log "Sleeping 30 seconds"
sleep 30
done