Commit 85e42353 authored by Andrejs Cunskis's avatar Andrejs Cunskis

E2E: Add testcase link to exported test metrics

parent dffaa093
...@@ -84,7 +84,8 @@ module QA ...@@ -84,7 +84,8 @@ module QA
retry_attempts: example.metadata[:retry_attempts] || 0, retry_attempts: example.metadata[:retry_attempts] || 0,
job_url: QA::Runtime::Env.ci_job_url, job_url: QA::Runtime::Env.ci_job_url,
pipeline_url: env('CI_PIPELINE_URL'), pipeline_url: env('CI_PIPELINE_URL'),
pipeline_id: env('CI_PIPELINE_ID') pipeline_id: env('CI_PIPELINE_ID'),
testcase: example.metadata[:testcase]
} }
} }
rescue StandardError => e rescue StandardError => e
......
...@@ -56,13 +56,14 @@ describe QA::Support::Formatters::TestStatsFormatter do ...@@ -56,13 +56,14 @@ describe QA::Support::Formatters::TestStatsFormatter do
retry_attempts: 0, retry_attempts: 0,
job_url: ci_job_url, job_url: ci_job_url,
pipeline_url: ci_pipeline_url, pipeline_url: ci_pipeline_url,
pipeline_id: ci_pipeline_id pipeline_id: ci_pipeline_id,
testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/1234'
} }
} }
end end
def run_spec(&spec) def run_spec(&spec)
spec ||= -> { it('spec') {} } spec ||= -> { it('spec', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/1234') {} }
describe_successfully('stats export', &spec).tap do |example_group| describe_successfully('stats export', &spec).tap do |example_group|
example_group.examples.each { |ex| ex.metadata[:file_path] = file_path } example_group.examples.each { |ex| ex.metadata[:file_path] = file_path }
...@@ -131,7 +132,7 @@ describe QA::Support::Formatters::TestStatsFormatter do ...@@ -131,7 +132,7 @@ describe QA::Support::Formatters::TestStatsFormatter do
it 'exports data to influxdb with correct reliable tag' do it 'exports data to influxdb with correct reliable tag' do
run_spec do run_spec do
it('spec', :reliable) {} it('spec', :reliable, testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/1234') {}
end end
expect(influx_write_api).to have_received(:write).with(data: [data]) expect(influx_write_api).to have_received(:write).with(data: [data])
...@@ -143,7 +144,7 @@ describe QA::Support::Formatters::TestStatsFormatter do ...@@ -143,7 +144,7 @@ describe QA::Support::Formatters::TestStatsFormatter do
it 'exports data to influxdb with correct quarantine tag' do it 'exports data to influxdb with correct quarantine tag' do
run_spec do run_spec do
it('spec', :quarantine) {} it('spec', :quarantine, testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/1234') {}
end end
expect(influx_write_api).to have_received(:write).with(data: [data]) expect(influx_write_api).to have_received(:write).with(data: [data])
......
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