Skip to content

Commit

Permalink
chore: testAcceptance finalizer always run (#1201)
Browse files Browse the repository at this point in the history
- fix an issue that finalizer does not run when test failed

Signed-off-by: Hiroshi Miura <[email protected]>
  • Loading branch information
miurahr authored Nov 30, 2024
1 parent 63f59dc commit d47fb99
Showing 1 changed file with 15 additions and 8 deletions.
23 changes: 15 additions & 8 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -1666,6 +1666,20 @@ def isCommandAvailable(command) {
}.exitValue == 0
}

def testAcceptanceFinally = tasks.register('testAcceptanceFinally') {
outputs.upToDateWhen { return false } // always run
doLast {
def display = project.hasProperty("testDisplay") ? project.getProperty("testDisplay") : ""
if (!display.isEmpty()) {
def pid = ext.has('xvfbPid') ? ext.xvfbPid : null
if (pid != null) {
stopX(pid)
ext.xfvgPid = null
}
}
}
}

tasks.register('testAcceptance', Test) {
onlyIf {
isCommandAvailable('Xvfb') || project.hasProperty("acceptanceTestLive")
Expand All @@ -1680,14 +1694,7 @@ tasks.register('testAcceptance', Test) {
}
}
}
doLast {
if (!display.isEmpty()) {
def pid = ext.has('xvfbPid') ? ext.xvfbPid : null
if (pid != null) {
stopX(pid)
}
}
}
finalizedBy testAcceptanceFinally

description = 'Run Acceptance GUI test'
group = 'verification'
Expand Down

0 comments on commit d47fb99

Please sign in to comment.