From e5068782b9de0e3f2c4eac5b5ed2f4155400f14b Mon Sep 17 00:00:00 2001 From: John Mulligan Date: Thu, 21 Aug 2025 12:30:55 -0400 Subject: [PATCH] cephadm: fix some issues running existing cephadm build tests As time has marched on and people changed things our tests no longer match the expected inputs. Signed-off-by: John Mulligan (cherry picked from commit 31c8010faa417ca53614bd30379a9b9c0c9199de) --- src/cephadm/tests/build/test_cephadm_build.py | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/cephadm/tests/build/test_cephadm_build.py b/src/cephadm/tests/build/test_cephadm_build.py index c2995a76d4b..9beef67ffe0 100644 --- a/src/cephadm/tests/build/test_cephadm_build.py +++ b/src/cephadm/tests/build/test_cephadm_build.py @@ -34,12 +34,12 @@ CONTAINERS = { }, 'ubuntu-20.04': { 'name': 'cephadm-build-test:ubuntu-20-04-py3', - 'base_image': 'quay.io/library/ubuntu:20.04', + 'base_image': 'docker.io/library/ubuntu:20.04', 'script': 'apt update && apt install -y python3-venv', }, 'ubuntu-22.04': { 'name': 'cephadm-build-test:ubuntu-22-04-py3', - 'base_image': 'quay.io/library/ubuntu:22.04', + 'base_image': 'docker.io/library/ubuntu:22.04', 'script': 'apt update && apt install -y python3-venv', }, } @@ -128,8 +128,8 @@ def test_cephadm_build(env, source_dir, tmp_path): assert all('requirements_entry' in v for v in data['bundled_packages']) assert 'zip_root_entries' in data zre = data['zip_root_entries'] - assert any(e.startswith('Jinja2') for e in zre) - assert any(e.startswith('MarkupSafe') for e in zre) + assert any(_dist_info(e, 'Jinja2') for e in zre) + assert any(_dist_info(e, 'MarkupSafe') for e in zre) assert any(e.startswith('jinja2') for e in zre) assert any(e.startswith('markupsafe') for e in zre) assert any(e.startswith('cephadmlib') for e in zre) @@ -184,9 +184,15 @@ def test_cephadm_build_from_rpms(env, source_dir, tmp_path): assert all('requirements_entry' in v for v in data['bundled_packages']) assert 'zip_root_entries' in data zre = data['zip_root_entries'] - assert any(e.startswith('Jinja2') for e in zre) - assert any(e.startswith('MarkupSafe') for e in zre) + assert any(_dist_info(e, 'Jinja2') for e in zre) + assert any(_dist_info(e, 'MarkupSafe') for e in zre) assert any(e.startswith('jinja2') for e in zre) assert any(e.startswith('markupsafe') for e in zre) assert any(e.startswith('cephadmlib') for e in zre) assert any(e.startswith('_cephadmmeta') for e in zre) + + +def _dist_info(entry, name): + return ( + entry.startswith(entry) or entry.startswith(entry.lower()) + ) and (entry.endswith('.dist-info') or entry.endswith('.egg-info')) -- 2.39.5