Two unit tests fail when rrun on single-CPU VM

Bug #1660393 reported by Javier Peña
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
oslo.messaging
Fix Released
High
Thomas Bechtold

Bug Description

To reproduce the bug, do:

$ tox -epy27 -- --parallel --concurrency=1

or a quicker reproducer:

$ tox -epy27 -- --parallel --concurrency=1 oslo_messaging.tests.notify.test_notifier

When running the unit tests on a single-CPU VM, two of them fail consistently:

======================================================================
FAIL: oslo_messaging.tests.notify.test_notifier.TestRoutingNotifier.test_load_notifiers_config
tags: worker-0
----------------------------------------------------------------------
Empty attachments:
  stderr
  stdout
Traceback (most recent call last):
  File "/builddir/build/BUILD/oslo.messaging-5.17.0/oslo_messaging/tests/notify/test_notifier.py", line 441, in test_load_notifiers_config
    self.router._load_notifiers()
  File "/builddir/build/BUILD/oslo.messaging-5.17.0/oslo_messaging/notify/_impl_routing.py", line 74, in _load_notifiers
    LOG.debug('loading notifiers from %s', self.NOTIFIER_PLUGIN_NAMESPACE)
  File "/usr/lib/python2.7/site-packages/mock/mock.py", line 698, in __getattr__
    raise AttributeError("Mock object has no attribute %r" % name)
AttributeError: Mock object has no attribute 'debug'
======================================================================
FAIL: oslo_messaging.tests.notify.test_notifier.TestRoutingNotifier.test_notify_filtered
tags: worker-0
----------------------------------------------------------------------
Empty attachments:
  stderr
  stdout
Traceback (most recent call last):
  File "/builddir/build/BUILD/oslo.messaging-5.17.0/oslo_messaging/tests/notify/test_notifier.py", line 596, in test_notify_filtered
    {}, mock.ANY, 'INFO', None)
  File "/usr/lib/python2.7/site-packages/mock/mock.py", line 947, in assert_called_once_with
    raise AssertionError(msg)
AssertionError: Expected 'notify' to be called once. Called 0 times.
Ran 1971 tests in 149.314s
FAILED (id=0, failures=2, skips=53)

Just adding a CPU to the VM makes unit tests pass. Also, fiddling with .testr.conf to increase test concurrency (to e.g. 4) fixes the issue.

Changed in oslo.messaging:
status: New → Confirmed
description: updated
description: updated
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/453037

Changed in oslo.messaging:
assignee: nobody → Thomas Bechtold (toabctl)
status: Confirmed → In Progress
Changed in oslo.messaging:
importance: Undecided → High
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to oslo.messaging (master)

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

commit f0b4baa70708fee45a0b11012d872c12a1c6a381
Author: Thomas Bechtold <email address hidden>
Date: Tue Apr 4 09:09:20 2017 +0200

    Mock 'oslo_messaging.notify._impl_routing.LOG' in notifier tests

    When running the tests with concurrency=1, 2 tests fail with:

      AttributeError: Mock object has no attribute 'debug'

    and

      AssertionError: Expected 'notify' to be called once. Called 0 times

    Mocking the LOG object solves the problem.

    Change-Id: Ie7f4448a103fae448123a05bc92e961aac00d6ec
    Closes-Bug: #1660393

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.21.0

This issue was fixed in the openstack/oslo.messaging 5.21.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.