/// <summary> /// Base constructor /// </summary> public UnrealTestConfiguration() { MaxDuration = 600; // 10m // create the role structure RequiredRoles = new Dictionary <UnrealTargetRole, List <UnrealTestRole> >(); HeartbeatOptions = new UnrealHeartbeatOptions(); }
private void CheckHeartbeat() { if (CachedConfig == null || CachedConfig.DisableHeartbeatTimeout || CachedConfig.HeartbeatOptions.bExpectHeartbeats == false || GetTestStatus() != TestStatus.InProgress) { return; } UnrealHeartbeatOptions HeartbeatOptions = CachedConfig.HeartbeatOptions; // First active heartbeat has not happened yet and timeout before first active heartbeat is enabled if (LastActiveHeartbeatTime == DateTime.MinValue && HeartbeatOptions.TimeoutBeforeFirstActiveHeartbeat > 0) { double SecondsSinceSessionStart = DateTime.Now.Subtract(SessionStartTime).TotalSeconds; if (SecondsSinceSessionStart > HeartbeatOptions.TimeoutBeforeFirstActiveHeartbeat) { Log.Error("{0} seconds have passed without detecting the first active Gauntlet heartbeat.", HeartbeatOptions.TimeoutBeforeFirstActiveHeartbeat); MarkTestComplete(); SetUnrealTestResult(TestResult.TimedOut); } } // First active heartbeat has happened and timeout between active heartbeats is enabled if (LastActiveHeartbeatTime != DateTime.MinValue && HeartbeatOptions.TimeoutBetweenActiveHeartbeats > 0) { double SecondsSinceLastActiveHeartbeat = DateTime.Now.Subtract(LastActiveHeartbeatTime).TotalSeconds; if (SecondsSinceLastActiveHeartbeat > HeartbeatOptions.TimeoutBetweenActiveHeartbeats) { Log.Error("{0} seconds have passed without detecting any active Gauntlet heartbeats.", HeartbeatOptions.TimeoutBetweenActiveHeartbeats); MarkTestComplete(); SetUnrealTestResult(TestResult.TimedOut); } } // First heartbeat has happened and timeout between heartbeats is enabled if (LastHeartbeatTime != DateTime.MinValue && HeartbeatOptions.TimeoutBetweenAnyHeartbeats > 0) { double SecondsSinceLastHeartbeat = DateTime.Now.Subtract(LastHeartbeatTime).TotalSeconds; if (SecondsSinceLastHeartbeat > HeartbeatOptions.TimeoutBetweenAnyHeartbeats) { Log.Error("{0} seconds have passed without detecting any Gauntlet heartbeats.", HeartbeatOptions.TimeoutBetweenAnyHeartbeats); MarkTestComplete(); SetUnrealTestResult(TestResult.TimedOut); } } }