mirror of
https://github.com/inspec/inspec
synced 2024-11-10 07:04:15 +00:00
Switched parallel worker env var from N to K. Fixed windows parallel runs.
Signed-off-by: Ryan Davis <zenspider@chef.io>
This commit is contained in:
parent
aa1d0283dd
commit
d431912790
1 changed files with 3 additions and 4 deletions
7
Rakefile
7
Rakefile
|
@ -89,6 +89,7 @@ namespace :test do
|
||||||
# rubocop:disable Style/BlockDelimiters,Layout/ExtraSpacing,Lint/AssignmentInCondition
|
# rubocop:disable Style/BlockDelimiters,Layout/ExtraSpacing,Lint/AssignmentInCondition
|
||||||
|
|
||||||
def n_threads_run(n_workers, jobs)
|
def n_threads_run(n_workers, jobs)
|
||||||
|
require "thread"
|
||||||
queue = Queue.new
|
queue = Queue.new
|
||||||
|
|
||||||
jobs.each do |job|
|
jobs.each do |job|
|
||||||
|
@ -157,21 +158,19 @@ namespace :test do
|
||||||
|
|
||||||
task :isolated do
|
task :isolated do
|
||||||
require "fileutils"
|
require "fileutils"
|
||||||
require "thread"
|
|
||||||
|
|
||||||
# Only needed for local runs, not CI?
|
# Only needed for local runs, not CI?
|
||||||
FileUtils.rm_rf File.expand_path "~/.inspec"
|
FileUtils.rm_rf File.expand_path "~/.inspec"
|
||||||
FileUtils.rm_rf File.expand_path "~/.chef"
|
FileUtils.rm_rf File.expand_path "~/.chef"
|
||||||
|
|
||||||
# 3 seems to be the magic number... (tho not by that much)
|
# 3 seems to be the magic number... (tho not by that much)
|
||||||
bad, good, n = {}, [], (ENV.delete("N") || 3).to_i
|
bad, good, n = {}, [], (ENV.delete("K") || 3).to_i
|
||||||
t0 = Time.now
|
t0 = Time.now
|
||||||
|
|
||||||
srand 42
|
|
||||||
tests = Dir[*GLOBS].sort
|
tests = Dir[*GLOBS].sort
|
||||||
|
|
||||||
n_threads_run n, tests do |path|
|
n_threads_run n, tests do |path|
|
||||||
output = `bundle exec ruby -Ilib:test #{path} 2>&1`
|
output = `bundle exec ruby -Ilib -Itest #{path} 2>&1`
|
||||||
|
|
||||||
if $?.success?
|
if $?.success?
|
||||||
$stderr.print "."
|
$stderr.print "."
|
||||||
|
|
Loading…
Reference in a new issue