Commit 18724b07 authored by Stan Hu's avatar Stan Hu

Merge branch 'id-extract-rails-6-1-commits' into 'master'

Provide changes that fix tests for Rails 6.1

See merge request gitlab-org/gitlab!61447
parents 70d40db5 4808039c
......@@ -17,7 +17,7 @@ class UpdateHighestRoleWorker
return unless user.present?
if user.active? && user.user_type.nil? && !user.internal?
if user.active? && user.human? && !user.internal?
Users::UpdateHighestMemberRoleService.new(user).execute
else
UserHighestRole.where(user_id: user_id).delete_all
......
# This file is created only to be able to run `derailed exec perf:mem` task
# This task loads the whole Rails application using its own initializers
......@@ -30,7 +30,7 @@ module EE
result[project_id] = {
average_coverage: average_coverage,
coverage_count: coverage_count,
last_updated_on: date
last_updated_on: Date.parse(date.to_s)
}
end
end
......
......@@ -154,7 +154,7 @@ RSpec.describe EpicIssues::CreateService do
# and we insert 5 issues instead of 1 which we do for control count
expect { described_class.new(epic, user, params).execute }
.not_to exceed_query_limit(control_count)
.with_threshold(28)
.with_threshold(29)
end
end
......
......@@ -16,7 +16,7 @@ module AfterCommitQueue
def run_after_commit_or_now(&block)
if Gitlab::Database.inside_transaction?
if ActiveRecord::Base.connection.current_transaction.records.include?(self)
if ActiveRecord::Base.connection.current_transaction.records&.include?(self)
run_after_commit(&block)
else
# If the current transaction does not include this record, we can run
......
......@@ -19,6 +19,8 @@ module Gitlab
# polluted with other unrelated errors (e.g. state machine)
# https://gitlab.com/gitlab-org/gitlab/-/issues/220823
pipeline.errors.add(:base, message)
pipeline.errors.full_messages
end
def warning(message)
......
......@@ -607,7 +607,7 @@ module Gitlab
unique_users_all_imports: unique_users_all_imports(time_period),
bulk_imports: {
gitlab: DEPRECATED_VALUE,
gitlab_v1: count(::BulkImport.where(time_period, source_type: :gitlab))
gitlab_v1: count(::BulkImport.where(**time_period, source_type: :gitlab))
},
project_imports: project_imports(time_period),
issue_imports: issue_imports(time_period),
......
......@@ -100,7 +100,8 @@ RSpec.describe InternalId do
context 'when executed outside of transaction' do
it 'increments counter with in_transaction: "false"' do
expect(ActiveRecord::Base.connection).to receive(:transaction_open?) { false }
allow(ActiveRecord::Base.connection).to receive(:transaction_open?) { false }
expect(InternalId::InternalIdGenerator.internal_id_transactions_total).to receive(:increment)
.with(operation: :generate, usage: 'issues', in_transaction: 'false').and_call_original
......@@ -158,7 +159,8 @@ RSpec.describe InternalId do
let(:value) { 2 }
it 'increments counter with in_transaction: "false"' do
expect(ActiveRecord::Base.connection).to receive(:transaction_open?) { false }
allow(ActiveRecord::Base.connection).to receive(:transaction_open?) { false }
expect(InternalId::InternalIdGenerator.internal_id_transactions_total).to receive(:increment)
.with(operation: :reset, usage: 'issues', in_transaction: 'false').and_call_original
......@@ -228,7 +230,8 @@ RSpec.describe InternalId do
context 'when executed outside of transaction' do
it 'increments counter with in_transaction: "false"' do
expect(ActiveRecord::Base.connection).to receive(:transaction_open?) { false }
allow(ActiveRecord::Base.connection).to receive(:transaction_open?) { false }
expect(InternalId::InternalIdGenerator.internal_id_transactions_total).to receive(:increment)
.with(operation: :track_greatest, usage: 'issues', in_transaction: 'false').and_call_original
......
......@@ -179,7 +179,7 @@ RSpec.describe Users::BuildService do
params.merge!({ user_type: :project_bot })
end
it { expect(user.project_bot?).to be true}
it { expect(user.project_bot?).to be true }
end
context 'when not a project_bot' do
......@@ -187,7 +187,7 @@ RSpec.describe Users::BuildService do
params.merge!({ user_type: :alert_bot })
end
it { expect(user.user_type).to be nil }
it { expect(user).to be_human }
end
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment