本文介绍了空手道加特林(Karate Gatling)使用加特林(Gatling)的油门功能时会引发异常,并且不会生成任何报告的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

While doing a POC, I am facing an issue. Karate Gatling works well in doing injections for simulations using Gatling. However, when I tried to use the Gatlings throttle feature, it throws a few exceptions. The executions completed saying - Simulation com.perffeatures.ExecuteThrottle completed in 150 seconds. The exception is thrown after this. Report is not generated

这是我尝试过的情况

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")
  }
}

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

I am getting exceptions like this after the execution completion

    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

推荐答案

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

Yes, this is (the only?) known lmitation of Karate-Gatling integration as of now and clearly mentioned in the documentation: https://github.com/intuit/karate/tree/master/karate-gatling#limitations

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

This is technically possible (but needs some work) and will be made available in a future release.

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

And I'm looking for someone who can contribute sooner.

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

For zero pause times you can use Nil

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

这篇关于空手道加特林(Karate Gatling)使用加特林(Gatling)的油门功能时会引发异常,并且不会生成任何报告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-25 01:09