annotate NewTests/PostgresUpgrades/wait-for-it.sh @ 605:76e5f75249ca

fix
author Alain Mazy <am@osimis.io>
date Tue, 23 Jan 2024 10:21:30 +0100
parents f3475c3e42e5
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
599
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents:
diff changeset
1 #!/usr/bin/env bash
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents:
diff changeset
2 # Use this script to test if a given TCP host/port are available
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents:
diff changeset
3
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents:
diff changeset
4 cmdname=$(basename $0)
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents:
diff changeset
5
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents:
diff changeset
6 echoerr() { if [[ $QUIET -ne 1 ]]; then echo "$@" 1>&2; fi }
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents:
diff changeset
7
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents:
diff changeset
8 usage()
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents:
diff changeset
9 {
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents:
diff changeset
10 cat << USAGE >&2
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents:
diff changeset
11 Usage:
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents:
diff changeset
12 $cmdname host:port [-s] [-t timeout] [-- command args]
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents:
diff changeset
13 -h HOST | --host=HOST Host or IP under test
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents:
diff changeset
14 -p PORT | --port=PORT TCP port under test
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents:
diff changeset
15 Alternatively, you specify the host and port as host:port
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents:
diff changeset
16 -s | --strict Only execute subcommand if the test succeeds
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents:
diff changeset
17 -q | --quiet Don't output any status messages
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents:
diff changeset
18 -t TIMEOUT | --timeout=TIMEOUT
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents:
diff changeset
19 Timeout in seconds, zero for no timeout
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents:
diff changeset
20 -- COMMAND ARGS Execute command with args after the test finishes
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents:
diff changeset
21 USAGE
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents:
diff changeset
22 exit 1
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents:
diff changeset
23 }
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents:
diff changeset
24
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents:
diff changeset
25 wait_for()
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents:
diff changeset
26 {
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents:
diff changeset
27 if [[ $TIMEOUT -gt 0 ]]; then
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents:
diff changeset
28 echoerr "$cmdname: waiting $TIMEOUT seconds for $HOST:$PORT"
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents:
diff changeset
29 else
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents:
diff changeset
30 echoerr "$cmdname: waiting for $HOST:$PORT without a timeout"
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents:
diff changeset
31 fi
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents:
diff changeset
32 start_ts=$(date +%s)
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents:
diff changeset
33 while :
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents:
diff changeset
34 do
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents:
diff changeset
35 if [[ $ISBUSY -eq 1 ]]; then
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents:
diff changeset
36 nc -z $HOST $PORT
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents:
diff changeset
37 result=$?
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents:
diff changeset
38 else
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents:
diff changeset
39 (echo > /dev/tcp/$HOST/$PORT) >/dev/null 2>&1
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents:
diff changeset
40 result=$?
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents:
diff changeset
41 fi
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents:
diff changeset
42 if [[ $result -eq 0 ]]; then
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents:
diff changeset
43 end_ts=$(date +%s)
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents:
diff changeset
44 echoerr "$cmdname: $HOST:$PORT is available after $((end_ts - start_ts)) seconds"
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents:
diff changeset
45 break
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents:
diff changeset
46 fi
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents:
diff changeset
47 sleep 1
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents:
diff changeset
48 done
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents:
diff changeset
49 return $result
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents:
diff changeset
50 }
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents:
diff changeset
51
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents:
diff changeset
52 wait_for_wrapper()
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents:
diff changeset
53 {
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents:
diff changeset
54 # In order to support SIGINT during timeout: http://unix.stackexchange.com/a/57692
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents:
diff changeset
55 if [[ $QUIET -eq 1 ]]; then
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents:
diff changeset
56 timeout $BUSYTIMEFLAG $TIMEOUT $0 --quiet --child --host=$HOST --port=$PORT --timeout=$TIMEOUT &
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents:
diff changeset
57 else
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents:
diff changeset
58 timeout $BUSYTIMEFLAG $TIMEOUT $0 --child --host=$HOST --port=$PORT --timeout=$TIMEOUT &
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents:
diff changeset
59 fi
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents:
diff changeset
60 PID=$!
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents:
diff changeset
61 trap "kill -INT -$PID" INT
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents:
diff changeset
62 wait $PID
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents:
diff changeset
63 RESULT=$?
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents:
diff changeset
64 if [[ $RESULT -ne 0 ]]; then
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents:
diff changeset
65 echoerr "$cmdname: timeout occurred after waiting $TIMEOUT seconds for $HOST:$PORT"
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents:
diff changeset
66 fi
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents:
diff changeset
67 return $RESULT
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents:
diff changeset
68 }
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents:
diff changeset
69
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents:
diff changeset
70 # process arguments
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents:
diff changeset
71 while [[ $# -gt 0 ]]
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents:
diff changeset
72 do
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents:
diff changeset
73 case "$1" in
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents:
diff changeset
74 *:* )
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents:
diff changeset
75 hostport=(${1//:/ })
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents:
diff changeset
76 HOST=${hostport[0]}
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents:
diff changeset
77 PORT=${hostport[1]}
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents:
diff changeset
78 shift 1
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents:
diff changeset
79 ;;
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents:
diff changeset
80 --child)
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents:
diff changeset
81 CHILD=1
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents:
diff changeset
82 shift 1
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents:
diff changeset
83 ;;
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents:
diff changeset
84 -q | --quiet)
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents:
diff changeset
85 QUIET=1
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents:
diff changeset
86 shift 1
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents:
diff changeset
87 ;;
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents:
diff changeset
88 -s | --strict)
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents:
diff changeset
89 STRICT=1
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents:
diff changeset
90 shift 1
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents:
diff changeset
91 ;;
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents:
diff changeset
92 -h)
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents:
diff changeset
93 HOST="$2"
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents:
diff changeset
94 if [[ $HOST == "" ]]; then break; fi
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents:
diff changeset
95 shift 2
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents:
diff changeset
96 ;;
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents:
diff changeset
97 --host=*)
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents:
diff changeset
98 HOST="${1#*=}"
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents:
diff changeset
99 shift 1
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents:
diff changeset
100 ;;
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents:
diff changeset
101 -p)
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents:
diff changeset
102 PORT="$2"
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents:
diff changeset
103 if [[ $PORT == "" ]]; then break; fi
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents:
diff changeset
104 shift 2
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents:
diff changeset
105 ;;
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents:
diff changeset
106 --port=*)
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents:
diff changeset
107 PORT="${1#*=}"
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents:
diff changeset
108 shift 1
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents:
diff changeset
109 ;;
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents:
diff changeset
110 -t)
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents:
diff changeset
111 TIMEOUT="$2"
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents:
diff changeset
112 if [[ $TIMEOUT == "" ]]; then break; fi
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents:
diff changeset
113 shift 2
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents:
diff changeset
114 ;;
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents:
diff changeset
115 --timeout=*)
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents:
diff changeset
116 TIMEOUT="${1#*=}"
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents:
diff changeset
117 shift 1
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents:
diff changeset
118 ;;
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents:
diff changeset
119 --)
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents:
diff changeset
120 shift
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents:
diff changeset
121 CLI=("$@")
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents:
diff changeset
122 break
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents:
diff changeset
123 ;;
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents:
diff changeset
124 --help)
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents:
diff changeset
125 usage
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents:
diff changeset
126 ;;
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents:
diff changeset
127 *)
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents:
diff changeset
128 echoerr "Unknown argument: $1"
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents:
diff changeset
129 usage
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents:
diff changeset
130 ;;
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents:
diff changeset
131 esac
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents:
diff changeset
132 done
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents:
diff changeset
133
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents:
diff changeset
134 if [[ "$HOST" == "" || "$PORT" == "" ]]; then
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents:
diff changeset
135 echoerr "Error: you need to provide a host and port to test."
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents:
diff changeset
136 usage
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents:
diff changeset
137 fi
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents:
diff changeset
138
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents:
diff changeset
139 TIMEOUT=${TIMEOUT:-15}
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents:
diff changeset
140 STRICT=${STRICT:-0}
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents:
diff changeset
141 CHILD=${CHILD:-0}
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents:
diff changeset
142 QUIET=${QUIET:-0}
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents:
diff changeset
143
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents:
diff changeset
144 # check to see if timeout is from busybox?
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents:
diff changeset
145 # check to see if timeout is from busybox?
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents:
diff changeset
146 TIMEOUT_PATH=$(realpath $(which timeout))
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents:
diff changeset
147 if [[ $TIMEOUT_PATH =~ "busybox" ]]; then
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents:
diff changeset
148 ISBUSY=1
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents:
diff changeset
149 BUSYTIMEFLAG="-t"
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents:
diff changeset
150 else
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents:
diff changeset
151 ISBUSY=0
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents:
diff changeset
152 BUSYTIMEFLAG=""
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents:
diff changeset
153 fi
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents:
diff changeset
154
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents:
diff changeset
155 if [[ $CHILD -gt 0 ]]; then
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents:
diff changeset
156 wait_for
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents:
diff changeset
157 RESULT=$?
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents:
diff changeset
158 exit $RESULT
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents:
diff changeset
159 else
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents:
diff changeset
160 if [[ $TIMEOUT -gt 0 ]]; then
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents:
diff changeset
161 wait_for_wrapper
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents:
diff changeset
162 RESULT=$?
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents:
diff changeset
163 else
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents:
diff changeset
164 wait_for
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents:
diff changeset
165 RESULT=$?
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents:
diff changeset
166 fi
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents:
diff changeset
167 fi
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents:
diff changeset
168
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents:
diff changeset
169 if [[ $CLI != "" ]]; then
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents:
diff changeset
170 if [[ $RESULT -ne 0 && $STRICT -eq 1 ]]; then
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents:
diff changeset
171 echoerr "$cmdname: strict mode, refusing to execute subprocess"
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents:
diff changeset
172 exit $RESULT
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents:
diff changeset
173 fi
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents:
diff changeset
174 exec "${CLI[@]}"
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents:
diff changeset
175 else
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents:
diff changeset
176 exit $RESULT
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents:
diff changeset
177 fi