summaryrefslogtreecommitdiffstats
path: root/tests/health_mgmtapi
diff options
context:
space:
mode:
authorPavlos Emm. Katsoulakis <paul@netdata.rocks>2019-06-28 08:27:57 +0200
committerPavlos Emm. Katsoulakis <paul@netdata.rocks>2019-06-28 08:27:57 +0200
commit171d8f5d01f17dddbd531139b86e1a1c96f95b0d (patch)
tree7b2f049259656e4c14c3d7e23a639964ebb2e07b /tests/health_mgmtapi
parent5d5266dc1a863d877d91cab232b6369091a198ee (diff)
Revert "Easily disable alarms, by persisting the silencers configuration (#6274)"
This reverts commit 60a73e90de2aa1c2eaae2ebbc45dd1fb96034df2. Emergency rollback of potential culprit as per issue #6356 Will be re-merging the change after investigation
Diffstat (limited to 'tests/health_mgmtapi')
-rw-r--r--tests/health_mgmtapi/expected_list/ALARM_CPU_IOWAIT-list.json1
-rw-r--r--tests/health_mgmtapi/expected_list/ALARM_CPU_USAGE-list.json1
-rw-r--r--tests/health_mgmtapi/expected_list/CONTEXT_SYSTEM_CPU-list.json1
-rw-r--r--tests/health_mgmtapi/expected_list/DISABLE-list.json1
-rw-r--r--tests/health_mgmtapi/expected_list/DISABLE_ALL-list.json1
-rw-r--r--tests/health_mgmtapi/expected_list/DISABLE_ALL_ERROR-list.json1
-rw-r--r--tests/health_mgmtapi/expected_list/DISABLE_SYSTEM_LOAD-list.json1
-rw-r--r--tests/health_mgmtapi/expected_list/FAMILIES_LOAD-list.json1
-rw-r--r--tests/health_mgmtapi/expected_list/HOSTS-list.json1
-rw-r--r--tests/health_mgmtapi/expected_list/RESET-list.json1
-rw-r--r--tests/health_mgmtapi/expected_list/SILENCE-list.json1
-rw-r--r--tests/health_mgmtapi/expected_list/SILENCE_2-list.json1
-rw-r--r--tests/health_mgmtapi/expected_list/SILENCE_3-list.json1
-rw-r--r--tests/health_mgmtapi/expected_list/SILENCE_ALARM_CPU_USAGE-list.json1
-rw-r--r--tests/health_mgmtapi/expected_list/SILENCE_ALARM_CPU_USAGE_LOAD_TRIGGER-list.json1
-rw-r--r--tests/health_mgmtapi/expected_list/SILENCE_ALL-list.json1
-rwxr-xr-xtests/health_mgmtapi/health-cmdapi-test.sh.in40
17 files changed, 2 insertions, 54 deletions
diff --git a/tests/health_mgmtapi/expected_list/ALARM_CPU_IOWAIT-list.json b/tests/health_mgmtapi/expected_list/ALARM_CPU_IOWAIT-list.json
deleted file mode 100644
index 9f05efe70e..0000000000
--- a/tests/health_mgmtapi/expected_list/ALARM_CPU_IOWAIT-list.json
+++ /dev/null
@@ -1 +0,0 @@
-{ "all": false, "type": "SILENCE", "silencers": [ { "alarm": "*10min_cpu_iowait" }, { "alarm": "*10min_cpu_usage *load_trigger" } ] }
diff --git a/tests/health_mgmtapi/expected_list/ALARM_CPU_USAGE-list.json b/tests/health_mgmtapi/expected_list/ALARM_CPU_USAGE-list.json
deleted file mode 100644
index dbf8799252..0000000000
--- a/tests/health_mgmtapi/expected_list/ALARM_CPU_USAGE-list.json
+++ /dev/null
@@ -1 +0,0 @@
-{ "all": false, "type": "SILENCE", "silencers": [ { "alarm": "*10min_cpu_usage *load_trigger", "context": "system.cpu" }, { "alarm": "*10min_cpu_usage *load_trigger", "chart": "system.load" } ] }
diff --git a/tests/health_mgmtapi/expected_list/CONTEXT_SYSTEM_CPU-list.json b/tests/health_mgmtapi/expected_list/CONTEXT_SYSTEM_CPU-list.json
deleted file mode 100644
index a267cfd6fc..0000000000
--- a/tests/health_mgmtapi/expected_list/CONTEXT_SYSTEM_CPU-list.json
+++ /dev/null
@@ -1 +0,0 @@
-{ "all": false, "type": "DISABLE", "silencers": [ { "context": "system.cpu" }, { "chart": "system.load" } ] }
diff --git a/tests/health_mgmtapi/expected_list/DISABLE-list.json b/tests/health_mgmtapi/expected_list/DISABLE-list.json
deleted file mode 100644
index c2c7781043..0000000000
--- a/tests/health_mgmtapi/expected_list/DISABLE-list.json
+++ /dev/null
@@ -1 +0,0 @@
-{ "all": false, "type": "DISABLE", "silencers": [ { "alarm": "*10min_cpu_usage *load_trigger" } ] }
diff --git a/tests/health_mgmtapi/expected_list/DISABLE_ALL-list.json b/tests/health_mgmtapi/expected_list/DISABLE_ALL-list.json
deleted file mode 100644
index bbc3f4f0c9..0000000000
--- a/tests/health_mgmtapi/expected_list/DISABLE_ALL-list.json
+++ /dev/null
@@ -1 +0,0 @@
-{ "all": true, "type": "DISABLE", "silencers": [] }
diff --git a/tests/health_mgmtapi/expected_list/DISABLE_ALL_ERROR-list.json b/tests/health_mgmtapi/expected_list/DISABLE_ALL_ERROR-list.json
deleted file mode 100644
index e8aee17953..0000000000
--- a/tests/health_mgmtapi/expected_list/DISABLE_ALL_ERROR-list.json
+++ /dev/null
@@ -1 +0,0 @@
-Auth Error
diff --git a/tests/health_mgmtapi/expected_list/DISABLE_SYSTEM_LOAD-list.json b/tests/health_mgmtapi/expected_list/DISABLE_SYSTEM_LOAD-list.json
deleted file mode 100644
index a7fc1cb8ac..0000000000
--- a/tests/health_mgmtapi/expected_list/DISABLE_SYSTEM_LOAD-list.json
+++ /dev/null
@@ -1 +0,0 @@
-{ "all": false, "type": "DISABLE", "silencers": [ { "chart": "system.load" } ] }
diff --git a/tests/health_mgmtapi/expected_list/FAMILIES_LOAD-list.json b/tests/health_mgmtapi/expected_list/FAMILIES_LOAD-list.json
deleted file mode 100644
index 50119f79c3..0000000000
--- a/tests/health_mgmtapi/expected_list/FAMILIES_LOAD-list.json
+++ /dev/null
@@ -1 +0,0 @@
-{ "all": false, "type": "None", "silencers": [ { "families": "load" } ] }
diff --git a/tests/health_mgmtapi/expected_list/HOSTS-list.json b/tests/health_mgmtapi/expected_list/HOSTS-list.json
deleted file mode 100644
index 9db21b6c34..0000000000
--- a/tests/health_mgmtapi/expected_list/HOSTS-list.json
+++ /dev/null
@@ -1 +0,0 @@
-{ "all": false, "type": "SILENCE", "silencers": [ { "hosts": "*" } ] }
diff --git a/tests/health_mgmtapi/expected_list/RESET-list.json b/tests/health_mgmtapi/expected_list/RESET-list.json
deleted file mode 100644
index 2d3f09d682..0000000000
--- a/tests/health_mgmtapi/expected_list/RESET-list.json
+++ /dev/null
@@ -1 +0,0 @@
-{ "all": false, "type": "None", "silencers": [] }
diff --git a/tests/health_mgmtapi/expected_list/SILENCE-list.json b/tests/health_mgmtapi/expected_list/SILENCE-list.json
deleted file mode 100644
index d157f2d3af..0000000000
--- a/tests/health_mgmtapi/expected_list/SILENCE-list.json
+++ /dev/null
@@ -1 +0,0 @@
-{ "all": false, "type": "SILENCE", "silencers": [ { "alarm": "*10min_cpu_usage *load_trigger" } ] }
diff --git a/tests/health_mgmtapi/expected_list/SILENCE_2-list.json b/tests/health_mgmtapi/expected_list/SILENCE_2-list.json
deleted file mode 100644
index d5e6fa2d14..0000000000
--- a/tests/health_mgmtapi/expected_list/SILENCE_2-list.json
+++ /dev/null
@@ -1 +0,0 @@
-{ "all": false, "type": "SILENCE", "silencers": [ { "families": "load" } ] }
diff --git a/tests/health_mgmtapi/expected_list/SILENCE_3-list.json b/tests/health_mgmtapi/expected_list/SILENCE_3-list.json
deleted file mode 100644
index 69e98cc19b..0000000000
--- a/tests/health_mgmtapi/expected_list/SILENCE_3-list.json
+++ /dev/null
@@ -1 +0,0 @@
-{ "all": false, "type": "SILENCE", "silencers": [] } WARNING: SILENCE or DISABLE command is ineffective without defining any alarm selectors.
diff --git a/tests/health_mgmtapi/expected_list/SILENCE_ALARM_CPU_USAGE-list.json b/tests/health_mgmtapi/expected_list/SILENCE_ALARM_CPU_USAGE-list.json
deleted file mode 100644
index dd789cd336..0000000000
--- a/tests/health_mgmtapi/expected_list/SILENCE_ALARM_CPU_USAGE-list.json
+++ /dev/null
@@ -1 +0,0 @@
-{ "all": false, "type": "SILENCE", "silencers": [ { "alarm": "*10min_cpu_usage *load_trigger", "chart": "system.load" } ] }
diff --git a/tests/health_mgmtapi/expected_list/SILENCE_ALARM_CPU_USAGE_LOAD_TRIGGER-list.json b/tests/health_mgmtapi/expected_list/SILENCE_ALARM_CPU_USAGE_LOAD_TRIGGER-list.json
deleted file mode 100644
index d157f2d3af..0000000000
--- a/tests/health_mgmtapi/expected_list/SILENCE_ALARM_CPU_USAGE_LOAD_TRIGGER-list.json
+++ /dev/null
@@ -1 +0,0 @@
-{ "all": false, "type": "SILENCE", "silencers": [ { "alarm": "*10min_cpu_usage *load_trigger" } ] }
diff --git a/tests/health_mgmtapi/expected_list/SILENCE_ALL-list.json b/tests/health_mgmtapi/expected_list/SILENCE_ALL-list.json
deleted file mode 100644
index c88ef9fde9..0000000000
--- a/tests/health_mgmtapi/expected_list/SILENCE_ALL-list.json
+++ /dev/null
@@ -1 +0,0 @@
-{ "all": true, "type": "SILENCE", "silencers": [] }
diff --git a/tests/health_mgmtapi/health-cmdapi-test.sh.in b/tests/health_mgmtapi/health-cmdapi-test.sh.in
index 5abf2b1704..26279cac97 100755
--- a/tests/health_mgmtapi/health-cmdapi-test.sh.in
+++ b/tests/health_mgmtapi/health-cmdapi-test.sh.in
@@ -27,7 +27,7 @@ check () {
elif [ "${r}" != "${2}" ] ; then
echo -e " ${GRAY}WARNING: 'Got ${r}'. Expected '${2}'"
iter=$((iter+1))
- if [ $iter -lt 10 ] ; then
+ if [ $iter -lt 10 ] ; then
echo -e " ${GRAY}Repeating test "
check "$1" "$2"
else
@@ -53,20 +53,6 @@ cmd () {
fi
}
-check_list() {
- RESPONSE=$(curl -s "http://$URL/api/v1/manage/health?cmd=LIST" -H "X-Auth-Token: $TOKEN" 2>&1)
-
- NAME="$1-list.json"
- echo $RESPONSE > $NAME
- diff $NAME expected_list/$NAME 1>/dev/null 2>&1
- if [ $? -eq 0 ]; then
- echo -e "${GREEN}Success: The list command got the correct answer for $NAME!"
- else
- echo -e "${RED}ERROR: the files $NAME and expected_list/$NAME does not match."
- exit 1
- fi
-}
-
WHITE='\033[0;37m'
RED='\033[0;31m'
GREEN='\033[0;32m'
@@ -104,13 +90,11 @@ err=0
# Test default state
cmd "cmd=RESET" "$HEALTH_CMDAPI_MSG_RESET"
check "Default State" "False False False False False False"
- check_list "RESET"
# Test auth failure
TOKEN="Wrong token"
cmd "cmd=DISABLE ALL" "$HEALTH_CMDAPI_MSG_AUTHERROR"
check "Default State" "False False False False False False"
- check_list "DISABLE_ALL_ERROR"
# Set correct token
TOKEN="${CORRECT_TOKEN}"
@@ -118,107 +102,87 @@ err=0
# Test disable
cmd "cmd=DISABLE ALL" "$HEALTH_CMDAPI_MSG_DISABLEALL"
check "All disabled" "True False True False True False"
- check_list "DISABLE_ALL"
# Reset
cmd "cmd=RESET" "$HEALTH_CMDAPI_MSG_RESET"
check "Default State" "False False False False False False"
- check_list "RESET"
# Test silence
cmd "cmd=SILENCE ALL" "$HEALTH_CMDAPI_MSG_SILENCEALL"
check "All silenced" "False True False True False True"
- check_list "SILENCE_ALL"
# Reset
cmd "cmd=RESET" "$HEALTH_CMDAPI_MSG_RESET"
check "Default State" "False False False False False False"
- check_list "RESET"
# Add silencer by name
printf -v resp "$HEALTH_CMDAPI_MSG_SILENCE\n$HEALTH_CMDAPI_MSG_ADDED"
cmd "cmd=SILENCE&alarm=*10min_cpu_usage *load_trigger" "${resp}"
check "Silence notifications for alarm1 and load_trigger" "False True False False False True"
- check_list "SILENCE_ALARM_CPU_USAGE_LOAD_TRIGGER"
# Convert to disable health checks
cmd "cmd=DISABLE" "$HEALTH_CMDAPI_MSG_DISABLE"
check "Disable notifications for alarm1 and load_trigger" "True False False False True False"
- check_list "DISABLE"
# Convert back to silence notifications
cmd "cmd=SILENCE" "$HEALTH_CMDAPI_MSG_SILENCE"
check "Silence notifications for alarm1 and load_trigger" "False True False False False True"
- check_list "SILENCE"
# Add second silencer by name
cmd "alarm=*10min_cpu_iowait" "$HEALTH_CMDAPI_MSG_ADDED"
check "Silence notifications for alarm1,alarm2 and load_trigger" "False True False True False True"
- check_list "ALARM_CPU_IOWAIT"
# Reset
cmd "cmd=RESET" "$HEALTH_CMDAPI_MSG_RESET"
- check_list "RESET"
# Add silencer by chart
printf -v resp "$HEALTH_CMDAPI_MSG_DISABLE\n$HEALTH_CMDAPI_MSG_ADDED"
cmd "cmd=DISABLE&chart=system.load" "${resp}"
check "Default State" "False False False False True False"
- check_list "DISABLE_SYSTEM_LOAD"
# Add silencer by context
cmd "context=system.cpu" "$HEALTH_CMDAPI_MSG_ADDED"
check "Default State" "True False True False True False"
- check_list "CONTEXT_SYSTEM_CPU"
# Reset
cmd "cmd=RESET" "$HEALTH_CMDAPI_MSG_RESET"
- check_list "RESET"
# Add second condition to a selector (AND)
printf -v resp "$HEALTH_CMDAPI_MSG_SILENCE\n$HEALTH_CMDAPI_MSG_ADDED"
cmd "cmd=SILENCE&alarm=*10min_cpu_usage *load_trigger&chart=system.load" "${resp}"
check "Silence notifications load_trigger" "False False False False False True"
- check_list "SILENCE_ALARM_CPU_USAGE"
# Add second selector with two conditions
cmd "alarm=*10min_cpu_usage *load_trigger&context=system.cpu" "$HEALTH_CMDAPI_MSG_ADDED"
check "Silence notifications load_trigger" "False True False False False True"
- check_list "ALARM_CPU_USAGE"
# Reset
cmd "cmd=RESET" "$HEALTH_CMDAPI_MSG_RESET"
- check_list "RESET"
# Add silencer without a command to disable or silence alarms
printf -v resp "$HEALTH_CMDAPI_MSG_ADDED\n$HEALTH_CMDAPI_MSG_STYPEWARNING"
cmd "families=load" "${resp}"
check "Family selector with no command" "False False False False False False"
- check_list "FAMILIES_LOAD"
# Add silence command
cmd "cmd=SILENCE" "$HEALTH_CMDAPI_MSG_SILENCE"
check "Silence family load" "False False False False False True"
- check_list "SILENCE_2"
# Reset
cmd "cmd=RESET" "$HEALTH_CMDAPI_MSG_RESET"
- check_list "RESET"
# Add command without silencers
printf -v resp "$HEALTH_CMDAPI_MSG_SILENCE\n$HEALTH_CMDAPI_MSG_NOSELECTORWARNING"
cmd "cmd=SILENCE" "${resp}"
check "Command with no selector" "False False False False False False"
- check_list "SILENCE_3"
# Add hosts silencer
cmd "hosts=*" "$HEALTH_CMDAPI_MSG_ADDED"
check "Silence all hosts" "False True False True False True"
- check_list "HOSTS"
# Reset
cmd "cmd=RESET" "$HEALTH_CMDAPI_MSG_RESET"
- check_list "RESET"
+
if [ $err -gt 0 ] ; then
echo "$err error(s) found"