Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
envsetup
Manage
Activity
Members
Plan
Redmine
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Model registry
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mediaserver
envsetup
Commits
8fa34c36
Commit
8fa34c36
authored
7 years ago
by
Stéphane Diemer
Browse files
Options
Downloads
Patches
Plain Diff
Changed email test to handle deferred sendings (refs
#21068
).
parent
d1986508
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tests/test_email.py
+13
-6
13 additions, 6 deletions
tests/test_email.py
with
13 additions
and
6 deletions
tests/test_email.py
+
13
−
6
View file @
8fa34c36
...
@@ -88,16 +88,23 @@ def send_test_email():
...
@@ -88,16 +88,23 @@ def send_test_email():
print
(
'
Sending test email to
"
%s
"
.
'
%
email
)
print
(
'
Sending test email to
"
%s
"
.
'
%
email
)
cmd
=
'
echo
"
This is a test email
"
| mail -s
"
Test email from `cat /etc/hostname`
"
%s
'
%
email
cmd
=
'
echo
"
This is a test email
"
| mail -s
"
Test email from `cat /etc/hostname`
"
%s
'
%
email
subprocess
.
getstatusoutput
(
cmd
)
subprocess
.
getstatusoutput
(
cmd
)
time
.
sleep
(
3
)
timeout
=
120
waited
=
2
out
=
''
cmd
=
'
grep
"
%s
"
/var/log/mail.log
'
%
email
cmd
=
'
grep
"
%s
"
/var/log/mail.log
'
%
email
status
,
out
=
subprocess
.
getstatusoutput
(
cmd
)
while
True
:
if
status
!=
0
:
time
.
sleep
(
7
)
status
,
out
=
subprocess
.
getstatusoutput
(
cmd
)
status
,
out
=
subprocess
.
getstatusoutput
(
cmd
)
if
status
!=
0
:
if
status
==
0
:
out
=
out
.
strip
().
split
(
'
\n
'
)[
-
1
]
if
'
status=deferred
'
not
in
out
:
break
if
waited
>=
timeout
:
print_red
(
'
Failed to send email.
'
)
print_red
(
'
Failed to send email.
'
)
print
(
'
No log entry found using command: %s
'
%
cmd
)
print
(
'
No log entry found
after %s seconds
using command: %s
'
%
(
waited
,
cmd
)
)
return
1
return
1
print
(
'
Waiting %s seconds for email sending status.
'
%
waited
)
time
.
sleep
(
waited
)
waited
*=
2
if
'
bounced
'
not
in
out
or
'
The email account that you tried to reach does not exist.
'
in
out
:
if
'
bounced
'
not
in
out
or
'
The email account that you tried to reach does not exist.
'
in
out
:
print_green
(
'
Email sent.
'
)
print_green
(
'
Email sent.
'
)
return
0
return
0
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment