diff options
author | Andrew Bartlett <abartlet@samba.org> | 2017-11-01 09:02:01 +1300 |
---|---|---|
committer | Karolin Seeger <kseeger@samba.org> | 2017-11-29 09:24:26 +0100 |
commit | fe3ae81cd9a5cf263da9cb373d07ebad4541727b (patch) | |
tree | d8502c0f166473500ba01d62402181fcbb4baa32 /testprogs | |
parent | 09a311caa602265b18067d8cd155e91f33918b1a (diff) | |
download | samba-fe3ae81cd9a5cf263da9cb373d07ebad4541727b.tar.gz |
selftest: Add more corruption cases for runtime and dbcheck
These tests now confirm we can handle these issues at runtime
as well as at dbcheck
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
(cherry picked from commit 4815efc0e3f89079e7c9b868b7514ea7c49a807c)
Diffstat (limited to 'testprogs')
-rw-r--r-- | testprogs/blackbox/common-links.sh | 12 | ||||
-rwxr-xr-x | testprogs/blackbox/dbcheck-links.sh | 3 | ||||
-rwxr-xr-x | testprogs/blackbox/runtime-links.sh | 74 |
3 files changed, 86 insertions, 3 deletions
diff --git a/testprogs/blackbox/common-links.sh b/testprogs/blackbox/common-links.sh index e36cb0b8f66..ee7310b5108 100644 --- a/testprogs/blackbox/common-links.sh +++ b/testprogs/blackbox/common-links.sh @@ -96,8 +96,16 @@ add_deleted_target_backlink() { fi } -add_deleted_source_backlink() { - ldif=$release_dir/add-deleted-source-backlink.ldif +revive_links_on_deleted_group() { + ldif=$release_dir/revive-links-on-deleted-group.ldif + TZ=UTC $ldbmodify -H tdb://$PREFIX_ABS/${RELEASE}/private/sam.ldb.d/DC%3DRELEASE-4-5-0-PRE1,DC%3DSAMBA,DC%3DCORP.ldb $ldif + if [ "$?" != "0" ]; then + return 1 + fi +} + +revive_backlink_on_deleted_group() { + ldif=$release_dir/revive-backlink-on-deleted-group.ldif TZ=UTC $ldbmodify -H tdb://$PREFIX_ABS/${RELEASE}/private/sam.ldb.d/DC%3DRELEASE-4-5-0-PRE1,DC%3DSAMBA,DC%3DCORP.ldb $ldif if [ "$?" != "0" ]; then return 1 diff --git a/testprogs/blackbox/dbcheck-links.sh b/testprogs/blackbox/dbcheck-links.sh index 074b60164dd..0aeada037fc 100755 --- a/testprogs/blackbox/dbcheck-links.sh +++ b/testprogs/blackbox/dbcheck-links.sh @@ -185,7 +185,8 @@ if [ -d $release_dir ]; then testit "add_dangling_link" add_dangling_link testit "add_dangling_backlink" add_dangling_backlink testit "add_deleted_dangling_backlink" add_deleted_dangling_backlink - testit "add_deleted_source_backlink" add_deleted_source_backlink + testit "revive_links_on_deleted_group" revive_links_on_deleted_group + testit "revive_backlink_on_deleted_group" revive_backlink_on_deleted_group testit "add_deleted_target_link" add_deleted_target_link testit "add_deleted_target_backlink" add_deleted_target_backlink testit "dbcheck_dangling" dbcheck_dangling diff --git a/testprogs/blackbox/runtime-links.sh b/testprogs/blackbox/runtime-links.sh new file mode 100755 index 00000000000..344b822f07e --- /dev/null +++ b/testprogs/blackbox/runtime-links.sh @@ -0,0 +1,74 @@ +#!/bin/sh + +if [ $# -lt 1 ]; then +cat <<EOF +Usage: dbcheck-links.sh PREFIX RELEASE +EOF +exit 1; +fi + +PREFIX_ABS="$1" +RELEASE="$2" +shift 2 + +. `dirname $0`/subunit.sh + +. `dirname $0`/common-links.sh + +delete_member_of_deleted_group() { + TZ=UTC $ldbdel -H tdb://$PREFIX_ABS/${RELEASE}/private/sam.ldb 'CN=User1 UT. Tester,CN=Users,DC=release-4-5-0-pre1,DC=samba,DC=corp' + if [ "$?" != "0" ]; then + return 1 + fi +} + +delete_backlink_memberof_deleted_group() { + TZ=UTC $ldbdel -H tdb://$PREFIX_ABS/${RELEASE}/private/sam.ldb 'CN=User UT. Tester,CN=Users,DC=release-4-5-0-pre1,DC=samba,DC=corp' + if [ "$?" != "0" ]; then + return 1 + fi +} + +delete_dangling_backlink_memberof_group() { + TZ=UTC $ldbdel -H tdb://$PREFIX_ABS/${RELEASE}/private/sam.ldb 'CN=dangling-back,CN=Users,DC=release-4-5-0-pre1,DC=samba,DC=corp' + if [ "$?" != "0" ]; then + return 1 + fi +} + + +if [ -d $release_dir ]; then + testit $RELEASE undump + testit "add_dangling_link" add_dangling_link + testit "add_dangling_backlink" add_dangling_backlink + testit "add_deleted_dangling_backlink" add_deleted_dangling_backlink + testit "revive_links_on_deleted_group" revive_links_on_deleted_group + testit "revive_backlink_on_deleted_group" revive_backlink_on_deleted_group + testit "add_deleted_target_link" add_deleted_target_link + testit "add_deleted_target_backlink" add_deleted_target_backlink + testit "dangling_one_way_link" dangling_one_way_link + testit "dangling_one_way_dn" dangling_one_way_dn + testit "deleted_one_way_dn" deleted_one_way_dn + testit "add_dangling_multi_valued" add_dangling_multi_valued + +#Now things are set up, work with the DB + testit "delete_member_of_deleted_group" delete_member_of_deleted_group + testit "delete_backlink_memberof_deleted_group" delete_backlink_memberof_deleted_group + testit "delete_dangling_backlink_memberof_group" delete_dangling_backlink_memberof_group +else + subunit_start_test $RELEASE + subunit_skip_test $RELEASE <<EOF +no test provision +EOF + + subunit_start_test "tombstones_expunge" + subunit_skip_test "tombstones_expunge" <<EOF +no test provision +EOF +fi + +if [ -d $PREFIX_ABS/${RELEASE} ]; then + rm -fr $PREFIX_ABS/${RELEASE} +fi + +exit $failed |