mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2025-02-12 05:55:35 +00:00
Merge pull request #1302 from tahoe-lafs/4028-more-integration
Fix another integration test failure Fixes ticket:4028
This commit is contained in:
commit
41131ca755
@ -401,9 +401,6 @@ def alice(
|
|||||||
reactor, request, temp_dir, introducer_furl, flog_gatherer, "alice",
|
reactor, request, temp_dir, introducer_furl, flog_gatherer, "alice",
|
||||||
web_port="tcp:9980:interface=localhost",
|
web_port="tcp:9980:interface=localhost",
|
||||||
storage=False,
|
storage=False,
|
||||||
# We're going to kill this ourselves, so no need for finalizer to
|
|
||||||
# do it:
|
|
||||||
finalize=False,
|
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
pytest_twisted.blockon(await_client_ready(process))
|
pytest_twisted.blockon(await_client_ready(process))
|
||||||
|
0
newsfragments/4028.minor
Normal file
0
newsfragments/4028.minor
Normal file
@ -332,6 +332,7 @@ class StorageClient(object):
|
|||||||
_base_url: DecodedURL
|
_base_url: DecodedURL
|
||||||
_swissnum: bytes
|
_swissnum: bytes
|
||||||
_treq: Union[treq, StubTreq, HTTPClient]
|
_treq: Union[treq, StubTreq, HTTPClient]
|
||||||
|
_pool: Optional[HTTPConnectionPool]
|
||||||
_clock: IReactorTime
|
_clock: IReactorTime
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
@ -361,7 +362,7 @@ class StorageClient(object):
|
|||||||
)
|
)
|
||||||
|
|
||||||
https_url = DecodedURL().replace(scheme="https", host=nurl.host, port=nurl.port)
|
https_url = DecodedURL().replace(scheme="https", host=nurl.host, port=nurl.port)
|
||||||
return cls(https_url, swissnum, treq_client, reactor)
|
return cls(https_url, swissnum, treq_client, pool, reactor)
|
||||||
|
|
||||||
def relative_url(self, path: str) -> DecodedURL:
|
def relative_url(self, path: str) -> DecodedURL:
|
||||||
"""Get a URL relative to the base URL."""
|
"""Get a URL relative to the base URL."""
|
||||||
@ -501,6 +502,11 @@ class StorageClient(object):
|
|||||||
).read()
|
).read()
|
||||||
raise ClientException(response.code, response.phrase, data)
|
raise ClientException(response.code, response.phrase, data)
|
||||||
|
|
||||||
|
def shutdown(self) -> Deferred:
|
||||||
|
"""Shutdown any connections."""
|
||||||
|
if self._pool is not None:
|
||||||
|
return self._pool.closeCachedConnections()
|
||||||
|
|
||||||
|
|
||||||
@define(hash=True)
|
@define(hash=True)
|
||||||
class StorageClientGeneral(object):
|
class StorageClientGeneral(object):
|
||||||
|
@ -1271,6 +1271,11 @@ class HTTPNativeStorageServer(service.MultiService):
|
|||||||
if self._lc.running:
|
if self._lc.running:
|
||||||
self._lc.stop()
|
self._lc.stop()
|
||||||
self._failed_to_connect("shut down")
|
self._failed_to_connect("shut down")
|
||||||
|
|
||||||
|
if self._istorage_server is not None:
|
||||||
|
client_shutting_down = self._istorage_server._http_client.shutdown()
|
||||||
|
result.addCallback(lambda _: client_shutting_down)
|
||||||
|
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
|
||||||
|
@ -331,6 +331,7 @@ class CustomHTTPServerTests(SyncTestCase):
|
|||||||
DecodedURL.from_text("http://127.0.0.1"),
|
DecodedURL.from_text("http://127.0.0.1"),
|
||||||
SWISSNUM_FOR_TEST,
|
SWISSNUM_FOR_TEST,
|
||||||
treq=treq,
|
treq=treq,
|
||||||
|
pool=None,
|
||||||
# We're using a Treq private API to get the reactor, alas, but only
|
# We're using a Treq private API to get the reactor, alas, but only
|
||||||
# in a test, so not going to worry about it too much. This would be
|
# in a test, so not going to worry about it too much. This would be
|
||||||
# fixed if https://github.com/twisted/treq/issues/226 were ever
|
# fixed if https://github.com/twisted/treq/issues/226 were ever
|
||||||
@ -512,6 +513,7 @@ class HttpTestFixture(Fixture):
|
|||||||
DecodedURL.from_text("http://127.0.0.1"),
|
DecodedURL.from_text("http://127.0.0.1"),
|
||||||
SWISSNUM_FOR_TEST,
|
SWISSNUM_FOR_TEST,
|
||||||
treq=self.treq,
|
treq=self.treq,
|
||||||
|
pool=None,
|
||||||
clock=self.clock,
|
clock=self.clock,
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -624,6 +626,7 @@ class GenericHTTPAPITests(SyncTestCase):
|
|||||||
DecodedURL.from_text("http://127.0.0.1"),
|
DecodedURL.from_text("http://127.0.0.1"),
|
||||||
b"something wrong",
|
b"something wrong",
|
||||||
treq=StubTreq(self.http.http_server.get_resource()),
|
treq=StubTreq(self.http.http_server.get_resource()),
|
||||||
|
pool=None,
|
||||||
clock=self.http.clock,
|
clock=self.http.clock,
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@ -1455,7 +1458,7 @@ class SharedImmutableMutableTestsMixin:
|
|||||||
self.client.advise_corrupt_share(storage_index, 13, reason)
|
self.client.advise_corrupt_share(storage_index, 13, reason)
|
||||||
)
|
)
|
||||||
|
|
||||||
for (si, share_number) in [(storage_index, 11), (urandom(16), 13)]:
|
for si, share_number in [(storage_index, 11), (urandom(16), 13)]:
|
||||||
with assert_fails_with_http_code(self, http.NOT_FOUND):
|
with assert_fails_with_http_code(self, http.NOT_FOUND):
|
||||||
self.http.result_of_with_flush(
|
self.http.result_of_with_flush(
|
||||||
self.client.advise_corrupt_share(si, share_number, reason)
|
self.client.advise_corrupt_share(si, share_number, reason)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user