From patchwork Sat Aug 23 17:38:18 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Giacomo Leidi X-Patchwork-Id: 43406 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id F2C3827BC49; Sat, 23 Aug 2025 18:41:28 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-6.4 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_BLOCKED, RCVD_IN_VALIDITY_CERTIFIED,RCVD_IN_VALIDITY_RPBL,RCVD_IN_VALIDITY_SAFE, SPF_HELO_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 63B8C27BC49 for ; Sat, 23 Aug 2025 18:41:28 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1upsEi-0004QY-HV; Sat, 23 Aug 2025 13:41:05 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1upsEg-0004Q6-Uu for guix-patches@gnu.org; Sat, 23 Aug 2025 13:41:02 -0400 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1upsEg-0003D8-Lu for guix-patches@gnu.org; Sat, 23 Aug 2025 13:41:02 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:Date:From:To:In-Reply-To:References:Subject; bh=ms6L2UsS3ax8+ZOVAhc9z1eTcn30b1KAyjrfcj2qSvk=; b=jsqk0eoEAUGnEVBoqgQHgrB0y9KslstXiy/nMVkhVQgxG/73ZcO92ZxUG+e2lZCZhiHKF3gvrtoYbF2fSf64SB7hyHK86hlx+zBXyaPrqHquKBn/6C8hPFN7Z2aWm1mtwQQ/R3Li2hyU1jn+zJ7ngLyTsWOVct94+mHl64SGrgIFeylbTu+dJy+rKhpmdmlcKtevdHPdfXyqBEZykq6iHih/eU5GMYbq06s4/eZKu6N2P4uNi4abqd6EbcIZU7+4ThlW2DeJl+wx8IuxOv8NY/5Gp6U30pIeDjncgAU02AXkEafOOmT/PsR3o7FU80jY4fR4QfCtdJouLMIizmfoyw==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1upsEg-0003l8-DZ for guix-patches@gnu.org; Sat, 23 Aug 2025 13:41:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#76081] [PATCH v14 1/5] tests: oci-container: Set explicit timeouts. References: <2f43e635-508c-407a-8309-06e75d492d89@autistici.org> In-Reply-To: <2f43e635-508c-407a-8309-06e75d492d89@autistici.org> Resent-From: Giacomo Leidi Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sat, 23 Aug 2025 17:41:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 76081 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: moreinfo To: 76081@debbugs.gnu.org Cc: Giacomo Leidi Received: via spool by 76081-submit@debbugs.gnu.org id=B76081.175597083514359 (code B ref 76081); Sat, 23 Aug 2025 17:41:02 +0000 Received: (at 76081) by debbugs.gnu.org; 23 Aug 2025 17:40:35 +0000 Received: from localhost ([127.0.0.1]:41566 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1upsED-0003jM-IR for submit@debbugs.gnu.org; Sat, 23 Aug 2025 13:40:35 -0400 Received: from latitanza.investici.org ([185.218.207.228]:22209) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1upsEB-0003j4-G3 for 76081@debbugs.gnu.org; Sat, 23 Aug 2025 13:40:32 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=autistici.org; s=stigmate; t=1755970829; bh=ms6L2UsS3ax8+ZOVAhc9z1eTcn30b1KAyjrfcj2qSvk=; h=From:To:Cc:Subject:Date:From; b=Ntrl7xw9FwuOTVZg9waqkIbv4cRMpCZXdHCGIxPkj3Dw7kjExpmI62vIS/hLw8Y+R TmvswHPxOJGDDv9OhdtdTJvdiJqkG5M562q+fj5/CV6Rpj0JmsRlwNcKCeyDMQSDX2 3MzwFMmVn0iXKAUY8uIKVk0yJ6nvzyLAPcp27iug= Received: from mx3.investici.org (unknown [127.0.0.1]) by latitanza.investici.org (Postfix) with ESMTP id 4c8PTn5ptmzGpTZ; Sat, 23 Aug 2025 17:40:29 +0000 (UTC) Received: from [185.218.207.228] (mx3.investici.org [185.218.207.228]) (Authenticated sender: goodoldpaul@autistici.org) by localhost (Postfix) with ESMTPSA id 4c8PTn2hsJzGpSV; Sat, 23 Aug 2025 17:40:29 +0000 (UTC) Date: Sat, 23 Aug 2025 19:38:18 +0200 Message-ID: <07d557d2b06cd9c00ec767857da0575a0adace3e.1755970702.git.goodoldpaul@autistici.org> X-Mailer: git-send-email 2.51.0 MIME-Version: 1.0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-to: Giacomo Leidi X-ACL-Warn: , Giacomo Leidi via Guix-patches X-Patchwork-Original-From: Giacomo Leidi via Guix-patches via From: Giacomo Leidi Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches * gnu/tests/docker.scm: Simplify %test-oci-container test case and add explicit timeouts to tests outcomes. Signed-off-by: Giacomo Leidi --- gnu/tests/docker.scm | 99 ++++++++++++++++++-------------------------- 1 file changed, 41 insertions(+), 58 deletions(-) base-commit: 73f943fd9f4cc69bd0463e6c64abeb65e060e1da diff --git a/gnu/tests/docker.scm b/gnu/tests/docker.scm index 8952daab2f..9fee3905f0 100644 --- a/gnu/tests/docker.scm +++ b/gnu/tests/docker.scm @@ -1,7 +1,7 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2019 Danny Milosavljevic ;;; Copyright © 2019-2023 Ludovic Courtès -;;; Copyright © 2024 Giacomo Leidi +;;; Copyright © 2024, 2025 Giacomo Leidi ;;; ;;; This file is part of GNU Guix. ;;; @@ -414,71 +414,54 @@ (define (run-oci-container-test) (test-runner-current (system-test-runner #$output)) (test-begin "oci-container") - (test-assert "containerd service running" - (marionette-eval - '(begin - (use-modules (gnu services herd)) - (match (start-service 'containerd) - (#f #f) - (('service response-parts ...) - (match (assq-ref response-parts 'running) - ((pid) pid))))) - marionette)) - - (test-assert "containerd PID file present" - (wait-for-file "/run/containerd/containerd.pid" marionette)) - - (test-assert "dockerd running" - (marionette-eval - '(begin - (use-modules (gnu services herd)) - (match (start-service 'dockerd) - (#f #f) - (('service response-parts ...) - (match (assq-ref response-parts 'running) - ((pid) pid))))) - marionette)) - - (sleep 10) ; let service start + (wait-for-file "/run/containerd/containerd.pid" marionette) (test-assert "docker-guile running" (marionette-eval '(begin (use-modules (gnu services herd)) - (match (start-service 'docker-guile) - (#f #f) - (('service response-parts ...) - (match (assq-ref response-parts 'running) - ((pid) pid))))) + (wait-for-service 'docker-guile #:timeout 120) + #t) marionette)) - (test-equal "passing host environment variables and volumes" - '("value" "hello") - (marionette-eval - `(begin - (use-modules (ice-9 popen) - (ice-9 rdelim)) - - (define slurp - (lambda args - (let* ((port (apply open-pipe* OPEN_READ args)) - (output (let ((line (read-line port))) - (if (eof-object? line) - "" - line))) - (status (close-pipe port))) - output))) - (let* ((response1 (slurp - ,(string-append #$docker-cli "/bin/docker") - "exec" "docker-guile" - "/bin/guile" "-c" "(display (getenv \"VARIABLE\"))")) - (response2 (slurp - ,(string-append #$docker-cli "/bin/docker") - "exec" "docker-guile" - "/bin/guile" "-c" "(begin (use-modules (ice-9 popen) (ice-9 rdelim)) + (test-assert "passing host environment variables and volumes" + (begin + (define (run-test) + (marionette-eval + `(begin + (use-modules (ice-9 popen) + (ice-9 rdelim)) + + (define slurp + (lambda args + (let* ((port (apply open-pipe* OPEN_READ args)) + (output (let ((line (read-line port))) + (if (eof-object? line) + "" + line))) + (status (close-pipe port))) + output))) + (let* ((response1 (slurp + ,(string-append #$docker-cli "/bin/docker") + "exec" "docker-guile" + "/bin/guile" "-c" "(display (getenv \"VARIABLE\"))")) + (response2 (slurp + ,(string-append #$docker-cli "/bin/docker") + "exec" "docker-guile" + "/bin/guile" "-c" "(begin (use-modules (ice-9 popen) (ice-9 rdelim)) (display (call-with-input-file \"/shared.txt\" read-line)))"))) - (list response1 response2))) - marionette)) + (list response1 response2))) + marionette)) + ;; Allow services to come up on slower machines + (let loop ((attempts 0)) + (if (= attempts 60) + (error "Service didn't come up after more than 60 seconds") + (if (equal? '("value" "hello") + (run-test)) + #t + (begin + (sleep 1) + (loop (+ 1 attempts)))))))) (test-end))))