1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2025-06-16 23:47:38 +02:00

Add Perl interface to C storage layer.

Maintaining the storage layer/drivers in two languages is burdensome.  Since the integration tests require the Perl storage layer/drivers we'll need them even after the core code is migrated to C.  Create an interface layer so the Perl code can be removed and new storage drivers/features introduced without adding Perl equivalents.

The goal is to move the integration tests to C so this interface will eventually be removed.  That being the case, the interface was designed for maximum compatibility to ease the transition.  The result looks a bit hacky but we'll improve it as needed until it can be retired.
This commit is contained in:
David Steele
2019-06-26 08:24:58 -04:00
parent bd6c0941e9
commit 4815752ccc
93 changed files with 4412 additions and 12102 deletions

View File

@ -297,42 +297,6 @@ sub run
$self->testException(sub {new pgBackRest::Common::Ini($strTestFile)}, ERROR_CRYPTO,
"unable to parse '$strTestFile'" .
"\nHINT: Is or was the repo encrypted?");
# Encryption
#---------------------------------------------------------------------------------------------------------------------------
executeTest("rm -rf ${strTestFile}*");
my $strCipherPass = 'x';
my $strCipherPassSub = 'y';
# Unencrypted storage but a passphrase passed
$self->testException(sub {new pgBackRest::Common::Ini($strTestFile, {bLoad => false,
strCipherPass => $strCipherPass})}, ERROR_ASSERT,
"a user passphrase and sub passphrase are both required when encrypting");
# Unencrypted storage but a sub passphrase passed
$self->testException(sub {new pgBackRest::Common::Ini($strTestFile, {bLoad => false,
strCipherPassSub => $strCipherPassSub})}, ERROR_ASSERT,
"a user passphrase and sub passphrase are both required when encrypting");
# Create Encrypted storage
my $oStorage = new pgBackRest::Storage::Local($self->testPath(), new pgBackRest::Storage::Posix::Driver(),
{strCipherType => CFGOPTVAL_REPO_CIPHER_TYPE_AES_256_CBC, strCipherPassUser => $strCipherPass});
$self->testException(sub {new pgBackRest::Common::Ini($strTestFile, {oStorage => $oStorage})}, ERROR_CRYPTO,
"passphrase is required when storage is encrypted");
$self->testException(sub {new pgBackRest::Common::Ini($strTestFile, {bLoad => false, oStorage => $oStorage,
strCipherPass => $strCipherPass})}, ERROR_ASSERT,
"a user passphrase and sub passphrase are both required when encrypting");
$oIni = $self->testResult(sub {
new pgBackRest::Common::Ini(
$strTestFile,
{bLoad => false, oStorage => $oStorage, strCipherPass => $strCipherPass, strCipherPassSub => $strCipherPassSub})},
'[object]', 'create new ini with encryption passphrases');
$self->testResult(sub {($oIni->cipherPassSub() eq $strCipherPassSub) &&
($oIni->cipherPass() eq $strCipherPass)}, true, ' new ini has encryption passphrases');
}
################################################################################################################################