puppetlabs / puppet-editor-services

Puppet Language Server for editors
Apache License 2.0
45 stars 21 forks source link

Tests are failing for Facter 4 #238

Closed glennsarti closed 4 years ago

glennsarti commented 4 years ago

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

DavidS commented 4 years ago

See the failures at the bottom of #236

glennsarti commented 4 years ago

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 commented 4 years ago

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

glennsarti commented 4 years ago
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 commented 4 years ago

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 commented 4 years ago

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 commented 4 years ago

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

BogdanIrimie commented 4 years ago

@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 commented 4 years ago

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