Adds retry for assertions of metrics and account balances.
This commit is contained in:
parent
44e237e60e
commit
9328f04f4a
|
@ -1,5 +1,4 @@
|
|||
using DistTestCore.Codex;
|
||||
using Logging;
|
||||
using NUnit.Framework;
|
||||
using NUnit.Framework.Constraints;
|
||||
using System.Numerics;
|
||||
|
@ -97,8 +96,11 @@ namespace DistTestCore.Marketplace
|
|||
}
|
||||
|
||||
public void AssertThatBalance(IResolveConstraint constraint, string message = "")
|
||||
{
|
||||
Time.Retry(() =>
|
||||
{
|
||||
Assert.That(GetBalance(), constraint, message);
|
||||
}, nameof(AssertThatBalance));
|
||||
}
|
||||
|
||||
public TestToken GetBalance()
|
||||
|
|
|
@ -27,6 +27,8 @@ namespace DistTestCore.Metrics
|
|||
}
|
||||
|
||||
public void AssertThat(string metricName, IResolveConstraint constraint, string message = "")
|
||||
{
|
||||
Time.Retry(() =>
|
||||
{
|
||||
var metricSet = GetMetricWithTimeout(metricName);
|
||||
var metricValue = metricSet.Values[0].Value;
|
||||
|
@ -34,6 +36,7 @@ namespace DistTestCore.Metrics
|
|||
log.Log($"{node.Name} metric '{metricName}' = {metricValue}");
|
||||
|
||||
Assert.That(metricValue, constraint, message);
|
||||
}, nameof(AssertThat));
|
||||
}
|
||||
|
||||
public Metrics? GetAllMetrics()
|
||||
|
|
Loading…
Reference in New Issue