Skip to content

Commit

Permalink
fix duplicate testing when unique suite name
Browse files Browse the repository at this point in the history
Signed-off-by: Victoria Jeffrey <vjeffrey@chef.io>
  • Loading branch information
Victoria Jeffrey committed Nov 3, 2016
1 parent 035e9a5 commit 1ac5843
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions lib/kitchen/verifier/inspec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -125,10 +125,27 @@ def local_suite_files
Pathname.new(base).exist? ? [base] : []
end

# Returns true if the local_suite_files and config[:inspec_tests] are
# pointing to the same directory
# @return [true] if test suites are duplicates
# @api private
def check_for_duplicates(local_suite_files, inspec_tests)
if local_suite_files[0]
local = local_suite_files[0].split('/').last(3).join('/')
return true if inspec_tests.include?(local)
end
false
end

# Returns an array of test profiles
# @return [Array<String>] array of suite directories or remote urls
# @api private
def collect_tests
puts 'local suite files', local_suite_files
puts 'config inspec tests', config[:inspec_tests]
# if check for duplicates returns true, only send back the value for config[:inspec_tests]
return config[:inspec_tests] if check_for_duplicates(local_suite_files, config[:inspec_tests])

# get local tests and get run list of profiles
(local_suite_files + config[:inspec_tests]).compact
end
Expand Down

0 comments on commit 1ac5843

Please sign in to comment.