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:
@@ -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;'")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user