This bit here might be screwing us

This commit is contained in:
Jordan Dominion
2025-07-29 19:19:22 -04:00
parent 384cdf27ce
commit c2b38c05ab
@@ -556,59 +556,57 @@ namespace Tgstation.Server.Tests.Live.Instance
File.Delete(dumpFiles.Single());
// fuck this test, it's flakey as a motherfucker
if (Environment.NewLine != null)
if (Environment.NewLine == null)
{
return;
}
// failed dump
JobResponse job;
while (true)
{
KillDD(true);
var jobTcs = new TaskCompletionSource();
var killTaskStarted = new TaskCompletionSource();
var killThread = new Thread(() =>
{
killTaskStarted.SetResult();
while (!jobTcs.Task.IsCompleted)
KillDD(false);
})
{
Priority = ThreadPriority.AboveNormal
};
// failed dump
JobResponse job;
while (true)
{
KillDD(true);
var jobTcs = new TaskCompletionSource();
var killTaskStarted = new TaskCompletionSource();
var killThread = new Thread(() =>
{
killTaskStarted.SetResult();
while (!jobTcs.Task.IsCompleted)
KillDD(false);
})
{
Priority = ThreadPriority.AboveNormal
};
killThread.Start();
try
{
await killTaskStarted.Task;
var dumpTask = instanceClient.DreamDaemon.CreateDump(cancellationToken);
job = await WaitForJob(await dumpTask, 20, true, null, cancellationToken);
}
finally
{
jobTcs.SetResult();
killThread.Join();
}
killThread.Start();
try
{
await killTaskStarted.Task;
var dumpTask = instanceClient.DreamDaemon.CreateDump(cancellationToken);
job = await WaitForJob(await dumpTask, 20, true, null, cancellationToken);
}
finally
{
jobTcs.SetResult();
killThread.Join();
// these can also happen
if (!(new PlatformIdentifier().IsWindows
&& (job.ExceptionDetails.Contains("Access is denied.")
|| job.ExceptionDetails.Contains("The handle is invalid.")
|| job.ExceptionDetails.Contains("Unknown error")
|| job.ExceptionDetails.Contains("No process is associated with this object.")
|| job.ExceptionDetails.Contains("The program issued a command but the command length is incorrect.")
|| job.ExceptionDetails.Contains("Only part of a ReadProcessMemory or WriteProcessMemory request was completed.")
|| job.ExceptionDetails.Contains("Unknown error"))))
break;
var restartJob = await instanceClient.DreamDaemon.Restart(cancellationToken);
await WaitForJob(restartJob, 20, false, null, cancellationToken);
}
// these can also happen
if (!(new PlatformIdentifier().IsWindows
&& (job.ExceptionDetails.Contains("Access is denied.")
|| job.ExceptionDetails.Contains("The handle is invalid.")
|| job.ExceptionDetails.Contains("Unknown error")
|| job.ExceptionDetails.Contains("No process is associated with this object.")
|| job.ExceptionDetails.Contains("The program issued a command but the command length is incorrect.")
|| job.ExceptionDetails.Contains("Only part of a ReadProcessMemory or WriteProcessMemory request was completed.")
|| job.ExceptionDetails.Contains("Unknown error"))))
break;
var restartJob = await instanceClient.DreamDaemon.Restart(cancellationToken);
await WaitForJob(restartJob, 20, false, null, cancellationToken);
Assert.IsTrue(job.ErrorCode == ErrorCode.GameServerOffline || job.ErrorCode == ErrorCode.GCoreFailure, $"{job.ErrorCode}: {job.ExceptionDetails}");
}
Assert.IsTrue(job.ErrorCode == ErrorCode.GameServerOffline || job.ErrorCode == ErrorCode.GCoreFailure, $"{job.ErrorCode}: {job.ExceptionDetails}");
var restartJob2 = await instanceClient.DreamDaemon.Restart(cancellationToken);
await WaitForJob(restartJob2, 20, false, null, cancellationToken);
}