Add caracal/squid mapping

Also patch out charmhelpers.osplatform.get_platform() and
charmhelpers.core.host.lsb_release() globally in the unit tests

Change-Id: I0d230c62775536aa29cc96053b129af37d157116
This commit is contained in:
Peter Sabaini 2024-05-27 12:34:04 +02:00
parent 48a2ce2fb9
commit 2a2b36b10e
3 changed files with 34 additions and 0 deletions

View File

@ -54,6 +54,7 @@ UCA_CODENAME_MAP = {
'zed': 'quincy',
'antelope': 'quincy',
'bobcat': 'reef',
'caracal': 'squid',
}

View File

@ -56,6 +56,11 @@ basepython = python3.10
deps = -r{toxinidir}/test-requirements.txt
commands = stestr run --slowest {posargs}
[testenv:py311]
basepython = python3.11
deps = -r{toxinidir}/test-requirements.txt
commands = stestr run --slowest {posargs}
[testenv:pep8]
basepython = python3
deps = -r{toxinidir}/test-requirements.txt

View File

@ -0,0 +1,28 @@
# Copyright 2024 Canonical Ltd.
#
# 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 unittest.mock import patch
# 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.
patch(
'charmhelpers.osplatform.get_platform', return_value='ubuntu'
).start()
patch(
'charmhelpers.core.host.lsb_release',
return_value={
'DISTRIB_CODENAME': 'jammy'
}).start()