File tree Expand file tree Collapse file tree 1 file changed +33
-0
lines changed
Tests/CodexReleaseTests/Utils Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Original file line number Diff line number Diff line change @@ -103,6 +103,30 @@ public ICodexNode StartOneHost()
103
103
return host ;
104
104
}
105
105
106
+ public void AssertHostAvailabilitiesAreEmpty ( IEnumerable < ICodexNode > hosts )
107
+ {
108
+ var retry = GetAvailabilitySpaceAssertRetry ( ) ;
109
+ retry . Run ( ( ) =>
110
+ {
111
+ foreach ( var host in hosts )
112
+ {
113
+ AssertHostAvailabilitiesAreEmpty ( host ) ;
114
+ }
115
+ } ) ;
116
+ }
117
+
118
+ private void AssertHostAvailabilitiesAreEmpty ( ICodexNode host )
119
+ {
120
+ var availabilities = host . Marketplace . GetAvailabilities ( ) ;
121
+ foreach ( var a in availabilities )
122
+ {
123
+ if ( a . FreeSpace . SizeInBytes != a . TotalSpace . SizeInBytes )
124
+ {
125
+ throw new Exception ( nameof ( AssertHostAvailabilitiesAreEmpty ) + $ " free: { a . FreeSpace } total: { a . TotalSpace } ") ;
126
+ }
127
+ }
128
+ }
129
+
106
130
public void AssertTstBalance ( ICodexNode node , TestToken expectedBalance , string message )
107
131
{
108
132
AssertTstBalance ( node . EthAddress , expectedBalance , message ) ;
@@ -160,6 +184,15 @@ private Retry GetBalanceAssertRetry()
160
184
failFast : false ) ;
161
185
}
162
186
187
+ private Retry GetAvailabilitySpaceAssertRetry ( )
188
+ {
189
+ return new Retry ( "AssertAvailabilitySpace" ,
190
+ maxTimeout : HostBlockTTL * 3 ,
191
+ sleepAfterFail : TimeSpan . FromSeconds ( 10.0 ) ,
192
+ onFail : f => { } ,
193
+ failFast : false ) ;
194
+ }
195
+
163
196
private TestToken GetTstBalance ( ICodexNode node )
164
197
{
165
198
return GetContracts ( ) . GetTestTokenBalance ( node ) ;
You can’t perform that action at this time.
0 commit comments