Skip to content
This repository was archived by the owner on Dec 24, 2022. It is now read-only.

Commit 2aecfb1

Browse files
committed
Add example of Redis password tests
1 parent 01d8c72 commit 2aecfb1

File tree

3 files changed

+31
-1
lines changed

3 files changed

+31
-1
lines changed

src/ServiceStack.Redis/ServiceStack.Redis.Signed.csproj

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,12 +163,15 @@
163163
<Compile Include="Generic\RedisTypedCommandQueue.cs" />
164164
<Compile Include="IRedisClientFactory.cs" />
165165
<Compile Include="IRedisFailover.cs" />
166+
<Compile Include="IRedisSentinel.cs" />
166167
<Compile Include="RedisClientManagerCacheClient.cs" />
167168
<Compile Include="RedisClientsManagerExtensions.cs" />
168169
<Compile Include="Pipeline\QueuedRedisCommand.cs" />
169170
<Compile Include="Pipeline\RedisCommand.cs" />
170171
<Compile Include="RedisClient_Slowlog.cs" />
171172
<Compile Include="RedisEndpoint.cs" />
173+
<Compile Include="RedisSentinel.cs" />
174+
<Compile Include="RedisSentinelWorker.cs" />
172175
<Compile Include="ScanResult.cs" />
173176
<Compile Include="ShardedConnectionPool.cs" />
174177
<Compile Include="ShardedRedisClientManager.cs" />
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
using NUnit.Framework;
2+
3+
namespace ServiceStack.Redis.Tests
4+
{
5+
[Explicit("Integration")]
6+
[TestFixture]
7+
public class RedisPasswordTests
8+
{
9+
[Test]
10+
public void Can_connect_to_Slaves_and_Masters_with_Password()
11+
{
12+
var factory = new PooledRedisClientManager(
13+
readWriteHosts: new[] { "pass@10.0.0.59:6379" },
14+
readOnlyHosts: new[] { "pass@10.0.0.59:6380" });
15+
16+
using (var readWrite = factory.GetClient())
17+
using (var readOnly = factory.GetReadOnlyClient())
18+
{
19+
readWrite.SetEntry("Foo", "Bar");
20+
var value = readOnly.GetEntry("Foo");
21+
22+
Assert.That(value, Is.EqualTo("Bar"));
23+
}
24+
}
25+
}
26+
}

tests/ServiceStack.Redis.Tests/ServiceStack.Redis.Tests.csproj

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,7 @@
194194
<Compile Include="RedisClientEvalTests.cs" />
195195
<Compile Include="RedisClientsManagerExtensionsTests.cs" />
196196
<Compile Include="RedisHyperLogTests.cs" />
197+
<Compile Include="RedisPasswordTests.cs" />
197198
<Compile Include="RedisPipelineCommonTests.cs" />
198199
<Compile Include="RedisPipelineTests.cs" />
199200
<Compile Include="Examples\BestPractice\IBlogRepository.cs" />
@@ -316,4 +317,4 @@
316317
<Target Name="AfterBuild">
317318
</Target>
318319
-->
319-
</Project>
320+
</Project>

0 commit comments

Comments
 (0)