Changes content integration tests to load content resources. (#4248)
* Changes content integration tests to load content resources. * Content Integration tests override the GameControllerOptions and ServerOptions. Only engine integration tests can change these! * don't do component auto-registration by default in content integration tests * Only use empty map in integration tests if CVar not overriden already. * don't use nullable annotations in content integration tests... * Fix integration tests * Fix spawn test * Move cvar overrides out of content * Update submodule.
This commit is contained in:
committed by
GitHub
parent
d10885742b
commit
d5e34c6ad4
@@ -7,6 +7,8 @@ using Content.Server.IoC;
|
|||||||
using Content.Shared.CCVar;
|
using Content.Shared.CCVar;
|
||||||
using Moq;
|
using Moq;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
|
using Robust.Client;
|
||||||
|
using Robust.Server;
|
||||||
using Robust.Server.Maps;
|
using Robust.Server.Maps;
|
||||||
using Robust.Shared;
|
using Robust.Shared;
|
||||||
using Robust.Shared.ContentPack;
|
using Robust.Shared.ContentPack;
|
||||||
@@ -31,6 +33,13 @@ namespace Content.IntegrationTests
|
|||||||
FailureLogLevel = LogLevel.Warning
|
FailureLogLevel = LogLevel.Warning
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Load content resources, but not config and user data.
|
||||||
|
options.Options = new GameControllerOptions()
|
||||||
|
{
|
||||||
|
LoadContentResources = true,
|
||||||
|
LoadConfigAndUserData = false,
|
||||||
|
};
|
||||||
|
|
||||||
options.ContentStart = true;
|
options.ContentStart = true;
|
||||||
|
|
||||||
options.ContentAssemblies = new[]
|
options.ContentAssemblies = new[]
|
||||||
@@ -57,13 +66,6 @@ namespace Content.IntegrationTests
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
// Connecting to Discord is a massive waste of time.
|
|
||||||
// Basically just makes the CI logs a mess.
|
|
||||||
options.CVarOverrides[CVars.DiscordEnabled.Name] = "false";
|
|
||||||
|
|
||||||
// Avoid preloading textures in tests.
|
|
||||||
options.CVarOverrides.TryAdd(CVars.TexturePreloadingEnabled.Name, "false");
|
|
||||||
|
|
||||||
return base.StartClient(options);
|
return base.StartClient(options);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -74,6 +76,13 @@ namespace Content.IntegrationTests
|
|||||||
FailureLogLevel = LogLevel.Warning
|
FailureLogLevel = LogLevel.Warning
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Load content resources, but not config and user data.
|
||||||
|
options.Options = new ServerOptions()
|
||||||
|
{
|
||||||
|
LoadConfigAndUserData = false,
|
||||||
|
LoadContentResources = true,
|
||||||
|
};
|
||||||
|
|
||||||
options.ContentStart = true;
|
options.ContentStart = true;
|
||||||
|
|
||||||
options.ContentAssemblies = new[]
|
options.ContentAssemblies = new[]
|
||||||
@@ -105,15 +114,23 @@ namespace Content.IntegrationTests
|
|||||||
// Disable holidays as some of them might mess with the map at round start.
|
// Disable holidays as some of them might mess with the map at round start.
|
||||||
options.CVarOverrides[CCVars.HolidaysEnabled.Name] = "false";
|
options.CVarOverrides[CCVars.HolidaysEnabled.Name] = "false";
|
||||||
|
|
||||||
// Avoid loading a large map by default for integration tests.
|
// Avoid loading a large map by default for integration tests if none has been specified.
|
||||||
options.CVarOverrides[CCVars.GameMap.Name] = "Maps/Test/empty.yml";
|
if(!options.CVarOverrides.ContainsKey(CCVars.GameMap.Name))
|
||||||
|
options.CVarOverrides[CCVars.GameMap.Name] = "Maps/Test/empty.yml";
|
||||||
|
|
||||||
return base.StartServer(options);
|
return base.StartServer(options);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected ServerIntegrationInstance StartServerDummyTicker(ServerIntegrationOptions options = null)
|
protected ServerIntegrationInstance StartServerDummyTicker(ServerIntegrationOptions options = null)
|
||||||
{
|
{
|
||||||
options ??= new ServerIntegrationOptions();
|
options ??= new ServerContentIntegrationOption();
|
||||||
|
|
||||||
|
// Load content resources, but not config and user data.
|
||||||
|
options.Options = new ServerOptions()
|
||||||
|
{
|
||||||
|
LoadConfigAndUserData = false,
|
||||||
|
LoadContentResources = true,
|
||||||
|
};
|
||||||
|
|
||||||
// Dummy game ticker.
|
// Dummy game ticker.
|
||||||
options.CVarOverrides[CCVars.GameDummyTicker.Name] = "true";
|
options.CVarOverrides[CCVars.GameDummyTicker.Name] = "true";
|
||||||
@@ -229,6 +246,12 @@ namespace Content.IntegrationTests
|
|||||||
FailureLogLevel = LogLevel.Warning;
|
FailureLogLevel = LogLevel.Warning;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override GameControllerOptions Options { get; set; } = new()
|
||||||
|
{
|
||||||
|
LoadContentResources = true,
|
||||||
|
LoadConfigAndUserData = false,
|
||||||
|
};
|
||||||
|
|
||||||
public Action ContentBeforeIoC { get; set; }
|
public Action ContentBeforeIoC { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -239,6 +262,12 @@ namespace Content.IntegrationTests
|
|||||||
FailureLogLevel = LogLevel.Warning;
|
FailureLogLevel = LogLevel.Warning;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override ServerOptions Options { get; set; } = new()
|
||||||
|
{
|
||||||
|
LoadContentResources = true,
|
||||||
|
LoadConfigAndUserData = false,
|
||||||
|
};
|
||||||
|
|
||||||
public Action ContentBeforeIoC { get; set; }
|
public Action ContentBeforeIoC { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ using System.Linq;
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Content.Server.Battery.Components;
|
using Content.Server.Battery.Components;
|
||||||
using Content.Server.PowerCell.Components;
|
using Content.Server.PowerCell.Components;
|
||||||
|
using Content.Shared.CCVar;
|
||||||
using Content.Shared.Coordinates;
|
using Content.Shared.Coordinates;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
@@ -21,7 +22,12 @@ namespace Content.IntegrationTests.Tests
|
|||||||
[Test]
|
[Test]
|
||||||
public async Task SpawnTest()
|
public async Task SpawnTest()
|
||||||
{
|
{
|
||||||
var server = StartServerDummyTicker();
|
var options = new ServerContentIntegrationOption()
|
||||||
|
{
|
||||||
|
CVarOverrides = {{CCVars.AIMaxUpdates.Name, int.MaxValue.ToString()}}
|
||||||
|
};
|
||||||
|
|
||||||
|
var server = StartServerDummyTicker(options);
|
||||||
await server.WaitIdleAsync();
|
await server.WaitIdleAsync();
|
||||||
|
|
||||||
var mapManager = server.ResolveDependency<IMapManager>();
|
var mapManager = server.ResolveDependency<IMapManager>();
|
||||||
|
|||||||
Submodule RobustToolbox updated: abea3024b4...c06707d519
Reference in New Issue
Block a user