2
0
Fork 0
mirror of https://github.com/inspec/inspec synced 2024-12-23 03:23:27 +00:00
inspec/test/functional/inspec_clear_cache_test.rb
Nick Schwaderer cbe105bbe0 Handles edge cases for parallelization
Signed-off-by: Nick Schwaderer <nschwaderer@chef.io>
2021-03-16 15:41:55 -04:00

27 lines
732 B
Ruby

require "functional/helper"
require "securerandom"
describe "inspec check" do
include FunctionalHelper
parallelize_me!
describe "inspec clear_cache" do
it "clears any existing cache" do
dirname = File.expand_path("~/.inspec/#{SecureRandom.hex(10)}/alt-cache")
unless File.directory?(dirname)
FileUtils.mkdir_p(dirname)
end
newfile = "#{dirname}/#{SecureRandom.hex(10)}.txt"
File.write(newfile, SecureRandom.hex(100))
assert !Dir.glob(newfile).empty?
out = inspec("clear_cache --vendor-cache=#{dirname}")
assert_empty Dir.glob(newfile)
assert_exit_code 0, out
_(out.stdout).must_include "== InSpec cache cleared successfully ==\n"
end
end
end