Hi, after some research, this test failing issue caused by database_cleaner-sequel gem.
config here. https://github.com/zw963/marketbet_crawler/blob/4e3537a267d93c3fc109ccebc119d08571d58d43/test/test_helper.rb after change DatabaseCleaner[:sequel].strategy from :transaction into :truncate, all test case works now. I create a new issue there. https://github.com/DatabaseCleaner/database_cleaner-sequel/issues/23 do you think if this is expected behavior? if not, could you please give some guiding suggestions for that issue? Thank you. 在2021年11月1日星期一 UTC+8 下午11:25:38<Jeremy Evans> 写道: > On Mon, Nov 1, 2021 at 3:18 AM Billy Zheng <vil...@gmail.com> wrote: > >> >> I get many test failing message when add `Sequel.extension >> :fiber_concurrency` into sequel config file, but then comment it,it can't >> be fixed automatically. >> i have to `RACK_ENV=test rake db:drop db:create db:migrate` again, to >> make test pass again. >> >> ``` >> RACK_ENV=test >> DB connected: >> postgres://postgres:postgres@localhost:5432/marketbet_crawler_test >> Eager loading ... >> Run options: --seed 42654 >> >> # Running: >> >> ...FEE >> >> Fabulous run in 0.088470s, 67.8198 runs/s, 158.2461 assertions/s. >> >> 1) Failure: >> retrieve latest institutions#test_0001_get the expected institution list >> [/home/zw963/Stocks/marketbet_crawler/test/services/latest_institutions_test.rb:6]: >> >> >> Expected: 0 >> Actual: 1 >> >> 2) Error: >> test /stocks#test_0001_test /stocks return a stock lists: >> Sequel::UniqueConstraintViolation: PG::UniqueViolation: ERROR: duplicate >> key value violates unique constraint "exchanges_name_key" >> DETAIL: Key (name)=(nyse) already exists. >> >> >> /home/zw963/others/.rvm/gems/ruby-3.0.2@marketbet_crawler/gems/sequel_pg-1.14.0/lib/sequel/extensions/pg_streaming.rb:113:in >> >> `check' >> >> /home/zw963/others/.rvm/gems/ruby-3.0.2@marketbet_crawler/gems/sequel_pg-1.14.0/lib/sequel/extensions/pg_streaming.rb:113:in >> >> `yield_each_row' >> >> /home/zw963/others/.rvm/gems/ruby-3.0.2@marketbet_crawler/gems/sequel_pg-1.14.0/lib/sequel/extensions/pg_streaming.rb:113:in >> >> `block in fetch_rows' >> >> /home/zw963/others/.rvm/gems/ruby-3.0.2@marketbet_crawler/gems/sequel-5.49.0/lib/sequel/adapters/postgres.rb:146:in >> >> `execute' >> >> /home/zw963/others/.rvm/gems/ruby-3.0.2@marketbet_crawler/gems/sequel-5.49.0/lib/sequel/adapters/postgres.rb:500:in >> >> `_execute' >> >> /home/zw963/others/.rvm/gems/ruby-3.0.2@marketbet_crawler/gems/sequel_pg-1.14.0/lib/sequel/extensions/pg_streaming.rb:47:in >> >> `_execute' >> >> /home/zw963/others/.rvm/gems/ruby-3.0.2@marketbet_crawler/gems/sequel-5.49.0/lib/sequel/adapters/postgres.rb:318:in >> >> `block (2 levels) in execute' >> >> /home/zw963/others/.rvm/gems/ruby-3.0.2@marketbet_crawler/gems/sequel-5.49.0/lib/sequel/adapters/postgres.rb:522:in >> >> `check_database_errors' >> >> /home/zw963/others/.rvm/gems/ruby-3.0.2@marketbet_crawler/gems/sequel-5.49.0/lib/sequel/adapters/postgres.rb:318:in >> >> `block in execute' >> >> /home/zw963/others/.rvm/gems/ruby-3.0.2@marketbet_crawler/gems/sequel-5.49.0/lib/sequel/connection_pool/threaded.rb:88:in >> >> `hold' >> >> /home/zw963/others/.rvm/gems/ruby-3.0.2@marketbet_crawler/gems/sequel-5.49.0/lib/sequel/database/connecting.rb:269:in >> >> `synchronize' >> >> /home/zw963/others/.rvm/gems/ruby-3.0.2@marketbet_crawler/gems/sequel-5.49.0/lib/sequel/adapters/postgres.rb:318:in >> >> `execute' >> >> /home/zw963/others/.rvm/gems/ruby-3.0.2@marketbet_crawler/gems/sequel-5.49.0/lib/sequel/dataset/actions.rb:1093:in >> >> `execute' >> >> /home/zw963/others/.rvm/gems/ruby-3.0.2@marketbet_crawler/gems/sequel_pg-1.14.0/lib/sequel/extensions/pg_streaming.rb:112:in >> >> `fetch_rows' >> >> /home/zw963/others/.rvm/gems/ruby-3.0.2@marketbet_crawler/gems/sequel-5.49.0/lib/sequel/dataset/actions.rb:946:in >> >> `with_sql_each' >> >> /home/zw963/others/.rvm/gems/ruby-3.0.2@marketbet_crawler/gems/sequel-5.49.0/lib/sequel/dataset/actions.rb:954:in >> >> `with_sql_first' >> >> /home/zw963/others/.rvm/gems/ruby-3.0.2@marketbet_crawler/gems/sequel-5.49.0/lib/sequel/adapters/shared/postgres.rb:1721:in >> >> `insert_select' >> >> /home/zw963/others/.rvm/gems/ruby-3.0.2@marketbet_crawler/gems/sequel-5.49.0/lib/sequel/model/base.rb:1739:in >> >> `_insert_select_raw' >> >> /home/zw963/others/.rvm/gems/ruby-3.0.2@marketbet_crawler/gems/sequel-5.49.0/lib/sequel/model/base.rb:1712:in >> >> `_insert' >> >> /home/zw963/others/.rvm/gems/ruby-3.0.2@marketbet_crawler/gems/sequel-5.49.0/lib/sequel/model/base.rb:1784:in >> >> `block (2 levels) in _save' >> >> /home/zw963/others/.rvm/gems/ruby-3.0.2@marketbet_crawler/gems/sequel-5.49.0/lib/sequel/model/base.rb:1038:in >> >> `around_create' >> >> /home/zw963/others/.rvm/gems/ruby-3.0.2@marketbet_crawler/gems/sequel-5.49.0/lib/sequel/model/base.rb:1781:in >> >> `block in _save' >> >> /home/zw963/others/.rvm/gems/ruby-3.0.2@marketbet_crawler/gems/sequel-5.49.0/lib/sequel/model/base.rb:1038:in >> >> `around_save' >> >> /home/zw963/others/.rvm/gems/ruby-3.0.2@marketbet_crawler/gems/sequel-5.49.0/lib/sequel/model/base.rb:1776:in >> >> `_save' >> >> /home/zw963/others/.rvm/gems/ruby-3.0.2@marketbet_crawler/gems/sequel-5.49.0/lib/sequel/model/base.rb:1488:in >> >> `block (2 levels) in save' >> >> /home/zw963/others/.rvm/gems/ruby-3.0.2@marketbet_crawler/gems/sequel-5.49.0/lib/sequel/model/base.rb:1942:in >> >> `block in checked_transaction' >> >> /home/zw963/others/.rvm/gems/ruby-3.0.2@marketbet_crawler/gems/sequel-5.49.0/lib/sequel/database/transactions.rb:258:in >> >> `_transaction' >> >> /home/zw963/others/.rvm/gems/ruby-3.0.2@marketbet_crawler/gems/sequel-5.49.0/lib/sequel/database/transactions.rb:233:in >> >> `block in transaction' >> >> /home/zw963/others/.rvm/gems/ruby-3.0.2@marketbet_crawler/gems/sequel-5.49.0/lib/sequel/connection_pool/threaded.rb:92:in >> >> `hold' >> >> /home/zw963/others/.rvm/gems/ruby-3.0.2@marketbet_crawler/gems/sequel-5.49.0/lib/sequel/database/connecting.rb:269:in >> >> `synchronize' >> >> /home/zw963/others/.rvm/gems/ruby-3.0.2@marketbet_crawler/gems/sequel-5.49.0/lib/sequel/database/transactions.rb:195:in >> >> `transaction' >> >> /home/zw963/others/.rvm/gems/ruby-3.0.2@marketbet_crawler/gems/sequel-5.49.0/lib/sequel/model/base.rb:1942:in >> >> `checked_transaction' >> >> /home/zw963/others/.rvm/gems/ruby-3.0.2@marketbet_crawler/gems/sequel-5.49.0/lib/sequel/model/base.rb:1488:in >> >> `block in save' >> >> /home/zw963/others/.rvm/gems/ruby-3.0.2@marketbet_crawler/gems/sequel-5.49.0/lib/sequel/model/base.rb:1930:in >> >> `checked_save_failure' >> >> /home/zw963/others/.rvm/gems/ruby-3.0.2@marketbet_crawler/gems/sequel-5.49.0/lib/sequel/model/base.rb:1488:in >> >> `save' >> >> /home/zw963/others/.rvm/gems/ruby-3.0.2@marketbet_crawler/gems/sequel-5.49.0/lib/sequel/model/base.rb:254:in >> >> `create' >> /home/zw963/Stocks/marketbet_crawler/test/stocks_test.rb:5:in `block >> (2 levels) in <top (required)>' >> >> 3) Error: >> test /stocks#test_0002_test /stocks.json return json: >> Sequel::UniqueConstraintViolation: PG::UniqueViolation: ERROR: duplicate >> key value violates unique constraint "exchanges_name_key" >> DETAIL: Key (name)=(nyse) already exists. >> >> >> /home/zw963/others/.rvm/gems/ruby-3.0.2@marketbet_crawler/gems/sequel_pg-1.14.0/lib/sequel/extensions/pg_streaming.rb:113:in >> >> `check' >> >> /home/zw963/others/.rvm/gems/ruby-3.0.2@marketbet_crawler/gems/sequel_pg-1.14.0/lib/sequel/extensions/pg_streaming.rb:113:in >> >> `yield_each_row' >> >> /home/zw963/others/.rvm/gems/ruby-3.0.2@marketbet_crawler/gems/sequel_pg-1.14.0/lib/sequel/extensions/pg_streaming.rb:113:in >> >> `block in fetch_rows' >> >> /home/zw963/others/.rvm/gems/ruby-3.0.2@marketbet_crawler/gems/sequel-5.49.0/lib/sequel/adapters/postgres.rb:146:in >> >> `execute' >> >> /home/zw963/others/.rvm/gems/ruby-3.0.2@marketbet_crawler/gems/sequel-5.49.0/lib/sequel/adapters/postgres.rb:500:in >> >> `_execute' >> >> /home/zw963/others/.rvm/gems/ruby-3.0.2@marketbet_crawler/gems/sequel_pg-1.14.0/lib/sequel/extensions/pg_streaming.rb:47:in >> >> `_execute' >> >> /home/zw963/others/.rvm/gems/ruby-3.0.2@marketbet_crawler/gems/sequel-5.49.0/lib/sequel/adapters/postgres.rb:318:in >> >> `block (2 levels) in execute' >> >> /home/zw963/others/.rvm/gems/ruby-3.0.2@marketbet_crawler/gems/sequel-5.49.0/lib/sequel/adapters/postgres.rb:522:in >> >> `check_database_errors' >> >> /home/zw963/others/.rvm/gems/ruby-3.0.2@marketbet_crawler/gems/sequel-5.49.0/lib/sequel/adapters/postgres.rb:318:in >> >> `block in execute' >> >> /home/zw963/others/.rvm/gems/ruby-3.0.2@marketbet_crawler/gems/sequel-5.49.0/lib/sequel/connection_pool/threaded.rb:88:in >> >> `hold' >> >> /home/zw963/others/.rvm/gems/ruby-3.0.2@marketbet_crawler/gems/sequel-5.49.0/lib/sequel/database/connecting.rb:269:in >> >> `synchronize' >> >> /home/zw963/others/.rvm/gems/ruby-3.0.2@marketbet_crawler/gems/sequel-5.49.0/lib/sequel/adapters/postgres.rb:318:in >> >> `execute' >> >> /home/zw963/others/.rvm/gems/ruby-3.0.2@marketbet_crawler/gems/sequel-5.49.0/lib/sequel/dataset/actions.rb:1093:in >> >> `execute' >> >> /home/zw963/others/.rvm/gems/ruby-3.0.2@marketbet_crawler/gems/sequel_pg-1.14.0/lib/sequel/extensions/pg_streaming.rb:112:in >> >> `fetch_rows' >> >> /home/zw963/others/.rvm/gems/ruby-3.0.2@marketbet_crawler/gems/sequel-5.49.0/lib/sequel/dataset/actions.rb:946:in >> >> `with_sql_each' >> >> /home/zw963/others/.rvm/gems/ruby-3.0.2@marketbet_crawler/gems/sequel-5.49.0/lib/sequel/dataset/actions.rb:954:in >> >> `with_sql_first' >> >> /home/zw963/others/.rvm/gems/ruby-3.0.2@marketbet_crawler/gems/sequel-5.49.0/lib/sequel/adapters/shared/postgres.rb:1721:in >> >> `insert_select' >> >> /home/zw963/others/.rvm/gems/ruby-3.0.2@marketbet_crawler/gems/sequel-5.49.0/lib/sequel/model/base.rb:1739:in >> >> `_insert_select_raw' >> >> /home/zw963/others/.rvm/gems/ruby-3.0.2@marketbet_crawler/gems/sequel-5.49.0/lib/sequel/model/base.rb:1712:in >> >> `_insert' >> >> /home/zw963/others/.rvm/gems/ruby-3.0.2@marketbet_crawler/gems/sequel-5.49.0/lib/sequel/model/base.rb:1784:in >> >> `block (2 levels) in _save' >> >> /home/zw963/others/.rvm/gems/ruby-3.0.2@marketbet_crawler/gems/sequel-5.49.0/lib/sequel/model/base.rb:1038:in >> >> `around_create' >> >> /home/zw963/others/.rvm/gems/ruby-3.0.2@marketbet_crawler/gems/sequel-5.49.0/lib/sequel/model/base.rb:1781:in >> >> `block in _save' >> >> /home/zw963/others/.rvm/gems/ruby-3.0.2@marketbet_crawler/gems/sequel-5.49.0/lib/sequel/model/base.rb:1038:in >> >> `around_save' >> >> /home/zw963/others/.rvm/gems/ruby-3.0.2@marketbet_crawler/gems/sequel-5.49.0/lib/sequel/model/base.rb:1776:in >> >> `_save' >> >> /home/zw963/others/.rvm/gems/ruby-3.0.2@marketbet_crawler/gems/sequel-5.49.0/lib/sequel/model/base.rb:1488:in >> >> `block (2 levels) in save' >> >> /home/zw963/others/.rvm/gems/ruby-3.0.2@marketbet_crawler/gems/sequel-5.49.0/lib/sequel/model/base.rb:1942:in >> >> `block in checked_transaction' >> >> /home/zw963/others/.rvm/gems/ruby-3.0.2@marketbet_crawler/gems/sequel-5.49.0/lib/sequel/database/transactions.rb:258:in >> >> `_transaction' >> >> /home/zw963/others/.rvm/gems/ruby-3.0.2@marketbet_crawler/gems/sequel-5.49.0/lib/sequel/database/transactions.rb:233:in >> >> `block in transaction' >> >> /home/zw963/others/.rvm/gems/ruby-3.0.2@marketbet_crawler/gems/sequel-5.49.0/lib/sequel/connection_pool/threaded.rb:92:in >> >> `hold' >> >> /home/zw963/others/.rvm/gems/ruby-3.0.2@marketbet_crawler/gems/sequel-5.49.0/lib/sequel/database/connecting.rb:269:in >> >> `synchronize' >> >> /home/zw963/others/.rvm/gems/ruby-3.0.2@marketbet_crawler/gems/sequel-5.49.0/lib/sequel/database/transactions.rb:195:in >> >> `transaction' >> >> /home/zw963/others/.rvm/gems/ruby-3.0.2@marketbet_crawler/gems/sequel-5.49.0/lib/sequel/model/base.rb:1942:in >> >> `checked_transaction' >> >> /home/zw963/others/.rvm/gems/ruby-3.0.2@marketbet_crawler/gems/sequel-5.49.0/lib/sequel/model/base.rb:1488:in >> >> `block in save' >> >> /home/zw963/others/.rvm/gems/ruby-3.0.2@marketbet_crawler/gems/sequel-5.49.0/lib/sequel/model/base.rb:1930:in >> >> `checked_save_failure' >> >> /home/zw963/others/.rvm/gems/ruby-3.0.2@marketbet_crawler/gems/sequel-5.49.0/lib/sequel/model/base.rb:1488:in >> >> `save' >> >> /home/zw963/others/.rvm/gems/ruby-3.0.2@marketbet_crawler/gems/sequel-5.49.0/lib/sequel/model/base.rb:254:in >> >> `create' >> /home/zw963/Stocks/marketbet_crawler/test/stocks_test.rb:15:in `block >> (2 levels) in <top (required)>' >> >> 6 runs, 14 assertions, 1 failures, 2 errors, 0 skips >> rake aborted! >> Command failed with status (1) >> /home/zw963/others/.rvm/gems/ruby-3.0.2@marketbet_crawler/gems/rake-13.0.6/exe/rake:27:in >> >> `<top (required)>' >> /home/zw963/.rvm/rubies/ruby-3.0.2/bin/ruby_executable_hooks:22:in `eval' >> /home/zw963/.rvm/rubies/ruby-3.0.2/bin/ruby_executable_hooks:22:in >> `<main>' >> Tasks: TOP => default => test >> (See full trace by running task with --trace >> ``` >> >> I use rack-test for test, perhaps above failing caused by this gem? >> >> anyway, could you please guide me some clue on this? >> > > Unfortunately not, it could be a bug in your code. All of Sequel's > adapter/integration tests pass when using the fiber_concurrency extension > (you can use the SEQUEL_FIBER_CONCURRENCY environment variable to run the > adapter/integration tests with the extension loaded). > > If you can put together a self-contained minimal example, I will take a > look. > > Thanks, > Jeremy > -- You received this message because you are subscribed to the Google Groups "sequel-talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to sequel-talk+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/sequel-talk/216554e9-6a9c-4174-89de-a77c954a2752n%40googlegroups.com.