puppet_litmus 0.28.0 → 0.31.1

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: 51e321964b54828b1e0c5602fd6038e8efe1fcd0190bd9c1ada036954b66e8db
4
- data.tar.gz: f5179463919201def0ff7a033f061dea91755a91c035b5fffc6222cdb8ce1359
3
+ metadata.gz: b9c563a22f33d327a6af23fad58c60adc7ee2dc3828adf46ea019687f1aaa8ce
4
+ data.tar.gz: da6f562172e3a827ac202b7934f4aa2309ff9e0dea2d3d6d41e17cc04d466ba8
5
5
  SHA512:
6
- metadata.gz: ff4f3114a21e708537908e577ce0d3361c6075d980eb1bd3bb13f680d526e0eaa2e6ecf64291864e8042e43b18e4a9df88b0098c53c3879a5d79390ffff1ddf6
7
- data.tar.gz: 0a3177a69170a3687e33820f8fbe21c89b6a00fc999ad800ecf2921b2f0452e06644833df5a5a98e3f3aa51cbdcca87d3e0a8f85476d4bcf9d7dde09ce5441a2
6
+ metadata.gz: abd1bd072ec642e55c5eca261d08194d8fc98b4f8d0ffa20a365530d9a1835e87652d8b1e81519cbad40438da474e4c07e303a3a926342ad6f0b74ed43b0fb06
7
+ data.tar.gz: ec1a571e9c8979523828201cfaf90d79be2a928c90437b5e9d30671f1beb1b07f5f839aee7738b450b34626cdf249319007777857e009c4e5ae3e1822b91b8c8
data/README.md CHANGED
@@ -12,17 +12,39 @@
12
12
  Litmus is a command line tool that allows you to run acceptance tests against Puppet modules.
13
13
 
14
14
  Litmus allows you to:
15
- * Provision targets to test against
16
- * Install a Puppet agent
17
- * Install a module
18
- * Run tests
19
- * Tear down the infrastructure
15
+
16
+ - Provision targets to test against
17
+
18
+ - Install a Puppet agent
19
+
20
+ - Install a module
21
+
22
+ - Run tests
23
+
24
+ - Tear down the infrastructure
20
25
 
21
26
  Litmus also facilitates parallel test runs and running tests in isolation. Each step is standalone, allowing other operations between test runs, such as debugging or configuration updates on the test targets.
22
27
 
23
- Install Litmus as a gem by running ```gem install puppet_litmus```.
28
+ Install Litmus as a gem by running `gem install puppet_litmus`.
29
+
30
+ - Note if you choose to override the `litmus_inventory.yaml` location, please ensure that the directory strutcture you define exists.
31
+
32
+ ## matrix_from_metadata_v2
33
+
34
+ matrix_from_metadata_v2 tool generates github actions matrix from metadata.json
35
+
36
+ How to use it: in the project module root directory run `bundle exec matrix_from_metadata_v2`
37
+
38
+ ### --exclude-platforms parameter
39
+
40
+ matrix_from_metadata_v2 accepts `--exclude-platforms <JSON array>` option in order to exclude some platforms from GA matrixes.
41
+
42
+ In order to use this new functionality just simply run:
43
+
44
+ `$: bundle exec matrix_from_metadata_v2 --exclude-platforms '["debian-11","centos-8"]'`
24
45
 
25
- * Note if you choose to override the `litmus_inventory.yaml` location, please ensure that the directory strutcture you define exists.
46
+ > Note: The option value should be JSON string otherwise it will throw an error.
47
+ > The values provided in the json array are case-insensitive `["debian-11","centos-8"]'` or `["Debian-11","CentOS-8"]'` are treated as being the same.
26
48
 
27
49
  ## Documentation
28
50
 
