[PATCH] Create a custom testenv from backup-file for manual testing

Andreas Schneider asn at samba.org
Wed Nov 7 16:10:44 UTC 2018

On Tuesday, 30 October 2018 21:52:19 CET Tim Beale via samba-technical wrote:
> The attached patch allows you to easily spin up any custom testenv that
> you want, for manual testing. All you need is a backup-file that the
> testenv DC will be based off.
> The main use-case is any testing that involves a large database.
> Creating user accounts is slow. Even with the improvements to the
> traffic_replay user generation, creating 5,000 users still takes close
> to 10 minutes. Instead of creating a blank testenv and slowly populating
> it with users, you can do this step once, take a backup, and then spin
> up the backup database multiple times as a new testenv.
> This testenv might be useful in other situations too. E.g. testing
> migrating databases across samba versions, you spot a DB corruption and
> want to try diagnosing/fixing it without completely losing the original
> problem state, you want to create a labdc-replica testenv of a real
> network, etc.
> Also fixed a couple of minor dnsupdate problems that were making
> debugging testenv bootstrapping issues difficult.
> CI pass: https://gitlab.com/catalyst-samba/samba/pipelines/34756736

Hi Tim,

running make test locally, I get:

ERROR(<type 'exceptions.OSError'>): uncaught exception - [Errno 2] No such 
file or directory                                                                              
  File "bin/python/samba/netcmd/__init__.py", line 184, in _run                                                                                                           
    return self.run(*args, **kwargs)                                                                                                                                      
  File "bin/python/samba/netcmd/domain_backup.py", line 982, in run                                                                                                       
    self.backup_smb_dbs(paths.private_dir, samdb, lp, logger)                                                                                                             
  File "bin/python/samba/netcmd/domain_backup.py", line 907, in backup_smb_dbs
  File "bin/python/samba/netcmd/domain_backup.py", line 866, in 
    mdb_copy(path, path + self.backup_ext)
  File "bin/python/samba/mdb_util.py", line 35, in mdb_copy
    status = subprocess.check_call(mdb_copy_cmd, close_fds=True, shell=False)
  File "/usr/lib64/python2.7/subprocess.py", line 185, in check_call
    retcode = call(*popenargs, **kwargs)
  File "/usr/lib64/python2.7/subprocess.py", line 172, in call
    return Popen(*popenargs, **kwargs).wait()
  File "/usr/lib64/python2.7/subprocess.py", line 394, in __init__
    errread, errwrite)
  File "/usr/lib64/python2.7/subprocess.py", line 1047, in _execute_child
    raise child_exception
Failed to create backup using:
projects/samba/st/dns_host_fie"  KRB5_CONFIG="/home/asn/workspace/projects/
samba/st/backupfromdc/etc/krb5.conf" KRB5CCNAME="/home/asn/workspace/projects/
samba/st/offlinebackupdc/krb5_ccache"  ./bin/amba-tool domain backup offline -
s /home/asn/workspace/projects/samba/st/backupfromdc/etc/smb.conf --
targetdir=/home/asn/workspace/projects/samba/st/tmp/9r3r9134qP at /home/asn/
workspace/projects/samba/selftest/target/Samba4.pm line 2701.
failed to start up environment 'offlinebackupdc' at /home/asn/workspace/
projects/samba/selftest/target/Samba.pm line 83.                                                 
samba can't start up known environment 'offlinebackupdc' at /home/asn/
workspace/projects/samba/selftest/selftest.pl line 983.

Andreas Schneider                      asn at samba.org
Samba Team                             www.samba.org
GPG-ID:     8DFF53E18F2ABC8D8F3C92237EE0FC4DCC014E3D

More information about the samba-technical mailing list