Refactor code structure and optimize performance across multiple modules

This commit is contained in:
StellaOps Bot
2025-12-26 20:03:22 +02:00
parent c786faae84
commit f10d83c444
1385 changed files with 69732 additions and 10280 deletions

View File

@@ -2,11 +2,13 @@ using Microsoft.Extensions.Logging.Abstractions;
using StellaOps.TaskRunner.Core.Evidence;
using StellaOps.TaskRunner.Core.Events;
using StellaOps.TestKit;
namespace StellaOps.TaskRunner.Tests;
public sealed class BundleImportEvidenceTests
{
[Fact]
[Trait("Category", TestCategories.Unit)]
[Fact]
public void BundleImportHashChain_Compute_CreatesDeterministicHash()
{
var input = new BundleImportInputManifest(
@@ -41,7 +43,8 @@ public sealed class BundleImportEvidenceTests
Assert.StartsWith("sha256:", chain1.RootHash);
}
[Fact]
[Trait("Category", TestCategories.Unit)]
[Fact]
public void BundleImportHashChain_Compute_DifferentInputsProduceDifferentHashes()
{
var input1 = new BundleImportInputManifest(
@@ -78,7 +81,8 @@ public sealed class BundleImportEvidenceTests
Assert.NotEqual(chain1.InputsHash, chain2.InputsHash);
}
[Fact]
[Trait("Category", TestCategories.Unit)]
[Fact]
public async Task BundleImportEvidenceService_CaptureAsync_StoresEvidence()
{
var store = new InMemoryPackRunEvidenceStore();
@@ -96,7 +100,8 @@ public sealed class BundleImportEvidenceTests
Assert.Equal(1, store.Count);
}
[Fact]
[Trait("Category", TestCategories.Unit)]
[Fact]
public async Task BundleImportEvidenceService_CaptureAsync_CreatesCorrectMaterials()
{
var store = new InMemoryPackRunEvidenceStore();
@@ -120,7 +125,8 @@ public sealed class BundleImportEvidenceTests
Assert.Contains(snapshot.Materials, m => m.Section == "hashchain");
}
[Fact]
[Trait("Category", TestCategories.Unit)]
[Fact]
public async Task BundleImportEvidenceService_CaptureAsync_SetsCorrectMetadata()
{
var store = new InMemoryPackRunEvidenceStore();
@@ -141,7 +147,8 @@ public sealed class BundleImportEvidenceTests
Assert.Equal("2", snapshot.Metadata["outputCount"]);
}
[Fact]
[Trait("Category", TestCategories.Unit)]
[Fact]
public async Task BundleImportEvidenceService_CaptureAsync_EmitsTimelineEvent()
{
var store = new InMemoryPackRunEvidenceStore();
@@ -165,7 +172,8 @@ public sealed class BundleImportEvidenceTests
Assert.Equal("bundle.import.evidence_captured", evt.EventType);
}
[Fact]
[Trait("Category", TestCategories.Unit)]
[Fact]
public async Task BundleImportEvidenceService_GetAsync_ReturnsEvidence()
{
var store = new InMemoryPackRunEvidenceStore();
@@ -183,7 +191,8 @@ public sealed class BundleImportEvidenceTests
Assert.Equal(evidence.TenantId, retrieved.TenantId);
}
[Fact]
[Trait("Category", TestCategories.Unit)]
[Fact]
public async Task BundleImportEvidenceService_GetAsync_ReturnsNullForMissingJob()
{
var store = new InMemoryPackRunEvidenceStore();
@@ -196,7 +205,8 @@ public sealed class BundleImportEvidenceTests
Assert.Null(retrieved);
}
[Fact]
[Trait("Category", TestCategories.Unit)]
[Fact]
public async Task BundleImportEvidenceService_ExportToPortableBundleAsync_CreatesFile()
{
var store = new InMemoryPackRunEvidenceStore();
@@ -230,7 +240,8 @@ public sealed class BundleImportEvidenceTests
}
}
[Fact]
[Trait("Category", TestCategories.Unit)]
[Fact]
public async Task BundleImportEvidenceService_ExportToPortableBundleAsync_FailsForMissingJob()
{
var store = new InMemoryPackRunEvidenceStore();
@@ -249,7 +260,8 @@ public sealed class BundleImportEvidenceTests
Assert.Contains("No evidence found", result.Error);
}
[Fact]
[Trait("Category", TestCategories.Unit)]
[Fact]
public void BundleImportEvidence_RecordProperties_AreAccessible()
{
var evidence = CreateTestEvidence();
@@ -264,7 +276,8 @@ public sealed class BundleImportEvidenceTests
Assert.NotNull(evidence.ValidationResult);
}
[Fact]
[Trait("Category", TestCategories.Unit)]
[Fact]
public void BundleImportValidationResult_RecordProperties_AreAccessible()
{
var result = new BundleImportValidationResult(