2023-09-13 09:59:21 +00:00
|
|
|
|
using DistTestCore.Helpers;
|
|
|
|
|
using Logging;
|
|
|
|
|
using MetricsPlugin;
|
|
|
|
|
using NUnit.Framework.Constraints;
|
|
|
|
|
|
2023-10-09 14:59:52 +00:00
|
|
|
|
namespace CodexTests
|
2023-09-13 09:59:21 +00:00
|
|
|
|
{
|
|
|
|
|
public static class MetricsAccessExtensions
|
|
|
|
|
{
|
|
|
|
|
public static void AssertThat(this IMetricsAccess access, string metricName, IResolveConstraint constraint, ILog? log = null, string message = "")
|
|
|
|
|
{
|
|
|
|
|
AssertHelpers.RetryAssert(constraint, () =>
|
|
|
|
|
{
|
|
|
|
|
var metricSet = access.GetMetric(metricName);
|
|
|
|
|
var metricValue = metricSet.Values[0].Value;
|
|
|
|
|
|
|
|
|
|
if (log != null) log.Log($"{access.TargetName} metric '{metricName}' = {metricValue}");
|
|
|
|
|
return metricValue;
|
|
|
|
|
}, message);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|