test: serialise setup registry scratch keys and refresh the copy plan baselines

The setup tests running in parallel shared HKCU\Software\Chronos.Tests and each
removed it once it looked empty; one test's cleanup could race another's key
creation and fail ReplacingTheLegacyUploaderMovesItsSignInEntryAndKeepsItTurnedOff
in a whole-suite run. ScratchRegistry now creates each scratch key and removes
the parent under one lock.

The Plan and Blocked compare captures now count both server projects coming
to this PC (Vertical and Slow pan, as the Projects part lists them); the old
baselines still showed one.

Refs #73

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Alby96andClaude Opus 5.5 committed 2026-11-17 22:48:17 +01:00
1 parent b0b7c45896
commit c3273b7da5
7 files changed
+43 -24

No files matched your search

@@ -19,8 +19,6 @@ namespace Chronos.App.Tests.Setup;
/// </summary>
public sealed class SingleSetupTests(TestContext context)
{
private const string TestsKey = @"Software\Chronos.Tests";
/// <summary>The StartupApproved state Task Manager writes for an entry it turned off.</summary>
private static readonly byte[] TurnedOff = [0x03, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
@@ -223,7 +221,7 @@ public sealed class SingleSetupTests(TestContext context)
var programs = LegacyProducts.StartupPrograms(Manifest(), directory);
Assert.SequenceEqual(["Chronos Uploader"], programs.Keys);
var keyPath = TestsKey + @"\" + Guid.NewGuid().ToString("N");
var keyPath = ScratchRegistry.Create();
try
{
using var run = Registry.CurrentUser.CreateSubKey(keyPath + @"\Run", writable: true);
@@ -238,10 +236,7 @@ public sealed class SingleSetupTests(TestContext context)
}
finally
{
Registry.CurrentUser.DeleteSubKeyTree(keyPath, throwOnMissingSubKey: false);
bool empty;
using (var tests = Registry.CurrentUser.OpenSubKey(TestsKey)) empty = tests is { SubKeyCount: 0, ValueCount: 0 };
if (empty) Registry.CurrentUser.DeleteSubKey(TestsKey, throwOnMissingSubKey: false);
ScratchRegistry.Delete(keyPath);
}
}