Commit 7b1f1869 authored by Nikola Milojevic's avatar Nikola Milojevic Committed by nmilojevic1

Move measurement to shared examplesSquashed commits

[8c06de12f7a] Apply suggestion
[a2b2517464a] Apply suggestion to import_project.md
parent e0605905
......@@ -61,7 +61,7 @@ Parameters:
| `namespace_path` | string | yes | Namespace path |
| `project_path` | string | yes | Project name |
| `archive_path` | string | yes | Path to the exported project tarball you want to import |
| `measurement_enabled` | boolean | no | If enabled, it will measure execution time, number of sql calls and GC count. It's false by default |
| `measurement_enabled` | boolean | no | Measure execution time, number of SQL calls and GC count |
```shell
bundle exec rake "gitlab:import_export:import[root, root, testingprojectimport, /path/to/file.tar.gz, true]"
......
# frozen_string_literal: true
RSpec.shared_examples 'import measurement' do
context 'when measurement is enabled' do
let(:measurement_enabled) { true }
it 'prints measurement results' do
expect { subject }.to output(including('Measuring enabled...', 'Number of sql calls:', 'Total GC count:', 'Total GC count:')).to_stdout
end
end
context 'when measurement is not enabled' do
let(:measurement_enabled) { false }
it 'does not output measurement results' do
expect { subject }.not_to output(/Measuring enabled.../).to_stdout
end
end
context 'when measurement is not provided' do
let(:task_params) { [username, namespace_path, project_name, archive_path] }
it 'does not output measurement results' do
expect { subject }.not_to output(/Measuring enabled.../).to_stdout
end
it 'does not raise any exception' do
expect { subject }.not_to raise_error
end
end
end
......@@ -70,33 +70,7 @@ describe 'gitlab:import_export:import rake task' do
subject
end
context 'when measurement is enabled' do
let(:measurement_enabled) { true }
it 'prints measurement results' do
expect { subject }.to output(including('Measuring enabled...', 'Number of sql calls:', 'Total GC count:', 'Total GC count:')).to_stdout
end
end
context 'when measurement is not enabled' do
let(:measurement_enabled) { false }
it 'output measurement results' do
expect { subject }.not_to output(/Measuring enabled.../).to_stdout
end
end
context 'when measurement is not provided' do
let(:task_params) { [username, namespace_path, project_name, archive_path] }
it 'does not output measurement results' do
expect { subject }.not_to output(/Measuring enabled.../).to_stdout
end
it 'does not raise any exception' do
expect { subject }.not_to raise_error
end
end
it_behaves_like 'import measurement'
end
context 'when project import is invalid' do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment