File tree 2 files changed +19
-2
lines changed
2 files changed +19
-2
lines changed Original file line number Diff line number Diff line change @@ -20,12 +20,20 @@ USAGE
20
20
}
21
21
22
22
wait_for () {
23
+ _HOST=$HOST
24
+ _PORT=$PORT
23
25
for i in ` seq $TIMEOUT ` ; do
24
26
nc -z " $HOST " " $PORT " > /dev/null 2>&1
25
-
27
+
26
28
result=$?
27
29
if [ $result -eq 0 ] ; then
28
30
if [ $# -gt 0 ] ; then
31
+ unset HOST
32
+ unset PORT
33
+ HOST=$_HOST
34
+ PORT=$_PORT
35
+ unset _HOST
36
+ unset _PORT
29
37
exec " $@ "
30
38
fi
31
39
exit 0
Original file line number Diff line number Diff line change 2
2
3
3
@test " google should be immediately found" {
4
4
run ./wait-for google.com:80 -- echo ' success'
5
-
5
+
6
6
[ " $output " = " success" ]
7
7
}
8
8
12
12
[ " $status " -ne 0 ]
13
13
[ " $output " != " success" ]
14
14
}
15
+
16
+ @test " preserve existing environment variable" {
17
+ HOST=myweb.com
18
+ PORT=8080
19
+ run ./wait-for google.com:80 -- echo ' success'
20
+
21
+ [ " $( echo $HOST ) " = ' myweb.com' ]
22
+ [ " $( echo $PORT ) " = ' 8080' ]
23
+ }
You can’t perform that action at this time.
0 commit comments