File tree Expand file tree Collapse file tree 2 files changed +17
-2
lines changed Expand file tree Collapse file tree 2 files changed +17
-2
lines changed Original file line number Diff line number Diff line change @@ -20,12 +20,18 @@ USAGE
2020}
2121
2222wait_for () {
23+ _HOST=$HOST
24+ _PORT=$PORT
2325 for i in ` seq $TIMEOUT ` ; do
2426 nc -z " $HOST " " $PORT " > /dev/null 2>&1
25-
27+
2628 result=$?
2729 if [ $result -eq 0 ] ; then
2830 if [ $# -gt 0 ] ; then
31+ unset $HOST
32+ unset $PORT
33+ HOST=$_HOST
34+ PORT=$_PORT
2935 exec " $@ "
3036 fi
3137 exit 0
Original file line number Diff line number Diff line change 22
33@test " google should be immediately found" {
44 run ./wait-for google.com:80 -- echo ' success'
5-
5+
66 [ " $output " = " success" ]
77}
88
1212 [ " $status " -ne 0 ]
1313 [ " $output " != " success" ]
1414}
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