Skip to content

Commit edbca65

Browse files
added spec to try to reproduce duplicate config section (#262)
1 parent 1f7ab13 commit edbca65

File tree

1 file changed

+59
-0
lines changed

1 file changed

+59
-0
lines changed

src/Hocon.Configuration.Test/ConfigurationSpec.cs

+59
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,65 @@ public void CanEnumerateQuotedKeys()
5959
Assert.Equal("some quoted, key", enumerable.Select(kvp => kvp.Key).First());
6060
}
6161

62+
[Fact]
63+
public void CanParseDuplicateKeys()
64+
{
65+
var hocon = @"
66+
akka{
67+
loglevel=INFO
68+
loggers=[""Akka.Logger.Serilog.SerilogLogger, Akka.Logger.Serilog""]
69+
70+
remote {
71+
log-remote-lifecycle-events = DEBUG
72+
dot-netty.tcp {
73+
port = 0
74+
hostname = localhost
75+
send-buffer-size = 60000000b
76+
receive-buffer-size = 60000000b
77+
maximum-frame-size = 30000000b
78+
}
79+
}
80+
81+
actor.provider = cluster
82+
83+
# duplicate
84+
remote {
85+
log-remote-lifecycle-events = DEBUG
86+
dot-netty.tcp {
87+
port = 0
88+
hostname = localhost
89+
send-buffer-size = 60000000b
90+
receive-buffer-size = 60000000b
91+
maximum-frame-size = 30000000b
92+
}
93+
}
94+
95+
cluster {
96+
allow-weakly-up-members = on
97+
seed-nodes = [""akka.tcp://ClusterSys@localhost:3881""]
98+
roles = [pubsub,webapi]
99+
100+
failure-detector {
101+
acceptable-heartbeat-pause=8s
102+
}
103+
104+
pub-sub {
105+
role = pubsub
106+
}
107+
downing-provider-class = ""Akka.Cluster.SplitBrainResolver, Akka.Cluster""
108+
split-brain-resolver {
109+
active-strategy = keep-majority
110+
stable-after = 30s
111+
}
112+
down-removal-margin = 30s
113+
}
114+
}
115+
";
116+
var config = HoconConfigurationFactory.ParseString(hocon);
117+
var config2 = config.GetConfig("akka.remote");
118+
config2.GetString("dot-netty.tcp.hostname").Should().Be("localhost");
119+
}
120+
62121
/// <summary>
63122
/// Should follow the load order rules specified in https://github.com/akkadotnet/HOCON/issues/151
64123
/// </summary>

0 commit comments

Comments
 (0)