Skip to content

Commit 93a7b5b

Browse files
authored
Fix intermittent http call failure in ItConfigDistributionStrategy (#3095)
* Fix intermittent http call failure in ItConfigDistributionStrategy
1 parent c7da64e commit 93a7b5b

File tree

1 file changed

+41
-13
lines changed

1 file changed

+41
-13
lines changed

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

Lines changed: 41 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -766,24 +766,52 @@ private void verifyResourceJDBC1Override(boolean configUpdated) {
766766
//verify datasource attributes of JdbcTestDataSource-0
767767
String appURI = "resTest=true&resName=" + dsName1;
768768
String dsOverrideTestUrl = baseUri + appURI;
769-
HttpResponse<String> response = assertDoesNotThrow(() -> OracleHttpClient.get(dsOverrideTestUrl, true));
770-
771-
assertEquals(200, response.statusCode(), "Status code not equals to 200");
772-
if (configUpdated) {
773-
assertTrue(response.body().contains("getMaxCapacity:10"), "Did get getMaxCapacity:10");
774-
assertTrue(response.body().contains("getInitialCapacity:4"), "Did get getInitialCapacity:4");
775-
assertTrue(response.body().contains("Url:" + dsUrl2), "Didn't get Url:" + dsUrl2);
776-
} else {
777-
assertTrue(response.body().contains("getMaxCapacity:15"), "Did get getMaxCapacity:15");
778-
assertTrue(response.body().contains("getInitialCapacity:1"), "Did get getInitialCapacity:1");
779-
assertTrue(response.body().contains("Url:" + dsUrl1), "Didn't get Url:" + dsUrl1);
780-
}
769+
770+
testUntil(
771+
() -> {
772+
HttpResponse<String> response = assertDoesNotThrow(() -> OracleHttpClient.get(dsOverrideTestUrl, true));
773+
if (response.statusCode() != 200) {
774+
logger.info("Response code is not 200 retrying...");
775+
return false;
776+
}
777+
if (configUpdated) {
778+
if (!(response.body().contains("getMaxCapacity:10"))) {
779+
logger.info("Did get getMaxCapacity:10");
780+
return false;
781+
}
782+
if (!(response.body().contains("getInitialCapacity:4"))) {
783+
logger.info("Did get getInitialCapacity:4");
784+
return false;
785+
}
786+
if (!(response.body().contains("Url:" + dsUrl2))) {
787+
logger.info("Didn't get Url:" + dsUrl2);
788+
return false;
789+
}
790+
} else {
791+
if (!(response.body().contains("getMaxCapacity:15"))) {
792+
logger.info("Did get getMaxCapacity:15");
793+
return false;
794+
}
795+
if (!(response.body().contains("getInitialCapacity:1"))) {
796+
logger.info("Did get getInitialCapacity:1");
797+
return false;
798+
}
799+
if (!(response.body().contains("Url:" + dsUrl1))) {
800+
logger.info("Didn't get Url:" + dsUrl1);
801+
return false;
802+
}
803+
}
804+
return true;
805+
},
806+
logger,
807+
"clusterview app in admin server is accessible after restart");
808+
781809

782810
//test connection pool in all managed servers of dynamic cluster
783811
for (int i = 1; i <= replicaCount; i++) {
784812
appURI = "dsTest=true&dsName=" + dsName1 + "&" + "serverName=" + managedServerNameBase + i;
785813
String dsConnectionPoolTestUrl = baseUri + appURI;
786-
response = assertDoesNotThrow(() -> OracleHttpClient.get(dsConnectionPoolTestUrl, true));
814+
HttpResponse<String> response = assertDoesNotThrow(() -> OracleHttpClient.get(dsConnectionPoolTestUrl, true));
787815
assertEquals(200, response.statusCode(), "Status code not equals to 200");
788816
assertTrue(response.body().contains("Connection successful"), "Didn't get Connection successful");
789817
}

0 commit comments

Comments
 (0)