This is an automated email from the git hooks/post-receive script. civodul pushed a commit to branch main in repository guix-cuirass.
The following commit(s) were added to refs/heads/main by this push: new 66e1d38 tests: Give instances of ‘guix-daemon’ and ‘cuirass register’ unique files. 66e1d38 is described below commit 66e1d38ede2e71d857fcb7c0218e15a35a71c344 Author: Ludovic Courtès <l...@gnu.org> AuthorDate: Tue Jul 16 16:53:52 2024 +0200 tests: Give instances of ‘guix-daemon’ and ‘cuirass register’ unique files. This is a followup to 331c67ab46b41fd7d19007b23fa9f0b0a06408aa. Previously, running these tests in parallel could result into mismatches, where one test would talk to the ‘cuirass register’ or ‘guix-daemon’ process of the other test. * tests/common.scm (%daemon-socket): Rename to… (%daemon-socket-stem): … this. (start-guix-daemon): Make socket name and state directory a function of the PID. * tests/http.scm (with-cuirass-register): Likewise. * tests/register.scm (start-process): Likewise. --- tests/common.scm | 13 +++++++++---- tests/http.scm | 12 ++++++++++-- tests/register.scm | 9 +++++++++ 3 files changed, 28 insertions(+), 6 deletions(-) diff --git a/tests/common.scm b/tests/common.scm index 4b6c549..a807498 100644 --- a/tests/common.scm +++ b/tests/common.scm @@ -61,23 +61,28 @@ (%package-database (pg-tmp)) (%db (db-open))) -(define %daemon-socket +(define %daemon-socket-stem (in-vicinity (or (getenv "TMPDIR") "/tmp") "cuirass-test-daemon-socket")) (define (start-guix-daemon) "Start a custom @command{guix-daemon} and define all the relevant environment variables so that Guix clients will take to it." - (setenv "GUIX_DAEMON_SOCKET" %daemon-socket) + (define socket + (string-append %daemon-socket-stem "-" + (number->string (getpid)))) + + (setenv "GUIX_DAEMON_SOCKET" socket) (setenv "GUIX_STATE_DIRECTORY" (in-vicinity (or (getenv "TMPDIR") "/tmp") - "cuirass-test-var")) + (string-append "cuirass-test-var-" + (number->string (getpid))))) (setenv "NIX_STORE" (in-vicinity (or (getenv "TMPDIR") "/tmp") "cuirass-test-store")) (spawn "guix-daemon" (list "guix-daemon" "--disable-chroot" - (string-append "--listen=" %daemon-socket)))) + (string-append "--listen=" socket)))) (define-syntax-rule (with-guix-daemon exp ...) "Evaluate @var{exp}... in a context where a test instance of diff --git a/tests/http.scm b/tests/http.scm index bcc420e..bdd2b7d 100644 --- a/tests/http.scm +++ b/tests/http.scm @@ -19,7 +19,8 @@ ;;; You should have received a copy of the GNU General Public License ;;; along with Cuirass. If not, see <http://www.gnu.org/licenses/>. -(use-modules (cuirass http) +(use-modules ((cuirass base) #:select (%bridge-socket-file-name)) + (cuirass http) (cuirass database) (cuirass gitlab) (cuirass specification) @@ -129,12 +130,19 @@ (let ((pid #f)) (dynamic-wind (lambda () + (setenv "CUIRASS_RUN_STATE_DIRECTORY" + (in-vicinity (or (getenv "TMPDIR") "/tmp") + (string-append "cuirass-test-run-" + (number->string (getpid))))) (set! pid (spawn "cuirass" (list "cuirass" "register" (string-append "--database=" (%package-database)))))) (lambda () - exp ...) + (parameterize ((%bridge-socket-file-name + (in-vicinity (getenv "CUIRASS_RUN_STATE_DIRECTORY") + "cuirass/bridge"))) + exp ...)) (lambda () (format (current-error-port) "terminating Cuirass (PID ~a)~%" pid) diff --git a/tests/register.scm b/tests/register.scm index 738a2fb..db0c73c 100644 --- a/tests/register.scm +++ b/tests/register.scm @@ -26,6 +26,15 @@ (define (start-process) (setenv "CUIRASS_LOGGING_LEVEL" "debug") + (setenv "CUIRASS_RUN_STATE_DIRECTORY" + (in-vicinity (or (getenv "TMPDIR") "/tmp") + (string-append "cuirass-test-run-" + (number->string (getpid))))) + + (%bridge-socket-file-name + (in-vicinity (getenv "CUIRASS_RUN_STATE_DIRECTORY") + "cuirass/bridge")) + (spawn "cuirass" (list "cuirass" "register" "-S" (string-append (getenv "testsrcdir")