gpt4 book ai didi

testing - 在 Chef InSpec 测试中包含节点的 IP 地址

转载 作者:行者123 更新时间:2023-11-28 21:22:27 24 4
gpt4 key购买 nike

我正在通过 Test Kitchen 运行 InSpec 测试

我的 InSpec 测试应确保 curl 命令的输出是“HelloWorld!”

以下代码块按预期工作:

describe command("curl localhost}") do
its('stdout') { should match /HelloWorld!/ }
end

问题

如何在我的 curl 测试中包含节点属性(IP 地址)?

在 .erb-templates 中我可以使用 <%= node['ipaddress'] %>

以下方法无效

describe command("curl #{:ipaddress}") do
its('stdout') { should match /HelloWorld!/ }
end

最佳答案

这不是特别支持。 InSpec 完全独立于 Chef,并且不了解 Chef 和 Ohai 的东西。您可能想自己做一些实现,但请检查 InSpec 中的 os 帮助程序。

关于testing - 在 Chef InSpec 测试中包含节点的 IP 地址,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48389630/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com