From 8c0853b80c4dc0370a8e91796388e4818123f5a6 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Tue, 29 Jan 2019 13:57:04 +0100 Subject: [PATCH] selftest:Samba4: wait for DNS names being registered We can't reliable start tests without registered dns names. Signed-off-by: Stefan Metzmacher Reviewed-by: Andrew Bartlett --- selftest/target/Samba4.pm | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/selftest/target/Samba4.pm b/selftest/target/Samba4.pm index 05c89345661..179a93ec06c 100755 --- a/selftest/target/Samba4.pm +++ b/selftest/target/Samba4.pm @@ -284,6 +284,35 @@ sub wait_for_start($$) return -1; } + # Ensure we registered all our names + if ($testenv_vars->{SERVER_ROLE} eq "domain controller") { + my $max_wait = 60; + print "Waiting for dns_update_cache to be created.\n"; + $count = 0; + while (not -e "$testenv_vars->{PRIVATEDIR}/dns_update_cache") { + $count++; + if ($count > $max_wait) { + teardown_env($self, $testenv_vars); + warn("Timed out ($max_wait sec) waiting for dns_update_cache PID $testenv_vars->{SAMBA_PID}"); + return -1; + } + print "Waiting for dns_update_cache to be created...\n"; + sleep(1); + } + print "Waiting for dns_update_cache to be filled.\n"; + $count = 0; + while ((-s "$testenv_vars->{PRIVATEDIR}/dns_update_cache") == 0) { + $count++; + if ($count > $max_wait) { + teardown_env($self, $testenv_vars); + warn("Timed out ($max_wait sec) waiting for dns_update_cache PID $testenv_vars->{SAMBA_PID}"); + return -1; + } + print "Waiting for dns_update_cache to be filled...\n"; + sleep(1); + } + } + print $self->getlog_env($testenv_vars); print "READY ($testenv_vars->{SAMBA_PID})\n";