diff --git a/lib/plugins/inspec-plugin-manager-cli/test/functional/inspec-plugin_test.rb b/lib/plugins/inspec-plugin-manager-cli/test/functional/inspec-plugin_test.rb index bc27574b0..8bb4bee20 100644 --- a/lib/plugins/inspec-plugin-manager-cli/test/functional/inspec-plugin_test.rb +++ b/lib/plugins/inspec-plugin-manager-cli/test/functional/inspec-plugin_test.rb @@ -291,7 +291,7 @@ class PluginManagerCliInstall < MiniTest::Test install_result = run_inspec_process_with_this_plugin("plugin install #{fixture_info[:given]}", post_run: list_after_run) - assert_empty install_result.stderr_ignore_deprecations + assert_empty install_result.stderr assert_equal 0, install_result.exit_status, 'Exit status should be 0' # Check UX messaging @@ -320,7 +320,7 @@ class PluginManagerCliInstall < MiniTest::Test assert_empty install_result.stderr assert_equal 1, install_result.exit_status, 'Exit status should be 1' - error_message = install_result.stdout_ignore_deprecations.split("\n").last + error_message = install_result.stdout.split("\n").last assert_includes error_message, "No such source code path" assert_includes error_message, 'inspec-test-fixture-nonesuch.rb' assert_includes error_message, 'installation failed' @@ -333,7 +333,7 @@ class PluginManagerCliInstall < MiniTest::Test assert_empty install_result.stderr assert_equal 1, install_result.exit_status, 'Exit status should be 1' - error_message = install_result.stdout_ignore_deprecations.split("\n").last + error_message = install_result.stdout.split("\n").last assert_includes error_message, "Invalid plugin name" assert_includes error_message, 'wrong-name' assert_includes error_message, "All inspec plugins must begin with either 'inspec-' or 'train-'" @@ -347,7 +347,7 @@ class PluginManagerCliInstall < MiniTest::Test assert_empty install_result.stderr assert_equal 1, install_result.exit_status, 'Exit status should be 1' - error_message = install_result.stdout_ignore_deprecations.split("\n").last + error_message = install_result.stdout.split("\n").last assert_includes error_message, "Does not appear to be a plugin" assert_includes error_message, 'inspec-egg-white-omelette' assert_includes error_message, "After probe-loading the supposed plugin, it did not register" @@ -369,7 +369,7 @@ class PluginManagerCliInstall < MiniTest::Test assert_empty install_result.stderr assert_equal 2, install_result.exit_status, 'Exit status on second install should be 2' - error_message = install_result.stdout_ignore_deprecations.split("\n").last + error_message = install_result.stdout.split("\n").last assert_includes error_message, "Plugin already installed" assert_includes error_message, 'inspec-test-fixture' assert_includes error_message, "Use 'inspec plugin list' to see previously installed plugin" @@ -383,7 +383,7 @@ class PluginManagerCliInstall < MiniTest::Test assert_empty install_result.stderr assert_equal 1, install_result.exit_status, 'Exit status should be 1' - error_message = install_result.stdout_ignore_deprecations.split("\n").last + error_message = install_result.stdout.split("\n").last assert_includes error_message, "Unrecognizable plugin structure" assert_includes error_message, 'inspec-wrong-structure' assert_includes error_message, ' When installing from a path, please provide the path of the entry point file' @@ -498,7 +498,7 @@ class PluginManagerCliInstall < MiniTest::Test assert_empty install_result.stderr assert_equal 2, install_result.exit_status, 'Exit status should be 2' - refusal_message = install_result.stdout_ignore_deprecations.split("\n").grep(/refusing/).last + refusal_message = install_result.stdout.split("\n").grep(/refusing/).last refute_nil refusal_message, 'Should find a failure message at the end' assert_includes refusal_message, 'inspec-test-fixture' assert_includes refusal_message, '0.2.0' @@ -515,7 +515,7 @@ class PluginManagerCliInstall < MiniTest::Test assert_empty install_result.stderr assert_equal 2, install_result.exit_status, 'Exit status should be 2' - refusal_message = install_result.stdout_ignore_deprecations.split("\n").grep(/refusing/).last + refusal_message = install_result.stdout.split("\n").grep(/refusing/).last refute_nil refusal_message, 'Should find a failure message at the end' assert_includes refusal_message, 'inspec-test-fixture' assert_includes refusal_message, '0.1.0' @@ -592,7 +592,7 @@ class PluginManagerCliUpdate < MiniTest::Test end update_result = run_inspec_process_with_this_plugin('plugin update inspec-test-fixture', pre_run: pre_block, post_run: list_after_run) - assert_empty update_result.stderr_ignore_deprecations + assert_empty update_result.stderr assert_equal 0, update_result.exit_status, 'Exit status should be 0' success_message = update_result.stdout.split("\n").grep(/updated/).last @@ -618,7 +618,7 @@ class PluginManagerCliUpdate < MiniTest::Test assert_empty update_result.stderr assert_equal 2, update_result.exit_status, 'Exit status should be 2' - refusal_message = update_result.stdout_ignore_deprecations.split("\n").grep(/refusing/).last + refusal_message = update_result.stdout.split("\n").grep(/refusing/).last refute_nil refusal_message, 'Should find a failure message at the end' assert_includes refusal_message, 'inspec-test-fixture' assert_includes refusal_message, '0.2.0' diff --git a/test/functional/filter_table_test.rb b/test/functional/filter_table_test.rb index 48403c894..3ba76dae1 100644 --- a/test/functional/filter_table_test.rb +++ b/test/functional/filter_table_test.rb @@ -47,7 +47,7 @@ describe '2943 inspec exec for filter table profile, method mode for `where' do control_hash.keys.must_include(expected_control) end - cmd.stderr_ignore_deprecations.must_equal '' + cmd.stderr.must_equal '' cmd.exit_status.must_equal 100 end end @@ -136,7 +136,7 @@ describe '2370 lazy_load for filter table' do control_hash.keys.must_include(expected_control) end - cmd.stderr_ignore_deprecations.must_equal '' + cmd.stderr.must_equal '' cmd.exit_status.must_equal 100 end end @@ -158,7 +158,7 @@ describe '2929 exceptions in block-mode where' do control_hash[ctl['id']] = ctl['results'][0]['message'] end control_hash.must_be_empty - cmd.stderr_ignore_deprecations.must_equal '' + cmd.stderr.must_equal '' cmd.exit_status.must_equal 0 end end diff --git a/test/functional/inheritance_test.rb b/test/functional/inheritance_test.rb index f5e874fb3..3355274ea 100644 --- a/test/functional/inheritance_test.rb +++ b/test/functional/inheritance_test.rb @@ -69,7 +69,7 @@ describe 'example inheritance profile' do it 'can execute a profile inheritance' do out = inspec('exec ' + path + ' --reporter json --no-create-lockfile --input-file ' + input_file) - out.stderr_ignore_deprecations.must_equal '' + out.stderr.must_equal '' out.exit_status.must_equal 101 JSON.load(out.stdout).must_be_kind_of Hash end diff --git a/test/functional/inputs_test.rb b/test/functional/inputs_test.rb index 1a973cc31..d9c938022 100644 --- a/test/functional/inputs_test.rb +++ b/test/functional/inputs_test.rb @@ -90,7 +90,7 @@ describe 'inputs' do cmd += ' --no-create-lockfile' out = inspec(cmd) out.stderr.must_equal "Type 'Color' is not a valid input type.\n" - out.stdout_ignore_deprecations.must_equal '' + out.stdout.must_equal '' out.exit_status.must_equal 1 end @@ -100,7 +100,7 @@ describe 'inputs' do cmd += ' --no-create-lockfile' out = inspec(cmd) out.stderr.must_equal "Input 'username' is required and does not have a value.\n" - out.stdout_ignore_deprecations.must_equal '' + out.stdout.must_equal '' out.exit_status.must_equal 1 end diff --git a/test/functional/inspec_exec_automate_test.rb b/test/functional/inspec_exec_automate_test.rb index 19016353e..b790d6d78 100644 --- a/test/functional/inspec_exec_automate_test.rb +++ b/test/functional/inspec_exec_automate_test.rb @@ -67,7 +67,7 @@ describe 'inspec exec automate' do end it 'should include tramp data' do - run_result.stderr_ignore_deprecations.must_equal '' + run_result.stderr.must_equal '' run_result.exit_status.wont_equal 1 # Can't use json-mode on run_inspec_process - it sets diff --git a/test/functional/inspec_exec_json_test.rb b/test/functional/inspec_exec_json_test.rb index 2d5f9c102..0891acbf9 100644 --- a/test/functional/inspec_exec_json_test.rb +++ b/test/functional/inspec_exec_json_test.rb @@ -10,7 +10,7 @@ describe 'inspec exec with json formatter' do it 'can execute a simple file and validate the json schema' do out = inspec('exec ' + example_control + ' --reporter json --no-create-lockfile') - out.stderr_ignore_deprecations.must_equal '' + out.stderr.must_equal '' out.exit_status.must_equal 0 data = JSON.parse(out.stdout) sout = inspec('schema exec-json') @@ -20,7 +20,7 @@ describe 'inspec exec with json formatter' do it 'can execute a profile and validate the json schema' do out = inspec('exec ' + example_profile + ' --reporter json --no-create-lockfile') - out.stderr_ignore_deprecations.must_equal '' + out.stderr.must_equal '' out.exit_status.must_equal 101 data = JSON.parse(out.stdout) sout = inspec('schema exec-json') @@ -30,7 +30,7 @@ describe 'inspec exec with json formatter' do it 'can execute a simple file while using end of options after reporter cli option' do out = inspec('exec --no-create-lockfile --reporter json -- ' + example_control) - out.stderr_ignore_deprecations.must_equal '' + out.stderr.must_equal '' out.exit_status.must_equal 0 data = JSON.parse(out.stdout) sout = inspec('schema exec-json') @@ -40,7 +40,7 @@ describe 'inspec exec with json formatter' do it 'can execute a profile and validate the json schema with target_id' do out = inspec('exec ' + example_profile + ' --reporter json --no-create-lockfile --target-id 1d3e399f-4d71-4863-ac54-84d437fbc444') - out.stderr_ignore_deprecations.must_equal '' + out.stderr.must_equal '' out.exit_status.must_equal 101 data = JSON.parse(out.stdout) data['platform']['target_id'].must_equal '1d3e399f-4d71-4863-ac54-84d437fbc444' diff --git a/test/functional/inspec_exec_jsonmin_test.rb b/test/functional/inspec_exec_jsonmin_test.rb index 4b2ffa6ac..2a82cc83b 100644 --- a/test/functional/inspec_exec_jsonmin_test.rb +++ b/test/functional/inspec_exec_jsonmin_test.rb @@ -10,7 +10,7 @@ describe 'inspec exec' do it 'can execute a profile with the mini json formatter and validate its schema' do out = inspec('exec ' + example_profile + ' --reporter json-min --no-create-lockfile') - out.stderr_ignore_deprecations.must_equal '' + out.stderr.must_equal '' out.exit_status.must_equal 101 data = JSON.parse(out.stdout) sout = inspec('schema exec-jsonmin') @@ -20,7 +20,7 @@ describe 'inspec exec' do it 'can execute a simple file with the mini json formatter and validate its schema' do out = inspec('exec ' + example_control + ' --reporter json-min --no-create-lockfile') - out.stderr_ignore_deprecations.must_equal '' + out.stderr.must_equal '' out.exit_status.must_equal 0 data = JSON.parse(out.stdout) sout = inspec('schema exec-jsonmin') diff --git a/test/functional/inspec_exec_junit_test.rb b/test/functional/inspec_exec_junit_test.rb index 4c28a7a83..4a60343ce 100644 --- a/test/functional/inspec_exec_junit_test.rb +++ b/test/functional/inspec_exec_junit_test.rb @@ -9,7 +9,7 @@ describe 'inspec exec with junit formatter' do it 'can execute a simple file with the junit formatter' do out = inspec('exec ' + example_control + ' --reporter junit --no-create-lockfile') - out.stderr_ignore_deprecations.must_equal '' + out.stderr.must_equal '' out.exit_status.must_equal 0 doc = REXML::Document.new(out.stdout) doc.has_elements?.must_equal true @@ -17,7 +17,7 @@ describe 'inspec exec with junit formatter' do it 'can execute the profile with the junit formatter' do out = inspec('exec ' + example_profile + ' --reporter junit --no-create-lockfile') - out.stderr_ignore_deprecations.must_equal '' + out.stderr.must_equal '' out.exit_status.must_equal 101 doc = REXML::Document.new(out.stdout) doc.has_elements?.must_equal true diff --git a/test/functional/inspec_exec_test.rb b/test/functional/inspec_exec_test.rb index 44a621112..84c498ccf 100644 --- a/test/functional/inspec_exec_test.rb +++ b/test/functional/inspec_exec_test.rb @@ -33,7 +33,7 @@ describe 'inspec exec' do out = inspec('exec ' + File.join(profile_path, 'simple-metadata') + ' --no-create-lockfile') out.stderr.must_equal '' out.exit_status.must_equal 0 - out.stdout_ignore_deprecations.must_equal " + out.stdout.must_equal " Profile: yumyum profile Version: (not specified) Target: local:// @@ -86,7 +86,7 @@ Test Summary: 0 successful, 0 failures, 0 skipped out = inspec('exec ' + File.join(profile_path, 'complete-metadata') + ' --no-create-lockfile') out.stderr.must_equal '' out.exit_status.must_equal 0 - out.stdout_ignore_deprecations.must_equal " + out.stdout.must_equal " Profile: title (name) Version: 1.2.3 Target: local:// @@ -456,7 +456,7 @@ Test Summary: \e[38;5;41m2 successful\e[0m, 0 failures, 0 skipped\n" let(:controls) { json['profiles'][0]['controls'] } it 'completes the run with failed controls but no exception' do - out.stderr_ignore_deprecations.must_be_empty + out.stderr.must_be_empty out.exit_status.must_equal 100 controls.count.must_equal 10 controls.select { |c| c['results'][0]['status'] == 'failed' }.count.must_be :>, 1 @@ -590,7 +590,7 @@ Test Summary: \e[38;5;41m2 successful\e[0m, 0 failures, 0 skipped\n" # If you do, it will execute twice, and cause STDIN to read empty on the second time it 'exec should see the custom target ID value' do result = run_inspec_process( 'exec ' + File.join(profile_path, 'simple-metadata') + ' ' + cli_args + ' ', opts ) - result.stderr_ignore_deprecations.must_be_empty + result.stderr.must_be_empty result.payload.json['platform']['target_id'].must_equal 'from-config-file' end diff --git a/test/functional/inspec_shell_test.rb b/test/functional/inspec_shell_test.rb index 222bf0f7b..009534842 100644 --- a/test/functional/inspec_shell_test.rb +++ b/test/functional/inspec_shell_test.rb @@ -19,24 +19,24 @@ describe 'inspec shell tests' do res = inspec("shell -c 'gordon_config' --depends #{example_profile}") res.stderr.must_equal '' res.exit_status.must_equal 0 - res.stdout_ignore_deprecations.must_equal 'gordon_config' + res.stdout.chop.must_equal 'gordon_config' end it 'confirm file caching is disabled' do out = do_shell_c('inspec.backend.cache_enabled?(:file)', 0) - out.stdout_ignore_deprecations.must_equal 'false' + out.stdout.chop.must_equal 'false' end it 'confirm command caching is disabled' do out = do_shell_c('inspec.backend.cache_enabled?(:command)', 0) - out.stdout_ignore_deprecations.must_equal 'false' + out.stdout.chop.must_equal 'false' end it 'can run ruby expressions (json output)' do x = rand y = rand out = do_shell_c("#{x} + #{y}", 0, true) - j = JSON.load(out.stdout_ignore_deprecations) + j = JSON.load(out.stdout) j.must_equal x+y end @@ -44,14 +44,14 @@ describe 'inspec shell tests' do x = rand y = rand out = do_shell_c("#{x} + #{y}", 0) - out.stdout_ignore_deprecations.must_equal "#{x+y}\n" + out.stdout.must_equal "#{x+y}\n" end it 'can run arbitrary ruby (json output)' do # You cannot have a pipe in a windows command line return if is_windows? out = do_shell_c('x = [1,2,3].inject(0) {|a,v| a + v*v}; x+10', 0, true) - j = JSON.load(out.stdout_ignore_deprecations) + j = JSON.load(out.stdout) j.must_equal 24 # 1^2 + 2^2 + 3^2 + 10 end @@ -59,12 +59,12 @@ describe 'inspec shell tests' do # You cannot have a pipe in a windows command line return if is_windows? out = do_shell_c('x = [1,2,3].inject(0) {|a,v| a + v*v}; x+10', 0) - out.stdout_ignore_deprecations.must_equal "24\n" + out.stdout.must_equal "24\n" end it 'retrieves resources (json output)' do out = do_shell_c('platform.params', 0, true) - j = JSON.load(out.stdout_ignore_deprecations) + j = JSON.load(out.stdout) j.keys.must_include 'name' j.keys.must_include 'families' j.keys.must_include 'arch' diff --git a/test/functional/logging_test.rb b/test/functional/logging_test.rb index 8bbeb265b..57f6103fb 100644 --- a/test/functional/logging_test.rb +++ b/test/functional/logging_test.rb @@ -20,7 +20,7 @@ describe 'Deprecation Facility Behavior' do let(:control_flag) { '--controls deprecate_fail_mode' } it 'should result in a failed control' do - run_result.stderr_ignore_deprecations.must_be_empty + run_result.stderr.must_be_empty run_result.exit_status.must_equal 100 json_result.count.must_equal 3 json_result[0]['status'].must_equal 'passed' @@ -43,7 +43,7 @@ describe 'Deprecation Facility Behavior' do json_result.count.must_equal 1 json_result[0]['status'].must_equal 'passed' - stderr_lines = run_result.stderr_ignore_deprecations.split("\n") + stderr_lines = run_result.stderr.split("\n") stderr_lines.count.must_equal 1 deprecation_line = stderr_lines.first diff --git a/test/functional/plugins_test.rb b/test/functional/plugins_test.rb index 8ca6f3287..e8a587603 100644 --- a/test/functional/plugins_test.rb +++ b/test/functional/plugins_test.rb @@ -60,7 +60,7 @@ describe 'cli command plugins' do outcome = inspec_with_env('meaningoflife answer', INSPEC_CONFIG_DIR: File.join(config_dir_path, 'meaning_by_path')) outcome.stderr.wont_include 'Could not find command "meaningoflife"' outcome.stderr.must_equal '' - outcome.stdout_ignore_deprecations.must_equal '' + outcome.stdout.must_equal '' outcome.exit_status.must_equal 42 end @@ -117,7 +117,7 @@ describe 'DSL plugin types support' do describe 'outer profile dsl plugin type support' do let(:profile_file) { 'outer_profile_dsl.rb' } it 'works correctly with outer_profile dsl extensions' do - run_result.stderr_ignore_deprecations.must_equal '' + run_result.stderr.must_equal '' # The outer_profile_dsl.rb file has control-01, then a call to favorite_grain # (which generates a control), then control-03. @@ -137,7 +137,7 @@ describe 'DSL plugin types support' do let(:profile_file) { 'control_dsl.rb' } it 'works correctly with control dsl extensions' do - run_result.stderr_ignore_deprecations.must_equal '' + run_result.stderr.must_equal '' # The control_dsl.rb file has one control, with a describe-01, then a call to favorite_fruit, then describe-02 # If the plugin exploded, we'd see describe-01 but not describe-02 @@ -156,7 +156,7 @@ describe 'DSL plugin types support' do describe 'describe dsl plugin type support' do let(:profile_file) { 'describe_dsl.rb' } it 'works correctly with describe dsl extensions' do - run_result.stderr_ignore_deprecations.must_equal '' + run_result.stderr.must_equal '' # The describe_dsl.rb file has one control, with # describe-01, describe-02 which contains a call to favorite_vegetable, then describe-03 @@ -175,7 +175,7 @@ describe 'DSL plugin types support' do describe 'test dsl plugin type support' do let(:profile_file) { 'test_dsl.rb' } it 'works correctly with test dsl extensions' do - run_result.stderr_ignore_deprecations.must_equal '' + run_result.stderr.must_equal '' # The test_dsl.rb file has one control, with # describe-01, describe-02 which contains a call to favorite_legume, then describe-03 @@ -202,7 +202,7 @@ describe 'DSL plugin types support' do cmd += File.join(profile_path, 'dsl_plugins') cmd += ' --controls=/^rdsl-control/ ' run_result = run_inspec_with_plugin(cmd, plugin_path: dsl_plugin_path) - run_result.stderr_ignore_deprecations.must_equal '' + run_result.stderr.must_equal '' # We should have three controls; 01 and 03 just do a string match. # 02 uses the custom resource, which relies on calls to the resource DSL.