From db1704d2259841f60382ca6c14dc1a6446ea939b Mon Sep 17 00:00:00 2001 From: Tim Smith Date: Fri, 8 Nov 2019 14:15:20 -0800 Subject: Add new chef_sleep resource We highly recommend you never use this, but there's times when you 100% need to have the client sleep for a period of time after some work. Example: windows_service will start a service and the OS will say that it's "started" when it's not. Before doing additional work that relies on the service being started you may need to sleep. This would be a good time to notify on the restart or start action. Signed-off-by: Tim Smith --- spec/unit/resource/chef_sleep_spec.rb | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 spec/unit/resource/chef_sleep_spec.rb (limited to 'spec') diff --git a/spec/unit/resource/chef_sleep_spec.rb b/spec/unit/resource/chef_sleep_spec.rb new file mode 100644 index 0000000000..bde29f4f1d --- /dev/null +++ b/spec/unit/resource/chef_sleep_spec.rb @@ -0,0 +1,30 @@ +# +# Copyright:: 2019, Chef Software, Inc. +# License:: Apache License, Version 2.0 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +require "spec_helper" + +describe Chef::Resource::ChefSleep do + let(:resource) { Chef::Resource::ChefSleep.new("30") } + + it "sets the default action as :sleep" do + expect(resource.action).to eql([:sleep]) + end + + it "sleep is the name property and it coerces to an Integer" do + expect(resource.seconds).to eql(30) + end +end -- cgit v1.2.1