Class: Kitchen::Verifier::Inspec

Inherits:
Base
  • Object
show all
Defined in:
lib/kitchen/verifier/inspec.rb

Overview

InSpec verifier for Kitchen.

Instance Method Summary collapse

Instance Method Details

#call(state) ⇒ Object



40
41
42
43
44
45
46
47
48
49
50
# File 'lib/kitchen/verifier/inspec.rb', line 40

def call(state)
  tests = collect_tests
  opts = runner_options(instance.transport, state)
  runner = ::Inspec::Runner.new(opts)
  tests.each { |target| runner.add_target(target, opts) }

  debug("Running specs from: #{tests.inspect}")
  exit_code = runner.run
  return if exit_code == 0
  fail ActionFailed, "Inspec Runner returns #{exit_code}"
end