This commit is contained in:
StellaOps Bot
2025-12-26 21:43:56 +02:00
354 changed files with 354 additions and 0 deletions

View File

@@ -196,6 +196,7 @@ public sealed class ExportCenterClientTests
Assert.NotNull(stream);
using var ms = new MemoryStream();
using StellaOps.TestKit;
await stream.CopyToAsync(ms);
Assert.Equal(bundleContent, ms.ToArray());
}

View File

@@ -130,6 +130,7 @@ public sealed class ExportDownloadHelperTests : IDisposable
using var source = new MemoryStream(content);
using var destination = new MemoryStream();
using StellaOps.TestKit;
var bytesCopied = await ExportDownloadHelper.CopyWithProgressAsync(source, destination);
Assert.Equal(content.Length, bytesCopied);

View File

@@ -549,6 +549,7 @@ internal sealed class FakeCryptoHash : StellaOps.Cryptography.ICryptoHash
public ValueTask<byte[]> ComputeHashAsync(Stream stream, string? algorithmId = null, CancellationToken cancellationToken = default)
{
using var sha256 = System.Security.Cryptography.SHA256.Create();
using StellaOps.TestKit;
var hash = sha256.ComputeHash(stream);
return new ValueTask<byte[]>(hash);
}

View File

@@ -349,6 +349,7 @@ public sealed class BootstrapPackBuilderTests : IDisposable
using var gzip = new GZipStream(packStream, CompressionMode.Decompress, leaveOpen: true);
using var tar = new TarReader(gzip, leaveOpen: true);
using StellaOps.TestKit;
TarEntry? entry;
while ((entry = tar.GetNextEntry()) is not null)
{

View File

@@ -554,6 +554,7 @@ public class BundleEncryptionServiceTests : IDisposable
public ValueTask<byte[]> ComputeHashAsync(Stream stream, string? algorithmId = null, CancellationToken cancellationToken = default)
{
using var sha256 = System.Security.Cryptography.SHA256.Create();
using StellaOps.TestKit;
var hash = sha256.ComputeHash(stream);
return new ValueTask<byte[]>(hash);
}

View File

@@ -207,6 +207,7 @@ public sealed class DevPortalOfflineBundleBuilderTests
}
using var memory = new MemoryStream();
using StellaOps.TestKit;
entry.DataStream.CopyTo(memory);
result[entry.Name] = memory.ToArray();
}

View File

@@ -133,6 +133,7 @@ public class DevPortalOfflineJobTests
CancellationToken cancellationToken)
{
using var memory = new MemoryStream();
using StellaOps.TestKit;
content.CopyTo(memory);
var bytes = memory.ToArray();
content.Seek(0, SeekOrigin.Begin);

View File

@@ -83,6 +83,7 @@ public class HmacDevPortalOfflineManifestSignerTests
var secret = Convert.FromBase64String(options.Secret);
using var hmac = new HMACSHA256(secret);
using StellaOps.TestKit;
var signature = hmac.ComputeHash(pae);
return Convert.ToBase64String(signature);
}

View File

@@ -387,6 +387,7 @@ public sealed class MirrorBundleBuilderTests : IDisposable
using var gzip = new GZipStream(bundleStream, CompressionMode.Decompress, leaveOpen: true);
using var tar = new TarReader(gzip, leaveOpen: true);
using StellaOps.TestKit;
TarEntry? entry;
while ((entry = tar.GetNextEntry()) is not null)
{

View File

@@ -161,6 +161,7 @@ public sealed class MirrorBundleSigningTests
{
using var nonSeekable = new NonSeekableMemoryStream(Encoding.UTF8.GetBytes("test"));
using StellaOps.TestKit;
await Assert.ThrowsAsync<ArgumentException>(() =>
_signer.SignArchiveAsync(nonSeekable));
}

View File

@@ -402,6 +402,7 @@ public class MirrorDeltaAdapterTests : IDisposable
public ValueTask<byte[]> ComputeHashAsync(Stream stream, string? algorithmId = null, CancellationToken cancellationToken = default)
{
using var sha256 = System.Security.Cryptography.SHA256.Create();
using StellaOps.TestKit;
var hash = sha256.ComputeHash(stream);
return new ValueTask<byte[]>(hash);
}

View File

@@ -374,6 +374,7 @@ public sealed class PortableEvidenceExportBuilderTests : IDisposable
using var gzip = new GZipStream(exportStream, CompressionMode.Decompress, leaveOpen: true);
using var tar = new TarReader(gzip, leaveOpen: true);
using StellaOps.TestKit;
TarEntry? entry;
while ((entry = tar.GetNextEntry()) is not null)
{

View File

@@ -58,6 +58,7 @@ public sealed class RiskBundleBuilderTests
public void Build_WhenMandatoryProviderMissing_Throws()
{
using var temp = new TempDir();
using StellaOps.TestKit;
var epss = temp.WriteFile("epss.csv", "cve,score\n");
var request = new RiskBundleBuildRequest(

View File

@@ -66,6 +66,7 @@ public sealed class RiskBundleJobTests
public Task<RiskBundleStorageMetadata> StoreAsync(RiskBundleObjectStoreOptions options, Stream content, CancellationToken cancellationToken = default)
{
using var ms = new MemoryStream();
using StellaOps.TestKit;
content.CopyTo(ms);
_store[options.StorageKey] = ms.ToArray();
return Task.FromResult(new RiskBundleStorageMetadata(options.StorageKey, ms.Length, options.ContentType));