[zmq] Don't create real matchmaker in unit tests

Bug #1640209 reported by Oleksii Zamiatin
16
This bug affects 3 people
Affects Status Importance Assigned to Milestone
oslo.messaging
Fix Released
Undecided
Gevorg Davoian

Bug Description

As it comes from the stack trace

Traceback (most recent call last):
  File "oslo_messaging/tests/drivers/zmq/test_zmq_transport_url.py", line 79, in test_redis_multiple_hosts_url
    "zmq+redis://host1:60001,host2:60002,host3:60003/"
  File "oslo_messaging/tests/drivers/zmq/test_zmq_transport_url.py", line 35, in setup_url
    transport = oslo_messaging.get_transport(self.conf, url)
  File "oslo_messaging/transport.py", line 192, in get_transport
    invoke_kwds=kwargs)
  File "/home/jenkins/workspace/gate-oslo.messaging-python27/.tox/py27/local/lib/python2.7/site-packages/stevedore/driver.py", line 46, in __init__
    verify_requirements=verify_requirements,
  File "/home/jenkins/workspace/gate-oslo.messaging-python27/.tox/py27/local/lib/python2.7/site-packages/stevedore/named.py", line 69, in __init__
    verify_requirements)
  File "/home/jenkins/workspace/gate-oslo.messaging-python27/.tox/py27/local/lib/python2.7/site-packages/stevedore/extension.py", line 171, in _load_plugins
    self._on_load_failure_callback(self, ep, err)
  File "/home/jenkins/workspace/gate-oslo.messaging-python27/.tox/py27/local/lib/python2.7/site-packages/stevedore/extension.py", line 163, in _load_plugins
    verify_requirements,
  File "/home/jenkins/workspace/gate-oslo.messaging-python27/.tox/py27/local/lib/python2.7/site-packages/stevedore/named.py", line 146, in _load_one_plugin
    verify_requirements,
  File "/home/jenkins/workspace/gate-oslo.messaging-python27/.tox/py27/local/lib/python2.7/site-packages/stevedore/extension.py", line 195, in _load_one_plugin
    obj = plugin(*invoke_args, **invoke_kwds)
  File "oslo_messaging/_drivers/impl_zmq.py", line 106, in __init__
    ).driver(self.conf, url=url)
  File "oslo_messaging/_drivers/zmq_driver/matchmaker/zmq_matchmaker_redis.py", line 270, in __init__
    is_available = self._check_availability(redis_instance)
  File "oslo_messaging/_drivers/zmq_driver/matchmaker/zmq_matchmaker_redis.py", line 303, in _check_availability
    redis_instance.ping()
  File "/home/jenkins/workspace/gate-oslo.messaging-python27/.tox/py27/local/lib/python2.7/site-packages/redis/client.py", line 682, in ping
    return self.execute_command('PING')
  File "/home/jenkins/workspace/gate-oslo.messaging-python27/.tox/py27/local/lib/python2.7/site-packages/redis/client.py", line 572, in execute_command
    connection.send_command(*args)
  File "/home/jenkins/workspace/gate-oslo.messaging-python27/.tox/py27/local/lib/python2.7/site-packages/redis/connection.py", line 563, in send_command
    self.send_packed_command(self.pack_command(*args))
  File "/home/jenkins/workspace/gate-oslo.messaging-python27/.tox/py27/local/lib/python2.7/site-packages/redis/connection.py", line 538, in send_packed_command
    self.connect()
  File "/home/jenkins/workspace/gate-oslo.messaging-python27/.tox/py27/local/lib/python2.7/site-packages/redis/connection.py", line 439, in connect
    sock = self._connect()
  File "/home/jenkins/workspace/gate-oslo.messaging-python27/.tox/py27/local/lib/python2.7/site-packages/fixtures/_fixtures/timeout.py", line 52, in signal_handler
    raise TimeoutException()
fixtures._fixtures.timeout.TimeoutException
Ran 1981 tests in 81.675s (+11.169s)
FAILED (id=6, failures=1, skips=35)
error: testr failed (1)

Real matchmaker redis is being created and trying to connect the real redis-server.

redis/connection.py", line 439, in connect
    sock = self._connect()

In order to avoid the undefined behavior in environments where redis may not be present for unit tests we have to mock things like that and do not perform the real connection especially in test where url parsing is tested.

Tags: zmq
Changed in oslo.messaging:
assignee: nobody → Gevorg Davoian (gdavoian)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to oslo.messaging (master)

Fix proposed to branch: master
Review: https://review.openstack.org/395091

Changed in oslo.messaging:
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to oslo.messaging (master)

Reviewed: https://review.openstack.org/395091
Committed: https://git.openstack.org/cgit/openstack/oslo.messaging/commit/?id=c9b5e474b56aa79ec19c2b27c61d2de77823bef2
Submitter: Jenkins
Branch: master

commit c9b5e474b56aa79ec19c2b27c61d2de77823bef2
Author: Gevorg Davoian <email address hidden>
Date: Tue Nov 8 19:22:29 2016 +0200

    [zmq] Don't create real matchmaker in unit tests

    Change-Id: I72c83959eef92aa26b1ff362dcea115bb8d006f8
    Closes-Bug: #1640209

Changed in oslo.messaging:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/oslo.messaging 5.13.0

This issue was fixed in the openstack/oslo.messaging 5.13.0 release.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.