-
Notifications
You must be signed in to change notification settings - Fork 53
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
Support for evaluating additional test goals #258
Support for evaluating additional test goals #258
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.
@imonteroperez Can you add a description of what is to be fixed by this PR and a bit of context? I known the reason of the change for other reasons, but that does not apply to any other person but me or @bmunozm that may want to review this.
Long story short, we found that when running the PCT for warnings-ng
plugin the results of integration tests of the plugin were not properly recognized by the PCT. Those tests were launched by using maven failsafe plugin and triggered by using this hook
Line 11 in 378f2f9
public abstract class PluginWithIntegrationTestsHook extends PluginCompatTesterHookBeforeExecution { |
I am requesting changes because I disagree with the approach, hook
interface is very simple and generic by purpose, you are adding methods to it to cover the needs of one plugin, not to hook into the default PCT lifecycle (checkout, compile, run tests)
If test results are not properly recognized that is something to be done in a particular hook executed after the tests are run, for example with a preexecution one that prevents default execution from the pct or similar approach, but PCT main code should be perfectly unaware of this.
Also I have my doubts if we should even run those integration tests on the PCT, are the commands used to update test dependencies before surefire:test
also working for failsafe
tests?
/** | ||
* Provides a list of test types executed under the hook (i.e. hooks used to launch other tests rather than surefire. | ||
*/ | ||
default Collection<String> getTestTypes() { |
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.
This is a particular need for some plugins, not part (IMO) of any general build cycle process hook mechanism. I do not believe is a good idea to start adding particular methods to cover particular plugins needs to the base interface of the hook mechanism which is aimed to provide a way to override PCT logic for certain plugins. As such it has to be generic, particular needs can be implemented in each individual hook.
For example, what is the purpose of this method in a precompilehook
or for a precheckout
one?
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.
Added description inside PR and applied your proposal. Thanks a lot! It improved the previous solution design a lot and simplify implementation. Kudos!
*/ | ||
public abstract class PluginWithIntegrationTestsHook extends PluginCompatTesterHookBeforeExecution { | ||
|
||
/** Inform about goals to execute integration tests */ | ||
abstract public Collection<String> getGoals(); |
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.
Are we sure these are not being used outside? Also having nullability annotations would be nice I think.
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.
Yes, AFAIK seems only used here (see also: https://github.com/search?q=PluginWithIntegrationTestsHook&type=code) Added NonNull annotation too here b692261
|
||
for (int j = 0; j < nodeList.getLength(); j++) { | ||
if (nodeList.item(j).getNodeName().equals("skipped")) { | ||
return false; |
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.
So if there is one skipped test, this is saying there are no test failures?
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.
Only the specific test that is skipped will not be considered as a failure. Before this PR it was considered as a failure.
return info; | ||
} | ||
|
||
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.
Extra spaces 😄
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.
Thanks! fixed in a917eb1
Seems PR builder failures are same than |
Enough approvals or time for others to block this, so merging |
This PR provides support for evaluating additional test goals as test results.
Context
warnings-ng
plugin was introduced in the past. See it here.surefire:test
goal) some additional actions are required to provide support for it as well as for others that extendsPluginWithIntegrationTestsHook
in the future in order to evaluate properly the results obtained from the PCT.Problem statement
warnings-ng
it setup it asSUCCESS
because it was only evaluating results forsurefire:test
goal.warnings-ng
plugin needs.Solution and implementation details
PluginWithIntegrationTestsHook
that makes feasible to setup new integration test suites and plugins in an easy way, just providing an implementation for two abstract methods that requires which goals and test types your plugin requires in order to execute integration tests.warnings-ng
:@raul-arabaolaza @bmunozm @fcojfernandez