diff --git a/src/allmydata/test/storage_plugin.py b/src/allmydata/test/storage_plugin.py index 3091de2f7..ae390f177 100644 --- a/src/allmydata/test/storage_plugin.py +++ b/src/allmydata/test/storage_plugin.py @@ -19,6 +19,7 @@ from foolscap.api import ( from allmydata.interfaces import ( IFoolscapStoragePlugin, + IStorageServer, ) from allmydata.client import ( AnnounceableStorageServer, @@ -56,7 +57,7 @@ class DummyStorage(object): def get_storage_client(self, configuration, announcement): - pass + return DummyStorageClient() @@ -68,3 +69,9 @@ class DummyStorageServer(object): def remote_just_some_method(self): pass + + +@implementer(IStorageServer) +@attr.s +class DummyStorageClient(object): + pass diff --git a/src/allmydata/test/test_storage_client.py b/src/allmydata/test/test_storage_client.py index e205a7f35..f10d203ef 100644 --- a/src/allmydata/test/test_storage_client.py +++ b/src/allmydata/test/test_storage_client.py @@ -24,6 +24,9 @@ from .common import ( UseTestPlugins, MemoryIntroducerClient, ) +from .storage_plugin import ( + DummyStorageClient, +) from allmydata.util import base32, yamlutil from allmydata.client import ( config_from_string, @@ -227,6 +230,20 @@ storage.plugins = tahoe-lafs-dummy-v1 storage = self.get_storage(server_id, self.node) self.assertIsInstance(storage, _NullStorage) + def test_enabled_plugin(self): + """ + An announcement that could be matched by a plugin that is enabled is + matched and the plugin's storage client is used. + """ + server_id = b"v0-abcdef" + ann = { + u"service-name": u"storage", + u"name": u"tahoe-lafs-dummy-v1", + } + self.publish(server_id, ann) + storage = self.get_storage(server_id, self.node) + self.assertIsInstance(storage, DummyStorageClient) + class TestStorageFarmBroker(unittest.TestCase):