Skip to content

Commit

Permalink
Improve AbstractConsoleBuildResultFunctionalTest patterns
Browse files Browse the repository at this point in the history
We saw a lot of flaky tests in this test class. This commit improves
the patterns to reduce the flakiness.
  • Loading branch information
blindpirate committed Mar 7, 2019
1 parent d7addcc commit bbb1c3a
Showing 1 changed file with 5 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ abstract class AbstractConsoleBuildResultFunctionalTest extends AbstractConsoleG
then:
result.assertRawOutputContains(successMessage)
LogContent.of(result.output).removeAnsiChars().withNormalizedEol().matches """(?s).*
BUILD SUCCESSFUL in \\d+s\\n?
BUILD SUCCESSFUL in \\d+s\\n*
2 actionable tasks: 2 executed
.*"""

Expand All @@ -62,7 +62,7 @@ BUILD SUCCESSFUL in \\d+s\\n?
then:
result.assertRawOutputContains(successMessage)
LogContent.of(result.output).removeAnsiChars().withNormalizedEol().matches """(?s).*
BUILD SUCCESSFUL in \\d+s\\n?
BUILD SUCCESSFUL in \\d+s\\n*
2 actionable tasks: 1 executed, 1 up-to-date
.*"""
}
Expand Down Expand Up @@ -95,9 +95,8 @@ BUILD SUCCESSFUL in \\d+s\\n?
succeeds('success')

then:
LogContent.of(result.output).removeAnsiChars().withNormalizedEol().matches """(?s).*build finished
BUILD SUCCESSFUL in \\d+s\\n?
LogContent.of(result.output).removeAnsiChars().withNormalizedEol().matches """(?s).*build finished\\n*
BUILD SUCCESSFUL in \\d+s\\n*
1 actionable task: 1 executed
.*"""
}
Expand All @@ -124,7 +123,7 @@ BUILD SUCCESSFUL in \\d+s\\n?
// Check that the failure text appears either stdout or stderr
def outputWithFailure = errorsShouldAppearOnStdout() ? failure.output : failure.error
def outputWithoutFailure = errorsShouldAppearOnStdout() ? failure.error : failure.output
def outputWithFailureAndNoDebugging = LogContent.of(outputWithFailure).removeBlankLines().removeAnsiChars().removeDebugPrefix().withNormalizedEol()
def outputWithFailureAndNoDebugging = LogContent.of(outputWithFailure).removeAnsiChars().removeDebugPrefix().removeBlankLines().withNormalizedEol()

outputWithFailure.contains("Build failed with an exception.")
outputWithFailureAndNoDebugging.contains("""
Expand Down

0 comments on commit bbb1c3a

Please sign in to comment.