Update jobs to fix the CI

- remove old / deprecated zuul jobs
- update to the latest rolling python3 jobs
- update tox based on tox4 fixes
- update tox python targets
- add the platform mocking patch - copy from https://review.opendev.org/c/openstack/charm-nova-compute-nvidia-vgpu/+/899177/2/unit_tests/__init__.py

Change-Id: If77436f4c27cf719907a2888d5b1e9e6c7eb3f7c
This commit is contained in:
Samuel Walladge 2023-09-29 07:36:44 +09:30
parent 5fc5216f51
commit f3a72cdc9f
5 changed files with 27 additions and 18 deletions

View File

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

23
tox.ini
View File

@ -7,29 +7,26 @@ sitepackages = False
skip_missing_interpreters = False
[testenv]
# We use tox mainly for virtual environment management for test requirements
# and do not install the charm code as a Python package into that environment.
# Ref: https://tox.wiki/en/latest/config.html#skip_install
skip_install = True
setenv = VIRTUAL_ENV={envdir}
PYTHONHASHSEED=0
install_command =
pip install {opts} {packages}
commands = stestr run {posargs}
[testenv:py34]
basepython = python3.4
[testenv:py38]
basepython = python3.8
deps = -r{toxinidir}/test-requirements.txt
commands = stestr run {posargs}
[testenv:py35]
basepython = python3.5
[testenv:py310]
basepython = python3.10
deps = -r{toxinidir}/test-requirements.txt
commands = stestr run {posargs}
[testenv:py36]
basepython = python3.6
deps = -r{toxinidir}/test-requirements.txt
commands = stestr run {posargs}
[testenv:py37]
basepython = python3.7
[testenv:py311]
basepython = python3.11
deps = -r{toxinidir}/test-requirements.txt
commands = stestr run {posargs}

View File

@ -0,0 +1,12 @@
# Patch out lsb_release() and get_platform() as unit tests should be fully
# insulated from the underlying platform. Unit tests assume that the system is
# ubuntu jammy.
from unittest.mock import patch
patch(
'charmhelpers.osplatform.get_platform', return_value='ubuntu'
).start()
patch(
'charmhelpers.core.host.lsb_release',
return_value={
'DISTRIB_CODENAME': 'jammy'
}).start()

View File

@ -123,8 +123,9 @@ requires:
'hacluster-b/1',
{'veg': 'carrot'})
self.assertEqual(
self.harness.charm.ha.get_remote_all('fruit'),
['orange', 'grape', 'banana'])
# sort for comparison because order is not guaranteed
sorted(self.harness.charm.ha.get_remote_all('fruit')),
['banana', 'grape', 'orange'])
def test_ha_ready(self):
self.harness.begin()

View File

@ -522,7 +522,7 @@ class TestHAClusterRequires(unittest.TestCase):
['value1'])
# Check multiple values:
self.assertEqual(
self.cr.get_remote_all('key2'),
sorted(self.cr.get_remote_all('key2')),
['value2', 'value3'])
# Check missing key
self.assertEqual(