mirror of
https://github.com/inspec/inspec
synced 2024-11-26 14:40:26 +00:00
Build fix for archive and vendor tests due to cookstyle offenses
Signed-off-by: Nikita Mathur <nikita.mathur@chef.io>
This commit is contained in:
parent
ab1d423a35
commit
1de38f3b13
4 changed files with 22 additions and 9 deletions
|
@ -404,18 +404,23 @@ module Inspec
|
|||
"--parallel",
|
||||
"--only=InSpec/Deprecations,InSpec/Deprecations/AttributeHelper,InSpec/Deprecations/AttributeDefault",
|
||||
]
|
||||
spec.patterns += Dir.glob("#{@target}/**/*").reject { |f| File.directory?(f) || (f.include? "inspec.lock") }
|
||||
spec.patterns += Dir.glob("#{@target}/**/*.rb").reject { |f| File.directory?(f) }
|
||||
spec.fail_on_error = false
|
||||
end
|
||||
rescue LoadError
|
||||
puts "Rubocop is not available. Install the rubocop gem to run the lint tests."
|
||||
end
|
||||
stdout = StringIO.new
|
||||
$stdout = stdout
|
||||
Rake::Task["cookstyle_lint"].invoke
|
||||
$stdout = STDOUT
|
||||
Rake.application["cookstyle_lint"].reenable
|
||||
stdout.string
|
||||
begin
|
||||
stdout = StringIO.new
|
||||
$stdout = stdout
|
||||
Rake::Task["cookstyle_lint"].invoke
|
||||
$stdout = STDOUT
|
||||
Rake.application["cookstyle_lint"].reenable
|
||||
stdout.string
|
||||
rescue => e
|
||||
puts "Cookstyle lint checks could not be performed. Error while running cookstyle - #{e}"
|
||||
""
|
||||
end
|
||||
end
|
||||
|
||||
# Check if the profile is internally well-structured. The logger will be
|
||||
|
|
|
@ -235,6 +235,14 @@ module FunctionalHelper
|
|||
end
|
||||
end
|
||||
|
||||
def prepare_profiles(dir = nil, &block)
|
||||
Dir.mktmpdir do |tmpdir|
|
||||
FileUtils.cp_r(profile_path, tmpdir)
|
||||
bn = File.basename(profile_path)
|
||||
yield(File.join(tmpdir, bn, dir.to_s))
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def assemble_env_prefix(env = {})
|
||||
|
|
|
@ -102,7 +102,7 @@ describe "inspec archive" do
|
|||
end
|
||||
|
||||
it "vendors dependencies by default" do
|
||||
prepare_examples("meta-profile") do |dir|
|
||||
prepare_profiles("dependencies/inheritance") do |dir|
|
||||
out = inspec("archive " + dir + " --output " + dst.path)
|
||||
|
||||
_(out.stderr).must_equal ""
|
||||
|
|
|
@ -155,7 +155,7 @@ describe "example inheritance profile" do
|
|||
end
|
||||
|
||||
it "use lockfile in tarball" do
|
||||
prepare_examples("meta-profile") do |dir|
|
||||
prepare_profiles("dependencies/inheritance") do |dir|
|
||||
# ensure the profile is vendored and packaged as tar
|
||||
out = inspec("vendor " + dir + " --overwrite")
|
||||
|
||||
|
|
Loading…
Reference in a new issue