Commit 2ebe9a0d authored by Anastasia McDonald's avatar Anastasia McDonald

Merge branch 'acunskis-quarantine-context' into 'master'

E2E: Correctly export quarantine status for exported metrics

See merge request gitlab-org/gitlab!81095
parents 9852b836 536b5dfc
...@@ -65,7 +65,7 @@ module QA ...@@ -65,7 +65,7 @@ module QA
file_path: file_path, file_path: file_path,
status: example.execution_result.status, status: example.execution_result.status,
reliable: example.metadata.key?(:reliable).to_s, reliable: example.metadata.key?(:reliable).to_s,
quarantined: example.metadata.key?(:quarantine).to_s, quarantined: quarantined(example.metadata),
retried: ((example.metadata[:retry_attempts] || 0) > 0).to_s, retried: ((example.metadata[:retry_attempts] || 0) > 0).to_s,
job_name: job_name, job_name: job_name,
merge_request: merge_request, merge_request: merge_request,
...@@ -144,6 +144,17 @@ module QA ...@@ -144,6 +144,17 @@ module QA
(!!merge_request_iid).to_s (!!merge_request_iid).to_s
end end
# Is spec quarantined
#
# @param [Hash] metadata
# @return [String]
def quarantined(metadata)
return "false" unless metadata.key?(:quarantine)
return "true" unless metadata[:quarantine].is_a?(Hash)
(!Specs::Helpers::Quarantine.quarantined_different_context?(metadata[:quarantine])).to_s
end
# Print log message # Print log message
# #
# @param [Symbol] level # @param [Symbol] level
......
...@@ -158,6 +158,23 @@ describe QA::Support::Formatters::TestStatsFormatter do ...@@ -158,6 +158,23 @@ describe QA::Support::Formatters::TestStatsFormatter do
end end
end end
context 'with context quarantined spec' do
let(:quarantined) { 'false' }
it 'exports data to influxdb with correct qurantine tag' do
run_spec do
it(
'spec',
quarantine: { only: { job: 'praefect' } },
testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/1234'
) {}
end
expect(influx_write_api).to have_received(:write).once
expect(influx_write_api).to have_received(:write).with(data: [data])
end
end
context 'with staging full run' do context 'with staging full run' do
let(:run_type) { 'staging-full' } let(:run_type) { 'staging-full' }
......
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