使用Runner的场景大纲在0.9.3中可能存在线程问题

时间:2019-07-19 17:28:13

标签: karate

我注意到Jenkins的通宵工作在Junit报告中失败了,但在Cucumber中却失败了。查看日志,我看到相同的调用被调用了两次,一个调用由于套接字异常超时而失败,另一个调用失败了。 我们仍在使用Junit4。

在詹金斯的工作日志中:

00:40:23.954 [ForkJoinPool-1-worker-5] DEBUG com.intuit.karate - request:
1 > GET https://qa.api.company.com/account/v1/accounts/12345/obligations?pageNumber=1&pageSize=20000
1 > Accept-Encoding: gzip,deflate
1 > Connection: Keep-Alive
1 > Host: qa.api.company.com
1 > SourceApplicationName: integrationTest
1 > User-Agent: Apache-HttpClient/4.5.5 (Java/11.0.3)
1 > api-key: xxxx

00:40:26.012 [ForkJoinPool-1-worker-5] ERROR com.intuit.karate - java.net.SocketTimeoutException: Read timed out, http call failed after 2058 milliseconds for URL: https://qa.api.company.com/account/v1/accounts/12345/obligations?pageNumber=1&pageSize=20000
00:40:26.012 [ForkJoinPool-1-worker-5] ERROR com.intuit.karate - http request failed: 
java.net.SocketTimeoutException: Read timed out
00:46:08.259 [ForkJoinPool-2-worker-7] DEBUG com.intuit.karate - request:
1 > GET https://qa.api.company.com/account/v1/accounts/12345/obligations?pageNumber=1&pageSize=20000

来自黄瓜报告:

00:46:08.259 request:
1 > GET https://qa.api.company.com/account/v1/accounts/12345/obligations?pageNumber=1&pageSize=20000
1 > Accept-Encoding: gzip,deflate
1 > Connection: Keep-Alive
1 > Host: qa.api.republicservices.com
1 > SourceApplicationName: integrationTest
1 > User-Agent: Apache-HttpClient/4.5.5 (Java/11.0.3)
1 > api-key: masked

00:46:09.144 response time in milliseconds: 107.94
1 < 200

我能想到的一件事是,我们正在扩展“主”跑步者:

public class AccountsRunner extends IntegrationRunner {

    @Test
    public void accountsRunner() {
        Results results = Runner.parallel(getClass(), 5);

主跑步者:

@KarateOptions(tags = {"~@ignore"}, features = "classpath:tests/")
public class IntegrationRunner {

    @Test
    public void integrationRunner() {
        Results results = Runner.parallel(getClass(), 5);

不确定延长转轮是否会导致问题,或者这是空手道中的线程问题,但是我不希望一个方案在多个池中运行。

1 个答案:

答案 0 :(得分:0)

这可能很好,因为apache http客户端习惯于重试失败的请求达3次。