1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2025-07-05 00:28:52 +02:00

Use harnessCfgLoadRaw() in command/command and common/exit unit tests.

The tests were originally written by loading values directly into the configuration before the parser was available.

Update to use harnessCfgLoadRaw() to simplify the tests and make them compatible with upcoming config changes.

Note that some unreachable conditions were removed since they could not be reached via a parsed config, only by munging values directly into the config. cfgOptionTest(optionId) was removed because a non-default value must always be set. cfgOptionValid(cfgOptLogTimestamp) was removed because it is true for all commands except for cfgCmdNone, which is checked with an assert.
This commit is contained in:
David Steele
2020-10-20 14:54:28 -04:00
parent 156b7d48cc
commit 176cf0bf60
5 changed files with 109 additions and 87 deletions

View File

@ -85,8 +85,8 @@ cmdOption(void)
// If option was reset
else if (cfgOptionReset(optionId))
strCatFmt(cmdOptionStr, " --reset-%s", cfgOptionName(optionId));
// Else set and not default
else if (cfgOptionSource(optionId) != cfgSourceDefault && cfgOptionTest(optionId))
// Else not default
else if (cfgOptionSource(optionId) != cfgSourceDefault)
{
ConfigDefineOption optionDefId = cfgOptionDefIdFromId(optionId);
@ -215,7 +215,7 @@ cmdEnd(int code, const String *errorMessage)
{
strCatZ(info, "completed successfully");
if (cfgOptionValid(cfgOptLogTimestamp) && cfgOptionBool(cfgOptLogTimestamp))
if (cfgOptionBool(cfgOptLogTimestamp))
strCatFmt(info, " (%" PRIu64 "ms)", timeMSec() - timeBegin);
}
else