Class: Beaker::DSL::TestTagging::PlatformTagConfiner
- Inherits:
-
Object
- Object
- Beaker::DSL::TestTagging::PlatformTagConfiner
- Defined in:
- lib/beaker/dsl/test_tagging.rb
Instance Method Summary collapse
-
#confine_details(tags) ⇒ Array<Hash{Symbol=>Object}>
Gets the confine details needed for a set of tags.
-
#initialize(platform_tag_confines_array) ⇒ PlatformTagConfiner
constructor
Constructs the PlatformTagConfiner, transforming the user format into the internal structure for use by Beaker itself.
Constructor Details
#initialize(platform_tag_confines_array) ⇒ PlatformTagConfiner
Note:
PlatformTagConfines objects come in the form [
{
:platform => <platform-regex>,
:tag_reason_hash => {
<tag> => <reason to confine>,
<tag> => <reason to confine>,
...etc...
}
}
]
Constructs the PlatformTagConfiner, transforming the user format
into the internal structure for use by Beaker itself.
Internally, we want to turn tag matches into platform
confine statements. So a better internal structure would
be something of the form:
{
<tag> => [{
:platform => <platform-regex>,
:reason => <reason to confine>,
:type => :except,
}, ... ]
}
111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 |
# File 'lib/beaker/dsl/test_tagging.rb', line 111 def initialize(platform_tag_confines_array) platform_tag_confines_array ||= [] @tag_confine_details_hash = {} platform_tag_confines_array.each do |entry| entry[:tag_reason_hash].keys.each do |tag| @tag_confine_details_hash[tag] ||= [] log_msg = "Tag '#{tag}' found, confining: except platforms " log_msg << "matching regex '#{entry[:platform]}'. Reason: " log_msg << "'#{entry[:tag_reason_hash][tag]}'" @tag_confine_details_hash[tag] << { :platform_regex => entry[:platform], :log_message => log_msg, :type => :except, } end end end |
Instance Method Details
#confine_details(tags) ⇒ Array<Hash{Symbol=>Object}>
Gets the confine details needed for a set of tags
137 138 139 140 141 142 143 144 145 146 147 148 149 150 |
# File 'lib/beaker/dsl/test_tagging.rb', line 137 def confine_details() ||= [] details = [] .each do |tag| tag_confine_array = @tag_confine_details_hash[tag] next if tag_confine_array.nil? details.push(*tag_confine_array) # tag_confine_array.each do |confine_details| # details << confine_details # end end details end |