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

ARTEMIS-5340 ensure PEM provider is truly optional #5547

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

jbertram
Copy link
Contributor

@jbertram jbertram commented Mar 5, 2025

No description provided.

@jbertram jbertram marked this pull request as draft March 6, 2025 15:29
@jbertram jbertram force-pushed the ARTEMIS-5340 branch 3 times, most recently from 0edfed3 to 81de28f Compare March 6, 2025 16:04
Comment on lines 44 to 45
// ensure the PEM provider wasn't already loaded by some other test
Assumptions.assumeFalse(Arrays.stream(ClassLoader.getSystemClassLoader().getDefinedPackages()).anyMatch(pkg -> PEM_PROVIDER_PACKAGE.equals(pkg.getName())));
Copy link
Member

@gemmellr gemmellr Mar 6, 2025

Choose a reason for hiding this comment

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

Would be better to make it an assertion and let it fail when it needs to, to serve as notice the two tests are clashing and need to be ordered or isolated from each other to fix the problem.

With an assumption, if some other new test is created and runs first, then this test will just start skipping and the 'dont load it to let it be removed if not used' effect the test verifies could be broken without noticing, unless someone spots the extra skip beginning to occur. Might as well not have a test at that point.

Its a requirement for the test to exist that it be run before the first other test in the module to use it, but its not a reason to optionally run the test or not. We always want to run it, but should check the requirement was satisfied at the start, the same way the test checks it at the end currently.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

Comment on lines 60 to 80
public void testPemProviderPackageName() {
assertEquals(PEM_PROVIDER_PACKAGE, PemKeyStoreProvider.class.getPackageName());
assertNotNull(ClassLoader.getSystemClassLoader().getDefinedPackage(PEM_PROVIDER_PACKAGE));
}
Copy link
Member

Choose a reason for hiding this comment

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

I think a better test would be loading the provider the way its normally to be loaded, by using SSLSupport to load a pem keystore (the other test could also load a non-pem keystore to similarly check that does not load the pem provider), instead of just directly loading the class.

The 'check the correct package is looked for' could still be done, just as the last thing the test does as a form of confirmation. Or it could be a third test.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I added a couple of new tests to verify loading keystores in addition to the static use.

@jbertram jbertram marked this pull request as ready for review March 6, 2025 20:06
@clebertsuconic
Copy link
Contributor

LGTM

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

Successfully merging this pull request may close these issues.

5 participants