diff options
author | Douwe Maan <douwe@gitlab.com> | 2017-05-02 22:32:34 +0000 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2017-05-02 22:32:34 +0000 |
commit | 185fd98fd4cb8f920558aea3795c4e1774cd39f5 (patch) | |
tree | 6112b4916600406d232845c39eeb24e73361d725 /spec/lib | |
parent | 2a73f0a638d4268dd367346dd602910f777742f4 (diff) | |
parent | 5e0e5801f1d113802f2bbbbfbaea5a53ddf1f957 (diff) | |
download | gitlab-ce-185fd98fd4cb8f920558aea3795c4e1774cd39f5.tar.gz |
Merge branch 'fix-gitaly-not-found' into 'master'
Re-enable ref operations with gitaly after not-found fix
See merge request !10773
Diffstat (limited to 'spec/lib')
-rw-r--r-- | spec/lib/gitlab/git/repository_spec.rb | 105 |
1 files changed, 60 insertions, 45 deletions
diff --git a/spec/lib/gitlab/git/repository_spec.rb b/spec/lib/gitlab/git/repository_spec.rb index 1b78910fa3c..ddedb7c3443 100644 --- a/spec/lib/gitlab/git/repository_spec.rb +++ b/spec/lib/gitlab/git/repository_spec.rb @@ -24,21 +24,26 @@ describe Gitlab::Git::Repository, seed_helper: true do end end - # TODO: Uncomment when feature is reenabled - # context 'with gitaly enabled' do - # before { stub_gitaly } - # - # it 'gets the branch name from GitalyClient' do - # expect_any_instance_of(Gitlab::GitalyClient::Ref).to receive(:default_branch_name) - # repository.root_ref - # end - # - # it 'wraps GRPC exceptions' do - # expect_any_instance_of(Gitlab::GitalyClient::Ref).to receive(:default_branch_name). - # and_raise(GRPC::Unknown) - # expect { repository.root_ref }.to raise_error(Gitlab::Git::CommandError) - # end - # end + context 'with gitaly enabled' do + before { stub_gitaly } + + it 'gets the branch name from GitalyClient' do + expect_any_instance_of(Gitlab::GitalyClient::Ref).to receive(:default_branch_name) + repository.root_ref + end + + it 'wraps GRPC not found' do + expect_any_instance_of(Gitlab::GitalyClient::Ref).to receive(:default_branch_name). + and_raise(GRPC::NotFound) + expect { repository.root_ref }.to raise_error(Gitlab::Git::Repository::NoRepository) + end + + it 'wraps GRPC exceptions' do + expect_any_instance_of(Gitlab::GitalyClient::Ref).to receive(:default_branch_name). + and_raise(GRPC::Unknown) + expect { repository.root_ref }.to raise_error(Gitlab::Git::CommandError) + end + end end describe "#rugged" do @@ -113,21 +118,26 @@ describe Gitlab::Git::Repository, seed_helper: true do it { is_expected.to include("master") } it { is_expected.not_to include("branch-from-space") } - # TODO: Uncomment when feature is reenabled - # context 'with gitaly enabled' do - # before { stub_gitaly } - # - # it 'gets the branch names from GitalyClient' do - # expect_any_instance_of(Gitlab::GitalyClient::Ref).to receive(:branch_names) - # subject - # end - # - # it 'wraps GRPC exceptions' do - # expect_any_instance_of(Gitlab::GitalyClient::Ref).to receive(:branch_names). - # and_raise(GRPC::Unknown) - # expect { subject }.to raise_error(Gitlab::Git::CommandError) - # end - # end + context 'with gitaly enabled' do + before { stub_gitaly } + + it 'gets the branch names from GitalyClient' do + expect_any_instance_of(Gitlab::GitalyClient::Ref).to receive(:branch_names) + subject + end + + it 'wraps GRPC not found' do + expect_any_instance_of(Gitlab::GitalyClient::Ref).to receive(:branch_names). + and_raise(GRPC::NotFound) + expect { subject }.to raise_error(Gitlab::Git::Repository::NoRepository) + end + + it 'wraps GRPC other exceptions' do + expect_any_instance_of(Gitlab::GitalyClient::Ref).to receive(:branch_names). + and_raise(GRPC::Unknown) + expect { subject }.to raise_error(Gitlab::Git::CommandError) + end + end end describe '#tag_names' do @@ -145,21 +155,26 @@ describe Gitlab::Git::Repository, seed_helper: true do it { is_expected.to include("v1.0.0") } it { is_expected.not_to include("v5.0.0") } - # TODO: Uncomment when feature is reenabled - # context 'with gitaly enabled' do - # before { stub_gitaly } - # - # it 'gets the tag names from GitalyClient' do - # expect_any_instance_of(Gitlab::GitalyClient::Ref).to receive(:tag_names) - # subject - # end - # - # it 'wraps GRPC exceptions' do - # expect_any_instance_of(Gitlab::GitalyClient::Ref).to receive(:tag_names). - # and_raise(GRPC::Unknown) - # expect { subject }.to raise_error(Gitlab::Git::CommandError) - # end - # end + context 'with gitaly enabled' do + before { stub_gitaly } + + it 'gets the tag names from GitalyClient' do + expect_any_instance_of(Gitlab::GitalyClient::Ref).to receive(:tag_names) + subject + end + + it 'wraps GRPC not found' do + expect_any_instance_of(Gitlab::GitalyClient::Ref).to receive(:tag_names). + and_raise(GRPC::NotFound) + expect { subject }.to raise_error(Gitlab::Git::Repository::NoRepository) + end + + it 'wraps GRPC exceptions' do + expect_any_instance_of(Gitlab::GitalyClient::Ref).to receive(:tag_names). + and_raise(GRPC::Unknown) + expect { subject }.to raise_error(Gitlab::Git::CommandError) + end + end end shared_examples 'archive check' do |extenstion| |