Testing module with BuildStepMonitor.BUILD

43 views
Skip to first unread message

Gavin

unread,
Oct 26, 2015, 10:10:52 PM10/26/15
to Jenkins Developers
Hey there,

I'm working on a legacy module that has BuildStepMonitor.BUILD.

I was reading
http://javadoc.jenkins-ci.org/hudson/tasks/BuildStep.html#getRequiredMonitorService()
and it says if I'm not using getPreviousBuild, then I can safely change it.

I'm not 100% sure the code (
https://github.com/jenkinsci/sauce-ondemand-plugin/blob/master/src/main/java/hudson/plugins/sauce_ondemand/SauceOnDemandTestPublisher.java#L70)
is actually not doing something simular.

Is there a set of jobs or tests or something I can download to confirm this
behavior won't be broken if i change it?

Gavin

Jesse Glick

unread,
Oct 27, 2015, 8:10:50 AM10/27/15
to Jenkins Dev
On Mon, Oct 26, 2015 at 10:10 PM, Gavin <hal...@gmail.com> wrote:
> I'm working on a legacy module that has BuildStepMonitor.BUILD.
>
> I was reading
> http://javadoc.jenkins-ci.org/hudson/tasks/BuildStep.html#getRequiredMonitorService()
> and it says if I'm not using getPreviousBuild, then I can safely change it.

As a rule, yes. Even if it is using `getPreviousBuild`, you can
probably change it to `NONE`, you just need to look a little more
closely.
It is not. Maven projects are weird. This is just saying: for a given
build of the moduleset (in general, a reactor project), look up the
last build of each module, and collect its test reports. Now the last
build of each module might have been built from this reactor build, or
it might be older (if some reactor builds skipped modules), or it
might be newer (if some individual module builds were rerun). I think
`getModuleBuilds` only supplies the same-or-older module builds.

At any rate, this publisher does not seem to need to wait for a
previous reactor build to complete in order to be correct, so use
`NONE`.

> Is there a set of jobs or tests or something I can download to confirm this
> behavior won't be broken if i change it?

Unless the plugin happened to have extensive functional tests, no.
Reply all
Reply to author
Forward
0 new messages