Misc updates for Python 3.12

Add tox target.

Fix use of assertEquals.

Add check/gate for charm build.

Drop build.lock file to pickup new dep versions.

Change-Id: Iecb71cf58596ce6f23703bbcf36d7bf0a9628e2c
This commit is contained in:
James Page 2024-11-20 10:42:49 +00:00
parent a30552d298
commit 3b8425281d
No known key found for this signature in database
GPG Key ID: BFECAECBA0E7D8C3
7 changed files with 25 additions and 278 deletions

3
.gitignore vendored
View File

@ -8,3 +8,6 @@ __pycache__
.stestr
*.charm
.vscode
.project
.pydevproject
interfaces/*

View File

@ -2,3 +2,8 @@
templates:
- openstack-python3-charm-yoga-jobs
- openstack-cover-jobs
check:
jobs:
- charmbuild
vars:
charm_build_name: ceph-fs

View File

@ -5,6 +5,7 @@ parts:
plugin: reactive
reactive-charm-build-arguments:
- --binary-wheels-from-source
- -v
build-packages:
- tox
- git

View File

@ -1,268 +0,0 @@
{
"locks": [
{
"type": "layer",
"item": "layer:options",
"url": "https://github.com/juju-solutions/layer-options.git",
"vcs": null,
"branch": "fcdcea4e5de3e1556c24e6704607862d0ba00a56",
"commit": "fcdcea4e5de3e1556c24e6704607862d0ba00a56"
},
{
"type": "layer",
"item": "layer:basic",
"url": "https://github.com/juju-solutions/layer-basic.git",
"vcs": null,
"branch": "33526bd6aaa01ffe717a5c66ed62bc4790344ef2",
"commit": "33526bd6aaa01ffe717a5c66ed62bc4790344ef2"
},
{
"type": "layer",
"item": "layer:openstack",
"url": "https://github.com/openstack/charm-layer-openstack",
"vcs": null,
"branch": "7c671b0696977f455616565d956895b2f890464b",
"commit": "7c671b0696977f455616565d956895b2f890464b"
},
{
"type": "layer",
"item": "layer:ceph",
"url": "https://github.com/openstack/charm-layer-ceph.git",
"vcs": null,
"branch": "17d40abd8d9ec3b8c32756ca981c80c4733c016f",
"commit": "17d40abd8d9ec3b8c32756ca981c80c4733c016f"
},
{
"type": "layer",
"item": "ceph-fs",
"url": null,
"vcs": null,
"branch": "e6c6f13cde785174cee1a48a8df1c581e394fc3b",
"commit": "e6c6f13cde785174cee1a48a8df1c581e394fc3b"
},
{
"type": "layer",
"item": "interface:tls-certificates",
"url": "https://github.com/juju-solutions/interface-tls-certificates",
"vcs": null,
"branch": "da891c403864482688ec767a964218e5857f0e49",
"commit": "da891c403864482688ec767a964218e5857f0e49"
},
{
"type": "layer",
"item": "interface:ceph-mds",
"url": "https://opendev.org/openstack/charm-interface-ceph-client.git",
"vcs": null,
"branch": "d9f3b53ca0cf30e47347a68beab59da5c03ce4c7",
"commit": "d9f3b53ca0cf30e47347a68beab59da5c03ce4c7"
},
{
"type": "layer",
"item": "interface:cephfs_share",
"url": null,
"vcs": null,
"branch": "e6c6f13cde785174cee1a48a8df1c581e394fc3b",
"commit": "e6c6f13cde785174cee1a48a8df1c581e394fc3b"
},
{
"type": "python_module",
"package": "dnspython3",
"vcs": null,
"version": "1.12.0"
},
{
"type": "python_module",
"package": "netifaces",
"vcs": null,
"version": "0.11.0"
},
{
"type": "python_module",
"package": "packaging",
"vcs": null,
"version": "24.1"
},
{
"type": "python_module",
"package": "setuptools",
"vcs": null,
"version": "71.1.0"
},
{
"type": "python_module",
"package": "pyaml",
"vcs": null,
"version": "21.10.1"
},
{
"type": "python_module",
"package": "flit_scm",
"vcs": null,
"version": "1.7.0"
},
{
"type": "python_module",
"package": "charms.reactive",
"url": "git+https://github.com/canonical/charms.reactive.git",
"branch": "0dc82abb7ac01f288042ee44b56a9d428c8fc46c",
"version": "0dc82abb7ac01f288042ee44b56a9d428c8fc46c",
"vcs": "git"
},
{
"type": "python_module",
"package": "psutil",
"vcs": null,
"version": "6.0.0"
},
{
"type": "python_module",
"package": "pyxattr",
"vcs": null,
"version": "0.8.1"
},
{
"type": "python_module",
"package": "MarkupSafe",
"vcs": null,
"version": "2.1.5"
},
{
"type": "python_module",
"package": "trove_classifiers",
"vcs": null,
"version": "2024.7.2"
},
{
"type": "python_module",
"package": "flit_core",
"vcs": null,
"version": "3.9.0"
},
{
"type": "python_module",
"package": "PyYAML",
"vcs": null,
"version": "6.0.1"
},
{
"type": "python_module",
"package": "charmhelpers",
"url": "git+https://github.com/juju/charm-helpers.git",
"branch": "1b2d4dc8f8effd79d782241a32a0485af1f01e73",
"version": "1b2d4dc8f8effd79d782241a32a0485af1f01e73",
"vcs": "git"
},
{
"type": "python_module",
"package": "pip",
"vcs": null,
"version": "22.0.4"
},
{
"type": "python_module",
"package": "calver",
"vcs": null,
"version": "2022.6.26"
},
{
"type": "python_module",
"package": "pluggy",
"vcs": null,
"version": "1.5.0"
},
{
"type": "python_module",
"package": "pyudev",
"vcs": null,
"version": "0.24.3"
},
{
"type": "python_module",
"package": "six",
"vcs": null,
"version": "1.16.0"
},
{
"type": "python_module",
"package": "pathspec",
"vcs": null,
"version": "0.12.1"
},
{
"type": "python_module",
"package": "jinja2",
"vcs": null,
"version": "3.1.4"
},
{
"type": "python_module",
"package": "pbr",
"vcs": null,
"version": "6.0.0"
},
{
"type": "python_module",
"package": "charms.ceph",
"url": "git+https://github.com/openstack/charms.ceph.git",
"branch": "64f3c1b12b14545a76321469478fb456b379832d",
"version": "64f3c1b12b14545a76321469478fb456b379832d",
"vcs": "git"
},
{
"type": "python_module",
"package": "looseversion",
"vcs": null,
"version": "1.3.0"
},
{
"type": "python_module",
"package": "hatchling",
"vcs": null,
"version": "1.25.0"
},
{
"type": "python_module",
"package": "netaddr",
"vcs": null,
"version": "0.7.19"
},
{
"type": "python_module",
"package": "Cython",
"vcs": null,
"version": "0.29.37"
},
{
"type": "python_module",
"package": "charms.openstack",
"url": "git+https://github.com/openstack/charms.openstack.git",
"branch": "355d65f64cc1dac133d885aa7cfc58b1804a0c30",
"version": "355d65f64cc1dac133d885aa7cfc58b1804a0c30",
"vcs": "git"
},
{
"type": "python_module",
"package": "wheel",
"vcs": null,
"version": "0.43.0"
},
{
"type": "python_module",
"package": "dnspython",
"vcs": null,
"version": "2.6.1"
},
{
"type": "python_module",
"package": "ceph_api",
"vcs": null,
"version": "0.4.0"
},
{
"type": "python_module",
"package": "setuptools_scm",
"vcs": null,
"version": "8.1.0"
}
]
}

View File

@ -5,7 +5,6 @@
#
pyparsing<3.0.0 # aodhclient is pinned in zaza and needs pyparsing < 3.0.0, but cffi also needs it, so pin here.
cffi==1.14.6; python_version < '3.6' # cffi 1.15.0 drops support for py35.
setuptools<50.0.0 # https://github.com/pypa/setuptools/commit/04e3df22df840c6bb244e9b27bc56750c44b7c85
stestr>=2.2.0

View File

@ -64,6 +64,13 @@ deps =
-r{toxinidir}/test-requirements.txt
commands = stestr run --slowest {posargs}
[testenv:py312]
basepython = python3.12
deps =
-c {env:TEST_CONSTRAINTS_FILE:https://raw.githubusercontent.com/openstack-charmers/zaza-openstack-tests/master/constraints/constraints-2024.1.txt}
-r{toxinidir}/test-requirements.txt
commands = stestr run --slowest {posargs}
[testenv:pep8]
basepython = python3
deps = flake8==3.9.2

View File

@ -32,7 +32,7 @@ class TestMitakaCephFsCharm(test_utils.PatchHelper):
# Package list is the only difference between the past version and
# future versions of this charm, see ``TestCephFsCharm`` for the rest
# of the tests
self.assertEquals(self.target.packages, [
self.assertEqual(self.target.packages, [
'ceph-mds', 'gdisk', 'btrfs-tools', 'xfsprogs'])
@ -54,30 +54,30 @@ class TestCephFsCharm(test_utils.PatchHelper):
setattr(self, attr, started)
def test___init__(self):
self.assertEquals(self.target.services, [
self.assertEqual(self.target.services, [
'ceph-mds@somehost'])
self.assertDictEqual(self.target.restart_map, {
'/etc/ceph/ceph.conf': ['ceph-mds@somehost']})
self.assertEquals(self.target.packages, [
self.assertEqual(self.target.packages, [
'ceph-mds', 'gdisk', 'btrfs-progs', 'xfsprogs'])
def test_configuration_class(self):
self.assertEquals(self.target.options.hostname, 'somehost')
self.assertEquals(self.target.options.mds_name, 'somehost')
self.assertEqual(self.target.options.hostname, 'somehost')
self.assertEqual(self.target.options.mds_name, 'somehost')
self.patch_target('get_networks')
self.get_networks.return_value = ['fakeaddress']
self.assertEquals(self.target.options.networks, ['fakeaddress'])
self.assertEqual(self.target.options.networks, ['fakeaddress'])
self.patch_object(ceph_fs.ch_core.hookenv, 'config')
self.config.side_effect = lambda x: {'prefer-ipv6': False}.get(x)
self.patch_object(ceph_fs, 'get_ipv6_addr')
self.get_ipv6_addr.return_value = ['2001:db8::fake']
self.patch_target('get_public_addr')
self.get_public_addr.return_value = '192.0.2.42'
self.assertEquals(
self.assertEqual(
self.target.options.public_addr,
'192.0.2.42')
self.config.side_effect = lambda x: {'prefer-ipv6': True}.get(x)
self.assertEquals(
self.assertEqual(
self.target.options.public_addr,
'2001:db8::fake')
self.patch_target('get_mds_cache')
@ -85,7 +85,7 @@ class TestCephFsCharm(test_utils.PatchHelper):
'mds-cache-memory-limit': '4Gi',
'mds-cache-reservation': 0.05,
'mds-health-cache-threshold': 1.5}
self.assertEquals(self.target.options.mds_cache, {
self.assertEqual(self.target.options.mds_cache, {
'mds-cache-memory-limit': '4Gi',
'mds-cache-reservation': 0.05,
'mds-health-cache-threshold': 1.5})