diff options
author | Hunter Haugen <hunter@puppetlabs.com> | 2014-05-02 14:15:52 -0700 |
---|---|---|
committer | Hunter Haugen <hunter@puppetlabs.com> | 2014-05-02 14:15:52 -0700 |
commit | e962b9553b8d79b36faa90ef6e002649820208a3 (patch) | |
tree | 5b634bfcd63ce60c36ae394cdbe7faf3fcabb900 | |
parent | 7443e8b80562295abd856bd0642e6e28a2fcf4bb (diff) | |
parent | 226cc7653c468afecf70ca3cdc8594ba874998db (diff) | |
download | puppet-stdlib-e962b9553b8d79b36faa90ef6e002649820208a3.tar.gz puppet-stdlib-e962b9553b8d79b36faa90ef6e002649820208a3.tar.bz2 |
Merge pull request #246 from hunner/update_build_csv
Update build_csv to understand contexts
-rw-r--r-- | spec/acceptance/build_csv.rb | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/spec/acceptance/build_csv.rb b/spec/acceptance/build_csv.rb index 556d1f8..62ecbf1 100644 --- a/spec/acceptance/build_csv.rb +++ b/spec/acceptance/build_csv.rb @@ -1,7 +1,6 @@ #!/usr/bin/env ruby # vim: set sw=2 sts=2 et tw=80 : require 'rspec' -require 'pry' #XXX Super ugly hack to keep from starting beaker nodes module Kernel @@ -44,15 +43,30 @@ def get_tests(children) end end +def count_test_types_in(type,group) + return 0 if group.nil? + group.inject(0) do |m,(k,v)| + m += v.length if k == type + m += count_tests_in(v) if v.is_a?(Hash) + m + end +end +def count_tests_in(group) + count_test_types_in('tests',group) +end +def count_pending_tests_in(group) + count_test_types_in('pending_tests',group) +end + # Convert tests hash to csv format def to_csv(function_list,tests) function_list.collect do |function_name| if v = tests["#{function_name} function"] - positive_tests = v["groups"]["success"] ? v["groups"]["success"]["tests"].length : 0 - negative_tests = v["groups"]["failure"] ? v["groups"]["failure"]["tests"].length : 0 + positive_tests = count_tests_in(v["groups"]["success"]) + negative_tests = count_tests_in(v["groups"]["failure"]) pending_tests = - (v["groups"]["failure"] ? v["groups"]["success"]["pending_tests"].length : 0) + - (v["groups"]["failure"] ? v["groups"]["failure"]["pending_tests"].length : 0) + count_pending_tests_in(v["groups"]["failure"]) + + count_pending_tests_in(v["groups"]["failure"]) else positive_tests = 0 negative_tests = 0 |