1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2025-03-03 14:52:21 +02:00

Fix extraneous hrnReplaceKey() calls in unit tests.

hrnReplaceKey() was added to the TEST_ERROR*() macros in 58760486 but some calls to TEST_ERROR*() already used it. This led to the function being called twice on the same buffer which had no effect but valgrind definitely did not like.

Remove extraneous calls to make valgrind happy. Since this is test code there are no implications for production.
This commit is contained in:
David Steele 2021-04-02 15:35:41 -04:00
parent 1615cb0261
commit a6a544c7f9
4 changed files with 6 additions and 7 deletions

View File

@ -209,9 +209,8 @@ testRun(void)
THROW_ON_SYS_ERROR(chdir("/") != 0, PathMissingError, "unable to chdir()");
TEST_ERROR(
walPath(strNew("relative/path"), pgPathLink, strNew("test")), OptionInvalidValueError,
hrnReplaceKey(
"PostgreSQL working directory '/' is not the same as option pg1-path '{[path]}/pg-link'\n"
"HINT: is the PostgreSQL data_directory configured the same as the pg1-path option?"));
"PostgreSQL working directory '/' is not the same as option pg1-path '{[path]}/pg-link'\n"
"HINT: is the PostgreSQL data_directory configured the same as the pg1-path option?");
TEST_ERROR(
walPath(strNew("relative/path"), NULL, strNew("test")), OptionRequiredError,

View File

@ -1122,7 +1122,7 @@ testRun(void)
TEST_ERROR(
manifestNewBuild(storagePg, PG_VERSION_94, pgCatalogTestVersion(PG_VERSION_94), false, false, NULL, NULL),
LinkDestinationError, hrnReplaceKey("link 'link' destination '{[path]}/pg/base' is in PGDATA"));
LinkDestinationError, "link 'link' destination '{[path]}/pg/base' is in PGDATA");
THROW_ON_SYS_ERROR(
unlink(strZ(strNewFmt("%s/pg/link", testPath()))) == -1, FileRemoveError, "unable to remove symlink");
@ -1158,7 +1158,7 @@ testRun(void)
TEST_ERROR(
manifestNewBuild(storagePg, PG_VERSION_94, pgCatalogTestVersion(PG_VERSION_94), false, true, NULL, NULL), FileOpenError,
hrnReplaceKey("unable to get info for missing path/file '{[path]}/pg/link-to-link': [2] No such file or directory"));
"unable to get info for missing path/file '{[path]}/pg/link-to-link': [2] No such file or directory");
THROW_ON_SYS_ERROR(
unlink(strZ(strNewFmt("%s/pg/link-to-link", testPath()))) == -1, FileRemoveError, "unable to remove symlink");

View File

@ -200,7 +200,7 @@ testRun(void)
TEST_ERROR(
storageInfoP(storageTest, STRDEF("/etc"), .ignoreMissing = true), AssertError,
hrnReplaceKey("absolute path '/etc' is not in base path '{[path]}'"));
"absolute path '/etc' is not in base path '{[path]}'");
TEST_RESULT_BOOL(
storageInfoP(storageTest, STRDEF("/etc"), .ignoreMissing = true, .noPathEnforce = true).exists, true,
"path not enforced");

View File

@ -106,7 +106,7 @@ testRun(void)
TEST_ERROR(
storageInfoP(storageRemote, strNew(BOGUS_STR)), FileOpenError,
hrnReplaceKey("unable to get info for missing path/file '{[path]}/repo/BOGUS'"));
"unable to get info for missing path/file '{[path]}/repo/BOGUS'");
TEST_RESULT_BOOL(storageInfoP(storageRemote, strNew(BOGUS_STR), .ignoreMissing = true).exists, false, "missing file/path");
// -------------------------------------------------------------------------------------------------------------------------