diff options
author | danielsdeleo <dan@opscode.com> | 2013-11-18 16:25:17 -0800 |
---|---|---|
committer | danielsdeleo <dan@opscode.com> | 2013-11-19 10:59:33 -0800 |
commit | a486a8fbe2c13084c3ec04f2c3083f31bd09128e (patch) | |
tree | 9d696f5b499bb8c0d07a19a7efba1b490f146dba /spec/integration | |
parent | 30586764c91b8344d04a5bb1c2984ab816f6e5bd (diff) | |
download | chef-a486a8fbe2c13084c3ec04f2c3083f31bd09128e.tar.gz |
Add integration test for chef-client IPv6
Diffstat (limited to 'spec/integration')
-rw-r--r-- | spec/integration/client/ipv6_spec.rb | 131 |
1 files changed, 131 insertions, 0 deletions
diff --git a/spec/integration/client/ipv6_spec.rb b/spec/integration/client/ipv6_spec.rb new file mode 100644 index 0000000000..f8d4a68c94 --- /dev/null +++ b/spec/integration/client/ipv6_spec.rb @@ -0,0 +1,131 @@ +# +# Author:: Daniel DeLeo (<dan@opscode.com>) +# Copyright:: Copyright (c) 2013 Opscode, 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 'support/shared/integration/integration_helper' +require 'chef/mixin/shell_out' + +describe "chef-client" do + extend IntegrationSupport + include Chef::Mixin::ShellOut + + let(:chef_zero_opts) { {:host => "::1"} } + + let(:validation_pem) do + <<-END_VALIDATION_PEM +-----BEGIN RSA PRIVATE KEY----- +MIIEogIBAAKCAQEApubutqtYYQ5UiA9QhWP7UvSmsfHsAoPKEVVPdVW/e8Svwpyf +0Xef6OFWVmBE+W442ZjLOe2y6p2nSnaq4y7dg99NFz6X+16mcKiCbj0RCiGqCvCk +NftHhTgO9/RFvCbmKZ1RKNob1YzLrF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mZdrA5mr0V83oDFPt/jQKBgC74RVE03pMlZiObFZNtheDiPKSG9Bz6wMh7NWMr +c37MtZLkg52mEFMTlfPLe6ceV37CM8WOhqe+dwSGrYhOU06dYqUR7VOZ1Qr0aZvo +fsNPu/Y0+u7rMkgv0fs1AXQnvz7kvKaF0YITVirfeXMafuKEtJoH7owRbur42cpV +YCAtAoGAP1rHOc+w0RUcBK3sY7aErrih0OPh9U5bvJsrw1C0FIZhCEoDVA+fNIQL +syHLXYFNy0OxMtH/bBAXBGNHd9gf5uOnqh0pYcbe/uRAxumC7Rl0cL509eURiA2T ++vFmf54y9YdnLXaqv+FhJT6B6V7WX7IpU9BMqJY1cJYXHuHG2KA= +-----END RSA PRIVATE KEY----- +END_VALIDATION_PEM + end + + let(:cache_path) do + Dir.mktmpdir + end + + let(:basic_config_file) do + <<-END_CLIENT_RB +chef_server_url "http://[::1]:8889" +validation_key '#{path_to('config/validator.pem')}' +cache_path '#{cache_path}' +client_key '#{cache_path}/client.pem' +END_CLIENT_RB + end + + let(:client_rb_content) do + basic_config_file + end + + + let(:chef_dir) { File.join(File.dirname(__FILE__), "..", "..", "..", "bin") } + + let(:chef_client_cmd) { %Q[chef-client -c "#{path_to('config/client.rb')}" -lwarn] } + + after do + FileUtils.rm_rf(cache_path) + end + + when_the_chef_server "is running on IPv6" do + + when_the_repository "has a cookbook with a no-op recipe" do + cookbook 'noop', '1.0.0', { 'metadata.rb' => 'version "1.0.0"' }, "recipes" => {"default.rb" => "#raise 'foo'"} + before do + file 'config/client.rb', client_rb_content + file 'config/validator.pem', validation_pem + end + + it "should complete with success" do + result = shell_out("#{chef_client_cmd} -o 'noop::default'", :cwd => chef_dir) + result.error! + end + + end + + when_the_repository "has a cookbook that hits server APIs" do + + recipe=<<-END_RECIPE + actual_item = data_bag_item("expect_bag", "expect_item") + if actual_item.key?("expect_key") and actual_item["expect_key"] == "expect_value" + Chef::Log.info "lookin good" + else + Chef::Log.error("!" * 80) + raise "unexpected data bag item content \#{actual_item.inspect}" + Chef::Log.error("!" * 80) + end + + END_RECIPE + + data_bag('expect_bag', { 'expect_item' => {"expect_key" => "expect_value"} }) + + cookbook 'api-smoke-test', '1.0.0', { 'metadata.rb' => 'version "1.0.0"' }, "recipes" => {"default.rb" => recipe} + + before do + file 'config/client.rb', client_rb_content + file 'config/validator.pem', validation_pem + end + + it "should complete with success" do + result = shell_out("#{chef_client_cmd} -o 'api-smoke-test::default'", :cwd => chef_dir) + result.error! + end + + end + end +end |