diff options
author | Stan Hu <stanhu@gmail.com> | 2018-10-02 06:13:40 +0300 |
---|---|---|
committer | Stan Hu <stanhu@gmail.com> | 2018-10-02 13:36:58 +0300 |
commit | bba99da98cd0b3d8fbcee7b02fb3d0ad7d642a24 (patch) | |
tree | c74fb0ae9581228fb96892d363a7eb0413ceb55c /spec/models/namespace_spec.rb | |
parent | 2bb8c1caa583e1efbc207c4093ea2159bfcc1db1 (diff) |
Improve logging when username update fails due to registry tags
When a user cannot be renamed due to existing container registry tags, log the
namespace and an example project that has tags.
Diffstat (limited to 'spec/models/namespace_spec.rb')
-rw-r--r-- | spec/models/namespace_spec.rb | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/spec/models/namespace_spec.rb b/spec/models/namespace_spec.rb index 3649990670b..22dc81acfda 100644 --- a/spec/models/namespace_spec.rb +++ b/spec/models/namespace_spec.rb @@ -82,6 +82,27 @@ describe Namespace do it { expect(namespace.human_name).to eq(namespace.owner_name) } end + describe '#first_project_with_container_registry_tags' do + let(:container_repository) { create(:container_repository) } + let!(:project) { create(:project, namespace: namespace, container_repositories: [container_repository]) } + + before do + stub_container_registry_config(enabled: true) + end + + it 'returns the project' do + stub_container_registry_tags(repository: :any, tags: ['tag']) + + expect(namespace.first_project_with_container_registry_tags).to eq(project) + end + + it 'returns no project' do + stub_container_registry_tags(repository: :any, tags: nil) + + expect(namespace.first_project_with_container_registry_tags).to be_nil + end + end + describe '.search' do let(:namespace) { create(:namespace) } @@ -184,7 +205,8 @@ describe Namespace do end it 'raises an error about not movable project' do - expect { namespace.move_dir }.to raise_error(/Namespace cannot be moved/) + expect { namespace.move_dir }.to raise_error(Gitlab::UpdatePathError, + /Namespace .* cannot be moved/) end end end |