def test_decimal_values(self): args = argparse.Namespace(critical=15, warning=2, reverse=False ) alert_status = check_elasticsearch_metrics.get_alert_status(args, value=1.9) alert_status.should.be.equal(check_elasticsearch_metrics.NagiosReturnCodes.OK.value) args = argparse.Namespace(critical=15, warning=2.0, reverse=False ) alert_status = check_elasticsearch_metrics.get_alert_status(args, value=2) alert_status.should.be.equal(check_elasticsearch_metrics.NagiosReturnCodes.WARNING.value) args = argparse.Namespace(critical=15, warning=2, reverse=False ) alert_status = check_elasticsearch_metrics.get_alert_status(args, value=2.0) alert_status.should.be.equal(check_elasticsearch_metrics.NagiosReturnCodes.WARNING.value) args = argparse.Namespace(critical=15, warning=2, reverse=False ) alert_status = check_elasticsearch_metrics.get_alert_status(args, value=15.1) alert_status.should.be.equal(check_elasticsearch_metrics.NagiosReturnCodes.CRITICAL.value)
def test_value_lt_critical_reverse_true(self): args = argparse.Namespace(critical=2, warning=15, reverse=True ) alert_status = check_elasticsearch_metrics.get_alert_status(args, value=1) alert_status.should.be.equal(check_elasticsearch_metrics.NagiosReturnCodes.CRITICAL.value)
def test_value_gt_warning_and_lt_critical(self): args = argparse.Namespace(critical=15, warning=2, reverse=False ) alert_status = check_elasticsearch_metrics.get_alert_status(args, value=3) alert_status.should.be.equal(check_elasticsearch_metrics.NagiosReturnCodes.WARNING.value)