beaker 7.3.0 → 7.4.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: ddee4c17a106c817361dc58a101c0c98d6dba0a1eddab7f865856059eab87bdb
4
- data.tar.gz: 4248053a457d1c41469bd825d4eef81b1ab2673ac6d30e8fd9ad292f2a4ead3d
3
+ metadata.gz: 8728e0534809f9264bde56aae96f4f8639596d92a17396f16636e1230493f954
4
+ data.tar.gz: dff353b3b984b363b15d60902a10f88a794a620c94cabfd1ef67b6054389fb11
5
5
  SHA512:
6
- metadata.gz: f6471b11f4aa7b5dd6e78313d042cdb79bec4d4c15d6c18aff840bbd5e52deab4feb0c9b1a3acce934bf577a12b47688b7e8934a28d6619a7e149c4263ec8638
7
- data.tar.gz: fb14fbffb4397d853e8cc048b4498af7b7cc96825d208356205caaf067f3e13a7dd9e4d27f97b43217c3948aec69f30233485b33e46ed5bca9ca0fdac600c7e8
6
+ metadata.gz: 859bfebb10ad3ae5d399508fcc2ee61bc01ce5aa60da9542e584ed90e5a5d3266b39d05e9a732db77063f356448dbf71307f948d46358816357a9bd0f7b5b2cf
7
+ data.tar.gz: 2aff57d8a71deef1c5fa275de75d4b02e9184adcf2966c14b2827842568c3f34458ce2abea65eedee5051dcd4d2044fd1764fa11cc1d930d4d5a721149661b26
data/CHANGELOG.md CHANGED
@@ -2,6 +2,22 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file.
4
4
 
