diff --git a/tests/SQLInsight.IntegrationTests/CollectorTests.cs b/tests/SQLInsight.IntegrationTests/CollectorTests.cs index 5532aa9..9f0cc58 100644 --- a/tests/SQLInsight.IntegrationTests/CollectorTests.cs +++ b/tests/SQLInsight.IntegrationTests/CollectorTests.cs @@ -267,6 +267,10 @@ public class CollectorTests(SqlServerFixture sql) END; EXEC (N'CREATE OR ALTER FUNCTION dbo.fn_PlanProbePrice (@p int) RETURNS int AS BEGIN RETURN @p * DATEPART(ms, GETDATE()); END;'); """); + // The rest of the suite fills the plan cache with heavier statements; start from an empty cache (test only: + // SQLInsight itself never clears it). + await sql.ExecuteAsSaAsync("DBCC FREEPROCCACHE WITH NO_INFOMSGS;"); + // Run in the database (not after USE in a master batch) so the plans belong to it, and put the tags inside the // statements: the statement text ends at the statement, not at a trailing comment. await using (var connection = new Microsoft.Data.SqlClient.SqlConnection(sql.DatabaseConnectionString(SqlServerFixture.TestDatabase)))