mirror of
https://github.com/ViViDboarder/abuse-the-force.git
synced 2024-11-24 04:46:36 +00:00
Fix message displayed when running tests
Used to show Deploy FAILURE for successful test runs Small bump of version too
This commit is contained in:
parent
2dd2d50781
commit
3e21b34664
@ -7,7 +7,7 @@ module AbuseTheForce
|
|||||||
# Write error to screen
|
# Write error to screen
|
||||||
def self.pute(s, fatal=false)
|
def self.pute(s, fatal=false)
|
||||||
puts "Error: #{s}"
|
puts "Error: #{s}"
|
||||||
|
|
||||||
# If fatal error, exit
|
# If fatal error, exit
|
||||||
if fatal
|
if fatal
|
||||||
exit 1
|
exit 1
|
||||||
@ -56,7 +56,7 @@ module AbuseTheForce
|
|||||||
on_error { |job| puts "Something bad happened!" }.
|
on_error { |job| puts "Something bad happened!" }.
|
||||||
on_poll { |job| puts "Polling for #{job.id}!" }.
|
on_poll { |job| puts "Polling for #{job.id}!" }.
|
||||||
perform
|
perform
|
||||||
|
|
||||||
# Restore old Manifest
|
# Restore old Manifest
|
||||||
FileUtils.move(
|
FileUtils.move(
|
||||||
File.join(Atf_Config.get_project_path, 'package.xml-bak'),
|
File.join(Atf_Config.get_project_path, 'package.xml-bak'),
|
||||||
@ -101,60 +101,68 @@ module AbuseTheForce
|
|||||||
|
|
||||||
if File.file? File.join(dpath, 'package.xml')
|
if File.file? File.join(dpath, 'package.xml')
|
||||||
@client.deploy(File.expand_path(dpath), options).
|
@client.deploy(File.expand_path(dpath), options).
|
||||||
on_complete { |job|
|
on_complete { |job|
|
||||||
puts "Finished deploy #{job.id}!"
|
puts "Finished deploy #{job.id}!"
|
||||||
result = job.result
|
result = job.result
|
||||||
if result != nil
|
if result != nil
|
||||||
|
|
||||||
puts "\nDeploy #{result.success ? "SUCCESS" : "FAILURE"}"
|
# Check if this was a test execution
|
||||||
|
if result.run_test_result != nil
|
||||||
|
|
||||||
# If a failed deploy, print errors
|
# Display a quick Success or Failure
|
||||||
if result.success == false
|
puts "\nTests #{result.run_test_result.num_failures == "0" ? "SUCCESS" : "FAILURE"}"
|
||||||
|
|
||||||
# Need messages in an array
|
# Display overview of number of successes and failures
|
||||||
unless result.messages.kind_of? Array
|
puts "TESTS RUN: #{result.run_test_result.num_tests_run} FAILURES: #{result.run_test_result.num_failures}"
|
||||||
result.messages = [].push result.messages
|
|
||||||
end
|
|
||||||
|
|
||||||
puts "DEPLOY ERRORS: #{result.messages.reject { |m| m.success }.size}"
|
if result.run_test_result.failures != nil
|
||||||
|
|
||||||
result.messages.each do |m|
|
# Make sure failures is an array
|
||||||
|
unless result.run_test_result.failures.kind_of? Array
|
||||||
# If the path is not from the project, fix it
|
result.run_test_result.failures = [].push result.run_test_result.failures
|
||||||
unless m.file_name.starts_with? Atf_Config.src
|
|
||||||
m.file_name = m.file_name.sub(/[a-zA-Z._-]*\//, Atf_Config.src + '/')
|
|
||||||
end
|
end
|
||||||
|
|
||||||
# Print our error in teh format "filename:line:column type in object message"
|
result.run_test_result.failures.each do |m|
|
||||||
if !m.success
|
|
||||||
puts "#{m.file_name}:#{m.line_number}:#{m.column_number} #{m.problem_type} in #{m.full_name} #{m.problem}"
|
# Print our error in teh format "filename:line:column type in object message"
|
||||||
|
if !m.success
|
||||||
|
puts "#{m.name}.#{m.method_name}: #{m.message}"
|
||||||
|
puts "Stack Trace: #{m.stack_trace}"
|
||||||
|
puts ""
|
||||||
|
end # not success
|
||||||
|
end # loop through test faiulres
|
||||||
|
end # failures != nil
|
||||||
|
else # run_test_result != nil
|
||||||
|
|
||||||
|
puts "\nDeploy #{result.success ? "SUCCESS" : "FAILURE"}"
|
||||||
|
|
||||||
|
# Not a test execution, so deployment
|
||||||
|
|
||||||
|
# If a failed deploy, print errors
|
||||||
|
if result.success == false
|
||||||
|
|
||||||
|
# Need messages in an array
|
||||||
|
unless result.messages.kind_of? Array
|
||||||
|
result.messages = [].push result.messages
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
# Need messages in an array
|
puts "DEPLOY ERRORS: #{result.messages.reject { |m| m.success }.size}"
|
||||||
if result.run_test_result != nil
|
|
||||||
|
|
||||||
puts "TESTS RUN: #{result.run_test_result.num_tests_run} FAILURES: #{result.run_test_result.num_failures}"
|
result.messages.each do |m|
|
||||||
|
|
||||||
if result.run_test_result.failures != nil
|
# If the path is not from the project, fix it
|
||||||
|
unless m.file_name.starts_with? Atf_Config.src
|
||||||
unless result.run_test_result.failures.kind_of? Array
|
m.file_name = m.file_name.sub(/[a-zA-Z._-]*\//, Atf_Config.src + '/')
|
||||||
result.run_test_result.failures = [].push result.run_test_result.failures
|
|
||||||
end
|
end
|
||||||
|
|
||||||
result.run_test_result.failures.each do |m|
|
# Print our error in teh format "filename:line:column type in object message"
|
||||||
|
if !m.success
|
||||||
# Print our error in teh format "filename:line:column type in object message"
|
puts "#{m.file_name}:#{m.line_number}:#{m.column_number} #{m.problem_type} in #{m.full_name} #{m.problem}"
|
||||||
if !m.success
|
|
||||||
puts "#{m.name}.#{m.method_name}: #{m.message}"
|
|
||||||
puts "Stack Trace: #{m.stack_trace}"
|
|
||||||
puts ""
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end # success == false
|
||||||
end
|
end # end result.run_test_result != null else
|
||||||
end
|
end # result != nil
|
||||||
}.
|
}.
|
||||||
on_error { |job| puts "Something bad happened!" }.
|
on_error { |job| puts "Something bad happened!" }.
|
||||||
on_poll { |job| puts "Polling for #{job.id}!" }.
|
on_poll { |job| puts "Polling for #{job.id}!" }.
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
module AbuseTheForce
|
module AbuseTheForce
|
||||||
VERSION = '0.1.2'
|
VERSION = '0.1.3'
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user