Skip to content

Commit 2dfdbdd

Browse files
committed
flush cluster topology after test completion
1 parent 0fb2308 commit 2dfdbdd

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ services:
2727
environment:
2828
- NODES=6
2929
- PORT=16600
30-
command: ${REDIS_EXTRA_ARGS:--cluster-enabled yes ""}
30+
command: "--cluster-enabled yes"
3131
ports:
3232
- "16600-16605:16600-16605"
3333
volumes:

osscluster_test.go

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,19 @@ func (s *clusterScenario) newClusterClient(
8787
}
8888

8989
func (s *clusterScenario) Close() error {
90+
91+
for _, master := range s.masters() {
92+
err := master.FlushAll(ctx).Err()
93+
if err != nil {
94+
return err
95+
}
96+
// since 7.2 forget calls should be propagated, calling only master
97+
// nodes should be sufficient.
98+
for _, nID := range s.nodeIDs {
99+
master.ClusterForget(ctx, nID)
100+
}
101+
}
102+
90103
for _, port := range s.ports {
91104
if process, ok := processes[port]; ok {
92105
process.Close()
@@ -1147,7 +1160,7 @@ var _ = Describe("ClusterClient", func() {
11471160
client, err := client.SlaveForKey(ctx, "test")
11481161
Expect(err).ToNot(HaveOccurred())
11491162
info := client.Info(ctx, "server")
1150-
Expect(info.Val()).Should(ContainSubstring("tcp_port:16602"))
1163+
Expect(info.Val()).Should(ContainSubstring("tcp_port:16604"))
11511164
})
11521165

11531166
It("should return correct master for key", func() {

0 commit comments

Comments
 (0)