Change WaitUntil tickstep default to 1, fix going over the max, better async and fix rejuvenate test not being async (#2439)
This commit is contained in:
@@ -129,19 +129,26 @@ namespace Content.IntegrationTests
|
||||
return grid;
|
||||
}
|
||||
|
||||
protected async Task WaitUntil(IntegrationInstance instance, Func<bool> func, int tickStep = 10, int maxTicks = 600)
|
||||
protected async Task WaitUntil(IntegrationInstance instance, Func<bool> func, int maxTicks = 600, int tickStep = 1)
|
||||
{
|
||||
var ticksAwaited = 0;
|
||||
bool passed;
|
||||
|
||||
await instance.WaitIdleAsync();
|
||||
|
||||
while (!(passed = func()) && ticksAwaited < maxTicks)
|
||||
{
|
||||
await instance.WaitIdleAsync();
|
||||
instance.RunTicks(tickStep);
|
||||
ticksAwaited += tickStep;
|
||||
}
|
||||
var ticksToRun = tickStep;
|
||||
|
||||
await instance.WaitIdleAsync();
|
||||
if (ticksAwaited + tickStep > maxTicks)
|
||||
{
|
||||
ticksToRun = maxTicks - ticksAwaited;
|
||||
}
|
||||
|
||||
await instance.WaitRunTicks(ticksToRun);
|
||||
|
||||
ticksAwaited += ticksToRun;
|
||||
}
|
||||
|
||||
Assert.That(passed);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user