Basic functional test for Bionic Ussuri and Docs changes

This patch adds a bare minimum bundle.yaml for deploying
watcher-dashboard charm and running a noop basic test. In addition, it
changes the initial information to point to upstream after the official
release of charm-watcher-dashboard. It also adds the appropriate repo
configuration and conforms to the new removed packages mechanism.

Change-Id: I0a44436c4d292aaaa7ce37a3792c205056b37f17
Signed-off-by: Stamatis Katsaounis <skatsaounis@admin.grnet.gr>
This commit is contained in:
Stamatis Katsaounis 2020-02-10 11:37:46 +02:00
parent 0ebff29089
commit 328a9202cf
11 changed files with 101 additions and 32 deletions

4
.gitreview Normal file
View File

@ -0,0 +1,4 @@
[gerrit]
host=review.opendev.org
port=29418
project=openstack/charm-watcher-dashboard.git

5
.zuul.yaml Normal file
View File

@ -0,0 +1,5 @@
- project:
templates:
- python35-charm-jobs
- openstack-python3-ussuri-jobs
- openstack-cover-jobs

View File

@ -1,6 +1,7 @@
# Overview
This charm is developed by Stamatis Katsaounis <skatsaounis@admin.grnet.gr> and it is based on the official
OpenStack Charms project.
This charm is developed as part of the OpenStack Charms project, and as such you
should refer to the [OpenStack Charm Development Guide](https://github.com/openstack/charm-guide) for details on how
to contribute to this charm.
You can find its source code here: <https://github.com/grnet/charm-watcher-dashboard>.
You can find its source code here: <https://github.com/openstack/charm-watcher-dashboard>.

View File

@ -2,6 +2,8 @@
This subordinate charm provides the Watcher Dashboard plugin for use with the OpenStack Dashboard.
OpenStack Ussuri or later is required.
# Usage
Example minimal deploy:
@ -13,9 +15,9 @@ Example minimal deploy:
# Bugs
Please report bugs on [GitHub](https://github.com/grnet/charm-watcher-dashboard/issues).
Please report bugs on [Launchpad][lp-bugs-charm-watcher-dashboard].
For general questions please refer to the OpenStack [Charm Guide](https://docs.openstack.org/charm-guide/latest/).
For general questions please refer to the OpenStack [Charm Guide][cg].
# Contact Information
@ -24,6 +26,13 @@ know that, so include that information here:
## OpenStack Watcher
- [Watcher](https://wiki.openstack.org/wiki/Watcher)
- [Watcher Bugs](https://launchpad.net/watcher)
- [Watcher][wiki-watcher]
- [Watcher Bugs][lp-bugs-watcher]
- Watcher IRC on freenode at #openstack-watcher
<!-- LINKS -->
[cg]: https://docs.openstack.org/charm-guide
[lp-bugs-charm-watcher-dashboard]: https://bugs.launchpad.net/charm-watcher-dashboard/+filebug
[lp-bugs-watcher]: https://launchpad.net/watcher
[wiki-watcher]: https://wiki.openstack.org/wiki/Watcher

View File

@ -1,7 +1,7 @@
includes:
- layer:openstack
- interface:dashboard-plugin
repo: https://github.com/grnet/charm-watcher-dashboard
repo: https://github.com/openstack/charm-watcher-dashboard
options:
basic:
use_venv: True

View File

@ -1,7 +1,7 @@
name: watcher-dashboard
display-name: Watcher Dashboard
summary: OpenStack resource optimization Dashboard
maintainer: Stamatis Katsaounis <skatsaounis@admin.grnet.gr>
maintainer: OpenStack Charmers <openstack-charmers@lists.ubuntu.com>
description: |
This is the dashboard for the OpenStack resource optimization
service, Watcher.

View File

@ -31,6 +31,10 @@ charm.use_defaults(
def dashboard_available():
"""Relation to OpenStack Dashboard principal charm complete.
"""
# config and restart is handled by package install, just update our status
with charm.provide_charm_instance() as watcher_dashboard_charm:
dashboard_relation = reactive.endpoint_from_flag('dashboard.available')
dashboard_relation.publish_plugin_info(
"", None,
conflicting_packages=watcher_dashboard_charm.purge_packages,
install_packages=watcher_dashboard_charm.packages)
watcher_dashboard_charm.assess_status()

View File

@ -0,0 +1,51 @@
series: bionic
relations:
- - mysql:shared-db
- keystone:shared-db
- - mysql:shared-db
- openstack-dashboard:shared-db
- - mysql:shared-db
- watcher:shared-db
- - keystone:identity-service
- watcher:identity-service
- - keystone:identity-service
- openstack-dashboard:identity-service
- - openstack-dashboard:dashboard-plugin
- watcher-dashboard:dashboard
- - rabbitmq-server:amqp
- watcher:amqp
applications:
keystone:
charm: cs:~openstack-charmers-next/keystone
num_units: 1
options:
openstack-origin: cloud:bionic-ussuri/proposed
mysql:
constraints: mem=3072M
charm: cs:~openstack-charmers-next/percona-cluster
num_units: 1
openstack-dashboard:
series: bionic
charm: cs:~openstack-charmers-next/openstack-dashboard
num_units: 1
options:
openstack-origin: cloud:bionic-ussuri/proposed
rabbitmq-server:
charm: cs:~openstack-charmers-next/rabbitmq-server
num_units: 1
watcher:
series: bionic
charm: cs:~openstack-charmers-next/watcher
num_units: 1
options:
openstack-origin: cloud:bionic-ussuri/proposed
datasources: gnocchi
planner: weight
planner-config: >
{
"weights": "change_node_power_state:9,change_nova_service_state:50,migrate:30,nop:70,resize:20,sleep:40,turn_host_to_acpi_s3_state:10,volume_migrate:60",
"parallelization": "change_node_power_state:2,change_nova_service_state:1,migrate:2,nop:1,resize:2,sleep:1,turn_host_to_acpi_s3_state:2,volume_migrate:2"
}
watcher-dashboard:
series: bionic
charm: ../../../watcher-dashboard

9
src/tests/tests.yaml Normal file
View File

@ -0,0 +1,9 @@
charm_name: watcher-dashboard
gate_bundles:
- bionic-ussuri
smoke_bundles:
- bionic-ussuri
configure:
- zaza.charm_tests.noop.setup.basic_setup
tests:
- zaza.charm_tests.noop.tests.NoopTest

View File

@ -1,22 +0,0 @@
# Copyright 2020 GRNET SA
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from __future__ import absolute_import
from __future__ import print_function
import charms_openstack.test_utils as test_utils
class TestWatcherDashboardHandlers(test_utils.PatchHelper):
pass

View File

@ -51,7 +51,15 @@ class TestWatcherDashboardHandlers(test_utils.PatchHelper):
self.provide_charm_instance().__enter__.return_value = \
self.watcher_dashboard_charm
self.provide_charm_instance().__exit__.return_value = None
self.patch('charms.reactive.endpoint_from_flag')
def test_dashboard_available(self):
mock_flag = mock.Mock()
self.endpoint_from_flag.return_value = mock_flag
self.watcher_dashboard_charm.purge_packages = ['n1']
self.watcher_dashboard_charm.packages = ['p1', 'p2']
handlers.dashboard_available()
self.watcher_dashboard_charm.assess_status.assert_called_once_with()
mock_flag.publish_plugin_info.assert_called_once_with(
"", None, conflicting_packages=['n1'],
install_packages=['p1', 'p2'])