1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2025-07-07 00:35:37 +02:00

Add empty archive array to info command JSON when stanza is missing.

There is an inconsistency when the JSON is output for the case when a stanza is requested and it does not exist in the repo. This was the only case where the archive array was not added to the JSON. Adding it will simplify the upcoming multi-repo support code.

Also, a redundant test was removed rather than updating it for this case.
This commit is contained in:
Cynthia Shang
2020-12-30 16:17:56 -05:00
committed by GitHub
parent 9bf7dbf6a2
commit cc90163233
2 changed files with 2 additions and 30 deletions

View File

@ -51,6 +51,7 @@ testRun(void)
infoRender(),
"["
"{"
"\"archive\":[],"
"\"backup\":[],"
"\"db\":[],"
"\"name\":\"stanza1\","
@ -1210,36 +1211,6 @@ testRun(void)
" database list: none\n",
"text - backup set requested, no db and no checksum error");
// Stanza not found
//--------------------------------------------------------------------------------------------------------------------------
argList2 = strLstDup(argList);
strLstAddZ(argList2, "--stanza=silly");
harnessCfgLoad(cfgCmdInfo, argList2);
TEST_RESULT_STR_Z(
infoRender(),
"["
"{"
"\"backup\":[],"
"\"db\":[],"
"\"name\":\"silly\","
"\"status\":{"
"\"code\":1,"
"\"lock\":{\"backup\":{\"held\":false}},"
"\"message\":\"missing stanza path\""
"}"
"}"
"]",
"json - missing stanza path");
StringList *argListText2 = strLstDup(argListText);
strLstAddZ(argListText2, "--stanza=silly");
harnessCfgLoad(cfgCmdInfo, argListText2);
TEST_RESULT_STR_Z(
infoRender(),
"stanza: silly\n"
" status: error (missing stanza path)\n",
"text - missing stanza path");
// Stanza found
//--------------------------------------------------------------------------------------------------------------------------
strLstAddZ(argList, "--stanza=stanza2");