Skip to content

Commit c7b7206

Browse files
author
jordanbreen28
committed
(CONT-950) - Resolve inadequate datatype for $value
Resolves an issue introduced during the syntax update carried out in this module. The parameter $value in config_entry, can be either a String, Integer or Float. However, it was wrongly set to exclude Floating point numbers.
1 parent e3e17f6 commit c7b7206

File tree

2 files changed

+30
-3
lines changed

2 files changed

+30
-3
lines changed

manifests/server/config_entry.pp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
# @param path Path for postgresql.conf
66
#
77
define postgresql::server::config_entry (
8-
Enum['present', 'absent'] $ensure = 'present',
9-
Optional[Variant[String[1], Integer]] $value = undef,
10-
Variant[Boolean, String[1]] $path = false
8+
Enum['present', 'absent'] $ensure = 'present',
9+
Optional[Variant[String[1], Integer, Float]] $value = undef,
10+
Variant[Boolean, String[1]] $path = false
1111
) {
1212
$postgresql_conf_path = $postgresql::server::postgresql_conf_path
1313

spec/defines/server/config_entry_spec.rb

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,33 @@
4242
end
4343
end
4444

45+
context 'passes values through appropriately' do
46+
let(:params) { { ensure: 'present', name: 'string_value', value: 'entry_test' } }
47+
48+
it 'as a String' do
49+
expect(subject).to contain_postgresql_conf('string_value').with(name: 'string_value',
50+
value: 'entry_test')
51+
end
52+
end
53+
54+
context 'passes values through appropriately' do
55+
let(:params) { { ensure: 'present', name: 'integer_value', value: 40 } }
56+
57+
it 'as an Integer' do
58+
expect(subject).to contain_postgresql_conf('integer_value').with(name: 'integer_value',
59+
value: 40)
60+
end
61+
end
62+
63+
context 'passes values through appropriately' do
64+
let(:params) { { ensure: 'present', name: 'floating_point_value', value: 4.0 } }
65+
66+
it 'a Float' do
67+
expect(subject).to contain_postgresql_conf('floating_point_value').with(name: 'floating_point_value',
68+
value: 4.0)
69+
end
70+
end
71+
4572
context 'unix_socket_directories' do
4673
let(:params) { { ensure: 'present', name: 'unix_socket_directories', value: '/var/pgsql, /opt/postgresql, /root/' } }
4774

0 commit comments

Comments
 (0)