fix(host): dev site seed no longer targets the metrics port; validator rejects seed-vs-MetricsPort
This commit is contained in:
@@ -124,6 +124,14 @@ public static class StartupValidator
|
|||||||
_ => SeedNodePort(seed) != grpcPort,
|
_ => SeedNodePort(seed) != grpcPort,
|
||||||
$"entry '{seed}' must not target the gRPC port " +
|
$"entry '{seed}' must not target the gRPC port " +
|
||||||
$"({grpcPort}); seed nodes must reference Akka remoting ports");
|
$"({grpcPort}); seed nodes must reference Akka remoting ports");
|
||||||
|
|
||||||
|
// Same failure mode as the gRPC guard: the Kestrel HTTP/1.1
|
||||||
|
// metrics listener is not an Akka.Remote endpoint, so a seed on
|
||||||
|
// it dials a doomed association forever.
|
||||||
|
p.Require("ScadaBridge:Cluster:SeedNodes",
|
||||||
|
_ => SeedNodePort(seed) != metricsPort,
|
||||||
|
$"entry '{seed}' must not target the metrics port " +
|
||||||
|
$"({metricsPort}); seed nodes must reference Akka remoting ports");
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.ThrowIfInvalid();
|
.ThrowIfInvalid();
|
||||||
|
|||||||
@@ -11,9 +11,10 @@
|
|||||||
"NodeName": "node-a"
|
"NodeName": "node-a"
|
||||||
},
|
},
|
||||||
"Cluster": {
|
"Cluster": {
|
||||||
|
"_seedNodes": "Host-0xx: second entry is the FUTURE node-b remoting port (8085) for a two-node localhost site. It must be an Akka remoting endpoint — never this node's GrpcPort (8083) or MetricsPort (8084); StartupValidator rejects both.",
|
||||||
"SeedNodes": [
|
"SeedNodes": [
|
||||||
"akka.tcp://scadabridge@localhost:8082",
|
"akka.tcp://scadabridge@localhost:8082",
|
||||||
"akka.tcp://scadabridge@localhost:8084"
|
"akka.tcp://scadabridge@localhost:8085"
|
||||||
],
|
],
|
||||||
"SplitBrainResolverStrategy": "keep-oldest",
|
"SplitBrainResolverStrategy": "keep-oldest",
|
||||||
"StableAfter": "00:00:15",
|
"StableAfter": "00:00:15",
|
||||||
|
|||||||
@@ -319,6 +319,36 @@ public class StartupValidatorTests
|
|||||||
Assert.Contains("must not target the gRPC port", ex.Message);
|
Assert.Contains("must not target the gRPC port", ex.Message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void Site_SeedNodeOnMetricsPort_FailsValidation()
|
||||||
|
{
|
||||||
|
// Review 01 [Medium]: appsettings.Site.json shipped a seed pointing at the
|
||||||
|
// Kestrel HTTP/1.1 metrics listener (8084) — a doomed Akka.Remote
|
||||||
|
// association. The validator guarded GrpcPort but not MetricsPort.
|
||||||
|
var values = ValidSiteConfig();
|
||||||
|
values["ScadaBridge:Node:GrpcPort"] = "8083";
|
||||||
|
values["ScadaBridge:Node:MetricsPort"] = "8084";
|
||||||
|
values["ScadaBridge:Cluster:SeedNodes:1"] = "akka.tcp://scadabridge@site-a-node1:8084";
|
||||||
|
var config = BuildConfig(values);
|
||||||
|
|
||||||
|
var ex = Assert.Throws<InvalidOperationException>(() => StartupValidator.Validate(config));
|
||||||
|
Assert.Contains("must not target the metrics port", ex.Message);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void Site_SeedNodeOnDefaultMetricsPort_FailsValidation()
|
||||||
|
{
|
||||||
|
// MetricsPort absent => NodeOptions default 8084. A seed on 8084 must
|
||||||
|
// still be rejected. Keep GrpcPort distinct so only the metrics rule fires.
|
||||||
|
var values = ValidSiteConfig();
|
||||||
|
values["ScadaBridge:Node:GrpcPort"] = "8083";
|
||||||
|
values["ScadaBridge:Cluster:SeedNodes:1"] = "akka.tcp://scadabridge@site-a-node2:8084";
|
||||||
|
var config = BuildConfig(values);
|
||||||
|
|
||||||
|
var ex = Assert.Throws<InvalidOperationException>(() => StartupValidator.Validate(config));
|
||||||
|
Assert.Contains("must not target the metrics port", ex.Message);
|
||||||
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
public void Site_SeedNodeOnDefaultGrpcPort_FailsValidation()
|
public void Site_SeedNodeOnDefaultGrpcPort_FailsValidation()
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user