You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@groovy.apache.org by pa...@apache.org on 2020/11/30 01:12:04 UTC
[groovy] branch GROOVY_3_0_X updated: make test more resilient on
CI servers
This is an automated email from the ASF dual-hosted git repository.
paulk pushed a commit to branch GROOVY_3_0_X
in repository https://gitbox.apache.org/repos/asf/groovy.git
The following commit(s) were added to refs/heads/GROOVY_3_0_X by this push:
new b0ad1e3 make test more resilient on CI servers
b0ad1e3 is described below
commit b0ad1e3c07f6e7e5ee3da6b5071d8d1c4d546cb3
Author: Paul King <pa...@asert.com.au>
AuthorDate: Mon Nov 30 11:11:44 2020 +1000
make test more resilient on CI servers
---
src/test/groovy/bugs/Groovy8060Bug.groovy | 33 ++++++++++++++++++++-----------
1 file changed, 21 insertions(+), 12 deletions(-)
diff --git a/src/test/groovy/bugs/Groovy8060Bug.groovy b/src/test/groovy/bugs/Groovy8060Bug.groovy
index a41f4c3..c430d27 100644
--- a/src/test/groovy/bugs/Groovy8060Bug.groovy
+++ b/src/test/groovy/bugs/Groovy8060Bug.groovy
@@ -22,20 +22,29 @@ import groovy.test.GroovyTestCase
class Groovy8060Bug extends GroovyTestCase {
void testLoggingWithinClosuresThatAreMethodArgsShouldHaveGuards() {
- assertScript '''
- @Grab('org.slf4j:slf4j-simple:1.7.30')
- import groovy.util.logging.Slf4j
+ int retry = 3 // flaky on CI servers, so retry if needed
+ boolean success = false
+ while (retry-- > 0 && !success) {
+ try {
+ assertScript '''
+ @Grab('org.slf4j:slf4j-simple:1.7.30')
+ import groovy.util.logging.Slf4j
- @Slf4j
- class LogMain {
- public static int count = 0
+ @Slf4j
+ class LogMain {
+ public static int count = 0
- static void main(args) {
- assert !log.isTraceEnabled()
- 1.times { log.trace("${count++}") }
- assert !count
- }
+ static void main(args) {
+ assert !log.isTraceEnabled()
+ 1.times { log.trace("${count++}") }
+ assert !count
+ }
+ }
+ '''
+ success = true
+ } catch(Exception ignore) {
+ sleep 100
}
- '''
+ }
}
}