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 spec tests #97
Fix spec tests #97
Conversation
templates/cert.cnf.erb
to fix spec tests@@ -35,7 +35,7 @@ commonName = <%= @commonname %> | |||
emailAddress = <%= @email %> | |||
<% end -%> | |||
|
|||
<% if $req_ext == true -%> | |||
<% if @req_ext == true -%> |
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.
Oh my, that was quite broken then
spec/defines/openssl_dhparam_spec.rb
Outdated
is_expected.to contain_file('/etc/ssl/dhparam.pem') | ||
}.to raise_error(Puppet::Error, /got 'foo'/) | ||
is_expected.to contain_file('/etc/ssl/dhparam.pem') | ||
}.to raise_error(Puppet::Error) |
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'd rather check the error content still.
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.
@raphink The reason I changed this test to be less specific is due to a change in how this exception is raised in either a different Ruby version, or a newer version of Puppet. I haven't figured out which of these triggered it yet. Basically, changing this rule was the only way to get the spec tests to pass. If you have another suggestion that will work across all versions and keep the content check in place, I would be happy to use that.
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.
For an example, see https://travis-ci.org/camptocamp/puppet-openssl/jobs/375901706
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 understand the error message changed between Puppet versions (unfortunately this happens quite often). Maybe the code could just check for the value 'foo'
in the output, just to avoid catching other errors.
I just changed the spec tests as you suggested, and as you can see, Puppet 5 checks still fail. The error is
I'm not a Ruby/spec expert, so I'm not sure where to go from here to catch both a |
Yes, this is linked to the fact that errors with data type checking are different than the ones with |
* The error message for Absolutepath is different between Puppet 4 and Puppet 5, so spec tests can't check for the error message anymore, just the error.
@raphink This should be fixed now. I updated the regular expression to catch both wordings of the exception, so it should work on Puppet 4/5 now. |
templates/cert.cnf.erb
to fix spec tests.