Skip to content

Commit

Permalink
Move golden tests to correct place
Browse files Browse the repository at this point in the history
  • Loading branch information
bastjan committed Oct 2, 2023
1 parent 3192bf3 commit 2d16560
Show file tree
Hide file tree
Showing 35 changed files with 364 additions and 445 deletions.
2 changes: 1 addition & 1 deletion .cruft.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"name": "OpenShift4 Monitoring",
"slug": "openshift4-monitoring",
"parameter_key": "openshift4_monitoring",
"test_cases": "capacity-alerts release-4.11 remote-write user-workload-monitoring capacity-alerts-with-node-labels vsphere team-label custom-rules release-4.12 release-4.13 team-routing",
"test_cases": "capacity-alerts release-4.11 remote-write user-workload-monitoring capacity-alerts-with-node-labels vsphere custom-rules release-4.12 release-4.13 team-routing",
"add_lib": "y",
"add_pp": "n",
"add_golden": "y",
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ jobs:
- user-workload-monitoring
- capacity-alerts-with-node-labels
- vsphere
- team-label
- custom-rules
- release-4.12
- release-4.13
Expand All @@ -63,7 +62,6 @@ jobs:
- user-workload-monitoring
- capacity-alerts-with-node-labels
- vsphere
- team-label
- custom-rules
- release-4.12
- release-4.13
Expand Down
2 changes: 1 addition & 1 deletion Makefile.vars.mk
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,4 @@ KUBENT_IMAGE ?= ghcr.io/doitintl/kube-no-trouble:latest
KUBENT_DOCKER ?= $(DOCKER_CMD) $(DOCKER_ARGS) $(root_volume) --entrypoint=/app/kubent $(KUBENT_IMAGE)

instance ?= capacity-alerts
test_instances = tests/capacity-alerts.yml tests/release-4.11.yml tests/remote-write.yml tests/user-workload-monitoring.yml tests/capacity-alerts-with-node-labels.yml tests/vsphere.yml tests/team-label.yml tests/custom-rules.yml tests/release-4.12.yml tests/release-4.13.yml tests/team-routing.yml
test_instances = tests/capacity-alerts.yml tests/release-4.11.yml tests/remote-write.yml tests/user-workload-monitoring.yml tests/capacity-alerts-with-node-labels.yml tests/vsphere.yml tests/custom-rules.yml tests/release-4.12.yml tests/release-4.13.yml tests/team-routing.yml
2 changes: 1 addition & 1 deletion class/defaults.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
parameters:
openshift4_monitoring:
team_fallback: null
fallback_team: null

=_metadata:
library_aliases:
Expand Down
3 changes: 2 additions & 1 deletion component/alert-routing-discovery.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -122,10 +122,11 @@ local teamBasedRouting = std.map(
} ];

