summaryrefslogtreecommitdiff
path: root/features
diff options
context:
space:
mode:
authorDaniel DeLeo <dan@opscode.com>2010-09-29 18:59:18 -0700
committerDaniel DeLeo <dan@opscode.com>2010-09-29 19:01:22 -0700
commit1f33f7a55c9ceb6de2af2cdf1885ca0f6a1a3896 (patch)
tree8325d6a2b805316a0fb5a92ed5935a4ddcbf9038 /features
parentb90034296afb461f7979a54f9a5ec685e92a7e2d (diff)
downloadchef-1f33f7a55c9ceb6de2af2cdf1885ca0f6a1a3896.tar.gz
[CHEF-1397] add integration test for checksum cache cleanup
Diffstat (limited to 'features')
-rw-r--r--features/chef-client/cleanup_checksum_cache.feature20
-rw-r--r--features/data/config/client_with_checksum_caching.rb23
-rw-r--r--features/steps/run_client_steps.rb6
3 files changed, 49 insertions, 0 deletions
diff --git a/features/chef-client/cleanup_checksum_cache.feature b/features/chef-client/cleanup_checksum_cache.feature
new file mode 100644
index 0000000000..6b60ccbf30
--- /dev/null
+++ b/features/chef-client/cleanup_checksum_cache.feature
@@ -0,0 +1,20 @@
+@client @checksum_cache @checksum_cache_cleanup @chef_1397
+Feature: Cleanup checksum cache
+ In order to not use all of the available inodes on the filesystem with unneeded files
+ As a sysadmin
+ I want Chef to remove unused checksum cache files
+
+ Scenario: Remove cached file checksums that are no longer needed
+ Given a validated node
+ And it includes the recipe 'template'
+ When I run the chef-client with '-l info' and the 'client_with_checksum_caching' config
+ Then the run should exit '0'
+ Given it includes no recipes
+ When I run the chef-client with '-l debug' and the 'client_with_checksum_caching' config
+ Then the run should exit '0'
+ And 'stdout' should have 'removing unused checksum cache file .*chef\-file\-\-.*\-\-chef\-rendered\-template.*'
+
+
+# for example:
+# DEBUG: removing unused checksum cache file /Users/ddeleo/opscode/chef/features/data/tmp/checksum_cache/chef-file--var-folders-Ui-UiODstTvGJm3edk+EIMyf++++TI--Tmp--chef-rendered-template20100929-40338-1rjvhyc-0
+
diff --git a/features/data/config/client_with_checksum_caching.rb b/features/data/config/client_with_checksum_caching.rb
new file mode 100644
index 0000000000..581c22d796
--- /dev/null
+++ b/features/data/config/client_with_checksum_caching.rb
@@ -0,0 +1,23 @@
+supportdir = File.expand_path(File.join(File.dirname(__FILE__), ".."))
+tmpdir = File.expand_path(File.join(File.dirname(__FILE__), "..", "tmp"))
+
+log_level :error
+log_location STDOUT
+file_cache_path File.join(tmpdir, "cache")
+ssl_verify_mode :verify_none
+registration_url "http://127.0.0.1:4000"
+template_url "http://127.0.0.1:4000"
+remotefile_url "http://127.0.0.1:4000"
+search_url "http://127.0.0.1:4000"
+role_url "http://127.0.0.1:4000"
+client_url "http://127.0.0.1:4000"
+chef_server_url "http://127.0.0.1:4000"
+validation_client_name "validator"
+systmpdir = File.expand_path(File.join(Dir.tmpdir, "chef_integration"))
+validation_key File.join(systmpdir, "validation.pem")
+client_key File.join(systmpdir, "client.pem")
+cache_type "BasicFile"
+cache_options({:path => File.join(tmpdir, "checksum_cache")})
+
+Ohai::Config[:disabled_plugins] << 'darwin::system_profiler' << 'darwin::kernel' << 'darwin::ssh_host_key' << 'network_listeners'
+Ohai::Config[:disabled_plugins ]<< 'darwin::uptime' << 'darwin::filesystem' << 'dmi' << 'lanuages' << 'perl' << 'python' << 'java'
diff --git a/features/steps/run_client_steps.rb b/features/steps/run_client_steps.rb
index f574cf57c8..183b000f11 100644
--- a/features/steps/run_client_steps.rb
+++ b/features/steps/run_client_steps.rb
@@ -52,6 +52,12 @@ When /^I run the chef\-client with '(.+)'$/ do |args|
When "I run the chef-client"
end
+When "I run the chef-client with '$options' and the '$config_file' config" do |options, config_file|
+ @config_file = File.expand_path(File.join(configdir, "#{config_file}.rb"))
+ @chef_args = options
+ When "I run the chef-client"
+end
+
When /^I run the chef\-client with '(.+)' for '(.+)' seconds$/ do |args, run_for|
@chef_args = args
When "I run the chef-client for '#{run_for}' seconds"