Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStan Hu <stanhu@gmail.com>2018-10-02 06:13:40 +0300
committerStan Hu <stanhu@gmail.com>2018-10-02 13:36:58 +0300
commitbba99da98cd0b3d8fbcee7b02fb3d0ad7d642a24 (patch)
treec74fb0ae9581228fb96892d363a7eb0413ceb55c /spec/models/namespace_spec.rb
parent2bb8c1caa583e1efbc207c4093ea2159bfcc1db1 (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.rb24
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