diff options
author | Austin S. Hemmelgarn <austin@netdata.cloud> | 2022-07-14 14:26:11 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-07-14 07:26:11 -0400 |
commit | bd5f778838ff6b4206509a19b967f7b6eb6b16c7 (patch) | |
tree | 3e6ec0b7a044fcdfc38528e0624ee9a204a41828 /packaging/makeself/jobs | |
parent | 1cea4f77ee42ebcd979efbcab13094c7818a4f8b (diff) |
Add basic runtime checks to static build process. (#13339)
* Enable use of Podman for static builds.
This way those of us who have migrated away from Docker can still easily
test static builds.
* Add basic runtime testing to the static build process.
This will help catch basic runtime issues that would not show up just
from building the agent.
Diffstat (limited to 'packaging/makeself/jobs')
-rwxr-xr-x | packaging/makeself/jobs/90-netdata-runtime-check.sh | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/packaging/makeself/jobs/90-netdata-runtime-check.sh b/packaging/makeself/jobs/90-netdata-runtime-check.sh new file mode 100755 index 0000000000..a3c94ffcb7 --- /dev/null +++ b/packaging/makeself/jobs/90-netdata-runtime-check.sh @@ -0,0 +1,54 @@ +#!/usr/bin/env bash +# SPDX-License-Identifier: GPL-3.0-or-later + +# shellcheck source=./packaging/makeself/functions.sh +. "${NETDATA_MAKESELF_PATH}"/functions.sh "${@}" || exit 1 + +dump_log() { + cat ./netdata.log +} + +wait_for() { + host="${1}" + port="${2}" + name="${3}" + timeout="30" + + if command -v nc > /dev/null ; then + netcat="nc" + elif command -v netcat > /dev/null ; then + netcat="netcat" + else + printf "Unable to find a usable netcat command.\n" + return 1 + fi + + printf "Waiting for %s on %s:%s ... " "${name}" "${host}" "${port}" + + sleep 30 + + i=0 + while ! ${netcat} -z "${host}" "${port}"; do + sleep 1 + if [ "$i" -gt "$timeout" ]; then + printf "Timed out!\n" + return 1 + fi + i="$((i + 1))" + done + printf "OK\n" +} + +trap dump_log EXIT + +"${NETDATA_INSTALL_PATH}/bin/netdata" -D > ./netdata.log 2>&1 & + +wait_for localhost 19999 netdata || exit 1 + +curl -sS http://127.0.0.1:19999/api/v1/info > ./response || exit 1 + +cat ./response + +jq '.version' ./response || exit 1 + +trap - EXIT |