Exemplo n.º 1
0
def test_agent_proxy_wait_running_0_seconds(nsproxy):
    """
    Using `wait_for_running` on a proxy after initialization should block until
    the agent is running or time out.
    """
    run_agent('agent')

    proxy = Proxy('agent').wait_for_running(timeout=0)
    assert proxy.ping() == 'pong'
Exemplo n.º 2
0
def test_agent_proxy_wait_running_0_seconds(nsproxy):
    """
    Using `wait_for_running` on a proxy after initialization should block until
    the agent is running or time out.
    """
    run_agent('agent')

    proxy = Proxy('agent').wait_for_running(timeout=0)
    assert proxy.ping() == 'pong'
Exemplo n.º 3
0
def test_agent_proxy_wait_running(nsproxy, timeout):
    """
    Using `wait_for_running` on a proxy after initialization should block until
    the agent is running or time out.
    """
    AgentProcess('agent').start()

    # Get "offline" proxy
    agent = Proxy('agent')
    time0 = time.time()
    Timer(abs(timeout) / 2, agent.run).start()

    proxy = Proxy('agent').wait_for_running(timeout=timeout)
    elapsed = time.time() - time0
    assert proxy.ping() == 'pong'
    assert elapsed >= abs(timeout) / 2
    assert elapsed <= abs(timeout)
Exemplo n.º 4
0
def test_agent_proxy_wait_running(nsproxy, timeout):
    """
    Using `wait_for_running` on a proxy after initialization should block until
    the agent is running or time out.
    """
    AgentProcess('agent').start()

    # Get "offline" proxy
    agent = Proxy('agent')
    time0 = time.time()
    Timer(abs(timeout) / 2, agent.run).start()

    proxy = Proxy('agent').wait_for_running(timeout=timeout)
    elapsed = time.time() - time0
    assert proxy.ping() == 'pong'
    assert elapsed >= abs(timeout) / 2
    assert elapsed <= abs(timeout)