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

Mocking puppet master $settings::storeconfigs variable #801

Open
b4ldr opened this issue Jul 29, 2020 · 0 comments
Open

Mocking puppet master $settings::storeconfigs variable #801

b4ldr opened this issue Jul 29, 2020 · 0 comments

Comments

@b4ldr
Copy link
Contributor

b4ldr commented Jul 29, 2020

I have a module which uses the $settings::storeconfig variable to ensure resources are only exported on systems which have sotreconfigs configured and im having trouble mocking the config setting. To test this out i have created a test module with the following puppet code.

class rspec_test {
    if $settings::storeconfigs {
        @@nagios_host {'confined':
            ensure => present
        }
    }
    @@nagios_host {'unconfined':
        ensure => present
    }
}

with the following test , the check for the confined resources fails as the clause for $settings::storeconfigs fails

describe 'rspec_test' do
  context 'test' do
    it { is_expected.to compile.with_all_deps }
  end
  context 'should have exported resources' do
    subject { exported_resources }
    it { is_expected.to contain_nagios_host('confined') }
    it { is_expected.to contain_nagios_host('unconfined') }
  end
end

I tried to update my tests by explicitly setting Puppet[:storeconfigs] = true. However this results in the error

ArgumentError:
      Could not find terminus puppetdb for indirection catalog

Is it possible to configure rspec to honour the settings::storeconfig variable without having to configure puppetdb.

full rspec output from both spec files avalible here

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant