Debian Codegraph @

debian/tests/functional

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