mirror of
https://github.com/redis/go-redis.git
synced 2026-10-28 08:24:54 +08:00
test(cluster): skip unknown-endpoint spec before 8.4 (#4215)
* test(cluster): skip unknown-endpoint spec before 8.4 On Redis 8.0 and 8.2 the cluster nodes segfault in a module timer shortly after cluster-preferred-endpoint-type is set to unknown-endpoint. The spec restores the setting quickly, so it only fails when the timer fires inside that window, but then every later cluster spec hits a dead cluster. * test(cluster): guard unknown-endpoint teardown on skip
This commit is contained in:
1 parent
c9092ec492
commit
470a926a08
1 file changed
+13
-3
+13
-3
@@ -2085,6 +2085,11 @@ var _ = Describe("ClusterClient with unknown-endpoint", func() {
|
||||
var saved map[string]string
|
||||
|
||||
BeforeEach(func() {
|
||||
client, saved = nil, nil
|
||||
// Redis 8.0 and 8.2 cluster nodes segfault in a module timer
|
||||
// shortly after this setting is applied, which takes down the
|
||||
// shared test cluster for every later spec.
|
||||
SkipBeforeRedisVersion("8.4", "cluster nodes crash with unknown-endpoint")
|
||||
saved = map[string]string{}
|
||||
for port, node := range cluster.clients {
|
||||
old, err := node.ConfigGet(ctx, param).Result()
|
||||
@@ -2096,12 +2101,17 @@ var _ = Describe("ClusterClient with unknown-endpoint", func() {
|
||||
})
|
||||
|
||||
AfterEach(func() {
|
||||
_ = client.ForEachMaster(ctx, func(ctx context.Context, master *redis.Client) error {
|
||||
return master.FlushDB(ctx).Err()
|
||||
})
|
||||
// Restore the setting even if BeforeEach failed before the client
|
||||
// was built; AfterEach also runs after the version skip.
|
||||
for port, value := range saved {
|
||||
Expect(cluster.clients[port].ConfigSet(ctx, param, value).Err()).NotTo(HaveOccurred())
|
||||
}
|
||||
if client == nil {
|
||||
return
|
||||
}
|
||||
_ = client.ForEachMaster(ctx, func(ctx context.Context, master *redis.Client) error {
|
||||
return master.FlushDB(ctx).Err()
|
||||
})
|
||||
Expect(client.Close()).NotTo(HaveOccurred())
|
||||
})
|
||||
|
||||
|
||||
Reference in new issue
Block a user