Fix flaky spec for the with_debian_file_type scope
🤔 What does this MR do and why?
The package file spec for the with_debian_file_type
scope is flaky which produces master-brokenflaky-test situations (see gitlab-org/quality/engineering-productivity/master-broken-incidents#7219 (closed)).
We are assuming that the problem from how the expected package file is set. It relies on some_package.package_files.last
. Our suspicion is that the package files insertion order is somehow not the one that is described.
Thus, the solution we're applying here is: do not use #last
but a "dumb" ruby loop to get the package that we want.
🏁 MR acceptance checklist
Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
🌈 Screenshots or screen recordings
RSpec changes...
⚙ How to set up and validate locally
$ bundle exec rspec 'spec/models/packages/package_file_spec.rb:172'