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

Add Watcher Test Case #1101

Merged
merged 9 commits into from
Sep 5, 2023
Merged

Add Watcher Test Case #1101

merged 9 commits into from
Sep 5, 2023

Conversation

freyes
Copy link
Member

@freyes freyes commented Aug 24, 2023

This PR introduces a new test case for OpenStack Watcher which uses the vm_workload_consolidation strategy[0]

Used/verified by this gerrit review:
https://review.opendev.org/c/openstack/charm-watcher/+/891195

[0] https://docs.openstack.org/watcher/latest/strategies/basic-server-consolidation.html

Add get_watcher_session_client() helper function to build a
watcherclient.v1.Client instance authenticated with a keystone session
that uses admin credentials by default.
This allows callers to pass None and let get_nova_session_client() to
use a sane default API, specifically this allows intermediate users
(e.g. launch_guest() ) to proxy values passed by the caller.
This change exposes two new parameters in the launch_instance()
function:

- nova_api_version: Set the microversion the novaclient should use.
- host: Request to launch the instance on a specific hypervisor host.
The stop_status parameter allows callers to ask stop retrying based on a
list of statuses that are known to be final (and error) states, this
saves time failing earlier.

Usage example for fail early when an instance reaches to ERROR status:

    openstack_utils.resource_reaches_status(self.nova_client.servers,
                                            instance_uuid,
                                            resource_attribute='state',
                                            expected_status='ACTIVE',
                                            stop_status='ERROR')
This simplifies when developing new tests and the programmer is not too
familiar with the different attributes an object has.
This test launches 1 instance per hypervisor, and then launches a new
audit to optimize the use of hypervisors and consolidate the instances
in a single hypervisor, but also disabling the nova-compute service to
avoid new instances get allocated.
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.

LGTM; one minor comment on a docstring.

:param host: Requested host to create servers
:type host: str
:param nova_api_version: Nova API version to use
:type nova_api_version: str
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should be:

:type nova_api_version: str | None

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

4491642 - this commit addresses this.

@ajkavanagh
Copy link
Contributor

@freyes just pending a gerrit review that exercises this; please could you link one into the description for posterity' sake?

@freyes
Copy link
Member Author

freyes commented Aug 25, 2023 via email

@ajkavanagh ajkavanagh merged commit 7925fd0 into openstack-charmers:master Sep 5, 2023
3 checks passed
openstack-mirroring pushed a commit to openstack/charm-watcher that referenced this pull request Sep 5, 2023
This change expands the testing bundles to deploy a fully functional
cloud and run the testing class WatcherTests which uses the
vm_workload_consolidation strategy[0].

[0] https://docs.openstack.org/watcher/latest/strategies/basic-server-consolidation.html

Func-Test-Pr: openstack-charmers/zaza-openstack-tests#1101
Change-Id: I5a1d9ef50ce16d553a06382e0825fcbb2d12e887
openstack-mirroring pushed a commit to openstack/openstack that referenced this pull request Sep 5, 2023
* Update charm-watcher from branch 'master'
  to 27c563dd5e90af4371a5124f7358b186a8a45d02
  - Add zaza-openstack-tests testing.
    
    This change expands the testing bundles to deploy a fully functional
    cloud and run the testing class WatcherTests which uses the
    vm_workload_consolidation strategy[0].
    
    [0] https://docs.openstack.org/watcher/latest/strategies/basic-server-consolidation.html
    
    Func-Test-Pr: openstack-charmers/zaza-openstack-tests#1101
    Change-Id: I5a1d9ef50ce16d553a06382e0825fcbb2d12e887
@freyes freyes deleted the watcher branch September 5, 2023 12:40
@wolsen wolsen mentioned this pull request Dec 13, 2023
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

2 participants