Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ spec:
summary: Index {{`{{ $labels.index }}`}} is using {{`{{ $value }}`}} percent of max field limit
runbook_url: {{ .Values.runbookUrls.opensearch.OpenSearchFieldLimit }}
- alert: OpenSearchFieldLimit
expr: (sum(max_over_time(elasticsearch_indices_mappings_stats_fields{namespace="opensearch-system",index!~"top_queries.*"}[5m])) by (index) / sum(max_over_time(elasticsearch_indices_settings_total_fields{namespace="opensearch-system",index!~"top_queries.*}[5m])) by (index)) * 100 > 95
expr: (sum(max_over_time(elasticsearch_indices_mappings_stats_fields{namespace="opensearch-system",index!~"top_queries.*"}[5m])) by (index) / sum(max_over_time(elasticsearch_indices_settings_total_fields{namespace="opensearch-system",index!~"top_queries.*"}[5m])) by (index)) * 100 > 95
for: 15m
labels:
severity: critical
Expand Down
5 changes: 5 additions & 0 deletions tests/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,11 @@ RUN curl -LOs "https://github.com/open-policy-agent/opa/releases/download/v${OPA
install -Tm 755 opa_linux_amd64 /usr/local/bin/opa && \
rm opa_linux_amd64

ARG PROMETHEUS_VERSION="3.6.0"
RUN curl -fsSL "https://github.com/prometheus/prometheus/releases/download/v${PROMETHEUS_VERSION}/prometheus-${PROMETHEUS_VERSION}.linux-amd64.tar.gz" | \
tar -zxvf - "prometheus-${PROMETHEUS_VERSION}.linux-amd64/promtool" --strip-components=1 && \
mv promtool /usr/local/bin/

ARG SOPS_VERSION="3.10.1"
RUN curl -LOs "https://github.com/getsops/sops/releases/download/v${SOPS_VERSION}/sops-v${SOPS_VERSION}.linux.amd64" && \
install -Tm 755 "sops-v${SOPS_VERSION}.linux.amd64" /usr/local/bin/sops && \
Expand Down
1 change: 1 addition & 0 deletions tests/end-to-end/velero/resources/backup-spec-sc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,6 @@ labelSelector:
velero: backup
metadata: {}
snapshotMoveData: true
snapshotVolumes: true
storageLocation: default
ttl: 720h0m0s
1 change: 1 addition & 0 deletions tests/end-to-end/velero/resources/backup-spec-wc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,6 @@ labelSelector:
operator: DoesNotExist
metadata: {}
snapshotMoveData: true
snapshotVolumes: true
storageLocation: default
ttl: 720h0m0s
1 change: 1 addition & 0 deletions tests/end-to-end/velero/resources/test-application.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ metadata:
name: velero-test
namespace: velero-test
spec:
terminationGracePeriodSeconds: 1
containers:
- image: ${image}
args:
Expand Down
50 changes: 50 additions & 0 deletions tests/unit/general/alerting-rules.bats
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
#!/usr/bin/env bats

# bats file_tags=releases,general,prometheus

setup_file() {
# for dynamically registering tests using `bats_test_function`
bats_require_minimum_version 1.11.1

load "../../bats.lib.bash"
load_common "env.bash"
load_common "gpg.bash"
load_common "yq.bash"

gpg.setup
env.setup

env.init openstack capi dev
}

setup() {
load "../../bats.lib.bash"
load_assert
load_common "yq.bash"
load_common "env.bash"
env.private
}

teardown_file() {
env.teardown
gpg.teardown
}

declare -a clusters=("service" "workload")

for cluster in "${clusters[@]}"; do
bats_test_function \
--description "check ${cluster} cluster alerting rules" \
-- check_alerting_rules "${cluster}"
done

check_alerting_rules() {
local -r cluster="${1}_cluster"

run --separate-stderr bats_pipe \
helmfile -f "${ROOT}/helmfile.d" -e "${cluster}" -l app=prometheus -l chart=charts/prometheus-alerts template --log-level error \
\| yq eval-all '[select(.kind == "PrometheusRule") | .spec.groups[]] | {"groups": .}' \
\| promtool check rules --no-lint-fatal /dev/stdin

assert_success
}