Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adding gh actions for promq tests if alerts directory is modified #741

Merged
merged 1 commit into from
Jul 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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: Alerts Promql tests

on:
push:
branches:
- main
paths:
- examples/alerts/**
pull_request:
branches:
- main
paths:
- 'examples/alerts/**'
jobs:
promql-tests:
name: Promql Unit 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
Loading