Skip to content
This repository has been archived by the owner on Jul 20, 2022. It is now read-only.

Commit

Permalink
Add test failure status.
Browse files Browse the repository at this point in the history
Adds support for test failure tracking. Test failures (failure
to run a test suite like Torpedo or Tempest) will now get tracked as
'TestFail' instead of just a normal 'Failure'.

Includes a pink hexagon icon to help highlight these failures in
the UI.
  • Loading branch information
dprince committed Aug 19, 2013
1 parent 46c818a commit e8155b9
Show file tree
Hide file tree
Showing 8 changed files with 28 additions and 6 deletions.
Binary file added app/assets/images/test_fail.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions app/helpers/application_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ def status_image(status, show_image = true)

image_name = case status
when "BuildFail" then "build_fail"
when "TestFail" then "test_fail"
when "Failed" then "failed"
when "Running" then "running"
when "Success" then "success"
Expand Down
3 changes: 3 additions & 0 deletions app/models/job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,9 @@ def self.stream(stdout, stderr)
elsif $status.exitstatus == 3
job.update_attribute(:status, "BuildFail")
return false
elsif $status.exitstatus == 4
job.update_attribute(:status, "TestFail")
return false
else
job.update_attribute(:status, "Failed")
return false
Expand Down
4 changes: 4 additions & 0 deletions app/models/job_group.rb
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ def update_status
status = 'BuildFail'
break
end
if job.status == 'TestFail' then
status = 'TestFail'
break
end
if job.status == 'Running' then
status = 'Running'
break
Expand Down
6 changes: 6 additions & 0 deletions app/templates/common.sh.erb
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,12 @@ function build_fail {
exit 3 # special exit status for build failure
}

function test_fail {
local MSG=$1
echo "FAILURE_MSG=$MSG"
exit 4 # special exit status for test failures (Torpedo, Tempest, etc)
}

function git_clone {
local URL=${1:?"Please specify a URL."}
local DIR=${2:?"Please specify a DIR."}
Expand Down
6 changes: 3 additions & 3 deletions app/templates/puppet_runner.sh.erb
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ stop_metric
export TORPEDO_IMAGE_NAME=${TORPEDO_IMAGE_NAME:-"ami-tty"}

rake torpedo:fire SERVER_NAME="$TEST_SUITE_SERVER_NAME" || \
{ rake tail_logs; fail "Hit by Torpedo."; }
{ rake tail_logs; test_fail "Hit by Torpedo."; }
stop_metric
fi

Expand All @@ -134,15 +134,15 @@ stop_metric
rake nova:smoke_tests_fedora \
SERVER_NAME="$TEST_SUITE_SERVER_NAME" \
NO_VOLUME="$SMOKE_TESTS_DISABLE_VOLUME" || \
{ rake tail_logs; fail "Smoke tests failed."; }
{ rake tail_logs; test_fail "Smoke tests failed."; }
stop_metric
fi

# run Tempest
if [ -n "$RUN_TEMPEST" ]; then
start_metric "Tempest Smoke"
rake tempest SERVER_NAME="$TEST_SUITE_SERVER_NAME" || \
{ rake tail_logs; fail "Caught in a Tempest."; }
{ rake tail_logs; test_fail "Caught in a Tempest."; }
stop_metric
fi

Expand Down
6 changes: 3 additions & 3 deletions app/templates/puppet_xen_runner.sh.erb
Original file line number Diff line number Diff line change
Expand Up @@ -166,23 +166,23 @@ EOF_RESERVE_IPS
export TORPEDO_TEST_HARD_REBOOT=${TORPEDO_TEST_HARD_REBOOT:-"true"}

rake torpedo:fire SERVER_NAME="$TEST_SUITE_SERVER_NAME" MODE=xen || \
{ rake tail_logs; fail "Hit by Torpedo."; }
{ rake tail_logs; test_fail "Hit by Torpedo."; }
stop_metric
fi

# run smoke tests (Not currently supported)
#if [ -n "$RUN_NOVA_SMOKE_TESTS" ]; then
#start_metric "Nova Smoke Tests"
#rake nova:smoke_tests_fedora SERVER_NAME="$TEST_SUITE_SERVER_NAME" NO_VOLUME=true || \
#{ rake tail_logs; fail "Smoke tests failed."; }
#{ rake tail_logs; test_fail "Smoke tests failed."; }
#stop_metric
#fi

# run Tempest
if [ -n "$RUN_TEMPEST" ]; then
start_metric "Tempest Smoke"
rake tempest SERVER_NAME="$TEST_SUITE_SERVER_NAME" || \
{ rake tail_logs; fail "Caught in a Tempest."; }
{ rake tail_logs; test_fail "Caught in a Tempest."; }
stop_metric
fi

Expand Down
8 changes: 8 additions & 0 deletions test/unit/job_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,14 @@ class JobTest < ActiveSupport::TestCase
assert_equal "", job.stderr
end

test "verify test failure exit status" do
assert !Job.run_job(jobs(:one), nil, "exit 4")
job = Job.find(jobs(:one).id)
assert_equal "TestFail", job.status
assert_equal "", job.stdout
assert_equal "", job.stderr
end

test "update job status updates smoke test status" do
job = jobs(:one)
job.update_attributes(
Expand Down

0 comments on commit e8155b9

Please sign in to comment.