Files
Nemera/tests/IntegrationTests/Nemera.Presentation.Api.IntegrationTests/Common/Setup/DeployedBundledPluginsFactAttribute.cs
T
BinaryAlley b30cbd6b9e Adds bundled plugin trust and cross-platform native deployment
- embeds the append-only historical and deny trust lists in the API and marks matching bundled plugins as Official without blocking loading
- builds and records the current plugin manifest only for official release builds
- deploys the PDF native libraries for the supported Linux, macOS and Windows runtimes from the plugin dependency manifest
- records release hashes by appending only missing entries to master's manifest and rejects any diff that removes a line
- documents the release flow, the supported runtimes and the plugin installer limits
2026-11-28 18:00:00 +02:00

48 lines
2.3 KiB
C#

#region ========================================================================= USING =====================================================================================
using System;
using System.Diagnostics.CodeAnalysis;
using System.IO;
using System.Linq;
using Xunit;
#endregion
namespace Nemera.Presentation.Api.IntegrationTests.Common.Setup;
/// <summary>
/// Marks a test that only runs when the API assembly was produced by an official release build and the deployed bundled plugins are present.
/// </summary>
[AttributeUsage(AttributeTargets.Method)]
[ExcludeFromCodeCoverage]
public sealed class DeployedBundledPluginsFactAttribute : FactAttribute
{
/// <summary>
/// Gets the reason to skip the test. If set, the test will be skipped instead of executed.
/// </summary>
public override string Skip
{
get
{
// xUnit evaluates Skip during discovery. Missing deployed plugins mean the solution was not built, which is normal locally,
// so the test is skipped with a reason instead of failing.
if (!OfficialReleaseBuildDetector.IsOfficialReleaseBuild())
return "The API assembly was not produced by an official release build.";
try
{
string repositoryRoot = BundledPluginManifestTestPaths.GetRepositoryRoot();
string pluginsDirectory = BundledPluginManifestTestPaths.GetDeployedPluginsDirectory(repositoryRoot);
// The deployed folder is produced by the solution build. If it is missing or empty there is no artifact to verify,
// so the test is skipped and the reason points at the path that was expected.
if (!Directory.Exists(pluginsDirectory))
return $"The deployed bundled plugins directory '{pluginsDirectory}' does not exist.";
if (!Directory.EnumerateFiles(pluginsDirectory, BundledPluginManifestTestPaths.PLUGIN_ASSEMBLY_SEARCH_PATTERN).Any())
return $"The deployed bundled plugins directory '{pluginsDirectory}' does not contain any bundled plugin assemblies.";
return string.Empty;
}
catch (InvalidOperationException exception)
{
return exception.Message;
}
}
}
}