summaryrefslogtreecommitdiff
path: root/source4/lib/ldb/tests
diff options
context:
space:
mode:
authorSimo Sorce <idra@samba.org>2006-12-11 15:49:39 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:29:07 -0500
commit2cd08c14a014a9326c6f42b83b4f2187bd2165b2 (patch)
treee02ae724cca76b6b32f3424ec1521383f398b4a7 /source4/lib/ldb/tests
parentd4ac51982cda20736878ffcba4118ca53b8fa09e (diff)
downloadsamba-2cd08c14a014a9326c6f42b83b4f2187bd2165b2.tar.gz
samba-2cd08c14a014a9326c6f42b83b4f2187bd2165b2.tar.bz2
samba-2cd08c14a014a9326c6f42b83b4f2187bd2165b2.zip
r20106: Optional ONE Level indexing for ldb_tdb
To activate it you must modify the @INDEXLIST object adding the attribute @IDXONE: 1 Ldb test included Simo. (This used to be commit ea111795f4016916473ccc05d23c6655e6af1207)
Diffstat (limited to 'source4/lib/ldb/tests')
-rw-r--r--source4/lib/ldb/tests/test-tdb-features.sh51
1 files changed, 51 insertions, 0 deletions
diff --git a/source4/lib/ldb/tests/test-tdb-features.sh b/source4/lib/ldb/tests/test-tdb-features.sh
index 6f1afdcf33..09a46d833e 100644
--- a/source4/lib/ldb/tests/test-tdb-features.sh
+++ b/source4/lib/ldb/tests/test-tdb-features.sh
@@ -117,3 +117,54 @@ checkcount 1 '(test=foo)'
checkcount 0 '(test=FOO)'
checkcount 1 '(test=f*o*)'
+checkone() {
+ count=$1
+ base="$2"
+ expression="$3"
+ n=`bin/ldbsearch -s one -b "$base" "$expression" | grep '^dn' | wc -l`
+ if [ $n != $count ]; then
+ echo "Got $n but expected $count for $expression"
+ $VALGRIND bin/ldbsearch -s one -b "$base" "$expression"
+ exit 1
+ fi
+ echo "OK: $count $expression"
+}
+
+echo "Removing wildcard attribute"
+cat <<EOF | $VALGRIND bin/ldbmodify || exit 1
+dn: @ATTRIBUTES
+changetype: modify
+delete: *
+*: INTEGER
+EOF
+
+echo "Adding one level indexes"
+cat <<EOF | $VALGRIND bin/ldbmodify || exit 1
+dn: @INDEXLIST
+changetype: modify
+add: @IDXONE
+@IDXONE: 1
+EOF
+
+echo "Testing one level indexed search"
+cat <<EOF | $VALGRIND bin/ldbadd || exit 1
+dn: cn=one,cn=t1,cn=TEST
+objectClass: oneclass
+cn: one
+test: one
+EOF
+checkone 1 "cn=t1,cn=TEST" '(test=one)'
+cat <<EOF | $VALGRIND bin/ldbadd || exit 1
+dn: cn=two,cn=t1,cn=TEST
+objectClass: oneclass
+cn: two
+test: one
+
+dn: cn=three,cn=t1,cn=TEST
+objectClass: oneclass
+cn: three
+test: one
+EOF
+checkone 3 "cn=t1,cn=TEST" '(test=one)'
+checkone 1 "cn=t1,cn=TEST" '(cn=two)'
+