Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit ba15f16

Browse files
committed
Add PostgreSQL::Test::Cluster::config_data()
This is useful to grab some configuration information from a node already set up, and I personally found two cases for it: pg_upgrade and a test to emulate check_guc. Author: Michael Paquier Discussion: https://postgr.es/m/20211129030833.GJ17618@telsasoft.com Discussion: https://postgr.es/m/YJ8xTmLQkotVLpN5@paquier.xyz
1 parent f1ea98a commit ba15f16

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

src/test/perl/PostgreSQL/Test/Cluster.pm

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -327,6 +327,31 @@ sub install_path
327327

328328
=pod
329329
330+
=item $node->config_data($option)
331+
332+
Return a string holding configuration data from pg_config, with $option
333+
being the option switch used with the pg_config command.
334+
335+
=cut
336+
337+
sub config_data
338+
{
339+
my ($self, $option) = @_;
340+
local %ENV = $self->_get_env();
341+
342+
my ($stdout, $stderr);
343+
my $result =
344+
IPC::Run::run [ $self->installed_command('pg_config'), $option ],
345+
'>', \$stdout, '2>', \$stderr
346+
or die "could not execute pg_config";
347+
chomp($stdout);
348+
$stdout =~ s/\r$//;
349+
350+
return $stdout;
351+
}
352+
353+
=pod
354+
330355
=item $node->info()
331356
332357
Return a string containing human-readable diagnostic information (paths, etc)

0 commit comments

Comments
 (0)