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

Standardized & simplified & updated build & test infrastructure #307

Merged
merged 7 commits into from
Apr 19, 2023

Conversation

jglick
Copy link
Member

@jglick jglick commented Dec 16, 2022

Wanted to try consuming jenkinsci/scm-api-plugin#180 but that first requires having basic dependencies be reasonably up to date, which they are not and the reliance on the analysis-pom parent makes it far harder to do routine maintenance like we do typical Jenkins plugins. The use of the plugin-util-api test dependency also causes serious structural problems making it hard to update the POM. (jenkinsci/bom#1521 (comment) for context)

Would supersede #306 & #305 & #304 & #302 & #265.

@jglick

This comment was marked as outdated.

@jglick jglick changed the title Sketch of standardized POM Standardized & simplified & updated build & test infrastructure Dec 16, 2022
@AnalyzeClasses(packages = "io.jenkins.plugins..")
class ArchitectureTest {
@ArchTest
static final ArchRule NO_JENKINS_INSTANCE_CALL = PluginArchitectureRules.NO_JENKINS_INSTANCE_CALL;
Copy link
Member Author

Choose a reason for hiding this comment

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

Whatever this stuff was doing, it can presumably be dropped without anyone noticing.

*/
@RunWith(Parameterized.class)
@SuppressWarnings({"PMD.ExcessiveImports", "checkstyle:ClassDataAbstractionCoupling", "rawtypes", "checkstyle:ClassFanOutComplexity", "checkstyle:JavaNCSS"})
public class GitHubChecksPublisherITest extends IntegrationTestWithJenkinsPerTest {
Copy link
Member Author

Choose a reason for hiding this comment

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

This IntegrationTestWithJenkinsPerTest is the problem. Should be rewritten to use just stuff provided by jenkins-test-harness.

*/
@Test
public void shouldRetrieveContextFromPipeline() {
WorkflowJob job = createPipeline();
Copy link
Member Author

Choose a reason for hiding this comment

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

Here for example. What is wrong with the usual r.createProject(WorkflowJob.class)?

import org.jenkinsci.plugins.github_branch_source.GitHubSCMSourceContext;
import org.junit.jupiter.api.Test;

import static io.jenkins.plugins.util.assertions.Assertions.assertThat;
Copy link
Member Author

Choose a reason for hiding this comment

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

A custom version of assertThat?? Just use Hamcrest.

@jglick
Copy link
Member Author

jglick commented Apr 14, 2023

@timja any advice here?

@timja
Copy link
Member

timja commented Apr 14, 2023

@timja any advice here?

this #325 ?

pom.xml Outdated
<scope>import</scope>
<type>pom</type>
</dependency>
<dependency> <!-- TODO pending https://github.com/jenkinsci/github-branch-source-plugin/pull/624 -->
Copy link
Member

Choose a reason for hiding this comment

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

@timja
Copy link
Member

timja commented Apr 14, 2023

@timja any advice here?

or is the question more about the deleting of all of the integration tests in the plugin?

@codecov
Copy link

codecov bot commented Apr 14, 2023

Codecov Report

Merging #307 (a6d3079) into master (f4c1127) will decrease coverage by 30.42%.
The diff coverage is n/a.

@@              Coverage Diff              @@
##             master     #307       +/-   ##
=============================================
- Coverage     80.79%   50.38%   -30.42%     
+ Complexity      170      114       -56     
=============================================
  Files            16       16               
  Lines           526      526               
  Branches         49       49               
=============================================
- Hits            425      265      -160     
- Misses           79      246      +167     
+ Partials         22       15        -7     

see 10 files with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@jglick
Copy link
Member Author

jglick commented Apr 14, 2023

is the question more about the deleting of all of the integration tests in the plugin?

Yeah, that is the only thing I found that would work. Do you have a better idea?

@timja
Copy link
Member

timja commented Apr 17, 2023

Yeah, that is the only thing I found that would work. Do you have a better idea?

Switch to the default parent pom but leave the plugin-util-api dependency? Can drop the architecture test if needed but not sure if we should drop all integration tests...

@timja timja marked this pull request as ready for review April 19, 2023 07:28
@timja timja requested a review from a team as a code owner April 19, 2023 07:28
@timja
Copy link
Member

timja commented Apr 19, 2023

After trying this myself I see that the issue is that plugin-util-api now uses junit5 for all it's tests.

It would be non-trivial to re-write to junit5 I think.
Likely easier to rewrite to JTH without the plugin-util-api wrapper.

I'll give that a quick go and if that's not something I have time for I'll merge this.

fyi @uhafner

@timja timja merged commit 7b8e246 into jenkinsci:master Apr 19, 2023
@timja
Copy link
Member

timja commented Apr 19, 2023

Shipping to unblock you, can look at the tests separately

Copy link
Member

@uhafner uhafner left a comment

Choose a reason for hiding this comment

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

I don't see a problem to switch the parent pom.

But I don't understand the reasoning for deleting all the valuable tests, degenerating the coverage but such a huge amount:

Bildschirmfoto 2023-04-19 um 09 47 45

This makes absolutely no sense.

@uhafner
Copy link
Member

uhafner commented Apr 19, 2023

Later equals never! 👎

@uhafner
Copy link
Member

uhafner commented Apr 19, 2023

Why are you requesting a review and then merge such a change before the review happens?

@timja
Copy link
Member

timja commented Apr 19, 2023

Why are you requesting a review and then merge such a change before the review happens?

I plan to look at this today / tomorrow but I didn't want to block @jglick any longer in case it takes longer. It's on top of my list and I've filed some of my notes from looking at it this morning in #329

@uhafner
Copy link
Member

uhafner commented Apr 19, 2023

Shouldn't this be done by the author of this PR?

@timja
Copy link
Member

timja commented Apr 19, 2023

Later equals never! 👎

😄 I've made good progress in here:
#332

I found another complexity is that github-branch-source has had some changes which has broken some of the mocking assumptions in this plugin.

I've fixed all but one test in that test class and just need to do some debugging to finish it off. Hopefully other tests will be straightforward to port.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants