Flaky test spec/models/ci/runner_spec.rb:499 Ci::Runner.recent

The flaky test failure message is difficult to read, which is described in #414261 (closed)

I believe the error message should look like this:

expected: [#Ci::Runner id: 32, ...]\n got: #ActiveRecord::Relation [Ci::Runner id: 34, 35, 32]

The tests look like this so I think the ordering might have problems:

describe '.recent' do
  subject { described_class.recent }

  let!(:runner1) { create(:ci_runner, :instance, contacted_at: nil, created_at: 2.months.ago) }
  let!(:runner2) { create(:ci_runner, :instance, contacted_at: nil, created_at: 3.months.ago) }
  let!(:runner3) { create(:ci_runner, :instance, contacted_at: 1.month.ago, created_at: 2.months.ago) }
  let!(:runner4) { create(:ci_runner, :instance, contacted_at: 1.month.ago, created_at: 3.months.ago) }

  it { is_expected.to eq([runner1, runner3, runner4]) }
end
Edited by 🤖 GitLab Bot 🤖