mirror of
https://github.com/pgbackrest/pgbackrest.git
synced 2025-01-06 03:53:59 +02:00
Replace harnessCfgLoad*() functions with HRN_CFG_LOAD() macro.
HRN_CFG_LOAD() handles the majority of test configuration loads and has various options for special cases. It was not clear when to use harnessCfgLoadRaw() vs harnessCfgLoad(). Now "raw" functionality is granular and enabled by parameters, e.g. noStd.
This commit is contained in:
parent
c1277677a3
commit
8250990afb
@ -234,7 +234,7 @@ pgbackrest/test/test.pl --vm=none --dry-run
|
|||||||
P00 INFO: test begin - log level info
|
P00 INFO: test begin - log level info
|
||||||
P00 INFO: builds required: bin
|
P00 INFO: builds required: bin
|
||||||
--> P00 INFO: 68 tests selected
|
--> P00 INFO: 68 tests selected
|
||||||
|
|
||||||
P00 INFO: P1-T01/68 - vm=none, module=common, test=error
|
P00 INFO: P1-T01/68 - vm=none, module=common, test=error
|
||||||
[filtered 65 lines of output]
|
[filtered 65 lines of output]
|
||||||
P00 INFO: P1-T67/68 - vm=none, module=performance, test=type
|
P00 INFO: P1-T67/68 - vm=none, module=performance, test=type
|
||||||
@ -253,12 +253,12 @@ pgbackrest/test/test.pl --vm=none --dev --vm-out --module=common --test=wait
|
|||||||
P00 INFO: cleanup old data
|
P00 INFO: cleanup old data
|
||||||
P00 INFO: builds required: none
|
P00 INFO: builds required: none
|
||||||
P00 INFO: 1 test selected
|
P00 INFO: 1 test selected
|
||||||
|
|
||||||
P00 INFO: P1-T1/1 - vm=none, module=common, test=wait
|
P00 INFO: P1-T1/1 - vm=none, module=common, test=wait
|
||||||
|
|
||||||
run 1 - waitNew(), waitMore, and waitFree()
|
run 1 - waitNew(), waitMore, and waitFree()
|
||||||
l0018 expect AssertError: assertion 'waitTime <= 999999000' failed
|
l0018 expect AssertError: assertion 'waitTime <= 999999000' failed
|
||||||
|
|
||||||
run 1/1 ------------- l0021 0ms wait
|
run 1/1 ------------- l0021 0ms wait
|
||||||
l0025 new wait
|
l0025 new wait
|
||||||
l0026 check remaining time
|
l0026 check remaining time
|
||||||
@ -283,9 +283,9 @@ pgbackrest/test/test.pl --vm=none --dev --vm-out --module=common --test=wait
|
|||||||
l0062 lower range check
|
l0062 lower range check
|
||||||
l0063 upper range check
|
l0063 upper range check
|
||||||
l0065 free wait
|
l0065 free wait
|
||||||
|
|
||||||
TESTS COMPLETED SUCCESSFULLY
|
TESTS COMPLETED SUCCESSFULLY
|
||||||
|
|
||||||
P00 INFO: P1-T1/1 - vm=none, module=common, test=wait
|
P00 INFO: P1-T1/1 - vm=none, module=common, test=wait
|
||||||
P00 INFO: tested modules have full coverage
|
P00 INFO: tested modules have full coverage
|
||||||
P00 INFO: writing C coverage report
|
P00 INFO: writing C coverage report
|
||||||
@ -305,7 +305,7 @@ pgbackrest/test/test.pl --vm=none --dev --module=postgres
|
|||||||
P00 INFO: cleanup old data
|
P00 INFO: cleanup old data
|
||||||
P00 INFO: builds required: none
|
P00 INFO: builds required: none
|
||||||
P00 INFO: 2 tests selected
|
P00 INFO: 2 tests selected
|
||||||
|
|
||||||
P00 INFO: P1-T1/2 - vm=none, module=postgres, test=client
|
P00 INFO: P1-T1/2 - vm=none, module=postgres, test=client
|
||||||
P00 INFO: P1-T2/2 - vm=none, module=postgres, test=interface
|
P00 INFO: P1-T2/2 - vm=none, module=postgres, test=interface
|
||||||
P00 INFO: tested modules have full coverage
|
P00 INFO: tested modules have full coverage
|
||||||
@ -345,7 +345,7 @@ pgbackrest/test/test.pl --vm=u18 --dev --module=mock --test=archive --run=2
|
|||||||
P00 INFO: bin dependencies have changed for none, rebuilding...
|
P00 INFO: bin dependencies have changed for none, rebuilding...
|
||||||
P00 INFO: build bin for none (/home/vagrant/test/bin/none)
|
P00 INFO: build bin for none (/home/vagrant/test/bin/none)
|
||||||
P00 INFO: 1 test selected
|
P00 INFO: 1 test selected
|
||||||
|
|
||||||
P00 INFO: P1-T1/1 - vm=u18, module=mock, test=archive, run=2
|
P00 INFO: P1-T1/1 - vm=u18, module=mock, test=archive, run=2
|
||||||
P00 INFO: no code modules had all tests run required for coverage
|
P00 INFO: no code modules had all tests run required for coverage
|
||||||
P00 INFO: TESTS COMPLETED SUCCESSFULLY
|
P00 INFO: TESTS COMPLETED SUCCESSFULLY
|
||||||
@ -392,14 +392,14 @@ if (testBegin("expireBackup()"))
|
|||||||
|
|
||||||
#### Setting up the command to be run
|
#### Setting up the command to be run
|
||||||
|
|
||||||
The [harnessConfig.h](https://github.com/pgbackrest/pgbackrest/blob/master/test/src/common/harnessConfig.h) describes a list of functions that should be used when configuration options are required for a command being tested. Options are set in a `StringList` which must be defined and passed to the function `harnessCfgLoad()` with the command. For example, the following will set up a test to run `pgbackrest --repo-path=test/test-0/repo info` command on multiple repositories, one of which is encrypted:
|
The [harnessConfig.h](https://github.com/pgbackrest/pgbackrest/blob/master/test/src/common/harnessConfig.h) describes a list of functions that should be used when configuration options are required for a command being tested. Options are set in a `StringList` which must be defined and passed to the `HRN_CFG_LOAD()` macro with the command. For example, the following will set up a test to run `pgbackrest --repo-path=test/test-0/repo info` command on multiple repositories, one of which is encrypted:
|
||||||
```
|
```
|
||||||
StringList *argList = strLstNew(); // Create an empty string list
|
StringList *argList = strLstNew(); // Create an empty string list
|
||||||
hrnCfgArgRawZ(argList, cfgOptRepoPath, TEST_PATH_REPO); // Add the --repo-path option
|
hrnCfgArgRawZ(argList, cfgOptRepoPath, TEST_PATH_REPO); // Add the --repo-path option
|
||||||
hrnCfgArgKeyRawZ(argList, cfgOptRepoPath, 2, TEST_PATH "/repo2"); // Add the --repo2-path option
|
hrnCfgArgKeyRawZ(argList, cfgOptRepoPath, 2, TEST_PATH "/repo2"); // Add the --repo2-path option
|
||||||
hrnCfgArgKeyRawStrId(argList, cfgOptRepoCipherType, 2, cipherTypeAes256Cbc); // Add the --repo2-cipher-type option
|
hrnCfgArgKeyRawStrId(argList, cfgOptRepoCipherType, 2, cipherTypeAes256Cbc); // Add the --repo2-cipher-type option
|
||||||
hrnCfgEnvKeyRawZ(cfgOptRepoCipherPass, 2, TEST_CIPHER_PASS); // Set environment variable for the --repo2-cipher-pass option
|
hrnCfgEnvKeyRawZ(cfgOptRepoCipherPass, 2, TEST_CIPHER_PASS); // Set environment variable for the --repo2-cipher-pass option
|
||||||
harnessCfgLoad(cfgCmdInfo, argList); // Load the command and option list into the test harness
|
HRN_CFG_LOAD(cfgCmdInfo, argList); // Load the command and option list into the test harness
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Storing a file
|
#### Storing a file
|
||||||
@ -455,7 +455,7 @@ HARNESS_FORK_BEGIN()
|
|||||||
{
|
{
|
||||||
sleepMSec(250);
|
sleepMSec(250);
|
||||||
|
|
||||||
harnessCfgLoad(cfgCmdInfo, argListText);
|
HRN_CFG_LOAD(cfgCmdInfo, argListText);
|
||||||
TEST_RESULT_STR_Z(
|
TEST_RESULT_STR_Z(
|
||||||
infoRender(),
|
infoRender(),
|
||||||
"stanza: stanza1\n"
|
"stanza: stanza1\n"
|
||||||
@ -531,7 +531,7 @@ There are detailed comment blocks above each section that explain the rules for
|
|||||||
|
|
||||||
The `option:` section is broken into sub-sections by a simple comment divider (e.g. `# Repository options`) under which the options are organized alphabetically by option name. To better explain this section, two hypothetical examples will be discussed. For more details, see [config.yaml](https://github.com/pgbackrest/pgbackrest/blob/master/src/build/config/config.yaml).
|
The `option:` section is broken into sub-sections by a simple comment divider (e.g. `# Repository options`) under which the options are organized alphabetically by option name. To better explain this section, two hypothetical examples will be discussed. For more details, see [config.yaml](https://github.com/pgbackrest/pgbackrest/blob/master/src/build/config/config.yaml).
|
||||||
|
|
||||||
#### Example 1: hypothetical command line only option
|
#### Example 1: hypothetical command line only option
|
||||||
```
|
```
|
||||||
set:
|
set:
|
||||||
type: string
|
type: string
|
||||||
|
@ -442,7 +442,7 @@ if (testBegin("expireBackup()"))
|
|||||||
<section id="test-command">
|
<section id="test-command">
|
||||||
<title>Setting up the command to be run</title>
|
<title>Setting up the command to be run</title>
|
||||||
|
|
||||||
<p>The <link url="{[github-url-test-common]}/harnessConfig.h">harnessConfig.h</link> describes a list of functions that should be used when configuration options are required for a command being tested. Options are set in a <code>StringList</code> which must be defined and passed to the function <code>harnessCfgLoad()</code> with the command. For example, the following will set up a test to run <cmd>pgbackrest --repo-path=test/test-0/repo info</cmd> command on multiple repositories, one of which is encrypted:</p>
|
<p>The <link url="{[github-url-test-common]}/harnessConfig.h">harnessConfig.h</link> describes a list of functions that should be used when configuration options are required for a command being tested. Options are set in a <code>StringList</code> which must be defined and passed to the <code>HRN_CFG_LOAD()</code> macro with the command. For example, the following will set up a test to run <cmd>pgbackrest --repo-path=test/test-0/repo info</cmd> command on multiple repositories, one of which is encrypted:</p>
|
||||||
|
|
||||||
<code-block>
|
<code-block>
|
||||||
StringList *argList = strLstNew(); // Create an empty string list
|
StringList *argList = strLstNew(); // Create an empty string list
|
||||||
@ -450,7 +450,7 @@ hrnCfgArgRawZ(argList, cfgOptRepoPath, TEST_PATH_REPO); // Add the -
|
|||||||
hrnCfgArgKeyRawZ(argList, cfgOptRepoPath, 2, TEST_PATH "/repo2"); // Add the --repo2-path option
|
hrnCfgArgKeyRawZ(argList, cfgOptRepoPath, 2, TEST_PATH "/repo2"); // Add the --repo2-path option
|
||||||
hrnCfgArgKeyRawStrId(argList, cfgOptRepoCipherType, 2, cipherTypeAes256Cbc); // Add the --repo2-cipher-type option
|
hrnCfgArgKeyRawStrId(argList, cfgOptRepoCipherType, 2, cipherTypeAes256Cbc); // Add the --repo2-cipher-type option
|
||||||
hrnCfgEnvKeyRawZ(cfgOptRepoCipherPass, 2, TEST_CIPHER_PASS); // Set environment variable for the --repo2-cipher-pass option
|
hrnCfgEnvKeyRawZ(cfgOptRepoCipherPass, 2, TEST_CIPHER_PASS); // Set environment variable for the --repo2-cipher-pass option
|
||||||
harnessCfgLoad(cfgCmdInfo, argList); // Load the command and option list into the test harness
|
HRN_CFG_LOAD(cfgCmdInfo, argList); // Load the command and option list into the test harness
|
||||||
</code-block>
|
</code-block>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
@ -514,7 +514,7 @@ HARNESS_FORK_BEGIN()
|
|||||||
{
|
{
|
||||||
sleepMSec(250);
|
sleepMSec(250);
|
||||||
|
|
||||||
harnessCfgLoad(cfgCmdInfo, argListText);
|
HRN_CFG_LOAD(cfgCmdInfo, argListText);
|
||||||
TEST_RESULT_STR_Z(
|
TEST_RESULT_STR_Z(
|
||||||
infoRender(),
|
infoRender(),
|
||||||
"stanza: stanza1\n"
|
"stanza: stanza1\n"
|
||||||
|
@ -7,11 +7,6 @@ Harness for Loading Test Configurations
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
#include "common/harnessConfig.h"
|
|
||||||
#include "common/harnessDebug.h"
|
|
||||||
#include "common/harnessLog.h"
|
|
||||||
#include "common/harnessTest.h"
|
|
||||||
|
|
||||||
#include "common/io/io.h"
|
#include "common/io/io.h"
|
||||||
#include "config/config.intern.h"
|
#include "config/config.intern.h"
|
||||||
#include "config/load.h"
|
#include "config/load.h"
|
||||||
@ -19,32 +14,63 @@ Harness for Loading Test Configurations
|
|||||||
#include "storage/helper.h"
|
#include "storage/helper.h"
|
||||||
#include "version.h"
|
#include "version.h"
|
||||||
|
|
||||||
|
#include "common/harnessConfig.h"
|
||||||
|
#include "common/harnessDebug.h"
|
||||||
|
#include "common/harnessLog.h"
|
||||||
|
#include "common/harnessTest.h"
|
||||||
|
|
||||||
/**********************************************************************************************************************************/
|
/**********************************************************************************************************************************/
|
||||||
void
|
void
|
||||||
harnessCfgLoadRaw(unsigned int argListSize, const char *argList[])
|
hrnCfgLoad(ConfigCommand commandId, const StringList *argListParam, const HrnCfgLoadParam param)
|
||||||
{
|
{
|
||||||
FUNCTION_HARNESS_BEGIN();
|
FUNCTION_HARNESS_BEGIN();
|
||||||
FUNCTION_HARNESS_PARAM(UINT, argListSize);
|
FUNCTION_HARNESS_PARAM(ENUM, commandId);
|
||||||
FUNCTION_HARNESS_PARAM(CHARPY, argList);
|
FUNCTION_HARNESS_PARAM(STRING_LIST, argListParam);
|
||||||
|
FUNCTION_HARNESS_PARAM(ENUM, param.role);
|
||||||
FUNCTION_HARNESS_END();
|
FUNCTION_HARNESS_END();
|
||||||
|
|
||||||
|
// Make a copy of the arg list that we can modify
|
||||||
|
StringList *argList = strLstDup(argListParam);
|
||||||
|
|
||||||
|
// Add standard options needed in most cases
|
||||||
|
if (!param.noStd)
|
||||||
|
{
|
||||||
|
// Set job retry to 0 if it is valid
|
||||||
|
if (cfgParseOptionValid(commandId, param.role, cfgOptJobRetry))
|
||||||
|
strLstInsert(argList, 0, STRDEF("--" CFGOPT_JOB_RETRY "=0"));
|
||||||
|
|
||||||
|
// Set log path if valid
|
||||||
|
if (cfgParseOptionValid(commandId, param.role, cfgOptLogPath))
|
||||||
|
strLstInsert(argList, 0, strNewFmt("--" CFGOPT_LOG_PATH "=%s", hrnPath()));
|
||||||
|
|
||||||
|
// Set lock path if valid
|
||||||
|
if (cfgParseOptionValid(commandId, param.role, cfgOptLockPath))
|
||||||
|
strLstInsert(argList, 0, strNewFmt("--" CFGOPT_LOCK_PATH "=%s/lock", hrnPath()));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Insert the command so it does not interfere with parameters
|
||||||
|
if (commandId != cfgCmdNone)
|
||||||
|
strLstInsert(argList, 0, cfgCommandRoleNameParam(commandId, param.role, COLON_STR));
|
||||||
|
|
||||||
|
// Insert the project exe
|
||||||
|
strLstInsert(argList, 0, param.exeBogus ? STRDEF("pgbackrest-bogus") : STRDEF(testProjectExe()));
|
||||||
|
|
||||||
|
// Log parameters
|
||||||
|
if (param.log)
|
||||||
|
{
|
||||||
|
printf("config load:");
|
||||||
|
|
||||||
|
for (unsigned int argIdx = 0; argIdx < strLstSize(argList); argIdx++)
|
||||||
|
printf(" %s", strZ(strLstGet(argList, argIdx)));
|
||||||
|
|
||||||
|
hrnTestResultComment(param.comment);
|
||||||
|
}
|
||||||
|
|
||||||
// Free objects in storage helper
|
// Free objects in storage helper
|
||||||
storageHelperFree();
|
storageHelperFree();
|
||||||
|
|
||||||
// Log parameters
|
|
||||||
hrnTestLogPrefix(__LINE__);
|
|
||||||
|
|
||||||
printf("config load:");
|
|
||||||
|
|
||||||
for (unsigned int argIdx = 0; argIdx < argListSize; argIdx++)
|
|
||||||
printf(" %s", argList[argIdx]);
|
|
||||||
|
|
||||||
printf("\n");
|
|
||||||
|
|
||||||
fflush(stdout);
|
|
||||||
|
|
||||||
// Parse config
|
// Parse config
|
||||||
configParse(storageLocal(), argListSize, argList, false);
|
configParse(storageLocal(), strLstSize(argList), strLstPtr(argList), false);
|
||||||
|
|
||||||
// Set dry-run mode for storage and logging
|
// Set dry-run mode for storage and logging
|
||||||
harnessLogDryRunSet(cfgOptionValid(cfgOptDryRun) && cfgOptionBool(cfgOptDryRun));
|
harnessLogDryRunSet(cfgOptionValid(cfgOptDryRun) && cfgOptionBool(cfgOptDryRun));
|
||||||
@ -65,56 +91,6 @@ harnessCfgLoadRaw(unsigned int argListSize, const char *argList[])
|
|||||||
FUNCTION_HARNESS_RETURN_VOID();
|
FUNCTION_HARNESS_RETURN_VOID();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**********************************************************************************************************************************/
|
|
||||||
void
|
|
||||||
harnessCfgLoadRole(ConfigCommand commandId, ConfigCommandRole commandRoleId, const StringList *argListParam)
|
|
||||||
{
|
|
||||||
FUNCTION_HARNESS_BEGIN();
|
|
||||||
FUNCTION_HARNESS_PARAM(ENUM, commandId);
|
|
||||||
FUNCTION_HARNESS_PARAM(ENUM, commandRoleId);
|
|
||||||
FUNCTION_HARNESS_PARAM(STRING_LIST, argListParam);
|
|
||||||
FUNCTION_HARNESS_END();
|
|
||||||
|
|
||||||
// Make a copy of the arg list that we can modify
|
|
||||||
StringList *argList = strLstDup(argListParam);
|
|
||||||
|
|
||||||
// Set job retry to 0 if it is valid
|
|
||||||
if (cfgParseOptionValid(commandId, commandRoleId, cfgOptJobRetry))
|
|
||||||
strLstInsert(argList, 0, STRDEF("--" CFGOPT_JOB_RETRY "=0"));
|
|
||||||
|
|
||||||
// Set log path if valid
|
|
||||||
if (cfgParseOptionValid(commandId, commandRoleId, cfgOptLogPath))
|
|
||||||
strLstInsert(argList, 0, strNewFmt("--" CFGOPT_LOG_PATH "=%s", hrnPath()));
|
|
||||||
|
|
||||||
// Set lock path if valid
|
|
||||||
if (cfgParseOptionValid(commandId, commandRoleId, cfgOptLockPath))
|
|
||||||
strLstInsert(argList, 0, strNewFmt("--" CFGOPT_LOCK_PATH "=%s/lock", hrnPath()));
|
|
||||||
|
|
||||||
// Insert the command so it does not interfere with parameters
|
|
||||||
strLstInsert(argList, 0, cfgCommandRoleNameParam(commandId, commandRoleId, COLON_STR));
|
|
||||||
|
|
||||||
// Insert the project exe
|
|
||||||
strLstInsert(argList, 0, STRDEF(testProjectExe()));
|
|
||||||
|
|
||||||
harnessCfgLoadRaw(strLstSize(argList), strLstPtr(argList));
|
|
||||||
|
|
||||||
FUNCTION_HARNESS_RETURN_VOID();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**********************************************************************************************************************************/
|
|
||||||
void
|
|
||||||
harnessCfgLoad(ConfigCommand commandId, const StringList *argListParam)
|
|
||||||
{
|
|
||||||
FUNCTION_HARNESS_BEGIN();
|
|
||||||
FUNCTION_HARNESS_PARAM(ENUM, commandId);
|
|
||||||
FUNCTION_HARNESS_PARAM(STRING_LIST, argListParam);
|
|
||||||
FUNCTION_HARNESS_END();
|
|
||||||
|
|
||||||
harnessCfgLoadRole(commandId, cfgCmdRoleMain, argListParam);
|
|
||||||
|
|
||||||
FUNCTION_HARNESS_RETURN_VOID();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**********************************************************************************************************************************/
|
/**********************************************************************************************************************************/
|
||||||
void
|
void
|
||||||
hrnCfgArgRaw(StringList *argList, ConfigOption optionId, const String *value)
|
hrnCfgArgRaw(StringList *argList, ConfigOption optionId, const String *value)
|
||||||
|
@ -1,6 +1,9 @@
|
|||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
Harness for Loading Test Configurations
|
Harness for Loading Test Configurations
|
||||||
***********************************************************************************************************************************/
|
***********************************************************************************************************************************/
|
||||||
|
#ifndef TEST_COMMON_HARNESS_CONFIG_H
|
||||||
|
#define TEST_COMMON_HARNESS_CONFIG_H
|
||||||
|
|
||||||
#include "config/config.h"
|
#include "config/config.h"
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
@ -19,17 +22,36 @@ Config option constants
|
|||||||
#define TEST_CIPHER_PASS_ARCHIVE "xarchivex"
|
#define TEST_CIPHER_PASS_ARCHIVE "xarchivex"
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
Load a test configuration without any side effects
|
Load a test configuration
|
||||||
|
|
||||||
There's no need to open log files, acquire locks, reset log levels, etc.
|
Automatically adds the exe, command (and role), lock-path, and log-path so executing the binary works locally or in a container.
|
||||||
|
There is no need to open log files, acquire locks, reset log levels, etc.
|
||||||
|
|
||||||
|
HRN_CFG_LOAD() is the preferred macro but if a configuration error is being tested with TEST_ERROR() then use hrnCfgLoadP() instead
|
||||||
|
since it will not log to the console and clutter the error log message.
|
||||||
***********************************************************************************************************************************/
|
***********************************************************************************************************************************/
|
||||||
// Low-level version used when it is important that only the options set explicity by the test are present in the config. The
|
typedef struct HrnCfgLoadParam
|
||||||
// additional options set by harnessCfgLoad() can make these tests harder to write. Most tests should use harnessCfgLoad().
|
{
|
||||||
void harnessCfgLoadRaw(unsigned int argListSize, const char *argList[]);
|
VAR_PARAM_HEADER;
|
||||||
|
ConfigCommandRole role; // Command role (defaults to main)
|
||||||
|
bool exeBogus; // Use pgbackrest-bogus as exe parameter
|
||||||
|
bool noStd; // Do not add standard options, e.g. lock-path
|
||||||
|
bool log; // Log parameters? (used internally by HRN_CFG_LOAD())
|
||||||
|
const char *comment; // Comment
|
||||||
|
} HrnCfgLoadParam;
|
||||||
|
|
||||||
// Automatically adds the exe, command (and role), lock-path, and log-path so executing the binary works locally or in a container.
|
#define hrnCfgLoadP(commandId, argList, ...) \
|
||||||
void harnessCfgLoad(ConfigCommand commandId, const StringList *argList);
|
hrnCfgLoad(commandId, argList, (HrnCfgLoadParam){VAR_PARAM_INIT, __VA_ARGS__})
|
||||||
void harnessCfgLoadRole(ConfigCommand commandId, ConfigCommandRole commandRoleId, const StringList *argList);
|
|
||||||
|
#define HRN_CFG_LOAD(commandId, argList, ...) \
|
||||||
|
do \
|
||||||
|
{ \
|
||||||
|
hrnTestLogPrefix(__LINE__); \
|
||||||
|
hrnCfgLoad(commandId, argList, (HrnCfgLoadParam){.log = true, __VA_ARGS__}); \
|
||||||
|
} \
|
||||||
|
while (0)
|
||||||
|
|
||||||
|
void hrnCfgLoad(ConfigCommand commandId, const StringList *argList, const HrnCfgLoadParam param);
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
Configuration helper functions
|
Configuration helper functions
|
||||||
@ -74,3 +96,5 @@ void hrnCfgEnvKeyRawZ(ConfigOption optionId, unsigned optionKey, const char *val
|
|||||||
|
|
||||||
void hrnCfgEnvRemoveRaw(ConfigOption optionId);
|
void hrnCfgEnvRemoveRaw(ConfigOption optionId);
|
||||||
void hrnCfgEnvKeyRemoveRaw(ConfigOption optionId, unsigned optionKey);
|
void hrnCfgEnvKeyRemoveRaw(ConfigOption optionId, unsigned optionKey);
|
||||||
|
|
||||||
|
#endif
|
||||||
|
@ -66,8 +66,7 @@ protocolLocalExec(
|
|||||||
{
|
{
|
||||||
// Load configuration
|
// Load configuration
|
||||||
StringList *const paramList = protocolLocalParam(protocolStorageType, hostIdx, processId);
|
StringList *const paramList = protocolLocalParam(protocolStorageType, hostIdx, processId);
|
||||||
strLstInsert(paramList, 0, cfgExe());
|
hrnCfgLoadP(cfgCmdNone, paramList, .noStd = true);
|
||||||
harnessCfgLoadRaw(strLstSize(paramList), strLstPtr(paramList));
|
|
||||||
|
|
||||||
// Change log process id to aid in debugging
|
// Change log process id to aid in debugging
|
||||||
hrnLogProcessIdSet(processId);
|
hrnLogProcessIdSet(processId);
|
||||||
@ -163,8 +162,7 @@ protocolRemoteExec(
|
|||||||
{
|
{
|
||||||
// Load configuration
|
// Load configuration
|
||||||
StringList *const paramList = protocolRemoteParam(protocolStorageType, hostIdx);
|
StringList *const paramList = protocolRemoteParam(protocolStorageType, hostIdx);
|
||||||
strLstInsert(paramList, 0, cfgExe());
|
hrnCfgLoadP(cfgCmdNone, paramList, .noStd = true);
|
||||||
harnessCfgLoadRaw(strLstSize(paramList), strLstPtr(paramList));
|
|
||||||
|
|
||||||
// Change log process id to aid in debugging
|
// Change log process id to aid in debugging
|
||||||
hrnLogProcessIdSet(processId);
|
hrnLogProcessIdSet(processId);
|
||||||
|
@ -29,7 +29,7 @@ testRun(void)
|
|||||||
strLstAddZ(argList, "--archive-async");
|
strLstAddZ(argList, "--archive-async");
|
||||||
strLstAddZ(argList, "--archive-timeout=1");
|
strLstAddZ(argList, "--archive-timeout=1");
|
||||||
strLstAddZ(argList, "--stanza=db");
|
strLstAddZ(argList, "--stanza=db");
|
||||||
harnessCfgLoad(cfgCmdArchivePush, argList);
|
HRN_CFG_LOAD(cfgCmdArchivePush, argList);
|
||||||
|
|
||||||
// -------------------------------------------------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------------------------------------------------
|
||||||
const String *segment = STRDEF("000000010000000100000001");
|
const String *segment = STRDEF("000000010000000100000001");
|
||||||
@ -138,7 +138,7 @@ testRun(void)
|
|||||||
strLstAddZ(argList, "--stanza=db");
|
strLstAddZ(argList, "--stanza=db");
|
||||||
hrnCfgArgRawZ(argList, cfgOptPgPath, "/path/to/pg");
|
hrnCfgArgRawZ(argList, cfgOptPgPath, "/path/to/pg");
|
||||||
strLstAddZ(argList, "--" CFGOPT_ARCHIVE_ASYNC);
|
strLstAddZ(argList, "--" CFGOPT_ARCHIVE_ASYNC);
|
||||||
harnessCfgLoadRole(cfgCmdArchiveGet, cfgCmdRoleAsync, argList);
|
HRN_CFG_LOAD(cfgCmdArchiveGet, argList, .role = cfgCmdRoleAsync);
|
||||||
|
|
||||||
const String *walSegment = STRDEF("000000010000000100000001");
|
const String *walSegment = STRDEF("000000010000000100000001");
|
||||||
|
|
||||||
@ -238,7 +238,7 @@ testRun(void)
|
|||||||
hrnCfgArgRawZ(argList, cfgOptPgPath, "/path/to/pg");
|
hrnCfgArgRawZ(argList, cfgOptPgPath, "/path/to/pg");
|
||||||
strLstAddZ(argList, "--repo-path=" TEST_PATH);
|
strLstAddZ(argList, "--repo-path=" TEST_PATH);
|
||||||
strLstAddZ(argList, "archive-get");
|
strLstAddZ(argList, "archive-get");
|
||||||
harnessCfgLoad(cfgCmdArchiveGet, argList);
|
HRN_CFG_LOAD(cfgCmdArchiveGet, argList);
|
||||||
|
|
||||||
TEST_RESULT_STR(walSegmentFind(storageRepo(), STRDEF("9.6-2"), STRDEF("123456781234567812345678"), 0), NULL, "no path");
|
TEST_RESULT_STR(walSegmentFind(storageRepo(), STRDEF("9.6-2"), STRDEF("123456781234567812345678"), 0), NULL, "no path");
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@ testRun(void)
|
|||||||
strLstAddZ(argList, "--archive-async");
|
strLstAddZ(argList, "--archive-async");
|
||||||
hrnCfgArgRawZ(argList, cfgOptPgPath, "/unused");
|
hrnCfgArgRawZ(argList, cfgOptPgPath, "/unused");
|
||||||
strLstAddZ(argList, "--spool-path=" TEST_PATH "/spool");
|
strLstAddZ(argList, "--spool-path=" TEST_PATH "/spool");
|
||||||
harnessCfgLoad(cfgCmdArchiveGet, argList);
|
HRN_CFG_LOAD(cfgCmdArchiveGet, argList);
|
||||||
|
|
||||||
size_t queueSize = 16 * 1024 * 1024;
|
size_t queueSize = 16 * 1024 * 1024;
|
||||||
size_t walSegmentSize = 16 * 1024 * 1024;
|
size_t walSegmentSize = 16 * 1024 * 1024;
|
||||||
@ -117,7 +117,7 @@ testRun(void)
|
|||||||
|
|
||||||
StringList *argList = strLstDup(argBaseList);
|
StringList *argList = strLstDup(argBaseList);
|
||||||
hrnCfgArgRawZ(argList, cfgOptPgHost, BOGUS_STR);
|
hrnCfgArgRawZ(argList, cfgOptPgHost, BOGUS_STR);
|
||||||
harnessCfgLoadRole(cfgCmdArchiveGet, cfgCmdRoleAsync, argList);
|
HRN_CFG_LOAD(cfgCmdArchiveGet, argList, .role = cfgCmdRoleAsync);
|
||||||
|
|
||||||
TEST_ERROR(cmdArchiveGetAsync(), HostInvalidError, "archive-get command must be run on the PostgreSQL host");
|
TEST_ERROR(cmdArchiveGetAsync(), HostInvalidError, "archive-get command must be run on the PostgreSQL host");
|
||||||
|
|
||||||
@ -130,7 +130,7 @@ testRun(void)
|
|||||||
TEST_TITLE("error on no segments");
|
TEST_TITLE("error on no segments");
|
||||||
|
|
||||||
argList = strLstDup(argBaseList);
|
argList = strLstDup(argBaseList);
|
||||||
harnessCfgLoadRole(cfgCmdArchiveGet, cfgCmdRoleAsync, argList);
|
HRN_CFG_LOAD(cfgCmdArchiveGet, argList, .role = cfgCmdRoleAsync);
|
||||||
|
|
||||||
TEST_ERROR(cmdArchiveGetAsync(), ParamInvalidError, "at least one wal segment is required");
|
TEST_ERROR(cmdArchiveGetAsync(), ParamInvalidError, "at least one wal segment is required");
|
||||||
|
|
||||||
@ -155,7 +155,7 @@ testRun(void)
|
|||||||
"1={\"db-id\":18072658121562454734,\"db-version\":\"10\"}\n");
|
"1={\"db-id\":18072658121562454734,\"db-version\":\"10\"}\n");
|
||||||
|
|
||||||
strLstAddZ(argList, "000000010000000100000001");
|
strLstAddZ(argList, "000000010000000100000001");
|
||||||
harnessCfgLoadRole(cfgCmdArchiveGet, cfgCmdRoleAsync, argList);
|
HRN_CFG_LOAD(cfgCmdArchiveGet, argList, .role = cfgCmdRoleAsync);
|
||||||
|
|
||||||
TEST_RESULT_VOID(cmdArchiveGetAsync(), "get async");
|
TEST_RESULT_VOID(cmdArchiveGetAsync(), "get async");
|
||||||
|
|
||||||
@ -317,7 +317,7 @@ testRun(void)
|
|||||||
strLstAddZ(argList, "0000000100000001000000FE");
|
strLstAddZ(argList, "0000000100000001000000FE");
|
||||||
strLstAddZ(argList, "0000000100000001000000FF");
|
strLstAddZ(argList, "0000000100000001000000FF");
|
||||||
strLstAddZ(argList, "000000010000000200000000");
|
strLstAddZ(argList, "000000010000000200000000");
|
||||||
harnessCfgLoadRole(cfgCmdArchiveGet, cfgCmdRoleAsync, argList);
|
HRN_CFG_LOAD(cfgCmdArchiveGet, argList, .role = cfgCmdRoleAsync);
|
||||||
|
|
||||||
HRN_INFO_PUT(
|
HRN_INFO_PUT(
|
||||||
storageRepoIdxWrite(1), INFO_ARCHIVE_PATH_FILE,
|
storageRepoIdxWrite(1), INFO_ARCHIVE_PATH_FILE,
|
||||||
@ -421,7 +421,7 @@ testRun(void)
|
|||||||
|
|
||||||
argList = strLstDup(argBaseList);
|
argList = strLstDup(argBaseList);
|
||||||
strLstAddZ(argList, "000000010000000200000000");
|
strLstAddZ(argList, "000000010000000200000000");
|
||||||
harnessCfgLoadRole(cfgCmdArchiveGet, cfgCmdRoleAsync, argList);
|
HRN_CFG_LOAD(cfgCmdArchiveGet, argList, .role = cfgCmdRoleAsync);
|
||||||
|
|
||||||
TEST_RESULT_VOID(cmdArchiveGetAsync(), "archive async");
|
TEST_RESULT_VOID(cmdArchiveGetAsync(), "archive async");
|
||||||
|
|
||||||
@ -454,7 +454,7 @@ testRun(void)
|
|||||||
|
|
||||||
argList = strLstDup(argBaseList);
|
argList = strLstDup(argBaseList);
|
||||||
strLstAddZ(argList, "000000010000000200000000");
|
strLstAddZ(argList, "000000010000000200000000");
|
||||||
harnessCfgLoadRole(cfgCmdArchiveGet, cfgCmdRoleAsync, argList);
|
HRN_CFG_LOAD(cfgCmdArchiveGet, argList, .role = cfgCmdRoleAsync);
|
||||||
|
|
||||||
HRN_INFO_PUT(
|
HRN_INFO_PUT(
|
||||||
storageRepoIdxWrite(2), INFO_ARCHIVE_PATH_FILE,
|
storageRepoIdxWrite(2), INFO_ARCHIVE_PATH_FILE,
|
||||||
@ -534,17 +534,15 @@ testRun(void)
|
|||||||
hrnProtocolLocalShimUninstall();
|
hrnProtocolLocalShimUninstall();
|
||||||
|
|
||||||
argList = strLstNew();
|
argList = strLstNew();
|
||||||
strLstAddZ(argList, "pgbackrest-bogus");
|
|
||||||
hrnCfgArgRawZ(argList, cfgOptPgPath, TEST_PATH_PG);
|
hrnCfgArgRawZ(argList, cfgOptPgPath, TEST_PATH_PG);
|
||||||
hrnCfgArgRawZ(argList, cfgOptRepoPath, TEST_PATH_REPO);
|
hrnCfgArgRawZ(argList, cfgOptRepoPath, TEST_PATH_REPO);
|
||||||
hrnCfgArgRawZ(argList, cfgOptSpoolPath, TEST_PATH_SPOOL);
|
hrnCfgArgRawZ(argList, cfgOptSpoolPath, TEST_PATH_SPOOL);
|
||||||
hrnCfgArgRawBool(argList, cfgOptArchiveAsync, true);
|
hrnCfgArgRawBool(argList, cfgOptArchiveAsync, true);
|
||||||
hrnCfgArgRawZ(argList, cfgOptStanza, "test2");
|
hrnCfgArgRawZ(argList, cfgOptStanza, "test2");
|
||||||
strLstAddZ(argList, CFGCMD_ARCHIVE_GET ":" CONFIG_COMMAND_ROLE_ASYNC);
|
|
||||||
strLstAddZ(argList, "0000000100000001000000FE");
|
strLstAddZ(argList, "0000000100000001000000FE");
|
||||||
strLstAddZ(argList, "0000000100000001000000FF");
|
strLstAddZ(argList, "0000000100000001000000FF");
|
||||||
strLstAddZ(argList, "000000010000000200000000");
|
strLstAddZ(argList, "000000010000000200000000");
|
||||||
harnessCfgLoadRaw(strLstSize(argList), strLstPtr(argList));
|
HRN_CFG_LOAD(cfgCmdArchiveGet, argList, .role = cfgCmdRoleAsync, .exeBogus = true);
|
||||||
|
|
||||||
TEST_ERROR(
|
TEST_ERROR(
|
||||||
cmdArchiveGetAsync(), ExecuteError,
|
cmdArchiveGetAsync(), ExecuteError,
|
||||||
@ -569,33 +567,30 @@ testRun(void)
|
|||||||
|
|
||||||
// Arguments that must be included. Use raw config here because we need to keep the
|
// Arguments that must be included. Use raw config here because we need to keep the
|
||||||
StringList *argBaseList = strLstNew();
|
StringList *argBaseList = strLstNew();
|
||||||
strLstAddZ(argBaseList, "pgbackrest-bogus");
|
|
||||||
hrnCfgArgRawZ(argBaseList, cfgOptPgPath, TEST_PATH_PG);
|
hrnCfgArgRawZ(argBaseList, cfgOptPgPath, TEST_PATH_PG);
|
||||||
hrnCfgArgRawZ(argBaseList, cfgOptRepoPath, TEST_PATH_REPO);
|
hrnCfgArgRawZ(argBaseList, cfgOptRepoPath, TEST_PATH_REPO);
|
||||||
hrnCfgArgRawZ(argBaseList, cfgOptStanza, "test1");
|
hrnCfgArgRawZ(argBaseList, cfgOptStanza, "test1");
|
||||||
hrnCfgArgRawZ(argBaseList, cfgOptArchiveTimeout, "1");
|
hrnCfgArgRawZ(argBaseList, cfgOptArchiveTimeout, "1");
|
||||||
hrnCfgArgRawZ(argBaseList, cfgOptLockPath, HRN_PATH "/lock");
|
|
||||||
strLstAddZ(argBaseList, CFGCMD_ARCHIVE_GET);
|
|
||||||
|
|
||||||
// -------------------------------------------------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------------------------------------------------
|
||||||
TEST_TITLE("command must be run on the pg host");
|
TEST_TITLE("command must be run on the pg host");
|
||||||
|
|
||||||
StringList *argList = strLstDup(argBaseList);
|
StringList *argList = strLstDup(argBaseList);
|
||||||
hrnCfgArgRawZ(argList, cfgOptPgHost, BOGUS_STR);
|
hrnCfgArgRawZ(argList, cfgOptPgHost, BOGUS_STR);
|
||||||
harnessCfgLoadRaw(strLstSize(argList), strLstPtr(argList));
|
HRN_CFG_LOAD(cfgCmdArchiveGet, argList, .exeBogus = true);
|
||||||
|
|
||||||
TEST_ERROR(cmdArchiveGet(), HostInvalidError, "archive-get command must be run on the PostgreSQL host");
|
TEST_ERROR(cmdArchiveGet(), HostInvalidError, "archive-get command must be run on the PostgreSQL host");
|
||||||
|
|
||||||
// -------------------------------------------------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------------------------------------------------
|
||||||
argList = strLstDup(argBaseList);
|
argList = strLstDup(argBaseList);
|
||||||
harnessCfgLoadRaw(strLstSize(argList), strLstPtr(argList));
|
HRN_CFG_LOAD(cfgCmdArchiveGet, argList, .exeBogus = true);
|
||||||
|
|
||||||
TEST_ERROR(cmdArchiveGet(), ParamRequiredError, "WAL segment to get required");
|
TEST_ERROR(cmdArchiveGet(), ParamRequiredError, "WAL segment to get required");
|
||||||
|
|
||||||
// -------------------------------------------------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------------------------------------------------
|
||||||
argList = strLstDup(argBaseList);
|
argList = strLstDup(argBaseList);
|
||||||
strLstAddZ(argList, "000000010000000100000001");
|
strLstAddZ(argList, "000000010000000100000001");
|
||||||
harnessCfgLoadRaw(strLstSize(argList), strLstPtr(argList));
|
HRN_CFG_LOAD(cfgCmdArchiveGet, argList, .exeBogus = true);
|
||||||
|
|
||||||
TEST_ERROR(cmdArchiveGet(), ParamRequiredError, "path to copy WAL segment required");
|
TEST_ERROR(cmdArchiveGet(), ParamRequiredError, "path to copy WAL segment required");
|
||||||
|
|
||||||
@ -605,7 +600,7 @@ testRun(void)
|
|||||||
hrnPgControlToBuffer((PgControl){.version = PG_VERSION_10, .systemId = 0xFACEFACEFACEFACE}));
|
hrnPgControlToBuffer((PgControl){.version = PG_VERSION_10, .systemId = 0xFACEFACEFACEFACE}));
|
||||||
|
|
||||||
strLstAddZ(argList, TEST_PATH_PG "/pg_wal/RECOVERYXLOG");
|
strLstAddZ(argList, TEST_PATH_PG "/pg_wal/RECOVERYXLOG");
|
||||||
harnessCfgLoadRaw(strLstSize(argList), strLstPtr(argList));
|
HRN_CFG_LOAD(cfgCmdArchiveGet, argList, .exeBogus = true);
|
||||||
|
|
||||||
TEST_ERROR(cmdArchiveGet(), RepoInvalidError, "unable to find a valid repository");
|
TEST_ERROR(cmdArchiveGet(), RepoInvalidError, "unable to find a valid repository");
|
||||||
|
|
||||||
@ -626,7 +621,7 @@ testRun(void)
|
|||||||
strLstAddZ(argList, "00000001.history");
|
strLstAddZ(argList, "00000001.history");
|
||||||
strLstAddZ(argList, TEST_PATH_PG "/pg_wal/RECOVERYHISTORY");
|
strLstAddZ(argList, TEST_PATH_PG "/pg_wal/RECOVERYHISTORY");
|
||||||
strLstAddZ(argList, "--archive-async");
|
strLstAddZ(argList, "--archive-async");
|
||||||
harnessCfgLoadRaw(strLstSize(argList), strLstPtr(argList));
|
HRN_CFG_LOAD(cfgCmdArchiveGet, argList, .exeBogus = true);
|
||||||
|
|
||||||
TEST_ERROR(cmdArchiveGet(), RepoInvalidError, "unable to find a valid repository");
|
TEST_ERROR(cmdArchiveGet(), RepoInvalidError, "unable to find a valid repository");
|
||||||
|
|
||||||
@ -649,7 +644,7 @@ testRun(void)
|
|||||||
hrnCfgArgRawBool(argList, cfgOptArchiveAsync, true);
|
hrnCfgArgRawBool(argList, cfgOptArchiveAsync, true);
|
||||||
strLstAddZ(argList, "000000010000000100000001");
|
strLstAddZ(argList, "000000010000000100000001");
|
||||||
strLstAddZ(argList, "pg_wal/RECOVERYXLOG");
|
strLstAddZ(argList, "pg_wal/RECOVERYXLOG");
|
||||||
harnessCfgLoadRaw(strLstSize(argList), strLstPtr(argList));
|
HRN_CFG_LOAD(cfgCmdArchiveGet, argList, .exeBogus = true);
|
||||||
|
|
||||||
THROW_ON_SYS_ERROR(chdir(strZ(cfgOptionStr(cfgOptPgPath))) != 0, PathMissingError, "unable to chdir()");
|
THROW_ON_SYS_ERROR(chdir(strZ(cfgOptionStr(cfgOptPgPath))) != 0, PathMissingError, "unable to chdir()");
|
||||||
|
|
||||||
@ -684,7 +679,7 @@ testRun(void)
|
|||||||
// Write more WAL segments (in this case queue should be full)
|
// Write more WAL segments (in this case queue should be full)
|
||||||
// -------------------------------------------------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------------------------------------------------
|
||||||
strLstAddZ(argList, "--archive-get-queue-max=48");
|
strLstAddZ(argList, "--archive-get-queue-max=48");
|
||||||
harnessCfgLoadRaw(strLstSize(argList), strLstPtr(argList));
|
HRN_CFG_LOAD(cfgCmdArchiveGet, argList, .exeBogus = true);
|
||||||
|
|
||||||
HRN_STORAGE_PUT_Z(storageSpoolWrite(), STORAGE_SPOOL_ARCHIVE_IN "/000000010000000100000001", "SHOULD-BE-A-REAL-WAL-FILE");
|
HRN_STORAGE_PUT_Z(storageSpoolWrite(), STORAGE_SPOOL_ARCHIVE_IN "/000000010000000100000001", "SHOULD-BE-A-REAL-WAL-FILE");
|
||||||
HRN_STORAGE_PUT_Z(storageSpoolWrite(), STORAGE_SPOOL_ARCHIVE_IN "/000000010000000100000001.ok", "0\nwarning about x");
|
HRN_STORAGE_PUT_Z(storageSpoolWrite(), STORAGE_SPOOL_ARCHIVE_IN "/000000010000000100000001.ok", "0\nwarning about x");
|
||||||
@ -749,7 +744,7 @@ testRun(void)
|
|||||||
|
|
||||||
// -------------------------------------------------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------------------------------------------------
|
||||||
strLstAddZ(argList, BOGUS_STR);
|
strLstAddZ(argList, BOGUS_STR);
|
||||||
harnessCfgLoadRaw(strLstSize(argList), strLstPtr(argList));
|
HRN_CFG_LOAD(cfgCmdArchiveGet, argList, .exeBogus = true);
|
||||||
|
|
||||||
TEST_ERROR(cmdArchiveGet(), ParamInvalidError, "extra parameters found");
|
TEST_ERROR(cmdArchiveGet(), ParamInvalidError, "extra parameters found");
|
||||||
|
|
||||||
@ -776,7 +771,7 @@ testRun(void)
|
|||||||
argList = strLstDup(argBaseList);
|
argList = strLstDup(argBaseList);
|
||||||
strLstAddZ(argList, "01ABCDEF01ABCDEF01ABCDEF");
|
strLstAddZ(argList, "01ABCDEF01ABCDEF01ABCDEF");
|
||||||
strLstAddZ(argList, TEST_PATH_PG "/pg_wal/RECOVERYXLOG");
|
strLstAddZ(argList, TEST_PATH_PG "/pg_wal/RECOVERYXLOG");
|
||||||
harnessCfgLoad(cfgCmdArchiveGet, argList);
|
HRN_CFG_LOAD(cfgCmdArchiveGet, argList);
|
||||||
|
|
||||||
TEST_ERROR(cmdArchiveGet(), RepoInvalidError, "unable to find a valid repository");
|
TEST_ERROR(cmdArchiveGet(), RepoInvalidError, "unable to find a valid repository");
|
||||||
|
|
||||||
@ -896,7 +891,7 @@ testRun(void)
|
|||||||
argList = strLstDup(argBaseList);
|
argList = strLstDup(argBaseList);
|
||||||
strLstAddZ(argList, "000000010000000100000001.partial");
|
strLstAddZ(argList, "000000010000000100000001.partial");
|
||||||
strLstAddZ(argList, TEST_PATH_PG "/pg_wal/RECOVERYXLOG");
|
strLstAddZ(argList, TEST_PATH_PG "/pg_wal/RECOVERYXLOG");
|
||||||
harnessCfgLoad(cfgCmdArchiveGet, argList);
|
HRN_CFG_LOAD(cfgCmdArchiveGet, argList);
|
||||||
|
|
||||||
TEST_RESULT_INT(cmdArchiveGet(), 0, "get");
|
TEST_RESULT_INT(cmdArchiveGet(), 0, "get");
|
||||||
|
|
||||||
@ -913,7 +908,7 @@ testRun(void)
|
|||||||
argList = strLstDup(argBaseList);
|
argList = strLstDup(argBaseList);
|
||||||
strLstAddZ(argList, "00000001.history");
|
strLstAddZ(argList, "00000001.history");
|
||||||
strLstAddZ(argList, TEST_PATH_PG "/pg_wal/RECOVERYHISTORY");
|
strLstAddZ(argList, TEST_PATH_PG "/pg_wal/RECOVERYHISTORY");
|
||||||
harnessCfgLoad(cfgCmdArchiveGet, argList);
|
HRN_CFG_LOAD(cfgCmdArchiveGet, argList);
|
||||||
|
|
||||||
TEST_RESULT_INT(cmdArchiveGet(), 1, "get");
|
TEST_RESULT_INT(cmdArchiveGet(), 1, "get");
|
||||||
|
|
||||||
@ -962,7 +957,7 @@ testRun(void)
|
|||||||
hrnCfgArgRawZ(argList, cfgOptStanza, "test1");
|
hrnCfgArgRawZ(argList, cfgOptStanza, "test1");
|
||||||
strLstAddZ(argList, "01ABCDEF01ABCDEF01ABCDEF");
|
strLstAddZ(argList, "01ABCDEF01ABCDEF01ABCDEF");
|
||||||
strLstAddZ(argList, TEST_PATH_PG "/pg_wal/RECOVERYXLOG");
|
strLstAddZ(argList, TEST_PATH_PG "/pg_wal/RECOVERYXLOG");
|
||||||
harnessCfgLoad(cfgCmdArchiveGet, argList);
|
HRN_CFG_LOAD(cfgCmdArchiveGet, argList);
|
||||||
hrnCfgEnvKeyRemoveRaw(cfgOptRepoCipherPass, 2);
|
hrnCfgEnvKeyRemoveRaw(cfgOptRepoCipherPass, 2);
|
||||||
|
|
||||||
TEST_RESULT_INT(cmdArchiveGet(), 0, "get");
|
TEST_RESULT_INT(cmdArchiveGet(), 0, "get");
|
||||||
@ -1061,7 +1056,7 @@ testRun(void)
|
|||||||
|
|
||||||
hrnCfgArgRawZ(argList, cfgOptRepo, "2");
|
hrnCfgArgRawZ(argList, cfgOptRepo, "2");
|
||||||
hrnCfgEnvKeyRawZ(cfgOptRepoCipherPass, 2, TEST_CIPHER_PASS);
|
hrnCfgEnvKeyRawZ(cfgOptRepoCipherPass, 2, TEST_CIPHER_PASS);
|
||||||
harnessCfgLoad(cfgCmdArchiveGet, argList);
|
HRN_CFG_LOAD(cfgCmdArchiveGet, argList);
|
||||||
hrnCfgEnvKeyRemoveRaw(cfgOptRepoCipherPass, 2);
|
hrnCfgEnvKeyRemoveRaw(cfgOptRepoCipherPass, 2);
|
||||||
|
|
||||||
TEST_RESULT_INT(cmdArchiveGet(), 0, "get");
|
TEST_RESULT_INT(cmdArchiveGet(), 0, "get");
|
||||||
@ -1081,7 +1076,7 @@ testRun(void)
|
|||||||
hrnCfgArgRawBool(argList, cfgOptArchiveAsync, true);
|
hrnCfgArgRawBool(argList, cfgOptArchiveAsync, true);
|
||||||
strLstAddZ(argList, "000000010000000100000001");
|
strLstAddZ(argList, "000000010000000100000001");
|
||||||
strLstAddZ(argList, "pg_wal/RECOVERYXLOG");
|
strLstAddZ(argList, "pg_wal/RECOVERYXLOG");
|
||||||
harnessCfgLoad(cfgCmdArchiveGet, argList);
|
HRN_CFG_LOAD(cfgCmdArchiveGet, argList);
|
||||||
|
|
||||||
HRN_INFO_PUT(
|
HRN_INFO_PUT(
|
||||||
storageRepoIdxWrite(0), INFO_ARCHIVE_PATH_FILE,
|
storageRepoIdxWrite(0), INFO_ARCHIVE_PATH_FILE,
|
||||||
|
@ -32,7 +32,7 @@ testRun(void)
|
|||||||
strLstAddZ(argList, "--pg1-path=" TEST_PATH "/db");
|
strLstAddZ(argList, "--pg1-path=" TEST_PATH "/db");
|
||||||
strLstAddZ(argList, "--spool-path=" TEST_PATH "/spool");
|
strLstAddZ(argList, "--spool-path=" TEST_PATH "/spool");
|
||||||
strLstAddZ(argList, "--" CFGOPT_ARCHIVE_ASYNC);
|
strLstAddZ(argList, "--" CFGOPT_ARCHIVE_ASYNC);
|
||||||
harnessCfgLoadRole(cfgCmdArchivePush, cfgCmdRoleAsync, argList);
|
HRN_CFG_LOAD(cfgCmdArchivePush, argList, .role = cfgCmdRoleAsync);
|
||||||
|
|
||||||
storagePathCreateP(storagePgWrite(), STRDEF("pg_wal/archive_status"));
|
storagePathCreateP(storagePgWrite(), STRDEF("pg_wal/archive_status"));
|
||||||
storagePathCreateP(storageTest, STRDEF("spool/archive/db/out"));
|
storagePathCreateP(storageTest, STRDEF("spool/archive/db/out"));
|
||||||
@ -69,7 +69,7 @@ testRun(void)
|
|||||||
// -------------------------------------------------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------------------------------------------------
|
||||||
StringList *argListDrop = strLstDup(argList);
|
StringList *argListDrop = strLstDup(argList);
|
||||||
strLstAdd(argListDrop, strNewFmt("--archive-push-queue-max=%zu", (size_t)1024 * 1024 * 1024));
|
strLstAdd(argListDrop, strNewFmt("--archive-push-queue-max=%zu", (size_t)1024 * 1024 * 1024));
|
||||||
harnessCfgLoadRole(cfgCmdArchivePush, cfgCmdRoleAsync, argListDrop);
|
HRN_CFG_LOAD(cfgCmdArchivePush, argListDrop, .role = cfgCmdRoleAsync);
|
||||||
|
|
||||||
// Write the files that we claim are in pg_wal
|
// Write the files that we claim are in pg_wal
|
||||||
Buffer *walBuffer = bufNew((size_t)16 * 1024 * 1024);
|
Buffer *walBuffer = bufNew((size_t)16 * 1024 * 1024);
|
||||||
@ -90,7 +90,7 @@ testRun(void)
|
|||||||
// Now set queue max low enough that WAL will be dropped
|
// Now set queue max low enough that WAL will be dropped
|
||||||
argListDrop = strLstDup(argList);
|
argListDrop = strLstDup(argList);
|
||||||
strLstAdd(argListDrop, strNewFmt("--archive-push-queue-max=%zu", (size_t)16 * 1024 * 1024 * 2));
|
strLstAdd(argListDrop, strNewFmt("--archive-push-queue-max=%zu", (size_t)16 * 1024 * 1024 * 2));
|
||||||
harnessCfgLoadRole(cfgCmdArchivePush, cfgCmdRoleAsync, argListDrop);
|
HRN_CFG_LOAD(cfgCmdArchivePush, argListDrop, .role = cfgCmdRoleAsync);
|
||||||
|
|
||||||
TEST_RESULT_BOOL(
|
TEST_RESULT_BOOL(
|
||||||
archivePushDrop(STRDEF("pg_wal"), archivePushProcessList(STRDEF(TEST_PATH "/db/pg_wal"))), true,
|
archivePushDrop(STRDEF("pg_wal"), archivePushProcessList(STRDEF(TEST_PATH "/db/pg_wal"))), true,
|
||||||
@ -104,7 +104,7 @@ testRun(void)
|
|||||||
strLstAddZ(argList, "--stanza=test");
|
strLstAddZ(argList, "--stanza=test");
|
||||||
strLstAddZ(argList, "--pg1-path=" TEST_PATH "/pg");
|
strLstAddZ(argList, "--pg1-path=" TEST_PATH "/pg");
|
||||||
strLstAddZ(argList, "--repo1-path=" TEST_PATH "/repo");
|
strLstAddZ(argList, "--repo1-path=" TEST_PATH "/repo");
|
||||||
harnessCfgLoad(cfgCmdArchivePush, argList);
|
HRN_CFG_LOAD(cfgCmdArchivePush, argList);
|
||||||
|
|
||||||
// Check mismatched pg_control and archive.info
|
// Check mismatched pg_control and archive.info
|
||||||
// -------------------------------------------------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------------------------------------------------
|
||||||
@ -175,7 +175,7 @@ testRun(void)
|
|||||||
strLstAddZ(argList, "--stanza=test");
|
strLstAddZ(argList, "--stanza=test");
|
||||||
strLstAddZ(argList, "--repo2-path=" TEST_PATH "/repo2");
|
strLstAddZ(argList, "--repo2-path=" TEST_PATH "/repo2");
|
||||||
strLstAddZ(argList, "--repo4-path=" TEST_PATH "/repo4");
|
strLstAddZ(argList, "--repo4-path=" TEST_PATH "/repo4");
|
||||||
harnessCfgLoad(cfgCmdArchivePush, argList);
|
HRN_CFG_LOAD(cfgCmdArchivePush, argList);
|
||||||
|
|
||||||
// repo2 has correct info
|
// repo2 has correct info
|
||||||
storagePutP(
|
storagePutP(
|
||||||
@ -255,21 +255,21 @@ testRun(void)
|
|||||||
hrnCfgArgRawZ(argList, cfgOptPgHost, "host");
|
hrnCfgArgRawZ(argList, cfgOptPgHost, "host");
|
||||||
hrnCfgArgRawZ(argList, cfgOptPgPath, "/pg");
|
hrnCfgArgRawZ(argList, cfgOptPgPath, "/pg");
|
||||||
strLstAddZ(argList, "--" CFGOPT_STANZA "=test2");
|
strLstAddZ(argList, "--" CFGOPT_STANZA "=test2");
|
||||||
harnessCfgLoadRole(cfgCmdArchivePush, cfgCmdRoleMain, argList);
|
HRN_CFG_LOAD(cfgCmdArchivePush, argList, .role = cfgCmdRoleMain);
|
||||||
|
|
||||||
TEST_ERROR(cmdArchivePush(), HostInvalidError, "archive-push command must be run on the PostgreSQL host");
|
TEST_ERROR(cmdArchivePush(), HostInvalidError, "archive-push command must be run on the PostgreSQL host");
|
||||||
|
|
||||||
// -------------------------------------------------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------------------------------------------------
|
||||||
argList = strLstNew();
|
argList = strLstNew();
|
||||||
strLstAddZ(argList, "--stanza=test");
|
strLstAddZ(argList, "--stanza=test");
|
||||||
harnessCfgLoad(cfgCmdArchivePush, argList);
|
HRN_CFG_LOAD(cfgCmdArchivePush, argList);
|
||||||
|
|
||||||
TEST_ERROR(cmdArchivePush(), ParamRequiredError, "WAL segment to push required");
|
TEST_ERROR(cmdArchivePush(), ParamRequiredError, "WAL segment to push required");
|
||||||
|
|
||||||
// -------------------------------------------------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------------------------------------------------
|
||||||
StringList *argListTemp = strLstDup(argList);
|
StringList *argListTemp = strLstDup(argList);
|
||||||
strLstAddZ(argListTemp, "pg_wal/000000010000000100000001");
|
strLstAddZ(argListTemp, "pg_wal/000000010000000100000001");
|
||||||
harnessCfgLoad(cfgCmdArchivePush, argListTemp);
|
HRN_CFG_LOAD(cfgCmdArchivePush, argListTemp);
|
||||||
|
|
||||||
TEST_ERROR(
|
TEST_ERROR(
|
||||||
cmdArchivePush(), OptionRequiredError,
|
cmdArchivePush(), OptionRequiredError,
|
||||||
@ -284,7 +284,7 @@ testRun(void)
|
|||||||
|
|
||||||
argListTemp = strLstDup(argList);
|
argListTemp = strLstDup(argList);
|
||||||
strLstAddZ(argListTemp, "pg_wal/000000010000000100000001");
|
strLstAddZ(argListTemp, "pg_wal/000000010000000100000001");
|
||||||
harnessCfgLoad(cfgCmdArchivePush, argListTemp);
|
HRN_CFG_LOAD(cfgCmdArchivePush, argListTemp);
|
||||||
|
|
||||||
storagePutP(
|
storagePutP(
|
||||||
storageNewWriteP(storageTest, STRDEF("pg/" PG_PATH_GLOBAL "/" PG_FILE_PGCONTROL)),
|
storageNewWriteP(storageTest, STRDEF("pg/" PG_PATH_GLOBAL "/" PG_FILE_PGCONTROL)),
|
||||||
@ -332,7 +332,7 @@ testRun(void)
|
|||||||
argListTemp = strLstDup(argList);
|
argListTemp = strLstDup(argList);
|
||||||
hrnCfgArgRawNegate(argListTemp, cfgOptArchiveHeaderCheck);
|
hrnCfgArgRawNegate(argListTemp, cfgOptArchiveHeaderCheck);
|
||||||
strLstAddZ(argListTemp, "pg_wal/000000010000000100000001");
|
strLstAddZ(argListTemp, "pg_wal/000000010000000100000001");
|
||||||
harnessCfgLoad(cfgCmdArchivePush, argListTemp);
|
HRN_CFG_LOAD(cfgCmdArchivePush, argListTemp);
|
||||||
|
|
||||||
TEST_RESULT_VOID(cmdArchivePush(), "push the WAL segment");
|
TEST_RESULT_VOID(cmdArchivePush(), "push the WAL segment");
|
||||||
TEST_RESULT_LOG("P00 INFO: pushed WAL file '000000010000000100000001' to the archive");
|
TEST_RESULT_LOG("P00 INFO: pushed WAL file '000000010000000100000001' to the archive");
|
||||||
@ -349,7 +349,7 @@ testRun(void)
|
|||||||
// -------------------------------------------------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------------------------------------------------
|
||||||
argListTemp = strLstDup(argList);
|
argListTemp = strLstDup(argList);
|
||||||
strLstAddZ(argListTemp, "pg_wal/000000010000000100000001");
|
strLstAddZ(argListTemp, "pg_wal/000000010000000100000001");
|
||||||
harnessCfgLoad(cfgCmdArchivePush, argListTemp);
|
HRN_CFG_LOAD(cfgCmdArchivePush, argListTemp);
|
||||||
|
|
||||||
memset(bufPtr(walBuffer1), 0, bufSize(walBuffer1));
|
memset(bufPtr(walBuffer1), 0, bufSize(walBuffer1));
|
||||||
hrnPgWalToBuffer((PgWal){.version = PG_VERSION_11, .systemId = 0xFACEFACEFACEFACE}, walBuffer1);
|
hrnPgWalToBuffer((PgWal){.version = PG_VERSION_11, .systemId = 0xFACEFACEFACEFACE}, walBuffer1);
|
||||||
@ -396,7 +396,7 @@ testRun(void)
|
|||||||
strLstAddZ(argListTemp, "--" CFGOPT_STANZA "=test");
|
strLstAddZ(argListTemp, "--" CFGOPT_STANZA "=test");
|
||||||
hrnCfgArgRawZ(argListTemp, cfgOptRepoPath, TEST_PATH "/repo");
|
hrnCfgArgRawZ(argListTemp, cfgOptRepoPath, TEST_PATH "/repo");
|
||||||
strLstAddZ(argListTemp, TEST_PATH "/pg/pg_wal/000000010000000100000002");
|
strLstAddZ(argListTemp, TEST_PATH "/pg/pg_wal/000000010000000100000002");
|
||||||
harnessCfgLoad(cfgCmdArchivePush, argListTemp);
|
HRN_CFG_LOAD(cfgCmdArchivePush, argListTemp);
|
||||||
|
|
||||||
TEST_RESULT_VOID(
|
TEST_RESULT_VOID(
|
||||||
storagePutP(storageNewWriteP(storageTest, STRDEF("pg/pg_wal/000000010000000100000002")), walBuffer2), "write WAL");
|
storagePutP(storageNewWriteP(storageTest, STRDEF("pg/pg_wal/000000010000000100000002")), walBuffer2), "write WAL");
|
||||||
@ -428,7 +428,7 @@ testRun(void)
|
|||||||
// -------------------------------------------------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------------------------------------------------
|
||||||
argListTemp = strLstDup(argList);
|
argListTemp = strLstDup(argList);
|
||||||
strLstAddZ(argListTemp, "pg_wal/00000001.history");
|
strLstAddZ(argListTemp, "pg_wal/00000001.history");
|
||||||
harnessCfgLoad(cfgCmdArchivePush, argListTemp);
|
HRN_CFG_LOAD(cfgCmdArchivePush, argListTemp);
|
||||||
|
|
||||||
storagePutP(storageNewWriteP(storagePgWrite(), STRDEF("pg_wal/00000001.history")), BUFSTRDEF("FAKEHISTORY"));
|
storagePutP(storageNewWriteP(storagePgWrite(), STRDEF("pg_wal/00000001.history")), BUFSTRDEF("FAKEHISTORY"));
|
||||||
|
|
||||||
@ -446,7 +446,7 @@ testRun(void)
|
|||||||
argListTemp = strLstDup(argList);
|
argListTemp = strLstDup(argList);
|
||||||
strLstAddZ(argListTemp, "--archive-push-queue-max=16m");
|
strLstAddZ(argListTemp, "--archive-push-queue-max=16m");
|
||||||
strLstAddZ(argListTemp, "pg_wal/000000010000000100000002");
|
strLstAddZ(argListTemp, "pg_wal/000000010000000100000002");
|
||||||
harnessCfgLoad(cfgCmdArchivePush, argListTemp);
|
HRN_CFG_LOAD(cfgCmdArchivePush, argListTemp);
|
||||||
|
|
||||||
TEST_RESULT_VOID(cmdArchivePush(), "drop WAL file");
|
TEST_RESULT_VOID(cmdArchivePush(), "drop WAL file");
|
||||||
TEST_RESULT_LOG("P00 WARN: dropped WAL file '000000010000000100000002' because archive queue exceeded 16MB");
|
TEST_RESULT_LOG("P00 WARN: dropped WAL file '000000010000000100000002' because archive queue exceeded 16MB");
|
||||||
@ -454,7 +454,7 @@ testRun(void)
|
|||||||
argListTemp = strLstDup(argList);
|
argListTemp = strLstDup(argList);
|
||||||
strLstAddZ(argListTemp, "--archive-push-queue-max=1GB");
|
strLstAddZ(argListTemp, "--archive-push-queue-max=1GB");
|
||||||
strLstAddZ(argListTemp, "pg_wal/000000010000000100000002");
|
strLstAddZ(argListTemp, "pg_wal/000000010000000100000002");
|
||||||
harnessCfgLoad(cfgCmdArchivePush, argListTemp);
|
HRN_CFG_LOAD(cfgCmdArchivePush, argListTemp);
|
||||||
|
|
||||||
TEST_RESULT_VOID(cmdArchivePush(), "push WAL file again");
|
TEST_RESULT_VOID(cmdArchivePush(), "push WAL file again");
|
||||||
TEST_RESULT_LOG(
|
TEST_RESULT_LOG(
|
||||||
@ -507,7 +507,7 @@ testRun(void)
|
|||||||
hrnCfgArgKeyRawZ(argListTemp, cfgOptRepoPath, 3, TEST_PATH "/repo3");
|
hrnCfgArgKeyRawZ(argListTemp, cfgOptRepoPath, 3, TEST_PATH "/repo3");
|
||||||
hrnCfgArgRawNegate(argListTemp, cfgOptCompress);
|
hrnCfgArgRawNegate(argListTemp, cfgOptCompress);
|
||||||
strLstAddZ(argListTemp, "pg_wal/000000010000000100000002");
|
strLstAddZ(argListTemp, "pg_wal/000000010000000100000002");
|
||||||
harnessCfgLoad(cfgCmdArchivePush, argListTemp);
|
HRN_CFG_LOAD(cfgCmdArchivePush, argListTemp);
|
||||||
hrnCfgEnvKeyRemoveRaw(cfgOptRepoCipherPass, 2);
|
hrnCfgEnvKeyRemoveRaw(cfgOptRepoCipherPass, 2);
|
||||||
|
|
||||||
TEST_RESULT_VOID(cmdArchivePush(), "push the WAL segment");
|
TEST_RESULT_VOID(cmdArchivePush(), "push the WAL segment");
|
||||||
@ -642,7 +642,7 @@ testRun(void)
|
|||||||
strLstAddZ(argList, "--" CFGOPT_SPOOL_PATH "=/spool");
|
strLstAddZ(argList, "--" CFGOPT_SPOOL_PATH "=/spool");
|
||||||
strLstAddZ(argList, "--" CFGOPT_STANZA "=test2");
|
strLstAddZ(argList, "--" CFGOPT_STANZA "=test2");
|
||||||
strLstAddZ(argList, "--" CFGOPT_ARCHIVE_ASYNC);
|
strLstAddZ(argList, "--" CFGOPT_ARCHIVE_ASYNC);
|
||||||
harnessCfgLoadRole(cfgCmdArchivePush, cfgCmdRoleAsync, argList);
|
HRN_CFG_LOAD(cfgCmdArchivePush, argList, .role = cfgCmdRoleAsync);
|
||||||
|
|
||||||
TEST_ERROR(cmdArchivePush(), HostInvalidError, "archive-push command must be run on the PostgreSQL host");
|
TEST_ERROR(cmdArchivePush(), HostInvalidError, "archive-push command must be run on the PostgreSQL host");
|
||||||
|
|
||||||
@ -654,24 +654,21 @@ testRun(void)
|
|||||||
strLstAddZ(argList, "--" CFGOPT_STANZA "=test2");
|
strLstAddZ(argList, "--" CFGOPT_STANZA "=test2");
|
||||||
strLstAddZ(argList, "--" CFGOPT_ARCHIVE_ASYNC);
|
strLstAddZ(argList, "--" CFGOPT_ARCHIVE_ASYNC);
|
||||||
strLstAddZ(argList, "/000000010000000100000001");
|
strLstAddZ(argList, "/000000010000000100000001");
|
||||||
harnessCfgLoadRole(cfgCmdArchivePush, cfgCmdRoleAsync, argList);
|
HRN_CFG_LOAD(cfgCmdArchivePush, argList, .role = cfgCmdRoleAsync);
|
||||||
|
|
||||||
TEST_ERROR(cmdArchivePush(), OptionRequiredError, "'archive-push' command in async mode requires option 'pg1-path'");
|
TEST_ERROR(cmdArchivePush(), OptionRequiredError, "'archive-push' command in async mode requires option 'pg1-path'");
|
||||||
|
|
||||||
// Call with a bogus exe name so the async process will error out and we can make sure timeouts work
|
// Call with a bogus exe name so the async process will error out and we can make sure timeouts work
|
||||||
// -------------------------------------------------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------------------------------------------------
|
||||||
argList = strLstNew();
|
argList = strLstNew();
|
||||||
strLstAddZ(argList, "pgbackrest-bogus");
|
|
||||||
strLstAddZ(argList, "--stanza=test");
|
strLstAddZ(argList, "--stanza=test");
|
||||||
strLstAddZ(argList, "--archive-async");
|
strLstAddZ(argList, "--archive-async");
|
||||||
strLstAddZ(argList, "--archive-timeout=1");
|
strLstAddZ(argList, "--archive-timeout=1");
|
||||||
strLstAddZ(argList, "--lock-path=" TEST_PATH "/lock");
|
|
||||||
strLstAddZ(argList, "--spool-path=" TEST_PATH " /spool");
|
strLstAddZ(argList, "--spool-path=" TEST_PATH " /spool");
|
||||||
strLstAddZ(argList, "--pg1-path=" TEST_PATH "/pg");
|
strLstAddZ(argList, "--pg1-path=" TEST_PATH "/pg");
|
||||||
strLstAddZ(argList, "--repo1-path=" TEST_PATH "/repo");
|
strLstAddZ(argList, "--repo1-path=" TEST_PATH "/repo");
|
||||||
strLstAddZ(argList, "archive-push");
|
|
||||||
strLstAddZ(argList, "pg_wal/bogus");
|
strLstAddZ(argList, "pg_wal/bogus");
|
||||||
harnessCfgLoadRaw(strLstSize(argList), strLstPtr(argList));
|
HRN_CFG_LOAD(cfgCmdArchivePush, argList, .exeBogus = true);
|
||||||
|
|
||||||
storagePathCreateP(storageTest, cfgOptionStr(cfgOptPgPath));
|
storagePathCreateP(storageTest, cfgOptionStr(cfgOptPgPath));
|
||||||
THROW_ON_SYS_ERROR(chdir(strZ(cfgOptionStr(cfgOptPgPath))) != 0, PathMissingError, "unable to chdir()");
|
THROW_ON_SYS_ERROR(chdir(strZ(cfgOptionStr(cfgOptPgPath))) != 0, PathMissingError, "unable to chdir()");
|
||||||
@ -708,7 +705,7 @@ testRun(void)
|
|||||||
// -------------------------------------------------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------------------------------------------------
|
||||||
StringList *argListTemp = strLstDup(argList);
|
StringList *argListTemp = strLstDup(argList);
|
||||||
strLstAddZ(argListTemp, TEST_PATH "/pg/pg_xlog/000000010000000100000001");
|
strLstAddZ(argListTemp, TEST_PATH "/pg/pg_xlog/000000010000000100000001");
|
||||||
harnessCfgLoad(cfgCmdArchivePush, argListTemp);
|
HRN_CFG_LOAD(cfgCmdArchivePush, argListTemp);
|
||||||
|
|
||||||
storagePathCreateP(storagePgWrite(), STRDEF("pg_xlog/archive_status"));
|
storagePathCreateP(storagePgWrite(), STRDEF("pg_xlog/archive_status"));
|
||||||
|
|
||||||
@ -725,7 +722,7 @@ testRun(void)
|
|||||||
argListTemp = strLstDup(argList);
|
argListTemp = strLstDup(argList);
|
||||||
strLstAddZ(argListTemp, TEST_PATH "/pg/pg_xlog/000000010000000100000001");
|
strLstAddZ(argListTemp, TEST_PATH "/pg/pg_xlog/000000010000000100000001");
|
||||||
strLstAddZ(argListTemp, "--archive-timeout=1");
|
strLstAddZ(argListTemp, "--archive-timeout=1");
|
||||||
harnessCfgLoad(cfgCmdArchivePush, argListTemp);
|
HRN_CFG_LOAD(cfgCmdArchivePush, argListTemp);
|
||||||
|
|
||||||
THROW_ON_SYS_ERROR(chdir(strZ(cfgOptionStr(cfgOptPgPath))) != 0, PathMissingError, "unable to chdir()");
|
THROW_ON_SYS_ERROR(chdir(strZ(cfgOptionStr(cfgOptPgPath))) != 0, PathMissingError, "unable to chdir()");
|
||||||
|
|
||||||
@ -776,7 +773,7 @@ testRun(void)
|
|||||||
// -------------------------------------------------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------------------------------------------------
|
||||||
argListTemp = strLstDup(argList);
|
argListTemp = strLstDup(argList);
|
||||||
strLstAddZ(argListTemp, TEST_PATH "/pg/pg_xlog/000000010000000100000001");
|
strLstAddZ(argListTemp, TEST_PATH "/pg/pg_xlog/000000010000000100000001");
|
||||||
harnessCfgLoad(cfgCmdArchivePush, argListTemp);
|
HRN_CFG_LOAD(cfgCmdArchivePush, argListTemp);
|
||||||
|
|
||||||
storagePutP(storageNewWriteP(storagePgWrite(), STRDEF("pg_xlog/archive_status/000000010000000100000001.ready")), NULL);
|
storagePutP(storageNewWriteP(storagePgWrite(), STRDEF("pg_xlog/archive_status/000000010000000100000001.ready")), NULL);
|
||||||
|
|
||||||
@ -806,7 +803,7 @@ testRun(void)
|
|||||||
strLstAddZ(argList, "--pg1-path=" TEST_PATH "/pg");
|
strLstAddZ(argList, "--pg1-path=" TEST_PATH "/pg");
|
||||||
strLstAddZ(argList, "--repo1-path=" TEST_PATH "/repo");
|
strLstAddZ(argList, "--repo1-path=" TEST_PATH "/repo");
|
||||||
strLstAddZ(argList, "--log-subprocess");
|
strLstAddZ(argList, "--log-subprocess");
|
||||||
harnessCfgLoadRole(cfgCmdArchivePush, cfgCmdRoleAsync, argList);
|
HRN_CFG_LOAD(cfgCmdArchivePush, argList, .role = cfgCmdRoleAsync);
|
||||||
|
|
||||||
TEST_ERROR(cmdArchivePushAsync(), ParamRequiredError, "WAL path to push required");
|
TEST_ERROR(cmdArchivePushAsync(), ParamRequiredError, "WAL path to push required");
|
||||||
|
|
||||||
@ -820,7 +817,7 @@ testRun(void)
|
|||||||
storagePathCreateP(storagePgWrite(), STRDEF("pg_xlog/archive_status"));
|
storagePathCreateP(storagePgWrite(), STRDEF("pg_xlog/archive_status"));
|
||||||
|
|
||||||
strLstAddZ(argList, TEST_PATH "/pg/pg_xlog");
|
strLstAddZ(argList, TEST_PATH "/pg/pg_xlog");
|
||||||
harnessCfgLoadRole(cfgCmdArchivePush, cfgCmdRoleAsync, argList);
|
HRN_CFG_LOAD(cfgCmdArchivePush, argList, .role = cfgCmdRoleAsync);
|
||||||
|
|
||||||
TEST_ERROR(cmdArchivePushAsync(), AssertError, "no WAL files to process");
|
TEST_ERROR(cmdArchivePushAsync(), AssertError, "no WAL files to process");
|
||||||
|
|
||||||
@ -837,7 +834,7 @@ testRun(void)
|
|||||||
|
|
||||||
// Add repo3
|
// Add repo3
|
||||||
hrnCfgArgKeyRawZ(argList, cfgOptRepoPath, 3, TEST_PATH "/repo3");
|
hrnCfgArgKeyRawZ(argList, cfgOptRepoPath, 3, TEST_PATH "/repo3");
|
||||||
harnessCfgLoadRole(cfgCmdArchivePush, cfgCmdRoleAsync, argList);
|
HRN_CFG_LOAD(cfgCmdArchivePush, argList, .role = cfgCmdRoleAsync);
|
||||||
|
|
||||||
storagePutP(
|
storagePutP(
|
||||||
storageNewWriteP(storageTest, STRDEF("repo3/archive/test/archive.info")),
|
storageNewWriteP(storageTest, STRDEF("repo3/archive/test/archive.info")),
|
||||||
@ -897,7 +894,7 @@ testRun(void)
|
|||||||
|
|
||||||
argListTemp = strLstDup(argList);
|
argListTemp = strLstDup(argList);
|
||||||
strLstAddZ(argListTemp, "--archive-push-queue-max=1gb");
|
strLstAddZ(argListTemp, "--archive-push-queue-max=1gb");
|
||||||
harnessCfgLoadRole(cfgCmdArchivePush, cfgCmdRoleAsync, argListTemp);
|
HRN_CFG_LOAD(cfgCmdArchivePush, argListTemp, .role = cfgCmdRoleAsync);
|
||||||
|
|
||||||
TEST_RESULT_VOID(cmdArchivePushAsync(), "push WAL segments");
|
TEST_RESULT_VOID(cmdArchivePushAsync(), "push WAL segments");
|
||||||
TEST_RESULT_LOG(
|
TEST_RESULT_LOG(
|
||||||
@ -972,7 +969,7 @@ testRun(void)
|
|||||||
|
|
||||||
argListTemp = strLstDup(argList);
|
argListTemp = strLstDup(argList);
|
||||||
strLstAddZ(argListTemp, "--archive-push-queue-max=16m");
|
strLstAddZ(argListTemp, "--archive-push-queue-max=16m");
|
||||||
harnessCfgLoadRole(cfgCmdArchivePush, cfgCmdRoleAsync, argListTemp);
|
HRN_CFG_LOAD(cfgCmdArchivePush, argListTemp, .role = cfgCmdRoleAsync);
|
||||||
|
|
||||||
TEST_RESULT_VOID(cmdArchivePushAsync(), "push WAL segments");
|
TEST_RESULT_VOID(cmdArchivePushAsync(), "push WAL segments");
|
||||||
TEST_RESULT_LOG(
|
TEST_RESULT_LOG(
|
||||||
|
@ -474,7 +474,7 @@ testRun(void)
|
|||||||
strLstAddZ(argList, "--repo1-path=" TEST_PATH "/repo");
|
strLstAddZ(argList, "--repo1-path=" TEST_PATH "/repo");
|
||||||
strLstAddZ(argList, "--pg1-path=" TEST_PATH "/pg");
|
strLstAddZ(argList, "--pg1-path=" TEST_PATH "/pg");
|
||||||
strLstAddZ(argList, "--repo1-retention-full=1");
|
strLstAddZ(argList, "--repo1-retention-full=1");
|
||||||
harnessCfgLoad(cfgCmdBackup, argList);
|
HRN_CFG_LOAD(cfgCmdBackup, argList);
|
||||||
|
|
||||||
// Create the pg path
|
// Create the pg path
|
||||||
storagePathCreateP(storagePgWrite(), NULL, .mode = 0700);
|
storagePathCreateP(storagePgWrite(), NULL, .mode = 0700);
|
||||||
@ -748,7 +748,7 @@ testRun(void)
|
|||||||
strLstAddZ(argList, "--repo1-retention-full=1");
|
strLstAddZ(argList, "--repo1-retention-full=1");
|
||||||
strLstAddZ(argList, "--repo1-cipher-type=aes-256-cbc");
|
strLstAddZ(argList, "--repo1-cipher-type=aes-256-cbc");
|
||||||
setenv("PGBACKREST_REPO1_CIPHER_PASS", "12345678", true);
|
setenv("PGBACKREST_REPO1_CIPHER_PASS", "12345678", true);
|
||||||
harnessCfgLoad(cfgCmdBackup, argList);
|
HRN_CFG_LOAD(cfgCmdBackup, argList);
|
||||||
unsetenv("PGBACKREST_REPO1_CIPHER_PASS");
|
unsetenv("PGBACKREST_REPO1_CIPHER_PASS");
|
||||||
|
|
||||||
// Create the pg path
|
// Create the pg path
|
||||||
@ -837,7 +837,7 @@ testRun(void)
|
|||||||
hrnCfgArgRaw(argList, cfgOptRepoPath, repoPath);
|
hrnCfgArgRaw(argList, cfgOptRepoPath, repoPath);
|
||||||
hrnCfgArgRaw(argList, cfgOptPgPath, pg1Path);
|
hrnCfgArgRaw(argList, cfgOptPgPath, pg1Path);
|
||||||
hrnCfgArgRawZ(argList, cfgOptRepoRetentionFull, "1");
|
hrnCfgArgRawZ(argList, cfgOptRepoRetentionFull, "1");
|
||||||
harnessCfgLoad(cfgCmdBackup, argList);
|
HRN_CFG_LOAD(cfgCmdBackup, argList);
|
||||||
|
|
||||||
time_t timestamp = 1575401652;
|
time_t timestamp = 1575401652;
|
||||||
String *backupLabel = backupLabelFormat(backupTypeFull, NULL, timestamp);
|
String *backupLabel = backupLabelFormat(backupTypeFull, NULL, timestamp);
|
||||||
@ -918,7 +918,7 @@ testRun(void)
|
|||||||
hrnCfgArgRaw(argList, cfgOptPgPath, pg1Path);
|
hrnCfgArgRaw(argList, cfgOptPgPath, pg1Path);
|
||||||
hrnCfgArgRawZ(argList, cfgOptRepoRetentionFull, "1");
|
hrnCfgArgRawZ(argList, cfgOptRepoRetentionFull, "1");
|
||||||
strLstAddZ(argList, "--" CFGOPT_BACKUP_STANDBY);
|
strLstAddZ(argList, "--" CFGOPT_BACKUP_STANDBY);
|
||||||
harnessCfgLoad(cfgCmdBackup, argList);
|
HRN_CFG_LOAD(cfgCmdBackup, argList);
|
||||||
|
|
||||||
TEST_ERROR(
|
TEST_ERROR(
|
||||||
backupInit(infoBackupNew(PG_VERSION_91, 1000000000000000910, hrnPgCatalogVersion(PG_VERSION_91), NULL)), ConfigError,
|
backupInit(infoBackupNew(PG_VERSION_91, 1000000000000000910, hrnPgCatalogVersion(PG_VERSION_91), NULL)), ConfigError,
|
||||||
@ -939,7 +939,7 @@ testRun(void)
|
|||||||
hrnCfgArgRawZ(argList, cfgOptRepoRetentionFull, "1");
|
hrnCfgArgRawZ(argList, cfgOptRepoRetentionFull, "1");
|
||||||
strLstAddZ(argList, "--" CFGOPT_BACKUP_STANDBY);
|
strLstAddZ(argList, "--" CFGOPT_BACKUP_STANDBY);
|
||||||
strLstAddZ(argList, "--no-" CFGOPT_ONLINE);
|
strLstAddZ(argList, "--no-" CFGOPT_ONLINE);
|
||||||
harnessCfgLoad(cfgCmdBackup, argList);
|
HRN_CFG_LOAD(cfgCmdBackup, argList);
|
||||||
|
|
||||||
TEST_RESULT_VOID(
|
TEST_RESULT_VOID(
|
||||||
backupInit(infoBackupNew(PG_VERSION_92, 1000000000000000920, hrnPgCatalogVersion(PG_VERSION_92), NULL)),
|
backupInit(infoBackupNew(PG_VERSION_92, 1000000000000000920, hrnPgCatalogVersion(PG_VERSION_92), NULL)),
|
||||||
@ -963,7 +963,7 @@ testRun(void)
|
|||||||
hrnCfgArgRaw(argList, cfgOptPgPath, pg1Path);
|
hrnCfgArgRaw(argList, cfgOptPgPath, pg1Path);
|
||||||
hrnCfgArgRawZ(argList, cfgOptRepoRetentionFull, "1");
|
hrnCfgArgRawZ(argList, cfgOptRepoRetentionFull, "1");
|
||||||
strLstAddZ(argList, "--no-" CFGOPT_ONLINE);
|
strLstAddZ(argList, "--no-" CFGOPT_ONLINE);
|
||||||
harnessCfgLoad(cfgCmdBackup, argList);
|
HRN_CFG_LOAD(cfgCmdBackup, argList);
|
||||||
|
|
||||||
TEST_ERROR(
|
TEST_ERROR(
|
||||||
backupInit(infoBackupNew(PG_VERSION_11, 1000000000000001100, hrnPgCatalogVersion(PG_VERSION_11), NULL)),
|
backupInit(infoBackupNew(PG_VERSION_11, 1000000000000001100, hrnPgCatalogVersion(PG_VERSION_11), NULL)),
|
||||||
@ -991,7 +991,7 @@ testRun(void)
|
|||||||
hrnCfgArgRawZ(argList, cfgOptRepoRetentionFull, "1");
|
hrnCfgArgRawZ(argList, cfgOptRepoRetentionFull, "1");
|
||||||
strLstAddZ(argList, "--no-" CFGOPT_ONLINE);
|
strLstAddZ(argList, "--no-" CFGOPT_ONLINE);
|
||||||
strLstAddZ(argList, "--" CFGOPT_START_FAST);
|
strLstAddZ(argList, "--" CFGOPT_START_FAST);
|
||||||
harnessCfgLoad(cfgCmdBackup, argList);
|
HRN_CFG_LOAD(cfgCmdBackup, argList);
|
||||||
|
|
||||||
TEST_RESULT_VOID(
|
TEST_RESULT_VOID(
|
||||||
backupInit(infoBackupNew(PG_VERSION_83, 1000000000000000830, hrnPgCatalogVersion(PG_VERSION_83), NULL)),
|
backupInit(infoBackupNew(PG_VERSION_83, 1000000000000000830, hrnPgCatalogVersion(PG_VERSION_83), NULL)),
|
||||||
@ -1015,7 +1015,7 @@ testRun(void)
|
|||||||
hrnCfgArgRawZ(argList, cfgOptRepoRetentionFull, "1");
|
hrnCfgArgRawZ(argList, cfgOptRepoRetentionFull, "1");
|
||||||
strLstAddZ(argList, "--no-" CFGOPT_ONLINE);
|
strLstAddZ(argList, "--no-" CFGOPT_ONLINE);
|
||||||
strLstAddZ(argList, "--" CFGOPT_STOP_AUTO);
|
strLstAddZ(argList, "--" CFGOPT_STOP_AUTO);
|
||||||
harnessCfgLoad(cfgCmdBackup, argList);
|
HRN_CFG_LOAD(cfgCmdBackup, argList);
|
||||||
|
|
||||||
TEST_RESULT_VOID(
|
TEST_RESULT_VOID(
|
||||||
backupInit(infoBackupNew(PG_VERSION_84, 1000000000000000840, hrnPgCatalogVersion(PG_VERSION_84), NULL)),
|
backupInit(infoBackupNew(PG_VERSION_84, 1000000000000000840, hrnPgCatalogVersion(PG_VERSION_84), NULL)),
|
||||||
@ -1038,7 +1038,7 @@ testRun(void)
|
|||||||
hrnCfgArgRaw(argList, cfgOptPgPath, pg1Path);
|
hrnCfgArgRaw(argList, cfgOptPgPath, pg1Path);
|
||||||
hrnCfgArgRawZ(argList, cfgOptRepoRetentionFull, "1");
|
hrnCfgArgRawZ(argList, cfgOptRepoRetentionFull, "1");
|
||||||
strLstAddZ(argList, "--" CFGOPT_CHECKSUM_PAGE);
|
strLstAddZ(argList, "--" CFGOPT_CHECKSUM_PAGE);
|
||||||
harnessCfgLoad(cfgCmdBackup, argList);
|
HRN_CFG_LOAD(cfgCmdBackup, argList);
|
||||||
|
|
||||||
harnessPqScriptSet((HarnessPq [])
|
harnessPqScriptSet((HarnessPq [])
|
||||||
{
|
{
|
||||||
@ -1070,7 +1070,7 @@ testRun(void)
|
|||||||
hrnCfgArgRaw(argList, cfgOptPgPath, pg1Path);
|
hrnCfgArgRaw(argList, cfgOptPgPath, pg1Path);
|
||||||
hrnCfgArgRawZ(argList, cfgOptRepoRetentionFull, "1");
|
hrnCfgArgRawZ(argList, cfgOptRepoRetentionFull, "1");
|
||||||
strLstAddZ(argList, "--no-" CFGOPT_CHECKSUM_PAGE);
|
strLstAddZ(argList, "--no-" CFGOPT_CHECKSUM_PAGE);
|
||||||
harnessCfgLoad(cfgCmdBackup, argList);
|
HRN_CFG_LOAD(cfgCmdBackup, argList);
|
||||||
|
|
||||||
harnessPqScriptSet((HarnessPq [])
|
harnessPqScriptSet((HarnessPq [])
|
||||||
{
|
{
|
||||||
@ -1118,7 +1118,7 @@ testRun(void)
|
|||||||
hrnCfgArgRaw(argList, cfgOptRepoPath, repoPath);
|
hrnCfgArgRaw(argList, cfgOptRepoPath, repoPath);
|
||||||
hrnCfgArgRaw(argList, cfgOptPgPath, pg1Path);
|
hrnCfgArgRaw(argList, cfgOptPgPath, pg1Path);
|
||||||
hrnCfgArgRawZ(argList, cfgOptRepoRetentionFull, "1");
|
hrnCfgArgRawZ(argList, cfgOptRepoRetentionFull, "1");
|
||||||
harnessCfgLoad(cfgCmdBackup, argList);
|
HRN_CFG_LOAD(cfgCmdBackup, argList);
|
||||||
|
|
||||||
// Create pg_control
|
// Create pg_control
|
||||||
storagePutP(
|
storagePutP(
|
||||||
@ -1165,7 +1165,7 @@ testRun(void)
|
|||||||
hrnCfgArgRawZ(argList, cfgOptRepoRetentionFull, "1");
|
hrnCfgArgRawZ(argList, cfgOptRepoRetentionFull, "1");
|
||||||
hrnCfgArgRawStrId(argList, cfgOptType, backupTypeFull);
|
hrnCfgArgRawStrId(argList, cfgOptType, backupTypeFull);
|
||||||
strLstAddZ(argList, "--no-" CFGOPT_COMPRESS);
|
strLstAddZ(argList, "--no-" CFGOPT_COMPRESS);
|
||||||
harnessCfgLoad(cfgCmdBackup, argList);
|
HRN_CFG_LOAD(cfgCmdBackup, argList);
|
||||||
|
|
||||||
// -------------------------------------------------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------------------------------------------------
|
||||||
TEST_TITLE("cannot resume when manifest and copy are missing");
|
TEST_TITLE("cannot resume when manifest and copy are missing");
|
||||||
@ -1367,7 +1367,7 @@ testRun(void)
|
|||||||
hrnCfgArgRaw(argList, cfgOptRepoPath, repoPath);
|
hrnCfgArgRaw(argList, cfgOptRepoPath, repoPath);
|
||||||
hrnCfgArgRaw(argList, cfgOptPgPath, pg1Path);
|
hrnCfgArgRaw(argList, cfgOptPgPath, pg1Path);
|
||||||
strLstAddZ(argList, "--no-" CFGOPT_ONLINE);
|
strLstAddZ(argList, "--no-" CFGOPT_ONLINE);
|
||||||
harnessCfgLoad(cfgCmdStanzaCreate, argList);
|
HRN_CFG_LOAD(cfgCmdStanzaCreate, argList);
|
||||||
|
|
||||||
cmdStanzaCreate();
|
cmdStanzaCreate();
|
||||||
TEST_RESULT_LOG("P00 INFO: stanza-create for stanza 'test1' on repo1");
|
TEST_RESULT_LOG("P00 INFO: stanza-create for stanza 'test1' on repo1");
|
||||||
@ -1381,7 +1381,7 @@ testRun(void)
|
|||||||
hrnCfgArgRaw(argList, cfgOptPgPath, pg1Path);
|
hrnCfgArgRaw(argList, cfgOptPgPath, pg1Path);
|
||||||
hrnCfgArgRawZ(argList, cfgOptRepoRetentionFull, "1");
|
hrnCfgArgRawZ(argList, cfgOptRepoRetentionFull, "1");
|
||||||
strLstAddZ(argList, "--no-" CFGOPT_ONLINE);
|
strLstAddZ(argList, "--no-" CFGOPT_ONLINE);
|
||||||
harnessCfgLoad(cfgCmdBackup, argList);
|
HRN_CFG_LOAD(cfgCmdBackup, argList);
|
||||||
|
|
||||||
storagePutP(storageNewWriteP(storagePgWrite(), PG_FILE_POSTMASTERPID_STR), BUFSTRDEF("PID"));
|
storagePutP(storageNewWriteP(storagePgWrite(), PG_FILE_POSTMASTERPID_STR), BUFSTRDEF("PID"));
|
||||||
|
|
||||||
@ -1403,7 +1403,7 @@ testRun(void)
|
|||||||
strLstAddZ(argList, "--no-" CFGOPT_ONLINE);
|
strLstAddZ(argList, "--no-" CFGOPT_ONLINE);
|
||||||
strLstAddZ(argList, "--no-" CFGOPT_COMPRESS);
|
strLstAddZ(argList, "--no-" CFGOPT_COMPRESS);
|
||||||
strLstAddZ(argList, "--" CFGOPT_FORCE);
|
strLstAddZ(argList, "--" CFGOPT_FORCE);
|
||||||
harnessCfgLoad(cfgCmdBackup, argList);
|
HRN_CFG_LOAD(cfgCmdBackup, argList);
|
||||||
|
|
||||||
storagePutP(storageNewWriteP(storagePgWrite(), STRDEF("postgresql.conf")), BUFSTRDEF("CONFIGSTUFF"));
|
storagePutP(storageNewWriteP(storagePgWrite(), STRDEF("postgresql.conf")), BUFSTRDEF("CONFIGSTUFF"));
|
||||||
|
|
||||||
@ -1437,7 +1437,7 @@ testRun(void)
|
|||||||
strLstAddZ(argList, "--" CFGOPT_COMPRESS);
|
strLstAddZ(argList, "--" CFGOPT_COMPRESS);
|
||||||
hrnCfgArgRawBool(argList, cfgOptRepoHardlink, true);
|
hrnCfgArgRawBool(argList, cfgOptRepoHardlink, true);
|
||||||
hrnCfgArgRawStrId(argList, cfgOptType, backupTypeDiff);
|
hrnCfgArgRawStrId(argList, cfgOptType, backupTypeDiff);
|
||||||
harnessCfgLoad(cfgCmdBackup, argList);
|
HRN_CFG_LOAD(cfgCmdBackup, argList);
|
||||||
|
|
||||||
TEST_ERROR(cmdBackup(), FileMissingError, "no files have changed since the last backup - this seems unlikely");
|
TEST_ERROR(cmdBackup(), FileMissingError, "no files have changed since the last backup - this seems unlikely");
|
||||||
|
|
||||||
@ -1458,7 +1458,7 @@ testRun(void)
|
|||||||
strLstAddZ(argList, "--no-" CFGOPT_COMPRESS);
|
strLstAddZ(argList, "--no-" CFGOPT_COMPRESS);
|
||||||
strLstAddZ(argList, "--" CFGOPT_CHECKSUM_PAGE);
|
strLstAddZ(argList, "--" CFGOPT_CHECKSUM_PAGE);
|
||||||
hrnCfgArgRawStrId(argList, cfgOptType, backupTypeIncr);
|
hrnCfgArgRawStrId(argList, cfgOptType, backupTypeIncr);
|
||||||
harnessCfgLoad(cfgCmdBackup, argList);
|
HRN_CFG_LOAD(cfgCmdBackup, argList);
|
||||||
|
|
||||||
storagePutP(storageNewWriteP(storagePgWrite(), PG_FILE_PGVERSION_STR), BUFSTRDEF("VER"));
|
storagePutP(storageNewWriteP(storagePgWrite(), PG_FILE_PGVERSION_STR), BUFSTRDEF("VER"));
|
||||||
|
|
||||||
@ -1485,7 +1485,7 @@ testRun(void)
|
|||||||
strLstAddZ(argList, "--no-" CFGOPT_ONLINE);
|
strLstAddZ(argList, "--no-" CFGOPT_ONLINE);
|
||||||
strLstAddZ(argList, "--no-" CFGOPT_COMPRESS);
|
strLstAddZ(argList, "--no-" CFGOPT_COMPRESS);
|
||||||
hrnCfgArgRawStrId(argList, cfgOptType, backupTypeDiff);
|
hrnCfgArgRawStrId(argList, cfgOptType, backupTypeDiff);
|
||||||
harnessCfgLoad(cfgCmdBackup, argList);
|
HRN_CFG_LOAD(cfgCmdBackup, argList);
|
||||||
|
|
||||||
sleepMSec(MSEC_PER_SEC - (timeMSec() % MSEC_PER_SEC));
|
sleepMSec(MSEC_PER_SEC - (timeMSec() % MSEC_PER_SEC));
|
||||||
storagePutP(storageNewWriteP(storagePgWrite(), PG_FILE_PGVERSION_STR), BUFSTRDEF("VR2"));
|
storagePutP(storageNewWriteP(storagePgWrite(), PG_FILE_PGVERSION_STR), BUFSTRDEF("VR2"));
|
||||||
@ -1511,7 +1511,7 @@ testRun(void)
|
|||||||
hrnCfgEnvKeyRawZ(cfgOptRepoCipherPass, 2, TEST_CIPHER_PASS);
|
hrnCfgEnvKeyRawZ(cfgOptRepoCipherPass, 2, TEST_CIPHER_PASS);
|
||||||
hrnCfgArgRaw(argList, cfgOptPgPath, pg1Path);
|
hrnCfgArgRaw(argList, cfgOptPgPath, pg1Path);
|
||||||
strLstAddZ(argList, "--no-" CFGOPT_ONLINE);
|
strLstAddZ(argList, "--no-" CFGOPT_ONLINE);
|
||||||
harnessCfgLoad(cfgCmdStanzaCreate, argList);
|
HRN_CFG_LOAD(cfgCmdStanzaCreate, argList);
|
||||||
|
|
||||||
cmdStanzaCreate();
|
cmdStanzaCreate();
|
||||||
TEST_RESULT_LOG("P00 INFO: stanza-create for stanza 'test1' on repo2");
|
TEST_RESULT_LOG("P00 INFO: stanza-create for stanza 'test1' on repo2");
|
||||||
@ -1523,7 +1523,7 @@ testRun(void)
|
|||||||
// With repo2 the only repo configured, ensure it is chosen by confirming diff is changed to full due to no prior backups
|
// With repo2 the only repo configured, ensure it is chosen by confirming diff is changed to full due to no prior backups
|
||||||
hrnCfgArgKeyRawZ(argList, cfgOptRepoRetentionFull, 2, "1");
|
hrnCfgArgKeyRawZ(argList, cfgOptRepoRetentionFull, 2, "1");
|
||||||
hrnCfgArgRawStrId(argList, cfgOptType, backupTypeDiff);
|
hrnCfgArgRawStrId(argList, cfgOptType, backupTypeDiff);
|
||||||
harnessCfgLoad(cfgCmdBackup, argList);
|
HRN_CFG_LOAD(cfgCmdBackup, argList);
|
||||||
|
|
||||||
TEST_RESULT_VOID(cmdBackup(), "backup");
|
TEST_RESULT_VOID(cmdBackup(), "backup");
|
||||||
TEST_RESULT_LOG(
|
TEST_RESULT_LOG(
|
||||||
@ -1539,7 +1539,7 @@ testRun(void)
|
|||||||
// Add repo1 to the configuration
|
// Add repo1 to the configuration
|
||||||
hrnCfgArgKeyRaw(argList, cfgOptRepoPath, 1, repoPath);
|
hrnCfgArgKeyRaw(argList, cfgOptRepoPath, 1, repoPath);
|
||||||
hrnCfgArgKeyRawZ(argList, cfgOptRepoRetentionFull, 1, "1");
|
hrnCfgArgKeyRawZ(argList, cfgOptRepoRetentionFull, 1, "1");
|
||||||
harnessCfgLoad(cfgCmdBackup, argList);
|
HRN_CFG_LOAD(cfgCmdBackup, argList);
|
||||||
|
|
||||||
TEST_RESULT_VOID(cmdBackup(), "backup");
|
TEST_RESULT_VOID(cmdBackup(), "backup");
|
||||||
TEST_RESULT_LOG(
|
TEST_RESULT_LOG(
|
||||||
@ -1555,7 +1555,7 @@ testRun(void)
|
|||||||
|
|
||||||
hrnCfgArgRawZ(argList, cfgOptRepo, "2");
|
hrnCfgArgRawZ(argList, cfgOptRepo, "2");
|
||||||
|
|
||||||
harnessCfgLoad(cfgCmdBackup, argList);
|
HRN_CFG_LOAD(cfgCmdBackup, argList);
|
||||||
|
|
||||||
storagePutP(storageNewWriteP(storagePgWrite(), PG_FILE_PGVERSION_STR), BUFSTRDEF("VER"));
|
storagePutP(storageNewWriteP(storagePgWrite(), PG_FILE_PGVERSION_STR), BUFSTRDEF("VER"));
|
||||||
|
|
||||||
@ -1619,7 +1619,7 @@ testRun(void)
|
|||||||
hrnCfgArgRaw(argList, cfgOptRepoPath, repoPath);
|
hrnCfgArgRaw(argList, cfgOptRepoPath, repoPath);
|
||||||
hrnCfgArgRaw(argList, cfgOptPgPath, pg1Path);
|
hrnCfgArgRaw(argList, cfgOptPgPath, pg1Path);
|
||||||
strLstAddZ(argList, "--no-" CFGOPT_ONLINE);
|
strLstAddZ(argList, "--no-" CFGOPT_ONLINE);
|
||||||
harnessCfgLoad(cfgCmdStanzaCreate, argList);
|
HRN_CFG_LOAD(cfgCmdStanzaCreate, argList);
|
||||||
|
|
||||||
cmdStanzaCreate();
|
cmdStanzaCreate();
|
||||||
TEST_RESULT_LOG("P00 INFO: stanza-create for stanza 'test1' on repo1");
|
TEST_RESULT_LOG("P00 INFO: stanza-create for stanza 'test1' on repo1");
|
||||||
@ -1634,7 +1634,7 @@ testRun(void)
|
|||||||
strLstAddZ(argList, "--" CFGOPT_STOP_AUTO);
|
strLstAddZ(argList, "--" CFGOPT_STOP_AUTO);
|
||||||
strLstAddZ(argList, "--no-" CFGOPT_COMPRESS);
|
strLstAddZ(argList, "--no-" CFGOPT_COMPRESS);
|
||||||
strLstAddZ(argList, "--no-" CFGOPT_ARCHIVE_CHECK);
|
strLstAddZ(argList, "--no-" CFGOPT_ARCHIVE_CHECK);
|
||||||
harnessCfgLoad(cfgCmdBackup, argList);
|
HRN_CFG_LOAD(cfgCmdBackup, argList);
|
||||||
|
|
||||||
// Add files
|
// Add files
|
||||||
storagePutP(
|
storagePutP(
|
||||||
@ -1731,7 +1731,7 @@ testRun(void)
|
|||||||
strLstAddZ(argList, "--" CFGOPT_STOP_AUTO);
|
strLstAddZ(argList, "--" CFGOPT_STOP_AUTO);
|
||||||
hrnCfgArgRawBool(argList, cfgOptRepoHardlink, true);
|
hrnCfgArgRawBool(argList, cfgOptRepoHardlink, true);
|
||||||
strLstAddZ(argList, "--" CFGOPT_ARCHIVE_COPY);
|
strLstAddZ(argList, "--" CFGOPT_ARCHIVE_COPY);
|
||||||
harnessCfgLoad(cfgCmdBackup, argList);
|
HRN_CFG_LOAD(cfgCmdBackup, argList);
|
||||||
|
|
||||||
// Create a backup manifest that looks like a halted backup manifest
|
// Create a backup manifest that looks like a halted backup manifest
|
||||||
Manifest *manifestResume = manifestNewBuild(
|
Manifest *manifestResume = manifestNewBuild(
|
||||||
@ -1922,7 +1922,7 @@ testRun(void)
|
|||||||
strLstAddZ(argList, "--no-" CFGOPT_COMPRESS);
|
strLstAddZ(argList, "--no-" CFGOPT_COMPRESS);
|
||||||
strLstAddZ(argList, "--" CFGOPT_STOP_AUTO);
|
strLstAddZ(argList, "--" CFGOPT_STOP_AUTO);
|
||||||
hrnCfgArgRawBool(argList, cfgOptRepoHardlink, true);
|
hrnCfgArgRawBool(argList, cfgOptRepoHardlink, true);
|
||||||
harnessCfgLoad(cfgCmdBackup, argList);
|
HRN_CFG_LOAD(cfgCmdBackup, argList);
|
||||||
|
|
||||||
// Load the previous manifest and null out the checksum-page option to be sure it gets set to false in this backup
|
// Load the previous manifest and null out the checksum-page option to be sure it gets set to false in this backup
|
||||||
const String *manifestPriorFile = STRDEF(STORAGE_REPO_BACKUP "/latest/" BACKUP_MANIFEST_FILE);
|
const String *manifestPriorFile = STRDEF(STORAGE_REPO_BACKUP "/latest/" BACKUP_MANIFEST_FILE);
|
||||||
@ -2087,7 +2087,7 @@ testRun(void)
|
|||||||
hrnCfgArgRaw(argList, cfgOptRepoPath, repoPath);
|
hrnCfgArgRaw(argList, cfgOptRepoPath, repoPath);
|
||||||
hrnCfgArgRaw(argList, cfgOptPgPath, pg1Path);
|
hrnCfgArgRaw(argList, cfgOptPgPath, pg1Path);
|
||||||
strLstAddZ(argList, "--no-" CFGOPT_ONLINE);
|
strLstAddZ(argList, "--no-" CFGOPT_ONLINE);
|
||||||
harnessCfgLoad(cfgCmdStanzaUpgrade, argList);
|
HRN_CFG_LOAD(cfgCmdStanzaUpgrade, argList);
|
||||||
|
|
||||||
cmdStanzaUpgrade();
|
cmdStanzaUpgrade();
|
||||||
TEST_RESULT_LOG("P00 INFO: stanza-upgrade for stanza 'test1' on repo1");
|
TEST_RESULT_LOG("P00 INFO: stanza-upgrade for stanza 'test1' on repo1");
|
||||||
@ -2104,7 +2104,7 @@ testRun(void)
|
|||||||
strLstAddZ(argList, "--" CFGOPT_BACKUP_STANDBY);
|
strLstAddZ(argList, "--" CFGOPT_BACKUP_STANDBY);
|
||||||
strLstAddZ(argList, "--" CFGOPT_START_FAST);
|
strLstAddZ(argList, "--" CFGOPT_START_FAST);
|
||||||
strLstAddZ(argList, "--" CFGOPT_ARCHIVE_COPY);
|
strLstAddZ(argList, "--" CFGOPT_ARCHIVE_COPY);
|
||||||
harnessCfgLoad(cfgCmdBackup, argList);
|
HRN_CFG_LOAD(cfgCmdBackup, argList);
|
||||||
|
|
||||||
// Create file to copy from the standby. This file will be zero-length on the primary and non-zero-length on the standby
|
// Create file to copy from the standby. This file will be zero-length on the primary and non-zero-length on the standby
|
||||||
// but no bytes will be copied.
|
// but no bytes will be copied.
|
||||||
@ -2236,7 +2236,7 @@ testRun(void)
|
|||||||
hrnCfgArgRaw(argList, cfgOptRepoPath, repoPath);
|
hrnCfgArgRaw(argList, cfgOptRepoPath, repoPath);
|
||||||
hrnCfgArgRaw(argList, cfgOptPgPath, pg1Path);
|
hrnCfgArgRaw(argList, cfgOptPgPath, pg1Path);
|
||||||
strLstAddZ(argList, "--no-" CFGOPT_ONLINE);
|
strLstAddZ(argList, "--no-" CFGOPT_ONLINE);
|
||||||
harnessCfgLoad(cfgCmdStanzaUpgrade, argList);
|
HRN_CFG_LOAD(cfgCmdStanzaUpgrade, argList);
|
||||||
|
|
||||||
cmdStanzaUpgrade();
|
cmdStanzaUpgrade();
|
||||||
TEST_RESULT_LOG("P00 INFO: stanza-upgrade for stanza 'test1' on repo1");
|
TEST_RESULT_LOG("P00 INFO: stanza-upgrade for stanza 'test1' on repo1");
|
||||||
@ -2251,7 +2251,7 @@ testRun(void)
|
|||||||
hrnCfgArgRawBool(argList, cfgOptRepoHardlink, true);
|
hrnCfgArgRawBool(argList, cfgOptRepoHardlink, true);
|
||||||
strLstAddZ(argList, "--" CFGOPT_MANIFEST_SAVE_THRESHOLD "=1");
|
strLstAddZ(argList, "--" CFGOPT_MANIFEST_SAVE_THRESHOLD "=1");
|
||||||
strLstAddZ(argList, "--" CFGOPT_ARCHIVE_COPY);
|
strLstAddZ(argList, "--" CFGOPT_ARCHIVE_COPY);
|
||||||
harnessCfgLoad(cfgCmdBackup, argList);
|
HRN_CFG_LOAD(cfgCmdBackup, argList);
|
||||||
|
|
||||||
// Move pg1-path and put a link in its place. This tests that backup works when pg1-path is a symlink yet should be
|
// Move pg1-path and put a link in its place. This tests that backup works when pg1-path is a symlink yet should be
|
||||||
// completely invisible in the manifest and logging.
|
// completely invisible in the manifest and logging.
|
||||||
@ -2441,7 +2441,7 @@ testRun(void)
|
|||||||
hrnCfgArgRawZ(argList, cfgOptRepoRetentionFull, "1");
|
hrnCfgArgRawZ(argList, cfgOptRepoRetentionFull, "1");
|
||||||
hrnCfgArgRawStrId(argList, cfgOptType, backupTypeIncr);
|
hrnCfgArgRawStrId(argList, cfgOptType, backupTypeIncr);
|
||||||
hrnCfgArgRawBool(argList, cfgOptRepoHardlink, true);
|
hrnCfgArgRawBool(argList, cfgOptRepoHardlink, true);
|
||||||
harnessCfgLoad(cfgCmdBackup, argList);
|
HRN_CFG_LOAD(cfgCmdBackup, argList);
|
||||||
|
|
||||||
// Run backup
|
// Run backup
|
||||||
testBackupPqScriptP(PG_VERSION_11, backupTimeStart, .errorAfterStart = true);
|
testBackupPqScriptP(PG_VERSION_11, backupTimeStart, .errorAfterStart = true);
|
||||||
@ -2480,7 +2480,7 @@ testRun(void)
|
|||||||
hrnCfgArgRawStrId(argList, cfgOptType, backupTypeIncr);
|
hrnCfgArgRawStrId(argList, cfgOptType, backupTypeIncr);
|
||||||
strLstAddZ(argList, "--" CFGOPT_DELTA);
|
strLstAddZ(argList, "--" CFGOPT_DELTA);
|
||||||
hrnCfgArgRawBool(argList, cfgOptRepoHardlink, true);
|
hrnCfgArgRawBool(argList, cfgOptRepoHardlink, true);
|
||||||
harnessCfgLoad(cfgCmdBackup, argList);
|
HRN_CFG_LOAD(cfgCmdBackup, argList);
|
||||||
|
|
||||||
// Update pg_control timestamp
|
// Update pg_control timestamp
|
||||||
HRN_STORAGE_TIME(storagePg(), "global/pg_control", backupTimeStart);
|
HRN_STORAGE_TIME(storagePg(), "global/pg_control", backupTimeStart);
|
||||||
|
@ -46,7 +46,7 @@ testRun(void)
|
|||||||
strLstAdd(argList, pg1PathOpt);
|
strLstAdd(argList, pg1PathOpt);
|
||||||
strLstAddZ(argList, "--repo1-path=" TEST_PATH "/repo");
|
strLstAddZ(argList, "--repo1-path=" TEST_PATH "/repo");
|
||||||
strLstAddZ(argList, "--archive-timeout=.5");
|
strLstAddZ(argList, "--archive-timeout=.5");
|
||||||
harnessCfgLoad(cfgCmdCheck, argList);
|
HRN_CFG_LOAD(cfgCmdCheck, argList);
|
||||||
|
|
||||||
// Set up harness to expect a failure to connect to the database
|
// Set up harness to expect a failure to connect to the database
|
||||||
harnessPqScriptSet((HarnessPq [])
|
harnessPqScriptSet((HarnessPq [])
|
||||||
@ -83,7 +83,7 @@ testRun(void)
|
|||||||
strLstAddZ(argList, "--repo1-path=" TEST_PATH "/repo");
|
strLstAddZ(argList, "--repo1-path=" TEST_PATH "/repo");
|
||||||
strLstAddZ(argList, "--repo2-host=repo.domain.com");
|
strLstAddZ(argList, "--repo2-host=repo.domain.com");
|
||||||
strLstAddZ(argList, "--archive-timeout=.5");
|
strLstAddZ(argList, "--archive-timeout=.5");
|
||||||
harnessCfgLoad(cfgCmdCheck, argList);
|
HRN_CFG_LOAD(cfgCmdCheck, argList);
|
||||||
|
|
||||||
// Two standbys found but no primary
|
// Two standbys found but no primary
|
||||||
harnessPqScriptSet((HarnessPq [])
|
harnessPqScriptSet((HarnessPq [])
|
||||||
@ -106,7 +106,7 @@ testRun(void)
|
|||||||
strLstAdd(argList, pg1PathOpt);
|
strLstAdd(argList, pg1PathOpt);
|
||||||
strLstAddZ(argList, "--repo1-host=repo.domain.com");
|
strLstAddZ(argList, "--repo1-host=repo.domain.com");
|
||||||
strLstAddZ(argList, "--archive-timeout=.5");
|
strLstAddZ(argList, "--archive-timeout=.5");
|
||||||
harnessCfgLoad(cfgCmdCheck, argList);
|
HRN_CFG_LOAD(cfgCmdCheck, argList);
|
||||||
|
|
||||||
harnessPqScriptSet((HarnessPq [])
|
harnessPqScriptSet((HarnessPq [])
|
||||||
{
|
{
|
||||||
@ -126,7 +126,7 @@ testRun(void)
|
|||||||
strLstAddZ(argList, "--repo1-path=" TEST_PATH "/repo");
|
strLstAddZ(argList, "--repo1-path=" TEST_PATH "/repo");
|
||||||
strLstAddZ(argList, "--archive-timeout=.5");
|
strLstAddZ(argList, "--archive-timeout=.5");
|
||||||
strLstAddZ(argList, "--backup-standby");
|
strLstAddZ(argList, "--backup-standby");
|
||||||
harnessCfgLoad(cfgCmdCheck, argList);
|
HRN_CFG_LOAD(cfgCmdCheck, argList);
|
||||||
|
|
||||||
// Primary database connection ok
|
// Primary database connection ok
|
||||||
harnessPqScriptSet((HarnessPq [])
|
harnessPqScriptSet((HarnessPq [])
|
||||||
@ -155,7 +155,7 @@ testRun(void)
|
|||||||
strLstAddZ(argList, "--archive-timeout=.5");
|
strLstAddZ(argList, "--archive-timeout=.5");
|
||||||
strLstAdd(argList, pg8PathOpt);
|
strLstAdd(argList, pg8PathOpt);
|
||||||
strLstAddZ(argList, "--pg8-port=5433");
|
strLstAddZ(argList, "--pg8-port=5433");
|
||||||
harnessCfgLoad(cfgCmdCheck, argList);
|
HRN_CFG_LOAD(cfgCmdCheck, argList);
|
||||||
|
|
||||||
// Standby database path doesn't match pg_control
|
// Standby database path doesn't match pg_control
|
||||||
harnessPqScriptSet((HarnessPq [])
|
harnessPqScriptSet((HarnessPq [])
|
||||||
@ -231,7 +231,7 @@ testRun(void)
|
|||||||
// Multi-repo - add a second repo (repo2)
|
// Multi-repo - add a second repo (repo2)
|
||||||
StringList *argListRepo2 = strLstDup(argList);
|
StringList *argListRepo2 = strLstDup(argList);
|
||||||
strLstAddZ(argListRepo2, "--repo2-path=" TEST_PATH "/repo2");
|
strLstAddZ(argListRepo2, "--repo2-path=" TEST_PATH "/repo2");
|
||||||
harnessCfgLoad(cfgCmdCheck, argListRepo2);
|
HRN_CFG_LOAD(cfgCmdCheck, argListRepo2);
|
||||||
|
|
||||||
harnessPqScriptSet((HarnessPq [])
|
harnessPqScriptSet((HarnessPq [])
|
||||||
{
|
{
|
||||||
@ -269,7 +269,7 @@ testRun(void)
|
|||||||
strLstAddZ(argList, "--repo1-path=" TEST_PATH "/repo");
|
strLstAddZ(argList, "--repo1-path=" TEST_PATH "/repo");
|
||||||
strLstAddZ(argList, "--repo2-path=" TEST_PATH "/repo2");
|
strLstAddZ(argList, "--repo2-path=" TEST_PATH "/repo2");
|
||||||
strLstAddZ(argList, "--archive-timeout=.5");
|
strLstAddZ(argList, "--archive-timeout=.5");
|
||||||
harnessCfgLoad(cfgCmdCheck, argList);
|
HRN_CFG_LOAD(cfgCmdCheck, argList);
|
||||||
|
|
||||||
// Create stanza files on repo2
|
// Create stanza files on repo2
|
||||||
storagePutP(storageNewWriteP(storageRepoIdxWrite(1), INFO_ARCHIVE_PATH_FILE_STR), archiveInfoContent);
|
storagePutP(storageNewWriteP(storageRepoIdxWrite(1), INFO_ARCHIVE_PATH_FILE_STR), archiveInfoContent);
|
||||||
@ -350,7 +350,7 @@ testRun(void)
|
|||||||
hrnCfgArgKeyRawZ(argList, cfgOptPgHostCmd, 5, "pgbackrest-bogus");
|
hrnCfgArgKeyRawZ(argList, cfgOptPgHostCmd, 5, "pgbackrest-bogus");
|
||||||
strLstAddZ(argList, "--pg5-path=/path/to/pg5");
|
strLstAddZ(argList, "--pg5-path=/path/to/pg5");
|
||||||
strLstAddZ(argList, "--pg5-host-user=" TEST_USER);
|
strLstAddZ(argList, "--pg5-host-user=" TEST_USER);
|
||||||
harnessCfgLoad(cfgCmdCheck, argList);
|
HRN_CFG_LOAD(cfgCmdCheck, argList);
|
||||||
|
|
||||||
// Placeholder test for manifest
|
// Placeholder test for manifest
|
||||||
TEST_ERROR(
|
TEST_ERROR(
|
||||||
@ -382,7 +382,7 @@ testRun(void)
|
|||||||
strLstAdd(argList, pg8PathOpt);
|
strLstAdd(argList, pg8PathOpt);
|
||||||
strLstAddZ(argList, "--pg8-port=5433");
|
strLstAddZ(argList, "--pg8-port=5433");
|
||||||
strLstAddZ(argList, "--repo1-path=" TEST_PATH "/repo");
|
strLstAddZ(argList, "--repo1-path=" TEST_PATH "/repo");
|
||||||
harnessCfgLoad(cfgCmdCheck, argList);
|
HRN_CFG_LOAD(cfgCmdCheck, argList);
|
||||||
|
|
||||||
DbGetResult db = {0};
|
DbGetResult db = {0};
|
||||||
|
|
||||||
@ -421,7 +421,7 @@ testRun(void)
|
|||||||
// archive-check=false
|
// archive-check=false
|
||||||
// -------------------------------------------------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------------------------------------------------
|
||||||
strLstAddZ(argList, "--no-archive-check");
|
strLstAddZ(argList, "--no-archive-check");
|
||||||
harnessCfgLoad(cfgCmdCheck, argList);
|
HRN_CFG_LOAD(cfgCmdCheck, argList);
|
||||||
|
|
||||||
TEST_RESULT_VOID(checkDbConfig(PG_VERSION_92, db.primaryIdx, db.primary, false), "valid db config --no-archive-check");
|
TEST_RESULT_VOID(checkDbConfig(PG_VERSION_92, db.primaryIdx, db.primary, false), "valid db config --no-archive-check");
|
||||||
|
|
||||||
@ -433,7 +433,7 @@ testRun(void)
|
|||||||
strLstAdd(argList, pg8PathOpt);
|
strLstAdd(argList, pg8PathOpt);
|
||||||
strLstAddZ(argList, "--pg8-port=5433");
|
strLstAddZ(argList, "--pg8-port=5433");
|
||||||
strLstAddZ(argList, "--repo1-path=" TEST_PATH "/repo");
|
strLstAddZ(argList, "--repo1-path=" TEST_PATH "/repo");
|
||||||
harnessCfgLoad(cfgCmdStanzaCreate, argList);
|
HRN_CFG_LOAD(cfgCmdStanzaCreate, argList);
|
||||||
|
|
||||||
TEST_RESULT_VOID(
|
TEST_RESULT_VOID(
|
||||||
checkDbConfig(PG_VERSION_92, db.primaryIdx, db.primary, false), "valid db config, archive-check not valid for command");
|
checkDbConfig(PG_VERSION_92, db.primaryIdx, db.primary, false), "valid db config, archive-check not valid for command");
|
||||||
@ -447,7 +447,7 @@ testRun(void)
|
|||||||
strLstAdd(argList, stanzaOpt);
|
strLstAdd(argList, stanzaOpt);
|
||||||
strLstAdd(argList, pg1PathOpt);
|
strLstAdd(argList, pg1PathOpt);
|
||||||
strLstAddZ(argList, "--repo1-path=" TEST_PATH "/repo");
|
strLstAddZ(argList, "--repo1-path=" TEST_PATH "/repo");
|
||||||
harnessCfgLoad(cfgCmdCheck, argList);
|
HRN_CFG_LOAD(cfgCmdCheck, argList);
|
||||||
|
|
||||||
harnessPqScriptSet((HarnessPq [])
|
harnessPqScriptSet((HarnessPq [])
|
||||||
{
|
{
|
||||||
@ -465,7 +465,7 @@ testRun(void)
|
|||||||
TEST_TITLE("disable archive_mode=always check");
|
TEST_TITLE("disable archive_mode=always check");
|
||||||
|
|
||||||
strLstAddZ(argList, "--no-archive-mode-check");
|
strLstAddZ(argList, "--no-archive-mode-check");
|
||||||
harnessCfgLoad(cfgCmdCheck, argList);
|
HRN_CFG_LOAD(cfgCmdCheck, argList);
|
||||||
TEST_RESULT_VOID(checkDbConfig(PG_VERSION_92, db.primaryIdx, db.primary, false), "check");
|
TEST_RESULT_VOID(checkDbConfig(PG_VERSION_92, db.primaryIdx, db.primary, false), "check");
|
||||||
|
|
||||||
TEST_RESULT_VOID(dbFree(db.primary), "free primary");
|
TEST_RESULT_VOID(dbFree(db.primary), "free primary");
|
||||||
@ -539,7 +539,7 @@ testRun(void)
|
|||||||
strLstAddZ(argList, "--repo1-path=" TEST_PATH "/repo");
|
strLstAddZ(argList, "--repo1-path=" TEST_PATH "/repo");
|
||||||
strLstAddZ(argList, "--repo1-cipher-type=aes-256-cbc");
|
strLstAddZ(argList, "--repo1-cipher-type=aes-256-cbc");
|
||||||
setenv("PGBACKREST_REPO1_CIPHER_PASS", "12345678", true);
|
setenv("PGBACKREST_REPO1_CIPHER_PASS", "12345678", true);
|
||||||
harnessCfgLoad(cfgCmdStanzaCreate, argList);
|
HRN_CFG_LOAD(cfgCmdStanzaCreate, argList);
|
||||||
|
|
||||||
// Create pg_control
|
// Create pg_control
|
||||||
storagePutP(
|
storagePutP(
|
||||||
|
@ -26,14 +26,12 @@ testRun(void)
|
|||||||
TEST_TITLE("single parameter");
|
TEST_TITLE("single parameter");
|
||||||
|
|
||||||
StringList *argList = strLstNew();
|
StringList *argList = strLstNew();
|
||||||
strLstAddZ(argList, PROJECT_BIN);
|
|
||||||
hrnCfgArgRawZ(argList, cfgOptStanza, "test");
|
hrnCfgArgRawZ(argList, cfgOptStanza, "test");
|
||||||
hrnCfgArgRawBool(argList, cfgOptArchiveAsync, true);
|
hrnCfgArgRawBool(argList, cfgOptArchiveAsync, true);
|
||||||
hrnCfgArgRawZ(argList, cfgOptArchiveTimeout, "10");
|
hrnCfgArgRawZ(argList, cfgOptArchiveTimeout, "10");
|
||||||
hrnCfgArgRawZ(argList, cfgOptPgPath, "/pg1");
|
hrnCfgArgRawZ(argList, cfgOptPgPath, "/pg1");
|
||||||
strLstAddZ(argList, CFGCMD_ARCHIVE_GET);
|
|
||||||
strLstAddZ(argList, "param1");
|
strLstAddZ(argList, "param1");
|
||||||
harnessCfgLoadRaw(strLstSize(argList), strLstPtr(argList));
|
HRN_CFG_LOAD(cfgCmdArchiveGet, argList, .noStd = true);
|
||||||
|
|
||||||
TEST_RESULT_VOID(cmdBegin(), "command begin with command parameter");
|
TEST_RESULT_VOID(cmdBegin(), "command begin with command parameter");
|
||||||
TEST_RESULT_LOG(
|
TEST_RESULT_LOG(
|
||||||
@ -44,14 +42,12 @@ testRun(void)
|
|||||||
TEST_TITLE("multiple parameters");
|
TEST_TITLE("multiple parameters");
|
||||||
|
|
||||||
argList = strLstNew();
|
argList = strLstNew();
|
||||||
strLstAddZ(argList, PROJECT_BIN);
|
|
||||||
hrnCfgArgRawZ(argList, cfgOptStanza, "test");
|
hrnCfgArgRawZ(argList, cfgOptStanza, "test");
|
||||||
hrnCfgArgRawBool(argList, cfgOptArchiveAsync, true);
|
hrnCfgArgRawBool(argList, cfgOptArchiveAsync, true);
|
||||||
hrnCfgArgRawZ(argList, cfgOptPgPath, "/pg1");
|
hrnCfgArgRawZ(argList, cfgOptPgPath, "/pg1");
|
||||||
strLstAddZ(argList, CFGCMD_ARCHIVE_GET);
|
|
||||||
strLstAddZ(argList, "param1");
|
strLstAddZ(argList, "param1");
|
||||||
strLstAddZ(argList, "param 2");
|
strLstAddZ(argList, "param 2");
|
||||||
harnessCfgLoadRaw(strLstSize(argList), strLstPtr(argList));
|
HRN_CFG_LOAD(cfgCmdArchiveGet, argList, .noStd = true);
|
||||||
|
|
||||||
TEST_RESULT_VOID(cmdBegin(), "command begin with command parameters");
|
TEST_RESULT_VOID(cmdBegin(), "command begin with command parameters");
|
||||||
TEST_RESULT_LOG(
|
TEST_RESULT_LOG(
|
||||||
@ -62,7 +58,6 @@ testRun(void)
|
|||||||
TEST_TITLE("reset, negate, list, hash options");
|
TEST_TITLE("reset, negate, list, hash options");
|
||||||
|
|
||||||
argList = strLstNew();
|
argList = strLstNew();
|
||||||
strLstAddZ(argList, PROJECT_BIN);
|
|
||||||
hrnCfgArgRawNegate(argList, cfgOptConfig);
|
hrnCfgArgRawNegate(argList, cfgOptConfig);
|
||||||
hrnCfgArgRawZ(argList, cfgOptStanza, "test");
|
hrnCfgArgRawZ(argList, cfgOptStanza, "test");
|
||||||
hrnCfgArgKeyRawZ(argList, cfgOptPgPath, 1, "/pg1");
|
hrnCfgArgKeyRawZ(argList, cfgOptPgPath, 1, "/pg1");
|
||||||
@ -74,9 +69,8 @@ testRun(void)
|
|||||||
hrnCfgArgRawZ(argList, cfgOptDbInclude, "db2");
|
hrnCfgArgRawZ(argList, cfgOptDbInclude, "db2");
|
||||||
hrnCfgArgRawZ(argList, cfgOptRecoveryOption, "standby_mode=on");
|
hrnCfgArgRawZ(argList, cfgOptRecoveryOption, "standby_mode=on");
|
||||||
hrnCfgArgRawZ(argList, cfgOptRecoveryOption, "primary_conninfo=blah");
|
hrnCfgArgRawZ(argList, cfgOptRecoveryOption, "primary_conninfo=blah");
|
||||||
strLstAddZ(argList, CFGCMD_RESTORE);
|
|
||||||
hrnCfgEnvRawZ(cfgOptRepoCipherPass, "SECRET-STUFF");
|
hrnCfgEnvRawZ(cfgOptRepoCipherPass, "SECRET-STUFF");
|
||||||
harnessCfgLoadRaw(strLstSize(argList), strLstPtr(argList));
|
HRN_CFG_LOAD(cfgCmdRestore, argList, .noStd = true);
|
||||||
|
|
||||||
TEST_RESULT_VOID(cmdBegin(), "command begin");
|
TEST_RESULT_VOID(cmdBegin(), "command begin");
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@ testRun(void)
|
|||||||
StringList *argList = strLstNew();
|
StringList *argList = strLstNew();
|
||||||
strLstAddZ(argList, "--stanza=db");
|
strLstAddZ(argList, "--stanza=db");
|
||||||
hrnCfgArgRawZ(argList, cfgOptPgPath, "/path/to/pg");
|
hrnCfgArgRawZ(argList, cfgOptPgPath, "/path/to/pg");
|
||||||
harnessCfgLoad(cfgCmdArchiveGet, argList);
|
HRN_CFG_LOAD(cfgCmdArchiveGet, argList);
|
||||||
|
|
||||||
TEST_RESULT_STR_Z(lockStopFileName(NULL), HRN_PATH "/lock/all" STOP_FILE_EXT, "stop file for all stanzas");
|
TEST_RESULT_STR_Z(lockStopFileName(NULL), HRN_PATH "/lock/all" STOP_FILE_EXT, "stop file for all stanzas");
|
||||||
TEST_RESULT_STR_Z(lockStopFileName(STRDEF("db")), HRN_PATH "/lock/db" STOP_FILE_EXT, "stop file for on stanza");
|
TEST_RESULT_STR_Z(lockStopFileName(STRDEF("db")), HRN_PATH "/lock/db" STOP_FILE_EXT, "stop file for on stanza");
|
||||||
@ -35,7 +35,7 @@ testRun(void)
|
|||||||
if (testBegin("lockStopTest(), cmdStart()"))
|
if (testBegin("lockStopTest(), cmdStart()"))
|
||||||
{
|
{
|
||||||
StringList *argList = strLstNew();
|
StringList *argList = strLstNew();
|
||||||
harnessCfgLoad(cfgCmdStart, argList);
|
HRN_CFG_LOAD(cfgCmdStart, argList);
|
||||||
|
|
||||||
TEST_RESULT_VOID(lockStopTest(), "no stop files without stanza");
|
TEST_RESULT_VOID(lockStopTest(), "no stop files without stanza");
|
||||||
TEST_RESULT_VOID(cmdStart(), " cmdStart - no stanza, no stop files");
|
TEST_RESULT_VOID(cmdStart(), " cmdStart - no stanza, no stop files");
|
||||||
@ -48,7 +48,7 @@ testRun(void)
|
|||||||
// -------------------------------------------------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------------------------------------------------
|
||||||
argList = strLstNew();
|
argList = strLstNew();
|
||||||
strLstAddZ(argList, "--stanza=db");
|
strLstAddZ(argList, "--stanza=db");
|
||||||
harnessCfgLoad(cfgCmdStart, argList);
|
HRN_CFG_LOAD(cfgCmdStart, argList);
|
||||||
|
|
||||||
TEST_RESULT_VOID(lockStopTest(), "no stop files with stanza");
|
TEST_RESULT_VOID(lockStopTest(), "no stop files with stanza");
|
||||||
TEST_RESULT_VOID(cmdStart(), " cmdStart - stanza, no stop files");
|
TEST_RESULT_VOID(cmdStart(), " cmdStart - stanza, no stop files");
|
||||||
@ -70,7 +70,7 @@ testRun(void)
|
|||||||
{
|
{
|
||||||
const String *lockPath = STRDEF(HRN_PATH "/lock");
|
const String *lockPath = STRDEF(HRN_PATH "/lock");
|
||||||
StringList *argList = strLstNew();
|
StringList *argList = strLstNew();
|
||||||
harnessCfgLoad(cfgCmdStop, argList);
|
HRN_CFG_LOAD(cfgCmdStop, argList);
|
||||||
|
|
||||||
TEST_RESULT_VOID(cmdStop(), "no stanza, create stop file");
|
TEST_RESULT_VOID(cmdStop(), "no stanza, create stop file");
|
||||||
StorageInfo info = {0};
|
StorageInfo info = {0};
|
||||||
@ -97,7 +97,7 @@ testRun(void)
|
|||||||
// -------------------------------------------------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------------------------------------------------
|
||||||
String *stanzaStopFile = strNewFmt("%s/db" STOP_FILE_EXT, strZ(lockPath));
|
String *stanzaStopFile = strNewFmt("%s/db" STOP_FILE_EXT, strZ(lockPath));
|
||||||
strLstAddZ(argList, "--stanza=db");
|
strLstAddZ(argList, "--stanza=db");
|
||||||
harnessCfgLoad(cfgCmdStop, argList);
|
HRN_CFG_LOAD(cfgCmdStop, argList);
|
||||||
|
|
||||||
TEST_RESULT_VOID(cmdStop(), "stanza, create stop file");
|
TEST_RESULT_VOID(cmdStop(), "stanza, create stop file");
|
||||||
TEST_RESULT_BOOL(storageExistsP(hrnStorage, stanzaStopFile), true, " stanza stop file created");
|
TEST_RESULT_BOOL(storageExistsP(hrnStorage, stanzaStopFile), true, " stanza stop file created");
|
||||||
@ -114,7 +114,7 @@ testRun(void)
|
|||||||
|
|
||||||
// -------------------------------------------------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------------------------------------------------
|
||||||
strLstAddZ(argList, "--force");
|
strLstAddZ(argList, "--force");
|
||||||
harnessCfgLoad(cfgCmdStop, argList);
|
HRN_CFG_LOAD(cfgCmdStop, argList);
|
||||||
TEST_RESULT_VOID(cmdStop(), "stanza, create stop file, force");
|
TEST_RESULT_VOID(cmdStop(), "stanza, create stop file, force");
|
||||||
TEST_RESULT_VOID(storageRemoveP(hrnStorage, stanzaStopFile), " remove stop file");
|
TEST_RESULT_VOID(storageRemoveP(hrnStorage, stanzaStopFile), " remove stop file");
|
||||||
|
|
||||||
|
@ -176,7 +176,7 @@ testRun(void)
|
|||||||
|
|
||||||
// Load Parameters
|
// Load Parameters
|
||||||
StringList *argList = strLstDup(argListAvoidWarn);
|
StringList *argList = strLstDup(argListAvoidWarn);
|
||||||
harnessCfgLoad(cfgCmdExpire, argList);
|
HRN_CFG_LOAD(cfgCmdExpire, argList);
|
||||||
|
|
||||||
TEST_RESULT_VOID(
|
TEST_RESULT_VOID(
|
||||||
storagePutP(
|
storagePutP(
|
||||||
@ -218,7 +218,7 @@ testRun(void)
|
|||||||
|
|
||||||
// Load Parameters
|
// Load Parameters
|
||||||
StringList *argList = strLstDup(argListBase);
|
StringList *argList = strLstDup(argListBase);
|
||||||
harnessCfgLoad(cfgCmdExpire, argList);
|
HRN_CFG_LOAD(cfgCmdExpire, argList);
|
||||||
|
|
||||||
TEST_RESULT_UINT(expireFullBackup(infoBackup, 0), 0, "retention-full not set");
|
TEST_RESULT_UINT(expireFullBackup(infoBackup, 0), 0, "retention-full not set");
|
||||||
TEST_RESULT_LOG(
|
TEST_RESULT_LOG(
|
||||||
@ -231,7 +231,7 @@ testRun(void)
|
|||||||
TEST_TITLE("retention-full set - full backup no dependencies expired");
|
TEST_TITLE("retention-full set - full backup no dependencies expired");
|
||||||
|
|
||||||
strLstAddZ(argList, "--repo1-retention-full=2");
|
strLstAddZ(argList, "--repo1-retention-full=2");
|
||||||
harnessCfgLoad(cfgCmdExpire, argList);
|
HRN_CFG_LOAD(cfgCmdExpire, argList);
|
||||||
|
|
||||||
TEST_RESULT_UINT(expireFullBackup(infoBackup, 0), 1, "retention-full=2 - one full backup expired");
|
TEST_RESULT_UINT(expireFullBackup(infoBackup, 0), 1, "retention-full=2 - one full backup expired");
|
||||||
TEST_RESULT_UINT(infoBackupDataTotal(infoBackup), 5, "current backups reduced by 1 full - no dependencies");
|
TEST_RESULT_UINT(infoBackupDataTotal(infoBackup), 5, "current backups reduced by 1 full - no dependencies");
|
||||||
@ -247,7 +247,7 @@ testRun(void)
|
|||||||
|
|
||||||
argList = strLstDup(argListBase);
|
argList = strLstDup(argListBase);
|
||||||
strLstAddZ(argList, "--repo1-retention-full=1");
|
strLstAddZ(argList, "--repo1-retention-full=1");
|
||||||
harnessCfgLoad(cfgCmdExpire, argList);
|
HRN_CFG_LOAD(cfgCmdExpire, argList);
|
||||||
|
|
||||||
TEST_RESULT_UINT(expireFullBackup(infoBackup, 0), 3, "retention-full=1 - one full backup and dependencies expired");
|
TEST_RESULT_UINT(expireFullBackup(infoBackup, 0), 3, "retention-full=1 - one full backup and dependencies expired");
|
||||||
TEST_RESULT_UINT(infoBackupDataTotal(infoBackup), 2, "current backups reduced by 1 full and dependencies");
|
TEST_RESULT_UINT(infoBackupDataTotal(infoBackup), 2, "current backups reduced by 1 full and dependencies");
|
||||||
@ -279,7 +279,7 @@ testRun(void)
|
|||||||
|
|
||||||
// Load Parameters
|
// Load Parameters
|
||||||
StringList *argList = strLstDup(argListAvoidWarn);
|
StringList *argList = strLstDup(argListAvoidWarn);
|
||||||
harnessCfgLoad(cfgCmdExpire, argList);
|
HRN_CFG_LOAD(cfgCmdExpire, argList);
|
||||||
|
|
||||||
TEST_RESULT_UINT(expireDiffBackup(infoBackup, 0), 0, "retention-diff not set - nothing expired");
|
TEST_RESULT_UINT(expireDiffBackup(infoBackup, 0), 0, "retention-diff not set - nothing expired");
|
||||||
TEST_RESULT_UINT(infoBackupDataTotal(infoBackup), 6, "current backups not expired");
|
TEST_RESULT_UINT(infoBackupDataTotal(infoBackup), 6, "current backups not expired");
|
||||||
@ -290,7 +290,7 @@ testRun(void)
|
|||||||
// Add retention-diff
|
// Add retention-diff
|
||||||
StringList *argListTemp = strLstDup(argList);
|
StringList *argListTemp = strLstDup(argList);
|
||||||
strLstAddZ(argListTemp, "--repo1-retention-diff=6");
|
strLstAddZ(argListTemp, "--repo1-retention-diff=6");
|
||||||
harnessCfgLoad(cfgCmdExpire, argListTemp);
|
HRN_CFG_LOAD(cfgCmdExpire, argListTemp);
|
||||||
|
|
||||||
TEST_RESULT_UINT(expireDiffBackup(infoBackup, 0), 0, "retention-diff set - too soon to expire");
|
TEST_RESULT_UINT(expireDiffBackup(infoBackup, 0), 0, "retention-diff set - too soon to expire");
|
||||||
TEST_RESULT_UINT(infoBackupDataTotal(infoBackup), 6, "current backups not expired");
|
TEST_RESULT_UINT(infoBackupDataTotal(infoBackup), 6, "current backups not expired");
|
||||||
@ -299,7 +299,7 @@ testRun(void)
|
|||||||
TEST_TITLE("retention-diff set - diff and dependent incr expired");
|
TEST_TITLE("retention-diff set - diff and dependent incr expired");
|
||||||
|
|
||||||
strLstAddZ(argList, "--repo1-retention-diff=2");
|
strLstAddZ(argList, "--repo1-retention-diff=2");
|
||||||
harnessCfgLoad(cfgCmdExpire, argList);
|
HRN_CFG_LOAD(cfgCmdExpire, argList);
|
||||||
|
|
||||||
TEST_RESULT_UINT(expireDiffBackup(infoBackup, 0), 2, "retention-diff=2 - full considered in diff");
|
TEST_RESULT_UINT(expireDiffBackup(infoBackup, 0), 2, "retention-diff=2 - full considered in diff");
|
||||||
TEST_RESULT_UINT(infoBackupDataTotal(infoBackup), 4, "current backups reduced by 1 diff and dependent increment");
|
TEST_RESULT_UINT(infoBackupDataTotal(infoBackup), 4, "current backups reduced by 1 diff and dependent increment");
|
||||||
@ -316,7 +316,7 @@ testRun(void)
|
|||||||
//--------------------------------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------------------------------
|
||||||
argList = strLstDup(argListAvoidWarn);
|
argList = strLstDup(argListAvoidWarn);
|
||||||
strLstAddZ(argList, "--repo1-retention-diff=1");
|
strLstAddZ(argList, "--repo1-retention-diff=1");
|
||||||
harnessCfgLoad(cfgCmdExpire, argList);
|
HRN_CFG_LOAD(cfgCmdExpire, argList);
|
||||||
|
|
||||||
TEST_ASSIGN(infoBackup, infoBackupNewLoad(ioBufferReadNew(backupInfoBase)), "get backup.info");
|
TEST_ASSIGN(infoBackup, infoBackupNewLoad(ioBufferReadNew(backupInfoBase)), "get backup.info");
|
||||||
TEST_RESULT_UINT(expireDiffBackup(infoBackup, 0), 2, "retention-diff set to 1 - full considered in diff");
|
TEST_RESULT_UINT(expireDiffBackup(infoBackup, 0), 2, "retention-diff set to 1 - full considered in diff");
|
||||||
@ -376,7 +376,7 @@ testRun(void)
|
|||||||
// Load parameters
|
// Load parameters
|
||||||
argList = strLstDup(argListAvoidWarn);
|
argList = strLstDup(argListAvoidWarn);
|
||||||
strLstAddZ(argList, "--repo1-retention-diff=1");
|
strLstAddZ(argList, "--repo1-retention-diff=1");
|
||||||
harnessCfgLoad(cfgCmdExpire, argList);
|
HRN_CFG_LOAD(cfgCmdExpire, argList);
|
||||||
|
|
||||||
TEST_RESULT_UINT(expireDiffBackup(infoBackup, 0), 1, "retention-diff set - only oldest diff expired");
|
TEST_RESULT_UINT(expireDiffBackup(infoBackup, 0), 1, "retention-diff set - only oldest diff expired");
|
||||||
TEST_RESULT_UINT(infoBackupDataTotal(infoBackup), 2, "current backups reduced by one");
|
TEST_RESULT_UINT(infoBackupDataTotal(infoBackup), 2, "current backups reduced by one");
|
||||||
@ -442,7 +442,7 @@ testRun(void)
|
|||||||
// Load Parameters
|
// Load Parameters
|
||||||
StringList *argList = strLstDup(argListBase);
|
StringList *argList = strLstDup(argListBase);
|
||||||
strLstAddZ(argList, "--repo1-retention-full=1");
|
strLstAddZ(argList, "--repo1-retention-full=1");
|
||||||
harnessCfgLoad(cfgCmdExpire, argList);
|
HRN_CFG_LOAD(cfgCmdExpire, argList);
|
||||||
|
|
||||||
TEST_RESULT_VOID(removeExpiredBackup(infoBackup, NULL, 0), "remove backups not in backup.info current");
|
TEST_RESULT_VOID(removeExpiredBackup(infoBackup, NULL, 0), "remove backups not in backup.info current");
|
||||||
|
|
||||||
@ -493,7 +493,7 @@ testRun(void)
|
|||||||
strLstAddZ(argList, "--stanza=db");
|
strLstAddZ(argList, "--stanza=db");
|
||||||
strLstAddZ(argList, "--repo1-retention-full=1"); // avoid warning
|
strLstAddZ(argList, "--repo1-retention-full=1"); // avoid warning
|
||||||
strLstAddZ(argList, "--repo1-host=/repo/not/local");
|
strLstAddZ(argList, "--repo1-host=/repo/not/local");
|
||||||
harnessCfgLoad(cfgCmdExpire, argList);
|
HRN_CFG_LOAD(cfgCmdExpire, argList);
|
||||||
|
|
||||||
TEST_ERROR(cmdExpire(), HostInvalidError, "expire command must be run on the repository host");
|
TEST_ERROR(cmdExpire(), HostInvalidError, "expire command must be run on the repository host");
|
||||||
|
|
||||||
@ -501,7 +501,7 @@ testRun(void)
|
|||||||
TEST_TITLE("check stop file");
|
TEST_TITLE("check stop file");
|
||||||
|
|
||||||
argList = strLstDup(argListAvoidWarn);
|
argList = strLstDup(argListAvoidWarn);
|
||||||
harnessCfgLoad(cfgCmdExpire, argList);
|
HRN_CFG_LOAD(cfgCmdExpire, argList);
|
||||||
|
|
||||||
// Create the stop file
|
// Create the stop file
|
||||||
TEST_RESULT_VOID(
|
TEST_RESULT_VOID(
|
||||||
@ -517,7 +517,7 @@ testRun(void)
|
|||||||
|
|
||||||
// Load Parameters
|
// Load Parameters
|
||||||
argList = strLstDup(argListBase);
|
argList = strLstDup(argListBase);
|
||||||
harnessCfgLoad(cfgCmdExpire, argList);
|
HRN_CFG_LOAD(cfgCmdExpire, argList);
|
||||||
|
|
||||||
// Create backup.info without current backups
|
// Create backup.info without current backups
|
||||||
const Buffer *backupInfoContent = harnessInfoChecksumZ
|
const Buffer *backupInfoContent = harnessInfoChecksumZ
|
||||||
@ -553,7 +553,7 @@ testRun(void)
|
|||||||
|
|
||||||
// Set archive retention, archive retention type default but no current backups - code path test
|
// Set archive retention, archive retention type default but no current backups - code path test
|
||||||
strLstAddZ(argList, "--repo1-retention-archive=4");
|
strLstAddZ(argList, "--repo1-retention-archive=4");
|
||||||
harnessCfgLoad(cfgCmdExpire, argList);
|
HRN_CFG_LOAD(cfgCmdExpire, argList);
|
||||||
|
|
||||||
TEST_RESULT_VOID(
|
TEST_RESULT_VOID(
|
||||||
removeExpiredArchive(infoBackup, false, 0), "archive retention set, retention type default, no current backups");
|
removeExpiredArchive(infoBackup, false, 0), "archive retention set, retention type default, no current backups");
|
||||||
@ -666,7 +666,7 @@ testRun(void)
|
|||||||
|
|
||||||
argList = strLstDup(argListAvoidWarn);
|
argList = strLstDup(argListAvoidWarn);
|
||||||
strLstAddZ(argList, "--repo1-retention-archive=3");
|
strLstAddZ(argList, "--repo1-retention-archive=3");
|
||||||
harnessCfgLoad(cfgCmdExpire, argList);
|
HRN_CFG_LOAD(cfgCmdExpire, argList);
|
||||||
|
|
||||||
TEST_RESULT_VOID(
|
TEST_RESULT_VOID(
|
||||||
removeExpiredArchive(infoBackup, false, 0), "archive retention type = full (default), repo1-retention-archive=3");
|
removeExpiredArchive(infoBackup, false, 0), "archive retention type = full (default), repo1-retention-archive=3");
|
||||||
@ -694,7 +694,7 @@ testRun(void)
|
|||||||
|
|
||||||
argList = strLstDup(argListAvoidWarn);
|
argList = strLstDup(argListAvoidWarn);
|
||||||
strLstAddZ(argList, "--repo1-retention-archive=2");
|
strLstAddZ(argList, "--repo1-retention-archive=2");
|
||||||
harnessCfgLoad(cfgCmdExpire, argList);
|
HRN_CFG_LOAD(cfgCmdExpire, argList);
|
||||||
|
|
||||||
TEST_RESULT_VOID(
|
TEST_RESULT_VOID(
|
||||||
removeExpiredArchive(infoBackup, false, 0), "archive retention type = full (default), repo1-retention-archive=2");
|
removeExpiredArchive(infoBackup, false, 0), "archive retention type = full (default), repo1-retention-archive=2");
|
||||||
@ -724,7 +724,7 @@ testRun(void)
|
|||||||
|
|
||||||
argList = strLstDup(argListAvoidWarn);
|
argList = strLstDup(argListAvoidWarn);
|
||||||
strLstAddZ(argList, "--repo1-retention-archive=1");
|
strLstAddZ(argList, "--repo1-retention-archive=1");
|
||||||
harnessCfgLoad(cfgCmdExpire, argList);
|
HRN_CFG_LOAD(cfgCmdExpire, argList);
|
||||||
|
|
||||||
TEST_RESULT_VOID(
|
TEST_RESULT_VOID(
|
||||||
removeExpiredArchive(infoBackup, false, 0), "archive retention type = full (default), repo1-retention-archive=1");
|
removeExpiredArchive(infoBackup, false, 0), "archive retention type = full (default), repo1-retention-archive=1");
|
||||||
@ -754,7 +754,7 @@ testRun(void)
|
|||||||
strLstAddZ(argList, "--repo1-retention-archive=2");
|
strLstAddZ(argList, "--repo1-retention-archive=2");
|
||||||
strLstAddZ(argList, "--repo1-retention-archive-type=diff");
|
strLstAddZ(argList, "--repo1-retention-archive-type=diff");
|
||||||
strLstAddZ(argList, "--repo1-retention-diff=2");
|
strLstAddZ(argList, "--repo1-retention-diff=2");
|
||||||
harnessCfgLoad(cfgCmdExpire, argList);
|
HRN_CFG_LOAD(cfgCmdExpire, argList);
|
||||||
|
|
||||||
TEST_RESULT_VOID(
|
TEST_RESULT_VOID(
|
||||||
removeExpiredArchive(infoBackup, false, 0),
|
removeExpiredArchive(infoBackup, false, 0),
|
||||||
@ -792,7 +792,7 @@ testRun(void)
|
|||||||
argList = strLstDup(argListAvoidWarn);
|
argList = strLstDup(argListAvoidWarn);
|
||||||
strLstAddZ(argList, "--repo1-retention-archive=4");
|
strLstAddZ(argList, "--repo1-retention-archive=4");
|
||||||
strLstAddZ(argList, "--repo1-retention-archive-type=incr");
|
strLstAddZ(argList, "--repo1-retention-archive-type=incr");
|
||||||
harnessCfgLoad(cfgCmdExpire, argList);
|
HRN_CFG_LOAD(cfgCmdExpire, argList);
|
||||||
|
|
||||||
// Regenerate archive
|
// Regenerate archive
|
||||||
archiveGenerate(storageTest, archiveStanzaPath, 1, 10, "9.4-1", "0000000200000000");
|
archiveGenerate(storageTest, archiveStanzaPath, 1, 10, "9.4-1", "0000000200000000");
|
||||||
@ -834,7 +834,7 @@ testRun(void)
|
|||||||
strLstAddZ(argList, "--repo1-retention-archive=2");
|
strLstAddZ(argList, "--repo1-retention-archive=2");
|
||||||
strLstAddZ(argList, "--repo1-retention-archive-type=diff");
|
strLstAddZ(argList, "--repo1-retention-archive-type=diff");
|
||||||
strLstAddZ(argList, "--dry-run");
|
strLstAddZ(argList, "--dry-run");
|
||||||
harnessCfgLoad(cfgCmdExpire, argList);
|
HRN_CFG_LOAD(cfgCmdExpire, argList);
|
||||||
|
|
||||||
// Write backup.manifest so infoBackup reconstruct produces same results as backup.info on disk
|
// Write backup.manifest so infoBackup reconstruct produces same results as backup.info on disk
|
||||||
storagePutP(
|
storagePutP(
|
||||||
@ -895,7 +895,7 @@ testRun(void)
|
|||||||
StringList *argList2 = strLstDup(argList);
|
StringList *argList2 = strLstDup(argList);
|
||||||
hrnCfgArgRawZ(argList2, cfgOptRepo, "2");
|
hrnCfgArgRawZ(argList2, cfgOptRepo, "2");
|
||||||
strLstAddZ(argList2, "--pg1-path=" TEST_PATH "/pg");
|
strLstAddZ(argList2, "--pg1-path=" TEST_PATH "/pg");
|
||||||
harnessCfgLoad(cfgCmdBackup, argList2);
|
HRN_CFG_LOAD(cfgCmdBackup, argList2);
|
||||||
|
|
||||||
TEST_RESULT_VOID(cmdExpire(), "via backup command: expire last backup in archive sub path and remove sub path");
|
TEST_RESULT_VOID(cmdExpire(), "via backup command: expire last backup in archive sub path and remove sub path");
|
||||||
TEST_RESULT_BOOL(
|
TEST_RESULT_BOOL(
|
||||||
@ -925,7 +925,7 @@ testRun(void)
|
|||||||
|
|
||||||
// Add to previous list and specify repo
|
// Add to previous list and specify repo
|
||||||
hrnCfgArgRawZ(argList, cfgOptRepo, "1");
|
hrnCfgArgRawZ(argList, cfgOptRepo, "1");
|
||||||
harnessCfgLoad(cfgCmdExpire, argList);
|
HRN_CFG_LOAD(cfgCmdExpire, argList);
|
||||||
|
|
||||||
TEST_RESULT_VOID(cmdExpire(), "expire last backup in archive sub path and remove sub path");
|
TEST_RESULT_VOID(cmdExpire(), "expire last backup in archive sub path and remove sub path");
|
||||||
TEST_RESULT_BOOL(
|
TEST_RESULT_BOOL(
|
||||||
@ -951,7 +951,7 @@ testRun(void)
|
|||||||
|
|
||||||
argList2 = strLstDup(argList);
|
argList2 = strLstDup(argList);
|
||||||
strLstAddZ(argList2, "--dry-run");
|
strLstAddZ(argList2, "--dry-run");
|
||||||
harnessCfgLoad(cfgCmdExpire, argList2);
|
HRN_CFG_LOAD(cfgCmdExpire, argList2);
|
||||||
|
|
||||||
harnessLogLevelSet(logLevelDetail);
|
harnessLogLevelSet(logLevelDetail);
|
||||||
|
|
||||||
@ -1090,7 +1090,7 @@ testRun(void)
|
|||||||
TEST_TITLE("expire command - multi-repo, archive and backups removed");
|
TEST_TITLE("expire command - multi-repo, archive and backups removed");
|
||||||
|
|
||||||
// Rerun previous test without dry-run
|
// Rerun previous test without dry-run
|
||||||
harnessCfgLoad(cfgCmdExpire, argList);
|
HRN_CFG_LOAD(cfgCmdExpire, argList);
|
||||||
|
|
||||||
TEST_RESULT_VOID(cmdExpire(), "expire backups and remove archive path");
|
TEST_RESULT_VOID(cmdExpire(), "expire backups and remove archive path");
|
||||||
TEST_RESULT_BOOL(
|
TEST_RESULT_BOOL(
|
||||||
@ -1134,7 +1134,7 @@ testRun(void)
|
|||||||
// With multi-repo config from previous test, adhoc expire on backup that doesn't exist
|
// With multi-repo config from previous test, adhoc expire on backup that doesn't exist
|
||||||
argList2 = strLstDup(argList);
|
argList2 = strLstDup(argList);
|
||||||
hrnCfgArgRawZ(argList2, cfgOptSet, "20201119-123456F_20201119-234567I");
|
hrnCfgArgRawZ(argList2, cfgOptSet, "20201119-123456F_20201119-234567I");
|
||||||
harnessCfgLoad(cfgCmdExpire, argList2);
|
HRN_CFG_LOAD(cfgCmdExpire, argList2);
|
||||||
|
|
||||||
TEST_RESULT_VOID(cmdExpire(), "label format OK but backup does not exist on any repo");
|
TEST_RESULT_VOID(cmdExpire(), "label format OK but backup does not exist on any repo");
|
||||||
TEST_RESULT_LOG(
|
TEST_RESULT_LOG(
|
||||||
@ -1146,7 +1146,7 @@ testRun(void)
|
|||||||
|
|
||||||
// Rerun on single repo
|
// Rerun on single repo
|
||||||
hrnCfgArgRawZ(argList2, cfgOptRepo, "1");
|
hrnCfgArgRawZ(argList2, cfgOptRepo, "1");
|
||||||
harnessCfgLoad(cfgCmdExpire, argList2);
|
HRN_CFG_LOAD(cfgCmdExpire, argList2);
|
||||||
|
|
||||||
TEST_RESULT_VOID(cmdExpire(), "label format OK but backup does not exist on requested repo");
|
TEST_RESULT_VOID(cmdExpire(), "label format OK but backup does not exist on requested repo");
|
||||||
TEST_RESULT_LOG(
|
TEST_RESULT_LOG(
|
||||||
@ -1158,7 +1158,7 @@ testRun(void)
|
|||||||
hrnCfgArgRawZ(argList, cfgOptSet, "20181119-152900F_20181119-152500I");
|
hrnCfgArgRawZ(argList, cfgOptSet, "20181119-152900F_20181119-152500I");
|
||||||
hrnCfgArgRawZ(argList, cfgOptRepo, "1");
|
hrnCfgArgRawZ(argList, cfgOptRepo, "1");
|
||||||
hrnCfgArgRawBool(argList, cfgOptDryRun, true);
|
hrnCfgArgRawBool(argList, cfgOptDryRun, true);
|
||||||
harnessCfgLoad(cfgCmdExpire, argList);
|
HRN_CFG_LOAD(cfgCmdExpire, argList);
|
||||||
|
|
||||||
// Incremental removed but no archives expired because the only remaining full backups must be able to play through PITR
|
// Incremental removed but no archives expired because the only remaining full backups must be able to play through PITR
|
||||||
TEST_RESULT_VOID(cmdExpire(), "label format OK and expired on specified repo");
|
TEST_RESULT_VOID(cmdExpire(), "label format OK and expired on specified repo");
|
||||||
@ -1175,7 +1175,7 @@ testRun(void)
|
|||||||
argList = strLstDup(argListAvoidWarn);
|
argList = strLstDup(argListAvoidWarn);
|
||||||
strLstAddZ(argList, "--set=" BOGUS_STR);
|
strLstAddZ(argList, "--set=" BOGUS_STR);
|
||||||
|
|
||||||
harnessCfgLoad(cfgCmdExpire, argList);
|
HRN_CFG_LOAD(cfgCmdExpire, argList);
|
||||||
TEST_ERROR(cmdExpire(), OptionInvalidValueError, "'" BOGUS_STR "' is not a valid backup label format");
|
TEST_ERROR(cmdExpire(), OptionInvalidValueError, "'" BOGUS_STR "' is not a valid backup label format");
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------------------------------
|
||||||
@ -1185,7 +1185,7 @@ testRun(void)
|
|||||||
argList = strLstDup(argListAvoidWarn);
|
argList = strLstDup(argListAvoidWarn);
|
||||||
strLstAddZ(argList, "--repo1-retention-archive=1");
|
strLstAddZ(argList, "--repo1-retention-archive=1");
|
||||||
strLstAddZ(argList, "--pg1-path=" TEST_PATH "/pg");
|
strLstAddZ(argList, "--pg1-path=" TEST_PATH "/pg");
|
||||||
harnessCfgLoad(cfgCmdBackup, argList);
|
HRN_CFG_LOAD(cfgCmdBackup, argList);
|
||||||
|
|
||||||
TEST_RESULT_VOID(cmdExpire(), "expire remove archive path");
|
TEST_RESULT_VOID(cmdExpire(), "expire remove archive path");
|
||||||
TEST_RESULT_LOG_FMT(
|
TEST_RESULT_LOG_FMT(
|
||||||
@ -1243,7 +1243,7 @@ testRun(void)
|
|||||||
argList = strLstDup(argListAvoidWarn);
|
argList = strLstDup(argListAvoidWarn);
|
||||||
strLstAddZ(argList, "--repo1-retention-archive=2");
|
strLstAddZ(argList, "--repo1-retention-archive=2");
|
||||||
strLstAddZ(argList, "--repo1-retention-archive-type=full");
|
strLstAddZ(argList, "--repo1-retention-archive-type=full");
|
||||||
harnessCfgLoad(cfgCmdExpire, argList);
|
HRN_CFG_LOAD(cfgCmdExpire, argList);
|
||||||
|
|
||||||
TEST_RESULT_VOID(
|
TEST_RESULT_VOID(
|
||||||
removeExpiredArchive(infoBackup, false, 0), "backup selected for retention does not have archive-start so do nothing");
|
removeExpiredArchive(infoBackup, false, 0), "backup selected for retention does not have archive-start so do nothing");
|
||||||
@ -1258,7 +1258,7 @@ testRun(void)
|
|||||||
argList = strLstDup(argListAvoidWarn);
|
argList = strLstDup(argListAvoidWarn);
|
||||||
strLstAddZ(argList, "--repo1-retention-archive=1");
|
strLstAddZ(argList, "--repo1-retention-archive=1");
|
||||||
strLstAddZ(argList, "--repo1-retention-archive-type=full");
|
strLstAddZ(argList, "--repo1-retention-archive-type=full");
|
||||||
harnessCfgLoad(cfgCmdExpire, argList);
|
HRN_CFG_LOAD(cfgCmdExpire, argList);
|
||||||
harnessLogLevelSet(logLevelDetail);
|
harnessLogLevelSet(logLevelDetail);
|
||||||
|
|
||||||
TEST_RESULT_VOID(
|
TEST_RESULT_VOID(
|
||||||
@ -1277,7 +1277,7 @@ testRun(void)
|
|||||||
argList = strLstDup(argListBase);
|
argList = strLstDup(argListBase);
|
||||||
strLstAddZ(argList, "--repo1-retention-full=2");
|
strLstAddZ(argList, "--repo1-retention-full=2");
|
||||||
strLstAddZ(argList, "--dry-run");
|
strLstAddZ(argList, "--dry-run");
|
||||||
harnessCfgLoad(cfgCmdExpire, argList);
|
HRN_CFG_LOAD(cfgCmdExpire, argList);
|
||||||
|
|
||||||
// Create backup.info and archives spread over different timelines
|
// Create backup.info and archives spread over different timelines
|
||||||
storagePutP(storageNewWriteP(storageTest, backupInfoFileName),
|
storagePutP(storageNewWriteP(storageTest, backupInfoFileName),
|
||||||
@ -1366,7 +1366,7 @@ testRun(void)
|
|||||||
// Load Parameters
|
// Load Parameters
|
||||||
argList = strLstDup(argListBase);
|
argList = strLstDup(argListBase);
|
||||||
strLstAddZ(argList, "--repo1-retention-full=2");
|
strLstAddZ(argList, "--repo1-retention-full=2");
|
||||||
harnessCfgLoad(cfgCmdExpire, argList);
|
HRN_CFG_LOAD(cfgCmdExpire, argList);
|
||||||
|
|
||||||
TEST_RESULT_VOID(cmdExpire(), "expire remove 00000002.history file");
|
TEST_RESULT_VOID(cmdExpire(), "expire remove 00000002.history file");
|
||||||
TEST_RESULT_BOOL(
|
TEST_RESULT_BOOL(
|
||||||
@ -1390,7 +1390,7 @@ testRun(void)
|
|||||||
argList = strLstDup(argListBase);
|
argList = strLstDup(argListBase);
|
||||||
strLstAddZ(argList, "--repo1-retention-full=2");
|
strLstAddZ(argList, "--repo1-retention-full=2");
|
||||||
strLstAddZ(argList, "--pg1-path=" TEST_PATH "/pg");
|
strLstAddZ(argList, "--pg1-path=" TEST_PATH "/pg");
|
||||||
harnessCfgLoad(cfgCmdBackup, argList);
|
HRN_CFG_LOAD(cfgCmdBackup, argList);
|
||||||
|
|
||||||
storagePutP(
|
storagePutP(
|
||||||
storageNewWriteP(storageTest, strNewFmt("%s/10-2/00000002.history", strZ(archiveStanzaPath))), BUFSTRDEF("tmp"));
|
storageNewWriteP(storageTest, strNewFmt("%s/10-2/00000002.history", strZ(archiveStanzaPath))), BUFSTRDEF("tmp"));
|
||||||
@ -1442,7 +1442,7 @@ testRun(void)
|
|||||||
hrnCfgArgRawZ(argList, cfgOptRepoRetentionFull, "2");
|
hrnCfgArgRawZ(argList, cfgOptRepoRetentionFull, "2");
|
||||||
hrnCfgArgRawFmt(argList, cfgOptRepoRetentionHistory, "%u", historyRetentionDays);
|
hrnCfgArgRawFmt(argList, cfgOptRepoRetentionHistory, "%u", historyRetentionDays);
|
||||||
hrnCfgArgRawBool(argList, cfgOptDryRun, true);
|
hrnCfgArgRawBool(argList, cfgOptDryRun, true);
|
||||||
harnessCfgLoad(cfgCmdExpire, argList);
|
HRN_CFG_LOAD(cfgCmdExpire, argList);
|
||||||
|
|
||||||
TEST_RESULT_VOID(cmdExpire(), "expire");
|
TEST_RESULT_VOID(cmdExpire(), "expire");
|
||||||
|
|
||||||
@ -1477,7 +1477,7 @@ testRun(void)
|
|||||||
argList = strLstDup(argListBase);
|
argList = strLstDup(argListBase);
|
||||||
hrnCfgArgRawZ(argList, cfgOptRepoRetentionFull, "2");
|
hrnCfgArgRawZ(argList, cfgOptRepoRetentionFull, "2");
|
||||||
hrnCfgArgRawFmt(argList, cfgOptRepoRetentionHistory, "%u", historyRetentionDays);
|
hrnCfgArgRawFmt(argList, cfgOptRepoRetentionHistory, "%u", historyRetentionDays);
|
||||||
harnessCfgLoad(cfgCmdExpire, argList);
|
HRN_CFG_LOAD(cfgCmdExpire, argList);
|
||||||
|
|
||||||
HRN_STORAGE_PUT_Z(storageRepoWrite(), STORAGE_REPO_BACKUP "/backup.history/2019/20191119-152138F.manifest.gz", "tmp");
|
HRN_STORAGE_PUT_Z(storageRepoWrite(), STORAGE_REPO_BACKUP "/backup.history/2019/20191119-152138F.manifest.gz", "tmp");
|
||||||
|
|
||||||
@ -1512,7 +1512,7 @@ testRun(void)
|
|||||||
HRN_STORAGE_PUT_Z(storageRepoWrite(), STORAGE_REPO_BACKUP "/backup.history/2017/20171119-152138F.manifest.gz", "tmp");
|
HRN_STORAGE_PUT_Z(storageRepoWrite(), STORAGE_REPO_BACKUP "/backup.history/2017/20171119-152138F.manifest.gz", "tmp");
|
||||||
|
|
||||||
hrnCfgArgRawZ(argList, cfgOptPgPath, TEST_PATH_PG);
|
hrnCfgArgRawZ(argList, cfgOptPgPath, TEST_PATH_PG);
|
||||||
harnessCfgLoad(cfgCmdBackup, argList);
|
HRN_CFG_LOAD(cfgCmdBackup, argList);
|
||||||
|
|
||||||
TEST_RESULT_VOID(cmdExpire(), "expire");
|
TEST_RESULT_VOID(cmdExpire(), "expire");
|
||||||
|
|
||||||
@ -1544,7 +1544,7 @@ testRun(void)
|
|||||||
// Load Parameters
|
// Load Parameters
|
||||||
StringList *argList = strLstDup(argListBase);
|
StringList *argList = strLstDup(argListBase);
|
||||||
strLstAddZ(argList, "--repo1-retention-full=2");
|
strLstAddZ(argList, "--repo1-retention-full=2");
|
||||||
harnessCfgLoad(cfgCmdExpire, argList);
|
HRN_CFG_LOAD(cfgCmdExpire, argList);
|
||||||
|
|
||||||
storagePutP(storageNewWriteP(storageTest, backupInfoFileName),
|
storagePutP(storageNewWriteP(storageTest, backupInfoFileName),
|
||||||
harnessInfoChecksumZ(
|
harnessInfoChecksumZ(
|
||||||
@ -1739,7 +1739,7 @@ testRun(void)
|
|||||||
|
|
||||||
argList = strLstDup(argListBase);
|
argList = strLstDup(argListBase);
|
||||||
strLstAddZ(argList, "--repo1-retention-full=1");
|
strLstAddZ(argList, "--repo1-retention-full=1");
|
||||||
harnessCfgLoad(cfgCmdExpire, argList);
|
HRN_CFG_LOAD(cfgCmdExpire, argList);
|
||||||
|
|
||||||
// Here, although backup 20181119-152138F of 10-1 will be expired, the WAL in 10-1 will not since the archive.info
|
// Here, although backup 20181119-152138F of 10-1 will be expired, the WAL in 10-1 will not since the archive.info
|
||||||
// does not know about that dir. Again, not really realistic since if it is on disk and reconstructed it would have. So
|
// does not know about that dir. Again, not really realistic since if it is on disk and reconstructed it would have. So
|
||||||
@ -1949,7 +1949,7 @@ testRun(void)
|
|||||||
StringList *argList = strLstDup(argListBase);
|
StringList *argList = strLstDup(argListBase);
|
||||||
strLstAddZ(argList, "--repo1-retention-full=1");
|
strLstAddZ(argList, "--repo1-retention-full=1");
|
||||||
strLstAddZ(argList, "--set=20181119-152800F_20181119-152152D");
|
strLstAddZ(argList, "--set=20181119-152800F_20181119-152152D");
|
||||||
harnessCfgLoad(cfgCmdExpire, argList);
|
HRN_CFG_LOAD(cfgCmdExpire, argList);
|
||||||
|
|
||||||
// Set the log level to detail so archive expiration messages are seen
|
// Set the log level to detail so archive expiration messages are seen
|
||||||
harnessLogLevelSet(logLevelDetail);
|
harnessLogLevelSet(logLevelDetail);
|
||||||
@ -1994,7 +1994,7 @@ testRun(void)
|
|||||||
argList = strLstDup(argListBase);
|
argList = strLstDup(argListBase);
|
||||||
strLstAddZ(argList, "--repo1-retention-full=1");
|
strLstAddZ(argList, "--repo1-retention-full=1");
|
||||||
strLstAddZ(argList, "--set=20181119-152138F");
|
strLstAddZ(argList, "--set=20181119-152138F");
|
||||||
harnessCfgLoad(cfgCmdExpire, argList);
|
HRN_CFG_LOAD(cfgCmdExpire, argList);
|
||||||
|
|
||||||
TEST_RESULT_VOID(cmdExpire(), "adhoc expire full backup");
|
TEST_RESULT_VOID(cmdExpire(), "adhoc expire full backup");
|
||||||
TEST_RESULT_BOOL(
|
TEST_RESULT_BOOL(
|
||||||
@ -2026,7 +2026,7 @@ testRun(void)
|
|||||||
argList = strLstDup(argListBase);
|
argList = strLstDup(argListBase);
|
||||||
strLstAddZ(argList, "--repo1-retention-full=1");
|
strLstAddZ(argList, "--repo1-retention-full=1");
|
||||||
strLstAddZ(argList, "--set=20181119-152900F");
|
strLstAddZ(argList, "--set=20181119-152900F");
|
||||||
harnessCfgLoad(cfgCmdExpire, argList);
|
HRN_CFG_LOAD(cfgCmdExpire, argList);
|
||||||
|
|
||||||
String *archiveRemaining = strNew();
|
String *archiveRemaining = strNew();
|
||||||
strCatFmt(
|
strCatFmt(
|
||||||
@ -2069,7 +2069,7 @@ testRun(void)
|
|||||||
|
|
||||||
argList = strLstDup(argListAvoidWarn);
|
argList = strLstDup(argListAvoidWarn);
|
||||||
strLstAddZ(argList, "--set=20181119-152850F");
|
strLstAddZ(argList, "--set=20181119-152850F");
|
||||||
harnessCfgLoad(cfgCmdExpire, argList);
|
HRN_CFG_LOAD(cfgCmdExpire, argList);
|
||||||
|
|
||||||
TEST_ERROR(
|
TEST_ERROR(
|
||||||
cmdExpire(), CommandError, CFGCMD_EXPIRE " command encountered 1 error(s), check the log file for details");
|
cmdExpire(), CommandError, CFGCMD_EXPIRE " command encountered 1 error(s), check the log file for details");
|
||||||
@ -2082,7 +2082,7 @@ testRun(void)
|
|||||||
|
|
||||||
argList = strLstDup(argListAvoidWarn);
|
argList = strLstDup(argListAvoidWarn);
|
||||||
strLstAddZ(argList, "--set=20181119-152800F");
|
strLstAddZ(argList, "--set=20181119-152800F");
|
||||||
harnessCfgLoad(cfgCmdExpire, argList);
|
HRN_CFG_LOAD(cfgCmdExpire, argList);
|
||||||
|
|
||||||
TEST_RESULT_VOID(cmdExpire(), "adhoc expire last prior db-id backup");
|
TEST_RESULT_VOID(cmdExpire(), "adhoc expire last prior db-id backup");
|
||||||
TEST_RESULT_BOOL(
|
TEST_RESULT_BOOL(
|
||||||
@ -2105,7 +2105,7 @@ testRun(void)
|
|||||||
|
|
||||||
argList = strLstDup(argListAvoidWarn);
|
argList = strLstDup(argListAvoidWarn);
|
||||||
strLstAddZ(argList, "--set=20181119-152850F");
|
strLstAddZ(argList, "--set=20181119-152850F");
|
||||||
harnessCfgLoad(cfgCmdExpire, argList);
|
HRN_CFG_LOAD(cfgCmdExpire, argList);
|
||||||
|
|
||||||
TEST_ERROR(
|
TEST_ERROR(
|
||||||
cmdExpire(), CommandError, CFGCMD_EXPIRE " command encountered 1 error(s), check the log file for details");
|
cmdExpire(), CommandError, CFGCMD_EXPIRE " command encountered 1 error(s), check the log file for details");
|
||||||
@ -2153,7 +2153,7 @@ testRun(void)
|
|||||||
argList = strLstDup(argListAvoidWarn);
|
argList = strLstDup(argListAvoidWarn);
|
||||||
strLstAddZ(argList, "--set=20181119-152850F_20181119-152252D");
|
strLstAddZ(argList, "--set=20181119-152850F_20181119-152252D");
|
||||||
strLstAddZ(argList, "--dry-run");
|
strLstAddZ(argList, "--dry-run");
|
||||||
harnessCfgLoad(cfgCmdExpire, argList);
|
HRN_CFG_LOAD(cfgCmdExpire, argList);
|
||||||
|
|
||||||
// Load the backup info. Do not store a manifest file for the adhoc backup for code coverage
|
// Load the backup info. Do not store a manifest file for the adhoc backup for code coverage
|
||||||
TEST_ASSIGN(infoBackup, infoBackupLoadFile(storageTest, backupInfoFileName, cipherTypeNone, NULL), "get backup.info");
|
TEST_ASSIGN(infoBackup, infoBackupLoadFile(storageTest, backupInfoFileName, cipherTypeNone, NULL), "get backup.info");
|
||||||
@ -2186,7 +2186,7 @@ testRun(void)
|
|||||||
hrnCfgArgKeyRawZ(argList, cfgOptRepoRetentionFull, 2, "1");
|
hrnCfgArgKeyRawZ(argList, cfgOptRepoRetentionFull, 2, "1");
|
||||||
hrnCfgArgKeyRawStrId(argList, cfgOptRepoCipherType, 2, cipherTypeAes256Cbc);
|
hrnCfgArgKeyRawStrId(argList, cfgOptRepoCipherType, 2, cipherTypeAes256Cbc);
|
||||||
hrnCfgEnvKeyRawZ(cfgOptRepoCipherPass, 2, TEST_CIPHER_PASS);
|
hrnCfgEnvKeyRawZ(cfgOptRepoCipherPass, 2, TEST_CIPHER_PASS);
|
||||||
harnessCfgLoad(cfgCmdExpire, argList);
|
HRN_CFG_LOAD(cfgCmdExpire, argList);
|
||||||
|
|
||||||
// Create backup.info
|
// Create backup.info
|
||||||
#define TEST_BACKUP_CURRENT \
|
#define TEST_BACKUP_CURRENT \
|
||||||
@ -2440,7 +2440,7 @@ testRun(void)
|
|||||||
TEST_TITLE("oldest backup not expired");
|
TEST_TITLE("oldest backup not expired");
|
||||||
|
|
||||||
StringList *argList = strLstDup(argListTime);
|
StringList *argList = strLstDup(argListTime);
|
||||||
harnessCfgLoad(cfgCmdExpire, argList);
|
HRN_CFG_LOAD(cfgCmdExpire, argList);
|
||||||
|
|
||||||
TEST_ASSIGN(infoBackup, infoBackupNewLoad(ioBufferReadNew(backupInfoBase)), "get backup.info");
|
TEST_ASSIGN(infoBackup, infoBackupNewLoad(ioBufferReadNew(backupInfoBase)), "get backup.info");
|
||||||
TEST_RESULT_VOID(cmdExpire(), "repo-retention-full not set for time-based");
|
TEST_RESULT_VOID(cmdExpire(), "repo-retention-full not set for time-based");
|
||||||
@ -2462,7 +2462,7 @@ testRun(void)
|
|||||||
|
|
||||||
// Add a time period
|
// Add a time period
|
||||||
strLstAddZ(argList, "--repo1-retention-full=35");
|
strLstAddZ(argList, "--repo1-retention-full=35");
|
||||||
harnessCfgLoad(cfgCmdExpire, argList);
|
HRN_CFG_LOAD(cfgCmdExpire, argList);
|
||||||
|
|
||||||
TEST_RESULT_VOID(cmdExpire(), "oldest backup older but other backups too young");
|
TEST_RESULT_VOID(cmdExpire(), "oldest backup older but other backups too young");
|
||||||
TEST_RESULT_STRLST_STR(
|
TEST_RESULT_STRLST_STR(
|
||||||
@ -2482,7 +2482,7 @@ testRun(void)
|
|||||||
argList = strLstDup(argListTime);
|
argList = strLstDup(argListTime);
|
||||||
strLstAddZ(argList, "--repo1-retention-full=30");
|
strLstAddZ(argList, "--repo1-retention-full=30");
|
||||||
strLstAddZ(argList, "--dry-run");
|
strLstAddZ(argList, "--dry-run");
|
||||||
harnessCfgLoad(cfgCmdExpire, argList);
|
HRN_CFG_LOAD(cfgCmdExpire, argList);
|
||||||
TEST_RESULT_VOID(cmdExpire(), "only oldest backup expired - dry-run");
|
TEST_RESULT_VOID(cmdExpire(), "only oldest backup expired - dry-run");
|
||||||
TEST_RESULT_LOG(
|
TEST_RESULT_LOG(
|
||||||
"P00 INFO: [DRY-RUN] repo1: expire time-based backup 20181119-152138F\n"
|
"P00 INFO: [DRY-RUN] repo1: expire time-based backup 20181119-152138F\n"
|
||||||
@ -2491,7 +2491,7 @@ testRun(void)
|
|||||||
"P00 INFO: [DRY-RUN] repo1: 9.4-1 remove archive, start = 000000010000000000000001, stop = 000000010000000000000003");
|
"P00 INFO: [DRY-RUN] repo1: 9.4-1 remove archive, start = 000000010000000000000001, stop = 000000010000000000000003");
|
||||||
|
|
||||||
strLstAddZ(argList, "--repo1-retention-archive=9999999");
|
strLstAddZ(argList, "--repo1-retention-archive=9999999");
|
||||||
harnessCfgLoad(cfgCmdExpire, argList);
|
HRN_CFG_LOAD(cfgCmdExpire, argList);
|
||||||
TEST_RESULT_VOID(cmdExpire(), "only oldest backup expired - dry-run, retention-archive set to max, no archives expired");
|
TEST_RESULT_VOID(cmdExpire(), "only oldest backup expired - dry-run, retention-archive set to max, no archives expired");
|
||||||
TEST_RESULT_LOG(
|
TEST_RESULT_LOG(
|
||||||
"P00 INFO: [DRY-RUN] repo1: expire time-based backup 20181119-152138F\n"
|
"P00 INFO: [DRY-RUN] repo1: expire time-based backup 20181119-152138F\n"
|
||||||
@ -2501,7 +2501,7 @@ testRun(void)
|
|||||||
strLstAddZ(argList, "--repo1-retention-full=30");
|
strLstAddZ(argList, "--repo1-retention-full=30");
|
||||||
strLstAddZ(argList, "--repo1-retention-archive=1"); // 1-day: expire all non-essential archive prior to newest full backup
|
strLstAddZ(argList, "--repo1-retention-archive=1"); // 1-day: expire all non-essential archive prior to newest full backup
|
||||||
strLstAddZ(argList, "--dry-run");
|
strLstAddZ(argList, "--dry-run");
|
||||||
harnessCfgLoad(cfgCmdExpire, argList);
|
HRN_CFG_LOAD(cfgCmdExpire, argList);
|
||||||
TEST_RESULT_VOID(cmdExpire(), "only oldest backup expired but retention archive set lower - dry-run");
|
TEST_RESULT_VOID(cmdExpire(), "only oldest backup expired but retention archive set lower - dry-run");
|
||||||
TEST_RESULT_LOG(
|
TEST_RESULT_LOG(
|
||||||
"P00 INFO: [DRY-RUN] repo1: expire time-based backup 20181119-152138F\n"
|
"P00 INFO: [DRY-RUN] repo1: expire time-based backup 20181119-152138F\n"
|
||||||
@ -2525,7 +2525,7 @@ testRun(void)
|
|||||||
strLstAddZ(argList, "--repo1-retention-archive-type=diff");
|
strLstAddZ(argList, "--repo1-retention-archive-type=diff");
|
||||||
strLstAddZ(argList, "--repo1-retention-archive=1"); // 1-diff: expire all non-essential archive prior to newest diff backup
|
strLstAddZ(argList, "--repo1-retention-archive=1"); // 1-diff: expire all non-essential archive prior to newest diff backup
|
||||||
strLstAddZ(argList, "--dry-run");
|
strLstAddZ(argList, "--dry-run");
|
||||||
harnessCfgLoad(cfgCmdExpire, argList);
|
HRN_CFG_LOAD(cfgCmdExpire, argList);
|
||||||
|
|
||||||
TEST_RESULT_VOID(cmdExpire(), "only oldest backup expired, retention archive is DIFF - dry-run");
|
TEST_RESULT_VOID(cmdExpire(), "only oldest backup expired, retention archive is DIFF - dry-run");
|
||||||
TEST_RESULT_LOG(
|
TEST_RESULT_LOG(
|
||||||
@ -2554,7 +2554,7 @@ testRun(void)
|
|||||||
|
|
||||||
argList = strLstDup(argListTime);
|
argList = strLstDup(argListTime);
|
||||||
strLstAddZ(argList, "--repo1-retention-full=25");
|
strLstAddZ(argList, "--repo1-retention-full=25");
|
||||||
harnessCfgLoad(cfgCmdExpire, argList);
|
HRN_CFG_LOAD(cfgCmdExpire, argList);
|
||||||
|
|
||||||
// Expire oldest from backup.info only, leaving the backup and archives on disk then save backup.info without oldest backup
|
// Expire oldest from backup.info only, leaving the backup and archives on disk then save backup.info without oldest backup
|
||||||
TEST_RESULT_UINT(expireTimeBasedBackup(infoBackup, (time_t)(timeNow - (25 * SEC_PER_DAY)), 0), 1, "expire oldest backup");
|
TEST_RESULT_UINT(expireTimeBasedBackup(infoBackup, (time_t)(timeNow - (25 * SEC_PER_DAY)), 0), 1, "expire oldest backup");
|
||||||
@ -2573,7 +2573,7 @@ testRun(void)
|
|||||||
|
|
||||||
argList = strLstDup(argListTime);
|
argList = strLstDup(argListTime);
|
||||||
strLstAddZ(argList, "--repo1-retention-full=1");
|
strLstAddZ(argList, "--repo1-retention-full=1");
|
||||||
harnessCfgLoad(cfgCmdExpire, argList);
|
HRN_CFG_LOAD(cfgCmdExpire, argList);
|
||||||
|
|
||||||
TEST_RESULT_VOID(cmdExpire(), "expire all but newest");
|
TEST_RESULT_VOID(cmdExpire(), "expire all but newest");
|
||||||
TEST_RESULT_LOG(
|
TEST_RESULT_LOG(
|
||||||
|
@ -1,13 +1,33 @@
|
|||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
Test Help Command
|
Test Help Command
|
||||||
***********************************************************************************************************************************/
|
***********************************************************************************************************************************/
|
||||||
|
#include "config/load.h"
|
||||||
#include "config/parse.h"
|
#include "config/parse.h"
|
||||||
|
#include "storage/helper.h"
|
||||||
#include "storage/posix/storage.h"
|
#include "storage/posix/storage.h"
|
||||||
#include "storage/storage.h"
|
|
||||||
#include "version.h"
|
#include "version.h"
|
||||||
|
|
||||||
#include "common/harnessConfig.h"
|
#include "common/harnessConfig.h"
|
||||||
|
|
||||||
|
/***********************************************************************************************************************************
|
||||||
|
Configuration load with just enough funcionality to test help
|
||||||
|
***********************************************************************************************************************************/
|
||||||
|
static void
|
||||||
|
testCfgLoad(const StringList *const argList)
|
||||||
|
{
|
||||||
|
FUNCTION_HARNESS_BEGIN();
|
||||||
|
FUNCTION_HARNESS_PARAM(STRING_LIST, argList);
|
||||||
|
FUNCTION_HARNESS_END();
|
||||||
|
|
||||||
|
// Parse config
|
||||||
|
configParse(storageLocal(), strLstSize(argList), strLstPtr(argList), false);
|
||||||
|
|
||||||
|
// Apply special option rules
|
||||||
|
cfgLoadUpdateOption();
|
||||||
|
|
||||||
|
FUNCTION_HARNESS_RETURN_VOID();
|
||||||
|
}
|
||||||
|
|
||||||
/***********************************************************************************************************************************
|
/***********************************************************************************************************************************
|
||||||
Test Run
|
Test Run
|
||||||
***********************************************************************************************************************************/
|
***********************************************************************************************************************************/
|
||||||
@ -111,13 +131,13 @@ testRun(void)
|
|||||||
// -------------------------------------------------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------------------------------------------------
|
||||||
argList = strLstNew();
|
argList = strLstNew();
|
||||||
strLstAddZ(argList, "/path/to/pgbackrest");
|
strLstAddZ(argList, "/path/to/pgbackrest");
|
||||||
TEST_RESULT_VOID(harnessCfgLoadRaw(strLstSize(argList), strLstPtr(argList)), "help from empty command line");
|
TEST_RESULT_VOID(testCfgLoad(argList), "help from empty command line");
|
||||||
TEST_RESULT_STR_Z(helpRender(), generalHelp, " check text");
|
TEST_RESULT_STR_Z(helpRender(), generalHelp, " check text");
|
||||||
|
|
||||||
argList = strLstNew();
|
argList = strLstNew();
|
||||||
strLstAddZ(argList, "/path/to/pgbackrest");
|
strLstAddZ(argList, "/path/to/pgbackrest");
|
||||||
strLstAddZ(argList, "help");
|
strLstAddZ(argList, "help");
|
||||||
TEST_RESULT_VOID(harnessCfgLoadRaw(strLstSize(argList), strLstPtr(argList)), "help from help command");
|
TEST_RESULT_VOID(testCfgLoad(argList), "help from help command");
|
||||||
TEST_RESULT_STR_Z(helpRender(), generalHelp, " check text");
|
TEST_RESULT_STR_Z(helpRender(), generalHelp, " check text");
|
||||||
|
|
||||||
// -------------------------------------------------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------------------------------------------------
|
||||||
@ -134,7 +154,7 @@ testRun(void)
|
|||||||
strLstAddZ(argList, "/path/to/pgbackrest");
|
strLstAddZ(argList, "/path/to/pgbackrest");
|
||||||
strLstAddZ(argList, "help");
|
strLstAddZ(argList, "help");
|
||||||
strLstAddZ(argList, "version");
|
strLstAddZ(argList, "version");
|
||||||
TEST_RESULT_VOID(harnessCfgLoadRaw(strLstSize(argList), strLstPtr(argList)), "help for version command");
|
TEST_RESULT_VOID(testCfgLoad(argList), "help for version command");
|
||||||
TEST_RESULT_STR_Z(helpRender(), commandHelp, " check text");
|
TEST_RESULT_STR_Z(helpRender(), commandHelp, " check text");
|
||||||
|
|
||||||
// This test is broken up into multiple strings because C99 does not require compilers to support const strings > 4095 bytes
|
// This test is broken up into multiple strings because C99 does not require compilers to support const strings > 4095 bytes
|
||||||
@ -291,7 +311,7 @@ testRun(void)
|
|||||||
strLstAddZ(argList, "--link-map=/link2=/dest2");
|
strLstAddZ(argList, "--link-map=/link2=/dest2");
|
||||||
strLstAddZ(argList, "--db-include=db1");
|
strLstAddZ(argList, "--db-include=db1");
|
||||||
strLstAddZ(argList, "--db-include=db2");
|
strLstAddZ(argList, "--db-include=db2");
|
||||||
TEST_RESULT_VOID(harnessCfgLoadRaw(strLstSize(argList), strLstPtr(argList)), "help for restore command");
|
TEST_RESULT_VOID(testCfgLoad(argList), "help for restore command");
|
||||||
unsetenv("PGBACKREST_REPO1_CIPHER_PASS");
|
unsetenv("PGBACKREST_REPO1_CIPHER_PASS");
|
||||||
TEST_RESULT_STR_Z(helpRender(), commandHelp, " check text");
|
TEST_RESULT_STR_Z(helpRender(), commandHelp, " check text");
|
||||||
|
|
||||||
@ -302,7 +322,7 @@ testRun(void)
|
|||||||
strLstAddZ(argList, "archive-push");
|
strLstAddZ(argList, "archive-push");
|
||||||
strLstAddZ(argList, "buffer-size");
|
strLstAddZ(argList, "buffer-size");
|
||||||
strLstAddZ(argList, "buffer-size");
|
strLstAddZ(argList, "buffer-size");
|
||||||
TEST_RESULT_VOID(harnessCfgLoadRaw(strLstSize(argList), strLstPtr(argList)), "parse too many options");
|
TEST_RESULT_VOID(testCfgLoad(argList), "parse too many options");
|
||||||
TEST_ERROR(helpRender(), ParamInvalidError, "only one option allowed for option help");
|
TEST_ERROR(helpRender(), ParamInvalidError, "only one option allowed for option help");
|
||||||
|
|
||||||
argList = strLstNew();
|
argList = strLstNew();
|
||||||
@ -310,7 +330,7 @@ testRun(void)
|
|||||||
strLstAddZ(argList, "help");
|
strLstAddZ(argList, "help");
|
||||||
strLstAddZ(argList, "archive-push");
|
strLstAddZ(argList, "archive-push");
|
||||||
strLstAddZ(argList, BOGUS_STR);
|
strLstAddZ(argList, BOGUS_STR);
|
||||||
TEST_RESULT_VOID(harnessCfgLoadRaw(strLstSize(argList), strLstPtr(argList)), "parse bogus option");
|
TEST_RESULT_VOID(testCfgLoad(argList), "parse bogus option");
|
||||||
TEST_ERROR(helpRender(), OptionInvalidError, "option 'BOGUS' is not valid for command 'archive-push'");
|
TEST_ERROR(helpRender(), OptionInvalidError, "option 'BOGUS' is not valid for command 'archive-push'");
|
||||||
|
|
||||||
argList = strLstNew();
|
argList = strLstNew();
|
||||||
@ -318,7 +338,7 @@ testRun(void)
|
|||||||
strLstAddZ(argList, CFGCMD_HELP);
|
strLstAddZ(argList, CFGCMD_HELP);
|
||||||
strLstAddZ(argList, CFGCMD_ARCHIVE_PUSH);
|
strLstAddZ(argList, CFGCMD_ARCHIVE_PUSH);
|
||||||
strLstAddZ(argList, CFGOPT_PROCESS);
|
strLstAddZ(argList, CFGOPT_PROCESS);
|
||||||
TEST_RESULT_VOID(harnessCfgLoadRaw(strLstSize(argList), strLstPtr(argList)), "parse option invalid for command");
|
TEST_RESULT_VOID(testCfgLoad(argList), "parse option invalid for command");
|
||||||
TEST_ERROR(helpRender(), OptionInvalidError, "option 'process' is not valid for command 'archive-push'");
|
TEST_ERROR(helpRender(), OptionInvalidError, "option 'process' is not valid for command 'archive-push'");
|
||||||
|
|
||||||
// -------------------------------------------------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------------------------------------------------
|
||||||
@ -344,13 +364,11 @@ testRun(void)
|
|||||||
strLstAddZ(argList, "help");
|
strLstAddZ(argList, "help");
|
||||||
strLstAddZ(argList, "archive-push");
|
strLstAddZ(argList, "archive-push");
|
||||||
strLstAddZ(argList, "buffer-size");
|
strLstAddZ(argList, "buffer-size");
|
||||||
TEST_RESULT_VOID(
|
TEST_RESULT_VOID(testCfgLoad(argList), "help for archive-push command, buffer-size option");
|
||||||
harnessCfgLoadRaw(strLstSize(argList), strLstPtr(argList)), "help for archive-push command, buffer-size option");
|
|
||||||
TEST_RESULT_STR(helpRender(), strNewFmt("%s\ndefault: 1048576\n", optionHelp), " check text");
|
TEST_RESULT_STR(helpRender(), strNewFmt("%s\ndefault: 1048576\n", optionHelp), " check text");
|
||||||
|
|
||||||
strLstAddZ(argList, "--buffer-size=32768");
|
strLstAddZ(argList, "--buffer-size=32768");
|
||||||
TEST_RESULT_VOID(
|
TEST_RESULT_VOID(testCfgLoad(argList), "help for archive-push command, buffer-size option");
|
||||||
harnessCfgLoadRaw(strLstSize(argList), strLstPtr(argList)), "help for archive-push command, buffer-size option");
|
|
||||||
TEST_RESULT_STR(helpRender(), strNewFmt("%s\ncurrent: 32768\ndefault: 1048576\n", optionHelp), " check text");
|
TEST_RESULT_STR(helpRender(), strNewFmt("%s\ncurrent: 32768\ndefault: 1048576\n", optionHelp), " check text");
|
||||||
|
|
||||||
// -------------------------------------------------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------------------------------------------------
|
||||||
@ -376,8 +394,7 @@ testRun(void)
|
|||||||
strLstAddZ(argList, "help");
|
strLstAddZ(argList, "help");
|
||||||
strLstAddZ(argList, "archive-push");
|
strLstAddZ(argList, "archive-push");
|
||||||
strLstAddZ(argList, "repo1-s3-host");
|
strLstAddZ(argList, "repo1-s3-host");
|
||||||
TEST_RESULT_VOID(
|
TEST_RESULT_VOID(testCfgLoad(argList), "help for archive-push command, repo1-s3-host option");
|
||||||
harnessCfgLoadRaw(strLstSize(argList), strLstPtr(argList)), "help for archive-push command, repo1-s3-host option");
|
|
||||||
TEST_RESULT_STR_Z(helpRender(), optionHelp, " check text");
|
TEST_RESULT_STR_Z(helpRender(), optionHelp, " check text");
|
||||||
|
|
||||||
optionHelp = strZ(strNewFmt(
|
optionHelp = strZ(strNewFmt(
|
||||||
@ -389,8 +406,7 @@ testRun(void)
|
|||||||
|
|
||||||
strLstAddZ(argList, "--repo1-type=s3");
|
strLstAddZ(argList, "--repo1-type=s3");
|
||||||
strLstAddZ(argList, "--repo1-s3-host=s3-host");
|
strLstAddZ(argList, "--repo1-s3-host=s3-host");
|
||||||
TEST_RESULT_VOID(
|
TEST_RESULT_VOID(testCfgLoad(argList), "help for archive-push command, repo1-s3-host option");
|
||||||
harnessCfgLoadRaw(strLstSize(argList), strLstPtr(argList)), "help for archive-push command, repo1-s3-host option");
|
|
||||||
TEST_RESULT_STR_Z(helpRender(), optionHelp, " check text");
|
TEST_RESULT_STR_Z(helpRender(), optionHelp, " check text");
|
||||||
|
|
||||||
// -------------------------------------------------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------------------------------------------------
|
||||||
@ -411,8 +427,7 @@ testRun(void)
|
|||||||
setenv("PGBACKREST_REPO1_CIPHER_PASS", "supersecret", true);
|
setenv("PGBACKREST_REPO1_CIPHER_PASS", "supersecret", true);
|
||||||
strLstAddZ(argList, "archive-push");
|
strLstAddZ(argList, "archive-push");
|
||||||
strLstAddZ(argList, "repo-cipher-pass");
|
strLstAddZ(argList, "repo-cipher-pass");
|
||||||
TEST_RESULT_VOID(
|
TEST_RESULT_VOID(testCfgLoad(argList), "help for archive-push command, repo1-s3-host option");
|
||||||
harnessCfgLoadRaw(strLstSize(argList), strLstPtr(argList)), "help for archive-push command, repo1-s3-host option");
|
|
||||||
unsetenv("PGBACKREST_REPO1_CIPHER_PASS");
|
unsetenv("PGBACKREST_REPO1_CIPHER_PASS");
|
||||||
TEST_RESULT_STR_Z(helpRender(), optionHelp, " check text");
|
TEST_RESULT_STR_Z(helpRender(), optionHelp, " check text");
|
||||||
|
|
||||||
@ -437,8 +452,7 @@ testRun(void)
|
|||||||
strLstAddZ(argList, "help");
|
strLstAddZ(argList, "help");
|
||||||
strLstAddZ(argList, "backup");
|
strLstAddZ(argList, "backup");
|
||||||
strLstAddZ(argList, "repo-hardlink");
|
strLstAddZ(argList, "repo-hardlink");
|
||||||
TEST_RESULT_VOID(
|
TEST_RESULT_VOID(testCfgLoad(argList), "help for backup command, repo-hardlink option");
|
||||||
harnessCfgLoadRaw(strLstSize(argList), strLstPtr(argList)), "help for backup command, repo-hardlink option");
|
|
||||||
TEST_RESULT_STR_Z(helpRender(), optionHelp, " check text");
|
TEST_RESULT_STR_Z(helpRender(), optionHelp, " check text");
|
||||||
|
|
||||||
argList = strLstNew();
|
argList = strLstNew();
|
||||||
@ -446,8 +460,7 @@ testRun(void)
|
|||||||
strLstAddZ(argList, "help");
|
strLstAddZ(argList, "help");
|
||||||
strLstAddZ(argList, "backup");
|
strLstAddZ(argList, "backup");
|
||||||
strLstAddZ(argList, "hardlink");
|
strLstAddZ(argList, "hardlink");
|
||||||
TEST_RESULT_VOID(
|
TEST_RESULT_VOID(testCfgLoad(argList), "help for backup command, deprecated hardlink option");
|
||||||
harnessCfgLoadRaw(strLstSize(argList), strLstPtr(argList)), "help for backup command, deprecated hardlink option");
|
|
||||||
TEST_RESULT_STR_Z(helpRender(), optionHelp, " check text");
|
TEST_RESULT_STR_Z(helpRender(), optionHelp, " check text");
|
||||||
|
|
||||||
// Check admonition
|
// Check admonition
|
||||||
@ -482,8 +495,7 @@ testRun(void)
|
|||||||
strLstAddZ(argList, "help");
|
strLstAddZ(argList, "help");
|
||||||
strLstAddZ(argList, "backup");
|
strLstAddZ(argList, "backup");
|
||||||
strLstAddZ(argList, "repo-retention-archive");
|
strLstAddZ(argList, "repo-retention-archive");
|
||||||
TEST_RESULT_VOID(
|
TEST_RESULT_VOID(testCfgLoad(argList), "help for backup command, repo-retention-archive option");
|
||||||
harnessCfgLoadRaw(strLstSize(argList), strLstPtr(argList)), "help for backup command, repo-retention-archive option");
|
|
||||||
TEST_RESULT_STR_Z(helpRender(), optionHelp, " check admonition text");
|
TEST_RESULT_STR_Z(helpRender(), optionHelp, " check admonition text");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -492,7 +504,7 @@ testRun(void)
|
|||||||
{
|
{
|
||||||
StringList *argList = strLstNew();
|
StringList *argList = strLstNew();
|
||||||
strLstAddZ(argList, "/path/to/pgbackrest");
|
strLstAddZ(argList, "/path/to/pgbackrest");
|
||||||
TEST_RESULT_VOID(harnessCfgLoadRaw(strLstSize(argList), strLstPtr(argList)), "parse help from empty command line");
|
TEST_RESULT_VOID(testCfgLoad(argList), "parse help from empty command line");
|
||||||
|
|
||||||
// Redirect stdout to a file
|
// Redirect stdout to a file
|
||||||
int stdoutSave = dup(STDOUT_FILENO);
|
int stdoutSave = dup(STDOUT_FILENO);
|
||||||
|
@ -36,20 +36,20 @@ testRun(void)
|
|||||||
StringList *argListText = strLstDup(argList);
|
StringList *argListText = strLstDup(argList);
|
||||||
|
|
||||||
strLstAddZ(argList, "--output=json");
|
strLstAddZ(argList, "--output=json");
|
||||||
harnessCfgLoad(cfgCmdInfo, argList);
|
HRN_CFG_LOAD(cfgCmdInfo, argList);
|
||||||
|
|
||||||
// No stanzas have been created
|
// No stanzas have been created
|
||||||
//--------------------------------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------------------------------
|
||||||
TEST_RESULT_STR_Z(infoRender(), "[]", "json - repo but no stanzas");
|
TEST_RESULT_STR_Z(infoRender(), "[]", "json - repo but no stanzas");
|
||||||
|
|
||||||
harnessCfgLoad(cfgCmdInfo, argListText);
|
HRN_CFG_LOAD(cfgCmdInfo, argListText);
|
||||||
TEST_RESULT_STR_Z(infoRender(), "No stanzas exist in the repository.\n", "text - no stanzas");
|
TEST_RESULT_STR_Z(infoRender(), "No stanzas exist in the repository.\n", "text - no stanzas");
|
||||||
|
|
||||||
// Repo is still empty but stanza option is specified
|
// Repo is still empty but stanza option is specified
|
||||||
//--------------------------------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------------------------------
|
||||||
StringList *argListStanzaOpt = strLstDup(argList);
|
StringList *argListStanzaOpt = strLstDup(argList);
|
||||||
strLstAddZ(argListStanzaOpt, "--stanza=stanza1");
|
strLstAddZ(argListStanzaOpt, "--stanza=stanza1");
|
||||||
harnessCfgLoad(cfgCmdInfo, argListStanzaOpt);
|
HRN_CFG_LOAD(cfgCmdInfo, argListStanzaOpt);
|
||||||
TEST_RESULT_STR_Z(
|
TEST_RESULT_STR_Z(
|
||||||
infoRender(),
|
infoRender(),
|
||||||
"["
|
"["
|
||||||
@ -80,7 +80,7 @@ testRun(void)
|
|||||||
|
|
||||||
StringList *argListTextStanzaOpt = strLstDup(argListText);
|
StringList *argListTextStanzaOpt = strLstDup(argListText);
|
||||||
strLstAddZ(argListTextStanzaOpt, "--stanza=stanza1");
|
strLstAddZ(argListTextStanzaOpt, "--stanza=stanza1");
|
||||||
harnessCfgLoad(cfgCmdInfo, argListTextStanzaOpt);
|
HRN_CFG_LOAD(cfgCmdInfo, argListTextStanzaOpt);
|
||||||
TEST_RESULT_STR_Z(
|
TEST_RESULT_STR_Z(
|
||||||
infoRender(),
|
infoRender(),
|
||||||
"stanza: stanza1\n"
|
"stanza: stanza1\n"
|
||||||
@ -101,7 +101,7 @@ testRun(void)
|
|||||||
" cipher: none\n",
|
" cipher: none\n",
|
||||||
"text - missing stanza data");
|
"text - missing stanza data");
|
||||||
|
|
||||||
harnessCfgLoad(cfgCmdInfo, argList);
|
HRN_CFG_LOAD(cfgCmdInfo, argList);
|
||||||
TEST_RESULT_STR_Z(
|
TEST_RESULT_STR_Z(
|
||||||
infoRender(),
|
infoRender(),
|
||||||
"["
|
"["
|
||||||
@ -190,7 +190,7 @@ testRun(void)
|
|||||||
"]", strZ(archiveStanza1Path), strZ(archiveStanza1Path), strZ(archiveStanza1Path), strZ(archiveStanza1Path)),
|
"]", strZ(archiveStanza1Path), strZ(archiveStanza1Path), strZ(archiveStanza1Path), strZ(archiveStanza1Path)),
|
||||||
"json - other error, single repo");
|
"json - other error, single repo");
|
||||||
|
|
||||||
harnessCfgLoad(cfgCmdInfo, argListTextStanzaOpt);
|
HRN_CFG_LOAD(cfgCmdInfo, argListTextStanzaOpt);
|
||||||
TEST_RESULT_STR(
|
TEST_RESULT_STR(
|
||||||
infoRender(), strNewFmt(
|
infoRender(), strNewFmt(
|
||||||
"stanza: stanza1\n"
|
"stanza: stanza1\n"
|
||||||
@ -251,7 +251,7 @@ testRun(void)
|
|||||||
{
|
{
|
||||||
sleepMSec(250);
|
sleepMSec(250);
|
||||||
|
|
||||||
harnessCfgLoad(cfgCmdInfo, argList);
|
HRN_CFG_LOAD(cfgCmdInfo, argList);
|
||||||
TEST_RESULT_STR_Z(
|
TEST_RESULT_STR_Z(
|
||||||
infoRender(),
|
infoRender(),
|
||||||
"["
|
"["
|
||||||
@ -303,7 +303,7 @@ testRun(void)
|
|||||||
"]",
|
"]",
|
||||||
"json - single stanza, no valid backups, backup/expire lock detected");
|
"json - single stanza, no valid backups, backup/expire lock detected");
|
||||||
|
|
||||||
harnessCfgLoad(cfgCmdInfo, argListText);
|
HRN_CFG_LOAD(cfgCmdInfo, argListText);
|
||||||
TEST_RESULT_STR_Z(
|
TEST_RESULT_STR_Z(
|
||||||
infoRender(),
|
infoRender(),
|
||||||
"stanza: stanza1\n"
|
"stanza: stanza1\n"
|
||||||
@ -332,7 +332,7 @@ testRun(void)
|
|||||||
strLstAddZ(argList2, "--stanza=stanza1");
|
strLstAddZ(argList2, "--stanza=stanza1");
|
||||||
hrnCfgArgKeyRawZ(argList2, cfgOptRepoPath, 2, TEST_PATH "/repo2");
|
hrnCfgArgKeyRawZ(argList2, cfgOptRepoPath, 2, TEST_PATH "/repo2");
|
||||||
hrnCfgArgRawZ(argList2, cfgOptRepo, "1");
|
hrnCfgArgRawZ(argList2, cfgOptRepo, "1");
|
||||||
harnessCfgLoad(cfgCmdInfo, argList2);
|
HRN_CFG_LOAD(cfgCmdInfo, argList2);
|
||||||
|
|
||||||
TEST_RESULT_STR_Z(
|
TEST_RESULT_STR_Z(
|
||||||
infoRender(),
|
infoRender(),
|
||||||
@ -351,7 +351,7 @@ testRun(void)
|
|||||||
strLstAddZ(argList2, "--stanza=stanza1");
|
strLstAddZ(argList2, "--stanza=stanza1");
|
||||||
hrnCfgArgKeyRawZ(argList2, cfgOptRepoPath, 2, TEST_PATH "/repo2");
|
hrnCfgArgKeyRawZ(argList2, cfgOptRepoPath, 2, TEST_PATH "/repo2");
|
||||||
hrnCfgArgRawZ(argList2, cfgOptRepo, "2");
|
hrnCfgArgRawZ(argList2, cfgOptRepo, "2");
|
||||||
harnessCfgLoad(cfgCmdInfo, argList2);
|
HRN_CFG_LOAD(cfgCmdInfo, argList2);
|
||||||
|
|
||||||
TEST_RESULT_STR_Z(
|
TEST_RESULT_STR_Z(
|
||||||
infoRender(),
|
infoRender(),
|
||||||
@ -388,7 +388,7 @@ testRun(void)
|
|||||||
"touch %s",
|
"touch %s",
|
||||||
strZ(strNewFmt("%s/000000010000000000000001-ac61b8f1ec7b1e6c3eaee9345214595eb7daa9a1.gz", strZ(archiveDb2_1))));
|
strZ(strNewFmt("%s/000000010000000000000001-ac61b8f1ec7b1e6c3eaee9345214595eb7daa9a1.gz", strZ(archiveDb2_1))));
|
||||||
|
|
||||||
harnessCfgLoad(cfgCmdInfo, argList);
|
HRN_CFG_LOAD(cfgCmdInfo, argList);
|
||||||
content = STRDEF
|
content = STRDEF
|
||||||
(
|
(
|
||||||
"[db]\n"
|
"[db]\n"
|
||||||
@ -447,7 +447,7 @@ testRun(void)
|
|||||||
{
|
{
|
||||||
sleepMSec(250);
|
sleepMSec(250);
|
||||||
|
|
||||||
harnessCfgLoad(cfgCmdInfo, argList);
|
HRN_CFG_LOAD(cfgCmdInfo, argList);
|
||||||
TEST_RESULT_STR_Z(
|
TEST_RESULT_STR_Z(
|
||||||
infoRender(),
|
infoRender(),
|
||||||
"["
|
"["
|
||||||
@ -584,7 +584,7 @@ testRun(void)
|
|||||||
"]",
|
"]",
|
||||||
"json - single stanza, valid backup, no priors, no archives in latest DB, backup/expire lock detected");
|
"json - single stanza, valid backup, no priors, no archives in latest DB, backup/expire lock detected");
|
||||||
|
|
||||||
harnessCfgLoad(cfgCmdInfo, argListText);
|
HRN_CFG_LOAD(cfgCmdInfo, argListText);
|
||||||
TEST_RESULT_STR_Z(
|
TEST_RESULT_STR_Z(
|
||||||
infoRender(),
|
infoRender(),
|
||||||
"stanza: stanza1\n"
|
"stanza: stanza1\n"
|
||||||
@ -1101,7 +1101,7 @@ testRun(void)
|
|||||||
{
|
{
|
||||||
sleepMSec(250);
|
sleepMSec(250);
|
||||||
|
|
||||||
harnessCfgLoad(cfgCmdInfo, argListMultiRepoJson);
|
HRN_CFG_LOAD(cfgCmdInfo, argListMultiRepoJson);
|
||||||
TEST_RESULT_STR_Z(
|
TEST_RESULT_STR_Z(
|
||||||
infoRender(),
|
infoRender(),
|
||||||
"["
|
"["
|
||||||
@ -1519,7 +1519,7 @@ testRun(void)
|
|||||||
{
|
{
|
||||||
sleepMSec(250);
|
sleepMSec(250);
|
||||||
|
|
||||||
harnessCfgLoad(cfgCmdInfo, argListMultiRepo);
|
HRN_CFG_LOAD(cfgCmdInfo, argListMultiRepo);
|
||||||
TEST_RESULT_STR_Z(
|
TEST_RESULT_STR_Z(
|
||||||
infoRender(),
|
infoRender(),
|
||||||
"stanza: stanza1\n"
|
"stanza: stanza1\n"
|
||||||
@ -1611,7 +1611,7 @@ testRun(void)
|
|||||||
argList2 = strLstDup(argListMultiRepo);
|
argList2 = strLstDup(argListMultiRepo);
|
||||||
strLstAddZ(argList2, "--stanza=stanza1");
|
strLstAddZ(argList2, "--stanza=stanza1");
|
||||||
strLstAddZ(argList2, "--set=bogus");
|
strLstAddZ(argList2, "--set=bogus");
|
||||||
harnessCfgLoad(cfgCmdInfo, argList2);
|
HRN_CFG_LOAD(cfgCmdInfo, argList2);
|
||||||
|
|
||||||
TEST_RESULT_STR_Z(
|
TEST_RESULT_STR_Z(
|
||||||
infoRender(),
|
infoRender(),
|
||||||
@ -1628,7 +1628,7 @@ testRun(void)
|
|||||||
strLstAddZ(argList2, "--stanza=stanza1");
|
strLstAddZ(argList2, "--stanza=stanza1");
|
||||||
strLstAddZ(argList2, "--set=20181119-152138F_20181119-152155I");
|
strLstAddZ(argList2, "--set=20181119-152138F_20181119-152155I");
|
||||||
strLstAddZ(argList2, "--repo=1");
|
strLstAddZ(argList2, "--repo=1");
|
||||||
harnessCfgLoad(cfgCmdInfo, argList2);
|
HRN_CFG_LOAD(cfgCmdInfo, argList2);
|
||||||
|
|
||||||
TEST_RESULT_STR_Z(
|
TEST_RESULT_STR_Z(
|
||||||
infoRender(),
|
infoRender(),
|
||||||
@ -1660,7 +1660,7 @@ testRun(void)
|
|||||||
argList2 = strLstDup(argListMultiRepo);
|
argList2 = strLstDup(argListMultiRepo);
|
||||||
strLstAddZ(argList2, "--stanza=stanza1");
|
strLstAddZ(argList2, "--stanza=stanza1");
|
||||||
strLstAddZ(argList2, "--set=20201116-200000F");
|
strLstAddZ(argList2, "--set=20201116-200000F");
|
||||||
harnessCfgLoad(cfgCmdInfo, argList2);
|
HRN_CFG_LOAD(cfgCmdInfo, argList2);
|
||||||
|
|
||||||
TEST_RESULT_STR_Z(
|
TEST_RESULT_STR_Z(
|
||||||
infoRender(),
|
infoRender(),
|
||||||
@ -1690,7 +1690,7 @@ testRun(void)
|
|||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------------------------------
|
||||||
strLstAddZ(argList2, "--output=json");
|
strLstAddZ(argList2, "--output=json");
|
||||||
harnessCfgLoad(cfgCmdInfo, argList2);
|
HRN_CFG_LOAD(cfgCmdInfo, argList2);
|
||||||
|
|
||||||
TEST_ERROR(strZ(infoRender()), ConfigError, "option 'set' is currently only valid for text output");
|
TEST_ERROR(strZ(infoRender()), ConfigError, "option 'set' is currently only valid for text output");
|
||||||
|
|
||||||
@ -1700,7 +1700,7 @@ testRun(void)
|
|||||||
strLstAddZ(argList2, "--stanza=stanza1");
|
strLstAddZ(argList2, "--stanza=stanza1");
|
||||||
strLstAddZ(argList2, "--set=20181119-152138F_20181119-152155I");
|
strLstAddZ(argList2, "--set=20181119-152138F_20181119-152155I");
|
||||||
strLstAddZ(argList2, "--repo=1");
|
strLstAddZ(argList2, "--repo=1");
|
||||||
harnessCfgLoad(cfgCmdInfo, argList2);
|
HRN_CFG_LOAD(cfgCmdInfo, argList2);
|
||||||
|
|
||||||
#define TEST_MANIFEST_TARGET_NO_LINK \
|
#define TEST_MANIFEST_TARGET_NO_LINK \
|
||||||
"\n" \
|
"\n" \
|
||||||
@ -1769,7 +1769,7 @@ testRun(void)
|
|||||||
strLstAddZ(argList2, "--stanza=stanza1");
|
strLstAddZ(argList2, "--stanza=stanza1");
|
||||||
strLstAddZ(argList2, "--set=20181119-152138F_20181119-152155I");
|
strLstAddZ(argList2, "--set=20181119-152138F_20181119-152155I");
|
||||||
strLstAddZ(argList2, "--repo=1");
|
strLstAddZ(argList2, "--repo=1");
|
||||||
harnessCfgLoad(cfgCmdInfo, argList2);
|
HRN_CFG_LOAD(cfgCmdInfo, argList2);
|
||||||
|
|
||||||
#define TEST_MANIFEST_NO_DB \
|
#define TEST_MANIFEST_NO_DB \
|
||||||
"\n" \
|
"\n" \
|
||||||
@ -1836,7 +1836,7 @@ testRun(void)
|
|||||||
//--------------------------------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------------------------------
|
||||||
argList2 = strLstDup(argList);
|
argList2 = strLstDup(argList);
|
||||||
strLstAddZ(argList2, "--stanza=stanza2");
|
strLstAddZ(argList2, "--stanza=stanza2");
|
||||||
harnessCfgLoad(cfgCmdInfo, argList2);
|
HRN_CFG_LOAD(cfgCmdInfo, argList2);
|
||||||
TEST_RESULT_STR_Z(
|
TEST_RESULT_STR_Z(
|
||||||
infoRender(),
|
infoRender(),
|
||||||
"["
|
"["
|
||||||
@ -1892,7 +1892,7 @@ testRun(void)
|
|||||||
|
|
||||||
argList2 = strLstDup(argListText);
|
argList2 = strLstDup(argListText);
|
||||||
strLstAddZ(argList2, "--stanza=stanza2");
|
strLstAddZ(argList2, "--stanza=stanza2");
|
||||||
harnessCfgLoad(cfgCmdInfo, argList2);
|
HRN_CFG_LOAD(cfgCmdInfo, argList2);
|
||||||
TEST_RESULT_STR_Z(
|
TEST_RESULT_STR_Z(
|
||||||
infoRender(),
|
infoRender(),
|
||||||
"stanza: stanza2\n"
|
"stanza: stanza2\n"
|
||||||
@ -1934,7 +1934,7 @@ testRun(void)
|
|||||||
|
|
||||||
argList2 = strLstDup(argListMultiRepo);
|
argList2 = strLstDup(argListMultiRepo);
|
||||||
hrnCfgArgRawZ(argList2, cfgOptStanza, "stanza1");
|
hrnCfgArgRawZ(argList2, cfgOptStanza, "stanza1");
|
||||||
harnessCfgLoad(cfgCmdInfo, argList2);
|
HRN_CFG_LOAD(cfgCmdInfo, argList2);
|
||||||
TEST_RESULT_STR_Z(
|
TEST_RESULT_STR_Z(
|
||||||
infoRender(),
|
infoRender(),
|
||||||
"stanza: stanza1\n"
|
"stanza: stanza1\n"
|
||||||
@ -2048,7 +2048,7 @@ testRun(void)
|
|||||||
|
|
||||||
argList2 = strLstDup(argListMultiRepo);
|
argList2 = strLstDup(argListMultiRepo);
|
||||||
hrnCfgArgRawZ(argList2, cfgOptStanza, "stanza4");
|
hrnCfgArgRawZ(argList2, cfgOptStanza, "stanza4");
|
||||||
harnessCfgLoad(cfgCmdInfo, argList2);
|
HRN_CFG_LOAD(cfgCmdInfo, argList2);
|
||||||
|
|
||||||
TEST_RESULT_STR_Z(
|
TEST_RESULT_STR_Z(
|
||||||
infoRender(),
|
infoRender(),
|
||||||
@ -2131,7 +2131,7 @@ testRun(void)
|
|||||||
|
|
||||||
argList2 = strLstDup(argListMultiRepo);
|
argList2 = strLstDup(argListMultiRepo);
|
||||||
hrnCfgArgRawZ(argList2, cfgOptStanza, "stanza3");
|
hrnCfgArgRawZ(argList2, cfgOptStanza, "stanza3");
|
||||||
harnessCfgLoad(cfgCmdInfo, argList2);
|
HRN_CFG_LOAD(cfgCmdInfo, argList2);
|
||||||
|
|
||||||
TEST_RESULT_STR_Z(
|
TEST_RESULT_STR_Z(
|
||||||
infoRender(),
|
infoRender(),
|
||||||
@ -2169,7 +2169,7 @@ testRun(void)
|
|||||||
"text - multi-repo, database mismatch, repo2 stanza-upgrade needed");
|
"text - multi-repo, database mismatch, repo2 stanza-upgrade needed");
|
||||||
|
|
||||||
hrnCfgArgRawZ(argList2, cfgOptOutput, "json");
|
hrnCfgArgRawZ(argList2, cfgOptOutput, "json");
|
||||||
harnessCfgLoad(cfgCmdInfo, argList2);
|
HRN_CFG_LOAD(cfgCmdInfo, argList2);
|
||||||
|
|
||||||
TEST_RESULT_STR_Z(
|
TEST_RESULT_STR_Z(
|
||||||
infoRender(),
|
infoRender(),
|
||||||
@ -2363,7 +2363,7 @@ testRun(void)
|
|||||||
argList2 = strLstDup(argListMultiRepo);
|
argList2 = strLstDup(argListMultiRepo);
|
||||||
strLstAddZ(argList2, "--repo-cipher-type=aes-256-cbc");
|
strLstAddZ(argList2, "--repo-cipher-type=aes-256-cbc");
|
||||||
strLstAddZ(argList2, "--config=" TEST_PATH "/pgbackrest.conf");
|
strLstAddZ(argList2, "--config=" TEST_PATH "/pgbackrest.conf");
|
||||||
harnessCfgLoad(cfgCmdInfo, argList2);
|
HRN_CFG_LOAD(cfgCmdInfo, argList2);
|
||||||
|
|
||||||
TEST_RESULT_STR(
|
TEST_RESULT_STR(
|
||||||
infoRender(), strNewFmt(
|
infoRender(), strNewFmt(
|
||||||
@ -2430,7 +2430,7 @@ testRun(void)
|
|||||||
|
|
||||||
hrnCfgArgRawZ(argList2, cfgOptStanza, "stanza3");
|
hrnCfgArgRawZ(argList2, cfgOptStanza, "stanza3");
|
||||||
hrnCfgArgRawZ(argList2, cfgOptSet, "20201110-100000F");
|
hrnCfgArgRawZ(argList2, cfgOptSet, "20201110-100000F");
|
||||||
harnessCfgLoad(cfgCmdInfo, argList2);
|
HRN_CFG_LOAD(cfgCmdInfo, argList2);
|
||||||
|
|
||||||
TEST_RESULT_STR(
|
TEST_RESULT_STR(
|
||||||
infoRender(), strNewFmt(
|
infoRender(), strNewFmt(
|
||||||
@ -2460,7 +2460,7 @@ testRun(void)
|
|||||||
|
|
||||||
argList2 = strLstDup(argListMultiRepo);
|
argList2 = strLstDup(argListMultiRepo);
|
||||||
hrnCfgArgRawZ(argList2, cfgOptStanza, "stanza1");
|
hrnCfgArgRawZ(argList2, cfgOptStanza, "stanza1");
|
||||||
harnessCfgLoad(cfgCmdInfo, argList2);
|
HRN_CFG_LOAD(cfgCmdInfo, argList2);
|
||||||
|
|
||||||
TEST_RESULT_STR(
|
TEST_RESULT_STR(
|
||||||
infoRender(), strNewFmt(
|
infoRender(), strNewFmt(
|
||||||
@ -2610,7 +2610,7 @@ testRun(void)
|
|||||||
hrnCfgArgRawZ(argList2, cfgOptRepoPath, TEST_PATH_REPO);
|
hrnCfgArgRawZ(argList2, cfgOptRepoPath, TEST_PATH_REPO);
|
||||||
hrnCfgArgRawZ(argList2, cfgOptStanza, "stanza1");
|
hrnCfgArgRawZ(argList2, cfgOptStanza, "stanza1");
|
||||||
hrnCfgArgKeyRawZ(argList2, cfgOptRepoPath, 2, TEST_PATH "/repo2");
|
hrnCfgArgKeyRawZ(argList2, cfgOptRepoPath, 2, TEST_PATH "/repo2");
|
||||||
harnessCfgLoad(cfgCmdInfo, argList2);
|
HRN_CFG_LOAD(cfgCmdInfo, argList2);
|
||||||
|
|
||||||
// Note that although the time on the backup in repo2 > repo1, repo1 current db is not the same because of the version so
|
// Note that although the time on the backup in repo2 > repo1, repo1 current db is not the same because of the version so
|
||||||
// the repo1, since read first, will be considered the current PG
|
// the repo1, since read first, will be considered the current PG
|
||||||
@ -2724,7 +2724,7 @@ testRun(void)
|
|||||||
{
|
{
|
||||||
StringList *argList = strLstNew();
|
StringList *argList = strLstNew();
|
||||||
strLstAdd(argList, strNewFmt("--repo-path=%s", strZ(repoPath)));
|
strLstAdd(argList, strNewFmt("--repo-path=%s", strZ(repoPath)));
|
||||||
harnessCfgLoad(cfgCmdInfo, argList);
|
HRN_CFG_LOAD(cfgCmdInfo, argList);
|
||||||
|
|
||||||
storagePathCreateP(storageLocalWrite(), archivePath);
|
storagePathCreateP(storageLocalWrite(), archivePath);
|
||||||
storagePathCreateP(storageLocalWrite(), backupPath);
|
storagePathCreateP(storageLocalWrite(), backupPath);
|
||||||
@ -2749,7 +2749,7 @@ testRun(void)
|
|||||||
//--------------------------------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------------------------------
|
||||||
strLstAddZ(argList, "--set=bogus");
|
strLstAddZ(argList, "--set=bogus");
|
||||||
|
|
||||||
TEST_ERROR(harnessCfgLoad(cfgCmdInfo, argList), OptionInvalidError, "option 'set' not valid without option 'stanza'");
|
TEST_ERROR(hrnCfgLoadP(cfgCmdInfo, argList), OptionInvalidError, "option 'set' not valid without option 'stanza'");
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------------------------------
|
||||||
TEST_TITLE("repo-level error");
|
TEST_TITLE("repo-level error");
|
||||||
@ -2760,7 +2760,7 @@ testRun(void)
|
|||||||
|
|
||||||
argList = strLstNew();
|
argList = strLstNew();
|
||||||
hrnCfgArgKeyRawZ(argList, cfgOptRepoPath, 1, TEST_PATH "/repo2");
|
hrnCfgArgKeyRawZ(argList, cfgOptRepoPath, 1, TEST_PATH "/repo2");
|
||||||
harnessCfgLoad(cfgCmdInfo, argList);
|
HRN_CFG_LOAD(cfgCmdInfo, argList);
|
||||||
|
|
||||||
TEST_RESULT_STR_Z(
|
TEST_RESULT_STR_Z(
|
||||||
infoRender(),
|
infoRender(),
|
||||||
@ -2771,7 +2771,7 @@ testRun(void)
|
|||||||
"text - invalid stanza");
|
"text - invalid stanza");
|
||||||
|
|
||||||
hrnCfgArgRawZ(argList, cfgOptOutput, "json");
|
hrnCfgArgRawZ(argList, cfgOptOutput, "json");
|
||||||
harnessCfgLoad(cfgCmdInfo, argList);
|
HRN_CFG_LOAD(cfgCmdInfo, argList);
|
||||||
|
|
||||||
TEST_RESULT_STR_Z(
|
TEST_RESULT_STR_Z(
|
||||||
infoRender(),
|
infoRender(),
|
||||||
@ -2805,7 +2805,7 @@ testRun(void)
|
|||||||
argList = strLstNew();
|
argList = strLstNew();
|
||||||
hrnCfgArgKeyRawZ(argList, cfgOptRepoPath, 1, TEST_PATH "/repo2");
|
hrnCfgArgKeyRawZ(argList, cfgOptRepoPath, 1, TEST_PATH "/repo2");
|
||||||
hrnCfgArgRawZ(argList, cfgOptStanza, "stanza1");
|
hrnCfgArgRawZ(argList, cfgOptStanza, "stanza1");
|
||||||
harnessCfgLoad(cfgCmdInfo, argList);
|
HRN_CFG_LOAD(cfgCmdInfo, argList);
|
||||||
|
|
||||||
TEST_RESULT_STR_Z(
|
TEST_RESULT_STR_Z(
|
||||||
infoRender(),
|
infoRender(),
|
||||||
@ -2816,7 +2816,7 @@ testRun(void)
|
|||||||
"text - stanza requested");
|
"text - stanza requested");
|
||||||
|
|
||||||
hrnCfgArgKeyRawZ(argList, cfgOptRepoPath, 2, TEST_PATH "/repo");
|
hrnCfgArgKeyRawZ(argList, cfgOptRepoPath, 2, TEST_PATH "/repo");
|
||||||
harnessCfgLoad(cfgCmdInfo, argList);
|
HRN_CFG_LOAD(cfgCmdInfo, argList);
|
||||||
|
|
||||||
TEST_RESULT_STR_Z(
|
TEST_RESULT_STR_Z(
|
||||||
infoRender(),
|
infoRender(),
|
||||||
|
@ -35,7 +35,7 @@ testRun(void)
|
|||||||
hrnCfgArgRawZ(argList, cfgOptPgPath, "/path/to/pg");
|
hrnCfgArgRawZ(argList, cfgOptPgPath, "/path/to/pg");
|
||||||
strLstAddZ(argList, "--process=1");
|
strLstAddZ(argList, "--process=1");
|
||||||
hrnCfgArgRawStrId(argList, cfgOptRemoteType, protocolStorageTypeRepo);
|
hrnCfgArgRawStrId(argList, cfgOptRemoteType, protocolStorageTypeRepo);
|
||||||
harnessCfgLoadRole(cfgCmdArchiveGet, cfgCmdRoleLocal, argList);
|
HRN_CFG_LOAD(cfgCmdArchiveGet, argList, .role = cfgCmdRoleLocal);
|
||||||
|
|
||||||
cmdLocal(HARNESS_FORK_CHILD_READ(), HARNESS_FORK_CHILD_WRITE());
|
cmdLocal(HARNESS_FORK_CHILD_READ(), HARNESS_FORK_CHILD_WRITE());
|
||||||
}
|
}
|
||||||
|
@ -35,7 +35,7 @@ testRun(void)
|
|||||||
strLstAddZ(argList, "--stanza=test1");
|
strLstAddZ(argList, "--stanza=test1");
|
||||||
strLstAddZ(argList, "--process=1");
|
strLstAddZ(argList, "--process=1");
|
||||||
hrnCfgArgRawStrId(argList, cfgOptRemoteType, protocolStorageTypeRepo);
|
hrnCfgArgRawStrId(argList, cfgOptRemoteType, protocolStorageTypeRepo);
|
||||||
harnessCfgLoadRole(cfgCmdInfo, cfgCmdRoleRemote, argList);
|
HRN_CFG_LOAD(cfgCmdInfo, argList, .role = cfgCmdRoleRemote);
|
||||||
|
|
||||||
cmdRemote(HARNESS_FORK_CHILD_READ(), HARNESS_FORK_CHILD_WRITE());
|
cmdRemote(HARNESS_FORK_CHILD_READ(), HARNESS_FORK_CHILD_WRITE());
|
||||||
}
|
}
|
||||||
@ -64,14 +64,12 @@ testRun(void)
|
|||||||
HARNESS_FORK_CHILD_BEGIN(0, true)
|
HARNESS_FORK_CHILD_BEGIN(0, true)
|
||||||
{
|
{
|
||||||
StringList *argList = strLstNew();
|
StringList *argList = strLstNew();
|
||||||
strLstAddZ(argList, testProjectExe());
|
|
||||||
strLstAddZ(argList, "--process=0");
|
strLstAddZ(argList, "--process=0");
|
||||||
hrnCfgArgRawStrId(argList, cfgOptRemoteType, protocolStorageTypeRepo);
|
hrnCfgArgRawStrId(argList, cfgOptRemoteType, protocolStorageTypeRepo);
|
||||||
strLstAddZ(argList, "--lock-path=/bogus");
|
strLstAddZ(argList, "--lock-path=/bogus");
|
||||||
strLstAddZ(argList, "--" CFGOPT_STANZA "=test");
|
strLstAddZ(argList, "--" CFGOPT_STANZA "=test");
|
||||||
hrnCfgArgRawZ(argList, cfgOptPgPath, "/path/to/pg");
|
hrnCfgArgRawZ(argList, cfgOptPgPath, "/path/to/pg");
|
||||||
strLstAddZ(argList, CFGCMD_ARCHIVE_GET ":" CONFIG_COMMAND_ROLE_REMOTE);
|
HRN_CFG_LOAD(cfgCmdArchiveGet, argList, .role = cfgCmdRoleRemote, .noStd = true);
|
||||||
harnessCfgLoadRaw(strLstSize(argList), strLstPtr(argList));
|
|
||||||
|
|
||||||
cmdRemote(HARNESS_FORK_CHILD_READ(), HARNESS_FORK_CHILD_WRITE());
|
cmdRemote(HARNESS_FORK_CHILD_READ(), HARNESS_FORK_CHILD_WRITE());
|
||||||
}
|
}
|
||||||
@ -101,13 +99,11 @@ testRun(void)
|
|||||||
HARNESS_FORK_CHILD_BEGIN(0, true)
|
HARNESS_FORK_CHILD_BEGIN(0, true)
|
||||||
{
|
{
|
||||||
StringList *argList = strLstNew();
|
StringList *argList = strLstNew();
|
||||||
strLstAddZ(argList, testProjectExe());
|
|
||||||
strLstAddZ(argList, "--stanza=test");
|
strLstAddZ(argList, "--stanza=test");
|
||||||
strLstAddZ(argList, "--process=0");
|
strLstAddZ(argList, "--process=0");
|
||||||
hrnCfgArgRawStrId(argList, cfgOptRemoteType, protocolStorageTypeRepo);
|
hrnCfgArgRawStrId(argList, cfgOptRemoteType, protocolStorageTypeRepo);
|
||||||
strLstAddZ(argList, "--lock-path=/bogus");
|
strLstAddZ(argList, "--lock-path=/bogus");
|
||||||
strLstAddZ(argList, CFGCMD_ARCHIVE_PUSH ":" CONFIG_COMMAND_ROLE_REMOTE);
|
HRN_CFG_LOAD(cfgCmdArchivePush, argList, .role = cfgCmdRoleRemote, .noStd = true);
|
||||||
harnessCfgLoadRaw(strLstSize(argList), strLstPtr(argList));
|
|
||||||
|
|
||||||
cmdRemote(HARNESS_FORK_CHILD_READ(), HARNESS_FORK_CHILD_WRITE());
|
cmdRemote(HARNESS_FORK_CHILD_READ(), HARNESS_FORK_CHILD_WRITE());
|
||||||
}
|
}
|
||||||
@ -140,7 +136,7 @@ testRun(void)
|
|||||||
strLstAddZ(argList, "--process=0");
|
strLstAddZ(argList, "--process=0");
|
||||||
hrnCfgArgRawStrId(argList, cfgOptRemoteType, protocolStorageTypeRepo);
|
hrnCfgArgRawStrId(argList, cfgOptRemoteType, protocolStorageTypeRepo);
|
||||||
hrnCfgArgRawZ(argList, cfgOptRepo, "1");
|
hrnCfgArgRawZ(argList, cfgOptRepo, "1");
|
||||||
harnessCfgLoadRole(cfgCmdArchivePush, cfgCmdRoleRemote, argList);
|
HRN_CFG_LOAD(cfgCmdArchivePush, argList, .role = cfgCmdRoleRemote);
|
||||||
|
|
||||||
cmdRemote(HARNESS_FORK_CHILD_READ(), HARNESS_FORK_CHILD_WRITE());
|
cmdRemote(HARNESS_FORK_CHILD_READ(), HARNESS_FORK_CHILD_WRITE());
|
||||||
}
|
}
|
||||||
@ -178,7 +174,7 @@ testRun(void)
|
|||||||
strLstAddZ(argList, "--stanza=test");
|
strLstAddZ(argList, "--stanza=test");
|
||||||
strLstAddZ(argList, "--process=0");
|
strLstAddZ(argList, "--process=0");
|
||||||
hrnCfgArgRawStrId(argList, cfgOptRemoteType, protocolStorageTypeRepo);
|
hrnCfgArgRawStrId(argList, cfgOptRemoteType, protocolStorageTypeRepo);
|
||||||
harnessCfgLoadRole(cfgCmdArchivePush, cfgCmdRoleRemote, argList);
|
HRN_CFG_LOAD(cfgCmdArchivePush, argList, .role = cfgCmdRoleRemote);
|
||||||
|
|
||||||
cmdRemote(HARNESS_FORK_CHILD_READ(), HARNESS_FORK_CHILD_WRITE());
|
cmdRemote(HARNESS_FORK_CHILD_READ(), HARNESS_FORK_CHILD_WRITE());
|
||||||
}
|
}
|
||||||
|
@ -27,7 +27,7 @@ testRun(void)
|
|||||||
{
|
{
|
||||||
StringList *argList = strLstNew();
|
StringList *argList = strLstNew();
|
||||||
strLstAddZ(argList, "--repo-path=" TEST_PATH_REPO);
|
strLstAddZ(argList, "--repo-path=" TEST_PATH_REPO);
|
||||||
harnessCfgLoad(cfgCmdRepoCreate, argList);
|
HRN_CFG_LOAD(cfgCmdRepoCreate, argList);
|
||||||
|
|
||||||
// -------------------------------------------------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------------------------------------------------
|
||||||
TEST_TITLE("noop on non-S3 storage");
|
TEST_TITLE("noop on non-S3 storage");
|
||||||
@ -42,7 +42,7 @@ testRun(void)
|
|||||||
strLstAddZ(argList, "--repo-path=" TEST_PATH_REPO);
|
strLstAddZ(argList, "--repo-path=" TEST_PATH_REPO);
|
||||||
strLstAddZ(argList, "--output=text");
|
strLstAddZ(argList, "--output=text");
|
||||||
strLstAddZ(argList, "--sort=none");
|
strLstAddZ(argList, "--sort=none");
|
||||||
harnessCfgLoad(cfgCmdRepoLs, argList);
|
HRN_CFG_LOAD(cfgCmdRepoLs, argList);
|
||||||
|
|
||||||
// Missing directory
|
// Missing directory
|
||||||
// -------------------------------------------------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------------------------------------------------
|
||||||
@ -158,7 +158,7 @@ testRun(void)
|
|||||||
// -------------------------------------------------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------------------------------------------------
|
||||||
StringList *argListTmp = strLstDup(argList);
|
StringList *argListTmp = strLstDup(argList);
|
||||||
strLstAddZ(argListTmp, "bbb");
|
strLstAddZ(argListTmp, "bbb");
|
||||||
harnessCfgLoad(cfgCmdRepoLs, argListTmp);
|
HRN_CFG_LOAD(cfgCmdRepoLs, argListTmp);
|
||||||
|
|
||||||
output = bufNew(0);
|
output = bufNew(0);
|
||||||
cfgOptionSet(cfgOptOutput, cfgSourceParam, VARSTRDEF("text"));
|
cfgOptionSet(cfgOptOutput, cfgSourceParam, VARSTRDEF("text"));
|
||||||
@ -183,7 +183,7 @@ testRun(void)
|
|||||||
// Too many paths
|
// Too many paths
|
||||||
// -------------------------------------------------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------------------------------------------------
|
||||||
strLstAddZ(argListTmp, "ccc");
|
strLstAddZ(argListTmp, "ccc");
|
||||||
harnessCfgLoad(cfgCmdRepoLs, argListTmp);
|
HRN_CFG_LOAD(cfgCmdRepoLs, argListTmp);
|
||||||
|
|
||||||
TEST_ERROR(storageListRender(ioBufferWriteNew(output)), ParamInvalidError, "only one path may be specified");
|
TEST_ERROR(storageListRender(ioBufferWriteNew(output)), ParamInvalidError, "only one path may be specified");
|
||||||
|
|
||||||
@ -194,7 +194,7 @@ testRun(void)
|
|||||||
hrnCfgArgKeyRawZ(argList, cfgOptRepoPath, 2, TEST_PATH_REPO "/aaa");
|
hrnCfgArgKeyRawZ(argList, cfgOptRepoPath, 2, TEST_PATH_REPO "/aaa");
|
||||||
hrnCfgArgRawZ(argList, cfgOptRepo, "2");
|
hrnCfgArgRawZ(argList, cfgOptRepo, "2");
|
||||||
strLstAddZ(argList, "--output=json");
|
strLstAddZ(argList, "--output=json");
|
||||||
harnessCfgLoad(cfgCmdRepoLs, argList);
|
HRN_CFG_LOAD(cfgCmdRepoLs, argList);
|
||||||
|
|
||||||
output = bufNew(0);
|
output = bufNew(0);
|
||||||
TEST_RESULT_VOID(storageListRender(ioBufferWriteNew(output)), "file (json)");
|
TEST_RESULT_VOID(storageListRender(ioBufferWriteNew(output)), "file (json)");
|
||||||
@ -298,7 +298,7 @@ testRun(void)
|
|||||||
|
|
||||||
StringList *argList = strLstNew();
|
StringList *argList = strLstNew();
|
||||||
hrnCfgArgRawZ(argList, cfgOptRepoPath, TEST_PATH_REPO);
|
hrnCfgArgRawZ(argList, cfgOptRepoPath, TEST_PATH_REPO);
|
||||||
harnessCfgLoad(cfgCmdRepoPut, argList);
|
HRN_CFG_LOAD(cfgCmdRepoPut, argList);
|
||||||
|
|
||||||
TEST_ERROR(storagePutProcess(ioBufferReadNew(fileBuffer)), ParamRequiredError, "destination file required");
|
TEST_ERROR(storagePutProcess(ioBufferReadNew(fileBuffer)), ParamRequiredError, "destination file required");
|
||||||
|
|
||||||
@ -306,7 +306,7 @@ testRun(void)
|
|||||||
TEST_TITLE("put a file");
|
TEST_TITLE("put a file");
|
||||||
|
|
||||||
strLstAdd(argList, fileName);
|
strLstAdd(argList, fileName);
|
||||||
harnessCfgLoad(cfgCmdRepoPut, argList);
|
HRN_CFG_LOAD(cfgCmdRepoPut, argList);
|
||||||
|
|
||||||
TEST_RESULT_VOID(storagePutProcess(ioBufferReadNew(fileBuffer)), "put");
|
TEST_RESULT_VOID(storagePutProcess(ioBufferReadNew(fileBuffer)), "put");
|
||||||
|
|
||||||
@ -318,7 +318,7 @@ testRun(void)
|
|||||||
hrnCfgArgRawStrId(argList, cfgOptRepoCipherType, cipherTypeAes256Cbc);
|
hrnCfgArgRawStrId(argList, cfgOptRepoCipherType, cipherTypeAes256Cbc);
|
||||||
strLstAddZ(argList, "--" CFGOPT_CIPHER_PASS "=custom");
|
strLstAddZ(argList, "--" CFGOPT_CIPHER_PASS "=custom");
|
||||||
strLstAdd(argList, fileEncCustomName);
|
strLstAdd(argList, fileEncCustomName);
|
||||||
harnessCfgLoad(cfgCmdRepoPut, argList);
|
HRN_CFG_LOAD(cfgCmdRepoPut, argList);
|
||||||
|
|
||||||
TEST_RESULT_VOID(storagePutProcess(ioBufferReadNew(fileEncCustomBuffer)), "put");
|
TEST_RESULT_VOID(storagePutProcess(ioBufferReadNew(fileEncCustomBuffer)), "put");
|
||||||
|
|
||||||
@ -330,7 +330,7 @@ testRun(void)
|
|||||||
hrnCfgArgRawStrId(argList, cfgOptRepoCipherType, cipherTypeAes256Cbc);
|
hrnCfgArgRawStrId(argList, cfgOptRepoCipherType, cipherTypeAes256Cbc);
|
||||||
strLstAddZ(argList, "--raw");
|
strLstAddZ(argList, "--raw");
|
||||||
strLstAdd(argList, fileRawName);
|
strLstAdd(argList, fileRawName);
|
||||||
harnessCfgLoad(cfgCmdRepoPut, argList);
|
HRN_CFG_LOAD(cfgCmdRepoPut, argList);
|
||||||
|
|
||||||
// Get stdin from a file
|
// Get stdin from a file
|
||||||
int stdinSave = dup(STDIN_FILENO);
|
int stdinSave = dup(STDIN_FILENO);
|
||||||
@ -351,7 +351,7 @@ testRun(void)
|
|||||||
hrnCfgArgRawZ(argList, cfgOptRepoPath, TEST_PATH_REPO);
|
hrnCfgArgRawZ(argList, cfgOptRepoPath, TEST_PATH_REPO);
|
||||||
hrnCfgArgRawStrId(argList, cfgOptRepoCipherType, cipherTypeAes256Cbc);
|
hrnCfgArgRawStrId(argList, cfgOptRepoCipherType, cipherTypeAes256Cbc);
|
||||||
strLstAddZ(argList, STORAGE_PATH_ARCHIVE "/test/" INFO_ARCHIVE_FILE);
|
strLstAddZ(argList, STORAGE_PATH_ARCHIVE "/test/" INFO_ARCHIVE_FILE);
|
||||||
harnessCfgLoad(cfgCmdRepoPut, argList);
|
HRN_CFG_LOAD(cfgCmdRepoPut, argList);
|
||||||
|
|
||||||
TEST_RESULT_VOID(storagePutProcess(ioBufferReadNew(archiveInfoFileBuffer)), "put");
|
TEST_RESULT_VOID(storagePutProcess(ioBufferReadNew(archiveInfoFileBuffer)), "put");
|
||||||
|
|
||||||
@ -362,7 +362,7 @@ testRun(void)
|
|||||||
hrnCfgArgRawZ(argList, cfgOptRepoPath, TEST_PATH_REPO);
|
hrnCfgArgRawZ(argList, cfgOptRepoPath, TEST_PATH_REPO);
|
||||||
hrnCfgArgRawStrId(argList, cfgOptRepoCipherType, cipherTypeAes256Cbc);
|
hrnCfgArgRawStrId(argList, cfgOptRepoCipherType, cipherTypeAes256Cbc);
|
||||||
strLstAddZ(argList, STORAGE_PATH_ARCHIVE "/test/" INFO_ARCHIVE_FILE ".copy");
|
strLstAddZ(argList, STORAGE_PATH_ARCHIVE "/test/" INFO_ARCHIVE_FILE ".copy");
|
||||||
harnessCfgLoad(cfgCmdRepoPut, argList);
|
HRN_CFG_LOAD(cfgCmdRepoPut, argList);
|
||||||
|
|
||||||
TEST_RESULT_VOID(storagePutProcess(ioBufferReadNew(archiveInfoFileBuffer)), "put");
|
TEST_RESULT_VOID(storagePutProcess(ioBufferReadNew(archiveInfoFileBuffer)), "put");
|
||||||
|
|
||||||
@ -373,7 +373,7 @@ testRun(void)
|
|||||||
hrnCfgArgRawZ(argList, cfgOptRepoPath, TEST_PATH_REPO);
|
hrnCfgArgRawZ(argList, cfgOptRepoPath, TEST_PATH_REPO);
|
||||||
hrnCfgArgRawStrId(argList, cfgOptRepoCipherType, cipherTypeAes256Cbc);
|
hrnCfgArgRawStrId(argList, cfgOptRepoCipherType, cipherTypeAes256Cbc);
|
||||||
strLstAddZ(argList, STORAGE_PATH_BACKUP "/test/" INFO_BACKUP_FILE);
|
strLstAddZ(argList, STORAGE_PATH_BACKUP "/test/" INFO_BACKUP_FILE);
|
||||||
harnessCfgLoad(cfgCmdRepoPut, argList);
|
HRN_CFG_LOAD(cfgCmdRepoPut, argList);
|
||||||
|
|
||||||
TEST_RESULT_VOID(storagePutProcess(ioBufferReadNew(backupInfoFileBuffer)), "put");
|
TEST_RESULT_VOID(storagePutProcess(ioBufferReadNew(backupInfoFileBuffer)), "put");
|
||||||
|
|
||||||
@ -384,7 +384,7 @@ testRun(void)
|
|||||||
hrnCfgArgRawZ(argList, cfgOptRepoPath, TEST_PATH_REPO);
|
hrnCfgArgRawZ(argList, cfgOptRepoPath, TEST_PATH_REPO);
|
||||||
hrnCfgArgRawStrId(argList, cfgOptRepoCipherType, cipherTypeAes256Cbc);
|
hrnCfgArgRawStrId(argList, cfgOptRepoCipherType, cipherTypeAes256Cbc);
|
||||||
strLstAddZ(argList, STORAGE_PATH_BACKUP "/test/" INFO_BACKUP_FILE ".copy");
|
strLstAddZ(argList, STORAGE_PATH_BACKUP "/test/" INFO_BACKUP_FILE ".copy");
|
||||||
harnessCfgLoad(cfgCmdRepoPut, argList);
|
HRN_CFG_LOAD(cfgCmdRepoPut, argList);
|
||||||
|
|
||||||
TEST_RESULT_VOID(storagePutProcess(ioBufferReadNew(backupInfoFileBuffer)), "put");
|
TEST_RESULT_VOID(storagePutProcess(ioBufferReadNew(backupInfoFileBuffer)), "put");
|
||||||
|
|
||||||
@ -403,7 +403,7 @@ testRun(void)
|
|||||||
strLstAddZ(argList, "--" CFGOPT_CIPHER_PASS "=custom");
|
strLstAddZ(argList, "--" CFGOPT_CIPHER_PASS "=custom");
|
||||||
strLstAdd(
|
strLstAdd(
|
||||||
argList, STRDEF(STORAGE_PATH_ARCHIVE "/test/12-1/000000010000000100000001-aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"));
|
argList, STRDEF(STORAGE_PATH_ARCHIVE "/test/12-1/000000010000000100000001-aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"));
|
||||||
harnessCfgLoad(cfgCmdRepoPut, argList);
|
HRN_CFG_LOAD(cfgCmdRepoPut, argList);
|
||||||
|
|
||||||
TEST_RESULT_VOID(storagePutProcess(ioBufferReadNew(archiveFileBuffer)), "put");
|
TEST_RESULT_VOID(storagePutProcess(ioBufferReadNew(archiveFileBuffer)), "put");
|
||||||
|
|
||||||
@ -418,7 +418,7 @@ testRun(void)
|
|||||||
hrnCfgArgRawStrId(argList, cfgOptRepoCipherType, cipherTypeAes256Cbc);
|
hrnCfgArgRawStrId(argList, cfgOptRepoCipherType, cipherTypeAes256Cbc);
|
||||||
strLstAddZ(argList, "--" CFGOPT_CIPHER_PASS "=custom");
|
strLstAddZ(argList, "--" CFGOPT_CIPHER_PASS "=custom");
|
||||||
strLstAddZ(argList, STORAGE_PATH_BACKUP "/test/latest/" BACKUP_MANIFEST_FILE);
|
strLstAddZ(argList, STORAGE_PATH_BACKUP "/test/latest/" BACKUP_MANIFEST_FILE);
|
||||||
harnessCfgLoad(cfgCmdRepoPut, argList);
|
HRN_CFG_LOAD(cfgCmdRepoPut, argList);
|
||||||
|
|
||||||
TEST_RESULT_VOID(storagePutProcess(ioBufferReadNew(manifestFileBuffer)), "put");
|
TEST_RESULT_VOID(storagePutProcess(ioBufferReadNew(manifestFileBuffer)), "put");
|
||||||
|
|
||||||
@ -430,7 +430,7 @@ testRun(void)
|
|||||||
hrnCfgArgRawStrId(argList, cfgOptRepoCipherType, cipherTypeAes256Cbc);
|
hrnCfgArgRawStrId(argList, cfgOptRepoCipherType, cipherTypeAes256Cbc);
|
||||||
strLstAddZ(argList, "--" CFGOPT_CIPHER_PASS "=custom");
|
strLstAddZ(argList, "--" CFGOPT_CIPHER_PASS "=custom");
|
||||||
strLstAddZ(argList, STORAGE_PATH_BACKUP "/test/latest/" BACKUP_MANIFEST_FILE ".copy");
|
strLstAddZ(argList, STORAGE_PATH_BACKUP "/test/latest/" BACKUP_MANIFEST_FILE ".copy");
|
||||||
harnessCfgLoad(cfgCmdRepoPut, argList);
|
HRN_CFG_LOAD(cfgCmdRepoPut, argList);
|
||||||
|
|
||||||
TEST_RESULT_VOID(storagePutProcess(ioBufferReadNew(manifestFileBuffer)), "put");
|
TEST_RESULT_VOID(storagePutProcess(ioBufferReadNew(manifestFileBuffer)), "put");
|
||||||
|
|
||||||
@ -444,7 +444,7 @@ testRun(void)
|
|||||||
hrnCfgArgKeyRawStrId(argList, cfgOptRepoCipherType, 2, cipherTypeAes256Cbc);
|
hrnCfgArgKeyRawStrId(argList, cfgOptRepoCipherType, 2, cipherTypeAes256Cbc);
|
||||||
strLstAddZ(argList, "--" CFGOPT_CIPHER_PASS "=custom");
|
strLstAddZ(argList, "--" CFGOPT_CIPHER_PASS "=custom");
|
||||||
strLstAddZ(argList, STORAGE_PATH_BACKUP "/test/backup.history/2020/label.manifest.gz");
|
strLstAddZ(argList, STORAGE_PATH_BACKUP "/test/backup.history/2020/label.manifest.gz");
|
||||||
harnessCfgLoad(cfgCmdRepoPut, argList);
|
HRN_CFG_LOAD(cfgCmdRepoPut, argList);
|
||||||
|
|
||||||
TEST_RESULT_VOID(storagePutProcess(ioBufferReadNew(manifestFileBuffer)), "put");
|
TEST_RESULT_VOID(storagePutProcess(ioBufferReadNew(manifestFileBuffer)), "put");
|
||||||
|
|
||||||
@ -456,7 +456,7 @@ testRun(void)
|
|||||||
hrnCfgArgRawStrId(argList, cfgOptRepoCipherType, cipherTypeAes256Cbc);
|
hrnCfgArgRawStrId(argList, cfgOptRepoCipherType, cipherTypeAes256Cbc);
|
||||||
strLstAddZ(argList, "--" CFGOPT_CIPHER_PASS "=custom2");
|
strLstAddZ(argList, "--" CFGOPT_CIPHER_PASS "=custom2");
|
||||||
strLstAdd(argList, STRDEF(STORAGE_PATH_BACKUP "/test/latest/pg_data/backup_label"));
|
strLstAdd(argList, STRDEF(STORAGE_PATH_BACKUP "/test/latest/pg_data/backup_label"));
|
||||||
harnessCfgLoad(cfgCmdRepoPut, argList);
|
HRN_CFG_LOAD(cfgCmdRepoPut, argList);
|
||||||
|
|
||||||
TEST_RESULT_VOID(storagePutProcess(ioBufferReadNew(backupLabelBuffer)), "put");
|
TEST_RESULT_VOID(storagePutProcess(ioBufferReadNew(backupLabelBuffer)), "put");
|
||||||
|
|
||||||
@ -465,7 +465,7 @@ testRun(void)
|
|||||||
|
|
||||||
argList = strLstNew();
|
argList = strLstNew();
|
||||||
hrnCfgArgRawZ(argList, cfgOptRepoPath, TEST_PATH_REPO);
|
hrnCfgArgRawZ(argList, cfgOptRepoPath, TEST_PATH_REPO);
|
||||||
harnessCfgLoad(cfgCmdRepoGet, argList);
|
HRN_CFG_LOAD(cfgCmdRepoGet, argList);
|
||||||
|
|
||||||
TEST_ERROR(storageGetProcess(ioBufferWriteNew(bufNew(0))), ParamRequiredError, "source file required");
|
TEST_ERROR(storageGetProcess(ioBufferWriteNew(bufNew(0))), ParamRequiredError, "source file required");
|
||||||
|
|
||||||
@ -473,7 +473,7 @@ testRun(void)
|
|||||||
TEST_TITLE("get a file");
|
TEST_TITLE("get a file");
|
||||||
|
|
||||||
strLstAdd(argList, fileName);
|
strLstAdd(argList, fileName);
|
||||||
harnessCfgLoad(cfgCmdRepoGet, argList);
|
HRN_CFG_LOAD(cfgCmdRepoGet, argList);
|
||||||
|
|
||||||
Buffer *writeBuffer = bufNew(0);
|
Buffer *writeBuffer = bufNew(0);
|
||||||
TEST_RESULT_INT(storageGetProcess(ioBufferWriteNew(writeBuffer)), 0, "get");
|
TEST_RESULT_INT(storageGetProcess(ioBufferWriteNew(writeBuffer)), 0, "get");
|
||||||
@ -485,7 +485,7 @@ testRun(void)
|
|||||||
argList = strLstNew();
|
argList = strLstNew();
|
||||||
hrnCfgArgRawZ(argList, cfgOptRepoPath, "/");
|
hrnCfgArgRawZ(argList, cfgOptRepoPath, "/");
|
||||||
strLstAdd(argList, strNewFmt(TEST_PATH "/repo/%s", strZ(fileName)));
|
strLstAdd(argList, strNewFmt(TEST_PATH "/repo/%s", strZ(fileName)));
|
||||||
harnessCfgLoad(cfgCmdRepoGet, argList);
|
HRN_CFG_LOAD(cfgCmdRepoGet, argList);
|
||||||
|
|
||||||
writeBuffer = bufNew(0);
|
writeBuffer = bufNew(0);
|
||||||
TEST_RESULT_INT(storageGetProcess(ioBufferWriteNew(writeBuffer)), 0, "get");
|
TEST_RESULT_INT(storageGetProcess(ioBufferWriteNew(writeBuffer)), 0, "get");
|
||||||
@ -499,7 +499,7 @@ testRun(void)
|
|||||||
hrnCfgArgRawStrId(argList, cfgOptRepoCipherType, cipherTypeAes256Cbc);
|
hrnCfgArgRawStrId(argList, cfgOptRepoCipherType, cipherTypeAes256Cbc);
|
||||||
strLstAddZ(argList, "--" CFGOPT_CIPHER_PASS "=custom");
|
strLstAddZ(argList, "--" CFGOPT_CIPHER_PASS "=custom");
|
||||||
strLstAdd(argList, fileEncCustomName);
|
strLstAdd(argList, fileEncCustomName);
|
||||||
harnessCfgLoad(cfgCmdRepoGet, argList);
|
HRN_CFG_LOAD(cfgCmdRepoGet, argList);
|
||||||
|
|
||||||
writeBuffer = bufNew(0);
|
writeBuffer = bufNew(0);
|
||||||
TEST_RESULT_INT(storageGetProcess(ioBufferWriteNew(writeBuffer)), 0, "get");
|
TEST_RESULT_INT(storageGetProcess(ioBufferWriteNew(writeBuffer)), 0, "get");
|
||||||
@ -513,7 +513,7 @@ testRun(void)
|
|||||||
hrnCfgArgRawStrId(argList, cfgOptRepoCipherType, cipherTypeAes256Cbc);
|
hrnCfgArgRawStrId(argList, cfgOptRepoCipherType, cipherTypeAes256Cbc);
|
||||||
strLstAddZ(argList, "--raw");
|
strLstAddZ(argList, "--raw");
|
||||||
strLstAdd(argList, fileRawName);
|
strLstAdd(argList, fileRawName);
|
||||||
harnessCfgLoad(cfgCmdRepoGet, argList);
|
HRN_CFG_LOAD(cfgCmdRepoGet, argList);
|
||||||
|
|
||||||
TEST_LOG("get");
|
TEST_LOG("get");
|
||||||
|
|
||||||
@ -539,7 +539,7 @@ testRun(void)
|
|||||||
hrnCfgArgRawZ(argList, cfgOptRepoPath, TEST_PATH_REPO);
|
hrnCfgArgRawZ(argList, cfgOptRepoPath, TEST_PATH_REPO);
|
||||||
strLstAddZ(argList, "--" CFGOPT_IGNORE_MISSING);
|
strLstAddZ(argList, "--" CFGOPT_IGNORE_MISSING);
|
||||||
strLstAddZ(argList, BOGUS_STR);
|
strLstAddZ(argList, BOGUS_STR);
|
||||||
harnessCfgLoad(cfgCmdRepoGet, argList);
|
HRN_CFG_LOAD(cfgCmdRepoGet, argList);
|
||||||
|
|
||||||
writeBuffer = bufNew(0);
|
writeBuffer = bufNew(0);
|
||||||
TEST_RESULT_INT(storageGetProcess(ioBufferWriteNew(bufNew(0))), 1, "get");
|
TEST_RESULT_INT(storageGetProcess(ioBufferWriteNew(bufNew(0))), 1, "get");
|
||||||
@ -553,7 +553,7 @@ testRun(void)
|
|||||||
hrnCfgArgRawZ(argList, cfgOptRepo, "2");
|
hrnCfgArgRawZ(argList, cfgOptRepo, "2");
|
||||||
hrnCfgArgRawStrId(argList, cfgOptRepoCipherType, cipherTypeAes256Cbc);
|
hrnCfgArgRawStrId(argList, cfgOptRepoCipherType, cipherTypeAes256Cbc);
|
||||||
strLstAddZ(argList, "/somewhere/" INFO_ARCHIVE_FILE);
|
strLstAddZ(argList, "/somewhere/" INFO_ARCHIVE_FILE);
|
||||||
harnessCfgLoad(cfgCmdRepoGet, argList);
|
HRN_CFG_LOAD(cfgCmdRepoGet, argList);
|
||||||
|
|
||||||
writeBuffer = bufNew(0);
|
writeBuffer = bufNew(0);
|
||||||
TEST_ERROR(
|
TEST_ERROR(
|
||||||
@ -567,7 +567,7 @@ testRun(void)
|
|||||||
hrnCfgArgRawZ(argList, cfgOptRepoPath, TEST_PATH_REPO);
|
hrnCfgArgRawZ(argList, cfgOptRepoPath, TEST_PATH_REPO);
|
||||||
hrnCfgArgRawStrId(argList, cfgOptRepoCipherType, cipherTypeAes256Cbc);
|
hrnCfgArgRawStrId(argList, cfgOptRepoCipherType, cipherTypeAes256Cbc);
|
||||||
strLstAdd(argList, fileEncCustomName);
|
strLstAdd(argList, fileEncCustomName);
|
||||||
harnessCfgLoad(cfgCmdRepoGet, argList);
|
HRN_CFG_LOAD(cfgCmdRepoGet, argList);
|
||||||
|
|
||||||
writeBuffer = bufNew(0);
|
writeBuffer = bufNew(0);
|
||||||
TEST_ERROR(
|
TEST_ERROR(
|
||||||
@ -582,7 +582,7 @@ testRun(void)
|
|||||||
strLstAddZ(argList, "--" CFGOPT_STANZA "=test2");
|
strLstAddZ(argList, "--" CFGOPT_STANZA "=test2");
|
||||||
hrnCfgArgRawStrId(argList, cfgOptRepoCipherType, cipherTypeAes256Cbc);
|
hrnCfgArgRawStrId(argList, cfgOptRepoCipherType, cipherTypeAes256Cbc);
|
||||||
strLstAddZ(argList, STORAGE_PATH_ARCHIVE "/test/" INFO_ARCHIVE_FILE);
|
strLstAddZ(argList, STORAGE_PATH_ARCHIVE "/test/" INFO_ARCHIVE_FILE);
|
||||||
harnessCfgLoad(cfgCmdRepoGet, argList);
|
HRN_CFG_LOAD(cfgCmdRepoGet, argList);
|
||||||
|
|
||||||
writeBuffer = bufNew(0);
|
writeBuffer = bufNew(0);
|
||||||
TEST_ERROR(storageGetProcess(ioBufferWriteNew(writeBuffer)), OptionInvalidValueError,
|
TEST_ERROR(storageGetProcess(ioBufferWriteNew(writeBuffer)), OptionInvalidValueError,
|
||||||
@ -595,7 +595,7 @@ testRun(void)
|
|||||||
hrnCfgArgRawZ(argList, cfgOptRepoPath, TEST_PATH_REPO);
|
hrnCfgArgRawZ(argList, cfgOptRepoPath, TEST_PATH_REPO);
|
||||||
hrnCfgArgRawStrId(argList, cfgOptRepoCipherType, cipherTypeAes256Cbc);
|
hrnCfgArgRawStrId(argList, cfgOptRepoCipherType, cipherTypeAes256Cbc);
|
||||||
strLstAddZ(argList, STORAGE_PATH_ARCHIVE "/test/" INFO_ARCHIVE_FILE);
|
strLstAddZ(argList, STORAGE_PATH_ARCHIVE "/test/" INFO_ARCHIVE_FILE);
|
||||||
harnessCfgLoad(cfgCmdRepoGet, argList);
|
HRN_CFG_LOAD(cfgCmdRepoGet, argList);
|
||||||
|
|
||||||
writeBuffer = bufNew(0);
|
writeBuffer = bufNew(0);
|
||||||
TEST_RESULT_INT(storageGetProcess(ioBufferWriteNew(writeBuffer)), 0, "get");
|
TEST_RESULT_INT(storageGetProcess(ioBufferWriteNew(writeBuffer)), 0, "get");
|
||||||
@ -609,7 +609,7 @@ testRun(void)
|
|||||||
strLstAddZ(argList, "--" CFGOPT_STANZA "=test");
|
strLstAddZ(argList, "--" CFGOPT_STANZA "=test");
|
||||||
hrnCfgArgRawStrId(argList, cfgOptRepoCipherType, cipherTypeAes256Cbc);
|
hrnCfgArgRawStrId(argList, cfgOptRepoCipherType, cipherTypeAes256Cbc);
|
||||||
strLstAddZ(argList, STORAGE_PATH_ARCHIVE "/test/" INFO_ARCHIVE_FILE ".copy");
|
strLstAddZ(argList, STORAGE_PATH_ARCHIVE "/test/" INFO_ARCHIVE_FILE ".copy");
|
||||||
harnessCfgLoad(cfgCmdRepoGet, argList);
|
HRN_CFG_LOAD(cfgCmdRepoGet, argList);
|
||||||
|
|
||||||
writeBuffer = bufNew(0);
|
writeBuffer = bufNew(0);
|
||||||
TEST_RESULT_INT(storageGetProcess(ioBufferWriteNew(writeBuffer)), 0, "get");
|
TEST_RESULT_INT(storageGetProcess(ioBufferWriteNew(writeBuffer)), 0, "get");
|
||||||
@ -622,7 +622,7 @@ testRun(void)
|
|||||||
hrnCfgArgRawZ(argList, cfgOptRepoPath, TEST_PATH_REPO);
|
hrnCfgArgRawZ(argList, cfgOptRepoPath, TEST_PATH_REPO);
|
||||||
hrnCfgArgRawStrId(argList, cfgOptRepoCipherType, cipherTypeAes256Cbc);
|
hrnCfgArgRawStrId(argList, cfgOptRepoCipherType, cipherTypeAes256Cbc);
|
||||||
strLstAddZ(argList, STORAGE_PATH_BACKUP "/test/" INFO_BACKUP_FILE);
|
strLstAddZ(argList, STORAGE_PATH_BACKUP "/test/" INFO_BACKUP_FILE);
|
||||||
harnessCfgLoad(cfgCmdRepoGet, argList);
|
HRN_CFG_LOAD(cfgCmdRepoGet, argList);
|
||||||
|
|
||||||
writeBuffer = bufNew(0);
|
writeBuffer = bufNew(0);
|
||||||
TEST_RESULT_INT(storageGetProcess(ioBufferWriteNew(writeBuffer)), 0, "get");
|
TEST_RESULT_INT(storageGetProcess(ioBufferWriteNew(writeBuffer)), 0, "get");
|
||||||
@ -635,7 +635,7 @@ testRun(void)
|
|||||||
hrnCfgArgRawZ(argList, cfgOptRepoPath, TEST_PATH_REPO);
|
hrnCfgArgRawZ(argList, cfgOptRepoPath, TEST_PATH_REPO);
|
||||||
hrnCfgArgRawStrId(argList, cfgOptRepoCipherType, cipherTypeAes256Cbc);
|
hrnCfgArgRawStrId(argList, cfgOptRepoCipherType, cipherTypeAes256Cbc);
|
||||||
strLstAddZ(argList, STORAGE_PATH_BACKUP "/test/" INFO_BACKUP_FILE ".copy");
|
strLstAddZ(argList, STORAGE_PATH_BACKUP "/test/" INFO_BACKUP_FILE ".copy");
|
||||||
harnessCfgLoad(cfgCmdRepoGet, argList);
|
HRN_CFG_LOAD(cfgCmdRepoGet, argList);
|
||||||
|
|
||||||
writeBuffer = bufNew(0);
|
writeBuffer = bufNew(0);
|
||||||
TEST_RESULT_INT(storageGetProcess(ioBufferWriteNew(writeBuffer)), 0, "get");
|
TEST_RESULT_INT(storageGetProcess(ioBufferWriteNew(writeBuffer)), 0, "get");
|
||||||
@ -655,7 +655,7 @@ testRun(void)
|
|||||||
strNewFmt(
|
strNewFmt(
|
||||||
"%s/repo/" STORAGE_PATH_ARCHIVE "/test/12-1/000000010000000100000001-aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
"%s/repo/" STORAGE_PATH_ARCHIVE "/test/12-1/000000010000000100000001-aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
||||||
TEST_PATH));
|
TEST_PATH));
|
||||||
harnessCfgLoad(cfgCmdRepoGet, argList);
|
HRN_CFG_LOAD(cfgCmdRepoGet, argList);
|
||||||
|
|
||||||
writeBuffer = bufNew(0);
|
writeBuffer = bufNew(0);
|
||||||
TEST_RESULT_INT(storageGetProcess(ioBufferWriteNew(writeBuffer)), 0, "get");
|
TEST_RESULT_INT(storageGetProcess(ioBufferWriteNew(writeBuffer)), 0, "get");
|
||||||
@ -668,7 +668,7 @@ testRun(void)
|
|||||||
hrnCfgArgRawZ(argList, cfgOptRepoPath, TEST_PATH_REPO);
|
hrnCfgArgRawZ(argList, cfgOptRepoPath, TEST_PATH_REPO);
|
||||||
hrnCfgArgRawStrId(argList, cfgOptRepoCipherType, cipherTypeAes256Cbc);
|
hrnCfgArgRawStrId(argList, cfgOptRepoCipherType, cipherTypeAes256Cbc);
|
||||||
strLstAddZ(argList, STORAGE_PATH_BACKUP "/test/latest/" BACKUP_MANIFEST_FILE);
|
strLstAddZ(argList, STORAGE_PATH_BACKUP "/test/latest/" BACKUP_MANIFEST_FILE);
|
||||||
harnessCfgLoad(cfgCmdRepoGet, argList);
|
HRN_CFG_LOAD(cfgCmdRepoGet, argList);
|
||||||
|
|
||||||
writeBuffer = bufNew(0);
|
writeBuffer = bufNew(0);
|
||||||
TEST_RESULT_INT(storageGetProcess(ioBufferWriteNew(writeBuffer)), 0, "get");
|
TEST_RESULT_INT(storageGetProcess(ioBufferWriteNew(writeBuffer)), 0, "get");
|
||||||
@ -681,7 +681,7 @@ testRun(void)
|
|||||||
hrnCfgArgRawZ(argList, cfgOptRepoPath, TEST_PATH_REPO);
|
hrnCfgArgRawZ(argList, cfgOptRepoPath, TEST_PATH_REPO);
|
||||||
hrnCfgArgRawStrId(argList, cfgOptRepoCipherType, cipherTypeAes256Cbc);
|
hrnCfgArgRawStrId(argList, cfgOptRepoCipherType, cipherTypeAes256Cbc);
|
||||||
strLstAddZ(argList, STORAGE_PATH_BACKUP "/test/latest/" BACKUP_MANIFEST_FILE ".copy");
|
strLstAddZ(argList, STORAGE_PATH_BACKUP "/test/latest/" BACKUP_MANIFEST_FILE ".copy");
|
||||||
harnessCfgLoad(cfgCmdRepoGet, argList);
|
HRN_CFG_LOAD(cfgCmdRepoGet, argList);
|
||||||
|
|
||||||
writeBuffer = bufNew(0);
|
writeBuffer = bufNew(0);
|
||||||
TEST_RESULT_INT(storageGetProcess(ioBufferWriteNew(writeBuffer)), 0, "get");
|
TEST_RESULT_INT(storageGetProcess(ioBufferWriteNew(writeBuffer)), 0, "get");
|
||||||
@ -694,7 +694,7 @@ testRun(void)
|
|||||||
hrnCfgArgRawZ(argList, cfgOptRepoPath, TEST_PATH_REPO);
|
hrnCfgArgRawZ(argList, cfgOptRepoPath, TEST_PATH_REPO);
|
||||||
hrnCfgArgRawStrId(argList, cfgOptRepoCipherType, cipherTypeAes256Cbc);
|
hrnCfgArgRawStrId(argList, cfgOptRepoCipherType, cipherTypeAes256Cbc);
|
||||||
strLstAddZ(argList, STORAGE_PATH_BACKUP "/test/backup.history/2020/label.manifest.gz");
|
strLstAddZ(argList, STORAGE_PATH_BACKUP "/test/backup.history/2020/label.manifest.gz");
|
||||||
harnessCfgLoad(cfgCmdRepoGet, argList);
|
HRN_CFG_LOAD(cfgCmdRepoGet, argList);
|
||||||
|
|
||||||
writeBuffer = bufNew(0);
|
writeBuffer = bufNew(0);
|
||||||
TEST_RESULT_INT(storageGetProcess(ioBufferWriteNew(writeBuffer)), 0, "get");
|
TEST_RESULT_INT(storageGetProcess(ioBufferWriteNew(writeBuffer)), 0, "get");
|
||||||
@ -707,7 +707,7 @@ testRun(void)
|
|||||||
hrnCfgArgRawZ(argList, cfgOptRepoPath, TEST_PATH_REPO);
|
hrnCfgArgRawZ(argList, cfgOptRepoPath, TEST_PATH_REPO);
|
||||||
hrnCfgArgRawStrId(argList, cfgOptRepoCipherType, cipherTypeAes256Cbc);
|
hrnCfgArgRawStrId(argList, cfgOptRepoCipherType, cipherTypeAes256Cbc);
|
||||||
strLstAdd(argList, STRDEF(STORAGE_PATH_BACKUP "/test/latest/pg_data/backup_label"));
|
strLstAdd(argList, STRDEF(STORAGE_PATH_BACKUP "/test/latest/pg_data/backup_label"));
|
||||||
harnessCfgLoad(cfgCmdRepoGet, argList);
|
HRN_CFG_LOAD(cfgCmdRepoGet, argList);
|
||||||
|
|
||||||
writeBuffer = bufNew(0);
|
writeBuffer = bufNew(0);
|
||||||
TEST_RESULT_INT(storageGetProcess(ioBufferWriteNew(writeBuffer)), 0, "get");
|
TEST_RESULT_INT(storageGetProcess(ioBufferWriteNew(writeBuffer)), 0, "get");
|
||||||
@ -726,7 +726,7 @@ testRun(void)
|
|||||||
{
|
{
|
||||||
StringList *argList = strLstNew();
|
StringList *argList = strLstNew();
|
||||||
strLstAddZ(argList, "--repo-path=" TEST_PATH "/repo");
|
strLstAddZ(argList, "--repo-path=" TEST_PATH "/repo");
|
||||||
harnessCfgLoad(cfgCmdRepoRm, argList);
|
HRN_CFG_LOAD(cfgCmdRepoRm, argList);
|
||||||
|
|
||||||
// -------------------------------------------------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------------------------------------------------
|
||||||
TEST_TITLE("remove missing path");
|
TEST_TITLE("remove missing path");
|
||||||
@ -737,7 +737,7 @@ testRun(void)
|
|||||||
TEST_TITLE("remove empty path");
|
TEST_TITLE("remove empty path");
|
||||||
|
|
||||||
strLstAddZ(argList, "path");
|
strLstAddZ(argList, "path");
|
||||||
harnessCfgLoad(cfgCmdRepoRm, argList);
|
HRN_CFG_LOAD(cfgCmdRepoRm, argList);
|
||||||
|
|
||||||
TEST_RESULT_VOID(storagePathCreateP(storageRepoWrite(), STRDEF("path")), "add path");
|
TEST_RESULT_VOID(storagePathCreateP(storageRepoWrite(), STRDEF("path")), "add path");
|
||||||
TEST_RESULT_VOID(cmdStorageRemove(), "remove path");
|
TEST_RESULT_VOID(cmdStorageRemove(), "remove path");
|
||||||
@ -760,7 +760,7 @@ testRun(void)
|
|||||||
TEST_TITLE("error on more than one path");
|
TEST_TITLE("error on more than one path");
|
||||||
|
|
||||||
strLstAddZ(argList, "repo2");
|
strLstAddZ(argList, "repo2");
|
||||||
harnessCfgLoad(cfgCmdRepoRm, argList);
|
HRN_CFG_LOAD(cfgCmdRepoRm, argList);
|
||||||
|
|
||||||
TEST_ERROR(cmdStorageRemove(), ParamInvalidError, "only one path may be specified");
|
TEST_ERROR(cmdStorageRemove(), ParamInvalidError, "only one path may be specified");
|
||||||
|
|
||||||
@ -772,7 +772,7 @@ testRun(void)
|
|||||||
hrnCfgArgKeyRawZ(argList, cfgOptRepoPath, 2, TEST_PATH_REPO);
|
hrnCfgArgKeyRawZ(argList, cfgOptRepoPath, 2, TEST_PATH_REPO);
|
||||||
hrnCfgArgRawZ(argList, cfgOptRepo, "2");
|
hrnCfgArgRawZ(argList, cfgOptRepo, "2");
|
||||||
strLstAddZ(argList, "path/aaa.txt");
|
strLstAddZ(argList, "path/aaa.txt");
|
||||||
harnessCfgLoad(cfgCmdRepoRm, argList);
|
HRN_CFG_LOAD(cfgCmdRepoRm, argList);
|
||||||
|
|
||||||
TEST_RESULT_VOID(
|
TEST_RESULT_VOID(
|
||||||
storagePutP(storageNewWriteP(storageRepoWrite(), STRDEF("path/aaa.txt")), BUFSTRDEF("TESTDATA")), "add path/file");
|
storagePutP(storageNewWriteP(storageRepoWrite(), STRDEF("path/aaa.txt")), BUFSTRDEF("TESTDATA")), "add path/file");
|
||||||
|
@ -165,7 +165,7 @@ testRun(void)
|
|||||||
strLstAddZ(argList, "--stanza=test1");
|
strLstAddZ(argList, "--stanza=test1");
|
||||||
strLstAddZ(argList, "--repo1-path=" TEST_PATH "/repo");
|
strLstAddZ(argList, "--repo1-path=" TEST_PATH "/repo");
|
||||||
strLstAddZ(argList, "--pg1-path=" TEST_PATH "/pg");
|
strLstAddZ(argList, "--pg1-path=" TEST_PATH "/pg");
|
||||||
harnessCfgLoad(cfgCmdRestore, argList);
|
HRN_CFG_LOAD(cfgCmdRestore, argList);
|
||||||
|
|
||||||
// Create the pg path
|
// Create the pg path
|
||||||
storagePathCreateP(storagePgWrite(), NULL, .mode = 0700);
|
storagePathCreateP(storagePgWrite(), NULL, .mode = 0700);
|
||||||
@ -337,7 +337,7 @@ testRun(void)
|
|||||||
strLstAddZ(argList, "--stanza=test1");
|
strLstAddZ(argList, "--stanza=test1");
|
||||||
strLstAdd(argList, strNewFmt("--repo1-path=%s", strZ(repoPath)));
|
strLstAdd(argList, strNewFmt("--repo1-path=%s", strZ(repoPath)));
|
||||||
strLstAdd(argList, strNewFmt("--pg1-path=%s", strZ(pgPath)));
|
strLstAdd(argList, strNewFmt("--pg1-path=%s", strZ(pgPath)));
|
||||||
harnessCfgLoad(cfgCmdRestore, argList);
|
HRN_CFG_LOAD(cfgCmdRestore, argList);
|
||||||
|
|
||||||
TEST_ERROR(restorePathValidate(), PathMissingError, "$PGDATA directory '" TEST_PATH "/pg' does not exist");
|
TEST_ERROR(restorePathValidate(), PathMissingError, "$PGDATA directory '" TEST_PATH "/pg' does not exist");
|
||||||
|
|
||||||
@ -365,7 +365,7 @@ testRun(void)
|
|||||||
strLstAdd(argList, strNewFmt("--repo1-path=%s", strZ(repoPath)));
|
strLstAdd(argList, strNewFmt("--repo1-path=%s", strZ(repoPath)));
|
||||||
strLstAdd(argList, strNewFmt("--pg1-path=%s", strZ(pgPath)));
|
strLstAdd(argList, strNewFmt("--pg1-path=%s", strZ(pgPath)));
|
||||||
strLstAddZ(argList, "--delta");
|
strLstAddZ(argList, "--delta");
|
||||||
harnessCfgLoad(cfgCmdRestore, argList);
|
HRN_CFG_LOAD(cfgCmdRestore, argList);
|
||||||
|
|
||||||
TEST_RESULT_VOID(restorePathValidate(), "restore --delta with invalid PGDATA");
|
TEST_RESULT_VOID(restorePathValidate(), "restore --delta with invalid PGDATA");
|
||||||
TEST_RESULT_BOOL(cfgOptionBool(cfgOptDelta), false, "--delta set to false");
|
TEST_RESULT_BOOL(cfgOptionBool(cfgOptDelta), false, "--delta set to false");
|
||||||
@ -374,7 +374,7 @@ testRun(void)
|
|||||||
" confirm that this is a valid $PGDATA directory. --delta and --force have been disabled and if any files"
|
" confirm that this is a valid $PGDATA directory. --delta and --force have been disabled and if any files"
|
||||||
" exist in the destination directories the restore will be aborted.");
|
" exist in the destination directories the restore will be aborted.");
|
||||||
|
|
||||||
harnessCfgLoad(cfgCmdRestore, argList);
|
HRN_CFG_LOAD(cfgCmdRestore, argList);
|
||||||
storagePutP(storageNewWriteP(storagePgWrite(), STRDEF("backup.manifest")), NULL);
|
storagePutP(storageNewWriteP(storagePgWrite(), STRDEF("backup.manifest")), NULL);
|
||||||
TEST_RESULT_VOID(restorePathValidate(), "restore --delta with valid PGDATA");
|
TEST_RESULT_VOID(restorePathValidate(), "restore --delta with valid PGDATA");
|
||||||
storageRemoveP(storagePgWrite(), STRDEF("backup.manifest"), .errorOnMissing = true);
|
storageRemoveP(storagePgWrite(), STRDEF("backup.manifest"), .errorOnMissing = true);
|
||||||
@ -384,7 +384,7 @@ testRun(void)
|
|||||||
strLstAddZ(argList, "--repo1-path=" TEST_PATH "/repo");
|
strLstAddZ(argList, "--repo1-path=" TEST_PATH "/repo");
|
||||||
strLstAddZ(argList, "--pg1-path=" TEST_PATH "/pg");
|
strLstAddZ(argList, "--pg1-path=" TEST_PATH "/pg");
|
||||||
strLstAddZ(argList, "--force");
|
strLstAddZ(argList, "--force");
|
||||||
harnessCfgLoad(cfgCmdRestore, argList);
|
HRN_CFG_LOAD(cfgCmdRestore, argList);
|
||||||
|
|
||||||
TEST_RESULT_VOID(restorePathValidate(), "restore --force with invalid PGDATA");
|
TEST_RESULT_VOID(restorePathValidate(), "restore --force with invalid PGDATA");
|
||||||
TEST_RESULT_BOOL(cfgOptionBool(cfgOptForce), false, "--force set to false");
|
TEST_RESULT_BOOL(cfgOptionBool(cfgOptForce), false, "--force set to false");
|
||||||
@ -393,7 +393,7 @@ testRun(void)
|
|||||||
" confirm that this is a valid $PGDATA directory. --delta and --force have been disabled and if any files"
|
" confirm that this is a valid $PGDATA directory. --delta and --force have been disabled and if any files"
|
||||||
" exist in the destination directories the restore will be aborted.");
|
" exist in the destination directories the restore will be aborted.");
|
||||||
|
|
||||||
harnessCfgLoad(cfgCmdRestore, argList);
|
HRN_CFG_LOAD(cfgCmdRestore, argList);
|
||||||
storagePutP(storageNewWriteP(storagePgWrite(), STRDEF(PG_FILE_PGVERSION)), NULL);
|
storagePutP(storageNewWriteP(storagePgWrite(), STRDEF(PG_FILE_PGVERSION)), NULL);
|
||||||
TEST_RESULT_VOID(restorePathValidate(), "restore --force with valid PGDATA");
|
TEST_RESULT_VOID(restorePathValidate(), "restore --force with valid PGDATA");
|
||||||
storageRemoveP(storagePgWrite(), STRDEF(PG_FILE_PGVERSION), .errorOnMissing = true);
|
storageRemoveP(storagePgWrite(), STRDEF(PG_FILE_PGVERSION), .errorOnMissing = true);
|
||||||
@ -447,7 +447,7 @@ testRun(void)
|
|||||||
strLstAddZ(argList, "--stanza=test1");
|
strLstAddZ(argList, "--stanza=test1");
|
||||||
strLstAdd(argList, strNewFmt("--repo1-path=%s", strZ(repoPath)));
|
strLstAdd(argList, strNewFmt("--repo1-path=%s", strZ(repoPath)));
|
||||||
strLstAdd(argList, strNewFmt("--pg1-path=%s", strZ(pgPath)));
|
strLstAdd(argList, strNewFmt("--pg1-path=%s", strZ(pgPath)));
|
||||||
harnessCfgLoad(cfgCmdRestore, argList);
|
HRN_CFG_LOAD(cfgCmdRestore, argList);
|
||||||
|
|
||||||
// -------------------------------------------------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------------------------------------------------
|
||||||
TEST_TITLE("error when no backups are present");
|
TEST_TITLE("error when no backups are present");
|
||||||
@ -470,7 +470,7 @@ testRun(void)
|
|||||||
strLstAdd(argList, strNewFmt("--repo1-path=%s", strZ(repoPath)));
|
strLstAdd(argList, strNewFmt("--repo1-path=%s", strZ(repoPath)));
|
||||||
strLstAdd(argList, strNewFmt("--pg1-path=%s", strZ(pgPath)));
|
strLstAdd(argList, strNewFmt("--pg1-path=%s", strZ(pgPath)));
|
||||||
strLstAddZ(argList, "--set=BOGUS");
|
strLstAddZ(argList, "--set=BOGUS");
|
||||||
harnessCfgLoad(cfgCmdRestore, argList);
|
HRN_CFG_LOAD(cfgCmdRestore, argList);
|
||||||
|
|
||||||
TEST_ERROR(restoreBackupSet(), BackupSetInvalidError, "backup set BOGUS is not valid");
|
TEST_ERROR(restoreBackupSet(), BackupSetInvalidError, "backup set BOGUS is not valid");
|
||||||
|
|
||||||
@ -488,7 +488,7 @@ testRun(void)
|
|||||||
strLstAddZ(argList, "--type=time");
|
strLstAddZ(argList, "--type=time");
|
||||||
strLstAddZ(argList, "--target=2016-12-19 16:28:04-0500");
|
strLstAddZ(argList, "--target=2016-12-19 16:28:04-0500");
|
||||||
|
|
||||||
harnessCfgLoad(cfgCmdRestore, argList);
|
HRN_CFG_LOAD(cfgCmdRestore, argList);
|
||||||
|
|
||||||
// Write out backup.info with no current backups to repo1
|
// Write out backup.info with no current backups to repo1
|
||||||
HRN_INFO_PUT(storageRepoIdxWrite(0), INFO_BACKUP_PATH_FILE, TEST_RESTORE_BACKUP_INFO_DB);
|
HRN_INFO_PUT(storageRepoIdxWrite(0), INFO_BACKUP_PATH_FILE, TEST_RESTORE_BACKUP_INFO_DB);
|
||||||
@ -508,7 +508,7 @@ testRun(void)
|
|||||||
strLstAddZ(argList, "--type=time");
|
strLstAddZ(argList, "--type=time");
|
||||||
strLstAddZ(argList, "--target=2016-12-19 16:28:04-0500");
|
strLstAddZ(argList, "--target=2016-12-19 16:28:04-0500");
|
||||||
|
|
||||||
harnessCfgLoad(cfgCmdRestore, argList);
|
HRN_CFG_LOAD(cfgCmdRestore, argList);
|
||||||
|
|
||||||
TEST_ASSIGN(backupData, restoreBackupSet(), "get backup set");
|
TEST_ASSIGN(backupData, restoreBackupSet(), "get backup set");
|
||||||
TEST_RESULT_STR_Z(backupData.backupSet, "20161219-212741F_20161219-212803D", "backup set found");
|
TEST_RESULT_STR_Z(backupData.backupSet, "20161219-212741F_20161219-212803D", "backup set found");
|
||||||
@ -525,7 +525,7 @@ testRun(void)
|
|||||||
hrnCfgArgRawZ(argList, cfgOptType, "time");
|
hrnCfgArgRawZ(argList, cfgOptType, "time");
|
||||||
hrnCfgArgRawZ(argList, cfgOptTarget, "2016-12-19 16:27:30-0500");
|
hrnCfgArgRawZ(argList, cfgOptTarget, "2016-12-19 16:27:30-0500");
|
||||||
|
|
||||||
harnessCfgLoad(cfgCmdRestore, argList);
|
HRN_CFG_LOAD(cfgCmdRestore, argList);
|
||||||
|
|
||||||
#define TEST_RESTORE_BACKUP_INFO_NEWEST \
|
#define TEST_RESTORE_BACKUP_INFO_NEWEST \
|
||||||
"[backup:current]\n" \
|
"[backup:current]\n" \
|
||||||
@ -553,7 +553,7 @@ testRun(void)
|
|||||||
|
|
||||||
// Request repo2 - latest from repo2 will be chosen
|
// Request repo2 - latest from repo2 will be chosen
|
||||||
hrnCfgArgRawZ(argList, cfgOptRepo, "2");
|
hrnCfgArgRawZ(argList, cfgOptRepo, "2");
|
||||||
harnessCfgLoad(cfgCmdRestore, argList);
|
HRN_CFG_LOAD(cfgCmdRestore, argList);
|
||||||
|
|
||||||
TEST_ASSIGN(backupData, restoreBackupSet(), "get backup set");
|
TEST_ASSIGN(backupData, restoreBackupSet(), "get backup set");
|
||||||
TEST_RESULT_STR_Z(backupData.backupSet, "20201212-201243F", "default to latest backup set");
|
TEST_RESULT_STR_Z(backupData.backupSet, "20201212-201243F", "default to latest backup set");
|
||||||
@ -571,7 +571,7 @@ testRun(void)
|
|||||||
hrnCfgArgRawZ(argList, cfgOptType, "time");
|
hrnCfgArgRawZ(argList, cfgOptType, "time");
|
||||||
hrnCfgArgRawZ(argList, cfgOptTarget, "2016-12-19 16:27:30-0500");
|
hrnCfgArgRawZ(argList, cfgOptTarget, "2016-12-19 16:27:30-0500");
|
||||||
|
|
||||||
harnessCfgLoad(cfgCmdRestore, argList);
|
HRN_CFG_LOAD(cfgCmdRestore, argList);
|
||||||
|
|
||||||
TEST_ASSIGN(backupData, restoreBackupSet(), "get backup set");
|
TEST_ASSIGN(backupData, restoreBackupSet(), "get backup set");
|
||||||
TEST_RESULT_STR_Z(backupData.backupSet, "20201212-201243F", "default to latest backup set");
|
TEST_RESULT_STR_Z(backupData.backupSet, "20201212-201243F", "default to latest backup set");
|
||||||
@ -588,7 +588,7 @@ testRun(void)
|
|||||||
hrnCfgArgRawZ(argList, cfgOptType, "time");
|
hrnCfgArgRawZ(argList, cfgOptType, "time");
|
||||||
hrnCfgArgRawZ(argList, cfgOptTarget, "Tue, 15 Nov 1994 12:45:26");
|
hrnCfgArgRawZ(argList, cfgOptTarget, "Tue, 15 Nov 1994 12:45:26");
|
||||||
|
|
||||||
harnessCfgLoad(cfgCmdRestore, argList);
|
HRN_CFG_LOAD(cfgCmdRestore, argList);
|
||||||
|
|
||||||
TEST_ASSIGN(backupData, restoreBackupSet(), "get backup set");
|
TEST_ASSIGN(backupData, restoreBackupSet(), "get backup set");
|
||||||
TEST_RESULT_STR_Z(backupData.backupSet, "20161219-212741F_20161219-212918I", "time invalid format, default latest");
|
TEST_RESULT_STR_Z(backupData.backupSet, "20161219-212741F_20161219-212918I", "time invalid format, default latest");
|
||||||
@ -610,7 +610,7 @@ testRun(void)
|
|||||||
hrnCfgArgRawZ(argList, cfgOptType, "time");
|
hrnCfgArgRawZ(argList, cfgOptType, "time");
|
||||||
hrnCfgArgRawZ(argList, cfgOptTarget, "2016-12-19 16:27:30-0500");
|
hrnCfgArgRawZ(argList, cfgOptTarget, "2016-12-19 16:27:30-0500");
|
||||||
|
|
||||||
harnessCfgLoad(cfgCmdRestore, argList);
|
HRN_CFG_LOAD(cfgCmdRestore, argList);
|
||||||
|
|
||||||
// Write out backup.info with no current backups to repo1 and repo2
|
// Write out backup.info with no current backups to repo1 and repo2
|
||||||
HRN_INFO_PUT(storageRepoIdxWrite(0), INFO_BACKUP_PATH_FILE, TEST_RESTORE_BACKUP_INFO_DB);
|
HRN_INFO_PUT(storageRepoIdxWrite(0), INFO_BACKUP_PATH_FILE, TEST_RESTORE_BACKUP_INFO_DB);
|
||||||
@ -650,7 +650,7 @@ testRun(void)
|
|||||||
strLstAddZ(argList, "--stanza=test1");
|
strLstAddZ(argList, "--stanza=test1");
|
||||||
strLstAdd(argList, strNewFmt("--repo1-path=%s", strZ(repoPath)));
|
strLstAdd(argList, strNewFmt("--repo1-path=%s", strZ(repoPath)));
|
||||||
strLstAdd(argList, strNewFmt("--pg1-path=%s", strZ(pgPath)));
|
strLstAdd(argList, strNewFmt("--pg1-path=%s", strZ(pgPath)));
|
||||||
harnessCfgLoad(cfgCmdRestore, argList);
|
HRN_CFG_LOAD(cfgCmdRestore, argList);
|
||||||
|
|
||||||
TEST_RESULT_VOID(restoreManifestMap(manifest), "base directory is not remapped");
|
TEST_RESULT_VOID(restoreManifestMap(manifest), "base directory is not remapped");
|
||||||
TEST_RESULT_STR(manifestTargetFind(manifest, MANIFEST_TARGET_PGDATA_STR)->path, pgPath, "base directory is not remapped");
|
TEST_RESULT_STR(manifestTargetFind(manifest, MANIFEST_TARGET_PGDATA_STR)->path, pgPath, "base directory is not remapped");
|
||||||
@ -662,7 +662,7 @@ testRun(void)
|
|||||||
strLstAddZ(argList, "--stanza=test1");
|
strLstAddZ(argList, "--stanza=test1");
|
||||||
strLstAdd(argList, strNewFmt("--repo1-path=%s", strZ(repoPath)));
|
strLstAdd(argList, strNewFmt("--repo1-path=%s", strZ(repoPath)));
|
||||||
strLstAdd(argList, strNewFmt("--pg1-path=%s", strZ(pgPath)));
|
strLstAdd(argList, strNewFmt("--pg1-path=%s", strZ(pgPath)));
|
||||||
harnessCfgLoad(cfgCmdRestore, argList);
|
HRN_CFG_LOAD(cfgCmdRestore, argList);
|
||||||
|
|
||||||
TEST_RESULT_VOID(restoreManifestMap(manifest), "base directory is remapped");
|
TEST_RESULT_VOID(restoreManifestMap(manifest), "base directory is remapped");
|
||||||
TEST_RESULT_STR(manifestTargetFind(manifest, MANIFEST_TARGET_PGDATA_STR)->path, pgPath, "base directory is remapped");
|
TEST_RESULT_STR(manifestTargetFind(manifest, MANIFEST_TARGET_PGDATA_STR)->path, pgPath, "base directory is remapped");
|
||||||
@ -676,7 +676,7 @@ testRun(void)
|
|||||||
strLstAdd(argList, strNewFmt("--repo1-path=%s", strZ(repoPath)));
|
strLstAdd(argList, strNewFmt("--repo1-path=%s", strZ(repoPath)));
|
||||||
strLstAdd(argList, strNewFmt("--pg1-path=%s", strZ(pgPath)));
|
strLstAdd(argList, strNewFmt("--pg1-path=%s", strZ(pgPath)));
|
||||||
strLstAddZ(argList, "--tablespace-map=bogus=/bogus");
|
strLstAddZ(argList, "--tablespace-map=bogus=/bogus");
|
||||||
harnessCfgLoad(cfgCmdRestore, argList);
|
HRN_CFG_LOAD(cfgCmdRestore, argList);
|
||||||
|
|
||||||
TEST_ERROR(restoreManifestMap(manifest), TablespaceMapError, "unable to remap invalid tablespace 'bogus'");
|
TEST_ERROR(restoreManifestMap(manifest), TablespaceMapError, "unable to remap invalid tablespace 'bogus'");
|
||||||
|
|
||||||
@ -701,7 +701,7 @@ testRun(void)
|
|||||||
strLstAdd(argList, strNewFmt("--pg1-path=%s", strZ(pgPath)));
|
strLstAdd(argList, strNewFmt("--pg1-path=%s", strZ(pgPath)));
|
||||||
strLstAddZ(argList, "--tablespace-map=2=/2");
|
strLstAddZ(argList, "--tablespace-map=2=/2");
|
||||||
strLstAddZ(argList, "--tablespace-map=ts2=/ts2");
|
strLstAddZ(argList, "--tablespace-map=ts2=/ts2");
|
||||||
harnessCfgLoad(cfgCmdRestore, argList);
|
HRN_CFG_LOAD(cfgCmdRestore, argList);
|
||||||
|
|
||||||
TEST_ERROR(
|
TEST_ERROR(
|
||||||
restoreManifestMap(manifest), TablespaceMapError, "tablespace remapped by name 'ts2' and id 2 with different paths");
|
restoreManifestMap(manifest), TablespaceMapError, "tablespace remapped by name 'ts2' and id 2 with different paths");
|
||||||
@ -713,7 +713,7 @@ testRun(void)
|
|||||||
strLstAdd(argList, strNewFmt("--pg1-path=%s", strZ(pgPath)));
|
strLstAdd(argList, strNewFmt("--pg1-path=%s", strZ(pgPath)));
|
||||||
strLstAddZ(argList, "--tablespace-map=1=/1-2");
|
strLstAddZ(argList, "--tablespace-map=1=/1-2");
|
||||||
strLstAddZ(argList, "--tablespace-map=ts2=/2-2");
|
strLstAddZ(argList, "--tablespace-map=ts2=/2-2");
|
||||||
harnessCfgLoad(cfgCmdRestore, argList);
|
HRN_CFG_LOAD(cfgCmdRestore, argList);
|
||||||
|
|
||||||
TEST_RESULT_VOID(restoreManifestMap(manifest), "remap tablespaces");
|
TEST_RESULT_VOID(restoreManifestMap(manifest), "remap tablespaces");
|
||||||
TEST_RESULT_STR_Z(manifestTargetFind(manifest, STRDEF("pg_tblspc/1"))->path, "/1-2", " check tablespace 1 target");
|
TEST_RESULT_STR_Z(manifestTargetFind(manifest, STRDEF("pg_tblspc/1"))->path, "/1-2", " check tablespace 1 target");
|
||||||
@ -734,7 +734,7 @@ testRun(void)
|
|||||||
strLstAdd(argList, strNewFmt("--pg1-path=%s", strZ(pgPath)));
|
strLstAdd(argList, strNewFmt("--pg1-path=%s", strZ(pgPath)));
|
||||||
strLstAddZ(argList, "--tablespace-map=2=/2-3");
|
strLstAddZ(argList, "--tablespace-map=2=/2-3");
|
||||||
strLstAddZ(argList, "--tablespace-map-all=/all");
|
strLstAddZ(argList, "--tablespace-map-all=/all");
|
||||||
harnessCfgLoad(cfgCmdRestore, argList);
|
HRN_CFG_LOAD(cfgCmdRestore, argList);
|
||||||
|
|
||||||
TEST_RESULT_VOID(restoreManifestMap(manifest), "remap tablespaces");
|
TEST_RESULT_VOID(restoreManifestMap(manifest), "remap tablespaces");
|
||||||
TEST_RESULT_STR_Z(manifestTargetFind(manifest, STRDEF("pg_tblspc/1"))->path, "/all/1", " check tablespace 1 target");
|
TEST_RESULT_STR_Z(manifestTargetFind(manifest, STRDEF("pg_tblspc/1"))->path, "/all/1", " check tablespace 1 target");
|
||||||
@ -756,7 +756,7 @@ testRun(void)
|
|||||||
strLstAdd(argList, strNewFmt("--repo1-path=%s", strZ(repoPath)));
|
strLstAdd(argList, strNewFmt("--repo1-path=%s", strZ(repoPath)));
|
||||||
strLstAdd(argList, strNewFmt("--pg1-path=%s", strZ(pgPath)));
|
strLstAdd(argList, strNewFmt("--pg1-path=%s", strZ(pgPath)));
|
||||||
strLstAddZ(argList, "--tablespace-map-all=/all2");
|
strLstAddZ(argList, "--tablespace-map-all=/all2");
|
||||||
harnessCfgLoad(cfgCmdRestore, argList);
|
HRN_CFG_LOAD(cfgCmdRestore, argList);
|
||||||
|
|
||||||
TEST_RESULT_VOID(restoreManifestMap(manifest), "remap tablespaces");
|
TEST_RESULT_VOID(restoreManifestMap(manifest), "remap tablespaces");
|
||||||
TEST_RESULT_STR_Z(manifestTargetFind(manifest, STRDEF("pg_tblspc/1"))->path, "/all2/1", " check tablespace 1 target");
|
TEST_RESULT_STR_Z(manifestTargetFind(manifest, STRDEF("pg_tblspc/1"))->path, "/all2/1", " check tablespace 1 target");
|
||||||
@ -779,7 +779,7 @@ testRun(void)
|
|||||||
strLstAdd(argList, strNewFmt("--repo1-path=%s", strZ(repoPath)));
|
strLstAdd(argList, strNewFmt("--repo1-path=%s", strZ(repoPath)));
|
||||||
strLstAdd(argList, strNewFmt("--pg1-path=%s", strZ(pgPath)));
|
strLstAdd(argList, strNewFmt("--pg1-path=%s", strZ(pgPath)));
|
||||||
strLstAddZ(argList, "--link-map=bogus=bogus");
|
strLstAddZ(argList, "--link-map=bogus=bogus");
|
||||||
harnessCfgLoad(cfgCmdRestore, argList);
|
HRN_CFG_LOAD(cfgCmdRestore, argList);
|
||||||
|
|
||||||
TEST_ERROR(restoreManifestMap(manifest), LinkMapError, "unable to remap invalid link 'bogus'");
|
TEST_ERROR(restoreManifestMap(manifest), LinkMapError, "unable to remap invalid link 'bogus'");
|
||||||
|
|
||||||
@ -801,7 +801,7 @@ testRun(void)
|
|||||||
strLstAdd(argList, strNewFmt("--repo1-path=%s", strZ(repoPath)));
|
strLstAdd(argList, strNewFmt("--repo1-path=%s", strZ(repoPath)));
|
||||||
strLstAdd(argList, strNewFmt("--pg1-path=%s", strZ(pgPath)));
|
strLstAdd(argList, strNewFmt("--pg1-path=%s", strZ(pgPath)));
|
||||||
strLstAddZ(argList, "--link-map=pg_hba.conf=bogus");
|
strLstAddZ(argList, "--link-map=pg_hba.conf=bogus");
|
||||||
harnessCfgLoad(cfgCmdRestore, argList);
|
HRN_CFG_LOAD(cfgCmdRestore, argList);
|
||||||
|
|
||||||
TEST_ERROR(
|
TEST_ERROR(
|
||||||
restoreManifestMap(manifest), LinkMapError,
|
restoreManifestMap(manifest), LinkMapError,
|
||||||
@ -816,7 +816,7 @@ testRun(void)
|
|||||||
strLstAdd(argList, strNewFmt("--pg1-path=%s", strZ(pgPath)));
|
strLstAdd(argList, strNewFmt("--pg1-path=%s", strZ(pgPath)));
|
||||||
strLstAddZ(argList, "--link-map=pg_hba.conf=../conf2/pg_hba2.conf");
|
strLstAddZ(argList, "--link-map=pg_hba.conf=../conf2/pg_hba2.conf");
|
||||||
strLstAddZ(argList, "--link-map=pg_wal=/wal2");
|
strLstAddZ(argList, "--link-map=pg_wal=/wal2");
|
||||||
harnessCfgLoad(cfgCmdRestore, argList);
|
HRN_CFG_LOAD(cfgCmdRestore, argList);
|
||||||
|
|
||||||
TEST_RESULT_VOID(restoreManifestMap(manifest), "remap links");
|
TEST_RESULT_VOID(restoreManifestMap(manifest), "remap links");
|
||||||
TEST_RESULT_STR_Z(manifestTargetFind(manifest, STRDEF("pg_data/pg_hba.conf"))->path, "../conf2", " check link path");
|
TEST_RESULT_STR_Z(manifestTargetFind(manifest, STRDEF("pg_data/pg_hba.conf"))->path, "../conf2", " check link path");
|
||||||
@ -837,7 +837,7 @@ testRun(void)
|
|||||||
strLstAdd(argList, strNewFmt("--repo1-path=%s", strZ(repoPath)));
|
strLstAdd(argList, strNewFmt("--repo1-path=%s", strZ(repoPath)));
|
||||||
strLstAdd(argList, strNewFmt("--pg1-path=%s", strZ(pgPath)));
|
strLstAdd(argList, strNewFmt("--pg1-path=%s", strZ(pgPath)));
|
||||||
strLstAddZ(argList, "--link-all");
|
strLstAddZ(argList, "--link-all");
|
||||||
harnessCfgLoad(cfgCmdRestore, argList);
|
HRN_CFG_LOAD(cfgCmdRestore, argList);
|
||||||
|
|
||||||
TEST_RESULT_VOID(restoreManifestMap(manifest), "leave links as they are");
|
TEST_RESULT_VOID(restoreManifestMap(manifest), "leave links as they are");
|
||||||
TEST_RESULT_STR_Z(manifestTargetFind(manifest, STRDEF("pg_data/pg_hba.conf"))->path, "../conf2", " check link path");
|
TEST_RESULT_STR_Z(manifestTargetFind(manifest, STRDEF("pg_data/pg_hba.conf"))->path, "../conf2", " check link path");
|
||||||
@ -853,7 +853,7 @@ testRun(void)
|
|||||||
strLstAddZ(argList, "--stanza=test1");
|
strLstAddZ(argList, "--stanza=test1");
|
||||||
strLstAdd(argList, strNewFmt("--repo1-path=%s", strZ(repoPath)));
|
strLstAdd(argList, strNewFmt("--repo1-path=%s", strZ(repoPath)));
|
||||||
strLstAdd(argList, strNewFmt("--pg1-path=%s", strZ(pgPath)));
|
strLstAdd(argList, strNewFmt("--pg1-path=%s", strZ(pgPath)));
|
||||||
harnessCfgLoad(cfgCmdRestore, argList);
|
HRN_CFG_LOAD(cfgCmdRestore, argList);
|
||||||
|
|
||||||
TEST_RESULT_VOID(restoreManifestMap(manifest), "remove all links");
|
TEST_RESULT_VOID(restoreManifestMap(manifest), "remove all links");
|
||||||
TEST_ERROR(
|
TEST_ERROR(
|
||||||
@ -931,7 +931,7 @@ testRun(void)
|
|||||||
strLstAddZ(argList, "--stanza=test1");
|
strLstAddZ(argList, "--stanza=test1");
|
||||||
strLstAddZ(argList, "--repo1-path=/repo");
|
strLstAddZ(argList, "--repo1-path=/repo");
|
||||||
strLstAdd(argList, strNewFmt("--pg1-path=%s", strZ(pgPath)));
|
strLstAdd(argList, strNewFmt("--pg1-path=%s", strZ(pgPath)));
|
||||||
harnessCfgLoad(cfgCmdRestore, argList);
|
HRN_CFG_LOAD(cfgCmdRestore, argList);
|
||||||
|
|
||||||
manifest = testManifestMinimal(STRDEF("20161219-212741F_20161219-21275D"), PG_VERSION_96, pgPath);
|
manifest = testManifestMinimal(STRDEF("20161219-212741F_20161219-21275D"), PG_VERSION_96, pgPath);
|
||||||
userLocalData.userRoot = true;
|
userLocalData.userRoot = true;
|
||||||
@ -1020,7 +1020,7 @@ testRun(void)
|
|||||||
strLstAddZ(argList, "--stanza=test1");
|
strLstAddZ(argList, "--stanza=test1");
|
||||||
strLstAdd(argList, strNewFmt("--repo1-path=%s", strZ(repoPath)));
|
strLstAdd(argList, strNewFmt("--repo1-path=%s", strZ(repoPath)));
|
||||||
strLstAdd(argList, strNewFmt("--pg1-path=%s", strZ(pgPath)));
|
strLstAdd(argList, strNewFmt("--pg1-path=%s", strZ(pgPath)));
|
||||||
harnessCfgLoad(cfgCmdRestore, argList);
|
HRN_CFG_LOAD(cfgCmdRestore, argList);
|
||||||
|
|
||||||
storagePathCreateP(storagePgWrite(), NULL, .mode = 0600);
|
storagePathCreateP(storagePgWrite(), NULL, .mode = 0600);
|
||||||
|
|
||||||
@ -1108,7 +1108,7 @@ testRun(void)
|
|||||||
strLstAdd(argList, strNewFmt("--repo1-path=%s", strZ(repoPath)));
|
strLstAdd(argList, strNewFmt("--repo1-path=%s", strZ(repoPath)));
|
||||||
strLstAdd(argList, strNewFmt("--pg1-path=%s", strZ(pgPath)));
|
strLstAdd(argList, strNewFmt("--pg1-path=%s", strZ(pgPath)));
|
||||||
strLstAddZ(argList, "--type=preserve");
|
strLstAddZ(argList, "--type=preserve");
|
||||||
harnessCfgLoad(cfgCmdRestore, argList);
|
HRN_CFG_LOAD(cfgCmdRestore, argList);
|
||||||
|
|
||||||
TEST_RESULT_VOID(restoreCleanBuild(manifest), "restore");
|
TEST_RESULT_VOID(restoreCleanBuild(manifest), "restore");
|
||||||
|
|
||||||
@ -1169,7 +1169,7 @@ testRun(void)
|
|||||||
strLstAddZ(argList, "--stanza=test1");
|
strLstAddZ(argList, "--stanza=test1");
|
||||||
strLstAdd(argList, strNewFmt("--repo1-path=%s", strZ(repoPath)));
|
strLstAdd(argList, strNewFmt("--repo1-path=%s", strZ(repoPath)));
|
||||||
strLstAdd(argList, strNewFmt("--pg1-path=%s", strZ(pgPath)));
|
strLstAdd(argList, strNewFmt("--pg1-path=%s", strZ(pgPath)));
|
||||||
harnessCfgLoad(cfgCmdRestore, argList);
|
HRN_CFG_LOAD(cfgCmdRestore, argList);
|
||||||
|
|
||||||
TEST_RESULT_VOID(restoreCleanBuild(manifest), "restore");
|
TEST_RESULT_VOID(restoreCleanBuild(manifest), "restore");
|
||||||
|
|
||||||
@ -1195,7 +1195,7 @@ testRun(void)
|
|||||||
|
|
||||||
StringList *argList = strLstDup(argListClean);
|
StringList *argList = strLstDup(argListClean);
|
||||||
strLstAddZ(argList, "--db-include=" UTF8_DB_NAME);
|
strLstAddZ(argList, "--db-include=" UTF8_DB_NAME);
|
||||||
harnessCfgLoad(cfgCmdRestore, argList);
|
HRN_CFG_LOAD(cfgCmdRestore, argList);
|
||||||
|
|
||||||
Manifest *manifest = NULL;
|
Manifest *manifest = NULL;
|
||||||
|
|
||||||
@ -1243,7 +1243,7 @@ testRun(void)
|
|||||||
|
|
||||||
argList = strLstDup(argListClean);
|
argList = strLstDup(argListClean);
|
||||||
strLstAddZ(argList, "--db-exclude=" UTF8_DB_NAME);
|
strLstAddZ(argList, "--db-exclude=" UTF8_DB_NAME);
|
||||||
harnessCfgLoad(cfgCmdRestore, argList);
|
HRN_CFG_LOAD(cfgCmdRestore, argList);
|
||||||
|
|
||||||
TEST_ERROR(restoreSelectiveExpression(manifest), DbMissingError, "database to exclude '" UTF8_DB_NAME "' does not exist");
|
TEST_ERROR(restoreSelectiveExpression(manifest), DbMissingError, "database to exclude '" UTF8_DB_NAME "' does not exist");
|
||||||
|
|
||||||
@ -1261,7 +1261,7 @@ testRun(void)
|
|||||||
|
|
||||||
argList = strLstDup(argListClean);
|
argList = strLstDup(argListClean);
|
||||||
strLstAddZ(argList, "--db-include=" UTF8_DB_NAME);
|
strLstAddZ(argList, "--db-include=" UTF8_DB_NAME);
|
||||||
harnessCfgLoad(cfgCmdRestore, argList);
|
HRN_CFG_LOAD(cfgCmdRestore, argList);
|
||||||
|
|
||||||
TEST_RESULT_STR(restoreSelectiveExpression(manifest), NULL, "all databases selected");
|
TEST_RESULT_STR(restoreSelectiveExpression(manifest), NULL, "all databases selected");
|
||||||
|
|
||||||
@ -1274,7 +1274,7 @@ testRun(void)
|
|||||||
|
|
||||||
argList = strLstDup(argListClean);
|
argList = strLstDup(argListClean);
|
||||||
strLstAddZ(argList, "--db-include=1");
|
strLstAddZ(argList, "--db-include=1");
|
||||||
harnessCfgLoad(cfgCmdRestore, argList);
|
HRN_CFG_LOAD(cfgCmdRestore, argList);
|
||||||
|
|
||||||
TEST_ERROR(
|
TEST_ERROR(
|
||||||
restoreSelectiveExpression(manifest), DbInvalidError,
|
restoreSelectiveExpression(manifest), DbInvalidError,
|
||||||
@ -1287,7 +1287,7 @@ testRun(void)
|
|||||||
|
|
||||||
argList = strLstDup(argListClean);
|
argList = strLstDup(argListClean);
|
||||||
strLstAddZ(argList, "--db-include=16385");
|
strLstAddZ(argList, "--db-include=16385");
|
||||||
harnessCfgLoad(cfgCmdRestore, argList);
|
HRN_CFG_LOAD(cfgCmdRestore, argList);
|
||||||
|
|
||||||
TEST_ERROR(
|
TEST_ERROR(
|
||||||
restoreSelectiveExpression(manifest), DbInvalidError,
|
restoreSelectiveExpression(manifest), DbInvalidError,
|
||||||
@ -1300,7 +1300,7 @@ testRun(void)
|
|||||||
|
|
||||||
argList = strLstDup(argListClean);
|
argList = strLstDup(argListClean);
|
||||||
strLstAddZ(argList, "--db-include=postgres");
|
strLstAddZ(argList, "--db-include=postgres");
|
||||||
harnessCfgLoad(cfgCmdRestore, argList);
|
HRN_CFG_LOAD(cfgCmdRestore, argList);
|
||||||
|
|
||||||
TEST_ERROR(
|
TEST_ERROR(
|
||||||
restoreSelectiveExpression(manifest), DbInvalidError,
|
restoreSelectiveExpression(manifest), DbInvalidError,
|
||||||
@ -1313,7 +1313,7 @@ testRun(void)
|
|||||||
|
|
||||||
argList = strLstDup(argListClean);
|
argList = strLstDup(argListClean);
|
||||||
strLstAddZ(argList, "--db-include=7777777");
|
strLstAddZ(argList, "--db-include=7777777");
|
||||||
harnessCfgLoad(cfgCmdRestore, argList);
|
HRN_CFG_LOAD(cfgCmdRestore, argList);
|
||||||
|
|
||||||
TEST_ERROR(restoreSelectiveExpression(manifest), DbMissingError, "database to include '7777777' does not exist");
|
TEST_ERROR(restoreSelectiveExpression(manifest), DbMissingError, "database to include '7777777' does not exist");
|
||||||
|
|
||||||
@ -1332,7 +1332,7 @@ testRun(void)
|
|||||||
|
|
||||||
argList = strLstDup(argListClean);
|
argList = strLstDup(argListClean);
|
||||||
strLstAddZ(argList, "--db-include=16384");
|
strLstAddZ(argList, "--db-include=16384");
|
||||||
harnessCfgLoad(cfgCmdRestore, argList);
|
HRN_CFG_LOAD(cfgCmdRestore, argList);
|
||||||
|
|
||||||
TEST_RESULT_STR_Z(restoreSelectiveExpression(manifest), "(^pg_data/base/32768/)", "check expression");
|
TEST_RESULT_STR_Z(restoreSelectiveExpression(manifest), "(^pg_data/base/32768/)", "check expression");
|
||||||
|
|
||||||
@ -1391,7 +1391,7 @@ testRun(void)
|
|||||||
|
|
||||||
argList = strLstDup(argListClean);
|
argList = strLstDup(argListClean);
|
||||||
strLstAddZ(argList, "--db-exclude=16384");
|
strLstAddZ(argList, "--db-exclude=16384");
|
||||||
harnessCfgLoad(cfgCmdRestore, argList);
|
HRN_CFG_LOAD(cfgCmdRestore, argList);
|
||||||
|
|
||||||
TEST_RESULT_STR_Z(
|
TEST_RESULT_STR_Z(
|
||||||
restoreSelectiveExpression(manifest),
|
restoreSelectiveExpression(manifest),
|
||||||
@ -1407,7 +1407,7 @@ testRun(void)
|
|||||||
|
|
||||||
argList = strLstDup(argListClean);
|
argList = strLstDup(argListClean);
|
||||||
strLstAddZ(argList, "--db-exclude=" UTF8_DB_NAME);
|
strLstAddZ(argList, "--db-exclude=" UTF8_DB_NAME);
|
||||||
harnessCfgLoad(cfgCmdRestore, argList);
|
HRN_CFG_LOAD(cfgCmdRestore, argList);
|
||||||
|
|
||||||
TEST_RESULT_STR_Z(
|
TEST_RESULT_STR_Z(
|
||||||
restoreSelectiveExpression(manifest),
|
restoreSelectiveExpression(manifest),
|
||||||
@ -1423,7 +1423,7 @@ testRun(void)
|
|||||||
|
|
||||||
argList = strLstDup(argListClean);
|
argList = strLstDup(argListClean);
|
||||||
strLstAddZ(argList, "--db-exclude=16385");
|
strLstAddZ(argList, "--db-exclude=16385");
|
||||||
harnessCfgLoad(cfgCmdRestore, argList);
|
HRN_CFG_LOAD(cfgCmdRestore, argList);
|
||||||
|
|
||||||
TEST_RESULT_STR_Z(
|
TEST_RESULT_STR_Z(
|
||||||
restoreSelectiveExpression(manifest),
|
restoreSelectiveExpression(manifest),
|
||||||
@ -1439,7 +1439,7 @@ testRun(void)
|
|||||||
|
|
||||||
argList = strLstDup(argListClean);
|
argList = strLstDup(argListClean);
|
||||||
strLstAddZ(argList, "--db-exclude=7777777");
|
strLstAddZ(argList, "--db-exclude=7777777");
|
||||||
harnessCfgLoad(cfgCmdRestore, argList);
|
HRN_CFG_LOAD(cfgCmdRestore, argList);
|
||||||
|
|
||||||
TEST_ERROR(restoreSelectiveExpression(manifest), DbMissingError, "database to exclude '7777777' does not exist");
|
TEST_ERROR(restoreSelectiveExpression(manifest), DbMissingError, "database to exclude '7777777' does not exist");
|
||||||
|
|
||||||
@ -1451,7 +1451,7 @@ testRun(void)
|
|||||||
argList = strLstDup(argListClean);
|
argList = strLstDup(argListClean);
|
||||||
strLstAddZ(argList, "--db-include=test2");
|
strLstAddZ(argList, "--db-include=test2");
|
||||||
strLstAddZ(argList, "--db-exclude=test2");
|
strLstAddZ(argList, "--db-exclude=test2");
|
||||||
harnessCfgLoad(cfgCmdRestore, argList);
|
HRN_CFG_LOAD(cfgCmdRestore, argList);
|
||||||
|
|
||||||
TEST_ERROR(restoreSelectiveExpression(manifest), DbInvalidError, "database to include '32768' is in the exclude list");
|
TEST_ERROR(restoreSelectiveExpression(manifest), DbInvalidError, "database to include '32768' is in the exclude list");
|
||||||
|
|
||||||
@ -1465,7 +1465,7 @@ testRun(void)
|
|||||||
strLstAddZ(argList, "--db-exclude=1");
|
strLstAddZ(argList, "--db-exclude=1");
|
||||||
strLstAddZ(argList, "--db-exclude=16385");
|
strLstAddZ(argList, "--db-exclude=16385");
|
||||||
strLstAddZ(argList, "--db-exclude=32768"); // user databases excluded will be silently ignored
|
strLstAddZ(argList, "--db-exclude=32768"); // user databases excluded will be silently ignored
|
||||||
harnessCfgLoad(cfgCmdRestore, argList);
|
HRN_CFG_LOAD(cfgCmdRestore, argList);
|
||||||
|
|
||||||
TEST_RESULT_STR_Z(
|
TEST_RESULT_STR_Z(
|
||||||
restoreSelectiveExpression(manifest),
|
restoreSelectiveExpression(manifest),
|
||||||
@ -1497,7 +1497,7 @@ testRun(void)
|
|||||||
StringList *argList = strLstDup(argBaseList);
|
StringList *argList = strLstDup(argBaseList);
|
||||||
strLstAddZ(argList, "--recovery-option=a-setting=a");
|
strLstAddZ(argList, "--recovery-option=a-setting=a");
|
||||||
strLstAddZ(argList, "--recovery-option=b_setting=b");
|
strLstAddZ(argList, "--recovery-option=b_setting=b");
|
||||||
harnessCfgLoad(cfgCmdRestore, argList);
|
HRN_CFG_LOAD(cfgCmdRestore, argList);
|
||||||
|
|
||||||
TEST_RESULT_STR_Z(
|
TEST_RESULT_STR_Z(
|
||||||
restoreRecoveryConf(PG_VERSION_94, restoreLabel),
|
restoreRecoveryConf(PG_VERSION_94, restoreLabel),
|
||||||
@ -1513,7 +1513,7 @@ testRun(void)
|
|||||||
|
|
||||||
strLstAddZ(argBaseList, "--recovery-option=restore-command=my_restore_command");
|
strLstAddZ(argBaseList, "--recovery-option=restore-command=my_restore_command");
|
||||||
argList = strLstDup(argBaseList);
|
argList = strLstDup(argBaseList);
|
||||||
harnessCfgLoad(cfgCmdRestore, argList);
|
HRN_CFG_LOAD(cfgCmdRestore, argList);
|
||||||
|
|
||||||
TEST_RESULT_STR_Z(
|
TEST_RESULT_STR_Z(
|
||||||
restoreRecoveryConf(PG_VERSION_94, restoreLabel),
|
restoreRecoveryConf(PG_VERSION_94, restoreLabel),
|
||||||
@ -1526,7 +1526,7 @@ testRun(void)
|
|||||||
|
|
||||||
argList = strLstDup(argBaseList);
|
argList = strLstDup(argBaseList);
|
||||||
strLstAddZ(argList, "--type=immediate");
|
strLstAddZ(argList, "--type=immediate");
|
||||||
harnessCfgLoad(cfgCmdRestore, argList);
|
HRN_CFG_LOAD(cfgCmdRestore, argList);
|
||||||
|
|
||||||
TEST_RESULT_STR_Z(
|
TEST_RESULT_STR_Z(
|
||||||
restoreRecoveryConf(PG_VERSION_94, restoreLabel),
|
restoreRecoveryConf(PG_VERSION_94, restoreLabel),
|
||||||
@ -1542,7 +1542,7 @@ testRun(void)
|
|||||||
strLstAddZ(argList, "--type=time");
|
strLstAddZ(argList, "--type=time");
|
||||||
strLstAddZ(argList, "--target=TIME");
|
strLstAddZ(argList, "--target=TIME");
|
||||||
strLstAddZ(argList, "--target-timeline=3");
|
strLstAddZ(argList, "--target-timeline=3");
|
||||||
harnessCfgLoad(cfgCmdRestore, argList);
|
HRN_CFG_LOAD(cfgCmdRestore, argList);
|
||||||
|
|
||||||
TEST_RESULT_STR_Z(
|
TEST_RESULT_STR_Z(
|
||||||
restoreRecoveryConf(PG_VERSION_94, restoreLabel),
|
restoreRecoveryConf(PG_VERSION_94, restoreLabel),
|
||||||
@ -1559,7 +1559,7 @@ testRun(void)
|
|||||||
strLstAddZ(argList, "--type=time");
|
strLstAddZ(argList, "--type=time");
|
||||||
strLstAddZ(argList, "--target=TIME");
|
strLstAddZ(argList, "--target=TIME");
|
||||||
strLstAddZ(argList, "--target-exclusive");
|
strLstAddZ(argList, "--target-exclusive");
|
||||||
harnessCfgLoad(cfgCmdRestore, argList);
|
HRN_CFG_LOAD(cfgCmdRestore, argList);
|
||||||
|
|
||||||
TEST_RESULT_STR_Z(
|
TEST_RESULT_STR_Z(
|
||||||
restoreRecoveryConf(PG_VERSION_94, restoreLabel),
|
restoreRecoveryConf(PG_VERSION_94, restoreLabel),
|
||||||
@ -1575,7 +1575,7 @@ testRun(void)
|
|||||||
argList = strLstDup(argBaseList);
|
argList = strLstDup(argBaseList);
|
||||||
strLstAddZ(argList, "--type=name");
|
strLstAddZ(argList, "--type=name");
|
||||||
strLstAddZ(argList, "--target=NAME");
|
strLstAddZ(argList, "--target=NAME");
|
||||||
harnessCfgLoad(cfgCmdRestore, argList);
|
HRN_CFG_LOAD(cfgCmdRestore, argList);
|
||||||
|
|
||||||
TEST_RESULT_STR_Z(
|
TEST_RESULT_STR_Z(
|
||||||
restoreRecoveryConf(PG_VERSION_94, restoreLabel),
|
restoreRecoveryConf(PG_VERSION_94, restoreLabel),
|
||||||
@ -1590,7 +1590,7 @@ testRun(void)
|
|||||||
argList = strLstDup(argBaseList);
|
argList = strLstDup(argBaseList);
|
||||||
strLstAddZ(argList, "--type=immediate");
|
strLstAddZ(argList, "--type=immediate");
|
||||||
strLstAddZ(argList, "--target-action=shutdown");
|
strLstAddZ(argList, "--target-action=shutdown");
|
||||||
harnessCfgLoad(cfgCmdRestore, argList);
|
HRN_CFG_LOAD(cfgCmdRestore, argList);
|
||||||
|
|
||||||
TEST_RESULT_STR_Z(
|
TEST_RESULT_STR_Z(
|
||||||
restoreRecoveryConf(PG_VERSION_95, restoreLabel),
|
restoreRecoveryConf(PG_VERSION_95, restoreLabel),
|
||||||
@ -1610,7 +1610,7 @@ testRun(void)
|
|||||||
argList = strLstDup(argBaseList);
|
argList = strLstDup(argBaseList);
|
||||||
strLstAddZ(argList, "--type=immediate");
|
strLstAddZ(argList, "--type=immediate");
|
||||||
strLstAddZ(argList, "--target-action=promote");
|
strLstAddZ(argList, "--target-action=promote");
|
||||||
harnessCfgLoad(cfgCmdRestore, argList);
|
HRN_CFG_LOAD(cfgCmdRestore, argList);
|
||||||
|
|
||||||
TEST_RESULT_STR_Z(
|
TEST_RESULT_STR_Z(
|
||||||
restoreRecoveryConf(PG_VERSION_94, restoreLabel),
|
restoreRecoveryConf(PG_VERSION_94, restoreLabel),
|
||||||
@ -1629,7 +1629,7 @@ testRun(void)
|
|||||||
|
|
||||||
argList = strLstDup(argBaseList);
|
argList = strLstDup(argBaseList);
|
||||||
strLstAddZ(argList, "--type=standby");
|
strLstAddZ(argList, "--type=standby");
|
||||||
harnessCfgLoad(cfgCmdRestore, argList);
|
HRN_CFG_LOAD(cfgCmdRestore, argList);
|
||||||
|
|
||||||
TEST_RESULT_STR_Z(
|
TEST_RESULT_STR_Z(
|
||||||
restoreRecoveryConf(PG_VERSION_94, restoreLabel),
|
restoreRecoveryConf(PG_VERSION_94, restoreLabel),
|
||||||
@ -1644,7 +1644,7 @@ testRun(void)
|
|||||||
argList = strLstDup(argBaseList);
|
argList = strLstDup(argBaseList);
|
||||||
strLstAddZ(argList, "--type=standby");
|
strLstAddZ(argList, "--type=standby");
|
||||||
strLstAddZ(argList, "--target-timeline=current");
|
strLstAddZ(argList, "--target-timeline=current");
|
||||||
harnessCfgLoad(cfgCmdRestore, argList);
|
HRN_CFG_LOAD(cfgCmdRestore, argList);
|
||||||
|
|
||||||
TEST_RESULT_STR_Z(
|
TEST_RESULT_STR_Z(
|
||||||
restoreRecoveryConf(PG_VERSION_94, restoreLabel),
|
restoreRecoveryConf(PG_VERSION_94, restoreLabel),
|
||||||
@ -1659,7 +1659,7 @@ testRun(void)
|
|||||||
|
|
||||||
argList = strLstDup(argBaseList);
|
argList = strLstDup(argBaseList);
|
||||||
strLstAddZ(argList, "--archive-mode=off");
|
strLstAddZ(argList, "--archive-mode=off");
|
||||||
harnessCfgLoad(cfgCmdRestore, argList);
|
HRN_CFG_LOAD(cfgCmdRestore, argList);
|
||||||
|
|
||||||
TEST_ERROR(
|
TEST_ERROR(
|
||||||
restoreRecoveryConf(PG_VERSION_94, restoreLabel), OptionInvalidError,
|
restoreRecoveryConf(PG_VERSION_94, restoreLabel), OptionInvalidError,
|
||||||
@ -1672,7 +1672,7 @@ testRun(void)
|
|||||||
argList = strLstDup(argBaseList);
|
argList = strLstDup(argBaseList);
|
||||||
strLstAddZ(argList, "--type=standby");
|
strLstAddZ(argList, "--type=standby");
|
||||||
strLstAddZ(argList, "--archive-mode=off");
|
strLstAddZ(argList, "--archive-mode=off");
|
||||||
harnessCfgLoad(cfgCmdRestore, argList);
|
HRN_CFG_LOAD(cfgCmdRestore, argList);
|
||||||
|
|
||||||
TEST_RESULT_STR_Z(
|
TEST_RESULT_STR_Z(
|
||||||
restoreRecoveryConf(PG_VERSION_12, restoreLabel),
|
restoreRecoveryConf(PG_VERSION_12, restoreLabel),
|
||||||
@ -1700,7 +1700,7 @@ testRun(void)
|
|||||||
strLstAdd(argList, strNewFmt("--pg1-path=%s", strZ(pgPath)));
|
strLstAdd(argList, strNewFmt("--pg1-path=%s", strZ(pgPath)));
|
||||||
strLstAddZ(argList, "--type=default");
|
strLstAddZ(argList, "--type=default");
|
||||||
strLstAddZ(argList, "--recovery-option=standby-mode=on");
|
strLstAddZ(argList, "--recovery-option=standby-mode=on");
|
||||||
harnessCfgLoad(cfgCmdRestore, argList);
|
HRN_CFG_LOAD(cfgCmdRestore, argList);
|
||||||
|
|
||||||
TEST_ERROR(
|
TEST_ERROR(
|
||||||
restoreRecoveryWriteAutoConf(PG_VERSION_12, restoreLabel), OptionInvalidError,
|
restoreRecoveryWriteAutoConf(PG_VERSION_12, restoreLabel), OptionInvalidError,
|
||||||
@ -1717,7 +1717,7 @@ testRun(void)
|
|||||||
strLstAddZ(argList, "--repo1-path=/repo");
|
strLstAddZ(argList, "--repo1-path=/repo");
|
||||||
strLstAdd(argList, strNewFmt("--pg1-path=%s", strZ(pgPath)));
|
strLstAdd(argList, strNewFmt("--pg1-path=%s", strZ(pgPath)));
|
||||||
strLstAddZ(argList, "--type=none");
|
strLstAddZ(argList, "--type=none");
|
||||||
harnessCfgLoad(cfgCmdRestore, argList);
|
HRN_CFG_LOAD(cfgCmdRestore, argList);
|
||||||
|
|
||||||
restoreRecoveryWriteAutoConf(PG_VERSION_12, restoreLabel);
|
restoreRecoveryWriteAutoConf(PG_VERSION_12, restoreLabel);
|
||||||
|
|
||||||
@ -1772,7 +1772,7 @@ testRun(void)
|
|||||||
strLstAdd(argList, strNewFmt("--pg1-path=%s", strZ(pgPath)));
|
strLstAdd(argList, strNewFmt("--pg1-path=%s", strZ(pgPath)));
|
||||||
strLstAddZ(argList, "--recovery-option=restore-command=my_restore_command");
|
strLstAddZ(argList, "--recovery-option=restore-command=my_restore_command");
|
||||||
strLstAddZ(argList, "--type=standby");
|
strLstAddZ(argList, "--type=standby");
|
||||||
harnessCfgLoad(cfgCmdRestore, argList);
|
HRN_CFG_LOAD(cfgCmdRestore, argList);
|
||||||
|
|
||||||
restoreRecoveryWriteAutoConf(PG_VERSION_12, restoreLabel);
|
restoreRecoveryWriteAutoConf(PG_VERSION_12, restoreLabel);
|
||||||
|
|
||||||
@ -1805,7 +1805,7 @@ testRun(void)
|
|||||||
strLstAddZ(argList, "--repo1-path=/repo");
|
strLstAddZ(argList, "--repo1-path=/repo");
|
||||||
strLstAdd(argList, strNewFmt("--pg1-path=%s", strZ(pgPath)));
|
strLstAdd(argList, strNewFmt("--pg1-path=%s", strZ(pgPath)));
|
||||||
strLstAddZ(argList, "--type=preserve");
|
strLstAddZ(argList, "--type=preserve");
|
||||||
harnessCfgLoad(cfgCmdRestore, argList);
|
HRN_CFG_LOAD(cfgCmdRestore, argList);
|
||||||
|
|
||||||
restoreRecoveryWrite(manifest);
|
restoreRecoveryWrite(manifest);
|
||||||
|
|
||||||
@ -1828,7 +1828,7 @@ testRun(void)
|
|||||||
strLstAddZ(argList, "--stanza=test1");
|
strLstAddZ(argList, "--stanza=test1");
|
||||||
strLstAddZ(argList, "--repo1-path=/repo");
|
strLstAddZ(argList, "--repo1-path=/repo");
|
||||||
strLstAdd(argList, strNewFmt("--pg1-path=%s", strZ(pgPath)));
|
strLstAdd(argList, strNewFmt("--pg1-path=%s", strZ(pgPath)));
|
||||||
harnessCfgLoad(cfgCmdRestore, argList);
|
HRN_CFG_LOAD(cfgCmdRestore, argList);
|
||||||
|
|
||||||
restoreRecoveryWrite(manifest);
|
restoreRecoveryWrite(manifest);
|
||||||
|
|
||||||
@ -1869,7 +1869,7 @@ testRun(void)
|
|||||||
strLstAdd(argList, strNewFmt("--repo1-path=%s", strZ(repoPath)));
|
strLstAdd(argList, strNewFmt("--repo1-path=%s", strZ(repoPath)));
|
||||||
strLstAdd(argList, strNewFmt("--pg1-path=%s", strZ(pgPath)));
|
strLstAdd(argList, strNewFmt("--pg1-path=%s", strZ(pgPath)));
|
||||||
strLstAddZ(argList, "--pg1-host=pg1");
|
strLstAddZ(argList, "--pg1-host=pg1");
|
||||||
harnessCfgLoad(cfgCmdRestore, argList);
|
HRN_CFG_LOAD(cfgCmdRestore, argList);
|
||||||
|
|
||||||
TEST_ERROR(cmdRestore(), HostInvalidError, "restore command must be run on the PostgreSQL host");
|
TEST_ERROR(cmdRestore(), HostInvalidError, "restore command must be run on the PostgreSQL host");
|
||||||
|
|
||||||
@ -1884,7 +1884,7 @@ testRun(void)
|
|||||||
strLstAddZ(argList, "--set=20161219-212741F");
|
strLstAddZ(argList, "--set=20161219-212741F");
|
||||||
hrnCfgArgKeyRawStrId(argList, cfgOptRepoCipherType, 2, cipherTypeAes256Cbc);
|
hrnCfgArgKeyRawStrId(argList, cfgOptRepoCipherType, 2, cipherTypeAes256Cbc);
|
||||||
hrnCfgEnvKeyRawZ(cfgOptRepoCipherPass, 2, TEST_CIPHER_PASS);
|
hrnCfgEnvKeyRawZ(cfgOptRepoCipherPass, 2, TEST_CIPHER_PASS);
|
||||||
harnessCfgLoad(cfgCmdRestore, argList);
|
HRN_CFG_LOAD(cfgCmdRestore, argList);
|
||||||
|
|
||||||
#define TEST_LABEL "20161219-212741F"
|
#define TEST_LABEL "20161219-212741F"
|
||||||
#define TEST_PGDATA MANIFEST_TARGET_PGDATA "/"
|
#define TEST_PGDATA MANIFEST_TARGET_PGDATA "/"
|
||||||
@ -2050,7 +2050,7 @@ testRun(void)
|
|||||||
strLstAddZ(argList, "--force");
|
strLstAddZ(argList, "--force");
|
||||||
hrnCfgArgKeyRawStrId(argList, cfgOptRepoCipherType, 2, cipherTypeAes256Cbc);
|
hrnCfgArgKeyRawStrId(argList, cfgOptRepoCipherType, 2, cipherTypeAes256Cbc);
|
||||||
hrnCfgEnvKeyRawZ(cfgOptRepoCipherPass, 2, TEST_CIPHER_PASS);
|
hrnCfgEnvKeyRawZ(cfgOptRepoCipherPass, 2, TEST_CIPHER_PASS);
|
||||||
harnessCfgLoad(cfgCmdRestore, argList);
|
HRN_CFG_LOAD(cfgCmdRestore, argList);
|
||||||
|
|
||||||
// Store backup.info to repo1 - repo1 will be selected because of the priority order
|
// Store backup.info to repo1 - repo1 will be selected because of the priority order
|
||||||
HRN_INFO_PUT(storageRepoIdxWrite(0), INFO_BACKUP_PATH_FILE, TEST_RESTORE_BACKUP_INFO "\n" TEST_RESTORE_BACKUP_INFO_DB);
|
HRN_INFO_PUT(storageRepoIdxWrite(0), INFO_BACKUP_PATH_FILE, TEST_RESTORE_BACKUP_INFO "\n" TEST_RESTORE_BACKUP_INFO_DB);
|
||||||
@ -2175,7 +2175,7 @@ testRun(void)
|
|||||||
hrnCfgArgRawStrId(argList, cfgOptType, CFGOPTVAL_TYPE_PRESERVE);
|
hrnCfgArgRawStrId(argList, cfgOptType, CFGOPTVAL_TYPE_PRESERVE);
|
||||||
strLstAddZ(argList, "--" CFGOPT_SET "=20161219-212741F");
|
strLstAddZ(argList, "--" CFGOPT_SET "=20161219-212741F");
|
||||||
strLstAddZ(argList, "--" CFGOPT_FORCE);
|
strLstAddZ(argList, "--" CFGOPT_FORCE);
|
||||||
harnessCfgLoad(cfgCmdRestore, argList);
|
HRN_CFG_LOAD(cfgCmdRestore, argList);
|
||||||
|
|
||||||
cmdRestore();
|
cmdRestore();
|
||||||
|
|
||||||
@ -2229,7 +2229,7 @@ testRun(void)
|
|||||||
strLstAddZ(argList, "--link-map=pg_wal=../wal");
|
strLstAddZ(argList, "--link-map=pg_wal=../wal");
|
||||||
strLstAddZ(argList, "--link-map=postgresql.conf=../config/postgresql.conf");
|
strLstAddZ(argList, "--link-map=postgresql.conf=../config/postgresql.conf");
|
||||||
strLstAddZ(argList, "--link-map=pg_hba.conf=../config/pg_hba.conf");
|
strLstAddZ(argList, "--link-map=pg_hba.conf=../config/pg_hba.conf");
|
||||||
harnessCfgLoad(cfgCmdRestore, argList);
|
HRN_CFG_LOAD(cfgCmdRestore, argList);
|
||||||
|
|
||||||
#define TEST_LABEL "20161219-212741F_20161219-212918I"
|
#define TEST_LABEL "20161219-212741F_20161219-212918I"
|
||||||
#define TEST_PGDATA MANIFEST_TARGET_PGDATA "/"
|
#define TEST_PGDATA MANIFEST_TARGET_PGDATA "/"
|
||||||
@ -2599,7 +2599,7 @@ testRun(void)
|
|||||||
strLstAddZ(argList, "--link-map=postgresql.conf=../config/postgresql.conf");
|
strLstAddZ(argList, "--link-map=postgresql.conf=../config/postgresql.conf");
|
||||||
strLstAddZ(argList, "--link-map=pg_hba.conf=../config/pg_hba.conf");
|
strLstAddZ(argList, "--link-map=pg_hba.conf=../config/pg_hba.conf");
|
||||||
strLstAddZ(argList, "--db-include=16384");
|
strLstAddZ(argList, "--db-include=16384");
|
||||||
harnessCfgLoad(cfgCmdRestore, argList);
|
HRN_CFG_LOAD(cfgCmdRestore, argList);
|
||||||
|
|
||||||
// Move pg1-path and put a link in its place. This tests that restore works when pg1-path is a symlink yet should be
|
// Move pg1-path and put a link in its place. This tests that restore works when pg1-path is a symlink yet should be
|
||||||
// completely invisible in the manifest and logging.
|
// completely invisible in the manifest and logging.
|
||||||
|
@ -42,10 +42,10 @@ testRun(void)
|
|||||||
hrnCfgArgRawZ(argList, cfgOptRepo, "2");
|
hrnCfgArgRawZ(argList, cfgOptRepo, "2");
|
||||||
|
|
||||||
TEST_ERROR(
|
TEST_ERROR(
|
||||||
harnessCfgLoad(cfgCmdStanzaCreate, argList), OptionInvalidError, "option 'repo' not valid for command 'stanza-create'");
|
hrnCfgLoadP(cfgCmdStanzaCreate, argList), OptionInvalidError, "option 'repo' not valid for command 'stanza-create'");
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------------------------------
|
||||||
harnessCfgLoad(cfgCmdStanzaCreate, argListBase);
|
HRN_CFG_LOAD(cfgCmdStanzaCreate, argListBase);
|
||||||
|
|
||||||
// Create the stop file
|
// Create the stop file
|
||||||
TEST_RESULT_VOID(
|
TEST_RESULT_VOID(
|
||||||
@ -58,7 +58,7 @@ testRun(void)
|
|||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------------------------------
|
||||||
argList = strLstDup(argListBase);
|
argList = strLstDup(argListBase);
|
||||||
harnessCfgLoad(cfgCmdStanzaCreate, argList);
|
HRN_CFG_LOAD(cfgCmdStanzaCreate, argList);
|
||||||
|
|
||||||
// Create pg_control
|
// Create pg_control
|
||||||
storagePutP(
|
storagePutP(
|
||||||
@ -130,7 +130,7 @@ testRun(void)
|
|||||||
hrnCfgArgKeyRawZ(argList, cfgOptRepoPath, 4, TEST_PATH "/repo4");
|
hrnCfgArgKeyRawZ(argList, cfgOptRepoPath, 4, TEST_PATH "/repo4");
|
||||||
hrnCfgArgKeyRawStrId(argList, cfgOptRepoCipherType, 4, cipherTypeAes256Cbc);
|
hrnCfgArgKeyRawStrId(argList, cfgOptRepoCipherType, 4, cipherTypeAes256Cbc);
|
||||||
hrnCfgEnvKeyRawZ(cfgOptRepoCipherPass, 4, "87654321");
|
hrnCfgEnvKeyRawZ(cfgOptRepoCipherPass, 4, "87654321");
|
||||||
harnessCfgLoad(cfgCmdStanzaCreate, argList);
|
HRN_CFG_LOAD(cfgCmdStanzaCreate, argList);
|
||||||
|
|
||||||
TEST_RESULT_VOID(cmdStanzaCreate(), "stanza create - files already exist on repo1 and both are valid");
|
TEST_RESULT_VOID(cmdStanzaCreate(), "stanza create - files already exist on repo1 and both are valid");
|
||||||
TEST_RESULT_LOG(
|
TEST_RESULT_LOG(
|
||||||
@ -250,14 +250,14 @@ testRun(void)
|
|||||||
hrnCfgArgKeyRawFmt(argListCmd, cfgOptPgPath, 1, TEST_PATH "/%s", strZ(stanza));
|
hrnCfgArgKeyRawFmt(argListCmd, cfgOptPgPath, 1, TEST_PATH "/%s", strZ(stanza));
|
||||||
|
|
||||||
TEST_ERROR(
|
TEST_ERROR(
|
||||||
harnessCfgLoad(cfgCmdStanzaDelete, argListCmd), OptionRequiredError,
|
hrnCfgLoadP(cfgCmdStanzaDelete, argListCmd), OptionRequiredError,
|
||||||
"stanza-delete command requires option: repo\n"
|
"stanza-delete command requires option: repo\n"
|
||||||
"HINT: this command requires a specific repository to operate on");
|
"HINT: this command requires a specific repository to operate on");
|
||||||
|
|
||||||
// Add the repo option
|
// Add the repo option
|
||||||
StringList *argListDelete = strLstDup(argListCmd);
|
StringList *argListDelete = strLstDup(argListCmd);
|
||||||
hrnCfgArgRawZ(argListDelete, cfgOptRepo, "4");
|
hrnCfgArgRawZ(argListDelete, cfgOptRepo, "4");
|
||||||
harnessCfgLoad(cfgCmdStanzaDelete, argListDelete);
|
HRN_CFG_LOAD(cfgCmdStanzaDelete, argListDelete);
|
||||||
|
|
||||||
TEST_ERROR(
|
TEST_ERROR(
|
||||||
cmdStanzaDelete(), FileMissingError,
|
cmdStanzaDelete(), FileMissingError,
|
||||||
@ -282,7 +282,7 @@ testRun(void)
|
|||||||
// Stanza with directories only
|
// Stanza with directories only
|
||||||
argListDelete = strLstDup(argListCmd);
|
argListDelete = strLstDup(argListCmd);
|
||||||
hrnCfgArgRawZ(argListDelete, cfgOptRepo, "3");
|
hrnCfgArgRawZ(argListDelete, cfgOptRepo, "3");
|
||||||
harnessCfgLoad(cfgCmdStanzaDelete, argListDelete);
|
HRN_CFG_LOAD(cfgCmdStanzaDelete, argListDelete);
|
||||||
|
|
||||||
TEST_RESULT_VOID(
|
TEST_RESULT_VOID(
|
||||||
storagePathCreateP(storageTest, strNewFmt("repo3/archive/%s/9.6-1/1234567812345678", strZ(stanza))),
|
storagePathCreateP(storageTest, strNewFmt("repo3/archive/%s/9.6-1/1234567812345678", strZ(stanza))),
|
||||||
@ -307,7 +307,7 @@ testRun(void)
|
|||||||
hrnCfgArgKeyRawZ(argList, cfgOptRepoPath, 2, TEST_PATH "/repo2");
|
hrnCfgArgKeyRawZ(argList, cfgOptRepoPath, 2, TEST_PATH "/repo2");
|
||||||
hrnCfgArgKeyRawStrId(argList, cfgOptRepoCipherType, 2, cipherTypeAes256Cbc);
|
hrnCfgArgKeyRawStrId(argList, cfgOptRepoCipherType, 2, cipherTypeAes256Cbc);
|
||||||
hrnCfgEnvKeyRawZ(cfgOptRepoCipherPass, 2, "12345678");
|
hrnCfgEnvKeyRawZ(cfgOptRepoCipherPass, 2, "12345678");
|
||||||
harnessCfgLoad(cfgCmdStanzaCreate, argList);
|
HRN_CFG_LOAD(cfgCmdStanzaCreate, argList);
|
||||||
|
|
||||||
// Backup files removed - archive.info and archive.info.copy exist repo2
|
// Backup files removed - archive.info and archive.info.copy exist repo2
|
||||||
TEST_RESULT_VOID(
|
TEST_RESULT_VOID(
|
||||||
@ -339,7 +339,7 @@ testRun(void)
|
|||||||
// Delete the last repo so only 1 remains
|
// Delete the last repo so only 1 remains
|
||||||
argListDelete = strLstDup(argListCmd);
|
argListDelete = strLstDup(argListCmd);
|
||||||
hrnCfgArgRawZ(argListDelete, cfgOptRepo, "2");
|
hrnCfgArgRawZ(argListDelete, cfgOptRepo, "2");
|
||||||
harnessCfgLoad(cfgCmdStanzaDelete, argListDelete);
|
HRN_CFG_LOAD(cfgCmdStanzaDelete, argListDelete);
|
||||||
|
|
||||||
// Create the stop file
|
// Create the stop file
|
||||||
TEST_RESULT_VOID(
|
TEST_RESULT_VOID(
|
||||||
@ -353,7 +353,7 @@ testRun(void)
|
|||||||
hrnCfgEnvKeyRemoveRaw(cfgOptRepoCipherPass, 2);
|
hrnCfgEnvKeyRemoveRaw(cfgOptRepoCipherPass, 2);
|
||||||
|
|
||||||
argList = strLstDup(argListBase);
|
argList = strLstDup(argListBase);
|
||||||
harnessCfgLoad(cfgCmdStanzaCreate, argList);
|
HRN_CFG_LOAD(cfgCmdStanzaCreate, argList);
|
||||||
|
|
||||||
// Archive files removed - backup.info exists
|
// Archive files removed - backup.info exists
|
||||||
TEST_RESULT_VOID(
|
TEST_RESULT_VOID(
|
||||||
@ -546,7 +546,7 @@ testRun(void)
|
|||||||
// Repeat last test using --force (deprecated)
|
// Repeat last test using --force (deprecated)
|
||||||
//--------------------------------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------------------------------
|
||||||
strLstAddZ(argList, "--force");
|
strLstAddZ(argList, "--force");
|
||||||
harnessCfgLoad(cfgCmdStanzaCreate, argList);
|
HRN_CFG_LOAD(cfgCmdStanzaCreate, argList);
|
||||||
TEST_ERROR(cmdStanzaCreate(), PathNotEmptyError, "archive directory not empty");
|
TEST_ERROR(cmdStanzaCreate(), PathNotEmptyError, "archive directory not empty");
|
||||||
TEST_RESULT_LOG(
|
TEST_RESULT_LOG(
|
||||||
"P00 WARN: option --force is no longer supported\n"
|
"P00 WARN: option --force is no longer supported\n"
|
||||||
@ -564,7 +564,7 @@ testRun(void)
|
|||||||
strLstAdd(argList, strNewFmt("--stanza=%s", strZ(stanza)));
|
strLstAdd(argList, strNewFmt("--stanza=%s", strZ(stanza)));
|
||||||
strLstAdd(argList, strNewFmt("--pg1-path=%s", strZ(pg1Path)));
|
strLstAdd(argList, strNewFmt("--pg1-path=%s", strZ(pg1Path)));
|
||||||
strLstAddZ(argList, "--repo1-path=" TEST_PATH "/repo");
|
strLstAddZ(argList, "--repo1-path=" TEST_PATH "/repo");
|
||||||
harnessCfgLoad(cfgCmdStanzaCreate, argList);
|
HRN_CFG_LOAD(cfgCmdStanzaCreate, argList);
|
||||||
|
|
||||||
// pgControl and database match
|
// pgControl and database match
|
||||||
//--------------------------------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------------------------------
|
||||||
@ -584,7 +584,7 @@ testRun(void)
|
|||||||
TEST_RESULT_BOOL(
|
TEST_RESULT_BOOL(
|
||||||
storageExistsP(storageTest, strNewFmt("repo/archive/%s/archive.info", strZ(stanza))), true, " stanza created");
|
storageExistsP(storageTest, strNewFmt("repo/archive/%s/archive.info", strZ(stanza))), true, " stanza created");
|
||||||
|
|
||||||
harnessCfgLoad(cfgCmdStanzaUpgrade, argList);
|
HRN_CFG_LOAD(cfgCmdStanzaUpgrade, argList);
|
||||||
harnessPqScriptSet((HarnessPq [])
|
harnessPqScriptSet((HarnessPq [])
|
||||||
{
|
{
|
||||||
HRNPQ_MACRO_OPEN_GE_92(1, "dbname='postgres' port=5432", PG_VERSION_92, strZ(pg1Path), false, NULL, NULL),
|
HRNPQ_MACRO_OPEN_GE_92(1, "dbname='postgres' port=5432", PG_VERSION_92, strZ(pg1Path), false, NULL, NULL),
|
||||||
@ -644,7 +644,7 @@ testRun(void)
|
|||||||
strLstAdd(argList, strNewFmt("--pg2-path=%s", strZ(pg1Path)));
|
strLstAdd(argList, strNewFmt("--pg2-path=%s", strZ(pg1Path)));
|
||||||
strLstAddZ(argList, "--pg2-port=5434");
|
strLstAddZ(argList, "--pg2-port=5434");
|
||||||
strLstAddZ(argList, "--repo1-path=" TEST_PATH "/repo");
|
strLstAddZ(argList, "--repo1-path=" TEST_PATH "/repo");
|
||||||
harnessCfgLoad(cfgCmdStanzaCreate, argList);
|
HRN_CFG_LOAD(cfgCmdStanzaCreate, argList);
|
||||||
|
|
||||||
// Create pg_control for primary
|
// Create pg_control for primary
|
||||||
storagePutP(
|
storagePutP(
|
||||||
@ -686,11 +686,11 @@ testRun(void)
|
|||||||
hrnCfgArgRawZ(argList, cfgOptRepo, "2");
|
hrnCfgArgRawZ(argList, cfgOptRepo, "2");
|
||||||
|
|
||||||
TEST_ERROR(
|
TEST_ERROR(
|
||||||
harnessCfgLoad(cfgCmdStanzaUpgrade, argList), OptionInvalidError,
|
hrnCfgLoadP(cfgCmdStanzaUpgrade, argList), OptionInvalidError,
|
||||||
"option 'repo' not valid for command 'stanza-upgrade'");
|
"option 'repo' not valid for command 'stanza-upgrade'");
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------------------------------
|
||||||
harnessCfgLoad(cfgCmdStanzaUpgrade, argListBase);
|
HRN_CFG_LOAD(cfgCmdStanzaUpgrade, argListBase);
|
||||||
|
|
||||||
// Create the stop file
|
// Create the stop file
|
||||||
TEST_RESULT_VOID(
|
TEST_RESULT_VOID(
|
||||||
@ -1007,7 +1007,7 @@ testRun(void)
|
|||||||
strLstAdd(argList, strNewFmt("--stanza=%s", strZ(stanzaOther)));
|
strLstAdd(argList, strNewFmt("--stanza=%s", strZ(stanzaOther)));
|
||||||
strLstAdd(argList, strNewFmt("--pg1-path=" TEST_PATH "/%s", strZ(stanzaOther)));
|
strLstAdd(argList, strNewFmt("--pg1-path=" TEST_PATH "/%s", strZ(stanzaOther)));
|
||||||
strLstAddZ(argList, "--no-online");
|
strLstAddZ(argList, "--no-online");
|
||||||
harnessCfgLoad(cfgCmdStanzaCreate, argList);
|
HRN_CFG_LOAD(cfgCmdStanzaCreate, argList);
|
||||||
|
|
||||||
// Create pg_control for stanza-create
|
// Create pg_control for stanza-create
|
||||||
storagePutP(
|
storagePutP(
|
||||||
@ -1020,7 +1020,7 @@ testRun(void)
|
|||||||
argList = strLstDup(argListCmd);
|
argList = strLstDup(argListCmd);
|
||||||
strLstAdd(argList, strNewFmt("--stanza=%s", strZ(stanza)));
|
strLstAdd(argList, strNewFmt("--stanza=%s", strZ(stanza)));
|
||||||
strLstAdd(argList, strNewFmt("--pg1-path=" TEST_PATH "/%s", strZ(stanza)));
|
strLstAdd(argList, strNewFmt("--pg1-path=" TEST_PATH "/%s", strZ(stanza)));
|
||||||
harnessCfgLoad(cfgCmdStanzaDelete, argList);
|
HRN_CFG_LOAD(cfgCmdStanzaDelete, argList);
|
||||||
|
|
||||||
// stanza already deleted
|
// stanza already deleted
|
||||||
//--------------------------------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------------------------------
|
||||||
@ -1132,7 +1132,7 @@ testRun(void)
|
|||||||
StringList *argListDel = strLstDup(argList);
|
StringList *argListDel = strLstDup(argList);
|
||||||
hrnCfgArgKeyRawZ(argListDel, cfgOptRepoPath, 2, TEST_PATH "/repo2");
|
hrnCfgArgKeyRawZ(argListDel, cfgOptRepoPath, 2, TEST_PATH "/repo2");
|
||||||
hrnCfgArgRawZ(argListDel, cfgOptRepo, "2");
|
hrnCfgArgRawZ(argListDel, cfgOptRepo, "2");
|
||||||
harnessCfgLoad(cfgCmdStanzaDelete, argListDel);
|
HRN_CFG_LOAD(cfgCmdStanzaDelete, argListDel);
|
||||||
|
|
||||||
TEST_RESULT_VOID(
|
TEST_RESULT_VOID(
|
||||||
storagePutP(
|
storagePutP(
|
||||||
@ -1151,7 +1151,7 @@ testRun(void)
|
|||||||
hrnCfgArgKeyRawZ(argList, cfgOptRepoPath, 2, TEST_PATH "/repo2");
|
hrnCfgArgKeyRawZ(argList, cfgOptRepoPath, 2, TEST_PATH "/repo2");
|
||||||
hrnCfgArgRawZ(argList, cfgOptRepo, "1");
|
hrnCfgArgRawZ(argList, cfgOptRepo, "1");
|
||||||
strLstAddZ(argList,"--force");
|
strLstAddZ(argList,"--force");
|
||||||
harnessCfgLoad(cfgCmdStanzaDelete, argList);
|
HRN_CFG_LOAD(cfgCmdStanzaDelete, argList);
|
||||||
|
|
||||||
TEST_RESULT_VOID(cmdStanzaDelete(), "stanza delete --force");
|
TEST_RESULT_VOID(cmdStanzaDelete(), "stanza delete --force");
|
||||||
TEST_RESULT_BOOL(
|
TEST_RESULT_BOOL(
|
||||||
|
@ -242,7 +242,7 @@ testRun(void)
|
|||||||
{
|
{
|
||||||
// Load Parameters
|
// Load Parameters
|
||||||
StringList *argList = strLstDup(argListBase);
|
StringList *argList = strLstDup(argListBase);
|
||||||
harnessCfgLoad(cfgCmdVerify, argList);
|
HRN_CFG_LOAD(cfgCmdVerify, argList);
|
||||||
|
|
||||||
const Buffer *contentLoad = harnessInfoChecksumZ
|
const Buffer *contentLoad = harnessInfoChecksumZ
|
||||||
(
|
(
|
||||||
@ -773,7 +773,7 @@ testRun(void)
|
|||||||
{
|
{
|
||||||
// Load Parameters
|
// Load Parameters
|
||||||
StringList *argList = strLstDup(argListBase);
|
StringList *argList = strLstDup(argListBase);
|
||||||
harnessCfgLoad(cfgCmdVerify, argList);
|
HRN_CFG_LOAD(cfgCmdVerify, argList);
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------------------------------
|
||||||
TEST_TITLE("backup.info invalid checksum, neither backup copy nor archive infos exist");
|
TEST_TITLE("backup.info invalid checksum, neither backup copy nor archive infos exist");
|
||||||
@ -878,7 +878,7 @@ testRun(void)
|
|||||||
{
|
{
|
||||||
// Load Parameters
|
// Load Parameters
|
||||||
StringList *argList = strLstDup(argListBase);
|
StringList *argList = strLstDup(argListBase);
|
||||||
harnessCfgLoad(cfgCmdVerify, argList);
|
HRN_CFG_LOAD(cfgCmdVerify, argList);
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------------------------------
|
||||||
TEST_TITLE("verifyFile()");
|
TEST_TITLE("verifyFile()");
|
||||||
@ -917,7 +917,7 @@ testRun(void)
|
|||||||
// Load Parameters with multi-repo
|
// Load Parameters with multi-repo
|
||||||
StringList *argList = strLstDup(argListBase);
|
StringList *argList = strLstDup(argListBase);
|
||||||
hrnCfgArgKeyRawZ(argList, cfgOptRepoPath, 4, TEST_PATH "/repo4");
|
hrnCfgArgKeyRawZ(argList, cfgOptRepoPath, 4, TEST_PATH "/repo4");
|
||||||
harnessCfgLoad(cfgCmdVerify, argList);
|
HRN_CFG_LOAD(cfgCmdVerify, argList);
|
||||||
|
|
||||||
// Store valid archive/backup info files
|
// Store valid archive/backup info files
|
||||||
TEST_RESULT_VOID(
|
TEST_RESULT_VOID(
|
||||||
@ -1047,7 +1047,7 @@ testRun(void)
|
|||||||
|
|
||||||
// Load Parameters - single default repo
|
// Load Parameters - single default repo
|
||||||
argList = strLstDup(argListBase);
|
argList = strLstDup(argListBase);
|
||||||
harnessCfgLoad(cfgCmdVerify, argList);
|
HRN_CFG_LOAD(cfgCmdVerify, argList);
|
||||||
|
|
||||||
TEST_RESULT_VOID(
|
TEST_RESULT_VOID(
|
||||||
storagePutP(
|
storagePutP(
|
||||||
@ -1089,7 +1089,7 @@ testRun(void)
|
|||||||
hrnCfgArgKeyRawZ(argList, cfgOptRepoPath, 2, TEST_PATH "/repo");
|
hrnCfgArgKeyRawZ(argList, cfgOptRepoPath, 2, TEST_PATH "/repo");
|
||||||
hrnCfgArgRawFmt(argList, cfgOptStanza, "%s", strZ(stanza));
|
hrnCfgArgRawFmt(argList, cfgOptStanza, "%s", strZ(stanza));
|
||||||
hrnCfgArgRawZ(argList, cfgOptRepo, "2");
|
hrnCfgArgRawZ(argList, cfgOptRepo, "2");
|
||||||
harnessCfgLoad(cfgCmdVerify, argList);
|
HRN_CFG_LOAD(cfgCmdVerify, argList);
|
||||||
|
|
||||||
TEST_RESULT_VOID(
|
TEST_RESULT_VOID(
|
||||||
storagePutP(
|
storagePutP(
|
||||||
@ -1283,7 +1283,7 @@ testRun(void)
|
|||||||
{
|
{
|
||||||
// Load Parameters
|
// Load Parameters
|
||||||
StringList *argList = strLstDup(argListBase);
|
StringList *argList = strLstDup(argListBase);
|
||||||
harnessCfgLoad(cfgCmdVerify, argList);
|
HRN_CFG_LOAD(cfgCmdVerify, argList);
|
||||||
|
|
||||||
// Backup labels
|
// Backup labels
|
||||||
const String *backupLabelFull = STRDEF("20181119-152900F");
|
const String *backupLabelFull = STRDEF("20181119-152900F");
|
||||||
@ -1415,7 +1415,7 @@ testRun(void)
|
|||||||
|
|
||||||
// Set process max to 1 and add more files to check so first backup completes before second is checked
|
// Set process max to 1 and add more files to check so first backup completes before second is checked
|
||||||
strLstAddZ(argList, "--process-max=1");
|
strLstAddZ(argList, "--process-max=1");
|
||||||
harnessCfgLoad(cfgCmdVerify, argList);
|
HRN_CFG_LOAD(cfgCmdVerify, argList);
|
||||||
|
|
||||||
contentLoad = harnessInfoChecksumZ
|
contentLoad = harnessInfoChecksumZ
|
||||||
(
|
(
|
||||||
|
@ -29,7 +29,7 @@ testRun(void)
|
|||||||
// *****************************************************************************************************************************
|
// *****************************************************************************************************************************
|
||||||
if (testBegin("exitInit() and exitOnSignal()"))
|
if (testBegin("exitInit() and exitOnSignal()"))
|
||||||
{
|
{
|
||||||
harnessCfgLoad(cfgCmdHelp, strLstNew());
|
HRN_CFG_LOAD(cfgCmdHelp, strLstNew());
|
||||||
|
|
||||||
HARNESS_FORK_BEGIN()
|
HARNESS_FORK_BEGIN()
|
||||||
{
|
{
|
||||||
@ -46,7 +46,7 @@ testRun(void)
|
|||||||
// *****************************************************************************************************************************
|
// *****************************************************************************************************************************
|
||||||
if (testBegin("exitSafe()"))
|
if (testBegin("exitSafe()"))
|
||||||
{
|
{
|
||||||
harnessCfgLoad(cfgCmdHelp, strLstNew());
|
HRN_CFG_LOAD(cfgCmdHelp, strLstNew());
|
||||||
cfgCommandSet(cfgCmdNone, cfgCmdRoleMain);
|
cfgCommandSet(cfgCmdNone, cfgCmdRoleMain);
|
||||||
|
|
||||||
TEST_RESULT_INT(exitSafe(0, false, signalTypeNone), 0, "exit with no command");
|
TEST_RESULT_INT(exitSafe(0, false, signalTypeNone), 0, "exit with no command");
|
||||||
@ -55,7 +55,7 @@ testRun(void)
|
|||||||
StringList *argList = strLstNew();
|
StringList *argList = strLstNew();
|
||||||
hrnCfgArgRawZ(argList, cfgOptStanza, "test");
|
hrnCfgArgRawZ(argList, cfgOptStanza, "test");
|
||||||
hrnCfgArgRawNegate(argList, cfgOptLogTimestamp);
|
hrnCfgArgRawNegate(argList, cfgOptLogTimestamp);
|
||||||
harnessCfgLoad(cfgCmdArchivePush, argList);
|
HRN_CFG_LOAD(cfgCmdArchivePush, argList);
|
||||||
|
|
||||||
TEST_RESULT_INT(exitSafe(0, false, signalTypeNone), 0, "exit with no error");
|
TEST_RESULT_INT(exitSafe(0, false, signalTypeNone), 0, "exit with no error");
|
||||||
TEST_RESULT_LOG("P00 INFO: archive-push command end: completed successfully");
|
TEST_RESULT_LOG("P00 INFO: archive-push command end: completed successfully");
|
||||||
@ -79,11 +79,9 @@ testRun(void)
|
|||||||
|
|
||||||
// -------------------------------------------------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------------------------------------------------
|
||||||
argList = strLstNew();
|
argList = strLstNew();
|
||||||
strLstAddZ(argList, PROJECT_BIN);
|
|
||||||
strLstAddZ(argList, "--" CFGOPT_STANZA "=test");
|
strLstAddZ(argList, "--" CFGOPT_STANZA "=test");
|
||||||
strLstAddZ(argList, "--" CFGOPT_PROCESS_MAX "=4");
|
strLstAddZ(argList, "--" CFGOPT_PROCESS_MAX "=4");
|
||||||
strLstAddZ(argList, CFGCMD_ARCHIVE_PUSH ":" CONFIG_COMMAND_ROLE_ASYNC);
|
HRN_CFG_LOAD(cfgCmdArchivePush, argList, .role = cfgCmdRoleAsync, .noStd = true);
|
||||||
harnessCfgLoadRaw(strLstSize(argList), strLstPtr(argList));
|
|
||||||
|
|
||||||
harnessLogLevelSet(logLevelDebug);
|
harnessLogLevelSet(logLevelDebug);
|
||||||
|
|
||||||
@ -105,7 +103,7 @@ testRun(void)
|
|||||||
" options: --exec-id=1-test --process-max=4 --stanza=test\n"
|
" options: --exec-id=1-test --process-max=4 --stanza=test\n"
|
||||||
" \n"
|
" \n"
|
||||||
" stack trace:\n"
|
" stack trace:\n"
|
||||||
" " TEST_PGB_PATH "/test/src/module/common/exitTest.c:testRun:92:(void)\n"
|
" " TEST_PGB_PATH "/test/src/module/common/exitTest.c:testRun:90:(void)\n"
|
||||||
" test.c:main:(argListSize: 1, argList: (char *[]))\n"
|
" test.c:main:(argListSize: 1, argList: (char *[]))\n"
|
||||||
" --------------------------------------------------------------------\n"
|
" --------------------------------------------------------------------\n"
|
||||||
"P00 INFO: archive-push:async command end: aborted with exception [122]\n"
|
"P00 INFO: archive-push:async command end: aborted with exception [122]\n"
|
||||||
@ -135,7 +133,7 @@ testRun(void)
|
|||||||
" options: --exec-id=1-test --process-max=4 --stanza=test\n"
|
" options: --exec-id=1-test --process-max=4 --stanza=test\n"
|
||||||
" \n"
|
" \n"
|
||||||
" stack trace:\n"
|
" stack trace:\n"
|
||||||
" " TEST_PGB_PATH "/test/src/module/common/exitTest.c:testRun:123:(void)\n"
|
" " TEST_PGB_PATH "/test/src/module/common/exitTest.c:testRun:121:(void)\n"
|
||||||
" test.c:main:(argListSize: 1, argList: (char *[]))\n"
|
" test.c:main:(argListSize: 1, argList: (char *[]))\n"
|
||||||
" --------------------------------------------------------------------\n"
|
" --------------------------------------------------------------------\n"
|
||||||
"P00 INFO: archive-push:async command end: aborted with exception [025]");
|
"P00 INFO: archive-push:async command end: aborted with exception [025]");
|
||||||
|
@ -15,7 +15,6 @@ testRun(void)
|
|||||||
if (testBegin("cfgExecParam()"))
|
if (testBegin("cfgExecParam()"))
|
||||||
{
|
{
|
||||||
StringList *argList = strLstNew();
|
StringList *argList = strLstNew();
|
||||||
strLstAddZ(argList, "pgbackrest");
|
|
||||||
strLstAddZ(argList, "--stanza=test1");
|
strLstAddZ(argList, "--stanza=test1");
|
||||||
hrnCfgArgRawZ(argList, cfgOptArchiveTimeout, "5");
|
hrnCfgArgRawZ(argList, cfgOptArchiveTimeout, "5");
|
||||||
strLstAddZ(argList, "--repo1-path=" TEST_PATH "/repo");
|
strLstAddZ(argList, "--repo1-path=" TEST_PATH "/repo");
|
||||||
@ -26,11 +25,10 @@ testRun(void)
|
|||||||
strLstAddZ(argList, "--reset-neutral-umask");
|
strLstAddZ(argList, "--reset-neutral-umask");
|
||||||
strLstAddZ(argList, "--repo-cipher-type=aes-256-cbc");
|
strLstAddZ(argList, "--repo-cipher-type=aes-256-cbc");
|
||||||
strLstAddZ(argList, "--" CFGOPT_ARCHIVE_ASYNC);
|
strLstAddZ(argList, "--" CFGOPT_ARCHIVE_ASYNC);
|
||||||
strLstAddZ(argList, "archive-get");
|
|
||||||
|
|
||||||
// Set repo1-cipher-pass to make sure it is not passed on the command line
|
// Set repo1-cipher-pass to make sure it is not passed on the command line
|
||||||
setenv("PGBACKREST_REPO1_CIPHER_PASS", "1234", true);
|
setenv("PGBACKREST_REPO1_CIPHER_PASS", "1234", true);
|
||||||
harnessCfgLoadRaw(strLstSize(argList), strLstPtr(argList));
|
HRN_CFG_LOAD(cfgCmdArchiveGet, argList, .noStd = true);
|
||||||
unsetenv("PGBACKREST_REPO1_CIPHER_PASS");
|
unsetenv("PGBACKREST_REPO1_CIPHER_PASS");
|
||||||
|
|
||||||
TEST_RESULT_STRLST_Z(
|
TEST_RESULT_STRLST_Z(
|
||||||
@ -48,7 +46,6 @@ testRun(void)
|
|||||||
|
|
||||||
// -------------------------------------------------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------------------------------------------------
|
||||||
argList = strLstNew();
|
argList = strLstNew();
|
||||||
strLstAddZ(argList, "pgbackrest");
|
|
||||||
strLstAddZ(argList, "--stanza=test1");
|
strLstAddZ(argList, "--stanza=test1");
|
||||||
strLstAddZ(argList, "--repo1-path=" TEST_PATH "/repo");
|
strLstAddZ(argList, "--repo1-path=" TEST_PATH "/repo");
|
||||||
strLstAddZ(argList, "--pg1-path=" TEST_PATH "/db path");
|
strLstAddZ(argList, "--pg1-path=" TEST_PATH "/db path");
|
||||||
@ -57,10 +54,9 @@ testRun(void)
|
|||||||
strLstAddZ(argList, "--recovery-option=a=b");
|
strLstAddZ(argList, "--recovery-option=a=b");
|
||||||
strLstAddZ(argList, "--recovery-option=c=d");
|
strLstAddZ(argList, "--recovery-option=c=d");
|
||||||
hrnCfgArgRawReset(argList, cfgOptLogPath);
|
hrnCfgArgRawReset(argList, cfgOptLogPath);
|
||||||
strLstAddZ(argList, "restore");
|
|
||||||
|
|
||||||
setenv("PGBACKREST_REPO1_HOST", "bogus", true);
|
setenv("PGBACKREST_REPO1_HOST", "bogus", true);
|
||||||
harnessCfgLoadRaw(strLstSize(argList), strLstPtr(argList));
|
HRN_CFG_LOAD(cfgCmdRestore, argList, .noStd = true);
|
||||||
unsetenv("PGBACKREST_REPO1_HOST");
|
unsetenv("PGBACKREST_REPO1_HOST");
|
||||||
|
|
||||||
KeyValue *optionReplace = kvNew();
|
KeyValue *optionReplace = kvNew();
|
||||||
|
@ -21,7 +21,7 @@ testRun(void)
|
|||||||
// *****************************************************************************************************************************
|
// *****************************************************************************************************************************
|
||||||
if (testBegin("cfgLoadLogSetting()"))
|
if (testBegin("cfgLoadLogSetting()"))
|
||||||
{
|
{
|
||||||
harnessCfgLoad(cfgCmdVersion, strLstNew());
|
HRN_CFG_LOAD(cfgCmdVersion, strLstNew());
|
||||||
|
|
||||||
TEST_RESULT_VOID(cfgLoadLogSetting(), "load log settings all defaults");
|
TEST_RESULT_VOID(cfgLoadLogSetting(), "load log settings all defaults");
|
||||||
|
|
||||||
@ -40,7 +40,7 @@ testRun(void)
|
|||||||
hrnCfgArgRawZ(argList, cfgOptStanza, "test");
|
hrnCfgArgRawZ(argList, cfgOptStanza, "test");
|
||||||
hrnCfgArgRawZ(argList, cfgOptPgPath, "/pg1");
|
hrnCfgArgRawZ(argList, cfgOptPgPath, "/pg1");
|
||||||
hrnCfgArgRawZ(argList, cfgOptRepo, "1");
|
hrnCfgArgRawZ(argList, cfgOptRepo, "1");
|
||||||
TEST_ERROR(harnessCfgLoad(cfgCmdCheck, argList), OptionInvalidError, "option 'repo' not valid for command 'check'");
|
TEST_ERROR(hrnCfgLoadP(cfgCmdCheck, argList), OptionInvalidError, "option 'repo' not valid for command 'check'");
|
||||||
|
|
||||||
// -------------------------------------------------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------------------------------------------------
|
||||||
TEST_TITLE("error when repo option not set and repo total > 1 or first repo index != 1");
|
TEST_TITLE("error when repo option not set and repo total > 1 or first repo index != 1");
|
||||||
@ -51,19 +51,19 @@ testRun(void)
|
|||||||
hrnCfgArgRawZ(argList, cfgOptStanza, "test");
|
hrnCfgArgRawZ(argList, cfgOptStanza, "test");
|
||||||
hrnCfgArgRawZ(argList, cfgOptPgPath, "/pg1");
|
hrnCfgArgRawZ(argList, cfgOptPgPath, "/pg1");
|
||||||
TEST_ERROR(
|
TEST_ERROR(
|
||||||
harnessCfgLoad(cfgCmdStanzaDelete, argList), OptionRequiredError,
|
hrnCfgLoadP(cfgCmdStanzaDelete, argList), OptionRequiredError,
|
||||||
"stanza-delete command requires option: repo\n"
|
"stanza-delete command requires option: repo\n"
|
||||||
"HINT: this command requires a specific repository to operate on");
|
"HINT: this command requires a specific repository to operate on");
|
||||||
|
|
||||||
hrnCfgArgRawZ(argList, cfgOptRepo, "2");
|
hrnCfgArgRawZ(argList, cfgOptRepo, "2");
|
||||||
TEST_RESULT_VOID(harnessCfgLoad(cfgCmdStanzaDelete, argList), "load stanza-delete with repo set");
|
HRN_CFG_LOAD(cfgCmdStanzaDelete, argList, .comment = "load stanza-delete with repo set");
|
||||||
|
|
||||||
argList = strLstNew();
|
argList = strLstNew();
|
||||||
hrnCfgArgKeyRawZ(argList, cfgOptRepoPath, 2, "/repo2");
|
hrnCfgArgKeyRawZ(argList, cfgOptRepoPath, 2, "/repo2");
|
||||||
hrnCfgArgRawZ(argList, cfgOptStanza, "test");
|
hrnCfgArgRawZ(argList, cfgOptStanza, "test");
|
||||||
hrnCfgArgRawZ(argList, cfgOptPgPath, "/pg1");
|
hrnCfgArgRawZ(argList, cfgOptPgPath, "/pg1");
|
||||||
TEST_ERROR(
|
TEST_ERROR(
|
||||||
harnessCfgLoad(cfgCmdStanzaDelete, argList), OptionRequiredError,
|
hrnCfgLoadP(cfgCmdStanzaDelete, argList), OptionRequiredError,
|
||||||
"stanza-delete command requires option: repo\n"
|
"stanza-delete command requires option: repo\n"
|
||||||
"HINT: this command requires a specific repository to operate on");
|
"HINT: this command requires a specific repository to operate on");
|
||||||
|
|
||||||
@ -71,12 +71,12 @@ testRun(void)
|
|||||||
hrnCfgArgKeyRawZ(argList, cfgOptRepoPath, 1, "/repo1");
|
hrnCfgArgKeyRawZ(argList, cfgOptRepoPath, 1, "/repo1");
|
||||||
hrnCfgArgRawZ(argList, cfgOptStanza, "test");
|
hrnCfgArgRawZ(argList, cfgOptStanza, "test");
|
||||||
hrnCfgArgRawZ(argList, cfgOptPgPath, "/pg1");
|
hrnCfgArgRawZ(argList, cfgOptPgPath, "/pg1");
|
||||||
TEST_RESULT_VOID(harnessCfgLoad(cfgCmdStanzaDelete, argList), "load stanza-delete with single repo, repo option not set");
|
HRN_CFG_LOAD(cfgCmdStanzaDelete, argList, .comment = "load stanza-delete with single repo, repo option not set");
|
||||||
|
|
||||||
argList = strLstNew();
|
argList = strLstNew();
|
||||||
hrnCfgArgKeyRawZ(argList, cfgOptRepoPath, 1, "/repo1");
|
hrnCfgArgKeyRawZ(argList, cfgOptRepoPath, 1, "/repo1");
|
||||||
hrnCfgArgKeyRawZ(argList, cfgOptRepoPath, 4, "/repo4");
|
hrnCfgArgKeyRawZ(argList, cfgOptRepoPath, 4, "/repo4");
|
||||||
TEST_RESULT_VOID(harnessCfgLoad(cfgCmdInfo, argList), "load info config -- option repo not required");
|
HRN_CFG_LOAD(cfgCmdInfo, argList, .comment = "load info config -- option repo not required");
|
||||||
TEST_RESULT_BOOL(cfgCommand() == cfgCmdInfo, true, " command is info");
|
TEST_RESULT_BOOL(cfgCommand() == cfgCmdInfo, true, " command is info");
|
||||||
|
|
||||||
// -------------------------------------------------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------------------------------------------------
|
||||||
@ -91,7 +91,7 @@ testRun(void)
|
|||||||
hrnCfgArgKeyRawZ(argList, cfgOptRepoPath, 1, "/repo1");
|
hrnCfgArgKeyRawZ(argList, cfgOptRepoPath, 1, "/repo1");
|
||||||
hrnCfgArgKeyRawZ(argList, cfgOptRepoHost, 2, "host2");
|
hrnCfgArgKeyRawZ(argList, cfgOptRepoHost, 2, "host2");
|
||||||
TEST_ERROR(
|
TEST_ERROR(
|
||||||
harnessCfgLoad(cfgCmdRestore, argList), OptionInvalidValueError,
|
hrnCfgLoadP(cfgCmdRestore, argList), OptionInvalidValueError,
|
||||||
"local repo3 and repo4 paths are both '/repo4' but must be different");
|
"local repo3 and repo4 paths are both '/repo4' but must be different");
|
||||||
|
|
||||||
// -------------------------------------------------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------------------------------------------------
|
||||||
@ -103,8 +103,7 @@ testRun(void)
|
|||||||
hrnCfgArgKeyRawZ(argList, cfgOptRepoPath, 1, "/repo1");
|
hrnCfgArgKeyRawZ(argList, cfgOptRepoPath, 1, "/repo1");
|
||||||
hrnCfgArgKeyRawZ(argList, cfgOptRepoRetentionFull, 1, "1");
|
hrnCfgArgKeyRawZ(argList, cfgOptRepoRetentionFull, 1, "1");
|
||||||
hrnCfgArgKeyRawZ(argList, cfgOptPgPath, 1, "/pg1");
|
hrnCfgArgKeyRawZ(argList, cfgOptPgPath, 1, "/pg1");
|
||||||
|
HRN_CFG_LOAD(cfgCmdBackup, argList);
|
||||||
harnessCfgLoad(cfgCmdBackup, argList);
|
|
||||||
|
|
||||||
// -------------------------------------------------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------------------------------------------------
|
||||||
TEST_TITLE("local default repo paths for cifs repo type must be different");
|
TEST_TITLE("local default repo paths for cifs repo type must be different");
|
||||||
@ -114,7 +113,7 @@ testRun(void)
|
|||||||
hrnCfgArgKeyRawStrId(argList, cfgOptRepoType, 1, STORAGE_CIFS_TYPE);
|
hrnCfgArgKeyRawStrId(argList, cfgOptRepoType, 1, STORAGE_CIFS_TYPE);
|
||||||
hrnCfgArgKeyRawStrId(argList, cfgOptRepoType, 2, STORAGE_CIFS_TYPE);
|
hrnCfgArgKeyRawStrId(argList, cfgOptRepoType, 2, STORAGE_CIFS_TYPE);
|
||||||
TEST_ERROR(
|
TEST_ERROR(
|
||||||
harnessCfgLoad(cfgCmdInfo, argList), OptionInvalidValueError,
|
hrnCfgLoadP(cfgCmdInfo, argList), OptionInvalidValueError,
|
||||||
"local repo1 and repo2 paths are both '/var/lib/pgbackrest' but must be different");
|
"local repo1 and repo2 paths are both '/var/lib/pgbackrest' but must be different");
|
||||||
|
|
||||||
// -------------------------------------------------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------------------------------------------------
|
||||||
@ -130,7 +129,7 @@ testRun(void)
|
|||||||
hrnCfgArgKeyRawZ(argList, cfgOptRepoS3Endpoint, 3, "endpoint");
|
hrnCfgArgKeyRawZ(argList, cfgOptRepoS3Endpoint, 3, "endpoint");
|
||||||
hrnCfgEnvKeyRawZ(cfgOptRepoS3Key, 3, "mykey");
|
hrnCfgEnvKeyRawZ(cfgOptRepoS3Key, 3, "mykey");
|
||||||
hrnCfgEnvKeyRawZ(cfgOptRepoS3KeySecret, 3, "mysecretkey");
|
hrnCfgEnvKeyRawZ(cfgOptRepoS3KeySecret, 3, "mysecretkey");
|
||||||
harnessCfgLoad(cfgCmdInfo, argList);
|
HRN_CFG_LOAD(cfgCmdInfo, argList);
|
||||||
|
|
||||||
hrnCfgEnvKeyRemoveRaw(cfgOptRepoS3Key, 3);
|
hrnCfgEnvKeyRemoveRaw(cfgOptRepoS3Key, 3);
|
||||||
hrnCfgEnvKeyRemoveRaw(cfgOptRepoS3KeySecret, 3);
|
hrnCfgEnvKeyRemoveRaw(cfgOptRepoS3KeySecret, 3);
|
||||||
@ -141,7 +140,7 @@ testRun(void)
|
|||||||
argList = strLstNew();
|
argList = strLstNew();
|
||||||
hrnCfgArgRawZ(argList, cfgOptStanza, "test");
|
hrnCfgArgRawZ(argList, cfgOptStanza, "test");
|
||||||
hrnCfgArgRawZ(argList, cfgOptPgPath, "/pg1");
|
hrnCfgArgRawZ(argList, cfgOptPgPath, "/pg1");
|
||||||
harnessCfgLoad(cfgCmdCheck, argList);
|
HRN_CFG_LOAD(cfgCmdCheck, argList);
|
||||||
|
|
||||||
cfgOptionIdxSet(cfgOptRepoHost, 0, cfgSourceParam, varNewStrZ("repo-host"));
|
cfgOptionIdxSet(cfgOptRepoHost, 0, cfgSourceParam, varNewStrZ("repo-host"));
|
||||||
|
|
||||||
@ -163,7 +162,7 @@ testRun(void)
|
|||||||
hrnCfgArgKeyRawZ(argList, cfgOptPgPath, 2, "/pg2");
|
hrnCfgArgKeyRawZ(argList, cfgOptPgPath, 2, "/pg2");
|
||||||
hrnCfgArgKeyRawZ(argList, cfgOptPgHost, 2, "pg2");
|
hrnCfgArgKeyRawZ(argList, cfgOptPgHost, 2, "pg2");
|
||||||
hrnCfgArgKeyRawZ(argList, cfgOptPgHostCmd, 2, "pg2-exe");
|
hrnCfgArgKeyRawZ(argList, cfgOptPgHostCmd, 2, "pg2-exe");
|
||||||
harnessCfgLoad(cfgCmdCheck, argList);
|
HRN_CFG_LOAD(cfgCmdCheck, argList);
|
||||||
|
|
||||||
TEST_RESULT_STR_Z(cfgOptionIdxStr(cfgOptPgHostCmd, 0), testProjectExe(), " check pg1-host-cmd");
|
TEST_RESULT_STR_Z(cfgOptionIdxStr(cfgOptPgHostCmd, 0), testProjectExe(), " check pg1-host-cmd");
|
||||||
TEST_RESULT_STR_Z(cfgOptionIdxStr(cfgOptPgHostCmd, 1), "pg2-exe", " check pg2-host-cmd");
|
TEST_RESULT_STR_Z(cfgOptionIdxStr(cfgOptPgHostCmd, 1), "pg2-exe", " check pg2-host-cmd");
|
||||||
@ -175,7 +174,7 @@ testRun(void)
|
|||||||
hrnCfgArgRawZ(argList, cfgOptStanza, "test");
|
hrnCfgArgRawZ(argList, cfgOptStanza, "test");
|
||||||
hrnCfgArgKeyRawZ(argList, cfgOptPgPath, 1, "/pg1");
|
hrnCfgArgKeyRawZ(argList, cfgOptPgPath, 1, "/pg1");
|
||||||
hrnCfgArgRawZ(argList, cfgOptDbTimeout, "100");
|
hrnCfgArgRawZ(argList, cfgOptDbTimeout, "100");
|
||||||
harnessCfgLoad(cfgCmdCheck, argList);
|
HRN_CFG_LOAD(cfgCmdCheck, argList);
|
||||||
|
|
||||||
cfgOptionInvalidate(cfgOptProtocolTimeout);
|
cfgOptionInvalidate(cfgOptProtocolTimeout);
|
||||||
cfgLoadUpdateOption();
|
cfgLoadUpdateOption();
|
||||||
@ -189,7 +188,7 @@ testRun(void)
|
|||||||
hrnCfgArgRawZ(argList, cfgOptStanza, "test");
|
hrnCfgArgRawZ(argList, cfgOptStanza, "test");
|
||||||
hrnCfgArgKeyRawZ(argList, cfgOptPgPath, 1, "/pg1");
|
hrnCfgArgKeyRawZ(argList, cfgOptPgPath, 1, "/pg1");
|
||||||
hrnCfgArgRawZ(argList, cfgOptProtocolTimeout, "100");
|
hrnCfgArgRawZ(argList, cfgOptProtocolTimeout, "100");
|
||||||
harnessCfgLoad(cfgCmdCheck, argList);
|
HRN_CFG_LOAD(cfgCmdCheck, argList);
|
||||||
|
|
||||||
cfgOptionInvalidate(cfgOptDbTimeout);
|
cfgOptionInvalidate(cfgOptDbTimeout);
|
||||||
cfgLoadUpdateOption();
|
cfgLoadUpdateOption();
|
||||||
@ -203,7 +202,7 @@ testRun(void)
|
|||||||
hrnCfgArgRawZ(argList, cfgOptStanza, "test");
|
hrnCfgArgRawZ(argList, cfgOptStanza, "test");
|
||||||
hrnCfgArgKeyRawZ(argList, cfgOptPgPath, 1, "/pg1");
|
hrnCfgArgKeyRawZ(argList, cfgOptPgPath, 1, "/pg1");
|
||||||
hrnCfgArgRawZ(argList, cfgOptDbTimeout, "100000");
|
hrnCfgArgRawZ(argList, cfgOptDbTimeout, "100000");
|
||||||
harnessCfgLoad(cfgCmdCheck, argList);
|
HRN_CFG_LOAD(cfgCmdCheck, argList);
|
||||||
|
|
||||||
TEST_RESULT_UINT(cfgOptionUInt64(cfgOptProtocolTimeout), 100030000, "check protocol-timeout");
|
TEST_RESULT_UINT(cfgOptionUInt64(cfgOptProtocolTimeout), 100030000, "check protocol-timeout");
|
||||||
|
|
||||||
@ -216,7 +215,7 @@ testRun(void)
|
|||||||
hrnCfgArgRawZ(argList, cfgOptDbTimeout, "100000");
|
hrnCfgArgRawZ(argList, cfgOptDbTimeout, "100000");
|
||||||
hrnCfgArgRawZ(argList, cfgOptProtocolTimeout, "50.5");
|
hrnCfgArgRawZ(argList, cfgOptProtocolTimeout, "50.5");
|
||||||
TEST_ERROR(
|
TEST_ERROR(
|
||||||
harnessCfgLoad(cfgCmdCheck, argList), OptionInvalidValueError,
|
hrnCfgLoadP(cfgCmdCheck, argList), OptionInvalidValueError,
|
||||||
"'50.5' is not valid for 'protocol-timeout' option\n"
|
"'50.5' is not valid for 'protocol-timeout' option\n"
|
||||||
"HINT 'protocol-timeout' option (50.5) should be greater than 'db-timeout' option (100000).");
|
"HINT 'protocol-timeout' option (50.5) should be greater than 'db-timeout' option (100000).");
|
||||||
|
|
||||||
@ -227,7 +226,7 @@ testRun(void)
|
|||||||
hrnCfgArgRawZ(argList, cfgOptStanza, "test");
|
hrnCfgArgRawZ(argList, cfgOptStanza, "test");
|
||||||
hrnCfgArgKeyRawZ(argList, cfgOptPgPath, 1, "/pg1");
|
hrnCfgArgKeyRawZ(argList, cfgOptPgPath, 1, "/pg1");
|
||||||
hrnCfgArgRawZ(argList, cfgOptProtocolTimeout, "11");
|
hrnCfgArgRawZ(argList, cfgOptProtocolTimeout, "11");
|
||||||
harnessCfgLoad(cfgCmdCheck, argList);
|
HRN_CFG_LOAD(cfgCmdCheck, argList);
|
||||||
|
|
||||||
TEST_RESULT_UINT(cfgOptionUInt64(cfgOptProtocolTimeout), 11000, "check protocol-timeout");
|
TEST_RESULT_UINT(cfgOptionUInt64(cfgOptProtocolTimeout), 11000, "check protocol-timeout");
|
||||||
TEST_RESULT_UINT(cfgOptionUInt64(cfgOptDbTimeout), 5500, "check db-timeout");
|
TEST_RESULT_UINT(cfgOptionUInt64(cfgOptDbTimeout), 5500, "check db-timeout");
|
||||||
@ -241,7 +240,7 @@ testRun(void)
|
|||||||
hrnCfgArgKeyRawZ(argList, cfgOptPgPath, 4, "/pg4");
|
hrnCfgArgKeyRawZ(argList, cfgOptPgPath, 4, "/pg4");
|
||||||
hrnCfgArgKeyRawZ(argList, cfgOptPgHost, 4, "pg4");
|
hrnCfgArgKeyRawZ(argList, cfgOptPgHost, 4, "pg4");
|
||||||
hrnCfgArgRawZ(argList, cfgOptRepoHost, "repo1");
|
hrnCfgArgRawZ(argList, cfgOptRepoHost, "repo1");
|
||||||
TEST_ERROR(harnessCfgLoad(cfgCmdCheck, argList), ConfigError, "pg and repo hosts cannot both be configured as remote");
|
TEST_ERROR(hrnCfgLoadP(cfgCmdCheck, argList), ConfigError, "pg and repo hosts cannot both be configured as remote");
|
||||||
|
|
||||||
// -------------------------------------------------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------------------------------------------------
|
||||||
TEST_TITLE("only pg can be remote");
|
TEST_TITLE("only pg can be remote");
|
||||||
@ -256,7 +255,7 @@ testRun(void)
|
|||||||
argList = strLstNew();
|
argList = strLstNew();
|
||||||
hrnCfgArgRawZ(argList, cfgOptRepoHost, "repo1");
|
hrnCfgArgRawZ(argList, cfgOptRepoHost, "repo1");
|
||||||
hrnCfgArgRawZ(argList, cfgOptRepo, "1");
|
hrnCfgArgRawZ(argList, cfgOptRepo, "1");
|
||||||
harnessCfgLoad(cfgCmdInfo, argList);
|
HRN_CFG_LOAD(cfgCmdInfo, argList);
|
||||||
|
|
||||||
// -------------------------------------------------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------------------------------------------------
|
||||||
argList = strLstNew();
|
argList = strLstNew();
|
||||||
@ -264,7 +263,7 @@ testRun(void)
|
|||||||
strLstAddZ(argList, "process-max");
|
strLstAddZ(argList, "process-max");
|
||||||
|
|
||||||
harnessLogLevelSet(logLevelWarn);
|
harnessLogLevelSet(logLevelWarn);
|
||||||
TEST_RESULT_VOID(harnessCfgLoad(cfgCmdHelp, argList), "load help config -- no retention warning");
|
HRN_CFG_LOAD(cfgCmdHelp, argList, .comment = "load help config -- no retention warning");
|
||||||
TEST_RESULT_BOOL(cfgCommandHelp(), true, " command is help");
|
TEST_RESULT_BOOL(cfgCommandHelp(), true, " command is help");
|
||||||
|
|
||||||
argList = strLstNew();
|
argList = strLstNew();
|
||||||
@ -272,7 +271,7 @@ testRun(void)
|
|||||||
strLstAddZ(argList, "--no-log-timestamp");
|
strLstAddZ(argList, "--no-log-timestamp");
|
||||||
|
|
||||||
harnessLogLevelSet(logLevelWarn);
|
harnessLogLevelSet(logLevelWarn);
|
||||||
TEST_RESULT_VOID(harnessCfgLoad(cfgCmdExpire, argList), "load config for retention warning");
|
HRN_CFG_LOAD(cfgCmdExpire, argList, .comment = "load config for retention warning");
|
||||||
TEST_RESULT_LOG(
|
TEST_RESULT_LOG(
|
||||||
"P00 WARN: option 'repo1-retention-full' is not set for 'repo1-retention-full-type=count', the repository may run out"
|
"P00 WARN: option 'repo1-retention-full' is not set for 'repo1-retention-full-type=count', the repository may run out"
|
||||||
" of space\n"
|
" of space\n"
|
||||||
@ -281,8 +280,8 @@ testRun(void)
|
|||||||
TEST_RESULT_BOOL(cfgOptionTest(cfgOptRepoRetentionArchive), false, " repo1-retention-archive not set");
|
TEST_RESULT_BOOL(cfgOptionTest(cfgOptRepoRetentionArchive), false, " repo1-retention-archive not set");
|
||||||
|
|
||||||
strLstAddZ(argList, "--repo1-retention-full=1");
|
strLstAddZ(argList, "--repo1-retention-full=1");
|
||||||
|
HRN_CFG_LOAD(cfgCmdExpire, argList, .comment = "load config no retention warning");
|
||||||
|
|
||||||
TEST_RESULT_VOID(harnessCfgLoad(cfgCmdExpire, argList), "load config no retention warning");
|
|
||||||
TEST_RESULT_INT(cfgOptionInt(cfgOptRepoRetentionArchive), 1, " repo1-retention-archive set");
|
TEST_RESULT_INT(cfgOptionInt(cfgOptRepoRetentionArchive), 1, " repo1-retention-archive set");
|
||||||
|
|
||||||
// Munge repo-type for coverage. This will go away when there are multiple repos.
|
// Munge repo-type for coverage. This will go away when there are multiple repos.
|
||||||
@ -293,8 +292,8 @@ testRun(void)
|
|||||||
strLstAddZ(argList, "--stanza=db");
|
strLstAddZ(argList, "--stanza=db");
|
||||||
strLstAddZ(argList, "--no-log-timestamp");
|
strLstAddZ(argList, "--no-log-timestamp");
|
||||||
strLstAddZ(argList, "--repo1-retention-archive-type=incr");
|
strLstAddZ(argList, "--repo1-retention-archive-type=incr");
|
||||||
|
HRN_CFG_LOAD(cfgCmdExpire, argList, .comment = "load config for retention warning");
|
||||||
|
|
||||||
TEST_RESULT_VOID(harnessCfgLoad(cfgCmdExpire, argList), "load config for retention warning");
|
|
||||||
TEST_RESULT_LOG(
|
TEST_RESULT_LOG(
|
||||||
"P00 WARN: option 'repo1-retention-full' is not set for 'repo1-retention-full-type=count', the repository may run out"
|
"P00 WARN: option 'repo1-retention-full' is not set for 'repo1-retention-full-type=count', the repository may run out"
|
||||||
" of space\n"
|
" of space\n"
|
||||||
@ -308,8 +307,8 @@ testRun(void)
|
|||||||
strLstAddZ(argList, "--stanza=db");
|
strLstAddZ(argList, "--stanza=db");
|
||||||
strLstAddZ(argList, "--no-log-timestamp");
|
strLstAddZ(argList, "--no-log-timestamp");
|
||||||
strLstAddZ(argList, "--repo1-retention-archive-type=diff");
|
strLstAddZ(argList, "--repo1-retention-archive-type=diff");
|
||||||
|
HRN_CFG_LOAD(cfgCmdExpire, argList, .comment = "load config for retention warning");
|
||||||
|
|
||||||
TEST_RESULT_VOID(harnessCfgLoad(cfgCmdExpire, argList), "load config for retention warning");
|
|
||||||
TEST_RESULT_LOG(
|
TEST_RESULT_LOG(
|
||||||
"P00 WARN: option 'repo1-retention-full' is not set for 'repo1-retention-full-type=count', the repository may run out"
|
"P00 WARN: option 'repo1-retention-full' is not set for 'repo1-retention-full-type=count', the repository may run out"
|
||||||
" of space\n"
|
" of space\n"
|
||||||
@ -320,8 +319,8 @@ testRun(void)
|
|||||||
TEST_RESULT_BOOL(cfgOptionTest(cfgOptRepoRetentionArchive), false, " repo1-retention-archive not set");
|
TEST_RESULT_BOOL(cfgOptionTest(cfgOptRepoRetentionArchive), false, " repo1-retention-archive not set");
|
||||||
|
|
||||||
strLstAddZ(argList, "--repo1-retention-diff=2");
|
strLstAddZ(argList, "--repo1-retention-diff=2");
|
||||||
|
HRN_CFG_LOAD(cfgCmdExpire, argList, .comment = "load config for retention warning");
|
||||||
|
|
||||||
TEST_RESULT_VOID(harnessCfgLoad(cfgCmdExpire, argList), "load config for retention warning");
|
|
||||||
TEST_RESULT_LOG(
|
TEST_RESULT_LOG(
|
||||||
"P00 WARN: option 'repo1-retention-full' is not set for 'repo1-retention-full-type=count', the repository may run out"
|
"P00 WARN: option 'repo1-retention-full' is not set for 'repo1-retention-full-type=count', the repository may run out"
|
||||||
" of space\n"
|
" of space\n"
|
||||||
@ -335,8 +334,8 @@ testRun(void)
|
|||||||
strLstAddZ(argList, "--repo1-retention-archive-type=diff");
|
strLstAddZ(argList, "--repo1-retention-archive-type=diff");
|
||||||
strLstAddZ(argList, "--repo1-retention-archive=3");
|
strLstAddZ(argList, "--repo1-retention-archive=3");
|
||||||
strLstAddZ(argList, "--repo1-retention-full=1");
|
strLstAddZ(argList, "--repo1-retention-full=1");
|
||||||
|
HRN_CFG_LOAD(cfgCmdExpire, argList, .comment = "load config for retention warning");
|
||||||
|
|
||||||
TEST_RESULT_VOID(harnessCfgLoad(cfgCmdExpire, argList), "load config for retention warning");
|
|
||||||
TEST_RESULT_LOG(
|
TEST_RESULT_LOG(
|
||||||
"P00 WARN: option 'repo1-retention-diff' is not set for 'repo1-retention-archive-type=diff'\n"
|
"P00 WARN: option 'repo1-retention-diff' is not set for 'repo1-retention-archive-type=diff'\n"
|
||||||
" HINT: to retain differential backups indefinitely (without warning), set option 'repo1-retention-diff'"
|
" HINT: to retain differential backups indefinitely (without warning), set option 'repo1-retention-diff'"
|
||||||
@ -349,8 +348,7 @@ testRun(void)
|
|||||||
strLstAddZ(argList, "--repo1-retention-archive=3");
|
strLstAddZ(argList, "--repo1-retention-archive=3");
|
||||||
strLstAddZ(argList, "--repo1-retention-diff=2");
|
strLstAddZ(argList, "--repo1-retention-diff=2");
|
||||||
strLstAddZ(argList, "--repo1-retention-full=1");
|
strLstAddZ(argList, "--repo1-retention-full=1");
|
||||||
|
HRN_CFG_LOAD(cfgCmdExpire, argList);
|
||||||
TEST_RESULT_VOID(harnessCfgLoad(cfgCmdExpire, argList), "load config with success");
|
|
||||||
|
|
||||||
argList = strLstNew();
|
argList = strLstNew();
|
||||||
strLstAddZ(argList, "--stanza=db");
|
strLstAddZ(argList, "--stanza=db");
|
||||||
@ -358,8 +356,8 @@ testRun(void)
|
|||||||
strLstAddZ(argList, "--repo1-retention-full=1");
|
strLstAddZ(argList, "--repo1-retention-full=1");
|
||||||
strLstAddZ(argList, "--repo1-retention-full-type=time");
|
strLstAddZ(argList, "--repo1-retention-full-type=time");
|
||||||
harnessLogLevelSet(logLevelWarn);
|
harnessLogLevelSet(logLevelWarn);
|
||||||
|
HRN_CFG_LOAD(cfgCmdExpire, argList, .comment = "load config: retention-full-type=time, retention-full is set");
|
||||||
|
|
||||||
TEST_RESULT_VOID(harnessCfgLoad(cfgCmdExpire, argList), "load config: retention-full-type=time, retention-full is set");
|
|
||||||
TEST_RESULT_BOOL(cfgOptionTest(cfgOptRepoRetentionArchive), false, " repo1-retention-archive not set");
|
TEST_RESULT_BOOL(cfgOptionTest(cfgOptRepoRetentionArchive), false, " repo1-retention-archive not set");
|
||||||
|
|
||||||
// -------------------------------------------------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------------------------------------------------
|
||||||
@ -377,7 +375,7 @@ testRun(void)
|
|||||||
hrnCfgArgRawZ(argList, cfgOptRepo, "2");
|
hrnCfgArgRawZ(argList, cfgOptRepo, "2");
|
||||||
|
|
||||||
TEST_ERROR(
|
TEST_ERROR(
|
||||||
harnessCfgLoad(cfgCmdArchiveGet, argList), OptionInvalidValueError,
|
hrnCfgLoadP(cfgCmdArchiveGet, argList), OptionInvalidValueError,
|
||||||
"'bogus.bucket' is not valid for option 'repo2-s3-bucket'"
|
"'bogus.bucket' is not valid for option 'repo2-s3-bucket'"
|
||||||
"\nHINT: RFC-2818 forbids dots in wildcard matches."
|
"\nHINT: RFC-2818 forbids dots in wildcard matches."
|
||||||
"\nHINT: TLS/SSL verification cannot proceed with this bucket name."
|
"\nHINT: TLS/SSL verification cannot proceed with this bucket name."
|
||||||
@ -399,8 +397,8 @@ testRun(void)
|
|||||||
strLstAddZ(argList, "--repo1-s3-endpoint=endpoint");
|
strLstAddZ(argList, "--repo1-s3-endpoint=endpoint");
|
||||||
strLstAddZ(argList, "--no-repo1-s3-verify-ssl");
|
strLstAddZ(argList, "--no-repo1-s3-verify-ssl");
|
||||||
strLstAddZ(argList, "--repo1-path=/repo");
|
strLstAddZ(argList, "--repo1-path=/repo");
|
||||||
|
HRN_CFG_LOAD(cfgCmdArchiveGet, argList, .comment = "invalid bucket with no verification");
|
||||||
|
|
||||||
TEST_RESULT_VOID(harnessCfgLoad(cfgCmdArchiveGet, argList), "invalid bucket with no verification");
|
|
||||||
TEST_RESULT_STR_Z(cfgOptionStr(cfgOptRepoS3Bucket), "bogus.bucket", " check bucket value");
|
TEST_RESULT_STR_Z(cfgOptionStr(cfgOptRepoS3Bucket), "bogus.bucket", " check bucket value");
|
||||||
|
|
||||||
// Valid bucket name
|
// Valid bucket name
|
||||||
@ -412,8 +410,8 @@ testRun(void)
|
|||||||
strLstAddZ(argList, "--repo1-s3-region=region");
|
strLstAddZ(argList, "--repo1-s3-region=region");
|
||||||
strLstAddZ(argList, "--repo1-s3-endpoint=endpoint");
|
strLstAddZ(argList, "--repo1-s3-endpoint=endpoint");
|
||||||
strLstAddZ(argList, "--repo1-path=/repo");
|
strLstAddZ(argList, "--repo1-path=/repo");
|
||||||
|
HRN_CFG_LOAD(cfgCmdArchiveGet, argList, .comment = "valid bucket name");
|
||||||
|
|
||||||
TEST_RESULT_VOID(harnessCfgLoad(cfgCmdArchiveGet, argList), "valid bucket name");
|
|
||||||
TEST_RESULT_STR_Z(cfgOptionStr(cfgOptRepoS3Bucket), "cool-bucket", " check bucket value");
|
TEST_RESULT_STR_Z(cfgOptionStr(cfgOptRepoS3Bucket), "cool-bucket", " check bucket value");
|
||||||
TEST_RESULT_BOOL(cfgOptionValid(cfgOptCompress), false, " compress is not valid");
|
TEST_RESULT_BOOL(cfgOptionValid(cfgOptCompress), false, " compress is not valid");
|
||||||
|
|
||||||
@ -426,8 +424,8 @@ testRun(void)
|
|||||||
argList = strLstNew();
|
argList = strLstNew();
|
||||||
strLstAddZ(argList, "--" CFGOPT_STANZA "=db");
|
strLstAddZ(argList, "--" CFGOPT_STANZA "=db");
|
||||||
strLstAddZ(argList, "--no-" CFGOPT_COMPRESS);
|
strLstAddZ(argList, "--no-" CFGOPT_COMPRESS);
|
||||||
|
HRN_CFG_LOAD(cfgCmdArchivePush, argList);
|
||||||
|
|
||||||
TEST_RESULT_VOID(harnessCfgLoad(cfgCmdArchivePush, argList), "load config");
|
|
||||||
TEST_RESULT_STR_Z(cfgOptionStr(cfgOptCompressType), "none", " compress-type=none");
|
TEST_RESULT_STR_Z(cfgOptionStr(cfgOptCompressType), "none", " compress-type=none");
|
||||||
TEST_RESULT_INT(cfgOptionInt(cfgOptCompressLevel), 0, " compress-level=0");
|
TEST_RESULT_INT(cfgOptionInt(cfgOptCompressLevel), 0, " compress-level=0");
|
||||||
TEST_RESULT_BOOL(cfgOptionValid(cfgOptCompress), false, " compress is not valid");
|
TEST_RESULT_BOOL(cfgOptionValid(cfgOptCompress), false, " compress is not valid");
|
||||||
@ -439,8 +437,8 @@ testRun(void)
|
|||||||
strLstAddZ(argList, "--" CFGOPT_STANZA "=db");
|
strLstAddZ(argList, "--" CFGOPT_STANZA "=db");
|
||||||
strLstAddZ(argList, "--" CFGOPT_COMPRESS);
|
strLstAddZ(argList, "--" CFGOPT_COMPRESS);
|
||||||
strLstAddZ(argList, "--" CFGOPT_COMPRESS_LEVEL "=9");
|
strLstAddZ(argList, "--" CFGOPT_COMPRESS_LEVEL "=9");
|
||||||
|
HRN_CFG_LOAD(cfgCmdArchivePush, argList);
|
||||||
|
|
||||||
TEST_RESULT_VOID(harnessCfgLoad(cfgCmdArchivePush, argList), "load config");
|
|
||||||
TEST_RESULT_STR_Z(cfgOptionStr(cfgOptCompressType), "gz", " compress-type=gz");
|
TEST_RESULT_STR_Z(cfgOptionStr(cfgOptCompressType), "gz", " compress-type=gz");
|
||||||
TEST_RESULT_INT(cfgOptionInt(cfgOptCompressLevel), 9, " compress-level=9");
|
TEST_RESULT_INT(cfgOptionInt(cfgOptCompressLevel), 9, " compress-level=9");
|
||||||
TEST_RESULT_BOOL(cfgOptionValid(cfgOptCompress), false, " compress is not valid");
|
TEST_RESULT_BOOL(cfgOptionValid(cfgOptCompress), false, " compress is not valid");
|
||||||
@ -452,8 +450,8 @@ testRun(void)
|
|||||||
strLstAddZ(argList, "--" CFGOPT_STANZA "=db");
|
strLstAddZ(argList, "--" CFGOPT_STANZA "=db");
|
||||||
strLstAddZ(argList, "--no-" CFGOPT_COMPRESS);
|
strLstAddZ(argList, "--no-" CFGOPT_COMPRESS);
|
||||||
strLstAddZ(argList, "--" CFGOPT_COMPRESS_TYPE "=gz");
|
strLstAddZ(argList, "--" CFGOPT_COMPRESS_TYPE "=gz");
|
||||||
|
HRN_CFG_LOAD(cfgCmdArchivePush, argList);
|
||||||
|
|
||||||
TEST_RESULT_VOID(harnessCfgLoad(cfgCmdArchivePush, argList), "load config");
|
|
||||||
TEST_RESULT_STR_Z(cfgOptionStr(cfgOptCompressType), "gz", " compress-type=gz");
|
TEST_RESULT_STR_Z(cfgOptionStr(cfgOptCompressType), "gz", " compress-type=gz");
|
||||||
TEST_RESULT_INT(cfgOptionInt(cfgOptCompressLevel), 6, " compress-level=6");
|
TEST_RESULT_INT(cfgOptionInt(cfgOptCompressLevel), 6, " compress-level=6");
|
||||||
TEST_RESULT_BOOL(cfgOptionValid(cfgOptCompress), false, " compress is not valid");
|
TEST_RESULT_BOOL(cfgOptionValid(cfgOptCompress), false, " compress is not valid");
|
||||||
|
@ -1635,14 +1635,14 @@ testRun(void)
|
|||||||
|
|
||||||
argList = strLstNew();
|
argList = strLstNew();
|
||||||
hrnCfgArgRawZ(argList, cfgOptLogLevelFile, "detail");
|
hrnCfgArgRawZ(argList, cfgOptLogLevelFile, "detail");
|
||||||
TEST_RESULT_VOID(harnessCfgLoad(cfgCmdInfo, argList), "info command");
|
HRN_CFG_LOAD(cfgCmdInfo, argList);
|
||||||
|
|
||||||
TEST_RESULT_BOOL(cfgLogFile(), true, " check logging");
|
TEST_RESULT_BOOL(cfgLogFile(), true, " check logging");
|
||||||
|
|
||||||
// -------------------------------------------------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------------------------------------------------
|
||||||
TEST_TITLE("version command does not do file logging");
|
TEST_TITLE("version command does not do file logging");
|
||||||
|
|
||||||
TEST_RESULT_VOID(harnessCfgLoad(cfgCmdVersion, strLstNew()), "version command");
|
HRN_CFG_LOAD(cfgCmdVersion, strLstNew());
|
||||||
TEST_RESULT_BOOL(cfgLogFile(), false, " check logging");
|
TEST_RESULT_BOOL(cfgLogFile(), false, " check logging");
|
||||||
|
|
||||||
// -------------------------------------------------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------------------------------------------------
|
||||||
@ -1652,7 +1652,7 @@ testRun(void)
|
|||||||
// hrnCfgArgRawZ(argList, cfgOptStanza, "test");
|
// hrnCfgArgRawZ(argList, cfgOptStanza, "test");
|
||||||
// hrnCfgArgKeyRawZ(argList, cfgOptPgPath, 2, "/pg2");
|
// hrnCfgArgKeyRawZ(argList, cfgOptPgPath, 2, "/pg2");
|
||||||
// hrnCfgArgKeyRawZ(argList, cfgOptPgPath, 8, "/pg8");
|
// hrnCfgArgKeyRawZ(argList, cfgOptPgPath, 8, "/pg8");
|
||||||
// TEST_RESULT_VOID(harnessCfgLoad(cfgCmdCheck, argList), "check command");
|
// HRN_CFG_LOAD(cfgCmdCheck, argList);
|
||||||
//
|
//
|
||||||
// TEST_RESULT_STR_Z(cfgOptionIdxStr(cfgOptPgPath, 0), "/pg2", "check pg1-path");
|
// TEST_RESULT_STR_Z(cfgOptionIdxStr(cfgOptPgPath, 0), "/pg2", "check pg1-path");
|
||||||
// TEST_RESULT_STR_Z(cfgOptionIdxStr(cfgOptPgPath, cfgOptionKeyToIdx(cfgOptPgPath, 8)), "/pg8", "check pg8-path");
|
// TEST_RESULT_STR_Z(cfgOptionIdxStr(cfgOptPgPath, cfgOptionKeyToIdx(cfgOptPgPath, 8)), "/pg8", "check pg8-path");
|
||||||
@ -1666,7 +1666,7 @@ testRun(void)
|
|||||||
hrnCfgArgKeyRawZ(argList, cfgOptPgPath, 8, "/pg8");
|
hrnCfgArgKeyRawZ(argList, cfgOptPgPath, 8, "/pg8");
|
||||||
hrnCfgArgRawZ(argList, cfgOptPg, "4");
|
hrnCfgArgRawZ(argList, cfgOptPg, "4");
|
||||||
TEST_ERROR(
|
TEST_ERROR(
|
||||||
harnessCfgLoadRole(cfgCmdBackup, cfgCmdRoleLocal, argList), OptionInvalidValueError,
|
hrnCfgLoadP(cfgCmdBackup, argList, .role = cfgCmdRoleLocal), OptionInvalidValueError,
|
||||||
"key '4' is not valid for 'pg' option");
|
"key '4' is not valid for 'pg' option");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34,7 +34,7 @@ testRun(void)
|
|||||||
hrnCfgArgRawZ(argList, cfgOptPgPath, "/path/to/pg");
|
hrnCfgArgRawZ(argList, cfgOptPgPath, "/path/to/pg");
|
||||||
strLstAddZ(argList, "--repo1-host=repo-host");
|
strLstAddZ(argList, "--repo1-host=repo-host");
|
||||||
strLstAddZ(argList, "--repo1-host-user=repo-host-user");
|
strLstAddZ(argList, "--repo1-host-user=repo-host-user");
|
||||||
harnessCfgLoad(cfgCmdArchiveGet, argList);
|
HRN_CFG_LOAD(cfgCmdArchiveGet, argList);
|
||||||
|
|
||||||
ProtocolServer *server = protocolServerNew(STRDEF("test"), STRDEF("config"), read, write);
|
ProtocolServer *server = protocolServerNew(STRDEF("test"), STRDEF("config"), read, write);
|
||||||
|
|
||||||
|
@ -75,7 +75,7 @@ testRun(void)
|
|||||||
strLstAddZ(argList, "--pg1-database=testdb");
|
strLstAddZ(argList, "--pg1-database=testdb");
|
||||||
hrnCfgArgRawStrId(argList, cfgOptRemoteType, protocolStorageTypePg);
|
hrnCfgArgRawStrId(argList, cfgOptRemoteType, protocolStorageTypePg);
|
||||||
strLstAddZ(argList, "--process=0");
|
strLstAddZ(argList, "--process=0");
|
||||||
harnessCfgLoadRole(cfgCmdBackup, cfgCmdRoleRemote, argList);
|
HRN_CFG_LOAD(cfgCmdBackup, argList, .role = cfgCmdRoleRemote);
|
||||||
|
|
||||||
// Set script
|
// Set script
|
||||||
harnessPqScriptSet((HarnessPq [])
|
harnessPqScriptSet((HarnessPq [])
|
||||||
@ -149,7 +149,7 @@ testRun(void)
|
|||||||
strLstAddZ(argList, "--repo1-retention-full=1");
|
strLstAddZ(argList, "--repo1-retention-full=1");
|
||||||
strLstAddZ(argList, "--pg1-path=/pg1");
|
strLstAddZ(argList, "--pg1-path=/pg1");
|
||||||
strLstAddZ(argList, "--pg1-database=backupdb");
|
strLstAddZ(argList, "--pg1-database=backupdb");
|
||||||
harnessCfgLoad(cfgCmdBackup, argList);
|
HRN_CFG_LOAD(cfgCmdBackup, argList);
|
||||||
|
|
||||||
// -------------------------------------------------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------------------------------------------------
|
||||||
TEST_TITLE("error when unable to select any pg_settings");
|
TEST_TITLE("error when unable to select any pg_settings");
|
||||||
@ -365,7 +365,7 @@ testRun(void)
|
|||||||
strLstAddZ(argList, "--pg1-path=/pg1");
|
strLstAddZ(argList, "--pg1-path=/pg1");
|
||||||
strLstAddZ(argList, "--pg2-path=/pg2");
|
strLstAddZ(argList, "--pg2-path=/pg2");
|
||||||
strLstAddZ(argList, "--pg2-port=5433");
|
strLstAddZ(argList, "--pg2-port=5433");
|
||||||
harnessCfgLoad(cfgCmdBackup, argList);
|
HRN_CFG_LOAD(cfgCmdBackup, argList);
|
||||||
|
|
||||||
harnessPqScriptSet((HarnessPq [])
|
harnessPqScriptSet((HarnessPq [])
|
||||||
{
|
{
|
||||||
@ -504,7 +504,7 @@ testRun(void)
|
|||||||
strLstAddZ(argList, "--repo1-retention-full=1");
|
strLstAddZ(argList, "--repo1-retention-full=1");
|
||||||
strLstAddZ(argList, "--pg1-path=/path/to/pg");
|
strLstAddZ(argList, "--pg1-path=/path/to/pg");
|
||||||
strLstAddZ(argList, "--pg1-user=bob");
|
strLstAddZ(argList, "--pg1-user=bob");
|
||||||
harnessCfgLoad(cfgCmdBackup, argList);
|
HRN_CFG_LOAD(cfgCmdBackup, argList);
|
||||||
|
|
||||||
harnessPqScriptSet((HarnessPq [])
|
harnessPqScriptSet((HarnessPq [])
|
||||||
{
|
{
|
||||||
@ -581,7 +581,7 @@ testRun(void)
|
|||||||
strLstAddZ(argList, "--pg1-path=/path/to/pg1");
|
strLstAddZ(argList, "--pg1-path=/path/to/pg1");
|
||||||
strLstAddZ(argList, "--pg8-path=/path/to/pg2");
|
strLstAddZ(argList, "--pg8-path=/path/to/pg2");
|
||||||
strLstAddZ(argList, "--pg8-port=5433");
|
strLstAddZ(argList, "--pg8-port=5433");
|
||||||
harnessCfgLoad(cfgCmdBackup, argList);
|
HRN_CFG_LOAD(cfgCmdBackup, argList);
|
||||||
|
|
||||||
harnessPqScriptSet((HarnessPq [])
|
harnessPqScriptSet((HarnessPq [])
|
||||||
{
|
{
|
||||||
@ -646,7 +646,7 @@ testRun(void)
|
|||||||
strLstAddZ(argList, "--pg5-path=/path/to/pg5");
|
strLstAddZ(argList, "--pg5-path=/path/to/pg5");
|
||||||
strLstAddZ(argList, "--pg8-path=/path/to/pg8");
|
strLstAddZ(argList, "--pg8-path=/path/to/pg8");
|
||||||
strLstAddZ(argList, "--pg8-port=5434");
|
strLstAddZ(argList, "--pg8-port=5434");
|
||||||
harnessCfgLoad(cfgCmdBackup, argList);
|
HRN_CFG_LOAD(cfgCmdBackup, argList);
|
||||||
|
|
||||||
harnessPqScriptSet((HarnessPq [])
|
harnessPqScriptSet((HarnessPq [])
|
||||||
{
|
{
|
||||||
|
@ -451,7 +451,7 @@ testRun(void)
|
|||||||
strLstAddZ(argList, "--stanza=db");
|
strLstAddZ(argList, "--stanza=db");
|
||||||
hrnCfgArgRawZ(argList, cfgOptPgPath, "/path/to/pg");
|
hrnCfgArgRawZ(argList, cfgOptPgPath, "/path/to/pg");
|
||||||
strLstAddZ(argList, "--repo-path=" TEST_PATH);
|
strLstAddZ(argList, "--repo-path=" TEST_PATH);
|
||||||
harnessCfgLoad(cfgCmdArchiveGet, argList);
|
HRN_CFG_LOAD(cfgCmdArchiveGet, argList);
|
||||||
|
|
||||||
// Create manifest for upgrade db (id=2), save to disk
|
// Create manifest for upgrade db (id=2), save to disk
|
||||||
manifestContent = harnessInfoChecksumZ
|
manifestContent = harnessInfoChecksumZ
|
||||||
|
@ -156,7 +156,7 @@ testRun(void)
|
|||||||
strLstAddZ(argList, "--" CFGOPT_STANZA "=test");
|
strLstAddZ(argList, "--" CFGOPT_STANZA "=test");
|
||||||
strLstAddZ(argList, "--" CFGOPT_PROCESS "=0");
|
strLstAddZ(argList, "--" CFGOPT_PROCESS "=0");
|
||||||
hrnCfgArgRawStrId(argList, cfgOptRemoteType, protocolStorageTypeRepo);
|
hrnCfgArgRawStrId(argList, cfgOptRemoteType, protocolStorageTypeRepo);
|
||||||
harnessCfgLoadRole(cfgCmdArchivePush, cfgCmdRoleRemote, argList);
|
HRN_CFG_LOAD(cfgCmdArchivePush, argList, .role = cfgCmdRoleRemote);
|
||||||
|
|
||||||
// Create a driver to test remote performance of storageInfoList() and inject it into storageRepo()
|
// Create a driver to test remote performance of storageInfoList() and inject it into storageRepo()
|
||||||
StorageTestPerfInfoList driver =
|
StorageTestPerfInfoList driver =
|
||||||
|
@ -155,15 +155,13 @@ testRun(void)
|
|||||||
if (testBegin("repoIsLocal() and pgIsLocal()"))
|
if (testBegin("repoIsLocal() and pgIsLocal()"))
|
||||||
{
|
{
|
||||||
StringList *argList = strLstNew();
|
StringList *argList = strLstNew();
|
||||||
strLstAddZ(argList, "pgbackrest");
|
|
||||||
strLstAddZ(argList, "--stanza=test1");
|
strLstAddZ(argList, "--stanza=test1");
|
||||||
hrnCfgArgRawZ(argList, cfgOptPgPath, "/path/to/pg");
|
hrnCfgArgRawZ(argList, cfgOptPgPath, "/path/to/pg");
|
||||||
strLstAddZ(argList, "--repo1-path=/repo-local");
|
strLstAddZ(argList, "--repo1-path=/repo-local");
|
||||||
strLstAddZ(argList, "--repo4-path=/remote-host-new");
|
strLstAddZ(argList, "--repo4-path=/remote-host-new");
|
||||||
strLstAddZ(argList, "--repo4-host=remote-host-new");
|
strLstAddZ(argList, "--repo4-host=remote-host-new");
|
||||||
hrnCfgArgRawZ(argList, cfgOptRepo, "1");
|
hrnCfgArgRawZ(argList, cfgOptRepo, "1");
|
||||||
strLstAddZ(argList, "archive-get");
|
HRN_CFG_LOAD(cfgCmdArchiveGet, argList, .noStd = true);
|
||||||
harnessCfgLoadRaw(strLstSize(argList), strLstPtr(argList));
|
|
||||||
|
|
||||||
TEST_RESULT_BOOL(repoIsLocal(0), true, "repo is local");
|
TEST_RESULT_BOOL(repoIsLocal(0), true, "repo is local");
|
||||||
TEST_RESULT_VOID(repoIsLocalVerify(), " local verified");
|
TEST_RESULT_VOID(repoIsLocalVerify(), " local verified");
|
||||||
@ -174,12 +172,10 @@ testRun(void)
|
|||||||
|
|
||||||
// -------------------------------------------------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------------------------------------------------
|
||||||
argList = strLstNew();
|
argList = strLstNew();
|
||||||
strLstAddZ(argList, "pgbackrest");
|
|
||||||
strLstAddZ(argList, "--stanza=test1");
|
strLstAddZ(argList, "--stanza=test1");
|
||||||
hrnCfgArgRawZ(argList, cfgOptPgPath, "/path/to/pg");
|
hrnCfgArgRawZ(argList, cfgOptPgPath, "/path/to/pg");
|
||||||
strLstAddZ(argList, "--repo1-host=remote-host");
|
strLstAddZ(argList, "--repo1-host=remote-host");
|
||||||
strLstAddZ(argList, "archive-get");
|
HRN_CFG_LOAD(cfgCmdArchiveGet, argList, .noStd = true);
|
||||||
harnessCfgLoadRaw(strLstSize(argList), strLstPtr(argList));
|
|
||||||
|
|
||||||
TEST_RESULT_BOOL(repoIsLocal(0), false, "repo is remote");
|
TEST_RESULT_BOOL(repoIsLocal(0), false, "repo is remote");
|
||||||
TEST_ERROR(repoIsLocalVerify(), HostInvalidError, "archive-get command must be run on the repository host");
|
TEST_ERROR(repoIsLocalVerify(), HostInvalidError, "archive-get command must be run on the repository host");
|
||||||
@ -188,12 +184,10 @@ testRun(void)
|
|||||||
TEST_TITLE("pg1 is local");
|
TEST_TITLE("pg1 is local");
|
||||||
|
|
||||||
argList = strLstNew();
|
argList = strLstNew();
|
||||||
strLstAddZ(argList, "pgbackrest");
|
|
||||||
strLstAddZ(argList, "--stanza=test1");
|
strLstAddZ(argList, "--stanza=test1");
|
||||||
strLstAddZ(argList, "--pg1-path=/path/to");
|
strLstAddZ(argList, "--pg1-path=/path/to");
|
||||||
strLstAddZ(argList, "--repo1-retention-full=1");
|
strLstAddZ(argList, "--repo1-retention-full=1");
|
||||||
strLstAddZ(argList, "backup");
|
HRN_CFG_LOAD(cfgCmdBackup, argList, .noStd = true);
|
||||||
harnessCfgLoadRaw(strLstSize(argList), strLstPtr(argList));
|
|
||||||
|
|
||||||
TEST_RESULT_BOOL(pgIsLocal(0), true, "pg is local");
|
TEST_RESULT_BOOL(pgIsLocal(0), true, "pg is local");
|
||||||
TEST_RESULT_VOID(pgIsLocalVerify(), "verify pg is local");
|
TEST_RESULT_VOID(pgIsLocalVerify(), "verify pg is local");
|
||||||
@ -202,12 +196,10 @@ testRun(void)
|
|||||||
TEST_TITLE("pg1 is not local");
|
TEST_TITLE("pg1 is not local");
|
||||||
|
|
||||||
argList = strLstNew();
|
argList = strLstNew();
|
||||||
strLstAddZ(argList, "pgbackrest");
|
|
||||||
strLstAddZ(argList, "--" CFGOPT_STANZA "=test1");
|
strLstAddZ(argList, "--" CFGOPT_STANZA "=test1");
|
||||||
hrnCfgArgRawZ(argList, cfgOptPgHost, "test1");
|
hrnCfgArgRawZ(argList, cfgOptPgHost, "test1");
|
||||||
strLstAddZ(argList, "--pg1-path=/path/to");
|
strLstAddZ(argList, "--pg1-path=/path/to");
|
||||||
strLstAddZ(argList, "restore");
|
HRN_CFG_LOAD(cfgCmdRestore, argList, .noStd = true);
|
||||||
harnessCfgLoadRaw(strLstSize(argList), strLstPtr(argList));
|
|
||||||
|
|
||||||
TEST_RESULT_BOOL(pgIsLocal(0), false, "pg1 is remote");
|
TEST_RESULT_BOOL(pgIsLocal(0), false, "pg1 is remote");
|
||||||
TEST_ERROR(pgIsLocalVerify(), HostInvalidError, "restore command must be run on the PostgreSQL host");
|
TEST_ERROR(pgIsLocalVerify(), HostInvalidError, "restore command must be run on the PostgreSQL host");
|
||||||
@ -216,7 +208,6 @@ testRun(void)
|
|||||||
TEST_TITLE("pg7 is not local");
|
TEST_TITLE("pg7 is not local");
|
||||||
|
|
||||||
argList = strLstNew();
|
argList = strLstNew();
|
||||||
strLstAddZ(argList, "pgbackrest");
|
|
||||||
strLstAddZ(argList, "--stanza=test1");
|
strLstAddZ(argList, "--stanza=test1");
|
||||||
hrnCfgArgRawZ(argList, cfgOptPgPath, "/path/to/bogus");
|
hrnCfgArgRawZ(argList, cfgOptPgPath, "/path/to/bogus");
|
||||||
strLstAddZ(argList, "--pg7-path=/path/to");
|
strLstAddZ(argList, "--pg7-path=/path/to");
|
||||||
@ -224,8 +215,7 @@ testRun(void)
|
|||||||
hrnCfgArgRawZ(argList, cfgOptPg, "7");
|
hrnCfgArgRawZ(argList, cfgOptPg, "7");
|
||||||
hrnCfgArgRawStrId(argList, cfgOptRemoteType, protocolStorageTypePg);
|
hrnCfgArgRawStrId(argList, cfgOptRemoteType, protocolStorageTypePg);
|
||||||
strLstAddZ(argList, "--process=0");
|
strLstAddZ(argList, "--process=0");
|
||||||
strLstAddZ(argList, CFGCMD_BACKUP ":" CONFIG_COMMAND_ROLE_LOCAL);
|
HRN_CFG_LOAD(cfgCmdBackup, argList, .role = cfgCmdRoleLocal, .noStd = true);
|
||||||
harnessCfgLoadRaw(strLstSize(argList), strLstPtr(argList));
|
|
||||||
|
|
||||||
TEST_RESULT_BOOL(pgIsLocal(1), false, "pg7 is remote");
|
TEST_RESULT_BOOL(pgIsLocal(1), false, "pg7 is remote");
|
||||||
}
|
}
|
||||||
@ -255,11 +245,9 @@ testRun(void)
|
|||||||
if (testBegin("protocolLocalParam()"))
|
if (testBegin("protocolLocalParam()"))
|
||||||
{
|
{
|
||||||
StringList *argList = strLstNew();
|
StringList *argList = strLstNew();
|
||||||
strLstAddZ(argList, "pgbackrest");
|
|
||||||
strLstAddZ(argList, "--stanza=test1");
|
strLstAddZ(argList, "--stanza=test1");
|
||||||
hrnCfgArgRawZ(argList, cfgOptPgPath, "/path/to/pg");
|
hrnCfgArgRawZ(argList, cfgOptPgPath, "/path/to/pg");
|
||||||
strLstAddZ(argList, "archive-get");
|
HRN_CFG_LOAD(cfgCmdArchiveGet, argList, .noStd = true);
|
||||||
harnessCfgLoadRaw(strLstSize(argList), strLstPtr(argList));
|
|
||||||
|
|
||||||
TEST_RESULT_STRLST_Z(
|
TEST_RESULT_STRLST_Z(
|
||||||
protocolLocalParam(protocolStorageTypeRepo, 0, 0),
|
protocolLocalParam(protocolStorageTypeRepo, 0, 0),
|
||||||
@ -269,13 +257,11 @@ testRun(void)
|
|||||||
|
|
||||||
// -------------------------------------------------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------------------------------------------------
|
||||||
argList = strLstNew();
|
argList = strLstNew();
|
||||||
strLstAddZ(argList, "pgbackrest");
|
|
||||||
strLstAddZ(argList, "--stanza=test1");
|
strLstAddZ(argList, "--stanza=test1");
|
||||||
strLstAddZ(argList, "--pg1-path=/pg");
|
strLstAddZ(argList, "--pg1-path=/pg");
|
||||||
strLstAddZ(argList, "--repo1-retention-full=1");
|
strLstAddZ(argList, "--repo1-retention-full=1");
|
||||||
strLstAddZ(argList, "--log-subprocess");
|
strLstAddZ(argList, "--log-subprocess");
|
||||||
strLstAddZ(argList, "backup");
|
HRN_CFG_LOAD(cfgCmdBackup, argList, .noStd = true);
|
||||||
harnessCfgLoadRaw(strLstSize(argList), strLstPtr(argList));
|
|
||||||
|
|
||||||
TEST_RESULT_STRLST_Z(
|
TEST_RESULT_STRLST_Z(
|
||||||
protocolLocalParam(protocolStorageTypePg, 0, 1),
|
protocolLocalParam(protocolStorageTypePg, 0, 1),
|
||||||
@ -290,7 +276,6 @@ testRun(void)
|
|||||||
storagePutP(storageNewWriteP(storageTest, STRDEF("pgbackrest.conf")), bufNew(0));
|
storagePutP(storageNewWriteP(storageTest, STRDEF("pgbackrest.conf")), bufNew(0));
|
||||||
|
|
||||||
StringList *argList = strLstNew();
|
StringList *argList = strLstNew();
|
||||||
strLstAddZ(argList, "pgbackrest");
|
|
||||||
strLstAddZ(argList, "--stanza=test1");
|
strLstAddZ(argList, "--stanza=test1");
|
||||||
hrnCfgArgRawZ(argList, cfgOptPgPath, "/path/to/pg");
|
hrnCfgArgRawZ(argList, cfgOptPgPath, "/path/to/pg");
|
||||||
strLstAddZ(argList, "--repo1-host=repo-host");
|
strLstAddZ(argList, "--repo1-host=repo-host");
|
||||||
@ -299,19 +284,17 @@ testRun(void)
|
|||||||
strLstAddZ(argList, "--config=" TEST_PATH "/pgbackrest.conf");
|
strLstAddZ(argList, "--config=" TEST_PATH "/pgbackrest.conf");
|
||||||
strLstAddZ(argList, "--config-include-path=" TEST_PATH);
|
strLstAddZ(argList, "--config-include-path=" TEST_PATH);
|
||||||
strLstAddZ(argList, "--config-path=" TEST_PATH);
|
strLstAddZ(argList, "--config-path=" TEST_PATH);
|
||||||
strLstAddZ(argList, "archive-get");
|
HRN_CFG_LOAD(cfgCmdArchiveGet, argList, .noStd = true);
|
||||||
harnessCfgLoadRaw(strLstSize(argList), strLstPtr(argList));
|
|
||||||
|
|
||||||
TEST_RESULT_STRLST_Z(
|
TEST_RESULT_STRLST_Z(
|
||||||
protocolRemoteParamSsh(protocolStorageTypeRepo, 0),
|
protocolRemoteParamSsh(protocolStorageTypeRepo, 0),
|
||||||
"-o\nLogLevel=error\n-o\nCompression=no\n-o\nPasswordAuthentication=no\nrepo-host-user@repo-host\n"
|
"-o\nLogLevel=error\n-o\nCompression=no\n-o\nPasswordAuthentication=no\nrepo-host-user@repo-host\n"
|
||||||
"pgbackrest --exec-id=1-test --log-level-console=off --log-level-file=off --log-level-stderr=error"
|
TEST_PROJECT_EXE " --exec-id=1-test --log-level-console=off --log-level-file=off --log-level-stderr=error"
|
||||||
" --pg1-path=/path/to/pg --process=0 --remote-type=repo --repo=1 --stanza=test1 archive-get:remote\n",
|
" --pg1-path=/path/to/pg --process=0 --remote-type=repo --repo=1 --stanza=test1 archive-get:remote\n",
|
||||||
"remote protocol params");
|
"remote protocol params");
|
||||||
|
|
||||||
// -------------------------------------------------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------------------------------------------------
|
||||||
argList = strLstNew();
|
argList = strLstNew();
|
||||||
strLstAddZ(argList, "pgbackrest");
|
|
||||||
strLstAddZ(argList, "--stanza=test1");
|
strLstAddZ(argList, "--stanza=test1");
|
||||||
strLstAddZ(argList, "--log-subprocess");
|
strLstAddZ(argList, "--log-subprocess");
|
||||||
hrnCfgArgRawZ(argList, cfgOptPgPath, "/unused"); // Will be passed to remote (required)
|
hrnCfgArgRawZ(argList, cfgOptPgPath, "/unused"); // Will be passed to remote (required)
|
||||||
@ -322,56 +305,50 @@ testRun(void)
|
|||||||
strLstAddZ(argList, "--repo1-host-config-include-path=/path/include");
|
strLstAddZ(argList, "--repo1-host-config-include-path=/path/include");
|
||||||
strLstAddZ(argList, "--repo1-host-config-path=/path/config");
|
strLstAddZ(argList, "--repo1-host-config-path=/path/config");
|
||||||
strLstAddZ(argList, "--repo1-host-user=repo-host-user");
|
strLstAddZ(argList, "--repo1-host-user=repo-host-user");
|
||||||
strLstAddZ(argList, CFGCMD_CHECK);
|
HRN_CFG_LOAD(cfgCmdCheck, argList, .noStd = true);
|
||||||
harnessCfgLoadRaw(strLstSize(argList), strLstPtr(argList));
|
|
||||||
|
|
||||||
TEST_RESULT_STRLST_Z(
|
TEST_RESULT_STRLST_Z(
|
||||||
protocolRemoteParamSsh(protocolStorageTypeRepo, 0),
|
protocolRemoteParamSsh(protocolStorageTypeRepo, 0),
|
||||||
"-o\nLogLevel=error\n-o\nCompression=no\n-o\nPasswordAuthentication=no\n-p\n444\nrepo-host-user@repo-host\n"
|
"-o\nLogLevel=error\n-o\nCompression=no\n-o\nPasswordAuthentication=no\n-p\n444\nrepo-host-user@repo-host\n"
|
||||||
"pgbackrest --config=/path/pgbackrest.conf --config-include-path=/path/include --config-path=/path/config"
|
TEST_PROJECT_EXE " --config=/path/pgbackrest.conf --config-include-path=/path/include --config-path=/path/config"
|
||||||
" --exec-id=1-test --log-level-console=off --log-level-file=info --log-level-stderr=error --log-subprocess"
|
" --exec-id=1-test --log-level-console=off --log-level-file=info --log-level-stderr=error --log-subprocess"
|
||||||
" --pg1-path=/unused --process=0 --remote-type=repo --repo=1 --stanza=test1 check:remote\n",
|
" --pg1-path=/unused --process=0 --remote-type=repo --repo=1 --stanza=test1 check:remote\n",
|
||||||
"remote protocol params with replacements");
|
"remote protocol params with replacements");
|
||||||
|
|
||||||
// -------------------------------------------------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------------------------------------------------
|
||||||
argList = strLstNew();
|
argList = strLstNew();
|
||||||
strLstAddZ(argList, "pgbackrest");
|
|
||||||
strLstAddZ(argList, "--stanza=test1");
|
strLstAddZ(argList, "--stanza=test1");
|
||||||
hrnCfgArgRawZ(argList, cfgOptPgPath, "/path/to/pg");
|
hrnCfgArgRawZ(argList, cfgOptPgPath, "/path/to/pg");
|
||||||
strLstAddZ(argList, "--process=3");
|
strLstAddZ(argList, "--process=3");
|
||||||
hrnCfgArgRawZ(argList, cfgOptRepo, "1");
|
hrnCfgArgRawZ(argList, cfgOptRepo, "1");
|
||||||
hrnCfgArgRawStrId(argList, cfgOptRemoteType, protocolStorageTypeRepo);
|
hrnCfgArgRawStrId(argList, cfgOptRemoteType, protocolStorageTypeRepo);
|
||||||
strLstAddZ(argList, "--repo1-host=repo-host");
|
strLstAddZ(argList, "--repo1-host=repo-host");
|
||||||
strLstAddZ(argList, CFGCMD_ARCHIVE_GET ":" CONFIG_COMMAND_ROLE_LOCAL);
|
HRN_CFG_LOAD(cfgCmdArchiveGet, argList, .role = cfgCmdRoleLocal, .noStd = true);
|
||||||
harnessCfgLoadRaw(strLstSize(argList), strLstPtr(argList));
|
|
||||||
|
|
||||||
TEST_RESULT_STRLST_Z(
|
TEST_RESULT_STRLST_Z(
|
||||||
protocolRemoteParamSsh(protocolStorageTypeRepo, 0),
|
protocolRemoteParamSsh(protocolStorageTypeRepo, 0),
|
||||||
"-o\nLogLevel=error\n-o\nCompression=no\n-o\nPasswordAuthentication=no\npgbackrest@repo-host\n"
|
"-o\nLogLevel=error\n-o\nCompression=no\n-o\nPasswordAuthentication=no\npgbackrest@repo-host\n"
|
||||||
"pgbackrest --exec-id=1-test --log-level-console=off --log-level-file=off --log-level-stderr=error"
|
TEST_PROJECT_EXE " --exec-id=1-test --log-level-console=off --log-level-file=off --log-level-stderr=error"
|
||||||
" --pg1-path=/path/to/pg --process=3 --remote-type=repo --repo=1 --stanza=test1 archive-get:remote\n",
|
" --pg1-path=/path/to/pg --process=3 --remote-type=repo --repo=1 --stanza=test1 archive-get:remote\n",
|
||||||
"remote protocol params for backup local");
|
"remote protocol params for backup local");
|
||||||
|
|
||||||
// -------------------------------------------------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------------------------------------------------
|
||||||
argList = strLstNew();
|
argList = strLstNew();
|
||||||
strLstAddZ(argList, "pgbackrest");
|
|
||||||
strLstAddZ(argList, "--stanza=test1");
|
strLstAddZ(argList, "--stanza=test1");
|
||||||
strLstAddZ(argList, "--pg1-path=/path/to/1");
|
strLstAddZ(argList, "--pg1-path=/path/to/1");
|
||||||
strLstAddZ(argList, "--pg1-host=pg1-host");
|
strLstAddZ(argList, "--pg1-host=pg1-host");
|
||||||
strLstAddZ(argList, "--repo1-retention-full=1");
|
strLstAddZ(argList, "--repo1-retention-full=1");
|
||||||
strLstAddZ(argList, "backup");
|
HRN_CFG_LOAD(cfgCmdBackup, argList, .noStd = true);
|
||||||
harnessCfgLoadRaw(strLstSize(argList), strLstPtr(argList));
|
|
||||||
|
|
||||||
TEST_RESULT_STRLST_Z(
|
TEST_RESULT_STRLST_Z(
|
||||||
protocolRemoteParamSsh(protocolStorageTypePg, 0),
|
protocolRemoteParamSsh(protocolStorageTypePg, 0),
|
||||||
"-o\nLogLevel=error\n-o\nCompression=no\n-o\nPasswordAuthentication=no\npostgres@pg1-host\n"
|
"-o\nLogLevel=error\n-o\nCompression=no\n-o\nPasswordAuthentication=no\npostgres@pg1-host\n"
|
||||||
"pgbackrest --exec-id=1-test --log-level-console=off --log-level-file=off --log-level-stderr=error"
|
TEST_PROJECT_EXE " --exec-id=1-test --log-level-console=off --log-level-file=off --log-level-stderr=error"
|
||||||
" --pg1-path=/path/to/1 --process=0 --remote-type=pg --stanza=test1 backup:remote\n",
|
" --pg1-path=/path/to/1 --process=0 --remote-type=pg --stanza=test1 backup:remote\n",
|
||||||
"remote protocol params for db backup");
|
"remote protocol params for db backup");
|
||||||
|
|
||||||
// -------------------------------------------------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------------------------------------------------
|
||||||
argList = strLstNew();
|
argList = strLstNew();
|
||||||
strLstAddZ(argList, "pgbackrest");
|
|
||||||
strLstAddZ(argList, "--stanza=test1");
|
strLstAddZ(argList, "--stanza=test1");
|
||||||
strLstAddZ(argList, "--process=4");
|
strLstAddZ(argList, "--process=4");
|
||||||
hrnCfgArgRawZ(argList, cfgOptPg, "2");
|
hrnCfgArgRawZ(argList, cfgOptPg, "2");
|
||||||
@ -381,19 +358,17 @@ testRun(void)
|
|||||||
strLstAddZ(argList, "--pg2-path=/path/to/2");
|
strLstAddZ(argList, "--pg2-path=/path/to/2");
|
||||||
strLstAddZ(argList, "--pg2-host=pg2-host");
|
strLstAddZ(argList, "--pg2-host=pg2-host");
|
||||||
hrnCfgArgRawStrId(argList, cfgOptRemoteType, protocolStorageTypePg);
|
hrnCfgArgRawStrId(argList, cfgOptRemoteType, protocolStorageTypePg);
|
||||||
strLstAddZ(argList, CFGCMD_BACKUP ":" CONFIG_COMMAND_ROLE_LOCAL);
|
HRN_CFG_LOAD(cfgCmdBackup, argList, .role = cfgCmdRoleLocal, .noStd = true);
|
||||||
harnessCfgLoadRaw(strLstSize(argList), strLstPtr(argList));
|
|
||||||
|
|
||||||
TEST_RESULT_STRLST_Z(
|
TEST_RESULT_STRLST_Z(
|
||||||
protocolRemoteParamSsh(protocolStorageTypePg, 1),
|
protocolRemoteParamSsh(protocolStorageTypePg, 1),
|
||||||
"-o\nLogLevel=error\n-o\nCompression=no\n-o\nPasswordAuthentication=no\npostgres@pg2-host\n"
|
"-o\nLogLevel=error\n-o\nCompression=no\n-o\nPasswordAuthentication=no\npostgres@pg2-host\n"
|
||||||
"pgbackrest --exec-id=1-test --log-level-console=off --log-level-file=off --log-level-stderr=error"
|
TEST_PROJECT_EXE " --exec-id=1-test --log-level-console=off --log-level-file=off --log-level-stderr=error"
|
||||||
" --pg1-path=/path/to/2 --process=4 --remote-type=pg --stanza=test1 backup:remote\n",
|
" --pg1-path=/path/to/2 --process=4 --remote-type=pg --stanza=test1 backup:remote\n",
|
||||||
"remote protocol params for db local");
|
"remote protocol params for db local");
|
||||||
|
|
||||||
// -------------------------------------------------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------------------------------------------------
|
||||||
argList = strLstNew();
|
argList = strLstNew();
|
||||||
strLstAddZ(argList, "pgbackrest");
|
|
||||||
strLstAddZ(argList, "--stanza=test1");
|
strLstAddZ(argList, "--stanza=test1");
|
||||||
strLstAddZ(argList, "--process=4");
|
strLstAddZ(argList, "--process=4");
|
||||||
hrnCfgArgRawZ(argList, cfgOptPg, "3");
|
hrnCfgArgRawZ(argList, cfgOptPg, "3");
|
||||||
@ -403,13 +378,12 @@ testRun(void)
|
|||||||
strLstAddZ(argList, "--pg3-socket-path=/socket3");
|
strLstAddZ(argList, "--pg3-socket-path=/socket3");
|
||||||
strLstAddZ(argList, "--pg3-port=3333");
|
strLstAddZ(argList, "--pg3-port=3333");
|
||||||
hrnCfgArgRawStrId(argList, cfgOptRemoteType, protocolStorageTypePg);
|
hrnCfgArgRawStrId(argList, cfgOptRemoteType, protocolStorageTypePg);
|
||||||
strLstAddZ(argList, CFGCMD_BACKUP ":" CONFIG_COMMAND_ROLE_LOCAL);
|
HRN_CFG_LOAD(cfgCmdBackup, argList, .role = cfgCmdRoleLocal, .noStd = true);
|
||||||
harnessCfgLoadRaw(strLstSize(argList), strLstPtr(argList));
|
|
||||||
|
|
||||||
TEST_RESULT_STRLST_Z(
|
TEST_RESULT_STRLST_Z(
|
||||||
protocolRemoteParamSsh(protocolStorageTypePg, 1),
|
protocolRemoteParamSsh(protocolStorageTypePg, 1),
|
||||||
"-o\nLogLevel=error\n-o\nCompression=no\n-o\nPasswordAuthentication=no\npostgres@pg3-host\n"
|
"-o\nLogLevel=error\n-o\nCompression=no\n-o\nPasswordAuthentication=no\npostgres@pg3-host\n"
|
||||||
"pgbackrest --exec-id=1-test --log-level-console=off --log-level-file=off --log-level-stderr=error"
|
TEST_PROJECT_EXE " --exec-id=1-test --log-level-console=off --log-level-file=off --log-level-stderr=error"
|
||||||
" --pg1-path=/path/to/3 --pg1-port=3333 --pg1-socket-path=/socket3 --process=4 --remote-type=pg --stanza=test1"
|
" --pg1-path=/path/to/3 --pg1-port=3333 --pg1-socket-path=/socket3 --process=4 --remote-type=pg --stanza=test1"
|
||||||
" backup:remote\n",
|
" backup:remote\n",
|
||||||
"remote protocol params for db local");
|
"remote protocol params for db local");
|
||||||
@ -995,7 +969,7 @@ testRun(void)
|
|||||||
strLstAddZ(argList, "--repo1-host=localhost");
|
strLstAddZ(argList, "--repo1-host=localhost");
|
||||||
strLstAddZ(argList, "--repo1-host-user=" TEST_USER);
|
strLstAddZ(argList, "--repo1-host-user=" TEST_USER);
|
||||||
strLstAddZ(argList, "--repo1-path=" TEST_PATH);
|
strLstAddZ(argList, "--repo1-path=" TEST_PATH);
|
||||||
harnessCfgLoad(cfgCmdInfo, argList);
|
HRN_CFG_LOAD(cfgCmdInfo, argList);
|
||||||
|
|
||||||
ProtocolClient *client = NULL;
|
ProtocolClient *client = NULL;
|
||||||
|
|
||||||
@ -1027,7 +1001,7 @@ testRun(void)
|
|||||||
strLstAddZ(argList, "--repo1-path=" TEST_PATH);
|
strLstAddZ(argList, "--repo1-path=" TEST_PATH);
|
||||||
strLstAddZ(argList, "--process=999");
|
strLstAddZ(argList, "--process=999");
|
||||||
hrnCfgArgRawStrId(argList, cfgOptRemoteType, protocolStorageTypePg);
|
hrnCfgArgRawStrId(argList, cfgOptRemoteType, protocolStorageTypePg);
|
||||||
harnessCfgLoadRole(cfgCmdArchiveGet, cfgCmdRoleLocal, argList);
|
HRN_CFG_LOAD(cfgCmdArchiveGet, argList, .role = cfgCmdRoleLocal);
|
||||||
|
|
||||||
TEST_RESULT_STR_Z(cfgOptionStr(cfgOptRepoCipherPass), "acbd", "check cipher pass before");
|
TEST_RESULT_STR_Z(cfgOptionStr(cfgOptRepoCipherPass), "acbd", "check cipher pass before");
|
||||||
TEST_ASSIGN(client, protocolRemoteGet(protocolStorageTypeRepo, 0), "get remote protocol");
|
TEST_ASSIGN(client, protocolRemoteGet(protocolStorageTypeRepo, 0), "get remote protocol");
|
||||||
@ -1059,7 +1033,7 @@ testRun(void)
|
|||||||
strLstAddZ(argList, "--repo2-host=localhost");
|
strLstAddZ(argList, "--repo2-host=localhost");
|
||||||
strLstAddZ(argList, "--repo2-host-user=" TEST_USER);
|
strLstAddZ(argList, "--repo2-host-user=" TEST_USER);
|
||||||
strLstAddZ(argList, "--repo2-path=" TEST_PATH "2");
|
strLstAddZ(argList, "--repo2-path=" TEST_PATH "2");
|
||||||
harnessCfgLoad(cfgCmdCheck, argList);
|
HRN_CFG_LOAD(cfgCmdCheck, argList);
|
||||||
|
|
||||||
TEST_RESULT_PTR(cfgOptionIdxStrNull(cfgOptRepoCipherPass, 0), NULL, "check repo1 cipher pass before");
|
TEST_RESULT_PTR(cfgOptionIdxStrNull(cfgOptRepoCipherPass, 0), NULL, "check repo1 cipher pass before");
|
||||||
TEST_ASSIGN(client, protocolRemoteGet(protocolStorageTypeRepo, 0), "get repo1 remote protocol");
|
TEST_ASSIGN(client, protocolRemoteGet(protocolStorageTypeRepo, 0), "get repo1 remote protocol");
|
||||||
@ -1080,7 +1054,7 @@ testRun(void)
|
|||||||
strLstAddZ(argList, "--pg1-host=localhost");
|
strLstAddZ(argList, "--pg1-host=localhost");
|
||||||
strLstAddZ(argList, "--pg1-host-user=" TEST_USER);
|
strLstAddZ(argList, "--pg1-host-user=" TEST_USER);
|
||||||
strLstAddZ(argList, "--pg1-path=" TEST_PATH);
|
strLstAddZ(argList, "--pg1-path=" TEST_PATH);
|
||||||
harnessCfgLoad(cfgCmdBackup, argList);
|
HRN_CFG_LOAD(cfgCmdBackup, argList);
|
||||||
|
|
||||||
TEST_ASSIGN(client, protocolRemoteGet(protocolStorageTypePg, 0), "get remote protocol");
|
TEST_ASSIGN(client, protocolRemoteGet(protocolStorageTypePg, 0), "get remote protocol");
|
||||||
|
|
||||||
@ -1093,7 +1067,7 @@ testRun(void)
|
|||||||
hrnCfgArgRawZ(argList, cfgOptPgPath, "/path/to/pg");
|
hrnCfgArgRawZ(argList, cfgOptPgPath, "/path/to/pg");
|
||||||
strLstAddZ(argList, "--protocol-timeout=10");
|
strLstAddZ(argList, "--protocol-timeout=10");
|
||||||
strLstAddZ(argList, "--process-max=2");
|
strLstAddZ(argList, "--process-max=2");
|
||||||
harnessCfgLoad(cfgCmdArchiveGet, argList);
|
HRN_CFG_LOAD(cfgCmdArchiveGet, argList);
|
||||||
|
|
||||||
TEST_ASSIGN(client, protocolLocalGet(protocolStorageTypeRepo, 0, 1), "get local protocol");
|
TEST_ASSIGN(client, protocolLocalGet(protocolStorageTypeRepo, 0, 1), "get local protocol");
|
||||||
TEST_RESULT_PTR(protocolLocalGet(protocolStorageTypeRepo, 0, 1), client, "get local cached protocol");
|
TEST_RESULT_PTR(protocolLocalGet(protocolStorageTypeRepo, 0, 1), client, "get local cached protocol");
|
||||||
|
@ -183,7 +183,7 @@ testRun(void)
|
|||||||
hrnCfgArgRawZ(argList, cfgOptRepoAzureContainer, TEST_CONTAINER);
|
hrnCfgArgRawZ(argList, cfgOptRepoAzureContainer, TEST_CONTAINER);
|
||||||
hrnCfgEnvRawZ(cfgOptRepoAzureAccount, TEST_ACCOUNT);
|
hrnCfgEnvRawZ(cfgOptRepoAzureAccount, TEST_ACCOUNT);
|
||||||
hrnCfgEnvRawZ(cfgOptRepoAzureKey, TEST_KEY_SHARED);
|
hrnCfgEnvRawZ(cfgOptRepoAzureKey, TEST_KEY_SHARED);
|
||||||
harnessCfgLoad(cfgCmdArchivePush, argList);
|
HRN_CFG_LOAD(cfgCmdArchivePush, argList);
|
||||||
|
|
||||||
Storage *storage = NULL;
|
Storage *storage = NULL;
|
||||||
TEST_ASSIGN(storage, storageRepoGet(0, false), "get repo storage");
|
TEST_ASSIGN(storage, storageRepoGet(0, false), "get repo storage");
|
||||||
@ -293,7 +293,7 @@ testRun(void)
|
|||||||
hrnCfgArgRawBool(argList, cfgOptRepoStorageVerifyTls, TEST_IN_CONTAINER);
|
hrnCfgArgRawBool(argList, cfgOptRepoStorageVerifyTls, TEST_IN_CONTAINER);
|
||||||
hrnCfgEnvRawZ(cfgOptRepoAzureAccount, TEST_ACCOUNT);
|
hrnCfgEnvRawZ(cfgOptRepoAzureAccount, TEST_ACCOUNT);
|
||||||
hrnCfgEnvRawZ(cfgOptRepoAzureKey, TEST_KEY_SHARED);
|
hrnCfgEnvRawZ(cfgOptRepoAzureKey, TEST_KEY_SHARED);
|
||||||
harnessCfgLoad(cfgCmdArchivePush, argList);
|
HRN_CFG_LOAD(cfgCmdArchivePush, argList);
|
||||||
|
|
||||||
Storage *storage = NULL;
|
Storage *storage = NULL;
|
||||||
TEST_ASSIGN(storage, storageRepoGet(0, true), "get repo storage");
|
TEST_ASSIGN(storage, storageRepoGet(0, true), "get repo storage");
|
||||||
@ -731,7 +731,7 @@ testRun(void)
|
|||||||
|
|
||||||
hrnCfgArgRawStrId(argList, cfgOptRepoAzureKeyType, storageAzureKeyTypeSas);
|
hrnCfgArgRawStrId(argList, cfgOptRepoAzureKeyType, storageAzureKeyTypeSas);
|
||||||
hrnCfgEnvRawZ(cfgOptRepoAzureKey, TEST_KEY_SAS);
|
hrnCfgEnvRawZ(cfgOptRepoAzureKey, TEST_KEY_SAS);
|
||||||
harnessCfgLoad(cfgCmdArchivePush, argList);
|
HRN_CFG_LOAD(cfgCmdArchivePush, argList);
|
||||||
|
|
||||||
TEST_ASSIGN(storage, storageRepoGet(0, true), "get repo storage");
|
TEST_ASSIGN(storage, storageRepoGet(0, true), "get repo storage");
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ testRun(void)
|
|||||||
hrnCfgArgRawZ(argList, cfgOptPgPath, "/path/to/pg");
|
hrnCfgArgRawZ(argList, cfgOptPgPath, "/path/to/pg");
|
||||||
strLstAddZ(argList, "--repo1-type=cifs");
|
strLstAddZ(argList, "--repo1-type=cifs");
|
||||||
strLstAddZ(argList, "--repo1-path=" TEST_PATH);
|
strLstAddZ(argList, "--repo1-path=" TEST_PATH);
|
||||||
harnessCfgLoad(cfgCmdArchiveGet, argList);
|
HRN_CFG_LOAD(cfgCmdArchiveGet, argList);
|
||||||
|
|
||||||
const Storage *storage = NULL;
|
const Storage *storage = NULL;
|
||||||
TEST_ASSIGN(storage, storageRepoGet(0, true), "get cifs repo storage");
|
TEST_ASSIGN(storage, storageRepoGet(0, true), "get cifs repo storage");
|
||||||
|
@ -205,7 +205,7 @@ testRun(void)
|
|||||||
hrnCfgArgRawZ(argList, cfgOptRepoGcsBucket, TEST_BUCKET);
|
hrnCfgArgRawZ(argList, cfgOptRepoGcsBucket, TEST_BUCKET);
|
||||||
hrnCfgArgRawStrId(argList, cfgOptRepoGcsKeyType, storageGcsKeyTypeToken);
|
hrnCfgArgRawStrId(argList, cfgOptRepoGcsKeyType, storageGcsKeyTypeToken);
|
||||||
hrnCfgEnvRawZ(cfgOptRepoGcsKey, TEST_TOKEN);
|
hrnCfgEnvRawZ(cfgOptRepoGcsKey, TEST_TOKEN);
|
||||||
harnessCfgLoad(cfgCmdArchivePush, argList);
|
HRN_CFG_LOAD(cfgCmdArchivePush, argList);
|
||||||
|
|
||||||
Storage *storage = NULL;
|
Storage *storage = NULL;
|
||||||
TEST_ASSIGN(storage, storageRepoGet(0, false), "get repo storage");
|
TEST_ASSIGN(storage, storageRepoGet(0, false), "get repo storage");
|
||||||
@ -329,7 +329,7 @@ testRun(void)
|
|||||||
hrnCfgArgRawFmt(argList, cfgOptRepoGcsEndpoint, "%s:%u", strZ(hrnServerHost()), testPort);
|
hrnCfgArgRawFmt(argList, cfgOptRepoGcsEndpoint, "%s:%u", strZ(hrnServerHost()), testPort);
|
||||||
hrnCfgArgRawBool(argList, cfgOptRepoStorageVerifyTls, TEST_IN_CONTAINER);
|
hrnCfgArgRawBool(argList, cfgOptRepoStorageVerifyTls, TEST_IN_CONTAINER);
|
||||||
hrnCfgEnvRawZ(cfgOptRepoGcsKey, TEST_KEY_FILE);
|
hrnCfgEnvRawZ(cfgOptRepoGcsKey, TEST_KEY_FILE);
|
||||||
harnessCfgLoad(cfgCmdArchivePush, argList);
|
HRN_CFG_LOAD(cfgCmdArchivePush, argList);
|
||||||
hrnCfgEnvRemoveRaw(cfgOptRepoGcsKey);
|
hrnCfgEnvRemoveRaw(cfgOptRepoGcsKey);
|
||||||
|
|
||||||
Storage *storage = NULL;
|
Storage *storage = NULL;
|
||||||
@ -425,7 +425,7 @@ testRun(void)
|
|||||||
|
|
||||||
StringList *argListAuto = strLstDup(argList);
|
StringList *argListAuto = strLstDup(argList);
|
||||||
hrnCfgArgRawStrId(argListAuto, cfgOptRepoGcsKeyType, storageGcsKeyTypeAuto);
|
hrnCfgArgRawStrId(argListAuto, cfgOptRepoGcsKeyType, storageGcsKeyTypeAuto);
|
||||||
harnessCfgLoad(cfgCmdArchivePush, argListAuto);
|
HRN_CFG_LOAD(cfgCmdArchivePush, argListAuto);
|
||||||
|
|
||||||
TEST_ASSIGN(storage, storageRepoGet(0, true), "get repo storage");
|
TEST_ASSIGN(storage, storageRepoGet(0, true), "get repo storage");
|
||||||
|
|
||||||
@ -885,7 +885,7 @@ testRun(void)
|
|||||||
|
|
||||||
hrnCfgArgRawZ(argList, cfgOptRepoGcsKeyType, "token");
|
hrnCfgArgRawZ(argList, cfgOptRepoGcsKeyType, "token");
|
||||||
hrnCfgEnvRawZ(cfgOptRepoGcsKey, TEST_TOKEN);
|
hrnCfgEnvRawZ(cfgOptRepoGcsKey, TEST_TOKEN);
|
||||||
harnessCfgLoad(cfgCmdArchivePush, argList);
|
HRN_CFG_LOAD(cfgCmdArchivePush, argList);
|
||||||
|
|
||||||
TEST_ASSIGN(storage, storageRepoGet(0, true), "get repo storage");
|
TEST_ASSIGN(storage, storageRepoGet(0, true), "get repo storage");
|
||||||
|
|
||||||
|
@ -1149,7 +1149,7 @@ testRun(void)
|
|||||||
strLstAddZ(argList, "--stanza=db");
|
strLstAddZ(argList, "--stanza=db");
|
||||||
hrnCfgArgRawZ(argList, cfgOptPgPath, "/path/to/pg");
|
hrnCfgArgRawZ(argList, cfgOptPgPath, "/path/to/pg");
|
||||||
strLstAddZ(argList, "--repo-path=" TEST_PATH);
|
strLstAddZ(argList, "--repo-path=" TEST_PATH);
|
||||||
harnessCfgLoad(cfgCmdArchiveGet, argList);
|
HRN_CFG_LOAD(cfgCmdArchiveGet, argList);
|
||||||
|
|
||||||
const Storage *storage = NULL;
|
const Storage *storage = NULL;
|
||||||
|
|
||||||
@ -1184,7 +1184,7 @@ testRun(void)
|
|||||||
// -------------------------------------------------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------------------------------------------------
|
||||||
argList = strLstNew();
|
argList = strLstNew();
|
||||||
strLstAddZ(argList, "--repo-path=" TEST_PATH);
|
strLstAddZ(argList, "--repo-path=" TEST_PATH);
|
||||||
harnessCfgLoad(cfgCmdInfo, argList);
|
HRN_CFG_LOAD(cfgCmdInfo, argList);
|
||||||
|
|
||||||
TEST_ASSIGN(storage, storageRepo(), "new repo storage no stanza");
|
TEST_ASSIGN(storage, storageRepo(), "new repo storage no stanza");
|
||||||
TEST_RESULT_STR(storageHelper.stanza, NULL, "stanza NULL");
|
TEST_RESULT_STR(storageHelper.stanza, NULL, "stanza NULL");
|
||||||
@ -1220,7 +1220,7 @@ testRun(void)
|
|||||||
strLstAddZ(argList, "--spool-path=" TEST_PATH);
|
strLstAddZ(argList, "--spool-path=" TEST_PATH);
|
||||||
strLstAddZ(argList, "--pg1-path=" TEST_PATH "/db");
|
strLstAddZ(argList, "--pg1-path=" TEST_PATH "/db");
|
||||||
strLstAddZ(argList, "--pg2-path=" TEST_PATH "/db2");
|
strLstAddZ(argList, "--pg2-path=" TEST_PATH "/db2");
|
||||||
harnessCfgLoad(cfgCmdArchiveGet, argList);
|
HRN_CFG_LOAD(cfgCmdArchiveGet, argList);
|
||||||
|
|
||||||
TEST_RESULT_PTR(storageHelper.storageSpool, NULL, "storage not cached");
|
TEST_RESULT_PTR(storageHelper.storageSpool, NULL, "storage not cached");
|
||||||
TEST_ASSIGN(storage, storageSpool(), "new storage");
|
TEST_ASSIGN(storage, storageSpool(), "new storage");
|
||||||
@ -1288,7 +1288,7 @@ testRun(void)
|
|||||||
|
|
||||||
argList = strLstNew();
|
argList = strLstNew();
|
||||||
strLstAddZ(argList, "--repo-path=" TEST_PATH);
|
strLstAddZ(argList, "--repo-path=" TEST_PATH);
|
||||||
harnessCfgLoad(cfgCmdInfo, argList);
|
HRN_CFG_LOAD(cfgCmdInfo, argList);
|
||||||
|
|
||||||
TEST_ERROR(storageSpool(), AssertError, "stanza cannot be NULL for this storage object");
|
TEST_ERROR(storageSpool(), AssertError, "stanza cannot be NULL for this storage object");
|
||||||
TEST_ERROR(storageSpoolWrite(), AssertError, "stanza cannot be NULL for this storage object");
|
TEST_ERROR(storageSpoolWrite(), AssertError, "stanza cannot be NULL for this storage object");
|
||||||
|
@ -42,7 +42,7 @@ testRun(void)
|
|||||||
strLstAddZ(argList, "--repo1-host-user=" TEST_USER);
|
strLstAddZ(argList, "--repo1-host-user=" TEST_USER);
|
||||||
strLstAddZ(argList, "--repo1-path=" TEST_PATH "/repo");
|
strLstAddZ(argList, "--repo1-path=" TEST_PATH "/repo");
|
||||||
hrnCfgArgRawZ(argList, cfgOptRepo, "1");
|
hrnCfgArgRawZ(argList, cfgOptRepo, "1");
|
||||||
harnessCfgLoadRole(cfgCmdArchiveGet, cfgCmdRoleLocal, argList);
|
HRN_CFG_LOAD(cfgCmdArchiveGet, argList, .role = cfgCmdRoleLocal);
|
||||||
|
|
||||||
const Storage *const storageRepoWrite = storageRepoGet(0, true);
|
const Storage *const storageRepoWrite = storageRepoGet(0, true);
|
||||||
const Storage *const storageRepo = storageRepoGet(0, false);
|
const Storage *const storageRepo = storageRepoGet(0, false);
|
||||||
@ -57,7 +57,7 @@ testRun(void)
|
|||||||
hrnCfgArgKeyRawZ(argList, cfgOptPgHostUser, 2, TEST_USER);
|
hrnCfgArgKeyRawZ(argList, cfgOptPgHostUser, 2, TEST_USER);
|
||||||
hrnCfgArgKeyRawZ(argList, cfgOptPgPath, 2, TEST_PATH_PG "2");
|
hrnCfgArgKeyRawZ(argList, cfgOptPgPath, 2, TEST_PATH_PG "2");
|
||||||
hrnCfgArgRawZ(argList, cfgOptRepoPath, TEST_PATH_REPO);
|
hrnCfgArgRawZ(argList, cfgOptRepoPath, TEST_PATH_REPO);
|
||||||
harnessCfgLoad(cfgCmdBackup, argList);
|
HRN_CFG_LOAD(cfgCmdBackup, argList);
|
||||||
|
|
||||||
const Storage *const storagePgWrite = storagePgGet(1, true);
|
const Storage *const storagePgWrite = storagePgGet(1, true);
|
||||||
|
|
||||||
|
@ -250,7 +250,7 @@ testRun(void)
|
|||||||
TEST_TITLE("config without token");
|
TEST_TITLE("config without token");
|
||||||
|
|
||||||
StringList *argList = strLstDup(commonArgList);
|
StringList *argList = strLstDup(commonArgList);
|
||||||
harnessCfgLoad(cfgCmdArchivePush, argList);
|
HRN_CFG_LOAD(cfgCmdArchivePush, argList);
|
||||||
|
|
||||||
StorageS3 *driver = (StorageS3 *)storageDriver(storageRepoGet(0, false));
|
StorageS3 *driver = (StorageS3 *)storageDriver(storageRepoGet(0, false));
|
||||||
|
|
||||||
@ -321,7 +321,7 @@ testRun(void)
|
|||||||
hrnCfgArgRawZ(argList, cfgOptRepoStorageCaPath, "/path/to/cert");
|
hrnCfgArgRawZ(argList, cfgOptRepoStorageCaPath, "/path/to/cert");
|
||||||
hrnCfgArgRawZ(argList, cfgOptRepoStorageCaFile, HRN_PATH_REPO "/" HRN_SERVER_CERT_PREFIX ".crt");
|
hrnCfgArgRawZ(argList, cfgOptRepoStorageCaFile, HRN_PATH_REPO "/" HRN_SERVER_CERT_PREFIX ".crt");
|
||||||
hrnCfgEnvRaw(cfgOptRepoS3Token, securityToken);
|
hrnCfgEnvRaw(cfgOptRepoS3Token, securityToken);
|
||||||
harnessCfgLoad(cfgCmdArchivePush, argList);
|
HRN_CFG_LOAD(cfgCmdArchivePush, argList);
|
||||||
|
|
||||||
driver = (StorageS3 *)storageDriver(storageRepoGet(0, false));
|
driver = (StorageS3 *)storageDriver(storageRepoGet(0, false));
|
||||||
|
|
||||||
@ -385,7 +385,7 @@ testRun(void)
|
|||||||
StringList *argList = strLstDup(commonArgList);
|
StringList *argList = strLstDup(commonArgList);
|
||||||
hrnCfgArgRawFmt(argList, cfgOptRepoStorageHost, "%s:%u", strZ(host), port);
|
hrnCfgArgRawFmt(argList, cfgOptRepoStorageHost, "%s:%u", strZ(host), port);
|
||||||
hrnCfgEnvRaw(cfgOptRepoS3Token, securityToken);
|
hrnCfgEnvRaw(cfgOptRepoS3Token, securityToken);
|
||||||
harnessCfgLoad(cfgCmdArchivePush, argList);
|
HRN_CFG_LOAD(cfgCmdArchivePush, argList);
|
||||||
|
|
||||||
Storage *s3 = storageRepoGet(0, true);
|
Storage *s3 = storageRepoGet(0, true);
|
||||||
StorageS3 *driver = (StorageS3 *)storageDriver(s3);
|
StorageS3 *driver = (StorageS3 *)storageDriver(s3);
|
||||||
@ -443,7 +443,7 @@ testRun(void)
|
|||||||
hrnCfgArgRawFmt(argList, cfgOptRepoStorageHost, "%s:%u", strZ(host), port);
|
hrnCfgArgRawFmt(argList, cfgOptRepoStorageHost, "%s:%u", strZ(host), port);
|
||||||
hrnCfgArgRaw(argList, cfgOptRepoS3Role, credRole);
|
hrnCfgArgRaw(argList, cfgOptRepoS3Role, credRole);
|
||||||
hrnCfgArgRawStrId(argList, cfgOptRepoS3KeyType, storageS3KeyTypeAuto);
|
hrnCfgArgRawStrId(argList, cfgOptRepoS3KeyType, storageS3KeyTypeAuto);
|
||||||
harnessCfgLoad(cfgCmdArchivePush, argList);
|
HRN_CFG_LOAD(cfgCmdArchivePush, argList);
|
||||||
|
|
||||||
s3 = storageRepoGet(0, true);
|
s3 = storageRepoGet(0, true);
|
||||||
driver = (StorageS3 *)storageDriver(s3);
|
driver = (StorageS3 *)storageDriver(s3);
|
||||||
@ -1017,7 +1017,7 @@ testRun(void)
|
|||||||
hrnCfgArgRaw(argList, cfgOptRepoStorageHost, host);
|
hrnCfgArgRaw(argList, cfgOptRepoStorageHost, host);
|
||||||
hrnCfgArgRawFmt(argList, cfgOptRepoStoragePort, "%u", port);
|
hrnCfgArgRawFmt(argList, cfgOptRepoStoragePort, "%u", port);
|
||||||
hrnCfgEnvRemoveRaw(cfgOptRepoS3Token);
|
hrnCfgEnvRemoveRaw(cfgOptRepoS3Token);
|
||||||
harnessCfgLoad(cfgCmdArchivePush, argList);
|
HRN_CFG_LOAD(cfgCmdArchivePush, argList);
|
||||||
|
|
||||||
s3 = storageRepoGet(0, true);
|
s3 = storageRepoGet(0, true);
|
||||||
driver = (StorageS3 *)storageDriver(s3);
|
driver = (StorageS3 *)storageDriver(s3);
|
||||||
|
Loading…
Reference in New Issue
Block a user