Skip to content
Permalink
Browse files

Remove per-stanza repo cache clear during testing.

This was not being used and is not supported by the equivalent C code.
  • Loading branch information...
dwsteele committed Jun 4, 2019
1 parent 44eb21e commit 92e04ea9f4e0eb3f6cd88a72497a026cbd348280
@@ -240,28 +240,17 @@ sub storageRepo
push @EXPORT, qw(storageRepo);

####################################################################################################################################
# storageRepoCacheClear - FOR TESTING ONLY!
# Clear the repo storage cache - FOR TESTING ONLY!
####################################################################################################################################
sub storageRepoCacheClear
{
# Assign function parameters, defaults, and log debug info
my
(
$strOperation,
$strStanza,
) =
logDebugParam
(
__PACKAGE__ . '::storageRepoCacheClear', \@_,
{name => 'strStanza'},
);
my ($strOperation) = logDebugParam(__PACKAGE__ . '::storageRepoCacheClear');

if (defined($hStorage->{&STORAGE_REPO}{$strStanza}))
{
delete($hStorage->{&STORAGE_REPO}{$strStanza});
}
delete($hStorage->{&STORAGE_REPO});

return;
# Return from function and log return values if any
return logDebugReturn($strOperation);
}

push @EXPORT, qw(storageRepoCacheClear);
"sub storageRepoCacheClear\n"
"{\n"
"\n"
"my\n"
"(\n"
"$strOperation,\n"
"$strStanza,\n"
") =\n"
"logDebugParam\n"
"(\n"
"__PACKAGE__ . '::storageRepoCacheClear', \\@_,\n"
"{name => 'strStanza'},\n"
");\n"
"\n"
"if (defined($hStorage->{&STORAGE_REPO}{$strStanza}))\n"
"{\n"
"delete($hStorage->{&STORAGE_REPO}{$strStanza});\n"
"}\n"
"my ($strOperation) = logDebugParam(__PACKAGE__ . '::storageRepoCacheClear');\n"
"\n"
"return;\n"
"delete($hStorage->{&STORAGE_REPO});\n"
"\n\n"
"return logDebugReturn($strOperation);\n"
"}\n"
"\n"
"push @EXPORT, qw(storageRepoCacheClear);\n"
@@ -52,7 +52,7 @@ sub initTest
my $self = shift;

# Clear cache from the previous test
storageRepoCacheClear($self->stanza());
storageRepoCacheClear();

# Load options
$self->configTestClear();
@@ -51,7 +51,7 @@ sub initTest
my $self = shift;

# Clear cache from the previous test
storageRepoCacheClear($self->stanza());
storageRepoCacheClear();

# Load options
$self->configTestClear();
@@ -116,7 +116,7 @@ sub run

# Attempt to reconstruct from an encypted archived WAL with an encrypted repo
#---------------------------------------------------------------------------------------------------------------------------
storageRepoCacheClear($self->stanza());
storageRepoCacheClear();
$self->optionTestSet(CFGOPT_REPO_CIPHER_TYPE, CFGOPTVAL_REPO_CIPHER_TYPE_AES_256_CBC);
$self->optionTestSet(CFGOPT_REPO_CIPHER_PASS, 'x');
$self->configTestLoad(CFGCMD_ARCHIVE_PUSH);
@@ -222,7 +222,7 @@ sub run
$self->configTestLoad(CFGCMD_ARCHIVE_PUSH);

# Clear the storage repo settings
storageRepoCacheClear($self->stanza());
storageRepoCacheClear();

# Create an encrypted storage and generate an encyption sub passphrase to store in the file
my $strCipherPassSub = cipherPassGen();
@@ -223,7 +223,7 @@ sub run
executeTest('sudo rm ' . $oBackupInfo->{strFileName} . '*');

# Clear the storage repo settings and change the passphrase
storageRepoCacheClear($self->stanza());
storageRepoCacheClear();

my $strCipherPass = 'x';
$self->configTestClear();
@@ -246,7 +246,7 @@ sub run
$oBackupInfo->create(PG_VERSION_93, $self->dbSysId(PG_VERSION_93), $i93ControlVersion, $i93CatalogVersion, true);

