s3:libads: Add net ads keep-account test
authorJustin Stephenson <jstephen@redhat.com>
Thu, 28 Jun 2018 15:08:27 +0000 (11:08 -0400)
committerAndrew Bartlett <abartlet@samba.org>
Mon, 30 Jul 2018 08:22:59 +0000 (10:22 +0200)
Add test for the new --keep-account net ads leave operation

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13498

Signed-off-by: Justin Stephenson <jstephen@redhat.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Mon Jul 30 10:22:59 CEST 2018 on sn-devel-144

testprogs/blackbox/test_net_ads.sh

index f83ce01aae6af661f6684f7582278d70a7871995..d3c4de5b7418be78ea11c48270fcfe5c38455c79 100755 (executable)
@@ -26,6 +26,11 @@ failed=0
 
 net_tool="$BINDIR/net -s $BASEDIR/$WORKDIR/client.conf --option=security=ads"
 
+ldbsearch="ldbsearch"
+if [ -x "$BINDIR/ldbsearch" ]; then
+       ldbsearch="$BINDIR/ldbsearch"
+fi
+
 # Load test functions
 . `dirname $0`/subunit.sh
 
@@ -181,6 +186,15 @@ testit_expect_failure "leave+invalid_server" $VALGRIND $net_tool ads leave -U$DC
 
 testit "testjoin user+password" $VALGRIND $net_tool ads testjoin -U$DC_USERNAME%$DC_PASSWORD || failed=`expr $failed + 1`
 
+testit "leave+keep_account" $VALGRIND $net_tool ads leave -U$DC_USERNAME%$DC_PASSWORD --keep-account || failed=`expr $failed + 1`
+
+computers_ldb_ou="CN=Computers,DC=addom,DC=samba,DC=example,DC=com"
+testit "ldb check for existence of machine account" $ldbsearch -U$DC_USERNAME%$DC_PASSWORD -H ldap://$SERVER.$REALM -s base -b "cn=$HOSTNAME,$computers_ldb_ou" || failed=`expr $failed + 1`
+
+testit "join" $VALGRIND $net_tool ads join -U$DC_USERNAME%$DC_PASSWORD || failed=`expr $failed + 1`
+
+testit "testjoin" $VALGRIND $net_tool ads testjoin || failed=`expr $failed + 1`
+
 ##Goodbye...
 testit "leave" $VALGRIND $net_tool ads leave -U$DC_USERNAME%$DC_PASSWORD || failed=`expr $failed + 1`