Class: GitlabQuality::TestTooling::CodeCoverage::ClickHouse::CategoryOwnersTable

Inherits:
Table
  • Object
show all
Defined in:
lib/gitlab_quality/test_tooling/code_coverage/click_house/category_owners_table.rb

Constant Summary collapse

TABLE_NAME =
"category_owners"
MissingMappingError =
Class.new(StandardError)
KNOWN_UNOWNED =
%w[shared not_owned tooling].freeze

Constants inherited from Table

Table::LOG_PREFIX

Instance Method Summary collapse

Methods inherited from Table

#initialize, #push

Constructor Details

This class inherits a constructor from GitlabQuality::TestTooling::CodeCoverage::ClickHouse::Table

Instance Method Details

#owners(feature_category_name) ⇒ Hash

Owners of particular feature category as group, stage and section

Parameters:

  • feature_category_name (String)

    the feature_category name

Returns:

  • (Hash)


28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/gitlab_quality/test_tooling/code_coverage/click_house/category_owners_table.rb', line 28

def owners(feature_category_name)
  if KNOWN_UNOWNED.include?(feature_category_name)
    logger.info(
      "#{LOG_PREFIX} #{feature_category_name} is a known feature category without owner..."
    )
    return {}
  end

  records.fetch(feature_category_name)
rescue KeyError
  raise(MissingMappingError, "Feature category '#{feature_category_name}' not found in table '#{table_name}'")
end

#truncateObject



16
17
18
19
20
21
22
# File 'lib/gitlab_quality/test_tooling/code_coverage/click_house/category_owners_table.rb', line 16

def truncate
  logger.debug("#{LOG_PREFIX} Truncating table #{full_table_name} ...")

  client.query("TRUNCATE TABLE #{full_table_name}")

  logger.info("#{LOG_PREFIX} Successfully truncated table #{full_table_name}")
end