summaryrefslogtreecommitdiff
path: root/spec/integration/client
diff options
context:
space:
mode:
authorJohn Keiser <jkeiser@opscode.com>2013-09-20 20:07:56 -0700
committerJohn Keiser <jkeiser@opscode.com>2013-10-02 11:57:50 -0700
commitf3683788e36ae8fa4975b9a24daeced36b486ec9 (patch)
treec51f55a266e58647a9e2c1fa2261fc8f546419e0 /spec/integration/client
parent9af06f9f9ccab183aea931262a5408d5f2426e82 (diff)
downloadchef-f3683788e36ae8fa4975b9a24daeced36b486ec9.tar.gz
Add -z and --chef-zero-port options to knife and chef-client
Diffstat (limited to 'spec/integration/client')
-rw-r--r--spec/integration/client/client_spec.rb64
1 files changed, 54 insertions, 10 deletions
diff --git a/spec/integration/client/client_spec.rb b/spec/integration/client/client_spec.rb
index 5527c17ba5..522ee8da8b 100644
--- a/spec/integration/client/client_spec.rb
+++ b/spec/integration/client/client_spec.rb
@@ -5,13 +5,11 @@ describe "chef-client" do
extend IntegrationSupport
include Chef::Mixin::ShellOut
- context "with a no-op recipe in the run_list" do
+ when_the_repository "has a cookbook with a no-op recipe" do
+ file 'cookbooks/x/recipes/default.rb', ''
- when_the_repository "has a cookbook with a no-op recipe" do
- file 'cookbooks/x/recipes/default.rb', ''
-
- it "should complete with success" do
- file 'config/client.rb', <<EOM
+ it "should complete with success" do
+ file 'config/client.rb', <<EOM
chef_zero.enabled true
client_key "#{path_to('config/client.pem')}"
validation_key nil
@@ -21,11 +19,57 @@ file_cache_path "#{path_to('config/cache')}"
file_backup_path "#{path_to('config/backup')}"
EOM
- chef_dir = File.join(File.dirname(__FILE__), "..", "..", "..", "bin")
- result = shell_out("chef-client -c \"#{path_to('config/client.rb')}\" -o 'x::default' -l debug", :cwd => chef_dir)
- result.error!
- end
+ chef_dir = File.join(File.dirname(__FILE__), "..", "..", "..", "bin")
+ result = shell_out("chef-client -c \"#{path_to('config/client.rb')}\" -o 'x::default' -l debug", :cwd => chef_dir)
+ result.error!
+ end
+
+ it "should complete with success when passed the -z flag" do
+ file 'config/client.rb', <<EOM
+chef_server_url 'http://omg.com/blah'
+client_key "#{path_to('config/client.pem')}"
+validation_key nil
+cookbook_path "#{path_to('cookbooks')}"
+checksum_path "#{path_to('config/checksums')}"
+file_cache_path "#{path_to('config/cache')}"
+file_backup_path "#{path_to('config/backup')}"
+EOM
+
+ chef_dir = File.join(File.dirname(__FILE__), "..", "..", "..", "bin")
+ result = shell_out("chef-client -c \"#{path_to('config/client.rb')}\" -o 'x::default' -l debug -z", :cwd => chef_dir)
+ result.error!
+ end
+
+ it "should complete with success when passed the --zero flag" do
+ file 'config/client.rb', <<EOM
+chef_server_url 'http://omg.com/blah'
+client_key "#{path_to('config/client.pem')}"
+validation_key nil
+cookbook_path "#{path_to('cookbooks')}"
+checksum_path "#{path_to('config/checksums')}"
+file_cache_path "#{path_to('config/cache')}"
+file_backup_path "#{path_to('config/backup')}"
+EOM
+
+ chef_dir = File.join(File.dirname(__FILE__), "..", "..", "..", "bin")
+ result = shell_out("chef-client -c \"#{path_to('config/client.rb')}\" -o 'x::default' -l debug --zero", :cwd => chef_dir)
+ result.error!
+ end
+
+ it "should complete with success when passed -z and --chef-zero-port" do
+ file 'config/client.rb', <<EOM
+chef_server_url 'http://omg.com/blah'
+client_key "#{path_to('config/client.pem')}"
+validation_key nil
+cookbook_path "#{path_to('cookbooks')}"
+checksum_path "#{path_to('config/checksums')}"
+file_cache_path "#{path_to('config/cache')}"
+file_backup_path "#{path_to('config/backup')}"
+EOM
+ chef_dir = File.join(File.dirname(__FILE__), "..", "..", "..", "bin")
+ result = shell_out("chef-client -c \"#{path_to('config/client.rb')}\" -o 'x::default' -l debug -z", :cwd => chef_dir)
+ result.error!
end
end
end