Skip to content

Commit

Permalink
CI Test coverage need longer timeouts (#3124)
Browse files Browse the repository at this point in the history
* Increase timeout to 2s in test for code coverage on CI

* fix BlockProcessorTests
  • Loading branch information
LukaszRozmej authored Jun 15, 2021
1 parent 8e0e6a8 commit b8ab965
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
using System.Threading.Tasks;
using System.Threading;
using FluentAssertions;
using Nethermind.Core.Test.Blockchain;

namespace Nethermind.Blockchain.Test
{
Expand Down Expand Up @@ -171,7 +172,7 @@ public async Task Process_long_running_branch(int blocksAmount)

var branchLength = blocksAmount + (int)testRpc.BlockTree.BestKnownNumber + 1;
((BlockTree)testRpc.BlockTree).AddBranch(branchLength, (int)testRpc.BlockTree.BestKnownNumber);
(await suggestedBlockResetEvent.WaitAsync(1000)).Should().BeTrue();
(await suggestedBlockResetEvent.WaitAsync(TestBlockchain.DefaultTimeout)).Should().BeTrue();
Assert.AreEqual(branchLength - 1, (int)testRpc.BlockTree.BestKnownNumber);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ namespace Nethermind.Core.Test.Blockchain
{
public class TestBlockchain : IDisposable
{
public const int DefaultTimeout = 2000;
public IStateReader StateReader { get; private set; }
public IEthereumEcdsa EthereumEcdsa { get; private set; }
public TransactionProcessor TxProcessor { get; set; }
Expand Down Expand Up @@ -177,15 +178,15 @@ protected virtual async Task<TestBlockchain> Build(ISpecProvider specProvider =
return this;
}

private async Task WaitAsync(SemaphoreSlim semaphore, string error, int timeout = 1000)
private async Task WaitAsync(SemaphoreSlim semaphore, string error, int timeout = DefaultTimeout)
{
if (!await semaphore.WaitAsync(timeout))
{
throw new InvalidOperationException(error);
}
}

private async Task WaitAsync(EventWaitHandle eventWaitHandle, string error, int timeout = 1000)
private async Task WaitAsync(EventWaitHandle eventWaitHandle, string error, int timeout = DefaultTimeout)
{
if (!await eventWaitHandle.WaitOneAsync(timeout, CancellationToken.None))
{
Expand Down

0 comments on commit b8ab965

Please sign in to comment.