diff --git a/tests/Tgstation.Server.Tests/Live/Instance/WatchdogTest.cs b/tests/Tgstation.Server.Tests/Live/Instance/WatchdogTest.cs index 4a453d4f51..3bf26e3f1d 100644 --- a/tests/Tgstation.Server.Tests/Live/Instance/WatchdogTest.cs +++ b/tests/Tgstation.Server.Tests/Live/Instance/WatchdogTest.cs @@ -729,28 +729,41 @@ namespace Tgstation.Server.Tests.Live.Instance var foundLivePath = false; var allPaths = new List(); - Assert.IsFalse(proc.HasExited); - foreach (var fd in Directory.GetFiles($"/proc/{pid}/fd")) + var features = new PosixProcessFeatures( + new Lazy(Mock.Of()), + Mock.Of(), + Mock.Of>()); + + features.SuspendProcess(proc); + try { - var sb = new StringBuilder(UInt16.MaxValue); - if (Syscall.readlink(fd, sb) == -1) - throw new UnixIOException(Stdlib.GetLastError()); + Assert.IsFalse(proc.HasExited); + foreach (var fd in Directory.GetFiles($"/proc/{pid}/fd")) + { + var sb = new StringBuilder(UInt16.MaxValue); + if (Syscall.readlink(fd, sb) == -1) + throw new UnixIOException(Stdlib.GetLastError()); - var path = sb.ToString(); + var path = sb.ToString(); - allPaths.Add($"Path: {path}"); - if (path.Contains($"Game/{previousStatus.DirectoryName}")) - failingLinks.Add($"Found fd {fd} resolving to previous absolute path game dir path: {path}"); + allPaths.Add($"Path: {path}"); + if (path.Contains($"Game/{previousStatus.DirectoryName}")) + failingLinks.Add($"Found fd {fd} resolving to previous absolute path game dir path: {path}"); - if (path.Contains($"Game/{currentStatus.ActiveCompileJob.DirectoryName}")) - failingLinks.Add($"Found fd {fd} resolving to current absolute path game dir path: {path}"); + if (path.Contains($"Game/{currentStatus.ActiveCompileJob.DirectoryName}")) + failingLinks.Add($"Found fd {fd} resolving to current absolute path game dir path: {path}"); - if (path.Contains($"Game/Live")) - foundLivePath = true; + if (path.Contains($"Game/Live")) + foundLivePath = true; + } + + if (!foundLivePath) + failingLinks.Add($"Failed to find a path containing the 'Live' directory!"); + } + finally + { + features.ResumeProcess(proc); } - - if (!foundLivePath) - failingLinks.Add($"Failed to find a path containing the 'Live' directory!"); Assert.IsTrue(failingLinks.Count == 0, String.Join(Environment.NewLine, failingLinks.Concat(allPaths))); }