puppet_litmus 0.34.6 → 0.36.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: 2e6995f6c4a1cd2d14abbbf0d617ef28b18b029c3b3b3a342d7e1a98b0673394
4
- data.tar.gz: 86fd172c61f5775906e666732cdcb949a28c62c6cb7e9e67c8c4638195dba488
3
+ metadata.gz: 77aab5b54a57e7de60b83fe6d1ebc2acf6a06f3cf6394106615af2ee5f25dcad
4
+ data.tar.gz: c0da65f29660db619f5d106be38f59c664212254d74e2f10f95623f08627eba7
5
5
  SHA512:
6
- metadata.gz: 4ffef8459fcd7b032a6fc43a376ebc833be88f344f59364b4b622e7d0bddf8cf7a4d8681e6fa3012b6914ab6922a5b59d4d7e41b286e740dd543ff5e59b80887
7
- data.tar.gz: 8789b4289c68186345dd097bda8539d8f5006184eb3b58f8cf544ca0fe80bb35d54ca6f43d7ddaa3fd53785b5d6e6dcf01e3fce4185e6a1fb27e3f4588f86773
6
+ metadata.gz: 98d8fc0cdbf4d71fadce7c349c8416d39066bab1c7f499f1d68bf771d2af7537b2a0bcdcc1af2c286d09d4d18f424ae34bd05efd0a9fbee8bd2443da48fe8da4
7
+ data.tar.gz: f0d1b6a4c78b8c41b2480996e7ea7a33f7da266054dc08d3aa74b1f906484031999c4d6d4ca7ff5830af8909498ddca5d360e3891783a4afff9eed0ccb7598f9
@@ -5,6 +5,25 @@
5
5
 
6
6
  require 'json'
7
7
 
