@@ -302,34 +302,50 @@ public void verifyHasClusterServiceChannelPort(String protocol, int port, String
302
302
+ protocol );
303
303
}
304
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
305
+ /*
306
+ * Construct a curl command that will be run via kubectl exec on the admin server
307
+ */
314
308
StringBuffer curlCmd =
315
309
new StringBuffer (
316
310
"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
311
324
- logger .info ("Curl cmd with response code " + curlCmdResCode );
325
- logger .info ("Curl cmd " + curlCmd );
312
+ /*
313
+ * Make sure we can reach the port,
314
+ * first via each managed server URL
315
+ */
316
+ for (int i = 1 ; i <= TestUtils .getClusterReplicas (domainUid , clusterName , domainNS ); i ++) {
317
+ StringBuffer serverAppUrl = new StringBuffer ("http://" );
318
+ serverAppUrl
319
+ .append (this .getDomainUid () + "-" + managedServerNameBase + i )
320
+ .append (":" )
321
+ .append (port )
322
+ .append ("/" );
323
+ serverAppUrl .append (path );
324
+
325
+ callWebAppAndWaitTillReady (
326
+ new StringBuffer (curlCmd .toString ())
327
+ .append (serverAppUrl .toString ())
328
+ .append (" -- --write-out %{http_code} -o /dev/null" )
329
+ .toString ());
330
+ }
326
331
327
- // call webapp iteratively till its deployed/ready
328
- callWebAppAndWaitTillReady (curlCmdResCode .toString ());
332
+ /*
333
+ * Make sure we can reach the port,
334
+ * second via cluster URL which should round robin through each managed server.
335
+ * Use the callWebAppAndCheckForServerNameInResponse method with verifyLoadBalancing
336
+ * enabled to verify each managed server is responding.
337
+ */
338
+ StringBuffer clusterAppUrl = new StringBuffer ("http://" );
339
+ clusterAppUrl
340
+ .append (this .getDomainUid () + "-cluster-" + this .clusterName )
341
+ .append (":" )
342
+ .append (port )
343
+ .append ("/" );
344
+ clusterAppUrl .append (path );
329
345
330
- // execute curl and look for the managed server name in response
331
- callWebAppAndCheckForServerNameInResponse (curlCmd . toString (), true );
332
- logger . info ( "curlCmd " + curlCmd );
346
+ // execute curl and look for each managed server name in response
347
+ callWebAppAndCheckForServerNameInResponse (
348
+ new StringBuffer ( curlCmd . toString ()). append ( clusterAppUrl . toString ()). toString (), true );
333
349
}
334
350
335
351
/**
0 commit comments