Add failing functional tests for more piped config subcommands

Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
This commit is contained in:
Clinton Wolfe 2019-02-08 12:03:57 -05:00
parent 5c02be2c3d
commit fd3c3df8c1

View file

@ -584,17 +584,26 @@ Test Summary: \e[38;5;41m2 successful\e[0m, 0 failures, 0 skipped\n"
describe 'when using the --config option to read from STDIN' do describe 'when using the --config option to read from STDIN' do
let(:json_path) { File.join(config_dir_path, 'json-config', 'good.json') } let(:json_path) { File.join(config_dir_path, 'json-config', 'good.json') }
let(:cli_args) { '--config -' } let(:cli_args) { '--config -' }
let(:run_result) do let(:opts) { { prefix: 'cat ' + json_path + ' | ', json: true, env: env } }
prefix = 'cat ' + json_path + ' | '
simple_profile = File.join(profile_path, 'simple-metadata') # DO NOT use the `let`-defined run_result through here
run_inspec_process( # If you do, it will execute twice, and cause STDIN to read empty on the second time
'exec ' + simple_profile + ' ' + cli_args + ' ', it 'exec should see the custom target ID value' do
{ prefix: prefix, json: true, env: env } result = run_inspec_process( 'exec ' + File.join(profile_path, 'simple-metadata') + ' ' + cli_args + ' ', opts )
) result.stderr.must_be_empty
result.payload.json['platform']['target_id'].must_equal 'from-config-file'
end end
it 'should see the custom target ID value' do
stderr.must_be_empty it 'detect should exit 0' do
seen_target_id.must_equal 'from-config-file' result = run_inspec_process( 'detect ' + cli_args + ' ', opts )
result.stderr.must_be_empty
result.exit_status.must_equal 0
end
it 'shell should exit 0' do
result = run_inspec_process( 'shell -c "platform.family" ' + cli_args + ' ', opts )
result.stderr.must_be_empty
result.exit_status.must_equal 0
end end
end end
end end