test/system: Remove stray 'podman stop' error in setup_suite() failures

If setup_suite() fails for some reason, causing the Docker registry to
not be created, then an unrelated message from 'podman stop' would show
up:
  not ok 1 setup_suite
  # (from function `setup_suite' in test file
       test/system/setup_suite.bash, line 43)
  #   `_pull_and_cache_distro_image foo || false' failed
  # Requested distro (foo) does not have a matching image
  # Error: no container with name or ID "docker-registry" found: no such
      container
  # ...
  # ...

This extra error message from 'podman stop' serves no purpose because
it's not related to the cause of the setup_suite() failure.  It's just
noise and it's better to silence it.

https://github.com/containers/toolbox/pull/1375
This commit is contained in:
Debarshi Ray 2023-09-22 20:20:29 +02:00
parent e1745ef9c2
commit 66a7ad7c97

View file

@ -218,7 +218,10 @@ function _setup_docker_registry() {
# Stop, removes and cleans after a locally hosted Docker registry # Stop, removes and cleans after a locally hosted Docker registry
function _clean_docker_registry() { function _clean_docker_registry() {
# Stop Docker registry container # Stop Docker registry container
if "$PODMAN" --root "$DOCKER_REG_ROOT" container exists "$DOCKER_REG_NAME"; then
"$PODMAN" --root "${DOCKER_REG_ROOT}" stop --time 0 "${DOCKER_REG_NAME}" "$PODMAN" --root "${DOCKER_REG_ROOT}" stop --time 0 "${DOCKER_REG_NAME}"
fi
# Clean up Podman's registry root state # Clean up Podman's registry root state
"$PODMAN" --root "${DOCKER_REG_ROOT}" rm --all --force "$PODMAN" --root "${DOCKER_REG_ROOT}" rm --all --force
"$PODMAN" --root "${DOCKER_REG_ROOT}" rmi --all --force "$PODMAN" --root "${DOCKER_REG_ROOT}" rmi --all --force