@@ -31,28 +31,28 @@ func TestSalud(t *testing.T) {
3131 t .Parallel ()
3232 peers := []peer {
3333 // fully healhy
34- {swarm .RandAddress (t ), & status.Snapshot {ConnectedPeers : 100 , StorageRadius : 8 , BeeMode : "full" , BatchCommitment : 50 , ReserveSize : 100 }, 1 , true },
35- {swarm .RandAddress (t ), & status.Snapshot {ConnectedPeers : 100 , StorageRadius : 8 , BeeMode : "full" , BatchCommitment : 50 , ReserveSize : 100 }, 1 , true },
36- {swarm .RandAddress (t ), & status.Snapshot {ConnectedPeers : 100 , StorageRadius : 8 , BeeMode : "full" , BatchCommitment : 50 , ReserveSize : 100 }, 1 , true },
37- {swarm .RandAddress (t ), & status.Snapshot {ConnectedPeers : 100 , StorageRadius : 8 , BeeMode : "full" , BatchCommitment : 50 , ReserveSize : 100 }, 1 , true },
38- {swarm .RandAddress (t ), & status.Snapshot {ConnectedPeers : 100 , StorageRadius : 8 , BeeMode : "full" , BatchCommitment : 50 , ReserveSize : 100 }, 1 , true },
39- {swarm .RandAddress (t ), & status.Snapshot {ConnectedPeers : 100 , StorageRadius : 8 , BeeMode : "full" , BatchCommitment : 50 , ReserveSize : 100 }, 1 , true },
34+ {swarm .RandAddress (t ), & status.Snapshot {ConnectedPeers : 100 , StorageRadius : 8 , BeeMode : "full" , BatchCommitment : 50 , ReserveSize : 100 , CommittedDepth : 8 }, 1 , true },
35+ {swarm .RandAddress (t ), & status.Snapshot {ConnectedPeers : 100 , StorageRadius : 8 , BeeMode : "full" , BatchCommitment : 50 , ReserveSize : 100 , CommittedDepth : 8 }, 1 , true },
36+ {swarm .RandAddress (t ), & status.Snapshot {ConnectedPeers : 100 , StorageRadius : 8 , BeeMode : "full" , BatchCommitment : 50 , ReserveSize : 100 , CommittedDepth : 8 }, 1 , true },
37+ {swarm .RandAddress (t ), & status.Snapshot {ConnectedPeers : 100 , StorageRadius : 8 , BeeMode : "full" , BatchCommitment : 50 , ReserveSize : 100 , CommittedDepth : 8 }, 1 , true },
38+ {swarm .RandAddress (t ), & status.Snapshot {ConnectedPeers : 100 , StorageRadius : 8 , BeeMode : "full" , BatchCommitment : 50 , ReserveSize : 100 , CommittedDepth : 8 }, 1 , true },
39+ {swarm .RandAddress (t ), & status.Snapshot {ConnectedPeers : 100 , StorageRadius : 8 , BeeMode : "full" , BatchCommitment : 50 , ReserveSize : 100 , CommittedDepth : 8 }, 1 , true },
4040
4141 // healthy since radius >= most common radius - 2
42- {swarm .RandAddress (t ), & status.Snapshot {ConnectedPeers : 100 , StorageRadius : 7 , BeeMode : "full" , BatchCommitment : 50 , ReserveSize : 100 }, 1 , true },
42+ {swarm .RandAddress (t ), & status.Snapshot {ConnectedPeers : 100 , StorageRadius : 7 , BeeMode : "full" , BatchCommitment : 50 , ReserveSize : 100 , CommittedDepth : 7 }, 1 , true },
4343
4444 // radius too low
45- {swarm .RandAddress (t ), & status.Snapshot {ConnectedPeers : 100 , StorageRadius : 5 , BeeMode : "full" , BatchCommitment : 50 , ReserveSize : 100 }, 1 , false },
45+ {swarm .RandAddress (t ), & status.Snapshot {ConnectedPeers : 100 , StorageRadius : 5 , BeeMode : "full" , BatchCommitment : 50 , ReserveSize : 100 , CommittedDepth : 5 }, 1 , false },
4646
4747 // dur too long
48- {swarm .RandAddress (t ), & status.Snapshot {ConnectedPeers : 100 , StorageRadius : 8 , BeeMode : "full" , BatchCommitment : 50 , ReserveSize : 100 }, 2 , false },
49- {swarm .RandAddress (t ), & status.Snapshot {ConnectedPeers : 100 , StorageRadius : 8 , BeeMode : "full" , BatchCommitment : 50 , ReserveSize : 100 }, 2 , false },
48+ {swarm .RandAddress (t ), & status.Snapshot {ConnectedPeers : 100 , StorageRadius : 8 , BeeMode : "full" , BatchCommitment : 50 , ReserveSize : 100 , CommittedDepth : 8 }, 2 , false },
49+ {swarm .RandAddress (t ), & status.Snapshot {ConnectedPeers : 100 , StorageRadius : 8 , BeeMode : "full" , BatchCommitment : 50 , ReserveSize : 100 , CommittedDepth : 8 }, 2 , false },
5050
5151 // connections not enough
52- {swarm .RandAddress (t ), & status.Snapshot {ConnectedPeers : 90 , StorageRadius : 8 , BeeMode : "full" , BatchCommitment : 50 , ReserveSize : 100 }, 1 , false },
52+ {swarm .RandAddress (t ), & status.Snapshot {ConnectedPeers : 90 , StorageRadius : 8 , BeeMode : "full" , BatchCommitment : 50 , ReserveSize : 100 , CommittedDepth : 8 }, 1 , false },
5353
5454 // commitment wrong
55- {swarm .RandAddress (t ), & status.Snapshot {ConnectedPeers : 100 , StorageRadius : 8 , BeeMode : "full" , BatchCommitment : 35 , ReserveSize : 100 }, 1 , false },
55+ {swarm .RandAddress (t ), & status.Snapshot {ConnectedPeers : 100 , StorageRadius : 8 , BeeMode : "full" , BatchCommitment : 35 , ReserveSize : 100 , CommittedDepth : 8 }, 1 , false },
5656 }
5757
5858 statusM := & statusMock {make (map [string ]peer )}
@@ -66,11 +66,12 @@ func TestSalud(t *testing.T) {
6666 topM := topMock .NewTopologyDriver (topMock .WithPeers (addrs ... ))
6767
6868 reserve := mockstorer .NewReserve (
69- mockstorer .WithRadius (8 ),
69+ mockstorer .WithRadius (6 ),
7070 mockstorer .WithReserveSize (100 ),
71+ mockstorer .WithCapacityDoubling (2 ),
7172 )
7273
73- service := salud .New (statusM , topM , reserve , log .Noop , - 1 , "full" , 0 , 0.8 , 0.8 , 0 )
74+ service := salud .New (statusM , topM , reserve , log .Noop , - 1 , "full" , 0 , 0.8 , 0.8 )
7475
7576 err := spinlock .Wait (time .Minute , func () bool {
7677 return len (topM .PeersHealth ()) == len (peers )
@@ -114,9 +115,10 @@ func TestSelfUnhealthyRadius(t *testing.T) {
114115 reserve := mockstorer .NewReserve (
115116 mockstorer .WithRadius (7 ),
116117 mockstorer .WithReserveSize (100 ),
118+ mockstorer .WithCapacityDoubling (0 ),
117119 )
118120
119- service := salud .New (statusM , topM , reserve , log .Noop , - 1 , "full" , 0 , 0.8 , 0.8 , 0 )
121+ service := salud .New (statusM , topM , reserve , log .Noop , - 1 , "full" , 0 , 0.8 , 0.8 )
120122 testutil .CleanupCloser (t , service )
121123
122124 err := spinlock .Wait (time .Minute , func () bool {
@@ -135,8 +137,8 @@ func TestSelfHealthyCapacityDoubling(t *testing.T) {
135137 t .Parallel ()
136138 peers := []peer {
137139 // fully healhy
138- {swarm .RandAddress (t ), & status.Snapshot {ConnectedPeers : 100 , StorageRadius : 8 , BeeMode : "full" }, 0 , true },
139- {swarm .RandAddress (t ), & status.Snapshot {ConnectedPeers : 100 , StorageRadius : 8 , BeeMode : "full" }, 0 , true },
140+ {swarm .RandAddress (t ), & status.Snapshot {ConnectedPeers : 100 , StorageRadius : 8 , BeeMode : "full" , CommittedDepth : 8 }, 0 , true },
141+ {swarm .RandAddress (t ), & status.Snapshot {ConnectedPeers : 100 , StorageRadius : 8 , BeeMode : "full" , CommittedDepth : 8 }, 0 , true },
140142 }
141143
142144 statusM := & statusMock {make (map [string ]peer )}
@@ -151,9 +153,10 @@ func TestSelfHealthyCapacityDoubling(t *testing.T) {
151153 reserve := mockstorer .NewReserve (
152154 mockstorer .WithRadius (6 ),
153155 mockstorer .WithReserveSize (100 ),
156+ mockstorer .WithCapacityDoubling (2 ),
154157 )
155158
156- service := salud .New (statusM , topM , reserve , log .Noop , - 1 , "full" , 0 , 0.8 , 0.8 , 2 )
159+ service := salud .New (statusM , topM , reserve , log .Noop , - 1 , "full" , 0 , 0.8 , 0.8 )
157160 testutil .CleanupCloser (t , service )
158161
159162 err := spinlock .Wait (time .Minute , func () bool {
@@ -183,7 +186,7 @@ func TestSubToRadius(t *testing.T) {
183186
184187 topM := topMock .NewTopologyDriver (topMock .WithPeers (addrs ... ))
185188
186- service := salud .New (& statusMock {make (map [string ]peer )}, topM , mockstorer .NewReserve (), log .Noop , - 1 , "full" , 0 , 0.8 , 0.8 , 0 )
189+ service := salud .New (& statusMock {make (map [string ]peer )}, topM , mockstorer .NewReserve (), log .Noop , - 1 , "full" , 0 , 0.8 , 0.8 )
187190
188191 c , unsub := service .SubscribeNetworkStorageRadius ()
189192 t .Cleanup (unsub )
@@ -216,7 +219,7 @@ func TestUnsub(t *testing.T) {
216219
217220 topM := topMock .NewTopologyDriver (topMock .WithPeers (addrs ... ))
218221
219- service := salud .New (& statusMock {make (map [string ]peer )}, topM , mockstorer .NewReserve (), log .Noop , - 1 , "full" , 0 , 0.8 , 0.8 , 0 )
222+ service := salud .New (& statusMock {make (map [string ]peer )}, topM , mockstorer .NewReserve (), log .Noop , - 1 , "full" , 0 , 0.8 , 0.8 )
220223 testutil .CleanupCloser (t , service )
221224
222225 c , unsub := service .SubscribeNetworkStorageRadius ()
0 commit comments