From 08f0562240155a871bd2a78d217db660e8ee3c91 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Sat, 16 Feb 2013 01:07:27 +1100 Subject: selftest: Run dbcheck and improved upgrdeprovision tests against release-4-0-0 The improved upgradeprovision tests now call ldapcmp to verify the changes made do actually bring the database in line with a fresh provision. Andrew Bartlett Reviewed-by: Stefan Metzmacher --- testprogs/blackbox/dbcheck-alpha13.sh | 64 ------- testprogs/blackbox/dbcheck-oldrelease.sh | 65 +++++++ testprogs/blackbox/upgradeprovision-alpha13.sh | 166 ------------------ testprogs/blackbox/upgradeprovision-oldrelease.sh | 203 ++++++++++++++++++++++ 4 files changed, 268 insertions(+), 230 deletions(-) delete mode 100755 testprogs/blackbox/dbcheck-alpha13.sh create mode 100755 testprogs/blackbox/dbcheck-oldrelease.sh delete mode 100755 testprogs/blackbox/upgradeprovision-alpha13.sh create mode 100755 testprogs/blackbox/upgradeprovision-oldrelease.sh (limited to 'testprogs') diff --git a/testprogs/blackbox/dbcheck-alpha13.sh b/testprogs/blackbox/dbcheck-alpha13.sh deleted file mode 100755 index a028116075..0000000000 --- a/testprogs/blackbox/dbcheck-alpha13.sh +++ /dev/null @@ -1,64 +0,0 @@ -#!/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 -} - -samba_upgradedns() { - $PYTHON $BINDIR/samba_upgradedns --dns-backend=SAMBA_INTERNAL -s "$PREFIX_ABS/alpha13_upgrade_full/etc/smb.conf" -} - -referenceprovision() { - $PYTHON $BINDIR/samba-tool domain provision --server-role="dc" --domain=SAMBA --host-name=ares --realm=alpha13.samba.corp --targetdir=$PREFIX_ABS/alpha13_upgrade_reference --use-ntvfs -} - -ldapcmp() { - $PYTHON $BINDIR/samba-tool ldapcmp tdb://$PREFIX_ABS/alpha13_upgrade_reference/private/sam.ldb tdb://$PREFIX_ABS/alpha13_upgrade_full/private/sam.ldb --two --filter=dNSProperty,dnsRecord,cn,displayName,versionNumber,systemFlags,msDS-HasInstantiatedNCs --skip-missing-dn -} - -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 $PREFIX_ABS/alpha13_upgrade_reference ]; then - rm -fr $PREFIX_ABS/alpha13_upgrade_reference -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 - testit "referenceprovision" referenceprovision - testit "samba_upgradedns" samba_upgradedns - testit "ldapcmp" ldapcmp -else - subunit_start_test "alpha13" - subunit_skip_test "alpha13" < $PREFIX_ABS/${RELEASE}_upgrade/etc/smb.conf + + cp -a $release_dir/private/*.keytab $PREFIX_ABS/${RELEASE}_upgrade_full/private/ + cp -a $release_dir/sysvol $PREFIX_ABS/${RELEASE}_upgrade_full/ + mkdir $PREFIX_ABS/${RELEASE}_upgrade_full/etc/ + cat $release_dir/etc/smb.conf.template | \ + sed "s|@@PREFIX@@|$PREFIX_ABS/${RELEASE}_upgrade_full|g" \ + > $PREFIX_ABS/${RELEASE}_upgrade_full/etc/smb.conf +} + +remove_dns_user() { + if [ x$RELEASE != x"release-4-0-0" ]; then + # This is done, because otherwise the upgrdeprovision will not run without --full + $BINDIR/ldbdel -H tdb://$PREFIX_ABS/${RELEASE}_upgrade/private/sam.ldb cn=dns,cn=users,dc=${RELEASE},dc=samba,dc=corp + fi +} + +reindex() { + $BINDIR/samba-tool dbcheck --reindex -H tdb://$PREFIX_ABS/${RELEASE}_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/${RELEASE}_upgrade/private/sam.ldb $@ +} + +dbcheck_clean() { + $BINDIR/samba-tool dbcheck --cross-ncs -H tdb://$PREFIX_ABS/${RELEASE}_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/${RELEASE}_upgrade_full/private/sam.ldb $@ +} + +dbcheck_full_clean() { + $BINDIR/samba-tool dbcheck --cross-ncs -H tdb://$PREFIX_ABS/${RELEASE}_upgrade_full/private/sam.ldb $@ +} + +upgradeprovision() { + $PYTHON $BINDIR/samba_upgradeprovision -s "$PREFIX_ABS/${RELEASE}_upgrade/etc/smb.conf" --debugchange +} + +upgradeprovision_full() { + $PYTHON $BINDIR/samba_upgradeprovision -s "$PREFIX_ABS/${RELEASE}_upgrade_full/etc/smb.conf" --full --debugchange +} + +samba_upgradedns() { + $PYTHON $BINDIR/samba_upgradedns --dns-backend=SAMBA_INTERNAL -s "$PREFIX_ABS/${RELEASE}_upgrade_full/etc/smb.conf" +} + +referenceprovision() { + $PYTHON $BINDIR/samba-tool domain provision --server-role="dc" --domain=SAMBA --host-name=ares --realm=${RELEASE}.samba.corp --targetdir=$PREFIX_ABS/${RELEASE}_upgrade_reference --use-ntvfs --host-ip=127.0.0.1 --host-ip6=::1 +} + +ldapcmp() { + if [ x$RELEASE != x"alpha13" ]; then + $PYTHON $BINDIR/samba-tool ldapcmp tdb://$PREFIX_ABS/${RELEASE}_upgrade_reference/private/sam.ldb tdb://$PREFIX_ABS/${RELEASE}_upgrade/private/sam.ldb --two --skip-missing-dn --filter=dnsRecord + fi +} + +ldapcmp_full() { + $PYTHON $BINDIR/samba-tool ldapcmp tdb://$PREFIX_ABS/${RELEASE}_upgrade_reference/private/sam.ldb tdb://$PREFIX_ABS/${RELEASE}_upgrade_full/private/sam.ldb --two --filter=dNSProperty,dnsRecord,cn,displayName,versionNumber,systemFlags,msDS-HasInstantiatedNCs --skip-missing-dn +} + +ldapcmp_sd() { + $PYTHON $BINDIR/samba-tool ldapcmp tdb://$PREFIX_ABS/${RELEASE}_upgrade_reference/private/sam.ldb tdb://$PREFIX_ABS/${RELEASE}_upgrade/private/sam.ldb --two --sd --skip-missing-dn +} + +ldapcmp_full_sd() { + $PYTHON $BINDIR/samba-tool ldapcmp tdb://$PREFIX_ABS/${RELEASE}_upgrade_reference/private/sam.ldb tdb://$PREFIX_ABS/${RELEASE}_upgrade_full/private/sam.ldb --two --sd --skip-missing-dn +} + +if [ -d $PREFIX_ABS/${RELEASE}_upgrade ]; then + rm -fr $PREFIX_ABS/${RELEASE}_upgrade +fi + +if [ -d $PREFIX_ABS/${RELEASE}_upgrade_full ]; then + rm -fr $PREFIX_ABS/${RELEASE}_upgrade_full +fi + +if [ -d $PREFIX_ABS/${RELEASE}_upgrade_reference ]; then + rm -fr $PREFIX_ABS/${RELEASE}_upgrade_reference +fi + +if [ -d $release_dir ]; then + testit $RELEASE undump + testit "remove_dns_user" remove_dns_user + testit "upgradeprovision" upgradeprovision + testit "upgradeprovision_full" upgradeprovision_full + testit "reindex" reindex + # So far, only releases before 4.0.0rc6 need a dbcheck if upgradeprovision has already been run + if [ x$RELEASE != x"release-4-0-0" ]; then + testit_expect_failure "dbcheck" dbcheck + fi + testit_expect_failure "dbcheck_full" dbcheck_full + testit "dbcheck_clean" dbcheck_clean + testit "dbcheck_full_clean" dbcheck_full_clean + testit "referenceprovision" referenceprovision + testit "samba_upgradedns" samba_upgradedns + testit "ldapcmp" ldapcmp + testit "ldapcmp_sd" ldapcmp_sd + testit "ldapcmp_full_sd" ldapcmp_full_sd +else + subunit_start_test "${RELEASE}" + subunit_skip_test "${RELEASE}" <