mirror of
https://github.com/tgstation/tgstation-server.git
synced 2026-08-27 15:07:03 +01:00
Attempt to normalize the process priority class on Windows Live tests
Also assume Windows allows nicing.
This commit is contained in:
@@ -88,10 +88,12 @@ namespace Tgstation.Server.Tests.Live
|
||||
|
||||
// neither of these should really matter but it's better that we test them
|
||||
// high prio DD might help with some topic flakiness actually
|
||||
// github doesn't allow nicing though
|
||||
bool runningInGitHubActions = !String.IsNullOrWhiteSpace(Environment.GetEnvironmentVariable("GITHUB_RUN_ID"));
|
||||
HighPriorityDreamDaemon = !runningInGitHubActions;
|
||||
LowPriorityDeployments = !runningInGitHubActions;
|
||||
// github doesn't allow nicing on linux though
|
||||
var runningInGitHubActions = !String.IsNullOrWhiteSpace(Environment.GetEnvironmentVariable("GITHUB_RUN_ID"));
|
||||
var windows = new Host.System.PlatformIdentifier().IsWindows;
|
||||
var nicingAllowed = windows || !runningInGitHubActions;
|
||||
HighPriorityDreamDaemon = nicingAllowed;
|
||||
LowPriorityDeployments = nicingAllowed;
|
||||
|
||||
args = new List<string>()
|
||||
{
|
||||
|
||||
@@ -730,6 +730,17 @@ namespace Tgstation.Server.Tests.Live
|
||||
[TestMethod]
|
||||
public async Task TestStandardTgsOperation()
|
||||
{
|
||||
using(var currentProcess = System.Diagnostics.Process.GetCurrentProcess())
|
||||
{
|
||||
var currentPriorityClass = currentProcess.PriorityClass;
|
||||
if (currentPriorityClass != ProcessPriorityClass.Normal)
|
||||
{
|
||||
// attempt to adjust it
|
||||
Console.WriteLine($"TEST PROCESS PRIORITY: Attempting to normalize process priority from {currentPriorityClass}...");
|
||||
currentProcess.PriorityClass = ProcessPriorityClass.Normal;
|
||||
}
|
||||
}
|
||||
|
||||
const int MaximumTestMinutes = 30;
|
||||
using var hardCancellationTokenSource = new CancellationTokenSource(TimeSpan.FromMinutes(MaximumTestMinutes));
|
||||
var hardCancellationToken = hardCancellationTokenSource.Token;
|
||||
|
||||
Reference in New Issue
Block a user