blob: 5921dd64c0e9eaa7670fa977ec1d55220bf9379e (
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
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
# frozen_string_literal: true
require 'spec_helper'
require_migration!
RSpec.describe FixIncorrectJobArtifactsExpireAt, migration: :gitlab_ci do
let_it_be(:batched_migration) { described_class::MIGRATION }
it 'does not schedule background jobs when Gitlab.com is true' do
allow(Gitlab).to receive(:com?).and_return(true)
reversible_migration do |migration|
migration.before -> {
expect(batched_migration).not_to have_scheduled_batched_migration
}
migration.after -> {
expect(batched_migration).not_to have_scheduled_batched_migration
}
end
end
it 'schedules background job on non Gitlab.com' do
allow(Gitlab).to receive(:com?).and_return(false)
reversible_migration do |migration|
migration.before -> {
expect(batched_migration).not_to have_scheduled_batched_migration
}
migration.after -> {
expect(batched_migration).to have_scheduled_batched_migration(
gitlab_schema: :gitlab_ci,
table_name: :ci_job_artifacts,
column_name: :id,
interval: described_class::INTERVAL,
batch_size: described_class::BATCH_SIZE
)
}
end
end
end
|