selftest: Change backup/restore testenvs to use 1 prefork child
authorTim Beale <timbeale@catalyst.net.nz>
Mon, 4 Feb 2019 23:23:43 +0000 (12:23 +1300)
committerAndrew Bartlett <abartlet@samba.org>
Wed, 13 Feb 2019 03:15:15 +0000 (04:15 +0100)
Recently the gitlab CI jobs were hitting memory resource limits and
using swap, which then caused test failures. The process model used in
the testenvs seemed to be contributing to this problem.

We can reduce the memory overhead of the restore/backup testenvs by
using 1 prefork child process instead of the default of 4 (kudos to
Garming for the idea). The tests run against these testenvs are basic
sanity-checks, rather than heavy-duty stress tests, so the number of
prefork workers shouldn't matter.

This is a bit of a tradeoff between testing the defaults that will
actually be used in production vs using limited resources efficiently on
shared CI runner machines.

Signed-off-by: Tim Beale <timbeale@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
selftest/target/Samba4.pm

index c0f557999ebf54f2d5248ad519ffb210fb416fa1..647e1f14467f1e165132e72680e0d7a182d12c39 100755 (executable)
@@ -3081,7 +3081,8 @@ sub setup_restoredc
        # we arbitrarily designate the restored DC as having SMBv1 disabled
        my $extra_conf = "
        server min protocol = SMB2
-       client min protocol = SMB2";
+       client min protocol = SMB2
+       prefork children = 1";
 
        my ($env, $ctx) = $self->prepare_dc_testenv($prefix, "restoredc",
                                                    $dcvars->{DOMAIN},
@@ -3124,11 +3125,12 @@ sub setup_renamedc
        # note: dcvars contains the env info for the dependent testenv ('backupfromdc')
        my ($self, $prefix, $dcvars) = @_;
        print "Preparing RENAME DC...\n";
+       my $extra_conf = "prefork children = 1";
 
        my $realm = "renamedom.samba.example.com";
        my ($env, $ctx) = $self->prepare_dc_testenv($prefix, "renamedc",
                                                    "RENAMEDOMAIN", $realm,
-                                                   $dcvars->{PASSWORD}, "");
+                                                   $dcvars->{PASSWORD}, $extra_conf);
 
        # create a backup of the 'backupfromdc' which renames the domain
        my $backupdir = File::Temp->newdir();
@@ -3171,11 +3173,12 @@ sub setup_offlinebackupdc
        # note: dcvars contains the env info for the dependent testenv ('backupfromdc')
        my ($self, $prefix, $dcvars) = @_;
        print "Preparing OFFLINE BACKUP DC...\n";
+       my $extra_conf = "prefork children = 1";
 
        my ($env, $ctx) = $self->prepare_dc_testenv($prefix, "offlinebackupdc",
                                                    $dcvars->{DOMAIN},
                                                    $dcvars->{REALM},
-                                                   $dcvars->{PASSWORD}, "");
+                                                   $dcvars->{PASSWORD}, $extra_conf);
 
        # create an offline backup of the 'backupfromdc' target
        my $backupdir = File::Temp->newdir();
@@ -3215,11 +3218,12 @@ sub setup_labdc
        # note: dcvars contains the env info for the dependent testenv ('backupfromdc')
        my ($self, $prefix, $dcvars) = @_;
        print "Preparing LAB-DOMAIN DC...\n";
+       my $extra_conf = "prefork children = 1";
 
        my ($env, $ctx) = $self->prepare_dc_testenv($prefix, "labdc",
                                                    "LABDOMAIN",
                                                    "labdom.samba.example.com",
-                                                   $dcvars->{PASSWORD}, "");
+                                                   $dcvars->{PASSWORD}, $extra_conf);
 
        # create a backup of the 'backupfromdc' which renames the domain and uses
        # the --no-secrets option to scrub any sensitive info