fix test, un-log error

This commit is contained in:
meejah 2022-12-02 01:27:13 -07:00
parent 5bc91bbf86
commit 347d11a83c

View File

@ -77,6 +77,7 @@ from .common import (
UseNode, UseNode,
SameProcessStreamEndpointAssigner, SameProcessStreamEndpointAssigner,
MemoryIntroducerClient, MemoryIntroducerClient,
flush_logged_errors,
) )
from .common_web import ( from .common_web import (
do_http, do_http,
@ -92,6 +93,8 @@ from allmydata.storage_client import (
IFoolscapStorageServer, IFoolscapStorageServer,
NativeStorageServer, NativeStorageServer,
StorageFarmBroker, StorageFarmBroker,
StorageClientConfig,
MissingPlugin,
_FoolscapStorage, _FoolscapStorage,
_NullStorage, _NullStorage,
) )
@ -159,7 +162,7 @@ class GetConnectionStatus(unittest.TestCase):
self.assertTrue(IConnectionStatus.providedBy(connection_status)) self.assertTrue(IConnectionStatus.providedBy(connection_status))
class UnrecognizedAnnouncement(SyncTestCase): class UnrecognizedAnnouncement(unittest.TestCase):
""" """
Tests for handling of announcements that aren't recognized and don't use Tests for handling of announcements that aren't recognized and don't use
*anonymous-storage-FURL*. *anonymous-storage-FURL*.
@ -183,7 +186,7 @@ class UnrecognizedAnnouncement(SyncTestCase):
def _tub_maker(self, overrides): def _tub_maker(self, overrides):
return Service() return Service()
def native_storage_server(self): def native_storage_server(self, config=None):
""" """
Make a ``NativeStorageServer`` out of an unrecognizable announcement. Make a ``NativeStorageServer`` out of an unrecognizable announcement.
""" """
@ -192,7 +195,8 @@ class UnrecognizedAnnouncement(SyncTestCase):
self.ann, self.ann,
self._tub_maker, self._tub_maker,
{}, {},
EMPTY_CLIENT_CONFIG, node_config=EMPTY_CLIENT_CONFIG,
config=config or StorageClientConfig(),
) )
def test_no_exceptions(self): def test_no_exceptions(self):
@ -243,11 +247,18 @@ class UnrecognizedAnnouncement(SyncTestCase):
""" """
``NativeStorageServer.get_longname`` describes the missing plugin. ``NativeStorageServer.get_longname`` describes the missing plugin.
""" """
server = self.native_storage_server() server = self.native_storage_server(
self.assertThat( StorageClientConfig(
server.get_longname(), storage_plugins={
Equals('<missing plugin "{}">'.format(self.plugin_name)), "nothing": {}
}
)
) )
self.assertEqual(
server.get_longname(),
'<missing plugin "nothing">',
)
self.flushLoggedErrors(MissingPlugin)
class PluginMatchedAnnouncement(SyncTestCase): class PluginMatchedAnnouncement(SyncTestCase):