5
+ ## [7.4.0](https://github.com/voxpupuli/beaker/tree/7.4.0) (2026-01-22)
6
+
7
+ [Full Changelog](https://github.com/voxpupuli/beaker/compare/7.3.0...7.4.0)
8
+
9
+ **Implemented enhancements:**
10
+
11
+ - Respect no\_color [\#1980](https://github.com/voxpupuli/beaker/pull/1980) ([bwitt](https://github.com/bwitt))
12
+
13
+ **Fixed bugs:**
14
+
15
+ - Avoid duplicating PermitUserEnvironment [\#1954](https://github.com/voxpupuli/beaker/pull/1954) ([kajinamit](https://github.com/kajinamit))
16
+
17
+ **Merged pull requests:**
18
+
19
+ - Add rspec annotations to GitHub CI [\#1986](https://github.com/voxpupuli/beaker/pull/1986) ([bastelfreak](https://github.com/bastelfreak))
20
+
5
21
  ## [7.3.0](https://github.com/voxpupuli/beaker/tree/7.3.0) (2026-01-06)
6
22
 
7
23
  [Full Changelog](https://github.com/voxpupuli/beaker/compare/7.2.2...7.3.0)
data/beaker.gemspec CHANGED
@@ -22,6 +22,7 @@ Gem::Specification.new do |s|
22
22
  s.add_development_dependency 'fakefs', '>= 2.4', '< 4'
23
23
  s.add_development_dependency 'rake', '~> 13.0'
24
24
  s.add_development_dependency 'rspec', '~> 3.0'
25
+ s.add_development_dependency 'rspec-github', '~> 3.0'
25
26
  s.add_development_dependency 'voxpupuli-rubocop', '~> 5.1.0'
26
27
 
27
28
  # Run time dependencies
@@ -71,7 +71,7 @@ beaker is an acceptance testing framework that is written in Ruby. beaker-rspec
71
71
 
72
72
  # Run it twice and test for idempotency
73
73
  apply_manifest(pp, :catch_failures => true)
74
- expect(apply_manifest(pp, :catch_failures => true).exit_code).to be_zero
74
+ apply_manifest(pp, :catch_changes => true)
75
75
  end
76
76
 
77
77
  describe package(package_name) do
@@ -302,7 +302,7 @@ module Unix::Exec
302
302
  case self['platform']
303
303
  when /amazon|debian|ubuntu|archlinux|el-|centos|fedora|redhat|oracle|scientific|opensuse|sles|solaris/
304
304
  directory = tmpdir
305
- exec(Beaker::Command.new("echo 'PermitUserEnvironment yes' | cat - /etc/ssh/sshd_config > #{directory}/sshd_config.permit"))
305
+ exec(Beaker::Command.new("sed -e 's/^PermitUserEnvironment .*/PermitUserEnvironment yes/' -e t -e '1s/^/PermitUserEnvironment yes\\n/' /etc/ssh/sshd_config > #{directory}/sshd_config.permit"))
306
306
  exec(Beaker::Command.new("mv #{directory}/sshd_config.permit /etc/ssh/sshd_config"))
307
307
  exec(Beaker::Command.new("echo '' >/etc/environment")) if self['platform'].include?('ubuntu-')
308
308
  when /(free|open)bsd/
@@ -37,6 +37,7 @@ module Beaker
37
37
  :test_tag_or => ['BEAKER_TEST_TAG_OR'],
38
38
  :test_tag_exclude => %w[BEAKER_EXCLUDE_TAG BEAKER_TEST_TAG_EXCLUDE],
39
39
  :run_in_parallel => ['BEAKER_RUN_IN_PARALLEL'],
40
+ :color => 'BEAKER_COLOR',
40
41
  }
41
42
 
42
43
  # Select all environment variables whose name matches provided regex
@@ -85,6 +86,18 @@ module Beaker
85
86
  end
86
87
  found_env_vars[:run_in_parallel] = found_env_vars[:run_in_parallel].split(',') if found_env_vars[:run_in_parallel]
87
88
 
89
+ # NO_COLOR is handled manually since it has inverted logic (presence means no color)
90
+ no_color_val = ENV['NO_COLOR']
91
+ beaker_color_val = found_env_vars[:color]
92
+
93
+ if beaker_color_val && !beaker_color_val.empty?
94
+ found_env_vars[:color] = !/^(no|false)$/i.match?(beaker_color_val)
95
+ elsif no_color_val && !no_color_val.empty?
96
+ found_env_vars[:color] = false
97
+ else
98
+ found_env_vars.delete(:color)
99
+ end
100
+
88
101
  found_env_vars[:pe_version_file_win] = found_env_vars[:pe_version_file]
89
102
  found_env_vars
90
103
  end
@@ -98,7 +111,7 @@ module Beaker
98
111
  found = found.merge(format_found_env_vars(collect_env_vars(ENVIRONMENT_SPEC)))
99
112
  found[:answers] = select_env_by_regex('\\Aq_')
100
113
 
101
- found.delete_if { |_key, value| value.nil? or value.empty? }
114
+ found.delete_if { |_key, value| value.nil? or (value.respond_to?(:empty?) && value.empty?) }
102
115
  found
103
116
  end
104
117
 
@@ -1,5 +1,5 @@
1
1
  module Beaker
2
2
  module Version
3
- STRING = '7.3.0'
3
+ STRING = '7.4.0'
4
4
  end
5
5
  end
@@ -79,7 +79,7 @@ module Beaker
79
79
  describe '#ssh_permit_user_environment' do
80
80
  context 'When called without error' do
81
81
  let(:directory) { '/directory' }
82
- let(:ssh_command) { "echo 'PermitUserEnvironment yes' | cat - /etc/ssh/sshd_config > #{directory}/sshd_config.permit" }
82
+ let(:ssh_command) { "sed -e 's/^PermitUserEnvironment .*/PermitUserEnvironment yes/' -e t -e '1s/^/PermitUserEnvironment yes\\n/' /etc/ssh/sshd_config > #{directory}/sshd_config.permit" }
83
83
  let(:ssh_move) { "mv #{directory}/sshd_config.permit /etc/ssh/sshd_config" }
84
84
 
85
85
  platforms = PlatformHelpers::REDHATPLATFORMS + PlatformHelpers::DEBIANPLATFORMS
@@ -23,6 +23,56 @@ module Beaker
23
23
  expect(env[:run_in_parallel]).to eq(%w[install configure])
24
24
  end
25
25
 
26
+ describe "color environment variables" do
27
+ after do
28
+ ENV.delete('NO_COLOR')
29
+ ENV.delete('BEAKER_COLOR')
30
+ end
31
+
32
+ it "disables color when NO_COLOR is set to any non-empty value" do
33
+ ENV['NO_COLOR'] = '1'
34
+ env = presets.env_vars
35
+ expect(env[:color]).to be false
36
+ end
37
+
38
+ it "does not set color when NO_COLOR is set to an empty string" do
39
+ ENV['NO_COLOR'] = ''
40
+ env = presets.env_vars
41
+ expect(env).not_to have_key(:color)
42
+ end
43
+
44
+ it "disables color when BEAKER_COLOR is set to 'no'" do
45
+ ENV['BEAKER_COLOR'] = 'no'
46
+ env = presets.env_vars
47
+ expect(env[:color]).to be false
48
+ end
49
+
50
+ it "disables color when BEAKER_COLOR is set to 'false'" do
51
+ ENV['BEAKER_COLOR'] = 'false'
52
+ env = presets.env_vars
53
+ expect(env[:color]).to be false
54
+ end
55
+
56
+ it "enables color when BEAKER_COLOR is set to 'yes'" do
57
+ ENV['BEAKER_COLOR'] = 'yes'
58
+ env = presets.env_vars
59
+ expect(env[:color]).to be true
60
+ end
61
+
62
+ it "enables color when BEAKER_COLOR is set to 'true'" do
63
+ ENV['BEAKER_COLOR'] = 'true'
64
+ env = presets.env_vars
65
+ expect(env[:color]).to be true
66
+ end
67
+
68
+ it "prioritizes BEAKER_COLOR over NO_COLOR" do
69
+ ENV['NO_COLOR'] = '1'
70
+ ENV['BEAKER_COLOR'] = 'yes'
71
+ env = presets.env_vars
72
+ expect(env[:color]).to be true
73
+ end
74
+ end
75
+
26
76
  it "removes all empty/nil entries in env_vars" do
27
77
  expect(presets.env_vars.has_value?(nil)).to be === false
28
78
  expect(presets.env_vars.has_value?({})).to be === false
data/spec/spec_helper.rb CHANGED
@@ -8,4 +8,9 @@ RSpec.configure do |config|
8
8
  config.include FakeFS::SpecHelpers
9
9
  config.include TestFileHelpers
10
10
  config.include HostHelpers
11
+ # Use the GitHub Annotations formatter for CI
12
+ if ENV['GITHUB_ACTIONS'] == 'true'
13
+ require 'rspec/github'
14
+ config.add_formatter RSpec::Github::Formatter
15
+ end
11
16
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: beaker
3
3
  version: !ruby/object:Gem::Version
4
- version: 7.3.0
4
+ version: 7.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Puppet
@@ -58,6 +58,20 @@ dependencies:
58
58
  - - "~>"
59
59
  - !ruby/object:Gem::Version
60
60
  version: '3.0'
61
+ - !ruby/object:Gem::Dependency
62
+ name: rspec-github
63
+ requirement: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - "~>"
66
+ - !ruby/object:Gem::Version
67
+ version: '3.0'
68
+ type: :development
69
+ prerelease: false
70
+ version_requirements: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - "~>"
73
+ - !ruby/object:Gem::Version
74
+ version: '3.0'
61
75
  - !ruby/object:Gem::Dependency
62
76
  name: voxpupuli-rubocop
63
77
  requirement: !ruby/object:Gem::Requirement