空手道加特林:设置本地地址

问题描述 投票:2回答:1

我有用于测试API的简单空手道功能文件,我想使用此功能文件进行负载测试。因此我使用Gatling来执行空手道特征文件:https://github.com/intuit/karate/tree/master/karate-gatling

但是,当我启动多个用户时,我想使用我配置的不同ip别名提交请求。

使用Gatling,我可以使用localAddress绑定到套接字

val protocol = http.localAddresses(ip)

但在Karate-Gatling中,使用了karateProtocol

val protocol = karateProtocol()

自述文件指出“空手道负责发出HTTP请求而Gatling只负责测量时间和管理线程”。

这意味着HTTP请求和localAddress绑定不能通过Gatling进行更改,但我想知道是否有通过Karate的解决方法,以便不同的ip别名可以用于不同的请求。

karate gatling gatling-plugin
1个回答
0
投票

这听起来像是需要一个功能请求来告诉HTTP客户端(例如Apache)使用本地地址。

如果你能帮助贡献和测试会很棒,设置localAddress的一种方法是在代码here中:

    RequestConfig.Builder configBuilder = RequestConfig.custom()
            .setCookieSpec(LenientCookieSpec.KARATE)
            .setConnectTimeout(config.getConnectTimeout())
            .setSocketTimeout(config.getReadTimeout());
    String localIp = "1.2.3.4";
    try {            
        InetAddress localAddress = InetAddress.getByName(localIp);
        configBuilder.setLocalAddress(localAddress);
    } catch (Exception e) {
        context.logger.error("failed to resolve local address: {}", localIp);
    }
© www.soinside.com 2019 - 2024. All rights reserved.