From 3f6f8b2eff13f5b74219adefdd4e670cb35264de Mon Sep 17 00:00:00 2001 From: Danilo Reyes Date: Sat, 1 Nov 2025 23:59:34 -0600 Subject: [PATCH] Enhance NixOS tests by adding a wait for PostgreSQL setup completion and verifying the existence of the 'webref' database role. This improves the reliability of database accessibility checks in the testing process. --- nixos/tests.nix | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/nixos/tests.nix b/nixos/tests.nix index 02ac384..2cb856d 100644 --- a/nixos/tests.nix +++ b/nixos/tests.nix @@ -176,6 +176,14 @@ start_all() machine.wait_for_unit("postgresql.service") + # Wait for PostgreSQL setup scripts to complete (database and user creation) + import time + machine.wait_for_unit("postgresql-setup.service", timeout=30) + time.sleep(2) # Give it a moment to finalize + + # Verify database role exists + machine.succeed("sudo -u postgres psql -c '\\du' | grep webref") + # Verify database is accessible with webref user machine.succeed("sudo -u webref psql webref -c 'SELECT 1;'")