summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2015-10-23 15:38:23 +1300
committerAndrew Bartlett <abartlet@samba.org>2015-10-26 08:17:47 +0100
commit0d962e010ea834c0479f403a4c8b38b05b7a0409 (patch)
tree7bf88c41ce0a1ed3841aecf3f130a98d04d390bb
parentbe2e0e6ff7e7388711c1d1570057ec0dfd36c39d (diff)
downloadsamba-0d962e010ea834c0479f403a4c8b38b05b7a0409.tar.gz
selftest: Confirm a demote of a real network works
Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Garming Sam <garming@catalyst.net.nz> Autobuild-User(master): Andrew Bartlett <abartlet@samba.org> Autobuild-Date(master): Mon Oct 26 08:17:47 CET 2015 on sn-devel-104
-rw-r--r--selftest/tests.py4
-rwxr-xr-xtestprogs/blackbox/demote-saveddb.sh67
2 files changed, 71 insertions, 0 deletions
diff --git a/selftest/tests.py b/selftest/tests.py
index 872fbaf0094..0ae23c0f55b 100644
--- a/selftest/tests.py
+++ b/selftest/tests.py
@@ -68,6 +68,10 @@ planpythontestsuite(
extra_path=[os.path.join(samba4srcdir, "..", "buildtools"),
os.path.join(samba4srcdir, "..", "third_party", "waf", "wafadmin")])
plantestsuite(
+ "samba4.blackbox.demote-saveddb", "none",
+ ["PYTHON=%s" % python, os.path.join(bbdir, "demote-saveddb.sh"),
+ '$PREFIX_ABS/demote', configuration])
+plantestsuite(
"samba4.blackbox.dbcheck.alpha13", "none",
["PYTHON=%s" % python, os.path.join(bbdir, "dbcheck-oldrelease.sh"),
'$PREFIX_ABS/provision', 'alpha13', configuration])
diff --git a/testprogs/blackbox/demote-saveddb.sh b/testprogs/blackbox/demote-saveddb.sh
new file mode 100755
index 00000000000..3d5fabd72e3
--- /dev/null
+++ b/testprogs/blackbox/demote-saveddb.sh
@@ -0,0 +1,67 @@
+#!/bin/sh
+
+if [ $# -lt 1 ]; then
+cat <<EOF
+Usage: demote.sh PREFIX RELEASE
+EOF
+exit 1;
+fi
+
+PREFIX_ABS="$1"
+shift 1
+
+. `dirname $0`/subunit.sh
+
+tree_dir=`dirname $0`/../../source4/selftest/provisions/multi-dc-samba-master-c596ac6
+
+undump() {
+ if test -x $BINDIR/tdbrestore;
+ then
+ `dirname $0`/../../source4/selftest/provisions/undump.sh $tree_dir $PREFIX_ABS $BINDIR/tdbrestore
+ else
+ `dirname $0`/../../source4/selftest/provisions/undump.sh $tree_dir $PREFIX_ABS
+ fi
+}
+
+demote() {
+ $PYTHON $BINDIR/samba-tool domain demote -H tdb://$PREFIX_ABS/private/sam.ldb --remove-other-dead-server=$1
+}
+
+
+if [ -d $tree_dir ]; then
+ testit "undump" undump
+ testit "demote-q-0-0" demote "q-0-0"
+ # The database was copied of q-0-1 so this will fail
+ # as we can't remove our own name
+ testit_expect_failure "demote-q-0-1" demote "q-0-1"
+ testit "demote-q-1-0" demote "q-1-0"
+ testit "demote-q-1-1" demote "q-1-1"
+else
+ subunit_start_test "undump"
+ subunit_skip_test "undump" <<EOF
+no test provision
+EOF
+
+ subunit_start_test "demote-q-0-0"
+ subunit_skip_test "demote-q-0-0" <<EOF
+no test provision
+EOF
+ subunit_start_test "demote-q-0-1"
+ subunit_skip_test "demote-q-0-1" <<EOF
+no test provision
+EOF
+ subunit_start_test "demote-q-1-1"
+ subunit_skip_test "demote-q-0-1" <<EOF
+no test provision
+EOF
+ subunit_start_test "demote-q-1-1"
+ subunit_skip_test "demote-q-1-1" <<EOF
+no test provision
+EOF
+fi
+
+if [ -d $PREFIX_ABS ]; then
+ rm -fr $PREFIX_ABS
+fi
+
+exit $failed