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/workers/gitlab/github_import/stage/finish_import_worker_spec.rb')
-rw-r--r--spec/workers/gitlab/github_import/stage/finish_import_worker_spec.rb44
1 files changed, 16 insertions, 28 deletions
diff --git a/spec/workers/gitlab/github_import/stage/finish_import_worker_spec.rb b/spec/workers/gitlab/github_import/stage/finish_import_worker_spec.rb
index 132fe1dc618..dd976eef28b 100644
--- a/spec/workers/gitlab/github_import/stage/finish_import_worker_spec.rb
+++ b/spec/workers/gitlab/github_import/stage/finish_import_worker_spec.rb
@@ -7,39 +7,27 @@ RSpec.describe Gitlab::GithubImport::Stage::FinishImportWorker do
let(:worker) { described_class.new }
describe '#perform' do
- it 'marks the import as finished' do
+ it 'marks the import as finished and reports import statistics' do
expect(project).to receive(:after_import)
- expect(worker).to receive(:report_import_time).with(project)
-
- worker.import(double(:client), project)
- end
- end
-
- describe '#report_import_time' do
- it 'reports the total import time' do
- expect(worker.histogram)
- .to receive(:observe)
- .with({ project: project.path_with_namespace }, a_kind_of(Numeric))
- .and_call_original
-
- expect(worker.counter)
- .to receive(:increment)
- .and_call_original
+ expect_next_instance_of(Gitlab::Import::Metrics) do |instance|
+ expect(instance).to receive(:track_finished_import)
+ expect(instance).to receive(:duration).and_return(3.005)
+ end
expect(Gitlab::GithubImport::Logger)
.to receive(:info)
- .with(
- message: 'GitHub project import finished',
- import_stage: 'Gitlab::GithubImport::Stage::FinishImportWorker',
- object_counts: {
- 'fetched' => {},
- 'imported' => {}
- },
- project_id: project.id,
- duration_s: a_kind_of(Numeric)
- )
+ .with(
+ message: 'GitHub project import finished',
+ import_stage: 'Gitlab::GithubImport::Stage::FinishImportWorker',
+ object_counts: {
+ 'fetched' => {},
+ 'imported' => {}
+ },
+ project_id: project.id,
+ duration_s: 3.01
+ )
- worker.report_import_time(project)
+ worker.import(double(:client), project)
end
end
end