diff options
author | Andrew Bartlett <abartlet@samba.org> | 2013-06-19 11:33:36 +1000 |
---|---|---|
committer | Stefan Metzmacher <metze@samba.org> | 2013-07-24 16:35:20 +0200 |
commit | ae0ba6bd833f71c4337ae3b6621bf797cb3c48c2 (patch) | |
tree | e40d8b077fff77fc0130e9d12ecf9f47f6004ad7 /selftest/target | |
parent | db9c3c62c89e1328872e3fdedde22b78770728a9 (diff) | |
download | samba-ae0ba6bd833f71c4337ae3b6621bf797cb3c48c2.tar.gz samba-ae0ba6bd833f71c4337ae3b6621bf797cb3c48c2.tar.bz2 samba-ae0ba6bd833f71c4337ae3b6621bf797cb3c48c2.zip |
selftest: Ensure the DC has started and and got a RID set before we proceed
This avoids errors when a busy DC has not yet fetched a RID set, showing up
as flapping tests when users are created, such as the samr.large-dc test.
Andrew Bartlett
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Diffstat (limited to 'selftest/target')
-rw-r--r-- | selftest/target/Samba4.pm | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/selftest/target/Samba4.pm b/selftest/target/Samba4.pm index e279beb3ea..e574b481bb 100644 --- a/selftest/target/Samba4.pm +++ b/selftest/target/Samba4.pm @@ -141,6 +141,7 @@ sub check_or_start($$$) sub wait_for_start($$) { my ($self, $testenv_vars) = @_; + my $ret; # give time for nbt server to register its names print "delaying for nbt name registration\n"; sleep 2; @@ -161,7 +162,25 @@ sub wait_for_start($$) system("$nmblookup $testenv_vars->{CONFIGURATION} $testenv_vars->{NETBIOSNAME}"); system("$nmblookup $testenv_vars->{CONFIGURATION} -U $testenv_vars->{SERVER_IP} $testenv_vars->{NETBIOSNAME}"); + # Ensure we have the first RID Set before we start tests. This makes the tests more reliable. + if ($testenv_vars->{SERVER_ROLE} eq "domain controller" and not ($testenv_vars->{NETBIOS_NAME} eq "rodc")) { + print "waiting for working LDAP and a RID Set to be allocated\n"; + my $ldbsearch = Samba::bindir_path($self, "ldbsearch"); + my $count = 0; + my $base_dn = "DC=".join(",DC=", split(/\./, $testenv_vars->{REALM})); + my $rid_set_dn = "cn=RID Set,cn=$testenv_vars->{NETBIOSNAME},ou=domain controllers,$base_dn"; + while (system("$ldbsearch -H ldap://$testenv_vars->{SERVER} -U$testenv_vars->{USERNAME}%$testenv_vars->{PASSWORD} -s base -b \"$rid_set_dn\" rIDAllocationPool > /dev/null") != 0) { + $count++; + if ($count > 40) { + $ret = 1; + last; + } + sleep(1); + } + } print $self->getlog_env($testenv_vars); + + return $ret } sub write_ldb_file($$$) @@ -692,7 +711,8 @@ nogroup:x:65534:nobody NSS_WRAPPER_WINBIND_SO_PATH => Samba::nss_wrapper_winbind_so_path($self), LOCAL_PATH => $ctx->{share}, UID_RFC2307TEST => $uid_rfc2307test, - GID_RFC2307TEST => $gid_rfc2307test + GID_RFC2307TEST => $gid_rfc2307test, + SERVER_ROLE => $ctx->{server_role} }; return $ret; |