Some checks failed
Docs CI / lint-and-preview (push) Has been cancelled
- Implemented MergeUsageAnalyzer to flag usage of AdvisoryMergeService and AddMergeModule. - Created AnalyzerReleases.Shipped.md and AnalyzerReleases.Unshipped.md for release documentation. - Added tests for MergeUsageAnalyzer to ensure correct diagnostics for various scenarios. - Updated project files for analyzers and tests to include necessary dependencies and configurations. - Introduced a sample report structure for scanner output.
50 lines
1.6 KiB
C#
50 lines
1.6 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.IO;
|
|
using System.Security.Cryptography.X509Certificates;
|
|
using StellaOps.Scanner.Surface.Env;
|
|
using StellaOps.Scanner.Surface.FS;
|
|
using Xunit;
|
|
|
|
namespace StellaOps.Scanner.WebService.Tests;
|
|
|
|
public sealed class SurfaceCacheOptionsConfiguratorTests
|
|
{
|
|
[Fact]
|
|
public void Configure_UsesSurfaceEnvironmentCacheRoot()
|
|
{
|
|
var cacheRoot = new DirectoryInfo(Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString("N")));
|
|
var settings = new SurfaceEnvironmentSettings(
|
|
new Uri("https://surface.example"),
|
|
"surface-cache",
|
|
null,
|
|
cacheRoot,
|
|
512,
|
|
true,
|
|
Array.Empty<string>(),
|
|
new SurfaceSecretsConfiguration("file", "tenant-b", "/etc/secrets", null, null, false),
|
|
"tenant-b",
|
|
new SurfaceTlsConfiguration(null, null, new X509Certificate2Collection()));
|
|
|
|
var environment = new StubSurfaceEnvironment(settings);
|
|
var configurator = new SurfaceCacheOptionsConfigurator(environment);
|
|
var options = new SurfaceCacheOptions();
|
|
|
|
configurator.Configure(options);
|
|
|
|
Assert.Equal(cacheRoot.FullName, options.RootDirectory);
|
|
}
|
|
|
|
private sealed class StubSurfaceEnvironment : ISurfaceEnvironment
|
|
{
|
|
public StubSurfaceEnvironment(SurfaceEnvironmentSettings settings)
|
|
{
|
|
Settings = settings;
|
|
}
|
|
|
|
public SurfaceEnvironmentSettings Settings { get; }
|
|
|
|
public IReadOnlyDictionary<string, string> RawVariables { get; } = new Dictionary<string, string>();
|
|
}
|
|
}
|