Ejemplo n.º 1
0
def test_uptime_check_zero():
    with on_time("2018-04-15 16:50", "CET"):
        assert list(uptime_utils.check({}, uptime_utils.Section(0, None))) == [
            Result(state=State.OK, summary="Up since Apr 15 2018 18:50:00"),
            Result(state=State.OK, summary="Uptime: 0 seconds"),
            Metric("uptime", 0.0),
        ]
Ejemplo n.º 2
0
def test_uptime_check_zero():
    with on_time('2018-04-15 16:50', 'CET'):
        assert list(
            uptime_utils.check(Parameters({}), uptime_utils.Section(
                0, None))) == [
                    Result(state=State.OK,
                           summary='Up since Apr 15 2018 18:50:00'),
                    Result(state=State.OK, summary='Uptime: 0 seconds'),
                    Metric("uptime", 0.0),
                ]
Ejemplo n.º 3
0
def test_uptime_check_basic():

    with on_time("2018-04-15 16:50", "CET"):
        assert list(uptime_utils.check({}, uptime_utils.Section(
            123, None))) == [
                Result(state=State.OK,
                       summary="Up since Apr 15 2018 18:47:57"),
                Result(state=State.OK, summary="Uptime: 2 minutes 3 seconds"),
                Metric("uptime", 123.0),
            ]
Ejemplo n.º 4
0
def test_uptime_check_basic():

    with on_time('2018-04-15 16:50', 'CET'):
        assert list(
            uptime_utils.check(Parameters({}), uptime_utils.Section(
                123, None))) == [
                    Result(state=State.OK,
                           summary='Up since Apr 15 2018 18:47:57'),
                    Result(state=State.OK,
                           summary='Uptime: 2 minutes 3 seconds'),
                    Metric("uptime", 123.0),
                ]
Ejemplo n.º 5
0
def test_uptime_solaris_inputs(info, reference):

    section = uptime.parse_uptime(info)
    assert section is not None

    # This time freeze has no correlation with the uptime of the test. It
    # is needed for the check output to always return the same infotext.
    # The true test happens on state and perfdata
    with on_time('2018-04-15 16:50', 'CET'):
        result = list(uptime_utils.check(Parameters({}), section))

    assert result == reference