basic positive path test

This commit is contained in:
Jean-Paul Calderone 2019-06-28 08:52:17 -04:00
parent 09acde41b9
commit f3218e6f62
2 changed files with 25 additions and 1 deletions

View File

@ -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

View File

@ -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):