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
def ping(args: 'Namespace'): """ Check the connectivity of a Pea :param args: arguments coming from the CLI. """ from jina.checker import NetworkChecker NetworkChecker(args)
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
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
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
def ping(args: 'Namespace'): from jina.checker import NetworkChecker NetworkChecker(args)
def ping(args): from jina.checker import NetworkChecker NetworkChecker(args)