Fix tests where broker suddenly disconnects client
This seems to be required just on more modern Python versions.
This commit is contained in:
parent
aceabcdef2
commit
28c11f4cce
@ -22,8 +22,10 @@ try:
|
||||
sock.close()
|
||||
if len(data) == 0:
|
||||
rc = 0
|
||||
except socket.error:
|
||||
rc = 0
|
||||
except socket.error as e:
|
||||
if e.errno == errno.ECONNRESET:
|
||||
# Connection has been closed by peer, this is the expected behaviour
|
||||
rc = 0
|
||||
finally:
|
||||
broker.terminate()
|
||||
broker.wait()
|
||||
|
@ -3,8 +3,6 @@
|
||||
# Test whether a CONNECT with reserved set to 1 results in a disconnect. MQTT-3.1.2-3
|
||||
|
||||
from mosq_test_helper import *
|
||||
from socket import error as SocketError
|
||||
import errno
|
||||
|
||||
rc = 1
|
||||
keepalive = 10
|
||||
@ -17,10 +15,9 @@ try:
|
||||
sock = mosq_test.do_client_connect(connect_packet, b"", port=port)
|
||||
sock.close()
|
||||
rc = 0
|
||||
except SocketError as e:
|
||||
except socket.error as e:
|
||||
if e.errno == errno.ECONNRESET:
|
||||
# Connection has been closed by peer (very quickly).
|
||||
# Fine, this is the expected behavior.
|
||||
# Connection has been closed by peer, this is the expected behaviour
|
||||
rc = 0
|
||||
finally:
|
||||
broker.terminate()
|
||||
|
@ -51,6 +51,10 @@ try:
|
||||
rc = 0
|
||||
|
||||
sock.close()
|
||||
except socket.error as e:
|
||||
if e.errno == errno.ECONNRESET:
|
||||
# Connection has been closed by peer, this is the expected behaviour
|
||||
rc = 0
|
||||
finally:
|
||||
broker.terminate()
|
||||
broker.wait()
|
||||
|
@ -47,6 +47,10 @@ try:
|
||||
rc = 0
|
||||
|
||||
sock.close()
|
||||
except socket.error as e:
|
||||
if e.errno == errno.ECONNRESET:
|
||||
# Connection has been closed by peer, this is the expected behaviour
|
||||
rc = 0
|
||||
finally:
|
||||
broker.terminate()
|
||||
broker.wait()
|
||||
|
@ -50,6 +50,10 @@ try:
|
||||
rc = 0
|
||||
|
||||
sock.close()
|
||||
except socket.error as e:
|
||||
if e.errno == errno.ECONNRESET:
|
||||
# Connection has been closed by peer, this is the expected behaviour
|
||||
rc = 0
|
||||
finally:
|
||||
broker.terminate()
|
||||
broker.wait()
|
||||
|
@ -53,6 +53,10 @@ try:
|
||||
rc = 0
|
||||
|
||||
sock.close()
|
||||
except socket.error as e:
|
||||
if e.errno == errno.ECONNRESET:
|
||||
# Connection has been closed by peer, this is the expected behaviour
|
||||
rc = 0
|
||||
finally:
|
||||
broker.terminate()
|
||||
broker.wait()
|
||||
|
@ -50,6 +50,10 @@ try:
|
||||
rc = 0
|
||||
|
||||
sock.close()
|
||||
except socket.error as e:
|
||||
if e.errno == errno.ECONNRESET:
|
||||
# Connection has been closed by peer, this is the expected behaviour
|
||||
rc = 0
|
||||
finally:
|
||||
broker.terminate()
|
||||
broker.wait()
|
||||
|
@ -3,8 +3,6 @@
|
||||
import struct
|
||||
|
||||
from mosq_test_helper import *
|
||||
from socket import error as SocketError
|
||||
import errno
|
||||
|
||||
rc = 1
|
||||
keepalive = 60
|
||||
@ -18,10 +16,9 @@ try:
|
||||
sock = mosq_test.do_client_connect(connect_packet, b"", timeout=30, port=port)
|
||||
rc = 0
|
||||
sock.close()
|
||||
except SocketError as e:
|
||||
except socket.error as e:
|
||||
if e.errno == errno.ECONNRESET:
|
||||
# Connection has been closed by peer (very quickly).
|
||||
# Fine, this is the expected behavior.
|
||||
# Connection has been closed by peer, this is the expected behaviour
|
||||
rc = 0
|
||||
finally:
|
||||
broker.terminate()
|
||||
|
@ -3,7 +3,6 @@
|
||||
# Test whether a client can connect without an SSL certificate if one is required.
|
||||
|
||||
from mosq_test_helper import *
|
||||
import errno
|
||||
|
||||
if sys.version < '2.7':
|
||||
print("WARNING: SSL not supported on Python 2.6")
|
||||
|
@ -15,3 +15,4 @@ import ssl
|
||||
import struct
|
||||
import subprocess
|
||||
import time
|
||||
import errno
|
||||
|
Loading…
Reference in New Issue
Block a user