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 failures on fresh project checkout #265

Open
mttkay opened this issue Jul 7, 2021 · 1 comment
Open

Test failures on fresh project checkout #265

mttkay opened this issue Jul 7, 2021 · 1 comment

Comments

@mttkay
Copy link
Contributor

mttkay commented Jul 7, 2021

There are 3 tests that fail locally after a fresh checkout of the project on master:

$ bundle exec rspec
...
Finished in 5.1 seconds (files took 0.3487 seconds to load)
157 examples, 3 failures

Failed examples:

rspec ./spec/license_scout/dependency_manager/bundler_spec.rb:134 # LicenseScout::DependencyManager::Bundler#dependencies bundler 2.x project returns an array of Dependencies found in the directory
rspec ./spec/license_scout/dependency_manager/cargo_spec.rb:86 # LicenseScout::DependencyManager::Cargo#dependencies cargo project returns an array of Dependencies found in the directory
rspec ./spec/license_scout/dependency_manager/mix_spec.rb:80 # LicenseScout::DependencyManager::Mix#dependencies returns an array of Dependencies found in the directory

testoutput.log

I'm not sure what the bundler related errors refer to. I ran bundle install so all dependencies as declared by Gemfile are installed:

$ bundle install
...
Bundle complete! 10 Gemfile dependencies, 83 gems now installed.
Use `bundle info [gemname]` to see where a bundled gem is installed.

It appears that some tests require Bundler 2.x, but the project was bundled with Bundler 1.7 as per Gemfile.lock:

BUNDLED WITH
   1.17.2

My understanding is that whatever version is specified here is the required version of Bundler when interacting with this repository.

By the time I ran these tests, my Bundler version matched the BUNDLED_WITH version:

$ bundle -v    
Bundler version 1.17.2
@mttkay
Copy link
Contributor Author

mttkay commented Jul 7, 2021

If I understand these tests correctly they rely on platform / host specifics to execute. That is not a good idea and will cause problems with setups that isolate Ruby dependencies and binaries such as rbenv or rvm. These specs test scenarios with both Bundler 1 and 2 and rely on them to co-exist. Since this project only requires Bundler 1.x as per Gemfile.lock, this is not going to work when license_scout dependencies are sandboxed.

Tests should be repeatable and isolated from their execution environment. Perhaps the solution here is to rely on vendored bundlers instead, so that you can execute them predictably across any environment?

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

No branches or pull requests

1 participant