puppet_litmus 0.36.0 → 0.36.2

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: 77aab5b54a57e7de60b83fe6d1ebc2acf6a06f3cf6394106615af2ee5f25dcad
4
- data.tar.gz: c0da65f29660db619f5d106be38f59c664212254d74e2f10f95623f08627eba7
3
+ metadata.gz: 918f276058fbe47a9bbffbc01d7438cb45506aaa9fad277b7d0a6d6a19fd8f95
4
+ data.tar.gz: 5e98eb4401f9380d2ae31c87ea530c273faf177236f01b8b73d6b9cdb2c8f344
5
5
  SHA512:
6
- metadata.gz: 98d8fc0cdbf4d71fadce7c349c8416d39066bab1c7f499f1d68bf771d2af7537b2a0bcdcc1af2c286d09d4d18f424ae34bd05efd0a9fbee8bd2443da48fe8da4
7
- data.tar.gz: f0d1b6a4c78b8c41b2480996e7ea7a33f7da266054dc08d3aa74b1f906484031999c4d6d4ca7ff5830af8909498ddca5d360e3891783a4afff9eed0ccb7598f9
6
+ metadata.gz: a60869765a8bdf0aea21b476daea6d69535daf39ab80de18895952c51b181d7783d103eff0d6300c67819a7073a7a5c67033bba4030a0a9411c758c1c2f62b9a
7
+ data.tar.gz: 8bc5ee4296050a3343b5312cbdcd774af7f4fb2186df4779b1779b921895edc65ba8f8893760a612517e137246474b827bd78ab0084c83903b219366154db653
@@ -32,7 +32,7 @@ IMAGE_TABLE = {
32
32
  'SLES-15' => 'sles-15',
33
33
  'Windows-2016' => 'windows-2016',
34
34
  'Windows-2019' => 'windows-2019',
35
- 'Windows-2022' => 'windows-2022',
35
+ 'Windows-2022' => 'windows-2022'
36
36
  }.freeze
37
37
 
38
38
  DOCKER_PLATFORMS = {
@@ -53,44 +53,40 @@ DOCKER_PLATFORMS = {
53
53
  # 'Ubuntu-16.04' => 'litmusimage/ubuntu:16.04', Support Dropped
54
54
  'Ubuntu-18.04' => 'litmusimage/ubuntu:18.04',
55
55
  'Ubuntu-20.04' => 'litmusimage/ubuntu:20.04',
56
- 'Ubuntu-22.04' => 'litmusimage/ubuntu:22.04',
56
+ 'Ubuntu-22.04' => 'litmusimage/ubuntu:22.04'
57
57
  }.freeze
58
58
 
59
59
  # This table uses the latest version in each collection for accurate
60
60
  # comparison when evaluating puppet requirements from the metadata
61
61
  COLLECTION_TABLE = [
62
- {
63
- puppet_maj_version: 6,
64
- ruby_version: 2.5,
65
- },
66
62
  {
67
63
  puppet_maj_version: 7,
68
- ruby_version: 2.7,
64
+ ruby_version: 2.7
69
65
  },
70
66
  {
71
67
  puppet_maj_version: 8,
72
- ruby_version: 3.2,
73
- },
68
+ ruby_version: 3.2
69
+ }
74
70
  ].freeze
75
71
 
76
72
  matrix = {
77
73
  platforms: [],
78
- collection: [],
74
+ collection: []
79
75
  }
80
76
 
81
77
  spec_matrix = {
82
- include: [],
78
+ include: []
83
79
  }
84
80
 
85
81
  if ARGV.include?('--exclude-platforms')
86
- exclude_platforms_occurencies = ARGV.select { |arg| arg == '--exclude-platforms' }.length
82
+ exclude_platforms_occurencies = ARGV.count { |arg| arg == '--exclude-platforms' }
87
83
  raise '--exclude-platforms argument should be present just one time in the command' unless exclude_platforms_occurencies <= 1
