guix_mirror_bot pushed a commit to branch master
in repository guix.
commit 026a414612198ef51582c9b43e198071d1a4b918
Author: Giacomo Leidi <[email protected]>
AuthorDate: Thu Nov 12 22:18:29 2026 +0100
tests: Make oci-service-type tests deterministic.
Commit 60f4d72590a introduced a non deterministic version of
oci-object-service-available?. So oci-object-service-available?
returned, for a single requested name, the tail of the object list
starting at that name:
e.g. ("localhost/guile:latest" "localhost/guile-bash:latest")
instead of ("localhost/guile:latest") - whose contents depend on
podman image ls ordering, and #f when the name was absent.
At 60f4d72590a both podman test containers used the same guile image,
so podman image ls contained a single entry and the list returned by
every contained just that name and the test's
'("localhost/guile:latest") expectation happened to match.
Commit cbbf6b1d570 changed the "second" container's image from guile to
a distinct guile-bash image. Now the environment has two images, the
tail sublist contains extra entries depending on image ls order, which
made the non determinism appear with flaky tests.
This patch replaces every with filter to always have a deterministic
output.
* gnu/build/oci-containers.scm (oci-object-service-available?): Replace
every with filter and return a list of names instead of a boolean.
* gnu/tests/containers.scm (run-rootless-podman-oci-service-test):
Adjust expected values.
Change-Id: Iea2c0b3ed7e4830855d9732ebf0959d1ac956e63
---
gnu/build/oci-containers.scm | 12 +++++++-----
gnu/tests/containers.scm | 4 ++--
2 files changed, 9 insertions(+), 7 deletions(-)
diff --git a/gnu/build/oci-containers.scm b/gnu/build/oci-containers.scm
index bb7d5426711..c4facf1e873 100644
--- a/gnu/build/oci-containers.scm
+++ b/gnu/build/oci-containers.scm
@@ -154,7 +154,8 @@ Current directory: ~a~%"
#:key verbose?
(format-string "{{.Name}}")
(log-port (current-error-port)))
- "Whether NAMES are provisioned in the current OBJECT environment."
+ "Return the subset of NAMES that are provisioned in the current OBJECT
+environment."
(define environment
(oci-object-list runtime-cli object
#:verbose? verbose?
@@ -162,16 +163,17 @@ Current directory: ~a~%"
(when verbose?
(oci-log-debug log-port "~a environment:~{ ~a~}~%" object environment))
- (define available?
- (every
+ (define available-names
+ (filter
(lambda (name)
(oci-object-member name environment #:verbose? verbose?))
names))
(when verbose?
- (oci-log-debug log-port "~a service is~a available~%" object (if available?
"" " not")))
+ (oci-log-debug log-port "~a service is~a available~%"
+ object (if (null? available-names) " not" "")))
- available?)
+ available-names)
(define* (oci-image-load runtime runtime-cli tarball name tag
#:key verbose?
diff --git a/gnu/tests/containers.scm b/gnu/tests/containers.scm
index 0850ffd5d6e..d93d93e837c 100644
--- a/gnu/tests/containers.scm
+++ b/gnu/tests/containers.scm
@@ -670,7 +670,7 @@ in the past.")
#:verbose? #t))))
marionette)))
;; Allow services to come up on slower machines.
- (with-retries 80 1 (equal? '("my-network" "podman")
(run-test)))))
+ (with-retries 80 1 (equal? '("my-network") (run-test)))))
(test-assert "image loaded"
(begin
@@ -920,7 +920,7 @@ in the past.")
marionette)))
;; Allow services to come up on slower machines.
(with-retries 80 1 (equal?
- '("my-network" "none")
+ '("my-network")
(run-test)))))
(test-assert "passing host environment variables"