puppet_litmus 0.25.1 → 0.27.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 228833b61d086ab7b01341ce03eb1169c309855209ca8a1345d55525fbe6403b
4
- data.tar.gz: 9e1f9a8f180f047bf49ac493b00871294bf22adccc134fbea6aa7c46fa8b6769
3
+ metadata.gz: 8d77bde09896757aa35ff61163febb315e2d50682b1b2dcdfdbc53b77da576c8
4
+ data.tar.gz: d80089f753244e77bf491e4bc9ac14a42e6ae112a85d4b6f41206c38b22b7a07
5
5
  SHA512:
6
- metadata.gz: efc5c864bf1781678e2cfd729bbbe2e5bdbe1f0eb03b244f135d892629c6e404aa01c1290fb001bb5616f8149800ff05e55fb57abb78b4f2041d1539ab18864d
7
- data.tar.gz: 1b12e3fcd6b1d9def5040c720a543a44df317538dcfe9058930a205412c709ff6160215edacaa4f6c22e6c2223b543d9f6d7ccc884b059ce849c5c83ce3079e1
6
+ metadata.gz: 31a2ac1b11fb651d06de17648e345fbab6105ceb92ff9da52632bba725f1689a111219040e5dacf25cc775382ea15c3845167318a45a953cfb33ab1ebf509d30
7
+ data.tar.gz: 108b085470b7d07a438c105871300f9a5a759443592073239c4c4d9c8648207c51774c9689a951ef3adc4b70796cada4f47b4f3263c295fde5aafa99f41ac472
data/README.md CHANGED
@@ -22,6 +22,8 @@ Litmus also facilitates parallel test runs and running tests in isolation. Each
22
22
 
23
23
  Install Litmus as a gem by running ```gem install puppet_litmus```.
24
24
 
25
+ * Note if you choose to override the `litmus_inventory.yaml` location, please ensure that the directory strutcture you define exists.
26
+
25
27
  ## Documentation
26
28
 
