Remote exception names are cut to 128 identifier characters before a class is built for them
This commit is contained in:
@@ -21,7 +21,12 @@ from fluksio.flow.remote import (
|
||||
RemoteWorkerHub,
|
||||
WorkerInventory,
|
||||
)
|
||||
from fluksio.flow.workers import NodeTimeout, RemoteError
|
||||
from fluksio.flow.workers import (
|
||||
MAX_REMOTE_NAME,
|
||||
NodeTimeout,
|
||||
RemoteError,
|
||||
_remote_class,
|
||||
)
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
@@ -149,6 +154,13 @@ def test_a_failure_keeps_its_class_across_the_socket(loop):
|
||||
assert str(caught[0]) == "bad input"
|
||||
|
||||
|
||||
def test_a_class_name_off_the_wire_is_bounded_and_identifier_safe():
|
||||
cls = _remote_class("Bad Name\n" + "x" * 10_000)
|
||||
assert cls.__name__.isidentifier()
|
||||
assert len(cls.__name__) == MAX_REMOTE_NAME
|
||||
assert issubclass(cls, RemoteError)
|
||||
|
||||
|
||||
def test_a_worker_that_goes_away_fails_the_call_rather_than_hanging(loop):
|
||||
hub = RemoteWorkerHub()
|
||||
worker, socket = attach(hub, loop)
|
||||
|
||||
Reference in New Issue
Block a user