beaker 2.36.0 → 2.37.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +8 -8
- data/HISTORY.md +67 -2
- data/acceptance/tests/base/dsl/platform_tag_confiner_test.rb +49 -0
- data/docs/dsl/platform_specific_tag_confines.md +76 -0
- data/docs/hosts/cisco.md +6 -5
- data/lib/beaker/dsl/install_utils/foss_utils.rb +20 -16
- data/lib/beaker/dsl/structure.rb +95 -0
- data/lib/beaker/host/cisco.rb +18 -11
- data/lib/beaker/host/unix/file.rb +10 -2
- data/lib/beaker/host/windows/pkg.rb +7 -1
- data/lib/beaker/host_prebuilt_steps.rb +1 -1
- data/lib/beaker/platform.rb +3 -1
- data/lib/beaker/version.rb +1 -1
- data/spec/beaker/dsl/install_utils/foss_utils_spec.rb +6 -6
- data/spec/beaker/dsl/structure_spec.rb +147 -0
- data/spec/beaker/host/cisco_spec.rb +43 -31
- data/spec/beaker/host/unix/file_spec.rb +1 -1
- data/spec/beaker/host/unix_spec.rb +1 -1
- data/spec/beaker/host_prebuilt_steps_spec.rb +2 -2
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
MGNkMmMyYzVlMzE0ZjZjNzZjYjMwNGUzYWI5ZGJiYzljM2E4YmJhNw==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
MmQyMGI2ZTdmYjVjMjQ3MzIwNWI5OTQwNGFhNzQ3NDgyYzNjMTU4Zg==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
N2M5NjFjMWM4MGI2ZTllNDM2ODNhMGQ4YmQzMzlhNWUzNDdiZWZmMWU3ZTdk
|
10
|
+
MWQ5YzE2ZjgwMmY1NzE3YTU3NjVhMjkxYTUzYjZkZDZkZmYzNGExZjJiNzNh
|
11
|
+
ZDg0MDY0ZGM5YjZlYjhmMDkyNjIxNDViZTdjNzBhNWUzNDIwMjI=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
Mjk3ZTg3M2Y1MjIzMzZkY2NhNzhiNWViNjljODc3YzljNjk5ZmZkMzM1ODcx
|
14
|
+
OTA0ZmVhNDg0YmFhYzAwOTc5ZjEwNTEwMTM1MjVlNjdiNjVhODI4NTk1ZTQ4
|
15
|
+
MDIxNDE1YzViZmNmMTNlOGVmZTc2M2FhNTMxMzZkNzJkMzE2N2Y=
|
data/HISTORY.md
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
# default - History
|
2
2
|
## Tags
|
3
|
-
* [LATEST -
|
3
|
+
* [LATEST - 15 Mar, 2016 (b7ed692c)](#LATEST)
|
4
|
+
* [2.36.0 - 9 Mar, 2016 (5fd86b67)](#2.36.0)
|
4
5
|
* [2.35.0 - 24 Feb, 2016 (b20fa892)](#2.35.0)
|
5
6
|
* [2.34.0 - 10 Feb, 2016 (b897a98a)](#2.34.0)
|
6
7
|
* [2.33.0 - 27 Jan, 2016 (0dd8505a)](#2.33.0)
|
@@ -111,7 +112,71 @@
|
|
111
112
|
* [pe1.2 - 6 Sep, 2011 (ba3dadd2)](#pe1.2)
|
112
113
|
|
113
114
|
## Details
|
114
|
-
### <a name = "LATEST">LATEST -
|
115
|
+
### <a name = "LATEST">LATEST - 15 Mar, 2016 (b7ed692c)
|
116
|
+
|
117
|
+
* (GEM) update beaker version to 2.37.0 (b7ed692c)
|
118
|
+
|
119
|
+
* Merge pull request #1079 from kevpl/bkr702_platform_confine_tags (e2b3701d)
|
120
|
+
|
121
|
+
|
122
|
+
```
|
123
|
+
Merge pull request #1079 from kevpl/bkr702_platform_confine_tags
|
124
|
+
|
125
|
+
(BKR-702) added platform-specific tag confines
|
126
|
+
```
|
127
|
+
* Merge pull request #1080 from MikaelSmith/fix-install_puppet_agent_on (478983f2)
|
128
|
+
|
129
|
+
|
130
|
+
```
|
131
|
+
Merge pull request #1080 from MikaelSmith/fix-install_puppet_agent_on
|
132
|
+
|
133
|
+
(maint) Correct install_puppet_agent_on args
|
134
|
+
```
|
135
|
+
* (maint) Correct install_puppet_agent_on args (26c82bdd)
|
136
|
+
|
137
|
+
|
138
|
+
```
|
139
|
+
(maint) Correct install_puppet_agent_on args
|
140
|
+
|
141
|
+
The docs for `install_puppet_agent_on` specify that the `opts` arg is
|
142
|
+
optional, but it doesn't have a default value so in practice it's
|
143
|
+
required. Update the call signature to specify a default empty hash, so
|
144
|
+
the function matches its description.
|
145
|
+
```
|
146
|
+
* Merge pull request #1078 from LuvCurves/BKR-705 (23612a36)
|
147
|
+
|
148
|
+
|
149
|
+
```
|
150
|
+
Merge pull request #1078 from LuvCurves/BKR-705
|
151
|
+
|
152
|
+
(BKR-705) Rename cisco platforms
|
153
|
+
```
|
154
|
+
* Merge pull request #1076 from MikaelSmith/BKR-715 (521fbf7b)
|
155
|
+
|
156
|
+
|
157
|
+
```
|
158
|
+
Merge pull request #1076 from MikaelSmith/BKR-715
|
159
|
+
|
160
|
+
(BKR-715) Use puppet_agent_version for MSI from dev repos
|
161
|
+
```
|
162
|
+
* (BKR-702) added platform-specific tag confines (7cc40abb)
|
163
|
+
|
164
|
+
* (BKR-705) Rename cisco platforms (f5a46897)
|
165
|
+
|
166
|
+
* (BKR-715) Use puppet_agent_version for MSI from dev repos (046fbffd)
|
167
|
+
|
168
|
+
|
169
|
+
```
|
170
|
+
(BKR-715) Use puppet_agent_version for MSI from dev repos
|
171
|
+
|
172
|
+
If a `puppet_agent_version` is specified, use it in
|
173
|
+
`install_puppet_agent_dev_repo_on` to fetch the MSI, so we get an MSI
|
174
|
+
unique to that SHA. This provides a work-around for BKR-712, and
|
175
|
+
normalizes behavior with `install_puppet_agent_on`.
|
176
|
+
```
|
177
|
+
### <a name = "2.36.0">2.36.0 - 9 Mar, 2016 (5fd86b67)
|
178
|
+
|
179
|
+
* (HISTORY) update beaker history for gem release 2.36.0 (5fd86b67)
|
115
180
|
|
116
181
|
* (GEM) update beaker version to 2.36.0 (571ab630)
|
117
182
|
|
@@ -0,0 +1,49 @@
|
|
1
|
+
test_name "DSL::Structure::PlatformTagConfiner" do
|
2
|
+
pstc_method_name = "#platform_specific_tag_confines"
|
3
|
+
step "#{pstc_method_name} doesn't change hosts if there are no tags" do
|
4
|
+
previous_hosts = hosts.dup
|
5
|
+
|
6
|
+
platform_specific_tag_confines
|
7
|
+
|
8
|
+
assert_equal previous_hosts, hosts, "#{pstc_method_name} changed the hosts array"
|
9
|
+
# cleanup
|
10
|
+
options[:platform_tag_confines_object] = nil
|
11
|
+
options[:platform_tag_confines] = nil
|
12
|
+
@hosts = previous_hosts
|
13
|
+
end
|
14
|
+
|
15
|
+
step "#{pstc_method_name} can remove hosts from a test, or be skipped if empty" do
|
16
|
+
assert hosts.length() > 0, "#{pstc_method_name} did not have enough hosts to test"
|
17
|
+
previous_hosts = hosts.dup
|
18
|
+
|
19
|
+
options[:platform_tag_confines] = [
|
20
|
+
:platform => /#{default[:platform]}/,
|
21
|
+
:tag_reason_hash => {
|
22
|
+
'tag1' => 'reason1'
|
23
|
+
}
|
24
|
+
]
|
25
|
+
|
26
|
+
begin
|
27
|
+
tag( 'tag1' )
|
28
|
+
rescue Beaker::DSL::Outcomes::SkipTest => e
|
29
|
+
if e.message =~ /^No\ suitable\ hosts\ found$/
|
30
|
+
# SkipTest is raised in the case when there are no hosts leftover for a test
|
31
|
+
# after confining. It's a very common acceptance test case where all of the
|
32
|
+
# hosts involved are of the same platform, and are thus all confined
|
33
|
+
# away by the code being run here. In this case, the hosts object will not
|
34
|
+
# be altered, but should be considered a pass, since the fact that SkipTest
|
35
|
+
# is being raised confirms that a lower number of hosts are coming out of
|
36
|
+
# the confine (0) than came in (>0, according to our pre-condition assertion)
|
37
|
+
else
|
38
|
+
fail "#{pstc_method_name} raised unexpected SkipTest exception: #{e}"
|
39
|
+
end
|
40
|
+
else
|
41
|
+
assert hosts.length() < previous_hosts.length(), "#{pstc_method_name} did not change hosts array"
|
42
|
+
end
|
43
|
+
|
44
|
+
# cleanup
|
45
|
+
options[:platform_tag_confines_object] = nil
|
46
|
+
options[:platform_tag_confines] = nil
|
47
|
+
@hosts = previous_hosts
|
48
|
+
end
|
49
|
+
end
|
@@ -0,0 +1,76 @@
|
|
1
|
+
# Platform-Specific Tag Confines
|
2
|
+
|
3
|
+
## What Are These?
|
4
|
+
|
5
|
+
Typically when adding support for new platforms, a number of tests have to
|
6
|
+
be confined away from executing on that new platform. This can be for a
|
7
|
+
number of reasons, from partial implementation/support to tests having
|
8
|
+
incorrect assumptions that don't work on the new platform.
|
9
|
+
|
10
|
+
Platform-specific tag confines are structures created to make this workflow
|
11
|
+
easier, & achievable in a much more low-impact and adaptable way.
|
12
|
+
|
13
|
+
## Ok, So How Do We Use Them?
|
14
|
+
|
15
|
+
In the local options file (provided to the command line interface (CLI)
|
16
|
+
using the `--options-file` parameter), you can now provide an array of
|
17
|
+
hashes, where each hash specifies a platform to confine, based on the
|
18
|
+
tags included in the test. The local options file key is
|
19
|
+
`:platform_tag_confines`.
|
20
|
+
|
21
|
+
An example local options file is included
|
22
|
+
below (remember that local options files have to be readable into
|
23
|
+
beaker as a ruby hash):
|
24
|
+
|
25
|
+
```ruby
|
26
|
+
{
|
27
|
+
:platform_tag_confines => [
|
28
|
+
{
|
29
|
+
:platform => /^ubuntu-1404/,
|
30
|
+
:tag_reason_hash => {
|
31
|
+
"metrics" => "Can't do this, because bananas are in the field",
|
32
|
+
"ui" => "TODO: We have not applied the UI tests to Ubuntu yet",
|
33
|
+
}
|
34
|
+
}, {
|
35
|
+
:platform => /^centos-7/,
|
36
|
+
:tag_reason_hash => {
|
37
|
+
"database" => "WUT is this system doing? I dunno, must skip",
|
38
|
+
"long_running" => "Flakiest test EVA. Would not run against centos-7, will kill...",
|
39
|
+
"ui" => "CentOS reason",
|
40
|
+
}
|
41
|
+
}
|
42
|
+
]
|
43
|
+
}
|
44
|
+
```
|
45
|
+
|
46
|
+
In this case, there are two platform confines objects specified, one for
|
47
|
+
Ubuntu 14.04, and the other for CentOS 7. These objects consist of a hash,
|
48
|
+
filled with two entries: the `:platform` regex, and the `:tag_reason_hash`.
|
49
|
+
|
50
|
+
The `:platform` regex is just that, a Ruby regex matching the host's
|
51
|
+
platform string.
|
52
|
+
|
53
|
+
The `:tag_reason_hash` is another hash that maps tags to the reason that
|
54
|
+
tests that have this particular tag are being confined away from testing.
|
55
|
+
|
56
|
+
Taking one of our confine examples from above, we can think of the Ubuntu
|
57
|
+
UI confine example like this:
|
58
|
+
|
59
|
+
"ui" tests will be confined away from ubuntu-1404 hosts, because
|
60
|
+
"TODO: We have not applied the UI tests to Ubuntu yet"
|
61
|
+
|
62
|
+
|
63
|
+
## But Why Do We Need These?
|
64
|
+
|
65
|
+
Usually when we add platforms, the confining tests step is very heavy
|
66
|
+
handed & repetitive, usually consisting of adding boilerplate confine
|
67
|
+
calls that don't provide any explanation for why these are happening.
|
68
|
+
This can make it hard to later know the reason for the confine, making
|
69
|
+
it hard to know when we should be able to remove confines down the road.
|
70
|
+
|
71
|
+
This new workflow should provide a number of advantages over the previous
|
72
|
+
one, including:
|
73
|
+
|
74
|
+
1. Always reporting a reason for confining a platform
|
75
|
+
2. Allowing these to be dynamically determined from configuration, rather
|
76
|
+
than needing to edit tens to hundreds of test files in-repo
|
data/docs/hosts/cisco.md
CHANGED
@@ -4,10 +4,11 @@ Wind River Linux is an embedded systems OS from Wind, an Intel Company. You
|
|
4
4
|
can get more details on this from their
|
5
5
|
[product page](http://www.windriver.com/products/linux/).
|
6
6
|
|
7
|
-
|
8
|
-
|
7
|
+
Beaker provides support for 2 of Cisco's Wind River Linux platforms.
|
8
|
+
Those platform codenames are `cisco_nexus` for Cisco NX-OS based systems
|
9
|
+
and `cisco_ios_xr` for Cisco IOS XR based systems.
|
9
10
|
|
10
|
-
Beaker currently can install puppet on
|
11
|
+
Beaker currently can install puppet on Cisco Nexus and Cisco IOS XR.
|
11
12
|
|
12
13
|
# Host Requirements
|
13
14
|
|
@@ -15,7 +16,7 @@ WRLinux hosts validate their setup once created, and will fail if not
|
|
15
16
|
setup correctly. There are two conditions that are validated specifically
|
16
17
|
on WRLinux hosts. These conditions are listed below.
|
17
18
|
|
18
|
-
A. All
|
19
|
+
A. All Cisco Nexus hosts will need a `:vrf` value, which determines their
|
19
20
|
virtual routing framework for networking purposes. For our purposes,
|
20
21
|
we tend to use the value `management`, so there is always a hosts
|
21
22
|
file line that looks like this in our configuration:
|
@@ -25,7 +26,7 @@ file line that looks like this in our configuration:
|
|
25
26
|
...
|
26
27
|
vrf: management
|
27
28
|
|
28
|
-
B.
|
29
|
+
B. All Cisco hosts will also require a user to be set on the
|
29
30
|
hosts. This is because they don't allow ssh'ing as the root user,
|
30
31
|
which is one of the main assumptions that Beaker operates under in
|
31
32
|
the usual case. In order to specify a user to ssh with, add this
|
@@ -324,7 +324,7 @@ module Beaker
|
|
324
324
|
# @return nil
|
325
325
|
# @raise [StandardError] When encountering an unsupported platform by default, or if gem cannot be found when default_action => 'gem_install'
|
326
326
|
# @raise [FailTest] When error occurs during the actual installation process
|
327
|
-
def install_puppet_agent_on(hosts, opts)
|
327
|
+
def install_puppet_agent_on(hosts, opts = {})
|
328
328
|
opts = FOSS_DEFAULT_DOWNLOAD_URLS.merge(opts)
|
329
329
|
opts[:puppet_collection] ||= 'pc1' #hi! i'm case sensitive! be careful!
|
330
330
|
opts[:puppet_agent_version] ||= opts[:version] #backwards compatability with old parameter name
|
@@ -333,7 +333,7 @@ module Beaker
|
|
333
333
|
add_role(host, 'aio') #we are installing agent, so we want aio role
|
334
334
|
package_name = nil
|
335
335
|
case host['platform']
|
336
|
-
when /el-|fedora|sles|centos|
|
336
|
+
when /el-|fedora|sles|centos|cisco_/
|
337
337
|
package_name = 'puppet-agent'
|
338
338
|
package_name << "-#{opts[:puppet_agent_version]}" if opts[:puppet_agent_version]
|
339
339
|
when /debian|ubuntu|cumulus/
|
@@ -842,21 +842,25 @@ module Beaker
|
|
842
842
|
opts = FOSS_DEFAULT_DOWNLOAD_URLS.merge(opts)
|
843
843
|
|
844
844
|
case variant
|
845
|
-
when /^(fedora|el|centos|sles|
|
845
|
+
when /^(fedora|el|centos|sles|cisco_nexus|cisco_ios_xr)$/
|
846
846
|
variant_url_value = (($1 == 'centos') ? 'el' : $1)
|
847
|
-
|
847
|
+
if variant == 'cisco_nexus'
|
848
|
+
variant_url_value = 'cisco-wrlinux'
|
849
|
+
version = '5'
|
850
|
+
end
|
851
|
+
if variant == 'cisco_ios_xr'
|
852
|
+
variant_url_value = 'cisco-wrlinux'
|
853
|
+
version = '7'
|
854
|
+
end
|
848
855
|
remote = "%s/puppetlabs-release%s-%s-%s.noarch.rpm" %
|
849
856
|
[opts[:release_yum_repo_url], repo_name, variant_url_value, version]
|
850
857
|
|
851
|
-
if variant == '
|
852
|
-
|
853
|
-
|
854
|
-
|
855
|
-
|
856
|
-
|
857
|
-
# cisco 7 requires using yum to localinstall the repo
|
858
|
-
on host, "yum -y localinstall #{remote}"
|
859
|
-
end
|
858
|
+
if variant == 'cisco_nexus'
|
859
|
+
# cisco nexus requires using yum to install the repo
|
860
|
+
host.install_package( remote )
|
861
|
+
elsif variant == 'cisco_ios_xr'
|
862
|
+
# cisco ios xr requires using yum to localinstall the repo
|
863
|
+
on host, "yum -y localinstall #{remote}"
|
860
864
|
else
|
861
865
|
host.install_package_with_rpm( remote, '--replacepkgs',
|
862
866
|
{ :package_proxy => opts[:package_proxy] } )
|
@@ -896,7 +900,7 @@ module Beaker
|
|
896
900
|
repo_filename,
|
897
901
|
copy_dir )
|
898
902
|
|
899
|
-
if host[:platform] =~ /
|
903
|
+
if host[:platform] =~ /cisco_nexus/
|
900
904
|
to_path = "#{host.package_config_dir}/#{File.basename(repo)}"
|
901
905
|
else
|
902
906
|
to_path = host.package_config_dir
|
@@ -938,7 +942,7 @@ module Beaker
|
|
938
942
|
repo_configs_dir = nil,
|
939
943
|
opts = options )
|
940
944
|
variant, version, arch, codename = host['platform'].to_array
|
941
|
-
if variant !~ /^(fedora|el|centos|debian|ubuntu|cumulus|
|
945
|
+
if variant !~ /^(fedora|el|centos|debian|ubuntu|cumulus|cisco_nexus|cisco_ios_xr)$/
|
942
946
|
raise "No repository installation step for #{variant} yet..."
|
943
947
|
end
|
944
948
|
repo_configs_dir ||= 'tmp/repo_configs'
|
@@ -1035,7 +1039,7 @@ module Beaker
|
|
1035
1039
|
onhost_copy_base = opts[:copy_dir_external]
|
1036
1040
|
|
1037
1041
|
case variant
|
1038
|
-
when /^(fedora|el|centos|debian|ubuntu|cumulus|
|
1042
|
+
when /^(fedora|el|centos|debian|ubuntu|cumulus|cisco_nexus|cisco_ios_xr)$/
|
1039
1043
|
sha = opts[:puppet_agent_sha] || opts[:puppet_agent_version]
|
1040
1044
|
opts[:dev_builds_repos] ||= [ opts[:puppet_collection] ]
|
1041
1045
|
install_puppetlabs_dev_repo( host, 'puppet-agent', sha, nil, opts )
|
data/lib/beaker/dsl/structure.rb
CHANGED
@@ -273,6 +273,28 @@ module Beaker
|
|
273
273
|
end
|
274
274
|
skip_test "#{self.path} includes excluded tag(s): #{tags_to_remove_to_include_this_test}" \
|
275
275
|
if tags_to_remove_to_include_this_test.length > 0
|
276
|
+
|
277
|
+
platform_specific_tag_confines
|
278
|
+
end
|
279
|
+
|
280
|
+
# Handles platform-specific tag confines logic
|
281
|
+
#
|
282
|
+
# @return nil
|
283
|
+
# @!visibility private
|
284
|
+
def platform_specific_tag_confines
|
285
|
+
@options[:platform_tag_confines_object] ||= PlatformTagConfiner.new(
|
286
|
+
@options[:platform_tag_confines]
|
287
|
+
)
|
288
|
+
confines = @options[:platform_tag_confines_object].confine_details(
|
289
|
+
metadata[:case][:tags]
|
290
|
+
)
|
291
|
+
confines.each do |confine_details|
|
292
|
+
logger.notify( confine_details[:log_message] )
|
293
|
+
confine(
|
294
|
+
confine_details[:type],
|
295
|
+
:platform => confine_details[:platform_regex]
|
296
|
+
)
|
297
|
+
end
|
276
298
|
end
|
277
299
|
|
278
300
|
#Return a set of hosts that meet the given criteria
|
@@ -322,6 +344,79 @@ module Beaker
|
|
322
344
|
true_false
|
323
345
|
end
|
324
346
|
end
|
347
|
+
|
348
|
+
class PlatformTagConfiner
|
349
|
+
|
350
|
+
# Constructs the PlatformTagConfiner, transforming the user format
|
351
|
+
# into the internal structure for use by Beaker itself.
|
352
|
+
#
|
353
|
+
# @param [Array<Hash{Symbol=>Object}>] platform_tag_confines_array
|
354
|
+
# The array of PlatformTagConfines objects that specify how these
|
355
|
+
# confines should behave. See the note below for more info
|
356
|
+
#
|
357
|
+
# @note PlatformTagConfines objects come in the form
|
358
|
+
# [
|
359
|
+
# {
|
360
|
+
# :platform => <platform-regex>,
|
361
|
+
# :tag_reason_hash => {
|
362
|
+
# <tag> => <reason to confine>,
|
363
|
+
# <tag> => <reason to confine>,
|
364
|
+
# ...etc...
|
365
|
+
# }
|
366
|
+
# }
|
367
|
+
# ]
|
368
|
+
#
|
369
|
+
# Internally, we want to turn tag matches into platform
|
370
|
+
# confine statements. So a better internal structure would
|
371
|
+
# be something of the form:
|
372
|
+
# {
|
373
|
+
# <tag> => [{
|
374
|
+
# :platform => <platform-regex>,
|
375
|
+
# :reason => <reason to confine>,
|
376
|
+
# :type => :except,
|
377
|
+
# }, ... ]
|
378
|
+
# }
|
379
|
+
def initialize(platform_tag_confines_array)
|
380
|
+
platform_tag_confines_array ||= []
|
381
|
+
@tag_confine_details_hash = {}
|
382
|
+
platform_tag_confines_array.each do |entry|
|
383
|
+
entry[:tag_reason_hash].keys.each do |tag|
|
384
|
+
@tag_confine_details_hash[tag] ||= []
|
385
|
+
log_msg = "Tag '#{tag}' found, confining: except platforms "
|
386
|
+
log_msg << "matching regex '#{entry[:platform]}'. Reason: "
|
387
|
+
log_msg << "'#{entry[:tag_reason_hash][tag]}'"
|
388
|
+
@tag_confine_details_hash[tag] << {
|
389
|
+
:platform_regex => entry[:platform],
|
390
|
+
:log_message => log_msg,
|
391
|
+
:type => :except
|
392
|
+
}
|
393
|
+
end
|
394
|
+
end
|
395
|
+
end
|
396
|
+
|
397
|
+
# Gets the confine details needed for a set of tags
|
398
|
+
#
|
399
|
+
# @param [Array<String>] tags Tags of the given test
|
400
|
+
#
|
401
|
+
# @return [Array<Hash{Symbol=>Object}>] an array of
|
402
|
+
# Confine details hashes, which are hashes of symbols
|
403
|
+
# to their properties, which are objects of various
|
404
|
+
# kinds, depending on the key
|
405
|
+
def confine_details(tags)
|
406
|
+
tags ||= []
|
407
|
+
details = []
|
408
|
+
tags.each do |tag|
|
409
|
+
tag_confine_array = @tag_confine_details_hash[tag]
|
410
|
+
next if tag_confine_array.nil?
|
411
|
+
|
412
|
+
details.push( *tag_confine_array )
|
413
|
+
# tag_confine_array.each do |confine_details|
|
414
|
+
# details << confine_details
|
415
|
+
# end
|
416
|
+
end
|
417
|
+
details
|
418
|
+
end
|
419
|
+
end
|
325
420
|
end
|
326
421
|
end
|
327
422
|
end
|
data/lib/beaker/host/cisco.rb
CHANGED
@@ -21,7 +21,7 @@ module Cisco
|
|
21
21
|
#
|
22
22
|
# @return nil
|
23
23
|
def scp_post_operations(scp_file_actual, scp_file_target)
|
24
|
-
if self[:platform] =~ /
|
24
|
+
if self[:platform] =~ /cisco_nexus/
|
25
25
|
execute( "mv #{scp_file_actual} #{scp_file_target}" )
|
26
26
|
end
|
27
27
|
nil
|
@@ -34,7 +34,7 @@ module Cisco
|
|
34
34
|
# @return [String] path, changed if needed due to host
|
35
35
|
# constraints
|
36
36
|
def scp_path(path)
|
37
|
-
if self[:platform] =~ /
|
37
|
+
if self[:platform] =~ /cisco_nexus/
|
38
38
|
@home_dir ||= execute( 'pwd' )
|
39
39
|
answer = "#{@home_dir}/#{File.basename( path )}"
|
40
40
|
answer << '/' if path =~ /\/$/
|
@@ -72,9 +72,8 @@ module Cisco
|
|
72
72
|
return user_pc unless command.index('vsh').nil?
|
73
73
|
|
74
74
|
prepend_cmds = 'source /etc/profile;'
|
75
|
-
if self[:
|
76
|
-
prepend_cmds <<
|
77
|
-
prepend_cmds << ( self[:vrf] ? self[:vrf] : '' )
|
75
|
+
if self[:vrf]
|
76
|
+
prepend_cmds << "sudo ip netns exec #{self[:vrf]}"
|
78
77
|
end
|
79
78
|
return prepend_cmds
|
80
79
|
end
|
@@ -95,7 +94,7 @@ module Cisco
|
|
95
94
|
env_array = self.environment_variable_string_pair_array( env )
|
96
95
|
environment_string = env_array.join(' ')
|
97
96
|
|
98
|
-
command = self[:platform] =~ /
|
97
|
+
command = self[:platform] =~ /cisco_nexus/ ? 'export' : 'env'
|
99
98
|
"#{command} #{environment_string};"
|
100
99
|
end
|
101
100
|
|
@@ -106,10 +105,18 @@ module Cisco
|
|
106
105
|
# this will be raised with the appropriate message
|
107
106
|
def validate_setup
|
108
107
|
msg = nil
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
108
|
+
if self[:platform] =~ /cisco_nexus/
|
109
|
+
if !self[:vrf]
|
110
|
+
msg = 'Cisco Nexus hosts must be provided with a :vrf value.'
|
111
|
+
end
|
112
|
+
if !self[:user]
|
113
|
+
msg = 'Cisco hosts must be provided with a :user value'
|
114
|
+
end
|
115
|
+
end
|
116
|
+
if self[:platform] =~ /cisco_ios_xr/
|
117
|
+
if !self[:user]
|
118
|
+
msg = 'Cisco hosts must be provided with a :user value'
|
119
|
+
end
|
113
120
|
end
|
114
121
|
|
115
122
|
if msg
|
@@ -121,4 +128,4 @@ module Cisco
|
|
121
128
|
end
|
122
129
|
|
123
130
|
end
|
124
|
-
end
|
131
|
+
end
|
@@ -62,10 +62,18 @@ module Unix::File
|
|
62
62
|
repo_filename = "pl-%s-%s-" % [ package_name, build_version ]
|
63
63
|
|
64
64
|
case variant
|
65
|
-
when /fedora|el|centos|
|
65
|
+
when /fedora|el|centos|cisco_nexus|cisco_ios_xr/
|
66
66
|
variant = 'el' if variant == 'centos'
|
67
|
-
|
67
|
+
if variant == 'cisco_nexus'
|
68
|
+
variant = 'cisco-wrlinux'
|
69
|
+
version = '5'
|
70
|
+
end
|
71
|
+
if variant == 'cisco_ios_xr'
|
72
|
+
variant = 'cisco-wrlinux'
|
73
|
+
version = '7'
|
74
|
+
end
|
68
75
|
fedora_prefix = ((variant == 'fedora') ? 'f' : '')
|
76
|
+
|
69
77
|
pattern = "%s-%s%s-%s.repo"
|
70
78
|
pattern = "repos-pe-#{pattern}" if self.is_pe?
|
71
79
|
|
@@ -65,7 +65,13 @@ module Windows::Pkg
|
|
65
65
|
# - we do not have install_32 set on host
|
66
66
|
# - we do not have install_32 set globally
|
67
67
|
arch_suffix = should_install_64bit ? '64' : '86'
|
68
|
-
|
68
|
+
# If a version was specified, use it; otherwise fall back to a default name.
|
69
|
+
# Avoid when puppet_agent_version is set to a SHA, which isn't used in package names.
|
70
|
+
if puppet_agent_version =~ /^\d+\.\d+\.\d+/
|
71
|
+
release_file = "puppet-agent-#{puppet_agent_version}-x#{arch_suffix}.msi"
|
72
|
+
else
|
73
|
+
release_file = "puppet-agent-x#{arch_suffix}.msi"
|
74
|
+
end
|
69
75
|
return release_path_end, release_file
|
70
76
|
end
|
71
77
|
|
@@ -110,7 +110,7 @@ module Beaker
|
|
110
110
|
check_and_install_packages_if_needed(host, OPENBSD_PACKAGES)
|
111
111
|
when host['platform'] =~ /solaris-10/
|
112
112
|
check_and_install_packages_if_needed(host, SOLARIS10_PACKAGES)
|
113
|
-
when host['platform'] !~ /debian|aix|solaris|windows|sles-|osx-|cumulus|f5-|netscaler|
|
113
|
+
when host['platform'] !~ /debian|aix|solaris|windows|sles-|osx-|cumulus|f5-|netscaler|cisco_/
|
114
114
|
check_and_install_packages_if_needed(host, UNIX_PACKAGES)
|
115
115
|
end
|
116
116
|
end
|
data/lib/beaker/platform.rb
CHANGED
@@ -3,7 +3,7 @@ module Beaker
|
|
3
3
|
# all String methods while adding several platform-specific use cases.
|
4
4
|
class Platform < String
|
5
5
|
# Supported platforms
|
6
|
-
PLATFORMS = /^(
|
6
|
+
PLATFORMS = /^(cisco_nexus|cisco_ios_xr|(free|open)bsd|osx|centos|fedora|debian|oracle|redhat|scientific|sles|ubuntu|windows|solaris|aix|el|eos|cumulus|f5|netscaler)\-.+\-.+$/
|
7
7
|
# Platform version numbers vs. codenames conversion hash
|
8
8
|
PLATFORM_VERSION_CODES =
|
9
9
|
{ :debian => { "jessie" => "8",
|
@@ -42,6 +42,8 @@ module Beaker
|
|
42
42
|
# Creates the Platform object. Checks to ensure that the platform String
|
43
43
|
# provided meets the platform formatting rules. Platforms name must be of
|
44
44
|
# the format /^OSFAMILY-VERSION-ARCH.*$/ where OSFAMILY is one of:
|
45
|
+
# * cisco_nexus
|
46
|
+
# * cisco_ios_xr
|
45
47
|
# * freebsd
|
46
48
|
# * openbsd
|
47
49
|
# * osx
|
data/lib/beaker/version.rb
CHANGED
@@ -641,7 +641,7 @@ describe ClassMixedWithDSLInstallUtils do
|
|
641
641
|
|
642
642
|
context 'on cisco platforms' do
|
643
643
|
context 'version 5' do
|
644
|
-
let( :platform ) { Beaker::Platform.new( '
|
644
|
+
let( :platform ) { Beaker::Platform.new( 'cisco_nexus-7-x86_64' ) }
|
645
645
|
|
646
646
|
it 'calls host.install_package' do
|
647
647
|
expect( host ).to receive( :install_package ).with( /\.rpm$/ )
|
@@ -650,7 +650,7 @@ describe ClassMixedWithDSLInstallUtils do
|
|
650
650
|
end
|
651
651
|
|
652
652
|
context 'version 7' do
|
653
|
-
let( :platform ) { Beaker::Platform.new( '
|
653
|
+
let( :platform ) { Beaker::Platform.new( 'cisco_ios_xr-6-x86_64' ) }
|
654
654
|
|
655
655
|
it 'uses yum localinstall to install the package' do
|
656
656
|
expect( subject ).to receive( :on ).with( host, /^yum.*localinstall.*\.rpm$/ )
|
@@ -952,12 +952,12 @@ describe ClassMixedWithDSLInstallUtils do
|
|
952
952
|
host['platform'] = platform
|
953
953
|
opts = { :version => '0.1.0' }
|
954
954
|
allow( subject ).to receive( :options ).and_return( {} )
|
955
|
-
copied_path = "#{win_temp}\\puppet-agent-x86.msi"
|
955
|
+
copied_path = "#{win_temp}\\puppet-agent-0.1.0-x86.msi"
|
956
956
|
mock_echo = Object.new()
|
957
957
|
allow( mock_echo ).to receive( :raw_output ).and_return( copied_path )
|
958
958
|
|
959
|
-
expect(subject).to receive(:fetch_http_file).once.with(/\/windows$/, 'puppet-agent-x86.msi', /\/windows$/)
|
960
|
-
expect(subject).to receive(:scp_to).once.with(host, /\/puppet-agent-x86.msi$/, /#{external_copy_base}/)
|
959
|
+
expect(subject).to receive(:fetch_http_file).once.with(/\/windows$/, 'puppet-agent-0.1.0-x86.msi', /\/windows$/)
|
960
|
+
expect(subject).to receive(:scp_to).once.with(host, /\/puppet-agent-0.1.0-x86.msi$/, /#{external_copy_base}/)
|
961
961
|
expect(subject).to receive(:install_msi_on).with(host, copied_path, {}, {:debug => nil}).once
|
962
962
|
expect(subject).to receive(:on).ordered.with(host, /echo/).and_return(mock_echo)
|
963
963
|
|
@@ -1063,7 +1063,7 @@ describe ClassMixedWithDSLInstallUtils do
|
|
1063
1063
|
expect( subject ).to receive( :install_msi_on ).with( any_args )
|
1064
1064
|
copy_base = 'copy_base_cygwin'
|
1065
1065
|
allow( host ).to receive( :external_copy_base ).and_return( copy_base )
|
1066
|
-
expect( subject ).to receive( :scp_to ).with( host, /puppet-agent-x86\.msi/, /#{copy_base}/ )
|
1066
|
+
expect( subject ).to receive( :scp_to ).with( host, /puppet-agent-1\.0\.0-x86\.msi/, /#{copy_base}/ )
|
1067
1067
|
expect( subject ).to receive( :configure_type_defaults_on ).with(host)
|
1068
1068
|
expect( subject ).to receive( :fetch_http_file ).with( /[^\/]\z/, anything, anything )
|
1069
1069
|
subject.install_puppet_agent_dev_repo_on( host, opts.merge({ :puppet_agent_version => '1.0.0' }) )
|
@@ -282,6 +282,10 @@ describe ClassMixedWithDSLStructure do
|
|
282
282
|
opts
|
283
283
|
}
|
284
284
|
|
285
|
+
before :each do
|
286
|
+
allow( subject ).to receive( :platform_specific_tag_confines )
|
287
|
+
end
|
288
|
+
|
285
289
|
it 'sets tags on the TestCase\'s metadata object' do
|
286
290
|
subject.instance_variable_set(:@options, options)
|
287
291
|
tags = ['pants', 'jayjay', 'moguely']
|
@@ -339,3 +343,146 @@ describe ClassMixedWithDSLStructure do
|
|
339
343
|
|
340
344
|
end
|
341
345
|
end
|
346
|
+
|
347
|
+
describe Beaker::DSL::Structure::PlatformTagConfiner do
|
348
|
+
let ( :confines_array ) { @confines_array || [] }
|
349
|
+
let ( :confiner ) {
|
350
|
+
Beaker::DSL::Structure::PlatformTagConfiner.new( confines_array )
|
351
|
+
}
|
352
|
+
|
353
|
+
describe '#initialize' do
|
354
|
+
it 'transforms one entry' do
|
355
|
+
platform_regex = /^ubuntu$/
|
356
|
+
tag_reason_hash = {
|
357
|
+
'tag1' => 'reason1',
|
358
|
+
'tag2' => 'reason2'
|
359
|
+
}
|
360
|
+
@confines_array = [ {
|
361
|
+
:platform => platform_regex,
|
362
|
+
:tag_reason_hash => tag_reason_hash
|
363
|
+
}
|
364
|
+
]
|
365
|
+
|
366
|
+
internal_hash = confiner.instance_variable_get( :@tag_confine_details_hash )
|
367
|
+
expect( internal_hash.keys() ).to include( 'tag1' )
|
368
|
+
expect( internal_hash.keys() ).to include( 'tag2' )
|
369
|
+
expect( internal_hash.keys().length() ).to be === 2
|
370
|
+
|
371
|
+
tag_reason_hash.each do |tag, reason|
|
372
|
+
tag_array = internal_hash[tag]
|
373
|
+
expect( tag_array.length() ).to be === 1
|
374
|
+
tag_hash = tag_array[0]
|
375
|
+
expect( tag_hash[:platform_regex] ).to eql( platform_regex )
|
376
|
+
expect( tag_hash[:log_message] ).to match( /#{reason}/ )
|
377
|
+
expect( tag_hash[:type] ).to be === :except
|
378
|
+
end
|
379
|
+
end
|
380
|
+
|
381
|
+
it 'deals with the same tag being used on multiple platforms correctly' do
|
382
|
+
@confines_array = [
|
383
|
+
{
|
384
|
+
:platform => /^el-/,
|
385
|
+
:tag_reason_hash => {
|
386
|
+
'tag1' => 'reason el 1',
|
387
|
+
'tag2' => 'reason2'
|
388
|
+
}
|
389
|
+
}, {
|
390
|
+
:platform => /^cisco-/,
|
391
|
+
:tag_reason_hash => {
|
392
|
+
'tag1' => 'reason cisco 1',
|
393
|
+
'tag3' => 'reason3'
|
394
|
+
}
|
395
|
+
}
|
396
|
+
]
|
397
|
+
|
398
|
+
internal_hash = confiner.instance_variable_get( :@tag_confine_details_hash )
|
399
|
+
expect( internal_hash.keys() ).to include( 'tag1' )
|
400
|
+
expect( internal_hash.keys() ).to include( 'tag2' )
|
401
|
+
expect( internal_hash.keys() ).to include( 'tag3' )
|
402
|
+
expect( internal_hash.keys().length() ).to be === 3
|
403
|
+
|
404
|
+
shared_tag_array = internal_hash['tag1']
|
405
|
+
expect( shared_tag_array.length() ).to be === 2
|
406
|
+
|
407
|
+
platform_el_found = false
|
408
|
+
platform_cisco_found = false
|
409
|
+
shared_tag_array.each do |confine_details|
|
410
|
+
case confine_details[:log_message]
|
411
|
+
when /\ el\ 1/
|
412
|
+
platform_el_found = true
|
413
|
+
platform_to_match = /^el-/
|
414
|
+
reason_to_match = /reason\ el\ 1/
|
415
|
+
when /\ cisco\ 1/
|
416
|
+
platform_cisco_found = true
|
417
|
+
platform_to_match = /^cisco-/
|
418
|
+
reason_to_match = /reason\ cisco\ 1/
|
419
|
+
else
|
420
|
+
log_msg = "unexpected log message for confine_details: "
|
421
|
+
log_msg << confine_details[:log_message]
|
422
|
+
fail( log_msg )
|
423
|
+
end
|
424
|
+
|
425
|
+
expect( confine_details[:platform_regex] ).to eql( platform_to_match )
|
426
|
+
expect( confine_details[:log_message] ).to match( reason_to_match )
|
427
|
+
end
|
428
|
+
expect( platform_el_found ).to be === true
|
429
|
+
expect( platform_cisco_found ).to be === true
|
430
|
+
end
|
431
|
+
end
|
432
|
+
|
433
|
+
describe '#confine_details' do
|
434
|
+
it 'returns an empty array if no tags match' do
|
435
|
+
fake_confine_details_hash = { 'tag1' => [ {:type => 1}, {:type => 2} ]}
|
436
|
+
confiner.instance_variable_set(
|
437
|
+
:@tag_confine_details_hash, fake_confine_details_hash
|
438
|
+
)
|
439
|
+
expect( confiner.confine_details( [ 'tag2', 'tag3' ] ) ).to be === []
|
440
|
+
end
|
441
|
+
|
442
|
+
context 'descriminates on tag name' do
|
443
|
+
fake_confine_details_hash = {
|
444
|
+
'tag0' => [ 10, 20, 30, 40 ],
|
445
|
+
'tag1' => [ 41, 51, 61, 71 ],
|
446
|
+
'tag2' => [ 22, 32, 42, 52 ],
|
447
|
+
'tag3' => [ 63, 73, 83, 93 ],
|
448
|
+
'tag4' => [ 34, 44, 54, 64 ],
|
449
|
+
}
|
450
|
+
|
451
|
+
key_combos_to_test = fake_confine_details_hash.keys.map { |key| [key] }
|
452
|
+
key_combos_to_test << [ 'tag0', 'tag2' ]
|
453
|
+
key_combos_to_test << [ 'tag1', 'tag4' ]
|
454
|
+
key_combos_to_test << [ 'tag2', 'tag3', 'tag4' ]
|
455
|
+
key_combos_to_test << fake_confine_details_hash.keys()
|
456
|
+
|
457
|
+
before :each do
|
458
|
+
confiner.instance_variable_set(
|
459
|
+
:@tag_confine_details_hash, fake_confine_details_hash
|
460
|
+
)
|
461
|
+
end
|
462
|
+
|
463
|
+
key_combos_to_test.each do |key_combo_to_have|
|
464
|
+
it "selects key(s) #{key_combo_to_have} from #{fake_confine_details_hash.keys}" do
|
465
|
+
haves = []
|
466
|
+
key_combo_to_have.each do |key_to_have|
|
467
|
+
haves += fake_confine_details_hash[key_to_have]
|
468
|
+
end
|
469
|
+
keys_not_to_have = fake_confine_details_hash.keys.reject { |key_trial|
|
470
|
+
key_combo_to_have.include?( key_trial )
|
471
|
+
}
|
472
|
+
have_nots = []
|
473
|
+
keys_not_to_have.each do |key_not_to_have|
|
474
|
+
have_nots += fake_confine_details_hash[key_not_to_have]
|
475
|
+
end
|
476
|
+
|
477
|
+
details = confiner.confine_details( key_combo_to_have )
|
478
|
+
have_nots.each do |confine_details|
|
479
|
+
expect( details ).to_not include( confine_details )
|
480
|
+
end
|
481
|
+
haves.each do |confine_details|
|
482
|
+
expect( details ).to include( confine_details )
|
483
|
+
end
|
484
|
+
end
|
485
|
+
end
|
486
|
+
end
|
487
|
+
end
|
488
|
+
end
|
@@ -7,34 +7,41 @@ module Cisco
|
|
7
7
|
if @platform
|
8
8
|
{ :platform => Beaker::Platform.new( @platform) }
|
9
9
|
else
|
10
|
-
{ :platform => Beaker::Platform.new( '
|
10
|
+
{ :platform => Beaker::Platform.new( 'cisco_nexus-vers-arch-extra' ) }
|
11
11
|
end
|
12
12
|
}
|
13
13
|
let(:host) { make_host( 'name', options.merge(platform) ) }
|
14
14
|
|
15
15
|
describe '#prepend_commands' do
|
16
16
|
|
17
|
-
context 'for
|
17
|
+
context 'for cisco_nexus-7' do
|
18
18
|
|
19
19
|
before :each do
|
20
|
-
@platform = '
|
20
|
+
@platform = 'cisco_nexus-7-x86_64'
|
21
21
|
end
|
22
22
|
|
23
23
|
it 'ends with the :vrf host parameter' do
|
24
24
|
vrf_answer = 'vrf_answer_135246'
|
25
|
-
@options = {
|
25
|
+
@options = {
|
26
|
+
:vrf => vrf_answer,
|
27
|
+
:user => 'notroot',
|
28
|
+
}
|
26
29
|
answer_test = host.prepend_commands( 'fake_command' )
|
27
30
|
expect( answer_test ).to match( /#{vrf_answer}$/ )
|
28
31
|
end
|
29
32
|
|
30
33
|
it 'begins with sourcing the /etc/profile script' do
|
31
34
|
answer_test = host.prepend_commands( 'fake_command' )
|
32
|
-
expect( answer_test ).to match(
|
35
|
+
expect( answer_test ).to match( 'source /etc/profile;' )
|
33
36
|
end
|
34
37
|
|
35
38
|
it 'uses sudo at the beginning of the actual command to execute' do
|
39
|
+
@options = {
|
40
|
+
:vrf => 'fakevrf',
|
41
|
+
:user => 'notroot',
|
42
|
+
}
|
36
43
|
answer_test = host.prepend_commands( 'fake_command' )
|
37
|
-
command_start_index = answer_test.index( ';
|
44
|
+
command_start_index = answer_test.index( ';' ) + 1
|
38
45
|
command_actual = answer_test[command_start_index, answer_test.length - command_start_index]
|
39
46
|
expect( command_actual ).to match( /^sudo / )
|
40
47
|
end
|
@@ -46,10 +53,10 @@ module Cisco
|
|
46
53
|
end
|
47
54
|
end
|
48
55
|
|
49
|
-
context 'for
|
56
|
+
context 'for cisco_ios_xr-6' do
|
50
57
|
|
51
58
|
before :each do
|
52
|
-
@platform = '
|
59
|
+
@platform = 'cisco_ios_xr-6-x86_64'
|
53
60
|
end
|
54
61
|
|
55
62
|
it 'begins with sourcing the /etc/profile script' do
|
@@ -62,8 +69,8 @@ module Cisco
|
|
62
69
|
expect( answer_test ).not_to match( /sudo/ )
|
63
70
|
end
|
64
71
|
|
65
|
-
it 'does
|
66
|
-
expect( host ).to receive( :[] ).with( :vrf )
|
72
|
+
it 'does prepend with the :vrf host parameter' do
|
73
|
+
expect( host ).to receive( :[] ).with( :vrf )
|
67
74
|
host.prepend_commands( 'fake_command' )
|
68
75
|
end
|
69
76
|
|
@@ -72,15 +79,15 @@ module Cisco
|
|
72
79
|
|
73
80
|
describe '#environment_string' do
|
74
81
|
|
75
|
-
it 'starts with `env` for
|
76
|
-
@platform = '
|
82
|
+
it 'starts with `env` for cisco_ios_xr-6' do
|
83
|
+
@platform = 'cisco_ios_xr-6-x86'
|
77
84
|
env_map = { 'PATH' => '/opt/pants/1' }
|
78
85
|
answer_test = host.environment_string( env_map )
|
79
86
|
expect( answer_test ).to match( /^env\ / )
|
80
87
|
end
|
81
88
|
|
82
|
-
it 'starts with `export` for
|
83
|
-
@platform = '
|
89
|
+
it 'starts with `export` for cisco_nexus-7' do
|
90
|
+
@platform = 'cisco_nexus-7-x86_64'
|
84
91
|
env_map = { 'PATH' => '/opt/pants/2' }
|
85
92
|
answer_test = host.environment_string( env_map )
|
86
93
|
expect( answer_test ).to match( /^export\ / )
|
@@ -93,7 +100,7 @@ module Cisco
|
|
93
100
|
end
|
94
101
|
|
95
102
|
it 'turns env maps into paired strings correctly' do
|
96
|
-
@platform = '
|
103
|
+
@platform = 'cisco_ios_xr-6-x86_64'
|
97
104
|
env_map = { 'var1' => 'ans1', 'var2' => 'ans2' }
|
98
105
|
answer_correct = 'env VAR1="ans1" VAR2="ans2";'
|
99
106
|
answer_test = host.environment_string( env_map )
|
@@ -104,7 +111,7 @@ module Cisco
|
|
104
111
|
describe '#package_config_dir' do
|
105
112
|
|
106
113
|
it 'returns correctly for cisco platforms' do
|
107
|
-
@platform = '
|
114
|
+
@platform = 'cisco_nexus-7-x86_64'
|
108
115
|
expect( host.package_config_dir ).to be === '/etc/yum/repos.d/'
|
109
116
|
end
|
110
117
|
end
|
@@ -112,16 +119,16 @@ module Cisco
|
|
112
119
|
describe '#repo_type' do
|
113
120
|
|
114
121
|
it 'returns correctly for cisco platforms' do
|
115
|
-
@platform = '
|
122
|
+
@platform = 'cisco_nexus-7-x86_64'
|
116
123
|
expect( host.repo_type ).to be === 'rpm'
|
117
124
|
end
|
118
125
|
end
|
119
126
|
|
120
127
|
describe '#validate_setup' do
|
121
128
|
|
122
|
-
context 'on the
|
129
|
+
context 'on the cisco_nexus-7 platform' do
|
123
130
|
before :each do
|
124
|
-
@platform = '
|
131
|
+
@platform = 'cisco_nexus-7-x86_64'
|
125
132
|
end
|
126
133
|
|
127
134
|
it 'errors when no :vrf value is provided' do
|
@@ -130,10 +137,10 @@ module Cisco
|
|
130
137
|
}.to raise_error( ArgumentError, /provided\ with\ a\ \:vrf\ value/ )
|
131
138
|
end
|
132
139
|
|
133
|
-
it 'errors when no user is provided' do
|
140
|
+
it 'errors when no :user value is provided' do
|
134
141
|
@options = {
|
135
142
|
:vrf => 'fake_vrf',
|
136
|
-
:user =>
|
143
|
+
:user => nil,
|
137
144
|
}
|
138
145
|
expect {
|
139
146
|
host.validate_setup
|
@@ -150,29 +157,34 @@ module Cisco
|
|
150
157
|
end
|
151
158
|
end
|
152
159
|
|
153
|
-
context 'on the
|
160
|
+
context 'on the cisco_ios_xr-6 platform' do
|
154
161
|
before :each do
|
155
|
-
@platform = '
|
162
|
+
@platform = 'cisco_ios_xr-6-x86_64'
|
156
163
|
end
|
157
164
|
|
158
|
-
it '
|
159
|
-
|
160
|
-
|
161
|
-
}
|
165
|
+
it 'does nothing if no :vrf value is provided' do
|
166
|
+
@options = {
|
167
|
+
:user => 'notroot',
|
168
|
+
}
|
169
|
+
validate_test = host.validate_setup
|
170
|
+
expect( validate_test ).to be_nil
|
162
171
|
end
|
163
172
|
|
164
|
-
it '
|
173
|
+
it 'errors when no user is provided' do
|
165
174
|
@options = {
|
166
175
|
:vrf => 'fake_vrf',
|
167
|
-
:user =>
|
176
|
+
:user => nil,
|
168
177
|
}
|
169
178
|
expect {
|
170
179
|
host.validate_setup
|
171
|
-
}.
|
180
|
+
}.to raise_error( ArgumentError, /provided\ with\ a\ \:user\ value/ )
|
172
181
|
end
|
173
182
|
|
174
183
|
it 'does nothing if the host is setup correctly' do
|
175
|
-
@options = {
|
184
|
+
@options = {
|
185
|
+
:vrf => 'fake_vrf',
|
186
|
+
:user => 'notroot',
|
187
|
+
}
|
176
188
|
validate_test = host.validate_setup
|
177
189
|
expect( validate_test ).to be_nil
|
178
190
|
end
|
@@ -115,7 +115,7 @@ module Beaker
|
|
115
115
|
end
|
116
116
|
|
117
117
|
it 'adds wrlinux to variant on cisco platforms' do
|
118
|
-
@platform = '
|
118
|
+
@platform = 'cisco_nexus-7-x86_64'
|
119
119
|
allow( instance ).to receive( :is_pe? ) { false }
|
120
120
|
filename = instance.repo_filename( 'pkg_name', 'pkg_version12' )
|
121
121
|
expect( filename ).to match( /sion12\-cisco\-wrlinux\-/ )
|
@@ -227,7 +227,7 @@ module Unix
|
|
227
227
|
|
228
228
|
describe '#validate_setup' do
|
229
229
|
|
230
|
-
it 'does nothing for non
|
230
|
+
it 'does nothing for non cisco_nexus-7 platforms' do
|
231
231
|
@platform = 'el-7-x86_64'
|
232
232
|
validate_test = host.validate_setup
|
233
233
|
expect( validate_test ).to be_nil
|
@@ -413,7 +413,7 @@ describe Beaker do
|
|
413
413
|
end
|
414
414
|
|
415
415
|
it 'skips validation on cisco hosts' do
|
416
|
-
@platform = '
|
416
|
+
@platform = 'cisco_nexus-7-x86_64'
|
417
417
|
expect( subject ).to receive( :check_and_install_packages_if_needed ).never
|
418
418
|
subject.validate_host(hosts, options)
|
419
419
|
end
|
@@ -588,7 +588,7 @@ describe Beaker do
|
|
588
588
|
|
589
589
|
it 'skips a cisco host correctly' do
|
590
590
|
host = make_host('name', {
|
591
|
-
:platform => '
|
591
|
+
:platform => 'cisco_nexus-7-x86_64',
|
592
592
|
:ssh_env_file => 'ssh_env_file',
|
593
593
|
:is_cygwin => true,
|
594
594
|
} )
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: beaker
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.37.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Puppetlabs
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-03-
|
11
|
+
date: 2016-03-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
@@ -535,6 +535,7 @@ files:
|
|
535
535
|
- acceptance/tests/base/dsl/helpers/host_helpers/shell_test.rb
|
536
536
|
- acceptance/tests/base/dsl/helpers/host_helpers/upgrade_package_test.rb
|
537
537
|
- acceptance/tests/base/dsl/install_utils/clone_git_repo_on_test.rb
|
538
|
+
- acceptance/tests/base/dsl/platform_tag_confiner_test.rb
|
538
539
|
- acceptance/tests/base/dsl/structure_test.rb
|
539
540
|
- acceptance/tests/base/host_prebuilt_steps/ssh_environment_test.rb
|
540
541
|
- acceptance/tests/base/host_test.rb
|
@@ -576,6 +577,7 @@ files:
|
|
576
577
|
- docs/VMWare-Fusion-Support.md
|
577
578
|
- docs/Vagrant-Support.md
|
578
579
|
- docs/beaker-vs.-beaker-rspec.md
|
580
|
+
- docs/dsl/platform_specific_tag_confines.md
|
579
581
|
- docs/hosts/README.md
|
580
582
|
- docs/hosts/cisco.md
|
581
583
|
- docs/hosts/eos.md
|