summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGrzegorz Bizon <grzesiek.bizon@gmail.com>2017-03-23 15:54:59 +0100
committerGrzegorz Bizon <grzesiek.bizon@gmail.com>2017-03-23 15:54:59 +0100
commitdcd2eeb1cfb633f4a28ddd9bc79deac0e3171d3f (patch)
treee0cc4860cdd544e666a12bd8b436419489c2d07a
parent3e01fed5cb36962065f5d19ab6a0cef1dfc14b48 (diff)
downloadgitlab-ce-dcd2eeb1cfb633f4a28ddd9bc79deac0e3171d3f.tar.gz
Rename container image to repository in specs
-rw-r--r--app/models/namespace.rb2
-rw-r--r--app/models/project.rb4
-rw-r--r--app/services/projects/transfer_service.rb2
-rw-r--r--spec/features/container_registry_spec.rb8
-rw-r--r--spec/features/security/project/internal_access_spec.rb4
-rw-r--r--spec/features/security/project/private_access_spec.rb4
-rw-r--r--spec/features/security/project/public_access_spec.rb4
-rw-r--r--spec/lib/container_registry/blob_spec.rb2
-rw-r--r--spec/lib/container_registry/tag_spec.rb2
-rw-r--r--spec/lib/gitlab/import_export/all_models.yml2
-rw-r--r--spec/models/namespace_spec.rb4
-rw-r--r--spec/models/project_spec.rb4
-rw-r--r--spec/services/container_images/destroy_service_spec.rb16
-rw-r--r--spec/services/projects/destroy_service_spec.rb4
-rw-r--r--spec/services/projects/transfer_service_spec.rb4
15 files changed, 33 insertions, 33 deletions
diff --git a/app/models/namespace.rb b/app/models/namespace.rb
index 4ae9d0122f2..ac03f098908 100644
--- a/app/models/namespace.rb
+++ b/app/models/namespace.rb
@@ -150,7 +150,7 @@ class Namespace < ActiveRecord::Base
end
def any_project_has_container_registry_images?
- projects.joins(:container_images).any?
+ projects.joins(:container_repositories).any?
end
def send_update_instructions
diff --git a/app/models/project.rb b/app/models/project.rb
index 4aa9c6bb2f2..5c6672c95b3 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -157,7 +157,7 @@ class Project < ActiveRecord::Base
has_one :import_data, dependent: :destroy, class_name: "ProjectImportData"
has_one :project_feature, dependent: :destroy
has_one :statistics, class_name: 'ProjectStatistics', dependent: :delete
- has_many :container_images, dependent: :destroy
+ has_many :container_repositories, dependent: :destroy
has_many :commit_statuses, dependent: :destroy
has_many :pipelines, dependent: :destroy, class_name: 'Ci::Pipeline'
@@ -908,7 +908,7 @@ class Project < ActiveRecord::Base
expire_caches_before_rename(old_path_with_namespace)
- if container_images.present?
+ if container_repositories.present?
Rails.logger.error "Project #{old_path_with_namespace} cannot be renamed because container registry images are present"
# we currently doesn't support renaming repository if it contains images in container registry
diff --git a/app/services/projects/transfer_service.rb b/app/services/projects/transfer_service.rb
index 6d9e7de4f24..f46bf884e37 100644
--- a/app/services/projects/transfer_service.rb
+++ b/app/services/projects/transfer_service.rb
@@ -36,7 +36,7 @@ module Projects
raise TransferError.new("Project with same path in target namespace already exists")
end
- unless project.container_images.empty?
+ unless project.container_repositories.empty?
# we currently doesn't support renaming repository if it contains images in container registry
raise TransferError.new('Project cannot be transferred, because images are present in its container registry')
end
diff --git a/spec/features/container_registry_spec.rb b/spec/features/container_registry_spec.rb
index 0199d08ab63..88642f72772 100644
--- a/spec/features/container_registry_spec.rb
+++ b/spec/features/container_registry_spec.rb
@@ -5,15 +5,15 @@ describe "Container Registry" do
let(:registry) { project.container_registry }
let(:tag_name) { 'latest' }
let(:tags) { [tag_name] }
- let(:container_image) { create(:container_image) }
- let(:image_name) { container_image.name }
+ let(:container_repository) { create(:container_repository) }
+ let(:image_name) { container_repository.name }
before do
login_as(:user)
project.team << [@user, :developer]
stub_container_registry_config(enabled: true)
stub_container_registry_tags(*tags)
- project.container_images << container_image unless container_image.nil?
+ project.container_repositories << container_repository unless container_repository.nil?
allow(Auth::ContainerRegistryAuthenticationService).to receive(:full_access_token).and_return('token')
end
@@ -23,7 +23,7 @@ describe "Container Registry" do
end
context 'when no images' do
- let(:container_image) { }
+ let(:container_repository) { }
it { expect(page).to have_content('No container images in Container Registry for this project') }
end
diff --git a/spec/features/security/project/internal_access_spec.rb b/spec/features/security/project/internal_access_spec.rb
index 350de2e5b6b..a961d8b4f69 100644
--- a/spec/features/security/project/internal_access_spec.rb
+++ b/spec/features/security/project/internal_access_spec.rb
@@ -443,12 +443,12 @@ describe "Internal Project Access", feature: true do
end
describe "GET /:project_path/container_registry" do
- let(:container_image) { create(:container_image) }
+ let(:container_repository) { create(:container_repository) }
before do
stub_container_registry_tags('latest')
stub_container_registry_config(enabled: true)
- project.container_images << container_image
+ project.container_repositories << container_repository
end
subject { namespace_project_container_registry_index_path(project.namespace, project) }
diff --git a/spec/features/security/project/private_access_spec.rb b/spec/features/security/project/private_access_spec.rb
index 62364206440..b7e42e67d82 100644
--- a/spec/features/security/project/private_access_spec.rb
+++ b/spec/features/security/project/private_access_spec.rb
@@ -432,12 +432,12 @@ describe "Private Project Access", feature: true do
end
describe "GET /:project_path/container_registry" do
- let(:container_image) { create(:container_image) }
+ let(:container_repository) { create(:container_repository) }
before do
stub_container_registry_tags('latest')
stub_container_registry_config(enabled: true)
- project.container_images << container_image
+ project.container_repositories << container_repository
end
subject { namespace_project_container_registry_index_path(project.namespace, project) }
diff --git a/spec/features/security/project/public_access_spec.rb b/spec/features/security/project/public_access_spec.rb
index 0e0c3140fd0..02660984b29 100644
--- a/spec/features/security/project/public_access_spec.rb
+++ b/spec/features/security/project/public_access_spec.rb
@@ -443,12 +443,12 @@ describe "Public Project Access", feature: true do
end
describe "GET /:project_path/container_registry" do
- let(:container_image) { create(:container_image) }
+ let(:container_repository) { create(:container_repository) }
before do
stub_container_registry_tags('latest')
stub_container_registry_config(enabled: true)
- project.container_images << container_image
+ project.container_repositories << container_repository
end
subject { namespace_project_container_registry_index_path(project.namespace, project) }
diff --git a/spec/lib/container_registry/blob_spec.rb b/spec/lib/container_registry/blob_spec.rb
index f092449c4bd..718a61ba291 100644
--- a/spec/lib/container_registry/blob_spec.rb
+++ b/spec/lib/container_registry/blob_spec.rb
@@ -15,7 +15,7 @@ describe ContainerRegistry::Blob do
let(:project) { create(:project, path: 'test', group: group) }
let(:example_host) { 'example.com' }
let(:registry_url) { 'http://' + example_host }
- let(:repository) { create(:container_image, name: '', project: project) }
+ let(:repository) { create(:container_repository, name: '', project: project) }
let(:blob) { repository.blob(config) }
before do
diff --git a/spec/lib/container_registry/tag_spec.rb b/spec/lib/container_registry/tag_spec.rb
index cdd0fe66bc3..01153a6eca9 100644
--- a/spec/lib/container_registry/tag_spec.rb
+++ b/spec/lib/container_registry/tag_spec.rb
@@ -5,7 +5,7 @@ describe ContainerRegistry::Tag do
let(:project) { create(:project, path: 'test', group: group) }
let(:example_host) { 'example.com' }
let(:registry_url) { 'http://' + example_host }
- let(:repository) { create(:container_image, name: '', project: project) }
+ let(:repository) { create(:container_repository, name: '', project: project) }
let(:tag) { repository.tag('tag') }
let(:headers) { { 'Accept' => 'application/vnd.docker.distribution.manifest.v2+json' } }
diff --git a/spec/lib/gitlab/import_export/all_models.yml b/spec/lib/gitlab/import_export/all_models.yml
index c3ee743035a..0429636486c 100644
--- a/spec/lib/gitlab/import_export/all_models.yml
+++ b/spec/lib/gitlab/import_export/all_models.yml
@@ -115,7 +115,7 @@ merge_access_levels:
- protected_branch
push_access_levels:
- protected_branch
-container_images:
+container_repositories:
- name
project:
- taggings
diff --git a/spec/models/namespace_spec.rb b/spec/models/namespace_spec.rb
index d22447c602f..bc70c6f4aa2 100644
--- a/spec/models/namespace_spec.rb
+++ b/spec/models/namespace_spec.rb
@@ -149,13 +149,13 @@ describe Namespace, models: true do
end
context "when any project has container images" do
- let(:container_image) { create(:container_image) }
+ let(:container_repository) { create(:container_repository) }
before do
stub_container_registry_config(enabled: true)
stub_container_registry_tags('tag')
- create(:empty_project, namespace: @namespace, container_images: [container_image])
+ create(:empty_project, namespace: @namespace, container_repositories: [container_repository])
allow(@namespace).to receive(:path_was).and_return(@namespace.path)
allow(@namespace).to receive(:path).and_return('new_path')
diff --git a/spec/models/project_spec.rb b/spec/models/project_spec.rb
index aefbedf0b93..69b7906bb4e 100644
--- a/spec/models/project_spec.rb
+++ b/spec/models/project_spec.rb
@@ -1186,12 +1186,12 @@ describe Project, models: true do
end
context 'container registry with images' do
- let(:container_image) { create(:container_image) }
+ let(:container_repository) { create(:container_repository) }
before do
stub_container_registry_config(enabled: true)
stub_container_registry_tags('tag')
- project.container_images << container_image
+ project.container_repositories << container_repository
end
subject { project.rename_repo }
diff --git a/spec/services/container_images/destroy_service_spec.rb b/spec/services/container_images/destroy_service_spec.rb
index 5b4dbaa7934..ebc15598cce 100644
--- a/spec/services/container_images/destroy_service_spec.rb
+++ b/spec/services/container_images/destroy_service_spec.rb
@@ -3,13 +3,13 @@ require 'spec_helper'
describe ContainerImages::DestroyService, services: true do
describe '#execute' do
let(:user) { create(:user) }
- let(:container_image) { create(:container_image, name: '') }
- let(:project) { create(:project, path: 'test', namespace: user.namespace, container_images: [container_image]) }
+ let(:container_repository) { create(:container_repository, name: '') }
+ let(:project) { create(:project, path: 'test', namespace: user.namespace, container_repositorys: [container_repository]) }
let(:example_host) { 'example.com' }
let(:registry_url) { 'http://' + example_host }
- it { expect(container_image).to be_valid }
- it { expect(project.container_images).not_to be_empty }
+ it { expect(container_repository).to be_valid }
+ it { expect(project.container_repositorys).not_to be_empty }
context 'when container image has tags' do
before do
@@ -19,15 +19,15 @@ describe ContainerImages::DestroyService, services: true do
it 'removes all tags before destroy' do
service = described_class.new(project, user)
- expect(container_image).to receive(:delete_tags).and_return(true)
- expect { service.execute(container_image) }.to change(project.container_images, :count).by(-1)
+ expect(container_repository).to receive(:delete_tags).and_return(true)
+ expect { service.execute(container_repository) }.to change(project.container_repositorys, :count).by(-1)
end
it 'fails when tags are not removed' do
service = described_class.new(project, user)
- expect(container_image).to receive(:delete_tags).and_return(false)
- expect { service.execute(container_image) }.to raise_error(ActiveRecord::RecordNotDestroyed)
+ expect(container_repository).to receive(:delete_tags).and_return(false)
+ expect { service.execute(container_repository) }.to raise_error(ActiveRecord::RecordNotDestroyed)
end
end
end
diff --git a/spec/services/projects/destroy_service_spec.rb b/spec/services/projects/destroy_service_spec.rb
index f91d62ebdaf..daad65d478a 100644
--- a/spec/services/projects/destroy_service_spec.rb
+++ b/spec/services/projects/destroy_service_spec.rb
@@ -90,12 +90,12 @@ describe Projects::DestroyService, services: true do
end
context 'container registry' do
- let(:container_image) { create(:container_image) }
+ let(:container_repository) { create(:container_repository) }
before do
stub_container_registry_config(enabled: true)
stub_container_registry_tags('tag')
- project.container_images << container_image
+ project.container_repositorys << container_repository
end
context 'images deletion succeeds' do
diff --git a/spec/services/projects/transfer_service_spec.rb b/spec/services/projects/transfer_service_spec.rb
index 5e56226ff91..adf8ede5086 100644
--- a/spec/services/projects/transfer_service_spec.rb
+++ b/spec/services/projects/transfer_service_spec.rb
@@ -29,12 +29,12 @@ describe Projects::TransferService, services: true do
end
context 'disallow transfering of project with tags' do
- let(:container_image) { create(:container_image) }
+ let(:container_repository) { create(:container_repository) }
before do
stub_container_registry_config(enabled: true)
stub_container_registry_tags('tag')
- project.container_images << container_image
+ project.container_repositorys << container_repository
end
subject { transfer_project(project, user, group) }