deric / puppet-accounts

Simple hierachical management of Linux user accounts, groups and SSH keys
https://forge.puppetlabs.com/deric/accounts
Apache License 2.0
34 stars 33 forks source link

Spec tests fail in clean env #56

Closed poikilotherm closed 7 years ago

poikilotherm commented 8 years ago

Hi there,

I wanted to add some spec tests to an extension I currently develop (see https://github.com/poikilotherm/puppet-accounts/tree/feature_enable_cleartext_pw). Maybe it is just me, but all (!) rspec tests invoked via bundle exec rake spec are failing with: Could not find declared class accounts::groups at line 1:1 Could not find declared class accounts at line 1:1 Could not find declared class accounts::users at line 1:1

I tried in the master branch (so no invalid code), same result. I tried with clean rvm envs (ruby 2.1.10, 2.3.1), same result. Even tried on two other machines, same result.

Does anybody have a clue? Other projects with rspec-puppet (like stdlib, ...) are running flawlessly within the same env!

My gem list:

Gems included by the bundle:
  * CFPropertyList (2.2.8)
  * addressable (2.4.0)
  * ansi (1.5.0)
  * ast (2.3.0)
  * astrolabe (1.3.1)
  * aws-sdk-v1 (1.66.0)
  * backports (3.6.8)
  * beaker (2.51.0)
  * beaker-answers (0.11.0)
  * beaker-hiera (0.1.1)
  * beaker-hostgenerator (0.8.0)
  * beaker-pe (0.12.1)
  * beaker-puppet_install_helper (0.5.0)
  * beaker-rspec (5.6.0)
  * builder (3.2.2)
  * bundler (1.13.6)
  * coderay (1.1.1)
  * connection_pool (2.2.0)
  * deep_merge (1.1.1)
  * diff-lcs (1.2.5)
  * docile (1.1.5)
  * docker-api (1.32.1)
  * domain_name (0.5.20160826)
  * ethon (0.9.1)
  * excon (0.54.0)
  * facter (2.4.6)
  * facterdb (0.3.8)
  * faraday (0.9.2)
  * faraday_middleware (0.10.0)
  * fast_gettext (1.1.0)
  * ffi (1.9.14)
  * fission (0.5.0)
  * fog (1.34.0)
  * fog-atmos (0.1.0)
  * fog-aws (0.12.0)
  * fog-brightbox (0.11.0)
  * fog-core (1.43.0)
  * fog-dynect (0.0.3)
  * fog-ecloud (0.3.0)
  * fog-google (0.0.9)
  * fog-json (1.0.2)
  * fog-local (0.3.0)
  * fog-powerdns (0.1.1)
  * fog-profitbricks (2.0.1)
  * fog-radosgw (0.0.5)
  * fog-riakcs (0.1.0)
  * fog-sakuracloud (1.7.5)
  * fog-serverlove (0.1.2)
  * fog-softlayer (1.1.4)
  * fog-storm_on_demand (0.1.1)
  * fog-terremark (0.1.0)
  * fog-vmfusion (0.1.0)
  * fog-voxel (0.1.0)
  * fog-xml (0.1.2)
  * formatador (0.2.5)
  * gettext (3.2.2)
  * gettext-setup (0.7)
  * gh (0.14.0)
  * google-api-client (0.9.4)
  * googleauth (0.5.1)
  * guard (2.14.0)
  * guard-rake (1.0.0)
  * hiera (3.2.1)
  * highline (1.7.8)
  * hirb (0.7.3)
  * hocon (1.1.3)
  * http-cookie (1.0.3)
  * httpclient (2.8.2.4)
  * hurley (0.2)
  * in-parallel (0.1.15)
  * inflecto (0.0.2)
  * inifile (2.0.2)
  * ipaddress (0.8.3)
  * jgrep (1.4.1)
  * json (1.8.3)
  * json_pure (1.8.3)
  * jwt (1.5.6)
  * launchy (2.4.3)
  * librarian-puppet (2.2.3)
  * librarianp (0.6.3)
  * listen (3.0.8)
  * little-plugger (1.1.4)
  * locale (2.1.2)
  * logging (2.1.0)
  * lumberjack (1.0.10)
  * master_manipulator (1.2.4)
  * mcollective-client (2.9.0)
  * memoist (0.15.0)
  * metaclass (0.0.4)
  * metadata-json-lint (0.0.11)
  * method_source (0.8.2)
  * mime-types (2.99.3)
  * mini_portile2 (2.1.0)
  * minitar (0.5.4)
  * minitest (5.9.1)
  * mocha (1.2.1)
  * multi_json (1.12.1)
  * multipart-post (2.0.0)
  * nenv (0.3.0)
  * net-http-persistent (3.0.0)
  * net-http-pipeline (1.0.1)
  * net-scp (1.2.1)
  * net-ssh (2.9.4)
  * net-telnet (0.1.1)
  * netrc (0.11.0)
  * nokogiri (1.6.8.1)
  * notiffany (0.1.1)
  * open_uri_redirections (0.2.1)
  * os (0.9.6)
  * parser (2.3.1.4)
  * powerpack (0.1.1)
  * pry (0.10.4)
  * puppet (4.7.0)
  * puppet-blacksmith (3.4.0)
  * puppet-lint (2.0.2)
  * puppet-lint-absolute_classname-check (0.2.4)
  * puppet-lint-classes_and_types_beginning_with_digits-check (0.1.2)
  * puppet-lint-leading_zero-check (0.1.1)
  * puppet-lint-resource_reference_syntax (1.0.9)
  * puppet-lint-trailing_comma-check (0.3.2)
  * puppet-lint-unquoted_string-check (0.3.0)
  * puppet-lint-version_comparison-check (0.2.1)
  * puppet-syntax (2.1.1)
  * puppet_forge (2.2.2)
  * puppetlabs_spec_helper (1.2.2)
  * pusher-client (0.6.2)
  * rainbow (2.1.0)
  * rake (11.3.0)
  * rb-fsevent (0.9.7)
  * rb-inotify (0.9.7)
  * rbvmomi (1.8.2)
  * representable (2.3.0)
  * require_all (1.3.3)
  * rest-client (1.8.0)
  * retriable (2.1.0)
  * rspec (3.1.0)
  * rspec-core (3.1.7)
  * rspec-expectations (3.1.2)
  * rspec-its (1.2.0)
  * rspec-mocks (3.1.3)
  * rspec-puppet (2.3.2)
  * rspec-puppet-facts (1.7.0)
  * rspec-support (3.1.2)
  * rsync (1.0.9)
  * rubocop (0.33.0)
  * ruby-progressbar (1.8.1)
  * semantic_puppet (0.1.4)
  * serverspec (2.37.2)
  * sfl (2.3)
  * shellany (0.0.1)
  * signet (0.7.3)
  * simplecov (0.12.0)
  * simplecov-console (0.3.1)
  * simplecov-html (0.10.0)
  * slop (3.6.0)
  * spdx-licenses (1.1.0)
  * specinfra (2.63.3)
  * stomp (1.4.3)
  * stringify-hash (0.0.2)
  * systemu (2.6.5)
  * text (1.3.1)
  * thor (0.19.1)
  * travis (1.8.2)
  * travis-lint (2.0.0)
  * trollop (2.1.2)
  * typhoeus (0.8.0)
  * uber (0.0.15)
  * unf (0.1.4)
  * unf_ext (0.0.7.2)
  * websocket (1.2.3)
deric commented 8 years ago

That's quite strange, it works for me. Ruby version 2.1.10 is definitely fine. Just running bundle install && bundle exec rake spec should be enough.

Try to submit a PR, it will trigger an automated build on Travis. Btw. which OS/distribution do you use?

poikilotherm commented 7 years ago

I'm using Fedora 24, tested on two other Fedora 23 machines. Maybe I'll setup an Ubuntu VM and try again there.

deric commented 7 years ago

Could you check that librarian-puppet install --path=spec/fixtures/modules/ installs all dependencies correctly? Possibly the full trace might be helpful.

poikilotherm commented 7 years ago

It get's installed correctly. I even tried to fix things by rerunning bundle exec rspec-puppet-init (deleted Rakefile, ... before) - no new results, still all defines/classes cannot be included.

I setup an Travis CI for my repo, too. Will just stick with that for running the spec tests (also this takes more time than local testing first).

deric commented 7 years ago

You might have a problem with .fixtures.yml:

fixtures:
  symlinks:
    accounts: "#{source_dir}"

which is supposed to symlink source code directory. It's responsibility of puppetlabs_spec_helper, which is included in spec_helper.rb. You might try updating spec_helper with exact path:

fixture_path = File.expand_path(File.join(__FILE__, '..', 'fixtures'))
RSpec.configure do |c|
  c.module_path = File.join(fixture_path, 'modules')
  c.manifest_dir = File.join(fixture_path, 'manifests')
end
poikilotherm commented 7 years ago

Bingo! That's it!

Should I add this to my PR?

deric commented 7 years ago

Cool. Sure, it's kind of magic where I don't know if it does anything or not :)