summaryrefslogtreecommitdiff
path: root/spec/integration/knife/list_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/integration/knife/list_spec.rb')
-rw-r--r--spec/integration/knife/list_spec.rb266
1 files changed, 133 insertions, 133 deletions
diff --git a/spec/integration/knife/list_spec.rb b/spec/integration/knife/list_spec.rb
index eb2ed279e5..32f5bb43f8 100644
--- a/spec/integration/knife/list_spec.rb
+++ b/spec/integration/knife/list_spec.rb
@@ -15,11 +15,11 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-require 'support/shared/integration/integration_helper'
-require 'support/shared/context/config'
-require 'chef/knife/list'
+require "support/shared/integration/integration_helper"
+require "support/shared/context/config"
+require "chef/knife/list"
-describe 'knife list', :workstation do
+describe "knife list", :workstation do
include IntegrationSupport
include KnifeSupport
@@ -27,7 +27,7 @@ describe 'knife list', :workstation do
when_the_chef_server "is empty" do
it "knife list / returns all top level directories" do
- knife('list /').should_succeed <<-EOM
+ knife("list /").should_succeed <<-EOM
/clients
/cookbooks
/data_bags
@@ -39,7 +39,7 @@ EOM
end
it "knife list -R / returns everything" do
- knife('list -R /').should_succeed <<-EOM
+ knife("list -R /").should_succeed <<-EOM
/:
clients
cookbooks
@@ -72,27 +72,27 @@ EOM
when_the_chef_server "has plenty of stuff in it" do
before do
- client 'client1', {}
- client 'client2', {}
- cookbook 'cookbook1', '1.0.0'
- cookbook 'cookbook2', '1.0.1', { 'recipes' => { 'default.rb' => '' } }
- data_bag 'bag1', { 'item1' => {}, 'item2' => {} }
- data_bag 'bag2', { 'item1' => {}, 'item2' => {} }
- environment 'environment1', {}
- environment 'environment2', {}
- node 'node1', {}
- node 'node2', {}
- policy 'policy1', '1.2.3', {}
- policy 'policy2', '1.2.3', {}
- policy 'policy2', '1.3.5', {}
- role 'role1', {}
- role 'role2', {}
- user 'user1', {}
- user 'user2', {}
+ client "client1", {}
+ client "client2", {}
+ cookbook "cookbook1", "1.0.0"
+ cookbook "cookbook2", "1.0.1", { "recipes" => { "default.rb" => "" } }
+ data_bag "bag1", { "item1" => {}, "item2" => {} }
+ data_bag "bag2", { "item1" => {}, "item2" => {} }
+ environment "environment1", {}
+ environment "environment2", {}
+ node "node1", {}
+ node "node2", {}
+ policy "policy1", "1.2.3", {}
+ policy "policy2", "1.2.3", {}
+ policy "policy2", "1.3.5", {}
+ role "role1", {}
+ role "role2", {}
+ user "user1", {}
+ user "user2", {}
end
it "knife list / returns all top level directories" do
- knife('list /').should_succeed <<-EOM
+ knife("list /").should_succeed <<-EOM
/clients
/cookbooks
/data_bags
@@ -104,7 +104,7 @@ EOM
end
it "knife list -R / returns everything" do
- knife('list -R /').should_succeed <<-EOM
+ knife("list -R /").should_succeed <<-EOM
/:
clients
cookbooks
@@ -167,7 +167,7 @@ EOM
end
it "knife list -R --flat / returns everything" do
- knife('list -R --flat /').should_succeed <<-EOM
+ knife("list -R --flat /").should_succeed <<-EOM
/clients
/clients/chef-validator.json
/clients/chef-webui.json
@@ -205,7 +205,7 @@ EOM
end
it "knife list -Rfp / returns everything" do
- knife('list -Rfp /').should_succeed <<-EOM
+ knife("list -Rfp /").should_succeed <<-EOM
/clients/
/clients/chef-validator.json
/clients/chef-webui.json
@@ -243,18 +243,18 @@ EOM
end
it "knife list /cookbooks returns the list of cookbooks" do
- knife('list /cookbooks').should_succeed <<-EOM
+ knife("list /cookbooks").should_succeed <<-EOM
/cookbooks/cookbook1
/cookbooks/cookbook2
EOM
end
it "knife list /cookbooks/*2/*/*.rb returns the one file" do
- knife('list /cookbooks/*2/*/*.rb').should_succeed "/cookbooks/cookbook2/recipes/default.rb\n"
+ knife("list /cookbooks/*2/*/*.rb").should_succeed "/cookbooks/cookbook2/recipes/default.rb\n"
end
it "knife list /**.rb returns all ruby files" do
- knife('list /**.rb').should_succeed <<-EOM
+ knife("list /**.rb").should_succeed <<-EOM
/cookbooks/cookbook1/metadata.rb
/cookbooks/cookbook2/metadata.rb
/cookbooks/cookbook2/recipes/default.rb
@@ -262,7 +262,7 @@ EOM
end
it "knife list /cookbooks/**.rb returns all ruby files" do
- knife('list /cookbooks/**.rb').should_succeed <<-EOM
+ knife("list /cookbooks/**.rb").should_succeed <<-EOM
/cookbooks/cookbook1/metadata.rb
/cookbooks/cookbook2/metadata.rb
/cookbooks/cookbook2/recipes/default.rb
@@ -270,7 +270,7 @@ EOM
end
it "knife list /**.json returns all json files" do
- knife('list /**.json').should_succeed <<-EOM
+ knife("list /**.json").should_succeed <<-EOM
/clients/chef-validator.json
/clients/chef-webui.json
/clients/client1.json
@@ -293,7 +293,7 @@ EOM
end
it "knife list /data**.json returns all data bag json files" do
- knife('list /data**.json').should_succeed <<-EOM
+ knife("list /data**.json").should_succeed <<-EOM
/data_bags/bag1/item1.json
/data_bags/bag1/item2.json
/data_bags/bag2/item1.json
@@ -302,30 +302,30 @@ EOM
end
it "knife list /environments/missing_file.json reports missing file" do
- knife('list /environments/missing_file.json').should_fail "ERROR: /environments/missing_file.json: No such file or directory\n"
+ knife("list /environments/missing_file.json").should_fail "ERROR: /environments/missing_file.json: No such file or directory\n"
end
context "missing file/directory exact match tests" do
it "knife list /blarghle reports missing directory" do
- knife('list /blarghle').should_fail "ERROR: /blarghle: No such file or directory\n"
+ knife("list /blarghle").should_fail "ERROR: /blarghle: No such file or directory\n"
end
it "knife list /roles/blarghle reports missing directory" do
- knife('list /roles/blarghle').should_fail "ERROR: /roles/blarghle: No such file or directory\n"
+ knife("list /roles/blarghle").should_fail "ERROR: /roles/blarghle: No such file or directory\n"
end
it "knife list /roles/blarghle/blorghle reports missing directory" do
- knife('list /roles/blarghle/blorghle').should_fail "ERROR: /roles/blarghle/blorghle: No such file or directory\n"
+ knife("list /roles/blarghle/blorghle").should_fail "ERROR: /roles/blarghle/blorghle: No such file or directory\n"
end
end
- context 'symlink tests' do
- when_the_repository 'is empty' do
- context 'when cwd is at the top of the repository' do
- before { cwd '.' }
+ context "symlink tests" do
+ when_the_repository "is empty" do
+ context "when cwd is at the top of the repository" do
+ before { cwd "." }
it "knife list -Rfp returns everything" do
- knife('list -Rfp').should_succeed <<-EOM
+ knife("list -Rfp").should_succeed <<-EOM
clients/
clients/chef-validator.json
clients/chef-webui.json
@@ -364,13 +364,13 @@ EOM
end
end
- when_the_repository 'has a cookbooks directory' do
- before { directory 'cookbooks' }
- context 'when cwd is in cookbooks/' do
- before { cwd 'cookbooks' }
+ when_the_repository "has a cookbooks directory" do
+ before { directory "cookbooks" }
+ context "when cwd is in cookbooks/" do
+ before { cwd "cookbooks" }
it "knife list -Rfp / returns everything" do
- knife('list -Rfp /').should_succeed <<-EOM
+ knife("list -Rfp /").should_succeed <<-EOM
/clients/
/clients/chef-validator.json
/clients/chef-webui.json
@@ -408,7 +408,7 @@ EOM
end
it "knife list -Rfp .. returns everything" do
- knife('list -Rfp ..').should_succeed <<-EOM
+ knife("list -Rfp ..").should_succeed <<-EOM
/clients/
/clients/chef-validator.json
/clients/chef-webui.json
@@ -446,7 +446,7 @@ EOM
end
it "knife list -Rfp returns cookbooks" do
- knife('list -Rfp').should_succeed <<-EOM
+ knife("list -Rfp").should_succeed <<-EOM
cookbook1/
cookbook1/metadata.rb
cookbook2/
@@ -458,14 +458,14 @@ EOM
end
end
- when_the_repository 'has a cookbooks/cookbook2 directory' do
- before { directory 'cookbooks/cookbook2' }
+ when_the_repository "has a cookbooks/cookbook2 directory" do
+ before { directory "cookbooks/cookbook2" }
- context 'when cwd is in cookbooks/cookbook2' do
- before { cwd 'cookbooks/cookbook2' }
+ context "when cwd is in cookbooks/cookbook2" do
+ before { cwd "cookbooks/cookbook2" }
it "knife list -Rfp returns cookbooks" do
- knife('list -Rfp').should_succeed <<-EOM
+ knife("list -Rfp").should_succeed <<-EOM
metadata.rb
recipes/
recipes/default.rb
@@ -474,17 +474,17 @@ EOM
end
end
- when_the_repository 'has a cookbooks directory and a symlinked cookbooks directory', :skip => (Chef::Platform.windows?) do
+ when_the_repository "has a cookbooks directory and a symlinked cookbooks directory", :skip => (Chef::Platform.windows?) do
before do
- directory 'cookbooks'
- symlink 'symlinked', 'cookbooks'
+ directory "cookbooks"
+ symlink "symlinked", "cookbooks"
end
- context 'when cwd is in cookbooks/' do
- before { cwd 'cookbooks' }
+ context "when cwd is in cookbooks/" do
+ before { cwd "cookbooks" }
it "knife list -Rfp returns cookbooks" do
- knife('list -Rfp').should_succeed <<-EOM
+ knife("list -Rfp").should_succeed <<-EOM
cookbook1/
cookbook1/metadata.rb
cookbook2/
@@ -495,11 +495,11 @@ EOM
end
end
- context 'when cwd is in symlinked/' do
- before { cwd 'symlinked' }
+ context "when cwd is in symlinked/" do
+ before { cwd "symlinked" }
it "knife list -Rfp returns cookbooks" do
- knife('list -Rfp').should_succeed <<-EOM
+ knife("list -Rfp").should_succeed <<-EOM
cookbook1/
cookbook1/metadata.rb
cookbook2/
@@ -511,17 +511,17 @@ EOM
end
end
- when_the_repository 'has a real_cookbooks directory and a cookbooks symlink to it', :skip => (Chef::Platform.windows?) do
+ when_the_repository "has a real_cookbooks directory and a cookbooks symlink to it", :skip => (Chef::Platform.windows?) do
before do
- directory 'real_cookbooks'
- symlink 'cookbooks', 'real_cookbooks'
+ directory "real_cookbooks"
+ symlink "cookbooks", "real_cookbooks"
end
- context 'when cwd is in real_cookbooks/' do
- before { cwd 'real_cookbooks' }
+ context "when cwd is in real_cookbooks/" do
+ before { cwd "real_cookbooks" }
it "knife list -Rfp returns cookbooks" do
- knife('list -Rfp').should_succeed <<-EOM
+ knife("list -Rfp").should_succeed <<-EOM
cookbook1/
cookbook1/metadata.rb
cookbook2/
@@ -532,11 +532,11 @@ EOM
end
end
- context 'when cwd is in cookbooks/' do
- before { cwd 'cookbooks' }
+ context "when cwd is in cookbooks/" do
+ before { cwd "cookbooks" }
it "knife list -Rfp returns cookbooks" do
- knife('list -Rfp').should_succeed <<-EOM
+ knife("list -Rfp").should_succeed <<-EOM
cookbook1/
cookbook1/metadata.rb
cookbook2/
@@ -553,51 +553,51 @@ EOM
context "--local" do
when_the_repository "is empty" do
it "knife list --local / returns nothing" do
- knife('list --local /').should_succeed ""
+ knife("list --local /").should_succeed ""
end
it "knife list /roles returns nothing" do
- knife('list --local /roles').should_fail "ERROR: /roles: No such file or directory\n"
+ knife("list --local /roles").should_fail "ERROR: /roles: No such file or directory\n"
end
end
when_the_repository "has a bunch of stuff" do
before do
- file 'clients/client1.json', {}
- file 'clients/client2.json', {}
+ file "clients/client1.json", {}
+ file "clients/client2.json", {}
- directory 'cookbooks/cookbook1' do
- file 'metadata.rb', cb_metadata("cookbook1", "1.0.0")
+ directory "cookbooks/cookbook1" do
+ file "metadata.rb", cb_metadata("cookbook1", "1.0.0")
end
- directory 'cookbooks/cookbook2' do
- file 'metadata.rb', cb_metadata("cookbook2", "2.0.0")
- file 'recipes/default.rb', ''
+ directory "cookbooks/cookbook2" do
+ file "metadata.rb", cb_metadata("cookbook2", "2.0.0")
+ file "recipes/default.rb", ""
end
- directory 'data_bags' do
- directory 'bag1' do
- file 'item1.json', {}
- file 'item2.json', {}
+ directory "data_bags" do
+ directory "bag1" do
+ file "item1.json", {}
+ file "item2.json", {}
end
- directory 'bag2' do
- file 'item1.json', {}
- file 'item2.json', {}
+ directory "bag2" do
+ file "item1.json", {}
+ file "item2.json", {}
end
end
- file 'environments/environment1.json', {}
- file 'environments/environment2.json', {}
- file 'nodes/node1.json', {}
- file 'nodes/node2.json', {}
+ file "environments/environment1.json", {}
+ file "environments/environment2.json", {}
+ file "nodes/node1.json", {}
+ file "nodes/node2.json", {}
- file 'roles/role1.json', {}
- file 'roles/role2.json', {}
- file 'users/user1.json', {}
- file 'users/user2.json', {}
+ file "roles/role1.json", {}
+ file "roles/role2.json", {}
+ file "users/user1.json", {}
+ file "users/user2.json", {}
end
it "knife list -Rfp / returns everything" do
- knife('list -Rp --local --flat /').should_succeed <<-EOM
+ knife("list -Rp --local --flat /").should_succeed <<-EOM
/clients/
/clients/client1.json
/clients/client2.json
@@ -632,15 +632,15 @@ EOM
context "missing file/directory tests" do
it "knife list --local /blarghle reports missing directory" do
- knife('list --local /blarghle').should_fail "ERROR: /blarghle: No such file or directory\n"
+ knife("list --local /blarghle").should_fail "ERROR: /blarghle: No such file or directory\n"
end
it "knife list /roles/blarghle reports missing directory" do
- knife('list --local /roles/blarghle').should_fail "ERROR: /roles/blarghle: No such file or directory\n"
+ knife("list --local /roles/blarghle").should_fail "ERROR: /roles/blarghle: No such file or directory\n"
end
it "knife list /roles/blarghle/blorghle reports missing directory" do
- knife('list --local /roles/blarghle/blorghle').should_fail "ERROR: /roles/blarghle/blorghle: No such file or directory\n"
+ knife("list --local /roles/blarghle/blorghle").should_fail "ERROR: /roles/blarghle/blorghle: No such file or directory\n"
end
end
end
@@ -648,16 +648,16 @@ EOM
when_the_chef_server "is in Enterprise mode", :osc_compat => false, :single_org => false do
before do
- organization 'foo'
+ organization "foo"
end
before :each do
- Chef::Config.chef_server_url = URI.join(Chef::Config.chef_server_url, '/organizations/foo')
+ Chef::Config.chef_server_url = URI.join(Chef::Config.chef_server_url, "/organizations/foo")
end
- context 'and is empty' do
+ context "and is empty" do
it "knife list / returns all top level directories" do
- knife('list /').should_succeed <<-EOM
+ knife("list /").should_succeed <<-EOM
/acls
/clients
/containers
@@ -676,7 +676,7 @@ EOM
end
it "knife list -R / returns everything" do
- knife('list -R /').should_succeed <<-EOM
+ knife("list -R /").should_succeed <<-EOM
/:
acls
clients
@@ -777,8 +777,8 @@ EOM
end
end
- it 'knife list -R / returns everything' do
- knife('list -R /').should_succeed <<-EOM
+ it "knife list -R / returns everything" do
+ knife("list -R /").should_succeed <<-EOM
/:
acls
clients
@@ -880,35 +880,35 @@ EOM
context "has plenty of stuff in it" do
before do
- client 'client1', {}
- client 'client2', {}
- container 'container1', {}
- container 'container2', {}
- cookbook 'cookbook1', '1.0.0'
- cookbook 'cookbook2', '1.0.1', { 'recipes' => { 'default.rb' => '' } }
- data_bag 'bag1', { 'item1' => {}, 'item2' => {} }
- data_bag 'bag2', { 'item1' => {}, 'item2' => {} }
- environment 'environment1', {}
- environment 'environment2', {}
- group 'group1', {}
- group 'group2', {}
- node 'node1', {}
- node 'node2', {}
- org_invite 'user1'
- org_member 'user2'
- policy 'policy1', '1.2.3', {}
- policy 'policy2', '1.2.3', {}
- policy 'policy2', '1.3.5', {}
- policy_group 'policy_group1', { 'policies' => { 'policy1' => { 'revision_id' => '1.2.3' } } }
- policy_group 'policy_group2', { 'policies' => { 'policy2' => { 'revision_id' => '1.3.5' } } }
- role 'role1', {}
- role 'role2', {}
- user 'user1', {}
- user 'user2', {}
+ client "client1", {}
+ client "client2", {}
+ container "container1", {}
+ container "container2", {}
+ cookbook "cookbook1", "1.0.0"
+ cookbook "cookbook2", "1.0.1", { "recipes" => { "default.rb" => "" } }
+ data_bag "bag1", { "item1" => {}, "item2" => {} }
+ data_bag "bag2", { "item1" => {}, "item2" => {} }
+ environment "environment1", {}
+ environment "environment2", {}
+ group "group1", {}
+ group "group2", {}
+ node "node1", {}
+ node "node2", {}
+ org_invite "user1"
+ org_member "user2"
+ policy "policy1", "1.2.3", {}
+ policy "policy2", "1.2.3", {}
+ policy "policy2", "1.3.5", {}
+ policy_group "policy_group1", { "policies" => { "policy1" => { "revision_id" => "1.2.3" } } }
+ policy_group "policy_group2", { "policies" => { "policy2" => { "revision_id" => "1.3.5" } } }
+ role "role1", {}
+ role "role2", {}
+ user "user1", {}
+ user "user2", {}
end
it "knife list -Rfp / returns everything" do
- knife('list -Rfp /').should_succeed <<-EOM
+ knife("list -Rfp /").should_succeed <<-EOM
/acls/
/acls/clients/
/acls/clients/client1.json