@@ -427,9 +427,9 @@ def is_healthy(ssh) -> bool:
427427def test_postgrest_is_running (host ):
428428 """Check if postgrest service is running using our SSH connection."""
429429 result = run_ssh_command (host ["ssh" ], "systemctl is-active postgrest" )
430- assert (
431- result [ "succeeded" ] and result [ "stdout" ]. strip () == "active "
432- ), "PostgREST service is not running"
430+ assert result [ "succeeded" ] and result [ "stdout" ]. strip () == "active" , (
431+ "PostgREST service is not running "
432+ )
433433
434434
435435def test_postgrest_responds_to_requests (host ):
@@ -552,9 +552,9 @@ def test_postgresql_version(host):
552552 if version_match :
553553 major_version = int (version_match .group (1 ))
554554 print (f"PostgreSQL major version: { major_version } " )
555- assert (
556- major_version >= 14
557- ), f"PostgreSQL version { major_version } is less than 14"
555+ assert major_version >= 14 , (
556+ f"PostgreSQL version { major_version } is less than 14"
557+ )
558558 else :
559559 assert False , "Could not parse PostgreSQL version number"
560560 else :
@@ -584,9 +584,9 @@ def test_libpq5_version(host):
584584 if version_match :
585585 major_version = int (version_match .group (1 ))
586586 print (f"libpq5 major version: { major_version } " )
587- assert (
588- major_version >= 14
589- ), f"libpq5 version { major_version } is less than 14"
587+ assert major_version >= 14 , (
588+ f"libpq5 version { major_version } is less than 14"
589+ )
590590 else :
591591 print ("Could not parse libpq5 version from dpkg output" )
592592 else :
@@ -619,9 +619,9 @@ def test_libpq5_version(host):
619619 if version_match :
620620 major_version = int (version_match .group (1 ))
621621 print (f"psql/libpq major version: { major_version } " )
622- assert (
623- major_version >= 14
624- ), f"psql/libpq version { major_version } is less than 14"
622+ assert major_version >= 14 , (
623+ f"psql/libpq version { major_version } is less than 14"
624+ )
625625 else :
626626 print ("Could not parse psql version" )
627627
@@ -711,9 +711,9 @@ def test_pam_postgresql_config(host):
711711 perms = result ["stdout" ].strip ()
712712 print (f"PAM config permissions: { perms } " )
713713 # Should be owned by postgres:postgres with 664 permissions
714- assert (
715- "postgres postgres" in perms
716- ), "PAM config not owned by postgres:postgres"
714+ assert "postgres postgres" in perms , (
715+ "PAM config not owned by postgres:postgres"
716+ )
717717 else :
718718 print ("\n PAM config file not found" )
719719 assert False , "PAM configuration file /etc/pam.d/postgresql not found"
@@ -748,7 +748,7 @@ def test_jit_pam_gatekeeper_profile(host):
748748 # Check if gatekeeper is in the postgres user's Nix profile
749749 result = run_ssh_command (
750750 host ["ssh" ],
751- "sudo -u postgres nix profile list 2>/dev/null | grep -i gatekeeper" ,
751+ "sudo -u postgres nix profile list --json | jq -r '.elements. gatekeeper.storePaths[0]' " ,
752752 )
753753 if result ["succeeded" ] and result ["stdout" ].strip ():
754754 print (f"\n Gatekeeper found in Nix profile:\n { result ['stdout' ]} " )
@@ -1003,7 +1003,9 @@ def test_postgrest_read_only_session_attrs(host):
10031003 print (
10041004 f"\n Found 'session is not read-only' errors in PostgREST logs:\n { result ['stdout' ]} "
10051005 )
1006- assert False , "PostgREST logs contain 'session is not read-only' errors even though PostgreSQL is configured for read-only mode"
1006+ assert False , (
1007+ "PostgREST logs contain 'session is not read-only' errors even though PostgreSQL is configured for read-only mode"
1008+ )
10071009 else :
10081010 print ("\n No 'session is not read-only' errors found in PostgREST logs" )
10091011
0 commit comments