首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >主厨ServerSpec主机资源不工作

主厨ServerSpec主机资源不工作
EN

Stack Overflow用户
提问于 2014-10-07 19:57:51
回答 1查看 506关注 0票数 0

我正在尝试编写一个ServerSpec测试,以针对已部署的实例运行。以下是有关的测试:

代码语言:javascript
复制
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最小)。我安装了这个包,现在当我尝试运行测试时,我得到了以下响应:

代码语言:javascript
复制
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的一个bug吗?有什么解决办法吗?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2014-10-07 20:37:36

这似乎是铁丝,所以我认为它是一个bug。不幸的是,serverspec项目最近禁用了对其repos的问题跟踪,因此没有一种很好的方法来检查它是否已知。听起来你的netcat可能太老了,无法支持这个选项,或者已经修补好了。解决办法是不要使用这个匹配器,should be_listening和iptables检查应该是等价的。您还可以使用带有command类型的nccurl来检查相同的内容。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/26244193

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档