summaryrefslogtreecommitdiff
path: root/spec/integration
diff options
context:
space:
mode:
Diffstat (limited to 'spec/integration')
-rw-r--r--spec/integration/knife/upload_spec.rb29
-rw-r--r--spec/integration/solo/solo_spec.rb34
2 files changed, 62 insertions, 1 deletions
diff --git a/spec/integration/knife/upload_spec.rb b/spec/integration/knife/upload_spec.rb
index 6ca8c3d8ce..27736349cc 100644
--- a/spec/integration/knife/upload_spec.rb
+++ b/spec/integration/knife/upload_spec.rb
@@ -1,6 +1,6 @@
#
# Author:: John Keiser (<jkeiser@opscode.com>)
-# Copyright:: Copyright (c) 2013 Opscode, Inc.
+# Copyright:: Copyright (c) 2013-2015 Chef Software, Inc.
# License:: Apache License, Version 2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -699,6 +699,19 @@ EOH
end
end
end
+ when_the_chef_server "is empty" do
+ when_the_repository 'has a cookbook with an invalid chef_version constraint in it' do
+ before do
+ file 'cookbooks/x/metadata.rb', cb_metadata('x', '1.0.0', "\nchef_version '~> 999.0'")
+ end
+ it 'knife upload succeeds' do
+ knife('upload /cookbooks/x').should_succeed <<EOM
+Updated /cookbooks/x
+EOM
+ knife('diff --name-status /cookbooks').should_succeed ''
+ end
+ end
+ end
end # without versioned cookbooks
with_versioned_cookbooks do
@@ -1219,6 +1232,20 @@ EOM
end
end
end
+
+ when_the_chef_server "is empty" do
+ when_the_repository 'has a cookbook with an invalid chef_version constraint in it' do
+ before do
+ file 'cookbooks/x-1.0.0/metadata.rb', cb_metadata('x', '1.0.0', "\nchef_version '~> 999.0'")
+ end
+ it 'knife upload succeeds' do
+ knife('upload /cookbooks/x').should_succeed <<EOM
+Updated /cookbooks/x
+EOM
+ knife('diff --name-status /cookbooks').should_succeed ''
+ end
+ end
+ end
end # with versioned cookbooks
when_the_chef_server 'has a user' do
diff --git a/spec/integration/solo/solo_spec.rb b/spec/integration/solo/solo_spec.rb
index f45933c799..6240a38144 100644
--- a/spec/integration/solo/solo_spec.rb
+++ b/spec/integration/solo/solo_spec.rb
@@ -70,6 +70,40 @@ EOM
end
end
+ when_the_repository "has a cookbook with an incompatible chef_version" do
+ before do
+ file 'cookbooks/x/metadata.rb', cb_metadata('x', '1.0.0', "\nchef_version '~> 999.0'")
+ file 'cookbooks/x/recipes/default.rb', 'puts "ITWORKS"'
+ file 'config/solo.rb', <<EOM
+cookbook_path "#{path_to('cookbooks')}"
+file_cache_path "#{path_to('config/cache')}"
+EOM
+ end
+
+ it "should exit with an error" do
+ result = shell_out("#{chef_solo} -c \"#{path_to('config/solo.rb')}\" -o 'x::default' -l debug", :cwd => chef_dir)
+ expect(result.exitstatus).to eq(1)
+ expect(result.stdout).to include("Chef::Exceptions::CookbookChefVersionMismatch")
+ end
+ end
+
+ when_the_repository "has a cookbook with an incompatible ohai_version" do
+ before do
+ file 'cookbooks/x/metadata.rb', cb_metadata('x', '1.0.0', "\nohai_version '~> 999.0'")
+ file 'cookbooks/x/recipes/default.rb', 'puts "ITWORKS"'
+ file 'config/solo.rb', <<EOM
+cookbook_path "#{path_to('cookbooks')}"
+file_cache_path "#{path_to('config/cache')}"
+EOM
+ end
+
+ it "should exit with an error" do
+ result = shell_out("#{chef_solo} -c \"#{path_to('config/solo.rb')}\" -o 'x::default' -l debug", :cwd => chef_dir)
+ expect(result.exitstatus).to eq(1)
+ expect(result.stdout).to include("Chef::Exceptions::CookbookOhaiVersionMismatch")
+ end
+ end
+
when_the_repository "has a cookbook with a recipe with sleep" do
before do