From 7b7badcefbd70e07c5d0a42f26039b7fafaa0ae3 Mon Sep 17 00:00:00 2001 From: Marc Gravell Date: Tue, 27 Feb 2024 10:18:31 +0000 Subject: [PATCH 1/7] Support `HeartbeatConsistencyChecks` in `Clone()` --- docs/ReleaseNotes.md | 3 ++- src/StackExchange.Redis/ConfigurationOptions.cs | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/ReleaseNotes.md b/docs/ReleaseNotes.md index 6b2643998..eacd06b2b 100644 --- a/docs/ReleaseNotes.md +++ b/docs/ReleaseNotes.md @@ -7,7 +7,8 @@ Current package versions: | [![StackExchange.Redis](https://img.shields.io/nuget/v/StackExchange.Redis.svg)](https://www.nuget.org/packages/StackExchange.Redis/) | [![StackExchange.Redis](https://img.shields.io/nuget/vpre/StackExchange.Redis.svg)](https://www.nuget.org/packages/StackExchange.Redis/) | [![StackExchange.Redis MyGet](https://img.shields.io/myget/stackoverflow/vpre/StackExchange.Redis.svg)](https://www.myget.org/feed/stackoverflow/package/nuget/StackExchange.Redis) | ## Unreleased -No pending unreleased changes. + +- Support `HeartbeatConsistencyChecks` in `Clone()` ([#2657 by mgravell](https://github.com/StackExchange/StackExchange.Redis/pull/2657)) ## 2.7.23 diff --git a/src/StackExchange.Redis/ConfigurationOptions.cs b/src/StackExchange.Redis/ConfigurationOptions.cs index 0cb8f1a78..deffaa4dd 100644 --- a/src/StackExchange.Redis/ConfigurationOptions.cs +++ b/src/StackExchange.Redis/ConfigurationOptions.cs @@ -721,6 +721,7 @@ public static ConfigurationOptions Parse(string configuration, bool ignoreUnknow setClientLibrary = setClientLibrary, LibraryName = LibraryName, Protocol = Protocol, + heartbeatConsistencyChecks = heartbeatConsistencyChecks, }; /// From 8e610b5115875290f9604a21883ff87aef275b85 Mon Sep 17 00:00:00 2001 From: Marc Gravell Date: Tue, 27 Feb 2024 10:19:15 +0000 Subject: [PATCH 2/7] fix PR number --- docs/ReleaseNotes.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/ReleaseNotes.md b/docs/ReleaseNotes.md index eacd06b2b..45b705598 100644 --- a/docs/ReleaseNotes.md +++ b/docs/ReleaseNotes.md @@ -8,7 +8,7 @@ Current package versions: ## Unreleased -- Support `HeartbeatConsistencyChecks` in `Clone()` ([#2657 by mgravell](https://github.com/StackExchange/StackExchange.Redis/pull/2657)) +- Support `HeartbeatConsistencyChecks` in `Clone()` ([#2658 by mgravell](https://github.com/StackExchange/StackExchange.Redis/pull/2658)) ## 2.7.23 From f197e0eede12e2da96248a28c693ccb8b4cf2f51 Mon Sep 17 00:00:00 2001 From: Marc Gravell Date: Tue, 27 Feb 2024 11:44:52 +0000 Subject: [PATCH 3/7] include heartbeatInterval --- docs/ReleaseNotes.md | 2 +- src/StackExchange.Redis/ConfigurationOptions.cs | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/ReleaseNotes.md b/docs/ReleaseNotes.md index 45b705598..63bd07b0a 100644 --- a/docs/ReleaseNotes.md +++ b/docs/ReleaseNotes.md @@ -8,7 +8,7 @@ Current package versions: ## Unreleased -- Support `HeartbeatConsistencyChecks` in `Clone()` ([#2658 by mgravell](https://github.com/StackExchange/StackExchange.Redis/pull/2658)) +- Support `HeartbeatConsistencyChecks` and `HeartbeatInterval` in `Clone()` ([#2658 by mgravell](https://github.com/StackExchange/StackExchange.Redis/pull/2658)) ## 2.7.23 diff --git a/src/StackExchange.Redis/ConfigurationOptions.cs b/src/StackExchange.Redis/ConfigurationOptions.cs index deffaa4dd..4f025d218 100644 --- a/src/StackExchange.Redis/ConfigurationOptions.cs +++ b/src/StackExchange.Redis/ConfigurationOptions.cs @@ -721,6 +721,7 @@ public static ConfigurationOptions Parse(string configuration, bool ignoreUnknow setClientLibrary = setClientLibrary, LibraryName = LibraryName, Protocol = Protocol, + heartbeatInterval = heartbeatInterval, heartbeatConsistencyChecks = heartbeatConsistencyChecks, }; From 2a624a241dfcc8c27fd1ab62f1a5a6d4e5a0095b Mon Sep 17 00:00:00 2001 From: Marc Gravell Date: Tue, 27 Feb 2024 12:01:17 +0000 Subject: [PATCH 4/7] check ConfigurationOptions fields --- .../StackExchange.Redis.Tests/ConfigTests.cs | 33 +++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) diff --git a/tests/StackExchange.Redis.Tests/ConfigTests.cs b/tests/StackExchange.Redis.Tests/ConfigTests.cs index 84a8f916b..80af4eede 100644 --- a/tests/StackExchange.Redis.Tests/ConfigTests.cs +++ b/tests/StackExchange.Redis.Tests/ConfigTests.cs @@ -1,4 +1,5 @@ -using StackExchange.Redis.Configuration; +using Microsoft.Extensions.Logging.Abstractions; +using StackExchange.Redis.Configuration; using System; using System.Globalization; using System.IO; @@ -6,11 +7,12 @@ using System.Linq; using System.Net; using System.Net.Sockets; +using System.Reflection; using System.Security.Authentication; using System.Text; +using System.Text.RegularExpressions; using System.Threading; using System.Threading.Tasks; -using Microsoft.Extensions.Logging.Abstractions; using Xunit; using Xunit.Abstractions; @@ -25,6 +27,33 @@ public ConfigTests(ITestOutputHelper output, SharedConnectionFixture fixture) : public Version DefaultVersion = new (3, 0, 0); public Version DefaultAzureVersion = new (4, 0, 0); + [Fact] + public void ExpectedFields() + { + // if this test fails: check that you've updated ConfigurationOptions.Clone(), then: fix the test! + // this is simple but pragmatic "have you considered?" check + + var fields = Array.ConvertAll(typeof(ConfigurationOptions).GetFields(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance), + x => Regex.Replace(x.Name, """<(\w+)>k__BackingField""", "$1")); + Array.Sort(fields); + Assert.Equal(new[] { + "abortOnConnectFail", "allowAdmin", "asyncTimeout", "backlogPolicy", "BeforeSocketConnect", + "CertificateSelection", "CertificateValidation", "ChannelPrefix", + "checkCertificateRevocation", "ClientName", "commandMap", + "configChannel", "configCheckSeconds", "connectRetry", + "connectTimeout", "DefaultDatabase", "defaultOptions", + "defaultVersion", "EndPoints", "heartbeatConsistencyChecks", + "heartbeatInterval", "includeDetailInExceptions", "includePerformanceCountersInExceptions", + "keepAlive", "LibraryName", "loggerFactory", + "password", "Protocol", "proxy", + "reconnectRetryPolicy", "resolveDns", "responseTimeout", + "ServiceName", "setClientLibrary", "SocketManager", + "ssl", "sslHost", "SslProtocols", + "syncTimeout", "tieBreaker", "Tunnel", + "user" + }, fields); + } + [Fact] public void SslProtocols_SingleValue() { From 0a73e8ef811e674bf57ee4608ba6b589598f9927 Mon Sep 17 00:00:00 2001 From: Marc Gravell Date: Tue, 27 Feb 2024 12:02:20 +0000 Subject: [PATCH 5/7] nit --- tests/StackExchange.Redis.Tests/ConfigTests.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/StackExchange.Redis.Tests/ConfigTests.cs b/tests/StackExchange.Redis.Tests/ConfigTests.cs index 80af4eede..3fed8cc2e 100644 --- a/tests/StackExchange.Redis.Tests/ConfigTests.cs +++ b/tests/StackExchange.Redis.Tests/ConfigTests.cs @@ -30,8 +30,8 @@ public ConfigTests(ITestOutputHelper output, SharedConnectionFixture fixture) : [Fact] public void ExpectedFields() { - // if this test fails: check that you've updated ConfigurationOptions.Clone(), then: fix the test! - // this is simple but pragmatic "have you considered?" check + // if this test fails, check that you've updated ConfigurationOptions.Clone(), then: fix the test! + // this is a simple but pragmatic "have you considered?" check var fields = Array.ConvertAll(typeof(ConfigurationOptions).GetFields(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance), x => Regex.Replace(x.Name, """<(\w+)>k__BackingField""", "$1")); From efcd8ab45972c569543ed0621d668d3a534221a9 Mon Sep 17 00:00:00 2001 From: Marc Gravell Date: Tue, 27 Feb 2024 12:13:14 +0000 Subject: [PATCH 6/7] we have non-netfx options --- tests/StackExchange.Redis.Tests/ConfigTests.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tests/StackExchange.Redis.Tests/ConfigTests.cs b/tests/StackExchange.Redis.Tests/ConfigTests.cs index 3fed8cc2e..89caa6b7f 100644 --- a/tests/StackExchange.Redis.Tests/ConfigTests.cs +++ b/tests/StackExchange.Redis.Tests/ConfigTests.cs @@ -6,6 +6,7 @@ using System.IO.Pipelines; using System.Linq; using System.Net; +using System.Net.Security; using System.Net.Sockets; using System.Reflection; using System.Security.Authentication; @@ -48,7 +49,11 @@ public void ExpectedFields() "password", "Protocol", "proxy", "reconnectRetryPolicy", "resolveDns", "responseTimeout", "ServiceName", "setClientLibrary", "SocketManager", - "ssl", "sslHost", "SslProtocols", + "ssl", +#if !NETFRAMEWORK + "SslClientAuthenticationOptions", +#endif + "sslHost", "SslProtocols", "syncTimeout", "tieBreaker", "Tunnel", "user" }, fields); From 95fa05132413638523ca08fea318899e6ea16702 Mon Sep 17 00:00:00 2001 From: Marc Gravell Date: Tue, 27 Feb 2024 12:21:34 +0000 Subject: [PATCH 7/7] moar nits --- tests/StackExchange.Redis.Tests/ConfigTests.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/StackExchange.Redis.Tests/ConfigTests.cs b/tests/StackExchange.Redis.Tests/ConfigTests.cs index 89caa6b7f..97c48e356 100644 --- a/tests/StackExchange.Redis.Tests/ConfigTests.cs +++ b/tests/StackExchange.Redis.Tests/ConfigTests.cs @@ -6,7 +6,6 @@ using System.IO.Pipelines; using System.Linq; using System.Net; -using System.Net.Security; using System.Net.Sockets; using System.Reflection; using System.Security.Authentication; @@ -35,7 +34,7 @@ public void ExpectedFields() // this is a simple but pragmatic "have you considered?" check var fields = Array.ConvertAll(typeof(ConfigurationOptions).GetFields(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance), - x => Regex.Replace(x.Name, """<(\w+)>k__BackingField""", "$1")); + x => Regex.Replace(x.Name, """^<(\w+)>k__BackingField$""", "$1")); Array.Sort(fields); Assert.Equal(new[] { "abortOnConnectFail", "allowAdmin", "asyncTimeout", "backlogPolicy", "BeforeSocketConnect",