mirror of
https://github.com/inspec/inspec
synced 2024-11-23 13:13:22 +00:00
4b96929bf5
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
48 lines
1.1 KiB
Ruby
48 lines
1.1 KiB
Ruby
# encoding: utf-8
|
|
|
|
require 'functional/helper'
|
|
require 'tempfile'
|
|
|
|
describe 'inspec exec automate' do
|
|
include FunctionalHelper
|
|
|
|
let(:config_path) do
|
|
file = Tempfile.new('config.json')
|
|
file.write(config_data)
|
|
file.close
|
|
file.path
|
|
end
|
|
|
|
let(:invocation) do
|
|
cmd = 'exec '
|
|
cmd += example_profile + ' '
|
|
cmd += '--config ' + config_path
|
|
cmd += ' --no-create-lockfile '
|
|
end
|
|
|
|
let(:run_result) { run_inspec_process(invocation) }
|
|
|
|
describe 'when the the URL is fake' do
|
|
let(:config_data) do
|
|
data = <<~EOF
|
|
{
|
|
"reporter": {
|
|
"automate" : {
|
|
"stdout" : false,
|
|
"url" : "https://fake_url_a2.com/data-collector/v0/",
|
|
"token" : "faketoken123",
|
|
"insecure" : true,
|
|
"node_uuid" : "test123"
|
|
}
|
|
}
|
|
}
|
|
EOF
|
|
end
|
|
|
|
it 'should fail' do
|
|
run_result.stderr.must_equal "Error generating reporter 'automate'\n"
|
|
run_result.exit_status.must_equal 1
|
|
run_result.stdout.must_include "ERROR: send_report: POST to /data-collector/v0/"
|
|
end
|
|
end
|
|
end
|