Merge pull request #1675 from tgstation/FuckYouDD-UnresolvesYourSymlinks

Regression tests and DMAPI fix
This commit is contained in:
Jordan Dominion
2023-10-21 06:22:45 -04:00
committed by GitHub
16 changed files with 64 additions and 30 deletions
+2 -2
View File
@@ -9,8 +9,8 @@
<TgsCommonLibraryVersion>6.0.1</TgsCommonLibraryVersion>
<TgsApiLibraryVersion>11.1.2</TgsApiLibraryVersion>
<TgsClientVersion>12.1.2</TgsClientVersion>
<TgsDmapiVersion>6.5.3</TgsDmapiVersion>
<TgsInteropVersion>5.6.1</TgsInteropVersion>
<TgsDmapiVersion>6.5.4</TgsDmapiVersion>
<TgsInteropVersion>5.6.2</TgsInteropVersion>
<TgsHostWatchdogVersion>1.4.0</TgsHostWatchdogVersion>
<TgsContainerScriptVersion>1.2.1</TgsContainerScriptVersion>
<TgsMigratorVersion>1.0.2</TgsMigratorVersion>
+1 -1
View File
@@ -1,6 +1,6 @@
// tgstation-server DMAPI
#define TGS_DMAPI_VERSION "6.5.3"
#define TGS_DMAPI_VERSION "6.5.4"
// All functions and datums outside this document are subject to change with any version and should not be relied on.
+1 -1
View File
@@ -153,4 +153,4 @@
/world/TgsSecurityLevel()
var/datum/tgs_api/api = TGS_READ_GLOBAL(tgs)
if(api)
api.SecurityLevel()
return api.SecurityLevel()
+1 -1
View File
@@ -1 +1 @@
"5.6.1"
"5.6.2"
@@ -2,6 +2,8 @@
using System.Collections.Generic;
using System.Linq;
using Newtonsoft.Json;
using Tgstation.Server.Api.Models;
using Tgstation.Server.Host.Components.Chat;
using Tgstation.Server.Host.Components.Deployment;
@@ -42,12 +44,14 @@ namespace Tgstation.Server.Host.Components.Interop.Bridge
/// <summary>
/// The <see cref="DreamDaemonSecurity"/> level of the launch.
/// </summary>
public DreamDaemonSecurity? SecurityLevel { get; }
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Include)]
public DreamDaemonSecurity SecurityLevel { get; }
/// <summary>
/// The <see cref="DreamDaemonSecurity"/> level of the launch.
/// </summary>
public DreamDaemonVisibility? Visibility { get; }
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Include)]
public DreamDaemonVisibility Visibility { get; }
/// <summary>
/// The <see cref="TestMergeInformation"/>s in the launch.
@@ -70,8 +74,8 @@ namespace Tgstation.Server.Host.Components.Interop.Bridge
IDmbProvider dmbProvider,
Version serverVersion,
string instanceName,
DreamDaemonSecurity? securityLevel,
DreamDaemonVisibility? visibility,
DreamDaemonSecurity securityLevel,
DreamDaemonVisibility visibility,
ushort serverPort,
bool apiValidateOnly)
: base(chatTrackingContext?.Channels ?? throw new ArgumentNullException(nameof(chatTrackingContext)))
@@ -76,13 +76,11 @@ namespace Tgstation.Server.Host.Components.Session
Dmb = dmb ?? throw new ArgumentNullException(nameof(dmb));
ProcessId = process?.Id ?? throw new ArgumentNullException(nameof(process));
RuntimeInformation = runtimeInformation ?? throw new ArgumentNullException(nameof(runtimeInformation));
if (!runtimeInformation.SecurityLevel.HasValue)
throw new ArgumentException("runtimeInformation must have a valid SecurityLevel!", nameof(runtimeInformation));
AccessIdentifier = accessIdentifier ?? throw new ArgumentNullException(nameof(accessIdentifier));
LaunchSecurityLevel = runtimeInformation.SecurityLevel.Value;
LaunchVisibility = runtimeInformation.Visibility.Value;
LaunchSecurityLevel = runtimeInformation.SecurityLevel;
LaunchVisibility = runtimeInformation.Visibility;
Port = port;
runtimeInformationLock = new object();
@@ -336,7 +336,8 @@ namespace Tgstation.Server.Host.Components.Session
var runtimeInformation = CreateRuntimeInformation(
dmbProvider,
chatTrackingContext,
launchParameters,
launchParameters.SecurityLevel.Value,
launchParameters.Visibility.Value,
apiValidate);
var reattachInformation = new ReattachInformation(
@@ -430,7 +431,8 @@ namespace Tgstation.Server.Host.Components.Session
var runtimeInformation = CreateRuntimeInformation(
reattachInformation.Dmb,
chatTrackingContext,
null,
reattachInformation.LaunchSecurityLevel,
reattachInformation.LaunchVisibility,
false);
reattachInformation.SetRuntimeInformation(runtimeInformation);
@@ -626,21 +628,23 @@ namespace Tgstation.Server.Host.Components.Session
/// </summary>
/// <param name="dmbProvider">The <see cref="IDmbProvider"/>.</param>
/// <param name="chatTrackingContext">The <see cref="IChatTrackingContext"/>.</param>
/// <param name="launchParameters">The <see cref="DreamDaemonLaunchParameters"/> if any.</param>
/// <param name="securityLevel">The <see cref="DreamDaemonSecurity"/> the server was launched with.</param>
/// <param name="visibility">The <see cref="DreamDaemonVisibility"/> the server was launched with.</param>
/// <param name="apiValidateOnly">The value of <see cref="RuntimeInformation.ApiValidateOnly"/>.</param>
/// <returns>A new <see cref="RuntimeInformation"/> class.</returns>
RuntimeInformation CreateRuntimeInformation(
IDmbProvider dmbProvider,
IChatTrackingContext chatTrackingContext,
DreamDaemonLaunchParameters launchParameters,
DreamDaemonSecurity securityLevel,
DreamDaemonVisibility visibility,
bool apiValidateOnly)
=> new (
chatTrackingContext,
dmbProvider,
assemblyInformationProvider.Version,
instance.Name,
launchParameters?.SecurityLevel,
launchParameters?.Visibility,
securityLevel,
visibility,
serverPortProvider.HttpApiPort,
apiValidateOnly);
@@ -1,5 +1,4 @@
using System;
using System.ComponentModel.DataAnnotations;
using System.Globalization;
using Tgstation.Server.Api.Models;
@@ -31,14 +30,12 @@ namespace Tgstation.Server.Host.Models
/// <summary>
/// The <see cref="DreamDaemonSecurity"/> level DreamDaemon was launched with.
/// </summary>
[Required]
public DreamDaemonSecurity? LaunchSecurityLevel { get; set; }
public DreamDaemonSecurity LaunchSecurityLevel { get; set; }
/// <summary>
/// The <see cref="DreamDaemonVisibility"/> DreamDaemon was launched with.
/// </summary>
[Required]
public DreamDaemonVisibility? LaunchVisibility { get; set; }
public DreamDaemonVisibility LaunchVisibility { get; set; }
/// <summary>
/// Initializes a new instance of the <see cref="ReattachInformationBase"/> class.
@@ -153,7 +153,7 @@ namespace Tgstation.Server.Host.Utils.GitHub
rateLimitInfo.Reset.ToString("o"));
else
logger.LogDebug(
"Requested GitHub client has {remainingRequests} requests remaining after the usage {lastUse}. Limit resets at {resetTime}",
"Requested GitHub client has {remainingRequests} requests remaining after the usage at {lastUse}. Limit resets at {resetTime}",
rateLimitInfo.Remaining,
lastUsed,
rateLimitInfo.Reset.ToString("o"));
+6
View File
@@ -11,6 +11,12 @@
dab()
TgsNew(new /datum/tgs_event_handler/impl, TGS_SECURITY_SAFE)
var/sec = TgsSecurityLevel()
if(isnull(sec))
FailTest("TGS Security level was null!")
log << "Running in security level: [sec]"
if(params["expect_chat_channels"])
var/list/channels = TgsChatChannelInfo()
if(!length(channels))
@@ -0,0 +1,17 @@
// Hand crafted DME, will not work if saved with DreamMaker
// BEGIN_INTERNALS
// END_INTERNALS
// BEGIN_FILE_DIR
#define FILE_DIR .
// END_FILE_DIR
// BEGIN_PREFERENCES
// END_PREFERENCES
// BEGIN_INCLUDE
#include "tests/DMAPI/LongRunning/Config.dm"
#include "tests/DMAPI/test_prelude.dm"
#include "tests/DMAPI/LongRunning/Test.dm"
// END_INCLUDE
@@ -92,7 +92,7 @@ namespace Tgstation.Server.Tests.Live.Instance
await configurationClient.CreateDirectory(staticDir, cancellationToken);
}
public Task SetupDMApiTests(CancellationToken cancellationToken)
public Task SetupDMApiTests(bool includingRoot, CancellationToken cancellationToken)
{
// just use an I/O manager here
var ioManager = new DefaultIOManager();
@@ -104,6 +104,12 @@ namespace Tgstation.Server.Tests.Live.Instance
ioManager.ConcatPath(instance.Path, "Repository", "tests", "DMAPI"),
null,
cancellationToken),
includingRoot
? ioManager.CopyFile(
"../../../../DMAPI/LongRunning/long_running_test_rooted.dme",
ioManager.ConcatPath(instance.Path, "Repository", "long_running_test_rooted.dme"),
cancellationToken)
: Task.CompletedTask,
ioManager.CopyDirectory(
Enumerable.Empty<string>(),
null,
@@ -175,8 +181,8 @@ namespace Tgstation.Server.Tests.Live.Instance
}
public Task RunPreWatchdog(CancellationToken cancellationToken) => Task.WhenAll(
SetupDMApiTests(false, cancellationToken),
SequencedApiTests(cancellationToken),
SetupDMApiTests(cancellationToken),
TestPregeneratedFilesExist(cancellationToken));
}
}
@@ -63,6 +63,7 @@ namespace Tgstation.Server.Tests.Live.Instance
await chatTask;
await dmTask;
await configTest.SetupDMApiTests(true, cancellationToken);
await byondTask;
await new WatchdogTest(
@@ -172,7 +173,7 @@ namespace Tgstation.Server.Tests.Live.Instance
dmUpdateRequest,
cloneRequest);
var configSetupTask = new ConfigurationTest(instanceClient.Configuration, instanceClient.Metadata).SetupDMApiTests(cancellationToken);
var configSetupTask = new ConfigurationTest(instanceClient.Configuration, instanceClient.Metadata).SetupDMApiTests(true, cancellationToken);
if (TestingUtils.RunningInGitHubActions
|| String.IsNullOrWhiteSpace(Environment.GetEnvironmentVariable("TGS_TEST_GITHUB_TOKEN"))
@@ -1101,7 +1101,7 @@ namespace Tgstation.Server.Tests.Live.Instance
var refreshed = await instanceClient.DreamMaker.Update(new DreamMakerRequest
{
ApiValidationSecurityLevel = deploymentSecurity,
ProjectName = $"tests/DMAPI/{dmeName}",
ProjectName = dmeName.Contains("rooted") ? dmeName : $"tests/DMAPI/{dmeName}",
RequireDMApiValidation = requireApi,
Timeout = TimeSpan.FromMilliseconds(1),
}, cancellationToken);
@@ -1471,7 +1471,7 @@ namespace Tgstation.Server.Tests.Live
await WatchdogTest.TellWorldToReboot2(instanceClient, WatchdogTest.StaticTopicClient, mainDDPort, cancellationToken);
dd = await instanceClient.DreamDaemon.Read(cancellationToken);
Assert.AreEqual(WatchdogStatus.Online, dd.Status.Value);
Assert.AreEqual(WatchdogStatus.Online, dd.Status.Value); // if this assert fails, you likely have to crack open the debugger and read test_fail_reason.txt manually
Assert.IsNull(dd.StagedCompileJob);
Assert.AreEqual(initialStaged, dd.ActiveCompileJob.Id);
+1
View File
@@ -157,6 +157,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "LongRunning", "LongRunning"
tests\DMAPI\LongRunning\Config.dm = tests\DMAPI\LongRunning\Config.dm
tests\DMAPI\LongRunning\long_running_test.dme = tests\DMAPI\LongRunning\long_running_test.dme
tests\DMAPI\LongRunning\long_running_test_copy.dme = tests\DMAPI\LongRunning\long_running_test_copy.dme
tests\DMAPI\LongRunning\long_running_test_rooted.dme = tests\DMAPI\LongRunning\long_running_test_rooted.dme
tests\DMAPI\LongRunning\Test.dm = tests\DMAPI\LongRunning\Test.dm
EndProjectSection
EndProject