Skip to content

Commit d560038

Browse files
Resolution to intermittent issue on IstioCrossDomain MDB usecase (#2403)
* Modified the display message, parameter posistion Co-authored-by: [email protected] <[email protected]>
1 parent 0107bdd commit d560038

File tree

4 files changed

+64
-0
lines changed

4 files changed

+64
-0
lines changed

integration-tests/src/test/java/oracle/weblogic/kubernetes/ItCrossDomainTransaction.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@
5858
import static oracle.weblogic.kubernetes.actions.TestActions.getServiceNodePort;
5959
import static oracle.weblogic.kubernetes.assertions.TestAssertions.domainExists;
6060
import static oracle.weblogic.kubernetes.utils.BuildApplication.buildApplication;
61+
import static oracle.weblogic.kubernetes.utils.CommonTestUtils.checkAppIsActive;
6162
import static oracle.weblogic.kubernetes.utils.CommonTestUtils.checkPodExists;
6263
import static oracle.weblogic.kubernetes.utils.CommonTestUtils.checkPodReady;
6364
import static oracle.weblogic.kubernetes.utils.CommonTestUtils.checkServiceExists;
@@ -418,6 +419,14 @@ public void testCrossDomainTransactionWithFailInjection() {
418419
@DisplayName("Check cross domain transcated MDB communication ")
419420
public void testCrossDomainTranscatedMDB() {
420421

422+
// No extra header info
423+
assertTrue(checkAppIsActive(K8S_NODEPORT_HOST,domain1AdminServiceNodePort,
424+
"", "mdbtopic","cluster-1",
425+
ADMIN_USERNAME_DEFAULT,ADMIN_PASSWORD_DEFAULT),
426+
"MDB application can not be activated on domain1/cluster");
427+
428+
logger.info("MDB application is activated on domain1/cluster");
429+
421430
String curlRequest = String.format("curl -v --show-error --noproxy '*' "
422431
+ "\"http://%s:%s/jmsservlet/jmstest?"
423432
+ "url=t3://domain2-cluster-cluster-1.%s:8001&"

integration-tests/src/test/java/oracle/weblogic/kubernetes/ItIstioCrossDomainTransaction.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@
5959
import static oracle.weblogic.kubernetes.actions.TestActions.createDomainCustomResource;
6060
import static oracle.weblogic.kubernetes.assertions.TestAssertions.domainExists;
6161
import static oracle.weblogic.kubernetes.utils.BuildApplication.buildApplication;
62+
import static oracle.weblogic.kubernetes.utils.CommonTestUtils.checkAppIsActive;
6263
import static oracle.weblogic.kubernetes.utils.CommonTestUtils.checkAppUsingHostHeader;
6364
import static oracle.weblogic.kubernetes.utils.CommonTestUtils.checkPodReady;
6465
import static oracle.weblogic.kubernetes.utils.CommonTestUtils.checkServiceExists;
@@ -455,7 +456,13 @@ public void testIstioCrossDomainTransactionWithFailInjection() {
455456
@Test
456457
@DisplayName("Check cross domain transcated MDB communication with istio")
457458
public void testIstioCrossDomainTranscatedMDB() {
459+
assertTrue(checkAppIsActive(K8S_NODEPORT_HOST,istioIngressPort,
460+
"-H 'host: " + "domain1-" + domain1Namespace + ".org '",
461+
"mdbtopic","cluster-1",
462+
ADMIN_USERNAME_DEFAULT,ADMIN_PASSWORD_DEFAULT),
463+
"MDB application can not be activated on domain1/cluster");
458464

465+
logger.info("MDB application is activated on domain1/cluster");
459466
String curlRequest = String.format("curl -v --show-error --noproxy '*' "
460467
+ "-H 'host:domain1-" + domain1Namespace + ".org' "
461468
+ "\"http://%s:%s/jmsservlet/jmstest?"

integration-tests/src/test/java/oracle/weblogic/kubernetes/utils/CommonTestUtils.java

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3249,6 +3249,52 @@ public static void checkAppIsRunning(
32493249

32503250
}
32513251

3252+
/**
3253+
* Check if the the application is active for a given weblogic target.
3254+
* @param host hostname to construct the REST url
3255+
* @param port the port construct the REST url
3256+
* @param headers extra header info to pass to the REST url
3257+
* @param application name of the application
3258+
* @param target the weblogic target for the application
3259+
* @param username username to log into the system
3260+
* @param password password for the username
3261+
*/
3262+
public static boolean checkAppIsActive(
3263+
String host,
3264+
int port,
3265+
String headers,
3266+
String application,
3267+
String target,
3268+
String username,
3269+
String password
3270+
) {
3271+
3272+
LoggingFacade logger = getLogger();
3273+
String curlString = String.format("curl -v --show-error --noproxy '*' "
3274+
+ "--user " + username + ":" + password + " " + headers
3275+
+ " -H X-Requested-By:MyClient -H Accept:application/json "
3276+
+ "-H Content-Type:application/json "
3277+
+ " -d \"{ target: '" + target + "' }\" "
3278+
+ " -X POST "
3279+
+ "http://%s:%s/management/weblogic/latest/domainRuntime/deploymentManager/appDeploymentRuntimes/"
3280+
+ application + "/getState", host, port);
3281+
3282+
logger.info("curl command {0}", curlString);
3283+
withStandardRetryPolicy
3284+
.conditionEvaluationListener(
3285+
condition -> logger.info("Waiting for Application {0} to be active "
3286+
+ "(elapsed time {1} ms, remaining time {2} ms)",
3287+
application,
3288+
condition.getElapsedTimeInMS(),
3289+
condition.getRemainingTimeInMS()))
3290+
.until(assertDoesNotThrow(() -> {
3291+
return () -> {
3292+
return exec(new String(curlString), true).stdout().contains("STATE_ACTIVE");
3293+
};
3294+
}));
3295+
return true;
3296+
}
3297+
32523298
/** Create a persistent volume.
32533299
* @param pvName name of the persistent volume to create
32543300
* @param domainUid domain UID

integration-tests/src/test/resources/istio/istio-cdt-http-template-service.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ spec:
3636
prefix: /cdttxservlet
3737
- uri:
3838
prefix: /jmsservlet
39+
- uri:
40+
prefix: /management
3941
- port: 7001
4042
route:
4143
- destination:

0 commit comments

Comments
 (0)