88
84
 
89
85
  exclude_platforms_list = ARGV[ARGV.find_index('--exclude-platforms') + 1]
90
86
  raise 'you need to provide a list of platforms in JSON format' if exclude_platforms_list.nil?
91
87
 
92
88
  begin
93
- exclude_list = JSON.parse(exclude_platforms_list).map { |platform| platform.downcase }
89
+ exclude_list = JSON.parse(exclude_platforms_list).map(&:downcase)
94
90
  rescue JSON::ParserError
95
91
  raise 'the exclude platforms list must valid JSON'
96
92
  end
@@ -103,20 +99,20 @@ metadata = JSON.parse(File.read(metadata_path))
103
99
  # Set platforms based on declared operating system support
104
100
  metadata['operatingsystem_support'].sort_by { |a| a['operatingsystem'] }.each do |sup|
105
101
  os = sup['operatingsystem']
106
- sup['operatingsystemrelease'].sort_by { |a| a.to_i }.each do |ver|
102
+ sup['operatingsystemrelease'].sort_by(&:to_i).each do |ver|
107
103
  image_key = "#{os}-#{ver}"
108
104
 
109
105
  if IMAGE_TABLE.key?(image_key) && !exclude_list.include?(image_key.downcase)
110
106
  matrix[:platforms] << {
111
107
  label: image_key,
112
108
  provider: 'provision::provision_service',
113
- image: IMAGE_TABLE[image_key],
109
+ image: IMAGE_TABLE[image_key]
114
110
  }
115
111
  elsif DOCKER_PLATFORMS.key?(image_key) && !exclude_list.include?(image_key.downcase)
116
112
  matrix[:platforms] << {
117
113
  label: image_key,
118
114
  provider: 'provision::docker',
119
- image: DOCKER_PLATFORMS[image_key],
115
+ image: DOCKER_PLATFORMS[image_key]
120
116
  }
121
117
  else
122
118
  puts "::warning::#{image_key} was excluded from testing" if exclude_list.include?(image_key.downcase)
@@ -130,7 +126,7 @@ if metadata.key?('requirements') && metadata['requirements'].length.positive?
130
126
  metadata['requirements'].each do |req|
131
127
  next unless req.key?('name') && req.key?('version_requirement') && req['name'] == 'puppet'
132
128
 
133
- ver_regexp = %r{^([>=<]{1,2})\s*([\d.]+)\s+([>=<]{1,2})\s*([\d.]+)$}
129
+ ver_regexp = /^([>=<]{1,2})\s*([\d.]+)\s+([>=<]{1,2})\s*([\d.]+)$/
134
130
  match = ver_regexp.match(req['version_requirement'])
135
131
  if match.nil?
136
132
  puts "::warning::Didn't recognize version_requirement '#{req['version_requirement']}'"
@@ -146,18 +142,22 @@ if metadata.key?('requirements') && metadata['requirements'].length.positive?
146
142
  next unless Gem::Requirement.create(reqs).satisfied_by?(Gem::Version.new("#{collection[:puppet_maj_version]}.9999"))
147
143
 
148
144
  matrix[:collection] << "puppet#{collection[:puppet_maj_version]}-nightly"
149
- spec_matrix[:include] << { puppet_version: "~> #{collection[:puppet_maj_version]}.0", ruby_version: collection[:ruby_version] }
145
+
146
+ include_version = {
147
+ 8 => "~> #{collection[:puppet_maj_version]}.0",
148
+ 7 => "~> #{collection[:puppet_maj_version]}.24",
149
+ 6 => "~> #{collection[:puppet_maj_version]}.0"
150
+ }
151
+ spec_matrix[:include] << { puppet_version: include_version[collection[:puppet_maj_version]], ruby_version: collection[:ruby_version] }
150
152
  end
151
153
  end
152
154
  end
153
155
 
