Skip to content
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
1 change: 1 addition & 0 deletions docs/ReleaseNotes.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ Current package versions:
- Add Redis 8.8 stream negative acknowledgements (`XNACK`) ([#3058 by @mgravell](https://github.com/StackExchange/StackExchange.Redis/pull/3058))
- Update experimental `GCRA` APIs and wire protocol terminology from "requests" to "tokens", to match server change ([#3051 by @mgravell](https://github.com/StackExchange/StackExchange.Redis/pull/3051))
- Add experimental `Aggregate.Count` support for sorted-set combination operations against Redis 8.8 ([#3059 by @mgravell](https://github.com/StackExchange/StackExchange.Redis/pull/3059))
- Recognize Azure Managed Redis (AMR) resources in new Azure clouds ([#3068 by @philon-msft](https://github.com/StackExchange/StackExchange.Redis/pull/3068))

## 2.12.14

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ public class AzureManagedRedisOptionsProvider : DefaultOptionsProvider
".redis.azure.net",
".redis.chinacloudapi.cn",
".redis.usgovcloudapi.net",
".redis.sovcloud-api.de",
".redis.sovcloud-api.fr",
".redisenterprise.cache.azure.net",
];

Expand Down
32 changes: 27 additions & 5 deletions tests/StackExchange.Redis.Tests/ConfigTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,9 @@ public void SslProtocols_InvalidValue()
[InlineData("contoso.redis.cache.usgovcloudapi.net:6380", true)]
[InlineData("contoso.redis.cache.sovcloud-api.de:6380", true)]
[InlineData("contoso.redis.cache.sovcloud-api.fr:6380", true)]
[InlineData("contoso.redis.cache.windows.net:6379", false)] // non-SSL port
[InlineData("contoso.redis.cache.windows.net:10000", false)] // wrong port
[InlineData("contoso.redis.cache.windows.net", false)] // no port
public void ConfigurationOptionsDefaultForAzure(string hostAndPort, bool sslShouldBeEnabled)
{
Version defaultAzureVersion = new(6, 0, 0);
Expand All @@ -149,11 +152,16 @@ public void ConfigurationOptionsDefaultForAzure(string hostAndPort, bool sslShou
[InlineData("contoso.redis.chinacloudapi.cn:10000", true)]
[InlineData("contoso.redis.usgovcloudapi.net:10000", true)]
[InlineData("contoso.redisenterprise.cache.azure.net:10000", true)]
[InlineData("contoso.REDIS.sovcloud-api.de:10000", true)] // added a few upper case chars to validate comparison
[InlineData("contoso.redis.sovcloud-api.fr:10000", true)]
[InlineData("contoso.redis.azure.net:6379", true)] // AMR port is usually 10000, assume SSL regardless
[InlineData("contoso.redis.azure.net:6380", true)] // AMR port is usually 10000, assume SSL regardless
[InlineData("contoso.redis.azure.net", true)] // no port, assume SSL
public void ConfigurationOptionsDefaultForAzureManagedRedis(string hostAndPort, bool sslShouldBeEnabled)
{
Version defaultAzureVersion = new(7, 4, 0);
Version defaultAzureManagedRedisVersion = new(7, 4, 0);
var options = ConfigurationOptions.Parse(hostAndPort);
Assert.True(options.DefaultVersion.Equals(defaultAzureVersion));
Assert.True(options.DefaultVersion.Equals(defaultAzureManagedRedisVersion));
Assert.False(options.AbortOnConnectFail);
Assert.Equal(sslShouldBeEnabled, options.Ssl);
}
Expand All @@ -166,12 +174,26 @@ public void ConfigurationOptionsForAzureWhenSpecified()
Assert.True(options.AbortOnConnectFail);
}

[Fact]
public void ConfigurationOptionsDefaultForNonAzure()
[Theory]
[InlineData("redis.contoso.com")] // no port
[InlineData("redis.contoso.com:xx")] // invalid port
[InlineData("redis.contoso.com:6379")] // valid port
[InlineData("contoso.Xredis.cache.windows.net:6380")] // almost an Azure Cache for Redis host name
[InlineData("contoso.redis.cache.windows.netX:6380")] // almost an Azure Cache for Redis host name
[InlineData("contoso.redis.cache.windows.net.X:6380")] // almost an Azure Cache for Redis host name
[InlineData("contoso.Xredis.azure.net:10000")] // almost an Azure Managed Redis host name
[InlineData("contoso.redis.azure.netX:10000")] // almost an Azure Managed Redis host name
[InlineData("contoso.redis.azure.net.X:10000")] // almost an Azure Managed Redis host name
[InlineData("contoso.redis.cache.windows.net:xx")] // Azure Cache for Redis host name with invalid port
[InlineData("contoso.redis.cache.windows.net:")] // Azure Cache for Redis host name with missing port
[InlineData("contoso.redis.azure.net:xx")] // AMR host name with invalid port
[InlineData("contoso.redis.azure.net:")] // AMR host name with missing port
public void ConfigurationOptionsDefaultForNonAzure(string hostAndPort)
{
var options = ConfigurationOptions.Parse("redis.contoso.com");
var options = ConfigurationOptions.Parse(hostAndPort);
Assert.True(options.DefaultVersion.Equals(DefaultVersion));
Assert.True(options.AbortOnConnectFail);
Assert.False(options.Ssl);
}

[Fact]
Expand Down
Loading