You've already forked pgbackrest
mirror of
https://github.com/pgbackrest/pgbackrest.git
synced 2026-05-22 10:15:16 +02:00
Allow timezones to be explicitly set for testing.
The TZ environment variable was not reliably pushed down to the test processes. Instead pass TZ via a command line parameter and set explicitly in the test process.
This commit is contained in:
@@ -76,6 +76,7 @@ sub new
|
||||
$self->{bBackTrace},
|
||||
$self->{bProfile},
|
||||
$self->{iScale},
|
||||
$self->{strTimeZone},
|
||||
$self->{bDebug},
|
||||
$self->{bDebugTestTrace},
|
||||
$self->{iBuildMax},
|
||||
@@ -107,6 +108,7 @@ sub new
|
||||
{name => 'bBackTrace'},
|
||||
{name => 'bProfile'},
|
||||
{name => 'iScale'},
|
||||
{name => 'strTimeZone', required => false},
|
||||
{name => 'bDebug'},
|
||||
{name => 'bDebugTestTrace'},
|
||||
{name => 'iBuildMax'},
|
||||
@@ -278,6 +280,7 @@ sub run
|
||||
(defined($self->{oTest}->{&TEST_DB}) ? ' --pg-version=' . $self->{oTest}->{&TEST_DB} : '') .
|
||||
($self->{strLogLevel} ne lc(INFO) ? " --log-level=$self->{strLogLevel}" : '') .
|
||||
' --pgsql-bin=' . $self->{oTest}->{&TEST_PGSQL_BIN} .
|
||||
($self->{strTimeZone} ? " --tz='$self->{strTimeZone}'" : '') .
|
||||
($self->{bLogForce} ? ' --log-force' : '') .
|
||||
($self->{bDryRun} ? ' --dry-run' : '') .
|
||||
($self->{bDryRun} ? ' --vm-out' : '') .
|
||||
@@ -394,6 +397,16 @@ sub run
|
||||
$strTestC =~ s/\{\[C\_TEST\_REPO_PATH\]\}/$self->{strBackRestBase}/g;
|
||||
$strTestC =~ s/\{\[C\_TEST\_SCALE\]\}/$self->{iScale}/g;
|
||||
|
||||
# Set timezone
|
||||
if (defined($self->{strTimeZone}))
|
||||
{
|
||||
$strTestC =~ s/\{\[C\_TEST\_TZ\]\}/setenv\("TZ", "$self->{strTimeZone}", true\);/g;
|
||||
}
|
||||
else
|
||||
{
|
||||
$strTestC =~ s/\{\[C\_TEST\_TZ\]\}/\/\/ No timezone specified/g;
|
||||
}
|
||||
|
||||
# Set default log level
|
||||
my $strLogLevelTestC = "logLevel" . ucfirst($self->{strLogLevelTest});
|
||||
$strTestC =~ s/\{\[C\_LOG\_LEVEL\_TEST\]\}/$strLogLevelTestC/g;
|
||||
|
||||
Reference in New Issue
Block a user