Closed miguelaferreira closed 8 years ago
I'm having this issue too! kitchen verify
gives the following failures:
Port "443"
should be listening with tcp (FAILED - 1)
Port "8000"
should be listening with tcp (FAILED - 2)
Port "8089"
should be listening with tcp (FAILED - 3)
Failures:
1) splunk::web Port "443" should be listening with tcp
Failure/Error: it { should be_listening.with('tcp') }
expected Port "443" to be listening with tcp
/bin/sh -c ss\ -tnl4\ \|\ grep\ --\ :443\\\
# /tmp/verifier/suites/serverspec/web_spec.rb:27:in `block (3 levels) in <top (required)>'
2) splunk::web Port "8000" should be listening with tcp
Failure/Error: it { should be_listening.with('tcp') }
expected Port "8000" to be listening with tcp
/bin/sh -c ss\ -tnl4\ \|\ grep\ --\ :8000\\\
# /tmp/verifier/suites/serverspec/web_spec.rb:31:in `block (3 levels) in <top (required)>'
3) splunk::web Port "8089" should be listening with tcp
Failure/Error: it { should be_listening.with('tcp') }
expected Port "8089" to be listening with tcp
/bin/sh -c ss\ -tnl4\ \|\ grep\ --\ :8089\\\
# /tmp/verifier/suites/serverspec/web_spec.rb:35:in `block (3 levels) in <top (required)>'
But when I do a kitchen login
and run ss -tnl4 | grep -- :443
it matches fine:
LISTEN 0 511 *:443 *:*
But running /bin/sh -c ss -tnl4 | grep -- :443
returns nothing and echo $?
returns 1?
However, this works (note the trailing space at the end of the command):
[kitchen@560fa9e639f3 ~]$ /bin/sh -c ss\ -tnl4\ \|\ grep\ --\ :443\\\
LISTEN 0 128 *:443 *:*
I wonder if a change somewhere has caused trailing spaces removed?
I think this is related to https://github.com/test-kitchen/busser-serverspec/issues/32?
I'll try to repro tomorrow but this I have doubts that it's an issue with kitchen-vagrant
itself. What serverspec versions are you seeing this on?
@cheeseplus I wasn't pinning the version of serverspec (nor busser), but I did that tot he following versions
(...)
gem 'serverspec', '2.31.1'
gem 'busser', '0.7.1'
(...)
The result was the same.
@miguelaferreira I have tried those versions and received the same error.
I added:
set :path, '/sbin:/usr/sbin:$PATH'
after
set :backend, :exec
now it works for me
That makes a ton of sense and that is a good catch
Sorry for the delay, I can also confirm that the suggestion of @bjenkins101 does indeed fix the problem.
I'm testing a cookbook that installs a jenkins master.
My Gemfile looks like this:
I'm running vagrant version 1.8.1. And using the opscode centos-7.1 template.
When I ask kitchen to verify the convergence using my ServerSpec tests, it fails on some checks (I assume the ones that need sudo):
If I login to the VM and run the same command, all tests pass: