-
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
jenkins.getCurrentUser() can use an incorrect context #632
Conversation
Really, this is fixing it???? 😆 |
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 trying to avoid the fallback in
acceptance-test-harness/src/main/java/org/jenkinsci/test/acceptance/po/PageObject.java
Lines 69 to 74 in 6297d94
if (context != null) { | |
return context.getJenkins(); | |
} | |
// TODO try to find the real Jenkins root according to the owner of this object, via breadcrumb | |
// Alternately, Job could have a method to get Jenkins by appending ../../ to its own URL, if not in a folder (need a separate method to find folder owner, but that needs its own page object too) | |
return injector.getInstance(Jenkins.class); |
acceptance-test-harness/src/main/java/org/jenkinsci/test/acceptance/po/PageObject.java
Line 54 in 6297d94
public PageObject(Injector injector, URL url) { |
acceptance-test-harness/src/main/java/org/jenkinsci/test/acceptance/po/Build.java
Lines 36 to 37 in 6297d94
public Build(Job job, int buildNumber) { | |
super(job.injector, job.url("%d/", buildNumber)); |
@jglick yes, that's the issue, while there's only one jenkins instance everything is fine. The problem comes when there are more than one instances implied and you navigate from one to another. Then the fallback retrieves always the same instance: the first one registered. |
Which should be checked for correctness; and, as above, uses of the If you do not plan on fixing other occurrences in this PR, could you at least file a Jira issue to track this? |
I'm more than happy to help with this, but I don't think I can do it in the short term, so I've created https://issues.jenkins.io/browse/JENKINS-64708 |
I am more than happy to merge and release this when the tests finish providing there are no unexpected regressions (which I do not anticipate) |
I've analysed the failing tests. Those are the ones failing in the PR that are not failing in master:
All of them seems to be failing because they don't find an element in UI by css or xpath, but they don't seem to be failing because of the login. |
#631 checks the logged in user by the
getJenkins().getCurrentUser()
. Some internal testing using SSO, probed that method will fail in such situation. The reason is that the injector is retrieving always the same jenkins instance instead of the actual instance where the Login happened.@jtnord @amuniz