diff options
author | jkeiser <jkeiser@opscode.com> | 2013-01-17 08:11:41 -0800 |
---|---|---|
committer | John Keiser <jkeiser@opscode.com> | 2013-06-07 13:12:21 -0700 |
commit | 929a6895a106afc516c050b6366fa0f01cc0034a (patch) | |
tree | 4562d8264051f7c1a7462c52a064a09013ce2d47 /spec/integration/knife/download_spec.rb | |
parent | f61f4b52644d255083333b0503cd8f9d6a8ad652 (diff) | |
download | chef-929a6895a106afc516c050b6366fa0f01cc0034a.tar.gz |
Make knife upload/download detect identical cookbooks correctly
Diffstat (limited to 'spec/integration/knife/download_spec.rb')
-rw-r--r-- | spec/integration/knife/download_spec.rb | 37 |
1 files changed, 21 insertions, 16 deletions
diff --git a/spec/integration/knife/download_spec.rb b/spec/integration/knife/download_spec.rb index 747de84c02..8baee8803b 100644 --- a/spec/integration/knife/download_spec.rb +++ b/spec/integration/knife/download_spec.rb @@ -440,56 +440,61 @@ EOM knife('diff --name-status /cookbooks').should_succeed '' end end + end + + when_the_repository 'has a cookbook' do + file 'cookbooks/x/metadata.rb', 'version "1.0.0"' + file 'cookbooks/x/onlyin1.0.0.rb', 'old_text' when_the_chef_server 'has a later version for the cookbook' do - cookbook 'x', '1.0.0', { 'metadata.rb' => 'version "1.0.0"', 'z.rb' => ''} - cookbook 'x', '1.0.1', { 'metadata.rb' => 'version "1.0.1"', 'y.rb' => 'hi' } + cookbook 'x', '1.0.0', { 'metadata.rb' => 'version "1.0.0"', 'onlyin1.0.0.rb' => '' } + cookbook 'x', '1.0.1', { 'metadata.rb' => 'version "1.0.1"', 'onlyin1.0.1.rb' => 'hi' } it 'knife download /cookbooks/x downloads the latest version' do knife('download --purge /cookbooks/x').should_succeed <<EOM Updated /cookbooks/x/metadata.rb -Created /cookbooks/x/y.rb -Deleted extra entry /cookbooks/x/z.rb (purge is on) +Created /cookbooks/x/onlyin1.0.1.rb +Deleted extra entry /cookbooks/x/onlyin1.0.0.rb (purge is on) EOM knife('diff --name-status /cookbooks').should_succeed '' end end when_the_chef_server 'has an earlier version for the cookbook' do - cookbook 'x', '1.0.0', { 'metadata.rb' => 'version "1.0.0"', 'z.rb' => ''} - cookbook 'x', '0.9.9', { 'metadata.rb' => 'version "0.9.9"', 'y.rb' => 'hi' } - it 'knife download /cookbooks/x does nothing' do - knife('download --purge /cookbooks/x').should_succeed '' + cookbook 'x', '1.0.0', { 'metadata.rb' => 'version "1.0.0"', 'onlyin1.0.0.rb' => ''} + cookbook 'x', '0.9.9', { 'metadata.rb' => 'version "0.9.9"', 'onlyin0.9.9.rb' => 'hi' } + it 'knife download /cookbooks/x downloads the updated file' do + knife('download --purge /cookbooks/x').should_succeed <<EOM +Updated /cookbooks/x/onlyin1.0.0.rb +EOM knife('diff --name-status /cookbooks').should_succeed '' end end when_the_chef_server 'has a later version for the cookbook, and no current version' do - cookbook 'x', '1.0.1', { 'metadata.rb' => 'version "1.0.1"', 'y.rb' => 'hi' } + cookbook 'x', '1.0.1', { 'metadata.rb' => 'version "1.0.1"', 'onlyin1.0.1.rb' => 'hi' } it 'knife download /cookbooks/x downloads the latest version' do knife('download --purge /cookbooks/x').should_succeed <<EOM Updated /cookbooks/x/metadata.rb -Created /cookbooks/x/y.rb -Deleted extra entry /cookbooks/x/z.rb (purge is on) +Created /cookbooks/x/onlyin1.0.1.rb +Deleted extra entry /cookbooks/x/onlyin1.0.0.rb (purge is on) EOM knife('diff --name-status /cookbooks').should_succeed '' end end when_the_chef_server 'has an earlier version for the cookbook, and no current version' do - cookbook 'x', '0.9.9', { 'metadata.rb' => 'version "0.9.9"', 'y.rb' => 'hi' } + cookbook 'x', '0.9.9', { 'metadata.rb' => 'version "0.9.9"', 'onlyin0.9.9.rb' => 'hi' } it 'knife download /cookbooks/x downloads the old version' do knife('download --purge /cookbooks/x').should_succeed <<EOM Updated /cookbooks/x/metadata.rb -Created /cookbooks/x/y.rb -Deleted extra entry /cookbooks/x/z.rb (purge is on) +Created /cookbooks/x/onlyin0.9.9.rb +Deleted extra entry /cookbooks/x/onlyin1.0.0.rb (purge is on) EOM knife('diff --name-status /cookbooks').should_succeed '' end end end - - # Multiple cookbook versions!!! end |