wintest: extend get_is_dc function with additional expectations
[garming/samba-autobuild/.git] / wintest / wintest.py
index 97ff2be9eab9daf7c2cd6faf1f7dfa8159abcd8c..d01e94bf658e14bf781250c8245be64adedc05b9 100644 (file)
@@ -492,9 +492,12 @@ options {
 
         while retries > 0:
             child = self.pexpect_spawn("nc -v -z -w 1 %s %u" % (hostname, port), crlf=False, timeout=1)
-            i = child.expect(['succeeded', 'failed', pexpect.EOF, pexpect.TIMEOUT])
+            child.expect([pexpect.EOF, pexpect.TIMEOUT])
+            child.close()
+            i = child.exitstatus
             if wait_for_fail:
-                if i > 0:
+                #wait for timeout or fail
+                if i == None or i > 0:
                     return
             else:
                 if i == 0:
@@ -551,7 +554,7 @@ options {
     def get_is_dc(self, child):
         '''check if a windows machine is a domain controller'''
         child.sendline("dcdiag")
-        i = child.expect(["is not a Directory Server",
+        i = child.expect(["is not a [Directory Server|DC]",
                           "is not recognized as an internal or external command",
                           "Home Server = ",
                           "passed test Replications"])
@@ -950,5 +953,8 @@ RebootOnCompletion=No
 
         if self.opts.dns_backend == 'SAMBA_INTERNAL':
             self.setvar('ALLOW_DNS_UPDATES', '--option=allow dns updates = True')
+            # we need recursive queries, since host expects answers with RA-bit
+            self.setvar('DNS_RECURSIVE_QUERIES', '--option=dns recursive queries = Yes')
         else:
             self.setvar('ALLOW_DNS_UPDATES', '')
+            self.setvar('DNS_RECURSIVE_QUERIES', '')