Skip to content

Commit

Permalink
Really fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
asdacap committed Aug 29, 2022
1 parent f6eef88 commit 15c5402
Showing 1 changed file with 13 additions and 11 deletions.
Original file line number Diff line number Diff line change
@@ -1,22 +1,23 @@
// Copyright (c) 2021 Demerzel Solutions Limited
// This file is part of the Nethermind library.
//
//
// The Nethermind library is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
//
// The Nethermind library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
//
// You should have received a copy of the GNU Lesser General Public License
// along with the Nethermind. If not, see <http://www.gnu.org/licenses/>.

using System;
using System.Threading;
using System.Threading.Tasks;
using FluentAssertions;
using FluentAssertions.Execution;
using Nethermind.Api;
using Nethermind.Config;
Expand All @@ -26,6 +27,7 @@
using Nethermind.Runner.Ethereum.Api;
using Nethermind.Runner.Ethereum.Steps;
using Nethermind.Serialization.Json;
using NSubstitute.ExceptionExtensions;
using NUnit.Framework;

namespace Nethermind.Runner.Test.Ethereum.Steps
Expand Down Expand Up @@ -85,18 +87,15 @@ public async Task With_steps_from_here_AuRa()
runnerContext,
LimboLogs.Instance);

using CancellationTokenSource source = new CancellationTokenSource(TimeSpan.FromSeconds(1));
using CancellationTokenSource source = new CancellationTokenSource(TimeSpan.FromSeconds(2));

try
{
await stepsManager.InitializeAll(source.Token);
}
catch (Exception e)
{
if (!(e is OperationCanceledException))
{
throw new AssertionFailedException($"Exception should be {nameof(OperationCanceledException)}");
}
e.Should().BeOfType<TestException>();
}
}

Expand All @@ -111,7 +110,7 @@ public async Task With_failing_steps()
runnerContext,
LimboLogs.Instance);

using CancellationTokenSource source = new CancellationTokenSource(TimeSpan.FromSeconds(1));
using CancellationTokenSource source = new CancellationTokenSource(TimeSpan.FromSeconds(2));

try
{
Expand All @@ -125,7 +124,7 @@ public async Task With_failing_steps()
}
}
}

private static T CreateApi<T>() where T : INethermindApi, new() =>
new T()
{
Expand Down Expand Up @@ -211,7 +210,7 @@ public StepCAuRa(AuRaNethermindApi runnerContext)

public override async Task Execute(CancellationToken cancellationToken)
{
await Task.Run(() => throw new Exception());
await Task.Run(() => throw new TestException());
}
}

Expand All @@ -221,4 +220,7 @@ public StepCStandard(NethermindApi runnerContext)
{
}
}

class TestException: Exception {
}
}

0 comments on commit 15c5402

Please sign in to comment.