1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2024-12-14 10:13:05 +02:00

Combine encrypted backupFile() tests with unencrypted tests.

This makes it easier to comment out all the tests while developing without getting unused variable errors.
This commit is contained in:
David Steele 2022-01-09 10:11:00 -05:00
parent d866dd5c29
commit 47954774c6
2 changed files with 13 additions and 17 deletions

View File

@ -818,7 +818,7 @@ unit:
# ---------------------------------------------------------------------------------------------------------------------------- # ----------------------------------------------------------------------------------------------------------------------------
- name: backup - name: backup
total: 10 total: 9
coverage: coverage:
- command/backup/backup - command/backup/backup

View File

@ -565,22 +565,22 @@ testRun(void)
Storage *storageTest = storagePosixNewP(TEST_PATH_STR, .write = true); Storage *storageTest = storagePosixNewP(TEST_PATH_STR, .write = true);
const String *pgFile = STRDEF("testfile");
const String *missingFile = STRDEF("missing");
const String *backupLabel = STRDEF("20190718-155825F");
const String *backupPathFile = strNewFmt(STORAGE_REPO_BACKUP "/%s/%s", strZ(backupLabel), strZ(pgFile));
BackupFileResult result = {0};
// ***************************************************************************************************************************** // *****************************************************************************************************************************
if (testBegin("segmentNumber()")) if (testBegin("segmentNumber()"))
{ {
TEST_RESULT_UINT(segmentNumber(pgFile), 0, "No segment number"); TEST_RESULT_UINT(segmentNumber(STRDEF("999")), 0, "No segment number");
TEST_RESULT_UINT(segmentNumber(strNewFmt("%s.123", strZ(pgFile))), 123, "Segment number"); TEST_RESULT_UINT(segmentNumber(STRDEF("999.123")), 123, "Segment number");
} }
// ***************************************************************************************************************************** // *****************************************************************************************************************************
if (testBegin("backupFile()")) if (testBegin("backupFile()"))
{ {
const String *pgFile = STRDEF("testfile");
const String *missingFile = STRDEF("missing");
const String *backupLabel = STRDEF("20190718-155825F");
const String *backupPathFile = strNewFmt(STORAGE_REPO_BACKUP "/%s/%s", strZ(backupLabel), strZ(pgFile));
BackupFileResult result = {0};
// Load Parameters // Load Parameters
StringList *argList = strLstNew(); StringList *argList = strLstNew();
hrnCfgArgRawZ(argList, cfgOptStanza, "test1"); hrnCfgArgRawZ(argList, cfgOptStanza, "test1");
@ -844,13 +844,12 @@ testRun(void)
"testfile.gz\n" "testfile.gz\n"
"zerofile\n", "zerofile\n",
.comment = "copy zero file to repo success"); .comment = "copy zero file to repo success");
}
// ***************************************************************************************************************************** // -------------------------------------------------------------------------------------------------------------------------
if (testBegin("backupFile() - encrypt")) TEST_TITLE("copy file to encrypted repo");
{
// Load Parameters // Load Parameters
StringList *argList = strLstNew(); argList = strLstNew();
hrnCfgArgRawZ(argList, cfgOptStanza, "test1"); hrnCfgArgRawZ(argList, cfgOptStanza, "test1");
hrnCfgArgRawZ(argList, cfgOptRepoPath, TEST_PATH "/repo"); hrnCfgArgRawZ(argList, cfgOptRepoPath, TEST_PATH "/repo");
hrnCfgArgRawZ(argList, cfgOptPgPath, TEST_PATH "/pg"); hrnCfgArgRawZ(argList, cfgOptPgPath, TEST_PATH "/pg");
@ -863,9 +862,6 @@ testRun(void)
// Create the pg path and pg file to backup // Create the pg path and pg file to backup
HRN_STORAGE_PUT_Z(storagePgWrite(), strZ(pgFile), "atestfile"); HRN_STORAGE_PUT_Z(storagePgWrite(), strZ(pgFile), "atestfile");
// -------------------------------------------------------------------------------------------------------------------------
TEST_TITLE("copy file to encrypted repo");
// No prior checksum, no compression, no pageChecksum, no delta, no hasReference // No prior checksum, no compression, no pageChecksum, no delta, no hasReference
TEST_ASSIGN( TEST_ASSIGN(
result, result,