Commit 1e0efc7e authored by Georges Racinet's avatar Georges Racinet 🦑
Browse files

RSpec tests for hg_access: using an empty repo for main tests

Thanks to this, the running time goes down from about 3mn to
1mn and 50s on my system.

The LFS tests are probably irrelevant: the day we activate Mercurial's
version of LFS, we will certainly have to perform other types of checks.
But then, they will perhaps serve as reminders that there is
something to adapt.

--HG--
branch : heptapod-stable
parent 84b0544435e7
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
let(:user) { create(:user) } let(:user) { create(:user) }
let(:actor) { user } let(:actor) { user }
let(:project) { create(:hg_git_project, :hg_repository) } let(:project) { create(:hg_git_project, :empty_repo) }
let(:project_path) { project&.path } let(:project_path) { project&.path }
let(:namespace_path) { project&.namespace&.path } let(:namespace_path) { project&.namespace&.path }
let(:protocol) { 'ssh' } let(:protocol) { 'ssh' }
...@@ -637,6 +637,10 @@ def disable_protocol(protocol) ...@@ -637,6 +637,10 @@ def disable_protocol(protocol)
context 'when LFS is not enabled' do context 'when LFS is not enabled' do
it 'does not run LFSIntegrity check' do it 'does not run LFSIntegrity check' do
# that the general branch push check would refuse for lack of a
# default branch is not what is tested here.
allow_any_instance_of(Gitlab::Checks::BranchCheck)
.to receive(:protected_branch_push_checks).and_return(nil)
expect(Gitlab::Checks::LfsIntegrity).not_to receive(:new) expect(Gitlab::Checks::LfsIntegrity).not_to receive(:new)
push_access_check push_access_check
...@@ -645,6 +649,9 @@ def disable_protocol(protocol) ...@@ -645,6 +649,9 @@ def disable_protocol(protocol)
context 'when LFS is enabled' do context 'when LFS is enabled' do
it 'checks LFS integrity only for first change' do it 'checks LFS integrity only for first change' do
# see comment for when LFS is not enabled
allow_any_instance_of(Gitlab::Checks::BranchCheck)
.to receive(:protected_branch_push_checks).and_return(nil)
allow(project).to receive(:lfs_enabled?).and_return(true) allow(project).to receive(:lfs_enabled?).and_return(true)
expect_next_instance_of(Gitlab::Checks::LfsIntegrity) do |instance| expect_next_instance_of(Gitlab::Checks::LfsIntegrity) do |instance|
......
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