# Clear the storage repo settings and change the passphrase
storageRepoCacheClear($self->stanza());
storageRepoCacheClear();
$self->optionTestSet(CFGOPT_REPO_CIPHER_TYPE, CFGOPTVAL_REPO_CIPHER_TYPE_AES_256_CBC);
$self->optionTestSet(CFGOPT_REPO_CIPHER_PASS, BOGUS);
$self->optionTestSet(CFGOPT_STANZA, $self->stanza());
@@ -284,7 +284,7 @@ sub run
executeTest('sudo chmod 644 ' . $strArchivedFile);

# Clear the cached repo settings and change repo settings to encrypted
storageRepoCacheClear($self->stanza());
storageRepoCacheClear();
$self->optionTestSet(CFGOPT_REPO_CIPHER_TYPE, CFGOPTVAL_REPO_CIPHER_TYPE_AES_256_CBC);
$self->optionTestSet(CFGOPT_REPO_CIPHER_PASS, 'x');
$self->configTestLoad(CFGCMD_STANZA_CREATE);
@@ -402,7 +402,7 @@ sub run
# Change repo encryption settings to unencrypted - stanza create is not allowed even with force
#---------------------------------------------------------------------------------------------------------------------------
# Clear the cached repo settings and change repo settings to unencrypted
storageRepoCacheClear($self->stanza());
storageRepoCacheClear();
$self->optionTestClear(CFGOPT_REPO_CIPHER_TYPE);
$self->optionTestClear(CFGOPT_REPO_CIPHER_PASS);
$self->configTestLoad(CFGCMD_STANZA_CREATE);
@@ -520,7 +520,7 @@ sub run
# Attempt to change the encryption settings
#---------------------------------------------------------------------------------------------------------------------------
# Clear the cached repo settings and change repo settings to encrypted
storageRepoCacheClear($self->stanza());
storageRepoCacheClear();
$self->optionTestSet(CFGOPT_REPO_CIPHER_TYPE, CFGOPTVAL_REPO_CIPHER_TYPE_AES_256_CBC);
$self->optionTestSet(CFGOPT_REPO_CIPHER_PASS, 'x');
$self->configTestLoad(CFGCMD_STANZA_UPGRADE);
@@ -543,7 +543,7 @@ sub run
$oBackupInfo->create(PG_VERSION_93, $self->dbSysId(PG_VERSION_93), '937', '201306121', true);

# Attempt to upgrade with a different passphrase
storageRepoCacheClear($self->stanza());
storageRepoCacheClear();
$self->optionTestSet(CFGOPT_REPO_CIPHER_TYPE, CFGOPTVAL_REPO_CIPHER_TYPE_AES_256_CBC);
$self->optionTestSet(CFGOPT_REPO_CIPHER_PASS, 'y');
$self->configTestLoad(CFGCMD_STANZA_UPGRADE);
@@ -552,7 +552,7 @@ sub run
"unable to parse '" . $self->{strArchivePath} . "/archive.info'" .
"\nHINT: Is or was the repo encrypted?");

storageRepoCacheClear($self->stanza());
storageRepoCacheClear();
$self->optionTestSet(CFGOPT_REPO_CIPHER_TYPE, CFGOPTVAL_REPO_CIPHER_TYPE_AES_256_CBC);
$self->optionTestSet(CFGOPT_REPO_CIPHER_PASS, 'x');
$self->configTestLoad(CFGCMD_STANZA_UPGRADE);
@@ -592,7 +592,7 @@ sub run
' encrypted archive and backup info files upgraded');

# Clear configuration
storageRepoCacheClear($self->stanza());
storageRepoCacheClear();
$self->optionTestClear(CFGOPT_REPO_CIPHER_TYPE);
$self->optionTestClear(CFGOPT_REPO_CIPHER_PASS);
}
@@ -770,7 +770,7 @@ sub run

# Clear the cached repo settings and change repo settings to encrypted
#---------------------------------------------------------------------------------------------------------------------------
storageRepoCacheClear($self->stanza());
storageRepoCacheClear();
$self->optionTestSet(CFGOPT_REPO_CIPHER_TYPE, CFGOPTVAL_REPO_CIPHER_TYPE_AES_256_CBC);
$self->optionTestSet(CFGOPT_REPO_CIPHER_PASS, 'x');
$self->configTestLoad(CFGCMD_STANZA_CREATE);

0 comments on commit 92e04ea

Please sign in to comment.
You can’t perform that action at this time.