Fix neutron-status upgrade check CLI tool

Some time ago commit [1] add registering of service config
options in neutron-status CLI tool.
Some time later, commit [2] changed name of list with
service options to be in uppercase and it wasn't changed
in neutron.cmd.status module.
Because of that neutron-status CLI command was broken and
this patch fixes it by changing config options list to be
proper.

[1] https://review.openstack.org/#/c/636363/
[2] https://review.openstack.org/#/c/636719/

Change-Id: Iba891f72dfaba6f09e1fc99b0e86f308db02df06
This commit is contained in:
Slawek Kaplonski 2019-03-15 00:16:24 +01:00
parent b6550e568d
commit 4777633e8b
2 changed files with 64 additions and 1 deletions

View File

@ -52,7 +52,7 @@ def setup_conf(conf=cfg.CONF):
neutron_conf_base.register_core_common_config_opts(conf)
neutron_conf_service.register_service_opts(
neutron_conf_service.service_opts, cfg.CONF)
neutron_conf_service.SERVICE_OPTS, cfg.CONF)
return conf

View File

@ -0,0 +1,63 @@
# Copyright (c) 2019 Red Hat, Inc.
# All Rights Reserved.
#
# 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 neutron_lib import exceptions
from oslo_upgradecheck import upgradecheck
from neutron.agent.linux import utils
from neutron.tests.functional import base
class StatusTest(base.BaseLoggingTestCase):
def test_neutron_status_cli(self):
"""This test runs "neutron-status upgrade check" command and check if
stdout contains header "Upgrade Check Results". It also checks if
stderr is empty.
Example output from this CLI tool looks like:
+----------------------------------------------------------------+
| Upgrade Check Results |
+----------------------------------------------------------------+
| Check: Worker counts configured |
| Result: Warning |
| Details: The default number of workers has changed. Please see |
| release notes for the new values, but it is strongly |
| encouraged for deployers to manually set the values for |
| api_workers and rpc_workers. |
+----------------------------------------------------------------+
Error codes which migh be returned by this command:
- Code.SUCCESS,
- Code.WARNING,
- Code.FAILURE
are all accepted as we don't want to test here if there are any
potential problems with upgrade or all is fine. This depends on
deployment's configuration.
"""
expected_result_title = "Upgrade Check Results"
try:
stdout, stderr = utils.execute(
cmd=["neutron-status", "upgrade", "check"],
extra_ok_codes=[upgradecheck.Code.SUCCESS,
upgradecheck.Code.WARNING,
upgradecheck.Code.FAILURE],
return_stderr=True)
self.assertEqual('', stderr)
self.assertTrue(expected_result_title in stdout)
except exceptions.ProcessExecutionError as error:
self.fail("neutron-status upgrade check command failed to run. "
"Error: %s" % error)