Skip to content

Commit 0bd772e

Browse files
committed
fix: testing for failure related to libpq5 version issue
1 parent 6aec728 commit 0bd772e

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

testinfra/test_ami_nix.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -526,3 +526,25 @@ def test_postgresql_version(host):
526526

527527
# This test always passes, it's just for informational purposes
528528
assert True
529+
530+
531+
def test_postgrest_logs_no_target_session_attrs_error(host):
532+
"""Check that PostgREST logs don't contain the target_session_attrs error."""
533+
# Check recent PostgREST logs for the specific error
534+
result = run_ssh_command(host['ssh'], "sudo journalctl -u postgrest --since '1 hour ago' | grep -i 'target_session_attrs' || true")
535+
536+
if result['stdout'].strip():
537+
print(f"\nFound target_session_attrs errors in PostgREST logs:\n{result['stdout']}")
538+
assert False, "PostgREST logs contain target_session_attrs errors"
539+
else:
540+
print("\nNo target_session_attrs errors found in PostgREST logs")
541+
542+
# Also check for the specific error pattern mentioned
543+
result = run_ssh_command(host['ssh'], "sudo journalctl -u postgrest --since '1 hour ago' | grep -i 'invalid target_session_attrs value.*read-only' || true")
544+
545+
if result['stdout'].strip():
546+
print(f"\nFound specific target_session_attrs read-only error:\n{result['stdout']}")
547+
assert False, "PostgREST logs contain invalid target_session_attrs read-only error"
548+
else:
549+
print("No invalid target_session_attrs read-only errors found in PostgREST logs")
550+

0 commit comments

Comments
 (0)