From d0ba8ff58c46c15facb4dba19eab8db83835b07c Mon Sep 17 00:00:00 2001 From: David Steele Date: Tue, 10 Dec 2019 13:16:47 -0500 Subject: [PATCH] Remove test point infrastructure. 82df7e6f and 9856fef5 updated tests that used test points in preparation for the feature not being available in the C code. Since tests points are no longer used remove the infrastructure. Also remove one stray --test option in mock/all that was essentially a noop but no longer works now that the option has been removed. --- build/lib/pgBackRestBuild/Config/Data.pm | 46 -------- lib/pgBackRest/Backup/Backup.pm | 11 +- lib/pgBackRest/Common/Log.pm | 100 +---------------- lib/pgBackRest/LibCAuto.pm | 3 - lib/pgBackRest/Main.pm | 7 -- lib/pgBackRest/Protocol/Base/Master.pm | 3 - src/config/config.auto.c | 27 ----- src/config/config.auto.h | 11 +- src/config/define.auto.c | 83 -------------- src/config/define.auto.h | 3 - src/config/parse.auto.c | 26 ----- src/perl/embed.auto.c | 101 +----------------- test/expect/mock-all-001.log | 4 +- test/expect/mock-all-002.log | 2 +- test/lib/pgBackRestTest/Common/ExecuteTest.pm | 28 +---- test/lib/pgBackRestTest/Common/JobTest.pm | 2 +- .../pgBackRestTest/Env/Host/HostBackupTest.pm | 11 +- .../pgBackRestTest/Module/Mock/MockAllTest.pm | 3 +- test/src/module/config/defineTest.c | 1 - test/src/module/config/parseTest.c | 6 +- 20 files changed, 23 insertions(+), 455 deletions(-) diff --git a/build/lib/pgBackRestBuild/Config/Data.pm b/build/lib/pgBackRestBuild/Config/Data.pm index ed89279bd..561dd048d 100644 --- a/build/lib/pgBackRestBuild/Config/Data.pm +++ b/build/lib/pgBackRestBuild/Config/Data.pm @@ -169,15 +169,6 @@ use constant CFGOPT_RECURSE => 'recurse' use constant CFGOPT_SORT => 'sort'; push @EXPORT, qw(CFGOPT_SORT); -# Command-line only test options -#----------------------------------------------------------------------------------------------------------------------------------- -use constant CFGOPT_TEST => 'test'; - push @EXPORT, qw(CFGOPT_TEST); -use constant CFGOPT_TEST_DELAY => 'test-delay'; - push @EXPORT, qw(CFGOPT_TEST_DELAY); -use constant CFGOPT_TEST_POINT => 'test-point'; - push @EXPORT, qw(CFGOPT_TEST_POINT); - # General options #----------------------------------------------------------------------------------------------------------------------------------- use constant CFGOPT_ARCHIVE_TIMEOUT => 'archive-timeout'; @@ -1137,43 +1128,6 @@ my %hConfigDefine = } }, - # Command-line only test options - #------------------------------------------------------------------------------------------------------------------------------- - &CFGOPT_TEST => - { - &CFGDEF_TYPE => CFGDEF_TYPE_BOOLEAN, - &CFGDEF_INTERNAL => true, - &CFGDEF_DEFAULT => false, - &CFGDEF_COMMAND => - { - &CFGCMD_ARCHIVE_PUSH => {}, - &CFGCMD_BACKUP => {}, - } - }, - - &CFGOPT_TEST_DELAY => - { - &CFGDEF_TYPE => CFGDEF_TYPE_FLOAT, - &CFGDEF_INTERNAL => true, - &CFGDEF_DEFAULT => 5, - &CFGDEF_ALLOW_RANGE => [.1, 60], - &CFGDEF_DEPEND => - { - &CFGDEF_DEPEND_OPTION => CFGOPT_TEST, - &CFGDEF_DEPEND_LIST => [true], - }, - &CFGDEF_COMMAND => CFGOPT_TEST, - }, - - &CFGOPT_TEST_POINT => - { - &CFGDEF_TYPE => CFGDEF_TYPE_HASH, - &CFGDEF_INTERNAL => true, - &CFGDEF_REQUIRED => false, - &CFGDEF_DEPEND => CFGOPT_TEST_DELAY, - &CFGDEF_COMMAND => CFGOPT_TEST, - }, - # General options #------------------------------------------------------------------------------------------------------------------------------- &CFGOPT_ARCHIVE_TIMEOUT => diff --git a/lib/pgBackRest/Backup/Backup.pm b/lib/pgBackRest/Backup/Backup.pm index 0610e2161..10d16e64d 100644 --- a/lib/pgBackRest/Backup/Backup.pm +++ b/lib/pgBackRest/Backup/Backup.pm @@ -289,9 +289,6 @@ sub processManifest {name => 'strLsnStart', required => false}, ); - # Start backup test point - &log(TEST, TEST_BACKUP_START); - # Get the master protocol for keep-alive my $oProtocolMaster = !isDbLocal({iRemoteIdx => $self->{iMasterRemoteIdx}}) ? @@ -417,7 +414,7 @@ sub processManifest # If there are no files to backup then we'll exit with an error unless in test mode. The other way this could happen is if # the database is down and backup is called with --no-online twice in a row. - if ($lFileTotal == 0 && !cfgOption(CFGOPT_TEST)) + if ($lFileTotal == 0) { confess &log(ERROR, "no files have changed since the last backup - this seems unlikely", ERROR_FILE_MISSING); } @@ -735,7 +732,6 @@ sub process else { &log(WARN, "aborted backup ${strAbortedBackup} cannot be resumed: ${strReason}"); - &log(TEST, TEST_BACKUP_NORESUME); $oStorageRepo->pathRemove(STORAGE_REPO_BACKUP . "/${strAbortedBackup}", {bRecurse => true}); undef($oAbortedManifest); @@ -912,13 +908,10 @@ sub process $oStorageDbMaster, $strDbMasterPath, $oLastManifest, cfgOption(CFGOPT_ONLINE), cfgOption(CFGOPT_DELTA), $hTablespaceMap, $hDatabaseMap, cfgOption(CFGOPT_EXCLUDE, false), $strTimelineCurrent, $strTimelineLast)); - &log(TEST, TEST_MANIFEST_BUILD); - # If resuming from an aborted backup if (defined($oAbortedManifest)) { &log(WARN, "aborted backup ${strBackupLabel} of same type exists, will be cleaned to remove invalid files and resumed"); - &log(TEST, TEST_BACKUP_RESUME); # Clean the backup path before resuming. The delta option may have changed from false to true during the resume clean # so set it to the result. @@ -996,8 +989,6 @@ sub process } # Remotes no longer needed (destroy them here so they don't timeout) - &log(TEST, TEST_BACKUP_STOP); - undef($oDbMaster); protocolDestroy(undef, undef, true); diff --git a/lib/pgBackRest/Common/Log.pm b/lib/pgBackRest/Common/Log.pm index f8b5ddad0..ec3aaa354 100644 --- a/lib/pgBackRest/Common/Log.pm +++ b/lib/pgBackRest/Common/Log.pm @@ -90,34 +90,6 @@ my $bLogWarnOnError = 0; # Store the last logged error my $oErrorLast; -# Test globals -my $bTest = false; -my $fTestDelay; -my $oTestPoint; - -#################################################################################################################################### -# Test constants -#################################################################################################################################### -use constant TEST => 'TEST'; - push @EXPORT, qw(TEST); -use constant TEST_ENCLOSE => 'PgBaCkReStTeSt'; - push @EXPORT, qw(TEST_ENCLOSE); - -use constant TEST_MANIFEST_BUILD => 'MANIFEST-BUILD'; - push @EXPORT, qw(TEST_MANIFEST_BUILD); -use constant TEST_BACKUP_RESUME => 'BACKUP-RESUME'; - push @EXPORT, qw(TEST_BACKUP_RESUME); -use constant TEST_BACKUP_NORESUME => 'BACKUP-NORESUME'; - push @EXPORT, qw(TEST_BACKUP_NORESUME); -use constant TEST_BACKUP_START => 'BACKUP-START'; - push @EXPORT, qw(TEST_BACKUP_START); -use constant TEST_BACKUP_STOP => 'BACKUP-STOP'; - push @EXPORT, qw(TEST_BACKUP_STOP); -use constant TEST_KEEP_ALIVE => 'KEEP_ALIVE'; - push @EXPORT, qw(TEST_KEEP_ALIVE); -use constant TEST_ARCHIVE_PUSH_ASYNC_START => 'ARCHIVE-PUSH-ASYNC-START'; - push @EXPORT, qw(TEST_ARCHIVE_PUSH_ASYNC_START); - #################################################################################################################################### # logFileSet - set the file messages will be logged to #################################################################################################################################### @@ -641,19 +613,8 @@ sub log my $strMessageFormat = $strMessage; my $iLogLevelRank = $oLogLevelRank{$strLevel}{rank}; - # If test message - if ($strLevel eq TEST) - { - if (!defined($oTestPoint) || !defined($$oTestPoint{lc($strMessage)})) - { - return; - } - - $iLogLevelRank = $oLogLevelRank{TRACE}{rank} + 1; - $strMessageFormat = TEST_ENCLOSE . '-' . $strMessageFormat . '-' . TEST_ENCLOSE; - } - # Else level rank must be valid - elsif (!defined($iLogLevelRank)) + # Level rank must be valid + if (!defined($iLogLevelRank)) { confess &log(ASSERT, "log level ${strLevel} does not exist"); } @@ -691,7 +652,7 @@ sub log } # Indent TRACE and debug levels so they are distinct from normal messages - if ($strLevel eq TRACE || $strLevel eq TEST) + if ($strLevel eq TRACE) { $strMessageFormat =~ s/\n/\n /g; $strMessageFormat = ' ' . $strMessageFormat; @@ -729,9 +690,8 @@ sub log syswrite(*STDERR, "${strMessage}\n"); $rExtra->{bLogConsole} = true; } - # Else output to stdout if configured log level setting rank is greater than the display level rank or test flag is set. - elsif (!$rExtra->{bLogConsole} && $iLogDisplayLevelRank <= $oLogLevelRank{$strLogLevelConsole}{rank} || - $bTest && $strLevel eq TEST) + # Else output to stdout if configured log level setting rank is greater than the display level rank + elsif (!$rExtra->{bLogConsole} && $iLogDisplayLevelRank <= $oLogLevelRank{$strLogLevelConsole}{rank}) { if (!$bSuppressLog) { @@ -746,12 +706,6 @@ sub log # } } - # If in test mode and this is a test message then delay so the calling process has time to read the message - if ($bTest && $strLevel eq TEST && $fTestDelay > 0) - { - usleep($fTestDelay * 1000000); - } - $rExtra->{bLogConsole} = true; } @@ -817,50 +771,6 @@ sub logErrorLast push @EXPORT, qw(logErrorLast); -#################################################################################################################################### -# testSet -# -# Set test parameters. -#################################################################################################################################### -sub testSet -{ - my $bTestParam = shift; - my $fTestDelayParam = shift; - my $oTestPointParam = shift; - - # Set defaults - $bTest = defined($bTestParam) ? $bTestParam : false; - $fTestDelay = defined($bTestParam) ? $fTestDelayParam : $fTestDelay; - $oTestPoint = $oTestPointParam; - - # Make sure that a delay is specified in test mode - if ($bTest && !defined($fTestDelay)) - { - confess &log(ASSERT, 'iTestDelay must be provided when bTest is true'); - } - - # Test delay should be between 1 and 600 seconds - if (!($fTestDelay >= 0 && $fTestDelay <= 600)) - { - confess &log(ERROR, 'test-delay must be between 1 and 600 seconds'); - } -} - -push @EXPORT, qw(testSet); - -#################################################################################################################################### -# testCheck - Check for a test message -#################################################################################################################################### -sub testCheck -{ - my $strLog = shift; - my $strTest = shift; - - return index($strLog, TEST_ENCLOSE . '-' . $strTest . '-' . TEST_ENCLOSE) != -1; -} - -push @EXPORT, qw(testCheck); - #################################################################################################################################### # logLevel - get the current log levels #################################################################################################################################### diff --git a/lib/pgBackRest/LibCAuto.pm b/lib/pgBackRest/LibCAuto.pm index d67937092..6beb65be3 100644 --- a/lib/pgBackRest/LibCAuto.pm +++ b/lib/pgBackRest/LibCAuto.pm @@ -299,9 +299,6 @@ sub libcAutoExportTag 'CFGOPT_TARGET_ACTION', 'CFGOPT_TARGET_EXCLUSIVE', 'CFGOPT_TARGET_TIMELINE', - 'CFGOPT_TEST', - 'CFGOPT_TEST_DELAY', - 'CFGOPT_TEST_POINT', 'CFGOPT_TYPE', 'cfgCommandName', 'cfgOptionIndex', diff --git a/lib/pgBackRest/Main.pm b/lib/pgBackRest/Main.pm index 2cbef020e..355cdded4 100644 --- a/lib/pgBackRest/Main.pm +++ b/lib/pgBackRest/Main.pm @@ -57,13 +57,6 @@ sub main if (!$bConfigLoaded) { configLoad(undef, $strConfigBin, $strCommand, \$strConfigJson); - - # Set test options - if (cfgOptionTest(CFGOPT_TEST) && cfgOption(CFGOPT_TEST)) - { - testSet(cfgOption(CFGOPT_TEST), cfgOption(CFGOPT_TEST_DELAY), cfgOption(CFGOPT_TEST_POINT, false)); - } - $bConfigLoaded = true; } else diff --git a/lib/pgBackRest/Protocol/Base/Master.pm b/lib/pgBackRest/Protocol/Base/Master.pm index 5eefaff38..a1b2818e3 100644 --- a/lib/pgBackRest/Protocol/Base/Master.pm +++ b/lib/pgBackRest/Protocol/Base/Master.pm @@ -268,9 +268,6 @@ sub keepAlive if (gettimeofday() - $self->{fKeepAliveTimeout} > $self->{fKeepAliveTime}) { $self->noOp(); - - # Keep alive test point - &log(TEST, TEST_KEEP_ALIVE); } } diff --git a/src/config/config.auto.c b/src/config/config.auto.c index dc20d8827..73bd8c825 100644 --- a/src/config/config.auto.c +++ b/src/config/config.auto.c @@ -466,9 +466,6 @@ STRING_EXTERN(CFGOPT_TARGET_STR, CFGOPT_TARGE STRING_EXTERN(CFGOPT_TARGET_ACTION_STR, CFGOPT_TARGET_ACTION); STRING_EXTERN(CFGOPT_TARGET_EXCLUSIVE_STR, CFGOPT_TARGET_EXCLUSIVE); STRING_EXTERN(CFGOPT_TARGET_TIMELINE_STR, CFGOPT_TARGET_TIMELINE); -STRING_EXTERN(CFGOPT_TEST_STR, CFGOPT_TEST); -STRING_EXTERN(CFGOPT_TEST_DELAY_STR, CFGOPT_TEST_DELAY); -STRING_EXTERN(CFGOPT_TEST_POINT_STR, CFGOPT_TEST_POINT); STRING_EXTERN(CFGOPT_TYPE_STR, CFGOPT_TYPE); /*********************************************************************************************************************************** @@ -1788,30 +1785,6 @@ static ConfigOptionData configOptionData[CFG_OPTION_TOTAL] = CONFIG_OPTION_LIST CONFIG_OPTION_DEFINE_ID(cfgDefOptTargetTimeline) ) - //------------------------------------------------------------------------------------------------------------------------------ - CONFIG_OPTION - ( - CONFIG_OPTION_NAME(CFGOPT_TEST) - CONFIG_OPTION_INDEX(0) - CONFIG_OPTION_DEFINE_ID(cfgDefOptTest) - ) - - //------------------------------------------------------------------------------------------------------------------------------ - CONFIG_OPTION - ( - CONFIG_OPTION_NAME(CFGOPT_TEST_DELAY) - CONFIG_OPTION_INDEX(0) - CONFIG_OPTION_DEFINE_ID(cfgDefOptTestDelay) - ) - - //------------------------------------------------------------------------------------------------------------------------------ - CONFIG_OPTION - ( - CONFIG_OPTION_NAME(CFGOPT_TEST_POINT) - CONFIG_OPTION_INDEX(0) - CONFIG_OPTION_DEFINE_ID(cfgDefOptTestPoint) - ) - //------------------------------------------------------------------------------------------------------------------------------ CONFIG_OPTION ( diff --git a/src/config/config.auto.h b/src/config/config.auto.h index f23eedb58..de26b5d93 100644 --- a/src/config/config.auto.h +++ b/src/config/config.auto.h @@ -381,16 +381,10 @@ Option constants STRING_DECLARE(CFGOPT_TARGET_EXCLUSIVE_STR); #define CFGOPT_TARGET_TIMELINE "target-timeline" STRING_DECLARE(CFGOPT_TARGET_TIMELINE_STR); -#define CFGOPT_TEST "test" - STRING_DECLARE(CFGOPT_TEST_STR); -#define CFGOPT_TEST_DELAY "test-delay" - STRING_DECLARE(CFGOPT_TEST_DELAY_STR); -#define CFGOPT_TEST_POINT "test-point" - STRING_DECLARE(CFGOPT_TEST_POINT_STR); #define CFGOPT_TYPE "type" STRING_DECLARE(CFGOPT_TYPE_STR); -#define CFG_OPTION_TOTAL 168 +#define CFG_OPTION_TOTAL 165 /*********************************************************************************************************************************** Command enum @@ -588,9 +582,6 @@ typedef enum cfgOptTargetAction, cfgOptTargetExclusive, cfgOptTargetTimeline, - cfgOptTest, - cfgOptTestDelay, - cfgOptTestPoint, cfgOptType, } ConfigOption; diff --git a/src/config/define.auto.c b/src/config/define.auto.c index b9bb5e233..9592cdfc4 100644 --- a/src/config/define.auto.c +++ b/src/config/define.auto.c @@ -4636,89 +4636,6 @@ static ConfigDefineOptionData configDefineOptionData[] = CFGDEFDATA_OPTION_LIST ) ) - // ----------------------------------------------------------------------------------------------------------------------------- - CFGDEFDATA_OPTION - ( - CFGDEFDATA_OPTION_NAME("test") - CFGDEFDATA_OPTION_REQUIRED(true) - CFGDEFDATA_OPTION_SECTION(cfgDefSectionCommandLine) - CFGDEFDATA_OPTION_TYPE(cfgDefOptTypeBoolean) - CFGDEFDATA_OPTION_INTERNAL(true) - - CFGDEFDATA_OPTION_INDEX_TOTAL(1) - CFGDEFDATA_OPTION_SECURE(false) - - CFGDEFDATA_OPTION_COMMAND_LIST - ( - CFGDEFDATA_OPTION_COMMAND(cfgDefCmdArchivePush) - CFGDEFDATA_OPTION_COMMAND(cfgDefCmdBackup) - ) - - CFGDEFDATA_OPTION_OPTIONAL_LIST - ( - CFGDEFDATA_OPTION_OPTIONAL_DEFAULT("0") - ) - ) - - // ----------------------------------------------------------------------------------------------------------------------------- - CFGDEFDATA_OPTION - ( - CFGDEFDATA_OPTION_NAME("test-delay") - CFGDEFDATA_OPTION_REQUIRED(true) - CFGDEFDATA_OPTION_SECTION(cfgDefSectionCommandLine) - CFGDEFDATA_OPTION_TYPE(cfgDefOptTypeFloat) - CFGDEFDATA_OPTION_INTERNAL(true) - - CFGDEFDATA_OPTION_INDEX_TOTAL(1) - CFGDEFDATA_OPTION_SECURE(false) - - CFGDEFDATA_OPTION_COMMAND_LIST - ( - CFGDEFDATA_OPTION_COMMAND(cfgDefCmdArchivePush) - CFGDEFDATA_OPTION_COMMAND(cfgDefCmdBackup) - ) - - CFGDEFDATA_OPTION_OPTIONAL_LIST - ( - CFGDEFDATA_OPTION_OPTIONAL_ALLOW_RANGE(0.1, 60) - CFGDEFDATA_OPTION_OPTIONAL_DEPEND_LIST - ( - cfgDefOptTest, - "1" - ) - - CFGDEFDATA_OPTION_OPTIONAL_DEFAULT("5") - ) - ) - - // ----------------------------------------------------------------------------------------------------------------------------- - CFGDEFDATA_OPTION - ( - CFGDEFDATA_OPTION_NAME("test-point") - CFGDEFDATA_OPTION_REQUIRED(false) - CFGDEFDATA_OPTION_SECTION(cfgDefSectionCommandLine) - CFGDEFDATA_OPTION_TYPE(cfgDefOptTypeHash) - CFGDEFDATA_OPTION_INTERNAL(true) - - CFGDEFDATA_OPTION_INDEX_TOTAL(1) - CFGDEFDATA_OPTION_SECURE(false) - - CFGDEFDATA_OPTION_COMMAND_LIST - ( - CFGDEFDATA_OPTION_COMMAND(cfgDefCmdArchivePush) - CFGDEFDATA_OPTION_COMMAND(cfgDefCmdBackup) - ) - - CFGDEFDATA_OPTION_OPTIONAL_LIST - ( - CFGDEFDATA_OPTION_OPTIONAL_DEPEND_LIST - ( - cfgDefOptTest, - "1" - ) - ) - ) - // ----------------------------------------------------------------------------------------------------------------------------- CFGDEFDATA_OPTION ( diff --git a/src/config/define.auto.h b/src/config/define.auto.h index 168fcd414..7152c1322 100644 --- a/src/config/define.auto.h +++ b/src/config/define.auto.h @@ -146,9 +146,6 @@ typedef enum cfgDefOptTargetAction, cfgDefOptTargetExclusive, cfgDefOptTargetTimeline, - cfgDefOptTest, - cfgDefOptTestDelay, - cfgDefOptTestPoint, cfgDefOptType, } ConfigDefineOption; diff --git a/src/config/parse.auto.c b/src/config/parse.auto.c index 546c2bac1..c222fe107 100644 --- a/src/config/parse.auto.c +++ b/src/config/parse.auto.c @@ -2240,29 +2240,6 @@ static const struct option optionList[] = .val = PARSE_OPTION_FLAG | cfgOptTargetTimeline, }, - // test option - // ----------------------------------------------------------------------------------------------------------------------------- - { - .name = CFGOPT_TEST, - .val = PARSE_OPTION_FLAG | cfgOptTest, - }, - - // test-delay option - // ----------------------------------------------------------------------------------------------------------------------------- - { - .name = CFGOPT_TEST_DELAY, - .has_arg = required_argument, - .val = PARSE_OPTION_FLAG | cfgOptTestDelay, - }, - - // test-point option - // ----------------------------------------------------------------------------------------------------------------------------- - { - .name = CFGOPT_TEST_POINT, - .has_arg = required_argument, - .val = PARSE_OPTION_FLAG | cfgOptTestPoint, - }, - // type option // ----------------------------------------------------------------------------------------------------------------------------- { @@ -2425,9 +2402,6 @@ static const ConfigOption optionResolveOrder[] = cfgOptStopAuto, cfgOptTablespaceMap, cfgOptTablespaceMapAll, - cfgOptTest, - cfgOptTestDelay, - cfgOptTestPoint, cfgOptType, cfgOptArchiveCheck, cfgOptArchiveCopy, diff --git a/src/perl/embed.auto.c b/src/perl/embed.auto.c index af184f631..48722c85f 100644 --- a/src/perl/embed.auto.c +++ b/src/perl/embed.auto.c @@ -1005,8 +1005,6 @@ static const EmbeddedModule embeddedModule[] = "{name => 'strLsnStart', required => false},\n" ");\n" "\n\n" - "&log(TEST, TEST_BACKUP_START);\n" - "\n\n" "my $oProtocolMaster =\n" "!isDbLocal({iRemoteIdx => $self->{iMasterRemoteIdx}}) ?\n" "protocolGet(CFGOPTVAL_REMOTE_TYPE_DB, $self->{iMasterRemoteIdx}) : undef;\n" @@ -1114,7 +1112,7 @@ static const EmbeddedModule embeddedModule[] = "'HINT: is something wrong with the clock or filesystem timestamps?', ERROR_FILE_MISSING);\n" "}\n" "\n\n\n" - "if ($lFileTotal == 0 && !cfgOption(CFGOPT_TEST))\n" + "if ($lFileTotal == 0)\n" "{\n" "confess &log(ERROR, \"no files have changed since the last backup - this seems unlikely\", ERROR_FILE_MISSING);\n" "}\n" @@ -1387,7 +1385,6 @@ static const EmbeddedModule embeddedModule[] = "else\n" "{\n" "&log(WARN, \"aborted backup ${strAbortedBackup} cannot be resumed: ${strReason}\");\n" - "&log(TEST, TEST_BACKUP_NORESUME);\n" "\n" "$oStorageRepo->pathRemove(STORAGE_REPO_BACKUP . \"/${strAbortedBackup}\", {bRecurse => true});\n" "undef($oAbortedManifest);\n" @@ -1539,13 +1536,10 @@ static const EmbeddedModule embeddedModule[] = "cfgOptionSet(CFGOPT_DELTA, $oBackupManifest->build(\n" "$oStorageDbMaster, $strDbMasterPath, $oLastManifest, cfgOption(CFGOPT_ONLINE), cfgOption(CFGOPT_DELTA), $hTablespaceMap,\n" "$hDatabaseMap, cfgOption(CFGOPT_EXCLUDE, false), $strTimelineCurrent, $strTimelineLast));\n" - "\n" - "&log(TEST, TEST_MANIFEST_BUILD);\n" "\n\n" "if (defined($oAbortedManifest))\n" "{\n" "&log(WARN, \"aborted backup ${strBackupLabel} of same type exists, will be cleaned to remove invalid files and resumed\");\n" - "&log(TEST, TEST_BACKUP_RESUME);\n" "\n\n\n" "cfgOptionSet(CFGOPT_DELTA, $self->resumeClean($oStorageRepo, $strBackupLabel, $oBackupManifest, $oAbortedManifest,\n" "cfgOption(CFGOPT_ONLINE), cfgOption(CFGOPT_DELTA), $strTimelineCurrent, $strTimelineAborted));\n" @@ -1609,8 +1603,6 @@ static const EmbeddedModule embeddedModule[] = "}\n" "}\n" "\n\n" - "&log(TEST, TEST_BACKUP_STOP);\n" - "\n" "undef($oDbMaster);\n" "protocolDestroy(undef, undef, true);\n" "\n\n\n\n" @@ -5034,30 +5026,6 @@ static const EmbeddedModule embeddedModule[] = "my $bLogWarnOnError = 0;\n" "\n\n" "my $oErrorLast;\n" - "\n\n" - "my $bTest = false;\n" - "my $fTestDelay;\n" - "my $oTestPoint;\n" - "\n\n\n\n" - "use constant TEST => 'TEST';\n" - "push @EXPORT, qw(TEST);\n" - "use constant TEST_ENCLOSE => 'PgBaCkReStTeSt';\n" - "push @EXPORT, qw(TEST_ENCLOSE);\n" - "\n" - "use constant TEST_MANIFEST_BUILD => 'MANIFEST-BUILD';\n" - "push @EXPORT, qw(TEST_MANIFEST_BUILD);\n" - "use constant TEST_BACKUP_RESUME => 'BACKUP-RESUME';\n" - "push @EXPORT, qw(TEST_BACKUP_RESUME);\n" - "use constant TEST_BACKUP_NORESUME => 'BACKUP-NORESUME';\n" - "push @EXPORT, qw(TEST_BACKUP_NORESUME);\n" - "use constant TEST_BACKUP_START => 'BACKUP-START';\n" - "push @EXPORT, qw(TEST_BACKUP_START);\n" - "use constant TEST_BACKUP_STOP => 'BACKUP-STOP';\n" - "push @EXPORT, qw(TEST_BACKUP_STOP);\n" - "use constant TEST_KEEP_ALIVE => 'KEEP_ALIVE';\n" - "push @EXPORT, qw(TEST_KEEP_ALIVE);\n" - "use constant TEST_ARCHIVE_PUSH_ASYNC_START => 'ARCHIVE-PUSH-ASYNC-START';\n" - "push @EXPORT, qw(TEST_ARCHIVE_PUSH_ASYNC_START);\n" "\n\n\n\n" "sub logFileSet\n" "{\n" @@ -5509,18 +5477,7 @@ static const EmbeddedModule embeddedModule[] = "my $strMessageFormat = $strMessage;\n" "my $iLogLevelRank = $oLogLevelRank{$strLevel}{rank};\n" "\n\n" - "if ($strLevel eq TEST)\n" - "{\n" - "if (!defined($oTestPoint) || !defined($$oTestPoint{lc($strMessage)}))\n" - "{\n" - "return;\n" - "}\n" - "\n" - "$iLogLevelRank = $oLogLevelRank{TRACE}{rank} + 1;\n" - "$strMessageFormat = TEST_ENCLOSE . '-' . $strMessageFormat . '-' . TEST_ENCLOSE;\n" - "}\n" - "\n" - "elsif (!defined($iLogLevelRank))\n" + "if (!defined($iLogLevelRank))\n" "{\n" "confess &log(ASSERT, \"log level ${strLevel} does not exist\");\n" "}\n" @@ -5554,7 +5511,7 @@ static const EmbeddedModule embeddedModule[] = "$strMessageFormat =~ s/\\n/\\n /g\n" "}\n" "\n\n" - "if ($strLevel eq TRACE || $strLevel eq TEST)\n" + "if ($strLevel eq TRACE)\n" "{\n" "$strMessageFormat =~ s/\\n/\\n /g;\n" "$strMessageFormat = ' ' . $strMessageFormat;\n" @@ -5589,19 +5546,13 @@ static const EmbeddedModule embeddedModule[] = "$rExtra->{bLogConsole} = true;\n" "}\n" "\n" - "elsif (!$rExtra->{bLogConsole} && $iLogDisplayLevelRank <= $oLogLevelRank{$strLogLevelConsole}{rank} ||\n" - "$bTest && $strLevel eq TEST)\n" + "elsif (!$rExtra->{bLogConsole} && $iLogDisplayLevelRank <= $oLogLevelRank{$strLogLevelConsole}{rank})\n" "{\n" "if (!$bSuppressLog)\n" "{\n" "syswrite(*STDOUT, $strMessageFormat);\n" "\n\n\n\n\n\n\n\n" "}\n" - "\n\n" - "if ($bTest && $strLevel eq TEST && $fTestDelay > 0)\n" - "{\n" - "usleep($fTestDelay * 1000000);\n" - "}\n" "\n" "$rExtra->{bLogConsole} = true;\n" "}\n" @@ -5661,39 +5612,6 @@ static const EmbeddedModule embeddedModule[] = "}\n" "\n" "push @EXPORT, qw(logErrorLast);\n" - "\n\n\n\n\n\n" - "sub testSet\n" - "{\n" - "my $bTestParam = shift;\n" - "my $fTestDelayParam = shift;\n" - "my $oTestPointParam = shift;\n" - "\n\n" - "$bTest = defined($bTestParam) ? $bTestParam : false;\n" - "$fTestDelay = defined($bTestParam) ? $fTestDelayParam : $fTestDelay;\n" - "$oTestPoint = $oTestPointParam;\n" - "\n\n" - "if ($bTest && !defined($fTestDelay))\n" - "{\n" - "confess &log(ASSERT, 'iTestDelay must be provided when bTest is true');\n" - "}\n" - "\n\n" - "if (!($fTestDelay >= 0 && $fTestDelay <= 600))\n" - "{\n" - "confess &log(ERROR, 'test-delay must be between 1 and 600 seconds');\n" - "}\n" - "}\n" - "\n" - "push @EXPORT, qw(testSet);\n" - "\n\n\n\n" - "sub testCheck\n" - "{\n" - "my $strLog = shift;\n" - "my $strTest = shift;\n" - "\n" - "return index($strLog, TEST_ENCLOSE . '-' . $strTest . '-' . TEST_ENCLOSE) != -1;\n" - "}\n" - "\n" - "push @EXPORT, qw(testCheck);\n" "\n\n\n\n" "sub logLevel\n" "{\n" @@ -7789,9 +7707,6 @@ static const EmbeddedModule embeddedModule[] = "'CFGOPT_TARGET_ACTION',\n" "'CFGOPT_TARGET_EXCLUSIVE',\n" "'CFGOPT_TARGET_TIMELINE',\n" - "'CFGOPT_TEST',\n" - "'CFGOPT_TEST_DELAY',\n" - "'CFGOPT_TEST_POINT',\n" "'CFGOPT_TYPE',\n" "'cfgCommandName',\n" "'cfgOptionIndex',\n" @@ -7913,12 +7828,6 @@ static const EmbeddedModule embeddedModule[] = "if (!$bConfigLoaded)\n" "{\n" "configLoad(undef, $strConfigBin, $strCommand, \\$strConfigJson);\n" - "\n\n" - "if (cfgOptionTest(CFGOPT_TEST) && cfgOption(CFGOPT_TEST))\n" - "{\n" - "testSet(cfgOption(CFGOPT_TEST), cfgOption(CFGOPT_TEST_DELAY), cfgOption(CFGOPT_TEST_POINT, false));\n" - "}\n" - "\n" "$bConfigLoaded = true;\n" "}\n" "else\n" @@ -9579,8 +9488,6 @@ static const EmbeddedModule embeddedModule[] = "if (gettimeofday() - $self->{fKeepAliveTimeout} > $self->{fKeepAliveTime})\n" "{\n" "$self->noOp();\n" - "\n\n" - "&log(TEST, TEST_KEEP_ALIVE);\n" "}\n" "}\n" "\n\n\n\n\n\n" diff --git a/test/expect/mock-all-001.log b/test/expect/mock-all-001.log index 549cf3f5e..adc3e4a1a 100644 --- a/test/expect/mock-all-001.log +++ b/test/expect/mock-all-001.log @@ -1085,9 +1085,9 @@ P00 ERROR: [070]: tablespace symlink [TEST_PATH]/db-master/db/base/invalid_tbls P00 INFO: backup command end: aborted with exception [070] incr backup - add tablespace 1 (db-master host) -> [CONTAINER-EXEC] db-master [BACKREST-BIN] --config=[TEST_PATH]/db-master/pgbackrest.conf --no-online --test --stanza=db backup +> [CONTAINER-EXEC] db-master [BACKREST-BIN] --config=[TEST_PATH]/db-master/pgbackrest.conf --no-online --stanza=db backup ------------------------------------------------------------------------------------------------------------------------------------ -P00 INFO: backup command begin [BACKREST-VERSION]: --no-compress --compress-level=3 --config=[TEST_PATH]/db-master/pgbackrest.conf --db-timeout=45 --lock-path=[TEST_PATH]/db-master/lock --log-level-console=detail --log-level-file=trace --log-level-stderr=off --log-path=[TEST_PATH]/db-master/log --log-subprocess --no-log-timestamp --no-online --pg1-path=[TEST_PATH]/db-master/db/base --protocol-timeout=60 --repo1-path=[TEST_PATH]/db-master/repo --stanza=db --start-fast --test +P00 INFO: backup command begin [BACKREST-VERSION]: --no-compress --compress-level=3 --config=[TEST_PATH]/db-master/pgbackrest.conf --db-timeout=45 --lock-path=[TEST_PATH]/db-master/lock --log-level-console=detail --log-level-file=trace --log-level-stderr=off --log-path=[TEST_PATH]/db-master/log --log-subprocess --no-log-timestamp --no-online --pg1-path=[TEST_PATH]/db-master/db/base --protocol-timeout=60 --repo1-path=[TEST_PATH]/db-master/repo --stanza=db --start-fast P00 WARN: option repo1-retention-full is not set, the repository may run out of space HINT: to retain full backups indefinitely (without warning), set option 'repo1-retention-full' to the maximum. P00 INFO: last backup label = [BACKUP-FULL-2], version = [VERSION-1] diff --git a/test/expect/mock-all-002.log b/test/expect/mock-all-002.log index 7866cc29c..5a1dd7181 100644 --- a/test/expect/mock-all-002.log +++ b/test/expect/mock-all-002.log @@ -540,7 +540,7 @@ P00 WARN: incr backup cannot alter 'checksum-page' option to 'false', reset to P00 ERROR: [070]: tablespace symlink [TEST_PATH]/db-master/db/base/invalid_tblspc destination must not be in $PGDATA incr backup - add tablespace 1 (backup host) -> [CONTAINER-EXEC] backup [BACKREST-BIN] --config=[TEST_PATH]/backup/pgbackrest.conf --no-online --test --stanza=db backup +> [CONTAINER-EXEC] backup [BACKREST-BIN] --config=[TEST_PATH]/backup/pgbackrest.conf --no-online --stanza=db backup ------------------------------------------------------------------------------------------------------------------------------------ P00 WARN: option repo1-retention-full is not set, the repository may run out of space HINT: to retain full backups indefinitely (without warning), set option 'repo1-retention-full' to the maximum. diff --git a/test/lib/pgBackRestTest/Common/ExecuteTest.pm b/test/lib/pgBackRestTest/Common/ExecuteTest.pm index 16e65d5c0..fe00af772 100644 --- a/test/lib/pgBackRestTest/Common/ExecuteTest.pm +++ b/test/lib/pgBackRestTest/Common/ExecuteTest.pm @@ -131,13 +131,11 @@ sub endRetry my ( $strOperation, - $strTest, $bWait ) = logDebugParam ( __PACKAGE__ . '->endRetry', \@_, - {name => 'strTest', required => false, trace => true}, {name => 'bWait', required => false, default => true, trace => true} ); @@ -173,12 +171,6 @@ sub endRetry { syswrite(*STDOUT, " ${strLine}\n") } - - if (defined($strTest) && testCheck($strLine, $strTest)) - { - &log(DEBUG, "Found test ${strTest}"); - return true; - } } # Drain the stderr stream @@ -272,11 +264,6 @@ sub endRetry print "output:\n$self->{strOutLog}\n"; } - if (defined($strTest)) - { - confess &log(ASSERT, "test point ${strTest} was not found"); - } - # Return from function and log return values if any return logDebugReturn ( @@ -296,13 +283,11 @@ sub end my ( $strOperation, - $strTest, $bWait ) = logDebugParam ( __PACKAGE__ . '->end', \@_, - {name => 'strTest', required => false, trace => true}, {name => 'bWait', required => false, default => true, trace => true} ); @@ -311,7 +296,7 @@ sub end if (!defined($self->{iRetrySeconds})) { - $iExitStatus = $self->endRetry($strTest, $bWait); + $iExitStatus = $self->endRetry($bWait); } # Else loop until success or timeout else @@ -322,7 +307,7 @@ sub end { $self->{bRetry} = false; $self->begin(); - $iExitStatus = $self->endRetry($strTest, $bWait); + $iExitStatus = $self->endRetry($bWait); if ($self->{bRetry}) { @@ -334,7 +319,7 @@ sub end if ($self->{bRetry}) { $self->begin(); - $iExitStatus = $self->endRetry($strTest, $bWait); + $iExitStatus = $self->endRetry($bWait); } } @@ -353,16 +338,9 @@ sub executeTest { my $strCommand = shift; my $oParam = shift; - my $strTest = shift; my $oExec = new pgBackRestTest::Common::ExecuteTest($strCommand, $oParam); $oExec->begin(); - - if (defined($strTest)) - { - $oExec->end($strTest); - } - $oExec->end(); return $oExec->{strOutLog}; diff --git a/test/lib/pgBackRestTest/Common/JobTest.pm b/test/lib/pgBackRestTest/Common/JobTest.pm index 461612622..a6b3e1dc9 100644 --- a/test/lib/pgBackRestTest/Common/JobTest.pm +++ b/test/lib/pgBackRestTest/Common/JobTest.pm @@ -574,7 +574,7 @@ sub end my $strTestDone = $self->{oProcess}{test}; my $iTestDoneIdx = $self->{oProcess}{idx}; - my $iExitStatus = $oExecDone->end(undef, $self->{iVmMax} == 1); + my $iExitStatus = $oExecDone->end($self->{iVmMax} == 1); if (defined($iExitStatus)) { diff --git a/test/lib/pgBackRestTest/Env/Host/HostBackupTest.pm b/test/lib/pgBackRestTest/Env/Host/HostBackupTest.pm index fe0042dca..e887b129f 100644 --- a/test/lib/pgBackRestTest/Env/Host/HostBackupTest.pm +++ b/test/lib/pgBackRestTest/Env/Host/HostBackupTest.pm @@ -169,8 +169,6 @@ sub backupBegin ); # Set defaults - my $strTest = defined($$oParam{strTest}) ? $$oParam{strTest} : undef; - my $fTestDelay = defined($$oParam{fTestDelay}) ? $$oParam{fTestDelay} : .2; my $oExpectedManifest = defined($$oParam{oExpectedManifest}) ? $$oParam{oExpectedManifest} : undef; $strComment = @@ -188,19 +186,12 @@ sub backupBegin (defined($$oParam{bStandby}) && $$oParam{bStandby} ? " --backup-standby" : '') . (defined($oParam->{strRepoType}) ? " --repo1-type=$oParam->{strRepoType}" : '') . ($strType ne 'incr' ? " --type=${strType}" : '') . - ' --stanza=' . (defined($oParam->{strStanza}) ? $oParam->{strStanza} : $self->stanza()) . ' backup' . - (defined($strTest) ? " --test --test-delay=${fTestDelay} --test-point=" . lc($strTest) . '=y' : ''), + ' --stanza=' . (defined($oParam->{strStanza}) ? $oParam->{strStanza} : $self->stanza()) . ' backup', {strComment => $strComment, iExpectedExitStatus => $$oParam{iExpectedExitStatus}, oLogTest => $self->{oLogTest}, bLogOutput => $self->synthetic()}); $oExecuteBackup->begin(); - # Return at the test point if one was defined - if (defined($strTest)) - { - $oExecuteBackup->end($strTest); - } - # Return from function and log return values if any return logDebugReturn ( diff --git a/test/lib/pgBackRestTest/Module/Mock/MockAllTest.pm b/test/lib/pgBackRestTest/Module/Mock/MockAllTest.pm index ed5a1ccd5..183211f7c 100644 --- a/test/lib/pgBackRestTest/Module/Mock/MockAllTest.pm +++ b/test/lib/pgBackRestTest/Module/Mock/MockAllTest.pm @@ -863,8 +863,7 @@ sub run \%oManifest, MANIFEST_TARGET_PGTBLSPC . '/1', DB_FILE_PREFIX_TMP . '/' . DB_FILE_PREFIX_TMP . '.1', 'IGNORE'); } - my $strBackup = $oHostBackup->backup( - $strType, 'add tablespace 1', {oExpectedManifest => \%oManifest, strOptionalParam => '--test'}); + my $strBackup = $oHostBackup->backup($strType, 'add tablespace 1', {oExpectedManifest => \%oManifest}); # Resume Incr Backup #--------------------------------------------------------------------------------------------------------------------------- diff --git a/test/src/module/config/defineTest.c b/test/src/module/config/defineTest.c index 0dc333950..fc74fdcd3 100644 --- a/test/src/module/config/defineTest.c +++ b/test/src/module/config/defineTest.c @@ -88,7 +88,6 @@ testRun(void) TEST_RESULT_BOOL(cfgDefOptionInternal(cfgDefCmdRestore, cfgDefOptSet), false, "option set is not internal"); TEST_RESULT_BOOL(cfgDefOptionInternal(cfgDefCmdRestore, cfgDefOptPgHost), true, "option pg-host is internal"); - TEST_RESULT_BOOL(cfgDefOptionInternal(cfgDefCmdRestore, cfgDefOptTest), true, "option test is internal"); TEST_RESULT_BOOL(cfgDefOptionMulti(cfgDefOptRecoveryOption), true, "recovery-option is multi"); TEST_RESULT_BOOL(cfgDefOptionMulti(cfgDefOptDbInclude), true, "db-include is multi"); diff --git a/test/src/module/config/parseTest.c b/test/src/module/config/parseTest.c index d91d788dc..cc5494332 100644 --- a/test/src/module/config/parseTest.c +++ b/test/src/module/config/parseTest.c @@ -882,11 +882,11 @@ testRun(void) strLstAdd(argList, strNew(TEST_BACKREST_EXE)); strLstAdd(argList, strNew("--pg1-path=/path/to/db")); strLstAdd(argList, strNew("--stanza=db")); - strLstAdd(argList, strNew("--test-delay=1")); - strLstAdd(argList, strNew(TEST_COMMAND_BACKUP)); + strLstAdd(argList, strNew("--spool-path=/path/to/spool")); + strLstAdd(argList, strNew(TEST_COMMAND_ARCHIVE_GET)); TEST_ERROR( configParse(strLstSize(argList), strLstPtr(argList), false), OptionInvalidError, - "option 'test-delay' not valid without option 'test'"); + "option 'spool-path' not valid without option 'archive-async'"); // ------------------------------------------------------------------------------------------------------------------------- argList = strLstNew();