Skip to content
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

Merged
merged 12 commits into from Sep 13, 2021

Conversation

mkalcok
Copy link
Contributor

@mkalcok mkalcok commented Jul 29, 2021

Copy link
Contributor

@auria auria left a 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 is completed 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.
Copy link
Contributor

@auria auria left a 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 :)

Copy link
Contributor

@ajkavanagh ajkavanagh left a 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.

Comment on lines 280 to 287
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'])
Copy link
Contributor

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?

Copy link
Contributor Author

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.

Comment on lines +315 to +317
if not routers_from_client:
self.fail('At least one router must be configured for this test '
'to pass.')
Copy link
Contributor

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?

Copy link
Contributor Author

@mkalcok mkalcok Jul 30, 2021

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.

Comment on lines +336 to +338
if not networks_from_client:
self.fail('At least one network must be configured for this test '
'to pass.')
Copy link
Contributor

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?

Comment on lines 361 to 363
if not subnet_list:
raise RuntimeError('Expected subnet "private_subnet" is not '
'configured.')
Copy link
Contributor

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.

Copy link
Contributor

@ajkavanagh ajkavanagh left a 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.

Comment on lines 277 to 278
cls.SKIP_LBAAS_TESTS = (current_release <= xenial_mitaka or
current_release >= bionic_train)
Copy link
Contributor

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)

Copy link
Contributor Author

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.

Comment on lines 380 to 381
except Exception as exc:
raise exc
Copy link
Contributor

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.

Copy link
Contributor

@lourot lourot left a 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.

@lourot lourot merged commit 2fd494c into openstack-charmers:master Sep 13, 2021
openstack-mirroring pushed a commit to openstack/charm-neutron-gateway that referenced this pull request Sep 13, 2021
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
openstack-mirroring pushed a commit to openstack/openstack that referenced this pull request Sep 13, 2021
* 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants