我的 serverspec 示例,使用 serverspec-init 进行设置,然后我生成了这个简单的测试文件 ./spec/altspf01/sample_spec.rb
require 'spec_helper'
describe command( '/bin/hostname -s' ) do
its(:stdout) { should match /atlspf01/ }
end
我希望它通过 ssh 连接到远程主机 (atlspf01) 并检查其主机名 (atlspf01)。相反,它连接到 localhost (ltipc682)。
1) Command "/bin/hostname -s" stdout should match /atlspf01/
Failure/Error: its(:stdout) { should match /atlspf01/ }
expected "ltipc682\n" to match /atlspf01/
Diff:
@@ -1,2 +1,2 @@
-/atlspf01/
+ltipc682
我做错了什么?
这里的所有代码:https ://gist.github.com/neilhwatson/a3f4a26ad8cf27d62307