diff --git a/docs/ReleaseNotes.md b/docs/ReleaseNotes.md index 6b2643998..63bd07b0a 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` 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 0cb8f1a78..4f025d218 100644 --- a/src/StackExchange.Redis/ConfigurationOptions.cs +++ b/src/StackExchange.Redis/ConfigurationOptions.cs @@ -721,6 +721,8 @@ public static ConfigurationOptions Parse(string configuration, bool ignoreUnknow setClientLibrary = setClientLibrary, LibraryName = LibraryName, Protocol = Protocol, + heartbeatInterval = heartbeatInterval, + heartbeatConsistencyChecks = heartbeatConsistencyChecks, }; /// diff --git a/tests/StackExchange.Redis.Tests/ConfigTests.cs b/tests/StackExchange.Redis.Tests/ConfigTests.cs index 84a8f916b..97c48e356 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,37 @@ 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 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")); + 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", +#if !NETFRAMEWORK + "SslClientAuthenticationOptions", +#endif + "sslHost", "SslProtocols", + "syncTimeout", "tieBreaker", "Tunnel", + "user" + }, fields); + } + [Fact] public void SslProtocols_SingleValue() {