summaryrefslogtreecommitdiff
path: root/spec/models/project_spec.rb
diff options
context:
space:
mode:
authorDouglas Barbosa Alexandre <dbalexandre@gmail.com>2019-01-08 00:07:02 +0000
committerDouglas Barbosa Alexandre <dbalexandre@gmail.com>2019-01-08 00:07:02 +0000
commit31f2c7b00ee52516c288b1b2f7e2064897e36ad8 (patch)
tree4e40daa89f18eb34642d58855b9ed63df0c087e8 /spec/models/project_spec.rb
parent30572739b0664da481d4cded68c91c7d13246e93 (diff)
parentee4af0c64cdf00d2c34ce7feb773e057f9758cff (diff)
downloadgitlab-ce-31f2c7b00ee52516c288b1b2f7e2064897e36ad8.tar.gz
Merge branch '53966-hashed-storage-read-only' into 'master'
Hashed Storage: Only set as `read_only` when starting the per-project migration See merge request gitlab-org/gitlab-ce!24128
Diffstat (limited to 'spec/models/project_spec.rb')
-rw-r--r--spec/models/project_spec.rb45
1 files changed, 41 insertions, 4 deletions
diff --git a/spec/models/project_spec.rb b/spec/models/project_spec.rb
index 5e7345ca180..d1ab0bdba29 100644
--- a/spec/models/project_spec.rb
+++ b/spec/models/project_spec.rb
@@ -2411,6 +2411,20 @@ describe Project do
end
end
+ describe '#set_repository_read_only!' do
+ let(:project) { create(:project) }
+
+ it 'returns true when there is no existing git transfer in progress' do
+ expect(project.set_repository_read_only!).to be_truthy
+ end
+
+ it 'returns false when there is an existing git transfer in progress' do
+ allow(project).to receive(:git_transfer_in_progress?) { true }
+
+ expect(project.set_repository_read_only!).to be_falsey
+ end
+ end
+
describe '#pushes_since_gc' do
let(:project) { create(:project) }
@@ -3144,6 +3158,33 @@ describe Project do
end
end
+ describe '#git_transfer_in_progress?' do
+ let(:project) { build(:project) }
+
+ subject { project.git_transfer_in_progress? }
+
+ it 'returns false when repo_reference_count and wiki_reference_count are 0' do
+ allow(project).to receive(:repo_reference_count) { 0 }
+ allow(project).to receive(:wiki_reference_count) { 0 }
+
+ expect(subject).to be_falsey
+ end
+
+ it 'returns true when repo_reference_count is > 0' do
+ allow(project).to receive(:repo_reference_count) { 2 }
+ allow(project).to receive(:wiki_reference_count) { 0 }
+
+ expect(subject).to be_truthy
+ end
+
+ it 'returns true when wiki_reference_count is > 0' do
+ allow(project).to receive(:repo_reference_count) { 0 }
+ allow(project).to receive(:wiki_reference_count) { 2 }
+
+ expect(subject).to be_truthy
+ end
+ end
+
context 'legacy storage' do
let(:project) { create(:project, :repository, :legacy_storage) }
let(:gitlab_shell) { Gitlab::Shell.new }
@@ -3204,10 +3245,6 @@ describe Project do
expect(project.migrate_to_hashed_storage!).to be_truthy
end
- it 'flags as read-only' do
- expect { project.migrate_to_hashed_storage! }.to change { project.repository_read_only }.to(true)
- end
-
it 'does not validate project visibility' do
expect(project).not_to receive(:visibility_level_allowed_as_fork)
expect(project).not_to receive(:visibility_level_allowed_by_group)