blob: efbbe22fd1bac21f4a1dcb901f80094aa057337b (
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
# frozen_string_literal: true
require 'spec_helper'
require_migration!
RSpec.describe TruncateErrorTrackingTables, :migration, feature_category: :redis do
let(:migration) { described_class.new }
context 'when on GitLab.com' do
before do
allow(Gitlab).to receive(:com?).and_return(true)
end
context 'when using Main db' do
it 'truncates the table' do
expect(described_class.connection).to receive(:execute).with('TRUNCATE table error_tracking_errors CASCADE')
migration.up
end
end
context 'when uses CI db', migration: :gitlab_ci do
before do
skip_if_multiple_databases_not_setup(:ci)
end
it 'does not truncate the table' do
expect(described_class.connection).not_to receive(:execute).with('TRUNCATE table error_tracking_errors CASCADE')
migration.up
end
end
end
context 'when on self-managed' do
before do
allow(Gitlab).to receive(:com?).and_return(false)
end
context 'when using Main db' do
it 'does not truncate the table' do
expect(described_class.connection).not_to receive(:execute).with('TRUNCATE table error_tracking_errors CASCADE')
migration.up
end
end
context 'when uses CI db', migration: :gitlab_ci do
it 'does not truncate the table' do
expect(described_class.connection).not_to receive(:execute).with('TRUNCATE table error_tracking_errors CASCADE')
migration.up
end
end
end
end
|