Merge branch 'main' of https://git.stella-ops.org/stella-ops.org/git.stella-ops.org
This commit is contained in:
@@ -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());
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -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));
|
||||
|
||||
Reference in New Issue
Block a user