Some checks are pending
CI / Build og unit tests (push) Waiting to run
CI / Integration (mcr.microsoft.com/mssql/server:2017-latest) (push) Blocked by required conditions
CI / Integration (mcr.microsoft.com/mssql/server:2019-latest) (push) Blocked by required conditions
CI / Integration (mcr.microsoft.com/mssql/server:2022-latest) (push) Blocked by required conditions
CI / Integration (mcr.microsoft.com/mssql/server:2025-latest) (push) Blocked by required conditions
- .NET 10 solution with Core, Connectivity, Rules, Contracts, Agent, Web and Hub - Capability model gating collectors and rules by SQL Server version (2000 and later); rules that cannot run are reported as not measurable, never as passed - Connectivity via Microsoft.Data.SqlClient with ODBC fallback for legacy instances, hardened monitoring session settings valid back to SQL Server 2000 - Support lifecycle rule (SQLI-VER-001) with lifecycle data shipped as a rule pack - Version-aware least-privilege permissions script, verified by integration tests against SQL Server in Docker (reads monitoring sources, cannot read customer data) - Forgejo Actions CI, contributing guide, code of conduct, issue templates, legacy version notes Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01E3EExwndy8Z22EK2Qpt6BK
48 lines
1.9 KiB
C#
48 lines
1.9 KiB
C#
using SQLInsight.Connectivity;
|
|
using SQLInsight.Core.Instances;
|
|
using SQLInsight.Rules;
|
|
using SQLInsight.Rules.Engine;
|
|
|
|
namespace SQLInsight.IntegrationTests;
|
|
|
|
[Collection(SqlServerTestGroup.Name)]
|
|
[Trait("Category", "Integration")]
|
|
public class InstanceProbeTests(SqlServerFixture sql)
|
|
{
|
|
private ConnectionTarget SaTarget => new()
|
|
{
|
|
Server = sql.Server,
|
|
Authentication = AuthenticationMode.SqlLogin,
|
|
UserName = "sa",
|
|
Password = new Microsoft.Data.SqlClient.SqlConnectionStringBuilder(sql.SaConnectionString).Password,
|
|
Provider = ConnectionProvider.SqlClient,
|
|
// Test containers use a self-signed certificate. A deliberate choice, as the README requires.
|
|
TrustServerCertificate = true,
|
|
};
|
|
|
|
[Fact]
|
|
public async Task Detects_release_matching_the_container_image()
|
|
{
|
|
await using var opened = await new SqlConnectionFactory().OpenAsync(SaTarget);
|
|
|
|
var info = await InstanceProbe.DetectAsync(opened.Connection);
|
|
|
|
var expectedYear = SqlServerFixture.Image.Split(':')[1][..4];
|
|
Assert.Equal(expectedYear, ((int)info.Release).ToString(System.Globalization.CultureInfo.InvariantCulture));
|
|
Assert.Equal(EngineEdition.Enterprise, info.EngineEdition); // Developer edition reports Enterprise.
|
|
Assert.False(string.IsNullOrEmpty(info.ServerName));
|
|
}
|
|
|
|
[Fact]
|
|
public async Task Full_pipeline_evaluates_every_built_in_rule()
|
|
{
|
|
await using var opened = await new SqlConnectionFactory().OpenAsync(SaTarget);
|
|
var info = await InstanceProbe.DetectAsync(opened.Connection);
|
|
var context = new RuleContext(info, InstanceCapabilities.From(info), DateTimeOffset.UtcNow);
|
|
|
|
var results = new RuleEngine(BuiltInRules.Create()).Evaluate(context);
|
|
|
|
Assert.NotEmpty(results);
|
|
Assert.DoesNotContain(results, r => r.Outcome == RuleOutcome.Error);
|
|
}
|
|
}
|