Refactor diskcertmanager tests for determinism and maintainability
#6589
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.
The TestTLSConfig test in the diskcertmanager package failed again in CI: https://github.com/spiffe/spire/actions/runs/21166557075/job/60872657392#step:5:413
Multiple previous attempts to fix this test revealed that its design (using a complex pattern of shared goroutine state, mock clocks, and log assertions) is inherently difficult to make reliably deterministic. Last attempt was #6570.
This PR completely refactors the diskcertmanager test suite. The refactored tests separate concerns by introducing three distinct test functions: TestNew for initialization scenarios, TestSyncCertificateFiles for unit testing the sync logic directly without goroutines, and TestWatchFileChanges for integration testing of the ticker behavior.
I looked at the test coverage to make sure that the refactor keeps the same coverage as before (94.6%)