s4-test: fixes for test-howto.py
authorAndrew Tridgell <tridge@samba.org>
Tue, 16 Nov 2010 07:14:11 +0000 (18:14 +1100)
committerAndrew Tridgell <tridge@samba.org>
Tue, 16 Nov 2010 07:58:55 +0000 (07:58 +0000)
this fixes some timing issues, plus ensures we test both with and
without kerberos

Autobuild-User: Andrew Tridgell <tridge@samba.org>
Autobuild-Date: Tue Nov 16 07:58:55 UTC 2010 on sn-devel-104

source4/scripting/devel/howto/test-howto.py
source4/scripting/devel/howto/tridge.conf

index f1730833e3a7699446a5c10e75be06a23aa8645c..48e30ab9e8fbc4ef762b19288452200a40b1d880 100755 (executable)
@@ -149,7 +149,7 @@ def ping_wait(hostname):
         raise Exception("Failed to ping %s" % hostname)
     print("Host %s is up" % hostname)
 
-def port_wait(hostname, port, retries=30, delay=2, wait_for_fail=False):
+def port_wait(hostname, port, retries=100, delay=2, wait_for_fail=False):
     '''wait for a host to come up on the network'''
     retry_cmd("nc -v -z -w 1 %s %u" % (hostname, port), ['succeeded'],
               retries=retries, delay=delay, wait_for_fail=wait_for_fail)
@@ -188,8 +188,7 @@ def start_s4(prefix=None, interfaces=None):
     run_cmd('killall -9 -q samba smbd nmbd winbindd', checkfail=False)
     run_cmd(['sbin/samba',
              '--option', 'panic action=gnome-terminal -e "gdb --pid %PID%"',
-             '--option', 'interfaces=%s' % interfaces,
-             '--option', 'log level=10'])
+             '--option', 'interfaces=%s' % interfaces])
     port_wait("localhost", 445)
 
 def test_smbclient():
@@ -277,18 +276,18 @@ def join_win7():
     child.expect("The command completed successfully")
     child.sendline("shutdown /r -t 0")
     port_wait("${WINDOWS7}", 23, wait_for_fail=True)
-    port_wait("${WINDOWS7}", 23, retries=100)
+    port_wait("${WINDOWS7}", 23)
 
 
 def test_win7():
     print("Checking the win7 join is OK")
     chdir('${PREFIX}')
-    port_wait("${WINDOWS7}", 445, delay=3)
+    port_wait("${WINDOWS7}", 445)
     retry_cmd('bin/smbclient -L ${WINDOWS7}.${LCREALM} -Uadministrator@${LCREALM}%${PASSWORD1}', ["C$", "IPC$", "Sharename"])
     cmd_contains("host -t A ${WINDOWS7}.${LCREALM}.", ['has address'])
     cmd_contains('bin/smbclient -L ${WINDOWS7}.${LCREALM} -Utestallowed@${LCREALM}%${PASSWORD1}', ["C$", "IPC$", "Sharename"])
-    cmd_contains('bin/smbclient -L ${WINDOWS7}.${LCREALM} -k yes -Utestallowed@${LCREALM}%${PASSWORD1}', ["C$", "IPC$", "Sharename"])
     cmd_contains('bin/smbclient -L ${WINDOWS7}.${LCREALM} -k no -Utestallowed@${LCREALM}%${PASSWORD1}', ["C$", "IPC$", "Sharename"])
+    cmd_contains('bin/smbclient -L ${WINDOWS7}.${LCREALM} -k yes -Utestallowed@${LCREALM}%${PASSWORD1}', ["C$", "IPC$", "Sharename"])
     port_wait("${WINDOWS7}", 23)
     child = pexpect_spawn("telnet ${WINDOWS7} -l '${DOMAIN}\\administrator'")
     child.expect("Welcome to Microsoft Telnet Service")
@@ -299,7 +298,7 @@ def test_win7():
     child.expect("The command completed successfully")
 
 def join_w2k8():
-    print("Joining a ${WINDOWS_DC3} box to the domain as a DC")
+    print("Joining a w2k8 box to the domain as a DC")
     vm_poweroff("${WINDOWS_DC1}", checkfail=False)
     vm_restore("${WINDOWS_DC1}", "${WINDOWS_DC1_SNAPSHOT}")
     ping_wait("${WINDOWS_DC1}")
