beaker 1.11.0 → 1.11.1
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/lib/beaker/answers/version30.rb +1 -1
- data/lib/beaker/cli.rb +13 -2
- data/lib/beaker/dsl/helpers.rb +6 -6
- data/lib/beaker/dsl/install_utils.rb +18 -5
- data/lib/beaker/host/unix.rb +1 -1
- data/lib/beaker/host/unix/pkg.rb +1 -1
- data/lib/beaker/host/windows/pkg.rb +3 -3
- data/lib/beaker/host_prebuilt_steps.rb +6 -6
- data/lib/beaker/hypervisor.rb +3 -3
- data/lib/beaker/hypervisor/blimper.rb +3 -3
- data/lib/beaker/hypervisor/docker.rb +4 -8
- data/lib/beaker/hypervisor/fusion.rb +3 -3
- data/lib/beaker/hypervisor/google_compute.rb +17 -7
- data/lib/beaker/hypervisor/google_compute_helper.rb +1 -1
- data/lib/beaker/hypervisor/solaris.rb +1 -1
- data/lib/beaker/hypervisor/vagrant.rb +1 -1
- data/lib/beaker/hypervisor/vcloud.rb +1 -1
- data/lib/beaker/hypervisor/vcloud_pooled.rb +3 -3
- data/lib/beaker/hypervisor/vsphere.rb +1 -1
- data/lib/beaker/logger.rb +14 -14
- data/lib/beaker/network_manager.rb +5 -5
- data/lib/beaker/options/command_line_parser.rb +12 -13
- data/lib/beaker/options/hosts_file_parser.rb +1 -1
- data/lib/beaker/options/options_file_parser.rb +4 -4
- data/lib/beaker/options/parser.rb +11 -5
- data/lib/beaker/options/pe_version_scraper.rb +2 -2
- data/lib/beaker/platform.rb +4 -4
- data/lib/beaker/shared/error_handler.rb +2 -2
- data/lib/beaker/shared/host_role_parser.rb +7 -7
- data/lib/beaker/ssh_connection.rb +2 -2
- data/lib/beaker/test_suite.rb +1 -1
- data/lib/beaker/version.rb +1 -1
- data/spec/beaker/hypervisor/docker_spec.rb +19 -13
- data/spec/beaker/options/command_line_parser_spec.rb +2 -2
- data/spec/beaker/options/parser_spec.rb +108 -85
- metadata +2 -2
@@ -131,7 +131,7 @@ module Beaker
|
|
131
131
|
@logger.notify 'Spent %.2f seconds deploying VMs' % (Time.now - start)
|
132
132
|
|
133
133
|
try = (Time.now - start) / 5
|
134
|
-
duration = run_and_report_duration do
|
134
|
+
duration = run_and_report_duration do
|
135
135
|
@hosts.each_with_index do |h, i|
|
136
136
|
booting_host(h, try, attempts)
|
137
137
|
end
|
@@ -2,7 +2,7 @@ require 'yaml' unless defined?(YAML)
|
|
2
2
|
require 'json'
|
3
3
|
require 'net/http'
|
4
4
|
|
5
|
-
module Beaker
|
5
|
+
module Beaker
|
6
6
|
class VcloudPooled < Beaker::Hypervisor
|
7
7
|
SSH_EXCEPTIONS = [
|
8
8
|
SocketError,
|
@@ -75,7 +75,7 @@ module Beaker
|
|
75
75
|
attempts = @options[:timeout].to_i / 5
|
76
76
|
response = http.request(request)
|
77
77
|
parsed_response = JSON.parse(response.body)
|
78
|
-
if parsed_response[h['template']] && parsed_response[h['template']]['ok'] && parsed_response[h['template']]['hostname']
|
78
|
+
if parsed_response[h['template']] && parsed_response[h['template']]['ok'] && parsed_response[h['template']]['hostname']
|
79
79
|
h['vmhostname'] = parsed_response[h['template']]['hostname']
|
80
80
|
else
|
81
81
|
raise "VcloudPooled.provision - no vCloud host free for #{h.name} in pool"
|
@@ -115,7 +115,7 @@ module Beaker
|
|
115
115
|
rescue *SSH_EXCEPTIONS => e
|
116
116
|
report_and_raise(@logger, e, 'vCloudPooled.cleanup (http.request)')
|
117
117
|
end
|
118
|
-
end
|
118
|
+
end
|
119
119
|
|
120
120
|
@logger.notify "Spent %.2f seconds cleaning up" % (Time.now - start)
|
121
121
|
end
|
data/lib/beaker/logger.rb
CHANGED
@@ -42,7 +42,7 @@ module Beaker
|
|
42
42
|
# Initialize a Logger object that reports to the provided destinations, use options from provided option hash
|
43
43
|
# @param [Array<String, IO>] Array of IO and strings (assumed to be file paths) to be reported to
|
44
44
|
# @param [Hash] options Hash of options
|
45
|
-
# @option options [Boolean] :color (true) Print color code before log messages
|
45
|
+
# @option options [Boolean] :color (true) Print color code before log messages
|
46
46
|
# @option options [Boolean] :quiet (false) Do not log messages to STDOUT
|
47
47
|
# @option options [String] :log_level ("info") Log level (one of "debug" - highest level, "verbose", "info",
|
48
48
|
# "notify" and "warn" - lowest level (see {LOG_LEVELS})) The log level indicates that messages at that
|
@@ -128,8 +128,8 @@ module Beaker
|
|
128
128
|
LOG_LEVELS[@log_level] >= LOG_LEVELS[:notify]
|
129
129
|
end
|
130
130
|
|
131
|
-
# Custom reporting for messages generated by host SUTs.
|
132
|
-
# Will not print unless we are at {LOG_LEVELS} 'verbose' or higher.
|
131
|
+
# Custom reporting for messages generated by host SUTs.
|
132
|
+
# Will not print unless we are at {LOG_LEVELS} 'verbose' or higher.
|
133
133
|
# Strips any color codes already in the provided messages, then adds logger color codes before reporting
|
134
134
|
# @param args[Array<String>] Strings to be reported
|
135
135
|
def host_output *args
|
@@ -139,7 +139,7 @@ module Beaker
|
|
139
139
|
optionally_color GREY, string, false
|
140
140
|
end
|
141
141
|
|
142
|
-
# Report a debug message.
|
142
|
+
# Report a debug message.
|
143
143
|
# Will not print unless we are at {LOG_LEVELS} 'debug' or higher.
|
144
144
|
# @param args[Array<String>] Strings to be reported
|
145
145
|
def debug *args
|
@@ -148,8 +148,8 @@ module Beaker
|
|
148
148
|
end
|
149
149
|
|
150
150
|
# Report a warning message.
|
151
|
-
# Will not print unless we are at {LOG_LEVELS} 'warn' or higher.
|
152
|
-
# Will pre-pend the message with "Warning: ".
|
151
|
+
# Will not print unless we are at {LOG_LEVELS} 'warn' or higher.
|
152
|
+
# Will pre-pend the message with "Warning: ".
|
153
153
|
# @param args[Array<String>] Strings to be reported
|
154
154
|
def warn *args
|
155
155
|
return unless is_warn?
|
@@ -157,31 +157,31 @@ module Beaker
|
|
157
157
|
optionally_color YELLOW, strings
|
158
158
|
end
|
159
159
|
|
160
|
-
# Report an info message.
|
161
|
-
# Will not print unless we are at {LOG_LEVELS} 'info' or higher.
|
160
|
+
# Report an info message.
|
161
|
+
# Will not print unless we are at {LOG_LEVELS} 'info' or higher.
|
162
162
|
# @param args[Array<String>] Strings to be reported
|
163
163
|
def info *args
|
164
164
|
return unless is_info?
|
165
165
|
optionally_color BLUE, args
|
166
166
|
end
|
167
167
|
|
168
|
-
# Report a success message.
|
169
|
-
# Will always be reported.
|
168
|
+
# Report a success message.
|
169
|
+
# Will always be reported.
|
170
170
|
# @param args[Array<String>] Strings to be reported
|
171
171
|
def success *args
|
172
172
|
optionally_color GREEN, args
|
173
173
|
end
|
174
174
|
|
175
|
-
# Report a notify message.
|
176
|
-
# Will not print unless we are at {LOG_LEVELS} 'notify' or higher.
|
175
|
+
# Report a notify message.
|
176
|
+
# Will not print unless we are at {LOG_LEVELS} 'notify' or higher.
|
177
177
|
# @param args[Array<String>] Strings to be reported
|
178
178
|
def notify *args
|
179
179
|
return unless is_notify?
|
180
180
|
optionally_color BRIGHT_WHITE, args
|
181
181
|
end
|
182
182
|
|
183
|
-
# Report an error message.
|
184
|
-
# Will always be reported.
|
183
|
+
# Report an error message.
|
184
|
+
# Will always be reported.
|
185
185
|
# @param args[Array<String>] Strings to be reported
|
186
186
|
def error *args
|
187
187
|
optionally_color BRIGHT_RED, args
|
@@ -17,9 +17,9 @@ module Beaker
|
|
17
17
|
# - only if we have a hypervisor
|
18
18
|
# - only if either the specific hosts has no specification or has 'provision' in its config
|
19
19
|
# - always if it is a vagrant box (vagrant boxes are always provisioned as they always need ssh key hacking)
|
20
|
-
def provision? options, host
|
21
|
-
command_line_says = options[:provision]
|
22
|
-
host_says = host['hypervisor'] && (host.has_key?('provision') ? host['provision'] : true)
|
20
|
+
def provision? options, host
|
21
|
+
command_line_says = options[:provision]
|
22
|
+
host_says = host['hypervisor'] && (host.has_key?('provision') ? host['provision'] : true)
|
23
23
|
(command_line_says && host_says) or (host['hypervisor'] =~/vagrant/)
|
24
24
|
end
|
25
25
|
|
@@ -38,10 +38,10 @@ module Beaker
|
|
38
38
|
cleanup
|
39
39
|
end
|
40
40
|
@hypervisors = {}
|
41
|
-
#sort hosts by their hypervisor, use hypervisor 'none' if no hypervisor is specified
|
41
|
+
#sort hosts by their hypervisor, use hypervisor 'none' if no hypervisor is specified
|
42
42
|
@options['HOSTS'].each_key do |name|
|
43
43
|
host = @options['HOSTS'][name]
|
44
|
-
hypervisor = host['hypervisor']
|
44
|
+
hypervisor = host['hypervisor']
|
45
45
|
hypervisor = provision?(@options, host) ? host['hypervisor'] : 'none'
|
46
46
|
@logger.debug "Hypervisor for #{name} is #{hypervisor}"
|
47
47
|
@machines[hypervisor] = [] unless @machines[hypervisor]
|
@@ -4,8 +4,8 @@ module Beaker
|
|
4
4
|
class CommandLineParser
|
5
5
|
|
6
6
|
# @example Create a CommanLineParser
|
7
|
-
# a = CommandLineParser.new
|
8
|
-
#
|
7
|
+
# a = CommandLineParser.new
|
8
|
+
#
|
9
9
|
# @note All of Beaker's supported command line options are defined here
|
10
10
|
def initialize
|
11
11
|
@cmd_options = Beaker::Options::OptionsHash.new
|
@@ -95,7 +95,7 @@ module Beaker
|
|
95
95
|
end
|
96
96
|
|
97
97
|
opts.on '-i URI', '--install URI',
|
98
|
-
'Install a project repo/app on the SUTs',
|
98
|
+
'Install a project repo/app on the SUTs',
|
99
99
|
'Provide full git URI or use short form KEYWORD/name',
|
100
100
|
'supported keywords: PUPPET, FACTER, HIERA, HIERA-PUPPET' do |value|
|
101
101
|
@cmd_options[:install] = value
|
@@ -176,15 +176,15 @@ module Beaker
|
|
176
176
|
@cmd_options[:validate] = bool
|
177
177
|
end
|
178
178
|
|
179
|
-
opts.on('--version', 'Report currently running version of beaker' ) do
|
179
|
+
opts.on('--version', 'Report currently running version of beaker' ) do
|
180
180
|
@cmd_options[:version] = true
|
181
181
|
end
|
182
182
|
|
183
|
-
opts.on('--parse-only', 'Display beaker parsed options and exit' ) do
|
183
|
+
opts.on('--parse-only', 'Display beaker parsed options and exit' ) do
|
184
184
|
@cmd_options[:parse_only] = true
|
185
185
|
end
|
186
186
|
|
187
|
-
opts.on('--help', 'Display this screen' ) do
|
187
|
+
opts.on('--help', 'Display this screen' ) do
|
188
188
|
@cmd_options[:help] = true
|
189
189
|
end
|
190
190
|
|
@@ -208,25 +208,24 @@ module Beaker
|
|
208
208
|
# @example
|
209
209
|
# args = ['--option', 'value', '--option2', 'value2', '--switch']
|
210
210
|
# parser = CommandLineParser.new
|
211
|
-
# parser.parse
|
211
|
+
# parser.parse(args) == {:option => 'value, :options2 => value, :switch => true}
|
212
212
|
#
|
213
213
|
# @return [Hash] Return the Hash of options
|
214
|
-
def parse
|
215
|
-
@optparse.parse
|
214
|
+
def parse( args = ARGV )
|
215
|
+
@optparse.parse(args)
|
216
216
|
@cmd_options
|
217
217
|
end
|
218
218
|
|
219
219
|
# Generate a string representing the supported arguments
|
220
220
|
#
|
221
|
-
# @example
|
222
|
-
# parser = CommandLineParser.new
|
223
|
-
# parser.usage = "Options: ..."
|
221
|
+
# @example
|
222
|
+
# parser = CommandLineParser.new
|
223
|
+
# parser.usage = "Options: ..."
|
224
224
|
#
|
225
225
|
# @return [String] Return a string representing the available arguments
|
226
226
|
def usage
|
227
227
|
@optparse.help
|
228
228
|
end
|
229
|
-
|
230
229
|
end
|
231
230
|
end
|
232
231
|
end
|
@@ -6,7 +6,7 @@ module Beaker
|
|
6
6
|
# Read the contents of the hosts.cfg into an OptionsHash, merge the 'CONFIG' section into the OptionsHash, return OptionsHash
|
7
7
|
# @param [String] hosts_file_path The path to the hosts file
|
8
8
|
#
|
9
|
-
# @example
|
9
|
+
# @example
|
10
10
|
# hosts_hash = HostsFileParser.parse_hosts_file('sample.cfg')
|
11
11
|
# hosts_hash == {:HOSTS=>{:"pe-ubuntu-lucid"=>{:roles=>["agent", "dashboard", "database", "master"], ... }
|
12
12
|
#
|
@@ -8,22 +8,22 @@ module Beaker
|
|
8
8
|
#
|
9
9
|
# Options file is assumed to contain extra options stored in a Hash
|
10
10
|
#
|
11
|
-
# ie,
|
11
|
+
# ie,
|
12
12
|
# {
|
13
13
|
# :debug => true,
|
14
14
|
# :tests => "test.rb",
|
15
15
|
# }
|
16
|
-
#
|
16
|
+
#
|
17
17
|
# @param [String] options_file_path The path to the options file
|
18
18
|
#
|
19
|
-
# @example
|
19
|
+
# @example
|
20
20
|
# options_hash = OptionsFileParser.parse_options_file('sample.cfg')
|
21
21
|
# options_hash == {:debug=>true, :tests=>"test.rb", :pre_suite=>["pre-suite.rb"], :post_suite=>"post_suite1.rb,post_suite2.rb"}
|
22
22
|
#
|
23
23
|
# @return [OptionsHash] The contents of the options file as an OptionsHash
|
24
24
|
# @raise [ArgumentError] Raises if options_file_path is not a path to a file
|
25
25
|
# @note Since the options_file is Eval'ed, any other Ruby commands will also be executed, this can be used
|
26
|
-
# to set additional environment variables
|
26
|
+
# to set additional environment variables
|
27
27
|
def self.parse_options_file(options_file_path)
|
28
28
|
result = Beaker::Options::OptionsHash.new
|
29
29
|
if options_file_path
|
@@ -5,7 +5,7 @@ module Beaker
|
|
5
5
|
#An Object that parses, merges and normalizes all supported Beaker options and arguments
|
6
6
|
class Parser
|
7
7
|
GITREPO = 'git://github.com/puppetlabs'
|
8
|
-
#These options can have the form of arg1,arg2 or [arg] or just arg,
|
8
|
+
#These options can have the form of arg1,arg2 or [arg] or just arg,
|
9
9
|
#should default to []
|
10
10
|
LONG_OPTS = [:helper, :load_path, :tests, :pre_suite, :post_suite, :install, :modules]
|
11
11
|
#These options expand out into an array of .rb files
|
@@ -139,29 +139,35 @@ module Beaker
|
|
139
139
|
# @param [Array] args ARGV or a provided arguments array
|
140
140
|
# @raise [ArgumentError] Raises error on bad input
|
141
141
|
def parse_args(args = ARGV)
|
142
|
-
#NOTE on argument precedence:
|
143
|
-
#
|
142
|
+
# NOTE on argument precedence:
|
144
143
|
# Will use env, then hosts/config file, then command line, then file options
|
145
|
-
|
144
|
+
|
145
|
+
|
146
146
|
@options = Beaker::Options::Presets.presets
|
147
|
-
cmd_line_options = @command_line_parser.parse
|
147
|
+
cmd_line_options = @command_line_parser.parse(args)
|
148
148
|
file_options = Beaker::Options::OptionsFileParser.parse_options_file(cmd_line_options[:options_file])
|
149
|
+
|
149
150
|
# merge together command line and file_options
|
150
151
|
# overwrite file options with command line options
|
151
152
|
cmd_line_and_file_options = file_options.merge(cmd_line_options)
|
153
|
+
|
152
154
|
# merge command line and file options with defaults
|
153
155
|
# overwrite defaults with command line and file options
|
154
156
|
@options = @options.merge(cmd_line_and_file_options)
|
157
|
+
@options[:command_line] = ([$0] + args).join(' ')
|
155
158
|
|
156
159
|
if not @options[:help] and not @options[:version]
|
157
160
|
#read the hosts file that contains the node configuration and hypervisor info
|
158
161
|
hosts_options = Beaker::Options::HostsFileParser.parse_hosts_file(@options[:hosts_file])
|
162
|
+
|
159
163
|
# merge in host file vars
|
160
164
|
# overwrite options (default, file options, command line, env) with host file options
|
161
165
|
@options = @options.merge(hosts_options)
|
166
|
+
|
162
167
|
# merge in env vars
|
163
168
|
# overwrite options (default, file options, command line, hosts file) with env
|
164
169
|
env_vars = Beaker::Options::Presets.env_vars
|
170
|
+
|
165
171
|
@options = @options.merge(env_vars)
|
166
172
|
|
167
173
|
normalize_args
|
@@ -8,11 +8,11 @@ module Beaker
|
|
8
8
|
# Version file is of the format
|
9
9
|
#
|
10
10
|
# 3.0.1-3-g57b669e
|
11
|
-
#
|
11
|
+
#
|
12
12
|
# @param [String] dist_dir The directory containing the version_file
|
13
13
|
# @param [String] version_file The file to scrape
|
14
14
|
#
|
15
|
-
# @return [String, nil] The PE version in the version_file or nil if not found
|
15
|
+
# @return [String, nil] The PE version in the version_file or nil if not found
|
16
16
|
# @raise [ArgumentError] Raises if version_file does not exist or cannot be opened
|
17
17
|
def self.load_pe_version dist_dir, version_file
|
18
18
|
version = nil
|
data/lib/beaker/platform.rb
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
module Beaker
|
2
|
-
#This class create a Platform object inheriting from String. It supports all String methods while adding
|
2
|
+
#This class create a Platform object inheriting from String. It supports all String methods while adding
|
3
3
|
#several platform-specific use cases.
|
4
4
|
class Platform < String
|
5
5
|
#Supported platforms
|
6
|
-
PLATFORMS = /^(centos|fedora|debian|oracle|redhat|scientific|sles|ubuntu|windows|solaris|aix|el)\-.+\-.+$/
|
6
|
+
PLATFORMS = /^(osx|centos|fedora|debian|oracle|redhat|scientific|sles|ubuntu|windows|solaris|aix|el)\-.+\-.+$/
|
7
7
|
#Platform version numbers vs. codenames conversion hash
|
8
|
-
PLATFORM_VERSION_CODES =
|
8
|
+
PLATFORM_VERSION_CODES =
|
9
9
|
{ :debian => { "wheezy" => "7",
|
10
10
|
"squeeze" => "6",
|
11
11
|
},
|
12
|
-
:ubuntu => { "trusty" => "1404",
|
12
|
+
:ubuntu => { "trusty" => "1404",
|
13
13
|
"saucy" => "1310",
|
14
14
|
"raring" => "1304",
|
15
15
|
"quantal" => "1210",
|
@@ -1,4 +1,4 @@
|
|
1
|
-
module Beaker
|
1
|
+
module Beaker
|
2
2
|
module Shared
|
3
3
|
#Methods for selecting host or hosts that match roles.
|
4
4
|
module HostRoleParser
|
@@ -11,25 +11,25 @@ module Beaker
|
|
11
11
|
hosts.select do |host|
|
12
12
|
desired_role.nil? or host['roles'].include?(desired_role.to_s)
|
13
13
|
end
|
14
|
-
end
|
14
|
+
end
|
15
15
|
|
16
|
-
#Find a single host with the role provided. Raise an error if more than one host is found to have the
|
16
|
+
#Find a single host with the role provided. Raise an error if more than one host is found to have the
|
17
17
|
#provided role.
|
18
18
|
#@param [Array<Host>] hosts The hosts to examine
|
19
19
|
#@param [String] role The host returned will have this role in its role list
|
20
20
|
#@return [Host] The single host with the desired role in its roles list
|
21
|
-
#@raise [ArgumentError] Raised if more than one host has the given role defined, or if no host has the
|
21
|
+
#@raise [ArgumentError] Raised if more than one host has the given role defined, or if no host has the
|
22
22
|
# role defined.
|
23
23
|
def only_host_with_role(hosts, role)
|
24
24
|
a_host = hosts_with_role(hosts, role)
|
25
|
-
case
|
25
|
+
case
|
26
26
|
when a_host.length == 0
|
27
27
|
raise ArgumentError, "There should be one host with #{role} defined!"
|
28
28
|
when a_host.length > 1
|
29
29
|
host_string = ( a_host.map { |host| host.name } ).join( ', ')
|
30
|
-
raise ArgumentError, "There should be only one host with #{role} defined, but I found #{a_host.length} (#{host_string})"
|
30
|
+
raise ArgumentError, "There should be only one host with #{role} defined, but I found #{a_host.length} (#{host_string})"
|
31
31
|
end
|
32
|
-
a_host.first
|
32
|
+
a_host.first
|
33
33
|
end
|
34
34
|
end
|
35
35
|
end
|
@@ -57,7 +57,7 @@ module Beaker
|
|
57
57
|
begin
|
58
58
|
@ssh.close if @ssh
|
59
59
|
rescue
|
60
|
-
@ssh.shutdown!
|
60
|
+
@ssh.shutdown!
|
61
61
|
end
|
62
62
|
@ssh = nil
|
63
63
|
end
|
@@ -103,7 +103,7 @@ module Beaker
|
|
103
103
|
attempt = false
|
104
104
|
puts "Command execution failed, attempting to reconnect to #{@hostname}"
|
105
105
|
close
|
106
|
-
connect
|
106
|
+
connect
|
107
107
|
retry
|
108
108
|
else
|
109
109
|
raise
|
data/lib/beaker/test_suite.rb
CHANGED
data/lib/beaker/version.rb
CHANGED
@@ -116,21 +116,10 @@ module Beaker
|
|
116
116
|
docker.provision
|
117
117
|
end
|
118
118
|
|
119
|
-
it 'should
|
120
|
-
hosts.each do |host|
|
121
|
-
image.should_receive(:tag).with({
|
122
|
-
:repo => host.name,
|
123
|
-
:force => true,
|
124
|
-
})
|
125
|
-
end
|
126
|
-
|
127
|
-
docker.provision
|
128
|
-
end
|
129
|
-
|
130
|
-
it 'should create a container based on the Image (identified by host.name)' do
|
119
|
+
it 'should create a container based on the Image (identified by image.id)' do
|
131
120
|
hosts.each do |host|
|
132
121
|
::Docker::Container.should_receive(:create).with({
|
133
|
-
'Image' =>
|
122
|
+
'Image' => image.id,
|
134
123
|
'Hostname' => host.name,
|
135
124
|
})
|
136
125
|
end
|
@@ -180,6 +169,23 @@ module Beaker
|
|
180
169
|
image.should_receive(:delete)
|
181
170
|
docker.cleanup
|
182
171
|
end
|
172
|
+
|
173
|
+
it 'should not delete the image if docker_preserve_image is set to true' do
|
174
|
+
hosts.each do |host|
|
175
|
+
host['docker_preserve_image']=true
|
176
|
+
end
|
177
|
+
image.should_not_receive(:delete)
|
178
|
+
docker.cleanup
|
179
|
+
end
|
180
|
+
|
181
|
+
it 'should delete the image if docker_preserve_image is set to false' do
|
182
|
+
hosts.each do |host|
|
183
|
+
host['docker_preserve_image']=false
|
184
|
+
end
|
185
|
+
image.should_receive(:delete)
|
186
|
+
docker.cleanup
|
187
|
+
end
|
188
|
+
|
183
189
|
end
|
184
190
|
|
185
191
|
describe '#dockerfile_for' do
|