Skip to content

Use waitForMessage in tests to reduce flakes#110

Merged
dwnusbaum merged 1 commit intojenkinsci:masterfrom
timja:use-wait-for-message
Apr 20, 2020
Merged

Use waitForMessage in tests to reduce flakes#110
dwnusbaum merged 1 commit intojenkinsci:masterfrom
timja:use-wait-for-message

Conversation

@timja
Copy link
Copy Markdown
Member

@timja timja commented Mar 4, 2020

Hi we're experiencing flakey tests trying to integrate the next bom line,

example:

Expected: a string containing "broken condition"
     but: was "Started
Running in Durability level: MAX_SURVIVABILITY
[Pipeline] Start of Pipeline
[Pipeline] waitUntil
[Pipeline] {
[Pipeline] semaphore
[Pipeline] }
Will try again after 0.25 sec
[Pipeline] {
[Pipeline] semaphore
[Pipeline] }
[Pipeline] // waitUntil
[Pipeline] End of Pipeline

@jglick suggested replacing assertLogContains with waitForMessage
jenkinsci/bom#110 (comment)

Copy link
Copy Markdown
Member

@jglick jglick left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@timja timja force-pushed the use-wait-for-message branch from 1e32e37 to 405a03f Compare March 5, 2020 19:46
@timja timja requested a review from jglick March 5, 2020 19:46
@@ -98,7 +98,7 @@ public class WaitForConditionStepTest {
// TODO the following fails (missing message) when run as part of whole suite, but not standalone: story.j.assertLogContains(message, story.j.assertBuildStatus(Result.FAILURE, story.j.waitForCompletion(b)));
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(possibly now obsolete)

@jglick
Copy link
Copy Markdown
Member

jglick commented Apr 8, 2020

You also need to handle

java.lang.AssertionError: 

Expected: a string containing "caught error"
     but: was "Started
Running in Durability level: MAX_SURVIVABILITY
[Pipeline] Start of Pipeline
[Pipeline] End of Pipeline
"
	at org.hamcrest.MatcherAssert.assertThat(MatcherAssert.java:18)
	at org.junit.Assert.assertThat(Assert.java:956)
	at org.junit.Assert.assertThat(Assert.java:923)
	at org.jvnet.hudson.test.JenkinsRule.assertLogContains(JenkinsRule.java:1402)
	at org.jenkinsci.plugins.workflow.steps.CatchErrorStepTest.assertCatchError(CatchErrorStepTest.java:241)
	at org.jenkinsci.plugins.workflow.steps.CatchErrorStepTest.optionalMessage(CatchErrorStepTest.java:120)

jglick added a commit to jglick/bom that referenced this pull request Apr 8, 2020
Copy link
Copy Markdown
Contributor

@bitwiseman bitwiseman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will timeout if the message is not found right? So, super slow if it fails. Just want to make sure I understand.

@timja
Copy link
Copy Markdown
Member Author

timja commented Apr 9, 2020

@jglick
Copy link
Copy Markdown
Member

jglick commented Apr 9, 2020

super slow if it fails

At most 3m.

@jglick
Copy link
Copy Markdown
Member

jglick commented Apr 9, 2020

Integrating jenkinsci/jenkins-test-harness#210 would also suffice.

@dwnusbaum dwnusbaum merged commit 9b3dde3 into jenkinsci:master Apr 20, 2020
@jglick
Copy link
Copy Markdown
Member

jglick commented Apr 20, 2020

or now, simply parent 4.1+

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants