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 b4fc66feb6
3353 changed files with 88254 additions and 1590657 deletions

View File

@@ -6,6 +6,7 @@ using StellaOps.PacksRegistry.Core.Models;
using StellaOps.PacksRegistry.Storage.Postgres.Repositories;
using Xunit;
using StellaOps.TestKit;
namespace StellaOps.PacksRegistry.Storage.Postgres.Tests;
[Collection(PacksRegistryPostgresCollection.Name)]
@@ -32,7 +33,8 @@ public sealed class PostgresPackRepositoryTests : IAsyncLifetime
public Task DisposeAsync() => Task.CompletedTask;
[Fact]
[Trait("Category", TestCategories.Unit)]
[Fact]
public async Task UpsertAndGet_RoundTripsPackRecord()
{
// Arrange
@@ -64,7 +66,8 @@ public sealed class PostgresPackRepositoryTests : IAsyncLifetime
fetched.Metadata.Should().ContainKey("author");
}
[Fact]
[Trait("Category", TestCategories.Unit)]
[Fact]
public async Task GetContentAsync_ReturnsPackContent()
{
// Arrange
@@ -82,7 +85,8 @@ public sealed class PostgresPackRepositoryTests : IAsyncLifetime
Encoding.UTF8.GetString(content!).Should().Be("this is the pack content");
}
[Fact]
[Trait("Category", TestCategories.Unit)]
[Fact]
public async Task GetProvenanceAsync_ReturnsProvenanceData()
{
// Arrange
@@ -101,7 +105,8 @@ public sealed class PostgresPackRepositoryTests : IAsyncLifetime
Encoding.UTF8.GetString(provenance!).Should().Be("provenance statement");
}
[Fact]
[Trait("Category", TestCategories.Unit)]
[Fact]
public async Task ListAsync_ReturnsPacksForTenant()
{
// Arrange
@@ -119,7 +124,8 @@ public sealed class PostgresPackRepositoryTests : IAsyncLifetime
packs.Should().HaveCount(2);
}
[Fact]
[Trait("Category", TestCategories.Unit)]
[Fact]
public async Task UpsertAsync_UpdatesExistingPack()
{
// Arrange

View File

@@ -29,6 +29,7 @@
<ItemGroup>
<ProjectReference Include="..\StellaOps.PacksRegistry.Storage.Postgres\StellaOps.PacksRegistry.Storage.Postgres.csproj" />
<ProjectReference Include="..\..\..\__Tests\__Libraries\StellaOps.Infrastructure.Postgres.Testing\StellaOps.Infrastructure.Postgres.Testing.csproj" />
<ProjectReference Include="../../../__Libraries/StellaOps.TestKit/StellaOps.TestKit.csproj" />
</ItemGroup>
</Project>

View File

@@ -3,11 +3,14 @@ using StellaOps.PacksRegistry.Core.Services;
using StellaOps.PacksRegistry.Infrastructure.InMemory;
using StellaOps.PacksRegistry.Infrastructure.Verification;
using StellaOps.TestKit;
namespace StellaOps.PacksRegistry.Tests;
public sealed class ExportServiceTests
{
[Fact]
[Trait("Category", TestCategories.Unit)]
[Fact]
public async Task Offline_seed_includes_metadata_and_content_when_requested()
{
var ct = TestContext.Current.CancellationToken;

View File

@@ -1,11 +1,13 @@
using StellaOps.PacksRegistry.Core.Models;
using StellaOps.PacksRegistry.Infrastructure.FileSystem;
using StellaOps.TestKit;
namespace StellaOps.PacksRegistry.Tests;
public sealed class FilePackRepositoryTests
{
[Fact]
[Trait("Category", TestCategories.Unit)]
[Fact]
public async Task Upsert_and_List_round_trip()
{
var tempPath = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString("N"));

View File

@@ -2,13 +2,15 @@ using StellaOps.PacksRegistry.Core.Services;
using StellaOps.PacksRegistry.Infrastructure.InMemory;
using StellaOps.PacksRegistry.Infrastructure.Verification;
using StellaOps.TestKit;
namespace StellaOps.PacksRegistry.Tests;
public sealed class PackServiceTests
{
private static byte[] SampleContent => System.Text.Encoding.UTF8.GetBytes("sample-pack-content");
[Fact]
[Trait("Category", TestCategories.Unit)]
[Fact]
public async Task Upload_persists_pack_with_digest()
{
var ct = TestContext.Current.CancellationToken;
@@ -35,7 +37,8 @@ public sealed class PackServiceTests
Assert.Equal(record.PackId, listed[0].PackId);
}
[Fact]
[Trait("Category", TestCategories.Unit)]
[Fact]
public async Task Upload_rejects_when_digest_mismatch()
{
var ct = TestContext.Current.CancellationToken;
@@ -56,7 +59,8 @@ public sealed class PackServiceTests
cancellationToken: ct));
}
[Fact]
[Trait("Category", TestCategories.Unit)]
[Fact]
public async Task Rotate_signature_updates_record_and_audits()
{
var ct = TestContext.Current.CancellationToken;

View File

@@ -9,6 +9,8 @@ using StellaOps.PacksRegistry.Core.Services;
using StellaOps.PacksRegistry.Infrastructure.InMemory;
using StellaOps.PacksRegistry.WebService.Contracts;
using StellaOps.TestKit;
namespace StellaOps.PacksRegistry.Tests;
public sealed class PacksApiTests : IClassFixture<WebApplicationFactory<Program>>
@@ -42,7 +44,8 @@ public sealed class PacksApiTests : IClassFixture<WebApplicationFactory<Program>
});
}
[Fact]
[Trait("Category", TestCategories.Unit)]
[Fact]
public async Task Upload_and_download_round_trip()
{
var ct = TestContext.Current.CancellationToken;

View File

@@ -2,11 +2,14 @@ using System.Security.Cryptography;
using System.Text;
using StellaOps.PacksRegistry.Infrastructure.Verification;
using StellaOps.TestKit;
namespace StellaOps.PacksRegistry.Tests;
public sealed class RsaSignatureVerifierTests
{
[Fact]
[Trait("Category", TestCategories.Unit)]
[Fact]
public async Task Verify_succeeds_when_signature_matches_digest()
{
var ct = TestContext.Current.CancellationToken;
@@ -22,7 +25,8 @@ public sealed class RsaSignatureVerifierTests
Assert.True(ok);
}
[Fact]
[Trait("Category", TestCategories.Unit)]
[Fact]
public async Task Verify_fails_on_invalid_signature()
{
var ct = TestContext.Current.CancellationToken;

View File

@@ -30,5 +30,6 @@
<ProjectReference Include="..\StellaOps.PacksRegistry.Core\StellaOps.PacksRegistry.Core.csproj" />
<ProjectReference Include="..\StellaOps.PacksRegistry.Infrastructure\StellaOps.PacksRegistry.Infrastructure.csproj" />
<ProjectReference Include="..\StellaOps.PacksRegistry.WebService\StellaOps.PacksRegistry.WebService.csproj" />
<ProjectReference Include="../../../__Libraries/StellaOps.TestKit/StellaOps.TestKit.csproj" />
</ItemGroup>
</Project>