154
156
  # Set to defaults (all collections) if no matches are found
155
- if matrix[:collection].empty?
156
- matrix[:collection] = COLLECTION_TABLE.map { |collection| "puppet#{collection[:puppet_maj_version]}-nightly" }
157
- end
157
+ matrix[:collection] = COLLECTION_TABLE.map { |collection| "puppet#{collection[:puppet_maj_version]}-nightly" } if matrix[:collection].empty?
158
158
 
159
159
  # Just to make sure there aren't any duplicates
160
- matrix[:platforms] = matrix[:platforms].uniq.sort { |a, b| a[:label] <=> b[:label] }
160
+ matrix[:platforms] = matrix[:platforms].uniq.sort_by { |a| a[:label] }
161
161
  matrix[:collection] = matrix[:collection].uniq.sort
162
162
 
163
163
  set_output('matrix', JSON.generate(matrix))
@@ -2,5 +2,5 @@
2
2
 
3
3
  # version of this gem
4
4
  module PuppetLitmus
5
- VERSION ||= '0.36.0'
5
+ VERSION ||= '0.36.2'
6
6
  end
@@ -8,7 +8,7 @@ RSpec.describe 'matrix_from_metadata_v2' do
8
8
  let(:github_output_content) { github_output.read }
9
9
  let(:result) { run_matrix_from_metadata_v2 }
10
10
 
11
- before(:each) do
11
+ before do
12
12
  ENV['GITHUB_OUTPUT'] = github_output.path
13
13
  end
14
14
 
@@ -29,11 +29,11 @@ RSpec.describe 'matrix_from_metadata_v2' do
29
29
  '"collection":[',
30
30
  '"puppet7-nightly","puppet8-nightly"',
31
31
  ']',
32
- '}',
33
- ].join,
32
+ '}'
33
+ ].join
34
34
  )
35
35
  expect(github_output_content).to include(
36
- 'spec_matrix={"include":[{"puppet_version":"~> 7.0","ruby_version":2.7},{"puppet_version":"~> 8.0","ruby_version":3.2}]}',
36
+ 'spec_matrix={"include":[{"puppet_version":"~> 7.24","ruby_version":2.7},{"puppet_version":"~> 8.0","ruby_version":3.2}]}'
37
37
  )
38
38
  expect(result.stdout).to include("Created matrix with 8 cells:\n - Acceptance Test Cells: 6\n - Spec Test Cells: 2")
39
39
  end
@@ -44,7 +44,7 @@ RSpec.describe 'matrix_from_metadata_v2' do
44
44
  let(:github_output_content) { github_output.read }
45
45
  let(:result) { run_matrix_from_metadata_v2({ '--exclude-platforms' => ['ubuntu-18.04'] }) }
46
46
 
47
- before(:each) do
47
+ before do
48
48
  ENV['GITHUB_OUTPUT'] = github_output.path
49
49
  end
50
50
 
@@ -65,11 +65,11 @@ RSpec.describe 'matrix_from_metadata_v2' do
65
65
  '"collection":[',
66
66
  '"puppet7-nightly","puppet8-nightly"',
67
67
  ']',
68
- '}',
69
- ].join,
68
+ '}'
69
+ ].join
70
70
  )
71
71
  expect(github_output_content).to include(
72
- 'spec_matrix={"include":[{"puppet_version":"~> 7.0","ruby_version":2.7},{"puppet_version":"~> 8.0","ruby_version":3.2}]}',
72
+ 'spec_matrix={"include":[{"puppet_version":"~> 7.24","ruby_version":2.7},{"puppet_version":"~> 8.0","ruby_version":3.2}]}'
73
73
  )
74
74
  expect(result.stdout).to include("Created matrix with 6 cells:\n - Acceptance Test Cells: 4\n - Spec Test Cells: 2")
75
75
  end
@@ -80,7 +80,7 @@ RSpec.describe 'matrix_from_metadata_v2' do
80
80
  let(:github_output_content) { github_output.read }
