disable triggering version discovery in test_generator unit tests

Fixed unit.actions.openstack.test_generator.GeneratorTest.test_generator
failure by avoid triggering version discovery as it needs to talk to
Keystone server. Talking to a live Keystone server is not needed for
this particular unit test.

NOTE: this patch is only applicable to stable/rocky and with the latest
openstacksdk 0.17.3 release.

NOTE: this patch also includes change I9ab552dd4bf3826f358d73a4bddaf1885b1be130
from https://review.opendev.org/#/c/672543/ as both are needed in order
to pass Jenkins.

Change-Id: Ib2c72e89612c9b2b4bccd37cb797804ea40e0b1f
Closes-Bug: 1837468
This commit is contained in:
Guang Yee 2019-07-22 15:15:00 -07:00
parent c9e61b80ad
commit f2a0b569f7
3 changed files with 46 additions and 0 deletions

8
bindep.txt Normal file
View File

@ -0,0 +1,8 @@
# This is a cross-platform list tracking distribution packages needed by tests;
# see http://docs.openstack.org/infra/bindep/ for additional information.
mysql-client [platform:dpkg]
mysql-server [platform:dpkg]
postgresql
postgresql-client [platform:dpkg]
postgresql-server [platform:rpm]

View File

@ -85,6 +85,36 @@ class GeneratorTest(base.BaseTest):
self.baremetal_patch.start()
self.addCleanup(self.baremetal_patch.stop)
# When {{ service }}_default_microversion is set, keystoneauth1
# will attempt to do version discovery by looking up the services
# in the Keystone service catalog and making sure the desire version
# is available. Prior to this patch
# https://review.opendev.org/#/c/587437/, clustering service does
# not set the default microversion. Therefore, there was no
# version discovery attempted during these tests. Now that the patch
# is included in the latest openstacksdk release, we need to
# disable version discovery by nullifying the CURRENT_API_VERSION
# in senlinclient in order the tests to pass. These are unit tests
# and does not need to talk to a real Keystone server.
self._senlin_api_version = None
def _reset_senlin_api_version():
if (actions.senlinclient and
hasattr(actions.senlinclient, 'plugin') and
hasattr(actions.senlinclient.plugin,
'CURRENT_API_VERSION')):
actions.senlinclient.CURRENT_API_VERSION = (
self._senlin_api_version)
if (actions.senlinclient and
hasattr(actions.senlinclient, 'plugin') and
hasattr(actions.senlinclient.plugin,
'CURRENT_API_VERSION')):
self._senlin_api_version = (
actions.senlinclient.plugin.CURRENT_API_VERSION)
actions.senlinclient.plugin.CURRENT_API_VERSION = None
self.addCleanup(_reset_senlin_api_version)
def test_generator(self):
for generator_cls in generator_factory.all_generators():
action_classes = generator_cls.create_actions()

View File

@ -0,0 +1,8 @@
---
fixes:
- |
[`bug 1837468 <https://bugs.launchpad.net/keystone/+bug/1837468>`_]
Fixed unit.actions.openstack.test_generator.GeneratorTest.test_generator
failure by avoid triggering version discovery as it needs to talk to
Keystone server. Talking to a live Keystone server is not needed for
this particular unit test.