Fix CertificateFixture error if previous test fails#10749
Merged
Conversation
b844640 to
7128673
Compare
7128673 to
25816e4
Compare
yhabteab
reviewed
Mar 11, 2026
This doesn't fix any concrete errors in master, but if tests ever get reordered for some reason and the tlsutility tests run before the http tests, they will leave broken certificates behind. This could be solved by cleaning up manually in the tests, but that again could cause issues if the tlsutility tests ever run in the middle of the http ones. The proper solution is using a CTest fixture to establish a dependency where the tlsutility tests always run before the tests using a new CTest fixture that provides the cleanup between these test groups.
25816e4 to
b72ad49
Compare
yhabteab
previously approved these changes
Mar 11, 2026
b72ad49 to
e153e6d
Compare
yhabteab
approved these changes
Mar 12, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This fixes an issue where a when a test-case using the
CertificateFixturefails, it causes the next test using this fixture to also fail.Problem
Originally,
CertificateFixtureused a symlink to a persistent directory containing the certificates generated over the course of a test run. Then it was changed to move the directory from the persistent store to the working directory and back, to fix testing on Windows without admin accounts. This is fine when the tests all pass, but if one fails, it doesn't move the directory back, which not only forces the tests to regenerate all certificates, but it also fails the test next in line, because it tries to remove the remainder directory withboost::filesystem::removeinstead ofboost::filesystem::remove_all.Though no test runs failed because of this that didn't fail anyway, it caused initial confusion what is actually going wrong.
Solution
The certificates are now copied back and forth instead of moving the directory and the cleanup step now deletes recursively instead of relying on the directory being empty. While this potentially causes slightly more disk activity than moving or symlinking, it shouldn't be significant compared to the overall build.
Additional Changes
This PR also adds a new CTest fixture to enforce ordering between the tlsutility tests and the other tests that use TLS certificates. This was necessary with the now fixed removal of the temporary directories in between each test.
This also solves a potential problem where if the tests are reordered the tlsutility tests leave broken certificates and CA behind. The new fixture forces the tests to run into an order where first the tlsutility tests run, then cleanup happens and then the other tests that aren't breaking certificates will run.