From 69eb127263df4d9a71011a9c51702541c0aa0419 Mon Sep 17 00:00:00 2001 From: Ed Santiago Date: Thu, 10 Oct 2024 12:50:30 -0600 Subject: [PATCH] found a way to tell if we're running bats in parallel Signed-off-by: Ed Santiago --- test/system/helpers.bash | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/test/system/helpers.bash b/test/system/helpers.bash index 1cd79fbe3949..c54d02bff7af 100644 --- a/test/system/helpers.bash +++ b/test/system/helpers.bash @@ -456,13 +456,17 @@ function clean_setup() { # Load (create, actually) the pause image. This way, all pod tests will # have it available. Without this, pod tests run in parallel will leave # behind : images. - # FIXME: we have to do this always, because there's no way (in bats 1.11) - # to tell if we're running in parallel. See bats-core#998 + # FIXME: only do this when running parallel! Otherwise, we may break + # test expectations. + # SUB-FIXME: there's no actual way to tell if we're running bats + # in parallel (see bats-core#998). Use undocumented hack. # FIXME: #23292 -- this should not be necessary. - run_podman pod create mypod - run_podman pod rm mypod - # And now, we have a pause image, and each test does not - # need to build their own. + if [[ -n "$BATS_SEMAPHORE_DIR" ]]; then + run_podman pod create mypod + run_podman pod rm mypod + # And now, we have a pause image, and each test does not + # need to build their own. + fi } # END setup/teardown tools