8
+ # Sets an output variable in GitHub Actions. If the GITHUB_OUTPUT environment
9
+ # variable is not set, this will fail with an exit code of 1 and
10
+ # send an ::error:: message to the GitHub Actions log.
11
+ # @param name [String] The name of the output variable
12
+ # @param value [String] The value of the output variable
13
+
14
+ def set_output(name, value)
15
+ # Get the output path
16
+ output = ENV.fetch('GITHUB_OUTPUT')
17
+
18
+ # Write the output variable to GITHUB_OUTPUT
19
+ File.open(output, 'a') do |f|
20
+ f.puts "#{name}=#{value}"
21
+ end
22
+ rescue KeyError
23
+ puts '::error::GITHUB_OUTPUT environment variable not set.'
24
+ exit 1
25
+ end
26
+
8
27
  IMAGE_TABLE = {
9
28
  'RedHat-7' => 'rhel-7',
10
29
  'RedHat-8' => 'rhel-8',
@@ -92,6 +111,5 @@ end
92
111
  matrix[:platform] = matrix[:platform].uniq.sort
93
112
  matrix[:collection] = matrix[:collection].uniq.sort
94
113
 
95
- puts "::set-output name=matrix::#{JSON.generate(matrix)}"
96
-
114
+ set_output('matrix', JSON.generate(matrix))
97
115
  puts "Created matrix with #{matrix[:platform].length * matrix[:collection].length} cells."
@@ -5,6 +5,25 @@
5
5
 
6
6
  require 'json'
7
7
 
8
+ # Sets an output variable in GitHub Actions. If the GITHUB_OUTPUT environment
9
+ # variable is not set, this will fail with an exit code of 1 and
10
+ # send an ::error:: message to the GitHub Actions log.
11
+ # @param name [String] The name of the output variable
12
+ # @param value [String] The value of the output variable
13
+
14
+ def set_output(name, value)
15
+ # Get the output path
16
+ output = ENV.fetch('GITHUB_OUTPUT')
17
+
18
+ # Write the output variable to GITHUB_OUTPUT
19
+ File.open(output, 'a') do |f|
20
+ f.puts "#{name}=#{value}"
21
+ end
22
+ rescue KeyError
23
+ puts '::error::GITHUB_OUTPUT environment variable not set.'
24
+ exit 1
25
+ end
26
+
8
27
  IMAGE_TABLE = {
9
28
  'RedHat-7' => 'rhel-7',
10
29
  'RedHat-8' => 'rhel-8',
@@ -48,6 +67,10 @@ COLLECTION_TABLE = [
48
67
  puppet_maj_version: 7,
49
68
  ruby_version: 2.7,
50
69
  },
70
+ {
71
+ puppet_maj_version: 8,
72
+ ruby_version: 3.2,
73
+ },
51
74
  ].freeze
52
75
 
53
76
  matrix = {
@@ -137,8 +160,8 @@ end
137
160
  matrix[:platforms] = matrix[:platforms].uniq.sort { |a, b| a[:label] <=> b[:label] }
138
161
  matrix[:collection] = matrix[:collection].uniq.sort
139
162
 
140
- puts "::set-output name=matrix::#{JSON.generate(matrix)}"
141
- puts "::set-output name=spec_matrix::#{JSON.generate(spec_matrix)}"
163
+ set_output('matrix', JSON.generate(matrix))
164
+ set_output('spec_matrix', JSON.generate(spec_matrix))
142
165
 
143
166
  acceptance_test_cell_count = matrix[:platforms].length * matrix[:collection].length
144
167
  spec_test_cell_count = spec_matrix[:include].length
@@ -2,5 +2,5 @@
2
2
 
3
3
  # version of this gem
4
4
  module PuppetLitmus
5
- VERSION ||= '0.34.6'
5
+ VERSION ||= '0.36.0'
6
6
  end
@@ -37,10 +37,10 @@
37
37
  "requirements": [
38
38
  {
39
39
  "name": "puppet",
40
- "version_requirement": ">= 6.0.0 < 8.0.0"
40
+ "version_requirement": ">= 7.0.0 < 9.0.0"
41
41
  }
42
42
  ],
43
43
  "template-url": "https://github.com/puppetlabs/pdk-templates.git#main",
44
- "template-ref": "heads/main-0-g2381db6",
45
- "pdk-version": "2.1.1"
44
+ "template-ref": "tags/2.7.4",
45
+ "pdk-version": "2.7.4"
46
46
  }
@@ -4,38 +4,50 @@ require 'spec_helper'
4
4
 
5
5
  RSpec.describe 'matrix_from_metadata_v2' do
6
6
  context 'without arguments' do
7
+ let(:github_output) { Tempfile.new('github_output') }
8
+ let(:github_output_content) { github_output.read }
7
9
  let(:result) { run_matrix_from_metadata_v2 }
8
10
 
11
+ before(:each) do
12
+ ENV['GITHUB_OUTPUT'] = github_output.path
13
+ end
14
+
9
15
  it 'run successfully' do
10
16
  expect(result.status_code).to eq 0
11
17
  end
12
18
 
13
19
  it 'generates the matrix' do
14
20
  expect(result.stdout).to include('::warning::Cannot find image for Ubuntu-14.04')
15
- expect(result.stdout).to include(
21
+ expect(github_output_content).to include(
16
22
  [
17
- '::set-output name=matrix::{',
23
+ 'matrix={',
18
24
  '"platforms":[',
19
25
  '{"label":"CentOS-6","provider":"provision::docker","image":"litmusimage/centos:6"},',
20
26
  '{"label":"RedHat-8","provider":"provision::provision_service","image":"rhel-8"},',
21
27
  '{"label":"Ubuntu-18.04","provider":"provision::docker","image":"litmusimage/ubuntu:18.04"}',
22
28
  '],',
23
29
  '"collection":[',
24
- '"puppet6-nightly","puppet7-nightly"',
30
+ '"puppet7-nightly","puppet8-nightly"',
25
31
  ']',
26
32
  '}',
27
33
  ].join,
28
34
  )
29
- expect(result.stdout).to include(
30
- '::set-output name=spec_matrix::{"include":[{"puppet_version":"~> 6.0","ruby_version":2.5},{"puppet_version":"~> 7.0","ruby_version":2.7}]}',
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}]}',
31
37
  )
32
38
  expect(result.stdout).to include("Created matrix with 8 cells:\n - Acceptance Test Cells: 6\n - Spec Test Cells: 2")
33
39
  end
34
40
  end
35
41
 
36
42
  context 'with --exclude-platforms ["ubuntu-18.04"]' do
43
+ let(:github_output) { Tempfile.new('github_output') }
44
+ let(:github_output_content) { github_output.read }
37
45
  let(:result) { run_matrix_from_metadata_v2({ '--exclude-platforms' => ['ubuntu-18.04'] }) }
38
46
 
47
+ before(:each) do
48
+ ENV['GITHUB_OUTPUT'] = github_output.path
49
+ end
50
+
39
51
  it 'run successfully' do
40
52
  expect(result.status_code).to eq 0
41
53
  end
@@ -43,29 +55,35 @@ RSpec.describe 'matrix_from_metadata_v2' do
43
55
  it 'generates the matrix without excluded platforms' do
44
56
  expect(result.stdout).to include('::warning::Cannot find image for Ubuntu-14.04')
45
57
  expect(result.stdout).to include('::warning::Ubuntu-18.04 was excluded from testing')
