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>2022-10-20 12:40:42 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2022-10-20 12:40:42 +0300
commitee664acb356f8123f4f6b00b73c1e1cf0866c7fb (patch)
treef8479f94a28f66654c6a4f6fb99bad6b4e86a40e /spec/support/shared_examples/bulk_imports
parent62f7d5c5b69180e82ae8196b7b429eeffc8e7b4f (diff)
Add latest changes from gitlab-org/gitlab@15-5-stable-eev15.5.0-rc42
Diffstat (limited to 'spec/support/shared_examples/bulk_imports')
-rw-r--r--spec/support/shared_examples/bulk_imports/common/pipelines/wiki_pipeline_examples.rb48
1 files changed, 48 insertions, 0 deletions
diff --git a/spec/support/shared_examples/bulk_imports/common/pipelines/wiki_pipeline_examples.rb b/spec/support/shared_examples/bulk_imports/common/pipelines/wiki_pipeline_examples.rb
index 7e7460cd602..cd4432af4ed 100644
--- a/spec/support/shared_examples/bulk_imports/common/pipelines/wiki_pipeline_examples.rb
+++ b/spec/support/shared_examples/bulk_imports/common/pipelines/wiki_pipeline_examples.rb
@@ -57,5 +57,53 @@ RSpec.shared_examples 'wiki pipeline imports a wiki for an entity' do
expect(tracker.entity.failures.first.exception_message).to eq('Only allowed schemes are http, https')
end
end
+
+ context 'when wiki is disabled' do
+ before do
+ allow_next_instance_of(BulkImports::Clients::HTTP) do |client|
+ allow(client)
+ .to receive(:get)
+ .and_raise(
+ BulkImports::NetworkError.new(
+ 'Unsuccessful response 403 from ...',
+ response: response_double
+ )
+ )
+ end
+ end
+
+ describe 'unsuccessful response' do
+ shared_examples 'does not raise an error' do
+ it 'does not raise an error' do
+ expect(parent.wiki).not_to receive(:ensure_repository)
+ expect(parent.wiki.repository).not_to receive(:ensure_repository)
+
+ expect { subject.run }.not_to raise_error
+ end
+ end
+
+ context 'when response is forbidden' do
+ let(:response_double) { instance_double(HTTParty::Response, forbidden?: true, code: 403) }
+
+ include_examples 'does not raise an error'
+ end
+
+ context 'when response is not found' do
+ let(:response_double) { instance_double(HTTParty::Response, forbidden?: false, not_found?: true) }
+
+ include_examples 'does not raise an error'
+ end
+
+ context 'when response is not 403' do
+ let(:response_double) { instance_double(HTTParty::Response, forbidden?: false, not_found?: false, code: 301) }
+
+ it 'marks tracker as failed' do
+ subject.run
+
+ expect(tracker.failed?).to eq(true)
+ end
+ end
+ end
+ end
end
end