@@ -29,13 +29,13 @@ sleep 12
2929
3030# Sticky (yes, there is only one app!!!)
3131echotestlabel " sticky one app"
32- SESSIONCO=$( curl -v http://localhost:8000/testapp/test.jsp -o /dev/null 2>&1 | grep Set-Cookie | awk ' { print $3 } ' | sed ' s:;::' )
32+ SESSIONCO=$( curl -v http://localhost:8000/testapp/test.jsp -m 20 - o /dev/null 2>&1 | grep Set-Cookie | awk ' { print $3 } ' | sed ' s:;::' )
3333if [ " ${SESSIONCO} " == " " ]; then
3434 echo " Failed no sessionid in curl output..."
3535 curl -v http://localhost:8000/testapp/test.jsp
3636fi
3737echo ${SESSIONCO}
38- NEWCO=$( curl -v --cookie " ${SESSIONCO} " http://localhost:8000/testapp/test.jsp -o /dev/null 2>&1 | grep Set-Cookie | awk ' { print $3 } ' | sed ' s:;::' )
38+ NEWCO=$( curl -v --cookie " ${SESSIONCO} " http://localhost:8000/testapp/test.jsp -m 20 - o /dev/null 2>&1 | grep Set-Cookie | awk ' { print $3 } ' | sed ' s:;::' )
3939if [ " ${NEWCO} " != " " ]; then
4040 echo " Failed not sticky received : ${NEWCO} ???"
4141 exit 1
@@ -47,17 +47,17 @@ sleep 12
4747
4848# Sticky (yes there are 2 apps now)
4949echotestlabel " sticky 2 app"
50- SESSIONCO=$( curl -v http://localhost:8000/testapp/test.jsp -o /dev/null 2>&1 | grep Set-Cookie | awk ' { print $3 } ' | sed ' s:;::' )
50+ SESSIONCO=$( curl -v http://localhost:8000/testapp/test.jsp -m 20 - o /dev/null 2>&1 | grep Set-Cookie | awk ' { print $3 } ' | sed ' s:;::' )
5151NODE=$( echo ${SESSIONCO} | awk -F = ' { print $2 }' | awk -F . ' { print $2 }' )
5252echo " first: ${SESSIONCO} node: ${NODE} "
53- NEWCO=$( curl -v http://localhost:8000/testapp/test.jsp -o /dev/null 2>&1 | grep Set-Cookie | awk ' { print $3 } ' | sed ' s:;::' )
53+ NEWCO=$( curl -v http://localhost:8000/testapp/test.jsp -m 20 - o /dev/null 2>&1 | grep Set-Cookie | awk ' { print $3 } ' | sed ' s:;::' )
5454NEWNODE=$( echo ${NEWCO} | awk -F = ' { print $2 }' | awk -F . ' { print $2 }' )
5555echo " second: ${NEWCO} node: ${NEWNODE} "
5656echo " Checking we can reach the 2 nodes"
5757i=0
5858while [ " ${NODE} " == " ${NEWNODE} " ]
5959do
60- NEWCO=$( curl -v http://localhost:8000/testapp/test.jsp -o /dev/null 2>&1 | grep Set-Cookie | awk ' { print $3 } ' | sed ' s:;::' )
60+ NEWCO=$( curl -v http://localhost:8000/testapp/test.jsp -m 20 - o /dev/null 2>&1 | grep Set-Cookie | awk ' { print $3 } ' | sed ' s:;::' )
6161 NEWNODE=$( echo ${NEWCO} | awk -F = ' { print $2 }' | awk -F . ' { print $2 }' )
6262 i=$( expr $i + 1)
6363 if [ $i -gt 40 ]; then
7373echo " ${i} try gives: ${NEWCO} node: ${NEWNODE} "
7474
7575# Still sticky
76- CO=$( curl -v --cookie " ${SESSIONCO} " http://localhost:8000/testapp/test.jsp -o /dev/null 2>&1 | grep Set-Cookie | awk ' { print $3 } ' | sed ' s:;::' )
76+ CO=$( curl -v --cookie " ${SESSIONCO} " http://localhost:8000/testapp/test.jsp -m 20 - o /dev/null 2>&1 | grep Set-Cookie | awk ' { print $3 } ' | sed ' s:;::' )
7777if [ " ${CO} " != " " ]; then
7878 echo " Failed not sticky received : ${CO} ???"
7979 exit 1
8080fi
81- CO=$( curl -v --cookie " ${NEWCO} " http://localhost:8000/testapp/test.jsp -o /dev/null 2>&1 | grep Set-Cookie | awk ' { print $3 } ' | sed ' s:;::' )
81+ CO=$( curl -v --cookie " ${NEWCO} " http://localhost:8000/testapp/test.jsp -m 20 - o /dev/null 2>&1 | grep Set-Cookie | awk ' { print $3 } ' | sed ' s:;::' )
8282if [ " ${CO} " != " " ]; then
8383 echo " Failed not sticky received : ${CO} ???"
8484 exit 1
8888echotestlabel " sticky: stopping one node and doing requests..."
8989NODE=$( echo ${NEWCO} | awk -F = ' { print $2 }' | awk -F . ' { print $2 }' )
9090echo $NODE
91- PORT=$( curl http://localhost:6666/mod_cluster_manager | grep Node | grep $NODE | sed ' s:)::' | awk -F : ' { print $3 } ' )
91+ PORT=$( curl http://localhost:6666/mod_cluster_manager -m 20 | grep Node | grep $NODE | sed ' s:)::' | awk -F : ' { print $3 } ' )
9292NAME=$( expr ${PORT} - 8080 + 1)
9393echo " Will stop tomcat$NAME corresponding to ${NODE} and cookie: ${NEWCO} "
9494CODE=" 200"
9999 echo " Done remaining tomcat still answering!"
100100 break
101101 fi
102- CODE=$( curl -s -o /dev/null -w " %{http_code}" --cookie " ${NEWCO} " http://localhost:8000/testapp/test.jsp)
102+ CODE=$( curl -s -o /dev/null -m 20 - w " %{http_code}" --cookie " ${NEWCO} " http://localhost:8000/testapp/test.jsp)
103103 if [ $i -eq 0 ]; then
104104 # stop the tomcat
105105 echo " tomcat${NAME} being stopped"
109109done
110110if [ ${CODE} != " 200" ]; then
111111 echo " Something was wrong... got: ${CODE} "
112- curl -v --cookie " ${NEWCO} " http://localhost:8000/testapp/test.jsp
112+ curl -v --cookie " ${NEWCO} " -m 20 http://localhost:8000/testapp/test.jsp
113113 exit 1
114114fi
115115
@@ -148,25 +148,25 @@ tomcat_wait_for_n_nodes 2 || exit 1
148148# X-Forwarded-Server: fe80::faf4:935b:9dda:2adf
149149# therefore don't forget ProxyPreserveHost On (otherwise UseAlias On failed...)
150150#
151- CODE=$( curl -s -o /dev/null -w " %{http_code}" --header " Host: example.com" http://127.0.0.1:8000/test/test.jsp)
151+ CODE=$( curl -s -o /dev/null -m 20 - w " %{http_code}" --header " Host: example.com" http://127.0.0.1:8000/test/test.jsp)
152152if [ ${CODE} != " 200" ]; then
153153 echo " Failed can't rearch webapp at example.com: ${CODE} "
154154 exit 1
155155fi
156156# Basically curl --header "Host: localhost" http://127.0.0.1:8000/test/test.jsp gives 400
157- CODE=$( curl -s -o /dev/null -w " %{http_code}" --header " Host: localhost" http://127.0.0.1:8000/test/test.jsp)
157+ CODE=$( curl -s -o /dev/null -m 20 - w " %{http_code}" --header " Host: localhost" http://127.0.0.1:8000/test/test.jsp)
158158if [ ${CODE} != " 404" ]; then
159159 echo " Failed should NOT rearch webapp at localhost: ${CODE} "
160160 exit 1
161161fi
162162# Same using localhost/testapp2 and curl --header "Host: localhost" http://127.0.0.1:8000/testapp2/test.jsp
163- CODE=$( curl -s -o /dev/null -w " %{http_code}" --header " Host: localhost" http://127.0.0.1:8000/testapp2/test.jsp)
163+ CODE=$( curl -s -o /dev/null -m 20 - w " %{http_code}" --header " Host: localhost" http://127.0.0.1:8000/testapp2/test.jsp)
164164if [ ${CODE} != " 200" ]; then
165165 echo " Failed can't rearch webapp at localhost: ${CODE} "
166166 exit 1
167167fi
168168# Basically curl --header "Host: example.com" http://127.0.0.1:8000/testapp2/test.jsp gives 400
169- CODE=$( curl -s -o /dev/null -w " %{http_code}" --header " Host: example.com" http://127.0.0.1:8000/testapp2/test.jsp)
169+ CODE=$( curl -s -o /dev/null -m 20 - w " %{http_code}" --header " Host: example.com" http://127.0.0.1:8000/testapp2/test.jsp)
170170if [ ${CODE} != " 404" ]; then
171171 echo " Failed should NOT rearch webapp at localhost: ${CODE} "
172172 exit 1
0 commit comments