Fix CI failures
1. Use stestr instead of deprecated running setup.py directly. 2. Stricter relationship validation in tosca-parser v2.13.0 caused template validation errors as similar to [1]. 3. Since several depending packages are too old and failed to path unittests, update version of the packages. [1] https://review.opendev.org/c/openstack/tacker/+/956458 Change-Id: I2b317f2c58518ae40b9c22dd1398a018580dc3cc Signed-off-by: Yasufumi Ogawa <yasufum.o@gmail.com> Co-authored-by: Shivam Shukla <shivam.shukla3@india.nec.com>
This commit is contained in:
4
.gitignore
vendored
4
.gitignore
vendored
@@ -26,6 +26,7 @@ pip-log.txt
|
||||
.tox
|
||||
nosetests.xml
|
||||
.testrepository
|
||||
.stestr
|
||||
|
||||
# Translations
|
||||
*.mo
|
||||
@@ -50,4 +51,5 @@ ChangeLog
|
||||
*~
|
||||
.*.swp
|
||||
.idea
|
||||
*.iml
|
||||
*.iml
|
||||
|
||||
|
3
.stestr.conf
Normal file
3
.stestr.conf
Normal file
@@ -0,0 +1,3 @@
|
||||
[DEFAULT]
|
||||
test_path=./translator/tests/
|
||||
top_dir=./
|
@@ -1,2 +1,2 @@
|
||||
openstackdocstheme>=2.2.1 # Apache-2.0
|
||||
sphinx>=2.0.0,!=2.1.0 # BSD
|
||||
openstackdocstheme>=3.4.1 # Apache-2.0
|
||||
sphinx>=8.1.3 # BSD
|
||||
|
@@ -2,15 +2,15 @@
|
||||
# date but we do not test them so no guarantee of having them all correct. If
|
||||
# you find any incorrect lower bounds, let us know or propose a fix.
|
||||
|
||||
pbr!=2.1.0,>=2.0.0 # Apache-2.0
|
||||
cliff!=2.9.0,>=2.8.0 # Apache-2.0
|
||||
pbr>=6.0.0 # Apache-2.0
|
||||
cliff>=4.9.1 # Apache-2.0
|
||||
PyYAML>=3.13 # MIT
|
||||
python-dateutil>=2.5.3 # BSD
|
||||
tosca-parser>=1.6.1 # Apache-2.0
|
||||
keystoneauth1>=3.4.0 # Apache-2.0
|
||||
python-novaclient>=9.1.0 # Apache-2.0
|
||||
python-heatclient>=1.10.0 # Apache-2.0
|
||||
python-glanceclient>=2.8.0 # Apache-2.0
|
||||
requests>=2.18.0 # Apache-2.0
|
||||
python-dateutil>=2.9.0 # BSD
|
||||
tosca-parser>=2.12.0 # Apache-2.0
|
||||
keystoneauth1>=5.11.0 # Apache-2.0
|
||||
python-novaclient>=18.9.0 # Apache-2.0
|
||||
python-heatclient>=4.2.0 # Apache-2.0
|
||||
python-glanceclient>=4.8.0 # Apache-2.0
|
||||
requests>=2.32.2 # Apache-2.0
|
||||
|
||||
oslo.log>=3.36.0 # Apache-2.0
|
||||
oslo.log>=7.1.0 # Apache-2.0
|
||||
|
@@ -1210,18 +1210,20 @@ node_types:
|
||||
- virtual_link:
|
||||
capability: tosca.capabilities.nfv.VirtualLinkable
|
||||
relationship: tosca.relationships.nfv.VirtualLinksTo
|
||||
occurrences: [0, 1]
|
||||
- virtual_binding:
|
||||
capability: tosca.capabilities.nfv.VirtualBindable
|
||||
relationship: tosca.relationships.nfv.VirtualBindsTo
|
||||
node: tosca.nodes.nfv.Vdu.Compute
|
||||
occurrences: [0, 1]
|
||||
|
||||
tosca.nodes.nfv.VnfVirtualLink:
|
||||
derived_from: tosca.nodes.Root
|
||||
description: Describes the information about an internal VNF VL
|
||||
description: Describes the information about an internal VNF VL
|
||||
properties:
|
||||
connectivity_type:
|
||||
type: tosca.datatypes.nfv.ConnectivityType
|
||||
description: Specifies the protocol exposed by the VL and the flow pattern supported by the VL
|
||||
description: Specifies the protocol exposed by the VL and the flow pattern supported by the VL
|
||||
required: true
|
||||
description:
|
||||
type: string
|
||||
|
@@ -25,6 +25,13 @@ resources:
|
||||
image: ubuntu-software-config-os-init
|
||||
user_data_format: SOFTWARE_CONFIG
|
||||
|
||||
elasticsearch_server:
|
||||
type: OS::Nova::Server
|
||||
properties:
|
||||
flavor: m1.medium
|
||||
image: ubuntu-software-config-os-init
|
||||
user_data_format: SOFTWARE_CONFIG
|
||||
|
||||
app_collectd_create_config:
|
||||
type: OS::Heat::SoftwareConfig
|
||||
properties:
|
||||
@@ -91,12 +98,17 @@ resources:
|
||||
group: script
|
||||
|
||||
logstash_create_deploy:
|
||||
type: OS::Heat::SoftwareDeployment
|
||||
type: OS::Heat::SoftwareDeploymentGroup
|
||||
properties:
|
||||
config:
|
||||
get_resource: logstash_create_config
|
||||
server:
|
||||
get_resource: logstash_server
|
||||
servers:
|
||||
logstash_server:
|
||||
get_resource: logstash_server
|
||||
elasticsearch_server:
|
||||
get_resource: elasticsearch_server
|
||||
depends_on:
|
||||
- elasticsearch_server
|
||||
|
||||
logstash_start_config:
|
||||
type: OS::Heat::SoftwareConfig
|
||||
@@ -106,12 +118,15 @@ resources:
|
||||
group: script
|
||||
|
||||
logstash_start_deploy:
|
||||
type: OS::Heat::SoftwareDeployment
|
||||
type: OS::Heat::SoftwareDeploymentGroup
|
||||
properties:
|
||||
config:
|
||||
get_resource: logstash_start_config
|
||||
server:
|
||||
get_resource: logstash_server
|
||||
servers:
|
||||
logstash_server:
|
||||
get_resource: logstash_server
|
||||
elasticsearch_server:
|
||||
get_resource: elasticsearch_server
|
||||
depends_on:
|
||||
- logstash_create_deploy
|
||||
|
||||
@@ -123,12 +138,15 @@ resources:
|
||||
group: script
|
||||
|
||||
app_collectd_logstash_connect_deploy:
|
||||
type: OS::Heat::SoftwareDeployment
|
||||
type: OS::Heat::SoftwareDeploymentGroup
|
||||
properties:
|
||||
config:
|
||||
get_resource: app_collectd_logstash_connect_config
|
||||
server:
|
||||
get_resource: logstash_server
|
||||
servers:
|
||||
logstash_server:
|
||||
get_resource: logstash_server
|
||||
elasticsearch_server:
|
||||
get_resource: elasticsearch_server
|
||||
depends_on:
|
||||
- logstash_create_deploy
|
||||
|
||||
|
@@ -29,8 +29,12 @@ topology_template:
|
||||
requirements:
|
||||
- virtualLink:
|
||||
node: VL1
|
||||
- link:
|
||||
node: VL1
|
||||
- virtualBinding:
|
||||
node: VDU1
|
||||
- binding:
|
||||
node: VDU1
|
||||
|
||||
VL1:
|
||||
type: tosca.nodes.vendor.VL
|
||||
|
@@ -7,17 +7,18 @@ node_types:
|
||||
tosca.nodes.vendor.VDU:
|
||||
derived_from: tosca.nodes.Compute
|
||||
capabilities:
|
||||
virtualbinding:
|
||||
binding:
|
||||
type: tosca.capabilities.vendor.VendorBindable
|
||||
|
||||
tosca.nodes.vendor.CP:
|
||||
derived_from: tosca.nodes.network.Port
|
||||
requirements:
|
||||
- virtualLink:
|
||||
- link:
|
||||
capability: tosca.capabilities.VendorLinkable
|
||||
relationship: tosca.relationships.vendor.VendorLinksTo
|
||||
node: tosca.nodes.vendor.VL
|
||||
- virtualBinding:
|
||||
occurrences: [0, 1]
|
||||
- binding:
|
||||
capability: tosca.capabilities.vendor.VendorBindable
|
||||
node: tosca.nodes.vendor.VDU
|
||||
relationship: tosca.relationships.vendor.VendorBindsTo
|
||||
@@ -25,7 +26,7 @@ node_types:
|
||||
tosca.nodes.vendor.VL:
|
||||
derived_from: tosca.nodes.network.Network
|
||||
capabilities:
|
||||
virtual_linkable:
|
||||
link:
|
||||
type: tosca.capabilities.vendor.VendorLinkable
|
||||
|
||||
relationship_types:
|
||||
@@ -66,10 +67,11 @@ topology_template:
|
||||
CP1:
|
||||
type: tosca.nodes.vendor.CP
|
||||
requirements:
|
||||
- virtualLink:
|
||||
- link:
|
||||
node: VL1
|
||||
relationship: tosca.relationships.vendor.VendorLinksTo
|
||||
- virtualBinding:
|
||||
occurrences: [0, 1]
|
||||
- binding:
|
||||
node: VDU1
|
||||
relationship: tosca.relationships.vendor.VendorBindsTo
|
||||
|
||||
|
@@ -26,8 +26,12 @@ topology_template:
|
||||
requirements:
|
||||
- virtualLink:
|
||||
node: VL1
|
||||
- link:
|
||||
node: VL1
|
||||
- virtualBinding:
|
||||
node: VDU1
|
||||
- binding:
|
||||
node: VDU1
|
||||
|
||||
VDU2:
|
||||
type: tosca.nodes.nfv.VDU.Tacker
|
||||
@@ -46,8 +50,12 @@ topology_template:
|
||||
requirements:
|
||||
- virtualLink:
|
||||
node: VL1
|
||||
- link:
|
||||
node: VL1
|
||||
- virtualBinding:
|
||||
node: VDU2
|
||||
- binding:
|
||||
node: VDU2
|
||||
|
||||
VL1:
|
||||
type: tosca.nodes.nfv.VL
|
||||
|
@@ -37,8 +37,12 @@ topology_template:
|
||||
requirements:
|
||||
- virtualLink:
|
||||
node: VL1
|
||||
- link:
|
||||
node: VL1
|
||||
- virtualBinding:
|
||||
node: VDU1
|
||||
- binding:
|
||||
node: VDU1
|
||||
|
||||
VL1:
|
||||
type: tosca.nodes.nfv.VL
|
||||
|
@@ -61,9 +61,14 @@ topology_template:
|
||||
- virtualLink:
|
||||
node: VL1
|
||||
# relationship: tosca.relationships.nfv.VirtualLinksTo
|
||||
- link:
|
||||
node: VL1
|
||||
- virtualBinding:
|
||||
node: VDU1
|
||||
relationship: tosca.relationships.nfv.VirtualBindsTo
|
||||
- binding:
|
||||
node: VDU1
|
||||
relationship: tosca.relationships.nfv.VirtualBindsTo
|
||||
|
||||
CP2:
|
||||
type: tosca.nodes.nfv.CP
|
||||
@@ -73,9 +78,14 @@ topology_template:
|
||||
- virtualLink:
|
||||
node: VL1
|
||||
# relationship: tosca.relationships.nfv.VirtualLinksTo
|
||||
- link:
|
||||
node: VL1
|
||||
- virtualBinding:
|
||||
node: VDU2
|
||||
relationship: tosca.relationships.nfv.VirtualBindsTo
|
||||
- binding:
|
||||
node: VDU2
|
||||
relationship: tosca.relationships.nfv.VirtualBindsTo
|
||||
|
||||
VL1:
|
||||
type: tosca.nodes.nfv.VL
|
||||
|
@@ -32,8 +32,12 @@ topology_template:
|
||||
requirements:
|
||||
- virtualLink:
|
||||
node: VL1
|
||||
- link:
|
||||
node: VL1
|
||||
- virtualBinding:
|
||||
node: VDU1
|
||||
- binding:
|
||||
node: VDU1
|
||||
VL1:
|
||||
type: tosca.nodes.nfv.VL
|
||||
properties:
|
||||
|
@@ -57,6 +57,8 @@ topology_template:
|
||||
requirements:
|
||||
- host:
|
||||
node: logstash_server
|
||||
- search_endpoint:
|
||||
node: elasticsearch_server
|
||||
interfaces:
|
||||
Standard:
|
||||
create: logstash/create.sh
|
||||
@@ -70,6 +72,14 @@ topology_template:
|
||||
host:
|
||||
properties: *host_capabilities
|
||||
|
||||
elasticsearch_server:
|
||||
type: tosca.nodes.Compute
|
||||
capabilities:
|
||||
host:
|
||||
properties: *host_capabilities
|
||||
os:
|
||||
properties: *os_capabilities
|
||||
|
||||
logstash_server:
|
||||
type: tosca.nodes.Compute
|
||||
capabilities:
|
||||
|
@@ -1,8 +1,9 @@
|
||||
hacking>=7.0.0,<7.1.0 # Apache-2.0
|
||||
coverage!=4.4,>=4.0 # Apache-2.0
|
||||
fixtures>=3.0.0 # Apache-2.0/BSD
|
||||
oslotest>=3.2.0 # Apache-2.0
|
||||
python-subunit>=1.0.0 # Apache-2.0/BSD
|
||||
testrepository>=0.0.18 # Apache-2.0/BSD
|
||||
testscenarios>=0.4 # Apache-2.0/BSD
|
||||
testtools>=2.2.0 # MIT
|
||||
hacking>=7.0.0 # Apache-2.0
|
||||
coverage>=7.8.1 # Apache-2.0
|
||||
fixtures>=4.2.5 # Apache-2.0/BSD
|
||||
oslotest>=5.0.1 # Apache-2.0
|
||||
python-subunit>=1.4.4 # Apache-2.0/BSD
|
||||
stestr>=2.0.0 # Apache-2.0
|
||||
testrepository>=0.0.21 # Apache-2.0/BSD
|
||||
testscenarios>=0.5.0 # Apache-2.0/BSD
|
||||
testtools>=2.7.2 # MIT
|
||||
|
9
tox.ini
9
tox.ini
@@ -19,7 +19,7 @@ deps =
|
||||
-c{env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master}
|
||||
-r{toxinidir}/requirements.txt
|
||||
-r{toxinidir}/test-requirements.txt
|
||||
commands = python setup.py test --slowest --testr-args='{posargs}'
|
||||
commands = stestr run --slowest '{posargs}'
|
||||
|
||||
[testenv:pep8]
|
||||
commands = flake8
|
||||
@@ -28,7 +28,12 @@ commands = flake8
|
||||
commands = {posargs}
|
||||
|
||||
[testenv:cover]
|
||||
commands = python setup.py test --coverage --coverage-package-name=translator --testr-args='{posargs}'
|
||||
setenv =
|
||||
PYTHON=coverage run --source translator --parallel-mode
|
||||
commands = stestr run '{posargs}'
|
||||
coverage combine
|
||||
coverage html -d cover
|
||||
coverage xml -o cover/coverage.xml
|
||||
|
||||
[testenv:docs]
|
||||
deps =
|
||||
|
@@ -11,9 +11,11 @@
|
||||
# under the License.
|
||||
|
||||
|
||||
import importlib
|
||||
import json
|
||||
import os
|
||||
import shutil
|
||||
import sys
|
||||
import tempfile
|
||||
from unittest import mock
|
||||
|
||||
@@ -31,6 +33,24 @@ class ShellTest(TestCase):
|
||||
template_validation = "--validate-only"
|
||||
failure_msg = _('The program raised an exception unexpectedly.')
|
||||
|
||||
def tearDown(self):
|
||||
"""Ensure all mocks are properly cleaned up after each test"""
|
||||
super().tearDown()
|
||||
mock.patch.stopall()
|
||||
modules_to_clear = [
|
||||
'translator.common.flavors',
|
||||
'translator.common.images',
|
||||
'novaclient.client',
|
||||
'keystoneauth1.adapter',
|
||||
'novaclient.v2.flavors'
|
||||
]
|
||||
for module in modules_to_clear:
|
||||
if module in sys.modules:
|
||||
try:
|
||||
importlib.reload(sys.modules[module])
|
||||
except (ImportError, AttributeError):
|
||||
sys.modules.pop(module, None)
|
||||
|
||||
def test_invalid_file_value(self):
|
||||
error = self.assertRaises(ValueError,
|
||||
shell.main, ('--template-file=template.txt',
|
||||
|
Reference in New Issue
Block a user