# Unit Testing Prometheus Alerts

**URL:** <https://discuss.prometheus.io/t/unit-testing-prometheus-alerts/1329>\
**Category:** PromQL\
**Created:** [December 3, 2022, 5:29pm UTC](https://discuss.prometheus.io/t/unit-testing-prometheus-alerts/1329 "2022-12-03T17:29:38Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![idioma](https://avatars.discourse-cdn.com/v4/letter/i/dbc845/32.png) [@idioma](https://discuss.prometheus.io/u/idioma)\
**Post date:** [December 3, 2022, 5:29pm UTC](https://discuss.prometheus.io/t/unit-testing-prometheus-alerts/1329/1 "2022-12-03T17:29:39Z")

</div>

I have been writing unit tests for my Prometheus alerts and I have just increased the interval range in my alert, therefore I need to modify my current test. This is my modified test:

```auto
      - interval: 15m
        # Series data.
        input_series:
          - series: 'some_bucket{service_name="some-service", le="1000"}'
            values: 6 6 6 6 6 6 6
          - series: 'some_bucket{service_name="some-service", le="10000"}'
            values: 10 11 12 13 14 14 14
          - series: 'some_bucket{service_name="some-service", le="+Inf"}'
            values: 10 100 200 300 400 500 600
        alert_rule_test:
          - eval_time: 5m
            alertname: someName
            exp_alerts: []
          - eval_time: 15m
            alertname: someName
            exp_alerts:
              - exp_labels:
                  severity: error
                  service_name: some-service
                exp_annotations:
                  summary: "a summary"
                  description: "adescription"

```

and my alert rule is:

` histogram_quantile(0.95, sum by(le) (rate(some_bucket{service_name="some-service"}[15m]))) >= 1000`

The test is working fine, it does not trigger at the `eval_time` of 5 minutes and it does when it hits the correct interval. My question is regarding the interval set at the top

```auto
    - interval: 15m

```

My understanding is that this should be the scraping interval, but if I change it to 1 the test fails. Why is that? Does it mean that my time series/input data needs changing? Can you help me navigate the expected values for the input series?

Thank you