@@ -330,18 +329,18 @@ RebootOnCompletion=No
 ''')
     child.expect("copied.")
     child.sendline("dcpromo /answer:answers.txt")
-    i = child.expect(["Setting the computer's DNS computer name root to", "failed"], timeout=120)
+    i = child.expect(["You must restart this computer", "failed"], timeout=120)
     if i != 0:
         raise Exception("dcpromo failed")
     child.sendline("shutdown -r -t 0")
     port_wait("${WINDOWS_DC1}", 23, wait_for_fail=True)
-    port_wait("${WINDOWS_DC1}", 23, retries=100)
+    port_wait("${WINDOWS_DC1}", 23)
 
 
 def test_w2k8():
     print("Checking the w2k8 join is OK")
     chdir('${PREFIX}')
-    port_wait("${WINDOWS_DC1}", 445, delay=3)
+    port_wait("${WINDOWS_DC1}", 445)
     retry_cmd('bin/smbclient -L ${WINDOWS_DC1}.${LCREALM} -Uadministrator@${LCREALM}%${PASSWORD1}', ["C$", "IPC$", "Sharename"])
     cmd_contains("host -t A ${WINDOWS_DC1}.${LCREALM}.", ['has address'])
     cmd_contains('bin/smbclient -L ${WINDOWS_DC1}.${LCREALM} -Utestallowed@${LCREALM}%${PASSWORD1}', ["C$", "IPC$", "Sharename"])
@@ -365,24 +364,34 @@ def test_w2k8():
 
     print("Checking if new users propogate to windows")
     run_cmd('bin/samba-tool newuser test2 ${PASSWORD2}')
+    retry_cmd("bin/smbclient -L ${WINDOWS_DC1} -Utest2%${PASSWORD2} -k no", ['Sharename', 'Remote IPC'])
     retry_cmd("bin/smbclient -L ${WINDOWS_DC1} -Utest2%${PASSWORD2} -k yes", ['Sharename', 'Remote IPC'])
 
     print("Checking if new users on windows propogate to samba")
     child.sendline("net user test3 ${PASSWORD3} /add")
-    child.expect("The command completed successfully")
-    retry_cmd("bin/smbclient -L ${HOSTNAME} -Utest3%%${PASSWORD3} -k yes", ['Sharename', 'IPC'])
+    while True:
+        i = child.expect(["The command completed successfully",
+                          "The directory service was unable to allocate a relative identifier"])
+        if i == 0:
+            break
+        time.sleep(2)
+
+    retry_cmd("bin/smbclient -L ${HOSTNAME} -Utest3%${PASSWORD3} -k no", ['Sharename', 'IPC'])
+    retry_cmd("bin/smbclient -L ${HOSTNAME} -Utest3%${PASSWORD3} -k yes", ['Sharename', 'IPC'])
 
     print("Checking propogation of user deletion")
     run_cmd('bin/samba-tool user delete test2')
     child.sendline("net user test3 /del")
     child.expect("The command completed successfully")
 
+    retry_cmd("bin/smbclient -L ${WINDOWS_DC1} -Utest2%${PASSWORD2} -k no", ['LOGON_FAILURE'])
+    retry_cmd("bin/smbclient -L ${HOSTNAME} -Utest3%${PASSWORD3} -k no", ['LOGON_FAILURE'])
     retry_cmd("bin/smbclient -L ${WINDOWS_DC1} -Utest2%${PASSWORD2} -k yes", ['NT_STATUS_UNSUCCESSFUL'])
-    retry_cmd("bin/smbclient -L ${HOSTNAME} -Utest3%%${PASSWORD3} -k yes", ['NT_STATUS_UNSUCCESSFUL'])
+    retry_cmd("bin/smbclient -L ${HOSTNAME} -Utest3%${PASSWORD3} -k yes", ['NT_STATUS_UNSUCCESSFUL'])
 
 
 def join_w2k8_rodc():
-    print("Joining a ${WINDOWS_DC3} box to the domain as a RODC")
+    print("Joining a w2k8 box to the domain as a RODC")
     vm_poweroff("${WINDOWS_DC2}", checkfail=False)
     vm_restore("${WINDOWS_DC2}", "${WINDOWS_DC2_SNAPSHOT}")
     ping_wait("${WINDOWS_DC2}")
@@ -420,19 +429,19 @@ RebootOnCompletion=No
 ''')
     child.expect("copied.")
     child.sendline("dcpromo /answer:answers.txt")
-    i = child.expect(["Securing machine", "failed"], timeout=120)
+    i = child.expect(["You must restart this computer", "failed"], timeout=120)
     if i != 0:
         raise Exception("dcpromo failed")
     child.sendline("shutdown -r -t 0")
     port_wait("${WINDOWS_DC2}", 23, wait_for_fail=True)
-    port_wait("${WINDOWS_DC2}", 23, retries=100)
+    port_wait("${WINDOWS_DC2}", 23)
 
 
 
 def test_w2k8_rodc():
     print("Checking the w2k8 RODC join is OK")
     chdir('${PREFIX}')
-    port_wait("${WINDOWS_DC2}", 445, delay=3)
+    port_wait("${WINDOWS_DC2}", 445)
     retry_cmd('bin/smbclient -L ${WINDOWS_DC2}.${LCREALM} -Uadministrator@${LCREALM}%${PASSWORD1}', ["C$", "IPC$", "Sharename"])
     cmd_contains("host -t A ${WINDOWS_DC2}.${LCREALM}.", ['has address'])
     cmd_contains('bin/smbclient -L ${WINDOWS_DC2}.${LCREALM} -Utestallowed@${LCREALM}%${PASSWORD1}', ["C$", "IPC$", "Sharename"])
