beaker 2.27.0 → 2.28.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/HISTORY.md +378 -2
- data/README.md +1 -3
- data/acceptance/config/acceptance-options.rb +3 -0
- data/acceptance/fixtures/files/failing_shell_script.txt +3 -0
- data/acceptance/fixtures/files/retry_script.txt +14 -0
- data/acceptance/fixtures/files/shell_script_with_output.txt +3 -0
- data/acceptance/fixtures/files/simple_text_file.txt +3 -0
- data/acceptance/fixtures/files/sles-11-x86_64.repo +5 -0
- data/acceptance/lib/helpers/test_helper.rb +111 -0
- data/acceptance/tests/base/dsl/helpers/configuration_test.rb +17 -0
- data/acceptance/tests/base/dsl/helpers/host_helpers/add_system32_hosts_entry_test.rb +50 -0
- data/acceptance/tests/base/dsl/helpers/host_helpers/backup_the_file_test.rb +64 -0
- data/acceptance/tests/base/dsl/helpers/host_helpers/check_for_package_test.rb +100 -0
- data/acceptance/tests/base/dsl/helpers/host_helpers/create_remote_file_test.rb +201 -0
- data/acceptance/tests/base/dsl/helpers/host_helpers/create_tmpdir_on_test.rb +68 -0
- data/acceptance/tests/base/dsl/helpers/host_helpers/curl_on_test.rb +48 -0
- data/acceptance/tests/base/dsl/helpers/host_helpers/curl_with_retries_test.rb +28 -0
- data/acceptance/tests/base/dsl/helpers/host_helpers/deploy_package_repo_test.rb +142 -0
- data/acceptance/tests/base/dsl/helpers/host_helpers/echo_on_test.rb +13 -0
- data/acceptance/tests/base/dsl/helpers/host_helpers/install_package_test.rb +67 -0
- data/acceptance/tests/base/dsl/helpers/host_helpers/on_test.rb +109 -0
- data/acceptance/tests/base/dsl/helpers/host_helpers/retry_on_test.rb +42 -0
- data/acceptance/tests/base/dsl/helpers/host_helpers/rsync_to_test.rb +143 -0
- data/acceptance/tests/base/dsl/helpers/host_helpers/run_cron_on_test.rb +242 -0
- data/acceptance/tests/base/dsl/helpers/host_helpers/run_script_on_test.rb +69 -0
- data/acceptance/tests/base/dsl/helpers/host_helpers/run_script_test.rb +53 -0
- data/acceptance/tests/base/dsl/helpers/host_helpers/scp_from_test.rb +53 -0
- data/acceptance/tests/base/dsl/helpers/host_helpers/scp_to_test.rb +54 -0
- data/acceptance/tests/base/dsl/helpers/host_helpers/shell_test.rb +51 -0
- data/acceptance/tests/base/dsl/helpers/host_helpers/upgrade_package_test.rb +92 -0
- data/acceptance/tests/base/dsl/install_utils/clone_git_repo_on_test.rb +47 -0
- data/acceptance/tests/base/{host.rb → host_test.rb} +2 -0
- data/acceptance/tests/hypervisor/{communication.rb → communication_test.rb} +0 -0
- data/acceptance/tests/load_path_bootstrap.rb +10 -0
- data/acceptance/tests/puppet/{install_smoke.rb → install_smoke_test.rb} +0 -0
- data/beaker.gemspec +1 -1
- data/docs/Access-the-Live-Test-Console-with-Pry.md +305 -0
- data/docs/Argument-Processing-and-Precedence.md +325 -0
- data/docs/Beaker-Installation.md +59 -0
- data/docs/Beaker-Owners-and-Reviewers.md +16 -0
- data/docs/Beaker-Test-Tagging.md +76 -0
- data/docs/Beaker-with-Masterless-Puppet.md +42 -0
- data/docs/Creating-A-Test-Environment.md +91 -0
- data/docs/Docker-Support.md +129 -0
- data/docs/EC2-Support.md +77 -0
- data/docs/Example-Vagrant-Hosts-Files.md +66 -0
- data/docs/File-a-Beaker-Bug.md +3 -0
- data/docs/Google-Compute-Engine-Support.md +41 -0
- data/docs/How-To-Beaker.md +7 -0
- data/docs/How-To-Use-User-Password-Authentication-with-Beaker.md +53 -0
- data/docs/How-to-Write-a-Beaker-Test-for-a-Module.md +145 -0
- data/docs/Lets-Write-a-Test.md +73 -0
- data/docs/Openstack-Support.md +32 -0
- data/docs/Overview.md +31 -0
- data/docs/README.md +43 -0
- data/docs/Roles-What-Are-They.md +44 -0
- data/docs/Shared-Options-for-Executing-Beaker-Commands.md +43 -0
- data/docs/Solaris-Support.md +10 -0
- data/docs/The-Beaker-DSL.md +283 -0
- data/docs/The-Command-Line.md +24 -0
- data/docs/Types,-Puppet-4,-and-the-All-In-One-Agent.md +13 -0
- data/docs/VMWare-Fusion-Support.md +36 -0
- data/docs/Vagrant-Support.md +47 -0
- data/docs/beaker-vs.-beaker-rspec.md +87 -0
- data/docs/hosts/README.md +8 -0
- data/docs/hosts/eos.md +30 -0
- data/docs/hypervisors/README.md +8 -0
- data/docs/hypervisors/aws.md +143 -0
- data/docs/vSphere-Support.md +46 -0
- data/lib/beaker/dsl/helpers/host_helpers.rb +2 -4
- data/lib/beaker/dsl/helpers/puppet_helpers.rb +45 -11
- data/lib/beaker/dsl/install_utils/foss_utils.rb +20 -23
- data/lib/beaker/dsl/install_utils/module_utils.rb +4 -0
- data/lib/beaker/dsl/install_utils/pe_utils.rb +2 -6
- data/lib/beaker/dsl/patterns.rb +1 -1
- data/lib/beaker/host.rb +3 -0
- data/lib/beaker/host/eos.rb +56 -0
- data/lib/beaker/host/mac/pkg.rb +1 -1
- data/lib/beaker/host/unix/pkg.rb +36 -0
- data/lib/beaker/hypervisor/aws_sdk.rb +1 -1
- data/lib/beaker/hypervisor/vagrant.rb +3 -3
- data/lib/beaker/logger.rb +1 -0
- data/lib/beaker/options/presets.rb +5 -0
- data/lib/beaker/shared/host_manager.rb +7 -4
- data/lib/beaker/version.rb +1 -1
- data/spec/beaker/dsl/helpers/puppet_helpers_spec.rb +87 -0
- data/spec/beaker/dsl/install_utils/foss_utils_spec.rb +53 -20
- data/spec/beaker/dsl/install_utils/module_utils_spec.rb +1 -1
- data/spec/beaker/dsl/install_utils/pe_utils_spec.rb +7 -14
- data/spec/beaker/host/eos_spec.rb +65 -0
- data/spec/beaker/host/unix/pkg_spec.rb +42 -0
- data/spec/beaker/hypervisor/aws_sdk_spec.rb +17 -56
- data/spec/beaker/hypervisor/vagrant_spec.rb +1 -1
- data/spec/beaker/logger_spec.rb +1 -1
- data/spec/mocks.rb +0 -13
- metadata +76 -6
- data/acceptance/tests/dsl/install_utils/clone_git_repo_on.rb +0 -50
@@ -133,8 +133,12 @@ module Beaker
|
|
133
133
|
#move to the host
|
134
134
|
logger.debug "Using scp to transfer #{source_path} to #{target_path}"
|
135
135
|
scp_to host, source_path, target_module_dir, {:ignore => ignore_list}
|
136
|
+
|
136
137
|
#rename to the selected module name, if not correct
|
137
138
|
cur_path = File.join(target_module_dir, source_name)
|
139
|
+
if host.is_powershell? #make sure our slashes are correct
|
140
|
+
cur_path = cur_path.gsub(/\//,'\\')
|
141
|
+
end
|
138
142
|
host.mv cur_path, target_path unless cur_path == target_path
|
139
143
|
when 'rsync'
|
140
144
|
logger.debug "Using rsync to transfer #{source_path} to #{target_path}"
|
@@ -102,9 +102,7 @@ module Beaker
|
|
102
102
|
pe_debug = host[:pe_debug] || opts[:pe_debug] ? ' -verboseR' : ''
|
103
103
|
"cd #{host['working_dir']} && hdiutil attach #{host['dist']}.dmg && installer#{pe_debug} -pkg /Volumes/puppet-enterprise-#{version}/puppet-enterprise-installer-#{version}.pkg -target /"
|
104
104
|
elsif host['platform'] =~ /eos/
|
105
|
-
|
106
|
-
command = commands.join("\n")
|
107
|
-
"Cli -c '#{command}'"
|
105
|
+
host.install_from_file("puppet-enterprise-#{version}-#{host['platform']}.swix")
|
108
106
|
else
|
109
107
|
pe_debug = host[:pe_debug] || opts[:pe_debug] ? ' -D' : ''
|
110
108
|
"cd #{host['working_dir']}/#{host['dist']} && ./#{host['pe_installer']}#{pe_debug} -a #{host['working_dir']}/answers"
|
@@ -218,9 +216,7 @@ module Beaker
|
|
218
216
|
end
|
219
217
|
|
220
218
|
if host['platform'] =~ /eos/
|
221
|
-
|
222
|
-
command = commands.join("\n")
|
223
|
-
on host, "Cli -c '#{command}'"
|
219
|
+
host.get_remote_file("#{path}/#{filename}#{extension}")
|
224
220
|
else
|
225
221
|
unpack = 'tar -xvf -'
|
226
222
|
unpack = extension =~ /gz/ ? 'gunzip | ' + unpack : unpack
|
data/lib/beaker/dsl/patterns.rb
CHANGED
@@ -19,7 +19,7 @@ module Beaker
|
|
19
19
|
# or Array<{Host}> to run the block against
|
20
20
|
# @param [Block] block This method will yield to a block of code passed by the caller
|
21
21
|
#
|
22
|
-
# @return [Array<Result>, Result] An array of results,
|
22
|
+
# @return [Array<Result>, Result, nil] An array of results, a result object, or nil.
|
23
23
|
# Check {#run_block_on} for more details on this.
|
24
24
|
def block_on hosts_or_filter, &block
|
25
25
|
block_hosts = nil
|
data/lib/beaker/host.rb
CHANGED
@@ -49,6 +49,8 @@ module Beaker
|
|
49
49
|
Mac::Host.new name, host_hash, options
|
50
50
|
when /freebsd/
|
51
51
|
FreeBSD::Host.new name, host_hash, options
|
52
|
+
when /eos/
|
53
|
+
Eos::Host.new name, host_hash, options
|
52
54
|
else
|
53
55
|
Unix::Host.new name, host_hash, options
|
54
56
|
end
|
@@ -499,6 +501,7 @@ module Beaker
|
|
499
501
|
'freebsd',
|
500
502
|
'windows',
|
501
503
|
'pswindows',
|
504
|
+
'eos',
|
502
505
|
].each do |lib|
|
503
506
|
require "beaker/host/#{lib}"
|
504
507
|
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
[ 'host', 'command_factory' ].each do |lib|
|
2
|
+
require "beaker/#{lib}"
|
3
|
+
end
|
4
|
+
|
5
|
+
module Eos
|
6
|
+
class Host < Unix::Host
|
7
|
+
|
8
|
+
# Gets the path & file name for the puppet agent package on EOS
|
9
|
+
#
|
10
|
+
# @param [String] puppet_collection Name of the puppet collection to use
|
11
|
+
# @param [String] puppet_agent_version Version of puppet agent to get
|
12
|
+
# @param [Hash{Symbol=>String}] opts Options hash to provide extra values
|
13
|
+
#
|
14
|
+
# @raise [ArgumentError] If one of the two required parameters (puppet_collection,
|
15
|
+
# puppet_agent_version) is either not passed or set to nil
|
16
|
+
#
|
17
|
+
# @return [String, String] Path to the directory and filename of the package, respectively
|
18
|
+
def get_puppet_agent_package_info( puppet_collection = nil, puppet_agent_version = nil, opts = {} )
|
19
|
+
error_message = "Must provide %s argument to get puppet agent package information"
|
20
|
+
raise ArgumentError, error_message % "puppet_collection" unless puppet_collection
|
21
|
+
raise ArgumentError, error_message % "puppet_agent_version" unless puppet_agent_version
|
22
|
+
|
23
|
+
variant, version, arch, _ = self['platform'].to_array
|
24
|
+
release_path = "#{variant}/#{version}/#{puppet_collection}/#{arch}"
|
25
|
+
release_file = "puppet-agent-#{puppet_agent_version}-1.#{variant}#{version}.#{arch}.swix"
|
26
|
+
return release_path, release_file
|
27
|
+
end
|
28
|
+
|
29
|
+
# Copies a remote file to the host location specified
|
30
|
+
#
|
31
|
+
# @param [String] remote_url URL to the remote file
|
32
|
+
# @param [String] host_directory Path to the host directory on the host.
|
33
|
+
#
|
34
|
+
# @note in EOS, you just copy the file as an extension, you don't worry
|
35
|
+
# about location, so that parameter is ignored
|
36
|
+
#
|
37
|
+
# @return [Result] The result of copying that file to the host
|
38
|
+
def get_remote_file( remote_url, host_directory = '' )
|
39
|
+
commands = ['enable', "copy #{remote_url} extension:"]
|
40
|
+
command = commands.join("\n")
|
41
|
+
execute("Cli -c '#{command}'")
|
42
|
+
end
|
43
|
+
|
44
|
+
# Installs an extension file already copied via {#get_remote_file} or something similar
|
45
|
+
#
|
46
|
+
# @param [String] filename Name of the file to install, including file extension
|
47
|
+
#
|
48
|
+
# @return [Result] The result of running the install command on the host
|
49
|
+
def install_from_file( filename )
|
50
|
+
commands = ['enable', "extension #{filename}"]
|
51
|
+
command = commands.join("\n")
|
52
|
+
execute("Cli -c '#{command}'")
|
53
|
+
end
|
54
|
+
|
55
|
+
end
|
56
|
+
end
|
data/lib/beaker/host/mac/pkg.rb
CHANGED
@@ -11,7 +11,7 @@ module Mac::Pkg
|
|
11
11
|
end
|
12
12
|
|
13
13
|
def uninstall_package(name, cmdline_args = '')
|
14
|
-
raise "Package #{name} cannot be
|
14
|
+
raise "Package #{name} cannot be uninstalled on #{self}"
|
15
15
|
end
|
16
16
|
|
17
17
|
# Upgrade an installed package to the latest available version
|
data/lib/beaker/host/unix/pkg.rb
CHANGED
@@ -120,6 +120,24 @@ module Unix::Pkg
|
|
120
120
|
end
|
121
121
|
end
|
122
122
|
|
123
|
+
# Install a package using RPM
|
124
|
+
#
|
125
|
+
# @param [String] name The name of the package to install. It
|
126
|
+
# may be a filename or a URL.
|
127
|
+
# @param [String] cmdline_args Additional command line arguments for
|
128
|
+
# the package manager.
|
129
|
+
# @option opts [String] :package_proxy A proxy of form http://host:port
|
130
|
+
#
|
131
|
+
# @return nil
|
132
|
+
# @api public
|
133
|
+
def install_package_with_rpm(name, cmdline_args = '', opts = {})
|
134
|
+
proxy = ''
|
135
|
+
if name =~ /^http/ and opts[:package_proxy]
|
136
|
+
proxy = extract_rpm_proxy_options(opts[:package_proxy])
|
137
|
+
end
|
138
|
+
execute("rpm #{cmdline_args} -ivh #{name} #{proxy}")
|
139
|
+
end
|
140
|
+
|
123
141
|
def uninstall_package(name, cmdline_args = '', opts = {})
|
124
142
|
case self['platform']
|
125
143
|
when /sles-/
|
@@ -252,4 +270,22 @@ module Unix::Pkg
|
|
252
270
|
end
|
253
271
|
end
|
254
272
|
|
273
|
+
# Extract RPM command's proxy options from URL
|
274
|
+
#
|
275
|
+
# @param [String] url A URL of form http://host:port
|
276
|
+
# @return [String] httpproxy and httport options for rpm
|
277
|
+
#
|
278
|
+
# @raise [StandardError] When encountering a string that
|
279
|
+
# cannot be parsed
|
280
|
+
# @api private
|
281
|
+
def extract_rpm_proxy_options(url)
|
282
|
+
begin
|
283
|
+
host, port = url.match(/https?:\/\/(.*):(\d*)/)[1,2]
|
284
|
+
raise if host.empty? or port.empty?
|
285
|
+
"--httpproxy #{host} --httpport #{port}"
|
286
|
+
rescue
|
287
|
+
raise "Cannot extract host and port from '#{url}'"
|
288
|
+
end
|
289
|
+
end
|
290
|
+
|
255
291
|
end
|
@@ -687,7 +687,7 @@ module Beaker
|
|
687
687
|
# @return [String] safe key name for current host
|
688
688
|
# @api private
|
689
689
|
def key_name
|
690
|
-
"#{key_name_prefix}-#{@options[:timestamp].strftime("%F_%H_%M_%
|
690
|
+
"#{key_name_prefix}-#{@options[:aws_keyname_modifier]}-#{@options[:timestamp].strftime("%F_%H_%M_%S_%N")}"
|
691
691
|
end
|
692
692
|
|
693
693
|
# Returns the local user running this tool
|
@@ -84,7 +84,7 @@ module Beaker
|
|
84
84
|
def set_ssh_config host, user
|
85
85
|
f = Tempfile.new("#{host.name}")
|
86
86
|
ssh_config = Dir.chdir(@vagrant_path) do
|
87
|
-
stdin, stdout, stderr, wait_thr = Open3.popen3('vagrant', 'ssh-config', host.name)
|
87
|
+
stdin, stdout, stderr, wait_thr = Open3.popen3(@vagrant_env, 'vagrant', 'ssh-config', host.name)
|
88
88
|
if not wait_thr.value.success?
|
89
89
|
raise "Failed to 'vagrant ssh-config' for #{host.name}"
|
90
90
|
end
|
@@ -128,7 +128,7 @@ module Beaker
|
|
128
128
|
@vagrant_path = File.expand_path(File.join(File.basename(__FILE__), '..', '.vagrant', 'beaker_vagrant_files', File.basename(options[:hosts_file])))
|
129
129
|
FileUtils.mkdir_p(@vagrant_path)
|
130
130
|
@vagrant_file = File.expand_path(File.join(@vagrant_path, "Vagrantfile"))
|
131
|
-
|
131
|
+
@vagrant_env = { "RUBYLIB" => "" }
|
132
132
|
end
|
133
133
|
|
134
134
|
def provision(provider = nil)
|
@@ -182,7 +182,7 @@ module Beaker
|
|
182
182
|
def vagrant_cmd(args)
|
183
183
|
Dir.chdir(@vagrant_path) do
|
184
184
|
exit_status = 1
|
185
|
-
Open3.popen3("vagrant #{args}") {|stdin, stdout, stderr, wait_thr|
|
185
|
+
Open3.popen3(@vagrant_env, "vagrant #{args}") {|stdin, stdout, stderr, wait_thr|
|
186
186
|
while line = stdout.gets
|
187
187
|
@logger.info(line)
|
188
188
|
end
|
data/lib/beaker/logger.rb
CHANGED
@@ -181,6 +181,11 @@ module Beaker
|
|
181
181
|
:ec2_yaml => 'config/image_templates/ec2.yaml',
|
182
182
|
:help => false,
|
183
183
|
:collect_perf_data => 'none',
|
184
|
+
:puppetdb_port_ssl => 8081,
|
185
|
+
:puppetdb_port_nonssl => 8080,
|
186
|
+
:puppetserver_port => 8140,
|
187
|
+
:nodeclassifier_port => 4433,
|
188
|
+
:aws_keyname_modifier => rand(10 ** 10).to_s.rjust(10,'0'), # 10 digit random number string
|
184
189
|
:ssh => {
|
185
190
|
:config => false,
|
186
191
|
:paranoid => false,
|
@@ -74,11 +74,14 @@ module Beaker
|
|
74
74
|
# @param [String, Symbol] filter Optional filter to apply to provided hosts - limits by name or role
|
75
75
|
# @param [Block] block This method will yield to a block of code passed by the caller
|
76
76
|
#
|
77
|
-
# @todo beaker3.0: simplify return types to Array<Result> only
|
77
|
+
# @todo (beaker3.0:BKR-571): simplify return types to Array<Result> only
|
78
78
|
#
|
79
|
-
# @return [Array<Result>, Result] If
|
80
|
-
# passed (after filtering), then an array of results is returned
|
81
|
-
#
|
79
|
+
# @return [Array<Result>, Result, nil] If an array of hosts has been
|
80
|
+
# passed (after filtering), then either an array of results is returned
|
81
|
+
# (if the array is non-empty), or nil is returned (if the array is empty).
|
82
|
+
# Else, a result object is returned. If filtering makes it such that only
|
83
|
+
# one host is left, then it's passed as a host object (not in an array),
|
84
|
+
# and thus a result object is returned.
|
82
85
|
def run_block_on hosts = [], filter = nil, &block
|
83
86
|
result = nil
|
84
87
|
block_hosts = hosts #the hosts to apply the block to after any filtering
|
data/lib/beaker/version.rb
CHANGED
@@ -894,5 +894,92 @@ describe ClassMixedWithDSLHelpers do
|
|
894
894
|
end
|
895
895
|
end
|
896
896
|
|
897
|
+
describe '#bounce_service' do
|
898
|
+
let( :options ) { Beaker::Options::Presets.new.presets }
|
899
|
+
before :each do
|
900
|
+
allow( subject ).to receive( :options ) { options }
|
901
|
+
end
|
902
|
+
|
903
|
+
it 'uses the default port argument if none given' do
|
904
|
+
host = hosts[0]
|
905
|
+
expect( host ).to receive( :graceful_restarts? ).and_return( false )
|
906
|
+
expect( subject ).to receive( :curl_with_retries ).with( anything(), anything(), /8140/, anything(), anything() )
|
907
|
+
subject.bounce_service( host, 'not_real_service')
|
908
|
+
end
|
909
|
+
|
910
|
+
it 'takes the port argument' do
|
911
|
+
host = hosts[0]
|
912
|
+
expect( host ).to receive( :graceful_restarts? ).and_return( false )
|
913
|
+
expect( subject ).to receive( :curl_with_retries ).with( anything(), anything(), /8000/, anything(), anything() )
|
914
|
+
subject.bounce_service( host, 'not_real_service', nil, 8000)
|
915
|
+
end
|
916
|
+
end
|
917
|
+
|
918
|
+
describe '#sleep_until_puppetdb_started' do
|
919
|
+
let( :options ) { Beaker::Options::Presets.new.presets }
|
920
|
+
before :each do
|
921
|
+
allow( subject ).to receive( :options ) { options }
|
922
|
+
end
|
923
|
+
|
924
|
+
it 'uses the default ports if none given' do
|
925
|
+
host = hosts[0]
|
926
|
+
expect( subject ).to receive( :curl_with_retries ).with( anything(), anything(), /8080/, anything(), anything() ).once.ordered
|
927
|
+
expect( subject ).to receive( :curl_with_retries ).with( anything(), anything(), /8081/, anything() ).once.ordered
|
928
|
+
subject.sleep_until_puppetdb_started( host )
|
929
|
+
end
|
930
|
+
|
931
|
+
it 'allows setting the nonssl_port' do
|
932
|
+
host = hosts[0]
|
933
|
+
expect( subject ).to receive( :curl_with_retries ).with( anything(), anything(), /8084/, anything(), anything() ).once.ordered
|
934
|
+
expect( subject ).to receive( :curl_with_retries ).with( anything(), anything(), /8081/, anything() ).once.ordered
|
935
|
+
subject.sleep_until_puppetdb_started( host, 8084 )
|
936
|
+
|
937
|
+
end
|
938
|
+
|
939
|
+
it 'allows setting the ssl_port' do
|
940
|
+
host = hosts[0]
|
941
|
+
expect( subject ).to receive( :curl_with_retries ).with( anything(), anything(), /8080/, anything(), anything() ).once.ordered
|
942
|
+
expect( subject ).to receive( :curl_with_retries ).with( anything(), anything(), /8085/, anything() ).once.ordered
|
943
|
+
subject.sleep_until_puppetdb_started( host, nil, 8085 )
|
944
|
+
end
|
945
|
+
end
|
946
|
+
|
947
|
+
describe '#sleep_until_puppetserver_started' do
|
948
|
+
let( :options ) { Beaker::Options::Presets.new.presets }
|
949
|
+
before :each do
|
950
|
+
allow( subject ).to receive( :options ) { options }
|
951
|
+
end
|
952
|
+
|
953
|
+
it 'uses the default port if none given' do
|
954
|
+
host = hosts[0]
|
955
|
+
expect( subject ).to receive( :curl_with_retries ).with( anything(), anything(), /8140/, anything() ).once.ordered
|
956
|
+
subject.sleep_until_puppetserver_started( host )
|
957
|
+
end
|
958
|
+
|
959
|
+
it 'allows setting the port' do
|
960
|
+
host = hosts[0]
|
961
|
+
expect( subject ).to receive( :curl_with_retries ).with( anything(), anything(), /8147/, anything() ).once.ordered
|
962
|
+
subject.sleep_until_puppetserver_started( host, 8147 )
|
963
|
+
end
|
964
|
+
end
|
965
|
+
|
966
|
+
describe '#sleep_until_nc_started' do
|
967
|
+
let( :options ) { Beaker::Options::Presets.new.presets }
|
968
|
+
before :each do
|
969
|
+
allow( subject ).to receive( :options ) { options }
|
970
|
+
end
|
971
|
+
|
972
|
+
it 'uses the default port if none given' do
|
973
|
+
host = hosts[0]
|
974
|
+
expect( subject ).to receive( :curl_with_retries ).with( anything(), anything(), /4433/, anything() ).once.ordered
|
975
|
+
subject.sleep_until_nc_started( host )
|
976
|
+
end
|
977
|
+
|
978
|
+
it 'allows setting the port' do
|
979
|
+
host = hosts[0]
|
980
|
+
expect( subject ).to receive( :curl_with_retries ).with( anything(), anything(), /4435/, anything() ).once.ordered
|
981
|
+
subject.sleep_until_nc_started( host, 4435 )
|
982
|
+
end
|
983
|
+
end
|
897
984
|
|
898
985
|
end
|
@@ -182,6 +182,29 @@ describe ClassMixedWithDSLInstallUtils do
|
|
182
182
|
url = subject.build_giturl('puppet', 'er0ck', 'github.com', 'ssh')
|
183
183
|
expect(url).to be == 'git@github.com:er0ck/puppet.git'
|
184
184
|
end
|
185
|
+
|
186
|
+
it 'uses ENV to build urls properly' do
|
187
|
+
allow(ENV).to receive(:[]).with('SERVER').and_return(nil)
|
188
|
+
allow(ENV).to receive(:[]).with('FORK').and_return(nil)
|
189
|
+
allow(ENV).to receive(:[]).with('PUPPET_FORK').and_return('er0ck/repo')
|
190
|
+
allow(ENV).to receive(:[]).with('PUPPET_SERVER').and_return('gitlab.com')
|
191
|
+
url = subject.build_giturl('puppet')
|
192
|
+
expect(url).to be == 'https://gitlab.com/er0ck/repo-puppet.git'
|
193
|
+
url = subject.build_giturl('puppet', 'er0ck')
|
194
|
+
expect(url).to be == 'https://gitlab.com/er0ck-puppet.git'
|
195
|
+
url = subject.build_giturl('puppet', 'er0ck', 'bitbucket.com')
|
196
|
+
expect(url).to be == 'https://bitbucket.com/er0ck-puppet.git'
|
197
|
+
url = subject.build_giturl('puppet', 'er0ck', 'github.com', 'https://')
|
198
|
+
expect(url).to be == 'https://github.com/er0ck/puppet.git'
|
199
|
+
url = subject.build_giturl('puppet', 'er0ck', 'github.com', 'https')
|
200
|
+
expect(url).to be == 'https://github.com/er0ck/puppet.git'
|
201
|
+
url = subject.build_giturl('puppet', 'er0ck', 'github.com', 'git@')
|
202
|
+
expect(url).to be == 'git@github.com:er0ck/puppet.git'
|
203
|
+
url = subject.build_giturl('puppet', 'er0ck', 'github.com', 'git')
|
204
|
+
expect(url).to be == 'git@github.com:er0ck/puppet.git'
|
205
|
+
url = subject.build_giturl('puppet', 'er0ck', 'github.com', 'ssh')
|
206
|
+
expect(url).to be == 'git@github.com:er0ck/puppet.git'
|
207
|
+
end
|
185
208
|
end
|
186
209
|
|
187
210
|
context 'extract_repo_info_from' do
|
@@ -396,7 +419,7 @@ describe ClassMixedWithDSLInstallUtils do
|
|
396
419
|
context 'on el-6' do
|
397
420
|
let(:platform) { Beaker::Platform.new('el-6-i386') }
|
398
421
|
it 'installs' do
|
399
|
-
expect(
|
422
|
+
expect(hosts[0]).to receive(:install_package_with_rpm).with(/puppetlabs-release-el-6\.noarch\.rpm/, '--replacepkgs', {:package_proxy=>false})
|
400
423
|
expect(hosts[0]).to receive(:install_package).with('puppet')
|
401
424
|
subject.install_puppet
|
402
425
|
end
|
@@ -414,7 +437,7 @@ describe ClassMixedWithDSLInstallUtils do
|
|
414
437
|
context 'on el-5' do
|
415
438
|
let(:platform) { Beaker::Platform.new('el-5-i386') }
|
416
439
|
it 'installs' do
|
417
|
-
expect(
|
440
|
+
expect(hosts[0]).to receive(:install_package_with_rpm).with(/puppetlabs-release-el-5\.noarch\.rpm/, '--replacepkgs', {:package_proxy=>false})
|
418
441
|
expect(hosts[0]).to receive(:install_package).with('puppet')
|
419
442
|
subject.install_puppet
|
420
443
|
end
|
@@ -422,7 +445,7 @@ describe ClassMixedWithDSLInstallUtils do
|
|
422
445
|
context 'on fedora' do
|
423
446
|
let(:platform) { Beaker::Platform.new('fedora-18-x86_84') }
|
424
447
|
it 'installs' do
|
425
|
-
expect(
|
448
|
+
expect(hosts[0]).to receive(:install_package_with_rpm).with(/puppetlabs-release-fedora-18\.noarch\.rpm/, '--replacepkgs', {:package_proxy=>false})
|
426
449
|
expect(hosts[0]).to receive(:install_package).with('puppet')
|
427
450
|
subject.install_puppet
|
428
451
|
end
|
@@ -585,16 +608,6 @@ describe ClassMixedWithDSLInstallUtils do
|
|
585
608
|
|
586
609
|
end
|
587
610
|
|
588
|
-
describe "When host is a redhat-like platform" do
|
589
|
-
let( :platform ) { Beaker::Platform.new('el-7-i386') }
|
590
|
-
|
591
|
-
it "installs an rpm" do
|
592
|
-
expect(subject).to receive(:on).with( host, /^(rpm --replacepkgs -ivh).*/ ).ordered
|
593
|
-
subject.install_puppetlabs_release_repo host
|
594
|
-
end
|
595
|
-
|
596
|
-
end
|
597
|
-
|
598
611
|
end
|
599
612
|
|
600
613
|
describe "#install_puppetlabs_dev_repo" do
|
@@ -754,10 +767,19 @@ describe ClassMixedWithDSLInstallUtils do
|
|
754
767
|
end
|
755
768
|
|
756
769
|
describe '#install_puppet_agent_from_msi_on' do
|
757
|
-
let( :opts ) { { :puppet_agent_version => 'VERSION' } }
|
770
|
+
let( :opts ) { { :puppet_agent_version => 'VERSION', :win_download_url => 'http://downloads.puppetlabs.com/windows' } }
|
758
771
|
let( :platform ) { 'windows' }
|
759
772
|
let( :host ) { { :platform => platform } }
|
760
773
|
|
774
|
+
it 'returns error when link incorrect' do
|
775
|
+
allow(subject).to receive(:link_exists?).with(anything()).and_return( false )
|
776
|
+
expect( host ).to receive( :is_x86_64? ).and_return( true )
|
777
|
+
|
778
|
+
expect{
|
779
|
+
subject.install_puppet_agent_from_msi_on( host, opts )
|
780
|
+
}.to raise_error(RuntimeError, /Puppet MSI at http:\/\/downloads.puppetlabs.com\/windows\/puppet-agent-VERSION-x64.msi does not exist!/)
|
781
|
+
end
|
782
|
+
|
761
783
|
it 'uses x86 msi when host is_x86_64 and install_32 is set on the host' do
|
762
784
|
host['install_32'] = true
|
763
785
|
|
@@ -1185,21 +1207,19 @@ describe ClassMixedWithDSLInstallUtils do
|
|
1185
1207
|
let(:aixhost) { make_host('aix', :platform => 'aix-53-power') }
|
1186
1208
|
let(:sol10host) { make_host('sol10', :platform => 'solaris-10-x86_64') }
|
1187
1209
|
let(:sol11host) { make_host('sol11', :platform => 'solaris-11-x86_64') }
|
1210
|
+
let(:cumulushost) { make_host('cumulus', :platform => 'cumulus-2.2-amd64') }
|
1188
1211
|
let(:el6host) { make_host('el6', :platform => 'el-6-x64') }
|
1189
1212
|
|
1190
1213
|
pkg_list = 'foo bar'
|
1191
1214
|
|
1192
|
-
it 'uninstalls packages on aix
|
1193
|
-
aix_depend_list = 'tar'
|
1215
|
+
it 'uninstalls packages on aix' do
|
1194
1216
|
result = Beaker::Result.new(aixhost,'')
|
1195
1217
|
result.stdout = pkg_list
|
1196
|
-
result2 = Beaker::Result.new(aixhost,'')
|
1197
|
-
result2.stdout = aix_depend_list
|
1198
1218
|
|
1199
|
-
expected_list = pkg_list
|
1219
|
+
expected_list = pkg_list
|
1200
1220
|
cmd_args = ''
|
1201
1221
|
|
1202
|
-
expect( subject ).to receive(:on).exactly(
|
1222
|
+
expect( subject ).to receive(:on).exactly(2).times.and_return(result, result)
|
1203
1223
|
expect( aixhost ).to receive(:uninstall_package).with(expected_list, cmd_args)
|
1204
1224
|
|
1205
1225
|
subject.remove_puppet_on( aixhost )
|
@@ -1231,6 +1251,19 @@ describe ClassMixedWithDSLInstallUtils do
|
|
1231
1251
|
subject.remove_puppet_on( sol11host )
|
1232
1252
|
end
|
1233
1253
|
|
1254
|
+
it 'uninstalls packages on cumulus' do
|
1255
|
+
result = Beaker::Result.new(cumulushost,'')
|
1256
|
+
result.stdout = pkg_list
|
1257
|
+
|
1258
|
+
expected_list = pkg_list
|
1259
|
+
cmd_args = ''
|
1260
|
+
|
1261
|
+
expect( subject ).to receive(:on).exactly(2).times.and_return(result, result)
|
1262
|
+
expect( cumulushost ).to receive(:uninstall_package).with(expected_list, cmd_args)
|
1263
|
+
|
1264
|
+
subject.remove_puppet_on( cumulushost )
|
1265
|
+
end
|
1266
|
+
|
1234
1267
|
it 'raises error on other platforms' do
|
1235
1268
|
expect { subject.remove_puppet_on( el6host ) }.to raise_error(RuntimeError, /unsupported platform/)
|
1236
1269
|
end
|