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:
Diffstat (limited to 'spec/lib/bulk_imports/projects/pipelines/snippets_repository_pipeline_spec.rb')
-rw-r--r--spec/lib/bulk_imports/projects/pipelines/snippets_repository_pipeline_spec.rb17
1 files changed, 14 insertions, 3 deletions
diff --git a/spec/lib/bulk_imports/projects/pipelines/snippets_repository_pipeline_spec.rb b/spec/lib/bulk_imports/projects/pipelines/snippets_repository_pipeline_spec.rb
index 56c0f8c8807..85946c5e0f9 100644
--- a/spec/lib/bulk_imports/projects/pipelines/snippets_repository_pipeline_spec.rb
+++ b/spec/lib/bulk_imports/projects/pipelines/snippets_repository_pipeline_spec.rb
@@ -2,7 +2,7 @@
require 'spec_helper'
-RSpec.describe BulkImports::Projects::Pipelines::SnippetsRepositoryPipeline do
+RSpec.describe BulkImports::Projects::Pipelines::SnippetsRepositoryPipeline, feature_category: :importers do
let(:user) { create(:user) }
let(:project) { create(:project) }
let(:bulk_import) { create(:bulk_import, user: user) }
@@ -55,7 +55,7 @@ RSpec.describe BulkImports::Projects::Pipelines::SnippetsRepositoryPipeline do
end
end
- describe '#run' do
+ describe '#run', :clean_gitlab_redis_cache do
let(:validation_response) { double(Hash, 'error?': false) }
before do
@@ -110,6 +110,18 @@ RSpec.describe BulkImports::Projects::Pipelines::SnippetsRepositoryPipeline do
.to change { Gitlab::GlRepository::SNIPPET.repository_for(matched_snippet).exists? }.to true
end
+ it 'skips already cached snippets' do
+ pipeline.run
+
+ data.first.tap { |d| d['createdAt'] = matched_snippet.created_at.to_s } # Reset data to original state
+
+ expect(pipeline).not_to receive(:load)
+
+ pipeline.run
+
+ expect(Gitlab::GlRepository::SNIPPET.repository_for(matched_snippet).exists?).to be true
+ end
+
it 'updates snippets statistics' do
allow_next_instance_of(Repository) do |repository|
allow(repository).to receive(:fetch_as_mirror)
@@ -149,7 +161,6 @@ RSpec.describe BulkImports::Projects::Pipelines::SnippetsRepositoryPipeline do
it 'logs the failure' do
pipeline.run
- expect(tracker.failed?).to eq(true)
expect(tracker.entity.failures.first).to be_present
expect(tracker.entity.failures.first.exception_message).to eq('Only allowed schemes are http, https')
end