Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support HeartbeatConsistencyChecks in Clone() #2658

Merged
merged 7 commits into from
Feb 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion docs/ReleaseNotes.md
Original file line number Diff line number Diff line change
Expand Up @@ -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) |
mgravell marked this conversation as resolved.
Show resolved Hide resolved

## 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

Expand Down
2 changes: 2 additions & 0 deletions src/StackExchange.Redis/ConfigurationOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -721,6 +721,8 @@ public static ConfigurationOptions Parse(string configuration, bool ignoreUnknow
setClientLibrary = setClientLibrary,
LibraryName = LibraryName,
Protocol = Protocol,
heartbeatInterval = heartbeatInterval,
heartbeatConsistencyChecks = heartbeatConsistencyChecks,
};

/// <summary>
Expand Down
37 changes: 35 additions & 2 deletions tests/StackExchange.Redis.Tests/ConfigTests.cs
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
using StackExchange.Redis.Configuration;
using Microsoft.Extensions.Logging.Abstractions;
using StackExchange.Redis.Configuration;
using System;
using System.Globalization;
using System.IO;
using System.IO.Pipelines;
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;

Expand All @@ -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()
{
Expand Down
Loading