From 15eeec09c22da15370152a40311f085f0aced9e2 Mon Sep 17 00:00:00 2001 From: John Keiser Date: Wed, 13 Jan 2016 15:08:48 -0800 Subject: Make upload cookbook_artifacts work --- spec/integration/knife/upload_spec.rb | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) (limited to 'spec/integration') diff --git a/spec/integration/knife/upload_spec.rb b/spec/integration/knife/upload_spec.rb index 79dae99acf..6ef40a1d98 100644 --- a/spec/integration/knife/upload_spec.rb +++ b/spec/integration/knife/upload_spec.rb @@ -1288,6 +1288,7 @@ EOM file "clients/x.json", { "public_key" => ChefZero::PUBLIC_KEY } file "containers/x.json", {} file "cookbooks/x/metadata.rb", cb_metadata("x", "1.0.0") + file "cookbook_artifacts/x-1x1/metadata.rb", cb_metadata("x", "1.0.0") file "data_bags/x/y.json", {} file "environments/x.json", {} file "groups/x.json", {} @@ -1306,6 +1307,7 @@ EOM Updated /acls/groups/blah.json Created /clients/x.json Created /containers/x.json +Created /cookbook_artifacts/x-1x1 Created /cookbooks/x Created /data_bags/x Created /data_bags/x/y.json @@ -1322,6 +1324,7 @@ Created /roles/x.json EOM expect(api.get("association_requests").map { |a| a["username"] }).to eq([ "foo" ]) expect(api.get("users").map { |a| a["user"]["username"] }).to eq([ "bar" ]) + knife("diff --name-status --diff-filter=AMT /").should_succeed "" end context "When the chef server has an identical copy of each thing" do @@ -1333,6 +1336,7 @@ EOM # acl_for %w(organizations foo groups blah) client "x", {} cookbook "x", "1.0.0" + cookbook_artifact "x", "1x1", "metadata.rb" => cb_metadata("x", "1.0.0") container "x", {} data_bag "x", { "y" => {} } environment "x", {} @@ -1345,7 +1349,7 @@ EOM policy_group "x", { "policies" => { "x" => { "revision_id" => "1.0.0" }, - "blah" => { "revision_id" => "1.0.0" }, + "blah" => { "revision_id" => "1.0.0" } } } role "x", {} @@ -1370,12 +1374,25 @@ EOM end end + context "When the chef server has a slightly different copy of the cookbook artifact" do + before do + cookbook_artifact "x", "1x1", { "recipes" => { "default.rb" => "" } } + end + + it "should fail because cookbook_artifacts cannot be updated" do + knife("upload /cookbook_artifacts/x-1x1").should_fail < true } container "x", {} cookbook "x", "1.0.0", { "recipes" => { "default.rb" => "" } } + cookbook_artifact "x", "1x1", { "metadata.rb" => cb_metadata("x", "1.0.0") } data_bag "x", { "y" => { "a" => "b" } } environment "x", { "description" => "foo" } group "x", { "groups" => [ "admin" ] } @@ -1386,7 +1403,7 @@ EOM policy_group "x", { "policies" => { "x" => { "revision_id" => "1.0.1" }, - "y" => { "revision_id" => "1.0.0" }, + "y" => { "revision_id" => "1.0.0" } } } role "x", { "run_list" => [ "blah" ] } -- cgit v1.2.1