Merge branch 'restart'

This commit is contained in:
Brian Warner 2017-06-26 18:52:57 +01:00
commit bded01d3cc
2 changed files with 21 additions and 1 deletions

View File

@ -98,9 +98,13 @@ def start(cfg, signal_error, no_daemon, blur_usage, advertise_version,
"--signal-error", is_flag=True,
help="force all clients to fail with a message",
)
@click.option(
"--disallow-list", is_flag=True,
help="never send list of allocated nameplates",
)
@click.pass_obj
def restart(cfg, signal_error, no_daemon, blur_usage, advertise_version,
transit, rendezvous):
transit, rendezvous, disallow_list):
"""
Re-start a relay server
"""
@ -111,6 +115,7 @@ def restart(cfg, signal_error, no_daemon, blur_usage, advertise_version,
cfg.transit = str(transit)
cfg.rendezvous = str(rendezvous)
cfg.signal_error = signal_error
cfg.allow_list = not disallow_list
restart_server(cfg)

View File

@ -1195,3 +1195,18 @@ class Server(unittest.TestCase):
plugin = MyPlugin(cfg)
relay = plugin.makeService(None)
self.assertEqual(False, relay._allow_list)
@mock.patch("wormhole.server.cmd_server.start_server")
def test_start_no_args(self, fake_start_server):
result = self.runner.invoke(server, ['start'])
self.assertEqual(0, result.exit_code)
cfg = fake_start_server.mock_calls[0][1][0]
MyPlugin(cfg).makeService(None)
@mock.patch("wormhole.server.cmd_server.restart_server")
def test_restart_no_args(self, fake_start_reserver):
result = self.runner.invoke(server, ['restart'])
self.assertEqual(0, result.exit_code)
cfg = fake_start_reserver.mock_calls[0][1][0]
MyPlugin(cfg).makeService(None)