@@ -286,9 +286,13 @@ public void verifyAdminServerExternalService(String username, String password) t
286286 *
287287 * @param protocol
288288 * @param port
289+ * @param path
289290 * @throws Exception
290291 */
291- public void verifyHasClusterServiceChannelPort (String protocol , int port ) throws Exception {
292+ public void verifyHasClusterServiceChannelPort (String protocol , int port , String path )
293+ throws Exception {
294+
295+ /* Make sure the service exists in k8s */
292296 if (!TestUtils .checkHasServiceChannelPort (
293297 this .getDomainUid () + "-cluster-" + this .clusterName , domainNS , protocol , port )) {
294298 throw new RuntimeException (
@@ -297,6 +301,35 @@ public void verifyHasClusterServiceChannelPort(String protocol, int port) throws
297301 + "/"
298302 + protocol );
299303 }
304+
305+ /* Make sure we can reach the port */
306+ StringBuffer testAppUrl = new StringBuffer ("http://" );
307+ testAppUrl
308+ .append (this .getDomainUid () + "-cluster-" + this .clusterName )
309+ .append (":" )
310+ .append (port )
311+ .append ("/" );
312+ testAppUrl .append (path );
313+ // curl cmd to call webapp
314+ StringBuffer curlCmd =
315+ new StringBuffer (
316+ "kubectl exec " + this .getDomainUid () + "-" + this .adminServerName + " /usr/bin/curl " );
317+ curlCmd .append (testAppUrl .toString ());
318+
319+ // curl cmd to get response code
320+ StringBuffer curlCmdResCode = new StringBuffer (curlCmd .toString ());
321+ // -- means pass trailing args to command in exec, not exec itself
322+ curlCmdResCode .append (" -- --write-out %{http_code} -o /dev/null" );
323+
324+ logger .info ("Curl cmd with response code " + curlCmdResCode );
325+ logger .info ("Curl cmd " + curlCmd );
326+
327+ // call webapp iteratively till its deployed/ready
328+ callWebAppAndWaitTillReady (curlCmdResCode .toString ());
329+
330+ // execute curl and look for the managed server name in response
331+ callWebAppAndCheckForServerNameInResponse (curlCmd .toString (), true );
332+ logger .info ("curlCmd " + curlCmd );
300333 }
301334
302335 /**
@@ -435,8 +468,8 @@ public void callWebAppAndVerifyLoadBalancing(String webappName, boolean verifyLo
435468 StringBuffer curlCmdResCode = new StringBuffer (curlCmd .toString ());
436469 curlCmdResCode .append (" --write-out %{http_code} -o /dev/null" );
437470
438- logger .info ("Curd cmd with response code " + curlCmdResCode );
439- logger .info ("Curd cmd " + curlCmd );
471+ logger .info ("Curl cmd with response code " + curlCmdResCode );
472+ logger .info ("Curl cmd " + curlCmd );
440473
441474 // call webapp iteratively till its deployed/ready
442475 callWebAppAndWaitTillReady (curlCmdResCode .toString ());
0 commit comments