beaker 3.11.0 → 3.12.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/acceptance/tests/subcommands/init.rb +1 -2
- data/lib/beaker/dsl/helpers/puppet_helpers.rb +11 -2
- data/lib/beaker/dsl/install_utils/foss_utils.rb +6 -1
- data/lib/beaker/subcommand.rb +7 -2
- data/lib/beaker/subcommands/subcommand_util.rb +17 -10
- data/lib/beaker/version.rb +1 -1
- data/spec/beaker/dsl/helpers/puppet_helpers_spec.rb +21 -0
- data/spec/beaker/dsl/install_utils/foss_utils_spec.rb +25 -0
- data/spec/beaker/subcommand/subcommand_util_spec.rb +0 -34
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
MGJkNWQ2MjM2NzVmMjFiMzIzNDUwMzBhNGRkMDUzMzFlNjk1ZTk2OA==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
MTVlOGIwNTBlNmRmOTgyMjc1YzBkZWE3NzU3YzIxZTBmNjc5YWIyMA==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
MDhiOTc5ZWQyMDA3NWE4MmM4ZjA4MTMwOWJkODg1ZjA3N2Q1Mzk4YmEyNzIw
|
10
|
+
OWVhYzE3OTI2YTFiZDkxNmIzNzA2YzI4YWQ5ZTA0YzMzNTk0ZGJhMDU0NzFm
|
11
|
+
OTJkYmFiZjk3NzVhNTVjZGE0ZjY1Yzc3MGYxNjdjYzdhMzE4NGM=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
NWYyYTNiYzgxMGY3OWIxNWMzNGViMTBlYmIyODI4MGQ3MmFiNzYzMTQzZTg3
|
14
|
+
NzQ5ZGJlZDExZDU0Yzc3OTY5M2RkMmEyYzQ5NDU4ZDVhM2M1Y2ExOThmMjQ5
|
15
|
+
NDQyNGIxOTA1YWE0YWVkMWRjMDUyY2RmMDlhZjhlYTU1ZmY1MTQ=
|
@@ -20,7 +20,7 @@ test_name 'use the init subcommand' do
|
|
20
20
|
|
21
21
|
['vmpooler', 'vagrant'].each do |hypervisor|
|
22
22
|
result = on(default, "beaker init --hypervisor=#{hypervisor}")
|
23
|
-
assert_match(/Writing
|
23
|
+
assert_match(/Writing host config.+/, result.stdout)
|
24
24
|
assert_equal(0, result.exit_code, "`beaker init --hypervisor=#{hypervisor}` should return a zero exit code")
|
25
25
|
step 'ensure that the Rakefile is present' do
|
26
26
|
on(default, '[ -e "Rakefile" ]')
|
@@ -44,4 +44,3 @@ test_name 'use the init subcommand' do
|
|
44
44
|
assert(result.stdout.include?("require 'tempfile'"), 'Rakefile should not contain prepended require')
|
45
45
|
end
|
46
46
|
end
|
47
|
-
|
@@ -676,9 +676,18 @@ module Beaker
|
|
676
676
|
def sleep_until_puppetdb_started(host, nonssl_port = nil, ssl_port = nil)
|
677
677
|
nonssl_port = options[:puppetdb_port_nonssl] if nonssl_port.nil?
|
678
678
|
ssl_port = options[:puppetdb_port_ssl] if ssl_port.nil?
|
679
|
-
|
679
|
+
pe_ver = host['pe_ver'] || '0'
|
680
|
+
if version_is_less(pe_ver, '2016.1.0') then
|
681
|
+
# the status endpoint was introduced in puppetdb 4.0. The earliest
|
682
|
+
# PE release with the 4.x pdb version was 2016.1.0
|
683
|
+
endpoint = 'pdb/meta/v1/version'
|
684
|
+
expected_regex = '\"version\" \{0,\}: \{0,\}\"[0-9]\{1,\}\.[0-9]\{1,\}\.[0-9]\{1,\}\"'
|
685
|
+
else
|
686
|
+
endpoint = 'status/v1/services/puppetdb-status'
|
687
|
+
expected_regex = '\"state\" \{0,\}: \{0,\}\"running\"'
|
688
|
+
end
|
680
689
|
retry_on(host,
|
681
|
-
"curl -m 1 http://localhost:#{nonssl_port}/#{endpoint} | grep '
|
690
|
+
"curl -m 1 http://localhost:#{nonssl_port}/#{endpoint} | grep '#{expected_regex}'",
|
682
691
|
{:max_retries => 120})
|
683
692
|
curl_with_retries("start puppetdb (ssl)",
|
684
693
|
host, "https://#{host.node_name}:#{ssl_port}", [35, 60])
|
@@ -436,7 +436,11 @@ module Beaker
|
|
436
436
|
# @api private
|
437
437
|
def install_puppet_from_rpm_on( hosts, opts )
|
438
438
|
block_on hosts do |host|
|
439
|
-
|
439
|
+
if host[:type] == 'aio'
|
440
|
+
install_puppetlabs_release_repo(host,'pc1',opts)
|
441
|
+
else
|
442
|
+
install_puppetlabs_release_repo(host,nil,opts)
|
443
|
+
end
|
440
444
|
|
441
445
|
if opts[:facter_version]
|
442
446
|
host.install_package("facter-#{opts[:facter_version]}")
|
@@ -922,6 +926,7 @@ module Beaker
|
|
922
926
|
# cisco ios xr requires using yum to localinstall the repo
|
923
927
|
on host, "yum -y localinstall #{remote}"
|
924
928
|
else
|
929
|
+
opts[:package_proxy] ||= false
|
925
930
|
host.install_package_with_rpm( remote, '--replacepkgs',
|
926
931
|
{ :package_proxy => opts[:package_proxy] } )
|
927
932
|
end
|
data/lib/beaker/subcommand.rb
CHANGED
@@ -7,14 +7,19 @@ module Beaker
|
|
7
7
|
SubcommandUtil = Beaker::Subcommands::SubcommandUtil
|
8
8
|
|
9
9
|
desc "init", "Initialises the beaker test environment configuration"
|
10
|
-
option :hypervisor, :type => :string, :
|
10
|
+
option :hypervisor, :type => :string, :enum => %w{vagrant vmpooler}
|
11
|
+
option :help, :type => :boolean, :hide => true
|
11
12
|
long_desc <<-LONGDESC
|
12
13
|
Initialises a beaker environment configuration
|
13
14
|
LONGDESC
|
14
15
|
def init()
|
15
|
-
|
16
|
+
if options[:help]
|
17
|
+
invoke :help, [], ["init"]
|
18
|
+
return
|
19
|
+
end
|
16
20
|
SubcommandUtil.require_tasks()
|
17
21
|
SubcommandUtil.init_hypervisor(options)
|
22
|
+
say "Writing host config to .beaker/acceptance/config/default_#{options[:hypervisor]}_hosts.yaml"
|
18
23
|
end
|
19
24
|
end
|
20
25
|
end
|
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'rake'
|
2
|
+
require 'stringio'
|
2
3
|
|
3
4
|
module Beaker
|
4
5
|
module Subcommands
|
@@ -12,8 +13,8 @@ module Beaker
|
|
12
13
|
# - execute the vagrant quickstart task
|
13
14
|
# - execute the vmpooler quickstart task
|
14
15
|
# - exit with a specific message
|
15
|
-
# - verify that the init subcommand has the correct arguments
|
16
16
|
# - execute the quick start task for the specified hypervisor
|
17
|
+
# - capture stdout and stderr
|
17
18
|
module SubcommandUtil
|
18
19
|
BEAKER_REQUIRE = "require 'beaker/tasks/quick_start'"
|
19
20
|
HYPERVISORS = ["vagrant", "vmpooler"]
|
@@ -72,7 +73,7 @@ module Beaker
|
|
72
73
|
# @param [String] task the rake task to execute
|
73
74
|
def self.execute_rake_task(task)
|
74
75
|
rake_app.load_rakefile()
|
75
|
-
rake_app.invoke_task(task)
|
76
|
+
with_captured_output { rake_app.invoke_task(task) }
|
76
77
|
end
|
77
78
|
|
78
79
|
# Execute the quick start task for vagrant
|
@@ -92,14 +93,6 @@ module Beaker
|
|
92
93
|
exit(0)
|
93
94
|
end
|
94
95
|
|
95
|
-
# Verify that a valid hypervisor has been specified
|
96
|
-
# @param [Array<Object>] options the options we want to query
|
97
|
-
def self.verify_init_args(options)
|
98
|
-
unless HYPERVISORS.include?(options[:hypervisor])
|
99
|
-
exit_with("Invalid hypervisor. Currently supported hypervisors are: #{HYPERVISORS.join(', ')}")
|
100
|
-
end
|
101
|
-
end
|
102
|
-
|
103
96
|
# Call the quick start task for the specified hypervisor
|
104
97
|
# @param [Array<Object>] options the options we want to query
|
105
98
|
def self.init_hypervisor(options)
|
@@ -110,6 +103,20 @@ module Beaker
|
|
110
103
|
init_vmpooler
|
111
104
|
end
|
112
105
|
end
|
106
|
+
|
107
|
+
# Execute a task but capture stdout and stderr to a buffer
|
108
|
+
def self.with_captured_output
|
109
|
+
begin
|
110
|
+
old_stdout = $stdout.clone
|
111
|
+
old_stderr = $stderr.clone
|
112
|
+
$stdout = StringIO.new
|
113
|
+
$stderr = StringIO.new
|
114
|
+
yield
|
115
|
+
ensure
|
116
|
+
$stdout = old_stdout
|
117
|
+
$stderr = old_stderr
|
118
|
+
end
|
119
|
+
end
|
113
120
|
end
|
114
121
|
end
|
115
122
|
end
|
data/lib/beaker/version.rb
CHANGED
@@ -1115,6 +1115,27 @@ describe ClassMixedWithDSLHelpers do
|
|
1115
1115
|
expect( subject ).to receive( :curl_with_retries ).with( anything(), anything(), /8085/, anything() ).once.ordered
|
1116
1116
|
subject.sleep_until_puppetdb_started( host, nil, 8085 )
|
1117
1117
|
end
|
1118
|
+
|
1119
|
+
context 'when pe_ver is less than 2016.1.0' do
|
1120
|
+
it 'uses the version endpoint' do
|
1121
|
+
host = hosts[0]
|
1122
|
+
host['pe_ver'] = '2015.3.3'
|
1123
|
+
expect( subject ).to receive( :retry_on ).with( anything(), /pdb\/meta\/v1\/version/, anything() ).once.ordered
|
1124
|
+
expect( subject ).to receive( :curl_with_retries ).with( anything(), anything(), /8081/, anything() ).once.ordered
|
1125
|
+
subject.sleep_until_puppetdb_started( host )
|
1126
|
+
end
|
1127
|
+
end
|
1128
|
+
|
1129
|
+
context 'when pe_ver is greater than 2015.9.9' do
|
1130
|
+
it 'uses the status endpoint' do
|
1131
|
+
host = hosts[0]
|
1132
|
+
host['pe_ver'] = '2016.1.0'
|
1133
|
+
expect( subject ).to receive( :retry_on ).with( anything(), /status\/v1\/services\/puppetdb-status/, anything() ).once.ordered
|
1134
|
+
expect( subject ).to receive( :curl_with_retries ).with( anything(), anything(), /8081/, anything() ).once.ordered
|
1135
|
+
subject.sleep_until_puppetdb_started( host )
|
1136
|
+
end
|
1137
|
+
end
|
1138
|
+
|
1118
1139
|
end
|
1119
1140
|
|
1120
1141
|
describe '#sleep_until_puppetserver_started' do
|
@@ -57,6 +57,17 @@ describe ClassMixedWithDSLInstallUtils do
|
|
57
57
|
:working_dir => '/tmp',
|
58
58
|
:type => 'foss',
|
59
59
|
:dist => 'puppet-enterprise-3.7.1-rc0-78-gffc958f-eos-4-i386' } ) }
|
60
|
+
let(:el6hostaio) { make_host( 'el6hostaio', { :platform => Beaker::Platform.new('el-6-i386'),
|
61
|
+
:pe_ver => '3.0',
|
62
|
+
:working_dir => '/tmp',
|
63
|
+
:type => 'aio',
|
64
|
+
:dist => 'puppet-enterprise-3.1.0-rc0-230-g36c9e5c-centos-6-i386' } ) }
|
65
|
+
let(:el6hostfoss) { make_host( 'el6hostfoss', { :platform => Beaker::Platform.new('el-6-i386'),
|
66
|
+
:pe_ver => '3.0',
|
67
|
+
:working_dir => '/tmp',
|
68
|
+
:type => 'foss',
|
69
|
+
:dist => 'puppet-enterprise-3.1.0-rc0-230-g36c9e5c-centos-6-i386' } ) }
|
70
|
+
|
60
71
|
let(:win_temp) { 'C:\\Windows\\Temp' }
|
61
72
|
|
62
73
|
|
@@ -257,6 +268,20 @@ describe ClassMixedWithDSLInstallUtils do
|
|
257
268
|
end
|
258
269
|
end
|
259
270
|
|
271
|
+
context 'install_puppet_from_rpm_on' do
|
272
|
+
it 'installs PC1 release repo when AIO' do
|
273
|
+
expect(subject).to receive(:install_puppetlabs_release_repo).with(el6hostaio,'pc1',{})
|
274
|
+
|
275
|
+
subject.install_puppet_from_rpm_on( el6hostaio, {} )
|
276
|
+
end
|
277
|
+
|
278
|
+
it 'installs non-PC1 package when not-AIO' do
|
279
|
+
expect(subject).to receive(:install_puppetlabs_release_repo).with(el6hostfoss,nil,{})
|
280
|
+
|
281
|
+
subject.install_puppet_from_rpm_on( el6hostfoss, {} )
|
282
|
+
end
|
283
|
+
end
|
284
|
+
|
260
285
|
context 'install_puppet_from_freebsd_ports_on' do
|
261
286
|
it 'installs puppet on FreeBSD 9' do
|
262
287
|
expect(freebsdhost9).to receive(:install_package).with('puppet')
|
@@ -108,40 +108,6 @@ module Beaker
|
|
108
108
|
end
|
109
109
|
end
|
110
110
|
|
111
|
-
describe 'verify_init_args' do
|
112
|
-
it "verfy the init args are valid for a vagrant run" do
|
113
|
-
options = {:hypervisor => "vagrant"}
|
114
|
-
expect(subject).to receive(:exit_with).exactly(0).times
|
115
|
-
subject.verify_init_args(options)
|
116
|
-
end
|
117
|
-
|
118
|
-
it "verfy the init args are valid for a vmpooler run" do
|
119
|
-
options = {:hypervisor => "vmpooler"}
|
120
|
-
expect(subject).to receive(:exit_with).exactly(0).times
|
121
|
-
subject.verify_init_args(options)
|
122
|
-
end
|
123
|
-
|
124
|
-
it "verify the init args are invalid for an init run" do
|
125
|
-
options = {}
|
126
|
-
expect(STDOUT).to receive(:puts).with("Invalid hypervisor. Currently supported hypervisors are: #{Beaker::Subcommands::SubcommandUtil::HYPERVISORS.join(', ')}").exactly(1).times
|
127
|
-
begin
|
128
|
-
subject.verify_init_args(options)
|
129
|
-
rescue SystemExit=>e
|
130
|
-
expect(e.status).to eq(0)
|
131
|
-
end
|
132
|
-
end
|
133
|
-
|
134
|
-
it "verify the init args are invalid for a vmpooler run" do
|
135
|
-
options = {:hypervisor => "thisshouldfail"}
|
136
|
-
expect(STDOUT).to receive(:puts).with("Invalid hypervisor. Currently supported hypervisors are: #{Beaker::Subcommands::SubcommandUtil::HYPERVISORS.join(', ')}").exactly(1).times
|
137
|
-
begin
|
138
|
-
subject.verify_init_args(options)
|
139
|
-
rescue SystemExit=>e
|
140
|
-
expect(e.status).to eq(0)
|
141
|
-
end
|
142
|
-
end
|
143
|
-
end
|
144
|
-
|
145
111
|
describe "determine_rake_file" do
|
146
112
|
|
147
113
|
it "uses Rakefile if no rakefile exists" do
|
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: 3.
|
4
|
+
version: 3.12.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Puppetlabs
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-03-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|