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:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-02-09 06:09:18 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2021-02-09 06:09:18 +0300
commit9c8d620e48c59fe3d10f9c4b50f91124d7c09182 (patch)
treec629ebcedd29c2ca756af2367218f6723ac3d58d /spec/services/packages
parent1c0289261b8d67e983b5d3ed1ef23fd800deab98 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/services/packages')
-rw-r--r--spec/services/packages/debian/create_distribution_service_spec.rb4
-rw-r--r--spec/services/packages/debian/destroy_distribution_service_spec.rb7
-rw-r--r--spec/services/packages/debian/update_distribution_service_spec.rb29
3 files changed, 33 insertions, 7 deletions
diff --git a/spec/services/packages/debian/create_distribution_service_spec.rb b/spec/services/packages/debian/create_distribution_service_spec.rb
index df23cafa784..87cf1070075 100644
--- a/spec/services/packages/debian/create_distribution_service_spec.rb
+++ b/spec/services/packages/debian/create_distribution_service_spec.rb
@@ -15,6 +15,8 @@ RSpec.describe Packages::Debian::CreateDistributionService do
.from(nil).to(expected_components.count)
.and change { container.debian_distributions.first&.architectures&.count }
.from(nil).to(expected_architectures.count)
+ .and not_change { Packages::Debian::ProjectComponentFile.count }
+ .and not_change { Packages::Debian::GroupComponentFile.count }
else
expect { response }
.to not_change { container.debian_distributions.klass.all.count }
@@ -23,6 +25,8 @@ RSpec.describe Packages::Debian::CreateDistributionService do
.and not_change { Packages::Debian::GroupComponent.count }
.and not_change { Packages::Debian::ProjectArchitecture.count }
.and not_change { Packages::Debian::GroupArchitecture.count }
+ .and not_change { Packages::Debian::ProjectComponentFile.count }
+ .and not_change { Packages::Debian::GroupComponentFile.count }
end
expect(response).to be_a(ServiceResponse)
diff --git a/spec/services/packages/debian/destroy_distribution_service_spec.rb b/spec/services/packages/debian/destroy_distribution_service_spec.rb
index cbb112af86f..e4c43884bb4 100644
--- a/spec/services/packages/debian/destroy_distribution_service_spec.rb
+++ b/spec/services/packages/debian/destroy_distribution_service_spec.rb
@@ -15,12 +15,15 @@ RSpec.describe Packages::Debian::DestroyDistributionService do
.from(2).to(0)
.and change { architecture1.class.all.count }
.from(3).to(0)
+ .and change { component_file1.class.all.count }
+ .from(4).to(0)
else
expect { response }
.to not_change { container.debian_distributions.klass.all.count }
.and not_change { container.debian_distributions.count }
.and not_change { component1.class.all.count }
.and not_change { architecture1.class.all.count }
+ .and not_change { component_file1.class.all.count }
end
expect(response).to be_a(ServiceResponse)
@@ -45,6 +48,10 @@ RSpec.describe Packages::Debian::DestroyDistributionService do
let_it_be(:architecture0, freeze: true) { create("debian_#{container_type}_architecture", distribution: distribution, name: 'all') }
let_it_be(:architecture1, freeze: can_freeze) { create("debian_#{container_type}_architecture", distribution: distribution, name: 'architecture1') }
let_it_be(:architecture2, freeze: can_freeze) { create("debian_#{container_type}_architecture", distribution: distribution, name: 'architecture2') }
+ let_it_be(:component_file1, freeze: can_freeze) { create("debian_#{container_type}_component_file", :source, component: component1) }
+ let_it_be(:component_file2, freeze: can_freeze) { create("debian_#{container_type}_component_file", component: component1, architecture: architecture1) }
+ let_it_be(:component_file3, freeze: can_freeze) { create("debian_#{container_type}_component_file", :source, component: component2) }
+ let_it_be(:component_file4, freeze: can_freeze) { create("debian_#{container_type}_component_file", component: component2, architecture: architecture2) }
subject { described_class.new(distribution) }
diff --git a/spec/services/packages/debian/update_distribution_service_spec.rb b/spec/services/packages/debian/update_distribution_service_spec.rb
index c60e8e3f735..852fc713e34 100644
--- a/spec/services/packages/debian/update_distribution_service_spec.rb
+++ b/spec/services/packages/debian/update_distribution_service_spec.rb
@@ -3,15 +3,26 @@
require 'spec_helper'
RSpec.describe Packages::Debian::UpdateDistributionService do
- RSpec.shared_examples 'Update Debian Distribution' do |expected_message, expected_components, expected_architectures|
+ RSpec.shared_examples 'Update Debian Distribution' do |expected_message, expected_components, expected_architectures, component_file_delta = 0|
it 'returns ServiceResponse', :aggregate_failures do
expect(distribution).to receive(:update).with(simple_params).and_call_original if expected_message.nil?
- expect { response }
- .to not_change { container.debian_distributions.klass.all.count }
- .and not_change { container.debian_distributions.count }
- .and not_change { component1.class.all.count }
- .and not_change { architecture1.class.all.count }
+ if component_file_delta.zero?
+ expect { response }
+ .to not_change { container.debian_distributions.klass.all.count }
+ .and not_change { container.debian_distributions.count }
+ .and not_change { component1.class.all.count }
+ .and not_change { architecture1.class.all.count }
+ .and not_change { component_file1.class.all.count }
+ else
+ expect { response }
+ .to not_change { container.debian_distributions.klass.all.count }
+ .and not_change { container.debian_distributions.count }
+ .and not_change { component1.class.all.count }
+ .and not_change { architecture1.class.all.count }
+ .and change { component_file1.class.all.count }
+ .from(4).to(4 + component_file_delta)
+ end
expect(response).to be_a(ServiceResponse)
expect(response.success?).to eq(expected_message.nil?)
@@ -48,6 +59,10 @@ RSpec.describe Packages::Debian::UpdateDistributionService do
let_it_be(:architecture0) { create("debian_#{container_type}_architecture", distribution: distribution, name: 'all') }
let_it_be(:architecture1) { create("debian_#{container_type}_architecture", distribution: distribution, name: 'architecture1') }
let_it_be(:architecture2) { create("debian_#{container_type}_architecture", distribution: distribution, name: 'architecture2') }
+ let_it_be(:component_file1) { create("debian_#{container_type}_component_file", :source, component: component1) }
+ let_it_be(:component_file2) { create("debian_#{container_type}_component_file", component: component1, architecture: architecture1) }
+ let_it_be(:component_file3) { create("debian_#{container_type}_component_file", :source, component: component2) }
+ let_it_be(:component_file4) { create("debian_#{container_type}_component_file", component: component2, architecture: architecture2) }
let(:original_params) do
{
@@ -110,7 +125,7 @@ RSpec.describe Packages::Debian::UpdateDistributionService do
}
end
- it_behaves_like 'Update Debian Distribution', nil, %w[component2 component3], %w[all architecture2 architecture3]
+ it_behaves_like 'Update Debian Distribution', nil, %w[component2 component3], %w[all architecture2 architecture3], -2
end
context 'with invalid components' do