首页 > 解决方案 > 用于链接到文件中部分的内容的 Serverspec 测试语句

问题描述

我有一个文件,内容如下。我需要为端口号编写服务器规范测试文件,因为它属于它们各自的部分,作为产品木偶自动化的一部分。

路径:etc/a.cfg 文件

Global
 user abc
 group aaa

frontend one
 bind 10.1.0.15:80
 option tcp

frontend two
 bind 10.1.1.25:666
 option tcp 

frontend three 
 bind 10.2.2.45:444
 option tcp

我需要编写 serverspec 测试,就好像端口 666 退出并且属于前端 2 部分一样。与 444 和 80 端口存在类似的方式并属于它们各自的部分

我已经创建了与检查这些部分是否存在相关的 soe serverspec 测试语句。像 serverspec.rb

 # to check frontend one is exst on server/VM for testing
describe file('a.cfg') do
  it { is_expected.to contain %r{^frontend one} } 
end

类似的方式 bt 我不确定如何编写 serverspec 测试,就好像端口 666 退出并且属于前端 2 部分一样。与 444 和 80 端口存在类似的方式并属于它们各自的部分

请帮助知道 puppet 或 serverspec 的人。

标签: rubydevopsserverspec

解决方案


推荐阅读