local alertmanagerConfig =
local routes = std.get(params.openshift4_monitoring.alertManagerConfig.route, 'routes', []);
params.openshift4_monitoring.alertManagerConfig {
receivers+: [ { name: nullReceiver } ],
route+: {
routes: adParams.prepend_routes + teamBasedRouting + adParams.append_routes + super.routes + if ownerOrFallbackTeam != null then [ {
routes: adParams.prepend_routes + teamBasedRouting + adParams.append_routes + routes + if ownerOrFallbackTeam != null then [ {
receiver: adParams.team_receiver_format % ownerOrFallbackTeam,
} ] else [ { receiver: nullReceiver } ],
},
Expand Down
68 changes: 0 additions & 68 deletions tests/capacity-alerts.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,3 @@
applications:
- non-existing
- no-ns
- ns-string
- ns-object
- base as ns-in-base
- base as ns-overridden
- non-existing as still-non-existing
- shared-responsibility
- same-ns-1
- same-ns-2

parameters:
kapitan:
dependencies:
Expand All @@ -25,59 +13,3 @@ parameters:
openshift4_monitoring:
capacityAlerts:
enabled: true
alertManagerConfig:
route:
routes:
- receiver: other
matchers:
- other = "true"
alertManagerAutoDiscovery:
debug_config_map: true
team_receiver_format: team_default_%s
additional_alert_matchers:
- 'syn_team = ""'
prepend_routes:
- matchers:
- alertname = Watchdog
repeat_interval: 60s
receiver: heartbeat

syn:
owner: clumsy-donkeys
teams:
chubby-cockroaches:
instances:
- ns-in-base
- ns-overridden
- shared-responsibility
lovable-lizards:
instances:
- ns-object
- shared-responsibility
- same-ns-2

no_ns: {}

ns_string:
namespace: "ns-string"

ns_object:
namespace:
name: "ns-object"

base:
namespace: base

ns_in_base: {}

ns_overridden:
namespace: overridden

shared_responsibility:
namespace: shared-responsibility

same_ns_1:
namespace: same-ns

same_ns_2:
namespace: same-ns
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,16 @@ stringData:
"severity": "warning"
"target_match_re":
"severity": "info"
"receivers":
- "name": "__component_openshift4_monitoring_null"
"route":
"group_interval": "5s"
"group_wait": "0s"
"repeat_interval": "10m"
"routes":
- "continue": false
"matchers":
- "namespace =~ \"\""
"receiver": "__component_openshift4_monitoring_null"
- "receiver": "__component_openshift4_monitoring_null"
type: Opaque
Original file line number Diff line number Diff line change
Expand Up @@ -31,32 +31,9 @@ stringData:
"group_wait": "0s"
"repeat_interval": "10m"
"routes":
- "matchers":
- "alertname = Watchdog"
"receiver": "heartbeat"
"repeat_interval": "60s"
- "continue": true
"matchers":
- "syn_team = \"\""
- "namespace =~ \"base|overridden|shared-responsibility\""
"receiver": "team_default_chubby-cockroaches"
- "continue": true
"matchers":
- "syn_team = \"\""
- "namespace =~ \"ns-string|same-ns\""
"receiver": "team_default_clumsy-donkeys"
- "continue": true
"matchers":
- "syn_team = \"\""
- "namespace =~ \"ns-object|shared-responsibility|same-ns\""
"receiver": "team_default_lovable-lizards"
- "continue": false
"matchers":
- "syn_team = \"\""
- "namespace =~ \"base|overridden|shared-responsibility|ns-string|same-ns|ns-object|shared-responsibility|same-ns\""
- "namespace =~ \"\""
"receiver": "__component_openshift4_monitoring_null"
- "matchers":
- "other = \"true\""
"receiver": "other"
- "receiver": "team_default_clumsy-donkeys"
- "receiver": "__component_openshift4_monitoring_null"
type: Opaque
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ spec:
severity: warning
syn: 'true'
syn_component: openshift4-monitoring
syn_team: clumsy-donkeys
- name: syn-MemoryCapacity
rules:
- alert: SYN_ClusterLowOnMemory
Expand All @@ -48,7 +47,6 @@ spec:
severity: warning
syn: 'true'
syn_component: openshift4-monitoring
syn_team: clumsy-donkeys
- name: syn-PodCapacity
rules:
- alert: SYN_TooManyPods
Expand All @@ -68,7 +66,6 @@ spec:
severity: warning
syn: 'true'
syn_component: openshift4-monitoring
syn_team: clumsy-donkeys
- name: syn-ResourceRequests
rules:
- alert: SYN_TooMuchCPURequested
Expand All @@ -88,7 +85,6 @@ spec:
severity: warning
syn: 'true'
syn_component: openshift4-monitoring
syn_team: clumsy-donkeys
- alert: SYN_TooMuchMemoryRequested
annotations:
description: The cluster is close to assigning all memory to running pods.
Expand All @@ -106,7 +102,6 @@ spec:
severity: warning
syn: 'true'
syn_component: openshift4-monitoring
syn_team: clumsy-donkeys
- name: syn-UnusedCapacity
rules:
- alert: SYN_ClusterHasUnusedNodes
Expand Down Expand Up @@ -144,4 +139,3 @@ spec:
severity: warning
syn: 'true'
syn_component: openshift4-monitoring
syn_team: clumsy-donkeys
Loading

0 comments on commit 2d16560

Please sign in to comment.