puppet_litmus 2.6.0 → 2.8.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: 68a5da663b866300b6b5a615485c799acf5e21734dcccc7218fa0eb90a5796aa
4
- data.tar.gz: a6d3f206e3c5c5f7676d2bac31e39cb60171df89f43cafded174703d45f8e8e0
3
+ metadata.gz: ddb31ff29d7e1d38620998447c3b0374b5d83c000a728c82335b792d31713f69
4
+ data.tar.gz: 577f054f113f94e527749b187567b04f62335ce2eae6f4d36d299a554cacc6ca
5
5
  SHA512:
6
- metadata.gz: f1c2dbfa634c423163cb8d2722d5fc172073d2c1daa2065d7acba8e95242e96ec22e63f53ded70180d1260c75df80ab7106e33bbb99dd42bf76ca15b02232323
7
- data.tar.gz: 02cb42bb65966d51a94b57b87d590684a7b79101544bd30cafbfb3de85759e242ec0501759ecc432824bca55aaa3c5673bb1c9e63ebeef6845ad0dc77b4ddec0
6
+ metadata.gz: 500e38ceadb721af5cb4c45ae84d38edf417bd55411f67e5b910d9b74090739be94169d370cf7663a86f445c4853ca92fcf5e43170aaf5d01719cc4ba4a7c943
7
+ data.tar.gz: 38fd30196f4b5c6eb952bee7f230d5c14a76b9d75cc45eed4681abb72eec1e5075d61d5963a44bdc4a13be51d3dcb739e12ec14ae99877184efe8f11fedefbbe
data/README.md CHANGED
@@ -68,6 +68,7 @@ in the project module root directory run `bundle exec matrix_from_metadata_v3`
68
68
  | --puppet-exclude | MAJOR | | Filter puppet major version |
69
69
  | --platform-include | REGEX | | Select platform |
70
70
  | --platform-exclude | REGEX | | Filter platform |
71
+ | --collection-platform-exclude | MAJOR:REGEX | | Filter a platform for one puppet major only, emitted as a GitHub Actions matrix exclude so the platform stays in other collections. Repeatable |
71
72
  | --arch-include | REGEX | | Select architecture |
72
73
  | --arch-exclude | REGEX | | Filter architecture |
73
74
  | --provision-prefer | NAME | docker | Prefer provisioner |
@@ -88,6 +89,10 @@ in the project module root directory run `bundle exec matrix_from_metadata_v3`
88
89
  ```sh
89
90
  matrix_from_metadata_v3 --platform-exclude redhat-7 --platform-exclude ubuntu-18.04
90
91
  ```
92
+ * Exclude a platform for one puppet major only (kept in other collections). E.g. ubuntu-20.04 has no Puppet 9 agent but is valid on Puppet 8:
93
+ ```sh
94
+ matrix_from_metadata_v3 --nightly --collection-platform-exclude 9:ubuntu-20.04
95
+ ```
91
96
  * Exclude architecture
