diff options
Diffstat (limited to 'qa/spec/support/formatters/test_stats_formatter_spec.rb')
-rw-r--r-- | qa/spec/support/formatters/test_stats_formatter_spec.rb | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/qa/spec/support/formatters/test_stats_formatter_spec.rb b/qa/spec/support/formatters/test_stats_formatter_spec.rb index 859d45a660b..f9baf9bd9d9 100644 --- a/qa/spec/support/formatters/test_stats_formatter_spec.rb +++ b/qa/spec/support/formatters/test_stats_formatter_spec.rb @@ -20,6 +20,8 @@ describe QA::Support::Formatters::TestStatsFormatter do let(:influx_write_api) { instance_double('InfluxDB2::WriteApi', write: nil) } let(:stage) { '1_manage' } let(:file_path) { "./qa/specs/features/#{stage}/subfolder/some_spec.rb" } + let(:ui_fabrication) { 0 } + let(:api_fabrication) { 0 } let(:influx_client_args) do { @@ -48,6 +50,9 @@ describe QA::Support::Formatters::TestStatsFormatter do fields: { id: './spec/support/formatters/test_stats_formatter_spec.rb[1:1]', run_time: 0, + api_fabrication: api_fabrication * 1000, + ui_fabrication: ui_fabrication * 1000, + total_fabrication: (api_fabrication + ui_fabrication) * 1000, retry_attempts: 0, job_url: ci_job_url, pipeline_url: ci_pipeline_url, @@ -69,6 +74,11 @@ describe QA::Support::Formatters::TestStatsFormatter do RSpec::Core::Sandbox.sandboxed do |config| config.formatter = QA::Support::Formatters::TestStatsFormatter + config.append_after do |example| + example.metadata[:api_fabrication] = Thread.current[:api_fabrication] + example.metadata[:browser_ui_fabrication] = Thread.current[:browser_ui_fabrication] + end + config.before(:context) { RSpec.current_example = nil } example.run @@ -171,5 +181,21 @@ describe QA::Support::Formatters::TestStatsFormatter do expect(influx_write_api).to have_received(:write).with(data: [data]) end end + + context 'with fabrication runtimes' do + let(:ui_fabrication) { 10 } + let(:api_fabrication) { 4 } + + before do + Thread.current[:api_fabrication] = api_fabrication + Thread.current[:browser_ui_fabrication] = ui_fabrication + end + + it 'exports data to influxdb with fabrication times' do + run_spec + + expect(influx_write_api).to have_received(:write).with(data: [data]) + end + end end end |