Skip to content

Commit 1805954

Browse files
committed
Add tests for pg_stat_ssl system view
Reviewed-by: Kyotaro HORIGUCHI <horiguchi.kyotaro@lab.ntt.co.jp> Discussion: https://www.postgresql.org/message-id/flat/398754d8-6bb5-c5cf-e7b8-22e5f0983caf@2ndquadrant.com/
1 parent bdd6e9b commit 1805954

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

src/test/ssl/t/001_ssltests.pl

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
if ($ENV{with_openssl} eq 'yes')
1010
{
11-
plan tests => 65;
11+
plan tests => 71;
1212
}
1313
else
1414
{
@@ -309,6 +309,16 @@
309309
qr/SSL error/,
310310
"does not connect with client-side CRL");
311311

312+
# pg_stat_ssl
313+
command_like([
314+
'psql', '-X', '-A', '-F', ',', '-P', 'null=_null_',
315+
'-d', "$common_connstr sslrootcert=invalid",
316+
'-c', "SELECT * FROM pg_stat_ssl WHERE pid = pg_backend_pid()"
317+
],
318+
qr{^pid,ssl,version,cipher,bits,compression,clientdn\n
319+
^\d+,t,TLSv[\d.]+,[\w-]+,\d+,f,$}mx,
320+
'pg_stat_ssl view without client certificate');
321+
312322
### Server-side tests.
313323
###
314324
### Test certificate authorization.
@@ -331,6 +341,16 @@
331341
"user=ssltestuser sslcert=ssl/client.crt sslkey=ssl/client_tmp.key",
332342
"certificate authorization succeeds with correct client cert");
333343

344+
# pg_stat_ssl
345+
command_like([
346+
'psql', '-X', '-A', '-F', ',', '-P', 'null=_null_',
347+
'-d', "$common_connstr user=ssltestuser sslcert=ssl/client.crt sslkey=ssl/client_tmp.key",
348+
'-c', "SELECT * FROM pg_stat_ssl WHERE pid = pg_backend_pid()"
349+
],
350+
qr{^pid,ssl,version,cipher,bits,compression,clientdn\n
351+
^\d+,t,TLSv[\d.]+,[\w-]+,\d+,f,/CN=ssltestuser$}mx,
352+
'pg_stat_ssl with client certificate');
353+
334354
# client key with wrong permissions
335355
test_connect_fails(
336356
$common_connstr,

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy