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.

This commit is contained in:
Danilo Reyes
2025-11-01 23:59:34 -06:00
parent eddc0390ba
commit 3f6f8b2eff

View File

@@ -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;'")