@@ -403,9 +403,9 @@ def is_healthy(ssh) -> bool:
403403def test_postgrest_is_running (host ):
404404 """Check if postgrest service is running using our SSH connection."""
405405 result = run_ssh_command (host ["ssh" ], "systemctl is-active postgrest" )
406- assert (
407- result [ "succeeded" ] and result [ "stdout" ]. strip () == "active "
408- ), "PostgREST service is not running"
406+ assert result [ "succeeded" ] and result [ "stdout" ]. strip () == "active" , (
407+ "PostgREST service is not running "
408+ )
409409
410410
411411def test_postgrest_responds_to_requests (host ):
@@ -547,9 +547,9 @@ def test_postgresql_version(host):
547547 if version_match :
548548 major_version = int (version_match .group (1 ))
549549 print (f"PostgreSQL major version: { major_version } " )
550- assert (
551- major_version >= 14
552- ), f"PostgreSQL version { major_version } is less than 14"
550+ assert major_version >= 14 , (
551+ f"PostgreSQL version { major_version } is less than 14"
552+ )
553553 else :
554554 assert False , "Could not parse PostgreSQL version number"
555555 else :
@@ -579,9 +579,9 @@ def test_libpq5_version(host):
579579 if version_match :
580580 major_version = int (version_match .group (1 ))
581581 print (f"libpq5 major version: { major_version } " )
582- assert (
583- major_version >= 14
584- ), f"libpq5 version { major_version } is less than 14"
582+ assert major_version >= 14 , (
583+ f"libpq5 version { major_version } is less than 14"
584+ )
585585 else :
586586 print ("Could not parse libpq5 version from dpkg output" )
587587 else :
@@ -614,9 +614,9 @@ def test_libpq5_version(host):
614614 if version_match :
615615 major_version = int (version_match .group (1 ))
616616 print (f"psql/libpq major version: { major_version } " )
617- assert (
618- major_version >= 14
619- ), f"psql/libpq version { major_version } is less than 14"
617+ assert major_version >= 14 , (
618+ f"psql/libpq version { major_version } is less than 14"
619+ )
620620 else :
621621 print ("Could not parse psql version" )
622622
@@ -706,9 +706,9 @@ def test_pam_postgresql_config(host):
706706 perms = result ["stdout" ].strip ()
707707 print (f"PAM config permissions: { perms } " )
708708 # Should be owned by postgres:postgres with 664 permissions
709- assert (
710- "postgres postgres" in perms
711- ), "PAM config not owned by postgres:postgres"
709+ assert "postgres postgres" in perms , (
710+ "PAM config not owned by postgres:postgres"
711+ )
712712 else :
713713 print ("\n PAM config file not found" )
714714 assert False , "PAM configuration file /etc/pam.d/postgresql not found"
@@ -743,7 +743,7 @@ def test_jit_pam_gatekeeper_profile(host):
743743 # Check if gatekeeper is in the postgres user's Nix profile
744744 result = run_ssh_command (
745745 host ["ssh" ],
746- "sudo -u postgres nix profile list 2>/dev/null | grep -i gatekeeper" ,
746+ "sudo -u postgres nix profile list --json | jq -r '.elements. gatekeeper.storePaths[0]' " ,
747747 )
748748 if result ["succeeded" ] and result ["stdout" ].strip ():
749749 print (f"\n Gatekeeper found in Nix profile:\n { result ['stdout' ]} " )
@@ -998,7 +998,9 @@ def test_postgrest_read_only_session_attrs(host):
998998 print (
999999 f"\n Found 'session is not read-only' errors in PostgREST logs:\n { result ['stdout' ]} "
10001000 )
1001- assert False , "PostgREST logs contain 'session is not read-only' errors even though PostgreSQL is configured for read-only mode"
1001+ assert False , (
1002+ "PostgREST logs contain 'session is not read-only' errors even though PostgreSQL is configured for read-only mode"
1003+ )
10021004 else :
10031005 print ("\n No 'session is not read-only' errors found in PostgREST logs" )
10041006
0 commit comments