Add backup MXer to testing

This commit is contained in:
Matthew McPherrin 2012-03-14 16:01:04 -04:00
parent 3a93d9c63d
commit 4e05bfc91e
1 changed files with 16 additions and 15 deletions

View File

@ -1,22 +1,23 @@
#!/usr/bin/env python
import socket, sys
s = socket.socket()
try:
s.connect(('mail.csclub.uwaterloo.ca', 25))
l220 = s.recv(128)
except socket.error, e:
print "FAIL", e
sys.exit(1)
for S in ['mail.csclub.uwaterloo.ca', 'mail2.csclub.uwaterloo.ca']:
s = socket.socket()
try:
s.connect((S, 25))
l220 = s.recv(128)
except socket.error, e:
print "FAIL", S, e
sys.exit(1)
if not (l220.startswith("220 ") and "csclub.uwaterloo.ca" in l220):
print "FAIL: Unexpected mail server start", l220
sys.exit(1)
s.send("EHLO localhost\n")
caps = s.recv(1024).split('\n')
if len([x for x in caps if not (x.startswith('250') or len(x) == 0)]) != 0:
print "FAIL: Unexpected reply to EHLO"
sys.exit(2)
if not (l220.startswith("220 ") and "csclub.uwaterloo.ca" in l220):
print "FAIL: Unexpected mail server start", S, l220
sys.exit(1)
s.send("EHLO localhost\n")
caps = s.recv(1024).split('\n')
if len([x for x in caps if not (x.startswith('250') or len(x) == 0)]) != 0:
print "FAIL: Unexpected reply to EHLO", S
sys.exit(2)
sys.exit(0)