Commit 57fe5a06 authored by Andrejs Cunskis's avatar Andrejs Cunskis

Ignore smoke tests in reliable test report

Consistent quotes

Fix spec name

Quotes v2
parent 2d446d4d
...@@ -64,6 +64,7 @@ module QA ...@@ -64,6 +64,7 @@ module QA
name: example.full_description, name: example.full_description,
file_path: file_path, file_path: file_path,
status: example.execution_result.status, status: example.execution_result.status,
smoke: example.metadata.key?(:smoke).to_s,
reliable: example.metadata.key?(:reliable).to_s, reliable: example.metadata.key?(:reliable).to_s,
quarantined: quarantined(example.metadata), quarantined: quarantined(example.metadata),
retried: ((example.metadata[:retry_attempts] || 0) > 0).to_s, retried: ((example.metadata[:retry_attempts] || 0) > 0).to_s,
......
...@@ -316,6 +316,7 @@ module QA ...@@ -316,6 +316,7 @@ module QA
|> filter(fn: (r) => r.status != "pending" and |> filter(fn: (r) => r.status != "pending" and
r.merge_request == "false" and r.merge_request == "false" and
r.quarantined == "false" and r.quarantined == "false" and
r.smoke == "false" and
r.reliable == "#{reliable}" and r.reliable == "#{reliable}" and
r._field == "id" r._field == "id"
) )
......
...@@ -8,14 +8,15 @@ describe QA::Support::Formatters::TestStatsFormatter do ...@@ -8,14 +8,15 @@ describe QA::Support::Formatters::TestStatsFormatter do
include QA::Specs::Helpers::RSpec include QA::Specs::Helpers::RSpec
include ActiveSupport::Testing::TimeHelpers include ActiveSupport::Testing::TimeHelpers
let(:url) { "http://influxdb.net" } let(:url) { 'http://influxdb.net' }
let(:token) { "token" } let(:token) { 'token' }
let(:ci_timestamp) { "2021-02-23T20:58:41Z" } let(:ci_timestamp) { '2021-02-23T20:58:41Z' }
let(:ci_job_name) { "test-job 1/5" } let(:ci_job_name) { 'test-job 1/5' }
let(:ci_job_url) { "url" } let(:ci_job_url) { 'url' }
let(:ci_pipeline_url) { "url" } let(:ci_pipeline_url) { 'url' }
let(:ci_pipeline_id) { "123" } let(:ci_pipeline_id) { '123' }
let(:run_type) { 'staging-full' } let(:run_type) { 'staging-full' }
let(:smoke) { 'false' }
let(:reliable) { 'false' } let(:reliable) { 'false' }
let(:quarantined) { 'false' } let(:quarantined) { 'false' }
let(:influx_client) { instance_double('InfluxDB2::Client', create_write_api: influx_write_api) } let(:influx_client) { instance_double('InfluxDB2::Client', create_write_api: influx_write_api) }
...@@ -42,11 +43,12 @@ describe QA::Support::Formatters::TestStatsFormatter do ...@@ -42,11 +43,12 @@ describe QA::Support::Formatters::TestStatsFormatter do
name: 'stats export spec', name: 'stats export spec',
file_path: file_path.gsub('./qa/specs/features', ''), file_path: file_path.gsub('./qa/specs/features', ''),
status: :passed, status: :passed,
smoke: smoke,
reliable: reliable, reliable: reliable,
quarantined: quarantined, quarantined: quarantined,
retried: "false", retried: 'false',
job_name: "test-job", job_name: 'test-job',
merge_request: "false", merge_request: 'false',
run_type: run_type, run_type: run_type,
stage: stage.match(%r{\d{1,2}_(\w+)}).captures.first, stage: stage.match(%r{\d{1,2}_(\w+)}).captures.first,
testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/1234' testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/1234'
...@@ -96,8 +98,8 @@ describe QA::Support::Formatters::TestStatsFormatter do ...@@ -96,8 +98,8 @@ describe QA::Support::Formatters::TestStatsFormatter do
allow_any_instance_of(RSpec::Core::Example::ExecutionResult).to receive(:run_time).and_return(0) # rubocop:disable RSpec/AnyInstanceOf allow_any_instance_of(RSpec::Core::Example::ExecutionResult).to receive(:run_time).and_return(0) # rubocop:disable RSpec/AnyInstanceOf
end end
context "without influxdb variables configured" do context 'without influxdb variables configured' do
it "skips export without influxdb url" do it 'skips export without influxdb url' do
stub_env('QA_INFLUXDB_URL', nil) stub_env('QA_INFLUXDB_URL', nil)
stub_env('QA_INFLUXDB_TOKEN', nil) stub_env('QA_INFLUXDB_TOKEN', nil)
...@@ -106,7 +108,7 @@ describe QA::Support::Formatters::TestStatsFormatter do ...@@ -106,7 +108,7 @@ describe QA::Support::Formatters::TestStatsFormatter do
expect(influx_client).not_to have_received(:create_write_api) expect(influx_client).not_to have_received(:create_write_api)
end end
it "skips export without influxdb token" do it 'skips export without influxdb token' do
stub_env('QA_INFLUXDB_URL', url) stub_env('QA_INFLUXDB_URL', url)
stub_env('QA_INFLUXDB_TOKEN', nil) stub_env('QA_INFLUXDB_TOKEN', nil)
...@@ -146,6 +148,19 @@ describe QA::Support::Formatters::TestStatsFormatter do ...@@ -146,6 +148,19 @@ describe QA::Support::Formatters::TestStatsFormatter do
end end
end end
context 'with smoke spec' do
let(:smoke) { 'true' }
it 'exports data to influxdb with correct smoke tag' do
run_spec do
it('spec', :smoke, 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 quarantined spec' do context 'with quarantined spec' do
let(:quarantined) { 'true' } let(:quarantined) { 'true' }
......
...@@ -71,6 +71,7 @@ describe QA::Tools::ReliableReport do ...@@ -71,6 +71,7 @@ describe QA::Tools::ReliableReport do
|> filter(fn: (r) => r.status != "pending" and |> filter(fn: (r) => r.status != "pending" and
r.merge_request == "false" and r.merge_request == "false" and
r.quarantined == "false" and r.quarantined == "false" and
r.smoke == "false" and
r.reliable == "#{reliable}" and r.reliable == "#{reliable}" and
r._field == "id" r._field == "id"
) )
......
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