Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid Type=notify for squid service in github CI #170

Merged
merged 2 commits into from
Mar 24, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 }