mirror of
https://github.com/inspec/inspec
synced 2025-02-18 15:08:44 +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",
|
"--parallel",
|
||||||
"--only=InSpec/Deprecations,InSpec/Deprecations/AttributeHelper,InSpec/Deprecations/AttributeDefault",
|
"--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
|
spec.fail_on_error = false
|
||||||
end
|
end
|
||||||
rescue LoadError
|
rescue LoadError
|
||||||
puts "Rubocop is not available. Install the rubocop gem to run the lint tests."
|
puts "Rubocop is not available. Install the rubocop gem to run the lint tests."
|
||||||
end
|
end
|
||||||
|
begin
|
||||||
stdout = StringIO.new
|
stdout = StringIO.new
|
||||||
$stdout = stdout
|
$stdout = stdout
|
||||||
Rake::Task["cookstyle_lint"].invoke
|
Rake::Task["cookstyle_lint"].invoke
|
||||||
$stdout = STDOUT
|
$stdout = STDOUT
|
||||||
Rake.application["cookstyle_lint"].reenable
|
Rake.application["cookstyle_lint"].reenable
|
||||||
stdout.string
|
stdout.string
|
||||||
|
rescue => e
|
||||||
|
puts "Cookstyle lint checks could not be performed. Error while running cookstyle - #{e}"
|
||||||
|
""
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# Check if the profile is internally well-structured. The logger will be
|
# Check if the profile is internally well-structured. The logger will be
|
||||||
|
|
|
@ -235,6 +235,14 @@ module FunctionalHelper
|
||||||
end
|
end
|
||||||
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
|
private
|
||||||
|
|
||||||
def assemble_env_prefix(env = {})
|
def assemble_env_prefix(env = {})
|
||||||
|
|
|
@ -102,7 +102,7 @@ describe "inspec archive" do
|
||||||
end
|
end
|
||||||
|
|
||||||
it "vendors dependencies by default" do
|
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 = inspec("archive " + dir + " --output " + dst.path)
|
||||||
|
|
||||||
_(out.stderr).must_equal ""
|
_(out.stderr).must_equal ""
|
||||||
|
|
|
@ -155,7 +155,7 @@ describe "example inheritance profile" do
|
||||||
end
|
end
|
||||||
|
|
||||||
it "use lockfile in tarball" do
|
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
|
# ensure the profile is vendored and packaged as tar
|
||||||
out = inspec("vendor " + dir + " --overwrite")
|
out = inspec("vendor " + dir + " --overwrite")
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue