# # Author:: John Keiser () # Copyright:: Copyright (c) 2013 Opscode, Inc. # License:: Apache License, Version 2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. require 'support/shared/integration/integration_helper' require 'chef/knife/list' require 'chef/knife/show' describe 'General chef_repo file system checks', :workstation do extend IntegrationSupport include KnifeSupport context 'directories and files that should/should not be ignored' do when_the_repository "has empty roles, environments and data bag item directories" do directory "roles" directory "environments" directory "data_bags/bag1" it "knife list --local -Rfp / returns them" do knife('list --local -Rfp /').should_succeed < "WARN: Cookbook 'cookbook1' is empty or entirely chefignored at #{Chef::Config.chef_repo_path}/cookbooks/cookbook1\n") /cookbooks/ EOM end end when_the_repository "has only empty cookbook subdirectories" do directory 'cookbooks/cookbook1/recipes' it "knife list --local -Rfp / does not return it" do knife('list --local -Rfp /').should_succeed(< "WARN: Cookbook 'cookbook1' is empty or entirely chefignored at #{Chef::Config.chef_repo_path}/cookbooks/cookbook1\n") /cookbooks/ EOM end end when_the_repository "has empty and non-empty cookbook subdirectories" do directory 'cookbooks/cookbook1/recipes' file 'cookbooks/cookbook1/templates/default/x.txt', '' it "knife list --local -Rfp / does not return the empty ones" do knife('list --local -Rfp /').should_succeed < "WARN: Cookbook 'cookbook1' is empty or entirely chefignored at #{Chef::Config.chef_repo_path}/cookbooks/cookbook1\n") /cookbooks/ EOM end end when_the_repository "has empty cookbook sub-sub-directories alongside non-empty ones" do file 'cookbooks/cookbook1/templates/default/x.txt', '' directory 'cookbooks/cookbook1/templates/rhel' directory 'cookbooks/cookbook1/files/default' it "knife list --local -Rfp / does not return the empty ones" do knife('list --local -Rfp /').should_succeed <