Commit 536b5dfc authored by Andrejs Cunskis's avatar Andrejs Cunskis

Correctly export quarantine status for exported metrics

parent b627a22a
......@@ -66,7 +66,7 @@ module QA
file_path: file_path,
status: example.execution_result.status,
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,
job_name: job_name,
merge_request: merge_request,
......@@ -170,6 +170,17 @@ module QA
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
#
# @param [Symbol] level
......
......@@ -157,6 +157,23 @@ describe QA::Support::Formatters::TestStatsFormatter do
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
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