Skip to content

Commit 85c9953

Browse files
committed
Add fixes
1 parent c6e9ca4 commit 85c9953

File tree

2 files changed

+18
-3
lines changed

2 files changed

+18
-3
lines changed

tests/NRedisStack.Tests/AbstractNRedisStackTest.cs

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ public abstract class AbstractNRedisStackTest : IClassFixture<EndpointsFixture>,
1212
protected readonly ConfigurationOptions DefaultConnectionConfig = new()
1313
{
1414
AsyncTimeout = 10000,
15-
SyncTimeout = 10000
15+
SyncTimeout = 10000,
16+
AllowAdmin = true,
1617
};
1718

1819
protected internal AbstractNRedisStackTest(EndpointsFixture endpointsFixture)
@@ -33,7 +34,21 @@ protected IDatabase GetDatabase(string endpointId = EndpointsFixture.Env.Standal
3334

3435
protected IDatabase GetCleanDatabase(string endpointId = EndpointsFixture.Env.Standalone)
3536
{
36-
IDatabase db = GetDatabase(endpointId);
37+
var redis = GetConnection(endpointId);
38+
39+
if (endpointId == EndpointsFixture.Env.Cluster)
40+
{
41+
foreach (var endPoint in redis.GetEndPoints())
42+
{
43+
var server = redis.GetServer(endPoint);
44+
45+
if (server.IsReplica) continue;
46+
47+
server.Execute("FLUSHALL");
48+
}
49+
}
50+
51+
IDatabase db = redis.GetDatabase();
3752
db.Execute("FLUSHALL");
3853
return db;
3954
}

tests/dockers/docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ services:
3030
- TLS_ENABLED=yes
3131
- PORT=16379
3232
- TLS_PORT=27379
33-
command: ${REDIS_EXTRA_ARGS:---enable-debug-command yes --enable-module-command yes --tls-auth-clients optional --save ""}
33+
command: ${REDIS_EXTRA_ARGS:---enable-debug-command yes --enable-module-command yes --tls-auth-clients optional --save "" --cluster-announce-ip 127.0.0.1}
3434
ports:
3535
- "16379-16384:16379-16384"
3636
- "27379-27384:27379-27384"

0 commit comments

Comments
 (0)