Skip to content

Commit

Permalink
Merge pull request #170 from traylenator/eight
Browse files Browse the repository at this point in the history
Avoid Type=notify for squid service in github CI
  • Loading branch information
traylenator authored Mar 24, 2022
2 parents 180aae1 + e50723f commit 9d4e083
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 6 deletions.
3 changes: 2 additions & 1 deletion .sync.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
# unmanaged as installing puppet-systemd
spec/spec_helper_acceptance.rb:
unmanaged: false
unmanaged: true
40 changes: 39 additions & 1 deletion spec/acceptance/class_spec.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,47 @@
require 'spec_helper_acceptance'

describe 'squid class' do
context 'configure http_access' do
context 'configure http_access with default service type' do
it 'works idempotently with no errors' do
pending('the default Type=notify in squid.service working again on CentOS 8') if fact('os.family') == 'RedHat' && fact('os.release.major') != '7'
pp = <<-EOS
# The default Type=notify is problematic in github CI.
if $facts['os']['family'] == 'RedHat' and $facts['os']['release']['major'] != '7' {
systemd::dropin_file{'simple.conf':
ensure => absent,
unit => 'squid.service',
before => Service['squid'],
}
}
class { 'squid':}
squid::http_port{'3128':}
squid::acl{'our_networks':
type => src,
entries => ['all'],
}
squid::http_access{'our_networks':
action => 'allow',
comment => 'Our networks hosts are allowed',
}
EOS
# Run it twice and test for idempotency
apply_manifest(pp, catch_failures: true)
apply_manifest(pp, catch_changes: true)
end
end

context 'configure http_access with simple service type' do
it 'works idempotently with no errors' do
pp = <<-EOS
# The default Type=notify is problematic in github CI.
if $facts['os']['family'] == 'RedHat' and $facts['os']['release']['major'] != '7' {
systemd::dropin_file{'simple.conf':
ensure => present,
unit => 'squid.service',
content => "[Service]\nType=simple\n",
before => Service['squid'],
}
}
class { 'squid':}
squid::http_port{'3128':}
squid::acl{'our_networks':
Expand Down
9 changes: 5 additions & 4 deletions spec/spec_helper_acceptance.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
# Managed by modulesync - DO NOT EDIT
# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/

require 'voxpupuli/acceptance/spec_helper_acceptance'

configure_beaker
configure_beaker do |host|
if fact('os.family') == 'RedHat' && fact('os.release.major') != '7'
on host, puppet('module', 'install', 'puppet-systemd'), acceptable_exit_codes: [0, 1]
end
end

Dir['./spec/support/acceptance/**/*.rb'].sort.each { |f| require f }

0 comments on commit 9d4e083

Please sign in to comment.