let(:index){double('index',name: index_name,schema: 'public',unique?: false,definition: 'CREATE INDEX _test_reindex_index ON public._test_reindex_table USING btree (_test_column)')}
@@ -17,29 +18,12 @@ RSpec.describe Gitlab::Database::ConcurrentReindex, '#perform' do
id serial NOT NULL PRIMARY KEY,
#{column_name} integer NOT NULL);
CREATE INDEX #{index_name} ON #{table_name} (#{column_name});
CREATE INDEX #{index.name} ON #{table_name} (#{column_name});
SQL
end
context'when the index does not exist'do
beforedo
connection.execute(<<~SQL)
DROP INDEX #{index_name}
SQL
end
it'raises an error'do
expect{subject.perform}.toraise_error(described_class::ReindexError,/does not exist/)
end
end
context'when the index is unique'do
beforedo
connection.execute(<<~SQL)
DROP INDEX #{index_name};
CREATE UNIQUE INDEX #{index_name} ON #{table_name} (#{column_name})
SQL
end
let(:index){double('index',name: index_name,unique?: true,definition: 'CREATE INDEX _test_reindex_index ON public._test_reindex_table USING btree (_test_column)')}
it'raises an error'do
expectdo
...
...
@@ -83,8 +67,8 @@ RSpec.describe Gitlab::Database::ConcurrentReindex, '#perform' do