diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2023-02-06 16:11:34 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2023-02-06 16:11:34 +0000 |
commit | d079b656b4719739b2247dcd9d46e9bec793095a (patch) | |
tree | d2c950c70a776bcf697c963151c5bd959f8a9f03 /tests | |
parent | Releasing debian version 1.37.1-2. (diff) | |
download | netdata-d079b656b4719739b2247dcd9d46e9bec793095a.tar.xz netdata-d079b656b4719739b2247dcd9d46e9bec793095a.zip |
Merging upstream version 1.38.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | tests/alarm_repetition/netdata.conf_with_repetition | 1 | ||||
-rw-r--r-- | tests/alarm_repetition/netdata.conf_without_repetition | 1 | ||||
-rw-r--r-- | tests/health_mgmtapi/README.md | 2 | ||||
-rwxr-xr-x | tests/installer/checksums.sh | 53 | ||||
-rwxr-xr-x | tests/installer/slack.sh | 65 | ||||
-rwxr-xr-x | tests/lifecycle.bats | 60 | ||||
-rwxr-xr-x | tests/run-unit-tests.sh | 2 | ||||
-rwxr-xr-x | tests/updater_checks.bats | 65 | ||||
-rwxr-xr-x | tests/updater_checks.sh | 71 |
9 files changed, 2 insertions, 318 deletions
diff --git a/tests/alarm_repetition/netdata.conf_with_repetition b/tests/alarm_repetition/netdata.conf_with_repetition index ddee852ff..e1424abfd 100644 --- a/tests/alarm_repetition/netdata.conf_with_repetition +++ b/tests/alarm_repetition/netdata.conf_with_repetition @@ -38,7 +38,6 @@ nfacct = no python.d = no apps = no - fping = no cups = no [health] diff --git a/tests/alarm_repetition/netdata.conf_without_repetition b/tests/alarm_repetition/netdata.conf_without_repetition index 7add03282..f11b1632d 100644 --- a/tests/alarm_repetition/netdata.conf_without_repetition +++ b/tests/alarm_repetition/netdata.conf_without_repetition @@ -38,7 +38,6 @@ nfacct = no python.d = no apps = no - fping = no cups = no [health] diff --git a/tests/health_mgmtapi/README.md b/tests/health_mgmtapi/README.md index e19b612a5..aa51c0d64 100644 --- a/tests/health_mgmtapi/README.md +++ b/tests/health_mgmtapi/README.md @@ -5,7 +5,7 @@ custom_edit_url: https://github.com/netdata/netdata/edit/master/tests/health_mgm # Health command API tester -The directory `tests/health_cmdapi` contains the test script `health-cmdapi-test.sh` for the [health command API](/web/api/health/README.md). +The directory `tests/health_cmdapi` contains the test script `health-cmdapi-test.sh` for the [health command API](https://github.com/netdata/netdata/blob/master/web/api/health/README.md). The script can be executed with options to prepare the system for the tests, run them and restore the system to its previous state. diff --git a/tests/installer/checksums.sh b/tests/installer/checksums.sh deleted file mode 100755 index ff0400baa..000000000 --- a/tests/installer/checksums.sh +++ /dev/null @@ -1,53 +0,0 @@ -#!/bin/sh - -# -# Mechanism to validate kickstart files integrity status -# -# Copyright: SPDX-License-Identifier: GPL-3.0-or-later -# -# Author : Pawel Krupa (pawel@netdata.cloud) -# Author : Pavlos Emm. Katsoulakis (paul@netdata.cloud) -# Author : Austin S. Hemmelgarn (austin@netdata.cloud) -set -e - -# If we are not in netdata git repo, at the top level directory, fail -TOP_LEVEL=$(basename "$(git rev-parse --show-toplevel 2>/dev/null || echo "")") -CWD="$(git rev-parse --show-cdup 2>/dev/null || echo "")" -if [ -n "$CWD" ] || [ "${TOP_LEVEL}" != "netdata" ]; then - echo "Run as ./tests/installer/$(basename "$0") from top level directory of netdata git repository" - echo "Kickstart validation process aborted" - exit 1 -fi - -check_file() { - README_MD5=$(grep "$1" "$2" | grep md5sum | grep curl | cut -d '"' -f2) - KICKSTART_URL="https://my-netdata.io/$1" - KICKSTART="packaging/installer/$1" - KICKSTART_MD5="$(md5sum "${KICKSTART}" | cut -d' ' -f1)" - CALCULATED_MD5="$(curl -Ss "${KICKSTART_URL}" | md5sum | cut -d ' ' -f 1)" - - # Conditionally run the website validation - if [ -z "${LOCAL_ONLY}" ]; then - echo "Validating ${KICKSTART_URL} against local file ${KICKSTART} with MD5 ${KICKSTART_MD5}.." - if [ "$KICKSTART_MD5" = "$CALCULATED_MD5" ]; then - echo "${KICKSTART_URL} looks fine" - else - echo "${KICKSTART_URL} md5sum does not match local file, it needs to be updated" - exit 2 - fi - fi - - echo "Validating documentation for $1" - if [ "$KICKSTART_MD5" != "$README_MD5" ]; then - echo "Invalid checksum for $1 in $2." - echo "checksum in docs: $README_MD5" - echo "current checksum: $KICKSTART_MD5" - exit 2 - else - echo "$1 MD5Sum is well documented" - fi -} - -check_file kickstart.sh packaging/installer/methods/kickstart.md - -echo "No problems found, exiting successfully!" diff --git a/tests/installer/slack.sh b/tests/installer/slack.sh deleted file mode 100755 index 3f3eff6e7..000000000 --- a/tests/installer/slack.sh +++ /dev/null @@ -1,65 +0,0 @@ -# #No shebang necessary -# BASH Lib: Simple incoming webhook for slack integration. -# -# The script expects the following parameters to be defined by the upper layer: -# SLACK_NOTIFY_WEBHOOK_URL -# SLACK_BOT_NAME -# SLACK_CHANNEL -# -# Copyright: -# -# Author: Pavlos Emm. Katsoulakis <paul@netdata.cloud - -post_message() { - TYPE="$1" - MESSAGE="$2" - CUSTOM_CHANNEL="$3" - - case "$TYPE" in - "PLAIN_MESSAGE") - curl -X POST --data-urlencode "payload={\"channel\": \"${SLACK_CHANNEL}\", \"username\": \"${SLACK_BOT_NAME}\", \"text\": \"${MESSAGE}\", \"icon_emoji\": \":space_invader:\"}" "${SLACK_NOTIFY_WEBHOOK_URL}" - ;; - "TRAVIS_MESSAGE") - if [ "${TRAVIS_EVENT_TYPE}" == "pull_request" ] || [ "${TRAVIS_BRANCH}" != "master" ] ; then - echo "Skipping notification due to build type." - return 0 - fi - - if [ -n "${CUSTOM_CHANNEL}" ]; then - echo "Sending travis message to custom channel ${CUSTOM_CHANNEL}" - OPTIONAL_CHANNEL_INFO="\"channel\": \"${CUSTOM_CHANNEL}\"," - fi - - POST_MESSAGE="{ - ${OPTIONAL_CHANNEL_INFO} - \"text\": \"${TRAVIS_REPO_SLUG}, ${MESSAGE}\", - \"attachments\": [{ - \"text\": \"${TRAVIS_JOB_NUMBER}: Event type '${TRAVIS_EVENT_TYPE}', on '${TRAVIS_OS_NAME}' \", - \"fallback\": \"I could not determine the build\", - \"callback_id\": \"\", - \"color\": \"#3AA3E3\", - \"attachment_type\": \"default\", - \"actions\": [ - { - \"name\": \"${TRAVIS_BUILD_NUMBER}\", - \"text\": \"Build #${TRAVIS_BUILD_NUMBER}\", - \"type\": \"button\", - \"url\": \"${TRAVIS_BUILD_WEB_URL}\" - }, - { - \"name\": \"${TRAVIS_JOB_NUMBER}\", - \"text\": \"Job #${TRAVIS_JOB_NUMBER}\", - \"type\": \"button\", - \"url\": \"${TRAVIS_JOB_WEB_URL}\" - }] - }] - }" - echo "Sending ${POST_MESSAGE}" - curl -X POST --data-urlencode "payload=${POST_MESSAGE}" "${SLACK_NOTIFY_WEBHOOK_URL}" - ;; - *) - echo "Unrecognized message type \"$TYPE\" was given" - return 1 - ;; - esac -} diff --git a/tests/lifecycle.bats b/tests/lifecycle.bats deleted file mode 100755 index bf626fe13..000000000 --- a/tests/lifecycle.bats +++ /dev/null @@ -1,60 +0,0 @@ -#!/usr/bin/env bats -# -# Netdata installation lifecycle testing script. -# This is to validate the install, update and uninstall of netdata -# -# Copyright: SPDX-License-Identifier: GPL-3.0-or-later -# -# Author : Pavlos Emm. Katsoulakis <paul@netdata.cloud) -# - -INSTALLATION="$BATS_TMPDIR/installation" -ENV="${INSTALLATION}/netdata/etc/netdata/.environment" -# list of files which need to be checked. Path cannot start from '/' -FILES="usr/libexec/netdata/plugins.d/go.d.plugin - usr/libexec/netdata/plugins.d/charts.d.plugin - usr/libexec/netdata/plugins.d/python.d.plugin" - -DIRS="usr/sbin/netdata - etc/netdata - usr/share/netdata - usr/libexec/netdata - var/cache/netdata - var/lib/netdata - var/log/netdata" - -setup() { - # If we are not in netdata git repo, at the top level directory, fail - TOP_LEVEL=$(basename "$(git rev-parse --show-toplevel)") - CWD=$(git rev-parse --show-cdup || echo "") - if [ -n "${CWD}" ] || [ ! "${TOP_LEVEL}" == "netdata" ]; then - echo "Run as ./tests/lifecycle/$(basename "$0") from top level directory of git repository" - exit 1 - fi -} - -@test "install netdata" { - ./netdata-installer.sh --dont-wait --dont-start-it --auto-update --install "${INSTALLATION}" - - # Validate particular files - for file in $FILES; do - [ ! -f "$BATS_TMPDIR/$file" ] - done - - # Validate particular directories - for a_dir in $DIRS; do - [ ! -d "$BATS_TMPDIR/$a_dir" ] - done -} - -@test "update netdata" { - export ENVIRONMENT_FILE="${ENV}" - ${INSTALLATION}/netdata/usr/libexec/netdata/netdata-updater.sh --not-running-from-cron - ! grep "new_installation" "${ENV}" -} - -@test "uninstall netdata" { - ./packaging/installer/netdata-uninstaller.sh --yes --force --env "${ENV}" - [ ! -f "${INSTALLATION}/netdata/usr/sbin/netdata" ] - [ ! -f "/etc/cron.daily/netdata-updater" ] -} diff --git a/tests/run-unit-tests.sh b/tests/run-unit-tests.sh index 70d618ad7..d39351779 100755 --- a/tests/run-unit-tests.sh +++ b/tests/run-unit-tests.sh @@ -21,7 +21,7 @@ install_netdata() { echo "Installing Netdata" fakeroot ./netdata-installer.sh \ - --install "$HOME" \ + --install-prefix "$HOME" \ --dont-wait \ --dont-start-it \ --enable-plugin-nfacct \ diff --git a/tests/updater_checks.bats b/tests/updater_checks.bats deleted file mode 100755 index 15ffce8fb..000000000 --- a/tests/updater_checks.bats +++ /dev/null @@ -1,65 +0,0 @@ -#!/usr/bin/env bats -# -# This script is responsible for validating -# updater capabilities after a change -# -# Copyright: SPDX-License-Identifier: GPL-3.0-or-later -# -# Author : Pavlos Emm. Katsoulakis <paul@netdata.cloud) -# - -INSTALLATION="$BATS_TMPDIR/installation" -ENV="${INSTALLATION}/netdata/etc/netdata/.environment" -# list of files which need to be checked. Path cannot start from '/' -FILES="usr/libexec/netdata/plugins.d/go.d.plugin - usr/libexec/netdata/plugins.d/charts.d.plugin - usr/libexec/netdata/plugins.d/python.d.plugin" - -DIRS="usr/sbin/netdata - etc/netdata - usr/share/netdata - usr/libexec/netdata - var/cache/netdata - var/lib/netdata - var/log/netdata" - -setup() { - # If we are not in netdata git repo, at the top level directory, fail - TOP_LEVEL=$(basename "$(git rev-parse --show-toplevel)") - CWD=$(git rev-parse --show-cdup || echo "") - if [ -n "${CWD}" ] || [ ! "${TOP_LEVEL}" == "netdata" ]; then - echo "Run as ./tests/$(basename "$0") from top level directory of git repository" - exit 1 - fi -} - -@test "install stable netdata using kickstart" { - ./packaging/installer/kickstart.sh --dont-wait --dont-start-it --auto-update --install ${INSTALLATION} - - # Validate particular files - for file in $FILES; do - [ ! -f "$BATS_TMPDIR/$file" ] - done - - # Validate particular directories - for a_dir in $DIRS; do - [ ! -d "$BATS_TMPDIR/$a_dir" ] - done - - # Cleanup - rm -rf ${kickstart_file} -} - -@test "update netdata using the new updater" { - export ENVIRONMENT_FILE="${ENV}" - # Run the updater, with the override so that it uses the local repo we have at hand - export NETDATA_LOCAL_TARBALL_OVERRIDE="${PWD}" - ${INSTALLATION}/netdata/usr/libexec/netdata/netdata-updater.sh --not-running-from-cron - ! grep "new_installation" "${ENV}" -} - -@test "uninstall netdata using latest uninstaller" { - ./packaging/installer/netdata-uninstaller.sh --yes --force --env "${ENV}" - [ ! -f "${INSTALLATION}/netdata/usr/sbin/netdata" ] - [ ! -f "/etc/cron.daily/netdata-updater" ] -} diff --git a/tests/updater_checks.sh b/tests/updater_checks.sh deleted file mode 100755 index 1c8d7b028..000000000 --- a/tests/updater_checks.sh +++ /dev/null @@ -1,71 +0,0 @@ -#!/usr/bin/env sh -# -# Wrapper script that installs the required dependencies -# for the BATS script to run successfully -# -# Copyright: SPDX-License-Identifier: GPL-3.0-or-later -# -# Author : Pavlos Emm. Katsoulakis <paul@netdata.cloud) -# - -echo "Syncing/updating repository.." - -blind_arch_grep_install() { - # There is a peculiar docker case with arch, where grep is not available - # This method will have to be triggered blindly, to inject grep so that we can process - # It starts to become a chicken-egg situation with all the distros.. - echo "* * Workaround hack * *" - echo "Attempting blind install for archlinux case" - - if command -v pacman > /dev/null 2>&1; then - echo "Executing grep installation" - pacman -Sy - pacman --noconfirm --needed -S grep - fi -} -blind_arch_grep_install || echo "Workaround failed, proceed as usual" - -running_os="$(grep '^ID=' /etc/os-release | cut -d'=' -f2 | sed -e 's/"//g')" - -case "${running_os}" in -"centos"|"fedora"|"CentOS") - echo "Running on CentOS, updating YUM repository.." - yum clean all - yum update -y - - echo "Installing extra dependencies.." - yum install -y epel-release - yum install -y bats curl - ;; -"debian"|"ubuntu") - echo "Running ${running_os}, updating APT repository" - apt-get update -y - apt-get install -y bats curl - ;; -"opensuse-leap"|"opensuse-tumbleweed") - zypper update -y - zypper install -y bats curl - - # Fixes curl: (60) SSL certificate problem: unable to get local issuer certificate - # https://travis-ci.com/netdata/netdata/jobs/267573805 - update-ca-certificates - ;; -"arch") - pacman --noconfirm -Syu - pacman --noconfirm --needed -S bash-bats curl libffi - ;; -"alpine") - apk update - apk add bash curl bats - ;; -*) - echo "Running on ${running_os}, no repository preparation done" - ;; -esac - -# Run dependency scriptlet, before anything else -# -./packaging/installer/install-required-packages.sh --non-interactive netdata - -echo "Running BATS file.." -bats --tap tests/updater_checks.bats |