diff options
author | Michael Paquier <michael@paquier.xyz> | 2022-02-08 10:35:27 +0900 |
---|---|---|
committer | Michael Paquier <michael@paquier.xyz> | 2022-02-08 10:35:27 +0900 |
commit | ba15f16107bea8a93edc505f3013cd7df4ac90fc (patch) | |
tree | 7b6dada1818c619f04ec71ecfadfc2f2585a32e4 /src/test/perl/PostgreSQL/Test/Cluster.pm | |
parent | f1ea98a7975e15cefdb446385880a2f55224ee7d (diff) | |
download | postgresql-ba15f16107bea8a93edc505f3013cd7df4ac90fc.tar.gz postgresql-ba15f16107bea8a93edc505f3013cd7df4ac90fc.zip |
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
Diffstat (limited to 'src/test/perl/PostgreSQL/Test/Cluster.pm')
-rw-r--r-- | src/test/perl/PostgreSQL/Test/Cluster.pm | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/test/perl/PostgreSQL/Test/Cluster.pm b/src/test/perl/PostgreSQL/Test/Cluster.pm index 265f3ae6574..41beadff9dd 100644 --- a/src/test/perl/PostgreSQL/Test/Cluster.pm +++ b/src/test/perl/PostgreSQL/Test/Cluster.pm @@ -327,6 +327,31 @@ sub install_path =pod +=item $node->config_data($option) + +Return a string holding configuration data from pg_config, with $option +being the option switch used with the pg_config command. + +=cut + +sub config_data +{ + my ($self, $option) = @_; + local %ENV = $self->_get_env(); + + my ($stdout, $stderr); + my $result = + IPC::Run::run [ $self->installed_command('pg_config'), $option ], + '>', \$stdout, '2>', \$stderr + or die "could not execute pg_config"; + chomp($stdout); + $stdout =~ s/\r$//; + + return $stdout; +} + +=pod + =item $node->info() Return a string containing human-readable diagnostic information (paths, etc) |