From 726fbccf5497128a0723d54f748ad8b0be14a606 Mon Sep 17 00:00:00 2001 From: Joseph Doherty Date: Mon, 9 Nov 2026 14:17:11 -0500 Subject: [PATCH] test(secrets): fix Windows failures - skippable permission tests, release SQLite pools before delete (scadaproj#27) The two Unix-permission tests called Skip.IfNot from a plain [Fact] (xunit v2 + Xunit.SkippableFact) so they failed on Windows; now [SkippableFact]. Resolver_Works_EndToEnd_ThroughDi calls SqliteConnection.ClearAllPools() before deleting its temp DB. Claude-Session: https://claude.ai/code/session_01GT67AEHd2Acv1YPwGfXEoV --- .../Cli/Interactive/Flows/BundleFlowTests.cs | 2 +- .../Cli/Interactive/Flows/KekDoctorFlowTests.cs | 2 +- .../DependencyInjection/AddZbSecretsTests.cs | 2 ++ 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/ZB.MOM.WW.Secrets/tests/ZB.MOM.WW.Secrets.Tests/Cli/Interactive/Flows/BundleFlowTests.cs b/ZB.MOM.WW.Secrets/tests/ZB.MOM.WW.Secrets.Tests/Cli/Interactive/Flows/BundleFlowTests.cs index 8cd826a..2b50a3d 100644 --- a/ZB.MOM.WW.Secrets/tests/ZB.MOM.WW.Secrets.Tests/Cli/Interactive/Flows/BundleFlowTests.cs +++ b/ZB.MOM.WW.Secrets/tests/ZB.MOM.WW.Secrets.Tests/Cli/Interactive/Flows/BundleFlowTests.cs @@ -232,7 +232,7 @@ public sealed class BundleFlowTests : IDisposable Assert.Null(await target.Store.GetAsync(new SecretName("svc/cross"), CancellationToken.None)); // untouched } - [Fact] + [SkippableFact] public async Task Import_source_key_file_permission_denied_renders_friendly_error_without_importing() { Skip.IfNot(!OperatingSystem.IsWindows(), "Unix permission bits are exercised via UnixFileMode."); diff --git a/ZB.MOM.WW.Secrets/tests/ZB.MOM.WW.Secrets.Tests/Cli/Interactive/Flows/KekDoctorFlowTests.cs b/ZB.MOM.WW.Secrets/tests/ZB.MOM.WW.Secrets.Tests/Cli/Interactive/Flows/KekDoctorFlowTests.cs index 3331e61..00e419d 100644 --- a/ZB.MOM.WW.Secrets/tests/ZB.MOM.WW.Secrets.Tests/Cli/Interactive/Flows/KekDoctorFlowTests.cs +++ b/ZB.MOM.WW.Secrets/tests/ZB.MOM.WW.Secrets.Tests/Cli/Interactive/Flows/KekDoctorFlowTests.cs @@ -226,7 +226,7 @@ public sealed class KekDoctorFlowTests : IAsyncLifetime, IDisposable Assert.Equal(_kekA.KekId, (await GetAsync("svc/a")).KekId); // nothing changed } - [Fact] + [SkippableFact] public async Task File_old_key_source_permission_denied_renders_friendly_error_and_still_re_diagnoses() { Skip.IfNot(!OperatingSystem.IsWindows(), "Unix permission bits are exercised via UnixFileMode."); diff --git a/ZB.MOM.WW.Secrets/tests/ZB.MOM.WW.Secrets.Tests/DependencyInjection/AddZbSecretsTests.cs b/ZB.MOM.WW.Secrets/tests/ZB.MOM.WW.Secrets.Tests/DependencyInjection/AddZbSecretsTests.cs index 058cd3b..7965919 100644 --- a/ZB.MOM.WW.Secrets/tests/ZB.MOM.WW.Secrets.Tests/DependencyInjection/AddZbSecretsTests.cs +++ b/ZB.MOM.WW.Secrets/tests/ZB.MOM.WW.Secrets.Tests/DependencyInjection/AddZbSecretsTests.cs @@ -116,6 +116,8 @@ public sealed class AddZbSecretsTests finally { Environment.SetEnvironmentVariable(envVar, null); + // Pooled SQLite handles keep the file open (Windows cannot delete it) - release them first. + Microsoft.Data.Sqlite.SqliteConnection.ClearAllPools(); File.Delete(dbPath); } }