Skip to content
Snippets Groups Projects
Commit cf473286 authored by Piotr Maślanka's avatar Piotr Maślanka
Browse files

tests

parent 4de95c6d
No related branches found
No related tags found
No related merge requests found
......@@ -19,6 +19,8 @@ class SingleNodeReconnector(object):
self.attache_group = attache_group
self.connection = None
self.terminating = False
def is_connected(self):
return self.connection is not None
......@@ -32,11 +34,15 @@ class SingleNodeReconnector(object):
self.connection.add_finalizer(self.on_fail)
def on_fail(self):
if self.terminating:
return
self.connection = None
self.connect()
def shutdown(self):
"""Close this connection"""
self.terminating = True
if self.connection is not None:
self.connection.send(None)
self.connection = None
# coding=UTF-8
from __future__ import print_function, absolute_import, division
import six
import logging
logger = logging.getLogger(__name__)
# coding=UTF-8
"""
Test things
"""
from __future__ import print_function, absolute_import, division
import six
import unittest
import time, logging, threading
from coolamqp.objects import Message, MessageProperties, NodeDefinition, Queue
from coolamqp.clustering import Cluster
import time
NODE = NodeDefinition('127.0.0.1', 'user', 'user', heartbeat=20)
logging.basicConfig(level=logging.DEBUG)
class TestA(unittest.TestCase):
def test_link(self):
"""Connect and disconnect"""
c = Cluster([NODE])
c.start()
c.shutdown()
def test_consume(self):
c = Cluster([NODE])
c.start()
con, fut = c.consume(Queue(u'hello', exclusive=True))
# fut.result()
con.cancel()
c.shutdown()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment