-
Notifications
You must be signed in to change notification settings - Fork 583
(MODULES-1882) convert function tests to rspec-puppet #464
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
(MODULES-1882) convert function tests to rspec-puppet #464
Conversation
The result of the test was: PASS I am a beta ci bot. I am probably lying to you. |
👏 👏 👏 So that bot totally lies. A few tests failed 😄. |
scope = PuppetlabsSpec::PuppetInternals.scope | ||
scope.stubs(:[]).with("::fqdn").returns(host) | ||
scope.stubs(:lookupvar).with("::fqdn").returns(host) | ||
scope.stubs(:lookupvar).with("::fqdn", {}).returns(host) |
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.
should this, for consistency, be handled with let(:facts) {{ :fqdn => host }}
, or is that not possible 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.
When you look at the tests, you'll see that the tests compare the output from different hosts. This precludes using the let(:facts)
thingy. I've added a comment and unstub it too.
@daenney from a CI perspective it did pass: Finished in 13 minutes 52 seconds (files took 1 minute 26.79 seconds to load) I think there are a lot of tests that are defered or not yet implemented but exist. |
require 'puppetlabs_spec_helper_clone' | ||
|
||
# hack to enable all the expect syntax (like allow_any_instance_of) in rspec-puppet examples | ||
RSpec::Mocks::Syntax.enable_expect(RSpec::Puppet::ManifestMatchers) |
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.
will this hack go away?
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.
Yes. This is tracked at rodjek/rspec-puppet#298
thank you very much, 💯 x 👍 ! |
The result of the test was: PASS I am a beta ci bot. I am probably lying to you. |
@nibalizer Oh that's curious, I saw a couple of stack traces in that run and in the last run, specifically this one:
That to me should've made the tests fail. |
e9d643e
to
d2d754a
Compare
one of the things that really astonishes me is that i was actually able to read through this hole patchset… |
The result of the test was: PASS I am a beta ci bot. I am probably lying to you. |
The :validate task is already provided by puppetlabs_spec_helper/rake_tasks and would check files twice. The metadata.json linting is just good form.
…e environmentpath
…sion Usage: describe 'puppet3 behaviour', :unless => RSpec.configuration.puppet_future do describe 'puppet4 behaviour', :if => RSpec.configuration.puppet_future do
d2d754a
to
2f84350
Compare
Rebased, fixed commit dates, fixed stuff @igalic noted. |
The result of the test was: PASS I am a beta ci bot. I am probably lying to you. |
Tests in the new style produces the following documentation output: abs should not eq nil should run abs() and raise an Puppet::ParseError should run abs(-34) and return 34 should run abs("-34") and return 34 should run abs(34) and return 34 should run abs("34") and return 34
This is copied and changed code from an older version of puppet's internal test setup code. It does not work with puppet4.
2f84350
to
18d4c21
Compare
The result of the test was: PASS I am a beta ci bot. I am probably lying to you. |
(MODULES-1882) convert function tests to rspec-puppet
This PR contains a big set of changes to convert most of the unit tests to use plain rspec-puppet. The commits are ordered so that every single commit should pass the specs and the easy changes are up front.
Should the conversion generate more discussion, I'd split out everything up to and including "spec_helper: implement an easy way for specs to confine to puppet version" into a separate PR to get the easy fixes squared away and reduce the amount of stuff I need to carry forward locally. Please consider that when reviewing, and try to keep comments for those two parts a bit separate.
The current master has ~900 examples, while this branch contains ~1750 examples, and 70 pending.