mirror of
https://github.com/inspec/inspec
synced 2024-12-11 22:02:47 +00:00
07dc5e3192
3 files left to go, and they're behaving oddly so I'm leaving them out in this pass. Looks like 21 deprecations left. Signed-off-by: Ryan Davis <zenspider@chef.io>
47 lines
1.5 KiB
Ruby
47 lines
1.5 KiB
Ruby
require "fileutils"
|
|
require "functional/helper"
|
|
require "securerandom"
|
|
|
|
describe "inspec exec" do
|
|
include FunctionalHelper
|
|
|
|
it "can generate keys" do
|
|
prepare_examples do |dir|
|
|
unique_key_name = SecureRandom.uuid
|
|
|
|
out = inspec("artifact generate --keyname #{unique_key_name}", "cd #{dir} && ")
|
|
|
|
stdout = out.stdout.force_encoding(Encoding::UTF_8)
|
|
_(stdout).must_include "Generating private key"
|
|
_(stdout).must_include "Generating public key"
|
|
assert_exit_code 0, out
|
|
end
|
|
end
|
|
|
|
it "can sign, verify and install a signed profile" do
|
|
# The arcive install commands do not currently support windows and
|
|
# use specific linux extract tar commands. Since artifact is still
|
|
# experimental we are skipping it for now.
|
|
return if is_windows?
|
|
|
|
prepare_examples do |dir|
|
|
unique_key_name = SecureRandom.uuid
|
|
install_dir = File.join(dir, SecureRandom.uuid)
|
|
profile = File.join(dir, "profile")
|
|
FileUtils.mkdir(install_dir)
|
|
|
|
out = inspec("artifact generate --keyname #{unique_key_name}", "cd #{dir} &&")
|
|
assert_exit_code 0, out
|
|
|
|
out = inspec("artifact sign-profile --profile #{profile} --keyname #{unique_key_name}", "cd #{dir} &&")
|
|
assert_exit_code 0, out
|
|
|
|
out = inspec("artifact install-profile --infile profile-1.0.0.iaf --destdir #{install_dir}", "cd #{dir} &&")
|
|
|
|
_(out.stdout.force_encoding(Encoding::UTF_8)).must_include "Installing to #{install_dir}"
|
|
_(Dir.entries(install_dir).join).must_include "inspec.yml"
|
|
assert_exit_code 0, out
|
|
end
|
|
end
|
|
|
|
end
|