You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by ac...@apache.org on 2017/10/17 11:26:05 UTC
[3/3] qpid-proton git commit: NO-JIRA: Fix fdlimit.py test,
incorrectly reporting skipped
NO-JIRA: Fix fdlimit.py test, incorrectly reporting skipped
Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/e0feb3f2
Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/e0feb3f2
Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/e0feb3f2
Branch: refs/heads/master
Commit: e0feb3f2fcc1c675186ca111937a2f34f7a0f705
Parents: 85d7fb4
Author: Alan Conway <ac...@redhat.com>
Authored: Tue Oct 17 12:08:55 2017 +0100
Committer: Alan Conway <ac...@redhat.com>
Committed: Tue Oct 17 12:08:55 2017 +0100
----------------------------------------------------------------------
proton-c/src/tests/fdlimit.py | 63 +++++++++++++++++++-------------------
1 file changed, 32 insertions(+), 31 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/e0feb3f2/proton-c/src/tests/fdlimit.py
----------------------------------------------------------------------
diff --git a/proton-c/src/tests/fdlimit.py b/proton-c/src/tests/fdlimit.py
index beb00a8..c41d14a 100644
--- a/proton-c/src/tests/fdlimit.py
+++ b/proton-c/src/tests/fdlimit.py
@@ -41,43 +41,44 @@ class LimitedBroker(object):
# Check if we can run prlimit to control resources
try:
Proc(["prlimit"]).wait_exit()
+except:
+ print "Skipping test: prlimit not available"
+ sys.exit(0)
- class FdLimitTest(ProcTestCase):
+class FdLimitTest(ProcTestCase):
- def proc(self, *args, **kwargs):
- """Skip valgrind for all processes started by this test"""
- return super(FdLimitTest, self).proc(*args, valgrind=False, **kwargs)
+ def proc(self, *args, **kwargs):
+ """Skip valgrind for all processes started by this test"""
+ return super(FdLimitTest, self).proc(*args, valgrind=False, **kwargs)
- def test_fd_limit_broker(self):
- """Check behaviour when running out of file descriptors on accept"""
- # Not too many FDs but not too few either, some are used for system purposes.
- fdlimit = 256
- with LimitedBroker(self, fdlimit) as b:
- receivers = []
- # Start enough receivers to use all FDs, make sure the broker logs an error
- for i in xrange(fdlimit+1):
- receivers.append(self.proc(["receive", "", b.port, str(i)]))
+ def test_fd_limit_broker(self):
+ """Check behaviour when running out of file descriptors on accept"""
+ # Not too many FDs but not too few either, some are used for system purposes.
+ fdlimit = 256
+ with LimitedBroker(self, fdlimit) as b:
+ receivers = []
+ # Start enough receivers to use all FDs, make sure the broker logs an error
+ for i in xrange(fdlimit+1):
+ receivers.append(self.proc(["receive", "", b.port, str(i)]))
- # Note: libuv silently swallows EMFILE/ENFILE errors so there is no error reporting.
- # The epoll proactor will close the users connection with the EMFILE/ENFILE error
- if "TRANSPORT_CLOSED" in b.proc.out:
- self.assertIn("open files", b.proc.out)
+ # Note: libuv silently swallows EMFILE/ENFILE errors so there is no error reporting.
+ # The epoll proactor will close the users connection with the EMFILE/ENFILE error
+ if "TRANSPORT_CLOSED" in b.proc.out:
+ self.assertIn("open files", b.proc.out)
- # All FDs are now in use, send attempt should fail or hang
- self.assertIn(self.proc(["send", "", b.port, "x"]).poll(), [1, None])
+ # All FDs are now in use, send attempt should fail or hang
+ self.assertIn(self.proc(["send", "", b.port, "x"]).poll(), [1, None])
- # Kill receivers to free up FDs
- for r in receivers:
- r.kill()
- for r in receivers:
- r.wait_exit(expect=None)
- # send/receive should succeed now
- self.assertIn("10 messages sent", self.proc(["send", "", b.port]).wait_exit())
- self.assertIn("10 messages received", self.proc(["receive", "", b.port]).wait_exit())
+ # Kill receivers to free up FDs
+ for r in receivers:
+ r.kill()
+ for r in receivers:
+ r.wait_exit(expect=None)
+ # send/receive should succeed now
+ self.assertIn("10 messages sent", self.proc(["send", "", b.port]).wait_exit())
+ self.assertIn("10 messages received", self.proc(["receive", "", b.port]).wait_exit())
- if __name__ == "__main__":
- main()
+if __name__ == "__main__":
+ main()
-except:
- print "Skipping test: prlimit not available"
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org