Skip to content

Commit

Permalink
adding gh actions for promq tests if alerts directory is modified
Browse files Browse the repository at this point in the history
  • Loading branch information
R-Lawton committed Jul 9, 2024
1 parent 0695451 commit aef2ccc
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 2 deletions.
31 changes: 31 additions & 0 deletions .github/workflows/test-alerts.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Test

on:
push:
branches:
- main
paths:
- examples/alerts/**
pull_request:
branches:
- main
paths:
- 'examples/alerts/**'
jobs:
promql-tests:
name: Promql Tests
runs-on: ubuntu-latest
defaults:
run:
shell: bash
steps:
- name: Set up Go 1.21.x
uses: actions/setup-go@v4
with:
go-version: 1.21.x
id: go
- name: Check out code
uses: actions/checkout@v4
- name: Run Promql tests
run: |
make test-alerts
4 changes: 3 additions & 1 deletion examples/alerts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,7 @@ make sloth-generate
There are also two matching unit tests to verify and test the alerts that Sloth has generated. These can be run using the make target:

```
make alerts-tests
make test-alerts
```

Note: The prometheus unit tests will also run via Github actions when a change is made in the alerts file.
2 changes: 1 addition & 1 deletion make/alerts.mk
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ container-runtime-tool:
exit 1; \
fi))

alerts-tests: container-runtime-tool ## Test alerts using promtool
test-alerts: container-runtime-tool ## Test alerts using promtool
$(CONTAINER_RUNTIME_BIN) run --rm -t \
-v $(AVAILABILITY_SLO_RULES):/prometheus/slo-availability.yaml \
-v $(LATENCY_SLO_RULES):/prometheus/slo-latency.yaml \
Expand Down

0 comments on commit aef2ccc

Please sign in to comment.