forked from redis/NRedisStack
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCommunityEditionUpdatesTests.cs
113 lines (77 loc) · 3.9 KB
/
CommunityEditionUpdatesTests.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
using StackExchange.Redis;
using Xunit;
namespace NRedisStack.Tests;
public class CommunityEditionUpdatesTests : AbstractNRedisStackTest, IDisposable
{
public CommunityEditionUpdatesTests(EndpointsFixture endpointsFixture) : base(endpointsFixture) { }
private IServer getAnyPrimary(IConnectionMultiplexer muxer)
{
foreach (var endpoint in muxer.GetEndPoints())
{
var server = muxer.GetServer(endpoint);
if (!server.IsReplica) return server;
}
throw new InvalidOperationException("Requires a primary endpoint (found none)");
}
[SkipIfRedis(Comparison.LessThan, "7.9.0")]
[MemberData(nameof(EndpointsFixture.Env.AllEnvironments), MemberType = typeof(EndpointsFixture.Env))]
public void ConfigSearchSettings(string endpointId)
{
IDatabase db = GetCleanDatabase(endpointId);
IConnectionMultiplexer muxer = db.Multiplexer;
IServer server = getAnyPrimary(muxer);
server.ConfigSet("search-on-timeout", "fail");
Assert.Equal("fail", server.ConfigGet("search-on-timeout").First().Value);
server.ConfigSet("search-on-timeout", "return");
Assert.Single(server.ConfigGet("search-min-prefix"));
Assert.Single(server.ConfigGet("search-max-prefix-expansions"));
Assert.Single(server.ConfigGet("search-max-doctablesize"));
Assert.Single(server.ConfigGet("search-max-search-results"));
Assert.Single(server.ConfigGet("search-max-aggregate-results"));
Assert.Single(server.ConfigGet("search-friso-ini"));
Assert.Single(server.ConfigGet("search-default-dialect"));
}
[SkipIfRedis(Comparison.LessThan, "7.9.0")]
[MemberData(nameof(EndpointsFixture.Env.AllEnvironments), MemberType = typeof(EndpointsFixture.Env))]
public void ConfigTimeSeriesSettings(string endpointId)
{
IDatabase db = GetCleanDatabase(endpointId);
IConnectionMultiplexer muxer = db.Multiplexer;
IServer server = getAnyPrimary(muxer);
Assert.Single(server.ConfigGet("ts-compaction-policy"));
Assert.Single(server.ConfigGet("ts-retention-policy"));
Assert.Single(server.ConfigGet("ts-duplicate-policy"));
Assert.Single(server.ConfigGet("ts-encoding"));
Assert.Single(server.ConfigGet("ts-chunk-size-bytes"));
Assert.Single(server.ConfigGet("ts-ignore-max-time-diff"));
Assert.Single(server.ConfigGet("ts-ignore-max-val-diff"));
}
[SkipIfRedis(Comparison.LessThan, "7.9.0")]
[MemberData(nameof(EndpointsFixture.Env.AllEnvironments), MemberType = typeof(EndpointsFixture.Env))]
public void ConfigProbabilisticSettings(string endpointId)
{
IDatabase db = GetCleanDatabase(endpointId);
IConnectionMultiplexer muxer = db.Multiplexer;
IServer server = getAnyPrimary(muxer);
server.ConfigSet("bf-error-rate", "0.02");
Assert.Single(server.ConfigGet("bf-error-rate"));
Assert.Equal("0.02", server.ConfigGet("bf-error-rate").First().Value);
Assert.Single(server.ConfigGet("bf-initial-size"));
Assert.Single(server.ConfigGet("cf-max-expansions"));
Assert.Single(server.ConfigGet("bf-expansion-factor"));
Assert.Single(server.ConfigGet("cf-expansion-factor"));
Assert.Single(server.ConfigGet("cf-initial-size"));
Assert.Single(server.ConfigGet("cf-bucket-size"));
Assert.Single(server.ConfigGet("cf-max-iterations"));
}
[SkipIfRedis(Comparison.LessThan, "7.9.0")]
[MemberData(nameof(EndpointsFixture.Env.AllEnvironments), MemberType = typeof(EndpointsFixture.Env))]
public void InfoSearchSection(string endpointId)
{
IDatabase db = GetCleanDatabase(endpointId);
IConnectionMultiplexer muxer = db.Multiplexer;
IServer server = getAnyPrimary(muxer);
var searchInfo = server.Info("search");
CustomAssertions.GreaterThan(10, searchInfo.Length);
}
}