示例#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 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
示例#3
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