Skip to content

Commit d8955ab

Browse files
committed
Fix flaky test due to sorting issue
Signed-off-by: Emmanuel Lodovice <[email protected]>
1 parent daf1f83 commit d8955ab

File tree

2 files changed

+48
-45
lines changed

2 files changed

+48
-45
lines changed

pkg/ring/ring_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -987,6 +987,7 @@ func TestRing_GetAllInstanceDescs(t *testing.T) {
987987
require.EqualValues(t, []InstanceDesc{
988988
{Addr: "127.0.0.1", Tokens: []uint32{1}, State: ACTIVE, Timestamp: now},
989989
}, healthyInstanceDescs)
990+
sort.Slice(unhealthyInstanceDescs, func(i, j int) bool { return unhealthyInstanceDescs[i].Addr < unhealthyInstanceDescs[j].Addr })
990991
require.EqualValues(t, []InstanceDesc{
991992
{Addr: "127.0.0.2", Tokens: []uint32{2}, State: LEAVING, Timestamp: now},
992993
{Addr: "127.0.0.3", Tokens: []uint32{3}, State: ACTIVE, Timestamp: twoMinutesAgo},

pkg/ruler/ruler_ring_test.go

Lines changed: 47 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ import (
1919
func TestGetReplicationSetForListRule(t *testing.T) {
2020
now := time.Now()
2121

22+
g := ring.NewRandomTokenGenerator()
23+
2224
tests := map[string]struct {
2325
ringInstances map[string]ring.InstanceDesc
2426
ringHeartbeatTimeout time.Duration
@@ -38,31 +40,31 @@ func TestGetReplicationSetForListRule(t *testing.T) {
3840
},
3941
"should succeed on all healthy instances and RF=1": {
4042
ringInstances: map[string]ring.InstanceDesc{
41-
"instance-1": {Addr: "127.0.0.1", State: ring.ACTIVE, Timestamp: now.Unix(), Tokens: ring.GenerateTokens(128, nil)},
42-
"instance-2": {Addr: "127.0.0.2", State: ring.ACTIVE, Timestamp: now.Add(-10 * time.Second).Unix(), Tokens: ring.GenerateTokens(128, nil)},
43-
"instance-3": {Addr: "127.0.0.3", State: ring.ACTIVE, Timestamp: now.Add(-20 * time.Second).Unix(), Tokens: ring.GenerateTokens(128, nil)},
43+
"instance-1": {Addr: "127.0.0.1", State: ring.ACTIVE, Timestamp: now.Unix(), Tokens: g.GenerateTokens(ring.NewDesc(), "instance-1", "", 128, true)},
44+
"instance-2": {Addr: "127.0.0.2", State: ring.ACTIVE, Timestamp: now.Add(-10 * time.Second).Unix(), Tokens: g.GenerateTokens(ring.NewDesc(), "instance-2", "", 128, true)},
45+
"instance-3": {Addr: "127.0.0.3", State: ring.ACTIVE, Timestamp: now.Add(-20 * time.Second).Unix(), Tokens: g.GenerateTokens(ring.NewDesc(), "instance-3", "", 128, true)},
4446
},
4547
ringHeartbeatTimeout: time.Minute,
4648
ringReplicationFactor: 1,
4749
expectedSet: []string{"127.0.0.1", "127.0.0.2", "127.0.0.3"},
4850
},
4951
"should fail on 1 unhealthy instance and RF=1": {
5052
ringInstances: map[string]ring.InstanceDesc{
51-
"instance-1": {Addr: "127.0.0.1", State: ring.ACTIVE, Timestamp: now.Unix(), Tokens: ring.GenerateTokens(128, nil)},
52-
"instance-2": {Addr: "127.0.0.2", State: ring.ACTIVE, Timestamp: now.Add(-10 * time.Second).Unix(), Tokens: ring.GenerateTokens(128, nil)},
53-
"instance-3": {Addr: "127.0.0.3", State: ring.ACTIVE, Timestamp: now.Add(-20 * time.Second).Unix(), Tokens: ring.GenerateTokens(128, nil)},
54-
"instance-4": {Addr: "127.0.0.4", State: ring.ACTIVE, Timestamp: now.Add(-2 * time.Minute).Unix(), Tokens: ring.GenerateTokens(128, nil)},
53+
"instance-1": {Addr: "127.0.0.1", State: ring.ACTIVE, Timestamp: now.Unix(), Tokens: g.GenerateTokens(ring.NewDesc(), "instance-1", "", 128, true)},
54+
"instance-2": {Addr: "127.0.0.2", State: ring.ACTIVE, Timestamp: now.Add(-10 * time.Second).Unix(), Tokens: g.GenerateTokens(ring.NewDesc(), "instance-2", "", 128, true)},
55+
"instance-3": {Addr: "127.0.0.3", State: ring.ACTIVE, Timestamp: now.Add(-20 * time.Second).Unix(), Tokens: g.GenerateTokens(ring.NewDesc(), "instance-3", "", 128, true)},
56+
"instance-4": {Addr: "127.0.0.4", State: ring.ACTIVE, Timestamp: now.Add(-2 * time.Minute).Unix(), Tokens: g.GenerateTokens(ring.NewDesc(), "instance-4", "", 128, true)},
5557
},
5658
ringHeartbeatTimeout: time.Minute,
5759
ringReplicationFactor: 1,
5860
expectedErr: ring.ErrTooManyUnhealthyInstances,
5961
},
6062
"should succeed on 1 unhealthy instances and RF=3": {
6163
ringInstances: map[string]ring.InstanceDesc{
62-
"instance-1": {Addr: "127.0.0.1", State: ring.ACTIVE, Timestamp: now.Unix(), Tokens: ring.GenerateTokens(128, nil)},
63-
"instance-2": {Addr: "127.0.0.2", State: ring.ACTIVE, Timestamp: now.Add(-10 * time.Second).Unix(), Tokens: ring.GenerateTokens(128, nil)},
64-
"instance-3": {Addr: "127.0.0.3", State: ring.ACTIVE, Timestamp: now.Add(-20 * time.Second).Unix(), Tokens: ring.GenerateTokens(128, nil)},
65-
"instance-4": {Addr: "127.0.0.4", State: ring.ACTIVE, Timestamp: now.Add(-2 * time.Minute).Unix(), Tokens: ring.GenerateTokens(128, nil)},
64+
"instance-1": {Addr: "127.0.0.1", State: ring.ACTIVE, Timestamp: now.Unix(), Tokens: g.GenerateTokens(ring.NewDesc(), "instance-1", "", 128, true)},
65+
"instance-2": {Addr: "127.0.0.2", State: ring.ACTIVE, Timestamp: now.Add(-10 * time.Second).Unix(), Tokens: g.GenerateTokens(ring.NewDesc(), "instance-2", "", 128, true)},
66+
"instance-3": {Addr: "127.0.0.3", State: ring.ACTIVE, Timestamp: now.Add(-20 * time.Second).Unix(), Tokens: g.GenerateTokens(ring.NewDesc(), "instance-3", "", 128, true)},
67+
"instance-4": {Addr: "127.0.0.4", State: ring.ACTIVE, Timestamp: now.Add(-2 * time.Minute).Unix(), Tokens: g.GenerateTokens(ring.NewDesc(), "instance-4", "", 128, true)},
6668
},
6769
ringHeartbeatTimeout: time.Minute,
6870
ringReplicationFactor: 3,
@@ -71,11 +73,11 @@ func TestGetReplicationSetForListRule(t *testing.T) {
7173
},
7274
"should succeed on 2 unhealthy instances and RF=3": {
7375
ringInstances: map[string]ring.InstanceDesc{
74-
"instance-1": {Addr: "127.0.0.1", State: ring.ACTIVE, Timestamp: now.Unix(), Tokens: ring.GenerateTokens(128, nil)},
75-
"instance-2": {Addr: "127.0.0.2", State: ring.ACTIVE, Timestamp: now.Add(-10 * time.Second).Unix(), Tokens: ring.GenerateTokens(128, nil)},
76-
"instance-3": {Addr: "127.0.0.3", State: ring.ACTIVE, Timestamp: now.Add(-20 * time.Second).Unix(), Tokens: ring.GenerateTokens(128, nil)},
77-
"instance-4": {Addr: "127.0.0.4", State: ring.ACTIVE, Timestamp: now.Add(-2 * time.Minute).Unix(), Tokens: ring.GenerateTokens(128, nil)},
78-
"instance-5": {Addr: "127.0.0.5", State: ring.ACTIVE, Timestamp: now.Add(-2 * time.Minute).Unix(), Tokens: ring.GenerateTokens(128, nil)},
76+
"instance-1": {Addr: "127.0.0.1", State: ring.ACTIVE, Timestamp: now.Unix(), Tokens: g.GenerateTokens(ring.NewDesc(), "instance-1", "", 128, true)},
77+
"instance-2": {Addr: "127.0.0.2", State: ring.ACTIVE, Timestamp: now.Add(-10 * time.Second).Unix(), Tokens: g.GenerateTokens(ring.NewDesc(), "instance-2", "", 128, true)},
78+
"instance-3": {Addr: "127.0.0.3", State: ring.ACTIVE, Timestamp: now.Add(-20 * time.Second).Unix(), Tokens: g.GenerateTokens(ring.NewDesc(), "instance-3", "", 128, true)},
79+
"instance-4": {Addr: "127.0.0.4", State: ring.ACTIVE, Timestamp: now.Add(-2 * time.Minute).Unix(), Tokens: g.GenerateTokens(ring.NewDesc(), "instance-4", "", 128, true)},
80+
"instance-5": {Addr: "127.0.0.5", State: ring.ACTIVE, Timestamp: now.Add(-2 * time.Minute).Unix(), Tokens: g.GenerateTokens(ring.NewDesc(), "instance-5", "", 128, true)},
7981
},
8082
ringHeartbeatTimeout: time.Minute,
8183
ringReplicationFactor: 3,
@@ -84,22 +86,22 @@ func TestGetReplicationSetForListRule(t *testing.T) {
8486
},
8587
"should fail on 3 unhealthy instances and RF=3": {
8688
ringInstances: map[string]ring.InstanceDesc{
87-
"instance-1": {Addr: "127.0.0.1", State: ring.ACTIVE, Timestamp: now.Unix(), Tokens: ring.GenerateTokens(128, nil)},
88-
"instance-2": {Addr: "127.0.0.2", State: ring.ACTIVE, Timestamp: now.Add(-10 * time.Second).Unix(), Tokens: ring.GenerateTokens(128, nil)},
89-
"instance-3": {Addr: "127.0.0.3", State: ring.ACTIVE, Timestamp: now.Add(-2 * time.Minute).Unix(), Tokens: ring.GenerateTokens(128, nil)},
90-
"instance-4": {Addr: "127.0.0.4", State: ring.ACTIVE, Timestamp: now.Add(-2 * time.Minute).Unix(), Tokens: ring.GenerateTokens(128, nil)},
91-
"instance-5": {Addr: "127.0.0.5", State: ring.ACTIVE, Timestamp: now.Add(-2 * time.Minute).Unix(), Tokens: ring.GenerateTokens(128, nil)},
89+
"instance-1": {Addr: "127.0.0.1", State: ring.ACTIVE, Timestamp: now.Unix(), Tokens: g.GenerateTokens(ring.NewDesc(), "instance-1", "", 128, true)},
90+
"instance-2": {Addr: "127.0.0.2", State: ring.ACTIVE, Timestamp: now.Add(-10 * time.Second).Unix(), Tokens: g.GenerateTokens(ring.NewDesc(), "instance-2", "", 128, true)},
91+
"instance-3": {Addr: "127.0.0.3", State: ring.ACTIVE, Timestamp: now.Add(-2 * time.Minute).Unix(), Tokens: g.GenerateTokens(ring.NewDesc(), "instance-3", "", 128, true)},
92+
"instance-4": {Addr: "127.0.0.4", State: ring.ACTIVE, Timestamp: now.Add(-2 * time.Minute).Unix(), Tokens: g.GenerateTokens(ring.NewDesc(), "instance-4", "", 128, true)},
93+
"instance-5": {Addr: "127.0.0.5", State: ring.ACTIVE, Timestamp: now.Add(-2 * time.Minute).Unix(), Tokens: g.GenerateTokens(ring.NewDesc(), "instance-5", "", 128, true)},
9294
},
9395
ringHeartbeatTimeout: time.Minute,
9496
ringReplicationFactor: 3,
9597
expectedErr: ring.ErrTooManyUnhealthyInstances,
9698
},
9799
"should succeed on 0 unhealthy instances and RF=3 zone replication enabled": {
98100
ringInstances: map[string]ring.InstanceDesc{
99-
"instance-1": {Addr: "127.0.0.1", State: ring.ACTIVE, Timestamp: now.Unix(), Tokens: ring.GenerateTokens(128, nil), Zone: "z1"},
100-
"instance-2": {Addr: "127.0.0.2", State: ring.ACTIVE, Timestamp: now.Add(-10 * time.Second).Unix(), Tokens: ring.GenerateTokens(128, nil), Zone: "z2"},
101-
"instance-3": {Addr: "127.0.0.3", State: ring.ACTIVE, Timestamp: now.Add(-20 * time.Second).Unix(), Tokens: ring.GenerateTokens(128, nil), Zone: "z3"},
102-
"instance-4": {Addr: "127.0.0.4", State: ring.ACTIVE, Timestamp: now.Add(-30 * time.Second).Unix(), Tokens: ring.GenerateTokens(128, nil), Zone: "z1"},
101+
"instance-1": {Addr: "127.0.0.1", State: ring.ACTIVE, Timestamp: now.Unix(), Tokens: g.GenerateTokens(ring.NewDesc(), "instance-1", "z1", 128, true), Zone: "z1"},
102+
"instance-2": {Addr: "127.0.0.2", State: ring.ACTIVE, Timestamp: now.Add(-10 * time.Second).Unix(), Tokens: g.GenerateTokens(ring.NewDesc(), "instance-2", "z2", 128, true), Zone: "z2"},
103+
"instance-3": {Addr: "127.0.0.3", State: ring.ACTIVE, Timestamp: now.Add(-20 * time.Second).Unix(), Tokens: g.GenerateTokens(ring.NewDesc(), "instance-3", "z3", 128, true), Zone: "z3"},
104+
"instance-4": {Addr: "127.0.0.4", State: ring.ACTIVE, Timestamp: now.Add(-30 * time.Second).Unix(), Tokens: g.GenerateTokens(ring.NewDesc(), "instance-4", "z1", 128, true), Zone: "z1"},
103105
},
104106
ringHeartbeatTimeout: time.Minute,
105107
ringReplicationFactor: 3,
@@ -110,11 +112,11 @@ func TestGetReplicationSetForListRule(t *testing.T) {
110112
},
111113
"should succeed on 3 unhealthy instances in 2 zones and RF=3 zone replication enabled": {
112114
ringInstances: map[string]ring.InstanceDesc{
113-
"instance-1": {Addr: "127.0.0.1", State: ring.PENDING, Timestamp: now.Unix(), Tokens: ring.GenerateTokens(128, nil), Zone: "z1"},
114-
"instance-2": {Addr: "127.0.0.2", State: ring.ACTIVE, Timestamp: now.Add(-10 * time.Second).Unix(), Tokens: ring.GenerateTokens(128, nil), Zone: "z2"},
115-
"instance-3": {Addr: "127.0.0.3", State: ring.ACTIVE, Timestamp: now.Add(-20 * time.Second).Unix(), Tokens: ring.GenerateTokens(128, nil), Zone: "z3"},
116-
"instance-4": {Addr: "127.0.0.4", State: ring.ACTIVE, Timestamp: now.Add(-2 * time.Minute).Unix(), Tokens: ring.GenerateTokens(128, nil), Zone: "z1"},
117-
"instance-5": {Addr: "127.0.0.5", State: ring.PENDING, Timestamp: now.Add(-10 * time.Second).Unix(), Tokens: ring.GenerateTokens(128, nil), Zone: "z2"},
115+
"instance-1": {Addr: "127.0.0.1", State: ring.PENDING, Timestamp: now.Unix(), Tokens: g.GenerateTokens(ring.NewDesc(), "instance-1", "z1", 128, true), Zone: "z1"},
116+
"instance-2": {Addr: "127.0.0.2", State: ring.ACTIVE, Timestamp: now.Add(-10 * time.Second).Unix(), Tokens: g.GenerateTokens(ring.NewDesc(), "instance-2", "z2", 128, true), Zone: "z2"},
117+
"instance-3": {Addr: "127.0.0.3", State: ring.ACTIVE, Timestamp: now.Add(-20 * time.Second).Unix(), Tokens: g.GenerateTokens(ring.NewDesc(), "instance-3", "z3", 128, true), Zone: "z3"},
118+
"instance-4": {Addr: "127.0.0.4", State: ring.ACTIVE, Timestamp: now.Add(-2 * time.Minute).Unix(), Tokens: g.GenerateTokens(ring.NewDesc(), "instance-4", "z1", 128, true), Zone: "z1"},
119+
"instance-5": {Addr: "127.0.0.5", State: ring.PENDING, Timestamp: now.Add(-10 * time.Second).Unix(), Tokens: g.GenerateTokens(ring.NewDesc(), "instance-5", "z2", 128, true), Zone: "z2"},
118120
},
119121
ringHeartbeatTimeout: time.Minute,
120122
ringReplicationFactor: 3,
@@ -128,10 +130,10 @@ func TestGetReplicationSetForListRule(t *testing.T) {
128130
},
129131
"should succeed on 1 unhealthy instances in 1 zone and RF=3 zone replication enabled": {
130132
ringInstances: map[string]ring.InstanceDesc{
131-
"instance-1": {Addr: "127.0.0.1", State: ring.ACTIVE, Timestamp: now.Unix(), Tokens: ring.GenerateTokens(128, nil), Zone: "z1"},
132-
"instance-2": {Addr: "127.0.0.2", State: ring.ACTIVE, Timestamp: now.Add(-10 * time.Second).Unix(), Tokens: ring.GenerateTokens(128, nil), Zone: "z2"},
133-
"instance-3": {Addr: "127.0.0.3", State: ring.ACTIVE, Timestamp: now.Add(-20 * time.Second).Unix(), Tokens: ring.GenerateTokens(128, nil), Zone: "z3"},
134-
"instance-4": {Addr: "127.0.0.4", State: ring.PENDING, Timestamp: now.Add(-30 * time.Second).Unix(), Tokens: ring.GenerateTokens(128, nil), Zone: "z1"},
133+
"instance-1": {Addr: "127.0.0.1", State: ring.ACTIVE, Timestamp: now.Unix(), Tokens: g.GenerateTokens(ring.NewDesc(), "instance-1", "z1", 128, true), Zone: "z1"},
134+
"instance-2": {Addr: "127.0.0.2", State: ring.ACTIVE, Timestamp: now.Add(-10 * time.Second).Unix(), Tokens: g.GenerateTokens(ring.NewDesc(), "instance-2", "z2", 128, true), Zone: "z2"},
135+
"instance-3": {Addr: "127.0.0.3", State: ring.ACTIVE, Timestamp: now.Add(-20 * time.Second).Unix(), Tokens: g.GenerateTokens(ring.NewDesc(), "instance-3", "z3", 128, true), Zone: "z3"},
136+
"instance-4": {Addr: "127.0.0.4", State: ring.PENDING, Timestamp: now.Add(-30 * time.Second).Unix(), Tokens: g.GenerateTokens(ring.NewDesc(), "instance-4", "z1", 128, true), Zone: "z1"},
135137
},
136138
ringHeartbeatTimeout: time.Minute,
137139
ringReplicationFactor: 3,
@@ -144,12 +146,12 @@ func TestGetReplicationSetForListRule(t *testing.T) {
144146
},
145147
"should fail on 3 unhealthy instances in 3 zonez and RF=3 zone replication enabled": {
146148
ringInstances: map[string]ring.InstanceDesc{
147-
"instance-1": {Addr: "127.0.0.1", State: ring.ACTIVE, Timestamp: now.Unix(), Tokens: ring.GenerateTokens(128, nil), Zone: "z1"},
148-
"instance-2": {Addr: "127.0.0.2", State: ring.ACTIVE, Timestamp: now.Add(-10 * time.Second).Unix(), Tokens: ring.GenerateTokens(128, nil), Zone: "z2"},
149-
"instance-3": {Addr: "127.0.0.3", State: ring.ACTIVE, Timestamp: now.Add(-20 * time.Second).Unix(), Tokens: ring.GenerateTokens(128, nil), Zone: "z3"},
150-
"instance-4": {Addr: "127.0.0.4", State: ring.PENDING, Timestamp: now.Add(-30 * time.Second).Unix(), Tokens: ring.GenerateTokens(128, nil), Zone: "z1"},
151-
"instance-5": {Addr: "127.0.0.5", State: ring.ACTIVE, Timestamp: now.Add(-2 * time.Minute).Unix(), Tokens: ring.GenerateTokens(128, nil), Zone: "z2"},
152-
"instance-6": {Addr: "127.0.0.6", State: ring.ACTIVE, Timestamp: now.Add(-2 * time.Minute).Unix(), Tokens: ring.GenerateTokens(128, nil), Zone: "z3"},
149+
"instance-1": {Addr: "127.0.0.1", State: ring.ACTIVE, Timestamp: now.Unix(), Tokens: g.GenerateTokens(ring.NewDesc(), "instance-1", "z1", 128, true), Zone: "z1"},
150+
"instance-2": {Addr: "127.0.0.2", State: ring.ACTIVE, Timestamp: now.Add(-10 * time.Second).Unix(), Tokens: g.GenerateTokens(ring.NewDesc(), "instance-2", "z2", 128, true), Zone: "z2"},
151+
"instance-3": {Addr: "127.0.0.3", State: ring.ACTIVE, Timestamp: now.Add(-20 * time.Second).Unix(), Tokens: g.GenerateTokens(ring.NewDesc(), "instance-3", "z3", 128, true), Zone: "z3"},
152+
"instance-4": {Addr: "127.0.0.4", State: ring.PENDING, Timestamp: now.Add(-30 * time.Second).Unix(), Tokens: g.GenerateTokens(ring.NewDesc(), "instance-4", "z1", 128, true), Zone: "z1"},
153+
"instance-5": {Addr: "127.0.0.5", State: ring.ACTIVE, Timestamp: now.Add(-2 * time.Minute).Unix(), Tokens: g.GenerateTokens(ring.NewDesc(), "instance-5", "z2", 128, true), Zone: "z2"},
154+
"instance-6": {Addr: "127.0.0.6", State: ring.ACTIVE, Timestamp: now.Add(-2 * time.Minute).Unix(), Tokens: g.GenerateTokens(ring.NewDesc(), "instance-6", "z3", 128, true), Zone: "z3"},
153155
},
154156
ringHeartbeatTimeout: time.Minute,
155157
ringReplicationFactor: 3,
@@ -163,11 +165,11 @@ func TestGetReplicationSetForListRule(t *testing.T) {
163165
},
164166
"should fail on 2 unhealthy instances in 2 zones and RF=2 zone replication enabled": {
165167
ringInstances: map[string]ring.InstanceDesc{
166-
"instance-1": {Addr: "127.0.0.1", State: ring.ACTIVE, Timestamp: now.Unix(), Tokens: ring.GenerateTokens(128, nil), Zone: "z1"},
167-
"instance-2": {Addr: "127.0.0.2", State: ring.ACTIVE, Timestamp: now.Add(-10 * time.Second).Unix(), Tokens: ring.GenerateTokens(128, nil), Zone: "z2"},
168-
"instance-3": {Addr: "127.0.0.3", State: ring.ACTIVE, Timestamp: now.Add(-20 * time.Second).Unix(), Tokens: ring.GenerateTokens(128, nil), Zone: "z3"},
169-
"instance-4": {Addr: "127.0.0.4", State: ring.PENDING, Timestamp: now.Add(-30 * time.Second).Unix(), Tokens: ring.GenerateTokens(128, nil), Zone: "z1"},
170-
"instance-5": {Addr: "127.0.0.5", State: ring.ACTIVE, Timestamp: now.Add(-2 * time.Minute).Unix(), Tokens: ring.GenerateTokens(128, nil), Zone: "z2"},
168+
"instance-1": {Addr: "127.0.0.1", State: ring.ACTIVE, Timestamp: now.Unix(), Tokens: g.GenerateTokens(ring.NewDesc(), "instance-1", "z1", 128, true), Zone: "z1"},
169+
"instance-2": {Addr: "127.0.0.2", State: ring.ACTIVE, Timestamp: now.Add(-10 * time.Second).Unix(), Tokens: g.GenerateTokens(ring.NewDesc(), "instance-2", "z2", 128, true), Zone: "z2"},
170+
"instance-3": {Addr: "127.0.0.3", State: ring.ACTIVE, Timestamp: now.Add(-20 * time.Second).Unix(), Tokens: g.GenerateTokens(ring.NewDesc(), "instance-3", "z3", 128, true), Zone: "z3"},
171+
"instance-4": {Addr: "127.0.0.4", State: ring.PENDING, Timestamp: now.Add(-30 * time.Second).Unix(), Tokens: g.GenerateTokens(ring.NewDesc(), "instance-4", "z1", 128, true), Zone: "z1"},
172+
"instance-5": {Addr: "127.0.0.5", State: ring.ACTIVE, Timestamp: now.Add(-2 * time.Minute).Unix(), Tokens: g.GenerateTokens(ring.NewDesc(), "instance-5", "z2", 128, true), Zone: "z2"},
171173
},
172174
ringHeartbeatTimeout: time.Minute,
173175
ringReplicationFactor: 2,

0 commit comments

Comments
 (0)