Browse Source

Run test outside of the task

CLDC-3611-performance-testing
Kat 7 months ago
parent
commit
5f251c44e1
  1. 28
      .github/workflows/review_pipeline.yml

28
.github/workflows/review_pipeline.yml

@ -71,18 +71,22 @@ jobs:
email: performance_testing_user@example.com email: performance_testing_user@example.com
password: password password: password
run: | run: |
network=$(aws ecs describe-services --cluster $cluster --services $service --query services[0].networkConfiguration) echo install apache2-utils
overrides='{ "containerOverrides" : [{ "name" : "app", "command" : ["bundle", "exec", "rake", "performance:run_ab[$email,$password]"]}]}' sudo apt-get update && sudo apt-get install -y apache2-utils
arn=$(aws ecs run-task --cluster $cluster --task-definition $ad_hoc_task_definition --network-configuration "$network" --overrides "$overrides" --group migrations --launch-type FARGATE --query tasks[0].taskArn) echo get token
echo "Waiting for performance test task to complete" TOKEN=$(curl -c token_cookies.txt -s https://review.submit-social-housing-data.levellingup.gov.uk/2621/account/sign-in | grep '<meta name="csrf-token"' | sed -n 's/.*content="\\([^"]*\\)".*/\\1/p')
temp=${arn##*/}
id=${temp%*\"} echo "Logging in..."
aws ecs wait tasks-stopped --cluster $cluster --tasks $id
succeeded=$(aws ecs describe-tasks --cluster $cluster --tasks $id --query "tasks[0].stopCode == 'EssentialContainerExited' && to_string(tasks[0].containers[0].exitCode) == '0'") curl -L -o nul -c login_cookies.txt -b token_cookies.txt -X POST https://review.submit-social-housing-data.levellingup.gov.uk/2621/account/sign-in \
if [ $succeeded == true ]; then exit 0; else exit 1; fi -d "user[email]=$email" \
env: -d "user[password]=$password" \
PERFORMANCE_TESTING_USER_EMAIL: coordinator1@example.com -d "authenticity_token=$TOKEN"
PERFORMANCE_TESTING_USER_PASSWORD: password
COOKIES=$(awk '/_data_collector_session/ { print $6, $7 }' login_cookies.txt | tr ' ' '=')
echo "Running performance test..."
ab -n 50 -c 50 -C "$COOKIES" 'https://review.submit-social-housing-data.levellingup.gov.uk/2621/lettings-logs'
comment: comment:
name: Add link to PR name: Add link to PR

Loading…
Cancel
Save