beaker 2.24.0 → 2.25.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/CONTRIBUTING.md +2 -7
- data/HISTORY.md +238 -2
- data/acceptance/tests/base/dsl/structure_test.rb +16 -0
- data/beaker.gemspec +4 -0
- data/lib/beaker/dsl/helpers.rb +3 -2
- data/lib/beaker/dsl/install_utils/foss_utils.rb +55 -6
- data/lib/beaker/dsl/structure.rb +28 -7
- data/lib/beaker/host.rb +2 -0
- data/lib/beaker/host_prebuilt_steps.rb +21 -9
- data/lib/beaker/hypervisor/aws_sdk.rb +86 -10
- data/lib/beaker/logger.rb +49 -1
- data/lib/beaker/options/presets.rb +1 -0
- data/lib/beaker/version.rb +1 -1
- data/spec/beaker/dsl/install_utils/foss_utils_spec.rb +49 -28
- data/spec/beaker/dsl/structure_spec.rb +44 -7
- data/spec/beaker/host_prebuilt_steps_spec.rb +7 -1
- data/spec/beaker/host_spec.rb +2 -0
- data/spec/beaker/hypervisor/aws_sdk_spec.rb +149 -9
- data/spec/beaker/logger_spec.rb +70 -0
- metadata +30 -4
- data/lib/beaker/dsl/helpers/hiera_helpers.rb +0 -60
- data/spec/beaker/dsl/helpers/hiera_helpers_spec.rb +0 -96
data/lib/beaker/dsl/structure.rb
CHANGED
@@ -36,9 +36,13 @@ module Beaker
|
|
36
36
|
# @param [String] step_name The name of the step to be logged.
|
37
37
|
# @param [Proc] block The actions to be performed in this step.
|
38
38
|
def step step_name, &block
|
39
|
-
logger.notify "\n
|
39
|
+
logger.notify "\n* #{step_name}\n"
|
40
40
|
set_current_step_name(step_name)
|
41
|
-
|
41
|
+
if block_given?
|
42
|
+
logger.step_in()
|
43
|
+
yield
|
44
|
+
logger.step_out()
|
45
|
+
end
|
42
46
|
end
|
43
47
|
|
44
48
|
# Provides a method to name tests.
|
@@ -49,7 +53,11 @@ module Beaker
|
|
49
53
|
def test_name my_name, &block
|
50
54
|
logger.notify "\n#{my_name}\n"
|
51
55
|
set_current_test_name(my_name)
|
52
|
-
|
56
|
+
if block_given?
|
57
|
+
logger.step_in()
|
58
|
+
yield
|
59
|
+
logger.step_out()
|
60
|
+
end
|
53
61
|
end
|
54
62
|
|
55
63
|
# Declare a teardown process that will be called after a test case is
|
@@ -170,6 +178,12 @@ module Beaker
|
|
170
178
|
# @example Confining from an already defined subset of hosts
|
171
179
|
# confine :except, {}, agents
|
172
180
|
#
|
181
|
+
# @example Confining to all ubuntu agents + all non-agents
|
182
|
+
# confine :to, { :platform => 'ubuntu' }, agents
|
183
|
+
#
|
184
|
+
# @example Confining to any non-windows agents + all non-agents
|
185
|
+
# confine :except, { :platform => 'windows' }, agents
|
186
|
+
#
|
173
187
|
#
|
174
188
|
# @return [Array<Host>] Returns an array of hosts that are still valid
|
175
189
|
# targets for this tests case.
|
@@ -177,17 +191,18 @@ module Beaker
|
|
177
191
|
# this test case after confinement.
|
178
192
|
def confine(type, criteria, host_array = nil, &block)
|
179
193
|
hosts_to_modify = Array( host_array || hosts )
|
194
|
+
hosts_not_modified = hosts - hosts_to_modify #we aren't examining these hosts
|
180
195
|
case type
|
181
196
|
when :except
|
182
197
|
if criteria and ( not criteria.empty? )
|
183
|
-
hosts_to_modify = hosts_to_modify - select_hosts(criteria, hosts_to_modify, &block)
|
198
|
+
hosts_to_modify = hosts_to_modify - select_hosts(criteria, hosts_to_modify, &block) + hosts_not_modified
|
184
199
|
else
|
185
200
|
# confining to all hosts *except* provided array of hosts
|
186
|
-
hosts_to_modify =
|
201
|
+
hosts_to_modify = hosts_not_modified
|
187
202
|
end
|
188
203
|
when :to
|
189
204
|
if criteria and ( not criteria.empty? )
|
190
|
-
hosts_to_modify = select_hosts(criteria, hosts_to_modify, &block)
|
205
|
+
hosts_to_modify = select_hosts(criteria, hosts_to_modify, &block) + hosts_not_modified
|
191
206
|
else
|
192
207
|
# confining to only hosts in provided array of hosts
|
193
208
|
end
|
@@ -214,7 +229,13 @@ module Beaker
|
|
214
229
|
|
215
230
|
yield
|
216
231
|
|
217
|
-
rescue Beaker::DSL::Outcomes::SkipTest
|
232
|
+
rescue Beaker::DSL::Outcomes::SkipTest => e
|
233
|
+
# I don't like this much, but adding options to confine is a breaking change
|
234
|
+
# to the DSL that would involve a major version bump
|
235
|
+
if e.message !~ /No suitable hosts found/
|
236
|
+
# a skip generated from the provided block, pass it up the chain
|
237
|
+
raise e
|
238
|
+
end
|
218
239
|
ensure
|
219
240
|
self.hosts = original_hosts
|
220
241
|
end
|
data/lib/beaker/host.rb
CHANGED
@@ -274,9 +274,11 @@ module Beaker
|
|
274
274
|
# and they shouldn't be ssh specific
|
275
275
|
result = nil
|
276
276
|
|
277
|
+
@logger.step_in()
|
277
278
|
seconds = Benchmark.realtime {
|
278
279
|
result = connection.execute(cmdline, options, output_callback)
|
279
280
|
}
|
281
|
+
@logger.step_out()
|
280
282
|
|
281
283
|
if not options[:silent]
|
282
284
|
@logger.debug "\n#{log_prefix} executed in %0.2f seconds" % seconds
|
@@ -160,7 +160,7 @@ module Beaker
|
|
160
160
|
# @return [String, String, String] The URL, arch and package name for EPL for the provided host
|
161
161
|
# @param [Hash{Symbol=>String}] opts Options to alter execution.
|
162
162
|
# @option opts [String] :epel_url Link to download
|
163
|
-
# @option opts [String] :epel_arch Architecture to download (i386, x86_64, etc), defaults to i386
|
163
|
+
# @option opts [String] :epel_arch Architecture to download (i386, x86_64, etc), defaults to i386 for 5 and 6, x86_64 for 7
|
164
164
|
# @option opts [String] :epel_6_pkg Package to download from provided link for el-6
|
165
165
|
# @option opts [String] :epel_5_pkg Package to download from provided link for el-5
|
166
166
|
# @raise [Exception] Raises an error if the host provided's platform != /el-(5|6)/
|
@@ -170,16 +170,23 @@ module Beaker
|
|
170
170
|
end
|
171
171
|
|
172
172
|
version = host['platform'].version
|
173
|
-
|
174
|
-
|
173
|
+
url = "#{host[:epel_url] || opts[:epel_url]}/#{version}"
|
174
|
+
if version == '7'
|
175
|
+
if opts[:epel_7_arch] == 'i386'
|
176
|
+
raise ArgumentError.new("epel-7 does not provide packages for i386")
|
177
|
+
end
|
178
|
+
pkg = host[:epel_pkg] || opts[:epel_7_pkg]
|
179
|
+
arch = opts[:epel_7_arch] || 'x86_64'
|
180
|
+
elsif version == '6'
|
175
181
|
pkg = host[:epel_pkg] || opts[:epel_6_pkg]
|
182
|
+
arch = host[:epel_arch] || opts[:epel_6_arch] || 'i386'
|
176
183
|
elsif version == '5'
|
177
|
-
url = "#{host[:epel_url] || opts[:epel_url]}/#{version}"
|
178
184
|
pkg = host[:epel_pkg] || opts[:epel_5_pkg]
|
185
|
+
arch = host[:epel_arch] || opts[:epel_5_arch] || 'i386'
|
179
186
|
else
|
180
|
-
raise "epel_info_for does not support el version #{version}, on #{host.name}"
|
187
|
+
raise ArgumentError.new("epel_info_for does not support el version #{version}, on #{host.name}")
|
181
188
|
end
|
182
|
-
return url,
|
189
|
+
return url, arch, pkg
|
183
190
|
end
|
184
191
|
|
185
192
|
# Run 'apt-get update' on the provided host or hosts.
|
@@ -237,7 +244,7 @@ module Beaker
|
|
237
244
|
report_and_raise(logger, e, "proxy_config")
|
238
245
|
end
|
239
246
|
|
240
|
-
#Install EPEL on host or hosts with platform = /el-(5|6)/. Do nothing on host or hosts of other platforms.
|
247
|
+
#Install EPEL on host or hosts with platform = /el-(5|6|7)/. Do nothing on host or hosts of other platforms.
|
241
248
|
# @param [Host, Array<Host>] host One or more hosts to act upon. Will use individual host epel_url, epel_arch
|
242
249
|
# and epel_pkg before using defaults provided in opts.
|
243
250
|
# @param [Hash{Symbol=>String}] opts Options to alter execution.
|
@@ -245,6 +252,7 @@ module Beaker
|
|
245
252
|
# @option opts [Beaker::Logger] :logger A {Beaker::Logger} object
|
246
253
|
# @option opts [String] :epel_url Link to download from
|
247
254
|
# @option opts [String] :epel_arch Architecture of epel to download (i386, x86_64, etc)
|
255
|
+
# @option opts [String] :epel_7_pkg Package to download from provided link for el-7
|
248
256
|
# @option opts [String] :epel_6_pkg Package to download from provided link for el-6
|
249
257
|
# @option opts [String] :epel_5_pkg Package to download from provided link for el-5
|
250
258
|
def add_el_extras( host, opts )
|
@@ -254,11 +262,15 @@ module Beaker
|
|
254
262
|
debug_opt = opts[:debug] ? 'vh' : ''
|
255
263
|
block_on host do |host|
|
256
264
|
case
|
257
|
-
when el_based?(host) && ['5','6'].include?(host['platform'].version)
|
265
|
+
when el_based?(host) && ['5','6','7'].include?(host['platform'].version)
|
258
266
|
result = host.exec(Command.new('rpm -qa | grep epel-release'), :acceptable_exit_codes => [0,1])
|
259
267
|
if result.exit_code == 1
|
260
268
|
url, arch, pkg = epel_info_for host, opts
|
261
|
-
host.
|
269
|
+
if host['platform'].version == '7'
|
270
|
+
host.exec(Command.new("rpm -i#{debug_opt} #{url}/#{arch}/e/#{pkg}"))
|
271
|
+
else
|
272
|
+
host.exec(Command.new("rpm -i#{debug_opt} #{url}/#{arch}/#{pkg}"))
|
273
|
+
end
|
262
274
|
#update /etc/yum.repos.d/epel.repo for new baseurl
|
263
275
|
host.exec(Command.new("sed -i -e 's;#baseurl.*$;baseurl=#{Regexp.escape(url)}/\$basearch;' /etc/yum.repos.d/epel.repo"))
|
264
276
|
#remove mirrorlist
|
@@ -92,6 +92,7 @@ module Beaker
|
|
92
92
|
def cleanup
|
93
93
|
# Provisioning should have set the host 'instance' values.
|
94
94
|
kill_instances(@hosts.map{|h| h['instance']}.select{|x| !x.nil?})
|
95
|
+
delete_key_pair_all_regions()
|
95
96
|
nil
|
96
97
|
end
|
97
98
|
|
@@ -193,6 +194,7 @@ module Beaker
|
|
193
194
|
end
|
194
195
|
end
|
195
196
|
end
|
197
|
+
delete_key_pair_all_regions(key_name_prefix)
|
196
198
|
|
197
199
|
@logger.notify "#{key}: Killed #{kill_count} instance(s)"
|
198
200
|
end
|
@@ -665,13 +667,23 @@ module Beaker
|
|
665
667
|
File.read(key_file)
|
666
668
|
end
|
667
669
|
|
670
|
+
# Generate a key prefix for key pair names
|
671
|
+
#
|
672
|
+
# @note This is the part of the key that will stay static between Beaker
|
673
|
+
# runs on the same host.
|
674
|
+
#
|
675
|
+
# @return [String] Beaker key pair name based on sanitized hostname
|
676
|
+
def key_name_prefix
|
677
|
+
safe_hostname = Socket.gethostname.gsub('.', '-')
|
678
|
+
"Beaker-#{local_user}-#{safe_hostname}"
|
679
|
+
end
|
680
|
+
|
668
681
|
# Generate a reusable key name from the local hosts hostname
|
669
682
|
#
|
670
683
|
# @return [String] safe key name for current host
|
671
684
|
# @api private
|
672
685
|
def key_name
|
673
|
-
|
674
|
-
"Beaker-#{local_user}-#{safe_hostname}"
|
686
|
+
"#{key_name_prefix}-#{@options[:timestamp].strftime("%F_%H_%M_%S")}"
|
675
687
|
end
|
676
688
|
|
677
689
|
# Returns the local user running this tool
|
@@ -682,22 +694,86 @@ module Beaker
|
|
682
694
|
ENV['USER']
|
683
695
|
end
|
684
696
|
|
685
|
-
#
|
697
|
+
# Creates the KeyPair for this test run
|
686
698
|
#
|
687
699
|
# @param region [AWS::EC2::Region] region to create the key pair in
|
688
700
|
# @return [AWS::EC2::KeyPair] created key_pair
|
689
701
|
# @api private
|
690
702
|
def ensure_key_pair(region)
|
691
|
-
@logger.notify("aws-sdk: Ensure key pair exists, create if not")
|
692
|
-
key_pairs = region.key_pairs
|
693
703
|
pair_name = key_name()
|
694
|
-
|
695
|
-
|
696
|
-
|
697
|
-
|
704
|
+
delete_key_pair(region, pair_name)
|
705
|
+
create_new_key_pair(region, pair_name)
|
706
|
+
end
|
707
|
+
|
708
|
+
# Deletes key pairs from all regions
|
709
|
+
#
|
710
|
+
# @param [String] keypair_name_filter if given, will get all keypairs that match
|
711
|
+
# a simple {::String#start_with?} filter. If no filter is given, the basic key
|
712
|
+
# name returned by {#key_name} will be used.
|
713
|
+
#
|
714
|
+
# @return nil
|
715
|
+
# @api private
|
716
|
+
def delete_key_pair_all_regions(keypair_name_filter=nil)
|
717
|
+
region_keypairs_hash = my_key_pairs(keypair_name_filter)
|
718
|
+
region_keypairs_hash.each_pair do |region, keypair_name_array|
|
719
|
+
keypair_name_array.each do |keypair_name|
|
720
|
+
delete_key_pair(region, keypair_name)
|
721
|
+
end
|
722
|
+
end
|
723
|
+
end
|
724
|
+
|
725
|
+
# Gets the Beaker user's keypairs by region
|
726
|
+
#
|
727
|
+
# @param [String] name_filter if given, will get all keypairs that match
|
728
|
+
# a simple {::String#start_with?} filter. If no filter is given, the basic key
|
729
|
+
# name returned by {#key_name} will be used.
|
730
|
+
#
|
731
|
+
# @return [Hash{AWS::EC2::Region=>Array[String]}] a hash of region instance to
|
732
|
+
# an array of the keypair names that match for the filter
|
733
|
+
# @api private
|
734
|
+
def my_key_pairs(name_filter=nil)
|
735
|
+
keypairs_by_region = {}
|
736
|
+
keyname_default = key_name()
|
737
|
+
keyname_filtered = "#{name_filter}-*"
|
738
|
+
@ec2.regions.each do |region|
|
739
|
+
if name_filter
|
740
|
+
aws_name_filter = keyname_filtered
|
741
|
+
else
|
742
|
+
aws_name_filter = keyname_default
|
743
|
+
end
|
744
|
+
keypair_collection = region.key_pairs.filter('key-name', aws_name_filter)
|
745
|
+
keypair_collection.each do |keypair|
|
746
|
+
keypairs_by_region[region] ||= []
|
747
|
+
keypairs_by_region[region] << keypair.name
|
748
|
+
end
|
698
749
|
end
|
750
|
+
keypairs_by_region
|
751
|
+
end
|
699
752
|
|
700
|
-
|
753
|
+
# Deletes a given key pair
|
754
|
+
#
|
755
|
+
# @param [AWS::EC2::Region] region the region the key belongs to
|
756
|
+
# @param [String] pair_name the name of the key to be deleted
|
757
|
+
#
|
758
|
+
# @api private
|
759
|
+
def delete_key_pair(region, pair_name)
|
760
|
+
kp = region.key_pairs[pair_name]
|
761
|
+
if kp.exists?
|
762
|
+
@logger.debug("aws-sdk: delete key pair in region: #{region.name}")
|
763
|
+
kp.delete()
|
764
|
+
end
|
765
|
+
end
|
766
|
+
|
767
|
+
# Create a new key pair for a given Beaker run
|
768
|
+
#
|
769
|
+
# @param [AWS::EC2::Region] region the region the key pair will be imported into
|
770
|
+
# @param [String] pair_name the name of the key to be created
|
771
|
+
#
|
772
|
+
# @return [AWS::EC2::KeyPair] key pair created
|
773
|
+
def create_new_key_pair(region, pair_name)
|
774
|
+
@logger.debug("aws-sdk: generating new key pair: #{pair_name}")
|
775
|
+
ssh_string = public_key()
|
776
|
+
region.key_pairs.import(pair_name, ssh_string)
|
701
777
|
end
|
702
778
|
|
703
779
|
# Return a reproducable security group identifier based on input ports
|
data/lib/beaker/logger.rb
CHANGED
@@ -8,6 +8,9 @@ module Beaker
|
|
8
8
|
#The results of the most recently run command
|
9
9
|
attr_accessor :last_result
|
10
10
|
|
11
|
+
#Determines the spacing that happens before an output line
|
12
|
+
attr_accessor :line_prefix
|
13
|
+
|
11
14
|
NORMAL = "\e[00;00m"
|
12
15
|
BRIGHT_NORMAL = "\e[00;01m"
|
13
16
|
BLACK = "\e[00;30m"
|
@@ -75,6 +78,8 @@ module Beaker
|
|
75
78
|
end
|
76
79
|
|
77
80
|
@last_result = nil
|
81
|
+
@line_prefix_length = 0
|
82
|
+
@line_prefix = ''
|
78
83
|
|
79
84
|
@destinations = []
|
80
85
|
|
@@ -176,6 +181,47 @@ module Beaker
|
|
176
181
|
end
|
177
182
|
end
|
178
183
|
|
184
|
+
# Prefixes a log line with the appropriate amount of whitespace for the level
|
185
|
+
# of test that's running.
|
186
|
+
#
|
187
|
+
# @param [String] line the line to prefix
|
188
|
+
#
|
189
|
+
# @return [String] the prefixed line
|
190
|
+
def prefix_log_line line
|
191
|
+
if line.kind_of?(Array)
|
192
|
+
line.map do |s|
|
193
|
+
prefix_log_line s
|
194
|
+
end
|
195
|
+
else
|
196
|
+
line.gsub!(/\r/, '')
|
197
|
+
has_ending_newline = line.end_with?("\n")
|
198
|
+
actual_lines = line.split("\n")
|
199
|
+
actual_lines.map! do |actual_line|
|
200
|
+
@line_prefix + actual_line
|
201
|
+
end
|
202
|
+
new_line = actual_lines.join("\n")
|
203
|
+
new_line << "\n" if has_ending_newline
|
204
|
+
new_line
|
205
|
+
end
|
206
|
+
end
|
207
|
+
|
208
|
+
# Sets the step level appropriately for logging to be indented correctly
|
209
|
+
#
|
210
|
+
# @return nil
|
211
|
+
def step_in
|
212
|
+
@line_prefix_length += 2
|
213
|
+
@line_prefix = ' ' * @line_prefix_length
|
214
|
+
end
|
215
|
+
|
216
|
+
# Sets the step level appropriately for logging to be indented correctly
|
217
|
+
#
|
218
|
+
# @return nil
|
219
|
+
def step_out
|
220
|
+
@line_prefix_length -= 2
|
221
|
+
@line_prefix_length = 0 if @line_prefix_length < 0
|
222
|
+
@line_prefix = ' ' * @line_prefix_length
|
223
|
+
end
|
224
|
+
|
179
225
|
# Custom reporting for messages generated by host SUTs.
|
180
226
|
# Will not print unless we are at {LOG_LEVELS} 'verbose' or higher.
|
181
227
|
# Strips any color codes already in the provided messages, then adds logger color codes before reporting
|
@@ -278,9 +324,11 @@ module Beaker
|
|
278
324
|
# @param [Boolean] add_newline (true) Add newlines between the color codes and the message
|
279
325
|
def optionally_color color_code, msg, add_newline = true
|
280
326
|
print_statement = add_newline ? :puts : :print
|
327
|
+
msg = convert(msg)
|
328
|
+
msg = prefix_log_line(msg)
|
281
329
|
@destinations.each do |to|
|
282
330
|
to.print color_code if @color
|
283
|
-
to.send print_statement,
|
331
|
+
to.send print_statement, msg
|
284
332
|
to.print NORMAL if @color unless color_code == NONE
|
285
333
|
end
|
286
334
|
end
|
@@ -165,6 +165,7 @@ module Beaker
|
|
165
165
|
:add_el_extras => false,
|
166
166
|
:epel_url => "http://mirrors.kernel.org/fedora-epel",
|
167
167
|
:epel_arch => "i386",
|
168
|
+
:epel_7_pkg => "epel-release-7-5.noarch.rpm",
|
168
169
|
:epel_6_pkg => "epel-release-6-8.noarch.rpm",
|
169
170
|
:epel_5_pkg => "epel-release-5-4.noarch.rpm",
|
170
171
|
:consoleport => 443,
|
data/lib/beaker/version.rb
CHANGED
@@ -1048,10 +1048,10 @@ describe ClassMixedWithDSLInstallUtils do
|
|
1048
1048
|
allow( subject ).to receive( :configure_foss_defaults_on ).and_return( true )
|
1049
1049
|
end
|
1050
1050
|
|
1051
|
-
def test_fetch_http_file()
|
1051
|
+
def test_fetch_http_file(agent_version = '1.0.0')
|
1052
1052
|
expect( subject ).to receive( :configure_type_defaults_on ).with(host)
|
1053
1053
|
expect( subject ).to receive( :fetch_http_file ).with( /[^\/]\z/, anything, anything )
|
1054
|
-
subject.install_puppet_agent_dev_repo_on( host, opts.merge({ :puppet_agent_version =>
|
1054
|
+
subject.install_puppet_agent_dev_repo_on( host, opts.merge({ :puppet_agent_version => agent_version }) )
|
1055
1055
|
end
|
1056
1056
|
|
1057
1057
|
context 'on windows' do
|
@@ -1084,20 +1084,31 @@ describe ClassMixedWithDSLInstallUtils do
|
|
1084
1084
|
@platform = 'solaris-10-x86_64'
|
1085
1085
|
end
|
1086
1086
|
|
1087
|
-
|
1088
|
-
|
1089
|
-
|
1090
|
-
|
1091
|
-
|
1092
|
-
|
1093
|
-
|
1087
|
+
[
|
1088
|
+
['1.0.1.786.477', '1.0.1.786.477'],
|
1089
|
+
['1.0.1.786.a477', '1.0.1.786.a477'],
|
1090
|
+
['1.0.1.786.477-', '1.0.1.786.477-'],
|
1091
|
+
['1.0.1.0000786.477', '1.0.1.0000786.477'],
|
1092
|
+
['1.000000.1.786.477', '1.000000.1.786.477'],
|
1093
|
+
['-1.0.1.786.477', '-1.0.1.786.477'],
|
1094
|
+
['1.2.5.38.6813', '1.2.5.38.6813']
|
1095
|
+
].each do |val, expected|
|
1096
|
+
|
1097
|
+
it "copies package to the root directory and installs it" do
|
1098
|
+
expect( subject ).to receive( :link_exists? ).with(/puppet-agent-#{expected}-1\.i386\.pkg\.gz/).and_return( true )
|
1099
|
+
expect( subject ).to receive( :scp_to ).with( host, /\/puppet-agent-#{expected}-1.i386\.pkg\.gz/, '/' )
|
1100
|
+
expect( subject ).to receive( :create_remote_file ).with( host, '/noask', /noask file/m )
|
1101
|
+
expect( subject ).to receive( :on ).with( host, "gunzip -c puppet-agent-#{expected}-1.i386.pkg.gz | pkgadd -d /dev/stdin -a noask -n all" )
|
1102
|
+
test_fetch_http_file(val)
|
1103
|
+
end
|
1094
1104
|
|
1095
|
-
|
1096
|
-
|
1097
|
-
|
1098
|
-
|
1099
|
-
|
1100
|
-
|
1105
|
+
it "copies old package to the root directory and installs it" do
|
1106
|
+
expect( subject ).to receive( :link_exists? ).with(/puppet-agent-#{expected}-1\.i386\.pkg\.gz/).and_return( false )
|
1107
|
+
expect( subject ).to receive( :scp_to ).with( host, /\/puppet-agent-#{expected}.i386\.pkg\.gz/, '/' )
|
1108
|
+
expect( subject ).to receive( :create_remote_file ).with( host, '/noask', /noask file/m )
|
1109
|
+
expect( subject ).to receive( :on ).with( host, "gunzip -c puppet-agent-#{expected}.i386.pkg.gz | pkgadd -d /dev/stdin -a noask -n all" )
|
1110
|
+
test_fetch_http_file(val)
|
1111
|
+
end
|
1101
1112
|
end
|
1102
1113
|
end
|
1103
1114
|
|
@@ -1106,20 +1117,30 @@ describe ClassMixedWithDSLInstallUtils do
|
|
1106
1117
|
@platform = 'solaris-11-x86_64'
|
1107
1118
|
end
|
1108
1119
|
|
1109
|
-
|
1110
|
-
|
1111
|
-
|
1112
|
-
|
1113
|
-
|
1114
|
-
|
1115
|
-
|
1120
|
+
[
|
1121
|
+
['1.0.1.786.477', '1.0.1.786.477'],
|
1122
|
+
['1.0.1.786.a477', '1.0.1.786.477'],
|
1123
|
+
['1.0.1.786.477-', '1.0.1.786.477'],
|
1124
|
+
['1.0.1.0000786.477', '1.0.1.786.477'],
|
1125
|
+
['1.000000.1.786.477', '1.0.1.786.477'],
|
1126
|
+
['-1.0.1.786.477', '1.0.1.786.477'],
|
1127
|
+
['1.2.5.38.6813', '1.2.5.38.6813']
|
1128
|
+
].each do |val, expected|
|
1129
|
+
|
1130
|
+
it "copies package to the root user directory and installs it" do
|
1131
|
+
# version = 1.0.0
|
1132
|
+
expect( subject ).to receive( :link_exists? ).with(/puppet-agent@#{expected},5\.11-1\.i386\.p5p/).and_return( true )
|
1133
|
+
expect( subject ).to receive( :scp_to ).with( host, /\/puppet-agent@#{expected},5\.11-1\.i386\.p5p/, '/root' )
|
1134
|
+
expect( subject ).to receive( :on ).with( host, "pkg install -g puppet-agent@#{expected},5.11-1.i386.p5p puppet-agent" )
|
1135
|
+
test_fetch_http_file(val)
|
1136
|
+
end
|
1116
1137
|
|
1117
|
-
|
1118
|
-
|
1119
|
-
|
1120
|
-
|
1121
|
-
|
1122
|
-
|
1138
|
+
it "copies old package to the root directory and installs it" do
|
1139
|
+
expect( subject ).to receive( :link_exists? ).with(/puppet-agent@#{expected},5\.11-1\.i386\.p5p/).and_return( false )
|
1140
|
+
expect( subject ).to receive( :scp_to ).with( host, /\/puppet-agent@#{expected},5\.11\.i386\.p5p/, '/root' )
|
1141
|
+
expect( subject ).to receive( :on ).with( host, "pkg install -g puppet-agent@#{expected},5.11.i386.p5p puppet-agent" )
|
1142
|
+
test_fetch_http_file(val)
|
1143
|
+
end
|
1123
1144
|
end
|
1124
1145
|
end
|
1125
1146
|
end
|