Exemple #1
0
def test_no_timeout_locate_ns_not_existing():
    """
    Locating a NS that does not exist with no timeout should raise an error.
    """
    t0 = time.time()
    with pytest.raises(TimeoutError):
        locate_ns('127.0.0.1:22', timeout=0.)
    assert time.time() - t0 <= 1.
Exemple #2
0
def test_wrong_nameserver_address():
    """
    Locating a name server that does not exist should raise an error.
    """
    t0 = time.time()
    with pytest.raises(TimeoutError):
        locate_ns('127.0.0.1:22', timeout=1.)
    assert 1. <= time.time() - t0 <= 2.
Exemple #3
0
def test_wrong_nameserver_address(timeout):
    """
    Locating a name server that does not exist should raise an error after
    the defined timeout.
    """
    t0 = time.time()
    with pytest.raises(TimeoutError):
        locate_ns('127.0.0.1:1234', timeout=timeout)
    assert timeout <= time.time() - t0 <= timeout + 1.2
Exemple #4
0
def test_wrong_nameserver_address(timeout):
    """
    Locating a name server that does not exist should raise an error after
    the defined timeout.
    """
    t0 = time.time()
    with pytest.raises(TimeoutError):
        locate_ns('127.0.0.1:1234', timeout=timeout)
    assert timeout <= time.time() - t0 <= timeout + 1.2
Exemple #5
0
def test_no_timeout_locate_ns_existing(nsproxy):
    """
    Locating a NS that exists with no timeout should be OK.
    """
    locate_ns(nsproxy.addr(), timeout=0.0)
Exemple #6
0
def test_no_timeout_locate_ns_existing(nsproxy):
    """
    Locating a NS that exists with no timeout should be OK.
    """
    locate_ns(nsproxy.addr(), timeout=0.)