puppet_litmus 0.14.0 → 0.15.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 815ccaf832ee6fa876fa73222f64246bf39d1510488cd5c655ea880976e94c32
4
- data.tar.gz: 40c94ee82672dd7a48d100d54cdf1091fea06b8b706e69c0382e4dbf5edfdb86
3
+ metadata.gz: 5910db3eed130389c917cfb64116897400905e1d66851f57e16be04d1070b95a
4
+ data.tar.gz: 01066623755c8b944f4362c0829fd46e3aaa13866a206fe17c74a19da3ed8143
5
5
  SHA512:
6
- metadata.gz: 6aa9e819c9d11d3d2f149e29792ee373c715cac86d4f6b2f6620efba1111b27b2fb9756470bed981e3fcf0d9b1897e398390a6dd8215e9d3cced0842311f58bb
7
- data.tar.gz: 14fa50906d8122c789d13a380dc245e41da0106c9ee9b1c7993b62b40de2661aa3a700303dcb2f7194756cbb34d3f143b94fb987d620a21cfd31a73bdf243382
6
+ metadata.gz: 4ce37bbfc92942ee4a50c4cc0831ccd8deac29ec092001c1c82dc3b7a8c57cd1bdb745bb64e224fc0fbc220c458b990b4ea429908a6548a7d18195a63873b3d3
7
+ data.tar.gz: 49b0a06fdf5772a2ed5104108cc4163b96b6eb500f1bf70259052099ab9231ee7d6b7c56bdfdc3af2708229600eda0c9bd41fb53cf5438db8c5f17309e24728a
data/lib/puppet_litmus.rb CHANGED
@@ -8,6 +8,7 @@ require 'puppet_litmus/inventory_manipulation'
8
8
  require 'puppet_litmus/puppet_helpers'
9
9
  require 'puppet_litmus/rake_helper'
10
10
  require 'puppet_litmus/spec_helper_acceptance'
11
+ require 'honeycomb-beeline'
11
12
 
12
13
  # Helper methods for testing puppet content
13
14
  module PuppetLitmus
@@ -15,4 +16,23 @@ module PuppetLitmus
15
16
  include PuppetLitmus::InventoryManipulation
16
17
  include PuppetLitmus::PuppetHelpers
17
18
  include PuppetLitmus::RakeHelper
19
+ Honeycomb.configure do |config|
20
+ end
21
+ process_span = Honeycomb.start_span(name: 'Litmus Testing')
22
+ if ENV['CI'] == 'true' && ENV['TRAVIS'] == 'true'
23
+ process_span.add_field('module_name', ENV['TRAVIS_REPO_SLUG'])
24
+ process_span.add_field('travis_build_id', ENV['TRAVIS_BUILD_ID'])
25
+ process_span.add_field('travis_build_web_url', ENV['TRAVIS_BUILD_WEB_URL'])
26
+ process_span.add_field('travis_commit_message', ENV['TRAVIS_COMMIT_MESSAGE'])
27
+ process_span.add_field('travis_pull_request_sha', ENV['TRAVIS_PULL_REQUEST_SHA'])
28
+ elsif ENV['CI'] == 'True' && ENV['APPVEYOR'] == 'True'
29
+ process_span.add_field('module_name', ENV['APPVEYOR_PROJECT_SLUG'])
30
+ process_span.add_field('appveyor_build_id', ENV['APPVEYOR_BUILD_ID'])
31
+ process_span.add_field('appveyor_url', "https://ci.appveyor.com/project/#{ENV['APPVEYOR_REPO_NAME']}/builds/#{ENV['APPVEYOR_BUILD_ID']}")
32
+ process_span.add_field('appveyor_repo_commit_message', ENV['APPVEYOR_REPO_COMMIT_MESSAGE'])
33
+ process_span.add_field('appveyor_pull_request_head_commit', ENV['APPVEYOR_PULL_REQUEST_HEAD_COMMIT'])
34
+ end
35
+ at_exit do
36
+ process_span.send
37
+ end
18
38
  end
@@ -13,9 +13,11 @@ module PuppetLitmus::InventoryManipulation
13
13
  else
14
14
  inventory_full_path
15
15
  end
16
- raise "There is no inventory file at '#{inventory_full_path}'" unless File.exist?(inventory_full_path)
16
+ raise "There is no inventory file at '#{inventory_full_path}'." unless File.exist?(inventory_full_path)
17
17
 
18
18
  inventory_hash = YAML.load_file(inventory_full_path)
19
+ raise "Inventory file is incompatible (version 2 and up). Try the 'bolt project migrate' command." if inventory_hash.dig('version').nil? || (inventory_hash['version'] < 2)
20
+
19
21
  inventory_hash
20
22
  end
21
23
 
@@ -24,12 +26,13 @@ module PuppetLitmus::InventoryManipulation
24
26
  # @return [Hash] inventory.yaml hash containing only an entry for localhost
25
27
  def localhost_inventory_hash
