Skip to content

Commit 2e544a4

Browse files
committed
Tests for delayed notifications
1 parent 03a4258 commit 2e544a4

3 files changed

Lines changed: 58 additions & 0 deletions

File tree

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#
2+
# Cookbook Name:: delayed_notifications
3+
# Recipe:: default
4+
#
5+
# Copyright 2009, Opscode
6+
#
7+
# Licensed under the Apache License, Version 2.0 (the "License");
8+
# you may not use this file except in compliance with the License.
9+
# You may obtain a copy of the License at
10+
#
11+
# http://www.apache.org/licenses/LICENSE-2.0
12+
#
13+
# Unless required by applicable law or agreed to in writing, software
14+
# distributed under the License is distributed on an "AS IS" BASIS,
15+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16+
# See the License for the specific language governing permissions and
17+
# limitations under the License.
18+
#
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#
2+
# Cookbook Name:: delayed_notifications
3+
# Recipe:: notify_a_resource_from_a_single_source
4+
#
5+
# Copyright 2009, Opscode
6+
#
7+
# Licensed under the Apache License, Version 2.0 (the "License");
8+
# you may not use this file except in compliance with the License.
9+
# You may obtain a copy of the License at
10+
#
11+
# http://www.apache.org/licenses/LICENSE-2.0
12+
#
13+
# Unless required by applicable law or agreed to in writing, software
14+
# distributed under the License is distributed on an "AS IS" BASIS,
15+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16+
# See the License for the specific language governing permissions and
17+
# limitations under the License.
18+
#
19+
20+
file "#{node[:tmpdir]}/notified_file.txt" do
21+
action :nothing
22+
end
23+
24+
exec "echo foo" do
25+
notifies :create, resources("file[#{node[:tmpdir]}/notified_file.txt]"), :delayed
26+
end
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
Feature: Delayed Notifications
2+
In order to not impact the system we are configuring unduly
3+
As a developer
4+
I want to be able to trigger an action on a resource only at the end of a run
5+
6+
Scenario: Notify a resource from a single source
7+
Given a validated node
8+
And it includes the recipe 'delayed_notifications::notify_a_resource_from_a_single_source'
9+
When I run the chef-client
10+
Then the run should exit '0'
11+
And a file named 'notified_file.txt' should exist
12+
13+
14+

0 commit comments

Comments
 (0)