Class: GitlabQuality::TestTooling::CodeCoverage::CategoryOwners
- Inherits:
-
Object
- Object
- GitlabQuality::TestTooling::CodeCoverage::CategoryOwners
- Includes:
- Utils
- Defined in:
- lib/gitlab_quality/test_tooling/code_coverage/category_owners.rb
Constant Summary collapse
- SOURCE_URL =
URI('https://gitlab.com/gitlab-com/www-gitlab-com/raw/master/data/stages.yml')
- BASE_DELAY =
seconds
1- MAX_RETRIES =
3
Instance Attribute Summary collapse
-
#hierarchy ⇒ Hash
readonly
Feature category ownership hierarchy, section -> stage -> group -> [feature_categories].
Instance Method Summary collapse
-
#as_db_table ⇒ Array<Hash>
Flattened feature category ownership.
-
#feature_categories_to_teams ⇒ Hash
Mapping of feature categories to teams (i.e., groups, stages, sections).
-
#initialize ⇒ CategoryOwners
constructor
A new instance of CategoryOwners.
Methods included from Utils
#exponential_delay_with_jitter
Constructor Details
#initialize ⇒ CategoryOwners
Returns a new instance of CategoryOwners.
37 38 39 40 41 42 43 44 |
# File 'lib/gitlab_quality/test_tooling/code_coverage/category_owners.rb', line 37 def initialize @feature_categories_map = {} @hierarchy = {} yaml_file = fetch_yaml_file yaml_content = YAML.load(yaml_file) populate_ownership_hierarchy(yaml_content) end |
Instance Attribute Details
#hierarchy ⇒ Hash (readonly)
Returns Feature category ownership hierarchy, section -> stage -> group -> [feature_categories].
35 36 37 |
# File 'lib/gitlab_quality/test_tooling/code_coverage/category_owners.rb', line 35 def hierarchy @hierarchy end |
Instance Method Details
#as_db_table ⇒ Array<Hash>
Returns Flattened feature category ownership.
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 |
# File 'lib/gitlab_quality/test_tooling/code_coverage/category_owners.rb', line 54 def as_db_table hierarchy.each_with_object([]) do |(section, stages), flattened_hierarchy| next unless stages stages.each do |stage, groups| next unless groups groups.each do |group, feature_categories| Array(feature_categories).each do |feature_category| flattened_hierarchy << { feature_category: feature_category, group: group, stage: stage, section: section } end end end end end |
#feature_categories_to_teams ⇒ Hash
Returns Mapping of feature categories to teams (i.e., groups, stages, sections).
83 84 85 86 |
# File 'lib/gitlab_quality/test_tooling/code_coverage/category_owners.rb', line 83 def feature_categories_to_teams populate_feature_categories_map(hierarchy) @feature_categories_map end |