diff options
author | John Keiser <jkeiser@opscode.com> | 2013-06-03 14:53:40 -0700 |
---|---|---|
committer | John Keiser <jkeiser@opscode.com> | 2013-06-07 13:12:36 -0700 |
commit | 2110aa47e073e31ce920ddf1e47d282100edd644 (patch) | |
tree | 0cc8b36383c09b6a156627748c06bf79c083e2ef /spec/integration/knife | |
parent | a9aad0c40c92cc1427ebb577817c23f180a9dba2 (diff) | |
download | chef-2110aa47e073e31ce920ddf1e47d282100edd644.tar.gz |
Add tests for knife upload --freeze
Diffstat (limited to 'spec/integration/knife')
-rw-r--r-- | spec/integration/knife/upload_spec.rb | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/spec/integration/knife/upload_spec.rb b/spec/integration/knife/upload_spec.rb index c73a14f78b..3bc8f6e622 100644 --- a/spec/integration/knife/upload_spec.rb +++ b/spec/integration/knife/upload_spec.rb @@ -368,6 +368,38 @@ EOM knife('diff --name-status /cookbooks').should_succeed '' end end + + when_the_repository 'has a different file in the cookbook' do + file 'cookbooks/x/metadata.rb', 'version "1.0.0"' + + it 'knife upload --freeze freezes the cookbook' do + knife('upload --freeze /cookbooks/x').should_succeed <<EOM +Updated /cookbooks/x +EOM + # Modify a file and attempt to upload + file 'cookbooks/x/metadata.rb', 'version "1.0.0" # This is different' + knife('upload /cookbooks/x').should_fail "ERROR: /cookbooks failed to write: Cookbook x is frozen\n" + end + end + end + + when_the_chef_server 'has a frozen cookbook' do + cookbook 'frozencook', '1.0.0', { + 'metadata.rb' => 'version "1.0.0"' + }, :frozen => true + + when_the_repository 'has an update to said cookbook' do + file 'cookbooks/frozencook/metadata.rb', 'version "1.0.0" # This is different' + + it 'knife upload fails to upload the frozen cookbook' do + knife('upload /cookbooks/frozencook').should_fail "ERROR: /cookbooks failed to write: Cookbook frozencook is frozen\n" + end + it 'knife upload --force uploads the frozen cookbook' do + knife('upload --force /cookbooks/frozencook').should_succeed <<EOM +Updated /cookbooks/frozencook +EOM + end + end end when_the_repository 'has a cookbook' do |