blob: 018f9511e747b9508596c67549ba03f9cf0dac7c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
|
@client @attribute_settings
Feature: Set default, normal, and override attributes
In order to easily configure similar systems
As an Administrator
I want to use different kinds of attributes
Scenario: Set a default attribute in a cookbook attribute file
Given I am an administrator
And a validated node
And it includes the recipe 'attribute_settings'
When I run the chef-client
Then the run should exit '0'
Then a file named 'attribute_setting.txt' should contain 'came from recipe\[attribute_settings\] attributes'
When the node is retrieved from the API
Then the inflated responses key 'attribute_priority_was' should match 'came from recipe\[attribute_settings\] attributes'
Scenario: Set the default attribute in a role
Given I am an administrator
And a 'role' named 'attribute_settings_default' exists
And a validated node
And it includes the role 'attribute_settings_default'
When I run the chef-client
Then the run should exit '0'
And a file named 'attribute_setting.txt' should contain 'came from role\[attribute_settings_default\] default attributes'
When the node is retrieved from the API
Then the inflated responses key 'attribute_priority_was' should match 'came from role\[attribute_settings_default\] default attributes'
Scenario: Set the default attribute in a recipe
Given I am an administrator
And a 'role' named 'attribute_settings_default' exists
And a validated node
And it includes the role 'attribute_settings_default'
And it includes the recipe 'attribute_settings::default_in_recipe'
When I run the chef-client
Then the run should exit '0'
And a file named 'attribute_setting.txt' should contain 'came from recipe\[attribute_settings::default_in_recipe\]'
When the node is retrieved from the API
Then the inflated responses key 'attribute_priority_was' should match 'came from recipe\[attribute_settings::default_in_recipe\]'
Scenario: Set a normal attribute in a cookbook attribute file
Given I am an administrator
And a validated node
And a 'role' named 'attribute_settings_default' exists
And it includes the role 'attribute_settings_default'
And it includes the recipe 'attribute_settings::default_in_recipe'
And it includes the recipe 'attribute_settings_normal'
When I run the chef-client
Then the run should exit '0'
Then a file named 'attribute_setting.txt' should contain 'came from recipe\[attribute_settings_normal\] attributes'
When the node is retrieved from the API
Then the inflated responses key 'attribute_priority_was' should match 'came from recipe\[attribute_settings_normal\] attributes'
Scenario: Set a normal attribute in a cookbook recipe
Given I am an administrator
And a validated node
And a 'role' named 'attribute_settings_default' exists
And it includes the role 'attribute_settings_default'
And it includes the recipe 'attribute_settings::default_in_recipe'
And it includes the recipe 'attribute_settings_normal::normal_in_recipe'
When I run the chef-client
Then the run should exit '0'
Then a file named 'attribute_setting.txt' should contain 'came from recipe\[attribute_settings_normal::normal_in_recipe\]'
When the node is retrieved from the API
Then the inflated responses key 'attribute_priority_was' should match 'came from recipe\[attribute_settings_normal::normal_in_recipe\]'
Scenario: Set an override attribute in a cookbook attribute file
Given I am an administrator
And a validated node
And a 'role' named 'attribute_settings_default' exists
And it includes the role 'attribute_settings_default'
And it includes the recipe 'attribute_settings::default_in_recipe'
And it includes the recipe 'attribute_settings_normal::normal_in_recipe'
And it includes the recipe 'attribute_settings_override'
When I run the chef-client
Then the run should exit '0'
Then a file named 'attribute_setting.txt' should contain 'came from recipe\[attribute_settings_override\] override attributes'
When the node is retrieved from the API
Then the inflated responses key 'attribute_priority_was' should match 'came from recipe\[attribute_settings_override\] override attributes'
Scenario: Set the override attribute in a role
Given I am an administrator
And a 'role' named 'attribute_settings_default' exists
And a 'role' named 'attribute_settings_override' exists
And a validated node
And it includes the role 'attribute_settings_default'
And it includes the recipe 'attribute_settings::default_in_recipe'
And it includes the recipe 'attribute_settings_normal::normal_in_recipe'
And it includes the recipe 'attribute_settings_override'
And it includes the role 'attribute_settings_override'
When I run the chef-client
Then the run should exit '0'
And a file named 'attribute_setting.txt' should contain 'came from role\[attribute_settings_override\] override attributes'
When the node is retrieved from the API
Then the inflated responses key 'attribute_priority_was' should match 'came from role\[attribute_settings_override\] override attributes'
Scenario: Set the attribute in a environment
Given I am an administrator
And an 'environment' named 'cucumber' exists
And a 'role' named 'attribute_settings_default' exists
And a 'role' named 'attribute_settings_override' exists
And a validated node in the 'cucumber' environment
And it includes the role 'attribute_settings_default'
And it includes the recipe 'attribute_settings::default_in_recipe'
And it includes the recipe 'attribute_settings_normal::normal_in_recipe'
And it includes the recipe 'attribute_settings_override'
And it includes the role 'attribute_settings_override'
When I run the chef-client with '-l debug'
Then the run should exit '0'
And a file named 'attribute_setting.txt' should contain 'came from environment cucumber'
When the node is retrieved from the API
Then the inflated responses key 'attribute_priority_was' should match 'came from environment cucumber'
Scenario: Set the override attribute in a recipe
Given I am an administrator
And a 'role' named 'attribute_settings_default' exists
And a 'role' named 'attribute_settings_override' exists
And a validated node
And it includes the role 'attribute_settings_default'
And it includes the recipe 'attribute_settings::default_in_recipe'
And it includes the recipe 'attribute_settings_normal::normal_in_recipe'
And it includes the recipe 'attribute_settings_override'
And it includes the role 'attribute_settings_override'
And it includes the recipe 'attribute_settings_override::override_in_recipe'
When I run the chef-client
Then the run should exit '0'
And a file named 'attribute_setting.txt' should contain 'came from recipe\[attribute_settings_override::override_in_recipe\]'
When the node is retrieved from the API
Then the inflated responses key 'attribute_priority_was' should match 'came from recipe\[attribute_settings_override::override_in_recipe\]'
Scenario: Data is removed from override attribute in a recipe
Given I am an administrator
And a 'role' named 'attribute_settings_override' exists
And a validated node
And it includes the role 'attribute_settings_override'
When I run the chef-client
Then the run should exit '0'
And a file named 'attribute_setting.txt' should contain 'came from role\[attribute_settings_override\] override attributes'
When the node is retrieved from the API
Then the inflated responses key 'attribute_priority_was' should match 'came from role\[attribute_settings_override\] override attributes'
Given it includes no recipes
And it includes the recipe 'integration_setup'
And it includes the recipe 'no_attributes'
When I run the chef-client
Then the run should exit '0'
And a file named 'attribute_setting.txt' should contain 'snakes'
# Test that attributes from JSON are applied before attribute files are applied.
@chef1286
Scenario: Attributes from JSON files are normal attributes applied before attribute files
Given I am an administrator
And a validated node
And it includes the recipe 'attribute_settings_normal'
When I run the chef-client with json attributes
Then the run should exit '0'
Then a file named 'attribute_setting.txt' should contain 'came from recipe\[attribute_settings_normal\] attributes'
When the node is retrieved from the API
Then the inflated responses key 'attribute_priority_was' should match 'came from recipe\[attribute_settings_normal\] attributes'
@chef1286
Scenario: Attributes from JSON files have higher precedence than defaults
Given a 'role' named 'attribute_settings_default' exists
And a 'role' named 'attribute_settings_override' exists
And a validated node
And it includes the role 'attribute_settings_default'
And it includes the recipe 'attribute_settings::default_in_recipe'
When I run the chef-client with json attributes
Then the run should exit '0'
Then a file named 'attribute_setting.txt' should contain 'from_json_file'
When the node is retrieved from the API
Then the inflated responses key 'attribute_priority_was' should match 'from_json_file'
|