Fix legacy installer updates and diagnostics

This commit is contained in:
2026-08-11 10:10:28 +02:00
parent 448be8dc49
commit cc1e59916a
15 changed files with 629 additions and 63 deletions
@@ -42,6 +42,9 @@ namespace BizTalkCheckmkPulse.Tests
Run("DefaultServiceContractIsExact", DefaultServiceContractIsExact);
Run("InstallerRejectsUnconfirmedServiceRename", InstallerRejectsUnconfirmedServiceRename);
Run("InstallerAllowsConfirmedServiceRename", InstallerAllowsConfirmedServiceRename);
Run("InstallerAcceptsLegacyEightServiceSelfTest", InstallerAcceptsLegacyEightServiceSelfTest);
Run("InstallerRequiresNineServicesForCandidate", InstallerRequiresNineServicesForCandidate);
Run("InstallerAllowsAdditiveServiceContract", InstallerAllowsAdditiveServiceContract);
Run("InstallerUpdatePreservesExistingSettings", InstallerUpdatePreservesExistingSettings);
Run("RuntimeValidationAcceptsFreshConsistentArtifacts", RuntimeValidationAcceptsFreshConsistentArtifacts);
Run("RuntimeValidationRejectsPreInstallSnapshot", RuntimeValidationRejectsPreInstallSnapshot);
@@ -53,6 +56,7 @@ namespace BizTalkCheckmkPulse.Tests
Run("ForceEndpointRefreshRequiresProviderMode", ForceEndpointRefreshRequiresProviderMode);
Run("RuntimeValidationArgumentsAreParsedStrictly", RuntimeValidationArgumentsAreParsedStrictly);
Run("TaskCompletionRequiresFreshSuccessfulRun", TaskCompletionRequiresFreshSuccessfulRun);
Run("TaskFailureIsDetectedImmediately", TaskFailureIsDetectedImmediately);
Run("SnapshotRoundTripPreservesLines", SnapshotRoundTripPreservesLines);
Run("SnapshotRejectsTampering", SnapshotRejectsTampering);
Run("SnapshotRejectsStaleData", SnapshotRejectsStaleData);
@@ -810,6 +814,51 @@ namespace BizTalkCheckmkPulse.Tests
Assert(change.Contains("BizTalk Platform"), "confirmed rename must report new service");
}
private static void InstallerAcceptsLegacyEightServiceSelfTest()
{
var output = string.Join("\r\n", Enumerable.Range(1, 8)
.Select(x => "0 \"BizTalk Legacy " + x + "\" - Self test OK"));
var services = BizTalkCheckmkPulse.Setup.InstallerEngine.ParseSelfTestOutput(
output,
string.Empty,
0,
null,
"Installierte Version");
AssertEqual(8, services.Count, "legacy self-test service count");
}
private static void InstallerRequiresNineServicesForCandidate()
{
var output = string.Join("\n", Enumerable.Range(1, 8)
.Select(x => "0 \"BizTalk Candidate " + x + "\" - Self test OK"));
try
{
BizTalkCheckmkPulse.Setup.InstallerEngine.ParseSelfTestOutput(
output,
string.Empty,
0,
9,
"Staging");
throw new InvalidOperationException("candidate with eight services was accepted");
}
catch (InvalidOperationException ex)
{
Assert(ex.Message.Contains("Zeilen=8"), "candidate failure must report actual line count");
Assert(ex.Message.Contains("Erwartet=9"), "candidate failure must report expected line count");
Assert(ex.Message.Contains("Stdout="), "candidate failure must include stdout");
}
}
private static void InstallerAllowsAdditiveServiceContract()
{
var change = BizTalkCheckmkPulse.Setup.InstallerEngine.EnsureServiceNameCompatibility(
new[] { "BizTalk Platform", "BizTalk Event Log" },
new[] { "BizTalk Platform", "BizTalk Endpoint Reachability", "BizTalk Event Log" },
false);
Assert(change.Contains("Entfernt=[]"), "additive contract must not remove a service");
Assert(change.Contains("BizTalk Endpoint Reachability"), "additive contract must report the new service");
}
private static string ExtractQuotedServiceName(string line)
{
var start = line.IndexOf('"') + 1;
@@ -1030,6 +1079,19 @@ namespace BizTalkCheckmkPulse.Tests
3, 0, boundary.AddSeconds(-3), boundary), "old successful task must not pass");
}
private static void TaskFailureIsDetectedImmediately()
{
var boundary = DateTime.UtcNow;
Assert(BizTalkCheckmkPulse.Setup.TaskSchedulerService.IsFreshCompletedFailure(
3, 8, boundary.AddSeconds(1), boundary), "fresh failed task must be detected");
Assert(!BizTalkCheckmkPulse.Setup.TaskSchedulerService.IsFreshCompletedFailure(
4, 8, boundary.AddSeconds(1), boundary), "running task must not be treated as completed failure");
Assert(!BizTalkCheckmkPulse.Setup.TaskSchedulerService.IsFreshCompletedFailure(
3, 8, boundary.AddSeconds(-3), boundary), "old task failure must not fail a new validation run");
var description = BizTalkCheckmkPulse.Setup.TaskSchedulerService.DescribeResult(8);
Assert(description.Contains("0x00000008"), "task result must include hexadecimal code");
}
private static RuntimeValidationResult ValidateRuntimeArtifacts(
DateTime boundaryUtc,
DateTime snapshotUtc,