1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2025-07-07 00:35:37 +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:
Cynthia Shang
2021-06-28 10:58:27 -04:00
committed by GitHub
parent fb2d111dcd
commit 065a8c8454
6 changed files with 162 additions and 193 deletions

View File

@ -162,12 +162,12 @@ testRun(void)
"\"status\":{"
"\"code\":99,"
"\"message\":\"[FileMissingError] unable to load info file '"
TEST_PATH_REPO "/" STORAGE_PATH_ARCHIVE "/stanza1/" INFO_ARCHIVE_FILE "' or '"
TEST_PATH_REPO "/" STORAGE_PATH_ARCHIVE "/stanza1/" INFO_ARCHIVE_FILE INFO_COPY_EXT "':\\n"
"FileMissingError: unable to open missing file '" TEST_PATH_REPO "/" STORAGE_PATH_ARCHIVE
"/stanza1/" INFO_ARCHIVE_FILE "' for read\\n"
"FileMissingError: unable to open missing file '" TEST_PATH_REPO "/" STORAGE_PATH_ARCHIVE
"/stanza1/" INFO_ARCHIVE_FILE INFO_COPY_EXT "' for read\\n"
TEST_PATH_REPO "/archive/stanza1/archive.info' or '"
TEST_PATH_REPO "/archive/stanza1/archive.info.copy':\\n"
"FileMissingError: unable to open missing file '" TEST_PATH_REPO "/archive/stanza1/archive.info'"
" for read\\n"
"FileMissingError: unable to open missing file '" TEST_PATH_REPO
"/archive/stanza1/archive.info.copy' for read\\n"
"HINT: archive.info cannot be opened but is required to push/get WAL segments.\\n"
"HINT: is archive_command configured correctly in postgresql.conf?\\n"
"HINT: has a stanza-create been performed?\\n"
@ -190,13 +190,11 @@ testRun(void)
infoRender(),
"stanza: stanza1\n"
" status: error (other)\n"
" [FileMissingError] unable to load info file '" TEST_PATH_REPO "/" STORAGE_PATH_ARCHIVE "/stanza1/"
INFO_ARCHIVE_FILE "' or '" TEST_PATH_REPO "/" STORAGE_PATH_ARCHIVE "/stanza1/" INFO_ARCHIVE_FILE
INFO_COPY_EXT "':\n"
" FileMissingError: unable to open missing file '" TEST_PATH_REPO "/" STORAGE_PATH_ARCHIVE "/stanza1/"
INFO_ARCHIVE_FILE "' for read\n"
" FileMissingError: unable to open missing file '" TEST_PATH_REPO "/" STORAGE_PATH_ARCHIVE "/stanza1/"
INFO_ARCHIVE_FILE INFO_COPY_EXT "' for read\n"
" [FileMissingError] unable to load info file '" TEST_PATH_REPO "/archive/stanza1/archive.info' or '"
TEST_PATH_REPO "/archive/stanza1/archive.info.copy':\n"
" FileMissingError: unable to open missing file '" TEST_PATH_REPO "/archive/stanza1/archive.info' for read\n"
" FileMissingError: unable to open missing file '" TEST_PATH_REPO "/archive/stanza1/archive.info.copy'"
" for read\n"
" HINT: archive.info cannot be opened but is required to push/get WAL segments.\n"
" HINT: is archive_command configured correctly in postgresql.conf?\n"
" HINT: has a stanza-create been performed?\n"
@ -2248,13 +2246,12 @@ testRun(void)
"stanza: stanza1\n"
" status: mixed\n"
" repo1: error (other)\n"
" [CryptoError] unable to load info file '" TEST_PATH_REPO "/" STORAGE_PATH_BACKUP "/stanza1/"
INFO_BACKUP_FILE "' or '" TEST_PATH_REPO "/" STORAGE_PATH_BACKUP "/stanza1/" INFO_BACKUP_FILE
INFO_COPY_EXT "':\n"
" [CryptoError] unable to load info file '" TEST_PATH_REPO "/backup/stanza1/backup.info' or '"
TEST_PATH_REPO "/backup/stanza1/backup.info.copy':\n"
" CryptoError: cipher header invalid\n"
" HINT: is or was the repo encrypted?\n"
" FileMissingError: unable to open missing file '" TEST_PATH_REPO "/" STORAGE_PATH_BACKUP "/stanza1/"
INFO_BACKUP_FILE INFO_COPY_EXT "' for read\n"
" FileMissingError: unable to open missing file '" TEST_PATH_REPO "/backup/stanza1/backup.info.copy'"
" for read\n"
" HINT: backup.info cannot be opened and is required to perform a backup.\n"
" HINT: has a stanza-create been performed?\n"
" HINT: use option --stanza if encryption settings are different for the stanza than the global"
@ -2268,13 +2265,12 @@ testRun(void)
"stanza: stanza2\n"
" status: mixed\n"
" repo1: error (other)\n"
" [CryptoError] unable to load info file '" TEST_PATH_REPO "/" STORAGE_PATH_BACKUP "/stanza2/"
INFO_BACKUP_FILE "' or '" TEST_PATH_REPO "/" STORAGE_PATH_BACKUP "/stanza2/" INFO_BACKUP_FILE
INFO_COPY_EXT "':\n"
" [CryptoError] unable to load info file '" TEST_PATH_REPO "/backup/stanza2/backup.info' or '"
TEST_PATH_REPO "/backup/stanza2/backup.info.copy':\n"
" CryptoError: cipher header invalid\n"
" HINT: is or was the repo encrypted?\n"
" FileMissingError: unable to open missing file '" TEST_PATH_REPO "/" STORAGE_PATH_BACKUP "/stanza2/"
INFO_BACKUP_FILE INFO_COPY_EXT "' for read\n"
" FileMissingError: unable to open missing file '" TEST_PATH_REPO "/backup/stanza2/backup.info.copy'"
" for read\n"
" HINT: backup.info cannot be opened and is required to perform a backup.\n"
" HINT: has a stanza-create been performed?\n"
" HINT: use option --stanza if encryption settings are different for the stanza than the global"
@ -2285,13 +2281,12 @@ testRun(void)
"stanza: stanza3\n"
" status: mixed\n"
" repo1: error (other)\n"
" [CryptoError] unable to load info file '" TEST_PATH_REPO "/" STORAGE_PATH_BACKUP "/stanza3/"
INFO_BACKUP_FILE "' or '" TEST_PATH_REPO "/" STORAGE_PATH_BACKUP "/stanza3/" INFO_BACKUP_FILE
INFO_COPY_EXT "':\n"
" [CryptoError] unable to load info file '" TEST_PATH_REPO "/backup/stanza3/backup.info' or '"
TEST_PATH_REPO "/backup/stanza3/backup.info.copy':\n"
" CryptoError: cipher header invalid\n"
" HINT: is or was the repo encrypted?\n"
" FileMissingError: unable to open missing file '" TEST_PATH_REPO "/" STORAGE_PATH_BACKUP "/stanza3/"
INFO_BACKUP_FILE INFO_COPY_EXT "' for read\n"
" FileMissingError: unable to open missing file '" TEST_PATH_REPO "/backup/stanza3/backup.info.copy'"
" for read\n"
" HINT: backup.info cannot be opened and is required to perform a backup.\n"
" HINT: has a stanza-create been performed?\n"
" HINT: use option --stanza if encryption settings are different for the stanza than the global"
@ -2322,13 +2317,12 @@ testRun(void)
"stanza: stanza3\n"
" status: mixed\n"
" repo1: error (other)\n"
" [CryptoError] unable to load info file '" TEST_PATH_REPO "/" STORAGE_PATH_BACKUP "/stanza3/"
INFO_BACKUP_FILE "' or '" TEST_PATH_REPO "/" STORAGE_PATH_BACKUP "/stanza3/" INFO_BACKUP_FILE
INFO_COPY_EXT "':\n"
" [CryptoError] unable to load info file '" TEST_PATH_REPO "/backup/stanza3/backup.info' or '"
TEST_PATH_REPO "/backup/stanza3/backup.info.copy':\n"
" CryptoError: cipher header invalid\n"
" HINT: is or was the repo encrypted?\n"
" FileMissingError: unable to open missing file '" TEST_PATH_REPO "/" STORAGE_PATH_BACKUP "/stanza3/"
INFO_BACKUP_FILE INFO_COPY_EXT "' for read\n"
" FileMissingError: unable to open missing file '" TEST_PATH_REPO "/backup/stanza3/backup.info.copy'"
" for read\n"
" HINT: backup.info cannot be opened and is required to perform a backup.\n"
" HINT: has a stanza-create been performed?\n"
" HINT: use option --stanza if encryption settings are different for the stanza than the global"
@ -2353,8 +2347,8 @@ testRun(void)
"stanza: stanza1\n"
" status: mixed\n"
" repo1: error (other)\n"
" [PathOpenError] unable to list file info for path '" TEST_PATH_REPO "/" STORAGE_PATH_ARCHIVE
"/stanza1/9.4-1': [13] Permission denied\n"
" [PathOpenError] unable to list file info for path '" TEST_PATH_REPO "/archive/stanza1/9.4-1': [13]"
" Permission denied\n"
" repo2: error (no valid backups)\n"
" cipher: mixed\n"
" repo1: none\n"