Skip to content

spec/tasks/gitlab/db_rake_spec.rb fails when running in decomposed databases

Job #1732710471 failed for 3a2cd1e2:

Failures:
  1) gitlab:db namespace rake task reindex cleans up any leftover indexes
     Failure/Error: expect(Gitlab::Database::Reindexing).to receive(:cleanup_leftovers!)
       (Gitlab::Database::Reindexing).cleanup_leftovers!(*(any args))
           expected: 1 time with any arguments
           received: 2 times with any arguments
     # ./spec/tasks/gitlab/db_rake_spec.rb:206:in `block (3 levels) in <top (required)>'
     # ./spec/spec_helper.rb:408:in `block (3 levels) in <top (required)>'
     # ./spec/support/sidekiq_middleware.rb:9:in `with_sidekiq_server_middleware'
     # ./spec/spec_helper.rb:399:in `block (2 levels) in <top (required)>'
     # ./spec/spec_helper.rb:395:in `block (3 levels) in <top (required)>'
     # ./lib/gitlab/application_context.rb:31:in `with_raw_context'
     # ./spec/spec_helper.rb:395:in `block (2 levels) in <top (required)>'
     # ./spec/support/database/prevent_cross_joins.rb:102:in `block (3 levels) in <top (required)>'
     # ./spec/support/database/prevent_cross_joins.rb:56:in `with_cross_joins_prevented'
     # ./spec/support/database/prevent_cross_joins.rb:102:in `block (2 levels) in <top (required)>'
  2) gitlab:db namespace rake task reindex when async index creation is enabled executes async index creation prior to any reindexing actions
     Failure/Error: expect(Gitlab::Database::AsyncIndexes).to receive(:create_pending_indexes!).ordered
       (Gitlab::Database::AsyncIndexes).create_pending_indexes!(*(any args))
           expected: 1 time with any arguments
           received: 2 times with any arguments
     # ./spec/tasks/gitlab/db_rake_spec.rb:215:in `block (4 levels) in <top (required)>'
     # ./spec/spec_helper.rb:408:in `block (3 levels) in <top (required)>'
     # ./spec/support/sidekiq_middleware.rb:9:in `with_sidekiq_server_middleware'
     # ./spec/spec_helper.rb:399:in `block (2 levels) in <top (required)>'
     # ./spec/spec_helper.rb:395:in `block (3 levels) in <top (required)>'
     # ./lib/gitlab/application_context.rb:31:in `with_raw_context'
     # ./spec/spec_helper.rb:395:in `block (2 levels) in <top (required)>'
     # ./spec/support/database/prevent_cross_joins.rb:102:in `block (3 levels) in <top (required)>'
     # ./spec/support/database/prevent_cross_joins.rb:56:in `with_cross_joins_prevented'
     # ./spec/support/database/prevent_cross_joins.rb:102:in `block (2 levels) in <top (required)>'
  3) gitlab:db namespace rake task reindex when no index_name is given uses all candidate indexes
     Failure/Error: expect(Gitlab::Database::PostgresIndex).to receive(:reindexing_support).and_return(indexes)
       (Gitlab::Database::PostgresIndex(identifier: text, indexrelid: oid, schema: string, name: string, tablename: string, type: string, unique: boolean, valid_index: boolean, partitioned: boolean, exclusion: boolean, expression: boolean, partial: boolean, definition: text, ondisk_size_bytes: integer) (class)).reindexing_support(*(any args))
           expected: 1 time with any arguments
           received: 2 times with any arguments
     # ./spec/tasks/gitlab/db_rake_spec.rb:234:in `block (4 levels) in <top (required)>'
     # ./spec/spec_helper.rb:408:in `block (3 levels) in <top (required)>'
     # ./spec/support/sidekiq_middleware.rb:9:in `with_sidekiq_server_middleware'
     # ./spec/spec_helper.rb:399:in `block (2 levels) in <top (required)>'
     # ./spec/spec_helper.rb:395:in `block (3 levels) in <top (required)>'
     # ./lib/gitlab/application_context.rb:31:in `with_raw_context'
     # ./spec/spec_helper.rb:395:in `block (2 levels) in <top (required)>'
     # ./spec/support/database/prevent_cross_joins.rb:102:in `block (3 levels) in <top (required)>'
     # ./spec/support/database/prevent_cross_joins.rb:56:in `with_cross_joins_prevented'
     # ./spec/support/database/prevent_cross_joins.rb:102:in `block (2 levels) in <top (required)>'
  4) gitlab:db namespace rake task reindex with index name given calls the index rebuilder with the proper arguments
     Failure/Error: Gitlab::Database::Reindexing.perform(indexes)
       Gitlab::Database::Reindexing received :perform with unexpected arguments
         expected: ([#<Double "index">])
              got: (#<Double "indexes">)
       Diff:
       @@ -1 +1 @@
       -[[#<Double "index">]]
       +[#<Double "indexes">]
     # ./lib/tasks/gitlab/db.rake:189:in `block (4 levels) in <top (required)>'
     # ./lib/gitlab/database/each_database.rb:12:in `block (2 levels) in each_database_connection'
     # ./lib/gitlab/database/each_database.rb:33:in `block in with_shared_connection'
     # ./lib/gitlab/database/shared_model.rb:15:in `using_connection'
     # ./lib/gitlab/database/each_database.rb:30:in `with_shared_connection'
     # ./lib/gitlab/database/each_database.rb:11:in `block in each_database_connection'
     # ./lib/gitlab/database/each_database.rb:8:in `each_pair'
     # ./lib/gitlab/database/each_database.rb:8:in `each_database_connection'
     # ./lib/tasks/gitlab/db.rake:170:in `block (3 levels) in <top (required)>'
     # ./spec/tasks/gitlab/db_rake_spec.rb:355:in `run_rake_task'
     # ./spec/tasks/gitlab/db_rake_spec.rb:252:in `block (4 levels) in <top (required)>'
     # ./spec/spec_helper.rb:408:in `block (3 levels) in <top (required)>'
     # ./spec/support/sidekiq_middleware.rb:9:in `with_sidekiq_server_middleware'
     # ./spec/spec_helper.rb:399:in `block (2 levels) in <top (required)>'
     # ./spec/spec_helper.rb:395:in `block (3 levels) in <top (required)>'
     # ./lib/gitlab/application_context.rb:31:in `with_raw_context'
     # ./spec/spec_helper.rb:395:in `block (2 levels) in <top (required)>'
     # ./spec/support/database/prevent_cross_joins.rb:102:in `block (3 levels) in <top (required)>'
     # ./spec/support/database/prevent_cross_joins.rb:56:in `with_cross_joins_prevented'
     # ./spec/support/database/prevent_cross_joins.rb:102:in `block (2 levels) in <top (required)>'
  5) gitlab:db namespace rake task reindex with index name given when database name is provided calls the index rebuilder with the proper arguments when the database name match
     Failure/Error: Gitlab::Database::Reindexing.perform(indexes)
       Gitlab::Database::Reindexing received :perform with unexpected arguments
         expected: ([#<Double "index">])
              got: (#<Double "indexes">)
       Diff:
       @@ -1 +1 @@
       -[[#<Double "index">]]
       +[#<Double "indexes">]
     # ./lib/tasks/gitlab/db.rake:189:in `block (4 levels) in <top (required)>'
     # ./lib/gitlab/database/each_database.rb:12:in `block (2 levels) in each_database_connection'
     # ./lib/gitlab/database/each_database.rb:33:in `block in with_shared_connection'
     # ./lib/gitlab/database/shared_model.rb:15:in `using_connection'
     # ./lib/gitlab/database/each_database.rb:30:in `with_shared_connection'
     # ./lib/gitlab/database/each_database.rb:11:in `block in each_database_connection'
     # ./lib/gitlab/database/each_database.rb:8:in `each_pair'
     # ./lib/gitlab/database/each_database.rb:8:in `each_database_connection'
     # ./lib/tasks/gitlab/db.rake:170:in `block (3 levels) in <top (required)>'
     # ./spec/tasks/gitlab/db_rake_spec.rb:355:in `run_rake_task'
     # ./spec/tasks/gitlab/db_rake_spec.rb:260:in `block (5 levels) in <top (required)>'
     # ./spec/spec_helper.rb:408:in `block (3 levels) in <top (required)>'
     # ./spec/support/sidekiq_middleware.rb:9:in `with_sidekiq_server_middleware'
     # ./spec/spec_helper.rb:399:in `block (2 levels) in <top (required)>'
     # ./spec/spec_helper.rb:395:in `block (3 levels) in <top (required)>'
     # ./lib/gitlab/application_context.rb:31:in `with_raw_context'
     # ./spec/spec_helper.rb:395:in `block (2 levels) in <top (required)>'
     # ./spec/support/database/prevent_cross_joins.rb:102:in `block (3 levels) in <top (required)>'
     # ./spec/support/database/prevent_cross_joins.rb:56:in `with_cross_joins_prevented'
     # ./spec/support/database/prevent_cross_joins.rb:102:in `block (2 levels) in <top (required)>'
  6) gitlab:db namespace rake task reindex with index name given when database name is provided ignores the index and uses all candidate indexes if database name does not match
     Failure/Error: indexes = indexes.where(identifier: identifier)
       #<Double "indexes"> received unexpected message :where with ({:identifier=>"public.foo_idx"})
     # ./lib/tasks/gitlab/db.rake:176:in `block (4 levels) in <top (required)>'
     # ./lib/gitlab/database/each_database.rb:12:in `block (2 levels) in each_database_connection'
     # ./lib/gitlab/database/each_database.rb:33:in `block in with_shared_connection'
     # ./lib/gitlab/database/shared_model.rb:15:in `using_connection'
     # ./lib/gitlab/database/each_database.rb:30:in `with_shared_connection'
     # ./lib/gitlab/database/each_database.rb:11:in `block in each_database_connection'
     # ./lib/gitlab/database/each_database.rb:8:in `each_pair'
     # ./lib/gitlab/database/each_database.rb:8:in `each_database_connection'
     # ./lib/tasks/gitlab/db.rake:170:in `block (3 levels) in <top (required)>'
     # ./spec/tasks/gitlab/db_rake_spec.rb:355:in `run_rake_task'
     # ./spec/tasks/gitlab/db_rake_spec.rb:267:in `block (5 levels) in <top (required)>'
     # ./spec/spec_helper.rb:408:in `block (3 levels) in <top (required)>'
     # ./spec/support/sidekiq_middleware.rb:9:in `with_sidekiq_server_middleware'
     # ./spec/spec_helper.rb:399:in `block (2 levels) in <top (required)>'
     # ./spec/spec_helper.rb:395:in `block (3 levels) in <top (required)>'
     # ./lib/gitlab/application_context.rb:31:in `with_raw_context'
     # ./spec/spec_helper.rb:395:in `block (2 levels) in <top (required)>'
     # ./spec/support/database/prevent_cross_joins.rb:102:in `block (3 levels) in <top (required)>'
     # ./spec/support/database/prevent_cross_joins.rb:56:in `with_cross_joins_prevented'
     # ./spec/support/database/prevent_cross_joins.rb:102:in `block (2 levels) in <top (required)>'
Finished in 36 minutes 20 seconds (files took 1 minute 11.83 seconds to load)
3766 examples, 6 failures, 19 pending
Failed examples:
rspec ./spec/tasks/gitlab/db_rake_spec.rb:205 # gitlab:db namespace rake task reindex cleans up any leftover indexes
rspec ./spec/tasks/gitlab/db_rake_spec.rb:212 # gitlab:db namespace rake task reindex when async index creation is enabled executes async index creation prior to any reindexing actions
rspec ./spec/tasks/gitlab/db_rake_spec.rb:233 # gitlab:db namespace rake task reindex when no index_name is given uses all candidate indexes
rspec ./spec/tasks/gitlab/db_rake_spec.rb:248 # gitlab:db namespace rake task reindex with index name given calls the index rebuilder with the proper arguments
rspec ./spec/tasks/gitlab/db_rake_spec.rb:256 # gitlab:db namespace rake task reindex with index name given when database name is provided calls the index rebuilder with the proper arguments when the database name match
rspec ./spec/tasks/gitlab/db_rake_spec.rb:263 # gitlab:db namespace rake task reindex with index name given when database name is provided ignores the index and uses all candidate indexes if database name does not match

/cc @krasio