podman icon indicating copy to clipboard operation
podman copied to clipboard

Regression: Quadlet: conflict names is nondeterministically failing

Open edsantiago opened this issue 1 year ago • 7 comments

Has something changed in the processing of $QUADLET_UNIT_DIRS?

not ok 215 |252| quadlet conflict names in 2083ms
# #/vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
# #|     FAIL: quadlet should show Notify=yes
# #| expected: =~ Notify=yes
# #|   actual: .... Notify=no

First seen today.

Reproducer:

$ while :;do hack/bats --rootless 252:conflict || break;done
...
fails on my laptop within 3-4 iterations. [EDIT: Usually. Right now, of course, on my final test, it took about 20 iterations]

[sys] |252| quadlet conflict names

  • debian-13 : sys podman debian-13 rootless host sqlite
  • fedora-40 : sys podman fedora-40 rootless host sqlite
x x x x x x
sys(2) podman(2) debian-13(1) rootless(2) host(2) sqlite(2)
fedora-40(1)

For extra credit, a patch similar to this one might be appreciated by future maintainers looking at the test failure.

diff --git a/test/system/252-quadlet.bats b/test/system/252-quadlet.bats
index 3ccf97d269..ada1198106 100644
--- a/test/system/252-quadlet.bats
+++ b/test/system/252-quadlet.bats
@@ -230,13 +230,13 @@ EOF
 
     cat > $dir1/$quadlet_file <<EOF
 [Container]
-Image=$IMAGE
+Image=quay.io/libpod/this-is-the-one:wewant
 Notify=yes
 EOF
 
     cat > $dir2/$quadlet_file <<EOF
 [Container]
-Image=$IMAGE
+Image=quay.io/libpod/bad-bad-bad:nonono
 Notify=no
 EOF
     QUADLET_UNIT_DIRS="$dir1:$dir2" run \

edsantiago avatar Sep 23 '24 20:09 edsantiago

OBTW it's not an alphanumeric-sorting issue: I tried dir1=aaa, dir2=bbb and vice-versa, and it still flakes unpredictably.

edsantiago avatar Sep 23 '24 20:09 edsantiago

@ygalblum, ideas? I didn't find the time to follow all recent Quadlet improvements.

vrothberg avatar Sep 24 '24 09:09 vrothberg

commit 133ea31ffb9e6cd9ccbbc01053463f04c11f7f18 introduced the regression. Moving from []string to map[string]struct{} broke the assumption that the entries are ordered

giuseppe avatar Sep 24 '24 09:09 giuseppe

@giuseppe is correct, thanks. I think we need to keep the order assumption because it provides predictability as to which file is processed and which is skipped. So, I'll need to rework on that change.

ygalblum avatar Sep 24 '24 10:09 ygalblum

the previous code was not deterministic for sub dirs. I think we need to sort the dir entries too

giuseppe avatar Sep 24 '24 10:09 giuseppe

Are you sure? Because, the previous code used WalkDir which states that The files are walked in lexical order, which makes the output deterministic and each new directory was appended to the end of the list.

ygalblum avatar Sep 24 '24 12:09 ygalblum

sorry you are right. WalkDir is fine

giuseppe avatar Sep 24 '24 13:09 giuseppe