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

extend unit tests for main class #288

Closed
wants to merge 2 commits into from

Conversation

bastelfreak
Copy link
Collaborator

No description provided.

@bastelfreak
Copy link
Collaborator Author

The error is:

  8) puppetdb on ubuntu-18.04-x86_64 with real world params should compile into a catalogue without dependency cycles
     Failure/Error: it { is_expected.to compile.with_all_deps }
       dependency cycles found: (Anchor[apt_key B97B0AFCAA1A47F044F244A07FCC7D46ACCC4CF8 present] => Apt::Key[Add key: B97B0AFCAA1A47F044F244A07FCC7D46ACCC4CF8 from Apt::Source apt.postgresql.org] => Apt::Source[apt.postgresql.org] => Package[dirmngr] => File[sources.list.d] => File[/etc/apt/sources.list.d/apt.postgresql.org.list] => Apt::Setting[list-apt.postgresql.org] => Apt::Source[apt.postgresql.org])
     # ./spec/unit/classes/init_spec.rb:37:in `block (5 levels) in <top (required)>'

This is a regression. I use the puppetdb class since months with these parameters, it now fails with the latest release/master branch.

@bastelfreak
Copy link
Collaborator Author

I extended the unit tests a bit. The parameter that causes issues is puppetdb::manage_dbserver which calls out to the postgresql modules which uses the apt module.

@bastelfreak
Copy link
Collaborator Author

@eimlav
Copy link

eimlav commented Oct 1, 2018

Hey @bastelfreak I've reverted the PR with these changes. I hope this helps you with the issues you are encountering here!

@bastelfreak
Copy link
Collaborator Author

Hi @eimlav, I updated and rebased this PR.The apt module is now working again. I think merging this PR still might be a good idea, to increase the code coverage.

@austb
Copy link
Contributor

austb commented Oct 3, 2018

Since manage_dbserver defaults to true, we were wondering if the shortened test would cover the case? I'm going to try to verify this locally, but you may be able to get it going faster.

next unless facts[:os]['release']['family'] == 'Debian'
context "on #{os} with managed postgresql" do
  describe 'manifest' do
    it { is_expected.to compile.with_all_deps }
  end
end

context "on #{os} without managed postgresql" do
  let :params do
    {
      :manage_dbserver => false
    }
  end

  describe 'manifest' do
    it { is_expected.to compile.with_all_deps }
  end
end

@bastelfreak
Copy link
Collaborator Author

That should be fine as well. I just wanted to use all params here that I use in prod and that currently fail for me. Afterwards I narrowed it down to manage_dbserver. On the other hand it might be good to test actual usecases in acceptance tests and not very specific parameters?

@austb
Copy link
Contributor

austb commented Oct 3, 2018

We were also cosidering removing the next unless facts[:os]['release']['family'] == 'Debian' so that if another dep breaks in postgresql, etc we can catch it as well.

@austb
Copy link
Contributor

austb commented Oct 3, 2018

I made some modifications to your commits here. I think I may need to add in the HEREDOC stuff to manage postgresql in the case where pdb doesn't, but that setup is what I think we are going for. Then again we may not need it if we don't include an expectation for it being included.

@austb
Copy link
Contributor

austb commented Oct 5, 2018

I'm going to close this in favor of #289

@austb austb closed this Oct 5, 2018
@bastelfreak bastelfreak deleted the debianbug branch October 5, 2018 18:39
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

Successfully merging this pull request may close these issues.

3 participants