Commit 6d39db96 authored by Max Reitz's avatar Max Reitz Committed by Eduardo Habkost
Browse files

iotests: Make nbd-fault-injector flush



When closing a connection, make the nbd-fault-injector flush the socket.
Without this, the output is a bit unreliable with Python 3.

Signed-off-by: default avatarMax Reitz <mreitz@redhat.com>
Reviewed-by: default avatarEduardo Habkost <ehabkost@redhat.com>
Reviewed-by: default avatarCleber Rosa <crosa@redhat.com>
Reviewed-by: default avatarEric Blake <eblake@redhat.com>
Message-Id: <20181022135307.14398-2-mreitz@redhat.com>
Signed-off-by: default avatarEduardo Habkost <ehabkost@redhat.com>
parent bb2e16e9
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -41,6 +41,7 @@ can't open device nbd+tcp://127.0.0.1:PORT/foo

=== Check disconnect after neg2 ===

Unable to read from socket: Connection reset by peer
Connection closed
read failed: Input/output error

@@ -54,6 +55,7 @@ can't open device nbd+tcp://127.0.0.1:PORT/foo

=== Check disconnect before request ===

Unable to read from socket: Connection reset by peer
Connection closed
read failed: Input/output error

@@ -116,6 +118,7 @@ can't open device nbd+tcp://127.0.0.1:PORT/

=== Check disconnect after neg-classic ===

Unable to read from socket: Connection reset by peer
Connection closed
read failed: Input/output error

@@ -161,6 +164,8 @@ can't open device nbd+unix:///foo?socket=TEST_DIR/nbd.sock

=== Check disconnect after neg2 ===

Unable to read from socket: Connection reset by peer
Connection closed
read failed: Input/output error

=== Check disconnect 8 neg2 ===
@@ -173,6 +178,8 @@ can't open device nbd+unix:///foo?socket=TEST_DIR/nbd.sock

=== Check disconnect before request ===

Unable to read from socket: Connection reset by peer
Connection closed
read failed: Input/output error

=== Check disconnect after request ===
@@ -234,6 +241,8 @@ can't open device nbd+unix:///?socket=TEST_DIR/nbd.sock

=== Check disconnect after neg-classic ===

Unable to read from socket: Connection reset by peer
Connection closed
read failed: Input/output error

*** done
+1 −0
Original line number Diff line number Diff line
@@ -112,6 +112,7 @@ class FaultInjectionSocket(object):
            if rule.match(event, io):
                if rule.when == 0 or bufsize is None:
                    print('Closing connection on rule match %s' % rule.name)
                    self.sock.flush()
                    sys.exit(0)
                if rule.when != -1:
                    return rule.when