-
-
Notifications
You must be signed in to change notification settings - Fork 881
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 the condition for upstream members #1276
Fix the condition for upstream members #1276
Conversation
7ff7f7e
to
30bd2a7
Compare
03d4c8e
to
0599bf7
Compare
Hi, there seem to be problems installing Nginx, which is why some tests fail. I don't know how this should be related to the change I made. Also the master branch failed too, so I think this is another issue. So in my opinion, this problem is fixed. Or have I overlooked something here? |
I think it'd be better if we made members an |
First, thanks for your reply. I think both solutions are valid. In both cases, I have the decision whether to define or collect the upstream members. You choose to collect in which you don't define a member, but I think that's independent of the datatype we're using. In this respect, I don't see any logical difference between the two solutions, or did I get something wrong? |
No, you got it right: essentially there must be a choice for the module user between members and collection. Currently you can't. I think that changing the parameter to Could you also add a test that ensures this is possible so we don't accidentally break this again? Currently the tests are broken on a new GPG key on the passenger repository though. |
The first version of the commit f0bf83a contained a hash with
But I agree, there should be a test for that. I'll try to create one |
Note the |
I tested locally
|
I think we'll need the equivalent of puppetlabs/puppetlabs-apache#1848 |
Unfortunately, I didn't get to create a test for it. Because I would have to import exported resources, which, according to my information booth, is not possible. Or does anyone know a way to implement that? |
The condition which decides if we have upstream members configurred or if we import from PuppetDB was wrong. Even if no upstream members are defined the condition was true. Fixes voxpupuliGH-1274
0599bf7
to
5f9f9e4
Compare
So, all tests are OK again. If nobody knows a way to implement a test with imported resources from somewhere I think I'm finished here. |
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.
https://github.com/rodjek/rspec-puppet#testing-exported-resources does mention testing exported resources, but I don't see a way to collect them. A somewhat ugly workaround for this would be creating a define:
define nginx::resource::upstream::collector (
Optional[String] $members_tag = undef,
) {
if $members_tag {
Nginx::Resource::Upstream::Member <<| upstream == $name and tag == $members_tag |>>
} else {
Nginx::Resource::Upstream::Member <<| upstream == $name |>>
}
}
Then in this class you do:
nginx::resource::usptream::collector { $name:
members_tag => $members_tag,
}
This would allow you to test for it:
it { is_expected.to contain_nginx__resource__upstream__collector(name).with_members_tag(nil) }
Not sure that's worth it so I'm fine with merging without tests as well.
For easily reading history of the PR , the job was done with PR #1277 |
Thanks! |
Thanks for the fix. Could you please release it also to forge? |
…mber_condition Fix the condition for upstream members
…mber_condition Fix the condition for upstream members
Pull Request (PR) description
The condition which decides if we have upstream members configurred or
if we import from PuppetDB was wrong. Even if no upstream members are
defined the condition was true. As a result, you couldn't import upstream
members no matter what you configured. Sorry for that
This Pull Request (PR) fixes the following issues
Fixes GH-1274