lib/runner.rb in tdi-0.2.3 vs lib/runner.rb in tdi-0.2.4

- old
+ new

@@ -1,7 +1,7 @@ # -# Copyright (C) 2013-2015 Globo.com +# Copyright (C) 2013-2017 Globo.com # # This file is part of TDI. # TDI is free software: you can redistribute it and/or modify @@ -28,20 +28,20 @@ # Skip reserved roles. # Ex: {"global": {"desc": "...", "acl": {"domain1": {"port": 80}...}...}...} # Ex: {"common": {"desc": "...", "acl": {"domain1": {"port": 80}...}...}...} plan.select { |role_name, role_content| if role_content.is_a?(Hash) - UNTESTABLE_ROLE_LIST.include?(role_name) or role_content['notest'].eql?('true') + UNTESTABLE_ROLE_LIST.include?(role_name) || role_content['notest'].eql?('true') end }.each_pair do |role_name, role_content| puts "Skipping reserved or disabled role: #{role_name}".yellow if opts[:verbose] > 0 end # Remove untestable roles. plan.reject! { |role_name, role_content| if role_content.is_a?(Hash) - UNTESTABLE_ROLE_LIST.include?(role_name) or role_content['notest'].eql?('true') + UNTESTABLE_ROLE_LIST.include?(role_name) || role_content['notest'].eql?('true') end } total_roles = plan.select { |key, val| val.is_a?(Hash) }.size puts "Total roles to run: #{total_roles}".cyan if opts[:verbose] > 1 @@ -100,11 +100,17 @@ # Shred. shred(opts, filename, tdiplan) puts 'Running tests... done.'.green if opts[:verbose] > 1 - ret = tdiplan.plan_passed? ? 0 : 1 + ret = 0 + ret += 1 if tdiplan.fail > 0 + ret += 2 if opts.warnfail? && tdiplan.warn > 0 ret = 0 if opts.nofail? + # 1 if failures + # 2 if warnings (only if -w/--warnfail is active) + # 3 if both (only if -w/--warnfail is active) + # 0 if none or if -n/--nofail is active ret end # Display test summary. def summary(opts, tdiplan)