artilleryio / artillery

The complete load testing platform. Everything you need for production-grade load tests. Serverless & distributed. Load test with Playwright. Load test HTTP APIs, GraphQL, WebSocket, and more. Use any Node.js module.
https://www.artillery.io
Mozilla Public License 2.0
7.92k stars 505 forks source link

phases is not adjusted when the arrivalRate is zero #327

Open ykokw opened 7 years ago

ykokw commented 7 years ago

artillery version: 1.6.0-2

When I run load test with following phase config, (I set arrivalRate to 0)

  phases:
    - duration: 30
      arrivalRate: 0
      rampTo: 30

I've got a warning message.

Unknown phase spec definition, skipping.
{"duration":30,"arrivalRate":0,"rampTo":30}
This should not happen

In the divideWork method of the lib/dist.js, all conditional statement looks return false if arrivalRate is 0. It should confirm that phase is included each parameters (e.g. phase.hasOwnProperty("arrivalRate"))

https://github.com/shoreditch-ops/artillery/blob/da7e4aa9397c5d3c27dc406be066069a49aa8787/lib/dist.js#L25

    if (phase.arrivalRate && phase.rampTo) { //if arrivalRate is 0, it become false
      let rates = distribute(phase.arrivalRate, numWorkers);
      let ramps = distribute(phase.rampTo, numWorkers);
      L.each(rates, function(Lr, i) {
        newPhases[i][phaseSpecIndex].arrivalRate = rates[i];
        newPhases[i][phaseSpecIndex].rampTo = ramps[i];
      });
      return;
    }

It looks uses original phases config (not adjusted)

hassy commented 7 years ago

Thanks @ykokw

hiepluong2205 commented 1 year ago

Same issue. Thanks ykokw