Module: Beaker::DSL::Roles
- Included in:
- Beaker::DSL
- Defined in:
- lib/beaker/dsl/roles.rb
Overview
Identifying hosts.
This aids in reaching common subsets of hosts in a testing matrix.
It requires the class it is mixed into to provide the attribute ‘hosts` which contain the hosts to search, these should implement Host’s interface. They, at least, must have #[] and #to_s available and provide an array when #[](‘roles’) is called.
Also the constant Outcomes::FailTest needs to be defined it will be raised in error conditions
Instance Method Summary collapse
-
#agents ⇒ Array<Host>
The hosts for which [‘roles’] include ‘agent’.
-
#dashboard ⇒ Array<Host>
The host for which [‘roles’] include ‘dashboard’.
-
#database ⇒ Array<Host>
The host for which [‘roles’] include ‘database’.
-
#find_only_one(role) ⇒ Host
Returns the host, if one and only one is found.
-
#hosts_as(desired_role = nil) ⇒ Array<Host>
Select hosts that include a desired role from #hosts.
-
#master ⇒ Array<Host>
The host for which [‘roles’] include ‘master’.
Instance Method Details
#agents ⇒ Array<Host>
The hosts for which [‘roles’] include ‘agent’
28 29 30 |
# File 'lib/beaker/dsl/roles.rb', line 28 def agents hosts_as 'agent' end |
#dashboard ⇒ Array<Host>
The host for which [‘roles’] include ‘dashboard’
67 68 69 |
# File 'lib/beaker/dsl/roles.rb', line 67 def dashboard find_only_one :dashboard end |
#database ⇒ Array<Host>
The host for which [‘roles’] include ‘database’
54 55 56 |
# File 'lib/beaker/dsl/roles.rb', line 54 def database find_only_one :database end |
#find_only_one(role) ⇒ Host
Returns the host, if one and only one is found
92 93 94 |
# File 'lib/beaker/dsl/roles.rb', line 92 def find_only_one role only_host_with_role(hosts, role) end |
#hosts_as(desired_role = nil) ⇒ Array<Host>
Select hosts that include a desired role from #hosts
84 85 86 |
# File 'lib/beaker/dsl/roles.rb', line 84 def hosts_as(desired_role = nil) hosts_with_role(hosts, desired_role) end |
#master ⇒ Array<Host>
The host for which [‘roles’] include ‘master’
41 42 43 |
# File 'lib/beaker/dsl/roles.rb', line 41 def master find_only_one :master end |