Skip to content

Commit 3822d5e

Browse files
committed
wip
1 parent 7e694a6 commit 3822d5e

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

Tests/CodexReleaseTests/Utils/MarketplaceAutoBootstrapDistTest.cs

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,30 @@ public ICodexNode StartOneHost()
103103
return host;
104104
}
105105

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+
106130
public void AssertTstBalance(ICodexNode node, TestToken expectedBalance, string message)
107131
{
108132
AssertTstBalance(node.EthAddress, expectedBalance, message);
@@ -160,6 +184,15 @@ private Retry GetBalanceAssertRetry()
160184
failFast: false);
161185
}
162186

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+
163196
private TestToken GetTstBalance(ICodexNode node)
164197
{
165198
return GetContracts().GetTestTokenBalance(node);

0 commit comments

Comments
 (0)