-
-
Notifications
You must be signed in to change notification settings - Fork 133
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
Fix readonly database property #422
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'spec_helper' | ||
|
||
describe Puppet::Type.type(:openldap_database).provider(:olc) do | ||
let(:params) do | ||
{ | ||
suffix: 'dc=example,dc=com', | ||
backend: 'mdb', | ||
readonly: false, | ||
# provider: described_class.name, | ||
} | ||
end | ||
|
||
let(:resource) do | ||
Puppet::Type.type(:openldap_database).new(params) | ||
end | ||
let(:provider) do | ||
resource.provider | ||
end | ||
|
||
before do | ||
allow(described_class).to receive(:slapcat).with('(|(olcDatabase=monitor)(olcDatabase={0}config)(&(objectClass=olcDatabaseConfig)(|(objectClass=olcBdbConfig)(objectClass=olcHdbConfig)(objectClass=olcMdbConfig)(objectClass=olcMonitorConfig)(objectClass=olcRelayConfig)(objectClass=olcLDAPConfig))))').and_return(<<~SLAPCAT) | ||
dn: olcDatabase={1}mdb,cn=config | ||
olcDatabase: {1}mdb | ||
olcReadOnly: FALSE | ||
SLAPCAT | ||
allow(provider).to receive(:slapcat) | ||
allow(provider).to receive(:ldapmodify) | ||
allow(provider).to receive(:ldapadd) | ||
# allow(described_class).to receive(:slapcat) | ||
# allow(described_class).to receive(:ldapmodify) | ||
# allow(described_class).to receive(:ldapadd) | ||
end | ||
|
||
describe 'when creating' do | ||
context 'with readonly set to false' do | ||
it 'parses olcReadOnly as false' do | ||
Check failure on line 38 in spec/unit/puppet/provider/openldap_database/olc_spec.rb GitHub Actions / Puppet / 8 (Ruby 3.2)
Check failure on line 38 in spec/unit/puppet/provider/openldap_database/olc_spec.rb GitHub Actions / Puppet / 7 (Ruby 2.7)
|
||
provider.create | ||
expect(described_class.instances.first.readonly).to eq :false | ||
# expect(described_class.instances.first.readonly).to eq(:false) | ||
end | ||
end | ||
|
||
context 'with readonly set to true' do | ||
let(:params) do | ||
super().merge({ readonly: true }) | ||
end | ||
|
||
it 'parses olcReadonly' do | ||
Check failure on line 50 in spec/unit/puppet/provider/openldap_database/olc_spec.rb GitHub Actions / Puppet / 8 (Ruby 3.2)
Check failure on line 50 in spec/unit/puppet/provider/openldap_database/olc_spec.rb GitHub Actions / Puppet / 7 (Ruby 2.7)
|
||
expect(described_class.instances.first.readonly).to eq(:true) | ||
end | ||
end | ||
end | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess the new default value is the reason for the CI failue:
Please update REFERENCE.md with
$ bundle exec rake strings:generate:reference
Add it to the PR and CI should continue.