Fix rare failure in LDAP tests.

Instead of writing a query to psql's stdin, use -c.  This avoids a
failure where psql exits before we write, seen a few times on the build
farm.  Thanks to Tom Lane for the suggestion.

Back-patch to 11, where the LDAP tests arrived.

Reviewed-by: Noah Misch <noah@leadboat.com>
Discussion: https://postgr.es/m/CA%2BhUKGLFmW%2BHQYPeKiwSp5sdFFHtFViCpw4Mh6yAgEx74r5-Cw%40mail.gmail.com
This commit is contained in:
Thomas Munro 2020-08-03 12:39:15 +12:00
parent 63e9aa6879
commit f44b9b625b
1 changed files with 2 additions and 1 deletions

View File

@ -165,7 +165,8 @@ sub test_access
my ($node, $role, $expected_res, $test_name) = @_;
my $res =
$node->psql('postgres', 'SELECT 1', extra_params => [ '-U', $role ]);
$node->psql('postgres', undef,
extra_params => [ '-U', $role, '-c', 'SELECT 1' ]);
is($res, $expected_res, $test_name);
return;
}