Exemplo n.º 1
0
def test_server_establishes_reverse_connection(ipc_base_path, runner):
    server_config = ConnectionConfig.from_name("server",
                                               base_path=ipc_base_path)
    server_done, client_done = d.checkpoint("done")

    server = d.driver(
        d.serve_endpoint(server_config),
        d.wait_until_connected_to("client"),
        server_done,
    )

    client = d.driver(d.run_endpoint("client"),
                      d.connect_to_endpoints(server_config), client_done)

    runner(server, client)
Exemplo n.º 2
0
def test_broadcast_without_listeners_explicitly_allowed(ipc_base_path, runner):
    server_config = ConnectionConfig.from_name("server", base_path=ipc_base_path)
    server_done, client_done = d.checkpoint("done")

    server = d.driver(d.serve_endpoint(server_config), server_done)

    client = d.driver(
        d.run_endpoint("client"),
        d.connect_to_endpoints(server_config),
        d.wait_until_connected_to("server"),
        d.broadcast(Event(), BroadcastConfig(require_subscriber=False)),
        client_done,
    )

    runner(server, client)
Exemplo n.º 3
0
def test_broadcast_without_listeners_throws(ipc_base_path, runner):
    server_config = ConnectionConfig.from_name("server", base_path=ipc_base_path)
    server_done, client_done = d.checkpoint("done")

    server = d.driver(d.serve_endpoint(server_config), server_done)

    client = d.driver(
        d.run_endpoint("client"),
        d.connect_to_endpoints(server_config),
        d.wait_until_connected_to("server"),
        d.throws(d.broadcast(Event()), NoSubscribers),
        client_done,
    )

    runner(server, client)
Exemplo n.º 4
0
def test_duplicate_connection_throws_exception(ipc_base_path, runner):
    server_config = ConnectionConfig.from_name("server",
                                               base_path=ipc_base_path)
    server_done, client_done = d.checkpoint("done")

    server = d.driver(d.serve_endpoint(server_config), server_done)

    client = d.driver(
        d.run_endpoint("client"),
        d.connect_to_endpoints(server_config),
        d.wait_until_connected_to("server"),
        d.throws(d.connect_to_endpoints(server_config),
                 ConnectionAttemptRejected),
        client_done,
    )

    runner(server, client)