1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72
|
#!/bin/bash
set -ex
export DEB_BUILD_OPTIONS=nocheck
DH_GOLANG_INSTALL_EXTRA="$(find ./* -name go.mod)" \
dh_auto_configure -O--buildsystem=golang -O--builddirectory=_build
DH_GOLANG_BUILDPKG="go.etcd.io/etcd/tests/functional/cmd/..." \
dh_auto_build -O--buildsystem=golang -O--builddirectory=_build
ln -sf _build/bin bin
ln -sf /usr/bin/etcd bin/
ln -sf /usr/bin/etcdctl bin/
# copy from ../../test.sh functional_pass
function functional_pass {
# Clean up any data and logs from previous runs
rm -rf /tmp/etcd-functional-* /tmp/etcd-functional-*.backup
ss -nlpt
for a in 1 2 3; do
./bin/etcd-agent --network tcp --address 127.0.0.1:${a}9027 &
pid="$!"
agent_pids="${agent_pids} $pid"
done
for a in 1 2 3; do
echo "Waiting for 'etcd-agent' on ${a}9027..."
while ! nc -z localhost ${a}9027; do
sleep 1
done
done
echo "functional test START!"
ss -nlpt
mkdir -p /tmp/etcd-tester-data
# patch out potential port conflicts
sed 's,127.0.0.1:2380,127.0.0.1:5380,g; s,127.0.0.1:2379,127.0.0.1:5378,g; ' \
./tests/functional/functional.yaml > /tmp/etcd-tester-data/functional.yaml
./bin/etcd-tester --config /tmp/etcd-tester-data/functional.yaml && echo "'etcd-tester' succeeded"
ETCD_TESTER_EXIT_CODE=$?
echo "ETCD_TESTER_EXIT_CODE:" ${ETCD_TESTER_EXIT_CODE}
# shellcheck disable=SC2206
agent_pids=($agent_pids)
kill -s TERM "${agent_pids[@]}" || true
if [[ "${ETCD_TESTER_EXIT_CODE}" -ne "0" ]]; then
printf "\n"
find /tmp/etcd-* -ls
printf "\n"
echo "FAILED! 'tail -1000 /tmp/etcd-functional-1/etcd.log'"
tail -1000 /tmp/etcd-functional-1/etcd.log
printf "\n"
echo "FAILED! 'tail -1000 /tmp/etcd-functional-2/etcd.log'"
tail -1000 /tmp/etcd-functional-2/etcd.log
printf "\n"
echo "FAILED! 'tail -1000 /tmp/etcd-functional-3/etcd.log'"
tail -1000 /tmp/etcd-functional-3/etcd.log
echo "--- FAIL: exit code" ${ETCD_TESTER_EXIT_CODE}
exit ${ETCD_TESTER_EXIT_CODE}
fi
echo "functional test PASS!"
}
functional_pass
|