summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorPaul Emm. Katsoulakis <34388743+paulkatsoulakis@users.noreply.github.com>2019-06-09 20:28:34 +0300
committerGitHub <noreply@github.com>2019-06-09 20:28:34 +0300
commit08666d90237d2e29cb2dcb19f25137f174ed8533 (patch)
treef9d65857f61a6fa8e0a9d85f84fd9f6e8da62c97 /tests
parent3caedbad6c7b3dbe3d9ff90e74207ac7a82f30a6 (diff)
netdata/packaging: Add more distribution validations (#6235)
* netdata/packaging: Add more distribution validations As an attempt to increase our coverage in testing and to guarantee cross-distribution stability, we choose to extend our baseline tests across all currently supported distributions. We run the stable to current transition test, to maximize scenarios coverage. The missing distributions from the bare OS runs, are covered on the Artifacts validations stage * netdata/packaging: adjust update lifecycle test to be more agile 1) use required packages during setup, to guarantee all stuff there cross-distro 2) add opensuse on entry point script 3) Only bats and curl will be installed prior to the tests. The rest are from the deps script * netdata/packaging: Use the right id for version checking, its opensuse-leap not opensuse * netdata/packaging: small adjustments 1) move deps script outside the bats process 2) don't install curl, we expect it to be there 3) fix tumbleweed tag, it was wrong (duh) * netdata/packaging: wrong place, trigger depedency after curl and bats install. Also, blind install for weird archlinux case missing grep * netdata/packaging: missed one more OS identifier * netdata/packaging: Handle alpine case * netdata/packaging: unattended execution flags * netdata/packaging: its a never ending story.. early install of bash for alpine, to get our job done then * netdata/packaging: fix docker runs - multiple commands should be within the container, just using && doesn't send them to the container, second command rather runs on the host * netdata/packaging: Run sh for the main test script, then trigger bash install within for alpine so that the rest of the process runs smoothly
Diffstat (limited to 'tests')
-rwxr-xr-xtests/updater_checks.bats1
-rwxr-xr-xtests/updater_checks.sh49
2 files changed, 46 insertions, 4 deletions
diff --git a/tests/updater_checks.bats b/tests/updater_checks.bats
index e177fe4e5a..1a7eeb704e 100755
--- a/tests/updater_checks.bats
+++ b/tests/updater_checks.bats
@@ -25,7 +25,6 @@ DIRS="usr/sbin/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 "")
diff --git a/tests/updater_checks.sh b/tests/updater_checks.sh
index 6d5aeabf31..9c8b6fa488 100755
--- a/tests/updater_checks.sh
+++ b/tests/updater_checks.sh
@@ -1,4 +1,4 @@
-#!/usr/bin/env bash
+#!/usr/bin/env sh
#
# Wrapper script that installs the required dependencies
# for the BATS script to run successfully
@@ -9,6 +9,22 @@
#
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="$(cat /etc/os-release |grep '^ID=' | cut -d'=' -f2 | sed -e 's/"//g')"
case "${running_os}" in
@@ -19,17 +35,44 @@ case "${running_os}" in
echo "Installing extra dependencies.."
yum install -y epel-release
- yum install -y git bats curl
+ yum install -y bats curl
;;
"debian"|"ubuntu")
echo "Running ${running_os}, updating APT repository"
apt-get update -y
- apt-get install -y git bats curl
+ apt-get install -y bats curl
+ ;;
+"opensuse-leap"|"opensuse-tumbleweed")
+ zypper update -y
+ zypper install -y bats curl
+ ;;
+"arch")
+ pacman -Sy
+ pacman --noconfirm --needed -S bash-bats curl
+ ;;
+"alpine")
+ apk update
+ apk add bash curl bats
;;
*)
echo "Running on ${running_os}, no repository preparation done"
;;
esac
+# Download and run depednency scriptlet, before anything else
+#
+deps_tool="/tmp/deps_tool.$$.sh"
+curl -Ss -o ${deps_tool} https://raw.githubusercontent.com/netdata/netdata-demo-site/master/install-required-packages.sh
+if [ -f "${deps_tool}" ]; then
+ echo "Running dependency handling script.."
+ chmod +x "${deps_tool}"
+ ${deps_tool} --non-interactive netdata
+ rm -f "${deps_tool}"
+ echo "Done!"
+else
+ echo "Failed to fetch dependency script, aborting the test"
+ exit 1
+fi
+
echo "Running BATS file.."
bats --tap tests/updater_checks.bats