黄瓜救援异常(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。

blsyf 回答:黄瓜救援异常(Ruby / HTTParty)

这是一个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 发送的响应。

本文链接:https://www.f2er.com/3123295.html

大家都在问