IISIntegration 738 B

123456789101112131415161718192021222324252627282930313233343536
  1. commit c62c7f6a61905e789486909e3d942b45542b202e
  2. Author: Justin Kotalik <[email protected]>
  3. Date: Tue Aug 28 14:26:07 2018 -0700
  4. Check event logs until process start time (#1338)
  5. diff --git a/test/Common.FunctionalTests/Utilities/EventLogHelpers.cs b/test/Common.FunctionalTests/Utilities/EventLogHelpers.cs
  6. index c85a78bdd33..6d2393f1879 100644
  7. --- a/test/Common.FunctionalTests/Utilities/EventLogHelpers.cs
  8. +++ b/test/Common.FunctionalTests/Utilities/EventLogHelpers.cs
  9. @@ -46,15 +46,22 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
  10. var eventLog = new EventLog("Application");
  11. - // Perf: only get the last 20 events from the event log.
  12. // Eventlog is already sorted based on time of event in ascending time.
  13. - // Add results in reverse order.
  14. + // Check results in reverse order.
  15. var expectedRegexEventLog = new Regex(expectedRegexMatchString);
  16. var processIdString = $"Process Id: {deploymentResult.HostProcess.Id}.";
  17. - for (var i = eventLog.Entries.Count - 1; i >= eventLog.Entries.Count - 20; i--)
  18. + // Event log messages round down to the nearest second, so subtract a second
  19. + var processStartTime = deploymentResult.HostProcess.StartTime.AddSeconds(-1);
  20. + for (var i = eventLog.Entries.Count - 1; i >= 0; i--)
  21. {
  22. var eventLogEntry = eventLog.Entries[i];
  23. + if (eventLogEntry.TimeGenerated < processStartTime)
  24. + {
  25. + // If event logs is older than the process start time, we didn't find a match.
  26. + break;
  27. + }
  28. +
  29. if (eventLogEntry.ReplacementStrings == null ||
  30. eventLogEntry.ReplacementStrings.Length < 3)
  31. {