Skip to content

Commit

Permalink
Merge pull request #1544 from SimonHoenscheid/fix_regex_add_tests
Browse files Browse the repository at this point in the history
postgresql_conf: Fix regex for value param and add tests
  • Loading branch information
SimonHoenscheid authored Oct 26, 2023
2 parents a3f6eeb + e3dabd1 commit 42aa804
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/puppet/type/postgresql_conf.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

newproperty(:value) do
desc 'The value to set for this parameter.'
newvalues(%r{^\S(.*\S)?$})
newvalues(%r{^(\S.*)?$})

munge do |value|
if value.to_i.to_s == value
Expand Down
6 changes: 6 additions & 0 deletions spec/unit/type/postgresql_conf_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,12 @@
end
# string https://www.postgresql.org/docs/current/datatype-character.html
describe 'validate complex string values with newvalues function' do
it 'validates log_line_prefix with value [%p] %q:%u:%d:%' do
expect { described_class.new(name: 'log_line_prefix', value: '[%p] %q:%u:%d:%x ') }.not_to raise_error
end
it 'validates log_line_prefix with value %t %q%u@%d %p %i' do
expect { described_class.new(name: 'log_line_prefix', value: '%t %q%u@%d %p %i ') }.not_to raise_error
end
it 'validates log_filename with value psql_01-%Y-%m-%d.log' do
expect { described_class.new(name: 'log_filename', value: 'psql_01-%Y-%m-%d.log') }.not_to raise_error
end
Expand Down

0 comments on commit 42aa804

Please sign in to comment.