( ctx context.Context, opt *redis.ClusterOptions, )
| 60 | } |
| 61 | |
| 62 | func (s *clusterScenario) newClusterClient( |
| 63 | ctx context.Context, opt *redis.ClusterOptions, |
| 64 | ) *redis.ClusterClient { |
| 65 | client := s.newClusterClientUnstable(opt) |
| 66 | client.SetCommandInfoResolver(client.NewDynamicResolver()) |
| 67 | err := eventually(func() error { |
| 68 | if opt.ClusterSlots != nil { |
| 69 | return nil |
| 70 | } |
| 71 | |
| 72 | state, err := client.LoadState(ctx) |
| 73 | if err != nil { |
| 74 | return err |
| 75 | } |
| 76 | |
| 77 | if !state.IsConsistent(ctx) { |
| 78 | return fmt.Errorf("cluster state is not consistent") |
| 79 | } |
| 80 | |
| 81 | return nil |
| 82 | }, 30*time.Second) |
| 83 | if err != nil { |
| 84 | panic(err) |
| 85 | } |
| 86 | |
| 87 | return client |
| 88 | } |
| 89 | |
| 90 | func (s *clusterScenario) Close() error { |
| 91 | ctx := context.TODO() |
no test coverage detected