Commit fbddb21 Ace Nassri
authored
1 parent fda06ee commit fbddb21 Copy full SHA for fbddb21
File tree 1 file changed +17
-17
lines changed
appengine/standard_python3/bundled-services/mail/flask
1 file changed +17
-17
lines changed Original file line number Diff line number Diff line change 14
14
15
15
import json
16
16
import subprocess
17
- import time
18
17
import uuid
19
18
20
19
import backoff
@@ -92,20 +91,21 @@ def test_send_receive(version):
92
91
assert "Successfully sent mail" in response .text
93
92
assert response .status_code == 201
94
93
95
- # Give the mail some time to be delivered and logs to post
96
- time .sleep (60 )
97
-
98
94
# Fetch logs to check messages on received mail
99
- entries = gcloud_cli (
100
- f'logging read "resource.type=gae_app AND resource.labels.version_id={ version_id } "'
101
- )
102
-
103
- text_payloads = ""
104
- for entry in entries :
105
- if "textPayload" in entry :
106
- text_payloads += entry ["textPayload" ]
107
- text_payloads += "\n "
108
-
109
- expected = f"Received greeting for valid-user@{ version_id } -dot-{ project_id } .appspotmail.com"
110
- assert expected in text_payloads
111
- assert "This message should be delivered" in text_payloads
95
+ @backoff .on_exception (backoff .expo , AssertionError , max_tries = 10 )
96
+ def assert_logs ():
97
+ entries = gcloud_cli (
98
+ f'logging read "resource.type=gae_app AND resource.labels.version_id={ version_id } "'
99
+ )
100
+
101
+ text_payloads = ""
102
+ for entry in entries :
103
+ if "textPayload" in entry :
104
+ text_payloads += entry ["textPayload" ]
105
+ text_payloads += "\n "
106
+
107
+ expected = f"Received greeting for valid-user@{ version_id } -dot-{ project_id } .appspotmail.com"
108
+ assert expected in text_payloads
109
+ assert "This message should be delivered" in text_payloads
110
+
111
+ assert_logs ()
You can’t perform that action at this time.
0 commit comments