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

Nginx module causing Puppet RSpec failures #1377

Closed
jamtur01 opened this issue Feb 29, 2020 · 3 comments
Closed

Nginx module causing Puppet RSpec failures #1377

jamtur01 opened this issue Feb 29, 2020 · 3 comments

Comments

@jamtur01
Copy link
Contributor

This is an odd one and I'm stumped. When I run my RSpec Puppet tests it's like the Nginx module can't find the values for some default params. The example below is nginx::ssl_dhparam but if I manually edit that one it goes down the param lists to the next.

The module is in .fixtures.yml and clones normally. No other modules seem to have an issue, just Nginx.

I don't know if it's upstream or PEBKAK but it's odd all my other modules are fine. :(

This is one of the tests that fails but its impacting all of the tests too:

it do
    is_expected.to contain_nginx__resource__server('host_name').with(
      listen_port: '80',
      proxy: 'http://localhost:1234/',
    )
  end

Affected Puppet, Ruby, OS and module versions/distributions

  • Puppet: 6.13
  • Ruby: 2.6.3
  • Distribution: OSX
  • Module version: 1.10.0

What are you seeing

I see:

Puppet::PreformattedError:
         Evaluation Error: Error while evaluating a Resource Statement, Evaluation Error: Unknown variable: 'nginx::ssl_dhparam'. (file: /Users/james/Dropbox/src_work/bob/puppet/modules/bob/spec/fixtures/modules/nginx/manifests/resource/server.pp, line: 174, column: 84) (file: /Users/james/Dropbox/src_work/bob/puppet/modules/bob/spec/fixtures/modules/bob/manifests/worker.pp, line: 19) on node mba.local
       # /Library/Ruby/Gems/2.6.0/gems/puppet-6.13.0/lib/puppet/pops/evaluator/runtime3_support.rb:39:in `optionally_fail'
       # /Library/Ruby/Gems/2.6.0/gems/puppet-6.13.0/lib/puppet/pops/evaluator/runtime3_support.rb:112:in `get_variable_value'
       # /Library/Ruby/Gems/2.6.0/gems/puppet-6.13.0/lib/puppet/pops/evaluator/evaluator_impl.rb:1080:in `eval_VariableExpression'
       # /Library/Ruby/Gems/2.6.0/gems/puppet-6.13.0/lib/puppet/pops/visitor.rb:94:in `visit_this_1'
       # /Library/Ruby/Gems/2.6.0/gems/puppet-6.13.0/lib/puppet/pops/evaluator/evaluator_impl.rb:81:in `evaluate'
       # /Library/Ruby/Gems/2.6.0/gems/puppet-6.13.0/lib/puppet/pops/parser/evaluating_parser.rb:60:in `evaluate'
       # /Library/Ruby/Gems/2.6.0/gems/puppet-6.13.0/lib/puppet/parser/ast/pops_bridge.rb:27:in `evaluate'
       # /Library/Ruby/Gems/2.6.0/gems/puppet-6.13.0/lib/puppet/parser/ast.rb:30:in `safeevaluate'
       # /Library/Ruby/Gems/2.6.0/gems/puppet-6.13.0/lib/puppet/parser/scope.rb:195:in `block (3 levels) in evaluate3x'
       # /Library/Ruby/Gems/2.6.0/gems/puppet-6.13.0/lib/puppet/parser/scope.rb:255:in `as_read_only'
       # /Library/Ruby/Gems/2.6.0/gems/puppet-6.13.0/lib/puppet/parser/scope.rb:195:in `block (2 levels) in evaluate3x'
       # /Library/Ruby/Gems/2.6.0/gems/puppet-6.13.0/lib/puppet/parser/scope.rb:193:in `catch'
       # /Library/Ruby/Gems/2.6.0/gems/puppet-6.13.0/lib/puppet/parser/scope.rb:193:in `block in evaluate3x'
       # /Library/Ruby/Gems/2.6.0/gems/puppet-6.13.0/lib/puppet/parser/scope.rb:984:in `with_guarded_scope'
       # /Library/Ruby/Gems/2.6.0/gems/puppet-6.13.0/lib/puppet/parser/scope.rb:192:in `evaluate3x'
       # /Library/Ruby/Gems/2.6.0/gems/puppet-6.13.0/lib/puppet/resource/type.rb:375:in `block (2 levels) in assign_defaults'
       # /Library/Ruby/Gems/2.6.0/gems/puppet-6.13.0/lib/puppet/util/errors.rb:115:in `exceptwrap'
       # /Library/Ruby/Gems/2.6.0/gems/puppet-6.13.0/lib/puppet/resource/type.rb:375:in `block in assign_defaults'
       # /Library/Ruby/Gems/2.6.0/gems/puppet-6.13.0/lib/puppet/resource/type.rb:370:in `each'
       # /Library/Ruby/Gems/2.6.0/gems/puppet-6.13.0/lib/puppet/resource/type.rb:370:in `assign_defaults'
       # /Library/Ruby/Gems/2.6.0/gems/puppet-6.13.0/lib/puppet/resource/type.rb:337:in `block in set_resource_parameters'
       # /Library/Ruby/Gems/2.6.0/gems/puppet-6.13.0/lib/puppet/parser/scope.rb:972:in `block in with_parameter_scope'
       # /Library/Ruby/Gems/2.6.0/gems/puppet-6.13.0/lib/puppet/parser/scope.rb:984:in `with_guarded_scope'
       # /Library/Ruby/Gems/2.6.0/gems/puppet-6.13.0/lib/puppet/parser/scope.rb:970:in `with_parameter_scope'
       # /Library/Ruby/Gems/2.6.0/gems/puppet-6.13.0/lib/puppet/resource/type.rb:332:in `set_resource_parameters'
       # /Library/Ruby/Gems/2.6.0/gems/puppet-6.13.0/lib/puppet/resource/type.rb:124:in `evaluate_code'
       # /Library/Ruby/Gems/2.6.0/gems/puppet-6.13.0/lib/puppet/parser/resource.rb:79:in `block in evaluate'
       # /Library/Ruby/Gems/2.6.0/gems/puppet-6.13.0/lib/puppet/util/profiler/around_profiler.rb:58:in `profile'
       # /Library/Ruby/Gems/2.6.0/gems/puppet-6.13.0/lib/puppet/util/profiler.rb:51:in `profile'
       # /Library/Ruby/Gems/2.6.0/gems/puppet-6.13.0/lib/puppet/parser/resource.rb:71:in `evaluate'
       # /Library/Ruby/Gems/2.6.0/gems/puppet-6.13.0/lib/puppet/parser/compiler.rb:541:in `block (3 levels) in evaluate_definitions'
       # /Library/Ruby/Gems/2.6.0/gems/puppet-6.13.0/lib/puppet/parser/compiler.rb:539:in `each'
       # /Library/Ruby/Gems/2.6.0/gems/puppet-6.13.0/lib/puppet/parser/compiler.rb:539:in `block (2 levels) in evaluate_definitions'
       # /Library/Ruby/Gems/2.6.0/gems/puppet-6.13.0/lib/puppet/util/profiler/around_profiler.rb:58:in `profile'
       # /Library/Ruby/Gems/2.6.0/gems/puppet-6.13.0/lib/puppet/util/profiler.rb:51:in `profile'
       # /Library/Ruby/Gems/2.6.0/gems/puppet-6.13.0/lib/puppet/parser/compiler.rb:538:in `block in evaluate_definitions'
       # /Library/Ruby/Gems/2.6.0/gems/puppet-6.13.0/lib/puppet/util/errors.rb:115:in `exceptwrap'
       # /Library/Ruby/Gems/2.6.0/gems/puppet-6.13.0/lib/puppet/parser/compiler.rb:537:in `evaluate_definitions'
       # /Library/Ruby/Gems/2.6.0/gems/puppet-6.13.0/lib/puppet/parser/compiler.rb:570:in `block (2 levels) in evaluate_generators'
       # /Library/Ruby/Gems/2.6.0/gems/puppet-6.13.0/lib/puppet/util/profiler/around_profiler.rb:58:in `profile'
       # /Library/Ruby/Gems/2.6.0/gems/puppet-6.13.0/lib/puppet/util/profiler.rb:51:in `profile'
       # /Library/Ruby/Gems/2.6.0/gems/puppet-6.13.0/lib/puppet/parser/compiler.rb:567:in `block in evaluate_generators'
       # /Library/Ruby/Gems/2.6.0/gems/puppet-6.13.0/lib/puppet/parser/compiler.rb:564:in `loop'
       # /Library/Ruby/Gems/2.6.0/gems/puppet-6.13.0/lib/puppet/parser/compiler.rb:564:in `evaluate_generators'
       # /Library/Ruby/Gems/2.6.0/gems/puppet-6.13.0/lib/puppet/parser/compiler.rb:179:in `block (2 levels) in compile'
       # /Library/Ruby/Gems/2.6.0/gems/puppet-6.13.0/lib/puppet/util/profiler/around_profiler.rb:58:in `profile'
       # /Library/Ruby/Gems/2.6.0/gems/puppet-6.13.0/lib/puppet/util/profiler.rb:51:in `profile'
       # /Library/Ruby/Gems/2.6.0/gems/puppet-6.13.0/lib/puppet/parser/compiler.rb:179:in `block in compile'
       # /Library/Ruby/Gems/2.6.0/gems/puppet-6.13.0/lib/puppet/context.rb:62:in `override'
       # /Library/Ruby/Gems/2.6.0/gems/puppet-6.13.0/lib/puppet.rb:289:in `override'
       # /Library/Ruby/Gems/2.6.0/gems/puppet-6.13.0/lib/puppet/parser/compiler.rb:155:in `compile'
       # /Library/Ruby/Gems/2.6.0/gems/puppet-6.13.0/lib/puppet/parser/compiler.rb:34:in `compile'
       # /Library/Ruby/Gems/2.6.0/gems/puppet-6.13.0/lib/puppet/indirector/catalog/compiler.rb:309:in `block (2 levels) in compile'
       # /Library/Ruby/Gems/2.6.0/gems/puppet-6.13.0/lib/puppet/util/profiler/around_profiler.rb:58:in `profile'
       # /Library/Ruby/Gems/2.6.0/gems/puppet-6.13.0/lib/puppet/util/profiler.rb:51:in `profile'
       # /Library/Ruby/Gems/2.6.0/gems/puppet-6.13.0/lib/puppet/indirector/catalog/compiler.rb:307:in `block in compile'
       # /Library/Ruby/Gems/2.6.0/gems/puppet-6.13.0/lib/puppet/util.rb:233:in `block in benchmark'
       # /Library/Ruby/Gems/2.6.0/gems/puppet-6.13.0/lib/puppet/util.rb:232:in `benchmark'
       # /Library/Ruby/Gems/2.6.0/gems/puppet-6.13.0/lib/puppet/indirector/catalog/compiler.rb:305:in `compile'
       # /Library/Ruby/Gems/2.6.0/gems/puppet-6.13.0/lib/puppet/indirector/catalog/compiler.rb:57:in `block in find'
       # /Library/Ruby/Gems/2.6.0/gems/puppet-6.13.0/lib/puppet/node/environment.rb:427:in `with_text_domain'
       # /Library/Ruby/Gems/2.6.0/gems/puppet-6.13.0/lib/puppet/indirector/catalog/compiler.rb:56:in `find'
       # /Library/Ruby/Gems/2.6.0/gems/puppet-6.13.0/lib/puppet/indirector/indirection.rb:223:in `find'
       # /Library/Ruby/Gems/2.6.0/gems/rspec-puppet-2.7.8/lib/rspec-puppet/adapters.rb:84:in `catalog'
       # /Library/Ruby/Gems/2.6.0/gems/rspec-puppet-2.7.8/lib/rspec-puppet/adapters.rb:162:in `catalog'
       # /Library/Ruby/Gems/2.6.0/gems/rspec-puppet-2.7.8/lib/rspec-puppet/adapters.rb:204:in `catalog'
       # /Library/Ruby/Gems/2.6.0/gems/rspec-puppet-2.7.8/lib/rspec-puppet/support.rb:415:in `build_catalog_without_cache'
       # /Library/Ruby/Gems/2.6.0/gems/rspec-puppet-2.7.8/lib/rspec-puppet/support.rb:426:in `block in build_catalog'
       # /Library/Ruby/Gems/2.6.0/gems/rspec-puppet-2.7.8/lib/rspec-puppet/cache.rb:17:in `get'
       # /Library/Ruby/Gems/2.6.0/gems/rspec-puppet-2.7.8/lib/rspec-puppet/support.rb:425:in `build_catalog'
       # /Library/Ruby/Gems/2.6.0/gems/rspec-puppet-2.7.8/lib/rspec-puppet/support.rb:90:in `block in load_catalogue'
       # /Library/Ruby/Gems/2.6.0/gems/rspec-puppet-2.7.8/lib/rspec-puppet/support.rb:376:in `with_vardir'
       # /Library/Ruby/Gems/2.6.0/gems/rspec-puppet-2.7.8/lib/rspec-puppet/support.rb:83:in `load_catalogue'
       # /Library/Ruby/Gems/2.6.0/gems/rspec-puppet-2.7.8/lib/rspec-puppet/example/class_example_group.rb:7:in `catalogue'
       # /Library/Ruby/Gems/2.6.0/gems/rspec-puppet-2.7.8/lib/rspec-puppet/support.rb:12:in `block in subject'
       # /Library/Ruby/Gems/2.6.0/gems/rspec-puppet-2.7.8/lib/rspec-puppet/matchers/create_generic.rb:84:in `matches?'
       # ./spec/classes/worker_spec.rb:52:in `block (4 levels) in <top (required)>'
       # ------------------
       # --- Caused by: ---
       # Puppet::PreformattedError:
       #   Evaluation Error: Unknown variable: 'nginx::ssl_dhparam'. (file: /Users/james/Dropbox/src_work/bob/puppet/modules/bob/spec/fixtures/modules/nginx/manifests/resource/server.pp, line: 174, column: 84)
       #   /Library/Ruby/Gems/2.6.0/gems/puppet-6.13.0/lib/puppet/pops/evaluator/runtime3_support.rb:39:in `optionally_fail'

What behaviour did you expect instead

Tests to run.

@tuxmea
Copy link
Member

tuxmea commented Feb 29, 2020

Just to be clear: this is failing tests from your own profile or is this failing tests from nginx module tests?
I am asking, as I saw that for profile spec tests to work you had to add the depending modules to your profile metadata.json.

@jamtur01
Copy link
Contributor Author

jamtur01 commented Feb 29, 2020

These tests are for a module I've written. The metadata.json file contains the puppet/nginx module.

@jamtur01
Copy link
Contributor Author

I fixed it - out of interest to anyone else - there was a single class which didn't include Nginx when it should have ... not sure why that'd kill all the tests but all good. :)

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

2 participants