92
97
  ```sh
93
98
  matrix_from_metadata_v3 --arch-exclude x86_64
data/exe/matrix.json CHANGED
@@ -3,6 +3,10 @@
3
3
  {
4
4
  "puppet": 8.0,
5
5
  "ruby": 3.2
6
+ },
7
+ {
8
+ "puppet": 9.0,
9
+ "ruby": 4.0
6
10
  }
7
11
  ],
8
12
  "provisioners": {
@@ -44,7 +48,8 @@
44
48
  "Windows": {
45
49
  "2016": { "x86_64": "windows-2016" },
46
50
  "2019": { "x86_64": "windows-2019" },
47
- "2022": { "x86_64": "windows-2022" }
51
+ "2022": { "x86_64": "windows-2022" },
52
+ "2025": { "x86_64": "windows-2025" }
48
53
  }
49
54
  },
50
55
  "docker": {
@@ -33,7 +33,8 @@ IMAGE_TABLE = {
33
33
  'SLES-15' => 'sles-15',
34
34
  'Windows-2016' => 'windows-2016',
35
35
  'Windows-2019' => 'windows-2019',
36
- 'Windows-2022' => 'windows-2022'
36
+ 'Windows-2022' => 'windows-2022',
37
+ 'Windows-2025' => 'windows-2025'
37
38
  }.freeze
38
39
 
39
40
  ARM_IMAGE_TABLE = {
@@ -86,6 +86,7 @@ options = OpenStruct.new(
86
86
  puppet_include: [],
87
87
  platform_exclude: [],
88
88
  platform_include: [],
89
+ collection_platform_exclude: [],
89
90
  arch_include: [],
90
91
  arch_exclude: [],
91
92
  provision_prefer: [],
@@ -155,6 +156,21 @@ begin
155
156
  opt.on('--platform-include REGEX', Regexp, 'Select platform') { |o| options.platform_include << o }
156
157
  opt.on('--platform-exclude REGEX', Regexp, 'Filter platform') { |o| options.platform_exclude << o }
157
158
 
159
+ opt.on('--collection-platform-exclude SPEC', String,
160
+ 'Filter a platform for one puppet major only, as MAJOR:PLATFORM_REGEX (e.g. 9:ubuntu-20.04). ' \
161
+ 'Emitted as a GitHub Actions matrix exclude so the platform stays in other collections. Repeatable.') do |o|
162
+ major, regex = o.split(':', 2)
163
+ raise OptionParser::InvalidArgument, "--collection-platform-exclude '#{o}' must be MAJOR:PLATFORM_REGEX" \
164
+ if regex.nil? || regex.empty? || major !~ /\A\d+\z/
165
+
166
+ begin
167
+ platform = Regexp.new(regex, Regexp::IGNORECASE)
168
+ rescue RegexpError => e
169
+ raise OptionParser::InvalidArgument, "--collection-platform-exclude '#{o}' has an invalid PLATFORM_REGEX: #{e.message}"
170
+ end
171
+ options.collection_platform_exclude << { major: major.to_i, platform: }
172
+ end
173
+
158
174
  opt.on('--arch-include REGEX', Regexp, 'Select architecture') { |o| options.arch_include << o }
159
175
  opt.on('--arch-exclude REGEX', Regexp, 'Filter architecture') { |o| options.arch_exclude << o }
160
176
 
@@ -287,21 +303,25 @@ options[:metadata]['requirements']&.each do |req|
287
303
  Action.warning('--nightly ignored: PUPPET_FORGE_TOKEN is not set, falling back to public puppet collection') \
288
304
  if options[:nightly] && !forge_token
289
305
  group = nightly ? "#{prefix}#{version}-nightly" : "#{prefix}#{version}"
290
- matrix[:collection] << if options[:latest_agent] && collection['puppet'] != 'nightly'
291
- require 'net/http'
292
- require 'json'
293
- require 'uri'
294
-
295
- uri = URI('https://forgeapi.puppet.com/private/versions/puppet-agent')
296
- response = Net::HTTP.get_response(uri)
297
- json_data = JSON.parse(response.body)
298
- all_versions = json_data.keys
299
- versionx = all_versions.select { |v| v.start_with?("#{collection['puppet'].to_i}.") }
300
- versionx.sort_by { |v| Gem::Version.new(v) }.last # rubocop:disable Style/RedundantSort
301
- { collection: group, version: agent_version }
302
- else
303
- group
304
- end
306
+
307
+ # puppet 9+ is only published via puppetcore; skip it when falling back to the public collection
308
+ if forge_token || version < 9
309
+ matrix[:collection] << if options[:latest_agent] && collection['puppet'] != 'nightly'
310
+ require 'net/http'
311
+ require 'json'
312
+ require 'uri'
313
+
314
+ uri = URI('https://forgeapi.puppet.com/private/versions/puppet-agent')
315
+ response = Net::HTTP.get_response(uri)
316
+ json_data = JSON.parse(response.body)
317
+ all_versions = json_data.keys
318
+ versionx = all_versions.select { |v| v.start_with?("#{collection['puppet'].to_i}.") }
319
+ versionx.sort_by { |v| Gem::Version.new(v) }.last # rubocop:disable Style/RedundantSort
320
+ { collection: group, version: agent_version }
321
+ else
322
+ group
323
+ end
324
+ end
305
325
 
306
326
  spec_matrix[:include] << {
307
327
  puppet_version: "~> #{collection['puppet']}",
@@ -366,6 +386,29 @@ options[:metadata]['operatingsystem_support'].each do |os_sup|
366
386
  end
367
387
  end
368
388
 
389
+ # Exclude specific platform x collection combinations (e.g. an OS a given puppet
390
+ # major ships no agent package for, such as ubuntu-20.04 on puppet 9). The platform
391
+ # and collection remain valid on their own, so this is emitted as a GitHub Actions
392
+ # matrix `exclude` that only drops the matching combinations.
393
+ unless options[:collection_platform_exclude].empty?
394
+ exclude = []
395
+ matrix[:collection].each do |coll|
396
+ coll_name = coll.is_a?(Hash) ? coll[:collection] : coll
397
+ major = coll_name.to_s[/\d+/]&.to_i
398
+ next if major.nil?
399
+
400
+ matrix[:platforms].each do |platform|
401
+ next unless options[:collection_platform_exclude].any? do |spec|
402
+ spec[:major] == major && platform[:label].match?(spec[:platform])
403
+ end
404
+
405
+ Action.notice("collection-platform-exclude filtered #{platform[:label]} x #{coll_name}")
406
+ exclude << { platforms: platform, collection: coll }
407
+ end
408
+ end
409
+ matrix[:exclude] = exclude unless exclude.empty?
410
+ end
411
+
369
412
  Action.group('matrix', matrix, pretty: true).group('spec_matrix', spec_matrix, pretty: true) if Action.type == 'github' && Action.notice
370
413
 
371
414
  Action.error('no supported puppet versions') if matrix[:collection].empty?
@@ -42,11 +42,10 @@ module PuppetLitmus::InventoryManipulation
42
42
  # @param targets [Array]
43
43
  # @return [Array] array of targets.
44
44
  def find_targets(inventory_hash, targets)
45
- if targets.nil?
46
- inventory_hash.to_s.scan(/uri"=>"(\S*)"/).flatten
47
- else
48
- [targets]
49
- end
45
+ return [targets] unless targets.nil?
46
+ return [] unless inventory_hash['groups']
47
+
48
+ targets_in_inventory(inventory_hash) { |target| target['uri'] }
50
49
  end
51
50
 
52
51
  # Recursively find and iterate over the groups in an inventory. If no block is passed
@@ -133,7 +133,7 @@ module PuppetLitmus::RakeHelper # rubocop:disable Metrics/ModuleLength
133
133
  # Skip forge token assignation when pointing to private collection endpoints as it is only accesible via VPN and it fails when credentials are passed.
134
134
  forge_token = ENV.fetch('PUPPET_FORGE_TOKEN', nil)
135
135
  params = {}
136
- params['password'] = forge_token if forge_token && !collection.include?('puppetcore8-nightly')
136
+ params['password'] = forge_token unless !forge_token || (collection.start_with?('puppetcore') && collection.end_with?('-nightly'))
137
137
  params['collection'] = collection if collection
138
138
  params['version'] = puppet_version if puppet_version
139
139
 
@@ -2,5 +2,5 @@
2
2
 
3
3
  # version of this gem
4
4
  module PuppetLitmus
5
- VERSION = '2.6.0'
5
+ VERSION = '2.8.0'
6
6
  end
@@ -47,7 +47,7 @@
47
47
  "requirements": [
48
48
  {
49
49
  "name": "puppet",
50
- "version_requirement": ">= 7.0.0 < 9.0.0"
50
+ "version_requirement": ">= 8.0.0 < 10.0.0"
51
51
  }
52
52
  ],
53
53
  "template-url": "https://github.com/puppetlabs/pdk-templates.git#main",
@@ -35,15 +35,15 @@ RSpec.describe 'matrix_from_metadata_v2' do
35
35
  '{"label":"Ubuntu-22.04-arm","provider":"provision_service","image":"ubuntu-2204-lts-arm64"}',
36
36
  '],',
37
37
  '"collection":[',
38
- '"puppetcore7","puppetcore8"',
38
+ '"puppetcore8"',
39
39
  ']',
40
40
  '}'
41
41
  ].join
42
42
  )
43
43
  expect(github_output_content).to include(
44
- 'spec_matrix={"include":[{"puppet_version":"~> 7.24","ruby_version":2.7},{"puppet_version":"~> 8.0","ruby_version":3.2}]}'
44
+ 'spec_matrix={"include":[{"puppet_version":"~> 8.0","ruby_version":3.2}]}'
45
45
  )
46
- expect(result.stdout).to include("Created matrix with 22 cells:\n - Acceptance Test Cells: 20\n - Spec Test Cells: 2")
46
+ expect(result.stdout).to include("Created matrix with 11 cells:\n - Acceptance Test Cells: 10\n - Spec Test Cells: 1")
47
47
  end
48
48
  end
49
49
 
@@ -79,15 +79,15 @@ RSpec.describe 'matrix_from_metadata_v2' do
79
79
  '{"label":"Ubuntu-22.04-arm","provider":"provision_service","image":"ubuntu-2204-lts-arm64"}',
80
80
  '],',
81
81
  '"collection":[',
82
- '"puppetcore7","puppetcore8"',
82
+ '"puppetcore8"',
83
83
  ']',
84
84
  '}'
85
85
  ].join
86
86
  )
87
87
  expect(github_output_content).to include(
88
- 'spec_matrix={"include":[{"puppet_version":"~> 7.24","ruby_version":2.7},{"puppet_version":"~> 8.0","ruby_version":3.2}]}'
88
+ 'spec_matrix={"include":[{"puppet_version":"~> 8.0","ruby_version":3.2}]}'
89
89
  )
90
- expect(result.stdout).to include("Created matrix with 20 cells:\n - Acceptance Test Cells: 18\n - Spec Test Cells: 2")
90
+ expect(result.stdout).to include("Created matrix with 10 cells:\n - Acceptance Test Cells: 9\n - Spec Test Cells: 1")
91
91
  end
92
92
  end
93
93
 
@@ -120,15 +120,15 @@ RSpec.describe 'matrix_from_metadata_v2' do
120
120
  '{"label":"Ubuntu-22.04-arm","provider":"provision_service","image":"ubuntu-2204-lts-arm64"}',
121
121
  '],',
122
122
  '"collection":[',
123
- '"puppetcore7","puppetcore8"',
123
+ '"puppetcore8"',
124
124
  ']',
125
125
  '}'
126
126
  ].join
127
127
  )
128
128
  expect(github_output_content).to include(
129
- 'spec_matrix={"include":[{"puppet_version":"~> 7.24","ruby_version":2.7},{"puppet_version":"~> 8.0","ruby_version":3.2}]}'
129
+ 'spec_matrix={"include":[{"puppet_version":"~> 8.0","ruby_version":3.2}]}'
130
130
  )
131
- expect(result.stdout).to include("Created matrix with 10 cells:\n - Acceptance Test Cells: 8\n - Spec Test Cells: 2")
131
+ expect(result.stdout).to include("Created matrix with 5 cells:\n - Acceptance Test Cells: 4\n - Spec Test Cells: 1")
132
132
  end
133
133
  end
134
134
 
@@ -159,15 +159,15 @@ RSpec.describe 'matrix_from_metadata_v2' do
159
159
  '{"label":"Ubuntu-22.04","provider":"docker","image":"litmusimage/ubuntu:22.04"}',
160
160
  '],',
161
161
  '"collection":[',
162
- '"puppetcore7","puppetcore8"',
162
+ '"puppetcore8"',
163
163
  ']',
164
164
  '}'
165
165
  ].join
166
166
  )
167
167
  expect(github_output_content).to include(
168
- 'spec_matrix={"include":[{"puppet_version":"~> 7.24","ruby_version":2.7},{"puppet_version":"~> 8.0","ruby_version":3.2}]}'
168
+ 'spec_matrix={"include":[{"puppet_version":"~> 8.0","ruby_version":3.2}]}'
169
169
  )
170
- expect(result.stdout).to include("Created matrix with 10 cells:\n - Acceptance Test Cells: 8\n - Spec Test Cells: 2")
170
+ expect(result.stdout).to include("Created matrix with 5 cells:\n - Acceptance Test Cells: 4\n - Spec Test Cells: 1")
171
171
  end
172
172
  end
173
173
  end
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'spec_helper'
4
+ require 'json'
4
5
 
5
6
  RSpec.describe 'matrix_from_metadata_v3' do
6
7
  let(:github_output) { Tempfile.new('github_output') }
@@ -30,7 +31,7 @@ RSpec.describe 'matrix_from_metadata_v3' do
30
31
  '{"label":"Ubuntu-22.04","provider":"docker","arch":"x86_64","image":"litmusimage/ubuntu:22.04","runner":"ubuntu-latest"}',
31
32
  '],',
32
33
  '"collection":[',
33
- '"puppetcore8"',
34
+ '"puppetcore8","puppetcore9"',
34
35
  ']',
35
36
  '}'
36
37
  ].join
@@ -41,7 +42,7 @@ RSpec.describe 'matrix_from_metadata_v3' do
41
42
  '::group::spec_matrix'
42
43
  )
43
44
  expect(github_output_content).to include(matrix)
44
- expect(github_output_content).to include('spec_matrix={"include":[{"puppet_version":"~> 8.0","ruby_version":3.2}]}')
45
+ expect(github_output_content).to include('spec_matrix={"include":[{"puppet_version":"~> 8.0","ruby_version":3.2},{"puppet_version":"~> 9.0","ruby_version":4.0}]}')
45
46
  end
46
47
  end
47
48
 
@@ -65,7 +66,7 @@ RSpec.describe 'matrix_from_metadata_v3' do
65
66
  '{"label":"Ubuntu-22.04-arm","provider":"provision_service","arch":"arm","image":"ubuntu-2204-lts-arm64","runner":"ubuntu-latest"}',
66
67
  '],',
67
68
  '"collection":[',
68
- '"puppetcore8"',
69
+ '"puppetcore8","puppetcore9"',
69
70
  ']',
70
71
  '}'
71
72
  ].join
@@ -84,7 +85,7 @@ RSpec.describe 'matrix_from_metadata_v3' do
84
85
  )
85
86
  expect(github_output_content).to include(matrix)
86
87
  expect(github_output_content).to include(
87
- 'spec_matrix={"include":[{"puppet_version":"~> 8.0","ruby_version":3.2}]}'
88
+ 'spec_matrix={"include":[{"puppet_version":"~> 8.0","ruby_version":3.2},{"puppet_version":"~> 9.0","ruby_version":4.0}]}'
88
89
  )
89
90
  end
90
91
  end
@@ -107,7 +108,7 @@ RSpec.describe 'matrix_from_metadata_v3' do
107
108
  '{"label":"Ubuntu-22.04-arm","provider":"provision_service","arch":"arm","image":"ubuntu-2204-lts-arm64","runner":"ubuntu-latest"}',
108
109
  '],',
109
110
  '"collection":[',
110
- '"puppetcore8"',
111
+ '"puppetcore8","puppetcore9"',
111
112
  ']',
112
113
  '}'
113
114
  ].join
@@ -126,7 +127,7 @@ RSpec.describe 'matrix_from_metadata_v3' do
126
127
  )
127
128
  expect(github_output_content).to include(matrix)
128
129
  expect(github_output_content).to include(
129
- 'spec_matrix={"include":[{"puppet_version":"~> 8.0","ruby_version":3.2}]}'
130
+ 'spec_matrix={"include":[{"puppet_version":"~> 8.0","ruby_version":3.2},{"puppet_version":"~> 9.0","ruby_version":4.0}]}'
130
131
  )
131
132
  end
132
133
  end
@@ -148,7 +149,7 @@ RSpec.describe 'matrix_from_metadata_v3' do
148
149
  '{"label":"Ubuntu-22.04-arm","provider":"provision_service","arch":"arm","image":"ubuntu-2204-lts-arm64","runner":"ubuntu-latest"}',
149
150
  '],',
150
151
  '"collection":[',
151
- '"puppetcore8"',
152
+ '"puppetcore8","puppetcore9"',
152
153
  ']',
153
154
  '}'
154
155
  ].join
@@ -168,7 +169,7 @@ RSpec.describe 'matrix_from_metadata_v3' do
168
169
  )
169
170
  expect(github_output_content).to include(matrix)
170
171
  expect(github_output_content).to include(
171
- 'spec_matrix={"include":[{"puppet_version":"~> 8.0","ruby_version":3.2}]}'
172
+ 'spec_matrix={"include":[{"puppet_version":"~> 8.0","ruby_version":3.2},{"puppet_version":"~> 9.0","ruby_version":4.0}]}'
172
173
  )
173
174
  end
174
175
  end
@@ -181,7 +182,7 @@ RSpec.describe 'matrix_from_metadata_v3' do
181
182
  '"platforms":[',
182
183
  '],',
183
184
  '"collection":[',
184
- '"puppetcore8"',
185
+ '"puppetcore8","puppetcore9"',
185
186
  ']',
186
187
  '}'
187
188
  ].join
@@ -205,7 +206,7 @@ RSpec.describe 'matrix_from_metadata_v3' do
205
206
  )
206
207
  expect(github_output_content).to include(matrix)
207
208
  expect(github_output_content).to include(
208
- 'spec_matrix={"include":[{"puppet_version":"~> 8.0","ruby_version":3.2}]}'
209
+ 'spec_matrix={"include":[{"puppet_version":"~> 8.0","ruby_version":3.2},{"puppet_version":"~> 9.0","ruby_version":4.0}]}'
209
210
  )
210
211
  end
211
212
  end
@@ -239,10 +240,9 @@ RSpec.describe 'matrix_from_metadata_v3' do
239
240
  '::group::matrix',
240
241
  '::group::spec_matrix'
241
242
  )
242
- expect(github_output_content).to match(/"collection":\["\d{4}\.\d\.\d-puppet_enterprise","\d{4}\.\d\.\d-puppet_enterprise","puppetcore8"/)
243
-
243
+ expect(github_output_content).to match(/"collection":\[(?:"\d{4}\.\d+\.\d+-puppet_enterprise",)+"puppetcore8","puppetcore9"/)
244
244
  expect(github_output_content).to include(
245
- 'spec_matrix={"include":[{"puppet_version":"~> 8.0","ruby_version":3.2}]}'
245
+ 'spec_matrix={"include":[{"puppet_version":"~> 8.0","ruby_version":3.2},{"puppet_version":"~> 9.0","ruby_version":4.0}]}'
246
246
  )
247
247
  end
248
248
  end
@@ -265,7 +265,7 @@ RSpec.describe 'matrix_from_metadata_v3' do
265
265
  '{"label":"Ubuntu-22.04-arm","provider":"provision_service","arch":"arm","image":"ubuntu-2204-lts-arm64","runner":"ubuntu-latest"}',
266
266
  '],',
267
267
  '"collection":[',
268
- '"puppetcore8-nightly"',
268
+ '"puppetcore8-nightly","puppetcore9-nightly"',
269
269
  ']',
270
270
  '}'
271
271
  ].join
@@ -284,7 +284,7 @@ RSpec.describe 'matrix_from_metadata_v3' do
284
284
  )
285
285
  expect(github_output_content).to include(matrix)
286
286
  expect(github_output_content).to include(
287
- 'spec_matrix={"include":[{"puppet_version":"~> 8.0","ruby_version":3.2}]}'
287
+ 'spec_matrix={"include":[{"puppet_version":"~> 8.0","ruby_version":3.2},{"puppet_version":"~> 9.0","ruby_version":4.0}]}'
288
288
  )
289
289
  end
290
290
  end
@@ -330,10 +330,58 @@ RSpec.describe 'matrix_from_metadata_v3' do
330
330
  '::group::spec_matrix'
331
331
  )
332
332
  expect(github_output_content).to match(/{"collection":"puppetcore8","version":"\d+\.\d+\.\d+"}/)
333
-
333
+ expect(github_output_content).to match(/{"collection":"puppetcore9","version":("\d+\.\d+\.\d+"|null)}/)
334
334
  expect(github_output_content).to include(
335
- 'spec_matrix={"include":[{"puppet_version":"~> 8.0","ruby_version":3.2}]}'
335
+ 'spec_matrix={"include":[{"puppet_version":"~> 8.0","ruby_version":3.2},{"puppet_version":"~> 9.0","ruby_version":4.0}]}'
336
+ )
337
+ end
338
+ end
339
+
340
+ context 'with --collection-platform-exclude' do
341
+ let(:result) do
342
+ run_matrix_from_metadata_v3(
343
+ ['--collection-platform-exclude', '9:ubuntu-18.04'],
344
+ env: { 'PUPPET_FORGE_TOKEN' => 'fake' }
345
+ )
346
+ end
347
+
348
+ it 'runs successfully' do
349
+ expect(result.status_code).to eq 0
350
+ end
351
+
352
+ it 'emits a matrix exclude for only the matching platform x collection' do
353
+ result
354
+ matrix = JSON.parse(github_output_content[/^matrix=(.+)$/, 1])
355
+ expect(matrix['exclude']).to contain_exactly(
356
+ 'platforms' => {
357
+ 'label' => 'Ubuntu-18.04', 'provider' => 'docker', 'arch' => 'x86_64',
358
+ 'image' => 'litmusimage/ubuntu:18.04', 'runner' => 'ubuntu-22.04'
359
+ },
360
+ 'collection' => 'puppetcore9'
336
361
  )
337
362
  end
363
+
364
+ it 'keeps the platform and the collection usable in other combinations' do
365
+ # Ubuntu-18.04 is still a platform and puppetcore9 is still a collection;
366
+ # only the single pair is excluded (so Ubuntu-18.04 still runs on puppetcore8).
367
+ result
368
+ expect(github_output_content).to include('{"label":"Ubuntu-18.04","provider":"docker",')
369
+ expect(github_output_content).to include('"collection":["puppetcore8","puppetcore9"]')
370
+ end
371
+
372
+ it 'logs the exclusion' do
373
+ expect(result.stdout).to include('::notice::collection-platform-exclude filtered Ubuntu-18.04 x puppetcore9')
374
+ end
375
+ end
376
+
377
+ context 'with an invalid --collection-platform-exclude spec' do
378
+ let(:result) do
379
+ run_matrix_from_metadata_v3(['--collection-platform-exclude', 'ubuntu-18.04'])
380
+ end
381
+
382
+ it 'fails with a helpful error' do
383
+ expect(result.status_code).not_to eq 0
384
+ expect(result.stdout).to include("--collection-platform-exclude 'ubuntu-18.04' must be MAJOR:PLATFORM_REGEX")
385
+ end
338
386
  end
339
387
  end
@@ -275,7 +275,7 @@ RSpec.describe PuppetLitmus::PuppetHelpers do
275
275
  expect(self).to receive(:target_in_inventory?).and_return(true)
276
276
  expect(self).to receive(:run_task).with(task_name, 'some.host', params, config: config_data, inventory: inventory_hash).and_return(result_structured_task_success)
277
277
  method_result = run_bolt_task(task_name, params, opts: {})
278
- expect(method_result.stdout).to eq('{"key1"=>"foo", "key2"=>"bar"}')
278
+ expect(method_result.stdout).to eq({ 'key1' => 'foo', 'key2' => 'bar' }.to_s)
279
279
  expect(method_result.result['key1']).to eq('foo')
280
280
  expect(method_result.result['key2']).to eq('bar')
281
281
  end
@@ -132,32 +132,32 @@ RSpec.describe PuppetLitmus::RakeHelper do
132
132
  end
133
133
  let(:targets) { ['some.host'] }
134
134
  let(:token) { 'some_token' }
135
- let(:params) { { 'collection' => 'puppet6', 'password' => token } }
135
+ let(:params) { { 'collection' => 'puppet8', 'password' => token } }
136
136
 
137
137
  it 'calls function' do
138
138
  allow(ENV).to receive(:fetch).with('PUPPET_VERSION', nil).and_return(nil)
139
139
  allow(ENV).to receive(:fetch).with('PUPPET_FORGE_TOKEN', nil).and_return(token)
140
140
  allow(File).to receive(:directory?).with(File.join(described_class::DEFAULT_CONFIG_DATA['modulepath'], 'puppet_agent')).and_return(true)
141
141
  allow_any_instance_of(BoltSpec::Run).to receive(:run_task).with('puppet_agent::install', targets, params, config: described_class::DEFAULT_CONFIG_DATA, inventory: inventory_hash).and_return([])
142
- install_agent('puppet6', targets, inventory_hash)
142
+ install_agent('puppet8', targets, inventory_hash)
143
143
  end
144
144
 
145
145
  it 'adds puppet version' do
146
- params = { 'collection' => 'puppet7', 'version' => '7.35.0' }
147
- allow(ENV).to receive(:fetch).with('PUPPET_VERSION', nil).and_return('7.35.0')
146
+ params = { 'collection' => 'puppet8', 'version' => '8.0.0' }
147
+ allow(ENV).to receive(:fetch).with('PUPPET_VERSION', nil).and_return('8.0.0')
148
148
  allow(ENV).to receive(:fetch).with('PUPPET_FORGE_TOKEN', nil).and_return(nil)
149
149
  allow(File).to receive(:directory?).with(File.join(described_class::DEFAULT_CONFIG_DATA['modulepath'], 'puppet_agent')).and_return(true)
150
150
  allow_any_instance_of(BoltSpec::Run).to receive(:run_task).with('puppet_agent::install', targets, params, config: described_class::DEFAULT_CONFIG_DATA, inventory: inventory_hash).and_return([])
151
- install_agent('puppet7', targets, inventory_hash)
151
+ install_agent('puppet8', targets, inventory_hash)
152
152
  end
153
153
 
154
154
  it 'fails for puppetcore if no token supplied' do
155
- params = { 'collection' => 'puppetcore7' }
155
+ params = { 'collection' => 'puppetcore8' }
156
156
  allow(ENV).to receive(:fetch).with('PUPPET_VERSION', nil).and_return(nil)
157
157
  allow(ENV).to receive(:fetch).with('PUPPET_FORGE_TOKEN', nil).and_return(nil)
158
158
  allow(File).to receive(:directory?).with(File.join(described_class::DEFAULT_CONFIG_DATA['modulepath'], 'puppet_agent')).and_return(true)
159
159
  allow_any_instance_of(BoltSpec::Run).to receive(:run_task).with('puppet_agent::install', targets, params, config: described_class::DEFAULT_CONFIG_DATA, inventory: inventory_hash).and_return([])
160
- expect { install_agent('puppetcore7', targets, inventory_hash) }.to raise_error(RuntimeError, /puppetcore agent installs require a valid PUPPET_FORGE_TOKEN set in the env\./)
160
+ expect { install_agent('puppetcore8', targets, inventory_hash) }.to raise_error(RuntimeError, /puppetcore agent installs require a valid PUPPET_FORGE_TOKEN set in the env\./)
161
161
  end
162
162
  end
163
163
 
@@ -77,7 +77,7 @@ describe 'litmus rake tasks' do
77
77
  end
78
78
 
79
79
  context 'with litmus:install_modules_from_directory' do
80
- let(:inventory_hash) { { 'groups' => [{ 'name' => 'ssh_nodes', 'nodes' => [{ 'uri' => 'some.host' }] }] } }
80
+ let(:inventory_hash) { { 'groups' => [{ 'name' => 'ssh_nodes', 'targets' => [{ 'uri' => 'some.host' }] }] } }
81
81
  let(:target_dir) { File.join(Dir.pwd, 'spec/fixtures/modules') }
82
82
  let(:dummy_tar) { 'spec/data/doot.tar.gz' }
83
83
 
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: 2.6.0
4
+ version: 2.8.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: 2026-05-29 00:00:00.000000000 Z
11
+ date: 2026-08-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bolt