Welcome to mirror list, hosted at ThFree Co, Russian Federation.

schedule_populate_merge_request_metrics_with_events_data_spec.rb « migrations « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 97e089c5cb888ff5a49704c1febb0cd58f342300 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
require 'spec_helper'
require Rails.root.join('db', 'post_migrate', '20171128214150_schedule_populate_merge_request_metrics_with_events_data.rb')

describe SchedulePopulateMergeRequestMetricsWithEventsData, :migration, :sidekiq do
  let!(:mrs) { create_list(:merge_request, 3) }

  it 'correctly schedules background migrations' do
    stub_const("#{described_class.name}::BATCH_SIZE", 2)

    Sidekiq::Testing.fake! do
      Timecop.freeze do
        migrate!

        expect(described_class::MIGRATION)
          .to be_scheduled_migration(10.minutes, mrs.first.id, mrs.second.id)

        expect(described_class::MIGRATION)
          .to be_scheduled_migration(20.minutes, mrs.third.id, mrs.third.id)

        expect(BackgroundMigrationWorker.jobs.size).to eq(2)
      end
    end
  end
end