Files
git.stella-ops.org/devops/services/crypto/sim-crypto-smoke/Program.cs
2026-01-13 18:53:39 +02:00

35 lines
1.1 KiB
C#

var baseUrl = Environment.GetEnvironmentVariable("STELLAOPS_CRYPTO_SIM_URL") ?? "http://localhost:8080";
var profile = (Environment.GetEnvironmentVariable("SIM_PROFILE") ?? "sm").ToLowerInvariant();
var algList = SmokeLogic.ResolveAlgorithms(profile, Environment.GetEnvironmentVariable("SIM_ALGORITHMS"));
var message = Environment.GetEnvironmentVariable("SIM_MESSAGE") ?? "stellaops-sim-smoke";
using var client = new HttpClient { BaseAddress = new Uri(baseUrl) };
var cts = new CancellationTokenSource(TimeSpan.FromSeconds(20));
var failures = new List<string>();
foreach (var alg in algList)
{
var (ok, error) = await SmokeLogic.SignAndVerifyAsync(client, alg, message, cts.Token);
if (!ok)
{
failures.Add($"{alg}: {error}");
continue;
}
Console.WriteLine($"[ok] {alg} via {baseUrl}");
}
if (failures.Count > 0)
{
Console.Error.WriteLine("Simulation smoke failed:");
foreach (var f in failures)
{
Console.Error.WriteLine($" - {f}");
}
Environment.Exit(1);
}
Console.WriteLine("Simulation smoke passed.");