Locust 负载测试一个 "not secure" 站点

Locust load test a "not secure" site

我想用 API 在这个开发阶段被归类为“不安全”的网站进行测试。 在 Locust 文档中说:

Safe mode: The HTTP client is configured to run in safe_mode. What this does is that any request that fails due to a connection error, timeout, or similar will not raise an exception, but rather return an empty dummy Response object. The request will be reported as a failure in User’s statistics. The returned dummy Response’s content attribute will be set to None, and its status_code will be 0.

我想知道是否有配置可以让您禁用此选项。

感谢您的宝贵时间

safe_mode和SSL/TLS没有任何关系,指的是requests在请求失败时(不管什么原因)不抛出异常。

要让 HttpUser/requests 忽略 SSL 问题,请将 verify=False 添加到您的呼叫中。

——

您正在查看非常古老的 Locust 文档,对吧?我不认为你提到的文字已经存在了很长一段时间。

safe_mode 已从 requests 中删除(以前看起来像这样 https://github.com/psf/requests/pull/604) but the same behaviour is implemented by Locust here https://github.com/locustio/locust/blob/51b1d5038a2be6e2823b2576c4436f2ff9f7c7c2/locust/clients.py#L195