Skip to content

Commit f754fe8

Browse files
committed
Testing reachability of cluster channel port via test webapp
1 parent 494d8b2 commit f754fe8

File tree

1 file changed

+38
-22
lines changed
  • integration-tests/src/test/java/oracle/kubernetes/operator/utils

1 file changed

+38
-22
lines changed

integration-tests/src/test/java/oracle/kubernetes/operator/utils/Domain.java

Lines changed: 38 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -302,34 +302,50 @@ public void verifyHasClusterServiceChannelPort(String protocol, int port, String
302302
+ protocol);
303303
}
304304

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+
*/
314308
StringBuffer curlCmd =
315309
new StringBuffer(
316310
"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");
323311

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+
}
326331

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);
329345

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);
333349
}
334350

335351
/**

0 commit comments

Comments
 (0)