Class: PluginManagerCliUpdate
- Inherits:
-
Minitest::Test
- Object
- Minitest::Test
- PluginManagerCliUpdate
- Includes:
- CorePluginFunctionalHelper, PluginManagerHelpers
- Defined in:
- lib/plugins/inspec-plugin-manager-cli/test/functional/inspec-plugin_test.rb
Overview
—————————————————————————————–#
inspec plugin update
—————————————————————————————–#
Constant Summary
Constants included from CorePluginFunctionalHelper
CorePluginFunctionalHelper::TRAIN_CONNECTION
Instance Method Summary collapse
- #test_fail_update_from_nonexistant_gem ⇒ Object
- #test_fail_update_path ⇒ Object
- #test_refuse_update_when_already_current ⇒ Object
- #test_when_a_plugin_can_be_updated ⇒ Object
Methods included from PluginManagerHelpers
#clear_empty_config_dir, #copy_in_core_config_dir, #copy_in_project_config_dir, #parse_plugin_list_lines, #teardown
Methods included from CorePluginFunctionalHelper
#__find_plugin_path_from_caller, #__make_empty_plugin_file_data_structure, #__make_plugin_file_data_structure_with_path, #run_inspec_process, #run_inspec_process_with_this_plugin
Instance Method Details
#test_fail_update_from_nonexistant_gem ⇒ Object
750 751 752 753 754 755 756 757 758 759 |
# File 'lib/plugins/inspec-plugin-manager-cli/test/functional/inspec-plugin_test.rb', line 750 def test_fail_update_from_nonexistant_gem update_result = run_inspec_process_with_this_plugin("plugin update inspec-test-fixture-nonesuch") skip_windows! assert_match(/No such plugin installed:.+ - update failed/, update_result.stdout) assert_empty update_result.stderr assert_exit_code 1, update_result end |
#test_fail_update_path ⇒ Object
761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 |
# File 'lib/plugins/inspec-plugin-manager-cli/test/functional/inspec-plugin_test.rb', line 761 def test_fail_update_path pre_block = Proc.new do |plugin_statefile_data, tmp_dir| plugin_statefile_data.clear # Signal not to write a file, we'll provide one. copy_in_core_config_dir("meaning_by_path", tmp_dir) end update_result = run_inspec_process_with_this_plugin("plugin update inspec-meaning-of-life", pre_run: pre_block) = update_result.stdout.split("\n").grep(/refusing/).last skip_windows! refute_nil , "Should find a failure message at the end" assert_includes , "inspec-meaning-of-life" assert_includes , "inspec plugin uninstall" assert_includes , "Cannot update path-based install" assert_empty update_result.stderr assert_exit_code 2, update_result end |
#test_refuse_update_when_already_current ⇒ Object
730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 |
# File 'lib/plugins/inspec-plugin-manager-cli/test/functional/inspec-plugin_test.rb', line 730 def test_refuse_update_when_already_current pre_block = Proc.new do |plugin_statefile_data, tmp_dir| plugin_statefile_data.clear # Signal not to write a file, we'll provide one. copy_in_core_config_dir("test-fixture-2-float", tmp_dir) end update_result = run_inspec_process_with_this_plugin("plugin update inspec-test-fixture", pre_run: pre_block) = update_result.stdout.split("\n").grep(/refusing/).last skip_windows! refute_nil , "Should find a failure message at the end" assert_includes , "inspec-test-fixture" assert_includes , "0.2.0" assert_includes , "Already installed at latest version" assert_empty update_result.stderr assert_exit_code 2, update_result end |
#test_when_a_plugin_can_be_updated ⇒ Object
703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 |
# File 'lib/plugins/inspec-plugin-manager-cli/test/functional/inspec-plugin_test.rb', line 703 def test_when_a_plugin_can_be_updated skip "this test requires bundler to pass" unless defined? ::Bundler pre_block = Proc.new do |plugin_statefile_data, tmp_dir| plugin_statefile_data.clear # Signal not to write a file, we'll provide one. copy_in_core_config_dir("test-fixture-1-float", tmp_dir) end update_result = run_inspec_process_with_this_plugin("plugin update inspec-test-fixture", pre_run: pre_block, post_run: list_after_run) = update_result.stdout.split("\n").grep(/updated/).last skip_windows! refute_nil , "Should find a success message at the end" assert_includes , "inspec-test-fixture" assert_includes , "0.1.0" assert_includes , "0.2.0" assert_includes , "updated from rubygems.org" itf_plugin = update_result.payload.list_result.detect { |p| p[:name] == "inspec-test-fixture" } refute_nil itf_plugin, "plugin name should now appear in the output of inspec list" assert_equal "gem (user)", itf_plugin[:type] assert_equal "0.2.0", itf_plugin[:version] assert_empty update_result.stderr assert_exit_code 0, update_result end |