File tree Expand file tree Collapse file tree 8 files changed +68
-14
lines changed
Expand file tree Collapse file tree 8 files changed +68
-14
lines changed Original file line number Diff line number Diff line change 44 Stdlib::Absolutepath $file ,
55
66 # Options
7+ String[1] $package_version = installed,
78 Optional[String[1]] $base = undef ,
89 Optional[String[1]] $bind_policy = undef ,
910 Optional[String[1]] $bind_timelimit = undef ,
Original file line number Diff line number Diff line change 55 }
66
77 package { $openldap::client::package :
8- ensure => present ,
8+ ensure => $openldap::client::package_version ,
99 }
1010}
Original file line number Diff line number Diff line change 1212 Boolean $escape_ldapi_ifs,
1313 Array[String[1]] $ldapi_ifs,
1414 Stdlib::Absolutepath $default_directory,
15- Boolean $manage_epel = true ,
15+ Boolean $manage_epel = true ,
16+ String[1] $package_version = installed,
1617 Optional[Boolean] $enable_chown = undef ,
1718 Optional[Boolean] $service_hasstatus = undef ,
1819 Boolean $enable = true ,
Original file line number Diff line number Diff line change 4343 }
4444
4545 package { $openldap::server::package :
46- ensure => present ,
46+ ensure => $openldap::server::package_version ,
4747 responsefile => $responsefile ,
4848 }
4949}
Original file line number Diff line number Diff line change 11# See README.md for details.
22class openldap::utils (
3- Optional[String[1]] $package = undef ,
3+ Optional[String[1]] $package = undef ,
4+ String[1] $package_version = installed,
45) {
56 if $package {
67 package { $package:
7- ensure => present ,
8+ ensure => $package_version ,
89 }
910 }
1011}
Original file line number Diff line number Diff line change 2222 case facts [ :os ] [ 'release' ] [ 'major' ]
2323 when '22.04'
2424 it {
25- is_expected . to contain_package ( 'libldap-2.5-0' ) . with ( ensure : :present )
25+ is_expected . to contain_package ( 'libldap-2.5-0' ) . with ( ensure : :installed )
2626 }
2727 else
2828 it {
29- is_expected . to contain_package ( 'libldap-2.4-2' ) . with ( ensure : :present )
29+ is_expected . to contain_package ( 'libldap-2.4-2' ) . with ( ensure : :installed )
3030 }
3131 end
3232 when 'RedHat'
3333 it {
34- is_expected . to contain_package ( 'openldap' ) . with ( ensure : :present )
34+ is_expected . to contain_package ( 'openldap' ) . with ( ensure : :installed )
3535 }
3636 end
3737 end
4545 it { is_expected . to contain_class ( 'openldap::client::install' ) }
4646
4747 it {
48- is_expected . to contain_package ( 'foo' ) . with ( ensure : :present )
48+ is_expected . to contain_package ( 'foo' ) . with ( ensure : :installed )
49+ }
50+ end
51+
52+ context 'when overriding package version' do
53+ let :pre_condition do
54+ "class {'openldap::client': package => 'bar', package_version => '2.3.4-1' }"
55+ end
56+
57+ it { is_expected . to compile . with_all_deps }
58+ it { is_expected . to contain_class ( 'openldap::client::install' ) }
59+
60+ it {
61+ is_expected . to contain_package ( 'bar' ) . with ( ensure : '2.3.4-1' )
4962 }
5063 end
5164 end
Original file line number Diff line number Diff line change 1616 case facts [ :osfamily ]
1717 when 'Debian'
1818 it {
19- is_expected . to contain_package ( 'slapd' ) . with ( ensure : :present )
19+ is_expected . to contain_package ( 'slapd' ) . with ( ensure : :installed )
2020 }
2121 when 'RedHat'
2222 it {
23- is_expected . to contain_package ( 'openldap-servers' ) . with ( ensure : :present )
23+ is_expected . to contain_package ( 'openldap-servers' ) . with ( ensure : :installed )
2424 }
2525 end
2626
3838 it { is_expected . not_to contain_class ( 'epel' ) } if ( facts [ :os ] [ 'family' ] == 'RedHat' ) && ( facts [ :os ] [ 'release' ] [ 'major' ] . to_s == '9' )
3939 end
4040 end
41+
42+ context 'when overriding package name' do
43+ let :pre_condition do
44+ "class {'openldap::server': package => 'foo', }"
45+ end
46+
47+ it { is_expected . to compile . with_all_deps }
48+ it { is_expected . to contain_class ( 'openldap::server::install' ) }
49+
50+ it {
51+ is_expected . to contain_package ( 'foo' ) . with ( ensure : :installed )
52+ }
53+ end
54+
55+ context 'when overriding package version' do
56+ let :pre_condition do
57+ "class {'openldap::server': package => 'bar', package_version => '2.4.6-1', }"
58+ end
59+
60+ it { is_expected . to compile . with_all_deps }
61+ it { is_expected . to contain_class ( 'openldap::server::install' ) }
62+
63+ it {
64+ is_expected . to contain_package ( 'bar' ) . with ( ensure : '2.4.6-1' )
65+ }
66+ end
4167 end
4268 end
4369end
Original file line number Diff line number Diff line change 1515 case facts [ :osfamily ]
1616 when 'Debian'
1717 it {
18- is_expected . to contain_package ( 'ldap-utils' ) . with ( ensure : :present )
18+ is_expected . to contain_package ( 'ldap-utils' ) . with ( ensure : :installed )
1919 }
2020 when 'RedHat'
2121 it {
22- is_expected . to contain_package ( 'openldap-clients' ) . with ( ensure : :present )
22+ is_expected . to contain_package ( 'openldap-clients' ) . with ( ensure : :installed )
2323 }
2424 end
2525 end
3232 it { is_expected . to compile . with_all_deps }
3333
3434 it {
35- is_expected . to contain_package ( 'foo' ) . with ( ensure : :present )
35+ is_expected . to contain_package ( 'foo' ) . with ( ensure : :installed )
36+ }
37+ end
38+
39+ context 'when overriding package version' do
40+ let :pre_condition do
41+ "class {'openldap::utils': package => 'bar', package_version => '3.6.9-12', }"
42+ end
43+
44+ it { is_expected . to compile . with_all_deps }
45+
46+ it {
47+ is_expected . to contain_package ( 'bar' ) . with ( ensure : '3.6.9-12' )
3648 }
3749 end
3850 end
You can’t perform that action at this time.
0 commit comments