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

port resource fails in docker containers because netstat is missing, but gives poor error output as to why. #762

Closed
lamont-granquist opened this issue May 17, 2016 · 2 comments

Comments

@lamont-granquist
Copy link
Contributor

So for example:

Failures:
  1) Port  22 should be listening
     Failure/Error: DEFAULT_FAILURE_NOTIFIER = lambda { |failure, _opts| raise failure }
       expected `Port  22.listening?` to return true, got false
     # ./test/integration/webapp/default_spec.rb:121:in `block (2 levels) in load'
     # ./vendor/bundle/ruby/2.2.0/gems/inspec-0.22.0/lib/inspec/runner_rspec.rb:65:in `run'
     # ./vendor/bundle/ruby/2.2.0/gems/kitchen-inspec-0.13.0/lib/kitchen/verifier/inspec.rb:50:in `call'
     # ./vendor/bundle/ruby/2.2.0/gems/test-kitchen-1.8.0/lib/kitchen/instance.rb:423:in `block in verify_action'
     # ./vendor/bundle/ruby/2.2.0/gems/test-kitchen-1.8.0/lib/kitchen/instance.rb:513:in `call'
     # ./vendor/bundle/ruby/2.2.0/gems/test-kitchen-1.8.0/lib/kitchen/instance.rb:513:in `synchronize_or_call'
     # ./vendor/bundle/ruby/2.2.0/gems/test-kitchen-1.8.0/lib/kitchen/instance.rb:478:in `block in action'
     # ./vendor/bundle/ruby/2.2.0/gems/test-kitchen-1.8.0/lib/kitchen/instance.rb:477:in `action'
     # ./vendor/bundle/ruby/2.2.0/gems/test-kitchen-1.8.0/lib/kitchen/instance.rb:415:in `verify_action'
     # ./vendor/bundle/ruby/2.2.0/gems/test-kitchen-1.8.0/lib/kitchen/instance.rb:348:in `block in transition_to'
     # ./vendor/bundle/ruby/2.2.0/gems/test-kitchen-1.8.0/lib/kitchen/instance.rb:347:in `each'
     # ./vendor/bundle/ruby/2.2.0/gems/test-kitchen-1.8.0/lib/kitchen/instance.rb:347:in `transition_to'
     # ./vendor/bundle/ruby/2.2.0/gems/test-kitchen-1.8.0/lib/kitchen/instance.rb:160:in `verify'
     # ./vendor/bundle/ruby/2.2.0/gems/test-kitchen-1.8.0/lib/kitchen/instance.rb:189:in `block in test'
     # ./vendor/bundle/ruby/2.2.0/gems/test-kitchen-1.8.0/lib/kitchen/instance.rb:185:in `test'
     # ./vendor/bundle/ruby/2.2.0/gems/test-kitchen-1.8.0/lib/kitchen/command.rb:176:in `public_send'
     # ./vendor/bundle/ruby/2.2.0/gems/test-kitchen-1.8.0/lib/kitchen/command.rb:176:in `block (2 levels) in run_action'
  2) Port  22 protocols should include "tcp"
     Failure/Error: DEFAULT_FAILURE_NOTIFIER = lambda { |failure, _opts| raise failure }
       expected [] to include "tcp"
     # ./test/integration/webapp/default_spec.rb:122:in `block (2 levels) in load'
     # ./vendor/bundle/ruby/2.2.0/gems/inspec-0.22.0/lib/inspec/runner_rspec.rb:65:in `run'
     # ./vendor/bundle/ruby/2.2.0/gems/kitchen-inspec-0.13.0/lib/kitchen/verifier/inspec.rb:50:in `call'
     # ./vendor/bundle/ruby/2.2.0/gems/test-kitchen-1.8.0/lib/kitchen/instance.rb:423:in `block in verify_action'
     # ./vendor/bundle/ruby/2.2.0/gems/test-kitchen-1.8.0/lib/kitchen/instance.rb:513:in `call'
     # ./vendor/bundle/ruby/2.2.0/gems/test-kitchen-1.8.0/lib/kitchen/instance.rb:513:in `synchronize_or_call'
     # ./vendor/bundle/ruby/2.2.0/gems/test-kitchen-1.8.0/lib/kitchen/instance.rb:478:in `block in action'
     # ./vendor/bundle/ruby/2.2.0/gems/test-kitchen-1.8.0/lib/kitchen/instance.rb:477:in `action'
     # ./vendor/bundle/ruby/2.2.0/gems/test-kitchen-1.8.0/lib/kitchen/instance.rb:415:in `verify_action'
     # ./vendor/bundle/ruby/2.2.0/gems/test-kitchen-1.8.0/lib/kitchen/instance.rb:348:in `block in transition_to'
     # ./vendor/bundle/ruby/2.2.0/gems/test-kitchen-1.8.0/lib/kitchen/instance.rb:347:in `each'
     # ./vendor/bundle/ruby/2.2.0/gems/test-kitchen-1.8.0/lib/kitchen/instance.rb:347:in `transition_to'
     # ./vendor/bundle/ruby/2.2.0/gems/test-kitchen-1.8.0/lib/kitchen/instance.rb:160:in `verify'
     # ./vendor/bundle/ruby/2.2.0/gems/test-kitchen-1.8.0/lib/kitchen/instance.rb:189:in `block in test'
     # ./vendor/bundle/ruby/2.2.0/gems/test-kitchen-1.8.0/lib/kitchen/instance.rb:185:in `test'
     # ./vendor/bundle/ruby/2.2.0/gems/test-kitchen-1.8.0/lib/kitchen/command.rb:176:in `public_send'
     # ./vendor/bundle/ruby/2.2.0/gems/test-kitchen-1.8.0/lib/kitchen/command.rb:176:in `block (2 levels) in run_action'
  3) Port  22 processes should eq ["sshd"]
     Failure/Error: DEFAULT_FAILURE_NOTIFIER = lambda { |failure, _opts| raise failure }

       expected: ["sshd"]
            got: []

       (compared using ==)
     # ./test/integration/webapp/default_spec.rb:123:in `block (2 levels) in load'
     # ./vendor/bundle/ruby/2.2.0/gems/inspec-0.22.0/lib/inspec/runner_rspec.rb:65:in `run'
     # ./vendor/bundle/ruby/2.2.0/gems/kitchen-inspec-0.13.0/lib/kitchen/verifier/inspec.rb:50:in `call'
     # ./vendor/bundle/ruby/2.2.0/gems/test-kitchen-1.8.0/lib/kitchen/instance.rb:423:in `block in verify_action'
     # ./vendor/bundle/ruby/2.2.0/gems/test-kitchen-1.8.0/lib/kitchen/instance.rb:513:in `call'
     # ./vendor/bundle/ruby/2.2.0/gems/test-kitchen-1.8.0/lib/kitchen/instance.rb:513:in `synchronize_or_call'
     # ./vendor/bundle/ruby/2.2.0/gems/test-kitchen-1.8.0/lib/kitchen/instance.rb:478:in `block in action'
     # ./vendor/bundle/ruby/2.2.0/gems/test-kitchen-1.8.0/lib/kitchen/instance.rb:477:in `action'
     # ./vendor/bundle/ruby/2.2.0/gems/test-kitchen-1.8.0/lib/kitchen/instance.rb:415:in `verify_action'
     # ./vendor/bundle/ruby/2.2.0/gems/test-kitchen-1.8.0/lib/kitchen/instance.rb:348:in `block in transition_to'
     # ./vendor/bundle/ruby/2.2.0/gems/test-kitchen-1.8.0/lib/kitchen/instance.rb:347:in `each'
     # ./vendor/bundle/ruby/2.2.0/gems/test-kitchen-1.8.0/lib/kitchen/instance.rb:347:in `transition_to'
     # ./vendor/bundle/ruby/2.2.0/gems/test-kitchen-1.8.0/lib/kitchen/instance.rb:160:in `verify'
     # ./vendor/bundle/ruby/2.2.0/gems/test-kitchen-1.8.0/lib/kitchen/instance.rb:189:in `block in test'
     # ./vendor/bundle/ruby/2.2.0/gems/test-kitchen-1.8.0/lib/kitchen/instance.rb:185:in `test'
     # ./vendor/bundle/ruby/2.2.0/gems/test-kitchen-1.8.0/lib/kitchen/command.rb:176:in `public_send'
     # ./vendor/bundle/ruby/2.2.0/gems/test-kitchen-1.8.0/lib/kitchen/command.rb:176:in `block (2 levels) in run_action'
Finished in 11.08 seconds (files took 4 minutes 6.3 seconds to load)
49 examples, 3 failures

This looks like the port simply isn't listening. But it really is. The issue is that the docker container lacks a netstat binary and doesn't have net-tools installed.

I would expect to see the exception raised from mixlib-shellout here or some other error indicating "netstat: command not found" more or less, but it seems like inspec is silently swallowing the error.

(for super bonus points you could also do pure-ruby parsing of the /proc filesystem on linux and avoid the external netstat binary dependency, but i don't really expect that...)

@dh2mom247
Copy link

This is the same issue noted in #742

@lamont-granquist
Copy link
Contributor Author

yep, dup

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