SEBWIN-226: Increased timeout for client startup to 30 seconds (15 turned out to be too low for slower machines).
This commit is contained in:
parent
90fefae248
commit
0916dacb7f
5 changed files with 20 additions and 16 deletions
|
@ -65,7 +65,7 @@ namespace SafeExamBrowser.Runtime.UnitTests.Operations
|
|||
sessionContext.Next = session.Object;
|
||||
proxyFactory.Setup(f => f.CreateClientProxy(It.IsAny<string>())).Returns(proxy.Object);
|
||||
|
||||
sut = new ClientOperation(logger.Object, processFactory.Object, proxyFactory.Object, runtimeHost.Object, sessionContext, 0);
|
||||
sut = new ClientOperation(logger.Object, processFactory.Object, proxyFactory.Object, runtimeHost.Object, sessionContext, 0, 0);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
|
@ -112,7 +112,7 @@ namespace SafeExamBrowser.Runtime.UnitTests.Operations
|
|||
var terminateClient = new Action(() => Task.Delay(100).ContinueWith(_ => process.Raise(p => p.Terminated += null, 0)));
|
||||
|
||||
processFactory.Setup(f => f.StartNew(It.IsAny<string>(), It.IsAny<string[]>())).Returns(process.Object).Callback(terminateClient);
|
||||
sut = new ClientOperation(logger.Object, processFactory.Object, proxyFactory.Object, runtimeHost.Object, sessionContext, ONE_SECOND);
|
||||
sut = new ClientOperation(logger.Object, processFactory.Object, proxyFactory.Object, runtimeHost.Object, sessionContext, ONE_SECOND, ONE_SECOND);
|
||||
|
||||
before = DateTime.Now;
|
||||
result = sut.Perform();
|
||||
|
|
|
@ -62,7 +62,7 @@ namespace SafeExamBrowser.Runtime.UnitTests.Operations
|
|||
sessionContext.Next = session.Object;
|
||||
proxyFactory.Setup(f => f.CreateClientProxy(It.IsAny<string>())).Returns(proxy.Object);
|
||||
|
||||
sut = new ClientTerminationOperation(logger.Object, processFactory.Object, proxyFactory.Object, runtimeHost.Object, sessionContext, 0);
|
||||
sut = new ClientTerminationOperation(logger.Object, processFactory.Object, proxyFactory.Object, runtimeHost.Object, sessionContext, 0, 0);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
|
|
|
@ -50,6 +50,7 @@ namespace SafeExamBrowser.Runtime
|
|||
{
|
||||
const int FIVE_SECONDS = 5000;
|
||||
const int FIFTEEN_SECONDS = 15000;
|
||||
const int THIRTY_SECONDS = 30000;
|
||||
|
||||
var args = Environment.GetCommandLineArgs();
|
||||
var nativeMethods = new NativeMethods();
|
||||
|
@ -79,11 +80,11 @@ namespace SafeExamBrowser.Runtime
|
|||
|
||||
sessionOperations.Enqueue(new SessionInitializationOperation(configuration, logger, runtimeHost, sessionContext));
|
||||
sessionOperations.Enqueue(new ConfigurationOperation(args, configuration, new HashAlgorithm(), logger, sessionContext));
|
||||
sessionOperations.Enqueue(new ClientTerminationOperation(logger, processFactory, proxyFactory, runtimeHost, sessionContext, FIFTEEN_SECONDS));
|
||||
sessionOperations.Enqueue(new ClientTerminationOperation(logger, processFactory, proxyFactory, runtimeHost, sessionContext, THIRTY_SECONDS, FIFTEEN_SECONDS));
|
||||
sessionOperations.Enqueue(new KioskModeTerminationOperation(desktopFactory, explorerShell, logger, processFactory, sessionContext));
|
||||
sessionOperations.Enqueue(new ServiceOperation(logger, serviceProxy, sessionContext));
|
||||
sessionOperations.Enqueue(new KioskModeOperation(desktopFactory, explorerShell, logger, processFactory, sessionContext));
|
||||
sessionOperations.Enqueue(new ClientOperation(logger, processFactory, proxyFactory, runtimeHost, sessionContext, FIFTEEN_SECONDS));
|
||||
sessionOperations.Enqueue(new ClientOperation(logger, processFactory, proxyFactory, runtimeHost, sessionContext, THIRTY_SECONDS, FIFTEEN_SECONDS));
|
||||
sessionOperations.Enqueue(new SessionActivationOperation(logger, sessionContext));
|
||||
|
||||
var bootstrapSequence = new OperationSequence(logger, bootstrapOperations);
|
||||
|
|
|
@ -21,8 +21,8 @@ namespace SafeExamBrowser.Runtime.Operations
|
|||
{
|
||||
internal class ClientOperation : SessionOperation
|
||||
{
|
||||
private readonly int timeout_ms;
|
||||
|
||||
private readonly int startup_timeout_ms;
|
||||
private readonly int shutdown_timeout_ms;
|
||||
private ILogger logger;
|
||||
private IProcessFactory processFactory;
|
||||
private IProxyFactory proxyFactory;
|
||||
|
@ -49,13 +49,15 @@ namespace SafeExamBrowser.Runtime.Operations
|
|||
IProxyFactory proxyFactory,
|
||||
IRuntimeHost runtimeHost,
|
||||
SessionContext sessionContext,
|
||||
int timeout_ms) : base(sessionContext)
|
||||
int startup_timeout_ms,
|
||||
int shutdown_timeout_ms) : base(sessionContext)
|
||||
{
|
||||
this.logger = logger;
|
||||
this.processFactory = processFactory;
|
||||
this.proxyFactory = proxyFactory;
|
||||
this.runtimeHost = runtimeHost;
|
||||
this.timeout_ms = timeout_ms;
|
||||
this.startup_timeout_ms = startup_timeout_ms;
|
||||
this.shutdown_timeout_ms = shutdown_timeout_ms;
|
||||
}
|
||||
|
||||
public override OperationResult Perform()
|
||||
|
@ -117,7 +119,7 @@ namespace SafeExamBrowser.Runtime.Operations
|
|||
ClientProcess.Terminated += clientTerminatedEventHandler;
|
||||
|
||||
logger.Info("Waiting for client to complete initialization...");
|
||||
clientReady = clientReadyEvent.WaitOne(timeout_ms);
|
||||
clientReady = clientReadyEvent.WaitOne(startup_timeout_ms);
|
||||
|
||||
runtimeHost.AllowConnection = false;
|
||||
runtimeHost.ClientReady -= clientReadyEventHandler;
|
||||
|
@ -130,7 +132,7 @@ namespace SafeExamBrowser.Runtime.Operations
|
|||
|
||||
if (!clientReady)
|
||||
{
|
||||
logger.Error($"Failed to start client within {timeout_ms / 1000} seconds!");
|
||||
logger.Error($"Failed to start client within {startup_timeout_ms / 1000} seconds!");
|
||||
}
|
||||
|
||||
if (clientTerminated)
|
||||
|
@ -198,19 +200,19 @@ namespace SafeExamBrowser.Runtime.Operations
|
|||
ClientProxy.Disconnect();
|
||||
|
||||
logger.Info("Waiting for client to disconnect from runtime communication host...");
|
||||
disconnected = disconnectedEvent.WaitOne(timeout_ms);
|
||||
disconnected = disconnectedEvent.WaitOne(shutdown_timeout_ms);
|
||||
|
||||
if (!disconnected)
|
||||
{
|
||||
logger.Error($"Client failed to disconnect within {timeout_ms / 1000} seconds!");
|
||||
logger.Error($"Client failed to disconnect within {shutdown_timeout_ms / 1000} seconds!");
|
||||
}
|
||||
|
||||
logger.Info("Waiting for client process to terminate...");
|
||||
terminated = terminatedEvent.WaitOne(timeout_ms);
|
||||
terminated = terminatedEvent.WaitOne(shutdown_timeout_ms);
|
||||
|
||||
if (!terminated)
|
||||
{
|
||||
logger.Error($"Client failed to terminate within {timeout_ms / 1000} seconds!");
|
||||
logger.Error($"Client failed to terminate within {shutdown_timeout_ms / 1000} seconds!");
|
||||
}
|
||||
|
||||
runtimeHost.ClientDisconnected -= disconnectedEventHandler;
|
||||
|
|
|
@ -22,7 +22,8 @@ namespace SafeExamBrowser.Runtime.Operations
|
|||
IProxyFactory proxyFactory,
|
||||
IRuntimeHost runtimeHost,
|
||||
SessionContext sessionContext,
|
||||
int timeout_ms) : base(logger, processFactory, proxyFactory, runtimeHost, sessionContext, timeout_ms)
|
||||
int startup_timeout_ms,
|
||||
int shutdown_timeout_ms) : base(logger, processFactory, proxyFactory, runtimeHost, sessionContext, startup_timeout_ms, shutdown_timeout_ms)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue