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

test error when running locally #312

Closed
wyardley opened this issue Sep 8, 2017 · 4 comments
Closed

test error when running locally #312

wyardley opened this issue Sep 8, 2017 · 4 comments
Labels
needs-feedback Further information is requested tests-fail

Comments

@wyardley
Copy link
Contributor

wyardley commented Sep 8, 2017

Affected Puppet, Ruby, OS and module versions/distributions

  • Puppet: 5.1.0
  • Ruby: 2.3.4p301
  • Distribution: [running tests on Mac OS X]
  • Module version: current git master

How to reproduce (e.g Puppet code you use)

bundle install
bundle exec rake test

What are you seeing

test failures [see below]. Tests don't appear to fail in Travis. Additionally, is the text "and install_options is a string" correct when it appears to be an array with a single string as the content? (['--verbose'])?

What behaviour did you expect instead

tests to pass

Output log

  1) Puppet::Type::Package::ProviderNpm when installing npm packages and install_options is a string passes the install_options to npm
     Failure/Error: npm('install', *options, package)
     
     Mocha::ExpectationError:
       unexpected invocation: Package[express](provider=npm).npm("install", "--global", "express")
       unsatisfied expectations:
       - expected exactly once, not yet invoked: Package[express](provider=npm).npm("install", "--global", "--verbose", "express")
       satisfied expectations:
       - allowed any number of times, not yet invoked: #<Puppet::Util::Feature:0x7faf8f99fd18>.root?(any_parameters)
       - allowed any number of times, not yet invoked: Puppet::Type::Package::ProviderNpm.command(:npm)
       - allowed any number of times, not yet invoked: Puppet::Type::Package::ProviderNpm.optional_commands(:npm)
     # ./lib/puppet/provider/package/npm.rb:76:in `install'
     # ./spec/unit/puppet/provider/package/npm_spec.rb:46:in `block (4 levels) in <top (required)>'

  2) Puppet::Type::Package::ProviderNpm when installing npm packages and install_options is a hash passes the install_options to npm
     Failure/Error: npm('install', *options, package)
     
     Mocha::ExpectationError:
       unexpected invocation: Package[express](provider=npm).npm("install", "--global", "express")
       unsatisfied expectations:
       - expected exactly once, not yet invoked: Package[express](provider=npm).npm("install", "--global", "--loglevel=error", "express")
       satisfied expectations:
       - allowed any number of times, not yet invoked: #<Puppet::Util::Feature:0x7faf8f99fd18>.root?(any_parameters)
       - allowed any number of times, not yet invoked: Puppet::Type::Package::ProviderNpm.command(:npm)
       - allowed any number of times, not yet invoked: Puppet::Type::Package::ProviderNpm.optional_commands(:npm)
     # ./lib/puppet/provider/package/npm.rb:76:in `install'
     # ./spec/unit/puppet/provider/package/npm_spec.rb:54:in `block (4 levels) in <top (required)>'

Finished in 0.43004 seconds (files took 7.12 seconds to load)
13 examples, 2 failures
@bastelfreak
Copy link
Member

I'm unable to reproduce this with ruby2.4.1 on archlinux. does it fail for you if you do bundle exec rake spec? This would do it sequentially, the test task does it in parallel

@wyardley
Copy link
Contributor Author

wyardley commented Sep 9, 2017

bundle exec rake spec doesn't seem to fail

and yet, if I run
bundle exec rspec spec/unit/puppet/provider/package/npm_spec.rb
it does fail. bundle and git are up to date.

I can also reproduce it with

% cd /tmp
% git clone git@github.com:voxpupuli/puppet-nodejs
% cd puppet-nodejs
% bundle install
% bundle exec rspec spec/unit/puppet/provider/package/npm_spec.rb

bundler itself is up to date.
I don't use rvm, so not so easy to test with a different Ruby version.

@wyardley
Copy link
Contributor Author

happens with parallel tests only, so I think it's an issue with the resource not getting reset or something
https://github.com/voxpupuli/puppet-nodejs/blob/master/spec/unit/puppet/provider/package/npm_spec.rb#L44-L45

@juniorsysadmin juniorsysadmin added needs-feedback Further information is requested tests-fail labels Sep 24, 2017
@juniorsysadmin
Copy link
Member

Closing due to age, feel free to re-open.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-feedback Further information is requested tests-fail
Projects
None yet
Development

No branches or pull requests

3 participants