81
81
  let(:result) { run_matrix_from_metadata_v2({ '--exclude-platforms' => ['ubuntu-18.04', 'redhat-8'] }) }
82
82
 
83
- before(:each) do
83
+ before do
84
84
  ENV['GITHUB_OUTPUT'] = github_output.path
85
85
  end
86
86
 
@@ -101,11 +101,11 @@ RSpec.describe 'matrix_from_metadata_v2' do
101
101
  '"collection":[',
102
102
  '"puppet7-nightly","puppet8-nightly"',
103
103
  ']',
104
- '}',
105
- ].join,
104
+ '}'
105
+ ].join
106
106
  )
107
107
  expect(github_output_content).to include(
108
- 'spec_matrix={"include":[{"puppet_version":"~> 7.0","ruby_version":2.7},{"puppet_version":"~> 8.0","ruby_version":3.2}]}',
108
+ 'spec_matrix={"include":[{"puppet_version":"~> 7.24","ruby_version":2.7},{"puppet_version":"~> 8.0","ruby_version":3.2}]}'
109
109
  )
110
110
  expect(result.stdout).to include("Created matrix with 4 cells:\n - Acceptance Test Cells: 2\n - Spec Test Cells: 2")
111
111
  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.36.0
4
+ version: 0.36.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Puppet, Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-03-27 00:00:00.000000000 Z
11
+ date: 2023-04-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bolt
@@ -154,20 +154,6 @@ dependencies:
154
154
  - - ">="
155
155
  - !ruby/object:Gem::Version
156
156
  version: '0'
157
- - !ruby/object:Gem::Dependency
158
- name: r10k
159
- requirement: !ruby/object:Gem::Requirement
160
- requirements:
161
- - - '='
162
- - !ruby/object:Gem::Version
163
- version: 3.15.1
164
- type: :runtime
165
- prerelease: false
166
- version_requirements: !ruby/object:Gem::Requirement
167
- requirements:
168
- - - '='
169
- - !ruby/object:Gem::Version
170
- version: 3.15.1
171
157
  description: " Providing a simple command line tool for puppet content creators,
172
158
  to enable simple and complex test deployments.\n"
173
159
  email:
@@ -229,17 +215,17 @@ specification_version: 4
229
215
  summary: Providing a simple command line tool for puppet content creators, to enable
230
216
  simple and complex test deployments.
231
217
  test_files:
232
- - spec/exe/matrix_from_metadata_v2_spec.rb
233
- - spec/exe/fake_metadata.json
218
+ - spec/spec_helper.rb
219
+ - spec/support/inventory.rb
220
+ - spec/support/inventorytesting.yaml
221
+ - spec/lib/puppet_litmus/rake_tasks_spec.rb
222
+ - spec/lib/puppet_litmus/puppet_litmus_version_spec.rb
234
223
  - spec/lib/puppet_litmus/util_spec.rb
235
224
  - spec/lib/puppet_litmus/inventory_manipulation_spec.rb
236
- - spec/lib/puppet_litmus/rake_tasks_spec.rb
237
- - spec/lib/puppet_litmus/puppet_helpers_spec.rb
238
225
  - spec/lib/puppet_litmus/rake_helper_spec.rb
239
- - spec/lib/puppet_litmus/puppet_litmus_version_spec.rb
240
- - spec/spec_helper.rb
241
- - spec/support/inventorytesting.yaml
242
- - spec/support/inventory.rb
226
+ - spec/lib/puppet_litmus/puppet_helpers_spec.rb
227
+ - spec/exe/fake_metadata.json
228
+ - spec/exe/matrix_from_metadata_v2_spec.rb
243
229
  - spec/data/doot.tar.gz
244
- - spec/data/inventory.yaml
245
230
  - spec/data/jim.yaml
231
+ - spec/data/inventory.yaml