You've already forked pgbackrest
mirror of
https://github.com/pgbackrest/pgbackrest.git
synced 2025-07-05 00:28:52 +02:00
Replace defines with string constants in unit tests.
For tests already updated as part of the macro-replacement effort, the output tests (TEST_ERROR, TEST_RESULT_LOG, TEST_STORAGE_LIST and TEST_RESULT_STR) have been simplified for readability to remove all but the TEST_PATH constants. The ongoing macro-replacement effort will include these changes. Updated: expireTest, stanzaTest, checkTest, infoTest, verifyTest (infoArchive and infoBackup had no changes).
This commit is contained in:
@ -254,9 +254,9 @@ testRun(void)
|
||||
TEST_RESULT_PTR(manifest, NULL, "manifest not set - pg version mismatch");
|
||||
TEST_RESULT_UINT(backupResult.status, backupInvalid, "manifest unusable - backup invalid");
|
||||
TEST_RESULT_LOG(
|
||||
"P00 WARN: unable to open missing file '" TEST_PATH_REPO "/" STORAGE_PATH_BACKUP "/db/" TEST_BACKUP_LABEL_FULL "/"
|
||||
BACKUP_MANIFEST_FILE INFO_COPY_EXT "' for read\n"
|
||||
"P00 ERROR: [028]: '" TEST_BACKUP_LABEL_FULL "' may not be recoverable - PG data (id 1, version 9.2, system-id "
|
||||
"P00 WARN: unable to open missing file '" TEST_PATH_REPO "/backup/db/20181119-152138F/backup.manifest.copy'"
|
||||
" for read\n"
|
||||
"P00 ERROR: [028]: '20181119-152138F' may not be recoverable - PG data (id 1, version 9.2, system-id "
|
||||
"6625592122879095702) is not in the backup.info history, skipping");
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
@ -289,10 +289,9 @@ testRun(void)
|
||||
TEST_RESULT_PTR(manifest, NULL, "manifest not set - pg system-id mismatch");
|
||||
TEST_RESULT_UINT(backupResult.status, backupInvalid, "manifest unusable - backup invalid");
|
||||
TEST_RESULT_LOG(
|
||||
"P00 WARN: unable to open missing file '" TEST_PATH_REPO "/" STORAGE_PATH_BACKUP "/db/" TEST_BACKUP_LABEL_FULL "/"
|
||||
BACKUP_MANIFEST_FILE "' for read\n"
|
||||
"P00 WARN: " TEST_BACKUP_LABEL_FULL "/backup.manifest is missing or unusable, using copy\n"
|
||||
"P00 ERROR: [028]: '" TEST_BACKUP_LABEL_FULL "' may not be recoverable - PG data (id 1, version 9.4, system-id 0) is "
|
||||
"P00 WARN: unable to open missing file '" TEST_PATH_REPO "/backup/db/20181119-152138F/backup.manifest' for read\n"
|
||||
"P00 WARN: 20181119-152138F/backup.manifest is missing or unusable, using copy\n"
|
||||
"P00 ERROR: [028]: '20181119-152138F' may not be recoverable - PG data (id 1, version 9.4, system-id 0) is "
|
||||
"not in the backup.info history, skipping");
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
@ -324,10 +323,9 @@ testRun(void)
|
||||
TEST_RESULT_PTR(manifest, NULL, "manifest not set - pg db-id mismatch");
|
||||
TEST_RESULT_UINT(backupResult.status, backupInvalid, "manifest unusable - backup invalid");
|
||||
TEST_RESULT_LOG(
|
||||
"P00 WARN: unable to open missing file '" TEST_PATH_REPO "/" STORAGE_PATH_BACKUP "/db/" TEST_BACKUP_LABEL_FULL "/"
|
||||
BACKUP_MANIFEST_FILE "' for read\n"
|
||||
"P00 WARN: " TEST_BACKUP_LABEL_FULL "/backup.manifest is missing or unusable, using copy\n"
|
||||
"P00 ERROR: [028]: '" TEST_BACKUP_LABEL_FULL "' may not be recoverable - PG data (id 0, version 9.4, system-id "
|
||||
"P00 WARN: unable to open missing file '" TEST_PATH_REPO "/backup/db/20181119-152138F/backup.manifest' for read\n"
|
||||
"P00 WARN: 20181119-152138F/backup.manifest is missing or unusable, using copy\n"
|
||||
"P00 ERROR: [028]: '20181119-152138F' may not be recoverable - PG data (id 0, version 9.4, system-id "
|
||||
"6625592122879095702) is not in the backup.info history, skipping");
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
@ -342,10 +340,9 @@ testRun(void)
|
||||
TEST_ASSIGN(manifest, verifyManifestFile(&backupResult, NULL, false, infoPg, &jobErrorTotal), "verify manifest");
|
||||
TEST_RESULT_UINT(backupResult.status, backupInvalid, "manifest unusable - backup invalid");
|
||||
TEST_RESULT_LOG(
|
||||
"P00 WARN: unable to open missing file '" TEST_PATH_REPO "/" STORAGE_PATH_BACKUP "/db/" TEST_BACKUP_LABEL_FULL "/"
|
||||
BACKUP_MANIFEST_FILE "' for read\n"
|
||||
"P00 WARN: unable to open missing file '" TEST_PATH_REPO "/backup/db/20181119-152138F/backup.manifest' for read\n"
|
||||
"P00 WARN: invalid checksum, actual 'e056f784a995841fd4e2802b809299b8db6803a2' but expected 'BOGUS' "
|
||||
STORAGE_REPO_BACKUP "/" TEST_BACKUP_LABEL_FULL "/" BACKUP_MANIFEST_FILE INFO_COPY_EXT);
|
||||
"<REPO:BACKUP>/20181119-152138F/backup.manifest.copy");
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
TEST_TITLE("current backup true");
|
||||
@ -359,9 +356,9 @@ testRun(void)
|
||||
TEST_RESULT_UINT(backupResult.status, backupInvalid, "manifest unusable - backup invalid");
|
||||
TEST_RESULT_LOG(
|
||||
"P00 WARN: invalid checksum, actual 'e056f784a995841fd4e2802b809299b8db6803a2' but expected 'BOGUS' "
|
||||
STORAGE_REPO_BACKUP "/" TEST_BACKUP_LABEL_FULL "/" BACKUP_MANIFEST_FILE "\n"
|
||||
"<REPO:BACKUP>/20181119-152138F/backup.manifest\n"
|
||||
"P00 WARN: invalid checksum, actual 'e056f784a995841fd4e2802b809299b8db6803a2' but expected 'BOGUS' "
|
||||
STORAGE_REPO_BACKUP "/" TEST_BACKUP_LABEL_FULL "/" BACKUP_MANIFEST_FILE INFO_COPY_EXT);
|
||||
"<REPO:BACKUP>/20181119-152138F/backup.manifest.copy");
|
||||
|
||||
// Write a valid manifest with a manifest copy that is invalid
|
||||
HRN_INFO_PUT(
|
||||
@ -383,7 +380,7 @@ testRun(void)
|
||||
TEST_ASSIGN(manifest, verifyManifestFile(&backupResult, NULL, true, infoPg, &jobErrorTotal), "verify manifest");
|
||||
TEST_RESULT_PTR_NE(manifest, NULL, "manifest set");
|
||||
TEST_RESULT_UINT(backupResult.status, backupValid, "manifest usable");
|
||||
TEST_RESULT_LOG("P00 WARN: backup '" TEST_BACKUP_LABEL_FULL "' manifest.copy does not match manifest");
|
||||
TEST_RESULT_LOG("P00 WARN: backup '20181119-152138F' manifest.copy does not match manifest");
|
||||
}
|
||||
|
||||
// *****************************************************************************************************************************
|
||||
@ -760,13 +757,10 @@ testRun(void)
|
||||
TEST_RESULT_LOG(
|
||||
"P00 WARN: invalid checksum, actual 'e056f784a995841fd4e2802b809299b8db6803a2' but expected 'BOGUS' "
|
||||
"<REPO:BACKUP>/backup.info\n"
|
||||
"P00 WARN: unable to open missing file '" TEST_PATH_REPO "/" STORAGE_PATH_BACKUP "/db/" INFO_BACKUP_FILE INFO_COPY_EXT
|
||||
"' for read\n"
|
||||
"P00 WARN: unable to open missing file '" TEST_PATH_REPO "/backup/db/backup.info.copy' for read\n"
|
||||
"P00 ERROR: [029]: No usable backup.info file\n"
|
||||
"P00 WARN: unable to open missing file '" TEST_PATH_REPO "/" STORAGE_PATH_ARCHIVE "/db/" INFO_ARCHIVE_FILE
|
||||
"' for read\n"
|
||||
"P00 WARN: unable to open missing file '" TEST_PATH_REPO "/" STORAGE_PATH_ARCHIVE "/db/" INFO_ARCHIVE_FILE
|
||||
INFO_COPY_EXT "' for read\n"
|
||||
"P00 WARN: unable to open missing file '" TEST_PATH_REPO "/archive/db/archive.info' for read\n"
|
||||
"P00 WARN: unable to open missing file '" TEST_PATH_REPO "/archive/db/archive.info.copy' for read\n"
|
||||
"P00 ERROR: [029]: No usable archive.info file");
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
@ -790,8 +784,7 @@ testRun(void)
|
||||
TEST_RESULT_LOG(
|
||||
"P00 WARN: invalid checksum, actual 'e056f784a995841fd4e2802b809299b8db6803a2' but expected 'BOGUS'"
|
||||
" <REPO:BACKUP>/backup.info\n"
|
||||
"P00 WARN: unable to open missing file '" TEST_PATH_REPO "/" STORAGE_PATH_ARCHIVE "/db/" INFO_ARCHIVE_FILE
|
||||
"' for read\n"
|
||||
"P00 WARN: unable to open missing file '" TEST_PATH_REPO "/archive/db/archive.info' for read\n"
|
||||
"P00 WARN: invalid checksum, actual 'e056f784a995841fd4e2802b809299b8db6803a2' but expected 'BOGUS'"
|
||||
" <REPO:ARCHIVE>/archive.info.copy\n"
|
||||
"P00 ERROR: [029]: No usable archive.info file");
|
||||
@ -835,10 +828,8 @@ testRun(void)
|
||||
HRN_STORAGE_REMOVE(storageRepoWrite(), INFO_ARCHIVE_PATH_FILE INFO_COPY_EXT, .comment = "remove archive.info.copy");
|
||||
TEST_RESULT_VOID(cmdVerify(), "usable backup and archive info files");
|
||||
TEST_RESULT_LOG(
|
||||
"P00 WARN: unable to open missing file '" TEST_PATH_REPO "/" STORAGE_PATH_BACKUP "/db/" INFO_BACKUP_FILE
|
||||
INFO_COPY_EXT "' for read\n"
|
||||
"P00 WARN: unable to open missing file '" TEST_PATH_REPO "/" STORAGE_PATH_ARCHIVE "/db/" INFO_ARCHIVE_FILE
|
||||
INFO_COPY_EXT "' for read\n"
|
||||
"P00 WARN: unable to open missing file '" TEST_PATH_REPO "/backup/db/backup.info.copy' for read\n"
|
||||
"P00 WARN: unable to open missing file '" TEST_PATH_REPO "/archive/db/archive.info.copy' for read\n"
|
||||
"P00 WARN: no archives or backups exist in the repo");
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
@ -850,10 +841,8 @@ testRun(void)
|
||||
.comment = "valid and matching archive.info.copy");
|
||||
TEST_ERROR(cmdVerify(), RuntimeError, "1 fatal errors encountered, see log for details");
|
||||
TEST_RESULT_LOG(
|
||||
"P00 WARN: unable to open missing file '" TEST_PATH_REPO "/" STORAGE_PATH_BACKUP "/db/" INFO_BACKUP_FILE
|
||||
"' for read\n"
|
||||
"P00 WARN: unable to open missing file '" TEST_PATH_REPO "/" STORAGE_PATH_BACKUP "/db/" INFO_BACKUP_FILE
|
||||
INFO_COPY_EXT "' for read\n"
|
||||
"P00 WARN: unable to open missing file '" TEST_PATH_REPO "/backup/db/backup.info' for read\n"
|
||||
"P00 WARN: unable to open missing file '" TEST_PATH_REPO "/backup/db/backup.info.copy' for read\n"
|
||||
"P00 ERROR: [029]: No usable backup.info file");
|
||||
}
|
||||
|
||||
@ -1182,25 +1171,23 @@ testRun(void)
|
||||
"'11-2/0000000200000007/000000020000000700000FFF-ee161f898c9012dd0c28b3fd1e7140b9cf411306'\n"
|
||||
"P01 ERROR: [039]: invalid result "
|
||||
"11-2/0000000200000008/000000020000000800000003-656817043007aa2100c44c712bcb456db705dab9: [41] raised from "
|
||||
"local-1 shim protocol: unable to open file '" TEST_PATH_REPO "/" STORAGE_PATH_ARCHIVE "/db/"
|
||||
"local-1 shim protocol: unable to open file '" TEST_PATH_REPO "/archive/db/"
|
||||
"11-2/0000000200000008/000000020000000800000003-656817043007aa2100c44c712bcb456db705dab9' for read:"
|
||||
" [13] Permission denied\n"
|
||||
"P00 WARN: unable to open missing file '" TEST_PATH_REPO "/" STORAGE_PATH_BACKUP "/db/20181119-152800F/"
|
||||
BACKUP_MANIFEST_FILE "' for read\n"
|
||||
"P00 WARN: unable to open missing file '" TEST_PATH_REPO "/" STORAGE_PATH_BACKUP "/db/20181119-152800F/"
|
||||
BACKUP_MANIFEST_FILE INFO_COPY_EXT "' for read\n"
|
||||
"P00 WARN: unable to open missing file '" TEST_PATH_REPO "/backup/db/20181119-152800F/backup.manifest' for read\n"
|
||||
"P00 WARN: unable to open missing file '" TEST_PATH_REPO "/backup/db/20181119-152800F/backup.manifest.copy'"
|
||||
" for read\n"
|
||||
"P00 WARN: manifest missing for '20181119-152800F' - backup may have expired\n"
|
||||
"P00 WARN: unable to open missing file '" TEST_PATH_REPO "/" STORAGE_PATH_BACKUP "/db/20181119-152810F/"
|
||||
BACKUP_MANIFEST_FILE INFO_COPY_EXT "' for read\n"
|
||||
"P00 WARN: unable to open missing file '" TEST_PATH_REPO "/backup/db/20181119-152810F/backup.manifest.copy'"
|
||||
" for read\n"
|
||||
"P00 ERROR: [028]: backup '20181119-152810F' manifest does not contain any target files to verify\n"
|
||||
"P01 ERROR: [028]: invalid checksum '20181119-152900F/pg_data/PG_VERSION'\n"
|
||||
"P01 ERROR: [028]: file missing '20181119-152900F_20181119-152909D/pg_data/testmissing'\n"
|
||||
"P00 WARN: unable to open missing file '" TEST_PATH_REPO "/" STORAGE_PATH_BACKUP "/db/20181119-153000F/"
|
||||
BACKUP_MANIFEST_FILE "' for read\n"
|
||||
"P00 WARN: unable to open missing file '" TEST_PATH_REPO "/backup/db/20181119-153000F/backup.manifest' for read\n"
|
||||
"P00 INFO: backup '20181119-153000F' appears to be in progress, skipping\n"
|
||||
"P01 ERROR: [039]: invalid result UNPROCESSEDBACKUP/pg_data/testother: [41] raised from local-1 shim protocol:"
|
||||
" unable to open file '" TEST_PATH_REPO "/" STORAGE_PATH_BACKUP "/db/UNPROCESSEDBACKUP/pg_data/testother'"
|
||||
" for read: [13] Permission denied\n"
|
||||
" unable to open file '" TEST_PATH_REPO "/backup/db/UNPROCESSEDBACKUP/pg_data/testother' for read: [13]"
|
||||
" Permission denied\n"
|
||||
"P00 DETAIL: archiveId: 11-2, wal start: 000000020000000700000FFD, wal stop: 000000020000000800000000\n"
|
||||
"P00 DETAIL: archiveId: 11-2, wal start: 000000020000000800000002, wal stop: 000000020000000800000003\n"
|
||||
"P00 DETAIL: archiveId: 11-2, wal start: 000000030000000000000000, wal stop: 000000030000000000000001\n"
|
||||
|
Reference in New Issue
Block a user