@@ -30,4 +52,4 @@ For documentation, see our [Litmus Docs Site](https://puppetlabs.github.io/litmu
30
52
 
31
53
  ## Other Resources
32
54
 
33
- * [Is it Worth the Time?](https://xkcd.com/1205/)
55
+ - [Is it Worth the Time?](https://xkcd.com/1205/)
@@ -13,12 +13,15 @@ IMAGE_TABLE = {
13
13
  'Windows-2012 R2' => 'windows-2012-r2-core',
14
14
  'Windows-2016' => 'windows-2016',
15
15
  'Windows-2019' => 'windows-2019-core',
16
+ # 'Windows-2022' => 'windows-2022', Image not yet available in GCP/Cloud-CI; no date on availability, but this can be uncommented then
16
17
  }.freeze
17
18
 
18
19
  DOCKER_PLATFORMS = {
19
20
  'CentOS-6' => 'litmusimage/centos:6',
20
21
  'CentOS-7' => 'litmusimage/centos:7',
21
22
  'CentOS-8' => 'litmusimage/centos:8',
23
+ 'Rocky-8' => 'litmusimage/rockylinux:8',
24
+ 'AlmaLinux-8' => 'litmusimage/almalinux:8',
22
25
  # 'Debian-8' => 'litmusimage/debian:8', Removing from testing: https://puppet.com/docs/pe/2021.0/supported_operating_systems.html
23
26
  'Debian-9' => 'litmusimage/debian:9',
24
27
  'Debian-10' => 'litmusimage/debian:10',
@@ -55,26 +58,45 @@ spec_matrix = {
55
58
  include: [],
56
59
  }
57
60
 
58
- metadata = JSON.parse(File.read('metadata.json'))
61
+ if ARGV.include?('--exclude-platforms')
62
+ exclude_platforms_occurencies = ARGV.select { |arg| arg == '--exclude-platforms' }.length
63
+ raise '--exclude-platforms argument should be present just one time in the command' unless exclude_platforms_occurencies <= 1
64
+
65
+ exclude_platforms_list = ARGV[ARGV.find_index('--exclude-platforms') + 1]
66
+ raise 'you need to provide a list of platforms in JSON format' if exclude_platforms_list.nil?
67
+
68
+ begin
69
+ exclude_list = JSON.parse(exclude_platforms_list).map { |platform| platform.downcase }
70
+ rescue JSON::ParserError
71
+ raise 'the exclude platforms list must valid JSON'
72
+ end
73
+ else
74
+ exclude_list = []
75
+ end
76
+
77
+ metadata_path = ENV['TEST_MATRIX_FROM_METADATA'] || 'metadata.json'
78
+ metadata = JSON.parse(File.read(metadata_path))
59
79
  # Set platforms based on declared operating system support
60
80
  metadata['operatingsystem_support'].sort_by { |a| a['operatingsystem'] }.each do |sup|
61
81
  os = sup['operatingsystem']
62
82
  sup['operatingsystemrelease'].sort_by { |a| a.to_i }.each do |ver|
63
83
  image_key = "#{os}-#{ver}"
64
- if IMAGE_TABLE.key? image_key
84
+
85
+ if IMAGE_TABLE.key?(image_key) && !exclude_list.include?(image_key.downcase)
65
86
  matrix[:platforms] << {
66
87
  label: image_key,
67
88
  provider: 'provision::provision_service',
68
89
  image: IMAGE_TABLE[image_key],
69
90
  }
70
- elsif DOCKER_PLATFORMS.key? image_key
91
+ elsif DOCKER_PLATFORMS.key?(image_key) && !exclude_list.include?(image_key.downcase)
71
92
  matrix[:platforms] << {
72
93
  label: image_key,
73
94
  provider: 'provision::docker',
74
95
  image: DOCKER_PLATFORMS[image_key],
75
96
  }
76
97
  else
77
- puts "::warning::Cannot find image for #{image_key}"
98
+ puts "::warning::#{image_key} was excluded from testing" if exclude_list.include?(image_key.downcase)
99
+ puts "::warning::Cannot find image for #{image_key}" unless exclude_list.include?(image_key.downcase)
78
100
  end
79
101
  end
80
102
  end
@@ -53,6 +53,85 @@ module PuppetLitmus::InventoryManipulation
53
53
  end
54
54
  end
55
55
 
56
+ # Recursively find and iterate over the groups in an inventory. If no block is passed
57
+ # to the function then only the name of the group is returned. If a block is passed
58
+ # then the block is executed against each group and the value of the block is returned.
59
+ #
60
+ # @param inventory_hash [Hash] Inventory hash from inventory.yaml
61
+ # @param block [Block] Block to execute against each node
62
+ def groups_in_inventory(inventory_hash, &block)
63
+ inventory_hash['groups'].flat_map do |group|
64
+ output_collector = []
65
+ output_collector << if block_given?
66
+ yield group
67
+ else
68
+ group['name'].downcase
69
+ end
70
+ output_collector << groups_in_inventory({ 'groups' => group['groups'] }, &block) if group.key? 'groups'
71
+ output_collector.flatten.compact
72
+ end
73
+ end
74
+
75
+ # Iterate over all targets in an inventory. If no block is given to the function
76
+ # it will return the name of every target in the inventory. If a block is passed
77
+ # it will execute the block on each target and return the value of the block.
78
+ #
79
+ # @param inventory_hash [Hash] Inventory hash from inventory.yaml
80
+ # @param block [Block] Block to execute against each node
81
+ def targets_in_inventory(inventory_hash)
82
+ groups_in_inventory(inventory_hash) do |group|
83
+ if group.key? 'targets'
84
+ group['targets'].map do |target|
85
+ if block_given?
86
+ (yield target)
87
+ else
88
+ target['uri'].downcase
89
+ end
90
+ end
91
+ end
92
+ end
93
+ end
94
+
95
+ # Find all targets in an inventory that have a role. The roles for a target are
96
+ # specified in the vars hash for a target. This function is tolerant to the roles
97
+ # hash being called either 'role' or 'roles' and it is tolerant to the roles being
98
+ # either a single key value or an array of roles.
99
+ #
100
+ # @param role [String] The name of a role to search for
101
+ # @param inventory [Hash] Inventory hash from inventory.yaml
102
+ def nodes_with_role(role, inventory)
103
+ output_collector = []
104
+ targets_in_inventory(inventory) do |target|
105
+ vars = target['vars']
106
+ roles = [(vars['role'] || vars['roles'])].flatten
107
+ roles = roles.map { |r| r.downcase }
108
+ output_collector << target['uri'] if roles.include? role.downcase
109
+ end
110
+ output_collector unless output_collector.empty?
111
+ end
112
+
113
+ # Searches through the inventory hash to either validate that a group being targeted exists,
114
+ # validate that a specific target being targeted exists, or resolves role names to a
115
+ # list of nodes to target. Targets and roles can be specified as strings or as symbols, and
116
+ # the functions are tolerant to incorrect capitalization.
117
+ #
118
+ # @param target [String] || [Array[String]] A list of targets
119
+ # @param inventory [Hash] inventory hash from inventory.yaml
120
+ def search_for_target(target, inventory)
121
+ result_collector = []
122
+ groups = groups_in_inventory(inventory)
123
+ Array(target).map do |name|
124
+ result_collector << name if groups.include? name.to_s.downcase
125
+ result_collector << name if targets_in_inventory(inventory).include? name.to_s.downcase
126
+ result_collector << nodes_with_role(name.to_s, inventory)
127
+ end
128
+
129
+ result_collector = result_collector.flatten.compact
130
+ raise 'targets not found in inventory' if result_collector.empty?
131
+
132
+ result_collector
133
+ end
134
+
56
135
  # Determines if a node_name exists in a group in the inventory_hash.
57
136
  #
58
137
  # @param inventory_hash [Hash] hash of the inventory.yaml file
@@ -86,14 +165,13 @@ module PuppetLitmus::InventoryManipulation
86
165
  # @param node_name [String] node to locate in the group
87
166
  # @return [Hash] config for node of name node_name
88
167
  def config_from_node(inventory_hash, node_name)
89
- inventory_hash['groups'].each do |group|
90
- group['targets'].each do |node|
91
- if node['uri'] == node_name
92
- return node['config']
93
- end
94
- end
168
+ config = targets_in_inventory(inventory_hash) do |target|
169
+ next unless target['uri'].downcase == node_name.downcase
170
+
171
+ return target['config'] unless target['config'].nil?
95
172
  end
96
- raise "No config was found for #{node_name}"
173
+
174
+ config.empty? ? nil : config[0]
97
175
  end
98
176
 
99
177
  # Finds a facts hash in the inventory hash by searching for a node name.
@@ -102,14 +180,13 @@ module PuppetLitmus::InventoryManipulation
102
180
  # @param node_name [String] node to locate in the group
103
181
  # @return [Hash] facts for node of name node_name
104
182
  def facts_from_node(inventory_hash, node_name)
105
- inventory_hash['groups'].each do |group|
106
- group['targets'].each do |node|
107
- if node['uri'] == node_name
108
- return node['facts']
109
- end
110
- end
183
+ facts = targets_in_inventory(inventory_hash) do |target|
184
+ next unless target['uri'].downcase == node_name.downcase
185
+
186
+ target['facts'] unless target['facts'].nil?
111
187
  end
112
- raise "No facts were found for #{node_name}"
188
+
189
+ facts.empty? ? nil : facts[0]
113
190
  end
114
191
 
115
192
  # Finds a var hash in the inventory hash by searching for a node name.
@@ -118,14 +195,12 @@ module PuppetLitmus::InventoryManipulation
118
195
  # @param node_name [String] node to locate in the group
119
196
  # @return [Hash] vars for node of name node_name
120
197
  def vars_from_node(inventory_hash, node_name)
121
- inventory_hash['groups'].each do |group|
122
- group['targets'].each do |node|
123
- if node['uri'] == node_name
124
- return node['vars']
125
- end
126
- end
198
+ vars = targets_in_inventory(inventory_hash) do |target|
199
+ next unless target['uri'].downcase == node_name.downcase
200
+
201
+ target['vars'] unless target['vars'].nil?
127
202
  end
128
- {}
203
+ vars.empty? ? {} : vars[0]
129
204
  end
130
205
 
131
206
  # Adds a node to a group specified, if group_name exists in inventory hash.
@@ -266,4 +341,27 @@ module PuppetLitmus::InventoryManipulation
266
341
  end
267
342
  Honeycomb.current_span.add_field('litmus.platform', facts&.dig('platform'))
268
343
  end
344
+
345
+ # Add platform custom information field to the current span for each node being targeted.
346
+ # If more than one node is being targeted, each node will be given a separate custom field.
347
+ #
348
+ # @param span [Honeycomb::Span] The current span
349
+ # @param target_node_names [Array[String]] Nodes being targeted
350
+ # @param inventory_hash [Hash] Hash of the inventory.yaml file
351
+ def add_node_fields_to_span(span, target_node_names, inventory_hash)
352
+ node_counter = 1
353
+ Array(target_node_names).each do |target_name|
354
+ name_field = 'litmus.node_name'
355
+ platform_field = 'litmus.platform'
356
+
357
+ name_field = "#{name_field}_#{node_counter}"
358
+ platform_field = "#{platform_field}_#{node_counter}"
359
+ span.add_field(name_field, target_name)
360
+ if target_in_inventory?(inventory_hash, target_name)
361
+ facts = facts_from_node(inventory_hash, target_name)
362
+ span.add_field(platform_field, facts&.dig('platform')) unless facts.nil?
363
+ end
364
+ node_counter += 1
365
+ end
366
+ end
269
367
  end
@@ -6,13 +6,24 @@ module PuppetLitmus::PuppetHelpers
6
6
  # Applies a manifest twice. First checking for errors. Secondly to make sure no changes occur.
7
7
  #
8
8
  # @param manifest [String] puppet manifest code to be applied.
9
+ # @param opts [Hash] Alters the behaviour of the command. Valid options are:
10
+ # :catch_changes [Boolean] (false) We're after idempotency so allow exit code 0 only.
11
+ # :expect_changes [Boolean] (false) We're after changes specifically so allow exit code 2 only.
12
+ # :catch_failures [Boolean] (false) We're after only complete success so allow exit codes 0 and 2 only.
13
+ # :expect_failures [Boolean] (false) We're after failures specifically so allow exit codes 1, 4, and 6 only.
14
+ # :manifest_file_location [Path] The place on the target system.
15
+ # :hiera_config [Path] The path to the hiera.yaml configuration on the target.
16
+ # :prefix_command [String] prefixes the puppet apply command; eg "export LANGUAGE='ja'".
17
+ # :trace [Boolean] run puppet apply with the trace flag (defaults to `true`).
18
+ # :debug [Boolean] run puppet apply with the debug flag.
19
+ # :noop [Boolean] run puppet apply with the noop flag.
9
20
  # @return [Boolean] The result of the 2 apply manifests.
10
- def idempotent_apply(manifest)
21
+ def idempotent_apply(manifest, opts = {})
11
22
  Honeycomb.start_span(name: 'litmus.idempotent_apply') do |span|
12
23
  ENV['HONEYCOMB_TRACE'] = span.to_trace_header
13
24
  manifest_file_location = create_manifest_file(manifest)
14
- apply_manifest(nil, catch_failures: true, manifest_file_location: manifest_file_location)
15
- apply_manifest(nil, catch_changes: true, manifest_file_location: manifest_file_location)
25
+ apply_manifest(nil, **opts, catch_failures: true, manifest_file_location: manifest_file_location)
26
+ apply_manifest(nil, **opts, catch_changes: true, manifest_file_location: manifest_file_location)
16
27
  end
17
28
  end
18
29
 
@@ -70,10 +81,15 @@ module PuppetLitmus::PuppetHelpers
70
81
 
71
82
  manifest_file_location = opts[:manifest_file_location] || create_manifest_file(manifest)
72
83
  inventory_hash = File.exist?('spec/fixtures/litmus_inventory.yaml') ? inventory_hash_from_inventory_file : localhost_inventory_hash
73
- raise "Target '#{target_node_name}' not found in spec/fixtures/litmus_inventory.yaml" unless target_in_inventory?(inventory_hash, target_node_name)
74
84
 
75
- span.add_field('litmus.node_name', target_node_name)
76
- add_platform_field(inventory_hash, target_node_name)
85
+ target_option = opts['targets'] || opts[:targets]
86
+ if target_option.nil?
87
+ raise "Target '#{target_node_name}' not found in spec/fixtures/litmus_inventory.yaml" unless target_in_inventory?(inventory_hash, target_node_name)
88
+ else
89
+ target_node_name = search_for_target(target_option, inventory_hash)
90
+ end
91
+
92
+ add_node_fields_to_span(span, target_node_name, inventory_hash)
77
93
 
78
94
  # Forcibly set the locale of the command
79
95
  locale = if os[:family] != 'windows'
@@ -132,7 +148,7 @@ module PuppetLitmus::PuppetHelpers
132
148
  #
133
149
  # @param manifest [String] puppet manifest code.
134
150
  # @return [String] The path to the location of the manifest.
135
- def create_manifest_file(manifest)
151
+ def create_manifest_file(manifest, opts = {})
136
152
  Honeycomb.start_span(name: 'litmus.create_manifest_file') do |span|
137
153
  ENV['HONEYCOMB_TRACE'] = span.to_trace_header
138
154
  span.add_field('litmus.manifest', manifest)
@@ -149,8 +165,9 @@ module PuppetLitmus::PuppetHelpers
149
165
  else
150
166
  # transfer to TARGET_HOST
151
167
  inventory_hash = inventory_hash_from_inventory_file
152
- span.add_field('litmus.node_name', target_node_name)
153
- add_platform_field(inventory_hash, target_node_name)
168
+ target_option = opts['targets'] || opts[:targets]
169
+ target_node_name = search_for_target(target_option, inventory_hash) unless target_option.nil?
170
+ add_node_fields_to_span(span, target_node_name, inventory_hash)
154
171
 
155
172
  manifest_file_location = File.basename(manifest_file)
156
173
  bolt_result = upload_file(manifest_file.path, manifest_file_location, target_node_name, options: {}, config: nil, inventory: inventory_hash)
@@ -169,13 +186,16 @@ module PuppetLitmus::PuppetHelpers
169
186
  # @param content [String] String data to write to the file.
170
187
  # @param destination [String] The path on the target node to write the file.
171
188
  # @return [Bool] Success. The file was succesfully writtne on the target.
172
- def write_file(content, destination)
189
+ def write_file(content, destination, opts = {})
173
190
  Honeycomb.start_span(name: 'litmus.write_file') do |span|
174
191
  ENV['HONEYCOMB_TRACE'] = span.to_trace_header
175
192
  span.add_field('litmus.destination', destination)
176
193
 
177
194
  require 'tmpdir'
195
+ inventory_hash = inventory_hash_from_inventory_file
178
196
  target_node_name = ENV['TARGET_HOST']
197
+ target_option = opts['targets'] || opts[:targets]
198
+ target_node_name = search_for_target(target_option, inventory_hash) unless target_option.nil?
179
199
 
180
200
  Tempfile.create('litmus') do |tmp_file|
181
201
  tmp_file.write(content)
@@ -186,9 +206,7 @@ module PuppetLitmus::PuppetHelpers
186
206
  FileUtils.cp(tmp_file.path, destination)
187
207
  else
188
208
  # transfer to TARGET_HOST
189
- inventory_hash = inventory_hash_from_inventory_file
190
- span.add_field('litmus.node_name', target_node_name)
191
- add_platform_field(inventory_hash, target_node_name)
209
+ add_node_fields_to_span(span, target_node_name, inventory_hash)
192
210
 
193
211
  bolt_result = upload_file(tmp_file.path, destination, target_node_name, options: {}, config: nil, inventory: inventory_hash)
194
212
  span.add_field('litmus.bolt_result.file_upload', bolt_result)
@@ -212,12 +230,17 @@ module PuppetLitmus::PuppetHelpers
212
230
  span.add_field('litmus.command_to_run', command_to_run)
213
231
  span.add_field('litmus.opts', opts)
214
232
 
215
- target_node_name = targeting_localhost? ? 'litmus_localhost' : ENV['TARGET_HOST']
216
233
  inventory_hash = File.exist?('spec/fixtures/litmus_inventory.yaml') ? inventory_hash_from_inventory_file : localhost_inventory_hash
217
- raise "Target '#{target_node_name}' not found in spec/fixtures/litmus_inventory.yaml" unless target_in_inventory?(inventory_hash, target_node_name)
218
234
 
219
- span.add_field('litmus.node_name', target_node_name)
220
- add_platform_field(inventory_hash, target_node_name)
235
+ target_option = opts['targets'] || opts[:targets]
236
+ if target_option.nil?
237
+ target_node_name = targeting_localhost? ? 'litmus_localhost' : ENV['TARGET_HOST']
238
+ raise "Target '#{target_node_name}' not found in spec/fixtures/litmus_inventory.yaml" unless target_in_inventory?(inventory_hash, target_node_name)
239
+ else
240
+ target_node_name = search_for_target(target_option, inventory_hash)
241
+ end
242
+
243
+ add_node_fields_to_span(span, target_node_name, inventory_hash)
221
244
 
222
245
  bolt_result = run_command(command_to_run, target_node_name, config: nil, inventory: inventory_hash)
223
246
  span.add_field('litmus.bolt_result', bolt_result)
@@ -251,12 +274,16 @@ module PuppetLitmus::PuppetHelpers
251
274
  span.add_field('litmus.opts', opts)
252
275
  span.add_field('litmus.options', options)
253
276
 
254
- target_node_name = targeting_localhost? ? 'litmus_localhost' : ENV['TARGET_HOST']
255
277
  inventory_hash = File.exist?('spec/fixtures/litmus_inventory.yaml') ? inventory_hash_from_inventory_file : localhost_inventory_hash
256
- raise "Target '#{target_node_name}' not found in spec/fixtures/litmus_inventory.yaml" unless target_in_inventory?(inventory_hash, target_node_name)
278
+ target_option = opts['targets'] || opts[:targets]
279
+ if target_option.nil?
280
+ target_node_name = targeting_localhost? ? 'litmus_localhost' : ENV['TARGET_HOST']
281
+ raise "Target '#{target_node_name}' not found in spec/fixtures/litmus_inventory.yaml" unless target_in_inventory?(inventory_hash, target_node_name)
282
+ else
283
+ target_node_name = search_for_target(target_option, inventory_hash)
284
+ end
257
285
 
258
- span.add_field('litmus.node_name', target_node_name)
259
- add_platform_field(inventory_hash, target_node_name)
286
+ add_node_fields_to_span(span, target_node_name, inventory_hash)
260
287
 
261
288
  bolt_result = upload_file(source, destination, target_node_name, options: options, config: nil, inventory: inventory_hash)
262
289
  span.add_field('litmus.bolt_result', bolt_result)
@@ -311,10 +338,15 @@ module PuppetLitmus::PuppetHelpers
311
338
  else
312
339
  localhost_inventory_hash
313
340
  end
314
- raise "Target '#{target_node_name}' not found in spec/fixtures/litmus_inventory.yaml" unless target_in_inventory?(inventory_hash, target_node_name)
315
341
 
316
- span.add_field('litmus.node_name', target_node_name)
317
- add_platform_field(inventory_hash, target_node_name)
342
+ target_option = opts['targets'] || opts[:targets]
343
+ if target_option.nil?
344
+ raise "Target '#{target_node_name}' not found in spec/fixtures/litmus_inventory.yaml" unless target_in_inventory?(inventory_hash, target_node_name)
345
+ else
346
+ target_node_name = search_for_target(target_option, inventory_hash)
347
+ end
348
+
349
+ add_node_fields_to_span(span, target_node_name, inventory_hash)
318
350
 
319
351
  bolt_result = run_task(task_name, target_node_name, params, config: config_data, inventory: inventory_hash)
320
352
  result_obj = {
@@ -372,10 +404,14 @@ module PuppetLitmus::PuppetHelpers
372
404
 
373
405
  target_node_name = targeting_localhost? ? 'litmus_localhost' : ENV['TARGET_HOST']
374
406
  inventory_hash = File.exist?('spec/fixtures/litmus_inventory.yaml') ? inventory_hash_from_inventory_file : localhost_inventory_hash
375
- raise "Target '#{target_node_name}' not found in spec/fixtures/litmus_inventory.yaml" unless target_in_inventory?(inventory_hash, target_node_name)
407
+ target_option = opts['targets'] || opts[:targets]
408
+ if target_option.nil?
409
+ raise "Target '#{target_node_name}' not found in spec/fixtures/litmus_inventory.yaml" unless target_in_inventory?(inventory_hash, target_node_name)
410
+ else
411
+ target_node_name = search_for_target(target_option, inventory_hash)
412
+ end
376
413
 
377
- span.add_field('litmus.node_name', target_node_name)
378
- add_platform_field(inventory_hash, target_node_name)
414
+ add_node_fields_to_span(span, target_node_name, inventory_hash)
379
415
 
380
416
  bolt_result = run_script(script, target_node_name, arguments, options: opts, config: nil, inventory: inventory_hash)
381
417
 
@@ -2,5 +2,5 @@
2
2
 
3
3
  # version of this gem
4
4
  module PuppetLitmus
5
- VERSION ||= '0.28.0'
5
+ VERSION ||= '0.31.1'
6
6
  end
@@ -0,0 +1,46 @@
1
+ {
2
+ "name": "puppetlabs-fake_module",
3
+ "version": "3.1.0",
4
+ "author": "puppetlabs",
5
+ "summary": "fake_module is a test",
6
+ "license": "Apache-2.0",
7
+ "source": "it has no source",
8
+ "project_page": "it has no project page",
9
+ "issues_url": "https://tickets.puppetlabs.com/browse/MODULES",
10
+ "dependencies": [
11
+ {
12
+ "name": "puppetlabs/stdlib",
13
+ "version_requirement": ">= 4.0.0 < 9.0.0"
14
+ }
15
+ ],
16
+ "operatingsystem_support": [
17
+ {
18
+ "operatingsystem": "CentOS",
19
+ "operatingsystemrelease": [
20
+ "6"
21
+ ]
22
+ },
23
+ {
24
+ "operatingsystem": "RedHat",
25
+ "operatingsystemrelease": [
26
+ "8"
27
+ ]
28
+ },
29
+ {
30
+ "operatingsystem": "Ubuntu",
31
+ "operatingsystemrelease": [
32
+ "14.04",
33
+ "18.04"
34
+ ]
35
+ }
36
+ ],
37
+ "requirements": [
38
+ {
39
+ "name": "puppet",
40
+ "version_requirement": ">= 6.0.0 < 8.0.0"
41
+ }
42
+ ],
43
+ "template-url": "https://github.com/puppetlabs/pdk-templates.git#main",
44
+ "template-ref": "heads/main-0-g2381db6",
45
+ "pdk-version": "2.1.1"
46
+ }
@@ -0,0 +1,95 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'spec_helper'
4
+
5
+ RSpec.describe 'matrix_from_metadata_v2' do
6
+ context 'without arguments' do
7
+ let(:result) { run_matrix_from_metadata_v2 }
8
+
9
+ it 'run successfully' do
10
+ expect(result.status_code).to eq 0
11
+ end
12
+
13
+ it 'generates the matrix' do
14
+ expect(result.stdout).to include('::warning::Cannot find image for Ubuntu-14.04')
15
+ expect(result.stdout).to include(
16
+ [
17
+ '::set-output name=matrix::{',
18
+ '"platforms":[',
19
+ '{"label":"CentOS-6","provider":"provision::docker","image":"litmusimage/centos:6"},',
20
+ '{"label":"RedHat-8","provider":"provision::provision_service","image":"rhel-8"},',
21
+ '{"label":"Ubuntu-18.04","provider":"provision::docker","image":"litmusimage/ubuntu:18.04"}',
22
+ '],',
23
+ '"collection":[',
24
+ '"puppet6-nightly","puppet7-nightly"',
25
+ ']',
26
+ '}',
27
+ ].join,
28
+ )
29
+ expect(result.stdout).to include(
30
+ '::set-output name=spec_matrix::{"include":[{"puppet_version":"~> 6.0","ruby_version":2.5},{"puppet_version":"~> 7.0","ruby_version":2.7}]}',
31
+ )
32
+ expect(result.stdout).to include("Created matrix with 8 cells:\n - Acceptance Test Cells: 6\n - Spec Test Cells: 2")
33
+ end
34
+ end
35
+
36
+ context 'with --exclude-platforms ["ubuntu-18.04"]' do
37
+ let(:result) { run_matrix_from_metadata_v2({ '--exclude-platforms' => ['ubuntu-18.04'] }) }
38
+
39
+ it 'run successfully' do
40
+ expect(result.status_code).to eq 0
41
+ end
42
+
43
+ it 'generates the matrix without excluded platforms' do
44
+ expect(result.stdout).to include('::warning::Cannot find image for Ubuntu-14.04')
45
+ expect(result.stdout).to include('::warning::Ubuntu-18.04 was excluded from testing')
46
+ expect(result.stdout).to include(
47
+ [
48
+ '::set-output name=matrix::{',
49
+ '"platforms":[',
50
+ '{"label":"CentOS-6","provider":"provision::docker","image":"litmusimage/centos:6"},',
51
+ '{"label":"RedHat-8","provider":"provision::provision_service","image":"rhel-8"}',
52
+ '],',
53
+ '"collection":[',
54
+ '"puppet6-nightly","puppet7-nightly"',
55
+ ']',
56
+ '}',
57
+ ].join,
58
+ )
59
+ expect(result.stdout).to include(
60
+ '::set-output name=spec_matrix::{"include":[{"puppet_version":"~> 6.0","ruby_version":2.5},{"puppet_version":"~> 7.0","ruby_version":2.7}]}',
61
+ )
62
+ expect(result.stdout).to include("Created matrix with 6 cells:\n - Acceptance Test Cells: 4\n - Spec Test Cells: 2")
63
+ end
64
+ end
65
+
66
+ context 'with --exclude-platforms \'["ubuntu-18.04","redhat-8"]\'' do
67
+ let(:result) { run_matrix_from_metadata_v2({ '--exclude-platforms' => ['ubuntu-18.04', 'redhat-8'] }) }
68
+
69
+ it 'run successfully' do
70
+ expect(result.status_code).to eq 0
71
+ end
72
+
73
+ it 'generates the matrix without excluded platforms' do
74
+ expect(result.stdout).to include('::warning::Cannot find image for Ubuntu-14.04')
75
+ expect(result.stdout).to include('::warning::Ubuntu-18.04 was excluded from testing')
76
+ expect(result.stdout).to include('::warning::RedHat-8 was excluded from testing')
77
+ expect(result.stdout).to include(
78
+ [
79
+ '::set-output name=matrix::{',
80
+ '"platforms":[',
81
+ '{"label":"CentOS-6","provider":"provision::docker","image":"litmusimage/centos:6"}',
82
+ '],',
83
+ '"collection":[',
84
+ '"puppet6-nightly","puppet7-nightly"',
85
+ ']',
86
+ '}',
87
+ ].join,
88
+ )
89
+ expect(result.stdout).to include(
90
+ '::set-output name=spec_matrix::{"include":[{"puppet_version":"~> 6.0","ruby_version":2.5},{"puppet_version":"~> 7.0","ruby_version":2.7}]}',
91
+ )
92
+ expect(result.stdout).to include("Created matrix with 4 cells:\n - Acceptance Test Cells: 2\n - Spec Test Cells: 2")
93
+ end
94
+ end
95
+ end
@@ -1,96 +1,12 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'spec_helper'
4
+ require 'support/inventory'
4
5
 
5
6
  RSpec.describe PuppetLitmus::InventoryManipulation do
6
- context 'with config_from_node' do
7
- let(:no_config_hash) do
8
- { 'groups' =>
9
- [{ 'name' => 'ssh_nodes',
10
- 'targets' =>
11
- [{ 'uri' => 'test.delivery.puppetlabs.net',
12
- 'facts' => { 'provisioner' => 'vmpooler', 'platform' => 'centos-5-x86_64' } }] },
13
- { 'name' => 'winrm_nodes', 'targets' => [] }] }
14
- end
15
-
16
- let(:no_docker_hash) do
17
- { 'groups' =>
18
- [{ 'name' => 'ssh_nodes', 'targets' => [] },
19
- { 'name' => 'winrm_nodes', 'targets' => [] }] }
20
- end
21
-
22
- let(:config_hash) do
23
- { 'groups' =>
24
- [{ 'name' => 'ssh_nodes',
25
- 'targets' =>
26
- [{ 'uri' => 'test.delivery.puppetlabs.net',
27
- 'config' => { 'transport' => 'ssh', 'ssh' => { 'user' => 'root', 'password' => 'Qu@lity!', 'host-key-check' => false } },
28
- 'facts' => { 'provisioner' => 'vmpooler', 'platform' => 'centos-5-x86_64' },
29
- 'vars' => { 'role' => 'agent' } }] },
30
- { 'name' => 'winrm_nodes', 'targets' => [] }] }
31
- end
32
-
33
- let(:inventory_full_path) { 'spec/data/inventory.yaml' }
34
-
35
- let(:no_feature_hash) do
36
- { 'groups' =>
37
- [{ 'name' => 'ssh_nodes',
38
- 'targets' =>
39
- [{ 'uri' => 'test.delivery.puppetlabs.net',
40
- 'config' => { 'transport' => 'ssh', 'ssh' => { 'user' => 'root', 'password' => 'Qu@lity!', 'host-key-check' => false } },
41
- 'facts' => { 'provisioner' => 'vmpooler', 'platform' => 'centos-5-x86_64' } }] },
42
- { 'name' => 'winrm_nodes', 'targets' => [] }] }
43
- end
44
-
45
- let(:feature_hash_group) do
46
- { 'groups' =>
47
- [{ 'name' => 'ssh_nodes',
48
- 'targets' =>
49
- [{ 'uri' => 'test.delivery.puppetlabs.net',
50
- 'config' => { 'transport' => 'ssh', 'ssh' => { 'user' => 'root', 'password' => 'Qu@lity!', 'host-key-check' => false } },
51
- 'facts' => { 'provisioner' => 'vmpooler', 'platform' => 'centos-5-x86_64' } }],
52
- 'features' => ['puppet-agent'] },
53
- { 'name' => 'winrm_nodes', 'targets' => [] }] }
54
- end
55
-
56
- let(:empty_feature_hash_group) do
57
- { 'groups' =>
58
- [{ 'name' => 'ssh_nodes',
59
- 'targets' =>
60
- [{ 'uri' => 'test.delivery.puppetlabs.net',
61
- 'config' => { 'transport' => 'ssh', 'ssh' => { 'user' => 'root', 'password' => 'Qu@lity!', 'host-key-check' => false } },
62
- 'facts' => { 'provisioner' => 'vmpooler', 'platform' => 'centos-5-x86_64' } }],
63
- 'features' => [] },
64
- { 'name' => 'winrm_nodes', 'targets' => [] }] }
65
- end
66
-
67
- let(:feature_hash_node) do
68
- { 'groups' =>
69
- [{ 'name' => 'ssh_nodes',
70
- 'targets' =>
71
- [{ 'uri' => 'test.delivery.puppetlabs.net',
72
- 'config' => { 'transport' => 'ssh', 'ssh' => { 'user' => 'root', 'password' => 'Qu@lity!', 'host-key-check' => false } },
73
- 'facts' => { 'provisioner' => 'vmpooler', 'platform' => 'centos-5-x86_64' },
74
- 'features' => ['puppet-agent'] }] },
75
- { 'name' => 'winrm_nodes', 'targets' => [] }] }
76
- end
77
-
78
- let(:empty_feature_hash_node) do
79
- { 'groups' =>
80
- [{ 'name' => 'ssh_nodes',
81
- 'targets' =>
82
- [{ 'uri' => 'test.delivery.puppetlabs.net',
83
- 'config' => { 'transport' => 'ssh', 'ssh' => { 'user' => 'root', 'password' => 'Qu@lity!', 'host-key-check' => false } },
84
- 'facts' => { 'provisioner' => 'vmpooler', 'platform' => 'centos-5-x86_64' },
85
- 'features' => [] }] },
86
- { 'name' => 'winrm_nodes', 'targets' => [] }] }
87
- end
88
-
89
- let(:foo_node) do
90
- { 'uri' => 'foo',
91
- 'facts' => { 'provisioner' => 'bar', 'platform' => 'ubuntu' } }
92
- end
7
+ let(:inventory_full_path) { 'spec/data/inventory.yaml' }
93
8
 
9
+ context 'with config_from_node' do
94
10
  it 'no matching node, raises' do
95
11
  expect { config_from_node(config_hash, 'not.here') }.to raise_error('No config was found for not.here')
96
12
  end
@@ -159,4 +75,70 @@ RSpec.describe PuppetLitmus::InventoryManipulation do
159
75
  [{ 'name' => 'ssh_nodes', 'targets' => [foo_node] }, { 'name' => 'winrm_nodes', 'targets' => [] }])
160
76
  end
161
77
  end
78
+
79
+ context 'with target searching' do
80
+ it 'gets correct groups names from an inventory' do
81
+ expect(groups_in_inventory(complex_inventory)).to eql(%w[ssh_nodes frontend winrm_nodes])
82
+ end
83
+
84
+ it 'applies a code block to groups' do
85
+ counts = groups_in_inventory(complex_inventory) do |group|
86
+ if group.key? 'targets'
87
+ group['targets'].count
88
+ end
89
+ end
90
+ expect(counts.sum).to be 4
91
+ end
92
+
93
+ it 'gets names of targets' do
94
+ target_list = ['test.delivery.puppetlabs.net', 'test2.delivery.puppetlabs.net', 'test3.delivery.puppetlabs.net', 'test4.delivery.puppetlabs.net']
95
+ expect(targets_in_inventory(complex_inventory)).to eql target_list
96
+ end
97
+
98
+ it 'applies a code block to targets' do
99
+ target_list = targets_in_inventory(complex_inventory) do |target|
100
+ next unless target['config']['transport'] == 'winrm'
101
+
102
+ target['uri']
103
+ end
104
+
105
+ expect(target_list).to eql ['test4.delivery.puppetlabs.net']
106
+ end
107
+
108
+ it 'returns agent nodes' do
109
+ node_list = nodes_with_role('agent', complex_inventory)
110
+ expected_node_list = ['test.delivery.puppetlabs.net', 'test3.delivery.puppetlabs.net', 'test4.delivery.puppetlabs.net']
111
+ expect(node_list).to eql expected_node_list
112
+ end
113
+
114
+ it 'returns agent nodes with different capitolization' do
115
+ node_list = nodes_with_role('Agent', complex_inventory)
116
+ expected_node_list = ['test.delivery.puppetlabs.net', 'test3.delivery.puppetlabs.net', 'test4.delivery.puppetlabs.net']
117
+ expect(node_list).to eql expected_node_list
118
+ end
119
+
120
+ it 'searches for a group' do
121
+ expect(search_for_target('winrm_nodes', complex_inventory)).to eql ['winrm_nodes']
122
+ end
123
+
124
+ it 'seaches for an array of groups' do
125
+ expect(search_for_target(%w[winrm_nodes ssh_nodes], complex_inventory)).to eql %w[winrm_nodes ssh_nodes]
126
+ end
127
+
128
+ it 'searches for a specific target' do
129
+ expect(search_for_target('test.delivery.puppetlabs.net', complex_inventory)).to eql ['test.delivery.puppetlabs.net']
130
+ end
131
+
132
+ it 'searches for an array of roles' do
133
+ expect(search_for_target(%w[iis nginx], complex_inventory)).to eql ['test4.delivery.puppetlabs.net', 'test3.delivery.puppetlabs.net']
134
+ end
135
+
136
+ it 'searches for roles as symbols' do
137
+ expect(search_for_target([:iis, :nginx], complex_inventory)).to eql ['test4.delivery.puppetlabs.net', 'test3.delivery.puppetlabs.net']
138
+ end
139
+
140
+ it 'raises an error if target not found' do
141
+ expect { search_for_target(:blah, complex_inventory) }.to raise_error 'targets not found in inventory'
142
+ end
143
+ end
162
144
  end
@@ -18,6 +18,13 @@ RSpec.describe PuppetLitmus::PuppetHelpers do
18
18
  expect(self).to receive(:apply_manifest).with(nil, catch_changes: true, manifest_file_location: '/bla.pp')
19
19
  idempotent_apply(manifest)
20
20
  end
21
+
22
+ it 'passes options to apply_manifest' do
23
+ expect(self).to receive(:create_manifest_file).with(manifest).and_return('/bla.pp')
24
+ expect(self).to receive(:apply_manifest).with(nil, catch_failures: true, manifest_file_location: '/bla.pp', option: 'value')
25
+ expect(self).to receive(:apply_manifest).with(nil, catch_changes: true, manifest_file_location: '/bla.pp', option: 'value')
26
+ idempotent_apply(manifest, option: 'value')
27
+ end
21
28
  end
22
29
 
23
30
  describe '.apply_manifest' do
data/spec/spec_helper.rb CHANGED
@@ -1,6 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'rspec'
4
+ require 'open3'
5
+ require 'ostruct'
4
6
 
5
7
  if ENV['COVERAGE'] == 'yes'
6
8
  require 'simplecov'
@@ -32,6 +34,17 @@ if ENV['COVERAGE'] == 'yes'
32
34
  end
33
35
  end
34
36
 
37
+ def run_matrix_from_metadata_v2(options = {})
38
+ command = 'bundle exec ./exe/matrix_from_metadata_v2'
39
+ command += " --exclude-platforms '#{options['--exclude-platforms']}'" unless options['--exclude-platforms'].nil?
40
+ result = Open3.capture3({ 'TEST_MATRIX_FROM_METADATA' => 'spec/exe/fake_metadata.json' }, command)
41
+ OpenStruct.new(
42
+ stdout: result[0],
43
+ stderr: result[1],
44
+ status_code: result[2],
45
+ )
46
+ end
47
+
35
48
  # This is basically how `configure!` sets up RSpec in tests.
36
49
  require 'puppet_litmus'
37
50
  RSpec.configure do |config|
@@ -0,0 +1,130 @@
1
+ # frozen_string_literal: true
2
+
3
+ def no_config_hash
4
+ { 'groups' =>
5
+ [
6
+ { 'name' => 'ssh_nodes',
7
+ 'targets' =>
8
+ [{ 'uri' => 'test.delivery.puppetlabs.net',
9
+ 'facts' => { 'provisioner' => 'vmpooler', 'platform' => 'centos-5-x86_64' } }] },
10
+ { 'name' => 'winrm_nodes', 'targets' => [] },
11
+ ] }
12
+ end
13
+
14
+ def no_docker_hash
15
+ { 'groups' =>
16
+ [{ 'name' => 'ssh_nodes', 'targets' => [] },
17
+ { 'name' => 'winrm_nodes', 'targets' => [] }] }
18
+ end
19
+
20
+ def config_hash
21
+ { 'groups' =>
22
+ [{ 'name' => 'ssh_nodes',
23
+ 'targets' =>
24
+ [{ 'uri' => 'test.delivery.puppetlabs.net',
25
+ 'config' => { 'transport' => 'ssh', 'ssh' => { 'user' => 'root', 'password' => 'Qu@lity!', 'host-key-check' => false } },
26
+ 'facts' => { 'provisioner' => 'vmpooler', 'platform' => 'centos-5-x86_64' },
27
+ 'vars' => { 'role' => 'agent' } }] },
28
+ { 'name' => 'winrm_nodes', 'targets' => [] }] }
29
+ end
30
+
31
+ def no_feature_hash
32
+ { 'groups' =>
33
+ [{ 'name' => 'ssh_nodes',
34
+ 'targets' =>
35
+ [{ 'uri' => 'test.delivery.puppetlabs.net',
36
+ 'config' => { 'transport' => 'ssh', 'ssh' => { 'user' => 'root', 'password' => 'Qu@lity!', 'host-key-check' => false } },
37
+ 'facts' => { 'provisioner' => 'vmpooler', 'platform' => 'centos-5-x86_64' } }] },
38
+ { 'name' => 'winrm_nodes', 'targets' => [] }] }
39
+ end
40
+
41
+ def feature_hash_group
42
+ { 'groups' =>
43
+ [{ 'name' => 'ssh_nodes',
44
+ 'targets' =>
45
+ [{ 'uri' => 'test.delivery.puppetlabs.net',
46
+ 'config' => { 'transport' => 'ssh', 'ssh' => { 'user' => 'root', 'password' => 'Qu@lity!', 'host-key-check' => false } },
47
+ 'facts' => { 'provisioner' => 'vmpooler', 'platform' => 'centos-5-x86_64' } }],
48
+ 'features' => ['puppet-agent'] },
49
+ { 'name' => 'winrm_nodes', 'targets' => [] }] }
50
+ end
51
+
52
+ def empty_feature_hash_group
53
+ { 'groups' =>
54
+ [{ 'name' => 'ssh_nodes',
55
+ 'targets' =>
56
+ [{ 'uri' => 'test.delivery.puppetlabs.net',
57
+ 'config' => { 'transport' => 'ssh', 'ssh' => { 'user' => 'root', 'password' => 'Qu@lity!', 'host-key-check' => false } },
58
+ 'facts' => { 'provisioner' => 'vmpooler', 'platform' => 'centos-5-x86_64' } }],
59
+ 'features' => [] },
60
+ { 'name' => 'winrm_nodes', 'targets' => [] }] }
61
+ end
62
+
63
+ def feature_hash_node
64
+ { 'groups' =>
65
+ [{ 'name' => 'ssh_nodes',
66
+ 'targets' =>
67
+ [{ 'uri' => 'test.delivery.puppetlabs.net',
68
+ 'config' => { 'transport' => 'ssh', 'ssh' => { 'user' => 'root', 'password' => 'Qu@lity!', 'host-key-check' => false } },
69
+ 'facts' => { 'provisioner' => 'vmpooler', 'platform' => 'centos-5-x86_64' },
70
+ 'features' => ['puppet-agent'] }] },
71
+ { 'name' => 'winrm_nodes', 'targets' => [] }] }
72
+ end
73
+
74
+ def empty_feature_hash_node
75
+ { 'groups' =>
76
+ [{ 'name' => 'ssh_nodes',
77
+ 'targets' =>
78
+ [{ 'uri' => 'test.delivery.puppetlabs.net',
79
+ 'config' => { 'transport' => 'ssh', 'ssh' => { 'user' => 'root', 'password' => 'Qu@lity!', 'host-key-check' => false } },
80
+ 'facts' => { 'provisioner' => 'vmpooler', 'platform' => 'centos-5-x86_64' },
81
+ 'features' => [] }] },
82
+ { 'name' => 'winrm_nodes', 'targets' => [] }] }
83
+ end
84
+
85
+ def foo_node
86
+ { 'uri' => 'foo',
87
+ 'facts' => { 'provisioner' => 'bar', 'platform' => 'ubuntu' } }
88
+ end
89
+
90
+ def complex_inventory
91
+ { 'groups' =>
92
+ [
93
+ {
94
+ 'name' => 'ssh_nodes',
95
+ 'groups' => [
96
+ { 'name' => 'frontend',
97
+ 'targets' => [
98
+ {
99
+ 'uri' => 'test.delivery.puppetlabs.net',
100
+ 'config' => { 'transport' => 'ssh', 'ssh' => { 'user' => 'root', 'password' => 'Qu@lity!', 'host-key-check' => false } },
101
+ 'facts' => { 'provisioner' => 'vmpooler', 'platform' => 'centos-5-x86_64' },
102
+ 'vars' => { 'role' => 'agent' },
103
+ },
104
+ {
105
+ 'uri' => 'test2.delivery.puppetlabs.net',
106
+ 'config' => { 'transport' => 'ssh', 'ssh' => { 'user' => 'root', 'password' => 'Qu@lity!', 'host-key-check' => false } },
107
+ 'facts' => { 'provisioner' => 'vmpooler', 'platform' => 'centos-5-x86_64' },
108
+ 'vars' => { 'role' => 'server' },
109
+ },
110
+ {
111
+ 'uri' => 'test3.delivery.puppetlabs.net',
112
+ 'config' => { 'transport' => 'ssh', 'ssh' => { 'user' => 'root', 'password' => 'Qu@lity!', 'host-key-check' => false } },
113
+ 'vars' => { 'roles' => %w[agent nginx webserver] },
114
+ },
115
+ ] },
116
+ ],
117
+ },
118
+ {
119
+ 'name' => 'winrm_nodes',
120
+ 'targets' => [
121
+ {
122
+ 'uri' => 'test4.delivery.puppetlabs.net',
123
+ 'config' => { 'transport' => 'winrm', 'winrm' => { 'user' => 'admin', 'password' => 'Qu@lity!' } },
124
+ 'facts' => { 'provisioner' => 'vmpooler', 'platform' => 'centos-5-x86_64' },
125
+ 'vars' => { 'roles' => %w[agent iis webserver] },
126
+ },
127
+ ],
128
+ },
129
+ ] }
130
+ end
@@ -0,0 +1,41 @@
1
+ groups:
2
+ - name: ssh_nodes
3
+ groups:
4
+ - name: webservers
5
+ targets:
6
+ - 192.168.100.179
7
+ - 192.168.100.180
8
+ - 192.168.100.181
9
+ - name: memcached
10
+ targets:
11
+ - 192.168.101.50
12
+ - 192.168.101.60
13
+ config:
14
+ ssh:
15
+ user: root
16
+ config:
17
+ transport: ssh
18
+ ssh:
19
+ user: centos
20
+ private-key: ~/.ssh/id_rsa
21
+ host-key-check: false
22
+ - name: win_nodes
23
+ groups:
24
+ - name: domaincontrollers
25
+ targets:
26
+ - 192.168.110.10
27
+ - 192.168.110.20
28
+ - name: testservers
29
+ targets:
30
+ - 172.16.219.20
31
+ - 172.16.219.30
32
+ config:
33
+ winrm:
34
+ realm: MYDOMAIN
35
+ ssl: false
36
+ config:
37
+ transport: winrm
38
+ winrm:
39
+ user: DOMAIN\opsaccount
40
+ password: S3cretP@ssword
41
+ ssl: true
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.28.0
4
+ version: 0.31.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Puppet, Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-07-29 00:00:00.000000000 Z
11
+ date: 2022-02-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bolt
@@ -185,6 +185,8 @@ files:
185
185
  - spec/data/doot.tar.gz
186
186
  - spec/data/inventory.yaml
187
187
  - spec/data/jim.yaml
188
+ - spec/exe/fake_metadata.json
189
+ - spec/exe/matrix_from_metadata_v2_spec.rb
188
190
  - spec/lib/puppet_litmus/inventory_manipulation_spec.rb
189
191
  - spec/lib/puppet_litmus/puppet_helpers_spec.rb
190
192
  - spec/lib/puppet_litmus/puppet_litmus_version_spec.rb
@@ -192,6 +194,8 @@ files:
192
194
  - spec/lib/puppet_litmus/rake_tasks_spec.rb
193
195
  - spec/lib/puppet_litmus/util_spec.rb
194
196
  - spec/spec_helper.rb
197
+ - spec/support/inventory.rb
198
+ - spec/support/inventorytesting.yaml
195
199
  homepage: https://github.com/puppetlabs/puppet_litmus
196
200
  licenses:
197
201
  - Apache-2.0
@@ -218,12 +222,16 @@ summary: Providing a simple command line tool for puppet content creators, to en
218
222
  simple and complex test deployments.
219
223
  test_files:
220
224
  - spec/spec_helper.rb
225
+ - spec/support/inventory.rb
226
+ - spec/support/inventorytesting.yaml
221
227
  - spec/lib/puppet_litmus/rake_tasks_spec.rb
222
228
  - spec/lib/puppet_litmus/puppet_litmus_version_spec.rb
223
229
  - spec/lib/puppet_litmus/util_spec.rb
224
230
  - spec/lib/puppet_litmus/inventory_manipulation_spec.rb
225
231
  - spec/lib/puppet_litmus/rake_helper_spec.rb
226
232
  - spec/lib/puppet_litmus/puppet_helpers_spec.rb
233
+ - spec/exe/fake_metadata.json
234
+ - spec/exe/matrix_from_metadata_v2_spec.rb
227
235
  - spec/data/doot.tar.gz
228
236
  - spec/data/jim.yaml
229
237
  - spec/data/inventory.yaml