Harden ACC installer update and endpoint performance
This commit is contained in:
@@ -39,6 +39,10 @@
|
||||
<Project>{A4D4D050-9EA7-4A71-B510-7D9D699B9F38}</Project>
|
||||
<Name>BizTalkCheckmkPulse</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\src\BizTalkCheckmkPulse.Setup\BizTalkCheckmkPulse.Setup.csproj">
|
||||
<Project>{764AC43A-26D8-43C1-9121-13FC8A9CC8B1}</Project>
|
||||
<Name>BizTalkCheckmkPulse.Setup</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
||||
|
||||
@@ -32,6 +32,8 @@ namespace BizTalkCheckmkPulse.Tests
|
||||
Run("EndpointCatalogPreservesManualOverrides", EndpointCatalogPreservesManualOverrides);
|
||||
Run("EndpointCatalogRoundTrip", EndpointCatalogRoundTrip);
|
||||
Run("EndpointOutputListsOnlyUnavailableTargets", EndpointOutputListsOnlyUnavailableTargets);
|
||||
Run("EndpointProbeBudgetFitsMinuteInterval", EndpointProbeBudgetFitsMinuteInterval);
|
||||
Run("InstallerUpdatePreservesExistingSettings", InstallerUpdatePreservesExistingSettings);
|
||||
Run("SnapshotRoundTripPreservesLines", SnapshotRoundTripPreservesLines);
|
||||
Run("SnapshotRejectsTampering", SnapshotRejectsTampering);
|
||||
Run("SnapshotRejectsStaleData", SnapshotRejectsStaleData);
|
||||
@@ -454,11 +456,11 @@ namespace BizTalkCheckmkPulse.Tests
|
||||
{
|
||||
EnvironmentName = "ACC",
|
||||
SynchronizedUtc = DateTime.UtcNow,
|
||||
ActiveCandidates = 1,
|
||||
ActiveCandidates = 150,
|
||||
UnsupportedCandidates = 0
|
||||
};
|
||||
catalog.Entries.Add(TestEndpoint("Orders", "api.example.test"));
|
||||
var store = new EndpointCatalogStore(path, 1048576, 500);
|
||||
var store = new EndpointCatalogStore(path, 1048576, 100);
|
||||
store.Write(catalog);
|
||||
var loaded = store.Read("ACC");
|
||||
|
||||
@@ -493,6 +495,75 @@ namespace BizTalkCheckmkPulse.Tests
|
||||
};
|
||||
}
|
||||
|
||||
private static void EndpointProbeBudgetFitsMinuteInterval()
|
||||
{
|
||||
var options = new MonitoringOptions();
|
||||
var seventyTargets = EndpointConnectivityProbe.CalculateWorstCaseProbeMilliseconds(
|
||||
70,
|
||||
options.EndpointProbeMaxConcurrency,
|
||||
options.EndpointProbeTimeoutMilliseconds);
|
||||
var configuredMaximum = EndpointConnectivityProbe.CalculateWorstCaseProbeMilliseconds(
|
||||
options.EndpointMaxCount,
|
||||
options.EndpointProbeMaxConcurrency,
|
||||
options.EndpointProbeTimeoutMilliseconds);
|
||||
|
||||
AssertEqual(15000, (int)seventyTargets, "70-target theoretical timeout budget");
|
||||
Assert(configuredMaximum <= 30000, "configured endpoint worst-case must leave headroom in the minute interval");
|
||||
}
|
||||
|
||||
private static void InstallerUpdatePreservesExistingSettings()
|
||||
{
|
||||
var directory = Path.Combine(Path.GetTempPath(), "BizTalkCheckmkPulse.InstallerTests." + Guid.NewGuid().ToString("N"));
|
||||
Directory.CreateDirectory(directory);
|
||||
try
|
||||
{
|
||||
var source = Path.Combine(directory, "source.config");
|
||||
var existing = Path.Combine(directory, "existing.config");
|
||||
var staged = Path.Combine(directory, "staged.config");
|
||||
File.WriteAllText(
|
||||
source,
|
||||
"<configuration><appSettings>"
|
||||
+ "<add key=\"EnvironmentName\" value=\"\" />"
|
||||
+ "<add key=\"EndpointProbeMaxConcurrency\" value=\"16\" />"
|
||||
+ "<add key=\"EndpointMaxCount\" value=\"100\" />"
|
||||
+ "<add key=\"NewSetting\" value=\"new-default\" />"
|
||||
+ "</appSettings></configuration>",
|
||||
new UTF8Encoding(false));
|
||||
File.WriteAllText(
|
||||
existing,
|
||||
"<configuration><appSettings>"
|
||||
+ "<add key=\"EnvironmentName\" value=\"ACC\" />"
|
||||
+ "<add key=\"EndpointProbeMaxConcurrency\" value=\"7\" />"
|
||||
+ "<add key=\"EndpointMaxCount\" value=\"500\" />"
|
||||
+ "<add key=\"RemovedLegacySetting\" value=\"legacy\" />"
|
||||
+ "</appSettings></configuration>",
|
||||
new UTF8Encoding(false));
|
||||
|
||||
var effectiveEnvironment = BizTalkCheckmkPulse.Setup.InstallerEngine.PrepareConfig(
|
||||
source,
|
||||
staged,
|
||||
existing,
|
||||
string.Empty);
|
||||
var merged = File.ReadAllText(staged);
|
||||
AssertEqual("ACC", effectiveEnvironment, "preserved installer environment");
|
||||
Assert(merged.Contains("key=\"EndpointProbeMaxConcurrency\" value=\"7\""), "existing operational value must be preserved");
|
||||
Assert(merged.Contains("key=\"EndpointMaxCount\" value=\"100\""), "superseded old default must migrate to new bounded default");
|
||||
Assert(merged.Contains("key=\"NewSetting\" value=\"new-default\""), "new source setting must be added");
|
||||
Assert(merged.IndexOf("RemovedLegacySetting", StringComparison.Ordinal) < 0, "removed legacy key must not be resurrected");
|
||||
|
||||
effectiveEnvironment = BizTalkCheckmkPulse.Setup.InstallerEngine.PrepareConfig(
|
||||
source,
|
||||
staged,
|
||||
existing,
|
||||
"PRD");
|
||||
AssertEqual("PRD", effectiveEnvironment, "requested environment override");
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (Directory.Exists(directory)) Directory.Delete(directory, true);
|
||||
}
|
||||
}
|
||||
|
||||
private static void SnapshotRejectsTampering()
|
||||
{
|
||||
WithTemporarySnapshot((path, store) =>
|
||||
|
||||
Reference in New Issue
Block a user