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

Commit

Permalink
Fixed #757: return http 409 if failed, and use for exit code
Browse files Browse the repository at this point in the history
  • Loading branch information
grtjn committed Jun 8, 2017
1 parent 1326241 commit afaac5d
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 3 deletions.
19 changes: 16 additions & 3 deletions deploy/lib/server_config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1297,12 +1297,25 @@ def test
suites << line.gsub(/.*suite path="([^"]+)".*/, '\1').strip if line.match("suite path")
end

success = true
suites.each do |suite|
r = go(%Q{http://#{@hostname}:#{@properties["ml.test-port"]}/test/default.xqy?func=run&suite=#{url_encode(suite)}&format=junit#{suiteTearDown}#{testTearDown}}, "get")
logger.info r.body
begin
r = go(%Q{http://#{@hostname}:#{@properties["ml.test-port"]}/test/default.xqy?func=run&suite=#{url_encode(suite)}&format=junit#{suiteTearDown}#{testTearDown}}, "get")
logger.info r.body
rescue Net::HTTPServerException => e
if e.response.code.to_i == 409
# ignore 409's, but mark failure
success = false
else
raise # reraise last exception
end
end
end
end
return true
if !success
logger.error "Some tests failed!"
end
return success
end

def test_cleanup
Expand Down
4 changes: 4 additions & 0 deletions src/test/default.xqy
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,10 @@ declare function local:run() {
return
if ($suite) then
let $result := t:run-suite($suite, $tests, $run-suite-teardown, $run-teardown)
let $_ :=
if (fn:number($result/@failed) > 0) then
xdmp:set-response-code(409, "There are failed tests")
else ()
return
if ($format eq "junit") then
local:format-junit($result)
Expand Down

0 comments on commit afaac5d

Please sign in to comment.