Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add test to load all config presets #20705

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions Content.IntegrationTests/Tests/ConfigPresetTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
using Content.Server.Entry;
using Robust.Shared.Configuration;
using Robust.Shared.ContentPack;

namespace Content.IntegrationTests.Tests;

[TestFixture]
public sealed class ConfigPresetTests
{
[Test]
public async Task TestLoadAll()
{
var pair = await PoolManager.GetServerClient();
var server = pair.Server;

var resources = server.ResolveDependency<IResourceManager>();
var config = server.ResolveDependency<IConfigurationManager>();

await server.WaitPost(() =>
{
var presets = resources.ContentFindFiles(EntryPoint.ConfigPresetsDir);

foreach (var preset in presets)
{
var stream = resources.ContentFileRead(preset);
config.LoadDefaultsFromTomlStream(stream);
}
});
}
}
1 change: 1 addition & 0 deletions Content.Server/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using System.Runtime.CompilerServices;

[assembly: InternalsVisibleTo("Content.Tests")]
[assembly: InternalsVisibleTo("Content.IntegrationTests")]
6 changes: 3 additions & 3 deletions Content.Server/Entry/EntryPoint.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,20 @@
using Content.Server.Voting.Managers;
using Content.Shared.CCVar;
using Content.Shared.Kitchen;
using Content.Shared.Localizations;
using Robust.Server;
using Robust.Shared.Configuration;
using Robust.Server.ServerStatus;
using Robust.Shared.Configuration;
using Robust.Shared.ContentPack;
using Robust.Shared.Prototypes;
using Robust.Shared.Timing;
using Robust.Shared.Utility;
using Content.Shared.Localizations;

namespace Content.Server.Entry
{
public sealed class EntryPoint : GameServer
{
private const string ConfigPresetsDir = "/ConfigPresets/";
internal const string ConfigPresetsDir = "/ConfigPresets/";
private const string ConfigPresetsDirBuild = $"{ConfigPresetsDir}Build/";

private EuiManager _euiManager = default!;
Expand Down