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
bcde36df
Commit
bcde36df
authored
8 years ago
by
Florent Thiery
Browse files
Options
Downloads
Patches
Plain Diff
fix postfix test, fixes
#20388
parent
23eff59b
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_postfix.py
+3
-20
3 additions, 20 deletions
tests/test_postfix.py
with
3 additions
and
20 deletions
tests/test_postfix.py
+
3
−
20
View file @
bcde36df
...
...
@@ -4,34 +4,17 @@
Check that emails can be sent.
'''
import
os
import
re
import
subprocess
import
sys
if
not
os
.
path
.
exists
(
'
/etc/postfix
'
):
print
(
'
Postfix dir does not exists, test skipped.
'
)
sys
.
exit
(
1
)
else
:
# check that postfix listens the port 25 correctly
out
=
subprocess
.
check_output
(
'
netstat -pant | grep
\'
:25
\'
'
,
shell
=
True
)
out
=
out
.
decode
(
'
utf-8
'
)
if
out
else
''
# netstat -pant output columns are:
# Proto | Recv-Q | Send-Q | Local address | Foreign address | State | PID/Program name
expected
=
r
'
tcp +\d +\d +127\.0\.0\.1:25 +0\.0\.0\.0:\* +LISTEN +[\d]+/master
'
found
=
False
if
out
:
for
line
in
out
.
split
(
'
\n
'
):
line
=
re
.
sub
(
r
'
+
'
,
'
'
,
line
)
if
line
:
if
not
re
.
match
(
expected
,
line
):
print
(
'
Unexpected result for postfix listening ports:
\n
%s
'
%
line
)
sys
.
exit
(
1
)
else
:
found
=
True
if
not
found
:
status
,
out
=
subprocess
.
getstatusoutput
(
'
netstat -pant | grep master | grep 127.0.0.1:25
'
,
shell
=
True
)
if
status
!=
0
:
print
(
'
The port 25 is not listened by any process.
'
)
sys
.
exit
(
1
)
print
(
'
Postfix listening port: OK.
'
)
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