[CalendarServer-changes] [6032] CalendarServer/branches/users/glyph/sql-store
source_changes at macosforge.org
source_changes at macosforge.org
Tue Aug 10 09:42:42 PDT 2010
Revision: 6032
http://trac.macosforge.org/projects/calendarserver/changeset/6032
Author: sagen at apple.com
Date: 2010-08-10 09:42:40 -0700 (Tue, 10 Aug 2010)
Log Message:
-----------
When running unit tests, put the postgres socket directory into /tmp to avoid the path-longer-than-UNIX_PATH_MAX issue.
Modified Paths:
--------------
CalendarServer/branches/users/glyph/sql-store/test
CalendarServer/branches/users/glyph/sql-store/txcaldav/calendarstore/test/test_postgres.py
CalendarServer/branches/users/glyph/sql-store/txdav/datastore/subpostgres.py
CalendarServer/branches/users/glyph/sql-store/txdav/datastore/test/test_subpostgres.py
Modified: CalendarServer/branches/users/glyph/sql-store/test
===================================================================
--- CalendarServer/branches/users/glyph/sql-store/test 2010-08-10 15:53:52 UTC (rev 6031)
+++ CalendarServer/branches/users/glyph/sql-store/test 2010-08-10 16:42:40 UTC (rev 6032)
@@ -81,4 +81,4 @@
test_modules="calendarserver twistedcaldav twext txdav txcaldav txcarddav ${m_twisted}";
fi;
-cd "${wd}" && "${python}" "${trial}" --temp-directory ~/Scratch --rterrors ${random} ${until_fail} ${no_colour} ${coverage} ${test_modules};
+cd "${wd}" && "${python}" "${trial}" --rterrors ${random} ${until_fail} ${no_colour} ${coverage} ${test_modules};
Modified: CalendarServer/branches/users/glyph/sql-store/txcaldav/calendarstore/test/test_postgres.py
===================================================================
--- CalendarServer/branches/users/glyph/sql-store/txcaldav/calendarstore/test/test_postgres.py 2010-08-10 15:53:52 UTC (rev 6031)
+++ CalendarServer/branches/users/glyph/sql-store/txcaldav/calendarstore/test/test_postgres.py 2010-08-10 16:42:40 UTC (rev 6032)
@@ -19,6 +19,7 @@
L{txcaldav.calendarstore.test.common}.
"""
+from hashlib import md5
from txcaldav.calendarstore.test.common import CommonTests as CalendarCommonTests
from txcarddav.addressbookstore.test.common import CommonTests as AddressBookCommonTests
@@ -94,9 +95,11 @@
self.cleanDatabase(testCase)
ready.callback(self.store)
return self.store
+ socketDirectory = CachingFilePath("/tmp/cs_test_%s" %
+ (md5(dbRoot.path).hexdigest()))
self.sharedService = PostgresService(
- dbRoot,
- getReady, v1_schema, "caldav"
+ dbRoot, getReady, v1_schema, "caldav",
+ socketDirectory=socketDirectory
)
self.sharedService.startService()
def startStopping():
Modified: CalendarServer/branches/users/glyph/sql-store/txdav/datastore/subpostgres.py
===================================================================
--- CalendarServer/branches/users/glyph/sql-store/txdav/datastore/subpostgres.py 2010-08-10 15:53:52 UTC (rev 6031)
+++ CalendarServer/branches/users/glyph/sql-store/txdav/datastore/subpostgres.py 2010-08-10 16:42:40 UTC (rev 6032)
@@ -154,7 +154,7 @@
class PostgresService(MultiService):
def __init__(self, dataStoreDirectory, subServiceFactory,
- schema, databaseName='subpostgres'):
+ schema, databaseName='subpostgres', socketDirectory=None):
"""
Initialize a L{PostgresService} pointed at a data store directory.
@@ -168,7 +168,10 @@
MultiService.__init__(self)
self.subServiceFactory = subServiceFactory
self.dataStoreDirectory = dataStoreDirectory
- self.socketDir = self.dataStoreDirectory.child("socket")
+ if socketDirectory:
+ self.socketDir = socketDirectory
+ else:
+ self.socketDir = self.dataStoreDirectory.child("socket")
self.databaseName = databaseName
self.schema = schema
self.monitor = None
@@ -292,11 +295,12 @@
env.update(PGDATA=clusterDir.path,
PGHOST=self.socketDir.path)
initdb = which("initdb")[0]
+ if not self.socketDir.isdir():
+ self.socketDir.createDirectory()
if clusterDir.isdir():
self.startDatabase()
else:
self.dataStoreDirectory.createDirectory()
- self.socketDir.createDirectory()
workingDir.createDirectory()
dbInited = getProcessOutput(
initdb, [], env, workingDir.path, errortoo=True
Modified: CalendarServer/branches/users/glyph/sql-store/txdav/datastore/test/test_subpostgres.py
===================================================================
--- CalendarServer/branches/users/glyph/sql-store/txdav/datastore/test/test_subpostgres.py 2010-08-10 15:53:52 UTC (rev 6031)
+++ CalendarServer/branches/users/glyph/sql-store/txdav/datastore/test/test_subpostgres.py 2010-08-10 16:42:40 UTC (rev 6032)
@@ -18,6 +18,8 @@
Tests for txdav.datastore.subpostgres.
"""
+from hashlib import md5
+
from twisted.trial.unittest import TestCase
from twext.python.filepath import CachingFilePath
@@ -67,11 +69,15 @@
cursor.close()
+ dbPath = "../_postgres_test_db"
svc = PostgresService(
- CachingFilePath("../_postgres_test_db"),
+ CachingFilePath(dbPath),
SimpleService,
"create table TEST_DUMMY_TABLE (stub varchar)",
- "dummy_db"
+ "dummy_db",
+ socketDirectory=CachingFilePath("/tmp/cs_test_%s" %
+ (md5(dbPath).hexdigest(),)
+ )
)
svc.startService()
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20100810/06e752d4/attachment-0001.html>
More information about the calendarserver-changes
mailing list