@@ -456,8 +465,8 @@ def test_w2k8_rodc():
 
     print("Checking if new users are available on windows")
     run_cmd('bin/samba-tool newuser test2 ${PASSWORD2}')
-    retry_cmd("bin/smbclient -L ${WINDOWS_DC2} -Utest2%${PASSWORD2} -k yes", ['Sharename', 'Remote IPC'])
     retry_cmd("bin/smbclient -L ${WINDOWS_DC2} -Utest2%${PASSWORD2} -k no", ['Sharename', 'Remote IPC'])
+    retry_cmd("bin/smbclient -L ${WINDOWS_DC2} -Utest2%${PASSWORD2} -k yes", ['Sharename', 'Remote IPC'])
     run_cmd('bin/samba-tool user delete test2')
     retry_cmd("bin/smbclient -L ${WINDOWS_DC2} -Utest2%${PASSWORD2}", ['LOGON_FAILURE'])
 
@@ -498,22 +507,24 @@ def test_vampire():
 
     print("Checking if new users propogate to windows")
     run_cmd('bin/samba-tool newuser test2 ${PASSWORD2}')
-    retry_cmd("bin/smbclient -L ${WINDOWS_DC3} -Utest2%${PASSWORD2} -k yes", ['Sharename', 'Remote IPC'])
     retry_cmd("bin/smbclient -L ${WINDOWS_DC3} -Utest2%${PASSWORD2} -k no", ['Sharename', 'Remote IPC'])
+    retry_cmd("bin/smbclient -L ${WINDOWS_DC3} -Utest2%${PASSWORD2} -k yes", ['Sharename', 'Remote IPC'])
 
     print("Checking if new users on windows propogate to samba")
     child.sendline("net user test3 ${PASSWORD3} /add")
     child.expect("The command completed successfully")
-    retry_cmd("bin/smbclient -L ${HOSTNAME} -Utest2%%${PASSWORD2} -k yes", ['Sharename', 'IPC'])
-    retry_cmd("bin/smbclient -L ${HOSTNAME} -Utest2%%${PASSWORD2} -k no", ['Sharename', 'IPC'])
+    retry_cmd("bin/smbclient -L ${HOSTNAME} -Utest2%${PASSWORD2} -k no", ['Sharename', 'IPC'])
+    retry_cmd("bin/smbclient -L ${HOSTNAME} -Utest2%${PASSWORD2} -k yes", ['Sharename', 'IPC'])
 
     print("Checking propogation of user deletion")
     run_cmd('bin/samba-tool user delete test2')
     child.sendline("net user test3 /del")
     child.expect("The command completed successfully")
 
+    retry_cmd("bin/smbclient -L ${WINDOWS_DC1} -Utest2%${PASSWORD2} -k no", ['LOGON_FAILURE'])
+    retry_cmd("bin/smbclient -L ${HOSTNAME} -Utest2%${PASSWORD2} -k no", ['LOGON_FAILURE'])
     retry_cmd("bin/smbclient -L ${WINDOWS_DC1} -Utest2%${PASSWORD2} -k yes", ['NT_STATUS_UNSUCCESSFUL'])
-    retry_cmd("bin/smbclient -L ${HOSTNAME} -Utest2%%${PASSWORD2} -k yes", ['NT_STATUS_UNSUCCESSFUL'])
+    retry_cmd("bin/smbclient -L ${HOSTNAME} -Utest2%${PASSWORD2} -k yes", ['NT_STATUS_UNSUCCESSFUL'])
 
 
 
index 4b21b571a33036d5e7e1d302252307a12980a417..5b184b679a2c3fd6b9a0541480a56dc538bc2974 100644 (file)
@@ -21,7 +21,7 @@ RNDC                : /usr/sbin/rndc
 REALM                 : HOWTO.TRIDGELL.NET
 LCREALM               : howto.tridgell.net
 DOMAIN                : howto
-BASEDN                : DC=howtoDC=tridgellDC=net
+BASEDN                : DC=howto,DC=tridgell,DC=net
 PASSWORD1             : p@ssw0rd
 PASSWORD2             : p@ssw0rd2
 PASSWORD3             : p@ssw0rd3
@@ -35,13 +35,13 @@ WINDOWS7_SNAPSHOT     : howto-test2
 WINDOWS_DC1           : w2k8r2b
 WINDOWS_DC1_VM        : w2k8r2b
 WINDOWS_DC1_PASS      : p@ssw0rd
-WINDOWS_DC1_SNAPSHOT  : howto-test
+WINDOWS_DC1_SNAPSHOT  : howto-test2
 
 # this VM will become a RODC in the samba domain
 WINDOWS_DC2           : w2k8r2c
 WINDOWS_DC2_VM        : w2k8r2c
 WINDOWS_DC2_PASS      : p@ssw0rd
-WINDOWS_DC2_SNAPSHOT  : howto-test
+WINDOWS_DC2_SNAPSHOT  : howto-test2
 
 # Samba will join this VM as a DC
 WINDOWS_DC3           : w2k8