You've already forked pgbackrest
mirror of
https://github.com/pgbackrest/pgbackrest.git
synced 2025-07-17 01:12:23 +02:00
Integration test improvements for disk and memory efficiency.
Set log-level-file=off when more that one test will run. In this case is it impossible to see the logs anyway since they will be automatically cleaned up after the test. This improves performance pretty dramatically since trace-level logging is expensive. If a singe integration test is run then log-level-file is trace by default but can be changed with the --log-level-test-file option. Reduce buffer-size to 64k to save memory during testing and allow more processes to run in parallel. Update log replacement rules so that these options can change without affecting expect logs.
This commit is contained in:
@ -21,6 +21,11 @@ use pgBackRest::Version;
|
||||
use pgBackRestTest::Common::ContainerTest;
|
||||
use pgBackRestTest::Common::ExecuteTest;
|
||||
|
||||
####################################################################################################################################
|
||||
# Expect log cache for supplemental files so they are only added to expect logs when they have changed
|
||||
####################################################################################################################################
|
||||
my $hyExpectCache = undef;
|
||||
|
||||
####################################################################################################################################
|
||||
# new
|
||||
####################################################################################################################################
|
||||
@ -148,15 +153,7 @@ sub supplementalAdd
|
||||
my $strComment = shift;
|
||||
my $strContent = shift;
|
||||
|
||||
my $strHeader = "+ supplemental file: " . $self->regExpReplaceAll($strFileName);
|
||||
|
||||
if (defined($strComment))
|
||||
{
|
||||
$self->{strLog} .= "\n" . $self->regExpReplaceAll($strComment) . "\n" . ('=' x '132') . "\n";
|
||||
}
|
||||
|
||||
$self->{strLog} .= "\n${strHeader}\n" . ('-' x length($strHeader)) . "\n";
|
||||
|
||||
# Get content if it is not defined
|
||||
if (!defined($strContent))
|
||||
{
|
||||
open(my $hFile, '<', $strFileName)
|
||||
@ -164,14 +161,27 @@ sub supplementalAdd
|
||||
|
||||
while (my $strLine = readline($hFile))
|
||||
{
|
||||
$self->{strLog} .= $self->regExpReplaceAll($strLine);
|
||||
$strContent .= $strLine;
|
||||
}
|
||||
|
||||
close($hFile);
|
||||
}
|
||||
else
|
||||
|
||||
# Only ouput when the content of this file has changed
|
||||
if (!defined($hyExpectCache->{$strFileName}) || $hyExpectCache->{$strFileName} ne $strContent)
|
||||
{
|
||||
if (defined($strContent) && length($strContent) > 0)
|
||||
# $hyExpectCache->{$strFileName} = $strContent;
|
||||
|
||||
my $strHeader = "+ supplemental file: " . $self->regExpReplaceAll($strFileName);
|
||||
|
||||
if (defined($strComment))
|
||||
{
|
||||
$self->{strLog} .= "\n" . $self->regExpReplaceAll($strComment) . "\n" . ('=' x '132') . "\n";
|
||||
}
|
||||
|
||||
$self->{strLog} .= "\n${strHeader}\n" . ('-' x length($strHeader)) . "\n";
|
||||
|
||||
if (length($strContent) > 0)
|
||||
{
|
||||
foreach my $strLine (split("\n", $strContent))
|
||||
{
|
||||
@ -439,6 +449,12 @@ sub regExpReplaceAll
|
||||
"${strTimestampRegExp} / ${strTimestampRegExp}\$", false);
|
||||
$strLine = $self->regExpReplace($strLine, 'CHECKSUM', 'checksum=[\"]{0,1}[0-f]{40}', '[0-f]{40}$', false);
|
||||
|
||||
$strLine = $self->regExpReplace($strLine, 'LOG-LEVEL-FILE', 'log-level-file=[a-z]+', '[a-z]+$', false);
|
||||
$strLine = $self->regExpReplace($strLine, 'LOG-SUBPROCESS', 'log-subprocess=[a-z]+', '[a-z]+$', false);
|
||||
$strLine = $self->regExpReplace($strLine, '', ' --log-subprocess', undef, false);
|
||||
$strLine = $self->regExpReplace($strLine, '', ' --no-log-subprocess', undef, false);
|
||||
$strLine = $self->regExpReplace($strLine, 'BUFFER-SIZE', 'buffer-size=[0-9a-z]+', '[0-9a-z]+$', false);
|
||||
|
||||
$strLine = $self->regExpReplace($strLine, 'REMOTE-PROCESS-TERMINATED-MESSAGE',
|
||||
'remote process terminated.*: (ssh.*|no output from terminated process)$',
|
||||
'(ssh.*|no output from terminated process)$', false);
|
||||
|
Reference in New Issue
Block a user