Adds check for block verification failures

This commit is contained in:
benbierens 2023-12-12 14:18:26 +01:00
parent 09554da362
commit 8fc8a3f7cf
No known key found for this signature in database
GPG Key ID: FE44815D96D0A1AA
5 changed files with 23 additions and 3 deletions

View File

@ -94,6 +94,8 @@ namespace CodexTests.BasicTests
AssertBalance(contracts, seller, Is.GreaterThan(sellerInitialBalance), "Seller was not paid for storage.");
AssertBalance(contracts, buyer, Is.LessThan(buyerInitialBalance), "Buyer was not charged for storage.");
CheckLogForErrors(seller, buyer);
}
}
}

View File

@ -6,7 +6,7 @@ using Utils;
namespace CodexTests.BasicTests
{
[TestFixture]
public class OneClientTests : DistTest
public class OneClientTests : CodexDistTest
{
[Test]
public void OneClientTest()

View File

@ -1,12 +1,11 @@
using CodexPlugin;
using DistTestCore;
using NUnit.Framework;
using Utils;
namespace CodexTests.BasicTests
{
[TestFixture]
public class TwoClientTests : DistTest
public class TwoClientTests : CodexDistTest
{
[Test]
public void TwoClientTest()
@ -51,6 +50,7 @@ namespace CodexTests.BasicTests
var downloadedFile = secondary.DownloadContent(contentId);
testFile.AssertIsEqual(downloadedFile);
CheckLogForErrors(primary, secondary);
}
}
}

View File

@ -85,6 +85,19 @@ namespace CodexTests
AssertHelpers.RetryAssert(constraint, () => contracts.GetTestTokenBalance(codexNode), nameof(AssertBalance) + msg);
}
public void CheckLogForErrors(params ICodexNode[] nodes)
{
foreach (var node in nodes) CheckLogForErrors(node);
}
public void CheckLogForErrors(ICodexNode node)
{
var log = Ci.DownloadLog(node);
log.AssertLogDoesNotContain("Block validation failed");
log.AssertLogDoesNotContain("ERR ");
}
protected virtual void OnCodexSetup(ICodexSetup setup)
{
}

View File

@ -9,5 +9,10 @@ namespace DistTestCore
{
Assert.That(log.DoesLogContain(expectedString), $"Did not find '{expectedString}' in log.");
}
public static void AssertLogDoesNotContain(this IDownloadedLog log, string unexpectedString)
{
Assert.That(!log.DoesLogContain(unexpectedString), $"Did find '{unexpectedString}' in log.");
}
}
}