Commit d6ecc99d authored by Dylan Griffith's avatar Dylan Griffith

Merge branch '354776-remove-database-async-index-creation-ff-from-migration-helpers' into 'master'

Remove `database_async_index_creation` feature flag check from migration helpers

See merge request gitlab-org/gitlab!82565
parents ac1c2533 f296a13d
......@@ -72,8 +72,7 @@ module Gitlab
end
def async_index_creation_available?
ApplicationRecord.connection.table_exists?(:postgres_async_indexes) &&
Feature.enabled?(:database_async_index_creation, type: :ops)
connection.table_exists?(:postgres_async_indexes)
end
end
end
......
......@@ -16,11 +16,6 @@ RSpec.describe Gitlab::Database::AsyncIndexes::MigrationHelpers do
describe '#unprepare_async_index' do
let!(:async_index) { create(:postgres_async_index, name: index_name) }
context 'when the flag is enabled' do
before do
stub_feature_flags(database_async_index_creation: true)
end
it 'destroys the record' do
expect do
migration.unprepare_async_index(table_name, 'id')
......@@ -48,26 +43,10 @@ RSpec.describe Gitlab::Database::AsyncIndexes::MigrationHelpers do
end
end
context 'when the feature flag is disabled' do
it 'does not destroy the record' do
stub_feature_flags(database_async_index_creation: false)
expect do
migration.unprepare_async_index(table_name, 'id')
end.not_to change { index_model.where(name: index_name).count }
end
end
end
describe '#unprepare_async_index_by_name' do
let(:index_name) { "index_#{table_name}_on_id" }
let!(:async_index) { create(:postgres_async_index, name: index_name) }
context 'when the flag is enabled' do
before do
stub_feature_flags(database_async_index_creation: true)
end
it 'destroys the record' do
expect do
migration.unprepare_async_index_by_name(table_name, index_name)
......@@ -85,27 +64,11 @@ RSpec.describe Gitlab::Database::AsyncIndexes::MigrationHelpers do
end
end
context 'when the feature flag is disabled' do
it 'does not destroy the record' do
stub_feature_flags(database_async_index_creation: false)
expect do
migration.unprepare_async_index_by_name(table_name, index_name)
end.not_to change { index_model.where(name: index_name).count }
end
end
end
describe '#prepare_async_index' do
before do
connection.create_table(table_name)
end
context 'when the feature flag is enabled' do
before do
stub_feature_flags(database_async_index_creation: true)
end
it 'creates the record for the async index' do
expect do
migration.prepare_async_index(table_name, 'id')
......@@ -179,15 +142,4 @@ RSpec.describe Gitlab::Database::AsyncIndexes::MigrationHelpers do
end
end
end
context 'when the feature flag is disabled' do
it 'does not create the record' do
stub_feature_flags(database_async_index_creation: false)
expect do
migration.prepare_async_index(table_name, 'id')
end.not_to change { index_model.where(name: index_name).count }
end
end
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment