Skip to content
Snippets Groups Projects
Commit 4ee8dc47 authored by Jorrit Schaap's avatar Jorrit Schaap
Browse files

SW-516: fixed t_tbbserver for python3/qpid. Left the test in its original...

SW-516: fixed t_tbbserver for python3/qpid. Left the test in its original state of incompleteness. At least it passes now (nothing is really tested).
parent 9af94a74
No related branches found
No related tags found
No related merge requests found
...@@ -2,56 +2,21 @@ ...@@ -2,56 +2,21 @@
import unittest import unittest
import uuid import uuid
from qpid.messaging.exceptions import * from lofar.messaging.messagebus import TemporaryQueue
from lofar.messaging.messagebus import FromBus, ToBus
from lofar.messaging.messages import CommandMessage, EventMessage
import logging import logging
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
try:
from qpid.messaging import Connection
from qpidtoollibs import BrokerAgent
except ImportError:
print('Cannot run test without qpid tools')
print('Please source qpid profile')
exit(3)
#TODO: add tests for tbbservice #TODO: add tests for tbbservice
if __name__ == '__main__': if __name__ == '__main__':
logging.basicConfig(format='%(asctime)s %(levelname)s %(message)s', level=logging.INFO) logging.basicConfig(format='%(asctime)s %(levelname)s %(message)s', level=logging.INFO)
exit_code = 0 with TemporaryQueue(__name__) as tmp_queue:
test_exchange_name = 't_tbbserver_test_exchange_%s' % uuid.uuid1()
connection = None
broker = None
try: logger.warning("TODO: add tests for tbbservice!")
# setup broker connection exit(3)
connection = Connection.establish('127.0.0.1')
broker = BrokerAgent(connection)
# add test service exchanges/queues
logger.info('adding test exchange to broker: %s', test_exchange_name)
broker.addExchange('topic', test_exchange_name)
# and run all tests # and run all tests
unittest.main() unittest.main()
except ConnectError as ce:
logger.error(ce)
exit_code = 3
except Exception as e:
logger.error(e)
exit_code = 1
finally:
# cleanup test exchanges/queues and exit
if broker:
logger.info('removing test exchange from broker: %s', test_exchange_name)
broker.delExchange(test_exchange_name)
if connection:
connection.close()
exit(exit_code)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment