0

I try to run simple test using Chef test kitchen:

  describe file('/opt/test_file.txt') do
    it { should exist }
  end

I can easy run this test on my kitchen machine (virtualBox/centos-7.2) using kitchen verify.

How can I run this test inside a Docker container installed in my kitchen machine?

techraf
  • 64,883
  • 27
  • 193
  • 198
Robert Grądzki
  • 139
  • 1
  • 2
  • 8

1 Answers1

1

In general would try to handle docker container spec tests as part of the image building process, however, I guess you could run something like this:

describe bash('docker exec -it YOUR_CONTAINER test -f /opt/test_file.txt') do
  its('exit_status') { should eq 0 }
end
thun
  • 478
  • 3
  • 12
  • It works, but i had to change a little first line: `describe bash('sudo docker exec YOUR_CONTAINER test -f /opt/test_file.txt') do` – Robert Grądzki Dec 23 '16 at 10:58