chef 12.0.0.alpha.2-x86-mingw32 → 12.0.0.rc.0-x86-mingw32
Sign up to get free protection for your applications and to get access to all the features.
- data/CONTRIBUTING.md +9 -0
- data/README.md +1 -1
- data/Rakefile +12 -0
- data/bin/chef-service-manager +1 -1
- data/bin/chef-windows-service +35 -0
- data/distro/common/html/_sources/ctl_chef_server.txt +307 -10
- data/distro/common/html/ctl_chef_client.html +3 -7
- data/distro/common/html/ctl_chef_server.html +609 -41
- data/distro/common/html/ctl_chef_shell.html +2 -2
- data/distro/common/html/ctl_chef_solo.html +1 -1
- data/distro/common/html/index.html +13 -13
- data/distro/common/html/knife.html +10 -10
- data/distro/common/html/knife_bootstrap.html +8 -8
- data/distro/common/html/knife_client.html +12 -12
- data/distro/common/html/knife_common_options.html +7 -7
- data/distro/common/html/knife_configure.html +3 -3
- data/distro/common/html/knife_cookbook.html +19 -19
- data/distro/common/html/knife_cookbook_site.html +28 -28
- data/distro/common/html/knife_data_bag.html +28 -13
- data/distro/common/html/knife_delete.html +2 -2
- data/distro/common/html/knife_deps.html +3 -3
- data/distro/common/html/knife_diff.html +4 -4
- data/distro/common/html/knife_download.html +3 -3
- data/distro/common/html/knife_edit.html +2 -2
- data/distro/common/html/knife_environment.html +14 -14
- data/distro/common/html/knife_exec.html +11 -11
- data/distro/common/html/knife_index_rebuild.html +2 -2
- data/distro/common/html/knife_list.html +3 -3
- data/distro/common/html/knife_node.html +23 -23
- data/distro/common/html/knife_raw.html +4 -4
- data/distro/common/html/knife_recipe_list.html +3 -3
- data/distro/common/html/knife_role.html +11 -11
- data/distro/common/html/knife_search.html +4 -4
- data/distro/common/html/knife_serve.html +3 -3
- data/distro/common/html/knife_show.html +3 -3
- data/distro/common/html/knife_ssh.html +7 -7
- data/distro/common/html/knife_ssl_check.html +7 -7
- data/distro/common/html/knife_ssl_fetch.html +9 -9
- data/distro/common/html/knife_status.html +3 -3
- data/distro/common/html/knife_tag.html +9 -9
- data/distro/common/html/knife_upload.html +3 -3
- data/distro/common/html/knife_user.html +9 -9
- data/distro/common/html/knife_using.html +11 -11
- data/distro/common/html/knife_xargs.html +14 -5
- data/distro/common/html/search.html +2 -2
- data/distro/common/html/searchindex.js +1 -1
- data/distro/common/man/man1/chef-shell.1 +2 -2
- data/distro/common/man/man1/knife-bootstrap.1 +7 -7
- data/distro/common/man/man1/knife-client.1 +10 -10
- data/distro/common/man/man1/knife-configure.1 +5 -5
- data/distro/common/man/man1/knife-cookbook-site.1 +24 -24
- data/distro/common/man/man1/knife-cookbook.1 +12 -12
- data/distro/common/man/man1/knife-data-bag.1 +34 -10
- data/distro/common/man/man1/knife-delete.1 +5 -5
- data/distro/common/man/man1/knife-deps.1 +5 -5
- data/distro/common/man/man1/knife-diff.1 +7 -7
- data/distro/common/man/man1/knife-download.1 +5 -5
- data/distro/common/man/man1/knife-edit.1 +5 -5
- data/distro/common/man/man1/knife-environment.1 +11 -11
- data/distro/common/man/man1/knife-exec.1 +11 -11
- data/distro/common/man/man1/knife-index-rebuild.1 +1 -1
- data/distro/common/man/man1/knife-list.1 +5 -5
- data/distro/common/man/man1/knife-node.1 +16 -16
- data/distro/common/man/man1/knife-raw.1 +6 -6
- data/distro/common/man/man1/knife-recipe-list.1 +1 -1
- data/distro/common/man/man1/knife-role.1 +7 -7
- data/distro/common/man/man1/knife-search.1 +6 -6
- data/distro/common/man/man1/knife-serve.1 +6 -6
- data/distro/common/man/man1/knife-show.1 +5 -5
- data/distro/common/man/man1/knife-ssh.1 +9 -9
- data/distro/common/man/man1/knife-ssl-check.1 +7 -7
- data/distro/common/man/man1/knife-ssl-fetch.1 +9 -9
- data/distro/common/man/man1/knife-status.1 +5 -5
- data/distro/common/man/man1/knife-tag.1 +8 -8
- data/distro/common/man/man1/knife-upload.1 +5 -5
- data/distro/common/man/man1/knife-user.1 +8 -8
- data/distro/common/man/man1/knife-xargs.1 +36 -10
- data/distro/common/man/man1/knife.1 +14 -14
- data/distro/common/man/man8/chef-client.8 +3 -10
- data/distro/common/man/man8/chef-solo.8 +1 -1
- data/ext/win32-eventlog/Rakefile +50 -0
- data/ext/win32-eventlog/chef-log.man +26 -0
- data/lib/chef/application.rb +313 -241
- data/lib/chef/application/apply.rb +10 -8
- data/lib/chef/application/client.rb +58 -33
- data/lib/chef/application/solo.rb +33 -12
- data/lib/chef/chef_fs/chef_fs_data_store.rb +1 -1
- data/lib/chef/chef_fs/command_line.rb +1 -1
- data/lib/chef/chef_fs/file_system/organization_invites_entry.rb +2 -1
- data/lib/chef/chef_fs/file_system/organization_members_entry.rb +2 -1
- data/lib/chef/chef_fs/file_system/rest_list_entry.rb +2 -1
- data/lib/chef/client.rb +18 -48
- data/lib/chef/config.rb +43 -11
- data/lib/chef/cookbook/cookbook_version_loader.rb +14 -7
- data/lib/chef/cookbook/metadata.rb +81 -38
- data/lib/chef/cookbook/syntax_check.rb +18 -52
- data/lib/chef/cookbook_loader.rb +1 -1
- data/lib/chef/cookbook_version.rb +58 -39
- data/lib/chef/data_bag.rb +2 -2
- data/lib/chef/deprecation/provider/file.rb +2 -1
- data/lib/chef/dsl/data_query.rb +2 -29
- data/lib/chef/dsl/recipe.rb +8 -22
- data/lib/chef/encrypted_data_bag_item/assertions.rb +1 -1
- data/lib/chef/encrypted_data_bag_item/check_encrypted.rb +56 -0
- data/lib/chef/encrypted_data_bag_item/encrypted_data_bag_item_assertions.rb +1 -1
- data/lib/chef/event_loggers/base.rb +62 -0
- data/lib/chef/event_loggers/windows_eventlog.rb +104 -0
- data/lib/chef/exceptions.rb +18 -1
- data/lib/chef/file_cache.rb +3 -2
- data/lib/chef/guard_interpreter/resource_guard_interpreter.rb +15 -6
- data/lib/chef/http.rb +20 -13
- data/lib/chef/http/ssl_policies.rb +2 -1
- data/lib/chef/json_compat.rb +9 -3
- data/lib/chef/knife.rb +2 -1
- data/lib/chef/knife/bootstrap.rb +12 -18
- data/lib/chef/knife/bootstrap/archlinux-gems.erb +2 -2
- data/lib/chef/knife/bootstrap/chef-aix.erb +2 -2
- data/lib/chef/knife/bootstrap/chef-full.erb +2 -2
- data/lib/chef/knife/cookbook_create.rb +1 -1
- data/lib/chef/knife/cookbook_site_share.rb +43 -8
- data/lib/chef/knife/core/bootstrap_context.rb +6 -11
- data/lib/chef/knife/core/object_loader.rb +5 -5
- data/lib/chef/knife/core/status_presenter.rb +156 -0
- data/lib/chef/knife/core/subcommand_loader.rb +6 -5
- data/lib/chef/knife/core/ui.rb +4 -4
- data/lib/chef/knife/data_bag_create.rb +7 -32
- data/lib/chef/knife/data_bag_edit.rb +24 -43
- data/lib/chef/knife/data_bag_from_file.rb +6 -31
- data/lib/chef/knife/data_bag_secret_options.rb +142 -0
- data/lib/chef/knife/data_bag_show.rb +19 -33
- data/lib/chef/knife/node_from_file.rb +9 -8
- data/lib/chef/knife/ssh.rb +0 -7
- data/lib/chef/knife/ssl_check.rb +70 -6
- data/lib/chef/knife/status.rb +11 -58
- data/lib/chef/mixin/command/unix.rb +2 -2
- data/lib/chef/mixin/convert_to_class_name.rb +54 -0
- data/lib/chef/mixin/descendants_tracker.rb +82 -0
- data/lib/chef/mixin/homebrew_user.rb +68 -0
- data/lib/chef/mixin/shell_out.rb +0 -4
- data/lib/chef/mixin/windows_architecture_helper.rb +16 -0
- data/lib/chef/mixin/windows_env_helper.rb +56 -0
- data/lib/chef/node.rb +2 -2
- data/lib/chef/node_map.rb +146 -0
- data/lib/chef/platform/provider_mapping.rb +11 -39
- data/lib/chef/platform/provider_priority_map.rb +80 -0
- data/lib/chef/platform/query_helpers.rb +5 -1
- data/lib/chef/platform/service_helpers.rb +113 -0
- data/lib/chef/provider.rb +24 -0
- data/lib/chef/provider/breakpoint.rb +2 -0
- data/lib/chef/provider/cookbook_file.rb +2 -0
- data/lib/chef/provider/cron.rb +1 -1
- data/lib/chef/provider/cron/unix.rb +13 -9
- data/lib/chef/provider/deploy.rb +3 -2
- data/lib/chef/provider/deploy/revision.rb +4 -2
- data/lib/chef/provider/deploy/timestamped.rb +2 -0
- data/lib/chef/provider/directory.rb +2 -0
- data/lib/chef/provider/dsc_script.rb +179 -0
- data/lib/chef/provider/env.rb +25 -10
- data/lib/chef/provider/env/windows.rb +9 -16
- data/lib/chef/provider/erl_call.rb +2 -0
- data/lib/chef/provider/execute.rb +5 -2
- data/lib/chef/provider/file.rb +2 -0
- data/lib/chef/provider/git.rb +51 -23
- data/lib/chef/provider/group/dscl.rb +2 -2
- data/lib/chef/provider/group/pw.rb +9 -13
- data/lib/chef/provider/http_request.rb +2 -0
- data/lib/chef/provider/link.rb +3 -0
- data/lib/chef/provider/log.rb +2 -0
- data/lib/chef/provider/lwrp_base.rb +11 -9
- data/lib/chef/provider/mount/mount.rb +1 -1
- data/lib/chef/provider/package/aix.rb +2 -0
- data/lib/chef/provider/package/apt.rb +2 -0
- data/lib/chef/provider/package/dpkg.rb +2 -0
- data/lib/chef/provider/package/easy_install.rb +2 -0
- data/lib/chef/provider/package/freebsd/pkg.rb +2 -1
- data/lib/chef/provider/package/freebsd/pkgng.rb +1 -1
- data/lib/chef/provider/package/freebsd/port.rb +1 -9
- data/lib/chef/provider/package/homebrew.rb +127 -0
- data/lib/chef/provider/package/ips.rb +2 -0
- data/lib/chef/provider/package/macports.rb +3 -0
- data/lib/chef/provider/package/pacman.rb +5 -4
- data/lib/chef/provider/package/paludis.rb +4 -2
- data/lib/chef/provider/package/portage.rb +4 -1
- data/lib/chef/provider/package/rpm.rb +2 -0
- data/lib/chef/provider/package/rubygems.rb +4 -0
- data/lib/chef/provider/package/smartos.rb +2 -0
- data/lib/chef/provider/package/solaris.rb +2 -0
- data/lib/chef/provider/package/windows.rb +5 -2
- data/lib/chef/provider/package/yum.rb +2 -0
- data/lib/chef/provider/powershell_script.rb +3 -1
- data/lib/chef/provider/remote_directory.rb +25 -10
- data/lib/chef/provider/route.rb +2 -0
- data/lib/chef/provider/ruby_block.rb +2 -0
- data/lib/chef/provider/script.rb +6 -0
- data/lib/chef/provider/service/aix.rb +128 -0
- data/lib/chef/provider/service/aixinit.rb +117 -0
- data/lib/chef/provider/service/arch.rb +6 -0
- data/lib/chef/provider/service/debian.rb +35 -29
- data/lib/chef/provider/service/freebsd.rb +7 -1
- data/lib/chef/provider/service/gentoo.rb +5 -1
- data/lib/chef/provider/service/init.rb +2 -0
- data/lib/chef/provider/service/insserv.rb +15 -8
- data/lib/chef/provider/service/invokercd.rb +6 -0
- data/lib/chef/provider/service/macosx.rb +4 -1
- data/lib/chef/provider/service/redhat.rb +9 -3
- data/lib/chef/provider/service/simple.rb +2 -0
- data/lib/chef/provider/service/solaris.rb +2 -0
- data/lib/chef/provider/service/systemd.rb +7 -0
- data/lib/chef/provider/service/upstart.rb +7 -0
- data/lib/chef/provider/service/windows.rb +5 -0
- data/lib/chef/provider/subversion.rb +2 -0
- data/lib/chef/provider/template.rb +1 -0
- data/lib/chef/provider/user/dscl.rb +3 -2
- data/lib/chef/provider/whyrun_safe_ruby_block.rb +2 -0
- data/lib/chef/provider_resolver.rb +103 -0
- data/lib/chef/providers.rb +6 -2
- data/lib/chef/recipe.rb +2 -0
- data/lib/chef/resource.rb +69 -78
- data/lib/chef/resource/apt_package.rb +3 -1
- data/lib/chef/resource/bash.rb +1 -0
- data/lib/chef/resource/bff_package.rb +0 -1
- data/lib/chef/resource/breakpoint.rb +1 -1
- data/lib/chef/resource/chef_gem.rb +1 -2
- data/lib/chef/resource/conditional.rb +26 -6
- data/lib/chef/resource/cookbook_file.rb +2 -3
- data/lib/chef/resource/csh.rb +1 -0
- data/lib/chef/resource/deploy.rb +0 -1
- data/lib/chef/resource/deploy_revision.rb +6 -1
- data/lib/chef/resource/directory.rb +1 -2
- data/lib/chef/resource/dpkg_package.rb +2 -1
- data/lib/chef/resource/dsc_script.rb +125 -0
- data/lib/chef/resource/easy_install_package.rb +2 -1
- data/lib/chef/resource/erl_call.rb +1 -0
- data/lib/chef/resource/execute.rb +26 -9
- data/lib/chef/resource/file.rb +1 -3
- data/lib/chef/resource/freebsd_package.rb +10 -23
- data/lib/chef/resource/gem_package.rb +2 -1
- data/lib/chef/resource/git.rb +2 -1
- data/lib/chef/resource/homebrew_package.rb +46 -0
- data/lib/chef/resource/http_request.rb +1 -0
- data/lib/chef/resource/ips_package.rb +3 -1
- data/lib/chef/resource/link.rb +1 -2
- data/lib/chef/resource/log.rb +4 -0
- data/lib/chef/resource/lwrp_base.rb +24 -15
- data/lib/chef/resource/macports_package.rb +3 -1
- data/lib/chef/resource/pacman_package.rb +2 -1
- data/lib/chef/resource/paludis_package.rb +3 -1
- data/lib/chef/resource/perl.rb +1 -0
- data/lib/chef/resource/powershell_script.rb +0 -2
- data/lib/chef/resource/python.rb +1 -1
- data/lib/chef/resource/remote_directory.rb +1 -2
- data/lib/chef/resource/remote_file.rb +1 -1
- data/lib/chef/resource/rpm_package.rb +2 -1
- data/lib/chef/resource/ruby.rb +1 -0
- data/lib/chef/resource/ruby_block.rb +3 -0
- data/lib/chef/resource/script.rb +2 -25
- data/lib/chef/resource/service.rb +0 -4
- data/lib/chef/resource/smartos_package.rb +3 -4
- data/lib/chef/resource/solaris_package.rb +7 -1
- data/lib/chef/resource/subversion.rb +0 -1
- data/lib/chef/resource/template.rb +2 -3
- data/lib/chef/resource/timestamped_deploy.rb +1 -2
- data/lib/chef/resource/whyrun_safe_ruby_block.rb +0 -1
- data/lib/chef/resource/windows_package.rb +3 -4
- data/lib/chef/resource/windows_script.rb +3 -0
- data/lib/chef/resource/windows_service.rb +2 -2
- data/lib/chef/resource/yum_package.rb +3 -1
- data/lib/chef/resource_collection.rb +50 -227
- data/lib/chef/resource_collection/resource_collection_serialization.rb +59 -0
- data/lib/chef/resource_collection/resource_list.rb +89 -0
- data/lib/chef/resource_collection/resource_set.rb +170 -0
- data/lib/chef/resources.rb +2 -0
- data/lib/chef/role.rb +1 -1
- data/lib/chef/run_context.rb +5 -1
- data/lib/chef/shell/ext.rb +1 -1
- data/lib/chef/util/backup.rb +3 -2
- data/lib/chef/util/dsc/configuration_generator.rb +115 -0
- data/lib/chef/util/dsc/lcm_output_parser.rb +133 -0
- data/lib/chef/util/dsc/local_configuration_manager.rb +141 -0
- data/lib/chef/util/dsc/resource_info.rb +26 -0
- data/lib/chef/util/path_helper.rb +12 -0
- data/lib/chef/util/powershell/cmdlet.rb +136 -0
- data/lib/chef/util/powershell/cmdlet_result.rb +46 -0
- data/lib/chef/version.rb +1 -1
- data/lib/chef/win32/api/system.rb +9 -0
- data/lib/chef/win32/version.rb +2 -0
- data/spec/.DS_Store +0 -0
- data/spec/data/.DS_Store +0 -0
- data/spec/data/bootstrap/test-hints.erb +1 -1
- data/spec/data/bootstrap/test.erb +1 -1
- data/spec/data/cb_version_cookbooks/cookbook2/files/test.txt +0 -0
- data/spec/data/cb_version_cookbooks/cookbook2/templates/test.erb +0 -0
- data/spec/data/cookbooks/ignorken/files/default/not_me.rb +2 -0
- data/spec/data/cookbooks/ignorken/templates/ubuntu-12.10/not_me.rb +2 -0
- data/spec/data/cookbooks/openldap/libraries/openldap.rb +4 -0
- data/spec/data/cookbooks/openldap/libraries/openldap/version.rb +3 -0
- data/spec/data/lwrp/.DS_Store +0 -0
- data/spec/data/lwrp/providers/.DS_Store +0 -0
- data/spec/data/lwrp/providers/buck_passer.rb +9 -2
- data/spec/data/lwrp/resources/.DS_Store +0 -0
- data/spec/data/lwrp/resources/foo.rb +3 -2
- data/spec/data/lwrp_override/.DS_Store +0 -0
- data/spec/data/lwrp_override/providers/.DS_Store +0 -0
- data/spec/data/lwrp_override/providers/buck_passer.rb +5 -10
- data/spec/data/lwrp_override/resources/.DS_Store +0 -0
- data/spec/data/lwrp_override/resources/foo.rb +4 -3
- data/spec/functional/assets/chefinittest +34 -0
- data/spec/functional/assets/testchefsubsys +11 -0
- data/spec/functional/dsl/reboot_pending_spec.rb +19 -16
- data/spec/functional/event_loggers/windows_eventlog_spec.rb +82 -0
- data/spec/functional/knife/cookbook_delete_spec.rb +3 -3
- data/spec/functional/knife/exec_spec.rb +1 -1
- data/spec/functional/resource/aix_service_spec.rb +136 -0
- data/spec/functional/resource/aixinit_service_spec.rb +211 -0
- data/spec/functional/resource/base.rb +1 -0
- data/spec/functional/resource/batch_spec.rb +4 -11
- data/spec/functional/resource/cron_spec.rb +7 -1
- data/spec/functional/resource/dsc_script_spec.rb +382 -0
- data/spec/functional/resource/env_spec.rb +54 -0
- data/spec/functional/resource/execute_spec.rb +113 -0
- data/spec/functional/resource/file_spec.rb +2 -0
- data/spec/functional/resource/group_spec.rb +7 -4
- data/spec/functional/resource/powershell_spec.rb +198 -185
- data/spec/functional/resource/rpm_spec.rb +5 -4
- data/spec/functional/resource/user/dscl_spec.rb +2 -1
- data/spec/functional/util/path_helper_spec.rb +37 -0
- data/spec/functional/util/powershell/cmdlet_spec.rb +114 -0
- data/spec/integration/client/client_spec.rb +1 -1
- data/spec/integration/client/ipv6_spec.rb +1 -1
- data/spec/integration/knife/chef_fs_data_store_spec.rb +1 -1
- data/spec/integration/knife/chef_repo_path_spec.rb +1 -1
- data/spec/integration/knife/chef_repository_file_system_spec.rb +1 -1
- data/spec/integration/knife/chefignore_spec.rb +1 -1
- data/spec/integration/knife/common_options_spec.rb +1 -1
- data/spec/integration/knife/cookbook_api_ipv6_spec.rb +2 -2
- data/spec/integration/knife/delete_spec.rb +1 -1
- data/spec/integration/knife/deps_spec.rb +1 -1
- data/spec/integration/knife/diff_spec.rb +1 -1
- data/spec/integration/knife/download_spec.rb +1 -1
- data/spec/integration/knife/list_spec.rb +1 -1
- data/spec/integration/knife/raw_spec.rb +1 -1
- data/spec/integration/knife/redirection_spec.rb +1 -1
- data/spec/integration/knife/serve_spec.rb +1 -1
- data/spec/integration/knife/show_spec.rb +1 -1
- data/spec/integration/knife/upload_spec.rb +4 -3
- data/spec/integration/recipes/lwrp_inline_resources_spec.rb +1 -1
- data/spec/spec_helper.rb +15 -0
- data/spec/support/chef_helpers.rb +1 -0
- data/spec/support/lib/chef/provider/snakeoil.rb +1 -0
- data/spec/support/lib/chef/resource/zen_follower.rb +1 -7
- data/spec/support/platform_helpers.rb +28 -0
- data/spec/support/shared/functional/file_resource.rb +6 -0
- data/spec/support/shared/functional/windows_script.rb +118 -0
- data/spec/support/shared/integration/integration_helper.rb +5 -2
- data/spec/support/shared/matchers/exit_with_code.rb +28 -0
- data/spec/support/shared/matchers/match_environment_variable.rb +17 -0
- data/spec/support/shared/shared_examples.rb +14 -0
- data/spec/support/shared/unit/execute_resource.rb +0 -7
- data/spec/support/shared/unit/resource/static_provider_resolution.rb +71 -0
- data/spec/support/shared/unit/script_resource.rb +1 -1
- data/spec/support/shared/unit/windows_script_resource.rb +35 -2
- data/spec/tiny_server.rb +1 -2
- data/spec/unit/api_client_spec.rb +5 -1
- data/spec/unit/application/{apply.rb → apply_spec.rb} +13 -5
- data/spec/unit/application/client_spec.rb +106 -13
- data/spec/unit/application/solo_spec.rb +25 -1
- data/spec/unit/client_spec.rb +1 -26
- data/spec/unit/config_fetcher_spec.rb +2 -1
- data/spec/unit/config_spec.rb +91 -2
- data/spec/unit/cookbook/cookbook_version_loader_spec.rb +8 -0
- data/spec/unit/cookbook/metadata_spec.rb +43 -6
- data/spec/unit/cookbook/syntax_check_spec.rb +8 -2
- data/spec/unit/cookbook_loader_spec.rb +4 -2
- data/spec/unit/cookbook_version_spec.rb +83 -2
- data/spec/unit/data_bag_item_spec.rb +5 -1
- data/spec/unit/data_bag_spec.rb +6 -1
- data/spec/unit/dsl/data_query_spec.rb +8 -110
- data/spec/unit/encrypted_data_bag_item/check_encrypted_spec.rb +95 -0
- data/spec/unit/encrypted_data_bag_item_spec.rb +16 -23
- data/spec/unit/environment_spec.rb +6 -2
- data/spec/unit/exceptions_spec.rb +6 -0
- data/spec/unit/guard_interpreter/resource_guard_interpreter_spec.rb +16 -15
- data/spec/unit/json_compat_spec.rb +12 -2
- data/spec/unit/knife/bootstrap_spec.rb +16 -63
- data/spec/unit/knife/cookbook_site_share_spec.rb +59 -6
- data/spec/unit/knife/core/bootstrap_context_spec.rb +8 -37
- data/spec/unit/knife/core/subcommand_loader_spec.rb +1 -1
- data/spec/unit/knife/core/ui_spec.rb +28 -0
- data/spec/unit/knife/data_bag_create_spec.rb +63 -71
- data/spec/unit/knife/data_bag_edit_spec.rb +83 -49
- data/spec/unit/knife/data_bag_from_file_spec.rb +104 -126
- data/spec/unit/knife/data_bag_secret_options_spec.rb +165 -0
- data/spec/unit/knife/data_bag_show_spec.rb +74 -72
- data/spec/unit/knife/environment_from_file_spec.rb +3 -2
- data/spec/unit/knife/ssl_check_spec.rb +46 -1
- data/spec/unit/knife/status_spec.rb +1 -2
- data/spec/unit/knife_spec.rb +18 -1
- data/spec/unit/lwrp_spec.rb +29 -8
- data/spec/unit/mixin/homebrew_user_spec.rb +100 -0
- data/spec/unit/node_map_spec.rb +155 -0
- data/spec/unit/node_spec.rb +11 -0
- data/spec/unit/platform/query_helpers_spec.rb +23 -0
- data/spec/unit/platform_spec.rb +23 -0
- data/spec/unit/provider/breakpoint_spec.rb +9 -9
- data/spec/unit/provider/cookbook_file/content_spec.rb +3 -3
- data/spec/unit/provider/cookbook_file_spec.rb +1 -1
- data/spec/unit/provider/cron/unix_spec.rb +78 -60
- data/spec/unit/provider/cron_spec.rb +175 -175
- data/spec/unit/provider/deploy/revision_spec.rb +22 -21
- data/spec/unit/provider/deploy/timestamped_spec.rb +3 -3
- data/spec/unit/provider/deploy_spec.rb +231 -230
- data/spec/unit/provider/directory_spec.rb +55 -55
- data/spec/unit/provider/dsc_script_spec.rb +174 -0
- data/spec/unit/provider/env/windows_spec.rb +70 -34
- data/spec/unit/provider/env_spec.rb +95 -49
- data/spec/unit/provider/erl_call_spec.rb +9 -9
- data/spec/unit/provider/execute_spec.rb +43 -27
- data/spec/unit/provider/file/content_spec.rb +9 -9
- data/spec/unit/provider/file_spec.rb +1 -1
- data/spec/unit/provider/git_spec.rb +221 -159
- data/spec/unit/provider/group/dscl_spec.rb +64 -63
- data/spec/unit/provider/group/gpasswd_spec.rb +14 -14
- data/spec/unit/provider/group/groupadd_spec.rb +33 -33
- data/spec/unit/provider/group/groupmod_spec.rb +23 -23
- data/spec/unit/provider/group/pw_spec.rb +21 -21
- data/spec/unit/provider/group/usermod_spec.rb +20 -20
- data/spec/unit/provider/group/windows_spec.rb +15 -15
- data/spec/unit/provider/group_spec.rb +76 -76
- data/spec/unit/provider/http_request_spec.rb +30 -30
- data/spec/unit/provider/ifconfig/aix_spec.rb +20 -20
- data/spec/unit/provider/ifconfig/debian_spec.rb +25 -9
- data/spec/unit/provider/ifconfig/redhat_spec.rb +13 -13
- data/spec/unit/provider/ifconfig_spec.rb +43 -43
- data/spec/unit/provider/link_spec.rb +60 -60
- data/spec/unit/provider/log_spec.rb +0 -4
- data/spec/unit/provider/mdadm_spec.rb +23 -23
- data/spec/unit/provider/mount/aix_spec.rb +17 -17
- data/spec/unit/provider/mount/mount_spec.rb +115 -119
- data/spec/unit/provider/mount/solaris_spec.rb +72 -72
- data/spec/unit/provider/mount/windows_spec.rb +24 -24
- data/spec/unit/provider/ohai_spec.rb +11 -11
- data/spec/unit/provider/package/aix_spec.rb +34 -34
- data/spec/unit/provider/package/apt_spec.rb +36 -36
- data/spec/unit/provider/package/dpkg_spec.rb +27 -27
- data/spec/unit/provider/package/easy_install_spec.rb +16 -16
- data/spec/unit/provider/package/freebsd/pkg_spec.rb +53 -53
- data/spec/unit/provider/package/freebsd/pkgng_spec.rb +24 -24
- data/spec/unit/provider/package/freebsd/port_spec.rb +45 -35
- data/spec/unit/provider/package/homebrew_spec.rb +266 -0
- data/spec/unit/provider/package/ips_spec.rb +34 -34
- data/spec/unit/provider/package/macports_spec.rb +49 -49
- data/spec/unit/provider/package/pacman_spec.rb +35 -39
- data/spec/unit/provider/package/paludis_spec.rb +20 -20
- data/spec/unit/provider/package/portage_spec.rb +38 -38
- data/spec/unit/provider/package/rpm_spec.rb +29 -29
- data/spec/unit/provider/package/rubygems_spec.rb +284 -270
- data/spec/unit/provider/package/smartos_spec.rb +15 -15
- data/spec/unit/provider/package/solaris_spec.rb +35 -35
- data/spec/unit/provider/package/windows/msi_spec.rb +3 -3
- data/spec/unit/provider/package/windows_spec.rb +6 -6
- data/spec/unit/provider/package/yum_spec.rb +416 -416
- data/spec/unit/provider/package/zypper_spec.rb +47 -47
- data/spec/unit/provider/package_spec.rb +107 -107
- data/spec/unit/provider/powershell_spec.rb +1 -1
- data/spec/unit/provider/registry_key_spec.rb +61 -61
- data/spec/unit/provider/remote_directory_spec.rb +36 -36
- data/spec/unit/provider/remote_file/cache_control_data_spec.rb +24 -24
- data/spec/unit/provider/remote_file/content_spec.rb +45 -45
- data/spec/unit/provider/remote_file/fetcher_spec.rb +9 -9
- data/spec/unit/provider/remote_file/ftp_spec.rb +32 -32
- data/spec/unit/provider/remote_file/http_spec.rb +44 -44
- data/spec/unit/provider/remote_file/local_file_spec.rb +9 -9
- data/spec/unit/provider/remote_file_spec.rb +3 -3
- data/spec/unit/provider/route_spec.rb +63 -63
- data/spec/unit/provider/ruby_block_spec.rb +4 -4
- data/spec/unit/provider/script_spec.rb +12 -12
- data/spec/unit/provider/service/aix_service_spec.rb +181 -0
- data/spec/unit/provider/service/aixinit_service_spec.rb +269 -0
- data/spec/unit/provider/service/arch_service_spec.rb +48 -48
- data/spec/unit/provider/service/debian_service_spec.rb +40 -40
- data/spec/unit/provider/service/gentoo_service_spec.rb +28 -28
- data/spec/unit/provider/service/init_service_spec.rb +39 -39
- data/spec/unit/provider/service/insserv_service_spec.rb +8 -8
- data/spec/unit/provider/service/invokercd_service_spec.rb +35 -35
- data/spec/unit/provider/service/macosx_spec.rb +49 -49
- data/spec/unit/provider/service/redhat_spec.rb +27 -27
- data/spec/unit/provider/service/simple_service_spec.rb +28 -28
- data/spec/unit/provider/service/solaris_smf_service_spec.rb +43 -46
- data/spec/unit/provider/service/systemd_service_spec.rb +63 -63
- data/spec/unit/provider/service/upstart_service_spec.rb +78 -78
- data/spec/unit/provider/service/windows_spec.rb +92 -92
- data/spec/unit/provider/service_spec.rb +40 -40
- data/spec/unit/provider/subversion_spec.rb +80 -80
- data/spec/unit/provider/template/content_spec.rb +9 -9
- data/spec/unit/provider/template_spec.rb +6 -6
- data/spec/unit/provider/user/dscl_spec.rb +170 -167
- data/spec/unit/provider/user/pw_spec.rb +48 -48
- data/spec/unit/provider/user/solaris_spec.rb +8 -8
- data/spec/unit/provider/user/useradd_spec.rb +1 -1
- data/spec/unit/provider/user/windows_spec.rb +26 -26
- data/spec/unit/provider/user_spec.rb +72 -72
- data/spec/unit/provider/whyrun_safe_ruby_block_spec.rb +4 -4
- data/spec/unit/provider_resolver_spec.rb +387 -0
- data/spec/unit/recipe_spec.rb +33 -12
- data/spec/unit/resource/apt_package_spec.rb +10 -13
- data/spec/unit/resource/bash_spec.rb +4 -4
- data/spec/unit/resource/batch_spec.rb +1 -1
- data/spec/unit/resource/breakpoint_spec.rb +11 -7
- data/spec/unit/resource/chef_gem_spec.rb +8 -15
- data/spec/unit/resource/conditional_action_not_nothing_spec.rb +2 -2
- data/spec/unit/resource/conditional_spec.rb +35 -16
- data/spec/unit/resource/cookbook_file_spec.rb +13 -13
- data/spec/unit/resource/cron_spec.rb +37 -37
- data/spec/unit/resource/csh_spec.rb +4 -4
- data/spec/unit/resource/deploy_revision_spec.rb +13 -18
- data/spec/unit/resource/deploy_spec.rb +60 -55
- data/spec/unit/resource/directory_spec.rb +18 -18
- data/spec/unit/resource/dpkg_package_spec.rb +8 -14
- data/spec/unit/resource/dsc_script_spec.rb +98 -0
- data/spec/unit/resource/easy_install_package_spec.rb +9 -18
- data/spec/unit/resource/env_spec.rb +12 -12
- data/spec/unit/resource/erl_call_spec.rb +11 -11
- data/spec/unit/resource/execute_spec.rb +5 -0
- data/spec/unit/resource/file_spec.rb +29 -29
- data/spec/unit/resource/freebsd_package_spec.rb +11 -12
- data/spec/unit/resource/gem_package_spec.rb +8 -15
- data/spec/unit/resource/git_spec.rb +12 -8
- data/spec/unit/resource/group_spec.rb +27 -27
- data/spec/unit/resource/homebrew_package_spec.rb +50 -0
- data/spec/unit/resource/http_request_spec.rb +6 -6
- data/spec/unit/resource/ifconfig_spec.rb +8 -8
- data/spec/unit/resource/ips_package_spec.rb +10 -13
- data/spec/unit/resource/link_spec.rb +25 -25
- data/spec/unit/resource/log_spec.rb +9 -9
- data/spec/unit/resource/macports_package_spec.rb +8 -13
- data/spec/unit/resource/mdadm_spec.rb +18 -18
- data/spec/unit/resource/mount_spec.rb +45 -45
- data/spec/unit/resource/ohai_spec.rb +7 -7
- data/spec/unit/resource/package_spec.rb +12 -12
- data/spec/unit/resource/pacman_package_spec.rb +8 -14
- data/spec/unit/resource/perl_spec.rb +4 -4
- data/spec/unit/resource/portage_package_spec.rb +3 -3
- data/spec/unit/resource/powershell_spec.rb +7 -7
- data/spec/unit/resource/python_spec.rb +4 -4
- data/spec/unit/resource/registry_key_spec.rb +32 -32
- data/spec/unit/resource/remote_directory_spec.rb +17 -17
- data/spec/unit/resource/remote_file_spec.rb +41 -41
- data/spec/unit/resource/route_spec.rb +19 -19
- data/spec/unit/resource/rpm_package_spec.rb +9 -13
- data/spec/unit/resource/ruby_block_spec.rb +8 -8
- data/spec/unit/resource/ruby_spec.rb +4 -4
- data/spec/unit/resource/scm_spec.rb +40 -40
- data/spec/unit/resource/script_spec.rb +2 -2
- data/spec/unit/resource/service_spec.rb +37 -47
- data/spec/unit/resource/smartos_package_spec.rb +10 -15
- data/spec/unit/resource/solaris_package_spec.rb +13 -28
- data/spec/unit/resource/subversion_spec.rb +16 -12
- data/spec/unit/resource/template_spec.rb +35 -35
- data/spec/unit/resource/timestamped_deploy_spec.rb +30 -4
- data/spec/unit/resource/user_spec.rb +23 -23
- data/spec/unit/resource/windows_package_spec.rb +17 -10
- data/spec/unit/resource/windows_service_spec.rb +9 -6
- data/spec/unit/resource/yum_package_spec.rb +16 -21
- data/spec/unit/resource_collection/resource_list_spec.rb +137 -0
- data/spec/unit/resource_collection/resource_set_spec.rb +199 -0
- data/spec/unit/resource_collection_spec.rb +73 -92
- data/spec/unit/resource_definition_spec.rb +38 -40
- data/spec/unit/resource_reporter_spec.rb +3 -3
- data/spec/unit/resource_spec.rb +68 -33
- data/spec/unit/rest_spec.rb +83 -76
- data/spec/unit/role_spec.rb +5 -0
- data/spec/unit/run_list_spec.rb +5 -1
- data/spec/unit/runner_spec.rb +245 -238
- data/spec/unit/shell/shell_ext_spec.rb +1 -1
- data/spec/unit/user_spec.rb +5 -1
- data/spec/unit/util/dsc/configuration_generator_spec.rb +171 -0
- data/spec/unit/util/dsc/lcm_output_parser_spec.rb +169 -0
- data/spec/unit/util/dsc/local_configuration_manager_spec.rb +139 -0
- data/spec/unit/util/path_helper_spec.rb +23 -1
- data/spec/unit/util/powershell/cmdlet_spec.rb +106 -0
- data/spec/unit/workstation_config_loader_spec.rb +1 -1
- metadata +303 -196
- checksums.yaml +0 -7
- data/distro/README +0 -2
- data/distro/arch/etc/conf.d/chef-client.conf +0 -5
- data/distro/arch/etc/conf.d/chef-expander.conf +0 -8
- data/distro/arch/etc/conf.d/chef-server-webui.conf +0 -10
- data/distro/arch/etc/conf.d/chef-server.conf +0 -10
- data/distro/arch/etc/conf.d/chef-solr.conf +0 -8
- data/distro/arch/etc/rc.d/chef-client +0 -90
- data/distro/arch/etc/rc.d/chef-expander +0 -78
- data/distro/arch/etc/rc.d/chef-server +0 -78
- data/distro/arch/etc/rc.d/chef-server-webui +0 -78
- data/distro/arch/etc/rc.d/chef-solr +0 -78
- data/distro/debian/etc/default/chef-client +0 -4
- data/distro/debian/etc/default/chef-expander +0 -8
- data/distro/debian/etc/default/chef-server +0 -9
- data/distro/debian/etc/default/chef-server-webui +0 -9
- data/distro/debian/etc/default/chef-solr +0 -8
- data/distro/debian/etc/init.d/chef-client +0 -212
- data/distro/debian/etc/init.d/chef-expander +0 -176
- data/distro/debian/etc/init.d/chef-server +0 -122
- data/distro/debian/etc/init.d/chef-server-webui +0 -123
- data/distro/debian/etc/init.d/chef-solr +0 -176
- data/distro/debian/etc/init/chef-client.conf +0 -17
- data/distro/debian/etc/init/chef-expander.conf +0 -17
- data/distro/debian/etc/init/chef-server-webui.conf +0 -17
- data/distro/debian/etc/init/chef-server.conf +0 -17
- data/distro/debian/etc/init/chef-solr.conf +0 -17
- data/distro/redhat/etc/init.d/chef-client +0 -121
- data/distro/redhat/etc/init.d/chef-expander +0 -104
- data/distro/redhat/etc/init.d/chef-server +0 -112
- data/distro/redhat/etc/init.d/chef-server-webui +0 -112
- data/distro/redhat/etc/init.d/chef-solr +0 -104
- data/distro/redhat/etc/logrotate.d/chef-client +0 -8
- data/distro/redhat/etc/logrotate.d/chef-expander +0 -8
- data/distro/redhat/etc/logrotate.d/chef-server +0 -8
- data/distro/redhat/etc/logrotate.d/chef-server-webui +0 -8
- data/distro/redhat/etc/logrotate.d/chef-solr +0 -8
- data/distro/redhat/etc/sysconfig/chef-client +0 -15
- data/distro/redhat/etc/sysconfig/chef-expander +0 -7
- data/distro/redhat/etc/sysconfig/chef-server +0 -14
- data/distro/redhat/etc/sysconfig/chef-server-webui +0 -14
- data/distro/redhat/etc/sysconfig/chef-solr +0 -8
- data/distro/windows/service_manager.rb +0 -20
- data/lib/chef/resource_platform_map.rb +0 -151
- data/spec/support/shared/matchers.rb +0 -17
- data/spec/unit/resource_platform_map_spec.rb +0 -164
@@ -31,7 +31,7 @@ describe Chef::Provider::Package::SmartOS, "load_current_resource" do
|
|
31
31
|
|
32
32
|
@status = double("Status", :exitstatus => 0)
|
33
33
|
@provider = Chef::Provider::Package::SmartOS.new(@new_resource, @run_context)
|
34
|
-
Chef::Resource::Package.
|
34
|
+
allow(Chef::Resource::Package).to receive(:new).and_return(@current_resource)
|
35
35
|
@stdin = StringIO.new
|
36
36
|
@stdout = "varnish-2.1.5nb2\n"
|
37
37
|
@stderr = StringIO.new
|
@@ -42,28 +42,28 @@ describe Chef::Provider::Package::SmartOS, "load_current_resource" do
|
|
42
42
|
describe "when loading current resource" do
|
43
43
|
|
44
44
|
it "should create a current resource with the name of the new_resource" do
|
45
|
-
@provider.
|
46
|
-
Chef::Resource::Package.
|
45
|
+
expect(@provider).to receive(:shell_out!).and_return(@shell_out)
|
46
|
+
expect(Chef::Resource::Package).to receive(:new).and_return(@current_resource)
|
47
47
|
@provider.load_current_resource
|
48
48
|
end
|
49
49
|
|
50
50
|
it "should set the current resource package name" do
|
51
|
-
@provider.
|
52
|
-
@current_resource.
|
51
|
+
expect(@provider).to receive(:shell_out!).and_return(@shell_out)
|
52
|
+
expect(@current_resource).to receive(:package_name).with(@new_resource.package_name)
|
53
53
|
@provider.load_current_resource
|
54
54
|
end
|
55
55
|
|
56
56
|
it "should set the installed version if it is installed" do
|
57
|
-
@provider.
|
57
|
+
expect(@provider).to receive(:shell_out!).and_return(@shell_out)
|
58
58
|
@provider.load_current_resource
|
59
|
-
@current_resource.version.
|
59
|
+
expect(@current_resource.version).to eq("2.1.5nb2")
|
60
60
|
end
|
61
61
|
|
62
62
|
it "should set the installed version to nil if it's not installed" do
|
63
63
|
out = OpenStruct.new(:stdout => nil)
|
64
|
-
@provider.
|
64
|
+
expect(@provider).to receive(:shell_out!).and_return(out)
|
65
65
|
@provider.load_current_resource
|
66
|
-
@current_resource.version.
|
66
|
+
expect(@current_resource.version).to eq(nil)
|
67
67
|
end
|
68
68
|
|
69
69
|
|
@@ -72,18 +72,18 @@ describe Chef::Provider::Package::SmartOS, "load_current_resource" do
|
|
72
72
|
describe "candidate_version" do
|
73
73
|
it "should return the candidate_version variable if already setup" do
|
74
74
|
@provider.candidate_version = "2.1.1"
|
75
|
-
@provider.
|
75
|
+
expect(@provider).not_to receive(:shell_out!)
|
76
76
|
@provider.candidate_version
|
77
77
|
end
|
78
78
|
|
79
79
|
it "should lookup the candidate_version if the variable is not already set" do
|
80
80
|
search = double()
|
81
|
-
search.
|
81
|
+
expect(search).to receive(:each_line).
|
82
82
|
and_yield("something-varnish-1.1.1 something varnish like\n").
|
83
83
|
and_yield("varnish-2.3.4 actual varnish\n")
|
84
84
|
@shell_out = double('shell_out!', :stdout => search)
|
85
|
-
@provider.
|
86
|
-
@provider.candidate_version.
|
85
|
+
expect(@provider).to receive(:shell_out!).with('/opt/local/bin/pkgin se varnish', :env => nil, :returns => [0,1]).and_return(@shell_out)
|
86
|
+
expect(@provider.candidate_version).to eq("2.3.4")
|
87
87
|
end
|
88
88
|
end
|
89
89
|
|
@@ -91,8 +91,8 @@ describe Chef::Provider::Package::SmartOS, "load_current_resource" do
|
|
91
91
|
|
92
92
|
it "run pkgin and install the package" do
|
93
93
|
out = OpenStruct.new(:stdout => nil)
|
94
|
-
@provider.
|
95
|
-
@provider.
|
94
|
+
expect(@provider).to receive(:shell_out!).with("/opt/local/sbin/pkg_info -E \"varnish*\"", {:env => nil, :returns=>[0,1]}).and_return(@shell_out)
|
95
|
+
expect(@provider).to receive(:shell_out!).with("/opt/local/bin/pkgin -y install varnish-2.1.5nb2", {:env=>nil}).and_return(out)
|
96
96
|
@provider.load_current_resource
|
97
97
|
@provider.install_package("varnish", "2.1.5nb2")
|
98
98
|
end
|
@@ -27,7 +27,7 @@ describe Chef::Provider::Package::Solaris do
|
|
27
27
|
@new_resource.source("/tmp/bash.pkg")
|
28
28
|
|
29
29
|
@provider = Chef::Provider::Package::Solaris.new(@new_resource, @run_context)
|
30
|
-
::File.
|
30
|
+
allow(::File).to receive(:exists?).and_return(true)
|
31
31
|
end
|
32
32
|
|
33
33
|
describe "assessing the current package status" do
|
@@ -50,119 +50,119 @@ PKGINFO
|
|
50
50
|
end
|
51
51
|
|
52
52
|
it "should create a current resource with the name of new_resource" do
|
53
|
-
@provider.
|
53
|
+
allow(@provider).to receive(:popen4).and_return(@status)
|
54
54
|
@provider.load_current_resource
|
55
|
-
@provider.current_resource.name.
|
55
|
+
expect(@provider.current_resource.name).to eq("SUNWbash")
|
56
56
|
end
|
57
57
|
|
58
58
|
it "should set the current reource package name to the new resource package name" do
|
59
|
-
@provider.
|
59
|
+
allow(@provider).to receive(:popen4).and_return(@status)
|
60
60
|
@provider.load_current_resource
|
61
|
-
@provider.current_resource.package_name.
|
61
|
+
expect(@provider.current_resource.package_name).to eq("SUNWbash")
|
62
62
|
end
|
63
63
|
|
64
64
|
it "should raise an exception if a source is supplied but not found" do
|
65
|
-
@provider.
|
66
|
-
::File.
|
65
|
+
allow(@provider).to receive(:popen4).and_return(@status)
|
66
|
+
allow(::File).to receive(:exists?).and_return(false)
|
67
67
|
@provider.define_resource_requirements
|
68
68
|
@provider.load_current_resource
|
69
|
-
|
69
|
+
expect { @provider.process_resource_requirements }.to raise_error(Chef::Exceptions::Package)
|
70
70
|
end
|
71
71
|
|
72
72
|
it "should get the source package version from pkginfo if provided" do
|
73
73
|
@stdout = StringIO.new(@pkginfo)
|
74
74
|
@stdin, @stderr = StringIO.new, StringIO.new
|
75
|
-
@provider.
|
76
|
-
@provider.
|
75
|
+
expect(@provider).to receive(:popen4).with("pkginfo -l -d /tmp/bash.pkg SUNWbash").and_yield(@pid, @stdin, @stdout, @stderr).and_return(@status)
|
76
|
+
expect(@provider).to receive(:popen4).with("pkginfo -l SUNWbash").and_return(@status)
|
77
77
|
@provider.load_current_resource
|
78
78
|
|
79
|
-
@provider.current_resource.package_name.
|
80
|
-
@new_resource.version.
|
79
|
+
expect(@provider.current_resource.package_name).to eq("SUNWbash")
|
80
|
+
expect(@new_resource.version).to eq("11.10.0,REV=2005.01.08.05.16")
|
81
81
|
end
|
82
82
|
|
83
83
|
it "should return the current version installed if found by pkginfo" do
|
84
84
|
@stdout = StringIO.new(@pkginfo)
|
85
85
|
@stdin, @stderr = StringIO.new, StringIO.new
|
86
|
-
@provider.
|
87
|
-
@provider.
|
86
|
+
expect(@provider).to receive(:popen4).with("pkginfo -l -d /tmp/bash.pkg SUNWbash").and_return(@status)
|
87
|
+
expect(@provider).to receive(:popen4).with("pkginfo -l SUNWbash").and_yield(@pid, @stdin, @stdout, @stderr).and_return(@status)
|
88
88
|
@provider.load_current_resource
|
89
|
-
@provider.current_resource.version.
|
89
|
+
expect(@provider.current_resource.version).to eq("11.10.0,REV=2005.01.08.05.16")
|
90
90
|
end
|
91
91
|
|
92
92
|
it "should raise an exception if the source is not set but we are installing" do
|
93
93
|
@new_resource = Chef::Resource::Package.new("SUNWbash")
|
94
94
|
@provider = Chef::Provider::Package::Solaris.new(@new_resource, @run_context)
|
95
|
-
@provider.
|
96
|
-
|
95
|
+
allow(@provider).to receive(:popen4).and_return(@status)
|
96
|
+
expect { @provider.run_action(:install) }.to raise_error(Chef::Exceptions::Package)
|
97
97
|
end
|
98
98
|
|
99
99
|
it "should raise an exception if pkginfo fails to run" do
|
100
100
|
@status = double("Status", :exitstatus => -1)
|
101
|
-
@provider.
|
102
|
-
|
101
|
+
allow(@provider).to receive(:popen4).and_return(@status)
|
102
|
+
expect { @provider.load_current_resource }.to raise_error(Chef::Exceptions::Package)
|
103
103
|
end
|
104
104
|
|
105
105
|
it "should return a current resource with a nil version if the package is not found" do
|
106
106
|
@stdout = StringIO.new
|
107
|
-
@provider.
|
108
|
-
@provider.
|
107
|
+
expect(@provider).to receive(:popen4).with("pkginfo -l -d /tmp/bash.pkg SUNWbash").and_return(@status)
|
108
|
+
expect(@provider).to receive(:popen4).with("pkginfo -l SUNWbash").and_yield(@pid, @stdin, @stdout, @stderr).and_return(@status)
|
109
109
|
@provider.load_current_resource
|
110
|
-
@provider.current_resource.version.
|
110
|
+
expect(@provider.current_resource.version).to be_nil
|
111
111
|
end
|
112
112
|
end
|
113
113
|
|
114
114
|
describe "candidate_version" do
|
115
115
|
it "should return the candidate_version variable if already setup" do
|
116
116
|
@provider.candidate_version = "11.10.0,REV=2005.01.08.05.16"
|
117
|
-
@provider.
|
117
|
+
expect(@provider).not_to receive(:popen4)
|
118
118
|
@provider.candidate_version
|
119
119
|
end
|
120
120
|
|
121
121
|
it "should lookup the candidate_version if the variable is not already set" do
|
122
122
|
@status = double("Status", :exitstatus => 0)
|
123
|
-
@provider.
|
124
|
-
@provider.
|
123
|
+
allow(@provider).to receive(:popen4).and_return(@status)
|
124
|
+
expect(@provider).to receive(:popen4)
|
125
125
|
@provider.candidate_version
|
126
126
|
end
|
127
127
|
|
128
128
|
it "should throw and exception if the exitstatus is not 0" do
|
129
129
|
@status = double("Status", :exitstatus => 1)
|
130
|
-
@provider.
|
131
|
-
|
130
|
+
allow(@provider).to receive(:popen4).and_return(@status)
|
131
|
+
expect { @provider.candidate_version }.to raise_error(Chef::Exceptions::Package)
|
132
132
|
end
|
133
133
|
|
134
134
|
end
|
135
135
|
|
136
136
|
describe "install and upgrade" do
|
137
137
|
it "should run pkgadd -n -d with the package source to install" do
|
138
|
-
@provider.
|
138
|
+
expect(@provider).to receive(:shell_out!).with("pkgadd -n -d /tmp/bash.pkg all")
|
139
139
|
@provider.install_package("SUNWbash", "11.10.0,REV=2005.01.08.05.16")
|
140
140
|
end
|
141
141
|
|
142
142
|
it "should run pkgadd -n -d when the package is a path to install" do
|
143
143
|
@new_resource = Chef::Resource::Package.new("/tmp/bash.pkg")
|
144
144
|
@provider = Chef::Provider::Package::Solaris.new(@new_resource, @run_context)
|
145
|
-
@new_resource.source.
|
146
|
-
@provider.
|
145
|
+
expect(@new_resource.source).to eq("/tmp/bash.pkg")
|
146
|
+
expect(@provider).to receive(:shell_out!).with("pkgadd -n -d /tmp/bash.pkg all")
|
147
147
|
@provider.install_package("/tmp/bash.pkg", "11.10.0,REV=2005.01.08.05.16")
|
148
148
|
end
|
149
149
|
|
150
150
|
it "should run pkgadd -n -a /tmp/myadmin -d with the package options -a /tmp/myadmin" do
|
151
|
-
@new_resource.
|
152
|
-
@provider.
|
151
|
+
allow(@new_resource).to receive(:options).and_return("-a /tmp/myadmin")
|
152
|
+
expect(@provider).to receive(:shell_out!).with("pkgadd -n -a /tmp/myadmin -d /tmp/bash.pkg all")
|
153
153
|
@provider.install_package("SUNWbash", "11.10.0,REV=2005.01.08.05.16")
|
154
154
|
end
|
155
155
|
end
|
156
156
|
|
157
157
|
describe "remove" do
|
158
158
|
it "should run pkgrm -n to remove the package" do
|
159
|
-
@provider.
|
159
|
+
expect(@provider).to receive(:shell_out!).with("pkgrm -n SUNWbash")
|
160
160
|
@provider.remove_package("SUNWbash", "11.10.0,REV=2005.01.08.05.16")
|
161
161
|
end
|
162
162
|
|
163
163
|
it "should run pkgrm -n -a /tmp/myadmin with options -a /tmp/myadmin" do
|
164
|
-
@new_resource.
|
165
|
-
@provider.
|
164
|
+
allow(@new_resource).to receive(:options).and_return("-a /tmp/myadmin")
|
165
|
+
expect(@provider).to receive(:shell_out!).with("pkgrm -n -a /tmp/myadmin SUNWbash")
|
166
166
|
@provider.remove_package("SUNWbash", "11.10.0,REV=2005.01.08.05.16")
|
167
167
|
end
|
168
168
|
|
@@ -37,15 +37,15 @@ describe Chef::Provider::Package::Windows::MSI, :windows_only do
|
|
37
37
|
|
38
38
|
describe "installed_version" do
|
39
39
|
it "returns the installed version" do
|
40
|
-
provider.
|
41
|
-
provider.
|
40
|
+
allow(provider).to receive(:get_product_property).and_return("{23170F69-40C1-2702-0920-000001000000}")
|
41
|
+
allow(provider).to receive(:get_installed_version).with("{23170F69-40C1-2702-0920-000001000000}").and_return("3.14159.1337.42")
|
42
42
|
expect(provider.installed_version).to eql("3.14159.1337.42")
|
43
43
|
end
|
44
44
|
end
|
45
45
|
|
46
46
|
describe "package_version" do
|
47
47
|
it "returns the version of a package" do
|
48
|
-
provider.
|
48
|
+
allow(provider).to receive(:get_product_property).with(/calculator.msi$/, "ProductVersion").and_return(42)
|
49
49
|
expect(provider.package_version).to eql(42)
|
50
50
|
end
|
51
51
|
end
|
@@ -27,8 +27,8 @@ describe Chef::Provider::Package::Windows, :windows_only do
|
|
27
27
|
|
28
28
|
describe "load_current_resource" do
|
29
29
|
before(:each) do
|
30
|
-
Chef::Util::PathHelper.
|
31
|
-
provider.
|
30
|
+
allow(Chef::Util::PathHelper).to receive(:validate_path)
|
31
|
+
allow(provider).to receive(:package_provider).and_return(double('package_provider',
|
32
32
|
:installed_version => "1.0", :package_version => "2.0"))
|
33
33
|
end
|
34
34
|
|
@@ -56,20 +56,20 @@ describe Chef::Provider::Package::Windows, :windows_only do
|
|
56
56
|
|
57
57
|
describe "package_provider" do
|
58
58
|
it "sets the package provider to MSI if the the installer type is :msi" do
|
59
|
-
provider.
|
59
|
+
allow(provider).to receive(:installer_type).and_return(:msi)
|
60
60
|
expect(provider.package_provider).to be_a(Chef::Provider::Package::Windows::MSI)
|
61
61
|
end
|
62
62
|
|
63
63
|
it "raises an error if the installer_type is unknown" do
|
64
|
-
provider.
|
64
|
+
allow(provider).to receive(:installer_type).and_return(:apt_for_windows)
|
65
65
|
expect { provider.package_provider }.to raise_error
|
66
66
|
end
|
67
67
|
end
|
68
68
|
|
69
69
|
describe "installer_type" do
|
70
70
|
it "it returns @installer_type if it is set" do
|
71
|
-
provider.new_resource.installer_type(
|
72
|
-
expect(provider.installer_type).to eql(
|
71
|
+
provider.new_resource.installer_type(:downeaster)
|
72
|
+
expect(provider.installer_type).to eql(:downeaster)
|
73
73
|
end
|
74
74
|
|
75
75
|
it "sets installer_type to msi if the source ends in .msi" do
|
@@ -37,7 +37,7 @@ describe Chef::Provider::Package::Yum do
|
|
37
37
|
:package_repository => "base",
|
38
38
|
:disable_extra_repo_control => true
|
39
39
|
)
|
40
|
-
Chef::Provider::Package::Yum::YumCache.
|
40
|
+
allow(Chef::Provider::Package::Yum::YumCache).to receive(:instance).and_return(@yum_cache)
|
41
41
|
@provider = Chef::Provider::Package::Yum.new(@new_resource, @run_context)
|
42
42
|
@pid = double("PID")
|
43
43
|
end
|
@@ -45,32 +45,32 @@ describe Chef::Provider::Package::Yum do
|
|
45
45
|
describe "when loading the current system state" do
|
46
46
|
it "should create a current resource with the name of the new_resource" do
|
47
47
|
@provider.load_current_resource
|
48
|
-
@provider.current_resource.name.
|
48
|
+
expect(@provider.current_resource.name).to eq("cups")
|
49
49
|
end
|
50
50
|
|
51
51
|
it "should set the current resources package name to the new resources package name" do
|
52
52
|
@provider.load_current_resource
|
53
|
-
@provider.current_resource.package_name.
|
53
|
+
expect(@provider.current_resource.package_name).to eq("cups")
|
54
54
|
end
|
55
55
|
|
56
56
|
it "should set the installed version to nil on the current resource if no installed package" do
|
57
|
-
@yum_cache.
|
57
|
+
allow(@yum_cache).to receive(:installed_version).and_return(nil)
|
58
58
|
@provider.load_current_resource
|
59
|
-
@provider.current_resource.version.
|
59
|
+
expect(@provider.current_resource.version).to be_nil
|
60
60
|
end
|
61
61
|
|
62
62
|
it "should set the installed version if yum has one" do
|
63
63
|
@provider.load_current_resource
|
64
|
-
@provider.current_resource.version.
|
64
|
+
expect(@provider.current_resource.version).to eq("1.2.4-11.18.el5")
|
65
65
|
end
|
66
66
|
|
67
67
|
it "should set the candidate version if yum info has one" do
|
68
68
|
@provider.load_current_resource
|
69
|
-
@provider.candidate_version.
|
69
|
+
expect(@provider.candidate_version).to eql("1.2.4-11.18.el5_2.3")
|
70
70
|
end
|
71
71
|
|
72
72
|
it "should return the current resouce" do
|
73
|
-
@provider.load_current_resource.
|
73
|
+
expect(@provider.load_current_resource).to eql(@provider.current_resource)
|
74
74
|
end
|
75
75
|
|
76
76
|
describe "when arch in package_name" do
|
@@ -79,11 +79,11 @@ describe Chef::Provider::Package::Yum do
|
|
79
79
|
@yum_cache = double(
|
80
80
|
'Chef::Provider::Yum::YumCache'
|
81
81
|
)
|
82
|
-
@yum_cache.
|
82
|
+
allow(@yum_cache).to receive(:installed_version) do |package_name, arch|
|
83
83
|
# nothing installed for package_name/new_package_name
|
84
84
|
nil
|
85
85
|
end
|
86
|
-
@yum_cache.
|
86
|
+
allow(@yum_cache).to receive(:candidate_version) do |package_name, arch|
|
87
87
|
if package_name == "testing.noarch" || package_name == "testing.more.noarch"
|
88
88
|
nil
|
89
89
|
# candidate for new_package_name
|
@@ -91,21 +91,21 @@ describe Chef::Provider::Package::Yum do
|
|
91
91
|
"1.1"
|
92
92
|
end
|
93
93
|
end
|
94
|
-
@yum_cache.
|
95
|
-
@yum_cache.
|
96
|
-
Chef::Provider::Package::Yum::YumCache.
|
94
|
+
allow(@yum_cache).to receive(:package_available?).and_return(true)
|
95
|
+
allow(@yum_cache).to receive(:disable_extra_repo_control).and_return(true)
|
96
|
+
allow(Chef::Provider::Package::Yum::YumCache).to receive(:instance).and_return(@yum_cache)
|
97
97
|
@provider = Chef::Provider::Package::Yum.new(@new_resource, @run_context)
|
98
98
|
@provider.load_current_resource
|
99
|
-
@provider.new_resource.package_name.
|
100
|
-
@provider.new_resource.arch.
|
101
|
-
@provider.arch.
|
99
|
+
expect(@provider.new_resource.package_name).to eq("testing")
|
100
|
+
expect(@provider.new_resource.arch).to eq("noarch")
|
101
|
+
expect(@provider.arch).to eq("noarch")
|
102
102
|
|
103
103
|
@new_resource = Chef::Resource::YumPackage.new('testing.more.noarch')
|
104
104
|
@provider = Chef::Provider::Package::Yum.new(@new_resource, @run_context)
|
105
105
|
@provider.load_current_resource
|
106
|
-
@provider.new_resource.package_name.
|
107
|
-
@provider.new_resource.arch.
|
108
|
-
@provider.arch.
|
106
|
+
expect(@provider.new_resource.package_name).to eq("testing.more")
|
107
|
+
expect(@provider.new_resource.arch).to eq("noarch")
|
108
|
+
expect(@provider.arch).to eq("noarch")
|
109
109
|
end
|
110
110
|
|
111
111
|
it "should not set the arch when an existing package_name is found" do
|
@@ -113,7 +113,7 @@ describe Chef::Provider::Package::Yum do
|
|
113
113
|
@yum_cache = double(
|
114
114
|
'Chef::Provider::Yum::YumCache'
|
115
115
|
)
|
116
|
-
@yum_cache.
|
116
|
+
allow(@yum_cache).to receive(:installed_version) do |package_name, arch|
|
117
117
|
# installed for package_name
|
118
118
|
if package_name == "testing.beta3" || package_name == "testing.beta3.more"
|
119
119
|
"1.1"
|
@@ -121,26 +121,26 @@ describe Chef::Provider::Package::Yum do
|
|
121
121
|
nil
|
122
122
|
end
|
123
123
|
end
|
124
|
-
@yum_cache.
|
124
|
+
allow(@yum_cache).to receive(:candidate_version) do |package_name, arch|
|
125
125
|
# no candidate for package_name/new_package_name
|
126
126
|
nil
|
127
127
|
end
|
128
|
-
@yum_cache.
|
129
|
-
@yum_cache.
|
130
|
-
Chef::Provider::Package::Yum::YumCache.
|
128
|
+
allow(@yum_cache).to receive(:package_available?).and_return(true)
|
129
|
+
allow(@yum_cache).to receive(:disable_extra_repo_control).and_return(true)
|
130
|
+
allow(Chef::Provider::Package::Yum::YumCache).to receive(:instance).and_return(@yum_cache)
|
131
131
|
@provider = Chef::Provider::Package::Yum.new(@new_resource, @run_context)
|
132
132
|
# annoying side effect of the fun stub'ing above
|
133
133
|
@provider.load_current_resource
|
134
|
-
@provider.new_resource.package_name.
|
135
|
-
@provider.new_resource.arch.
|
136
|
-
@provider.arch.
|
134
|
+
expect(@provider.new_resource.package_name).to eq("testing.beta3")
|
135
|
+
expect(@provider.new_resource.arch).to eq(nil)
|
136
|
+
expect(@provider.arch).to eq(nil)
|
137
137
|
|
138
138
|
@new_resource = Chef::Resource::YumPackage.new('testing.beta3.more')
|
139
139
|
@provider = Chef::Provider::Package::Yum.new(@new_resource, @run_context)
|
140
140
|
@provider.load_current_resource
|
141
|
-
@provider.new_resource.package_name.
|
142
|
-
@provider.new_resource.arch.
|
143
|
-
@provider.arch.
|
141
|
+
expect(@provider.new_resource.package_name).to eq("testing.beta3.more")
|
142
|
+
expect(@provider.new_resource.arch).to eq(nil)
|
143
|
+
expect(@provider.arch).to eq(nil)
|
144
144
|
end
|
145
145
|
|
146
146
|
it "should not set the arch when no existing package_name or new_package_name+new_arch is found" do
|
@@ -148,29 +148,29 @@ describe Chef::Provider::Package::Yum do
|
|
148
148
|
@yum_cache = double(
|
149
149
|
'Chef::Provider::Yum::YumCache'
|
150
150
|
)
|
151
|
-
@yum_cache.
|
151
|
+
allow(@yum_cache).to receive(:installed_version) do |package_name, arch|
|
152
152
|
# nothing installed for package_name/new_package_name
|
153
153
|
nil
|
154
154
|
end
|
155
|
-
@yum_cache.
|
155
|
+
allow(@yum_cache).to receive(:candidate_version) do |package_name, arch|
|
156
156
|
# no candidate for package_name/new_package_name
|
157
157
|
nil
|
158
158
|
end
|
159
|
-
@yum_cache.
|
160
|
-
@yum_cache.
|
161
|
-
Chef::Provider::Package::Yum::YumCache.
|
159
|
+
allow(@yum_cache).to receive(:package_available?).and_return(true)
|
160
|
+
allow(@yum_cache).to receive(:disable_extra_repo_control).and_return(true)
|
161
|
+
allow(Chef::Provider::Package::Yum::YumCache).to receive(:instance).and_return(@yum_cache)
|
162
162
|
@provider = Chef::Provider::Package::Yum.new(@new_resource, @run_context)
|
163
163
|
@provider.load_current_resource
|
164
|
-
@provider.new_resource.package_name.
|
165
|
-
@provider.new_resource.arch.
|
166
|
-
@provider.arch.
|
164
|
+
expect(@provider.new_resource.package_name).to eq("testing.beta3")
|
165
|
+
expect(@provider.new_resource.arch).to eq(nil)
|
166
|
+
expect(@provider.arch).to eq(nil)
|
167
167
|
|
168
168
|
@new_resource = Chef::Resource::YumPackage.new('testing.beta3.more')
|
169
169
|
@provider = Chef::Provider::Package::Yum.new(@new_resource, @run_context)
|
170
170
|
@provider.load_current_resource
|
171
|
-
@provider.new_resource.package_name.
|
172
|
-
@provider.new_resource.arch.
|
173
|
-
@provider.arch.
|
171
|
+
expect(@provider.new_resource.package_name).to eq("testing.beta3.more")
|
172
|
+
expect(@provider.new_resource.arch).to eq(nil)
|
173
|
+
expect(@provider.arch).to eq(nil)
|
174
174
|
end
|
175
175
|
|
176
176
|
it "should ensure it doesn't clobber an existing arch if passed" do
|
@@ -179,11 +179,11 @@ describe Chef::Provider::Package::Yum do
|
|
179
179
|
@yum_cache = double(
|
180
180
|
'Chef::Provider::Yum::YumCache'
|
181
181
|
)
|
182
|
-
@yum_cache.
|
182
|
+
allow(@yum_cache).to receive(:installed_version) do |package_name, arch|
|
183
183
|
# nothing installed for package_name/new_package_name
|
184
184
|
nil
|
185
185
|
end
|
186
|
-
@yum_cache.
|
186
|
+
allow(@yum_cache).to receive(:candidate_version) do |package_name, arch|
|
187
187
|
if package_name == "testing.noarch"
|
188
188
|
nil
|
189
189
|
# candidate for new_package_name
|
@@ -191,43 +191,43 @@ describe Chef::Provider::Package::Yum do
|
|
191
191
|
"1.1"
|
192
192
|
end
|
193
193
|
end.and_return("something")
|
194
|
-
@yum_cache.
|
195
|
-
@yum_cache.
|
196
|
-
Chef::Provider::Package::Yum::YumCache.
|
194
|
+
allow(@yum_cache).to receive(:package_available?).and_return(true)
|
195
|
+
allow(@yum_cache).to receive(:disable_extra_repo_control).and_return(true)
|
196
|
+
allow(Chef::Provider::Package::Yum::YumCache).to receive(:instance).and_return(@yum_cache)
|
197
197
|
@provider = Chef::Provider::Package::Yum.new(@new_resource, @run_context)
|
198
198
|
@provider.load_current_resource
|
199
|
-
@provider.new_resource.package_name.
|
200
|
-
@provider.new_resource.arch.
|
199
|
+
expect(@provider.new_resource.package_name).to eq("testing.i386")
|
200
|
+
expect(@provider.new_resource.arch).to eq("x86_64")
|
201
201
|
end
|
202
202
|
end
|
203
203
|
|
204
204
|
it "should flush the cache if :before is true" do
|
205
|
-
@new_resource.
|
206
|
-
@yum_cache.
|
205
|
+
allow(@new_resource).to receive(:flush_cache).and_return({:after => false, :before => true})
|
206
|
+
expect(@yum_cache).to receive(:reload).once
|
207
207
|
@provider.load_current_resource
|
208
208
|
end
|
209
209
|
|
210
210
|
it "should flush the cache if :before is false" do
|
211
|
-
@new_resource.
|
212
|
-
@yum_cache.
|
211
|
+
allow(@new_resource).to receive(:flush_cache).and_return({:after => false, :before => false})
|
212
|
+
expect(@yum_cache).not_to receive(:reload)
|
213
213
|
@provider.load_current_resource
|
214
214
|
end
|
215
215
|
|
216
216
|
it "should detect --enablerepo or --disablerepo when passed among options, collect them preserving order and notify the yum cache" do
|
217
|
-
@new_resource.
|
218
|
-
@yum_cache.
|
217
|
+
allow(@new_resource).to receive(:options).and_return("--stuff --enablerepo=foo --otherthings --disablerepo=a,b,c --enablerepo=bar")
|
218
|
+
expect(@yum_cache).to receive(:enable_extra_repo_control).with("--enablerepo=foo --disablerepo=a,b,c --enablerepo=bar")
|
219
219
|
@provider.load_current_resource
|
220
220
|
end
|
221
221
|
|
222
222
|
it "should let the yum cache know extra repos are disabled if --enablerepo or --disablerepo aren't among options" do
|
223
|
-
@new_resource.
|
224
|
-
@yum_cache.
|
223
|
+
allow(@new_resource).to receive(:options).and_return("--stuff --otherthings")
|
224
|
+
expect(@yum_cache).to receive(:disable_extra_repo_control)
|
225
225
|
@provider.load_current_resource
|
226
226
|
end
|
227
227
|
|
228
228
|
it "should let the yum cache know extra repos are disabled if options aren't set" do
|
229
|
-
@new_resource.
|
230
|
-
@yum_cache.
|
229
|
+
allow(@new_resource).to receive(:options).and_return(nil)
|
230
|
+
expect(@yum_cache).to receive(:disable_extra_repo_control)
|
231
231
|
@provider.load_current_resource
|
232
232
|
end
|
233
233
|
|
@@ -242,12 +242,12 @@ describe Chef::Provider::Package::Yum do
|
|
242
242
|
:version_available? => true,
|
243
243
|
:disable_extra_repo_control => true
|
244
244
|
)
|
245
|
-
Chef::Provider::Package::Yum::YumCache.
|
245
|
+
allow(Chef::Provider::Package::Yum::YumCache).to receive(:instance).and_return(@yum_cache)
|
246
246
|
pkg = Chef::Provider::Package::Yum::RPMPackage.new("test-package", "1.2.4-11.18.el5", "x86_64", [])
|
247
|
-
@yum_cache.
|
247
|
+
expect(@yum_cache).to receive(:packages_from_require).and_return([pkg])
|
248
248
|
@provider = Chef::Provider::Package::Yum.new(@new_resource, @run_context)
|
249
249
|
@provider.load_current_resource
|
250
|
-
@new_resource.package_name.
|
250
|
+
expect(@new_resource.package_name).to eq("test-package")
|
251
251
|
end
|
252
252
|
|
253
253
|
it "should search provides if package name can't be found, warn about multiple matches, but use the first one" do
|
@@ -261,14 +261,14 @@ describe Chef::Provider::Package::Yum do
|
|
261
261
|
:version_available? => true,
|
262
262
|
:disable_extra_repo_control => true
|
263
263
|
)
|
264
|
-
Chef::Provider::Package::Yum::YumCache.
|
264
|
+
allow(Chef::Provider::Package::Yum::YumCache).to receive(:instance).and_return(@yum_cache)
|
265
265
|
pkg_x = Chef::Provider::Package::Yum::RPMPackage.new("test-package-x", "1.2.4-11.18.el5", "x86_64", [])
|
266
266
|
pkg_y = Chef::Provider::Package::Yum::RPMPackage.new("test-package-y", "1.2.6-11.3.el5", "i386", [])
|
267
|
-
@yum_cache.
|
268
|
-
Chef::Log.
|
267
|
+
expect(@yum_cache).to receive(:packages_from_require).and_return([pkg_x, pkg_y])
|
268
|
+
expect(Chef::Log).to receive(:warn).exactly(1).times.with(%r{matched multiple Provides})
|
269
269
|
@provider = Chef::Provider::Package::Yum.new(@new_resource, @run_context)
|
270
270
|
@provider.load_current_resource
|
271
|
-
@new_resource.package_name.
|
271
|
+
expect(@new_resource.package_name).to eq("test-package-x")
|
272
272
|
end
|
273
273
|
|
274
274
|
it "should search provides if no package is available - if no match in installed provides then load the complete set" do
|
@@ -282,9 +282,9 @@ describe Chef::Provider::Package::Yum do
|
|
282
282
|
:version_available? => true,
|
283
283
|
:disable_extra_repo_control => true
|
284
284
|
)
|
285
|
-
Chef::Provider::Package::Yum::YumCache.
|
286
|
-
@yum_cache.
|
287
|
-
@yum_cache.
|
285
|
+
allow(Chef::Provider::Package::Yum::YumCache).to receive(:instance).and_return(@yum_cache)
|
286
|
+
expect(@yum_cache).to receive(:packages_from_require).twice.and_return([])
|
287
|
+
expect(@yum_cache).to receive(:reload_provides)
|
288
288
|
@provider = Chef::Provider::Package::Yum.new(@new_resource, @run_context)
|
289
289
|
@provider.load_current_resource
|
290
290
|
end
|
@@ -300,14 +300,14 @@ describe Chef::Provider::Package::Yum do
|
|
300
300
|
:version_available? => true,
|
301
301
|
:disable_extra_repo_control => true
|
302
302
|
)
|
303
|
-
Chef::Provider::Package::Yum::YumCache.
|
303
|
+
allow(Chef::Provider::Package::Yum::YumCache).to receive(:instance).and_return(@yum_cache)
|
304
304
|
@provider = Chef::Provider::Package::Yum.new(@new_resource, @run_context)
|
305
|
-
@yum_cache.
|
306
|
-
@yum_cache.
|
305
|
+
expect(@yum_cache).to receive(:packages_from_require).once.and_return([])
|
306
|
+
expect(@yum_cache).not_to receive(:reload_provides)
|
307
307
|
@new_resource.action(:remove)
|
308
308
|
@provider.load_current_resource
|
309
|
-
@yum_cache.
|
310
|
-
@yum_cache.
|
309
|
+
expect(@yum_cache).to receive(:packages_from_require).once.and_return([])
|
310
|
+
expect(@yum_cache).not_to receive(:reload_provides)
|
311
311
|
@new_resource.action(:purge)
|
312
312
|
@provider.load_current_resource
|
313
313
|
end
|
@@ -324,27 +324,27 @@ describe Chef::Provider::Package::Yum do
|
|
324
324
|
:version_available? => true,
|
325
325
|
:disable_extra_repo_control => true
|
326
326
|
)
|
327
|
-
Chef::Provider::Package::Yum::YumCache.
|
328
|
-
@yum_cache.
|
327
|
+
allow(Chef::Provider::Package::Yum::YumCache).to receive(:instance).and_return(@yum_cache)
|
328
|
+
expect(@yum_cache).to receive(:packages_from_require).twice.and_return([])
|
329
329
|
@provider = Chef::Provider::Package::Yum.new(@new_resource, @run_context)
|
330
330
|
@provider.load_current_resource
|
331
|
-
@new_resource.package_name.
|
331
|
+
expect(@new_resource.package_name).to eq("cups")
|
332
332
|
end
|
333
333
|
end
|
334
334
|
|
335
335
|
describe "when installing a package" do
|
336
336
|
it "should run yum install with the package name and version" do
|
337
337
|
@provider.load_current_resource
|
338
|
-
Chef::Provider::Package::Yum::RPMUtils.
|
339
|
-
@provider.
|
338
|
+
allow(Chef::Provider::Package::Yum::RPMUtils).to receive(:rpmvercmp).and_return(-1)
|
339
|
+
expect(@provider).to receive(:yum_command).with(
|
340
340
|
"yum -d0 -e0 -y install emacs-1.0"
|
341
341
|
)
|
342
342
|
@provider.install_package("emacs", "1.0")
|
343
343
|
end
|
344
344
|
|
345
345
|
it "should run yum localinstall if given a path to an rpm" do
|
346
|
-
@new_resource.
|
347
|
-
@provider.
|
346
|
+
allow(@new_resource).to receive(:source).and_return("/tmp/emacs-21.4-20.el5.i386.rpm")
|
347
|
+
expect(@provider).to receive(:yum_command).with(
|
348
348
|
"yum -d0 -e0 -y localinstall /tmp/emacs-21.4-20.el5.i386.rpm"
|
349
349
|
)
|
350
350
|
@provider.install_package("emacs", "21.4-20.el5")
|
@@ -352,10 +352,10 @@ describe Chef::Provider::Package::Yum do
|
|
352
352
|
|
353
353
|
it "should run yum localinstall if given a path to an rpm as the package" do
|
354
354
|
@new_resource = Chef::Resource::Package.new("/tmp/emacs-21.4-20.el5.i386.rpm")
|
355
|
-
::File.
|
355
|
+
allow(::File).to receive(:exists?).and_return(true)
|
356
356
|
@provider = Chef::Provider::Package::Yum.new(@new_resource, @run_context)
|
357
|
-
@new_resource.source.
|
358
|
-
@provider.
|
357
|
+
expect(@new_resource.source).to eq("/tmp/emacs-21.4-20.el5.i386.rpm")
|
358
|
+
expect(@provider).to receive(:yum_command).with(
|
359
359
|
"yum -d0 -e0 -y localinstall /tmp/emacs-21.4-20.el5.i386.rpm"
|
360
360
|
)
|
361
361
|
@provider.install_package("/tmp/emacs-21.4-20.el5.i386.rpm", "21.4-20.el5")
|
@@ -363,9 +363,9 @@ describe Chef::Provider::Package::Yum do
|
|
363
363
|
|
364
364
|
it "should run yum install with the package name, version and arch" do
|
365
365
|
@provider.load_current_resource
|
366
|
-
@new_resource.
|
367
|
-
Chef::Provider::Package::Yum::RPMUtils.
|
368
|
-
@provider.
|
366
|
+
allow(@new_resource).to receive(:arch).and_return("i386")
|
367
|
+
allow(Chef::Provider::Package::Yum::RPMUtils).to receive(:rpmvercmp).and_return(-1)
|
368
|
+
expect(@provider).to receive(:yum_command).with(
|
369
369
|
"yum -d0 -e0 -y install emacs-21.4-20.el5.i386"
|
370
370
|
)
|
371
371
|
@provider.install_package("emacs", "21.4-20.el5")
|
@@ -374,9 +374,9 @@ describe Chef::Provider::Package::Yum do
|
|
374
374
|
it "installs the package with the options given in the resource" do
|
375
375
|
@provider.load_current_resource
|
376
376
|
@provider.candidate_version = '11'
|
377
|
-
@new_resource.
|
378
|
-
Chef::Provider::Package::Yum::RPMUtils.
|
379
|
-
@provider.
|
377
|
+
allow(@new_resource).to receive(:options).and_return("--disablerepo epmd")
|
378
|
+
allow(Chef::Provider::Package::Yum::RPMUtils).to receive(:rpmvercmp).and_return(-1)
|
379
|
+
expect(@provider).to receive(:yum_command).with(
|
380
380
|
"yum -d0 -e0 -y --disablerepo epmd install cups-11"
|
381
381
|
)
|
382
382
|
@provider.install_package(@new_resource.name, @provider.candidate_version)
|
@@ -393,13 +393,13 @@ describe Chef::Provider::Package::Yum do
|
|
393
393
|
:version_available? => nil,
|
394
394
|
:disable_extra_repo_control => true
|
395
395
|
)
|
396
|
-
Chef::Provider::Package::Yum::YumCache.
|
396
|
+
allow(Chef::Provider::Package::Yum::YumCache).to receive(:instance).and_return(@yum_cache)
|
397
397
|
@provider = Chef::Provider::Package::Yum.new(@new_resource, @run_context)
|
398
|
-
|
398
|
+
expect { @provider.install_package("lolcats", "0.99") }.to raise_error(Chef::Exceptions::Package, %r{Version .* not found})
|
399
399
|
end
|
400
400
|
|
401
401
|
it "should raise an exception if candidate version is older than the installed version and allow_downgrade is false" do
|
402
|
-
@new_resource.
|
402
|
+
allow(@new_resource).to receive(:allow_downgrade).and_return(false)
|
403
403
|
@yum_cache = double(
|
404
404
|
'Chef::Provider::Yum::YumCache',
|
405
405
|
:reload_installed => true,
|
@@ -411,10 +411,10 @@ describe Chef::Provider::Package::Yum do
|
|
411
411
|
:allow_multi_install => [ "kernel" ],
|
412
412
|
:disable_extra_repo_control => true
|
413
413
|
)
|
414
|
-
Chef::Provider::Package::Yum::YumCache.
|
414
|
+
allow(Chef::Provider::Package::Yum::YumCache).to receive(:instance).and_return(@yum_cache)
|
415
415
|
@provider = Chef::Provider::Package::Yum.new(@new_resource, @run_context)
|
416
416
|
@provider.load_current_resource
|
417
|
-
|
417
|
+
expect { @provider.install_package("cups", "1.2.4-11.15.el5") }.to raise_error(Chef::Exceptions::Package, %r{is newer than candidate package})
|
418
418
|
end
|
419
419
|
|
420
420
|
it "should not raise an exception if candidate version is older than the installed version and the package is list in yum's installonlypkg option" do
|
@@ -430,17 +430,17 @@ describe Chef::Provider::Package::Yum do
|
|
430
430
|
:package_repository => "base",
|
431
431
|
:disable_extra_repo_control => true
|
432
432
|
)
|
433
|
-
Chef::Provider::Package::Yum::YumCache.
|
433
|
+
allow(Chef::Provider::Package::Yum::YumCache).to receive(:instance).and_return(@yum_cache)
|
434
434
|
@provider = Chef::Provider::Package::Yum.new(@new_resource, @run_context)
|
435
435
|
@provider.load_current_resource
|
436
|
-
@provider.
|
436
|
+
expect(@provider).to receive(:yum_command).with(
|
437
437
|
"yum -d0 -e0 -y install cups-1.2.4-11.15.el5"
|
438
438
|
)
|
439
439
|
@provider.install_package("cups", "1.2.4-11.15.el5")
|
440
440
|
end
|
441
441
|
|
442
442
|
it "should run yum downgrade if candidate version is older than the installed version and allow_downgrade is true" do
|
443
|
-
@new_resource.
|
443
|
+
allow(@new_resource).to receive(:allow_downgrade).and_return(true)
|
444
444
|
@yum_cache = double(
|
445
445
|
'Chef::Provider::Yum::YumCache',
|
446
446
|
:reload_installed => true,
|
@@ -453,34 +453,34 @@ describe Chef::Provider::Package::Yum do
|
|
453
453
|
:package_repository => "base",
|
454
454
|
:disable_extra_repo_control => true
|
455
455
|
)
|
456
|
-
Chef::Provider::Package::Yum::YumCache.
|
456
|
+
allow(Chef::Provider::Package::Yum::YumCache).to receive(:instance).and_return(@yum_cache)
|
457
457
|
@provider = Chef::Provider::Package::Yum.new(@new_resource, @run_context)
|
458
458
|
@provider.load_current_resource
|
459
|
-
@provider.
|
459
|
+
expect(@provider).to receive(:yum_command).with(
|
460
460
|
"yum -d0 -e0 -y downgrade cups-1.2.4-11.15.el5"
|
461
461
|
)
|
462
462
|
@provider.install_package("cups", "1.2.4-11.15.el5")
|
463
463
|
end
|
464
464
|
|
465
465
|
it "should run yum install then flush the cache if :after is true" do
|
466
|
-
@new_resource.
|
466
|
+
allow(@new_resource).to receive(:flush_cache).and_return({:after => true, :before => false})
|
467
467
|
@provider.load_current_resource
|
468
|
-
Chef::Provider::Package::Yum::RPMUtils.
|
469
|
-
@provider.
|
468
|
+
allow(Chef::Provider::Package::Yum::RPMUtils).to receive(:rpmvercmp).and_return(-1)
|
469
|
+
expect(@provider).to receive(:yum_command).with(
|
470
470
|
"yum -d0 -e0 -y install emacs-1.0"
|
471
471
|
)
|
472
|
-
@yum_cache.
|
472
|
+
expect(@yum_cache).to receive(:reload).once
|
473
473
|
@provider.install_package("emacs", "1.0")
|
474
474
|
end
|
475
475
|
|
476
476
|
it "should run yum install then not flush the cache if :after is false" do
|
477
|
-
@new_resource.
|
477
|
+
allow(@new_resource).to receive(:flush_cache).and_return({:after => false, :before => false})
|
478
478
|
@provider.load_current_resource
|
479
|
-
Chef::Provider::Package::Yum::RPMUtils.
|
480
|
-
@provider.
|
479
|
+
allow(Chef::Provider::Package::Yum::RPMUtils).to receive(:rpmvercmp).and_return(-1)
|
480
|
+
expect(@provider).to receive(:yum_command).with(
|
481
481
|
"yum -d0 -e0 -y install emacs-1.0"
|
482
482
|
)
|
483
|
-
@yum_cache.
|
483
|
+
expect(@yum_cache).not_to receive(:reload)
|
484
484
|
@provider.install_package("emacs", "1.0")
|
485
485
|
end
|
486
486
|
end
|
@@ -489,8 +489,8 @@ describe Chef::Provider::Package::Yum do
|
|
489
489
|
it "should run yum install if the package is installed and a version is given" do
|
490
490
|
@provider.load_current_resource
|
491
491
|
@provider.candidate_version = '11'
|
492
|
-
Chef::Provider::Package::Yum::RPMUtils.
|
493
|
-
@provider.
|
492
|
+
allow(Chef::Provider::Package::Yum::RPMUtils).to receive(:rpmvercmp).and_return(-1)
|
493
|
+
expect(@provider).to receive(:yum_command).with(
|
494
494
|
"yum -d0 -e0 -y install cups-11"
|
495
495
|
)
|
496
496
|
@provider.upgrade_package(@new_resource.name, @provider.candidate_version)
|
@@ -500,8 +500,8 @@ describe Chef::Provider::Package::Yum do
|
|
500
500
|
@provider.load_current_resource
|
501
501
|
@current_resource = Chef::Resource::Package.new('cups')
|
502
502
|
@provider.candidate_version = '11'
|
503
|
-
Chef::Provider::Package::Yum::RPMUtils.
|
504
|
-
@provider.
|
503
|
+
allow(Chef::Provider::Package::Yum::RPMUtils).to receive(:rpmvercmp).and_return(-1)
|
504
|
+
expect(@provider).to receive(:yum_command).with(
|
505
505
|
"yum -d0 -e0 -y install cups-11"
|
506
506
|
)
|
507
507
|
@provider.upgrade_package(@new_resource.name, @provider.candidate_version)
|
@@ -519,19 +519,19 @@ describe Chef::Provider::Package::Yum do
|
|
519
519
|
:allow_multi_install => [ "kernel" ],
|
520
520
|
:disable_extra_repo_control => true
|
521
521
|
)
|
522
|
-
Chef::Provider::Package::Yum::YumCache.
|
522
|
+
allow(Chef::Provider::Package::Yum::YumCache).to receive(:instance).and_return(@yum_cache)
|
523
523
|
@provider = Chef::Provider::Package::Yum.new(@new_resource, @run_context)
|
524
524
|
@provider.load_current_resource
|
525
|
-
|
525
|
+
expect { @provider.upgrade_package("cups", "1.2.4-11.15.el5") }.to raise_error(Chef::Exceptions::Package, %r{is newer than candidate package})
|
526
526
|
end
|
527
527
|
|
528
528
|
# Test our little workaround, some crossover into Chef::Provider::Package territory
|
529
529
|
it "should call action_upgrade in the parent if the current resource version is nil" do
|
530
|
-
@yum_cache.
|
530
|
+
allow(@yum_cache).to receive(:installed_version).and_return(nil)
|
531
531
|
@provider.load_current_resource
|
532
532
|
@current_resource = Chef::Resource::Package.new('cups')
|
533
533
|
@provider.candidate_version = '11'
|
534
|
-
@provider.
|
534
|
+
expect(@provider).to receive(:upgrade_package).with(
|
535
535
|
"cups",
|
536
536
|
"11"
|
537
537
|
)
|
@@ -542,7 +542,7 @@ describe Chef::Provider::Package::Yum do
|
|
542
542
|
@provider.load_current_resource
|
543
543
|
@current_resource = Chef::Resource::Package.new('cups')
|
544
544
|
@provider.candidate_version = nil
|
545
|
-
@provider.
|
545
|
+
expect(@provider).not_to receive(:upgrade_package)
|
546
546
|
@provider.action_upgrade
|
547
547
|
end
|
548
548
|
|
@@ -550,7 +550,7 @@ describe Chef::Provider::Package::Yum do
|
|
550
550
|
@provider.load_current_resource
|
551
551
|
@current_resource = Chef::Resource::Package.new('cups')
|
552
552
|
@provider.candidate_version = '11'
|
553
|
-
@provider.
|
553
|
+
expect(@provider).to receive(:upgrade_package).with(
|
554
554
|
"cups",
|
555
555
|
"11"
|
556
556
|
)
|
@@ -558,26 +558,26 @@ describe Chef::Provider::Package::Yum do
|
|
558
558
|
end
|
559
559
|
|
560
560
|
it "should not call action_upgrade in the parent if the candidate is older" do
|
561
|
-
@yum_cache.
|
561
|
+
allow(@yum_cache).to receive(:installed_version).and_return("12")
|
562
562
|
@provider.load_current_resource
|
563
563
|
@current_resource = Chef::Resource::Package.new('cups')
|
564
564
|
@provider.candidate_version = '11'
|
565
|
-
@provider.
|
565
|
+
expect(@provider).not_to receive(:upgrade_package)
|
566
566
|
@provider.action_upgrade
|
567
567
|
end
|
568
568
|
end
|
569
569
|
|
570
570
|
describe "when removing a package" do
|
571
571
|
it "should run yum remove with the package name" do
|
572
|
-
@provider.
|
572
|
+
expect(@provider).to receive(:yum_command).with(
|
573
573
|
"yum -d0 -e0 -y remove emacs-1.0"
|
574
574
|
)
|
575
575
|
@provider.remove_package("emacs", "1.0")
|
576
576
|
end
|
577
577
|
|
578
578
|
it "should run yum remove with the package name and arch" do
|
579
|
-
@new_resource.
|
580
|
-
@provider.
|
579
|
+
allow(@new_resource).to receive(:arch).and_return("x86_64")
|
580
|
+
expect(@provider).to receive(:yum_command).with(
|
581
581
|
"yum -d0 -e0 -y remove emacs-1.0.x86_64"
|
582
582
|
)
|
583
583
|
@provider.remove_package("emacs", "1.0")
|
@@ -586,7 +586,7 @@ describe Chef::Provider::Package::Yum do
|
|
586
586
|
|
587
587
|
describe "when purging a package" do
|
588
588
|
it "should run yum remove with the package name" do
|
589
|
-
@provider.
|
589
|
+
expect(@provider).to receive(:yum_command).with(
|
590
590
|
"yum -d0 -e0 -y remove emacs-1.0"
|
591
591
|
)
|
592
592
|
@provider.purge_package("emacs", "1.0")
|
@@ -596,8 +596,8 @@ describe Chef::Provider::Package::Yum do
|
|
596
596
|
describe "when running yum" do
|
597
597
|
it "should run yum once if it exits with a return code of 0" do
|
598
598
|
@status = double("Status", :exitstatus => 0)
|
599
|
-
@provider.
|
600
|
-
@provider.
|
599
|
+
allow(@provider).to receive(:output_of_command).and_return([@status, "", ""])
|
600
|
+
expect(@provider).to receive(:output_of_command).once.with(
|
601
601
|
"yum -d0 -e0 -y install emacs-1.0",
|
602
602
|
{:timeout => Chef::Config[:yum_timeout]}
|
603
603
|
)
|
@@ -606,34 +606,34 @@ describe Chef::Provider::Package::Yum do
|
|
606
606
|
|
607
607
|
it "should run yum once if it exits with a return code > 0 and no scriptlet failures" do
|
608
608
|
@status = double("Status", :exitstatus => 2)
|
609
|
-
@provider.
|
610
|
-
@provider.
|
609
|
+
allow(@provider).to receive(:output_of_command).and_return([@status, "failure failure", "problem problem"])
|
610
|
+
expect(@provider).to receive(:output_of_command).once.with(
|
611
611
|
"yum -d0 -e0 -y install emacs-1.0",
|
612
612
|
{:timeout => Chef::Config[:yum_timeout]}
|
613
613
|
)
|
614
|
-
|
614
|
+
expect { @provider.yum_command("yum -d0 -e0 -y install emacs-1.0") }.to raise_error(Chef::Exceptions::Exec)
|
615
615
|
end
|
616
616
|
|
617
617
|
it "should run yum once if it exits with a return code of 1 and %pre scriptlet failures" do
|
618
618
|
@status = double("Status", :exitstatus => 1)
|
619
|
-
@provider.
|
620
|
-
@provider.
|
619
|
+
allow(@provider).to receive(:output_of_command).and_return([@status, "error: %pre(demo-1-1.el5.centos.x86_64) scriptlet failed, exit status 2", ""])
|
620
|
+
expect(@provider).to receive(:output_of_command).once.with(
|
621
621
|
"yum -d0 -e0 -y install emacs-1.0",
|
622
622
|
{:timeout => Chef::Config[:yum_timeout]}
|
623
623
|
)
|
624
624
|
# will still raise an exception, can't stub out the subsequent call
|
625
|
-
|
625
|
+
expect { @provider.yum_command("yum -d0 -e0 -y install emacs-1.0") }.to raise_error(Chef::Exceptions::Exec)
|
626
626
|
end
|
627
627
|
|
628
628
|
it "should run yum twice if it exits with a return code of 1 and %post scriptlet failures" do
|
629
629
|
@status = double("Status", :exitstatus => 1)
|
630
|
-
@provider.
|
631
|
-
@provider.
|
630
|
+
allow(@provider).to receive(:output_of_command).and_return([@status, "error: %post(demo-1-1.el5.centos.x86_64) scriptlet failed, exit status 2", ""])
|
631
|
+
expect(@provider).to receive(:output_of_command).twice.with(
|
632
632
|
"yum -d0 -e0 -y install emacs-1.0",
|
633
633
|
{:timeout => Chef::Config[:yum_timeout]}
|
634
634
|
)
|
635
635
|
# will still raise an exception, can't stub out the subsequent call
|
636
|
-
|
636
|
+
expect { @provider.yum_command("yum -d0 -e0 -y install emacs-1.0") }.to raise_error(Chef::Exceptions::Exec)
|
637
637
|
end
|
638
638
|
end
|
639
639
|
end
|
@@ -650,7 +650,7 @@ describe Chef::Provider::Package::Yum::RPMUtils do
|
|
650
650
|
[ "9:1.7.3", [ 9, "1.7.3", nil ] ],
|
651
651
|
[ "15:20020927", [ 15, "20020927", nil ] ]
|
652
652
|
].each do |x, y|
|
653
|
-
@rpmutils.version_parse(x).
|
653
|
+
expect(@rpmutils.version_parse(x)).to eq(y)
|
654
654
|
end
|
655
655
|
end
|
656
656
|
|
@@ -660,7 +660,7 @@ describe Chef::Provider::Package::Yum::RPMUtils do
|
|
660
660
|
[ "-1:1.7.3", [ nil, nil, "1:1.7.3" ] ],
|
661
661
|
[ "-:20020927", [ nil, nil, ":20020927" ] ]
|
662
662
|
].each do |x, y|
|
663
|
-
@rpmutils.version_parse(x).
|
663
|
+
expect(@rpmutils.version_parse(x)).to eq(y)
|
664
664
|
end
|
665
665
|
end
|
666
666
|
|
@@ -670,7 +670,7 @@ describe Chef::Provider::Package::Yum::RPMUtils do
|
|
670
670
|
[ "1.7.3", [ nil, "1.7.3", nil ] ],
|
671
671
|
[ "20020927", [ nil, "20020927", nil ] ]
|
672
672
|
].each do |x, y|
|
673
|
-
@rpmutils.version_parse(x).
|
673
|
+
expect(@rpmutils.version_parse(x)).to eq(y)
|
674
674
|
end
|
675
675
|
end
|
676
676
|
|
@@ -680,7 +680,7 @@ describe Chef::Provider::Package::Yum::RPMUtils do
|
|
680
680
|
[ "0001.7.3", [ nil, "0001.7.3", nil ] ],
|
681
681
|
[ "20020927,3", [ nil, "20020927,3", nil ] ]
|
682
682
|
].each do |x, y|
|
683
|
-
@rpmutils.version_parse(x).
|
683
|
+
expect(@rpmutils.version_parse(x)).to eq(y)
|
684
684
|
end
|
685
685
|
end
|
686
686
|
|
@@ -690,7 +690,7 @@ describe Chef::Provider::Package::Yum::RPMUtils do
|
|
690
690
|
[ "1.7.3-1jpp.2.el5", [ nil, "1.7.3", "1jpp.2.el5" ] ],
|
691
691
|
[ "20020927-46.el5", [ nil, "20020927", "46.el5" ] ]
|
692
692
|
].each do |x, y|
|
693
|
-
@rpmutils.version_parse(x).
|
693
|
+
expect(@rpmutils.version_parse(x)).to eq(y)
|
694
694
|
end
|
695
695
|
end
|
696
696
|
|
@@ -700,7 +700,7 @@ describe Chef::Provider::Package::Yum::RPMUtils do
|
|
700
700
|
[ "-1jpp.2.el5", [ nil, nil, "1jpp.2.el5" ] ],
|
701
701
|
[ "-0020020927-46.el5", [ nil, "-0020020927", "46.el5" ] ]
|
702
702
|
].each do |x, y|
|
703
|
-
@rpmutils.version_parse(x).
|
703
|
+
expect(@rpmutils.version_parse(x)).to eq(y)
|
704
704
|
end
|
705
705
|
end
|
706
706
|
end
|
@@ -757,7 +757,7 @@ describe Chef::Provider::Package::Yum::RPMUtils do
|
|
757
757
|
[ "0.0.1aa", "0.0.1aa", 0 ],
|
758
758
|
[ "0.0.1a", "0.0.1aa", -1 ],
|
759
759
|
].each do |x, y, result|
|
760
|
-
@rpmutils.rpmvercmp(x,y).
|
760
|
+
expect(@rpmutils.rpmvercmp(x,y)).to eq(result)
|
761
761
|
end
|
762
762
|
end
|
763
763
|
|
@@ -776,43 +776,43 @@ describe Chef::Provider::Package::Yum::RPMUtils do
|
|
776
776
|
[ "", "", 0 ],
|
777
777
|
[ "", "1.0.1", -1 ]
|
778
778
|
].each do |x, y, result|
|
779
|
-
@rpmutils.rpmvercmp(x,y).
|
779
|
+
expect(@rpmutils.rpmvercmp(x,y)).to eq(result)
|
780
780
|
end
|
781
781
|
end
|
782
782
|
|
783
783
|
it "tests isalnum good input" do
|
784
784
|
[ 'a', 'z', 'A', 'Z', '0', '9' ].each do |t|
|
785
|
-
@rpmutils.isalnum(t).
|
785
|
+
expect(@rpmutils.isalnum(t)).to eq(true)
|
786
786
|
end
|
787
787
|
end
|
788
788
|
|
789
789
|
it "tests isalnum bad input" do
|
790
790
|
[ '-', '.', '!', '^', ':', '_' ].each do |t|
|
791
|
-
@rpmutils.isalnum(t).
|
791
|
+
expect(@rpmutils.isalnum(t)).to eq(false)
|
792
792
|
end
|
793
793
|
end
|
794
794
|
|
795
795
|
it "tests isalpha good input" do
|
796
796
|
[ 'a', 'z', 'A', 'Z', ].each do |t|
|
797
|
-
@rpmutils.isalpha(t).
|
797
|
+
expect(@rpmutils.isalpha(t)).to eq(true)
|
798
798
|
end
|
799
799
|
end
|
800
800
|
|
801
801
|
it "tests isalpha bad input" do
|
802
802
|
[ '0', '9', '-', '.', '!', '^', ':', '_' ].each do |t|
|
803
|
-
@rpmutils.isalpha(t).
|
803
|
+
expect(@rpmutils.isalpha(t)).to eq(false)
|
804
804
|
end
|
805
805
|
end
|
806
806
|
|
807
807
|
it "tests isdigit good input" do
|
808
808
|
[ '0', '9', ].each do |t|
|
809
|
-
@rpmutils.isdigit(t).
|
809
|
+
expect(@rpmutils.isdigit(t)).to eq(true)
|
810
810
|
end
|
811
811
|
end
|
812
812
|
|
813
813
|
it "tests isdigit bad input" do
|
814
814
|
[ 'A', 'z', '-', '.', '!', '^', ':', '_' ].each do |t|
|
815
|
-
@rpmutils.isdigit(t).
|
815
|
+
expect(@rpmutils.isdigit(t)).to eq(false)
|
816
816
|
end
|
817
817
|
end
|
818
818
|
end
|
@@ -826,15 +826,15 @@ describe Chef::Provider::Package::Yum::RPMVersion do
|
|
826
826
|
end
|
827
827
|
|
828
828
|
it "should expose evr (name-version-release) available" do
|
829
|
-
@rpmv.e.
|
830
|
-
@rpmv.v.
|
831
|
-
@rpmv.r.
|
829
|
+
expect(@rpmv.e).to eq(1)
|
830
|
+
expect(@rpmv.v).to eq("1.6.5")
|
831
|
+
expect(@rpmv.r).to eq("9.36.el5")
|
832
832
|
|
833
|
-
@rpmv.evr.
|
833
|
+
expect(@rpmv.evr).to eq("1:1.6.5-9.36.el5")
|
834
834
|
end
|
835
835
|
|
836
836
|
it "should output a version-release string" do
|
837
|
-
@rpmv.to_s.
|
837
|
+
expect(@rpmv.to_s).to eq("1.6.5-9.36.el5")
|
838
838
|
end
|
839
839
|
end
|
840
840
|
|
@@ -844,34 +844,34 @@ describe Chef::Provider::Package::Yum::RPMVersion do
|
|
844
844
|
end
|
845
845
|
|
846
846
|
it "should expose evr (name-version-release) available" do
|
847
|
-
@rpmv.e.
|
848
|
-
@rpmv.v.
|
849
|
-
@rpmv.r.
|
847
|
+
expect(@rpmv.e).to eq(1)
|
848
|
+
expect(@rpmv.v).to eq("1.6.5")
|
849
|
+
expect(@rpmv.r).to eq("9.36.el5")
|
850
850
|
|
851
|
-
@rpmv.evr.
|
851
|
+
expect(@rpmv.evr).to eq("1:1.6.5-9.36.el5")
|
852
852
|
end
|
853
853
|
|
854
854
|
it "should output a version-release string" do
|
855
|
-
@rpmv.to_s.
|
855
|
+
expect(@rpmv.to_s).to eq("1.6.5-9.36.el5")
|
856
856
|
end
|
857
857
|
end
|
858
858
|
|
859
859
|
it "should raise an error unless passed 1 or 3 args" do
|
860
|
-
|
860
|
+
expect {
|
861
861
|
Chef::Provider::Package::Yum::RPMVersion.new()
|
862
|
-
}.
|
863
|
-
|
862
|
+
}.to raise_error(ArgumentError)
|
863
|
+
expect {
|
864
864
|
Chef::Provider::Package::Yum::RPMVersion.new("1:1.6.5-9.36.el5")
|
865
|
-
}.
|
866
|
-
|
865
|
+
}.not_to raise_error
|
866
|
+
expect {
|
867
867
|
Chef::Provider::Package::Yum::RPMVersion.new("1:1.6.5-9.36.el5", "extra")
|
868
|
-
}.
|
869
|
-
|
868
|
+
}.to raise_error(ArgumentError)
|
869
|
+
expect {
|
870
870
|
Chef::Provider::Package::Yum::RPMVersion.new("1", "1.6.5", "9.36.el5")
|
871
|
-
}.
|
872
|
-
|
871
|
+
}.not_to raise_error
|
872
|
+
expect {
|
873
873
|
Chef::Provider::Package::Yum::RPMVersion.new("1", "1.6.5", "9.36.el5", "extra")
|
874
|
-
}.
|
874
|
+
}.to raise_error(ArgumentError)
|
875
875
|
end
|
876
876
|
|
877
877
|
# thanks version_class_spec.rb!
|
@@ -898,9 +898,9 @@ describe Chef::Provider::Package::Yum::RPMVersion do
|
|
898
898
|
].each do |smaller, larger|
|
899
899
|
sm = Chef::Provider::Package::Yum::RPMVersion.new(smaller)
|
900
900
|
lg = Chef::Provider::Package::Yum::RPMVersion.new(larger)
|
901
|
-
sm.
|
902
|
-
lg.
|
903
|
-
sm.
|
901
|
+
expect(sm).to be < lg
|
902
|
+
expect(lg).to be > sm
|
903
|
+
expect(sm).not_to eq(lg)
|
904
904
|
end
|
905
905
|
end
|
906
906
|
|
@@ -924,9 +924,9 @@ describe Chef::Provider::Package::Yum::RPMVersion do
|
|
924
924
|
].each do |smaller, larger|
|
925
925
|
sm = Chef::Provider::Package::Yum::RPMVersion.new(smaller)
|
926
926
|
lg = Chef::Provider::Package::Yum::RPMVersion.new(larger)
|
927
|
-
sm.
|
928
|
-
lg.
|
929
|
-
sm.
|
927
|
+
expect(sm).to be < lg
|
928
|
+
expect(lg).to be > sm
|
929
|
+
expect(sm).not_to eq(lg)
|
930
930
|
end
|
931
931
|
end
|
932
932
|
|
@@ -941,7 +941,7 @@ describe Chef::Provider::Package::Yum::RPMVersion do
|
|
941
941
|
].each do |smaller, larger|
|
942
942
|
sm = Chef::Provider::Package::Yum::RPMVersion.new(smaller)
|
943
943
|
lg = Chef::Provider::Package::Yum::RPMVersion.new(larger)
|
944
|
-
sm.
|
944
|
+
expect(sm).to eq(lg)
|
945
945
|
end
|
946
946
|
end
|
947
947
|
|
@@ -956,7 +956,7 @@ describe Chef::Provider::Package::Yum::RPMVersion do
|
|
956
956
|
].each do |smaller, larger|
|
957
957
|
sm = Chef::Provider::Package::Yum::RPMVersion.new(smaller)
|
958
958
|
lg = Chef::Provider::Package::Yum::RPMVersion.new(larger)
|
959
|
-
sm.
|
959
|
+
expect(sm).to eq(lg)
|
960
960
|
end
|
961
961
|
end
|
962
962
|
end
|
@@ -980,9 +980,9 @@ describe Chef::Provider::Package::Yum::RPMVersion do
|
|
980
980
|
].each do |smaller, larger|
|
981
981
|
sm = Chef::Provider::Package::Yum::RPMVersion.new(smaller)
|
982
982
|
lg = Chef::Provider::Package::Yum::RPMVersion.new(larger)
|
983
|
-
sm.partial_compare(lg).
|
984
|
-
lg.partial_compare(sm).
|
985
|
-
sm.partial_compare(lg).
|
983
|
+
expect(sm.partial_compare(lg)).to eq(-1)
|
984
|
+
expect(lg.partial_compare(sm)).to eq(1)
|
985
|
+
expect(sm.partial_compare(lg)).not_to eq(0)
|
986
986
|
end
|
987
987
|
end
|
988
988
|
|
@@ -997,7 +997,7 @@ describe Chef::Provider::Package::Yum::RPMVersion do
|
|
997
997
|
].each do |smaller, larger|
|
998
998
|
sm = Chef::Provider::Package::Yum::RPMVersion.new(smaller)
|
999
999
|
lg = Chef::Provider::Package::Yum::RPMVersion.new(larger)
|
1000
|
-
sm.partial_compare(lg).
|
1000
|
+
expect(sm.partial_compare(lg)).to eq(0)
|
1001
1001
|
end
|
1002
1002
|
end
|
1003
1003
|
end
|
@@ -1011,18 +1011,18 @@ describe Chef::Provider::Package::Yum::RPMPackage do
|
|
1011
1011
|
end
|
1012
1012
|
|
1013
1013
|
it "should expose nevra (name-epoch-version-release-arch) available" do
|
1014
|
-
@rpm.name.
|
1015
|
-
@rpm.version.e.
|
1016
|
-
@rpm.version.v.
|
1017
|
-
@rpm.version.r.
|
1018
|
-
@rpm.arch.
|
1014
|
+
expect(@rpm.name).to eq("testing")
|
1015
|
+
expect(@rpm.version.e).to eq(1)
|
1016
|
+
expect(@rpm.version.v).to eq("1.6.5")
|
1017
|
+
expect(@rpm.version.r).to eq("9.36.el5")
|
1018
|
+
expect(@rpm.arch).to eq("x86_64")
|
1019
1019
|
|
1020
|
-
@rpm.nevra.
|
1021
|
-
@rpm.to_s.
|
1020
|
+
expect(@rpm.nevra).to eq("testing-1:1.6.5-9.36.el5.x86_64")
|
1021
|
+
expect(@rpm.to_s).to eq(@rpm.nevra)
|
1022
1022
|
end
|
1023
1023
|
|
1024
1024
|
it "should always have at least one provide, itself" do
|
1025
|
-
@rpm.provides.size.
|
1025
|
+
expect(@rpm.provides.size).to eq(1)
|
1026
1026
|
@rpm.provides[0].name == "testing"
|
1027
1027
|
@rpm.provides[0].version.evr == "1:1.6.5-9.36.el5"
|
1028
1028
|
@rpm.provides[0].flag == :==
|
@@ -1035,18 +1035,18 @@ describe Chef::Provider::Package::Yum::RPMPackage do
|
|
1035
1035
|
end
|
1036
1036
|
|
1037
1037
|
it "should expose nevra (name-epoch-version-release-arch) available" do
|
1038
|
-
@rpm.name.
|
1039
|
-
@rpm.version.e.
|
1040
|
-
@rpm.version.v.
|
1041
|
-
@rpm.version.r.
|
1042
|
-
@rpm.arch.
|
1038
|
+
expect(@rpm.name).to eq("testing")
|
1039
|
+
expect(@rpm.version.e).to eq(1)
|
1040
|
+
expect(@rpm.version.v).to eq("1.6.5")
|
1041
|
+
expect(@rpm.version.r).to eq("9.36.el5")
|
1042
|
+
expect(@rpm.arch).to eq("x86_64")
|
1043
1043
|
|
1044
|
-
@rpm.nevra.
|
1045
|
-
@rpm.to_s.
|
1044
|
+
expect(@rpm.nevra).to eq("testing-1:1.6.5-9.36.el5.x86_64")
|
1045
|
+
expect(@rpm.to_s).to eq(@rpm.nevra)
|
1046
1046
|
end
|
1047
1047
|
|
1048
1048
|
it "should always have at least one provide, itself" do
|
1049
|
-
@rpm.provides.size.
|
1049
|
+
expect(@rpm.provides.size).to eq(1)
|
1050
1050
|
@rpm.provides[0].name == "testing"
|
1051
1051
|
@rpm.provides[0].version.evr == "1:1.6.5-9.36.el5"
|
1052
1052
|
@rpm.provides[0].flag == :==
|
@@ -1054,30 +1054,30 @@ describe Chef::Provider::Package::Yum::RPMPackage do
|
|
1054
1054
|
end
|
1055
1055
|
|
1056
1056
|
it "should raise an error unless passed 4 or 6 args" do
|
1057
|
-
|
1057
|
+
expect {
|
1058
1058
|
Chef::Provider::Package::Yum::RPMPackage.new()
|
1059
|
-
}.
|
1060
|
-
|
1059
|
+
}.to raise_error(ArgumentError)
|
1060
|
+
expect {
|
1061
1061
|
Chef::Provider::Package::Yum::RPMPackage.new("testing")
|
1062
|
-
}.
|
1063
|
-
|
1062
|
+
}.to raise_error(ArgumentError)
|
1063
|
+
expect {
|
1064
1064
|
Chef::Provider::Package::Yum::RPMPackage.new("testing", "1:1.6.5-9.36.el5")
|
1065
|
-
}.
|
1066
|
-
|
1065
|
+
}.to raise_error(ArgumentError)
|
1066
|
+
expect {
|
1067
1067
|
Chef::Provider::Package::Yum::RPMPackage.new("testing", "1:1.6.5-9.36.el5", "x86_64")
|
1068
|
-
}.
|
1069
|
-
|
1068
|
+
}.to raise_error(ArgumentError)
|
1069
|
+
expect {
|
1070
1070
|
Chef::Provider::Package::Yum::RPMPackage.new("testing", "1:1.6.5-9.36.el5", "x86_64", [])
|
1071
|
-
}.
|
1072
|
-
|
1071
|
+
}.not_to raise_error
|
1072
|
+
expect {
|
1073
1073
|
Chef::Provider::Package::Yum::RPMPackage.new("testing", "1", "1.6.5", "9.36.el5", "x86_64")
|
1074
|
-
}.
|
1075
|
-
|
1074
|
+
}.to raise_error(ArgumentError)
|
1075
|
+
expect {
|
1076
1076
|
Chef::Provider::Package::Yum::RPMPackage.new("testing", "1", "1.6.5", "9.36.el5", "x86_64", [])
|
1077
|
-
}.
|
1078
|
-
|
1077
|
+
}.not_to raise_error
|
1078
|
+
expect {
|
1079
1079
|
Chef::Provider::Package::Yum::RPMPackage.new("testing", "1", "1.6.5", "9.36.el5", "x86_64", [], "extra")
|
1080
|
-
}.
|
1080
|
+
}.to raise_error(ArgumentError)
|
1081
1081
|
end
|
1082
1082
|
|
1083
1083
|
describe "<=>" do
|
@@ -1096,9 +1096,9 @@ describe Chef::Provider::Package::Yum::RPMPackage do
|
|
1096
1096
|
].each do |smaller, larger|
|
1097
1097
|
sm = Chef::Provider::Package::Yum::RPMPackage.new(smaller, "0:0.0.1-1", "x86_64", [])
|
1098
1098
|
lg = Chef::Provider::Package::Yum::RPMPackage.new(larger, "0:0.0.1-1", "x86_64", [])
|
1099
|
-
sm.
|
1100
|
-
lg.
|
1101
|
-
sm.
|
1099
|
+
expect(sm).to be < lg
|
1100
|
+
expect(lg).to be > sm
|
1101
|
+
expect(sm).not_to eq(lg)
|
1102
1102
|
end
|
1103
1103
|
end
|
1104
1104
|
|
@@ -1113,9 +1113,9 @@ describe Chef::Provider::Package::Yum::RPMPackage do
|
|
1113
1113
|
].each do |smaller, larger|
|
1114
1114
|
sm = Chef::Provider::Package::Yum::RPMPackage.new("test-package", "0:0.0.1-1", smaller, [])
|
1115
1115
|
lg = Chef::Provider::Package::Yum::RPMPackage.new("test-package", "0:0.0.1-1", larger, [])
|
1116
|
-
sm.
|
1117
|
-
lg.
|
1118
|
-
sm.
|
1116
|
+
expect(sm).to be < lg
|
1117
|
+
expect(lg).to be > sm
|
1118
|
+
expect(sm).not_to eq(lg)
|
1119
1119
|
end
|
1120
1120
|
end
|
1121
1121
|
end
|
@@ -1132,31 +1132,31 @@ describe Chef::Provider::Package::Yum::RPMDbPackage do
|
|
1132
1132
|
|
1133
1133
|
describe "initialize" do
|
1134
1134
|
it "should return a Chef::Provider::Package::Yum::RPMDbPackage object" do
|
1135
|
-
@rpm_x.
|
1135
|
+
expect(@rpm_x).to be_kind_of(Chef::Provider::Package::Yum::RPMDbPackage)
|
1136
1136
|
end
|
1137
1137
|
end
|
1138
1138
|
|
1139
1139
|
describe "available" do
|
1140
1140
|
it "should return true" do
|
1141
|
-
@rpm_x.available.
|
1142
|
-
@rpm_y.available.
|
1143
|
-
@rpm_z.available.
|
1141
|
+
expect(@rpm_x.available).to eq(true)
|
1142
|
+
expect(@rpm_y.available).to eq(true)
|
1143
|
+
expect(@rpm_z.available).to eq(false)
|
1144
1144
|
end
|
1145
1145
|
end
|
1146
1146
|
|
1147
1147
|
describe "installed" do
|
1148
1148
|
it "should return true" do
|
1149
|
-
@rpm_x.installed.
|
1150
|
-
@rpm_y.installed.
|
1151
|
-
@rpm_z.installed.
|
1149
|
+
expect(@rpm_x.installed).to eq(false)
|
1150
|
+
expect(@rpm_y.installed).to eq(true)
|
1151
|
+
expect(@rpm_z.installed).to eq(true)
|
1152
1152
|
end
|
1153
1153
|
end
|
1154
1154
|
|
1155
1155
|
describe "repoid" do
|
1156
1156
|
it "should return the source repository repoid" do
|
1157
|
-
@rpm_x.repoid.
|
1158
|
-
@rpm_y.repoid.
|
1159
|
-
@rpm_z.repoid.
|
1157
|
+
expect(@rpm_x.repoid).to eq("base")
|
1158
|
+
expect(@rpm_y.repoid).to eq("extras")
|
1159
|
+
expect(@rpm_z.repoid).to eq("other")
|
1160
1160
|
end
|
1161
1161
|
end
|
1162
1162
|
end
|
@@ -1168,11 +1168,11 @@ describe Chef::Provider::Package::Yum::RPMDependency do
|
|
1168
1168
|
end
|
1169
1169
|
|
1170
1170
|
it "should expose name, version, flag available" do
|
1171
|
-
@rpmdep.name.
|
1172
|
-
@rpmdep.version.e.
|
1173
|
-
@rpmdep.version.v.
|
1174
|
-
@rpmdep.version.r.
|
1175
|
-
@rpmdep.flag.
|
1171
|
+
expect(@rpmdep.name).to eq("testing")
|
1172
|
+
expect(@rpmdep.version.e).to eq(1)
|
1173
|
+
expect(@rpmdep.version.v).to eq("1.6.5")
|
1174
|
+
expect(@rpmdep.version.r).to eq("9.36.el5")
|
1175
|
+
expect(@rpmdep.flag).to eq(:==)
|
1176
1176
|
end
|
1177
1177
|
end
|
1178
1178
|
|
@@ -1182,67 +1182,67 @@ describe Chef::Provider::Package::Yum::RPMDependency do
|
|
1182
1182
|
end
|
1183
1183
|
|
1184
1184
|
it "should expose name, version, flag available" do
|
1185
|
-
@rpmdep.name.
|
1186
|
-
@rpmdep.version.e.
|
1187
|
-
@rpmdep.version.v.
|
1188
|
-
@rpmdep.version.r.
|
1189
|
-
@rpmdep.flag.
|
1185
|
+
expect(@rpmdep.name).to eq("testing")
|
1186
|
+
expect(@rpmdep.version.e).to eq(1)
|
1187
|
+
expect(@rpmdep.version.v).to eq("1.6.5")
|
1188
|
+
expect(@rpmdep.version.r).to eq("9.36.el5")
|
1189
|
+
expect(@rpmdep.flag).to eq(:==)
|
1190
1190
|
end
|
1191
1191
|
end
|
1192
1192
|
|
1193
1193
|
it "should raise an error unless passed 3 or 5 args" do
|
1194
|
-
|
1194
|
+
expect {
|
1195
1195
|
Chef::Provider::Package::Yum::RPMDependency.new()
|
1196
|
-
}.
|
1197
|
-
|
1196
|
+
}.to raise_error(ArgumentError)
|
1197
|
+
expect {
|
1198
1198
|
Chef::Provider::Package::Yum::RPMDependency.new("testing")
|
1199
|
-
}.
|
1200
|
-
|
1199
|
+
}.to raise_error(ArgumentError)
|
1200
|
+
expect {
|
1201
1201
|
Chef::Provider::Package::Yum::RPMDependency.new("testing", "1:1.6.5-9.36.el5")
|
1202
|
-
}.
|
1203
|
-
|
1202
|
+
}.to raise_error(ArgumentError)
|
1203
|
+
expect {
|
1204
1204
|
Chef::Provider::Package::Yum::RPMDependency.new("testing", "1:1.6.5-9.36.el5", :==)
|
1205
|
-
}.
|
1206
|
-
|
1205
|
+
}.not_to raise_error
|
1206
|
+
expect {
|
1207
1207
|
Chef::Provider::Package::Yum::RPMDependency.new("testing", "1:1.6.5-9.36.el5", :==, "extra")
|
1208
|
-
}.
|
1209
|
-
|
1208
|
+
}.to raise_error(ArgumentError)
|
1209
|
+
expect {
|
1210
1210
|
Chef::Provider::Package::Yum::RPMDependency.new("testing", "1", "1.6.5", "9.36.el5", :==)
|
1211
|
-
}.
|
1212
|
-
|
1211
|
+
}.not_to raise_error
|
1212
|
+
expect {
|
1213
1213
|
Chef::Provider::Package::Yum::RPMDependency.new("testing", "1", "1.6.5", "9.36.el5", :==, "extra")
|
1214
|
-
}.
|
1214
|
+
}.to raise_error(ArgumentError)
|
1215
1215
|
end
|
1216
1216
|
|
1217
1217
|
describe "parse" do
|
1218
1218
|
it "should parse a name, flag, version string into a valid RPMDependency object" do
|
1219
1219
|
@rpmdep = Chef::Provider::Package::Yum::RPMDependency.parse("testing >= 1:1.6.5-9.36.el5")
|
1220
1220
|
|
1221
|
-
@rpmdep.name.
|
1222
|
-
@rpmdep.version.e.
|
1223
|
-
@rpmdep.version.v.
|
1224
|
-
@rpmdep.version.r.
|
1225
|
-
@rpmdep.flag.
|
1221
|
+
expect(@rpmdep.name).to eq("testing")
|
1222
|
+
expect(@rpmdep.version.e).to eq(1)
|
1223
|
+
expect(@rpmdep.version.v).to eq("1.6.5")
|
1224
|
+
expect(@rpmdep.version.r).to eq("9.36.el5")
|
1225
|
+
expect(@rpmdep.flag).to eq(:>=)
|
1226
1226
|
end
|
1227
1227
|
|
1228
1228
|
it "should parse a name into a valid RPMDependency object" do
|
1229
1229
|
@rpmdep = Chef::Provider::Package::Yum::RPMDependency.parse("testing")
|
1230
1230
|
|
1231
|
-
@rpmdep.name.
|
1232
|
-
@rpmdep.version.e.
|
1233
|
-
@rpmdep.version.v.
|
1234
|
-
@rpmdep.version.r.
|
1235
|
-
@rpmdep.flag.
|
1231
|
+
expect(@rpmdep.name).to eq("testing")
|
1232
|
+
expect(@rpmdep.version.e).to eq(nil)
|
1233
|
+
expect(@rpmdep.version.v).to eq(nil)
|
1234
|
+
expect(@rpmdep.version.r).to eq(nil)
|
1235
|
+
expect(@rpmdep.flag).to eq(:==)
|
1236
1236
|
end
|
1237
1237
|
|
1238
1238
|
it "should parse an invalid string into the name of a RPMDependency object" do
|
1239
1239
|
@rpmdep = Chef::Provider::Package::Yum::RPMDependency.parse("testing blah >")
|
1240
1240
|
|
1241
|
-
@rpmdep.name.
|
1242
|
-
@rpmdep.version.e.
|
1243
|
-
@rpmdep.version.v.
|
1244
|
-
@rpmdep.version.r.
|
1245
|
-
@rpmdep.flag.
|
1241
|
+
expect(@rpmdep.name).to eq("testing blah >")
|
1242
|
+
expect(@rpmdep.version.e).to eq(nil)
|
1243
|
+
expect(@rpmdep.version.v).to eq(nil)
|
1244
|
+
expect(@rpmdep.version.r).to eq(nil)
|
1245
|
+
expect(@rpmdep.flag).to eq(:==)
|
1246
1246
|
end
|
1247
1247
|
|
1248
1248
|
it "should parse various valid flags" do
|
@@ -1255,7 +1255,7 @@ describe Chef::Provider::Package::Yum::RPMDependency do
|
|
1255
1255
|
[ "<", :< ]
|
1256
1256
|
].each do |before, after|
|
1257
1257
|
@rpmdep = Chef::Provider::Package::Yum::RPMDependency.parse("testing #{before} 1:1.1-1")
|
1258
|
-
@rpmdep.flag.
|
1258
|
+
expect(@rpmdep.flag).to eq(after)
|
1259
1259
|
end
|
1260
1260
|
end
|
1261
1261
|
|
@@ -1269,8 +1269,8 @@ describe Chef::Provider::Package::Yum::RPMDependency do
|
|
1269
1269
|
[ "~", :== ]
|
1270
1270
|
].each do |before, after|
|
1271
1271
|
@rpmdep = Chef::Provider::Package::Yum::RPMDependency.parse("testing #{before} 1:1.1-1")
|
1272
|
-
@rpmdep.name.
|
1273
|
-
@rpmdep.flag.
|
1272
|
+
expect(@rpmdep.name).to eq("testing #{before} 1:1.1-1")
|
1273
|
+
expect(@rpmdep.flag).to eq(after)
|
1274
1274
|
end
|
1275
1275
|
end
|
1276
1276
|
end
|
@@ -1279,12 +1279,12 @@ describe Chef::Provider::Package::Yum::RPMDependency do
|
|
1279
1279
|
it "should raise an error unless a RPMDependency is passed" do
|
1280
1280
|
@rpmprovide = Chef::Provider::Package::Yum::RPMDependency.new("testing", "1:1.6.5-9.36.el5", :==)
|
1281
1281
|
@rpmrequire = Chef::Provider::Package::Yum::RPMDependency.new("testing", "1:1.6.5-9.36.el5", :>=)
|
1282
|
-
|
1282
|
+
expect {
|
1283
1283
|
@rpmprovide.satisfy?("hi")
|
1284
|
-
}.
|
1285
|
-
|
1284
|
+
}.to raise_error(ArgumentError)
|
1285
|
+
expect {
|
1286
1286
|
@rpmprovide.satisfy?(@rpmrequire)
|
1287
|
-
}.
|
1287
|
+
}.not_to raise_error
|
1288
1288
|
end
|
1289
1289
|
|
1290
1290
|
it "should validate dependency satisfaction logic for standard examples" do
|
@@ -1326,8 +1326,8 @@ describe Chef::Provider::Package::Yum::RPMDependency do
|
|
1326
1326
|
@rpmprovide = Chef::Provider::Package::Yum::RPMDependency.parse(prov)
|
1327
1327
|
@rpmrequire = Chef::Provider::Package::Yum::RPMDependency.parse(req)
|
1328
1328
|
|
1329
|
-
@rpmprovide.satisfy?(@rpmrequire).
|
1330
|
-
@rpmrequire.satisfy?(@rpmprovide).
|
1329
|
+
expect(@rpmprovide.satisfy?(@rpmrequire)).to eq(result)
|
1330
|
+
expect(@rpmrequire.satisfy?(@rpmprovide)).to eq(result)
|
1331
1331
|
end
|
1332
1332
|
end
|
1333
1333
|
end
|
@@ -1358,89 +1358,89 @@ describe Chef::Provider::Package::Yum::RPMDb do
|
|
1358
1358
|
|
1359
1359
|
describe "initialize" do
|
1360
1360
|
it "should return a Chef::Provider::Package::Yum::RPMDb object" do
|
1361
|
-
@rpmdb.
|
1361
|
+
expect(@rpmdb).to be_kind_of(Chef::Provider::Package::Yum::RPMDb)
|
1362
1362
|
end
|
1363
1363
|
end
|
1364
1364
|
|
1365
1365
|
describe "push" do
|
1366
1366
|
it "should accept an RPMDbPackage object through pushing" do
|
1367
|
-
|
1367
|
+
expect { @rpmdb.push(@rpm_w) }.not_to raise_error
|
1368
1368
|
end
|
1369
1369
|
|
1370
1370
|
it "should accept multiple RPMDbPackage object through pushing" do
|
1371
|
-
|
1371
|
+
expect { @rpmdb.push(@rpm_w, @rpm_x, @rpm_y, @rpm_z) }.not_to raise_error
|
1372
1372
|
end
|
1373
1373
|
|
1374
1374
|
it "should only accept an RPMDbPackage object" do
|
1375
|
-
|
1375
|
+
expect { @rpmdb.push("string") }.to raise_error
|
1376
1376
|
end
|
1377
1377
|
|
1378
1378
|
it "should add the package to the package db" do
|
1379
1379
|
@rpmdb.push(@rpm_w)
|
1380
|
-
@rpmdb["test-package-b"].
|
1380
|
+
expect(@rpmdb["test-package-b"]).not_to eq(nil)
|
1381
1381
|
end
|
1382
1382
|
|
1383
1383
|
it "should add conditionally add the package to the available list" do
|
1384
|
-
@rpmdb.available_size.
|
1384
|
+
expect(@rpmdb.available_size).to eq(0)
|
1385
1385
|
@rpmdb.push(@rpm_v, @rpm_w)
|
1386
|
-
@rpmdb.available_size.
|
1386
|
+
expect(@rpmdb.available_size).to eq(1)
|
1387
1387
|
end
|
1388
1388
|
|
1389
1389
|
it "should add conditionally add the package to the installed list" do
|
1390
|
-
@rpmdb.installed_size.
|
1390
|
+
expect(@rpmdb.installed_size).to eq(0)
|
1391
1391
|
@rpmdb.push(@rpm_w, @rpm_x)
|
1392
|
-
@rpmdb.installed_size.
|
1392
|
+
expect(@rpmdb.installed_size).to eq(1)
|
1393
1393
|
end
|
1394
1394
|
|
1395
1395
|
it "should have a total of 2 packages in the RPMDb" do
|
1396
|
-
@rpmdb.size.
|
1396
|
+
expect(@rpmdb.size).to eq(0)
|
1397
1397
|
@rpmdb.push(@rpm_w, @rpm_x, @rpm_y, @rpm_z)
|
1398
|
-
@rpmdb.size.
|
1398
|
+
expect(@rpmdb.size).to eq(2)
|
1399
1399
|
end
|
1400
1400
|
|
1401
1401
|
it "should keep the Array unique when a duplicate is pushed" do
|
1402
1402
|
@rpmdb.push(@rpm_z, @rpm_z_mirror)
|
1403
|
-
@rpmdb["test-package-c"].size.
|
1403
|
+
expect(@rpmdb["test-package-c"].size).to eq(1)
|
1404
1404
|
end
|
1405
1405
|
|
1406
1406
|
it "should register the package provides in the provides index" do
|
1407
1407
|
@rpmdb.push(@rpm_v, @rpm_w, @rpm_z)
|
1408
|
-
@rpmdb.lookup_provides("test-package-a")[0].
|
1409
|
-
@rpmdb.lookup_provides("config(test)")[0].
|
1410
|
-
@rpmdb.lookup_provides("libz.so.1()(64bit)")[0].
|
1411
|
-
@rpmdb.lookup_provides("libz.so.1()(64bit)")[1].
|
1408
|
+
expect(@rpmdb.lookup_provides("test-package-a")[0]).to eq(@rpm_v)
|
1409
|
+
expect(@rpmdb.lookup_provides("config(test)")[0]).to eq(@rpm_z)
|
1410
|
+
expect(@rpmdb.lookup_provides("libz.so.1()(64bit)")[0]).to eq(@rpm_v)
|
1411
|
+
expect(@rpmdb.lookup_provides("libz.so.1()(64bit)")[1]).to eq(@rpm_z)
|
1412
1412
|
end
|
1413
1413
|
end
|
1414
1414
|
|
1415
1415
|
describe "<<" do
|
1416
1416
|
it "should accept an RPMPackage object through the << operator" do
|
1417
|
-
|
1417
|
+
expect { @rpmdb << @rpm_w }.not_to raise_error
|
1418
1418
|
end
|
1419
1419
|
end
|
1420
1420
|
|
1421
1421
|
describe "lookup" do
|
1422
1422
|
it "should return an Array of RPMPackage objects by index" do
|
1423
1423
|
@rpmdb << @rpm_w
|
1424
|
-
@rpmdb.lookup("test-package-b").
|
1424
|
+
expect(@rpmdb.lookup("test-package-b")).to be_kind_of(Array)
|
1425
1425
|
end
|
1426
1426
|
end
|
1427
1427
|
|
1428
1428
|
describe "[]" do
|
1429
1429
|
it "should return an Array of RPMPackage objects though the [index] operator" do
|
1430
1430
|
@rpmdb << @rpm_w
|
1431
|
-
@rpmdb["test-package-b"].
|
1431
|
+
expect(@rpmdb["test-package-b"]).to be_kind_of(Array)
|
1432
1432
|
end
|
1433
1433
|
|
1434
1434
|
it "should return an Array of 3 RPMPackage objects" do
|
1435
1435
|
@rpmdb.push(@rpm_w, @rpm_x, @rpm_y, @rpm_z)
|
1436
|
-
@rpmdb["test-package-b"].size.
|
1436
|
+
expect(@rpmdb["test-package-b"].size).to eq(3)
|
1437
1437
|
end
|
1438
1438
|
|
1439
1439
|
it "should return an Array of RPMPackage objects sorted from newest to oldest" do
|
1440
1440
|
@rpmdb.push(@rpm_w, @rpm_x, @rpm_y, @rpm_z)
|
1441
|
-
@rpmdb["test-package-b"][0].
|
1442
|
-
@rpmdb["test-package-b"][1].
|
1443
|
-
@rpmdb["test-package-b"][2].
|
1441
|
+
expect(@rpmdb["test-package-b"][0]).to eq(@rpm_y)
|
1442
|
+
expect(@rpmdb["test-package-b"][1]).to eq(@rpm_x)
|
1443
|
+
expect(@rpmdb["test-package-b"][2]).to eq(@rpm_w)
|
1444
1444
|
end
|
1445
1445
|
end
|
1446
1446
|
|
@@ -1448,57 +1448,57 @@ describe Chef::Provider::Package::Yum::RPMDb do
|
|
1448
1448
|
it "should return an Array of RPMPackage objects by index" do
|
1449
1449
|
@rpmdb << @rpm_z
|
1450
1450
|
x = @rpmdb.lookup_provides("config(test)")
|
1451
|
-
x.
|
1452
|
-
x[0].
|
1451
|
+
expect(x).to be_kind_of(Array)
|
1452
|
+
expect(x[0]).to eq(@rpm_z)
|
1453
1453
|
end
|
1454
1454
|
end
|
1455
1455
|
|
1456
1456
|
describe "clear" do
|
1457
1457
|
it "should clear the RPMDb" do
|
1458
|
-
@rpmdb.
|
1459
|
-
@rpmdb.
|
1458
|
+
expect(@rpmdb).to receive(:clear_available).once
|
1459
|
+
expect(@rpmdb).to receive(:clear_installed).once
|
1460
1460
|
@rpmdb.push(@rpm_w, @rpm_x, @rpm_y, @rpm_z)
|
1461
|
-
@rpmdb.size.
|
1462
|
-
@rpmdb.lookup_provides("config(test)").
|
1461
|
+
expect(@rpmdb.size).not_to eq(0)
|
1462
|
+
expect(@rpmdb.lookup_provides("config(test)")).to be_kind_of(Array)
|
1463
1463
|
@rpmdb.clear
|
1464
|
-
@rpmdb.lookup_provides("config(test)").
|
1465
|
-
@rpmdb.size.
|
1464
|
+
expect(@rpmdb.lookup_provides("config(test)")).to eq(nil)
|
1465
|
+
expect(@rpmdb.size).to eq(0)
|
1466
1466
|
end
|
1467
1467
|
end
|
1468
1468
|
|
1469
1469
|
describe "clear_available" do
|
1470
1470
|
it "should clear the available list" do
|
1471
1471
|
@rpmdb.push(@rpm_w, @rpm_x, @rpm_y, @rpm_z)
|
1472
|
-
@rpmdb.available_size.
|
1472
|
+
expect(@rpmdb.available_size).not_to eq(0)
|
1473
1473
|
@rpmdb.clear_available
|
1474
|
-
@rpmdb.available_size.
|
1474
|
+
expect(@rpmdb.available_size).to eq(0)
|
1475
1475
|
end
|
1476
1476
|
end
|
1477
1477
|
|
1478
1478
|
describe "available?" do
|
1479
1479
|
it "should return true if a package is available" do
|
1480
|
-
@rpmdb.available?(@rpm_w).
|
1480
|
+
expect(@rpmdb.available?(@rpm_w)).to eq(false)
|
1481
1481
|
@rpmdb.push(@rpm_v, @rpm_w)
|
1482
|
-
@rpmdb.available?(@rpm_v).
|
1483
|
-
@rpmdb.available?(@rpm_w).
|
1482
|
+
expect(@rpmdb.available?(@rpm_v)).to eq(false)
|
1483
|
+
expect(@rpmdb.available?(@rpm_w)).to eq(true)
|
1484
1484
|
end
|
1485
1485
|
end
|
1486
1486
|
|
1487
1487
|
describe "clear_installed" do
|
1488
1488
|
it "should clear the installed list" do
|
1489
1489
|
@rpmdb.push(@rpm_w, @rpm_x, @rpm_y, @rpm_z)
|
1490
|
-
@rpmdb.installed_size.
|
1490
|
+
expect(@rpmdb.installed_size).not_to eq(0)
|
1491
1491
|
@rpmdb.clear_installed
|
1492
|
-
@rpmdb.installed_size.
|
1492
|
+
expect(@rpmdb.installed_size).to eq(0)
|
1493
1493
|
end
|
1494
1494
|
end
|
1495
1495
|
|
1496
1496
|
describe "installed?" do
|
1497
1497
|
it "should return true if a package is installed" do
|
1498
|
-
@rpmdb.installed?(@rpm_w).
|
1498
|
+
expect(@rpmdb.installed?(@rpm_w)).to eq(false)
|
1499
1499
|
@rpmdb.push(@rpm_w, @rpm_x)
|
1500
|
-
@rpmdb.installed?(@rpm_w).
|
1501
|
-
@rpmdb.installed?(@rpm_x).
|
1500
|
+
expect(@rpmdb.installed?(@rpm_w)).to eq(true)
|
1501
|
+
expect(@rpmdb.installed?(@rpm_x)).to eq(false)
|
1502
1502
|
end
|
1503
1503
|
end
|
1504
1504
|
|
@@ -1506,12 +1506,12 @@ describe Chef::Provider::Package::Yum::RPMDb do
|
|
1506
1506
|
it "should raise an error unless a RPMDependency is passed" do
|
1507
1507
|
@rpmprovide = Chef::Provider::Package::Yum::RPMDependency.new("testing", "1:1.6.5-9.36.el5", :==)
|
1508
1508
|
@rpmrequire = Chef::Provider::Package::Yum::RPMDependency.new("testing", "1:1.6.5-9.36.el5", :>=)
|
1509
|
-
|
1509
|
+
expect {
|
1510
1510
|
@rpmdb.whatprovides("hi")
|
1511
|
-
}.
|
1512
|
-
|
1511
|
+
}.to raise_error(ArgumentError)
|
1512
|
+
expect {
|
1513
1513
|
@rpmdb.whatprovides(@rpmrequire)
|
1514
|
-
}.
|
1514
|
+
}.not_to raise_error
|
1515
1515
|
end
|
1516
1516
|
|
1517
1517
|
it "should return an Array of packages statisfying a RPMDependency" do
|
@@ -1519,14 +1519,14 @@ describe Chef::Provider::Package::Yum::RPMDb do
|
|
1519
1519
|
|
1520
1520
|
@rpmrequire = Chef::Provider::Package::Yum::RPMDependency.parse("test-package-a >= 1.6.5")
|
1521
1521
|
x = @rpmdb.whatprovides(@rpmrequire)
|
1522
|
-
x.
|
1523
|
-
x[0].
|
1522
|
+
expect(x).to be_kind_of(Array)
|
1523
|
+
expect(x[0]).to eq(@rpm_v)
|
1524
1524
|
|
1525
1525
|
@rpmrequire = Chef::Provider::Package::Yum::RPMDependency.parse("libz.so.1()(64bit)")
|
1526
1526
|
x = @rpmdb.whatprovides(@rpmrequire)
|
1527
|
-
x.
|
1528
|
-
x[0].
|
1529
|
-
x[1].
|
1527
|
+
expect(x).to be_kind_of(Array)
|
1528
|
+
expect(x[0]).to eq(@rpm_v)
|
1529
|
+
expect(x[1]).to eq(@rpm_z)
|
1530
1530
|
end
|
1531
1531
|
end
|
1532
1532
|
|
@@ -1592,18 +1592,18 @@ EOF
|
|
1592
1592
|
Chef::Provider::Package::Yum::YumCache.reset_instance
|
1593
1593
|
@yc = Chef::Provider::Package::Yum::YumCache.instance
|
1594
1594
|
# load valid data
|
1595
|
-
@yc.
|
1595
|
+
allow(@yc).to receive(:shell_out!).and_return(@status)
|
1596
1596
|
end
|
1597
1597
|
|
1598
1598
|
describe "initialize" do
|
1599
1599
|
it "should return a Chef::Provider::Package::Yum::YumCache object" do
|
1600
|
-
@yc.
|
1600
|
+
expect(@yc).to be_kind_of(Chef::Provider::Package::Yum::YumCache)
|
1601
1601
|
end
|
1602
1602
|
|
1603
1603
|
it "should register reload for start of Chef::Client runs" do
|
1604
1604
|
Chef::Provider::Package::Yum::YumCache.reset_instance
|
1605
|
-
Chef::Client.
|
1606
|
-
b.
|
1605
|
+
expect(Chef::Client).to receive(:when_run_starts) do |&b|
|
1606
|
+
expect(b).not_to be_nil
|
1607
1607
|
end
|
1608
1608
|
@yc = Chef::Provider::Package::Yum::YumCache.instance
|
1609
1609
|
end
|
@@ -1611,7 +1611,7 @@ EOF
|
|
1611
1611
|
|
1612
1612
|
describe "refresh" do
|
1613
1613
|
it "should implicitly call yum-dump.py only once by default after being instantiated" do
|
1614
|
-
@yc.
|
1614
|
+
expect(@yc).to receive(:shell_out!).once
|
1615
1615
|
@yc.installed_version("zlib")
|
1616
1616
|
@yc.reset
|
1617
1617
|
@yc.installed_version("zlib")
|
@@ -1619,226 +1619,226 @@ EOF
|
|
1619
1619
|
|
1620
1620
|
it "should run yum-dump.py using the system python when next_refresh is for :all" do
|
1621
1621
|
@yc.reload
|
1622
|
-
@yc.
|
1622
|
+
expect(@yc).to receive(:shell_out!).with(%r{^/usr/bin/python .*/yum-dump.py --options --installed-provides --yum-lock-timeout 30$}, :timeout=>Chef::Config[:yum_timeout])
|
1623
1623
|
@yc.refresh
|
1624
1624
|
end
|
1625
1625
|
|
1626
1626
|
it "should run yum-dump.py with the installed flag when next_refresh is for :installed" do
|
1627
1627
|
@yc.reload_installed
|
1628
|
-
@yc.
|
1628
|
+
expect(@yc).to receive(:shell_out!).with(%r{^/usr/bin/python .*/yum-dump.py --installed --yum-lock-timeout 30$}, :timeout=>Chef::Config[:yum_timeout])
|
1629
1629
|
@yc.refresh
|
1630
1630
|
end
|
1631
1631
|
|
1632
1632
|
it "should run yum-dump.py with the all-provides flag when next_refresh is for :provides" do
|
1633
1633
|
@yc.reload_provides
|
1634
|
-
@yc.
|
1634
|
+
expect(@yc).to receive(:shell_out!).with(%r{^/usr/bin/python .*/yum-dump.py --options --all-provides --yum-lock-timeout 30$}, :timeout=>Chef::Config[:yum_timeout])
|
1635
1635
|
@yc.refresh
|
1636
1636
|
end
|
1637
1637
|
|
1638
1638
|
it "should pass extra_repo_control args to yum-dump.py" do
|
1639
1639
|
@yc.enable_extra_repo_control("--enablerepo=foo --disablerepo=bar")
|
1640
|
-
@yc.
|
1640
|
+
expect(@yc).to receive(:shell_out!).with(%r{^/usr/bin/python .*/yum-dump.py --options --installed-provides --enablerepo=foo --disablerepo=bar --yum-lock-timeout 30$}, :timeout=>Chef::Config[:yum_timeout])
|
1641
1641
|
@yc.refresh
|
1642
1642
|
end
|
1643
1643
|
|
1644
1644
|
it "should pass extra_repo_control args and configured yum lock timeout to yum-dump.py" do
|
1645
1645
|
Chef::Config[:yum_lock_timeout] = 999
|
1646
1646
|
@yc.enable_extra_repo_control("--enablerepo=foo --disablerepo=bar")
|
1647
|
-
@yc.
|
1647
|
+
expect(@yc).to receive(:shell_out!).with(%r{^/usr/bin/python .*/yum-dump.py --options --installed-provides --enablerepo=foo --disablerepo=bar --yum-lock-timeout 999$}, :timeout=>Chef::Config[:yum_timeout])
|
1648
1648
|
@yc.refresh
|
1649
1649
|
end
|
1650
1650
|
|
1651
1651
|
it "should warn about invalid data with too many separators" do
|
1652
1652
|
@status = double("Status", :exitstatus => 0, :stdin => @stdin, :stdout => @stdout_bad_separators, :stderr => @stderr)
|
1653
|
-
@yc.
|
1654
|
-
Chef::Log.
|
1653
|
+
allow(@yc).to receive(:shell_out!).and_return(@status)
|
1654
|
+
expect(Chef::Log).to receive(:warn).exactly(3).times.with(%r{Problem parsing})
|
1655
1655
|
@yc.refresh
|
1656
1656
|
end
|
1657
1657
|
|
1658
1658
|
it "should warn about invalid data with an incorrect type" do
|
1659
1659
|
@status = double("Status", :exitstatus => 0, :stdin => @stdin, :stdout => @stdout_bad_type, :stderr => @stderr)
|
1660
|
-
@yc.
|
1661
|
-
Chef::Log.
|
1660
|
+
allow(@yc).to receive(:shell_out!).and_return(@status)
|
1661
|
+
expect(Chef::Log).to receive(:warn).exactly(2).times.with(%r{Problem parsing})
|
1662
1662
|
@yc.refresh
|
1663
1663
|
end
|
1664
1664
|
|
1665
1665
|
it "should warn about no output from yum-dump.py" do
|
1666
1666
|
@status = double("Status", :exitstatus => 0, :stdin => @stdin, :stdout => @stdout_no_output, :stderr => @stderr)
|
1667
|
-
@yc.
|
1668
|
-
Chef::Log.
|
1667
|
+
allow(@yc).to receive(:shell_out!).and_return(@status)
|
1668
|
+
expect(Chef::Log).to receive(:warn).exactly(1).times.with(%r{no output from yum-dump.py})
|
1669
1669
|
@yc.refresh
|
1670
1670
|
end
|
1671
1671
|
|
1672
1672
|
it "should raise exception yum-dump.py exits with a non zero status" do
|
1673
1673
|
@status = double("Status", :exitstatus => 1, :stdin => @stdin, :stdout => @stdout_no_output, :stderr => @stderr)
|
1674
|
-
@yc.
|
1675
|
-
|
1674
|
+
allow(@yc).to receive(:shell_out!).and_return(@status)
|
1675
|
+
expect { @yc.refresh}.to raise_error(Chef::Exceptions::Package, %r{CentOS-Base.repo, line: 12})
|
1676
1676
|
end
|
1677
1677
|
|
1678
1678
|
it "should parse type 'i' into an installed state for a package" do
|
1679
|
-
@yc.available_version("erlang-mochiweb").
|
1680
|
-
@yc.installed_version("erlang-mochiweb").
|
1679
|
+
expect(@yc.available_version("erlang-mochiweb")).to eq(nil)
|
1680
|
+
expect(@yc.installed_version("erlang-mochiweb")).not_to eq(nil)
|
1681
1681
|
end
|
1682
1682
|
|
1683
1683
|
it "should parse type 'a' into an available state for a package" do
|
1684
|
-
@yc.available_version("znc").
|
1685
|
-
@yc.installed_version("znc").
|
1684
|
+
expect(@yc.available_version("znc")).not_to eq(nil)
|
1685
|
+
expect(@yc.installed_version("znc")).to eq(nil)
|
1686
1686
|
end
|
1687
1687
|
|
1688
1688
|
it "should parse type 'r' into an installed and available states for a package" do
|
1689
|
-
@yc.available_version("zip").
|
1690
|
-
@yc.installed_version("zip").
|
1689
|
+
expect(@yc.available_version("zip")).not_to eq(nil)
|
1690
|
+
expect(@yc.installed_version("zip")).not_to eq(nil)
|
1691
1691
|
end
|
1692
1692
|
|
1693
1693
|
it "should parse installonlypkgs from yum-dump.py options output" do
|
1694
|
-
@yc.allow_multi_install.
|
1694
|
+
expect(@yc.allow_multi_install).to eq(%w{kernel kernel-bigmem kernel-enterprise})
|
1695
1695
|
end
|
1696
1696
|
end
|
1697
1697
|
|
1698
1698
|
describe "installed_version" do
|
1699
1699
|
it "should take one or two arguments" do
|
1700
|
-
|
1701
|
-
|
1702
|
-
|
1700
|
+
expect { @yc.installed_version("zip") }.not_to raise_error
|
1701
|
+
expect { @yc.installed_version("zip", "i386") }.not_to raise_error
|
1702
|
+
expect { @yc.installed_version("zip", "i386", "extra") }.to raise_error(ArgumentError)
|
1703
1703
|
end
|
1704
1704
|
|
1705
1705
|
it "should return version-release for matching package regardless of arch" do
|
1706
|
-
@yc.installed_version("zip", "x86_64").
|
1707
|
-
@yc.installed_version("zip", nil).
|
1706
|
+
expect(@yc.installed_version("zip", "x86_64")).to eq("2.31-2.el5")
|
1707
|
+
expect(@yc.installed_version("zip", nil)).to eq("2.31-2.el5")
|
1708
1708
|
end
|
1709
1709
|
|
1710
1710
|
it "should return version-release for matching package and arch" do
|
1711
|
-
@yc.installed_version("zip", "x86_64").
|
1712
|
-
@yc.installed_version("zisofs-tools", "i386").
|
1711
|
+
expect(@yc.installed_version("zip", "x86_64")).to eq("2.31-2.el5")
|
1712
|
+
expect(@yc.installed_version("zisofs-tools", "i386")).to eq(nil)
|
1713
1713
|
end
|
1714
1714
|
|
1715
1715
|
it "should return nil for an unmatched package" do
|
1716
|
-
@yc.installed_version(nil, nil).
|
1717
|
-
@yc.installed_version("test1", nil).
|
1718
|
-
@yc.installed_version("test2", "x86_64").
|
1716
|
+
expect(@yc.installed_version(nil, nil)).to eq(nil)
|
1717
|
+
expect(@yc.installed_version("test1", nil)).to eq(nil)
|
1718
|
+
expect(@yc.installed_version("test2", "x86_64")).to eq(nil)
|
1719
1719
|
end
|
1720
1720
|
end
|
1721
1721
|
|
1722
1722
|
describe "available_version" do
|
1723
1723
|
it "should take one or two arguments" do
|
1724
|
-
|
1725
|
-
|
1726
|
-
|
1724
|
+
expect { @yc.available_version("zisofs-tools") }.not_to raise_error
|
1725
|
+
expect { @yc.available_version("zisofs-tools", "i386") }.not_to raise_error
|
1726
|
+
expect { @yc.available_version("zisofs-tools", "i386", "extra") }.to raise_error(ArgumentError)
|
1727
1727
|
end
|
1728
1728
|
|
1729
1729
|
it "should return version-release for matching package regardless of arch" do
|
1730
|
-
@yc.available_version("zip", "x86_64").
|
1731
|
-
@yc.available_version("zip", nil).
|
1730
|
+
expect(@yc.available_version("zip", "x86_64")).to eq("2.31-2.el5")
|
1731
|
+
expect(@yc.available_version("zip", nil)).to eq("2.31-2.el5")
|
1732
1732
|
end
|
1733
1733
|
|
1734
1734
|
it "should return version-release for matching package and arch" do
|
1735
|
-
@yc.available_version("zip", "x86_64").
|
1736
|
-
@yc.available_version("zisofs-tools", "i386").
|
1735
|
+
expect(@yc.available_version("zip", "x86_64")).to eq("2.31-2.el5")
|
1736
|
+
expect(@yc.available_version("zisofs-tools", "i386")).to eq(nil)
|
1737
1737
|
end
|
1738
1738
|
|
1739
1739
|
it "should return nil for an unmatched package" do
|
1740
|
-
@yc.available_version(nil, nil).
|
1741
|
-
@yc.available_version("test1", nil).
|
1742
|
-
@yc.available_version("test2", "x86_64").
|
1740
|
+
expect(@yc.available_version(nil, nil)).to eq(nil)
|
1741
|
+
expect(@yc.available_version("test1", nil)).to eq(nil)
|
1742
|
+
expect(@yc.available_version("test2", "x86_64")).to eq(nil)
|
1743
1743
|
end
|
1744
1744
|
end
|
1745
1745
|
|
1746
1746
|
describe "version_available?" do
|
1747
1747
|
it "should take two or three arguments" do
|
1748
|
-
|
1749
|
-
|
1750
|
-
|
1748
|
+
expect { @yc.version_available?("zisofs-tools") }.to raise_error(ArgumentError)
|
1749
|
+
expect { @yc.version_available?("zisofs-tools", "1.0.6-3.2.2") }.not_to raise_error
|
1750
|
+
expect { @yc.version_available?("zisofs-tools", "1.0.6-3.2.2", "x86_64") }.not_to raise_error
|
1751
1751
|
end
|
1752
1752
|
|
1753
1753
|
it "should return true if our package-version-arch is available" do
|
1754
|
-
@yc.version_available?("zisofs-tools", "1.0.6-3.2.2", "x86_64").
|
1754
|
+
expect(@yc.version_available?("zisofs-tools", "1.0.6-3.2.2", "x86_64")).to eq(true)
|
1755
1755
|
end
|
1756
1756
|
|
1757
1757
|
it "should return true if our package-version, no arch, is available" do
|
1758
|
-
@yc.version_available?("zisofs-tools", "1.0.6-3.2.2", nil).
|
1759
|
-
@yc.version_available?("zisofs-tools", "1.0.6-3.2.2").
|
1758
|
+
expect(@yc.version_available?("zisofs-tools", "1.0.6-3.2.2", nil)).to eq(true)
|
1759
|
+
expect(@yc.version_available?("zisofs-tools", "1.0.6-3.2.2")).to eq(true)
|
1760
1760
|
end
|
1761
1761
|
|
1762
1762
|
it "should return false if our package-version-arch isn't available" do
|
1763
|
-
@yc.version_available?("zisofs-tools", "1.0.6-3.2.2", "pretend").
|
1764
|
-
@yc.version_available?("zisofs-tools", "pretend", "x86_64").
|
1765
|
-
@yc.version_available?("pretend", "1.0.6-3.2.2", "x86_64").
|
1763
|
+
expect(@yc.version_available?("zisofs-tools", "1.0.6-3.2.2", "pretend")).to eq(false)
|
1764
|
+
expect(@yc.version_available?("zisofs-tools", "pretend", "x86_64")).to eq(false)
|
1765
|
+
expect(@yc.version_available?("pretend", "1.0.6-3.2.2", "x86_64")).to eq(false)
|
1766
1766
|
end
|
1767
1767
|
|
1768
1768
|
it "should return false if our package-version, no arch, isn't available" do
|
1769
|
-
@yc.version_available?("zisofs-tools", "pretend", nil).
|
1770
|
-
@yc.version_available?("zisofs-tools", "pretend").
|
1771
|
-
@yc.version_available?("pretend", "1.0.6-3.2.2").
|
1769
|
+
expect(@yc.version_available?("zisofs-tools", "pretend", nil)).to eq(false)
|
1770
|
+
expect(@yc.version_available?("zisofs-tools", "pretend")).to eq(false)
|
1771
|
+
expect(@yc.version_available?("pretend", "1.0.6-3.2.2")).to eq(false)
|
1772
1772
|
end
|
1773
1773
|
end
|
1774
1774
|
|
1775
1775
|
describe "package_repository" do
|
1776
1776
|
it "should take two or three arguments" do
|
1777
|
-
|
1778
|
-
|
1779
|
-
|
1777
|
+
expect { @yc.package_repository("zisofs-tools") }.to raise_error(ArgumentError)
|
1778
|
+
expect { @yc.package_repository("zisofs-tools", "1.0.6-3.2.2") }.not_to raise_error
|
1779
|
+
expect { @yc.package_repository("zisofs-tools", "1.0.6-3.2.2", "x86_64") }.not_to raise_error
|
1780
1780
|
end
|
1781
1781
|
|
1782
1782
|
it "should return repoid for package-version-arch" do
|
1783
|
-
@yc.package_repository("zlib-devel", "1.2.3-3", "i386").
|
1784
|
-
@yc.package_repository("zlib-devel", "1.2.3-3", "x86_64").
|
1783
|
+
expect(@yc.package_repository("zlib-devel", "1.2.3-3", "i386")).to eq("extras")
|
1784
|
+
expect(@yc.package_repository("zlib-devel", "1.2.3-3", "x86_64")).to eq("base")
|
1785
1785
|
end
|
1786
1786
|
|
1787
1787
|
it "should return repoid for package-version, no arch" do
|
1788
|
-
@yc.package_repository("zisofs-tools", "1.0.6-3.2.2", nil).
|
1789
|
-
@yc.package_repository("zisofs-tools", "1.0.6-3.2.2").
|
1788
|
+
expect(@yc.package_repository("zisofs-tools", "1.0.6-3.2.2", nil)).to eq("extras")
|
1789
|
+
expect(@yc.package_repository("zisofs-tools", "1.0.6-3.2.2")).to eq("extras")
|
1790
1790
|
end
|
1791
1791
|
|
1792
1792
|
it "should return nil when no match for package-version-arch" do
|
1793
|
-
@yc.package_repository("zisofs-tools", "1.0.6-3.2.2", "pretend").
|
1794
|
-
@yc.package_repository("zisofs-tools", "pretend", "x86_64").
|
1795
|
-
@yc.package_repository("pretend", "1.0.6-3.2.2", "x86_64").
|
1793
|
+
expect(@yc.package_repository("zisofs-tools", "1.0.6-3.2.2", "pretend")).to eq(nil)
|
1794
|
+
expect(@yc.package_repository("zisofs-tools", "pretend", "x86_64")).to eq(nil)
|
1795
|
+
expect(@yc.package_repository("pretend", "1.0.6-3.2.2", "x86_64")).to eq(nil)
|
1796
1796
|
end
|
1797
1797
|
|
1798
1798
|
it "should return nil when no match for package-version, no arch" do
|
1799
|
-
@yc.package_repository("zisofs-tools", "pretend", nil).
|
1800
|
-
@yc.package_repository("zisofs-tools", "pretend").
|
1801
|
-
@yc.package_repository("pretend", "1.0.6-3.2.2").
|
1799
|
+
expect(@yc.package_repository("zisofs-tools", "pretend", nil)).to eq(nil)
|
1800
|
+
expect(@yc.package_repository("zisofs-tools", "pretend")).to eq(nil)
|
1801
|
+
expect(@yc.package_repository("pretend", "1.0.6-3.2.2")).to eq(nil)
|
1802
1802
|
end
|
1803
1803
|
end
|
1804
1804
|
|
1805
1805
|
describe "reset" do
|
1806
1806
|
it "should empty the installed and available packages RPMDb" do
|
1807
|
-
@yc.available_version("zip", "x86_64").
|
1808
|
-
@yc.installed_version("zip", "x86_64").
|
1807
|
+
expect(@yc.available_version("zip", "x86_64")).to eq("2.31-2.el5")
|
1808
|
+
expect(@yc.installed_version("zip", "x86_64")).to eq("2.31-2.el5")
|
1809
1809
|
@yc.reset
|
1810
|
-
@yc.available_version("zip", "x86_64").
|
1811
|
-
@yc.installed_version("zip", "x86_64").
|
1810
|
+
expect(@yc.available_version("zip", "x86_64")).to eq(nil)
|
1811
|
+
expect(@yc.installed_version("zip", "x86_64")).to eq(nil)
|
1812
1812
|
end
|
1813
1813
|
end
|
1814
1814
|
|
1815
1815
|
describe "package_available?" do
|
1816
1816
|
it "should return true a package name is available" do
|
1817
|
-
@yc.package_available?("zisofs-tools").
|
1818
|
-
@yc.package_available?("moo").
|
1819
|
-
@yc.package_available?(nil).
|
1817
|
+
expect(@yc.package_available?("zisofs-tools")).to eq(true)
|
1818
|
+
expect(@yc.package_available?("moo")).to eq(false)
|
1819
|
+
expect(@yc.package_available?(nil)).to eq(false)
|
1820
1820
|
end
|
1821
1821
|
|
1822
1822
|
it "should return true a package name + arch is available" do
|
1823
|
-
@yc.package_available?("zlib-devel.i386").
|
1824
|
-
@yc.package_available?("zisofs-tools.x86_64").
|
1825
|
-
@yc.package_available?("znc-test.beta1.x86_64").
|
1826
|
-
@yc.package_available?("znc-test.beta1").
|
1827
|
-
@yc.package_available?("znc-test.test.beta1").
|
1828
|
-
@yc.package_available?("moo.i386").
|
1829
|
-
@yc.package_available?("zisofs-tools.beta").
|
1830
|
-
@yc.package_available?("znc-test.test").
|
1823
|
+
expect(@yc.package_available?("zlib-devel.i386")).to eq(true)
|
1824
|
+
expect(@yc.package_available?("zisofs-tools.x86_64")).to eq(true)
|
1825
|
+
expect(@yc.package_available?("znc-test.beta1.x86_64")).to eq(true)
|
1826
|
+
expect(@yc.package_available?("znc-test.beta1")).to eq(true)
|
1827
|
+
expect(@yc.package_available?("znc-test.test.beta1")).to eq(true)
|
1828
|
+
expect(@yc.package_available?("moo.i386")).to eq(false)
|
1829
|
+
expect(@yc.package_available?("zisofs-tools.beta")).to eq(false)
|
1830
|
+
expect(@yc.package_available?("znc-test.test")).to eq(false)
|
1831
1831
|
end
|
1832
1832
|
end
|
1833
1833
|
|
1834
1834
|
describe "enable_extra_repo_control" do
|
1835
1835
|
it "should set @extra_repo_control to arg" do
|
1836
1836
|
@yc.enable_extra_repo_control("--enablerepo=test")
|
1837
|
-
@yc.extra_repo_control.
|
1837
|
+
expect(@yc.extra_repo_control).to eq("--enablerepo=test")
|
1838
1838
|
end
|
1839
1839
|
|
1840
1840
|
it "should call reload once when set to flag cache for update" do
|
1841
|
-
@yc.
|
1841
|
+
expect(@yc).to receive(:reload).once
|
1842
1842
|
@yc.enable_extra_repo_control("--enablerepo=test")
|
1843
1843
|
@yc.enable_extra_repo_control("--enablerepo=test")
|
1844
1844
|
end
|
@@ -1848,13 +1848,13 @@ EOF
|
|
1848
1848
|
it "should set @extra_repo_control to nil" do
|
1849
1849
|
@yc.enable_extra_repo_control("--enablerepo=test")
|
1850
1850
|
@yc.disable_extra_repo_control
|
1851
|
-
@yc.extra_repo_control.
|
1851
|
+
expect(@yc.extra_repo_control).to eq(nil)
|
1852
1852
|
end
|
1853
1853
|
|
1854
1854
|
it "should call reload once when cleared to flag cache for update" do
|
1855
|
-
@yc.
|
1855
|
+
expect(@yc).to receive(:reload).once
|
1856
1856
|
@yc.enable_extra_repo_control("--enablerepo=test")
|
1857
|
-
@yc.
|
1857
|
+
expect(@yc).to receive(:reload).once
|
1858
1858
|
@yc.disable_extra_repo_control
|
1859
1859
|
@yc.disable_extra_repo_control
|
1860
1860
|
end
|