2019-11-07 23:42:48 +00:00
|
|
|
require "minitest/autorun"
|
|
|
|
require "open3"
|
|
|
|
|
2019-11-22 20:48:56 +00:00
|
|
|
TEST_CLI_OPTS = "--chef-license=accept-no-persist".freeze
|
2019-11-09 21:36:15 +00:00
|
|
|
|
|
|
|
class ArtifactTest < Minitest::Test
|
|
|
|
make_my_diffs_pretty!
|
|
|
|
|
2020-02-10 20:54:58 +00:00
|
|
|
def run_cmd(cmd)
|
|
|
|
env = { "PATH" => ENV["PATH"] }
|
|
|
|
pwd = ENV["project_root"] || `git rev-parse --show-toplevel`.chomp
|
|
|
|
opts = { chdir: pwd }
|
|
|
|
|
|
|
|
Open3.capture3(env, cmd, opts)
|
|
|
|
end
|
|
|
|
|
2019-11-09 21:38:00 +00:00
|
|
|
def assert_artifact(inspec_command)
|
2020-02-10 20:54:58 +00:00
|
|
|
stdout, stderr, status = run_cmd "inspec #{inspec_command} #{TEST_CLI_OPTS}"
|
2019-11-09 21:36:15 +00:00
|
|
|
|
|
|
|
assert_empty stderr.sub(/#< CLIXML\n/, "")
|
|
|
|
assert stdout
|
|
|
|
assert status
|
|
|
|
end
|
|
|
|
end
|