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-73474] Add GitHubAppCredentials.withOwner non regression test #804

Merged
merged 11 commits into from
Oct 8, 2024

Conversation

jeromepochat
Copy link
Contributor

A regression around GitHubAppCredentials.withOwner was introduced since #796.

As a follow-up to the fix, this adds non regression test.

Copy link
Member

@jglick jglick left a comment

Choose a reason for hiding this comment

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

A unit test, OK. What we would really like is an integration test with WireMock of running a multibranch pipeline and having the various involved plugins wire through the Run context that allows withOwner to be called with the right value. That would be a lot more work of course.

@@ -56,40 +55,6 @@ public class GithubAppCredentialsTest extends AbstractGitHubWireMockTest {
private static GitHubAppCredentials appCredentials, appCredentialsNoOwner;
private static LogRecorder logRecorder;

// https://stackoverflow.com/a/22176759/4951015
public static final String PKCS8_PRIVATE_KEY = "-----BEGIN PRIVATE KEY-----\n"
Copy link
Contributor Author

@jeromepochat jeromepochat Sep 27, 2024

Choose a reason for hiding this comment

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

Extracted to GitHubApp for reuse from multiple test classes.

@jeromepochat
Copy link
Contributor Author

jeromepochat commented Sep 27, 2024

👀 why the new test is failing on windows but pass on linux.

Copy link
Member

@jglick jglick left a comment

Choose a reason for hiding this comment

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

Thanks!

multiBranchProject.scheduleBuild2(0, new Action[0]).getFuture().get();

final var branchProject = multiBranchProject.getItem("master");
assertThat(branchProject, notNullValue());
Copy link
Member

Choose a reason for hiding this comment

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

And without the fix, is this the line that fails?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

And without the fix, is this the line that fails?

Yes. I confirm that the test is failing without #803

Comment on lines +9 to +10
private static final String PRIVATE_KEY = "-----BEGIN PRIVATE KEY-----\n"
+
Copy link
Member

Choose a reason for hiding this comment

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

BTW when updating to 2.479.x we can switch to a multiline text block which would be more legible.

@jglick jglick merged commit 11ce4fe into jenkinsci:master Oct 8, 2024
17 checks passed
@jeromepochat jeromepochat deleted the JENKINS-73474 branch October 8, 2024 22:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants