From 0f8ef5a2c83e0496ef79c3d6f8b1188fdd1943a0 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Tue, 22 Jan 2013 23:39:15 +1100 Subject: selftest: Add test of upgradeprovision using the old alpha13 tree This ensures that upgradeprovision works as expected on a known good old database. Andrew Bartlett Reviewed-by: Stefan Metzmacher Autobuild-User(master): Andrew Bartlett Autobuild-Date(master): Sun Jan 27 11:55:54 CET 2013 on sn-devel-104 --- testprogs/blackbox/upgradeprovision-alpha13.sh | 135 +++++++++++++++++++++++++ 1 file changed, 135 insertions(+) create mode 100755 testprogs/blackbox/upgradeprovision-alpha13.sh (limited to 'testprogs') diff --git a/testprogs/blackbox/upgradeprovision-alpha13.sh b/testprogs/blackbox/upgradeprovision-alpha13.sh new file mode 100755 index 0000000000..1747c7b4e9 --- /dev/null +++ b/testprogs/blackbox/upgradeprovision-alpha13.sh @@ -0,0 +1,135 @@ +#!/bin/sh + +if [ $# -lt 1 ]; then +cat < $PREFIX_ABS/alpha13_upgrade/etc/smb.conf + + cp -a $alpha13_dir/private/*.keytab $PREFIX_ABS/alpha13_upgrade_full/private/ + cp -a $alpha13_dir/sysvol $PREFIX_ABS/alpha13_upgrade_full/ + mkdir $PREFIX_ABS/alpha13_upgrade_full/etc/ + cat $alpha13_dir/etc/smb.conf.template | \ + sed "s|@@PREFIX@@|$PREFIX_ABS/alpha13_upgrade_full|g" \ + > $PREFIX_ABS/alpha13_upgrade_full/etc/smb.conf +} + +remove_dns_user() { + # This is done, because otherwise the upgrdeprovision will not run without --full + $BINDIR/ldbdel -H tdb://$PREFIX_ABS/alpha13_upgrade/private/sam.ldb cn=dns,cn=users,dc=alpha13,dc=samba,dc=corp +} + +reindex() { + $BINDIR/samba-tool dbcheck --reindex -H tdb://$PREFIX_ABS/alpha13_upgrade/private/sam.ldb $@ +} + +# This should 'fail', because it returns the number of modified records +dbcheck() { + $BINDIR/samba-tool dbcheck --cross-ncs --fix --yes -H tdb://$PREFIX_ABS/alpha13_upgrade/private/sam.ldb $@ +} + +dbcheck_clean() { + $BINDIR/samba-tool dbcheck --cross-ncs -H tdb://$PREFIX_ABS/alpha13_upgrade/private/sam.ldb $@ +} + +# This should 'fail', because it returns the number of modified records +dbcheck_full() { + $BINDIR/samba-tool dbcheck --cross-ncs --fix --yes -H tdb://$PREFIX_ABS/alpha13_upgrade_full/private/sam.ldb $@ +} + +dbcheck_full_clean() { + $BINDIR/samba-tool dbcheck --cross-ncs -H tdb://$PREFIX_ABS/alpha13_upgrade_full/private/sam.ldb $@ +} + +upgradeprovision() { + $PYTHON $BINDIR/samba_upgradeprovision -s "$PREFIX_ABS/alpha13_upgrade/etc/smb.conf" --debugchange +} + +upgradeprovision_full() { + $PYTHON $BINDIR/samba_upgradeprovision -s "$PREFIX_ABS/alpha13_upgrade_full/etc/smb.conf" --full --debugchange +} + +if [ -d $PREFIX_ABS/alpha13_upgrade ]; then + rm -fr $PREFIX_ABS/alpha13_upgrade +fi + +if [ -d $PREFIX_ABS/alpha13_upgrade_full ]; then + rm -fr $PREFIX_ABS/alpha13_upgrade_full +fi + +if [ -d $alpha13_dir ]; then + testit "alpha13" alpha13 + testit "remove_dns_user" remove_dns_user + testit "upgradeprovision" upgradeprovision + testit "upgradeprovision_full" upgradeprovision_full + testit "reindex" reindex + testit_expect_failure "dbcheck" dbcheck + testit "dbcheck_clean" dbcheck_clean + testit_expect_failure "dbcheck_full" dbcheck_full + testit "dbcheck_full_clean" dbcheck_full_clean +else + subunit_start_test "alpha13" + subunit_skip_test "alpha13" <