26 lines
906 B
C#
26 lines
906 B
C#
|
|
namespace NeonSprawl.Server.Tests.Game.PositionState;
|
|
|
|
/// <summary>Skips unless <c>ConnectionStrings__NeonSprawl</c> is set; fails in CI if missing so misconfigured workflows do not silently pass.</summary>
|
|
public sealed class RequirePostgresFactAttribute : FactAttribute
|
|
{
|
|
public RequirePostgresFactAttribute()
|
|
{
|
|
var cs = Environment.GetEnvironmentVariable("ConnectionStrings__NeonSprawl");
|
|
var inCi = string.Equals(Environment.GetEnvironmentVariable("CI"), "true", StringComparison.Ordinal);
|
|
|
|
if (!string.IsNullOrWhiteSpace(cs))
|
|
{
|
|
return;
|
|
}
|
|
|
|
if (inCi)
|
|
{
|
|
throw new InvalidOperationException(
|
|
"CI must set ConnectionStrings__NeonSprawl for Postgres integration tests.");
|
|
}
|
|
|
|
Skip = "Set ConnectionStrings__NeonSprawl to run Postgres integration tests (see server/README.md).";
|
|
}
|
|
}
|