-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into renovate/all-non-major-github-action
- Loading branch information
Showing
30 changed files
with
582 additions
and
161 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,24 @@ | ||
#!/bin/bash | ||
|
||
# Setup | ||
current_time=$(date "+%Y.%m.%d-%H.%M.%S") | ||
perf_test_aws_s3_bucket=${PERF_TEST_AWS_S3_BUCKET:-notify-performance-test-results-staging} | ||
perf_test_csv_directory_path=${PERF_TEST_CSV_DIRECTORY_PATH:-/tmp/notify_performance_test} | ||
|
||
mkdir -p $perf_test_csv_directory_path/$current_time | ||
|
||
# Run old performance test and copy results to S3 | ||
locust --headless --config tests-perf/locust/locust.conf --html $perf_test_csv_directory_path/$current_time/index.html --csv $perf_test_csv_directory_path/$current_time/perf_test | ||
|
||
aws s3 cp $perf_test_csv_directory_path/ "s3://$perf_test_aws_s3_bucket" --recursive || exit 1 | ||
|
||
# Sleep 15 minutes to allow the system to stabilize | ||
sleep 900 | ||
|
||
# Run email send rate performance test | ||
# This configuration should send 10K emails / minute for 10 minutes for 100K emails total. | ||
# We run this test on Tuesday through Friday (just after midnight UTC) only. | ||
if [ "$(date +%u)" -ge 2 ] && [ "$(date +%u)" -le 5 ]; then | ||
locust --headless --host https://api.staging.notification.cdssandbox.xyz --locustfile tests-perf/locust/send_rate_email.py --users 5 --run-time 10m --spawn-rate 1 | ||
fi | ||
|
||
# Cleanup | ||
rm -rf $perf_test_csv_directory_path/$current_time |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
""" | ||
Revision ID: 0448_update_verify_code2 | ||
Revises: 0447_update_verify_code_template | ||
Create Date: 2023-10-05 00:00:00 | ||
""" | ||
from datetime import datetime | ||
|
||
from alembic import op | ||
from flask import current_app | ||
|
||
revision = "0448_update_verify_code2" | ||
down_revision = "0447_update_verify_code_template" | ||
|
||
near_content = "\n".join( | ||
[ | ||
"[[en]]", | ||
"Hi ((name)),", | ||
"", | ||
"Here is your security code to log in to GC Notify:", | ||
"", | ||
"^ ((verify_code))", | ||
"[[/en]]", | ||
"", | ||
"---", | ||
"", | ||
"[[fr]]", | ||
"Bonjour ((name)),", | ||
"", | ||
"Voici votre code de sécurité pour vous connecter à Notification GC:", | ||
"", | ||
"^ ((verify_code))", | ||
"[[/fr]]", | ||
] | ||
) | ||
|
||
|
||
templates = [ | ||
{ | ||
"id": current_app.config["EMAIL_2FA_TEMPLATE_ID"], | ||
"template_type": "email", | ||
"subject": "Sign in | Connectez-vous", | ||
"content": near_content, | ||
"process_type": "priority", | ||
}, | ||
] | ||
|
||
|
||
def upgrade(): | ||
conn = op.get_bind() | ||
|
||
for template in templates: | ||
current_version = conn.execute("select version from templates where id='{}'".format(template["id"])).fetchone() | ||
name = conn.execute("select name from templates where id='{}'".format(template["id"])).fetchone() | ||
template["version"] = current_version[0] + 1 | ||
template["name"] = name[0] | ||
|
||
template_update = """ | ||
UPDATE templates SET content = '{}', subject = '{}', version = '{}', updated_at = '{}' | ||
WHERE id = '{}' | ||
""" | ||
template_history_insert = """ | ||
INSERT INTO templates_history (id, name, template_type, created_at, content, archived, service_id, subject, | ||
created_by_id, version, process_type, hidden) | ||
VALUES ('{}', '{}', '{}', '{}', '{}', False, '{}', '{}', '{}', {}, '{}', false) | ||
""" | ||
|
||
for template in templates: | ||
op.execute( | ||
template_update.format( | ||
template["content"], | ||
template["subject"], | ||
template["version"], | ||
datetime.utcnow(), | ||
template["id"], | ||
) | ||
) | ||
|
||
op.execute( | ||
template_history_insert.format( | ||
template["id"], | ||
template["name"], | ||
template["template_type"], | ||
datetime.utcnow(), | ||
template["content"], | ||
current_app.config["NOTIFY_SERVICE_ID"], | ||
template["subject"], | ||
current_app.config["NOTIFY_USER_ID"], | ||
template["version"], | ||
template["process_type"], | ||
) | ||
) | ||
|
||
|
||
def downgrade(): | ||
pass |
Oops, something went wrong.