From 1a1a716efb67ad852dbfdfc093512bf5bb2f0430 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pavel=20Mac=C3=ADk?= Date: Mon, 7 Oct 2024 16:15:44 +0200 Subject: [PATCH] feat(RHIDP-3671): collect RHDH population and access token logs (#97) (#99) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Pavel MacĂ­k --- ci-scripts/collect-results.sh | 3 +++ ci-scripts/rhdh-setup/create_resource.sh | 8 ++++---- test.env | 10 ++++++++++ 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/ci-scripts/collect-results.sh b/ci-scripts/collect-results.sh index 93ccb51..298ef93 100755 --- a/ci-scripts/collect-results.sh +++ b/ci-scripts/collect-results.sh @@ -75,6 +75,9 @@ try_gather_file "${TMP_DIR}/benchmark-scenario" try_gather_file "${TMP_DIR}/create_group.log" try_gather_file "${TMP_DIR}/create_user.log" try_gather_file "${TMP_DIR}/get_token.log" +try_gather_file "${TMP_DIR}/get_rhdh_token.log" +try_gather_file "${TMP_DIR}/get_api_count.log" +try_gather_file "${TMP_DIR}/get_component_count.log" try_gather_file load-test.log try_gather_file postgresql.log diff --git a/ci-scripts/rhdh-setup/create_resource.sh b/ci-scripts/rhdh-setup/create_resource.sh index 76c234c..e4b94bc 100755 --- a/ci-scripts/rhdh-setup/create_resource.sh +++ b/ci-scripts/rhdh-setup/create_resource.sh @@ -117,7 +117,7 @@ clone_and_upload() { ACCESS_TOKEN=$(get_token "rhdh") curl -k "$(backstage_url)/api/catalog/locations" --cookie "$COOKIE" --cookie-jar "$COOKIE" -X POST -H 'Accept-Encoding: gzip, deflate, br' -H 'Authorization: Bearer '"$ACCESS_TOKEN" -H 'Content-Type: application/json' --data-raw '{"type":"url","target":"'"${upload_url}"'"}' - timeout=600 + timeout=1800 timeout_timestamp=$(date -d "$timeout seconds" "+%s") last_count=-1 while true; do @@ -126,8 +126,8 @@ clone_and_upload() { exit 1 else ACCESS_TOKEN=$(get_token "rhdh") - if [[ 'component-*.yaml' == "${1}" ]]; then b_count=$(curl -s -k "$(backstage_url)/api/catalog/entity-facets?facet=kind" --cookie "$COOKIE" --cookie-jar "$COOKIE" -H 'Content-Type: application/json' -H 'Authorization: Bearer '"$ACCESS_TOKEN" | jq -r '.facets.kind[] | select(.value == "Component")| .count'); fi - if [[ 'api-*.yaml' == "${1}" ]]; then b_count=$(curl -s -k "$(backstage_url)/api/catalog/entity-facets?facet=kind" --cookie "$COOKIE" --cookie-jar "$COOKIE" -H 'Content-Type: application/json' -H 'Authorization: Bearer '"$ACCESS_TOKEN" | jq -r '.facets.kind[] | select(.value == "API")| .count'); fi + if [[ 'component-*.yaml' == "${1}" ]]; then b_count=$(curl -s -k "$(backstage_url)/api/catalog/entity-facets?facet=kind" --cookie "$COOKIE" --cookie-jar "$COOKIE" -H 'Content-Type: application/json' -H 'Authorization: Bearer '"$ACCESS_TOKEN" | tee -a "$TMP_DIR/get_component_count.log" | jq -r '.facets.kind[] | select(.value == "Component")| .count'); fi + if [[ 'api-*.yaml' == "${1}" ]]; then b_count=$(curl -s -k "$(backstage_url)/api/catalog/entity-facets?facet=kind" --cookie "$COOKIE" --cookie-jar "$COOKIE" -H 'Content-Type: application/json' -H 'Authorization: Bearer '"$ACCESS_TOKEN" | tee -a "$TMP_DIR/get_api_count.log" | jq -r '.facets.kind[] | select(.value == "API")| .count'); fi if [[ "$last_count" != "$b_count" ]] && [[ $last_count -ge 0 ]]; then # reset the timeout if current count changes log_info "The current count changed, resetting entity waiting timeout to $timeout seconds" timeout_timestamp=$(date -d "$timeout seconds" "+%s") @@ -308,7 +308,7 @@ rhdh_token() { --data-urlencode "code=$code" \ --data-urlencode "session_state=$session_state" \ --data-urlencode "state=$state" \ - "$CODE_URL" | jq -r ".backstageIdentity" | jq -r ".expires_in_timestamp = $(date -d '30 minutes' +%s)") + "$CODE_URL" | tee -a "$TMP_DIR/get_rhdh_token.log" | jq -r ".backstageIdentity" | jq -r ".expires_in_timestamp = $(date -d '30 minutes' +%s)") echo "$ACCESS_TOKEN" } diff --git a/test.env b/test.env index 13fff96..b93513b 100644 --- a/test.env +++ b/test.env @@ -56,3 +56,13 @@ # export ARTIFACT_DIR=.artifacts # export ENABLE_RBAC=false # export ENABLE_PROFILING=false + +## Scalability testing +# export SCALE_WORKERS="1 2" +# export SCALE_ACTIVE_USERS_SPAWN_RATES="1:1 200:40" +# export SCALE_BS_USERS_GROUPS="1:1 1000:250" +# export SCALE_CATALOG_SIZES="1:1 2500:2500" +# export SCALE_REPLICAS="1 2" +# export SCALE_DB_STORAGES="1Gi 2Gi" +# export SCALE_CPU_REQUESTS_LIMITS=": 1:1" +# export SCALE_MEMORY_REQUESTS_LIMITS=": 1Gi:1Gi"