puppet_litmus 0.25.0 → 0.26.3

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: c30427123e4564bc48f1ab51d5ba1a309d51a92cfaa960ca879cf0bc9646b811
4
- data.tar.gz: 0c84f4661ece76aa2c69e375c7c82b0a2c8eef4d9b644edd6e50c516e3eb2b5b
3
+ metadata.gz: f98913f0f6a0c9ad4060437f3d79da268611da67a03a147f79ae84ebc39f0626
4
+ data.tar.gz: 8f6f10a27f7151c7d1b6f1428f8b0b9c2976a5c63ecbc6586ee58e047f695c68
5
5
  SHA512:
6
- metadata.gz: b188680048a9f7c9aa78f579555cf2ce892b74a9dbf03d7463a6f12f097b17db4dcde1fb0173c1037e1817a9cc423cf948c2888c18cf141499dd57adcc9607bf
7
- data.tar.gz: bd2df6cd288d01181384eb9ecd943b3f508d8c5262062acb4cbe88c1b694c578e435769fc067cbaea0032c3e224f9b8193485cab34f3aaa75e91d8dfed9d31ea
6
+ metadata.gz: aef4defe588e0e2abc252ce3110fa6dea31d25dd9977809a28029eb0856e9348a134a69058089078b254b27865372ce740d5903ccbf0151fe6b8769d8e503d24
7
+ data.tar.gz: 75da654699d7820473e840ab65e998387c89ab76cf935ede3835f4fdda280669dd01af29f8de098308655ace037b1807a4ec53771e969102c97ba1965b32b11e
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/).
@@ -20,13 +20,13 @@ DOCKER_PLATFORMS = {
20
20
  'CentOS-7' => 'litmusimage/centos:7',
21
21
  'CentOS-8' => 'litmusimage/centos:8',
22
22
  'Debian-10' => 'litmusimage/debian:10',
23
- 'Debian-8' => 'litmusimage/debian:8',
23
+ # 'Debian-8' => 'litmusimage/debian:8', Removing from testing: https://puppet.com/docs/pe/2021.0/supported_operating_systems.html
24
24
  'Debian-9' => 'litmusimage/debian:9',
25
25
  'OracleLinux-6' => 'litmusimage/oraclelinux:6',
26
26
  'OracleLinux-7' => 'litmusimage/oraclelinux:7',
27
27
  'Scientific-6' => 'litmusimage/scientificlinux:6',
28
28
  'Scientific-7' => 'litmusimage/scientificlinux:7',
29
- 'Ubuntu-14.04' => 'litmusimage/ubuntu:14.04',
29
+ # 'Ubuntu-14.04' => 'litmusimage/ubuntu:14.04', Removing from testing: https://puppet.com/docs/pe/2021.0/supported_operating_systems.html
30
30
  'Ubuntu-16.04' => 'litmusimage/ubuntu:16.04',
31
31
  'Ubuntu-18.04' => 'litmusimage/ubuntu:18.04',
32
32
  'Ubuntu-20.04' => 'litmusimage/ubuntu:20.04',
@@ -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.0'
5
+ VERSION ||= '0.26.3'
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.0
4
+ version: 0.26.3
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-25 00:00:00.000000000 Z
11
+ date: 2021-04-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bolt
@@ -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.2
215
215
  signing_key:
216
216
  specification_version: 4
217
217
  summary: Providing a simple command line tool for puppet content creators, to enable