From 2e14051cb604143f36e881fac04051caee583375 Mon Sep 17 00:00:00 2001 From: Tim Burke Date: Thu, 5 Jun 2025 15:23:26 -0700 Subject: [PATCH] tests: Fix some connection-closed testing on OS X Change-Id: I32fec7540bee70e77140964c5983d133a572fa7b --- test/unit/proxy/test_server.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/test/unit/proxy/test_server.py b/test/unit/proxy/test_server.py index 0579a264f4..307807f1b1 100644 --- a/test/unit/proxy/test_server.py +++ b/test/unit/proxy/test_server.py @@ -2545,10 +2545,12 @@ class BaseTestObjectController(object): self.assertEqual(b'', fd.read()) # I expected this to raise a socket error self.assertEqual(b'', sock.recv(1024)) + time.sleep(0.01) # ... but we ARE disconnected with self.assertRaises(socket.error) as caught: sock.send(b'test') - self.assertEqual(caught.exception.errno, errno.EPIPE) + self.assertIn(caught.exception.errno, + (errno.EPIPE, errno.ECONNRESET)) # and logging confirms we've timed out last_debug_msg = prosrv.logger.get_lines_for_level('debug')[-1] self.assertIn('timed out', last_debug_msg) @@ -3052,6 +3054,8 @@ class TestReplicatedObjectController( # kernel discovers that the connection is not open and # subsequent send attempts fail. sock.sendall(b'GET /info HTTP/1.1\r\n') + # OS X especially seems to want this to detect the close + time.sleep(0.001) sock.sendall(b'Host: localhost\r\n' b'X-Storage-Token: t\r\n' b'\r\n')