summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorThom May <thom@chef.io>2016-07-21 16:40:27 +0100
committerThom May <thom@chef.io>2016-07-26 13:27:24 +0100
commit01d6650793e51ad1bdb5309fea49464c2335365d (patch)
treeed8009be851cd5a7abd4b278efa3aa66c16f7983 /spec
parentff9d72e533a5a5e5afa53d4cf9a8feef3078925f (diff)
downloadchef-01d6650793e51ad1bdb5309fea49464c2335365d.tar.gz
Cache ChefFS childrentm/cache_fs_children
Signed-off-by: Thom May <thom@chef.io>
Diffstat (limited to 'spec')
-rw-r--r--spec/integration/knife/diff_spec.rb4
-rw-r--r--spec/integration/knife/download_spec.rb8
-rw-r--r--spec/integration/knife/raw_spec.rb2
-rw-r--r--spec/integration/knife/upload_spec.rb6
-rw-r--r--spec/spec_helper.rb4
-rw-r--r--spec/support/shared/integration/knife_support.rb4
6 files changed, 19 insertions, 9 deletions
diff --git a/spec/integration/knife/diff_spec.rb b/spec/integration/knife/diff_spec.rb
index b7d2f4d1c3..b3bd23f48e 100644
--- a/spec/integration/knife/diff_spec.rb
+++ b/spec/integration/knife/diff_spec.rb
@@ -72,7 +72,7 @@ EOM
file "data_bags/x/y.json", {}
file "environments/_default.json", { "description" => "The default Chef environment" }
file "environments/x.json", {}
- file "nodes/x.json", {}
+ file "nodes/x.json", { "normal" => { "tags" => [] } }
file "roles/x.json", {}
file "users/admin.json", { "admin" => true, "public_key" => ChefZero::PUBLIC_KEY }
file "users/x.json", { "public_key" => ChefZero::PUBLIC_KEY }
@@ -366,7 +366,7 @@ EOM
file "data_bags/x/y.json", {}
file "environments/_default.json", { "description" => "The default Chef environment" }
file "environments/x.json", {}
- file "nodes/x.json", {}
+ file "nodes/x.json", { "normal" => { "tags" => [] } }
file "roles/x.json", {}
file "users/admin.json", { "admin" => true, "public_key" => ChefZero::PUBLIC_KEY }
file "users/x.json", { "public_key" => ChefZero::PUBLIC_KEY }
diff --git a/spec/integration/knife/download_spec.rb b/spec/integration/knife/download_spec.rb
index a924226ea2..be0fc9d708 100644
--- a/spec/integration/knife/download_spec.rb
+++ b/spec/integration/knife/download_spec.rb
@@ -76,7 +76,7 @@ EOM
file "data_bags/x/y.json", {}
file "environments/_default.json", { "description" => "The default Chef environment" }
file "environments/x.json", {}
- file "nodes/x.json", {}
+ file "nodes/x.json", { "normal" => { "tags" => [] } }
file "roles/x.json", {}
file "users/admin.json", { "admin" => true, "public_key" => ChefZero::PUBLIC_KEY }
file "users/x.json", { "public_key" => ChefZero::PUBLIC_KEY }
@@ -645,7 +645,7 @@ EOM
file "data_bags/x/y.json", {}
file "environments/_default.json", { "description" => "The default Chef environment" }
file "environments/x.json", {}
- file "nodes/x.json", {}
+ file "nodes/x.json", { "normal" => { "tags" => [] } }
file "roles/x.json", {}
file "users/admin.json", { "admin" => true, "public_key" => ChefZero::PUBLIC_KEY }
file "users/x.json", { "public_key" => ChefZero::PUBLIC_KEY }
@@ -1271,7 +1271,7 @@ EOM
file "groups/x.json", {}
file "invitations.json", [ "foo" ]
file "members.json", [ "bar" ]
- file "nodes/x.json", {}
+ file "nodes/x.json", { "normal" => { "tags" => [] } }
file "org.json", { "full_name" => "Something" }
file "policies/x-1.0.0.json", {}
file "policies/blah-1.0.0.json", {}
@@ -1295,7 +1295,7 @@ EOM
file "environments/x.json", { "description" => "foo" }
file "groups/x.json", { "description" => "foo" }
file "groups/x.json", { "groups" => [ "admin" ] }
- file "nodes/x.json", { "run_list" => [ "blah" ] }
+ file "nodes/x.json", { "normal" => { "tags" => [] }, "run_list" => [ "blah" ] }
file "org.json", { "full_name" => "Something Else " }
file "policies/x-1.0.0.json", { "run_list" => [ "blah" ] }
file "policy_groups/x.json", {
diff --git a/spec/integration/knife/raw_spec.rb b/spec/integration/knife/raw_spec.rb
index 9078bf09a1..5e0d3a3d11 100644
--- a/spec/integration/knife/raw_spec.rb
+++ b/spec/integration/knife/raw_spec.rb
@@ -49,7 +49,9 @@ describe "knife raw", :workstation do
},
"normal": {
+ "tags": [
+ ]
},
"default": {
diff --git a/spec/integration/knife/upload_spec.rb b/spec/integration/knife/upload_spec.rb
index 55c95b59b7..1db0ea8726 100644
--- a/spec/integration/knife/upload_spec.rb
+++ b/spec/integration/knife/upload_spec.rb
@@ -96,7 +96,7 @@ EOM
file "data_bags/x/y.json", {}
file "environments/_default.json", { "description" => "The default Chef environment" }
file "environments/x.json", {}
- file "nodes/x.json", {}
+ file "nodes/x.json", { "normal" => { "tags" => [] } }
file "roles/x.json", {}
file "users/admin.json", { "admin" => true, "public_key" => ChefZero::PUBLIC_KEY }
file "users/x.json", { "public_key" => ChefZero::PUBLIC_KEY }
@@ -802,7 +802,7 @@ EOM
file "data_bags/x/y.json", {}
file "environments/_default.json", { "description" => "The default Chef environment" }
file "environments/x.json", {}
- file "nodes/x.json", {}
+ file "nodes/x.json", { "normal" => { "tags" => [] } }
file "roles/x.json", {}
file "users/admin.json", { "admin" => true, "public_key" => ChefZero::PUBLIC_KEY }
file "users/x.json", { "public_key" => ChefZero::PUBLIC_KEY }
@@ -1313,7 +1313,7 @@ EOM
file "invitations.json", [ "foo" ]
file "members.json", [ "bar" ]
file "org.json", { "full_name" => "wootles" }
- file "nodes/x.json", {}
+ file "nodes/x.json", { "normal" => { "tags" => [] } }
file "policies/x-1.0.0.json", {}
file "policies/blah-1.0.0.json", {}
file "policy_groups/x.json", { "policies" => { "x" => { "revision_id" => "1.0.0" }, "blah" => { "revision_id" => "1.0.0" } } }
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index 44a599436c..dcbc34a157 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -66,6 +66,8 @@ require "chef/util/file_edit"
require "chef/config"
+require "chef/chef_fs/file_system_cache"
+
if ENV["CHEF_FIPS"] == "1"
Chef::Config.init_openssl
end
@@ -202,6 +204,8 @@ RSpec.configure do |config|
config.before(:each) do
Chef.reset!
+ Chef::ChefFS::FileSystemCache.instance.reset!
+
Chef::Config.reset
# By default, treat deprecation warnings as errors in tests.
diff --git a/spec/support/shared/integration/knife_support.rb b/spec/support/shared/integration/knife_support.rb
index 398d90dff0..01df9ab1a7 100644
--- a/spec/support/shared/integration/knife_support.rb
+++ b/spec/support/shared/integration/knife_support.rb
@@ -20,6 +20,7 @@ require "chef/knife"
require "chef/application/knife"
require "logger"
require "chef/log"
+require "chef/chef_fs/file_system_cache"
module KnifeSupport
DEBUG = ENV["DEBUG"]
@@ -70,6 +71,9 @@ module KnifeSupport
Chef::Config[:verbosity] = ( DEBUG ? 2 : 0 )
instance.config[:config_file] = File.join(CHEF_SPEC_DATA, "null_config.rb")
+ # Ensure the ChefFS cache is empty
+ Chef::ChefFS::FileSystemCache.instance.reset!
+
# Configure chef with a (mostly) blank knife.rb
# We set a global and then mutate it in our stub knife.rb so we can be
# extra sure that we're not loading someone's real knife.rb and then