Skip to content
Snippets Groups Projects
Commit cb0cbb6a authored by Stan Hu's avatar Stan Hu
Browse files

Merge branch '359127-migration-status' into 'master'

Take migration status into account for size

See merge request !90776
parents ea75b538 52025d43
No related branches found
No related tags found
1 merge request!90776Take migration status into account for size
Pipeline #572650426 passed
......@@ -468,7 +468,7 @@ def start_expiration_policy!
def size
strong_memoize(:size) do
next unless Gitlab.com?
next if self.created_at.before?(MIGRATION_PHASE_1_STARTED_AT)
next if self.created_at.before?(MIGRATION_PHASE_1_STARTED_AT) && self.migration_state != 'import_done'
next unless gitlab_api_client.supports_gitlab_api?
gitlab_api_client.repository_details(self.path, sizing: :self)['size_bytes']
......
......@@ -689,10 +689,29 @@
it { is_expected.to eq(nil) }
end
context 'with an old repository' do
context 'supports gitlab api on .com with an old repository' do
let(:on_com) { true }
let(:created_at) { described_class::MIGRATION_PHASE_1_STARTED_AT - 3.months }
it { is_expected.to eq(nil) }
before do
allow(repository.gitlab_api_client).to receive(:supports_gitlab_api?).and_return(true)
allow(repository.gitlab_api_client).to receive(:repository_details).with(repository.path, sizing: :self).and_return(response)
expect(repository).to receive(:migration_state).and_return(migration_state)
end
context 'with migration_state import_done' do
let(:response) { { 'size_bytes' => 12345 } }
let(:migration_state) { 'import_done' }
it { is_expected.to eq(12345) }
end
context 'with migration_state not import_done' do
let(:response) { { 'size_bytes' => 12345 } }
let(:migration_state) { 'default' }
it { is_expected.to eq(nil) }
end
end
end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment