github.com/redhat-appstudio/e2e-tests@v0.0.0-20240520140907-9709f6f59323/tests/load-tests/ci-scripts/load-test.sh (about) 1 #!/bin/bash 2 3 set -o nounset 4 set -o errexit 5 set -o pipefail 6 7 # shellcheck disable=SC1090 8 source "/usr/local/ci-secrets/redhat-appstudio-load-test/load-test-scenario.${1:-concurrent}" 9 10 pushd "${2:-./tests/load-tests}" 11 12 source "./ci-scripts/user-prefix.sh" 13 14 export QUAY_E2E_ORGANIZATION MY_GITHUB_ORG GITHUB_TOKEN TEKTON_PERF_ENABLE_PROFILING TEKTON_PERF_ENABLE_CPU_PROFILING TEKTON_PERF_ENABLE_MEMORY_PROFILING TEKTON_PERF_PROFILE_CPU_PERIOD KUBE_SCHEDULER_LOG_LEVEL 15 QUAY_E2E_ORGANIZATION=$(cat /usr/local/ci-secrets/redhat-appstudio-load-test/quay-org) 16 MY_GITHUB_ORG=$(cat /usr/local/ci-secrets/redhat-appstudio-load-test/github-org) 17 18 rate_limits_csv="${OUTPUT_DIR:-.}/gh-rate-limits-remaining.csv" 19 20 echo "Starting a watch for GH rate limits remainig" 21 IFS="," read -ra kvs <<<"$(cat /usr/local/ci-secrets/redhat-appstudio-load-test/github_accounts)" 22 echo -n "Time" >"$rate_limits_csv" 23 for kv in "${kvs[@]}"; do 24 IFS=":" read -ra name_token <<<"$kv" 25 echo -n ";${name_token[0]}" >>"$rate_limits_csv" 26 done 27 echo >>"$rate_limits_csv" 28 29 while true; do 30 timestamp=$(printf "%s" "$(date -u +'%FT%T')") 31 echo -n "$timestamp" >>"$rate_limits_csv" 32 for kv in "${kvs[@]}"; do 33 IFS=":" read -ra name_token <<<"$kv" 34 rate=$(curl -s -H "Accept: application/vnd.github+json" -H "Authorization: token ${name_token[1]}" -H "X-GitHub-Api-Version: 2022-11-28" 'https://api.github.com/rate_limit' | jq -rc '(.rate.remaining|tostring)') 35 echo -n ";$rate" >>"$rate_limits_csv" 36 done 37 echo >>"$rate_limits_csv" 38 sleep 10s 39 done & 40 41 rate_limit_exit=$! 42 kill_rate_limits() { 43 echo "Stopping the watch for GH rate limits remainig" 44 kill $rate_limit_exit 45 } 46 trap kill_rate_limits EXIT 47 48 ./run.sh 49 50 popd