Refactor code structure and optimize performance across multiple modules
This commit is contained in:
@@ -29,7 +29,8 @@ public sealed class AttestationBundleVerifierTests : IDisposable
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public async Task VerifyAsync_FileNotFound_ReturnsFileNotFoundCode()
|
||||
{
|
||||
var options = new AttestationBundleVerifyOptions(
|
||||
@@ -42,7 +43,8 @@ public sealed class AttestationBundleVerifierTests : IDisposable
|
||||
Assert.Equal(AttestationBundleExitCodes.FileNotFound, result.ExitCode);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public async Task VerifyAsync_ValidBundle_ReturnsSuccess()
|
||||
{
|
||||
var bundlePath = await CreateValidBundleAsync();
|
||||
@@ -56,7 +58,8 @@ public sealed class AttestationBundleVerifierTests : IDisposable
|
||||
Assert.Equal("verified", result.Status);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public async Task VerifyAsync_ValidBundle_ReturnsMetadata()
|
||||
{
|
||||
var bundlePath = await CreateValidBundleAsync();
|
||||
@@ -72,7 +75,8 @@ public sealed class AttestationBundleVerifierTests : IDisposable
|
||||
Assert.StartsWith("sha256:", result.RootHash);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public async Task VerifyAsync_CorruptedArchive_ReturnsFormatError()
|
||||
{
|
||||
var bundlePath = Path.Combine(_tempDir, "corrupted.tgz");
|
||||
@@ -86,7 +90,8 @@ public sealed class AttestationBundleVerifierTests : IDisposable
|
||||
Assert.Equal(AttestationBundleExitCodes.FormatError, result.ExitCode);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public async Task VerifyAsync_ChecksumMismatch_ReturnsChecksumMismatchCode()
|
||||
{
|
||||
var bundlePath = await CreateBundleWithBadChecksumAsync();
|
||||
@@ -99,7 +104,8 @@ public sealed class AttestationBundleVerifierTests : IDisposable
|
||||
Assert.Equal(AttestationBundleExitCodes.ChecksumMismatch, result.ExitCode);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public async Task VerifyAsync_ExternalChecksumMismatch_ReturnsChecksumMismatchCode()
|
||||
{
|
||||
var bundlePath = await CreateValidBundleAsync();
|
||||
@@ -114,7 +120,8 @@ public sealed class AttestationBundleVerifierTests : IDisposable
|
||||
Assert.Equal(AttestationBundleExitCodes.ChecksumMismatch, result.ExitCode);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public async Task VerifyAsync_MissingTransparency_WhenNotOffline_ReturnsMissingTransparencyCode()
|
||||
{
|
||||
var bundlePath = await CreateBundleWithoutTransparencyAsync();
|
||||
@@ -130,7 +137,8 @@ public sealed class AttestationBundleVerifierTests : IDisposable
|
||||
Assert.Equal(AttestationBundleExitCodes.MissingTransparency, result.ExitCode);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public async Task VerifyAsync_MissingTransparency_WhenOffline_ReturnsSuccess()
|
||||
{
|
||||
var bundlePath = await CreateBundleWithoutTransparencyAsync();
|
||||
@@ -146,7 +154,8 @@ public sealed class AttestationBundleVerifierTests : IDisposable
|
||||
Assert.Equal(AttestationBundleExitCodes.Success, result.ExitCode);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public async Task VerifyAsync_MissingDssePayload_ReturnsSignatureFailure()
|
||||
{
|
||||
var bundlePath = await CreateBundleWithMissingDssePayloadAsync();
|
||||
@@ -159,7 +168,8 @@ public sealed class AttestationBundleVerifierTests : IDisposable
|
||||
Assert.Equal(AttestationBundleExitCodes.SignatureFailure, result.ExitCode);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public async Task ImportAsync_ValidBundle_ReturnsSuccess()
|
||||
{
|
||||
var bundlePath = await CreateValidBundleAsync();
|
||||
@@ -177,7 +187,8 @@ public sealed class AttestationBundleVerifierTests : IDisposable
|
||||
Assert.Equal("imported", result.Status);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public async Task ImportAsync_InvalidBundle_ReturnsVerificationFailed()
|
||||
{
|
||||
var bundlePath = Path.Combine(_tempDir, "invalid.tgz");
|
||||
@@ -194,7 +205,8 @@ public sealed class AttestationBundleVerifierTests : IDisposable
|
||||
Assert.Equal("verification_failed", result.Status);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public async Task ImportAsync_InheritsTenantFromMetadata()
|
||||
{
|
||||
var bundlePath = await CreateValidBundleAsync();
|
||||
@@ -390,6 +402,7 @@ public sealed class AttestationBundleVerifierTests : IDisposable
|
||||
{
|
||||
var bytes = Encoding.UTF8.GetBytes(content);
|
||||
using var dataStream = new MemoryStream(bytes);
|
||||
using StellaOps.TestKit;
|
||||
var entry = new PaxTarEntry(TarEntryType.RegularFile, name)
|
||||
{
|
||||
DataStream = dataStream
|
||||
|
||||
Reference in New Issue
Block a user