test: Export the mgmt command to be used during test
This commit is contained in:
committed by
James Shubin
parent
d99190b166
commit
572b2575c5
@@ -38,6 +38,10 @@ if [ ! -z "$APT" ]; then
|
||||
$sudo_command $APT install -y libpcap0.8-dev || true
|
||||
# dependencies for building debian packages with `make deb`
|
||||
$sudo_command $APT install -y dpkg-dev devscripts debhelper dh-golang dh-systemd
|
||||
# `realpath` is a more universal alternative to `readlink -f` for absolute path resolution
|
||||
# (-f is missing on BSD/macOS), but older Debian/Ubuntu's don't include it in coreutils yet.
|
||||
# https://unix.stackexchange.com/a/136527
|
||||
$sudo_command $APT install -y realpath || true
|
||||
fi
|
||||
|
||||
if [ ! -z "$BREW" ]; then
|
||||
|
||||
@@ -10,7 +10,7 @@ mkdir -p "${MGMT_TMPDIR}"
|
||||
> "${MGMT_TMPDIR}"sshd_config
|
||||
|
||||
# run empty graph, with prometheus support
|
||||
$timeout --kill-after=60s 55s ./mgmt run --tmp-prefix --yaml=augeas-1.yaml &
|
||||
$timeout --kill-after=60s 55s "$MGMT" run --tmp-prefix --yaml=augeas-1.yaml &
|
||||
pid=$!
|
||||
sleep 10s # let it converge
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
# should take a few seconds plus converged timeout, and test we don't hang!
|
||||
# TODO: should we return a different exit code if the resources fail?
|
||||
# TODO: should we be converged if one of the resources has permanently failed?
|
||||
$timeout --kill-after=60s 55s ./mgmt run --yaml exec-fail.yaml --converged-timeout=5 --no-watch --no-pgp --tmp-prefix &
|
||||
$timeout --kill-after=60s 55s "$MGMT" run --yaml exec-fail.yaml --converged-timeout=5 --no-watch --no-pgp --tmp-prefix &
|
||||
pid=$!
|
||||
wait $pid # get exit status
|
||||
exit $?
|
||||
|
||||
@@ -38,7 +38,7 @@ function run_usergroup_test() {
|
||||
setup
|
||||
|
||||
# run till completion
|
||||
sudo -A timeout --kill-after=30s 25s ./mgmt run --yaml ./exec-usergroup/${graph} --converged-timeout=5 --no-watch --tmp-prefix &
|
||||
sudo -A timeout --kill-after=30s 25s "$MGMT" run --yaml ./exec-usergroup/${graph} --converged-timeout=5 --no-watch --tmp-prefix &
|
||||
pid=$!
|
||||
wait $pid # get exit status
|
||||
e=$?
|
||||
|
||||
@@ -9,7 +9,7 @@ fi
|
||||
set -x
|
||||
|
||||
# run till completion
|
||||
$timeout --kill-after=60s 55s ./mgmt run --yaml file-mode.yaml --converged-timeout=5 --no-watch --tmp-prefix &
|
||||
$timeout --kill-after=60s 55s "$MGMT" run --yaml file-mode.yaml --converged-timeout=5 --no-watch --tmp-prefix &
|
||||
pid=$!
|
||||
wait $pid # get exit status
|
||||
e=$?
|
||||
|
||||
@@ -7,7 +7,7 @@ exit 0
|
||||
mkdir -p /tmp/mgmt/a/b/c/
|
||||
|
||||
# run empty graph, with prometheus support
|
||||
$timeout --kill-after=60s 55s ./mgmt run --tmp-prefix --yaml=examples/deep-dirs.yaml &
|
||||
$timeout --kill-after=60s 55s "$MGMT" run --tmp-prefix --yaml=examples/deep-dirs.yaml &
|
||||
pid=$!
|
||||
sleep 10s # let it converge
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ mkdir -p /tmp/mgmt/
|
||||
rm /tmp/mgmt/f1 || true
|
||||
|
||||
# run empty graph, with prometheus support
|
||||
$timeout --kill-after=60s 55s ./mgmt run --tmp-prefix --yaml=file-move.yaml 2>&1 | tee /tmp/mgmt/file-move.log &
|
||||
$timeout --kill-after=60s 55s "$MGMT" run --tmp-prefix --yaml=file-move.yaml 2>&1 | tee /tmp/mgmt/file-move.log &
|
||||
pid=$!
|
||||
sleep 5s # let it converge
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ if ! timeout 1s sudo -A true; then
|
||||
fi
|
||||
|
||||
# run till completion
|
||||
$timeout --kill-after=30s 25s sudo -A ./mgmt run --yaml file-owner.yaml --converged-timeout=5 --no-watch --tmp-prefix &
|
||||
$timeout --kill-after=30s 25s sudo -A "$MGMT" run --yaml file-owner.yaml --converged-timeout=5 --no-watch --tmp-prefix &
|
||||
pid=$!
|
||||
wait $pid # get exit status
|
||||
e=$?
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
# should take 15 seconds for longest resources plus startup time to shutdown
|
||||
# we don't want the ^C to allow the rest of the graph to continue executing!
|
||||
$timeout --kill-after=65s 55s ./mgmt run --yaml graph-exit1.yaml --no-watch --no-pgp --tmp-prefix &
|
||||
$timeout --kill-after=65s 55s "$MGMT" run --yaml graph-exit1.yaml --no-watch --no-pgp --tmp-prefix &
|
||||
pid=$!
|
||||
sleep 5s # let the initial resources start to run...
|
||||
killall -SIGINT mgmt # send ^C to exit mgmt
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
# should take 15 seconds for longest resources plus startup time to shutdown
|
||||
# we don't want the ^C to allow the rest of the graph to continue executing!
|
||||
$timeout --kill-after=65s 55s ./mgmt run --yaml graph-exit2.yaml --no-watch --no-pgp --tmp-prefix &
|
||||
$timeout --kill-after=65s 55s "$MGMT" run --yaml graph-exit2.yaml --no-watch --no-pgp --tmp-prefix &
|
||||
pid=$!
|
||||
sleep 10s # let the initial resources start to run...
|
||||
killall -SIGINT mgmt # send ^C to exit mgmt
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/bin/bash -e
|
||||
|
||||
# should take more than 25s plus overhead
|
||||
$timeout --kill-after=50s 45s ./mgmt run --yaml graph-fanin-1.yaml --converged-timeout=5 --no-watch --tmp-prefix --no-pgp &
|
||||
$timeout --kill-after=50s 45s "$MGMT" run --yaml graph-fanin-1.yaml --converged-timeout=5 --no-watch --tmp-prefix --no-pgp &
|
||||
pid=$!
|
||||
wait $pid # get exit status
|
||||
exit $?
|
||||
|
||||
@@ -34,7 +34,7 @@ file "${tmpdir}/loadavg" {
|
||||
}
|
||||
EOF
|
||||
|
||||
$timeout --kill-after=60s 55s ./mgmt run --tmp-prefix --converged-timeout=1 --lang "$tmpdir/load0.mcl" &
|
||||
$timeout --kill-after=60s 55s "$MGMT" run --tmp-prefix --converged-timeout=1 --lang "$tmpdir/load0.mcl" &
|
||||
pid=$!
|
||||
wait $pid # get exit status
|
||||
e=$?
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/bin/bash -e
|
||||
|
||||
# run empty graph, with prometheus support
|
||||
$timeout --kill-after=60s 55s ./mgmt run --tmp-prefix --prometheus &
|
||||
$timeout --kill-after=60s 55s "$MGMT" run --tmp-prefix --prometheus &
|
||||
pid=$!
|
||||
sleep 5s # let it converge
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/bin/bash -e
|
||||
|
||||
# run empty graph, with prometheus support
|
||||
$timeout --kill-after=60s 55s ./mgmt run --tmp-prefix --prometheus --prometheus-listen :52637 &
|
||||
$timeout --kill-after=60s 55s "$MGMT" run --tmp-prefix --prometheus --prometheus-listen :52637 &
|
||||
pid=$!
|
||||
sleep 5s # let it converge
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ if [[ $(uname) == "Darwin" ]] ; then
|
||||
fi
|
||||
|
||||
# run a graph, with prometheus support
|
||||
$timeout --kill-after=60s 55s ./mgmt run --tmp-prefix --no-pgp --prometheus --yaml prometheus-3.yaml &
|
||||
$timeout --kill-after=60s 55s "$MGMT" run --tmp-prefix --no-pgp --prometheus --yaml prometheus-3.yaml &
|
||||
pid=$!
|
||||
sleep 10s # let it converge
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ if [[ $(uname) == "Darwin" ]] ; then
|
||||
fi
|
||||
|
||||
# run a graph, with prometheus support
|
||||
$timeout --kill-after=60s 55s ./mgmt run --tmp-prefix --no-pgp --prometheus --yaml prometheus-4.yaml &
|
||||
$timeout --kill-after=60s 55s "$MGMT" run --tmp-prefix --no-pgp --prometheus --yaml prometheus-4.yaml &
|
||||
pid=$!
|
||||
sleep 15s # let it converge
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
# should take at least 55s, but fail if we block this
|
||||
# TODO: it would be nice to make sure this test doesn't exit too early!
|
||||
$timeout --kill-after=120s 110s ./mgmt run --yaml sema-1.yaml --sema 2 --converged-timeout=5 --no-watch --no-pgp --tmp-prefix &
|
||||
$timeout --kill-after=120s 110s "$MGMT" run --yaml sema-1.yaml --sema 2 --converged-timeout=5 --no-watch --no-pgp --tmp-prefix &
|
||||
pid=$!
|
||||
wait $pid # get exit status
|
||||
exit $?
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
set -o errexit
|
||||
set -o pipefail
|
||||
|
||||
$timeout --kill-after=3s 1s ./mgmt --help # hello world!
|
||||
$timeout --kill-after=3s 1s "$MGMT" --help # hello world!
|
||||
pid=$!
|
||||
wait $pid # get exit status
|
||||
exit $?
|
||||
|
||||
@@ -7,7 +7,7 @@ if env | grep -q -e '^TRAVIS=true$'; then
|
||||
fi
|
||||
|
||||
# run till completion
|
||||
$timeout --kill-after=15s 10s ./mgmt run --yaml t2.yaml --converged-timeout=5 --no-watch --tmp-prefix &
|
||||
$timeout --kill-after=15s 10s "$MGMT" run --yaml t2.yaml --converged-timeout=5 --no-watch --tmp-prefix &
|
||||
pid=$!
|
||||
wait $pid # get exit status
|
||||
e=$?
|
||||
|
||||
@@ -10,11 +10,11 @@ fi
|
||||
mkdir -p "${MGMT_TMPDIR}"mgmt{A..C}
|
||||
|
||||
# run till completion
|
||||
$timeout --kill-after=15s 10s ./mgmt run --yaml t3-a.yaml --converged-timeout=5 --no-watch --tmp-prefix &
|
||||
$timeout --kill-after=15s 10s "$MGMT" run --yaml t3-a.yaml --converged-timeout=5 --no-watch --tmp-prefix &
|
||||
pid1=$!
|
||||
$timeout --kill-after=15s 10s ./mgmt run --yaml t3-b.yaml --converged-timeout=5 --no-watch --tmp-prefix &
|
||||
$timeout --kill-after=15s 10s "$MGMT" run --yaml t3-b.yaml --converged-timeout=5 --no-watch --tmp-prefix &
|
||||
pid2=$!
|
||||
$timeout --kill-after=15s 10s ./mgmt run --yaml t3-c.yaml --converged-timeout=5 --no-watch --tmp-prefix &
|
||||
$timeout --kill-after=15s 10s "$MGMT" run --yaml t3-c.yaml --converged-timeout=5 --no-watch --tmp-prefix &
|
||||
pid3=$!
|
||||
|
||||
wait $pid1 # get exit status
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/bin/bash -e
|
||||
|
||||
# should take slightly more than 35s, but fail if we take much longer)
|
||||
$timeout --kill-after=55s 50s ./mgmt run --yaml t5.yaml --converged-timeout=5 --no-watch --no-pgp --tmp-prefix &
|
||||
$timeout --kill-after=55s 50s "$MGMT" run --yaml t5.yaml --converged-timeout=5 --no-watch --no-pgp --tmp-prefix &
|
||||
pid=$!
|
||||
wait $pid # get exit status
|
||||
exit $?
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/bin/bash -e
|
||||
|
||||
# should take slightly more than 35s, but fail if we take much longer)
|
||||
$timeout --kill-after=55s 50s ./mgmt run --yaml t5b.yaml --converged-timeout=5 --no-watch --no-pgp --tmp-prefix &
|
||||
$timeout --kill-after=55s 50s "$MGMT" run --yaml t5b.yaml --converged-timeout=5 --no-watch --no-pgp --tmp-prefix &
|
||||
pid=$!
|
||||
wait $pid # get exit status
|
||||
exit $?
|
||||
|
||||
@@ -7,7 +7,7 @@ if env | grep -q -e '^TRAVIS=true$'; then
|
||||
fi
|
||||
|
||||
# run till completion
|
||||
$timeout --kill-after=60s 55s ./mgmt run --yaml t6.yaml --no-watch --tmp-prefix &
|
||||
$timeout --kill-after=60s 55s "$MGMT" run --yaml t6.yaml --no-watch --tmp-prefix &
|
||||
pid=$!
|
||||
sleep 10s # let it converge
|
||||
test -e /tmp/mgmt/f1
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/bin/bash -e
|
||||
|
||||
# run empty graph
|
||||
$timeout --kill-after=45s 35s ./mgmt run --tmp-prefix --no-pgp &
|
||||
$timeout --kill-after=45s 35s "$MGMT" run --tmp-prefix --no-pgp &
|
||||
pid=$!
|
||||
sleep 10s # let it converge
|
||||
$(sleep 3s && killall -SIGINT mgmt)& # send ^C to exit mgmt
|
||||
|
||||
@@ -3,11 +3,11 @@
|
||||
exit 0 # XXX: test temporarily disabled till etcd or mgmt regression is fixed.
|
||||
|
||||
# run empty graphs, we're just testing etcd clustering
|
||||
$timeout --kill-after=180s 120s ./mgmt run --hostname h1 --tmp-prefix &
|
||||
$timeout --kill-after=180s 120s "$MGMT" run --hostname h1 --tmp-prefix &
|
||||
pid1=$!
|
||||
sleep 15s # let it startup
|
||||
|
||||
$timeout --kill-after=180s 120s ./mgmt run --hostname h2 --seeds http://127.0.0.1:2379 --client-urls http://127.0.0.1:2381 --server-urls http://127.0.0.1:2382 --tmp-prefix &
|
||||
$timeout --kill-after=180s 120s "$MGMT" run --hostname h2 --seeds http://127.0.0.1:2379 --client-urls http://127.0.0.1:2381 --server-urls http://127.0.0.1:2382 --tmp-prefix &
|
||||
pid2=$!
|
||||
sleep 15s
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ fi
|
||||
|
||||
# set the config file
|
||||
cp -a yaml-change1a.yaml /tmp/mgmt/yaml-change.yaml
|
||||
$timeout --kill-after=30s 20s ./mgmt run --yaml /tmp/mgmt/yaml-change.yaml --tmp-prefix &
|
||||
$timeout --kill-after=30s 20s "$MGMT" run --yaml /tmp/mgmt/yaml-change.yaml --tmp-prefix &
|
||||
pid=$!
|
||||
sleep 5s # let it converge
|
||||
grep -q 'hello world' /tmp/mgmt/change1 # check contents are correct
|
||||
|
||||
@@ -21,8 +21,6 @@ fi
|
||||
LINE=$(printf '=%.0s' `seq -s ' ' $(tput cols)`) # a terminal width string
|
||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && cd .. && pwd )" # dir!
|
||||
cd "$DIR" >/dev/null # work from main mgmt directory
|
||||
MGMT="$DIR/test/shell/mgmt"
|
||||
cp -a "$DIR/mgmt" "$MGMT" # put a copy there
|
||||
failures=""
|
||||
count=0
|
||||
|
||||
|
||||
@@ -2,6 +2,12 @@
|
||||
|
||||
# common settings and functions for test scripts
|
||||
|
||||
# get the fully expanded path of the project directory
|
||||
ROOT="$(realpath "$(dirname "$(realpath "${BASH_SOURCE}")")/..")"
|
||||
|
||||
# absolute location to freshly build binary to be used for testing
|
||||
export MGMT="$ROOT/mgmt"
|
||||
|
||||
if [[ $(uname) == "Darwin" ]] ; then
|
||||
export timeout="gtimeout"
|
||||
export mktemp="gmktemp"
|
||||
|
||||
Reference in New Issue
Block a user