summaryrefslogtreecommitdiff
path: root/features
diff options
context:
space:
mode:
authorDaniel DeLeo <dan@opscode.com>2010-06-09 17:21:18 -0700
committerDaniel DeLeo <dan@opscode.com>2010-06-09 17:21:18 -0700
commit479e98c8988183c0f42148c3521da46eaf0f2241 (patch)
treed2e18ccd56fac7b17beb9c56326b0618bf16e91b /features
parent804e57d493ca4348a229d0ded39704788d1ebc32 (diff)
parent0889a6797b7bc74cf504083543603a6dd7a6276d (diff)
downloadchef-479e98c8988183c0f42148c3521da46eaf0f2241.tar.gz
Merge branch 'CHEF-1286'
Diffstat (limited to 'features')
-rw-r--r--features/chef-client/attribute_settings.feature13
-rw-r--r--features/data/json_attribs/attribute_settings.json3
-rw-r--r--features/steps/run_client_steps.rb9
-rw-r--r--features/support/env.rb3
4 files changed, 26 insertions, 2 deletions
diff --git a/features/chef-client/attribute_settings.feature b/features/chef-client/attribute_settings.feature
index 566c57ea24..4427f719b2 100644
--- a/features/chef-client/attribute_settings.feature
+++ b/features/chef-client/attribute_settings.feature
@@ -116,4 +116,15 @@ Feature: Set default, normal, and override attributes
Then the run should exit '0'
And a file named 'attribute_setting.txt' should contain 'snakes'
-
+ @chef1286
+ Scenario: Attributes are provided as JSON via the command line
+ Given 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 'from_json_file'
+ When the node is retrieved from the API
+ Then the inflated responses key 'attribute_priority_was' should match 'from_json_file'
+
+
+
diff --git a/features/data/json_attribs/attribute_settings.json b/features/data/json_attribs/attribute_settings.json
new file mode 100644
index 0000000000..effc4941e8
--- /dev/null
+++ b/features/data/json_attribs/attribute_settings.json
@@ -0,0 +1,3 @@
+{
+ "attribute_priority_was": "from_json_file"
+} \ No newline at end of file
diff --git a/features/steps/run_client_steps.rb b/features/steps/run_client_steps.rb
index c1de01e913..41b23e10e6 100644
--- a/features/steps/run_client_steps.rb
+++ b/features/steps/run_client_steps.rb
@@ -16,6 +16,8 @@
# limitations under the License.
#
+CHEF_CLIENT = File.join(CHEF_PROJECT_ROOT, "chef", "bin", "chef-client")
+
###
# When
###
@@ -60,6 +62,13 @@ When /^I run the chef\-client at log level '(.+)'$/ do |log_level|
When "I run the chef-client"
end
+When 'I run the chef-client with json attributes' do
+ @log_level = :debug
+ @chef_args = "-j #{File.join(FEATURES_DATA, 'json_attribs', 'attribute_settings.json')}"
+ When "I run the chef-client"
+end
+
+
When /^I run the chef\-client with config file '(.+)'$/ do |config_file|
@config_file = config_file
When "I run the chef-client"
diff --git a/features/support/env.rb b/features/support/env.rb
index a50847afe9..8a985066aa 100644
--- a/features/support/env.rb
+++ b/features/support/env.rb
@@ -22,7 +22,8 @@ require 'spec/expectations'
CHEF_PROJECT_ROOT = File.expand_path(File.dirname(__FILE__) + '/../../')
KNIFE_CONFIG = CHEF_PROJECT_ROOT + '/features/data/config/knife.rb'
KNIFE_CMD = File.expand_path(File.join(CHEF_PROJECT_ROOT, "chef", "bin", "knife"))
-INTEGRATION_COOKBOOKS = File.join(CHEF_PROJECT_ROOT, "features", "data", "cookbooks")
+FEATURES_DATA = File.join(CHEF_PROJECT_ROOT, "features", "data")
+INTEGRATION_COOKBOOKS = File.join(FEATURES_DATA, "cookbooks")
$:.unshift(CHEF_PROJECT_ROOT + '/chef/lib')
$:.unshift(CHEF_PROJECT_ROOT + '/chef-server-api/lib')