Esempio n. 1
0
def test_passenger_status_2():
    passenger_status = PassengerStatus(context_wrap(PASS_STATUS_SP))
    assert passenger_status["Version"] == '4.0.18'
    assert len(passenger_status['foreman_default']['p_list']) == 6
    foreman_default_p_list = passenger_status['foreman_default']['p_list']
    assert foreman_default_p_list[0] == {
        'PID': '39176',
        'Sessions': '0',
        'Processed': '194',
        'Uptime': '24h 9m 0s',
        'CPU': '0%',
        'Memory': '488M',
        'Last used': '20m 24s a'
    }
    assert foreman_default_p_list[1] == {
        'PID': '39342',
        'Sessions': '0',
        'Processed': '0',
        'Uptime': '24h 8m 58s',
        'CPU': '0%',
        'Memory': '178M',
        'Last used': '24h 8m 5'
    }
    assert foreman_default_p_list[-1] == {
        'PID': '39614',
        'Sessions': '0',
        'Processed': '0',
        'Uptime': '24h 8m 56s',
        'CPU': '0%',
        'Memory': '174M',
        'Last used': '24h 8m 5'
    }
    assert 'rack_default' in passenger_status
def test_passenger_status_doc_examples():
    env = {
        'passenger_status': PassengerStatus(context_wrap(PASS_STATUS)),
    }
    failed, total = doctest.testmod(passenger_status, globs=env)
    assert failed == 0
def test_passenger_status_ex():
    with pytest.raises(ParseException) as pe:
        PassengerStatus(context_wrap(PASS_STATUS_EXP1))
        assert "Cannot find the header line." in str(pe)
def test_passenger_status():
    passenger_status = PassengerStatus(context_wrap(PASS_STATUS))
    assert passenger_status.data["Version"] == '4.0.18'
    assert len(passenger_status.data['foreman_default']['p_list']) == 3
    assert ('rack_default' in passenger_status.data) is True
Esempio n. 5
0
def test_passenger_status_ex():
    with pytest.raises(SkipException):
        PassengerStatus(context_wrap(PASS_STATUS_EXP1))