feat: harden isolated Tornado test workflow
This commit is contained in:
@@ -28,4 +28,51 @@ public static class PlayoutEngineFactory
|
||||
new EnvironmentLiveAuthorization(),
|
||||
TimeProvider.System);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Applies the same fail-closed Test-mode configuration, scene-root, file-name and
|
||||
/// allowlist validation used by the runtime before a diagnostic tool creates an engine.
|
||||
/// This method never creates a dispatcher or activates COM.
|
||||
/// </summary>
|
||||
public static void ValidateIsolatedTestCommand(
|
||||
PlayoutOptions options,
|
||||
IEnumerable<PlayoutCue> cues)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(options);
|
||||
ArgumentNullException.ThrowIfNull(cues);
|
||||
|
||||
if (options.Mode != PlayoutMode.Test || options.TrustedLiveOutputEnabled)
|
||||
{
|
||||
throw new PlayoutConfigurationException(
|
||||
"The isolated test command requires Test mode with live output disabled.");
|
||||
}
|
||||
|
||||
var validated = ValidatedPlayoutOptions.Create(options);
|
||||
foreach (var cue in cues)
|
||||
{
|
||||
if (cue is null)
|
||||
{
|
||||
throw new PlayoutConfigurationException(
|
||||
"The isolated test command contains an invalid scene.");
|
||||
}
|
||||
|
||||
PlayoutCue resolved;
|
||||
try
|
||||
{
|
||||
resolved = validated.ResolveCue(cue);
|
||||
}
|
||||
catch (PlayoutRequestException exception)
|
||||
{
|
||||
throw new PlayoutConfigurationException(
|
||||
"The isolated test command contains an invalid scene.",
|
||||
exception);
|
||||
}
|
||||
|
||||
if (!validated.IsTestSceneAllowed(resolved))
|
||||
{
|
||||
throw new PlayoutConfigurationException(
|
||||
"The isolated test command contains a scene that is not allowlisted.");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user