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

20220505174658_update_index_on_alerts_to_exclude_null_fingerprints_spec.rb « migrations « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: ec58a54b085d7fffe265c8ef5b098bd309189a0e (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
# frozen_string_literal: true

require 'spec_helper'
require_migration!

RSpec.describe UpdateIndexOnAlertsToExcludeNullFingerprints do
  let(:alerts) { 'alert_management_alerts' }
  let(:old_index) { described_class::OLD_INDEX_NAME }
  let(:new_index) { described_class::NEW_INDEX_NAME }

  it 'correctly migrates up and down' do
    reversible_migration do |migration|
      migration.before -> {
        expect(subject.index_exists_by_name?(alerts, old_index)).to be_truthy
        expect(subject.index_exists_by_name?(alerts, new_index)).to be_falsey
      }

      migration.after -> {
        expect(subject.index_exists_by_name?(alerts, old_index)).to be_falsey
        expect(subject.index_exists_by_name?(alerts, new_index)).to be_truthy
      }
    end
  end
end