Skip to content

Commit 8de9d5d

Browse files
authored
DEVPROD-14931: Fix Cypress test flake (#649)
1 parent 8b335fb commit 8de9d5d

File tree

3 files changed

+24
-5
lines changed

3 files changed

+24
-5
lines changed

.evergreen/attach.yml

+14
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,20 @@ functions:
6767
bucket: evg-bucket-evergreen-ui
6868
content_type: text/plain
6969
permissions: public-read
70+
71+
attach-restore-logs:
72+
command: s3.put
73+
type: system
74+
params:
75+
aws_key: ${AWS_ACCESS_KEY_ID}
76+
aws_secret: ${AWS_SECRET_ACCESS_KEY}
77+
aws_session_token: ${AWS_SESSION_TOKEN}
78+
local_file: "ui/${app_dir}/restore-logs.txt"
79+
remote_file: ${build_variant}/${task_id}/${execution}/restore-logs.txt
80+
bucket: evg-bucket-evergreen-ui
81+
content_type: text/plain
82+
permissions: public-read
83+
display_name: restore-logs
7084

7185
attach-source-map:
7286
command: s3.put

.evergreen/evergreen.yml

+1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ post:
2828
- func: attach-cypress-results
2929
- func: attach-email
3030
- func: attach-logkeeper-logs
31+
- func: attach-restore-logs
3132
- func: attach-source-map
3233
- func: attach-storybook
3334
- func: attach-test-results

scripts/evg-db-ops.sh

+9-5
Original file line numberDiff line numberDiff line change
@@ -77,16 +77,20 @@ restore_db() {
7777
echo "Error: $1 does not exist. Ensure you have a valid dump before restoring."
7878
exit 1
7979
fi
80-
80+
if [ "$CI" = 'true' ]; then
81+
LOG_FILE="restore-logs.txt"
82+
else
83+
LOG_FILE="/dev/stdout"
84+
fi
8185
# Use 'mongorestore' to restore the database from the dump.
8286
for ((retry=0; retry<=MAX_RETRIES; retry++)); do
83-
if mongorestore --quiet --drop --uri="$2" "$1"; then
84-
echo "Successfully restored the database from $1."
87+
if mongorestore --stopOnError --drop --uri="$2" "$1" >> "$LOG_FILE" 2>&1; then
88+
echo "Successfully restored the database from $1." >> "$LOG_FILE"
8589
break
8690
else
87-
echo "Error restoring the database from $1. Retry attempt: $retry"
91+
echo "Error restoring the database from $1. Retry attempt: $retry" >> "$LOG_FILE"
8892
if [ $retry -eq $MAX_RETRIES ]; then
89-
echo "Max retries reached. Exiting."
93+
echo "Max retries reached. Exiting." >> "$LOG_FILE"
9094
exit 1
9195
fi
9296
sleep 3

0 commit comments

Comments
 (0)