Skip to content

Commit 2e4ba8f

Browse files
authored
Merge pull request #17752 from c00crane/284852_cl_waitForSSL
Add wait for SSL restart during reconfigs - in ported CL FATs
2 parents 48a038a + 461965a commit 2e4ba8f

File tree

4 files changed

+42
-16
lines changed

4 files changed

+42
-16
lines changed

dev/com.ibm.ws.security.fat.common/src/com/ibm/ws/security/fat/common/CommonTest.java

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ public class CommonTest {
2828

2929
private final static Class<?> thisClass = CommonTest.class;
3030
public static String _testName = "";
31-
protected static int timeoutCounter = 0;
3231
protected static int allowableTimeoutCount = 0;
3332
public static CommonMessageTools msgUtils = new CommonMessageTools();
3433
protected WebClientTracker webClientTracker = new WebClientTracker();
@@ -108,6 +107,7 @@ public static void addToAllowableTimeoutCount(int additionalCount) {
108107
public static void timeoutChecker() throws Exception {
109108
String method = "timeoutChecker";
110109

110+
int timeoutCounter = 0 ;
111111
boolean timeoutFound = false;
112112
String outputFile = "./results/output.txt";
113113
File f = new File(outputFile);
@@ -131,10 +131,6 @@ public static void timeoutChecker() throws Exception {
131131
}
132132
}
133133
}
134-
if (theLine.contains("TestClass END")) {
135-
Log.info(thisClass, method, "Found an end of test class marker in log");
136-
timeoutFound = false;
137-
}
138134
}
139135
} catch (IOException e) {
140136
e.printStackTrace();

dev/com.ibm.ws.security.fat.common/src/com/ibm/ws/security/fat/common/TestServer.java

Lines changed: 33 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* http://www.eclipse.org/legal/epl-v10.html
77
*
88
* Contributors:
9-
* IBM Corporation - initial API and implementation
9+
* IBM Corporation - initial API and implementation
1010
*******************************************************************************/
1111
package com.ibm.ws.security.fat.common;
1212

@@ -69,6 +69,7 @@ public class TestServer extends ExternalResource {
6969
protected String callbackFeature;
7070
protected int retryTimeoutCount = 0;
7171
protected int overrideRestartWaitTime = 0;
72+
protected int sslWaitTimeoutCount = 0;
7273

7374
protected CommonMessageTools msgUtils = new CommonMessageTools();
7475
protected ServerBootstrapUtils bootstrapUtils = new ServerBootstrapUtils();
@@ -712,6 +713,8 @@ public void stopServer() throws Exception {
712713
addIgnoredServerException(MessageConstants.CWWKO0221E_PORT_IN_USE);
713714
// ignore shutdown timing issues
714715
addIgnoredServerExceptions(MessageConstants.CWWKO0227E_EXECUTOR_SERVICE_MISSING);
716+
// ignore ssl restart warnings - if they caused problems, tests would also be failing
717+
addIgnoredServerExceptions(MessageConstants.SSL_NOT_RESTARTED_PROPERLY);
715718
server.stopServer(ignoredServerExceptions);
716719
}
717720
unInstallCallbackHandler(callback, callbackFeature);
@@ -826,6 +829,7 @@ private void waitForSuccessfulUpdateAndStartMessages(boolean reportViaJunit, Lis
826829
assertNotNull("Did not encounter the CWWKG0017I message saying the server configuration was successfully updated.", updateMsg);
827830

828831
waitForAppsToReboot();
832+
waitForSSLRestart();
829833
validateStartMessages(startMessages, reportViaJunit);
830834
}
831835

@@ -864,6 +868,33 @@ private boolean waitForAppToBeReady(String app) {
864868
return true;
865869
}
866870

871+
private void waitForSSLRestart() throws Exception {
872+
873+
String thisMethod = "waitForSSLRestart";
874+
Log.info(thisClass, thisMethod, "Checking for SSL restart for server: " + server.getServerName());
875+
876+
// look for the "CWWKO0220I: TCP Channel defaultHttpEndpoint-ssl has stopped listening for requests on host " message
877+
// if we find it, then wait for "CWWKO0219I: TCP Channel defaultHttpEndpoint-ssl has been started and is now listening for requests on host"
878+
String sslStopMsg = server.waitForStringInLogUsingMark("CWWKO0220I:.*defaultHttpEndpoint-ssl.*", 500);
879+
if (sslStopMsg != null) {
880+
String sslStartMsg = server.waitForStringInLogUsingMark("CWWKO0219I:.*defaultHttpEndpoint-ssl.*");
881+
if (sslStartMsg == null) {
882+
Log.warning(thisClass, "SSL may not have started properly - future failures may be due to this");
883+
sslWaitTimeoutCount += 1;
884+
} else {
885+
Log.info(thisClass, thisMethod, "SSL appears have restarted properly");
886+
}
887+
} else {
888+
Log.info(thisClass, thisMethod, "Did not detect a restart of the SSL port");
889+
sslWaitTimeoutCount += 1;
890+
}
891+
892+
}
893+
894+
public int getSslWaitTimeoutCount() {
895+
return sslWaitTimeoutCount;
896+
}
897+
867898
/**
868899
* Searches for a message string in the specified server log
869900
*
@@ -1300,7 +1331,7 @@ public String getBootstrapProperty(String key) throws Exception {
13001331
Properties serverProperties = this.getServer().getBootstrapProperties();
13011332
return serverProperties.getProperty(key, null);
13021333
}
1303-
1334+
13041335
public String getJvmOptionsFilePath() throws Exception {
13051336
String thisMethod = "getJvmOptionsFilePath";
13061337
String jvmProps = getServerFileLoc() + "/jvm.options";

dev/com.ibm.ws.security.oauth.oidc_fat.common/src/com/ibm/ws/security/oauth_oidc/fat/commonTest/CommonTest.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1749,6 +1749,7 @@ public static void tearDown() throws Exception {
17491749
try {
17501750
// update the allowedTimeout count to account for msgs issued during start retries
17511751
addToAllowableTimeoutCount(server.getRetryTimeoutCount());
1752+
addToAllowableTimeoutCount(server.getSslWaitTimeoutCount());
17521753
tearDownServer(server);
17531754
newServerRefList.add(server);
17541755
} catch (Exception e) {

dev/com.ibm.ws.security.saml.sso_fat.common/src/com/ibm/ws/security/saml20/fat/commonTest/SAMLCommonTest.java

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ public Boolean callSpecificCheck() {
114114
protected static List<CommonLocalLDAPServerSuite> ldapRefList = new ArrayList<CommonLocalLDAPServerSuite>();
115115
protected static boolean cipherMayExceed128 = false;
116116
public static boolean usingExternalLDAPServer = false;
117-
//issue 17687
117+
//issue 17687
118118
public static String callbackHandlerWss4j = SAMLConstants.EXAMPLE_CALLBACK_WSS4J;
119119
public static String featureWss4j = SAMLConstants.EXAMPLE_CALLBACK_FEATURE_WSS4J;
120120

@@ -157,7 +157,6 @@ public static void initCommonVars() {
157157
testSettings = null;
158158
samlConfigSettings = new SAMLConfigSettings();
159159
helpers = null;
160-
timeoutCounter = 0;
161160
//allowableTimeoutCount = 0;
162161
flowType = null;
163162
copyMetaData = true;
@@ -205,7 +204,7 @@ public static SAMLTestServer commonSetUp(String requestedServer,
205204

206205
}
207206

208-
//issue 17687
207+
//issue 17687
209208
public static SAMLTestServer commonSetUp(String requestedServer,
210209
String serverXML, String testType, String serverType,
211210
List<String> addtlApps, List<String> addtlMessages, Boolean checkForSecuityStart, String callbackHandler,
@@ -221,14 +220,13 @@ public static SAMLTestServer commonSetUp(String requestedServer,
221220
return commonSetUp(requestedServer, serverXML, testType, serverType, addtlApps, addtlMessages, checkForSecuityStart, cbHandlers);
222221

223222
} //End issue 17687
224-
225-
223+
226224
//issue 17687
227225
public static SAMLTestServer commonSetUp(String requestedServer,
228226
String serverXML, String testType, String serverType,
229227
List<String> addtlApps, List<String> addtlMessages, Boolean checkForSecuityStart, Map<String, String> cbHandlers) throws Exception {
230-
//End issue 17687
231-
228+
//End issue 17687
229+
232230
String thisMethod = "commonSetUp";
233231
msgUtils.printMethodName(thisMethod);
234232

@@ -246,7 +244,6 @@ public static SAMLTestServer commonSetUp(String requestedServer,
246244
}
247245
}
248246

249-
timeoutCounter = 0;
250247
// allowableTimeoutCount = 0;
251248
// Integer defaultPort = null;
252249
String httpString = null;
@@ -269,7 +266,7 @@ public static SAMLTestServer commonSetUp(String requestedServer,
269266
} else {
270267
aTestServer = new SAMLTestServer(requestedServer, usableServerXml, serverType, cbHandlers);
271268
} //End issue 17687
272-
269+
273270
aTestServer.removeServerConfigFiles();
274271
aTestServer.setServerNameAndHostIp();
275272

@@ -952,6 +949,7 @@ public static void tearDown() throws Exception {
952949
try {
953950
for (SAMLTestServer server : serverRefList) {
954951
addToAllowableTimeoutCount(server.getRetryTimeoutCount());
952+
addToAllowableTimeoutCount(server.getSslWaitTimeoutCount());
955953
}
956954
timeoutChecker();
957955
} catch (Exception e) {

0 commit comments

Comments
 (0)