From 5b131b827389fcd0d7db9faee3f6c9419946a5b6 Mon Sep 17 00:00:00 2001 From: David Gibson Date: Wed, 23 Oct 2024 13:59:09 +1100 Subject: [PATCH] test/system: Fix spurious "duplicate tests" failures in pasta tests As an internal consistency check, the pasta tests check for duplicated test cases by grepping a log file for a parsed test id. However it uses grep -F for the purpose which will not perform an exact match, but a substring match. There are some tests which generate an id which is a substring of the id for other tests, so when test order is randomised, this can cause a spurious failure. This can happen in practice when running the test in parallel with very high concurrency (e.g. -j 100). Fix this by adding the -x option to grep, which only checks for full line exact matches. Fixes: https://github.com/containers/podman/issues/24342 Signed-off-by: David Gibson --- test/system/505-networking-pasta.bats | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/system/505-networking-pasta.bats b/test/system/505-networking-pasta.bats index ad2472a4fc..b96570998b 100644 --- a/test/system/505-networking-pasta.bats +++ b/test/system/505-networking-pasta.bats @@ -129,7 +129,7 @@ function pasta_test_do() { local tests_run=${BATS_FILE_TMPDIR}/tests_run touch ${tests_run} local testid="IPv${ip_ver} $proto $iftype $bind_type range=$range delta=$delta bytes=$bytes" - if grep -q -F -- "$testid" ${tests_run}; then + if grep -q -F -x -- "$testid" ${tests_run}; then die "Duplicate test! Have already run $testid" fi echo "$testid" >>${tests_run}