Skip to content

Commit 6aec728

Browse files
committed
fix: adding a test to see postgres version
1 parent b68c494 commit 6aec728

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

testinfra/test_ami_nix.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -507,3 +507,22 @@ def test_postgrest_ending_empty_key_query_parameter_is_removed(host):
507507
},
508508
)
509509
assert res.ok
510+
511+
512+
def test_postgresql_version(host):
513+
"""Print the PostgreSQL version being tested."""
514+
result = run_ssh_command(host['ssh'], "sudo -u postgres psql -c 'SELECT version();'")
515+
if result['succeeded']:
516+
print(f"\nPostgreSQL Version:\n{result['stdout']}")
517+
else:
518+
print(f"\nFailed to get PostgreSQL version: {result['stderr']}")
519+
520+
# Also get the version from the command line
521+
result = run_ssh_command(host['ssh'], "sudo -u postgres psql --version")
522+
if result['succeeded']:
523+
print(f"PostgreSQL Client Version: {result['stdout'].strip()}")
524+
else:
525+
print(f"Failed to get PostgreSQL client version: {result['stderr']}")
526+
527+
# This test always passes, it's just for informational purposes
528+
assert True

0 commit comments

Comments
 (0)