mirror of
https://github.com/samba-team/samba.git
synced 2024-12-22 13:34:15 +03:00
selftest: Add dedicated RENAMEDC testenv for 'backup rename'
Add a new testenv that's similar to the existing restoredc, except we use 'backup rename' to rename the domain as we back it up. Restoring this backup then proves that a valid DC can be started from a renamed backup. Run the same sub-set of RESTOREDC tests to prove that the new testenv is sound. Signed-off-by: Tim Beale <timbeale@catalyst.net.nz> Reviewed-by: Gary Lockyer <gary@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
This commit is contained in:
parent
6681f904aa
commit
20568e00e6
@ -409,6 +409,7 @@ sub get_interface($)
|
||||
$interfaces{"vampire2000dc"} = 39;
|
||||
$interfaces{"backupfromdc"} = 40;
|
||||
$interfaces{"restoredc"} = 41;
|
||||
$interfaces{"renamedc"} = 42;
|
||||
|
||||
# update lib/socket_wrapper/socket_wrapper.c
|
||||
# #define MAX_WRAPPED_INTERFACES 64
|
||||
|
@ -2161,6 +2161,7 @@ sub check_env($$)
|
||||
s4member => ["ad_dc_ntvfs"],
|
||||
|
||||
restoredc => ["backupfromdc"],
|
||||
renamedc => ["backupfromdc"],
|
||||
|
||||
none => [],
|
||||
);
|
||||
@ -2790,6 +2791,50 @@ sub setup_restoredc
|
||||
return $env;
|
||||
}
|
||||
|
||||
# Set up a DC testenv solely by using the 'samba-tool domain backup rename' and
|
||||
# restore commands. This proves that we can backup and rename an online DC
|
||||
# ('backupfromdc') and use the backup file to create a valid, working samba DC.
|
||||
sub setup_renamedc
|
||||
{
|
||||
# note: dcvars contains the env info for the dependent testenv ('backupfromdc')
|
||||
my ($self, $prefix, $dcvars) = @_;
|
||||
print "Preparing RENAME DC...\n";
|
||||
|
||||
my $env = $self->prepare_dc_testenv($prefix, "renamedc",
|
||||
"RENAMEDOMAIN", "renamedom.samba.example.com",
|
||||
$dcvars->{PASSWORD});
|
||||
|
||||
# create a backup of the 'backupfromdc' which renames the domain
|
||||
my $backupdir = File::Temp->newdir();
|
||||
my $backup_args = "rename $env->{DOMAIN} $env->{REALM}";
|
||||
my $backup_file = $self->create_backup($env, $dcvars, $backupdir,
|
||||
$backup_args);
|
||||
unless($backup_file) {
|
||||
return undef;
|
||||
}
|
||||
|
||||
# restore the backup file to populate the rename-DC testenv
|
||||
my $restore_dir = abs_path($prefix);
|
||||
my $restore_opts = "--newservername=$env->{SERVER} --host-ip=$env->{SERVER_IP}";
|
||||
my $ret = $self->restore_backup_file($backup_file, $restore_opts,
|
||||
$restore_dir, $env->{SERVERCONFFILE});
|
||||
unless ($ret == 0) {
|
||||
return undef;
|
||||
}
|
||||
|
||||
# start samba for the restored DC
|
||||
if (not defined($self->check_or_start($env, "standard"))) {
|
||||
return undef;
|
||||
}
|
||||
|
||||
my $upn_array = ["$env->{REALM}.upn"];
|
||||
my $spn_array = ["$env->{REALM}.spn"];
|
||||
|
||||
$self->setup_namespaces($env, $upn_array, $spn_array);
|
||||
|
||||
return $env;
|
||||
}
|
||||
|
||||
sub setup_none
|
||||
{
|
||||
my ($self, $path) = @_;
|
||||
|
@ -812,7 +812,7 @@ plantestsuite_loadlist("samba4.ldap.vlv.python(ad_dc_ntvfs)", "ad_dc_ntvfs", [py
|
||||
plantestsuite_loadlist("samba4.ldap.linked_attributes.python(ad_dc_ntvfs)", "ad_dc_ntvfs:local", [python, os.path.join(samba4srcdir, "dsdb/tests/python/linked_attributes.py"), '$PREFIX_ABS/ad_dc_ntvfs/private/sam.ldb', '-U"$USERNAME%$PASSWORD"', '--workgroup=$DOMAIN', '$LOADLIST', '$LISTOPT'])
|
||||
|
||||
# These should be the first tests run against testenvs created by backup/restore
|
||||
for env in ['restoredc']:
|
||||
for env in ['restoredc', 'renamedc']:
|
||||
# check that a restored DC matches the original DC (backupfromdc)
|
||||
plantestsuite("samba4.blackbox.ldapcmp_restore", env,
|
||||
["PYTHON=%s" % python,
|
||||
@ -869,7 +869,7 @@ for env in ["ad_dc_ntvfs"]:
|
||||
)
|
||||
|
||||
# this is a basic sanity-check of Kerberos/NTLM user login
|
||||
for env in ["restoredc"]:
|
||||
for env in ["restoredc", "renamedc"]:
|
||||
plantestsuite_loadlist("samba4.ldap.login_basics.python(%s)" % env, env,
|
||||
[python, os.path.join(samba4srcdir, "dsdb/tests/python/login_basics.py"),
|
||||
"$SERVER", '-U"$USERNAME%$PASSWORD"', "-W$DOMAIN", "--realm=$REALM",
|
||||
@ -906,7 +906,7 @@ plansmbtorture4testsuite(t, "vampire_dc", ['$SERVER', '-U$USERNAME%$PASSWORD', '
|
||||
plansmbtorture4testsuite(t, "vampire_dc", ['$SERVER', '-U$USERNAME%$PASSWORD', '--workgroup=$DOMAIN'], modname="samba4.%s.two" % t)
|
||||
|
||||
# RPC smoke-tests for testenvs of interest (RODC, etc)
|
||||
for env in ['rodc', 'restoredc']:
|
||||
for env in ['rodc', 'restoredc', 'renamedc']:
|
||||
plansmbtorture4testsuite('rpc.echo', env, ['ncacn_np:$SERVER', "-k", "yes", '-U$USERNAME%$PASSWORD', '--workgroup=$DOMAIN'], modname="samba4.rpc.echo")
|
||||
plansmbtorture4testsuite('rpc.echo', "%s:local" % env, ['ncacn_np:$SERVER', "-k", "yes", '-P', '--workgroup=$DOMAIN'], modname="samba4.rpc.echo")
|
||||
plansmbtorture4testsuite('rpc.echo', "%s:local" % env, ['ncacn_np:$SERVER', "-k", "no", '-Utestallowed\ account%$DC_PASSWORD', '--workgroup=$DOMAIN'], modname="samba4.rpc.echo.testallowed")
|
||||
@ -1086,7 +1086,7 @@ for env in [
|
||||
planpythontestsuite("ad_dc_ntvfs:local", "samba.tests.kcc.kcc_utils")
|
||||
|
||||
for env in [ "simpleserver", "fileserver", "nt4_dc", "ad_dc", "ad_dc_ntvfs",
|
||||
"ad_member", "restoredc" ]:
|
||||
"ad_member", "restoredc", "renamedc" ]:
|
||||
planoldpythontestsuite(env, "netlogonsvc",
|
||||
extra_path=[os.path.join(srcdir(), 'python/samba/tests')],
|
||||
name="samba.tests.netlogonsvc.python(%s)" % env)
|
||||
@ -1110,7 +1110,8 @@ for env in ['vampire_dc', 'promoted_dc', 'rodc']:
|
||||
# environment teardown.
|
||||
# check the databases are all OK. PLEASE LEAVE THIS AS THE LAST TEST
|
||||
for env in ["ad_dc_ntvfs", "ad_dc", "fl2000dc", "fl2003dc", "fl2008r2dc",
|
||||
'vampire_dc', 'promoted_dc', 'backupfromdc', 'restoredc']:
|
||||
'vampire_dc', 'promoted_dc', 'backupfromdc', 'restoredc',
|
||||
'renamedc']:
|
||||
plantestsuite("samba4.blackbox.dbcheck(%s)" % env, env + ":local" , ["PYTHON=%s" % python, os.path.join(bbdir, "dbcheck.sh"), '$PREFIX/provision', configuration])
|
||||
|
||||
# cmocka tests not requiring a specific encironment
|
||||
|
Loading…
Reference in New Issue
Block a user