Skip to content

Rails 5: fix hashed_path? method that looks up file_location that doesn't exist…

What does this MR do?

Rails 5 fix for model.file_location that throws a NoMethodError: undefined method 'file_location' for #<Ci::JobArtifact:0x00007f9ba217a738> when running this code as part of migration specs. E.g. when running spec/lib/gitlab/background_migration/archive_legacy_traces_spec.rb:28 on Rails 5, when this hashed_path method gets called, the file_location column does not exist in the database because of the rollbacks in the specs. For Rails 4 getting the value of an enum for which the column does not exists just returns nil. This is different as Rails 5 gives a NoMethodError.

Introduced in !18615 (merged).

Reproducible by running RAILS5=1 bin/rspec spec/lib/gitlab/background_migration/archive_legacy_traces_spec.rb:28 See https://gitlab.com/gitlab-org/gitlab-ce/-/jobs/94757641 and https://gitlab.com/gitlab-org/gitlab-ce/-/jobs/94757645 for the errors.

What are the relevant issue numbers?

Does this MR meet the acceptance criteria?

Edited by Jasper Maes

Merge request reports