Пример #1
0
def test_ping():
    a1 = set_pea_parser().parse_args([])
    a2 = set_ping_parser().parse_args(['0.0.0.0', str(a1.port_ctrl), '--print-response'])
    a3 = set_ping_parser().parse_args(['0.0.0.1', str(a1.port_ctrl), '--timeout', '1000'])

    with pytest.raises(SystemExit) as cm:
        with BasePea(a1):
            NetworkChecker(a2)

    assert cm.value.code == 0

    # test with bad addresss
    with pytest.raises(SystemExit) as cm:
        with BasePea(a1):
            NetworkChecker(a3)

    assert cm.value.code == 1
Пример #2
0
def ping(args: 'Namespace'):
    """
    Check the connectivity of a Pea

    :param args: arguments coming from the CLI.
    """
    from jina.checker import NetworkChecker

    NetworkChecker(args)
Пример #3
0
def test_container_ping(docker_image_built):
    a4 = set_pea_parser().parse_args(['--uses', img_name])
    a5 = set_ping_parser().parse_args(['0.0.0.0', str(a4.port_ctrl), '--print-response'])

    # test with container
    with pytest.raises(SystemExit) as cm:
        with BasePea(a4):
            NetworkChecker(a5)

    assert cm.value.code == 0
Пример #4
0
def test_ping():
    a1 = set_pod_parser().parse_args([])
    a2 = set_ping_parser().parse_args(['0.0.0.0', str(a1.port)])

    a3 = set_ping_parser().parse_args(
        ['0.0.0.1', str(a1.port), '--timeout', '1000'])

    with pytest.raises(SystemExit) as cm:
        with PodFactory.build_pod(a1):
            NetworkChecker(a2)

    assert cm.value.code == 0

    # test with bad address
    with pytest.raises(SystemExit) as cm:
        with PodFactory.build_pod(a1):
            NetworkChecker(a3)

    assert cm.value.code == 1
Пример #5
0
    def test_container_ping(self):
        a4 = set_pea_parser().parse_args(['--uses', img_name])
        a5 = set_ping_parser().parse_args(
            ['0.0.0.0', str(a4.port_ctrl), '--print-response'])

        # test with container
        with self.assertRaises(SystemExit) as cm:
            with BasePea(a4):
                NetworkChecker(a5)

        assert cm.exception.code == 0
Пример #6
0
Файл: api.py Проект: yuanl/jina
def ping(args: 'Namespace'):
    from jina.checker import NetworkChecker
    NetworkChecker(args)
Пример #7
0
def ping(args):
    from jina.checker import NetworkChecker
    NetworkChecker(args)