save checkpoint

This commit is contained in:
master
2026-02-11 01:32:14 +02:00
parent 5593212b41
commit cf5b72974f
2316 changed files with 68799 additions and 3808 deletions

View File

@@ -47,4 +47,8 @@
<ProjectReference Include="../../Router/__Libraries/StellaOps.Router.AspNet/StellaOps.Router.AspNet.csproj" />
<ProjectReference Include="../../__Libraries/StellaOps.Replay.Core/StellaOps.Replay.Core.csproj" />
</ItemGroup>
<!-- Federation files excluded from Core due to circular dependency; compiled here for DI registration -->
<ItemGroup>
<Compile Include="../__Libraries/StellaOps.Concelier.Core/Federation/**/*.cs" Link="Federation/%(RecursiveDir)%(Filename)%(Extension)" />
</ItemGroup>
</Project>

View File

@@ -26,6 +26,7 @@ using StellaOps.Concelier.Testing;
using Xunit;
using StellaOps.TestKit;
using FakeTimeProvider = Microsoft.Extensions.Time.Testing.FakeTimeProvider;
namespace StellaOps.Concelier.Connector.Distro.Debian.Tests;
[Collection(ConcelierFixtureCollection.Name)]

View File

@@ -28,6 +28,7 @@ using StellaOps.Cryptography.DependencyInjection;
using Xunit;
using StellaOps.TestKit;
using FakeTimeProvider = Microsoft.Extensions.Time.Testing.FakeTimeProvider;
namespace StellaOps.Concelier.Connector.Ru.Nkcki.Tests;
[Collection(ConcelierFixtureCollection.Name)]

View File

@@ -0,0 +1,30 @@
// <copyright file="FakeTimeProvider.cs" company="Stella Operations">
// Copyright (c) Stella Operations. Licensed under BUSL-1.1.
// </copyright>
namespace StellaOps.Concelier.Core.Tests.Federation;
/// <summary>
/// Fake <see cref="TimeProvider"/> for deterministic time-dependent testing.
/// </summary>
internal sealed class FakeTimeProvider : TimeProvider
{
private DateTimeOffset _currentTime;
public FakeTimeProvider(DateTimeOffset startTime)
{
_currentTime = startTime;
}
public override DateTimeOffset GetUtcNow() => _currentTime;
public void Advance(TimeSpan duration)
{
_currentTime = _currentTime.Add(duration);
}
public void SetTime(DateTimeOffset newTime)
{
_currentTime = newTime;
}
}

View File

@@ -128,13 +128,14 @@ public sealed class SnapshotIngestionOrchestratorTests
_pinningServiceMock
.Setup(x => x.PinSnapshotAsync(It.IsAny<string>(), sourceId, It.IsAny<string?>(), It.IsAny<CancellationToken>()))
.ReturnsAsync(new SnapshotPinResult(
Success: false,
SnapshotId: null,
SiteId: "test-site",
PinnedAt: _timeProvider.GetUtcNow(),
PreviousSnapshotId: null,
Error: "Pinning failed"));
.ReturnsAsync(new SnapshotPinResult
{
Success = false,
SiteId = "test-site",
PinnedAt = _timeProvider.GetUtcNow(),
PreviousSnapshotId = null,
Error = "Pinning failed"
});
// Act
var result = await _orchestrator.ImportWithRollbackAsync(stream, null, sourceId);
@@ -165,13 +166,14 @@ public sealed class SnapshotIngestionOrchestratorTests
_pinningServiceMock
.Setup(x => x.PinSnapshotAsync(It.IsAny<string>(), sourceId, It.IsAny<string?>(), It.IsAny<CancellationToken>()))
.ReturnsAsync(new SnapshotPinResult(
Success: true,
SnapshotId: "temp-snapshot",
SiteId: "test-site",
PinnedAt: _timeProvider.GetUtcNow(),
PreviousSnapshotId: "prev-snapshot",
Error: null));
.ReturnsAsync(new SnapshotPinResult
{
Success = true,
SiteId = "test-site",
PinnedAt = _timeProvider.GetUtcNow(),
PreviousSnapshotId = "prev-snapshot",
Error = null
});
_coordinatorMock
.Setup(x => x.ImportBundleAsync(It.IsAny<Stream>(), It.IsAny<CancellationToken>()))
@@ -179,11 +181,13 @@ public sealed class SnapshotIngestionOrchestratorTests
_pinningServiceMock
.Setup(x => x.RollbackSnapshotAsync(It.IsAny<string>(), sourceId, It.IsAny<string>(), It.IsAny<CancellationToken>()))
.ReturnsAsync(new SnapshotRollbackResult(
Success: true,
RolledBackToSnapshotId: "prev-snapshot",
RolledBackAt: _timeProvider.GetUtcNow(),
Error: null));
.ReturnsAsync(new SnapshotRollbackResult
{
Success = true,
RolledBackToSnapshotId = "prev-snapshot",
RolledBackAt = _timeProvider.GetUtcNow(),
Error = null
});
// Act
var result = await _orchestrator.ImportWithRollbackAsync(stream, null, sourceId);
@@ -216,13 +220,14 @@ public sealed class SnapshotIngestionOrchestratorTests
_pinningServiceMock
.Setup(x => x.PinSnapshotAsync("snapshot-002", sourceId, bundle.CompositeDigest, It.IsAny<CancellationToken>()))
.ReturnsAsync(new SnapshotPinResult(
Success: true,
SnapshotId: "snapshot-002",
SiteId: "test-site",
PinnedAt: _timeProvider.GetUtcNow(),
PreviousSnapshotId: null,
Error: null));
.ReturnsAsync(new SnapshotPinResult
{
Success = true,
SiteId = "test-site",
PinnedAt = _timeProvider.GetUtcNow(),
PreviousSnapshotId = null,
Error = null
});
// Act
var result = await _orchestrator.CreateWithPinningAsync(sourceId, "test-label");
@@ -324,13 +329,14 @@ public sealed class SnapshotIngestionOrchestratorTests
_pinningServiceMock
.Setup(x => x.PinSnapshotAsync(It.IsAny<string>(), sourceId, It.IsAny<string?>(), It.IsAny<CancellationToken>()))
.ReturnsAsync(new SnapshotPinResult(
Success: true,
SnapshotId: bundle.SnapshotId,
SiteId: "test-site",
PinnedAt: _timeProvider.GetUtcNow(),
PreviousSnapshotId: null,
Error: null));
.ReturnsAsync(new SnapshotPinResult
{
Success = true,
SiteId = "test-site",
PinnedAt = _timeProvider.GetUtcNow(),
PreviousSnapshotId = null,
Error = null
});
_coordinatorMock
.Setup(x => x.ImportBundleAsync(It.IsAny<Stream>(), It.IsAny<CancellationToken>()))
@@ -339,18 +345,23 @@ public sealed class SnapshotIngestionOrchestratorTests
private FeedSnapshotBundle CreateTestBundle(string snapshotId)
{
return new FeedSnapshotBundle(
SnapshotId: snapshotId,
CompositeDigest: $"sha256:{Guid.NewGuid():N}",
CreatedAt: _timeProvider.GetUtcNow(),
Label: "test-bundle",
Sources: new[]
return new FeedSnapshotBundle
{
SnapshotId = snapshotId,
CompositeDigest = $"sha256:{Guid.NewGuid():N}",
CreatedAt = _timeProvider.GetUtcNow(),
Label = "test-bundle",
Sources = new[]
{
new FeedSourceSnapshot(
SourceId: "nvd",
Digest: $"sha256:{Guid.NewGuid():N}",
ItemCount: 100,
CapturedAt: _timeProvider.GetUtcNow())
});
new SourceSnapshot
{
SourceId = "nvd",
Version = "1.0",
Digest = $"sha256:{Guid.NewGuid():N}",
RecordCount = 100,
CreatedAt = _timeProvider.GetUtcNow()
}
}
};
}
}

