Skip to content
代码片段 群组 项目
未验证 提交 6c1afc2e 编辑于 作者: Stan Hu's avatar Stan Hu
浏览文件

Exclude rspec-profiling CSV headers from PostgreSQL inserts

rspec-profiling recently added new columns to the CSV collector, but
the PSQL collector doesn't support this. We should exclude columns
until we actually want them.

* https://gitlab.com/gitlab-org/quality/engineering-productivity/master-broken-incidents/-/issues/5763
* https://gitlab.com/gitlab-org/quality/engineering-productivity/master-broken-incidents/-/issues/5898
上级 7e59e417
No related branches found
No related tags found
无相关合并请求
...@@ -9,7 +9,9 @@ module Collectors ...@@ -9,7 +9,9 @@ module Collectors
class CSVWithTimestamps < ::RspecProfiling::Collectors::CSV class CSVWithTimestamps < ::RspecProfiling::Collectors::CSV
TIMESTAMP_FIELDS = %w[created_at updated_at].freeze TIMESTAMP_FIELDS = %w[created_at updated_at].freeze
METADATA_FIELDS = %w[feature_category].freeze METADATA_FIELDS = %w[feature_category].freeze
HEADERS = (::RspecProfiling::Collectors::CSV::HEADERS + TIMESTAMP_FIELDS + METADATA_FIELDS).freeze EXCLUDED_FIELDS = %w[seed owner_tag start_memory end_memory].freeze
HEADERS = (::RspecProfiling::Collectors::CSV::HEADERS + TIMESTAMP_FIELDS + METADATA_FIELDS \
- EXCLUDED_FIELDS).freeze
def insert(attributes) def insert(attributes)
output << HEADERS.map do |field| output << HEADERS.map do |field|
......
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe 'rspec-profiling spec', feature_category: :tooling do
let(:expected_headers) do
# This should match https://github.com/procore-oss/rspec_profiling/blob/45df8d429643c4307fc62fa00d0a593932e6aff5/lib/rspec_profiling/collectors/psql.rb#L28-L40
%w[branch commit_hash date file line_number description time status
exception query_count query_time request_count request_time
created_at updated_at feature_category]
end
it 'includes only headers supported by the database' do
expect(RspecProfilingExt::Collectors::CSVWithTimestamps::HEADERS).to match_array(expected_headers)
end
end
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册