New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Neutron gateway actions #611
Neutron gateway actions #611
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- I'd recommend removing the backslashes due to col length.
- Could some comments be added, specially for the
run_action
calls? - The 3 tests have a repeating pattern to check if
result.status
iscompleted
and compare data from the client and the one returned from the action. Maybe this code could be wrapped into a helper function?
Other than the above, tests lgtm.
The last mitaka test bundle (xenial-mitaka) does not have loadbalancer services enabled.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the refactor. LGTM, although it needs to be approved by an OpenStack team member :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the patch; please take a look at my comments; they may not be accurate as I'm just thinking through the consequences of skip vs failure and I'm not sure of the context. Thanks.
def tearDown(self): | ||
"""Cleanup loadbalancers if there are any left over.""" | ||
super(NeutronGatewayStatusActionsTest, self).tearDown() | ||
if not self.SKIP_LBAAS_TESTS: | ||
load_balancers = self.neutron_client.list_loadbalancers().get( | ||
'loadbalancers', []) | ||
for lbaas in load_balancers: | ||
self.neutron_client.delete_loadbalancer(lbaas['id']) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This gets run after each test in the class? Is this what you want? I only see one test that uses load balancers and it might be more "obvious" and less resource hungry to just wrap the majority of a test in a try: except: and put this code in a finally: to ensure it gets run?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a good point. Indeed the original purpose of this tearDown
was to ensure that the loadbalancers are removed even if the test that created them failed. I'll fix it.
if not routers_from_client: | ||
self.fail('At least one router must be configured for this test ' | ||
'to pass.') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you want the test to fail, or just to be skipped?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Intention was for tests to fail because the model is not properly configured. Unless there's a reason for some test models to not have routers. But none of the func test models had problem with this so far.
Edit: My reasoning was that without the proper resources present on the neutron agents (routers, networks, loadbalancers), we can not verify that these actions return correct data. If we skip these tests, errors may silently creep in, in the future.
if not networks_from_client: | ||
self.fail('At least one network must be configured for this test ' | ||
'to pass.') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As above; should this test be skipped if there is no resource to test against rather than failing?
if not subnet_list: | ||
raise RuntimeError('Expected subnet "private_subnet" is not ' | ||
'configured.') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As above, skip or fail? The reason for asking, is whether this can be a generic test or is very specific to this environment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good; just a couple of minor comments.
cls.SKIP_LBAAS_TESTS = (current_release <= xenial_mitaka or | ||
current_release >= bionic_train) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
An alternative option/syntax:
cls.SKIP_LBAAS_TESTS = not (xenial_mitaka > current_release < bionic_train)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks, that does look better.
except Exception as exc: | ||
raise exc |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This isn't needed; the exception with happen if no exceptions are caught which is essentially the same thing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks! Not giving +2 yet because when addressing comments in the Gerrit review, the actions will be renamed and thus this PR will need the same renamings. As far as I can tell all comments from other reviewers have been addressed.
New actions: * show-routers * show-dhcp-networks * show-loadbalancers Partial-Bug: #1916231 Closes-Bug: #1917401 Closes-Bug: #1917403 Closes-Bug: #1917405 Change-Id: Ie59c2a7d5c1ee9c51a0f7db4e8f38229812ac84a func-test-pr: openstack-charmers/zaza-openstack-tests#611
* Update charm-neutron-gateway from branch 'master' to c7566f4e47e9203e80a83c579af179e26324937d - Merge "Actions that expose various neutron resources" - Actions that expose various neutron resources New actions: * show-routers * show-dhcp-networks * show-loadbalancers Partial-Bug: #1916231 Closes-Bug: #1917401 Closes-Bug: #1917403 Closes-Bug: #1917405 Change-Id: Ie59c2a7d5c1ee9c51a0f7db4e8f38229812ac84a func-test-pr: openstack-charmers/zaza-openstack-tests#611
Functional tests for neutron-gateway actions needed by juju-verify.
Related LP issues (1 for each action):
Neutron gateway charm PR: https://review.opendev.org/c/openstack/charm-neutron-gateway/+/782896