加特林进纸器的值用完了

时间:2019-01-08 07:19:25

标签: scala gatling

我有一个要用于2个供料器的数组。我期望每个馈线将能够使用数组中的所有值。但是好像值用完了

val baseArray = Array (  Map("transactionId" -> "q-1"),
            Map("transactionId" -> "q-2"),
            Map("transactionId" -> "q-3"))


val feeder_getA = baseArray.clone.queue             
val scn_getInsuredOrPrincipals = scenario("getInsuredOrPrincipals")
    .feed(feeder_getA)  
    .exec(http("request_getA").get("/getA/${transactionId}"))

val feeder_getB = baseArray.clone.queue             
val scn_getInsuredOrPrincipals = scenario("getInsuredOrPrincipals")
    .feed(feeder_getB)  
    .exec(http("request_getB").get("/getB/${transactionId}"))   



setUp(
    scn_getInsuredOrPrincipals.inject(
            atOnceUsers(3), // 2
            rampUsers(3) over (5 seconds)
    ),
    scn_getInsuredOrPrincipal.inject(
            atOnceUsers(3), // 2
            rampUsers(3) over (5 seconds)
        )
)   


I get an error saying feeder is now empty after 3 values are consumed... i was assuming feeder_getA  and feeder_getB would each get 3 values so each scenario would get equal number of values. That doesnt seem like  its happening. Almot as if the clone isnt working

1 个答案:

答案 0 :(得分:0)

问题在于,您的供稿器是使用queue策略定义的,该策略遍历所有元素,然后在没有更多可用资源时失败:

val feeder_getA = baseArray.clone.queue

您需要使用circular策略,该策略可以追溯到一开始:

val feeder_getA = baseArray.clone.circular

有关更多信息,see the docs.