46
- expect(result.stdout).to include(
58
+ expect(github_output_content).to include(
47
59
  [
48
- '::set-output name=matrix::{',
60
+ 'matrix={',
49
61
  '"platforms":[',
50
62
  '{"label":"CentOS-6","provider":"provision::docker","image":"litmusimage/centos:6"},',
51
63
  '{"label":"RedHat-8","provider":"provision::provision_service","image":"rhel-8"}',
52
64
  '],',
53
65
  '"collection":[',
54
- '"puppet6-nightly","puppet7-nightly"',
66
+ '"puppet7-nightly","puppet8-nightly"',
55
67
  ']',
56
68
  '}',
57
69
  ].join,
58
70
  )
59
- expect(result.stdout).to include(
60
- '::set-output name=spec_matrix::{"include":[{"puppet_version":"~> 6.0","ruby_version":2.5},{"puppet_version":"~> 7.0","ruby_version":2.7}]}',
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}]}',
61
73
  )
62
74
  expect(result.stdout).to include("Created matrix with 6 cells:\n - Acceptance Test Cells: 4\n - Spec Test Cells: 2")
63
75
  end
64
76
  end
65
77
 
66
78
  context 'with --exclude-platforms \'["ubuntu-18.04","redhat-8"]\'' do
79
+ let(:github_output) { Tempfile.new('github_output') }
80
+ let(:github_output_content) { github_output.read }
67
81
  let(:result) { run_matrix_from_metadata_v2({ '--exclude-platforms' => ['ubuntu-18.04', 'redhat-8'] }) }
68
82
 
83
+ before(:each) do
84
+ ENV['GITHUB_OUTPUT'] = github_output.path
85
+ end
86
+
69
87
  it 'run successfully' do
70
88
  expect(result.status_code).to eq 0
71
89
  end
@@ -74,20 +92,20 @@ RSpec.describe 'matrix_from_metadata_v2' do
74
92
  expect(result.stdout).to include('::warning::Cannot find image for Ubuntu-14.04')
75
93
  expect(result.stdout).to include('::warning::Ubuntu-18.04 was excluded from testing')
76
94
  expect(result.stdout).to include('::warning::RedHat-8 was excluded from testing')
77
- expect(result.stdout).to include(
95
+ expect(github_output_content).to include(
78
96
  [
79
- '::set-output name=matrix::{',
97
+ 'matrix={',
80
98
  '"platforms":[',
81
99
  '{"label":"CentOS-6","provider":"provision::docker","image":"litmusimage/centos:6"}',
82
100
  '],',
83
101
  '"collection":[',
84
- '"puppet6-nightly","puppet7-nightly"',
102
+ '"puppet7-nightly","puppet8-nightly"',
85
103
  ']',
86
104
  '}',
87
105
  ].join,
88
106
  )
89
- expect(result.stdout).to include(
90
- '::set-output name=spec_matrix::{"include":[{"puppet_version":"~> 6.0","ruby_version":2.5},{"puppet_version":"~> 7.0","ruby_version":2.7}]}',
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}]}',
91
109
  )
92
110
  expect(result.stdout).to include("Created matrix with 4 cells:\n - Acceptance Test Cells: 2\n - Spec Test Cells: 2")
93
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.34.6
4
+ version: 0.36.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: 2023-03-09 00:00:00.000000000 Z
11
+ date: 2023-03-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bolt
@@ -229,17 +229,17 @@ specification_version: 4
229
229
  summary: Providing a simple command line tool for puppet content creators, to enable
230
230
  simple and complex test deployments.
231
231
  test_files:
232
- - spec/spec_helper.rb
233
- - spec/support/inventory.rb
234
- - spec/support/inventorytesting.yaml
235
232
  - spec/exe/matrix_from_metadata_v2_spec.rb
236
233
  - spec/exe/fake_metadata.json
237
- - spec/data/jim.yaml
238
- - spec/data/doot.tar.gz
239
- - spec/data/inventory.yaml
240
- - spec/lib/puppet_litmus/rake_tasks_spec.rb
241
- - spec/lib/puppet_litmus/puppet_litmus_version_spec.rb
234
+ - spec/lib/puppet_litmus/util_spec.rb
242
235
  - spec/lib/puppet_litmus/inventory_manipulation_spec.rb
236
+ - spec/lib/puppet_litmus/rake_tasks_spec.rb
243
237
  - spec/lib/puppet_litmus/puppet_helpers_spec.rb
244
238
  - spec/lib/puppet_litmus/rake_helper_spec.rb
245
- - spec/lib/puppet_litmus/util_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
243
+ - spec/data/doot.tar.gz
244
+ - spec/data/inventory.yaml
245
+ - spec/data/jim.yaml