Skip to content

Commit 37111f2

Browse files
authored
Add tests to ensure we can deal with trailing $ in encoded cloud ids. (#4993)
1 parent b69cfef commit 37111f2

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

tests/Tests/ClientConcepts/ConnectionPooling/BuildingBlocks/ConnectionPooling.doc.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,17 @@ [U] public void CloudConnectionPool()
167167

168168
//hide
169169
{
170+
171+
//make sure we can deal with trailing dollar sign separators.
172+
foreach (var dollars in Enumerable.Range(0, 5).Select(i => new string('$', i)))
173+
{
174+
Func<IElasticClient> doesNotThrowWhenEndsWithDollar = () =>
175+
new ElasticClient($"my_cluster:{ToBase64($"hostname$guid{dollars}")}", credentials);
176+
177+
var validClient = doesNotThrowWhenEndsWithDollar.Should().NotThrow().Subject;
178+
validClient.ConnectionSettings.ConnectionPool.Nodes.First().Uri.Should().Be("https://guid.hostname");
179+
}
180+
170181
var badCloudIds = new[]
171182
{
172183
"",

0 commit comments

Comments
 (0)