diff options
Diffstat (limited to 'spec/support/shared_examples/models/concerns/repository_storage_movable_shared_examples.rb')
-rw-r--r-- | spec/support/shared_examples/models/concerns/repository_storage_movable_shared_examples.rb | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/spec/support/shared_examples/models/concerns/repository_storage_movable_shared_examples.rb b/spec/support/shared_examples/models/concerns/repository_storage_movable_shared_examples.rb index 4c617f3ba46..819cf6018fe 100644 --- a/spec/support/shared_examples/models/concerns/repository_storage_movable_shared_examples.rb +++ b/spec/support/shared_examples/models/concerns/repository_storage_movable_shared_examples.rb @@ -33,7 +33,7 @@ RSpec.shared_examples 'handles repository moves' do subject { build(repository_storage_factory_key, container: container) } it "does not allow the container to be read-only on create" do - container.update!(repository_read_only: true) + container.set_repository_read_only! expect(subject).not_to be_valid expect(subject.errors[error_key].first).to match(/is read only/) @@ -45,8 +45,8 @@ RSpec.shared_examples 'handles repository moves' do context 'destination_storage_name' do subject { build(repository_storage_factory_key) } - it 'picks storage from ApplicationSetting' do - expect(Gitlab::CurrentSettings).to receive(:pick_repository_storage).and_return('picked').at_least(:once) + it 'can pick new storage' do + expect(Repository).to receive(:pick_storage_shard).and_return('picked').at_least(:once) expect(subject.destination_storage_name).to eq('picked') end @@ -99,6 +99,11 @@ RSpec.shared_examples 'handles repository moves' do expect(container).not_to be_repository_read_only end + + it 'updates the updated_at column of the container', :aggregate_failures do + expect { storage_move.finish_replication! }.to change { container.updated_at } + expect(storage_move.container.updated_at).to be >= storage_move.updated_at + end end context 'and transits to failed' do |