lundi 22 janvier 2018

Include a nodes ip address in Chef InSpec test

I'm running InSpec tests through Test Kitchen

My InSpec test shall ensure, that the output of a curl command is "HelloWorld!"

The following code-block works as desired:

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

Question

How can I include a nodes attribute (ip address) inside my curl test?

In .erb-templates I can use <%= node['ipaddress'] %>

The following approch isn't working

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

Aucun commentaire:

Enregistrer un commentaire