PragmaticFlow / NBomber

Modern and flexible load testing framework for Pull and Push scenarios, designed to test any system regardless a protocol (HTTP/WebSockets/AMQP etc) or a semantic model (Pull/Push).
https://nbomber.com
Other
2.07k stars 131 forks source link

Exception while running first example #573

Closed ggercman closed 1 year ago

ggercman commented 1 year ago

Got exception at the end of running first demo. How to reproduce:

csproj:

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>net7.0</TargetFramework>
    <ImplicitUsings>enable</ImplicitUsings>
    <Nullable>enable</Nullable>
  </PropertyGroup>
  <ItemGroup>
    <PackageReference Include="NBomber" Version="4.1.2" />
    <PackageReference Include="NBomber.Http" Version="4.1.1" />
  </ItemGroup>
</Project>

program.cs:

using NBomber.CSharp;

var scenario = Scenario.Create("hello_world_scenario", async context =>
{
    await Task.Delay(1_000);

    return Response.Ok();
})
.WithoutWarmUp()
.WithLoadSimulations(
    Simulation.RampingInject(rate: 50, interval: TimeSpan.FromSeconds(1), during: TimeSpan.FromMinutes(1)),
    Simulation.Inject(rate: 50, interval: TimeSpan.FromSeconds(1), during: TimeSpan.FromMinutes(1)),
    Simulation.InjectRandom(minRate: 50, maxRate: 10, interval: TimeSpan.FromSeconds(1), during: TimeSpan.FromSeconds(30))
);

NBomberRunner
    .RegisterScenarios(scenario)
    .Run();

`

Exception at the end of running scenarios.

'minValue' cannot be greater than maxValue. Arg_ParamName_Name

   at System.Random.ThrowMinMaxValueSwapped() in /_/src/libraries/System.Private.CoreLib/src/System/Random.cs:line 198
   at System.Random.Next(Int32 minValue, Int32 maxValue) in /_/src/libraries/System.Private.CoreLib/src/System/Random.cs:line 94
   at NBomber.Domain.Scheduler.ScenarioScheduler.clo@159-8.MoveNext() in /home/runner/work/NBomber/NBomber/src/NBomber/Domain/Scheduler/ScenarioScheduler.fs:line 191
   at <StartupCode$NBomber>.$TestHost.clo@74-18.MoveNext() in /home/runner/work/NBomber/NBomber/src/NBomber/DomainServices/TestHost/TestHost.fs:line 93
   at <StartupCode$NBomber>.$TestHost.StopTest@202.MoveNext() in /home/runner/work/NBomber/NBomber/src/NBomber/DomainServices/TestHost/TestHost.fs:line 216
AntyaDev commented 1 year ago

Hi @ggercman

Is it easy to reproduce? I have tried but have had no luck...

ggercman commented 1 year ago

Actually I get exception on each execution. image

AntyaDev commented 1 year ago

@ggercman I can't reproduce this behavior. I copied your snippet, pasted it into the CSharpProd project, and tried reproducing it but was unsuccessful.

AntyaDev commented 1 year ago

@ggercman Finally, I reproduced it, I just needed to wait more than 2 mins. Btw, why do you specify: minRate: 50, maxRate: 10? I mean why maxRate is lower than minRate?

AntyaDev commented 1 year ago

I think I need to add a validation that will check: minRate < maxRate

ggercman commented 1 year ago

I probably copied from one of provided examples. This one https://github.com/PragmaticFlow/NBomber/blob/dev/examples/CSharpProd/HelloWorld/LoadSimulation/ScenarioInjectRate.cs

AntyaDev commented 1 year ago

ah sorry, it's my mistake.