26
28
  {
29
+ 'version' => 2,
27
30
  'groups' => [
28
31
  {
29
32
  'name' => 'local',
30
- 'nodes' => [
33
+ 'targets' => [
31
34
  {
32
- 'name' => 'litmus_localhost',
35
+ 'uri' => 'litmus_localhost',
33
36
  'config' => { 'transport' => 'local' },
34
37
  'feature' => 'puppet-agent',
35
38
  },
@@ -45,13 +48,11 @@ module PuppetLitmus::InventoryManipulation
45
48
  # @param targets [Array]
46
49
  # @return [Array] array of targets.
47
50
  def find_targets(inventory_hash, targets)
48
- require 'bolt/inventory'
49
- if targets.nil?
50
- inventory = Bolt::Inventory.new(inventory_hash, nil)
51
- targets = inventory.node_names.to_a
52
- else
53
- targets = [targets]
54
- end
51
+ targets = if targets.nil?
52
+ inventory_hash.to_s.scan(%r{uri"=>"(\S*)"}).flatten
53
+ else
54
+ [targets]
55
+ end
55
56
  targets
56
57
  end
57
58
 
@@ -66,8 +67,8 @@ module PuppetLitmus::InventoryManipulation
66
67
  inventory_hash['groups'].each do |group|
67
68
  next unless group['name'] == group_name
68
69
 
69
- group['nodes'].each do |node|
70
- exists = true if node['name'] == node_name
70
+ group['targets'].each do |node|
71
+ exists = true if node['uri'] == node_name
71
72
  end
72
73
  end
73
74
  exists
@@ -89,8 +90,8 @@ module PuppetLitmus::InventoryManipulation
89
90
  # @return [Hash] config for node of name node_name
90
91
  def config_from_node(inventory_hash, node_name)
91
92
  inventory_hash['groups'].each do |group|
92
- group['nodes'].each do |node|
93
- if node['name'] == node_name
93
+ group['targets'].each do |node|
94
+ if node['uri'] == node_name
94
95
  return node['config']
95
96
  end
96
97
  end
@@ -105,8 +106,8 @@ module PuppetLitmus::InventoryManipulation
105
106
  # @return [Hash] facts for node of name node_name
106
107
  def facts_from_node(inventory_hash, node_name)
107
108
  inventory_hash['groups'].each do |group|
108
- group['nodes'].each do |node|
109
- if node['name'] == node_name
109
+ group['targets'].each do |node|
110
+ if node['uri'] == node_name
110
111
  return node['facts']
111
112
  end
112
113
  end
@@ -121,8 +122,8 @@ module PuppetLitmus::InventoryManipulation
121
122
  # @return [Hash] vars for node of name node_name
122
123
  def vars_from_node(inventory_hash, node_name)
123
124
  inventory_hash['groups'].each do |group|
124
- group['nodes'].each do |node|
125
- if node['name'] == node_name
125
+ group['targets'].each do |node|
126
+ if node['uri'] == node_name
126
127
  return node['vars']
127
128
  end
128
129
  end
@@ -141,12 +142,12 @@ module PuppetLitmus::InventoryManipulation
141
142
  if inventory_hash['groups'].any? { |g| g['name'] == group_name }
142
143
  inventory_hash['groups'].each do |group|
143
144
  if group['name'] == group_name
144
- group['nodes'].push node
145
+ group['targets'].push node
145
146
  end
146
147
  end
147
148
  else
148
149
  # add new group
149
- group = { 'name' => group_name, 'nodes' => [node] }
150
+ group = { 'name' => group_name, 'targets' => [node] }
150
151
  inventory_hash['groups'].push group
151
152
  end
152
153
  inventory_hash
@@ -159,7 +160,7 @@ module PuppetLitmus::InventoryManipulation
159
160
  # @return [Hash] inventory_hash with node of node_name removed.
160
161
  def remove_node(inventory_hash, node_name)
161
162
  inventory_hash['groups'].each do |group|
162
- group['nodes'].delete_if { |i| i['name'] == node_name }
163
+ group['targets'].delete_if { |i| i['uri'] == node_name }
163
164
  end
164
165
  inventory_hash
165
166
  end
@@ -213,13 +214,13 @@ module PuppetLitmus::InventoryManipulation
213
214
  group_index = 0
214
215
  inventory_hash['groups'].each do |group|
215
216
  node_index = 0
216
- group['nodes'].each do |node|
217
- if node['name'] == node_name
217
+ group['targets'].each do |node|
218
+ if node['uri'] == node_name
218
219
  if node['features'].nil? == true
219
220
  node = node.merge('features' => [])
220
221
  end
221
222
  node['features'].push feature_name unless node['features'].include?(feature_name)
222
- inventory_hash['groups'][group_index]['nodes'][node_index] = node
223
+ inventory_hash['groups'][group_index]['targets'][node_index] = node
223
224
  end
224
225
  node_index += 1
225
226
  end
@@ -237,8 +238,8 @@ module PuppetLitmus::InventoryManipulation
237
238
  # @return [Hash] inventory_hash with feature added to node if node_name exists in inventory hash.
238
239
  def remove_feature_from_node(inventory_hash, feature_name, node_name)
239
240
  inventory_hash['groups'].each do |group|
240
- group['nodes'].each do |node|
241
- if node['name'] == node_name && node['features'].nil? != true
241
+ group['targets'].each do |node|
242
+ if node['uri'] == node_name && node['features'].nil? != true
242
243
  node['features'].delete(feature_name)
243
244
  end
244
245
  end
@@ -122,19 +122,25 @@ module PuppetLitmus::PuppetHelpers
122
122
  # @yieldreturn [Block] this method will yield to a block of code passed by the caller; this can be used for additional validation, etc.
123
123
  # @return [Object] A result object from the command.
124
124
  def run_shell(command_to_run, opts = {})
125
- target_node_name = targeting_localhost? ? 'litmus_localhost' : ENV['TARGET_HOST']
126
- inventory_hash = File.exist?('inventory.yaml') ? inventory_hash_from_inventory_file : localhost_inventory_hash
127
- raise "Target '#{target_node_name}' not found in inventory.yaml" unless target_in_inventory?(inventory_hash, target_node_name)
128
-
129
- result = run_command(command_to_run, target_node_name, config: nil, inventory: inventory_hash)
130
- raise "shell failed\n`#{command_to_run}`\n======\n#{result}" if result.first['result']['exit_code'] != 0 && opts[:expect_failures] != true
131
-
132
- result = OpenStruct.new(exit_code: result.first['result']['exit_code'],
133
- exit_status: result.first['result']['exit_code'],
134
- stdout: result.first['result']['stdout'],
135
- stderr: result.first['result']['stderr'])
136
- yield result if block_given?
137
- result
125
+ Honeycomb.start_span(name: 'litmus_runshell') do |span|
126
+ target_node_name = targeting_localhost? ? 'litmus_localhost' : ENV['TARGET_HOST']
127
+ inventory_hash = File.exist?('inventory.yaml') ? inventory_hash_from_inventory_file : localhost_inventory_hash
128
+ raise "Target '#{target_node_name}' not found in inventory.yaml" unless target_in_inventory?(inventory_hash, target_node_name)
129
+
130
+ result = run_command(command_to_run, target_node_name, config: nil, inventory: inventory_hash)
131
+ if result.first['result']['exit_code'] != 0 && opts[:expect_failures] != true
132
+ span.add_field('litmus_runshellfailure', result)
133
+ raise "shell failed\n`#{command_to_run}`\n======\n#{result}"
134
+ end
135
+
136
+ result = OpenStruct.new(exit_code: result.first['result']['exit_code'],
137
+ exit_status: result.first['result']['exit_code'],
138
+ stdout: result.first['result']['stdout'],
139
+ stderr: result.first['result']['stderr'])
140
+ yield result if block_given?
141
+ span.add_field('litmus_runshellsuccess', result)
142
+ result
143
+ end
138
144
  end
139
145
 
140
146
  # Copies file to the target, using its respective transport
@@ -145,31 +151,37 @@ module PuppetLitmus::PuppetHelpers
145
151
  # @yieldreturn [Block] this method will yield to a block of code passed by the caller; this can be used for additional validation, etc.
146
152
  # @return [Object] A result object from the command.
147
153
  def bolt_upload_file(source, destination, opts = {}, options = {})
148
- target_node_name = targeting_localhost? ? 'litmus_localhost' : ENV['TARGET_HOST']
149
- inventory_hash = File.exist?('inventory.yaml') ? inventory_hash_from_inventory_file : localhost_inventory_hash
150
- raise "Target '#{target_node_name}' not found in inventory.yaml" unless target_in_inventory?(inventory_hash, target_node_name)
151
-
152
- result = upload_file(source, destination, target_node_name, options: options, config: nil, inventory: inventory_hash)
153
-
154
- result_obj = {
155
- exit_code: 0,
156
- stdout: result.first['result']['_output'],
157
- stderr: nil,
158
- result: result.first['result'],
159
- }
160
-
161
- if result.first['status'] != 'success'
162
- raise "upload file failed\n======\n#{result}" if opts[:expect_failures] != true
163
-
164
- result_obj[:exit_code] = 255
165
- result_obj[:stderr] = result.first['result']['_error']['msg']
154
+ Honeycomb.start_span(name: 'litmus_uploadfile') do |span|
155
+ target_node_name = targeting_localhost? ? 'litmus_localhost' : ENV['TARGET_HOST']
156
+ inventory_hash = File.exist?('inventory.yaml') ? inventory_hash_from_inventory_file : localhost_inventory_hash
157
+ raise "Target '#{target_node_name}' not found in inventory.yaml" unless target_in_inventory?(inventory_hash, target_node_name)
158
+
159
+ result = upload_file(source, destination, target_node_name, options: options, config: nil, inventory: inventory_hash)
160
+
161
+ result_obj = {
162
+ exit_code: 0,
163
+ stdout: result.first['result']['_output'],
164
+ stderr: nil,
165
+ result: result.first['result'],
166
+ }
167
+
168
+ if result.first['status'] != 'success'
169
+ if opts[:expect_failures] != true
170
+ span.add_field('litmus_uploadfilefailure', result)
171
+ raise "upload file failed\n======\n#{result}"
172
+ end
173
+
174
+ result_obj[:exit_code] = 255
175
+ result_obj[:stderr] = result.first['result']['_error']['msg']
176
+ end
177
+
178
+ result = OpenStruct.new(exit_code: result_obj[:exit_code],
179
+ stdout: result_obj[:stdout],
180
+ stderr: result_obj[:stderr])
181
+ yield result if block_given?
182
+ span.add_field('litmus_uploadfilesucess', result)
183
+ result
166
184
  end
167
-
168
- result = OpenStruct.new(exit_code: result_obj[:exit_code],
169
- stdout: result_obj[:stdout],
170
- stderr: result_obj[:stderr])
171
- yield result if block_given?
172
- result
173
185
  end
174
186
 
175
187
  # rubocop:disable Layout/TrailingWhitespace
@@ -184,50 +196,56 @@ module PuppetLitmus::PuppetHelpers
184
196
  # @return [Object] A result object from the task.The values available are stdout, stderr and result.
185
197
  # rubocop:enable Layout/TrailingWhitespace
186
198
  def run_bolt_task(task_name, params = {}, opts = {})
187
- config_data = { 'modulepath' => File.join(Dir.pwd, 'spec', 'fixtures', 'modules') }
188
- target_node_name = targeting_localhost? ? 'litmus_localhost' : ENV['TARGET_HOST']
189
- inventory_hash = if !opts[:inventory_file].nil? && File.exist?(opts[:inventory_file])
190
- inventory_hash_from_inventory_file(opts[:inventory_file])
191
- elsif File.exist?('inventory.yaml')
192
- inventory_hash_from_inventory_file('inventory.yaml')
193
- else
194
- localhost_inventory_hash
195
- end
196
- raise "Target '#{target_node_name}' not found in inventory.yaml" unless target_in_inventory?(inventory_hash, target_node_name)
197
-
198
- result = run_task(task_name, target_node_name, params, config: config_data, inventory: inventory_hash)
199
- result_obj = {
200
- exit_code: 0,
201
- stdout: nil,
202
- stderr: nil,
203
- result: result.first['result'],
204
- }
205
-
206
- if result.first['status'] == 'success'
207
- # stdout returns unstructured data if structured data is not available
208
- result_obj[:stdout] = if result.first['result']['_output'].nil?
209
- result.first['result'].to_s
210
- else
211
- result.first['result']['_output']
212
- end
213
-
214
- else
215
- raise "task failed\n`#{task_name}`\n======\n#{result}" if opts[:expect_failures] != true
216
-
217
- result_obj[:exit_code] = if result.first['result']['_error']['details'].nil?
218
- 255
219
- else
220
- result.first['result']['_error']['details'].fetch('exitcode', 255)
221
- end
222
- result_obj[:stderr] = result.first['result']['_error']['msg']
199
+ Honeycomb.start_span(name: 'litmus_runtask') do |span|
200
+ config_data = { 'modulepath' => File.join(Dir.pwd, 'spec', 'fixtures', 'modules') }
201
+ target_node_name = targeting_localhost? ? 'litmus_localhost' : ENV['TARGET_HOST']
202
+ inventory_hash = if !opts[:inventory_file].nil? && File.exist?(opts[:inventory_file])
203
+ inventory_hash_from_inventory_file(opts[:inventory_file])
204
+ elsif File.exist?('inventory.yaml')
205
+ inventory_hash_from_inventory_file('inventory.yaml')
206
+ else
207
+ localhost_inventory_hash
208
+ end
209
+ raise "Target '#{target_node_name}' not found in inventory.yaml" unless target_in_inventory?(inventory_hash, target_node_name)
210
+
211
+ result = run_task(task_name, target_node_name, params, config: config_data, inventory: inventory_hash)
212
+ result_obj = {
213
+ exit_code: 0,
214
+ stdout: nil,
215
+ stderr: nil,
216
+ result: result.first['result'],
217
+ }
218
+
219
+ if result.first['status'] == 'success'
220
+ # stdout returns unstructured data if structured data is not available
221
+ result_obj[:stdout] = if result.first['result']['_output'].nil?
222
+ result.first['result'].to_s
223
+ else
224
+ result.first['result']['_output']
225
+ end
226
+
227
+ else
228
+ if opts[:expect_failures] != true
229
+ span.add_field('litmus_runtaskfailure', result)
230
+ raise "task failed\n`#{task_name}`\n======\n#{result}"
231
+ end
232
+
233
+ result_obj[:exit_code] = if result.first['result']['_error']['details'].nil?
234
+ 255
235
+ else
236
+ result.first['result']['_error']['details'].fetch('exitcode', 255)
237
+ end
238
+ result_obj[:stderr] = result.first['result']['_error']['msg']
239
+ end
240
+
241
+ result = OpenStruct.new(exit_code: result_obj[:exit_code],
242
+ stdout: result_obj[:stdout],
243
+ stderr: result_obj[:stderr],
244
+ result: result_obj[:result])
245
+ yield result if block_given?
246
+ span.add_field('litmus_runtasksuccess', result)
247
+ result
223
248
  end
224
-
225
- result = OpenStruct.new(exit_code: result_obj[:exit_code],
226
- stdout: result_obj[:stdout],
227
- stderr: result_obj[:stderr],
228
- result: result_obj[:result])
229
- yield result if block_given?
230
- result
231
249
  end
232
250
 
233
251
  # Runs a script against the target system.
@@ -238,19 +256,25 @@ module PuppetLitmus::PuppetHelpers
238
256
  # @yieldreturn [Block] this method will yield to a block of code passed by the caller; this can be used for additional validation, etc.
239
257
  # @return [Object] A result object from the script run.
240
258
  def bolt_run_script(script, opts = {}, arguments: [])
241
- target_node_name = targeting_localhost? ? 'litmus_localhost' : ENV['TARGET_HOST']
242
- inventory_hash = File.exist?('inventory.yaml') ? inventory_hash_from_inventory_file : localhost_inventory_hash
243
- raise "Target '#{target_node_name}' not found in inventory.yaml" unless target_in_inventory?(inventory_hash, target_node_name)
244
-
245
- result = run_script(script, target_node_name, arguments, options: opts, config: nil, inventory: inventory_hash)
246
-
247
- raise "script run failed\n`#{script}`\n======\n#{result}" if result.first['result']['exit_code'] != 0 && opts[:expect_failures] != true
248
-
249
- result = OpenStruct.new(exit_code: result.first['result']['exit_code'],
250
- stdout: result.first['result']['stdout'],
251
- stderr: result.first['result']['stderr'])
252
- yield result if block_given?
253
- result
259
+ Honeycomb.start_span(name: 'litmus_runscript') do |span|
260
+ target_node_name = targeting_localhost? ? 'litmus_localhost' : ENV['TARGET_HOST']
261
+ inventory_hash = File.exist?('inventory.yaml') ? inventory_hash_from_inventory_file : localhost_inventory_hash
262
+ raise "Target '#{target_node_name}' not found in inventory.yaml" unless target_in_inventory?(inventory_hash, target_node_name)
263
+
264
+ result = run_script(script, target_node_name, arguments, options: opts, config: nil, inventory: inventory_hash)
265
+
266
+ if result.first['result']['exit_code'] != 0 && opts[:expect_failures] != true
267
+ span.add_field('litmus_runscriptfailure', result)
268
+ raise "script run failed\n`#{script}`\n======\n#{result}"
269
+ end
270
+
271
+ result = OpenStruct.new(exit_code: result.first['result']['exit_code'],
272
+ stdout: result.first['result']['stdout'],
273
+ stderr: result.first['result']['stderr'])
274
+ yield result if block_given?
275
+ span.add_field('litmus_runscriptsuccess', result)
276
+ result
277
+ end
254
278
  end
255
279
 
256
280
  # Determines if the current execution is targeting localhost or not
@@ -150,7 +150,8 @@ module PuppetLitmus::RakeHelper
150
150
  end
151
151
  raise "puppet_agent was not found in #{DEFAULT_CONFIG_DATA['modulepath']}, please amend the .fixtures.yml file" unless File.directory?(File.join(DEFAULT_CONFIG_DATA['modulepath'], 'puppet_agent'))
152
152
 
153
- run_task('puppet_agent::install', targets, params, config: DEFAULT_CONFIG_DATA, inventory: inventory_hash)
153
+ # using boltspec, when the runner is called it changes the inventory_hash dropping the version field. The clone works around this
154
+ run_task('puppet_agent::install', targets, params, config: DEFAULT_CONFIG_DATA, inventory: inventory_hash.clone)
154
155
  end
155
156
 
156
157
  def configure_path(inventory_hash)
@@ -135,6 +135,33 @@ namespace :litmus do
135
135
  end
136
136
  end
137
137
 
138
+ # Add a given feature to a selection of nodes
139
+ #
140
+ # @param :target_node_name [Array] nodes on which to add the feature.
141
+ # @param :added_feature [String] the feature which you wish to add.
142
+ desc 'add_feature, [:added_feature, :target_node_name]'
143
+ task :add_feature, [:added_feature, :target_node_name] do |_task, args|
144
+ inventory_hash = inventory_hash_from_inventory_file
145
+ targets = find_targets(inventory_hash, args[:target_node_name])
146
+ if targets.empty?
147
+ puts 'No targets found'
148
+ exit 0
149
+ end
150
+ if args[:added_feature].nil? || args[:added_feature] == ''
151
+ puts 'No feature given'
152
+ exit 0
153
+ end
154
+ puts 'add_feature'
155
+
156
+ targets.each do |target|
157
+ inventory_hash = add_feature_to_node(inventory_hash, args[:added_feature], target)
158
+ end
159
+
160
+ write_to_inventory_file(inventory_hash, 'inventory.yaml')
161
+
162
+ puts 'Feature added'
163
+ end
164
+
138
165
  # Install the puppet modules from a source directory to nodes. It does not install dependencies.
139
166
  #
140
167
  # @param :source [String] source directory to look in (ignores symlinks) defaults do './spec/fixtures/modules'.
@@ -400,6 +427,7 @@ namespace :litmus do
400
427
  host = 'localhost'
401
428
  RSpec::Core::RakeTask.new(host.to_sym) do |t|
402
429
  t.pattern = 'spec/acceptance/**{,/*/**}/*_spec.rb'
430
+ Rake::Task['spec_prep'].invoke
403
431
  ENV['TARGET_HOST'] = host
404
432
  end
405
433
  end
@@ -2,5 +2,5 @@
2
2
 
3
3
  # version of this gem
4
4
  module PuppetLitmus
5
- VERSION ||= '0.14.0'
5
+ VERSION ||= '0.15.0'
6
6
  end
@@ -1,8 +1,8 @@
1
1
  ---
2
2
  groups:
3
3
  - name: ssh_nodes
4
- nodes:
5
- - name: test.delivery.puppetlabs.net
4
+ targets:
5
+ - uri: test.delivery.puppetlabs.net
6
6
  config:
7
7
  transport: ssh
8
8
  ssh:
@@ -13,4 +13,4 @@ groups:
13
13
  provisioner: vmpooler
14
14
  platform: centos-5-x86_64
15
15
  - name: winrm_nodes
16
- nodes: []
16
+ targets: []
data/spec/data/jim.yaml CHANGED
@@ -1,8 +1,8 @@
1
1
  ---
2
2
  groups:
3
3
  - name: ssh_nodes
4
- nodes:
5
- - name: test.delivery.puppetlabs.net
4
+ targets:
5
+ - uri: test.delivery.puppetlabs.net
6
6
  config:
7
7
  transport: ssh
8
8
  ssh:
@@ -9,27 +9,27 @@ RSpec.describe PuppetLitmus::InventoryManipulation do
9
9
  let(:no_config_hash) do
10
10
  { 'groups' =>
11
11
  [{ 'name' => 'ssh_nodes',
12
- 'nodes' =>
13
- [{ 'name' => 'test.delivery.puppetlabs.net',
12
+ 'targets' =>
13
+ [{ 'uri' => 'test.delivery.puppetlabs.net',
14
14
  'facts' => { 'provisioner' => 'vmpooler', 'platform' => 'centos-5-x86_64' } }] },
15
- { 'name' => 'winrm_nodes', 'nodes' => [] }] }
15
+ { 'name' => 'winrm_nodes', 'targets' => [] }] }
16
16
  end
17
17
 
18
18
  let(:no_docker_hash) do
19
19
  { 'groups' =>
20
- [{ 'name' => 'ssh_nodes', 'nodes' => [] },
21
- { 'name' => 'winrm_nodes', 'nodes' => [] }] }
20
+ [{ 'name' => 'ssh_nodes', 'targets' => [] },
21
+ { 'name' => 'winrm_nodes', 'targets' => [] }] }
22
22
  end
23
23
 
24
24
  let(:config_hash) do
25
25
  { 'groups' =>
26
26
  [{ 'name' => 'ssh_nodes',
27
- 'nodes' =>
28
- [{ 'name' => 'test.delivery.puppetlabs.net',
27
+ 'targets' =>
28
+ [{ 'uri' => 'test.delivery.puppetlabs.net',
29
29
  'config' => { 'transport' => 'ssh', 'ssh' => { 'user' => 'root', 'password' => 'Qu@lity!', 'host-key-check' => false } },
30
30
  'facts' => { 'provisioner' => 'vmpooler', 'platform' => 'centos-5-x86_64' },
31
31
  'vars' => { 'role' => 'agent' } }] },
32
- { 'name' => 'winrm_nodes', 'nodes' => [] }] }
32
+ { 'name' => 'winrm_nodes', 'targets' => [] }] }
33
33
  end
34
34
 
35
35
  let(:inventory_full_path) { 'spec/data/inventory.yaml' }
@@ -37,59 +37,59 @@ RSpec.describe PuppetLitmus::InventoryManipulation do
37
37
  let(:no_feature_hash) do
38
38
  { 'groups' =>
39
39
  [{ 'name' => 'ssh_nodes',
40
- 'nodes' =>
41
- [{ 'name' => 'test.delivery.puppetlabs.net',
40
+ 'targets' =>
41
+ [{ 'uri' => 'test.delivery.puppetlabs.net',
42
42
  'config' => { 'transport' => 'ssh', 'ssh' => { 'user' => 'root', 'password' => 'Qu@lity!', 'host-key-check' => false } },
43
43
  'facts' => { 'provisioner' => 'vmpooler', 'platform' => 'centos-5-x86_64' } }] },
44
- { 'name' => 'winrm_nodes', 'nodes' => [] }] }
44
+ { 'name' => 'winrm_nodes', 'targets' => [] }] }
45
45
  end
46
46
 
47
47
  let(:feature_hash_group) do
48
48
  { 'groups' =>
49
49
  [{ 'name' => 'ssh_nodes',
50
- 'nodes' =>
51
- [{ 'name' => 'test.delivery.puppetlabs.net',
50
+ 'targets' =>
51
+ [{ 'uri' => 'test.delivery.puppetlabs.net',
52
52
  'config' => { 'transport' => 'ssh', 'ssh' => { 'user' => 'root', 'password' => 'Qu@lity!', 'host-key-check' => false } },
53
53
  'facts' => { 'provisioner' => 'vmpooler', 'platform' => 'centos-5-x86_64' } }],
54
54
  'features' => ['puppet-agent'] },
55
- { 'name' => 'winrm_nodes', 'nodes' => [] }] }
55
+ { 'name' => 'winrm_nodes', 'targets' => [] }] }
56
56
  end
57
57
 
58
58
  let(:empty_feature_hash_group) do
59
59
  { 'groups' =>
60
60
  [{ 'name' => 'ssh_nodes',
61
- 'nodes' =>
62
- [{ 'name' => 'test.delivery.puppetlabs.net',
61
+ 'targets' =>
62
+ [{ 'uri' => 'test.delivery.puppetlabs.net',
63
63
  'config' => { 'transport' => 'ssh', 'ssh' => { 'user' => 'root', 'password' => 'Qu@lity!', 'host-key-check' => false } },
64
64
  'facts' => { 'provisioner' => 'vmpooler', 'platform' => 'centos-5-x86_64' } }],
65
65
  'features' => [] },
66
- { 'name' => 'winrm_nodes', 'nodes' => [] }] }
66
+ { 'name' => 'winrm_nodes', 'targets' => [] }] }
67
67
  end
68
68
 
69
69
  let(:feature_hash_node) do
70
70
  { 'groups' =>
71
71
  [{ 'name' => 'ssh_nodes',
72
- 'nodes' =>
73
- [{ 'name' => 'test.delivery.puppetlabs.net',
72
+ 'targets' =>
73
+ [{ 'uri' => 'test.delivery.puppetlabs.net',
74
74
  'config' => { 'transport' => 'ssh', 'ssh' => { 'user' => 'root', 'password' => 'Qu@lity!', 'host-key-check' => false } },
75
75
  'facts' => { 'provisioner' => 'vmpooler', 'platform' => 'centos-5-x86_64' },
76
76
  'features' => ['puppet-agent'] }] },
77
- { 'name' => 'winrm_nodes', 'nodes' => [] }] }
77
+ { 'name' => 'winrm_nodes', 'targets' => [] }] }
78
78
  end
79
79
 
80
80
  let(:empty_feature_hash_node) do
81
81
  { 'groups' =>
82
82
  [{ 'name' => 'ssh_nodes',
83
- 'nodes' =>
84
- [{ 'name' => 'test.delivery.puppetlabs.net',
83
+ 'targets' =>
84
+ [{ 'uri' => 'test.delivery.puppetlabs.net',
85
85
  'config' => { 'transport' => 'ssh', 'ssh' => { 'user' => 'root', 'password' => 'Qu@lity!', 'host-key-check' => false } },
86
86
  'facts' => { 'provisioner' => 'vmpooler', 'platform' => 'centos-5-x86_64' },
87
87
  'features' => [] }] },
88
- { 'name' => 'winrm_nodes', 'nodes' => [] }] }
88
+ { 'name' => 'winrm_nodes', 'targets' => [] }] }
89
89
  end
90
90
 
91
91
  let(:foo_node) do
92
- { 'name' => 'foo',
92
+ { 'uri' => 'foo',
93
93
  'facts' => { 'provisioner' => 'bar', 'platform' => 'ubuntu' } }
94
94
  end
95
95
 
@@ -115,11 +115,11 @@ RSpec.describe PuppetLitmus::InventoryManipulation do
115
115
  end
116
116
 
117
117
  it 'no feature exists for the group, and returns hash with feature added' do
118
- expect(described_class.add_feature_to_group(no_feature_hash, 'puppet-agent', 'ssh_nodes')).to eq('groups' => [{ 'features' => ['puppet-agent'], 'name' => 'ssh_nodes', 'nodes' => [{ 'config' => { 'ssh' => { 'host-key-check' => false, 'password' => 'Qu@lity!', 'user' => 'root' }, 'transport' => 'ssh' }, 'facts' => { 'platform' => 'centos-5-x86_64', 'provisioner' => 'vmpooler' }, 'name' => 'test.delivery.puppetlabs.net' }] }, { 'name' => 'winrm_nodes', 'nodes' => [] }]) # rubocop:disable Metrics/LineLength: Line is too long
118
+ expect(described_class.add_feature_to_group(no_feature_hash, 'puppet-agent', 'ssh_nodes')).to eq('groups' => [{ 'features' => ['puppet-agent'], 'name' => 'ssh_nodes', 'targets' => [{ 'config' => { 'ssh' => { 'host-key-check' => false, 'password' => 'Qu@lity!', 'user' => 'root' }, 'transport' => 'ssh' }, 'facts' => { 'platform' => 'centos-5-x86_64', 'provisioner' => 'vmpooler' }, 'uri' => 'test.delivery.puppetlabs.net' }] }, { 'name' => 'winrm_nodes', 'targets' => [] }]) # rubocop:disable Metrics/LineLength: Line is too long
119
119
  end
120
120
 
121
121
  it 'feature exists for the group, and returns hash with feature removed' do
122
- expect(described_class.remove_feature_from_group(feature_hash_group, 'puppet-agent', 'ssh_nodes')).to eq('groups' => [{ 'features' => [], 'name' => 'ssh_nodes', 'nodes' => [{ 'config' => { 'ssh' => { 'host-key-check' => false, 'password' => 'Qu@lity!', 'user' => 'root' }, 'transport' => 'ssh' }, 'facts' => { 'platform' => 'centos-5-x86_64', 'provisioner' => 'vmpooler' }, 'name' => 'test.delivery.puppetlabs.net' }] }, { 'name' => 'winrm_nodes', 'nodes' => [] }]) # rubocop:disable Metrics/LineLength: Line is too long
122
+ expect(described_class.remove_feature_from_group(feature_hash_group, 'puppet-agent', 'ssh_nodes')).to eq('groups' => [{ 'features' => [], 'name' => 'ssh_nodes', 'targets' => [{ 'config' => { 'ssh' => { 'host-key-check' => false, 'password' => 'Qu@lity!', 'user' => 'root' }, 'transport' => 'ssh' }, 'facts' => { 'platform' => 'centos-5-x86_64', 'provisioner' => 'vmpooler' }, 'uri' => 'test.delivery.puppetlabs.net' }] }, { 'name' => 'winrm_nodes', 'targets' => [] }]) # rubocop:disable Metrics/LineLength: Line is too long
123
123
  end
124
124
 
125
125
  it 'write from inventory_hash to inventory_yaml file feature_hash_group' do
@@ -127,15 +127,15 @@ RSpec.describe PuppetLitmus::InventoryManipulation do
127
127
  end
128
128
 
129
129
  it 'empty feature exists for the group, and returns hash with feature added' do
130
- expect(described_class.add_feature_to_group(empty_feature_hash_group, 'puppet-agent', 'ssh_nodes')).to eq('groups' => [{ 'features' => ['puppet-agent'], 'name' => 'ssh_nodes', 'nodes' => [{ 'config' => { 'ssh' => { 'host-key-check' => false, 'password' => 'Qu@lity!', 'user' => 'root' }, 'transport' => 'ssh' }, 'facts' => { 'platform' => 'centos-5-x86_64', 'provisioner' => 'vmpooler' }, 'name' => 'test.delivery.puppetlabs.net' }] }, { 'name' => 'winrm_nodes', 'nodes' => [] }]) # rubocop:disable Metrics/LineLength: Line is too long
130
+ expect(described_class.add_feature_to_group(empty_feature_hash_group, 'puppet-agent', 'ssh_nodes')).to eq('groups' => [{ 'features' => ['puppet-agent'], 'name' => 'ssh_nodes', 'targets' => [{ 'config' => { 'ssh' => { 'host-key-check' => false, 'password' => 'Qu@lity!', 'user' => 'root' }, 'transport' => 'ssh' }, 'facts' => { 'platform' => 'centos-5-x86_64', 'provisioner' => 'vmpooler' }, 'uri' => 'test.delivery.puppetlabs.net' }] }, { 'name' => 'winrm_nodes', 'targets' => [] }]) # rubocop:disable Metrics/LineLength: Line is too long
131
131
  end
132
132
 
133
133
  it 'no feature exists for the node, and returns hash with feature added' do
134
- expect(described_class.add_feature_to_node(no_feature_hash, 'puppet-agent', 'test.delivery.puppetlabs.net')).to eq('groups' => [{ 'name' => 'ssh_nodes', 'nodes' => [{ 'config' => { 'ssh' => { 'host-key-check' => false, 'password' => 'Qu@lity!', 'user' => 'root' }, 'transport' => 'ssh' }, 'facts' => { 'platform' => 'centos-5-x86_64', 'provisioner' => 'vmpooler' }, 'name' => 'test.delivery.puppetlabs.net', 'features' => ['puppet-agent'] }] }, { 'name' => 'winrm_nodes', 'nodes' => [] }]) # rubocop:disable Metrics/LineLength: Line is too long
134
+ expect(described_class.add_feature_to_node(no_feature_hash, 'puppet-agent', 'test.delivery.puppetlabs.net')).to eq('groups' => [{ 'name' => 'ssh_nodes', 'targets' => [{ 'config' => { 'ssh' => { 'host-key-check' => false, 'password' => 'Qu@lity!', 'user' => 'root' }, 'transport' => 'ssh' }, 'facts' => { 'platform' => 'centos-5-x86_64', 'provisioner' => 'vmpooler' }, 'uri' => 'test.delivery.puppetlabs.net', 'features' => ['puppet-agent'] }] }, { 'name' => 'winrm_nodes', 'targets' => [] }]) # rubocop:disable Metrics/LineLength: Line is too long
135
135
  end
136
136
 
137
137
  it 'feature exists for the node, and returns hash with feature removed' do
138
- expect(described_class.remove_feature_from_node(feature_hash_node, 'puppet-agent', 'test.delivery.puppetlabs.net')).to eq('groups' => [{ 'name' => 'ssh_nodes', 'nodes' => [{ 'config' => { 'ssh' => { 'host-key-check' => false, 'password' => 'Qu@lity!', 'user' => 'root' }, 'transport' => 'ssh' }, 'facts' => { 'platform' => 'centos-5-x86_64', 'provisioner' => 'vmpooler' }, 'name' => 'test.delivery.puppetlabs.net', 'features' => [] }] }, { 'name' => 'winrm_nodes', 'nodes' => [] }]) # rubocop:disable Metrics/LineLength: Line is too long
138
+ expect(described_class.remove_feature_from_node(feature_hash_node, 'puppet-agent', 'test.delivery.puppetlabs.net')).to eq('groups' => [{ 'name' => 'ssh_nodes', 'targets' => [{ 'config' => { 'ssh' => { 'host-key-check' => false, 'password' => 'Qu@lity!', 'user' => 'root' }, 'transport' => 'ssh' }, 'facts' => { 'platform' => 'centos-5-x86_64', 'provisioner' => 'vmpooler' }, 'uri' => 'test.delivery.puppetlabs.net', 'features' => [] }] }, { 'name' => 'winrm_nodes', 'targets' => [] }]) # rubocop:disable Metrics/LineLength: Line is too long
139
139
  end
140
140
 
141
141
  it 'write from inventory_hash to inventory_yaml file feature_hash_node' do
@@ -143,7 +143,7 @@ RSpec.describe PuppetLitmus::InventoryManipulation do
143
143
  end
144
144
 
145
145
  it 'empty feature exists for the node, and returns hash with feature added' do
146
- expect(described_class.add_feature_to_node(empty_feature_hash_node, 'puppet-agent', 'test.delivery.puppetlabs.net')).to eq('groups' => [{ 'name' => 'ssh_nodes', 'nodes' => [{ 'config' => { 'ssh' => { 'host-key-check' => false, 'password' => 'Qu@lity!', 'user' => 'root' }, 'transport' => 'ssh' }, 'facts' => { 'platform' => 'centos-5-x86_64', 'provisioner' => 'vmpooler' }, 'name' => 'test.delivery.puppetlabs.net', 'features' => ['puppet-agent'] }] }, { 'name' => 'winrm_nodes', 'nodes' => [] }]) # rubocop:disable Metrics/LineLength: Line is too long
146
+ expect(described_class.add_feature_to_node(empty_feature_hash_node, 'puppet-agent', 'test.delivery.puppetlabs.net')).to eq('groups' => [{ 'name' => 'ssh_nodes', 'targets' => [{ 'config' => { 'ssh' => { 'host-key-check' => false, 'password' => 'Qu@lity!', 'user' => 'root' }, 'transport' => 'ssh' }, 'facts' => { 'platform' => 'centos-5-x86_64', 'provisioner' => 'vmpooler' }, 'uri' => 'test.delivery.puppetlabs.net', 'features' => ['puppet-agent'] }] }, { 'name' => 'winrm_nodes', 'targets' => [] }]) # rubocop:disable Metrics/LineLength: Line is too long
147
147
  end
148
148
 
149
149
  it 'write from inventory_hash to inventory_yaml file no feature_hash' do
@@ -153,12 +153,12 @@ RSpec.describe PuppetLitmus::InventoryManipulation do
153
153
 
154
154
  it 'group does not exist in inventory, and returns hash with group added' do
155
155
  expect(described_class.add_node_to_group(no_docker_hash, foo_node, 'docker_nodes')).to eq('groups' =>
156
- [{ 'name' => 'ssh_nodes', 'nodes' => [] }, { 'name' => 'winrm_nodes', 'nodes' => [] }, { 'name' => 'docker_nodes', 'nodes' => [foo_node] }])
156
+ [{ 'name' => 'ssh_nodes', 'targets' => [] }, { 'name' => 'winrm_nodes', 'targets' => [] }, { 'name' => 'docker_nodes', 'targets' => [foo_node] }])
157
157
  end
158
158
 
159
159
  it 'group exists in inventory, and returns hash with node added' do
160
160
  expect(described_class.add_node_to_group(no_docker_hash, foo_node, 'ssh_nodes')).to eq('groups' =>
161
- [{ 'name' => 'ssh_nodes', 'nodes' => [foo_node] }, { 'name' => 'winrm_nodes', 'nodes' => [] }])
161
+ [{ 'name' => 'ssh_nodes', 'targets' => [foo_node] }, { 'name' => 'winrm_nodes', 'targets' => [] }])
162
162
  end
163
163
  end
164
164
  end
@@ -31,8 +31,8 @@ RSpec.describe PuppetLitmus::RakeHelper do
31
31
  context 'with tear_down' do
32
32
  let(:inventory_hash) do
33
33
  { 'groups' =>
34
- [{ 'name' => 'ssh_nodes', 'nodes' =>
35
- [{ 'name' => 'some.host', 'facts' => { 'provisioner' => 'docker', 'container_name' => 'foo', 'platform' => 'some.host' } }] }] }
34
+ [{ 'name' => 'ssh_nodes', 'targets' =>
35
+ [{ 'uri' => 'some.host', 'facts' => { 'provisioner' => 'docker', 'container_name' => 'foo', 'platform' => 'some.host' } }] }] }
36
36
  end
37
37
  let(:targets) { ['some.host'] }
38
38
  let(:params) { { 'action' => 'tear_down', 'node_name' => 'some.host', 'inventory' => Dir.pwd } }
@@ -47,8 +47,8 @@ RSpec.describe PuppetLitmus::RakeHelper do
47
47
  context 'with install_agent' do
48
48
  let(:inventory_hash) do
49
49
  { 'groups' =>
50
- [{ 'name' => 'ssh_nodes', 'nodes' =>
51
- [{ 'name' => 'some.host', 'facts' => { 'provisioner' => 'docker', 'container_name' => 'foo', 'platform' => 'some.host' } }] }] }
50
+ [{ 'name' => 'ssh_nodes', 'targets' =>
51
+ [{ 'uri' => 'some.host', 'facts' => { 'provisioner' => 'docker', 'container_name' => 'foo', 'platform' => 'some.host' } }] }] }
52
52
  end
53
53
  let(:targets) { ['some.host'] }
54
54
  let(:params) { { 'collection' => 'puppet6' } }
@@ -62,9 +62,10 @@ RSpec.describe PuppetLitmus::RakeHelper do
62
62
 
63
63
  context 'with install_module' do
64
64
  let(:inventory_hash) do
65
- { 'groups' =>
66
- [{ 'name' => 'ssh_nodes', 'nodes' =>
67
- [{ 'name' => 'some.host', 'facts' => { 'provisioner' => 'docker', 'container_name' => 'foo', 'platform' => 'some.host' } }] }] }
65
+ { 'version' => 2,
66
+ 'groups' =>
67
+ [{ 'name' => 'ssh_nodes', 'targets' =>
68
+ [{ 'uri' => 'some.host', 'facts' => { 'provisioner' => 'docker', 'container_name' => 'foo', 'platform' => 'some.host' } }] }] }
68
69
  end
69
70
  let(:module_tar) { '/tmp/foo.tar.gz' }
70
71
  let(:targets) { ['some.host'] }
@@ -81,8 +82,8 @@ RSpec.describe PuppetLitmus::RakeHelper do
81
82
  context 'with check_connectivity' do
82
83
  let(:inventory_hash) do
83
84
  { 'groups' =>
84
- [{ 'name' => 'ssh_nodes', 'nodes' =>
85
- [{ 'name' => 'some.host', 'facts' => { 'provisioner' => 'docker', 'container_name' => 'foo', 'platform' => 'some.host' } }] }] }
85
+ [{ 'name' => 'ssh_nodes', 'targets' =>
86
+ [{ 'uri' => 'some.host', 'facts' => { 'provisioner' => 'docker', 'container_name' => 'foo', 'platform' => 'some.host' } }] }] }
86
87
  end
87
88
  let(:targets) { ['some.host'] }
88
89
  let(:command) { 'cd .' }
@@ -102,8 +103,8 @@ RSpec.describe PuppetLitmus::RakeHelper do
102
103
  context 'with uninstall module' do
103
104
  let(:inventory_hash) do
104
105
  { 'groups' =>
105
- [{ 'name' => 'ssh_nodes', 'nodes' =>
106
- [{ 'name' => 'some.host', 'facts' => { 'provisioner' => 'docker', 'container_name' => 'foo', 'platform' => 'some.host' } }] }] }
106
+ [{ 'name' => 'ssh_nodes', 'targets' =>
107
+ [{ 'uri' => 'some.host', 'facts' => { 'provisioner' => 'docker', 'container_name' => 'foo', 'platform' => 'some.host' } }] }] }
107
108
  end
108
109
  let(:targets) { ['some.host'] }
109
110
  let(:uninstall_module_command) { 'puppet module uninstall foo-bar' }
@@ -2,6 +2,8 @@
2
2
 
3
3
  require 'spec_helper'
4
4
  require 'rake'
5
+ load File.expand_path('../../../lib/puppet_litmus/inventory_manipulation.rb', __dir__)
6
+ include PuppetLitmus::InventoryManipulation # rubocop:disable Style/MixinUsage
5
7
  describe 'litmus rake tasks' do
6
8
  before(:all) do # rubocop:disable RSpec/BeforeAfterAll
7
9
  load File.expand_path('../../../lib/puppet_litmus/rake_tasks.rb', __dir__)
@@ -27,7 +29,7 @@ describe 'litmus rake tasks' do
27
29
  end
28
30
 
29
31
  context 'with litmus:install_modules_from_directory' do
30
- let(:inventory_hash) { { 'groups' => [{ 'name' => 'ssh_nodes', 'nodes' => [{ 'name' => 'some.host' }] }] } }
32
+ let(:inventory_hash) { { 'groups' => [{ 'name' => 'ssh_nodes', 'nodes' => [{ 'uri' => 'some.host' }] }] } }
31
33
  let(:target_folder) { File.join(Dir.pwd, 'spec/fixtures/modules') }
32
34
  let(:dummy_tar) { File.new('spec/data/doot.tar.gz') }
33
35
 
@@ -47,10 +49,10 @@ describe 'litmus rake tasks' do
47
49
 
48
50
  context 'with litmus:provision_install task' do
49
51
  it 'happy path' do
50
- expect(Rake::Task['spec_prep']).to receive(:invoke).and_return('').once
51
- expect(Rake::Task['litmus:provision_list']).to receive(:invoke).with('default').once
52
- expect(Rake::Task['litmus:install_agent']).to receive(:invoke).with('puppet6').once
53
- expect(Rake::Task['litmus:install_module']).to receive(:invoke).once
52
+ expect(Rake::Task['spec_prep']).to receive(:invoke).and_return('')
53
+ expect(Rake::Task['litmus:provision_list']).to receive(:invoke).with('default')
54
+ expect(Rake::Task['litmus:install_agent']).to receive(:invoke).with('puppet6')
55
+ expect(Rake::Task['litmus:install_module']).to receive(:invoke)
54
56
  Rake::Task['litmus:provision_install'].invoke('default', 'puppet6')
55
57
  end
56
58
  end
@@ -92,4 +94,12 @@ describe 'litmus rake tasks' do
92
94
  Rake::Task['litmus:check_connectivity'].invoke
93
95
  end
94
96
  end
97
+
98
+ context 'with litmus:acceptance:localhost task' do
99
+ it 'calls spec_prep' do
100
+ expect(Rake::Task['spec_prep']).to receive(:invoke).and_return('')
101
+ expect_any_instance_of(RSpec::Core::RakeTask).to receive(:run_task)
102
+ Rake::Task['litmus:acceptance:localhost'].invoke
103
+ end
104
+ end
95
105
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: puppet_litmus
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.14.0
4
+ version: 0.15.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Puppet, Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-01-23 00:00:00.000000000 Z
11
+ date: 2020-02-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bolt
@@ -118,6 +118,20 @@ dependencies:
118
118
  - - ">="
119
119
  - !ruby/object:Gem::Version
120
120
  version: '0'
121
+ - !ruby/object:Gem::Dependency
122
+ name: honeycomb-beeline
123
+ requirement: !ruby/object:Gem::Requirement
124
+ requirements:
125
+ - - ">="
126
+ - !ruby/object:Gem::Version
127
+ version: '0'
128
+ type: :runtime
129
+ prerelease: false
130
+ version_requirements: !ruby/object:Gem::Requirement
131
+ requirements:
132
+ - - ">="
133
+ - !ruby/object:Gem::Version
134
+ version: '0'
121
135
  description: " Providing a simple command line tool for puppet content creators,
122
136
  to enable simple and complex test deployments.\n"
123
137
  email:
@@ -163,19 +177,18 @@ required_rubygems_version: !ruby/object:Gem::Requirement
163
177
  - !ruby/object:Gem::Version
164
178
  version: '0'
165
179
  requirements: []
166
- rubyforge_project:
167
- rubygems_version: 2.7.6.2
180
+ rubygems_version: 3.0.6
168
181
  signing_key:
169
182
  specification_version: 4
170
183
  summary: Providing a simple command line tool for puppet content creators, to enable
171
184
  simple and complex test deployments.
172
185
  test_files:
173
- - spec/spec_helper.rb
174
- - spec/lib/puppet_litmus/rake_tasks_spec.rb
175
- - spec/lib/puppet_litmus/version_spec.rb
176
- - spec/lib/puppet_litmus/inventory_manipulation_spec.rb
177
- - spec/lib/puppet_litmus/rake_helper_spec.rb
178
- - spec/lib/puppet_litmus/puppet_helpers_spec.rb
179
186
  - spec/data/doot.tar.gz
180
- - spec/data/jim.yaml
181
187
  - spec/data/inventory.yaml
188
+ - spec/data/jim.yaml
189
+ - spec/lib/puppet_litmus/inventory_manipulation_spec.rb
190
+ - spec/lib/puppet_litmus/puppet_helpers_spec.rb
191
+ - spec/lib/puppet_litmus/rake_helper_spec.rb
192
+ - spec/lib/puppet_litmus/rake_tasks_spec.rb
193
+ - spec/lib/puppet_litmus/version_spec.rb
194
+ - spec/spec_helper.rb