-
Notifications
You must be signed in to change notification settings - Fork 237
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
Make check of logged-in user independent of UI #631
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IIUC uses
acceptance-test-harness/src/main/java/org/jenkinsci/test/acceptance/po/User.java
Lines 45 to 56 in ca473c8
super(context, context.url("me/")); | |
} | |
public User(Jenkins context, String name) { | |
super(context, context.url("user/%s/", name)); | |
} | |
private void load() { | |
if (id != null) return; | |
try { | |
JsonNode json = getJson(); | |
id = json.get("id").asText(); |
When the user is not valid, the Already Fixed |
@@ -201,7 +201,8 @@ public boolean matchesSafely(PageObject item) { | |||
@Override | |||
public boolean matchesSafely(final Jenkins jenkins) { | |||
final User currentUser = jenkins.getCurrentUser(); | |||
return currentUser != null && currentUser.id().equals(user); | |||
// if the user is not logged, currentUser can be not null with a null id | |||
return currentUser != null && currentUser.id() != null && currentUser.id().equals(user); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
or just
return currentUser != null && currentUser.id() != null && currentUser.id().equals(user); | |
return currentUser != null && user.equals(currentUser.id()); |
I suppose
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that was my first intention, but after a search I couldn't be 100% sure that user
will be always non-null. I can commit the suggestion if you prefer
There are currently 264 test failures in master, this PR has 330. Is the diff because of this change? |
After analysing the failures (and I'm not experienced on the plugins whose tests are failing and I might be wrong):
The details:
|
Plot plugin is known to be broken on weeklies. It should probably be removed from ATH, I don't think it meets the threshold for what should be here. |
Great. Thanks @fcojfernandez! I'm merging now. |
Making the check of the logged user using Jenkins API instead the UI, so the check is more robust in case something is not well rendered.
@bmunozm @EstherAF
@jtnord I think you're the new maintainer?