空手道加特林在使用加特林的油门功能时会引发异常,并且不会生成报告

时间:2018-09-04 18:14:04

标签: gatling karate

在进行POC时,我面临一个问题。空手道加特林在使用加特林进行仿真注射时效果很好。但是,当我尝试使用Gatlings节流功能时,它会抛出一些异常。执行完成的话是-Simulation com.perffeatures.ExecuteThrottle在150秒内完成。此后将引发异常。报告未生成

这是我尝试过的情况

class ExecuteThrottle extends Simulation {
  before {
    println("Execution of load test started for throttle test")
  }
  val protocol = karateProtocol("/api/users?delay=3" -> pauseFor("post" -> 10))
  val perfscenario3 = scenario("Feature_1").exec(karateFeature("classpath:com/perffeatures/perfscenario3.feature"))

  setUp(
    perfscenario3.inject(
      constantUsersPerSec(1) during (10 minutes)
    ).protocols(protocol)
  ).throttle(
    reachRps(10) in (30 seconds),
    holdFor(1 minute),
    jumpToRps(25),
    holdFor(1 minute)
  ).assertions(
    global.responseTime.max.between(100, 5000),
    global.failedRequests.percent.is(0)
  ).maxDuration(20 minutes)

  after {
    println("Done with the load test execution for throttle test")
  }
}

执行完成后,我会收到类似的异常

    Simulation com.perffeatures.ExecuteThrottle completed in 150 seconds
    Done with the load test execution for throttle test
23:48:53.229 [GatlingSystem-akka.actor.default-dispatcher-12] ERROR c.intuit.karate.gatling.KarateAction - 'classpath:com/perffeatures/perfscenario3.feature' crashed on session Session(Feature_1,152,Map(),1536085133199,0,OK,List(),io.gatling.core.protocol.ProtocolComponentsRegistry$$Lambda$316/1455695758@1a06a693), forwarding to the next one
java.lang.IllegalStateException: cannot create children while terminating or terminated
    at akka.actor.dungeon.Children.makeChild(Children.scala:270)
    at akka.actor.dungeon.Children.attachChild(Children.scala:48)
    at akka.actor.dungeon.Children.attachChild$(Children.scala:47)
    at akka.actor.ActorCell.attachChild(ActorCell.scala:370)
    at akka.actor.ActorSystemImpl.actorOf(ActorSystem.scala:717)
    at com.intuit.karate.gatling.KarateAction.getActor(KarateAction.scala:30)
    at com.intuit.karate.gatling.KarateAction.$anonfun$execute$1(KarateAction.scala:99)
    at com.intuit.karate.cucumber.AsyncFeature.submit(AsyncFeature.java:52)
    at com.intuit.karate.cucumber.CucumberUtils.callAsync(CucumberUtils.java:160)
    at com.intuit.karate.cucumber.CucumberUtils.callAsync(CucumberUtils.java:154)
    at com.intuit.karate.gatling.KarateAction.execute(KarateAction.scala:103)
    at io.gatling.core.action.Action.$bang(Action.scala:35)
    at io.gatling.core.action.Action.$bang$(Action.scala:35)
    at com.intuit.karate.gatling.KarateAction.io$gatling$core$action$ChainableAction$$super$$bang(KarateAction.scala:26)
    at io.gatling.core.action.ChainableAction.$bang(Action.scala:60)
    at io.gatling.core.action.ChainableAction.$bang$(Action.scala:58)
    at com.intuit.karate.gatling.KarateAction.io$gatling$core$action$ExitableAction$$super$$bang(KarateAction.scala:26)
    at io.gatling.core.action.ExitableAction.$bang(BlockExit.scala:137)
    at io.gatling.core.action.ExitableAction.$bang$(BlockExit.scala:135)
    at com.intuit.karate.gatling.KarateAction.$bang(KarateAction.scala:26)
    at io.gatling.core.controller.inject.Injector.startUser(Injector.scala:130)
    at io.gatling.core.controller.inject.Injector.$anonfun$injectUser$1(Injector.scala:142)
    at akka.actor.Scheduler$$anon$4.run(Scheduler.scala:140)
    at akka.dispatch.TaskInvocation.run(AbstractDispatcher.scala:40)
    at akka.dispatch.ForkJoinExecutorConfigurator$AkkaForkJoinTask.exec(ForkJoinExecutorConfigurator.scala:43)
    at akka.dispatch.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260)
    at akka.dispatch.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1339)
    at akka.dispatch.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1979)
    at akka.dispatch.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:107)
    java.lang.reflect.InvocationTargetException
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at io.gatling.mojo.MainWithArgsInFile.runMain(MainWithArgsInFile.java:50)
        at io.gatling.mojo.MainWithArgsInFile.main(MainWithArgsInFile.java:33)
    Caused by: java.util.concurrent.TimeoutException: Futures timed out after [2 seconds]
        at scala.concurrent.impl.Promise$DefaultPromise.ready(Promise.scala:255)
        at scala.concurrent.impl.Promise$DefaultPromise.result(Promise.scala:259)
        at scala.concurrent.Await$.$anonfun$result$1(package.scala:215)
        at scala.concurrent.BlockContext$DefaultBlockContext$.blockOn(BlockContext.scala:53)
        at scala.concurrent.Await$.result(package.scala:142)
        at io.gatling.app.Gatling$.start(Gatling.scala:66)
        at io.gatling.app.Gatling$.fromArgs(Gatling.scala:45)
        at io.gatling.app.Gatling$.main(Gatling.scala:37)
        at io.gatling.app.Gatling.main(Gatling.scala)
        ... 6 more
    [INFO] ------------------------------------------------------------------------
    [INFO] BUILD FAILURE

1 个答案:

答案 0 :(得分:1)

是的,这是(唯一的)空手道-加特林集成的已知模仿,并在文档中明确提到:https://github.com/intuit/karate/tree/master/karate-gatling#limitations

从技术上讲这是可能的(但需要做一些工作),并将在以后的版本中提供。

我正在寻找可以更快做出贡献的人。

对于零暂停时间,您可以使用Nil

val protocol = karateProtocol(
  "/cats/{id}" -> Nil,
  "/cats" -> pauseFor("get" -> 15, "post" -> 25)
)