From 0d9aa230da3bcd6321d5c3008938447fd023c1cb Mon Sep 17 00:00:00 2001 From: Eric <5089238+emizzle@users.noreply.github.com> Date: Thu, 14 Sep 2023 14:45:25 +1000 Subject: [PATCH] Fix re-evaluation of condition in `Time.WaitUntil` For example, seller.Marketplace.GetBalance() is captured once on call, and then is compared to a continually updated sellerWithFailures.Marketplace.GetBalance. Update RetryAssert such that `var c = constraint.Resolve();` is executed inside of the `Time.WaitUntil` instead of outside, so it is continually reevaluated. --- DistTestCore/Helpers/AssertHelpers.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/DistTestCore/Helpers/AssertHelpers.cs b/DistTestCore/Helpers/AssertHelpers.cs index fdbffab..efd0749 100644 --- a/DistTestCore/Helpers/AssertHelpers.cs +++ b/DistTestCore/Helpers/AssertHelpers.cs @@ -10,8 +10,11 @@ namespace DistTestCore.Helpers { try { - var c = constraint.Resolve(); - Time.WaitUntil(() => c.ApplyTo(actual()).IsSuccess); + + Time.WaitUntil(() => { + var c = constraint.Resolve(); + return c.ApplyTo(actual()).IsSuccess; + }); } catch (TimeoutException) {