Reduce python APIv2 test net dependency

Previously these tests pulled some test images from quay, opening them up
to networking-flake induced failures.  As has already been done for
other tests, update to utilize the locally running registry server.

Also: Add `test/python/**` into the apiv2 task conditions as referenced
by the `Makefile` `localapiv2-python` target.

Signed-off-by: Chris Evich <cevich@redhat.com>
This commit is contained in:
Chris Evich
2024-08-07 11:58:49 -04:00
parent bf091abdc5
commit 7936809f75
2 changed files with 15 additions and 5 deletions

View File

@ -44,17 +44,27 @@ class PodmanAPI:
os.environ["CONTAINERS_REGISTRIES_CONF"] = os.path.join(
self.anchor_directory, "registry.conf"
)
conf = """unqualified-search-registries = ["docker.io", "quay.io"]
[[registry]]
location="localhost:5000"
insecure=true
# Entry verified by compat/test_system.py
reg_conf_sfx = """
[[registry.mirror]]
location = "mirror.localhost:5000"
"""
# Assume developer-mode testing by default
reg_conf_source_path="./test/registries.conf"
# When operating in a CI environment, use the local registry server.
# Ref: https://github.com/containers/automation_images/pull/357
# https://github.com/containers/podman/pull/22726
if os.getenv("CI_USE_REGISTRY_CACHE"):
reg_conf_source_path = "./test/registries-cached.conf"
with open(os.path.join(reg_conf_source_path)) as file:
conf = file.read() + reg_conf_sfx
with open(os.environ["CONTAINERS_REGISTRIES_CONF"], "w") as file:
file.write(conf)