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

Let ConfidentialKey & Secret do something from unit tests #4603

Merged
merged 9 commits into from
Mar 28, 2020

Conversation

jglick
Copy link
Member

@jglick jglick commented Mar 26, 2020

Found it frustrating that I could not, for example, call any method on Secret from jshell because ConfidentialStore does not work without Jenkins. Simpler to introduce an in-memory mock for such cases. (DefaultConfidentialStore already has its own test coverage. Leaving ConfidentialStore.TEST to avoid breaking PCT on https://github.com/jenkinsci/credentials-plugin/blob/6f710a7e30156e94aff8a3c6c6799cef04ad35df/src/test/java/jenkins/security/ConfidentialStoreRule.java & https://github.com/jenkinsci/kubernetes-cli-plugin/blob/4f368d86f28a625c8c0c3bf5a4c25304c9d88cfc/src/test/java/jenkins/security/ConfidentialStoreRule.java.)

Proposed changelog entries

  • Developer: Secret and ConfidentialKey implementations can now be used from unit tests without JenkinsRule.

@jglick jglick added internal developer Changes which impact plugin developers labels Mar 26, 2020
@jglick
Copy link
Member Author

jglick commented Mar 27, 2020

Got some test errors in RSAConfidentialKey.getPrivateKey which I cannot reproduce locally, investigating.

…tialStore; this also lets the mock use a fixed seed
@jglick jglick requested a review from jvz March 27, 2020 14:54
@jglick
Copy link
Member Author

jglick commented Mar 27, 2020

Hmm, still seeing CI failures in RSADigitalSignatureConfidentialKeyTest, CryptoConfidentialKeyTest, and RSAConfidentialKeyTest, this time on JDK 11, which I cannot reproduce locally (on either 8 or 11). I have tried to set a predictable RNG seed so I am not getting what is happening here.

@jglick jglick changed the title Delete ConfidentialStoreRule Let ConfidentialKey & Secret do something from unit tests Mar 27, 2020
@jglick
Copy link
Member Author

jglick commented Mar 27, 2020

Flake, presumably:

java.lang.AssertionError
	at hudson.slaves.PingThreadTest.failedPingThreadResetsComputerChannel(PingThreadTest.java:89)

@jglick jglick added the ready-for-merge The PR is ready to go, and it will be merged soon if there is no negative feedback label Mar 27, 2020
@timja
Copy link
Member

timja commented Mar 28, 2020

let's give it one more build

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
developer Changes which impact plugin developers internal ready-for-merge The PR is ready to go, and it will be merged soon if there is no negative feedback
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants