selftest: Clear environment before provision
commit3966342a1817b84d78e0c6687b4e7dc6d71f3c41
authorJamie McClymont <jamiemcclymont@catalyst.net.nz>
Mon, 29 Jan 2018 05:59:34 +0000 (29 18:59 +1300)
committerAndreas Schneider <asn@cryptomilk.org>
Thu, 22 Mar 2018 07:00:25 +0000 (22 08:00 +0100)
tree487ac360b67c90fb36e2f2a7c43c0aa22dbff3d3
parentef35fbfc8ca3f8583507c3b55cab1304290a204d
selftest: Clear environment before provision

Currently, if an environment is being provisioned after a test which used
ad_member_rfc2307, the provisioning process has all of the following in its
environment:

{
'DC_NETBIOSNAME'               => 'LOCALDC',
'DC_PASSWORD'                  => 'locDCpass1',
'DC_SERVER_IP'                 => '127.0.0.21',
'DC_SERVER_IPV6'               => 'fd00:0000:0000:0000:0000:0000:5357:5f15',
'DC_SERVER'                    => 'localdc',
'DC_USERNAME'                  => 'Administrator',
'DOMAIN'                       => 'SAMBADOMAIN',
'LOCAL_PATH'                   => '/.../st/ad_member_rfc2307/share',
'LOCK_DIR'                     => '/.../st/ad_member_rfc2307/lockdir',
'NETBIOSNAME'                  => 'RFC2307MEMBER',
'NMBD_SOCKET_DIR'              => '/.../st/ad_member_rfc2307/nmbd',
'NSS_WRAPPER_GROUP'            => '/.../st/ad_member_rfc2307/private/group',
'NSS_WRAPPER_HOSTNAME'         => 'rfc2307member.samba.example.com',
'NSS_WRAPPER_HOSTS'            => '/.../st/hosts',
'NSS_WRAPPER_MODULE_FN_PREFIX' => 'winbind',
'NSS_WRAPPER_MODULE_SO_PATH'   => '/.../bin/default/nsswitch/libnss-wrapper-winbind.so',
'NSS_WRAPPER_PASSWD'           => '/.../st/ad_member_rfc2307/private/passwd',
'PASSWORD'                     => 'loCalMemberPass',
'REALM'                        => 'SAMBA.EXAMPLE.COM',
'RESOLV_WRAPPER_HOSTS'         => '/.../st/dns_host_file',
'SELFTEST_WINBINDD_SOCKET_DIR' => '/.../st/ad_member_rfc2307/winbindd',
'SERVER_IP'                    => '127.0.0.34',
'SERVER_IPV6'                  => 'fd00:0000:0000:0000:0000:0000:5357:5f22',
'SERVER'                       => 'RFC2307MEMBER',
'USERID'                       => '55668',
'USERNAME'                     => 'jamiemcclymont',
}

Unsurprisingly, some of these can cause issues for the provisioning process, if
a reduced subset of tests is being run which causes the provision to encounter
never-before-seen pairs of adjacent environments.

For example, a run with only
TESTS='--include-env=vampire_dc --include-env=ad_member_rfc2307'
would fail to start up the vampire_dc with:
Could not find machine account in secrets database:
Failed to fetch machine account password from secrets.ldb:
Could not find entry to match filter:
'(&(flatname=SAMBADOMAIN)(objectclass=primaryDomain))' base: 'cn=Primary Domains': No such object: dsdb_search at ../source4/dsdb/common/util.c:4641

Signed-off-by: Jamie McClymont <jamiemcclymont@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
selftest/selftest.pl