gpt4 book ai didi

Mysql2::Error: # MySQL 客户端未连接 — Rails 6.0.2.2 with rspec; Ruby 2.6.4 mac os Catalina + Mojave

转载 作者:行者123 更新时间:2023-12-04 16:27:20 25 4
gpt4 key购买 nike

我在 Rails 6.0.2.2 上遇到 MySQL 的这个非常奇怪的间歇性问题,
RSpec 4.0.0.rc1,
ruby 2.6.4

在两台独立的 Mac 上,一台运行 macOS Mojave,另一台运行 MacOS Catalina

有趣的是,运行 Catalina 的 mac 似乎很少这样做,尽管它仍然这样做。故障是间歇性的,似乎是在套件中的另一次故障之后立即发生,但在随后的运行中经常继续出现(在大约一半的测试套件中),即使我已经修复了最初失败的规范。

  1) Template 
Failure/Error: _query(sql, @query_options.merge(options))

ActiveRecord::StatementInvalid:
Mysql2::Error: MySQL client is not connected
# /Users/jason/.rvm/gems/ruby-2.6.4/gems/mysql2-0.5.3/lib/mysql2/client.rb:131:in `_query'
# /Users/jason/.rvm/gems/ruby-2.6.4/gems/mysql2-0.5.3/lib/mysql2/client.rb:131:in `block in query'
# /Users/jason/.rvm/gems/ruby-2.6.4/gems/mysql2-0.5.3/lib/mysql2/client.rb:130:in `handle_interrupt'
# /Users/jason/.rvm/gems/ruby-2.6.4/gems/mysql2-0.5.3/lib/mysql2/client.rb:130:in `query'
# /Users/jason/.rvm/gems/ruby-2.6.4/gems/rspec-wait-0.0.9/lib/rspec/wait.rb:46:in `block (2 levels) in <top (required)>'
# ------------------
# --- Caused by: ---
# Mysql2::Error:
# MySQL client is not connected
# /Users/jason/.rvm/gems/ruby-2.6.4/gems/mysql2-0.5.3/lib/mysql2/client.rb:131:in `_query'

最佳答案

就我而言,我在为 ActiveJob 后台作业运行测试时遇到了问题,并且
添加 config.active_job.queue_adapter = :test到 config/environments/test.rb 为我工作。

关于Mysql2::Error: # MySQL 客户端未连接 — Rails 6.0.2.2 with rspec; Ruby 2.6.4 mac os Catalina + Mojave,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60919107/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com