Fix some trivial bugs

This commit is contained in:
tengqm 2017-09-07 01:59:51 -04:00
parent 9379725f08
commit 2ec21b7dc2
6 changed files with 14 additions and 44 deletions

4
.gitignore vendored Normal file
View File

@ -0,0 +1,4 @@
__pycache__
.testrepository
.tox
*.egg-info

View File

@ -9,3 +9,5 @@ oslo.config!=4.3.0,!=4.4.0,>=4.0.0 # Apache-2.0
oslo.serialization!=2.19.1,>=1.10.0 # Apache-2.0 oslo.serialization!=2.19.1,>=1.10.0 # Apache-2.0
oslo.utils>=3.20.0 # Apache-2.0 oslo.utils>=3.20.0 # Apache-2.0
six>=1.9.0 # MIT six>=1.9.0 # MIT
tempest>=16.1.0 # Apache-2.0
tempest-lib>=0.14.0 # Apache-2.0

View File

@ -1,32 +1 @@
# 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 senlin.drivers.openstack import ceilometer_v2
from senlin.drivers.openstack import cinder_v2
from senlin.drivers.openstack import keystone_v3
from senlin.drivers.openstack import zaqar_v2
from senlin.tests.drivers.openstack import heat_v1
from senlin.tests.drivers.openstack import lbaas
from senlin.tests.drivers.openstack import mistral_v2
from senlin.tests.drivers.openstack import neutron_v2
from senlin.tests.drivers.openstack import nova_v2
compute = nova_v2.NovaClient
identity = keystone_v3.KeystoneClient
loadbalancing = lbaas.LoadBalancerDriver
message = zaqar_v2.ZaqarClient
network = neutron_v2.NeutronClient
orchestration = heat_v1.HeatClient
telemetry = ceilometer_v2.CeilometerClient
workflow = mistral_v2.MistralClient
block_storage = cinder_v2.CinderClient

View File

@ -12,7 +12,6 @@
from tempest.lib import decorators from tempest.lib import decorators
from senlin.common.i18n import _
from senlin_tempest_plugin.common import utils from senlin_tempest_plugin.common import utils
from senlin_tempest_plugin.functional import base from senlin_tempest_plugin.functional import base
@ -58,8 +57,8 @@ class TestClusterScaleInOut(base.BaseSenlinFunctionalTest):
self.assertEqual('ACTIVE', cluster['status']) self.assertEqual('ACTIVE', cluster['status'])
self.assertEqual(4, cluster['desired_capacity']) self.assertEqual(4, cluster['desired_capacity'])
self.assertEqual(4, len(cluster['nodes'])) self.assertEqual(4, len(cluster['nodes']))
reason = _("The target capacity (6) is greater " reason = ("The target capacity (6) is greater "
"than the cluster's max_size (5).") "than the cluster's max_size (5).")
self.assertEqual(reason, res) self.assertEqual(reason, res)
# Scale in cluster with count set to 2 # Scale in cluster with count set to 2

View File

@ -123,7 +123,7 @@ class TestScalingPolicy(base.BaseSenlinFunctionalTest):
self.assertEqual('ACTIVE', cluster['status']) self.assertEqual('ACTIVE', cluster['status'])
self.assertEqual(1, cluster['desired_capacity']) self.assertEqual(1, cluster['desired_capacity'])
self.assertEqual(1, len(cluster['nodes'])) self.assertEqual(1, len(cluster['nodes']))
reason = "Policy check failure: Failed policy '%s': The target " reason = ("Policy check failure: Failed policy '%s': The target "
"capacity (-1) is less than the cluster's " "capacity (-1) is less than the cluster's "
"min_size (0)." % scalein_policy['name'] "min_size (0).") % scalein_policy['name']
self.assertEqual(reason, res) self.assertEqual(reason, res)

10
tox.ini
View File

@ -1,6 +1,6 @@
[tox] [tox]
minversion = 2.0 minversion = 2.0
envlist = py35,py27,pep8,functional envlist = py35,py27,pep8,api,functional
skipsdist = True skipsdist = True
[testenv] [testenv]
@ -17,7 +17,7 @@ whitelist_externals = find
basepython = python3.5 basepython = python3.5
setenv = VIRTUAL_ENV={envdir} setenv = VIRTUAL_ENV={envdir}
PYTHONHASHSEED=0 PYTHONHASHSEED=0
OS_TEST_PATH=senlin_tempest_plugin/tests/tempest/api OS_TEST_PATH=senlin_tempest_plugin/api
commands = commands =
find . -type f -name "*.py[c|o]" -delete find . -type f -name "*.py[c|o]" -delete
ostestr --slowest {posargs} ostestr --slowest {posargs}
@ -26,7 +26,7 @@ commands =
basepython = python3.5 basepython = python3.5
setenv = VIRTUAL_ENV={envdir} setenv = VIRTUAL_ENV={envdir}
PYTHONHASHSEED=0 PYTHONHASHSEED=0
OS_TEST_PATH=senlin_tempest_plugin/tests/tempest/functional OS_TEST_PATH=senlin_tempest_plugin/functional
# By default ostestr will set concurrency to ncpu, to specify something else # By default ostestr will set concurrency to ncpu, to specify something else
# use the concurrency=<n> option. # use the concurrency=<n> option.
# e.g.: 'tox -efunctional -- --concurrency=4' # e.g.: 'tox -efunctional -- --concurrency=4'
@ -55,7 +55,3 @@ enable-extensions=H106,H203
show-source = true show-source = true
exclude=.venv,.git,.tox,*lib/python*,*egg,tools,build,releasenotes exclude=.venv,.git,.tox,*lib/python*,*egg,tools,build,releasenotes
max-complexity=10 max-complexity=10
[testenv:bandit]
deps = -r{toxinidir}/test-requirements.txt
commands = bandit -r senlin -x tests -s B101,B104,B110,B310,B311,B506