Skip to content

Commit

Permalink
Test nameserver shutdown with a ConnectionClosedError
Browse files Browse the repository at this point in the history
  • Loading branch information
ocaballeror committed Apr 5, 2018
1 parent d18e221 commit dc8fda1
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions osbrain/tests/test_proxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,14 @@
import pytest
from threading import Timer

from Pyro4.errors import ConnectionClosedError

import osbrain
from osbrain import run_agent
from osbrain import run_nameserver
from osbrain import Agent
from osbrain import AgentProcess
from osbrain import NameServer
from osbrain import Proxy
from osbrain.proxy import locate_ns
from osbrain.helper import wait_agent_attr
Expand Down Expand Up @@ -325,3 +329,17 @@ def shoot(self):
assert not wayne._next_oneway

assert wait_agent_attr(wayne, value=20 * ['bang!'], timeout=1.5)


def test_nameserver_proxy_shutdown_connectionclosed():
"""
Check that nameserver proxies can handle a ConnectionClosedError at
shutdown.
"""
class CustomNS(NameServer):
def daemon_shutdown(self):
super().daemon_shutdown()
raise ConnectionClosedError

ns = run_nameserver(base=CustomNS)
ns.shutdown()

0 comments on commit dc8fda1

Please sign in to comment.