release orchestrator v1 draft and build fixes

This commit is contained in:
master
2026-01-12 12:24:17 +02:00
parent f3de858c59
commit 9873f80830
1598 changed files with 240385 additions and 5944 deletions

View File

@@ -0,0 +1,85 @@
namespace StellaOps.Plugin.Testing;
using StellaOps.Plugin.Abstractions.Context;
/// <summary>
/// Test implementation of IPluginContext.
/// </summary>
public sealed class TestPluginContext : IPluginContext
{
/// <summary>
/// Gets the test configuration.
/// </summary>
public TestPluginConfiguration Configuration { get; }
/// <summary>
/// Gets the test logger.
/// </summary>
public TestPluginLogger Logger { get; }
/// <summary>
/// Gets the test services.
/// </summary>
public TestPluginServices Services { get; }
/// <inheritdoc />
public Guid? TenantId { get; set; }
/// <inheritdoc />
public Guid InstanceId { get; }
/// <inheritdoc />
public CancellationToken ShutdownToken { get; }
/// <inheritdoc />
public TimeProvider TimeProvider { get; }
/// <summary>
/// Gets the GUID generator for deterministic testing.
/// </summary>
public SequentialGuidGenerator GuidGenerator { get; }
/// <summary>
/// Gets the HTTP client factory for test mocking.
/// </summary>
public TestHttpClientFactory HttpClientFactory { get; }
IPluginConfiguration IPluginContext.Configuration => Configuration;
IPluginLogger IPluginContext.Logger => Logger;
IPluginServices IPluginContext.Services => Services;
/// <summary>
/// Creates a new test context.
/// </summary>
/// <param name="options">Test host options.</param>
public TestPluginContext(PluginTestHostOptions options)
{
Configuration = new TestPluginConfiguration(options.Configuration, options.Secrets);
Logger = new TestPluginLogger(options.MinLogLevel, options.EnableLogging);
Services = new TestPluginServices();
TimeProvider = options.TimeProvider
?? new FakeTimeProvider(options.StartTime ?? DateTimeOffset.UtcNow);
GuidGenerator = new SequentialGuidGenerator();
HttpClientFactory = new TestHttpClientFactory();
InstanceId = GuidGenerator.NewGuid();
ShutdownToken = CancellationToken.None;
// Register common services
Services.Register<IHttpClientFactory>(HttpClientFactory);
Services.Register(TimeProvider);
}
/// <summary>
/// Creates a new test context with a custom shutdown token.
/// </summary>
/// <param name="options">Test host options.</param>
/// <param name="shutdownToken">Shutdown cancellation token.</param>
public TestPluginContext(PluginTestHostOptions options, CancellationToken shutdownToken)
: this(options)
{
ShutdownToken = shutdownToken;
}
}