chef-infrainspec

Chef: use kitchen input value in inspec command test


I'm attempting to use an input value from .kitchen.yml in an Inspec test like this:

/.kitchen.yml

- inputs:
  my_service: some_service_name

/tests/my_test.rb

describe command('/bin/some_app status (input('my_service'))')
  its('stdout') { should include 'foo' }
end

Unfortunately, I'm greeted with syntax errors when I try to kitchen verify the suite. The goal is to test if the output of /bin/some_app status my_service contains foo.


Solution

  • Found the solution to the syntax issue. Correct syntax:

    describe command("/bin/some_app status " + input("my_service"))
      its('stdout') { should include 'foo' }
    end