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

(BKR-1510) make fact helpers support structured facts #59

Merged
merged 1 commit into from
Aug 29, 2018

Conversation

sevendials
Copy link
Contributor

This code adds json to the options of fact_on() and parses the result. This means that fact() and fact_on() preserve the structure and data types of facts.

@puppetlabs-jenkins
Copy link
Contributor

Can one of the admins verify this patch?

@mchllweeks
Copy link

jenkins test this please

@sevendials
Copy link
Contributor Author

@mchllweeks I run rake test:spec:run locally and get this:

Finished in 3.33 seconds (files took 0.81633 seconds to load)
274 examples, 0 failures

I can't see the Jenkins result details on this PR other than it is failing. Should I be running some other test?

@mchllweeks
Copy link

@sevendials Here is the error from Jenkins:
09:49:45 Failures:
09:49:45
09:49:45 1) ClassMixedWithDSLHelpers#fact_on preserves data types
09:49:45 Failure/Error: expect(structured_fact['uid'].class).to be Integer
09:49:45
09:49:45 expected #Class:18330360 => Integer
09:49:45 got #Class:18330200 => Fixnum
09:49:45
09:49:45 Compared using equal?, which compares object identity,
09:49:45 but expected and actual are not the same object. Use
09:49:45 expect(actual).to eq(expected) if you don't care about
09:49:45 object identity in this example.
09:49:45
09:49:45
09:49:45 Diff:
09:49:45 @@ -1,2 +1,2 @@
09:49:45 -Integer
09:49:45 +Fixnum
09:49:45 # ./spec/beaker-puppet/helpers/facter_helpers_spec.rb:66:in `block (3 levels) in <top (required)>'
09:49:45
09:49:45 Finished in 2.44 seconds (files took 1.35 seconds to load)
09:49:45 336 examples, 1 failure
09:49:45
09:49:45 Failed examples:
09:49:45
09:49:45 rspec ./spec/beaker-puppet/helpers/facter_helpers_spec.rb:61 # ClassMixedWithDSLHelpers#fact_on preserves data types

This code adds json to the options of fact_on() and parses the result. This means that fact() and fact_on() preserve the structure and data types of facts.
@sevendials
Copy link
Contributor Author

@mchllweeks I couldn't find any docs about appropriate Ruby versions but I'm guessing that Jenkins is using Ruby <2.4 because above that, Fixnum is deprecated.

I've rebased and pushed a fix to it.

@mchllweeks
Copy link

jenkins test this please

@mchllweeks
Copy link

jenkins re-test this please

@mchllweeks mchllweeks merged commit 957caaf into puppetlabs:master Aug 29, 2018
alexjfisher added a commit to alexjfisher/beaker-puppet that referenced this pull request Oct 1, 2018
Since puppetlabs#59 `fact_on`
stopped working with symbols for fact names.
alexjfisher added a commit to alexjfisher/puppet-collectd that referenced this pull request Oct 1, 2018
Since puppetlabs/beaker-puppet#59, `fact` no
longer works with symbols.

One test was failing.  Two others were being skipped entirely.
alexjfisher added a commit to alexjfisher/beaker-puppet that referenced this pull request Oct 9, 2018
Since puppetlabs#59 `fact_on`
stopped working with symbols for fact names.
archii pushed a commit to archii/puppet-collectd that referenced this pull request Mar 25, 2019
Since puppetlabs/beaker-puppet#59, `fact` no
longer works with symbols.

One test was failing.  Two others were being skipped entirely.
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