Reviewed: https://review.opendev.org/c/openstack/nova/+/805657 Committed: https://opendev.org/openstack/nova/commit/930b7c992156733fbb4f598488605825d62ebc0c Submitter: "Zuul (22348)" Branch: master
commit 930b7c992156733fbb4f598488605825d62ebc0c Author: Balazs Gibizer <[email protected]> Date: Mon Aug 23 17:13:14 2021 +0200 Avoid modifying the Mock class in test The rdb unit test defines a shutdown field on the Mock class unintentionally. This causes that a later test in the same executor expecting that mock.Mock().shutdown is a newly auto generated mock.Mock() but it founds that is an already used (called) object. This causes that the later test fails when asserting the number of calls on that mock. The original intention of the rbd unit test was to catch the instantiation of the Rados object in test so it set Rados = mock.Mock() so when the code under test called Rados() it actually called Mock(). It worked but it has that huge side effect. Instead of this a proper mocking of the constructor can be done in two steps: rados_inst = mock.Mock() Rados = mock.Mock(return_value=rados_inst) This makes sure that every Rados() call will return rados_inst that is a mock without causing Mock class level side effect. Change-Id: If71620e808744736cb4fe3abda76d81a6335311b Closes-Bug: #1936849 ** Changed in: nova Status: In Progress => Fix Released -- You received this bug notification because you are a member of Yahoo! Engineering Team, which is subscribed to OpenStack Compute (nova). https://bugs.launchpad.net/bugs/1936849 Title: nova.tests.unit.virt.hyperv.test_serialproxy.SerialProxyTestCase.test_stop_serial_proxy failure Status in OpenStack Compute (nova): Fix Released Bug description: https://1e1442a936d81c7126bc- fc1e7af78d7504e20bbc3359634b65b5.ssl.cf1.rackcdn.com/800313/1/gate/openstack- tox-lower-constraints/6ee3d8d/testr_results.html 2021-07-13 16:22:36,703 WARNING [oslo_policy.policy] JSON formatted policy_file support is deprecated since Victoria release. You need to use YAML format which will be default in future. You can use ``oslopolicy-convert-json-to-yaml`` tool to convert existing JSON-formatted policy file to YAML-formatted in backward compatible way: https://docs.openstack.org/oslo.policy/latest/cli/oslopolicy-convert-json-to-yaml.html. 2021-07-13 16:22:36,704 WARNING [oslo_policy.policy] JSON formatted policy_file support is deprecated since Victoria release. You need to use YAML format which will be default in future. You can use ``oslopolicy-convert-json-to-yaml`` tool to convert existing JSON-formatted policy file to YAML-formatted in backward compatible way: https://docs.openstack.org/oslo.policy/latest/cli/oslopolicy-convert-json-to-yaml.html. 2021-07-13 16:22:36,708 WARNING [oslo_policy.policy] Policy Rules ['os_compute_api:extensions', 'os_compute_api:os-floating-ip-pools', 'os_compute_api:os-quota-sets:defaults', 'os_compute_api:os-availability-zone:list', 'os_compute_api:limits', 'system_admin_api', 'system_reader_api', 'project_admin_api', 'project_member_api', 'project_reader_api', 'system_admin_or_owner', 'system_or_project_reader', 'os_compute_api:limits:other_project', 'os_compute_api:os-lock-server:unlock:unlock_override', 'os_compute_api:servers:create:zero_disk_flavor', 'compute:servers:resize:cross_cell'] specified in policy files are the same as the defaults provided by the service. You can remove these rules from policy files which will make maintenance easier. You can detect these redundant rules by ``oslopolicy-list-redundant`` tool also. }}} Traceback (most recent call last): File "/home/zuul/src/opendev.org/openstack/nova/nova/tests/unit/virt/hyperv/test_serialproxy.py", line 70, in test_stop_serial_proxy self._proxy._conn.shutdown.assert_called_once_with(socket.SHUT_RDWR) File "/home/zuul/src/opendev.org/openstack/nova/.tox/lower-constraints/lib/python3.8/site-packages/mock/mock.py", line 955, in assert_called_once_with raise AssertionError(msg) AssertionError: Expected 'mock' to be called once. Called 2 times. Calls: [call(), call(2)]. To manage notifications about this bug go to: https://bugs.launchpad.net/nova/+bug/1936849/+subscriptions -- Mailing list: https://launchpad.net/~yahoo-eng-team Post to : [email protected] Unsubscribe : https://launchpad.net/~yahoo-eng-team More help : https://help.launchpad.net/ListHelp

