Commit eac01b5c authored by Barry Warsaw's avatar Barry Warsaw

Add MappingStorage tests for Connection and Timeout tests

(ReconnectionTests make no sense for MappingStorage).

Also add BDBTimeoutTests.

Set the level for the FileStorageConnectionTests,
FileStorageTimeoutTests, BDBConnectionTests, BDBReconnectionTests, and
BDBTimeoutTests to level 2 so they aren't normally run.

MappingStorageConnectionTests and MappingStorageTimeoutTests both get
level 1 so they are normally always run.  FileStorageReconnectionTests
also gets level 1 since there s no MappingStorageReconnectionTests.
parent fdd0ea34
...@@ -35,7 +35,6 @@ class FileStorageConfig: ...@@ -35,7 +35,6 @@ class FileStorageConfig:
create and 'yes' or 'no', create and 'yes' or 'no',
read_only and 'yes' or 'no') read_only and 'yes' or 'no')
class BerkeleyStorageConfig: class BerkeleyStorageConfig:
def getConfig(self, path, create, read_only): def getConfig(self, path, create, read_only):
return """\ return """\
...@@ -45,48 +44,91 @@ class BerkeleyStorageConfig: ...@@ -45,48 +44,91 @@ class BerkeleyStorageConfig:
read_only %s read_only %s
</Storage>""" % (path, read_only) </Storage>""" % (path, read_only)
class MappingStorageConfig:
def getConfig(self, path, create, read_only):
return """\
<Storage>
type MappingStorage
name %s
</Storage>""" % path
class FileStorageConnectionTests( class FileStorageConnectionTests(
FileStorageConfig, FileStorageConfig,
ConnectionTests.ConnectionTests ConnectionTests.ConnectionTests
): ):
"""FileStorage-specific connection tests.""" """FileStorage-specific connection tests."""
level = 2
class FileStorageReconnectionTests( class FileStorageReconnectionTests(
FileStorageConfig, FileStorageConfig,
ConnectionTests.ReconnectionTests ConnectionTests.ReconnectionTests
): ):
"""FileStorage-specific re-connection tests.""" """FileStorage-specific re-connection tests."""
# Run this at level 1 because MappingStorage can't do reconnection tests
level = 1
class FileStorageTimeoutTests( class FileStorageTimeoutTests(
FileStorageConfig, FileStorageConfig,
ConnectionTests.TimeoutTests ConnectionTests.TimeoutTests
): ):
# doesn't test anything that is storage-specific level = 2
pass
class BDBConnectionTests( class BDBConnectionTests(
BerkeleyStorageConfig, BerkeleyStorageConfig,
ConnectionTests.ConnectionTests ConnectionTests.ConnectionTests
): ):
"""Berkeley storage connection tests.""" """Berkeley storage connection tests."""
level = 2
class BDBReconnectionTests( class BDBReconnectionTests(
BerkeleyStorageConfig, BerkeleyStorageConfig,
ConnectionTests.ReconnectionTests ConnectionTests.ReconnectionTests
): ):
"""Berkeley storage re-connection tests.""" """Berkeley storage re-connection tests."""
level = 2
class BDBTimeoutTests(
BerkeleyStorageConfig,
ConnectionTests.TimeoutTests
):
level = 2
test_classes = [FileStorageConnectionTests, FileStorageReconnectionTests,
class MappingStorageConnectionTests(
MappingStorageConfig,
ConnectionTests.ConnectionTests
):
"""Mapping storage connection tests."""
level = 1
# The ReconnectionTests can't work with MappingStorage because it's only an
# in-memory storage and has no persistent state.
class MappingStorageTimeoutTests(
MappingStorageConfig,
ConnectionTests.TimeoutTests
):
level = 1
test_classes = [FileStorageConnectionTests,
FileStorageReconnectionTests,
FileStorageTimeoutTests] FileStorageTimeoutTests]
test_classes.extend(
[MappingStorageConnectionTests,
MappingStorageTimeoutTests])
import BDBStorage import BDBStorage
if BDBStorage.is_available: if BDBStorage.is_available:
test_classes.append(BDBConnectionTests) test_classes.append(BDBConnectionTests)
test_classes.append(BDBReconnectionTests) test_classes.append(BDBReconnectionTests)
test_classes.append(BDBTimeoutTests)
def test_suite(): def test_suite():
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment