puppet_litmus 0.36.1 → 0.36.2

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: f9a130b9a5ccaf0b18f53a163b9e65dd207eef1fbe23db2921df3b4b534f44ab
4
- data.tar.gz: b2f1d8367e536d2f83104b839438e26e7cfc4da9f06ba714730e7dbbb2de6f6c
3
+ metadata.gz: 918f276058fbe47a9bbffbc01d7438cb45506aaa9fad277b7d0a6d6a19fd8f95
4
+ data.tar.gz: 5e98eb4401f9380d2ae31c87ea530c273faf177236f01b8b73d6b9cdb2c8f344
5
5
  SHA512:
6
- metadata.gz: 9e5852a7557b51cf4ee81a50d169d58a7de90aebb6f4c0f53258274632b49f7e8d93175176b60b3435023326df6cabf27f68d10209d5bfdf100911f32a438869
7
- data.tar.gz: 4c70b9fb01b6a32b374e287d2a8444896d31d9d38a0a8b7e18cc1cc10f5b531fcfad811a8269f707b9cc05f7085a5f94f94c28acf84a0a5858ebe5ef43db1e4f
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,22 +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] << if collection[:puppet_maj_version] == 8
150
- { puppet_version: 'https://github.com/puppetlabs/puppet', ruby_version: collection[:ruby_version] }
151
- else
152
- { puppet_version: "~> #{collection[:puppet_maj_version]}.0", ruby_version: collection[:ruby_version] }
153
- end
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] }
154
152
  end
155
153
  end
156
154
  end
157
155
 
158
156
  # Set to defaults (all collections) if no matches are found
159
- if matrix[:collection].empty?
160
- matrix[:collection] = COLLECTION_TABLE.map { |collection| "puppet#{collection[:puppet_maj_version]}-nightly" }
161
- end
157
+ matrix[:collection] = COLLECTION_TABLE.map { |collection| "puppet#{collection[:puppet_maj_version]}-nightly" } if matrix[:collection].empty?
162
158
 
163
159
  # Just to make sure there aren't any duplicates
164
- matrix[:platforms] = matrix[:platforms].uniq.sort { |a, b| a[:label] <=> b[:label] }
160
+ matrix[:platforms] = matrix[:platforms].uniq.sort_by { |a| a[:label] }
165
161
  matrix[:collection] = matrix[:collection].uniq.sort
166
162
 
167
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.1'
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.1
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-28 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
@@ -215,17 +215,17 @@ specification_version: 4
215
215
  summary: Providing a simple command line tool for puppet content creators, to enable
216
216
  simple and complex test deployments.
217
217
  test_files:
218
- - spec/exe/matrix_from_metadata_v2_spec.rb
219
- - 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
220
223
  - spec/lib/puppet_litmus/util_spec.rb
221
224
  - spec/lib/puppet_litmus/inventory_manipulation_spec.rb
222
- - spec/lib/puppet_litmus/rake_tasks_spec.rb
223
- - spec/lib/puppet_litmus/puppet_helpers_spec.rb
224
225
  - spec/lib/puppet_litmus/rake_helper_spec.rb
225
- - spec/lib/puppet_litmus/puppet_litmus_version_spec.rb
226
- - spec/spec_helper.rb
227
- - spec/support/inventorytesting.yaml
228
- - 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
229
229
  - spec/data/doot.tar.gz
230
- - spec/data/inventory.yaml
231
230
  - spec/data/jim.yaml
231
+ - spec/data/inventory.yaml