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

Add customizable warning not to directly edit settings.py #210

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
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
Prev Previous commit
Add unit test for settings.py header
wbclark committed Jul 22, 2021
commit 7feb95eef105d2ef5611948a83f8b1dbc7631300
66 changes: 66 additions & 0 deletions spec/classes/settings_header_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
require 'spec_helper'

describe 'pulpcore' do
on_supported_os.each do |os, os_facts|
context "on #{os}" do
let(:facts) { os_facts }

context 'default params' do
it { is_expected.to compile.with_all_deps }

it 'adds default header to settings.py' do
is_expected.to contain_concat__fragment('base')
.with_content(
Regexp.new(<<~HEADER.chomp),
################################################################################
# !!! WARNING: DO NOT EDIT THIS FILE !!! #
################################################################################
# File managed by Puppet. #
# Module: pulpcore #
################################################################################
# Not only are your edits likely to be overwritten, there is also a strong #
# possibility of breaking your system if you change configuration here without #
# making required changes elsewhere. Refer to the documentation you used to #
# install Pulpcore to determine the safe and persistent way to modify the #
# configuration. #
################################################################################

CONTENT_HOST =
HEADER
)
end
end

context 'with custom config header strings' do
let :pre_condition do
<<~PUPPET
class { pulpcore::header_strings:
custom_installer_name => 'my_pulpcore_installer',
custom_settings_explanation => "Don't even think about it."
}
PUPPET
end

it { is_expected.to compile.with_all_deps }

it 'adds customized header to settings.py' do
is_expected.to contain_concat__fragment('base')
.with_content(
Regexp.new(<<~HEADER.chomp),
################################################################################
# !!! WARNING: DO NOT EDIT THIS FILE !!! #
################################################################################
# File managed by my_pulpcore_installer. #
# Module: pulpcore #
################################################################################
# Don't even think about it. #
################################################################################

CONTENT_HOST =
HEADER
)
end
end
end
end
end