Commit bec87301 authored by Peter Leitzen's avatar Peter Leitzen

Ensure that migration specs work without bot_type

Before this commit some migration specs failed with

    4) Gitlab::BackgroundMigration::DeleteDiffFiles#perform when diff
       files can be deleted rollsback if something goes wrong
       Failure/Error: return false if internal?

       NameError:
         undefined local variable or method `bot_type' for
           #<User id: @namespace1117>
         Did you mean?  bot_type=
                        bot_type?
       # ./ee/app/models/ee/user.rb:281:in `bot?'
       # ./ee/app/models/ee/user.rb:277:in `internal?'
       # ./app/models/user.rb:1452:in `password_required?'
       # ./ee/app/models/ee/user.rb:290:in `password_required?'

https://gitlab.com/gitlab-org/gitlab-ee/-/jobs/185393284

It's because we migrate down before each migration spec which actually
introduces `bot_type`.
parent 19abaa73
......@@ -242,7 +242,7 @@ module EE
end
def bot?
bot_type.present?
has_bot_type? ? bot_type.present? : old_support_bot
end
protected
......@@ -256,6 +256,14 @@ module EE
private
def has_bot_type?
has_attribute?(:bot_type)
end
def old_support_bot
read_attribute(:support_bot)
end
def namespace_union(select = :id)
::Gitlab::SQL::Union.new([
::Namespace.select(select).where(type: nil, owner: self),
......
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