605e56829e
LocalDb Phase 2 deleted the bespoke replicators, so three config keys changed meaning or died outright: - ScadaBridge:StoreAndForward:ReplicationEnabled is fully dead. Deleted the property, its 10 config entries, and the 5 test references. - SqliteDbPath / SiteDbPath are now migration-only: they name the legacy files SiteLocalDbLegacyMigrator drains at boot, not live databases. Both mandatory rules are relaxed accordingly (StartupValidator's Site-only Require, and the S&F validator's non-empty rule) — an absent value now means "nothing to migrate", so an already-migrated node can drop the key. DatabaseOptions- Validator still rejects a present-but-blank value. - SiteRuntime:ConfigFetchRetryCount's only reader was SiteReplicationActor. Deleted with its validator rule. The two path keys stay present in every config, now with a comment explaining why: removing them would strand un-migrated data on a node that has not yet started once. Both relaxations are pinned by the inverse of the test they replace (Site_MissingSiteDbPath_IsAccepted..., EmptySqliteDbPath_IsAccepted...), each verified to fail with the old rule restored. Note: deploy/wonder-app-vd03/appsettings.Site.json is under a gitignored deploy/ tree, so its edit is local-only and must be repeated on the box. Claude-Session: https://claude.ai/code/session_01BL2Vu1ESDQ9SCN4gVKkdts
39 lines
1.3 KiB
C#
39 lines
1.3 KiB
C#
namespace ZB.MOM.WW.ScadaBridge.StoreAndForward.Tests;
|
|
|
|
/// <summary>
|
|
/// WP-9: Tests for StoreAndForwardOptions defaults and configuration.
|
|
/// </summary>
|
|
public class StoreAndForwardOptionsTests
|
|
{
|
|
[Fact]
|
|
public void DefaultOptions_HasReasonableDefaults()
|
|
{
|
|
var options = new StoreAndForwardOptions();
|
|
|
|
Assert.Equal("./data/store-and-forward.db", options.SqliteDbPath);
|
|
Assert.Equal(TimeSpan.FromSeconds(30), options.DefaultRetryInterval);
|
|
Assert.Equal(50, options.DefaultMaxRetries);
|
|
Assert.Equal(TimeSpan.FromSeconds(10), options.RetryTimerInterval);
|
|
}
|
|
|
|
[Fact]
|
|
public void Options_CanBeCustomized()
|
|
{
|
|
var options = new StoreAndForwardOptions
|
|
{
|
|
SqliteDbPath = "/custom/path.db",
|
|
DefaultRetryInterval = TimeSpan.FromMinutes(5),
|
|
DefaultMaxRetries = 100,
|
|
RetryTimerInterval = TimeSpan.FromSeconds(30)
|
|
};
|
|
|
|
Assert.Equal("/custom/path.db", options.SqliteDbPath);
|
|
Assert.Equal(TimeSpan.FromMinutes(5), options.DefaultRetryInterval);
|
|
Assert.Equal(100, options.DefaultMaxRetries);
|
|
}
|
|
|
|
[Fact]
|
|
public void SweepBatchLimit_Defaults_To_500() =>
|
|
Assert.Equal(500, new StoreAndForwardOptions().SweepBatchLimit);
|
|
}
|