Log message for revision 104808:
  Changed startup server tests in Zope2 to use a randomized port number, to 
allow the nightly buildbot to run the tests at the same time for multiple 
configurations without the port being already in use.
  

Changed:
  U   Zope/trunk/doc/CHANGES.rst
  U   Zope/trunk/src/Zope2/Startup/tests/testStarter.py

-=-
Modified: Zope/trunk/doc/CHANGES.rst
===================================================================
--- Zope/trunk/doc/CHANGES.rst  2009-10-05 19:26:46 UTC (rev 104807)
+++ Zope/trunk/doc/CHANGES.rst  2009-10-05 19:39:12 UTC (rev 104808)
@@ -11,6 +11,10 @@
 Restructuring
 +++++++++++++
 
+- Changed startup server tests in Zope2 to use a randomized port number, to
+  allow the nightly buildbot to run the tests at the same time for multiple
+  configurations without the port being already in use.
+
 - Cloned ``ZopeVocabularyRegistry`` from ``zope.app.schema``, and added
   sane registration of it during initialization of Five.
 

Modified: Zope/trunk/src/Zope2/Startup/tests/testStarter.py
===================================================================
--- Zope/trunk/src/Zope2/Startup/tests/testStarter.py   2009-10-05 19:26:46 UTC 
(rev 104807)
+++ Zope/trunk/src/Zope2/Startup/tests/testStarter.py   2009-10-05 19:39:12 UTC 
(rev 104808)
@@ -17,6 +17,7 @@
 import errno
 import logging
 import os
+import random
 import sys
 import tempfile
 import unittest
@@ -183,14 +184,18 @@
         self.assertEqual(_n, 10)
 
     def testSetupServers(self):
+        # We generate a random port number to test against, so that multiple
+        # test runs of this at the same time can succeed
+        port = random.randint(10000, 50000)
         conf = self.load_config_text("""
             instancehome <<INSTANCE_HOME>>
             <http-server>
-                address 18092
+                address %(http)s
             </http-server>
             <ftp-server>
-               address 18093
-            </ftp-server>""")
+               address %(ftp)s
+            </ftp-server>""" % dict(http=port, ftp=port+1)
+        )
         starter = self.get_starter(conf)
         # do the job the 'handler' would have done (call prepare)
         for server in conf.servers:
@@ -206,30 +211,6 @@
             del conf.servers # should release servers
             pass
 
-        # The rest sets up a conflict by using the same port for the HTTP
-        # and FTP servers, relying on socket.bind() to raise an "address
-        # already in use" exception.  However, because the sockets specify
-        # SO_REUSEADDR, socket.bind() may not raise that exception.
-        # See <http://zope.org/Collectors/Zope/1104> for gory details.
-
-        ## conf = self.load_config_text("""
-        ##     instancehome <<INSTANCE_HOME>>
-        ##     <http-server>
-        ##         address 18092
-        ##     </http-server>
-        ##     <ftp-server>
-        ##        # conflict
-        ##        address 18092
-        ##     </ftp-server>""")
-        ## starter = self.get_starter(conf)
-        ## # do the job the 'handler' would have done (call prepare)
-        ## for server in conf.servers:
-        ##     server.prepare('', None, 'Zope2', {}, None)
-        ## try:
-        ##     self.assertRaises(ZConfig.ConfigurationError, 
starter.setupServers)
-        ## finally:
-        ##     del conf.servers
-
     def testDropPrivileges(self):
         # somewhat incomplete because we we're never running as root
         # when we test, but we test as much as we can

_______________________________________________
Zope-Checkins maillist  -  Zope-Checkins@zope.org
https://mail.zope.org/mailman/listinfo/zope-checkins

Reply via email to