Skip to content
This repository was archived by the owner on Aug 19, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions src/main/java/com/rmn/qa/AutomationRunContext.java
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,11 @@ public void cleanUpRunRequests(ProxySet proxySet) {
*/
private boolean isRunOld(AutomationRunRequest runRequest) {
// Get the amount of seconds passed
return System.currentTimeMillis() > runRequest.getCreatedDate().getTime() + (AutomationRunContext.CLEANUP_LIFE_LENGTH_IN_SECONDS * 1000);
if(AutomationUtils.lowerCaseMatch("internetexplorer",runRequest.getBrowser())) {
return System.currentTimeMillis() > runRequest.getCreatedDate().getTime() + (10 * 60 * 1000); // 10 minutes for IE to come online
} else {
return System.currentTimeMillis() > runRequest.getCreatedDate().getTime() + (AutomationRunContext.CLEANUP_LIFE_LENGTH_IN_SECONDS * 1000);
}
}

/**
Expand Down Expand Up @@ -288,7 +292,7 @@ public int getTotalThreadsAvailable(ProxySet proxySet) {
}
}
}
// Now process all registered runs to make sure there werent any requests that just haven't had any started nodes
// Now process all registered runs to make sure there weren't any requests that just haven't had any started nodes
for(String uuid : runsToSessions.keySet()) {
AutomationRunRequest registeredRun = getRunRequest(uuid);
// If a the registered run exists AND is still new, we should count the original request amount as all tests may not be in flight yet
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ private void startNodes(String uuid,int threadCountRequested, String browser, St
* @return
*/
private boolean browserSupportedByAmis(String browser) {
return AutomationUtils.lowerCaseMatch("chrome",browser) || AutomationUtils.lowerCaseMatch("firefox",browser) || AutomationUtils.lowerCaseMatch("internetexplorer",browser);
return AutomationUtils.lowerCaseMatch(BrowserType.CHROME,browser) || AutomationUtils.lowerCaseMatch(BrowserType.FIREFOX,browser) || AutomationUtils.lowerCaseMatch("internetexplorer",browser);
}

@Override
Expand Down
5 changes: 3 additions & 2 deletions src/main/java/com/rmn/qa/servlet/StatusServlet.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import org.openqa.grid.selenium.proxy.DefaultRemoteProxy;
import org.openqa.grid.web.servlet.RegistryBasedServlet;
import org.openqa.grid.web.utils.BrowserNameUtils;
import org.openqa.selenium.remote.BrowserType;
import org.openqa.selenium.remote.CapabilityType;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.slf4j.Logger;
Expand Down Expand Up @@ -105,8 +106,8 @@ protected void doGet(HttpServletRequest request, HttpServletResponse response) t
builder.append("<H1>Grid Hub ");
builder.append(coreVersion).append(coreRevision);
builder.append("</H1>");
int chromeThreads = requestMatcher.getNumFreeThreadsForParameters(getRegistry().getAllProxies(),new AutomationRunRequest(StatusServlet.class.getSimpleName(),null,"chrome"));
int firefoxThreads = requestMatcher.getNumFreeThreadsForParameters(getRegistry().getAllProxies(),new AutomationRunRequest(StatusServlet.class.getSimpleName(),null,"firefox"));
int chromeThreads = requestMatcher.getNumFreeThreadsForParameters(getRegistry().getAllProxies(),new AutomationRunRequest(StatusServlet.class.getSimpleName(),null, BrowserType.CHROME));
int firefoxThreads = requestMatcher.getNumFreeThreadsForParameters(getRegistry().getAllProxies(),new AutomationRunRequest(StatusServlet.class.getSimpleName(),null,BrowserType.FIREFOX));
int ieThreads = requestMatcher.getNumFreeThreadsForParameters(getRegistry().getAllProxies(),new AutomationRunRequest(StatusServlet.class.getSimpleName(),null,"internetexplorer"));
builder.append("<H2>Free Threads - Chrome: ").append(chromeThreads).append(" Firefox: ").append(firefoxThreads).append(" IE: ").append(ieThreads).append("</H2>");

Expand Down
1 change: 1 addition & 0 deletions src/main/resources/aws.properties.default
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ node_instance_type_chrome=c3.large
# Firefox and IE will only run in 1 browser per VM so we'll use micros for them
node_instance_type_firefox=t2.micro
node_instance_type_internetexplorer=t2.micro
east_windows_node_ami=ami-dcd869b4


# Security Group Info
Expand Down
32 changes: 31 additions & 1 deletion src/test/java/com/rmn/qa/AutomationRunContextTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public void cleanUp() {
@Test
// Tests that an old run gets cleaned up (removed)
public void testOldRun() {
AutomationRunRequest oldRequest = new AutomationRunRequest("uuid",10,"firefox","10","linux",AutomationUtils.modifyDate(new Date(),-1, Calendar.HOUR));
AutomationRunRequest oldRequest = new AutomationRunRequest("uuid",10,"firefox","10","linux",AutomationUtils.modifyDate(new Date(),-5, Calendar.MINUTE));
AutomationRunContext context = AutomationContext.getContext();
context.addRun(oldRequest);

Expand All @@ -68,6 +68,36 @@ public void testNewRun() {
Assert.assertTrue("Run request should still exist as the run was new enough", context.hasRun(oldRequest.getUuid()));
}

@Test
// Tests that a new run does not get cleaned up (removed)
public void testNewRunIE() {
AutomationRunRequest oldRequest = new AutomationRunRequest("uuid",10,"internetexplorer","10","linux",AutomationUtils.modifyDate(new Date(),-7, Calendar.MINUTE));
AutomationRunContext context = AutomationContext.getContext();
context.addRun(oldRequest);


Assert.assertTrue("Run should exist", context.hasRun(oldRequest.getUuid()));
ProxySet proxySet = new ProxySet(false);
proxySet.add(new MockRemoteProxy());
context.cleanUpRunRequests(proxySet);
Assert.assertTrue("Run request should still exist as the run was new enough", context.hasRun(oldRequest.getUuid()));
}

@Test
// Tests that a new run does not get cleaned up (removed)
public void testOldRunIE() {
AutomationRunRequest oldRequest = new AutomationRunRequest("uuid",10,"internetexplorer","10","linux",AutomationUtils.modifyDate(new Date(),-15, Calendar.MINUTE));
AutomationRunContext context = AutomationContext.getContext();
context.addRun(oldRequest);


Assert.assertTrue("Run should exist", context.hasRun(oldRequest.getUuid()));
ProxySet proxySet = new ProxySet(false);
proxySet.add(new MockRemoteProxy());
context.cleanUpRunRequests(proxySet);
Assert.assertFalse("Run request should no longer exist as it should have been removed", context.hasRun(oldRequest.getUuid()));
}

@Test
// Tests that a run with slots does not get removed
public void testActiveSession() {
Expand Down