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:
Yasufumi Ogawa
2025-06-14 03:05:30 +00:00
parent 5964e3a1fd
commit 098b9db0d4
16 changed files with 133 additions and 40 deletions

2
.gitignore vendored
View File

@@ -26,6 +26,7 @@ pip-log.txt
.tox .tox
nosetests.xml nosetests.xml
.testrepository .testrepository
.stestr
# Translations # Translations
*.mo *.mo
@@ -51,3 +52,4 @@ ChangeLog
.*.swp .*.swp
.idea .idea
*.iml *.iml

3
.stestr.conf Normal file
View File

@@ -0,0 +1,3 @@
[DEFAULT]
test_path=./translator/tests/
top_dir=./

View File

@@ -1,2 +1,2 @@
openstackdocstheme>=2.2.1 # Apache-2.0 openstackdocstheme>=3.4.1 # Apache-2.0
sphinx>=2.0.0,!=2.1.0 # BSD sphinx>=8.1.3 # BSD

View File

@@ -2,15 +2,15 @@
# date but we do not test them so no guarantee of having them all correct. If # 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. # you find any incorrect lower bounds, let us know or propose a fix.
pbr!=2.1.0,>=2.0.0 # Apache-2.0 pbr>=6.0.0 # Apache-2.0
cliff!=2.9.0,>=2.8.0 # Apache-2.0 cliff>=4.9.1 # Apache-2.0
PyYAML>=3.13 # MIT PyYAML>=3.13 # MIT
python-dateutil>=2.5.3 # BSD python-dateutil>=2.9.0 # BSD
tosca-parser>=1.6.1 # Apache-2.0 tosca-parser>=2.12.0 # Apache-2.0
keystoneauth1>=3.4.0 # Apache-2.0 keystoneauth1>=5.11.0 # Apache-2.0
python-novaclient>=9.1.0 # Apache-2.0 python-novaclient>=18.9.0 # Apache-2.0
python-heatclient>=1.10.0 # Apache-2.0 python-heatclient>=4.2.0 # Apache-2.0
python-glanceclient>=2.8.0 # Apache-2.0 python-glanceclient>=4.8.0 # Apache-2.0
requests>=2.18.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

View File

@@ -1210,10 +1210,12 @@ node_types:
- virtual_link: - virtual_link:
capability: tosca.capabilities.nfv.VirtualLinkable capability: tosca.capabilities.nfv.VirtualLinkable
relationship: tosca.relationships.nfv.VirtualLinksTo relationship: tosca.relationships.nfv.VirtualLinksTo
occurrences: [0, 1]
- virtual_binding: - virtual_binding:
capability: tosca.capabilities.nfv.VirtualBindable capability: tosca.capabilities.nfv.VirtualBindable
relationship: tosca.relationships.nfv.VirtualBindsTo relationship: tosca.relationships.nfv.VirtualBindsTo
node: tosca.nodes.nfv.Vdu.Compute node: tosca.nodes.nfv.Vdu.Compute
occurrences: [0, 1]
tosca.nodes.nfv.VnfVirtualLink: tosca.nodes.nfv.VnfVirtualLink:
derived_from: tosca.nodes.Root derived_from: tosca.nodes.Root

View File

@@ -25,6 +25,13 @@ resources:
image: ubuntu-software-config-os-init image: ubuntu-software-config-os-init
user_data_format: SOFTWARE_CONFIG 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: app_collectd_create_config:
type: OS::Heat::SoftwareConfig type: OS::Heat::SoftwareConfig
properties: properties:
@@ -91,12 +98,17 @@ resources:
group: script group: script
logstash_create_deploy: logstash_create_deploy:
type: OS::Heat::SoftwareDeployment type: OS::Heat::SoftwareDeploymentGroup
properties: properties:
config: config:
get_resource: logstash_create_config get_resource: logstash_create_config
server: servers:
logstash_server:
get_resource: logstash_server get_resource: logstash_server
elasticsearch_server:
get_resource: elasticsearch_server
depends_on:
- elasticsearch_server
logstash_start_config: logstash_start_config:
type: OS::Heat::SoftwareConfig type: OS::Heat::SoftwareConfig
@@ -106,12 +118,15 @@ resources:
group: script group: script
logstash_start_deploy: logstash_start_deploy:
type: OS::Heat::SoftwareDeployment type: OS::Heat::SoftwareDeploymentGroup
properties: properties:
config: config:
get_resource: logstash_start_config get_resource: logstash_start_config
server: servers:
logstash_server:
get_resource: logstash_server get_resource: logstash_server
elasticsearch_server:
get_resource: elasticsearch_server
depends_on: depends_on:
- logstash_create_deploy - logstash_create_deploy
@@ -123,12 +138,15 @@ resources:
group: script group: script
app_collectd_logstash_connect_deploy: app_collectd_logstash_connect_deploy:
type: OS::Heat::SoftwareDeployment type: OS::Heat::SoftwareDeploymentGroup
properties: properties:
config: config:
get_resource: app_collectd_logstash_connect_config get_resource: app_collectd_logstash_connect_config
server: servers:
logstash_server:
get_resource: logstash_server get_resource: logstash_server
elasticsearch_server:
get_resource: elasticsearch_server
depends_on: depends_on:
- logstash_create_deploy - logstash_create_deploy

