mirror of
https://github.com/inspec/inspec
synced 2024-11-10 07:04:15 +00:00
Build the InSpec gem directly in Kitchen so we can run locally
Before you had to kick off kitchen via Rake as the Rake task build the local gem we injected into the cookbook. Now we do it within Test Kitchen using a feature that didn't exist when this was all written. Also --output is your friend and greatly reduces the complexity of all this. Signed-off-by: Tim Smith <tsmith@chef.io>
This commit is contained in:
parent
77f0efd1e8
commit
a05699c5c3
4 changed files with 13 additions and 13 deletions
14
Rakefile
14
Rakefile
|
@ -138,19 +138,7 @@ namespace :test do
|
|||
concurrency = ENV['CONCURRENCY'] || 1
|
||||
os = args[:os] || ENV['OS'] || ''
|
||||
ENV['DOCKER'] = 'true' if ENV['docker'].nil?
|
||||
puts "Building current InSpec gem for audit cookbook testing..."
|
||||
output = %x[gem build inspec-core.gemspec]
|
||||
puts output
|
||||
gem_name = output.split("\n")[-1].split(':')[1].strip
|
||||
path = File.dirname(__FILE__)
|
||||
File.rename(File.join(path, gem_name), File.join(path, 'inspec-core-local.gem'))
|
||||
destination = File.join(path, 'test', 'cookbooks', 'os_prepare', 'files', 'inspec-core-local.gem')
|
||||
begin
|
||||
FileUtils.cp(File.join(path, 'inspec-core-local.gem'), destination)
|
||||
sh("bundle exec kitchen test -c #{concurrency} #{os}")
|
||||
ensure
|
||||
FileUtils.rm(destination)
|
||||
end
|
||||
sh("bundle exec kitchen test -c #{concurrency} #{os}")
|
||||
end
|
||||
# Inject a prerequisite task
|
||||
task :'integration' => [:accept_license]
|
||||
|
|
|
@ -9,6 +9,10 @@ verifier:
|
|||
name: inspec
|
||||
sudo: true
|
||||
|
||||
lifecycle:
|
||||
pre_converge:
|
||||
- local: gem build inspec-core.gemspec --output test/cookbooks/os_prepare/files/inspec-core-local.gem
|
||||
|
||||
platforms:
|
||||
# The following (private) boxes are shared via VagrantCloud and are only
|
||||
# available to users working for Chef. Sorry, it's about software licensing.
|
||||
|
|
|
@ -9,6 +9,10 @@ verifier:
|
|||
name: inspec
|
||||
sudo: true
|
||||
|
||||
lifecycle:
|
||||
pre_converge:
|
||||
- local: gem build inspec-core.gemspec --output test/cookbooks/os_prepare/files/inspec-core-local.gem
|
||||
|
||||
platforms:
|
||||
- name: centos-6
|
||||
- name: centos-7
|
||||
|
|
|
@ -7,6 +7,10 @@ driver:
|
|||
transport:
|
||||
name: dokken
|
||||
|
||||
lifecycle:
|
||||
pre_converge:
|
||||
- local: gem build inspec-core.gemspec --output test/cookbooks/os_prepare/files/inspec-core-local.gem
|
||||
|
||||
provisioner:
|
||||
name: dokken
|
||||
client_rb:
|
||||
|
|
Loading…
Reference in a new issue