chef 14.1.12-universal-mingw32 → 14.2.0-universal-mingw32
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +1 -6
- data/VERSION +1 -1
- data/chef.gemspec +2 -3
- data/lib/chef/chef_fs/data_handler/data_handler_base.rb +8 -4
- data/lib/chef/cookbook/manifest_v0.rb +2 -2
- data/lib/chef/cookbook_manifest.rb +3 -2
- data/lib/chef/cookbook_version.rb +3 -2
- data/lib/chef/guard_interpreter/default_guard_interpreter.rb +2 -2
- data/lib/chef/http/auth_credentials.rb +5 -3
- data/lib/chef/http/authenticator.rb +6 -3
- data/lib/chef/knife.rb +3 -6
- data/lib/chef/knife/configure.rb +12 -8
- data/lib/chef/knife/raw.rb +6 -1
- data/lib/chef/mixin/shell_out.rb +16 -14
- data/lib/chef/provider/execute.rb +4 -3
- data/lib/chef/provider/git.rb +1 -1
- data/lib/chef/provider/package/dnf.rb +5 -5
- data/lib/chef/provider/package/windows.rb +7 -0
- data/lib/chef/provider/package/yum.rb +7 -7
- data/lib/chef/provider/service/freebsd.rb +3 -3
- data/lib/chef/provider/service/init.rb +5 -5
- data/lib/chef/provider/service/macosx.rb +5 -4
- data/lib/chef/provider/service/simple.rb +4 -4
- data/lib/chef/provider/service/systemd.rb +13 -13
- data/lib/chef/provider/service/upstart.rb +3 -3
- data/lib/chef/provider/service/windows.rb +2 -0
- data/lib/chef/provider/systemd_unit.rb +4 -4
- data/lib/chef/provider/user.rb +18 -1
- data/lib/chef/provider/user/aix.rb +40 -8
- data/lib/chef/provider/user/dscl.rb +7 -14
- data/lib/chef/provider/user/linux.rb +1 -11
- data/lib/chef/provider/user/solaris.rb +57 -26
- data/lib/chef/provider/user/useradd.rb +4 -1
- data/lib/chef/provider/windows_task.rb +1 -0
- data/lib/chef/providers.rb +1 -2
- data/lib/chef/resource/execute.rb +4 -1
- data/lib/chef/resource/gem_package.rb +1 -1
- data/lib/chef/resource/hostname.rb +1 -1
- data/lib/chef/resource/sysctl.rb +3 -1
- data/lib/chef/resource/windows_ad_join.rb +16 -3
- data/lib/chef/resource_inspector.rb +13 -0
- data/lib/chef/run_context/cookbook_compiler.rb +1 -1
- data/lib/chef/server_api.rb +2 -0
- data/lib/chef/version.rb +1 -1
- data/spec/functional/mixin/shell_out_spec.rb +27 -1
- data/spec/functional/resource/execute_spec.rb +2 -2
- data/spec/functional/resource/windows_task_spec.rb +1 -1
- data/spec/support/shared/functional/securable_resource.rb +1 -1
- data/spec/support/shared/unit/execute_resource.rb +1 -1
- data/spec/support/shared/unit/provider/useradd_based_user_provider.rb +3 -3
- data/spec/unit/chef_fs/data_handler/data_handler_base_spec.rb +65 -0
- data/spec/unit/cookbook/manifest_v0_spec.rb +1 -1
- data/spec/unit/cookbook_manifest_spec.rb +2 -0
- data/spec/unit/dsl/recipe_spec.rb +1 -5
- data/spec/unit/http/authenticator_spec.rb +33 -8
- data/spec/unit/mixin/shell_out_spec.rb +61 -1
- data/spec/unit/provider/apt_update_spec.rb +7 -7
- data/spec/unit/provider/execute_spec.rb +16 -15
- data/spec/unit/provider/git_spec.rb +3 -3
- data/spec/unit/provider/package/windows_spec.rb +12 -0
- data/spec/unit/provider/script_spec.rb +2 -2
- data/spec/unit/provider/service/arch_service_spec.rb +9 -9
- data/spec/unit/provider/service/freebsd_service_spec.rb +6 -6
- data/spec/unit/provider/service/init_service_spec.rb +11 -11
- data/spec/unit/provider/service/invokercd_service_spec.rb +9 -9
- data/spec/unit/provider/service/macosx_spec.rb +11 -11
- data/spec/unit/provider/service/openbsd_service_spec.rb +6 -6
- data/spec/unit/provider/service/simple_service_spec.rb +4 -4
- data/spec/unit/provider/service/systemd_service_spec.rb +16 -16
- data/spec/unit/provider/service/upstart_service_spec.rb +12 -12
- data/spec/unit/provider/service/windows_spec.rb +5 -0
- data/spec/unit/provider/systemd_unit_spec.rb +163 -118
- data/spec/unit/provider/user/dscl_spec.rb +2 -9
- data/spec/unit/provider/user/solaris_spec.rb +2 -2
- data/spec/unit/provider/zypper_repository_spec.rb +3 -3
- data/spec/unit/provider_spec.rb +1 -5
- data/spec/unit/resource/apt_package_spec.rb +14 -0
- data/spec/unit/resource/apt_preference_spec.rb +14 -1
- data/spec/unit/resource/apt_repository_spec.rb +12 -3
- data/spec/unit/resource/apt_update_spec.rb +9 -0
- data/spec/unit/resource/bash_spec.rb +8 -0
- data/spec/unit/resource/bff_package_spec.rb +51 -0
- data/spec/unit/resource/breakpoint_spec.rb +4 -4
- data/spec/unit/resource/build_essential_spec.rb +5 -1
- data/spec/unit/resource/cab_package_spec.rb +10 -0
- data/spec/unit/resource/chef_gem_spec.rb +14 -0
- data/spec/unit/resource/chef_handler_spec.rb +9 -4
- data/spec/unit/resource/chocolatey_package_spec.rb +15 -1
- data/spec/unit/resource/conditional_spec.rb +3 -3
- data/spec/unit/resource/cookbook_file_spec.rb +13 -2
- data/spec/unit/resource/cron_spec.rb +2 -7
- data/spec/unit/resource/csh_spec.rb +8 -0
- data/spec/unit/resource/directory_spec.rb +4 -9
- data/spec/unit/resource/dmg_package_spec.rb +8 -4
- data/spec/unit/resource/dnf_package_spec.rb +16 -1
- data/spec/unit/resource/dpkg_package_spec.rb +18 -0
- data/spec/unit/resource/dsc_resource_spec.rb +6 -6
- data/spec/unit/resource/dsc_script_spec.rb +39 -39
- data/spec/unit/resource/execute_spec.rb +20 -12
- data/spec/unit/resource/file_spec.rb +10 -10
- data/spec/unit/resource/freebsd_package_spec.rb +16 -0
- data/spec/unit/resource/gem_package_spec.rb +27 -0
- data/spec/unit/resource/git_spec.rb +17 -2
- data/spec/unit/resource/group_spec.rb +18 -17
- data/spec/unit/resource/homebrew_cask_spec.rb +9 -4
- data/spec/unit/resource/homebrew_package_spec.rb +14 -0
- data/spec/unit/resource/homebrew_tap_spec.rb +8 -3
- data/spec/unit/resource/hostname_spec.rb +10 -6
- data/spec/unit/resource/http_request_spec.rb +14 -0
- data/spec/unit/resource/ips_package_spec.rb +15 -3
- data/spec/unit/resource/ksh_spec.rb +8 -0
- data/spec/unit/resource/launchd_spec.rb +11 -5
- data/spec/unit/resource/link_spec.rb +6 -11
- data/spec/unit/resource/log_spec.rb +8 -8
- data/spec/unit/resource/macos_user_defaults_spec.rb +5 -1
- data/spec/unit/resource/macports_package_spec.rb +19 -0
- data/spec/unit/resource/mdadm_spec.rb +7 -3
- data/spec/unit/resource/mount_spec.rb +15 -18
- data/spec/unit/resource/msu_package_spec.rb +10 -0
- data/spec/unit/resource/ohai_hint_spec.rb +9 -8
- data/spec/unit/resource/ohai_spec.rb +11 -3
- data/spec/unit/resource/openbsd_package_spec.rb +14 -0
- data/spec/unit/resource/openssl_dhparam.rb +10 -5
- data/spec/unit/resource/openssl_rsa_private_key_spec.rb +10 -5
- data/spec/unit/resource/openssl_rsa_public_key_spec.rb +9 -5
- data/spec/unit/resource/osx_profile_spec.rb +7 -4
- data/spec/unit/resource/package_spec.rb +14 -0
- data/spec/unit/resource/pacman_package_spec.rb +17 -3
- data/spec/unit/resource/paludis_package_spec.rb +36 -0
- data/spec/unit/resource/perl_spec.rb +8 -0
- data/spec/unit/resource/portage_package_spec.rb +14 -0
- data/spec/unit/resource/powershell_package_spec.rb +14 -0
- data/spec/unit/resource/python_spec.rb +8 -0
- data/spec/unit/resource/reboot_spec.rb +5 -3
- data/spec/unit/resource/registry_key_spec.rb +12 -1
- data/spec/unit/resource/remote_directory_spec.rb +11 -1
- data/spec/unit/resource/remote_file_spec.rb +19 -0
- data/spec/unit/resource/rhsm_errata_level_spec.rb +7 -3
- data/spec/unit/resource/rhsm_errata_spec.rb +8 -4
- data/spec/unit/resource/rhsm_register_spec.rb +6 -1
- data/spec/unit/resource/rhsm_repo_spec.rb +9 -4
- data/spec/unit/resource/rhsm_subscription_spec.rb +9 -4
- data/spec/unit/resource/route_spec.rb +4 -9
- data/spec/unit/resource/rpm_package_spec.rb +14 -0
- data/spec/unit/resource/ruby_block_spec.rb +12 -8
- data/spec/unit/resource/ruby_spec.rb +8 -0
- data/spec/unit/resource/scm_spec.rb +16 -8
- data/spec/unit/resource/script_spec.rb +8 -0
- data/spec/unit/resource/service_spec.rb +15 -0
- data/spec/unit/resource/smartos_package_spec.rb +18 -4
- data/spec/unit/resource/solaris_package_spec.rb +14 -0
- data/spec/unit/resource/subversion_spec.rb +14 -8
- data/spec/unit/resource/sudo_spec.rb +11 -4
- data/spec/unit/resource/swap_file_spec.rb +4 -5
- data/spec/unit/resource/sysctl_spec.rb +8 -10
- data/spec/unit/resource/systemd_unit_spec.rb +14 -12
- data/spec/unit/resource/template_spec.rb +19 -0
- data/spec/unit/resource/{windows_ad_join.rb → windows_ad_join_spec.rb} +12 -6
- data/spec/unit/resource/windows_auto_run_spec.rb +9 -9
- data/spec/unit/resource/windows_env_spec.rb +8 -16
- data/spec/unit/resource/windows_feature.rb +27 -8
- data/spec/unit/resource/windows_feature_dism.rb +30 -9
- data/spec/unit/resource/windows_feature_powershell.rb +7 -7
- data/spec/unit/resource/windows_font_spec.rb +3 -4
- data/spec/unit/resource/windows_package_spec.rb +12 -2
- data/spec/unit/resource/windows_pagefile_spec.rb +12 -8
- data/spec/unit/resource/windows_path_spec.rb +4 -5
- data/spec/unit/resource/windows_printer_port_spec.rb +20 -3
- data/spec/unit/resource/windows_printer_spec.rb +12 -5
- data/spec/unit/resource/windows_service_spec.rb +24 -1
- data/spec/unit/resource/windows_shortcut_spec.rb +4 -5
- data/spec/unit/resource/yum_repository_spec.rb +48 -2
- data/spec/unit/resource/zypper_package_spec.rb +51 -0
- data/spec/unit/resource/zypper_repository_spec.rb +56 -11
- data/spec/unit/resource_spec.rb +1 -5
- metadata +21 -12
- data/spec/functional/resource/user/useradd_spec.rb +0 -709
@@ -283,15 +283,8 @@ ea18e18b720e358e7fbe3cfbeaa561456f6ba008937a30"
|
|
283
283
|
provider.dscl_set_home
|
284
284
|
end
|
285
285
|
|
286
|
-
it "should
|
287
|
-
|
288
|
-
expect { provider.dscl_set_home }.to raise_error(Chef::Exceptions::User)
|
289
|
-
end
|
290
|
-
|
291
|
-
it "should run ditto to copy any missing files from skel to the new home dir" do
|
292
|
-
expect(::File).to receive(:exist?).with("/System/Library/User\ Template/English.lproj").and_return(true)
|
293
|
-
expect(FileUtils).to receive(:chown_R).with("toor", "", "/Users/toor")
|
294
|
-
expect(provider).to receive(:shell_out!).with("ditto", "/System/Library/User Template/English.lproj", "/Users/toor")
|
286
|
+
it "should run createhomedir to create the user's new home folder" do
|
287
|
+
expect(provider).to receive(:shell_out!).with("/usr/sbin/createhomedir", "-c", "-u", "toor")
|
295
288
|
provider.ditto_home
|
296
289
|
end
|
297
290
|
|
@@ -2,7 +2,7 @@
|
|
2
2
|
# Author:: Adam Jacob (<adam@chef.io>)
|
3
3
|
# Author:: Daniel DeLeo (<dan@chef.io>)
|
4
4
|
# Author:: Dave Eddy (<dave@daveeddy.com>)
|
5
|
-
# Copyright:: Copyright 2008-
|
5
|
+
# Copyright:: Copyright 2008-2018, Chef Software Inc.
|
6
6
|
# Copyright:: Copyright 2015-2016, Dave Eddy
|
7
7
|
#
|
8
8
|
# License:: Apache License, Version 2.0
|
@@ -68,7 +68,7 @@ describe Chef::Provider::User::Solaris do
|
|
68
68
|
password_file = Tempfile.new("shadow")
|
69
69
|
password_file.puts "adam:existingpassword:15441::::::"
|
70
70
|
password_file.close
|
71
|
-
|
71
|
+
stub_const("Chef::Provider::User::Solaris::PASSWORD_FILE", password_file.path)
|
72
72
|
allow(provider).to receive(:shell_out!).and_return(true)
|
73
73
|
# may not be able to write to /etc for tests...
|
74
74
|
temp_file = Tempfile.new("shadow")
|
@@ -1,6 +1,6 @@
|
|
1
1
|
#
|
2
2
|
# Author:: Tim Smith (<tsmith@chef.io>)
|
3
|
-
# Copyright:: 2017, Chef Software
|
3
|
+
# Copyright:: 2017-2018, Chef Software Inc.
|
4
4
|
# License:: Apache License, Version 2.0
|
5
5
|
#
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
@@ -45,11 +45,11 @@ describe Chef::Provider::ZypperRepository do
|
|
45
45
|
end
|
46
46
|
|
47
47
|
let(:rpm_key_finger) do
|
48
|
-
double("
|
48
|
+
double("shell_out", stdout: RPM_KEYS, exitstatus: 0, error?: false)
|
49
49
|
end
|
50
50
|
|
51
51
|
let(:gpg_finger) do
|
52
|
-
double("
|
52
|
+
double("shell_out", stdout: GPG_FINGER, exitstatus: 0, error?: false)
|
53
53
|
end
|
54
54
|
|
55
55
|
it "responds to load_current_resource" do
|
data/spec/unit/provider_spec.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
#
|
2
2
|
# Author:: Adam Jacob (<adam@chef.io>)
|
3
|
-
# Copyright:: Copyright 2008-
|
3
|
+
# Copyright:: Copyright 2008-2018, Chef Software Inc.
|
4
4
|
# License:: Apache License, Version 2.0
|
5
5
|
#
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
@@ -75,10 +75,6 @@ describe Chef::Provider do
|
|
75
75
|
expect(@provider.respond_to?(:shell_out!)).to be true
|
76
76
|
end
|
77
77
|
|
78
|
-
it "should mixin shell_out_with_systems_locale" do
|
79
|
-
expect(@provider.respond_to?(:shell_out_with_systems_locale)).to be true
|
80
|
-
end
|
81
|
-
|
82
78
|
it "should store the resource passed to new as new_resource" do
|
83
79
|
expect(@provider.new_resource).to eql(@resource)
|
84
80
|
end
|
@@ -31,6 +31,20 @@ describe Chef::Resource::AptPackage, "initialize" do
|
|
31
31
|
|
32
32
|
let(:resource) { Chef::Resource::AptPackage.new("foo") }
|
33
33
|
|
34
|
+
it "sets the default action as :install" do
|
35
|
+
expect(resource.action).to eql([:install])
|
36
|
+
end
|
37
|
+
|
38
|
+
it "supports :install, :lock, :purge, :reconfig, :remove, :unlock, :upgrade actions" do
|
39
|
+
expect { resource.action :install }.not_to raise_error
|
40
|
+
expect { resource.action :lock }.not_to raise_error
|
41
|
+
expect { resource.action :purge }.not_to raise_error
|
42
|
+
expect { resource.action :reconfig }.not_to raise_error
|
43
|
+
expect { resource.action :remove }.not_to raise_error
|
44
|
+
expect { resource.action :unlock }.not_to raise_error
|
45
|
+
expect { resource.action :upgrade }.not_to raise_error
|
46
|
+
end
|
47
|
+
|
34
48
|
it "supports default_release" do
|
35
49
|
resource.default_release("lenny-backports")
|
36
50
|
expect(resource.default_release).to eql("lenny-backports")
|
@@ -22,7 +22,20 @@ describe Chef::Resource::AptPreference do
|
|
22
22
|
let(:node) { Chef::Node.new }
|
23
23
|
let(:events) { Chef::EventDispatch::Dispatcher.new }
|
24
24
|
let(:run_context) { Chef::RunContext.new(node, {}, events) }
|
25
|
-
let(:resource) { Chef::Resource::AptPreference.new("
|
25
|
+
let(:resource) { Chef::Resource::AptPreference.new("fakey_fakerton", run_context) }
|
26
|
+
|
27
|
+
it "the package_name property is the name_property" do
|
28
|
+
expect(resource.package_name).to eql("fakey_fakerton")
|
29
|
+
end
|
30
|
+
|
31
|
+
it "sets the default action as :add" do
|
32
|
+
expect(resource.action).to eql([:add])
|
33
|
+
end
|
34
|
+
|
35
|
+
it "supports :add, :remove actions" do
|
36
|
+
expect { resource.action :add }.not_to raise_error
|
37
|
+
expect { resource.action :remove }.not_to raise_error
|
38
|
+
end
|
26
39
|
|
27
40
|
it "resolves to a Noop class when on non-linux OS" do
|
28
41
|
node.automatic[:os] = "windows"
|
@@ -25,14 +25,23 @@ describe Chef::Resource::AptRepository do
|
|
25
25
|
empty_events = Chef::EventDispatch::Dispatcher.new
|
26
26
|
Chef::RunContext.new(node, {}, empty_events)
|
27
27
|
end
|
28
|
-
let(:resource) { Chef::Resource::AptRepository.new("
|
28
|
+
let(:resource) { Chef::Resource::AptRepository.new("fakey_fakerton", run_context) }
|
29
29
|
|
30
30
|
it "keyserver defaults to keyserver.ubuntu.com" do
|
31
31
|
expect(resource.keyserver).to eql("keyserver.ubuntu.com")
|
32
32
|
end
|
33
33
|
|
34
|
-
it "repo_name is the
|
35
|
-
expect(resource.repo_name).to eql("
|
34
|
+
it "the repo_name property is the name_property" do
|
35
|
+
expect(resource.repo_name).to eql("fakey_fakerton")
|
36
|
+
end
|
37
|
+
|
38
|
+
it "sets the default action as :add" do
|
39
|
+
expect(resource.action).to eql([:add])
|
40
|
+
end
|
41
|
+
|
42
|
+
it "supports :add, :remove actions" do
|
43
|
+
expect { resource.action :add }.not_to raise_error
|
44
|
+
expect { resource.action :remove }.not_to raise_error
|
36
45
|
end
|
37
46
|
|
38
47
|
it "distribution defaults to the distro codename" do
|
@@ -24,6 +24,15 @@ describe Chef::Resource::AptUpdate do
|
|
24
24
|
let(:run_context) { Chef::RunContext.new(node, {}, events) }
|
25
25
|
let(:resource) { Chef::Resource::AptUpdate.new("update", run_context) }
|
26
26
|
|
27
|
+
it "sets the default action as :periodic" do
|
28
|
+
expect(resource.action).to eql([:periodic])
|
29
|
+
end
|
30
|
+
|
31
|
+
it "supports :periodic, :update actions" do
|
32
|
+
expect { resource.action :periodic }.not_to raise_error
|
33
|
+
expect { resource.action :update }.not_to raise_error
|
34
|
+
end
|
35
|
+
|
27
36
|
it "default frequency is set to be 1 day" do
|
28
37
|
expect(resource.frequency).to eql(86_400)
|
29
38
|
end
|
@@ -34,4 +34,12 @@ describe Chef::Resource::Bash do
|
|
34
34
|
expect(resource.interpreter).to eql("bash")
|
35
35
|
end
|
36
36
|
|
37
|
+
it "sets the default action as :run" do
|
38
|
+
expect(resource.action).to eql([:run])
|
39
|
+
end
|
40
|
+
|
41
|
+
it "supports :run action" do
|
42
|
+
expect { resource.action :run }.not_to raise_error
|
43
|
+
end
|
44
|
+
|
37
45
|
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
#
|
2
|
+
# Author:: Tim Smith (<tsmith@chef.io>)
|
3
|
+
# Copyright:: Copyright 2018 Chef Software, Inc.
|
4
|
+
# License:: Apache License, Version 2.0
|
5
|
+
#
|
6
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
7
|
+
# you may not use this file except in compliance with the License.
|
8
|
+
# You may obtain a copy of the License at
|
9
|
+
#
|
10
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
11
|
+
#
|
12
|
+
# Unless required by applicable law or agreed to in writing, software
|
13
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
14
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15
|
+
# See the License for the specific language governing permissions and
|
16
|
+
# limitations under the License.
|
17
|
+
#
|
18
|
+
|
19
|
+
require "spec_helper"
|
20
|
+
require "support/shared/unit/resource/static_provider_resolution"
|
21
|
+
|
22
|
+
describe Chef::Resource::BffPackage, "initialize" do
|
23
|
+
|
24
|
+
static_provider_resolution(
|
25
|
+
resource: Chef::Resource::BffPackage,
|
26
|
+
provider: Chef::Provider::Package::Bff,
|
27
|
+
name: :bff_package,
|
28
|
+
action: :install,
|
29
|
+
os: "linux",
|
30
|
+
platform_family: "aix"
|
31
|
+
)
|
32
|
+
|
33
|
+
end
|
34
|
+
|
35
|
+
describe Chef::Resource::BffPackage, "defaults" do
|
36
|
+
let(:resource) { Chef::Resource::BffPackage.new("fakey_fakerton") }
|
37
|
+
|
38
|
+
it "sets the default action as :install" do
|
39
|
+
expect(resource.action).to eql([:install])
|
40
|
+
end
|
41
|
+
|
42
|
+
it "supports :install, :lock, :purge, :reconfig, :remove, :unlock, :upgrade actions" do
|
43
|
+
expect { resource.action :install }.not_to raise_error
|
44
|
+
expect { resource.action :lock }.not_to raise_error
|
45
|
+
expect { resource.action :purge }.not_to raise_error
|
46
|
+
expect { resource.action :reconfig }.not_to raise_error
|
47
|
+
expect { resource.action :remove }.not_to raise_error
|
48
|
+
expect { resource.action :unlock }.not_to raise_error
|
49
|
+
expect { resource.action :upgrade }.not_to raise_error
|
50
|
+
end
|
51
|
+
end
|
@@ -48,12 +48,12 @@ describe Chef::Resource::Breakpoint do
|
|
48
48
|
provider.action_break
|
49
49
|
end
|
50
50
|
|
51
|
-
it "
|
52
|
-
expect(resource.
|
51
|
+
it "sets the default action as :break" do
|
52
|
+
expect(resource.action).to eql([:break])
|
53
53
|
end
|
54
54
|
|
55
|
-
it "
|
56
|
-
expect
|
55
|
+
it "supports :break action" do
|
56
|
+
expect { resource.action :break }.not_to raise_error
|
57
57
|
end
|
58
58
|
|
59
59
|
it "names itself after the line number of the file where it's created" do
|
@@ -25,10 +25,14 @@ describe Chef::Resource::BuildEssential do
|
|
25
25
|
expect(resource.resource_name).to eql(:build_essential)
|
26
26
|
end
|
27
27
|
|
28
|
-
it "
|
28
|
+
it "sets the default action as :install" do
|
29
29
|
expect(resource.action).to eql([:install])
|
30
30
|
end
|
31
31
|
|
32
|
+
it "supports :install action" do
|
33
|
+
expect { resource.action :install }.not_to raise_error
|
34
|
+
end
|
35
|
+
|
32
36
|
context "when not settting a resource name" do
|
33
37
|
let(:resource) { Chef::Resource::BuildEssential.new(nil) }
|
34
38
|
|
@@ -34,6 +34,16 @@ describe Chef::Resource::CabPackage do
|
|
34
34
|
expect(resource.action).to eql([:install])
|
35
35
|
end
|
36
36
|
|
37
|
+
it "supports :install, :lock, :purge, :reconfig, :remove, :unlock, :upgrade actions" do
|
38
|
+
expect { resource.action :install }.not_to raise_error
|
39
|
+
expect { resource.action :lock }.not_to raise_error
|
40
|
+
expect { resource.action :purge }.not_to raise_error
|
41
|
+
expect { resource.action :reconfig }.not_to raise_error
|
42
|
+
expect { resource.action :remove }.not_to raise_error
|
43
|
+
expect { resource.action :unlock }.not_to raise_error
|
44
|
+
expect { resource.action :upgrade }.not_to raise_error
|
45
|
+
end
|
46
|
+
|
37
47
|
it "coerces name property to package_name property" do
|
38
48
|
expect(resource.package_name).to eql("test_pkg")
|
39
49
|
end
|
@@ -34,6 +34,20 @@ end
|
|
34
34
|
describe Chef::Resource::ChefGem, "gem_binary" do
|
35
35
|
let(:resource) { Chef::Resource::ChefGem.new("foo") }
|
36
36
|
|
37
|
+
it "sets the default action as :install" do
|
38
|
+
expect(resource.action).to eql([:install])
|
39
|
+
end
|
40
|
+
|
41
|
+
it "supports :install, :lock, :purge, :reconfig, :remove, :unlock, :upgrade actions" do
|
42
|
+
expect { resource.action :install }.not_to raise_error
|
43
|
+
expect { resource.action :lock }.not_to raise_error
|
44
|
+
expect { resource.action :purge }.not_to raise_error
|
45
|
+
expect { resource.action :reconfig }.not_to raise_error
|
46
|
+
expect { resource.action :remove }.not_to raise_error
|
47
|
+
expect { resource.action :unlock }.not_to raise_error
|
48
|
+
expect { resource.action :upgrade }.not_to raise_error
|
49
|
+
end
|
50
|
+
|
37
51
|
it "raises an exception when gem_binary is set" do
|
38
52
|
expect { resource.gem_binary("/lol/cats/gem") }.to raise_error(ArgumentError)
|
39
53
|
end
|
@@ -19,17 +19,22 @@ require "spec_helper"
|
|
19
19
|
|
20
20
|
describe Chef::Resource::ChefHandler do
|
21
21
|
|
22
|
-
let(:resource) { Chef::Resource::ChefHandler.new("
|
22
|
+
let(:resource) { Chef::Resource::ChefHandler.new("fakey_fakerton") }
|
23
23
|
|
24
24
|
it "has a resource name of :chef_handler" do
|
25
25
|
expect(resource.resource_name).to eql(:chef_handler)
|
26
26
|
end
|
27
27
|
|
28
|
-
it "
|
28
|
+
it "the class_name property is the name_property" do
|
29
|
+
expect(resource.class_name).to eql("fakey_fakerton")
|
30
|
+
end
|
31
|
+
|
32
|
+
it "sets the default action as :enable" do
|
29
33
|
expect(resource.action).to eql([:enable])
|
30
34
|
end
|
31
35
|
|
32
|
-
it "
|
33
|
-
expect
|
36
|
+
it "supports :disable, :enable actions" do
|
37
|
+
expect { resource.action :disable }.not_to raise_error
|
38
|
+
expect { resource.action :enable }.not_to raise_error
|
34
39
|
end
|
35
40
|
end
|
@@ -26,10 +26,24 @@ describe Chef::Resource::ChocolateyPackage do
|
|
26
26
|
expect(resource).to be_a_kind_of(Chef::Resource::Package)
|
27
27
|
end
|
28
28
|
|
29
|
-
it "has a resource name of :
|
29
|
+
it "has a resource name of :chocolatey_package" do
|
30
30
|
expect(resource.resource_name).to eql(:chocolatey_package)
|
31
31
|
end
|
32
32
|
|
33
|
+
it "sets the default action as :install" do
|
34
|
+
expect(resource.action).to eql([:install])
|
35
|
+
end
|
36
|
+
|
37
|
+
it "supports :install, :lock, :purge, :reconfig, :remove, :unlock, :upgrade actions" do
|
38
|
+
expect { resource.action :install }.not_to raise_error
|
39
|
+
expect { resource.action :lock }.not_to raise_error
|
40
|
+
expect { resource.action :purge }.not_to raise_error
|
41
|
+
expect { resource.action :reconfig }.not_to raise_error
|
42
|
+
expect { resource.action :remove }.not_to raise_error
|
43
|
+
expect { resource.action :unlock }.not_to raise_error
|
44
|
+
expect { resource.action :upgrade }.not_to raise_error
|
45
|
+
end
|
46
|
+
|
33
47
|
it "coerces its name to a package_name array" do
|
34
48
|
expect(resource.package_name).to eql(["fakey_fakerton"])
|
35
49
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
#
|
2
2
|
# Author:: Daniel DeLeo (<dan@chef.io>)
|
3
|
-
# Copyright:: Copyright 2011-
|
3
|
+
# Copyright:: Copyright 2011-2018, Chef Software Inc.
|
4
4
|
# License:: Apache License, Version 2.0
|
5
5
|
#
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
@@ -92,7 +92,7 @@ describe Chef::Resource::Conditional do
|
|
92
92
|
describe "after running a command which timed out" do
|
93
93
|
before do
|
94
94
|
@conditional = Chef::Resource::Conditional.only_if(@parent_resource, "false")
|
95
|
-
allow_any_instance_of(Chef::GuardInterpreter::DefaultGuardInterpreter).to receive(:
|
95
|
+
allow_any_instance_of(Chef::GuardInterpreter::DefaultGuardInterpreter).to receive(:shell_out).and_raise(Chef::Exceptions::CommandTimeout)
|
96
96
|
end
|
97
97
|
|
98
98
|
it "indicates that resource convergence should not continue" do
|
@@ -195,7 +195,7 @@ describe Chef::Resource::Conditional do
|
|
195
195
|
describe "after running a command which timed out" do
|
196
196
|
before do
|
197
197
|
@conditional = Chef::Resource::Conditional.not_if(@parent_resource, "false")
|
198
|
-
allow_any_instance_of(Chef::GuardInterpreter::DefaultGuardInterpreter).to receive(:
|
198
|
+
allow_any_instance_of(Chef::GuardInterpreter::DefaultGuardInterpreter).to receive(:shell_out).and_raise(Chef::Exceptions::CommandTimeout)
|
199
199
|
end
|
200
200
|
|
201
201
|
it "indicates that resource convergence should continue" do
|
@@ -22,12 +22,23 @@ require "spec_helper"
|
|
22
22
|
describe Chef::Resource::CookbookFile do
|
23
23
|
let(:resource) { Chef::Resource::CookbookFile.new("/foo/bar/sourcecode_tarball.tgz") }
|
24
24
|
|
25
|
-
it "
|
25
|
+
it "sets the default action as :create" do
|
26
|
+
expect(resource.action).to eql([:create])
|
27
|
+
end
|
28
|
+
|
29
|
+
it "supports :create, :create_if_missing, :delete, :touch actions" do
|
30
|
+
expect { resource.action :create }.not_to raise_error
|
31
|
+
expect { resource.action :create_if_missing }.not_to raise_error
|
32
|
+
expect { resource.action :delete }.not_to raise_error
|
33
|
+
expect { resource.action :touch }.not_to raise_error
|
34
|
+
end
|
35
|
+
|
36
|
+
it "uses the basepath of the resource name for the source property" do
|
26
37
|
expect(resource.source).to eq("sourcecode_tarball.tgz")
|
27
38
|
end
|
28
39
|
|
29
40
|
it "source property accepts Strings" do
|
30
|
-
resource.
|
41
|
+
resource.source("config_file.conf")
|
31
42
|
expect(resource.source).to eq("config_file.conf")
|
32
43
|
end
|
33
44
|
|
@@ -22,18 +22,13 @@ require "spec_helper"
|
|
22
22
|
describe Chef::Resource::Cron do
|
23
23
|
let(:resource) { Chef::Resource::Cron.new("cronify") }
|
24
24
|
|
25
|
-
it "
|
26
|
-
expect(resource.name).to eql("cronify")
|
27
|
-
end
|
28
|
-
|
29
|
-
it "has a default action of [:create]" do
|
25
|
+
it "sets the default action as :create" do
|
30
26
|
expect(resource.action).to eql([:create])
|
31
27
|
end
|
32
28
|
|
33
|
-
it "
|
29
|
+
it "supports :create, :delete actions" do
|
34
30
|
expect { resource.action :create }.not_to raise_error
|
35
31
|
expect { resource.action :delete }.not_to raise_error
|
36
|
-
expect { resource.action :lolcat }.to raise_error(ArgumentError)
|
37
32
|
end
|
38
33
|
|
39
34
|
it "allows you to set a command" do
|
@@ -30,6 +30,14 @@ describe Chef::Resource::Csh do
|
|
30
30
|
expect(resource.resource_name).to eql(:csh)
|
31
31
|
end
|
32
32
|
|
33
|
+
it "sets the default action as :run" do
|
34
|
+
expect(resource.action).to eql([:run])
|
35
|
+
end
|
36
|
+
|
37
|
+
it "supports :run action" do
|
38
|
+
expect { resource.action :run }.not_to raise_error
|
39
|
+
end
|
40
|
+
|
33
41
|
it "has an interpreter of csh" do
|
34
42
|
expect(resource.interpreter).to eql("csh")
|
35
43
|
end
|