Arthur de Jong

Open Source / Free Software developer

summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArthur de Jong <arthur@arthurdejong.org>2009-06-06 22:17:33 +0200
committerArthur de Jong <arthur@arthurdejong.org>2009-06-06 22:17:33 +0200
commita8a6bdd079fc0e090c6062fc09b34b6638da7869 (patch)
tree8defb012ed223911f7482c8e4fc383477ab980a5
parent6042557ab6ae0e397ccd6ea6b39c5a3e9a74a665 (diff)
update and document test suite
git-svn-id: http://arthurdejong.org/svn/nss-pam-ldapd/nss-ldapd@932 ef36b2f9-881f-0410-afb5-c4e39611909c
-rw-r--r--HACKING6
-rw-r--r--tests/README81
-rw-r--r--tests/test.ldif.gzbin0 -> 188713 bytes
-rwxr-xr-xtests/test_nsscmds.sh10
4 files changed, 96 insertions, 1 deletions
diff --git a/HACKING b/HACKING
index 55072b5..52498c7 100644
--- a/HACKING
+++ b/HACKING
@@ -155,3 +155,9 @@ only potentially exploit bugs in the library and gain the privileges of the
process that was doing the name lookups. In this case the privileges of the
daemon are potentially exposed.
+
+TEST SETUP
+==========
+
+In the test directory there are a number of tests available. See the file
+README in the test directory for more details.
diff --git a/tests/README b/tests/README
new file mode 100644
index 0000000..1baa642
--- /dev/null
+++ b/tests/README
@@ -0,0 +1,81 @@
+
+This document tries to descrive the test in this directory. Most of these
+tests should be self-explanitory as they should be simple unit tests of
+the shipped modules (more unit tests are welcome).
+
+Since nss-ldapd is meant for providing data from an LDAP server for some tests
+you should have an LDAP server and for even other tests you need to have
+nss-ldapd installed (patches for using LD_PRELOAD or similar tricks instead are
+welcome).
+
+For this a test setup should be made (the tests are ignored if no such setup
+was detected). In my development environment I use a chroot jail with Debian.
+The instructions in this document assume a similar environment.
+
+
+TEST ENVIRONMENT
+================
+
+LDAP server configuration
+-------------------------
+
+An LDAP server listening on ldap://localhost and ldapi:// is assumed. This
+is acomplished on Debian by the following line in /etc/default/slapd:
+ SLAPD_SERVICES="ldap:/// ldaps:/// ldapi:///"
+
+Because there will be a lot of data in the database and to test paged results
+you need the following in /etc/ldap/slapd.conf:
+ sizelimit size.prtotal=unlimited
+
+The LDAP server should be set up to service up the dc=test,dc=tld DN as base.
+
+A sample test.ldif file is also available. Note that this file is currently
+not shipped in the released tarballs because it is quite large. Load the file
+into your LDAP server so that it can be served.
+
+Most of the names in the database have been randomly generated based on a
+combination of name-lists that were found on the Internet.
+
+
+nsswitch.conf
+-------------
+
+The /etc/nsswitch.conf file is expected to contain something like the following.
+All maps should be looked up through LDAP and some tests may expect the LDAP
+lookup to come after the files lookup.
+
+passwd: files ldap
+group: files ldap
+shadow: files ldap
+hosts: files ldap dns mdns
+networks: files ldap
+protocols: db files ldap
+services: db files ldap
+ethers: db files ldap
+rpc: db files ldap
+netgroup: files ldap
+aliases: files ldap
+
+nss-ldapd.conf
+--------------
+
+The /etc/nss-ldapd.conf file is expected to be configured like the following.
+
+uid nslcd
+gid nslcd
+uri ldapi:///
+base dc=test,dc=tld
+pagesize 100
+timelimit 2
+bind_timelimit 4
+reconnect_sleeptime 4
+reconnect_maxsleeptime 10
+filter group (|(objectClass=posixGroup)(objectClass=groupOfUniqueNames))
+
+
+OLD TESTS
+=========
+
+There are also a lot of old test files in this directory. Those files are
+of the form test_<map>.c. These files call the NSS module functions directly.
+These can probably all be removed and integrated into test_nsscmds.sh instead.
diff --git a/tests/test.ldif.gz b/tests/test.ldif.gz
new file mode 100644
index 0000000..a050d5c
--- /dev/null
+++ b/tests/test.ldif.gz
Binary files differ
diff --git a/tests/test_nsscmds.sh b/tests/test_nsscmds.sh
index 63797e0..ed14afd 100755
--- a/tests/test_nsscmds.sh
+++ b/tests/test_nsscmds.sh
@@ -339,8 +339,16 @@ barsrv 15350/udp
foosrv 15349/tcp
EOM
+check "getent services sssin" << EOM
+sssin 5000/tcp SSSIN
+EOM
+
+check "getent services SSSIN" << EOM
+sssin 5000/tcp SSSIN
+EOM
+
check "getent services | wc -l" << EOM
-`grep -c '^[^#].' /etc/services | awk '{print $1 + 3}'`
+`grep -c '^[^#].' /etc/services | awk '{print $1 + 4}'`
EOM
###########################################################################