You've already forked pgbackrest
mirror of
https://github.com/pgbackrest/pgbackrest.git
synced 2025-11-29 22:28:02 +02:00
Split test modules into separate files.
Makes the code more maintainable. Tests are dynamically loaded by name rather than requiring an if-else block.
This commit is contained in:
@@ -2,7 +2,6 @@
|
||||
# HostGroupTest.pm - Encapsulate a group of docker containers for testing
|
||||
####################################################################################################################################
|
||||
package pgBackRestTest::Common::HostGroupTest;
|
||||
use parent 'pgBackRestTest::Common::ParamTest';
|
||||
|
||||
####################################################################################################################################
|
||||
# Perl includes
|
||||
@@ -68,8 +67,8 @@ sub hostAdd
|
||||
|
||||
$self->{host}{$oHost->{strName}} = $oHost;
|
||||
|
||||
$oHost->executeSimple("sh -c 'echo \"\" >> /etc/hosts\'", undef, 'root');
|
||||
$oHost->executeSimple("sh -c 'echo \"# Test Hosts\" >> /etc/hosts'", undef, 'root');
|
||||
$oHost->executeSimple("echo \"\" >> /etc/hosts", undef, 'root');
|
||||
$oHost->executeSimple("echo \"# Test Hosts\" >> /etc/hosts", undef, 'root');
|
||||
|
||||
# Iterate hosts to add IP mappings
|
||||
foreach my $strOtherHostName (sort(keys(%{$self->{host}})))
|
||||
@@ -79,10 +78,10 @@ sub hostAdd
|
||||
if ($strOtherHostName ne $oHost->{strName})
|
||||
{
|
||||
# Add this host IP to all hosts
|
||||
$oOtherHost->executeSimple("sh -c 'echo \"$oHost->{strIP} $oHost->{strName}\" >> /etc/hosts'", undef, 'root');
|
||||
$oOtherHost->executeSimple("echo \"$oHost->{strIP} $oHost->{strName}\" >> /etc/hosts", undef, 'root');
|
||||
|
||||
# Add all other host IPs to this host
|
||||
$oHost->executeSimple("sh -c 'echo \"$oOtherHost->{strIP} ${strOtherHostName}\" >> /etc/hosts'", undef, 'root');
|
||||
$oHost->executeSimple("echo \"$oOtherHost->{strIP} ${strOtherHostName}\" >> /etc/hosts", undef, 'root');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user