mirror of
https://github.com/tgstation/tgstation-server.git
synced 2026-08-23 04:57:17 +01:00
Extend test timeout specifically for GitHub actions
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
using System;
|
||||
|
||||
namespace Tgstation.Server.Tests.Live
|
||||
{
|
||||
static class LiveTestUtils
|
||||
{
|
||||
public static bool RunningInGitHubActions { get; } = !String.IsNullOrWhiteSpace(Environment.GetEnvironmentVariable("GITHUB_RUN_ID"));
|
||||
}
|
||||
}
|
||||
@@ -89,9 +89,8 @@ 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 on linux though
|
||||
var runningInGitHubActions = !String.IsNullOrWhiteSpace(Environment.GetEnvironmentVariable("GITHUB_RUN_ID"));
|
||||
var windows = new Host.System.PlatformIdentifier().IsWindows;
|
||||
var nicingAllowed = windows || !runningInGitHubActions;
|
||||
var nicingAllowed = windows || !LiveTestUtils.RunningInGitHubActions;
|
||||
HighPriorityDreamDaemon = nicingAllowed;
|
||||
LowPriorityDeployments = nicingAllowed;
|
||||
|
||||
|
||||
@@ -3,6 +3,8 @@ using System.Net.Http;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
|
||||
using Tgstation.Server.Api;
|
||||
using Tgstation.Server.Client;
|
||||
using Tgstation.Server.Common;
|
||||
@@ -29,6 +31,8 @@ namespace Tgstation.Server.Tests.Live
|
||||
var now = DateTimeOffset.UtcNow;
|
||||
|
||||
Console.WriteLine($"TEST ERROR RATE LIMITED: {ex}");
|
||||
if (!LiveTestUtils.RunningInGitHubActions)
|
||||
Assert.Inconclusive("Rate limited by GitHub!");
|
||||
|
||||
var sleepTime = ex.RetryAfter.Value - now;
|
||||
Console.WriteLine($"Sleeping for {sleepTime.TotalMinutes} minutes and retrying...");
|
||||
|
||||
@@ -746,8 +746,8 @@ namespace Tgstation.Server.Tests.Live
|
||||
Assert.AreEqual(ProcessPriorityClass.Normal, currentProcess.PriorityClass);
|
||||
}
|
||||
|
||||
const int MaximumTestMinutes = 30;
|
||||
using var hardCancellationTokenSource = new CancellationTokenSource(TimeSpan.FromMinutes(MaximumTestMinutes));
|
||||
var maximumTestMinutes = LiveTestUtils.RunningInGitHubActions ? 90 : 20;
|
||||
using var hardCancellationTokenSource = new CancellationTokenSource(TimeSpan.FromMinutes(maximumTestMinutes));
|
||||
var hardCancellationToken = hardCancellationTokenSource.Token;
|
||||
|
||||
ServiceCollectionExtensions.UseAdditionalLoggerProvider<HardFailLoggerProvider>();
|
||||
|
||||
Reference in New Issue
Block a user