From b3db78588282693213e5194021c544c75cf49c96 Mon Sep 17 00:00:00 2001 From: Ewoud Kohl van Wijngaarden Date: Sat, 27 Jan 2024 14:43:43 +0100 Subject: [PATCH 1/6] Run acceptance tests in CI --- .github/workflows/ci.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 49981e36..fe0c83cd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,4 +13,6 @@ concurrency: jobs: puppet: name: Puppet - uses: voxpupuli/gha-puppet/.github/workflows/basic.yml@v1 + uses: voxpupuli/gha-puppet/.github/workflows/beaker.yml@v2 + with: + beaker_hypervisor: 'vagrant_libvirt' From fdb6fc18a737dff34487831d2621b1e7c3ae89ac Mon Sep 17 00:00:00 2001 From: Ewoud Kohl van Wijngaarden Date: Sat, 27 Jan 2024 14:51:58 +0100 Subject: [PATCH 2/6] Test out beaker-vagrant shorter-directory-names branch --- Gemfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Gemfile b/Gemfile index a4a3b204..59115812 100644 --- a/Gemfile +++ b/Gemfile @@ -17,6 +17,7 @@ end group :system_tests do gem 'voxpupuli-acceptance', '~> 3.0', :require => false + gem 'beaker-vagrant', github: 'ekohl/beaker-vagrant', branch: 'shorter-directory-names' end group :release do From c973bd9d23a9cb7a147830de01bb022812e4aad8 Mon Sep 17 00:00:00 2001 From: Ewoud Kohl van Wijngaarden Date: Sat, 27 Jan 2024 15:04:59 +0100 Subject: [PATCH 3/6] Fix class_disabled_spec manifest definitions Fixes: 28bc41bfcc89715936ab7ff9dbfd4dcec25395f6 ("migrater to beaker_puppet_helpers") --- spec/acceptance/class_disabled_spec.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/spec/acceptance/class_disabled_spec.rb b/spec/acceptance/class_disabled_spec.rb index b5d48eca..224d2349 100644 --- a/spec/acceptance/class_disabled_spec.rb +++ b/spec/acceptance/class_disabled_spec.rb @@ -45,7 +45,7 @@ class { 'selinux': mode => 'permissive' } end context 'when switching from enforcing to disabled' do - let(:pp) do + let(:manifest) do <<-EOS class { 'selinux': mode => 'disabled' } EOS @@ -75,7 +75,7 @@ class { 'selinux': mode => 'disabled' } end it 'applies without changes' do - apply_manifest(pp, catch_changes: true) + apply_manifest(manifest, catch_changes: true) end describe command('getenforce') do @@ -120,7 +120,7 @@ class { 'selinux': mode => 'permissive' } end it 'applies without changes' do - apply_manifest(pp, catch_changes: true) + apply_manifest(manifest, catch_changes: true) end describe command('getenforce') do From e125c1887d5a1c2e58bee7482385faac741c6056 Mon Sep 17 00:00:00 2001 From: Ewoud Kohl van Wijngaarden Date: Sat, 27 Jan 2024 15:09:15 +0100 Subject: [PATCH 4/6] Apply puppet-lint to acceptance test example --- spec/acceptance/class_spec.rb | 41 ++++++++++++++++++----------------- 1 file changed, 21 insertions(+), 20 deletions(-) diff --git a/spec/acceptance/class_spec.rb b/spec/acceptance/class_spec.rb index 4e06ff5a..828aae33 100644 --- a/spec/acceptance/class_spec.rb +++ b/spec/acceptance/class_spec.rb @@ -19,14 +19,14 @@ class { 'selinux': mode => 'enforcing' } selinux::permissive { 'puppet_selinux_test_policy_t': } selinux::port { 'puppet_selinux_test_policy_port_t/tcp': - seltype => 'puppet_selinux_test_policy_port_t', - port => 55555, + seltype => 'puppet_selinux_test_policy_port_t', + port => 55555, protocol => 'tcp', } } # just something simple I found via Google: - file {'/tmp/selinux_simple_policy.te': + file { '/tmp/selinux_simple_policy.te': ensure => 'file', content => @("EOF") module puppet_selinux_simple_policy 1.0; @@ -40,7 +40,7 @@ class file { read getattr }; | EOF } - file {'/tmp/selinux_test_policy.te': + file { '/tmp/selinux_test_policy.te': ensure => 'file', content => @("EOF") policy_module(puppet_selinux_test_policy, 1.0.0) @@ -56,48 +56,49 @@ class file { read getattr }; selinux::module { 'puppet_selinux_simple_policy': source_te => 'file:///tmp/selinux_simple_policy.te', builder => 'simple', - require => File['/tmp/selinux_simple_policy.te'] + require => File['/tmp/selinux_simple_policy.te'], } selinux::module { 'puppet_selinux_test_policy': - source_te => 'file:///tmp/selinux_test_policy.te', - builder => 'refpolicy', - require => File['/tmp/selinux_test_policy.te'] + source_te => 'file:///tmp/selinux_test_policy.te', + builder => 'refpolicy', + require => File['/tmp/selinux_test_policy.te'], } if $have_selinux_ruby_library { - Class['selinux'] -> - file { '/tmp/test_selinux_fcontext': content => 'TEST', seltype => 'puppet_selinux_test_policy_exec_t', + require => Class['selinux'], } - selinux::fcontext {'/tmp/fcontexts_source(/.*)?': + selinux::fcontext { '/tmp/fcontexts_source(/.*)?': seltype => 'puppet_selinux_test_policy_exec_t', } - selinux::fcontext::equivalence {'/tmp/fcontexts_equivalent': + selinux::fcontext::equivalence { '/tmp/fcontexts_equivalent': target => '/tmp/fcontexts_source', } file {['/tmp/fcontexts_source', '/tmp/fcontexts_equivalent']: - ensure => 'directory', + ensure => 'directory', require => [Selinux::Fcontext['/tmp/fcontexts_source(/.*)?'], Selinux::Fcontext::Equivalence['/tmp/fcontexts_equivalent']], } - file {['/tmp/fcontexts_source/define_test', '/tmp/fcontexts_equivalent/define_test']: - ensure => file, - notify => Exec["/sbin/restorecon -FR /tmp/fcontexts_*"] + file { ['/tmp/fcontexts_source/define_test', '/tmp/fcontexts_equivalent/define_test']: + ensure => file, + notify => Exec['/sbin/restorecon -FR /tmp/fcontexts_*'], } - exec {'/sbin/restorecon -FR /tmp/fcontexts_*': - # this is needed because puppet creates files with the wrong context as - # it runs unconfined and only becomes idempotent after the second run. + exec { '/sbin/restorecon -FR /tmp/fcontexts_*': + # this is needed because puppet creates files with the wrong context as + # it runs unconfined and only becomes idempotent after the second run. refreshonly => true, } # test purging - resources {['selinux_fcontext', 'selinux_fcontext_equivalence']: purge => true } + resources { ['selinux_fcontext', 'selinux_fcontext_equivalence']: + purge => true, + } } EOS end From b394233e4378a23910cfdd774a0ff7b41ceb909d Mon Sep 17 00:00:00 2001 From: Ewoud Kohl van Wijngaarden Date: Sat, 27 Jan 2024 15:10:40 +0100 Subject: [PATCH 5/6] Drop Fedora 30 - 33, add Fedora 38 & 39 --- metadata.json | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/metadata.json b/metadata.json index 2082c2c2..d9898004 100644 --- a/metadata.json +++ b/metadata.json @@ -48,10 +48,8 @@ { "operatingsystem": "Fedora", "operatingsystemrelease": [ - "30", - "31", - "32", - "33" + "38", + "39" ] }, { From 3186f6f06ccfbed14e24fdb46be3431b24df68c6 Mon Sep 17 00:00:00 2001 From: Ewoud Kohl van Wijngaarden Date: Sat, 27 Jan 2024 15:12:32 +0100 Subject: [PATCH 6/6] Use more beaker PRs --- Gemfile | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Gemfile b/Gemfile index 59115812..55171f55 100644 --- a/Gemfile +++ b/Gemfile @@ -17,7 +17,10 @@ end group :system_tests do gem 'voxpupuli-acceptance', '~> 3.0', :require => false - gem 'beaker-vagrant', github: 'ekohl/beaker-vagrant', branch: 'shorter-directory-names' + # https://github.com/voxpupuli/beaker-vagrant/pull/80 + gem 'beaker-vagrant', github: 'ekohl/beaker-vagrant', branch: 'shorter-directory-names', require: false + # https://github.com/voxpupuli/beaker-hostgenerator/pull/353 + gem 'beaker-hostgenerator', github: 'ekohl/beaker-hostgenerator', branch: 'use-latest-centos-images-on-vagrant', require: false end group :release do