Skip to content
Browse files

Update tests to allow using a remote RabbitMQ broker, also updated

README file to describe testing process, for both local and remote tests.
Fixed the list_queues example to allow for using a remote RabbitMQ broker.
  • Loading branch information...
1 parent afcd2f3 commit dd1ce3279fc4335c80696dfd46e18d050e4cea60 @clemesha-ooi clemesha-ooi committed Jul 22, 2010
Showing with 27 additions and 6 deletions.
  1. +21 −1 README.rst
  2. +3 −3 examples/list_queues.py
  3. +3 −2 tests/test_service.py
View
22 README.rst
@@ -36,7 +36,7 @@ From top-level package directory run::
Get realtime data from RabbitMQ:
-From top-level package directory run::
+From the top-level package directory run::
$ twistd -n txrabbitmq
@@ -48,6 +48,26 @@ Open 2nd shell, navigate to the directory `webui/push` and run::
Open ports 8000 and 9000, to see commands data and push, respectively
+
+Testing
+-------
+
+From the top-level package directory run::
+
+ $ trial tests/test_service.py
+
+NOTES:
+
+The RabbitMQ cookie must exist in ~/.erlang.cookie
+
+For testing with a remote RabbitMQ broker, before using trial run::
+
+ $ export TXRABBITMQ_NODENAME=my_node@my_remote_host
+
+Also, when testing with a remote RabbitMQ broker, make sure firewall
+rules allow communication of the Erlang Port Mapper Daemon (epmd).
+
+
License
-------
Apache License:
View
6 examples/list_queues.py
@@ -5,11 +5,11 @@
from twotp.node import Process, readCookie, buildNodeName
-def rabbitmqctl_client(erlang_cookie=None, nodename="txrabbitmq"):
- cookie = readCookie() #TODO: allow passing 'erlang_cookie'
+def rabbitmqctl_client(nodename="rabbit@localhost"):
+ cookie = readCookie() #"~/.erlang.cookie" must exist
nodeName = buildNodeName(nodename)
process = Process(nodeName, cookie)
- return RabbitMQControlService(process)
+ return RabbitMQControlService(process, nodeName)
@inlineCallbacks
def list_queues():
View
5 tests/test_service.py
@@ -22,9 +22,10 @@ class TestRabbitMQControlService(unittest.TestCase):
def setUp(self):
cookie = readCookie()
- nodeName = buildNodeName("test-txrabbitmq")
+ node = os.environ.get("TXRABBITMQ_NODENAME") or "rabbit@localhost"
+ nodeName = buildNodeName(node)
self.process = Process(nodeName, cookie)
- self.service = RabbitMQControlService(self.process)
+ self.service = RabbitMQControlService(self.process, nodeName)
def tearDown(self):
for epmd in self.process.oneShotEpmds.values():

0 comments on commit dd1ce32

Please sign in to comment.
Something went wrong with that request. Please try again.