diff options
author | Vasu1105 <vasundhara.jagdale@msystechnologies.com> | 2019-12-23 13:30:31 +0530 |
---|---|---|
committer | Vasu1105 <vasundhara.jagdale@msystechnologies.com> | 2019-12-23 13:30:31 +0530 |
commit | d13e7054083e4dc8e6f7f869d374e43cfd643be9 (patch) | |
tree | dde11a53dc5195cd5d575be448ea5db6cfbc85b8 | |
parent | e57e97eb4c72a4a7213eecce8fbb15ce74159848 (diff) | |
download | chef-d13e7054083e4dc8e6f7f869d374e43cfd643be9.tar.gz |
Added more few more integration specs
Signed-off-by: Vasu1105 <vasundhara.jagdale@msystechnologies.com>
-rw-r--r-- | spec/integration/knife/cookbook_upload_spec.rb | 10 | ||||
-rw-r--r-- | spec/integration/knife/upload_spec.rb | 21 |
2 files changed, 30 insertions, 1 deletions
diff --git a/spec/integration/knife/cookbook_upload_spec.rb b/spec/integration/knife/cookbook_upload_spec.rb index 7e98b6ea64..6496a911b0 100644 --- a/spec/integration/knife/cookbook_upload_spec.rb +++ b/spec/integration/knife/cookbook_upload_spec.rb @@ -86,5 +86,15 @@ describe "knife cookbook upload", :workstation do EOM end end + + when_the_repository "has cookbook metadata without name attribute in metadata file" do + before do + file "cookbooks/x/metadata.rb", cb_metadata(nil, "1.0.0") + end + + it "knife cookbook upload x " do + expect { knife("cookbook upload x -o #{cb_dir}") }.to raise_error(Chef::Exceptions::MetadataNotValid) + end + end end end diff --git a/spec/integration/knife/upload_spec.rb b/spec/integration/knife/upload_spec.rb index 6b85633345..77db50fc22 100644 --- a/spec/integration/knife/upload_spec.rb +++ b/spec/integration/knife/upload_spec.rb @@ -452,11 +452,30 @@ describe "knife upload", :workstation do # upload of a file is designed not to work at present. Make sure that is the # case. when_the_chef_server "has a cookbook" do - before do cookbook "x", "1.0.0", { "z.rb" => "" } end + when_the_repository "does not have metadata file" do + before do + file "cookbooks/x/y.rb", "hi" + end + + it "raises MetadataNotFound exception" do + expect { knife("upload /cookbooks/x") }.to raise_error(Chef::Exceptions::MetadataNotFound) + end + end + + when_the_repository "does not have valid metadata" do + before do + file "cookbooks/x/metadata.rb", cb_metadata(nil, "1.0.0") + end + + it "raises exception for invalid metadata" do + expect { knife("upload /cookbooks/x") }.to raise_error(Chef::Exceptions::MetadataNotValid) + end + end + when_the_repository "has a modified, extra and missing file for the cookbook" do before do file "cookbooks/x/metadata.rb", cb_metadata("x", "1.0.0", "#modified") |