2014-10-07 7 views
0

배포 된 인스턴스에 대해 실행할 ServerSpec 테스트를 작성하려고합니다. 다음은 관련 테스트입니다 :Chef ServerSpec 호스트 리소스가 작동하지 않습니다.

require 'spec_helper' 

describe service('nginx') do 
    it { should be_enabled } 
    it { should be_running } 
end 

describe port(80) do 
    it { should be_listening } 
end 

describe port(8085) do 
    it { should be_listening } 
end 

describe host('localhost') do 
    it { should be_reachable.with(:port => 8085, :proto => 'tcp') } 
end 

내가 처음 ncat가 설치되지 않았 음을 알게이 테스트 (CentOS의 최소 7)을 실행하려고. 그 패키지를 설치했는데 테스트를 실행하려고하면 다음 응답이 표시됩니다.

Failures: 
    1) Host "localhost" should be reachable 
    Failure/Error: it { should be_reachable.with(:port => 8085, :proto => 'tcp') } 
     expected Host "localhost" to be reachable 
     /bin/sh -c nc\ -vvvvzt\ localhost\ 8085\ -w\ 5 
     nc: invalid option -- 'z' 
Ncat: Try `--help' or man(1) ncat for more information, usage options and help. QUITTING. 
    # /tmp/busser/suites/serverspec/localhost/nginx_spec.rb:17:in `block (2 levels) in <top (required)>' 
Finished in 0.08179 seconds (files took 0.2021 seconds to load) 
5 examples, 1 failure 

이것은 ServerSpec의 버그입니까? 알려진 해결 방법이 있습니까?

답변

0

이것은 hardwired in specinfra 인 것으로 보이므로 버그라고 생각합니다. 불행하게도 serverspec 프로젝트는 최근 repos에서 문제점 추적을 비활성화 했으므로 이것이 알려진 것인지 확인하는 좋은 방법은 없습니다. netcat이 너무 오래되어이 옵션을 지원하지 못하거나 패치를 적용한 것 같습니다. 해결 방법은이 정규 표현식을 사용하지 않는 것입니다. should be_listening과 iptables 검사가 동등해야합니다. 유형을 nc 또는 curl과 함께 사용하여 동일한 항목을 확인할 수도 있습니다.

+0

내가해야 할 일이있을 것이라고 생각했습니다. 현재 상황에 대한 배경에 감사드립니다. – localhostv6