View File

@@ -29,8 +29,12 @@ topology_template:
requirements: requirements:
- virtualLink: - virtualLink:
node: VL1 node: VL1
- link:
node: VL1
- virtualBinding: - virtualBinding:
node: VDU1 node: VDU1
- binding:
node: VDU1
VL1: VL1:
type: tosca.nodes.vendor.VL type: tosca.nodes.vendor.VL

View File

@@ -7,17 +7,18 @@ node_types:
tosca.nodes.vendor.VDU: tosca.nodes.vendor.VDU:
derived_from: tosca.nodes.Compute derived_from: tosca.nodes.Compute
capabilities: capabilities:
virtualbinding: binding:
type: tosca.capabilities.vendor.VendorBindable type: tosca.capabilities.vendor.VendorBindable
tosca.nodes.vendor.CP: tosca.nodes.vendor.CP:
derived_from: tosca.nodes.network.Port derived_from: tosca.nodes.network.Port
requirements: requirements:
- virtualLink: - link:
capability: tosca.capabilities.VendorLinkable capability: tosca.capabilities.VendorLinkable
relationship: tosca.relationships.vendor.VendorLinksTo relationship: tosca.relationships.vendor.VendorLinksTo
node: tosca.nodes.vendor.VL node: tosca.nodes.vendor.VL
- virtualBinding: occurrences: [0, 1]
- binding:
capability: tosca.capabilities.vendor.VendorBindable capability: tosca.capabilities.vendor.VendorBindable
node: tosca.nodes.vendor.VDU node: tosca.nodes.vendor.VDU
relationship: tosca.relationships.vendor.VendorBindsTo relationship: tosca.relationships.vendor.VendorBindsTo
@@ -25,7 +26,7 @@ node_types:
tosca.nodes.vendor.VL: tosca.nodes.vendor.VL:
derived_from: tosca.nodes.network.Network derived_from: tosca.nodes.network.Network
capabilities: capabilities:
virtual_linkable: link:
type: tosca.capabilities.vendor.VendorLinkable type: tosca.capabilities.vendor.VendorLinkable
relationship_types: relationship_types:
@@ -66,10 +67,11 @@ topology_template:
CP1: CP1:
type: tosca.nodes.vendor.CP type: tosca.nodes.vendor.CP
requirements: requirements:
- virtualLink: - link:
node: VL1 node: VL1
relationship: tosca.relationships.vendor.VendorLinksTo relationship: tosca.relationships.vendor.VendorLinksTo
- virtualBinding: occurrences: [0, 1]
- binding:
node: VDU1 node: VDU1
relationship: tosca.relationships.vendor.VendorBindsTo relationship: tosca.relationships.vendor.VendorBindsTo

View File

@@ -26,8 +26,12 @@ topology_template:
requirements: requirements:
- virtualLink: - virtualLink:
node: VL1 node: VL1
- link:
node: VL1
- virtualBinding: - virtualBinding:
node: VDU1 node: VDU1
- binding:
node: VDU1
VDU2: VDU2:
type: tosca.nodes.nfv.VDU.Tacker type: tosca.nodes.nfv.VDU.Tacker
@@ -46,8 +50,12 @@ topology_template:
requirements: requirements:
- virtualLink: - virtualLink:
node: VL1 node: VL1
- link:
node: VL1
- virtualBinding: - virtualBinding:
node: VDU2 node: VDU2
- binding:
node: VDU2
VL1: VL1:
type: tosca.nodes.nfv.VL type: tosca.nodes.nfv.VL

View File

@@ -37,8 +37,12 @@ topology_template:
requirements: requirements:
- virtualLink: - virtualLink:
node: VL1 node: VL1
- link:
node: VL1
- virtualBinding: - virtualBinding:
node: VDU1 node: VDU1
- binding:
node: VDU1
VL1: VL1:
type: tosca.nodes.nfv.VL type: tosca.nodes.nfv.VL

View File

