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

@ -112,8 +112,7 @@ testRun(void)
// Only confirming we get passed the check for repoIsLocal || more than one pg-path configured
TEST_ERROR(
cmdCheck(), FileMissingError, "unable to open missing file '" TEST_PATH_PG "/" PG_PATH_GLOBAL "/" PG_FILE_PGCONTROL
"' for read");
cmdCheck(), FileMissingError, "unable to open missing file '" TEST_PATH_PG "/global/pg_control' for read");
//--------------------------------------------------------------------------------------------------------------------------
TEST_TITLE("backup-standby set without standby");
@ -135,9 +134,8 @@ testRun(void)
});
TEST_ERROR(
cmdCheck(), FileMissingError, "unable to open missing file '" TEST_PATH_PG "/" PG_PATH_GLOBAL "/" PG_FILE_PGCONTROL
"' for read");
TEST_RESULT_LOG("P00 WARN: option '" CFGOPT_BACKUP_STANDBY "' is enabled but standby is not properly configured");
cmdCheck(), FileMissingError, "unable to open missing file '" TEST_PATH_PG "/global/pg_control' for read");
TEST_RESULT_LOG("P00 WARN: option 'backup-standby' is enabled but standby is not properly configured");
//--------------------------------------------------------------------------------------------------------------------------
TEST_TITLE("standby and primary database - standby path doesn't match pg_control");
@ -171,7 +169,7 @@ testRun(void)
TEST_ERROR(
cmdCheck(), DbMismatchError,
"version '" PG_VERSION_92_STR "' and path '" TEST_PATH "' queried from cluster do not match version '" PG_VERSION_92_STR
"' and '" TEST_PATH_PG "' read from '" TEST_PATH_PG "/" PG_PATH_GLOBAL "/" PG_FILE_PGCONTROL "'\n"
"' and '" TEST_PATH_PG "' read from '" TEST_PATH_PG "/global/pg_control'\n"
"HINT: the pg1-path and pg1-port settings likely reference different clusters.");
//--------------------------------------------------------------------------------------------------------------------------
@ -426,7 +424,7 @@ testRun(void)
TEST_ERROR(
checkDbConfig(PG_VERSION_94, db.primaryIdx, db.primary, false), DbMismatchError,
"version '" PG_VERSION_92_STR "' and path '" TEST_PATH_PG "' queried from cluster do not match version '"
PG_VERSION_94_STR "' and '" TEST_PATH_PG "' read from '" TEST_PATH_PG "/" PG_PATH_GLOBAL "/" PG_FILE_PGCONTROL "'\n"
PG_VERSION_94_STR "' and '" TEST_PATH_PG "' read from '" TEST_PATH_PG "/global/pg_control'\n"
"HINT: the pg1-path and pg1-port settings likely reference different clusters.");
//--------------------------------------------------------------------------------------------------------------------------
@ -435,7 +433,7 @@ testRun(void)
TEST_ERROR_FMT(
checkDbConfig(PG_VERSION_92, db.standbyIdx, db.standby, true), DbMismatchError,
"version '" PG_VERSION_92_STR "' and path '%s' queried from cluster do not match version '" PG_VERSION_92_STR "' and"
" '" TEST_PATH "/pg8' read from '" TEST_PATH "/pg8/" PG_PATH_GLOBAL "/" PG_FILE_PGCONTROL "'\n"
" '" TEST_PATH "/pg8' read from '" TEST_PATH "/pg8/global/pg_control'\n"
"HINT: the pg8-path and pg8-port settings likely reference different clusters.",
strZ(dbPgDataPath(db.standby)));