Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

[JENKINS-31516] Run re-index on children on organization re-index #20

Merged
merged 4 commits into from Dec 9, 2015

Conversation

@amuniz
Copy link
Member

commented Nov 12, 2015

@reviewbybees

This comment has been minimized.

Copy link

commented Nov 12, 2015

This pull request originates from a CloudBees employee. At CloudBees, we require that all pull requests be reviewed by other CloudBees employees before we seek to have the change accepted. If you want to learn more about our process please see this explanation.

@tfennelly

This comment has been minimized.

Copy link
Member

commented Nov 12, 2015

🐝

1 similar comment
@oleg-nenashev

This comment has been minimized.

Copy link
Member

commented Nov 12, 2015

🐝

@jglick

This comment has been minimized.

Copy link
Member

commented Nov 12, 2015

A test would be nice but 🐝

@jenkinsadmin

This comment has been minimized.

Copy link
Member

commented Nov 12, 2015

Thank you for a pull request! Please check this document for how the Jenkins project handles pull requests

@recena

This comment has been minimized.

Copy link
Collaborator

commented Dec 2, 2015

👍 to add a new test

@jglick

This comment has been minimized.

Copy link
Member

commented Dec 2, 2015

Well, if you have time to write a test (verifying that it fails in the expected way with your fix commented out), that would be great, otherwise you are free to merge as is.

@recena

This comment has been minimized.

Copy link
Collaborator

commented Dec 2, 2015

🐝

public static class BranchProjectFactoryImpl extends BranchProjectFactory<FreeStyleProject, FreeStyleBuild> {

@Override
public FreeStyleProject newInstance(Branch branch) {
FreeStyleProject job = new FreeStyleProject(getOwner(), branch.getName());
job.onCreatedFromScratch();

This comment has been minimized.

Copy link
@amuniz

amuniz Dec 4, 2015

Author Member

I don't like this, but if I remove it then I get:

Dec 04, 2015 12:31:02 PM hudson.model.Executor finish1
SEVERE: Executor threw an exception
java.lang.AssertionError
    at jenkins.model.lazy.LazyBuildMixIn.createBuildRunMap(LazyBuildMixIn.java:139)
    at jenkins.model.lazy.LazyBuildMixIn.onCreatedFromScratch(LazyBuildMixIn.java:96)
    at hudson.model.AbstractProject.onCreatedFromScratch(AbstractProject.java:310)
    at com.cloudbees.hudson.plugins.folder.computed.ComputedFolder$1.created(ComputedFolder.java:171)
    at jenkins.branch.MultiBranchProject$1.observe(MultiBranchProject.java:351)
    at jenkins.scm.impl.SingleSCMSource.retrieve(SingleSCMSource.java:99)
    at jenkins.scm.api.SCMSource.fetch(SCMSource.java:143)
    at jenkins.branch.MultiBranchProject.computeChildren(MultiBranchProject.java:295)
    at com.cloudbees.hudson.plugins.folder.computed.ComputedFolder.updateChildren(ComputedFolder.java:151)
    at com.cloudbees.hudson.plugins.folder.computed.FolderComputation.run(FolderComputation.java:106)
    at hudson.model.ResourceController.execute(ResourceController.java:98)
    at hudson.model.Executor.run(Executor.java:374)

Any idea?

This comment has been minimized.

Copy link
@jglick

jglick Dec 4, 2015

Member

Not sure, something you need to debug. The Javadoc for newInstance explicit forbids you from calling onCreatedFromScratch, since this is called by MultiBranchProject.

@amuniz

This comment has been minimized.

Copy link
Member Author

commented Dec 4, 2015

Added a test. If the fix is commented out, the test fails // @recena @jglick

synchronized (rootDir) {
int limit = 0;
while (limit < 5) {
rootDir.wait(1000);

This comment has been minimized.

Copy link
@jglick

jglick Dec 4, 2015

Member

Huh?? Who is notifying a File?

This comment has been minimized.

Copy link
@amuniz

amuniz Dec 4, 2015

Author Member

Nobody, it just waits for 1 second (5 in total) for the message to appear, then returns or assert unconditionally.

This comment has been minimized.

Copy link
@jglick

jglick Dec 4, 2015

Member

🐜 So why not use Thread.sleep?

@jglick

This comment has been minimized.

Copy link
Member

commented Dec 4, 2015

🐛 for the stray call to onCreatedFromScratch.

@amuniz

This comment has been minimized.

Copy link
Member Author

commented Dec 4, 2015

@jglick

bug for the stray call to onCreatedFromScratch.

Caught! 😄 Mockito.spy on FreestyleProject was mocking the call to onCreatedFromScratch too, which is obviously not desired.

@@ -65,7 +75,23 @@ public void configRoundTrip() throws Exception {
assertEquals(MockFactory.class, projectFactories.get(0).getClass());
assertEquals(MockFactory.class, projectFactories.get(1).getClass());
}
@TestExtension("configRoundTrip")

@Test

This comment has been minimized.

Copy link
@jglick

jglick Dec 4, 2015

Member

🐜 missing @Issue


top.setDescription("Org folder test");
top = r.configRoundtrip(top);
waitForLogFileMessage("Indexing multibranch project: stuff", logs);

This comment has been minimized.

Copy link
@jglick

jglick Dec 4, 2015

Member

🐜 I think rather than waiting for log messages, you can call getIndexing().getTimestamp() and compare to the original.

This comment has been minimized.

Copy link
@amuniz

amuniz Dec 4, 2015

Author Member

I think it is worth to keep it as I found this pattern useful in other tests when there was no other way to check for something happening.

@jglick

This comment has been minimized.

Copy link
Member

commented Dec 4, 2015

🐝

@amuniz

This comment has been minimized.

Copy link
Member Author

commented Dec 9, 2015

jglick added a commit that referenced this pull request Dec 9, 2015
Merge pull request #20 from amuniz/schedule-build-on-indexing
[JENKINS-31516] Run re-index on children on organization re-index

@jglick jglick merged commit e1cf1f4 into jenkinsci:master Dec 9, 2015

1 check passed

Jenkins This pull request looks good
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
7 participants
You can’t perform that action at this time.