[Supervisor-checkins] r891 - in supervisor/trunk: . src/supervisor src/supervisor/tests
Mike Naberezny
mike at maintainable.com
Fri Sep 25 22:45:36 EDT 2009
Author: Mike Naberezny <mike at maintainable.com>
Date: Fri Sep 25 22:45:36 2009
New Revision: 891
Log:
Fixed a bug where the --serverurl option of supervisorctl would not
accept a URL with a "unix" scheme. (Jason Kirtland)
Modified:
supervisor/trunk/CHANGES.txt
supervisor/trunk/src/supervisor/datatypes.py
supervisor/trunk/src/supervisor/tests/test_datatypes.py
supervisor/trunk/src/supervisor/tests/test_options.py
Modified: supervisor/trunk/CHANGES.txt
==============================================================================
--- supervisor/trunk/CHANGES.txt (original)
+++ supervisor/trunk/CHANGES.txt Fri Sep 25 22:45:36 2009
@@ -20,6 +20,9 @@
- Made a more friendly exception message when a FCGI socket cannot be
created. (Roger Hoover)
+ - Fixed a bug where the --serverurl option of supervisorctl would not
+ accept a URL with a "unix" scheme. (Jason Kirtland)
+
3.0a7 (2009-05-24)
- We now bundle our own patched version of Medusa contributed by Jason
Modified: supervisor/trunk/src/supervisor/datatypes.py
==============================================================================
--- supervisor/trunk/src/supervisor/datatypes.py (original)
+++ supervisor/trunk/src/supervisor/datatypes.py Fri Sep 25 22:45:36 2009
@@ -371,6 +371,8 @@
import urlparse
scheme, netloc, path, params, query, fragment = urlparse.urlparse(value)
if scheme and netloc:
+ return value
+ if scheme == 'unix' and path.startswith('//') and len(path) > 2:
return value
raise ValueError("value %s is not a URL" % value)
Modified: supervisor/trunk/src/supervisor/tests/test_datatypes.py
==============================================================================
--- supervisor/trunk/src/supervisor/tests/test_datatypes.py (original)
+++ supervisor/trunk/src/supervisor/tests/test_datatypes.py Fri Sep 25 22:45:36 2009
@@ -152,6 +152,30 @@
self.assertRaises(ValueError, integer, 'abc')
self.assertEqual(integer('1'), 1)
self.assertEqual(integer(str(sys.maxint+1)), sys.maxint+1)
+
+ def test_url_accepts_urlparse_recognized_scheme_with_netloc(self):
+ good_url = 'http://localhost:9001'
+ self.assertEqual(datatypes.url(good_url), good_url)
+
+ def test_url_rejects_urlparse_recognized_scheme_but_no_netloc(self):
+ bad_url = 'http://'
+ self.assertRaises(ValueError, datatypes.url, bad_url)
+
+ def test_url_accepts_unix_scheme_with_path(self):
+ good_url = "unix://somepath"
+ self.assertEqual(good_url, datatypes.url(good_url))
+
+ def test_url_rejects_unix_scheme_with_no_slashes_or_path(self):
+ bad_url = "unix:"
+ self.assertRaises(ValueError, datatypes.url, bad_url)
+
+ def test_url_rejects_unix_scheme_with_slashes_but_no_path(self):
+ bad_url = "unix://"
+ self.assertRaises(ValueError, datatypes.url, bad_url)
+
+ def test_url_rejects_urlparse_unrecognized_scheme_with_path(self):
+ bad_url = "bad://path"
+ self.assertRaises(ValueError, datatypes.url, bad_url)
class InetStreamSocketConfigTests(unittest.TestCase):
def _getTargetClass(self):
Modified: supervisor/trunk/src/supervisor/tests/test_options.py
==============================================================================
--- supervisor/trunk/src/supervisor/tests/test_options.py (original)
+++ supervisor/trunk/src/supervisor/tests/test_options.py Fri Sep 25 22:45:36 2009
@@ -141,7 +141,14 @@
self.assertEqual(options.username, 'chris')
self.assertEqual(options.password, '123')
self.assertEqual(options.history_file, history_file)
-
+
+ def test_options_unixsocket_cli(self):
+ from StringIO import StringIO
+ fp = StringIO('[supervisorctl]')
+ instance = self._makeOne()
+ instance.configfile = fp
+ instance.realize(args=['--serverurl', 'unix:///dev/null'])
+ self.assertEqual(instance.serverurl, 'unix:///dev/null')
class ServerOptionsTests(unittest.TestCase):
def _getTargetClass(self):
More information about the Supervisor-checkins
mailing list