27
29
  For documentation, see our [Litmus Docs Site](https://puppetlabs.github.io/litmus/).
@@ -34,16 +34,26 @@ DOCKER_PLATFORMS = {
34
34
 
35
35
  # This table uses the latest version in each collection for accurate
36
36
  # comparison when evaluating puppet requirements from the metadata
37
- COLLECTION_TABLE = {
38
- '6.24.0' => 'puppet6-nightly',
39
- '7.4.0' => 'puppet7-nightly',
40
- }.freeze
37
+ COLLECTION_TABLE = [
38
+ {
39
+ puppet_maj_version: 6,
40
+ ruby_version: 2.5,
41
+ },
42
+ {
43
+ puppet_maj_version: 7,
44
+ ruby_version: 2.7,
45
+ },
46
+ ].freeze
41
47
 
42
48
  matrix = {
43
49
  platforms: [],
44
50
  collection: [],
45
51
  }
46
52
 
53
+ spec_matrix = {
54
+ include: [],
55
+ }
56
+
47
57
  metadata = JSON.parse(File.read('metadata.json'))
48
58
  # Set platforms based on declared operating system support
49
59
  metadata['operatingsystem_support'].sort_by { |a| a['operatingsystem'] }.each do |sup|
@@ -83,17 +93,20 @@ if metadata.key?('requirements') && metadata['requirements'].length.positive?
83
93
  cmp_one, ver_one, cmp_two, ver_two = match.captures
84
94
  reqs = ["#{cmp_one} #{ver_one}", "#{cmp_two} #{ver_two}"]
85
95
 
86
- COLLECTION_TABLE.each do |key, val|
87
- if Gem::Requirement.create(reqs).satisfied_by?(Gem::Version.new(key))
88
- matrix[:collection] << val
89
- end
96
+ COLLECTION_TABLE.each do |collection|
97
+ # Test against the "largest" puppet version in a collection, e.g. `7.9999` to allow puppet requirements with a non-zero lower bound on minor/patch versions.
98
+ # This assumes that such a boundary will always allow the latest actually existing puppet version of a release stream, trading off simplicity vs accuracy here.
99
+ next unless Gem::Requirement.create(reqs).satisfied_by?(Gem::Version.new("#{collection[:puppet_maj_version]}.9999"))
100
+
101
+ matrix[:collection] << "puppet#{collection[:puppet_maj_version]}-nightly"
102
+ spec_matrix[:include] << { puppet_version: "~> #{collection[:puppet_maj_version]}.0", ruby_version: collection[:ruby_version] }
90
103
  end
91
104
  end
92
105
  end
93
106
 
94
107
  # Set to defaults (all collections) if no matches are found
95
108
  if matrix[:collection].empty?
96
- matrix[:collection] = COLLECTION_TABLE.values
109
+ matrix[:collection] = COLLECTION_TABLE.map { |collection| "puppet#{collection[:puppet_maj_version]}-nightly" }
97
110
  end
98
111
 
99
112
  # Just to make sure there aren't any duplicates
@@ -101,5 +114,11 @@ matrix[:platforms] = matrix[:platforms].uniq.sort { |a, b| a[:label] <=> b[:labe
101
114
  matrix[:collection] = matrix[:collection].uniq.sort
102
115
 
103
116
  puts "::set-output name=matrix::#{JSON.generate(matrix)}"
117
+ puts "::set-output name=spec_matrix::#{JSON.generate(spec_matrix)}"
118
+
119
+ acceptance_test_cell_count = matrix[:platforms].length * matrix[:collection].length
120
+ spec_test_cell_count = spec_matrix[:include].length
104
121
 
105
- puts "Created matrix with #{matrix[:platforms].length * matrix[:collection].length} cells."
122
+ puts "Created matrix with #{acceptance_test_cell_count + spec_test_cell_count} cells:"
123
+ puts " - Acceptance Test Cells: #{acceptance_test_cell_count}"
124
+ puts " - Spec Test Cells: #{spec_test_cell_count}"
@@ -11,7 +11,7 @@ module PuppetLitmus::InventoryManipulation
11
11
  def inventory_hash_from_inventory_file(inventory_full_path = nil)
12
12
  require 'yaml'
13
13
  inventory_full_path = if inventory_full_path.nil?
14
- 'inventory.yaml'
14
+ "#{Dir.pwd}/spec/fixtures/litmus_inventory.yaml"
15
15
  else
16
16
  inventory_full_path
17
17
  end
@@ -69,13 +69,19 @@ module PuppetLitmus::PuppetHelpers
69
69
  end
70
70
 
71
71
  manifest_file_location = opts[:manifest_file_location] || create_manifest_file(manifest)
72
- inventory_hash = File.exist?('inventory.yaml') ? inventory_hash_from_inventory_file : localhost_inventory_hash
73
- raise "Target '#{target_node_name}' not found in inventory.yaml" unless target_in_inventory?(inventory_hash, target_node_name)
72
+ 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
74
 
75
75
  span.add_field('litmus.node_name', target_node_name)
76
76
  add_platform_field(inventory_hash, target_node_name)
77
77
 
78
- command_to_run = "#{opts[:prefix_command]} puppet apply #{manifest_file_location}"
78
+ # Forcibly set the locale of the command
79
+ locale = if os[:family] != 'windows'
80
+ 'LC_ALL=en_US.UTF-8 '
81
+ else
82
+ ''
83
+ end
84
+ command_to_run = "#{locale}#{opts[:prefix_command]} puppet apply #{manifest_file_location}"
79
85
  command_to_run += ' --trace' if !opts[:trace].nil? && (opts[:trace] == true)
80
86
  command_to_run += " --modulepath #{Dir.pwd}/spec/fixtures/modules" if target_node_name == 'litmus_localhost'
81
87
  command_to_run += " --hiera_config='#{opts[:hiera_config]}'" unless opts[:hiera_config].nil?
@@ -207,8 +213,8 @@ module PuppetLitmus::PuppetHelpers
207
213
  span.add_field('litmus.opts', opts)
208
214
 
209
215
  target_node_name = targeting_localhost? ? 'litmus_localhost' : ENV['TARGET_HOST']
210
- inventory_hash = File.exist?('inventory.yaml') ? inventory_hash_from_inventory_file : localhost_inventory_hash
211
- raise "Target '#{target_node_name}' not found in inventory.yaml" unless target_in_inventory?(inventory_hash, target_node_name)
216
+ 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)
212
218
 
213
219
  span.add_field('litmus.node_name', target_node_name)
214
220
  add_platform_field(inventory_hash, target_node_name)
@@ -246,8 +252,8 @@ module PuppetLitmus::PuppetHelpers
246
252
  span.add_field('litmus.options', options)
247
253
 
248
254
  target_node_name = targeting_localhost? ? 'litmus_localhost' : ENV['TARGET_HOST']
249
- inventory_hash = File.exist?('inventory.yaml') ? inventory_hash_from_inventory_file : localhost_inventory_hash
250
- raise "Target '#{target_node_name}' not found in inventory.yaml" unless target_in_inventory?(inventory_hash, target_node_name)
255
+ 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)
251
257
 
252
258
  span.add_field('litmus.node_name', target_node_name)
253
259
  add_platform_field(inventory_hash, target_node_name)
@@ -300,12 +306,12 @@ module PuppetLitmus::PuppetHelpers
300
306
  target_node_name = targeting_localhost? ? 'litmus_localhost' : ENV['TARGET_HOST']
301
307
  inventory_hash = if !opts[:inventory_file].nil? && File.exist?(opts[:inventory_file])
302
308
  inventory_hash_from_inventory_file(opts[:inventory_file])
303
- elsif File.exist?('inventory.yaml')
304
- inventory_hash_from_inventory_file('inventory.yaml')
309
+ elsif File.exist?('spec/fixtures/litmus_inventory.yaml')
310
+ inventory_hash_from_inventory_file('spec/fixtures/litmus_inventory.yaml')
305
311
  else
306
312
  localhost_inventory_hash
307
313
  end
308
- raise "Target '#{target_node_name}' not found in inventory.yaml" unless target_in_inventory?(inventory_hash, target_node_name)
314
+ raise "Target '#{target_node_name}' not found in spec/fixtures/litmus_inventory.yaml" unless target_in_inventory?(inventory_hash, target_node_name)
309
315
 
310
316
  span.add_field('litmus.node_name', target_node_name)
311
317
  add_platform_field(inventory_hash, target_node_name)
@@ -365,8 +371,8 @@ module PuppetLitmus::PuppetHelpers
365
371
  span.add_field('litmus.arguments', arguments)
366
372
 
367
373
  target_node_name = targeting_localhost? ? 'litmus_localhost' : ENV['TARGET_HOST']
368
- inventory_hash = File.exist?('inventory.yaml') ? inventory_hash_from_inventory_file : localhost_inventory_hash
369
- raise "Target '#{target_node_name}' not found in inventory.yaml" unless target_in_inventory?(inventory_hash, target_node_name)
374
+ 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)
370
376
 
371
377
  span.add_field('litmus.node_name', target_node_name)
372
378
  add_platform_field(inventory_hash, target_node_name)
@@ -125,7 +125,7 @@ namespace :litmus do
125
125
 
126
126
  results = install_agent(args[:collection], targets, inventory_hash)
127
127
  results.each do |result|
128
- command_to_run = "bolt task run puppet_agent::install --targets #{result['target']} --inventoryfile inventory.yaml --modulepath #{DEFAULT_CONFIG_DATA['modulepath']}"
128
+ command_to_run = "bolt task run puppet_agent::install --targets #{result['target']} --inventoryfile spec/fixtures/litmus_inventory.yaml --modulepath #{DEFAULT_CONFIG_DATA['modulepath']}"
129
129
  raise "Failed on #{result['target']}\n#{result}\ntry running '#{command_to_run}'" if result['status'] != 'success'
130
130
 
131
131
  # validate successful install
@@ -157,7 +157,7 @@ namespace :litmus do
157
157
  end
158
158
 
159
159
  # update the inventory with the puppet-agent feature set per node
160
- write_to_inventory_file(inventory_hash, 'inventory.yaml')
160
+ write_to_inventory_file(inventory_hash, 'spec/fixtures/litmus_inventory.yaml')
161
161
  end
162
162
 
163
163
  # Add a given feature to a selection of nodes
@@ -182,7 +182,7 @@ namespace :litmus do
182
182
  inventory_hash = add_feature_to_node(inventory_hash, args[:added_feature], target)
183
183
  end
184
184
 
185
- write_to_inventory_file(inventory_hash, 'inventory.yaml')
185
+ write_to_inventory_file(inventory_hash, 'spec/fixtures/litmus_inventory.yaml')
186
186
 
187
187
  puts 'Feature added'
188
188
  end
@@ -336,7 +336,7 @@ namespace :litmus do
336
336
 
337
337
  namespace :acceptance do
338
338
  require 'rspec/core/rake_task'
339
- if File.file?('inventory.yaml')
339
+ if File.file?('spec/fixtures/litmus_inventory.yaml')
340
340
  inventory_hash = inventory_hash_from_inventory_file
341
341
  targets = find_targets(inventory_hash, nil)
342
342
 
@@ -2,5 +2,5 @@
2
2
 
3
3
  # version of this gem
4
4
  module PuppetLitmus
5
- VERSION ||= '0.25.1'
5
+ VERSION ||= '0.27.0'
6
6
  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.25.1
4
+ version: 0.27.0
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-02-26 00:00:00.000000000 Z
11
+ date: 2021-04-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bolt
@@ -19,7 +19,7 @@ dependencies:
19
19
  version: 2.0.1
20
20
  - - "<"
21
21
  - !ruby/object:Gem::Version
22
- version: 3.0.0
22
+ version: 4.0.0
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
@@ -29,7 +29,7 @@ dependencies:
29
29
  version: 2.0.1
30
30
  - - "<"
31
31
  - !ruby/object:Gem::Version
32
- version: 3.0.0
32
+ version: 4.0.0
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: puppet-modulebuilder
35
35
  requirement: !ruby/object:Gem::Requirement
@@ -211,7 +211,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
211
211
  - !ruby/object:Gem::Version
212
212
  version: '0'
213
213
  requirements: []
214
- rubygems_version: 3.0.6
214
+ rubygems_version: 3.1.4
215
215
  signing_key:
216
216
  specification_version: 4
217
217
  summary: Providing a simple command line tool for puppet content creators, to enable