diff options
author | jkeiser <jkeiser@opscode.com> | 2013-01-16 12:31:12 -0800 |
---|---|---|
committer | John Keiser <jkeiser@opscode.com> | 2013-06-07 13:12:21 -0700 |
commit | 24d5c6aa2cc3d8e8236a5de5fd3ae8080db49ea8 (patch) | |
tree | d2ac4dc07a537df6e7dbbc0246c7989dbb5d7529 /spec | |
parent | 14e1abe669299c324fddbd038e24e7d9c862b302 (diff) | |
download | chef-24d5c6aa2cc3d8e8236a5de5fd3ae8080db49ea8.tar.gz |
Add knife diff cwd, wildcard and cookbook version tests
Diffstat (limited to 'spec')
-rw-r--r-- | spec/integration/knife/diff_spec.rb | 66 | ||||
-rw-r--r-- | spec/integration/knife/download_spec.rb | 2 | ||||
-rw-r--r-- | spec/integration/knife/upload_spec.rb | 2 |
3 files changed, 68 insertions, 2 deletions
diff --git a/spec/integration/knife/diff_spec.rb b/spec/integration/knife/diff_spec.rb index 7465b4d54c..e0be660ab9 100644 --- a/spec/integration/knife/diff_spec.rb +++ b/spec/integration/knife/diff_spec.rb @@ -134,6 +134,22 @@ A\t/environments/y.json A\t/roles/y.json EOM end + + context 'when cwd is the data_bags directory' do + cwd 'data_bags' + it 'knife diff reports different data bags' do + knife('diff --name-status').should_succeed <<EOM +A\tx/z.json +A\ty +EOM + end + it 'knife diff * reports different data bags' do + knife('diff --name-status *').should_succeed <<EOM +A\tx/z.json +A\ty +EOM + end + end end end @@ -148,4 +164,54 @@ EOM 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', '' + + when_the_chef_server 'has a later version for the cookbook' do + 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' => '' } + + it 'knife diff /cookbooks/x shows differences' do + knife('diff --name-status /cookbooks/x').should_succeed <<EOM +M\t/cookbooks/x/metadata.rb +D\t/cookbooks/x/onlyin1.0.1.rb +A\t/cookbooks/x/onlyin1.0.0.rb +EOM + 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"', 'onlyin1.0.0.rb' => '' } + cookbook 'x', '0.9.9', { 'metadata.rb' => 'version "0.9.9"', 'onlyin0.9.9.rb' => '' } + it 'knife diff /cookbooks/x shows no differences' do + knife('diff --name-status /cookbooks/x').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"', 'onlyin1.0.1.rb' => '' } + + it 'knife diff /cookbooks/x shows the differences' do + knife('diff --name-status /cookbooks/x').should_succeed <<EOM +M\t/cookbooks/x/metadata.rb +D\t/cookbooks/x/onlyin1.0.1.rb +A\t/cookbooks/x/onlyin1.0.0.rb +EOM + 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"', 'onlyin0.9.9.rb' => '' } + + it 'knife diff /cookbooks/x shows the differences' do + knife('diff --name-status /cookbooks/x').should_succeed <<EOM +M\t/cookbooks/x/metadata.rb +D\t/cookbooks/x/onlyin0.9.9.rb +A\t/cookbooks/x/onlyin1.0.0.rb +EOM + end + end + end end diff --git a/spec/integration/knife/download_spec.rb b/spec/integration/knife/download_spec.rb index 73a7dc671c..747de84c02 100644 --- a/spec/integration/knife/download_spec.rb +++ b/spec/integration/knife/download_spec.rb @@ -478,7 +478,7 @@ EOM 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 "1.0.1"', 'y.rb' => 'hi' } + cookbook 'x', '0.9.9', { 'metadata.rb' => 'version "0.9.9"', 'y.rb' => 'hi' } it 'knife download /cookbooks/x downloads the old version' do knife('download --purge /cookbooks/x').should_succeed <<EOM diff --git a/spec/integration/knife/upload_spec.rb b/spec/integration/knife/upload_spec.rb index 221ad5c85f..04832fa6ee 100644 --- a/spec/integration/knife/upload_spec.rb +++ b/spec/integration/knife/upload_spec.rb @@ -495,7 +495,7 @@ EOM 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 "1.0.1"', 'y.rb' => 'hi' } + cookbook 'x', '0.9.9', { 'metadata.rb' => 'version "0.9.9"', 'y.rb' => 'hi' } it 'knife upload /cookbooks/x uploads the new version' do knife('upload --purge /cookbooks/x').should_succeed <<EOM |