View File

@@ -18,10 +18,17 @@
<ProjectReference Include="../../__Libraries/StellaOps.Concelier.RawModels/StellaOps.Concelier.RawModels.csproj" />
<ProjectReference Include="../../__Libraries/StellaOps.Concelier.Models/StellaOps.Concelier.Models.csproj" />
<ProjectReference Include="../../__Libraries/StellaOps.Concelier.Merge/StellaOps.Concelier.Merge.csproj" />
<ProjectReference Include="../../__Libraries/StellaOps.Concelier.Federation/StellaOps.Concelier.Federation.csproj" />
<ProjectReference Include="../../__Libraries/StellaOps.Concelier.Persistence/StellaOps.Concelier.Persistence.csproj" />
<ProjectReference Include="../../../__Libraries/StellaOps.Ingestion.Telemetry/StellaOps.Ingestion.Telemetry.csproj" />
<ProjectReference Include="../../../__Libraries/StellaOps.TestKit/StellaOps.TestKit.csproj" />
<ProjectReference Include="../../../__Libraries/StellaOps.Replay.Core/StellaOps.Replay.Core.csproj" />
<ProjectReference Include="../../../__Libraries/StellaOps.VersionComparison/StellaOps.VersionComparison.csproj" />
<ProjectReference Include="../../../__Libraries/StellaOps.DistroIntel/StellaOps.DistroIntel.csproj" />
<ProjectReference Include="../../../Aoc/__Libraries/StellaOps.Aoc/StellaOps.Aoc.csproj" />
</ItemGroup>
<!-- Federation files excluded from Core due to circular dependency; compiled here for testing -->
<ItemGroup>
<Compile Include="../../__Libraries/StellaOps.Concelier.Core/Federation/**/*.cs" Link="Federation/%(RecursiveDir)%(Filename)%(Extension)" />
</ItemGroup>
</Project>

View File

@@ -18,6 +18,7 @@ using StellaOps.Concelier.Storage.MergeEvents;
using StellaOps.Provenance;
using StellaOps.TestKit;
using FakeTimeProvider = Microsoft.Extensions.Time.Testing.FakeTimeProvider;
namespace StellaOps.Concelier.Merge.Tests;
public sealed class AdvisoryMergeServiceTests

View File

@@ -11,6 +11,7 @@ using Xunit;
using StellaOps.TestKit;
using FakeTimeProvider = Microsoft.Extensions.Time.Testing.FakeTimeProvider;
namespace StellaOps.Concelier.Merge.Tests;
public sealed class AdvisoryPrecedenceMergerTests

View File

@@ -5,6 +5,7 @@ using StellaOps.Concelier.Models;
using StellaOps.Concelier.Storage.MergeEvents;
using StellaOps.TestKit;
using FakeTimeProvider = Microsoft.Extensions.Time.Testing.FakeTimeProvider;
namespace StellaOps.Concelier.Merge.Tests;
public sealed class MergeEventWriterTests

View File

@@ -8,6 +8,7 @@ using StellaOps.Concelier.Models;
using StellaOps.Concelier.Storage.MergeEvents;
using StellaOps.TestKit;
using FakeTimeProvider = Microsoft.Extensions.Time.Testing.FakeTimeProvider;
namespace StellaOps.Concelier.Merge.Tests;
public sealed class MergePrecedenceIntegrationTests : IAsyncLifetime