@@ -61,9 +61,14 @@ topology_template:
- virtualLink: - virtualLink:
node: VL1 node: VL1
# relationship: tosca.relationships.nfv.VirtualLinksTo # relationship: tosca.relationships.nfv.VirtualLinksTo
- link:
node: VL1
- virtualBinding: - virtualBinding:
node: VDU1 node: VDU1
relationship: tosca.relationships.nfv.VirtualBindsTo relationship: tosca.relationships.nfv.VirtualBindsTo
- binding:
node: VDU1
relationship: tosca.relationships.nfv.VirtualBindsTo
CP2: CP2:
type: tosca.nodes.nfv.CP type: tosca.nodes.nfv.CP
@@ -73,9 +78,14 @@ topology_template:
- virtualLink: - virtualLink:
node: VL1 node: VL1
# relationship: tosca.relationships.nfv.VirtualLinksTo # relationship: tosca.relationships.nfv.VirtualLinksTo
- link:
node: VL1
- virtualBinding: - virtualBinding:
node: VDU2 node: VDU2
relationship: tosca.relationships.nfv.VirtualBindsTo relationship: tosca.relationships.nfv.VirtualBindsTo
- binding:
node: VDU2
relationship: tosca.relationships.nfv.VirtualBindsTo
VL1: VL1:
type: tosca.nodes.nfv.VL type: tosca.nodes.nfv.VL

View File

@@ -32,8 +32,12 @@ topology_template:
requirements: requirements:
- virtualLink: - virtualLink:
node: VL1 node: VL1
- link:
node: VL1
- virtualBinding: - virtualBinding:
node: VDU1 node: VDU1
- binding:
node: VDU1
VL1: VL1:
type: tosca.nodes.nfv.VL type: tosca.nodes.nfv.VL
properties: properties:

View File

@@ -57,6 +57,8 @@ topology_template:
requirements: requirements:
- host: - host:
node: logstash_server node: logstash_server
- search_endpoint:
node: elasticsearch_server
interfaces: interfaces:
Standard: Standard:
create: logstash/create.sh create: logstash/create.sh
@@ -70,6 +72,14 @@ topology_template:
host: host:
properties: *host_capabilities properties: *host_capabilities
elasticsearch_server:
type: tosca.nodes.Compute
capabilities:
host:
properties: *host_capabilities
os:
properties: *os_capabilities
logstash_server: logstash_server:
type: tosca.nodes.Compute type: tosca.nodes.Compute
capabilities: capabilities:

View File

@@ -1,8 +1,9 @@
hacking>=7.0.0,<7.1.0 # Apache-2.0 hacking>=7.0.0 # Apache-2.0
coverage!=4.4,>=4.0 # Apache-2.0 coverage>=7.8.1 # Apache-2.0
fixtures>=3.0.0 # Apache-2.0/BSD fixtures>=4.2.5 # Apache-2.0/BSD
oslotest>=3.2.0 # Apache-2.0 oslotest>=5.0.1 # Apache-2.0
python-subunit>=1.0.0 # Apache-2.0/BSD python-subunit>=1.4.4 # Apache-2.0/BSD
testrepository>=0.0.18 # Apache-2.0/BSD stestr>=2.0.0 # Apache-2.0
testscenarios>=0.4 # Apache-2.0/BSD testrepository>=0.0.21 # Apache-2.0/BSD
testtools>=2.2.0 # MIT testscenarios>=0.5.0 # Apache-2.0/BSD
testtools>=2.7.2 # MIT

View File

@@ -19,7 +19,7 @@ deps =
-c{env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master} -c{env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master}
-r{toxinidir}/requirements.txt -r{toxinidir}/requirements.txt
-r{toxinidir}/test-requirements.txt -r{toxinidir}/test-requirements.txt
commands = python setup.py test --slowest --testr-args='{posargs}' commands = stestr run --slowest '{posargs}'
[testenv:pep8] [testenv:pep8]
commands = flake8 commands = flake8
@@ -28,7 +28,12 @@ commands = flake8
commands = {posargs} commands = {posargs}
[testenv:cover] [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] [testenv:docs]
deps = deps =

View File

@@ -11,9 +11,11 @@
# under the License. # under the License.
import importlib
import json import json
import os import os
import shutil import shutil
import sys
import tempfile import tempfile
from unittest import mock from unittest import mock
@@ -31,6 +33,24 @@ class ShellTest(TestCase):
template_validation = "--validate-only" template_validation = "--validate-only"
failure_msg = _('The program raised an exception unexpectedly.') 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): def test_invalid_file_value(self):
error = self.assertRaises(ValueError, error = self.assertRaises(ValueError,
shell.main, ('--template-file=template.txt', shell.main, ('--template-file=template.txt',