黄瓜救援异常(Ruby/HTTParty)



我在运行Cucumber测试时遇到了一个异常,我试图找到我能做些什么,但没有成功。

当我在最后一步发帖时:

When('accept terms of use') do
until @o == 200
@o = CadastroApp.sign_term1.code
sleep 1
end
end
class CadastroApp
include HTTParty
def self.sign_term1
post("#{$uat_uri}agree/multipleterms",
body: {
'ContractsId': $contract1,
'deviceType': 'Smartphone',
'Platform': 'ios',
'Model': 'Iphone XS max',
}.to_json,
headers: {
'Authorization': "Bearer #{$auth_token}",
'Content-Type': 'application/json'
})
end
end

我得到了错误:

52: def self.cucumber_run_with_backtrace_filtering(pseudo_method)
53:   begin
54:     yield
55:   rescue Exception => e
56:     instance_exec_invocation_line = "#{__FILE__}:#{__LINE__ - 2}:in `cucumber_run_with_backtrace_filtering'"
57:     replace_instance_exec_invocation_line!((e.backtrace || []), instance_exec_invocation_line, pseudo_method)
58:     raise e
59:   end
60: end

我不知道这是否是一个问题,但我使用了很多"直到@variable==200"来循环api,直到我得到响应代码200。

这是一个MYSQL问题。当我请求API时,MYSQL不会关闭请求,所以当我检查Kubernetes时会有很多超时。

Exception Caught by LogRequestResponseMiddleware:
1) ----- Exception Type
MySql.Data.MySqlClient.MySqlException
1) ----- Exception Source
MySql.Data
1) ----- Exception TargetSite
MySql.Data.MySqlClient.Driver GetConnection()
1) ----- Exception Message
error connecting: Timeout expired.  The timeout period elapsed prior to obtaining a connection from the pool.  This may have occurred because all pooled connections were in use and max pool size was reached.
Message = error connecting: Timeout expired.  The timeout period elapsed prior to obtaining a connection from the pool.  This may have occurred because all pooled connections were in use and max pool size was reac
hed.

所以我重新发布了API,自动化运行良好。

这不是一个错误。这是Ruby在步骤中出错时发送的响应。

最新更新