Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

reduce flakiness of doSuccesfulLogin #643

Merged
merged 7 commits into from
Feb 22, 2021

Conversation

Vlatombe
Copy link
Member

@Vlatombe Vlatombe commented Feb 18, 2021

I'm seeing regularly flakiness in my ATH such as

Expected: has logged in user tmpuser
     but: tmpuser is not logged in.
	at org.hamcrest.MatcherAssert.assertThat(MatcherAssert.java:20)
	at org.junit.Assert.assertThat(Assert.java:964)
	at org.junit.Assert.assertThat(Assert.java:930)
	at org.jenkinsci.test.acceptance.po.Login.doSuccessfulLogin(Login.java:67)
	at org.jenkinsci.test.acceptance.po.Login.doSuccessfulLogin(Login.java:72)

I think in some cases the current check is not enough and the navigation happens before the login is really completed.

While working on this area, I notices doLoginDespiteNoPaths was useless since doLogin has been changed to not use path since ebdd746. So I deprecated it and removed calls I could find in this ATH.

@Vlatombe Vlatombe changed the title Try to debug flaky logins Improve login assertion Feb 19, 2021
Assert.assertThat(this, loggedInAs(user));
waitFor().withTimeout(30, TimeUnit.SECONDS).until(() -> {
assertThat(this, not(hasInvalidLoginInformation())); // login hasn't failed
return ExpectedConditions.visibilityOfElementLocated(by.id("jenkins")); // redirect has happened
Copy link
Member

Choose a reason for hiding this comment

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

I am wondering if this can happen on other places where we also use clickAndWaitToBecomeStale or until(CapybaraPortingLayerImpl::isStale);

This could likely be the cause (and the fix) of the race condition on creating a new Folder that has been observed a a few times. https://issues.jenkins.io/browse/JENKINS-64358

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes it looks like the same class of issue.

@jtnord jtnord added the fix label Feb 19, 2021
@jtnord jtnord changed the title Improve login assertion reduce flakyness of doSuccesfulLogin Feb 19, 2021
@Vlatombe Vlatombe marked this pull request as ready for review February 19, 2021 14:59
@Vlatombe Vlatombe changed the title reduce flakyness of doSuccesfulLogin reduce flakiness of doSuccesfulLogin Feb 19, 2021
@Vlatombe Vlatombe merged commit 67237e8 into jenkinsci:master Feb 22, 2021
@Vlatombe Vlatombe deleted the flaky-logins branch February 22, 2021 09:59
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants