Only display new threshold breaches

This commit is contained in:
benbierens 2023-07-11 08:19:14 +02:00
parent d982f39870
commit 7d856c276b
No known key found for this signature in database
GPG Key ID: FE44815D96D0A1AA
3 changed files with 24 additions and 9 deletions

View File

@ -71,10 +71,9 @@ namespace ContinuousTests
return node.UploadFile(fileStream); return node.UploadFile(fileStream);
}); });
if (response.StartsWith(UploadFailedMessage)) if (string.IsNullOrEmpty(response)) return null;
{ if (response.StartsWith(UploadFailedMessage)) return null;
return null;
}
Log.Log($"Uploaded file. Received contentId: '{response}'."); Log.Log($"Uploaded file. Received contentId: '{response}'.");
return new ContentId(response); return new ContentId(response);
} }

View File

@ -10,6 +10,8 @@ namespace ContinuousTests.Tests
public override TimeSpan RunTestEvery => TimeSpan.FromSeconds(30); public override TimeSpan RunTestEvery => TimeSpan.FromSeconds(30);
public override TestFailMode TestFailMode => TestFailMode.StopAfterFirstFailure; public override TestFailMode TestFailMode => TestFailMode.StopAfterFirstFailure;
private static readonly List<string> previousBreaches = new List<string>();
[TestMoment(t: 0)] [TestMoment(t: 0)]
public void CheckAllThresholds() public void CheckAllThresholds()
{ {
@ -22,7 +24,22 @@ namespace ContinuousTests.Tests
var breaches = n.GetDebugThresholdBreaches(); var breaches = n.GetDebugThresholdBreaches();
if (breaches.breaches.Any()) if (breaches.breaches.Any())
{ {
Assert.Fail(string.Join(",", breaches.breaches.Select(b => FormatBreach(n, b)))); var newBreaches = new List<string>();
foreach (var b in breaches.breaches)
{
if (!previousBreaches.Contains(b))
{
newBreaches.Add(b);
previousBreaches.Add(b);
}
}
if (newBreaches.Any())
{
Assert.Fail(string.Join(",", newBreaches.Select(b => FormatBreach(n, b))));
Program.Cancellation.Cts.Cancel();
}
} }
} }

View File

@ -75,10 +75,9 @@ namespace DistTestCore
return CodexAccess.UploadFile(fileStream); return CodexAccess.UploadFile(fileStream);
}); });
if (response.StartsWith(UploadFailedMessage)) if (string.IsNullOrEmpty(response)) Assert.Fail("Received empty response.");
{ if (response.StartsWith(UploadFailedMessage)) Assert.Fail("Node failed to store block.");
Assert.Fail("Node failed to store block.");
}
var logReplacement = $"(CID:{file.Describe()})"; var logReplacement = $"(CID:{file.Describe()})";
Log($"ContentId '{response}' is {logReplacement}"); Log($"ContentId '{response}' is {logReplacement}");
lifecycle.Log.AddStringReplace(response, logReplacement); lifecycle.Log.AddStringReplace(response, logReplacement);