[test] generate slapd.conf to be cwd independant
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Fri, 11 Feb 2011 13:38:40 +0100
changeset 6983 0459635ce666
parent 6982 fe74a45204e3
child 6984 528e44ef570c
[test] generate slapd.conf to be cwd independant
MANIFEST.in
server/test/data/slapd.conf
server/test/data/slapd.conf.in
server/test/unittest_ldapuser.py
--- a/MANIFEST.in	Fri Feb 11 13:23:22 2011 +0100
+++ b/MANIFEST.in	Fri Feb 11 13:38:40 2011 +0100
@@ -21,7 +21,7 @@
 recursive-include entities/test/data bootstrap_cubes *.py
 recursive-include sobjects/test/data bootstrap_cubes *.py
 recursive-include hooks/test/data bootstrap_cubes *.py
-recursive-include server/test/data bootstrap_cubes *.py source* *.conf *.ldif
+recursive-include server/test/data bootstrap_cubes *.py source* *.conf.in *.ldif
 recursive-include devtools/test/data bootstrap_cubes *.py *.txt *.js
 recursive-include web/test/data bootstrap_cubes pouet.css *.py
 
--- a/server/test/data/slapd.conf	Fri Feb 11 13:23:22 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,53 +0,0 @@
-# This is the main slapd configuration file. See slapd.conf(5) for more
-# info on the configuration options.
-
-#######################################################################
-# Global Directives:
-
-# Features to permit
-#allow bind_v2
-
-# Schema and objectClass definitions
-include         /etc/ldap/schema/core.schema
-include         /etc/ldap/schema/cosine.schema
-include         /etc/ldap/schema/nis.schema
-include         /etc/ldap/schema/inetorgperson.schema
-include         /etc/ldap/schema/openldap.schema
-include         /etc/ldap/schema/misc.schema
-
-# Where the pid file is put. The init.d script
-# will not stop the server if you change this.
-pidfile         ./data/test-slapd.pid
-
-# List of arguments that were passed to the server
-argsfile        ./data/slapd.args
-
-# Read slapd.conf(5) for possible values
-loglevel        sync
-# none
-
-# Where the dynamically loaded modules are stored
-modulepath	/usr/lib/ldap
-moduleload	back_hdb
-moduleload	back_bdb
-moduleload      back_monitor
-
-# The maximum number of entries that is returned for a search operation
-sizelimit 500
-
-# The tool-threads parameter sets the actual amount of cpu's that is used
-# for indexing.
-tool-threads 1
-
-database        bdb
-
-# The base of your directory in database #1
-suffix          "dc=cubicweb,dc=test"
-
-# rootdn directive for specifying a superuser on the database. This is needed
-# for syncrepl.
-#rootdn          "cn=admin,dc=cubicweb,dc=test"
-#rootpw          "cubicwebrocks"
-# Where the database file are physically stored for database #1
-directory       "./data/ldapdb"
-
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/server/test/data/slapd.conf.in	Fri Feb 11 13:38:40 2011 +0100
@@ -0,0 +1,53 @@
+# This is the main slapd configuration file. See slapd.conf(5) for more
+# info on the configuration options.
+
+#######################################################################
+# Global Directives:
+
+# Features to permit
+#allow bind_v2
+
+# Schema and objectClass definitions
+include         /etc/ldap/schema/core.schema
+include         /etc/ldap/schema/cosine.schema
+include         /etc/ldap/schema/nis.schema
+include         /etc/ldap/schema/inetorgperson.schema
+include         /etc/ldap/schema/openldap.schema
+include         /etc/ldap/schema/misc.schema
+
+# Where the pid file is put. The init.d script
+# will not stop the server if you change this.
+pidfile         %(apphome)s/test-slapd.pid
+
+# List of arguments that were passed to the server
+argsfile        %(apphome)s/slapd.args
+
+# Read slapd.conf(5) for possible values
+loglevel        sync
+# none
+
+# Where the dynamically loaded modules are stored
+modulepath	/usr/lib/ldap
+moduleload	back_hdb
+moduleload	back_bdb
+moduleload      back_monitor
+
+# The maximum number of entries that is returned for a search operation
+sizelimit 500
+
+# The tool-threads parameter sets the actual amount of cpu's that is used
+# for indexing.
+tool-threads 1
+
+database        bdb
+
+# The base of your directory in database #1
+suffix          "dc=cubicweb,dc=test"
+
+# rootdn directive for specifying a superuser on the database. This is needed
+# for syncrepl.
+#rootdn          "cn=admin,dc=cubicweb,dc=test"
+#rootpw          "cubicwebrocks"
+# Where the database file are physically stored for database #1
+directory       "%(apphome)s/ldapdb"
+
--- a/server/test/unittest_ldapuser.py	Fri Feb 11 13:23:22 2011 +0100
+++ b/server/test/unittest_ldapuser.py	Fri Feb 11 13:38:40 2011 +0100
@@ -87,6 +87,10 @@
     global slapd_process, CONFIG
     basedir = join(config.apphome, "ldapdb")
     slapdconf = join(config.apphome, "slapd.conf")
+    confin = file(join(config.apphome, "slapd.conf.in")).read()
+    confstream = file(slapdconf, 'w')
+    confstream.write(confin % {'apphome': config.apphome})
+    confstream.close()
     if not exists(basedir):
         os.makedirs(basedir)
         # fill ldap server with some data