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

Fix opt-in for Maven Failsafe plugin #462

Merged
merged 1 commit into from
Feb 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package org.jenkins.tools.test.hook;

import java.util.Map;
import java.util.Set;
import org.jenkins.tools.test.model.PomData;

/**
* Custom execution hook for plugins whose parent is {@code org.jvnet.hudson.plugins:analysis-pom}.
* These plugins use Maven Failsafe Plugin in their test suites.
*/
public class AnalysisPomExecutionHook extends PluginWithFailsafeIntegrationTestsHook {
Copy link
Member

@jtnord jtnord Feb 17, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CloudBees' has no internal users of PluginWithFailsafeIntegrationTestsHook (nee PluginWithFailsafeIntegrationTestsHook)

And as implemented PluginWithFailsafeIntegrationTestsHook is incorrect as to be generic it should be executing pre-integration-test then integration-test and finally post-integration-test.

the analysis-pom's configuration of failsafe does not follow this generic nature as it is not spinning anything up.

Perhaps it is worth just removing PluginWithFailsafeIntegrationTestsHook and then inlining getGoals here in a way that is specific to Ulli's usage.

Suggested change
public class AnalysisPomExecutionHook extends PluginWithFailsafeIntegrationTestsHook {
public class AnalysisPomExecutionHook extends PluginWithIntegrationTestsHook {


private static final Set<String> ARTIFACT_IDS =
Set.of(
"analysis-model-api",
"bootstrap5-api",
"checks-api",
"echarts-api",
"font-awesome-api",
"forensics-api",
"jquery3-api",
"plugin-util-api",
"popper2-api");

@Override
public boolean check(Map<String, Object> info) {
PomData data = (PomData) info.get("pomData");
return "io.jenkins.plugins".equals(data.groupId)
&& ARTIFACT_IDS.contains(data.artifactId)
&& "hpi".equals(data.getPackaging());
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
}
}
@Override
public Collection<String> getGoals() {
return List.of("failsafe:integration-test");
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
* Workaround for those plugins with integration tests since they need execute the
* failsafe:integration-test goal before execution.
*/
public class PluginWithFailsafeIntegrationTestsHook extends PluginWithIntegrationTestsHook {
public abstract class PluginWithFailsafeIntegrationTestsHook
extends PluginWithIntegrationTestsHook {

@Override
public Collection<String> getGoals() {
Expand Down