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

Tests are failing for Facter 4 #238

Closed
glennsarti opened this issue Apr 16, 2020 · 9 comments · Fixed by #239
Closed

Tests are failing for Facter 4 #238

glennsarti opened this issue Apr 16, 2020 · 9 comments · Fixed by #239
Labels
bug Something isn't working

Comments

@glennsarti
Copy link
Contributor

The Travis and Appveyor tests are failing now that Facter 4 is available.

@glennsarti glennsarti added the bug Something isn't working label Apr 16, 2020
@DavidS
Copy link
Contributor

DavidS commented Apr 16, 2020

See the failures at the bottom of #236

@glennsarti
Copy link
Contributor Author

Okay, so it's a bug in Facter 4.0.16. 4.0.15 is fine. I am 99% sure it's due to https://github.com/puppetlabs/facter-ng/blame/master/lib/facter.rb#L189

@DavidS
Copy link
Contributor

DavidS commented Apr 16, 2020

@glennsarti do you have a short repro? I can follow up with the team

@glennsarti
Copy link
Contributor Author

glennsarti commented Apr 16, 2020

bundle exec rspec --default .\spec\languageserver-sidecar\ -f d spec/languageserver-sidecar/integration/puppet-languageserver-sidecar/facter_helper_spec.rb:40

Apologies for Windows paths.

Will fail to find the custom fact in the cache dir fixture.

If you lock Facter to 4.0.15 e.g. in Gemfile add gem 'facter', '=4.0.15', redo the bundle install and run the test again it passes.

@glennsarti
Copy link
Contributor Author

bundle exec puppet facts --vardir C:/Source/puppet-editor-services/spec/languageserver-sidecar/fixtures/real_agent/cache --confdir C:/Source/puppet-editor-services/spec/languageserver-sidecar/fixtures/real_agent/confdir Still works so it's something I'm not initialising correctly, but that reset call I linked earlier seems a really bad idea.

@glennsarti
Copy link
Contributor Author

Interestingly... using Editor Services Facter.reset gets called twice, but puppet facts calls it three times!!

I guess it must REALLY be reset by then...

@glennsarti
Copy link
Contributor Author

glennsarti commented Apr 16, 2020

The failing tests failed to find a custom fact in the puppet cache dir, or in a modulepath

glennsarti added a commit to glennsarti/puppet-editor-services that referenced this issue Apr 16, 2020
It appears that Facter 4.0.16 is resetting the Facter search dirs
which then causes the sidecar to not find some external or custom facts.
This commit monkey patches the Facter module and makes it possible
to limit the number of resets to one.
@BogdanIrimie
Copy link

@glennsarti with the fix from https://github.com/puppetlabs/facter-ng/tree/FACT-2562-2 the tests pass.
To run the test I have used

export PUPPET_GEM_VERSION="~> 6.0"
bundle exec rake test_languageserver test_languageserver_sidecar test_debugserver

@glennsarti
Copy link
Contributor Author

I had a look at the branch. It does concern me there weren't tests for this though.

jpogran pushed a commit that referenced this issue Apr 18, 2020
(GH-238) Monkey patch Facter for minimal resets
jpogran added a commit to jpogran/puppet-editor-services that referenced this issue Apr 22, 2020
glennsarti added a commit that referenced this issue Apr 23, 2020
Revert "(GH-238) Monkey patch Facter for minimal resets"
jpogran added a commit to jpogran/puppet-editor-services that referenced this issue Apr 28, 2020
glennsarti added a commit to glennsarti/puppet-editor-services that referenced this issue May 16, 2020
…services into mergeup-master

* 'master' of https://github.com/glennsarti/puppet-editor-services:
  (maint) Release 0.26.0
  (puppetlabsGH-245) Remove facts_all sidecar request
  (puppetlabsGH-245) Use object cache for fact data
  (puppetlabsGH-245) Add acceptance tests for getFacts request
  (puppetlabsGH-242) Puppet Facts Endpoint
  Revert "(puppetlabsGH-238) Monkey patch Facter for minimal resets"
  (maint) Update branding urls
  (puppetlabsGH-238) Monkey patch Facter for minimal resets
  (maint) Update rubocop to 0.80.x
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants